@tangle-network/agent-runtime 0.199.0 → 0.201.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{activation-c3um4SY1.d.ts → activation-BPxs-Iu2.d.ts} +2 -2
- package/dist/{activation-zQWmiiPg.js → activation-C_FN2aqK.js} +2 -2
- package/dist/{activation-zQWmiiPg.js.map → activation-C_FN2aqK.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -3
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop-DZw5QWT9.js +176 -0
- package/dist/analyst-loop-DZw5QWT9.js.map +1 -0
- package/dist/analyst-loop.d.ts +1 -11
- package/dist/analyst-loop.js +2 -2
- package/dist/candidate-execution/index.d.ts +2 -2
- package/dist/candidate-execution/index.js +3 -3
- package/dist/{coordination-driver-vWb7kViA.js → coordination-driver-qdAwriPV.js} +8 -5
- package/dist/{coordination-driver-vWb7kViA.js.map → coordination-driver-qdAwriPV.js.map} +1 -1
- package/dist/{delegate-Ch93bpH5.js → delegate-BWHG-zZW.js} +2 -2
- package/dist/{delegate-Ch93bpH5.js.map → delegate-BWHG-zZW.js.map} +1 -1
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +2 -2
- package/dist/{graph-C6pT08K-.js → graph-cCqKhLqz.js} +3 -3
- package/dist/{graph-C6pT08K-.js.map → graph-cCqKhLqz.js.map} +1 -1
- package/dist/{improvement-cycle-CxZKIbLD.js → improvement-cycle-VH_ZGcIj.js} +5 -5
- package/dist/{improvement-cycle-CxZKIbLD.js.map → improvement-cycle-VH_ZGcIj.js.map} +1 -1
- package/dist/{index-CMTUgh-T.d.ts → index-Br191WbE.d.ts} +190 -142
- package/dist/index.d.ts +6 -5
- package/dist/index.js +28 -49
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +15 -106
- package/dist/intelligence.js +9 -408
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +3 -3
- package/dist/kernel.js +8 -9
- package/dist/{loop-runner-bin-CAf1OQot.d.ts → loop-runner-bin-BNRdsDOn.d.ts} +3 -3
- package/dist/{loop-runner-bin-SNrh585k.js → loop-runner-bin-jQ8hXO9J.js} +4 -4
- package/dist/{loop-runner-bin-SNrh585k.js.map → loop-runner-bin-jQ8hXO9J.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 +3 -3
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +4 -4
- package/dist/{prepare-CAO1yXov.js → prepare-Dc30WRB0.js} +6 -3
- package/dist/prepare-Dc30WRB0.js.map +1 -0
- package/dist/{protected-model-port-BtXp2dUY.d.ts → protected-model-port-BlLP8ja6.d.ts} +2 -2
- package/dist/{protected-model-port-B5avcRiQ.js → protected-model-port-D5gDcnrH.js} +2 -2
- package/dist/{protected-model-port-B5avcRiQ.js.map → protected-model-port-D5gDcnrH.js.map} +1 -1
- package/dist/{provision-supervisor-D5YSCDVD.js → provision-supervisor-BA2-GPth.js} +3 -3
- package/dist/{provision-supervisor-D5YSCDVD.js.map → provision-supervisor-BA2-GPth.js.map} +1 -1
- package/dist/{redact-Dv8WcCKy.js → redact-h-oaw11Q.js} +13093 -11221
- package/dist/redact-h-oaw11Q.js.map +1 -0
- package/dist/{runtime-BN16GbTA.js → runtime-DeqdBVeC.js} +8 -9
- package/dist/{runtime-BN16GbTA.js.map → runtime-DeqdBVeC.js.map} +1 -1
- package/dist/{server-CbNb_N1x.js → server-U_k9NUbk.js} +3 -3
- package/dist/{server-CbNb_N1x.js.map → server-U_k9NUbk.js.map} +1 -1
- package/dist/{stream-agent-turn-CLOQr497.d.ts → stream-agent-turn-CJWthifS.d.ts} +42 -13
- package/dist/{structural-rollout-DANCelu6.js → structural-rollout-BcMmrpv4.js} +2 -3
- package/dist/{structural-rollout-DANCelu6.js.map → structural-rollout-BcMmrpv4.js.map} +1 -1
- package/dist/{supervise-BGNXB8No.js → supervise-DmFO50N6.js} +497 -90
- package/dist/supervise-DmFO50N6.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +13 -13
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-1s_29INY.d.ts → types-CuXu5zuS.d.ts} +3 -2
- package/dist/{workspace-archive-BMOnloFf.js → workspace-archive-CBX0hwL_.js} +2 -2
- package/dist/{workspace-archive-BMOnloFf.js.map → workspace-archive-CBX0hwL_.js.map} +1 -1
- package/package.json +6 -6
- package/dist/analyst-loop-BknOQUW5.js +0 -546
- package/dist/analyst-loop-BknOQUW5.js.map +0 -1
- package/dist/prepare-CAO1yXov.js.map +0 -1
- package/dist/redact-Dv8WcCKy.js.map +0 -1
- package/dist/sandbox-events-DbC2WKKS.js +0 -929
- package/dist/sandbox-events-DbC2WKKS.js.map +0 -1
- package/dist/supervise-BGNXB8No.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyst-loop-DZw5QWT9.js","names":[],"sources":["../src/analyst-loop/run-analyst-loop.ts"],"sourcesContent":["/**\n * `runAnalystLoop` — the one call agent apps reach for to close the\n * recursive-self-improvement loop.\n *\n * 1. Load baseline findings (last run, or the slice the caller specifies)\n * 2. Run the analyst registry with priorFindings injected\n * 3. Persist the new run's findings to the ledger\n * 4. Diff the new run against the baseline\n * 5. Hand the findings to the knowledge proposal source\n * 6. Hand the findings to the agent-surface proposal source\n * 7. Return a single report the consumer renders / persists / acts on.\n *\n * Proposal sources are optional: the loop also works as a plain\n * \"run + diff + report\" primitive.\n */\n\nimport type { AnalystFinding, AnalystRunResult, FindingsDiff } from '@tangle-network/agent-eval'\nimport { diffFindings } from '@tangle-network/agent-eval'\n\nimport type {\n AnalystLoopEvent,\n AnalystRegistryStreamingLike,\n ImprovementReport,\n KnowledgeReport,\n RunAnalystLoopOpts,\n RunAnalystLoopResult,\n} from './types'\n\n/** Analyze a run and apply accepted knowledge and agent-surface proposals. */\nexport async function runAnalystLoop<TProposal = unknown, TEdit = unknown>(\n opts: RunAnalystLoopOpts,\n): Promise<RunAnalystLoopResult<TProposal, TEdit>> {\n const log = opts.log ?? defaultLog\n const strategy = opts.priorFindingsStrategy ?? 'per-kind'\n const emit = makeEmitter(opts.onEvent)\n const startedAt = Date.now()\n\n // 1. Resolve baseline + load prior findings.\n const baselineRunId = resolveBaselineRunId(opts)\n const priorAll: ReadonlyArray<AnalystFinding & { run_id: string }> = baselineRunId\n ? (opts.findingsStore?.loadRun(baselineRunId) ?? [])\n : []\n log('baseline resolved', { baselineRunId, prior_findings: priorAll.length })\n await emit({\n type: 'baseline-resolved',\n runId: opts.runId,\n baselineRunId,\n priorFindingCount: priorAll.length,\n })\n\n // 2. Run the registry. Strategy controls how analysts see priors.\n // When the registry exposes runStream, forward each event verbatim\n // so subscribers see per-analyst progress in real time.\n const priorFindings = buildPriorFindingsInput(priorAll, strategy, opts.registry.list())\n const analystResult = await runRegistry(opts, priorFindings, emit)\n log('analyst run complete', {\n findings: analystResult.findings.length,\n cost_usd: analystResult.total_cost_usd,\n per_analyst: analystResult.per_analyst.map((s) => ({\n id: s.analyst_id,\n status: s.status,\n n: s.findings_count,\n })),\n })\n\n // 3. Persist the new run before proposal generation so the ledger remains\n // the source of truth if a proposal source throws.\n if (opts.findingsStore && analystResult.findings.length > 0) {\n await opts.findingsStore.append(opts.runId, analystResult.findings)\n await emit({\n type: 'findings-persisted',\n runId: opts.runId,\n count: analystResult.findings.length,\n })\n }\n\n // 4. Diff vs baseline.\n let diff: FindingsDiff | null = null\n if (baselineRunId && analystResult.findings.length > 0) {\n diff = diffFindings(\n priorAll.map((f) => ({ ...f })),\n analystResult.findings.map((f) => ({ ...f, run_id: opts.runId })),\n )\n log('diff vs baseline', {\n appeared: diff.appeared.length,\n disappeared: diff.disappeared.length,\n persisted: diff.persisted.length,\n changed: diff.changed.length,\n })\n await emit({\n type: 'diff-computed',\n runId: opts.runId,\n baselineRunId,\n appeared: diff.appeared.length,\n disappeared: diff.disappeared.length,\n persisted: diff.persisted.length,\n changed: diff.changed.length,\n })\n }\n\n // 5. Knowledge proposals. This loop never writes live knowledge.\n let knowledge: KnowledgeReport<TProposal> | null = null\n if (opts.knowledgeProposalSource) {\n knowledge = await runKnowledgeProposalSource(opts, analystResult.findings, log, emit)\n }\n\n // 6. Agent-surface proposals. This loop never writes live agent state.\n let improvement: ImprovementReport<TEdit> | null = null\n if (opts.improvementProposalSource) {\n improvement = await runImprovementProposalSource(opts, analystResult.findings, log, emit)\n }\n\n const durationMs = Math.max(0, Date.now() - startedAt)\n await emit({\n type: 'loop-completed',\n runId: opts.runId,\n durationMs,\n })\n\n return {\n runId: opts.runId,\n baselineRunId,\n durationMs,\n analystResult,\n diff,\n knowledge,\n improvement,\n }\n}\n\ntype Emitter = (event: AnalystLoopEvent) => Promise<void>\n\nfunction makeEmitter(onEvent: RunAnalystLoopOpts['onEvent']): Emitter {\n if (!onEvent) return async () => {}\n return async (event) => {\n await onEvent(event)\n }\n}\n\nasync function runRegistry(\n opts: RunAnalystLoopOpts,\n priorFindings: ReturnType<typeof buildPriorFindingsInput>,\n emit: Emitter,\n): Promise<AnalystRunResult> {\n const reg = opts.registry as AnalystRegistryStreamingLike\n const registryOptions = {\n ...(priorFindings ? { priorFindings } : {}),\n ...(opts.chainFindings !== undefined ? { chainFindings: opts.chainFindings } : {}),\n ...(opts.costLedger ? { costLedger: opts.costLedger } : {}),\n ...(opts.costPhase ? { costPhase: opts.costPhase } : {}),\n ...(opts.signal ? { signal: opts.signal } : {}),\n }\n if (typeof reg.runStream === 'function' && opts.onEvent) {\n let final: AnalystRunResult | null = null\n for await (const ev of reg.runStream(opts.runId, opts.inputs, registryOptions)) {\n await emit({ type: 'analyst', runId: opts.runId, event: ev })\n if (ev.type === 'run-completed') final = ev.result\n }\n if (!final) {\n throw new Error('runAnalystLoop: registry.runStream ended without run-completed event')\n }\n return final\n }\n return opts.registry.run(opts.runId, opts.inputs, registryOptions)\n}\n\nfunction resolveBaselineRunId(opts: RunAnalystLoopOpts): string | null {\n if (opts.baselineRunId === null) return null\n if (typeof opts.baselineRunId === 'string') return opts.baselineRunId\n if (!opts.findingsStore) return null\n const all = opts.findingsStore.loadAll()\n let last: string | null = null\n for (const row of all) {\n if (row.run_id === opts.runId) continue\n last = row.run_id\n }\n return last\n}\n\nfunction buildPriorFindingsInput(\n prior: ReadonlyArray<AnalystFinding & { run_id: string }>,\n strategy: 'per-kind' | 'wildcard' | 'none',\n registry: ReadonlyArray<{ id: string }>,\n): ReadonlyArray<AnalystFinding> | Record<string, ReadonlyArray<AnalystFinding>> | undefined {\n if (strategy === 'none' || prior.length === 0) return undefined\n const stripped = prior.map(({ run_id: _run_id, ...rest }) => rest as AnalystFinding)\n if (strategy === 'wildcard') {\n return { '*': stripped }\n }\n void registry\n return stripped\n}\n\nasync function runKnowledgeProposalSource<TProposal>(\n opts: RunAnalystLoopOpts,\n findings: ReadonlyArray<AnalystFinding>,\n log: NonNullable<RunAnalystLoopOpts['log']>,\n emit: Emitter,\n): Promise<KnowledgeReport<TProposal>> {\n const source = opts.knowledgeProposalSource!\n const batch = await source.proposeFromFindings(findings)\n log('knowledge.proposeFromFindings', {\n proposals: batch.proposals.length,\n skipped: batch.skipped,\n errors: batch.errors.length,\n })\n await emit({\n type: 'knowledge-proposed',\n runId: opts.runId,\n proposalCount: batch.proposals.length,\n skipped: batch.skipped,\n errors: batch.errors.length,\n })\n\n return {\n proposals: batch.proposals as TProposal[],\n skipped: batch.skipped,\n errors: batch.errors,\n }\n}\n\nasync function runImprovementProposalSource<TEdit>(\n opts: RunAnalystLoopOpts,\n findings: ReadonlyArray<AnalystFinding>,\n log: NonNullable<RunAnalystLoopOpts['log']>,\n emit: Emitter,\n): Promise<ImprovementReport<TEdit>> {\n const source = opts.improvementProposalSource!\n const batch = await source.proposeFromFindings(findings)\n log('improvement.proposeFromFindings', {\n edits: batch.edits.length,\n skipped: batch.skipped,\n errors: batch.errors.length,\n })\n await emit({\n type: 'improvement-proposed',\n runId: opts.runId,\n editCount: batch.edits.length,\n skipped: batch.skipped,\n errors: batch.errors.length,\n })\n\n return {\n edits: batch.edits as TEdit[],\n skipped: batch.skipped,\n errors: batch.errors,\n }\n}\n\nfunction defaultLog(msg: string, fields?: Record<string, unknown>): void {\n if (fields) console.log(`[analyst-loop] ${msg}`, fields)\n else console.log(`[analyst-loop] ${msg}`)\n}\n"],"mappings":";;;AA6BA,eAAsB,eACpB,MACiD;CACjD,MAAM,MAAM,KAAK,OAAO;CACxB,MAAM,WAAW,KAAK,yBAAyB;CAC/C,MAAM,OAAO,YAAY,KAAK,OAAO;CACrC,MAAM,YAAY,KAAK,IAAI;CAG3B,MAAM,gBAAgB,qBAAqB,IAAI;CAC/C,MAAM,WAA+D,gBAChE,KAAK,eAAe,QAAQ,aAAa,KAAK,CAAC,IAChD,CAAC;CACL,IAAI,qBAAqB;EAAE;EAAe,gBAAgB,SAAS;CAAO,CAAC;CAC3E,MAAM,KAAK;EACT,MAAM;EACN,OAAO,KAAK;EACZ;EACA,mBAAmB,SAAS;CAC9B,CAAC;CAMD,MAAM,gBAAgB,MAAM,YAAY,MADlB,wBAAwB,UAAU,UAAU,KAAK,SAAS,KAAK,CAC3B,GAAG,IAAI;CACjE,IAAI,wBAAwB;EAC1B,UAAU,cAAc,SAAS;EACjC,UAAU,cAAc;EACxB,aAAa,cAAc,YAAY,KAAK,OAAO;GACjD,IAAI,EAAE;GACN,QAAQ,EAAE;GACV,GAAG,EAAE;EACP,EAAE;CACJ,CAAC;CAID,IAAI,KAAK,iBAAiB,cAAc,SAAS,SAAS,GAAG;EAC3D,MAAM,KAAK,cAAc,OAAO,KAAK,OAAO,cAAc,QAAQ;EAClE,MAAM,KAAK;GACT,MAAM;GACN,OAAO,KAAK;GACZ,OAAO,cAAc,SAAS;EAChC,CAAC;CACH;CAGA,IAAI,OAA4B;CAChC,IAAI,iBAAiB,cAAc,SAAS,SAAS,GAAG;EACtD,OAA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K;EACT,MAAM;EACN,OAAO,KAAK;EACZ,eAAe,MAAM,UAAU;EAC/B,SAAS,MAAM;EACf,QAAQ,MAAM,OAAO;CACvB,CAAC;CAED,OAAO;EACL,WAAW,MAAM;EACjB,SAAS,MAAM;EACf,QAAQ,MAAM;CAChB;AACF;AAEA,eAAe,6BACb,MACA,UACA,KACA,MACmC;CAEnC,MAAM,QAAQ,MADC,KAAK,0BACO,oBAAoB,QAAQ;CACvD,IAAI,mCAAmC;EACrC,OAAO,MAAM,MAAM;EACnB,SAAS,MAAM;EACf,QAAQ,MAAM,OAAO;CACvB,CAAC;CACD,MAAM,KAAK;EACT,MAAM;EACN,OAAO,KAAK;EACZ,WAAW,MAAM,MAAM;EACvB,SAAS,MAAM;EACf,QAAQ,MAAM,OAAO;CACvB,CAAC;CAED,OAAO;EACL,OAAO,MAAM;EACb,SAAS,MAAM;EACf,QAAQ,MAAM;CAChB;AACF;AAEA,SAAS,WAAW,KAAa,QAAwC;CACvE,IAAI,QAAQ,QAAQ,IAAI,kBAAkB,OAAO,MAAM;MAClD,QAAQ,IAAI,kBAAkB,KAAK;AAC1C"}
|
package/dist/analyst-loop.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import { a as Iteration } from "./types-Q0PMagdm.js";
|
|
2
1
|
import { a as ImprovementEditBatch, c as KnowledgeProposalBatch, d as RunAnalystLoopOpts, f as RunAnalystLoopResult, i as FindingsStoreLike, l as KnowledgeProposalSource, n as AnalystRegistryLike, o as ImprovementProposalSource, r as AnalystRegistryStreamingLike, s as ImprovementReport, t as AnalystLoopEvent, u as KnowledgeReport } from "./types-zWfqDjeL.js";
|
|
3
|
-
import { TraceAnalysisStore, TraceAnalystByteBudgets } from "@tangle-network/agent-eval";
|
|
4
|
-
//#region src/analyst-loop/iterations-to-trace-store.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Build an in-memory `TraceAnalysisStore` over a loop round's iterations. Fail-loud on an
|
|
7
|
-
* empty round — there is nothing for an analyst to read, and a silent empty store would
|
|
8
|
-
* mask a broken capture path.
|
|
9
|
-
*/
|
|
10
|
-
declare function iterationsToTraceStore<Task, Output>(iterations: ReadonlyArray<Iteration<Task, Output>>, budgets?: TraceAnalystByteBudgets): TraceAnalysisStore;
|
|
11
|
-
//#endregion
|
|
12
2
|
//#region src/analyst-loop/run-analyst-loop.d.ts
|
|
13
3
|
/** Analyze a run and apply accepted knowledge and agent-surface proposals. */
|
|
14
4
|
declare function runAnalystLoop<TProposal = unknown, TEdit = unknown>(opts: RunAnalystLoopOpts): Promise<RunAnalystLoopResult<TProposal, TEdit>>;
|
|
15
5
|
//#endregion
|
|
16
|
-
export { type AnalystLoopEvent, type AnalystRegistryLike, type AnalystRegistryStreamingLike, type FindingsStoreLike, type ImprovementEditBatch, type ImprovementProposalSource, type ImprovementReport, type KnowledgeProposalBatch, type KnowledgeProposalSource, type KnowledgeReport, type RunAnalystLoopOpts, type RunAnalystLoopResult,
|
|
6
|
+
export { type AnalystLoopEvent, type AnalystRegistryLike, type AnalystRegistryStreamingLike, type FindingsStoreLike, type ImprovementEditBatch, type ImprovementProposalSource, type ImprovementReport, type KnowledgeProposalBatch, type KnowledgeProposalSource, type KnowledgeReport, type RunAnalystLoopOpts, type RunAnalystLoopResult, runAnalystLoop };
|
|
17
7
|
//# sourceMappingURL=analyst-loop.d.ts.map
|
package/dist/analyst-loop.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { t as runAnalystLoop } from "./analyst-loop-DZw5QWT9.js";
|
|
2
|
+
export { runAnalystLoop };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentCandidateWorkspacePort, B as ResolvedAgentCandidateContainer, C as AgentCandidateProtectedModelSettlement, D as AgentCandidateRunFinalization, E as AgentCandidateRepositoryPort, F as PreparedAgentCandidateExecution, H as VerifiedAgentCandidateTaskOutcome, I as PreparedAgentCandidateInstruction, L as PreparedAgentCandidateKnowledge, M as CANDIDATE_TRACE_TAGS, N as CanonicalCandidateDocument, O as AgentCandidateTaskExecution, P as PersistedTaskOutcomeEvidence, R as PreparedAgentCandidateLaunch, S as AgentCandidateProtectedModelReservation, T as AgentCandidateProtectedRunCapture, U as AgentCandidateExecutionRoots, V as VerifiedAgentCandidate, _ as AgentCandidateModelLimits, a as AgentCandidateExecutionPorts, b as AgentCandidateOutputPurpose, c as AgentCandidateExecutorPort, d as AgentCandidateExecutorStopRequest, f as AgentCandidateExecutorTaskOutcomeCapture, g as AgentCandidateMemoryResetResult, h as AgentCandidateMemoryPort, i as AgentCandidateContainerPort, j as CANDIDATE_TRACE_ENV, k as AgentCandidateVerificationPorts, l as AgentCandidateExecutorProfileFile, m as AgentCandidateExecutorWorkspaceInput, n as AgentCandidateBenchmarkGraderIdentity, o as AgentCandidateExecutorFinalCapture, p as AgentCandidateExecutorWorkspaceFile, r as AgentCandidateBenchmarkGraderPort, s as AgentCandidateExecutorMemoryCapture, t as AgentCandidateArtifactPort, u as AgentCandidateExecutorRequest, v as AgentCandidateModelPort, w as AgentCandidateProtectedModelSettlementCall, x as AgentCandidateProtectedModelActivation, y as AgentCandidateOutputArtifactPort, z as PreparedAgentCandidateTrace } from "../types-
|
|
2
|
-
import { A as AgentCandidateExecutionPhase, B as AgentCandidatePreparationEvidence, C as AgentCandidateExecutionClaim, D as AgentCandidateExecutionFailureClass, E as AgentCandidateExecutionCleanupHandles, F as AgentCandidateExecutionTerminalResult, I as AgentCandidateRetryRejection, L as InMemoryAgentCandidateExecutionClaimStore, M as AgentCandidateExecutionRecoveryEvidence, N as AgentCandidateExecutionStageResult, O as AgentCandidateExecutionFinishResult, P as AgentCandidateExecutionTerminalRecord, R as InMemoryAgentCandidateExecutionClaimStoreOptions, S as AgentCandidateExecutionAttemptRef, T as AgentCandidateExecutionClaimStore, _ as PrepareAgentCandidateExecutionOptions, a as AgentCandidateModelGrantSettleInput, b as executePreparedAgentCandidate, c as agentCandidateProfileAsAgentProfile, d as freezeGenericAgentCandidateProfile, f as omitUndefinedObjectFields, g as parseExactCandidateProfile, h as parseExactAgentProfileDiff, i as AgentCandidateModelGrantReserveInput, j as AgentCandidateExecutionPhaseResult, k as AgentCandidateExecutionLease, l as applyExactAgentProfileDiff, m as parseExactAgentProfile, n as AgentCandidateModelGrantClient, o as CreateProtectedAgentCandidateModelPortOptions, r as AgentCandidateModelGrantReservation, s as createProtectedAgentCandidateModelPort, t as AgentCandidateModelGrantActivateInput, u as assertCandidateProfileBinding, v as prepareAgentCandidateExecution, w as AgentCandidateExecutionClaimResult, x as AgentCandidateExecutionAttemptRecord, y as ExecutePreparedAgentCandidateOptions, z as candidateExecutionClaim } from "../protected-model-port-
|
|
1
|
+
import { A as AgentCandidateWorkspacePort, B as ResolvedAgentCandidateContainer, C as AgentCandidateProtectedModelSettlement, D as AgentCandidateRunFinalization, E as AgentCandidateRepositoryPort, F as PreparedAgentCandidateExecution, H as VerifiedAgentCandidateTaskOutcome, I as PreparedAgentCandidateInstruction, L as PreparedAgentCandidateKnowledge, M as CANDIDATE_TRACE_TAGS, N as CanonicalCandidateDocument, O as AgentCandidateTaskExecution, P as PersistedTaskOutcomeEvidence, R as PreparedAgentCandidateLaunch, S as AgentCandidateProtectedModelReservation, T as AgentCandidateProtectedRunCapture, U as AgentCandidateExecutionRoots, V as VerifiedAgentCandidate, _ as AgentCandidateModelLimits, a as AgentCandidateExecutionPorts, b as AgentCandidateOutputPurpose, c as AgentCandidateExecutorPort, d as AgentCandidateExecutorStopRequest, f as AgentCandidateExecutorTaskOutcomeCapture, g as AgentCandidateMemoryResetResult, h as AgentCandidateMemoryPort, i as AgentCandidateContainerPort, j as CANDIDATE_TRACE_ENV, k as AgentCandidateVerificationPorts, l as AgentCandidateExecutorProfileFile, m as AgentCandidateExecutorWorkspaceInput, n as AgentCandidateBenchmarkGraderIdentity, o as AgentCandidateExecutorFinalCapture, p as AgentCandidateExecutorWorkspaceFile, r as AgentCandidateBenchmarkGraderPort, s as AgentCandidateExecutorMemoryCapture, t as AgentCandidateArtifactPort, u as AgentCandidateExecutorRequest, v as AgentCandidateModelPort, w as AgentCandidateProtectedModelSettlementCall, x as AgentCandidateProtectedModelActivation, y as AgentCandidateOutputArtifactPort, z as PreparedAgentCandidateTrace } from "../types-CuXu5zuS.js";
|
|
2
|
+
import { A as AgentCandidateExecutionPhase, B as AgentCandidatePreparationEvidence, C as AgentCandidateExecutionClaim, D as AgentCandidateExecutionFailureClass, E as AgentCandidateExecutionCleanupHandles, F as AgentCandidateExecutionTerminalResult, I as AgentCandidateRetryRejection, L as InMemoryAgentCandidateExecutionClaimStore, M as AgentCandidateExecutionRecoveryEvidence, N as AgentCandidateExecutionStageResult, O as AgentCandidateExecutionFinishResult, P as AgentCandidateExecutionTerminalRecord, R as InMemoryAgentCandidateExecutionClaimStoreOptions, S as AgentCandidateExecutionAttemptRef, T as AgentCandidateExecutionClaimStore, _ as PrepareAgentCandidateExecutionOptions, a as AgentCandidateModelGrantSettleInput, b as executePreparedAgentCandidate, c as agentCandidateProfileAsAgentProfile, d as freezeGenericAgentCandidateProfile, f as omitUndefinedObjectFields, g as parseExactCandidateProfile, h as parseExactAgentProfileDiff, i as AgentCandidateModelGrantReserveInput, j as AgentCandidateExecutionPhaseResult, k as AgentCandidateExecutionLease, l as applyExactAgentProfileDiff, m as parseExactAgentProfile, n as AgentCandidateModelGrantClient, o as CreateProtectedAgentCandidateModelPortOptions, r as AgentCandidateModelGrantReservation, s as createProtectedAgentCandidateModelPort, t as AgentCandidateModelGrantActivateInput, u as assertCandidateProfileBinding, v as prepareAgentCandidateExecution, w as AgentCandidateExecutionClaimResult, x as AgentCandidateExecutionAttemptRecord, y as ExecutePreparedAgentCandidateOptions, z as candidateExecutionClaim } from "../protected-model-port-BlLP8ja6.js";
|
|
3
3
|
import { AgentCandidateArtifactRef, AgentCandidateBundle, AgentCandidateCapturedArtifact, AgentCandidateCodeDisabled, AgentCandidateCodeNoOp, AgentCandidateExecution, AgentCandidateGitHubRepository, AgentCandidateKnowledge, AgentCandidateMemoryPolicy, AgentCandidateProfile, AgentCandidateResolvedModel, AgentCandidateRunCell, AgentCandidateWorkspaceManifestMaterial, AgentCandidateWorkspaceSnapshotEvidence, AgentProfile, AgentProfileDiff, Sha256Digest } from "@tangle-network/agent-interface";
|
|
4
4
|
import { TraceStore } from "@tangle-network/agent-eval";
|
|
5
5
|
import { CodeSurface } from "@tangle-network/agent-eval/campaign";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as canonicalCandidateBytes, l as embeddedCandidateArtifact } from "../protected-redaction-wGo44k2K.js";
|
|
2
|
-
import { $ as assertTerminalMatchesStaged, A as omitUndefinedObjectFields, C as agentCandidateProfileAsAgentProfile, G as InMemoryAgentCandidateExecutionClaimStore, H as scanMaterializedWorkspaceManifest, J as candidateCleanupTimeout, K as candidateClaimFileInternals, M as parseExactAgentProfile, N as parseExactAgentProfileDiff, O as freezeGenericAgentCandidateProfile, P as parseExactCandidateProfile, Q as assertTerminalMatchesClaim, T as assertCandidateProfileBinding, V as readVerifiedArtifact, W as verifyMaterializedWorkspace, X as assertRecoveryMatchesStaged, Y as withinCandidateCleanupDeadline, Z as assertTerminalAllowedInPhase, _ as beginPreparedCandidateDisposal, a as AGENT_CANDIDATE_EXECUTION_SUPPORT, at as terminalRecord, b as CANDIDATE_TRACE_TAGS, c as executePreparedAgentCandidate, d as persistCandidateOutputArtifact, et as recoveredTerminalRecord, f as sealAgentCandidateModelSettlement, g as assertPreparedCandidateIntegrity, h as candidateExecutionClaim, i as candidateKnowledgeExecutionPaths, it as sealTerminalDigest, l as RecoveryAgentCandidateTraceStore, m as sealAgentCandidateExecutorStopAcknowledgement, n as CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, nt as rejectedStage, q as candidateCleanupDeadline, r as CANDIDATE_KNOWLEDGE_ROOT_ENV, rt as requireStagedTerminal, s as verifyAgentCandidateBundle, t as prepareAgentCandidateExecution, tt as rejectedFinish, u as persistCandidateModelSettlementEvidence, v as consumePreparedCandidateExecution, w as applyExactAgentProfileDiff, y as CANDIDATE_TRACE_ENV, z as candidateWorkspaceManifest } from "../prepare-
|
|
3
|
-
import { i as sealAgentCandidateBundle, n as captureAgentCandidateWorkspaceFiles, r as createAgentCandidateWorkspacePort, t as captureAgentCandidateWorkspace } from "../workspace-archive-
|
|
4
|
-
import { n as exactProcessProviderAsCandidateExecutor, t as createProtectedAgentCandidateModelPort } from "../protected-model-port-
|
|
2
|
+
import { $ as assertTerminalMatchesStaged, A as omitUndefinedObjectFields, C as agentCandidateProfileAsAgentProfile, G as InMemoryAgentCandidateExecutionClaimStore, H as scanMaterializedWorkspaceManifest, J as candidateCleanupTimeout, K as candidateClaimFileInternals, M as parseExactAgentProfile, N as parseExactAgentProfileDiff, O as freezeGenericAgentCandidateProfile, P as parseExactCandidateProfile, Q as assertTerminalMatchesClaim, T as assertCandidateProfileBinding, V as readVerifiedArtifact, W as verifyMaterializedWorkspace, X as assertRecoveryMatchesStaged, Y as withinCandidateCleanupDeadline, Z as assertTerminalAllowedInPhase, _ as beginPreparedCandidateDisposal, a as AGENT_CANDIDATE_EXECUTION_SUPPORT, at as terminalRecord, b as CANDIDATE_TRACE_TAGS, c as executePreparedAgentCandidate, d as persistCandidateOutputArtifact, et as recoveredTerminalRecord, f as sealAgentCandidateModelSettlement, g as assertPreparedCandidateIntegrity, h as candidateExecutionClaim, i as candidateKnowledgeExecutionPaths, it as sealTerminalDigest, l as RecoveryAgentCandidateTraceStore, m as sealAgentCandidateExecutorStopAcknowledgement, n as CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, nt as rejectedStage, q as candidateCleanupDeadline, r as CANDIDATE_KNOWLEDGE_ROOT_ENV, rt as requireStagedTerminal, s as verifyAgentCandidateBundle, t as prepareAgentCandidateExecution, tt as rejectedFinish, u as persistCandidateModelSettlementEvidence, v as consumePreparedCandidateExecution, w as applyExactAgentProfileDiff, y as CANDIDATE_TRACE_ENV, z as candidateWorkspaceManifest } from "../prepare-Dc30WRB0.js";
|
|
3
|
+
import { i as sealAgentCandidateBundle, n as captureAgentCandidateWorkspaceFiles, r as createAgentCandidateWorkspacePort, t as captureAgentCandidateWorkspace } from "../workspace-archive-CBX0hwL_.js";
|
|
4
|
+
import { n as exactProcessProviderAsCandidateExecutor, t as createProtectedAgentCandidateModelPort } from "../protected-model-port-D5gDcnrH.js";
|
|
5
5
|
import { agentCandidateExecutionPlanMaterialSchema, agentCandidateMaterializationReceiptSchema } from "@tangle-network/agent-interface";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
import { constants, linkSync } from "node:fs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as createInbox, It as FileResultBlobStore, Jt as parseWorkerToolTraceArtifact, Lt as FileSpawnJournal,
|
|
1
|
+
import { $r as providerAttemptEvidence, Ct as createInbox, Hr as parseCommittedJsonLines, It as FileResultBlobStore, Jt as parseWorkerToolTraceArtifact, Lt as FileSpawnJournal, Mt as isLiveNodeStatus, Nt as isTerminalNodeStatus, Ot as createPeerMailbox, Rt as InMemoryResultBlobStore, Tn as promptCacheTokenClasses, Ur as prepareJsonlAppend, Vr as isNoEntError, Wr as writeAllBytes, Yt as workerTraceAnalysisStore, Zt as assertValidBudget, bn as chargedTokens, c as pickBestDelivered, di as detachedFrozen, dn as runBrainLoop, jn as unmeteredSpend, l as runFinalizer, m as withDriverExecutor, o as bestDelivered, q as freeSlots, r as resolveRedactor, st as createExecutorRegistry, u as runTree, y as meterRuntimeOwnedProviderAttempt, zt as InMemorySpawnJournal } from "./redact-h-oaw11Q.js";
|
|
2
2
|
import { f as RuntimeRunStateError, m as ValidationError } from "./errors-DodWX-cb.js";
|
|
3
3
|
import { A as writeWorkerCancellation, M as writeWorkerSteerAcknowledgement, b as workerCancellationsDir, c as readWorkerCancelRequests, d as readWorkerSteerRequests, k as writeRunCancellation, l as readWorkerCancellation, o as readRunCancelRequest, r as claimWorkerSteerDelivery, s as readRunCancellation, u as readWorkerSteerAcknowledgement } from "./run-layout-B8I_LXN-.js";
|
|
4
4
|
import { agentProfileSchema, canonicalCandidateDigest } from "@tangle-network/agent-interface";
|
|
@@ -3621,7 +3621,7 @@ function driverAgent(opts) {
|
|
|
3621
3621
|
},
|
|
3622
3622
|
...scope.resume ? [{
|
|
3623
3623
|
role: "user",
|
|
3624
|
-
content: resumeBrief(scope.resume, opts.priorCoordination)
|
|
3624
|
+
content: resumeBrief(scope.resume, scope.view, opts.priorCoordination)
|
|
3625
3625
|
}] : hasPriorCoordination(opts.priorCoordination) ? [{
|
|
3626
3626
|
role: "user",
|
|
3627
3627
|
content: priorCoordinationBrief(opts.priorCoordination)
|
|
@@ -3676,7 +3676,7 @@ function driverAgent(opts) {
|
|
|
3676
3676
|
* Injected as the brain's first user-context on a resumed run so it continues from unresolved work;
|
|
3677
3677
|
* old continuation receipts are evidence and are never auto-delivered.
|
|
3678
3678
|
*/
|
|
3679
|
-
function resumeBrief(resume, prior) {
|
|
3679
|
+
function resumeBrief(resume, current, prior) {
|
|
3680
3680
|
const lines = [
|
|
3681
3681
|
"RESUME: this run continues a prior coordinator process. Its committed work is restored",
|
|
3682
3682
|
"below and already counts toward the deliverable — do NOT redo it. Continue from the",
|
|
@@ -3688,9 +3688,12 @@ function resumeBrief(resume, prior) {
|
|
|
3688
3688
|
for (const s of resume.settled) lines.push(s.kind === "done" ? `- ${s.handle.id} (${s.handle.label}): done, score=${s.verdict?.score ?? 0}, valid=${s.verdict?.valid ?? false}, outRef=${s.outRef}` : `- ${s.handle.id} (${s.handle.label}): down, reason=${s.reason}`);
|
|
3689
3689
|
const byState = (state) => [...resume.keys].filter(([, v]) => v.state === state);
|
|
3690
3690
|
const completed = byState("completed");
|
|
3691
|
-
const
|
|
3691
|
+
const currentIds = new Set(current.nodes.map((node) => node.id));
|
|
3692
|
+
const recovered = byState("in-doubt").filter(([, value]) => currentIds.has(value.id));
|
|
3693
|
+
const inDoubt = byState("in-doubt").filter(([, value]) => !currentIds.has(value.id));
|
|
3692
3694
|
const failed = byState("down");
|
|
3693
3695
|
if (completed.length > 0) lines.push("", "COMPLETED keys — spawn_worker with the same key returns the finished result, spending nothing:", ...completed.map(([k, v]) => `- ${k} → ${v.id} (${v.label})`));
|
|
3696
|
+
if (recovered.length > 0) lines.push("", "Recovered keys are attached to this scope. Use await_event to receive their results and coordinate with their original workers:", ...recovered.map(([key, value]) => `- ${key} → ${value.id} (${value.label})`));
|
|
3694
3697
|
if (inDoubt.length > 0) lines.push("", "Keys IN DOUBT — a prior process recorded them as started but never recorded a terminal receipt. Do NOT spawn a replacement under these keys; inspect or recover each exact prior execution first:", ...inDoubt.map(([k, v]) => `- ${k} (prior attempt ${v.id}, ${v.label})`));
|
|
3695
3698
|
if (failed.length > 0) lines.push("", "Keys whose prior attempt FAILED (settled down) — spawn_worker with the same key retries:", ...failed.map(([k, v]) => `- ${k} (prior attempt ${v.id}, ${v.label})`));
|
|
3696
3699
|
if (resume.waits.length > 0) lines.push("", "Pending waits RE-ARMED on their original deadlines (they settle through await_event):", ...resume.waits.map((w) => `- ${w.label} (${w.spec.kind})`));
|
|
@@ -3769,4 +3772,4 @@ function errMessage(e) {
|
|
|
3769
3772
|
//#endregion
|
|
3770
3773
|
export { defaultToolDetectors as A, coordinationVerbNames as C, parseAuthoredAnalystDefinition as D, normalizeAnalyzeOnSettle as E, createFileRunContext as M, createInMemoryRunContext as N, questionEscalationTargets as O, FileCoordinationLog as P, canonicalFindingEvent as S, downMessageRefusalReasons as T, renderAnytimeTable as _, allOf as a, DEFAULT_AWAIT_EVENT_TIMEOUT_MS as b, createProgressTracker as c, progressStop as d, sampleFromSettled as f, plateauLength as g, bestSoFar as h, finalizeBestDelivered as i, watchTrace as j, createEventBus as k, noProgressFor as l, areaUnderCurve as m, createSteerAcknowledger as n, allWorkersStalled as o, anytimeReport as p, driverAgent as r, anyOf as s, createCancelAcknowledger as t, plateau as u, watchRunCancellation as v, createCoordinationTools as w, analystToolGroupNames as x, ANALYST_DEFINITION_BOUNDS as y };
|
|
3771
3774
|
|
|
3772
|
-
//# sourceMappingURL=coordination-driver-
|
|
3775
|
+
//# sourceMappingURL=coordination-driver-qdAwriPV.js.map
|