@tangle-network/sandbox 0.34.6 → 0.36.3
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/dist/agent/index.d.ts +3 -3
- package/dist/agent/index.js +3 -3
- package/dist/{agent-run-outcome-DKG5Gog3.d.ts → agent-run-outcome-C0T6t4zn.d.ts} +1 -1
- package/dist/{client-DG65Nm46.js → client-4KbDo0dU.js} +2 -2
- package/dist/{client-DN93xcP3.d.ts → client-C-f9U8O4.d.ts} +2 -2
- package/dist/core.d.ts +3 -3
- package/dist/core.js +2 -2
- package/dist/{index-CAP0VNJ1.d.ts → index-DcWLZb5F.d.ts} +2 -2
- package/dist/index.d.ts +197 -196
- package/dist/index.js +4 -4
- package/dist/{runtime-api-paApH4-W.js → runtime-api-ClXF8k_q.js} +78 -2
- package/dist/runtime.d.ts +10 -3
- package/dist/runtime.js +1 -1
- package/dist/{sandbox-BRLqUARI.d.ts → sandbox-BK6WNRtc.d.ts} +20 -12
- package/dist/{sandbox-B70BzvzR.js → sandbox-DsnIsKUL.js} +51 -47
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-Cj1fDoJ7.js → tangle-BbYJI8g_.js} +1 -1
- package/dist/{types-B9LOEpNN.d.ts → types-B00bLoQR.d.ts} +40 -14
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { _ as backendTypeSchema, g as deriveAgentRunOutcome, h as deriveAgentResultOutcome, m as createAgentRunOutcomeTracker, p as normalizeRuntimeBackendConfig, u as parseSSEStream, v as parseBackendType } from "./runtime-api-
|
|
1
|
+
import { _ as backendTypeSchema, g as deriveAgentRunOutcome, h as deriveAgentResultOutcome, m as createAgentRunOutcomeTracker, p as normalizeRuntimeBackendConfig, u as parseSSEStream, v as parseBackendType } from "./runtime-api-ClXF8k_q.js";
|
|
2
2
|
import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, i as FileWriteConflictError, l as SandboxError, n as CapabilityError, o as NotFoundError, p as ValidationError, r as EgressProxyRecoveryError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
|
|
3
|
-
import { _ as parseBackendRegistryResponse, a as splitInlineProfileSkills, c as SandboxFleetClient, d as validateBatchRunRequest, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as splitInlineProfileFileMounts, l as runtimeWorkspaceCwdSchema, m as backendRegistryInteractionKindSchema, n as Sandbox, o as validateDeferredProfileFileMounts, p as backendRegistryEntrySchema, r as materializeProfileFileMounts, s as SandboxFleet, t as IntelligenceClient, u as createBatchResultAccumulator, v as parseBackendRegistryResponseBody } from "./client-
|
|
3
|
+
import { _ as parseBackendRegistryResponse, a as splitInlineProfileSkills, c as SandboxFleetClient, d as validateBatchRunRequest, f as backendRegistryCapabilitiesSchema, g as isBackendRegistryInteractionKind, h as backendRegistryResponseSchema, i as splitInlineProfileFileMounts, l as runtimeWorkspaceCwdSchema, m as backendRegistryInteractionKindSchema, n as Sandbox, o as validateDeferredProfileFileMounts, p as backendRegistryEntrySchema, r as materializeProfileFileMounts, s as SandboxFleet, t as IntelligenceClient, u as createBatchResultAccumulator, v as parseBackendRegistryResponseBody } from "./client-4KbDo0dU.js";
|
|
4
4
|
import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, c as createInteractiveControlHolderId, l as interactiveSessionIdentityDigest, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-Dv0gbFMu.js";
|
|
5
|
-
import { A as toOtelJson, C as collectAgentResponseText, D as buildTraceExportPayload, O as exportTraceBundle, S as collectAgentFinalMessageText, T as isToolBearingEvent, _ as TerminalStream, a as WorkspaceImages, c as SandboxTaskSession, d as agentInteractiveSessionPromptRequestDigest, f as InteractiveTerminalFrameLog, g as InteractiveSessionController, h as BrowserInteractiveSessionController, k as otelTraceIdForTangleTrace, l as SandboxSession, m as createInteractiveTerminalSession, o as GPU_LEASE_PROVIDER_NAMES, p as createInteractiveTerminalCapture, s as MAX_EGRESS_DENIALS_LIMIT, t as SandboxInstance, u as InteractiveSessionHandle, v as TerminalStreamError, w as getSandboxEventText, x as applySandboxEventText, y as TERMINAL_WS_ECHO_SUBPROTOCOL } from "./sandbox-
|
|
5
|
+
import { A as toOtelJson, C as collectAgentResponseText, D as buildTraceExportPayload, O as exportTraceBundle, S as collectAgentFinalMessageText, T as isToolBearingEvent, _ as TerminalStream, a as WorkspaceImages, c as SandboxTaskSession, d as agentInteractiveSessionPromptRequestDigest, f as InteractiveTerminalFrameLog, g as InteractiveSessionController, h as BrowserInteractiveSessionController, k as otelTraceIdForTangleTrace, l as SandboxSession, m as createInteractiveTerminalSession, o as GPU_LEASE_PROVIDER_NAMES, p as createInteractiveTerminalCapture, s as MAX_EGRESS_DENIALS_LIMIT, t as SandboxInstance, u as InteractiveSessionHandle, v as TerminalStreamError, w as getSandboxEventText, x as applySandboxEventText, y as TERMINAL_WS_ECHO_SUBPROTOCOL } from "./sandbox-DsnIsKUL.js";
|
|
6
6
|
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-DQD9kCdN.js";
|
|
7
|
-
import { t as TangleSandboxClient } from "./tangle-
|
|
7
|
+
import { t as TangleSandboxClient } from "./tangle-BbYJI8g_.js";
|
|
8
8
|
import { SANDBOX_SIZE_PRESET_NAMES, agentProfileConfidentialSchema, agentProfileSchema } from "@tangle-network/agent-interface";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
//#region src/confidential.ts
|
|
@@ -1022,6 +1022,29 @@ function appendSessionIdQuery(params, sessionId) {
|
|
|
1022
1022
|
}
|
|
1023
1023
|
//#endregion
|
|
1024
1024
|
//#region src/runtime-api.ts
|
|
1025
|
+
function isModelCredentialSuperseded(error) {
|
|
1026
|
+
return error instanceof SandboxError && error.status === 503 && error.code === "MODEL_CREDENTIAL_SUPERSEDED";
|
|
1027
|
+
}
|
|
1028
|
+
function waitForRetryAfter(delayMs, signal) {
|
|
1029
|
+
if (delayMs <= 0) return Promise.resolve();
|
|
1030
|
+
return new Promise((resolve, reject) => {
|
|
1031
|
+
let timer;
|
|
1032
|
+
const onAbort = () => {
|
|
1033
|
+
if (timer) clearTimeout(timer);
|
|
1034
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1035
|
+
reject(signal?.reason ?? new DOMException("The operation was aborted", "AbortError"));
|
|
1036
|
+
};
|
|
1037
|
+
if (signal?.aborted) {
|
|
1038
|
+
onAbort();
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
timer = setTimeout(() => {
|
|
1042
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1043
|
+
resolve();
|
|
1044
|
+
}, delayMs);
|
|
1045
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1025
1048
|
/** Internal typed client for routes served by a sandbox runtime. */
|
|
1026
1049
|
var SandboxRuntimeApi = class {
|
|
1027
1050
|
terminals;
|
|
@@ -1087,6 +1110,27 @@ var SandboxRuntimeApi = class {
|
|
|
1087
1110
|
}
|
|
1088
1111
|
if (options.executionId !== void 0 && !sawTerminal) throw new NetworkError("event stream ended before a terminal event — the connection dropped mid-turn");
|
|
1089
1112
|
}
|
|
1113
|
+
/**
|
|
1114
|
+
* List the durable execution records for one session.
|
|
1115
|
+
*
|
|
1116
|
+
* The sidecar owns this ledger and returns records newest first. Validate
|
|
1117
|
+
* the response here so malformed payloads cannot become false run evidence.
|
|
1118
|
+
*/
|
|
1119
|
+
async runs(sessionId) {
|
|
1120
|
+
await this.transport.ensureRunning();
|
|
1121
|
+
const endpoint = `/agents/sessions/${encodeURIComponent(sessionId)}/runs`;
|
|
1122
|
+
const payload = await this.json(endpoint, { method: "GET" });
|
|
1123
|
+
if (payload.success !== true || !Array.isArray(payload.executions)) throw new ServerError("Session runs response has an invalid shape", 502, {
|
|
1124
|
+
origin: "runtime",
|
|
1125
|
+
endpoint
|
|
1126
|
+
});
|
|
1127
|
+
const executions = payload.executions.map((value) => normalizeSessionExecutionInfo(value, sessionId));
|
|
1128
|
+
if (executions.some((execution) => execution === null)) throw new ServerError("Session runs response has an invalid execution", 502, {
|
|
1129
|
+
origin: "runtime",
|
|
1130
|
+
endpoint
|
|
1131
|
+
});
|
|
1132
|
+
return executions.filter((execution) => execution !== null);
|
|
1133
|
+
}
|
|
1090
1134
|
async readFiles(paths, options = {}) {
|
|
1091
1135
|
const params = new URLSearchParams();
|
|
1092
1136
|
appendSessionIdQuery(params, options.sessionId);
|
|
@@ -1278,7 +1322,8 @@ var SandboxRuntimeApi = class {
|
|
|
1278
1322
|
if (options.credentials?.baseUrl) headers.set("X-Backend-Base-Url", options.credentials.baseUrl);
|
|
1279
1323
|
const timeoutSignal = options.timeoutMs !== void 0 ? AbortSignal.timeout(options.timeoutMs) : void 0;
|
|
1280
1324
|
const signal = options.signal && timeoutSignal ? combineAbortSignals([options.signal, timeoutSignal]) : options.signal ?? timeoutSignal;
|
|
1281
|
-
|
|
1325
|
+
const path = `/agents/sessions/${encodeURIComponent(id)}/messages`;
|
|
1326
|
+
const init = {
|
|
1282
1327
|
method: "POST",
|
|
1283
1328
|
headers,
|
|
1284
1329
|
signal,
|
|
@@ -1298,7 +1343,14 @@ var SandboxRuntimeApi = class {
|
|
|
1298
1343
|
...request.turnId !== void 0 ? { turnId: request.turnId } : {},
|
|
1299
1344
|
...request.interactions !== void 0 ? { interactions: request.interactions } : {}
|
|
1300
1345
|
})
|
|
1301
|
-
}
|
|
1346
|
+
};
|
|
1347
|
+
try {
|
|
1348
|
+
return await this.json(path, init);
|
|
1349
|
+
} catch (error) {
|
|
1350
|
+
if (!isModelCredentialSuperseded(error)) throw error;
|
|
1351
|
+
await waitForRetryAfter(error.retryAfterMs ?? 1e3, signal);
|
|
1352
|
+
return this.json(path, init);
|
|
1353
|
+
}
|
|
1302
1354
|
}
|
|
1303
1355
|
async deleteSession(id) {
|
|
1304
1356
|
await this.transport.ensureRunning();
|
|
@@ -1410,6 +1462,30 @@ function normalizeSessionFailureReason(value) {
|
|
|
1410
1462
|
...executionId ? { executionId } : {}
|
|
1411
1463
|
};
|
|
1412
1464
|
}
|
|
1465
|
+
function normalizeSessionExecutionInfo(value, expectedSessionId) {
|
|
1466
|
+
if (!value || typeof value !== "object") return null;
|
|
1467
|
+
const raw = value;
|
|
1468
|
+
const executionId = raw.executionId;
|
|
1469
|
+
const sessionId = raw.sessionId;
|
|
1470
|
+
const status = raw.status;
|
|
1471
|
+
const startedAt = raw.startedAt;
|
|
1472
|
+
const completedAt = raw.completedAt;
|
|
1473
|
+
const eventCount = raw.eventCount;
|
|
1474
|
+
const lastEventId = raw.lastEventId;
|
|
1475
|
+
const normalizedStartedAt = typeof startedAt === "number" && Number.isFinite(startedAt) ? startedAt : void 0;
|
|
1476
|
+
const normalizedCompletedAt = typeof completedAt === "number" && Number.isFinite(completedAt) ? completedAt : void 0;
|
|
1477
|
+
const validCompletion = status === "active" ? completedAt === void 0 : normalizedCompletedAt !== void 0 && normalizedStartedAt !== void 0 && normalizedCompletedAt >= normalizedStartedAt;
|
|
1478
|
+
if (typeof executionId !== "string" || executionId.length === 0 || typeof sessionId !== "string" || sessionId.length === 0 || sessionId !== expectedSessionId || status !== "active" && status !== "completed" && status !== "failed" && status !== "cancelled" || normalizedStartedAt === void 0 || !validCompletion || typeof eventCount !== "number" || !Number.isInteger(eventCount) || eventCount < 0 || typeof lastEventId !== "string" || lastEventId.length === 0) return null;
|
|
1479
|
+
return {
|
|
1480
|
+
executionId,
|
|
1481
|
+
sessionId,
|
|
1482
|
+
status,
|
|
1483
|
+
startedAt: normalizedStartedAt,
|
|
1484
|
+
...normalizedCompletedAt !== void 0 ? { completedAt: normalizedCompletedAt } : {},
|
|
1485
|
+
eventCount,
|
|
1486
|
+
lastEventId
|
|
1487
|
+
};
|
|
1488
|
+
}
|
|
1413
1489
|
function normalizeSessionInfo(raw) {
|
|
1414
1490
|
const id = raw.id;
|
|
1415
1491
|
if (typeof id !== "string") return null;
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $i as UploadProgress, $r as SandboxTerminalManager, A as CommitTaskSessionOptions, B as CreateTaskSessionOptions, Ci as SessionMessage, Ct as FileUsageResult, Jr as SandboxRuntimeHealth, Qr as SandboxTerminalInfo, Ri as TaskSessionChanges, St as FileUsageOptions, T as ChunkedUploadResult, Ur as SandboxPortBinding, Vi as TaskSessionInfo, Zr as SandboxTerminalCreateOptions, _i as SessionExecutionStatus, _t as FileRenameResult, bi as SessionInfo, bt as FileTreeOptions, di as SendSessionMessageOptions, ei as SandboxTerminalRequestOptions, fi as SendSessionMessageRequest, fr as SandboxEvent, gi as SessionExecutionInfo, hi as SessionEventStreamOptions, ia as WriteFileOptions, ln as ListMessagesOptions, mt as FileReadBatchResult, pi as SentSessionMessage, pt as FileReadBatchOptions, qn as RenameOptions, w as ChunkedUploadOptions, wt as FileWriteResult, xt as FileTreeResult, z as CreateSessionOptions, zi as TaskSessionCommitResult } from "./types-B00bLoQR.js";
|
|
2
2
|
import { a as NetworkError, c as QuotaError, d as SandboxFailureDetail, f as ServerError, h as ValidationError, i as FileWriteConflictError, l as SandboxError, m as TimeoutError, n as CapabilityError, o as NotFoundError, p as StateError, s as PartialFailureError, t as AuthError, u as SandboxErrorJson } from "./errors-CQOvGddH.js";
|
|
3
|
-
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-
|
|
3
|
+
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-C0T6t4zn.js";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/chunked-upload.d.ts
|
|
6
6
|
/** The transport a caller wires this module to — {@link SandboxInstance.runtimeFetch}
|
|
@@ -55,6 +55,13 @@ declare class SandboxRuntimeApi {
|
|
|
55
55
|
* the token for.
|
|
56
56
|
*/
|
|
57
57
|
events(sessionId: string, options?: SessionEventStreamOptions): AsyncGenerator<SandboxEvent>;
|
|
58
|
+
/**
|
|
59
|
+
* List the durable execution records for one session.
|
|
60
|
+
*
|
|
61
|
+
* The sidecar owns this ledger and returns records newest first. Validate
|
|
62
|
+
* the response here so malformed payloads cannot become false run evidence.
|
|
63
|
+
*/
|
|
64
|
+
runs(sessionId: string): Promise<SessionExecutionInfo[]>;
|
|
58
65
|
readFiles(paths: string[], options?: FileReadBatchOptions): Promise<FileReadBatchResult>;
|
|
59
66
|
writeFile(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
|
|
60
67
|
/**
|
|
@@ -120,4 +127,4 @@ declare class SandboxRuntimeClient extends SandboxRuntimeApi {
|
|
|
120
127
|
}
|
|
121
128
|
declare function createSandboxRuntimeClient(config: SandboxRuntimeClientConfig): SandboxRuntimeClient;
|
|
122
129
|
//#endregion
|
|
123
|
-
export { type AgentRunOutcome, type AgentRunOutcomeTracker, AuthError, CapabilityError, type ChunkedUploadOptions, type ChunkedUploadResult, type ChunkedUploadTransport, type FileReadBatchOptions, type FileReadBatchResult, type FileRenameResult, type FileTreeOptions, type FileTreeResult, FileWriteConflictError, type FileWriteResult, type ListMessagesOptions, NetworkError, NotFoundError, PartialFailureError, QuotaError, type RenameOptions, SandboxError, type SandboxErrorJson, type SandboxEvent, type SandboxFailureDetail, SandboxRuntimeClient, type SandboxRuntimeClientConfig, type SandboxRuntimeHealth, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, ServerError, type SessionEventStreamOptions, type SessionMessage, StateError, TimeoutError, type UploadProgress, ValidationError, type WriteFileOptions, createAgentRunOutcomeTracker, createSandboxRuntimeClient, deriveAgentResultOutcome, deriveAgentRunOutcome, uploadChunked };
|
|
130
|
+
export { type AgentRunOutcome, type AgentRunOutcomeTracker, AuthError, CapabilityError, type ChunkedUploadOptions, type ChunkedUploadResult, type ChunkedUploadTransport, type FileReadBatchOptions, type FileReadBatchResult, type FileRenameResult, type FileTreeOptions, type FileTreeResult, FileWriteConflictError, type FileWriteResult, type ListMessagesOptions, NetworkError, NotFoundError, PartialFailureError, QuotaError, type RenameOptions, SandboxError, type SandboxErrorJson, type SandboxEvent, type SandboxFailureDetail, SandboxRuntimeClient, type SandboxRuntimeClientConfig, type SandboxRuntimeHealth, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, ServerError, type SessionEventStreamOptions, type SessionExecutionInfo, type SessionExecutionStatus, type SessionMessage, StateError, TimeoutError, type UploadProgress, ValidationError, type WriteFileOptions, createAgentRunOutcomeTracker, createSandboxRuntimeClient, deriveAgentResultOutcome, deriveAgentRunOutcome, uploadChunked };
|
package/dist/runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as uploadChunked, g as deriveAgentRunOutcome, h as deriveAgentResultOutcome, m as createAgentRunOutcomeTracker, t as SandboxRuntimeApi } from "./runtime-api-
|
|
1
|
+
import { a as uploadChunked, g as deriveAgentRunOutcome, h as deriveAgentResultOutcome, m as createAgentRunOutcomeTracker, t as SandboxRuntimeApi } from "./runtime-api-ClXF8k_q.js";
|
|
2
2
|
import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, i as FileWriteConflictError, l as SandboxError, n as CapabilityError, o as NotFoundError, p as ValidationError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
|
|
3
3
|
import { n as combineAbortSignals } from "./abort-signal-si1WMfJb.js";
|
|
4
4
|
//#region src/runtime-client.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as TerminalStreamReconnectAuthority, c as MintScopedTokenOptions, h as TerminalReadyInfo, l as ScopedToken, r as TerminalStreamHandlers, t as TerminalStream } from "./terminal-stream-5GNLCsms.js";
|
|
2
2
|
import { a as InteractiveSessionControlController, c as InteractiveSessionIdentity, d as InteractiveAttachOptions, f as InteractiveControlClaimAcknowledgement, h as InteractiveSessionStatus, m as InteractiveRequestOptions, n as BrowserInteractiveSessionControlControllerOptions, o as InteractiveSessionControlControllerOptions, p as InteractiveControlClaimOptions, s as InteractiveSessionControlTransport } from "./browser-interactive-control-controller-lRfzpg9t.js";
|
|
3
|
-
import { $
|
|
3
|
+
import { $ as DurablePlanDecisionResult, A as CommitTaskSessionOptions, Ai as SnapshotInfo, B as CreateTaskSessionOptions, C as BranchOptions, Ci as SessionMessage, D as CodeExecutionResult, Di as SnapshotDeleteAcknowledgement, E as CodeExecutionOptions, Fn as ProvisionEvent, G as DispatchedSession, Gi as TeeAttestationResponse, Gr as SandboxResourceUsage, Gt as GitStatus, Ht as GitCommit, In as ProvisionResult, It as ForkCounts, J as DriveTurnOptions, Jn as RestoreSnapshotOptions, Jr as SandboxRuntimeHealth, Kt as GpuLease, Lt as ForkIdempotency, Mi as SnapshotResult, Mn as PromptInputPart, Nn as PromptOptions, O as CodeLanguage, On as ProcessManager, Pi as StartupDiagnostics, Pn as PromptResult, Q as DurablePlan, Qn as RolloutOptions, Ri as TaskSessionChanges, Rt as ForkLookupOptions, Si as SessionListOptions, Sn as PreviewLinkManager, Ti as SessionResultOptions, Ui as TeeAttestationOptions, Ur as SandboxPortBinding, Vi as TaskSessionInfo, Vr as SandboxInfo, Vt as GitBranch, W as DispatchPromptOptions, Wt as GitDiff, X as DriverInfo, Xi as TurnDriveResult, Xn as Rollout, Xr as SandboxTerminalAttachOptions, Yn as ResumeOptions, Yr as SandboxStatus, Zt as GpuLeaseManager, _n as NetworkManager, aa as WriteManyFile, ai as SandboxTraceOptions, an as IntelligenceReportCompareTo, at as EgressManager, bi as SessionInfo, bn as PermissionsManager, ci as SearchOptions, cn as JsonValue, cr as SandboxCreateReceipt, ct as EventStreamOptions, d as BackendConfig, di as SendSessionMessageOptions, dt as ExecResult, er as RolloutStartResult, fi as SendSessionMessageRequest, fr as SandboxEvent, gi as SessionExecutionInfo, hi as SessionEventStreamOptions, ia as WriteFileOptions, in as IntelligenceReportBudget, ir as SSHCredentials, j as CompletedTurnResult, ji as SnapshotOptions, jr as SandboxFleetTraceBundle, ln as ListMessagesOptions, lr as SandboxDeleteAcknowledgement, na as WaitForRolloutOptions, ni as SandboxTraceBundle, nn as InstalledTool, oa as WriteManyOptions, or as SandboxConnection, p as BackendManager, pi as SentSessionMessage, qi as TeePublicKeyResponse, qr as SandboxRuntimeCapabilities, ra as WorkspaceOperationLookup, rn as IntelligenceReport, rr as SSHCommandDescriptor, si as SearchMatch, sn as IntelligenceReportWindow, ta as WaitForOptions, ti as SandboxTerminals, ut as ExecOptions, vt as FileSystem, wt as FileWriteResult, xi as SessionInterruptOptions, yi as SessionForkOptions, z as CreateSessionOptions, zi as TaskSessionCommitResult } from "./types-B00bLoQR.js";
|
|
4
4
|
import { AgentInteractiveSessionAttach, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionRef, AgentInteractiveSessionStart, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentInteractiveTerminalSession, AgentInteractiveTerminalSession as AgentInteractiveTerminalSession$1, AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, InteractionAcknowledgement, InteractionData, InteractionRequest, InteractionResponseCommand, TerminalOutputEvent, TerminalReplayWindow, agentInteractiveSessionPromptRequestDigest } from "@tangle-network/agent-interface";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
@@ -397,6 +397,7 @@ interface SandboxSessionHost extends InteractiveSessionHost {
|
|
|
397
397
|
prompt(message: string | PromptInputPart[], options?: PromptOptions): Promise<PromptResult>;
|
|
398
398
|
_sessionStatus(id: string): Promise<SessionInfo | null>;
|
|
399
399
|
_sessionEvents(id: string, opts?: SessionEventStreamOptions): AsyncGenerator<SandboxEvent>;
|
|
400
|
+
_sessionRuns(id: string): Promise<SessionExecutionInfo[]>;
|
|
400
401
|
_sessionResult(id: string, options?: SessionResultOptions, session?: SessionInfo): Promise<PromptResult>;
|
|
401
402
|
_sessionDelete(id: string): Promise<void>;
|
|
402
403
|
_sessionSendMessage(id: string, request: SendSessionMessageRequest, options?: SendSessionMessageOptions): Promise<SentSessionMessage>;
|
|
@@ -457,6 +458,13 @@ declare class SandboxSession {
|
|
|
457
458
|
* terminal event has been yielded, OR when the caller's signal aborts.
|
|
458
459
|
*/
|
|
459
460
|
events(opts?: SessionEventStreamOptions): AsyncGenerator<SandboxEvent>;
|
|
461
|
+
/**
|
|
462
|
+
* List the durable executions recorded for this session, newest first.
|
|
463
|
+
*
|
|
464
|
+
* This is the runtime's authoritative execution ledger. It lets callers
|
|
465
|
+
* count provider runs without inferring execution from model-written files.
|
|
466
|
+
*/
|
|
467
|
+
runs(): Promise<SessionExecutionInfo[]>;
|
|
460
468
|
/**
|
|
461
469
|
* Await a terminal result. With `executionId`, drains only that execution;
|
|
462
470
|
* without it, reads status and selects the latest execution. Event replay
|
|
@@ -1329,12 +1337,9 @@ declare class SandboxInstance {
|
|
|
1329
1337
|
* console.log(`Backend: ${status.type}, Status: ${status.status}`);
|
|
1330
1338
|
* ```
|
|
1331
1339
|
*
|
|
1332
|
-
* @example
|
|
1340
|
+
* @example Point the backend at a different model
|
|
1333
1341
|
* ```typescript
|
|
1334
|
-
* await box.backend.
|
|
1335
|
-
* command: "npx",
|
|
1336
|
-
* args: ["-y", "@anthropic/web-search"],
|
|
1337
|
-
* });
|
|
1342
|
+
* await box.backend.updateConfig({ model: "openai/gpt-5-mini" });
|
|
1338
1343
|
* ```
|
|
1339
1344
|
*
|
|
1340
1345
|
* @example Read provider-native Cursor metadata
|
|
@@ -1346,8 +1351,6 @@ declare class SandboxInstance {
|
|
|
1346
1351
|
*/
|
|
1347
1352
|
get backend(): BackendManager;
|
|
1348
1353
|
private backendStatus;
|
|
1349
|
-
private backendCapabilities;
|
|
1350
|
-
private backendAddMcp;
|
|
1351
1354
|
private backendGetMcpStatus;
|
|
1352
1355
|
private backendUpdateConfig;
|
|
1353
1356
|
private backendControlData;
|
|
@@ -1720,11 +1723,13 @@ declare class SandboxInstance {
|
|
|
1720
1723
|
*/
|
|
1721
1724
|
delete(): Promise<SandboxDeleteAcknowledgement>;
|
|
1722
1725
|
/**
|
|
1723
|
-
* Read
|
|
1724
|
-
*
|
|
1725
|
-
*
|
|
1726
|
+
* Read a lifecycle response body once.
|
|
1727
|
+
*
|
|
1728
|
+
* Current APIs return the complete sandbox state. Older APIs return an empty
|
|
1729
|
+
* body, so callers refresh when this method cannot recover a state payload.
|
|
1726
1730
|
*/
|
|
1727
|
-
private
|
|
1731
|
+
private readLifecycleResponse;
|
|
1732
|
+
private applyLifecycleResponse;
|
|
1728
1733
|
/**
|
|
1729
1734
|
* Upload a local directory to the sandbox via tar.
|
|
1730
1735
|
* @param localPath - Local directory path to upload
|
|
@@ -1765,6 +1770,7 @@ declare class SandboxInstance {
|
|
|
1765
1770
|
*/
|
|
1766
1771
|
private waitForWithSSE;
|
|
1767
1772
|
private hasReachedWaitTarget;
|
|
1773
|
+
private hasFreshStatus;
|
|
1768
1774
|
private ensureRunning;
|
|
1769
1775
|
private assertFilesystemIncarnationReady;
|
|
1770
1776
|
private runtimeFetch;
|
|
@@ -1960,6 +1966,8 @@ declare class SandboxInstance {
|
|
|
1960
1966
|
mintScopedToken(opts: MintScopedTokenOptions): Promise<ScopedToken>;
|
|
1961
1967
|
/** @internal — invoked by SandboxSession.status(). */
|
|
1962
1968
|
_sessionStatus(id: string): Promise<SessionInfo | null>;
|
|
1969
|
+
/** @internal — invoked by SandboxSession.runs(). */
|
|
1970
|
+
_sessionRuns(id: string): Promise<SessionExecutionInfo[]>;
|
|
1963
1971
|
/** @internal — invoked by SandboxSession.events(). */
|
|
1964
1972
|
_sessionEvents(id: string, opts?: SessionEventStreamOptions, stopOnTurnTerminal?: boolean): AsyncGenerator<SandboxEvent>;
|
|
1965
1973
|
/** Replay one execution without subscribing to other runs on its session. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as uploadChunked, c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, h as deriveAgentResultOutcome, i as sessionHeaders, m as createAgentRunOutcomeTracker, n as normalizeSessionInfo, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as normalizeRuntimeBackendConfig, r as appendSessionIdQuery, t as SandboxRuntimeApi, u as parseSSEStream } from "./runtime-api-
|
|
1
|
+
import { a as uploadChunked, c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, h as deriveAgentResultOutcome, i as sessionHeaders, m as createAgentRunOutcomeTracker, n as normalizeSessionInfo, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as normalizeRuntimeBackendConfig, r as appendSessionIdQuery, t as SandboxRuntimeApi, u as parseSSEStream } from "./runtime-api-ClXF8k_q.js";
|
|
2
2
|
import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, l as SandboxError, m as parseErrorResponse, n as CapabilityError, o as NotFoundError, p as ValidationError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
|
|
3
3
|
import { c as createInteractiveControlHolderId, d as interactiveSessionControlReleaseResponseSchema, f as interactiveSessionControlValidationResponseSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, p as interactiveSessionStatusResponseSchema, r as browserInteractiveTerminalEndpoint, s as assertInteractiveSessionRef, u as interactiveSessionControlClaimResponseSchema } from "./browser-interactive-control-controller-Dv0gbFMu.js";
|
|
4
4
|
import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-si1WMfJb.js";
|
|
@@ -2756,6 +2756,15 @@ var SandboxSession = class SandboxSession {
|
|
|
2756
2756
|
return this.box._sessionEvents(this.id, opts);
|
|
2757
2757
|
}
|
|
2758
2758
|
/**
|
|
2759
|
+
* List the durable executions recorded for this session, newest first.
|
|
2760
|
+
*
|
|
2761
|
+
* This is the runtime's authoritative execution ledger. It lets callers
|
|
2762
|
+
* count provider runs without inferring execution from model-written files.
|
|
2763
|
+
*/
|
|
2764
|
+
async runs() {
|
|
2765
|
+
return this.box._sessionRuns(this.id);
|
|
2766
|
+
}
|
|
2767
|
+
/**
|
|
2759
2768
|
* Await a terminal result. With `executionId`, drains only that execution;
|
|
2760
2769
|
* without it, reads status and selects the latest execution. Event replay
|
|
2761
2770
|
* makes either form safe after the execution has already finished.
|
|
@@ -3189,7 +3198,7 @@ function normalizeProvisionStep(raw) {
|
|
|
3189
3198
|
* response into a {@link StartupDiagnostics}, deriving the
|
|
3190
3199
|
* operation-name → duration `phases` map. Returns `null` when the
|
|
3191
3200
|
* payload is absent or carries no operations — diagnostics are emitted
|
|
3192
|
-
*
|
|
3201
|
+
* on create and lifecycle responses, so most ordinary reads have no payload to
|
|
3193
3202
|
* normalize.
|
|
3194
3203
|
*/
|
|
3195
3204
|
function normalizeStartupDiagnostics(raw) {
|
|
@@ -5213,7 +5222,12 @@ var SandboxInstance = class SandboxInstance {
|
|
|
5213
5222
|
const buffer = await response.arrayBuffer();
|
|
5214
5223
|
await fs.writeFile(tempTarPath, Buffer.from(buffer));
|
|
5215
5224
|
await fs.mkdir(localDir, { recursive: true });
|
|
5216
|
-
|
|
5225
|
+
try {
|
|
5226
|
+
execSync(`tar -xzf "${tempTarPath}" -C "${localDir}"`, { stdio: "pipe" });
|
|
5227
|
+
} catch (error) {
|
|
5228
|
+
const stderr = error.stderr?.toString().trim();
|
|
5229
|
+
throw new Error(`downloadDir: host tar failed to extract the archive${stderr ? ` — ${stderr}` : ""}`);
|
|
5230
|
+
}
|
|
5217
5231
|
} finally {
|
|
5218
5232
|
await fs.rm(tempDir, { recursive: true }).catch(() => {});
|
|
5219
5233
|
}
|
|
@@ -5488,12 +5502,9 @@ var SandboxInstance = class SandboxInstance {
|
|
|
5488
5502
|
* console.log(`Backend: ${status.type}, Status: ${status.status}`);
|
|
5489
5503
|
* ```
|
|
5490
5504
|
*
|
|
5491
|
-
* @example
|
|
5505
|
+
* @example Point the backend at a different model
|
|
5492
5506
|
* ```typescript
|
|
5493
|
-
* await box.backend.
|
|
5494
|
-
* command: "npx",
|
|
5495
|
-
* args: ["-y", "@anthropic/web-search"],
|
|
5496
|
-
* });
|
|
5507
|
+
* await box.backend.updateConfig({ model: "openai/gpt-5-mini" });
|
|
5497
5508
|
* ```
|
|
5498
5509
|
*
|
|
5499
5510
|
* @example Read provider-native Cursor metadata
|
|
@@ -5506,8 +5517,6 @@ var SandboxInstance = class SandboxInstance {
|
|
|
5506
5517
|
get backend() {
|
|
5507
5518
|
return {
|
|
5508
5519
|
status: () => this.backendStatus(),
|
|
5509
|
-
capabilities: () => this.backendCapabilities(),
|
|
5510
|
-
addMcp: (name, config) => this.backendAddMcp(name, config),
|
|
5511
5520
|
getMcpStatus: () => this.backendGetMcpStatus(),
|
|
5512
5521
|
updateConfig: (config) => this.backendUpdateConfig(config),
|
|
5513
5522
|
account: () => this.backendAccount(),
|
|
@@ -5528,36 +5537,13 @@ var SandboxInstance = class SandboxInstance {
|
|
|
5528
5537
|
}
|
|
5529
5538
|
async backendStatus() {
|
|
5530
5539
|
await this.ensureRunning();
|
|
5531
|
-
const response = await this.runtimeFetch("/backend
|
|
5532
|
-
if (!response.ok) {
|
|
5533
|
-
const body = await response.text();
|
|
5534
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5535
|
-
}
|
|
5536
|
-
return await response.json();
|
|
5537
|
-
}
|
|
5538
|
-
async backendCapabilities() {
|
|
5539
|
-
await this.ensureRunning();
|
|
5540
|
-
const response = await this.runtimeFetch("/backend/capabilities", { method: "GET" });
|
|
5540
|
+
const response = await this.runtimeFetch("/backend", { method: "GET" });
|
|
5541
5541
|
if (!response.ok) {
|
|
5542
5542
|
const body = await response.text();
|
|
5543
5543
|
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5544
5544
|
}
|
|
5545
5545
|
return await response.json();
|
|
5546
5546
|
}
|
|
5547
|
-
async backendAddMcp(name, config) {
|
|
5548
|
-
await this.ensureRunning();
|
|
5549
|
-
const response = await this.runtimeFetch("/backend/mcp", {
|
|
5550
|
-
method: "POST",
|
|
5551
|
-
body: JSON.stringify({
|
|
5552
|
-
name,
|
|
5553
|
-
config
|
|
5554
|
-
})
|
|
5555
|
-
});
|
|
5556
|
-
if (!response.ok) {
|
|
5557
|
-
const body = await response.text();
|
|
5558
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5559
|
-
}
|
|
5560
|
-
}
|
|
5561
5547
|
async backendGetMcpStatus() {
|
|
5562
5548
|
await this.ensureRunning();
|
|
5563
5549
|
const response = await this.runtimeFetch("/backend/mcp", { method: "GET" });
|
|
@@ -5569,9 +5555,9 @@ var SandboxInstance = class SandboxInstance {
|
|
|
5569
5555
|
}
|
|
5570
5556
|
async backendUpdateConfig(config) {
|
|
5571
5557
|
await this.ensureRunning();
|
|
5572
|
-
const response = await this.runtimeFetch("/backend/
|
|
5573
|
-
method: "
|
|
5574
|
-
body: JSON.stringify(
|
|
5558
|
+
const response = await this.runtimeFetch("/backend/configure", {
|
|
5559
|
+
method: "POST",
|
|
5560
|
+
body: JSON.stringify(config)
|
|
5575
5561
|
});
|
|
5576
5562
|
if (!response.ok) {
|
|
5577
5563
|
const body = await response.text();
|
|
@@ -6839,8 +6825,9 @@ var SandboxInstance = class SandboxInstance {
|
|
|
6839
6825
|
const body = await response.text();
|
|
6840
6826
|
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
6841
6827
|
}
|
|
6842
|
-
const
|
|
6843
|
-
await this.refresh();
|
|
6828
|
+
const data = await this.readLifecycleResponse(response);
|
|
6829
|
+
if (!this.applyLifecycleResponse(data)) await this.refresh();
|
|
6830
|
+
const diagnostics = data ? normalizeStartupDiagnostics(data.startupDiagnostics) : null;
|
|
6844
6831
|
if (diagnostics) this.info.startupDiagnostics = diagnostics;
|
|
6845
6832
|
}
|
|
6846
6833
|
/**
|
|
@@ -6858,8 +6845,9 @@ var SandboxInstance = class SandboxInstance {
|
|
|
6858
6845
|
const body = await response.text();
|
|
6859
6846
|
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
6860
6847
|
}
|
|
6861
|
-
const
|
|
6862
|
-
await this.refresh();
|
|
6848
|
+
const data = await this.readLifecycleResponse(response);
|
|
6849
|
+
if (!this.applyLifecycleResponse(data)) await this.refresh();
|
|
6850
|
+
const diagnostics = data ? normalizeStartupDiagnostics(data.startupDiagnostics) : null;
|
|
6863
6851
|
if (diagnostics) this.info.startupDiagnostics = diagnostics;
|
|
6864
6852
|
}
|
|
6865
6853
|
/**
|
|
@@ -6891,13 +6879,19 @@ var SandboxInstance = class SandboxInstance {
|
|
|
6891
6879
|
};
|
|
6892
6880
|
}
|
|
6893
6881
|
/**
|
|
6894
|
-
* Read
|
|
6895
|
-
*
|
|
6896
|
-
*
|
|
6882
|
+
* Read a lifecycle response body once.
|
|
6883
|
+
*
|
|
6884
|
+
* Current APIs return the complete sandbox state. Older APIs return an empty
|
|
6885
|
+
* body, so callers refresh when this method cannot recover a state payload.
|
|
6897
6886
|
*/
|
|
6898
|
-
async
|
|
6899
|
-
|
|
6900
|
-
|
|
6887
|
+
async readLifecycleResponse(response) {
|
|
6888
|
+
return await response.json().catch(() => null);
|
|
6889
|
+
}
|
|
6890
|
+
applyLifecycleResponse(data) {
|
|
6891
|
+
if (!data || data.id !== this.id || typeof data.status !== "string" || typeof data.createdAt !== "string") return false;
|
|
6892
|
+
this.info = this.parseInfo(data, this.info);
|
|
6893
|
+
sandboxStatusObservedAt.set(this, Date.now());
|
|
6894
|
+
return true;
|
|
6901
6895
|
}
|
|
6902
6896
|
/**
|
|
6903
6897
|
* Upload a local directory to the sandbox via tar.
|
|
@@ -7032,6 +7026,7 @@ var SandboxInstance = class SandboxInstance {
|
|
|
7032
7026
|
} catch (err) {
|
|
7033
7027
|
if (err instanceof StateError || err instanceof TimeoutError) throw err;
|
|
7034
7028
|
}
|
|
7029
|
+
if (this.hasFreshStatus() && this.hasReachedWaitTarget(statuses)) return;
|
|
7035
7030
|
while (true) {
|
|
7036
7031
|
if (options?.signal?.aborted) throw new TimeoutError(0, "Aborted");
|
|
7037
7032
|
await this.refresh();
|
|
@@ -7096,6 +7091,11 @@ var SandboxInstance = class SandboxInstance {
|
|
|
7096
7091
|
if (!statuses.includes(this.status)) return false;
|
|
7097
7092
|
return this.status !== "running" || this.filesystemIncarnationReadiness === "ready";
|
|
7098
7093
|
}
|
|
7094
|
+
hasFreshStatus() {
|
|
7095
|
+
const statusObservedAt = sandboxStatusObservedAt.get(this) ?? 0;
|
|
7096
|
+
const statusAgeMs = Date.now() - statusObservedAt;
|
|
7097
|
+
return statusObservedAt > 0 && statusAgeMs >= 0 && statusAgeMs < SANDBOX_STATUS_FRESHNESS_MS;
|
|
7098
|
+
}
|
|
7099
7099
|
async ensureRunning(signal) {
|
|
7100
7100
|
signal?.throwIfAborted();
|
|
7101
7101
|
const statusObservedAt = sandboxStatusObservedAt.get(this) ?? 0;
|
|
@@ -7599,6 +7599,10 @@ var SandboxInstance = class SandboxInstance {
|
|
|
7599
7599
|
}
|
|
7600
7600
|
return normalizeSessionInfo(await response.json());
|
|
7601
7601
|
}
|
|
7602
|
+
/** @internal — invoked by SandboxSession.runs(). */
|
|
7603
|
+
async _sessionRuns(id) {
|
|
7604
|
+
return this.runtime.runs(id);
|
|
7605
|
+
}
|
|
7602
7606
|
/** @internal — invoked by SandboxSession.events(). */
|
|
7603
7607
|
async *_sessionEvents(id, opts, stopOnTurnTerminal = false) {
|
|
7604
7608
|
await this.ensureRunning();
|
package/dist/tangle/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TANGLE_JOBS_CONTRACT, c as AgentSandboxBlueprintAbi, d as SandboxCreateParamTypes, f as SandboxCreateResponseParamTypes, i as TANGLE_CHAIN_ID, l as ITangleJobsAbi, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, p as SandboxIdParamTypes, r as JOB_SANDBOX_DELETE, s as TangleSandboxClientConfig, t as TangleSandboxClient, u as JsonResponseParamTypes } from "../index-
|
|
1
|
+
import { a as TANGLE_JOBS_CONTRACT, c as AgentSandboxBlueprintAbi, d as SandboxCreateParamTypes, f as SandboxCreateResponseParamTypes, i as TANGLE_CHAIN_ID, l as ITangleJobsAbi, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, p as SandboxIdParamTypes, r as JOB_SANDBOX_DELETE, s as TangleSandboxClientConfig, t as TangleSandboxClient, u as JsonResponseParamTypes } from "../index-DcWLZb5F.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TANGLE_MAINNET_RPC, TangleSandboxClient, TangleSandboxClientConfig };
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-
|
|
1
|
+
import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-BbYJI8g_.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TANGLE_MAINNET_RPC, TangleSandboxClient };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as parseErrorResponse } from "./errors-C6kn-3zt.js";
|
|
2
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
2
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-DsnIsKUL.js";
|
|
3
3
|
//#region src/tangle/abi.ts
|
|
4
4
|
/**
|
|
5
5
|
* Tangle Contract ABI Definitions
|
|
@@ -3043,6 +3043,23 @@ interface SandboxRuntimeCapabilities {
|
|
|
3043
3043
|
* Lifecycle state of an agent session inside a sandbox.
|
|
3044
3044
|
*/
|
|
3045
3045
|
type SessionStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
|
|
3046
|
+
/** Lifecycle state of an execution retained in the session replay ledger. */
|
|
3047
|
+
type SessionExecutionStatus = "active" | "completed" | "failed" | "cancelled";
|
|
3048
|
+
/**
|
|
3049
|
+
* Durable metadata for one session execution.
|
|
3050
|
+
*
|
|
3051
|
+
* The values come from the runtime replay ledger, not from a provider
|
|
3052
|
+
* response or an inferred model result.
|
|
3053
|
+
*/
|
|
3054
|
+
interface SessionExecutionInfo {
|
|
3055
|
+
executionId: string;
|
|
3056
|
+
sessionId: string;
|
|
3057
|
+
status: SessionExecutionStatus;
|
|
3058
|
+
startedAt: number;
|
|
3059
|
+
completedAt?: number;
|
|
3060
|
+
eventCount: number;
|
|
3061
|
+
lastEventId: string;
|
|
3062
|
+
}
|
|
3046
3063
|
/** Secret-free model tuple selected by the sandbox runtime. */
|
|
3047
3064
|
/**
|
|
3048
3065
|
* Which layer supplied the model id that executed. `request` means the model
|
|
@@ -4681,8 +4698,24 @@ interface BackendStatus {
|
|
|
4681
4698
|
version?: string;
|
|
4682
4699
|
/** Error message if failed */
|
|
4683
4700
|
error?: string;
|
|
4684
|
-
/**
|
|
4685
|
-
|
|
4701
|
+
/** Capabilities the running backend reports, when it reports them */
|
|
4702
|
+
capabilities?: BackendCapabilities;
|
|
4703
|
+
}
|
|
4704
|
+
/** Status of one MCP server, as the runtime reports it. */
|
|
4705
|
+
interface BackendMcpServerStatus {
|
|
4706
|
+
name: string;
|
|
4707
|
+
status: "connected" | "disconnected" | "error" | "unknown";
|
|
4708
|
+
type?: "local" | "remote" | "stdio" | "http";
|
|
4709
|
+
error?: string;
|
|
4710
|
+
}
|
|
4711
|
+
/**
|
|
4712
|
+
* The runtime-adjustable backend settings. Thinking-token budgets are
|
|
4713
|
+
* per-run (`backend.model.maxThinkingTokens` on the run request), not part
|
|
4714
|
+
* of the durable config, and the server refuses them here.
|
|
4715
|
+
*/
|
|
4716
|
+
interface BackendRuntimeConfigUpdate {
|
|
4717
|
+
/** Model id for the running backend */
|
|
4718
|
+
model?: string;
|
|
4686
4719
|
}
|
|
4687
4720
|
/**
|
|
4688
4721
|
* Backend information.
|
|
@@ -5194,19 +5227,12 @@ interface PermissionsManager {
|
|
|
5194
5227
|
* Access via `sandbox.backend`.
|
|
5195
5228
|
*/
|
|
5196
5229
|
interface BackendManager {
|
|
5197
|
-
/** Get current backend status */
|
|
5230
|
+
/** Get current backend status, including reported capabilities */
|
|
5198
5231
|
status(): Promise<BackendStatus>;
|
|
5199
|
-
/** Get backend capabilities */
|
|
5200
|
-
capabilities(): Promise<BackendCapabilities>;
|
|
5201
|
-
/** Add MCP server at runtime (opencode only) */
|
|
5202
|
-
addMcp(name: string, config: McpServerConfig): Promise<void>;
|
|
5203
5232
|
/** Get MCP server status */
|
|
5204
|
-
getMcpStatus(): Promise<Record<string,
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
}>>;
|
|
5208
|
-
/** Update backend configuration */
|
|
5209
|
-
updateConfig(config: Partial<BackendConfig>): Promise<void>;
|
|
5233
|
+
getMcpStatus(): Promise<Record<string, BackendMcpServerStatus>>;
|
|
5234
|
+
/** Update the runtime-adjustable backend settings */
|
|
5235
|
+
updateConfig(config: BackendRuntimeConfigUpdate): Promise<void>;
|
|
5210
5236
|
/** Provider account metadata, when exposed by the backend SDK */
|
|
5211
5237
|
account(): Promise<BackendAccount>;
|
|
5212
5238
|
/** Provider model catalog, when exposed by the backend SDK */
|
|
@@ -6286,4 +6312,4 @@ interface CodeExecutionOptions {
|
|
|
6286
6312
|
idempotencyKey?: string;
|
|
6287
6313
|
}
|
|
6288
6314
|
//#endregion
|
|
6289
|
-
export {
|
|
6315
|
+
export { DurablePlanDecisionResult as $, UploadProgress as $i, RolloutScorer as $n, SandboxTerminalManager as $r, GpuLeaseStatus as $t, CommitTaskSessionOptions as A, SnapshotInfo as Ai, ProcessSpawnOptions as An, SandboxFleetToken as Ar, FleetDriveTurnRequest as At, CreateTaskSessionOptions as B, TaskSessionFileChange as Bi, PublicTemplateVersionInfo as Bn, SandboxIdentity as Br, GitAuth as Bt, BranchOptions as C, SessionMessage as Ci, PreviewLinkWaitOptions as Cn, SandboxFleetMachineMeteredUsage as Cr, FileUsageResult as Ct, CodeExecutionResult as D, SnapshotDeleteAcknowledgement as Di, ProcessLogEntry as Dn, SandboxFleetManifestMachine as Dr, FleetDispatchResultBufferOptions as Dt, CodeExecutionOptions as E, SessionStatus as Ei, ProcessListOptions as En, SandboxFleetManifest as Er, FleetDispatchResultBuffer as Et, CreateSandboxFleetOptions as F, StartupOperation as Fi, ProvisionEvent as Fn, SandboxFleetUsage as Fr, FleetPromptDispatchResult as Ft, DispatchedSession as G, TeeAttestationResponse as Gi, ReconcileSandboxFleetsOptions as Gn, SandboxResourceUsage as Gr, GitStatus as Gt, DevServerInfo as H, TaskSessionProfile as Hi, PublishPublicTemplateVersionOptions as Hn, SandboxIntelligenceEnvelope as Hr, GitCommit as Ht, CreateSandboxFleetTokenOptions as I, StorageConfig as Ii, ProvisionResult as In, SandboxFleetWorkspace as Ir, ForkCounts as It, DriveTurnOptions as J, TokenRefreshHandler as Ji, RestoreSnapshotOptions as Jn, SandboxRuntimeHealth as Jr, GpuLeaseCommandResult as Jt, DownloadOptions as K, TeePublicKey as Ki, ReconcileSandboxFleetsResult as Kn, SandboxResources as Kr, GpuLease as Kt, CreateSandboxFleetWithCoordinatorOptions as L, SubscriptionInfo as Li, ProvisionStatus as Ln, SandboxFleetWorkspaceReconcileResult as Lr, ForkIdempotency as Lt, CreateGpuLeaseOptions as M, SnapshotResult as Mi, PromptInputPart as Mn, SandboxFleetTraceEvent as Mr, FleetExecDispatchResult as Mt, CreateIntelligenceReportOptions as N, SshKeysManager as Ni, PromptOptions as Nn, SandboxFleetTraceExport as Nr, FleetMachineId as Nt, CodeLanguage as O, SnapshotDeleteOutcome as Oi, ProcessManager as On, SandboxFleetOperationsSummary as Or, FleetDispatchStreamOptions as Ot, CreateRequestOptions as P, StartupDiagnostics as Pi, PromptResult as Pn, SandboxFleetTraceOptions as Pr, FleetPromptDispatchOptions as Pt, DurablePlan as Q, UploadOptions as Qi, RolloutOptions as Qn, SandboxTerminalInfo as Qr, GpuLeaseProviderName as Qt, CreateSandboxOptions as R, TaskSessionChanges as Ri, ProvisionStep as Rn, SandboxFleetWorkspaceRestoreResult as Rr, ForkLookupOptions as Rt, BatchTaskResult as S, SessionListOptions as Si, PreviewLinkManager as Sn, SandboxFleetMachine as Sr, FileUsageOptions as St, ChunkedUploadResult as T, SessionResultOptions as Ti, ProcessInfo as Tn, SandboxFleetMachineSpec as Tr, FleetDispatchCancelResult as Tt, DirectoryPermission as U, TeeAttestationOptions as Ui, ReapExpiredSandboxFleetsOptions as Un, SandboxPortBinding as Ur, GitConfig as Ut, DeleteOptions as V, TaskSessionInfo as Vi, PublishPublicTemplateOptions as Vn, SandboxInfo as Vr, GitBranch as Vt, DispatchPromptOptions as W, TeeAttestationReport as Wi, ReapExpiredSandboxFleetsResult as Wn, SandboxPortPreviewLink as Wr, GitDiff as Wt, DriverInfo as X, TurnDriveResult as Xi, Rollout as Xn, SandboxTerminalAttachOptions as Xr, GpuLeaseExecResult as Xt, DriverConfig as Y, TokenUsage as Yi, ResumeOptions as Yn, SandboxStatus as Yr, GpuLeaseExecOptions as Yt, DriverType as Z, UpdateUserOptions as Zi, RolloutChildResult as Zn, SandboxTerminalCreateOptions as Zr, GpuLeaseManager as Zt, BatchBackend as _, SessionExecutionStatus as _i, NetworkManager as _n, SandboxFleetDispatchResponse as _r, FileRenameResult as _t, AgentQuestionRequest as a, WriteManyFile as aa, SandboxTraceOptions as ai, IntelligenceReportCompareTo as an, SandboxConfig as ar, EgressManager as at, BatchRunRequest as b, SessionInfo as bi, PermissionsManager as bn, SandboxFleetInfo as br, FileTreeOptions as bt, AttachGpuLeaseOptions as c, BatchEvent as ca, SearchOptions as ci, JsonValue as cn, SandboxCreateReceipt as cr, EventStreamOptions as ct, BackendConfig as d, BatchTaskUsage as da, SendSessionMessageOptions as di, ListSandboxFleetOptions as dn, SandboxEnvironment as dr, ExecResult as dt, UsageInfo as ea, SandboxTerminalRequestOptions as ei, HostAgentDriverConfig as en, RolloutStartResult as er, DurablePlanSnapshot as et, BackendInfo as f, PublicBatchRunRequest as fa, SendSessionMessageRequest as fi, ListSandboxOptions as fn, SandboxEvent as fr, FileInfo as ft, BackendStatus as g, SessionExecutionInfo as gi, NetworkConfig as gn, SandboxFleetDispatchFailureClass as gr, FileReadResult as gt, BackendRuntimeConfigUpdate as h, SessionEventStreamOptions as hi, MkdirOptions as hn, SandboxFleetCostEstimate as hr, FileReadError as ht, AgentApprovalRequirement as i, WriteFileOptions as ia, SandboxTraceExport as ii, IntelligenceReportBudget as in, SSHCredentials as ir, EgressDenial as it, CompletedTurnResult as j, SnapshotOptions as ji, ProcessStatus as jn, SandboxFleetTraceBundle as jr, FleetExecDispatchOptions as jt, CodeResultPart as k, SnapshotIdempotency as ki, ProcessSignal as kn, SandboxFleetPolicy as kr, FleetDriveTurnOutcome as kt, AttachSandboxFleetMachineOptions as l, BatchEventDataMap as la, SecretInfo as li, ListMessagesOptions as ln, SandboxDeleteAcknowledgement as lr, ExactProcessSpawnOptions as lt, BackendMcpServerStatus as m, parseBackendType as ma, SessionBackendCredentials as mi, McpServerConfig as mn, SandboxFleetArtifactSpec as mr, FileReadBatchResult as mt, AccessPolicyRule as n, WaitForRolloutOptions as na, SandboxTraceBundle as ni, InstalledTool as nn, RolloutTurnPart as nr, EffectiveBackendProfile as nt, AgentRunStatus as o, WriteManyOptions as oa, SandboxUser as oi, IntelligenceReportSubjectType as on, SandboxConnection as or, EgressPolicy as ot, BackendManager as p, BackendType as pa, SentSessionMessage as pi, MAX_EGRESS_DENIALS_LIMIT as pn, SandboxFleetArtifact as pr, FileReadBatchOptions as pt, DownloadProgress as q, TeePublicKeyResponse as qi, RenameOptions as qn, SandboxRuntimeCapabilities as qr, GpuLeaseBilling as qt, AddUserOptions as r, WorkspaceOperationLookup as ra, SandboxTraceEvent as ri, IntelligenceReport as rn, SSHCommandDescriptor as rr, EffectiveBackendSource as rt, AgentToolInvocation as s, BatchBackendStats as sa, SearchMatch as si, IntelligenceReportWindow as sn, SandboxCreateOutcome as sr, EnsureDevServerOptions as st, AcceleratorKind as t, WaitForOptions as ta, SandboxTerminals as ti, HostAgentRuntimeBackend as tn, RolloutStatus as tr, EffectiveBackend as tt, BackendCapabilities as u, BatchSidecarGroup as ua, SecretsManager as ui, ListOptions as un, SandboxDeleteOutcome as ur, ExecOptions as ut, BatchResult as v, SessionFailureReason as vi, NonHostAgentDriverConfig as vn, SandboxFleetDriverCapability as vr, FileSystem as vt, ChunkedUploadOptions as w, SessionMessageInputPart as wi, Process as wn, SandboxFleetMachineRecord as wr, FileWriteResult as wt, BatchTask as x, SessionInterruptOptions as xi, PreviewLinkInfo as xn, SandboxFleetIntelligenceEnvelope as xr, FileTreeResult as xt, BatchRunOptions as y, SessionForkOptions as yi, PermissionLevel as yn, SandboxFleetDriverTimings as yr, FileTreeFile as yt, CreateSessionOptions as z, TaskSessionCommitResult as zi, PublicTemplateInfo as zn, SandboxFleetWorkspaceSnapshotResult as zr, GPU_LEASE_PROVIDER_NAMES as zt };
|