ai-spend-agent 0.9.9 → 0.9.10

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 (2) hide show
  1. package/dist/index.js +18 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1116,12 +1116,27 @@ async function workspaceCommand(args, runtime) {
1116
1116
  return fail("A retained batch was refused. No new envelope or nonce was created; resolve the refusal before pushing again.");
1117
1117
  const now = runtime.workspaceNow ?? workspaceClock.now();
1118
1118
  const loaded = status.pending ? undefined : runtime.workspaceLoadCalls ? await runtime.workspaceLoadCalls()
1119
- : await loadLocalAgentFinancialUsage({ workspaceDailyFacts: true, sinceIso: workspaceClock.daysBefore(now, 30) });
1120
- if (loaded?.diagnostics.some(item => item.code !== "directory_missing"))
1121
- return fail("Local source reading is incomplete. No facts were replaced or sent; resolve the reported source coverage before pushing.");
1119
+ : await loadLocalAgentFinancialUsage({ workspaceDailyFacts: true, sinceIso: workspaceClock.daysBefore(now, 30),
1120
+ untilIso: `${now.slice(0, 10)}T00:00:00.000Z` });
1121
+ const representedUnknowns = loaded?.diagnostics.filter(item => item.code === "unsupported_token_shape"
1122
+ && item.workspaceFactCoverage === "unknown_tokens").reduce((count, item) => count + item.count, 0) ?? 0;
1123
+ const blockingDiagnostics = loaded?.diagnostics.filter(item => item.code !== "directory_missing"
1124
+ && !(item.code === "unsupported_token_shape" && item.workspaceFactCoverage === "unknown_tokens")) ?? [];
1125
+ if (blockingDiagnostics.length) {
1126
+ const counts = new Map();
1127
+ for (const diagnostic of blockingDiagnostics) {
1128
+ const label = `${localAgentFormatLabel(diagnostic.agent)}: ${diagnostic.code}${diagnostic.workspaceReason ? ` (${diagnostic.workspaceReason})` : ""}`;
1129
+ counts.set(label, (counts.get(label) ?? 0) + diagnostic.count);
1130
+ }
1131
+ return fail(["Local source reading is incomplete. No facts were replaced or sent.",
1132
+ "Local scan diagnostics (counts, without paths or transcript contents):",
1133
+ ...[...counts].sort(([left], [right]) => left.localeCompare(right)).map(([label, count]) => `${label}: ${count}`),
1134
+ "Share these diagnostic counts for help before retrying. Do not delete logs or reconnect this machine."].join("\n"));
1135
+ }
1122
1136
  const prepared = await prepareWorkspacePush({ home: runtime.homeDirectory, calls: loaded?.calls ?? [], generatedAt: now,
1123
1137
  confirm: (payload, coverage) => consent(["Exact outgoing local facts (no prompts, paths, session IDs, or amounts):", payload,
1124
1138
  `Excluded calls: ${coverage.excludedCalls}. Missing token components: ${coverage.incompleteComponents}.`,
1139
+ ...(representedUnknowns ? [`${representedUnknowns} incomplete local usage records are represented by unknown token values, never zero.`] : []),
1125
1140
  status.pending?.state === "uncertain" ? "This retries only the identical retained signed batch with its original nonce. Send this exact batch again? [y/N] "
1126
1141
  : "Machine tokens remain separate from provider-reported tokens and billed costs. Send this batch? [y/N] "].join("\n")) });
1127
1142
  if (prepared.state === "unchanged")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-spend-agent",
3
- "version": "0.9.9",
3
+ "version": "0.9.10",
4
4
  "funding": "https://asktilden.com",
5
5
  "description": "Local-first financial accountability CLI: Claude Code/Codex attribution, provenance, and next actions, plus experimental Gemini CLI cost evidence.",
6
6
  "type": "module",
@@ -55,8 +55,8 @@
55
55
  "prepack": "npm run build"
56
56
  },
57
57
  "dependencies": {
58
- "@agent-finops/core": "0.9.9",
59
- "@agent-finops/report": "0.9.9",
58
+ "@agent-finops/core": "0.9.10",
59
+ "@agent-finops/report": "0.9.10",
60
60
  "yocto-spinner": "^1.2.0"
61
61
  }
62
62
  }