@tangle-network/sandbox 1.0.231 → 1.0.232
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 +22 -1
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +5 -5
- package/dist/agent/preview.d.ts +1 -1
- package/dist/agent/preview.js +2 -2
- package/dist/{agent-run-outcome-DMaHbXAk.d.ts → agent-run-outcome-MsLkgPNu.d.ts} +2 -2
- package/dist/{api-request-_SFFNVqY.js → api-request-B0BPgzdp.js} +34 -9
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +2 -2
- package/dist/{browser-interactive-control-controller-BiP6TJFP.js → browser-interactive-control-controller-Bf-DbRCA.js} +14 -4
- package/dist/{browser-interactive-control-controller-qv26Bpfx.d.ts → browser-interactive-control-controller-D17JJ8B0.d.ts} +1 -1
- package/dist/{chunked-upload-BjkxykZD.js → chunked-upload-BGwaw5np.js} +4 -5
- package/dist/{chunked-upload-file-B2KFimpz.js → chunked-upload-file-BnV8qgwV.js} +2 -2
- package/dist/cli-auth-bundle-DvmJ71bO.js +2 -0
- package/dist/{client-DvvRMxKx.d.ts → client-BTpWpGs-.d.ts} +36 -30
- package/dist/{client-OlxlnLwV.js → client-CgZADtPk.js} +36 -46
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-DZ8ptALs.js → collaboration-DneF_7bo.js} +20 -27
- package/dist/{core-D7czAW25.js → core-Cxww35JL.js} +5 -5
- package/dist/core.d.ts +6 -6
- package/dist/core.js +5 -5
- package/dist/{direct-http2-DU2SK2Wo.js → direct-http2-B5bdFrtg.js} +1 -1
- package/dist/{errors-A-bhwwsE.js → error-catalog-CGhVLVNq.js} +1 -382
- package/dist/errors-dK3-2RCh.js +382 -0
- package/dist/{file-download-UhMKbMbD.js → file-download-CUNdbymj.js} +1 -1
- package/dist/{index-Cip3q_xe.d.ts → index-CHP8U613.d.ts} +13 -23
- package/dist/index.d.ts +12 -12
- package/dist/index.js +28 -25
- package/dist/intelligence/index.js +3 -3
- package/dist/interactive-control.d.ts +1 -1
- package/dist/interactive-control.js +1 -1
- package/dist/{interactive-controller-D4gZ4f2I.js → interactive-controller-Bs7VQ04W.js} +17 -54
- package/dist/{interactive-controller-P0yy6sGl.d.ts → interactive-controller-DbNjY09X.d.ts} +3 -3
- package/dist/lib/prepared-evidence.js +1 -1
- package/dist/lib/prepared-process.js +1 -1
- package/dist/{lines-7VecgiGd.js → lines-DtssoioA.js} +1 -1
- package/dist/{lines-DNXdVbGO.d.ts → lines-n-mBURry.d.ts} +1 -1
- package/dist/lines.d.ts +1 -1
- package/dist/lines.js +1 -1
- package/dist/{local-cli-auth-CPS9yuTc.js → local-cli-auth-8Ndf1jRw.js} +1 -1
- package/dist/{mcp-local-CIXZFqF4.js → mcp-local-tA5cB3zq.js} +4 -4
- package/dist/{prepared-evidence-Byty5p51.js → prepared-evidence-DBE_xYjq.js} +2 -2
- package/dist/{prepared-process-u1B0b94R.js → prepared-process-B1kSkhn-.js} +2 -2
- package/dist/{preview-CNfYklE6.d.ts → preview-BHee3FzP.d.ts} +3 -3
- package/dist/{public-templates-CPvDf8CH.d.ts → public-templates-ZrUJ507X.d.ts} +2 -2
- package/dist/public-templates.d.ts +1 -1
- package/dist/public-templates.js +1 -1
- package/dist/{raw-evidence-archive-BgWqaQcM.js → raw-evidence-archive-Cfy_3_3y.js} +2 -2
- package/dist/{retry-policy-Dh-VezcE.js → retry-policy-CI5tyUGr.js} +2 -24
- package/dist/runtime.d.ts +7 -7
- package/dist/runtime.js +9 -9
- package/dist/{sandbox-Dvk2PYnL.js → sandbox-DOvm9OvM.js} +59 -74
- package/dist/{secp256k1-Cbp9tbkX.js → secp256k1-DZM5U2gv.js} +1 -1
- package/dist/select-seat-command.d.ts +1 -1
- package/dist/select-seat-command.js +1 -1
- package/dist/session-gateway/index.js +11 -20
- package/dist/sidecar-proxy-error-CeNM5eJj.js +4 -0
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-DWzUnb1Y.js → tangle-DFmy_0hM.js} +22 -17
- package/dist/{terminal-stream-types-DB8V0hiG.d.ts → terminal-stream-types-NBdVKKFu.d.ts} +0 -1
- package/dist/{types-Cmv31xBh.d.ts → types-CuMa305b.d.ts} +13 -57
- package/package.json +5 -5
- package/dist/cli-auth-bundle-CMJWI99l.js +0 -2
- package/dist/sidecar-proxy-error-DpBLxIof.js +0 -24
- /package/dist/{abort-signal-BbJTt2QJ.js → abort-signal-C0_9B1Hm.js} +0 -0
- /package/dist/{cli-auth-bundle-Wg3x2hd2.d.ts → cli-auth-bundle-BE_EfLUx.d.ts} +0 -0
- /package/dist/{cli-auth-bundle-C6DtK7GX-BbbiAn-Z.js → cli-auth-bundle-C6DtK7GX-Cjs6D-9c.js} +0 -0
- /package/dist/{file-transfer-BSe4ayU9.js → file-transfer-CSL53pv9.js} +0 -0
- /package/dist/{index-YbAo-so_.d.ts → index-D0zHNMSe.d.ts} +0 -0
- /package/dist/{index-CDtEPygc.d.ts → index-DsX2pOIn.d.ts} +0 -0
- /package/dist/{keep-alive-fetch-BIaDMUtu.js → keep-alive-fetch-C2DX2_rG.js} +0 -0
- /package/dist/{preview-operations-B3TTvqlm.js → preview-operations-BBF0BNuZ.js} +0 -0
- /package/dist/{retry-after-header-DUdCC0KJ.js → retry-after-header-Bt-XvU-x.js} +0 -0
- /package/dist/{sse-parser-DOCszo1K.js → sse-parser-CBQzZvkZ.js} +0 -0
- /package/dist/{utils-CK-x8vXj.js → utils-DqiOGAK5.js} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { D as assertCurrentBackendType, E as applyRequestedModel, M as withProfileHarness, N as withoutCreateOnlyModelFields, T as isBrowserRuntime, V as backendTypeSchema, k as normalizeRuntimeBackendConfig, o as requestInteractiveSessionToken, x as encodePromptForWire } from "./interactive-controller-
|
|
1
|
+
import { D as assertCurrentBackendType, E as applyRequestedModel, M as withProfileHarness, N as withoutCreateOnlyModelFields, T as isBrowserRuntime, V as backendTypeSchema, k as normalizeRuntimeBackendConfig, o as requestInteractiveSessionToken, x as encodePromptForWire } from "./interactive-controller-Bs7VQ04W.js";
|
|
2
2
|
import { r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
|
|
3
|
-
import { $ as
|
|
4
|
-
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, _ as NotFoundError, a as readResponseJson, g as NetworkError, i as parseResponseError, r as parseErrorResponse, s as AuthError, v as PartialFailureError } from "./errors-
|
|
5
|
-
import { n as combineAbortSignals } from "./abort-signal-
|
|
6
|
-
import { r as abortableSleep, t as RETRY_POLICY } from "./retry-policy-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-
|
|
10
|
-
import { t as parseSSEStream } from "./sse-parser-
|
|
11
|
-
import { t as LinesClient } from "./lines-
|
|
3
|
+
import { $ as isRateLimitCreateError, B as normalizeConnection, D as validateDeferredProfileFileMounts, E as splitInlineProfileSkills, F as normalizeSandboxCreateReceipt, G as CAPACITY_ETA_WAIT_MAX_MS, H as normalizeProxySecretReceipt, I as normalizeStartupDiagnostics, J as createRetryDelayMs, K as DEPLOY_WINDOW_RETRY_MS, O as isRetryableProfileFileMaterializeFailure, P as normalizeCaptureProof, Q as isDeployWindowCreateError, R as dateOf, T as splitInlineProfileFileMounts, U as normalizeSandboxShape, V as normalizeEgressPolicyFields, W as CAPACITY_ETA_MARGIN_MS, X as generateIdempotencyKey, Y as extendableDeadline, Z as isCapacityShortageCreateError, d as sandboxLedgerUsd, et as isRetryableCreateError, n as createSandboxInstanceFromResponse, o as exportTraceBundle, q as awaitCreateResend, z as parseLifecycleTimes } from "./sandbox-DOvm9OvM.js";
|
|
4
|
+
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, _ as NotFoundError, a as readResponseJson, g as NetworkError, i as parseResponseError, r as parseErrorResponse, s as AuthError, v as PartialFailureError } from "./errors-dK3-2RCh.js";
|
|
5
|
+
import { n as combineAbortSignals } from "./abort-signal-C0_9B1Hm.js";
|
|
6
|
+
import { r as abortableSleep, t as RETRY_POLICY } from "./retry-policy-CI5tyUGr.js";
|
|
7
|
+
import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-B0BPgzdp.js";
|
|
8
|
+
import { l as SANDBOX_AGENT_HOME, t as isInsideReservedDir } from "./file-transfer-CSL53pv9.js";
|
|
9
|
+
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-C2DX2_rG.js";
|
|
10
|
+
import { t as parseSSEStream } from "./sse-parser-CBQzZvkZ.js";
|
|
11
|
+
import { t as LinesClient } from "./lines-DtssoioA.js";
|
|
12
12
|
import { PublicTemplatesClient } from "./public-templates.js";
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
//#region ../../../packages/runtime-contracts/dist/git-policy.js
|
|
@@ -1236,11 +1236,11 @@ function isLocalSandboxEndpoint(baseUrl) {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
1238
|
async function resolveLocalCliAuthFiles(backendType) {
|
|
1239
|
-
const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-
|
|
1239
|
+
const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-8Ndf1jRw.js");
|
|
1240
1240
|
return discoverLocalCliAuthFiles(backendType);
|
|
1241
1241
|
}
|
|
1242
1242
|
async function loadLocalCliAuthExpectation(backendType) {
|
|
1243
|
-
const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-
|
|
1243
|
+
const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-8Ndf1jRw.js");
|
|
1244
1244
|
return describe(backendType);
|
|
1245
1245
|
}
|
|
1246
1246
|
/**
|
|
@@ -1277,17 +1277,13 @@ async function hydrateLocalCliBackendAuth(backend, baseUrl, trustLocalCliAuth) {
|
|
|
1277
1277
|
}
|
|
1278
1278
|
//#endregion
|
|
1279
1279
|
//#region src/client-transport.ts
|
|
1280
|
-
const DEFAULT_TIMEOUT_MS$1 = 3e4;
|
|
1281
1280
|
const DEFAULT_PLATFORM_URL = "https://id.tangle.tools";
|
|
1282
1281
|
const PRODUCTION_BASE_URL = "https://sandbox.tangle.tools";
|
|
1283
|
-
let sandboxTransportApiKey;
|
|
1284
1282
|
var SandboxTransport = class {
|
|
1285
|
-
static {
|
|
1286
|
-
sandboxTransportApiKey = (client) => client.#apiKey;
|
|
1287
|
-
}
|
|
1288
1283
|
baseUrl;
|
|
1289
1284
|
platformUrl;
|
|
1290
1285
|
#apiKey;
|
|
1286
|
+
/** This client's default deadline: `SandboxConfig.timeoutMs`, else `SDK_TIMEOUTS.default`. */
|
|
1291
1287
|
timeoutMs;
|
|
1292
1288
|
trustLocalCliAuth;
|
|
1293
1289
|
/** Receives the SDK's timing spans; see `SandboxConfig.onTiming`. */
|
|
@@ -1302,7 +1298,7 @@ var SandboxTransport = class {
|
|
|
1302
1298
|
const platformUrl = config.platformUrl ?? (this.baseUrl === PRODUCTION_BASE_URL ? DEFAULT_PLATFORM_URL : void 0);
|
|
1303
1299
|
this.platformUrl = platformUrl?.replace(/\/+$/, "");
|
|
1304
1300
|
this.#apiKey = config.apiKey;
|
|
1305
|
-
this.timeoutMs = config.timeoutMs ??
|
|
1301
|
+
this.timeoutMs = config.timeoutMs ?? SDK_TIMEOUTS.default;
|
|
1306
1302
|
this.trustLocalCliAuth = config.trustLocalCliAuth === true;
|
|
1307
1303
|
this.onTiming = config.onTiming;
|
|
1308
1304
|
this.directExec = config.directExec ?? !isBrowserRuntime();
|
|
@@ -1320,10 +1316,14 @@ var SandboxTransport = class {
|
|
|
1320
1316
|
if (!this.platformUrl) throw new ValidationError("platformUrl is required for Platform calls when baseUrl is not https://sandbox.tangle.tools", { fields: { platformUrl: "required" } });
|
|
1321
1317
|
const headers = new Headers(options?.headers);
|
|
1322
1318
|
if (!headers.has("Authorization")) headers.set("Authorization", `Bearer ${this.#apiKey}`);
|
|
1323
|
-
return
|
|
1319
|
+
return fetchSandboxApi({
|
|
1320
|
+
baseUrl: this.platformUrl,
|
|
1321
|
+
timeoutMs: this.timeoutMs,
|
|
1322
|
+
signal: this.signal,
|
|
1323
|
+
timeoutError: (ms) => new TimeoutError(`Request timed out after ${ms}ms`, { timeoutMs: ms })
|
|
1324
|
+
}, path, {
|
|
1324
1325
|
...options,
|
|
1325
|
-
headers
|
|
1326
|
-
signal: this.signal ? combineAbortSignals([options?.signal ?? AbortSignal.timeout(this.timeoutMs), this.signal]) : options?.signal ?? AbortSignal.timeout(this.timeoutMs)
|
|
1326
|
+
headers
|
|
1327
1327
|
});
|
|
1328
1328
|
}
|
|
1329
1329
|
/** Authenticated API fetch. Per-request timeout overrides the client ceiling for slow data-plane work. */
|
|
@@ -1404,8 +1404,6 @@ var SandboxTransport = class {
|
|
|
1404
1404
|
* matches whose deletes keep failing never hold back the ones after them.
|
|
1405
1405
|
*/
|
|
1406
1406
|
const DELETE_MATCHING_PATH = "/v1/sandboxes/delete-matching";
|
|
1407
|
-
const DEFAULT_TIMEOUT_MS = 12e4;
|
|
1408
|
-
const DEFAULT_UNTIL_REMOVED_TIMEOUT_MS = 3e5;
|
|
1409
1407
|
const OUTCOMES = new Set([
|
|
1410
1408
|
"destroyed",
|
|
1411
1409
|
"already_absent",
|
|
@@ -1450,7 +1448,7 @@ function readPage(raw) {
|
|
|
1450
1448
|
};
|
|
1451
1449
|
}
|
|
1452
1450
|
async function requestPage(client, body, options) {
|
|
1453
|
-
const timeoutMs = options?.timeoutMs ?? (options?.until === "removed" ?
|
|
1451
|
+
const timeoutMs = options?.timeoutMs ?? (options?.until === "removed" ? SDK_TIMEOUTS.deleteMatchingUntilRemoved : SDK_TIMEOUTS.deleteMatching);
|
|
1454
1452
|
const response = await client.fetch(DELETE_MATCHING_PATH, {
|
|
1455
1453
|
method: "POST",
|
|
1456
1454
|
body,
|
|
@@ -1513,7 +1511,7 @@ var SandboxManagement = class extends SandboxTransport {
|
|
|
1513
1511
|
origin: "sandbox-api"
|
|
1514
1512
|
});
|
|
1515
1513
|
await instance.waitFor("running", {
|
|
1516
|
-
timeoutMs: options?.timeoutMs ??
|
|
1514
|
+
timeoutMs: options?.timeoutMs ?? SDK_TIMEOUTS.create,
|
|
1517
1515
|
signal: options?.signal
|
|
1518
1516
|
});
|
|
1519
1517
|
return instance;
|
|
@@ -1833,7 +1831,7 @@ var SandboxCreation = class extends SandboxManagement {
|
|
|
1833
1831
|
}
|
|
1834
1832
|
};
|
|
1835
1833
|
if (options?.backend?.type !== void 0) assertCurrentBackendType(options.backend.type);
|
|
1836
|
-
const timeoutMs = requestOptions?.timeoutMs ?? (options?.gpuLease ?
|
|
1834
|
+
const timeoutMs = requestOptions?.timeoutMs ?? (options?.gpuLease ? SDK_TIMEOUTS.gpuCreate : SDK_TIMEOUTS.create);
|
|
1837
1835
|
const idempotencyKey = options?.idempotencyKey ?? generateIdempotencyKey();
|
|
1838
1836
|
const startedAt = Date.now();
|
|
1839
1837
|
let deadline = startedAt + timeoutMs;
|
|
@@ -2121,8 +2119,6 @@ var SandboxBatch = class extends SandboxCreation {
|
|
|
2121
2119
|
const normalizedRequest = validateBatchRunRequest(request);
|
|
2122
2120
|
const accumulator = createNormalizedBatchResultAccumulator(normalizedRequest);
|
|
2123
2121
|
const userSignal = options?.signal;
|
|
2124
|
-
const url = `${this.baseUrl}${BATCH_RUN_PATH}`;
|
|
2125
|
-
const requestBody = JSON.stringify(normalizedRequest);
|
|
2126
2122
|
const rawIdempotencyKey = options?.idempotencyKey;
|
|
2127
2123
|
const parsedIdempotencyKey = rawIdempotencyKey === void 0 ? void 0 : batchIdempotencyKeySchema.safeParse(rawIdempotencyKey);
|
|
2128
2124
|
if (parsedIdempotencyKey && !parsedIdempotencyKey.success) {
|
|
@@ -2142,25 +2138,19 @@ var SandboxBatch = class extends SandboxCreation {
|
|
|
2142
2138
|
};
|
|
2143
2139
|
let response;
|
|
2144
2140
|
try {
|
|
2145
|
-
response = await
|
|
2141
|
+
response = await this.fetch(BATCH_RUN_PATH, {
|
|
2146
2142
|
method: "POST",
|
|
2147
2143
|
headers: {
|
|
2148
|
-
Authorization: `Bearer ${sandboxTransportApiKey(this)}`,
|
|
2149
|
-
"Content-Type": "application/json",
|
|
2150
2144
|
Accept: BATCH_CUSTODY_ACCEPT,
|
|
2145
|
+
"x-no-retry": "1",
|
|
2151
2146
|
...options?.replayOnly ? { "If-Match": "*" } : {},
|
|
2152
2147
|
...parsedIdempotencyKey?.success ? { "Idempotency-Key": parsedIdempotencyKey.data } : {}
|
|
2153
2148
|
},
|
|
2154
|
-
body:
|
|
2149
|
+
body: JSON.stringify(normalizedRequest),
|
|
2155
2150
|
signal: userSignal
|
|
2156
2151
|
});
|
|
2157
2152
|
} catch (err) {
|
|
2158
|
-
|
|
2159
|
-
return preserveCustody(new NetworkError(`Failed to connect to Sandbox API: ${err instanceof Error ? err.message : String(err)}`, {
|
|
2160
|
-
cause: err instanceof Error ? err : void 0,
|
|
2161
|
-
endpoint: BATCH_RUN_PATH,
|
|
2162
|
-
origin: "sandbox-api"
|
|
2163
|
-
}));
|
|
2153
|
+
return preserveCustody(err);
|
|
2164
2154
|
}
|
|
2165
2155
|
if (!response.ok) {
|
|
2166
2156
|
const errBody = await response.text();
|
|
@@ -3380,13 +3370,9 @@ var SandboxFleet = class {
|
|
|
3380
3370
|
async dispatchExec(command, options) {
|
|
3381
3371
|
return (await this.dispatchExecDetailed(command, options)).results;
|
|
3382
3372
|
}
|
|
3373
|
+
/** Timeout: the larger of `timeoutMs` and `SDK_TIMEOUTS.fleetDispatch`, plus `SDK_TIMEOUTS.margin`. */
|
|
3383
3374
|
async dispatchExecDetailed(command, options) {
|
|
3384
|
-
|
|
3385
|
-
method: "POST",
|
|
3386
|
-
body: JSON.stringify(execDispatchBody(command, options))
|
|
3387
|
-
});
|
|
3388
|
-
if (!response.ok) throw await parseResponseError(response);
|
|
3389
|
-
return await response.json();
|
|
3375
|
+
return this.dispatch(execDispatchBody(command, options));
|
|
3390
3376
|
}
|
|
3391
3377
|
/**
|
|
3392
3378
|
* Run one prompt on one machine's default agent through the API's fleet
|
|
@@ -3408,10 +3394,14 @@ var SandboxFleet = class {
|
|
|
3408
3394
|
}
|
|
3409
3395
|
async dispatchPromptDetailed(message, options) {
|
|
3410
3396
|
this.assertUnbudgetedDispatch();
|
|
3397
|
+
return this.dispatch(promptDispatchBody(message, options));
|
|
3398
|
+
}
|
|
3399
|
+
/** The API runs a dispatch to its `timeoutMs` (10 min by default), and the request waits for it. */
|
|
3400
|
+
async dispatch(body) {
|
|
3411
3401
|
const response = await this.client.fetch(`/v1/fleets/${this.fleetId}/dispatch`, {
|
|
3412
3402
|
method: "POST",
|
|
3413
|
-
body: JSON.stringify(
|
|
3414
|
-
});
|
|
3403
|
+
body: JSON.stringify(body)
|
|
3404
|
+
}, { timeoutMs: Math.max(body.timeoutMs ?? 0, SDK_TIMEOUTS.fleetDispatch) + SDK_TIMEOUTS.margin });
|
|
3415
3405
|
if (!response.ok) throw await parseResponseError(response);
|
|
3416
3406
|
return await response.json();
|
|
3417
3407
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as CollaborationTransportConfig, a as CollaborationClient, c as CollaborationClientConfig, d as CollaborationDocumentRef, f as CollaborationFileBridgeOptions, g as CollaborationTokenRefreshResponse, h as CollaborationTokenRefreshRequest, i as parseCollaborationDocumentId, l as CollaborationDocumentAdapter, m as CollaborationPermissions, n as buildCollaborationDocumentId, o as CollaborationBootstrapRequest, p as CollaborationFileEvent, r as normalizeCollaborationPath, s as CollaborationBootstrapResponse, t as CollaborationFileBridge, u as CollaborationDocumentChange, v as SaveCollaborationSnapshotRequest, y as SaveCollaborationSnapshotResponse } from "../index-
|
|
1
|
+
import { _ as CollaborationTransportConfig, a as CollaborationClient, c as CollaborationClientConfig, d as CollaborationDocumentRef, f as CollaborationFileBridgeOptions, g as CollaborationTokenRefreshResponse, h as CollaborationTokenRefreshRequest, i as parseCollaborationDocumentId, l as CollaborationDocumentAdapter, m as CollaborationPermissions, n as buildCollaborationDocumentId, o as CollaborationBootstrapRequest, p as CollaborationFileEvent, r as normalizeCollaborationPath, s as CollaborationBootstrapResponse, t as CollaborationFileBridge, u as CollaborationDocumentChange, v as SaveCollaborationSnapshotRequest, y as SaveCollaborationSnapshotResponse } from "../index-D0zHNMSe.js";
|
|
2
2
|
export { CollaborationBootstrapRequest, CollaborationBootstrapResponse, CollaborationClient, CollaborationClientConfig, CollaborationDocumentAdapter, CollaborationDocumentChange, CollaborationDocumentRef, CollaborationFileBridge, CollaborationFileBridgeOptions, CollaborationFileEvent, CollaborationPermissions, CollaborationTokenRefreshRequest, CollaborationTokenRefreshResponse, CollaborationTransportConfig, SaveCollaborationSnapshotRequest, SaveCollaborationSnapshotResponse, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-
|
|
1
|
+
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-DneF_7bo.js";
|
|
2
2
|
export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as TimeoutError, g as NetworkError, r as parseErrorResponse } from "./errors-
|
|
1
|
+
import { E as TimeoutError, g as NetworkError, r as parseErrorResponse } from "./errors-dK3-2RCh.js";
|
|
2
|
+
import { i as fetchSandboxApi } from "./api-request-B0BPgzdp.js";
|
|
2
3
|
//#region src/collaboration/client.ts
|
|
3
|
-
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
4
4
|
function normalizeBaseUrl(url) {
|
|
5
5
|
return url.replace(/\/+$/, "");
|
|
6
6
|
}
|
|
@@ -11,7 +11,7 @@ var CollaborationClient = class {
|
|
|
11
11
|
#headers;
|
|
12
12
|
constructor(config) {
|
|
13
13
|
this.baseUrl = normalizeBaseUrl(config.baseUrl);
|
|
14
|
-
this.timeoutMs = config.timeoutMs
|
|
14
|
+
this.timeoutMs = config.timeoutMs;
|
|
15
15
|
this.fetchImpl = config.fetch ?? globalThis.fetch.bind(globalThis);
|
|
16
16
|
this.#headers = config.headers;
|
|
17
17
|
}
|
|
@@ -34,31 +34,24 @@ var CollaborationClient = class {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
async requestJson(path, init) {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return response.json();
|
|
55
|
-
} catch (error) {
|
|
56
|
-
if (error instanceof Error && error.name === "AbortError") throw new TimeoutError(`Request timed out after ${this.timeoutMs}ms`, { timeoutMs: this.timeoutMs });
|
|
57
|
-
if (error instanceof Error && "code" in error) throw error;
|
|
58
|
-
throw new NetworkError(`Failed to connect to collaboration API: ${error instanceof Error ? error.message : String(error)}`, { cause: error instanceof Error ? error : void 0 });
|
|
59
|
-
} finally {
|
|
60
|
-
clearTimeout(timeoutId);
|
|
37
|
+
const response = await fetchSandboxApi({
|
|
38
|
+
baseUrl: this.baseUrl,
|
|
39
|
+
timeoutMs: this.timeoutMs,
|
|
40
|
+
fetchImpl: this.fetchImpl,
|
|
41
|
+
timeoutError: (ms) => new TimeoutError(`Request timed out after ${ms}ms`, { timeoutMs: ms }),
|
|
42
|
+
networkError: (error) => new NetworkError(`Failed to connect to collaboration API: ${error instanceof Error ? error.message : String(error)}`, { cause: error instanceof Error ? error : void 0 })
|
|
43
|
+
}, path, {
|
|
44
|
+
...init,
|
|
45
|
+
headers: await this.resolveHeaders()
|
|
46
|
+
});
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
const body = await response.text();
|
|
49
|
+
throw parseErrorResponse(response.status, body, {
|
|
50
|
+
method: init.method,
|
|
51
|
+
path
|
|
52
|
+
}, response.headers);
|
|
61
53
|
}
|
|
54
|
+
return response.json();
|
|
62
55
|
}
|
|
63
56
|
async resolveHeaders() {
|
|
64
57
|
if (typeof this.#headers === "function") return this.#headers();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as agentProfileSchema } from "./profile-schema-C1KpT-wS.js";
|
|
2
|
-
import {
|
|
3
|
-
import { D as ValidationError, S as SandboxError, l as CapabilityError } from "./errors-
|
|
4
|
-
import { t as awaitWithAbort } from "./abort-signal-
|
|
5
|
-
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-C6DtK7GX-
|
|
6
|
-
import "./cli-auth-bundle-
|
|
2
|
+
import { tt as canonicalAgentProfileDigest } from "./sandbox-DOvm9OvM.js";
|
|
3
|
+
import { D as ValidationError, S as SandboxError, l as CapabilityError } from "./errors-dK3-2RCh.js";
|
|
4
|
+
import { t as awaitWithAbort } from "./abort-signal-C0_9B1Hm.js";
|
|
5
|
+
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-C6DtK7GX-Cjs6D-9c.js";
|
|
6
|
+
import "./cli-auth-bundle-DvmJ71bO.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
//#region src/failure-kind.ts
|
|
9
9
|
const LOST_CODES = new Set(["BACKING_CONTAINER_MISSING", "SANDBOX_NOT_FOUND"]);
|
package/dist/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as WorkspaceImages, O as SandboxInstance, V as ProfileFileDeliveryReport, z as WorkspaceImagePublishRequestOptions } from "./index-
|
|
2
|
-
import { B as ServerError, C as CapabilityError, D as FileWriteConflictError, F as QuotaError, G as ValidationError, L as SandboxError, M as NotFoundError, N as PartialFailureError, P as ProfileFileMountPathError, R as SandboxErrorJson, V as StateError, W as TimeoutError, b as parseErrorResponse, j as NetworkError, x as AuthError, z as SandboxFailureDetail } from "./terminal-stream-types-
|
|
3
|
-
import { En as SandboxConfig, Ga as ExecResult, Gr as ManagedProcessOptions, H as PreviewLinkInfo, Ia as WorkspaceImagePublishInput, In as NetworkConfig, Ja as SandboxEnvRecoveryView, Jr as ManagedProcessRecord, Kr as ManagedProcessResumeOptions, La as WorkspaceImagePublishResult, Ri as ConversationTurnOptions, Tn as CreateSandboxOptions, U as PreviewLinkManager, W as PreviewLinkWaitOptions, Wr as ManagedProcessJobs, Yr as ManagedProcessSpec, an as SandboxInfo, kn as SandboxStatus, oa as SessionMessageAdmission, qa as SandboxEnvRecovery, qr as ManagedProcessState, wi as PromptInputPart, yr as ExecOptions, zi as ConversationTurnResult } from "./types-
|
|
4
|
-
import { D as LineReplyCode, E as LineReminderPreferences, F as LineSenderVerification, G as LineApplicationRequest, H as LINE_APPLICATION_REPLY_MAX_CHARS, I as LineSenderVerificationStart, J as LineApplicationView, K as LineApplicationResult, N as LineSendInput, O as LineReplyCodeInput, P as LineSendReceipt, T as LineProvider, U as LINE_APPLICATION_REQUEST_MAX_BYTES, W as LineApplication, X as parseLineApplicationResult, Y as parseLineApplicationRequest, _ as LineInstanceCreate, a as Line, b as LineMemberInstance, d as LineAttachment, f as LineAttachmentReauthorization, g as LineInstanceAttachOptions, h as LineImage, i as profileChannelReference, l as LineApplicationAttachOptions, o as LineAgentRolePolicy, p as LineExecutionKey, q as LineApplicationState, r as lineInstanceKey, t as LinesClient, w as LineNumberInventory, y as LineMember } from "./lines-
|
|
5
|
-
import { Ct as
|
|
6
|
-
import { a as PublicTemplatesClient, i as PublicTemplatePublishRequestOptions, n as PublicTemplatePublishError, r as PublicTemplatePublishJob, t as PublicTemplatePublishArtifact } from "./public-templates-
|
|
1
|
+
import { B as WorkspaceImages, O as SandboxInstance, V as ProfileFileDeliveryReport, z as WorkspaceImagePublishRequestOptions } from "./index-CHP8U613.js";
|
|
2
|
+
import { B as ServerError, C as CapabilityError, D as FileWriteConflictError, F as QuotaError, G as ValidationError, L as SandboxError, M as NotFoundError, N as PartialFailureError, P as ProfileFileMountPathError, R as SandboxErrorJson, V as StateError, W as TimeoutError, b as parseErrorResponse, j as NetworkError, x as AuthError, z as SandboxFailureDetail } from "./terminal-stream-types-NBdVKKFu.js";
|
|
3
|
+
import { En as SandboxConfig, Ga as ExecResult, Gr as ManagedProcessOptions, H as PreviewLinkInfo, Ia as WorkspaceImagePublishInput, In as NetworkConfig, Ja as SandboxEnvRecoveryView, Jr as ManagedProcessRecord, Kr as ManagedProcessResumeOptions, La as WorkspaceImagePublishResult, Ri as ConversationTurnOptions, Tn as CreateSandboxOptions, U as PreviewLinkManager, W as PreviewLinkWaitOptions, Wr as ManagedProcessJobs, Yr as ManagedProcessSpec, an as SandboxInfo, kn as SandboxStatus, oa as SessionMessageAdmission, qa as SandboxEnvRecovery, qr as ManagedProcessState, wi as PromptInputPart, yr as ExecOptions, zi as ConversationTurnResult } from "./types-CuMa305b.js";
|
|
4
|
+
import { D as LineReplyCode, E as LineReminderPreferences, F as LineSenderVerification, G as LineApplicationRequest, H as LINE_APPLICATION_REPLY_MAX_CHARS, I as LineSenderVerificationStart, J as LineApplicationView, K as LineApplicationResult, N as LineSendInput, O as LineReplyCodeInput, P as LineSendReceipt, T as LineProvider, U as LINE_APPLICATION_REQUEST_MAX_BYTES, W as LineApplication, X as parseLineApplicationResult, Y as parseLineApplicationRequest, _ as LineInstanceCreate, a as Line, b as LineMemberInstance, d as LineAttachment, f as LineAttachmentReauthorization, g as LineInstanceAttachOptions, h as LineImage, i as profileChannelReference, l as LineApplicationAttachOptions, o as LineAgentRolePolicy, p as LineExecutionKey, q as LineApplicationState, r as lineInstanceKey, t as LinesClient, w as LineNumberInventory, y as LineMember } from "./lines-n-mBURry.js";
|
|
5
|
+
import { At as sandboxFailureKind, Ct as HostedInstance, Et as InstanceRestartingError, Ot as InstancesClient, St as EnsureInstanceOptions, Tt as InstanceRecord, _t as SeatSelectionError, an as BackendRegistryInteractionKind, bt as gatewaySeatTransport, cn as backendRegistryEntrySchema, dn as isBackendRegistryInteractionKind, dt as SandboxResolvedSeat, fn as parseBackendRegistryResponse, ft as SandboxSeatCredentials, gt as SeatResolutionObservation, ht as SeatOwnerTransport, in as BackendRegistryEntry, kt as SandboxFailureKind, ln as backendRegistryInteractionKindSchema, lt as ISOLATED_CREATION_ATTESTATION_VERSION, mt as SeatOwnerReply, on as BackendRegistryResponse, pn as parseBackendRegistryResponseBody, pt as SandboxSeatSelectionInput, rn as BackendRegistryCapabilities, sn as backendRegistryCapabilitiesSchema, t as Sandbox, un as backendRegistryResponseSchema, ut as CreateSelectSeatOptions, vt as SeatSelectionRequest, wt as InstanceProfile, xt as ManagedProcessClient, yt as createSelectSeat } from "./client-BTpWpGs-.js";
|
|
6
|
+
import { a as PublicTemplatesClient, i as PublicTemplatePublishRequestOptions, n as PublicTemplatePublishError, r as PublicTemplatePublishJob, t as PublicTemplatePublishArtifact } from "./public-templates-ZrUJ507X.js";
|
|
7
7
|
export { AuthError, BackendRegistryCapabilities, BackendRegistryEntry, BackendRegistryInteractionKind, BackendRegistryResponse, CapabilityError, ConversationTurnOptions, ConversationTurnResult, CreateSandboxOptions, CreateSelectSeatOptions, EnsureInstanceOptions, ExecOptions, ExecResult, FileWriteConflictError, HostedInstance, ISOLATED_CREATION_ATTESTATION_VERSION, InstanceProfile, InstanceRecord, InstanceRestartingError, InstancesClient, LINE_APPLICATION_REPLY_MAX_CHARS, LINE_APPLICATION_REQUEST_MAX_BYTES, Line, LineAgentRolePolicy, LineApplication, LineApplicationAttachOptions, LineApplicationRequest, LineApplicationResult, LineApplicationState, LineApplicationView, LineAttachment, LineAttachmentReauthorization, LineExecutionKey, LineImage, LineInstanceAttachOptions, LineInstanceCreate, LineMember, LineMemberInstance, LineNumberInventory, LineProvider, LineReminderPreferences, LineReplyCode, LineReplyCodeInput, LineSendInput, LineSendReceipt, LineSenderVerification, LineSenderVerificationStart, LinesClient, ManagedProcessClient, ManagedProcessJobs, ManagedProcessOptions, ManagedProcessRecord, ManagedProcessResumeOptions, ManagedProcessSpec, ManagedProcessState, NetworkConfig, NetworkError, NotFoundError, PartialFailureError, PreviewLinkInfo, PreviewLinkManager, PreviewLinkWaitOptions, ProfileFileDeliveryReport, ProfileFileMountPathError, PromptInputPart, PublicTemplatePublishArtifact, PublicTemplatePublishError, PublicTemplatePublishJob, PublicTemplatePublishRequestOptions, PublicTemplatesClient, QuotaError, Sandbox, SandboxConfig, SandboxEnvRecovery, SandboxEnvRecoveryView, SandboxError, SandboxErrorJson, SandboxFailureDetail, SandboxFailureKind, SandboxInfo, SandboxInstance, SandboxResolvedSeat, SandboxSeatCredentials, SandboxSeatSelectionInput, SandboxStatus, SeatOwnerReply, SeatOwnerTransport, SeatResolutionObservation, SeatSelectionError, SeatSelectionRequest, ServerError, SessionMessageAdmission, StateError, TimeoutError, ValidationError, WorkspaceImagePublishInput, WorkspaceImagePublishRequestOptions, WorkspaceImagePublishResult, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, createSelectSeat, gatewaySeatTransport, isBackendRegistryInteractionKind, lineInstanceKey, parseBackendRegistryResponse, parseBackendRegistryResponseBody, parseErrorResponse, parseLineApplicationRequest, parseLineApplicationResult, profileChannelReference, sandboxFailureKind };
|
package/dist/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as WorkspaceImages, t as SandboxInstance, x as ManagedProcessClient } from "./sandbox-
|
|
2
|
-
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, _ as NotFoundError, b as QuotaError, g as NetworkError, l as CapabilityError, p as FileWriteConflictError, r as parseErrorResponse, s as AuthError, v as PartialFailureError, w as StateError, y as ProfileFileMountPathError } from "./errors-
|
|
3
|
-
import { a as InstancesClient, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, p as isBackendRegistryInteractionKind, r as HostedInstance, t as Sandbox, u as backendRegistryEntrySchema } from "./client-
|
|
4
|
-
import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-
|
|
1
|
+
import { r as WorkspaceImages, t as SandboxInstance, x as ManagedProcessClient } from "./sandbox-DOvm9OvM.js";
|
|
2
|
+
import { C as ServerError, D as ValidationError, E as TimeoutError, S as SandboxError, _ as NotFoundError, b as QuotaError, g as NetworkError, l as CapabilityError, p as FileWriteConflictError, r as parseErrorResponse, s as AuthError, v as PartialFailureError, w as StateError, y as ProfileFileMountPathError } from "./errors-dK3-2RCh.js";
|
|
3
|
+
import { a as InstancesClient, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, p as isBackendRegistryInteractionKind, r as HostedInstance, t as Sandbox, u as backendRegistryEntrySchema } from "./client-CgZADtPk.js";
|
|
4
|
+
import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-DtssoioA.js";
|
|
5
5
|
import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
|
|
6
|
-
import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-
|
|
6
|
+
import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-Cxww35JL.js";
|
|
7
7
|
export { AuthError, CapabilityError, FileWriteConflictError, HostedInstance, ISOLATED_CREATION_ATTESTATION_VERSION, InstanceRestartingError, InstancesClient, LINE_APPLICATION_REPLY_MAX_CHARS, LINE_APPLICATION_REQUEST_MAX_BYTES, LinesClient, ManagedProcessClient, NetworkError, NotFoundError, PartialFailureError, ProfileFileMountPathError, PublicTemplatePublishError, PublicTemplatesClient, QuotaError, Sandbox, SandboxError, SandboxInstance, SeatSelectionError, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, createSelectSeat, gatewaySeatTransport, isBackendRegistryInteractionKind, lineInstanceKey, parseBackendRegistryResponse, parseBackendRegistryResponseBody, parseErrorResponse, parseLineApplicationRequest, parseLineApplicationResult, profileChannelReference, sandboxFailureKind };
|