@hasna/economy 0.2.17 → 0.2.19

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.
Files changed (86) hide show
  1. package/LICENSE +187 -13
  2. package/README.md +199 -13
  3. package/dist/cli/commands/completion.d.ts +2 -0
  4. package/dist/cli/commands/completion.d.ts.map +1 -0
  5. package/dist/cli/commands/extras.d.ts +4 -0
  6. package/dist/cli/commands/extras.d.ts.map +1 -0
  7. package/dist/cli/commands/menubar.d.ts.map +1 -1
  8. package/dist/cli/commands/notification.d.ts +8 -0
  9. package/dist/cli/commands/notification.d.ts.map +1 -0
  10. package/dist/cli/commands/todos.d.ts +26 -0
  11. package/dist/cli/commands/todos.d.ts.map +1 -0
  12. package/dist/cli/commands/tui.d.ts +10 -0
  13. package/dist/cli/commands/tui.d.ts.map +1 -0
  14. package/dist/cli/commands/watch.d.ts +1 -0
  15. package/dist/cli/commands/watch.d.ts.map +1 -1
  16. package/dist/cli/index.js +4845 -1001
  17. package/dist/db/database.d.ts +19 -1
  18. package/dist/db/database.d.ts.map +1 -1
  19. package/dist/db/pg-migrations.d.ts.map +1 -1
  20. package/dist/index.d.ts +2 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +1023 -108
  23. package/dist/ingest/billing.d.ts +9 -0
  24. package/dist/ingest/billing.d.ts.map +1 -1
  25. package/dist/ingest/claude-quota.d.ts +5 -0
  26. package/dist/ingest/claude-quota.d.ts.map +1 -0
  27. package/dist/ingest/claude.d.ts +8 -2
  28. package/dist/ingest/claude.d.ts.map +1 -1
  29. package/dist/ingest/codex-quota.d.ts +5 -0
  30. package/dist/ingest/codex-quota.d.ts.map +1 -0
  31. package/dist/ingest/codex.d.ts +1 -0
  32. package/dist/ingest/codex.d.ts.map +1 -1
  33. package/dist/ingest/cursor.d.ts +6 -0
  34. package/dist/ingest/cursor.d.ts.map +1 -0
  35. package/dist/ingest/gemini.d.ts +1 -0
  36. package/dist/ingest/gemini.d.ts.map +1 -1
  37. package/dist/ingest/hermes.d.ts +6 -0
  38. package/dist/ingest/hermes.d.ts.map +1 -0
  39. package/dist/ingest/opencode.d.ts +7 -0
  40. package/dist/ingest/opencode.d.ts.map +1 -0
  41. package/dist/ingest/otel.d.ts +20 -0
  42. package/dist/ingest/otel.d.ts.map +1 -0
  43. package/dist/ingest/pi.d.ts +7 -0
  44. package/dist/ingest/pi.d.ts.map +1 -0
  45. package/dist/ingest/plugin.d.ts +17 -0
  46. package/dist/ingest/plugin.d.ts.map +1 -0
  47. package/dist/lib/agents.d.ts +11 -0
  48. package/dist/lib/agents.d.ts.map +1 -0
  49. package/dist/lib/billing-diff.d.ts +22 -0
  50. package/dist/lib/billing-diff.d.ts.map +1 -0
  51. package/dist/lib/cloud-sync.d.ts +35 -0
  52. package/dist/lib/cloud-sync.d.ts.map +1 -0
  53. package/dist/lib/config.d.ts.map +1 -1
  54. package/dist/lib/gatherer.d.ts.map +1 -1
  55. package/dist/lib/model-config.d.ts.map +1 -1
  56. package/dist/lib/open-projects.d.ts +19 -0
  57. package/dist/lib/open-projects.d.ts.map +1 -0
  58. package/dist/lib/paths.d.ts +20 -0
  59. package/dist/lib/paths.d.ts.map +1 -0
  60. package/dist/lib/pricing.d.ts +2 -2
  61. package/dist/lib/pricing.d.ts.map +1 -1
  62. package/dist/lib/savings.d.ts +17 -0
  63. package/dist/lib/savings.d.ts.map +1 -0
  64. package/dist/lib/serve-auth.d.ts +4 -0
  65. package/dist/lib/serve-auth.d.ts.map +1 -0
  66. package/dist/lib/spikes.d.ts +18 -0
  67. package/dist/lib/spikes.d.ts.map +1 -0
  68. package/dist/lib/sync-all.d.ts +28 -0
  69. package/dist/lib/sync-all.d.ts.map +1 -0
  70. package/dist/lib/watch-paths.d.ts +3 -0
  71. package/dist/lib/watch-paths.d.ts.map +1 -0
  72. package/dist/lib/webhooks.d.ts.map +1 -1
  73. package/dist/mcp/http.d.ts +12 -0
  74. package/dist/mcp/http.d.ts.map +1 -0
  75. package/dist/mcp/index.js +2518 -472
  76. package/dist/mcp/server.d.ts +4 -0
  77. package/dist/mcp/server.d.ts.map +1 -0
  78. package/dist/otel/index.d.ts +3 -0
  79. package/dist/otel/index.d.ts.map +1 -0
  80. package/dist/otel/index.js +1372 -0
  81. package/dist/server/index.js +2818 -218
  82. package/dist/server/serve.d.ts +9 -1
  83. package/dist/server/serve.d.ts.map +1 -1
  84. package/dist/types/index.d.ts +56 -6
  85. package/dist/types/index.d.ts.map +1 -1
  86. package/package.json +7 -3
package/LICENSE CHANGED
@@ -1,17 +1,191 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
1
 
5
- Copyright 2026 Andrei Hasna
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
6
5
 
7
- Licensed under the Apache License, Version 2.0 (the "License");
8
- you may not use this file except in compliance with the License.
9
- You may obtain a copy of the License at
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
10
7
 
11
- http://www.apache.org/licenses/LICENSE-2.0
8
+ 1. Definitions.
12
9
 
13
- Unless required by applicable law or agreed to in writing, software
14
- distributed under the License is distributed on an "AS IS" BASIS,
15
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- See the License for the specific language governing permissions and
17
- limitations under the License.
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2026 Hasna, Inc.
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
package/README.md CHANGED
@@ -1,60 +1,246 @@
1
1
  # @hasna/economy
2
2
 
3
- AI coding cost tracker CLI + MCP server + REST API + web dashboard for Claude Code, Codex, and Gemini
3
+ AI coding cost tracker for Claude Code, Takumi, Codex, and Gemini. It ships as a CLI, MCP server, REST API, web dashboard, and native macOS menu bar app.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@hasna/economy)](https://www.npmjs.com/package/@hasna/economy)
6
6
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
7
7
 
8
+ ## Features
9
+
10
+ - Ingests local Claude Code, Takumi, Codex, and Gemini CLI usage.
11
+ - Tracks sessions, requests, projects, machines, models, cache tokens, budgets, goals, and provider billing.
12
+ - Seeds editable model pricing with input, output, cache-read, 5-minute cache-write, 1-hour cache-write, and context-cache storage rates.
13
+ - Handles tiered pricing such as Gemini long-prompt rates and OpenAI long-context rates.
14
+ - Reconciles estimates against Anthropic, OpenAI, and Gemini billing sources.
15
+ - Exposes cost data through CLI commands, an MCP server, REST endpoints, and a dashboard.
16
+ - Syncs project metadata from the `@hasna/projects` registry during full local sync.
17
+ - Sends budget alert webhooks and retries failed deliveries on later syncs.
18
+
8
19
  ## Install
9
20
 
10
21
  ```bash
11
22
  bun install -g @hasna/economy
12
23
  ```
13
24
 
14
- ## CLI Usage
25
+ ## Quick Start
26
+
27
+ ```bash
28
+ economy sync --verbose
29
+ economy today
30
+ economy pricing list
31
+ economy serve --port 3456
32
+ ```
33
+
34
+ Open the dashboard with:
35
+
36
+ ```bash
37
+ economy dashboard --port 3456
38
+ ```
39
+
40
+ ## Agent Integrations
41
+
42
+ Use the MCP server for live cost context inside coding agents:
43
+
44
+ ```bash
45
+ economy mcp --all
46
+ ```
47
+
48
+ That prints install snippets for Claude Code, Codex, and Gemini:
49
+
50
+ ```bash
51
+ claude mcp add --transport stdio --scope user economy -- economy-mcp
52
+ ```
53
+
54
+ Codex config:
55
+
56
+ ```toml
57
+ [mcp_servers.economy]
58
+ command = "economy-mcp"
59
+ args = []
60
+ ```
61
+
62
+ Gemini settings:
63
+
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "economy": { "command": "economy-mcp", "args": [] }
68
+ }
69
+ }
70
+ ```
71
+
72
+ The MCP server exposes read tools for summaries, sessions, machines, pricing, daily spend, budgets, goals, and provider billing. It also exposes mutation tools for budgets, pricing rows, and goals so Claude Code, Codex, and Gemini can manage Economy data through the same validated surface as the CLI and REST API.
73
+
74
+ ## Ingest
75
+
76
+ Run a full local ingest:
77
+
78
+ ```bash
79
+ economy sync
80
+ ```
81
+
82
+ Limit ingest to one source:
83
+
84
+ ```bash
85
+ economy sync --claude
86
+ economy sync --codex
87
+ economy sync --gemini
88
+ economy sync --takumi
89
+ ```
90
+
91
+ Useful repair options:
15
92
 
16
93
  ```bash
17
- economy --help
94
+ economy sync --force
95
+ economy sync --recalculate
96
+ economy sync --backfill-machine
18
97
  ```
19
98
 
20
- ## MCP Server
99
+ Full sync also imports active project metadata from `@hasna/projects` when the registry is available.
100
+
101
+ ## Pricing
102
+
103
+ Default pricing is seeded into SQLite and can be edited locally:
104
+
105
+ ```bash
106
+ economy pricing list
107
+ economy pricing set gpt-5.4 --input 2.50 --output 15 --cache-read 0.25
108
+ economy pricing set claude-sonnet-4-6 --input 3 --output 15 --cache-read 0.30 --cache-write 3.75 --cache-write-1h 6
109
+ economy pricing set gemini-3.1-pro-preview --input 2 --output 12 --cache-read 0.20 --cache-storage 4.50
110
+ ```
111
+
112
+ Pricing supports separate cache-read, 5-minute cache-write, 1-hour cache-write, and context-cache storage rates. Custom user-edited rows are preserved when default pricing seeds are repaired or updated.
113
+
114
+ Provider-qualified rows such as `z-ai/glm-5.1` or `minimax/minimax-m2.7` are matched before unqualified rows, so router-specific prices can coexist with direct provider API prices.
115
+
116
+ OpenRouter-style model IDs ending in `:free` are treated as zero-cost variants even when their base model has a paid default row.
117
+
118
+ ## Billing
119
+
120
+ Estimated costs can be reconciled with provider billing:
21
121
 
22
122
  ```bash
23
- economy-mcp --help
123
+ economy billing sync --days 31
124
+ economy billing show --period month
24
125
  ```
25
126
 
127
+ Supported billing sources:
128
+
129
+ - Anthropic: `HASNAXYZ_ANTHROPIC_LIVE_ADMIN_API_KEY` or `ANTHROPIC_ADMIN_API_KEY`
130
+ - OpenAI: `HASNAXYZ_OPENAI_LIVE_ADMIN_API_KEY` or `OPENAI_ADMIN_API_KEY`
131
+ - Gemini: `HASNA_ECONOMY_GEMINI_BILLING_EXPORT_PATH`, legacy `HASNAXYZ_ECONOMY_GEMINI_BILLING_EXPORT_PATH`, or `GEMINI_BILLING_EXPORT_PATH`
132
+
133
+ Gemini billing export files may be JSON arrays, JSON objects with `rows`, JSONL, or simple CSV.
134
+
135
+ ## Budgets, Goals, And Alerts
136
+
137
+ ```bash
138
+ economy budget set --period monthly --limit 50 --alert 80
139
+ economy budget set --agent codex --period weekly --limit 25 --alert 70
140
+ economy budget list
141
+ economy goal set --period month --limit 40
142
+ economy goal set --agent gemini --period week --limit 15
143
+ economy goal list
144
+ economy config set webhook-url https://example.com/economy-webhook
145
+ economy config webhook-test
146
+ ```
147
+
148
+ Budgets and goals can be global, project-scoped with `--project`, agent-scoped with `--agent`, or both. Valid agent scopes are `claude`, `takumi`, `codex`, and `gemini`.
149
+
150
+ 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.
151
+
26
152
  ## REST API
27
153
 
154
+ Start the server:
155
+
28
156
  ```bash
29
- economy-serve --help
157
+ economy-serve --port 3456
30
158
  ```
31
159
 
160
+ Common endpoints:
161
+
162
+ - `GET /health`
163
+ - `GET /api/summary?period=today`
164
+ - `GET /api/sessions?agent=codex&limit=20`
165
+ - `GET /api/sessions/:id/requests`
166
+ - `GET /api/models`
167
+ - `GET /api/projects`
168
+ - `GET /api/budgets`
169
+ - `POST /api/budgets`
170
+ - `DELETE /api/budgets/:id`
171
+ - `GET /api/pricing`
172
+ - `POST /api/pricing`
173
+ - `DELETE /api/pricing/:model`
174
+ - `GET /api/goals`
175
+ - `POST /api/goals`
176
+ - `DELETE /api/goals/:id`
177
+ - `GET /api/billing?period=month`
178
+ - `POST /api/sync`
179
+ - `POST /api/billing/sync`
180
+
181
+ Budget and goal mutation endpoints validate agent scopes against `claude`, `takumi`, `codex`, and `gemini`.
182
+
183
+ The server also serves the built dashboard when `dashboard/dist` is present.
184
+
32
185
  ## Native macOS Menubar
33
186
 
34
- The `menubar/` app is a native SwiftUI menu bar app built with `MenuBarExtra`, not Electron. It targets macOS 26 and talks to the REST API exposed by `economy-serve`. The server URL is configurable inside the app and defaults to `http://127.0.0.1:3456`.
187
+ The `menubar/` app is a native SwiftUI `MenuBarExtra` app, not Electron. It targets Swift 5.9+ and macOS 14+, and talks to the REST API exposed by `economy-serve`. The default server URL is `http://127.0.0.1:3456`.
35
188
 
36
- Build it on macOS with Xcode / Swift 6.2:
189
+ Build it on macOS:
37
190
 
38
191
  ```bash
39
192
  cd menubar
40
193
  swift build -c release
41
194
  ```
42
195
 
196
+ Release app helpers:
197
+
198
+ ```bash
199
+ economy menubar install
200
+ economy menubar start
201
+ economy menubar stop
202
+ economy menubar uninstall
203
+ ```
204
+
43
205
  ## Cloud Sync
44
206
 
45
- This package supports cloud sync via `@hasna/cloud`:
207
+ Economy can push and pull local SQLite data through `@hasna/cloud` PostgreSQL sync:
46
208
 
47
209
  ```bash
48
- cloud setup
49
- cloud sync push --service economy
50
- cloud sync pull --service economy
210
+ economy cloud status
211
+ economy cloud push
212
+ economy cloud pull
213
+ economy cloud sync
51
214
  ```
52
215
 
53
216
  ## Data Directory
54
217
 
55
218
  Data is stored in `~/.hasna/economy/`.
56
219
 
57
- The main SQLite database lives at `~/.hasna/economy/economy.db`. Older `~/.economy/` data is auto-migrated on first open.
220
+ The main SQLite database lives at `~/.hasna/economy/economy.db`. Older `~/.economy/` data is auto-migrated on first open. Override the database path with `HASNA_ECONOMY_DB_PATH` or `ECONOMY_DB`.
221
+
222
+ ## Development
223
+
224
+ ```bash
225
+ bun test
226
+ bun run typecheck
227
+ bun run build
228
+ cd dashboard && bun run lint
229
+ cd menubar && swift build -c release
230
+ ```
231
+
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`
58
244
 
59
245
  ## License
60
246
 
@@ -0,0 +1,2 @@
1
+ export declare function printCompletion(shell: string): void;
2
+ //# sourceMappingURL=completion.d.ts.map
@@ -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,4 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerExtendedCommands(program: Command): void;
3
+ export declare function registerFleetCommands(program: Command): void;
4
+ //# sourceMappingURL=extras.d.ts.map
@@ -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;AA+CnC,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,CAsE7E;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAcvC;AAED,wBAAgB,YAAY,IAAI,IAAI,CAOnC;AAED,wBAAgB,WAAW,IAAI,IAAI,CAWlC"}
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"}
@@ -3,6 +3,7 @@ interface WatchOptions {
3
3
  interval: number;
4
4
  agent?: Agent;
5
5
  notify?: number;
6
+ daemon?: boolean;
6
7
  }
7
8
  export declare function watchCosts(opts: WatchOptions): Promise<void>;
8
9
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/watch.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAEjD,UAAU,YAAY;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAuBD,wBAAsB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFlE"}
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"}