@tangle-network/sandbox 1.0.237 → 1.0.238

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 (63) hide show
  1. package/dist/agent/index.d.ts +4 -4
  2. package/dist/agent/index.js +4 -4
  3. package/dist/agent/preview.d.ts +1 -1
  4. package/dist/agent/preview.js +2 -2
  5. package/dist/{agent-execution-preparation-BJChICex.js → agent-execution-preparation-CjKTjmJ9.js} +3 -3
  6. package/dist/{agent-execution-preparation-receipt-BIFxqyr5.js → agent-execution-preparation-receipt-AihkqLnd.js} +4 -4
  7. package/dist/{agent-run-outcome-DkEeNhH6.d.ts → agent-run-outcome-DrhA0Z4S.d.ts} +2 -2
  8. package/dist/{api-request-Cm1H_xsv.js → api-request-wjUrfDvm.js} +1 -1
  9. package/dist/auth/index.d.ts +2 -2
  10. package/dist/auth/index.js +2 -2
  11. package/dist/{browser-interactive-control-controller-JSGfFeNB.d.ts → browser-interactive-control-controller-9RauUsHw.d.ts} +1 -1
  12. package/dist/{browser-interactive-control-controller-CrBx8ETe.js → browser-interactive-control-controller-BDVXcCnz.js} +14 -14
  13. package/dist/cli-auth-bundle-BinY89CX.js +2 -0
  14. package/dist/{cli-auth-bundle-C6DtK7GX-mBUPER0R.js → cli-auth-bundle-C6DtK7GX-DoqlFTT-.js} +1 -1
  15. package/dist/{client-Cy6Zlb3W.d.ts → client-DsXWyLrM.d.ts} +79 -114
  16. package/dist/{client-Crwo3vqo.js → client-eoEoMzDD.js} +18 -115
  17. package/dist/collaboration/index.d.ts +1 -1
  18. package/dist/collaboration/index.js +1 -1
  19. package/dist/{collaboration-k3yUVGgP.js → collaboration-jvzPekSe.js} +1 -1
  20. package/dist/core.d.ts +6 -6
  21. package/dist/core.js +3 -3
  22. package/dist/{file-download-DXgIe-CV.js → file-download-CihyMYH-.js} +1 -1
  23. package/dist/{harness-DMaNgn0S.js → harness-C5lXV9e5.js} +5 -5
  24. package/dist/{index-DYxmMGbU.d.ts → index-B_1aVs2B.d.ts} +7 -6
  25. package/dist/index.d.ts +12 -11
  26. package/dist/index.js +10 -10
  27. package/dist/intelligence/index.d.ts +13 -6
  28. package/dist/intelligence/index.js +60 -8
  29. package/dist/interactive-control.d.ts +1 -1
  30. package/dist/interactive-control.js +1 -1
  31. package/dist/{interactive-controller-DaBe9oR5.d.ts → interactive-controller-C2vOFe0u.d.ts} +3 -3
  32. package/dist/{interactive-controller-mqraKMkh.js → interactive-controller-CDqa41yU.js} +5 -5
  33. package/dist/{lines-DfKFyMTA.d.ts → lines-CxWFuuJ3.d.ts} +1 -1
  34. package/dist/lines.d.ts +1 -1
  35. package/dist/{local-cli-auth-CO0byocv.js → local-cli-auth-DrNihS9-.js} +1 -1
  36. package/dist/{mcp-local-DV-BvoUI.js → mcp-local-CbzPG05W.js} +2 -2
  37. package/dist/{preview-BqicYuSJ.d.ts → preview-DFFaAZdF.d.ts} +3 -3
  38. package/dist/{profile-schema-C1KpT-wS.js → profile-schema-C0n0VgmA.js} +468 -36
  39. package/dist/{public-templates-Bk843Kqc.d.ts → public-templates-xqtPv6pg.d.ts} +2 -2
  40. package/dist/public-templates.d.ts +1 -1
  41. package/dist/{raw-evidence-archive-XEDh0VUj.js → raw-evidence-archive-DLNEUdij.js} +3 -15
  42. package/dist/raw-evidence-export-C0ieFpi2.d.ts +354 -0
  43. package/dist/raw-evidence-export-C6Xdl3nC.js +19 -0
  44. package/dist/runtime.d.ts +5 -5
  45. package/dist/runtime.js +3 -3
  46. package/dist/{sandbox-DnuEGRn4.js → sandbox-nYoBbiu1.js} +79 -72
  47. package/dist/{select-seat-CntQ4bko.js → select-seat-BHHUFoKh.js} +4 -4
  48. package/dist/select-seat-command.d.ts +2 -2
  49. package/dist/select-seat-command.js +1 -1
  50. package/dist/session-gateway/index.js +1 -1
  51. package/dist/tangle/index.d.ts +1 -1
  52. package/dist/tangle/index.js +1 -1
  53. package/dist/{tangle-DjcPKCqo.js → tangle-BaGQdAZk.js} +2 -2
  54. package/dist/{terminal-stream-types-DBQuAsmB.d.ts → terminal-stream-types-D7dMd-NV.d.ts} +28 -20
  55. package/dist/{types-C8aazs-y.d.ts → types-ImZuAuFG.d.ts} +3 -344
  56. package/package.json +7 -7
  57. package/dist/cli-auth-bundle-BLAtE6Dc.js +0 -2
  58. /package/dist/{chunked-upload-file-JfRw6PRf.js → chunked-upload-file-DtAW52iW.js} +0 -0
  59. /package/dist/{cli-auth-bundle-B91fSxkR.d.ts → cli-auth-bundle-eUl7Sa1x.d.ts} +0 -0
  60. /package/dist/{direct-http2-Bgb2lHte.js → direct-http2-zLxsvF44.js} +0 -0
  61. /package/dist/{index-o31uwAkX.d.ts → index-BTXyTVq4.d.ts} +0 -0
  62. /package/dist/{index-C-_HY5NY.d.ts → index-ClusTWYM.d.ts} +0 -0
  63. /package/dist/{sha2-vu4U-x2L.js → sha2-BIoWepwn.js} +0 -0
@@ -1,6 +1,52 @@
1
1
  import { D as TimeoutError, _ as NetworkError, r as parseErrorResponse, u as CapabilityError } from "../errors-DQEu-Q7s.js";
2
- import { i as fetchSandboxApi } from "../api-request-Cm1H_xsv.js";
3
- import { n as verifyDownload } from "../file-download-DXgIe-CV.js";
2
+ import { i as fetchSandboxApi } from "../api-request-wjUrfDvm.js";
3
+ import { n as verifyDownload } from "../file-download-CihyMYH-.js";
4
+ import { t as rawEvidenceArchiveAttemptSchema } from "../raw-evidence-export-C6Xdl3nC.js";
5
+ import { z } from "zod";
6
+ //#region src/intelligence/run-session-capture.ts
7
+ const captureSchema = z.discriminatedUnion("schema", [z.object({
8
+ schema: z.literal("tangle.run-session-capture.v1"),
9
+ sessionId: z.string().min(1),
10
+ attempts: z.array(rawEvidenceArchiveAttemptSchema)
11
+ }), z.object({
12
+ schema: z.literal("tangle.run-session-restored.v1"),
13
+ sessions: z.array(z.object({
14
+ sourceSessionId: z.string().min(1),
15
+ storedSessionId: z.string().min(1),
16
+ nativeAttempts: z.array(rawEvidenceArchiveAttemptSchema.pick({
17
+ executionId: true,
18
+ ordinal: true,
19
+ nativeSessionIds: true,
20
+ outcome: true,
21
+ missingReasons: true
22
+ }))
23
+ }))
24
+ })]);
25
+ /** Latest recorded attempt per execution in one verified capture.json source. */
26
+ function parseRunSessionCapture(record, storedSessionId) {
27
+ const capture = captureSchema.parse(record);
28
+ const selected = (capture.schema === "tangle.run-session-capture.v1" ? [{
29
+ sourceSessionId: capture.sessionId,
30
+ storedSessionId: capture.sessionId,
31
+ nativeAttempts: capture.attempts
32
+ }] : capture.sessions).filter((session) => session.storedSessionId === storedSessionId);
33
+ const source = selected[0];
34
+ if (!source || selected.length !== 1) throw new Error("Capture has no unambiguous stored session identity");
35
+ const latest = /* @__PURE__ */ new Map();
36
+ const seen = /* @__PURE__ */ new Map();
37
+ for (const attempt of source.nativeAttempts) {
38
+ const ordinals = seen.get(attempt.executionId) ?? /* @__PURE__ */ new Set();
39
+ if (ordinals.has(attempt.ordinal)) throw new Error("Capture repeats an execution attempt");
40
+ ordinals.add(attempt.ordinal);
41
+ seen.set(attempt.executionId, ordinals);
42
+ if (attempt.ordinal > (latest.get(attempt.executionId)?.ordinal ?? 0)) latest.set(attempt.executionId, attempt);
43
+ }
44
+ return [...latest.values()].map((attempt) => ({
45
+ ...attempt,
46
+ sourceSessionId: source.sourceSessionId
47
+ }));
48
+ }
49
+ //#endregion
4
50
  //#region src/intelligence/index.ts
5
51
  /** Browser-safe tenant trace and run-session reads from Tangle Intelligence.
6
52
  * Its base URL is independent of the Sandbox API. Customer keys scope reads;
@@ -139,7 +185,7 @@ function createIntelligenceClient(config) {
139
185
  appendParam(search, "sandboxId", params.sandboxId);
140
186
  appendParam(search, "executionId", params.executionId);
141
187
  const suffix = search.size > 0 ? `?${search}` : "";
142
- return getJson(`/v1/run-sessions/${encodeURIComponent(runId)}${suffix}`);
188
+ return getJson(`/v1/run-sessions/${encodeURIComponent(runId)}${suffix}`, params.signal);
143
189
  }
144
190
  async function* iterateRunSessionFiles(runId, params = {}) {
145
191
  let cursor = params.cursor;
@@ -148,7 +194,11 @@ function createIntelligenceClient(config) {
148
194
  ...params,
149
195
  cursor
150
196
  });
151
- for (const file of page.files) yield file;
197
+ for (const file of page.files) {
198
+ config.signal?.throwIfAborted();
199
+ params.signal?.throwIfAborted();
200
+ yield file;
201
+ }
152
202
  if (!page.nextCursor) return;
153
203
  cursor = page.nextCursor;
154
204
  }
@@ -161,7 +211,9 @@ function createIntelligenceClient(config) {
161
211
  sessionId: file.sessionId,
162
212
  path: file.path
163
213
  });
164
- return request(`/v1/run-sessions/${encodeURIComponent(runId)}/content?${search}`, async (response) => {
214
+ const path = `/v1/run-sessions/${encodeURIComponent(runId)}/content?${search}`;
215
+ const signal = AbortSignal.any([config.signal, options?.signal].filter((value) => value !== void 0));
216
+ return request(path, async (response) => {
165
217
  try {
166
218
  const digest = response.headers.get("x-stored-sha256");
167
219
  if (!digest || !/^sha256:[a-f0-9]{64}$/.test(digest) || storedSha256 !== void 0 && storedSha256 !== digest || etag !== void 0 && etag !== response.headers.get("etag") || storedBytes === null) throw new Error("Run-session download does not match its selected revision");
@@ -169,14 +221,14 @@ function createIntelligenceClient(config) {
169
221
  const stream = verifyDownload(response, {
170
222
  expectedSha256: digest,
171
223
  expectedSize: storedBytes,
172
- signal: config.signal
224
+ signal
173
225
  });
174
226
  return options?.stream ? stream : new Uint8Array(await new Response(stream).arrayBuffer());
175
227
  } catch (error) {
176
228
  if (!response.body?.locked) await response.body?.cancel(error).catch(() => {});
177
229
  throw error;
178
230
  }
179
- });
231
+ }, signal);
180
232
  }
181
233
  async function listSessions(params = {}) {
182
234
  const search = new URLSearchParams();
@@ -250,4 +302,4 @@ function createIntelligenceClient(config) {
250
302
  };
251
303
  }
252
304
  //#endregion
253
- export { DEFAULT_INTELLIGENCE_BASE_URL, createIntelligenceClient };
305
+ export { DEFAULT_INTELLIGENCE_BASE_URL, createIntelligenceClient, parseRunSessionCapture };
@@ -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-JSGfFeNB.js";
1
+ import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, n as BrowserInteractiveSessionControlControllerOptions, r as browserInteractiveControlHolderId, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-9RauUsHw.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-CrBx8ETe.js";
1
+ import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-BDVXcCnz.js";
2
2
  export { BrowserInteractiveSessionControlController, InteractiveSessionNotRunningError, browserInteractiveControlHolderId };
@@ -1,6 +1,6 @@
1
- import { o as TerminalStreamReconnectAuthority, pt as AgentInteractiveSessionRef, u as ScopedToken } from "./terminal-stream-types-DBQuAsmB.js";
2
- import { Cn as TerminalStream } from "./types-C8aazs-y.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-JSGfFeNB.js";
1
+ import { ft as AgentInteractiveSessionRef, o as TerminalStreamReconnectAuthority, u as ScopedToken } from "./terminal-stream-types-D7dMd-NV.js";
2
+ import { Cn as TerminalStream } from "./types-ImZuAuFG.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-9RauUsHw.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,9 +1,9 @@
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-CrBx8ETe.js";
3
- import { r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
1
+ import { C as boundedIdentifierSchema, T as boundedJsonSchema, o as canonicalCandidateDigest } from "./harness-C5lXV9e5.js";
2
+ import { r as agentProfileSchema } from "./profile-schema-C0n0VgmA.js";
3
+ 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-BDVXcCnz.js";
4
4
  import { O as ValidationError, _ as NetworkError, i as parseResponseError, s as retryWhen, t as TerminalStreamError, u as CapabilityError, w as ServerError } from "./errors-DQEu-Q7s.js";
5
5
  import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-CRxC2dlT.js";
6
- import { n as SDK_TIMEOUTS } from "./api-request-Cm1H_xsv.js";
6
+ import { n as SDK_TIMEOUTS } from "./api-request-wjUrfDvm.js";
7
7
  import { c as awaitSdkResend, s as uploadChunked } from "./chunked-upload-B1kuuezC.js";
8
8
  import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
9
9
  import { z } from "zod";
@@ -76,7 +76,7 @@ function normalizeEffectiveBackend(value) {
76
76
  };
77
77
  }
78
78
  //#endregion
79
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/runtime-attachments.js
79
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.19/node_modules/@tangle-network/agent-interface/dist/runtime-attachments.js
80
80
  const AgentRuntimeAttachmentsSchema = boundedJsonSchema.pipe(z.strictObject({ mcp: agentProfileSchema.shape.mcp.unwrap().superRefine((servers, context) => {
81
81
  for (const alias of Object.keys(servers)) {
82
82
  const result = boundedIdentifierSchema.safeParse(alias);
@@ -1,4 +1,4 @@
1
- import { Tn as CreateSandboxOptions, ga as BackendConfig } from "./types-C8aazs-y.js";
1
+ import { Tn as CreateSandboxOptions, ga as BackendConfig } from "./types-ImZuAuFG.js";
2
2
 
3
3
  //#region src/line-application.d.ts
4
4
  /** Bounded callback request bytes after canonicalization, including JSON framing. */
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-DfKFyMTA.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-CxWFuuJ3.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 };
@@ -1,4 +1,4 @@
1
- import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-C6DtK7GX-mBUPER0R.js";
1
+ import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-C6DtK7GX-DoqlFTT-.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";
@@ -1,4 +1,4 @@
1
- import "./api-request-Cm1H_xsv.js";
1
+ import "./api-request-wjUrfDvm.js";
2
2
  import { u as SANDBOX_FILE_API_ABSOLUTE_ROOTS } from "./file-transfer-DOSTbUSR.js";
3
3
  import { a as listAgentPreviews, i as getAgentPreview, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "./preview-operations-DWL78boI.js";
4
4
  //#region \0rolldown/runtime.js
@@ -396,7 +396,7 @@ async function createMcpServer(box, options = {}) {
396
396
  const { bindings, handlers } = bindToolSpecs(box, options);
397
397
  const server = new serverModule.Server({
398
398
  name: options.name ?? "tangle-sandbox",
399
- version: options.version ?? "1.0.237"
399
+ version: options.version ?? "1.0.238"
400
400
  }, { capabilities: { tools: {} } });
401
401
  server.setRequestHandler(typesModule.ListToolsRequestSchema, async () => ({ tools: bindings.map(({ spec: s }) => ({
402
402
  name: s.name,
@@ -1,6 +1,6 @@
1
- import { O as SandboxInstance } from "./index-DYxmMGbU.js";
2
- import { F as EnsureDevServerOptions, H as PreviewLinkInfo } from "./types-C8aazs-y.js";
3
- import { t as Sandbox } from "./client-Cy6Zlb3W.js";
1
+ import { O as SandboxInstance } from "./index-B_1aVs2B.js";
2
+ import { F as EnsureDevServerOptions, H as PreviewLinkInfo } from "./types-ImZuAuFG.js";
3
+ import { t as Sandbox } from "./client-DsXWyLrM.js";
4
4
 
5
5
  //#region src/agent/preview-operations.d.ts
6
6
  type AgentPreviewOptions = Pick<EnsureDevServerOptions, "sessionId" | "cwd"> & {