@tangle-network/agent-runtime 0.340.0 → 0.342.0
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/{activation-D2PVljaw.js → activation-CWPmt0Do.js} +4 -4
- package/dist/{activation-D2PVljaw.js.map → activation-CWPmt0Do.js.map} +1 -1
- package/dist/{activation-DGDl4wwI.d.ts → activation-CXqtijue.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{bundle-DNUq-OPW.js → bundle-Cwpit6Tg.js} +2 -2
- package/dist/{bundle-DNUq-OPW.js.map → bundle-Cwpit6Tg.js.map} +1 -1
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{driver-control-acknowledgers-MTrs8HAF.js → coordination-manager-B5JsolDR.js} +4852 -4539
- package/dist/coordination-manager-B5JsolDR.js.map +1 -0
- package/dist/{delegate-CtJIS-tp.js → delegate-Rl-5paLJ.js} +2 -2
- package/dist/{delegate-CtJIS-tp.js.map → delegate-Rl-5paLJ.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +451 -358
- package/dist/durable.js.map +1 -1
- package/dist/{graph-DfWqp_1e.js → graph-Ce-59ZXn.js} +5 -5
- package/dist/{graph-DfWqp_1e.js.map → graph-Ce-59ZXn.js.map} +1 -1
- package/dist/{improve-CKRVQqzt.js → improve-BZXt2qM0.js} +837 -704
- package/dist/improve-BZXt2qM0.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +205 -191
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-DNWbTcVm.js → loop-runner-B0MV1-CD.js} +2 -2
- package/dist/{loop-runner-DNWbTcVm.js.map → loop-runner-B0MV1-CD.js.map} +1 -1
- package/dist/{loop-runner-C4EWEcXf.d.ts → loop-runner-CuhbgVGo.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +5 -5
- package/dist/{prepare-FzJoS68l.js → prepare-C-cWCyt3.js} +988 -735
- package/dist/prepare-C-cWCyt3.js.map +1 -0
- package/dist/{profile-DToH0XEs.js → profile-CbMw5hAn.js} +2 -2
- package/dist/{profile-DToH0XEs.js.map → profile-CbMw5hAn.js.map} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-DqvWXmAE.js → provision-supervisor-DL6gEMQp.js} +444 -419
- package/dist/provision-supervisor-DL6gEMQp.js.map +1 -0
- package/dist/{runtime-C55Zgo1R.js → runtime-eghmj6W4.js} +1245 -1028
- package/dist/runtime-eghmj6W4.js.map +1 -0
- package/dist/{sandbox-profile-compat-DRr3JwDx.js → sandbox-profile-compat-FN2kab2-.js} +72 -72
- package/dist/{sandbox-profile-compat-DRr3JwDx.js.map → sandbox-profile-compat-FN2kab2-.js.map} +1 -1
- package/dist/{search-executor-ChOlRBgg.js → search-executor-rbjdZ3OD.js} +3 -3
- package/dist/{search-executor-ChOlRBgg.js.map → search-executor-rbjdZ3OD.js.map} +1 -1
- package/dist/{server-DkVBSN_S.js → server-BiK1Kcno.js} +4 -4
- package/dist/{server-DkVBSN_S.js.map → server-BiK1Kcno.js.map} +1 -1
- package/dist/{structural-rollout-C1LEk_zq.js → structural-rollout-BD9IN7K_.js} +3 -3
- package/dist/{structural-rollout-C1LEk_zq.js.map → structural-rollout-BD9IN7K_.js.map} +1 -1
- package/dist/{supervise-CaUAxZZP.js → supervise-DmOi7gll.js} +6346 -5447
- package/dist/supervise-DmOi7gll.js.map +1 -0
- package/dist/{supervisor-VXuN2OHT.js → supervisor-DUWcecAd.js} +13822 -12826
- package/dist/supervisor-DUWcecAd.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +13 -13
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-DZ6L0Bv3.d.ts → types-Cgs89PQd.d.ts} +266 -356
- package/dist/workspace-store/index.js +273 -265
- package/dist/workspace-store/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/driver-control-acknowledgers-MTrs8HAF.js.map +0 -1
- package/dist/improve-CKRVQqzt.js.map +0 -1
- package/dist/prepare-FzJoS68l.js.map +0 -1
- package/dist/provision-supervisor-DqvWXmAE.js.map +0 -1
- package/dist/runtime-C55Zgo1R.js.map +0 -1
- package/dist/supervise-CaUAxZZP.js.map +0 -1
- package/dist/supervisor-VXuN2OHT.js.map +0 -1
|
@@ -9,9 +9,9 @@ import { spawn } from "node:child_process";
|
|
|
9
9
|
import { lstat, mkdir, mkdtemp, open, readFile, readdir, readlink, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
10
10
|
import { homedir, tmpdir } from "node:os";
|
|
11
11
|
import { Readable } from "node:stream";
|
|
12
|
-
import { pipeline } from "node:stream/promises";
|
|
13
|
-
import { extract, pack } from "tar-stream";
|
|
14
12
|
import { isAnyArrayBuffer, isSharedArrayBuffer } from "node:util/types";
|
|
13
|
+
import { extract, pack } from "tar-stream";
|
|
14
|
+
import { pipeline } from "node:stream/promises";
|
|
15
15
|
//#region src/runtime/supervise/deadline.ts
|
|
16
16
|
const MAX_TIMER_DELAY_MS = 2147483647;
|
|
17
17
|
const DEFAULT_SUCCESSFUL_SHUTDOWN_MS = 5e3;
|
|
@@ -694,74 +694,6 @@ function deepFreezeCandidate(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
694
694
|
return Object.freeze(value);
|
|
695
695
|
}
|
|
696
696
|
//#endregion
|
|
697
|
-
//#region src/candidate-execution/artifact-streams.ts
|
|
698
|
-
/** Verify the complete stream, including its final digest, before accepting its consumer's result. */
|
|
699
|
-
async function* verifiedArtifactChunks(artifact, port, signal) {
|
|
700
|
-
signal?.throwIfAborted();
|
|
701
|
-
if (!("content" in artifact) && !port.readStream) throw new Error("streaming workspace artifacts require readStream");
|
|
702
|
-
const chunks = "content" in artifact ? [Buffer.from(artifact.content, "base64")] : port.readStream(artifact, { signal });
|
|
703
|
-
const hash = createHash("sha256");
|
|
704
|
-
let byteLength = 0;
|
|
705
|
-
for await (const chunk of chunks) {
|
|
706
|
-
signal?.throwIfAborted();
|
|
707
|
-
if (!(chunk instanceof Uint8Array)) throw new Error("candidate artifact emitted a non-byte chunk");
|
|
708
|
-
byteLength += chunk.byteLength;
|
|
709
|
-
if (byteLength > artifact.byteLength) throw new Error("candidate artifact exceeds its declared length");
|
|
710
|
-
hash.update(chunk);
|
|
711
|
-
yield chunk;
|
|
712
|
-
}
|
|
713
|
-
signal?.throwIfAborted();
|
|
714
|
-
if (byteLength !== artifact.byteLength || `sha256:${hash.digest("hex")}` !== artifact.sha256) throw new Error("candidate artifact failed digest or length verification");
|
|
715
|
-
}
|
|
716
|
-
const selfVerifyingPuts = /* @__PURE__ */ new WeakMap();
|
|
717
|
-
/**
|
|
718
|
-
* Declare that this exact putStream resolves only after reading its stored object back from where
|
|
719
|
-
* this exact readStream reads it, and matching its digest and length. The claim belongs to the
|
|
720
|
-
* pair, so a wrapper that replaces either function never inherits it.
|
|
721
|
-
*/
|
|
722
|
-
function markPutStreamVerified(putStream, readStream) {
|
|
723
|
-
selfVerifyingPuts.set(putStream, readStream);
|
|
724
|
-
}
|
|
725
|
-
/** Whether a port's putStream already read back what its readStream will return. */
|
|
726
|
-
function putStreamVerifiedBy(port) {
|
|
727
|
-
return port.putStream !== void 0 && port.readStream !== void 0 && selfVerifyingPuts.get(port.putStream) === port.readStream;
|
|
728
|
-
}
|
|
729
|
-
/** Stream evaluator evidence into its existing store and verify durable readback before returning. */
|
|
730
|
-
async function persistCandidateOutputArtifactStream(port, input) {
|
|
731
|
-
if (!port.putStream || !port.readStream) throw new Error("streaming workspace persistence requires putStream and readStream");
|
|
732
|
-
input.signal?.throwIfAborted();
|
|
733
|
-
const hash = createHash("sha256");
|
|
734
|
-
let byteLength = 0;
|
|
735
|
-
let consumed = false;
|
|
736
|
-
async function* checked() {
|
|
737
|
-
for await (const chunk of input.chunks) {
|
|
738
|
-
input.signal?.throwIfAborted();
|
|
739
|
-
if (!(chunk instanceof Uint8Array)) throw new Error("candidate artifact emitted a non-byte chunk");
|
|
740
|
-
byteLength += chunk.byteLength;
|
|
741
|
-
if (byteLength > input.maxBytes) throw new Error("candidate workspace archive exceeds maxArchiveBytes");
|
|
742
|
-
hash.update(chunk);
|
|
743
|
-
yield chunk;
|
|
744
|
-
}
|
|
745
|
-
consumed = true;
|
|
746
|
-
input.signal?.throwIfAborted();
|
|
747
|
-
}
|
|
748
|
-
const chunks = checked();
|
|
749
|
-
try {
|
|
750
|
-
const ref = agentCandidateArtifactRefSchema.parse(await port.putStream({
|
|
751
|
-
executionId: input.executionId,
|
|
752
|
-
purpose: input.purpose,
|
|
753
|
-
chunks,
|
|
754
|
-
...input.signal ? { signal: input.signal } : {}
|
|
755
|
-
}));
|
|
756
|
-
input.signal?.throwIfAborted();
|
|
757
|
-
if (!consumed || ref.sha256 !== `sha256:${hash.digest("hex")}` || ref.byteLength !== byteLength) throw new Error("candidate output locator does not identify the submitted bytes");
|
|
758
|
-
if (!putStreamVerifiedBy(port)) for await (const _chunk of verifiedArtifactChunks(ref, port, input.signal));
|
|
759
|
-
return immutableCandidateValue(ref);
|
|
760
|
-
} finally {
|
|
761
|
-
await chunks.return(void 0);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
//#endregion
|
|
765
697
|
//#region src/candidate-execution/artifacts.ts
|
|
766
698
|
function artifactCacheKey(artifact) {
|
|
767
699
|
return `${artifact.sha256}:${artifact.byteLength}`;
|
|
@@ -1483,6 +1415,74 @@ function workspaceTarHeader(name, mode, size) {
|
|
|
1483
1415
|
};
|
|
1484
1416
|
}
|
|
1485
1417
|
//#endregion
|
|
1418
|
+
//#region src/candidate-execution/artifact-streams.ts
|
|
1419
|
+
/** Verify the complete stream, including its final digest, before accepting its consumer's result. */
|
|
1420
|
+
async function* verifiedArtifactChunks(artifact, port, signal) {
|
|
1421
|
+
signal?.throwIfAborted();
|
|
1422
|
+
if (!("content" in artifact) && !port.readStream) throw new Error("streaming workspace artifacts require readStream");
|
|
1423
|
+
const chunks = "content" in artifact ? [Buffer.from(artifact.content, "base64")] : port.readStream(artifact, { signal });
|
|
1424
|
+
const hash = createHash("sha256");
|
|
1425
|
+
let byteLength = 0;
|
|
1426
|
+
for await (const chunk of chunks) {
|
|
1427
|
+
signal?.throwIfAborted();
|
|
1428
|
+
if (!(chunk instanceof Uint8Array)) throw new Error("candidate artifact emitted a non-byte chunk");
|
|
1429
|
+
byteLength += chunk.byteLength;
|
|
1430
|
+
if (byteLength > artifact.byteLength) throw new Error("candidate artifact exceeds its declared length");
|
|
1431
|
+
hash.update(chunk);
|
|
1432
|
+
yield chunk;
|
|
1433
|
+
}
|
|
1434
|
+
signal?.throwIfAborted();
|
|
1435
|
+
if (byteLength !== artifact.byteLength || `sha256:${hash.digest("hex")}` !== artifact.sha256) throw new Error("candidate artifact failed digest or length verification");
|
|
1436
|
+
}
|
|
1437
|
+
const selfVerifyingPuts = /* @__PURE__ */ new WeakMap();
|
|
1438
|
+
/**
|
|
1439
|
+
* Declare that this exact putStream resolves only after reading its stored object back from where
|
|
1440
|
+
* this exact readStream reads it, and matching its digest and length. The claim belongs to the
|
|
1441
|
+
* pair, so a wrapper that replaces either function never inherits it.
|
|
1442
|
+
*/
|
|
1443
|
+
function markPutStreamVerified(putStream, readStream) {
|
|
1444
|
+
selfVerifyingPuts.set(putStream, readStream);
|
|
1445
|
+
}
|
|
1446
|
+
/** Whether a port's putStream already read back what its readStream will return. */
|
|
1447
|
+
function putStreamVerifiedBy(port) {
|
|
1448
|
+
return port.putStream !== void 0 && port.readStream !== void 0 && selfVerifyingPuts.get(port.putStream) === port.readStream;
|
|
1449
|
+
}
|
|
1450
|
+
/** Stream evaluator evidence into its existing store and verify durable readback before returning. */
|
|
1451
|
+
async function persistCandidateOutputArtifactStream(port, input) {
|
|
1452
|
+
if (!port.putStream || !port.readStream) throw new Error("streaming workspace persistence requires putStream and readStream");
|
|
1453
|
+
input.signal?.throwIfAborted();
|
|
1454
|
+
const hash = createHash("sha256");
|
|
1455
|
+
let byteLength = 0;
|
|
1456
|
+
let consumed = false;
|
|
1457
|
+
async function* checked() {
|
|
1458
|
+
for await (const chunk of input.chunks) {
|
|
1459
|
+
input.signal?.throwIfAborted();
|
|
1460
|
+
if (!(chunk instanceof Uint8Array)) throw new Error("candidate artifact emitted a non-byte chunk");
|
|
1461
|
+
byteLength += chunk.byteLength;
|
|
1462
|
+
if (byteLength > input.maxBytes) throw new Error("candidate workspace archive exceeds maxArchiveBytes");
|
|
1463
|
+
hash.update(chunk);
|
|
1464
|
+
yield chunk;
|
|
1465
|
+
}
|
|
1466
|
+
consumed = true;
|
|
1467
|
+
input.signal?.throwIfAborted();
|
|
1468
|
+
}
|
|
1469
|
+
const chunks = checked();
|
|
1470
|
+
try {
|
|
1471
|
+
const ref = agentCandidateArtifactRefSchema.parse(await port.putStream({
|
|
1472
|
+
executionId: input.executionId,
|
|
1473
|
+
purpose: input.purpose,
|
|
1474
|
+
chunks,
|
|
1475
|
+
...input.signal ? { signal: input.signal } : {}
|
|
1476
|
+
}));
|
|
1477
|
+
input.signal?.throwIfAborted();
|
|
1478
|
+
if (!consumed || ref.sha256 !== `sha256:${hash.digest("hex")}` || ref.byteLength !== byteLength) throw new Error("candidate output locator does not identify the submitted bytes");
|
|
1479
|
+
if (!putStreamVerifiedBy(port)) for await (const _chunk of verifiedArtifactChunks(ref, port, input.signal));
|
|
1480
|
+
return immutableCandidateValue(ref);
|
|
1481
|
+
} finally {
|
|
1482
|
+
await chunks.return(void 0);
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
//#endregion
|
|
1486
1486
|
//#region src/candidate-execution/git-materialize.ts
|
|
1487
1487
|
async function verifyCandidateCode(code, repositories, patchBytes) {
|
|
1488
1488
|
if (code.kind === "disabled") return void 0;
|
|
@@ -2528,6 +2528,6 @@ function refuseSandboxProfileField(field, context = "candidate profile") {
|
|
|
2528
2528
|
throw new ValidationError(`${context} field ${field} is refused: Sandbox's Interface 4.0.0 cannot carry it yet, and Runtime does not drop it`);
|
|
2529
2529
|
}
|
|
2530
2530
|
//#endregion
|
|
2531
|
-
export { isAbortError as $,
|
|
2531
|
+
export { isAbortError as $, verifyMaterializedProfileWorkspace as A, sha256Bytes$1 as B, WorkspaceScanLimitError as C, armDeadlineTimer as Ct, readMaterializedWorkspaceFiles as D, singleFlightTeardown as Dt, captureMaterializedWorkspace as E, isDeadlineAbortReason as Et, canonicalCandidateDocument as F, addTokenUsage as G, hasControlCharacter as H, deepFreezeCandidate as I, cloneTokenUsage as J, chargedTokens as K, embeddedCandidateArtifact as L, verifyWorkspaceSnapshotArtifacts as M, canonicalCandidateBytes$1 as N, readVerifiedArtifact as O, teardownExecutor as Ot, canonicalCandidateDigest$1 as P, hasCompleteCacheBreakdown as Q, immutableCandidateValue as R, isWellFormedUnicode as S, ROOT_DEADLINE_REASON as St, candidateWorkspaceManifest as T, checkInIdleMs as Tt, abortError as U, verifyCanonicalCandidateDocument as V, addSpend as W, errorMessage as X, deleteBoxSafe as Y, fnv1a32Hex as Z, captureAgentCandidateWorkspaceFiles as _, withBudgetResources as _t, materializeAgentCandidateWorkspaceFromArtifacts as a, roundBoxMinutes as at, persistCandidateOutputArtifact as b, DEADLINE_CHECK_IN_MESSAGE as bt, verifyAgentCandidateWorkspaceTree as c, throwAbort as ct, readCandidateGitHubResource as d, withTimeout as dt, isAsyncIterable as et, verifyCandidateCode as f, zeroSpend as ft, verifiedArtifactChunks as g, resourceTelemetry as gt, markPutStreamVerified as h, assertResources as ht, captureAgentCandidateWorkspaceTreeToArtifacts as i, randomUuid as it, verifyMaterializedWorkspace as j, verifyBytes as k, teardownSurfaces as kt, captureAgentCandidateWorkspace as l, throwIfAborted as lt, verifyTaskOutcomePatch as m, addResourceSpend as mt, refuseSandboxProfileField as n, promptCacheTokenClasses as nt, readAgentCandidateWorkspaceArtifactFiles as o, sleep as ot, verifyTaskCheckout as p, zeroTokenUsage as pt, cloneSpend as q, captureAgentCandidateWorkspaceToArtifacts as r, randomSuffix as rt, verifyAgentCandidateWorkspaceArtifacts as s, stringifySafe as st, assertSandboxProfileCompatibility as t, mapWithConcurrency as tt, createAgentCandidateWorkspacePort as u, unmeteredSpend as ut, verifyAgentCandidateWorkspaceArchive as v, ACCEPTED_RESULT_GRACE_MS as vt, artifactCacheKey as w, boundedChildDeadlineAt as wt, assertExactObjectKeys as x, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as xt, workspaceLimits as y, CHILD_DEADLINE_REASON as yt, omitTopLevelDigest as z };
|
|
2532
2532
|
|
|
2533
|
-
//# sourceMappingURL=sandbox-profile-compat-
|
|
2533
|
+
//# sourceMappingURL=sandbox-profile-compat-FN2kab2-.js.map
|