@tangle-network/sandbox 1.0.83 → 1.0.85

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 (41) hide show
  1. package/dist/agent/index.d.ts +4 -4
  2. package/dist/agent/index.js +3 -3
  3. package/dist/agent/preview.d.ts +1 -1
  4. package/dist/agent/preview.js +1 -1
  5. package/dist/{agent-run-outcome-CnHGo3Uz.d.ts → agent-run-outcome-C-spjmpO.d.ts} +2 -2
  6. package/dist/auth/index.js +1 -1
  7. package/dist/{browser-interactive-control-controller-WLzM_Lyq.js → browser-interactive-control-controller-BvtNDWql.js} +15 -15
  8. package/dist/{browser-interactive-control-controller-BelQQ9nb.d.ts → browser-interactive-control-controller-CMdlolu0.d.ts} +1 -1
  9. package/dist/{chunked-upload-tul4qbe5.js → chunked-upload--QnrxdO9.js} +43 -17
  10. package/dist/{chunked-upload-file-D9NvCQis.js → chunked-upload-file-an8AfIJx.js} +1 -1
  11. package/dist/{cli-auth-bundle-DspL04sN.js → cli-auth-bundle-BoK5wpru.js} +1 -1
  12. package/dist/{client-B-2_Po8s.d.ts → client-C9MO8LIK.d.ts} +5 -5
  13. package/dist/{client-DJVMPIqA.js → client-DbQhnheE.js} +5 -5
  14. package/dist/{core-NptHnlS8.js → core-hC1zr8YQ.js} +3 -3
  15. package/dist/core.d.ts +6 -6
  16. package/dist/core.js +3 -3
  17. package/dist/{harness-D2TXEUu-.js → harness-BnGz2Wng.js} +5 -5
  18. package/dist/{index-DVKTxbNc.d.ts → index-sQwAEhFX.d.ts} +17 -35
  19. package/dist/index.d.ts +9 -9
  20. package/dist/index.js +7 -7
  21. package/dist/interactive-control.d.ts +1 -1
  22. package/dist/interactive-control.js +1 -1
  23. package/dist/{interactive-controller-h5lObChU.d.ts → interactive-controller-Bm3diCYK.d.ts} +3 -3
  24. package/dist/{interactive-controller-BdGvy0jq.js → interactive-controller-CkiJBT6m.js} +31 -6
  25. package/dist/{lines-CgePkUiD.d.ts → lines-Dr8YagSZ.d.ts} +1 -1
  26. package/dist/lines.d.ts +1 -1
  27. package/dist/{local-cli-auth-xqJlVceZ.js → local-cli-auth-bw8Puox2.js} +1 -1
  28. package/dist/{preview-CU6CWrEU.d.ts → preview-Cp2U18Qf.d.ts} +3 -3
  29. package/dist/{profile-schema-D-XJLM1E.js → profile-schema-DFZTAn1S.js} +8 -8
  30. package/dist/{public-templates-CMXx_e0h.d.ts → public-templates-BtVRh-az.d.ts} +2 -2
  31. package/dist/public-templates.d.ts +1 -1
  32. package/dist/runtime.d.ts +5 -5
  33. package/dist/runtime.js +3 -3
  34. package/dist/{sandbox-DTuiPoNU.js → sandbox-CzRLjpZn.js} +806 -335
  35. package/dist/select-seat-command.d.ts +1 -1
  36. package/dist/tangle/index.d.ts +1 -1
  37. package/dist/tangle/index.js +1 -1
  38. package/dist/{tangle-h3zo20pc.js → tangle-CA-ADYF3.js} +32 -32
  39. package/dist/{terminal-stream-types-MjiApwNS.d.ts → terminal-stream-types-CqLXtP8e.d.ts} +14 -14
  40. package/dist/{types-DMGo9Vty.d.ts → types-B150etc6.d.ts} +71 -66
  41. package/package.json +4 -4
@@ -1,16 +1,16 @@
1
- import { A as requestedPublicProfileDigest, C as encodeTextForWire, D as assertCurrentBackendType, E as applyRequestedModel, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, O as mergeRuntimeBackendConfig, P as withoutRuntimeSecrets, S as encodePromptForWire, U as normalizeEffectiveBackend, _ as isTraceId, a as assertScopedTokenActive, b as resolveDispatchRunIdentity, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as TRACE_ID_HEADER, h as waitForRetryAfter, i as terminalUpgradeHeadersSupported, j as requestedSecretProfilePublicDigest, k as normalizeRuntimeBackendConfig, l as normalizeSessionInfo, m as isRetryableCredentialRefusal, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as mintTraceId, w as canUseNodeHttp2, x as validateAcceptedDispatchRunRef, y as resolveTraceId } from "./interactive-controller-BdGvy0jq.js";
2
- import { D as boundedStringSchema, _ as sha256, g as sha256DigestSchema$1, o as canonicalCandidateDigest$1, s as canonicalCandidateJson$1, u as isCanonicalJsonValue$1, w as boundedIdentifierSchema } from "./harness-D2TXEUu-.js";
3
- import { A as agentInteractiveSessionStatusMatchesRef, B as PlanContinuationSchema, C as AgentInteractiveSessionStopAcknowledgementSchema, D as agentInteractiveSessionControlClaimMatchesRef, E as agentInteractiveSessionControlClaimIsNewer, F as AgentRunCancellationAcknowledgementSchema, G as InteractionResponseSchema, H as InteractionBindingSchema, I as AgentRunCancellationRequestSchema, L as agentRunCancellationAcknowledgementMatchesRequest, M as agentInteractiveDimensionSchema, N as sameAgentExactRun, O as agentInteractiveSessionPromptAcknowledgementMatchesCommand, P as AgentExactRunControlRefSchema, S as AgentInteractiveSessionStatusSchema, T as agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, U as InteractionRequestSchema, V as InteractionAcknowledgementSchema, W as InteractionResponseCommandSchema, _ as AgentInteractiveSessionControlClaimRequestSchema, b as AgentInteractiveSessionPromptCommandSchema, d as interactiveSessionControlClaimResponseSchema, f as interactiveSessionControlReleaseResponseSchema, g as AgentInteractiveSessionControlClaimAcknowledgementSchema, h as AgentInteractiveSessionAttachSchema, j as agentInteractiveSessionStopAcknowledgementMatchesCommand, l as createInteractiveControlHolderId, m as interactiveSessionStatusResponseSchema, p as interactiveSessionControlValidationResponseSchema, v as AgentInteractiveSessionControlClaimSchema, w as AgentInteractiveSessionStopCommandSchema, x as AgentInteractiveSessionRefSchema, y as AgentInteractiveSessionPromptAcknowledgementSchema } from "./browser-interactive-control-controller-WLzM_Lyq.js";
4
- import { a as canonicalAgentProfileValue, r as agentProfileSchema } from "./profile-schema-D-XJLM1E.js";
1
+ import { A as normalizeRuntimeBackendConfig, C as encodeTextForWire, D as applyRequestedModel, F as withoutRuntimeSecrets, I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, M as requestedSecretProfilePublicDigest, O as assertCurrentBackendType, S as encodePromptForWire, T as canUseNodeHttp2, W as normalizeEffectiveBackend, _ as isTraceId, a as assertScopedTokenActive, b as resolveDispatchRunIdentity, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as TRACE_ID_HEADER, h as waitForRetryAfter, i as terminalUpgradeHeadersSupported, j as requestedPublicProfileDigest, k as mergeRuntimeBackendConfig, l as normalizeSessionInfo, m as isRetryableCredentialRefusal, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as mintTraceId, w as runtimeFilesystemPath, x as validateAcceptedDispatchRunRef, y as resolveTraceId } from "./interactive-controller-CkiJBT6m.js";
2
+ import { C as boundedIdentifierSchema, E as boundedStringSchema, g as sha256DigestSchema, o as canonicalCandidateDigest, s as canonicalCandidateJson, u as isCanonicalJsonValue } from "./harness-BnGz2Wng.js";
3
+ import { A as agentInteractiveSessionStatusMatchesRef, B as PlanContinuationSchema, C as AgentInteractiveSessionStopAcknowledgementSchema, D as agentInteractiveSessionControlClaimMatchesRef, E as agentInteractiveSessionControlClaimIsNewer, F as AgentRunCancellationAcknowledgementSchema, G as InteractionResponseSchema, H as InteractionBindingSchema, I as AgentRunCancellationRequestSchema, L as agentRunCancellationAcknowledgementMatchesRequest, M as agentInteractiveDimensionSchema, N as sameAgentExactRun, O as agentInteractiveSessionPromptAcknowledgementMatchesCommand, P as AgentExactRunControlRefSchema, S as AgentInteractiveSessionStatusSchema, T as agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, U as InteractionRequestSchema, V as InteractionAcknowledgementSchema, W as InteractionResponseCommandSchema, _ as AgentInteractiveSessionControlClaimRequestSchema, b as AgentInteractiveSessionPromptCommandSchema, d as interactiveSessionControlClaimResponseSchema, f as interactiveSessionControlReleaseResponseSchema, g as AgentInteractiveSessionControlClaimAcknowledgementSchema, h as AgentInteractiveSessionAttachSchema, j as agentInteractiveSessionStopAcknowledgementMatchesCommand, l as createInteractiveControlHolderId, m as interactiveSessionStatusResponseSchema, p as interactiveSessionControlValidationResponseSchema, v as AgentInteractiveSessionControlClaimSchema, w as AgentInteractiveSessionStopCommandSchema, x as AgentInteractiveSessionRefSchema, y as AgentInteractiveSessionPromptAcknowledgementSchema } from "./browser-interactive-control-controller-BvtNDWql.js";
4
+ import { a as canonicalAgentProfileValue, r as agentProfileSchema } from "./profile-schema-DFZTAn1S.js";
5
5
  import { C as StateError, E as ValidationError, F as SANDBOX_FILE_API_ABSOLUTE_ROOTS, I as isProfileFileMountOutsideRoots, L as profileFileMountOutsideRootsMessage, N as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, P as SANDBOX_AGENT_HOME, S as ServerError, T as TimeoutError, a as AuthError, c as CompliancePlacementError, f as GpuProviderNotConfiguredError, g as NotFoundError, h as NetworkError, i as readResponseJson, j as SANDBOX_PROXY_REQUEST_MAX_BYTES, l as EdgeNotReadyError, m as NON_RETRYABLE_CREATE_QUOTA_REASONS, 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-BStusQVc.js";
6
6
  import { n as combineAbortSignals, r as delayUntilAborted, t as awaitWithAbort } from "./abort-signal-JVaAyNMP.js";
7
7
  import { t as rewrapResponse } from "./response-rewrap-B75N59JT.js";
8
8
  import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch--8twRp99.js";
9
9
  import { t as SIDECAR_PROXY_ERROR_HEADER } from "./sidecar-proxy-error-DORW8_mD.js";
10
10
  import { t as parseSSEStream } from "./sse-parser-BUIKfYAd.js";
11
- import { s as uploadChunked } from "./chunked-upload-tul4qbe5.js";
11
+ import { s as uploadChunked } from "./chunked-upload--QnrxdO9.js";
12
12
  import { t as runPreparedProcess } from "./prepared-process-GzQXVsX8.js";
13
- import { a as backendTypeSchema, r as cliAuthReferenceSchema } from "./cli-auth-bundle-DspL04sN.js";
13
+ import { a as backendTypeSchema, r as cliAuthReferenceSchema } from "./cli-auth-bundle-BoK5wpru.js";
14
14
  import { n as SandboxLines } from "./lines-D9XmRZMl.js";
15
15
  import { z } from "zod";
16
16
  import { createHash } from "node:crypto";
@@ -20,7 +20,7 @@ import "node:fs/promises";
20
20
  import { readTokenCostUsd, readTokenUsage } from "@tangle-network/agent-core";
21
21
  import "@tangle-network/agent-interface/environment-provider";
22
22
  import { OTLP_SPAN_KIND, OTLP_STATUS_CODE, msToUnixNano, otlpTraceExport, toOtlpAttributes, toW3CSpanId, toW3CTraceId } from "@tangle-network/agent-trace-contract/otlp";
23
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.4/node_modules/@tangle-network/agent-interface/dist/agent-execution-preparation.js
23
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/agent-execution-preparation.js
24
24
  /**
25
25
  * Canonical RFC 8785/SHA-256 identity for one validated, public AgentProfile.
26
26
  * Secret-capable MCP/hook fields are tagged. Other prompt, resource, metadata,
@@ -31,11 +31,11 @@ import { OTLP_SPAN_KIND, OTLP_STATUS_CODE, msToUnixNano, otlpTraceExport, toOtlp
31
31
  */
32
32
  function canonicalAgentProfileDigest(profile) {
33
33
  const material = canonicalAgentProfileValue(agentProfileSchema.parse(profile));
34
- if (material === void 0 || !isCanonicalJsonValue$1(material)) throw new Error("AgentProfile must contain finite, acyclic RFC 8785 JSON values");
35
- return canonicalCandidateDigest$1(material);
34
+ if (material === void 0 || !isCanonicalJsonValue(material)) throw new Error("AgentProfile must contain finite, acyclic RFC 8785 JSON values");
35
+ return canonicalCandidateDigest(material);
36
36
  }
37
37
  //#endregion
38
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.4/node_modules/@tangle-network/agent-interface/dist/environment-interactive-start.js
38
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/environment-interactive-start.js
39
39
  const AgentInteractiveSessionRunCoordinatesSchema = z.strictObject({
40
40
  provider: boundedIdentifierSchema,
41
41
  environmentId: boundedIdentifierSchema,
@@ -52,7 +52,7 @@ const AgentInteractiveSessionRunCoordinatesSchema = z.strictObject({
52
52
  const AgentInteractiveSessionStartSchema = z.strictObject({
53
53
  run: AgentExactRunControlRefSchema,
54
54
  profile: agentProfileSchema,
55
- requestedProfileDigest: sha256DigestSchema$1,
55
+ requestedProfileDigest: sha256DigestSchema,
56
56
  authMode: z.literal("oauth").optional(),
57
57
  initialPrompt: boundedStringSchema.optional(),
58
58
  cwd: boundedStringSchema.min(1).optional(),
@@ -63,7 +63,7 @@ const AgentInteractiveSessionStartSchema = z.strictObject({
63
63
  function agentInteractiveSessionRequestDigest(coordinates, input) {
64
64
  const exactCoordinates = AgentInteractiveSessionRunCoordinatesSchema.parse(coordinates);
65
65
  const exactInput = AgentInteractiveSessionStartSchema.omit({ run: true }).parse(input);
66
- return canonicalCandidateDigest$1({
66
+ return canonicalCandidateDigest({
67
67
  kind: "agent-interactive-session-start.v1",
68
68
  run: exactCoordinates,
69
69
  requestedProfileDigest: exactInput.requestedProfileDigest,
@@ -112,7 +112,7 @@ function runCoordinates(run) {
112
112
  };
113
113
  }
114
114
  //#endregion
115
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.4/node_modules/@tangle-network/agent-interface/dist/environment-terminal.js
115
+ //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/environment-terminal.js
116
116
  const terminalDimensionSchema = z.number().int().positive().max(1e4);
117
117
  /**
118
118
  * Provider-neutral handle for one interactive terminal.
@@ -488,7 +488,7 @@ const PROFILE_IMPORT_PART_BYTES = 512 * 1024;
488
488
  const MANAGED_PROFILE_TRANSPORT = "managed-profile-reference-v1";
489
489
  /** Cache identity follows JSON wire semantics and RFC 8785 key ordering. */
490
490
  function profileCacheSha256(profile) {
491
- return canonicalCandidateDigest$1(JSON.parse(JSON.stringify(profile))).slice(7);
491
+ return canonicalCandidateDigest(JSON.parse(JSON.stringify(profile))).slice(7);
492
492
  }
493
493
  //#endregion
494
494
  //#region ../../../packages/runtime-contracts/dist/direct-read.js
@@ -763,7 +763,7 @@ async function responseNeedsProfileImport(response) {
763
763
  }
764
764
  /** Upload the public profile only. Runtime grants remain in the turn backend. */
765
765
  async function primeManagedProfile(profile, fetchRuntime) {
766
- const bytes = new TextEncoder().encode(canonicalCandidateJson$1(profile));
766
+ const bytes = new TextEncoder().encode(canonicalCandidateJson(profile));
767
767
  const sha256 = profileCacheSha256(profile);
768
768
  if (bytes.length > 8388608) throw new ValidationError("Managed profile exceeds the profile import bound");
769
769
  const post = async (body) => {
@@ -1401,6 +1401,607 @@ const routes = Object.values({
1401
1401
  "codeExec": {
1402
1402
  "method": "POST",
1403
1403
  "path": "/code/exec",
1404
+ "pattern": "^/code/exec$",
1405
+ "auth": {
1406
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1407
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1408
+ "hostAgent": "ingress-and-scoped-token",
1409
+ "sidecar": "control-or-scoped-session-token"
1410
+ },
1411
+ "layers": [
1412
+ "worker",
1413
+ "orchestrator",
1414
+ "hostAgent",
1415
+ "sidecar",
1416
+ "typescript",
1417
+ "python"
1418
+ ],
1419
+ "auditAction": "sandbox.exec",
1420
+ "rateFamily": "process",
1421
+ "shortTokenRequired": true,
1422
+ "startsWork": true,
1423
+ "blocking": true,
1424
+ "execActivity": true
1425
+ },
1426
+ "processSpawn": {
1427
+ "method": "POST",
1428
+ "path": "/process/spawn",
1429
+ "pattern": "^/process/spawn$",
1430
+ "auth": {
1431
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1432
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1433
+ "hostAgent": "ingress-and-scoped-token",
1434
+ "sidecar": "control-or-scoped-session-token"
1435
+ },
1436
+ "layers": [
1437
+ "worker",
1438
+ "orchestrator",
1439
+ "hostAgent",
1440
+ "sidecar",
1441
+ "typescript",
1442
+ "python"
1443
+ ],
1444
+ "auditAction": "sandbox.exec",
1445
+ "rateFamily": "process",
1446
+ "shortTokenRequired": true,
1447
+ "startsWork": true,
1448
+ "blocking": "blocking",
1449
+ "execActivity": true
1450
+ },
1451
+ "ensureDevServer": {
1452
+ "method": "POST",
1453
+ "path": "/process/ensure-dev-server",
1454
+ "pattern": "^/process/ensure-dev-server$",
1455
+ "auth": {
1456
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1457
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1458
+ "hostAgent": "ingress-and-scoped-token",
1459
+ "sidecar": "control-or-scoped-session-token"
1460
+ },
1461
+ "layers": [
1462
+ "worker",
1463
+ "orchestrator",
1464
+ "hostAgent",
1465
+ "sidecar",
1466
+ "typescript",
1467
+ "python"
1468
+ ],
1469
+ "auditAction": "sandbox.exec",
1470
+ "rateFamily": "process",
1471
+ "shortTokenRequired": true,
1472
+ "startsWork": true,
1473
+ "blocking": true,
1474
+ "execActivity": true
1475
+ },
1476
+ "processList": {
1477
+ "method": "GET",
1478
+ "path": "/process",
1479
+ "pattern": "^/process$",
1480
+ "auth": {
1481
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1482
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1483
+ "hostAgent": "ingress-and-scoped-token",
1484
+ "sidecar": "control-or-scoped-session-token"
1485
+ },
1486
+ "layers": [
1487
+ "worker",
1488
+ "orchestrator",
1489
+ "hostAgent",
1490
+ "sidecar",
1491
+ "typescript",
1492
+ "python"
1493
+ ],
1494
+ "auditAction": null,
1495
+ "rateFamily": null,
1496
+ "shortTokenRequired": false,
1497
+ "startsWork": false,
1498
+ "blocking": false,
1499
+ "execActivity": true
1500
+ },
1501
+ "processGet": {
1502
+ "method": "GET",
1503
+ "path": "/process/{pid}",
1504
+ "pattern": "^/process/[^/]+$",
1505
+ "auth": {
1506
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1507
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1508
+ "hostAgent": "ingress-and-scoped-token",
1509
+ "sidecar": "control-or-scoped-session-token"
1510
+ },
1511
+ "layers": [
1512
+ "worker",
1513
+ "orchestrator",
1514
+ "hostAgent",
1515
+ "sidecar",
1516
+ "typescript",
1517
+ "python"
1518
+ ],
1519
+ "auditAction": null,
1520
+ "rateFamily": null,
1521
+ "shortTokenRequired": false,
1522
+ "startsWork": false,
1523
+ "blocking": false,
1524
+ "execActivity": true
1525
+ },
1526
+ "kill": {
1527
+ "method": "DELETE",
1528
+ "path": "/process/{pid}",
1529
+ "pattern": "^/process/[^/]+$",
1530
+ "auth": {
1531
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1532
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1533
+ "hostAgent": "ingress-and-scoped-token",
1534
+ "sidecar": "control-or-scoped-session-token"
1535
+ },
1536
+ "layers": [
1537
+ "worker",
1538
+ "orchestrator",
1539
+ "hostAgent",
1540
+ "sidecar",
1541
+ "typescript",
1542
+ "python"
1543
+ ],
1544
+ "auditAction": null,
1545
+ "rateFamily": null,
1546
+ "shortTokenRequired": false,
1547
+ "startsWork": false,
1548
+ "blocking": false,
1549
+ "execActivity": true
1550
+ },
1551
+ "logs": {
1552
+ "method": "GET",
1553
+ "path": "/process/{pid}/logs",
1554
+ "pattern": "^/process/[^/]+/logs$",
1555
+ "auth": {
1556
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1557
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1558
+ "hostAgent": "ingress-and-scoped-token",
1559
+ "sidecar": "control-or-scoped-session-token"
1560
+ },
1561
+ "layers": [
1562
+ "worker",
1563
+ "orchestrator",
1564
+ "hostAgent",
1565
+ "sidecar",
1566
+ "typescript",
1567
+ "python"
1568
+ ],
1569
+ "auditAction": null,
1570
+ "rateFamily": null,
1571
+ "shortTokenRequired": false,
1572
+ "startsWork": false,
1573
+ "blocking": false,
1574
+ "execActivity": true
1575
+ },
1576
+ "listKernels": {
1577
+ "method": "GET",
1578
+ "path": "/code/kernels",
1579
+ "pattern": "^/code/kernels$",
1580
+ "auth": {
1581
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1582
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1583
+ "hostAgent": "ingress-and-scoped-token",
1584
+ "sidecar": "control-or-scoped-session-token"
1585
+ },
1586
+ "layers": [
1587
+ "worker",
1588
+ "orchestrator",
1589
+ "hostAgent",
1590
+ "sidecar",
1591
+ "typescript",
1592
+ "python"
1593
+ ],
1594
+ "auditAction": null,
1595
+ "rateFamily": null,
1596
+ "shortTokenRequired": false,
1597
+ "startsWork": false,
1598
+ "blocking": false,
1599
+ "execActivity": true
1600
+ },
1601
+ "restartKernel": {
1602
+ "method": "POST",
1603
+ "path": "/code/kernels/{key}/restart",
1604
+ "pattern": "^/code/kernels/[^/]+/restart$",
1605
+ "auth": {
1606
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1607
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1608
+ "hostAgent": "ingress-and-scoped-token",
1609
+ "sidecar": "control-or-scoped-session-token"
1610
+ },
1611
+ "layers": [
1612
+ "worker",
1613
+ "orchestrator",
1614
+ "hostAgent",
1615
+ "sidecar",
1616
+ "typescript",
1617
+ "python"
1618
+ ],
1619
+ "auditAction": null,
1620
+ "rateFamily": null,
1621
+ "shortTokenRequired": false,
1622
+ "startsWork": true,
1623
+ "blocking": false,
1624
+ "execActivity": true
1625
+ },
1626
+ "disposeKernel": {
1627
+ "method": "DELETE",
1628
+ "path": "/code/kernels/{key}",
1629
+ "pattern": "^/code/kernels/[^/]+$",
1630
+ "auth": {
1631
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1632
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1633
+ "hostAgent": "ingress-and-scoped-token",
1634
+ "sidecar": "control-or-scoped-session-token"
1635
+ },
1636
+ "layers": [
1637
+ "worker",
1638
+ "orchestrator",
1639
+ "hostAgent",
1640
+ "sidecar",
1641
+ "typescript",
1642
+ "python"
1643
+ ],
1644
+ "auditAction": null,
1645
+ "rateFamily": null,
1646
+ "shortTokenRequired": false,
1647
+ "startsWork": false,
1648
+ "blocking": false,
1649
+ "execActivity": true
1650
+ },
1651
+ "fileWrite": {
1652
+ "method": "POST",
1653
+ "path": "/files/write",
1654
+ "pattern": "^/files/write$",
1655
+ "auth": {
1656
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1657
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1658
+ "hostAgent": "ingress-and-scoped-token",
1659
+ "sidecar": "control-or-scoped-session-token"
1660
+ },
1661
+ "layers": [
1662
+ "worker",
1663
+ "orchestrator",
1664
+ "hostAgent",
1665
+ "sidecar",
1666
+ "typescript",
1667
+ "python"
1668
+ ],
1669
+ "auditAction": null,
1670
+ "rateFamily": null,
1671
+ "shortTokenRequired": false,
1672
+ "startsWork": true,
1673
+ "blocking": false,
1674
+ "execActivity": false
1675
+ },
1676
+ "fileRead": {
1677
+ "method": "POST",
1678
+ "path": "/files/read",
1679
+ "pattern": "^/files/read$",
1680
+ "auth": {
1681
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1682
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1683
+ "hostAgent": "ingress-and-scoped-token",
1684
+ "sidecar": "control-or-scoped-session-token"
1685
+ },
1686
+ "layers": [
1687
+ "worker",
1688
+ "orchestrator",
1689
+ "hostAgent",
1690
+ "sidecar",
1691
+ "typescript",
1692
+ "python"
1693
+ ],
1694
+ "auditAction": null,
1695
+ "rateFamily": null,
1696
+ "shortTokenRequired": false,
1697
+ "startsWork": false,
1698
+ "blocking": false,
1699
+ "execActivity": false
1700
+ },
1701
+ "fileInfo": {
1702
+ "method": "POST",
1703
+ "path": "/files/info",
1704
+ "pattern": "^/files/info$",
1705
+ "auth": {
1706
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1707
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1708
+ "hostAgent": "ingress-and-scoped-token",
1709
+ "sidecar": "control-or-scoped-session-token"
1710
+ },
1711
+ "layers": [
1712
+ "worker",
1713
+ "orchestrator",
1714
+ "hostAgent",
1715
+ "sidecar",
1716
+ "typescript",
1717
+ "python"
1718
+ ],
1719
+ "auditAction": null,
1720
+ "rateFamily": null,
1721
+ "shortTokenRequired": false,
1722
+ "startsWork": false,
1723
+ "blocking": false,
1724
+ "execActivity": false
1725
+ },
1726
+ "fileReadBatch": {
1727
+ "method": "POST",
1728
+ "path": "/files/read-batch",
1729
+ "pattern": "^/files/read-batch$",
1730
+ "auth": {
1731
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1732
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1733
+ "hostAgent": "ingress-and-scoped-token",
1734
+ "sidecar": "control-or-scoped-session-token"
1735
+ },
1736
+ "layers": [
1737
+ "worker",
1738
+ "orchestrator",
1739
+ "hostAgent",
1740
+ "sidecar",
1741
+ "typescript",
1742
+ "python"
1743
+ ],
1744
+ "auditAction": null,
1745
+ "rateFamily": null,
1746
+ "shortTokenRequired": false,
1747
+ "startsWork": false,
1748
+ "blocking": false,
1749
+ "execActivity": false
1750
+ },
1751
+ "fileWriteBatch": {
1752
+ "method": "POST",
1753
+ "path": "/files/write-batch",
1754
+ "pattern": "^/files/write-batch$",
1755
+ "auth": {
1756
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1757
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1758
+ "hostAgent": "ingress-and-scoped-token",
1759
+ "sidecar": "control-or-scoped-session-token"
1760
+ },
1761
+ "layers": [
1762
+ "worker",
1763
+ "orchestrator",
1764
+ "hostAgent",
1765
+ "sidecar",
1766
+ "typescript",
1767
+ "python"
1768
+ ],
1769
+ "auditAction": null,
1770
+ "rateFamily": null,
1771
+ "shortTokenRequired": false,
1772
+ "startsWork": true,
1773
+ "blocking": false,
1774
+ "execActivity": false
1775
+ },
1776
+ "fileTree": {
1777
+ "method": "GET",
1778
+ "path": "/files/tree",
1779
+ "pattern": "^/files/tree$",
1780
+ "auth": {
1781
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1782
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1783
+ "hostAgent": "ingress-and-scoped-token",
1784
+ "sidecar": "control-or-scoped-session-token"
1785
+ },
1786
+ "layers": [
1787
+ "worker",
1788
+ "orchestrator",
1789
+ "hostAgent",
1790
+ "sidecar",
1791
+ "typescript",
1792
+ "python"
1793
+ ],
1794
+ "auditAction": null,
1795
+ "rateFamily": null,
1796
+ "shortTokenRequired": false,
1797
+ "startsWork": false,
1798
+ "blocking": false,
1799
+ "execActivity": false
1800
+ },
1801
+ "fileDelete": {
1802
+ "method": "POST",
1803
+ "path": "/files/delete",
1804
+ "pattern": "^/files/delete$",
1805
+ "auth": {
1806
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1807
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1808
+ "hostAgent": "ingress-and-scoped-token",
1809
+ "sidecar": "control-or-scoped-session-token"
1810
+ },
1811
+ "layers": [
1812
+ "worker",
1813
+ "orchestrator",
1814
+ "hostAgent",
1815
+ "sidecar",
1816
+ "typescript",
1817
+ "python"
1818
+ ],
1819
+ "auditAction": null,
1820
+ "rateFamily": null,
1821
+ "shortTokenRequired": false,
1822
+ "startsWork": true,
1823
+ "blocking": false,
1824
+ "execActivity": false
1825
+ },
1826
+ "fileRename": {
1827
+ "method": "POST",
1828
+ "path": "/files/rename",
1829
+ "pattern": "^/files/rename$",
1830
+ "auth": {
1831
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1832
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1833
+ "hostAgent": "ingress-and-scoped-token",
1834
+ "sidecar": "control-or-scoped-session-token"
1835
+ },
1836
+ "layers": [
1837
+ "worker",
1838
+ "orchestrator",
1839
+ "hostAgent",
1840
+ "sidecar",
1841
+ "typescript",
1842
+ "python"
1843
+ ],
1844
+ "auditAction": null,
1845
+ "rateFamily": null,
1846
+ "shortTokenRequired": false,
1847
+ "startsWork": true,
1848
+ "blocking": false,
1849
+ "execActivity": false
1850
+ },
1851
+ "fsUpload": {
1852
+ "method": "POST",
1853
+ "path": "/fs/upload",
1854
+ "pattern": "^/fs/upload$",
1855
+ "auth": {
1856
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1857
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1858
+ "hostAgent": "ingress-and-scoped-token",
1859
+ "sidecar": "control-or-scoped-session-token"
1860
+ },
1861
+ "layers": [
1862
+ "worker",
1863
+ "orchestrator",
1864
+ "hostAgent",
1865
+ "sidecar",
1866
+ "typescript",
1867
+ "python"
1868
+ ],
1869
+ "auditAction": null,
1870
+ "rateFamily": null,
1871
+ "shortTokenRequired": false,
1872
+ "startsWork": true,
1873
+ "blocking": false,
1874
+ "execActivity": false
1875
+ },
1876
+ "fsDownload": {
1877
+ "method": "GET",
1878
+ "path": "/fs/download/:path{.*}",
1879
+ "pattern": "^/fs/download/.+$",
1880
+ "auth": {
1881
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1882
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1883
+ "hostAgent": "ingress-and-scoped-token",
1884
+ "sidecar": "control-or-scoped-session-token"
1885
+ },
1886
+ "layers": [
1887
+ "worker",
1888
+ "orchestrator",
1889
+ "hostAgent",
1890
+ "sidecar",
1891
+ "typescript",
1892
+ "python"
1893
+ ],
1894
+ "auditAction": null,
1895
+ "rateFamily": null,
1896
+ "shortTokenRequired": false,
1897
+ "startsWork": false,
1898
+ "blocking": false,
1899
+ "execActivity": false
1900
+ },
1901
+ "fsUploadDirectory": {
1902
+ "method": "POST",
1903
+ "path": "/fs/upload-dir",
1904
+ "pattern": "^/fs/upload-dir$",
1905
+ "auth": {
1906
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1907
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1908
+ "hostAgent": "ingress-and-scoped-token",
1909
+ "sidecar": "control-or-scoped-session-token"
1910
+ },
1911
+ "layers": [
1912
+ "worker",
1913
+ "orchestrator",
1914
+ "hostAgent",
1915
+ "sidecar",
1916
+ "typescript",
1917
+ "python"
1918
+ ],
1919
+ "auditAction": null,
1920
+ "rateFamily": null,
1921
+ "shortTokenRequired": false,
1922
+ "startsWork": true,
1923
+ "blocking": false,
1924
+ "execActivity": false
1925
+ },
1926
+ "fsDownloadDirectory": {
1927
+ "method": "GET",
1928
+ "path": "/fs/download-dir/:path{.*}",
1929
+ "pattern": "^/fs/download-dir/.+$",
1930
+ "auth": {
1931
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1932
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1933
+ "hostAgent": "ingress-and-scoped-token",
1934
+ "sidecar": "control-or-scoped-session-token"
1935
+ },
1936
+ "layers": [
1937
+ "worker",
1938
+ "orchestrator",
1939
+ "hostAgent",
1940
+ "sidecar",
1941
+ "typescript",
1942
+ "python"
1943
+ ],
1944
+ "auditAction": null,
1945
+ "rateFamily": null,
1946
+ "shortTokenRequired": false,
1947
+ "startsWork": false,
1948
+ "blocking": false,
1949
+ "execActivity": false
1950
+ },
1951
+ "fsList": {
1952
+ "method": "GET",
1953
+ "path": "/fs/list/:path{.*}",
1954
+ "pattern": "^/fs/list/.+$",
1955
+ "auth": {
1956
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1957
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1958
+ "hostAgent": "ingress-and-scoped-token",
1959
+ "sidecar": "control-or-scoped-session-token"
1960
+ },
1961
+ "layers": [
1962
+ "worker",
1963
+ "orchestrator",
1964
+ "hostAgent",
1965
+ "sidecar",
1966
+ "typescript",
1967
+ "python"
1968
+ ],
1969
+ "auditAction": null,
1970
+ "rateFamily": null,
1971
+ "shortTokenRequired": false,
1972
+ "startsWork": false,
1973
+ "blocking": false,
1974
+ "execActivity": false
1975
+ },
1976
+ "fsStat": {
1977
+ "method": "GET",
1978
+ "path": "/fs/stat/:path{.*}",
1979
+ "pattern": "^/fs/stat/.+$",
1980
+ "auth": {
1981
+ "worker": "sandbox-owner-or-scoped-runtime-token",
1982
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
1983
+ "hostAgent": "ingress-and-scoped-token",
1984
+ "sidecar": "control-or-scoped-session-token"
1985
+ },
1986
+ "layers": [
1987
+ "worker",
1988
+ "orchestrator",
1989
+ "hostAgent",
1990
+ "sidecar",
1991
+ "typescript",
1992
+ "python"
1993
+ ],
1994
+ "auditAction": null,
1995
+ "rateFamily": null,
1996
+ "shortTokenRequired": false,
1997
+ "startsWork": false,
1998
+ "blocking": false,
1999
+ "execActivity": false
2000
+ },
2001
+ "fsDelete": {
2002
+ "method": "DELETE",
2003
+ "path": "/fs/:path{.*}",
2004
+ "pattern": "^/fs/.+$",
1404
2005
  "auth": {
1405
2006
  "worker": "sandbox-owner-or-scoped-runtime-token",
1406
2007
  "orchestrator": "sandbox-owner-or-scoped-runtime-token",
@@ -1415,15 +2016,17 @@ const routes = Object.values({
1415
2016
  "typescript",
1416
2017
  "python"
1417
2018
  ],
1418
- "auditAction": "sandbox.exec",
1419
- "rateFamily": "process",
1420
- "shortTokenRequired": true,
2019
+ "auditAction": null,
2020
+ "rateFamily": null,
2021
+ "shortTokenRequired": false,
1421
2022
  "startsWork": true,
1422
- "blocking": true
2023
+ "blocking": false,
2024
+ "execActivity": false
1423
2025
  },
1424
- "processSpawn": {
2026
+ "fsMkdir": {
1425
2027
  "method": "POST",
1426
- "path": "/process/spawn",
2028
+ "path": "/fs/mkdir/:path{.*}",
2029
+ "pattern": "^/fs/mkdir/.+$",
1427
2030
  "auth": {
1428
2031
  "worker": "sandbox-owner-or-scoped-runtime-token",
1429
2032
  "orchestrator": "sandbox-owner-or-scoped-runtime-token",
@@ -1438,15 +2041,42 @@ const routes = Object.values({
1438
2041
  "typescript",
1439
2042
  "python"
1440
2043
  ],
1441
- "auditAction": "sandbox.exec",
1442
- "rateFamily": "process",
1443
- "shortTokenRequired": true,
2044
+ "auditAction": null,
2045
+ "rateFamily": null,
2046
+ "shortTokenRequired": false,
1444
2047
  "startsWork": true,
1445
- "blocking": "blocking"
2048
+ "blocking": false,
2049
+ "execActivity": false
1446
2050
  },
1447
- "ensureDevServer": {
2051
+ "fsExists": {
2052
+ "method": "GET",
2053
+ "path": "/fs/exists/:path{.*}",
2054
+ "pattern": "^/fs/exists/.+$",
2055
+ "auth": {
2056
+ "worker": "sandbox-owner-or-scoped-runtime-token",
2057
+ "orchestrator": "sandbox-owner-or-scoped-runtime-token",
2058
+ "hostAgent": "ingress-and-scoped-token",
2059
+ "sidecar": "control-or-scoped-session-token"
2060
+ },
2061
+ "layers": [
2062
+ "worker",
2063
+ "orchestrator",
2064
+ "hostAgent",
2065
+ "sidecar",
2066
+ "typescript",
2067
+ "python"
2068
+ ],
2069
+ "auditAction": null,
2070
+ "rateFamily": null,
2071
+ "shortTokenRequired": false,
2072
+ "startsWork": false,
2073
+ "blocking": false,
2074
+ "execActivity": false
2075
+ },
2076
+ "uploadSessionInit": {
1448
2077
  "method": "POST",
1449
- "path": "/process/ensure-dev-server",
2078
+ "path": "/fs/upload-session",
2079
+ "pattern": "^/fs/upload-session$",
1450
2080
  "auth": {
1451
2081
  "worker": "sandbox-owner-or-scoped-runtime-token",
1452
2082
  "orchestrator": "sandbox-owner-or-scoped-runtime-token",
@@ -1461,15 +2091,17 @@ const routes = Object.values({
1461
2091
  "typescript",
1462
2092
  "python"
1463
2093
  ],
1464
- "auditAction": "sandbox.exec",
1465
- "rateFamily": "process",
1466
- "shortTokenRequired": true,
2094
+ "auditAction": null,
2095
+ "rateFamily": null,
2096
+ "shortTokenRequired": false,
1467
2097
  "startsWork": true,
1468
- "blocking": true
2098
+ "blocking": false,
2099
+ "execActivity": false
1469
2100
  },
1470
- "processList": {
2101
+ "uploadSessionState": {
1471
2102
  "method": "GET",
1472
- "path": "/process",
2103
+ "path": "/fs/upload-session/{id}",
2104
+ "pattern": "^/fs/upload-session/[^/]+$",
1473
2105
  "auth": {
1474
2106
  "worker": "sandbox-owner-or-scoped-runtime-token",
1475
2107
  "orchestrator": "sandbox-owner-or-scoped-runtime-token",
@@ -1488,11 +2120,13 @@ const routes = Object.values({
1488
2120
  "rateFamily": null,
1489
2121
  "shortTokenRequired": false,
1490
2122
  "startsWork": false,
1491
- "blocking": false
2123
+ "blocking": false,
2124
+ "execActivity": false
1492
2125
  },
1493
- "processGet": {
1494
- "method": "GET",
1495
- "path": "/process/{pid}",
2126
+ "uploadSessionPart": {
2127
+ "method": "PUT",
2128
+ "path": "/fs/upload-session/{id}/parts/{index}",
2129
+ "pattern": "^/fs/upload-session/[^/]+/parts/[^/]+$",
1496
2130
  "auth": {
1497
2131
  "worker": "sandbox-owner-or-scoped-runtime-token",
1498
2132
  "orchestrator": "sandbox-owner-or-scoped-runtime-token",
@@ -1510,12 +2144,14 @@ const routes = Object.values({
1510
2144
  "auditAction": null,
1511
2145
  "rateFamily": null,
1512
2146
  "shortTokenRequired": false,
1513
- "startsWork": false,
1514
- "blocking": false
2147
+ "startsWork": true,
2148
+ "blocking": false,
2149
+ "execActivity": false
1515
2150
  },
1516
- "kill": {
1517
- "method": "DELETE",
1518
- "path": "/process/{pid}",
2151
+ "uploadSessionCommit": {
2152
+ "method": "POST",
2153
+ "path": "/fs/upload-session/{id}/commit",
2154
+ "pattern": "^/fs/upload-session/[^/]+/commit$",
1519
2155
  "auth": {
1520
2156
  "worker": "sandbox-owner-or-scoped-runtime-token",
1521
2157
  "orchestrator": "sandbox-owner-or-scoped-runtime-token",
@@ -1534,11 +2170,13 @@ const routes = Object.values({
1534
2170
  "rateFamily": null,
1535
2171
  "shortTokenRequired": false,
1536
2172
  "startsWork": true,
1537
- "blocking": false
2173
+ "blocking": false,
2174
+ "execActivity": false
1538
2175
  },
1539
- "logs": {
1540
- "method": "GET",
1541
- "path": "/process/{pid}/logs",
2176
+ "uploadSessionDelete": {
2177
+ "method": "DELETE",
2178
+ "path": "/fs/upload-session/{id}",
2179
+ "pattern": "^/fs/upload-session/[^/]+$",
1542
2180
  "auth": {
1543
2181
  "worker": "sandbox-owner-or-scoped-runtime-token",
1544
2182
  "orchestrator": "sandbox-owner-or-scoped-runtime-token",
@@ -1556,12 +2194,13 @@ const routes = Object.values({
1556
2194
  "auditAction": null,
1557
2195
  "rateFamily": null,
1558
2196
  "shortTokenRequired": false,
1559
- "startsWork": false,
1560
- "blocking": false
2197
+ "startsWork": true,
2198
+ "blocking": false,
2199
+ "execActivity": false
1561
2200
  }
1562
2201
  }).map((operation) => ({
1563
2202
  ...operation,
1564
- matcher: new RegExp("^" + operation.path.replace(/\{[^}]+\}/g, "[^/]+") + "$")
2203
+ matcher: new RegExp(operation.pattern)
1565
2204
  }));
1566
2205
  function sandboxOperation(path, method, layer) {
1567
2206
  return routes.find((operation) => operation.method === method && operation.layers.includes(layer) && operation.matcher.test(path));
@@ -2008,118 +2647,6 @@ async function isRefusedBearer(response) {
2008
2647
  return false;
2009
2648
  }
2010
2649
  }
2011
- //#endregion
2012
- //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.2/node_modules/@tangle-network/agent-interface/dist/agent-candidate-schema-common.js
2013
- const sha256Pattern = /^sha256:[a-f0-9]{64}$/;
2014
- const gitObjectPattern = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
2015
- const environmentNamePattern = /^[A-Za-z_][A-Za-z0-9_]*$/;
2016
- const headerNamePattern = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
2017
- const mediaTypePattern = /^[a-z0-9][a-z0-9!#$&^_.+-]{0,126}\/[a-z0-9][a-z0-9!#$&^_.+-]{0,126}$/;
2018
- const githubComponentPattern = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$/;
2019
- const secretNamePattern = /(?:^|[_-])(?:api[_-]?key|access[_-]?key|private[_-]?key|token|secret|password|credentials?|authorization|cookie|database[_-]?url|dsn|pat)(?:[_-]|$)/i;
2020
- 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+)/;
2021
- const controlCharacterPattern = /[\u0000-\u001f\u007f]/;
2022
- z.string().regex(sha256Pattern);
2023
- z.string().regex(gitObjectPattern);
2024
- const environmentNameSchema = z.string().regex(environmentNamePattern);
2025
- z.string().regex(headerNamePattern);
2026
- z.string().regex(mediaTypePattern);
2027
- function sha256Bytes(value) {
2028
- const bytes = sha256(value);
2029
- return `sha256:${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
2030
- }
2031
- /** RFC 8785 serialization used by every candidate-producing package. */
2032
- function canonicalCandidateJson(value) {
2033
- if (!isCanonicalJsonValue(value)) throw new Error("candidate document must be finite, acyclic RFC 8785 JSON");
2034
- return serializeCanonicalCandidate(value);
2035
- }
2036
- function canonicalCandidateBytes(value) {
2037
- return new TextEncoder().encode(canonicalCandidateJson(value));
2038
- }
2039
- function canonicalCandidateDigest(value) {
2040
- return sha256Bytes(canonicalCandidateBytes(value));
2041
- }
2042
- function serializeCanonicalCandidate(value) {
2043
- if (value === null || typeof value === "boolean" || typeof value === "number") return JSON.stringify(value);
2044
- if (typeof value === "string") return JSON.stringify(value);
2045
- if (Array.isArray(value)) return `[${value.map(serializeCanonicalCandidate).join(",")}]`;
2046
- return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${serializeCanonicalCandidate(value[key])}`).join(",")}}`;
2047
- }
2048
- function isWellFormedUnicode(value) {
2049
- for (let index = 0; index < value.length; index++) {
2050
- const code = value.charCodeAt(index);
2051
- if (code >= 55296 && code <= 56319) {
2052
- const next = value.charCodeAt(index + 1);
2053
- if (!(next >= 56320 && next <= 57343)) return false;
2054
- index++;
2055
- } else if (code >= 56320 && code <= 57343) return false;
2056
- }
2057
- return true;
2058
- }
2059
- function isCanonicalJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
2060
- if (value === null || typeof value === "boolean") return true;
2061
- if (typeof value === "string") return isWellFormedUnicode(value);
2062
- if (typeof value === "number") return Number.isFinite(value);
2063
- if (typeof value !== "object" || ancestors.has(value)) return false;
2064
- const prototype = Object.getPrototypeOf(value);
2065
- if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) return false;
2066
- const nextAncestors = new Set(ancestors).add(value);
2067
- if (Array.isArray(value)) {
2068
- for (let index = 0; index < value.length; index += 1) {
2069
- if (!(index in value)) return false;
2070
- if (!isCanonicalJsonValue(value[index], nextAncestors)) return false;
2071
- }
2072
- return true;
2073
- }
2074
- return Object.entries(value).every(([key, entry]) => isWellFormedUnicode(key) && isCanonicalJsonValue(entry, nextAncestors));
2075
- }
2076
- function hasCredentialBearingUrl(value) {
2077
- try {
2078
- const url = new URL(value);
2079
- if (url.username !== "" || url.password !== "") return true;
2080
- return [...url.searchParams.keys()].some((key) => secretNamePattern.test(key));
2081
- } catch {
2082
- return false;
2083
- }
2084
- }
2085
- /**
2086
- * Whether a string holds an obvious credential: a provider key (`sk-`, `gh*_`,
2087
- * `github_pat_`, `AKIA`), a PEM private key, a bearer token, or a URL with
2088
- * userinfo or a credential-named query parameter. The agent-eval redaction
2089
- * core calls it, so candidate validation and trace redaction agree.
2090
- */
2091
- function looksLikeCredential(value) {
2092
- return obviousSecretValuePattern.test(value) || hasCredentialBearingUrl(value);
2093
- }
2094
- function isPublicConfigValue(value) {
2095
- return !controlCharacterPattern.test(value) && isWellFormedUnicode(value) && !looksLikeCredential(value);
2096
- }
2097
- /** Shared public reference owner; resolution belongs to the trusted executor. */
2098
- const agentCandidateSecretRefSchema = z.strictObject({
2099
- kind: z.literal("secret-ref"),
2100
- key: z.string().min(1).max(500).refine((value) => value.trim().length > 0 && isPublicConfigValue(value), "secret reference key must be a public non-credential identity"),
2101
- format: z.enum(["raw", "bearer"]).optional()
2102
- });
2103
- const agentCandidatePublicValueSchema = z.strictObject({
2104
- kind: z.literal("public"),
2105
- value: z.string().refine(isPublicConfigValue, "candidate config cannot carry credentials; the evaluator owns model authorization")
2106
- });
2107
- const agentCandidateConfigValueSchema = z.discriminatedUnion("kind", [agentCandidatePublicValueSchema, agentCandidateSecretRefSchema]);
2108
- function configRecordSchema(keySchema) {
2109
- return z.record(keySchema, agentCandidateConfigValueSchema).superRefine((config, ctx) => {
2110
- for (const name of Object.keys(config)) if (secretNamePattern.test(name) && config[name]?.kind !== "secret-ref") ctx.addIssue({
2111
- code: "custom",
2112
- path: [name],
2113
- message: "candidate config cannot declare credential-bearing names"
2114
- });
2115
- });
2116
- }
2117
- configRecordSchema(environmentNameSchema);
2118
- z.object({
2119
- kind: z.literal("github"),
2120
- owner: z.string().regex(githubComponentPattern).refine((value) => value !== "." && value !== ".."),
2121
- repo: z.string().regex(githubComponentPattern).refine((value) => value !== "." && value !== "..")
2122
- }).strict();
2123
2650
  const CODEX_SYSTEM_PROMPT_FILE = ".codex/system-prompt.md";
2124
2651
  const OPENCODE_APPEND_SYSTEM_PROMPT_FILE = ".opencode/agent-system-prompt.md";
2125
2652
  const OPENCODE_CONFIG_FILE = "opencode.json";
@@ -5292,7 +5819,7 @@ var InteractiveSessionHandle = class {
5292
5819
  options?.signal?.throwIfAborted();
5293
5820
  const binding = this.requireBinding();
5294
5821
  const exactCommand = AgentInteractiveSessionPromptCommandSchema.parse(command);
5295
- if (canonicalCandidateDigest$1(exactCommand.ref) !== canonicalCandidateDigest$1(binding.ref) || canonicalCandidateDigest$1(exactCommand.control) !== canonicalCandidateDigest$1(binding.control)) throw new Error(`Interactive session ${this.sessionId} prompt is bound to a different exact ref`);
5822
+ 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`);
5296
5823
  return (options === void 0 ? this.host._sendInteractivePrompt(this.sessionId, exactCommand) : this.host._sendInteractivePrompt(this.sessionId, exactCommand, options)).then((acknowledgement) => {
5297
5824
  const exactAcknowledgement = AgentInteractiveSessionPromptAcknowledgementSchema.parse(acknowledgement);
5298
5825
  if (!agentInteractiveSessionPromptAcknowledgementMatchesCommand(exactCommand, exactAcknowledgement)) throw new Error(`Interactive session ${this.sessionId} prompt acknowledgement does not match the command`);
@@ -5370,8 +5897,8 @@ var InteractiveSessionHandle = class {
5370
5897
  options?.signal?.throwIfAborted();
5371
5898
  const binding = this.requireBinding();
5372
5899
  const exactRequest = AgentInteractiveSessionAttachSchema.parse(request);
5373
- if (!agentInteractiveSessionControlClaimMatchesRef(binding.ref, exactRequest.control) || canonicalCandidateDigest$1(exactRequest.control) !== canonicalCandidateDigest$1(binding.control)) throw new Error(`Interactive session ${this.sessionId} terminal attach is bound to a different active control claim`);
5374
- const requestDigest = canonicalCandidateDigest$1(exactRequest);
5900
+ 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`);
5901
+ const requestDigest = canonicalCandidateDigest(exactRequest);
5375
5902
  if (this.agentTerminalAttachInFlight !== void 0) {
5376
5903
  if (this.agentTerminalAttachDigest !== requestDigest) throw new Error(`Interactive session ${this.sessionId} cannot attach with a different terminal request while another attach is in flight`);
5377
5904
  return awaitWithAbort(this.agentTerminalAttachInFlight, options?.signal);
@@ -5424,7 +5951,7 @@ var InteractiveSessionHandle = class {
5424
5951
  options?.signal?.throwIfAborted();
5425
5952
  const ref = this.requireRef();
5426
5953
  const exactRequest = AgentInteractiveSessionControlClaimRequestSchema.parse(request);
5427
- if (canonicalCandidateDigest$1(exactRequest.ref) !== canonicalCandidateDigest$1(ref)) throw new Error(`Interactive session ${this.sessionId} control claim is bound to a different exact ref`);
5954
+ if (canonicalCandidateDigest(exactRequest.ref) !== canonicalCandidateDigest(ref)) throw new Error(`Interactive session ${this.sessionId} control claim is bound to a different exact ref`);
5428
5955
  return this.host._claimInteractiveControl(this.sessionId, exactRequest, options).then((acknowledgement) => {
5429
5956
  const exactAcknowledgement = AgentInteractiveSessionControlClaimAcknowledgementSchema.parse(acknowledgement);
5430
5957
  if (!agentInteractiveSessionControlClaimAcknowledgementMatchesRequest(exactRequest, exactAcknowledgement)) throw new Error(`Interactive session ${this.sessionId} control claim acknowledgement does not match the request`);
@@ -5439,7 +5966,7 @@ var InteractiveSessionHandle = class {
5439
5966
  options?.signal?.throwIfAborted();
5440
5967
  const binding = this.requireBinding();
5441
5968
  const exactCommand = AgentInteractiveSessionStopCommandSchema.parse(command);
5442
- if (canonicalCandidateDigest$1(exactCommand.ref) !== canonicalCandidateDigest$1(binding.ref) || canonicalCandidateDigest$1(exactCommand.control) !== canonicalCandidateDigest$1(binding.control)) throw new Error(`Interactive session ${this.sessionId} stop is bound to a different exact ref`);
5969
+ 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`);
5443
5970
  return (options === void 0 ? this.host._stopInteractive(this.sessionId, exactCommand) : this.host._stopInteractive(this.sessionId, exactCommand, options)).then((acknowledgement) => {
5444
5971
  const exactAcknowledgement = AgentInteractiveSessionStopAcknowledgementSchema.parse(acknowledgement);
5445
5972
  if (!agentInteractiveSessionStopAcknowledgementMatchesCommand(exactCommand, exactAcknowledgement)) throw new Error(`Interactive session ${this.sessionId} stop acknowledgement does not match the command`);
@@ -5451,7 +5978,7 @@ var InteractiveSessionHandle = class {
5451
5978
  const ref = this.requireRef();
5452
5979
  return (options === void 0 ? this.host._stopInteractiveLifecycle(this.sessionId, ref) : this.host._stopInteractiveLifecycle(this.sessionId, ref, options)).then((acknowledgement) => {
5453
5980
  const exactAcknowledgement = AgentInteractiveSessionStopAcknowledgementSchema.parse(acknowledgement);
5454
- if (canonicalCandidateDigest$1(exactAcknowledgement.ref) !== canonicalCandidateDigest$1(ref)) throw new Error(`Interactive session ${this.sessionId} lifecycle stop acknowledgement does not match the exact ref`);
5981
+ if (canonicalCandidateDigest(exactAcknowledgement.ref) !== canonicalCandidateDigest(ref)) throw new Error(`Interactive session ${this.sessionId} lifecycle stop acknowledgement does not match the exact ref`);
5455
5982
  if (exactAcknowledgement.status !== "accepted" && exactAcknowledgement.status !== "replayed") throw new Error(`Interactive session ${this.sessionId} lifecycle stop was not confirmed (${exactAcknowledgement.status})`);
5456
5983
  if (exactAcknowledgement.effect === "unknown") throw new Error(`Interactive session ${this.sessionId} lifecycle stop returned an unknown outcome`);
5457
5984
  return exactAcknowledgement;
@@ -5881,48 +6408,8 @@ var SandboxExecCapabilities = class extends SandboxCodeOperations {
5881
6408
  }
5882
6409
  };
5883
6410
  //#endregion
5884
- //#region src/sandbox-file-write.ts
5885
- var SandboxFileWriteCapabilities = class extends SandboxExecCapabilities {
5886
- /**
5887
- * Read a file from the sandbox.
5888
- *
5889
- * @param path - Path to the file. Relative paths resolve from the workspace root.
5890
- * Absolute paths (e.g., `/tmp/output.json`) access the container filesystem directly.
5891
- * @returns File content as string
5892
- *
5893
- * @example
5894
- * ```typescript
5895
- * const content = await box.read("src/index.ts");
5896
- * const report = await box.read("/output/report.json");
5897
- * ```
5898
- */
5899
- async read(path, options) {
5900
- const headers = callHeaders(options);
5901
- await this.ensureRunning();
5902
- const response = await this.runtimeFetch("/files/read", {
5903
- method: "POST",
5904
- headers,
5905
- body: JSON.stringify({
5906
- path,
5907
- encoding: "utf8"
5908
- })
5909
- });
5910
- if (!response.ok) throw await parseResponseError(response);
5911
- return parseTextFileReadResponse(await response.text());
5912
- }
5913
- /**
5914
- * Write content to a file in the sandbox.
5915
- *
5916
- * @param path - Path to the file. Relative paths resolve from the workspace root.
5917
- * Absolute paths (e.g., `/tmp/cases.json`) write to the container filesystem directly.
5918
- * @param content - Content to write
5919
- *
5920
- * @example
5921
- * ```typescript
5922
- * await box.write("src/fix.ts", "export const fix = () => {}");
5923
- * await box.write("/tmp/config.json", JSON.stringify(config));
5924
- * ```
5925
- */
6411
+ //#region src/generated/sandbox-file-operations.ts
6412
+ var SandboxFileOperations = class extends SandboxExecCapabilities {
5926
6413
  async write(path, content, options) {
5927
6414
  await this.ensureRunning();
5928
6415
  return this.writeFileRequest(path, content, options);
@@ -5931,7 +6418,7 @@ var SandboxFileWriteCapabilities = class extends SandboxExecCapabilities {
5931
6418
  const params = new URLSearchParams();
5932
6419
  appendSessionIdQuery(params, options?.sessionId);
5933
6420
  const query = params.toString();
5934
- const data = await readResponseJson(await this.runtimeFetch(`/files/write${query ? `?${query}` : ""}`, {
6421
+ const data = await readResponseJson(await this.runtimeFetch("/files/write" + (query ? "?" + query : ""), {
5935
6422
  method: "POST",
5936
6423
  headers: callHeaders({ traceId: options?.traceId }),
5937
6424
  body: JSON.stringify({
@@ -5950,6 +6437,38 @@ var SandboxFileWriteCapabilities = class extends SandboxExecCapabilities {
5950
6437
  });
5951
6438
  return data.data;
5952
6439
  }
6440
+ async read(path, options) {
6441
+ const headers = callHeaders(options);
6442
+ await this.ensureRunning();
6443
+ const response = await this.runtimeFetch("/files/read", {
6444
+ method: "POST",
6445
+ headers,
6446
+ body: JSON.stringify({
6447
+ path,
6448
+ encoding: "utf8"
6449
+ })
6450
+ });
6451
+ if (!response.ok) throw await parseResponseError(response);
6452
+ let payload;
6453
+ try {
6454
+ payload = JSON.parse(await response.text());
6455
+ } catch (error) {
6456
+ if (!(error instanceof SyntaxError)) throw error;
6457
+ throw new ServerError("Runtime returned invalid JSON for file read", 502, {
6458
+ origin: "runtime",
6459
+ endpoint: "/files/read"
6460
+ });
6461
+ }
6462
+ if (typeof payload !== "object" || payload === null || !("success" in payload) || payload.success !== true || !("data" in payload) || typeof payload.data !== "object" || payload.data === null || !("content" in payload.data) || typeof payload.data.content !== "string" || !("encoding" in payload.data) || payload.data.encoding !== "utf8") throw new ServerError("Runtime returned a malformed text file response", 502, {
6463
+ origin: "runtime",
6464
+ endpoint: "/files/read"
6465
+ });
6466
+ return payload.data.content;
6467
+ }
6468
+ };
6469
+ //#endregion
6470
+ //#region src/sandbox-file-write.ts
6471
+ var SandboxFileWriteCapabilities = class extends SandboxFileOperations {
5953
6472
  assertWritePreconditions(result, requested) {
5954
6473
  if ([...requested.expectedHash !== void 0 ? ["ifHash"] : [], ...requested.ifAbsent ? ["ifAbsent"] : []].some((precondition) => !result.preconditionsApplied?.includes(precondition))) throw new CapabilityError("sidecar does not support write preconditions");
5955
6474
  }
@@ -6112,22 +6631,6 @@ function splitWriteManyBatches(files) {
6112
6631
  function hasDuplicateWriteManyPaths(files) {
6113
6632
  return new Set(files.map((file) => file.path)).size !== files.length;
6114
6633
  }
6115
- function parseTextFileReadResponse(body) {
6116
- let payload;
6117
- try {
6118
- payload = JSON.parse(body);
6119
- } catch {
6120
- throw new ServerError("Runtime returned invalid JSON for file read", 502, {
6121
- origin: "runtime",
6122
- endpoint: "/files/read"
6123
- });
6124
- }
6125
- if (typeof payload !== "object" || payload === null || !("success" in payload) || payload.success !== true || !("data" in payload) || typeof payload.data !== "object" || payload.data === null || !("content" in payload.data) || typeof payload.data.content !== "string" || !("encoding" in payload.data) || payload.data.encoding !== "utf8") throw new ServerError("Runtime returned a malformed text file response", 502, {
6126
- origin: "runtime",
6127
- endpoint: "/files/read"
6128
- });
6129
- return payload.data.content;
6130
- }
6131
6634
  const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
6132
6635
  /** Transient file-write failures worth retrying: rate-limit (quota), 5xx,
6133
6636
  * transport (network), and request timeouts. A non-transient error (bad path,
@@ -6605,7 +7108,7 @@ const interactionResolutionDeliveryStateSchema = z.enum([
6605
7108
  const interactionResolutionAcknowledgementSchema = z.strictObject({
6606
7109
  status: z.enum(["accepted", "already_resolved_same"]),
6607
7110
  operationId: z.string().min(1),
6608
- responseDigest: sha256DigestSchema$1,
7111
+ responseDigest: sha256DigestSchema,
6609
7112
  interactionId: z.string().min(1),
6610
7113
  sessionId: z.string().min(1),
6611
7114
  outcome: z.enum([
@@ -6633,7 +7136,7 @@ const InteractionConflictEnvelopeSchema = z.object({
6633
7136
  code: z.string().min(1),
6634
7137
  message: z.string().min(1),
6635
7138
  status: REFUSED_INTERACTION_STATUS,
6636
- existingResponseDigest: sha256DigestSchema$1.optional(),
7139
+ existingResponseDigest: sha256DigestSchema.optional(),
6637
7140
  existingOperationId: z.string().min(1).optional(),
6638
7141
  resolvedAt: z.string().min(1).optional()
6639
7142
  })
@@ -6661,7 +7164,7 @@ function bindingsEqual(left, right) {
6661
7164
  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;
6662
7165
  }
6663
7166
  function assertResolutionMatches(resolution, sessionId, submitted, response, endpoint) {
6664
- const expectedDigest = canonicalCandidateDigest$1(submitted);
7167
+ const expectedDigest = canonicalCandidateDigest(submitted);
6665
7168
  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);
6666
7169
  }
6667
7170
  /** Parse one interaction response without discarding replay information. */
@@ -7582,7 +8085,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
7582
8085
  origin: "runtime",
7583
8086
  endpoint: `/agents/sessions/${encodeURIComponent(id)}/interactive`
7584
8087
  });
7585
- if (canonicalCandidateDigest$1(status.ref) !== canonicalCandidateDigest$1(exactCommand.ref)) throw new ValidationError("Interactive prompt ref or control does not match the session");
8088
+ if (canonicalCandidateDigest(status.ref) !== canonicalCandidateDigest(exactCommand.ref)) throw new ValidationError("Interactive prompt ref or control does not match the session");
7586
8089
  const endpoint = `/agents/sessions/${encodeURIComponent(id)}/interactive/prompt`;
7587
8090
  const response = await this.runtimeFetch(endpoint, {
7588
8091
  method: "POST",
@@ -7760,7 +8263,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
7760
8263
  origin: "runtime"
7761
8264
  });
7762
8265
  const acknowledgement = parsed.data.data;
7763
- if (canonicalCandidateDigest$1(acknowledgement.ref) !== canonicalCandidateDigest$1(exactRef)) throw new ServerError("Interactive lifecycle stop acknowledgement does not match the exact ref", 502, {
8266
+ if (canonicalCandidateDigest(acknowledgement.ref) !== canonicalCandidateDigest(exactRef)) throw new ServerError("Interactive lifecycle stop acknowledgement does not match the exact ref", 502, {
7764
8267
  endpoint,
7765
8268
  origin: "runtime"
7766
8269
  });
@@ -9809,6 +10312,75 @@ async function readEgressJson(response, message) {
9809
10312
  }
9810
10313
  }
9811
10314
  //#endregion
10315
+ //#region src/generated/sandbox-filesystem-operations.ts
10316
+ function fileInfo(entry) {
10317
+ return {
10318
+ name: entry.name,
10319
+ path: entry.path,
10320
+ size: entry.size,
10321
+ isDir: entry.isDir,
10322
+ isFile: entry.isFile,
10323
+ isSymlink: entry.isSymlink,
10324
+ permissions: entry.permissions,
10325
+ owner: entry.owner,
10326
+ group: entry.group,
10327
+ modTime: new Date(entry.modTime),
10328
+ accessTime: new Date(entry.accessTime)
10329
+ };
10330
+ }
10331
+ var DeclaredFilesystemOperations = class {
10332
+ constructor(host) {
10333
+ this.host = host;
10334
+ }
10335
+ async fsList(path, options) {
10336
+ const params = new URLSearchParams();
10337
+ if (options?.all) params.set("all", "true");
10338
+ if (options?.long) params.set("long", "true");
10339
+ appendSessionIdQuery(params, options?.sessionId);
10340
+ await this.host.ensureRunning();
10341
+ const query = params.toString();
10342
+ const basePath = runtimeFilesystemPath("/fs/list", path);
10343
+ return ((await readResponseJson(await this.host.runtimeFetch(query ? basePath + "?" + query : basePath, { method: "GET" }))).data?.entries ?? []).map(fileInfo);
10344
+ }
10345
+ async fsStat(path) {
10346
+ await this.host.ensureRunning();
10347
+ const basePath = runtimeFilesystemPath("/fs/stat", path);
10348
+ return fileInfo((await readResponseJson(await this.host.runtimeFetch(basePath, { method: "GET" }))).data);
10349
+ }
10350
+ async fsDelete(path, options) {
10351
+ const params = new URLSearchParams();
10352
+ if (options?.recursive) params.set("recursive", "true");
10353
+ const hasSessionScope = appendSessionIdQuery(params, options?.sessionId);
10354
+ await this.host.ensureRunning();
10355
+ if (hasSessionScope && !options?.recursive) {
10356
+ const response = await this.host.runtimeFetch("/files/delete?" + params, {
10357
+ method: "POST",
10358
+ body: JSON.stringify({ path })
10359
+ });
10360
+ if (!response.ok) throw await parseResponseError(response);
10361
+ return;
10362
+ }
10363
+ const query = params.toString();
10364
+ const basePath = runtimeFilesystemPath("/fs", path);
10365
+ const response = await this.host.runtimeFetch(query ? basePath + "?" + query : basePath, { method: "DELETE" });
10366
+ if (!response.ok) throw await parseResponseError(response);
10367
+ }
10368
+ async fsMkdir(path, options) {
10369
+ await this.host.ensureRunning();
10370
+ const params = new URLSearchParams();
10371
+ if (options?.recursive) params.set("recursive", "true");
10372
+ const query = params.toString();
10373
+ const basePath = runtimeFilesystemPath("/fs/mkdir", path);
10374
+ const response = await this.host.runtimeFetch(query ? basePath + "?" + query : basePath, { method: "POST" });
10375
+ if (!response.ok) throw await parseResponseError(response);
10376
+ }
10377
+ async fsExists(path) {
10378
+ await this.host.ensureRunning();
10379
+ const basePath = runtimeFilesystemPath("/fs/exists", path);
10380
+ return (await readResponseJson(await this.host.runtimeFetch(basePath, { method: "GET" }))).data?.exists === true;
10381
+ }
10382
+ };
10383
+ //#endregion
9812
10384
  //#region src/lib/file-download.ts
9813
10385
  /** Retain only complete downloads; failed streams leave the destination intact. */
9814
10386
  async function downloadFile(request, localPath, options = {}) {
@@ -9995,35 +10567,7 @@ function sliceRanges(total, count) {
9995
10567
  }
9996
10568
  //#endregion
9997
10569
  //#region src/sandbox-filesystem-operations.ts
9998
- function isFilesystemTraversalSegment(segment) {
9999
- let decoded = segment;
10000
- for (let depth = 0; depth < 32; depth++) {
10001
- if (decoded === "." || decoded === "..") return true;
10002
- try {
10003
- const next = decodeURIComponent(decoded);
10004
- if (next === decoded) return false;
10005
- decoded = next;
10006
- } catch {
10007
- return false;
10008
- }
10009
- }
10010
- return true;
10011
- }
10012
- /**
10013
- * The extra separator is intentional: absolute paths produce `//`, allowing
10014
- * the runtime route wildcard to retain the path's leading slash.
10015
- */
10016
- function runtimeFilesystemPath(endpoint, path) {
10017
- const isAbsolute = path.startsWith("/");
10018
- const segments = path.split("/").filter((segment) => segment.length > 0 && segment !== ".");
10019
- if (segments.some(isFilesystemTraversalSegment)) throw new ValidationError("Filesystem paths must not contain traversal segments (\"..\")");
10020
- const encodedPath = segments.map(encodeURIComponent).join("/");
10021
- return `${endpoint}/${isAbsolute ? "/" : ""}${encodedPath}`;
10022
- }
10023
- var SandboxFilesystemOperations = class {
10024
- constructor(host) {
10025
- this.host = host;
10026
- }
10570
+ var SandboxFilesystemOperations = class extends DeclaredFilesystemOperations {
10027
10571
  get fs() {
10028
10572
  return {
10029
10573
  supportsWriteMode: true,
@@ -10067,7 +10611,7 @@ var SandboxFilesystemOperations = class {
10067
10611
  totalBytes: size,
10068
10612
  percentage: 0
10069
10613
  });
10070
- const { uploadChunkedFromFile } = await import("./chunked-upload-file-D9NvCQis.js");
10614
+ const { uploadChunkedFromFile } = await import("./chunked-upload-file-an8AfIJx.js");
10071
10615
  await uploadChunkedFromFile({ fetch: (path, init) => this.host.runtimeFetch(path, init) }, remotePath, localPath, {
10072
10616
  mode: options?.permissions,
10073
10617
  onProgress: options?.onProgress ? (progress) => {
@@ -10172,82 +10716,9 @@ var SandboxFilesystemOperations = class {
10172
10716
  await fs.rm(tempDir, { recursive: true }).catch(() => {});
10173
10717
  }
10174
10718
  }
10175
- async fsList(path, options) {
10176
- const params = new URLSearchParams();
10177
- if (options?.all) params.set("all", "true");
10178
- if (options?.long) params.set("long", "true");
10179
- appendSessionIdQuery(params, options?.sessionId);
10180
- await this.host.ensureRunning();
10181
- const query = params.toString();
10182
- const basePath = runtimeFilesystemPath("/fs/list", path);
10183
- const url = query ? `${basePath}?${query}` : basePath;
10184
- return ((await readResponseJson(await this.host.runtimeFetch(url, { method: "GET" }))).data?.entries ?? []).map((e) => ({
10185
- name: e.name,
10186
- path: e.path,
10187
- size: e.size,
10188
- isDir: e.isDir,
10189
- isFile: e.isFile,
10190
- isSymlink: e.isSymlink,
10191
- permissions: e.permissions,
10192
- owner: e.owner,
10193
- group: e.group,
10194
- modTime: new Date(e.modTime),
10195
- accessTime: new Date(e.accessTime)
10196
- }));
10197
- }
10198
- async fsStat(path) {
10199
- await this.host.ensureRunning();
10200
- const e = (await readResponseJson(await this.host.runtimeFetch(runtimeFilesystemPath("/fs/stat", path), { method: "GET" }))).data;
10201
- return {
10202
- name: e.name,
10203
- path: e.path,
10204
- size: e.size,
10205
- isDir: e.isDir,
10206
- isFile: e.isFile,
10207
- isSymlink: e.isSymlink,
10208
- permissions: e.permissions,
10209
- owner: e.owner,
10210
- group: e.group,
10211
- modTime: new Date(e.modTime),
10212
- accessTime: new Date(e.accessTime)
10213
- };
10214
- }
10215
- async fsDelete(path, options) {
10216
- const params = new URLSearchParams();
10217
- if (options?.recursive) params.set("recursive", "true");
10218
- const hasSessionScope = appendSessionIdQuery(params, options?.sessionId);
10219
- await this.host.ensureRunning();
10220
- if (hasSessionScope && !options?.recursive) {
10221
- const response = await this.host.runtimeFetch(`/files/delete?${params}`, {
10222
- method: "POST",
10223
- body: JSON.stringify({ path })
10224
- });
10225
- if (!response.ok) throw await parseResponseError(response);
10226
- return;
10227
- }
10228
- const query = params.toString();
10229
- const basePath = runtimeFilesystemPath("/fs", path);
10230
- const url = query ? `${basePath}?${query}` : basePath;
10231
- const response = await this.host.runtimeFetch(url, { method: "DELETE" });
10232
- if (!response.ok) throw await parseResponseError(response);
10233
- }
10234
10719
  async fsRename(sourcePath, destinationPath, options) {
10235
10720
  return this.host.runtime().renameFile(sourcePath, destinationPath, options);
10236
10721
  }
10237
- async fsMkdir(path, options) {
10238
- await this.host.ensureRunning();
10239
- const params = new URLSearchParams();
10240
- if (options?.recursive) params.set("recursive", "true");
10241
- const query = params.toString();
10242
- const basePath = runtimeFilesystemPath("/fs/mkdir", path);
10243
- const url = query ? `${basePath}?${query}` : basePath;
10244
- const response = await this.host.runtimeFetch(url, { method: "POST" });
10245
- if (!response.ok) throw await parseResponseError(response);
10246
- }
10247
- async fsExists(path) {
10248
- await this.host.ensureRunning();
10249
- return (await readResponseJson(await this.host.runtimeFetch(runtimeFilesystemPath("/fs/exists", path), { method: "GET" }))).data?.exists === true;
10250
- }
10251
10722
  };
10252
10723
  //#endregion
10253
10724
  //#region src/sandbox-interactive-terminal.ts
@@ -10473,7 +10944,7 @@ var SandboxInteractiveTerminalOperations = class {
10473
10944
  origin: "runtime",
10474
10945
  endpoint: `/agents/sessions/${encodeURIComponent(id)}/interactive`
10475
10946
  }, "INTERACTIVE_SESSION_EXITED");
10476
- if (canonicalCandidateDigest$1(status.ref) !== canonicalCandidateDigest$1(exactRef)) throw new ValidationError("Interactive attach ref does not match the current session");
10947
+ if (canonicalCandidateDigest(status.ref) !== canonicalCandidateDigest(exactRef)) throw new ValidationError("Interactive attach ref does not match the current session");
10477
10948
  return exactRef;
10478
10949
  }
10479
10950
  /**