@tangle-network/sandbox 1.0.81 → 1.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +3 -3
- package/dist/agent/preview.d.ts +1 -1
- package/dist/{agent-run-outcome-Du2htAvV.d.ts → agent-run-outcome-CnHGo3Uz.d.ts} +2 -2
- package/dist/{browser-interactive-control-controller-GIsNMRwI.d.ts → browser-interactive-control-controller-BelQQ9nb.d.ts} +1 -1
- package/dist/{client-DG_vRbFq.d.ts → client-B-2_Po8s.d.ts} +5 -5
- package/dist/{client-tjnUrxqS.js → client-DJVMPIqA.js} +2 -2
- package/dist/{core-BcH02aoo.js → core-NptHnlS8.js} +1 -1
- package/dist/core.d.ts +6 -6
- package/dist/core.js +3 -3
- package/dist/{index-CgG1l9x0.d.ts → index-DVKTxbNc.d.ts} +12 -39
- package/dist/index.d.ts +9 -9
- package/dist/index.js +5 -5
- package/dist/interactive-control.d.ts +1 -1
- package/dist/{interactive-controller-BU07MKps.js → interactive-controller-BdGvy0jq.js} +14 -2
- package/dist/{interactive-controller-Ca0kMtZ3.d.ts → interactive-controller-h5lObChU.d.ts} +3 -3
- package/dist/{lines-rI7-oWVx.d.ts → lines-CgePkUiD.d.ts} +1 -1
- package/dist/lines.d.ts +1 -1
- package/dist/{preview-CFO-y0VK.d.ts → preview-CU6CWrEU.d.ts} +3 -3
- package/dist/{public-templates-BDOs6m9N.d.ts → public-templates-CMXx_e0h.d.ts} +2 -2
- package/dist/public-templates.d.ts +1 -1
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.js +1 -1
- package/dist/{sandbox-ww4MIs45.js → sandbox-DTuiPoNU.js} +214 -102
- package/dist/select-seat-command.d.ts +1 -1
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-CKK6uYNQ.js → tangle-h3zo20pc.js} +1 -1
- package/dist/{terminal-stream-types-eCul7SPm.d.ts → terminal-stream-types-MjiApwNS.d.ts} +1 -1
- package/dist/{types-DFbmqK0t.d.ts → types-DMGo9Vty.d.ts} +106 -86
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as requestedPublicProfileDigest, C as encodeTextForWire, D as assertCurrentBackendType, E as applyRequestedModel, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, O as mergeRuntimeBackendConfig, P as withoutRuntimeSecrets, S as encodePromptForWire, U as normalizeEffectiveBackend, _ as
|
|
1
|
+
import { A as requestedPublicProfileDigest, C as encodeTextForWire, D as assertCurrentBackendType, E as applyRequestedModel, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, O as mergeRuntimeBackendConfig, P as withoutRuntimeSecrets, S as encodePromptForWire, U as normalizeEffectiveBackend, _ as isTraceId, a as assertScopedTokenActive, b as resolveDispatchRunIdentity, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as TRACE_ID_HEADER, h as waitForRetryAfter, i as terminalUpgradeHeadersSupported, j as requestedSecretProfilePublicDigest, k as normalizeRuntimeBackendConfig, l as normalizeSessionInfo, m as isRetryableCredentialRefusal, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as mintTraceId, w as canUseNodeHttp2, x as validateAcceptedDispatchRunRef, y as resolveTraceId } from "./interactive-controller-BdGvy0jq.js";
|
|
2
2
|
import { D as boundedStringSchema, _ as sha256, g as sha256DigestSchema$1, o as canonicalCandidateDigest$1, s as canonicalCandidateJson$1, u as isCanonicalJsonValue$1, w as boundedIdentifierSchema } from "./harness-D2TXEUu-.js";
|
|
3
3
|
import { A as agentInteractiveSessionStatusMatchesRef, B as PlanContinuationSchema, C as AgentInteractiveSessionStopAcknowledgementSchema, D as agentInteractiveSessionControlClaimMatchesRef, E as agentInteractiveSessionControlClaimIsNewer, F as AgentRunCancellationAcknowledgementSchema, G as InteractionResponseSchema, H as InteractionBindingSchema, I as AgentRunCancellationRequestSchema, L as agentRunCancellationAcknowledgementMatchesRequest, M as agentInteractiveDimensionSchema, N as sameAgentExactRun, O as agentInteractiveSessionPromptAcknowledgementMatchesCommand, P as AgentExactRunControlRefSchema, S as AgentInteractiveSessionStatusSchema, T as agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, U as InteractionRequestSchema, V as InteractionAcknowledgementSchema, W as InteractionResponseCommandSchema, _ as AgentInteractiveSessionControlClaimRequestSchema, b as AgentInteractiveSessionPromptCommandSchema, d as interactiveSessionControlClaimResponseSchema, f as interactiveSessionControlReleaseResponseSchema, g as AgentInteractiveSessionControlClaimAcknowledgementSchema, h as AgentInteractiveSessionAttachSchema, j as agentInteractiveSessionStopAcknowledgementMatchesCommand, l as createInteractiveControlHolderId, m as interactiveSessionStatusResponseSchema, p as interactiveSessionControlValidationResponseSchema, v as AgentInteractiveSessionControlClaimSchema, w as AgentInteractiveSessionStopCommandSchema, x as AgentInteractiveSessionRefSchema, y as AgentInteractiveSessionPromptAcknowledgementSchema } from "./browser-interactive-control-controller-WLzM_Lyq.js";
|
|
4
4
|
import { a as canonicalAgentProfileValue, r as agentProfileSchema } from "./profile-schema-D-XJLM1E.js";
|
|
@@ -1397,6 +1397,175 @@ const REFRESH_REASON_HEADER = "x-tangle-refresh-reason";
|
|
|
1397
1397
|
function sendsRefreshReason() {
|
|
1398
1398
|
return !("document" in globalThis);
|
|
1399
1399
|
}
|
|
1400
|
+
const routes = Object.values({
|
|
1401
|
+
"codeExec": {
|
|
1402
|
+
"method": "POST",
|
|
1403
|
+
"path": "/code/exec",
|
|
1404
|
+
"auth": {
|
|
1405
|
+
"worker": "sandbox-owner-or-scoped-runtime-token",
|
|
1406
|
+
"orchestrator": "sandbox-owner-or-scoped-runtime-token",
|
|
1407
|
+
"hostAgent": "ingress-and-scoped-token",
|
|
1408
|
+
"sidecar": "control-or-scoped-session-token"
|
|
1409
|
+
},
|
|
1410
|
+
"layers": [
|
|
1411
|
+
"worker",
|
|
1412
|
+
"orchestrator",
|
|
1413
|
+
"hostAgent",
|
|
1414
|
+
"sidecar",
|
|
1415
|
+
"typescript",
|
|
1416
|
+
"python"
|
|
1417
|
+
],
|
|
1418
|
+
"auditAction": "sandbox.exec",
|
|
1419
|
+
"rateFamily": "process",
|
|
1420
|
+
"shortTokenRequired": true,
|
|
1421
|
+
"startsWork": true,
|
|
1422
|
+
"blocking": true
|
|
1423
|
+
},
|
|
1424
|
+
"processSpawn": {
|
|
1425
|
+
"method": "POST",
|
|
1426
|
+
"path": "/process/spawn",
|
|
1427
|
+
"auth": {
|
|
1428
|
+
"worker": "sandbox-owner-or-scoped-runtime-token",
|
|
1429
|
+
"orchestrator": "sandbox-owner-or-scoped-runtime-token",
|
|
1430
|
+
"hostAgent": "ingress-and-scoped-token",
|
|
1431
|
+
"sidecar": "control-or-scoped-session-token"
|
|
1432
|
+
},
|
|
1433
|
+
"layers": [
|
|
1434
|
+
"worker",
|
|
1435
|
+
"orchestrator",
|
|
1436
|
+
"hostAgent",
|
|
1437
|
+
"sidecar",
|
|
1438
|
+
"typescript",
|
|
1439
|
+
"python"
|
|
1440
|
+
],
|
|
1441
|
+
"auditAction": "sandbox.exec",
|
|
1442
|
+
"rateFamily": "process",
|
|
1443
|
+
"shortTokenRequired": true,
|
|
1444
|
+
"startsWork": true,
|
|
1445
|
+
"blocking": "blocking"
|
|
1446
|
+
},
|
|
1447
|
+
"ensureDevServer": {
|
|
1448
|
+
"method": "POST",
|
|
1449
|
+
"path": "/process/ensure-dev-server",
|
|
1450
|
+
"auth": {
|
|
1451
|
+
"worker": "sandbox-owner-or-scoped-runtime-token",
|
|
1452
|
+
"orchestrator": "sandbox-owner-or-scoped-runtime-token",
|
|
1453
|
+
"hostAgent": "ingress-and-scoped-token",
|
|
1454
|
+
"sidecar": "control-or-scoped-session-token"
|
|
1455
|
+
},
|
|
1456
|
+
"layers": [
|
|
1457
|
+
"worker",
|
|
1458
|
+
"orchestrator",
|
|
1459
|
+
"hostAgent",
|
|
1460
|
+
"sidecar",
|
|
1461
|
+
"typescript",
|
|
1462
|
+
"python"
|
|
1463
|
+
],
|
|
1464
|
+
"auditAction": "sandbox.exec",
|
|
1465
|
+
"rateFamily": "process",
|
|
1466
|
+
"shortTokenRequired": true,
|
|
1467
|
+
"startsWork": true,
|
|
1468
|
+
"blocking": true
|
|
1469
|
+
},
|
|
1470
|
+
"processList": {
|
|
1471
|
+
"method": "GET",
|
|
1472
|
+
"path": "/process",
|
|
1473
|
+
"auth": {
|
|
1474
|
+
"worker": "sandbox-owner-or-scoped-runtime-token",
|
|
1475
|
+
"orchestrator": "sandbox-owner-or-scoped-runtime-token",
|
|
1476
|
+
"hostAgent": "ingress-and-scoped-token",
|
|
1477
|
+
"sidecar": "control-or-scoped-session-token"
|
|
1478
|
+
},
|
|
1479
|
+
"layers": [
|
|
1480
|
+
"worker",
|
|
1481
|
+
"orchestrator",
|
|
1482
|
+
"hostAgent",
|
|
1483
|
+
"sidecar",
|
|
1484
|
+
"typescript",
|
|
1485
|
+
"python"
|
|
1486
|
+
],
|
|
1487
|
+
"auditAction": null,
|
|
1488
|
+
"rateFamily": null,
|
|
1489
|
+
"shortTokenRequired": false,
|
|
1490
|
+
"startsWork": false,
|
|
1491
|
+
"blocking": false
|
|
1492
|
+
},
|
|
1493
|
+
"processGet": {
|
|
1494
|
+
"method": "GET",
|
|
1495
|
+
"path": "/process/{pid}",
|
|
1496
|
+
"auth": {
|
|
1497
|
+
"worker": "sandbox-owner-or-scoped-runtime-token",
|
|
1498
|
+
"orchestrator": "sandbox-owner-or-scoped-runtime-token",
|
|
1499
|
+
"hostAgent": "ingress-and-scoped-token",
|
|
1500
|
+
"sidecar": "control-or-scoped-session-token"
|
|
1501
|
+
},
|
|
1502
|
+
"layers": [
|
|
1503
|
+
"worker",
|
|
1504
|
+
"orchestrator",
|
|
1505
|
+
"hostAgent",
|
|
1506
|
+
"sidecar",
|
|
1507
|
+
"typescript",
|
|
1508
|
+
"python"
|
|
1509
|
+
],
|
|
1510
|
+
"auditAction": null,
|
|
1511
|
+
"rateFamily": null,
|
|
1512
|
+
"shortTokenRequired": false,
|
|
1513
|
+
"startsWork": false,
|
|
1514
|
+
"blocking": false
|
|
1515
|
+
},
|
|
1516
|
+
"kill": {
|
|
1517
|
+
"method": "DELETE",
|
|
1518
|
+
"path": "/process/{pid}",
|
|
1519
|
+
"auth": {
|
|
1520
|
+
"worker": "sandbox-owner-or-scoped-runtime-token",
|
|
1521
|
+
"orchestrator": "sandbox-owner-or-scoped-runtime-token",
|
|
1522
|
+
"hostAgent": "ingress-and-scoped-token",
|
|
1523
|
+
"sidecar": "control-or-scoped-session-token"
|
|
1524
|
+
},
|
|
1525
|
+
"layers": [
|
|
1526
|
+
"worker",
|
|
1527
|
+
"orchestrator",
|
|
1528
|
+
"hostAgent",
|
|
1529
|
+
"sidecar",
|
|
1530
|
+
"typescript",
|
|
1531
|
+
"python"
|
|
1532
|
+
],
|
|
1533
|
+
"auditAction": null,
|
|
1534
|
+
"rateFamily": null,
|
|
1535
|
+
"shortTokenRequired": false,
|
|
1536
|
+
"startsWork": true,
|
|
1537
|
+
"blocking": false
|
|
1538
|
+
},
|
|
1539
|
+
"logs": {
|
|
1540
|
+
"method": "GET",
|
|
1541
|
+
"path": "/process/{pid}/logs",
|
|
1542
|
+
"auth": {
|
|
1543
|
+
"worker": "sandbox-owner-or-scoped-runtime-token",
|
|
1544
|
+
"orchestrator": "sandbox-owner-or-scoped-runtime-token",
|
|
1545
|
+
"hostAgent": "ingress-and-scoped-token",
|
|
1546
|
+
"sidecar": "control-or-scoped-session-token"
|
|
1547
|
+
},
|
|
1548
|
+
"layers": [
|
|
1549
|
+
"worker",
|
|
1550
|
+
"orchestrator",
|
|
1551
|
+
"hostAgent",
|
|
1552
|
+
"sidecar",
|
|
1553
|
+
"typescript",
|
|
1554
|
+
"python"
|
|
1555
|
+
],
|
|
1556
|
+
"auditAction": null,
|
|
1557
|
+
"rateFamily": null,
|
|
1558
|
+
"shortTokenRequired": false,
|
|
1559
|
+
"startsWork": false,
|
|
1560
|
+
"blocking": false
|
|
1561
|
+
}
|
|
1562
|
+
}).map((operation) => ({
|
|
1563
|
+
...operation,
|
|
1564
|
+
matcher: new RegExp("^" + operation.path.replace(/\{[^}]+\}/g, "[^/]+") + "$")
|
|
1565
|
+
}));
|
|
1566
|
+
function sandboxOperation(path, method, layer) {
|
|
1567
|
+
return routes.find((operation) => operation.method === method && operation.layers.includes(layer) && operation.matcher.test(path));
|
|
1568
|
+
}
|
|
1400
1569
|
//#endregion
|
|
1401
1570
|
//#region ../../../packages/runtime-contracts/dist/sidecar-request.js
|
|
1402
1571
|
/**
|
|
@@ -1415,7 +1584,7 @@ function normalizeSidecarPathname(input) {
|
|
|
1415
1584
|
}
|
|
1416
1585
|
let probe = decoded;
|
|
1417
1586
|
for (let layer = 0; layer <= 8; layer++) {
|
|
1418
|
-
if (
|
|
1587
|
+
if (/[\\\u0000-\u001f\u007f]/.test(probe) || probe.split("/").some((segment) => segment === "." || segment === "..")) return null;
|
|
1419
1588
|
const next = probe.replace(/%(25|2e|2f|5c)/gi, (_, hex) => String.fromCharCode(Number.parseInt(hex, 16)));
|
|
1420
1589
|
if (next === probe) {
|
|
1421
1590
|
const pathname = decoded.split("/").map((segment) => encodeURIComponent(segment).replace(/%(3a|40|24|26|2b|2c|3b|3d)/gi, (escaped) => String.fromCharCode(Number.parseInt(escaped.slice(1), 16)))).join("/");
|
|
@@ -1429,45 +1598,31 @@ function normalizeSidecarPathname(input) {
|
|
|
1429
1598
|
}
|
|
1430
1599
|
return null;
|
|
1431
1600
|
}
|
|
1432
|
-
const EXEC_ROUTES = [
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
rateFamily: "process"
|
|
1440
|
-
},
|
|
1441
|
-
{
|
|
1442
|
-
path: "process/spawn",
|
|
1443
|
-
rateFamily: "process"
|
|
1444
|
-
},
|
|
1445
|
-
{
|
|
1446
|
-
path: "process/ensure-dev-server",
|
|
1447
|
-
rateFamily: "process"
|
|
1448
|
-
},
|
|
1449
|
-
{
|
|
1450
|
-
path: "terminals/commands",
|
|
1451
|
-
rateFamily: "terminal"
|
|
1452
|
-
}
|
|
1453
|
-
];
|
|
1601
|
+
const EXEC_ROUTES = [{
|
|
1602
|
+
path: "exec",
|
|
1603
|
+
rateFamily: "process"
|
|
1604
|
+
}, {
|
|
1605
|
+
path: "terminals/commands",
|
|
1606
|
+
rateFamily: "terminal"
|
|
1607
|
+
}];
|
|
1454
1608
|
/** Classify once, before constructing a URL that could erase dot segments. */
|
|
1455
1609
|
function classifySidecarRequest(input, method, upgrade = false) {
|
|
1456
1610
|
const normalized = normalizeSidecarPathname(input);
|
|
1457
1611
|
if (!normalized) return null;
|
|
1458
1612
|
const { path, pathname } = normalized;
|
|
1613
|
+
const operation = !upgrade ? sandboxOperation(`/${path}`, method, "hostAgent") : void 0;
|
|
1459
1614
|
const exec = method === "POST" && !upgrade ? EXEC_ROUTES.find((route) => route.path === path) : void 0;
|
|
1460
|
-
let auditAction = exec ? "sandbox.exec" : null;
|
|
1615
|
+
let auditAction = operation?.auditAction ?? (exec ? "sandbox.exec" : null);
|
|
1461
1616
|
if (upgrade && /^terminals\/[^/]+\/ws$/.test(path)) auditAction = "sandbox.terminal.attach";
|
|
1462
1617
|
else if (upgrade && path === "ssh") auditAction = "sandbox.ssh.open";
|
|
1463
1618
|
else if (!upgrade && method === "POST" && path === "terminals") auditAction = "sandbox.terminal.attach";
|
|
1464
|
-
const rateFamily = exec?.rateFamily ?? (auditAction ? "terminal-open" : null) ?? (path === "process" || path.startsWith("process/") ? "process" : null);
|
|
1619
|
+
const rateFamily = operation?.rateFamily ?? exec?.rateFamily ?? (auditAction ? "terminal-open" : null) ?? (path === "process" || path.startsWith("process/") ? "process" : null);
|
|
1465
1620
|
return {
|
|
1466
1621
|
path,
|
|
1467
1622
|
pathname,
|
|
1468
1623
|
auditAction,
|
|
1469
1624
|
rateFamily,
|
|
1470
|
-
shortTokenRequired: !!exec
|
|
1625
|
+
shortTokenRequired: operation?.shortTokenRequired ?? !!exec
|
|
1471
1626
|
};
|
|
1472
1627
|
}
|
|
1473
1628
|
//#endregion
|
|
@@ -3161,7 +3316,7 @@ var SandboxOperation = class SandboxOperation {
|
|
|
3161
3316
|
//#region src/lib/sandbox-command.ts
|
|
3162
3317
|
const SANDBOX_COMMAND_SHELL = "/bin/sh";
|
|
3163
3318
|
function sandboxShellCommandArgs(command) {
|
|
3164
|
-
return ["-c", command];
|
|
3319
|
+
return [...["-c"], command];
|
|
3165
3320
|
}
|
|
3166
3321
|
//#endregion
|
|
3167
3322
|
//#region src/managed-process.ts
|
|
@@ -5527,37 +5682,31 @@ var SandboxRuntimeOperations = class extends SandboxLifecycleCapabilities {
|
|
|
5527
5682
|
}
|
|
5528
5683
|
};
|
|
5529
5684
|
//#endregion
|
|
5530
|
-
//#region src/sandbox-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
const
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
}
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
}
|
|
5551
|
-
var SandboxExecCapabilities = class extends SandboxRuntimeOperations {
|
|
5552
|
-
/**
|
|
5553
|
-
* Execute a command in the sandbox through a non-login POSIX shell.
|
|
5554
|
-
* The command inherits the sandbox runtime environment.
|
|
5555
|
-
*/
|
|
5685
|
+
//#region src/generated/sandbox-code-operations.ts
|
|
5686
|
+
var SandboxCodeOperations = class extends SandboxRuntimeOperations {
|
|
5687
|
+
async runCode(language, source, options) {
|
|
5688
|
+
const headers = sessionHeaders(options?.sessionId) ?? {};
|
|
5689
|
+
await this.ensureRunning();
|
|
5690
|
+
if (options?.idempotencyKey) headers["X-Idempotency-Key"] = options.idempotencyKey;
|
|
5691
|
+
const payload = await readResponseJson(await this.runtimeFetch("/code/exec", {
|
|
5692
|
+
method: "POST",
|
|
5693
|
+
headers,
|
|
5694
|
+
body: JSON.stringify({
|
|
5695
|
+
language,
|
|
5696
|
+
source,
|
|
5697
|
+
timeoutMs: options?.timeoutMs,
|
|
5698
|
+
env: options?.env,
|
|
5699
|
+
cwd: options?.cwd
|
|
5700
|
+
})
|
|
5701
|
+
}));
|
|
5702
|
+
if (!payload.success || !payload.data) throw new Error(payload.error?.message ?? "runCode failed without a typed error");
|
|
5703
|
+
return payload.data;
|
|
5704
|
+
}
|
|
5556
5705
|
async exec(command, options) {
|
|
5557
5706
|
const headers = callHeaders(options);
|
|
5558
5707
|
await this.ensureRunning(options?.signal);
|
|
5559
|
-
const timeoutMs = options?.timeoutMs ??
|
|
5560
|
-
if (!Number.isInteger(timeoutMs) || timeoutMs <
|
|
5708
|
+
const timeoutMs = options?.timeoutMs ?? 3e4;
|
|
5709
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs < 100 || timeoutMs > 6e5) throw new ValidationError("exec timeoutMs must be an integer between 100 and 600000");
|
|
5561
5710
|
const result = (await readResponseJson(await runPreparedProcess((path, init, budget) => this.runtimeFetch(path, init, { timeoutMs: budget }), "/process/spawn", {
|
|
5562
5711
|
method: "POST",
|
|
5563
5712
|
headers,
|
|
@@ -5570,7 +5719,7 @@ var SandboxExecCapabilities = class extends SandboxRuntimeOperations {
|
|
|
5570
5719
|
timeoutMs,
|
|
5571
5720
|
blocking: true
|
|
5572
5721
|
})
|
|
5573
|
-
}, timeoutMs +
|
|
5722
|
+
}, timeoutMs + 15e3))).data;
|
|
5574
5723
|
if (!result || typeof result.exitCode !== "number" || typeof result.stdout !== "string" || typeof result.stderr !== "string") throw new ServerError("Sandbox process response was malformed", 502);
|
|
5575
5724
|
return {
|
|
5576
5725
|
exitCode: result.exitCode,
|
|
@@ -5578,51 +5727,14 @@ var SandboxExecCapabilities = class extends SandboxRuntimeOperations {
|
|
|
5578
5727
|
stderr: result.stderr
|
|
5579
5728
|
};
|
|
5580
5729
|
}
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
* structured outputs (matplotlib images as base64 PNG, pandas DataFrames,
|
|
5590
|
-
* explicit `display(value)` calls as JSON/HTML, errors with traceback).
|
|
5591
|
-
*
|
|
5592
|
-
* @example Persistent Python session
|
|
5593
|
-
* ```ts
|
|
5594
|
-
* await box.runCode("python", "import pandas as pd; df = pd.DataFrame({'x': range(5)})", { sessionId: "s1" });
|
|
5595
|
-
* const r = await box.runCode("python", "df.describe()", { sessionId: "s1" });
|
|
5596
|
-
* // r.results[0] is a `dataframe` part with columns + rows from the describe()
|
|
5597
|
-
* ```
|
|
5598
|
-
*
|
|
5599
|
-
* @example Matplotlib chart
|
|
5600
|
-
* ```ts
|
|
5601
|
-
* const r = await box.runCode("python",
|
|
5602
|
-
* "import matplotlib.pyplot as plt; plt.plot([1,2,3,4]); plt.show()",
|
|
5603
|
-
* { sessionId: "s1" });
|
|
5604
|
-
* const png = r.results.find(p => p.type === "image");
|
|
5605
|
-
* // png.data is a base64 PNG ready to render or hand back to an LLM
|
|
5606
|
-
* ```
|
|
5607
|
-
*/
|
|
5608
|
-
async runCode(language, source, options) {
|
|
5609
|
-
const headers = sessionHeaders(options?.sessionId) ?? {};
|
|
5610
|
-
await this.ensureRunning();
|
|
5611
|
-
if (options?.idempotencyKey) headers["X-Idempotency-Key"] = options.idempotencyKey;
|
|
5612
|
-
const payload = await readResponseJson(await this.runtimeFetch("/code/exec", {
|
|
5613
|
-
method: "POST",
|
|
5614
|
-
headers,
|
|
5615
|
-
body: JSON.stringify({
|
|
5616
|
-
language,
|
|
5617
|
-
source,
|
|
5618
|
-
timeoutMs: options?.timeoutMs,
|
|
5619
|
-
env: options?.env,
|
|
5620
|
-
cwd: options?.cwd
|
|
5621
|
-
})
|
|
5622
|
-
}));
|
|
5623
|
-
if (!payload.success || !payload.data) throw new Error(payload.error?.message ?? "runCode failed without a typed error");
|
|
5624
|
-
return payload.data;
|
|
5625
|
-
}
|
|
5730
|
+
};
|
|
5731
|
+
//#endregion
|
|
5732
|
+
//#region src/sandbox-exec.ts
|
|
5733
|
+
function quoteForShell(value) {
|
|
5734
|
+
if (value.includes("\0")) throw new Error("Shell argument contains NUL byte");
|
|
5735
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
5736
|
+
}
|
|
5737
|
+
var SandboxExecCapabilities = class extends SandboxCodeOperations {
|
|
5626
5738
|
/**
|
|
5627
5739
|
* Search for text patterns in files using ripgrep.
|
|
5628
5740
|
*
|
package/dist/tangle/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as JOB_SANDBOX_DELETE, T as SandboxCreateResponseParamTypes, _ as TANGLE_JOBS_CONTRACT, a as fetchQuote, b as AgentSandboxBlueprintAbi, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as TANGLE_CHAIN_ID, h as TangleSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TangleSandboxClientConfig, w as SandboxCreateParamTypes, x as JOB_SANDBOX_CREATE, y as ITangleJobsAbi } from "../index-
|
|
1
|
+
import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as JOB_SANDBOX_DELETE, T as SandboxCreateResponseParamTypes, _ as TANGLE_JOBS_CONTRACT, a as fetchQuote, b as AgentSandboxBlueprintAbi, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as TANGLE_CHAIN_ID, h as TangleSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TangleSandboxClientConfig, w as SandboxCreateParamTypes, x as JOB_SANDBOX_CREATE, y as ITangleJobsAbi } from "../index-DVKTxbNc.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JobQuoteDetails, JsonResponseParamTypes, OperatorChallenge, OperatorSession, OperatorSessionError, OperatorSessionToken, QuoteDomain, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, SignMessage, SignedQuote, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, TangleSandboxClientConfig, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-
|
|
1
|
+
import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-h3zo20pc.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
1
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-DTuiPoNU.js";
|
|
2
2
|
import { i as readResponseJson } from "./errors-BStusQVc.js";
|
|
3
3
|
import { _ as rotlBH, a as anumber, b as rotlSL, d as createXOFer, g as u32, h as toBytes$1, l as createHasher, m as swap32IfBE, n as abytes, o as aoutput, r as aexists, s as clean, t as Hash, v as rotlBL, x as split, y as rotlSH } from "./utils-BXgE8UHJ.js";
|
|
4
4
|
//#region ../../../packages/runtime-contracts/dist/tangle-blueprint-abi.js
|
|
@@ -2599,7 +2599,7 @@ interface TerminalAttachTimings {
|
|
|
2599
2599
|
echoRttMs?: number;
|
|
2600
2600
|
/** How the init was offered: on the upgrade URL as well as in the frame (a default-shell attach), or in the frame alone. */
|
|
2601
2601
|
init: "upgrade" | "frame";
|
|
2602
|
-
/** The
|
|
2602
|
+
/** The runtime's stamps; absent when the runtime does not stamp the attach. */
|
|
2603
2603
|
server?: TerminalReadyTimings;
|
|
2604
2604
|
}
|
|
2605
2605
|
/** Authority refreshed before an interactive stream reconnects. */
|