token-studio 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -0
- package/CHANGELOG.md +89 -0
- package/Dockerfile +17 -0
- package/LICENSE +22 -0
- package/NOTICE.md +21 -0
- package/PRIVACY.md +68 -0
- package/README.en.md +220 -0
- package/README.md +220 -0
- package/config/collectors.json +54 -0
- package/data/.gitkeep +1 -0
- package/docker-compose.yml +17 -0
- package/docs/assets/.gitkeep +1 -0
- package/docs/assets/token-studio-v44-dashboard.png +0 -0
- package/docs/assets/token-studio-v44-live.png +0 -0
- package/docs/assets/token-studio-v44-review-mobile.png +0 -0
- package/docs/assets/token-studio-v44-review.png +0 -0
- package/docs/assets/token-studio-v45-dashboard.png +0 -0
- package/docs/assets/token-studio-v45-live.png +0 -0
- package/docs/assets/token-studio-v45-review-mobile.png +0 -0
- package/docs/assets/token-studio-v45-review.png +0 -0
- package/docs/blog-case-study.md +34 -0
- package/docs/collector-support-matrix.md +65 -0
- package/docs/competitive-notes.md +87 -0
- package/docs/demo-data/README.md +12 -0
- package/docs/demo-data/token-studio-v2-demo.json +146 -0
- package/docs/demo-flow.md +39 -0
- package/docs/first-run.md +95 -0
- package/docs/local-collectors.md +49 -0
- package/docs/public-launch-checklist.md +45 -0
- package/docs/resume-bullets.md +7 -0
- package/docs/statusline.md +52 -0
- package/index.html +16 -0
- package/package.json +36 -0
- package/render.yaml +17 -0
- package/src/auto-attribution.mjs +396 -0
- package/src/ccusage-bridge.mjs +74 -0
- package/src/ccusage-import.mjs +415 -0
- package/src/cli.mjs +643 -0
- package/src/client/dashboard/App.jsx +1734 -0
- package/src/client/dashboard/annotation-presets.js +138 -0
- package/src/client/dashboard/attribution.js +328 -0
- package/src/client/dashboard/components-charts.jsx +622 -0
- package/src/client/dashboard/components-tables.jsx +1531 -0
- package/src/client/dashboard/components-top.jsx +307 -0
- package/src/client/dashboard/import-budget.js +41 -0
- package/src/client/dashboard/model-usage.js +108 -0
- package/src/client/dashboard/onboarding.js +80 -0
- package/src/client/dashboard/styles.css +2606 -0
- package/src/client/live/LiveApp.jsx +226 -0
- package/src/client/live/styles.css +446 -0
- package/src/client/main.jsx +20 -0
- package/src/client/review/ReviewApp.jsx +507 -0
- package/src/client/review/closure-progress.js +165 -0
- package/src/client/review/markdown-report.js +401 -0
- package/src/client/review/model-strategy.js +273 -0
- package/src/client/review/roi-advisor.js +255 -0
- package/src/client/review/roi-evidence.js +78 -0
- package/src/client/review/savings-simulator.js +252 -0
- package/src/client/review/sections-1.jsx +277 -0
- package/src/client/review/sections-2.jsx +927 -0
- package/src/client/review/styles.css +2321 -0
- package/src/client/review/utils.js +345 -0
- package/src/client/shared/utils.js +236 -0
- package/src/closure-check.mjs +537 -0
- package/src/closure-import.mjs +646 -0
- package/src/collect.mjs +247 -0
- package/src/collector-config.mjs +82 -0
- package/src/collector-registry.mjs +333 -0
- package/src/collectors/claude-code.mjs +355 -0
- package/src/collectors/codex.mjs +418 -0
- package/src/collectors/copilot.mjs +19 -0
- package/src/collectors/cursor.mjs +23 -0
- package/src/collectors/gemini.mjs +530 -0
- package/src/collectors/goose.mjs +15 -0
- package/src/collectors/hermes.mjs +206 -0
- package/src/collectors/kimi.mjs +15 -0
- package/src/collectors/openclaw.mjs +400 -0
- package/src/collectors/opencode.mjs +349 -0
- package/src/collectors/qwen.mjs +15 -0
- package/src/collectors/structured-usage.mjs +437 -0
- package/src/collectors/utils.mjs +93 -0
- package/src/db.mjs +1397 -0
- package/src/demo-seed.mjs +39 -0
- package/src/dev.mjs +43 -0
- package/src/live.mjs +428 -0
- package/src/model-policy.mjs +147 -0
- package/src/pricing.mjs +434 -0
- package/src/privacy-check.mjs +126 -0
- package/src/server.mjs +1240 -0
- package/src/source-health.mjs +195 -0
- package/src/statusline.mjs +156 -0
- package/src/terminal-report.mjs +245 -0
- package/src/update-pricing.mjs +8 -0
- package/test/annotation-presets.test.mjs +137 -0
- package/test/api-annotations.test.mjs +202 -0
- package/test/api-auto-attribution.test.mjs +169 -0
- package/test/api-source-health.test.mjs +109 -0
- package/test/api-v2.test.mjs +278 -0
- package/test/api-v43.test.mjs +151 -0
- package/test/api-v44.test.mjs +128 -0
- package/test/attribution-summary.test.mjs +164 -0
- package/test/auto-attribution.test.mjs +116 -0
- package/test/ccusage-bridge.test.mjs +36 -0
- package/test/ccusage-import.test.mjs +93 -0
- package/test/cli-v43.test.mjs +64 -0
- package/test/cli-v45.test.mjs +34 -0
- package/test/cli-v46.test.mjs +129 -0
- package/test/cli-v47.test.mjs +98 -0
- package/test/closure-check.test.mjs +202 -0
- package/test/closure-import.test.mjs +263 -0
- package/test/collector-config.test.mjs +25 -0
- package/test/collector-registry.test.mjs +56 -0
- package/test/csv.test.mjs +19 -0
- package/test/db-annotations.test.mjs +186 -0
- package/test/db-v2.test.mjs +200 -0
- package/test/db-v4.test.mjs +178 -0
- package/test/experimental-collectors.test.mjs +103 -0
- package/test/fixtures/collectors/copilot/usage.jsonl +2 -0
- package/test/fixtures/collectors/cursor/usage.jsonl +2 -0
- package/test/fixtures/collectors/goose/usage.jsonl +2 -0
- package/test/fixtures/collectors/kimi/usage.jsonl +2 -0
- package/test/fixtures/collectors/qwen/usage.jsonl +2 -0
- package/test/import-budget.test.mjs +40 -0
- package/test/live.test.mjs +256 -0
- package/test/markdown-report.test.mjs +193 -0
- package/test/model-policy.test.mjs +34 -0
- package/test/model-strategy.test.mjs +116 -0
- package/test/model-usage.test.mjs +99 -0
- package/test/official-pricing.test.mjs +70 -0
- package/test/onboarding.test.mjs +55 -0
- package/test/privacy-check.test.mjs +33 -0
- package/test/review-closure-progress.test.mjs +99 -0
- package/test/roi-advisor.test.mjs +188 -0
- package/test/roi-evidence.test.mjs +48 -0
- package/test/roi-summary.test.mjs +101 -0
- package/test/savings-simulator.test.mjs +141 -0
- package/test/source-health.test.mjs +62 -0
- package/test/statusline.test.mjs +148 -0
- package/vite.config.js +23 -0
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
24
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 4.8.0
|
|
4
|
+
|
|
5
|
+
- Renamed the npm package to `token-studio` with `npx token-studio demo` as the primary public entry.
|
|
6
|
+
- Updated CLI path handling so npm-installed commands run package files from the installed package while writing demo/usage SQLite data into the caller's working directory.
|
|
7
|
+
- Added Source Health Center data and UI for native stable, experimental, detected-only, and ccusage import-bridge sources without exposing full local paths.
|
|
8
|
+
- Added `GET /api/source-health` and included source health metadata in `/api/data`.
|
|
9
|
+
- Updated README quick start and public docs around npm launch, ccusage bridge coverage, privacy boundaries, and official-price/non-invoice wording.
|
|
10
|
+
|
|
11
|
+
## 4.7.0
|
|
12
|
+
|
|
13
|
+
- Added Dashboard ccusage CLI Bridge UX that only generates copyable local commands; the browser never runs external scanners.
|
|
14
|
+
- Extended budget profiles to support `rolling` and `fixed` windows with `reset_anchor` and editable `warning_threshold`.
|
|
15
|
+
- Updated `/live` and `token-studio statusline` to show quota window type, reset countdown, warning thresholds, and budget usage.
|
|
16
|
+
- Added `docs/statusline.md` plus `token-studio statusline --help` integration snippets for Claude Code statusline, tmux, PowerShell, and JSON scripts.
|
|
17
|
+
- Added `token-studio policy --format=markdown|claude-md|agents-md` to export a reusable ROI model-use playbook without editing project files.
|
|
18
|
+
|
|
19
|
+
## 4.6.0
|
|
20
|
+
|
|
21
|
+
- Added `token-studio import-usage --format=ccusage-cli` to explicitly run `ccusage <report> --json --no-cost` and reuse the existing privacy-safe ccusage import planner.
|
|
22
|
+
- Added non-interactive `--yes` gating for the ccusage CLI bridge; dry-run remains default, apply creates a SQLite backup, and unsafe conversation-like fields are rejected.
|
|
23
|
+
- Added `token-studio statusline --format=text|json` for terminal/Claude Code/tmux status bars with recent-window tokens, burn rate, cache hit, budget usage, reset countdown, unpriced-model warnings, and open Advisor Actions.
|
|
24
|
+
- Added weekly ccusage JSON shape support and kept imported third-party cost fields ignored in favor of Token Studio official-price conversion.
|
|
25
|
+
- Updated documentation to position v4.6 as a bridge/statusline catch-up release, not a desktop widget, leaderboard, or full TUI rewrite.
|
|
26
|
+
|
|
27
|
+
## 4.5.0
|
|
28
|
+
|
|
29
|
+
- Added first-run onboarding on the Dashboard, derived from existing usage, budget, advisor action, and token event data without adding schema.
|
|
30
|
+
- Added empty-state guidance for no data, data without Advisor actions, and budgets without recent event-level live data.
|
|
31
|
+
- Added `token-studio open` to start the local UI and open the browser.
|
|
32
|
+
- Added `token-studio import-usage --help` with ccusage JSON examples, supported shapes, and privacy boundaries.
|
|
33
|
+
- Added `docs/first-run.md` with a 5-minute demo/import/budget/review flow.
|
|
34
|
+
|
|
35
|
+
## 4.4.0
|
|
36
|
+
|
|
37
|
+
- Added a Dashboard “导入/预算” wizard for ccusage JSON paste/upload dry-run and explicit SQLite apply.
|
|
38
|
+
- Added `POST /api/import/ccusage-json` so the UI can reuse the privacy-safe ccusage import planner; unsafe conversation-like fields are rejected and apply creates a SQLite backup.
|
|
39
|
+
- Added Budget Wizard UI for source-level custom token/cost windows and linked `/live` budget guardrails.
|
|
40
|
+
- Added `/review` Advisor Action Summary page with open/done/dismissed counts and standalone Markdown action export.
|
|
41
|
+
- Fixed `/review` mobile bottom spacing so fixed previous/next page controls do not cover the last visible content.
|
|
42
|
+
- Added demo-mode public screenshot assets under `docs/assets/`.
|
|
43
|
+
|
|
44
|
+
## 4.3.0
|
|
45
|
+
|
|
46
|
+
- Added `token-studio import-usage --format=ccusage-json` for documented ccusage JSON import with dry-run by default, unsafe conversation-field rejection, and Token Studio official-price recomputation.
|
|
47
|
+
- Added local `budget_profiles`, budget APIs, `token-studio budget`, and `/live` budget windows with near/over/exceeded guardrail warnings.
|
|
48
|
+
- Added `advisor_actions`, action APIs, `/review` action buttons, and Markdown report action status output.
|
|
49
|
+
- Added `token-studio report --period=week --format=table|markdown|json` for terminal ROI review summaries.
|
|
50
|
+
- Extended collector matrix with `import-only` ccusage and detected-only entries for Amp, Droid, Codebuff, pi-agent, Roo Code, Zed Agent, Antigravity, Cline, Kiro, Grok Build, and Kilo.
|
|
51
|
+
- Kept v4.3 broad coverage privacy-safe: no fake token rows, no prompt/response/transcript/diff/full-path storage, and no real collect in automated tests.
|
|
52
|
+
|
|
53
|
+
## 4.2.0
|
|
54
|
+
|
|
55
|
+
- Added ROI Savings Simulator on `/review` to compare official-price model switching scenarios for low-value, exploration, testing, and context-prep work.
|
|
56
|
+
- Added savings simulation output to Markdown weekly review reports with explicit non-invoice wording.
|
|
57
|
+
- Extended `/api/live` with guardrail thresholds and warning cards for high burn rate, low cache hit, low output/input ratio, and active unpriced models.
|
|
58
|
+
- Added `token-studio collectors --audit [--json]` for safe experimental collector audits without SQLite writes or full-path output.
|
|
59
|
+
- Extended collector metadata with `auditRecommended` and `lastAudit` placeholders.
|
|
60
|
+
- Kept v4.2 focused on product differentiation; npm release packaging and screenshots remain a later launch gate.
|
|
61
|
+
|
|
62
|
+
## 4.1.0
|
|
63
|
+
|
|
64
|
+
- Added `/live` lightweight local monitor for recent token burn rate, cache hit, active sessions, sources, and models.
|
|
65
|
+
- Added `token-studio live` and `token-studio collectors`.
|
|
66
|
+
- Upgraded Cursor, GitHub Copilot CLI, Qwen Code, Kimi, and Goose to opt-in experimental collectors.
|
|
67
|
+
- Added fixture-backed structured usage parsing that skips rows without explicit token fields.
|
|
68
|
+
- Extended `GET /api/collectors` with privacy, token reliability, data field, and fixture metadata.
|
|
69
|
+
- Added public launch checklist and collector support matrix.
|
|
70
|
+
- Expanded competitive notes and README differentiation against token-meter style tools.
|
|
71
|
+
|
|
72
|
+
## 4.0.0
|
|
73
|
+
|
|
74
|
+
- Repackaged the project as `@ryan/token-studio-roi` with the `token-studio` CLI.
|
|
75
|
+
- Added standalone demo mode backed by synthetic SQLite data.
|
|
76
|
+
- Added collector registry and source detection for six stable local collectors.
|
|
77
|
+
- Added detected-only entries for Cursor, GitHub Copilot CLI, Qwen Code, Kimi, and Goose.
|
|
78
|
+
- Added privacy check for publish readiness.
|
|
79
|
+
- Added `token_events`, `work_items`, and `work_item_sessions` schema.
|
|
80
|
+
- Added ROI Evidence Score on `/review`.
|
|
81
|
+
- Added model policy Markdown API.
|
|
82
|
+
- Added `GET /api/collectors`, `GET /api/privacy-check`, `GET /api/model-policy.md`, and work item APIs.
|
|
83
|
+
- Kept local write APIs loopback-only, local-Origin-only, and JSON-only.
|
|
84
|
+
|
|
85
|
+
## Notes
|
|
86
|
+
|
|
87
|
+
- Real collection is never run by automated tests.
|
|
88
|
+
- Demo data is synthetic and must not be described as real user history.
|
|
89
|
+
- Official-price conversion is not a provider invoice.
|
package/Dockerfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
FROM node:22-alpine
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
COPY package.json package-lock.json ./
|
|
5
|
+
RUN npm ci
|
|
6
|
+
|
|
7
|
+
COPY src ./src
|
|
8
|
+
COPY config ./config
|
|
9
|
+
COPY data/pricing-litellm.json data/pricing-openrouter.json ./data/
|
|
10
|
+
COPY index.html vite.config.js ./
|
|
11
|
+
RUN npm run build && npm prune --omit=dev
|
|
12
|
+
|
|
13
|
+
ENV PORT=4173
|
|
14
|
+
ENV HOST=0.0.0.0
|
|
15
|
+
EXPOSE 4173
|
|
16
|
+
|
|
17
|
+
CMD ["node", "src/server.mjs"]
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AI Token Dashboard contributors
|
|
4
|
+
Copyright (c) 2026 Token Studio ROI contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Notice
|
|
2
|
+
|
|
3
|
+
Token Studio ROI is a standalone public packaging and productization effort by ryan.
|
|
4
|
+
|
|
5
|
+
The project preserves attribution for an earlier MIT-licensed AI token dashboard prototype. The original MIT copyright notice is kept in `LICENSE`.
|
|
6
|
+
|
|
7
|
+
Token Studio ROI adds and productizes the following first-class features:
|
|
8
|
+
|
|
9
|
+
- standalone `token-studio` CLI
|
|
10
|
+
- demo mode with synthetic data
|
|
11
|
+
- collector registry and source detection
|
|
12
|
+
- privacy scanner for public readiness
|
|
13
|
+
- session attribution and provenance
|
|
14
|
+
- work item model for grouping sessions into outputs
|
|
15
|
+
- ROI Evidence Score
|
|
16
|
+
- local ROI Advisor rules
|
|
17
|
+
- model policy Markdown export
|
|
18
|
+
- official-price conversion boundaries
|
|
19
|
+
- loopback-only local write API hardening
|
|
20
|
+
|
|
21
|
+
The project does not claim provider-invoice accuracy and does not read, store, display, or export conversation content.
|
package/PRIVACY.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Privacy
|
|
2
|
+
|
|
3
|
+
Token Studio ROI is designed as a local-first AI coding review tool.
|
|
4
|
+
|
|
5
|
+
## Default Behavior
|
|
6
|
+
|
|
7
|
+
- No cloud sync.
|
|
8
|
+
- No account system.
|
|
9
|
+
- No remote telemetry.
|
|
10
|
+
- No automatic scan of local AI tool logs on startup.
|
|
11
|
+
- Demo mode uses synthetic records only.
|
|
12
|
+
|
|
13
|
+
## Real Collection
|
|
14
|
+
|
|
15
|
+
Real collection runs only after explicit confirmation through the CLI or local UI.
|
|
16
|
+
|
|
17
|
+
Supported v4.0 stable collectors read local structured usage metadata from:
|
|
18
|
+
|
|
19
|
+
- Claude Code
|
|
20
|
+
- Codex CLI
|
|
21
|
+
- Gemini CLI
|
|
22
|
+
- OpenCode
|
|
23
|
+
- OpenClaw
|
|
24
|
+
- Hermes Agent
|
|
25
|
+
|
|
26
|
+
Detected-only sources such as Cursor, GitHub Copilot CLI, Qwen Code, Kimi, and Goose are not written as usage rows until reliable token fixtures exist.
|
|
27
|
+
|
|
28
|
+
## Data Not Stored
|
|
29
|
+
|
|
30
|
+
Token Studio ROI does not store:
|
|
31
|
+
|
|
32
|
+
- prompts
|
|
33
|
+
- responses
|
|
34
|
+
- full transcripts
|
|
35
|
+
- full file paths
|
|
36
|
+
- command bodies
|
|
37
|
+
- diff content
|
|
38
|
+
- fetched PR, commit, article, or deployment content
|
|
39
|
+
|
|
40
|
+
Output links store only URL, label, and type.
|
|
41
|
+
|
|
42
|
+
## Local Data
|
|
43
|
+
|
|
44
|
+
Local SQLite files live under `data/` by default and are ignored by Git.
|
|
45
|
+
|
|
46
|
+
Before publishing or sharing the repository, run:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm run privacy:check
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The privacy check looks for real SQLite databases, AI log directories, `.env` files, generated exports, personal paths, and likely secrets in tracked files.
|
|
53
|
+
|
|
54
|
+
## Network Boundary
|
|
55
|
+
|
|
56
|
+
The local server binds to `127.0.0.1` by default.
|
|
57
|
+
|
|
58
|
+
All write APIs require:
|
|
59
|
+
|
|
60
|
+
- loopback request address
|
|
61
|
+
- local or empty Origin
|
|
62
|
+
- `Content-Type: application/json`
|
|
63
|
+
|
|
64
|
+
The server does not trust `X-Forwarded-For` for local access checks.
|
|
65
|
+
|
|
66
|
+
## Cost Boundary
|
|
67
|
+
|
|
68
|
+
Dollar values are official public token-price conversions. They are useful for trend review and model strategy, but they are not provider invoices or financial reconciliation.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Token Studio ROI
|
|
2
|
+
|
|
3
|
+
**English** | [中文](README.md)
|
|
4
|
+
|
|
5
|
+
**Local AI Coding ROI Studio.** Token Studio ROI is a local, privacy-first AI coding review tool. It does more than count tokens: it connects official-price token usage to projects, tasks, work stages, output evidence, and model strategy.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx token-studio demo
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Remember three differences:
|
|
12
|
+
|
|
13
|
+
- **Work Evidence**: see where tokens went and which project/task/stage/output they belong to.
|
|
14
|
+
- **Savings Simulator**: simulate model-switching savings with official public token prices.
|
|
15
|
+
- **Model Policy**: turn usage history into next week's light/mid/heavy model strategy.
|
|
16
|
+
|
|
17
|
+
By default it does not read, display, or upload conversation content. Real collection requires explicit confirmation.
|
|
18
|
+
|
|
19
|
+
## Why Not ccusage / CodeBurn?
|
|
20
|
+
|
|
21
|
+
| Tool | Strength | Token Studio ROI difference |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| ccusage | Broad coverage and mature JSON output | Token Studio ROI uses the bridge for coverage, then focuses on outputs and review |
|
|
24
|
+
| CodeBurn | `npx` TUI and local cost observation | Token Studio ROI focuses on weekly reports, action loops, and model policy |
|
|
25
|
+
| TokenTracker / CodexBar | Desktop visibility and quota surfaces | Token Studio ROI focuses on local ROI decisions and work evidence |
|
|
26
|
+
|
|
27
|
+
See [docs/competitive-notes.md](docs/competitive-notes.md) for the fuller competitor reference and differentiation notes.
|
|
28
|
+
|
|
29
|
+
## What Makes ROI Different?
|
|
30
|
+
|
|
31
|
+
v4.8 focuses on decisions, not only metering, and uses npm one-command launch, Source Health, a small CLI bridge, quota profiles, and statusline integrations to close coverage and live-entry gaps without turning Token Studio into a desktop widget or TUI clone:
|
|
32
|
+
|
|
33
|
+
- **ROI Savings Simulator**: compares official-price model switching scenarios for exploration, testing, context prep, low-value, and abandoned work.
|
|
34
|
+
- **ccusage JSON Import**: imports documented ccusage JSON output for broader structured usage coverage while recomputing costs with Token Studio official pricing.
|
|
35
|
+
- **ccusage CLI Bridge UX**: the Dashboard only generates copyable local commands; the browser never runs external scanners.
|
|
36
|
+
- **Source Health Center**: shows native stable, experimental, detected-only, and ccusage import-bridge status, recent usage, token-field trust, and privacy boundaries without exposing full local paths.
|
|
37
|
+
- **Import / Budget Wizard**: paste or upload ccusage JSON in the Dashboard, dry-run first, inspect shape/session/event counts, unsafe fields, and unpriced models, then explicitly apply to SQLite.
|
|
38
|
+
- **Quota Profiles v2**: supports rolling/fixed custom guardrail windows, reset anchors, warning thresholds, burn projection, reset countdown, and near/over/exceeded warnings on `/live`.
|
|
39
|
+
- **Statusline Guardrails**: `token-studio statusline` prints recent-window tokens, burn rate, cache, budget usage, unpriced-model warnings, and open actions for terminal prompts, tmux, or Claude Code statusline.
|
|
40
|
+
- **ROI Playbook Export**: `token-studio policy` exports Markdown, Claude Code, or AGENTS-style model-use snippets without editing project files.
|
|
41
|
+
- **Advisor Action Loop**: turns Savings Simulator and ROI Advisor recommendations into open/done/dismissed actions and includes them in weekly Markdown reports.
|
|
42
|
+
- **Collector Audit**: audits experimental collectors before upgrading support, without SQLite writes or full-path output.
|
|
43
|
+
- **Work Evidence**: connects usage to projects, tasks, stages, value, output links, and work items.
|
|
44
|
+
|
|
45
|
+
All dollar values are official-price conversions or simulations, not provider invoices.
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
Recommended Node.js: 24. Minimum: `>=22.12.0`.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx token-studio demo
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Expected output:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
[demo] seeded 3 sessions and 2 daily rows into .../data/demo.sqlite
|
|
59
|
+
[token-studio] UI http://127.0.0.1:5173/ (Demo Mode)
|
|
60
|
+
[token-studio] API http://127.0.0.1:4173
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Common commands:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx token-studio start
|
|
67
|
+
npx token-studio import-usage --format=ccusage-cli --report=session --dry-run --yes
|
|
68
|
+
npx token-studio statusline --format=text
|
|
69
|
+
npx token-studio collectors
|
|
70
|
+
npx token-studio privacy-check
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
From source:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git clone https://github.com/RyanCoreAI/token-studio-roi.git
|
|
77
|
+
cd token-studio-roi
|
|
78
|
+
npm install
|
|
79
|
+
npm run demo
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`demo` uses synthetic data and does not scan real `.claude`, `.codex`, Cursor, or Copilot logs. `start` reads an existing SQLite database and does not collect automatically. The `ccusage-cli` bridge explicitly runs the external ccusage local scanner; Token Studio only accepts structured JSON, rejects conversation-like fields, and ignores third-party cost fields.
|
|
83
|
+
|
|
84
|
+
See [docs/first-run.md](docs/first-run.md) for the first-run flow. The Dashboard also derives first-run guidance from the current database: no data points to demo/import, data without actions points to `/review`, and budgets without event-level live data explain the `/live` window behavior.
|
|
85
|
+
|
|
86
|
+
## Screenshots
|
|
87
|
+
|
|
88
|
+
These screenshots are from demo mode or sanitized synthetic data, not real local logs.
|
|
89
|
+
|
|
90
|
+

|
|
91
|
+
|
|
92
|
+

|
|
93
|
+
|
|
94
|
+

|
|
95
|
+
|
|
96
|
+
Real collection requires explicit confirmation:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npx token-studio collect --sources=claude,codex
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Non-interactive shells refuse collection unless `--yes` is passed.
|
|
103
|
+
|
|
104
|
+
## Core Features
|
|
105
|
+
|
|
106
|
+
- Collector registry: Claude Code, Codex CLI, Gemini CLI, OpenCode, OpenClaw, and Hermes Agent are v4.0 stable sources.
|
|
107
|
+
- Experimental sources: Cursor, GitHub Copilot CLI, Qwen Code, Kimi, and Goose import only explicit token fields and never produce fake token rows.
|
|
108
|
+
- Official-price conversion: published provider token prices only; unpriced models stay unpriced.
|
|
109
|
+
- Work attribution: project, task type, output status, purpose, stage, value, and notes.
|
|
110
|
+
- Output evidence: stores only URL, label, and output type.
|
|
111
|
+
- ROI Evidence Score: checks whether attribution, outputs, manual confirmation, and work items are strong enough for ROI decisions.
|
|
112
|
+
- ROI Savings Simulator: simulates model switching savings with official prices and keeps unpriced models out of dollar decisions.
|
|
113
|
+
- ROI Advisor: local rules only, no LLM calls and no extra token usage.
|
|
114
|
+
- Advisor Action Loop: add recommendations to an action list, mark them done or dismissed, and review trends without claiming causal savings.
|
|
115
|
+
- Model Policy / ROI Playbook export: generates Markdown, Claude Code, or AGENTS-style strategy snippets from local structured history without writing files.
|
|
116
|
+
- ccusage Import Bridge: `token-studio import-usage --format=ccusage-json` imports saved structured JSON, and `--format=ccusage-cli` explicitly invokes ccusage CLI; both avoid conversation content and third-party cost estimates.
|
|
117
|
+
- Source Health Center: the Dashboard and `/api/source-health` show support tier, detected status, recent import/collection summary, and token-field trust without leaking full local paths.
|
|
118
|
+
- Import / Budget Wizard: dashboard entry for ccusage JSON dry-run/apply, ccusage CLI Bridge command generation, and budget-window creation.
|
|
119
|
+
- Quota Profiles v2: source-level custom token/cost guardrails with rolling/fixed windows, reset anchors, warning thresholds, and near/over/exceeded warnings.
|
|
120
|
+
- Live Monitor: `/live` shows recent 15-minute token, model, cache, burn-rate metadata, budget windows, and guardrail warnings.
|
|
121
|
+
- Statusline Guardrails: `token-studio statusline --format=text|json` reads SQLite only and prints recent-window tokens, burn rate, cache, budget usage, reset countdown, unpriced-model warnings, and open Advisor Actions; integration examples are in [docs/statusline.md](docs/statusline.md).
|
|
122
|
+
- Collector Audit: `token-studio collectors --audit` returns a safe experimental-source summary without writing SQLite.
|
|
123
|
+
- Terminal Report: `token-studio report --period=week --format=table|markdown|json` prints a quick ROI review summary.
|
|
124
|
+
- Privacy check: scans for real DBs, AI log directories, `.env`, generated exports, personal paths, and likely secrets.
|
|
125
|
+
- Demo mode: public demos use synthetic data and show a Demo Mode badge.
|
|
126
|
+
- First-run onboarding: empty-data, import, budget, and review-action guidance without cloud sync or accounts.
|
|
127
|
+
|
|
128
|
+
## Why Not Just ccusage / CodeBurn?
|
|
129
|
+
|
|
130
|
+
ccusage, CodeBurn, TokenTracker, and token-dashboard are closer to token meters, TUIs, live burn-rate monitors, or broad collector dashboards. Token Studio ROI is not trying to replace those tools. It turns local token usage into reviewable work evidence: projects, tasks, purpose, stage, value, output links, work items, ROI Evidence, Advisor actions, and Model Policy.
|
|
131
|
+
|
|
132
|
+
If you only need to know how many tokens you used today, ccusage or CodeBurn may be lighter. If you want to understand what those tokens produced and how to change next week's model strategy, Token Studio ROI is the better fit.
|
|
133
|
+
|
|
134
|
+
## Privacy Boundary
|
|
135
|
+
|
|
136
|
+
Token Studio ROI does not store:
|
|
137
|
+
|
|
138
|
+
- prompts
|
|
139
|
+
- responses
|
|
140
|
+
- full transcripts
|
|
141
|
+
- full file paths
|
|
142
|
+
- command bodies
|
|
143
|
+
- diff content
|
|
144
|
+
|
|
145
|
+
Fine-grained analysis may store only token structure, source, model, timestamp, tool category, file extension, repo path hash, and privacy level.
|
|
146
|
+
|
|
147
|
+
Run the publish gate:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npm run privacy:check
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## API
|
|
154
|
+
|
|
155
|
+
Stable interfaces:
|
|
156
|
+
|
|
157
|
+
- `GET /api/data`
|
|
158
|
+
- `GET /api/collectors`
|
|
159
|
+
- `GET /api/source-health`
|
|
160
|
+
- `GET /api/live`
|
|
161
|
+
- `GET /api/budget-profiles`
|
|
162
|
+
- `POST /api/budget-profiles`
|
|
163
|
+
- `DELETE /api/budget-profiles`
|
|
164
|
+
- `POST /api/import/ccusage-json`
|
|
165
|
+
- `GET /api/advisor-actions`
|
|
166
|
+
- `POST /api/advisor-actions`
|
|
167
|
+
- `DELETE /api/advisor-actions/:id`
|
|
168
|
+
- `GET /api/privacy-check`
|
|
169
|
+
- `GET /api/model-policy.md`
|
|
170
|
+
- `POST /api/collect`
|
|
171
|
+
- `POST /api/session-annotations`
|
|
172
|
+
- `POST /api/session-annotations/batch`
|
|
173
|
+
- `POST /api/session-outputs`
|
|
174
|
+
- `GET /api/auto-attribution/suggestions`
|
|
175
|
+
- `POST /api/auto-attribution/apply`
|
|
176
|
+
- `POST /api/auto-attribution/undo`
|
|
177
|
+
- `POST /api/work-items`
|
|
178
|
+
- `POST /api/work-items/link-sessions`
|
|
179
|
+
- `DELETE /api/work-items/:id`
|
|
180
|
+
|
|
181
|
+
All local write APIs remain loopback-only, local-Origin-only, and JSON-only. The server does not trust `X-Forwarded-For` for local access checks.
|
|
182
|
+
|
|
183
|
+
## Development
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm install
|
|
187
|
+
npm test
|
|
188
|
+
npm run build
|
|
189
|
+
npm run privacy:check
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Development mode:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
npm run dev
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Default URLs:
|
|
199
|
+
|
|
200
|
+
- UI: `http://127.0.0.1:5173`
|
|
201
|
+
- API: `http://127.0.0.1:4173`
|
|
202
|
+
|
|
203
|
+
## Public Readiness Checklist
|
|
204
|
+
|
|
205
|
+
- [ ] `npm test`
|
|
206
|
+
- [ ] `npm run build`
|
|
207
|
+
- [ ] `npm run privacy:check`
|
|
208
|
+
- [ ] demo screenshots come from demo mode
|
|
209
|
+
- [ ] `/live` loads from demo mode or temporary SQLite
|
|
210
|
+
- [ ] no real `data/usage.sqlite`
|
|
211
|
+
- [ ] no `.claude/`, `.codex/`, `.env`
|
|
212
|
+
- [ ] no raw conversation content
|
|
213
|
+
- [ ] README says official-price conversion is not a provider invoice
|
|
214
|
+
- [ ] NOTICE preserves attribution for the MIT prototype
|
|
215
|
+
|
|
216
|
+
## License / Attribution
|
|
217
|
+
|
|
218
|
+
MIT licensed. See [LICENSE](LICENSE) and [NOTICE.md](NOTICE.md).
|
|
219
|
+
|
|
220
|
+
Token Studio ROI is a standalone public packaging and productization effort by ryan. It preserves attribution for the earlier MIT prototype while making the public product, CLI, collector registry, privacy scanner, ROI evidence layer, work item model, advisor, and model policy workflow first-class Token Studio ROI features.
|
package/README.md
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Token Studio ROI
|
|
2
|
+
|
|
3
|
+
[English](README.en.md) | **中文**
|
|
4
|
+
|
|
5
|
+
**Local AI Coding ROI Studio.** Token Studio ROI 不只是 token meter,而是一个本地隐私优先的 AI 编程复盘工具:记录 token 和官方价换算成本,连接项目、任务、工作阶段、产出证据和模型策略。
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx token-studio demo
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
首屏只需要记住三个差异:
|
|
12
|
+
|
|
13
|
+
- **Work Evidence**:回答 token 花在哪、对应什么项目/任务/阶段/产出。
|
|
14
|
+
- **Savings Simulator**:按官方公开 token 价格模拟模型切换后的节省空间。
|
|
15
|
+
- **Model Policy**:把历史用量转成下周轻量/中等/重模型使用策略。
|
|
16
|
+
|
|
17
|
+
默认不读取、不展示、不上传对话正文。真实采集必须显式确认。
|
|
18
|
+
|
|
19
|
+
## Why Not ccusage / CodeBurn?
|
|
20
|
+
|
|
21
|
+
| 工具 | 强项 | Token Studio ROI 的差异 |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| ccusage | 覆盖广、JSON 输出成熟 | Token Studio ROI 用 ccusage bridge 补覆盖,但重点做产出和复盘 |
|
|
24
|
+
| CodeBurn | `npx` TUI 和本地成本观测 | Token Studio ROI 做周报、行动闭环和模型策略 |
|
|
25
|
+
| TokenTracker / CodexBar | 桌面组件、限额可见性 | Token Studio ROI 做本地 ROI 决策和工作证据 |
|
|
26
|
+
|
|
27
|
+
更完整的竞品参考和差异化记录见 [docs/competitive-notes.md](docs/competitive-notes.md)。
|
|
28
|
+
|
|
29
|
+
## What Makes ROI Different?
|
|
30
|
+
|
|
31
|
+
Token Studio ROI 的 v4.8 重点不是再堆一个 token meter,而是把统计结果转成可执行决策,并用 npm 一键启动、Source Health、CLI bridge、quota profiles 和 statusline integration 补齐竞品的覆盖面和实时入口:
|
|
32
|
+
|
|
33
|
+
- **ROI Savings Simulator**:模拟“探索、测试、上下文整理、低价值或废弃任务从重模型切到轻量/中模型”时,按官方公开 token 价格可能少花多少。
|
|
34
|
+
- **ccusage JSON Import**:兼容 ccusage documented JSON output,借它的多源生态导入结构化 token 数据,但成本仍由 Token Studio 官方价函数重算。
|
|
35
|
+
- **ccusage CLI Bridge UX**:Dashboard 只生成可复制命令,不从浏览器运行外部扫描器;真实 bridge 仍由用户在本地终端显式执行。
|
|
36
|
+
- **Source Health Center**:显示 native stable、experimental、detected-only、ccusage import-bridge 的状态、最近用量、token 字段可信度和隐私边界,不输出完整本机路径。
|
|
37
|
+
- **Import / Budget Wizard**:在 Dashboard 里粘贴或上传 ccusage JSON,先 dry-run 看 shape、session/event 数、unsafe 字段和未定价模型,确认后才写 SQLite。
|
|
38
|
+
- **Quota Profiles v2**:支持 rolling/fixed 自定义限额窗口、reset anchor、warning threshold,在 `/live` 看到 burn projection、reset countdown 和 near/over/exceeded warnings。
|
|
39
|
+
- **Statusline Guardrails**:`token-studio statusline` 输出最近窗口 token、burn rate、cache、预算使用率、未定价模型提示和 open actions,适配终端 prompt、tmux 或 Claude Code statusline。
|
|
40
|
+
- **ROI Playbook Export**:`token-studio policy` 导出 Markdown、Claude Code 或 AGENTS 风格模型使用策略片段,不自动修改项目文件。
|
|
41
|
+
- **Advisor Action Loop**:把 Savings Simulator / ROI Advisor 建议加入行动清单,标记完成或忽略,并写入 Markdown 周报。
|
|
42
|
+
- **Collector Audit**:先审计 experimental collector 是否真的有可靠 token 字段,再决定是否升级支持级别,不用估算值伪造用量。
|
|
43
|
+
- **Work Evidence**:把 session 连接到项目、任务、阶段、价值、产出链接和 work item,回答“token 换来了什么”。
|
|
44
|
+
|
|
45
|
+
所有 ROI 金额都写作“官方价换算 / 节省模拟”,不能当供应商账单或财务对账。
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
推荐 Node.js 24,最低 Node.js `>=22.12.0`。
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx token-studio demo
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
预期输出类似:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
[demo] seeded 3 sessions and 2 daily rows into .../data/demo.sqlite
|
|
59
|
+
[token-studio] UI http://127.0.0.1:5173/ (Demo Mode)
|
|
60
|
+
[token-studio] API http://127.0.0.1:4173
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
常用命令:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx token-studio start
|
|
67
|
+
npx token-studio import-usage --format=ccusage-cli --report=session --dry-run --yes
|
|
68
|
+
npx token-studio statusline --format=text
|
|
69
|
+
npx token-studio collectors
|
|
70
|
+
npx token-studio privacy-check
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
从源码运行:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git clone https://github.com/RyanCoreAI/token-studio-roi.git
|
|
77
|
+
cd token-studio-roi
|
|
78
|
+
npm install
|
|
79
|
+
npm run demo
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`demo` 使用合成数据,不扫描真实 `.claude`、`.codex`、Cursor 或 Copilot 日志。`start` 只读取已有 SQLite,不自动采集。`ccusage-cli` bridge 会显式运行外部 ccusage 本地扫描器;Token Studio 只接收结构化 JSON,拒绝 conversation-like 字段,并忽略第三方 cost 字段。
|
|
83
|
+
|
|
84
|
+
首次使用流程见 [docs/first-run.md](docs/first-run.md)。Dashboard 也会根据当前数据状态显示“首次使用”引导:无数据时提示 demo/import,有数据但无 action 时提示去 `/review`,有预算但无事件级 live 数据时解释 `/live` 的窗口口径。
|
|
85
|
+
|
|
86
|
+
## Screenshots
|
|
87
|
+
|
|
88
|
+
这些截图来自 demo mode 或脱敏合成数据,不包含真实本机日志。
|
|
89
|
+
|
|
90
|
+

|
|
91
|
+
|
|
92
|
+

|
|
93
|
+
|
|
94
|
+

|
|
95
|
+
|
|
96
|
+
真实采集需要显式确认:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npx token-studio collect --sources=claude,codex
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
非交互环境不会自动扫描本机日志;需要显式 `--yes` 才会继续。
|
|
103
|
+
|
|
104
|
+
## Core Features
|
|
105
|
+
|
|
106
|
+
- Collector registry:Claude Code、Codex CLI、Gemini CLI、OpenCode、OpenClaw、Hermes Agent 作为 v4.0 stable 来源。
|
|
107
|
+
- Experimental sources:Cursor、GitHub Copilot CLI、Qwen Code、Kimi、Goose 仅在存在明确 token 字段时导入,不伪造 token 或费用。
|
|
108
|
+
- Official-price conversion:按官方公开 token 单价换算,未公开美元价的模型保持未定价。
|
|
109
|
+
- Work attribution:项目、任务类型、产出状态、工作目的、阶段、价值、备注。
|
|
110
|
+
- Output evidence:只保存 URL、标签和类型,不抓取链接内容。
|
|
111
|
+
- ROI Evidence Score:检查归因、产出、人工确认和 work item 是否足够支撑 ROI 判断。
|
|
112
|
+
- ROI Savings Simulator:按官方价模拟模型切换后的节省空间,不把未定价模型算作 $0。
|
|
113
|
+
- ROI Advisor:本地规则建议,不调用 LLM,不额外消耗 token。
|
|
114
|
+
- Advisor Action Loop:把建议加入行动清单、标为完成或忽略;只做趋势复盘,不声称因果节省。
|
|
115
|
+
- Model Policy / ROI Playbook:导出 Markdown、Claude Code 或 AGENTS 风格策略片段,把历史用量转成下周模型使用策略,不自动写文件。
|
|
116
|
+
- ccusage Import Bridge:`token-studio import-usage --format=ccusage-json` 导入保存的结构化 JSON,`--format=ccusage-cli` 显式调用 ccusage CLI;两者都不保存正文,不采用第三方估算成本。
|
|
117
|
+
- Source Health Center:Dashboard 和 `/api/source-health` 展示来源支持级别、检测状态、最近导入/采集摘要和 token 字段可信度,不泄露完整本机路径。
|
|
118
|
+
- Import / Budget Wizard:Dashboard 内置 ccusage JSON dry-run/apply、ccusage CLI Bridge 命令生成器和预算窗口创建入口。
|
|
119
|
+
- Quota Profiles v2:自定义 source 级 token/cost 预算窗口,支持 rolling/fixed、reset anchor 和 warning threshold,`/live` 显示 near/over/exceeded warnings。
|
|
120
|
+
- Live Monitor:`/live` 轻量监控最近 15 分钟 token、模型、cache、burn rate、预算窗口和 guardrail warnings。
|
|
121
|
+
- Statusline Guardrails:`token-studio statusline --format=text|json` 只读 SQLite,输出最近窗口 token、burn rate、cache、预算使用率、reset countdown、未定价模型提示和 open Advisor Actions;集成示例见 [docs/statusline.md](docs/statusline.md)。
|
|
122
|
+
- Collector Audit:`token-studio collectors --audit` 只输出实验来源安全摘要,不写 SQLite。
|
|
123
|
+
- Terminal Report:`token-studio report --period=week --format=table|markdown|json` 快速查看 ROI 复盘摘要。
|
|
124
|
+
- Privacy check:公开前扫描真实 DB、AI 日志目录、`.env`、导出文件和个人路径。
|
|
125
|
+
- Demo mode:公开演示默认使用合成数据并显示 Demo Mode 标识。
|
|
126
|
+
- First-run onboarding:空数据、导入、预算、复盘 action 的首次使用引导,不新增云同步或账号。
|
|
127
|
+
|
|
128
|
+
## Why Not Just ccusage / CodeBurn?
|
|
129
|
+
|
|
130
|
+
ccusage、CodeBurn、TokenTracker 和 token-dashboard 更偏 token meter、TUI、实时 burn rate 或工具覆盖。Token Studio ROI 的核心不是替代这些统计器,而是把本地 token 消耗变成可复盘的工作证据:项目、任务、目的、阶段、价值、产出链接、work item、ROI Evidence、Advisor 行动项和 Model Policy。
|
|
131
|
+
|
|
132
|
+
如果你只想知道今天用了多少 token,ccusage 或 CodeBurn 会更轻。如果你想知道这些 token 换来了什么产出、下周该怎么换模型策略,Token Studio ROI 更适合。
|
|
133
|
+
|
|
134
|
+
## Privacy Boundary
|
|
135
|
+
|
|
136
|
+
Token Studio ROI 不保存:
|
|
137
|
+
|
|
138
|
+
- prompt
|
|
139
|
+
- response
|
|
140
|
+
- full transcript
|
|
141
|
+
- full file path
|
|
142
|
+
- command body
|
|
143
|
+
- diff content
|
|
144
|
+
|
|
145
|
+
细粒度分析只允许保存 token 结构、来源、模型、时间、tool category、文件扩展名、repo path hash 和 privacy level。
|
|
146
|
+
|
|
147
|
+
运行公开检查:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npm run privacy:check
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## API
|
|
154
|
+
|
|
155
|
+
稳定接口:
|
|
156
|
+
|
|
157
|
+
- `GET /api/data`
|
|
158
|
+
- `GET /api/collectors`
|
|
159
|
+
- `GET /api/source-health`
|
|
160
|
+
- `GET /api/live`
|
|
161
|
+
- `GET /api/budget-profiles`
|
|
162
|
+
- `POST /api/budget-profiles`
|
|
163
|
+
- `DELETE /api/budget-profiles`
|
|
164
|
+
- `POST /api/import/ccusage-json`
|
|
165
|
+
- `GET /api/advisor-actions`
|
|
166
|
+
- `POST /api/advisor-actions`
|
|
167
|
+
- `DELETE /api/advisor-actions/:id`
|
|
168
|
+
- `GET /api/privacy-check`
|
|
169
|
+
- `GET /api/model-policy.md`
|
|
170
|
+
- `POST /api/collect`
|
|
171
|
+
- `POST /api/session-annotations`
|
|
172
|
+
- `POST /api/session-annotations/batch`
|
|
173
|
+
- `POST /api/session-outputs`
|
|
174
|
+
- `GET /api/auto-attribution/suggestions`
|
|
175
|
+
- `POST /api/auto-attribution/apply`
|
|
176
|
+
- `POST /api/auto-attribution/undo`
|
|
177
|
+
- `POST /api/work-items`
|
|
178
|
+
- `POST /api/work-items/link-sessions`
|
|
179
|
+
- `DELETE /api/work-items/:id`
|
|
180
|
+
|
|
181
|
+
所有写接口继续限制为 loopback、local Origin、JSON。服务端不信任 `X-Forwarded-For` 作为本机判断。
|
|
182
|
+
|
|
183
|
+
## Development
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm install
|
|
187
|
+
npm test
|
|
188
|
+
npm run build
|
|
189
|
+
npm run privacy:check
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
开发模式:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
npm run dev
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
默认地址:
|
|
199
|
+
|
|
200
|
+
- UI: `http://127.0.0.1:5173`
|
|
201
|
+
- API: `http://127.0.0.1:4173`
|
|
202
|
+
|
|
203
|
+
## Public Readiness Checklist
|
|
204
|
+
|
|
205
|
+
- [ ] `npm test`
|
|
206
|
+
- [ ] `npm run build`
|
|
207
|
+
- [ ] `npm run privacy:check`
|
|
208
|
+
- [ ] demo screenshots come from demo mode
|
|
209
|
+
- [ ] `/live` loads from demo mode or temporary SQLite
|
|
210
|
+
- [ ] no real `data/usage.sqlite`
|
|
211
|
+
- [ ] no `.claude/`, `.codex/`, `.env`
|
|
212
|
+
- [ ] no raw conversation content
|
|
213
|
+
- [ ] README explains official-price conversion is not a provider invoice
|
|
214
|
+
- [ ] NOTICE keeps attribution for the MIT prototype
|
|
215
|
+
|
|
216
|
+
## License / Attribution
|
|
217
|
+
|
|
218
|
+
MIT licensed. See [LICENSE](LICENSE) and [NOTICE.md](NOTICE.md).
|
|
219
|
+
|
|
220
|
+
Token Studio ROI is a standalone public packaging and productization effort by ryan. It preserves attribution for the earlier MIT prototype while making the public product, CLI, collector registry, privacy scanner, ROI evidence layer, work item model, advisor, and model policy workflow first-class Token Studio ROI features.
|