@tangle-network/sandbox 0.64.21 → 0.64.23
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 +2 -0
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +4 -4
- package/dist/agent/preview.d.ts +1 -1
- package/dist/agent/preview.js +2 -2
- package/dist/{agent-run-outcome-UqVoiafo.d.ts → agent-run-outcome-BoiY5RrK.d.ts} +1 -1
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/{browser-interactive-control-controller-CvObO_Kf.d.ts → browser-interactive-control-controller-Cw2Q3hfX.d.ts} +1 -1
- package/dist/{client-Bzklblzg.d.ts → client-B804yDSr.d.ts} +6 -5
- package/dist/{client-Hj4dfcQT.js → client-C-o416Dc.js} +16 -7
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/core.d.ts +6 -6
- package/dist/core.js +4 -4
- package/dist/{index-iYdJi4O8.d.ts → index-CNM15Rx0.d.ts} +6 -6
- package/dist/index.d.ts +11 -11
- package/dist/index.js +7 -7
- package/dist/interactive-control.d.ts +1 -1
- package/dist/{interactive-controller-CG-ikeYf.d.ts → interactive-controller-BOe7cpuN.d.ts} +3 -3
- package/dist/{interactive-controller-OAsASPd_.js → interactive-controller-D_YmzZMA.js} +15 -2
- package/dist/lib/prepared-evidence.d.ts +4 -0
- package/dist/lib/prepared-evidence.js +2 -0
- package/dist/lib/prepared-process.d.ts +10 -0
- package/dist/lib/prepared-process.js +2 -0
- package/dist/{lines-CEX65fBF.d.ts → lines--NPNRhka.d.ts} +1 -1
- package/dist/lines.d.ts +1 -1
- package/dist/lines.js +1 -1
- package/dist/{local-cli-auth-Ch-deqly.js → local-cli-auth-5wvTE6DL.js} +1 -1
- package/dist/{mcp-local-BjLG7VHY.js → mcp-local-BaQdgLvZ.js} +1 -1
- package/dist/prepared-evidence-Crb-sWgL.js +62 -0
- package/dist/prepared-process-BOu9ZhKj.js +100 -0
- package/dist/{preview-Cjg3Lsls.d.ts → preview-D-1iLTNy.d.ts} +3 -3
- package/dist/{public-templates-CXn4aQsN.d.ts → public-templates-8gLwCwQm.d.ts} +2 -2
- package/dist/public-templates.d.ts +1 -1
- package/dist/{raw-evidence-archive-CDYDqHNv.js → raw-evidence-archive-DvWOvznt.js} +40 -33
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.js +1 -1
- package/dist/{sandbox-B-jG2cbj.js → sandbox-ClF1lCZz.js} +42 -20
- package/dist/{secp256k1-CmLpsmWl.js → secp256k1-CZAC_H2H.js} +1 -1
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-BUFCa-Up.js → tangle-rBYA7naZ.js} +3 -3
- package/dist/{types-CxfH95D5.d.ts → types-B2UV3_Ta.d.ts} +14 -2
- package/package.json +8 -8
- /package/dist/{chunked-upload-file-Dpv1YsoA.js → chunked-upload-file-D2HelcEi.js} +0 -0
- /package/dist/{cli-auth-bundle-Dyw3hCGx.d.ts → cli-auth-bundle-C5jJHHWq.d.ts} +0 -0
- /package/dist/{cli-auth-bundle-tQLVYptC.js → cli-auth-bundle-DyiAdzXr.js} +0 -0
- /package/dist/{collaboration-g_HzXa6f.js → collaboration-Dgyl7F33.js} +0 -0
- /package/dist/{direct-http2-Dar5erTH.js → direct-http2-BNulnzDd.js} +0 -0
- /package/dist/{index-C8VSFtWl.d.ts → index-BOND2ou0.d.ts} +0 -0
- /package/dist/{index-CVjTnRWP.d.ts → index-Crpv6Ejs.d.ts} +0 -0
- /package/dist/{line-application-DY9ZTdgF.js → line-application-CvOBTLei.js} +0 -0
- /package/dist/{lines-C5ER4aN_.js → lines-CXkOvy_9.js} +0 -0
- /package/dist/{preview-operations-Ca02vPDJ.js → preview-operations-Dr-bMWGF.js} +0 -0
- /package/dist/{terminal-stream-types-ClZCArRg.d.ts → terminal-stream-types-CR_JP7ub.d.ts} +0 -0
- /package/dist/{utils-BGvM02yJ.js → utils-CLVp0apb.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as listAgentPreviews, i as getAgentPreview, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "./preview-operations-
|
|
1
|
+
import { a as listAgentPreviews, i as getAgentPreview, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "./preview-operations-Dr-bMWGF.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
//#region \0rolldown/runtime.js
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//#region src/lib/prepared-evidence.mjs
|
|
2
|
+
async function receipt(response) {
|
|
3
|
+
const reader = response.body?.getReader();
|
|
4
|
+
if (!reader) throw new Error("Evidence preparation has no receipt");
|
|
5
|
+
let length = 0;
|
|
6
|
+
const chunks = [];
|
|
7
|
+
try {
|
|
8
|
+
while (true) {
|
|
9
|
+
const next = await reader.read();
|
|
10
|
+
if (next.done) break;
|
|
11
|
+
length += next.value.byteLength;
|
|
12
|
+
if (length > 4096) {
|
|
13
|
+
await reader.cancel();
|
|
14
|
+
throw new Error("Evidence preparation receipt is too large");
|
|
15
|
+
}
|
|
16
|
+
chunks.push(next.value);
|
|
17
|
+
}
|
|
18
|
+
} finally {
|
|
19
|
+
reader.releaseLock();
|
|
20
|
+
}
|
|
21
|
+
const bytes = new Uint8Array(length);
|
|
22
|
+
let offset = 0;
|
|
23
|
+
for (const chunk of chunks) {
|
|
24
|
+
bytes.set(chunk, offset);
|
|
25
|
+
offset += chunk.byteLength;
|
|
26
|
+
}
|
|
27
|
+
const pending = JSON.parse(new TextDecoder().decode(bytes));
|
|
28
|
+
if (pending.state !== "preparing" || typeof pending.archiveId !== "string" || !/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i.test(pending.archiveId)) throw new Error("Malformed evidence preparation receipt");
|
|
29
|
+
return pending.archiveId;
|
|
30
|
+
}
|
|
31
|
+
/** One bounded prepare/poll/cancel transport; archive validation remains with its decoder. */
|
|
32
|
+
async function runPreparedEvidence(request, signal, timeoutMs = 15 * 6e4) {
|
|
33
|
+
let archiveId;
|
|
34
|
+
try {
|
|
35
|
+
let response = await request(signal);
|
|
36
|
+
const deadline = Date.now() + timeoutMs;
|
|
37
|
+
while (response.status === 202) {
|
|
38
|
+
archiveId = await receipt(response);
|
|
39
|
+
signal?.throwIfAborted();
|
|
40
|
+
if (Date.now() >= deadline) throw new Error("Evidence preparation timed out");
|
|
41
|
+
await new Promise((resolve, reject) => {
|
|
42
|
+
const abort = () => {
|
|
43
|
+
clearTimeout(timer);
|
|
44
|
+
reject(signal.reason);
|
|
45
|
+
};
|
|
46
|
+
const timer = setTimeout(() => {
|
|
47
|
+
signal?.removeEventListener("abort", abort);
|
|
48
|
+
resolve();
|
|
49
|
+
}, Math.min(1e3, deadline - Date.now()));
|
|
50
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
51
|
+
if (signal?.aborted) abort();
|
|
52
|
+
});
|
|
53
|
+
response = await request(signal, archiveId);
|
|
54
|
+
}
|
|
55
|
+
return response;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (archiveId) await request(AbortSignal.timeout(5e3), archiveId, true).then((response) => response.body?.cancel()).catch(() => void 0);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { runPreparedEvidence as t };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//#region src/lib/prepared-process.mjs
|
|
2
|
+
/** Request and pause share one deadline, including independent cancellation cleanup. */
|
|
3
|
+
function processRequests(request, deadline, signal) {
|
|
4
|
+
const remaining = (ceiling = 3e4) => {
|
|
5
|
+
signal?.throwIfAborted();
|
|
6
|
+
const left = Math.floor(deadline - performance.now());
|
|
7
|
+
if (left <= 0) throw new Error("Process result timed out");
|
|
8
|
+
return Math.min(left, ceiling);
|
|
9
|
+
};
|
|
10
|
+
const ask = (target, options, ceiling = 3e4) => {
|
|
11
|
+
const left = remaining(ceiling);
|
|
12
|
+
const timeoutSignal = Number.isFinite(left) ? AbortSignal.timeout(left) : void 0;
|
|
13
|
+
const requestSignal = signal && timeoutSignal ? AbortSignal.any([signal, timeoutSignal]) : signal ?? timeoutSignal;
|
|
14
|
+
return request(target, {
|
|
15
|
+
...options,
|
|
16
|
+
...requestSignal ? { signal: requestSignal } : {}
|
|
17
|
+
}, Number.isFinite(left) ? left : 0);
|
|
18
|
+
};
|
|
19
|
+
const pause = () => {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
const abort = () => {
|
|
22
|
+
clearTimeout(timer);
|
|
23
|
+
reject(signal.reason);
|
|
24
|
+
};
|
|
25
|
+
const timer = setTimeout(() => {
|
|
26
|
+
signal?.removeEventListener("abort", abort);
|
|
27
|
+
resolve();
|
|
28
|
+
}, Math.min(250, remaining()));
|
|
29
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
30
|
+
if (signal?.aborted) abort();
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
ask,
|
|
35
|
+
pause
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Only the small pending receipt is parsed; terminal output stays streamed. */
|
|
39
|
+
async function pollPreparedProcess(transport, target, pid, headers, read) {
|
|
40
|
+
while (true) {
|
|
41
|
+
const response = await transport.ask(target, {
|
|
42
|
+
method: "GET",
|
|
43
|
+
headers
|
|
44
|
+
});
|
|
45
|
+
if (response.status !== 202) return response;
|
|
46
|
+
const pending = await read(response);
|
|
47
|
+
if (pending.state !== "running" || pending.pid !== pid) throw new Error("Malformed process result receipt");
|
|
48
|
+
await transport.pause();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** One prepare/PID/result transport for SDK, Worker adapters and Node probes. */
|
|
52
|
+
async function runPreparedProcess(request, path, init, timeoutMs = 75e3, read = (response) => response.clone().json()) {
|
|
53
|
+
const transport = processRequests(request, timeoutMs === 0 ? Number.POSITIVE_INFINITY : performance.now() + timeoutMs, init.signal);
|
|
54
|
+
const resultBase = path.split("?")[0].replace(/\/spawn$/, "");
|
|
55
|
+
let pid;
|
|
56
|
+
try {
|
|
57
|
+
const response = await transport.ask(`${path}${path.includes("?") ? "&" : "?"}async=1`, init, Number.POSITIVE_INFINITY);
|
|
58
|
+
if (response.status < 200 || response.status >= 300) return response;
|
|
59
|
+
const admitted = await read(response);
|
|
60
|
+
if (typeof admitted.data?.exitCode === "number") return response;
|
|
61
|
+
pid = admitted.data?.pid;
|
|
62
|
+
if (!Number.isSafeInteger(pid) || pid <= 0) throw new Error("Malformed process admission");
|
|
63
|
+
return await pollPreparedProcess(transport, `${resultBase}/${pid}?result=1`, pid, init.headers, read);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
const cancelHeaders = new Headers(init.headers);
|
|
66
|
+
cancelHeaders.set("Content-Type", "application/json");
|
|
67
|
+
if (pid) {
|
|
68
|
+
const cleanup = processRequests(request, performance.now() + 5e3);
|
|
69
|
+
try {
|
|
70
|
+
await (await cleanup.ask(`${resultBase}/${pid}`, {
|
|
71
|
+
method: "DELETE",
|
|
72
|
+
headers: cancelHeaders,
|
|
73
|
+
body: JSON.stringify({
|
|
74
|
+
signal: "SIGKILL",
|
|
75
|
+
tree: true
|
|
76
|
+
})
|
|
77
|
+
})).body?.cancel?.();
|
|
78
|
+
const settled = await pollPreparedProcess(cleanup, `${resultBase}/${pid}?result=1`, pid, init.headers, read);
|
|
79
|
+
if (settled.status !== 200 && settled.status !== 408) throw new Error("Process cancellation settlement unknown");
|
|
80
|
+
await settled.body?.cancel?.();
|
|
81
|
+
} catch {}
|
|
82
|
+
}
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** Adapt existing parsed-JSON probe calls without changing their result schema. */
|
|
87
|
+
function withPreparedProcessCalls(call) {
|
|
88
|
+
return async (path, init = {}, timeoutMs = 75e3, ...rest) => {
|
|
89
|
+
if (init.method !== "POST" || !path.split("?")[0].endsWith("/process/spawn")) return call(path, init, timeoutMs, ...rest);
|
|
90
|
+
if ((typeof init.body === "string" ? JSON.parse(init.body) : void 0)?.blocking !== true) return call(path, init, timeoutMs, ...rest);
|
|
91
|
+
const started = performance.now();
|
|
92
|
+
const result = await runPreparedProcess((route, options, budget) => call(route, options, budget, ...rest), path, init, timeoutMs, (response) => response.body);
|
|
93
|
+
return {
|
|
94
|
+
...result,
|
|
95
|
+
...typeof result.wallMs === "number" ? { wallMs: performance.now() - started } : {}
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { withPreparedProcessCalls as n, runPreparedProcess as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as SandboxInstance } from "./index-
|
|
2
|
-
import { F as EnsureDevServerOptions, H as PreviewLinkInfo } from "./types-
|
|
3
|
-
import { t as Sandbox } from "./client-
|
|
1
|
+
import { O as SandboxInstance } from "./index-CNM15Rx0.js";
|
|
2
|
+
import { F as EnsureDevServerOptions, H as PreviewLinkInfo } from "./types-B2UV3_Ta.js";
|
|
3
|
+
import { t as Sandbox } from "./client-B804yDSr.js";
|
|
4
4
|
|
|
5
5
|
//#region src/agent/preview-operations.d.ts
|
|
6
6
|
type AgentPreviewOptions = Pick<EnsureDevServerOptions, "sessionId" | "cwd"> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as SandboxError } from "./terminal-stream-types-
|
|
2
|
-
import { Pi as HttpClient, ai as PublishPublicTemplateVersionOptions, ii as PublishPublicTemplateOptions, ni as PublicTemplateInfo, ri as PublicTemplateVersionInfo } from "./types-
|
|
1
|
+
import { F as SandboxError } from "./terminal-stream-types-CR_JP7ub.js";
|
|
2
|
+
import { Pi as HttpClient, ai as PublishPublicTemplateVersionOptions, ii as PublishPublicTemplateOptions, ni as PublicTemplateInfo, ri as PublicTemplateVersionInfo } from "./types-B2UV3_Ta.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/public-templates.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PublicTemplatesClient, i as PublicTemplatePublishRequestOptions, n as PublicTemplatePublishError, r as PublicTemplatePublishJob, t as PublicTemplatePublishArtifact } from "./public-templates-
|
|
1
|
+
import { a as PublicTemplatesClient, i as PublicTemplatePublishRequestOptions, n as PublicTemplatePublishError, r as PublicTemplatePublishJob, t as PublicTemplatePublishArtifact } from "./public-templates-8gLwCwQm.js";
|
|
2
2
|
export { PublicTemplatePublishArtifact, PublicTemplatePublishError, PublicTemplatePublishJob, PublicTemplatePublishRequestOptions, PublicTemplatesClient };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as runPreparedEvidence } from "./prepared-evidence-Crb-sWgL.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
//#region src/lib/raw-evidence-archive.ts
|
|
3
4
|
const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/).transform((value) => `sha256:${value.slice(7)}`);
|
|
@@ -245,7 +246,7 @@ async function exportRawEvidenceDirectory(request, subject, targetDirectory, opt
|
|
|
245
246
|
} catch (error) {
|
|
246
247
|
if (error.code !== "ENOENT") throw error;
|
|
247
248
|
}
|
|
248
|
-
const response = await request
|
|
249
|
+
const response = await runPreparedEvidence(request, options.signal);
|
|
249
250
|
if (!response.ok) {
|
|
250
251
|
await response.body?.cancel();
|
|
251
252
|
throw new Error(`Raw evidence archive request failed (HTTP ${response.status}); no legacy fallback`);
|
|
@@ -275,38 +276,7 @@ async function exportRawEvidenceDirectory(request, subject, targetDirectory, opt
|
|
|
275
276
|
await fs.mkdir(directory, { mode: 448 });
|
|
276
277
|
try {
|
|
277
278
|
const archive = join(staging, "archive.tar.gz");
|
|
278
|
-
const
|
|
279
|
-
const hash = createHash("sha256");
|
|
280
|
-
let sizeBytes = 0;
|
|
281
|
-
const reader = response.body?.getReader();
|
|
282
|
-
const abort = () => {
|
|
283
|
-
reader?.cancel(options.signal?.reason).catch(() => {});
|
|
284
|
-
};
|
|
285
|
-
options.signal?.addEventListener("abort", abort, { once: true });
|
|
286
|
-
const maxArchiveBytes = options.maxArchiveBytes ?? Math.min(Number.MAX_SAFE_INTEGER, options.maxBytes + options.maxFiles * 2048 + 1024 * 1024);
|
|
287
|
-
try {
|
|
288
|
-
for (;;) {
|
|
289
|
-
options.signal?.throwIfAborted();
|
|
290
|
-
const chunk = await reader?.read();
|
|
291
|
-
options.signal?.throwIfAborted();
|
|
292
|
-
if (!chunk || chunk.done) break;
|
|
293
|
-
sizeBytes += chunk.value.byteLength;
|
|
294
|
-
if (sizeBytes > maxArchiveBytes) throw new Error("Evidence archive exceeds compressed byte limit");
|
|
295
|
-
hash.update(chunk.value);
|
|
296
|
-
await file.writeFile(chunk.value);
|
|
297
|
-
}
|
|
298
|
-
} finally {
|
|
299
|
-
options.signal?.removeEventListener("abort", abort);
|
|
300
|
-
await file.close();
|
|
301
|
-
await reader?.cancel().catch(() => {});
|
|
302
|
-
reader?.releaseLock();
|
|
303
|
-
}
|
|
304
|
-
const length = response.headers.get("content-length");
|
|
305
|
-
if (length !== null && (!/^\d+$/.test(length) || Number(length) !== sizeBytes)) throw new Error("Evidence archive transfer was truncated");
|
|
306
|
-
const transfer = {
|
|
307
|
-
sizeBytes,
|
|
308
|
-
sha256: hash.digest("hex")
|
|
309
|
-
};
|
|
279
|
+
const transfer = await downloadEvidenceArchive(response, archive, options);
|
|
310
280
|
const members = /* @__PURE__ */ new Map();
|
|
311
281
|
const extract = tar.extract();
|
|
312
282
|
let unpacked = 0;
|
|
@@ -495,6 +465,43 @@ async function exportRawEvidenceDirectory(request, subject, targetDirectory, opt
|
|
|
495
465
|
throw new Error(`Evidence export failed; partial bytes retained at ${staging}`, { cause: error });
|
|
496
466
|
}
|
|
497
467
|
}
|
|
468
|
+
/** Acquire bounded compressed bytes and verify the complete transfer before extraction. */
|
|
469
|
+
async function downloadEvidenceArchive(response, archive, options) {
|
|
470
|
+
const fs = await import("node:fs/promises");
|
|
471
|
+
const { createHash } = await import("node:crypto");
|
|
472
|
+
const file = await fs.open(archive, "wx", 384);
|
|
473
|
+
const hash = createHash("sha256");
|
|
474
|
+
let sizeBytes = 0;
|
|
475
|
+
const reader = response.body?.getReader();
|
|
476
|
+
const abort = () => {
|
|
477
|
+
reader?.cancel(options.signal?.reason).catch(() => {});
|
|
478
|
+
};
|
|
479
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
480
|
+
const maxArchiveBytes = options.maxArchiveBytes ?? Math.min(Number.MAX_SAFE_INTEGER, options.maxBytes + options.maxFiles * 2048 + 1024 * 1024);
|
|
481
|
+
try {
|
|
482
|
+
for (;;) {
|
|
483
|
+
options.signal?.throwIfAborted();
|
|
484
|
+
const chunk = await reader?.read();
|
|
485
|
+
options.signal?.throwIfAborted();
|
|
486
|
+
if (!chunk || chunk.done) break;
|
|
487
|
+
sizeBytes += chunk.value.byteLength;
|
|
488
|
+
if (sizeBytes > maxArchiveBytes) throw new Error("Evidence archive exceeds compressed byte limit");
|
|
489
|
+
hash.update(chunk.value);
|
|
490
|
+
await file.writeFile(chunk.value);
|
|
491
|
+
}
|
|
492
|
+
} finally {
|
|
493
|
+
options.signal?.removeEventListener("abort", abort);
|
|
494
|
+
await file.close();
|
|
495
|
+
await reader?.cancel().catch(() => {});
|
|
496
|
+
reader?.releaseLock();
|
|
497
|
+
}
|
|
498
|
+
const length = response.headers.get("content-length");
|
|
499
|
+
if (length !== null && (!/^\d+$/.test(length) || Number(length) !== sizeBytes)) throw new Error("Evidence archive transfer was truncated");
|
|
500
|
+
return {
|
|
501
|
+
sizeBytes,
|
|
502
|
+
sha256: hash.digest("hex")
|
|
503
|
+
};
|
|
504
|
+
}
|
|
498
505
|
async function readBoundedResponse(response, max, signal) {
|
|
499
506
|
const reader = response.body?.getReader();
|
|
500
507
|
let size = 0;
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as NotFoundError, F as SandboxError, H as TimeoutError, I as SandboxErrorJson, L as SandboxFailureDetail, M as ProfileFileMountPathError, N as QuotaError, R as ServerError, S as CapabilityError, T as FileWriteConflictError, U as ValidationError, b as AuthError, j as PartialFailureError, k as NetworkError, u as ScopedToken, z as StateError } from "./terminal-stream-types-
|
|
2
|
-
import { Bn as SandboxPortBinding, Br as FileTreeResult, Ct as SessionMessageAdmission, Dt as TaskSessionCommitResult, Er as ChunkedUploadResult, Et as TaskSessionChanges, Gn as SandboxTerminalCreateOptions, Hr as FileUsageResult, Ir as FileRenameResult, Jn as SandboxTerminalRequestOptions, Jr as UploadProgress, Kn as SandboxTerminalInfo, Kr as RenameOptions, Mr as FileReadBatchOptions, Nr as FileReadBatchResult, Q as CommitTaskSessionOptions, St as SessionMessage, Tr as ChunkedUploadOptions, Un as SandboxRuntimeHealth, Ur as FileWriteResult, Vr as FileUsageOptions, Yr as WriteFileOptions, ct as ListMessagesOptions, dt as SendSessionMessageRequest, fa as SandboxEvent, ft as SentSessionMessage, gt as SessionExecutionStatus, ht as SessionExecutionInfo, it as CreateTaskSessionOptions, kt as TaskSessionInfo, mt as SessionEventStreamOptions, qn as SandboxTerminalManager, rr as TerminalStream, rt as CreateSessionOptions, ut as SendSessionMessageOptions, yt as SessionInfo, zr as FileTreeOptions } from "./types-
|
|
3
|
-
import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-
|
|
4
|
-
import { t as BrowserInteractiveSessionController } from "./interactive-controller-
|
|
5
|
-
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-
|
|
1
|
+
import { A as NotFoundError, F as SandboxError, H as TimeoutError, I as SandboxErrorJson, L as SandboxFailureDetail, M as ProfileFileMountPathError, N as QuotaError, R as ServerError, S as CapabilityError, T as FileWriteConflictError, U as ValidationError, b as AuthError, j as PartialFailureError, k as NetworkError, u as ScopedToken, z as StateError } from "./terminal-stream-types-CR_JP7ub.js";
|
|
2
|
+
import { Bn as SandboxPortBinding, Br as FileTreeResult, Ct as SessionMessageAdmission, Dt as TaskSessionCommitResult, Er as ChunkedUploadResult, Et as TaskSessionChanges, Gn as SandboxTerminalCreateOptions, Hr as FileUsageResult, Ir as FileRenameResult, Jn as SandboxTerminalRequestOptions, Jr as UploadProgress, Kn as SandboxTerminalInfo, Kr as RenameOptions, Mr as FileReadBatchOptions, Nr as FileReadBatchResult, Q as CommitTaskSessionOptions, St as SessionMessage, Tr as ChunkedUploadOptions, Un as SandboxRuntimeHealth, Ur as FileWriteResult, Vr as FileUsageOptions, Yr as WriteFileOptions, ct as ListMessagesOptions, dt as SendSessionMessageRequest, fa as SandboxEvent, ft as SentSessionMessage, gt as SessionExecutionStatus, ht as SessionExecutionInfo, it as CreateTaskSessionOptions, kt as TaskSessionInfo, mt as SessionEventStreamOptions, qn as SandboxTerminalManager, rr as TerminalStream, rt as CreateSessionOptions, ut as SendSessionMessageOptions, yt as SessionInfo, zr as FileTreeOptions } from "./types-B2UV3_Ta.js";
|
|
3
|
+
import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-Cw2Q3hfX.js";
|
|
4
|
+
import { t as BrowserInteractiveSessionController } from "./interactive-controller-BOe7cpuN.js";
|
|
5
|
+
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-BoiY5RrK.js";
|
|
6
6
|
|
|
7
7
|
//#region src/lib/chunked-upload.d.ts
|
|
8
8
|
/** The transport a caller wires this module to — {@link SandboxInstance.runtimeFetch}
|
package/dist/runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, R as deriveAgentRunOutcome, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController, z as projectAgentTerminalRecord } from "./interactive-controller-
|
|
1
|
+
import { I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, R as deriveAgentRunOutcome, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController, z as projectAgentTerminalRecord } from "./interactive-controller-D_YmzZMA.js";
|
|
2
2
|
import { S as StateError, T as ValidationError, _ as ProfileFileMountPathError, a as AuthError, b as SandboxError, g as PartialFailureError, h as NotFoundError, m as NetworkError, s as CapabilityError, u as FileWriteConflictError, v as QuotaError, w as TimeoutError, x as ServerError } from "./errors-BfbOP_rx.js";
|
|
3
3
|
import { f as combineAbortSignals, n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-DHx53yre.js";
|
|
4
4
|
import { s as uploadChunked } from "./chunked-upload-DN2twsUu.js";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { a as normalizeEffectiveBackend, r as backendTypeSchema } from "./backend-types-CLvdSX8V.js";
|
|
2
|
-
import { A as normalizeRuntimeBackendConfig, C as encodePromptForWire, D as assertCurrentBackendType, E as applyRequestedModel, F as withoutRuntimeSecrets, I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, M as requestedSecretProfilePublicDigest, S as validateAcceptedDispatchRunRef, T as canUseNodeHttp2, _ as mintTraceId, a as assertScopedTokenActive, b as parseSSEStream, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as sessionHeaders, g as isTraceId, h as TRACE_ID_HEADER, i as terminalUpgradeHeadersSupported, j as requestedPublicProfileDigest, k as mergeRuntimeBackendConfig, l as normalizeSessionInfo, m as waitForRetryAfter, n as InteractiveSessionController, p as isRetryableCredentialRefusal, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as resolveTraceId, w as encodeTextForWire, x as resolveDispatchRunIdentity, y as traceHeaders } from "./interactive-controller-
|
|
2
|
+
import { A as normalizeRuntimeBackendConfig, C as encodePromptForWire, D as assertCurrentBackendType, E as applyRequestedModel, F as withoutRuntimeSecrets, I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, M as requestedSecretProfilePublicDigest, S as validateAcceptedDispatchRunRef, T as canUseNodeHttp2, _ as mintTraceId, a as assertScopedTokenActive, b as parseSSEStream, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as sessionHeaders, g as isTraceId, h as TRACE_ID_HEADER, i as terminalUpgradeHeadersSupported, j as requestedPublicProfileDigest, k as mergeRuntimeBackendConfig, l as normalizeSessionInfo, m as waitForRetryAfter, n as InteractiveSessionController, p as isRetryableCredentialRefusal, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as resolveTraceId, w as encodeTextForWire, x as resolveDispatchRunIdentity, y as traceHeaders } from "./interactive-controller-D_YmzZMA.js";
|
|
3
3
|
import { C as StreamInterruptedError, F as profileFileMountOutsideRootsMessage, M as SANDBOX_AGENT_HOME, N as SANDBOX_FILE_API_ABSOLUTE_ROOTS, P as isProfileFileMountOutsideRoots, S as StateError, T as ValidationError, _ as ProfileFileMountPathError, a as AuthError, b as SandboxError, c as EdgeNotReadyError, h as NotFoundError, i as readResponseJson, j as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, k as SANDBOX_PROXY_REQUEST_MAX_BYTES, m as NetworkError, n as parseErrorResponse, r as parseResponseError, s as CapabilityError, t as TerminalStreamError, v as QuotaError, w as TimeoutError, x as ServerError } from "./errors-BfbOP_rx.js";
|
|
4
4
|
import { _ as interactiveSessionStatusResponseSchema, d as awaitWithAbort, f as combineAbortSignals, g as interactiveSessionControlValidationResponseSchema, h as interactiveSessionControlReleaseResponseSchema, l as createInteractiveControlHolderId, m as interactiveSessionControlClaimResponseSchema, p as delayUntilAborted } from "./browser-interactive-control-controller-DHx53yre.js";
|
|
5
5
|
import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-BBzJDWyt.js";
|
|
6
6
|
import { s as uploadChunked } from "./chunked-upload-DN2twsUu.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { t as runPreparedProcess } from "./prepared-process-BOu9ZhKj.js";
|
|
8
|
+
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-DyiAdzXr.js";
|
|
9
|
+
import { n as SandboxLines } from "./lines-CXkOvy_9.js";
|
|
9
10
|
import { z } from "zod";
|
|
10
11
|
import { AgentExactRunControlRefSchema, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, InteractionAcknowledgementSchema, InteractionBindingSchema, InteractionRequestSchema, InteractionResponseCommandSchema, InteractionResponseSchema, PlanContinuationSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, canonicalCandidateDigest, canonicalCandidateJson, exactAgentInteractiveSessionStart, sha256DigestSchema, terminalSessionUsable } from "@tangle-network/agent-interface";
|
|
11
12
|
import { AgentInteractiveSessionControlClaimSchema as AgentInteractiveSessionControlClaimSchema$1, AgentInteractiveSessionPromptAcknowledgementSchema as AgentInteractiveSessionPromptAcknowledgementSchema$1, AgentInteractiveSessionRefSchema as AgentInteractiveSessionRefSchema$1, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema as AgentInteractiveSessionStopAcknowledgementSchema$1 } from "@tangle-network/agent-interface/environment-interactive-control";
|
|
@@ -310,6 +311,7 @@ var DirectReadRoute = class {
|
|
|
310
311
|
* degradation, and only `fallback` is declared on that request.
|
|
311
312
|
*/
|
|
312
313
|
async read(signal) {
|
|
314
|
+
signal?.throwIfAborted();
|
|
313
315
|
this.stats.attempts += 1;
|
|
314
316
|
const now = this.now();
|
|
315
317
|
if (now < this.cooldownUntil) {
|
|
@@ -332,14 +334,12 @@ var DirectReadRoute = class {
|
|
|
332
334
|
}
|
|
333
335
|
const controller = new AbortController();
|
|
334
336
|
const timer = setTimeout(() => controller.abort(), DIRECT_READ_TIMEOUT_MS);
|
|
335
|
-
const onAbort = () => controller.abort();
|
|
336
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
337
337
|
let response;
|
|
338
338
|
try {
|
|
339
339
|
response = await this.fetchImpl(grant.url, {
|
|
340
340
|
method: "GET",
|
|
341
341
|
headers: { Authorization: `Bearer ${grant.token}` },
|
|
342
|
-
signal: controller.signal
|
|
342
|
+
signal: signal ? AbortSignal.any([controller.signal, signal]) : controller.signal
|
|
343
343
|
});
|
|
344
344
|
} catch {
|
|
345
345
|
if (signal?.aborted) {
|
|
@@ -353,13 +353,20 @@ var DirectReadRoute = class {
|
|
|
353
353
|
return this.fallback(controller.signal.aborted ? "timeout" : "unreachable");
|
|
354
354
|
} finally {
|
|
355
355
|
clearTimeout(timer);
|
|
356
|
-
signal?.removeEventListener("abort", onAbort);
|
|
357
356
|
}
|
|
358
357
|
if (!response.ok) return this.fallback("refused");
|
|
359
358
|
let body;
|
|
360
359
|
try {
|
|
361
360
|
body = await response.json();
|
|
362
361
|
} catch {
|
|
362
|
+
if (signal?.aborted) {
|
|
363
|
+
this.stats.fallbacks += 1;
|
|
364
|
+
this.stats.lastReason = "unreachable";
|
|
365
|
+
return {
|
|
366
|
+
kind: "fallback",
|
|
367
|
+
reason: "unreachable"
|
|
368
|
+
};
|
|
369
|
+
}
|
|
363
370
|
return this.fallback("malformed");
|
|
364
371
|
}
|
|
365
372
|
const project = body?.project;
|
|
@@ -630,7 +637,9 @@ var SandboxInfoCapabilities = class {
|
|
|
630
637
|
}
|
|
631
638
|
async readStatus(reason) {
|
|
632
639
|
const local = state(this);
|
|
633
|
-
|
|
640
|
+
local.client.signal?.throwIfAborted();
|
|
641
|
+
const direct = local.directRead.engaged() && DIRECT_READ_POLLABLE_STATUSES.has(local.info.status) ? await local.directRead.read(local.client.signal) : null;
|
|
642
|
+
local.client.signal?.throwIfAborted();
|
|
634
643
|
if (direct?.kind === "unchanged") {
|
|
635
644
|
sandboxStatusObservedAt.set(this, Date.now());
|
|
636
645
|
return;
|
|
@@ -1083,6 +1092,9 @@ var DirectRuntimeHttpClient = class {
|
|
|
1083
1092
|
get apiClient() {
|
|
1084
1093
|
return this.baseClient;
|
|
1085
1094
|
}
|
|
1095
|
+
get signal() {
|
|
1096
|
+
return this.baseClient.signal;
|
|
1097
|
+
}
|
|
1086
1098
|
getApiKey() {
|
|
1087
1099
|
return this.baseClient.getApiKey?.();
|
|
1088
1100
|
}
|
|
@@ -1145,6 +1157,10 @@ var DirectRuntimeHttpClient = class {
|
|
|
1145
1157
|
if (options?.body && typeof options.body === "object" && !isFormDataBody) init.duplex = "half";
|
|
1146
1158
|
const directTimeoutMs = fetchOptions?.timeoutMs;
|
|
1147
1159
|
if (!init.signal && typeof directTimeoutMs === "number" && directTimeoutMs > 0) init.signal = AbortSignal.timeout(directTimeoutMs);
|
|
1160
|
+
if (this.signal) {
|
|
1161
|
+
this.signal.throwIfAborted();
|
|
1162
|
+
init.signal = init.signal ? combineAbortSignals([init.signal, this.signal]) : this.signal;
|
|
1163
|
+
}
|
|
1148
1164
|
const send = async (request) => {
|
|
1149
1165
|
const timing = {
|
|
1150
1166
|
onTiming: this.onTiming,
|
|
@@ -1152,7 +1168,7 @@ var DirectRuntimeHttpClient = class {
|
|
|
1152
1168
|
};
|
|
1153
1169
|
if (!route) throw new NetworkError("Direct runtime route was withdrawn");
|
|
1154
1170
|
if (route.useExec && canUseNodeHttp2()) {
|
|
1155
|
-
const { fetchDirectHttp2 } = await import("./direct-http2-
|
|
1171
|
+
const { fetchDirectHttp2 } = await import("./direct-http2-BNulnzDd.js");
|
|
1156
1172
|
return fetchDirectHttp2(route.url, request, timing);
|
|
1157
1173
|
}
|
|
1158
1174
|
return fetchWithKeepAlive(route.url, request, timing);
|
|
@@ -1288,6 +1304,10 @@ const HARNESS_SKILL_DIRS = {
|
|
|
1288
1304
|
//#region ../../../packages/agent-profile-materialize/dist/workspace-files.js
|
|
1289
1305
|
const compareStrings = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
1290
1306
|
constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0);
|
|
1307
|
+
new TextDecoder("utf-8", {
|
|
1308
|
+
fatal: true,
|
|
1309
|
+
ignoreBOM: true
|
|
1310
|
+
});
|
|
1291
1311
|
//#endregion
|
|
1292
1312
|
//#region ../../../packages/agent-profile-materialize/dist/plan-types.js
|
|
1293
1313
|
/**
|
|
@@ -1333,10 +1353,6 @@ new Set(EXECUTOR_SYSTEM_PROMPT_BINDINGS);
|
|
|
1333
1353
|
*/
|
|
1334
1354
|
const BINDABLE_LAUNCH_CONTROLS = ["systemPrompt", ...EXECUTOR_SYSTEM_PROMPT_BINDINGS];
|
|
1335
1355
|
new Set(BINDABLE_LAUNCH_CONTROLS);
|
|
1336
|
-
new TextDecoder("utf-8", {
|
|
1337
|
-
fatal: true,
|
|
1338
|
-
ignoreBOM: true
|
|
1339
|
-
});
|
|
1340
1356
|
Object.values({
|
|
1341
1357
|
agent: "Agent",
|
|
1342
1358
|
askuserquestion: "AskUserQuestion",
|
|
@@ -4880,7 +4896,7 @@ var SandboxExecCapabilities = class extends SandboxRuntimeOperations {
|
|
|
4880
4896
|
await this.ensureRunning(options?.signal);
|
|
4881
4897
|
const timeoutMs = options?.timeoutMs ?? EXEC_DEFAULT_TIMEOUT_MS;
|
|
4882
4898
|
if (!Number.isInteger(timeoutMs) || timeoutMs < EXEC_MIN_TIMEOUT_MS || timeoutMs > EXEC_MAX_TIMEOUT_MS) throw new ValidationError(`exec timeoutMs must be an integer between ${EXEC_MIN_TIMEOUT_MS} and ${EXEC_MAX_TIMEOUT_MS}`);
|
|
4883
|
-
const result = (await readResponseJson(await this.runtimeFetch("/process/spawn", {
|
|
4899
|
+
const result = (await readResponseJson(await runPreparedProcess((path, init, budget) => this.runtimeFetch(path, init, { timeoutMs: budget }), "/process/spawn", {
|
|
4884
4900
|
method: "POST",
|
|
4885
4901
|
headers,
|
|
4886
4902
|
...options?.signal ? { signal: options.signal } : {},
|
|
@@ -4892,7 +4908,7 @@ var SandboxExecCapabilities = class extends SandboxRuntimeOperations {
|
|
|
4892
4908
|
timeoutMs,
|
|
4893
4909
|
blocking: true
|
|
4894
4910
|
})
|
|
4895
|
-
},
|
|
4911
|
+
}, timeoutMs + EXEC_TRANSPORT_MARGIN_MS))).data;
|
|
4896
4912
|
if (!result || typeof result.exitCode !== "number" || typeof result.stdout !== "string" || typeof result.stderr !== "string") throw new ServerError("Sandbox process response was malformed", 502);
|
|
4897
4913
|
return {
|
|
4898
4914
|
exitCode: result.exitCode,
|
|
@@ -7080,10 +7096,13 @@ var SandboxInteractiveCapabilities = class extends SandboxPromptCapabilities {
|
|
|
7080
7096
|
var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabilities {
|
|
7081
7097
|
/** @internal — invoked before the sandbox is deleted. */
|
|
7082
7098
|
async _sessionExportRawEvidence(id, destination, options) {
|
|
7083
|
-
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-
|
|
7099
|
+
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-DvWOvznt.js");
|
|
7084
7100
|
await this.ensureRunning();
|
|
7085
7101
|
await this.refresh();
|
|
7086
|
-
return exportRawEvidenceDirectory((signal) => this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence/archive?${new URLSearchParams([
|
|
7102
|
+
return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence/archive?${new URLSearchParams([
|
|
7103
|
+
["async", "1"],
|
|
7104
|
+
...archiveId ? [["archiveId", archiveId]] : [],
|
|
7105
|
+
...cancel ? [["cancel", "1"]] : [],
|
|
7087
7106
|
["maxBytes", String(options.maxBytes)],
|
|
7088
7107
|
["maxFiles", String(options.maxFiles)],
|
|
7089
7108
|
...options.copy ? [["copy", options.copy]] : [],
|
|
@@ -7108,10 +7127,13 @@ var SandboxSessionEvidenceCapabilities = class extends SandboxInteractiveCapabil
|
|
|
7108
7127
|
* and the byte and file bounds are verified before the directory appears.
|
|
7109
7128
|
*/
|
|
7110
7129
|
async exportRawEvidence(destination, options) {
|
|
7111
|
-
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-
|
|
7130
|
+
const { exportRawEvidenceDirectory } = await import("./raw-evidence-archive-DvWOvznt.js");
|
|
7112
7131
|
await this.ensureRunning();
|
|
7113
7132
|
await this.refresh();
|
|
7114
|
-
return exportRawEvidenceDirectory((signal) => this.runtimeFetch(`/agents/raw-evidence/archive?${new URLSearchParams({
|
|
7133
|
+
return exportRawEvidenceDirectory((signal, archiveId, cancel) => this.runtimeFetch(`/agents/raw-evidence/archive?${new URLSearchParams({
|
|
7134
|
+
async: "1",
|
|
7135
|
+
...archiveId ? { archiveId } : {},
|
|
7136
|
+
...cancel ? { cancel: "1" } : {},
|
|
7115
7137
|
maxBytes: String(options.maxBytes),
|
|
7116
7138
|
maxFiles: String(options.maxFiles)
|
|
7117
7139
|
})}`, {
|
|
@@ -9414,7 +9436,7 @@ var SandboxFilesystemOperations = class {
|
|
|
9414
9436
|
totalBytes: size,
|
|
9415
9437
|
percentage: 0
|
|
9416
9438
|
});
|
|
9417
|
-
const { uploadChunkedFromFile } = await import("./chunked-upload-file-
|
|
9439
|
+
const { uploadChunkedFromFile } = await import("./chunked-upload-file-D2HelcEi.js");
|
|
9418
9440
|
await uploadChunkedFromFile({ fetch: (path, init) => this.host.runtimeFetch(path, init) }, remotePath, localPath, {
|
|
9419
9441
|
mode: options?.permissions,
|
|
9420
9442
|
onProgress: options?.onProgress ? (progress) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as anumber, c as concatBytes$1, f as randomBytes, h as toBytes, i as ahash, l as createHasher$1, n as abytes$1, o as aoutput, p as rotr, r as aexists, s as clean, t as Hash, u as createView, x as split } from "./utils-
|
|
1
|
+
import { a as anumber, c as concatBytes$1, f as randomBytes, h as toBytes, i as ahash, l as createHasher$1, n as abytes$1, o as aoutput, p as rotr, r as aexists, s as clean, t as Hash, u as createView, x as split } from "./utils-CLVp0apb.js";
|
|
2
2
|
//#region ../../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
|
|
3
3
|
/**
|
|
4
4
|
* Internal Merkle-Damgard hash utils.
|
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-CNM15Rx0.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-rBYA7naZ.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,6 +1,6 @@
|
|
|
1
1
|
import { i as readResponseJson } from "./errors-BfbOP_rx.js";
|
|
2
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
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-
|
|
2
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-ClF1lCZz.js";
|
|
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-CLVp0apb.js";
|
|
4
4
|
//#region ../../../packages/runtime-contracts/dist/tangle-blueprint-abi.js
|
|
5
5
|
/**
|
|
6
6
|
* Tangle blueprint wire contract shared by the orchestrator's Tangle driver and
|
|
@@ -2376,7 +2376,7 @@ function isAddressEqual(a, b) {
|
|
|
2376
2376
|
//#region ../../../node_modules/.pnpm/viem@2.55.4_bufferutil@4.1.0_typescript@6.0.3_utf-8-validate@5.0.10_zod@4.6.5/node_modules/viem/_esm/utils/signature/recoverPublicKey.js
|
|
2377
2377
|
async function recoverPublicKey({ hash, signature }) {
|
|
2378
2378
|
const hashHex = isHex(hash) ? hash : toHex(hash);
|
|
2379
|
-
const { secp256k1 } = await import("./secp256k1-
|
|
2379
|
+
const { secp256k1 } = await import("./secp256k1-CZAC_H2H.js");
|
|
2380
2380
|
return `0x${(() => {
|
|
2381
2381
|
if (typeof signature === "object" && "r" in signature && "s" in signature) {
|
|
2382
2382
|
const { r, s, v, yParity } = signature;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as SandboxCreateReceipt, a as TerminalStreamOptions, g as TerminalReadyInfo, i as TerminalStreamHandlers, s as TerminalStreamToken, t as TerminalAttachTimings } from "./terminal-stream-types-
|
|
2
|
-
import { t as CliAuthReference } from "./cli-auth-bundle-
|
|
1
|
+
import { G as SandboxCreateReceipt, a as TerminalStreamOptions, g as TerminalReadyInfo, i as TerminalStreamHandlers, s as TerminalStreamToken, t as TerminalAttachTimings } from "./terminal-stream-types-CR_JP7ub.js";
|
|
2
|
+
import { t as CliAuthReference } from "./cli-auth-bundle-C5jJHHWq.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import * as _$_tangle_network_agent_interface0 from "@tangle-network/agent-interface";
|
|
5
5
|
import { AgentExactRunControlRef, AgentProfile, AgentProfileCapabilities, AgentProfileConfidential, AgentProfileValidationResult, AgentRuntimeAttachments, PlanContinuation, ReasoningEffort, SandboxSizePreset } from "@tangle-network/agent-interface";
|
|
@@ -2868,6 +2868,8 @@ interface HttpClient {
|
|
|
2868
2868
|
readonly onTiming?: SdkTimingHook | undefined;
|
|
2869
2869
|
/** False keeps exec on the API; see `SandboxConfig.directExec`. */
|
|
2870
2870
|
readonly directExec?: boolean;
|
|
2871
|
+
/** Cancels this client's requests, including direct runtime transports. */
|
|
2872
|
+
readonly signal?: AbortSignal | undefined;
|
|
2871
2873
|
}
|
|
2872
2874
|
//#endregion
|
|
2873
2875
|
//#region src/types/code-execution.d.ts
|
|
@@ -3470,6 +3472,14 @@ interface FileUsageOptions {
|
|
|
3470
3472
|
* by their own metadata without following their targets.
|
|
3471
3473
|
*/
|
|
3472
3474
|
interface FileUsageResult {
|
|
3475
|
+
/** Observational snapshot only; never a quota or billing authority. */
|
|
3476
|
+
observation?: {
|
|
3477
|
+
scanStartedAt: string;
|
|
3478
|
+
observedAt: string;
|
|
3479
|
+
ageMs: number;
|
|
3480
|
+
refreshing: boolean;
|
|
3481
|
+
maxAgeMs: number;
|
|
3482
|
+
};
|
|
3473
3483
|
/** Scanned root, relative to the workspace when applicable. */
|
|
3474
3484
|
root: string;
|
|
3475
3485
|
/** Sum of regular-file and symlink apparent sizes. */
|
|
@@ -4783,6 +4793,8 @@ interface SandboxConfig {
|
|
|
4783
4793
|
* Defaults to 30000 (30 seconds).
|
|
4784
4794
|
*/
|
|
4785
4795
|
timeoutMs?: number;
|
|
4796
|
+
/** Client lifetime cancellation, composed with each request's own signal. */
|
|
4797
|
+
signal?: AbortSignal;
|
|
4786
4798
|
/**
|
|
4787
4799
|
* Permit the SDK to read CLI auth files from the host home directory
|
|
4788
4800
|
* (`~/.codex/auth.json`, `~/.claude/.credentials.json`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sandbox",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.23",
|
|
4
4
|
"description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -159,17 +159,17 @@
|
|
|
159
159
|
"vitest": "^4.1.11",
|
|
160
160
|
"ws": "^8.20.0",
|
|
161
161
|
"yjs": "13.6.30",
|
|
162
|
-
"@products/sandbox-test-utils": "0.0.0",
|
|
163
|
-
"@tangle-network/agent-profile-materialize": "0.26.0",
|
|
164
162
|
"@tangle-network/runtime-contracts": "0.19.0",
|
|
165
|
-
"@tangle-network/
|
|
166
|
-
"@tangle-network/cli-agent-registry": "0.10.2",
|
|
163
|
+
"@tangle-network/sse-core": "0.0.0",
|
|
167
164
|
"@repo/shared": "0.0.0",
|
|
168
|
-
"@tangle-network/
|
|
165
|
+
"@tangle-network/sdk": "4.0.16",
|
|
166
|
+
"@products/sandbox-test-utils": "0.0.0",
|
|
167
|
+
"@tangle-network/agent-profile-materialize": "0.26.0",
|
|
168
|
+
"@tangle-network/cli-agent-registry": "0.10.2"
|
|
169
169
|
},
|
|
170
170
|
"tangleRelease": {
|
|
171
|
-
"sourceSha": "
|
|
172
|
-
"mergedAt": "2026-10-
|
|
171
|
+
"sourceSha": "dbc59a1771e5ff3416f2df0feb47d31a86250768",
|
|
172
|
+
"mergedAt": "2026-10-23T09:00:47-06:00"
|
|
173
173
|
},
|
|
174
174
|
"scripts": {
|
|
175
175
|
"build": "node scripts/build-dist.mjs",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|