@tangle-network/sandbox 0.38.2 → 0.39.1-develop.20260912191433.b31d83f
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 +11 -3
- package/dist/agent/index.d.ts +3 -3
- package/dist/agent/index.js +4 -4
- package/dist/{agent-run-outcome-Bq1aHHPy.d.ts → agent-run-outcome-BSysiQWr.d.ts} +1 -1
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +2 -1
- package/dist/{browser-interactive-control-controller-lRfzpg9t.d.ts → browser-interactive-control-controller-BELrFH4f.d.ts} +1 -1
- package/dist/cli-auth-bundle-DUsK57rK.js +25 -0
- package/dist/{client-XqUR9qgS.d.ts → client-fy_RYdGN.d.ts} +13 -4
- package/dist/{client-DRumogtw.js → client-j6FmPkNB.js} +102 -14
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-DoSvMDEu.js → collaboration-CDvc5Hxk.js} +1 -1
- package/dist/core.d.ts +4 -4
- package/dist/core.js +3 -3
- package/dist/{errors-BMinPhXs.d.ts → errors-Cv3Td7LB.d.ts} +21 -1
- package/dist/{errors-MMMPY4T6.js → errors-V6uPkjfJ.js} +25 -3
- package/dist/{index-Bq_z_u6A.d.ts → index-CS-t6tPU.d.ts} +11 -1
- package/dist/{index-D3h0zRzl.d.ts → index-hYNUMvGr.d.ts} +2 -2
- package/dist/index.d.ts +30 -31
- package/dist/index.js +6 -14
- package/dist/intelligence/index.js +1 -1
- package/dist/interactive-control.d.ts +1 -1
- package/dist/{local-cli-auth-CJmSpTjk.js → local-cli-auth-BAJuMBZU.js} +7 -5
- package/dist/{runtime-api-CrjcDtUw.js → runtime-api-DokfzHVX.js} +31 -6
- package/dist/runtime.d.ts +3 -3
- package/dist/runtime.js +2 -2
- package/dist/{sandbox-CzBWptVE.js → sandbox-BFZa_Gx-.js} +39 -35
- package/dist/{sandbox-DQmu7a6M.d.ts → sandbox-C8xeDrlS.d.ts} +8 -8
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-B0p39vvV.js → tangle-Dn2pS3TZ.js} +2 -2
- package/dist/{types-DTDI3kek.d.ts → types-BZuZPQ0N.d.ts} +14 -5
- package/package.json +6 -5
- /package/dist/{index-CMLW3u5K.d.ts → index-BzAxTiqF.d.ts} +0 -0
- /package/dist/{terminal-stream-5GNLCsms.d.ts → terminal-stream-CcaBTVg3.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -277,6 +277,14 @@ try {
|
|
|
277
277
|
|
|
278
278
|
Use the same `idempotencyKey` only when retrying the same logical create request.
|
|
279
279
|
|
|
280
|
+
Inspect `SandboxError.createFailureDisposition` only on the top-level error returned by `create()`.
|
|
281
|
+
The value `"not-admitted"` proves that this call's attempts admitted no sandbox.
|
|
282
|
+
An absent value means unknown, even when the last HTTP status is 429.
|
|
283
|
+
Do not infer this call's disposition from `cause` or earlier calls with the same key.
|
|
284
|
+
This evidence does not exclude a sandbox from an earlier call with that key.
|
|
285
|
+
Cleanup may skip same-key recovery after `"not-admitted"` only when the key was fresh for this call.
|
|
286
|
+
Transport failures and unclassified responses remain uncertain; keep their recovery path.
|
|
287
|
+
|
|
280
288
|
## Commands and files
|
|
281
289
|
|
|
282
290
|
`exec()` returns the exit code, standard output, standard error, and timing data.
|
|
@@ -310,10 +318,10 @@ console.log(config);
|
|
|
310
318
|
| Public API request | 1 MiB | `SANDBOX_PROXY_REQUEST_MAX_BYTES` | Requests routed through the Sandbox API |
|
|
311
319
|
| Direct runtime file request | 32 MiB | `SANDBOX_DIRECT_FILE_REQUEST_MAX_BYTES` | Direct runtime requests |
|
|
312
320
|
| Multipart upload | 5 MiB | `FILE_MULTIPART_UPLOAD_MAX_BYTES` | One multipart upload |
|
|
313
|
-
| Chunked upload part | 768 KiB | `FILE_UPLOAD_PART_MAX_BYTES` | One `fs.uploadData()` part |
|
|
314
|
-
| Chunked upload session | 64 MiB | `FILE_UPLOAD_SESSION_MAX_BYTES` | One complete `fs.uploadData()` call |
|
|
321
|
+
| Chunked upload part | 768 KiB | `FILE_UPLOAD_PART_MAX_BYTES` | One `fs.upload()` or `fs.uploadData()` part |
|
|
322
|
+
| Chunked upload session | 64 MiB | `FILE_UPLOAD_SESSION_MAX_BYTES` | One complete `fs.upload()` or `fs.uploadData()` call |
|
|
315
323
|
|
|
316
|
-
Use `fs.uploadData()`
|
|
324
|
+
Use `fs.upload()` for local files or `fs.uploadData()` for in-memory content larger than the single-request limit.
|
|
317
325
|
|
|
318
326
|
The instance also exposes `git`, `tools`, `process`, `terminals`, `network`, `egress`, `previewLinks`, `images`, and `backend` capability clients.
|
|
319
327
|
Unsupported capabilities fail with a typed SDK error.
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as SandboxSession, h as SandboxTaskSession, r as SandboxInstance } from "../sandbox-
|
|
2
|
-
import { D as CodeExecutionResult, E as CodeExecutionOptions, O as CodeLanguage, Si as SessionListOptions, bi as SessionInfo, d as BackendConfig, k as CodeResultPart } from "../types-
|
|
3
|
-
import { i as Sandbox } from "../client-
|
|
1
|
+
import { g as SandboxSession, h as SandboxTaskSession, r as SandboxInstance } from "../sandbox-C8xeDrlS.js";
|
|
2
|
+
import { D as CodeExecutionResult, E as CodeExecutionOptions, O as CodeLanguage, Si as SessionListOptions, bi as SessionInfo, d as BackendConfig, k as CodeResultPart } from "../types-BZuZPQ0N.js";
|
|
3
|
+
import { i as Sandbox } from "../client-fy_RYdGN.js";
|
|
4
4
|
import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
5
|
|
|
6
6
|
//#region src/agent/instances.d.ts
|
package/dist/agent/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { f as assertCurrentBackendType } from "../runtime-api-
|
|
2
|
-
import { f as StateError, m as ValidationError, s as NotFoundError } from "../errors-
|
|
3
|
-
import { n as Sandbox } from "../client-
|
|
4
|
-
import { t as SandboxInstance } from "../sandbox-
|
|
1
|
+
import { f as assertCurrentBackendType } from "../runtime-api-DokfzHVX.js";
|
|
2
|
+
import { f as StateError, m as ValidationError, s as NotFoundError } from "../errors-V6uPkjfJ.js";
|
|
3
|
+
import { n as Sandbox } from "../client-j6FmPkNB.js";
|
|
4
|
+
import { t as SandboxInstance } from "../sandbox-BFZa_Gx-.js";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
//#region src/agent/instances.ts
|
|
7
7
|
const managers = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AgentQuestionRequest, et as DurablePlanSnapshot, fr as SandboxEvent, i as AgentApprovalRequirement, o as AgentRunStatus, s as AgentToolInvocation } from "./types-
|
|
1
|
+
import { a as AgentQuestionRequest, et as DurablePlanSnapshot, fr as SandboxEvent, i as AgentApprovalRequirement, o as AgentRunStatus, s as AgentToolInvocation } from "./types-BZuZPQ0N.js";
|
|
2
2
|
import { InteractionRequest } from "@tangle-network/agent-interface";
|
|
3
3
|
|
|
4
4
|
//#region src/agent-run-outcome.d.ts
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-
|
|
2
|
-
export { AnyTokenPayload, BatchScopedTokenPayload, CollaborationAccess, CollaborationTokenPayload, IssueCollaborationTokenOptions, ProductTokenIssuer, ProjectScopedTokenPayload, ReadTokenPayload, SessionScopedTokenPayload, TokenScope, getTokenTTL, isTokenExpiringSoon, issueBatchScopedToken, issueCollaborationToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, unsafeDecodeToken, verifyToken };
|
|
1
|
+
import { _ as ReadTokenPayload, a as issueCollaborationToken, b as materializeCliAuthBundle, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-CS-t6tPU.js";
|
|
2
|
+
export { AnyTokenPayload, BatchScopedTokenPayload, CollaborationAccess, CollaborationTokenPayload, IssueCollaborationTokenOptions, ProductTokenIssuer, ProjectScopedTokenPayload, ReadTokenPayload, SessionScopedTokenPayload, TokenScope, getTokenTTL, isTokenExpiringSoon, issueBatchScopedToken, issueCollaborationToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, materializeCliAuthBundle, unsafeDecodeToken, verifyToken };
|
package/dist/auth/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as materializeCliAuthBundle } from "../cli-auth-bundle-DUsK57rK.js";
|
|
1
2
|
//#region src/auth/tokens.ts
|
|
2
3
|
const textEncoder = new TextEncoder();
|
|
3
4
|
const textDecoder = new TextDecoder();
|
|
@@ -311,4 +312,4 @@ var ProductTokenIssuer = class {
|
|
|
311
312
|
}
|
|
312
313
|
};
|
|
313
314
|
//#endregion
|
|
314
|
-
export { ProductTokenIssuer, getTokenTTL, isTokenExpiringSoon, issueBatchScopedToken, issueCollaborationToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, unsafeDecodeToken, verifyToken };
|
|
315
|
+
export { ProductTokenIssuer, getTokenTTL, isTokenExpiringSoon, issueBatchScopedToken, issueCollaborationToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, materializeCliAuthBundle, unsafeDecodeToken, verifyToken };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as TerminalStreamHandlers } from "./terminal-stream-
|
|
1
|
+
import { r as TerminalStreamHandlers } from "./terminal-stream-CcaBTVg3.js";
|
|
2
2
|
import { AgentInteractiveSessionAttach, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionStatus } from "@tangle-network/agent-interface";
|
|
3
3
|
import { AgentInteractiveSessionControlClaim as AgentInteractiveSessionControlClaim$1, AgentInteractiveSessionControlClaimRequest as AgentInteractiveSessionControlClaimRequest$1, AgentInteractiveSessionRef as AgentInteractiveSessionRef$1 } from "@tangle-network/agent-interface/environment-interactive-control";
|
|
4
4
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region ../../../packages/cli-agent-registry/dist/cli-auth-bundle.mjs
|
|
2
|
+
const DEFAULT_MODE = 384;
|
|
3
|
+
const AUTH_BUNDLE_PATHS = Object.freeze({
|
|
4
|
+
codex: ".codex/auth.json",
|
|
5
|
+
"claude-code": ".claude/.credentials.json"
|
|
6
|
+
});
|
|
7
|
+
/** Convert a native credential JSON bundle without reading host credentials. */
|
|
8
|
+
function materializeCliAuthBundle(backendType, rawBundle) {
|
|
9
|
+
if (backendType !== "codex" && backendType !== "claude-code") throw new Error("CLI auth bundle is not supported for the selected backend");
|
|
10
|
+
if (typeof rawBundle !== "string") throw new Error("CLI auth bundle must be a JSON object");
|
|
11
|
+
let value;
|
|
12
|
+
try {
|
|
13
|
+
value = JSON.parse(rawBundle);
|
|
14
|
+
} catch {
|
|
15
|
+
throw new Error("CLI auth bundle must be a JSON object");
|
|
16
|
+
}
|
|
17
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("CLI auth bundle must be a JSON object");
|
|
18
|
+
return [{
|
|
19
|
+
path: AUTH_BUNDLE_PATHS[backendType],
|
|
20
|
+
content: rawBundle,
|
|
21
|
+
mode: DEFAULT_MODE
|
|
22
|
+
}];
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { materializeCliAuthBundle as n, AUTH_BUNDLE_PATHS as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as TraceExportResult, n as HttpClient, r as SandboxInstance, u as TraceExportSink } from "./sandbox-
|
|
2
|
-
import { l as ScopedToken, s as MintInteractiveSessionTokenOptions } from "./terminal-stream-
|
|
3
|
-
import { Ar as SandboxFleetToken, At as FleetDriveTurnRequest, Bn as PublicTemplateVersionInfo, Br as SandboxIdentity, Dt as FleetDispatchResultBufferOptions, Er as SandboxFleetManifest, Et as FleetDispatchResultBuffer, F as CreateSandboxFleetOptions, Fr as SandboxFleetUsage, Ft as FleetPromptDispatchResult, Gn as ReconcileSandboxFleetsOptions, Hn as PublishPublicTemplateVersionOptions, I as CreateSandboxFleetTokenOptions, Ji as TokenRefreshHandler, Kn as ReconcileSandboxFleetsResult, L as CreateSandboxFleetWithCoordinatorOptions, Li as SubscriptionInfo, Lr as SandboxFleetWorkspaceReconcileResult, Mn as PromptInputPart, Mt as FleetExecDispatchResult, N as CreateIntelligenceReportOptions, Ni as SshKeysManager, Nn as PromptOptions, Nt as FleetMachineId, Or as SandboxFleetOperationsSummary, Ot as FleetDispatchStreamOptions, P as CreateRequestOptions, Pn as PromptResult, Pr as SandboxFleetTraceOptions, Pt as FleetPromptDispatchOptions, R as CreateSandboxOptions, Rr as SandboxFleetWorkspaceRestoreResult, Tt as FleetDispatchCancelResult, Un as ReapExpiredSandboxFleetsOptions, Vn as PublishPublicTemplateOptions, Vr as SandboxInfo, Wn as ReapExpiredSandboxFleetsResult, _r as SandboxFleetDispatchResponse, an as IntelligenceReportCompareTo, ar as SandboxConfig, b as BatchRunRequest, br as SandboxFleetInfo, ca as BatchEvent, dn as ListSandboxFleetOptions, dr as SandboxEnvironment, dt as ExecResult, ea as UsageInfo, fn as ListSandboxOptions, hr as SandboxFleetCostEstimate, in as IntelligenceReportBudget, jr as SandboxFleetTraceBundle, jt as FleetExecDispatchOptions, kt as FleetDriveTurnOutcome, l as AttachSandboxFleetMachineOptions, mr as SandboxFleetArtifactSpec, pr as SandboxFleetArtifact, rn as IntelligenceReport, sn as IntelligenceReportWindow, ui as SecretsManager, ut as ExecOptions, v as BatchResult, vr as SandboxFleetDriverCapability, wr as SandboxFleetMachineRecord, y as BatchRunOptions, zn as PublicTemplateInfo, zr as SandboxFleetWorkspaceSnapshotResult } from "./types-
|
|
1
|
+
import { l as TraceExportResult, n as HttpClient, r as SandboxInstance, u as TraceExportSink } from "./sandbox-C8xeDrlS.js";
|
|
2
|
+
import { l as ScopedToken, s as MintInteractiveSessionTokenOptions } from "./terminal-stream-CcaBTVg3.js";
|
|
3
|
+
import { Ar as SandboxFleetToken, At as FleetDriveTurnRequest, Bn as PublicTemplateVersionInfo, Br as SandboxIdentity, Dt as FleetDispatchResultBufferOptions, Er as SandboxFleetManifest, Et as FleetDispatchResultBuffer, F as CreateSandboxFleetOptions, Fr as SandboxFleetUsage, Ft as FleetPromptDispatchResult, Gn as ReconcileSandboxFleetsOptions, Hn as PublishPublicTemplateVersionOptions, I as CreateSandboxFleetTokenOptions, Ji as TokenRefreshHandler, Kn as ReconcileSandboxFleetsResult, L as CreateSandboxFleetWithCoordinatorOptions, Li as SubscriptionInfo, Lr as SandboxFleetWorkspaceReconcileResult, Mn as PromptInputPart, Mt as FleetExecDispatchResult, N as CreateIntelligenceReportOptions, Ni as SshKeysManager, Nn as PromptOptions, Nt as FleetMachineId, Or as SandboxFleetOperationsSummary, Ot as FleetDispatchStreamOptions, P as CreateRequestOptions, Pn as PromptResult, Pr as SandboxFleetTraceOptions, Pt as FleetPromptDispatchOptions, R as CreateSandboxOptions, Rr as SandboxFleetWorkspaceRestoreResult, Tt as FleetDispatchCancelResult, Un as ReapExpiredSandboxFleetsOptions, Vn as PublishPublicTemplateOptions, Vr as SandboxInfo, Wn as ReapExpiredSandboxFleetsResult, _r as SandboxFleetDispatchResponse, an as IntelligenceReportCompareTo, ar as SandboxConfig, b as BatchRunRequest, br as SandboxFleetInfo, ca as BatchEvent, dn as ListSandboxFleetOptions, dr as SandboxEnvironment, dt as ExecResult, ea as UsageInfo, fn as ListSandboxOptions, hr as SandboxFleetCostEstimate, in as IntelligenceReportBudget, jr as SandboxFleetTraceBundle, jt as FleetExecDispatchOptions, kt as FleetDriveTurnOutcome, l as AttachSandboxFleetMachineOptions, mr as SandboxFleetArtifactSpec, pr as SandboxFleetArtifact, rn as IntelligenceReport, sn as IntelligenceReportWindow, ui as SecretsManager, ut as ExecOptions, v as BatchResult, vr as SandboxFleetDriverCapability, wr as SandboxFleetMachineRecord, y as BatchRunOptions, zn as PublicTemplateInfo, zr as SandboxFleetWorkspaceSnapshotResult } from "./types-BZuZPQ0N.js";
|
|
4
4
|
import { AgentInteractiveSessionRef } from "@tangle-network/agent-interface";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
@@ -23,6 +23,9 @@ declare const backendRegistryCapabilitiesSchema: z.ZodObject<{
|
|
|
23
23
|
imageInput: z.ZodBoolean;
|
|
24
24
|
contextWindow: z.ZodNumber;
|
|
25
25
|
mcp: z.ZodBoolean;
|
|
26
|
+
runtimeAttachments: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
mcp: z.ZodLiteral<true>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
26
29
|
sessions: z.ZodBoolean;
|
|
27
30
|
configurable: z.ZodBoolean;
|
|
28
31
|
interactions: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<("permission" | "question" | "plan")[], string[]>>;
|
|
@@ -40,6 +43,9 @@ declare const backendRegistryEntrySchema: z.ZodObject<{
|
|
|
40
43
|
imageInput: z.ZodBoolean;
|
|
41
44
|
contextWindow: z.ZodNumber;
|
|
42
45
|
mcp: z.ZodBoolean;
|
|
46
|
+
runtimeAttachments: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
mcp: z.ZodLiteral<true>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
43
49
|
sessions: z.ZodBoolean;
|
|
44
50
|
configurable: z.ZodBoolean;
|
|
45
51
|
interactions: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<("permission" | "question" | "plan")[], string[]>>;
|
|
@@ -59,6 +65,9 @@ declare const backendRegistryResponseSchema: z.ZodObject<{
|
|
|
59
65
|
imageInput: z.ZodBoolean;
|
|
60
66
|
contextWindow: z.ZodNumber;
|
|
61
67
|
mcp: z.ZodBoolean;
|
|
68
|
+
runtimeAttachments: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
mcp: z.ZodLiteral<true>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
62
71
|
sessions: z.ZodBoolean;
|
|
63
72
|
configurable: z.ZodBoolean;
|
|
64
73
|
interactions: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<("permission" | "question" | "plan")[], string[]>>;
|
|
@@ -422,7 +431,7 @@ declare class Sandbox implements HttpClient, ScopedTokenHttpClient {
|
|
|
422
431
|
* });
|
|
423
432
|
* ```
|
|
424
433
|
*/
|
|
425
|
-
create(
|
|
434
|
+
create(inputOptions?: CreateSandboxOptions, requestOptions?: CreateRequestOptions): Promise<SandboxInstance>;
|
|
426
435
|
/**
|
|
427
436
|
* Poll a sandbox to `running` by id. Surfaces a real provision failure
|
|
428
437
|
* as a {@link StateError} (carrying the sandbox's error message) rather
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as PartialFailureError, d as ServerError, h as parseErrorResponse, m as ValidationError, o as NetworkError, p as TimeoutError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
1
|
+
import { c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, l as encodeTextForWire, m as normalizeRuntimeBackendConfig, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, u as parseSSEStream, v as backendTypeSchema } from "./runtime-api-DokfzHVX.js";
|
|
2
|
+
import { c as PartialFailureError, d as ServerError, h as parseErrorResponse, m as ValidationError, o as NetworkError, p as TimeoutError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-V6uPkjfJ.js";
|
|
3
3
|
import { n as combineAbortSignals } from "./abort-signal-si1WMfJb.js";
|
|
4
|
-
import { E as normalizeConnection, O as exportTraceBundle, b as requestInteractiveSessionToken, i as normalizeStartupDiagnostics, n as createSandboxInstanceFromResponse, r as normalizeSandboxCreateReceipt } from "./sandbox-
|
|
4
|
+
import { E as normalizeConnection, O as exportTraceBundle, b as requestInteractiveSessionToken, i as normalizeStartupDiagnostics, n as createSandboxInstanceFromResponse, r as normalizeSandboxCreateReceipt } from "./sandbox-BFZa_Gx-.js";
|
|
5
5
|
import { agentProfileSchema } from "@tangle-network/agent-interface";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/backend-registry.ts
|
|
@@ -24,6 +24,7 @@ const backendRegistryCapabilitiesSchema = z.object({
|
|
|
24
24
|
imageInput: z.boolean(),
|
|
25
25
|
contextWindow: z.number(),
|
|
26
26
|
mcp: z.boolean(),
|
|
27
|
+
runtimeAttachments: z.object({ mcp: z.literal(true) }).optional(),
|
|
27
28
|
sessions: z.boolean(),
|
|
28
29
|
configurable: z.boolean(),
|
|
29
30
|
interactions: z.array(z.string().min(1)).transform((values) => values.filter(isBackendRegistryInteractionKind))
|
|
@@ -2429,6 +2430,56 @@ const RETRYABLE_CREATE_STATUS_CODES = new Set([
|
|
|
2429
2430
|
503,
|
|
2430
2431
|
504
|
|
2431
2432
|
]);
|
|
2433
|
+
/**
|
|
2434
|
+
* 503 classes that mean "the cell cannot place a create right now, ask
|
|
2435
|
+
* again", not "this create failed". They are what a caller sees while the
|
|
2436
|
+
* production host-agent rolls: placement is drained on the only host, so an
|
|
2437
|
+
* unkeyed create fails `CAPACITY_EXHAUSTED` (`HOST_PRESSURE` and
|
|
2438
|
+
* `PROVISIONING_PAUSED` are the sibling admission refusals the orchestrator
|
|
2439
|
+
* maps to 503), and a keyed create cannot verify its ref while the agent is
|
|
2440
|
+
* down (`IDEMPOTENT_CREATE_PROBE_FAILED`). Re-POSTing is safe: the admission
|
|
2441
|
+
* refusals started no provision, the probe answer is the Worker declining to
|
|
2442
|
+
* act until it can prove what exists, and the idempotency key joins
|
|
2443
|
+
* whichever provision did start.
|
|
2444
|
+
*
|
|
2445
|
+
* `SANDBOX_CREATE_RECONCILING` is deliberately not in the family. The Worker
|
|
2446
|
+
* answers it (Retry-After 2) when a same-key create meets a journaled D1
|
|
2447
|
+
* reservation left by an earlier attempt
|
|
2448
|
+
* (products/sandbox/api/src/routes/sandbox-create-idempotency-flow.ts). The
|
|
2449
|
+
* Worker releases that journal on the three admission refusals above
|
|
2450
|
+
* (sandbox-create-failure.ts, `PRE_PROVISION_REFUSAL_CODES`), so the hold
|
|
2451
|
+
* can only follow a retained real failure: a provision that started and
|
|
2452
|
+
* failed, or a create whose commit never ran because the Worker or the
|
|
2453
|
+
* controller stopped mid-create. The reconciler leaves such a journal alone
|
|
2454
|
+
* for RESERVATION_TTL_MS = 5 min and then releases it only after three
|
|
2455
|
+
* authoritative misses, one cron tick apart
|
|
2456
|
+
* (products/sandbox/api/src/cf/create-reservation-reconciler.ts), which is
|
|
2457
|
+
* longer than the 150 s ceiling below and the 120 s default create budget.
|
|
2458
|
+
* Retrying it on the time budget could never outlast the hold; it only
|
|
2459
|
+
* turned a ~10 s failure into a 120 s TimeoutError. It keeps the
|
|
2460
|
+
* five-attempt budget, paced on its Retry-After, like every other 503. The
|
|
2461
|
+
* same code also answers a failed read of that recovery state, a transient
|
|
2462
|
+
* the short budget already covers.
|
|
2463
|
+
*/
|
|
2464
|
+
const DEPLOY_WINDOW_RETRY_CODES = new Set([
|
|
2465
|
+
"IDEMPOTENT_CREATE_PROBE_FAILED",
|
|
2466
|
+
"CAPACITY_EXHAUSTED",
|
|
2467
|
+
"HOST_PRESSURE",
|
|
2468
|
+
"PROVISIONING_PAUSED"
|
|
2469
|
+
]);
|
|
2470
|
+
/**
|
|
2471
|
+
* Longest a create keeps re-POSTing through the deploy-window family,
|
|
2472
|
+
* counted from the start of the create. Sized to the production host-agent
|
|
2473
|
+
* roll in `.github/actions/update-host-agents/action.yml` (drain placement
|
|
2474
|
+
* on the host, swap the agent, restore placement): the last measured roll
|
|
2475
|
+
* kept placement drained for 124 s. The caller's create deadline binds
|
|
2476
|
+
* first when it is shorter, and the 120 s default is, so a default create
|
|
2477
|
+
* waits out its own deadline rather than this ceiling.
|
|
2478
|
+
*/
|
|
2479
|
+
const DEPLOY_WINDOW_RETRY_MS = 15e4;
|
|
2480
|
+
function isDeployWindowCreateError(cause) {
|
|
2481
|
+
return cause instanceof SandboxError && cause.status === 503 && DEPLOY_WINDOW_RETRY_CODES.has(cause.code);
|
|
2482
|
+
}
|
|
2432
2483
|
function isRetryableCreateError(cause) {
|
|
2433
2484
|
if (cause instanceof NetworkError) return true;
|
|
2434
2485
|
return cause instanceof SandboxError && cause.status !== void 0 && RETRYABLE_CREATE_STATUS_CODES.has(cause.status);
|
|
@@ -2480,11 +2531,11 @@ function withRequestContextHeaders(response, path, method) {
|
|
|
2480
2531
|
});
|
|
2481
2532
|
}
|
|
2482
2533
|
async function resolveLocalCliAuthFiles(backendType) {
|
|
2483
|
-
const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-
|
|
2534
|
+
const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-BAJuMBZU.js");
|
|
2484
2535
|
return discoverLocalCliAuthFiles(backendType);
|
|
2485
2536
|
}
|
|
2486
2537
|
async function describeLocalCliAuthExpectation(backendType) {
|
|
2487
|
-
const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-
|
|
2538
|
+
const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-BAJuMBZU.js");
|
|
2488
2539
|
return describe(backendType);
|
|
2489
2540
|
}
|
|
2490
2541
|
async function hydrateLocalCliBackendAuth(backend, baseUrl, trustLocalCliAuth) {
|
|
@@ -2661,11 +2712,24 @@ var Sandbox = class {
|
|
|
2661
2712
|
* });
|
|
2662
2713
|
* ```
|
|
2663
2714
|
*/
|
|
2664
|
-
async create(
|
|
2715
|
+
async create(inputOptions, requestOptions) {
|
|
2716
|
+
let options = inputOptions;
|
|
2717
|
+
if (options?.backend?.runtimeAttachments !== void 0) {
|
|
2718
|
+
normalizeRuntimeBackendConfig(options.backend);
|
|
2719
|
+
options = {
|
|
2720
|
+
...options,
|
|
2721
|
+
backend: {
|
|
2722
|
+
...options.backend,
|
|
2723
|
+
runtimeAttachments: structuredClone(options.backend.runtimeAttachments)
|
|
2724
|
+
}
|
|
2725
|
+
};
|
|
2726
|
+
}
|
|
2665
2727
|
if (options?.backend?.type !== void 0) assertCurrentBackendType(options.backend.type);
|
|
2666
2728
|
const timeoutMs = requestOptions?.timeoutMs ?? (options?.gpuLease ? DEFAULT_GPU_CREATE_TIMEOUT_MS : DEFAULT_CREATE_TIMEOUT_MS);
|
|
2667
2729
|
const idempotencyKey = options?.idempotencyKey ?? generateIdempotencyKey();
|
|
2668
|
-
const
|
|
2730
|
+
const startedAt = Date.now();
|
|
2731
|
+
const deadline = startedAt + timeoutMs;
|
|
2732
|
+
const deployWindowDeadline = Math.min(deadline, startedAt + DEPLOY_WINDOW_RETRY_MS);
|
|
2669
2733
|
const git = options?.git ? {
|
|
2670
2734
|
url: options.git.url,
|
|
2671
2735
|
ref: options.git.ref,
|
|
@@ -2754,17 +2818,37 @@ var Sandbox = class {
|
|
|
2754
2818
|
idempotencyKey,
|
|
2755
2819
|
billingOwnerId: options?.billingOwnerId
|
|
2756
2820
|
});
|
|
2757
|
-
|
|
2758
|
-
|
|
2821
|
+
let lastServerError;
|
|
2822
|
+
let allPreviousCreateAttemptsRefused = true;
|
|
2823
|
+
const createTimeoutError = () => new TimeoutError(timeoutMs, `Sandbox create did not complete within ${timeoutMs}ms. ` + (lastServerError ? `The last attempt failed with ${lastServerError.code}${lastServerError.status === void 0 ? "" : ` (HTTP ${lastServerError.status})`}: ${lastServerError.message}. ` : "") + `The provision may still be running server-side; retry create() with idempotencyKey="${idempotencyKey}" to join it.`, allPreviousCreateAttemptsRefused && lastServerError?.createFailureDisposition === "not-admitted" ? { createFailureDisposition: "not-admitted" } : void 0, lastServerError);
|
|
2824
|
+
const sleepBeforeRetry = async (delayMs) => {
|
|
2759
2825
|
try {
|
|
2760
|
-
await waitForCreateRetry(
|
|
2826
|
+
await waitForCreateRetry(delayMs, postSignal);
|
|
2761
2827
|
} catch (waitError) {
|
|
2762
2828
|
if (requestOptions?.signal?.aborted) throw waitError;
|
|
2763
2829
|
throw createTimeoutError();
|
|
2764
2830
|
}
|
|
2765
2831
|
};
|
|
2832
|
+
const waitBeforeRetry = async (cause, failedAttempt) => {
|
|
2833
|
+
if (isDeployWindowCreateError(cause)) {
|
|
2834
|
+
const delayMs = Math.max(createRetryDelayMs(cause, failedAttempt), CREATE_RETRY_BASE_DELAY_MS);
|
|
2835
|
+
if (delayMs >= deployWindowDeadline - Date.now()) throw deployWindowDeadline === deadline ? createTimeoutError() : cause;
|
|
2836
|
+
await sleepBeforeRetry(delayMs);
|
|
2837
|
+
return;
|
|
2838
|
+
}
|
|
2839
|
+
const delayMs = createRetryDelayMs(cause, failedAttempt);
|
|
2840
|
+
if (cause instanceof SandboxError && delayMs >= deadline - Date.now()) throw cause;
|
|
2841
|
+
await sleepBeforeRetry(delayMs);
|
|
2842
|
+
};
|
|
2766
2843
|
let response;
|
|
2767
|
-
|
|
2844
|
+
let shortBudgetFailures = 0;
|
|
2845
|
+
const exhaustsRetryBudget = (error) => {
|
|
2846
|
+
if (!isRetryableCreateError(error)) return true;
|
|
2847
|
+
if (isDeployWindowCreateError(error)) return false;
|
|
2848
|
+
shortBudgetFailures += 1;
|
|
2849
|
+
return shortBudgetFailures >= CREATE_POST_MAX_ATTEMPTS;
|
|
2850
|
+
};
|
|
2851
|
+
for (let attempt = 1;; attempt++) {
|
|
2768
2852
|
try {
|
|
2769
2853
|
response = await this.fetch("/v1/sandboxes", {
|
|
2770
2854
|
method: "POST",
|
|
@@ -2773,16 +2857,20 @@ var Sandbox = class {
|
|
|
2773
2857
|
body: createRequestBody
|
|
2774
2858
|
}, { timeoutMs });
|
|
2775
2859
|
} catch (error) {
|
|
2860
|
+
allPreviousCreateAttemptsRefused = false;
|
|
2776
2861
|
if (requestOptions?.signal?.aborted) throw error;
|
|
2862
|
+
if (error instanceof SandboxError && !(error instanceof TimeoutError)) lastServerError = error;
|
|
2777
2863
|
if (postDeadline.aborted || Date.now() >= deadline || error instanceof TimeoutError || error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError")) throw createTimeoutError();
|
|
2778
|
-
if (
|
|
2864
|
+
if (exhaustsRetryBudget(error instanceof Error ? error : new Error(String(error)))) throw error;
|
|
2779
2865
|
await waitBeforeRetry(error, attempt);
|
|
2780
2866
|
continue;
|
|
2781
2867
|
}
|
|
2782
2868
|
if (response.ok) break;
|
|
2783
2869
|
const body = await response.text();
|
|
2784
|
-
const error = parseErrorResponse(response.status, body,
|
|
2785
|
-
|
|
2870
|
+
const error = parseErrorResponse(response.status, body, { allPreviousCreateAttemptsRefused }, response.headers);
|
|
2871
|
+
allPreviousCreateAttemptsRefused = error.createFailureDisposition === "not-admitted";
|
|
2872
|
+
lastServerError = error;
|
|
2873
|
+
if (exhaustsRetryBudget(error)) throw error;
|
|
2786
2874
|
await waitBeforeRetry(error, attempt);
|
|
2787
2875
|
response = void 0;
|
|
2788
2876
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as CollaborationTransportConfig, a as CollaborationClient, c as CollaborationClientConfig, d as CollaborationDocumentRef, f as CollaborationFileBridgeOptions, g as CollaborationTokenRefreshResponse, h as CollaborationTokenRefreshRequest, i as parseCollaborationDocumentId, l as CollaborationDocumentAdapter, m as CollaborationPermissions, n as buildCollaborationDocumentId, o as CollaborationBootstrapRequest, p as CollaborationFileEvent, r as normalizeCollaborationPath, s as CollaborationBootstrapResponse, t as CollaborationFileBridge, u as CollaborationDocumentChange, v as SaveCollaborationSnapshotRequest, y as SaveCollaborationSnapshotResponse } from "../index-
|
|
1
|
+
import { _ as CollaborationTransportConfig, a as CollaborationClient, c as CollaborationClientConfig, d as CollaborationDocumentRef, f as CollaborationFileBridgeOptions, g as CollaborationTokenRefreshResponse, h as CollaborationTokenRefreshRequest, i as parseCollaborationDocumentId, l as CollaborationDocumentAdapter, m as CollaborationPermissions, n as buildCollaborationDocumentId, o as CollaborationBootstrapRequest, p as CollaborationFileEvent, r as normalizeCollaborationPath, s as CollaborationBootstrapResponse, t as CollaborationFileBridge, u as CollaborationDocumentChange, v as SaveCollaborationSnapshotRequest, y as SaveCollaborationSnapshotResponse } from "../index-BzAxTiqF.js";
|
|
2
2
|
export { CollaborationBootstrapRequest, CollaborationBootstrapResponse, CollaborationClient, CollaborationClientConfig, CollaborationDocumentAdapter, CollaborationDocumentChange, CollaborationDocumentRef, CollaborationFileBridge, CollaborationFileBridgeOptions, CollaborationFileEvent, CollaborationPermissions, CollaborationTokenRefreshRequest, CollaborationTokenRefreshResponse, CollaborationTransportConfig, SaveCollaborationSnapshotRequest, SaveCollaborationSnapshotResponse, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
|
|
@@ -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-CDvc5Hxk.js";
|
|
2
2
|
export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as parseErrorResponse, o as NetworkError, p as TimeoutError } from "./errors-
|
|
1
|
+
import { h as parseErrorResponse, o as NetworkError, p as TimeoutError } from "./errors-V6uPkjfJ.js";
|
|
2
2
|
//#region src/collaboration/client.ts
|
|
3
3
|
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
4
4
|
function normalizeBaseUrl(url) {
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as WorkspaceImagePublishRequestOptions, i as WorkspaceImagePublishInput, o as WorkspaceImagePublishResult, r as SandboxInstance, s as WorkspaceImages } from "./sandbox-
|
|
2
|
-
import { Cn as PreviewLinkWaitOptions, Mn as PromptInputPart, R as CreateSandboxOptions, Sn as PreviewLinkManager, Vr as SandboxInfo, Yr as SandboxStatus, ar as SandboxConfig, dt as ExecResult, gn as NetworkConfig, ut as ExecOptions, xn as PreviewLinkInfo } from "./types-
|
|
3
|
-
import { C as isBackendRegistryInteractionKind, S as backendRegistryResponseSchema, T as parseBackendRegistryResponseBody, _ as BackendRegistryInteractionKind, b as backendRegistryEntrySchema, g as BackendRegistryEntry, h as BackendRegistryCapabilities, i as Sandbox, v as BackendRegistryResponse, w as parseBackendRegistryResponse, x as backendRegistryInteractionKindSchema, y as backendRegistryCapabilitiesSchema } from "./client-
|
|
4
|
-
import { a as FileWriteConflictError, c as PartialFailureError, d as SandboxErrorJson, f as SandboxFailureDetail, g as ValidationError, h as TimeoutError, l as QuotaError, m as StateError, n as CapabilityError, o as NetworkError, p as ServerError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
1
|
+
import { a as WorkspaceImagePublishRequestOptions, i as WorkspaceImagePublishInput, o as WorkspaceImagePublishResult, r as SandboxInstance, s as WorkspaceImages } from "./sandbox-C8xeDrlS.js";
|
|
2
|
+
import { Cn as PreviewLinkWaitOptions, Mn as PromptInputPart, R as CreateSandboxOptions, Sn as PreviewLinkManager, Vr as SandboxInfo, Yr as SandboxStatus, ar as SandboxConfig, dt as ExecResult, gn as NetworkConfig, ut as ExecOptions, xn as PreviewLinkInfo } from "./types-BZuZPQ0N.js";
|
|
3
|
+
import { C as isBackendRegistryInteractionKind, S as backendRegistryResponseSchema, T as parseBackendRegistryResponseBody, _ as BackendRegistryInteractionKind, b as backendRegistryEntrySchema, g as BackendRegistryEntry, h as BackendRegistryCapabilities, i as Sandbox, v as BackendRegistryResponse, w as parseBackendRegistryResponse, x as backendRegistryInteractionKindSchema, y as backendRegistryCapabilitiesSchema } from "./client-fy_RYdGN.js";
|
|
4
|
+
import { a as FileWriteConflictError, c as PartialFailureError, d as SandboxErrorJson, f as SandboxFailureDetail, g as ValidationError, h as TimeoutError, l as QuotaError, m as StateError, n as CapabilityError, o as NetworkError, p as ServerError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-Cv3Td7LB.js";
|
|
5
5
|
export { AuthError, type BackendRegistryCapabilities, type BackendRegistryEntry, type BackendRegistryInteractionKind, type BackendRegistryResponse, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, FileWriteConflictError, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, type PreviewLinkWaitOptions, type PromptInputPart, QuotaError, Sandbox, type SandboxConfig, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, type SandboxInfo, SandboxInstance, type SandboxStatus, ServerError, StateError, TimeoutError, ValidationError, type WorkspaceImagePublishInput, type WorkspaceImagePublishRequestOptions, type WorkspaceImagePublishResult, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, isBackendRegistryInteractionKind, parseBackendRegistryResponse, parseBackendRegistryResponseBody };
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as FileWriteConflictError, c as PartialFailureError, d as ServerError, f as StateError, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-
|
|
2
|
-
import { _ as parseBackendRegistryResponse, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, m as backendRegistryInteractionKindSchema, n as Sandbox, p as backendRegistryEntrySchema, v as parseBackendRegistryResponseBody } from "./client-
|
|
3
|
-
import { a as WorkspaceImages, t as SandboxInstance } from "./sandbox-
|
|
1
|
+
import { a as FileWriteConflictError, c as PartialFailureError, d as ServerError, f as StateError, l as QuotaError, m as ValidationError, n as CapabilityError, o as NetworkError, p as TimeoutError, s as NotFoundError, t as AuthError, u as SandboxError } from "./errors-V6uPkjfJ.js";
|
|
2
|
+
import { _ as parseBackendRegistryResponse, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, m as backendRegistryInteractionKindSchema, n as Sandbox, p as backendRegistryEntrySchema, v as parseBackendRegistryResponseBody } from "./client-j6FmPkNB.js";
|
|
3
|
+
import { a as WorkspaceImages, t as SandboxInstance } from "./sandbox-BFZa_Gx-.js";
|
|
4
4
|
export { AuthError, CapabilityError, FileWriteConflictError, NetworkError, NotFoundError, PartialFailureError, QuotaError, Sandbox, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, isBackendRegistryInteractionKind, parseBackendRegistryResponse, parseBackendRegistryResponseBody };
|
|
@@ -22,6 +22,13 @@ declare class SandboxError extends Error {
|
|
|
22
22
|
readonly sidecarVersion?: string;
|
|
23
23
|
/** Sidecar image/tag/sha when the runtime emitted it */
|
|
24
24
|
readonly containerImage?: string;
|
|
25
|
+
/**
|
|
26
|
+
* On create's top-level error, proves this call's attempts admitted no
|
|
27
|
+
* sandbox. Absence is unknown. Earlier errors in `cause` describe only
|
|
28
|
+
* their attempt prefix, not subsequent attempts or earlier calls using
|
|
29
|
+
* the same idempotency key.
|
|
30
|
+
*/
|
|
31
|
+
readonly createFailureDisposition?: "not-admitted";
|
|
25
32
|
constructor(message: string, code: string, status?: number, metadata?: SandboxErrorMetadata);
|
|
26
33
|
}
|
|
27
34
|
type SandboxErrorOrigin = "sidecar" | "sandbox-api" | "control-plane" | "runtime" | "unknown";
|
|
@@ -31,6 +38,7 @@ interface SandboxErrorMetadata {
|
|
|
31
38
|
retryAfterMs?: number;
|
|
32
39
|
sidecarVersion?: string;
|
|
33
40
|
containerImage?: string;
|
|
41
|
+
createFailureDisposition?: "not-admitted";
|
|
34
42
|
}
|
|
35
43
|
type SandboxErrorJson = string | number | boolean | null | {
|
|
36
44
|
[key: string]: SandboxErrorJson;
|
|
@@ -128,7 +136,19 @@ declare class EgressProxyRecoveryError extends SandboxError {
|
|
|
128
136
|
declare class TimeoutError extends SandboxError {
|
|
129
137
|
/** Timeout duration in milliseconds */
|
|
130
138
|
readonly timeoutMs: number;
|
|
131
|
-
|
|
139
|
+
/**
|
|
140
|
+
* The last typed failure the operation had already received when the
|
|
141
|
+
* deadline fired, when there was one.
|
|
142
|
+
*
|
|
143
|
+
* An operation that spends its budget across several attempts (create's
|
|
144
|
+
* bounded POST retry) usually learns the server's failure class on an
|
|
145
|
+
* earlier attempt — `CONTAINER_START_FAILED`, `PROVISIONING_ERROR`,
|
|
146
|
+
* `RATE_LIMIT_EXCEEDED`. Without this field that class dies at the
|
|
147
|
+
* deadline and the caller is left with a timeout that names no cause,
|
|
148
|
+
* which is the last discard in a chain built specifically to deliver it.
|
|
149
|
+
*/
|
|
150
|
+
readonly cause?: SandboxError;
|
|
151
|
+
constructor(timeoutMs: number, message?: string, metadata?: SandboxErrorMetadata, cause?: SandboxError);
|
|
132
152
|
}
|
|
133
153
|
/**
|
|
134
154
|
* A network or connection error occurred.
|
|
@@ -22,6 +22,13 @@ var SandboxError = class extends Error {
|
|
|
22
22
|
sidecarVersion;
|
|
23
23
|
/** Sidecar image/tag/sha when the runtime emitted it */
|
|
24
24
|
containerImage;
|
|
25
|
+
/**
|
|
26
|
+
* On create's top-level error, proves this call's attempts admitted no
|
|
27
|
+
* sandbox. Absence is unknown. Earlier errors in `cause` describe only
|
|
28
|
+
* their attempt prefix, not subsequent attempts or earlier calls using
|
|
29
|
+
* the same idempotency key.
|
|
30
|
+
*/
|
|
31
|
+
createFailureDisposition;
|
|
25
32
|
constructor(message, code, status, metadata) {
|
|
26
33
|
super(message);
|
|
27
34
|
this.name = "SandboxError";
|
|
@@ -32,6 +39,7 @@ var SandboxError = class extends Error {
|
|
|
32
39
|
this.retryAfterMs = metadata?.retryAfterMs;
|
|
33
40
|
this.sidecarVersion = metadata?.sidecarVersion;
|
|
34
41
|
this.containerImage = metadata?.containerImage;
|
|
42
|
+
this.createFailureDisposition = metadata?.createFailureDisposition;
|
|
35
43
|
}
|
|
36
44
|
};
|
|
37
45
|
/**
|
|
@@ -168,10 +176,23 @@ var EgressProxyRecoveryError = class extends SandboxError {
|
|
|
168
176
|
var TimeoutError = class extends SandboxError {
|
|
169
177
|
/** Timeout duration in milliseconds */
|
|
170
178
|
timeoutMs;
|
|
171
|
-
|
|
179
|
+
/**
|
|
180
|
+
* The last typed failure the operation had already received when the
|
|
181
|
+
* deadline fired, when there was one.
|
|
182
|
+
*
|
|
183
|
+
* An operation that spends its budget across several attempts (create's
|
|
184
|
+
* bounded POST retry) usually learns the server's failure class on an
|
|
185
|
+
* earlier attempt — `CONTAINER_START_FAILED`, `PROVISIONING_ERROR`,
|
|
186
|
+
* `RATE_LIMIT_EXCEEDED`. Without this field that class dies at the
|
|
187
|
+
* deadline and the caller is left with a timeout that names no cause,
|
|
188
|
+
* which is the last discard in a chain built specifically to deliver it.
|
|
189
|
+
*/
|
|
190
|
+
cause;
|
|
191
|
+
constructor(timeoutMs, message, metadata, cause) {
|
|
172
192
|
super(message ?? `Request timed out after ${timeoutMs}ms`, "TIMEOUT", 408, metadata);
|
|
173
193
|
this.name = "TimeoutError";
|
|
174
194
|
this.timeoutMs = timeoutMs;
|
|
195
|
+
this.cause = cause;
|
|
175
196
|
}
|
|
176
197
|
};
|
|
177
198
|
/**
|
|
@@ -288,7 +309,7 @@ function parseErrorResponse(status, body, context, headers) {
|
|
|
288
309
|
const code = (typeof data.code === "string" ? asErrorCode(data.code) : void 0) ?? nestedCode;
|
|
289
310
|
const rawLog = typeof errorObj === "object" && errorObj !== null ? errorObj.log : void 0;
|
|
290
311
|
const logTail = typeof rawLog === "string" && rawLog.trim().length > 0 ? rawLog.trim() : void 0;
|
|
291
|
-
const prefix = context ? `${context.method ?? "REQUEST"} ${context.path ?? ""}: ` : "";
|
|
312
|
+
const prefix = context?.method || context?.path ? `${context.method ?? "REQUEST"} ${context.path ?? ""}: ` : "";
|
|
292
313
|
const composedMessage = shouldAppendDetails ? `${baseMessage}: ${details}` : baseMessage;
|
|
293
314
|
const messageWithReason = `${prefix}${reason && !composedMessage.includes(reason) ? `${composedMessage}: ${reason}` : composedMessage}`;
|
|
294
315
|
const message = logTail && !messageWithReason.includes(logTail) ? `${messageWithReason}\n${logTail}` : messageWithReason;
|
|
@@ -297,7 +318,8 @@ function parseErrorResponse(status, body, context, headers) {
|
|
|
297
318
|
endpoint: context?.path ?? headers?.get("x-tangle-request-path") ?? void 0,
|
|
298
319
|
retryAfterMs: parseRetryAfterMs(headers?.get("retry-after") ?? void 0, data),
|
|
299
320
|
sidecarVersion: headers?.get("x-sidecar-version") ?? void 0,
|
|
300
|
-
containerImage: headers?.get("x-sidecar-image") ?? headers?.get("x-sidecar-image-tag") ?? void 0
|
|
321
|
+
containerImage: headers?.get("x-sidecar-image") ?? headers?.get("x-sidecar-image-tag") ?? void 0,
|
|
322
|
+
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
|
|
301
323
|
};
|
|
302
324
|
if (isQuotaCode(code)) return new QuotaError(data.quotaType || "rate_limit", message, data.current, data.limit, metadata, status);
|
|
303
325
|
if (isCapabilityCode(code)) return new CapabilityError(message, code, status, metadata, readCapability(data, errorObj));
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
//#region ../../../packages/cli-agent-registry/dist/cli-auth-bundle.d.mts
|
|
2
|
+
//#region src/cli-auth-bundle.d.ts
|
|
3
|
+
type LocalCliAuthFile = {
|
|
4
|
+
path: string;
|
|
5
|
+
content: string;
|
|
6
|
+
mode?: number;
|
|
7
|
+
};
|
|
8
|
+
/** Convert a native credential JSON bundle without reading host credentials. */
|
|
9
|
+
declare function materializeCliAuthBundle(backendType: string, rawBundle: string): LocalCliAuthFile[]; //#endregion
|
|
10
|
+
//#endregion
|
|
1
11
|
//#region src/auth/types.d.ts
|
|
2
12
|
/**
|
|
3
13
|
* Auth Types
|
|
@@ -217,4 +227,4 @@ declare class ProductTokenIssuer {
|
|
|
217
227
|
getTtlMinutes(tier?: "free" | "pro" | "enterprise"): number;
|
|
218
228
|
}
|
|
219
229
|
//#endregion
|
|
220
|
-
export { ReadTokenPayload as _, issueCollaborationToken as a, issueSessionScopedToken as c, AnyTokenPayload as d, BatchScopedTokenPayload as f, ProjectScopedTokenPayload as g, IssueCollaborationTokenOptions as h, issueBatchScopedToken as i, unsafeDecodeToken as l, CollaborationTokenPayload as m, getTokenTTL as n, issueProjectScopedToken as o, CollaborationAccess as p, isTokenExpiringSoon as r, issueReadToken as s, ProductTokenIssuer as t, verifyToken as u, SessionScopedTokenPayload as v, TokenScope as y };
|
|
230
|
+
export { ReadTokenPayload as _, issueCollaborationToken as a, materializeCliAuthBundle as b, issueSessionScopedToken as c, AnyTokenPayload as d, BatchScopedTokenPayload as f, ProjectScopedTokenPayload as g, IssueCollaborationTokenOptions as h, issueBatchScopedToken as i, unsafeDecodeToken as l, CollaborationTokenPayload as m, getTokenTTL as n, issueProjectScopedToken as o, CollaborationAccess as p, isTokenExpiringSoon as r, issueReadToken as s, ProductTokenIssuer as t, verifyToken as u, SessionScopedTokenPayload as v, TokenScope as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as HttpClient, r as SandboxInstance } from "./sandbox-
|
|
2
|
-
import { R as CreateSandboxOptions } from "./types-
|
|
1
|
+
import { n as HttpClient, r as SandboxInstance } from "./sandbox-C8xeDrlS.js";
|
|
2
|
+
import { R as CreateSandboxOptions } from "./types-BZuZPQ0N.js";
|
|
3
3
|
|
|
4
4
|
//#region src/tangle/abi.d.ts
|
|
5
5
|
/**
|