@tangle-network/sandbox 0.68.7 → 0.69.0
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 +5 -4
- package/dist/abort-signal-BKVZNJul.js +46 -0
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +4 -4
- package/dist/agent/preview.d.ts +1 -1
- package/dist/agent/preview.js +2 -2
- package/dist/{agent-run-outcome-Cp8hzV98.d.ts → agent-run-outcome-z5-7NA1x.d.ts} +1 -1
- package/dist/{api-request-D8Mni27A.js → api-request-D1UVNo16.js} +1 -1
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/{browser-interactive-control-controller-CH7CLpmc.d.ts → browser-interactive-control-controller-CAmOZ9Sw.d.ts} +1 -1
- package/dist/{browser-interactive-control-controller-k1KkqDGF.js → browser-interactive-control-controller-CLHNi8rG.js} +2 -46
- package/dist/{chunked-upload-file-CbbWlCFt.js → chunked-upload-file-CLwAeLrM.js} +1 -1
- package/dist/{client-aBXGR6bc.d.ts → client-BG1kKuT7.d.ts} +5 -5
- package/dist/{client-D5GLp93x.js → client-DP5TOkG6.js} +9 -8
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/{core-VOzQz1mc.js → core-CO7om2qW.js} +2 -2
- package/dist/core.d.ts +6 -6
- package/dist/core.js +4 -4
- package/dist/{direct-http2--35cHOv5.js → direct-http2-Pyj3Rvr1.js} +1 -1
- package/dist/{index-EebEqYqj.d.ts → index-DQpx4M1t.d.ts} +8 -8
- package/dist/index.d.ts +11 -11
- package/dist/index.js +9 -8
- package/dist/intelligence/index.js +1 -1
- package/dist/interactive-control.d.ts +1 -1
- package/dist/interactive-control.js +1 -1
- package/dist/{interactive-controller-ThIeP_oZ.js → interactive-controller-DIlzqR9a.js} +15 -234
- package/dist/{interactive-controller-Mh7Ud5DQ.d.ts → interactive-controller-qsiVS3gd.d.ts} +3 -3
- package/dist/lib/prepared-evidence.js +1 -1
- package/dist/lib/prepared-process.js +1 -1
- package/dist/{lines-BTIFNxRO.d.ts → lines-B9f2EKS6.d.ts} +1 -1
- package/dist/lines.d.ts +1 -1
- package/dist/lines.js +1 -1
- package/dist/{local-cli-auth-Dxti_D10.js → local-cli-auth-B5lzT8mt.js} +1 -1
- package/dist/{mcp-local-ClJ5TD-m.js → mcp-local-Gz1Uygqk.js} +1 -1
- package/dist/{preview-D6tTCcmv.d.ts → preview-II4uNVbG.d.ts} +3 -3
- package/dist/{public-templates-sZe-0Qvi.d.ts → public-templates-CkHcnhWA.d.ts} +2 -2
- package/dist/public-templates.d.ts +1 -1
- package/dist/{raw-evidence-archive-iDPF8eF_.js → raw-evidence-archive-D60Yg1-5.js} +1 -1
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.js +4 -4
- package/dist/{sandbox-Ksajmtq4.js → sandbox-CVieDtU6.js} +31 -39
- package/dist/{secp256k1-CoRKQn1k.js → secp256k1-DxHlUI6v.js} +1 -1
- package/dist/select-seat-command.d.ts +1 -1
- package/dist/session-gateway/index.d.ts +132 -508
- package/dist/session-gateway/index.js +694 -946
- package/dist/sidecar-proxy-error-B2Hxt41g.js +24 -0
- package/dist/sse-parser-CUfurwcm.js +227 -0
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-Cmr8JcO3.js → tangle-B4k-BjIh.js} +3 -3
- package/dist/{terminal-stream-types-yAt76vk7.d.ts → terminal-stream-types-Bgy8iSFg.d.ts} +8 -5
- package/dist/{types-DUNlmyED.d.ts → types-D6n5ohlx.d.ts} +2 -2
- package/package.json +7 -7
- /package/dist/{chunked-upload-CbtLVV6-.js → chunked-upload-l6b9AWFA.js} +0 -0
- /package/dist/{cli-auth-bundle-Can3oLKY.d.ts → cli-auth-bundle-CeNOYFje.d.ts} +0 -0
- /package/dist/{cli-auth-bundle-DlQs_26j.js → cli-auth-bundle-CrO4F3Ru.js} +0 -0
- /package/dist/{collaboration-Ox7K-TN6.js → collaboration-BwLNv6sy.js} +0 -0
- /package/dist/{index-B8xo7y26.d.ts → index-C0RkLba5.d.ts} +0 -0
- /package/dist/{index-mz8_2rr2.d.ts → index-DaIF4c9p.d.ts} +0 -0
- /package/dist/{keep-alive-fetch-C92u8Kce.js → keep-alive-fetch-Bi-zvHpN.js} +0 -0
- /package/dist/{lines-DgRXUg5y.js → lines-D_HDAcVt.js} +0 -0
- /package/dist/{prepared-evidence-Di89Tatw.js → prepared-evidence-DUmJSegi.js} +0 -0
- /package/dist/{prepared-process-DKgEUodb.js → prepared-process-Dlk_9JVJ.js} +0 -0
- /package/dist/{preview-operations-BL7YCkes.js → preview-operations-eTUlPen5.js} +0 -0
- /package/dist/{response-rewrap-Bsj87BIq.js → response-rewrap-BKkJ5hnn.js} +0 -0
- /package/dist/{utils-C86i6t3C.js → utils-DB8DnUCU.js} +0 -0
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { a as normalizeEffectiveBackend, r as backendTypeSchema } from "./backend-types-CLvdSX8V.js";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as requestedPublicProfileDigest, C as encodeTextForWire, E as assertCurrentBackendType, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, O as mergeRuntimeBackendConfig, P as withoutRuntimeSecrets, S as encodePromptForWire, T as applyRequestedModel, _ as mintTraceId, a as assertScopedTokenActive, b as resolveDispatchRunIdentity, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as sessionHeaders, g as isTraceId, h as TRACE_ID_HEADER, i as terminalUpgradeHeadersSupported, j as requestedSecretProfilePublicDigest, k as normalizeRuntimeBackendConfig, l as normalizeSessionInfo, m as waitForRetryAfter, n as InteractiveSessionController, p as isRetryableCredentialRefusal, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as resolveTraceId, w as canUseNodeHttp2, x as validateAcceptedDispatchRunRef, y as traceHeaders } from "./interactive-controller-DIlzqR9a.js";
|
|
3
3
|
import { A as SANDBOX_PROXY_REQUEST_MAX_BYTES, C as StateError, E as ValidationError, F as isProfileFileMountOutsideRoots, I as profileFileMountOutsideRootsMessage, M as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, N as SANDBOX_AGENT_HOME, P as SANDBOX_FILE_API_ABSOLUTE_ROOTS, S as ServerError, T as TimeoutError, a as AuthError, g as NotFoundError, h as NetworkError, i as readResponseJson, l as EdgeNotReadyError, n as parseErrorResponse, r as parseResponseError, s as CapabilityError, t as TerminalStreamError, v as ProfileFileMountPathError, w as StreamInterruptedError, x as SandboxError, y as QuotaError } from "./errors-Bs5G7JdV.js";
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
4
|
+
import { d as interactiveSessionControlClaimResponseSchema, f as interactiveSessionControlReleaseResponseSchema, l as createInteractiveControlHolderId, m as interactiveSessionStatusResponseSchema, p as interactiveSessionControlValidationResponseSchema } from "./browser-interactive-control-controller-CLHNi8rG.js";
|
|
5
|
+
import { n as combineAbortSignals, r as delayUntilAborted, t as awaitWithAbort } from "./abort-signal-BKVZNJul.js";
|
|
6
|
+
import { t as rewrapResponse } from "./response-rewrap-BKkJ5hnn.js";
|
|
7
|
+
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-Bi-zvHpN.js";
|
|
8
|
+
import { t as SIDECAR_PROXY_ERROR_HEADER } from "./sidecar-proxy-error-B2Hxt41g.js";
|
|
9
|
+
import { t as parseSSEStream } from "./sse-parser-CUfurwcm.js";
|
|
10
|
+
import { s as uploadChunked } from "./chunked-upload-l6b9AWFA.js";
|
|
11
|
+
import { t as runPreparedProcess } from "./prepared-process-Dlk_9JVJ.js";
|
|
12
|
+
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-CrO4F3Ru.js";
|
|
13
|
+
import { n as SandboxLines } from "./lines-D_HDAcVt.js";
|
|
11
14
|
import { z } from "zod";
|
|
12
15
|
import { AgentExactRunControlRefSchema, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, InteractionAcknowledgementSchema, InteractionBindingSchema, InteractionRequestSchema, InteractionResponseCommandSchema, InteractionResponseSchema, PlanContinuationSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, canonicalCandidateDigest, canonicalCandidateJson, exactAgentInteractiveSessionStart, sha256DigestSchema, terminalSessionUsable } from "@tangle-network/agent-interface";
|
|
13
16
|
import { AgentInteractiveSessionControlClaimSchema as AgentInteractiveSessionControlClaimSchema$1, AgentInteractiveSessionPromptAcknowledgementSchema as AgentInteractiveSessionPromptAcknowledgementSchema$1, AgentInteractiveSessionRefSchema as AgentInteractiveSessionRefSchema$1, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema as AgentInteractiveSessionStopAcknowledgementSchema$1 } from "@tangle-network/agent-interface/environment-interactive-control";
|
|
@@ -1114,29 +1117,6 @@ function classifySidecarRequest(input, method, upgrade = false) {
|
|
|
1114
1117
|
};
|
|
1115
1118
|
}
|
|
1116
1119
|
//#endregion
|
|
1117
|
-
//#region ../../../packages/runtime-contracts/dist/sidecar-proxy-error.js
|
|
1118
|
-
/**
|
|
1119
|
-
* Response header that the host-agent sidecar proxy puts on each error it
|
|
1120
|
-
* writes itself. The value is the host-agent error code, for example
|
|
1121
|
-
* `NOT_MANAGED` or `ROUTE_LOOKUP_FAILED`.
|
|
1122
|
-
*
|
|
1123
|
-
* The orchestrator reaches a sidecar only through the host-agent sidecar
|
|
1124
|
-
* proxy. Thus two services write errors on that path. They use the same
|
|
1125
|
-
* statuses (404, 502, 503, 504) and the same `{error, code}` JSON body. This
|
|
1126
|
-
* header names the author of the response. If the header is present, the
|
|
1127
|
-
* host-agent wrote the response. If the header is absent, the sidecar wrote
|
|
1128
|
-
* the response.
|
|
1129
|
-
*
|
|
1130
|
-
* The orchestrator invalidates the endpoint and sends the request again only
|
|
1131
|
-
* for a host-agent error. A sidecar error is an ordinary answer, and a new
|
|
1132
|
-
* endpoint cannot change it.
|
|
1133
|
-
*
|
|
1134
|
-
* The host-agent deletes this header from an upstream response before it
|
|
1135
|
-
* returns that response. A sidecar must not be able to set the header. A
|
|
1136
|
-
* tenant preview app on an in-container port must not be able to set it.
|
|
1137
|
-
*/
|
|
1138
|
-
const SIDECAR_PROXY_ERROR_HEADER = "X-Tangle-Sidecar-Proxy-Error";
|
|
1139
|
-
//#endregion
|
|
1140
1120
|
//#region src/runtime-route-policy.ts
|
|
1141
1121
|
/**
|
|
1142
1122
|
* Where the default sandbox handle sends a runtime call, and whether a call
|
|
@@ -1455,7 +1435,7 @@ var DirectRuntimeHttpClient = class {
|
|
|
1455
1435
|
};
|
|
1456
1436
|
if (!route) throw new NetworkError("Direct runtime route was withdrawn");
|
|
1457
1437
|
if ((route.useHost || route.useExec) && canUseNodeHttp2()) {
|
|
1458
|
-
const { fetchDirectHttp2 } = await import("./direct-http2
|
|
1438
|
+
const { fetchDirectHttp2 } = await import("./direct-http2-Pyj3Rvr1.js");
|
|
1459
1439
|
return fetchDirectHttp2(route.url, request, timing);
|
|
1460
1440
|
}
|
|
1461
1441
|
return fetchWithKeepAlive(route.url, request, timing);
|
|
@@ -3953,13 +3933,25 @@ const LIFECYCLE_CONFLICT_MAX_DELAY_MS = 4e3;
|
|
|
3953
3933
|
function isLifecycleConflict(cause) {
|
|
3954
3934
|
return cause instanceof SandboxError && cause.status === 409 && cause.code === LIFECYCLE_CONFLICT_CODE;
|
|
3955
3935
|
}
|
|
3936
|
+
/**
|
|
3937
|
+
* The orchestrator's typed refusal of a delete whose agent sessions are not
|
|
3938
|
+
* yet sealed in run session storage: HTTP 503, nothing was torn down, and the
|
|
3939
|
+
* route says to retry the delete. One child delete of a 16-child branch met it
|
|
3940
|
+
* in production branch-fanout (eu1, 2026-10-26) and failed the whole run.
|
|
3941
|
+
*/
|
|
3942
|
+
const RUN_SESSION_CAPTURE_PENDING_CODE = "RUN_SESSION_CAPTURE_PENDING";
|
|
3943
|
+
/** A refusal that changed nothing and that the platform says to retry. */
|
|
3944
|
+
function isRetriedLifecycleRefusal(cause) {
|
|
3945
|
+
return isLifecycleConflict(cause) || cause instanceof SandboxError && cause.status === 503 && cause.code === RUN_SESSION_CAPTURE_PENDING_CODE;
|
|
3946
|
+
}
|
|
3956
3947
|
function lifecycleConflictDelayMs(cause, failedAttempt) {
|
|
3957
3948
|
if (cause instanceof SandboxError && cause.retryAfterMs !== void 0) return cause.retryAfterMs;
|
|
3958
3949
|
return Math.min(LIFECYCLE_CONFLICT_BASE_DELAY_MS * 2 ** Math.max(0, failedAttempt - 1), LIFECYCLE_CONFLICT_MAX_DELAY_MS);
|
|
3959
3950
|
}
|
|
3960
3951
|
/**
|
|
3961
3952
|
* Run one lifecycle mutation, re-attempting only the platform's typed
|
|
3962
|
-
* "already in progress" refusal
|
|
3953
|
+
* "already in progress" refusal and its "sessions not yet sealed" delete
|
|
3954
|
+
* refusal.
|
|
3963
3955
|
*
|
|
3964
3956
|
* Every other failure keeps its identity and its stack: this widens no other
|
|
3965
3957
|
* error class, and a caller abort ends the wait immediately.
|
|
@@ -3968,7 +3960,7 @@ async function withLifecycleConflictRetry(run, options) {
|
|
|
3968
3960
|
for (let attempt = 1;; attempt += 1) try {
|
|
3969
3961
|
return await run();
|
|
3970
3962
|
} catch (error) {
|
|
3971
|
-
if (!
|
|
3963
|
+
if (!isRetriedLifecycleRefusal(error) || attempt >= LIFECYCLE_CONFLICT_MAX_ATTEMPTS || options?.signal?.aborted) throw error;
|
|
3972
3964
|
await delayUntilAborted(lifecycleConflictDelayMs(error, attempt), options?.signal);
|
|
3973
3965
|
}
|
|
3974
3966
|
}
|
|
@@ -7207,8 +7199,8 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
|
|
|
7207
7199
|
/**
|
|
7208
7200
|
* Mint a scoped, time-bounded JWT for browser access (Issue #913 Gap 1).
|
|
7209
7201
|
* Authority is the caller's `TANGLE_API_KEY` (sk-tan-*); signing secrets
|
|
7210
|
-
* stay server-side.
|
|
7211
|
-
*
|
|
7202
|
+
* stay server-side. Native session streams use read-only session-runtime;
|
|
7203
|
+
* session/project retain legacy gateway semantics.
|
|
7212
7204
|
*/
|
|
7213
7205
|
async mintScopedToken(opts) {
|
|
7214
7206
|
return requestScopedToken(state(this).client, this.id, opts);
|
|
@@ -7438,7 +7430,7 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
|
|
|
7438
7430
|
var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabilities {
|
|
7439
7431
|
/** @internal — invoked before the sandbox is deleted. */
|
|
7440
7432
|
async _sessionExportRawEvidence(id, destination, options) {
|
|
7441
|
-
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-
|
|
7433
|
+
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-D60Yg1-5.js");
|
|
7442
7434
|
await this.ensureRunning();
|
|
7443
7435
|
await this.refresh();
|
|
7444
7436
|
return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence/archive?${new URLSearchParams([
|
|
@@ -7469,7 +7461,7 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
|
|
|
7469
7461
|
* and the byte and file bounds are verified before the directory appears.
|
|
7470
7462
|
*/
|
|
7471
7463
|
async exportRawEvidence(destination, options) {
|
|
7472
|
-
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-
|
|
7464
|
+
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-D60Yg1-5.js");
|
|
7473
7465
|
await this.ensureRunning();
|
|
7474
7466
|
await this.refresh();
|
|
7475
7467
|
return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/raw-evidence/archive?${new URLSearchParams({
|
|
@@ -9782,7 +9774,7 @@ var SandboxFilesystemOperations = class {
|
|
|
9782
9774
|
totalBytes: size,
|
|
9783
9775
|
percentage: 0
|
|
9784
9776
|
});
|
|
9785
|
-
const { uploadChunkedFromFile } = await import("./chunked-upload-file-
|
|
9777
|
+
const { uploadChunkedFromFile } = await import("./chunked-upload-file-CLwAeLrM.js");
|
|
9786
9778
|
await uploadChunkedFromFile({ fetch: (path, init) => this.host.runtimeFetch(path, init) }, remotePath, localPath, {
|
|
9787
9779
|
mode: options?.permissions,
|
|
9788
9780
|
onProgress: options?.onProgress ? (progress) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as anumber, c as concatBytes$1, f as randomBytes, h as toBytes, i as ahash, l as createHasher$1, n as abytes$1, o as aoutput, p as rotr, r as aexists, s as clean, t as Hash, u as createView, x as split } from "./utils-
|
|
1
|
+
import { a as anumber, c as concatBytes$1, f as randomBytes, h as toBytes, i as ahash, l as createHasher$1, n as abytes$1, o as aoutput, p as rotr, r as aexists, s as clean, t as Hash, u as createView, x as split } from "./utils-DB8DnUCU.js";
|
|
2
2
|
//#region ../../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
|
|
3
3
|
/**
|
|
4
4
|
* Internal Merkle-Damgard hash utils.
|