@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { W as FileSpawnJournal, n as terminalAccounting } from "./supervisor-accounting-Bw4MJk-b.js";
|
|
2
2
|
import { t as isNoEntError } from "./jsonl-file-DsxVI0E_.js";
|
|
3
3
|
import { a as writeAtomicDurableFile, r as publishExclusiveDurableFile } from "./durable-file-DstVeHcj.js";
|
|
4
4
|
import { canonicalCandidateDigest, canonicalCandidateJson } from "@tangle-network/agent-interface";
|
|
@@ -135,4 +135,4 @@ async function readFailureRecord(runDir) {
|
|
|
135
135
|
}
|
|
136
136
|
export { readFailureRecord as a, writeFailureRecord as c, parseSettleRecord as i, writeSettleRecord as l, SETTLE_RECORD_FILE as n, readSettleRecord as o, SettledRunDirectoryError as r, settleRecordDigest as s, FAILURE_RECORD_FILE as t };
|
|
137
137
|
|
|
138
|
-
//# sourceMappingURL=settle-record-
|
|
138
|
+
//# sourceMappingURL=settle-record-WWQasnDq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settle-record-C6LdVvok.js","names":[],"sources":["../src/durable/settle-record.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises'\nimport { resolve } from 'node:path'\nimport {\n type AgentProfile,\n canonicalCandidateDigest,\n canonicalCandidateJson,\n} from '@tangle-network/agent-interface'\nimport {\n publishExclusiveDurableFile,\n writeAtomicDurableFile,\n} from '../runtime/supervise/durable-file'\nimport { terminalAccounting } from '../runtime/supervise/supervisor-accounting'\nimport type { RootStreamReceipt, SupervisedResult } from '../runtime/supervise/types'\nimport { isNoEntError } from './jsonl-file'\nimport { FileSpawnJournal } from './spawn-journal/journal-store'\n\n/** Terminal evidence has one result per segment. Reopen archives that result byte for byte;\n * a failed attempt may resume because failure.json records only the latest throw.\n * Serialization, exclusive publication and validation stay with the record operations below.\n */\n\n/** The settle record: the returned `SupervisedResult` as canonical JSON, written once. */\nexport const SETTLE_RECORD_FILE = 'result.json'\n/** The failure record: the most recent throw, replaced by a later throw. */\nexport const FAILURE_RECORD_FILE = 'failure.json'\n\n/** What `failure.json` records about the most recent throw. */\nexport interface DurableFailureRecord {\n readonly runId: string\n readonly pursuitId: string\n /** ISO instant the throw was recorded. */\n readonly at: string\n readonly error: { readonly name: string; readonly message: string }\n /** The root's retained provider stream at the time of the throw, when the directory holds one:\n * a root that died mid-turn keeps what it had streamed, and this names it. */\n readonly rootStream?: RootStreamReceipt\n}\n\n/** The directory already holds a settle record, so the run it records must not be re-entered. */\nexport class SettledRunDirectoryError extends Error {\n readonly path: string\n /** The root of the recorded run, which is its `runId`. */\n readonly recordedRunId: string\n\n constructor(path: string, recordedRunId: string, requestedRunId: string) {\n super(\n recordedRunId === requestedRunId\n ? `supervisePursuit: ${path} records that run '${recordedRunId}' already settled; a settled run is not re-entered unless the call passes reopen: { operator, reason, operationId }`\n : `supervisePursuit: ${path} records that run '${recordedRunId}' already settled in this directory; a directory holds one settle record, so run '${requestedRunId}' needs its own runDir`,\n )\n this.name = 'SettledRunDirectoryError'\n this.path = path\n this.recordedRunId = recordedRunId\n }\n}\n\n/** A result member whose JSON form would misstate it. */\nclass UnrecordableSettleValueError extends TypeError {\n readonly path: string\n\n constructor(path: string, kind: string) {\n super(\n `supervisePursuit: result${path} is a ${kind}, which JSON cannot record faithfully; a settle record holds plain data only`,\n )\n this.name = 'UnrecordableSettleValueError'\n this.path = path\n }\n}\n\nconst PLAIN_PROTOTYPES = new Set<unknown>([Object.prototype, Array.prototype, null])\n\n/**\n * The JSON value of a result, or a throw naming the first member JSON would misstate. An\n * `undefined` member and a function are dropped, exactly as any JSON consumer drops them; a Map,\n * a Set, a Date, a typed array, or a class instance would be rewritten to `{}` or a string and\n * so is refused.\n */\nfunction jsonValue(result: unknown): unknown {\n const seen: unknown[] = []\n const visit = (value: unknown, path: string): void => {\n if (value === null || typeof value !== 'object') return\n if (value instanceof Map) throw new UnrecordableSettleValueError(path, 'Map')\n if (value instanceof Set) throw new UnrecordableSettleValueError(path, 'Set')\n if (value instanceof Date) throw new UnrecordableSettleValueError(path, 'Date')\n if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) {\n throw new UnrecordableSettleValueError(path, 'binary buffer')\n }\n if (!PLAIN_PROTOTYPES.has(Object.getPrototypeOf(value))) {\n throw new UnrecordableSettleValueError(path, 'class instance')\n }\n if (seen.includes(value)) throw new UnrecordableSettleValueError(path, 'cycle')\n seen.push(value)\n if (Array.isArray(value)) {\n for (const [index, item] of value.entries()) visit(item, `${path}[${index}]`)\n } else {\n for (const [key, item] of Object.entries(value)) visit(item, `${path}.${key}`)\n }\n seen.pop()\n }\n visit(result, '')\n return JSON.parse(JSON.stringify(result))\n}\n\n/**\n * The exact bytes `result.json` holds for a result: its JSON value serialized as RFC 8785\n * canonical JSON. Throws `UnrecordableSettleValueError` before any byte is written when the\n * result carries a value JSON would misstate.\n */\nexport function settleRecordJson(result: unknown): string {\n return canonicalCandidateJson(jsonValue(result))\n}\n\n/** The digest the settle record's bytes hash to: the candidate digest of the result's JSON value. */\nexport function settleRecordDigest(result: unknown): string {\n return canonicalCandidateDigest(jsonValue(result))\n}\n\n/** Publish `result.json` in the run directory once. Throws when a record is already there. */\nexport async function writeSettleRecord(runDir: string, result: unknown): Promise<string> {\n const path = resolve(runDir, SETTLE_RECORD_FILE)\n if (!publishExclusiveDurableFile(path, settleRecordJson(result))) {\n throw new Error(`supervisePursuit: ${path} already exists; a settle record is written once`)\n }\n return path\n}\n\n/** Replace `failure.json` in the run directory with the most recent throw. */\nexport async function writeFailureRecord(\n runDir: string,\n record: DurableFailureRecord,\n): Promise<string> {\n const path = resolve(runDir, FAILURE_RECORD_FILE)\n writeAtomicDurableFile(path, `${JSON.stringify(record, null, 2)}\\n`)\n return path\n}\n\n/**\n * Read the settle record a run directory holds, or `undefined` when it holds none. A file that\n * is present but is not a settle record is corruption and fails loud. `usage` annotates legacy\n * results by replay without changing their sealed fields; recorded usage always wins.\n */\nexport async function readSettleRecord(\n runDir: string,\n options: { readonly usage?: boolean; readonly requestedProfile?: AgentProfile } = {},\n): Promise<SupervisedResult<unknown> | undefined> {\n const recorded = await readTerminalFile(runDir, SETTLE_RECORD_FILE, parseSettleRecord)\n if (!recorded || !options.usage || recorded.usage) return recorded\n const { usage } = await terminalAccounting(\n new FileSpawnJournal(resolve(runDir, 'spawn-journal.jsonl')),\n recorded.tree.root,\n recorded.spentTotal.ms,\n options.requestedProfile,\n )\n return { ...recorded, usage }\n}\n\nasync function readTerminalFile<T>(\n runDir: string,\n file: string,\n parse: (text: string, path: string) => T,\n): Promise<T | undefined> {\n const path = resolve(runDir, file)\n try {\n return parse(await readFile(path, 'utf8'), path)\n } catch (error) {\n if (isNoEntError(error)) return undefined\n throw error\n }\n}\n\nfunction parseTerminalJson(text: string, path: string): unknown {\n try {\n return JSON.parse(text)\n } catch (cause) {\n throw new Error(`supervisePursuit: ${path} is not valid JSON`, { cause })\n }\n}\n\n/** Parse settle-record bytes already read, so a caller hashes and parses the same bytes. */\nexport function parseSettleRecord(text: string, path: string): SupervisedResult<unknown> {\n const parsed = parseTerminalJson(text, path)\n const record = parsed as { kind?: unknown; tree?: { root?: unknown } }\n if (\n typeof record !== 'object' ||\n record === null ||\n typeof record.kind !== 'string' ||\n typeof record.tree !== 'object' ||\n record.tree === null ||\n typeof record.tree.root !== 'string'\n ) {\n throw new Error(`supervisePursuit: ${path} is not a settle record (no kind or tree.root)`)\n }\n return parsed as SupervisedResult<unknown>\n}\n\n/** Read the most recent failure record, or `undefined` when the directory holds none. */\nexport async function readFailureRecord(runDir: string): Promise<DurableFailureRecord | undefined> {\n return readTerminalFile(runDir, FAILURE_RECORD_FILE, (text, path) => {\n const parsed = parseTerminalJson(text, path)\n const record = parsed as Partial<DurableFailureRecord>\n if (\n typeof record !== 'object' ||\n record === null ||\n typeof record.runId !== 'string' ||\n typeof record.pursuitId !== 'string' ||\n typeof record.at !== 'string' ||\n typeof record.error?.name !== 'string' ||\n typeof record.error.message !== 'string' ||\n (record.rootStream !== undefined &&\n (typeof record.rootStream.ref !== 'string' || typeof record.rootStream.events !== 'number'))\n ) {\n throw new Error(`supervisePursuit: ${path} is not a failure record`)\n }\n return parsed as DurableFailureRecord\n })\n}\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAa,qBAAqB;;AAElC,MAAa,sBAAsB;;AAenC,IAAa,2BAAb,cAA8C,MAAM;CAClD;;CAEA;CAEA,YAAY,MAAc,eAAuB,gBAAwB;EACvE,MACE,kBAAkB,iBACd,qBAAqB,KAAK,qBAAqB,cAAc,uHAC7D,qBAAqB,KAAK,qBAAqB,cAAc,oFAAoF,eAAe,uBACtK;EACA,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,gBAAgB;CACvB;AACF;;AAGA,IAAM,+BAAN,cAA2C,UAAU;CACnD;CAEA,YAAY,MAAc,MAAc;EACtC,MACE,2BAA2B,KAAK,QAAQ,KAAK,6EAC/C;EACA,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF;AAEA,MAAM,mCAAmB,IAAI,IAAa;CAAC,OAAO;CAAW,MAAM;CAAW;AAAI,CAAC;;;;;;;AAQnF,SAAS,UAAU,QAA0B;CAC3C,MAAM,OAAkB,CAAC;CACzB,MAAM,SAAS,OAAgB,SAAuB;EACpD,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;EACjD,IAAI,iBAAiB,KAAK,MAAM,IAAI,6BAA6B,MAAM,KAAK;EAC5E,IAAI,iBAAiB,KAAK,MAAM,IAAI,6BAA6B,MAAM,KAAK;EAC5E,IAAI,iBAAiB,MAAM,MAAM,IAAI,6BAA6B,MAAM,MAAM;EAC9E,IAAI,YAAY,OAAO,KAAK,KAAK,iBAAiB,aAChD,MAAM,IAAI,6BAA6B,MAAM,eAAe;EAE9D,IAAI,CAAC,iBAAiB,IAAI,OAAO,eAAe,KAAK,CAAC,GACpD,MAAM,IAAI,6BAA6B,MAAM,gBAAgB;EAE/D,IAAI,KAAK,SAAS,KAAK,GAAG,MAAM,IAAI,6BAA6B,MAAM,OAAO;E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,QACA,MACA,OACwB;CACxB,MAAM,OAAO,QAAQ,QAAQ,IAAI;CACjC,IAAI;EACF,OAAO,MAAM,MAAM,SAAS,MAAM,MAAM,GAAG,IAAI;CACjD,SAAS,OAAO;EACd,IAAI,aAAa,KAAK,GAAG,OAAO,KAAA;EAChC,MAAM;CACR;AACF;AAEA,SAAS,kBAAkB,MAAc,MAAuB;CAC9D,IAAI;EACF,OAAO,KAAK,MAAM,IAAI;CACxB,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,qBAAqB,KAAK,qBAAqB,EAAE,MAAM,CAAC;CAC1E;AACF;;AAGA,SAAgB,kBAAkB,MAAc,MAAyC;CACvF,MAAM,SAAS,kBAAkB,MAAM,IAAI;CAC3C,MAAM,SAAS;CACf,IACE,OAAO,WAAW,YAClB,WAAW,QACX,OAAO,OAAO,SAAS,YACvB,OAAO,OAAO,SAAS,YACvB,OAAO,SAAS,QAChB,OAAO,OAAO,KAAK,SAAS,UAE5B,MAAM,IAAI,MAAM,qBAAqB,KAAK,+CAA+C;CAE3F,OAAO;AACT;;AAGA,eAAsB,kBAAkB,QAA2D;CACjG,OAAO,iBAAiB,QAAQ,sBAAsB,MAAM,SAAS;EACnE,MAAM,SAAS,kBAAkB,MAAM,IAAI;EAC3C,MAAM,SAAS;EACf,IACE,OAAO,WAAW,YAClB,WAAW,QACX,OAAO,OAAO,UAAU,YACxB,OAAO,OAAO,cAAc,YAC5B,OAAO,OAAO,OAAO,YACrB,OAAO,OAAO,OAAO,SAAS,YAC9B,OAAO,OAAO,MAAM,YAAY,YAC/B,OAAO,eAAe,KAAA,MACpB,OAAO,OAAO,WAAW,QAAQ,YAAY,OAAO,OAAO,WAAW,WAAW,WAEpF,MAAM,IAAI,MAAM,qBAAqB,KAAK,yBAAyB;EAErE,OAAO;CACT,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"settle-record-WWQasnDq.js","names":[],"sources":["../src/durable/settle-record.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises'\nimport { resolve } from 'node:path'\nimport {\n type AgentProfile,\n canonicalCandidateDigest,\n canonicalCandidateJson,\n} from '@tangle-network/agent-interface'\nimport {\n publishExclusiveDurableFile,\n writeAtomicDurableFile,\n} from '../runtime/supervise/durable-file'\nimport { terminalAccounting } from '../runtime/supervise/supervisor-accounting'\nimport type { RootStreamReceipt, SupervisedResult } from '../runtime/supervise/types'\nimport { isNoEntError } from './jsonl-file'\nimport { FileSpawnJournal } from './spawn-journal/journal-store'\n\n/** Terminal evidence has one result per segment. Reopen archives that result byte for byte;\n * a failed attempt may resume because failure.json records only the latest throw.\n * Serialization, exclusive publication and validation stay with the record operations below.\n */\n\n/** The settle record: the returned `SupervisedResult` as canonical JSON, written once. */\nexport const SETTLE_RECORD_FILE = 'result.json'\n/** The failure record: the most recent throw, replaced by a later throw. */\nexport const FAILURE_RECORD_FILE = 'failure.json'\n\n/** What `failure.json` records about the most recent throw. */\nexport interface DurableFailureRecord {\n readonly runId: string\n readonly pursuitId: string\n /** ISO instant the throw was recorded. */\n readonly at: string\n readonly error: { readonly name: string; readonly message: string }\n /** The root's retained provider stream at the time of the throw, when the directory holds one:\n * a root that died mid-turn keeps what it had streamed, and this names it. */\n readonly rootStream?: RootStreamReceipt\n}\n\n/** The directory already holds a settle record, so the run it records must not be re-entered. */\nexport class SettledRunDirectoryError extends Error {\n readonly path: string\n /** The root of the recorded run, which is its `runId`. */\n readonly recordedRunId: string\n\n constructor(path: string, recordedRunId: string, requestedRunId: string) {\n super(\n recordedRunId === requestedRunId\n ? `supervisePursuit: ${path} records that run '${recordedRunId}' already settled; a settled run is not re-entered unless the call passes reopen: { operator, reason, operationId }`\n : `supervisePursuit: ${path} records that run '${recordedRunId}' already settled in this directory; a directory holds one settle record, so run '${requestedRunId}' needs its own runDir`,\n )\n this.name = 'SettledRunDirectoryError'\n this.path = path\n this.recordedRunId = recordedRunId\n }\n}\n\n/** A result member whose JSON form would misstate it. */\nclass UnrecordableSettleValueError extends TypeError {\n readonly path: string\n\n constructor(path: string, kind: string) {\n super(\n `supervisePursuit: result${path} is a ${kind}, which JSON cannot record faithfully; a settle record holds plain data only`,\n )\n this.name = 'UnrecordableSettleValueError'\n this.path = path\n }\n}\n\nconst PLAIN_PROTOTYPES = new Set<unknown>([Object.prototype, Array.prototype, null])\n\n/**\n * The JSON value of a result, or a throw naming the first member JSON would misstate. An\n * `undefined` member and a function are dropped, exactly as any JSON consumer drops them; a Map,\n * a Set, a Date, a typed array, or a class instance would be rewritten to `{}` or a string and\n * so is refused.\n */\nfunction jsonValue(result: unknown): unknown {\n const seen: unknown[] = []\n const visit = (value: unknown, path: string): void => {\n if (value === null || typeof value !== 'object') return\n if (value instanceof Map) throw new UnrecordableSettleValueError(path, 'Map')\n if (value instanceof Set) throw new UnrecordableSettleValueError(path, 'Set')\n if (value instanceof Date) throw new UnrecordableSettleValueError(path, 'Date')\n if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) {\n throw new UnrecordableSettleValueError(path, 'binary buffer')\n }\n if (!PLAIN_PROTOTYPES.has(Object.getPrototypeOf(value))) {\n throw new UnrecordableSettleValueError(path, 'class instance')\n }\n if (seen.includes(value)) throw new UnrecordableSettleValueError(path, 'cycle')\n seen.push(value)\n if (Array.isArray(value)) {\n for (const [index, item] of value.entries()) visit(item, `${path}[${index}]`)\n } else {\n for (const [key, item] of Object.entries(value)) visit(item, `${path}.${key}`)\n }\n seen.pop()\n }\n visit(result, '')\n return JSON.parse(JSON.stringify(result))\n}\n\n/**\n * The exact bytes `result.json` holds for a result: its JSON value serialized as RFC 8785\n * canonical JSON. Throws `UnrecordableSettleValueError` before any byte is written when the\n * result carries a value JSON would misstate.\n */\nexport function settleRecordJson(result: unknown): string {\n return canonicalCandidateJson(jsonValue(result))\n}\n\n/** The digest the settle record's bytes hash to: the candidate digest of the result's JSON value. */\nexport function settleRecordDigest(result: unknown): string {\n return canonicalCandidateDigest(jsonValue(result))\n}\n\n/** Publish `result.json` in the run directory once. Throws when a record is already there. */\nexport async function writeSettleRecord(runDir: string, result: unknown): Promise<string> {\n const path = resolve(runDir, SETTLE_RECORD_FILE)\n if (!publishExclusiveDurableFile(path, settleRecordJson(result))) {\n throw new Error(`supervisePursuit: ${path} already exists; a settle record is written once`)\n }\n return path\n}\n\n/** Replace `failure.json` in the run directory with the most recent throw. */\nexport async function writeFailureRecord(\n runDir: string,\n record: DurableFailureRecord,\n): Promise<string> {\n const path = resolve(runDir, FAILURE_RECORD_FILE)\n writeAtomicDurableFile(path, `${JSON.stringify(record, null, 2)}\\n`)\n return path\n}\n\n/**\n * Read the settle record a run directory holds, or `undefined` when it holds none. A file that\n * is present but is not a settle record is corruption and fails loud. `usage` annotates legacy\n * results by replay without changing their sealed fields; recorded usage always wins.\n */\nexport async function readSettleRecord(\n runDir: string,\n options: { readonly usage?: boolean; readonly requestedProfile?: AgentProfile } = {},\n): Promise<SupervisedResult<unknown> | undefined> {\n const recorded = await readTerminalFile(runDir, SETTLE_RECORD_FILE, parseSettleRecord)\n if (!recorded || !options.usage || recorded.usage) return recorded\n const { usage } = await terminalAccounting(\n new FileSpawnJournal(resolve(runDir, 'spawn-journal.jsonl')),\n recorded.tree.root,\n recorded.spentTotal.ms,\n options.requestedProfile,\n )\n return { ...recorded, usage }\n}\n\nasync function readTerminalFile<T>(\n runDir: string,\n file: string,\n parse: (text: string, path: string) => T,\n): Promise<T | undefined> {\n const path = resolve(runDir, file)\n try {\n return parse(await readFile(path, 'utf8'), path)\n } catch (error) {\n if (isNoEntError(error)) return undefined\n throw error\n }\n}\n\nfunction parseTerminalJson(text: string, path: string): unknown {\n try {\n return JSON.parse(text)\n } catch (cause) {\n throw new Error(`supervisePursuit: ${path} is not valid JSON`, { cause })\n }\n}\n\n/** Parse settle-record bytes already read, so a caller hashes and parses the same bytes. */\nexport function parseSettleRecord(text: string, path: string): SupervisedResult<unknown> {\n const parsed = parseTerminalJson(text, path)\n const record = parsed as { kind?: unknown; tree?: { root?: unknown } }\n if (\n typeof record !== 'object' ||\n record === null ||\n typeof record.kind !== 'string' ||\n typeof record.tree !== 'object' ||\n record.tree === null ||\n typeof record.tree.root !== 'string'\n ) {\n throw new Error(`supervisePursuit: ${path} is not a settle record (no kind or tree.root)`)\n }\n return parsed as SupervisedResult<unknown>\n}\n\n/** Read the most recent failure record, or `undefined` when the directory holds none. */\nexport async function readFailureRecord(runDir: string): Promise<DurableFailureRecord | undefined> {\n return readTerminalFile(runDir, FAILURE_RECORD_FILE, (text, path) => {\n const parsed = parseTerminalJson(text, path)\n const record = parsed as Partial<DurableFailureRecord>\n if (\n typeof record !== 'object' ||\n record === null ||\n typeof record.runId !== 'string' ||\n typeof record.pursuitId !== 'string' ||\n typeof record.at !== 'string' ||\n typeof record.error?.name !== 'string' ||\n typeof record.error.message !== 'string' ||\n (record.rootStream !== undefined &&\n (typeof record.rootStream.ref !== 'string' || typeof record.rootStream.events !== 'number'))\n ) {\n throw new Error(`supervisePursuit: ${path} is not a failure record`)\n }\n return parsed as DurableFailureRecord\n })\n}\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAa,qBAAqB;;AAElC,MAAa,sBAAsB;;AAenC,IAAa,2BAAb,cAA8C,MAAM;CAClD;;CAEA;CAEA,YAAY,MAAc,eAAuB,gBAAwB;EACvE,MACE,kBAAkB,iBACd,qBAAqB,KAAK,qBAAqB,cAAc,uHAC7D,qBAAqB,KAAK,qBAAqB,cAAc,oFAAoF,eAAe,uBACtK;EACA,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,gBAAgB;CACvB;AACF;;AAGA,IAAM,+BAAN,cAA2C,UAAU;CACnD;CAEA,YAAY,MAAc,MAAc;EACtC,MACE,2BAA2B,KAAK,QAAQ,KAAK,6EAC/C;EACA,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF;AAEA,MAAM,mCAAmB,IAAI,IAAa;CAAC,OAAO;CAAW,MAAM;CAAW;AAAI,CAAC;;;;;;;AAQnF,SAAS,UAAU,QAA0B;CAC3C,MAAM,OAAkB,CAA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AsB,MAAM,SAAS;EACnE,MAAM,SAAS,kBAAkB,MAAM,IAAI;EAC3C,MAAM,SAAS;EACf,IACE,OAAO,WAAW,YAClB,WAAW,QACX,OAAO,OAAO,UAAU,YACxB,OAAO,OAAO,cAAc,YAC5B,OAAO,OAAO,OAAO,YACrB,OAAO,OAAO,OAAO,SAAS,YAC9B,OAAO,OAAO,MAAM,YAAY,YAC/B,OAAO,eAAe,KAAA,MACpB,OAAO,OAAO,WAAW,QAAQ,YAAY,OAAO,OAAO,WAAW,WAAW,WAEpF,MAAM,IAAI,MAAM,qBAAqB,KAAK,yBAAyB;EAErE,OAAO;CACT,CAAC;AACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as ValidationError } from "./errors-
|
|
1
|
+
import { m as ValidationError } from "./errors-DG8yufqX.js";
|
|
2
2
|
import { REDACTION_VERSION, redact } from "@tangle-network/agent-eval/traces";
|
|
3
3
|
// src/redact.ts
|
|
4
4
|
/**
|
|
@@ -45,7 +45,8 @@ function resolveRedactor(redact) {
|
|
|
45
45
|
const maxCauseDepth = 4;
|
|
46
46
|
const maxMessageLength = 32768;
|
|
47
47
|
const maxPartLength = 2048;
|
|
48
|
-
/** A persisted failure must explain its wrappers without exporting credentials or unbounded data.
|
|
48
|
+
/** A persisted failure must explain its wrappers without exporting credentials or unbounded data.
|
|
49
|
+
* Redaction runs per line so one credential cannot erase the lines around it. */
|
|
49
50
|
function errorText(value) {
|
|
50
51
|
let text;
|
|
51
52
|
try {
|
|
@@ -53,7 +54,7 @@ function errorText(value) {
|
|
|
53
54
|
} catch {
|
|
54
55
|
text = "[unprintable rejection]";
|
|
55
56
|
}
|
|
56
|
-
return String(defaultRedactor(
|
|
57
|
+
return text.split("\n").map((line) => String(defaultRedactor(line))).join("\n").slice(0, maxMessageLength);
|
|
57
58
|
}
|
|
58
59
|
function errorProperty(error, field) {
|
|
59
60
|
try {
|
|
@@ -120,6 +121,19 @@ function causeChain(error) {
|
|
|
120
121
|
}
|
|
121
122
|
return chain;
|
|
122
123
|
}
|
|
124
|
+
const maxStackFrames = 40;
|
|
125
|
+
/** The deepest cause's stack that has one, redacted and bounded to {@link maxStackFrames} frames,
|
|
126
|
+
* so a failure the messages alone cannot place still names its throw site (#2347). Outer
|
|
127
|
+
* wrappers' stacks are skipped: they restate the wrap site the record's own fields name. */
|
|
128
|
+
function errorStack(error) {
|
|
129
|
+
let found;
|
|
130
|
+
for (const value of causeChain(error)) {
|
|
131
|
+
if (!(value instanceof Error)) continue;
|
|
132
|
+
const stack = errorProperty(value, "stack");
|
|
133
|
+
if (stack !== void 0 && stack !== "[unreadable error stack]") found = stack;
|
|
134
|
+
}
|
|
135
|
+
return found === void 0 ? void 0 : found.split("\n").slice(0, maxStackFrames).join("\n");
|
|
136
|
+
}
|
|
123
137
|
// src/runtime/supervise/snapshot.ts
|
|
124
138
|
/** Deeply detach and freeze untrusted data at a runtime decision boundary. The clone prevents the
|
|
125
139
|
* caller from mutating it later; the freeze prevents downstream code from mutating the snapshot.
|
|
@@ -205,6 +219,6 @@ function deepFreeze(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
205
219
|
for (const child of Object.values(value)) deepFreeze(child, seen);
|
|
206
220
|
return Object.freeze(value);
|
|
207
221
|
}
|
|
208
|
-
export { errMessage as a,
|
|
222
|
+
export { errMessage as a, errorStack as c, defaultRedactorIdentityMaterial as d, resolveRedactor as f, causeChain as i, errorText as l, detachedSnapshot as n, errorHttpStatus as o, shareParsedStrings as r, errorProperty as s, detachedFrozen as t, defaultRedactor as u };
|
|
209
223
|
|
|
210
|
-
//# sourceMappingURL=snapshot-
|
|
224
|
+
//# sourceMappingURL=snapshot-BKI_w3JD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot-BKI_w3JD.js","names":[],"sources":["../src/redact.ts","../src/runtime/supervise/error-message.ts","../src/runtime/supervise/snapshot.ts"],"sourcesContent":["/**\n * Redaction for values that may leave the Runtime process. The built-in\n * redactor is agent-eval's redaction core (`@tangle-network/agent-eval/traces`,\n * default profile): credentials found by field name or value shape are\n * replaced whole, email, card, SSN and phone values in place, and token counts\n * such as `inputTokens` or `max_tokens` are kept. A customer with\n * domain-specific PII supplies their own `redact` hook.\n *\n * This is narrower than `src/sanitize.ts`, which drops fields of the runtime's\n * *event envelope* unless the caller opts in: here the value is opaque customer\n * payload, so the scrub is value-shaped, not schema-shaped.\n *\n * @experimental\n */\n\nimport { REDACTION_VERSION, redact } from '@tangle-network/agent-eval/traces'\n\n/** A redactor maps an arbitrary trace value to a safe-to-export value. Pure;\n * must not throw on cyclic input (the default tolerates cycles). */\nexport type Redactor = (value: unknown) => unknown\n\n/**\n * The built-in redactor. Cycle-safe, depth-bounded and total: it never throws\n * on customer input and never mutates it.\n */\nexport function defaultRedactor(value: unknown): unknown {\n return redact(value).value\n}\n\n/** Stable identity input for saved work that depends on built-in redaction behavior. */\nexport function defaultRedactorIdentityMaterial(): unknown {\n return {\n core: '@tangle-network/agent-eval/traces redact',\n profile: 'default',\n version: REDACTION_VERSION,\n }\n}\n\n/**\n * Resolve the redactor a client uses. A caller-supplied hook handles\n * domain-specific values first, then the built-in scrubber still removes\n * credentials and personal data. Returning `false` is the explicit opt-out for\n * already-reviewed public values.\n */\nexport function resolveRedactor(redact: Redactor | false | undefined): Redactor {\n if (redact === false) return (value) => value\n if (!redact) return defaultRedactor\n return (value) => defaultRedactor(redact(value))\n}\n","import { defaultRedactor } from '../../redact'\n\nconst maxCauseDepth = 4\nconst maxMessageLength = 32_768\nconst maxPartLength = 2_048\n\n/** A persisted failure must explain its wrappers without exporting credentials or unbounded data.\n * Redaction runs per line so one credential cannot erase the lines around it. */\nexport function errorText(value: unknown): string {\n let text: string\n try {\n text = typeof value === 'string' ? value : (JSON.stringify(value) ?? String(value))\n } catch {\n text = '[unprintable rejection]'\n }\n const lines = text.split('\\n').map((line) => String(defaultRedactor(line)))\n return lines.join('\\n').slice(0, maxMessageLength)\n}\n\nexport function errorProperty(\n error: Error,\n field: 'name' | 'message' | 'stack',\n): string | undefined {\n try {\n const value = error[field]\n return value === undefined\n ? undefined\n : errorText(value).slice(0, field === 'name' ? 256 : maxMessageLength)\n } catch {\n return `[unreadable error ${field}]`\n }\n}\n\n/** An HTTP status carried on a thrown error, read without trusting its getter. Provider SDKs put\n * one on their own error classes, so this is how a refusal is recognised outside the transport\n * taxonomy — for the persisted message here, and for the driver's retry verdict. */\nexport function errorHttpStatus(error: Error): number | undefined {\n try {\n const status: unknown = Reflect.get(error, 'status')\n return typeof status === 'number' && Number.isInteger(status) && status >= 100 && status <= 599\n ? status\n : undefined\n } catch {\n return undefined\n }\n}\n\n/** Shared by child settlements, driver attempts, and the final no-winner result. */\nexport function errMessage(error: unknown): string {\n const parts: string[] = []\n const seen = new Set<Error>()\n let current = error\n for (let depth = 0; depth <= maxCauseDepth; depth += 1) {\n try {\n if (!(current instanceof Error)) {\n parts.push(errorText(current).slice(0, maxPartLength))\n break\n }\n if (seen.has(current)) {\n parts.push('[circular]')\n break\n }\n seen.add(current)\n const status = errorHttpStatus(current)\n const message =\n (status === undefined ? '' : `HTTP ${status}: `) + (errorProperty(current, 'message') ?? '')\n // An AggregateError's members carry its evidence: name each, one level deep.\n const members: unknown = Reflect.get(current, 'errors')\n const named = Array.isArray(members)\n ? ` [${members.map((m) => (m instanceof Error ? `${errorProperty(m, 'name')}: ${errorProperty(m, 'message')}` : errorText(m))).join('; ')}]`\n : ''\n const part = depth === 0 ? message : `${errorProperty(current, 'name')}: ${message}`\n parts.push(`${part}${named}`.slice(0, maxPartLength))\n current = current.cause\n if (current === undefined || current === null) break\n if (depth === maxCauseDepth) parts.push('[cause chain truncated]')\n } catch {\n parts.push('[unreadable error cause]')\n break\n }\n }\n return parts.join(': caused by ').slice(0, maxMessageLength)\n}\n\n/** The error and its causes (`cause`, and `errors` members), bounded and cycle-safe. */\nexport function causeChain(error: unknown): object[] {\n const chain: object[] = []\n const queue: unknown[] = [error]\n while (queue.length > 0 && chain.length < 12) {\n const value = queue.shift()\n if (typeof value !== 'object' || value === null || chain.includes(value)) continue\n chain.push(value)\n try {\n const errors: unknown = Reflect.get(value, 'errors')\n if (Array.isArray(errors)) queue.push(...errors)\n queue.push(Reflect.get(value, 'cause'))\n } catch {\n // A cause that cannot be read ends this branch of the walk.\n }\n }\n return chain\n}\n\nconst maxStackFrames = 40\n\n/** The deepest cause's stack that has one, redacted and bounded to {@link maxStackFrames} frames,\n * so a failure the messages alone cannot place still names its throw site (#2347). Outer\n * wrappers' stacks are skipped: they restate the wrap site the record's own fields name. */\nexport function errorStack(error: unknown): string | undefined {\n let found: string | undefined\n for (const value of causeChain(error)) {\n if (!(value instanceof Error)) continue\n const stack = errorProperty(value, 'stack')\n if (stack !== undefined && stack !== '[unreadable error stack]') found = stack\n }\n return found === undefined ? undefined : found.split('\\n').slice(0, maxStackFrames).join('\\n')\n}\n","import { ValidationError } from '../../errors'\n\n/** Deeply detach and freeze untrusted data at a runtime decision boundary. The clone prevents the\n * caller from mutating it later; the freeze prevents downstream code from mutating the snapshot.\n * Strings are immutable, so the snapshot shares the caller's strings instead of copying them. */\nexport function detachedSnapshot<T>(value: T, context: string): T {\n let clone: T\n try {\n clone = structuredClone(value)\n } catch (error) {\n throw new ValidationError(`${context}: input must be structured-cloneable`, { cause: error })\n }\n return deepFreeze(shareSourceStrings(value, clone))\n}\n\n/** Detach a value from its caller and freeze it, without the `ValidationError` framing\n * {@link detachedSnapshot} adds. For a boundary that has already validated its input. */\nexport function detachedFrozen<T>(value: T): T {\n return deepFreeze(shareSourceStrings(value, structuredClone(value)))\n}\n\n/**\n * Point each string in a fresh structured clone at the equal string in its source.\n *\n * `structuredClone` copies every string, and a copied string buys no isolation: only objects and\n * arrays can change through a shared reference. A spawned profile passes several boundaries, and\n * each one kept its own copy: in a reproduction of Discovery's hosted coordinator, a child profile\n * that mounts a 5.3 MB file packet was held four times per spawned child. A scope keeps every\n * child it spawned, so the heap grew about 22 MB per spawn, and hosted coordinators died with V8\n * heap OOM after 37 spawns.\n *\n * The walk pairs only own data properties of plain objects and arrays. Accessors, Maps, Sets and\n * other cloned types keep the clone's values. A string is replaced only by a string equal to it,\n * so the snapshot holds exactly the clone's value. The snapshot keeps the source's strings alive.\n */\nfunction shareSourceStrings<T>(source: unknown, clone: T): T {\n const visited = new Set<object>()\n const visit = (from: unknown, to: unknown): void => {\n if (from === null || to === null || typeof from !== 'object' || typeof to !== 'object') return\n const array = Array.isArray(to)\n if (array !== Array.isArray(from)) return\n if (!array && Object.getPrototypeOf(to) !== Object.prototype) return\n if (visited.has(to)) return\n visited.add(to)\n const target = to as Record<string, unknown>\n for (const key of Object.keys(target)) {\n const own = Object.getOwnPropertyDescriptor(from, key)\n if (own === undefined || !('value' in own)) continue\n const cloned = target[key]\n if (typeof cloned === 'string') {\n if (own.value === cloned) target[key] = own.value\n } else visit(own.value, cloned)\n }\n }\n visit(source, clone)\n return clone\n}\n\n/**\n * Replace each string in a freshly parsed JSON value with an equal string already in `pool`, and\n * add the new ones. One recovery pass parses every interrupted child's profile from its own blob,\n * so children that carry the same file packet would otherwise hold one copy each. The value is\n * updated in place, so it must belong to the caller; frozen objects are left as they are.\n */\nexport function shareParsedStrings<T>(value: T, pool: Map<string, string>): T {\n const visit = (node: unknown): void => {\n if (node === null || typeof node !== 'object' || Object.isFrozen(node)) return\n if (!Array.isArray(node) && Object.getPrototypeOf(node) !== Object.prototype) return\n const target = node as Record<string, unknown>\n for (const key of Object.keys(target)) {\n const item = target[key]\n if (typeof item !== 'string') {\n visit(item)\n continue\n }\n const shared = pool.get(item)\n if (shared === undefined) pool.set(item, item)\n else target[key] = shared\n }\n }\n visit(value)\n return value\n}\n\nfunction deepFreeze<T>(value: T, seen = new Set<object>()): T {\n // `Object.freeze` throws `TypeError: Cannot freeze array buffer views with elements` on any\n // non-empty TypedArray or Buffer, so binary inside a payload must be handed back untouched\n // rather than frozen. Its bytes are already detached by the `structuredClone` above.\n if (value === null || typeof value !== 'object' || ArrayBuffer.isView(value) || seen.has(value)) {\n return value\n }\n seen.add(value)\n for (const child of Object.values(value as Record<string, unknown>)) deepFreeze(child, seen)\n return Object.freeze(value)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,gBAAgB,OAAyB;CACvD,OAAO,OAAO,KAAK,CAAC,CAAC;AACvB;;AAGA,SAAgB,kCAA2C;CACzD,OAAO;EACL,MAAM;EACN,SAAS;EACT,SAAS;CACX;AACF;;;;;;;AAQA,SAAgB,gBAAgB,QAAgD;CAC9E,IAAI,WAAW,OAAO,QAAQ,UAAU;CACxC,IAAI,CAAC,QAAQ,OAAO;CACpB,QAAQ,UAAU,gBAAgB,OAAO,KAAK,CAAC;AACjD;;AC9CA,MAAM,gBAAgB;AACtB,MAAM,mBAAmB;AACzB,MAAM,gBAAgB;;;AAItB,SAAgB,UAAU,OAAwB;CAChD,IAAI;CACJ,IAAI;EACF,OAAO,OAAO,UAAU,WAAW,QAAS,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;CACnF,QAAQ;EACN,OAAO;CACT;CAEA,OADc,KAAK,MAAM,IAAI,CAAC,CAAC,KAAK,SAAS,OAAO,gBAAgB,IAAI,CAAC,CAC9D,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,GAAG,gBAAgB;AACnD;AAEA,SAAgB,cACd,OACA,OACoB;CACpB,IAAI;EACF,MAAM,QAAQ,MAAM;EACpB,OAAO,UAAU,KAAA,IACb,KAAA,IACA,UAAU,KAAK,CAAC,CAAC,MAAM,GAAG,UAAU,SAAS,MAAM,gBAAgB;CACzE,QAAQ;EACN,OAAO,qBAAqB,MAAM;CACpC;AACF;;;;AAKA,SAAgB,gBAAgB,OAAkC;CAChE,IAAI;EACF,MAAM,SAAkB,QAAQ,IAAI,OAAO,QAAQ;EACnD,OAAO,OAAO,WAAW,YAAY,OAAO,UAAU,MAAM,KAAK,UAAU,OAAO,UAAU,MACxF,SACA,KAAA;CACN,QAAQ;EACN;CACF;AACF;;AA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AS,OAAO,OAAO,KAAgC,GAAG,WAAW,OAAO,IAAI;CAC3F,OAAO,OAAO,OAAO,KAAK;AAC5B"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Br as
|
|
2
|
-
import { m as ValidationError, p as SessionMismatchError, r as BackendTransportError } from "./errors-
|
|
3
|
-
import { I as armDeadlineTimer, c as errorMessage, f as isAsyncIterable } from "./util-
|
|
4
|
-
import { ct as
|
|
5
|
-
import { C as createExecutor,
|
|
6
|
-
import { c as profileModelExecutionSettings, g as observedModelMatchesDeclared, i as concreteModelId, l as profileProviderModel, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile } from "./model-policy-
|
|
7
|
-
import { z as sha256Bytes$1 } from "./workspace-streams-
|
|
1
|
+
import { $r as awaitAbortable, Br as runtimeOwnedPendingExecutorMaterialization, Dr as knownExecutionBindingReceipt, Gr as executableAgentProfileSnapshot, Lr as runtimeOwnedExecutorExecutionBinding, Or as knownMaterializationReceipt, Rr as runtimeOwnedExecutorMaterialization, Ur as unknownExecutionBindingReceipt, Wr as unknownMaterializationReceipt, di as providerMessageText, li as promptFromAgentTurnInput, ui as promptOptionsFromAgentTurnInput, wr as authoredProfileDigest } from "./supervisor-accounting-Bw4MJk-b.js";
|
|
2
|
+
import { m as ValidationError, p as SessionMismatchError, r as BackendTransportError } from "./errors-DG8yufqX.js";
|
|
3
|
+
import { I as armDeadlineTimer, c as errorMessage, f as isAsyncIterable } from "./util-fcckrkKp.js";
|
|
4
|
+
import { ct as terminalTextFromSandboxEvent, ht as createSandboxUsageLedger, it as mapSandboxToolEvent, lt as canonicalStreamEventFromSandboxEvent, n as runtimeFailureCause, nt as createSandboxToolPartState, rt as mapSandboxEvent } from "./failure-cause-CVB-YE88.js";
|
|
5
|
+
import { C as createExecutor, Qt as readSandboxOutcome, S as captureReusableExecutorConfig, Zt as projectSandboxOutcome, _ as withDriverExecutor, b as createExecutorRegistry, n as createSupervisor, v as InMemoryResultBlobStore, y as InMemorySpawnJournal } from "./supervisor-Dpeu7rnZ.js";
|
|
6
|
+
import { c as profileModelExecutionSettings, g as observedModelMatchesDeclared, i as concreteModelId, l as profileProviderModel, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile } from "./model-policy-yxOrDTTj.js";
|
|
7
|
+
import { z as sha256Bytes$1 } from "./workspace-streams-DA9R3j-p.js";
|
|
8
8
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, renderInputPartsAsText } from "@tangle-network/agent-interface";
|
|
9
9
|
import { costForTokenPricing, makeProposalFinding, scoreKnowledgeReadiness } from "@tangle-network/agent-eval";
|
|
10
10
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
@@ -702,52 +702,16 @@ function deriveTurnSignal(callerSignal, timeoutMs) {
|
|
|
702
702
|
}
|
|
703
703
|
// src/runtime/stream-agent-turn.ts
|
|
704
704
|
/**
|
|
705
|
-
* `streamAgentTurn`
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
* `
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
-
* `
|
|
712
|
-
* `
|
|
713
|
-
* `
|
|
714
|
-
*
|
|
715
|
-
* summary plus the full event list.
|
|
716
|
-
*
|
|
717
|
-
* This is a UNIFICATION seam, not a new stream parser — each kind is a thin
|
|
718
|
-
* adapter over code that already exists and is already hardened:
|
|
719
|
-
* - `box` — `mapSandboxEvent` projects the sandbox event stream and one
|
|
720
|
-
* `SandboxUsageLedger` (sandbox-events.ts) meters it, so a harness
|
|
721
|
-
* that reports usage only in its own event is counted once per turn;
|
|
722
|
-
* its requested profile is explicitly recorded as unverified because
|
|
723
|
-
* the box already exists.
|
|
724
|
-
* - `executor` — Runtime materializes the exact `AgentProfile`, records its
|
|
725
|
-
* identity receipts, drives the executor once, and tears it
|
|
726
|
-
* down after capturing the terminal artifact.
|
|
727
|
-
* - `chat` — the backend's own `stream()` surface, normalized by
|
|
728
|
-
* `normalizeBackendStreamEvent`; its requested profile is likewise
|
|
729
|
-
* unverified because an arbitrary backend cannot attest its setup.
|
|
730
|
-
*
|
|
731
|
-
* Distinct from `openSandboxRun` (box-only, session resume over one persistent
|
|
732
|
-
* artifact, raw `SandboxEvent` deliverables) and from `runAgentTaskStream`
|
|
733
|
-
* (full task lifecycle: knowledge preflight, session store, resume). This is
|
|
734
|
-
* the minimal turn primitive underneath both worlds: prompt in, one normalized
|
|
735
|
-
* event stream out, terminal result+usage guaranteed on every non-thrown path.
|
|
736
|
-
*
|
|
737
|
-
* Stream envelope: `backend_start` → incremental events → (`backend_error` on
|
|
738
|
-
* failure) → `final`. A caller-initiated abort terminates with
|
|
739
|
-
* `final.status: 'aborted'`; an expired `timeoutMs` deadline with
|
|
740
|
-
* `final.status: 'failed'` — so cancellation stays distinguishable from a
|
|
741
|
-
* blown deadline.
|
|
742
|
-
*
|
|
743
|
-
* Mid-stream lifecycle work needs NO extra API: the generator is pull-based,
|
|
744
|
-
* so the producer is suspended between yields and resumes only when the caller
|
|
745
|
-
* pulls again. A consumer can therefore run arbitrary async work between
|
|
746
|
-
* events — sync state on each `tool_result`, decide a no-op retry after
|
|
747
|
-
* draining, run a pre-`done` flush when it receives `final` and BEFORE it
|
|
748
|
-
* forwards its own terminal event downstream. The interleaving is guaranteed
|
|
749
|
-
* (and locked by test): nothing is produced past the event the caller is
|
|
750
|
-
* holding.
|
|
705
|
+
* `streamAgentTurn` is the one run-a-turn event stream for a sandbox box, a one-shot `Executor`,
|
|
706
|
+
* and an in-process `AgentExecutionBackend`. Every kind yields `RuntimeStreamEvent` and ends with
|
|
707
|
+
* `final` (`text`, `metadata.tokenUsage`, `metadata.costUsd`, `metadata.model`). `collectAgentTurn`
|
|
708
|
+
* drains that. `box` meters with one `SandboxUsageLedger` and records the requested profile
|
|
709
|
+
* unverified. `executor` materializes the `AgentProfile`, drives once, and tears down after the
|
|
710
|
+
* terminal artifact. `chat` normalizes `stream()` and is likewise unverified. This is not
|
|
711
|
+
* `openSandboxRun` or `runAgentTaskStream`. Envelope: `backend_start`, incremental events,
|
|
712
|
+
* `backend_error` on failure, then `final`. Abort ends `final.status: 'aborted'`; `timeoutMs`
|
|
713
|
+
* ends `final.status: 'failed'`. The generator is pull-based, so a consumer can work between events
|
|
714
|
+
* and nothing is produced past the event it holds.
|
|
751
715
|
*
|
|
752
716
|
* @stable
|
|
753
717
|
*/
|
|
@@ -3088,4 +3052,4 @@ function structuralRollout(config = {}) {
|
|
|
3088
3052
|
}
|
|
3089
3053
|
export { defaultAnalystInstruction as A, InMemoryRuntimeSessionStore as B, optimizerMethod as C, runAgentic as D, refine as E, collectAgentTurn as F, nowIso as H, streamAgentTurn as I, createIterableBackend as L, renderReport as M, profileChatClient as N, sample as O, profileOptimizerModelCall as P, createSandboxPromptBackend as R, strategyAuthorSystemPrompt as S, depthStrategy as T, startOrResumeRuntimeSession as U, newRuntimeSession as V, touchSession as W, defineStrategy as _, defaultStructuralRolloutPolicy as a, sampleThenRefine as b, officialChecksFromMeta as c, selectBestIndex as d, structuralRollout as f, authorStrategy as g, assertStrategyContract as h, defaultExtractCandidate as i, observe as j, ObservationError as k, resolveEntrySymbol as l, adaptiveRefine as m, compareCheckOutcomes as n, filterAuthoredAsserts as o, visibleCheckScore as p, composeCheckSources as r, modelAuthoredChecks as s, canDisplace as t, sandboxCheckRunner as u, loadAuthoredStrategy as v, breadthStrategy as w, strategyAuthorContract as x, requestStrategySource as y, normalizeBackendStreamEvent as z };
|
|
3090
3054
|
|
|
3091
|
-
//# sourceMappingURL=structural-rollout-
|
|
3055
|
+
//# sourceMappingURL=structural-rollout-C1xxoWcN.js.map
|