@hasna/economy 0.3.6 → 0.3.8
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/CHANGELOG.md +31 -0
- package/README.md +73 -60
- package/dashboard/README.md +17 -64
- package/dist/cli/commands/extras.d.ts.map +1 -1
- package/dist/cli/commands/todos.d.ts +3 -0
- package/dist/cli/commands/todos.d.ts.map +1 -1
- package/dist/cli/index.js +914 -199
- package/dist/db/cloud.d.ts +3 -4
- package/dist/db/cloud.d.ts.map +1 -1
- package/dist/db/database.d.ts +10 -3
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/dialect.d.ts +13 -0
- package/dist/db/dialect.d.ts.map +1 -0
- package/dist/db/pg-migrate.d.ts +30 -0
- package/dist/db/pg-migrate.d.ts.map +1 -0
- package/dist/db/pg-migrations.d.ts.map +1 -1
- package/dist/db/sqlite-adapter.d.ts +36 -0
- package/dist/db/sqlite-adapter.d.ts.map +1 -0
- package/dist/db/sync-pg.d.ts +1 -1
- package/dist/db/sync-pg.d.ts.map +1 -1
- package/dist/index.js +309 -59
- package/dist/ingest/billing.d.ts +1 -1
- package/dist/ingest/billing.d.ts.map +1 -1
- package/dist/ingest/claude-quota.d.ts +1 -1
- package/dist/ingest/claude-quota.d.ts.map +1 -1
- package/dist/ingest/claude.d.ts +1 -1
- package/dist/ingest/claude.d.ts.map +1 -1
- package/dist/ingest/codex-quota.d.ts +1 -1
- package/dist/ingest/codex-quota.d.ts.map +1 -1
- package/dist/ingest/codex.d.ts +1 -1
- package/dist/ingest/codex.d.ts.map +1 -1
- package/dist/ingest/cursor.d.ts +1 -1
- package/dist/ingest/cursor.d.ts.map +1 -1
- package/dist/ingest/gemini.d.ts +1 -1
- package/dist/ingest/gemini.d.ts.map +1 -1
- package/dist/ingest/hermes.d.ts +1 -1
- package/dist/ingest/hermes.d.ts.map +1 -1
- package/dist/ingest/loops.d.ts +6 -0
- package/dist/ingest/loops.d.ts.map +1 -0
- package/dist/ingest/opencode.d.ts +1 -1
- package/dist/ingest/opencode.d.ts.map +1 -1
- package/dist/ingest/otel.d.ts +16 -3
- package/dist/ingest/otel.d.ts.map +1 -1
- package/dist/ingest/pi.d.ts +1 -1
- package/dist/ingest/pi.d.ts.map +1 -1
- package/dist/ingest/plugin.d.ts +1 -1
- package/dist/ingest/plugin.d.ts.map +1 -1
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/analytics.d.ts +1 -1
- package/dist/lib/analytics.d.ts.map +1 -1
- package/dist/lib/billing-diff.d.ts +1 -1
- package/dist/lib/billing-diff.d.ts.map +1 -1
- package/dist/lib/brief.d.ts +1 -1
- package/dist/lib/brief.d.ts.map +1 -1
- package/dist/lib/open-projects.d.ts +10 -2
- package/dist/lib/open-projects.d.ts.map +1 -1
- package/dist/lib/pricing.d.ts +1 -1
- package/dist/lib/pricing.d.ts.map +1 -1
- package/dist/lib/savings.d.ts +1 -1
- package/dist/lib/savings.d.ts.map +1 -1
- package/dist/lib/spikes.d.ts +1 -1
- package/dist/lib/spikes.d.ts.map +1 -1
- package/dist/lib/store/index.d.ts +9 -1
- package/dist/lib/store/index.d.ts.map +1 -1
- package/dist/lib/sync-all.d.ts +3 -1
- package/dist/lib/sync-all.d.ts.map +1 -1
- package/dist/lib/webhooks.d.ts +1 -1
- package/dist/lib/webhooks.d.ts.map +1 -1
- package/dist/mcp/index.js +757 -166
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/openapi.d.ts.map +1 -1
- package/dist/otel/index.js +262 -27
- package/dist/server/index.js +683 -135
- package/dist/server/serve.d.ts +1 -1
- package/dist/server/serve.d.ts.map +1 -1
- package/dist/types/index.d.ts +37 -4
- package/dist/types/index.d.ts.map +1 -1
- package/docs/README.md +12 -0
- package/docs/cli.md +88 -0
- package/docs/configuration.md +86 -0
- package/docs/ingestion.md +47 -0
- package/docs/mcp.md +65 -0
- package/docs/otel.md +53 -0
- package/docs/rest-api.md +89 -0
- package/package.json +4 -5
- package/dist/lib/cloud-sync.d.ts +0 -35
- package/dist/lib/cloud-sync.d.ts.map +0 -1
- package/dist/lib/fleet-sync.d.ts +0 -61
- package/dist/lib/fleet-sync.d.ts.map +0 -1
- package/dist/lib/peer-sync.d.ts +0 -21
- package/dist/lib/peer-sync.d.ts.map +0 -1
- package/dist/storage.js +0 -2746
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this repository are tracked here. This project follows semantic versioning for published npm packages when practical.
|
|
4
4
|
|
|
5
|
+
## @hasna/economy 0.3.7 - 2026-07-24
|
|
6
|
+
|
|
7
|
+
Reconciliation release: `main` had diverged from the published npm line. The `0.3.x`
|
|
8
|
+
code (`0.3.0`-`0.3.6`, the unified `Store` refactor plus the cloud/self_hosted service
|
|
9
|
+
surfaces) shipped to npm from `feature`-line commits and was never merged back, while
|
|
10
|
+
`main` (`0.2.52`) carried two merged-but-unpublished features. This release is a real
|
|
11
|
+
three-way merge that keeps **both** histories.
|
|
12
|
+
|
|
13
|
+
- Merged the published `v0.3.6` tag (`4f76834`) into `main`, preserving both parents.
|
|
14
|
+
- Forward-ported **compact CLI/MCP output defaults** (#4) onto the `Store` surfaces:
|
|
15
|
+
`--limit`/`--verbose`/`--json` on `breakdown`, `budget list`, `project list`,
|
|
16
|
+
`pricing list`, `goal list`, `goal status`, `usage`, `subscriptions list`, `fleet`;
|
|
17
|
+
`limit`/`verbose`/`json` params on the `get_model_breakdown`, `get_project_breakdown`,
|
|
18
|
+
`get_account_breakdown`, `get_budget_status`, `get_pricing`, `get_goals`,
|
|
19
|
+
`list_machines`, `get_session_detail`, `get_usage`, `get_savings`, `sync` and
|
|
20
|
+
`set_subscription` MCP tools.
|
|
21
|
+
- Forward-ported **token cost centers** (#5) onto the `Store` architecture: added
|
|
22
|
+
`EconomyStore.costCenterBreakdown()` (local SQLite + cloud `/v1` transports),
|
|
23
|
+
`cost_center_id` on `BudgetInput`, and the `breakdown --by cost-center|loop|app|repo`
|
|
24
|
+
CLI dimension plus the `get_cost_center_breakdown` MCP tool. The cloud transport
|
|
25
|
+
drops rows the API did not attribute to a cost center, so an un-upgraded serve
|
|
26
|
+
reports "no cost-center usage" instead of mislabelling model rows.
|
|
27
|
+
- Dropped the main-only code the `0.3.x` refactor deliberately removed as the
|
|
28
|
+
forbidden DSN-on-client pattern: `src/lib/peer-sync.ts`, `src/lib/cloud-sync.ts`
|
|
29
|
+
(and with it the `cloud schedule install|status|remove` commands) and
|
|
30
|
+
`src/lib/fleet-sync.ts`. The MCP `sync` tool no longer reports `cloud_pushed` /
|
|
31
|
+
`cloud_pulled` because `SyncAllResult` no longer carries them.
|
|
32
|
+
- Bumped strictly above the published `0.3.6` latest. (The `v0.3.6` tag commit itself
|
|
33
|
+
carried `package.json` version `0.3.5`; the `0.3.6` publish bumped the registry
|
|
34
|
+
without a follow-up commit.)
|
|
35
|
+
|
|
5
36
|
## @hasna/economy 0.2.43 - 2026-07-06
|
|
6
37
|
|
|
7
38
|
- Added the self_hosted service surface: `economy-serve` foundation probes (`GET /health`, `/ready`, `/version` -> `{ status, version, mode }`) and a versioned `/v1` API covering summaries, sessions, breakdowns, budgets, goals, pricing, subscriptions, billing, and sync.
|
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@ AI coding cost tracker for Claude Code, Takumi, Codex, Gemini, OpenCode, Cursor,
|
|
|
8
8
|
## Features
|
|
9
9
|
|
|
10
10
|
- Ingests local Claude Code, Takumi, Codex, Gemini, OpenCode, Cursor, Pi, and Hermes usage.
|
|
11
|
-
- Tracks sessions, requests, projects, machines, models, cache tokens, budgets, goals, and provider billing.
|
|
11
|
+
- Tracks sessions, requests, projects, machines, models, cache tokens, cost centers, budgets, goals, and provider billing.
|
|
12
12
|
- Attributes usage to `@hasna/accounts` profiles when agents run under managed account/profile config dirs.
|
|
13
|
-
- Breaks down API-equivalent, metered API, subscription-included, estimated, and unknown cost by account and
|
|
13
|
+
- Breaks down API-equivalent, metered API, subscription-included, estimated, and unknown cost by account, coding agent, and cost center.
|
|
14
14
|
- Seeds editable model pricing with input, output, cache-read, 5-minute cache-write, 1-hour cache-write, and context-cache storage rates.
|
|
15
15
|
- Handles tiered pricing such as Gemini long-prompt rates and OpenAI long-context rates.
|
|
16
16
|
- Reconciles estimates against Anthropic, OpenAI, and Gemini billing sources.
|
|
@@ -39,6 +39,35 @@ Open the dashboard with:
|
|
|
39
39
|
economy dashboard --port 3456
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
## Documentation
|
|
43
|
+
|
|
44
|
+
- [CLI reference](docs/cli.md)
|
|
45
|
+
- [Ingestion sources and attribution](docs/ingestion.md)
|
|
46
|
+
- [Configuration, storage modes, and deployment](docs/configuration.md)
|
|
47
|
+
- [REST API](docs/rest-api.md)
|
|
48
|
+
- [MCP server](docs/mcp.md)
|
|
49
|
+
- [OTLP/HTTP sidecar](docs/otel.md)
|
|
50
|
+
|
|
51
|
+
## CLI Output Defaults
|
|
52
|
+
|
|
53
|
+
Economy CLI commands are compact by default so agent terminals do not fill their context with full records. High-cardinality list and status commands show essential columns, cap row counts, and print a hint when more rows are available.
|
|
54
|
+
|
|
55
|
+
Use explicit detail paths when you need more:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
economy sessions --limit 50
|
|
59
|
+
economy session <id> --verbose
|
|
60
|
+
economy accounts month --json
|
|
61
|
+
economy usage month --verbose
|
|
62
|
+
economy todos list --limit 20
|
|
63
|
+
economy todos list --verbose
|
|
64
|
+
economy todos show 9.7
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`--json` remains the machine-readable path for commands that support it. Human output may truncate rows or long text; use `--json`, `--limit`, or a `show`/detail command for complete data. `--verbose` expands output where supported; its exact limit is command-specific (for example, `economy session --verbose` shows up to 50 requests).
|
|
68
|
+
|
|
69
|
+
Status subcommands follow the same rule. For example, `economy goal status` prints a compact human summary by default and `economy goal status --limit 5` or `--verbose` controls how many goals are listed.
|
|
70
|
+
|
|
42
71
|
## Agent Integrations
|
|
43
72
|
|
|
44
73
|
Use the MCP server for live cost context inside coding agents:
|
|
@@ -71,7 +100,7 @@ Gemini settings:
|
|
|
71
100
|
}
|
|
72
101
|
```
|
|
73
102
|
|
|
74
|
-
The MCP server exposes read tools for summaries, sessions, machines, pricing, daily spend, budgets, goals, provider billing, usage snapshots, savings, project/account/agent breakdowns, and subscriptions. It also exposes mutation tools for budgets, pricing rows, goals, and subscriptions so coding agents can manage Economy data through the same validated surface as the CLI and REST API.
|
|
103
|
+
The MCP server exposes read tools for summaries, sessions, machines, pricing, daily spend, budgets, goals, provider billing, usage snapshots, savings, project/account/agent/cost-center breakdowns, and subscriptions. MCP tools are compact by default for agent context safety; high-cardinality tools accept `limit`, `verbose`, or `json=true` where raw structured output is useful. It also exposes mutation tools for budgets, pricing rows, goals, and subscriptions so coding agents can manage Economy data through the same validated surface as the CLI and REST API. See the [MCP guide](docs/mcp.md) for HTTP mode and the complete tool list.
|
|
75
104
|
|
|
76
105
|
## Ingest
|
|
77
106
|
|
|
@@ -92,8 +121,11 @@ economy sync --opencode
|
|
|
92
121
|
economy sync --cursor
|
|
93
122
|
economy sync --pi
|
|
94
123
|
economy sync --hermes
|
|
124
|
+
economy sync --loops
|
|
95
125
|
```
|
|
96
126
|
|
|
127
|
+
`economy sync --loops` reads `~/.hasna/loops/loops.db` in read-only mode and imports OpenLoops orchestration/judge `goal_runs.tokens_used` into `loop:*` cost centers. It intentionally does not ingest dispatched coding-agent work from loops; heavy agent spend remains captured by the existing per-agent ingesters and can be analyzed alongside loop cost centers through account/profile attribution.
|
|
128
|
+
|
|
97
129
|
Useful repair options:
|
|
98
130
|
|
|
99
131
|
```bash
|
|
@@ -102,7 +134,7 @@ economy sync --recalculate
|
|
|
102
134
|
economy sync --backfill-machine
|
|
103
135
|
```
|
|
104
136
|
|
|
105
|
-
Full sync also imports active project metadata from `@hasna/projects` when the registry is available. The Codex source reads both
|
|
137
|
+
Full sync also imports active project metadata from `@hasna/projects` when the registry is available. The Codex source reads both `~/.codex/state_5.sqlite` and the Codewith store at `~/.codewith/state_5.sqlite` by default; explicit `HASNA_ECONOMY_CODEX_DB_PATH` and `HASNA_ECONOMY_CODEWITH_DB_PATH` values override those locations.
|
|
106
138
|
|
|
107
139
|
Account attribution is automatic when `@hasna/accounts` has a matching active, applied, or env-dir profile for the agent. Account identity is the email address plus coding agent, so `work@example.com` under Codex and Claude is reported as two accounts. You can also force attribution for a process with `ECONOMY_ACCOUNT=tool:name` or agent-specific overrides such as `ECONOMY_CODEX_ACCOUNT=codex:work`.
|
|
108
140
|
|
|
@@ -116,6 +148,26 @@ economy breakdown --by account
|
|
|
116
148
|
|
|
117
149
|
Account breakdowns report `api_equivalent_usd` for the API list-price value of the usage, plus `billable_usd`/`metered_api_usd` for known direct API spend and `subscription_included_usd` for usage covered by a subscription.
|
|
118
150
|
|
|
151
|
+
Cost-center breakdowns group spend across loops, apps, repos, services, and teams:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
economy breakdown --by cost-center
|
|
155
|
+
economy breakdown --by loop
|
|
156
|
+
economy breakdown --by app
|
|
157
|
+
economy breakdown --by repo
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Apps and services can report usage through the local `economy-otel` sidecar:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
economy-otel --port 4318
|
|
164
|
+
curl -X POST http://127.0.0.1:4318/ingest \
|
|
165
|
+
-H 'content-type: application/json' \
|
|
166
|
+
-d '{"source":"app","cost_center":"alumia","cost_center_kind":"app","project_path":"/workspace/alumia","model":"gpt-5-mini","cost_usd":0.12,"input_tokens":1200,"output_tokens":300}'
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Accepted `/ingest` attribution fields include `cost_center`, `cost_center_kind`, `cost_center_id`, `attribution_tag`, `project_path`, `repo`, `account_key`, `account_tool`, `account_name`, `account_email`, and explicit `cost_usd`. The [OTLP guide](docs/otel.md) documents both payload formats and all aliases.
|
|
170
|
+
|
|
119
171
|
Subscription plans can be configured locally and are used by savings calculations:
|
|
120
172
|
|
|
121
173
|
```bash
|
|
@@ -144,7 +196,7 @@ OpenRouter-style model IDs ending in `:free` are treated as zero-cost variants e
|
|
|
144
196
|
|
|
145
197
|
## Billing
|
|
146
198
|
|
|
147
|
-
Estimated costs can be reconciled with provider billing:
|
|
199
|
+
Estimated costs can be reconciled with provider billing in local mode:
|
|
148
200
|
|
|
149
201
|
```bash
|
|
150
202
|
economy billing sync --days 31
|
|
@@ -164,6 +216,7 @@ Gemini billing export files may be JSON arrays, JSON objects with `rows`, JSONL,
|
|
|
164
216
|
```bash
|
|
165
217
|
economy budget set --period monthly --limit 50 --alert 80
|
|
166
218
|
economy budget set --agent codex --period weekly --limit 25 --alert 70
|
|
219
|
+
economy budget set --cost-center loop:fleet-evaluator --period weekly --limit 10
|
|
167
220
|
economy budget list
|
|
168
221
|
economy goal set --period month --limit 40
|
|
169
222
|
economy goal set --agent gemini --period week --limit 15
|
|
@@ -172,7 +225,7 @@ economy config set webhook-url https://example.com/economy-webhook
|
|
|
172
225
|
economy config webhook-test
|
|
173
226
|
```
|
|
174
227
|
|
|
175
|
-
Budgets
|
|
228
|
+
Budgets can be global, project-scoped with `--project`, agent-scoped with `--agent`, cost-center scoped with `--cost-center`, or combined. Goals can be global, project-scoped, agent-scoped, or both. Valid agent scopes are `claude`, `takumi`, `codex`, `gemini`, `opencode`, `cursor`, `pi`, and `hermes`.
|
|
176
229
|
|
|
177
230
|
Budget webhooks fire after sync when the alert threshold is crossed. Failed webhook deliveries are not marked as fired, so the next sync can retry them.
|
|
178
231
|
|
|
@@ -184,35 +237,16 @@ Start the server:
|
|
|
184
237
|
economy-serve --port 3456
|
|
185
238
|
```
|
|
186
239
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
- `GET /health`
|
|
190
|
-
- `GET /
|
|
191
|
-
- `GET /
|
|
192
|
-
- `GET /
|
|
193
|
-
- `
|
|
194
|
-
- `
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
- `GET /api/usage?period=month`
|
|
198
|
-
- `GET /api/savings?period=month`
|
|
199
|
-
- `GET /api/subscriptions`
|
|
200
|
-
- `POST /api/subscriptions`
|
|
201
|
-
- `DELETE /api/subscriptions/:id`
|
|
202
|
-
- `GET /api/budgets`
|
|
203
|
-
- `POST /api/budgets`
|
|
204
|
-
- `DELETE /api/budgets/:id`
|
|
205
|
-
- `GET /api/pricing`
|
|
206
|
-
- `POST /api/pricing`
|
|
207
|
-
- `DELETE /api/pricing/:model`
|
|
208
|
-
- `GET /api/goals`
|
|
209
|
-
- `POST /api/goals`
|
|
210
|
-
- `DELETE /api/goals/:id`
|
|
211
|
-
- `GET /api/billing?period=month`
|
|
212
|
-
- `POST /api/sync`
|
|
213
|
-
- `POST /api/billing/sync`
|
|
214
|
-
|
|
215
|
-
Budget, goal, and subscription mutation endpoints validate agent scopes against `claude`, `takumi`, `codex`, `gemini`, `opencode`, `cursor`, `pi`, and `hermes`.
|
|
240
|
+
The canonical API uses `/v1`; `/api` remains a legacy alias for the dashboard and older clients. For example:
|
|
241
|
+
|
|
242
|
+
- `GET /health`, `/ready`, `/version`, and `/openapi.json`
|
|
243
|
+
- `GET /v1/summary?period=today`
|
|
244
|
+
- `GET /v1/sessions?agent=codex&account=work@example.com&limit=20`
|
|
245
|
+
- `GET /v1/breakdown?by=cost-center&period=month`
|
|
246
|
+
- `POST /v1/budgets`, `/v1/goals`, `/v1/pricing`, and `/v1/subscriptions`
|
|
247
|
+
- `POST /v1/sync`, `/v1/billing/sync`, and `/v1/ingest`
|
|
248
|
+
|
|
249
|
+
See the [REST API reference](docs/rest-api.md) for every route, response envelopes, authentication, and legacy aliases. The server publishes the current generated contract at `/openapi.json`.
|
|
216
250
|
|
|
217
251
|
The server also serves the built dashboard when `dashboard/dist` is present. The dashboard includes account-scoped session filtering, subscription plan create/update/delete controls in Savings, and savings/usage/account tables for subscription-aware cost analysis.
|
|
218
252
|
|
|
@@ -236,22 +270,13 @@ economy menubar stop
|
|
|
236
270
|
economy menubar uninstall
|
|
237
271
|
```
|
|
238
272
|
|
|
239
|
-
## Cloud Sync
|
|
240
|
-
|
|
241
|
-
Economy can push and pull local SQLite data through `@hasna/cloud` PostgreSQL sync:
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
economy cloud status
|
|
245
|
-
economy cloud push
|
|
246
|
-
economy cloud pull
|
|
247
|
-
economy cloud sync
|
|
248
|
-
```
|
|
249
|
-
|
|
250
273
|
## Data Directory
|
|
251
274
|
|
|
252
275
|
Data is stored in `~/.hasna/economy/`.
|
|
253
276
|
|
|
254
|
-
The main SQLite database lives at `~/.hasna/economy/economy.db`. Older `~/.economy/` data is
|
|
277
|
+
The main SQLite database lives at `~/.hasna/economy/economy.db`. Older `~/.economy/` data is copied on first open when the new directory does not exist. Override the database path with `HASNA_ECONOMY_DB_PATH` or `ECONOMY_DB`.
|
|
278
|
+
|
|
279
|
+
For shared deployments, CLI and MCP can use a remote `/v1` API instead of local SQLite by setting `HASNA_ECONOMY_API_URL` and `HASNA_ECONOMY_API_KEY`. See [configuration](docs/configuration.md) for client resolution, server auth, Postgres mode, and all environment variables.
|
|
255
280
|
|
|
256
281
|
## Development
|
|
257
282
|
|
|
@@ -259,6 +284,7 @@ The main SQLite database lives at `~/.hasna/economy/economy.db`. Older `~/.econo
|
|
|
259
284
|
bun test
|
|
260
285
|
bun run typecheck
|
|
261
286
|
bun run build
|
|
287
|
+
bun scripts/sync-openapi.ts
|
|
262
288
|
cd dashboard && bun run lint
|
|
263
289
|
cd menubar && swift build -c release
|
|
264
290
|
```
|
|
@@ -267,19 +293,6 @@ cd menubar && swift build -c release
|
|
|
267
293
|
|
|
268
294
|
Economy is published under the Apache-2.0 license. See [CONTRIBUTING.md](CONTRIBUTING.md) for local development and release hygiene, [SECURITY.md](SECURITY.md) for vulnerability reporting, [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for community expectations, and [CHANGELOG.md](CHANGELOG.md) for release notes.
|
|
269
295
|
|
|
270
|
-
## HTTP mode
|
|
271
|
-
|
|
272
|
-
Shared Streamable HTTP transport for multi-agent sessions (stdio remains the default):
|
|
273
|
-
|
|
274
|
-
```bash
|
|
275
|
-
economy-mcp --http # http://127.0.0.1:8860/mcp
|
|
276
|
-
MCP_HTTP=1 economy-mcp # same
|
|
277
|
-
economy-mcp --http --port 8815 # explicit port
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
- Health: `GET http://127.0.0.1:8860/health` -> `{"status":"ok","name":"economy"}`
|
|
281
|
-
- Override port with `MCP_HTTP_PORT` or `--port`
|
|
282
|
-
|
|
283
296
|
## License
|
|
284
297
|
|
|
285
298
|
Apache-2.0 -- see [LICENSE](LICENSE)
|
package/dashboard/README.md
CHANGED
|
@@ -1,73 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Economy dashboard
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The dashboard is the React/Vite UI served by `economy-serve`. It covers overview, sessions, models, projects, budgets, goals, usage, accounts, savings, fleet, reconciliation, pricing, and provider billing.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Development
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
7
|
+
Run the API from the repository root, then start Vite:
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
export default defineConfig([
|
|
20
|
-
globalIgnores(['dist']),
|
|
21
|
-
{
|
|
22
|
-
files: ['**/*.{ts,tsx}'],
|
|
23
|
-
extends: [
|
|
24
|
-
// Other configs...
|
|
25
|
-
|
|
26
|
-
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
-
tseslint.configs.recommendedTypeChecked,
|
|
28
|
-
// Alternatively, use this for stricter rules
|
|
29
|
-
tseslint.configs.strictTypeChecked,
|
|
30
|
-
// Optionally, add this for stylistic rules
|
|
31
|
-
tseslint.configs.stylisticTypeChecked,
|
|
32
|
-
|
|
33
|
-
// Other configs...
|
|
34
|
-
],
|
|
35
|
-
languageOptions: {
|
|
36
|
-
parserOptions: {
|
|
37
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
-
tsconfigRootDir: import.meta.dirname,
|
|
39
|
-
},
|
|
40
|
-
// other options...
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
])
|
|
9
|
+
```bash
|
|
10
|
+
economy-serve --port 3456
|
|
11
|
+
cd dashboard
|
|
12
|
+
bun install
|
|
13
|
+
bun run dev
|
|
44
14
|
```
|
|
45
15
|
|
|
46
|
-
|
|
16
|
+
The development build uses `http://localhost:3456` by default. Set `VITE_API_URL` at build/dev time to use another origin. The dashboard currently calls the server's legacy-compatible `/api` routes; the public canonical API is `/v1`.
|
|
47
17
|
|
|
48
|
-
|
|
49
|
-
// eslint.config.js
|
|
50
|
-
import reactX from 'eslint-plugin-react-x'
|
|
51
|
-
import reactDom from 'eslint-plugin-react-dom'
|
|
18
|
+
## Validation
|
|
52
19
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
extends: [
|
|
58
|
-
// Other configs...
|
|
59
|
-
// Enable lint rules for React
|
|
60
|
-
reactX.configs['recommended-typescript'],
|
|
61
|
-
// Enable lint rules for React DOM
|
|
62
|
-
reactDom.configs.recommended,
|
|
63
|
-
],
|
|
64
|
-
languageOptions: {
|
|
65
|
-
parserOptions: {
|
|
66
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
-
tsconfigRootDir: import.meta.dirname,
|
|
68
|
-
},
|
|
69
|
-
// other options...
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
])
|
|
20
|
+
```bash
|
|
21
|
+
bun test
|
|
22
|
+
bun run lint
|
|
23
|
+
bun run build
|
|
73
24
|
```
|
|
25
|
+
|
|
26
|
+
The root package build writes production assets to `dashboard/dist`; `economy-serve` serves those assets and provides SPA fallback routing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extras.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/extras.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"extras.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/extras.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAgDnC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyS/D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyC5D"}
|
|
@@ -20,6 +20,9 @@ export declare function printTodosOverview(): void;
|
|
|
20
20
|
export declare function printTodosList(opts: {
|
|
21
21
|
phase?: string;
|
|
22
22
|
status?: TodoStatus;
|
|
23
|
+
limit?: number;
|
|
24
|
+
verbose?: boolean;
|
|
25
|
+
json?: boolean;
|
|
23
26
|
}): void;
|
|
24
27
|
export declare function printTodoShow(taskId: string): void;
|
|
25
28
|
export declare function registerTodosCommand(program: Command): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/todos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,MAAM,CAAA;AAE3D,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,QAAQ,EAAE,CAAA;CAClB;AAED,eAAO,MAAM,eAAe,iBAAiB,CAAA;AAC7C,eAAO,MAAM,YAAY,kOACmM,CAAA;AAE5N,eAAO,MAAM,cAAc,EAAE,SAAS,EAuqBrC,CAAA;
|
|
1
|
+
{"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/todos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,MAAM,CAAA;AAE3D,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,QAAQ,EAAE,CAAA;CAClB;AAED,eAAO,MAAM,eAAe,iBAAiB,CAAA;AAC7C,eAAO,MAAM,YAAY,kOACmM,CAAA;AAE5N,eAAO,MAAM,cAAc,EAAE,SAAS,EAuqBrC,CAAA;AAgDD,wBAAgB,cAAc,IAAI,IAAI,CAoCrC;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CA0BzC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CA+DrI;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAmBlD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+C3D"}
|