@tangle-network/agent-app 0.45.26 → 0.45.28

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 (70) hide show
  1. package/dist/assistant/index.d.ts +1 -0
  2. package/dist/assistant/index.js +5 -5
  3. package/dist/chat-routes/index.js +21 -21
  4. package/dist/chat-store/index.js +2 -2
  5. package/dist/{chunk-B2UEW62O.js → chunk-5ZTFZBS6.js} +4 -4
  6. package/dist/{chunk-AGCRCOQH.js → chunk-AWPK7ZDS.js} +1 -1
  7. package/dist/chunk-C3CAYGGQ.js +18 -0
  8. package/dist/chunk-C3CAYGGQ.js.map +1 -0
  9. package/dist/chunk-EMLGWEHV.js +33 -0
  10. package/dist/chunk-EMLGWEHV.js.map +1 -0
  11. package/dist/{chunk-XEA5EG6P.js → chunk-EPZYYWCT.js} +8 -30
  12. package/dist/chunk-EPZYYWCT.js.map +1 -0
  13. package/dist/{chunk-WD2B6HGY.js → chunk-K4RA5T3A.js} +11 -32
  14. package/dist/chunk-K4RA5T3A.js.map +1 -0
  15. package/dist/chunk-NEJ7OMQS.js +351 -0
  16. package/dist/chunk-NEJ7OMQS.js.map +1 -0
  17. package/dist/{chunk-7V2I3JGZ.js → chunk-OTLEYHOG.js} +50 -12
  18. package/dist/chunk-OTLEYHOG.js.map +1 -0
  19. package/dist/{chunk-RT5RKAFX.js → chunk-QGSVF6DZ.js} +8 -18
  20. package/dist/chunk-QGSVF6DZ.js.map +1 -0
  21. package/dist/{chunk-KOMP6NDW.js → chunk-WC43OQMR.js} +45 -34
  22. package/dist/chunk-WC43OQMR.js.map +1 -0
  23. package/dist/{chunk-N3G3FSM4.js → chunk-YXA3U4JZ.js} +9 -47
  24. package/dist/chunk-YXA3U4JZ.js.map +1 -0
  25. package/dist/design-canvas-react/index.js +4 -4
  26. package/dist/design-canvas-react/lazy.js +1 -1
  27. package/dist/legibility/cli.js +14 -8
  28. package/dist/legibility/cli.js.map +1 -1
  29. package/dist/legibility/index.js +2 -1
  30. package/dist/peer-floors/cli.js +14 -8
  31. package/dist/peer-floors/cli.js.map +1 -1
  32. package/dist/preflight/cli.js +4 -2
  33. package/dist/preflight/cli.js.map +1 -1
  34. package/dist/{run-tEsZUhAf.d.ts → run-D80hoLKh.d.ts} +1 -1
  35. package/dist/sandbox/index.d.ts +53 -1
  36. package/dist/sandbox/index.js +1 -1
  37. package/dist/signoff/cli.d.ts +2 -2
  38. package/dist/signoff/cli.js +6 -18
  39. package/dist/signoff/cli.js.map +1 -1
  40. package/dist/signoff/index.d.ts +4 -420
  41. package/dist/signoff/index.js +3 -55
  42. package/dist/signoff/proof-cli.js +11 -6
  43. package/dist/signoff/proof-cli.js.map +1 -1
  44. package/dist/signoff/proof.d.ts +70 -271
  45. package/dist/signoff/proof.js +3 -73
  46. package/dist/signoff/proof.js.map +1 -1
  47. package/dist/spend/cli.d.ts +1 -0
  48. package/dist/spend/cli.js +119 -0
  49. package/dist/spend/cli.js.map +1 -0
  50. package/dist/spend/index.d.ts +640 -0
  51. package/dist/spend/index.js +196 -0
  52. package/dist/spend/index.js.map +1 -0
  53. package/dist/stream/index.js +14 -14
  54. package/dist/teams/index.js +9 -9
  55. package/dist/teams/invitations-api.js +7 -7
  56. package/dist/theme-contract/cli.js +6 -2
  57. package/dist/theme-contract/cli.js.map +1 -1
  58. package/dist/theme-contract/index.js +2 -1
  59. package/dist/{types-U7Nz-txa.d.ts → types-Bd6uW9vQ.d.ts} +1 -1
  60. package/dist/web-react/index.d.ts +28 -40
  61. package/dist/web-react/index.js +11 -11
  62. package/package.json +7 -1
  63. package/dist/chunk-7V2I3JGZ.js.map +0 -1
  64. package/dist/chunk-KOMP6NDW.js.map +0 -1
  65. package/dist/chunk-N3G3FSM4.js.map +0 -1
  66. package/dist/chunk-RT5RKAFX.js.map +0 -1
  67. package/dist/chunk-WD2B6HGY.js.map +0 -1
  68. package/dist/chunk-XEA5EG6P.js.map +0 -1
  69. /package/dist/{chunk-B2UEW62O.js.map → chunk-5ZTFZBS6.js.map} +0 -0
  70. /package/dist/{chunk-AGCRCOQH.js.map → chunk-AWPK7ZDS.js.map} +0 -0
@@ -0,0 +1,196 @@
1
+ import {
2
+ DEFAULT_CEILING_TOLERANCE_MS,
3
+ SPEND_CHECKS,
4
+ chargeNanoUsd,
5
+ computeExpectedCeiling,
6
+ formatSpendReport,
7
+ isCharge,
8
+ parseSandboxGroupKey,
9
+ parseSettlementReference,
10
+ reconcileSpend,
11
+ settlementSandboxId,
12
+ spendReportToJson
13
+ } from "../chunk-NEJ7OMQS.js";
14
+
15
+ // src/spend/store.ts
16
+ function foldSpendBoxRecord(record, patch) {
17
+ let lastActivityAt = record.lastActivityAt;
18
+ let stoppedAt = record.stoppedAt;
19
+ let openDetachedRunIds = record.openDetachedRunIds;
20
+ if (patch.observedActivityAt !== void 0) {
21
+ lastActivityAt = Math.max(lastActivityAt, patch.observedActivityAt);
22
+ if (stoppedAt !== null && patch.observedActivityAt > stoppedAt) stoppedAt = null;
23
+ }
24
+ if (patch.openDetachedRunAdd !== void 0 && !openDetachedRunIds.includes(patch.openDetachedRunAdd)) {
25
+ openDetachedRunIds = [...openDetachedRunIds, patch.openDetachedRunAdd];
26
+ }
27
+ if (patch.openDetachedRunRemove !== void 0) {
28
+ openDetachedRunIds = openDetachedRunIds.filter((id) => id !== patch.openDetachedRunRemove);
29
+ }
30
+ if (patch.stoppedAt !== void 0) {
31
+ stoppedAt = patch.stoppedAt >= lastActivityAt ? patch.stoppedAt : stoppedAt;
32
+ }
33
+ return {
34
+ ...record,
35
+ lastActivityAt,
36
+ stoppedAt,
37
+ openDetachedRunIds,
38
+ // Set-once: a deleted sandbox id never comes back, so a second observation
39
+ // is a duplicate delivery, not a second deletion.
40
+ deletedAt: record.deletedAt ?? patch.deletedAt ?? null
41
+ };
42
+ }
43
+ function createInMemorySpendLedgerStore() {
44
+ const rows = /* @__PURE__ */ new Map();
45
+ return {
46
+ async load(sandboxId) {
47
+ const row = rows.get(sandboxId);
48
+ return row ? structuredClone(row) : null;
49
+ },
50
+ async insert(record) {
51
+ const stored = structuredClone(record);
52
+ rows.set(record.sandboxId, stored);
53
+ return structuredClone(stored);
54
+ },
55
+ async update(sandboxId, patch) {
56
+ const current = rows.get(sandboxId);
57
+ if (!current) return null;
58
+ const next = foldSpendBoxRecord(current, patch);
59
+ rows.set(sandboxId, next);
60
+ return structuredClone(next);
61
+ },
62
+ records() {
63
+ return [...rows.values()].map((row) => structuredClone(row));
64
+ },
65
+ put(record) {
66
+ rows.set(record.sandboxId, structuredClone(record));
67
+ }
68
+ };
69
+ }
70
+ function createSpendLedger(options) {
71
+ const { store } = options;
72
+ const clock = options.now ?? Date.now;
73
+ return {
74
+ async observeSandbox(input) {
75
+ const at = input.at ?? clock();
76
+ const existing = await store.load(input.sandboxId);
77
+ if (existing) {
78
+ const updated = await store.update(input.sandboxId, { observedActivityAt: at });
79
+ return updated ?? existing;
80
+ }
81
+ return await store.insert(
82
+ {
83
+ sandboxId: input.sandboxId,
84
+ workspaceId: input.workspaceId,
85
+ createdAt: at,
86
+ idleTimeoutSeconds: input.idleTimeoutSeconds,
87
+ maxLifetimeSeconds: input.maxLifetimeSeconds ?? null,
88
+ lastActivityAt: at,
89
+ openDetachedRunIds: [],
90
+ stoppedAt: null,
91
+ deletedAt: null
92
+ },
93
+ options.extras
94
+ );
95
+ },
96
+ async recordActivity(sandboxId, at) {
97
+ return await store.update(sandboxId, { observedActivityAt: at ?? clock() });
98
+ },
99
+ async recordDetachedRunStarted(sandboxId, runId, at) {
100
+ return await store.update(sandboxId, {
101
+ observedActivityAt: at ?? clock(),
102
+ openDetachedRunAdd: runId
103
+ });
104
+ },
105
+ async recordDetachedRunEnded(sandboxId, runId, at) {
106
+ return await store.update(sandboxId, {
107
+ observedActivityAt: at ?? clock(),
108
+ openDetachedRunRemove: runId
109
+ });
110
+ },
111
+ async recordStopped(sandboxId, at) {
112
+ return await store.update(sandboxId, { stoppedAt: at ?? clock() });
113
+ },
114
+ async recordDeleted(sandboxId, at) {
115
+ return await store.update(sandboxId, { deletedAt: at ?? clock() });
116
+ }
117
+ };
118
+ }
119
+
120
+ // src/spend/budget.ts
121
+ var ComputeBudgetExceededError = class extends Error {
122
+ workspaceId;
123
+ limitNanoUsd;
124
+ settledNanoUsd;
125
+ overageNanoUsd;
126
+ constructor(refusal) {
127
+ super(
128
+ `Compute budget exceeded for workspace ${refusal.workspaceId}: $${(refusal.settledNanoUsd / 1e9).toFixed(2)} settled against a cap of $${(refusal.limitNanoUsd / 1e9).toFixed(2)} (over by $${(refusal.overageNanoUsd / 1e9).toFixed(2)}). No sandbox was provisioned. Raise the cap or reconcile the spend before retrying.`
129
+ );
130
+ this.name = "ComputeBudgetExceededError";
131
+ this.workspaceId = refusal.workspaceId;
132
+ this.limitNanoUsd = refusal.limitNanoUsd;
133
+ this.settledNanoUsd = refusal.settledNanoUsd;
134
+ this.overageNanoUsd = refusal.overageNanoUsd;
135
+ }
136
+ };
137
+ async function assertComputeBudget(budget, workspaceId) {
138
+ if (!budget) return;
139
+ const settledNanoUsd = await budget.settledNanoUsd(workspaceId);
140
+ if (settledNanoUsd < budget.limitNanoUsd) return;
141
+ const refusal = {
142
+ workspaceId,
143
+ limitNanoUsd: budget.limitNanoUsd,
144
+ settledNanoUsd,
145
+ overageNanoUsd: settledNanoUsd - budget.limitNanoUsd,
146
+ at: (budget.now ?? Date.now)()
147
+ };
148
+ budget.onRefusal?.(refusal);
149
+ throw new ComputeBudgetExceededError(refusal);
150
+ }
151
+ function createSandboxSpendHooks(options) {
152
+ const { ledger, budget, onError } = options;
153
+ return {
154
+ async beforeProvision(input) {
155
+ await assertComputeBudget(budget, input.workspaceId);
156
+ },
157
+ async onProvisioned(observation) {
158
+ if (!ledger) return;
159
+ try {
160
+ await ledger.observeSandbox({
161
+ sandboxId: observation.sandboxId,
162
+ workspaceId: observation.workspaceId,
163
+ idleTimeoutSeconds: observation.idleTimeoutSeconds,
164
+ maxLifetimeSeconds: observation.maxLifetimeSeconds ?? null,
165
+ at: observation.at
166
+ });
167
+ } catch (err) {
168
+ onError?.(err);
169
+ }
170
+ },
171
+ onActivity(input) {
172
+ if (!ledger) return;
173
+ void ledger.recordActivity(input.sandboxId, input.at).catch((err) => onError?.(err));
174
+ }
175
+ };
176
+ }
177
+ export {
178
+ ComputeBudgetExceededError,
179
+ DEFAULT_CEILING_TOLERANCE_MS,
180
+ SPEND_CHECKS,
181
+ assertComputeBudget,
182
+ chargeNanoUsd,
183
+ computeExpectedCeiling,
184
+ createInMemorySpendLedgerStore,
185
+ createSandboxSpendHooks,
186
+ createSpendLedger,
187
+ foldSpendBoxRecord,
188
+ formatSpendReport,
189
+ isCharge,
190
+ parseSandboxGroupKey,
191
+ parseSettlementReference,
192
+ reconcileSpend,
193
+ settlementSandboxId,
194
+ spendReportToJson
195
+ };
196
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/spend/store.ts","../../src/spend/budget.ts"],"sourcesContent":["import type { SpendBoxPatch, SpendBoxRecord } from './types'\n\n/**\n * Persistence seam for the expectation ledger — the product implements it over\n * its own tables.\n *\n * Deliberately NOT compare-and-set, unlike `MissionStorePort`. A mission has one\n * serialized owner and a lost write corrupts a state machine; a box record is a\n * MONOTONIC FOLD (activity takes a max, a detached-run id joins or leaves a set,\n * delete is set-once) so concurrent writers converge no matter what order they\n * land in. The worst a lost race can do here is leave `lastActivityAt` behind\n * the truth — which makes the derived ceiling TIGHTER, so the failure mode is a\n * false alarm a human dismisses, never a missed charge. That asymmetry is the\n * whole reason the fold is shaped this way.\n *\n * `update` returns null when the row does not exist, never a throw.\n */\nexport interface SpendLedgerStorePort {\n load(sandboxId: string): Promise<SpendBoxRecord | null>\n /** `extras` are the opaque product-column values — write them in the SAME\n * statement as the record, or ignore them if the table has no extra columns. */\n insert(record: SpendBoxRecord, extras?: Record<string, unknown>): Promise<SpendBoxRecord>\n update(sandboxId: string, patch: SpendBoxPatch): Promise<SpendBoxRecord | null>\n}\n\n/**\n * Apply one fold step. Exported so a SQL implementation and an in-memory one\n * reach the same record, and so a product can unit-test its own store against\n * the canonical answer.\n *\n * The two rules worth stating out loud:\n *\n * - `observedActivityAt` only ever moves `lastActivityAt` FORWARD. A replayed\n * or out-of-order event cannot rewind the ceiling.\n * - activity later than a recorded `stoppedAt` CLEARS the stop. A box that\n * worked after the product thought it stopped is running again, and keeping\n * the stale stop would make the ceiling too tight — inventing an over-ceiling\n * finding out of the product's own bookkeeping rather than the platform's.\n */\nexport function foldSpendBoxRecord(record: SpendBoxRecord, patch: SpendBoxPatch): SpendBoxRecord {\n let lastActivityAt = record.lastActivityAt\n let stoppedAt = record.stoppedAt\n let openDetachedRunIds = record.openDetachedRunIds\n\n if (patch.observedActivityAt !== undefined) {\n lastActivityAt = Math.max(lastActivityAt, patch.observedActivityAt)\n if (stoppedAt !== null && patch.observedActivityAt > stoppedAt) stoppedAt = null\n }\n if (patch.openDetachedRunAdd !== undefined && !openDetachedRunIds.includes(patch.openDetachedRunAdd)) {\n openDetachedRunIds = [...openDetachedRunIds, patch.openDetachedRunAdd]\n }\n if (patch.openDetachedRunRemove !== undefined) {\n openDetachedRunIds = openDetachedRunIds.filter((id) => id !== patch.openDetachedRunRemove)\n }\n if (patch.stoppedAt !== undefined) {\n // Latest-wins, but never behind observed activity: a stop we are told about\n // that predates work we watched is not the stop that closed this box.\n stoppedAt = patch.stoppedAt >= lastActivityAt ? patch.stoppedAt : stoppedAt\n }\n\n return {\n ...record,\n lastActivityAt,\n stoppedAt,\n openDetachedRunIds,\n // Set-once: a deleted sandbox id never comes back, so a second observation\n // is a duplicate delivery, not a second deletion.\n deletedAt: record.deletedAt ?? patch.deletedAt ?? null,\n }\n}\n\n/** An in-memory store that also lets a test inspect and force state. */\nexport interface InMemorySpendLedgerStore extends SpendLedgerStorePort {\n /** Every record, insertion order. */\n records(): SpendBoxRecord[]\n /** Unguarded direct write — simulates a crash-shaped or platform-seeded row. */\n put(record: SpendBoxRecord): void\n}\n\n/** Create an in-memory expectation ledger. Production writers use the same port. */\nexport function createInMemorySpendLedgerStore(): InMemorySpendLedgerStore {\n const rows = new Map<string, SpendBoxRecord>()\n return {\n async load(sandboxId) {\n const row = rows.get(sandboxId)\n return row ? structuredClone(row) : null\n },\n async insert(record) {\n const stored = structuredClone(record)\n rows.set(record.sandboxId, stored)\n return structuredClone(stored)\n },\n async update(sandboxId, patch) {\n const current = rows.get(sandboxId)\n if (!current) return null\n const next = foldSpendBoxRecord(current, patch)\n rows.set(sandboxId, next)\n return structuredClone(next)\n },\n records() {\n return [...rows.values()].map((row) => structuredClone(row))\n },\n put(record) {\n rows.set(record.sandboxId, structuredClone(record))\n },\n }\n}\n\n/** What the product tells the ledger when it first sees a box. */\nexport interface ObserveSandboxInput {\n readonly sandboxId: string\n readonly workspaceId: string\n /** The idle timeout the product asked the platform for, seconds. */\n readonly idleTimeoutSeconds: number\n /** The max lifetime the product asked for, seconds, when it asked for one. */\n readonly maxLifetimeSeconds?: number | null\n /** Defaults to the ledger's clock. */\n readonly at?: number\n}\n\nexport interface SpendLedgerOptions {\n readonly store: SpendLedgerStorePort\n /** Injectable clock (epoch ms). Default `Date.now`. */\n readonly now?: () => number\n /** Product columns written verbatim on every insert. */\n readonly extras?: Record<string, unknown>\n}\n\n/**\n * The recording half of spend verification: the product's own account of what\n * it asked the platform for.\n *\n * Every method is best-effort from the caller's point of view — a product wires\n * these into paths that must not fail because bookkeeping failed. They still\n * reject on a store error rather than swallowing it, so a caller that wants\n * fire-and-forget says so at the call site (`/sandbox`'s hook does).\n */\nexport interface SpendLedger {\n /**\n * Record that a box exists and is billable from now. Inserts on first sight,\n * and otherwise records activity — reuse and resume are both \"the platform is\n * charging for this box again\", and the record's own existence is what\n * distinguishes them, so no caller has to know which happened.\n */\n observeSandbox(input: ObserveSandboxInput): Promise<SpendBoxRecord>\n /** Record that the product saw this box do work. */\n recordActivity(sandboxId: string, at?: number): Promise<SpendBoxRecord | null>\n /**\n * Record that the product handed the platform work it will NOT watch finish.\n * Until the matching end is recorded, this box's ceiling cannot rest on\n * observed activity — see `computeExpectedCeiling`.\n */\n recordDetachedRunStarted(sandboxId: string, runId: string, at?: number): Promise<SpendBoxRecord | null>\n /** Record that a detached run was confirmed finished. */\n recordDetachedRunEnded(sandboxId: string, runId: string, at?: number): Promise<SpendBoxRecord | null>\n /** Record that the product knows this box stopped. */\n recordStopped(sandboxId: string, at?: number): Promise<SpendBoxRecord | null>\n /** Record that the product knows this box was deleted. */\n recordDeleted(sandboxId: string, at?: number): Promise<SpendBoxRecord | null>\n}\n\n/** Create the recording half over a product-supplied store. */\nexport function createSpendLedger(options: SpendLedgerOptions): SpendLedger {\n const { store } = options\n const clock = options.now ?? Date.now\n\n return {\n async observeSandbox(input) {\n const at = input.at ?? clock()\n const existing = await store.load(input.sandboxId)\n if (existing) {\n const updated = await store.update(input.sandboxId, { observedActivityAt: at })\n return updated ?? existing\n }\n return await store.insert(\n {\n sandboxId: input.sandboxId,\n workspaceId: input.workspaceId,\n createdAt: at,\n idleTimeoutSeconds: input.idleTimeoutSeconds,\n maxLifetimeSeconds: input.maxLifetimeSeconds ?? null,\n lastActivityAt: at,\n openDetachedRunIds: [],\n stoppedAt: null,\n deletedAt: null,\n },\n options.extras,\n )\n },\n async recordActivity(sandboxId, at) {\n return await store.update(sandboxId, { observedActivityAt: at ?? clock() })\n },\n async recordDetachedRunStarted(sandboxId, runId, at) {\n return await store.update(sandboxId, {\n observedActivityAt: at ?? clock(),\n openDetachedRunAdd: runId,\n })\n },\n async recordDetachedRunEnded(sandboxId, runId, at) {\n return await store.update(sandboxId, {\n observedActivityAt: at ?? clock(),\n openDetachedRunRemove: runId,\n })\n },\n async recordStopped(sandboxId, at) {\n return await store.update(sandboxId, { stoppedAt: at ?? clock() })\n },\n async recordDeleted(sandboxId, at) {\n return await store.update(sandboxId, { deletedAt: at ?? clock() })\n },\n }\n}\n","import type { SpendLedger } from './store'\n\n/** Why provisioning was refused, with every number the decision used. */\nexport interface ComputeBudgetRefusal {\n readonly workspaceId: string\n /** The cap, unsigned nanodollars. */\n readonly limitNanoUsd: number\n /** Cumulative settled compute spend for this workspace, unsigned nanodollars. */\n readonly settledNanoUsd: number\n /** How far past the cap it already is. */\n readonly overageNanoUsd: number\n readonly at: number\n}\n\n/**\n * Provisioning refused because the workspace is already past its compute cap.\n *\n * Correctable by design: every number the decision used is on the error, so a\n * product can render \"this workspace has spent $X of its $Y compute budget\" and\n * an operator can raise the cap or investigate without reading logs.\n *\n * This is the failure mode the module exists to produce. A platform billing\n * defect that used to end in a silent negative balance now ends in provisioning\n * stopping and something loud happening instead.\n */\nexport class ComputeBudgetExceededError extends Error {\n readonly workspaceId: string\n readonly limitNanoUsd: number\n readonly settledNanoUsd: number\n readonly overageNanoUsd: number\n\n constructor(refusal: ComputeBudgetRefusal) {\n super(\n `Compute budget exceeded for workspace ${refusal.workspaceId}: ` +\n `$${(refusal.settledNanoUsd / 1_000_000_000).toFixed(2)} settled against a cap of ` +\n `$${(refusal.limitNanoUsd / 1_000_000_000).toFixed(2)} ` +\n `(over by $${(refusal.overageNanoUsd / 1_000_000_000).toFixed(2)}). ` +\n 'No sandbox was provisioned. Raise the cap or reconcile the spend before retrying.',\n )\n this.name = 'ComputeBudgetExceededError'\n this.workspaceId = refusal.workspaceId\n this.limitNanoUsd = refusal.limitNanoUsd\n this.settledNanoUsd = refusal.settledNanoUsd\n this.overageNanoUsd = refusal.overageNanoUsd\n }\n}\n\n/**\n * A per-workspace cap on sandbox compute.\n *\n * `/billing`'s budget primitive caps MODEL keys, and it works because the\n * platform enforces the cap at the key it minted. Sandbox compute has no such\n * key: a box bills the shared company wallet, so nothing upstream refuses. This\n * carries the same shape to the one place a consumer can still act — the moment\n * before it asks for another box.\n *\n * `settledNanoUsd` is a callback rather than a number because the authority is\n * the platform ledger, not this package: the product reads the same rows it\n * hands the reconciler. Cache it if the read is expensive; a cap is a\n * coarse-grained control and a slightly stale total still refuses.\n */\nexport interface ComputeBudget {\n /** The cap, unsigned nanodollars. */\n readonly limitNanoUsd: number\n /** Cumulative settled compute spend for the workspace, unsigned nanodollars. */\n readonly settledNanoUsd: (workspaceId: string) => Promise<number> | number\n /**\n * Called on every refusal, before the error is thrown. This is the alert\n * seam: a refusal nobody hears is a product that silently stopped working.\n */\n readonly onRefusal?: (refusal: ComputeBudgetRefusal) => void\n /** Injectable clock (epoch ms). Default `Date.now`. */\n readonly now?: () => number\n}\n\n/**\n * Throw {@link ComputeBudgetExceededError} when the workspace is already past\n * its cap. Returns normally — and reads nothing — when no budget is configured.\n *\n * Deliberately a pre-check against spend ALREADY SETTLED, not a reservation\n * against spend about to happen: settlement lags provisioning by design (the\n * platform's durable settlement queue), so there is no instant at which a\n * consumer could hold an accurate running total. The cap therefore overshoots by\n * at most the unsettled tail, which is bounded by the box's own idle timeout.\n * A cap that refuses one box late is worth far more than one that cannot be\n * implemented honestly.\n */\nexport async function assertComputeBudget(\n budget: ComputeBudget | undefined,\n workspaceId: string,\n): Promise<void> {\n if (!budget) return\n const settledNanoUsd = await budget.settledNanoUsd(workspaceId)\n if (settledNanoUsd < budget.limitNanoUsd) return\n\n const refusal: ComputeBudgetRefusal = {\n workspaceId,\n limitNanoUsd: budget.limitNanoUsd,\n settledNanoUsd,\n overageNanoUsd: settledNanoUsd - budget.limitNanoUsd,\n at: (budget.now ?? Date.now)(),\n }\n budget.onRefusal?.(refusal)\n throw new ComputeBudgetExceededError(refusal)\n}\n\n// ── the /sandbox seam ─────────────────────────────────────────────────────────\n\n/**\n * What `/sandbox` reports once a box is provisioned, reused or resumed.\n *\n * Structurally identical to `SandboxProvisionedObservation` in `/sandbox`, and\n * deliberately re-declared rather than imported: `/spend` composes `/sandbox`,\n * so a type import in the other direction would invert the dependency. The two\n * are pinned together by a compile-time assignment in this module's tests.\n */\nexport interface SpendProvisionObservation {\n readonly workspaceId: string\n readonly userId?: string\n readonly sandboxId: string\n readonly boxKey?: string | undefined\n readonly idleTimeoutSeconds: number\n readonly maxLifetimeSeconds?: number | undefined\n readonly at: number\n}\n\n/**\n * The optional seam `EnsureWorkspaceSandboxOptions.spend` and the turn\n * primitives' `spend` option both accept. One object, wired in both places.\n */\nexport interface SandboxSpendSeam {\n beforeProvision?(input: { workspaceId: string; userId?: string }): Promise<void> | void\n onProvisioned?(observation: SpendProvisionObservation): Promise<void> | void\n /** Synchronous by contract — it sits on the turn path. See `createSandboxSpendHooks`. */\n onActivity?(input: { sandboxId: string; at: number }): void\n}\n\nexport interface SandboxSpendHooksOptions {\n /** Records box lifecycle. Omit to run the budget guard alone. */\n readonly ledger?: SpendLedger\n /** Refuses provisioning past a cap. Omit to record alone. */\n readonly budget?: ComputeBudget\n /**\n * Called when RECORDING fails. Recording is best-effort — a bookkeeping\n * failure must never take down the provisioning it is bookkeeping — so this\n * is the only place such a failure is visible. A refusal is NOT routed here;\n * refusals throw, by design.\n */\n readonly onError?: (error: unknown) => void\n}\n\n/**\n * Build the object to hand `ensureWorkspaceSandbox`'s `spend` option.\n *\n * Wiring it is the entire adoption cost: one field, and the product's boxes are\n * both budget-capped and recorded.\n */\nexport function createSandboxSpendHooks(options: SandboxSpendHooksOptions): SandboxSpendSeam {\n const { ledger, budget, onError } = options\n return {\n async beforeProvision(input) {\n await assertComputeBudget(budget, input.workspaceId)\n },\n async onProvisioned(observation) {\n if (!ledger) return\n try {\n await ledger.observeSandbox({\n sandboxId: observation.sandboxId,\n workspaceId: observation.workspaceId,\n idleTimeoutSeconds: observation.idleTimeoutSeconds,\n maxLifetimeSeconds: observation.maxLifetimeSeconds ?? null,\n at: observation.at,\n })\n } catch (err) {\n onError?.(err)\n }\n },\n onActivity(input) {\n if (!ledger) return\n // The turn path calls this synchronously and does not await it, so the\n // promise is settled here rather than escaping as an unhandled rejection.\n // Recording activity is a monotonic max, so a write that lands late — or\n // out of order against another turn's — still converges.\n void ledger.recordActivity(input.sandboxId, input.at).catch((err: unknown) => onError?.(err))\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA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;AAAA,IACL,MAAM,gBAAgB,OAAO;AAC3B,YAAM,oBAAoB,QAAQ,MAAM,WAAW;AAAA,IACrD;AAAA,IACA,MAAM,cAAc,aAAa;AAC/B,UAAI,CAAC,OAAQ;AACb,UAAI;AACF,cAAM,OAAO,eAAe;AAAA,UAC1B,WAAW,YAAY;AAAA,UACvB,aAAa,YAAY;AAAA,UACzB,oBAAoB,YAAY;AAAA,UAChC,oBAAoB,YAAY,sBAAsB;AAAA,UACtD,IAAI,YAAY;AAAA,QAClB,CAAC;AAAA,MACH,SAAS,KAAK;AACZ,kBAAU,GAAG;AAAA,MACf;AAAA,IACF;AAAA,IACA,WAAW,OAAO;AAChB,UAAI,CAAC,OAAQ;AAKb,WAAK,OAAO,eAAe,MAAM,WAAW,MAAM,EAAE,EAAE,MAAM,CAAC,QAAiB,UAAU,GAAG,CAAC;AAAA,IAC9F;AAAA,EACF;AACF;","names":[]}
@@ -4,20 +4,6 @@ import {
4
4
  normalizeClientTurnId,
5
5
  resolveChatTurn
6
6
  } from "../chunk-JEZJ6HTF.js";
7
- import {
8
- DEFAULT_RUNNING_TURN_LEASE_MS,
9
- DEFAULT_RUNNING_TURN_RENEW_INTERVAL_MS,
10
- TURN_EVENTS_MIGRATION_SQL,
11
- TURN_STATUS_SCOPE_MIGRATION_SQL,
12
- coalesceChatStreamEvents,
13
- coalesceDeltas,
14
- createBufferedTurnTap,
15
- createD1TurnEventStore,
16
- createMemoryTurnEventStore,
17
- pumpBufferedTurn,
18
- replayTurnEvents,
19
- stampReplaySeq
20
- } from "../chunk-SDEADFHZ.js";
21
7
  import {
22
8
  MISSING_TOOL_TERMINAL_ERROR,
23
9
  MISSING_TOOL_TERMINAL_REASON,
@@ -42,6 +28,20 @@ import {
42
28
  } from "../chunk-XZ27ENOZ.js";
43
29
  import "../chunk-M3K2HVQD.js";
44
30
  import "../chunk-YJMCRXQQ.js";
31
+ import {
32
+ DEFAULT_RUNNING_TURN_LEASE_MS,
33
+ DEFAULT_RUNNING_TURN_RENEW_INTERVAL_MS,
34
+ TURN_EVENTS_MIGRATION_SQL,
35
+ TURN_STATUS_SCOPE_MIGRATION_SQL,
36
+ coalesceChatStreamEvents,
37
+ coalesceDeltas,
38
+ createBufferedTurnTap,
39
+ createD1TurnEventStore,
40
+ createMemoryTurnEventStore,
41
+ pumpBufferedTurn,
42
+ replayTurnEvents,
43
+ stampReplaySeq
44
+ } from "../chunk-SDEADFHZ.js";
45
45
  export {
46
46
  DEFAULT_RUNNING_TURN_LEASE_MS,
47
47
  DEFAULT_RUNNING_TURN_RENEW_INTERVAL_MS,
@@ -1,3 +1,12 @@
1
+ import {
2
+ INVITATION_EXPIRY_DAYS,
3
+ generateInvitationToken,
4
+ getInvitationExpiresAt,
5
+ inviteUrlForToken,
6
+ normalizeInvitationEmail,
7
+ parseInvitationPermission,
8
+ renderInvitationEmail
9
+ } from "../chunk-2DRYTJHI.js";
1
10
  import {
2
11
  generateInviteToken,
3
12
  isInviteTokenShape,
@@ -18,15 +27,6 @@ import {
18
27
  workspaceRoleToCollaborationAccess,
19
28
  workspaceRoleToSandboxRole
20
29
  } from "../chunk-6XIAPIW6.js";
21
- import {
22
- INVITATION_EXPIRY_DAYS,
23
- generateInvitationToken,
24
- getInvitationExpiresAt,
25
- inviteUrlForToken,
26
- normalizeInvitationEmail,
27
- parseInvitationPermission,
28
- renderInvitationEmail
29
- } from "../chunk-2DRYTJHI.js";
30
30
  export {
31
31
  ASSIGNABLE_WORKSPACE_ROLES,
32
32
  INVITATION_EXPIRY_DAYS,
@@ -1,10 +1,3 @@
1
- import {
2
- SeatLimitError
3
- } from "../chunk-MEUNTJL5.js";
4
- import "../chunk-DJ4VJIH5.js";
5
- import {
6
- hasWorkspaceRole
7
- } from "../chunk-6XIAPIW6.js";
8
1
  import {
9
2
  generateInvitationToken,
10
3
  getInvitationExpiresAt,
@@ -12,6 +5,13 @@ import {
12
5
  normalizeInvitationEmail,
13
6
  parseInvitationPermission
14
7
  } from "../chunk-2DRYTJHI.js";
8
+ import {
9
+ SeatLimitError
10
+ } from "../chunk-MEUNTJL5.js";
11
+ import "../chunk-DJ4VJIH5.js";
12
+ import {
13
+ hasWorkspaceRole
14
+ } from "../chunk-6XIAPIW6.js";
15
15
 
16
16
  // src/teams/invitations-api.ts
17
17
  import { and, eq, lte, sql } from "drizzle-orm";
@@ -1,7 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  checkThemeContract
4
- } from "../chunk-RT5RKAFX.js";
4
+ } from "../chunk-QGSVF6DZ.js";
5
+ import "../chunk-EMLGWEHV.js";
6
+ import {
7
+ invokedAsScript
8
+ } from "../chunk-C3CAYGGQ.js";
5
9
 
6
10
  // src/theme-contract/cli.ts
7
11
  function parseArgs(argv) {
@@ -75,5 +79,5 @@ function main() {
75
79
  );
76
80
  process.exit(1);
77
81
  }
78
- main();
82
+ if (invokedAsScript(import.meta.url, process.argv[1])) main();
79
83
  //# sourceMappingURL=cli.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/theme-contract/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * agent-app-theme-check — CI guard against the invisible-surface incident class.\n *\n * A consumer app runs this over its own source; it fails (exit 1) when a\n * component references a theme token — `var(--popover)` or a preset-mapped\n * utility like `bg-surface-container-high` — that the app's shipped CSS never\n * defines, which would paint that surface transparent with no error at runtime.\n *\n * agent-app-theme-check --src src --src packages/ui/src \\\n * --extra-css src/app-tokens.css\n *\n * Flags (all repeatable except --tokens):\n * --src <dir> source dir to scan for token references (required, 1+)\n * --extra-css <file> extra CSS whose --name: definitions also count as defined\n * --tokens <file> override the base tokens.css (defaults to the one\n * agent-app ships as `@tangle-network/agent-app/styles`)\n * --allow <--var> suppress a token name from the missing report\n *\n * Wire it as a CI step: `\"theme-check\": \"agent-app-theme-check --src src\"`.\n */\n\nimport { checkThemeContract } from './index'\n\ninterface ParsedArgs {\n srcDirs: string[]\n extraCss: string[]\n allow: string[]\n tokens?: string\n}\n\nfunction parseArgs(argv: string[]): ParsedArgs {\n const out: ParsedArgs = { srcDirs: [], extraCss: [], allow: [] }\n for (let i = 0; i < argv.length; i++) {\n const flag = argv[i]\n const take = () => {\n const v = argv[++i]\n if (v === undefined) fail(`${flag} needs a value`)\n return v!\n }\n switch (flag) {\n case '--src':\n out.srcDirs.push(take())\n break\n case '--extra-css':\n out.extraCss.push(take())\n break\n case '--allow':\n out.allow.push(take())\n break\n case '--tokens':\n out.tokens = take()\n break\n case '-h':\n case '--help':\n printUsage()\n process.exit(0)\n break\n default:\n fail(`unknown argument: ${flag}`)\n }\n }\n return out\n}\n\nfunction printUsage(): void {\n process.stdout.write(\n 'Usage: agent-app-theme-check --src <dir> [--src <dir>…] ' +\n '[--extra-css <file>…] [--tokens <file>] [--allow <--var>…]\\n',\n )\n}\n\nfunction fail(msg: string): never {\n process.stderr.write(`agent-app-theme-check: ${msg}\\n`)\n printUsage()\n process.exit(2)\n}\n\nfunction main(): void {\n const args = parseArgs(process.argv.slice(2))\n if (args.srcDirs.length === 0) fail('at least one --src <dir> is required')\n\n const { ok, missing } = checkThemeContract({\n srcDirs: args.srcDirs,\n tokensCss: args.tokens,\n extraTokensCss: args.extraCss,\n allowlist: args.allow,\n })\n\n if (ok) {\n process.stdout.write(`theme contract OK — every referenced token is defined (${args.srcDirs.join(', ')})\\n`)\n process.exit(0)\n }\n\n process.stderr.write(\n `theme contract FAILED — ${missing.length} token reference(s) resolve to nothing (surface ships transparent):\\n\\n`,\n )\n for (const m of missing) process.stderr.write(` ${m.varName}\\n referenced in ${m.referencedIn}\\n`)\n process.stderr.write(\n '\\nDefine these in your tokens.css (or `import \\'@tangle-network/agent-app/styles\\'`),\\n' +\n 'pass the defining CSS via --extra-css, or suppress a deliberately-external one with --allow.\\n',\n )\n process.exit(1)\n}\n\nmain()\n"],"mappings":";;;;;;AA+BA,SAAS,UAAU,MAA4B;AAC7C,QAAM,MAAkB,EAAE,SAAS,CAAC,GAAG,UAAU,CAAC,GAAG,OAAO,CAAC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AQ,OAAO;AAAA,IACb,gCAA2B,QAAQ,MAAM;AAAA;AAAA;AAAA,EAC3C;AACA,aAAW,KAAK,QAAS,SAAQ,OAAO,MAAM,KAAK,EAAE,OAAO;AAAA,oBAAuB,EAAE,YAAY;AAAA,CAAI;AACrG,UAAQ,OAAO;AAAA,IACb;AAAA,EAEF;AACA,UAAQ,KAAK,CAAC;AAChB;AAEA,KAAK;","names":[]}
1
+ {"version":3,"sources":["../../src/theme-contract/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * agent-app-theme-check — CI guard against the invisible-surface incident class.\n *\n * A consumer app runs this over its own source; it fails (exit 1) when a\n * component references a theme token — `var(--popover)` or a preset-mapped\n * utility like `bg-surface-container-high` — that the app's shipped CSS never\n * defines, which would paint that surface transparent with no error at runtime.\n *\n * agent-app-theme-check --src src --src packages/ui/src \\\n * --extra-css src/app-tokens.css\n *\n * Flags (all repeatable except --tokens):\n * --src <dir> source dir to scan for token references (required, 1+)\n * --extra-css <file> extra CSS whose --name: definitions also count as defined\n * --tokens <file> override the base tokens.css (defaults to the one\n * agent-app ships as `@tangle-network/agent-app/styles`)\n * --allow <--var> suppress a token name from the missing report\n *\n * Wire it as a CI step: `\"theme-check\": \"agent-app-theme-check --src src\"`.\n */\n\nimport { checkThemeContract } from './index'\nimport { invokedAsScript } from '../signoff/invoked-as-script'\n\ninterface ParsedArgs {\n srcDirs: string[]\n extraCss: string[]\n allow: string[]\n tokens?: string\n}\n\nfunction parseArgs(argv: string[]): ParsedArgs {\n const out: ParsedArgs = { srcDirs: [], extraCss: [], allow: [] }\n for (let i = 0; i < argv.length; i++) {\n const flag = argv[i]\n const take = () => {\n const v = argv[++i]\n if (v === undefined) fail(`${flag} needs a value`)\n return v!\n }\n switch (flag) {\n case '--src':\n out.srcDirs.push(take())\n break\n case '--extra-css':\n out.extraCss.push(take())\n break\n case '--allow':\n out.allow.push(take())\n break\n case '--tokens':\n out.tokens = take()\n break\n case '-h':\n case '--help':\n printUsage()\n process.exit(0)\n break\n default:\n fail(`unknown argument: ${flag}`)\n }\n }\n return out\n}\n\nfunction printUsage(): void {\n process.stdout.write(\n 'Usage: agent-app-theme-check --src <dir> [--src <dir>…] ' +\n '[--extra-css <file>…] [--tokens <file>] [--allow <--var>…]\\n',\n )\n}\n\nfunction fail(msg: string): never {\n process.stderr.write(`agent-app-theme-check: ${msg}\\n`)\n printUsage()\n process.exit(2)\n}\n\nfunction main(): void {\n const args = parseArgs(process.argv.slice(2))\n if (args.srcDirs.length === 0) fail('at least one --src <dir> is required')\n\n const { ok, missing } = checkThemeContract({\n srcDirs: args.srcDirs,\n tokensCss: args.tokens,\n extraTokensCss: args.extraCss,\n allowlist: args.allow,\n })\n\n if (ok) {\n process.stdout.write(`theme contract OK — every referenced token is defined (${args.srcDirs.join(', ')})\\n`)\n process.exit(0)\n }\n\n process.stderr.write(\n `theme contract FAILED — ${missing.length} token reference(s) resolve to nothing (surface ships transparent):\\n\\n`,\n )\n for (const m of missing) process.stderr.write(` ${m.varName}\\n referenced in ${m.referencedIn}\\n`)\n process.stderr.write(\n '\\nDefine these in your tokens.css (or `import \\'@tangle-network/agent-app/styles\\'`),\\n' +\n 'pass the defining CSS via --extra-css, or suppress a deliberately-external one with --allow.\\n',\n )\n process.exit(1)\n}\n\n/* c8 ignore start — process wiring, exercised by the bin itself */\nif (invokedAsScript(import.meta.url, process.argv[1])) main()\n/* c8 ignore stop */\n"],"mappings":";;;;;;;;;;AAgCA,SAAS,UAAU,MAA4B;AAC7C,QAAM,MAAkB,EAAE,SAAS,CAAC,GAAG,UAAU,CAAC,GAAG,OAAO,CAAC,EAAE;AAC/D,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,OAAO,KAAK,CAAC;AACnB,UAAM,OAAO,MAAM;AACjB,YAAM,IAAI,KAAK,EAAE,CAAC;AAClB,UAAI,MAAM,OAAW,MAAK,GAAG,IAAI,gBAAgB;AACjD,aAAO;AAAA,IACT;AACA,YAAQ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;AAChB;AAGA,IAAI,gBAAgB,YAAY,KAAK,QAAQ,KAAK,CAAC,CAAC,EAAG,MAAK;","names":[]}
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  checkThemeContract
3
- } from "../chunk-RT5RKAFX.js";
3
+ } from "../chunk-QGSVF6DZ.js";
4
+ import "../chunk-EMLGWEHV.js";
4
5
  export {
5
6
  checkThemeContract
6
7
  };
@@ -230,4 +230,4 @@ type SignoffEvent = {
230
230
  readonly durationMs: number;
231
231
  };
232
232
 
233
- export type { LoadedSignoffConfig as L, SignoffSource as S, SignoffEvent as a, SignoffReport as b, SignoffConfig as c, SignoffStepResult as d, SignoffStepSpec as e, SignoffRepoFacts as f, SignoffAttempt as g, SignoffConfigOrigin as h, SignoffHostFacts as i, SignoffInstallResult as j, SignoffInstallSpec as k, SignoffShuffleSpec as l, SignoffStepStatus as m };
233
+ export type { LoadedSignoffConfig as L, SignoffSource as S, SignoffEvent as a, SignoffReport as b, SignoffAttempt as c, SignoffConfig as d, SignoffConfigOrigin as e, SignoffHostFacts as f, SignoffInstallResult as g, SignoffInstallSpec as h, SignoffRepoFacts as i, SignoffShuffleSpec as j, SignoffStepResult as k, SignoffStepSpec as l, SignoffStepStatus as m };
@@ -18,6 +18,7 @@ export { p as parseReviewQueueItem } from '../queue-VTBA5ONX.js';
18
18
  export { SandboxTerminalConnection, SandboxTerminalConnectionResponse, UseSandboxTerminalConnectionOptions, UseSandboxTerminalConnectionResult, tabTerminalConnectionId, useSandboxTerminalConnection } from './terminal.js';
19
19
  import { i as ProductSeatOffer } from '../billing-BibxgALe.js';
20
20
  import { SessionSort, SessionPage, SessionSummary, SessionRailAction } from '../session-shell/index.js';
21
+ import { AsyncResourceState, AsyncEmptySpec } from './async/index.js';
21
22
  import { CatalogModel } from '../catalog/index.js';
22
23
  import { Harness } from '../harness/index.js';
23
24
  export { a as ATTACHMENT_ACCEPT, e as FileIndexReadyResponse, f as FileIndexResponse, g as FileIndexWarmingResponse } from '../attachment-validation-BfJDBU1g.js';
@@ -1031,11 +1032,6 @@ interface AgentActivityPanelProps {
1031
1032
  title?: string;
1032
1033
  emptyLabel?: string;
1033
1034
  }
1034
- /**
1035
- * The standalone cross-context delegation surface: every agent run the
1036
- * product journaled, mission-spawned or not, with status, cost, drill-in, and
1037
- * a mission link slot for promoted delegations.
1038
- */
1039
1035
  declare function AgentActivityPanel({ fetchActivity, renderMissionRef, title, emptyLabel }: AgentActivityPanelProps): react.JSX.Element;
1040
1036
 
1041
1037
  /** Human label for a queue state. */
@@ -1606,6 +1602,7 @@ declare function SessionHistoryPanel({ history, hasAnySessions, query, onQueryCh
1606
1602
  * each re-derived — typed cells, an error a person can act on, and an
1607
1603
  * optimistic edit that can be taken back.
1608
1604
  */
1605
+
1609
1606
  /** The value one cell can hold. `null` is "no value on file". */
1610
1607
  type RecordGridValue = string | number | boolean | null;
1611
1608
  /** Typed outcome for one cell. Callers MUST inspect `succeeded` before reading
@@ -1631,14 +1628,16 @@ type RecordGridRowOutcome = {
1631
1628
  declare function recordGridOk(value: RecordGridValue): RecordGridCellOutcome;
1632
1629
  /** Build a cell failure outcome carrying the message shown next to the cell. */
1633
1630
  declare function recordGridFail(error: string): RecordGridCellOutcome;
1634
- /** How a value came to sit in a cell. Rendered as the provenance tone. */
1635
- type RecordGridSourceBasis =
1636
- /** Extracted from a document or message the product can link to. */
1637
- 'source'
1638
- /** A person entered or confirmed it. */
1639
- | 'confirmed'
1640
- /** Computed from other cells; the quote (if any) is the input, not the value. */
1641
- | 'derived';
1631
+ /**
1632
+ * How a value came to sit in a cell. Rendered as the provenance tone.
1633
+ *
1634
+ * A type alias of `./provenance-model`'s `ProvenanceBasis`, not a lookalike:
1635
+ * two vocabularies for the same concept — a grid cell's origin — shipped one
1636
+ * day apart and would have drifted the moment either one added a value. The
1637
+ * grid gains `asserted` for free (a cell an agent claimed with nothing behind
1638
+ * it), where the caller previously had no way to say that.
1639
+ */
1640
+ type RecordGridSourceBasis = ProvenanceBasis;
1642
1641
  /**
1643
1642
  * Where one cell's value came from. Optional on every row — a grid over data
1644
1643
  * with no lineage renders identically without it.
@@ -1652,7 +1651,9 @@ interface RecordGridCellSource {
1652
1651
  href?: string;
1653
1652
  /** Position inside the source: a page, a line, a span — the caller's words. */
1654
1653
  locator?: string;
1655
- /** How the value got here. Absent renders as a neutral marker. */
1654
+ /** How the value got here. Absent renders as `asserted` the weakest claim
1655
+ * in the union — because a caller that stated no basis has established
1656
+ * nothing about a document, and an omission must never read as one. */
1656
1657
  basis?: RecordGridSourceBasis;
1657
1658
  }
1658
1659
  /** One option of a `select` column. */
@@ -1845,17 +1846,6 @@ declare function withoutRecordGridRemoved(overlay: RecordGridOverlay, rowId: str
1845
1846
  */
1846
1847
  declare function pruneRecordGridOverlay(rows: readonly RecordGridRow[], overlay: RecordGridOverlay): RecordGridOverlay;
1847
1848
 
1848
- /** Which of the three data states the caller is in. Distinct renders: an
1849
- * errored fetch must never be indistinguishable from an empty result. */
1850
- type RecordGridState = 'loading' | 'error' | 'ready';
1851
- /** The empty state's content. `action` is the caller's next step — a link into
1852
- * chat, an import button — because only the product knows what unblocks the
1853
- * reader. */
1854
- interface RecordGridEmptyState {
1855
- title: string;
1856
- description?: string;
1857
- action?: ReactNode;
1858
- }
1859
1849
  /** One committed cell edit, handed to `onUpdate`. */
1860
1850
  interface RecordGridCellChange {
1861
1851
  /** The row as it was BEFORE the edit — what rollback restores. */
@@ -1887,22 +1877,20 @@ type RecordGridCreateOutcome = {
1887
1877
  interface RecordGridProps {
1888
1878
  /** Column definitions, in render order. */
1889
1879
  columns: readonly RecordGridColumn[];
1890
- /** The caller's rows. Optimistic edits are layered over these and dropped as
1891
- * this prop catches up. */
1892
- rows: readonly RecordGridRow[];
1880
+ /** Fetch state over the caller's rows `web-react/async`'s
1881
+ * `AsyncResourceState`, the same three-state contract every other screen
1882
+ * in the shell fetches through. `ready`/`empty`'s value is the base rows;
1883
+ * optimistic edits are layered over it and dropped as a later value
1884
+ * catches up. `error` always carries `retry` — there is no way to render a
1885
+ * failed fetch with no recovery action, by construction. */
1886
+ state: AsyncResourceState<readonly RecordGridRow[]>;
1893
1887
  /** Accessible name for the grid. Required — an unnamed grid is unusable with
1894
1888
  * a screen reader. */
1895
1889
  caption: string;
1896
- /** Data state. Defaults to `ready`. A non-empty `error` forces the error
1897
- * state whatever this says, so a caller cannot render a failed fetch as an
1898
- * empty list by forgetting one prop. */
1899
- state?: RecordGridState;
1900
- /** The failure message the error state renders. */
1901
- error?: string | null;
1902
- /** Re-run the caller's fetch. Absent → the error state offers no retry. */
1903
- onRetry?: () => void;
1904
- /** What the empty state says, and what it offers next. */
1905
- empty: RecordGridEmptyState;
1890
+ /** What the empty state says, and what it offers next — `web-react/async`'s
1891
+ * `AsyncEmptySpec`, so an empty grid reads in the same words as an empty
1892
+ * list or panel elsewhere in the product. */
1893
+ empty: AsyncEmptySpec;
1906
1894
  /** Persist one created row. Absent → no add affordance. */
1907
1895
  onCreate?: (values: Readonly<Record<string, RecordGridValue>>) => Promise<RecordGridCreateOutcome>;
1908
1896
  /** Persist one cell edit. Absent → every cell renders read-only. */
@@ -1926,7 +1914,7 @@ interface RecordGridProps {
1926
1914
  * id, so a record store's fold output maps straight on: one cell per entry,
1927
1915
  * its quote and link in `sources`.
1928
1916
  */
1929
- declare function RecordGrid({ columns, rows, caption, state, error, onRetry, empty, onCreate, onUpdate, onDelete, newRowDefaults, addLabel, locale, toolbar, loadingRowCount, className, }: RecordGridProps): react.JSX.Element;
1917
+ declare function RecordGrid({ columns, caption, state, empty, onCreate, onUpdate, onDelete, newRowDefaults, addLabel, locale, toolbar, loadingRowCount, className, }: RecordGridProps): react.JSX.Element;
1930
1918
 
1931
1919
  /**
1932
1920
  * Keyboard + pointer model for a trigger-and-popover pair, dependency-free.
@@ -2223,4 +2211,4 @@ declare function useThinkingSeconds(active: boolean): number;
2223
2211
  */
2224
2212
  declare function ChatMessages({ messages, messageSize, models, renderMarkdown, renderExtras, durableCards, userLabel, agentLabel, loading, approval, onToolCallClick, toolRenderers, error, onRetry, renderEmpty, emptyState, header, resolveAttachmentUrl, workProductCards, }: ChatMessagesProps): react.JSX.Element;
2225
2213
 
2226
- export { type ActivityTone, type AgentActivityPage, AgentActivityPanel, type AgentActivityPanelProps, type AgentActivityRecord, AgentSessionControls, type AgentSessionControlsProps, type AttachmentFileResult, CatalogModel, ChatAttachmentInput, ChatAttachmentKind, ChatAttachmentPart, ChatComposer, type ChatComposerProps, type ChatEmptyDoor, ChatEmptyState, type ChatEmptyStateProps, ChatInteraction, ChatInteractionField, type ChatInteractionRestoreMode, ChatInteractionStatus, ChatMentionPart, type ChatMessageMetrics, type ChatMessageSegment, ChatMessages, type ChatMessagesProps, ChatSelectField, type ChatStreamCallbacks, type ChatStreamToolCall, type ChatStreamToolResult, type ChatToolCallInfo, type ChatUiMessage, type ComposerFile, type ComposerFilePart, type ComposerSendFailure, type ComposerSendHandler, type ComposerSendOutcome, type ComposerSendPartsHandler, type ComposerSendRejected, type ComposerSendResult, type ConsumeChatStreamResult, DEFAULT_EFFORT_LEVELS, DEFAULT_PROVENANCE_CONFIDENCE_POLICY, type DurableChatCard, DurableChatCards, type DurableChatCardsProps, type DurableInteractionAnswerSubmitterOptions, DurablePlanCard, type DurablePlanCardProps, DurablePlanClientError, type DurablePlanCurrentInput, type DurablePlanDecision, type DurablePlanDecisionClient, type DurablePlanDecisionClientOptions, type DurablePlanDecisionInput, type DurablePlanDecisionResult, type DurablePlanFollowUpReceipt, EMPTY_RECORD_GRID_OVERLAY, type EffortLevel, EffortPicker, type EffortPickerProps, EvidenceLineageTable, type EvidenceLineageTableProps, ExceptionList, type ExceptionListProps, type FetchSessionPage, type FieldValues, FlowWaterfall, type FlowWaterfallProps, INTERACTION_SUBMIT_TIMEOUT_MESSAGE, INTERACTION_SUBMIT_TIMEOUT_MS, InteractionActionButton, type InteractionAnswerSubmission, type InteractionAnswerSubmitterOptions, InteractionAnswers, type InteractionAttemptStore, InteractionBadge, type InteractionBadgeVariant, InteractionCancelData, InteractionPlanCard, type InteractionPlanCardProps, InteractionQuestionCard, type InteractionQuestionCardProps, InteractionRequestWire, type InteractionSubmitResult, type LinkLikeComponent, type LinkLikeProps, type MentionTextSegment, MessageAttachments, type MessageAttachmentsProps, MissionActivityLane, type MissionActivityLaneProps, ModelPicker, type ModelPickerProps, PROVENANCE_BASES, type ProposalApprovalHandlers, type ProvenanceBasis, type ProvenanceBasisMeta, type ProvenanceConfidencePolicy, type ProvenanceGap, type ProvenanceGapKind, ProvenanceLegend, type ProvenanceLegendProps, type ProvenanceRecord, type ProvenanceSource, type ProvenanceSourceStatus, ProvenanceStamp, type ProvenanceStampProps, type ProvenanceStanding, type ProvenanceStandingMeta, ProvenanceValue, type ProvenanceValueProps, ProviderLogo, type ProviderLogoProps, QualityCheckList, type QualityCheckListProps, QuestionOptionList, type QuestionOptionListProps, RecordGrid, type RecordGridBooleanColumn, type RecordGridCellChange, type RecordGridCellOutcome, type RecordGridCellSource, type RecordGridColumn, type RecordGridColumnBase, type RecordGridCreateOutcome, type RecordGridCurrencyColumn, type RecordGridDateColumn, type RecordGridDependency, type RecordGridEmptyState, type RecordGridNumberColumn, type RecordGridOverlay, type RecordGridProps, type RecordGridRow, type RecordGridRowOutcome, type RecordGridSelectColumn, type RecordGridSelectOption, type RecordGridSourceBasis, type RecordGridState, type RecordGridTextColumn, type RecordGridValue, type RecordGridWriteOutcome, type RestoreChatInteractionsOptions, ReviewQueueItem, type ReviewQueuePage, ReviewQueuePanel, type ReviewQueuePanelProps, ReviewQueueState, RunDrillIn, type RunDrillInProps, SeatPaywall, type SeatPaywallProps, type SessionActionLabels, type SessionActions, type SessionActionsOptions, type SessionBulkAction, SessionHistoryPanel, type SessionHistoryPanelProps, type SessionHistoryState, type SessionPageQuery, type SmoothRevealOptions, type StreamChatOptions, type SubmitInteractionAnswer, type ToolDetailRenderers, type ToolRunRecord, type ToolRunStep, type UseChatInteractionsOptions, type UseChatInteractionsResult, type UseComposerAttachmentsOptions, type UseComposerAttachmentsResult, type UseDurablePlanFlowOptions, type UseDurablePlanFlowResult, type UseInfiniteScrollOptions, type UseSessionHistoryOptions, type WaterfallRow, WorkProductCard, type WorkProductCardProps, __resetAttachmentFileCacheForTests, activityTone, buildAnswerData, cancelChatInteraction, consumeChatStream, createDurableInteractionAnswerSubmitter, createDurablePlanDecisionClient, createInteractionAnswerSubmitter, createMemoryInteractionAttemptStore, createSessionInteractionAttemptStore, describeProvenance, describeProvenanceSourceStatus, dispatchChatStreamLine, durableChatCardsFromParts, fieldAnswer, fieldValuesFromAnswers, formatActivityCost, formatActivityDuration, formatModelCost, formatRecordGridValue, formatSessionTimestamp, formatTokensPerSecond, hasSecretField, hydrateChatInteractions, interactionStatusLabels, interactionSubmissionSignature, interactionTerminalNotes, isLateAnswerableStatus, isRecordGridCellApplicable, lateAnswerMessage, loadAttachmentFile, loadingProvenanceSources, mergeActivityPages, mergeReviewQueuePages, nextRevealCount, parseRecordGridInput, pendingApprovalOf, projectRecordGridRows, provenanceBasisMeta, provenanceGaps, provenanceNextMove, provenanceStandingMeta, provenanceTriggerLabel, pruneRecordGridOverlay, readRecordGridCell, recordGridEditorText, recordGridFail, recordGridOk, recordGridRowLabel, resolveChatInteraction, resolveProvenanceStanding, responseErrorMessage, restoreChatInteractions, reviewQueueStateLabel, rollUpProvenanceStanding, sameRecordGridValue, segmentMentionContent, settleInteractionSubmit, standingFromConfidence, streamChatTurn, sumRecordGridColumn, terminalizePendingChatInteractions, triggerAttachmentDownload, upsertChatInteraction, useChatInteractions, useComposerAttachments, useDurablePlanFlow, useInfiniteScroll, usePending, usePopover, useSessionActions, useSessionHistory, useSmoothText, useThinkingSeconds, validateRecordGridCell, validateRecordGridRow, waterfallLayout, weakerProvenanceStanding, withRecordGridCreated, withRecordGridRemoved, withRecordGridServerRow, withRecordGridUpdate, withoutRecordGridCreated, withoutRecordGridRemoved, withoutRecordGridUpdate, workProductPartsFromMessageParts, workProductStatusLabel };
2214
+ export { type ActivityTone, type AgentActivityPage, AgentActivityPanel, type AgentActivityPanelProps, type AgentActivityRecord, AgentSessionControls, type AgentSessionControlsProps, type AttachmentFileResult, CatalogModel, ChatAttachmentInput, ChatAttachmentKind, ChatAttachmentPart, ChatComposer, type ChatComposerProps, type ChatEmptyDoor, ChatEmptyState, type ChatEmptyStateProps, ChatInteraction, ChatInteractionField, type ChatInteractionRestoreMode, ChatInteractionStatus, ChatMentionPart, type ChatMessageMetrics, type ChatMessageSegment, ChatMessages, type ChatMessagesProps, ChatSelectField, type ChatStreamCallbacks, type ChatStreamToolCall, type ChatStreamToolResult, type ChatToolCallInfo, type ChatUiMessage, type ComposerFile, type ComposerFilePart, type ComposerSendFailure, type ComposerSendHandler, type ComposerSendOutcome, type ComposerSendPartsHandler, type ComposerSendRejected, type ComposerSendResult, type ConsumeChatStreamResult, DEFAULT_EFFORT_LEVELS, DEFAULT_PROVENANCE_CONFIDENCE_POLICY, type DurableChatCard, DurableChatCards, type DurableChatCardsProps, type DurableInteractionAnswerSubmitterOptions, DurablePlanCard, type DurablePlanCardProps, DurablePlanClientError, type DurablePlanCurrentInput, type DurablePlanDecision, type DurablePlanDecisionClient, type DurablePlanDecisionClientOptions, type DurablePlanDecisionInput, type DurablePlanDecisionResult, type DurablePlanFollowUpReceipt, EMPTY_RECORD_GRID_OVERLAY, type EffortLevel, EffortPicker, type EffortPickerProps, EvidenceLineageTable, type EvidenceLineageTableProps, ExceptionList, type ExceptionListProps, type FetchSessionPage, type FieldValues, FlowWaterfall, type FlowWaterfallProps, INTERACTION_SUBMIT_TIMEOUT_MESSAGE, INTERACTION_SUBMIT_TIMEOUT_MS, InteractionActionButton, type InteractionAnswerSubmission, type InteractionAnswerSubmitterOptions, InteractionAnswers, type InteractionAttemptStore, InteractionBadge, type InteractionBadgeVariant, InteractionCancelData, InteractionPlanCard, type InteractionPlanCardProps, InteractionQuestionCard, type InteractionQuestionCardProps, InteractionRequestWire, type InteractionSubmitResult, type LinkLikeComponent, type LinkLikeProps, type MentionTextSegment, MessageAttachments, type MessageAttachmentsProps, MissionActivityLane, type MissionActivityLaneProps, ModelPicker, type ModelPickerProps, PROVENANCE_BASES, type ProposalApprovalHandlers, type ProvenanceBasis, type ProvenanceBasisMeta, type ProvenanceConfidencePolicy, type ProvenanceGap, type ProvenanceGapKind, ProvenanceLegend, type ProvenanceLegendProps, type ProvenanceRecord, type ProvenanceSource, type ProvenanceSourceStatus, ProvenanceStamp, type ProvenanceStampProps, type ProvenanceStanding, type ProvenanceStandingMeta, ProvenanceValue, type ProvenanceValueProps, ProviderLogo, type ProviderLogoProps, QualityCheckList, type QualityCheckListProps, QuestionOptionList, type QuestionOptionListProps, RecordGrid, type RecordGridBooleanColumn, type RecordGridCellChange, type RecordGridCellOutcome, type RecordGridCellSource, type RecordGridColumn, type RecordGridColumnBase, type RecordGridCreateOutcome, type RecordGridCurrencyColumn, type RecordGridDateColumn, type RecordGridDependency, type RecordGridNumberColumn, type RecordGridOverlay, type RecordGridProps, type RecordGridRow, type RecordGridRowOutcome, type RecordGridSelectColumn, type RecordGridSelectOption, type RecordGridSourceBasis, type RecordGridTextColumn, type RecordGridValue, type RecordGridWriteOutcome, type RestoreChatInteractionsOptions, ReviewQueueItem, type ReviewQueuePage, ReviewQueuePanel, type ReviewQueuePanelProps, ReviewQueueState, RunDrillIn, type RunDrillInProps, SeatPaywall, type SeatPaywallProps, type SessionActionLabels, type SessionActions, type SessionActionsOptions, type SessionBulkAction, SessionHistoryPanel, type SessionHistoryPanelProps, type SessionHistoryState, type SessionPageQuery, type SmoothRevealOptions, type StreamChatOptions, type SubmitInteractionAnswer, type ToolDetailRenderers, type ToolRunRecord, type ToolRunStep, type UseChatInteractionsOptions, type UseChatInteractionsResult, type UseComposerAttachmentsOptions, type UseComposerAttachmentsResult, type UseDurablePlanFlowOptions, type UseDurablePlanFlowResult, type UseInfiniteScrollOptions, type UseSessionHistoryOptions, type WaterfallRow, WorkProductCard, type WorkProductCardProps, __resetAttachmentFileCacheForTests, activityTone, buildAnswerData, cancelChatInteraction, consumeChatStream, createDurableInteractionAnswerSubmitter, createDurablePlanDecisionClient, createInteractionAnswerSubmitter, createMemoryInteractionAttemptStore, createSessionInteractionAttemptStore, describeProvenance, describeProvenanceSourceStatus, dispatchChatStreamLine, durableChatCardsFromParts, fieldAnswer, fieldValuesFromAnswers, formatActivityCost, formatActivityDuration, formatModelCost, formatRecordGridValue, formatSessionTimestamp, formatTokensPerSecond, hasSecretField, hydrateChatInteractions, interactionStatusLabels, interactionSubmissionSignature, interactionTerminalNotes, isLateAnswerableStatus, isRecordGridCellApplicable, lateAnswerMessage, loadAttachmentFile, loadingProvenanceSources, mergeActivityPages, mergeReviewQueuePages, nextRevealCount, parseRecordGridInput, pendingApprovalOf, projectRecordGridRows, provenanceBasisMeta, provenanceGaps, provenanceNextMove, provenanceStandingMeta, provenanceTriggerLabel, pruneRecordGridOverlay, readRecordGridCell, recordGridEditorText, recordGridFail, recordGridOk, recordGridRowLabel, resolveChatInteraction, resolveProvenanceStanding, responseErrorMessage, restoreChatInteractions, reviewQueueStateLabel, rollUpProvenanceStanding, sameRecordGridValue, segmentMentionContent, settleInteractionSubmit, standingFromConfidence, streamChatTurn, sumRecordGridColumn, terminalizePendingChatInteractions, triggerAttachmentDownload, upsertChatInteraction, useChatInteractions, useComposerAttachments, useDurablePlanFlow, useInfiniteScroll, usePending, usePopover, useSessionActions, useSessionHistory, useSmoothText, useThinkingSeconds, validateRecordGridCell, validateRecordGridRow, waterfallLayout, weakerProvenanceStanding, withRecordGridCreated, withRecordGridRemoved, withRecordGridServerRow, withRecordGridUpdate, withoutRecordGridCreated, withoutRecordGridRemoved, withoutRecordGridUpdate, workProductPartsFromMessageParts, workProductStatusLabel };
@@ -117,16 +117,8 @@ import {
117
117
  withoutRecordGridCreated,
118
118
  withoutRecordGridRemoved,
119
119
  withoutRecordGridUpdate
120
- } from "../chunk-KOMP6NDW.js";
120
+ } from "../chunk-WC43OQMR.js";
121
121
  import "../chunk-FBVLEGEG.js";
122
- import {
123
- useComposerAttachments
124
- } from "../chunk-E4DHYENH.js";
125
- import {
126
- tabTerminalConnectionId,
127
- useSandboxTerminalConnection
128
- } from "../chunk-BATKJP3P.js";
129
- import "../chunk-PC2WYTK7.js";
130
122
  import {
131
123
  EvidenceLineageTable,
132
124
  ExceptionList,
@@ -142,6 +134,14 @@ import {
142
134
  import {
143
135
  parseReviewQueueItem
144
136
  } from "../chunk-GEYACSFW.js";
137
+ import {
138
+ useComposerAttachments
139
+ } from "../chunk-E4DHYENH.js";
140
+ import {
141
+ tabTerminalConnectionId,
142
+ useSandboxTerminalConnection
143
+ } from "../chunk-BATKJP3P.js";
144
+ import "../chunk-PC2WYTK7.js";
145
145
  import "../chunk-QY4BRKRJ.js";
146
146
  import {
147
147
  ATTACHMENT_ACCEPT
@@ -153,7 +153,8 @@ import {
153
153
  isChatAttachmentPart,
154
154
  mentionInputToPart,
155
155
  mentionPartsFromMessageParts
156
- } from "../chunk-B2UEW62O.js";
156
+ } from "../chunk-5ZTFZBS6.js";
157
+ import "../chunk-ZVEEWGDK.js";
157
158
  import {
158
159
  DISPATCH_MAX_MEDIA_PARTS,
159
160
  DISPATCH_MAX_PARTS,
@@ -166,7 +167,6 @@ import {
166
167
  mediaTypeForMentionPath,
167
168
  mentionKindForPath
168
169
  } from "../chunk-KWXUBMXU.js";
169
- import "../chunk-ZVEEWGDK.js";
170
170
  import {
171
171
  attachmentPartKey
172
172
  } from "../chunk-XZ27ENOZ.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.45.26",
3
+ "version": "0.45.28",
4
4
  "packageManager": "pnpm@11.17.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [
@@ -36,6 +36,7 @@
36
36
  "agent-app-legibility-check": "./dist/legibility/cli.js",
37
37
  "agent-app-preflight": "./dist/preflight/cli.js",
38
38
  "agent-app-peer-check": "./dist/peer-floors/cli.js",
39
+ "agent-app-spend-check": "./dist/spend/cli.js",
39
40
  "agent-app-signoff": "./dist/signoff/cli.js",
40
41
  "agent-app-verify-proof": "./dist/signoff/proof-cli.js"
41
42
  },
@@ -482,6 +483,11 @@
482
483
  "types": "./dist/peer-floors/check.d.ts",
483
484
  "import": "./dist/peer-floors/check.js",
484
485
  "default": "./dist/peer-floors/check.js"
486
+ },
487
+ "./spend": {
488
+ "types": "./dist/spend/index.d.ts",
489
+ "import": "./dist/spend/index.js",
490
+ "default": "./dist/spend/index.js"
485
491
  }
486
492
  },
487
493
  "scripts": {