@tangle-network/sandbox 1.0.232 → 1.0.234

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 (80) hide show
  1. package/README.md +6 -4
  2. package/dist/agent/index.d.ts +4 -4
  3. package/dist/agent/index.js +5 -5
  4. package/dist/agent/preview.d.ts +1 -1
  5. package/dist/agent/preview.js +2 -2
  6. package/dist/agent-execution-preparation-BJChICex.js +18 -0
  7. package/dist/agent-execution-preparation-receipt-BIFxqyr5.js +250 -0
  8. package/dist/{agent-run-outcome-MsLkgPNu.d.ts → agent-run-outcome-CEf6hJYp.d.ts} +3 -2
  9. package/dist/{api-request-B0BPgzdp.js → api-request-DgN02xvN.js} +4 -4
  10. package/dist/auth/index.d.ts +2 -2
  11. package/dist/auth/index.js +2 -2
  12. package/dist/{browser-interactive-control-controller-Bf-DbRCA.js → browser-interactive-control-controller-Bcn-qNH2.js} +4 -250
  13. package/dist/{browser-interactive-control-controller-D17JJ8B0.d.ts → browser-interactive-control-controller-CcUjQEfa.d.ts} +1 -1
  14. package/dist/{chunked-upload-BGwaw5np.js → chunked-upload-BlvgxPWx.js} +3 -3
  15. package/dist/{chunked-upload-file-BnV8qgwV.js → chunked-upload-file-DOeLpMO0.js} +2 -2
  16. package/dist/{cli-auth-bundle-BE_EfLUx.d.ts → cli-auth-bundle-B91fSxkR.d.ts} +1 -1
  17. package/dist/cli-auth-bundle-BLAtE6Dc.js +2 -0
  18. package/dist/{client-CgZADtPk.js → client-4Myv37Rw.js} +14 -13
  19. package/dist/{client-BTpWpGs-.d.ts → client-OYkwBKG2.d.ts} +7 -7
  20. package/dist/collaboration/index.d.ts +1 -1
  21. package/dist/collaboration/index.js +1 -1
  22. package/dist/{collaboration-DneF_7bo.js → collaboration-1xRRxdcU.js} +2 -2
  23. package/dist/core-CUZyz-U8.js +161 -0
  24. package/dist/core.d.ts +6 -6
  25. package/dist/core.js +6 -5
  26. package/dist/{direct-http2-B5bdFrtg.js → direct-http2-Bgb2lHte.js} +1 -1
  27. package/dist/{errors-dK3-2RCh.js → errors-nXGKGVFe.js} +2 -2
  28. package/dist/{file-download-CUNdbymj.js → file-download-BjkrYzy_.js} +1 -1
  29. package/dist/{index-CHP8U613.d.ts → index-C8YpXh5N.d.ts} +6 -6
  30. package/dist/index.d.ts +11 -11
  31. package/dist/index.js +14 -13
  32. package/dist/intelligence/index.d.ts +41 -109
  33. package/dist/intelligence/index.js +60 -73
  34. package/dist/interactive-control.d.ts +1 -1
  35. package/dist/interactive-control.js +1 -1
  36. package/dist/{interactive-controller-DbNjY09X.d.ts → interactive-controller-CJ7BBRpv.d.ts} +3 -3
  37. package/dist/{interactive-controller-Bs7VQ04W.js → interactive-controller-Cr5s-xqq.js} +9 -6
  38. package/dist/lib/prepared-evidence.js +1 -1
  39. package/dist/lib/prepared-process.js +1 -1
  40. package/dist/{lines-n-mBURry.d.ts → lines-CCJZUrBP.d.ts} +1 -1
  41. package/dist/{lines-DtssoioA.js → lines-CSGBHEjR.js} +1 -1
  42. package/dist/lines.d.ts +1 -1
  43. package/dist/lines.js +1 -1
  44. package/dist/{local-cli-auth-8Ndf1jRw.js → local-cli-auth-CO0byocv.js} +1 -1
  45. package/dist/{mcp-local-tA5cB3zq.js → mcp-local-BC2LLdhQ.js} +4 -4
  46. package/dist/{prepared-evidence-DBE_xYjq.js → prepared-evidence-ibAysmX8.js} +2 -2
  47. package/dist/{prepared-process-B1kSkhn-.js → prepared-process-DQ_68Ofg.js} +2 -2
  48. package/dist/{preview-BHee3FzP.d.ts → preview-zpWYtsDJ.d.ts} +3 -3
  49. package/dist/{public-templates-ZrUJ507X.d.ts → public-templates-DCFFPDEB.d.ts} +2 -2
  50. package/dist/public-templates.d.ts +1 -1
  51. package/dist/public-templates.js +1 -1
  52. package/dist/{raw-evidence-archive-Cfy_3_3y.js → raw-evidence-archive-Cz4j8VMw.js} +2 -2
  53. package/dist/runtime.d.ts +5 -5
  54. package/dist/runtime.js +5 -5
  55. package/dist/{sandbox-DOvm9OvM.js → sandbox-EEF6M32H.js} +27 -38
  56. package/dist/{secp256k1-DZM5U2gv.js → secp256k1-ZiYFbGjz.js} +1 -1
  57. package/dist/{core-Cxww35JL.js → select-seat-B4Y-7vIq.js} +40 -171
  58. package/dist/select-seat-command.d.ts +9 -3
  59. package/dist/select-seat-command.js +69 -57
  60. package/dist/session-gateway/index.js +4 -4
  61. package/dist/tangle/index.d.ts +1 -1
  62. package/dist/tangle/index.js +1 -1
  63. package/dist/{tangle-DFmy_0hM.js → tangle-CVbbgu8Q.js} +5 -5
  64. package/dist/{types-CuMa305b.d.ts → types-B5GAxo6l.d.ts} +6 -2
  65. package/package.json +4 -4
  66. package/dist/cli-auth-bundle-DvmJ71bO.js +0 -2
  67. /package/dist/{abort-signal-C0_9B1Hm.js → abort-signal-CRxC2dlT.js} +0 -0
  68. /package/dist/{cli-auth-bundle-C6DtK7GX-Cjs6D-9c.js → cli-auth-bundle-C6DtK7GX-mBUPER0R.js} +0 -0
  69. /package/dist/{error-catalog-CGhVLVNq.js → error-catalog-CAbzw67O.js} +0 -0
  70. /package/dist/{file-transfer-CSL53pv9.js → file-transfer-DOSTbUSR.js} +0 -0
  71. /package/dist/{index-DsX2pOIn.d.ts → index-C-_HY5NY.d.ts} +0 -0
  72. /package/dist/{index-D0zHNMSe.d.ts → index-o31uwAkX.d.ts} +0 -0
  73. /package/dist/{keep-alive-fetch-C2DX2_rG.js → keep-alive-fetch-sGVP8skk.js} +0 -0
  74. /package/dist/{preview-operations-BBF0BNuZ.js → preview-operations-DWL78boI.js} +0 -0
  75. /package/dist/{retry-after-header-Bt-XvU-x.js → retry-after-header-BZbs5rig.js} +0 -0
  76. /package/dist/{retry-policy-CI5tyUGr.js → retry-policy-oW3_ljoc.js} +0 -0
  77. /package/dist/{sidecar-proxy-error-CeNM5eJj.js → sidecar-proxy-error-DTdbCbUM.js} +0 -0
  78. /package/dist/{sse-parser-CBQzZvkZ.js → sse-parser-BCG3iL9j.js} +0 -0
  79. /package/dist/{terminal-stream-types-NBdVKKFu.d.ts → terminal-stream-types-eE97lZ-5.d.ts} +0 -0
  80. /package/dist/{utils-DqiOGAK5.js → utils-BT2q9nkO.js} +0 -0
package/dist/index.js CHANGED
@@ -1,18 +1,19 @@
1
- import { A as requestedPublicProfileDigest, B as ALL_BACKEND_TYPES, F as createAgentRunOutcomeTracker, H as isolationPrincipalSchema, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, V as backendTypeSchema, W as parseBackendType, i as terminalUpgradeHeadersSupported, k as normalizeRuntimeBackendConfig, n as InteractiveSessionController, r as TerminalStream, t as BrowserInteractiveSessionController, z as TERMINAL_WS_ECHO_SUBPROTOCOL } from "./interactive-controller-Bs7VQ04W.js";
2
- import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, k as agentInteractiveSessionPromptRequestDigest, l as createInteractiveControlHolderId, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController, u as interactiveSessionIdentityDigest } from "./browser-interactive-control-controller-Bf-DbRCA.js";
1
+ import { A as requestedPublicProfileDigest, B as ALL_BACKEND_TYPES, F as createAgentRunOutcomeTracker, H as isolationPrincipalSchema, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, V as backendTypeSchema, W as parseBackendType, i as terminalUpgradeHeadersSupported, k as normalizeRuntimeBackendConfig, n as InteractiveSessionController, r as TerminalStream, t as BrowserInteractiveSessionController, z as TERMINAL_WS_ECHO_SUBPROTOCOL } from "./interactive-controller-Cr5s-xqq.js";
2
+ import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, k as agentInteractiveSessionPromptRequestDigest, l as createInteractiveControlHolderId, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController, u as interactiveSessionIdentityDigest } from "./browser-interactive-control-controller-Bcn-qNH2.js";
3
3
  import { i as SANDBOX_SIZE_PRESET_NAMES, r as agentProfileSchema, t as agentProfileConfidentialSchema } from "./profile-schema-C1KpT-wS.js";
4
- import { A as ProfileUnsupportedError, C as SandboxOperationFailedError, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, M as isMaterializerHarness, N as materializeProfile, S as SandboxOperation, T as splitInlineProfileFileMounts, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, f as InteractiveSessionHandle, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, j as enforceWorkspacePlanSupport, k as HARNESS_LAUNCH_MATERIALIZE_OPTIONS, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as exportTraceBundle, p as InteractiveTerminalFrameLog, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as collectAgentResponseText, w as materializeProfileFileMounts, x as ManagedProcessClient, y as getSandboxEventText } from "./sandbox-DOvm9OvM.js";
5
- import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, T as StreamInterruptedError, _ as NotFoundError, b as QuotaError, c as BranchFanoutExceedsHostError, d as EdgeNotReadyError, f as EgressProxyRecoveryError, g as NetworkError, h as KeyBudgetExhaustedError, l as CapabilityError, m as GpuProviderNotConfiguredError, p as FileWriteConflictError, r as parseErrorResponse, s as AuthError, t as TerminalStreamError, u as CompliancePlacementError, v as PartialFailureError, w as StateError, x as ResumeEnvRequiredError, y as ProfileFileMountPathError } from "./errors-dK3-2RCh.js";
6
- import { _ as createBatchResultAccumulator, a as InstancesClient, c as runtimeWorkspaceCwdSchema, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, g as IntelligenceClient, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, n as RunsClient, o as SandboxFleetClient, p as isBackendRegistryInteractionKind, r as HostedInstance, s as SandboxFleet, t as Sandbox, u as backendRegistryEntrySchema, v as validateBatchRunRequest } from "./client-CgZADtPk.js";
7
- import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-B0BPgzdp.js";
8
- import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-DneF_7bo.js";
9
- import "./file-transfer-CSL53pv9.js";
10
- import { t as parseSSEStream } from "./sse-parser-CBQzZvkZ.js";
11
- import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-DtssoioA.js";
12
- import { t as downloadFile } from "./file-download-CUNdbymj.js";
4
+ import { A as ProfileUnsupportedError, C as SandboxOperationFailedError, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, M as isMaterializerHarness, N as materializeProfile, S as SandboxOperation, T as splitInlineProfileFileMounts, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, f as InteractiveSessionHandle, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, j as enforceWorkspacePlanSupport, k as HARNESS_LAUNCH_MATERIALIZE_OPTIONS, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as exportTraceBundle, p as InteractiveTerminalFrameLog, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as collectAgentResponseText, w as materializeProfileFileMounts, x as ManagedProcessClient, y as getSandboxEventText } from "./sandbox-EEF6M32H.js";
5
+ import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, T as StreamInterruptedError, _ as NotFoundError, b as QuotaError, c as BranchFanoutExceedsHostError, d as EdgeNotReadyError, f as EgressProxyRecoveryError, g as NetworkError, h as KeyBudgetExhaustedError, l as CapabilityError, m as GpuProviderNotConfiguredError, p as FileWriteConflictError, r as parseErrorResponse, s as AuthError, t as TerminalStreamError, u as CompliancePlacementError, v as PartialFailureError, w as StateError, x as ResumeEnvRequiredError, y as ProfileFileMountPathError } from "./errors-nXGKGVFe.js";
6
+ import { _ as createBatchResultAccumulator, a as InstancesClient, c as runtimeWorkspaceCwdSchema, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, g as IntelligenceClient, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, n as RunsClient, o as SandboxFleetClient, p as isBackendRegistryInteractionKind, r as HostedInstance, s as SandboxFleet, t as Sandbox, u as backendRegistryEntrySchema, v as validateBatchRunRequest } from "./client-4Myv37Rw.js";
7
+ import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-DgN02xvN.js";
8
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-1xRRxdcU.js";
9
+ import "./file-transfer-DOSTbUSR.js";
10
+ import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
11
+ import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-CSGBHEjR.js";
12
+ import { t as downloadFile } from "./file-download-BjkrYzy_.js";
13
13
  import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
14
- import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-Cxww35JL.js";
15
- import { s as BlueprintSandboxClient } from "./tangle-DFmy_0hM.js";
14
+ import { a as parseLineApplicationResult, i as parseLineApplicationRequest, n as LINE_APPLICATION_REPLY_MAX_CHARS, o as sandboxFailureKind, r as LINE_APPLICATION_REQUEST_MAX_BYTES, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-CUZyz-U8.js";
15
+ import { a as gatewaySeatTransport, i as createSelectSeat, r as SeatSelectionError } from "./select-seat-B4Y-7vIq.js";
16
+ import { s as BlueprintSandboxClient } from "./tangle-CVbbgu8Q.js";
16
17
  import { z } from "zod";
17
18
  //#region ../../../packages/runtime-contracts/dist/model-key-proxy.js
18
19
  const MANAGED_MODEL_KEY_SENTINEL = "proxy-managed-per-request";
@@ -1,69 +1,23 @@
1
1
  //#region src/intelligence/index.d.ts
2
- /**
3
- * `@tangle-network/sandbox/intelligence` — browser-safe typed client for the
4
- * hosted trace-read surface on Tangle Intelligence
5
- * (`https://intelligence.tangle.tools`, default port 3030).
6
- *
7
- * This is a SEPARATE host from the Sandbox API. The SDK's `IntelligenceClient`
8
- * (exposed as `client.intelligence`) routes intelligence-*report* calls through
9
- * `Sandbox.fetch` against the **sandbox** `baseUrl` — that is the
10
- * sandbox-api intelligence-report surface, a different service. The trace-read
11
- * routes (`/v1/traces`, `/v1/runs*`, `/v1/sessions*`) live on intelligence-api
12
- * and are tenant-scoped by the customer key, so this client does NOT reuse
13
- * `Sandbox.fetch`; it carries its own intelligence-host base URL.
14
- *
15
- * Auth is the customer key (`sk-tan-*`) sent as `Authorization: Bearer ...`;
16
- * the platform resolves it to the caller's tenant and filters `tenant_id`
17
- * first and unconditionally on every route, so a cross-tenant id returns an
18
- * empty result or 404, never the row.
19
- *
20
- * Nothing here uses a Node API — `globalThis.fetch` only — so it runs in the
21
- * browser, Cloudflare Workers, Deno, and Node 20+ unchanged. The base URL must
22
- * be supplied by the caller (e.g. from `TANGLE_INTELLIGENCE_BASE_URL`) or it
23
- * falls back to the production host.
24
- *
25
- * @example
26
- * ```typescript
27
- * import { createIntelligenceClient } from "@tangle-network/sandbox/intelligence";
28
- *
29
- * const intel = createIntelligenceClient({
30
- * apiKey: process.env.TANGLE_API_KEY!,
31
- * baseUrl: process.env.TANGLE_INTELLIGENCE_BASE_URL,
32
- * });
33
- *
34
- * const { items } = await intel.listTraces({ status: "ERROR", limit: 20 });
35
- * for await (const span of intel.iterateTraceSpans(items[0].traceId)) {
36
- * console.log(span.name, span.durationMs);
37
- * }
38
- * ```
39
- *
40
- * @packageDocumentation
41
- */
42
- /**
43
- * Production intelligence-api host. Mirrors the api-side
44
- * `DEFAULT_INTELLIGENCE_BASE_URL` so the SDK default and the server default
45
- * never drift.
2
+ /** Browser-safe tenant trace and run-session reads from Tangle Intelligence.
3
+ * Its base URL is independent of the Sandbox API. Customer keys scope reads;
4
+ * trusted backend session reads require serviceToken plus an explicit tenantId.
46
5
  */
47
6
  declare const DEFAULT_INTELLIGENCE_BASE_URL = "https://intelligence.tangle.tools";
48
7
  interface IntelligenceClientConfig {
49
8
  /** Tangle customer API key (`sk-tan-*`). Sent as `Authorization: Bearer ...`. */
50
- apiKey: string;
51
- /**
52
- * Intelligence-api base URL. Defaults to {@link DEFAULT_INTELLIGENCE_BASE_URL}.
53
- * Pass `TANGLE_INTELLIGENCE_BASE_URL` here to point at a non-prod host; do NOT
54
- * pass the sandbox `baseUrl` — these routes live on a different service.
55
- */
9
+ apiKey?: string;
10
+ /** Trusted backend session reads; exclusive with apiKey and requires tenantId. */
11
+ serviceToken?: string;
12
+ tenantId?: string;
13
+ /** Intelligence origin, independent of the Sandbox API. */
56
14
  baseUrl?: string;
57
15
  /** Per-request timeout; defaults to the shared SDK transport deadline. */
58
16
  timeoutMs?: number;
59
17
  /** Cancels requests and response consumption with the caller's reason. */
60
18
  signal?: AbortSignal;
61
19
  }
62
- /**
63
- * A bigint nanosecond timestamp rendered as a decimal string — JSON cannot
64
- * carry a bigint, so the wire format is the same OTLP-JSON decimal-string
65
- * convention the service accepts on ingest.
66
- */
20
+ /** Decimal OTLP-JSON nanoseconds. */
67
21
  type NanoString = string;
68
22
  /** Trace status filter: `ERROR` = the trace has ≥1 error span; `OK` = none. */
69
23
  type TraceStatus = "ERROR" | "OK";
@@ -86,16 +40,12 @@ interface TraceSummary {
86
40
  model: string | null;
87
41
  runId: string | null;
88
42
  }
89
- /** A page of trace summaries plus the keyset cursor for the next page. */
90
43
  interface TraceSummaryList {
91
44
  items: TraceSummary[];
92
45
  /** Opaque cursor for the next page; `null` at the end of the stream. */
93
46
  nextCursor: string | null;
94
47
  }
95
- /**
96
- * One trace-span row on the wire — every stored column passed through, the two
97
- * bigint nano columns rendered as decimal strings. Already redacted at ingest.
98
- */
48
+ /** Stored span, redacted at ingest; nanoseconds are decimal strings. */
99
49
  interface SerializedSpan {
100
50
  /** Span PK, `<traceId>:<spanId>`. */
101
51
  id: string;
@@ -141,11 +91,7 @@ interface RunSpanWindow {
141
91
  truncated: boolean;
142
92
  total: number;
143
93
  }
144
- /**
145
- * An eval-run row. Numeric metrics are numeric columns rendered as strings.
146
- * `additionalProperties` on the wire — the row carries more columns than the
147
- * documented core, so the type is open.
148
- */
94
+ /** Open eval-run row; numeric metrics are decimal strings. */
149
95
  interface IntelligenceRun {
150
96
  id: string;
151
97
  tenantId: string;
@@ -165,7 +111,6 @@ interface RunList {
165
111
  limit: number;
166
112
  nextCursor: string | null;
167
113
  }
168
- /** One row of the tenant-wide session explorer (`GET /v1/sessions`). */
169
114
  interface SessionSummary {
170
115
  sessionId: string;
171
116
  traceCount: number;
@@ -177,7 +122,6 @@ interface SessionSummary {
177
122
  errorCount: number;
178
123
  userId: string | null;
179
124
  }
180
- /** A page of session summaries plus the keyset cursor for the next page. */
181
125
  interface SessionSummaryList {
182
126
  items: SessionSummary[];
183
127
  nextCursor: string | null;
@@ -185,9 +129,18 @@ interface SessionSummaryList {
185
129
  /**
186
130
  * One agent session file the platform captured from a cloud sandbox of a run
187
131
  * (`GET /v1/run-sessions/{runId}`). Files outlive the sandbox; the stored
188
- * bytes are redacted, and `sourceSha256` names the bytes as captured.
132
+ * bytes preserve their captured source; historical redaction stays recorded.
189
133
  */
190
134
  interface RunSessionFile {
135
+ /** Authoritative native-copy identity; absent on historical/untyped files. */
136
+ executionId?: string;
137
+ attempt?: number;
138
+ storePath?: string;
139
+ sourceSessionId?: string;
140
+ /** Harness-native identity, distinct from the source sidecar session. */
141
+ nativeSessionId?: string;
142
+ /** Complete settled native copy, independent of sandbox seal completeness. */
143
+ final?: boolean;
191
144
  runId: string;
192
145
  sandboxId: string;
193
146
  /** The sidecar session the file was captured from. */
@@ -237,14 +190,22 @@ interface RunSessionList {
237
190
  /** Pass as `cursor` for the next page; null on the last page. */
238
191
  nextCursor: string | null;
239
192
  }
240
- /** Query params for {@link IntelligenceTraceClient.listRunSessionFiles}. */
241
193
  interface ListRunSessionFilesParams {
242
194
  /** Files per page, clamped server-side to `[1, 5000]` (default 1000). */
243
195
  limit?: number;
244
196
  /** Opaque cursor from the prior page's `nextCursor`. */
245
197
  cursor?: string;
198
+ sandboxId?: string;
199
+ executionId?: string;
200
+ }
201
+ interface WaitForRunSessionFilesParams {
202
+ sandboxId?: string;
203
+ executionId?: string;
204
+ /** Wait for this sandbox's complete seal instead of its first final native file. */
205
+ requireCompleteSeal?: boolean;
206
+ timeoutMs?: number;
207
+ signal?: AbortSignal;
246
208
  }
247
- /** Query params for {@link IntelligenceTraceClient.listTraces}. */
248
209
  interface ListTracesParams {
249
210
  /** Page size, clamped server-side to `[1, 200]` (default 50). */
250
211
  limit?: number;
@@ -263,14 +224,12 @@ interface ListTracesParams {
263
224
  /** Opaque cursor from the prior response's `nextCursor`. */
264
225
  cursor?: string;
265
226
  }
266
- /** Query params for {@link IntelligenceTraceClient.getTraceSpans}. */
267
227
  interface GetTraceSpansParams {
268
228
  /** Page size, clamped server-side to `INTELLIGENCE_TRACE_SPAN_LIMIT`. */
269
229
  limit?: number;
270
230
  /** Opaque cursor over `(start_unix_nano, span id)` from the prior page. */
271
231
  cursor?: string;
272
232
  }
273
- /** Query params for {@link IntelligenceTraceClient.listRuns}. */
274
233
  interface ListRunsParams {
275
234
  limit?: number;
276
235
  status?: "started" | "baseline-complete" | "generation-complete" | "gate-decided" | "finished" | "errored";
@@ -283,7 +242,6 @@ interface ListRunsParams {
283
242
  label?: string;
284
243
  cursor?: string;
285
244
  }
286
- /** Query params for {@link IntelligenceTraceClient.listSessions}. */
287
245
  interface ListSessionsParams {
288
246
  limit?: number;
289
247
  from?: string;
@@ -294,30 +252,20 @@ interface ListSessionsParams {
294
252
  userId?: string;
295
253
  cursor?: string;
296
254
  }
297
- /** Query params for {@link IntelligenceTraceClient.getSessionTraces}. */
298
255
  interface GetSessionTracesParams {
299
256
  limit?: number;
300
257
  cursor?: string;
301
258
  }
302
- /**
303
- * Browser-safe typed client for the Tangle Intelligence trace-read surface.
304
- * Construct via {@link createIntelligenceClient}.
305
- */
259
+ /** Browser-safe trace and capture reads. */
306
260
  interface IntelligenceTraceClient {
307
261
  /** List tenant-wide trace summaries (one row per trace), newest first. */
308
262
  listTraces(params?: ListTracesParams): Promise<TraceSummaryList>;
309
263
  /** List one trace's spans, keyset-paginated. */
310
264
  getTraceSpans(traceId: string, params?: GetTraceSpansParams): Promise<SpanPage>;
311
- /**
312
- * Stream the FULL span set of one trace as NDJSON. The returned
313
- * `ReadableStream` yields the raw bytes (one JSON span per line); decode it
314
- * yourself, or use {@link iterateTraceSpans} to walk parsed spans page by
315
- * page without the bulk endpoint.
316
- */
265
+ /** Raw NDJSON spans; iterateTraceSpans provides parsed pagination. */
317
266
  exportTraceSpansNdjson(traceId: string): Promise<ReadableStream<Uint8Array>>;
318
267
  /** List the tenant's eval-runs, newest first. */
319
268
  listRuns(params?: ListRunsParams): Promise<RunList>;
320
- /** Fetch a single eval-run. */
321
269
  getRun(runId: string): Promise<IntelligenceRun>;
322
270
  /** List the spans pivoted to this run (by `run_id`), bounded window. */
323
271
  getRunTraces(runId: string): Promise<RunSpanWindow>;
@@ -328,10 +276,9 @@ interface IntelligenceTraceClient {
328
276
  * the sandbox named no run.
329
277
  */
330
278
  listRunSessionFiles(runId: string, params?: ListRunSessionFilesParams): Promise<RunSessionList>;
331
- /**
332
- * Async iterator over every captured file of a run, following `nextCursor`
333
- * page by page. Seals are on the first page of {@link listRunSessionFiles}.
334
- */
279
+ /** Wait on platform capture notifications, with a caller-bounded deadline. */
280
+ waitForRunSessionFiles(runId: string, params?: WaitForRunSessionFilesParams): Promise<RunSessionList>;
281
+ /** Iterate all captured files; listRunSessionFiles carries seals on its first page. */
335
282
  iterateRunSessionFiles(runId: string, params?: ListRunSessionFilesParams): AsyncGenerator<RunSessionFile, void, unknown>;
336
283
  /** Download stored bytes, or return their stream for bounded consumers. */
337
284
  downloadRunSessionFile<Stream extends boolean = false>(runId: string, file: Pick<RunSessionFile, "sandboxId" | "sessionId" | "path"> & Partial<RunSessionFile>, options?: {
@@ -341,29 +288,14 @@ interface IntelligenceTraceClient {
341
288
  listSessions(params?: ListSessionsParams): Promise<SessionSummaryList>;
342
289
  /** List one session's traces as the trace-summary shape, keyset-paginated. */
343
290
  getSessionTraces(sessionId: string, params?: GetSessionTracesParams): Promise<TraceSummaryList>;
344
- /**
345
- * Async iterator over the spans of one trace, following the keyset cursor
346
- * page by page so a trace larger than one page is walkable end-to-end
347
- * without the NDJSON bulk endpoint.
348
- */
291
+ /** Iterate all spans through keyset pagination. */
349
292
  iterateTraceSpans(traceId: string, params?: GetTraceSpansParams): AsyncGenerator<SerializedSpan, void, unknown>;
350
- /**
351
- * Async iterator over every trace summary, following `nextCursor` page by
352
- * page until the stream ends.
353
- */
293
+ /** Iterate all trace summaries. */
354
294
  iterateTraces(params?: ListTracesParams): AsyncGenerator<TraceSummary, void, unknown>;
355
- /**
356
- * Async iterator over every session summary, following `nextCursor` page by
357
- * page until the stream ends.
358
- */
295
+ /** Iterate all sessions. */
359
296
  iterateSessions(params?: ListSessionsParams): AsyncGenerator<SessionSummary, void, unknown>;
360
297
  }
361
- /**
362
- * Create a browser-safe client for the Tangle Intelligence trace-read surface.
363
- *
364
- * @param config.apiKey Customer key (`sk-tan-*`) — Bearer auth, resolved to a tenant.
365
- * @param config.baseUrl Intelligence-api host; defaults to {@link DEFAULT_INTELLIGENCE_BASE_URL}.
366
- */
298
+ /** Create tenant-scoped trace and capture reads. */
367
299
  declare function createIntelligenceClient(config: IntelligenceClientConfig): IntelligenceTraceClient;
368
300
  //#endregion
369
- export { DEFAULT_INTELLIGENCE_BASE_URL, GetSessionTracesParams, GetTraceSpansParams, type IntelligenceTraceClient as IntelligenceClient, IntelligenceTraceClient, IntelligenceClientConfig, IntelligenceRun, type IntelligenceRun as Run, ListRunSessionFilesParams, ListRunsParams, ListSessionsParams, ListTracesParams, NanoString, RunList, RunSessionFile, RunSessionList, RunSessionSeal, RunSpanWindow, SerializedSpan, SessionSummary, SessionSummaryList, SpanPage, TraceStatus, TraceSummary, TraceSummaryList, createIntelligenceClient };
301
+ export { DEFAULT_INTELLIGENCE_BASE_URL, GetSessionTracesParams, GetTraceSpansParams, type IntelligenceTraceClient as IntelligenceClient, IntelligenceTraceClient, IntelligenceClientConfig, IntelligenceRun, type IntelligenceRun as Run, ListRunSessionFilesParams, ListRunsParams, ListSessionsParams, ListTracesParams, NanoString, RunList, RunSessionFile, RunSessionList, RunSessionSeal, RunSpanWindow, SerializedSpan, SessionSummary, SessionSummaryList, SpanPage, TraceStatus, TraceSummary, TraceSummaryList, WaitForRunSessionFilesParams, createIntelligenceClient };
@@ -1,106 +1,90 @@
1
- import { E as TimeoutError, g as NetworkError, r as parseErrorResponse } from "../errors-dK3-2RCh.js";
2
- import { i as fetchSandboxApi } from "../api-request-B0BPgzdp.js";
3
- import { n as verifyDownload } from "../file-download-CUNdbymj.js";
1
+ import { E as TimeoutError, g as NetworkError, l as CapabilityError, r as parseErrorResponse } from "../errors-nXGKGVFe.js";
2
+ import { i as fetchSandboxApi } from "../api-request-DgN02xvN.js";
3
+ import { n as verifyDownload } from "../file-download-BjkrYzy_.js";
4
4
  //#region src/intelligence/index.ts
5
- /**
6
- * `@tangle-network/sandbox/intelligence` — browser-safe typed client for the
7
- * hosted trace-read surface on Tangle Intelligence
8
- * (`https://intelligence.tangle.tools`, default port 3030).
9
- *
10
- * This is a SEPARATE host from the Sandbox API. The SDK's `IntelligenceClient`
11
- * (exposed as `client.intelligence`) routes intelligence-*report* calls through
12
- * `Sandbox.fetch` against the **sandbox** `baseUrl` — that is the
13
- * sandbox-api intelligence-report surface, a different service. The trace-read
14
- * routes (`/v1/traces`, `/v1/runs*`, `/v1/sessions*`) live on intelligence-api
15
- * and are tenant-scoped by the customer key, so this client does NOT reuse
16
- * `Sandbox.fetch`; it carries its own intelligence-host base URL.
17
- *
18
- * Auth is the customer key (`sk-tan-*`) sent as `Authorization: Bearer ...`;
19
- * the platform resolves it to the caller's tenant and filters `tenant_id`
20
- * first and unconditionally on every route, so a cross-tenant id returns an
21
- * empty result or 404, never the row.
22
- *
23
- * Nothing here uses a Node API — `globalThis.fetch` only — so it runs in the
24
- * browser, Cloudflare Workers, Deno, and Node 20+ unchanged. The base URL must
25
- * be supplied by the caller (e.g. from `TANGLE_INTELLIGENCE_BASE_URL`) or it
26
- * falls back to the production host.
27
- *
28
- * @example
29
- * ```typescript
30
- * import { createIntelligenceClient } from "@tangle-network/sandbox/intelligence";
31
- *
32
- * const intel = createIntelligenceClient({
33
- * apiKey: process.env.TANGLE_API_KEY!,
34
- * baseUrl: process.env.TANGLE_INTELLIGENCE_BASE_URL,
35
- * });
36
- *
37
- * const { items } = await intel.listTraces({ status: "ERROR", limit: 20 });
38
- * for await (const span of intel.iterateTraceSpans(items[0].traceId)) {
39
- * console.log(span.name, span.durationMs);
40
- * }
41
- * ```
42
- *
43
- * @packageDocumentation
44
- */
45
- /**
46
- * Production intelligence-api host. Mirrors the api-side
47
- * `DEFAULT_INTELLIGENCE_BASE_URL` so the SDK default and the server default
48
- * never drift.
5
+ /** Browser-safe tenant trace and run-session reads from Tangle Intelligence.
6
+ * Its base URL is independent of the Sandbox API. Customer keys scope reads;
7
+ * trusted backend session reads require serviceToken plus an explicit tenantId.
49
8
  */
50
9
  const DEFAULT_INTELLIGENCE_BASE_URL = "https://intelligence.tangle.tools";
51
10
  function appendParam(search, key, value) {
52
11
  if (value === void 0) return;
53
12
  search.set(key, String(value));
54
13
  }
55
- /**
56
- * Create a browser-safe client for the Tangle Intelligence trace-read surface.
57
- *
58
- * @param config.apiKey Customer key (`sk-tan-*`) — Bearer auth, resolved to a tenant.
59
- * @param config.baseUrl Intelligence-api host; defaults to {@link DEFAULT_INTELLIGENCE_BASE_URL}.
60
- */
61
- function createIntelligenceClient(config) {
62
- if (!config.apiKey) throw new Error("createIntelligenceClient: apiKey is required");
14
+ function createIntelligenceRequest(config) {
63
15
  const transport = {
64
- apiKey: config.apiKey,
16
+ apiKey: config.apiKey ?? "",
65
17
  baseUrl: config.baseUrl ?? "https://intelligence.tangle.tools",
66
18
  timeoutMs: config.timeoutMs,
67
19
  signal: config.signal
68
20
  };
69
- /**
70
- * Uses the Sandbox transport with this Intelligence host's base URL,
71
- * Bearer key, body deadline and typed timeout/network errors.
72
- *
73
- * The timeout covers `read` as well, so a server that sends its headers
74
- * and then stalls the body still times out. A caller that hands the body
75
- * stream on (the NDJSON export) returns the response from `read` and owns
76
- * the stream's pace from there.
77
- */
78
- async function request(path, read) {
21
+ /** The transport deadline covers read(); returned streams transfer pacing to the caller. */
22
+ return async function request(path, read, signal) {
23
+ let endpoint = path;
24
+ if (config.serviceToken && !path.startsWith("/v1/run-sessions/")) throw new Error("Trusted service auth is limited to run-session reads");
25
+ if (config.serviceToken) {
26
+ const url = new URL(path.replace("/v1/run-sessions/", "/v1/insights/internal/run-sessions/"), transport.baseUrl);
27
+ url.searchParams.set("tenantId", config.tenantId);
28
+ endpoint = `${url.pathname}${url.search}`;
29
+ }
79
30
  return fetchSandboxApi({
80
31
  ...transport,
81
32
  timeoutError: (ms) => new TimeoutError(`Request timed out after ${ms}ms`, {
82
33
  timeoutMs: ms,
83
- endpoint: path
34
+ endpoint
84
35
  }),
85
36
  networkError: (err) => new NetworkError(`Failed to connect to Intelligence API: ${err instanceof Error ? err.message : String(err)}`, {
86
37
  cause: err instanceof Error ? err : void 0,
87
- endpoint: path,
38
+ endpoint,
88
39
  origin: "sandbox-api"
89
40
  })
90
- }, path, { headers: { Accept: "application/json" } }, { read: async (response) => {
41
+ }, endpoint, {
42
+ headers: {
43
+ Accept: "application/json",
44
+ ...config.serviceToken ? { "X-Service-Token": config.serviceToken } : {}
45
+ },
46
+ ...config.serviceToken ? { redirect: "error" } : {},
47
+ ...signal ? { signal } : {}
48
+ }, { read: async (response) => {
91
49
  if (!response.ok) throw parseErrorResponse(response.status, await response.text(), {
92
50
  method: "GET",
93
- path
51
+ path: endpoint
94
52
  }, response.headers);
95
53
  return read(response);
96
54
  } });
55
+ };
56
+ }
57
+ async function waitForRunSessionFiles(request, config, runId, params = {}) {
58
+ if (params.requireCompleteSeal && !params.sandboxId) throw new Error("A complete-seal wait requires sandboxId");
59
+ const timeoutMs = params.timeoutMs ?? 12e4;
60
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) throw new Error("Invalid run-session wait timeout");
61
+ const deadline = Date.now() + timeoutMs;
62
+ const signal = AbortSignal.any([AbortSignal.timeout(timeoutMs), ...[config.signal, params.signal].filter((s) => s !== void 0)]);
63
+ for (;;) {
64
+ signal.throwIfAborted();
65
+ if (Date.now() >= deadline) throw new TimeoutError("Run-session files did not arrive before the deadline", { timeoutMs });
66
+ const search = new URLSearchParams({ waitMs: String(Math.min(25e3, Math.max(1, Math.floor((config.timeoutMs ?? 3e4) * .8)), deadline - Date.now())) });
67
+ appendParam(search, "sandboxId", params.sandboxId);
68
+ appendParam(search, "executionId", params.executionId);
69
+ if (params.requireCompleteSeal) search.set("completeSeal", "true");
70
+ const page = await request(`/v1/run-sessions/${encodeURIComponent(runId)}?${search}`, async (response) => {
71
+ if (response.headers.get("X-Run-Session-Wait") !== "1") throw new CapabilityError("Intelligence does not support capture notification waits");
72
+ return await response.json();
73
+ }, signal);
74
+ if (params.requireCompleteSeal ? page.seals.some((seal) => seal.sandboxId === params.sandboxId && seal.complete) : page.files.some((file) => file.final === true && file.state === "stored")) return page;
75
+ if (Date.now() >= deadline) throw new TimeoutError("Run-session files did not arrive before the deadline", { timeoutMs });
97
76
  }
77
+ }
78
+ /** Create tenant-scoped trace and capture reads. */
79
+ function createIntelligenceClient(config) {
80
+ if (Boolean(config.apiKey) === Boolean(config.serviceToken) || config.serviceToken && !config.tenantId) throw new Error("createIntelligenceClient requires either apiKey or serviceToken with tenantId");
81
+ const request = createIntelligenceRequest(config);
98
82
  /** GET a JSON route, raising the SDK's typed error on a non-2xx response. */
99
- function getJson(path) {
83
+ function getJson(path, signal) {
100
84
  return request(path, async (response) => {
101
85
  const text = await response.text();
102
86
  return JSON.parse(text);
103
- });
87
+ }, signal);
104
88
  }
105
89
  async function listTraces(params = {}) {
106
90
  const search = new URLSearchParams();
@@ -152,6 +136,8 @@ function createIntelligenceClient(config) {
152
136
  const search = new URLSearchParams();
153
137
  appendParam(search, "limit", params.limit);
154
138
  appendParam(search, "cursor", params.cursor);
139
+ appendParam(search, "sandboxId", params.sandboxId);
140
+ appendParam(search, "executionId", params.executionId);
155
141
  const suffix = search.size > 0 ? `?${search}` : "";
156
142
  return getJson(`/v1/run-sessions/${encodeURIComponent(runId)}${suffix}`);
157
143
  }
@@ -183,7 +169,7 @@ function createIntelligenceClient(config) {
183
169
  const stream = verifyDownload(response, {
184
170
  expectedSha256: digest,
185
171
  expectedSize: storedBytes,
186
- signal: transport.signal
172
+ signal: config.signal
187
173
  });
188
174
  return options?.stream ? stream : new Uint8Array(await new Response(stream).arrayBuffer());
189
175
  } catch (error) {
@@ -253,6 +239,7 @@ function createIntelligenceClient(config) {
253
239
  getRun,
254
240
  getRunTraces,
255
241
  listRunSessionFiles,
242
+ waitForRunSessionFiles: (runId, params) => waitForRunSessionFiles(request, config, runId, params),
256
243
  iterateRunSessionFiles,
257
244
  downloadRunSessionFile,
258
245
  listSessions,
@@ -1,2 +1,2 @@
1
- import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, n as BrowserInteractiveSessionControlControllerOptions, r as browserInteractiveControlHolderId, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-D17JJ8B0.js";
1
+ import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, n as BrowserInteractiveSessionControlControllerOptions, r as browserInteractiveControlHolderId, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-CcUjQEfa.js";
2
2
  export { BrowserInteractiveSessionControlController, type BrowserInteractiveSessionControlControllerOptions, type InteractiveSessionIdentity, InteractiveSessionNotRunningError, browserInteractiveControlHolderId };
@@ -1,2 +1,2 @@
1
- import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-Bf-DbRCA.js";
1
+ import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-Bcn-qNH2.js";
2
2
  export { BrowserInteractiveSessionControlController, InteractiveSessionNotRunningError, browserInteractiveControlHolderId };
@@ -1,6 +1,6 @@
1
- import { dt as AgentInteractiveSessionRef, o as TerminalStreamReconnectAuthority, u as ScopedToken } from "./terminal-stream-types-NBdVKKFu.js";
2
- import { Cn as TerminalStream } from "./types-CuMa305b.js";
3
- import { a as InteractiveSessionControlController, c as InteractiveSessionIdentity, f as InteractiveAttachOptions, g as InteractiveRequestOptions, n as BrowserInteractiveSessionControlControllerOptions, o as InteractiveSessionControlControllerOptions, s as InteractiveSessionControlTransport } from "./browser-interactive-control-controller-D17JJ8B0.js";
1
+ import { dt as AgentInteractiveSessionRef, o as TerminalStreamReconnectAuthority, u as ScopedToken } from "./terminal-stream-types-eE97lZ-5.js";
2
+ import { Cn as TerminalStream } from "./types-B5GAxo6l.js";
3
+ import { a as InteractiveSessionControlController, c as InteractiveSessionIdentity, f as InteractiveAttachOptions, g as InteractiveRequestOptions, n as BrowserInteractiveSessionControlControllerOptions, o as InteractiveSessionControlControllerOptions, s as InteractiveSessionControlTransport } from "./browser-interactive-control-controller-CcUjQEfa.js";
4
4
 
5
5
  //#region src/interactive-controller.d.ts
6
6
  /** The request fields supplied by an attach caller before control is claimed. */
@@ -1,11 +1,11 @@
1
1
  import { C as boundedIdentifierSchema, T as boundedJsonSchema, o as canonicalCandidateDigest } from "./harness-DMaNgn0S.js";
2
- import { B as PlanContinuationSchema, D as agentInteractiveSessionControlClaimMatchesRef, P as AgentExactRunControlRefSchema, R as AgentExecutionOutcomeSchema, U as InteractionRequestSchema, c as assertInteractiveSessionRef, h as AgentInteractiveSessionAttachSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, r as browserInteractiveTerminalEndpoint, v as AgentInteractiveSessionControlClaimSchema, x as AgentInteractiveSessionRefSchema, z as DurablePlanSchema } from "./browser-interactive-control-controller-Bf-DbRCA.js";
2
+ import { B as PlanContinuationSchema, D as agentInteractiveSessionControlClaimMatchesRef, P as AgentExactRunControlRefSchema, R as AgentExecutionOutcomeSchema, U as InteractionRequestSchema, c as assertInteractiveSessionRef, h as AgentInteractiveSessionAttachSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, r as browserInteractiveTerminalEndpoint, v as AgentInteractiveSessionControlClaimSchema, x as AgentInteractiveSessionRefSchema, z as DurablePlanSchema } from "./browser-interactive-control-controller-Bcn-qNH2.js";
3
3
  import { r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
4
- import { C as ServerError, D as ValidationError, g as NetworkError, i as parseResponseError, l as CapabilityError, o as retryWhen, t as TerminalStreamError } from "./errors-dK3-2RCh.js";
5
- import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-C0_9B1Hm.js";
6
- import { n as SDK_TIMEOUTS } from "./api-request-B0BPgzdp.js";
7
- import { c as awaitSdkResend, s as uploadChunked } from "./chunked-upload-BGwaw5np.js";
8
- import { t as parseSSEStream } from "./sse-parser-CBQzZvkZ.js";
4
+ import { C as ServerError, D as ValidationError, g as NetworkError, i as parseResponseError, l as CapabilityError, o as retryWhen, t as TerminalStreamError } from "./errors-nXGKGVFe.js";
5
+ import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-CRxC2dlT.js";
6
+ import { n as SDK_TIMEOUTS } from "./api-request-DgN02xvN.js";
7
+ import { c as awaitSdkResend, s as uploadChunked } from "./chunked-upload-BlvgxPWx.js";
8
+ import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
9
9
  import { z } from "zod";
10
10
  import { PART_TEXT, PART_TEXT_SUFFIX } from "@tangle-network/agent-core/sse";
11
11
  /** Stable declaration order; registry tests check the shipped spec composition. */
@@ -511,6 +511,7 @@ function observeEvent(state, event) {
511
511
  return;
512
512
  }
513
513
  if (type === "error") {
514
+ state.failure ??= plainRecord(data.failure);
514
515
  state.runError ??= readError(data) ?? "Agent execution failed";
515
516
  state.runErrorCode ??= readString(data.code);
516
517
  state.runErrorStatusCode ??= readHttpFailureStatus(data.statusCode);
@@ -561,6 +562,7 @@ function observeOutcomeFrame(state, type, data, terminal) {
561
562
  }
562
563
  const outcome = plainRecord(data.outcome);
563
564
  const nestedResult = plainRecord(data.result);
565
+ state.failure ??= plainRecord(data.failure ?? nestedResult?.failure ?? outcome?.failure);
564
566
  for (const [field, value] of Object.entries({
565
567
  status: data.status,
566
568
  "outcome.type": outcome?.type,
@@ -685,6 +687,7 @@ function outcomeDetails(state) {
685
687
  if (question) details.question = question;
686
688
  if (state.plan) details.plan = state.plan;
687
689
  if (state.resetAt) details.resetAt = state.resetAt;
690
+ if (state.failure) details.failure = state.failure;
688
691
  return details;
689
692
  }
690
693
  function failed(error, errorCode, common, statusCode) {
@@ -1,2 +1,2 @@
1
- import { t as runPreparedEvidence } from "../prepared-evidence-DBE_xYjq.js";
1
+ import { t as runPreparedEvidence } from "../prepared-evidence-ibAysmX8.js";
2
2
  export { runPreparedEvidence };
@@ -1,2 +1,2 @@
1
- import { n as withPreparedProcessCalls, t as runPreparedProcess } from "../prepared-process-B1kSkhn-.js";
1
+ import { n as withPreparedProcessCalls, t as runPreparedProcess } from "../prepared-process-DQ_68Ofg.js";
2
2
  export { runPreparedProcess, withPreparedProcessCalls };
@@ -1,4 +1,4 @@
1
- import { Tn as CreateSandboxOptions, ga as BackendConfig } from "./types-CuMa305b.js";
1
+ import { Tn as CreateSandboxOptions, ga as BackendConfig } from "./types-B5GAxo6l.js";
2
2
 
3
3
  //#region src/line-application.d.ts
4
4
  /** Bounded callback request bytes after canonicalization, including JSON framing. */
@@ -1,4 +1,4 @@
1
- import { D as ValidationError, r as parseErrorResponse } from "./errors-dK3-2RCh.js";
1
+ import { D as ValidationError, r as parseErrorResponse } from "./errors-nXGKGVFe.js";
2
2
  //#region src/line-identity.ts
3
3
  /**
4
4
  * The instance key that serves one member: `keyPrefix` plus the first 32 hex
package/dist/lines.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as LineRespondAgent, B as LineVoiceOptions, C as LineMessage, D as LineReplyCode, E as LineReminderPreferences, F as LineSenderVerification, I as LineSenderVerificationStart, L as LineThread, M as LineRole, N as LineSendInput, O as LineReplyCodeInput, P as LineSendReceipt, R as LineTransport, S as LineMemberSpec, T as LineProvider, V as LinesHttpClient, _ as LineInstanceCreate, a as Line, b as LineMemberInstance, c as LineAllowanceSubject, d as LineAttachment, f as LineAttachmentReauthorization, g as LineInstanceAttachOptions, h as LineImage, i as profileChannelReference, j as LineRespondView, k as LineReplyGate, l as LineApplicationAttachOptions, m as LineFromConnectionInput, n as SandboxLines, o as LineAgentRolePolicy, p as LineExecutionKey, r as lineInstanceKey, s as LineAllowance, t as LinesClient, u as LineAttachOptions, v as LineLimits, w as LineNumberInventory, x as LineMemberPatch, y as LineMember, z as LineVoice } from "./lines-n-mBURry.js";
1
+ import { A as LineRespondAgent, B as LineVoiceOptions, C as LineMessage, D as LineReplyCode, E as LineReminderPreferences, F as LineSenderVerification, I as LineSenderVerificationStart, L as LineThread, M as LineRole, N as LineSendInput, O as LineReplyCodeInput, P as LineSendReceipt, R as LineTransport, S as LineMemberSpec, T as LineProvider, V as LinesHttpClient, _ as LineInstanceCreate, a as Line, b as LineMemberInstance, c as LineAllowanceSubject, d as LineAttachment, f as LineAttachmentReauthorization, g as LineInstanceAttachOptions, h as LineImage, i as profileChannelReference, j as LineRespondView, k as LineReplyGate, l as LineApplicationAttachOptions, m as LineFromConnectionInput, n as SandboxLines, o as LineAgentRolePolicy, p as LineExecutionKey, r as lineInstanceKey, s as LineAllowance, t as LinesClient, u as LineAttachOptions, v as LineLimits, w as LineNumberInventory, x as LineMemberPatch, y as LineMember, z as LineVoice } from "./lines-CCJZUrBP.js";
2
2
  export { Line, LineAgentRolePolicy, LineAllowance, LineAllowanceSubject, LineApplicationAttachOptions, LineAttachOptions, LineAttachment, LineAttachmentReauthorization, LineExecutionKey, LineFromConnectionInput, LineImage, LineInstanceAttachOptions, LineInstanceCreate, LineLimits, LineMember, LineMemberInstance, LineMemberPatch, LineMemberSpec, LineMessage, LineNumberInventory, LineProvider, LineReminderPreferences, LineReplyCode, LineReplyCodeInput, LineReplyGate, LineRespondAgent, LineRespondView, LineRole, LineSendInput, LineSendReceipt, LineSenderVerification, LineSenderVerificationStart, LineThread, LineTransport, LineVoice, LineVoiceOptions, LinesClient, LinesHttpClient, SandboxLines, lineInstanceKey, profileChannelReference };
package/dist/lines.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-DtssoioA.js";
1
+ import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-CSGBHEjR.js";
2
2
  export { LinesClient, SandboxLines, lineInstanceKey, profileChannelReference };
@@ -1,4 +1,4 @@
1
- import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-C6DtK7GX-Cjs6D-9c.js";
1
+ import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-C6DtK7GX-mBUPER0R.js";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import { basename, dirname, join } from "node:path";
4
4
  import { homedir } from "node:os";