@tangle-network/sandbox 1.0.231 → 1.0.233
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-execution-preparation-BJChICex.js +18 -0
- package/dist/agent-execution-preparation-receipt-BIFxqyr5.js +250 -0
- package/dist/{agent-run-outcome-DMaHbXAk.d.ts → agent-run-outcome-B0nURFpG.d.ts} +3 -2
- package/dist/{api-request-_SFFNVqY.js → api-request-dyabkosT.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-BM2p1dBp.js} +16 -252
- package/dist/{browser-interactive-control-controller-qv26Bpfx.d.ts → browser-interactive-control-controller-CcUjQEfa.d.ts} +1 -1
- package/dist/{chunked-upload-BjkxykZD.js → chunked-upload-BlvgxPWx.js} +4 -5
- package/dist/{chunked-upload-file-B2KFimpz.js → chunked-upload-file-DOeLpMO0.js} +2 -2
- package/dist/cli-auth-bundle-BLAtE6Dc.js +2 -0
- package/dist/{client-OlxlnLwV.js → client-BS-PR_-j.js} +38 -47
- package/dist/{client-DvvRMxKx.d.ts → client-DlTDphmI.d.ts} +38 -32
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-DZ8ptALs.js → collaboration-Dz20mN9a.js} +20 -27
- package/dist/core-CUZyz-U8.js +161 -0
- package/dist/core.d.ts +6 -6
- package/dist/core.js +6 -5
- package/dist/{direct-http2-DU2SK2Wo.js → direct-http2-Bgb2lHte.js} +1 -1
- package/dist/{errors-A-bhwwsE.js → error-catalog-CAbzw67O.js} +1 -382
- package/dist/errors-nXGKGVFe.js +382 -0
- package/dist/{file-download-UhMKbMbD.js → file-download-BjkrYzy_.js} +1 -1
- package/dist/{index-Cip3q_xe.d.ts → index-DE5n6mot.d.ts} +13 -23
- package/dist/index.d.ts +12 -12
- package/dist/index.js +29 -25
- package/dist/intelligence/index.d.ts +41 -109
- package/dist/intelligence/index.js +60 -73
- package/dist/interactive-control.d.ts +1 -1
- package/dist/interactive-control.js +1 -1
- package/dist/{interactive-controller-D4gZ4f2I.js → interactive-controller-DDPdZa2H.js} +20 -54
- package/dist/{interactive-controller-P0yy6sGl.d.ts → interactive-controller-sEU_J6Bc.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-CSGBHEjR.js} +1 -1
- package/dist/{lines-DNXdVbGO.d.ts → lines-qvpmwN_2.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-CO0byocv.js} +1 -1
- package/dist/{mcp-local-CIXZFqF4.js → mcp-local-Dz_Sehz0.js} +4 -4
- package/dist/{prepared-evidence-Byty5p51.js → prepared-evidence-ibAysmX8.js} +2 -2
- package/dist/{prepared-process-u1B0b94R.js → prepared-process-DQ_68Ofg.js} +2 -2
- package/dist/{preview-CNfYklE6.d.ts → preview-BC_wLaA2.d.ts} +3 -3
- package/dist/{public-templates-CPvDf8CH.d.ts → public-templates-WuvmbvzY.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-Cz4j8VMw.js} +2 -2
- package/dist/{retry-policy-Dh-VezcE.js → retry-policy-oW3_ljoc.js} +2 -24
- package/dist/runtime.d.ts +7 -7
- package/dist/runtime.js +9 -9
- package/dist/{sandbox-Dvk2PYnL.js → sandbox-OyCRplrI.js} +65 -91
- package/dist/{secp256k1-Cbp9tbkX.js → secp256k1-ZiYFbGjz.js} +1 -1
- package/dist/{core-D7czAW25.js → select-seat-B4Y-7vIq.js} +40 -171
- package/dist/select-seat-command.d.ts +9 -3
- package/dist/select-seat-command.js +69 -57
- package/dist/session-gateway/index.js +11 -20
- package/dist/sidecar-proxy-error-DTdbCbUM.js +4 -0
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-DWzUnb1Y.js → tangle-Crxw_6V-.js} +22 -17
- package/dist/{terminal-stream-types-DB8V0hiG.d.ts → terminal-stream-types-eE97lZ-5.d.ts} +0 -1
- package/dist/{types-Cmv31xBh.d.ts → types-Cs5eJzOK.d.ts} +17 -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-CRxC2dlT.js} +0 -0
- /package/dist/{cli-auth-bundle-C6DtK7GX-BbbiAn-Z.js → cli-auth-bundle-C6DtK7GX-mBUPER0R.js} +0 -0
- /package/dist/{cli-auth-bundle-Wg3x2hd2.d.ts → cli-auth-bundle-CjSu4D9W.d.ts} +0 -0
- /package/dist/{file-transfer-BSe4ayU9.js → file-transfer-DOSTbUSR.js} +0 -0
- /package/dist/{index-CDtEPygc.d.ts → index-C-_HY5NY.d.ts} +0 -0
- /package/dist/{index-YbAo-so_.d.ts → index-o31uwAkX.d.ts} +0 -0
- /package/dist/{keep-alive-fetch-BIaDMUtu.js → keep-alive-fetch-sGVP8skk.js} +0 -0
- /package/dist/{preview-operations-B3TTvqlm.js → preview-operations-DWL78boI.js} +0 -0
- /package/dist/{retry-after-header-DUdCC0KJ.js → retry-after-header-BZbs5rig.js} +0 -0
- /package/dist/{sse-parser-DOCszo1K.js → sse-parser-BCG3iL9j.js} +0 -0
- /package/dist/{utils-CK-x8vXj.js → utils-BT2q9nkO.js} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { C as boundedIdentifierSchema, D as isBoundedEventContentJson, E as boundedStringSchema, S as boundedEventContentStringSchema, T as boundedJsonSchema, _ as CONTRACT_MAX_ARRAY_LENGTH, b as boundedEventContentJsonSchema, g as sha256DigestSchema,
|
|
2
|
-
import { t as
|
|
1
|
+
import { C as boundedIdentifierSchema, D as isBoundedEventContentJson, E as boundedStringSchema, S as boundedEventContentStringSchema, T as boundedJsonSchema, _ as CONTRACT_MAX_ARRAY_LENGTH, b as boundedEventContentJsonSchema, g as sha256DigestSchema, o as canonicalCandidateDigest, w as boundedJsonRecordSchema, x as boundedEventContentRecordSchema, y as CONTRACT_MAX_STRING_LENGTH } from "./harness-DMaNgn0S.js";
|
|
2
|
+
import { t as agentExecutionPreparationReceiptSchema } from "./agent-execution-preparation-receipt-BIFxqyr5.js";
|
|
3
|
+
import { t as awaitWithAbort } from "./abort-signal-CRxC2dlT.js";
|
|
4
|
+
import { i as fetchSandboxApi } from "./api-request-dyabkosT.js";
|
|
3
5
|
import { z } from "zod";
|
|
4
6
|
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/native-session-event.js
|
|
5
7
|
/**
|
|
@@ -1203,253 +1205,6 @@ z.strictObject({
|
|
|
1203
1205
|
receivedAt: z.iso.datetime().max(64),
|
|
1204
1206
|
event: CanonicalStreamEventSchema
|
|
1205
1207
|
});
|
|
1206
|
-
//#endregion
|
|
1207
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-workspace-source-snapshot.js
|
|
1208
|
-
const controlCharacterPattern = /[\u0000-\u001f\u007f]/;
|
|
1209
|
-
/** Shared public identifier used by workspace lifecycle contracts. */
|
|
1210
|
-
const agentWorkspacePublicIdentifierSchema = z.string().min(1).max(500).refine((value) => value.trim().length > 0 && isWellFormedUnicode(value) && !controlCharacterPattern.test(value) && !looksLikeCredential(value), "public workspace identity cannot carry credential-like material");
|
|
1211
|
-
const agentWorkspaceSourceSnapshotPolicySchema = z.strictObject({
|
|
1212
|
-
kind: z.literal("provider-declared"),
|
|
1213
|
-
name: agentWorkspacePublicIdentifierSchema,
|
|
1214
|
-
version: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
1215
|
-
digest: sha256DigestSchema
|
|
1216
|
-
});
|
|
1217
|
-
//#endregion
|
|
1218
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-profile-materialization.js
|
|
1219
|
-
/**
|
|
1220
|
-
* The canonical AgentProfile leaves that can affect one execution.
|
|
1221
|
-
*
|
|
1222
|
-
* Compound parents such as `model`, `prompt`, and `resources` are deliberately
|
|
1223
|
-
* absent. A producer must report the exact requested leaf instead of claiming
|
|
1224
|
-
* a parent while silently dropping one of its children. `systemPrompt` and
|
|
1225
|
-
* `appendSystemPrompt` are separate leaves for the same reason: a backend that
|
|
1226
|
-
* can only add text must report the requested replacement as unsatisfied rather
|
|
1227
|
-
* than acknowledge it.
|
|
1228
|
-
*/
|
|
1229
|
-
const AGENT_PROFILE_MATERIALIZATION_AXES = [
|
|
1230
|
-
"name",
|
|
1231
|
-
"description",
|
|
1232
|
-
"version",
|
|
1233
|
-
"tags",
|
|
1234
|
-
"systemPrompt",
|
|
1235
|
-
"appendSystemPrompt",
|
|
1236
|
-
"instructions",
|
|
1237
|
-
"modelDefault",
|
|
1238
|
-
"modelSmall",
|
|
1239
|
-
"modelProvider",
|
|
1240
|
-
"modelReasoningEffort",
|
|
1241
|
-
"modelMaxVisibleOutputTokens",
|
|
1242
|
-
"modelMaxReasoningTokens",
|
|
1243
|
-
"modelMaxTotalOutputTokens",
|
|
1244
|
-
"modelMetadata",
|
|
1245
|
-
"harness",
|
|
1246
|
-
"seats",
|
|
1247
|
-
"proxySecrets",
|
|
1248
|
-
"permissions",
|
|
1249
|
-
"tools",
|
|
1250
|
-
"mcp",
|
|
1251
|
-
"connections",
|
|
1252
|
-
"subagents",
|
|
1253
|
-
"files",
|
|
1254
|
-
"resourceTools",
|
|
1255
|
-
"skills",
|
|
1256
|
-
"resourceAgents",
|
|
1257
|
-
"commands",
|
|
1258
|
-
"knowledge",
|
|
1259
|
-
"resourceInstructions",
|
|
1260
|
-
"resourceFailOnError",
|
|
1261
|
-
"hooks",
|
|
1262
|
-
"modes",
|
|
1263
|
-
"confidential",
|
|
1264
|
-
"metadata",
|
|
1265
|
-
"extensions"
|
|
1266
|
-
];
|
|
1267
|
-
[...Object.entries({
|
|
1268
|
-
default: "modelDefault",
|
|
1269
|
-
small: "modelSmall",
|
|
1270
|
-
provider: "modelProvider",
|
|
1271
|
-
reasoningEffort: "modelReasoningEffort",
|
|
1272
|
-
maxVisibleOutputTokens: "modelMaxVisibleOutputTokens",
|
|
1273
|
-
maxReasoningTokens: "modelMaxReasoningTokens",
|
|
1274
|
-
maxTotalOutputTokens: "modelMaxTotalOutputTokens",
|
|
1275
|
-
metadata: "modelMetadata"
|
|
1276
|
-
}).map(([property, axis]) => ({
|
|
1277
|
-
axis,
|
|
1278
|
-
rootPath: `/model/${property}`,
|
|
1279
|
-
value: (profile) => profile.model?.[property]
|
|
1280
|
-
}))];
|
|
1281
|
-
//#endregion
|
|
1282
|
-
//#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/agent-execution-preparation-receipt.js
|
|
1283
|
-
const nonBlankStringSchema = z.string().refine((value) => value.trim().length > 0, "value cannot be blank");
|
|
1284
|
-
const publicMechanismIdentifierSchema = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,199}$/, "mechanism must be a public identifier, not launch arguments").refine((value) => !looksLikeCredential(value), "mechanism cannot carry credential-like material");
|
|
1285
|
-
const publicLifecycleIdentifierSchema = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._~:/+-]{0,499}$/, "lifecycle identity must be a public identifier").refine((value) => !looksLikeCredential(value), "lifecycle identity cannot carry credential-like material");
|
|
1286
|
-
const publicReasonSchema = nonBlankStringSchema.max(4e3).refine((value) => !looksLikeCredential(value), "reason cannot carry credential-like material");
|
|
1287
|
-
const jsonPointerSchema = z.string().refine(isCanonicalJsonPointer, "path must be a canonical RFC 6901 JSON Pointer");
|
|
1288
|
-
const agentExecutionPreparationAxisResultSchema = z.strictObject({
|
|
1289
|
-
axis: z.enum(AGENT_PROFILE_MATERIALIZATION_AXES),
|
|
1290
|
-
disposition: z.enum([
|
|
1291
|
-
"behavior",
|
|
1292
|
-
"control",
|
|
1293
|
-
"overridden",
|
|
1294
|
-
"unsupported"
|
|
1295
|
-
]),
|
|
1296
|
-
owner: z.enum(["runtime", "executor"]),
|
|
1297
|
-
mechanism: publicMechanismIdentifierSchema,
|
|
1298
|
-
evidenceDigest: sha256DigestSchema.optional(),
|
|
1299
|
-
path: jsonPointerSchema.optional(),
|
|
1300
|
-
reason: publicReasonSchema.optional()
|
|
1301
|
-
}).superRefine((result, context) => {
|
|
1302
|
-
const requiresReason = result.disposition === "overridden" || result.disposition === "unsupported";
|
|
1303
|
-
if (requiresReason && result.reason === void 0) context.addIssue({
|
|
1304
|
-
code: "custom",
|
|
1305
|
-
path: ["reason"],
|
|
1306
|
-
message: `${result.disposition} profile coverage requires a reason`
|
|
1307
|
-
});
|
|
1308
|
-
if (!requiresReason && result.reason !== void 0) context.addIssue({
|
|
1309
|
-
code: "custom",
|
|
1310
|
-
path: ["reason"],
|
|
1311
|
-
message: `${result.disposition} profile coverage cannot carry an override reason`
|
|
1312
|
-
});
|
|
1313
|
-
});
|
|
1314
|
-
const reasoningEffortSchema = z.enum(REASONING_EFFORTS);
|
|
1315
|
-
const agentExecutionPreparationReasoningEffortSchema = z.strictObject({
|
|
1316
|
-
requested: reasoningEffortSchema,
|
|
1317
|
-
resolved: reasoningEffortSchema.optional(),
|
|
1318
|
-
fidelity: z.enum([
|
|
1319
|
-
"exact",
|
|
1320
|
-
"clamped",
|
|
1321
|
-
"unsupported"
|
|
1322
|
-
])
|
|
1323
|
-
}).superRefine((effort, context) => {
|
|
1324
|
-
if (effort.fidelity === "unsupported") {
|
|
1325
|
-
if (effort.resolved !== void 0) context.addIssue({
|
|
1326
|
-
code: "custom",
|
|
1327
|
-
path: ["resolved"],
|
|
1328
|
-
message: "unsupported reasoning effort cannot claim a resolved value"
|
|
1329
|
-
});
|
|
1330
|
-
return;
|
|
1331
|
-
}
|
|
1332
|
-
if (effort.resolved === void 0) {
|
|
1333
|
-
context.addIssue({
|
|
1334
|
-
code: "custom",
|
|
1335
|
-
path: ["resolved"],
|
|
1336
|
-
message: `${effort.fidelity} reasoning fidelity requires a resolved value`
|
|
1337
|
-
});
|
|
1338
|
-
return;
|
|
1339
|
-
}
|
|
1340
|
-
if (effort.fidelity === "exact" && effort.resolved !== effort.requested) context.addIssue({
|
|
1341
|
-
code: "custom",
|
|
1342
|
-
path: ["resolved"],
|
|
1343
|
-
message: "exact reasoning fidelity must preserve the requested effort"
|
|
1344
|
-
});
|
|
1345
|
-
if (effort.fidelity === "clamped") {
|
|
1346
|
-
if (effort.resolved === effort.requested) context.addIssue({
|
|
1347
|
-
code: "custom",
|
|
1348
|
-
path: ["resolved"],
|
|
1349
|
-
message: "clamped reasoning fidelity must change the requested effort"
|
|
1350
|
-
});
|
|
1351
|
-
else if (!isDownwardReasoningClamp(effort.requested, effort.resolved)) context.addIssue({
|
|
1352
|
-
code: "custom",
|
|
1353
|
-
path: ["resolved"],
|
|
1354
|
-
message: "reasoning effort may clamp down but must never increase"
|
|
1355
|
-
});
|
|
1356
|
-
}
|
|
1357
|
-
});
|
|
1358
|
-
const agentExecutionPreparationReceiptSchema = z.strictObject({
|
|
1359
|
-
kind: z.literal("agent-execution-preparation"),
|
|
1360
|
-
schemaVersion: z.literal(1),
|
|
1361
|
-
preparationId: nonBlankStringSchema.max(500),
|
|
1362
|
-
requestDigest: sha256DigestSchema,
|
|
1363
|
-
authoredProfileDigest: sha256DigestSchema,
|
|
1364
|
-
effectiveProfileDigest: sha256DigestSchema,
|
|
1365
|
-
backend: nonBlankStringSchema.max(200),
|
|
1366
|
-
harness: harnessTypeSchema,
|
|
1367
|
-
harnessVersion: nonBlankStringSchema.max(200),
|
|
1368
|
-
resolvedModel: z.strictObject({
|
|
1369
|
-
requested: z.string().max(500),
|
|
1370
|
-
resolved: nonBlankStringSchema.max(500),
|
|
1371
|
-
provider: z.string().max(200).optional(),
|
|
1372
|
-
reasoningEffort: agentExecutionPreparationReasoningEffortSchema.optional()
|
|
1373
|
-
}),
|
|
1374
|
-
workspace: z.strictObject({
|
|
1375
|
-
leaseId: publicLifecycleIdentifierSchema,
|
|
1376
|
-
provider: publicLifecycleIdentifierSchema,
|
|
1377
|
-
identityDigest: sha256DigestSchema,
|
|
1378
|
-
isolation: z.enum(["per-run", "shared"]),
|
|
1379
|
-
sourceSnapshotDigest: sha256DigestSchema,
|
|
1380
|
-
sourceSnapshotPolicy: agentWorkspaceSourceSnapshotPolicySchema,
|
|
1381
|
-
preparedWorkspaceDigest: sha256DigestSchema,
|
|
1382
|
-
profileActivationDigest: sha256DigestSchema
|
|
1383
|
-
}),
|
|
1384
|
-
axisResults: z.array(agentExecutionPreparationAxisResultSchema),
|
|
1385
|
-
executionPlanDigest: sha256DigestSchema,
|
|
1386
|
-
materializer: z.strictObject({
|
|
1387
|
-
name: nonBlankStringSchema.max(200),
|
|
1388
|
-
version: nonBlankStringSchema.max(200)
|
|
1389
|
-
}),
|
|
1390
|
-
expiresAtMs: z.number().int().positive().safe(),
|
|
1391
|
-
digest: sha256DigestSchema
|
|
1392
|
-
}).superRefine((receipt, context) => {
|
|
1393
|
-
const seen = /* @__PURE__ */ new Map();
|
|
1394
|
-
for (const [index, result] of receipt.axisResults.entries()) {
|
|
1395
|
-
const key = agentExecutionPreparationAxisResultKey(result.axis, result.path);
|
|
1396
|
-
const previous = seen.get(key);
|
|
1397
|
-
if (previous !== void 0) context.addIssue({
|
|
1398
|
-
code: "custom",
|
|
1399
|
-
path: ["axisResults", index],
|
|
1400
|
-
message: agentExecutionPreparationAxisResultsEqual(previous, result) ? "duplicate profile axis/path result" : "conflicting profile axis/path results"
|
|
1401
|
-
});
|
|
1402
|
-
else seen.set(key, result);
|
|
1403
|
-
if (index > 0 && compareAgentExecutionPreparationAxisResults(receipt.axisResults[index - 1], result) >= 0) context.addIssue({
|
|
1404
|
-
code: "custom",
|
|
1405
|
-
path: ["axisResults", index],
|
|
1406
|
-
message: "profile axis/path results must be canonically sorted"
|
|
1407
|
-
});
|
|
1408
|
-
}
|
|
1409
|
-
if (!isCanonicalJsonValue(receipt)) context.addIssue({
|
|
1410
|
-
code: "custom",
|
|
1411
|
-
message: "execution preparation receipt must contain only RFC 8785 JSON values"
|
|
1412
|
-
});
|
|
1413
|
-
else if (canonicalCandidateDigest(omitTopLevelDigest(receipt)) !== receipt.digest) context.addIssue({
|
|
1414
|
-
code: "custom",
|
|
1415
|
-
path: ["digest"],
|
|
1416
|
-
message: "execution preparation receipt digest is invalid"
|
|
1417
|
-
});
|
|
1418
|
-
});
|
|
1419
|
-
/** @internal Canonical identity for one preparation axis and path. */
|
|
1420
|
-
function agentExecutionPreparationAxisResultKey(axis, path) {
|
|
1421
|
-
return `${axis}\u0000${path ?? ""}`;
|
|
1422
|
-
}
|
|
1423
|
-
/** @internal Exact public equality for preparation axis rows. */
|
|
1424
|
-
function agentExecutionPreparationAxisResultsEqual(left, right) {
|
|
1425
|
-
try {
|
|
1426
|
-
return canonicalCandidateJson(left) === canonicalCandidateJson(right);
|
|
1427
|
-
} catch {
|
|
1428
|
-
return false;
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
const AXIS_ORDER = new Map(AGENT_PROFILE_MATERIALIZATION_AXES.map((axis, index) => [axis, index]));
|
|
1432
|
-
/** @internal Canonical order for preparation axis rows. */
|
|
1433
|
-
function compareAgentExecutionPreparationAxisResults(left, right) {
|
|
1434
|
-
const axisDifference = (AXIS_ORDER.get(left.axis) ?? Number.MAX_SAFE_INTEGER) - (AXIS_ORDER.get(right.axis) ?? Number.MAX_SAFE_INTEGER);
|
|
1435
|
-
if (axisDifference !== 0) return axisDifference;
|
|
1436
|
-
const leftPath = left.path ?? "";
|
|
1437
|
-
const rightPath = right.path ?? "";
|
|
1438
|
-
return leftPath < rightPath ? -1 : leftPath > rightPath ? 1 : 0;
|
|
1439
|
-
}
|
|
1440
|
-
function isCanonicalJsonPointer(value) {
|
|
1441
|
-
if (!value.startsWith("/") || !isWellFormedUnicode(value)) return false;
|
|
1442
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
1443
|
-
if (value[index] !== "~") continue;
|
|
1444
|
-
const escape = value[index + 1];
|
|
1445
|
-
if (escape !== "0" && escape !== "1") return false;
|
|
1446
|
-
index += 1;
|
|
1447
|
-
}
|
|
1448
|
-
return true;
|
|
1449
|
-
}
|
|
1450
|
-
function isDownwardReasoningClamp(requested, resolved) {
|
|
1451
|
-
return REASONING_EFFORTS.indexOf(resolved) < REASONING_EFFORTS.indexOf(requested);
|
|
1452
|
-
}
|
|
1453
1208
|
const agentInteractiveDimensionSchema = z.number().int().positive().max(1e4);
|
|
1454
1209
|
/** @internal Compare every coordinate of two exact run references. */
|
|
1455
1210
|
function sameAgentExactRun(left, right) {
|
|
@@ -2035,7 +1790,10 @@ function createBrowserInteractiveSessionControlTransport(options) {
|
|
|
2035
1790
|
if (typeof fetchImpl !== "function") throw new Error("Interactive browser controller requires fetch");
|
|
2036
1791
|
return {
|
|
2037
1792
|
async status(sessionId, incarnationId, requestOptions) {
|
|
2038
|
-
const response = await
|
|
1793
|
+
const response = await fetchSandboxApi({
|
|
1794
|
+
baseUrl: "",
|
|
1795
|
+
fetchImpl
|
|
1796
|
+
}, `${browserInteractiveSessionEndpoint(options.sessionApiUrl, sessionId)}?incarnationId=${encodeURIComponent(incarnationId)}`, {
|
|
2039
1797
|
headers: authHeaders(options.token),
|
|
2040
1798
|
...requestOptions?.signal === void 0 ? {} : { signal: requestOptions.signal }
|
|
2041
1799
|
});
|
|
@@ -2046,7 +1804,10 @@ function createBrowserInteractiveSessionControlTransport(options) {
|
|
|
2046
1804
|
return parsed.data.data.status;
|
|
2047
1805
|
},
|
|
2048
1806
|
async claimControl(sessionId, request, requestOptions) {
|
|
2049
|
-
const response = await
|
|
1807
|
+
const response = await fetchSandboxApi({
|
|
1808
|
+
baseUrl: "",
|
|
1809
|
+
fetchImpl
|
|
1810
|
+
}, browserInteractiveSessionEndpoint(options.sessionApiUrl, sessionId, "/control"), {
|
|
2050
1811
|
method: "POST",
|
|
2051
1812
|
headers: authHeaders(options.token, true),
|
|
2052
1813
|
body: JSON.stringify(request),
|
|
@@ -2062,7 +1823,10 @@ function createBrowserInteractiveSessionControlTransport(options) {
|
|
|
2062
1823
|
ref,
|
|
2063
1824
|
control
|
|
2064
1825
|
});
|
|
2065
|
-
const response = await
|
|
1826
|
+
const response = await fetchSandboxApi({
|
|
1827
|
+
baseUrl: "",
|
|
1828
|
+
fetchImpl
|
|
1829
|
+
}, browserInteractiveSessionEndpoint(options.sessionApiUrl, sessionId, "/control/release"), {
|
|
2066
1830
|
method: "POST",
|
|
2067
1831
|
headers: authHeaders(options.token, true),
|
|
2068
1832
|
body: JSON.stringify(body),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { at as AgentInteractiveSessionAttach, ct as AgentInteractiveSessionControlClaimRequest, dt as AgentInteractiveSessionRef, ft as AgentInteractiveSessionStatus, i as TerminalStreamHandlers, ot as AgentInteractiveSessionControlClaim, st as AgentInteractiveSessionControlClaimAcknowledgement } from "./terminal-stream-types-
|
|
1
|
+
import { at as AgentInteractiveSessionAttach, ct as AgentInteractiveSessionControlClaimRequest, dt as AgentInteractiveSessionRef, ft as AgentInteractiveSessionStatus, i as TerminalStreamHandlers, ot as AgentInteractiveSessionControlClaim, st as AgentInteractiveSessionControlClaimAcknowledgement } from "./terminal-stream-types-eE97lZ-5.js";
|
|
2
2
|
|
|
3
3
|
//#region src/interactive-types.d.ts
|
|
4
4
|
/** Cancellation for an interactive SDK request. */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { S as SandboxError, n as isTransientWrite, r as parseErrorResponse } from "./errors-
|
|
2
|
-
import { c as retryBudget, i as awaitResend, n as SANDBOX_API_RETRY_SCOPE, r as abortableSleep } from "./retry-policy-
|
|
3
|
-
import { i as FILE_UPLOAD_SESSION_MAX_BYTES, n as isFileTooLargeErrorBody, r as isPayloadTooLargeErrorBody } from "./file-transfer-
|
|
1
|
+
import { S as SandboxError, n as isTransientWrite, r as parseErrorResponse } from "./errors-nXGKGVFe.js";
|
|
2
|
+
import { c as retryBudget, i as awaitResend, n as SANDBOX_API_RETRY_SCOPE, r as abortableSleep } from "./retry-policy-oW3_ljoc.js";
|
|
3
|
+
import { i as FILE_UPLOAD_SESSION_MAX_BYTES, n as isFileTooLargeErrorBody, r as isPayloadTooLargeErrorBody } from "./file-transfer-DOSTbUSR.js";
|
|
4
4
|
//#region src/lib/sdk-retry.ts
|
|
5
|
-
const countSdkRequest = () => retryBudget(SANDBOX_API_RETRY_SCOPE).sent();
|
|
6
5
|
const takeSdkTurn = (maxWaitMs) => retryBudget(SANDBOX_API_RETRY_SCOPE).take(maxWaitMs);
|
|
7
6
|
const awaitSdkResend = (resend, o) => awaitResend(SANDBOX_API_RETRY_SCOPE, resend, o);
|
|
8
7
|
//#endregion
|
|
@@ -387,4 +386,4 @@ var ChunkedUploadInterruptedError = class extends Error {
|
|
|
387
386
|
}
|
|
388
387
|
};
|
|
389
388
|
//#endregion
|
|
390
|
-
export { planCompression as a, awaitSdkResend as c, partCount as i,
|
|
389
|
+
export { planCompression as a, awaitSdkResend as c, partCount as i, takeSdkTurn as l, commitSession as n, putPart as o, initUploadSession as r, uploadChunked as s, abortSession as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as FILE_UPLOAD_SESSION_MAX_BYTES } from "./file-transfer-
|
|
2
|
-
import { a as planCompression, i as partCount, n as commitSession, o as putPart, r as initUploadSession, t as abortSession } from "./chunked-upload-
|
|
1
|
+
import { i as FILE_UPLOAD_SESSION_MAX_BYTES } from "./file-transfer-DOSTbUSR.js";
|
|
2
|
+
import { a as planCompression, i as partCount, n as commitSession, o as putPart, r as initUploadSession, t as abortSession } from "./chunked-upload-BlvgxPWx.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { open } from "node:fs/promises";
|
|
5
5
|
//#region src/lib/chunked-upload-file.ts
|
|
@@ -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-DDPdZa2H.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-OyCRplrI.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-nXGKGVFe.js";
|
|
5
|
+
import { n as combineAbortSignals } from "./abort-signal-CRxC2dlT.js";
|
|
6
|
+
import { r as abortableSleep, t as RETRY_POLICY } from "./retry-policy-oW3_ljoc.js";
|
|
7
|
+
import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-dyabkosT.js";
|
|
8
|
+
import { l as SANDBOX_AGENT_HOME, t as isInsideReservedDir } from "./file-transfer-DOSTbUSR.js";
|
|
9
|
+
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-sGVP8skk.js";
|
|
10
|
+
import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
|
|
11
|
+
import { t as LinesClient } from "./lines-CSGBHEjR.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-CO0byocv.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-CO0byocv.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;
|
|
@@ -1782,6 +1780,8 @@ var SandboxManagement = class extends SandboxTransport {
|
|
|
1782
1780
|
/** Create options the API takes exactly as given, in wire order. */
|
|
1783
1781
|
function verbatimCreateFields(options) {
|
|
1784
1782
|
return {
|
|
1783
|
+
requireNativeSessionCapture: options?.requireNativeSessionCapture,
|
|
1784
|
+
sessionCapture: options?.sessionCapture,
|
|
1785
1785
|
gpuLease: options?.gpuLease,
|
|
1786
1786
|
sshEnabled: options?.sshEnabled,
|
|
1787
1787
|
sshPublicKeys: options?.sshPublicKeys,
|
|
@@ -1833,7 +1833,7 @@ var SandboxCreation = class extends SandboxManagement {
|
|
|
1833
1833
|
}
|
|
1834
1834
|
};
|
|
1835
1835
|
if (options?.backend?.type !== void 0) assertCurrentBackendType(options.backend.type);
|
|
1836
|
-
const timeoutMs = requestOptions?.timeoutMs ?? (options?.gpuLease ?
|
|
1836
|
+
const timeoutMs = requestOptions?.timeoutMs ?? (options?.gpuLease ? SDK_TIMEOUTS.gpuCreate : SDK_TIMEOUTS.create);
|
|
1837
1837
|
const idempotencyKey = options?.idempotencyKey ?? generateIdempotencyKey();
|
|
1838
1838
|
const startedAt = Date.now();
|
|
1839
1839
|
let deadline = startedAt + timeoutMs;
|
|
@@ -1898,7 +1898,6 @@ var SandboxCreation = class extends SandboxManagement {
|
|
|
1898
1898
|
cwd: workspaceCwd,
|
|
1899
1899
|
bare: options?.bare,
|
|
1900
1900
|
agent: options?.agent,
|
|
1901
|
-
requireNativeSessionCapture: options?.requireNativeSessionCapture,
|
|
1902
1901
|
driver: options?.driver,
|
|
1903
1902
|
backend: requestBackend,
|
|
1904
1903
|
env: options?.env,
|
|
@@ -2121,8 +2120,6 @@ var SandboxBatch = class extends SandboxCreation {
|
|
|
2121
2120
|
const normalizedRequest = validateBatchRunRequest(request);
|
|
2122
2121
|
const accumulator = createNormalizedBatchResultAccumulator(normalizedRequest);
|
|
2123
2122
|
const userSignal = options?.signal;
|
|
2124
|
-
const url = `${this.baseUrl}${BATCH_RUN_PATH}`;
|
|
2125
|
-
const requestBody = JSON.stringify(normalizedRequest);
|
|
2126
2123
|
const rawIdempotencyKey = options?.idempotencyKey;
|
|
2127
2124
|
const parsedIdempotencyKey = rawIdempotencyKey === void 0 ? void 0 : batchIdempotencyKeySchema.safeParse(rawIdempotencyKey);
|
|
2128
2125
|
if (parsedIdempotencyKey && !parsedIdempotencyKey.success) {
|
|
@@ -2142,25 +2139,19 @@ var SandboxBatch = class extends SandboxCreation {
|
|
|
2142
2139
|
};
|
|
2143
2140
|
let response;
|
|
2144
2141
|
try {
|
|
2145
|
-
response = await
|
|
2142
|
+
response = await this.fetch(BATCH_RUN_PATH, {
|
|
2146
2143
|
method: "POST",
|
|
2147
2144
|
headers: {
|
|
2148
|
-
Authorization: `Bearer ${sandboxTransportApiKey(this)}`,
|
|
2149
|
-
"Content-Type": "application/json",
|
|
2150
2145
|
Accept: BATCH_CUSTODY_ACCEPT,
|
|
2146
|
+
"x-no-retry": "1",
|
|
2151
2147
|
...options?.replayOnly ? { "If-Match": "*" } : {},
|
|
2152
2148
|
...parsedIdempotencyKey?.success ? { "Idempotency-Key": parsedIdempotencyKey.data } : {}
|
|
2153
2149
|
},
|
|
2154
|
-
body:
|
|
2150
|
+
body: JSON.stringify(normalizedRequest),
|
|
2155
2151
|
signal: userSignal
|
|
2156
2152
|
});
|
|
2157
2153
|
} 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
|
-
}));
|
|
2154
|
+
return preserveCustody(err);
|
|
2164
2155
|
}
|
|
2165
2156
|
if (!response.ok) {
|
|
2166
2157
|
const errBody = await response.text();
|
|
@@ -3380,13 +3371,9 @@ var SandboxFleet = class {
|
|
|
3380
3371
|
async dispatchExec(command, options) {
|
|
3381
3372
|
return (await this.dispatchExecDetailed(command, options)).results;
|
|
3382
3373
|
}
|
|
3374
|
+
/** Timeout: the larger of `timeoutMs` and `SDK_TIMEOUTS.fleetDispatch`, plus `SDK_TIMEOUTS.margin`. */
|
|
3383
3375
|
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();
|
|
3376
|
+
return this.dispatch(execDispatchBody(command, options));
|
|
3390
3377
|
}
|
|
3391
3378
|
/**
|
|
3392
3379
|
* Run one prompt on one machine's default agent through the API's fleet
|
|
@@ -3408,10 +3395,14 @@ var SandboxFleet = class {
|
|
|
3408
3395
|
}
|
|
3409
3396
|
async dispatchPromptDetailed(message, options) {
|
|
3410
3397
|
this.assertUnbudgetedDispatch();
|
|
3398
|
+
return this.dispatch(promptDispatchBody(message, options));
|
|
3399
|
+
}
|
|
3400
|
+
/** The API runs a dispatch to its `timeoutMs` (10 min by default), and the request waits for it. */
|
|
3401
|
+
async dispatch(body) {
|
|
3411
3402
|
const response = await this.client.fetch(`/v1/fleets/${this.fleetId}/dispatch`, {
|
|
3412
3403
|
method: "POST",
|
|
3413
|
-
body: JSON.stringify(
|
|
3414
|
-
});
|
|
3404
|
+
body: JSON.stringify(body)
|
|
3405
|
+
}, { timeoutMs: Math.max(body.timeoutMs ?? 0, SDK_TIMEOUTS.fleetDispatch) + SDK_TIMEOUTS.margin });
|
|
3415
3406
|
if (!response.ok) throw await parseResponseError(response);
|
|
3416
3407
|
return await response.json();
|
|
3417
3408
|
}
|