@tangle-network/sandbox 1.0.500 → 1.0.502
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.
- package/README.md +2 -0
- package/dist/agent/index.js +5 -5
- package/dist/agent/preview.js +1 -1
- package/dist/{api-request-DSDjbyYV.js → api-request-BOY5Oo4e.js} +1 -1
- package/dist/{browser-interactive-control-controller-D8E9oHyL.js → browser-interactive-control-controller-DVGzcq3L.js} +1 -1
- package/dist/{chunked-upload-C84EiOec.js → chunked-upload-DBcoeSaY.js} +1 -1
- package/dist/{chunked-upload-file-CtoNGE4S.js → chunked-upload-file-Cxmzlt7a.js} +1 -1
- package/dist/{client-CRwjq9NU.js → client-gnipGxVD.js} +9 -8
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-Dn27PtkF.js → collaboration-DoKV1hRL.js} +2 -2
- package/dist/core.js +5 -5
- package/dist/{direct-http2-DiJOMM8k.js → direct-http2-76yKngho.js} +2 -2
- package/dist/{errors-DVjaZqJT.js → errors-DkSlRgmz.js} +14 -2
- package/dist/{file-download-C6BO_rTp.js → file-download-DzMU3oTM.js} +1 -1
- package/dist/gpu-lease/index.js +1 -1
- package/dist/index.js +11 -11
- package/dist/intelligence/index.js +3 -3
- package/dist/interactive-control.js +1 -1
- package/dist/{interactive-controller-B8gEKed9.js → interactive-controller-ByjyFiG4.js} +6 -30
- package/dist/{keep-alive-fetch-D76rml5I.js → keep-alive-fetch-BsWauyqz.js} +86 -6
- package/dist/{lines-N7p7PrZ1.js → lines-C5d-ZQV8.js} +1 -1
- package/dist/lines.js +1 -1
- package/dist/{mcp-local-0BxGYbxI.js → mcp-local-BSAp9YEL.js} +2 -2
- package/dist/public-templates.js +1 -1
- package/dist/{raw-evidence-archive-B7_0tFYq.js → raw-evidence-archive-Cv1bz40t.js} +1 -1
- package/dist/runtime.js +5 -5
- package/dist/{sandbox-DD-bhdf3.js → sandbox-C5vHrnpW.js} +15 -26
- package/dist/{select-seat-CAnEAObc.js → select-seat-C06uoKc5.js} +1 -1
- package/dist/select-seat-command.js +2 -2
- package/dist/session-gateway/index.js +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-BVJ5I1Ki.js → tangle-CAXw7tPL.js} +3 -3
- package/dist/{trace-id-BwKjBM-q.js → trace-id-CHtsS3t1.js} +26 -2
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -24,6 +24,8 @@ Every account-authenticated request from the [shared raw transport](src/lib/api-
|
|
|
24
24
|
|
|
25
25
|
## Timeouts and retries
|
|
26
26
|
|
|
27
|
+
On supported Node runtimes, concurrent HTTPS requests to a Sandbox API origin share HTTP/2 connections when the server negotiates HTTP/2. HTTP/1.1 servers can process long and short requests concurrently. The SDK calls the application’s fetch function and honors an explicit request dispatcher.
|
|
28
|
+
|
|
27
29
|
Every HTTP request has a default deadline, including direct runtime, Platform, browser control, collaboration and Tangle operator calls. [`SDK_TIMEOUTS`](src/lib/api-request.mjs) owns the values (milliseconds); import it from `@tangle-network/sandbox`. `SandboxConfig.timeoutMs` replaces `default`; an operation's own timeout replaces that client default. Caller cancellation still applies.
|
|
28
30
|
|
|
29
31
|
| Calls | Default policy |
|
package/dist/agent/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-
|
|
2
|
-
import {
|
|
3
|
-
import { t as SandboxInstance } from "../sandbox-
|
|
4
|
-
import { O as ValidationError, T as StateError, v as NotFoundError } from "../errors-
|
|
5
|
-
import { t as Sandbox } from "../client-
|
|
1
|
+
import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-BSAp9YEL.js";
|
|
2
|
+
import { x as assertCurrentBackendType } from "../interactive-controller-ByjyFiG4.js";
|
|
3
|
+
import { t as SandboxInstance } from "../sandbox-C5vHrnpW.js";
|
|
4
|
+
import { O as ValidationError, T as StateError, v as NotFoundError } from "../errors-DkSlRgmz.js";
|
|
5
|
+
import { t as Sandbox } from "../client-gnipGxVD.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/agent/instances.ts
|
|
8
8
|
const managers = /* @__PURE__ */ new WeakMap();
|
package/dist/agent/preview.js
CHANGED
|
@@ -66,7 +66,7 @@ async function servePreviewMcp(request, config) {
|
|
|
66
66
|
if (typeof config.authorize !== "function") throw new Error("Preview MCP requires a host authorization callback");
|
|
67
67
|
const tools = config.tools ?? PREVIEW_TOOLS;
|
|
68
68
|
if (!tools.length || tools.some((tool) => !PREVIEW_TOOLS.includes(tool))) throw new Error("Preview MCP requires an explicit nonempty preview-only tool grant");
|
|
69
|
-
const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-
|
|
69
|
+
const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-BSAp9YEL.js").then((n) => n.n), import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js")]);
|
|
70
70
|
const handle = await createMcpServer(config.box, {
|
|
71
71
|
name: "tangle-previews",
|
|
72
72
|
sessionId: config.sessionId,
|
|
@@ -30,7 +30,7 @@ function rewrapResponse(original, headers, body = original.body) {
|
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/lib/api-request.mjs
|
|
32
32
|
/** The package version tsdown.config.ts defines; unbuilt source reports 0.0.0. */
|
|
33
|
-
const SDK_VERSION = "1.0.
|
|
33
|
+
const SDK_VERSION = "1.0.502";
|
|
34
34
|
function withRequestContextHeaders(response, path, method, body = response.body) {
|
|
35
35
|
const headers = new Headers(response.headers);
|
|
36
36
|
headers.set("x-tangle-request-path", path);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { C as boundedEventContentRecordSchema, D as boundedJsonSchema, E as boundedJsonRecordSchema, O as boundedStringSchema, S as boundedEventContentJsonSchema, T as boundedIdentifierSchema, k as isBoundedEventContentJson, s as canonicalCandidateDigest, v as sha256DigestSchema, w as boundedEventContentStringSchema, x as CONTRACT_MAX_STRING_LENGTH, y as CONTRACT_MAX_ARRAY_LENGTH } from "./harness-QlDF8rzb.js";
|
|
2
2
|
import { t as agentExecutionPreparationReceiptSchema } from "./agent-execution-preparation-receipt-Cc9RZhlS.js";
|
|
3
3
|
import { t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
|
|
4
|
-
import { i as fetchSandboxApi } from "./api-request-
|
|
4
|
+
import { i as fetchSandboxApi } from "./api-request-BOY5Oo4e.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.28/node_modules/@tangle-network/agent-interface/dist/native-session-event.js
|
|
7
7
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as SandboxError, n as isTransientWrite, r as parseErrorResponse } from "./errors-
|
|
1
|
+
import { C as SandboxError, n as isTransientWrite, r as parseErrorResponse } from "./errors-DkSlRgmz.js";
|
|
2
2
|
import { c as retryBudget, i as awaitResend, n as SANDBOX_API_RETRY_SCOPE, r as abortableSleep } from "./retry-policy-oW3_ljoc.js";
|
|
3
3
|
import { i as FILE_UPLOAD_SESSION_MAX_BYTES, n as isFileTooLargeErrorBody, r as isPayloadTooLargeErrorBody } from "./file-transfer-DOSTbUSR.js";
|
|
4
4
|
//#region src/lib/sdk-retry.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as FILE_UPLOAD_SESSION_MAX_BYTES } from "./file-transfer-DOSTbUSR.js";
|
|
2
|
-
import { a as partWire, i as partCount, n as commitSession, o as planCompression, r as initUploadSession, s as putPart, t as abortSession } from "./chunked-upload-
|
|
2
|
+
import { a as partWire, i as partCount, n as commitSession, o as planCompression, r as initUploadSession, s as putPart, t as abortSession } from "./chunked-upload-DBcoeSaY.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { open } from "node:fs/promises";
|
|
5
5
|
//#region src/lib/chunked-upload-file.ts
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as normalizeRuntimeBackendConfig, D as withoutCreateOnlyModelFields, E as withProfileHarness, I as backendTypeSchema, _ as encodePromptForWire, b as applyRequestedModel, o as requestInteractiveSessionToken, x as assertCurrentBackendType } from "./interactive-controller-ByjyFiG4.js";
|
|
2
2
|
import { r as agentProfileSchema } from "./profile-schema-BHeC7cOf.js";
|
|
3
|
-
import { $ as isCapacityShortageCreateError, B as parseLifecycleTimes, E as validateDeferredProfileFileMounts, F as normalizeCaptureProof, G as normalizeSandboxShape, H as normalizeConnection, I as normalizeSandboxCreateReceipt, J as DEPLOY_WINDOW_RETRY_MS, K as CAPACITY_ETA_MARGIN_MS, L as normalizeStartupDiagnostics, P as DirectRuntimeHttpClient, Q as generateIdempotencyKey, T as splitInlineProfileSkills, U as normalizeEgressPolicyFields, V as state, W as normalizeProxySecretReceipt, X as createRetryDelayMs, Y as awaitCreateResend, Z as extendableDeadline, d as sandboxLedgerUsd, et as isDeployWindowCreateError,
|
|
4
|
-
import { C as SandboxError, D as TimeoutError, O as ValidationError, _ as NetworkError, a as readResponseJson, c as AuthError, i as parseResponseError, r as parseErrorResponse, v as NotFoundError, w as ServerError, y as PartialFailureError } from "./errors-
|
|
3
|
+
import { $ as isCapacityShortageCreateError, B as parseLifecycleTimes, E as validateDeferredProfileFileMounts, F as normalizeCaptureProof, G as normalizeSandboxShape, H as normalizeConnection, I as normalizeSandboxCreateReceipt, J as DEPLOY_WINDOW_RETRY_MS, K as CAPACITY_ETA_MARGIN_MS, L as normalizeStartupDiagnostics, P as DirectRuntimeHttpClient, Q as generateIdempotencyKey, T as splitInlineProfileSkills, U as normalizeEgressPolicyFields, V as state, W as normalizeProxySecretReceipt, X as createRetryDelayMs, Y as awaitCreateResend, Z as extendableDeadline, d as sandboxLedgerUsd, et as isDeployWindowCreateError, n as createSandboxInstanceFromResponse, nt as isRetryableCreateError, o as exportTraceBundle, q as CAPACITY_ETA_WAIT_MAX_MS, rt as runtimeWorkspaceCwdSchema, tt as isRateLimitCreateError, w as splitInlineProfileFileMounts, x as deleteSandbox, z as dateOf } from "./sandbox-C5vHrnpW.js";
|
|
4
|
+
import { C as SandboxError, D as TimeoutError, O as ValidationError, _ as NetworkError, a as readResponseJson, c as AuthError, i as parseResponseError, k as SANDBOX_CREATE_DEADLINE_HEADER, r as parseErrorResponse, v as NotFoundError, w as ServerError, y as PartialFailureError } from "./errors-DkSlRgmz.js";
|
|
5
5
|
import { n as combineAbortSignals } from "./abort-signal-BsriwJ8L.js";
|
|
6
6
|
import { r as abortableSleep, t as RETRY_POLICY } from "./retry-policy-oW3_ljoc.js";
|
|
7
|
-
import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-
|
|
7
|
+
import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-BOY5Oo4e.js";
|
|
8
8
|
import { l as SANDBOX_AGENT_HOME } from "./file-transfer-DOSTbUSR.js";
|
|
9
|
-
import { i as resolveTraceId } from "./trace-id-
|
|
10
|
-
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-
|
|
9
|
+
import { c as isBrowserRuntime, i as resolveTraceId } from "./trace-id-CHtsS3t1.js";
|
|
10
|
+
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-BsWauyqz.js";
|
|
11
11
|
import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
|
|
12
|
-
import { t as LinesClient } from "./lines-
|
|
12
|
+
import { t as LinesClient } from "./lines-C5d-ZQV8.js";
|
|
13
13
|
import { PublicTemplatesClient } from "./public-templates.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
//#region ../../../packages/runtime-contracts/dist/git-policy.js
|
|
@@ -1310,7 +1310,8 @@ var SandboxTransport = class {
|
|
|
1310
1310
|
}),
|
|
1311
1311
|
fetchImpl: (url, init) => fetchWithKeepAlive(url, init, {
|
|
1312
1312
|
onTiming: this.onTiming,
|
|
1313
|
-
path
|
|
1313
|
+
path,
|
|
1314
|
+
control: true
|
|
1314
1315
|
})
|
|
1315
1316
|
}, path, options, fetchOptions);
|
|
1316
1317
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-
|
|
1
|
+
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-DoKV1hRL.js";
|
|
2
2
|
export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as TimeoutError, _ as NetworkError, r as parseErrorResponse } from "./errors-
|
|
2
|
-
import { i as fetchSandboxApi } from "./api-request-
|
|
1
|
+
import { D as TimeoutError, _ as NetworkError, r as parseErrorResponse } from "./errors-DkSlRgmz.js";
|
|
2
|
+
import { i as fetchSandboxApi } from "./api-request-BOY5Oo4e.js";
|
|
3
3
|
//#region src/collaboration/client.ts
|
|
4
4
|
function normalizeBaseUrl(url) {
|
|
5
5
|
return url.replace(/\/+$/, "");
|
package/dist/core.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as ManagedProcessClient, r as WorkspaceImages, t as SandboxInstance } from "./sandbox-
|
|
2
|
-
import { C as SandboxError, D as TimeoutError, O as ValidationError, T as StateError, _ as NetworkError, b as ProfileFileMountPathError, c as AuthError, m as FileWriteConflictError, o as responseMetadata, r as parseErrorResponse, u as CapabilityError, v as NotFoundError, w as ServerError, x as QuotaError, y as PartialFailureError } from "./errors-
|
|
3
|
-
import { a as InstancesClient, c as backendRegistryCapabilitiesSchema, d as backendRegistryResponseSchema, f as isBackendRegistryInteractionKind, i as InstanceRestartingError, l as backendRegistryEntrySchema, m as parseBackendRegistryResponseBody, p as parseBackendRegistryResponse, r as HostedInstance, t as Sandbox, u as backendRegistryInteractionKindSchema } from "./client-
|
|
4
|
-
import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-
|
|
1
|
+
import { S as ManagedProcessClient, r as WorkspaceImages, t as SandboxInstance } from "./sandbox-C5vHrnpW.js";
|
|
2
|
+
import { C as SandboxError, D as TimeoutError, O as ValidationError, T as StateError, _ as NetworkError, b as ProfileFileMountPathError, c as AuthError, m as FileWriteConflictError, o as responseMetadata, r as parseErrorResponse, u as CapabilityError, v as NotFoundError, w as ServerError, x as QuotaError, y as PartialFailureError } from "./errors-DkSlRgmz.js";
|
|
3
|
+
import { a as InstancesClient, c as backendRegistryCapabilitiesSchema, d as backendRegistryResponseSchema, f as isBackendRegistryInteractionKind, i as InstanceRestartingError, l as backendRegistryEntrySchema, m as parseBackendRegistryResponseBody, p as parseBackendRegistryResponse, r as HostedInstance, t as Sandbox, u as backendRegistryInteractionKindSchema } from "./client-gnipGxVD.js";
|
|
4
|
+
import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-C5d-ZQV8.js";
|
|
5
5
|
import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
|
|
6
6
|
import { a as parseLineApplicationResult, i as parseLineApplicationRequest, n as LINE_APPLICATION_REPLY_MAX_CHARS, o as sandboxFailureKind, r as LINE_APPLICATION_REQUEST_MAX_BYTES, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-CBWUEURz.js";
|
|
7
|
-
import { a as createSelectSeat, i as SeatSelectionError, o as gatewaySeatTransport } from "./select-seat-
|
|
7
|
+
import { a as createSelectSeat, i as SeatSelectionError, o as gatewaySeatTransport } from "./select-seat-C06uoKc5.js";
|
|
8
8
|
export { AuthError, CapabilityError, FileWriteConflictError, HostedInstance, ISOLATED_CREATION_ATTESTATION_VERSION, InstanceRestartingError, InstancesClient, LINE_APPLICATION_REPLY_MAX_CHARS, LINE_APPLICATION_REQUEST_MAX_BYTES, LinesClient, ManagedProcessClient, NetworkError, NotFoundError, PartialFailureError, ProfileFileMountPathError, PublicTemplatePublishError, PublicTemplatesClient, QuotaError, Sandbox, SandboxError, SandboxInstance, SeatSelectionError, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, createSelectSeat, gatewaySeatTransport, isBackendRegistryInteractionKind, lineInstanceKey, parseBackendRegistryResponse, parseBackendRegistryResponseBody, parseErrorResponse, parseLineApplicationRequest, parseLineApplicationResult, profileChannelReference, responseMetadata, sandboxFailureKind };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as responseTraceId } from "./trace-id-
|
|
2
|
-
import { t as emitTiming } from "./keep-alive-fetch-
|
|
1
|
+
import { a as responseTraceId } from "./trace-id-CHtsS3t1.js";
|
|
2
|
+
import { t as emitTiming } from "./keep-alive-fetch-BsWauyqz.js";
|
|
3
3
|
//#region src/lib/direct-http2.ts
|
|
4
4
|
const sessions = /* @__PURE__ */ new Map();
|
|
5
5
|
const inFlight = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { n as HOST_AGENT_RESTART_KINDS, r as catalogEntry, t as ERROR_CATALOG } from "./error-catalog-DMNep7Y3.js";
|
|
2
2
|
import { n as plannedRestartDeadline, t as parseSandboxRetryAfterHeader } from "./retry-after-header-DyAWSQ4m.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region ../../../packages/runtime-contracts/dist/project-create-admission.js
|
|
5
|
+
/** The caller's absolute create deadline (epoch ms), the same on every POST of one create. */
|
|
6
|
+
const SANDBOX_CREATE_DEADLINE_HEADER = "X-Sandbox-Create-Deadline-Ms";
|
|
7
|
+
z.union([z.string().uuid().transform((attemptId) => ({
|
|
8
|
+
attemptId,
|
|
9
|
+
projectRefs: []
|
|
10
|
+
})), z.object({
|
|
11
|
+
attemptId: z.string().uuid(),
|
|
12
|
+
projectRefs: z.array(z.string().min(1).max(200)).max(2)
|
|
13
|
+
}).strict()]);
|
|
14
|
+
//#endregion
|
|
3
15
|
//#region src/error-classes.ts
|
|
4
16
|
const STATUS_CODE = {
|
|
5
17
|
400: "VALIDATION_ERROR",
|
|
@@ -322,7 +334,7 @@ function parseErrorResponse(status, body, context, headers) {
|
|
|
322
334
|
...capacityRefusalMetadata(data),
|
|
323
335
|
sidecarVersion: headers?.get("x-sidecar-version") ?? void 0,
|
|
324
336
|
containerImage: headers?.get("x-sidecar-image") ?? headers?.get("x-sidecar-image-tag") ?? void 0,
|
|
325
|
-
createFailureDisposition: context?.allPreviousCreateAttemptsRefused === true && (context.method ?? headers?.get("x-tangle-request-method")) === "POST" && (context.path ?? headers?.get("x-tangle-request-path")) === "/v1/sandboxes" && status === 429 && (code === "RATE_LIMIT_EXCEEDED" || code === "QUOTA_EXCEEDED" || code === "PLATFORM_RATE_LIMITED") ? "not-admitted" : void 0
|
|
337
|
+
createFailureDisposition: context?.allPreviousCreateAttemptsRefused === true && (context.method ?? headers?.get("x-tangle-request-method")) === "POST" && (context.path ?? headers?.get("x-tangle-request-path")) === "/v1/sandboxes" && (status === 429 && (code === "RATE_LIMIT_EXCEEDED" || code === "QUOTA_EXCEEDED" || code === "PLATFORM_RATE_LIMITED") || status === 400 && code === "VALIDATION_ERROR" && headers?.get("X-Sandbox-Create-Disposition") === "not-admitted") ? "not-admitted" : void 0
|
|
326
338
|
};
|
|
327
339
|
const source = wireFields(data, errorObj, data.details);
|
|
328
340
|
const serverNextStep = [data.nextStep, typeof errorObj === "object" ? errorObj?.nextStep : void 0].find((step) => typeof step === "string" && !!step.trim());
|
|
@@ -372,4 +384,4 @@ function readResponseJson(response) {
|
|
|
372
384
|
*/
|
|
373
385
|
var TerminalStreamError = class extends SandboxError {};
|
|
374
386
|
//#endregion
|
|
375
|
-
export { SandboxError as C, TimeoutError as D, StreamInterruptedError as E, ValidationError as O, ResumeEnvRequiredError as S, StateError as T, NetworkError as _, readResponseJson as a, ProfileFileMountPathError as b, AuthError as c, CompliancePlacementError as d, EdgeNotReadyError as f, KeyBudgetExhaustedError as g, GpuProviderNotConfiguredError as h, parseResponseError as i, BranchFanoutExceedsHostError as l, FileWriteConflictError as m, isTransientWrite as n, responseMetadata as o, EgressProxyRecoveryError as p, parseErrorResponse as r, retryWhen as s, TerminalStreamError as t, CapabilityError as u, NotFoundError as v, ServerError as w, QuotaError as x, PartialFailureError as y };
|
|
387
|
+
export { SandboxError as C, TimeoutError as D, StreamInterruptedError as E, ValidationError as O, ResumeEnvRequiredError as S, StateError as T, NetworkError as _, readResponseJson as a, ProfileFileMountPathError as b, AuthError as c, CompliancePlacementError as d, EdgeNotReadyError as f, KeyBudgetExhaustedError as g, GpuProviderNotConfiguredError as h, parseResponseError as i, SANDBOX_CREATE_DEADLINE_HEADER as k, BranchFanoutExceedsHostError as l, FileWriteConflictError as m, isTransientWrite as n, responseMetadata as o, EgressProxyRecoveryError as p, parseErrorResponse as r, retryWhen as s, TerminalStreamError as t, CapabilityError as u, NotFoundError as v, ServerError as w, QuotaError as x, PartialFailureError as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as bytesToHex, t as sha256 } from "./sha2--74Uh_Sg.js";
|
|
2
|
-
import { O as ValidationError } from "./errors-
|
|
2
|
+
import { O as ValidationError } from "./errors-DkSlRgmz.js";
|
|
3
3
|
import { n as combineAbortSignals } from "./abort-signal-BsriwJ8L.js";
|
|
4
4
|
//#region src/lib/file-download.ts
|
|
5
5
|
function downloadBounds(options) {
|
package/dist/gpu-lease/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as fetchSandboxApi } from "../api-request-
|
|
1
|
+
import { i as fetchSandboxApi } from "../api-request-BOY5Oo4e.js";
|
|
2
2
|
import { t as ITangleJobsAbi } from "../abi-pcDt2Adp.js";
|
|
3
3
|
import { createPublicClient, createWalletClient, decodeAbiParameters, encodeAbiParameters, encodeFunctionData, hexToBytes, http, keccak256, parseAbi, parseAbiParameters, parseEventLogs, recoverMessageAddress, stringToHex } from "viem";
|
|
4
4
|
import { privateKeyToAccount } from "viem/accounts";
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as deriveAgentResultOutcome, C as normalizeRuntimeBackendConfig, F as ALL_BACKEND_TYPES, I as backendTypeSchema, L as isolationPrincipalSchema, M as projectAgentTerminalRecord, N as TERMINAL_WS_ECHO_SUBPROTOCOL, i as terminalUpgradeHeadersSupported, j as deriveAgentRunOutcome, k as createAgentRunOutcomeTracker, n as InteractiveSessionController, r as TerminalStream, t as BrowserInteractiveSessionController, w as requestedPublicProfileDigest, z as parseBackendType } from "./interactive-controller-ByjyFiG4.js";
|
|
2
2
|
import { a as SANDBOX_SIZE_PRESET_NAMES, r as agentProfileSchema, t as agentProfileConfidentialSchema } from "./profile-schema-BHeC7cOf.js";
|
|
3
|
-
import { A as isMaterializerHarness, C as materializeProfileFileMounts, D as HARNESS_LAUNCH_MATERIALIZE_OPTIONS, E as validateDeferredProfileFileMounts, M as SandboxOperation, N as SandboxOperationFailedError, O as ProfileUnsupportedError, S as ManagedProcessClient, T as splitInlineProfileSkills, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, f as InteractiveSessionHandle, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, j as materializeProfile, k as enforceWorkspacePlanSupport, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as exportTraceBundle, p as InteractiveTerminalFrameLog, r as WorkspaceImages, rt as runtimeWorkspaceCwdSchema, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as collectAgentResponseText, w as splitInlineProfileFileMounts, y as getSandboxEventText } from "./sandbox-
|
|
4
|
-
import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, k as agentInteractiveSessionPromptRequestDigest, l as createInteractiveControlHolderId, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController, u as interactiveSessionIdentityDigest } from "./browser-interactive-control-controller-
|
|
5
|
-
import { C as SandboxError, D as TimeoutError, E as StreamInterruptedError, O as ValidationError, S as ResumeEnvRequiredError, T as StateError, _ as NetworkError, b as ProfileFileMountPathError, c as AuthError, d as CompliancePlacementError, f as EdgeNotReadyError, g as KeyBudgetExhaustedError, h as GpuProviderNotConfiguredError, l as BranchFanoutExceedsHostError, m as FileWriteConflictError, o as responseMetadata, p as EgressProxyRecoveryError, r as parseErrorResponse, t as TerminalStreamError, u as CapabilityError, v as NotFoundError, w as ServerError, x as QuotaError, y as PartialFailureError } from "./errors-
|
|
6
|
-
import { _ as validateBatchRunRequest, a as InstancesClient, c as backendRegistryCapabilitiesSchema, d as backendRegistryResponseSchema, f as isBackendRegistryInteractionKind, g as createBatchResultAccumulator, h as IntelligenceClient, i as InstanceRestartingError, l as backendRegistryEntrySchema, m as parseBackendRegistryResponseBody, n as RunsClient, o as SandboxFleetClient, p as parseBackendRegistryResponse, r as HostedInstance, s as SandboxFleet, t as Sandbox, u as backendRegistryInteractionKindSchema } from "./client-
|
|
7
|
-
import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-
|
|
8
|
-
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-
|
|
3
|
+
import { A as isMaterializerHarness, C as materializeProfileFileMounts, D as HARNESS_LAUNCH_MATERIALIZE_OPTIONS, E as validateDeferredProfileFileMounts, M as SandboxOperation, N as SandboxOperationFailedError, O as ProfileUnsupportedError, S as ManagedProcessClient, T as splitInlineProfileSkills, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, f as InteractiveSessionHandle, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, j as materializeProfile, k as enforceWorkspacePlanSupport, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as exportTraceBundle, p as InteractiveTerminalFrameLog, r as WorkspaceImages, rt as runtimeWorkspaceCwdSchema, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as collectAgentResponseText, w as splitInlineProfileFileMounts, y as getSandboxEventText } from "./sandbox-C5vHrnpW.js";
|
|
4
|
+
import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, k as agentInteractiveSessionPromptRequestDigest, l as createInteractiveControlHolderId, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController, u as interactiveSessionIdentityDigest } from "./browser-interactive-control-controller-DVGzcq3L.js";
|
|
5
|
+
import { C as SandboxError, D as TimeoutError, E as StreamInterruptedError, O as ValidationError, S as ResumeEnvRequiredError, T as StateError, _ as NetworkError, b as ProfileFileMountPathError, c as AuthError, d as CompliancePlacementError, f as EdgeNotReadyError, g as KeyBudgetExhaustedError, h as GpuProviderNotConfiguredError, l as BranchFanoutExceedsHostError, m as FileWriteConflictError, o as responseMetadata, p as EgressProxyRecoveryError, r as parseErrorResponse, t as TerminalStreamError, u as CapabilityError, v as NotFoundError, w as ServerError, x as QuotaError, y as PartialFailureError } from "./errors-DkSlRgmz.js";
|
|
6
|
+
import { _ as validateBatchRunRequest, a as InstancesClient, c as backendRegistryCapabilitiesSchema, d as backendRegistryResponseSchema, f as isBackendRegistryInteractionKind, g as createBatchResultAccumulator, h as IntelligenceClient, i as InstanceRestartingError, l as backendRegistryEntrySchema, m as parseBackendRegistryResponseBody, n as RunsClient, o as SandboxFleetClient, p as parseBackendRegistryResponse, r as HostedInstance, s as SandboxFleet, t as Sandbox, u as backendRegistryInteractionKindSchema } from "./client-gnipGxVD.js";
|
|
7
|
+
import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-BOY5Oo4e.js";
|
|
8
|
+
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-DoKV1hRL.js";
|
|
9
9
|
import "./file-transfer-DOSTbUSR.js";
|
|
10
10
|
import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
|
|
11
|
-
import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-
|
|
12
|
-
import { t as downloadFile } from "./file-download-
|
|
11
|
+
import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-C5d-ZQV8.js";
|
|
12
|
+
import { t as downloadFile } from "./file-download-DzMU3oTM.js";
|
|
13
13
|
import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
|
|
14
14
|
import { a as parseLineApplicationResult, i as parseLineApplicationRequest, n as LINE_APPLICATION_REPLY_MAX_CHARS, o as sandboxFailureKind, r as LINE_APPLICATION_REQUEST_MAX_BYTES, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-CBWUEURz.js";
|
|
15
|
-
import { a as createSelectSeat, i as SeatSelectionError, o as gatewaySeatTransport } from "./select-seat-
|
|
16
|
-
import { s as BlueprintSandboxClient } from "./tangle-
|
|
15
|
+
import { a as createSelectSeat, i as SeatSelectionError, o as gatewaySeatTransport } from "./select-seat-C06uoKc5.js";
|
|
16
|
+
import { s as BlueprintSandboxClient } from "./tangle-CAXw7tPL.js";
|
|
17
17
|
import { z } from "zod";
|
|
18
18
|
//#region ../../../packages/runtime-contracts/dist/model-key-proxy.js
|
|
19
19
|
const MANAGED_MODEL_KEY_SENTINEL = "proxy-managed-per-request";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as TimeoutError, _ as NetworkError, r as parseErrorResponse, u as CapabilityError } from "../errors-
|
|
2
|
-
import { i as fetchSandboxApi } from "../api-request-
|
|
3
|
-
import { n as verifyDownload } from "../file-download-
|
|
1
|
+
import { D as TimeoutError, _ as NetworkError, r as parseErrorResponse, u as CapabilityError } from "../errors-DkSlRgmz.js";
|
|
2
|
+
import { i as fetchSandboxApi } from "../api-request-BOY5Oo4e.js";
|
|
3
|
+
import { n as verifyDownload } from "../file-download-DzMU3oTM.js";
|
|
4
4
|
import { t as rawEvidenceArchiveAttemptSchema } from "../raw-evidence-export-Dog7W5zP.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/intelligence/run-session-capture.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-
|
|
1
|
+
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-DVGzcq3L.js";
|
|
2
2
|
export { BrowserInteractiveSessionControlController, InteractiveSessionNotRunningError, browserInteractiveControlHolderId };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { D as boundedJsonSchema, T as boundedIdentifierSchema, s as canonicalCandidateDigest } from "./harness-QlDF8rzb.js";
|
|
2
2
|
import { r as agentProfileSchema } from "./profile-schema-BHeC7cOf.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-
|
|
4
|
-
import { O as ValidationError, _ as NetworkError, i as parseResponseError, s as retryWhen, t as TerminalStreamError, u as CapabilityError, w as ServerError } from "./errors-
|
|
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-DVGzcq3L.js";
|
|
4
|
+
import { O as ValidationError, _ as NetworkError, i as parseResponseError, s as retryWhen, t as TerminalStreamError, u as CapabilityError, w as ServerError } from "./errors-DkSlRgmz.js";
|
|
5
5
|
import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
|
|
6
|
-
import { n as SDK_TIMEOUTS } from "./api-request-
|
|
7
|
-
import { c as uploadChunked, l as awaitSdkResend } from "./chunked-upload-
|
|
8
|
-
import { i as resolveTraceId, n as isTraceId, o as traceHeaders, r as mintTraceId, t as TRACE_ID_HEADER } from "./trace-id-
|
|
6
|
+
import { n as SDK_TIMEOUTS } from "./api-request-BOY5Oo4e.js";
|
|
7
|
+
import { c as uploadChunked, l as awaitSdkResend } from "./chunked-upload-DBcoeSaY.js";
|
|
8
|
+
import { i as resolveTraceId, l as isCloudflareWorker, n as isTraceId, o as traceHeaders, r as mintTraceId, t as TRACE_ID_HEADER } from "./trace-id-CHtsS3t1.js";
|
|
9
9
|
import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import { PART_TEXT, PART_TEXT_SUFFIX } from "@tangle-network/agent-core/sse";
|
|
@@ -945,30 +945,6 @@ function requestedSecretProfilePublicDigest(backend) {
|
|
|
945
945
|
}) ?? {});
|
|
946
946
|
}
|
|
947
947
|
//#endregion
|
|
948
|
-
//#region src/lib/runtime-env.ts
|
|
949
|
-
/**
|
|
950
|
-
* True inside a Cloudflare Worker. Under `nodejs_compat` workerd sets
|
|
951
|
-
* `process.versions.node`, but it ships `node:http2` as a stub whose `connect()`
|
|
952
|
-
* throws "The http2.connect method is not implemented", so `process.versions`
|
|
953
|
-
* cannot tell a Worker from Node. The user agent can.
|
|
954
|
-
*/
|
|
955
|
-
function isCloudflareWorker() {
|
|
956
|
-
return globalThis.navigator?.userAgent?.startsWith("Cloudflare-Workers") === true;
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* True in a browser page or a browser Web Worker, where a request is subject
|
|
960
|
-
* to CORS. Box hosts carry no CORS contract, so a browser reads its runtime
|
|
961
|
-
* through the Sandbox API proxy.
|
|
962
|
-
*/
|
|
963
|
-
function isBrowserRuntime() {
|
|
964
|
-
const g = globalThis;
|
|
965
|
-
return !isCloudflareWorker() && (g.document !== void 0 || g.WorkerGlobalScope !== void 0);
|
|
966
|
-
}
|
|
967
|
-
/** True where `node:http2` can open a session: Node, but not a Worker. */
|
|
968
|
-
function canUseNodeHttp2() {
|
|
969
|
-
return typeof process !== "undefined" && typeof process.versions?.node === "string" && !isCloudflareWorker();
|
|
970
|
-
}
|
|
971
|
-
//#endregion
|
|
972
948
|
//#region src/lib/wire-encoding.ts
|
|
973
949
|
/**
|
|
974
950
|
* Encode a prompt text part for the wire. Server decodes at the route
|
|
@@ -2572,4 +2548,4 @@ var BrowserInteractiveSessionController = class extends InteractiveSessionContro
|
|
|
2572
2548
|
}
|
|
2573
2549
|
};
|
|
2574
2550
|
//#endregion
|
|
2575
|
-
export {
|
|
2551
|
+
export { deriveAgentResultOutcome as A, normalizeRuntimeBackendConfig as C, withoutCreateOnlyModelFields as D, withProfileHarness as E, ALL_BACKEND_TYPES as F, backendTypeSchema as I, isolationPrincipalSchema as L, projectAgentTerminalRecord as M, TERMINAL_WS_ECHO_SUBPROTOCOL as N, withoutRuntimeSecrets as O, AgentRuntimeAttachmentsSchema as P, normalizeEffectiveBackend as R, mergeRuntimeBackendConfig as S, requestedSecretProfilePublicDigest as T, encodePromptForWire as _, assertScopedTokenActive as a, applyRequestedModel as b, SandboxRuntimeApi as c, appendSessionIdQuery as d, callHeaders as f, validateAcceptedDispatchRunRef as g, resolveDispatchRunIdentity as h, terminalUpgradeHeadersSupported as i, deriveAgentRunOutcome as j, createAgentRunOutcomeTracker as k, normalizeSessionInfo as l, assertFileWritePreconditions as m, InteractiveSessionController as n, requestInteractiveSessionToken as o, sessionHeaders as p, TerminalStream as r, requestScopedToken as s, BrowserInteractiveSessionController as t, sessionMessageRequestBody as u, encodeTextForWire as v, requestedPublicProfileDigest as w, assertCurrentBackendType as x, runtimeFilesystemPath as y, parseBackendType as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as responseTraceId } from "./trace-id-
|
|
1
|
+
import { a as responseTraceId, c as isBrowserRuntime, s as canUseNodeHttp2 } from "./trace-id-CHtsS3t1.js";
|
|
2
2
|
//#region src/lib/keep-alive-fetch.ts
|
|
3
3
|
/** How long an idle SDK socket stays open. The servers keep theirs open for 35 s and more. */
|
|
4
4
|
const KEEP_ALIVE_TIMEOUT_MS = 6e4;
|
|
@@ -16,6 +16,8 @@ function ms(value) {
|
|
|
16
16
|
}
|
|
17
17
|
let cachedHost;
|
|
18
18
|
let cachedAgent = null;
|
|
19
|
+
let cachedHttp2;
|
|
20
|
+
let origins = /* @__PURE__ */ new Map();
|
|
19
21
|
function readGlobalDispatcher() {
|
|
20
22
|
const read = () => globalThis[GLOBAL_DISPATCHER];
|
|
21
23
|
const host = read();
|
|
@@ -31,12 +33,37 @@ function agentOptions(agent) {
|
|
|
31
33
|
if (value && typeof value === "object") return value;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
|
-
function buildKeepAliveAgent(host) {
|
|
36
|
+
function buildKeepAliveAgent(host, multiplex = false) {
|
|
35
37
|
const AgentClass = Object.getPrototypeOf(host)?.constructor;
|
|
36
38
|
if (typeof AgentClass !== "function" || AgentClass.name !== "Agent") return null;
|
|
37
39
|
const options = agentOptions(host);
|
|
38
40
|
if (!options || options.keepAliveTimeout !== void 0) return null;
|
|
41
|
+
const factory = Object.getOwnPropertySymbols(host).find((key) => key.description === "factory");
|
|
42
|
+
if (factory && host[factory]?.name !== "defaultFactory") return null;
|
|
43
|
+
if (multiplex && (options.allowH2 !== void 0 || options.connections !== void 0 || typeof options.connect === "function" || options.socketPath !== void 0 || [options.connect, options.tls].some((tls) => typeof tls === "object" && tls !== null && "ALPNProtocols" in tls))) return null;
|
|
39
44
|
try {
|
|
45
|
+
if (multiplex) {
|
|
46
|
+
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
47
|
+
if (!major || major < 22 || major === 22 && (minor ?? 0) < 19) return null;
|
|
48
|
+
const load = process.getBuiltinModule("node:module").createRequire(import.meta.url);
|
|
49
|
+
const Agent = load("undici/lib/dispatcher/agent.js");
|
|
50
|
+
const bridge = load("undici/lib/dispatcher/dispatcher1-wrapper.js");
|
|
51
|
+
const pool = new Agent({
|
|
52
|
+
...options,
|
|
53
|
+
allowH2: true,
|
|
54
|
+
preferH2: true,
|
|
55
|
+
connections: 4,
|
|
56
|
+
keepAliveTimeout: KEEP_ALIVE_TIMEOUT_MS
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
dispatch(request, handler) {
|
|
60
|
+
const { method, upgrade, allowH2 } = request;
|
|
61
|
+
if (upgrade || method === "CONNECT" || allowH2 === false) return host.dispatch(request, handler);
|
|
62
|
+
return pool.dispatch(request, bridge.wrapHandler(handler));
|
|
63
|
+
},
|
|
64
|
+
close: () => pool.close()
|
|
65
|
+
};
|
|
66
|
+
}
|
|
40
67
|
return new AgentClass({
|
|
41
68
|
...options,
|
|
42
69
|
keepAliveTimeout: KEEP_ALIVE_TIMEOUT_MS
|
|
@@ -55,9 +82,13 @@ function keepAliveDispatcher() {
|
|
|
55
82
|
if (!host) return void 0;
|
|
56
83
|
if (host !== cachedHost) {
|
|
57
84
|
const previous = cachedAgent;
|
|
85
|
+
const previousHttp2 = cachedHttp2;
|
|
86
|
+
origins = /* @__PURE__ */ new Map();
|
|
87
|
+
cachedHttp2 = void 0;
|
|
58
88
|
cachedHost = host;
|
|
59
89
|
cachedAgent = buildKeepAliveAgent(host);
|
|
60
90
|
Promise.resolve(previous?.close?.()).catch(() => void 0);
|
|
91
|
+
Promise.resolve(previousHttp2?.close?.()).catch(() => void 0);
|
|
61
92
|
}
|
|
62
93
|
return cachedAgent ?? void 0;
|
|
63
94
|
}
|
|
@@ -106,6 +137,7 @@ function subscribeChannels(channels) {
|
|
|
106
137
|
const { request, socket } = message;
|
|
107
138
|
const capture = request ? captures.get(request) : void 0;
|
|
108
139
|
if (!capture) return;
|
|
140
|
+
capture.observeProtocol?.(socket);
|
|
109
141
|
capture.sentAt = now();
|
|
110
142
|
const marks = socket ? socketMarks.get(socket) : void 0;
|
|
111
143
|
if (marks && !marks.claimed) {
|
|
@@ -178,9 +210,53 @@ function phasesOf(capture) {
|
|
|
178
210
|
* call time, so a caller's fetch override still receives the request.
|
|
179
211
|
*/
|
|
180
212
|
async function fetchWithKeepAlive(url, init, options) {
|
|
181
|
-
|
|
213
|
+
const supplied = init.dispatcher;
|
|
214
|
+
const fallback = supplied ?? keepAliveDispatcher();
|
|
215
|
+
if (!options.control || supplied || !fallback || !cachedHost || !url.startsWith("https://") || !canUseNodeHttp2() || isBrowserRuntime() || process.versions.bun || !process.versions.undici) return measuredFetch(url, init, options, fallback);
|
|
216
|
+
if (cachedHttp2 === void 0) cachedHttp2 = buildKeepAliveAgent(cachedHost, true);
|
|
217
|
+
const primary = cachedHttp2;
|
|
218
|
+
if (!primary) return measuredFetch(url, init, options, fallback);
|
|
219
|
+
const origin = new URL(url).origin;
|
|
220
|
+
const table = origins;
|
|
221
|
+
const current = table.get(origin);
|
|
222
|
+
if (current) return measuredFetch(url, init, options, current.selected ?? await awaitProtocol(current.ready, init.signal));
|
|
223
|
+
let select;
|
|
224
|
+
const state = { ready: new Promise((resolve) => {
|
|
225
|
+
select = resolve;
|
|
226
|
+
}) };
|
|
227
|
+
table.set(origin, state);
|
|
228
|
+
const forget = () => {
|
|
229
|
+
if (table.get(origin) === state) table.delete(origin);
|
|
230
|
+
};
|
|
231
|
+
const negotiated = (socket) => {
|
|
232
|
+
if (state.selected) return;
|
|
233
|
+
state.selected = socket?.alpnProtocol === "h2" ? primary : fallback;
|
|
234
|
+
if (socket) socket.once("close", forget);
|
|
235
|
+
else forget();
|
|
236
|
+
select(state.selected);
|
|
237
|
+
};
|
|
238
|
+
try {
|
|
239
|
+
return await measuredFetch(url, init, options, primary, negotiated);
|
|
240
|
+
} finally {
|
|
241
|
+
negotiated();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function awaitProtocol(ready, signal) {
|
|
245
|
+
if (!signal) return ready;
|
|
246
|
+
signal.throwIfAborted();
|
|
247
|
+
return new Promise((resolve, reject) => {
|
|
248
|
+
const abort = () => reject(signal.reason);
|
|
249
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
250
|
+
ready.then((dispatcher) => {
|
|
251
|
+
signal.removeEventListener("abort", abort);
|
|
252
|
+
resolve(dispatcher);
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
async function measuredFetch(url, init, options, baseDispatcher, observeProtocol) {
|
|
257
|
+
let dispatcher = baseDispatcher;
|
|
182
258
|
const hook = options.onTiming;
|
|
183
|
-
if (!hook) return dispatcher ? globalThis.fetch(url, {
|
|
259
|
+
if (!hook && !observeProtocol) return dispatcher ? globalThis.fetch(url, {
|
|
184
260
|
...init,
|
|
185
261
|
dispatcher
|
|
186
262
|
}) : globalThis.fetch(url, init);
|
|
@@ -197,16 +273,19 @@ async function fetchWithKeepAlive(url, init, options) {
|
|
|
197
273
|
});
|
|
198
274
|
capture = {
|
|
199
275
|
startedAt,
|
|
200
|
-
finish
|
|
276
|
+
finish,
|
|
277
|
+
observeProtocol
|
|
201
278
|
};
|
|
202
279
|
dispatcher = tagged(host, capture);
|
|
203
280
|
}
|
|
204
281
|
let response;
|
|
205
282
|
try {
|
|
206
|
-
|
|
283
|
+
const attempt = globalThis.fetch(url, dispatcher ? {
|
|
207
284
|
...init,
|
|
208
285
|
dispatcher
|
|
209
286
|
} : init);
|
|
287
|
+
if (!capture?.request) observeProtocol?.();
|
|
288
|
+
response = await attempt;
|
|
210
289
|
} catch (error) {
|
|
211
290
|
if (capture?.request) captures.delete(capture.request);
|
|
212
291
|
emitTiming(hook, {
|
|
@@ -223,6 +302,7 @@ async function fetchWithKeepAlive(url, init, options) {
|
|
|
223
302
|
});
|
|
224
303
|
throw error;
|
|
225
304
|
}
|
|
305
|
+
if (!hook) return response;
|
|
226
306
|
const report = () => {
|
|
227
307
|
const phases = capture ? phasesOf(capture) : void 0;
|
|
228
308
|
const socket = phases ? capture?.marks ? "new" : "reused" : void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as ValidationError, r as parseErrorResponse } from "./errors-
|
|
1
|
+
import { O as ValidationError, r as parseErrorResponse } from "./errors-DkSlRgmz.js";
|
|
2
2
|
//#region src/line-identity.ts
|
|
3
3
|
/**
|
|
4
4
|
* The instance key that serves one member: `keyPrefix` plus the first 32 hex
|
package/dist/lines.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-
|
|
1
|
+
import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-C5d-ZQV8.js";
|
|
2
2
|
export { LinesClient, SandboxLines, lineInstanceKey, profileChannelReference };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./api-request-
|
|
1
|
+
import "./api-request-BOY5Oo4e.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-BTHZR1w2.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.
|
|
399
|
+
version: options.version ?? "1.0.502"
|
|
400
400
|
}, { capabilities: { tools: {} } });
|
|
401
401
|
server.setRequestHandler(typesModule.ListToolsRequestSchema, async () => ({ tools: bindings.map(({ spec: s }) => ({
|
|
402
402
|
name: s.name,
|
package/dist/public-templates.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as SandboxError, a as readResponseJson } from "./errors-
|
|
1
|
+
import { C as SandboxError, a as readResponseJson } from "./errors-DkSlRgmz.js";
|
|
2
2
|
import { n as combineAbortSignals } from "./abort-signal-BsriwJ8L.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/public-templates.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as verifyDownload } from "./file-download-
|
|
1
|
+
import { n as verifyDownload } from "./file-download-DzMU3oTM.js";
|
|
2
2
|
import { t as runPreparedEvidence } from "./prepared-evidence-BMADfSad.js";
|
|
3
3
|
import { t as rawEvidenceArchiveAttemptSchema } from "./raw-evidence-export-Dog7W5zP.js";
|
|
4
4
|
import { z } from "zod";
|
package/dist/runtime.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-
|
|
3
|
-
import { C as SandboxError, D as TimeoutError, O as ValidationError, T as StateError, _ as NetworkError, b as ProfileFileMountPathError, c as AuthError, m as FileWriteConflictError, u as CapabilityError, v as NotFoundError, w as ServerError, x as QuotaError, y as PartialFailureError } from "./errors-
|
|
4
|
-
import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-
|
|
5
|
-
import { c as uploadChunked } from "./chunked-upload-
|
|
1
|
+
import { A as deriveAgentResultOutcome, M as projectAgentTerminalRecord, c as SandboxRuntimeApi, j as deriveAgentRunOutcome, k as createAgentRunOutcomeTracker, t as BrowserInteractiveSessionController } from "./interactive-controller-ByjyFiG4.js";
|
|
2
|
+
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-DVGzcq3L.js";
|
|
3
|
+
import { C as SandboxError, D as TimeoutError, O as ValidationError, T as StateError, _ as NetworkError, b as ProfileFileMountPathError, c as AuthError, m as FileWriteConflictError, u as CapabilityError, v as NotFoundError, w as ServerError, x as QuotaError, y as PartialFailureError } from "./errors-DkSlRgmz.js";
|
|
4
|
+
import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-BOY5Oo4e.js";
|
|
5
|
+
import { c as uploadChunked } from "./chunked-upload-DBcoeSaY.js";
|
|
6
6
|
//#region src/runtime-client.ts
|
|
7
7
|
function requireToken(token) {
|
|
8
8
|
const value = token.trim();
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as deriveAgentResultOutcome, C as normalizeRuntimeBackendConfig, O as withoutRuntimeSecrets, P as AgentRuntimeAttachmentsSchema, R as normalizeEffectiveBackend, S as mergeRuntimeBackendConfig, T as requestedSecretProfilePublicDigest, _ as encodePromptForWire, a as assertScopedTokenActive, b as applyRequestedModel, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as validateAcceptedDispatchRunRef, h as resolveDispatchRunIdentity, i as terminalUpgradeHeadersSupported, k as createAgentRunOutcomeTracker, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as encodeTextForWire, w as requestedPublicProfileDigest, x as assertCurrentBackendType, y as runtimeFilesystemPath } from "./interactive-controller-ByjyFiG4.js";
|
|
2
2
|
import { O as boundedStringSchema, T as boundedIdentifierSchema, c as canonicalCandidateJson, s as canonicalCandidateDigest, v as sha256DigestSchema } from "./harness-QlDF8rzb.js";
|
|
3
3
|
import { o as ProxySecretReceiptSchema, r as agentProfileSchema } from "./profile-schema-BHeC7cOf.js";
|
|
4
|
-
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-
|
|
4
|
+
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-DVGzcq3L.js";
|
|
5
5
|
import { t as canonicalAgentProfileDigest } from "./agent-execution-preparation-B8PJuIsN.js";
|
|
6
|
-
import { C as SandboxError, D as TimeoutError, E as StreamInterruptedError, O as ValidationError, T as StateError, _ as NetworkError, a as readResponseJson, b as ProfileFileMountPathError, c as AuthError, f as EdgeNotReadyError, i as parseResponseError, n as isTransientWrite, o as responseMetadata, r as parseErrorResponse, s as retryWhen, t as TerminalStreamError, u as CapabilityError, v as NotFoundError, w as ServerError, y as PartialFailureError } from "./errors-
|
|
6
|
+
import { C as SandboxError, D as TimeoutError, E as StreamInterruptedError, O as ValidationError, T as StateError, _ as NetworkError, a as readResponseJson, b as ProfileFileMountPathError, c as AuthError, f as EdgeNotReadyError, i as parseResponseError, k as SANDBOX_CREATE_DEADLINE_HEADER, n as isTransientWrite, o as responseMetadata, r as parseErrorResponse, s as retryWhen, t as TerminalStreamError, u as CapabilityError, v as NotFoundError, w as ServerError, y as PartialFailureError } from "./errors-DkSlRgmz.js";
|
|
7
7
|
import { n as plannedRestartDeadline, r as SIDECAR_PROXY_ERROR_HEADER, t as parseSandboxRetryAfterHeader } from "./retry-after-header-DyAWSQ4m.js";
|
|
8
8
|
import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
|
|
9
9
|
import { a as backoffDelayMs, o as isUndelivered, r as abortableSleep } from "./retry-policy-oW3_ljoc.js";
|
|
10
|
-
import { a as isReplayableBody, i as fetchSandboxApi, n as SDK_TIMEOUTS, o as rewrapResponse, t as IDEMPOTENT_METHODS } from "./api-request-
|
|
10
|
+
import { a as isReplayableBody, i as fetchSandboxApi, n as SDK_TIMEOUTS, o as rewrapResponse, t as IDEMPOTENT_METHODS } from "./api-request-BOY5Oo4e.js";
|
|
11
11
|
import { a as SANDBOX_PROXY_REQUEST_MAX_BYTES, c as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, d as isProfileFileMountOutsideRoots, f as profileFileMountOutsideRootsMessage, l as SANDBOX_AGENT_HOME, o as FILE_OPERATION_LIMITS, t as isInsideReservedDir$1, u as SANDBOX_FILE_API_ABSOLUTE_ROOTS } from "./file-transfer-DOSTbUSR.js";
|
|
12
|
-
import { c as uploadChunked, l as awaitSdkResend, u as takeSdkTurn } from "./chunked-upload-
|
|
13
|
-
import { i as resolveTraceId, n as isTraceId, r as mintTraceId, t as TRACE_ID_HEADER } from "./trace-id-
|
|
14
|
-
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-
|
|
12
|
+
import { c as uploadChunked, l as awaitSdkResend, u as takeSdkTurn } from "./chunked-upload-DBcoeSaY.js";
|
|
13
|
+
import { i as resolveTraceId, n as isTraceId, r as mintTraceId, s as canUseNodeHttp2, t as TRACE_ID_HEADER } from "./trace-id-CHtsS3t1.js";
|
|
14
|
+
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-BsWauyqz.js";
|
|
15
15
|
import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
|
|
16
16
|
import { t as runPreparedProcess } from "./prepared-process-B4DuLmEg.js";
|
|
17
17
|
import { a as isBackendType, r as cliAuthReferenceSchema } from "./cli-auth-bundle-CXI4ysvr-DMV1Pos7.js";
|
|
18
18
|
import "./cli-auth-bundle-DqIHmlbG.js";
|
|
19
|
-
import { n as SandboxLines } from "./lines-
|
|
20
|
-
import { t as downloadFile } from "./file-download-
|
|
19
|
+
import { n as SandboxLines } from "./lines-C5d-ZQV8.js";
|
|
20
|
+
import { t as downloadFile } from "./file-download-DzMU3oTM.js";
|
|
21
21
|
import { z } from "zod";
|
|
22
22
|
import { createHash } from "node:crypto";
|
|
23
23
|
import { constants } from "node:fs";
|
|
@@ -258,17 +258,6 @@ const TerminalReplayWindowSchema = z.strictObject({
|
|
|
258
258
|
latest: z.number().int().nonnegative()
|
|
259
259
|
});
|
|
260
260
|
//#endregion
|
|
261
|
-
//#region ../../../packages/runtime-contracts/dist/project-create-admission.js
|
|
262
|
-
/** The caller's absolute create deadline (epoch ms), the same on every POST of one create. */
|
|
263
|
-
const SANDBOX_CREATE_DEADLINE_HEADER = "X-Sandbox-Create-Deadline-Ms";
|
|
264
|
-
z.union([z.string().uuid().transform((attemptId) => ({
|
|
265
|
-
attemptId,
|
|
266
|
-
projectRefs: []
|
|
267
|
-
})), z.object({
|
|
268
|
-
attemptId: z.string().uuid(),
|
|
269
|
-
projectRefs: z.array(z.string().min(1).max(200)).max(2)
|
|
270
|
-
}).strict()]);
|
|
271
|
-
//#endregion
|
|
272
261
|
//#region ../../../packages/runtime-contracts/dist/workspace-cwd.js
|
|
273
262
|
const MAX_RUNTIME_WORKSPACE_CWD_LENGTH$1 = 4096;
|
|
274
263
|
function hasControlCharacter$3(value) {
|
|
@@ -3034,7 +3023,7 @@ var DirectRuntimeHttpClient = class {
|
|
|
3034
3023
|
const connection = this.getConnection();
|
|
3035
3024
|
const origin = connection?.authToken ? connection.hostUrl : void 0;
|
|
3036
3025
|
if (!origin || !canUseNodeHttp2()) return;
|
|
3037
|
-
import("./direct-http2-
|
|
3026
|
+
import("./direct-http2-76yKngho.js").then(({ preconnectDirectHttp2 }) => preconnectDirectHttp2(origin)).catch(() => {});
|
|
3038
3027
|
}
|
|
3039
3028
|
async fetch(path, options, fetchOptions) {
|
|
3040
3029
|
const throughApi = () => this.baseClient.fetch(path, options, fetchOptions);
|
|
@@ -3119,7 +3108,7 @@ var DirectRuntimeHttpClient = class {
|
|
|
3119
3108
|
};
|
|
3120
3109
|
const observe = this.onDirectRuntimeResponse;
|
|
3121
3110
|
if (!route) throw new NetworkError("Direct runtime route was withdrawn");
|
|
3122
|
-
const { fetchDirectHttp2: transport } = (route.useHost || route.useExec) && canUseNodeHttp2() ? await import("./direct-http2-
|
|
3111
|
+
const { fetchDirectHttp2: transport } = (route.useHost || route.useExec) && canUseNodeHttp2() ? await import("./direct-http2-76yKngho.js") : { fetchDirectHttp2: fetchWithKeepAlive };
|
|
3123
3112
|
return fetchSandboxApi({
|
|
3124
3113
|
baseUrl: route.origin,
|
|
3125
3114
|
timeoutMs: this.baseClient.timeoutMs,
|
|
@@ -15832,7 +15821,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
|
|
|
15832
15821
|
var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabilities {
|
|
15833
15822
|
/** @internal — invoked before the sandbox is deleted. */
|
|
15834
15823
|
async _sessionExportRawEvidence(id, destination, options) {
|
|
15835
|
-
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-
|
|
15824
|
+
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-Cv1bz40t.js");
|
|
15836
15825
|
await this.ensureRunning();
|
|
15837
15826
|
await this.refresh();
|
|
15838
15827
|
return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence/archive?${new URLSearchParams([
|
|
@@ -15863,7 +15852,7 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
|
|
|
15863
15852
|
* and the byte and file bounds are verified before the directory appears.
|
|
15864
15853
|
*/
|
|
15865
15854
|
async exportRawEvidence(destination, options) {
|
|
15866
|
-
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-
|
|
15855
|
+
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-Cv1bz40t.js");
|
|
15867
15856
|
await this.ensureRunning();
|
|
15868
15857
|
await this.refresh();
|
|
15869
15858
|
return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/raw-evidence/archive?${new URLSearchParams({
|
|
@@ -17977,7 +17966,7 @@ var SandboxFilesystemOperations = class extends DeclaredFilesystemOperations {
|
|
|
17977
17966
|
totalBytes: size,
|
|
17978
17967
|
percentage: 0
|
|
17979
17968
|
});
|
|
17980
|
-
const { uploadChunkedFromFile } = await import("./chunked-upload-file-
|
|
17969
|
+
const { uploadChunkedFromFile } = await import("./chunked-upload-file-Cxmzlt7a.js");
|
|
17981
17970
|
await uploadChunkedFromFile({ fetch: (path, init) => this.host.runtimeFetch(path, init) }, remotePath, localPath, {
|
|
17982
17971
|
mode: options?.permissions,
|
|
17983
17972
|
onProgress: options?.onProgress ? (progress) => {
|
|
@@ -18879,4 +18868,4 @@ var SandboxInstance = class SandboxInstance extends SandboxEgressCapabilities {
|
|
|
18879
18868
|
}
|
|
18880
18869
|
};
|
|
18881
18870
|
//#endregion
|
|
18882
|
-
export { isCapacityShortageCreateError as $, isMaterializerHarness as A, parseLifecycleTimes as B, materializeProfileFileMounts as C, HARNESS_LAUNCH_MATERIALIZE_OPTIONS as D, validateDeferredProfileFileMounts as E, normalizeCaptureProof as F, normalizeSandboxShape as G, normalizeConnection as H, normalizeSandboxCreateReceipt as I, DEPLOY_WINDOW_RETRY_MS as J, CAPACITY_ETA_MARGIN_MS as K, normalizeStartupDiagnostics as L, SandboxOperation as M, SandboxOperationFailedError as N, ProfileUnsupportedError as O, DirectRuntimeHttpClient as P, generateIdempotencyKey as Q, readFilesystemIncarnationTuple as R, ManagedProcessClient as S, splitInlineProfileSkills as T, normalizeEgressPolicyFields as U, state as V, normalizeProxySecretReceipt as W, createRetryDelayMs as X, awaitCreateResend as Y, extendableDeadline as Z, collectAgentFinalMessageText as _, buildTraceExportPayload as a, isToolBearingEvent as b, toOtelJson as c, sandboxLedgerUsd as d, isDeployWindowCreateError as et, InteractiveSessionHandle as f, applySandboxEventText as g, createInteractiveTerminalSession as h, MAX_EGRESS_DENIALS_LIMIT as i,
|
|
18871
|
+
export { isCapacityShortageCreateError as $, isMaterializerHarness as A, parseLifecycleTimes as B, materializeProfileFileMounts as C, HARNESS_LAUNCH_MATERIALIZE_OPTIONS as D, validateDeferredProfileFileMounts as E, normalizeCaptureProof as F, normalizeSandboxShape as G, normalizeConnection as H, normalizeSandboxCreateReceipt as I, DEPLOY_WINDOW_RETRY_MS as J, CAPACITY_ETA_MARGIN_MS as K, normalizeStartupDiagnostics as L, SandboxOperation as M, SandboxOperationFailedError as N, ProfileUnsupportedError as O, DirectRuntimeHttpClient as P, generateIdempotencyKey as Q, readFilesystemIncarnationTuple as R, ManagedProcessClient as S, splitInlineProfileSkills as T, normalizeEgressPolicyFields as U, state as V, normalizeProxySecretReceipt as W, createRetryDelayMs as X, awaitCreateResend as Y, extendableDeadline as Z, collectAgentFinalMessageText as _, buildTraceExportPayload as a, isToolBearingEvent as b, toOtelJson as c, sandboxLedgerUsd as d, isDeployWindowCreateError as et, InteractiveSessionHandle as f, applySandboxEventText as g, createInteractiveTerminalSession as h, MAX_EGRESS_DENIALS_LIMIT as i, materializeProfile as j, enforceWorkspacePlanSupport as k, SandboxTaskSession as l, createInteractiveTerminalCapture as m, createSandboxInstanceFromResponse as n, isRetryableCreateError as nt, exportTraceBundle as o, InteractiveTerminalFrameLog as p, CAPACITY_ETA_WAIT_MAX_MS as q, WorkspaceImages as r, runtimeWorkspaceCwdSchema$1 as rt, otelTraceIdForTangleTrace as s, SandboxInstance as t, isRateLimitCreateError as tt, SandboxSession as u, collectAgentResponseText as v, splitInlineProfileFileMounts as w, deleteSandbox as x, getSandboxEventText as y, dateOf as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as agentProfileSchema } from "./profile-schema-BHeC7cOf.js";
|
|
2
2
|
import { t as canonicalAgentProfileDigest } from "./agent-execution-preparation-B8PJuIsN.js";
|
|
3
|
-
import { C as SandboxError, O as ValidationError, u as CapabilityError } from "./errors-
|
|
3
|
+
import { C as SandboxError, O as ValidationError, u as CapabilityError } from "./errors-DkSlRgmz.js";
|
|
4
4
|
import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
|
|
5
5
|
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-CXI4ysvr-DMV1Pos7.js";
|
|
6
6
|
import "./cli-auth-bundle-DqIHmlbG.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as SandboxError, O as ValidationError } from "./errors-
|
|
2
|
-
import { r as SEAT_OWNER_MAX_RESPONSE_BYTES, s as seatOwnerTimeoutMs, t as SEAT_COMMAND_TIMEOUT_MS } from "./select-seat-
|
|
1
|
+
import { C as SandboxError, O as ValidationError } from "./errors-DkSlRgmz.js";
|
|
2
|
+
import { r as SEAT_OWNER_MAX_RESPONSE_BYTES, s as seatOwnerTimeoutMs, t as SEAT_COMMAND_TIMEOUT_MS } from "./select-seat-C06uoKc5.js";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
//#region src/select-seat-command.ts
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../retry-after-header-DyAWSQ4m.js";
|
|
2
2
|
import { n as combineAbortSignals } from "../abort-signal-BsriwJ8L.js";
|
|
3
|
-
import { i as fetchSandboxApi } from "../api-request-
|
|
3
|
+
import { i as fetchSandboxApi } from "../api-request-BOY5Oo4e.js";
|
|
4
4
|
import { t as parseSSEStream } from "../sse-parser-BCG3iL9j.js";
|
|
5
5
|
import { PART_TEXT, PART_TEXT_SUFFIX } from "@tangle-network/agent-core/sse";
|
|
6
6
|
//#region ../../../packages/runtime-contracts/dist/session-gateway.js
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as SandboxCreateResponseParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as AgentSandboxBlueprintAbi, g as SandboxCreateParamTypes, h as JsonResponseParamTypes, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_DELETE, n as fetchQuote, o as validateQuote, p as JOB_SANDBOX_CREATE, r as inputsHashOf, s as BlueprintSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxIdParamTypes } from "../tangle-
|
|
1
|
+
import { _ as SandboxCreateResponseParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as AgentSandboxBlueprintAbi, g as SandboxCreateParamTypes, h as JsonResponseParamTypes, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_DELETE, n as fetchQuote, o as validateQuote, p as JOB_SANDBOX_CREATE, r as inputsHashOf, s as BlueprintSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxIdParamTypes } from "../tangle-CAXw7tPL.js";
|
|
2
2
|
import { t as ITangleJobsAbi } from "../abi-pcDt2Adp.js";
|
|
3
3
|
export { AgentSandboxBlueprintAbi, BlueprintSandboxClient, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
2
|
-
import { a as readResponseJson } from "./errors-
|
|
3
|
-
import { i as fetchSandboxApi } from "./api-request-
|
|
1
|
+
import { R as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-C5vHrnpW.js";
|
|
2
|
+
import { a as readResponseJson } from "./errors-DkSlRgmz.js";
|
|
3
|
+
import { i as fetchSandboxApi } from "./api-request-BOY5Oo4e.js";
|
|
4
4
|
import { t as ITangleJobsAbi } from "./abi-pcDt2Adp.js";
|
|
5
5
|
import { _ as rotlBH, a as anumber, b as rotlSL, d as createXOFer, g as u32, h as toBytes$1, l as createHasher, m as swap32IfBE, n as abytes, o as aoutput, r as aexists, s as clean, t as Hash, v as rotlBL, x as split, y as rotlSH } from "./utils-BvN0Mk3j.js";
|
|
6
6
|
//#region ../../../packages/runtime-contracts/dist/tangle-blueprint-abi.js
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import { O as ValidationError } from "./errors-
|
|
1
|
+
import { O as ValidationError } from "./errors-DkSlRgmz.js";
|
|
2
|
+
//#region src/lib/runtime-env.ts
|
|
3
|
+
/**
|
|
4
|
+
* True inside a Cloudflare Worker. Under `nodejs_compat` workerd sets
|
|
5
|
+
* `process.versions.node`, but it ships `node:http2` as a stub whose `connect()`
|
|
6
|
+
* throws "The http2.connect method is not implemented", so `process.versions`
|
|
7
|
+
* cannot tell a Worker from Node. The user agent can.
|
|
8
|
+
*/
|
|
9
|
+
function isCloudflareWorker() {
|
|
10
|
+
return globalThis.navigator?.userAgent?.startsWith("Cloudflare-Workers") === true;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* True in a browser page or a browser Web Worker, where a request is subject
|
|
14
|
+
* to CORS. Box hosts carry no CORS contract, so a browser reads its runtime
|
|
15
|
+
* through the Sandbox API proxy.
|
|
16
|
+
*/
|
|
17
|
+
function isBrowserRuntime() {
|
|
18
|
+
const g = globalThis;
|
|
19
|
+
return !isCloudflareWorker() && (g.document !== void 0 || g.WorkerGlobalScope !== void 0);
|
|
20
|
+
}
|
|
21
|
+
/** True where `node:http2` can open a session: Node, but not a Worker. */
|
|
22
|
+
function canUseNodeHttp2() {
|
|
23
|
+
return typeof process !== "undefined" && typeof process.versions?.node === "string" && !isCloudflareWorker();
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
2
26
|
//#region src/lib/trace-id.ts
|
|
3
27
|
/**
|
|
4
28
|
* Request header that carries one turn's trace id. The Sandbox API adopts it
|
|
@@ -50,4 +74,4 @@ function traceHeaders(traceId) {
|
|
|
50
74
|
return { [TRACE_ID_HEADER]: resolveTraceId(traceId) };
|
|
51
75
|
}
|
|
52
76
|
//#endregion
|
|
53
|
-
export { responseTraceId as a, resolveTraceId as i, isTraceId as n, traceHeaders as o, mintTraceId as r, TRACE_ID_HEADER as t };
|
|
77
|
+
export { responseTraceId as a, isBrowserRuntime as c, resolveTraceId as i, isCloudflareWorker as l, isTraceId as n, traceHeaders as o, mintTraceId as r, canUseNodeHttp2 as s, TRACE_ID_HEADER as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sandbox",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.502",
|
|
4
4
|
"description": "TypeScript SDK for Tangle Sandbox: create cloud sandboxes and run commands and coding agents in them",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -114,6 +114,9 @@
|
|
|
114
114
|
"tar-stream": "3.2.2",
|
|
115
115
|
"zod": "^4.6.7"
|
|
116
116
|
},
|
|
117
|
+
"optionalDependencies": {
|
|
118
|
+
"undici": "8.12.3"
|
|
119
|
+
},
|
|
117
120
|
"peerDependencies": {
|
|
118
121
|
"@mastra/core": "^1.36.0",
|
|
119
122
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
@@ -153,15 +156,15 @@
|
|
|
153
156
|
"vitest": "^4.1.12",
|
|
154
157
|
"ws": "^8.22.0",
|
|
155
158
|
"yjs": "13.6.33",
|
|
156
|
-
"@
|
|
157
|
-
"@tangle-network/agent-profile-materialize": "0.27.1",
|
|
159
|
+
"@products/sandbox-test-utils": "0.0.0",
|
|
158
160
|
"@tangle-network/cli-agent-registry": "0.15.0",
|
|
161
|
+
"@repo/shared": "0.0.0",
|
|
159
162
|
"@tangle-network/runtime-contracts": "0.20.0",
|
|
160
|
-
"@
|
|
163
|
+
"@tangle-network/agent-profile-materialize": "0.27.1"
|
|
161
164
|
},
|
|
162
165
|
"tangleRelease": {
|
|
163
|
-
"sourceSha": "
|
|
164
|
-
"mergedAt": "2026-11-
|
|
166
|
+
"sourceSha": "7105e97a4af5a041c62bc9a58ffa117104ba091c",
|
|
167
|
+
"mergedAt": "2026-11-20T03:01:00-08:00"
|
|
165
168
|
},
|
|
166
169
|
"scripts": {
|
|
167
170
|
"build": "node scripts/build-dist.mjs && bash scripts/verify-dist.sh",
|