@hasna/economy 0.3.3 → 0.3.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/watch.ts"],"names":[],"mappings":"AAMA,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,CA0GlE"}
1
+ {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/watch.ts"],"names":[],"mappings":"AAMA,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,CAgHlE"}
package/dist/cli/index.js CHANGED
@@ -6330,7 +6330,12 @@ async function watchCosts(opts) {
6330
6330
  if (daemon)
6331
6331
  ingestPending = true;
6332
6332
  await poll();
6333
- const timer = setInterval(poll, opts.interval * 1000);
6333
+ const timer = setInterval(() => {
6334
+ poll().catch((e) => {
6335
+ console.log(chalk5.dim(`
6336
+ Poll error: ${e instanceof Error ? e.message : String(e)} \u2014 retrying next tick`));
6337
+ });
6338
+ }, opts.interval * 1000);
6334
6339
  process.on("SIGINT", () => {
6335
6340
  clearInterval(timer);
6336
6341
  if (ingestTimer)
@@ -10581,6 +10586,7 @@ init_billing();
10581
10586
  init_package_metadata();
10582
10587
  init_pricing();
10583
10588
  init_store();
10589
+ init_transport();
10584
10590
  import { execSync } from "child_process";
10585
10591
  var program = new Command;
10586
10592
  program.name("economy").description("AI coding cost tracker \u2014 Claude, Codex, Gemini, OpenCode, Cursor, Pi, Hermes").version(packageMetadata.version);
@@ -11650,4 +11656,16 @@ registerBriefCommand(program, { beforeRead: () => autoSync({ dedupe: false }) })
11650
11656
  registerExtendedCommands(program);
11651
11657
  registerFleetCommands(program);
11652
11658
  registerEventsCommands(program, { source: "economy" });
11653
- program.parseAsync();
11659
+ function reportCliError(err2) {
11660
+ if (err2 instanceof HasnaHttpError) {
11661
+ if (err2.status === 404) {
11662
+ fail(`economy: the cloud API has no endpoint for this command (${err2.method} ${err2.path} -> 404). ` + `The self-hosted server is likely running an older build \u2014 it needs an ECS redeploy of the current version.`);
11663
+ }
11664
+ if (err2.status === 401 || err2.status === 403) {
11665
+ fail(`economy: cloud API rejected the request (${err2.status}). Check HASNA_ECONOMY_API_KEY.`);
11666
+ }
11667
+ fail(`economy: cloud API request failed (${err2.method} ${err2.path} -> ${err2.status}).`);
11668
+ }
11669
+ fail(`economy: ${err2 instanceof Error ? err2.message : String(err2)}`);
11670
+ }
11671
+ program.parseAsync().catch(reportCliError);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/economy",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "AI coding cost tracker — CLI + MCP server + REST API + web dashboard for Claude Code, Codex, Gemini, OpenCode, Cursor, Pi, and Hermes",
5
5
  "repository": {
6
6
  "type": "git",