@tangle-network/agent-runtime 0.202.0 → 0.203.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-D4oFb8Lt.js → activation-C8Ilw0IX.js} +2 -2
- package/dist/{activation-D4oFb8Lt.js.map → activation-C8Ilw0IX.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/{improvement-cycle-RpIiIKjM.js → improvement-cycle-BVS0odHN.js} +75 -17
- package/dist/improvement-cycle-BVS0odHN.js.map +1 -0
- package/dist/{index-BLaGPXGh.d.ts → index-prZR0SAw.d.ts} +60 -26
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/intelligence.js +2 -2
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +3 -3
- package/dist/{loop-runner-bin-CqXOUcrz.js → loop-runner-bin-CSMc1AQ5.js} +2 -2
- package/dist/{loop-runner-bin-CqXOUcrz.js.map → loop-runner-bin-CSMc1AQ5.js.map} +1 -1
- package/dist/{loop-runner-bin-CkmHiZgU.d.ts → loop-runner-bin-CdLhMvhw.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/{runtime-Dc-Aem9j.js → runtime-B4HhRqE8.js} +97 -20
- package/dist/runtime-B4HhRqE8.js.map +1 -0
- package/dist/{structural-rollout-Zbntz3jo.js → structural-rollout-DPwqGLUp.js} +87 -50
- package/dist/structural-rollout-DPwqGLUp.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +9 -9
- package/dist/tui/index.d.ts +1 -1
- package/package.json +6 -6
- package/dist/improvement-cycle-RpIiIKjM.js.map +0 -1
- package/dist/runtime-Dc-Aem9j.js.map +0 -1
- package/dist/structural-rollout-Zbntz3jo.js.map +0 -1
package/dist/kernel.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { $t as spendFromUsageEvents, At as peerMailTools, B as workerInteractiveBindingFile, Bn as startRetainedRunInEnvironment, C as settledToIteration, Ct as createInbox, D as timerAt, Di as decodeHarnessUsage, Dt as claimsAuthority, E as pollFor, Ei as sumSandboxUsage, Et as PEER_MAIL_WIRE_KEY, Gn as readCodexRolloutSession, Gt as WORKER_TOOL_TRACE_SCHEMA_VERSION, H as reconnectRetainedInteractiveRun, Hn as addHarnessUsage, Ht as materializeTreeView, I as readWorkerInteractiveAdmissions, It as FileResultBlobStore, J as queueOf, Jt as parseWorkerToolTraceArtifact, K as effectiveConcurrency, Kt as captureWorkerTraceEvidence, L as workerInteractiveAdmissionFile, Ln as reconnectRetainedRun, Lt as FileSpawnJournal, O as validateWaitSpec, Ot as createPeerMailbox, Pt as createInPlaceCliExecutor, Qt as createBudgetPool, R as attachWorker, Rn as recoverRetainedRun, Rt as InMemoryResultBlobStore, Si as mapSandboxToolEvent, St as readWorkerProgress, T as isWaitOutcome, Ti as sandboxProgressEvents, Tt as DEFAULT_PEER_MAIL_LIMITS, U as recoverRetainedInteractiveRun, Un as createCodexRolloutStoreReader, Ut as pendingWaits, V as workerInteractiveBindingsDir, Vt as loadSpawnForest, W as startRetainedInteractiveRun, Wn as harnessUsageIsEmpty, Wt as replaySpawnTree, Xt as contentAddress, Y as rollingDispatch, Yt as workerTraceAnalysisStore, _i as createSandboxToolPartState, _n as resolveAgentEnvironmentProvider, _t as createPushTraceSource, a as createSupervisor, an as createSandboxLineage, at as cliWorktreeExecutor, bt as DEFAULT_STALL_AFTER_MS, c as pickBestDelivered, dt as readWorkerTraceContext, en as TERMINAL_DECISIONS, er as createOpenInferenceFileExporter, ft as workerTraceEnv, g as createScope, gn as providerAsSandboxClient, gt as createSteerableSandboxSession, hi as assertSandboxServedModel, hn as providerAsExecutor, ht as DEFAULT_SANDBOX_STEERING_MAX_TURNS, i as createRootHandle, in as runAgentRounds, it as cliInPlaceExecutor, jt as peerMailVerbNames, k as waitUntil, kt as isPeerMailEnvelope, l as runFinalizer, lt as createWorktreeCliExecutor, mn as createAgentEnvironmentProviderRegistry, mt as workerTraceSeamKey, nn as defaultSelectWinner, o as bestDelivered, on as probeSandboxCapabilities, ot as createExecutor, pt as workerTraceHeaders, q as freeSlots, rn as isTerminalDecision, s as collectDelivered, sn as acquireSandbox, st as createExecutorRegistry, tr as createOtelExporter, vi as createSandboxUsageLedger, vn as sandboxClientAsProvider, vt as decodeToolPart, w as createWaitProbes, wi as sandboxEventServedBackend, wt as AUTHORITY_MARKERS, xi as mapSandboxEvent, xt as createActivityLog, yi as extractLlmCallEvent, yt as sandboxSessionTraceSource, z as readWorkerInteractiveBinding, zn as startRetainedRun, zt as InMemorySpawnJournal } from "./redact-B5g0jY2n.js";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as collectAgentTurn, C as defaultAnalystInstruction, D as profileOptimizerModelCall, E as profileChatClient, S as ObservationError, T as renderReport, _ as depthStrategy, a as defaultStructuralRolloutPolicy, b as sample, c as officialChecksFromMeta, d as selectBestIndex, f as structuralRollout, g as defineStrategy, h as breadthStrategy, i as defaultExtractCandidate, j as streamAgentTurn, l as resolveEntrySymbol, m as adaptiveRefine, n as compareCheckOutcomes, o as filterAuthoredAsserts, p as visibleCheckScore, r as composeCheckSources, s as modelAuthoredChecks, t as canDisplace, u as sandboxCheckRunner, v as refine, w as observe, x as sampleThenRefine, y as runAgentic } from "./structural-rollout-DPwqGLUp.js";
|
|
3
3
|
import { n as assertModelAllowed, r as assertProfileModelsAllowed } from "./model-policy-DKDyr-fc.js";
|
|
4
|
-
import { $ as InMemoryCorpus, A as chatWorkerSeam, At as
|
|
4
|
+
import { $ as InMemoryCorpus, A as chatWorkerSeam, At as renderLeaderboardHtml, B as SandboxRunAbortError, Bt as sanitizeMcpToolSchema, C as withUntrackedArtifacts, Ct as superviseDispatch, D as codeModeSupervisorTools, Dt as stopSentinel, Et as sentinelCompletion, F as selectChampion, Ft as defaultAuditorInstruction, G as equalKOnCost, Gt as secretEnvOfMcpServer, H as printBenchmarkReport, Ht as mcpSecretEnvMetadataKey, I as assertStrategyContract, It as McpSpawnFault, J as runPersonified, K as trajectoryReport, Kt as createTangleSandboxExactProcessProvider, L as authorStrategy, Lt as connectStdioMcp, M as discriminatingMeans, Mt as renderLeaderboardSvg, N as pickChampion, Nt as renderPairwiseMarkdown, O as unsafeInProcessRunner, Ot as leaderboard, P as runStrategyEvolution, Pt as auditIntent, Q as FileCorpus, R as strategyAuthorContract, Rt as materializeLocalMcp, S as copyUntrackedIntoClone, St as loopDispatch, T as patchDelivered, Tt as deterministicCompletion, U as runBenchmark, Ut as resolveMcpServerLaunch, V as openSandboxRun, Vt as envKeyProvider, W as promotionGate, Wt as resolveSecretEnv, X as createShapeRegistry, Y as builtinShapes, Z as registerShape, _ as NOTE_MAX_CHARS, _t as defineLeaderboard, a as localShell, at as pipeline, b as composeWorkerEvidence, bt as inlineSandboxClient, c as createVerifierEnvironment, ct as widen, d as harvestSurfaceDiffs, dt as createScopeAnalyst, et as renderCorpusToInstructions, f as analystsFromRegistry, ft as registryScopeAnalyst, g as EVIDENCE_MAX_CHARS, gt as harvestCorpus, h as worktreeFanout, ht as HarvestError, i as jjWorkspace, it as panel, j as createChatSessionStore, jt as renderLeaderboardMarkdown, k as chatTransportExecutor, kt as pairwiseSignificance, l as boxSurfaceReader, lt as assertTraceDerivedFindings, m as superviseSurface, mt as inProcessSandboxClient, n as makeFinding, nt as flatWidenGate, o as runInWorkspace, ot as selectValidWinner, p as failuresAnalyst, pt as observationFromRegistry, q as definePersona, r as gitWorkspace, rt as loopUntil, s as createWaterfallCollector, st as verify, t as computeFindingId, tt as fanout, u as fsSurfaceReader, ut as buildSteerContext, v as VERIFY_TAIL_CHARS, vt as resolveSandboxClient, w as analyzeTrace, wt as completionAuthorizes, x as settledWorkerOut, xt as loopCampaignDispatch, y as closingWorkerNote, yt as localSandboxClient, z as strategyAuthorSystemPrompt, zt as createMcpEnvironment } from "./runtime-B4HhRqE8.js";
|
|
5
5
|
import { _ as serveCoordinationMcp, a as isPreSpawnExecutorFailure, b as mapExecutorResult, c as withWorkerSpawnRetry, d as resolveSupervisorProfile, f as supervisorAgent, g as defaultUnmetContractSteer, h as classifyDriverFailure, i as workerFromBackend, l as assertCoordinationBinding, m as DriverAttemptsExhaustedError, n as supervise, o as resolveWorkerSpawnRetry, s as retryPreSpawnRefusals, t as DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY, v as createSupervisorSpanRecorder, y as gateOnDeliverable } from "./supervise-CskGiJMk.js";
|
|
6
6
|
import { A as defaultToolDetectors, E as normalizeAnalyzeOnSettle, M as createFileRunContext, N as createInMemoryRunContext, P as FileCoordinationLog, S as canonicalFindingEvent, _ as renderAnytimeTable, a as allOf, b as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, c as createProgressTracker, f as sampleFromSettled, g as plateauLength, h as bestSoFar, i as finalizeBestDelivered, j as watchTrace, k as createEventBus, l as noProgressFor, m as areaUnderCurve, o as allWorkersStalled, p as anytimeReport, s as anyOf, u as plateau } from "./coordination-driver-B5TLsu_f.js";
|
|
7
7
|
import { C as workerInboxFileFromEventDir, D as workerSteerRequestsDir, E as workerSteerRequestFile, O as workerSteersDir, S as workerInboxFile, T as workerSteerAcknowledgementsDir, _ as supervisorWorkersDir, a as legacySupervisorRunsRoot, b as workerCancellationsDir, c as readWorkerCancelRequests, d as readWorkerSteerRequests, f as runCancelRequestFile, g as supervisorRunsRoot, h as supervisorRunDir, i as legacySupervisorRunDir, j as writeWorkerSteer, l as readWorkerCancellation, m as safeWorkerFile, n as cancelWorker, o as readRunCancelRequest, p as runCancellationFile, s as readRunCancellation, t as cancelRun, u as readWorkerSteerAcknowledgement, v as workerCancelRequestsFile, w as workerSteerAcknowledgementFile, x as workerControlLogFile, y as workerCancellationFile } from "./run-layout-B8I_LXN-.js";
|
|
8
8
|
import { n as workerFromInteractiveProvider, r as claimRetainedInteractiveControl, t as provisionSupervisor } from "./provision-supervisor-hc_SOkP5.js";
|
|
9
9
|
import { a as defaultProfileRichnessThresholds, i as assessAuthoredProfile, n as delegate, o as profileRichnessFinding, r as asAuthoredProfile, s as supervisorInstructions, t as defaultDelegateBudget } from "./delegate-B8y9EvTY.js";
|
|
10
10
|
import { a as analyzesFindingsReportPrompt, c as dumbContinuationFailPrompt, d as kernelPromptRegistry, f as naiveContinuationPrompt, l as dumbContinuationPassPrompt, n as defaultEdgeTraversalCap, o as createPromptRegistry, p as promptHandle, r as runGraph, s as delegatesWorkerBriefPrompt, t as GraphEdgeCapError, u as formatPromptHandle } from "./graph-C3WsOkdi.js";
|
|
11
|
-
export { AUTHORITY_MARKERS, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_PEER_MAIL_LIMITS, DEFAULT_SANDBOX_STEERING_MAX_TURNS, DEFAULT_STALL_AFTER_MS, DriverAttemptsExhaustedError, EVIDENCE_MAX_CHARS, FileCoordinationLog, FileCorpus, FileResultBlobStore, FileSpawnJournal, GraphEdgeCapError, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, McpSpawnFault, NOTE_MAX_CHARS, PEER_MAIL_WIRE_KEY, SandboxRunAbortError, TERMINAL_DECISIONS, VERIFY_TAIL_CHARS, WORKER_TOOL_TRACE_SCHEMA_VERSION, acquireSandbox, adaptiveRefine, addHarnessUsage, allOf, allWorkersStalled, analystsFromRegistry, analyzeTrace, analyzesFindingsReportPrompt, anyOf, anytimeReport, areaUnderCurve, asAuthoredProfile, assertCoordinationBinding, assertModelAllowed, assertProfileModelsAllowed, assertSandboxServedModel, assertStrategyContract, assertTraceDerivedFindings, assessAuthoredProfile, attachWorker, auditIntent, authorStrategy, bestDelivered, bestSoFar, boxSurfaceReader, breadthStrategy, buildSteerContext, builtinShapes, canDisplace, cancelRun, cancelWorker, canonicalFindingEvent, captureWorkerTraceEvidence, chatTransportExecutor, chatWorkerSeam, claimRetainedInteractiveControl, claimsAuthority, classifyDriverFailure, cliInPlaceExecutor, cliWorktreeExecutor, closingWorkerNote, codeModeSupervisorTools, collectAgentTurn, collectDelivered, compareCheckOutcomes, completionAuthorizes, composeCheckSources, composeWorkerEvidence, computeFindingId, connectStdioMcp, contentAddress, copyUntrackedIntoClone, createActivityLog, createAgentEnvironmentProviderRegistry, createBudgetPool, createChatSessionStore, createCodexRolloutStoreReader, createEventBus, createExecutor, createExecutorRegistry, createFileRunContext, createInMemoryRunContext, createInPlaceCliExecutor, createInbox, createMcpEnvironment, createOpenInferenceFileExporter, createOtelExporter, createPeerMailbox, createProgressTracker, createPromptRegistry, createPushTraceSource, createRootHandle, createSandboxLineage, createSandboxToolPartState, createSandboxUsageLedger, createScope, createScopeAnalyst, createShapeRegistry, createSteerableSandboxSession, createSupervisor, createSupervisorSpanRecorder, createTangleSandboxExactProcessProvider, createVerifierEnvironment, createWaitProbes, createWaterfallCollector, createWorktreeCliExecutor, decodeHarnessUsage, decodeToolPart, defaultAnalystInstruction, defaultAuditorInstruction, defaultDelegateBudget, defaultEdgeTraversalCap, defaultExtractCandidate, defaultProfileRichnessThresholds, defaultSelectWinner, defaultStructuralRolloutPolicy, defaultToolDetectors, defaultUnmetContractSteer, defineLeaderboard, definePersona, defineStrategy, delegate, delegatesWorkerBriefPrompt, depthStrategy, deterministicCompletion, discriminatingMeans, dumbContinuationFailPrompt, dumbContinuationPassPrompt, effectiveConcurrency, envKeyProvider, equalKOnCost, extractLlmCallEvent, failuresAnalyst, fanout, filterAuthoredAsserts, finalizeBestDelivered, flatWidenGate, formatPromptHandle, freeSlots, fsSurfaceReader, gateOnDeliverable, gitWorkspace, harnessUsageIsEmpty, harvestCorpus, harvestSurfaceDiffs, inProcessSandboxClient, inlineSandboxClient, isPeerMailEnvelope, isPreSpawnExecutorFailure, isTerminalDecision, isWaitOutcome, jjWorkspace, kernelPromptRegistry, leaderboard, legacySupervisorRunDir, legacySupervisorRunsRoot, loadSpawnForest, localSandboxClient, localShell, loopCampaignDispatch, loopDispatch, loopUntil, makeFinding, mapExecutorResult, mapSandboxEvent, mapSandboxToolEvent, materializeLocalMcp, materializeTreeView, mcpSecretEnvMetadataKey, modelAuthoredChecks, naiveContinuationPrompt, noProgressFor, normalizeAnalyzeOnSettle, observe, officialChecksFromMeta, openSandboxRun, pairwiseSignificance, panel, parseWorkerToolTraceArtifact, patchDelivered, peerMailTools, peerMailVerbNames, pendingWaits, pickBestDelivered, pickChampion, pipeline, plateau, plateauLength, pollFor, printBenchmarkReport, probeSandboxCapabilities, profileChatClient, profileOptimizerModelCall, profileRichnessFinding, promotionGate, promptHandle, providerAsExecutor, providerAsSandboxClient, provisionSupervisor, queueOf, readCodexRolloutSession, readRunCancelRequest, readRunCancellation, readWorkerCancelRequests, readWorkerCancellation, readWorkerInteractiveAdmissions, readWorkerInteractiveBinding, readWorkerProgress, readWorkerSteerAcknowledgement, readWorkerSteerRequests, readWorkerTraceContext, reconnectRetainedInteractiveRun, reconnectRetainedRun, recoverRetainedInteractiveRun, recoverRetainedRun, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderLeaderboardHtml, renderLeaderboardMarkdown, renderLeaderboardSvg, renderPairwiseMarkdown, renderReport, replaySpawnTree, resolveAgentEnvironmentProvider, resolveEntrySymbol, resolveMcpServerLaunch, resolveSandboxClient, resolveSecretEnv, resolveSupervisorProfile, resolveWorkerSpawnRetry, retryPreSpawnRefusals, rollingDispatch, runAgentRounds, runAgentic, runBenchmark, runCancelRequestFile, runCancellationFile, runFinalizer, runGraph, runInWorkspace, runPersonified, runStrategyEvolution, safeWorkerFile, sample, sampleFromSettled, sampleThenRefine, sandboxCheckRunner, sandboxClientAsProvider, sandboxEventServedBackend, sandboxProgressEvents, sandboxSessionTraceSource, sanitizeMcpToolSchema, secretEnvOfMcpServer, selectBestIndex, selectChampion, selectValidWinner, sentinelCompletion, serveCoordinationMcp, settledToIteration, settledWorkerOut, spendFromUsageEvents, startRetainedInteractiveRun, startRetainedRun, startRetainedRunInEnvironment, stopSentinel, strategyAuthorContract, strategyAuthorSystemPrompt, streamAgentTurn, structuralRollout, sumSandboxUsage, supervise, superviseDispatch, superviseSurface, supervisorAgent, supervisorInstructions, supervisorRunDir, supervisorRunsRoot, supervisorWorkersDir, timerAt, trajectoryReport, unsafeInProcessRunner, validateWaitSpec, verify, visibleCheckScore, waitUntil, watchTrace, widen, withUntrackedArtifacts, withWorkerSpawnRetry, workerCancelRequestsFile, workerCancellationFile, workerCancellationsDir, workerControlLogFile, workerFromBackend, workerFromInteractiveProvider, workerInboxFile, workerInboxFileFromEventDir, workerInteractiveAdmissionFile, workerInteractiveBindingFile, workerInteractiveBindingsDir, workerSteerAcknowledgementFile, workerSteerAcknowledgementsDir, workerSteerRequestFile, workerSteerRequestsDir, workerSteersDir, workerTraceAnalysisStore, workerTraceEnv, workerTraceHeaders, workerTraceSeamKey, worktreeFanout, writeWorkerSteer };
|
|
11
|
+
export { AUTHORITY_MARKERS, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_PEER_MAIL_LIMITS, DEFAULT_SANDBOX_STEERING_MAX_TURNS, DEFAULT_STALL_AFTER_MS, DriverAttemptsExhaustedError, EVIDENCE_MAX_CHARS, FileCoordinationLog, FileCorpus, FileResultBlobStore, FileSpawnJournal, GraphEdgeCapError, HarvestError, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, McpSpawnFault, NOTE_MAX_CHARS, ObservationError, PEER_MAIL_WIRE_KEY, SandboxRunAbortError, TERMINAL_DECISIONS, VERIFY_TAIL_CHARS, WORKER_TOOL_TRACE_SCHEMA_VERSION, acquireSandbox, adaptiveRefine, addHarnessUsage, allOf, allWorkersStalled, analystsFromRegistry, analyzeTrace, analyzesFindingsReportPrompt, anyOf, anytimeReport, areaUnderCurve, asAuthoredProfile, assertCoordinationBinding, assertModelAllowed, assertProfileModelsAllowed, assertSandboxServedModel, assertStrategyContract, assertTraceDerivedFindings, assessAuthoredProfile, attachWorker, auditIntent, authorStrategy, bestDelivered, bestSoFar, boxSurfaceReader, breadthStrategy, buildSteerContext, builtinShapes, canDisplace, cancelRun, cancelWorker, canonicalFindingEvent, captureWorkerTraceEvidence, chatTransportExecutor, chatWorkerSeam, claimRetainedInteractiveControl, claimsAuthority, classifyDriverFailure, cliInPlaceExecutor, cliWorktreeExecutor, closingWorkerNote, codeModeSupervisorTools, collectAgentTurn, collectDelivered, compareCheckOutcomes, completionAuthorizes, composeCheckSources, composeWorkerEvidence, computeFindingId, connectStdioMcp, contentAddress, copyUntrackedIntoClone, createActivityLog, createAgentEnvironmentProviderRegistry, createBudgetPool, createChatSessionStore, createCodexRolloutStoreReader, createEventBus, createExecutor, createExecutorRegistry, createFileRunContext, createInMemoryRunContext, createInPlaceCliExecutor, createInbox, createMcpEnvironment, createOpenInferenceFileExporter, createOtelExporter, createPeerMailbox, createProgressTracker, createPromptRegistry, createPushTraceSource, createRootHandle, createSandboxLineage, createSandboxToolPartState, createSandboxUsageLedger, createScope, createScopeAnalyst, createShapeRegistry, createSteerableSandboxSession, createSupervisor, createSupervisorSpanRecorder, createTangleSandboxExactProcessProvider, createVerifierEnvironment, createWaitProbes, createWaterfallCollector, createWorktreeCliExecutor, decodeHarnessUsage, decodeToolPart, defaultAnalystInstruction, defaultAuditorInstruction, defaultDelegateBudget, defaultEdgeTraversalCap, defaultExtractCandidate, defaultProfileRichnessThresholds, defaultSelectWinner, defaultStructuralRolloutPolicy, defaultToolDetectors, defaultUnmetContractSteer, defineLeaderboard, definePersona, defineStrategy, delegate, delegatesWorkerBriefPrompt, depthStrategy, deterministicCompletion, discriminatingMeans, dumbContinuationFailPrompt, dumbContinuationPassPrompt, effectiveConcurrency, envKeyProvider, equalKOnCost, extractLlmCallEvent, failuresAnalyst, fanout, filterAuthoredAsserts, finalizeBestDelivered, flatWidenGate, formatPromptHandle, freeSlots, fsSurfaceReader, gateOnDeliverable, gitWorkspace, harnessUsageIsEmpty, harvestCorpus, harvestSurfaceDiffs, inProcessSandboxClient, inlineSandboxClient, isPeerMailEnvelope, isPreSpawnExecutorFailure, isTerminalDecision, isWaitOutcome, jjWorkspace, kernelPromptRegistry, leaderboard, legacySupervisorRunDir, legacySupervisorRunsRoot, loadSpawnForest, localSandboxClient, localShell, loopCampaignDispatch, loopDispatch, loopUntil, makeFinding, mapExecutorResult, mapSandboxEvent, mapSandboxToolEvent, materializeLocalMcp, materializeTreeView, mcpSecretEnvMetadataKey, modelAuthoredChecks, naiveContinuationPrompt, noProgressFor, normalizeAnalyzeOnSettle, observationFromRegistry, observe, officialChecksFromMeta, openSandboxRun, pairwiseSignificance, panel, parseWorkerToolTraceArtifact, patchDelivered, peerMailTools, peerMailVerbNames, pendingWaits, pickBestDelivered, pickChampion, pipeline, plateau, plateauLength, pollFor, printBenchmarkReport, probeSandboxCapabilities, profileChatClient, profileOptimizerModelCall, profileRichnessFinding, promotionGate, promptHandle, providerAsExecutor, providerAsSandboxClient, provisionSupervisor, queueOf, readCodexRolloutSession, readRunCancelRequest, readRunCancellation, readWorkerCancelRequests, readWorkerCancellation, readWorkerInteractiveAdmissions, readWorkerInteractiveBinding, readWorkerProgress, readWorkerSteerAcknowledgement, readWorkerSteerRequests, readWorkerTraceContext, reconnectRetainedInteractiveRun, reconnectRetainedRun, recoverRetainedInteractiveRun, recoverRetainedRun, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderLeaderboardHtml, renderLeaderboardMarkdown, renderLeaderboardSvg, renderPairwiseMarkdown, renderReport, replaySpawnTree, resolveAgentEnvironmentProvider, resolveEntrySymbol, resolveMcpServerLaunch, resolveSandboxClient, resolveSecretEnv, resolveSupervisorProfile, resolveWorkerSpawnRetry, retryPreSpawnRefusals, rollingDispatch, runAgentRounds, runAgentic, runBenchmark, runCancelRequestFile, runCancellationFile, runFinalizer, runGraph, runInWorkspace, runPersonified, runStrategyEvolution, safeWorkerFile, sample, sampleFromSettled, sampleThenRefine, sandboxCheckRunner, sandboxClientAsProvider, sandboxEventServedBackend, sandboxProgressEvents, sandboxSessionTraceSource, sanitizeMcpToolSchema, secretEnvOfMcpServer, selectBestIndex, selectChampion, selectValidWinner, sentinelCompletion, serveCoordinationMcp, settledToIteration, settledWorkerOut, spendFromUsageEvents, startRetainedInteractiveRun, startRetainedRun, startRetainedRunInEnvironment, stopSentinel, strategyAuthorContract, strategyAuthorSystemPrompt, streamAgentTurn, structuralRollout, sumSandboxUsage, supervise, superviseDispatch, superviseSurface, supervisorAgent, supervisorInstructions, supervisorRunDir, supervisorRunsRoot, supervisorWorkersDir, timerAt, trajectoryReport, unsafeInProcessRunner, validateWaitSpec, verify, visibleCheckScore, waitUntil, watchTrace, widen, withUntrackedArtifacts, withWorkerSpawnRetry, workerCancelRequestsFile, workerCancellationFile, workerCancellationsDir, workerControlLogFile, workerFromBackend, workerFromInteractiveProvider, workerInboxFile, workerInboxFileFromEventDir, workerInteractiveAdmissionFile, workerInteractiveBindingFile, workerInteractiveBindingsDir, workerSteerAcknowledgementFile, workerSteerAcknowledgementsDir, workerSteerRequestFile, workerSteerRequestsDir, workerSteersDir, workerTraceAnalysisStore, workerTraceEnv, workerTraceHeaders, workerTraceSeamKey, worktreeFanout, writeWorkerSteer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { st as createExecutorRegistry } from "./redact-B5g0jY2n.js";
|
|
2
2
|
import { i as ConfigError } from "./errors-DodWX-cb.js";
|
|
3
|
-
import { J as runPersonified, h as worktreeFanout, q as definePersona } from "./runtime-
|
|
3
|
+
import { J as runPersonified, h as worktreeFanout, q as definePersona } from "./runtime-B4HhRqE8.js";
|
|
4
4
|
import { t as runAnalystLoop } from "./analyst-loop-DZw5QWT9.js";
|
|
5
5
|
import { t as createKbGate } from "./kb-gate-DpaSwXVx.js";
|
|
6
6
|
//#region src/loop-runner.ts
|
|
@@ -243,4 +243,4 @@ if (invokedScript && /loop-runner-bin\.(js|ts|mjs)$/.test(invokedScript)) main()
|
|
|
243
243
|
//#endregion
|
|
244
244
|
export { isDelegatedLoopMode as a, worktreeLoopRunner as c, auditLoopRunner as i, runLoopRunnerCli as n, researchLoopRunner as o, DELEGATED_LOOP_MODES as r, runDelegatedLoop as s, parseLoopRunnerArgv as t };
|
|
245
245
|
|
|
246
|
-
//# sourceMappingURL=loop-runner-bin-
|
|
246
|
+
//# sourceMappingURL=loop-runner-bin-CSMc1AQ5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-runner-bin-CqXOUcrz.js","names":[],"sources":["../src/loop-runner.ts","../src/loop-runner-bin.ts"],"sourcesContent":["/**\n *\n * `runDelegatedLoop` — the configured delegated loop-runner.\n *\n * One typed entrypoint a worker agent (or a scheduled routine) calls to run a\n * disciplined loop in a chosen MODE, over agent-runtime's hardened engines:\n *\n * code → build-in-a-loop on the GENERIC recursive path (worktreeLoopRunner: author one\n * `AgentProfile` per harness → worktree-CLI leaves → `patchDelivered` gate)\n * review → caller-registered runner — a `code` runner with an approval gate over candidates\n * research → research-in-a-loop with valid-only KB growth (createKbGate)\n * audit → analyze trace/run data → findings (runAnalystLoop, caller-wired)\n * self-improve → caller-registered `improve(profile, options)` run\n *\n * It is intentionally a thin façade: the value is that EVERY product reuses the\n * one hardened engine instead of forking delegation logic. The dispatcher owns\n * mode routing, timing, fail-loud on an unregistered mode, and a uniform result\n * shape; each mode's engine is a pre-configured runner in the registry (build it\n * with the factories below, or inject your own / a stub).\n *\n * @experimental\n */\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport { runAnalystLoop } from './analyst-loop'\nimport type { RunAnalystLoopOpts, RunAnalystLoopResult } from './analyst-loop/types'\nimport { ConfigError } from './errors'\nimport { type CreateKbGateOptions, createKbGate, type FactCandidate } from './mcp/kb-gate'\nimport {\n type AuthoredHarness,\n type Budget,\n createExecutorRegistry,\n definePersona,\n runPersonified,\n type WinnerStrategy,\n type WorktreeFanoutOptions,\n type WorktreePatchArtifact,\n worktreeFanout,\n} from './runtime'\n\n/** All valid delegated-loop mode names — used for validation and CLI surfaces. @experimental */\nexport const DELEGATED_LOOP_MODES = ['code', 'review', 'research', 'audit', 'self-improve'] as const\n\n/** @experimental */\nexport type DelegatedLoopMode = (typeof DELEGATED_LOOP_MODES)[number]\n\n/** Type guard — returns true when `value` is a valid `DelegatedLoopMode` string. @experimental */\nexport function isDelegatedLoopMode(value: unknown): value is DelegatedLoopMode {\n return typeof value === 'string' && (DELEGATED_LOOP_MODES as readonly string[]).includes(value)\n}\n\n/** @experimental A pre-configured loop for one mode. Returns the mode's raw\n * output; the dispatcher wraps it in a {@link DelegatedLoopResult}. */\nexport type DelegatedLoopRunner<T = unknown> = (signal: AbortSignal) => Promise<T>\n\n/** @experimental Mode → configured runner. Partial: only register the modes a\n * given product/routine actually uses. */\nexport type DelegatedLoopRegistry = Partial<Record<DelegatedLoopMode, DelegatedLoopRunner>>\n\n/** @experimental Uniform result — never throws from a registered runner; a\n * thrown engine becomes `{ ok: false, error }` so a routine can record + move on. */\nexport interface DelegatedLoopResult<T = unknown> {\n mode: DelegatedLoopMode\n ok: boolean\n output?: T\n error?: string\n durationMs: number\n}\n\n/** @experimental */\nexport interface RunDelegatedLoopOptions {\n signal?: AbortSignal\n /** Clock override for deterministic tests. */\n now?: () => number\n}\n\n/**\n *\n * Dispatch a configured loop by mode. Fails loud (throws `ConfigError`) when no\n * runner is registered for the mode — a routine pointed at an unwired mode is a\n * config bug, not a silent no-op. A runner that throws is captured as\n * `{ ok: false }` so unattended runs record the failure rather than crash.\n *\n * @experimental\n */\nexport async function runDelegatedLoop<T = unknown>(\n mode: DelegatedLoopMode,\n registry: DelegatedLoopRegistry,\n options: RunDelegatedLoopOptions = {},\n): Promise<DelegatedLoopResult<T>> {\n const runner = registry[mode] as DelegatedLoopRunner<T> | undefined\n if (!runner) {\n throw new ConfigError(\n `runDelegatedLoop: no runner registered for mode '${mode}' (registered: ${\n Object.keys(registry).join(', ') || 'none'\n })`,\n )\n }\n const now = options.now ?? Date.now\n const signal = options.signal ?? new AbortController().signal\n const start = now()\n try {\n const output = await runner(signal)\n return { mode, ok: true, output, durationMs: now() - start }\n } catch (err) {\n return {\n mode,\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n durationMs: now() - start,\n }\n }\n}\n\n/** @experimental Options for the local-repo `code` runner over the GENERIC recursive path. */\nexport interface WorktreeLoopRunnerOptions {\n /** Exact profile carried by the personified root that owns this fanout. */\n rootProfile: AgentProfile\n /** Absolute path to the local git checkout each worktree is cut from. */\n repoRoot: string\n /** The instruction handed to every authored harness (composed under each profile's systemPrompt). */\n taskPrompt: string\n /** The supervisor-authored harness profiles — one fanout item (one worktree-CLI leaf) each. */\n harnesses: ReadonlyArray<AuthoredHarness>\n /** Conserved budget pool bounding the fanout (equal-k holds by construction). */\n budget: Budget\n /** Shell command run in each worktree to derive the tests-PASS signal. */\n testCmd?: string\n /** Shell command run in each worktree to derive the typecheck-PASS signal. */\n typecheckCmd?: string\n /** Which verification signals the deliverable REQUIRES present-and-passing (default none). */\n require?: ReadonlyArray<'tests' | 'typecheck'>\n /** Diff-size cap (lines). */\n maxDiffLines?: number\n /** Literal path prefixes the patch must not touch (the secret-floor is always on regardless). */\n forbiddenPaths?: string[]\n /** Winner-selection strategy among gated candidates. Default `highest-score`. */\n winnerStrategy?: WinnerStrategy\n /** Test seams forwarded to the worktree-CLI leaves so the runner drives offline. */\n runGit?: WorktreeFanoutOptions['runGit']\n runHarness?: WorktreeFanoutOptions['runHarness']\n runCommand?: WorktreeFanoutOptions['runCommand']\n}\n\n/**\n *\n * `code` mode on the GENERIC recursive path: author one `AgentProfile` per harness, run them as a\n * `worktreeFanout` (N `createWorktreeCliExecutor` leaves, each `gateOnDeliverable`) through\n * `runPersonified` on the keystone Supervisor. The sandbox-session counterpart that drives the in-box\n * harness over a `SandboxClient` is `detachedSessionDelegate` (`./mcp/delegates`); here there is no\n * `runAgentRounds` driver, no role-coupled delegate — the harness list is the fanout, the gate is\n * `patchDelivered`,\n * the winner is the shared valid-only selector (NOT `defaultSelectWinner`, whose non-valid fallback\n * would surface an ungated patch). Equal-k holds by the conserved budget pool. Returns the winning\n * patch artifact, or throws when no candidate is delivered (fail loud, never a vacuous done).\n *\n * @experimental\n */\nexport function worktreeLoopRunner(\n options: WorktreeLoopRunnerOptions,\n): DelegatedLoopRunner<WorktreePatchArtifact> {\n const shape = worktreeFanout<string>({\n repoRoot: options.repoRoot,\n taskPrompt: options.taskPrompt,\n harnesses: options.harnesses,\n ...(options.testCmd !== undefined ? { testCmd: options.testCmd } : {}),\n ...(options.typecheckCmd !== undefined ? { typecheckCmd: options.typecheckCmd } : {}),\n ...(options.require !== undefined ? { require: options.require } : {}),\n ...(options.maxDiffLines !== undefined ? { maxDiffLines: options.maxDiffLines } : {}),\n ...(options.forbiddenPaths !== undefined ? { forbiddenPaths: options.forbiddenPaths } : {}),\n ...(options.winnerStrategy !== undefined ? { winnerStrategy: options.winnerStrategy } : {}),\n ...(options.runGit ? { runGit: options.runGit } : {}),\n ...(options.runHarness ? { runHarness: options.runHarness } : {}),\n ...(options.runCommand ? { runCommand: options.runCommand } : {}),\n })\n // The persona's only role here is to carry the fanout shape onto the Supervisor; each item's\n // executor is BYO (the gated worktree-CLI leaf), so the registry only needs to pass BYO through.\n const persona = definePersona<WorktreePatchArtifact>({\n name: 'worktree-coder',\n root: { profile: options.rootProfile, harness: null },\n directive: 'deliver a minimal validated patch on a fresh worktree',\n context: { role: 'coder' },\n executors: { registry: createExecutorRegistry() },\n })\n return async (signal) => {\n const result = await runPersonified<string, WorktreePatchArtifact>({\n persona,\n shape,\n task: options.taskPrompt,\n budget: options.budget,\n signal,\n })\n if (result.kind !== 'winner' || result.out.kind !== 'done') {\n const blockers =\n result.kind === 'winner' && result.out.kind === 'blocked'\n ? result.out.blockers.join('; ')\n : `supervisor settled ${result.kind}`\n throw new Error(`worktreeLoopRunner: no delivered patch (${blockers})`)\n }\n return result.out.deliverable\n }\n}\n\n/** @experimental A fact rejected at the KB gate — surfaced, never dropped. */\nexport interface VetoedFact {\n candidate: FactCandidate\n vetoedBy?: string\n reason?: string\n}\n\n/** @experimental */\nexport interface ResearchLoopResult {\n /** Facts that passed the fail-closed gate — safe to write to the KB. */\n accepted: FactCandidate[]\n /** Facts the gate vetoed in the final round — escalate, do not silently drop. */\n vetoed: VetoedFact[]\n /** Research rounds actually run. */\n rounds: number\n}\n\n/** @experimental Options for the default `research` runner. */\nexport interface ResearchLoopRunnerOptions {\n /**\n * The research engine (the consumer's web/doc searcher + extractor). Called\n * each round with the prior round's vetoes so it can re-research the gaps.\n * Returns fact candidates carrying their grounding (`verbatimPassage` +\n * `sourceText`).\n */\n research: (round: number, vetoed: VetoedFact[]) => Promise<FactCandidate[]>\n /** Gate config (extra judges, self-artifact kinds, …). The floor is always on. */\n gate?: CreateKbGateOptions\n /** Max research rounds (correct-on-veto remediation). Default 1. */\n maxRounds?: number\n}\n\n/**\n * `research` mode — research-in-a-loop with valid-only KB growth.\n *\n * Each round: research → gate every candidate (fail-closed; passage MUST be in\n * the source) → accept the clean ones → re-research the vetoed ones next round,\n * up to `maxRounds`. Vetoed facts in the final round are RETURNED (escalate,\n * never silently dropped) so the caller audits vs retries.\n *\n * @experimental\n */\nexport function researchLoopRunner(\n o: ResearchLoopRunnerOptions,\n): DelegatedLoopRunner<ResearchLoopResult> {\n const gate = createKbGate(o.gate)\n const maxRounds = Math.max(1, Math.trunc(o.maxRounds ?? 1))\n return async (signal) => {\n const accepted: FactCandidate[] = []\n let vetoed: VetoedFact[] = []\n let rounds = 0\n for (let round = 0; round < maxRounds; round += 1) {\n if (signal.aborted) break\n rounds += 1\n const candidates = await o.research(round, vetoed)\n if (candidates.length === 0) break\n vetoed = []\n for (const c of candidates) {\n const v = await gate(c)\n if (v.accepted) accepted.push(c)\n else vetoed.push({ candidate: c, vetoedBy: v.vetoedBy, reason: v.reason })\n }\n if (vetoed.length === 0) break\n }\n return { accepted, vetoed, rounds }\n }\n}\n\n/**\n * `audit` mode — analyst loop over captured trace/run data.\n *\n * @experimental\n */\nexport function auditLoopRunner<TProposal = unknown, TEdit = unknown>(\n options: RunAnalystLoopOpts,\n): DelegatedLoopRunner<RunAnalystLoopResult<TProposal, TEdit>> {\n return async () => runAnalystLoop<TProposal, TEdit>(options)\n}\n","#!/usr/bin/env node\n/**\n *\n * `agent-runtime-loop` — the schedulable entrypoint for the configured\n * delegated loop-runner. A cron job / routine / Makefile target invokes:\n *\n * agent-runtime-loop --mode research --config ./loops.config.js\n *\n * The config module wires the registry (with full access to env / creds —\n * which is why the deps live there, not in this generic bin). It must default-\n * export a `DelegatedLoopRegistry`, or a `() => DelegatedLoopRegistry | Promise<…>`.\n * The bin runs the selected mode, prints the `DelegatedLoopResult` as JSON, and\n * exits 0 on `ok`, 1 on a recorded failure, 2 on a usage/config error.\n *\n * @experimental\n */\n\nimport {\n DELEGATED_LOOP_MODES,\n type DelegatedLoopMode,\n type DelegatedLoopRegistry,\n type DelegatedLoopResult,\n isDelegatedLoopMode,\n runDelegatedLoop,\n} from './loop-runner'\n\n/** @experimental Parsed CLI invocation. */\nexport interface LoopRunnerCliArgs {\n mode: string\n /** Loads the registry — the bin wires this from `--config`; tests inject a stub. */\n loadRegistry: () => Promise<DelegatedLoopRegistry> | DelegatedLoopRegistry\n now?: () => number\n}\n\n/** @experimental */\nexport interface LoopRunnerCliResult {\n exitCode: number\n result?: DelegatedLoopResult\n error?: string\n}\n\n/**\n *\n * Pure CLI core (no process / argv / IO) so it's unit-testable: validate the\n * mode, load the registry, dispatch, map to an exit code (0 ok / 1 failed /\n * 2 usage). Exported for embedding in custom runners + tests.\n *\n * @experimental\n */\nexport async function runLoopRunnerCli(args: LoopRunnerCliArgs): Promise<LoopRunnerCliResult> {\n if (!isDelegatedLoopMode(args.mode)) {\n return {\n exitCode: 2,\n error: `unknown mode '${args.mode}' (expected one of: ${DELEGATED_LOOP_MODES.join(', ')})`,\n }\n }\n let registry: DelegatedLoopRegistry\n try {\n registry = await args.loadRegistry()\n } catch (err) {\n return { exitCode: 2, error: `failed to load registry: ${errMsg(err)}` }\n }\n if (!registry[args.mode]) {\n return {\n exitCode: 2,\n error: `config registers no runner for mode '${args.mode}' (registered: ${\n Object.keys(registry).join(', ') || 'none'\n })`,\n }\n }\n // runDelegatedLoop throws only on a missing runner (guarded above); a failing\n // engine is captured as { ok: false } → exit 1, not a crash.\n const result = await runDelegatedLoop(args.mode as DelegatedLoopMode, registry, {\n ...(args.now ? { now: args.now } : {}),\n })\n return { exitCode: result.ok ? 0 : 1, result }\n}\n\n/** Parse `--mode X --config Y` from an argv tail (`process.argv.slice(2)`). */\nexport function parseLoopRunnerArgv(argv: string[]): { mode?: string; config?: string } {\n const out: { mode?: string; config?: string } = {}\n for (let i = 0; i < argv.length; i += 1) {\n const a = argv[i]\n if (a === '--mode') out.mode = argv[++i]\n else if (a === '--config') out.config = argv[++i]\n else if (a?.startsWith('--mode=')) out.mode = a.slice('--mode='.length)\n else if (a?.startsWith('--config=')) out.config = a.slice('--config='.length)\n }\n return out\n}\n\n/** Normalize a config module's default export → a registry. */\nfunction resolveRegistry(mod: unknown): DelegatedLoopRegistry {\n const def = (mod as { default?: unknown })?.default ?? mod\n const value = typeof def === 'function' ? (def as () => unknown)() : def\n return value as DelegatedLoopRegistry\n}\n\nfunction errMsg(err: unknown): string {\n return err instanceof Error ? err.message : String(err)\n}\n\n/** The argv → IO → exit shell. Kept thin; logic lives in `runLoopRunnerCli`. */\nasync function main(): Promise<void> {\n const { mode, config } = parseLoopRunnerArgv(process.argv.slice(2))\n if (!mode || !config) {\n process.stderr.write(\n 'usage: agent-runtime-loop --mode <mode> --config <module>\\n' +\n ` modes: ${DELEGATED_LOOP_MODES.join(' | ')}\\n` +\n ' config: a JS/TS module default-exporting a DelegatedLoopRegistry (or a factory)\\n',\n )\n process.exit(2)\n }\n const { pathToFileURL } = await import('node:url')\n const { resolve } = await import('node:path')\n const cli = await runLoopRunnerCli({\n mode,\n loadRegistry: async () => resolveRegistry(await import(pathToFileURL(resolve(config)).href)),\n })\n process.stdout.write(`${JSON.stringify(cli.result ?? { error: cli.error }, null, 2)}\\n`)\n if (cli.error) process.stderr.write(`${cli.error}\\n`)\n process.exit(cli.exitCode)\n}\n\n// Run only when executed as the bin — never when imported for the testable\n// core, and never when bundled into a runtime that has no `process.argv`\n// (e.g. Cloudflare Workers, where `process` is a shim without `argv`). Reading\n// `process.argv[1]` directly would throw at module load there; `process.argv?.`\n// keeps the guard a no-op instead of crashing the Worker on startup.\nconst invokedScript = typeof process !== 'undefined' ? process.argv?.[1] : undefined\nif (invokedScript && /loop-runner-bin\\.(js|ts|mjs)$/.test(invokedScript)) {\n void main()\n}\n"],"mappings":";;;;;;;AAyCA,MAAa,uBAAuB;CAAC;CAAQ;CAAU;CAAY;CAAS;AAAc;;AAM1F,SAAgB,oBAAoB,OAA4C;CAC9E,OAAO,OAAO,UAAU,YAAa,qBAA2C,SAAS,KAAK;AAChG;;;;;;;;;;AAoCA,eAAsB,iBACpB,MACA,UACA,UAAmC,CAAC,GACH;CACjC,MAAM,SAAS,SAAS;CACxB,IAAI,CAAC,QACH,MAAM,IAAI,YACR,oDAAoD,KAAK,iBACvD,OAAO,KAAK,QAAQ,CAAC,CAAC,KAAK,IAAI,KAAK,OACrC,EACH;CAEF,MAAM,MAAM,QAAQ,OAAO,KAAK;CAChC,MAAM,SAAS,QAAQ,UAAU,IAAI,gBAAgB,CAAC,CAAC;CACvD,MAAM,QAAQ,IAAI;CAClB,IAAI;EAEF,OAAO;GAAE;GAAM,IAAI;GAAM,QAAA,MADJ,OAAO,MAAM;GACD,YAAY,IAAI,IAAI;EAAM;CAC7D,SAAS,KAAK;EACZ,OAAO;GACL;GACA,IAAI;GACJ,OAAO,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;GACtD,YAAY,IAAI,IAAI;EACtB;CACF;AACF;;;;;;;;;;;;;;;AA8CA,SAAgB,mBAC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YAAY,gBAAgB,MAAM,OAAO,cAAc,QAAQ,MAAM,CAAC,CAAC,CAAC,KAAK;CAC7F,CAAC;CACD,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,IAAI,UAAU,EAAE,OAAO,IAAI,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG;CACvF,IAAI,IAAI,OAAO,QAAQ,OAAO,MAAM,GAAG,IAAI,MAAM,GAAG;CACpD,QAAQ,KAAK,IAAI,QAAQ;AAC3B;AAOA,MAAM,gBAAgB,OAAO,YAAY,cAAc,QAAQ,OAAO,KAAK,KAAA;AAC3E,IAAI,iBAAiB,gCAAgC,KAAK,aAAa,GACrE,KAAU"}
|
|
1
|
+
{"version":3,"file":"loop-runner-bin-CSMc1AQ5.js","names":[],"sources":["../src/loop-runner.ts","../src/loop-runner-bin.ts"],"sourcesContent":["/**\n *\n * `runDelegatedLoop` — the configured delegated loop-runner.\n *\n * One typed entrypoint a worker agent (or a scheduled routine) calls to run a\n * disciplined loop in a chosen MODE, over agent-runtime's hardened engines:\n *\n * code → build-in-a-loop on the GENERIC recursive path (worktreeLoopRunner: author one\n * `AgentProfile` per harness → worktree-CLI leaves → `patchDelivered` gate)\n * review → caller-registered runner — a `code` runner with an approval gate over candidates\n * research → research-in-a-loop with valid-only KB growth (createKbGate)\n * audit → analyze trace/run data → findings (runAnalystLoop, caller-wired)\n * self-improve → caller-registered `improve(profile, options)` run\n *\n * It is intentionally a thin façade: the value is that EVERY product reuses the\n * one hardened engine instead of forking delegation logic. The dispatcher owns\n * mode routing, timing, fail-loud on an unregistered mode, and a uniform result\n * shape; each mode's engine is a pre-configured runner in the registry (build it\n * with the factories below, or inject your own / a stub).\n *\n * @experimental\n */\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport { runAnalystLoop } from './analyst-loop'\nimport type { RunAnalystLoopOpts, RunAnalystLoopResult } from './analyst-loop/types'\nimport { ConfigError } from './errors'\nimport { type CreateKbGateOptions, createKbGate, type FactCandidate } from './mcp/kb-gate'\nimport {\n type AuthoredHarness,\n type Budget,\n createExecutorRegistry,\n definePersona,\n runPersonified,\n type WinnerStrategy,\n type WorktreeFanoutOptions,\n type WorktreePatchArtifact,\n worktreeFanout,\n} from './runtime'\n\n/** All valid delegated-loop mode names — used for validation and CLI surfaces. @experimental */\nexport const DELEGATED_LOOP_MODES = ['code', 'review', 'research', 'audit', 'self-improve'] as const\n\n/** @experimental */\nexport type DelegatedLoopMode = (typeof DELEGATED_LOOP_MODES)[number]\n\n/** Type guard — returns true when `value` is a valid `DelegatedLoopMode` string. @experimental */\nexport function isDelegatedLoopMode(value: unknown): value is DelegatedLoopMode {\n return typeof value === 'string' && (DELEGATED_LOOP_MODES as readonly string[]).includes(value)\n}\n\n/** @experimental A pre-configured loop for one mode. Returns the mode's raw\n * output; the dispatcher wraps it in a {@link DelegatedLoopResult}. */\nexport type DelegatedLoopRunner<T = unknown> = (signal: AbortSignal) => Promise<T>\n\n/** @experimental Mode → configured runner. Partial: only register the modes a\n * given product/routine actually uses. */\nexport type DelegatedLoopRegistry = Partial<Record<DelegatedLoopMode, DelegatedLoopRunner>>\n\n/** @experimental Uniform result — never throws from a registered runner; a\n * thrown engine becomes `{ ok: false, error }` so a routine can record + move on. */\nexport interface DelegatedLoopResult<T = unknown> {\n mode: DelegatedLoopMode\n ok: boolean\n output?: T\n error?: string\n durationMs: number\n}\n\n/** @experimental */\nexport interface RunDelegatedLoopOptions {\n signal?: AbortSignal\n /** Clock override for deterministic tests. */\n now?: () => number\n}\n\n/**\n *\n * Dispatch a configured loop by mode. Fails loud (throws `ConfigError`) when no\n * runner is registered for the mode — a routine pointed at an unwired mode is a\n * config bug, not a silent no-op. A runner that throws is captured as\n * `{ ok: false }` so unattended runs record the failure rather than crash.\n *\n * @experimental\n */\nexport async function runDelegatedLoop<T = unknown>(\n mode: DelegatedLoopMode,\n registry: DelegatedLoopRegistry,\n options: RunDelegatedLoopOptions = {},\n): Promise<DelegatedLoopResult<T>> {\n const runner = registry[mode] as DelegatedLoopRunner<T> | undefined\n if (!runner) {\n throw new ConfigError(\n `runDelegatedLoop: no runner registered for mode '${mode}' (registered: ${\n Object.keys(registry).join(', ') || 'none'\n })`,\n )\n }\n const now = options.now ?? Date.now\n const signal = options.signal ?? new AbortController().signal\n const start = now()\n try {\n const output = await runner(signal)\n return { mode, ok: true, output, durationMs: now() - start }\n } catch (err) {\n return {\n mode,\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n durationMs: now() - start,\n }\n }\n}\n\n/** @experimental Options for the local-repo `code` runner over the GENERIC recursive path. */\nexport interface WorktreeLoopRunnerOptions {\n /** Exact profile carried by the personified root that owns this fanout. */\n rootProfile: AgentProfile\n /** Absolute path to the local git checkout each worktree is cut from. */\n repoRoot: string\n /** The instruction handed to every authored harness (composed under each profile's systemPrompt). */\n taskPrompt: string\n /** The supervisor-authored harness profiles — one fanout item (one worktree-CLI leaf) each. */\n harnesses: ReadonlyArray<AuthoredHarness>\n /** Conserved budget pool bounding the fanout (equal-k holds by construction). */\n budget: Budget\n /** Shell command run in each worktree to derive the tests-PASS signal. */\n testCmd?: string\n /** Shell command run in each worktree to derive the typecheck-PASS signal. */\n typecheckCmd?: string\n /** Which verification signals the deliverable REQUIRES present-and-passing (default none). */\n require?: ReadonlyArray<'tests' | 'typecheck'>\n /** Diff-size cap (lines). */\n maxDiffLines?: number\n /** Literal path prefixes the patch must not touch (the secret-floor is always on regardless). */\n forbiddenPaths?: string[]\n /** Winner-selection strategy among gated candidates. Default `highest-score`. */\n winnerStrategy?: WinnerStrategy\n /** Test seams forwarded to the worktree-CLI leaves so the runner drives offline. */\n runGit?: WorktreeFanoutOptions['runGit']\n runHarness?: WorktreeFanoutOptions['runHarness']\n runCommand?: WorktreeFanoutOptions['runCommand']\n}\n\n/**\n *\n * `code` mode on the GENERIC recursive path: author one `AgentProfile` per harness, run them as a\n * `worktreeFanout` (N `createWorktreeCliExecutor` leaves, each `gateOnDeliverable`) through\n * `runPersonified` on the keystone Supervisor. The sandbox-session counterpart that drives the in-box\n * harness over a `SandboxClient` is `detachedSessionDelegate` (`./mcp/delegates`); here there is no\n * `runAgentRounds` driver, no role-coupled delegate — the harness list is the fanout, the gate is\n * `patchDelivered`,\n * the winner is the shared valid-only selector (NOT `defaultSelectWinner`, whose non-valid fallback\n * would surface an ungated patch). Equal-k holds by the conserved budget pool. Returns the winning\n * patch artifact, or throws when no candidate is delivered (fail loud, never a vacuous done).\n *\n * @experimental\n */\nexport function worktreeLoopRunner(\n options: WorktreeLoopRunnerOptions,\n): DelegatedLoopRunner<WorktreePatchArtifact> {\n const shape = worktreeFanout<string>({\n repoRoot: options.repoRoot,\n taskPrompt: options.taskPrompt,\n harnesses: options.harnesses,\n ...(options.testCmd !== undefined ? { testCmd: options.testCmd } : {}),\n ...(options.typecheckCmd !== undefined ? { typecheckCmd: options.typecheckCmd } : {}),\n ...(options.require !== undefined ? { require: options.require } : {}),\n ...(options.maxDiffLines !== undefined ? { maxDiffLines: options.maxDiffLines } : {}),\n ...(options.forbiddenPaths !== undefined ? { forbiddenPaths: options.forbiddenPaths } : {}),\n ...(options.winnerStrategy !== undefined ? { winnerStrategy: options.winnerStrategy } : {}),\n ...(options.runGit ? { runGit: options.runGit } : {}),\n ...(options.runHarness ? { runHarness: options.runHarness } : {}),\n ...(options.runCommand ? { runCommand: options.runCommand } : {}),\n })\n // The persona's only role here is to carry the fanout shape onto the Supervisor; each item's\n // executor is BYO (the gated worktree-CLI leaf), so the registry only needs to pass BYO through.\n const persona = definePersona<WorktreePatchArtifact>({\n name: 'worktree-coder',\n root: { profile: options.rootProfile, harness: null },\n directive: 'deliver a minimal validated patch on a fresh worktree',\n context: { role: 'coder' },\n executors: { registry: createExecutorRegistry() },\n })\n return async (signal) => {\n const result = await runPersonified<string, WorktreePatchArtifact>({\n persona,\n shape,\n task: options.taskPrompt,\n budget: options.budget,\n signal,\n })\n if (result.kind !== 'winner' || result.out.kind !== 'done') {\n const blockers =\n result.kind === 'winner' && result.out.kind === 'blocked'\n ? result.out.blockers.join('; ')\n : `supervisor settled ${result.kind}`\n throw new Error(`worktreeLoopRunner: no delivered patch (${blockers})`)\n }\n return result.out.deliverable\n }\n}\n\n/** @experimental A fact rejected at the KB gate — surfaced, never dropped. */\nexport interface VetoedFact {\n candidate: FactCandidate\n vetoedBy?: string\n reason?: string\n}\n\n/** @experimental */\nexport interface ResearchLoopResult {\n /** Facts that passed the fail-closed gate — safe to write to the KB. */\n accepted: FactCandidate[]\n /** Facts the gate vetoed in the final round — escalate, do not silently drop. */\n vetoed: VetoedFact[]\n /** Research rounds actually run. */\n rounds: number\n}\n\n/** @experimental Options for the default `research` runner. */\nexport interface ResearchLoopRunnerOptions {\n /**\n * The research engine (the consumer's web/doc searcher + extractor). Called\n * each round with the prior round's vetoes so it can re-research the gaps.\n * Returns fact candidates carrying their grounding (`verbatimPassage` +\n * `sourceText`).\n */\n research: (round: number, vetoed: VetoedFact[]) => Promise<FactCandidate[]>\n /** Gate config (extra judges, self-artifact kinds, …). The floor is always on. */\n gate?: CreateKbGateOptions\n /** Max research rounds (correct-on-veto remediation). Default 1. */\n maxRounds?: number\n}\n\n/**\n * `research` mode — research-in-a-loop with valid-only KB growth.\n *\n * Each round: research → gate every candidate (fail-closed; passage MUST be in\n * the source) → accept the clean ones → re-research the vetoed ones next round,\n * up to `maxRounds`. Vetoed facts in the final round are RETURNED (escalate,\n * never silently dropped) so the caller audits vs retries.\n *\n * @experimental\n */\nexport function researchLoopRunner(\n o: ResearchLoopRunnerOptions,\n): DelegatedLoopRunner<ResearchLoopResult> {\n const gate = createKbGate(o.gate)\n const maxRounds = Math.max(1, Math.trunc(o.maxRounds ?? 1))\n return async (signal) => {\n const accepted: FactCandidate[] = []\n let vetoed: VetoedFact[] = []\n let rounds = 0\n for (let round = 0; round < maxRounds; round += 1) {\n if (signal.aborted) break\n rounds += 1\n const candidates = await o.research(round, vetoed)\n if (candidates.length === 0) break\n vetoed = []\n for (const c of candidates) {\n const v = await gate(c)\n if (v.accepted) accepted.push(c)\n else vetoed.push({ candidate: c, vetoedBy: v.vetoedBy, reason: v.reason })\n }\n if (vetoed.length === 0) break\n }\n return { accepted, vetoed, rounds }\n }\n}\n\n/**\n * `audit` mode — analyst loop over captured trace/run data.\n *\n * @experimental\n */\nexport function auditLoopRunner<TProposal = unknown, TEdit = unknown>(\n options: RunAnalystLoopOpts,\n): DelegatedLoopRunner<RunAnalystLoopResult<TProposal, TEdit>> {\n return async () => runAnalystLoop<TProposal, TEdit>(options)\n}\n","#!/usr/bin/env node\n/**\n *\n * `agent-runtime-loop` — the schedulable entrypoint for the configured\n * delegated loop-runner. A cron job / routine / Makefile target invokes:\n *\n * agent-runtime-loop --mode research --config ./loops.config.js\n *\n * The config module wires the registry (with full access to env / creds —\n * which is why the deps live there, not in this generic bin). It must default-\n * export a `DelegatedLoopRegistry`, or a `() => DelegatedLoopRegistry | Promise<…>`.\n * The bin runs the selected mode, prints the `DelegatedLoopResult` as JSON, and\n * exits 0 on `ok`, 1 on a recorded failure, 2 on a usage/config error.\n *\n * @experimental\n */\n\nimport {\n DELEGATED_LOOP_MODES,\n type DelegatedLoopMode,\n type DelegatedLoopRegistry,\n type DelegatedLoopResult,\n isDelegatedLoopMode,\n runDelegatedLoop,\n} from './loop-runner'\n\n/** @experimental Parsed CLI invocation. */\nexport interface LoopRunnerCliArgs {\n mode: string\n /** Loads the registry — the bin wires this from `--config`; tests inject a stub. */\n loadRegistry: () => Promise<DelegatedLoopRegistry> | DelegatedLoopRegistry\n now?: () => number\n}\n\n/** @experimental */\nexport interface LoopRunnerCliResult {\n exitCode: number\n result?: DelegatedLoopResult\n error?: string\n}\n\n/**\n *\n * Pure CLI core (no process / argv / IO) so it's unit-testable: validate the\n * mode, load the registry, dispatch, map to an exit code (0 ok / 1 failed /\n * 2 usage). Exported for embedding in custom runners + tests.\n *\n * @experimental\n */\nexport async function runLoopRunnerCli(args: LoopRunnerCliArgs): Promise<LoopRunnerCliResult> {\n if (!isDelegatedLoopMode(args.mode)) {\n return {\n exitCode: 2,\n error: `unknown mode '${args.mode}' (expected one of: ${DELEGATED_LOOP_MODES.join(', ')})`,\n }\n }\n let registry: DelegatedLoopRegistry\n try {\n registry = await args.loadRegistry()\n } catch (err) {\n return { exitCode: 2, error: `failed to load registry: ${errMsg(err)}` }\n }\n if (!registry[args.mode]) {\n return {\n exitCode: 2,\n error: `config registers no runner for mode '${args.mode}' (registered: ${\n Object.keys(registry).join(', ') || 'none'\n })`,\n }\n }\n // runDelegatedLoop throws only on a missing runner (guarded above); a failing\n // engine is captured as { ok: false } → exit 1, not a crash.\n const result = await runDelegatedLoop(args.mode as DelegatedLoopMode, registry, {\n ...(args.now ? { now: args.now } : {}),\n })\n return { exitCode: result.ok ? 0 : 1, result }\n}\n\n/** Parse `--mode X --config Y` from an argv tail (`process.argv.slice(2)`). */\nexport function parseLoopRunnerArgv(argv: string[]): { mode?: string; config?: string } {\n const out: { mode?: string; config?: string } = {}\n for (let i = 0; i < argv.length; i += 1) {\n const a = argv[i]\n if (a === '--mode') out.mode = argv[++i]\n else if (a === '--config') out.config = argv[++i]\n else if (a?.startsWith('--mode=')) out.mode = a.slice('--mode='.length)\n else if (a?.startsWith('--config=')) out.config = a.slice('--config='.length)\n }\n return out\n}\n\n/** Normalize a config module's default export → a registry. */\nfunction resolveRegistry(mod: unknown): DelegatedLoopRegistry {\n const def = (mod as { default?: unknown })?.default ?? mod\n const value = typeof def === 'function' ? (def as () => unknown)() : def\n return value as DelegatedLoopRegistry\n}\n\nfunction errMsg(err: unknown): string {\n return err instanceof Error ? err.message : String(err)\n}\n\n/** The argv → IO → exit shell. Kept thin; logic lives in `runLoopRunnerCli`. */\nasync function main(): Promise<void> {\n const { mode, config } = parseLoopRunnerArgv(process.argv.slice(2))\n if (!mode || !config) {\n process.stderr.write(\n 'usage: agent-runtime-loop --mode <mode> --config <module>\\n' +\n ` modes: ${DELEGATED_LOOP_MODES.join(' | ')}\\n` +\n ' config: a JS/TS module default-exporting a DelegatedLoopRegistry (or a factory)\\n',\n )\n process.exit(2)\n }\n const { pathToFileURL } = await import('node:url')\n const { resolve } = await import('node:path')\n const cli = await runLoopRunnerCli({\n mode,\n loadRegistry: async () => resolveRegistry(await import(pathToFileURL(resolve(config)).href)),\n })\n process.stdout.write(`${JSON.stringify(cli.result ?? { error: cli.error }, null, 2)}\\n`)\n if (cli.error) process.stderr.write(`${cli.error}\\n`)\n process.exit(cli.exitCode)\n}\n\n// Run only when executed as the bin — never when imported for the testable\n// core, and never when bundled into a runtime that has no `process.argv`\n// (e.g. Cloudflare Workers, where `process` is a shim without `argv`). Reading\n// `process.argv[1]` directly would throw at module load there; `process.argv?.`\n// keeps the guard a no-op instead of crashing the Worker on startup.\nconst invokedScript = typeof process !== 'undefined' ? process.argv?.[1] : undefined\nif (invokedScript && /loop-runner-bin\\.(js|ts|mjs)$/.test(invokedScript)) {\n void main()\n}\n"],"mappings":";;;;;;;AAyCA,MAAa,uBAAuB;CAAC;CAAQ;CAAU;CAAY;CAAS;AAAc;;AAM1F,SAAgB,oBAAoB,OAA4C;CAC9E,OAAO,OAAO,UAAU,YAAa,qBAA2C,SAAS,KAAK;AAChG;;;;;;;;;;AAoCA,eAAsB,iBACpB,MACA,UACA,UAAmC,CAAC,GACH;CACjC,MAAM,SAAS,SAAS;CACxB,IAAI,CAAC,QACH,MAAM,IAAI,YACR,oDAAoD,KAAK,iBACvD,OAAO,KAAK,QAAQ,CAAC,CAAC,KAAK,IAAI,KAAK,OACrC,EACH;CAEF,MAAM,MAAM,QAAQ,OAAO,KAAK;CAChC,MAAM,SAAS,QAAQ,UAAU,IAAI,gBAAgB,CAAC,CAAC;CACvD,MAAM,QAAQ,IAAI;CAClB,IAAI;EAEF,OAAO;GAAE;GAAM,IAAI;GAAM,QAAA,MADJ,OAAO,MAAM;GACD,YAAY,IAAI,IAAI;EAAM;CAC7D,SAAS,KAAK;EACZ,OAAO;GACL;GACA,IAAI;GACJ,OAAO,eAAe,QAAQ,IAAI,UAAU,OA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ACvC,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,MAAM,MAAM,iBAAiB;EACjC;EACA,cAAc,YAAY,gBAAgB,MAAM,OAAO,cAAc,QAAQ,MAAM,CAAC,CAAC,CAAC,KAAK;CAC7F,CAAC;CACD,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,IAAI,UAAU,EAAE,OAAO,IAAI,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG;CACvF,IAAI,IAAI,OAAO,QAAQ,OAAO,MAAM,GAAG,IAAI,MAAM,GAAG;CACpD,QAAQ,KAAK,IAAI,QAAQ;AAC3B;AAOA,MAAM,gBAAgB,OAAO,YAAY,cAAc,QAAQ,OAAO,KAAK,KAAA;AAC3E,IAAI,iBAAiB,gCAAgC,KAAK,aAAa,GACrE,KAAU"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as RunAnalystLoopOpts, f as RunAnalystLoopResult } from "./types-zWfqDjeL.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Ml as WinnerStrategy, O as AuthoredHarness, k as WorktreeFanoutOptions, un as WorktreePatchArtifact } from "./index-prZR0SAw.js";
|
|
3
3
|
import { ir as Budget } from "./stream-agent-turn-CAj0XcwD.js";
|
|
4
4
|
import { n as FactCandidate, t as CreateKbGateOptions } from "./kb-gate-C8z2juK8.js";
|
|
5
5
|
import { AgentProfile } from "@tangle-network/agent-interface";
|
|
@@ -162,4 +162,4 @@ declare function parseLoopRunnerArgv(argv: string[]): {
|
|
|
162
162
|
};
|
|
163
163
|
//#endregion
|
|
164
164
|
export { researchLoopRunner as _, DELEGATED_LOOP_MODES as a, DelegatedLoopResult as c, ResearchLoopRunnerOptions as d, RunDelegatedLoopOptions as f, isDelegatedLoopMode as g, auditLoopRunner as h, runLoopRunnerCli as i, DelegatedLoopRunner as l, WorktreeLoopRunnerOptions as m, LoopRunnerCliResult as n, DelegatedLoopMode as o, VetoedFact as p, parseLoopRunnerArgv as r, DelegatedLoopRegistry as s, LoopRunnerCliArgs as t, ResearchLoopResult as u, runDelegatedLoop as v, worktreeLoopRunner as y };
|
|
165
|
-
//# sourceMappingURL=loop-runner-bin-
|
|
165
|
+
//# sourceMappingURL=loop-runner-bin-CdLhMvhw.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as runLoopRunnerCli, n as LoopRunnerCliResult, r as parseLoopRunnerArgv, t as LoopRunnerCliArgs } from "./loop-runner-bin-
|
|
1
|
+
import { i as runLoopRunnerCli, n as LoopRunnerCliResult, r as parseLoopRunnerArgv, t as LoopRunnerCliArgs } from "./loop-runner-bin-CdLhMvhw.js";
|
|
2
2
|
export { LoopRunnerCliArgs, LoopRunnerCliResult, parseLoopRunnerArgv, runLoopRunnerCli };
|
package/dist/loop-runner-bin.js
CHANGED
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as SandboxClient, h as LoopSandboxPlacement } from "../types-Q0PMagdm.js";
|
|
2
|
-
import { $d as
|
|
2
|
+
import { $d as FeedbackEvent, $f as DelegateUiAuditRoute, $u as AuthorizeDownMessage, Af as runDetachedTurn, Ap as FileDelegationStore, Bd as McpServer, Bf as SubmitOutput, Cd as QuestionRecord, Cf as DriveTurnCapableBox, Cp as buildDelegationTraceSpans, Df as detachedTurnEvents, Dp as DelegationPersistenceError, Ef as createDetachedTurnResumeDriver, Ep as createDelegationTraceCollector, Fd as createCoordinationTools, Ff as DelegationResumeTick, Gd as DELEGATE_INPUT_SCHEMA, Gf as DelegateFeedbackArgs, Gu as AnalystFindingEvent, Hd as createInProcessTransport, Hf as DelegateCodeArgs, Id as downMessageRefusalReasons, If as DelegationRunContext, Jd as DelegateError, Jf as DelegateResearchConfig, Ju as AnalystRegistry, Kd as DELEGATE_TOOL_NAME, Kf as DelegateFeedbackResult, Kp as CoderOutput, Ku as AnalystKind, Lf as DelegationTaskQueue, Md as WorkerWatchOptions, Mf as DelegationRecord, Mp as InMemoryDelegationStore, Nd as analystToolGroupNames, Nf as DelegationResumeContext, Of as formatDetachedSessionRef, Op as DelegationStateCorruptError, Pf as DelegationResumeDriver, Qd as validateDelegateArgs, Qf as DelegateUiAuditResult, Qu as AuthoredAnalystLimits, Rd as parseAuthoredAnalystDefinition, Rf as DelegationTaskQueueOptions, Sd as QuestionPolicy, Sf as DetachedTurnResumeDriverOptions, Sp as DelegationTraceSpan, Td as SettledWorker, Tf as RunDetachedTurnOptions, Tp as composeLoopTraceEmitters, Ud as createMcpServer, Uf as DelegateCodeConfig, Uu as ANALYST_DEFINITION_BOUNDS, Vd as McpServerOptions, Vf as hashIdempotencyInput, Wd as DELEGATE_DESCRIPTION, Wf as DelegateCodeResult, Wu as AnalystDefinitionIssue, Xd as DelegateResult, Xf as DelegateUiAuditArgs, Yd as DelegateHandlerOptions, Yf as DelegateResearchResult, Yu as AnalystToolGroupName, Zd as createDelegateHandler, Zf as DelegateUiAuditConfig, Zu as AuthoredAnalystDefinition, _d as QuestionEscalationOutcome, _f as SiblingSandboxExecutorOptions, _p as CappedDelegationTrace, ad as CoordinationTools, af as CoderReviewer, ap as DelegationProfile, bd as QuestionLevel, bf as DetachedSessionRefParts, bp as DelegationTraceCaps, cd as DefinedAnalystRecord, cf as DetachedWinnerSelection, cp as DelegationStatus, dd as DownMessageDeliveryOutcome, df as coderTaskFromArgs, dp as FeedbackRating, ed as AuthorizedDownMessage, ef as FeedbackStore, ep as DelegationError, fd as DownMessageEvent, ff as detachedSessionDelegate, fp as FeedbackRefersTo, gd as QuestionDecision, gf as FleetWorkspaceExecutorOptions, gp as delegationProfiles, hd as Question, hf as FleetHandle, hp as UiAuditorDelegationOutput, if as CoderReview, ip as DelegationHistoryResult, jd as WorkerSpawnContext, jf as DelegationArgs, jp as FileDelegationStoreOptions, kf as parseDetachedSessionRef, kp as DelegationStore, ld as DownMessageAuthorizationInput, lf as SettleDetachedCoderTurnOptions, lp as DelegationStatusArgs, md as MakeWorkerAgent, mf as DelegationExecutor, mp as UiAuditLensFilter, nf as eventToSnapshot, np as DelegationHistoryArgs, od as CoordinationToolsOptions, of as DelegateRunCtx, op as DelegationProgress, pd as EscalateQuestion, pf as settleDetachedCoderTurn, pp as ResearchOutputShape, qd as DelegateArgs, qf as DelegateResearchArgs, rd as CoordinationEvent, rf as CoderDelegate, rp as DelegationHistoryEntry, sd as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, sf as DetachedSessionDelegateOptions, sp as DelegationResultPayload, td as ContinuationInstruction, tf as InMemoryFeedbackStore, tp as DelegationFeedbackSnapshot, ud as DownMessageDeliveryAttempt, uf as UiAuditorDelegate, up as DelegationStatusResult, vd as QuestionEscalationRecord, vf as createFleetWorkspaceExecutor, vp as DELEGATION_TRACE_MAX_BYTES, wd as QuestionUrgency, wf as DriveTurnTick, wp as capDelegationTrace, xd as QuestionOption, xf as DetachedTurn, xp as DelegationTraceCollector, yd as QuestionEscalationTarget, yf as createSiblingSandboxExecutor, yp as DELEGATION_TRACE_MAX_SPANS, zd as questionEscalationTargets, zf as SubmitInput } from "../index-prZR0SAw.js";
|
|
3
3
|
import { Jn as JsonRpcMessage, Xn as McpToolDescriptor, Yn as JsonRpcResponse, Zn as McpTransport, _i as TraceContext, _n as RunLocalHarnessOptions, an as RemoveWorktreeOptions, bi as readTraceContextFromEnv, bn as parseCodexTokenUsage, cn as createWorktree, dn as CodexExecutionPolicy, fn as CodexTokenUsage, gn as LocalHarnessResult, hn as LocalHarness, in as GitRunner, ln as removeWorktree, mn as LOCAL_HARNESSES, nn as DiffOptions, on as WorktreeHandle, pn as DEFAULT_LOCAL_HARNESS, rn as DiffResult, sn as captureWorktreeDiff, tn as CreateWorktreeOptions, un as CodexExecutionEvidence, vi as createPropagatingTraceEmitter, vn as harnessSupportsReasoningEffort, xi as traceContextToEnv, xn as runLocalHarness, yi as mergeTraceEnv, yn as localHarnessExecutable } from "../stream-agent-turn-CAj0XcwD.js";
|
|
4
4
|
import { d as ResearchSource, o as UiLens } from "../substrate-B4iT90Zv.js";
|
|
5
5
|
import { a as KbGateResult, i as FactJudgeVerdict, n as FactCandidate, o as createKbGate, r as FactJudge, t as CreateKbGateOptions } from "../kb-gate-C8z2juK8.js";
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { An as throwIfAborted, Cr as parseCodexTokenUsage, Dn as sleep, Jn as readTraceContextFromEnv, Kn as createPropagatingTraceEmitter, Sn as deleteBoxSafe, Sr as localHarnessExecutable, Yn as traceContextToEnv, _r as createWorktree, br as LOCAL_HARNESSES, cn as assertBoxlessPromptOptions, gr as captureWorktreeDiff, hr as runWorktreeHarness, in as runAgentRounds, kn as throwAbort, qn as mergeTraceEnv, tn as createSandboxForSpec, vr as removeWorktree, wr as CodexExecutionDiagnosticError, xr as harnessSupportsReasoningEffort, yr as DEFAULT_LOCAL_HARNESS } from "../redact-B5g0jY2n.js";
|
|
2
2
|
import { i as ConfigError, m as ValidationError } from "../errors-DodWX-cb.js";
|
|
3
3
|
import { t as assertExecutableAgentProfile } from "../model-policy-DKDyr-fc.js";
|
|
4
|
-
import { E as runCoderChecks, ot as selectValidWinner } from "../runtime-
|
|
4
|
+
import { E as runCoderChecks, ot as selectValidWinner } from "../runtime-B4HhRqE8.js";
|
|
5
5
|
import { D as parseAuthoredAnalystDefinition, O as questionEscalationTargets, T as downMessageRefusalReasons, b as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, w as createCoordinationTools, x as analystToolGroupNames, y as ANALYST_DEFINITION_BOUNDS } from "../coordination-driver-B5TLsu_f.js";
|
|
6
6
|
import { t as createStdioToolServer } from "../tool-server-BJbCPhoW.js";
|
|
7
7
|
import { t as createKbGate } from "../kb-gate-DpaSwXVx.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bt as insideCursorNamespace, C as settledToIteration, Ci as notifySandboxEventObserver, Cn as hasCompleteCacheBreakdown, Dn as sleep, En as randomSuffix, Hr as parseCommittedJsonLines, Mn as zeroSpend, On as stringifySafe, Rt as InMemoryResultBlobStore, Ur as prepareJsonlAppend, Vr as isNoEntError, Wr as writeAllBytes, Xt as contentAddress, Y as rollingDispatch, _t as createPushTraceSource, a as createSupervisor, an as createSandboxLineage, bn as chargedTokens, cn as assertBoxlessPromptOptions, di as detachedFrozen, dn as runBrainLoop, fn as canonicalObservedModelParts, in as runAgentRounds, li as executableAgentProfileSnapshot, ln as readPromptOptions, lt as createWorktreeCliExecutor, m as withDriverExecutor, nn as defaultSelectWinner, on as probeSandboxCapabilities, ot as createExecutor, qt as isTraceAnalysisStore, st as createExecutorRegistry, ui as executableAgentSpecSnapshot, un as routerBrain, wn as isAbortError, xn as cloneSpend, yn as addSpend, zt as InMemorySpawnJournal } from "./redact-B5g0jY2n.js";
|
|
2
2
|
import { m as ValidationError, n as AnalystError, s as PlannerError } from "./errors-DodWX-cb.js";
|
|
3
|
-
import {
|
|
3
|
+
import { E as profileChatClient, S as ObservationError, T as renderReport, b as sample, k as strategyAuthorMethod, v as refine, w as observe, x as sampleThenRefine, y as runAgentic } from "./structural-rollout-DPwqGLUp.js";
|
|
4
4
|
import { c as profileModelExecutionSettings, i as concreteModelId, l as profileProviderModel, o as enforceTokenLimits, t as assertExecutableAgentProfile } from "./model-policy-DKDyr-fc.js";
|
|
5
5
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
6
6
|
import { f as sha256Bytes, i as redactProtectedValue, o as canonicalCandidateDigest$1, r as redactProtectedReason, u as immutableCandidateValue } from "./protected-redaction-wGo44k2K.js";
|
|
@@ -2213,9 +2213,34 @@ function defineLeaderboard(spec) {
|
|
|
2213
2213
|
}
|
|
2214
2214
|
//#endregion
|
|
2215
2215
|
//#region src/runtime/harvest-corpus.ts
|
|
2216
|
-
/**
|
|
2216
|
+
/**
|
|
2217
|
+
* Analyze completed runs through the selected observer and retain findings in a corpus.
|
|
2218
|
+
*
|
|
2219
|
+
* Store-agnostic by design: the caller maps its trace store's rows (a
|
|
2220
|
+
* `ProductionTraceSink` ndjson, OTLP spans, RunRecords) to `ObserveInput` — task text,
|
|
2221
|
+
* final output, the event trace, terminal outcome.
|
|
2222
|
+
* The default observer reads execution evidence; an injected analysis owns its admitted sources.
|
|
2223
|
+
*
|
|
2224
|
+
* The nightly product job is then three lines:
|
|
2225
|
+
* const runs = mapSinkRowsToObserveInputs(await readSink(yesterday))
|
|
2226
|
+
* const report = await harvestCorpus({ runs, profile, executor, corpus })
|
|
2227
|
+
* log(report) // runsObserved / findings / learned / failures
|
|
2228
|
+
*
|
|
2229
|
+
* Consumers choose how retained findings inform later work and how to assess their value.
|
|
2230
|
+
*/
|
|
2231
|
+
/** The completed batch evidence remains available even when every analysis failed. */
|
|
2232
|
+
var HarvestError = class extends Error {
|
|
2233
|
+
report;
|
|
2234
|
+
constructor(report) {
|
|
2235
|
+
super(`harvestCorpus: every run failed analysis (${report.failures.length}) — first: ${report.failures[0]?.error}`);
|
|
2236
|
+
this.report = report;
|
|
2237
|
+
this.name = "HarvestError";
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
/** Batch the selected observation implementation over completed runs and retain its findings. */
|
|
2217
2241
|
async function harvestCorpus(opts) {
|
|
2218
|
-
const concurrency =
|
|
2242
|
+
const concurrency = opts.concurrency ?? 4;
|
|
2243
|
+
if (!Number.isSafeInteger(concurrency) || concurrency < 1 || opts.maxRuns !== void 0 && (!Number.isSafeInteger(opts.maxRuns) || opts.maxRuns < 0)) throw new TypeError("harvest limits require positive integer concurrency and nonnegative integer maxRuns");
|
|
2219
2244
|
const report = {
|
|
2220
2245
|
runsObserved: 0,
|
|
2221
2246
|
findings: 0,
|
|
@@ -2233,26 +2258,34 @@ async function harvestCorpus(opts) {
|
|
|
2233
2258
|
let consumed = 0;
|
|
2234
2259
|
let done = false;
|
|
2235
2260
|
const next = async () => {
|
|
2236
|
-
if (done || opts.maxRuns !== void 0 && consumed >= opts.maxRuns) return null;
|
|
2237
|
-
const
|
|
2261
|
+
if (done || opts.signal?.aborted || opts.maxRuns !== void 0 && consumed >= opts.maxRuns) return null;
|
|
2262
|
+
const sequence = ++consumed;
|
|
2263
|
+
let r;
|
|
2264
|
+
try {
|
|
2265
|
+
r = await iterator.next();
|
|
2266
|
+
} catch (error) {
|
|
2267
|
+
done = true;
|
|
2268
|
+
report.failures.push({
|
|
2269
|
+
runId: `source-${sequence}`,
|
|
2270
|
+
error: `trace source: ${error instanceof Error ? error.message.slice(0, 300) : String(error)}`
|
|
2271
|
+
});
|
|
2272
|
+
return null;
|
|
2273
|
+
}
|
|
2238
2274
|
if (r.done) {
|
|
2239
2275
|
done = true;
|
|
2240
2276
|
return null;
|
|
2241
2277
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2278
|
+
return {
|
|
2279
|
+
input: r.value,
|
|
2280
|
+
sequence
|
|
2281
|
+
};
|
|
2244
2282
|
};
|
|
2245
2283
|
const workers = Array.from({ length: concurrency }, async () => {
|
|
2246
|
-
for (let
|
|
2284
|
+
for (let run = await next(); run !== null; run = await next()) {
|
|
2285
|
+
const { input, sequence } = run;
|
|
2247
2286
|
if (opts.signal?.aborted) return;
|
|
2248
2287
|
try {
|
|
2249
|
-
const obs = await observe(input,
|
|
2250
|
-
profile: opts.profile,
|
|
2251
|
-
executor: opts.executor,
|
|
2252
|
-
corpus: opts.corpus,
|
|
2253
|
-
tags: opts.tags ?? [],
|
|
2254
|
-
...opts.signal ? { signal: opts.signal } : {}
|
|
2255
|
-
});
|
|
2288
|
+
const obs = await observe(input, opts);
|
|
2256
2289
|
report.runsObserved += 1;
|
|
2257
2290
|
report.findings += obs.findings.length;
|
|
2258
2291
|
report.learned += obs.learned.length;
|
|
@@ -2260,16 +2293,20 @@ async function harvestCorpus(opts) {
|
|
|
2260
2293
|
report.usage.output += obs.usage.output;
|
|
2261
2294
|
report.usage.known &&= obs.usage.known;
|
|
2262
2295
|
} catch (e) {
|
|
2263
|
-
report.usage.known
|
|
2296
|
+
report.usage.known &&= e instanceof ObservationError && e.usage.known;
|
|
2297
|
+
if (e instanceof ObservationError) {
|
|
2298
|
+
report.usage.input += e.usage.input;
|
|
2299
|
+
report.usage.output += e.usage.output;
|
|
2300
|
+
}
|
|
2264
2301
|
report.failures.push({
|
|
2265
|
-
runId: input.runId ?? `run-${
|
|
2302
|
+
runId: input.runId ?? `run-${sequence}`,
|
|
2266
2303
|
error: e instanceof Error ? e.message.slice(0, 300) : String(e)
|
|
2267
2304
|
});
|
|
2268
2305
|
}
|
|
2269
2306
|
}
|
|
2270
2307
|
});
|
|
2271
2308
|
await Promise.all(workers);
|
|
2272
|
-
if (report.runsObserved === 0 && report.failures.length > 0) throw new
|
|
2309
|
+
if (report.runsObserved === 0 && report.failures.length > 0) throw new HarvestError(report);
|
|
2273
2310
|
return report;
|
|
2274
2311
|
}
|
|
2275
2312
|
//#endregion
|
|
@@ -2397,6 +2434,46 @@ function inProcessSandboxClient(options) {
|
|
|
2397
2434
|
} };
|
|
2398
2435
|
}
|
|
2399
2436
|
//#endregion
|
|
2437
|
+
//#region src/runtime/observation-registry.ts
|
|
2438
|
+
/** Adapt any Eval analyst registry, including recursive engines, to observation and harvesting. */
|
|
2439
|
+
function observationFromRegistry(registry, options) {
|
|
2440
|
+
if (!["production", "search"].includes(options.proposalOrigin)) throw new TypeError("registry observation requires an explicit production or search origin");
|
|
2441
|
+
return async (input, context) => {
|
|
2442
|
+
const signals = [context.signal, options.runOptions?.signal].filter((signal) => signal !== void 0);
|
|
2443
|
+
const result = await registry.run(input.runId ?? randomUUID(), typeof options.inputs === "function" ? await options.inputs(input) : options.inputs, {
|
|
2444
|
+
...options.runOptions,
|
|
2445
|
+
...signals.length ? { signal: AbortSignal.any(signals) } : {}
|
|
2446
|
+
});
|
|
2447
|
+
const usage = {
|
|
2448
|
+
input: 0,
|
|
2449
|
+
output: 0,
|
|
2450
|
+
known: true
|
|
2451
|
+
};
|
|
2452
|
+
for (const analyst of result.per_analyst) {
|
|
2453
|
+
const receipt = analyst.usage;
|
|
2454
|
+
usage.input += receipt.tokens?.input ?? receipt.partialTokens?.input ?? 0;
|
|
2455
|
+
usage.output += receipt.tokens?.output ?? receipt.partialTokens?.output ?? 0;
|
|
2456
|
+
usage.known &&= receipt.tokens !== null && receipt.tokens.tokensKnown !== false && receipt.tokensEstimated !== true;
|
|
2457
|
+
}
|
|
2458
|
+
try {
|
|
2459
|
+
await options.record?.(result, input);
|
|
2460
|
+
const incomplete = result.per_analyst.filter((analyst) => analyst.status !== "ok");
|
|
2461
|
+
if (incomplete.length) throw new Error(incomplete.map((analyst) => `${analyst.analyst_id}: ${analyst.error?.message ?? analyst.reason ?? analyst.status}`).join("; "));
|
|
2462
|
+
const findings = result.findings.map((finding) => ({
|
|
2463
|
+
...finding,
|
|
2464
|
+
proposal_origin: options.proposalOrigin
|
|
2465
|
+
}));
|
|
2466
|
+
return {
|
|
2467
|
+
findings,
|
|
2468
|
+
report: renderReport(findings),
|
|
2469
|
+
usage
|
|
2470
|
+
};
|
|
2471
|
+
} catch (cause) {
|
|
2472
|
+
throw new ObservationError(cause instanceof Error ? cause.message : String(cause), usage, { cause });
|
|
2473
|
+
}
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
2476
|
+
//#endregion
|
|
2400
2477
|
//#region src/runtime/personify/analyst.ts
|
|
2401
2478
|
/**
|
|
2402
2479
|
* The diagnosis a combinator steers from must be TRACE-derived, never JUDGE-derived. A finding
|
|
@@ -6837,6 +6914,6 @@ function tail(s) {
|
|
|
6837
6914
|
return s.slice(-400);
|
|
6838
6915
|
}
|
|
6839
6916
|
//#endregion
|
|
6840
|
-
export { InMemoryCorpus as $, chatWorkerSeam as A,
|
|
6917
|
+
export { InMemoryCorpus as $, chatWorkerSeam as A, renderLeaderboardHtml as At, SandboxRunAbortError as B, sanitizeMcpToolSchema as Bt, withUntrackedArtifacts as C, superviseDispatch as Ct, codeModeSupervisorTools as D, stopSentinel as Dt, runCoderChecks as E, sentinelCompletion as Et, selectChampion as F, defaultAuditorInstruction as Ft, equalKOnCost as G, secretEnvOfMcpServer as Gt, printBenchmarkReport as H, mcpSecretEnvMetadataKey as Ht, assertStrategyContract as I, McpSpawnFault as It, runPersonified as J, trajectoryReport as K, createTangleSandboxExactProcessProvider as Kt, authorStrategy as L, connectStdioMcp as Lt, discriminatingMeans as M, renderLeaderboardSvg as Mt, pickChampion as N, renderPairwiseMarkdown as Nt, unsafeInProcessRunner as O, leaderboard as Ot, runStrategyEvolution as P, auditIntent as Pt, FileCorpus as Q, strategyAuthorContract as R, materializeLocalMcp as Rt, copyUntrackedIntoClone as S, loopDispatch as St, patchDelivered as T, deterministicCompletion as Tt, runBenchmark as U, resolveMcpServerLaunch as Ut, openSandboxRun as V, envKeyProvider as Vt, promotionGate as W, resolveSecretEnv as Wt, createShapeRegistry as X, builtinShapes as Y, registerShape as Z, NOTE_MAX_CHARS as _, defineLeaderboard as _t, localShell as a, pipeline as at, composeWorkerEvidence as b, inlineSandboxClient as bt, createVerifierEnvironment as c, widen as ct, harvestSurfaceDiffs as d, createScopeAnalyst as dt, renderCorpusToInstructions as et, analystsFromRegistry as f, registryScopeAnalyst as ft, EVIDENCE_MAX_CHARS as g, harvestCorpus as gt, worktreeFanout as h, HarvestError as ht, jjWorkspace as i, panel as it, createChatSessionStore as j, renderLeaderboardMarkdown as jt, chatTransportExecutor as k, pairwiseSignificance as kt, boxSurfaceReader as l, assertTraceDerivedFindings as lt, superviseSurface as m, inProcessSandboxClient as mt, makeFinding$1 as n, flatWidenGate as nt, runInWorkspace as o, selectValidWinner as ot, failuresAnalyst as p, observationFromRegistry as pt, definePersona as q, gitWorkspace as r, loopUntil as rt, createWaterfallCollector as s, verify as st, computeFindingId$1 as t, fanout as tt, fsSurfaceReader as u, buildSteerContext as ut, VERIFY_TAIL_CHARS as v, resolveSandboxClient as vt, analyzeTrace as w, completionAuthorizes as wt, settledWorkerOut as x, loopCampaignDispatch as xt, closingWorkerNote as y, localSandboxClient as yt, strategyAuthorSystemPrompt as z, createMcpEnvironment as zt };
|
|
6841
6918
|
|
|
6842
|
-
//# sourceMappingURL=runtime-
|
|
6919
|
+
//# sourceMappingURL=runtime-B4HhRqE8.js.map
|