@tangle-network/sandbox 0.69.11 → 0.69.13

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 (77) hide show
  1. package/dist/agent/index.d.ts +4 -4
  2. package/dist/agent/index.js +5 -5
  3. package/dist/agent/preview.d.ts +1 -1
  4. package/dist/agent/preview.js +3 -3
  5. package/dist/{agent-run-outcome-B5CzWxw4.d.ts → agent-run-outcome-BuebRCWr.d.ts} +2 -2
  6. package/dist/{api-request-D1UVNo16.js → api-request-EseiF9B1.js} +1 -1
  7. package/dist/auth/index.d.ts +2 -2
  8. package/dist/auth/index.js +1 -1
  9. package/dist/browser-interactive-control-controller-Bt1vcu9c.js +4045 -0
  10. package/dist/{browser-interactive-control-controller-SI9hV6r5.d.ts → browser-interactive-control-controller-CVnME80O.d.ts} +5 -7
  11. package/dist/{chunked-upload-l6b9AWFA.js → chunked-upload-Df_5Q2x8.js} +1 -1
  12. package/dist/{chunked-upload-file-CLwAeLrM.js → chunked-upload-file-Dtm1GBkE.js} +2 -2
  13. package/dist/cli-auth-bundle-3LBcaEqw.js +2593 -0
  14. package/dist/{client-Ds3As2SY.d.ts → client-BWnbrifs.d.ts} +40 -42
  15. package/dist/{client-D6b3wBnI.js → client-D-6z6BJb.js} +11 -11
  16. package/dist/collaboration/index.d.ts +1 -1
  17. package/dist/collaboration/index.js +1 -1
  18. package/dist/{collaboration-BwLNv6sy.js → collaboration-BTGTf3We.js} +1 -1
  19. package/dist/{core-BhSZIdRK.js → core-EqIoRKiQ.js} +5 -4
  20. package/dist/core.d.ts +6 -6
  21. package/dist/core.js +5 -5
  22. package/dist/{direct-http2-Pyj3Rvr1.js → direct-http2-B0ra_xhU.js} +1 -1
  23. package/dist/{errors-Bs5G7JdV.js → errors-ZmDrrk4f.js} +1 -1
  24. package/dist/harness-BD_OISom.js +201 -0
  25. package/dist/harness-DWL2MM4q.js +418 -0
  26. package/dist/{index-nXob5TkM.d.ts → index-DdcCRDq8.d.ts} +14 -16
  27. package/dist/index.d.ts +11 -11
  28. package/dist/index.js +11 -11
  29. package/dist/intelligence/index.js +2 -2
  30. package/dist/interactive-control.d.ts +1 -1
  31. package/dist/interactive-control.js +1 -1
  32. package/dist/{interactive-controller-DSDEfapN.js → interactive-controller-B4bQwRJL.js} +21 -8
  33. package/dist/{interactive-controller-FgmcS8_Y.d.ts → interactive-controller-DlFKGQqu.d.ts} +3 -4
  34. package/dist/lib/prepared-evidence.js +1 -1
  35. package/dist/lib/prepared-process.js +1 -1
  36. package/dist/{lines-D_HDAcVt.js → lines-BqZOl_io.js} +1 -1
  37. package/dist/{lines-BoVYnUCM.d.ts → lines-ptj8SyD4.d.ts} +1 -1
  38. package/dist/lines.d.ts +1 -1
  39. package/dist/lines.js +1 -1
  40. package/dist/{local-cli-auth-DaU64laN.js → local-cli-auth-BBdGF3wf.js} +1 -1
  41. package/dist/{mcp-local-Gz1Uygqk.js → mcp-local-BcRLN_Ic.js} +1 -1
  42. package/dist/{prepared-evidence-DUmJSegi.js → prepared-evidence-CuUh_mz6.js} +1 -1
  43. package/dist/{preview-7EJ_80nL.d.ts → preview-ByTCKjiK.d.ts} +3 -3
  44. package/dist/profile-schema-CT3hB1mG.js +1135 -0
  45. package/dist/{public-templates-B6_uwnRZ.d.ts → public-templates-O2mxBX7J.d.ts} +2 -2
  46. package/dist/public-templates.d.ts +1 -1
  47. package/dist/public-templates.js +1 -1
  48. package/dist/{raw-evidence-archive-D60Yg1-5.js → raw-evidence-archive-CqarcYcp.js} +1 -1
  49. package/dist/runtime.d.ts +5 -5
  50. package/dist/runtime.js +5 -5
  51. package/dist/{sandbox-DVOrtcTK.js → sandbox-eUPdjk1p.js} +384 -46
  52. package/dist/{secp256k1-DxHlUI6v.js → secp256k1-CZWrpqxW.js} +1 -1
  53. package/dist/select-seat-command.d.ts +1 -1
  54. package/dist/select-seat-command.js +1 -1
  55. package/dist/session-gateway/index.js +3 -3
  56. package/dist/sha2-BUPMvGTk.js +694 -0
  57. package/dist/tangle/index.d.ts +1 -1
  58. package/dist/tangle/index.js +1 -1
  59. package/dist/{tangle-Br7yT7X8.js → tangle-BmhK_E7e.js} +4 -4
  60. package/dist/terminal-stream-types-DwXQzUbH.d.ts +3328 -0
  61. package/dist/{types-CkLWX7i5.d.ts → types-B28t5Sq1.d.ts} +10 -12
  62. package/package.json +6 -6
  63. package/dist/browser-interactive-control-controller-CLHNi8rG.js +0 -292
  64. package/dist/cli-auth-bundle-B1Mpf18p.js +0 -1590
  65. package/dist/terminal-stream-types-DuzvL1ge.d.ts +0 -676
  66. /package/dist/{abort-signal-BKVZNJul.js → abort-signal-jU-SEjLT.js} +0 -0
  67. /package/dist/{cli-auth-bundle-CeNOYFje.d.ts → cli-auth-bundle-MskLEgtA.d.ts} +0 -0
  68. /package/dist/{index-C0RkLba5.d.ts → index-Dqcr9p97.d.ts} +0 -0
  69. /package/dist/{index-DaIF4c9p.d.ts → index-Dslyq85a.d.ts} +0 -0
  70. /package/dist/{keep-alive-fetch-Bi-zvHpN.js → keep-alive-fetch-C2DX2_rG.js} +0 -0
  71. /package/dist/{prepared-process-Dlk_9JVJ.js → prepared-process-LjBfQnZ5.js} +0 -0
  72. /package/dist/{preview-operations-eTUlPen5.js → preview-operations-BvgwYaoL.js} +0 -0
  73. /package/dist/{response-rewrap-BKkJ5hnn.js → response-rewrap-MBztoTLx.js} +0 -0
  74. /package/dist/{retry-after-header-U_L5Ml9Q.js → retry-after-header-BZbs5rig.js} +0 -0
  75. /package/dist/{sidecar-proxy-error-B2Hxt41g.js → sidecar-proxy-error-Dty4zmN7.js} +0 -0
  76. /package/dist/{sse-parser-CUfurwcm.js → sse-parser-DmO5gP6u.js} +0 -0
  77. /package/dist/{utils-DB8DnUCU.js → utils-vaFoyyiO.js} +0 -0
@@ -1,25 +1,258 @@
1
1
  import { a as normalizeEffectiveBackend, r as backendTypeSchema } from "./backend-types-CLvdSX8V.js";
2
- import { A as requestedPublicProfileDigest, C as encodeTextForWire, E as assertCurrentBackendType, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, O as mergeRuntimeBackendConfig, P as withoutRuntimeSecrets, S as encodePromptForWire, T as applyRequestedModel, _ as mintTraceId, a as assertScopedTokenActive, b as resolveDispatchRunIdentity, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as sessionHeaders, g as isTraceId, h as TRACE_ID_HEADER, i as terminalUpgradeHeadersSupported, j as requestedSecretProfilePublicDigest, k as normalizeRuntimeBackendConfig, l as normalizeSessionInfo, m as waitForRetryAfter, n as InteractiveSessionController, p as isRetryableCredentialRefusal, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as resolveTraceId, w as canUseNodeHttp2, x as validateAcceptedDispatchRunRef, y as traceHeaders } from "./interactive-controller-DSDEfapN.js";
3
- import { A as SANDBOX_PROXY_REQUEST_MAX_BYTES, C as StateError, E as ValidationError, F as isProfileFileMountOutsideRoots, I as profileFileMountOutsideRootsMessage, M as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, N as SANDBOX_AGENT_HOME, P as SANDBOX_FILE_API_ABSOLUTE_ROOTS, S as ServerError, T as TimeoutError, a as AuthError, g as NotFoundError, h as NetworkError, i as readResponseJson, l as EdgeNotReadyError, n as parseErrorResponse, r as parseResponseError, s as CapabilityError, t as TerminalStreamError, v as ProfileFileMountPathError, w as StreamInterruptedError, x as SandboxError, y as QuotaError } from "./errors-Bs5G7JdV.js";
4
- import { d as interactiveSessionControlClaimResponseSchema, f as interactiveSessionControlReleaseResponseSchema, l as createInteractiveControlHolderId, m as interactiveSessionStatusResponseSchema, p as interactiveSessionControlValidationResponseSchema } from "./browser-interactive-control-controller-CLHNi8rG.js";
5
- import { n as combineAbortSignals, r as delayUntilAborted, t as awaitWithAbort } from "./abort-signal-BKVZNJul.js";
6
- import { t as rewrapResponse } from "./response-rewrap-BKkJ5hnn.js";
7
- import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-Bi-zvHpN.js";
8
- import { t as SIDECAR_PROXY_ERROR_HEADER } from "./sidecar-proxy-error-B2Hxt41g.js";
9
- import { t as parseSSEStream } from "./sse-parser-CUfurwcm.js";
10
- import { s as uploadChunked } from "./chunked-upload-l6b9AWFA.js";
11
- import { t as runPreparedProcess } from "./prepared-process-Dlk_9JVJ.js";
12
- import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-B1Mpf18p.js";
13
- import { n as SandboxLines } from "./lines-D_HDAcVt.js";
2
+ import { A as agentInteractiveSessionStopAcknowledgementMatchesCommand, B as InteractionAcknowledgementSchema, C as AgentInteractiveSessionStopCommandSchema, D as agentInteractiveSessionPromptAcknowledgementMatchesCommand, E as agentInteractiveSessionControlClaimMatchesRef, F as AgentRunCancellationRequestSchema, G as AgentInteractiveSessionPromptAcknowledgementSchema, H as InteractionResponseCommandSchema, I as agentRunCancellationAcknowledgementMatchesRequest, J as AgentInteractiveSessionStopAcknowledgementSchema, K as AgentInteractiveSessionRefSchema$1, M as sameAgentExactRun, N as AgentExactRunControlRefSchema, P as AgentRunCancellationAcknowledgementSchema, S as AgentInteractiveSessionStopAcknowledgementSchema$1, T as agentInteractiveSessionControlClaimIsNewer, U as InteractionResponseSchema, V as InteractionRequestSchema, W as AgentInteractiveSessionControlClaimSchema, Y as InteractionBindingSchema, _ as AgentInteractiveSessionControlClaimRequestSchema, b as AgentInteractiveSessionPromptCommandSchema, d as interactiveSessionControlClaimResponseSchema, f as interactiveSessionControlReleaseResponseSchema, g as AgentInteractiveSessionControlClaimAcknowledgementSchema, h as AgentInteractiveSessionAttachSchema, j as agentInteractiveDimensionSchema, k as agentInteractiveSessionStatusMatchesRef, l as createInteractiveControlHolderId, m as interactiveSessionStatusResponseSchema, p as interactiveSessionControlValidationResponseSchema, q as AgentInteractiveSessionStatusSchema, v as AgentInteractiveSessionControlClaimSchema$1, w as agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, x as AgentInteractiveSessionRefSchema, y as AgentInteractiveSessionPromptAcknowledgementSchema$1, z as PlanContinuationSchema } from "./browser-interactive-control-controller-Bt1vcu9c.js";
3
+ import { t as sha256 } from "./sha2-BUPMvGTk.js";
4
+ import { a as canonicalCandidateDigest$1, h as sha256DigestSchema$1 } from "./harness-BD_OISom.js";
5
+ import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-3LBcaEqw.js";
6
+ import { A as requestedPublicProfileDigest, C as encodeTextForWire, E as assertCurrentBackendType, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, O as mergeRuntimeBackendConfig, P as withoutRuntimeSecrets, S as encodePromptForWire, T as applyRequestedModel, _ as mintTraceId, a as assertScopedTokenActive, b as resolveDispatchRunIdentity, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as sessionHeaders, g as isTraceId, h as TRACE_ID_HEADER, i as terminalUpgradeHeadersSupported, j as requestedSecretProfilePublicDigest, k as normalizeRuntimeBackendConfig, l as normalizeSessionInfo, m as waitForRetryAfter, n as InteractiveSessionController, p as isRetryableCredentialRefusal, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as resolveTraceId, w as canUseNodeHttp2, x as validateAcceptedDispatchRunRef, y as traceHeaders } from "./interactive-controller-B4bQwRJL.js";
7
+ import { S as boundedIdentifierSchema, T as boundedStringSchema, g as sha256DigestSchema$2, o as canonicalCandidateDigest$2, s as canonicalCandidateJson$1, u as isCanonicalJsonValue$1 } from "./harness-DWL2MM4q.js";
8
+ import { i as canonicalAgentProfileValue, n as agentProfileSchema } from "./profile-schema-CT3hB1mG.js";
9
+ import { A as SANDBOX_PROXY_REQUEST_MAX_BYTES, C as StateError, E as ValidationError, F as isProfileFileMountOutsideRoots, I as profileFileMountOutsideRootsMessage, M as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, N as SANDBOX_AGENT_HOME, P as SANDBOX_FILE_API_ABSOLUTE_ROOTS, S as ServerError, T as TimeoutError, a as AuthError, g as NotFoundError, h as NetworkError, i as readResponseJson, l as EdgeNotReadyError, n as parseErrorResponse, r as parseResponseError, s as CapabilityError, t as TerminalStreamError, v as ProfileFileMountPathError, w as StreamInterruptedError, x as SandboxError, y as QuotaError } from "./errors-ZmDrrk4f.js";
10
+ import { n as combineAbortSignals, r as delayUntilAborted, t as awaitWithAbort } from "./abort-signal-jU-SEjLT.js";
11
+ import { t as rewrapResponse } from "./response-rewrap-MBztoTLx.js";
12
+ import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-C2DX2_rG.js";
13
+ import { t as SIDECAR_PROXY_ERROR_HEADER } from "./sidecar-proxy-error-Dty4zmN7.js";
14
+ import { t as parseSSEStream } from "./sse-parser-DmO5gP6u.js";
15
+ import { s as uploadChunked } from "./chunked-upload-Df_5Q2x8.js";
16
+ import { t as runPreparedProcess } from "./prepared-process-LjBfQnZ5.js";
17
+ import { n as SandboxLines } from "./lines-BqZOl_io.js";
14
18
  import { z } from "zod";
15
- import { AgentExactRunControlRefSchema, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, InteractionAcknowledgementSchema, InteractionBindingSchema, InteractionRequestSchema, InteractionResponseCommandSchema, InteractionResponseSchema, PlanContinuationSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, canonicalCandidateDigest, canonicalCandidateJson, exactAgentInteractiveSessionStart, sha256DigestSchema, terminalSessionUsable } from "@tangle-network/agent-interface";
16
- import { AgentInteractiveSessionControlClaimSchema as AgentInteractiveSessionControlClaimSchema$1, AgentInteractiveSessionPromptAcknowledgementSchema as AgentInteractiveSessionPromptAcknowledgementSchema$1, AgentInteractiveSessionRefSchema as AgentInteractiveSessionRefSchema$1, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema as AgentInteractiveSessionStopAcknowledgementSchema$1 } from "@tangle-network/agent-interface/environment-interactive-control";
17
19
  import { createHash } from "node:crypto";
18
20
  import { constants } from "node:fs";
19
21
  import { dirname } from "node:path";
20
22
  import "node:fs/promises";
21
23
  import { readTokenCostUsd, readTokenUsage } from "@tangle-network/agent-core";
22
24
  import "@tangle-network/agent-interface/environment-provider";
25
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.8.1/node_modules/@tangle-network/agent-interface/dist/agent-execution-preparation.js
26
+ /**
27
+ * Canonical RFC 8785/SHA-256 identity for one validated, public AgentProfile.
28
+ * Secret-capable MCP/hook fields are tagged. Other prompt, resource, metadata,
29
+ * and tool text is ordinary public profile data: it may legitimately discuss
30
+ * credentials, security incidents, or examples that resemble credentials, so
31
+ * pattern matching cannot decide whether it is secret. Resolve opaque secret
32
+ * references only after this public identity is fixed.
33
+ */
34
+ function canonicalAgentProfileDigest(profile) {
35
+ const material = canonicalAgentProfileValue(agentProfileSchema.parse(profile));
36
+ if (material === void 0 || !isCanonicalJsonValue$1(material)) throw new Error("AgentProfile must contain finite, acyclic RFC 8785 JSON values");
37
+ return canonicalCandidateDigest$2(material);
38
+ }
39
+ //#endregion
40
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.8.1/node_modules/@tangle-network/agent-interface/dist/environment-interactive-start.js
41
+ const AgentInteractiveSessionRunCoordinatesSchema = z.strictObject({
42
+ provider: boundedIdentifierSchema,
43
+ environmentId: boundedIdentifierSchema,
44
+ sessionId: boundedIdentifierSchema,
45
+ executionId: boundedIdentifierSchema
46
+ });
47
+ /**
48
+ * Start one native coding-agent TUI from caller-owned request material.
49
+ *
50
+ * The provider owns profile materialization and returns its preparation receipt
51
+ * in the resulting reference. Replaying the same exact request/run returns the
52
+ * same reference, even after the process exits; changed material cannot reuse it.
53
+ */
54
+ const AgentInteractiveSessionStartSchema = z.strictObject({
55
+ run: AgentExactRunControlRefSchema,
56
+ profile: agentProfileSchema,
57
+ requestedProfileDigest: sha256DigestSchema$2,
58
+ authMode: z.literal("oauth").optional(),
59
+ initialPrompt: boundedStringSchema.optional(),
60
+ cwd: boundedStringSchema.min(1).optional(),
61
+ cols: agentInteractiveDimensionSchema.optional(),
62
+ rows: agentInteractiveDimensionSchema.optional()
63
+ });
64
+ /** Digest the exact process-start request independently of its derived run id. */
65
+ function agentInteractiveSessionRequestDigest(coordinates, input) {
66
+ const exactCoordinates = AgentInteractiveSessionRunCoordinatesSchema.parse(coordinates);
67
+ const exactInput = AgentInteractiveSessionStartSchema.omit({ run: true }).parse(input);
68
+ return canonicalCandidateDigest$2({
69
+ kind: "agent-interactive-session-start.v1",
70
+ run: exactCoordinates,
71
+ requestedProfileDigest: exactInput.requestedProfileDigest,
72
+ ...exactInput.authMode === void 0 ? {} : { authMode: exactInput.authMode },
73
+ ...exactInput.initialPrompt === void 0 ? {} : { initialPrompt: exactInput.initialPrompt },
74
+ ...exactInput.cwd === void 0 ? {} : { cwd: exactInput.cwd },
75
+ ...exactInput.cols === void 0 ? {} : { cols: exactInput.cols },
76
+ ...exactInput.rows === void 0 ? {} : { rows: exactInput.rows }
77
+ });
78
+ }
79
+ /** Mint the one exact run reference a provider must acknowledge for this start. */
80
+ function agentInteractiveSessionRunRef(coordinates, input) {
81
+ const exactCoordinates = AgentInteractiveSessionRunCoordinatesSchema.parse(coordinates);
82
+ const requestDigest = agentInteractiveSessionRequestDigest(exactCoordinates, input);
83
+ return AgentExactRunControlRefSchema.parse({
84
+ ...exactCoordinates,
85
+ runId: `interactive-run-${requestDigest.slice(7)}`,
86
+ requestDigest
87
+ });
88
+ }
89
+ /** Parse a start request and prove its profile identity before provider work. */
90
+ function exactAgentInteractiveSessionStart(value) {
91
+ const parsed = AgentInteractiveSessionStartSchema.parse(value);
92
+ if (parsed.profile.harness === void 0) throw new Error("interactive agent sessions require AgentProfile.harness");
93
+ if (parsed.authMode === "oauth" && parsed.profile.harness !== "claude-code") throw new Error("Claude Code OAuth mode requires the claude-code harness");
94
+ if (canonicalAgentProfileDigest(parsed.profile) !== parsed.requestedProfileDigest) throw new Error("interactive agent session requested profile digest does not match its profile");
95
+ const { run, ...input } = parsed;
96
+ if (!sameAgentExactRun(run, agentInteractiveSessionRunRef(runCoordinates(run), input))) throw new Error("interactive agent session run identity does not match its start request");
97
+ return parsed;
98
+ }
99
+ /** Prove that a provider returned the exact run and preparation receipt requested. */
100
+ function agentInteractiveSessionRefMatchesStart(request, ref) {
101
+ const parsedRequest = AgentInteractiveSessionStartSchema.safeParse(request);
102
+ const parsedRef = AgentInteractiveSessionRefSchema.safeParse(ref);
103
+ if (!parsedRequest.success || !parsedRef.success) return false;
104
+ const requestedHarness = parsedRequest.data.profile.harness;
105
+ if (requestedHarness === void 0) return false;
106
+ return parsedRef.data.preparationReceipt.authoredProfileDigest === parsedRequest.data.requestedProfileDigest && parsedRef.data.preparationReceipt.harness === requestedHarness && sameAgentExactRun(parsedRef.data.run, parsedRequest.data.run);
107
+ }
108
+ function runCoordinates(run) {
109
+ return {
110
+ provider: run.provider,
111
+ environmentId: run.environmentId,
112
+ sessionId: run.sessionId,
113
+ executionId: run.executionId
114
+ };
115
+ }
116
+ //#endregion
117
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.8.1/node_modules/@tangle-network/agent-interface/dist/environment-terminal.js
118
+ const terminalDimensionSchema = z.number().int().positive().max(1e4);
119
+ /**
120
+ * Provider-neutral handle for one interactive terminal.
121
+ *
122
+ * The handle carries no raw process id and no environment map, so a terminal
123
+ * reference never leaks host process detail or injected secrets. Every terminal
124
+ * is bound to a parent execution and carries an explicit expiry, so an orphan
125
+ * or an expired terminal fails closed at the call sites that read it.
126
+ */
127
+ const TerminalSessionRefSchema = z.strictObject({
128
+ terminalSessionId: boundedIdentifierSchema,
129
+ parentExecutionId: boundedIdentifierSchema,
130
+ name: boundedIdentifierSchema,
131
+ shell: boundedStringSchema.min(1),
132
+ command: boundedStringSchema.optional(),
133
+ cwd: boundedStringSchema.min(1),
134
+ cols: terminalDimensionSchema,
135
+ rows: terminalDimensionSchema,
136
+ connectionId: boundedIdentifierSchema.optional(),
137
+ createdAt: z.iso.datetime().max(64),
138
+ lastActivityAt: z.iso.datetime().max(64),
139
+ expiresAt: z.iso.datetime().max(64),
140
+ isRunning: z.boolean(),
141
+ exitCode: z.number().int().optional(),
142
+ exitSignal: boundedIdentifierSchema.optional(),
143
+ attachCount: z.number().int().nonnegative()
144
+ });
145
+ /** Raw bytes written to the terminal, normalized to UTF-8 text. */
146
+ const TerminalInputSchema = z.strictObject({ data: boundedStringSchema });
147
+ /** New terminal geometry. */
148
+ const TerminalResizeSchema = z.strictObject({
149
+ cols: terminalDimensionSchema,
150
+ rows: terminalDimensionSchema
151
+ });
152
+ z.strictObject({
153
+ parentExecutionId: boundedIdentifierSchema,
154
+ terminalSessionId: boundedIdentifierSchema.optional(),
155
+ connectionId: boundedIdentifierSchema.optional(),
156
+ mode: z.enum(["attach", "logical"]),
157
+ cols: terminalDimensionSchema.optional(),
158
+ rows: terminalDimensionSchema.optional(),
159
+ command: boundedStringSchema.optional(),
160
+ cwd: boundedStringSchema.optional()
161
+ });
162
+ z.discriminatedUnion("status", [
163
+ z.strictObject({
164
+ status: z.enum(["attached", "reattached"]),
165
+ mode: z.enum(["attach", "logical"]),
166
+ ref: TerminalSessionRefSchema,
167
+ attachCount: z.number().int().nonnegative()
168
+ }),
169
+ z.strictObject({
170
+ status: z.literal("unavailable"),
171
+ reason: boundedStringSchema.min(1)
172
+ }),
173
+ z.strictObject({
174
+ status: z.literal("unknown"),
175
+ message: boundedStringSchema.min(1),
176
+ retryable: z.boolean()
177
+ })
178
+ ]);
179
+ /**
180
+ * One ordered terminal output frame. `output` frames carry a monotonic `seq`
181
+ * that a consumer replays from, so a reconnect resumes without loss or
182
+ * duplication.
183
+ */
184
+ const TerminalOutputEventSchema = z.discriminatedUnion("type", [
185
+ z.strictObject({
186
+ type: z.literal("ready"),
187
+ cols: terminalDimensionSchema.optional(),
188
+ rows: terminalDimensionSchema.optional()
189
+ }),
190
+ z.strictObject({
191
+ type: z.literal("output"),
192
+ seq: z.number().int().nonnegative(),
193
+ data: boundedStringSchema
194
+ }),
195
+ z.strictObject({
196
+ type: z.literal("resize"),
197
+ cols: terminalDimensionSchema,
198
+ rows: terminalDimensionSchema
199
+ }),
200
+ z.strictObject({
201
+ type: z.literal("exit"),
202
+ exitCode: z.number().int().optional(),
203
+ exitSignal: boundedIdentifierSchema.optional()
204
+ }),
205
+ z.strictObject({
206
+ type: z.literal("error"),
207
+ message: boundedStringSchema.min(1)
208
+ })
209
+ ]);
210
+ z.discriminatedUnion("status", [
211
+ z.strictObject({
212
+ status: z.literal("detached"),
213
+ terminalSessionId: boundedIdentifierSchema,
214
+ connectionId: boundedIdentifierSchema.optional()
215
+ }),
216
+ z.strictObject({
217
+ status: z.literal("closed"),
218
+ terminalSessionId: boundedIdentifierSchema,
219
+ exitCode: z.number().int().optional(),
220
+ exitSignal: boundedIdentifierSchema.optional()
221
+ }),
222
+ z.strictObject({
223
+ status: z.literal("unknown"),
224
+ terminalSessionId: boundedIdentifierSchema,
225
+ message: boundedStringSchema.min(1),
226
+ retryable: z.boolean()
227
+ })
228
+ ]);
229
+ /**
230
+ * Fail-closed usability check for a terminal reference. Returns true only when
231
+ * the reference parses, is running, and its expiry is in the future. A parse
232
+ * failure, a stopped terminal, or a past expiry denies use.
233
+ */
234
+ function terminalSessionUsable(ref, nowIso) {
235
+ const parsed = TerminalSessionRefSchema.safeParse(ref);
236
+ if (!parsed.success) return false;
237
+ const now = Date.parse(nowIso);
238
+ const expiresAt = Date.parse(parsed.data.expiresAt);
239
+ if (!Number.isFinite(now) || !Number.isFinite(expiresAt)) return false;
240
+ if (now >= expiresAt) return false;
241
+ return parsed.data.isRunning;
242
+ }
243
+ /**
244
+ * The replay cursors a terminal handle can serve.
245
+ *
246
+ * `earliest` is the oldest cursor `events` accepts and `latest` is the newest
247
+ * frame the handle holds. A handle retains a bounded number of frames, so a
248
+ * consumer that holds no cursor, or holds one the handle dropped, reads this
249
+ * window to resume from a cursor that still exists.
250
+ */
251
+ const TerminalReplayWindowSchema = z.strictObject({
252
+ earliest: z.number().int().nonnegative(),
253
+ latest: z.number().int().nonnegative()
254
+ });
255
+ //#endregion
23
256
  //#region src/normalize.ts
24
257
  /**
25
258
  * Normalize a raw `connection` payload from the Sandbox API into the SDK's
@@ -131,7 +364,7 @@ const PROFILE_IMPORT_PART_BYTES = 512 * 1024;
131
364
  const MANAGED_PROFILE_TRANSPORT = "managed-profile-reference-v1";
132
365
  /** Cache identity follows JSON wire semantics and RFC 8785 key ordering. */
133
366
  function profileCacheSha256(profile) {
134
- return canonicalCandidateDigest(JSON.parse(JSON.stringify(profile))).slice(7);
367
+ return canonicalCandidateDigest$1(JSON.parse(JSON.stringify(profile))).slice(7);
135
368
  }
136
369
  //#endregion
137
370
  //#region ../../../packages/runtime-contracts/dist/direct-read.js
@@ -406,7 +639,7 @@ async function responseNeedsProfileImport(response) {
406
639
  }
407
640
  /** Upload the public profile only. Runtime grants remain in the turn backend. */
408
641
  async function primeManagedProfile(profile, fetchRuntime) {
409
- const bytes = new TextEncoder().encode(canonicalCandidateJson(profile));
642
+ const bytes = new TextEncoder().encode(canonicalCandidateJson$1(profile));
410
643
  const sha256 = profileCacheSha256(profile);
411
644
  if (bytes.length > 8388608) throw new ValidationError("Managed profile exceeds the profile import bound");
412
645
  const post = async (body) => {
@@ -1436,7 +1669,7 @@ var DirectRuntimeHttpClient = class {
1436
1669
  };
1437
1670
  if (!route) throw new NetworkError("Direct runtime route was withdrawn");
1438
1671
  if ((route.useHost || route.useExec) && canUseNodeHttp2()) {
1439
- const { fetchDirectHttp2 } = await import("./direct-http2-Pyj3Rvr1.js");
1672
+ const { fetchDirectHttp2 } = await import("./direct-http2-B0ra_xhU.js");
1440
1673
  return fetchDirectHttp2(route.url, request, timing);
1441
1674
  }
1442
1675
  return fetchWithKeepAlive(route.url, request, timing);
@@ -1498,6 +1731,111 @@ async function isRefusedBearer(response) {
1498
1731
  return false;
1499
1732
  }
1500
1733
  }
1734
+ //#endregion
1735
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@3.0.0/node_modules/@tangle-network/agent-interface/dist/agent-candidate-schema-common.js
1736
+ const sha256Pattern = /^sha256:[a-f0-9]{64}$/;
1737
+ const gitObjectPattern = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
1738
+ const environmentNamePattern = /^[A-Za-z_][A-Za-z0-9_]*$/;
1739
+ const headerNamePattern = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
1740
+ const mediaTypePattern = /^[a-z0-9][a-z0-9!#$&^_.+-]{0,126}\/[a-z0-9][a-z0-9!#$&^_.+-]{0,126}$/;
1741
+ const githubComponentPattern = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$/;
1742
+ const secretNamePattern = /(?:^|[_-])(?:api[_-]?key|access[_-]?key|private[_-]?key|token|secret|password|credentials?|authorization|cookie|database[_-]?url|dsn|pat)(?:[_-]|$)/i;
1743
+ const obviousSecretValuePattern = /(?:\bsk[-_][-_A-Za-z0-9]{10,}\b|\bgh[pousr]_[A-Za-z0-9]{12,}\b|\bgithub_pat_[A-Za-z0-9_]{12,}\b|\bAKIA[A-Z0-9]{12,}\b|-----BEGIN [A-Z ]*PRIVATE KEY-----|\bBearer\s+\S+)/;
1744
+ const controlCharacterPattern = /[\u0000-\u001f\u007f]/;
1745
+ z.string().regex(sha256Pattern);
1746
+ z.string().regex(gitObjectPattern);
1747
+ const environmentNameSchema = z.string().regex(environmentNamePattern);
1748
+ z.string().regex(headerNamePattern);
1749
+ z.string().regex(mediaTypePattern);
1750
+ function sha256Bytes(value) {
1751
+ const bytes = sha256(value);
1752
+ return `sha256:${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
1753
+ }
1754
+ /** RFC 8785 serialization used by every candidate-producing package. */
1755
+ function canonicalCandidateJson(value) {
1756
+ if (!isCanonicalJsonValue(value)) throw new Error("candidate document must be finite, acyclic RFC 8785 JSON");
1757
+ return serializeCanonicalCandidate(value);
1758
+ }
1759
+ function canonicalCandidateBytes(value) {
1760
+ return new TextEncoder().encode(canonicalCandidateJson(value));
1761
+ }
1762
+ function canonicalCandidateDigest(value) {
1763
+ return sha256Bytes(canonicalCandidateBytes(value));
1764
+ }
1765
+ function serializeCanonicalCandidate(value) {
1766
+ if (value === null || typeof value === "boolean" || typeof value === "number") return JSON.stringify(value);
1767
+ if (typeof value === "string") return JSON.stringify(value);
1768
+ if (Array.isArray(value)) return `[${value.map(serializeCanonicalCandidate).join(",")}]`;
1769
+ return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${serializeCanonicalCandidate(value[key])}`).join(",")}}`;
1770
+ }
1771
+ function isWellFormedUnicode(value) {
1772
+ for (let index = 0; index < value.length; index++) {
1773
+ const code = value.charCodeAt(index);
1774
+ if (code >= 55296 && code <= 56319) {
1775
+ const next = value.charCodeAt(index + 1);
1776
+ if (!(next >= 56320 && next <= 57343)) return false;
1777
+ index++;
1778
+ } else if (code >= 56320 && code <= 57343) return false;
1779
+ }
1780
+ return true;
1781
+ }
1782
+ function isCanonicalJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
1783
+ if (value === null || typeof value === "boolean") return true;
1784
+ if (typeof value === "string") return isWellFormedUnicode(value);
1785
+ if (typeof value === "number") return Number.isFinite(value);
1786
+ if (typeof value !== "object" || ancestors.has(value)) return false;
1787
+ const prototype = Object.getPrototypeOf(value);
1788
+ if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) return false;
1789
+ const nextAncestors = new Set(ancestors).add(value);
1790
+ if (Array.isArray(value)) {
1791
+ for (let index = 0; index < value.length; index += 1) {
1792
+ if (!(index in value)) return false;
1793
+ if (!isCanonicalJsonValue(value[index], nextAncestors)) return false;
1794
+ }
1795
+ return true;
1796
+ }
1797
+ return Object.entries(value).every(([key, entry]) => isWellFormedUnicode(key) && isCanonicalJsonValue(entry, nextAncestors));
1798
+ }
1799
+ function hasCredentialBearingUrl(value) {
1800
+ try {
1801
+ const url = new URL(value);
1802
+ if (url.username !== "" || url.password !== "") return true;
1803
+ return [...url.searchParams.keys()].some((key) => secretNamePattern.test(key));
1804
+ } catch {
1805
+ return false;
1806
+ }
1807
+ }
1808
+ /**
1809
+ * Whether a string holds an obvious credential: a provider key (`sk-`, `gh*_`,
1810
+ * `github_pat_`, `AKIA`), a PEM private key, a bearer token, or a URL with
1811
+ * userinfo or a credential-named query parameter. The agent-eval redaction
1812
+ * core calls it, so candidate validation and trace redaction agree.
1813
+ */
1814
+ function looksLikeCredential(value) {
1815
+ return obviousSecretValuePattern.test(value) || hasCredentialBearingUrl(value);
1816
+ }
1817
+ function isPublicConfigValue(value) {
1818
+ return !controlCharacterPattern.test(value) && isWellFormedUnicode(value) && !looksLikeCredential(value);
1819
+ }
1820
+ const agentCandidateConfigValueSchema = z.object({
1821
+ kind: z.literal("public"),
1822
+ value: z.string().refine(isPublicConfigValue, "candidate config cannot carry credentials; the evaluator owns model authorization")
1823
+ }).strict();
1824
+ function configRecordSchema(keySchema) {
1825
+ return z.record(keySchema, agentCandidateConfigValueSchema).superRefine((config, ctx) => {
1826
+ for (const name of Object.keys(config)) if (secretNamePattern.test(name)) ctx.addIssue({
1827
+ code: "custom",
1828
+ path: [name],
1829
+ message: "candidate config cannot declare credential-bearing names"
1830
+ });
1831
+ });
1832
+ }
1833
+ configRecordSchema(environmentNameSchema);
1834
+ z.object({
1835
+ kind: z.literal("github"),
1836
+ owner: z.string().regex(githubComponentPattern).refine((value) => value !== "." && value !== ".."),
1837
+ repo: z.string().regex(githubComponentPattern).refine((value) => value !== "." && value !== "..")
1838
+ }).strict();
1501
1839
  const CODEX_SYSTEM_PROMPT_FILE = ".codex/system-prompt.md";
1502
1840
  const OPENCODE_APPEND_SYSTEM_PROMPT_FILE = ".opencode/agent-system-prompt.md";
1503
1841
  const OPENCODE_CONFIG_FILE = "opencode.json";
@@ -4245,9 +4583,9 @@ const runningStatusSchema = AgentInteractiveSessionStatusSchema.options[0];
4245
4583
  const exitedStatusSchema = AgentInteractiveSessionStatusSchema.options[1];
4246
4584
  /** Start result for one exact interactive process. */
4247
4585
  const interactiveSessionStartDataSchema = z.discriminatedUnion("state", [runningStatusSchema.extend({
4248
- control: AgentInteractiveSessionControlClaimSchema$1,
4586
+ control: AgentInteractiveSessionControlClaimSchema,
4249
4587
  streamUrl: z.string().min(1)
4250
- }).strict(), exitedStatusSchema.extend({ control: AgentInteractiveSessionControlClaimSchema$1 }).strict()]);
4588
+ }).strict(), exitedStatusSchema.extend({ control: AgentInteractiveSessionControlClaimSchema }).strict()]);
4251
4589
  const interactiveSessionStartResponseSchema = z.object({
4252
4590
  success: z.literal(true),
4253
4591
  data: interactiveSessionStartDataSchema
@@ -4261,11 +4599,11 @@ z.object({
4261
4599
  }).strict();
4262
4600
  const interactiveSessionPromptResponseSchema = z.object({
4263
4601
  success: z.literal(true),
4264
- data: AgentInteractiveSessionPromptAcknowledgementSchema$1
4602
+ data: AgentInteractiveSessionPromptAcknowledgementSchema
4265
4603
  }).strict();
4266
4604
  const interactiveSessionStopResponseSchema = z.object({
4267
4605
  success: z.literal(true),
4268
- data: AgentInteractiveSessionStopAcknowledgementSchema$1
4606
+ data: AgentInteractiveSessionStopAcknowledgementSchema
4269
4607
  }).strict();
4270
4608
  z.object({ ref: AgentInteractiveSessionRefSchema$1 }).strict();
4271
4609
  z.object({ incarnationId: AgentInteractiveSessionRefSchema$1.shape.incarnationId }).strict();
@@ -4710,7 +5048,7 @@ var InteractiveSessionHandle = class {
4710
5048
  if (exactStart.run.sessionId !== this.sessionId) throw new Error(`Interactive session ${this.sessionId} start is bound to session ${exactStart.run.sessionId}`);
4711
5049
  return (requestOptions === void 0 ? this.host._startInteractive(this.sessionId, exactStart) : this.host._startInteractive(this.sessionId, exactStart, requestOptions)).then((info) => {
4712
5050
  const ref = AgentInteractiveSessionRefSchema.parse(info.ref);
4713
- const control = AgentInteractiveSessionControlClaimSchema.parse(info.control);
5051
+ const control = AgentInteractiveSessionControlClaimSchema$1.parse(info.control);
4714
5052
  if (!agentInteractiveSessionRefMatchesStart(exactStart, ref) || !agentInteractiveSessionControlClaimMatchesRef(ref, control)) throw new Error(`Interactive session ${this.sessionId} start returned an inexact ref or control claim`);
4715
5053
  const exactInfo = {
4716
5054
  ...info,
@@ -4726,7 +5064,7 @@ var InteractiveSessionHandle = class {
4726
5064
  requireBinding() {
4727
5065
  const ref = this.requireRef();
4728
5066
  if (!this.control) throw new Error(`Interactive session ${this.sessionId} handle is not bound to an exact ref and control claim`);
4729
- const control = AgentInteractiveSessionControlClaimSchema.parse(this.control);
5067
+ const control = AgentInteractiveSessionControlClaimSchema$1.parse(this.control);
4730
5068
  if (!agentInteractiveSessionControlClaimMatchesRef(ref, control)) throw new Error(`Interactive session ${this.sessionId} handle is not bound to a control claim for its exact ref`);
4731
5069
  return {
4732
5070
  ref,
@@ -4743,9 +5081,9 @@ var InteractiveSessionHandle = class {
4743
5081
  options?.signal?.throwIfAborted();
4744
5082
  const binding = this.requireBinding();
4745
5083
  const exactCommand = AgentInteractiveSessionPromptCommandSchema.parse(command);
4746
- if (canonicalCandidateDigest(exactCommand.ref) !== canonicalCandidateDigest(binding.ref) || canonicalCandidateDigest(exactCommand.control) !== canonicalCandidateDigest(binding.control)) throw new Error(`Interactive session ${this.sessionId} prompt is bound to a different exact ref`);
5084
+ if (canonicalCandidateDigest$2(exactCommand.ref) !== canonicalCandidateDigest$2(binding.ref) || canonicalCandidateDigest$2(exactCommand.control) !== canonicalCandidateDigest$2(binding.control)) throw new Error(`Interactive session ${this.sessionId} prompt is bound to a different exact ref`);
4747
5085
  return (options === void 0 ? this.host._sendInteractivePrompt(this.sessionId, exactCommand) : this.host._sendInteractivePrompt(this.sessionId, exactCommand, options)).then((acknowledgement) => {
4748
- const exactAcknowledgement = AgentInteractiveSessionPromptAcknowledgementSchema.parse(acknowledgement);
5086
+ const exactAcknowledgement = AgentInteractiveSessionPromptAcknowledgementSchema$1.parse(acknowledgement);
4749
5087
  if (!agentInteractiveSessionPromptAcknowledgementMatchesCommand(exactCommand, exactAcknowledgement)) throw new Error(`Interactive session ${this.sessionId} prompt acknowledgement does not match the command`);
4750
5088
  return exactAcknowledgement;
4751
5089
  });
@@ -4754,7 +5092,7 @@ var InteractiveSessionHandle = class {
4754
5092
  validateControl(control, options) {
4755
5093
  options?.signal?.throwIfAborted();
4756
5094
  const ref = this.requireRef();
4757
- const exactControl = AgentInteractiveSessionControlClaimSchema.parse(control);
5095
+ const exactControl = AgentInteractiveSessionControlClaimSchema$1.parse(control);
4758
5096
  if (!agentInteractiveSessionControlClaimMatchesRef(ref, exactControl)) throw new Error(`Interactive session ${this.sessionId} control claim is bound to a different exact ref`);
4759
5097
  return options === void 0 ? this.host._validateInteractiveControl(this.sessionId, ref, exactControl) : this.host._validateInteractiveControl(this.sessionId, ref, exactControl, options);
4760
5098
  }
@@ -4810,8 +5148,8 @@ var InteractiveSessionHandle = class {
4810
5148
  options?.signal?.throwIfAborted();
4811
5149
  const binding = this.requireBinding();
4812
5150
  const exactRequest = AgentInteractiveSessionAttachSchema.parse(request);
4813
- if (!agentInteractiveSessionControlClaimMatchesRef(binding.ref, exactRequest.control) || canonicalCandidateDigest(exactRequest.control) !== canonicalCandidateDigest(binding.control)) throw new Error(`Interactive session ${this.sessionId} terminal attach is bound to a different active control claim`);
4814
- const requestDigest = canonicalCandidateDigest(exactRequest);
5151
+ if (!agentInteractiveSessionControlClaimMatchesRef(binding.ref, exactRequest.control) || canonicalCandidateDigest$2(exactRequest.control) !== canonicalCandidateDigest$2(binding.control)) throw new Error(`Interactive session ${this.sessionId} terminal attach is bound to a different active control claim`);
5152
+ const requestDigest = canonicalCandidateDigest$2(exactRequest);
4815
5153
  if (this.agentTerminalAttachInFlight !== void 0) {
4816
5154
  if (this.agentTerminalAttachDigest !== requestDigest) throw new Error(`Interactive session ${this.sessionId} cannot attach with a different terminal request while another attach is in flight`);
4817
5155
  return awaitWithAbort(this.agentTerminalAttachInFlight, options?.signal);
@@ -4864,12 +5202,12 @@ var InteractiveSessionHandle = class {
4864
5202
  options?.signal?.throwIfAborted();
4865
5203
  const ref = this.requireRef();
4866
5204
  const exactRequest = AgentInteractiveSessionControlClaimRequestSchema.parse(request);
4867
- if (canonicalCandidateDigest(exactRequest.ref) !== canonicalCandidateDigest(ref)) throw new Error(`Interactive session ${this.sessionId} control claim is bound to a different exact ref`);
5205
+ if (canonicalCandidateDigest$2(exactRequest.ref) !== canonicalCandidateDigest$2(ref)) throw new Error(`Interactive session ${this.sessionId} control claim is bound to a different exact ref`);
4868
5206
  return this.host._claimInteractiveControl(this.sessionId, exactRequest, options).then((acknowledgement) => {
4869
5207
  const exactAcknowledgement = AgentInteractiveSessionControlClaimAcknowledgementSchema.parse(acknowledgement);
4870
5208
  if (!agentInteractiveSessionControlClaimAcknowledgementMatchesRequest(exactRequest, exactAcknowledgement)) throw new Error(`Interactive session ${this.sessionId} control claim acknowledgement does not match the request`);
4871
5209
  if ((exactAcknowledgement.status === "accepted" || exactAcknowledgement.status === "replayed") && exactAcknowledgement.control) {
4872
- const current = this.control ? AgentInteractiveSessionControlClaimSchema.parse(this.control) : void 0;
5210
+ const current = this.control ? AgentInteractiveSessionControlClaimSchema$1.parse(this.control) : void 0;
4873
5211
  if (current === void 0 || agentInteractiveSessionControlClaimIsNewer(exactAcknowledgement.control, current)) this.control = exactAcknowledgement.control;
4874
5212
  }
4875
5213
  return exactAcknowledgement;
@@ -4879,9 +5217,9 @@ var InteractiveSessionHandle = class {
4879
5217
  options?.signal?.throwIfAborted();
4880
5218
  const binding = this.requireBinding();
4881
5219
  const exactCommand = AgentInteractiveSessionStopCommandSchema.parse(command);
4882
- if (canonicalCandidateDigest(exactCommand.ref) !== canonicalCandidateDigest(binding.ref) || canonicalCandidateDigest(exactCommand.control) !== canonicalCandidateDigest(binding.control)) throw new Error(`Interactive session ${this.sessionId} stop is bound to a different exact ref`);
5220
+ if (canonicalCandidateDigest$2(exactCommand.ref) !== canonicalCandidateDigest$2(binding.ref) || canonicalCandidateDigest$2(exactCommand.control) !== canonicalCandidateDigest$2(binding.control)) throw new Error(`Interactive session ${this.sessionId} stop is bound to a different exact ref`);
4883
5221
  return (options === void 0 ? this.host._stopInteractive(this.sessionId, exactCommand) : this.host._stopInteractive(this.sessionId, exactCommand, options)).then((acknowledgement) => {
4884
- const exactAcknowledgement = AgentInteractiveSessionStopAcknowledgementSchema.parse(acknowledgement);
5222
+ const exactAcknowledgement = AgentInteractiveSessionStopAcknowledgementSchema$1.parse(acknowledgement);
4885
5223
  if (!agentInteractiveSessionStopAcknowledgementMatchesCommand(exactCommand, exactAcknowledgement)) throw new Error(`Interactive session ${this.sessionId} stop acknowledgement does not match the command`);
4886
5224
  return exactAcknowledgement;
4887
5225
  });
@@ -4890,8 +5228,8 @@ var InteractiveSessionHandle = class {
4890
5228
  options?.signal?.throwIfAborted();
4891
5229
  const ref = this.requireRef();
4892
5230
  return (options === void 0 ? this.host._stopInteractiveLifecycle(this.sessionId, ref) : this.host._stopInteractiveLifecycle(this.sessionId, ref, options)).then((acknowledgement) => {
4893
- const exactAcknowledgement = AgentInteractiveSessionStopAcknowledgementSchema.parse(acknowledgement);
4894
- if (canonicalCandidateDigest(exactAcknowledgement.ref) !== canonicalCandidateDigest(ref)) throw new Error(`Interactive session ${this.sessionId} lifecycle stop acknowledgement does not match the exact ref`);
5231
+ const exactAcknowledgement = AgentInteractiveSessionStopAcknowledgementSchema$1.parse(acknowledgement);
5232
+ if (canonicalCandidateDigest$2(exactAcknowledgement.ref) !== canonicalCandidateDigest$2(ref)) throw new Error(`Interactive session ${this.sessionId} lifecycle stop acknowledgement does not match the exact ref`);
4895
5233
  if (exactAcknowledgement.status !== "accepted" && exactAcknowledgement.status !== "replayed") throw new Error(`Interactive session ${this.sessionId} lifecycle stop was not confirmed (${exactAcknowledgement.status})`);
4896
5234
  if (exactAcknowledgement.effect === "unknown") throw new Error(`Interactive session ${this.sessionId} lifecycle stop returned an unknown outcome`);
4897
5235
  return exactAcknowledgement;
@@ -6137,7 +6475,7 @@ const interactionResolutionDeliveryStateSchema = z.enum([
6137
6475
  const interactionResolutionAcknowledgementSchema = z.strictObject({
6138
6476
  status: z.enum(["accepted", "already_resolved_same"]),
6139
6477
  operationId: z.string().min(1),
6140
- responseDigest: sha256DigestSchema,
6478
+ responseDigest: sha256DigestSchema$1,
6141
6479
  interactionId: z.string().min(1),
6142
6480
  sessionId: z.string().min(1),
6143
6481
  outcome: z.enum([
@@ -6165,7 +6503,7 @@ const InteractionConflictEnvelopeSchema = z.object({
6165
6503
  code: z.string().min(1),
6166
6504
  message: z.string().min(1),
6167
6505
  status: REFUSED_INTERACTION_STATUS,
6168
- existingResponseDigest: sha256DigestSchema.optional(),
6506
+ existingResponseDigest: sha256DigestSchema$2.optional(),
6169
6507
  existingOperationId: z.string().min(1).optional(),
6170
6508
  resolvedAt: z.string().min(1).optional()
6171
6509
  })
@@ -6193,7 +6531,7 @@ function bindingsEqual(left, right) {
6193
6531
  return left.requestDigest === right.requestDigest && left.runId === right.runId && left.provider === right.provider && left.environmentId === right.environmentId && left.sessionId === right.sessionId && left.executionId === right.executionId && left.interactionId === right.interactionId;
6194
6532
  }
6195
6533
  function assertResolutionMatches(resolution, sessionId, submitted, response, endpoint) {
6196
- const expectedDigest = canonicalCandidateDigest(submitted);
6534
+ const expectedDigest = canonicalCandidateDigest$2(submitted);
6197
6535
  if (resolution.sessionId !== sessionId || resolution.interactionId !== submitted.id || resolution.outcome !== submitted.outcome || resolution.responseDigest !== expectedDigest) throw invalidRuntimeResponse("Sidecar returned a resolution for another interaction response", response, endpoint);
6198
6536
  }
6199
6537
  /** Parse one interaction response without discarding replay information. */
@@ -7245,7 +7583,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
7245
7583
  origin: "runtime",
7246
7584
  endpoint: `/agents/sessions/${encodeURIComponent(id)}/interactive`
7247
7585
  });
7248
- if (canonicalCandidateDigest(status.ref) !== canonicalCandidateDigest(exactCommand.ref)) throw new ValidationError("Interactive prompt ref or control does not match the session");
7586
+ if (canonicalCandidateDigest$2(status.ref) !== canonicalCandidateDigest$2(exactCommand.ref)) throw new ValidationError("Interactive prompt ref or control does not match the session");
7249
7587
  const endpoint = `/agents/sessions/${encodeURIComponent(id)}/interactive/prompt`;
7250
7588
  const response = await this.runtimeFetch(endpoint, {
7251
7589
  method: "POST",
@@ -7294,7 +7632,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
7294
7632
  async _releaseInteractiveControl(id, ref, control, options) {
7295
7633
  options?.signal?.throwIfAborted();
7296
7634
  const exactRef = AgentInteractiveSessionRefSchema.parse(ref);
7297
- const exactControl = AgentInteractiveSessionControlClaimSchema.parse(control);
7635
+ const exactControl = AgentInteractiveSessionControlClaimSchema$1.parse(control);
7298
7636
  if (exactRef.run.sessionId !== id) throw new ValidationError("Interactive control release does not belong to the session");
7299
7637
  assertInteractiveRefBelongsToSandbox(exactRef, state(this).interactiveEnvironmentId);
7300
7638
  if (!agentInteractiveSessionControlClaimMatchesRef(exactRef, exactControl)) throw new ValidationError("Interactive control release does not match the session ref");
@@ -7316,7 +7654,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
7316
7654
  async _validateInteractiveControl(id, ref, control, options) {
7317
7655
  options?.signal?.throwIfAborted();
7318
7656
  const exactRef = AgentInteractiveSessionRefSchema.parse(ref);
7319
- const exactControl = AgentInteractiveSessionControlClaimSchema.parse(control);
7657
+ const exactControl = AgentInteractiveSessionControlClaimSchema$1.parse(control);
7320
7658
  if (exactRef.run.sessionId !== id) throw new ValidationError("Interactive control validation does not belong to the session");
7321
7659
  assertInteractiveRefBelongsToSandbox(exactRef, state(this).interactiveEnvironmentId);
7322
7660
  if (!agentInteractiveSessionControlClaimMatchesRef(exactRef, exactControl)) throw new ValidationError("Interactive control validation does not match the session ref");
@@ -7419,7 +7757,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
7419
7757
  origin: "runtime"
7420
7758
  });
7421
7759
  const acknowledgement = parsed.data.data;
7422
- if (canonicalCandidateDigest(acknowledgement.ref) !== canonicalCandidateDigest(exactRef)) throw new ServerError("Interactive lifecycle stop acknowledgement does not match the exact ref", 502, {
7760
+ if (canonicalCandidateDigest$2(acknowledgement.ref) !== canonicalCandidateDigest$2(exactRef)) throw new ServerError("Interactive lifecycle stop acknowledgement does not match the exact ref", 502, {
7423
7761
  endpoint,
7424
7762
  origin: "runtime"
7425
7763
  });
@@ -7431,7 +7769,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
7431
7769
  var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabilities {
7432
7770
  /** @internal — invoked before the sandbox is deleted. */
7433
7771
  async _sessionExportRawEvidence(id, destination, options) {
7434
- const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-D60Yg1-5.js");
7772
+ const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-CqarcYcp.js");
7435
7773
  await this.ensureRunning();
7436
7774
  await this.refresh();
7437
7775
  return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence/archive?${new URLSearchParams([
@@ -7462,7 +7800,7 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
7462
7800
  * and the byte and file bounds are verified before the directory appears.
7463
7801
  */
7464
7802
  async exportRawEvidence(destination, options) {
7465
- const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-D60Yg1-5.js");
7803
+ const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-CqarcYcp.js");
7466
7804
  await this.ensureRunning();
7467
7805
  await this.refresh();
7468
7806
  return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/raw-evidence/archive?${new URLSearchParams({
@@ -9775,7 +10113,7 @@ var SandboxFilesystemOperations = class {
9775
10113
  totalBytes: size,
9776
10114
  percentage: 0
9777
10115
  });
9778
- const { uploadChunkedFromFile } = await import("./chunked-upload-file-CLwAeLrM.js");
10116
+ const { uploadChunkedFromFile } = await import("./chunked-upload-file-Dtm1GBkE.js");
9779
10117
  await uploadChunkedFromFile({ fetch: (path, init) => this.host.runtimeFetch(path, init) }, remotePath, localPath, {
9780
10118
  mode: options?.permissions,
9781
10119
  onProgress: options?.onProgress ? (progress) => {
@@ -10148,7 +10486,7 @@ var SandboxInteractiveTerminalOperations = class {
10148
10486
  origin: "runtime",
10149
10487
  endpoint: `/agents/sessions/${encodeURIComponent(id)}/interactive`
10150
10488
  }, "INTERACTIVE_SESSION_EXITED");
10151
- if (canonicalCandidateDigest(status.ref) !== canonicalCandidateDigest(exactRef)) throw new ValidationError("Interactive attach ref does not match the current session");
10489
+ if (canonicalCandidateDigest$2(status.ref) !== canonicalCandidateDigest$2(exactRef)) throw new ValidationError("Interactive attach ref does not match the current session");
10152
10490
  const stream = await this.connectStream(id, `/terminals/${encodeURIComponent(id)}/ws`, {
10153
10491
  connectionId: id,
10154
10492
  cols: exactRequest.cols,
@@ -10612,4 +10950,4 @@ var SandboxInstance = class SandboxInstance extends SandboxEgressCapabilities {
10612
10950
  }
10613
10951
  };
10614
10952
  //#endregion
10615
- export { normalizeSandboxCreateReceipt as A, SandboxOperationFailedError as C, validateDeferredProfileFileMounts as D, splitInlineProfileSkills as E, normalizeSandboxShape as F, parseStopPhase as M, normalizeConnection as N, isRetryableProfileFileMaterializeFailure as O, normalizeEgressPolicyFields as P, SandboxOperation as S, splitInlineProfileFileMounts as T, collectAgentFinalMessageText as _, buildTraceExportPayload as a, isToolBearingEvent as b, toOtelJson as c, InteractiveSessionHandle as d, agentInteractiveSessionPromptRequestDigest as f, applySandboxEventText as g, createInteractiveTerminalSession as h, MAX_EGRESS_DENIALS_LIMIT as i, normalizeStartupDiagnostics as j, normalizeCaptureProof as k, SandboxTaskSession as l, createInteractiveTerminalCapture as m, createSandboxInstanceFromResponse as n, exportTraceBundle as o, InteractiveTerminalFrameLog as p, WorkspaceImages as r, otelTraceIdForTangleTrace as s, SandboxInstance as t, SandboxSession as u, collectAgentResponseText as v, materializeProfileFileMounts as w, ManagedProcessClient as x, getSandboxEventText as y };
10953
+ export { normalizeStartupDiagnostics as A, materializeProfileFileMounts as C, isRetryableProfileFileMaterializeFailure as D, validateDeferredProfileFileMounts as E, canonicalAgentProfileDigest as F, normalizeConnection as M, normalizeEgressPolicyFields as N, normalizeCaptureProof as O, normalizeSandboxShape as P, SandboxOperationFailedError as S, splitInlineProfileSkills as T, collectAgentResponseText as _, buildTraceExportPayload as a, ManagedProcessClient as b, toOtelJson as c, InteractiveSessionHandle as d, InteractiveTerminalFrameLog as f, collectAgentFinalMessageText as g, applySandboxEventText as h, MAX_EGRESS_DENIALS_LIMIT as i, parseStopPhase as j, normalizeSandboxCreateReceipt as k, SandboxTaskSession as l, createInteractiveTerminalSession as m, createSandboxInstanceFromResponse as n, exportTraceBundle as o, createInteractiveTerminalCapture as p, WorkspaceImages as r, otelTraceIdForTangleTrace as s, SandboxInstance as t, SandboxSession as u, getSandboxEventText as v, splitInlineProfileFileMounts as w, SandboxOperation as x, isToolBearingEvent as y };