@tangle-network/agent-runtime 7.0.0 → 8.0.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/CHANGELOG.md +68 -0
- package/README.md +0 -3
- package/dist/{activation-Ba9IAgQ3.js → activation-Ce4zUcu8.js} +4 -4
- package/dist/{activation-Ba9IAgQ3.js.map → activation-Ce4zUcu8.js.map} +1 -1
- package/dist/{activation-DIkTEBWF.d.ts → activation-xxvLF1-1.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/{bundle-Cy5igJdv.js → bundle-CcpL2lfr.js} +2 -2
- package/dist/{bundle-Cy5igJdv.js.map → bundle-CcpL2lfr.js.map} +1 -1
- package/dist/candidate-execution/index.js +4 -4
- package/dist/continuation-CIyKnS1Q.js +451 -0
- package/dist/continuation-CIyKnS1Q.js.map +1 -0
- package/dist/{coordination-manager-DQZ2u6L-.js → coordination-manager-sa_PkISw.js} +194 -148
- package/dist/coordination-manager-sa_PkISw.js.map +1 -0
- package/dist/{coordination-map-routing-CKRNZSaV.js → coordination-map-routing-XZXTlCmn.js} +2 -4
- package/dist/coordination-map-routing-XZXTlCmn.js.map +1 -0
- package/dist/{delegate-DFLSVjFG.js → delegate-DhTkJIta.js} +3 -3
- package/dist/{delegate-DFLSVjFG.js.map → delegate-DhTkJIta.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +13 -12
- package/dist/durable.js.map +1 -1
- package/dist/{errors-AzSuGI23.js → errors-DG8yufqX.js} +8 -1
- package/dist/errors-DG8yufqX.js.map +1 -0
- package/dist/{failure-cause-rJTm_Tx8.js → failure-cause-CVB-YE88.js} +12 -8
- package/dist/{failure-cause-rJTm_Tx8.js.map → failure-cause-CVB-YE88.js.map} +1 -1
- package/dist/{graph-registry-7X2nrreR.js → graph-registry-czAwYwNj.js} +133 -9
- package/dist/graph-registry-czAwYwNj.js.map +1 -0
- package/dist/{graph-registry-gYbq4L5Z.js → graph-registry-uTIyyy7A.js} +1 -1
- package/dist/graph-tSIT_eWK.js +1793 -0
- package/dist/graph-tSIT_eWK.js.map +1 -0
- package/dist/{improve-BolbYegO.js → improve-H08hiIw9.js} +19 -48
- package/dist/improve-H08hiIw9.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -16
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +8 -8
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +16 -15
- package/dist/{loop-runner-Cs9IJ6Nk.d.ts → loop-runner-BGwhcn1p.d.ts} +2 -2
- package/dist/{loop-runner-C9W3T_3T.js → loop-runner-ChqK8kSz.js} +3 -3
- package/dist/{loop-runner-C9W3T_3T.js.map → loop-runner-ChqK8kSz.js.map} +1 -1
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +7 -5
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +9 -9
- package/dist/mcp/memory-bin.js +2 -2
- package/dist/{model-policy-JOcg3NRs.js → model-policy-yxOrDTTj.js} +9 -9
- package/dist/model-policy-yxOrDTTj.js.map +1 -0
- package/dist/{prepare-Dtfk_Wi_.js → prepare-BnF8nGIg.js} +4 -4
- package/dist/{prepare-Dtfk_Wi_.js.map → prepare-BnF8nGIg.js.map} +1 -1
- package/dist/{profile-CNSQjOes.js → profile-CD25rTJF.js} +4 -4
- package/dist/{profile-CNSQjOes.js.map → profile-CD25rTJF.js.map} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js +2 -2
- package/dist/{provision-supervisor-BQFHjCtN.js → provision-supervisor-Dx4TXTMM.js} +8 -8
- package/dist/{provision-supervisor-BQFHjCtN.js.map → provision-supervisor-Dx4TXTMM.js.map} +1 -1
- package/dist/{run-cancellation-B84X8ZAP.js → run-cancellation-DYszFJtQ.js} +4 -4
- package/dist/{run-cancellation-B84X8ZAP.js.map → run-cancellation-DYszFJtQ.js.map} +1 -1
- package/dist/{run-state-Dh1bGERI.js → run-state-DHBoJjaF.js} +5 -5
- package/dist/{run-state-Dh1bGERI.js.map → run-state-DHBoJjaF.js.map} +1 -1
- package/dist/{runtime-C9F1PG2A.js → runtime-CaM5Gbbv.js} +76 -987
- package/dist/runtime-CaM5Gbbv.js.map +1 -0
- package/dist/{sandbox-profile-compat-oFGWESLn.js → sandbox-profile-compat-l-SLQnGb.js} +2 -2
- package/dist/{sandbox-profile-compat-oFGWESLn.js.map → sandbox-profile-compat-l-SLQnGb.js.map} +1 -1
- package/dist/{search-executor-CKR9_6NR.js → search-executor-B9L8W_1O.js} +17 -46
- package/dist/search-executor-B9L8W_1O.js.map +1 -0
- package/dist/{server-Dh3SQGQT.js → server-BlDV8sj_.js} +32 -8
- package/dist/{server-Dh3SQGQT.js.map → server-BlDV8sj_.js.map} +1 -1
- package/dist/{settle-record-C6LdVvok.js → settle-record-WWQasnDq.js} +2 -2
- package/dist/{settle-record-C6LdVvok.js.map → settle-record-WWQasnDq.js.map} +1 -1
- package/dist/{snapshot-Cgj2Wzi6.js → snapshot-BKI_w3JD.js} +19 -5
- package/dist/snapshot-BKI_w3JD.js.map +1 -0
- package/dist/{structural-rollout-Dapf2aZY.js → structural-rollout-C1xxoWcN.js} +18 -54
- package/dist/structural-rollout-C1xxoWcN.js.map +1 -0
- package/dist/{supervise-xwl2D6q3.js → supervise-DWiSgPLB.js} +101 -111
- package/dist/supervise-DWiSgPLB.js.map +1 -0
- package/dist/{supervision-discovery-B47U8TH5.js → supervision-discovery-C9kfBLKy.js} +4 -4
- package/dist/{supervision-discovery-B47U8TH5.js.map → supervision-discovery-C9kfBLKy.js.map} +1 -1
- package/dist/{supervisor-gC-u_PRk.js → supervisor-Dpeu7rnZ.js} +206 -693
- package/dist/supervisor-Dpeu7rnZ.js.map +1 -0
- package/dist/{supervisor-accounting-DxLQ_TQe.js → supervisor-accounting-Bw4MJk-b.js} +434 -423
- package/dist/supervisor-accounting-Bw4MJk-b.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +13 -13
- package/dist/{tool-server-Dg350Bgz.js → tool-server-DYwRbi0I.js} +3 -3
- package/dist/{tool-server-Dg350Bgz.js.map → tool-server-DYwRbi0I.js.map} +1 -1
- package/dist/{top-web-BJLnFQdr.js → top-web-B3HOAtrZ.js} +9 -7
- package/dist/{top-web-BJLnFQdr.js.map → top-web-B3HOAtrZ.js.map} +1 -1
- package/dist/tui/bin.js +3 -3
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/{types-Jg274chm.d.ts → types-C_qbnw9N.d.ts} +1335 -1413
- package/dist/{util-C_cdPNC4.js → util-fcckrkKp.js} +39 -113
- package/dist/util-fcckrkKp.js.map +1 -0
- package/dist/{workspace-streams-B7yNMahl.js → workspace-streams-DA9R3j-p.js} +2 -2
- package/dist/{workspace-streams-B7yNMahl.js.map → workspace-streams-DA9R3j-p.js.map} +1 -1
- package/package.json +1 -1
- package/dist/coordination-manager-DQZ2u6L-.js.map +0 -1
- package/dist/coordination-map-routing-CKRNZSaV.js.map +0 -1
- package/dist/errors-AzSuGI23.js.map +0 -1
- package/dist/graph-BjQF2syl.js +0 -579
- package/dist/graph-BjQF2syl.js.map +0 -1
- package/dist/graph-registry-7X2nrreR.js.map +0 -1
- package/dist/improve-BolbYegO.js.map +0 -1
- package/dist/model-policy-JOcg3NRs.js.map +0 -1
- package/dist/runtime-C9F1PG2A.js.map +0 -1
- package/dist/search-executor-CKR9_6NR.js.map +0 -1
- package/dist/snapshot-Cgj2Wzi6.js.map +0 -1
- package/dist/structural-rollout-Dapf2aZY.js.map +0 -1
- package/dist/supervise-xwl2D6q3.js.map +0 -1
- package/dist/supervisor-accounting-DxLQ_TQe.js.map +0 -1
- package/dist/supervisor-gC-u_PRk.js.map +0 -1
- package/dist/util-C_cdPNC4.js.map +0 -1
package/dist/agent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DS as AgentRunSpec, QS as SandboxClient, S as RuntimeStreamEvent, XS as OutputAdapter } from "./types-C_qbnw9N.js";
|
|
2
2
|
import { a as ProfileMaterializationContract, c as assertProfileMaterializes, n as AssertProfileMaterializationOptions, o as ProfileMaterializationIssue, r as DefineProfileMaterializationContractOptions, s as ValidateProfileMaterializationOptions, t as AgentProfileMaterializationAxis } from "./profile-materialization-BRY22Oh8.js";
|
|
3
3
|
import { a as createSurfaceImprovementProposer, c as SurfaceValidationIssue, i as SurfaceImprovementEdit, l as renderSurfaceIssues, n as DraftPatchInput, o as AgentSurfaces, r as DraftPatchOutput, s as ResolvedSurface, t as CreateSurfaceImprovementProposerOptions, u as validateSurfaces } from "./improvement-adapter-D5GRU1eY.js";
|
|
4
4
|
import { AgentProfile, AgentProfileFileMount, AgentProfileMcpServer } from "@tangle-network/agent-interface";
|
package/dist/agent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as createSandboxForSpec,
|
|
1
|
+
import { rt as mapSandboxEvent } from "./failure-cause-CVB-YE88.js";
|
|
2
|
+
import { A as createSandboxForSpec, Rt as assertProfileMaterialization, qt as sandboxActProfileMaterialization, zt as assertProfileMaterializes } from "./supervisor-Dpeu7rnZ.js";
|
|
3
3
|
import { l as sha256 } from "./jsonl-file-DsxVI0E_.js";
|
|
4
|
-
import "./runtime-
|
|
4
|
+
import "./runtime-CaM5Gbbv.js";
|
|
5
5
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
6
6
|
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
7
7
|
import { parseFindingSubject } from "@tangle-network/agent-eval/analyst";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as immutableCandidateValue, N as canonicalCandidateDigest$1, R as omitTopLevelDigest } from "./workspace-streams-
|
|
1
|
+
import { L as immutableCandidateValue, N as canonicalCandidateDigest$1, R as omitTopLevelDigest } from "./workspace-streams-DA9R3j-p.js";
|
|
2
2
|
import { agentCandidateBundleSchema } from "@tangle-network/agent-interface";
|
|
3
3
|
// src/candidate-execution/bundle.ts
|
|
4
4
|
/** Validate and content-address a candidate bundle before it crosses an approval boundary. */
|
|
@@ -13,4 +13,4 @@ function sealAgentCandidateBundle(input) {
|
|
|
13
13
|
}
|
|
14
14
|
export { sealAgentCandidateBundle as t };
|
|
15
15
|
|
|
16
|
-
//# sourceMappingURL=bundle-
|
|
16
|
+
//# sourceMappingURL=bundle-CcpL2lfr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-
|
|
1
|
+
{"version":3,"file":"bundle-CcpL2lfr.js","names":["canonicalCandidateDigest"],"sources":["../src/candidate-execution/bundle.ts"],"sourcesContent":["import type { AgentCandidateBundle } from '@tangle-network/agent-interface'\nimport { agentCandidateBundleSchema } from '@tangle-network/agent-interface'\n\nimport { canonicalCandidateDigest, immutableCandidateValue, omitTopLevelDigest } from './digest'\n\n/** Exact candidate wire shape before the runtime computes its canonical digest. */\nexport type AgentCandidateBundleInput = Omit<AgentCandidateBundle, 'digest'>\n\n/** Validate and content-address a candidate bundle before it crosses an approval boundary. */\nexport function sealAgentCandidateBundle(input: AgentCandidateBundleInput): AgentCandidateBundle {\n const digest = canonicalCandidateDigest(input)\n const parsed = agentCandidateBundleSchema.parse({ ...input, digest })\n const parsedDigest = canonicalCandidateDigest(omitTopLevelDigest(parsed))\n if (parsedDigest !== digest) {\n throw new Error('candidate bundle changed while validating its canonical wire shape')\n }\n return immutableCandidateValue(parsed)\n}\n"],"mappings":";;;;AASA,SAAgB,yBAAyB,OAAwD;CAC/F,MAAM,SAASA,2BAAyB,KAAK;CAC7C,MAAM,SAAS,2BAA2B,MAAM;EAAE,GAAG;EAAO;CAAO,CAAC;CAEpE,IADqBA,2BAAyB,mBAAmB,MAAM,CACxD,MAAM,QACnB,MAAM,IAAI,MAAM,oEAAoE;CAEtF,OAAO,wBAAwB,MAAM;AACvC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { F as deepFreezeCandidate, I as embeddedCandidateArtifact, M as canonicalCandidateBytes$1, a as verifyAgentCandidateWorkspaceArtifacts, c as createAgentCandidateWorkspacePort, h as workspaceLimits, i as readAgentCandidateWorkspaceArtifactFiles, j as verifiedArtifactChunks, n as captureAgentCandidateWorkspaceTreeToArtifacts, o as verifyAgentCandidateWorkspaceTree, p as captureAgentCandidateWorkspaceFiles, r as materializeAgentCandidateWorkspaceFromArtifacts, s as captureAgentCandidateWorkspace, t as captureAgentCandidateWorkspaceToArtifacts, x as candidateWorkspaceManifest } from "../workspace-streams-
|
|
2
|
-
import { a as applyExactAgentProfileDiff, b as parseExactCandidateProfile, i as agentCandidateProfileAsAgentProfile, o as assertCandidateProfileBinding, p as freezeGenericAgentCandidateProfile, v as parseExactAgentProfile, y as parseExactAgentProfileDiff } from "../profile-
|
|
3
|
-
import { t as sealAgentCandidateBundle } from "../bundle-
|
|
4
|
-
import { _ as sealTerminalDigest, a as consumePreparedCandidateExecution, b as sealAgentCandidateModelSettlement, c as withinCandidateCleanupDeadline, d as assertTerminalMatchesClaim, f as assertTerminalMatchesStaged, g as requireStagedTerminal, h as rejectedStage, i as beginPreparedCandidateDisposal, l as assertRecoveryMatchesStaged, m as rejectedFinish, n as executePreparedAgentCandidate, o as candidateClaimFileInternals, p as recoveredTerminalRecord, r as assertPreparedCandidateIntegrity, s as candidateCleanupDeadline, t as prepareAgentCandidateExecution, u as assertTerminalAllowedInPhase, v as terminalRecord, w as verifyAgentCandidateBundle, x as exactProcessProviderAsCandidateExecutor, y as createProtectedAgentCandidateModelPort } from "../prepare-
|
|
1
|
+
import { F as deepFreezeCandidate, I as embeddedCandidateArtifact, M as canonicalCandidateBytes$1, a as verifyAgentCandidateWorkspaceArtifacts, c as createAgentCandidateWorkspacePort, h as workspaceLimits, i as readAgentCandidateWorkspaceArtifactFiles, j as verifiedArtifactChunks, n as captureAgentCandidateWorkspaceTreeToArtifacts, o as verifyAgentCandidateWorkspaceTree, p as captureAgentCandidateWorkspaceFiles, r as materializeAgentCandidateWorkspaceFromArtifacts, s as captureAgentCandidateWorkspace, t as captureAgentCandidateWorkspaceToArtifacts, x as candidateWorkspaceManifest } from "../workspace-streams-DA9R3j-p.js";
|
|
2
|
+
import { a as applyExactAgentProfileDiff, b as parseExactCandidateProfile, i as agentCandidateProfileAsAgentProfile, o as assertCandidateProfileBinding, p as freezeGenericAgentCandidateProfile, v as parseExactAgentProfile, y as parseExactAgentProfileDiff } from "../profile-CD25rTJF.js";
|
|
3
|
+
import { t as sealAgentCandidateBundle } from "../bundle-CcpL2lfr.js";
|
|
4
|
+
import { _ as sealTerminalDigest, a as consumePreparedCandidateExecution, b as sealAgentCandidateModelSettlement, c as withinCandidateCleanupDeadline, d as assertTerminalMatchesClaim, f as assertTerminalMatchesStaged, g as requireStagedTerminal, h as rejectedStage, i as beginPreparedCandidateDisposal, l as assertRecoveryMatchesStaged, m as rejectedFinish, n as executePreparedAgentCandidate, o as candidateClaimFileInternals, p as recoveredTerminalRecord, r as assertPreparedCandidateIntegrity, s as candidateCleanupDeadline, t as prepareAgentCandidateExecution, u as assertTerminalAllowedInPhase, v as terminalRecord, w as verifyAgentCandidateBundle, x as exactProcessProviderAsCandidateExecutor, y as createProtectedAgentCandidateModelPort } from "../prepare-BnF8nGIg.js";
|
|
5
5
|
import { agentCandidateArtifactRefSchema, agentCandidateWorkspaceManifestMaterialSchema, agentCandidateWorkspaceSnapshotEvidenceSchema } from "@tangle-network/agent-interface";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import { linkSync } from "node:fs";
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { m as ValidationError } from "./errors-DG8yufqX.js";
|
|
2
|
+
import { l as sha256 } from "./jsonl-file-DsxVI0E_.js";
|
|
3
|
+
import { a as writeAtomicDurableFile } from "./durable-file-DstVeHcj.js";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { mkdir } from "node:fs/promises";
|
|
6
|
+
// src/finite-number.ts
|
|
7
|
+
function isFiniteNumber(value) {
|
|
8
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
9
|
+
}
|
|
10
|
+
// src/runtime/supervise/continuation.ts
|
|
11
|
+
/**
|
|
12
|
+
* One check ({@link CheckVerdict}; {@link CheckUnavailableError} pauses), one
|
|
13
|
+
* {@link ContinuationPolicy} (`maxBarren`, an optional deadline, no re-prompt default), and one
|
|
14
|
+
* note ({@link composeContinuationNote} owns the facts, {@link ContinuationProfile} owns the
|
|
15
|
+
* words, a play may only append).
|
|
16
|
+
*/
|
|
17
|
+
/** Read a check function's return value into a verdict. Anything but `true` or a passing verdict
|
|
18
|
+
* is a failure: a check fails closed. */
|
|
19
|
+
function checkVerdictOf(outcome) {
|
|
20
|
+
if (outcome === true) return { pass: true };
|
|
21
|
+
if (typeof outcome !== "object" || outcome === null || Array.isArray(outcome)) return { pass: false };
|
|
22
|
+
const raw = outcome;
|
|
23
|
+
const items = typeof raw.items === "object" && raw.items !== null && !Array.isArray(raw.items) ? Object.fromEntries(Object.entries(raw.items).filter((entry) => typeof entry[1] === "number" && Number.isFinite(entry[1]))) : void 0;
|
|
24
|
+
const failures = Array.isArray(raw.failures) ? raw.failures.filter((line) => typeof line === "string" && line.trim() !== "") : void 0;
|
|
25
|
+
return Object.freeze({
|
|
26
|
+
pass: raw.pass === true,
|
|
27
|
+
...items === void 0 ? {} : { items: Object.freeze(items) },
|
|
28
|
+
...isFiniteNumber(raw.composite) ? { composite: raw.composite } : {},
|
|
29
|
+
...isFiniteNumber(raw.threshold) ? { threshold: raw.threshold } : {},
|
|
30
|
+
...failures === void 0 ? {} : { failures: Object.freeze(failures) },
|
|
31
|
+
...typeof raw.review === "string" && raw.review.trim() !== "" ? { review: raw.review.trim() } : {}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** Items that fail in `verdict`: every item below 1, or the named items of its FAIL lines. */
|
|
35
|
+
function failedItems(verdict) {
|
|
36
|
+
if (verdict.items !== void 0) return Object.entries(verdict.items).filter(([, value]) => value < 1).map(([name]) => name);
|
|
37
|
+
return (verdict.failures ?? []).map((line) => line.slice(5).split(/[\s:]/u)[0] ?? "");
|
|
38
|
+
}
|
|
39
|
+
/** Items that pass in `verdict`. */
|
|
40
|
+
function passedItems(verdict) {
|
|
41
|
+
return Object.entries(verdict.items ?? {}).filter(([, value]) => value >= 1).map(([name]) => name);
|
|
42
|
+
}
|
|
43
|
+
/** Resolve and check a policy before any compute. Returns the deadline in epoch ms, or undefined
|
|
44
|
+
* when the policy sets none. */
|
|
45
|
+
function admitContinuationPolicy(policy, context) {
|
|
46
|
+
if (typeof policy !== "object" || policy === null) throw new ValidationError(`${context}: continuation must be an object`);
|
|
47
|
+
const deadlineMs = typeof policy.deadline === "string" ? Date.parse(policy.deadline) : policy.deadline;
|
|
48
|
+
if (deadlineMs !== void 0 && (typeof deadlineMs !== "number" || !Number.isFinite(deadlineMs) || deadlineMs <= 0)) throw new ValidationError(`${context}: continuation.deadline, when set, must be a finite time (epoch ms or ISO 8601)`);
|
|
49
|
+
if (!Number.isInteger(policy.maxBarren) || policy.maxBarren < 1) throw new ValidationError(`${context}: continuation.maxBarren must be an integer >= 1`);
|
|
50
|
+
if (policy.failures !== "verbatim" && policy.failures !== "off") throw new ValidationError(`${context}: continuation.failures must be 'verbatim' or 'off'`);
|
|
51
|
+
if (policy.panel !== "on" && policy.panel !== "off") throw new ValidationError(`${context}: continuation.panel must be 'on' or 'off'`);
|
|
52
|
+
if (policy.bar !== "on" && policy.bar !== "off") throw new ValidationError(`${context}: continuation.bar must be 'on' or 'off'`);
|
|
53
|
+
if (policy.panel === "on") {
|
|
54
|
+
if (typeof policy.runPanel !== "function") throw new ValidationError(`${context}: continuation.panel 'on' needs runPanel`);
|
|
55
|
+
const usd = policy.panelUsd;
|
|
56
|
+
if (usd === void 0 || !isFiniteNumber(usd.perContinuation) || !isFiniteNumber(usd.perRun) || usd.perContinuation <= 0 || usd.perRun < usd.perContinuation) throw new ValidationError(`${context}: continuation.panel 'on' needs panelUsd with 0 < perContinuation <= perRun`);
|
|
57
|
+
}
|
|
58
|
+
if (policy.append !== void 0 && typeof policy.append !== "function") throw new ValidationError(`${context}: continuation.append must be a function`);
|
|
59
|
+
if (policy.session !== void 0 && policy.session !== "native" && policy.session !== "fresh") throw new ValidationError(`${context}: continuation.session must be 'native' or 'fresh'`);
|
|
60
|
+
if (policy.reference !== void 0 && typeof policy.reference !== "string") throw new ValidationError(`${context}: continuation.reference must be a string`);
|
|
61
|
+
admitContinuationProfile(policy.profile, context);
|
|
62
|
+
return deadlineMs;
|
|
63
|
+
}
|
|
64
|
+
/** The facts a profile template may name. */
|
|
65
|
+
const CONTINUATION_FACTS = [
|
|
66
|
+
"composite",
|
|
67
|
+
"threshold",
|
|
68
|
+
"failed",
|
|
69
|
+
"total",
|
|
70
|
+
"reads",
|
|
71
|
+
"owed",
|
|
72
|
+
"settled",
|
|
73
|
+
"delivered",
|
|
74
|
+
"continuation"
|
|
75
|
+
];
|
|
76
|
+
const factNames = new Set(CONTINUATION_FACTS);
|
|
77
|
+
const placeholder = /\{([a-zA-Z]+)\}/gu;
|
|
78
|
+
function admitContinuationProfile(profile, context) {
|
|
79
|
+
if (typeof profile !== "object" || profile === null) throw new ValidationError(`${context}: continuation.profile must be an object`);
|
|
80
|
+
if (typeof profile.id !== "string" || profile.id.trim() === "") throw new ValidationError(`${context}: continuation.profile.id must be non-empty`);
|
|
81
|
+
const texts = [
|
|
82
|
+
["opening", profile.opening],
|
|
83
|
+
["plan", profile.plan],
|
|
84
|
+
["rules", profile.rules],
|
|
85
|
+
...Object.entries(profile.headings ?? {}).map(([key, value]) => [`headings.${key}`, value]),
|
|
86
|
+
...profile.barRule === void 0 ? [] : [["barRule", profile.barRule]]
|
|
87
|
+
];
|
|
88
|
+
for (const key of [
|
|
89
|
+
"failures",
|
|
90
|
+
"protected",
|
|
91
|
+
"changed",
|
|
92
|
+
"findings",
|
|
93
|
+
"bar",
|
|
94
|
+
"plan",
|
|
95
|
+
"rules"
|
|
96
|
+
]) if (typeof profile.headings?.[key] !== "string") throw new ValidationError(`${context}: continuation.profile.headings.${key} must be a string`);
|
|
97
|
+
for (const [key, text] of texts) {
|
|
98
|
+
if (typeof text !== "string") throw new ValidationError(`${context}: continuation.profile.${key} must be a string`);
|
|
99
|
+
for (const match of text.matchAll(placeholder)) if (!factNames.has(match[1] ?? "")) throw new ValidationError(`${context}: continuation.profile.${key} names {${match[1]}}, which is not a fact Runtime supplies (${CONTINUATION_FACTS.join(", ")})`);
|
|
100
|
+
}
|
|
101
|
+
if (profile.review !== void 0) {
|
|
102
|
+
if (typeof profile.review !== "string" || profile.review.trim() === "") throw new ValidationError(`${context}: continuation.profile.review must be non-empty`);
|
|
103
|
+
for (const match of profile.review.matchAll(placeholder)) if (![
|
|
104
|
+
"version",
|
|
105
|
+
"path",
|
|
106
|
+
"score"
|
|
107
|
+
].includes(match[1] ?? "")) throw new ValidationError(`${context}: continuation.profile.review names {${match[1]}}; it may name {version}, {path} and {score}`);
|
|
108
|
+
}
|
|
109
|
+
if (profile.opening.trim() === "") throw new ValidationError(`${context}: continuation.profile.opening must be non-empty`);
|
|
110
|
+
if (profile.panelModel !== void 0 && typeof profile.panelModel !== "string") throw new ValidationError(`${context}: continuation.profile.panelModel must be a string`);
|
|
111
|
+
if (profile.questions !== void 0 && !Array.isArray(profile.questions)) throw new ValidationError(`${context}: continuation.profile.questions must be an array`);
|
|
112
|
+
for (const [index, question] of (profile.questions ?? []).entries()) if (typeof question !== "string" || question.trim() === "") throw new ValidationError(`${context}: continuation.profile.questions[${index}] must be a non-empty string`);
|
|
113
|
+
}
|
|
114
|
+
/** Findings reach the note only when every citation resolves, at least two distinct spans are
|
|
115
|
+
* cited, and the independent verifier agreed. The best method in Who&When found the failing step
|
|
116
|
+
* 14.2% of the time, so an unverified finding is noise with a citation. */
|
|
117
|
+
function admitFinding(finding) {
|
|
118
|
+
if (!finding.verified) return false;
|
|
119
|
+
if (finding.citations.length === 0) return false;
|
|
120
|
+
if (!finding.citations.every((citation) => citation.resolved)) return false;
|
|
121
|
+
return new Set(finding.citations.map((citation) => citation.uri)).size >= 2;
|
|
122
|
+
}
|
|
123
|
+
/** About 1,500 tokens of findings. */
|
|
124
|
+
const FINDINGS_CHAR_CAP = 6e3;
|
|
125
|
+
/**
|
|
126
|
+
* Rank the admitted findings by how many failed items they explain, drop repeats, and keep them
|
|
127
|
+
* within the note's cap. Earlier findings stay as they were written (ACE: itemized additions keep
|
|
128
|
+
* detail that repeated rewrites lose); a finding whose items all pass now is marked resolved.
|
|
129
|
+
*/
|
|
130
|
+
function distillFindings(prior, proposed, failing, continuation) {
|
|
131
|
+
const key = (claim) => claim.toLowerCase().replace(/\s+/gu, " ").trim();
|
|
132
|
+
const known = new Set(prior.map((finding) => key(finding.claim)));
|
|
133
|
+
const carried = prior.map((finding) => finding.resolvedAt === void 0 && (finding.items?.length ?? 0) > 0 && (finding.items ?? []).every((item) => !failing.has(item)) ? {
|
|
134
|
+
...finding,
|
|
135
|
+
resolvedAt: continuation
|
|
136
|
+
} : finding);
|
|
137
|
+
const fresh = proposed.filter(admitFinding).filter((finding) => {
|
|
138
|
+
const k = key(finding.claim);
|
|
139
|
+
if (known.has(k)) return false;
|
|
140
|
+
known.add(k);
|
|
141
|
+
return true;
|
|
142
|
+
}).map((finding) => ({
|
|
143
|
+
finding,
|
|
144
|
+
links: (finding.items ?? []).filter((item) => failing.has(item)).length
|
|
145
|
+
})).sort((a, b) => b.links - a.links);
|
|
146
|
+
const out = [...carried];
|
|
147
|
+
let used = carried.filter((finding) => finding.resolvedAt === void 0).reduce((sum, finding) => sum + finding.claim.length, 0);
|
|
148
|
+
for (const { finding } of fresh) {
|
|
149
|
+
if (used + finding.claim.length > FINDINGS_CHAR_CAP) break;
|
|
150
|
+
used += finding.claim.length;
|
|
151
|
+
out.push({
|
|
152
|
+
...finding,
|
|
153
|
+
admittedAt: continuation
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
/** Expand the profile's question templates over the failed items and the settled workers. */
|
|
159
|
+
function expandQuestions(templates, failing, workers) {
|
|
160
|
+
const out = [];
|
|
161
|
+
for (const template of templates) {
|
|
162
|
+
const hasItem = template.includes("{item}");
|
|
163
|
+
const hasWorker = template.includes("{worker}");
|
|
164
|
+
if (!hasItem && !hasWorker) {
|
|
165
|
+
out.push(template);
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const items = hasItem ? failing : [""];
|
|
169
|
+
const each = hasWorker ? workers.map((worker) => `${worker.id} (${worker.label})`) : [""];
|
|
170
|
+
for (const item of items) for (const worker of each) out.push(template.replaceAll("{item}", item).replaceAll("{worker}", worker));
|
|
171
|
+
}
|
|
172
|
+
return out;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Write one continuation note, sections 1 to 8 of docs/38. Section 9, the run's state, is
|
|
176
|
+
* `composeReentryTask`, which wraps this text. Pure: the same input writes the same note.
|
|
177
|
+
*/
|
|
178
|
+
function composeContinuationNote(input) {
|
|
179
|
+
const { profile, verdict } = input;
|
|
180
|
+
const items = verdict?.items ?? {};
|
|
181
|
+
const total = Object.keys(items).length;
|
|
182
|
+
const failing = verdict === void 0 ? [] : failedItems(verdict);
|
|
183
|
+
const facts = {
|
|
184
|
+
composite: verdict?.composite === void 0 ? "unknown" : format(verdict.composite),
|
|
185
|
+
threshold: verdict?.threshold === void 0 ? "unknown" : format(verdict.threshold),
|
|
186
|
+
failed: verdict === void 0 || total === 0 && (verdict.failures?.length ?? 0) === 0 ? "unknown" : String(failing.length),
|
|
187
|
+
total: total === 0 ? "unknown" : String(total),
|
|
188
|
+
reads: String(input.reads),
|
|
189
|
+
owed: input.owed?.trim() || "not described",
|
|
190
|
+
settled: String(input.progress.settledCount),
|
|
191
|
+
delivered: String(input.progress.deliveredCount ?? 0),
|
|
192
|
+
continuation: String(input.continuation)
|
|
193
|
+
};
|
|
194
|
+
const fill = (text) => text.replace(placeholder, (_, name) => facts[name] ?? `{${name}}`);
|
|
195
|
+
const sections = [verdict === void 0 ? "No check verdict is available yet." + (input.canSubmitResult === true ? " Submit a result through submit_result to request the check." : "") : verdict.pass ? "The check passes on the current state, but no result has been accepted." + (input.canSubmitResult === true ? " Call submit_result to request acceptance." : "") : fill(profile.opening).trim()];
|
|
196
|
+
const section = (heading, body) => {
|
|
197
|
+
if (body.length === 0) return;
|
|
198
|
+
sections.push([...heading.trim() === "" ? [] : [`## ${fill(heading)}`], ...body].join("\n"));
|
|
199
|
+
};
|
|
200
|
+
if (input.failures === "verbatim" && verdict !== void 0) {
|
|
201
|
+
const lines = verdict.failures ?? [];
|
|
202
|
+
const shown = lines.slice(0, 40);
|
|
203
|
+
const more = lines.length - shown.length;
|
|
204
|
+
section(profile.headings.failures, [...shown, ...more > 0 ? [input.canReadMore ? `${more} more failure lines: call read_continuation with continuation ${input.continuation}.` : `${more} more failure lines are not shown.`] : []]);
|
|
205
|
+
const passing = passedItems(verdict);
|
|
206
|
+
section(profile.headings.protected, passing.length === 0 ? [] : [passing.join(", ")]);
|
|
207
|
+
if (input.previous !== void 0) {
|
|
208
|
+
const before = new Set(failedItems(input.previous));
|
|
209
|
+
const now = new Set(failing);
|
|
210
|
+
const fixed = [...before].filter((item) => !now.has(item));
|
|
211
|
+
const broke = [...now].filter((item) => !before.has(item));
|
|
212
|
+
section(profile.headings.changed, [
|
|
213
|
+
...fixed.length === 0 ? [] : [`Now passing: ${fixed.join(", ")}.`],
|
|
214
|
+
...broke.length === 0 ? [] : [`Newly failing: ${broke.join(", ")}.`],
|
|
215
|
+
...fixed.length === 0 && broke.length === 0 ? ["No item changed since the last note."] : [],
|
|
216
|
+
...input.previous.composite !== void 0 && verdict.composite !== void 0 ? [`Composite: ${format(input.previous.composite)} then ${format(verdict.composite)}.`] : []
|
|
217
|
+
]);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (input.findings !== void 0) {
|
|
221
|
+
const open = input.findings.filter((finding) => finding.resolvedAt === void 0);
|
|
222
|
+
const resolved = input.findings.filter((finding) => finding.resolvedAt === input.continuation);
|
|
223
|
+
section(profile.headings.findings, [...open.map((finding) => `- [hypothesis] ${finding.claim}` + (finding.items?.length ? ` (items: ${finding.items.join(", ")})` : "") + ` Evidence: ${finding.citations.map((citation) => citation.uri).join(", ")}`), ...resolved.map((finding) => `- [resolved] ${finding.claim}`)]);
|
|
224
|
+
}
|
|
225
|
+
if (input.bar !== void 0 && verdict !== void 0) {
|
|
226
|
+
const body = [];
|
|
227
|
+
if (profile.barRule?.trim()) body.push(fill(profile.barRule).trim());
|
|
228
|
+
for (const [item, value] of Object.entries(items)) {
|
|
229
|
+
const best = input.bar.best?.verdict.items?.[item];
|
|
230
|
+
body.push(`- ${item}: ${value >= 1 ? "passes" : `fails (${format(value)})`}` + (best === void 0 ? "" : ` / ${input.bar.best?.label}: ${best >= 1 ? "passes" : `fails (${format(best)})`}`));
|
|
231
|
+
}
|
|
232
|
+
if (input.bar.best?.verdict.composite !== void 0) body.push(`Best version ${input.bar.best.label}: composite ${format(input.bar.best.verdict.composite)}.`);
|
|
233
|
+
if (input.bar.reference?.trim()) body.push(`Reference result: ${input.bar.reference.trim()}`);
|
|
234
|
+
if (verdict.review?.trim()) body.push(`The check's review: ${verdict.review.trim()}`);
|
|
235
|
+
section(profile.headings.bar, body);
|
|
236
|
+
}
|
|
237
|
+
section(profile.headings.plan, profile.plan.trim() === "" ? [] : [fill(profile.plan).trim()]);
|
|
238
|
+
section(profile.headings.rules, [...profile.rules.trim() === "" ? [] : [fill(profile.rules).trim()], ...input.sealed ? ["The score comes from cases you cannot see."] : []]);
|
|
239
|
+
for (const appended of input.appended ?? []) section(appended.heading, appended.text.trim() === "" ? [] : [appended.text.trim()]);
|
|
240
|
+
return sections.join("\n\n");
|
|
241
|
+
}
|
|
242
|
+
function summarizeVerdict(verdict) {
|
|
243
|
+
if (verdict === void 0) return null;
|
|
244
|
+
const total = Object.keys(verdict.items ?? {}).length;
|
|
245
|
+
return {
|
|
246
|
+
pass: verdict.pass,
|
|
247
|
+
...verdict.composite === void 0 ? {} : { composite: verdict.composite },
|
|
248
|
+
...total === 0 ? {} : {
|
|
249
|
+
failed: failedItems(verdict).length,
|
|
250
|
+
total
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function noteDigest(note) {
|
|
255
|
+
return `sha256:${sha256(note)}`;
|
|
256
|
+
}
|
|
257
|
+
/** A run directory's continuation files: the root's at `<runDir>/continuations/<n>/`, a nested
|
|
258
|
+
* manager's at `<runDir>/continuations/managers/<owner>/<n>/`. */
|
|
259
|
+
const CONTINUATIONS_DIR = "continuations";
|
|
260
|
+
/**
|
|
261
|
+
* Write one continuation's files under `<dir>/<n>/`: `note.md`, `verdict.json`, and
|
|
262
|
+
* `panel.jsonl` when the panel ran. The director reads them through `read_continuation`, because
|
|
263
|
+
* its box cannot read the driver's run directory.
|
|
264
|
+
*/
|
|
265
|
+
async function writeContinuationFiles(dir, continuation, files) {
|
|
266
|
+
const at = join(dir, String(continuation));
|
|
267
|
+
await mkdir(at, { recursive: true });
|
|
268
|
+
writeAtomicDurableFile(join(at, "note.md"), `${files.note}\n`);
|
|
269
|
+
writeAtomicDurableFile(join(at, "verdict.json"), `${JSON.stringify(files.verdict ?? null, null, 2)}\n`);
|
|
270
|
+
if (files.panel !== void 0) writeAtomicDurableFile(join(at, "panel.jsonl"), files.panel.map((line) => JSON.stringify(line)).join("\n") + (files.panel.length ? "\n" : ""));
|
|
271
|
+
}
|
|
272
|
+
/** The best composite across `reads`, or `undefined` when no read scored. */
|
|
273
|
+
function bestComposite(reads) {
|
|
274
|
+
let best;
|
|
275
|
+
for (const read of reads) {
|
|
276
|
+
const value = read.verdict?.composite;
|
|
277
|
+
if (value !== void 0 && (best === void 0 || value > best)) best = value;
|
|
278
|
+
}
|
|
279
|
+
return best;
|
|
280
|
+
}
|
|
281
|
+
function format(value) {
|
|
282
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(3).replace(/0+$/u, "");
|
|
283
|
+
}
|
|
284
|
+
/** Build the continuation state for one manager with a check. */
|
|
285
|
+
function createContinuationKeeper(input) {
|
|
286
|
+
const { policy } = input;
|
|
287
|
+
const failures = input.feedback === "pass-only" ? "off" : policy.failures;
|
|
288
|
+
const entries = [];
|
|
289
|
+
const notes = [];
|
|
290
|
+
let findings = [];
|
|
291
|
+
let panelUsd = 0;
|
|
292
|
+
let panelUsdKnown = true;
|
|
293
|
+
const latestVerdict = () => {
|
|
294
|
+
const reads = input.reads();
|
|
295
|
+
for (let i = reads.length - 1; i >= 0; i -= 1) {
|
|
296
|
+
const read = reads[i];
|
|
297
|
+
if (read?.verdict !== void 0) return {
|
|
298
|
+
verdict: read.verdict,
|
|
299
|
+
read: read.read
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
return { read: 0 };
|
|
303
|
+
};
|
|
304
|
+
const closePrevious = () => {
|
|
305
|
+
const last = entries.at(-1);
|
|
306
|
+
const lastNote = notes.at(-1);
|
|
307
|
+
if (last === void 0 || lastNote === void 0) return;
|
|
308
|
+
const latest = latestVerdict();
|
|
309
|
+
entries[entries.length - 1] = {
|
|
310
|
+
...last,
|
|
311
|
+
after: latest.read > lastNote.read ? summarizeVerdict(latest.verdict) : null
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
return {
|
|
315
|
+
async compose(context) {
|
|
316
|
+
closePrevious();
|
|
317
|
+
const continuation = entries.length + 1;
|
|
318
|
+
const { verdict, read } = latestVerdict();
|
|
319
|
+
const failing = verdict === void 0 ? [] : failedItems(verdict);
|
|
320
|
+
let panelRecord;
|
|
321
|
+
let panelLines;
|
|
322
|
+
if (policy.panel === "on" && policy.runPanel !== void 0 && policy.panelUsd !== void 0) {
|
|
323
|
+
const workers = input.workers();
|
|
324
|
+
const questions = expandQuestions(policy.profile.questions ?? [], failing, workers);
|
|
325
|
+
const left = policy.panelUsd.perRun - panelUsd;
|
|
326
|
+
const usdCap = Math.min(policy.panelUsd.perContinuation, left);
|
|
327
|
+
const asking = questions.length > 0 && usdCap > 0 && panelUsdKnown;
|
|
328
|
+
let traces;
|
|
329
|
+
let unavailable;
|
|
330
|
+
if (asking) try {
|
|
331
|
+
traces = await input.traces?.();
|
|
332
|
+
if (traces === void 0) unavailable = "the run has recorded no trace yet";
|
|
333
|
+
} catch (error) {
|
|
334
|
+
unavailable = `the run's traces could not be read: ${error instanceof Error ? error.message : String(error)}`;
|
|
335
|
+
}
|
|
336
|
+
if (asking && traces !== void 0) {
|
|
337
|
+
const result = await policy.runPanel({
|
|
338
|
+
continuation,
|
|
339
|
+
task: input.task,
|
|
340
|
+
...verdict === void 0 ? {} : { verdict },
|
|
341
|
+
reads: input.reads(),
|
|
342
|
+
questions,
|
|
343
|
+
traces,
|
|
344
|
+
workers,
|
|
345
|
+
...policy.best === void 0 ? {} : { bar: policy.best },
|
|
346
|
+
...policy.reference === void 0 ? {} : { reference: policy.reference },
|
|
347
|
+
usdCap,
|
|
348
|
+
signal: context.signal
|
|
349
|
+
});
|
|
350
|
+
if (result.usd === null) panelUsdKnown = false;
|
|
351
|
+
else panelUsd += result.usd;
|
|
352
|
+
findings = distillFindings(findings, result.findings, new Set(failing), continuation);
|
|
353
|
+
panelRecord = {
|
|
354
|
+
asked: questions.length,
|
|
355
|
+
proposed: result.findings.length,
|
|
356
|
+
admitted: findings.filter((finding) => finding.admittedAt === continuation).length,
|
|
357
|
+
usd: result.usd
|
|
358
|
+
};
|
|
359
|
+
panelLines = [...result.findings.map((finding) => ({
|
|
360
|
+
kind: "finding",
|
|
361
|
+
admitted: admitFinding(finding),
|
|
362
|
+
...finding
|
|
363
|
+
})), ...result.receipts === void 0 ? [] : [{
|
|
364
|
+
kind: "receipts",
|
|
365
|
+
receipts: result.receipts
|
|
366
|
+
}]];
|
|
367
|
+
} else panelRecord = {
|
|
368
|
+
asked: 0,
|
|
369
|
+
proposed: 0,
|
|
370
|
+
admitted: 0,
|
|
371
|
+
usd: 0,
|
|
372
|
+
...unavailable === void 0 ? {} : { unavailable }
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
const appended = policy.append ? await policy.append({
|
|
376
|
+
continuation,
|
|
377
|
+
...verdict === void 0 ? {} : { verdict },
|
|
378
|
+
reads: input.reads(),
|
|
379
|
+
signal: context.signal
|
|
380
|
+
}) : void 0;
|
|
381
|
+
const note = composeContinuationNote({
|
|
382
|
+
profile: policy.profile,
|
|
383
|
+
continuation,
|
|
384
|
+
...verdict === void 0 ? {} : { verdict },
|
|
385
|
+
...notes.at(-1)?.verdict === void 0 ? {} : { previous: notes.at(-1)?.verdict },
|
|
386
|
+
reads: input.reads().length,
|
|
387
|
+
failures,
|
|
388
|
+
...policy.panel === "on" ? { findings } : {},
|
|
389
|
+
...policy.bar === "on" ? { bar: {
|
|
390
|
+
...policy.best === void 0 ? {} : { best: policy.best },
|
|
391
|
+
...policy.reference === void 0 ? {} : { reference: policy.reference }
|
|
392
|
+
} } : {},
|
|
393
|
+
...appended === void 0 ? {} : { appended: [appended] },
|
|
394
|
+
...input.owed === void 0 ? {} : { owed: input.owed },
|
|
395
|
+
progress: context.progress,
|
|
396
|
+
canReadMore: input.canReadMore,
|
|
397
|
+
canSubmitResult: input.canSubmitResult === true,
|
|
398
|
+
...input.sealed === true ? { sealed: true } : {}
|
|
399
|
+
});
|
|
400
|
+
notes.push({
|
|
401
|
+
note,
|
|
402
|
+
...verdict === void 0 ? {} : { verdict },
|
|
403
|
+
...panelLines === void 0 ? {} : { panel: panelLines },
|
|
404
|
+
read
|
|
405
|
+
});
|
|
406
|
+
entries.push({
|
|
407
|
+
continuation,
|
|
408
|
+
attempt: context.attempt,
|
|
409
|
+
noteDigest: noteDigest(note),
|
|
410
|
+
profile: policy.profile.id,
|
|
411
|
+
switches: {
|
|
412
|
+
failures,
|
|
413
|
+
panel: policy.panel,
|
|
414
|
+
bar: policy.bar
|
|
415
|
+
},
|
|
416
|
+
before: summarizeVerdict(verdict),
|
|
417
|
+
after: null,
|
|
418
|
+
...panelRecord === void 0 ? {} : { panel: panelRecord },
|
|
419
|
+
appended: appended === void 0 ? 0 : 1
|
|
420
|
+
});
|
|
421
|
+
if (input.dir !== void 0) await writeContinuationFiles(input.dir, continuation, {
|
|
422
|
+
note,
|
|
423
|
+
...verdict === void 0 ? {} : { verdict },
|
|
424
|
+
...panelLines === void 0 ? {} : { panel: panelLines }
|
|
425
|
+
});
|
|
426
|
+
return note;
|
|
427
|
+
},
|
|
428
|
+
read(continuation) {
|
|
429
|
+
const index = continuation === void 0 ? notes.length - 1 : continuation - 1;
|
|
430
|
+
const entry = notes[index];
|
|
431
|
+
if (entry === void 0) return {
|
|
432
|
+
found: false,
|
|
433
|
+
reason: notes.length === 0 ? "no continuation has been sent in this run" : `continuations run from 1 to ${notes.length}`
|
|
434
|
+
};
|
|
435
|
+
return {
|
|
436
|
+
found: true,
|
|
437
|
+
continuation: index + 1,
|
|
438
|
+
note: entry.note,
|
|
439
|
+
verdict: failures === "off" && entry.verdict !== void 0 ? { pass: entry.verdict.pass } : entry.verdict ?? null,
|
|
440
|
+
findings: findings.filter((finding) => finding.admittedAt <= index + 1)
|
|
441
|
+
};
|
|
442
|
+
},
|
|
443
|
+
entries() {
|
|
444
|
+
closePrevious();
|
|
445
|
+
return entries.map((entry) => ({ ...entry }));
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
export { createContinuationKeeper as a, checkVerdictOf as i, admitContinuationPolicy as n, failedItems as o, bestComposite as r, isFiniteNumber as s, CONTINUATIONS_DIR as t };
|
|
450
|
+
|
|
451
|
+
//# sourceMappingURL=continuation-CIyKnS1Q.js.map
|