@tangle-network/agent-app 4.0.13 → 4.0.15

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 (32) hide show
  1. package/dist/billing/identity-bound.d.ts +14 -9
  2. package/dist/billing/index.js +1 -1
  3. package/dist/chat-routes/detached-turn.d.ts +1 -1
  4. package/dist/chat-routes/failure-wording.d.ts +3 -4
  5. package/dist/chat-routes/index.js +5 -5
  6. package/dist/chat-routes/index.js.map +1 -1
  7. package/dist/{chunk-XCUT2I52.js → chunk-5QQBQS7W.js} +8 -2
  8. package/dist/{chunk-XCUT2I52.js.map → chunk-5QQBQS7W.js.map} +1 -1
  9. package/dist/{chunk-GWATTXFR.js → chunk-FYF564KJ.js} +2 -2
  10. package/dist/{chunk-QPD42X6A.js → chunk-G4NHCLYA.js} +17 -9
  11. package/dist/chunk-G4NHCLYA.js.map +1 -0
  12. package/dist/{chunk-TMWUWKLU.js → chunk-GE242CLI.js} +2 -2
  13. package/dist/{chunk-RNDWCT4O.js → chunk-MZZMOGFN.js} +101 -89
  14. package/dist/{chunk-RNDWCT4O.js.map → chunk-MZZMOGFN.js.map} +1 -1
  15. package/dist/{chunk-CD4SJXYC.js → chunk-RFXROORA.js} +12 -12
  16. package/dist/chunk-RFXROORA.js.map +1 -0
  17. package/dist/platform/delegated-keys.d.ts +5 -1
  18. package/dist/platform/index.js +8 -2
  19. package/dist/platform/index.js.map +1 -1
  20. package/dist/preset-cloudflare/index.js +3 -3
  21. package/dist/public-consultation/index.js +3 -3
  22. package/dist/runtime/index.js +2 -2
  23. package/dist/runtime/router-turn.js +1 -1
  24. package/dist/spend/delegate-budget.d.ts +4 -0
  25. package/dist/spend/index.js.map +1 -1
  26. package/dist/turn-health/index.js +3 -1
  27. package/dist/turn-health/index.js.map +1 -1
  28. package/package.json +1 -1
  29. package/dist/chunk-CD4SJXYC.js.map +0 -1
  30. package/dist/chunk-QPD42X6A.js.map +0 -1
  31. /package/dist/{chunk-GWATTXFR.js.map → chunk-FYF564KJ.js.map} +0 -0
  32. /package/dist/{chunk-TMWUWKLU.js.map → chunk-GE242CLI.js.map} +0 -0
@@ -33,6 +33,7 @@ export interface DurableWorkspaceKeyRecord {
33
33
  idempotencyKey?: string | null;
34
34
  keyId: string;
35
35
  keyEncrypted: string;
36
+ /** A provisioning row keeps the requested budget. An active row: 0 for a confirmed spend-through child, which spends its source's cap. */
36
37
  budgetUsd: number;
37
38
  expiresAt: Date;
38
39
  status: WorkspaceKeyStatus;
@@ -45,9 +46,10 @@ export interface DurableWorkspaceKeyRecord {
45
46
  export interface DurableWorkspaceKeyProvisioningRecord extends DurableWorkspaceKeyRecord {
46
47
  status: 'provisioning';
47
48
  }
49
+ /** `spendThrough: true` confirms the child has no budget of its own; without it the child is sized at the requested budget. */
48
50
  type DurableWorkspaceKeyCreateResult = Awaited<ReturnType<KeyProvisioner['createKey']>> & {
49
51
  budgetUsd?: number | null;
50
- budgetRemaining?: number;
52
+ spendThrough?: true;
51
53
  expiresAt?: string | null;
52
54
  };
53
55
  /** The exact request identity that must be reused when recovering a create. */
@@ -55,6 +57,8 @@ export interface DurableWorkspaceKeyCreateInput {
55
57
  name: string;
56
58
  product: string;
57
59
  budgetUsd: number;
60
+ /** Mint a child that spends the source's cap and reserves nothing. A provisioner that ignores it mints `budgetUsd`. */
61
+ spendThrough?: true;
58
62
  expiresAt: string;
59
63
  /** Stable across process restarts for one persisted provisioning row. */
60
64
  idempotencyKey: string;
@@ -65,9 +69,11 @@ export interface DurableWorkspaceKeyProvisioner {
65
69
  supportsIdempotentCreate?: true;
66
70
  /** Create one child key. Non-idempotent providers recover through stable-name discovery only. */
67
71
  createKey(input: DurableWorkspaceKeyCreateInput): Promise<DurableWorkspaceKeyCreateResult>;
72
+ /** `budgetRemaining` is what the key can still spend; for a spend-through child, its source's remainder. */
68
73
  getKey(id: string): Promise<{
69
74
  budgetUsd?: number | null;
70
75
  budgetSpent?: number;
76
+ budgetRemaining?: number;
71
77
  expiresAt?: string | null;
72
78
  }>;
73
79
  /**
@@ -92,13 +98,7 @@ export interface DurableWorkspaceKeyConditionalWrites {
92
98
  keyId: string;
93
99
  }): Promise<boolean>;
94
100
  /** Return false when the row was no longer provisioning. */
95
- markActive(input: {
96
- id: string;
97
- keyId: string;
98
- keyEncrypted: string;
99
- expiresAt: Date;
100
- budgetUsd: number;
101
- }): Promise<boolean>;
101
+ markActive(input: Parameters<DurableWorkspaceKeyStore['markActive']>[0]): Promise<boolean>;
102
102
  }
103
103
  /** Persistence operations for identity-bound key lifecycle state. */
104
104
  export interface DurableWorkspaceKeyStore {
@@ -172,9 +172,14 @@ export interface WorkspaceRuntimeKey {
172
172
  }
173
173
  /** Identity-bound durable key manager API. */
174
174
  export interface DurableWorkspaceKeyManager {
175
- /** Reuse a matching active key or reconcile and mint one under a lease. */
175
+ /**
176
+ * Reuse a matching active key or reconcile and mint one under a lease. Pass `spendThrough` when Platform reports a
177
+ * budget on the source: the child then reserves nothing, so live children never hold the source's cap several times
178
+ * over, and Platform refuses each request once that cap is spent. `budgetUsd` is then the remainder reported at mint.
179
+ */
176
180
  ensureKey(identity: WorkspaceKeyIdentity, options?: {
177
181
  budgetUsd?: number;
182
+ spendThrough?: boolean;
178
183
  }): Promise<WorkspaceRuntimeKey>;
179
184
  /** Read usage without returning the child secret. */
180
185
  getUsage(identity: WorkspaceKeyIdentity): Promise<WorkspaceKeyUsage | null>;
@@ -5,7 +5,7 @@ import {
5
5
  createTcloudKeyProvisioner,
6
6
  createWorkspaceKeyManager,
7
7
  readSharedBillingState
8
- } from "../chunk-QPD42X6A.js";
8
+ } from "../chunk-G4NHCLYA.js";
9
9
  import "../chunk-VGS2NXLB.js";
10
10
  export {
11
11
  DEFAULT_MIN_REMAINING_KEY_LIFETIME_MS,
@@ -173,7 +173,7 @@ export interface DetachedTurnResult {
173
173
  /** True when the preferred model did not serve. Makes an autonomous
174
174
  * downgrade — which no human watched happen — attributable after the fact. */
175
175
  usedModelFallback?: boolean;
176
- /** Every model tried, in order, with the reason each was abandoned. */
176
+ /** Every model tried, in order. Each attempt's raw `reason` is server-only; never render or send it to a client. */
177
177
  modelAttempts?: ModelFailoverAttempt[];
178
178
  }
179
179
  /**
@@ -30,9 +30,10 @@ export interface FailureView {
30
30
  export declare function failureIds(source: unknown): Record<string, string>;
31
31
  /** The text a failure adds to the answer: its sentence, after a lead line for the classes that carry one. */
32
32
  export declare function failureText(view: FailureView, partialAnswer: string): string;
33
- /** The reason a failure carries, wherever its producer put it: in `data`, a nested error, a session error's
34
- * properties, the top level, or a raw harness event. Empty when there is none, so a failure always reads its class. */
33
+ /** The reason stays server-side; a closed protocol reason is a class, not prose. */
35
34
  export declare function failureReason(event: unknown): string;
35
+ /** One code extractor for the wire, raw harness events and the answer text. */
36
+ export declare function failureCode(event: unknown): string | undefined;
36
37
  /** One turn's person-facing filter. `view` classifies a failure reason; every reason is logged once, at warn (`log`,
37
38
  * else `console.warn`), with its class and ids, and the same reason reads the same wherever it appears. `warning`
38
39
  * gives an allowed warning's sentence. `event` is every event the producer yields as it may reach the client.
@@ -52,8 +53,6 @@ export declare function sandboxStreamFailureDiagnostic(error: unknown): {
52
53
  code: string;
53
54
  reason: string;
54
55
  };
55
- /** The typed reason a sandbox `error` event carries, or a generic stream-error code. */
56
- export declare function sandboxStreamErrorCode(data: unknown): string;
57
56
  /** A tool part as the person may read it, live and stored: a failed call's `error` and `output` lose the harness's list
58
57
  * of every tool, and the harness's `invalid` repair tool, which stands in for a call to a tool the model does not have,
59
58
  * reads one sentence. Inputs, metadata and a completed call's output (a document it read) stay whole. */
@@ -40,10 +40,10 @@ import {
40
40
  observeNativeCompletion,
41
41
  readCompletedSandboxTurn,
42
42
  recoverSandboxAssistantMessage
43
- } from "../chunk-TMWUWKLU.js";
43
+ } from "../chunk-GE242CLI.js";
44
44
  import {
45
45
  runProtectedRouterTurn
46
- } from "../chunk-GWATTXFR.js";
46
+ } from "../chunk-FYF564KJ.js";
47
47
  import {
48
48
  HYBRID_TURN_GUIDANCE,
49
49
  INTENT_LINE_HISTORY_MESSAGES,
@@ -74,7 +74,7 @@ import {
74
74
  turnPromptText,
75
75
  valueRedactor,
76
76
  withProducerStream
77
- } from "../chunk-CD4SJXYC.js";
77
+ } from "../chunk-RFXROORA.js";
78
78
  import "../chunk-SBHFMDR7.js";
79
79
  import "../chunk-H6BRJU5M.js";
80
80
  import "../chunk-4DBHC63F.js";
@@ -109,7 +109,7 @@ import {
109
109
  streamWithModelFailover,
110
110
  summarizeFailoverReason,
111
111
  transformVisibleTextParts
112
- } from "../chunk-RNDWCT4O.js";
112
+ } from "../chunk-MZZMOGFN.js";
113
113
  import "../chunk-QUV5M7SZ.js";
114
114
  import "../chunk-WGT32NQ4.js";
115
115
  import "../chunk-YG66IHDU.js";
@@ -185,7 +185,7 @@ import "../chunk-S5SRJJQG.js";
185
185
  import "../chunk-GD4ONMKJ.js";
186
186
  import "../chunk-UGWQLQDS.js";
187
187
  import "../chunk-R32MULDK.js";
188
- import "../chunk-XCUT2I52.js";
188
+ import "../chunk-5QQBQS7W.js";
189
189
  import "../chunk-D6UJEOZQ.js";
190
190
  import "../chunk-YYA2CVOY.js";
191
191
  import "../chunk-KSLTD4FI.js";