@tangle-network/agent-runtime 0.271.0 → 0.273.3
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-DGbFPGR3.js → activation-Cx2dKA_l.js} +2 -2
- package/dist/{activation-DGbFPGR3.js.map → activation-Cx2dKA_l.js.map} +1 -1
- package/dist/{activation-BrJmwTLB.d.ts → activation-IfDlhR3J.d.ts} +2 -2
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/candidate-execution/index.js +2 -2
- package/dist/{coordination-driver-iBGMKDvB.js → coordination-driver-CkcW4dxU.js} +155 -80
- package/dist/coordination-driver-CkcW4dxU.js.map +1 -0
- package/dist/{delegate-DOqUvaIz.js → delegate-Dvb1-mE-.js} +2 -2
- package/dist/{delegate-DOqUvaIz.js.map → delegate-Dvb1-mE-.js.map} +1 -1
- package/dist/durable.d.ts +3 -572
- package/dist/durable.js +92 -18
- package/dist/durable.js.map +1 -1
- package/dist/{graph-DnMcepkN.js → graph-C69Uxtzt.js} +14 -8
- package/dist/graph-C69Uxtzt.js.map +1 -0
- package/dist/{improvement-cycle-1IyRJo5h.js → improvement-cycle-CO2HRCQq.js} +4 -4
- package/dist/{improvement-cycle-1IyRJo5h.js.map → improvement-cycle-CO2HRCQq.js.map} +1 -1
- package/dist/{index-CL1dduJd.d.ts → index-D2ipSqkP.d.ts} +4318 -3102
- package/dist/index.d.ts +6 -450
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +3 -3
- package/dist/intelligence.js +5 -5
- package/dist/kernel.d.ts +4 -4
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-BPZ9tt1W.js → loop-runner-bin-B9MIq9O7.js} +3 -3
- package/dist/{loop-runner-bin-BPZ9tt1W.js.map → loop-runner-bin-B9MIq9O7.js.map} +1 -1
- package/dist/{loop-runner-bin-O_vM1w8Y.d.ts → loop-runner-bin-ThlwVkvo.d.ts} +3 -3
- 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 +5 -5
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-DWHxpwx2.d.ts → openai-tools-Bb0mAr5z.d.ts} +2 -2
- package/dist/{prepare-oHUQdC5-.js → prepare-DVlvGP7V.js} +2 -2
- package/dist/{prepare-oHUQdC5-.js.map → prepare-DVlvGP7V.js.map} +1 -1
- package/dist/profiles.d.ts +2 -2
- package/dist/{protected-model-port-DqF0qDU6.js → protected-model-port-BrWgsCnl.js} +2 -2
- package/dist/{protected-model-port-DqF0qDU6.js.map → protected-model-port-BrWgsCnl.js.map} +1 -1
- package/dist/{protected-redaction--F3v1oo8.js → protected-redaction-DylCC_ot.js} +14 -20
- package/dist/protected-redaction-DylCC_ot.js.map +1 -0
- package/dist/{provision-supervisor-Cy8pqE95.js → provision-supervisor-BKAvsDtP.js} +3 -3
- package/dist/{provision-supervisor-Cy8pqE95.js.map → provision-supervisor-BKAvsDtP.js.map} +1 -1
- package/dist/{runtime-DVjIH1eo.js → runtime-CHxXrUeZ.js} +2079 -1441
- package/dist/runtime-CHxXrUeZ.js.map +1 -0
- package/dist/{server-CN9vzbSe.js → server-2OeFrEVG.js} +3 -3
- package/dist/{server-CN9vzbSe.js.map → server-2OeFrEVG.js.map} +1 -1
- package/dist/{stream-agent-turn-DbEsKgb_.d.ts → stream-agent-turn-ewm3BZAp.d.ts} +15 -16
- package/dist/{structural-rollout-I92sIfNl.js → structural-rollout-DCUprNpH.js} +2 -2
- package/dist/{structural-rollout-I92sIfNl.js.map → structural-rollout-DCUprNpH.js.map} +1 -1
- package/dist/{substrate-CbC03Vzo.d.ts → substrate-VKjmrksz.d.ts} +2 -2
- package/dist/{supervise-DJ_1i9vj.js → supervise-Dej5aSDa.js} +211 -48
- package/dist/supervise-Dej5aSDa.js.map +1 -0
- package/dist/{supervisor-Cvd5mf7x.js → supervisor-DdKPGluv.js} +952 -221
- package/dist/supervisor-DdKPGluv.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +60 -60
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-Bo7z5aG5.d.ts → types-DMRc3jru.d.ts} +356 -64
- package/package.json +5 -5
- package/dist/coordination-driver-iBGMKDvB.js.map +0 -1
- package/dist/graph-DnMcepkN.js.map +0 -1
- package/dist/protected-redaction--F3v1oo8.js.map +0 -1
- package/dist/runtime-DVjIH1eo.js.map +0 -1
- package/dist/supervise-DJ_1i9vj.js.map +0 -1
- package/dist/supervisor-Cvd5mf7x.js.map +0 -1
package/dist/durable.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as RuntimeRunStateError,
|
|
1
|
+
import { $i as detachedSnapshot, Ai as readCommittedJsonLines, Di as isNoEntError, E as failedItems, Lt as FileSpawnJournal, Oa as zeroSpend, Oi as parseCommittedJsonLines, Pi as authoredProfileDigest, Wt as loadSpawnForest, ga as cloneSpend, ji as writeAllBytes, ki as prepareJsonlAppend, kr as contentAddress, ma as addSpend } from "./supervisor-DdKPGluv.js";
|
|
2
|
+
import { f as RuntimeRunStateError, m as ValidationError } from "./errors-DodWX-cb.js";
|
|
3
3
|
import { a as withPursuitContext, t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
|
|
4
4
|
import { a as writeAtomicDurableFile, r as publishExclusiveDurableFile } from "./durable-file-DWQA4ooo.js";
|
|
5
5
|
import { i as applyExactAgentProfileDiff } from "./profile-D3eXNBQV.js";
|
|
6
|
-
import { _ as readRootStream, g as ROOT_STREAM_FILE, i as superviseRootProfile, r as supervise, v as readRootStreamReceipt } from "./supervise-
|
|
6
|
+
import { _ as readRootStream, g as ROOT_STREAM_FILE, i as superviseRootProfile, r as supervise, v as readRootStreamReceipt } from "./supervise-Dej5aSDa.js";
|
|
7
7
|
import { h as supervisorRunDir } from "./run-layout-vwd4SwX_.js";
|
|
8
8
|
import { canonicalCandidateDigest, canonicalCandidateJson, sha256Bytes } from "@tangle-network/agent-interface";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
@@ -1279,11 +1279,9 @@ function assertPursuitVersions(versions) {
|
|
|
1279
1279
|
};
|
|
1280
1280
|
if (typeof versions !== "object" || versions === null) fail("must be an object");
|
|
1281
1281
|
const { judge, next, stop, run } = versions;
|
|
1282
|
-
if (typeof judge === "
|
|
1283
|
-
if (judge.trim().length === 0) fail("judge must name a registry entry");
|
|
1284
|
-
} else if (typeof judge !== "object" || judge === null || typeof judge.judge !== "function") fail("judge must be a VersionJudge or a registry name");
|
|
1282
|
+
if (typeof judge !== "object" || judge === null || typeof judge.judge !== "function") fail("judge must be a VersionJudge, such as declaredCheckJudge(check)");
|
|
1285
1283
|
else if (!isSha256(judge.digest)) fail("judge.digest must be a sha256 digest (sha256:<64 hex>)");
|
|
1286
|
-
if (
|
|
1284
|
+
if (next !== "review-of-best" && typeof next !== "function") fail("next must be a function or 'review-of-best'");
|
|
1287
1285
|
if (run !== void 0 && typeof run !== "function") fail("run must be a function when set");
|
|
1288
1286
|
const { usd } = versions;
|
|
1289
1287
|
if (usd !== void 0 && typeof usd !== "function") fail("usd must be a function when set");
|
|
@@ -1312,10 +1310,9 @@ async function runPursuitVersions(profile, task, opts, runOne) {
|
|
|
1312
1310
|
"rootHandle",
|
|
1313
1311
|
"steerDir"
|
|
1314
1312
|
]) if (rest[key] !== void 0) throw new ValidationError(`supervisePursuit versions: ${key} names one run, and a version chain has one per version; omit it`);
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
const next = resolveNamed("next", "nextVersions", versions.next, registry?.nextVersions);
|
|
1313
|
+
const judge = versions.judge;
|
|
1314
|
+
if (versions.next === "review-of-best" && rest.continuation?.profile.review === void 0) throw new ValidationError("supervisePursuit versions: next 'review-of-best' needs continuation.profile.review, the words the next version reads about its review");
|
|
1315
|
+
const next = versions.next === "review-of-best" ? reviewOfBest(rest.runId ?? "supervise", rest.continuation?.profile.review ?? "") : versions.next;
|
|
1319
1316
|
const stop = versions.stop;
|
|
1320
1317
|
const minImprovement = stop.minImprovement ?? 0;
|
|
1321
1318
|
const now = rest.now ?? Date.now;
|
|
@@ -1525,8 +1522,16 @@ async function runPursuitVersions(profile, task, opts, runOne) {
|
|
|
1525
1522
|
change: spec.change,
|
|
1526
1523
|
acceptUncertain: true
|
|
1527
1524
|
};
|
|
1525
|
+
const bar = base.continuation !== void 0 && parent.verdict.check !== void 0 ? { continuation: {
|
|
1526
|
+
...base.continuation,
|
|
1527
|
+
best: {
|
|
1528
|
+
label: `v${parent.version}`,
|
|
1529
|
+
verdict: parent.verdict.check
|
|
1530
|
+
}
|
|
1531
|
+
} } : {};
|
|
1528
1532
|
const options = {
|
|
1529
1533
|
...base,
|
|
1534
|
+
...bar,
|
|
1530
1535
|
runId: spec.runId,
|
|
1531
1536
|
runDir: spec.runDir,
|
|
1532
1537
|
fork,
|
|
@@ -1636,12 +1641,81 @@ function canonicalStop(stop) {
|
|
|
1636
1641
|
...stop.minImprovement === void 0 ? {} : { minImprovement: stop.minImprovement }
|
|
1637
1642
|
};
|
|
1638
1643
|
}
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1644
|
+
/** Where `'review-of-best'` mounts a review: `inputs/review/version-<n>.md`. One review lives in
|
|
1645
|
+
* a profile at a time. */
|
|
1646
|
+
const REVIEW_DIR = "inputs/review/";
|
|
1647
|
+
/**
|
|
1648
|
+
* `'review-of-best'`: fork from the best version with its check's verdict mounted under
|
|
1649
|
+
* {@link REVIEW_DIR} and the profile's review words as one instruction. The previous review's
|
|
1650
|
+
* mount and instruction are removed, so a profile carries one review. This is what the Lab's
|
|
1651
|
+
* `continue-best` changes did in Lab code, now written once from the check's own verdict.
|
|
1652
|
+
*/
|
|
1653
|
+
function reviewOfBest(runId, words) {
|
|
1654
|
+
return ({ best, versions }) => {
|
|
1655
|
+
const n = versions.length + 1;
|
|
1656
|
+
const verdict = best.verdict.check;
|
|
1657
|
+
const path = `${REVIEW_DIR}version-${best.version}.md`;
|
|
1658
|
+
const instruction = words.replaceAll("{version}", String(best.version)).replaceAll("{path}", path).replaceAll("{score}", best.verdict.score === null ? "none" : String(best.verdict.score)).trim();
|
|
1659
|
+
const page = reviewPage(best.version, best.verdict.score, verdict);
|
|
1660
|
+
const earlierInstructions = best.change?.set?.prompt?.instructions ?? [];
|
|
1661
|
+
const earlierMounts = (best.profile.resources?.files ?? []).map((file) => file.path).filter((mounted) => mounted.startsWith("inputs/review/") && mounted !== path);
|
|
1662
|
+
return {
|
|
1663
|
+
kind: "agent-profile-diff",
|
|
1664
|
+
id: `${runId}-v${n}-review-of-v${best.version}`,
|
|
1665
|
+
title: `Version ${n}: review of version ${best.version}`,
|
|
1666
|
+
source: {
|
|
1667
|
+
kind: "optimizer",
|
|
1668
|
+
notes: [`review-of-best: version ${best.version}`, `judge ${best.verdict.judgeDigest}`]
|
|
1669
|
+
},
|
|
1670
|
+
set: {
|
|
1671
|
+
prompt: { instructions: [instruction] },
|
|
1672
|
+
resources: { files: [{
|
|
1673
|
+
path,
|
|
1674
|
+
resource: {
|
|
1675
|
+
kind: "inline",
|
|
1676
|
+
name: path,
|
|
1677
|
+
content: page
|
|
1678
|
+
}
|
|
1679
|
+
}] }
|
|
1680
|
+
},
|
|
1681
|
+
...earlierInstructions.length > 0 || earlierMounts.length > 0 ? { remove: {
|
|
1682
|
+
...earlierInstructions.length > 0 ? { prompt: { instructions: [...earlierInstructions] } } : {},
|
|
1683
|
+
...earlierMounts.length > 0 ? { resources: { files: earlierMounts } } : {}
|
|
1684
|
+
} } : {}
|
|
1685
|
+
};
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
/** The review page: facts only, in the check's own lines. */
|
|
1689
|
+
function reviewPage(version, score, verdict) {
|
|
1690
|
+
if (verdict === void 0) return [
|
|
1691
|
+
`# Version ${version}`,
|
|
1692
|
+
"",
|
|
1693
|
+
`Score: ${score ?? "none"}. The judge reported no per-item verdict.`,
|
|
1694
|
+
""
|
|
1695
|
+
].join("\n");
|
|
1696
|
+
const failing = failedItems(verdict);
|
|
1697
|
+
return [
|
|
1698
|
+
`# Version ${version}`,
|
|
1699
|
+
"",
|
|
1700
|
+
`Score: ${score ?? "none"}.${verdict.threshold === void 0 ? "" : ` The check passes at ${verdict.threshold}.`}`,
|
|
1701
|
+
"",
|
|
1702
|
+
"## Items",
|
|
1703
|
+
"",
|
|
1704
|
+
...Object.entries(verdict.items ?? {}).map(([item, value]) => `- ${item}: ${value >= 1 ? "passes" : `fails (${value})`}`),
|
|
1705
|
+
"",
|
|
1706
|
+
...failing.length === 0 ? [] : [
|
|
1707
|
+
"## Failures",
|
|
1708
|
+
"",
|
|
1709
|
+
...verdict.failures ?? [],
|
|
1710
|
+
""
|
|
1711
|
+
],
|
|
1712
|
+
...verdict.review === void 0 ? [] : [
|
|
1713
|
+
"## The check's review",
|
|
1714
|
+
"",
|
|
1715
|
+
verdict.review,
|
|
1716
|
+
""
|
|
1717
|
+
]
|
|
1718
|
+
].join("\n");
|
|
1645
1719
|
}
|
|
1646
1720
|
async function readLedger(path) {
|
|
1647
1721
|
let text;
|
|
@@ -1872,6 +1946,6 @@ function compareText(left, right) {
|
|
|
1872
1946
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
1873
1947
|
}
|
|
1874
1948
|
//#endregion
|
|
1875
|
-
export { FAILURE_RECORD_FILE, FORK_PARENT_UNCERTAIN_NODES_KEY, FileObserverJournal, PURSUIT_VERSIONS_FILE, ROOT_STREAM_FILE, RUN_DIRECTORY_LOCK_FILE, RUN_FORK_CORRELATION_KEYS, RunDirectoryLockedError, SETTLE_RECORD_FILE, SettledRunDirectoryError, SupervisePursuitError, acquireRunDirectoryLock, assertPursuitVersions, createFileObserverHooks, deriveExecutionId, discoverDurableSupervisionRun, handleChatTurn, observerRecordDigest, projectPursuit, pursuitVersionRun, readFailureRecord, readRootStream, readRootStreamReceipt, readRunDirectoryLock, readSettleRecord, runDirectoryHolderIsLive, settleRecordJson, supervisePursuit, verifyObserverRecords };
|
|
1949
|
+
export { FAILURE_RECORD_FILE, FORK_PARENT_UNCERTAIN_NODES_KEY, FileObserverJournal, PURSUIT_VERSIONS_FILE, REVIEW_DIR, ROOT_STREAM_FILE, RUN_DIRECTORY_LOCK_FILE, RUN_FORK_CORRELATION_KEYS, RunDirectoryLockedError, SETTLE_RECORD_FILE, SettledRunDirectoryError, SupervisePursuitError, acquireRunDirectoryLock, assertPursuitVersions, createFileObserverHooks, deriveExecutionId, discoverDurableSupervisionRun, handleChatTurn, observerRecordDigest, projectPursuit, pursuitVersionRun, readFailureRecord, readRootStream, readRootStreamReceipt, readRunDirectoryLock, readSettleRecord, runDirectoryHolderIsLive, settleRecordJson, supervisePursuit, verifyObserverRecords };
|
|
1876
1950
|
|
|
1877
1951
|
//# sourceMappingURL=durable.js.map
|