@tangle-network/sandbox 0.10.4 → 0.10.5-develop.20260713235503.8f2cefc
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 +13 -0
- package/dist/agent/index.d.ts +3 -3
- package/dist/{client-B8i6qrQr.d.ts → client-C-4NcZoa.d.ts} +7 -3
- package/dist/{client-DTpHjPjc.js → client-CL_cbjU4.js} +106 -54
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-QZXrXdIb.js → collaboration-CcZE2xMl.js} +1 -1
- package/dist/core.d.ts +4 -4
- package/dist/core.js +3 -3
- package/dist/{errors--P_nbLzM.d.ts → errors-CNCz3Ms9.d.ts} +1 -1
- package/dist/{errors-DSz87Rkk.js → errors-wd266B9Q.js} +3 -3
- package/dist/{index-BFnMEze6.d.ts → index-DFJiN98I.d.ts} +2 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/intelligence/index.js +1 -1
- package/dist/{runtime-api-CYA2DUQw.js → runtime-api-CaXI7Kl2.js} +16 -2
- package/dist/runtime.d.ts +9 -6
- package/dist/runtime.js +5 -3
- package/dist/{sandbox-BtNWbfd3.d.ts → sandbox-BvNEOnIl.d.ts} +6 -10
- package/dist/{sandbox-Be9WAqSg.js → sandbox-CIHssZCH.js} +84 -44
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-D6UfK_B0.js → tangle-C-5OvIj8.js} +2 -2
- package/dist/{types-BvSoEHz8.d.ts → types-yNRVRww-.d.ts} +61 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -206,6 +206,19 @@ client.connect();
|
|
|
206
206
|
detection, replay-on-reconnect, and `lastEventId` persistence. None of this requires a
|
|
207
207
|
Durable Object.
|
|
208
208
|
|
|
209
|
+
Server-originated product events can arrive before the browser connects:
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
await client.broadcastSessionAgentEvent(sessionId, {
|
|
213
|
+
type: "project.provision_progress",
|
|
214
|
+
properties: { message: "Creating workspace" },
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The public API binds that pending queue to the authenticated product and Sandbox account and commits it to Redis before returning `success: true`.
|
|
219
|
+
A later connection by the same owner leases and acknowledges the ordered queue; another owner receives none of it.
|
|
220
|
+
A gateway crash before acknowledgement redelivers the same event IDs, which the default `SessionGatewayClient` deduplicates before invoking handlers.
|
|
221
|
+
|
|
209
222
|
See `examples/cf-worker-chat.ts`, `examples/browser-streaming-resume.ts`, and
|
|
210
223
|
`examples/reconnect-from-last-event-id.ts` for end-to-end patterns.
|
|
211
224
|
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as CodeLanguage, E as CodeExecutionResult, T as CodeExecutionOptions, k as CodeResultPart } from "../types-
|
|
2
|
-
import { n as SandboxInstance } from "../sandbox-
|
|
3
|
-
import { i as SandboxClient } from "../client-
|
|
1
|
+
import { D as CodeLanguage, E as CodeExecutionResult, T as CodeExecutionOptions, k as CodeResultPart } from "../types-yNRVRww-.js";
|
|
2
|
+
import { n as SandboxInstance } from "../sandbox-BvNEOnIl.js";
|
|
3
|
+
import { i as SandboxClient } from "../client-C-4NcZoa.js";
|
|
4
4
|
import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
5
|
|
|
6
6
|
//#region src/agent/tools/_specs.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as TraceExportSink, i as TraceExportResult, n as SandboxInstance, t as HttpClient } from "./sandbox-
|
|
1
|
+
import { $n as SandboxFleetInfo, Ci as TokenRefreshHandler, Cn as PublishPublicTemplateOptions, Dn as ReconcileSandboxFleetsOptions, En as ReapExpiredSandboxFleetsResult, F as CreateSandboxFleetOptions, Gr as SecretsManager, Gt as IntelligenceReportWindow, Hn as SandboxClientConfig, Ht as IntelligenceReportBudget, I as CreateSandboxFleetTokenOptions, Jn as SandboxFleetCostEstimate, Kn as SandboxFleetArtifact, L as CreateSandboxFleetWithCoordinatorOptions, N as CreateIntelligenceReportOptions, On as ReconcileSandboxFleetsResult, P as CreateRequestOptions, R as CreateSandboxOptions, Sn as PublicTemplateVersionInfo, Tn as ReapExpiredSandboxFleetsOptions, Ut as IntelligenceReportCompareTo, Vt as IntelligenceReport, Wn as SandboxEnvironment, Xn as SandboxFleetDispatchResponse, Xt as ListSandboxOptions, Yt as ListSandboxFleetOptions, Zn as SandboxFleetDriverCapability, _ as BatchResult, _r as SandboxFleetWorkspaceRestoreResult, _t as FleetExecDispatchOptions, a as AttachSandboxFleetMachineOptions, ar as SandboxFleetManifest, bt as FleetPromptDispatchOptions, et as ExecOptions, g as BatchOptions, gn as PromptResult, gr as SandboxFleetWorkspaceReconcileResult, gt as FleetDispatchStreamOptions, hn as PromptOptions, ht as FleetDispatchResultBufferOptions, ki as UsageInfo, lr as SandboxFleetToken, m as BatchEvent, mn as PromptInputPart, mr as SandboxFleetUsage, mt as FleetDispatchResultBuffer, oi as SshKeysManager, pr as SandboxFleetTraceOptions, pt as FleetDispatchCancelResult, qn as SandboxFleetArtifactSpec, rr as SandboxFleetMachineRecord, sr as SandboxFleetOperationsSummary, tt as ExecResult, ui as SubscriptionInfo, ur as SandboxFleetTraceBundle, v as BatchRunOptions, vr as SandboxFleetWorkspaceSnapshotResult, vt as FleetExecDispatchResult, wn as PublishPublicTemplateVersionOptions, wr as SandboxProfileSummary, x as BatchTask, xn as PublicTemplateInfo, xt as FleetPromptDispatchResult, y as BatchRunRequest, yr as SandboxInfo, yt as FleetMachineId } from "./types-yNRVRww-.js";
|
|
2
|
+
import { a as TraceExportSink, i as TraceExportResult, n as SandboxInstance, t as HttpClient } from "./sandbox-BvNEOnIl.js";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/sse-parser.d.ts
|
|
5
5
|
/**
|
|
@@ -194,7 +194,11 @@ interface SessionBroadcastEvent {
|
|
|
194
194
|
data?: unknown;
|
|
195
195
|
channel?: string;
|
|
196
196
|
}
|
|
197
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* Result returned after Sandbox accepts or rejects a session event.
|
|
199
|
+
* For a session that has not connected yet, `success: true` means the event
|
|
200
|
+
* was durably queued for the authenticated owner.
|
|
201
|
+
*/
|
|
198
202
|
interface SessionBroadcastResult {
|
|
199
203
|
success: boolean;
|
|
200
204
|
sessionId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as NotFoundError, d as TimeoutError, f as ValidationError, i as NetworkError, p as parseErrorResponse, t as AuthError } from "./errors-
|
|
2
|
-
import { d as exportTraceBundle, g as parseSSEStream, l as normalizeConnection, m as encodePromptForWire, n as normalizeStartupDiagnostics, t as SandboxInstance } from "./sandbox-
|
|
1
|
+
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, p as parseErrorResponse, t as AuthError } from "./errors-wd266B9Q.js";
|
|
2
|
+
import { d as exportTraceBundle, g as parseSSEStream, l as normalizeConnection, m as encodePromptForWire, n as normalizeStartupDiagnostics, t as SandboxInstance } from "./sandbox-CIHssZCH.js";
|
|
3
3
|
//#region src/resources.ts
|
|
4
4
|
/**
|
|
5
5
|
* Compute tiers, ordered smallest → largest. Defined HERE (not imported from
|
|
@@ -100,7 +100,7 @@ const DEFAULT_MACHINE_LIFETIME_SECONDS = 3600;
|
|
|
100
100
|
const DEFAULT_MAX_CONCURRENT_CREATES = 4;
|
|
101
101
|
const MAX_CONCURRENT_ARTIFACT_READS = 8;
|
|
102
102
|
const DEFAULT_ARTIFACT_ROOT = "/workspace";
|
|
103
|
-
const DEFAULT_MAX_ARTIFACT_BYTES =
|
|
103
|
+
const DEFAULT_MAX_ARTIFACT_BYTES = 10 * 1024 * 1024;
|
|
104
104
|
const MAX_MACHINE_ID_LENGTH = 64;
|
|
105
105
|
const machineIdPattern = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
|
|
106
106
|
function createFleetId() {
|
|
@@ -997,6 +997,41 @@ const DEFAULT_TIMEOUT_MS = 3e4;
|
|
|
997
997
|
*/
|
|
998
998
|
const DEFAULT_CREATE_TIMEOUT_MS = 12e4;
|
|
999
999
|
const DEFAULT_GPU_CREATE_TIMEOUT_MS = 900 * 1e3;
|
|
1000
|
+
const CREATE_POST_MAX_ATTEMPTS = 5;
|
|
1001
|
+
const CREATE_RETRY_BASE_DELAY_MS = 250;
|
|
1002
|
+
const CREATE_RETRY_MAX_DELAY_MS = 4e3;
|
|
1003
|
+
const RETRYABLE_CREATE_STATUS_CODES = new Set([
|
|
1004
|
+
408,
|
|
1005
|
+
425,
|
|
1006
|
+
429,
|
|
1007
|
+
500,
|
|
1008
|
+
502,
|
|
1009
|
+
503,
|
|
1010
|
+
504
|
|
1011
|
+
]);
|
|
1012
|
+
function isRetryableCreateError(error) {
|
|
1013
|
+
if (error instanceof NetworkError) return true;
|
|
1014
|
+
return error instanceof SandboxError && error.status !== void 0 && RETRYABLE_CREATE_STATUS_CODES.has(error.status);
|
|
1015
|
+
}
|
|
1016
|
+
function createRetryDelayMs(error, failedAttempt) {
|
|
1017
|
+
if (error instanceof SandboxError && error.retryAfterMs !== void 0) return error.retryAfterMs;
|
|
1018
|
+
return Math.min(CREATE_RETRY_BASE_DELAY_MS * 2 ** Math.max(0, failedAttempt - 1), CREATE_RETRY_MAX_DELAY_MS);
|
|
1019
|
+
}
|
|
1020
|
+
async function waitForCreateRetry(delayMs, signal) {
|
|
1021
|
+
if (signal.aborted) throw signal.reason ?? /* @__PURE__ */ new Error("Sandbox create aborted");
|
|
1022
|
+
if (delayMs <= 0) return;
|
|
1023
|
+
await new Promise((resolve, reject) => {
|
|
1024
|
+
const timeoutId = setTimeout(() => {
|
|
1025
|
+
signal.removeEventListener("abort", onAbort);
|
|
1026
|
+
resolve();
|
|
1027
|
+
}, delayMs);
|
|
1028
|
+
const onAbort = () => {
|
|
1029
|
+
clearTimeout(timeoutId);
|
|
1030
|
+
reject(signal.reason ?? /* @__PURE__ */ new Error("Sandbox create aborted"));
|
|
1031
|
+
};
|
|
1032
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1000
1035
|
/**
|
|
1001
1036
|
* Extra grace the SDK's client-side batch deadline gets on top of
|
|
1002
1037
|
* the server-side `timeoutMs`. The server's clock starts when the
|
|
@@ -1294,60 +1329,77 @@ var SandboxClient = class {
|
|
|
1294
1329
|
const resources = normalizeSandboxResources(options?.resources, options?.driver);
|
|
1295
1330
|
const postDeadline = AbortSignal.timeout(timeoutMs);
|
|
1296
1331
|
const postSignal = requestOptions?.signal ? AbortSignal.any([requestOptions.signal, postDeadline]) : postDeadline;
|
|
1332
|
+
const createRequestBody = JSON.stringify({
|
|
1333
|
+
name: options?.name,
|
|
1334
|
+
...resolvedEnvironment !== void 0 ? {
|
|
1335
|
+
environment: resolvedEnvironment,
|
|
1336
|
+
image: resolvedEnvironment
|
|
1337
|
+
} : {},
|
|
1338
|
+
git,
|
|
1339
|
+
tools: options?.tools,
|
|
1340
|
+
bare: options?.bare,
|
|
1341
|
+
...options?.publicEdge === false ? { publicEdge: false } : {},
|
|
1342
|
+
driver: options?.driver,
|
|
1343
|
+
backend: resolvedBackend,
|
|
1344
|
+
permissions: options?.permissions,
|
|
1345
|
+
env: options?.env,
|
|
1346
|
+
resources,
|
|
1347
|
+
gpuLease: options?.gpuLease,
|
|
1348
|
+
sshEnabled: options?.sshEnabled,
|
|
1349
|
+
sshPublicKeys: options?.sshPublicKeys ?? (options?.sshPublicKey ? [options.sshPublicKey] : void 0),
|
|
1350
|
+
sshKeyIds: options?.sshKeyIds,
|
|
1351
|
+
webTerminalEnabled: options?.webTerminalEnabled,
|
|
1352
|
+
maxLifetimeSeconds: options?.maxLifetimeSeconds,
|
|
1353
|
+
idleTimeoutSeconds: options?.idleTimeoutSeconds,
|
|
1354
|
+
storage: options?.storage,
|
|
1355
|
+
ephemeral: options?.ephemeral,
|
|
1356
|
+
fromSnapshot: options?.fromSnapshot,
|
|
1357
|
+
fromSandboxId: options?.fromSandboxId,
|
|
1358
|
+
templateId: options?.templateId,
|
|
1359
|
+
publicTemplateId: options?.publicTemplateId,
|
|
1360
|
+
publicTemplateVersionId: options?.publicTemplateVersionId,
|
|
1361
|
+
secrets: options?.secrets,
|
|
1362
|
+
confidential: options?.confidential,
|
|
1363
|
+
metadata: options?.metadata,
|
|
1364
|
+
teamId: options?.teamId,
|
|
1365
|
+
capabilities: options?.capabilities,
|
|
1366
|
+
privacy: options?.privacy,
|
|
1367
|
+
egressPolicy: options?.egressPolicy,
|
|
1368
|
+
idempotencyKey
|
|
1369
|
+
});
|
|
1370
|
+
const createTimeoutError = () => new TimeoutError(timeoutMs, `Sandbox create did not complete within ${timeoutMs}ms. The provision may still be running server-side; retry create() with idempotencyKey="${idempotencyKey}" to join it.`);
|
|
1371
|
+
const waitBeforeRetry = async (error, failedAttempt) => {
|
|
1372
|
+
try {
|
|
1373
|
+
await waitForCreateRetry(createRetryDelayMs(error, failedAttempt), postSignal);
|
|
1374
|
+
} catch (waitError) {
|
|
1375
|
+
if (requestOptions?.signal?.aborted) throw waitError;
|
|
1376
|
+
throw createTimeoutError();
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1297
1379
|
let response;
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
backend: resolvedBackend,
|
|
1315
|
-
permissions: options?.permissions,
|
|
1316
|
-
env: options?.env,
|
|
1317
|
-
resources,
|
|
1318
|
-
gpuLease: options?.gpuLease,
|
|
1319
|
-
sshEnabled: options?.sshEnabled,
|
|
1320
|
-
sshPublicKeys: options?.sshPublicKeys ?? (options?.sshPublicKey ? [options.sshPublicKey] : void 0),
|
|
1321
|
-
sshKeyIds: options?.sshKeyIds,
|
|
1322
|
-
webTerminalEnabled: options?.webTerminalEnabled,
|
|
1323
|
-
maxLifetimeSeconds: options?.maxLifetimeSeconds,
|
|
1324
|
-
idleTimeoutSeconds: options?.idleTimeoutSeconds,
|
|
1325
|
-
storage: options?.storage,
|
|
1326
|
-
ephemeral: options?.ephemeral,
|
|
1327
|
-
fromSnapshot: options?.fromSnapshot,
|
|
1328
|
-
fromSandboxId: options?.fromSandboxId,
|
|
1329
|
-
templateId: options?.templateId,
|
|
1330
|
-
publicTemplateId: options?.publicTemplateId,
|
|
1331
|
-
publicTemplateVersionId: options?.publicTemplateVersionId,
|
|
1332
|
-
secrets: options?.secrets,
|
|
1333
|
-
confidential: options?.confidential,
|
|
1334
|
-
metadata: options?.metadata,
|
|
1335
|
-
teamId: options?.teamId,
|
|
1336
|
-
capabilities: options?.capabilities,
|
|
1337
|
-
privacy: options?.privacy,
|
|
1338
|
-
egressPolicy: options?.egressPolicy,
|
|
1339
|
-
idempotencyKey
|
|
1340
|
-
})
|
|
1341
|
-
});
|
|
1342
|
-
} catch (err) {
|
|
1343
|
-
if (requestOptions?.signal?.aborted) throw err;
|
|
1344
|
-
if (err instanceof TimeoutError || err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError")) throw new TimeoutError(timeoutMs, `Sandbox create did not complete within ${timeoutMs}ms. The provision may still be running server-side; retry create() with idempotencyKey="${idempotencyKey}" to join it.`);
|
|
1345
|
-
throw err;
|
|
1346
|
-
}
|
|
1347
|
-
if (!response.ok) {
|
|
1380
|
+
for (let attempt = 1; attempt <= CREATE_POST_MAX_ATTEMPTS; attempt++) {
|
|
1381
|
+
try {
|
|
1382
|
+
response = await this.fetch("/v1/sandboxes", {
|
|
1383
|
+
method: "POST",
|
|
1384
|
+
headers: { "Idempotency-Key": idempotencyKey },
|
|
1385
|
+
signal: postSignal,
|
|
1386
|
+
body: createRequestBody
|
|
1387
|
+
});
|
|
1388
|
+
} catch (error) {
|
|
1389
|
+
if (requestOptions?.signal?.aborted) throw error;
|
|
1390
|
+
if (postDeadline.aborted || Date.now() >= deadline || error instanceof TimeoutError || error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError")) throw createTimeoutError();
|
|
1391
|
+
if (attempt >= CREATE_POST_MAX_ATTEMPTS || !isRetryableCreateError(error)) throw error;
|
|
1392
|
+
await waitBeforeRetry(error, attempt);
|
|
1393
|
+
continue;
|
|
1394
|
+
}
|
|
1395
|
+
if (response.ok) break;
|
|
1348
1396
|
const body = await response.text();
|
|
1349
|
-
|
|
1397
|
+
const error = parseErrorResponse(response.status, body, void 0, response.headers);
|
|
1398
|
+
if (attempt >= CREATE_POST_MAX_ATTEMPTS || !isRetryableCreateError(error)) throw error;
|
|
1399
|
+
await waitBeforeRetry(error, attempt);
|
|
1400
|
+
response = void 0;
|
|
1350
1401
|
}
|
|
1402
|
+
if (!response) throw createTimeoutError();
|
|
1351
1403
|
const data = await response.json();
|
|
1352
1404
|
const instance = new SandboxInstance(this, this.parseInfo(data), resolvedBackend);
|
|
1353
1405
|
if (instance.status === "provisioning" || instance.status === "pending") {
|
|
@@ -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-CcZE2xMl.js";
|
|
2
2
|
export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as TimeoutError, i as NetworkError, p as parseErrorResponse } from "./errors-
|
|
1
|
+
import { d as TimeoutError, i as NetworkError, p as parseErrorResponse } from "./errors-wd266B9Q.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 {
|
|
2
|
-
import { n as SandboxInstance } from "./sandbox-
|
|
3
|
-
import { i as SandboxClient } from "./client-
|
|
4
|
-
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors
|
|
1
|
+
import { Ar as SandboxStatus, Hn as SandboxClientConfig, R as CreateSandboxOptions, an as PreviewLinkInfo, en as NetworkConfig, et as ExecOptions, on as PreviewLinkManager, tt as ExecResult, yr as SandboxInfo } from "./types-yNRVRww-.js";
|
|
2
|
+
import { n as SandboxInstance } from "./sandbox-BvNEOnIl.js";
|
|
3
|
+
import { i as SandboxClient } from "./client-C-4NcZoa.js";
|
|
4
|
+
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-CNCz3Ms9.js";
|
|
5
5
|
export { AuthError, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, QuotaError, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, type SandboxInfo, SandboxInstance, type SandboxStatus, ServerError, StateError, TimeoutError, ValidationError };
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, s as QuotaError, t as AuthError, u as StateError } from "./errors-
|
|
2
|
-
import { t as SandboxInstance } from "./sandbox-
|
|
3
|
-
import { n as SandboxClient } from "./client-
|
|
1
|
+
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
|
|
2
|
+
import { t as SandboxInstance } from "./sandbox-CIHssZCH.js";
|
|
3
|
+
import { n as SandboxClient } from "./client-CL_cbjU4.js";
|
|
4
4
|
export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxClient as Sandbox, SandboxClient, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError };
|
|
@@ -90,7 +90,7 @@ declare class PartialFailureError extends SandboxError {
|
|
|
90
90
|
declare class ValidationError extends SandboxError {
|
|
91
91
|
/** Field-level validation errors */
|
|
92
92
|
readonly fields?: Record<string, string>;
|
|
93
|
-
constructor(message: string, fields?: Record<string, string>, metadata?: SandboxErrorMetadata);
|
|
93
|
+
constructor(message: string, fields?: Record<string, string>, metadata?: SandboxErrorMetadata, code?: string);
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* The sandbox is not in a valid state for the requested operation.
|
|
@@ -109,8 +109,8 @@ var PartialFailureError = class extends SandboxError {
|
|
|
109
109
|
var ValidationError = class extends SandboxError {
|
|
110
110
|
/** Field-level validation errors */
|
|
111
111
|
fields;
|
|
112
|
-
constructor(message, fields, metadata) {
|
|
113
|
-
super(message,
|
|
112
|
+
constructor(message, fields, metadata, code = "VALIDATION_ERROR") {
|
|
113
|
+
super(message, code, 400, metadata);
|
|
114
114
|
this.name = "ValidationError";
|
|
115
115
|
this.fields = fields;
|
|
116
116
|
}
|
|
@@ -255,7 +255,7 @@ function parseErrorResponse(status, body, context, headers) {
|
|
|
255
255
|
if (isPartialFailureCode(code)) return new PartialFailureError(message, code, status, metadata, readFailures(data, errorObj));
|
|
256
256
|
if (code === "EGRESS_PROXY_RECOVERY_REQUIRED") return new EgressProxyRecoveryError(message, metadata);
|
|
257
257
|
switch (status) {
|
|
258
|
-
case 400: return new ValidationError(message, data.fields, metadata);
|
|
258
|
+
case 400: return new ValidationError(message, data.fields, metadata, code);
|
|
259
259
|
case 401: return new AuthError(message, metadata);
|
|
260
260
|
case 404: return new NotFoundError(data.resourceType || "Resource", data.resourceId || "unknown", metadata);
|
|
261
261
|
case 408: return new TimeoutError(data.timeoutMs || 3e4, message, metadata);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as CreateSandboxOptions } from "./types-
|
|
2
|
-
import { n as SandboxInstance, t as HttpClient } from "./sandbox-
|
|
1
|
+
import { R as CreateSandboxOptions } from "./types-yNRVRww-.js";
|
|
2
|
+
import { n as SandboxInstance, t as HttpClient } from "./sandbox-BvNEOnIl.js";
|
|
3
3
|
|
|
4
4
|
//#region src/tangle/abi.d.ts
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $ as EventStreamOptions, $n as
|
|
2
|
-
import { C as SandboxMcpConfig, D as buildSandboxMcpConfig, E as buildControlPlaneMcpConfig, S as SANDBOX_MCP_SERVER_NAME, T as SandboxMcpServerEntry, _ as RespondToPermissionOptions, a as TraceExportSink, b as BuildSandboxMcpConfigOptions, c as otelTraceIdForTangleTrace, d as SandboxSession, f as InteractiveAuthFile, g as InterruptResult, h as InteractiveSessionInfo, i as TraceExportResult, l as toOtelJson, m as InteractiveSessionHost, n as SandboxInstance, o as buildTraceExportPayload, p as InteractiveSessionHandle, r as TraceExportFormat, s as exportTraceBundle, u as SandboxTaskSession, v as StartInteractiveOptions, w as SandboxMcpEndpoint, x as CONTROL_PLANE_MCP_SERVER_NAME, y as BuildControlPlaneMcpConfigOptions } from "./sandbox-
|
|
3
|
-
import { a as Team, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, i as SandboxClient, l as SessionBroadcastResult, m as parseSSEStream, n as IntelligenceClient, o as TeamInvitation, p as ParsedSSEEvent, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as SandboxFleet } from "./client-
|
|
1
|
+
import { $ as EventStreamOptions, $n as SandboxFleetInfo, $r as SessionListOptions, $t as MkdirOptions, A as CommitTaskSessionOptions, Ai as WaitForOptions, Ar as SandboxStatus, At as GpuLeaseBilling, B as CreateTaskSessionOptions, Bi as AgentProfileMcpServer, Bn as SSHCommandDescriptor, Br as ScopedToken, Bt as InstalledTool, C as BatchTaskUsage, Ci as TokenRefreshHandler, Cn as PublishPublicTemplateOptions, Cr as SandboxPortPreviewLink, Ct as GitAuth, Di as UploadOptions, Dn as ReconcileSandboxFleetsOptions, Dr as SandboxRuntimeHealth, Dt as GitDiff, Ei as UpdateUserOptions, En as ReapExpiredSandboxFleetsResult, Er as SandboxResources, Et as GitConfig, F as CreateSandboxFleetOptions, Fi as AgentProfile, Fn as RolloutScorer, Fr as SandboxTraceBundle, Ft as GpuLeaseProviderName, G as DownloadOptions, Gi as AgentProfileResources, Gn as SandboxEvent, Gr as SecretsManager, Gt as IntelligenceReportWindow, H as DirectoryPermission, Hi as AgentProfilePermissionValue, Hn as SandboxClientConfig, Hr as SearchMatch, Ht as IntelligenceReportBudget, Ii as AgentProfileCapabilities, In as RolloutStartResult, Ir as SandboxTraceEvent, It as GpuLeaseStatus, J as DriverConfig, Ji as AgentSubagentProfile, Jn as SandboxFleetCostEstimate, Jr as SentSessionMessage, Jt as ListOptions, K as DownloadProgress, Ki as AgentProfileValidationIssue, Kn as SandboxFleetArtifact, Kr as SendSessionMessageOptions, L as CreateSandboxFleetWithCoordinatorOptions, Li as AgentProfileConfidential, Ln as RolloutStatus, Lr as SandboxTraceExport, Lt as GpuType, M as CreateGpuLeaseOptions, Mi as WriteFileOptions, Mn as Rollout, Mr as SandboxTerminalInfo, Mt as GpuLeaseExecOptions, N as CreateIntelligenceReportOptions, Ni as WriteManyFile, Nn as RolloutChildResult, Nr as SandboxTerminalManager, Nt as GpuLeaseExecResult, O as CodeResult, Oi as UploadProgress, On as ReconcileSandboxFleetsResult, Or as SandboxRuntimeProfile, Ot as GitStatus, P as CreateRequestOptions, Pi as WriteManyOptions, Pn as RolloutOptions, Pr as SandboxTerminalRequestOptions, Pt as GpuLeaseManager, Q as EgressPolicy, Qi as mergeAgentProfiles, Qn as SandboxFleetDriverTimings, Qr as SessionInfo, Qt as MintScopedTokenOptions, R as CreateSandboxOptions, Ri as AgentProfileConnection, Rn as RolloutTurnPart, Rr as SandboxTraceOptions, Rt as HostAgentDriverConfig, S as BatchTaskResult, Si as TeePublicKeyResponse, Sn as PublicTemplateVersionInfo, Sr as SandboxPortBinding, St as GPU_LEASE_PROVIDER_NAMES, Ti as TurnDriveResult, Tn as ReapExpiredSandboxFleetsOptions, Tr as SandboxResourceUsage, Tt as GitCommit, U as DispatchPromptOptions, Ui as AgentProfilePrompt, Un as SandboxConnection, Ur as SearchOptions, Ut as IntelligenceReportCompareTo, V as DeleteOptions, Vi as AgentProfileModelHints, Vn as SSHCredentials, Vr as ScopedTokenScope, Vt as IntelligenceReport, W as DispatchedSession, Wi as AgentProfileResourceRef, Wn as SandboxEnvironment, Wr as SecretInfo, Wt as IntelligenceReportSubjectType, X as DriverType, Xi as defineGitHubResource, Xn as SandboxFleetDispatchResponse, Xr as SessionEventStreamOptions, Xt as ListSandboxOptions, Y as DriverInfo, Yi as defineAgentProfile, Yn as SandboxFleetDispatchFailureClass, Yr as SessionBackendCredentials, Yt as ListSandboxFleetOptions, Z as EgressManager, Zi as defineInlineResource, Zn as SandboxFleetDriverCapability, Zr as SessionForkOptions, Zt as McpServerConfig, _ as BatchResult, _i as TaskSessionProfile, _n as ProvisionEvent, _r as SandboxFleetWorkspaceRestoreResult, _t as FleetExecDispatchOptions, a as AttachSandboxFleetMachineOptions, ai as SnapshotResult, an as PreviewLinkInfo, ar as SandboxFleetManifest, at as FileReadError, b as BatchSidecarGroup, bi as TeeAttestationResponse, bn as ProvisionStep, br as SandboxIntelligenceEnvelope, bt as FleetPromptDispatchOptions, c as BackendInfo, ci as StartupOperation, cn as ProcessInfo, cr as SandboxFleetPolicy, ct as FileSystem, d as BackendType, di as TaskOptions, dn as ProcessSignal, dr as SandboxFleetTraceEvent, dt as FileTreeResult, ei as SessionMessage, en as NetworkConfig, er as SandboxFleetIntelligenceEnvelope, et as ExecOptions, f as BatchBackend, fi as TaskResult, fn as ProcessSpawnOptions, fr as SandboxFleetTraceExport, ft as FileWriteResult, g as BatchOptions, gi as TaskSessionInfo, gn as PromptResult, gr as SandboxFleetWorkspaceReconcileResult, gt as FleetDispatchStreamOptions, h as BatchEventDataMap, hi as TaskSessionFileChange, hn as PromptOptions, hr as SandboxFleetWorkspace, ht as FleetDispatchResultBufferOptions, i as AttachGpuLeaseOptions, ii as SnapshotOptions, in as PermissionsManager, ir as SandboxFleetMachineSpec, it as FileReadBatchResult, j as CompletedTurnResult, ji as WaitForRolloutOptions, jr as SandboxTerminalCreateOptions, jt as GpuLeaseCommandResult, ki as UsageInfo, kn as RenameOptions, kr as SandboxRuntimeProfileList, kt as GpuLease, l as BackendManager, li as StorageConfig, ln as ProcessLogEntry, lr as SandboxFleetToken, lt as FileTreeFile, m as BatchEvent, mi as TaskSessionCommitResult, mr as SandboxFleetUsage, mt as FleetDispatchResultBuffer, n as AccessPolicyRule, ni as SessionStatus, nn as NonHostAgentDriverConfig, nr as SandboxFleetMachineMeteredUsage, nt as FileInfo, o as BackendCapabilities, on as PreviewLinkManager, or as SandboxFleetManifestMachine, ot as FileReadResult, p as BatchBackendStats, pi as TaskSessionChanges, pn as ProcessStatus, pr as SandboxFleetTraceOptions, pt as FleetDispatchCancelResult, q as DriveTurnOptions, qi as AgentProfileValidationResult, qn as SandboxFleetArtifactSpec, qr as SendSessionMessageRequest, qt as ListMessagesOptions, r as AddUserOptions, ri as SnapshotInfo, rn as PermissionLevel, rr as SandboxFleetMachineRecord, rt as FileReadBatchOptions, s as BackendConfig, si as StartupDiagnostics, sn as Process, sr as SandboxFleetOperationsSummary, st as FileRenameResult, t as AcceleratorKind, ti as SessionMessageInputPart, tn as NetworkManager, tr as SandboxFleetMachine, tt as ExecResult, u as BackendStatus, ui as SubscriptionInfo, un as ProcessManager, ur as SandboxFleetTraceBundle, ut as FileTreeOptions, v as BatchRunOptions, vi as TeeAttestationOptions, vn as ProvisionResult, vr as SandboxFleetWorkspaceSnapshotResult, w as BranchOptions, wi as ToolsConfig, wn as PublishPublicTemplateVersionOptions, wr as SandboxProfileSummary, wt as GitBranch, x as BatchTask, xi as TeePublicKey, xn as PublicTemplateInfo, xr as SandboxPermissionsConfig, y as BatchRunRequest, yi as TeeAttestationReport, yn as ProvisionStatus, yr as SandboxInfo, yt as FleetMachineId, z as CreateSessionOptions, zi as AgentProfileFileMount, zn as RunCodeOptions, zr as SandboxUser, zt as HostAgentRuntimeBackend } from "./types-yNRVRww-.js";
|
|
2
|
+
import { C as SandboxMcpConfig, D as buildSandboxMcpConfig, E as buildControlPlaneMcpConfig, S as SANDBOX_MCP_SERVER_NAME, T as SandboxMcpServerEntry, _ as RespondToPermissionOptions, a as TraceExportSink, b as BuildSandboxMcpConfigOptions, c as otelTraceIdForTangleTrace, d as SandboxSession, f as InteractiveAuthFile, g as InterruptResult, h as InteractiveSessionInfo, i as TraceExportResult, l as toOtelJson, m as InteractiveSessionHost, n as SandboxInstance, o as buildTraceExportPayload, p as InteractiveSessionHandle, r as TraceExportFormat, s as exportTraceBundle, u as SandboxTaskSession, v as StartInteractiveOptions, w as SandboxMcpEndpoint, x as CONTROL_PLANE_MCP_SERVER_NAME, y as BuildControlPlaneMcpConfigOptions } from "./sandbox-BvNEOnIl.js";
|
|
3
|
+
import { a as Team, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, i as SandboxClient, l as SessionBroadcastResult, m as parseSSEStream, n as IntelligenceClient, o as TeamInvitation, p as ParsedSSEEvent, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as SandboxFleet } from "./client-C-4NcZoa.js";
|
|
4
4
|
import { d as AnyTokenPayload, h as IssueCollaborationTokenOptions, m as CollaborationTokenPayload, p as CollaborationAccess } from "./index-CyHojkuA.js";
|
|
5
5
|
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-DKzapw-9.js";
|
|
6
|
-
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors
|
|
7
|
-
import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-
|
|
6
|
+
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-CNCz3Ms9.js";
|
|
7
|
+
import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-DFJiN98I.js";
|
|
8
8
|
|
|
9
9
|
//#region src/attestation-heartbeat.d.ts
|
|
10
10
|
interface TeeAttestationHeartbeatSample {
|
|
@@ -1371,4 +1371,4 @@ interface RouterEvalMatrixCaseResult {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
declare function runTangleRouterEvalMatrixInSandbox(options: RunTangleRouterEvalMatrixInSandboxOptions): Promise<RunTangleRouterEvalMatrixInSandboxResult>;
|
|
1373
1373
|
//#endregion
|
|
1374
|
-
export { type AcceleratorKind, type AccessPolicyRule, type AddUserOptions, type AgentProfile, type AgentProfileCapabilities, type AgentProfileConnection, type AgentProfileFileMount, type AgentProfileMcpServer, type AgentProfileModelHints, type AgentProfilePermissionValue, type AgentProfilePrompt, type AgentProfileResourceRef, type AgentProfileResources, type AgentProfileValidationIssue, type AgentProfileValidationResult, type AgentSubagentProfile, type AnyTokenPayload, type AttachGpuLeaseOptions, type AttachSandboxFleetMachineOptions, AuthError, type BackendCapabilities, type BackendConfig, type BackendInfo, type BackendManager, type BackendStatus, type BackendType, type BatchBackend, type BatchBackendStats, type BatchEvent, type BatchEventDataMap, type BatchOptions, type BatchResult, type BatchRunOptions, type BatchRunRequest, type BatchSidecarGroup, type BatchTask, type BatchTaskResult, type BatchTaskUsage, type BranchOptions, type BuildControlPlaneMcpConfigOptions, type BuildProgressEvent, type BuildSandboxMcpConfigOptions, CONTROL_PLANE_MCP_SERVER_NAME, CapabilityError, type CodeResult, type CollaborationAccess, type CollaborationBootstrapRequest, type CollaborationBootstrapResponse, CollaborationClient, type CollaborationClientConfig, type CollaborationDocumentAdapter, type CollaborationDocumentChange, type CollaborationDocumentRef, CollaborationFileBridge, type CollaborationFileBridgeOptions, type CollaborationFileEvent, type CollaborationPermissions, type CollaborationTokenPayload, type CollaborationTokenRefreshRequest, type CollaborationTokenRefreshResponse, type CollaborationTransportConfig, type CommitTaskSessionOptions, type CompletedTurnResult, type ConfidentialSandboxResult, type ConfidentialTeeType, type CreateConfidentialSandboxOptions, type CreateGpuLeaseOptions, type CreateIntelligenceReportOptions, type CreateRequestOptions, type CreateSandboxFleetOptions, type CreateSandboxFleetWithCoordinatorOptions, type CreateSandboxOptions, type CreateSessionOptions, type CreateTaskSessionOptions, type CreateTeamOptions, DEFAULT_SANDBOX_SIZE, type DeleteOptions, type DirectoryPermission, type DispatchPromptOptions, type DispatchedSession, type DownloadOptions, type DownloadProgress, type DriveTurnOptions, type DriverConfig, type DriverInfo, type DriverType, type EgressManager, type EgressPolicy, EgressProxyRecoveryError, type EventStreamOptions, type ExecOptions, type ExecResult, type FileInfo, type FileReadBatchOptions, type FileReadBatchResult, type FileReadError, type FileReadResult, type FileSystem, type FileTreeFile, type FileTreeOptions, type FileTreeResult, type FileWriteResult, type FleetDispatchCancelResult, type FleetDispatchResultBuffer, type FleetDispatchResultBufferOptions, type FleetDispatchStreamOptions, type FleetExecDispatchOptions, type FleetMachineId, type FleetPromptDispatchOptions, GPU_LEASE_PROVIDER_NAMES, type GitAuth, type GitBranch, type GitCommit, type GitConfig, type GitDiff, type GitStatus, type GpuLease, type GpuLeaseBilling, type GpuLeaseCommandResult, type GpuLeaseExecOptions, type GpuLeaseExecResult, type GpuLeaseManager, type GpuLeaseProviderName, type GpuLeaseStatus, type GpuType, type HostAgentDriverConfig, type HostAgentRuntimeBackend, Image, type ImageBuildClient, type ImageBuildClientConfig, type ImageBuildFetchClient, type ImageBuildOptions, type ImageBuildResult, ImageBuilder, type ImageSpec, type InstalledTool, IntelligenceClient, type IntelligenceReport, type IntelligenceReportBudget, type IntelligenceReportCompareTo, type IntelligenceReportSubjectType, type IntelligenceReportWindow, type InteractiveAuthFile, InteractiveSessionHandle, type InteractiveSessionHost, type InteractiveSessionInfo, type InterruptResult, type InviteTeamMemberOptions, type IssueCollaborationTokenOptions, type ListMessagesOptions, type ListOptions, type ListSandboxFleetOptions, type ListSandboxOptions, MANAGE_SANDBOXES_PARAMETERS, MANAGE_SANDBOXES_TOOL_NAME, type ManageSandboxesInput, type ManageSandboxesTool, type ManageSandboxesToolOptions, type MaterializeProfileFileMountsOptions, type MaterializeProfileFileMountsResult, type McpServerConfig, type MintScopedTokenOptions, type MkdirOptions, type NetworkConfig, NetworkError, type NetworkManager, type NonHostAgentDriverConfig, NotFoundError, type ParseSSEStreamOptions, type ParsedSSEEvent, PartialFailureError, type PermissionLevel, type PermissionsManager, type PreviewLinkInfo, type PreviewLinkManager, type Process, type ProcessInfo, type ProcessLogEntry, type ProcessManager, type ProcessSignal, type ProcessSpawnOptions, type ProcessStatus, type PromptOptions, type PromptResult, type ProvisionEvent, type ProvisionResult, type ProvisionStatus, type ProvisionStep, type PublicTemplateInfo, type PublicTemplateVersionInfo, type PublishPublicTemplateOptions, type PublishPublicTemplateVersionOptions, QuotaError, type ReapExpiredSandboxFleetsOptions, type ReapExpiredSandboxFleetsResult, type ReconcileSandboxFleetsOptions, type ReconcileSandboxFleetsResult, type RespondToPermissionOptions, type Rollout, type RolloutChildResult, type RolloutOptions, type RolloutScorer, type RolloutStartResult, type RolloutStatus, type RolloutTurnPart, type RouterEvalMatrixAgentProfile, type RouterEvalMatrixCaseResult, type RouterEvalMatrixHarness, type RouterEvalMatrixPayload, type RouterEvalMatrixSandboxBox, type RouterEvalMatrixSandboxClient, type RouterEvalMatrixScenario, type RouterEvalMatrixSuiteResponse, type RouterImportedRunResponse, type RouterSearchConfig, type RouterSearchConfigOptions, type RunCodeOptions, type RunTangleRouterEvalMatrixInSandboxOptions, type RunTangleRouterEvalMatrixInSandboxResult, SANDBOX_MCP_SERVER_NAME, SANDBOX_SIZE_PRESETS, SANDBOX_SIZE_PRESET_NAMES, type SSHCommandDescriptor, type SSHCredentials, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, type SandboxConnection, type SandboxEnvironment, SandboxError, type SandboxErrorJson, type SandboxEvent, type SandboxFailureDetail, SandboxFleet, type SandboxFleetArtifact, type SandboxFleetArtifactSpec, SandboxFleetClient, type SandboxFleetCostEstimate, type SandboxFleetDispatchFailureClass, type SandboxFleetDispatchResponse, type SandboxFleetDriverCapability, type SandboxFleetDriverTimings, type SandboxFleetInfo, type SandboxFleetIntelligenceEnvelope, type SandboxFleetMachine, type SandboxFleetMachineMeteredUsage, type SandboxFleetMachineRecord, type SandboxFleetMachineSpec, type SandboxFleetManifest, type SandboxFleetManifestMachine, type SandboxFleetOperationsSummary, type SandboxFleetPolicy, type SandboxFleetToken, type SandboxFleetTraceBundle, type SandboxFleetTraceEvent, type SandboxFleetTraceExport, type SandboxFleetTraceOptions, type SandboxFleetUsage, type SandboxFleetWorkspace, type SandboxFleetWorkspaceReconcileResult, type SandboxFleetWorkspaceRestoreResult, type SandboxFleetWorkspaceSnapshotResult, type SandboxInfo, SandboxInstance, type SandboxIntelligenceEnvelope, type SandboxMcpConfig, type SandboxMcpEndpoint, type SandboxMcpServerEntry, type SandboxPermissionsConfig, type SandboxPortBinding, type SandboxPortPreviewLink, type SandboxProfileSummary, type SandboxResourceUsage, type SandboxResources, type SandboxRuntimeHealth, type SandboxRuntimeProfile, type SandboxRuntimeProfileList, SandboxSession, type SandboxSizePreset, type SandboxStatus, SandboxTaskSession, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, type SandboxTraceBundle, type SandboxTraceEvent, type SandboxTraceExport, type SandboxTraceOptions, type SandboxUser, type SaveCollaborationSnapshotRequest, type SaveCollaborationSnapshotResponse, type ScopedToken, type ScopedTokenScope, type SearchMatch, type SearchOptions, type SecretInfo, type SecretsManager, type SendSessionMessageOptions, type SendSessionMessageRequest, type SentSessionMessage, ServerError, type SessionBackendCredentials, type SessionBroadcastEvent, type SessionBroadcastResult, type SessionEventStreamOptions, type SessionForkOptions, type SessionInfo, type SessionListOptions, type SessionMessage, type SessionMessageInputPart, type SessionStatus, type SnapshotInfo, type SnapshotOptions, type SnapshotResult, type SplitInlineProfileFileMountsResult, type StartInteractiveOptions, type StartupDiagnostics, type StartupOperation, StateError, type StorageConfig, type SubscriptionInfo, TangleSandboxClient, type TangleSandboxClientConfig, type TangleSearchProvider, type TaskOptions, type TaskResult, type TaskSessionChanges, type TaskSessionCommitResult, type TaskSessionFileChange, type TaskSessionInfo, type TaskSessionProfile, type Team, type TeamInvitation, type TeamMember, type TeeAttestationHeartbeat, type TeeAttestationHeartbeatOptions, type TeeAttestationHeartbeatSample, type TeeAttestationOptions, type TeeAttestationReport, type TeeAttestationResponse, type TeePublicKey, type TeePublicKeyResponse, TimeoutError, type TokenRefreshHandler, type ToolsConfig, type TraceExportFormat, type TraceExportResult, type TraceExportSink, type TurnDriveResult, type UpdateUserOptions, type UploadOptions, type UploadProgress, type UsageInfo, ValidationError, type WaitForOptions, type WaitForRolloutOptions, type WriteFileOptions, type WriteManyFile, type WriteManyOptions, applySandboxEventText, buildCollaborationDocumentId, buildControlPlaneMcpConfig, buildSandboxMcpConfig, buildTangleRouterEvalMatrixRequest, buildTangleRouterResponsesWebSearchRequest, buildTangleRouterSearchBackend, buildTangleRouterSearchProfile, buildTraceExportPayload, collectAgentResponseText, createConfidentialSandbox, createManageSandboxesTool, defineAgentProfile, defineGitHubResource, defineInlineResource, exportTraceBundle, fetchTangleRouterSearchConfig, generateAttestationNonce, generateDockerfile, getSandboxEventText, materializeProfileFileMounts, mergeAgentProfiles, normalizeCollaborationPath, normalizeRuntimeBackendConfig, otelTraceIdForTangleTrace, parseCollaborationDocumentId, parseSSEStream, resolveSandboxResources, runTangleRouterEvalMatrixInSandbox, sandboxResourcesForSize, serializeForSidecar, splitInlineProfileFileMounts, startTeeAttestationHeartbeat, toOtelJson };
|
|
1374
|
+
export { type AcceleratorKind, type AccessPolicyRule, type AddUserOptions, type AgentProfile, type AgentProfileCapabilities, type AgentProfileConnection, type AgentProfileFileMount, type AgentProfileMcpServer, type AgentProfileModelHints, type AgentProfilePermissionValue, type AgentProfilePrompt, type AgentProfileResourceRef, type AgentProfileResources, type AgentProfileValidationIssue, type AgentProfileValidationResult, type AgentSubagentProfile, type AnyTokenPayload, type AttachGpuLeaseOptions, type AttachSandboxFleetMachineOptions, AuthError, type BackendCapabilities, type BackendConfig, type BackendInfo, type BackendManager, type BackendStatus, type BackendType, type BatchBackend, type BatchBackendStats, type BatchEvent, type BatchEventDataMap, type BatchOptions, type BatchResult, type BatchRunOptions, type BatchRunRequest, type BatchSidecarGroup, type BatchTask, type BatchTaskResult, type BatchTaskUsage, type BranchOptions, type BuildControlPlaneMcpConfigOptions, type BuildProgressEvent, type BuildSandboxMcpConfigOptions, CONTROL_PLANE_MCP_SERVER_NAME, CapabilityError, type CodeResult, type CollaborationAccess, type CollaborationBootstrapRequest, type CollaborationBootstrapResponse, CollaborationClient, type CollaborationClientConfig, type CollaborationDocumentAdapter, type CollaborationDocumentChange, type CollaborationDocumentRef, CollaborationFileBridge, type CollaborationFileBridgeOptions, type CollaborationFileEvent, type CollaborationPermissions, type CollaborationTokenPayload, type CollaborationTokenRefreshRequest, type CollaborationTokenRefreshResponse, type CollaborationTransportConfig, type CommitTaskSessionOptions, type CompletedTurnResult, type ConfidentialSandboxResult, type ConfidentialTeeType, type CreateConfidentialSandboxOptions, type CreateGpuLeaseOptions, type CreateIntelligenceReportOptions, type CreateRequestOptions, type CreateSandboxFleetOptions, type CreateSandboxFleetWithCoordinatorOptions, type CreateSandboxOptions, type CreateSessionOptions, type CreateTaskSessionOptions, type CreateTeamOptions, DEFAULT_SANDBOX_SIZE, type DeleteOptions, type DirectoryPermission, type DispatchPromptOptions, type DispatchedSession, type DownloadOptions, type DownloadProgress, type DriveTurnOptions, type DriverConfig, type DriverInfo, type DriverType, type EgressManager, type EgressPolicy, EgressProxyRecoveryError, type EventStreamOptions, type ExecOptions, type ExecResult, type FileInfo, type FileReadBatchOptions, type FileReadBatchResult, type FileReadError, type FileReadResult, type FileRenameResult, type FileSystem, type FileTreeFile, type FileTreeOptions, type FileTreeResult, type FileWriteResult, type FleetDispatchCancelResult, type FleetDispatchResultBuffer, type FleetDispatchResultBufferOptions, type FleetDispatchStreamOptions, type FleetExecDispatchOptions, type FleetMachineId, type FleetPromptDispatchOptions, GPU_LEASE_PROVIDER_NAMES, type GitAuth, type GitBranch, type GitCommit, type GitConfig, type GitDiff, type GitStatus, type GpuLease, type GpuLeaseBilling, type GpuLeaseCommandResult, type GpuLeaseExecOptions, type GpuLeaseExecResult, type GpuLeaseManager, type GpuLeaseProviderName, type GpuLeaseStatus, type GpuType, type HostAgentDriverConfig, type HostAgentRuntimeBackend, Image, type ImageBuildClient, type ImageBuildClientConfig, type ImageBuildFetchClient, type ImageBuildOptions, type ImageBuildResult, ImageBuilder, type ImageSpec, type InstalledTool, IntelligenceClient, type IntelligenceReport, type IntelligenceReportBudget, type IntelligenceReportCompareTo, type IntelligenceReportSubjectType, type IntelligenceReportWindow, type InteractiveAuthFile, InteractiveSessionHandle, type InteractiveSessionHost, type InteractiveSessionInfo, type InterruptResult, type InviteTeamMemberOptions, type IssueCollaborationTokenOptions, type ListMessagesOptions, type ListOptions, type ListSandboxFleetOptions, type ListSandboxOptions, MANAGE_SANDBOXES_PARAMETERS, MANAGE_SANDBOXES_TOOL_NAME, type ManageSandboxesInput, type ManageSandboxesTool, type ManageSandboxesToolOptions, type MaterializeProfileFileMountsOptions, type MaterializeProfileFileMountsResult, type McpServerConfig, type MintScopedTokenOptions, type MkdirOptions, type NetworkConfig, NetworkError, type NetworkManager, type NonHostAgentDriverConfig, NotFoundError, type ParseSSEStreamOptions, type ParsedSSEEvent, PartialFailureError, type PermissionLevel, type PermissionsManager, type PreviewLinkInfo, type PreviewLinkManager, type Process, type ProcessInfo, type ProcessLogEntry, type ProcessManager, type ProcessSignal, type ProcessSpawnOptions, type ProcessStatus, type PromptOptions, type PromptResult, type ProvisionEvent, type ProvisionResult, type ProvisionStatus, type ProvisionStep, type PublicTemplateInfo, type PublicTemplateVersionInfo, type PublishPublicTemplateOptions, type PublishPublicTemplateVersionOptions, QuotaError, type ReapExpiredSandboxFleetsOptions, type ReapExpiredSandboxFleetsResult, type ReconcileSandboxFleetsOptions, type ReconcileSandboxFleetsResult, type RenameOptions, type RespondToPermissionOptions, type Rollout, type RolloutChildResult, type RolloutOptions, type RolloutScorer, type RolloutStartResult, type RolloutStatus, type RolloutTurnPart, type RouterEvalMatrixAgentProfile, type RouterEvalMatrixCaseResult, type RouterEvalMatrixHarness, type RouterEvalMatrixPayload, type RouterEvalMatrixSandboxBox, type RouterEvalMatrixSandboxClient, type RouterEvalMatrixScenario, type RouterEvalMatrixSuiteResponse, type RouterImportedRunResponse, type RouterSearchConfig, type RouterSearchConfigOptions, type RunCodeOptions, type RunTangleRouterEvalMatrixInSandboxOptions, type RunTangleRouterEvalMatrixInSandboxResult, SANDBOX_MCP_SERVER_NAME, SANDBOX_SIZE_PRESETS, SANDBOX_SIZE_PRESET_NAMES, type SSHCommandDescriptor, type SSHCredentials, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, type SandboxConnection, type SandboxEnvironment, SandboxError, type SandboxErrorJson, type SandboxEvent, type SandboxFailureDetail, SandboxFleet, type SandboxFleetArtifact, type SandboxFleetArtifactSpec, SandboxFleetClient, type SandboxFleetCostEstimate, type SandboxFleetDispatchFailureClass, type SandboxFleetDispatchResponse, type SandboxFleetDriverCapability, type SandboxFleetDriverTimings, type SandboxFleetInfo, type SandboxFleetIntelligenceEnvelope, type SandboxFleetMachine, type SandboxFleetMachineMeteredUsage, type SandboxFleetMachineRecord, type SandboxFleetMachineSpec, type SandboxFleetManifest, type SandboxFleetManifestMachine, type SandboxFleetOperationsSummary, type SandboxFleetPolicy, type SandboxFleetToken, type SandboxFleetTraceBundle, type SandboxFleetTraceEvent, type SandboxFleetTraceExport, type SandboxFleetTraceOptions, type SandboxFleetUsage, type SandboxFleetWorkspace, type SandboxFleetWorkspaceReconcileResult, type SandboxFleetWorkspaceRestoreResult, type SandboxFleetWorkspaceSnapshotResult, type SandboxInfo, SandboxInstance, type SandboxIntelligenceEnvelope, type SandboxMcpConfig, type SandboxMcpEndpoint, type SandboxMcpServerEntry, type SandboxPermissionsConfig, type SandboxPortBinding, type SandboxPortPreviewLink, type SandboxProfileSummary, type SandboxResourceUsage, type SandboxResources, type SandboxRuntimeHealth, type SandboxRuntimeProfile, type SandboxRuntimeProfileList, SandboxSession, type SandboxSizePreset, type SandboxStatus, SandboxTaskSession, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, type SandboxTraceBundle, type SandboxTraceEvent, type SandboxTraceExport, type SandboxTraceOptions, type SandboxUser, type SaveCollaborationSnapshotRequest, type SaveCollaborationSnapshotResponse, type ScopedToken, type ScopedTokenScope, type SearchMatch, type SearchOptions, type SecretInfo, type SecretsManager, type SendSessionMessageOptions, type SendSessionMessageRequest, type SentSessionMessage, ServerError, type SessionBackendCredentials, type SessionBroadcastEvent, type SessionBroadcastResult, type SessionEventStreamOptions, type SessionForkOptions, type SessionInfo, type SessionListOptions, type SessionMessage, type SessionMessageInputPart, type SessionStatus, type SnapshotInfo, type SnapshotOptions, type SnapshotResult, type SplitInlineProfileFileMountsResult, type StartInteractiveOptions, type StartupDiagnostics, type StartupOperation, StateError, type StorageConfig, type SubscriptionInfo, TangleSandboxClient, type TangleSandboxClientConfig, type TangleSearchProvider, type TaskOptions, type TaskResult, type TaskSessionChanges, type TaskSessionCommitResult, type TaskSessionFileChange, type TaskSessionInfo, type TaskSessionProfile, type Team, type TeamInvitation, type TeamMember, type TeeAttestationHeartbeat, type TeeAttestationHeartbeatOptions, type TeeAttestationHeartbeatSample, type TeeAttestationOptions, type TeeAttestationReport, type TeeAttestationResponse, type TeePublicKey, type TeePublicKeyResponse, TimeoutError, type TokenRefreshHandler, type ToolsConfig, type TraceExportFormat, type TraceExportResult, type TraceExportSink, type TurnDriveResult, type UpdateUserOptions, type UploadOptions, type UploadProgress, type UsageInfo, ValidationError, type WaitForOptions, type WaitForRolloutOptions, type WriteFileOptions, type WriteManyFile, type WriteManyOptions, applySandboxEventText, buildCollaborationDocumentId, buildControlPlaneMcpConfig, buildSandboxMcpConfig, buildTangleRouterEvalMatrixRequest, buildTangleRouterResponsesWebSearchRequest, buildTangleRouterSearchBackend, buildTangleRouterSearchProfile, buildTraceExportPayload, collectAgentResponseText, createConfidentialSandbox, createManageSandboxesTool, defineAgentProfile, defineGitHubResource, defineInlineResource, exportTraceBundle, fetchTangleRouterSearchConfig, generateAttestationNonce, generateDockerfile, getSandboxEventText, materializeProfileFileMounts, mergeAgentProfiles, normalizeCollaborationPath, normalizeRuntimeBackendConfig, otelTraceIdForTangleTrace, parseCollaborationDocumentId, parseSSEStream, resolveSandboxResources, runTangleRouterEvalMatrixInSandbox, sandboxResourcesForSize, serializeForSidecar, splitInlineProfileFileMounts, startTeeAttestationHeartbeat, toOtelJson };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as serializeForSidecar, r as normalizeRuntimeBackendConfig } from "./runtime-api-
|
|
2
|
-
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as StateError } from "./errors-
|
|
3
|
-
import { a as InteractiveSessionHandle, c as getSandboxEventText, d as exportTraceBundle, f as otelTraceIdForTangleTrace, g as parseSSEStream, h as encodeTextForWire, i as SandboxSession, o as applySandboxEventText, p as toOtelJson, r as SandboxTaskSession, s as collectAgentResponseText, t as SandboxInstance, u as buildTraceExportPayload } from "./sandbox-
|
|
4
|
-
import { a as DEFAULT_SANDBOX_SIZE, c as resolveSandboxResources, i as SandboxFleetClient, l as sandboxResourcesForSize, n as SandboxClient, o as SANDBOX_SIZE_PRESETS, r as SandboxFleet, s as SANDBOX_SIZE_PRESET_NAMES, t as IntelligenceClient } from "./client-
|
|
5
|
-
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-
|
|
6
|
-
import { t as TangleSandboxClient } from "./tangle-
|
|
1
|
+
import { i as serializeForSidecar, r as normalizeRuntimeBackendConfig } from "./runtime-api-CaXI7Kl2.js";
|
|
2
|
+
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
|
|
3
|
+
import { a as InteractiveSessionHandle, c as getSandboxEventText, d as exportTraceBundle, f as otelTraceIdForTangleTrace, g as parseSSEStream, h as encodeTextForWire, i as SandboxSession, o as applySandboxEventText, p as toOtelJson, r as SandboxTaskSession, s as collectAgentResponseText, t as SandboxInstance, u as buildTraceExportPayload } from "./sandbox-CIHssZCH.js";
|
|
4
|
+
import { a as DEFAULT_SANDBOX_SIZE, c as resolveSandboxResources, i as SandboxFleetClient, l as sandboxResourcesForSize, n as SandboxClient, o as SANDBOX_SIZE_PRESETS, r as SandboxFleet, s as SANDBOX_SIZE_PRESET_NAMES, t as IntelligenceClient } from "./client-CL_cbjU4.js";
|
|
5
|
+
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-CcZE2xMl.js";
|
|
6
|
+
import { t as TangleSandboxClient } from "./tangle-C-5OvIj8.js";
|
|
7
7
|
import { defineAgentProfile, defineGitHubResource, defineInlineResource, mergeAgentProfiles } from "@tangle-network/agent-interface";
|
|
8
8
|
//#region src/confidential.ts
|
|
9
9
|
function generateAttestationNonce(bytes = 32) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as TimeoutError, i as NetworkError, p as parseErrorResponse } from "../errors-
|
|
1
|
+
import { d as TimeoutError, i as NetworkError, p as parseErrorResponse } from "../errors-wd266B9Q.js";
|
|
2
2
|
//#region src/intelligence/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* `@tangle-network/sandbox/intelligence` — browser-safe typed client for the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as ValidationError, l as ServerError, p as parseErrorResponse } from "./errors-
|
|
1
|
+
import { f as ValidationError, l as ServerError, p as parseErrorResponse } from "./errors-wd266B9Q.js";
|
|
2
2
|
//#region src/backend-config.ts
|
|
3
3
|
const LEGACY_QUESTION_ALIAS_KEY = ["question", "Channel"].join("");
|
|
4
4
|
function parseModelString(model) {
|
|
@@ -203,7 +203,7 @@ var SandboxRuntimeApi = class {
|
|
|
203
203
|
method: "POST",
|
|
204
204
|
body: JSON.stringify({
|
|
205
205
|
paths: chunk,
|
|
206
|
-
|
|
206
|
+
encoding: options.encoding ?? "utf8"
|
|
207
207
|
})
|
|
208
208
|
});
|
|
209
209
|
for (const [path, result] of Object.entries(payload.data.files)) if (result.success) files.push({
|
|
@@ -259,6 +259,19 @@ var SandboxRuntimeApi = class {
|
|
|
259
259
|
body: JSON.stringify({ path })
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
|
+
async renameFile(sourcePath, destinationPath, options = {}) {
|
|
263
|
+
await this.transport.ensureRunning();
|
|
264
|
+
const params = new URLSearchParams();
|
|
265
|
+
if (options.sessionId) params.set("sessionId", options.sessionId);
|
|
266
|
+
const query = params.toString();
|
|
267
|
+
return (await this.json(`/files/rename${query ? `?${query}` : ""}`, {
|
|
268
|
+
method: "POST",
|
|
269
|
+
body: JSON.stringify({
|
|
270
|
+
sourcePath,
|
|
271
|
+
destinationPath
|
|
272
|
+
})
|
|
273
|
+
})).data;
|
|
274
|
+
}
|
|
262
275
|
async fileTree(path, options = {}) {
|
|
263
276
|
if (options.maxDepth !== void 0 && (!Number.isInteger(options.maxDepth) || options.maxDepth < 1 || options.maxDepth > 20)) throw new ValidationError("maxDepth must be an integer between 1 and 20");
|
|
264
277
|
await this.transport.ensureRunning();
|
|
@@ -272,6 +285,7 @@ var SandboxRuntimeApi = class {
|
|
|
272
285
|
const info = normalizeSessionInfo(await this.json("/agents/sessions", {
|
|
273
286
|
method: "POST",
|
|
274
287
|
body: JSON.stringify({
|
|
288
|
+
...options.sessionId !== void 0 ? { sessionId: options.sessionId } : {},
|
|
275
289
|
...options.title !== void 0 ? { title: options.title } : {},
|
|
276
290
|
...options.parentId !== void 0 ? { parentID: options.parentId } : {},
|
|
277
291
|
backend: normalizeRuntimeBackendConfig(options.backend)
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as CommitTaskSessionOptions,
|
|
2
|
-
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors
|
|
1
|
+
import { A as CommitTaskSessionOptions, B as CreateTaskSessionOptions, Dr as SandboxRuntimeHealth, Jr as SentSessionMessage, Kr as SendSessionMessageOptions, Mi as WriteFileOptions, Mr as SandboxTerminalInfo, Nr as SandboxTerminalManager, Pr as SandboxTerminalRequestOptions, Qr as SessionInfo, Sr as SandboxPortBinding, dt as FileTreeResult, ei as SessionMessage, ft as FileWriteResult, gi as TaskSessionInfo, it as FileReadBatchResult, jr as SandboxTerminalCreateOptions, kn as RenameOptions, kr as SandboxRuntimeProfileList, mi as TaskSessionCommitResult, pi as TaskSessionChanges, qr as SendSessionMessageRequest, qt as ListMessagesOptions, rt as FileReadBatchOptions, st as FileRenameResult, ut as FileTreeOptions, z as CreateSessionOptions } from "./types-yNRVRww-.js";
|
|
2
|
+
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-CNCz3Ms9.js";
|
|
3
3
|
|
|
4
4
|
//#region src/runtime-api.d.ts
|
|
5
5
|
interface RuntimeTransport {
|
|
@@ -17,6 +17,7 @@ declare class SandboxRuntimeApi {
|
|
|
17
17
|
readFiles(paths: string[], options?: FileReadBatchOptions): Promise<FileReadBatchResult>;
|
|
18
18
|
writeFile(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
|
|
19
19
|
deleteFile(path: string, options?: Pick<WriteFileOptions, "sessionId">): Promise<void>;
|
|
20
|
+
renameFile(sourcePath: string, destinationPath: string, options?: RenameOptions): Promise<FileRenameResult>;
|
|
20
21
|
fileTree(path: string, options?: FileTreeOptions): Promise<FileTreeResult>;
|
|
21
22
|
createSession(options: CreateSessionOptions): Promise<SessionInfo>;
|
|
22
23
|
messages(id: string, options?: Omit<ListMessagesOptions, "sessionId">): Promise<SessionMessage[]>;
|
|
@@ -36,9 +37,9 @@ declare class SandboxRuntimeApi {
|
|
|
36
37
|
//#endregion
|
|
37
38
|
//#region src/runtime-client.d.ts
|
|
38
39
|
interface SandboxRuntimeClientConfig {
|
|
39
|
-
/** Browser-safe proxy base returned by
|
|
40
|
+
/** Browser-safe proxy base returned by a runtime-scoped token mint. */
|
|
40
41
|
baseUrl: string;
|
|
41
|
-
/** Short-lived
|
|
42
|
+
/** Short-lived `session-runtime` or `read-only` token. */
|
|
42
43
|
token: string;
|
|
43
44
|
/** Request timeout in milliseconds. Defaults to 30 seconds. */
|
|
44
45
|
timeoutMs?: number;
|
|
@@ -49,7 +50,9 @@ interface SandboxRuntimeClientConfig {
|
|
|
49
50
|
* Browser- and Worker-safe client for one sandbox runtime.
|
|
50
51
|
*
|
|
51
52
|
* Construct it from the scoped token response returned by
|
|
52
|
-
* `box.mintScopedToken(
|
|
53
|
+
* `box.mintScopedToken({ scope: "session-runtime", sessionId })` or
|
|
54
|
+
* `box.mintScopedToken({ scope: "read-only" })`. The full Sandbox API key
|
|
55
|
+
* remains server-side.
|
|
53
56
|
*/
|
|
54
57
|
declare class SandboxRuntimeClient extends SandboxRuntimeApi {
|
|
55
58
|
private readonly auth;
|
|
@@ -59,4 +62,4 @@ declare class SandboxRuntimeClient extends SandboxRuntimeApi {
|
|
|
59
62
|
}
|
|
60
63
|
declare function createSandboxRuntimeClient(config: SandboxRuntimeClientConfig): SandboxRuntimeClient;
|
|
61
64
|
//#endregion
|
|
62
|
-
export { AuthError, CapabilityError, type FileReadBatchOptions, type FileReadBatchResult, type FileTreeOptions, type FileTreeResult, type FileWriteResult, type ListMessagesOptions, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, SandboxRuntimeClient, type SandboxRuntimeClientConfig, type SandboxRuntimeHealth, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, ServerError, type SessionMessage, StateError, TimeoutError, ValidationError, type WriteFileOptions, createSandboxRuntimeClient };
|
|
65
|
+
export { AuthError, CapabilityError, type FileReadBatchOptions, type FileReadBatchResult, type FileRenameResult, type FileTreeOptions, type FileTreeResult, type FileWriteResult, type ListMessagesOptions, NetworkError, NotFoundError, PartialFailureError, QuotaError, type RenameOptions, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, SandboxRuntimeClient, type SandboxRuntimeClientConfig, type SandboxRuntimeHealth, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, ServerError, type SessionMessage, StateError, TimeoutError, ValidationError, type WriteFileOptions, createSandboxRuntimeClient };
|
package/dist/runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as SandboxRuntimeApi } from "./runtime-api-
|
|
2
|
-
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, s as QuotaError, t as AuthError, u as StateError } from "./errors-
|
|
1
|
+
import { t as SandboxRuntimeApi } from "./runtime-api-CaXI7Kl2.js";
|
|
2
|
+
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
|
|
3
3
|
//#region src/runtime-client.ts
|
|
4
4
|
const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
|
|
5
5
|
function requireToken(token) {
|
|
@@ -28,7 +28,9 @@ function requireTimeout(timeoutMs) {
|
|
|
28
28
|
* Browser- and Worker-safe client for one sandbox runtime.
|
|
29
29
|
*
|
|
30
30
|
* Construct it from the scoped token response returned by
|
|
31
|
-
* `box.mintScopedToken(
|
|
31
|
+
* `box.mintScopedToken({ scope: "session-runtime", sessionId })` or
|
|
32
|
+
* `box.mintScopedToken({ scope: "read-only" })`. The full Sandbox API key
|
|
33
|
+
* remains server-side.
|
|
32
34
|
*/
|
|
33
35
|
var SandboxRuntimeClient = class extends SandboxRuntimeApi {
|
|
34
36
|
auth;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as EventStreamOptions,
|
|
1
|
+
import { $ as EventStreamOptions, $r as SessionListOptions, A as CommitTaskSessionOptions, Ai as WaitForOptions, An as RestoreSnapshotOptions, Ar as SandboxStatus, B as CreateTaskSessionOptions, Bn as SSHCommandDescriptor, Br as ScopedToken, Bt as InstalledTool, D as CodeLanguage, Dr as SandboxRuntimeHealth, Dt as GitDiff, E as CodeExecutionResult, Fr as SandboxTraceBundle, Gn as SandboxEvent, Gt as IntelligenceReportWindow, Hr as SearchMatch, Ht as IntelligenceReportBudget, In as RolloutStartResult, Jr as SentSessionMessage, Kr as SendSessionMessageOptions, Kt as JsonValue, Mi as WriteFileOptions, Mn as Rollout, Ni as WriteManyFile, Nr as SandboxTerminalManager, Ot as GitStatus, Pi as WriteManyOptions, Pn as RolloutOptions, Pt as GpuLeaseManager, Qr as SessionInfo, Qt as MintScopedTokenOptions, Rr as SandboxTraceOptions, Si as TeePublicKeyResponse, Sr as SandboxPortBinding, T as CodeExecutionOptions, Ti as TurnDriveResult, Tr as SandboxResourceUsage, Tt as GitCommit, U as DispatchPromptOptions, Un as SandboxConnection, Ur as SearchOptions, Ut as IntelligenceReportCompareTo, Vn as SSHCredentials, Vt as IntelligenceReport, W as DispatchedSession, Xr as SessionEventStreamOptions, Y as DriverInfo, Z as EgressManager, Zr as SessionForkOptions, _n as ProvisionEvent, ai as SnapshotResult, bi as TeeAttestationResponse, ct as FileSystem, di as TaskOptions, ei as SessionMessage, et as ExecOptions, fi as TaskResult, ft as FileWriteResult, gi as TaskSessionInfo, gn as PromptResult, hn as PromptOptions, ii as SnapshotOptions, in as PermissionsManager, j as CompletedTurnResult, ji as WaitForRolloutOptions, jn as ResumeOptions, kr as SandboxRuntimeProfileList, kt as GpuLease, l as BackendManager, mi as TaskSessionCommitResult, mn as PromptInputPart, on as PreviewLinkManager, pi as TaskSessionChanges, q as DriveTurnOptions, qr as SendSessionMessageRequest, qt as ListMessagesOptions, ri as SnapshotInfo, s as BackendConfig, si as StartupDiagnostics, tn as NetworkManager, tt as ExecResult, un as ProcessManager, ur as SandboxFleetTraceBundle, vi as TeeAttestationOptions, vn as ProvisionResult, w as BranchOptions, wt as GitBranch, yr as SandboxInfo, z as CreateSessionOptions } from "./types-yNRVRww-.js";
|
|
2
2
|
|
|
3
3
|
//#region src/mcp.d.ts
|
|
4
4
|
/**
|
|
@@ -900,6 +900,7 @@ declare class SandboxInstance {
|
|
|
900
900
|
private fsList;
|
|
901
901
|
private fsStat;
|
|
902
902
|
private fsDelete;
|
|
903
|
+
private fsRename;
|
|
903
904
|
private fsMkdir;
|
|
904
905
|
private fsExists;
|
|
905
906
|
/**
|
|
@@ -1498,15 +1499,10 @@ declare class SandboxInstance {
|
|
|
1498
1499
|
*/
|
|
1499
1500
|
driveTurn(message: string | PromptInputPart[], opts: DriveTurnOptions): Promise<TurnDriveResult>;
|
|
1500
1501
|
/**
|
|
1501
|
-
* Mint a scoped, time-bounded JWT for
|
|
1502
|
-
*
|
|
1503
|
-
*
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1506
|
-
* Use this to give a browser direct read access to the sandbox without
|
|
1507
|
-
* leaking the full bearer (`box.connection.authToken`). The returned
|
|
1508
|
-
* token verifies against the same sidecar middleware that already
|
|
1509
|
-
* gates ProductTokenIssuer-issued JWTs — no new sidecar surface.
|
|
1502
|
+
* Mint a scoped, time-bounded JWT for browser access (Issue #913 Gap 1).
|
|
1503
|
+
* Authority is the caller's `TANGLE_API_KEY` (sk-tan-*); signing secrets
|
|
1504
|
+
* stay server-side. Session/project scopes work with SessionGatewayClient,
|
|
1505
|
+
* while session-runtime/read-only scopes work with SandboxRuntimeClient.
|
|
1510
1506
|
*/
|
|
1511
1507
|
mintScopedToken(opts: MintScopedTokenOptions): Promise<ScopedToken>;
|
|
1512
1508
|
/** @internal — invoked by SandboxSession.status(). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as normalizeSessionInfo, r as normalizeRuntimeBackendConfig, t as SandboxRuntimeApi } from "./runtime-api-
|
|
2
|
-
import { c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, p as parseErrorResponse, s as QuotaError, t as AuthError, u as StateError } from "./errors-
|
|
1
|
+
import { n as normalizeSessionInfo, r as normalizeRuntimeBackendConfig, t as SandboxRuntimeApi } from "./runtime-api-CaXI7Kl2.js";
|
|
2
|
+
import { c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, p as parseErrorResponse, s as QuotaError, t as AuthError, u as StateError } from "./errors-wd266B9Q.js";
|
|
3
3
|
import { addTokenUsage, readTokenCostUsd, readTokenUsage } from "@tangle-network/agent-core";
|
|
4
4
|
//#region src/lib/sse-parser.ts
|
|
5
5
|
/**
|
|
@@ -920,6 +920,22 @@ const WRITE_MANY_DEFAULT_PACE_MS = 150;
|
|
|
920
920
|
const WRITE_MANY_DEFAULT_MAX_RETRIES = 4;
|
|
921
921
|
const WRITE_MANY_RETRY_BASE_MS = 250;
|
|
922
922
|
const WRITE_MANY_RETRY_MAX_MS = 2e3;
|
|
923
|
+
function parseTextFileReadResponse(body) {
|
|
924
|
+
let payload;
|
|
925
|
+
try {
|
|
926
|
+
payload = JSON.parse(body);
|
|
927
|
+
} catch {
|
|
928
|
+
throw new ServerError("Runtime returned invalid JSON for file read", 502, {
|
|
929
|
+
origin: "runtime",
|
|
930
|
+
endpoint: "/files/read"
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
if (typeof payload !== "object" || payload === null || !("success" in payload) || payload.success !== true || !("data" in payload) || typeof payload.data !== "object" || payload.data === null || !("content" in payload.data) || typeof payload.data.content !== "string" || !("encoding" in payload.data) || payload.data.encoding !== "utf8") throw new ServerError("Runtime returned a malformed text file response", 502, {
|
|
934
|
+
origin: "runtime",
|
|
935
|
+
endpoint: "/files/read"
|
|
936
|
+
});
|
|
937
|
+
return payload.data.content;
|
|
938
|
+
}
|
|
923
939
|
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
924
940
|
/** Transient file-write failures worth retrying: rate-limit (quota), 5xx,
|
|
925
941
|
* transport (network), and request timeouts. A non-transient error (bad path,
|
|
@@ -1331,18 +1347,20 @@ var SandboxInstance = class SandboxInstance {
|
|
|
1331
1347
|
*/
|
|
1332
1348
|
async read(path, options) {
|
|
1333
1349
|
await this.ensureRunning();
|
|
1334
|
-
const headers = {};
|
|
1335
|
-
if (options?.sessionId) headers["X-Session-Id"] = options.sessionId;
|
|
1350
|
+
const headers = options?.sessionId ? { "X-Session-Id": options.sessionId } : void 0;
|
|
1336
1351
|
const response = await this.runtimeFetch("/files/read", {
|
|
1337
1352
|
method: "POST",
|
|
1338
1353
|
headers,
|
|
1339
|
-
body: JSON.stringify({
|
|
1354
|
+
body: JSON.stringify({
|
|
1355
|
+
path,
|
|
1356
|
+
encoding: "utf8"
|
|
1357
|
+
})
|
|
1340
1358
|
});
|
|
1341
1359
|
if (!response.ok) {
|
|
1342
1360
|
const body = await response.text();
|
|
1343
1361
|
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
1344
1362
|
}
|
|
1345
|
-
return (await response.
|
|
1363
|
+
return parseTextFileReadResponse(await response.text());
|
|
1346
1364
|
}
|
|
1347
1365
|
/**
|
|
1348
1366
|
* Write content to a file in the sandbox.
|
|
@@ -1544,8 +1562,8 @@ var SandboxInstance = class SandboxInstance {
|
|
|
1544
1562
|
* `error` + `done` so callers never see a thrown generator.
|
|
1545
1563
|
*/
|
|
1546
1564
|
async *streamPromptInner(message, options) {
|
|
1565
|
+
if (options?.lastEventId && !options.executionId) throw new ValidationError("lastEventId requires executionId so the SDK can replay the correct execution", { executionId: "Required when lastEventId is set" });
|
|
1547
1566
|
await this.ensureRunning();
|
|
1548
|
-
const parts = encodePromptForWire(message);
|
|
1549
1567
|
const timeoutMs = typeof options?.timeoutMs === "number" && options.timeoutMs > 0 ? options.timeoutMs : void 0;
|
|
1550
1568
|
const timeoutSignal = timeoutMs ? AbortSignal.timeout(timeoutMs) : void 0;
|
|
1551
1569
|
const streamSignal = timeoutSignal ? options?.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal : options?.signal;
|
|
@@ -1563,26 +1581,47 @@ var SandboxInstance = class SandboxInstance {
|
|
|
1563
1581
|
...data
|
|
1564
1582
|
});
|
|
1565
1583
|
};
|
|
1584
|
+
const explicitReplay = Boolean(options?.executionId && options.lastEventId);
|
|
1585
|
+
const requestEndpoint = explicitReplay ? `/agents/run/${encodeURIComponent(options?.executionId ?? "")}/events?lastEventId=${encodeURIComponent(options?.lastEventId ?? "")}&format=sse` : "/agents/run/stream";
|
|
1586
|
+
let lastEventId = options?.lastEventId;
|
|
1587
|
+
let executionId = options?.executionId;
|
|
1588
|
+
let sessionId = options?.sessionId;
|
|
1589
|
+
let receivedTerminal = false;
|
|
1590
|
+
const RECONNECT_BACKOFF_MS = [
|
|
1591
|
+
2e3,
|
|
1592
|
+
4e3,
|
|
1593
|
+
8e3,
|
|
1594
|
+
16e3,
|
|
1595
|
+
3e4,
|
|
1596
|
+
3e4
|
|
1597
|
+
];
|
|
1598
|
+
const MAX_RECONNECT_ATTEMPTS = RECONNECT_BACKOFF_MS.length;
|
|
1599
|
+
let lastReplayStatus;
|
|
1600
|
+
let lastExecutionStatus;
|
|
1601
|
+
let firstSseEventSeen = false;
|
|
1566
1602
|
let response;
|
|
1567
1603
|
try {
|
|
1568
1604
|
logStreamCheckpoint("runtime_post_start", {
|
|
1569
|
-
endpoint:
|
|
1605
|
+
endpoint: requestEndpoint,
|
|
1570
1606
|
sessionId: options?.sessionId,
|
|
1571
1607
|
executionId: options?.executionId,
|
|
1572
1608
|
hasLastEventId: Boolean(options?.lastEventId),
|
|
1573
|
-
detach: options?.detach === true
|
|
1609
|
+
detach: options?.detach === true,
|
|
1610
|
+
replayOnly: explicitReplay
|
|
1574
1611
|
});
|
|
1575
|
-
|
|
1612
|
+
const request = explicitReplay ? {
|
|
1613
|
+
method: "GET",
|
|
1614
|
+
signal: streamSignal
|
|
1615
|
+
} : {
|
|
1576
1616
|
method: "POST",
|
|
1577
1617
|
signal: streamSignal,
|
|
1578
1618
|
headers: {
|
|
1579
1619
|
...options?.executionId ? { "X-Execution-ID": options.executionId } : {},
|
|
1580
|
-
...options?.lastEventId ? { "Last-Event-ID": options.lastEventId } : {},
|
|
1581
1620
|
...options?.detach ? { "x-agent-detach": "true" } : {}
|
|
1582
1621
|
},
|
|
1583
1622
|
body: JSON.stringify({
|
|
1584
1623
|
identifier: "default",
|
|
1585
|
-
parts,
|
|
1624
|
+
parts: encodePromptForWire(message),
|
|
1586
1625
|
sessionId: options?.sessionId,
|
|
1587
1626
|
turnId: options?.turnId,
|
|
1588
1627
|
metadata: options?.context,
|
|
@@ -1591,7 +1630,8 @@ var SandboxInstance = class SandboxInstance {
|
|
|
1591
1630
|
...options?.detach ? { detach: true } : {},
|
|
1592
1631
|
backend: normalizeRuntimeBackendConfig(options?.backend ?? this.defaultRuntimeBackend, { model: options?.model })
|
|
1593
1632
|
})
|
|
1594
|
-
}
|
|
1633
|
+
};
|
|
1634
|
+
response = await this.runtimeFetch(requestEndpoint, request);
|
|
1595
1635
|
logStreamCheckpoint("runtime_response_headers", {
|
|
1596
1636
|
status: response.status,
|
|
1597
1637
|
ok: response.ok
|
|
@@ -1601,27 +1641,20 @@ var SandboxInstance = class SandboxInstance {
|
|
|
1601
1641
|
throwIfTimedOut();
|
|
1602
1642
|
throw err;
|
|
1603
1643
|
}
|
|
1604
|
-
if (!response.ok) {
|
|
1644
|
+
if (!response.ok && !explicitReplay) {
|
|
1605
1645
|
const body = await response.text();
|
|
1606
1646
|
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
1607
1647
|
}
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
3e4
|
|
1619
|
-
];
|
|
1620
|
-
const MAX_RECONNECT_ATTEMPTS = RECONNECT_BACKOFF_MS.length;
|
|
1621
|
-
let lastReplayStatus;
|
|
1622
|
-
let lastExecutionStatus;
|
|
1623
|
-
let firstSseEventSeen = false;
|
|
1624
|
-
for await (const event of this.parseSSEStream(response, streamSignal)) {
|
|
1648
|
+
if (!response.ok) {
|
|
1649
|
+
lastReplayStatus = response.status;
|
|
1650
|
+
await response.text();
|
|
1651
|
+
logStreamCheckpoint("replay_response_status", {
|
|
1652
|
+
attempt: 0,
|
|
1653
|
+
status: response.status,
|
|
1654
|
+
ok: false
|
|
1655
|
+
});
|
|
1656
|
+
} else for await (const event of this.parseSSEStream(response, streamSignal)) {
|
|
1657
|
+
if (event.type === "history.replay.start" || event.type === "history.replay.end") continue;
|
|
1625
1658
|
if (!firstSseEventSeen) {
|
|
1626
1659
|
firstSseEventSeen = true;
|
|
1627
1660
|
logStreamCheckpoint("first_sse_event", {
|
|
@@ -2099,11 +2132,19 @@ var SandboxInstance = class SandboxInstance {
|
|
|
2099
2132
|
async resourceUsage() {
|
|
2100
2133
|
await this.ensureRunning();
|
|
2101
2134
|
const response = await this.runtimeFetch("/health/detailed", { method: "GET" });
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2135
|
+
const body = await response.text();
|
|
2136
|
+
let data;
|
|
2137
|
+
try {
|
|
2138
|
+
data = JSON.parse(body);
|
|
2139
|
+
} catch (error) {
|
|
2140
|
+
if (response.ok) throw new NetworkError("Detailed health returned a non-JSON response", error instanceof Error ? error : void 0, {
|
|
2141
|
+
endpoint: "/health/detailed",
|
|
2142
|
+
origin: "runtime"
|
|
2143
|
+
});
|
|
2105
2144
|
}
|
|
2106
|
-
|
|
2145
|
+
if (data?.resources) return data.resources;
|
|
2146
|
+
if (!response.ok) throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2147
|
+
return null;
|
|
2107
2148
|
}
|
|
2108
2149
|
/**
|
|
2109
2150
|
* Git capability object for repository operations.
|
|
@@ -2328,6 +2369,7 @@ var SandboxInstance = class SandboxInstance {
|
|
|
2328
2369
|
list: (path, options) => this.fsList(path, options),
|
|
2329
2370
|
stat: (path) => this.fsStat(path),
|
|
2330
2371
|
delete: (path, options) => this.fsDelete(path, options),
|
|
2372
|
+
rename: (sourcePath, destinationPath, options) => this.fsRename(sourcePath, destinationPath, options),
|
|
2331
2373
|
mkdir: (path, options) => this.fsMkdir(path, options),
|
|
2332
2374
|
exists: (path) => this.fsExists(path)
|
|
2333
2375
|
};
|
|
@@ -2515,6 +2557,9 @@ var SandboxInstance = class SandboxInstance {
|
|
|
2515
2557
|
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2516
2558
|
}
|
|
2517
2559
|
}
|
|
2560
|
+
async fsRename(sourcePath, destinationPath, options) {
|
|
2561
|
+
return this.runtime.renameFile(sourcePath, destinationPath, options);
|
|
2562
|
+
}
|
|
2518
2563
|
async fsMkdir(path, options) {
|
|
2519
2564
|
await this.ensureRunning();
|
|
2520
2565
|
const params = new URLSearchParams();
|
|
@@ -4443,15 +4488,10 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4443
4488
|
return { state: "running" };
|
|
4444
4489
|
}
|
|
4445
4490
|
/**
|
|
4446
|
-
* Mint a scoped, time-bounded JWT for
|
|
4447
|
-
*
|
|
4448
|
-
*
|
|
4449
|
-
*
|
|
4450
|
-
*
|
|
4451
|
-
* Use this to give a browser direct read access to the sandbox without
|
|
4452
|
-
* leaking the full bearer (`box.connection.authToken`). The returned
|
|
4453
|
-
* token verifies against the same sidecar middleware that already
|
|
4454
|
-
* gates ProductTokenIssuer-issued JWTs — no new sidecar surface.
|
|
4491
|
+
* Mint a scoped, time-bounded JWT for browser access (Issue #913 Gap 1).
|
|
4492
|
+
* Authority is the caller's `TANGLE_API_KEY` (sk-tan-*); signing secrets
|
|
4493
|
+
* stay server-side. Session/project scopes work with SessionGatewayClient,
|
|
4494
|
+
* while session-runtime/read-only scopes work with SandboxRuntimeClient.
|
|
4455
4495
|
*/
|
|
4456
4496
|
async mintScopedToken(opts) {
|
|
4457
4497
|
if ((opts.scope === "session" || opts.scope === "session-runtime") && !opts.sessionId) throw new ValidationError(`${opts.scope} scope requires a sessionId`);
|
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-DFJiN98I.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-C-5OvIj8.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
|
-
import { p as parseErrorResponse } from "./errors-
|
|
2
|
-
import { t as SandboxInstance } from "./sandbox-
|
|
1
|
+
import { p as parseErrorResponse } from "./errors-wd266B9Q.js";
|
|
2
|
+
import { t as SandboxInstance } from "./sandbox-CIHssZCH.js";
|
|
3
3
|
//#region src/tangle/abi.ts
|
|
4
4
|
/**
|
|
5
5
|
* Tangle Contract ABI Definitions
|
|
@@ -1254,18 +1254,19 @@ interface PromptOptions {
|
|
|
1254
1254
|
/** AbortSignal for cancellation */
|
|
1255
1255
|
signal?: AbortSignal;
|
|
1256
1256
|
/**
|
|
1257
|
-
* Stable execution id for
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1261
|
-
*
|
|
1262
|
-
*
|
|
1257
|
+
* Stable execution id for tracing a first dispatch or selecting an existing
|
|
1258
|
+
* execution for replay. Forwarded as `X-Execution-ID` on a first dispatch.
|
|
1259
|
+
* When combined with `lastEventId`, the SDK replays the existing execution
|
|
1260
|
+
* without sending the prompt again. An execution ID alone does not make a
|
|
1261
|
+
* repeated POST idempotent; use `turnId` for application-level retries.
|
|
1262
|
+
* Omit to let the SDK read the id from `execution.started` for in-call
|
|
1263
|
+
* reconnects.
|
|
1263
1264
|
*/
|
|
1264
1265
|
executionId?: string;
|
|
1265
1266
|
/**
|
|
1266
|
-
* Last event id the caller has already acknowledged.
|
|
1267
|
-
* replays strictly after this id
|
|
1268
|
-
*
|
|
1267
|
+
* Last event id the caller has already acknowledged. Requires `executionId`;
|
|
1268
|
+
* the SDK replays strictly after this id without dispatching a new prompt.
|
|
1269
|
+
* Omit on the first attempt.
|
|
1269
1270
|
*/
|
|
1270
1271
|
lastEventId?: string;
|
|
1271
1272
|
/**
|
|
@@ -1724,6 +1725,10 @@ interface SessionListOptions {
|
|
|
1724
1725
|
}
|
|
1725
1726
|
/** Options for creating a runtime agent session. */
|
|
1726
1727
|
interface CreateSessionOptions {
|
|
1728
|
+
/** Stable caller-supplied idempotency key. Repeating create with the same
|
|
1729
|
+
* id returns the existing session without creating another workspace or
|
|
1730
|
+
* backend session. Omit to let the runtime mint a random id. */
|
|
1731
|
+
sessionId?: string;
|
|
1727
1732
|
title?: string;
|
|
1728
1733
|
parentId?: string;
|
|
1729
1734
|
backend: BackendConfig;
|
|
@@ -2018,18 +2023,18 @@ type TurnDriveResult = {
|
|
|
2018
2023
|
error: string;
|
|
2019
2024
|
};
|
|
2020
2025
|
/**
|
|
2021
|
-
* Scope of a `box.mintScopedToken()` request.
|
|
2022
|
-
*
|
|
2023
|
-
*
|
|
2026
|
+
* Scope of a `box.mintScopedToken()` request. `session` and `project` mint
|
|
2027
|
+
* SessionGateway read tokens. `session-runtime` and `read-only` mint sidecar
|
|
2028
|
+
* capability tokens for browser-safe runtime access.
|
|
2024
2029
|
*/
|
|
2025
2030
|
type ScopedTokenScope = "session" | "session-runtime" | "project" | "read-only";
|
|
2026
2031
|
/**
|
|
2027
2032
|
* Options for `box.mintScopedToken()`.
|
|
2028
2033
|
*/
|
|
2029
2034
|
interface MintScopedTokenOptions {
|
|
2030
|
-
/** Scope to mint. `session`
|
|
2031
|
-
*
|
|
2032
|
-
*
|
|
2035
|
+
/** Scope to mint. `session` and `project` are for SessionGateway streams;
|
|
2036
|
+
* `session-runtime` permits typed files, messages, and terminals for one
|
|
2037
|
+
* session; `read-only` permits read-only runtime requests. */
|
|
2033
2038
|
scope: ScopedTokenScope;
|
|
2034
2039
|
/** Required when `scope` is `session` or `session-runtime`. */
|
|
2035
2040
|
sessionId?: string;
|
|
@@ -2039,18 +2044,17 @@ interface MintScopedTokenOptions {
|
|
|
2039
2044
|
ttlMinutes?: number;
|
|
2040
2045
|
}
|
|
2041
2046
|
/**
|
|
2042
|
-
* Returned by `box.mintScopedToken()`.
|
|
2043
|
-
*
|
|
2044
|
-
*
|
|
2047
|
+
* Returned by `box.mintScopedToken()`. Use session/project tokens with
|
|
2048
|
+
* `SessionGatewayClient`; use session-runtime/read-only tokens with
|
|
2049
|
+
* `SandboxRuntimeClient`.
|
|
2045
2050
|
*/
|
|
2046
2051
|
interface ScopedToken {
|
|
2047
|
-
/** Bearer token (JWT)
|
|
2048
|
-
* via the `EventSource` URL with token query param. */
|
|
2052
|
+
/** Bearer token (JWT) for the consumer selected by `scope`. */
|
|
2049
2053
|
token: string;
|
|
2050
2054
|
/** When the token expires. */
|
|
2051
2055
|
expiresAt: Date;
|
|
2052
|
-
/** The runtime's direct edge URL.
|
|
2053
|
-
*
|
|
2056
|
+
/** The runtime's direct edge URL. Use with runtime scopes; session/project
|
|
2057
|
+
* tokens instead connect to the Sandbox API's `/session` WebSocket. */
|
|
2054
2058
|
runtimeUrl: string;
|
|
2055
2059
|
/** Browser-safe Sandbox API proxy base for terminal and runtime requests. */
|
|
2056
2060
|
sidecarProxyUrl: string;
|
|
@@ -2582,7 +2586,7 @@ interface SandboxFleetArtifactSpec {
|
|
|
2582
2586
|
*/
|
|
2583
2587
|
path: string;
|
|
2584
2588
|
label?: string;
|
|
2585
|
-
/** Maximum allowed artifact content size in bytes. Defaults to
|
|
2589
|
+
/** Maximum allowed artifact content size in bytes. Defaults to 10 MiB. */
|
|
2586
2590
|
maxBytes?: number;
|
|
2587
2591
|
}
|
|
2588
2592
|
interface SandboxFleetArtifact extends SandboxFleetArtifactSpec {
|
|
@@ -4419,6 +4423,13 @@ interface FileWriteResult {
|
|
|
4419
4423
|
/** Encoding echoed by runtimes that include it in write responses. */
|
|
4420
4424
|
encoding?: "utf8" | "base64";
|
|
4421
4425
|
}
|
|
4426
|
+
/** Metadata returned after a successful file or directory rename. */
|
|
4427
|
+
interface FileRenameResult {
|
|
4428
|
+
/** Previous path, relative to the workspace when applicable. */
|
|
4429
|
+
sourcePath: string;
|
|
4430
|
+
/** New path, relative to the workspace when applicable. */
|
|
4431
|
+
destinationPath: string;
|
|
4432
|
+
}
|
|
4422
4433
|
/**
|
|
4423
4434
|
* Options for uploading files.
|
|
4424
4435
|
*/
|
|
@@ -4490,6 +4501,11 @@ interface DeleteOptions {
|
|
|
4490
4501
|
/** Agent session whose workspace and change history receive the deletion. */
|
|
4491
4502
|
sessionId?: string;
|
|
4492
4503
|
}
|
|
4504
|
+
/** Options for {@link FileSystem.rename}. */
|
|
4505
|
+
interface RenameOptions {
|
|
4506
|
+
/** Agent session whose workspace and change history receive the rename. */
|
|
4507
|
+
sessionId?: string;
|
|
4508
|
+
}
|
|
4493
4509
|
/**
|
|
4494
4510
|
* File system operations for sandboxes. Access via `sandbox.fs`.
|
|
4495
4511
|
*
|
|
@@ -4734,6 +4750,27 @@ interface FileSystem {
|
|
|
4734
4750
|
* ```
|
|
4735
4751
|
*/
|
|
4736
4752
|
delete(path: string, options?: DeleteOptions): Promise<void>;
|
|
4753
|
+
/**
|
|
4754
|
+
* Rename a file or directory inside the sandbox without transferring its contents.
|
|
4755
|
+
* An existing regular file or symbolic link at the destination is replaced atomically.
|
|
4756
|
+
* Replacing a non-empty directory fails, as does moving across filesystems.
|
|
4757
|
+
*
|
|
4758
|
+
* @param sourcePath - Current path
|
|
4759
|
+
* @param destinationPath - New path
|
|
4760
|
+
* @param options - Session workspace options
|
|
4761
|
+
* @returns The resolved source and destination paths
|
|
4762
|
+
* @throws NotFoundError if the source or destination parent does not exist
|
|
4763
|
+
* @throws Error if the destination is a non-empty directory or the paths span filesystems
|
|
4764
|
+
*
|
|
4765
|
+
* @example
|
|
4766
|
+
* ```typescript
|
|
4767
|
+
* await box.fs.rename(
|
|
4768
|
+
* "/workspace/assets/logo.tmp",
|
|
4769
|
+
* "/workspace/assets/logo.png",
|
|
4770
|
+
* );
|
|
4771
|
+
* ```
|
|
4772
|
+
*/
|
|
4773
|
+
rename(sourcePath: string, destinationPath: string, options?: RenameOptions): Promise<FileRenameResult>;
|
|
4737
4774
|
/**
|
|
4738
4775
|
* Create a directory.
|
|
4739
4776
|
*
|
|
@@ -4843,4 +4880,4 @@ interface CodeExecutionOptions {
|
|
|
4843
4880
|
idempotencyKey?: string;
|
|
4844
4881
|
}
|
|
4845
4882
|
//#endregion
|
|
4846
|
-
export { EventStreamOptions as $,
|
|
4883
|
+
export { EventStreamOptions as $, SandboxFleetInfo as $n, SessionListOptions as $r, MkdirOptions as $t, CommitTaskSessionOptions as A, WaitForOptions as Ai, RestoreSnapshotOptions as An, SandboxStatus as Ar, GpuLeaseBilling as At, CreateTaskSessionOptions as B, AgentProfileMcpServer as Bi, SSHCommandDescriptor as Bn, ScopedToken as Br, InstalledTool as Bt, BatchTaskUsage as C, TokenRefreshHandler as Ci, PublishPublicTemplateOptions as Cn, SandboxPortPreviewLink as Cr, GitAuth as Ct, CodeLanguage as D, UploadOptions as Di, ReconcileSandboxFleetsOptions as Dn, SandboxRuntimeHealth as Dr, GitDiff as Dt, CodeExecutionResult as E, UpdateUserOptions as Ei, ReapExpiredSandboxFleetsResult as En, SandboxResources as Er, GitConfig as Et, CreateSandboxFleetOptions as F, AgentProfile as Fi, RolloutScorer as Fn, SandboxTraceBundle as Fr, GpuLeaseProviderName as Ft, DownloadOptions as G, AgentProfileResources as Gi, SandboxEvent as Gn, SecretsManager as Gr, IntelligenceReportWindow as Gt, DirectoryPermission as H, AgentProfilePermissionValue as Hi, SandboxClientConfig as Hn, SearchMatch as Hr, IntelligenceReportBudget as Ht, CreateSandboxFleetTokenOptions as I, AgentProfileCapabilities as Ii, RolloutStartResult as In, SandboxTraceEvent as Ir, GpuLeaseStatus as It, DriverConfig as J, AgentSubagentProfile as Ji, SandboxFleetCostEstimate as Jn, SentSessionMessage as Jr, ListOptions as Jt, DownloadProgress as K, AgentProfileValidationIssue as Ki, SandboxFleetArtifact as Kn, SendSessionMessageOptions as Kr, JsonValue as Kt, CreateSandboxFleetWithCoordinatorOptions as L, AgentProfileConfidential as Li, RolloutStatus as Ln, SandboxTraceExport as Lr, GpuType as Lt, CreateGpuLeaseOptions as M, WriteFileOptions as Mi, Rollout as Mn, SandboxTerminalInfo as Mr, GpuLeaseExecOptions as Mt, CreateIntelligenceReportOptions as N, WriteManyFile as Ni, RolloutChildResult as Nn, SandboxTerminalManager as Nr, GpuLeaseExecResult as Nt, CodeResult as O, UploadProgress as Oi, ReconcileSandboxFleetsResult as On, SandboxRuntimeProfile as Or, GitStatus as Ot, CreateRequestOptions as P, WriteManyOptions as Pi, RolloutOptions as Pn, SandboxTerminalRequestOptions as Pr, GpuLeaseManager as Pt, EgressPolicy as Q, mergeAgentProfiles as Qi, SandboxFleetDriverTimings as Qn, SessionInfo as Qr, MintScopedTokenOptions as Qt, CreateSandboxOptions as R, AgentProfileConnection as Ri, RolloutTurnPart as Rn, SandboxTraceOptions as Rr, HostAgentDriverConfig as Rt, BatchTaskResult as S, TeePublicKeyResponse as Si, PublicTemplateVersionInfo as Sn, SandboxPortBinding as Sr, GPU_LEASE_PROVIDER_NAMES as St, CodeExecutionOptions as T, TurnDriveResult as Ti, ReapExpiredSandboxFleetsOptions as Tn, SandboxResourceUsage as Tr, GitCommit as Tt, DispatchPromptOptions as U, AgentProfilePrompt as Ui, SandboxConnection as Un, SearchOptions as Ur, IntelligenceReportCompareTo as Ut, DeleteOptions as V, AgentProfileModelHints as Vi, SSHCredentials as Vn, ScopedTokenScope as Vr, IntelligenceReport as Vt, DispatchedSession as W, AgentProfileResourceRef as Wi, SandboxEnvironment as Wn, SecretInfo as Wr, IntelligenceReportSubjectType as Wt, DriverType as X, defineGitHubResource as Xi, SandboxFleetDispatchResponse as Xn, SessionEventStreamOptions as Xr, ListSandboxOptions as Xt, DriverInfo as Y, defineAgentProfile as Yi, SandboxFleetDispatchFailureClass as Yn, SessionBackendCredentials as Yr, ListSandboxFleetOptions as Yt, EgressManager as Z, defineInlineResource as Zi, SandboxFleetDriverCapability as Zn, SessionForkOptions as Zr, McpServerConfig as Zt, BatchResult as _, TaskSessionProfile as _i, ProvisionEvent as _n, SandboxFleetWorkspaceRestoreResult as _r, FleetExecDispatchOptions as _t, AttachSandboxFleetMachineOptions as a, SnapshotResult as ai, PreviewLinkInfo as an, SandboxFleetManifest as ar, FileReadError as at, BatchSidecarGroup as b, TeeAttestationResponse as bi, ProvisionStep as bn, SandboxIntelligenceEnvelope as br, FleetPromptDispatchOptions as bt, BackendInfo as c, StartupOperation as ci, ProcessInfo as cn, SandboxFleetPolicy as cr, FileSystem as ct, BackendType as d, TaskOptions as di, ProcessSignal as dn, SandboxFleetTraceEvent as dr, FileTreeResult as dt, SessionMessage as ei, NetworkConfig as en, SandboxFleetIntelligenceEnvelope as er, ExecOptions as et, BatchBackend as f, TaskResult as fi, ProcessSpawnOptions as fn, SandboxFleetTraceExport as fr, FileWriteResult as ft, BatchOptions as g, TaskSessionInfo as gi, PromptResult as gn, SandboxFleetWorkspaceReconcileResult as gr, FleetDispatchStreamOptions as gt, BatchEventDataMap as h, TaskSessionFileChange as hi, PromptOptions as hn, SandboxFleetWorkspace as hr, FleetDispatchResultBufferOptions as ht, AttachGpuLeaseOptions as i, SnapshotOptions as ii, PermissionsManager as in, SandboxFleetMachineSpec as ir, FileReadBatchResult as it, CompletedTurnResult as j, WaitForRolloutOptions as ji, ResumeOptions as jn, SandboxTerminalCreateOptions as jr, GpuLeaseCommandResult as jt, CodeResultPart as k, UsageInfo as ki, RenameOptions as kn, SandboxRuntimeProfileList as kr, GpuLease as kt, BackendManager as l, StorageConfig as li, ProcessLogEntry as ln, SandboxFleetToken as lr, FileTreeFile as lt, BatchEvent as m, TaskSessionCommitResult as mi, PromptInputPart as mn, SandboxFleetUsage as mr, FleetDispatchResultBuffer as mt, AccessPolicyRule as n, SessionStatus as ni, NonHostAgentDriverConfig as nn, SandboxFleetMachineMeteredUsage as nr, FileInfo as nt, BackendCapabilities as o, SshKeysManager as oi, PreviewLinkManager as on, SandboxFleetManifestMachine as or, FileReadResult as ot, BatchBackendStats as p, TaskSessionChanges as pi, ProcessStatus as pn, SandboxFleetTraceOptions as pr, FleetDispatchCancelResult as pt, DriveTurnOptions as q, AgentProfileValidationResult as qi, SandboxFleetArtifactSpec as qn, SendSessionMessageRequest as qr, ListMessagesOptions as qt, AddUserOptions as r, SnapshotInfo as ri, PermissionLevel as rn, SandboxFleetMachineRecord as rr, FileReadBatchOptions as rt, BackendConfig as s, StartupDiagnostics as si, Process as sn, SandboxFleetOperationsSummary as sr, FileRenameResult as st, AcceleratorKind as t, SessionMessageInputPart as ti, NetworkManager as tn, SandboxFleetMachine as tr, ExecResult as tt, BackendStatus as u, SubscriptionInfo as ui, ProcessManager as un, SandboxFleetTraceBundle as ur, FileTreeOptions as ut, BatchRunOptions as v, TeeAttestationOptions as vi, ProvisionResult as vn, SandboxFleetWorkspaceSnapshotResult as vr, FleetExecDispatchResult as vt, BranchOptions as w, ToolsConfig as wi, PublishPublicTemplateVersionOptions as wn, SandboxProfileSummary as wr, GitBranch as wt, BatchTask as x, TeePublicKey as xi, PublicTemplateInfo as xn, SandboxPermissionsConfig as xr, FleetPromptDispatchResult as xt, BatchRunRequest as y, TeeAttestationReport as yi, ProvisionStatus as yn, SandboxInfo as yr, FleetMachineId as yt, CreateSessionOptions as z, AgentProfileFileMount as zi, RunCodeOptions as zn, SandboxUser as zr, HostAgentRuntimeBackend as zt };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sandbox",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5-develop.20260713235503.8f2cefc",
|
|
4
4
|
"description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|