@hasna/economy 0.2.20 → 0.2.22
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/LICENSE +1 -2
- package/README.md +5 -13
- package/dist/cli/commands/completion.d.ts +2 -0
- package/dist/cli/commands/completion.d.ts.map +1 -0
- package/dist/cli/commands/extras.d.ts +4 -0
- package/dist/cli/commands/extras.d.ts.map +1 -0
- package/dist/cli/commands/menubar.d.ts.map +1 -1
- package/dist/cli/commands/notification.d.ts +8 -0
- package/dist/cli/commands/notification.d.ts.map +1 -0
- package/dist/cli/commands/todos.d.ts +26 -0
- package/dist/cli/commands/todos.d.ts.map +1 -0
- package/dist/cli/commands/tui.d.ts +10 -0
- package/dist/cli/commands/tui.d.ts.map +1 -0
- package/dist/cli/commands/watch.d.ts +1 -0
- package/dist/cli/commands/watch.d.ts.map +1 -1
- package/dist/cli/index.js +5649 -708
- package/dist/db/database.d.ts +45 -3
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/pg-migrations.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1576 -142
- package/dist/ingest/billing.d.ts +27 -0
- package/dist/ingest/billing.d.ts.map +1 -0
- package/dist/ingest/claude-quota.d.ts +5 -0
- package/dist/ingest/claude-quota.d.ts.map +1 -0
- package/dist/ingest/claude.d.ts +13 -2
- package/dist/ingest/claude.d.ts.map +1 -1
- package/dist/ingest/codex-quota.d.ts +5 -0
- package/dist/ingest/codex-quota.d.ts.map +1 -0
- package/dist/ingest/codex.d.ts +2 -1
- package/dist/ingest/codex.d.ts.map +1 -1
- package/dist/ingest/cursor.d.ts +6 -0
- package/dist/ingest/cursor.d.ts.map +1 -0
- package/dist/ingest/gemini.d.ts +2 -1
- package/dist/ingest/gemini.d.ts.map +1 -1
- package/dist/ingest/hermes.d.ts +6 -0
- package/dist/ingest/hermes.d.ts.map +1 -0
- package/dist/ingest/opencode.d.ts +7 -0
- package/dist/ingest/opencode.d.ts.map +1 -0
- package/dist/ingest/otel.d.ts +20 -0
- package/dist/ingest/otel.d.ts.map +1 -0
- package/dist/ingest/pi.d.ts +7 -0
- package/dist/ingest/pi.d.ts.map +1 -0
- package/dist/ingest/plugin.d.ts +17 -0
- package/dist/ingest/plugin.d.ts.map +1 -0
- package/dist/lib/accounts.d.ts +11 -0
- package/dist/lib/accounts.d.ts.map +1 -0
- package/dist/lib/agents.d.ts +11 -0
- package/dist/lib/agents.d.ts.map +1 -0
- package/dist/lib/billing-diff.d.ts +22 -0
- package/dist/lib/billing-diff.d.ts.map +1 -0
- package/dist/lib/cloud-sync.d.ts +35 -0
- package/dist/lib/cloud-sync.d.ts.map +1 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/gatherer.d.ts.map +1 -1
- package/dist/lib/model-config.d.ts.map +1 -1
- package/dist/lib/open-projects.d.ts +19 -0
- package/dist/lib/open-projects.d.ts.map +1 -0
- package/dist/lib/package-metadata.d.ts +8 -0
- package/dist/lib/package-metadata.d.ts.map +1 -0
- package/dist/lib/paths.d.ts +20 -0
- package/dist/lib/paths.d.ts.map +1 -0
- package/dist/lib/pricing.d.ts +3 -3
- package/dist/lib/pricing.d.ts.map +1 -1
- package/dist/lib/savings.d.ts +17 -0
- package/dist/lib/savings.d.ts.map +1 -0
- package/dist/lib/serve-auth.d.ts +4 -0
- package/dist/lib/serve-auth.d.ts.map +1 -0
- package/dist/lib/spikes.d.ts +18 -0
- package/dist/lib/spikes.d.ts.map +1 -0
- package/dist/lib/sync-all.d.ts +28 -0
- package/dist/lib/sync-all.d.ts.map +1 -0
- package/dist/lib/watch-paths.d.ts +3 -0
- package/dist/lib/watch-paths.d.ts.map +1 -0
- package/dist/lib/webhooks.d.ts +1 -1
- package/dist/lib/webhooks.d.ts.map +1 -1
- package/dist/mcp/index.js +3063 -482
- package/dist/otel/index.d.ts +3 -0
- package/dist/otel/index.d.ts.map +1 -0
- package/dist/otel/index.js +1423 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +3550 -269
- package/dist/server/serve.d.ts +10 -2
- package/dist/server/serve.d.ts.map +1 -1
- package/dist/types/index.d.ts +102 -6
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +9 -4
package/LICENSE
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
Apache License
|
|
3
2
|
Version 2.0, January 2004
|
|
4
3
|
http://www.apache.org/licenses/
|
|
@@ -176,7 +175,7 @@
|
|
|
176
175
|
|
|
177
176
|
END OF TERMS AND CONDITIONS
|
|
178
177
|
|
|
179
|
-
Copyright 2026
|
|
178
|
+
Copyright 2026 hasna
|
|
180
179
|
|
|
181
180
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
181
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ AI coding cost tracker for Claude Code, Takumi, Codex, and Gemini. It ships as a
|
|
|
9
9
|
|
|
10
10
|
- Ingests local Claude Code, Takumi, Codex, and Gemini CLI usage.
|
|
11
11
|
- Tracks sessions, requests, projects, machines, models, cache tokens, budgets, goals, and provider billing.
|
|
12
|
+
- Attributes usage to `@hasna/accounts` profiles when agents run under managed account/profile config dirs.
|
|
12
13
|
- Seeds editable model pricing with input, output, cache-read, 5-minute cache-write, 1-hour cache-write, and context-cache storage rates.
|
|
13
14
|
- Handles tiered pricing such as Gemini long-prompt rates and OpenAI long-context rates.
|
|
14
15
|
- Reconciles estimates against Anthropic, OpenAI, and Gemini billing sources.
|
|
@@ -98,6 +99,10 @@ economy sync --backfill-machine
|
|
|
98
99
|
|
|
99
100
|
Full sync also imports active project metadata from `@hasna/projects` when the registry is available.
|
|
100
101
|
|
|
102
|
+
Account attribution is automatic when `@hasna/accounts` has a matching active, applied, or env-dir profile for the agent. You can also force attribution for a process with `ECONOMY_ACCOUNT=tool:name` or agent-specific overrides such as `ECONOMY_CODEX_ACCOUNT=codex:work`.
|
|
103
|
+
|
|
104
|
+
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.
|
|
105
|
+
|
|
101
106
|
## Pricing
|
|
102
107
|
|
|
103
108
|
Default pricing is seeded into SQLite and can be edited locally:
|
|
@@ -229,19 +234,6 @@ cd dashboard && bun run lint
|
|
|
229
234
|
cd menubar && swift build -c release
|
|
230
235
|
```
|
|
231
236
|
|
|
232
|
-
## HTTP mode
|
|
233
|
-
|
|
234
|
-
Shared Streamable HTTP transport for multi-agent sessions (stdio remains the default):
|
|
235
|
-
|
|
236
|
-
```bash
|
|
237
|
-
economy-mcp --http # http://127.0.0.1:8815/mcp
|
|
238
|
-
MCP_HTTP=1 economy-mcp # same
|
|
239
|
-
economy-mcp --http --port 8815 # explicit port
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
- Health: `GET http://127.0.0.1:8815/health` → `{"status":"ok","name":"economy"}`
|
|
243
|
-
- Override port with `MCP_HTTP_PORT` or `--port`
|
|
244
|
-
|
|
245
237
|
## License
|
|
246
238
|
|
|
247
239
|
Apache-2.0 -- see [LICENSE](LICENSE)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/completion.ts"],"names":[],"mappings":"AA0FA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAenD"}
|
|
@@ -0,0 +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;AA6CnC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0R/D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkC5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menubar.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/menubar.ts"],"names":[],"mappings":"AA0BA,wBAAsB,cAAc,CAAC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"menubar.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/menubar.ts"],"names":[],"mappings":"AA0BA,wBAAsB,cAAc,CAAC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0E7E;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAcvC;AAED,wBAAgB,YAAY,IAAI,IAAI,CAOnC;AAED,wBAAgB,WAAW,IAAI,IAAI,CAWlC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type ExecFile = (file: string, args: string[], options: {
|
|
2
|
+
stdio: 'ignore';
|
|
3
|
+
}) => unknown;
|
|
4
|
+
export declare function appleScriptString(value: string): string;
|
|
5
|
+
export declare function notificationScript(title: string, body: string): string;
|
|
6
|
+
export declare function sendNotification(title: string, body: string, execFile?: ExecFile): void;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/notification.ts"],"names":[],"mappings":"AAEA,KAAK,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,QAAQ,CAAA;CAAE,KAAK,OAAO,CAAA;AAEvF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAuB,GAAG,IAAI,CAIrG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export type TodoStatus = 'pending' | 'in_progress' | 'done';
|
|
3
|
+
export interface TodoTask {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
status: TodoStatus;
|
|
7
|
+
deps?: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface TodoPhase {
|
|
10
|
+
id: string;
|
|
11
|
+
title: string;
|
|
12
|
+
summary: string;
|
|
13
|
+
tasks: TodoTask[];
|
|
14
|
+
}
|
|
15
|
+
export declare const ROADMAP_VERSION = "2026-05-23-b";
|
|
16
|
+
export declare const ROADMAP_GOAL = "Unified AI spend across 4+ machines: auto-sync local telemetry, track subscription usage & savings, ingest all major coding agents, and expose proactive CLI/MCP intelligence \u2014 not just per-machine API cost estimates.";
|
|
17
|
+
export declare const ROADMAP_PHASES: TodoPhase[];
|
|
18
|
+
export declare function printTodosHelp(): void;
|
|
19
|
+
export declare function printTodosOverview(): void;
|
|
20
|
+
export declare function printTodosList(opts: {
|
|
21
|
+
phase?: string;
|
|
22
|
+
status?: TodoStatus;
|
|
23
|
+
}): void;
|
|
24
|
+
export declare function printTodoShow(taskId: string): void;
|
|
25
|
+
export declare function registerTodosCommand(program: Command): void;
|
|
26
|
+
//# sourceMappingURL=todos.d.ts.map
|
|
@@ -0,0 +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;AAkBD,wBAAgB,cAAc,IAAI,IAAI,CAkCrC;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAyBzC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,IAAI,CAyBlF;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAmBlD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsC3D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SqliteAdapter as Database } from '@hasna/cloud';
|
|
2
|
+
export declare function buildStatusLine(db: Database): string;
|
|
3
|
+
export declare function buildWaybarJson(db: Database): Record<string, unknown>;
|
|
4
|
+
export declare function printStatusLine(): void;
|
|
5
|
+
export declare function printWaybarJson(): void;
|
|
6
|
+
export declare function runTui(opts: {
|
|
7
|
+
watch?: boolean;
|
|
8
|
+
interval?: number;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=tui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/tui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAA;AAkC7D,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,CAoBpD;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWrE;AAED,wBAAgB,eAAe,IAAI,IAAI,CAGtC;AAED,wBAAgB,eAAe,IAAI,IAAI,CAGtC;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/watch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/watch.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAGjD,UAAU,YAAY;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AA4BD,wBAAsB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgGlE"}
|