core: add self-hosted weekly dashboard and machine workers
Reuse the existing weekly pace, reset history and daily budgets across multiple machines without multiplying shared account quota. Coordinate profile-bound official CLI logins through transient authorization responses while keeping provider credentials local to each CLI. Release as version 1.2.0. Refs #19
This commit is contained in:
+54
-4
@@ -7,7 +7,7 @@ the IDs instead of restating the text. The requirements (R1 to R7) are in
|
||||
|
||||
## D1 — .NET 10, C# 14 and NativeAOT for win-x64 and linux-x64
|
||||
|
||||
**Decision.** Every shipped executable (the app, the CLI and the Stream Deck plugin) targets
|
||||
**Decision.** Every shipped executable (the app, the CLI, Stream Deck plugin and optional web/worker hosts) targets
|
||||
`net10.0` with C# 14 and publishes NativeAOT for `win-x64` and `linux-x64`. `global.json` asks
|
||||
for SDK 10.0.100 or newer within 10.0 (`rollForward: latestFeature`), so the SDK from CachyOS's
|
||||
package manager works too. Builds treat warnings as errors and run the trim and AOT analyzers.
|
||||
@@ -20,8 +20,10 @@ serialization, binding or loading, or runtime code generation.
|
||||
|
||||
## D2 — The CLIs are the only interface to a provider
|
||||
|
||||
**Decision.** FinalToken never reads, stores, logs or sends a credential (OAuth token, API key,
|
||||
cookie). It never opens a provider login and never calls a provider's HTTP API itself. It reads
|
||||
**Decision.** FinalToken never reads, stores, logs or sends a provider access/refresh token,
|
||||
API key or cookie. It can invoke an official CLI login and transiently relay the browser's
|
||||
authorization response to that exact pending process ([D14](#d14--self-hosted-dashboard-and-workers)).
|
||||
It never calls a provider's HTTP API itself. It reads
|
||||
the files the CLIs write and runs the installed `claude` and `codex` executables as child
|
||||
processes, which use their own login. It never opens credential files such as
|
||||
`~/.claude/.credentials.json` or `~/.codex/auth.json`, or the OS keychain. Only counts, model
|
||||
@@ -32,6 +34,7 @@ working.
|
||||
**Why.** R2, R3.
|
||||
|
||||
**Gives up.** Whatever the CLIs do not expose, and limit data while a CLI is not installed.
|
||||
Login coordination needs the installed CLI's supported flow; no central credential pool is possible.
|
||||
|
||||
## D3 — Claude data sources
|
||||
|
||||
@@ -299,7 +302,8 @@ week's start and the id of the limit window it follows (`weekStart`, `weekWindow
|
||||
the current instance of the provider's weekly limit: its longest window over a day whose label
|
||||
names no model family. Without one, it is the local calendar week from Monday, and `weekWindow`
|
||||
is absent. The DTOs and their source-generated JSON context live in `FinalToken.Core`, shared by
|
||||
the app, the CLI and the Stream Deck plugin. Nothing listens on a socket or runs an HTTP server. A reader treats a
|
||||
the app, the CLI and the Stream Deck plugin. The optional separate dashboard/worker hosts use
|
||||
[D14](#d14--self-hosted-dashboard-and-workers); the desktop app itself has no server. A reader treats a
|
||||
snapshot older than three refresh intervals as stale. The app gives the engine its own path; a
|
||||
CLI refresh keeps the path already in the snapshot, and a snapshot without one has none, so a
|
||||
reader never mistakes its own path for the app's.
|
||||
@@ -310,6 +314,52 @@ calendar week (developer feedback, 2026-10-18).
|
||||
|
||||
**Gives up.** Updates faster than the reader's poll interval.
|
||||
|
||||
## D14 — Self-hosted dashboard and workers
|
||||
|
||||
**Decision.** Add a separate ASP.NET Core slim/NativeAOT-compatible server and an outbound .NET
|
||||
worker per OS user, following the developer's direction in
|
||||
[#19](https://git.finalfactory.de/FinalFactory/FinalToken/issues/19).
|
||||
|
||||
- Account ids, expected emails and machine/profile bindings are configured by the operator.
|
||||
The server has a dashboard access key and distinct per-machine keys. Browser sessions are
|
||||
HttpOnly, SameSite cookies with CSRF checks; remote access uses HTTPS. A worker cannot select
|
||||
another machine's identity or execute arbitrary remote commands.
|
||||
- The dashboard calls Core's D7, D12 and D13 APIs. No second forecasting implementation is added.
|
||||
Local settings remain local; the newest quota observation's profile supplies the pace threshold,
|
||||
hidden windows and freshness interval. Account timezone controls calendar days. No working-hour
|
||||
forecast is added. Old/expired limits are displayed but have no current forecast.
|
||||
- Quota is the newest observed account/window value, never the sum across machines. Consumption
|
||||
uses Claude response ids and ordered Codex session cumulative counts across machine copies.
|
||||
Conflicting event metadata is excluded with a warning. Raw metadata history and observations
|
||||
survive offline clients and restarts; messages and project paths are not exported.
|
||||
- Old hourly history cannot be deduplicated after aggregation. An optional designated source and
|
||||
fixed UTC-hour cutoff import it once; identified source events own the interval after the cutoff.
|
||||
Historical profile/account attribution is an operator assertion; identity probes cannot prove
|
||||
which account produced older transcripts. Use a separate profile/data directory per account.
|
||||
- A login is bound to browser session, machine, OS user, config profile, worker boot and a
|
||||
15-minute maximum attempt deadline. That deadline is not a provider credential expiry.
|
||||
Claude uses `auth login --claudeai` and manual code relay through stdin; Codex uses
|
||||
`login --device-auth`. The CLI exchanges and stores its own credentials. A status probe verifies
|
||||
the resulting email. Unknown identity or account mismatch cannot be reported as success.
|
||||
Responses, URLs and device codes live only in pending-session memory and are not logged.
|
||||
- Cancellation, timeout, worker restart and concurrent attempts have explicit outcomes.
|
||||
No remote localhost callback forwarding or private provider endpoint is implemented.
|
||||
CLI output/flow changes fail visibly and may require terminal login on that machine.
|
||||
- The worker reuses the local store and scanner. Claude's legacy D3 print-mode quota probe is
|
||||
opt-in: current official documentation does not promise that slash commands in print mode are
|
||||
a supported quota API. Without it, existing observations remain available and age to stale.
|
||||
Codex uses D4's CLI app-server and rollout fallback. No provider HTTP API is added.
|
||||
|
||||
**Why.** R8, and the developer's clarification that the browser authorization response must
|
||||
travel through FinalToken to the CLI, without being stored. D7's analysis answers whether the
|
||||
remaining allowance will last through the actual reset; token prices alone cannot answer it.
|
||||
|
||||
**Gives up.** Automatic remote callbacks, provider-token sharing, automatic account switching,
|
||||
unverified identities, universal login lifetimes, and exact cross-machine attribution of old
|
||||
hourly buckets. The metadata inventory currently has a 100,000-record per-profile export bound;
|
||||
the collector retains prior data and reports failure when full. This version uses atomic JSON
|
||||
inventories, not an unbounded fleet database. See [operation and limits](web-dashboard.md).
|
||||
|
||||
## D10 — Stream Deck plugin
|
||||
|
||||
**Decision.** The plugin's UUID is `de.finalfactory.finaltoken`, its folder
|
||||
|
||||
Reference in New Issue
Block a user