@tangle-network/agent-runtime 0.107.4 → 0.108.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/README.md +17 -4
- package/dist/{activation-Ck5ksFWg.js → activation-DRpnplEm.js} +3 -3
- package/dist/{activation-Ck5ksFWg.js.map → activation-DRpnplEm.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{candidate-execution-BUpR0mSD.js → candidate-execution-nYMa-bc-.js} +4 -4
- package/dist/{candidate-execution-BUpR0mSD.js.map → candidate-execution-nYMa-bc-.js.map} +1 -1
- package/dist/durable.d.ts +134 -0
- package/dist/durable.js +124 -0
- package/dist/durable.js.map +1 -0
- package/dist/{environment-provider-IUGU3epE.d.ts → environment-provider-D0NXc4Qz.d.ts} +73 -4
- package/dist/environment-provider.d.ts +1 -1
- package/dist/{improvement-cycle-Ulvvbg5p.js → improvement-cycle-CRnDDdX0.js} +49 -155
- package/dist/improvement-cycle-CRnDDdX0.js.map +1 -0
- package/dist/{index-CeawCSEg.d.ts → index-BZbJWqoZ.d.ts} +175 -27
- package/dist/{index-D6MwUzvB.d.ts → index-DQp3BPeC.d.ts} +11 -159
- package/dist/{index-jmFVBIHo.d.ts → index-cdkwHruJ.d.ts} +3 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.js +14 -121
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +15 -7
- package/dist/intelligence.js +4 -4
- package/dist/{knowledge-Dizh_AtL.js → knowledge-rdrpPIXs.js} +5 -5
- package/dist/{knowledge-Dizh_AtL.js.map → knowledge-rdrpPIXs.js.map} +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-BbYG9CeA.d.ts → loop-runner-bin-9-JlGqN7.d.ts} +3 -3
- package/dist/{loop-runner-bin-CvdKZkE4.js → loop-runner-bin-B1V-XS5A.js} +3 -3
- package/dist/{loop-runner-bin-CvdKZkE4.js.map → loop-runner-bin-B1V-XS5A.js.map} +1 -1
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/loops.d.ts +3 -3
- package/dist/loops.js +5 -5
- package/dist/mcp/bin.js +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-CKLy1C7M.js → openai-tools-BjQq2TTL.js} +2 -2
- package/dist/{openai-tools-CKLy1C7M.js.map → openai-tools-BjQq2TTL.js.map} +1 -1
- package/dist/{prepare-_WTTffkz.js → prepare-Pr19X93k.js} +141 -6
- package/dist/prepare-Pr19X93k.js.map +1 -0
- package/dist/primeintellect/index.d.ts +1 -1
- package/dist/{protected-model-port-ZUwVuftA.js → protected-model-port-uthtDNqu.js} +2 -2
- package/dist/{protected-model-port-ZUwVuftA.js.map → protected-model-port-uthtDNqu.js.map} +1 -1
- package/dist/{redact-C5xOm8cu.d.ts → redact-BkasKlyd.d.ts} +17 -27
- package/dist/{runtime-5zM5XxLr.js → runtime-CDekUROm.js} +20 -13
- package/dist/runtime-CDekUROm.js.map +1 -0
- package/dist/{structural-rollout-IXUEplky.js → structural-rollout-BC81Otmc.js} +10 -9
- package/dist/structural-rollout-BC81Otmc.js.map +1 -0
- package/dist/{supervise-BiRutHS9.js → supervise-JfKPwIlO.js} +270 -69
- package/dist/supervise-JfKPwIlO.js.map +1 -0
- package/dist/{supervisor-DTKhF-RV.js → supervisor-B2LzaWRb.js} +221 -16
- package/dist/supervisor-B2LzaWRb.js.map +1 -0
- package/dist/testing.js +3544 -657
- package/dist/testing.js.map +1 -1
- package/dist/{workspace-archive-CIG1VNCj.js → workspace-archive-C9w_rxt6.js} +2 -2
- package/dist/{workspace-archive-CIG1VNCj.js.map → workspace-archive-C9w_rxt6.js.map} +1 -1
- package/package.json +11 -6
- package/dist/improvement-cycle-Ulvvbg5p.js.map +0 -1
- package/dist/prepare-_WTTffkz.js.map +0 -1
- package/dist/runtime-5zM5XxLr.js.map +0 -1
- package/dist/structural-rollout-IXUEplky.js.map +0 -1
- package/dist/supervise-BiRutHS9.js.map +0 -1
- package/dist/supervisor-DTKhF-RV.js.map +0 -1
package/dist/loops.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as contentAddress, c as replaySpawnTree, i as InMemorySpawnJournal, n as FileSpawnJournal, o as materializeTreeView, r as InMemoryResultBlobStore, s as pendingWaits, t as FileResultBlobStore } from "./spawn-journal-CwPvKUTa.js";
|
|
2
|
-
import {
|
|
3
|
-
import { C as observe, S as defaultAnalystInstruction, _ 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, 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 renderReport, x as sampleThenRefine, y as runAgentic } from "./structural-rollout-
|
|
4
|
-
import { $ as defineLeaderboard, A as trajectoryReport, B as flatWidenGate, C as strategyAuthorContract, Ct as sanitizeMcpToolSchema, D as runBenchmark, Dt as secretEnvOfMcpServer, E as printBenchmarkReport, Et as resolveSecretEnv, F as registerShape, G as verify, H as panel, I as FileCorpus, J as buildSteerContext, K as widen, L as InMemoryCorpus, M as runPersonified, N as builtinShapes, O as promotionGate, P as createShapeRegistry, Q as harvestCorpus, R as renderCorpusToInstructions, S as authorStrategy, St as createMcpEnvironment, T as openSandboxRun, Tt as mcpSecretEnvMetadataKey, U as pipeline, V as loopUntil, W as selectValidWinner, X as registryScopeAnalyst, Y as createScopeAnalyst, Z as inProcessSandboxClient, _ as discriminatingMeans, _t as auditIntent, a as localShell, at as loopCampaignDispatch, b as selectChampion, bt as connectStdioMcp, c as createVerifierEnvironment, ct as deterministicCompletion, d as worktreeFanout, dt as leaderboard, et as dumbDriver, f as analyzeTrace, ft as pairwiseSignificance, g as streamAgentTurn, gt as renderPairwiseMarkdown, h as collectAgentTurn, ht as renderLeaderboardSvg, i as jjWorkspace, it as inlineSandboxClient, j as definePersona, k as equalKOnCost, l as failuresAnalyst, lt as sentinelCompletion, mt as renderLeaderboardMarkdown, n as makeFinding, nt as resolveSandboxClient, o as runInWorkspace, ot as loopDispatch, p as patchDelivered, pt as renderLeaderboardHtml, q as assertTraceDerivedFindings, r as gitWorkspace, rt as localSandboxClient, s as createWaterfallCollector, st as completionAuthorizes, t as computeFindingId, tt as naiveDriver, u as superviseSurface, ut as stopSentinel, v as pickChampion, vt as defaultAuditorInstruction, w as SandboxRunAbortError, wt as envKeyProvider, x as assertStrategyContract, xt as materializeLocalMcp, y as runStrategyEvolution, yt as McpSpawnFault, z as fanout } from "./runtime-
|
|
2
|
+
import { D as routerChatWithUsage, E as routerChatWithTools, O as routerToolLoop, T as routerBrain, _ as waitUntil, a as runFinalizer, b as readWorkerProgress, c as spendFromUsageEvents, d as settledToIteration, f as createWaitProbes, g as validateWaitSpec, h as timerAt, i as pickBestDelivered, m as pollFor, n as bestDelivered, o as runTree, p as isWaitOutcome, r as collectDelivered, s as createBudgetPool, t as createSupervisor, u as createScope, v as DEFAULT_STALL_AFTER_MS, y as createActivityLog } from "./supervisor-B2LzaWRb.js";
|
|
3
|
+
import { C as observe, S as defaultAnalystInstruction, _ 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, 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 renderReport, x as sampleThenRefine, y as runAgentic } from "./structural-rollout-BC81Otmc.js";
|
|
4
|
+
import { $ as defineLeaderboard, A as trajectoryReport, B as flatWidenGate, C as strategyAuthorContract, Ct as sanitizeMcpToolSchema, D as runBenchmark, Dt as secretEnvOfMcpServer, E as printBenchmarkReport, Et as resolveSecretEnv, F as registerShape, G as verify, H as panel, I as FileCorpus, J as buildSteerContext, K as widen, L as InMemoryCorpus, M as runPersonified, N as builtinShapes, O as promotionGate, P as createShapeRegistry, Q as harvestCorpus, R as renderCorpusToInstructions, S as authorStrategy, St as createMcpEnvironment, T as openSandboxRun, Tt as mcpSecretEnvMetadataKey, U as pipeline, V as loopUntil, W as selectValidWinner, X as registryScopeAnalyst, Y as createScopeAnalyst, Z as inProcessSandboxClient, _ as discriminatingMeans, _t as auditIntent, a as localShell, at as loopCampaignDispatch, b as selectChampion, bt as connectStdioMcp, c as createVerifierEnvironment, ct as deterministicCompletion, d as worktreeFanout, dt as leaderboard, et as dumbDriver, f as analyzeTrace, ft as pairwiseSignificance, g as streamAgentTurn, gt as renderPairwiseMarkdown, h as collectAgentTurn, ht as renderLeaderboardSvg, i as jjWorkspace, it as inlineSandboxClient, j as definePersona, k as equalKOnCost, l as failuresAnalyst, lt as sentinelCompletion, mt as renderLeaderboardMarkdown, n as makeFinding, nt as resolveSandboxClient, o as runInWorkspace, ot as loopDispatch, p as patchDelivered, pt as renderLeaderboardHtml, q as assertTraceDerivedFindings, r as gitWorkspace, rt as localSandboxClient, s as createWaterfallCollector, st as completionAuthorizes, t as computeFindingId, tt as naiveDriver, u as superviseSurface, ut as stopSentinel, v as pickChampion, vt as defaultAuditorInstruction, w as SandboxRunAbortError, wt as envKeyProvider, x as assertStrategyContract, xt as materializeLocalMcp, y as runStrategyEvolution, yt as McpSpawnFault, z as fanout } from "./runtime-CDekUROm.js";
|
|
5
5
|
import { i as mapSandboxToolEvent, n as extractLlmCallEvent, o as sumSandboxUsage, r as mapSandboxEvent, t as createSandboxToolPartState } from "./sandbox-events-DeI5xX8P.js";
|
|
6
|
-
import { At as createSteerableSandboxSession, Bt as runAgentRounds, Ct as createFileRunContext, Dt as createExecutorRegistry, Et as createExecutor, F as assessAuthoredProfile, Ft as decodeToolPart, Gt as
|
|
6
|
+
import { At as createSteerableSandboxSession, Bt as runAgentRounds, Ct as createFileRunContext, Dt as createExecutorRegistry, Et as createExecutor, F as assessAuthoredProfile, Ft as decodeToolPart, Gt as FileCoordinationLog, Ht as createSandboxLineage, I as authoredWorker, It as sandboxSessionTraceSource, Kt as assertModelAllowed, L as defaultProfileRichnessThresholds, Lt as createInbox, M as defaultDelegateBudget, Mt as piExecutor, N as delegate, Nt as piSeamKey, Ot as createWorktreeCliExecutor, P as asAuthoredProfile, Pt as createPushTraceSource, R as profileRichnessFinding, St as watchTrace, Tt as cliWorktreeExecutor, Ut as probeSandboxCapabilities, Vt as runLoop, Wt as acquireSandbox, _t as effectiveConcurrency, at as createProgressTracker, bt as rollingDispatch, ct as sampleFromSettled, dt as bestSoFar, et as driverAgent, ft as plateauLength, gt as createEventBus, i as serveCoordinationMcp, it as anyOf, jt as PI_RUNTIME, kt as DEFAULT_SANDBOX_STEERING_MAX_TURNS, lt as anytimeReport, mt as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, n as workerFromBackend, nt as allOf, ot as noProgressFor, pt as renderAnytimeTable, qt as gateOnDeliverable, r as supervisorAgent, rt as allWorkersStalled, st as plateau, t as supervise, tt as finalizeBestDelivered, ut as areaUnderCurve, vt as freeSlots, wt as createInMemoryRunContext, xt as defaultToolDetectors, yt as queueOf, z as supervisorInstructions, zt as defaultSelectWinner } from "./supervise-JfKPwIlO.js";
|
|
7
7
|
import { a as sandboxClientAsProvider, i as resolveAgentEnvironmentProvider, n as providerAsExecutor, o as createTangleSandboxExactProcessProvider, r as providerAsSandboxClient, t as createAgentEnvironmentProviderRegistry } from "./environment-provider-CfLUmKmf.js";
|
|
8
|
-
export { DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_SANDBOX_STEERING_MAX_TURNS, DEFAULT_STALL_AFTER_MS, FileCorpus, FileResultBlobStore, FileSpawnJournal, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, McpSpawnFault, PI_RUNTIME, SandboxRunAbortError, acquireSandbox, adaptiveRefine, allOf, allWorkersStalled, analyzeTrace, anyOf, anytimeReport, areaUnderCurve, asAuthoredProfile, assertModelAllowed, assertStrategyContract, assertTraceDerivedFindings, assessAuthoredProfile, auditIntent, authorStrategy, authoredWorker, bestSoFar, breadthStrategy, buildSteerContext, builtinShapes, canDisplace, cliWorktreeExecutor, collectAgentTurn, compareCheckOutcomes, completionAuthorizes, composeCheckSources, computeFindingId, connectStdioMcp, contentAddress, createActivityLog, createAgentEnvironmentProviderRegistry, createBudgetPool, createEventBus, createExecutor, createExecutorRegistry, createFileRunContext, createInMemoryRunContext, createInbox, createMcpEnvironment, createProgressTracker, createPushTraceSource, createSandboxLineage, createSandboxToolPartState, createScope, createScopeAnalyst, createShapeRegistry, createSteerableSandboxSession, createSupervisor, createTangleSandboxExactProcessProvider, createVerifierEnvironment, createWaitProbes, createWaterfallCollector, createWorktreeCliExecutor, decodeToolPart, defaultAnalystInstruction, defaultAuditorInstruction, defaultDelegateBudget, defaultExtractCandidate, defaultProfileRichnessThresholds, defaultSelectWinner, defaultStructuralRolloutPolicy, defaultToolDetectors, defineLeaderboard, definePersona, defineStrategy, delegate, depthStrategy, deterministicCompletion, discriminatingMeans, driverAgent, dumbDriver, effectiveConcurrency, envKeyProvider, equalKOnCost, extractLlmCallEvent, failuresAnalyst, fanout, filterAuthoredAsserts, finalizeBestDelivered, flatWidenGate, freeSlots, gateOnDeliverable, gitWorkspace, harvestCorpus, inProcessSandboxClient, inlineSandboxClient, isWaitOutcome, jjWorkspace, leaderboard, localSandboxClient, localShell, loopCampaignDispatch, loopDispatch, loopUntil, makeFinding, mapSandboxEvent, mapSandboxToolEvent, materializeLocalMcp, materializeTreeView, mcpSecretEnvMetadataKey, modelAuthoredChecks, naiveDriver, noProgressFor, observe, officialChecksFromMeta, openSandboxRun, pairwiseSignificance, panel, patchDelivered, pendingWaits, piExecutor, piSeamKey, pickChampion, pipeline, plateau, plateauLength, pollFor, printBenchmarkReport, probeSandboxCapabilities, profileRichnessFinding, promotionGate, providerAsExecutor, providerAsSandboxClient, queueOf, readWorkerProgress, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderLeaderboardHtml, renderLeaderboardMarkdown, renderLeaderboardSvg, renderPairwiseMarkdown, renderReport, replaySpawnTree, resolveAgentEnvironmentProvider, resolveEntrySymbol, resolveSandboxClient, resolveSecretEnv, rollingDispatch, routerBrain, routerChatWithTools, routerChatWithUsage, routerToolLoop, runAgentRounds, runAgentic, runBenchmark, runInWorkspace, runLoop, runPersonified, runStrategyEvolution, sample, sampleFromSettled, sampleThenRefine, sandboxCheckRunner, sandboxClientAsProvider, sandboxSessionTraceSource, sanitizeMcpToolSchema, secretEnvOfMcpServer, selectBestIndex, selectChampion, selectValidWinner, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, streamAgentTurn, structuralRollout, sumSandboxUsage, supervise, superviseSurface, supervisorAgent, supervisorInstructions, timerAt, trajectoryReport, validateWaitSpec, verify, visibleCheckScore, waitUntil, watchTrace, widen, workerFromBackend, worktreeFanout };
|
|
8
|
+
export { DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DEFAULT_SANDBOX_STEERING_MAX_TURNS, DEFAULT_STALL_AFTER_MS, FileCoordinationLog, FileCorpus, FileResultBlobStore, FileSpawnJournal, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, McpSpawnFault, PI_RUNTIME, SandboxRunAbortError, acquireSandbox, adaptiveRefine, allOf, allWorkersStalled, analyzeTrace, anyOf, anytimeReport, areaUnderCurve, asAuthoredProfile, assertModelAllowed, assertStrategyContract, assertTraceDerivedFindings, assessAuthoredProfile, auditIntent, authorStrategy, authoredWorker, bestDelivered, bestSoFar, breadthStrategy, buildSteerContext, builtinShapes, canDisplace, cliWorktreeExecutor, collectAgentTurn, collectDelivered, compareCheckOutcomes, completionAuthorizes, composeCheckSources, computeFindingId, connectStdioMcp, contentAddress, createActivityLog, createAgentEnvironmentProviderRegistry, createBudgetPool, createEventBus, createExecutor, createExecutorRegistry, createFileRunContext, createInMemoryRunContext, createInbox, createMcpEnvironment, createProgressTracker, createPushTraceSource, createSandboxLineage, createSandboxToolPartState, createScope, createScopeAnalyst, createShapeRegistry, createSteerableSandboxSession, createSupervisor, createTangleSandboxExactProcessProvider, createVerifierEnvironment, createWaitProbes, createWaterfallCollector, createWorktreeCliExecutor, decodeToolPart, defaultAnalystInstruction, defaultAuditorInstruction, defaultDelegateBudget, defaultExtractCandidate, defaultProfileRichnessThresholds, defaultSelectWinner, defaultStructuralRolloutPolicy, defaultToolDetectors, defineLeaderboard, definePersona, defineStrategy, delegate, depthStrategy, deterministicCompletion, discriminatingMeans, driverAgent, dumbDriver, effectiveConcurrency, envKeyProvider, equalKOnCost, extractLlmCallEvent, failuresAnalyst, fanout, filterAuthoredAsserts, finalizeBestDelivered, flatWidenGate, freeSlots, gateOnDeliverable, gitWorkspace, harvestCorpus, inProcessSandboxClient, inlineSandboxClient, isWaitOutcome, jjWorkspace, leaderboard, localSandboxClient, localShell, loopCampaignDispatch, loopDispatch, loopUntil, makeFinding, mapSandboxEvent, mapSandboxToolEvent, materializeLocalMcp, materializeTreeView, mcpSecretEnvMetadataKey, modelAuthoredChecks, naiveDriver, noProgressFor, observe, officialChecksFromMeta, openSandboxRun, pairwiseSignificance, panel, patchDelivered, pendingWaits, piExecutor, piSeamKey, pickBestDelivered, pickChampion, pipeline, plateau, plateauLength, pollFor, printBenchmarkReport, probeSandboxCapabilities, profileRichnessFinding, promotionGate, providerAsExecutor, providerAsSandboxClient, queueOf, readWorkerProgress, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderLeaderboardHtml, renderLeaderboardMarkdown, renderLeaderboardSvg, renderPairwiseMarkdown, renderReport, replaySpawnTree, resolveAgentEnvironmentProvider, resolveEntrySymbol, resolveSandboxClient, resolveSecretEnv, rollingDispatch, routerBrain, routerChatWithTools, routerChatWithUsage, routerToolLoop, runAgentRounds, runAgentic, runBenchmark, runFinalizer, runInWorkspace, runLoop, runPersonified, runStrategyEvolution, runTree, sample, sampleFromSettled, sampleThenRefine, sandboxCheckRunner, sandboxClientAsProvider, sandboxSessionTraceSource, sanitizeMcpToolSchema, secretEnvOfMcpServer, selectBestIndex, selectChampion, selectValidWinner, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, streamAgentTurn, structuralRollout, sumSandboxUsage, supervise, superviseSurface, supervisorAgent, supervisorInstructions, timerAt, trajectoryReport, validateWaitSpec, verify, visibleCheckScore, waitUntil, watchTrace, widen, workerFromBackend, worktreeFanout };
|
package/dist/mcp/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as DelegationTaskQueue, X as FileDelegationStore, o as createMcpServer } from "../supervise-
|
|
2
|
+
import { B as DelegationTaskQueue, X as FileDelegationStore, o as createMcpServer } from "../supervise-JfKPwIlO.js";
|
|
3
3
|
import { a as resolveRouterBaseUrl } from "../model-resolution-Btd9iIKV.js";
|
|
4
4
|
import { n as readTraceContextFromEnv } from "../trace-propagation-CJJC7SVB.js";
|
|
5
5
|
//#region src/mcp/delegate-supervisor-provisioning.ts
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as SandboxClient, h as LoopSandboxPlacement } from "../types-BevOjfTY.js";
|
|
2
|
-
import { $c as
|
|
2
|
+
import { $c as DetachedWinnerSelection, $l as DelegationStatus, $s as createDelegateHandler, Ac as DiffOptions, Al as SubmitInput, As as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, Au as DELEGATION_TRACE_MAX_BYTES, Bc as JsonRpcMessage, Bl as DelegateResearchResult, Bs as SettledWorker, Bu as DelegationStateCorruptError, Cl as DelegationRecord, Dl as DelegationRunContext, Ds as CoordinationEvent, El as DelegationResumeTick, Es as AnalystRegistry, Fc as captureWorktreeDiff, Fl as DelegateCodeResult, Fs as QuestionLevel, Fu as buildDelegationTraceSpans, Gc as FeedbackStore, Gl as DelegationError, Gs as createInProcessTransport, Hc as McpToolDescriptor, Hl as DelegateUiAuditConfig, Hs as createCoordinationTools, Hu as FileDelegationStore, Ic as createWorktree, Il as DelegateFeedbackArgs, Is as QuestionOption, Iu as capDelegationTrace, Jc as CoderDelegate, Jl as DelegationHistoryEntry, Js as DELEGATE_INPUT_SCHEMA, Kc as InMemoryFeedbackStore, Kl as DelegationFeedbackSnapshot, Ks as createMcpServer, Lc as removeWorktree, Ll as DelegateFeedbackResult, Ls as QuestionPolicy, Lu as composeLoopTraceEmitters, Mc as GitRunner, Ml as hashIdempotencyInput, Ms as MakeWorkerAgent, Mu as DelegationTraceCaps, Nc as RemoveWorktreeOptions, Nl as DelegateCodeArgs, Ns as Question, Nu as DelegationTraceCollector, Ol as DelegationTaskQueue, Os as CoordinationTools, Pc as WorktreeHandle, Pl as DelegateCodeConfig, Ps as QuestionDecision, Pu as DelegationTraceSpan, Qc as DetachedSessionDelegateOptions, Ql as DelegationResultPayload, Qs as DelegateResult, Rl as DelegateResearchArgs, Rs as QuestionRecord, Ru as createDelegationTraceCollector, Sl as DelegationArgs, Tl as DelegationResumeDriver, Ts as AnalystFindingEvent, Uc as McpTransport, Ul as DelegateUiAuditResult, Us as McpServer, Uu as FileDelegationStoreOptions, Vc as JsonRpcResponse, Vl as DelegateUiAuditArgs, Vs as WorkerWatchOptions, Vu as DelegationStore, Wc as FeedbackEvent, Wl as DelegateUiAuditRoute, Ws as McpServerOptions, Wu as InMemoryDelegationStore, Xc as CoderReviewer, Xl as DelegationProfile, Xs as DelegateArgs, Yc as CoderReview, Yl as DelegationHistoryResult, Ys as DELEGATE_TOOL_NAME, Zc as DelegateRunCtx, Zl as DelegationProgress, Zs as DelegateHandlerOptions, _l as createDetachedTurnResumeDriver, al as DelegationExecutor, au as ResearchSource, bl as parseDetachedSessionRef, cl as SiblingSandboxExecutorOptions, cu as TraceContext, dl as DetachedSessionRefParts, du as traceContextToEnv, ec as validateDelegateArgs, ed as CoderOutput, el as SettleDetachedCoderTurnOptions, eu as DelegationStatusArgs, fl as DetachedTurn, gl as RunDetachedTurnOptions, hl as DriveTurnTick, il as settleDetachedCoderTurn, iu as ResearchOutputShape, jc as DiffResult, jl as SubmitOutput, js as DownMessageEvent, ju as DELEGATION_TRACE_MAX_SPANS, kc as CreateWorktreeOptions, kl as DelegationTaskQueueOptions, ks as CoordinationToolsOptions, ku as CappedDelegationTrace, ll as createFleetWorkspaceExecutor, lu as createPropagatingTraceEmitter, ml as DriveTurnCapableBox, nl as coderTaskFromArgs, nu as FeedbackRating, ol as FleetHandle, ou as UiAuditLensFilter, pl as DetachedTurnResumeDriverOptions, qc as eventToSnapshot, ql as DelegationHistoryArgs, qs as DELEGATE_DESCRIPTION, rl as detachedSessionDelegate, ru as FeedbackRefersTo, sl as FleetWorkspaceExecutorOptions, su as UiAuditorDelegationOutput, tl as UiAuditorDelegate, tu as DelegationStatusResult, ul as createSiblingSandboxExecutor, uu as readTraceContextFromEnv, vl as detachedTurnEvents, wl as DelegationResumeContext, xl as runDetachedTurn, yl as formatDetachedSessionRef, zl as DelegateResearchConfig, zs as QuestionUrgency, zu as DelegationPersistenceError } from "../index-BZbJWqoZ.js";
|
|
3
3
|
import { o as UiLens } from "../substrate-BcnuSHXm.js";
|
|
4
4
|
import { a as LocalHarnessResult, c as runLocalHarness, i as LocalHarness, n as CodexExecutionPolicy, o as RunLocalHarnessOptions, r as CodexTokenUsage, s as parseCodexTokenUsage, t as CodexExecutionEvidence } from "../local-harness-Dh8PJ0ot.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,11 +1,11 @@
|
|
|
1
1
|
import { u as ValidationError } from "../errors-DEAvWQPy.js";
|
|
2
2
|
import { l as throwAbort, n as deleteBoxSafe, s as sleep, u as throwIfAborted } from "../util-MVgdwuIS.js";
|
|
3
|
-
import {
|
|
4
|
-
import { W as selectValidWinner, m as runCoderChecks, q as assertTraceDerivedFindings } from "../runtime-
|
|
5
|
-
import { $ as eventToSnapshot, A as createDelegateHandler, B as DelegationTaskQueue, Bt as runAgentRounds, C as DELEGATE_FEEDBACK_INPUT_SCHEMA, D as DELEGATE_DESCRIPTION, E as validateDelegateFeedbackArgs, G as capDelegationTrace, H as DELEGATION_TRACE_MAX_BYTES, J as DelegationPersistenceError, K as composeLoopTraceEmitters, O as DELEGATE_INPUT_SCHEMA, Q as InMemoryFeedbackStore, Rt as createSandboxForSpec, S as DELEGATE_FEEDBACK_DESCRIPTION, T as createDelegateFeedbackHandler, U as DELEGATION_TRACE_MAX_SPANS, V as hashIdempotencyInput, W as buildDelegationTraceSpans, X as FileDelegationStore, Y as DelegationStateCorruptError, Z as InMemoryDelegationStore, _ as DELEGATE_UI_AUDIT_DESCRIPTION, a as createInProcessTransport, b as createDelegateUiAuditHandler, c as DELEGATION_STATUS_INPUT_SCHEMA, d as validateDelegationStatusArgs, f as DELEGATION_HISTORY_DESCRIPTION, g as validateDelegationHistoryArgs, h as createDelegationHistoryHandler, ht as createCoordinationTools, j as validateDelegateArgs, k as DELEGATE_TOOL_NAME, l as DELEGATION_STATUS_TOOL_NAME, m as DELEGATION_HISTORY_TOOL_NAME, mt as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, o as createMcpServer, p as DELEGATION_HISTORY_INPUT_SCHEMA, q as createDelegationTraceCollector, s as DELEGATION_STATUS_DESCRIPTION, u as createDelegationStatusHandler, v as DELEGATE_UI_AUDIT_INPUT_SCHEMA, w as DELEGATE_FEEDBACK_TOOL_NAME, x as validateDelegateUiAuditArgs, y as DELEGATE_UI_AUDIT_TOOL_NAME } from "../supervise-
|
|
3
|
+
import { F as removeWorktree, L as parseCodexTokenUsage, M as runWorktreeHarness, N as captureWorktreeDiff, P as createWorktree, R as runLocalHarness, z as CodexExecutionDiagnosticError } from "../supervisor-B2LzaWRb.js";
|
|
4
|
+
import { W as selectValidWinner, m as runCoderChecks, q as assertTraceDerivedFindings } from "../runtime-CDekUROm.js";
|
|
5
|
+
import { $ as eventToSnapshot, A as createDelegateHandler, B as DelegationTaskQueue, Bt as runAgentRounds, C as DELEGATE_FEEDBACK_INPUT_SCHEMA, D as DELEGATE_DESCRIPTION, E as validateDelegateFeedbackArgs, G as capDelegationTrace, H as DELEGATION_TRACE_MAX_BYTES, J as DelegationPersistenceError, K as composeLoopTraceEmitters, O as DELEGATE_INPUT_SCHEMA, Q as InMemoryFeedbackStore, Rt as createSandboxForSpec, S as DELEGATE_FEEDBACK_DESCRIPTION, T as createDelegateFeedbackHandler, U as DELEGATION_TRACE_MAX_SPANS, V as hashIdempotencyInput, W as buildDelegationTraceSpans, X as FileDelegationStore, Y as DelegationStateCorruptError, Z as InMemoryDelegationStore, _ as DELEGATE_UI_AUDIT_DESCRIPTION, a as createInProcessTransport, b as createDelegateUiAuditHandler, c as DELEGATION_STATUS_INPUT_SCHEMA, d as validateDelegationStatusArgs, f as DELEGATION_HISTORY_DESCRIPTION, g as validateDelegationHistoryArgs, h as createDelegationHistoryHandler, ht as createCoordinationTools, j as validateDelegateArgs, k as DELEGATE_TOOL_NAME, l as DELEGATION_STATUS_TOOL_NAME, m as DELEGATION_HISTORY_TOOL_NAME, mt as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, o as createMcpServer, p as DELEGATION_HISTORY_INPUT_SCHEMA, q as createDelegationTraceCollector, s as DELEGATION_STATUS_DESCRIPTION, u as createDelegationStatusHandler, v as DELEGATE_UI_AUDIT_INPUT_SCHEMA, w as DELEGATE_FEEDBACK_TOOL_NAME, x as validateDelegateUiAuditArgs, y as DELEGATE_UI_AUDIT_TOOL_NAME } from "../supervise-JfKPwIlO.js";
|
|
6
6
|
import { t as createStdioToolServer } from "../tool-server-RcWgLIsL.js";
|
|
7
7
|
import { t as createKbGate } from "../kb-gate-DpaSwXVx.js";
|
|
8
|
-
import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-
|
|
8
|
+
import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-BjQq2TTL.js";
|
|
9
9
|
import { t as coderTaskToPrompt } from "../coder-yhVWbdWc.js";
|
|
10
10
|
import { a as createMemoryToolServer, c as resolveMemoryFromEnv, i as MEMORY_NAME_ENV, n as MEMORY_ITEMS_ENV, o as parseMemoryItems, r as MEMORY_LOG_ENV, s as readMemoryItemsFile, t as MEMORY_FILE_ENV } from "../memory-server-DL6cE2Ag.js";
|
|
11
11
|
import { n as readTraceContextFromEnv, r as traceContextToEnv, t as createPropagatingTraceEmitter } from "../trace-propagation-CJJC7SVB.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as DELEGATE_FEEDBACK_INPUT_SCHEMA, S as DELEGATE_FEEDBACK_DESCRIPTION, c as DELEGATION_STATUS_INPUT_SCHEMA, f as DELEGATION_HISTORY_DESCRIPTION, l as DELEGATION_STATUS_TOOL_NAME, m as DELEGATION_HISTORY_TOOL_NAME, p as DELEGATION_HISTORY_INPUT_SCHEMA, s as DELEGATION_STATUS_DESCRIPTION, w as DELEGATE_FEEDBACK_TOOL_NAME } from "./supervise-
|
|
1
|
+
import { C as DELEGATE_FEEDBACK_INPUT_SCHEMA, S as DELEGATE_FEEDBACK_DESCRIPTION, c as DELEGATION_STATUS_INPUT_SCHEMA, f as DELEGATION_HISTORY_DESCRIPTION, l as DELEGATION_STATUS_TOOL_NAME, m as DELEGATION_HISTORY_TOOL_NAME, p as DELEGATION_HISTORY_INPUT_SCHEMA, s as DELEGATION_STATUS_DESCRIPTION, w as DELEGATE_FEEDBACK_TOOL_NAME } from "./supervise-JfKPwIlO.js";
|
|
2
2
|
//#region src/mcp/openai-tools.ts
|
|
3
3
|
function buildTool(name, description, parameters) {
|
|
4
4
|
return {
|
|
@@ -41,4 +41,4 @@ function mcpToolsForRuntimeMcpSubset(names) {
|
|
|
41
41
|
//#endregion
|
|
42
42
|
export { mcpToolsForRuntimeMcpSubset as n, mcpToolsForRuntimeMcp as t };
|
|
43
43
|
|
|
44
|
-
//# sourceMappingURL=openai-tools-
|
|
44
|
+
//# sourceMappingURL=openai-tools-BjQq2TTL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-tools-
|
|
1
|
+
{"version":3,"file":"openai-tools-BjQq2TTL.js","names":[],"sources":["../src/mcp/openai-tools.ts"],"sourcesContent":["/**\n *\n * OpenAI Chat Completions `tools[]` projection of the queue-bound agent-runtime\n * MCP delegation tools.\n *\n * Use when configuring `createOpenAICompatibleBackend({ tools: ... })` so the\n * model can call `delegate_feedback`, `delegation_status`, and\n * `delegation_history` through the OpenAI-compat transport (tcloud, OpenRouter,\n * OpenAI direct, cli-bridge). The runtime surfaces tool calls as `tool_call`\n * stream events — execution is the caller's responsibility (typically the\n * parent sandbox runtime's MCP mount).\n *\n * Sandbox-SDK callers do NOT need this helper: the sandbox runtime mounts\n * MCP servers natively and the in-sandbox harness discovers tools via the\n * runtime, not via an OpenAI tools array.\n *\n * Tool name + description + JSON-schema are pulled from the canonical\n * `DELEGATE_*` constants exported by `./tools/*` so the projection cannot\n * drift from the server's own validators.\n *\n * @experimental\n */\n\nimport type { OpenAIChatTool } from '../types'\nimport {\n DELEGATE_FEEDBACK_DESCRIPTION,\n DELEGATE_FEEDBACK_INPUT_SCHEMA,\n DELEGATE_FEEDBACK_TOOL_NAME,\n} from './tools/delegate-feedback'\nimport {\n DELEGATION_HISTORY_DESCRIPTION,\n DELEGATION_HISTORY_INPUT_SCHEMA,\n DELEGATION_HISTORY_TOOL_NAME,\n} from './tools/delegation-history'\nimport {\n DELEGATION_STATUS_DESCRIPTION,\n DELEGATION_STATUS_INPUT_SCHEMA,\n DELEGATION_STATUS_TOOL_NAME,\n} from './tools/delegation-status'\n\nfunction buildTool(\n name: string,\n description: string,\n parameters: Readonly<Record<string, unknown>>,\n): OpenAIChatTool {\n // `parameters` arrives as a deeply-readonly `as const` literal. The\n // OpenAI-compat backend JSON-serializes the body so a shallow copy\n // into a plain object is sufficient — and shields callers that mutate\n // the returned descriptor from corrupting the source constant.\n return {\n type: 'function',\n function: { name, description, parameters: { ...parameters } },\n }\n}\n\n/**\n *\n * Returns the queue-bound delegation tools projected into OpenAI Chat\n * Completions `tools[]` shape. The order is stable: `delegate_feedback`,\n * `delegation_status`, `delegation_history`.\n *\n * @experimental\n */\nexport function mcpToolsForRuntimeMcp(): OpenAIChatTool[] {\n return [\n buildTool(\n DELEGATE_FEEDBACK_TOOL_NAME,\n DELEGATE_FEEDBACK_DESCRIPTION,\n DELEGATE_FEEDBACK_INPUT_SCHEMA as Readonly<Record<string, unknown>>,\n ),\n buildTool(\n DELEGATION_STATUS_TOOL_NAME,\n DELEGATION_STATUS_DESCRIPTION,\n DELEGATION_STATUS_INPUT_SCHEMA as Readonly<Record<string, unknown>>,\n ),\n buildTool(\n DELEGATION_HISTORY_TOOL_NAME,\n DELEGATION_HISTORY_DESCRIPTION,\n DELEGATION_HISTORY_INPUT_SCHEMA as Readonly<Record<string, unknown>>,\n ),\n ]\n}\n\n/**\n *\n * Subset filter — return only the projected tools whose `function.name`\n * appears in `names`. Useful for curated mounts (e.g. only the queue-bound\n * delegation tools, omitting `delegate_feedback`). Unknown names are\n * silently ignored; pass an empty array to get an empty result.\n *\n * @experimental\n */\nexport function mcpToolsForRuntimeMcpSubset(names: ReadonlyArray<string>): OpenAIChatTool[] {\n const allowed = new Set(names)\n return mcpToolsForRuntimeMcp().filter((tool) => allowed.has(tool.function.name))\n}\n"],"mappings":";;AAwCA,SAAS,UACP,MACA,aACA,YACgB;CAKhB,OAAO;EACL,MAAM;EACN,UAAU;GAAE;GAAM;GAAa,YAAY,EAAE,GAAG,WAAW;EAAE;CAC/D;AACF;;;;;;;;;AAUA,SAAgB,wBAA0C;CACxD,OAAO;EACL,UACE,6BACA,+BACA,8BACF;EACA,UACE,6BACA,+BACA,8BACF;EACA,UACE,8BACA,gCACA,+BACF;CACF;AACF;;;;;;;;;;AAWA,SAAgB,4BAA4B,OAAgD;CAC1F,MAAM,UAAU,IAAI,IAAI,KAAK;CAC7B,OAAO,sBAAsB,CAAC,CAAC,QAAQ,SAAS,QAAQ,IAAI,KAAK,SAAS,IAAI,CAAC;AACjF"}
|
|
@@ -198,14 +198,14 @@ function agentCandidateProfileAsAgentProfile(candidate) {
|
|
|
198
198
|
if (candidate.model) output.model = { ...candidate.model };
|
|
199
199
|
if (candidate.mcp) output.mcp = Object.fromEntries(Object.entries(candidate.mcp).map(([name, server]) => [name, {
|
|
200
200
|
...server,
|
|
201
|
-
...server.args ? { args: server.args.map(publicValue) } : {},
|
|
201
|
+
...server.args ? { args: server.args.map(publicValue$1) } : {},
|
|
202
202
|
...server.env ? { env: mapPublicValues(server.env) } : {}
|
|
203
203
|
}]));
|
|
204
204
|
if (candidate.subagents) output.subagents = cloneRecord(candidate.subagents);
|
|
205
205
|
if (candidate.modes) output.modes = cloneRecord(candidate.modes);
|
|
206
206
|
if (candidate.hooks) output.hooks = Object.fromEntries(Object.entries(candidate.hooks).map(([event, hooks]) => [event, hooks.map(({ executable, args, env, ...hook }) => ({
|
|
207
207
|
...hook,
|
|
208
|
-
command: [executable, ...(args ?? []).map(publicValue)].map(shellQuote).join(" "),
|
|
208
|
+
command: [executable, ...(args ?? []).map(publicValue$1)].map(shellQuote).join(" "),
|
|
209
209
|
...env ? { env: mapPublicValues(env) } : {}
|
|
210
210
|
}))]));
|
|
211
211
|
if (candidate.resources) {
|
|
@@ -302,11 +302,11 @@ function candidatePublicValue(value) {
|
|
|
302
302
|
function mapCandidatePublicValues(values) {
|
|
303
303
|
return Object.fromEntries(Object.entries(values).map(([name, value]) => [name, candidatePublicValue(value)]));
|
|
304
304
|
}
|
|
305
|
-
function publicValue(value) {
|
|
305
|
+
function publicValue$1(value) {
|
|
306
306
|
return value.value;
|
|
307
307
|
}
|
|
308
308
|
function mapPublicValues(values) {
|
|
309
|
-
return Object.fromEntries(Object.entries(values).map(([key, value]) => [key, publicValue(value)]));
|
|
309
|
+
return Object.fromEntries(Object.entries(values).map(([key, value]) => [key, publicValue$1(value)]));
|
|
310
310
|
}
|
|
311
311
|
function cloneRecord(values) {
|
|
312
312
|
return Object.fromEntries(Object.entries(values).map(([key, value]) => [key, { ...value }]));
|
|
@@ -3731,6 +3731,136 @@ var CandidateExecutionDeadlineError = class extends Error {
|
|
|
3731
3731
|
}
|
|
3732
3732
|
};
|
|
3733
3733
|
//#endregion
|
|
3734
|
+
//#region src/candidate-execution/system-prompt.ts
|
|
3735
|
+
const NATIVE_EXECUTABLES = {
|
|
3736
|
+
"claude-code": "claude",
|
|
3737
|
+
codex: "codex",
|
|
3738
|
+
opencode: "opencode",
|
|
3739
|
+
pi: "pi"
|
|
3740
|
+
};
|
|
3741
|
+
const SYSTEM_PROMPT_FILE = ".tangle/system-prompt.md";
|
|
3742
|
+
/** Project a replacement system prompt onto the exact native process control. */
|
|
3743
|
+
function projectCandidateSystemPrompt(plan, launch, systemPromptFilePath) {
|
|
3744
|
+
const systemPrompt = plan.systemPrompt;
|
|
3745
|
+
if (systemPrompt === void 0) return plan;
|
|
3746
|
+
const expectedExecutable = NATIVE_EXECUTABLES[plan.harness];
|
|
3747
|
+
if (!expectedExecutable) throw new Error(`candidate system prompt has no native launch projection for ${plan.harness}`);
|
|
3748
|
+
if (launch.kind !== "container-command") throw new Error(`candidate-entrypoint launch cannot prove ${plan.harness} system-prompt replacement`);
|
|
3749
|
+
if (launch.executable !== expectedExecutable && !(posix.isAbsolute(launch.executable) && posix.basename(launch.executable) === expectedExecutable)) throw new Error(`${plan.harness} system-prompt replacement requires the native ${expectedExecutable} executable`);
|
|
3750
|
+
assertNoSystemPromptOverride(plan.harness, launch.args ?? []);
|
|
3751
|
+
const projectedPlan = omitUnappliedSystemPrompt(plan);
|
|
3752
|
+
switch (plan.harness) {
|
|
3753
|
+
case "codex": return appendFlags(projectedPlan, "-c", `developer_instructions=${tomlString(systemPrompt.value)}`);
|
|
3754
|
+
case "claude-code": return appendFlags(addSystemPromptFile(projectedPlan, systemPrompt.value), "--system-prompt-file", systemPromptFilePath);
|
|
3755
|
+
case "opencode": return {
|
|
3756
|
+
...projectedPlan,
|
|
3757
|
+
files: projectOpenCodeSystemPrompt(projectedPlan.files, systemPrompt.value)
|
|
3758
|
+
};
|
|
3759
|
+
case "pi": return appendFlags(addSystemPromptFile(projectedPlan, systemPrompt.value), "--system-prompt", systemPromptFilePath);
|
|
3760
|
+
default: throw new Error(`candidate system prompt has no native launch projection for ${plan.harness}`);
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
function omitUnappliedSystemPrompt(plan) {
|
|
3764
|
+
const { systemPrompt: _systemPrompt, ...projected } = plan;
|
|
3765
|
+
return projected;
|
|
3766
|
+
}
|
|
3767
|
+
function appendFlags(plan, ...values) {
|
|
3768
|
+
return {
|
|
3769
|
+
...plan,
|
|
3770
|
+
flags: [...plan.flags, ...values.map(publicValue)]
|
|
3771
|
+
};
|
|
3772
|
+
}
|
|
3773
|
+
function publicValue(value) {
|
|
3774
|
+
return {
|
|
3775
|
+
kind: "public",
|
|
3776
|
+
value
|
|
3777
|
+
};
|
|
3778
|
+
}
|
|
3779
|
+
function addSystemPromptFile(plan, systemPrompt) {
|
|
3780
|
+
if (plan.files.some((file) => file.relPath === SYSTEM_PROMPT_FILE)) throw new Error(`candidate profile conflicts with reserved ${SYSTEM_PROMPT_FILE}`);
|
|
3781
|
+
return {
|
|
3782
|
+
...plan,
|
|
3783
|
+
files: [...plan.files, {
|
|
3784
|
+
relPath: SYSTEM_PROMPT_FILE,
|
|
3785
|
+
content: systemPrompt,
|
|
3786
|
+
source: "generated"
|
|
3787
|
+
}]
|
|
3788
|
+
};
|
|
3789
|
+
}
|
|
3790
|
+
function assertNoSystemPromptOverride(harness, args) {
|
|
3791
|
+
const values = args.map((value) => value.value);
|
|
3792
|
+
if (harness === "claude-code" || harness === "pi") {
|
|
3793
|
+
if (values.some((value) => value === "--system-prompt" || value.startsWith("--system-prompt=") || value === "--system-prompt-file" || value.startsWith("--system-prompt-file="))) throw new Error(`${harness} launch arguments conflict with the candidate profile system prompt`);
|
|
3794
|
+
return;
|
|
3795
|
+
}
|
|
3796
|
+
if (harness !== "codex") return;
|
|
3797
|
+
for (let index = 0; index < values.length; index++) {
|
|
3798
|
+
const value = values[index];
|
|
3799
|
+
if ((value === "-c" || value === "--config" ? values[index + 1] : value.startsWith("--config=") ? value.slice(9) : void 0)?.trimStart().startsWith("developer_instructions=")) throw new Error("codex launch arguments conflict with the candidate profile system prompt");
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
function projectOpenCodeSystemPrompt(files, prompt) {
|
|
3803
|
+
const configIndex = files.findIndex((file) => file.relPath === "opencode.json");
|
|
3804
|
+
if (configIndex === -1) return [...files, {
|
|
3805
|
+
relPath: "opencode.json",
|
|
3806
|
+
content: openCodeConfigWithPrompt({}, prompt),
|
|
3807
|
+
source: "generated"
|
|
3808
|
+
}];
|
|
3809
|
+
const configFile = files[configIndex];
|
|
3810
|
+
if (configFile.source !== "generated") throw new Error("opencode system-prompt replacement requires generated opencode.json");
|
|
3811
|
+
const config = parseJsonObject(configFile.content, "generated opencode.json");
|
|
3812
|
+
const output = [...files];
|
|
3813
|
+
output[configIndex] = {
|
|
3814
|
+
...configFile,
|
|
3815
|
+
content: openCodeConfigWithPrompt(config, prompt)
|
|
3816
|
+
};
|
|
3817
|
+
return output;
|
|
3818
|
+
}
|
|
3819
|
+
function openCodeConfigWithPrompt(config, prompt) {
|
|
3820
|
+
const agent = optionalJsonObject(config.agent, "generated opencode.json agent");
|
|
3821
|
+
const build = optionalJsonObject(agent.build, "generated opencode.json agent.build");
|
|
3822
|
+
const plan = optionalJsonObject(agent.plan, "generated opencode.json agent.plan");
|
|
3823
|
+
assertCompatiblePrompt(build.prompt, prompt, "build");
|
|
3824
|
+
assertCompatiblePrompt(plan.prompt, prompt, "plan");
|
|
3825
|
+
return JSON.stringify({
|
|
3826
|
+
$schema: "https://opencode.ai/config.json",
|
|
3827
|
+
...config,
|
|
3828
|
+
agent: {
|
|
3829
|
+
...agent,
|
|
3830
|
+
build: {
|
|
3831
|
+
...build,
|
|
3832
|
+
prompt
|
|
3833
|
+
},
|
|
3834
|
+
plan: {
|
|
3835
|
+
...plan,
|
|
3836
|
+
prompt
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
}, null, 2);
|
|
3840
|
+
}
|
|
3841
|
+
function parseJsonObject(content, label) {
|
|
3842
|
+
let value;
|
|
3843
|
+
try {
|
|
3844
|
+
value = JSON.parse(content);
|
|
3845
|
+
} catch (cause) {
|
|
3846
|
+
throw new Error(`${label} must contain valid JSON`, { cause });
|
|
3847
|
+
}
|
|
3848
|
+
return jsonObject(value, label);
|
|
3849
|
+
}
|
|
3850
|
+
function optionalJsonObject(value, label) {
|
|
3851
|
+
return value === void 0 ? {} : jsonObject(value, label);
|
|
3852
|
+
}
|
|
3853
|
+
function jsonObject(value, label) {
|
|
3854
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error(`${label} must be a JSON object`);
|
|
3855
|
+
return value;
|
|
3856
|
+
}
|
|
3857
|
+
function assertCompatiblePrompt(value, prompt, agent) {
|
|
3858
|
+
if (value !== void 0 && value !== prompt) throw new Error(`generated opencode.json agent.${agent}.prompt conflicts with the profile`);
|
|
3859
|
+
}
|
|
3860
|
+
function tomlString(value) {
|
|
3861
|
+
return `"${value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\n", "\\n").replaceAll("\r", "\\r").replaceAll(" ", "\\t")}"`;
|
|
3862
|
+
}
|
|
3863
|
+
//#endregion
|
|
3734
3864
|
//#region src/candidate-execution/prepare.ts
|
|
3735
3865
|
const MIN_RESERVATION_TTL_MS = 15 * 6e4;
|
|
3736
3866
|
const PREPARED_HOLD_MARGIN_MS = 5 * 6e4;
|
|
@@ -3778,7 +3908,7 @@ async function prepareAgentCandidateExecution(candidate, task, ports, options =
|
|
|
3778
3908
|
candidateExecutorFiles = await readMaterializedWorkspaceFiles(task.stagingRoots.candidateRoot, bundle.execution.workspace.material);
|
|
3779
3909
|
} else if (task.stagingRoots.candidateRoot || task.executionRoots.candidateRoot) throw new Error("disabled code cannot receive a candidate workspace root");
|
|
3780
3910
|
await assertEmptyDirectory(task.stagingRoots.profileRoot);
|
|
3781
|
-
const profileWorkspacePlan = materializeCandidateProfile(bundle.profile, harness, { resolvedResources: verifiedResourceTextByDigest(candidate) });
|
|
3911
|
+
const profileWorkspacePlan = projectCandidateSystemPrompt(materializeCandidateProfile(bundle.profile, harness, { resolvedResources: verifiedResourceTextByDigest(candidate) }), bundle.execution.launch, profileSystemPromptExecutionPath(bundle.execution.cwd.workspace, task.executionRoots));
|
|
3782
3912
|
const profileApplication = applyAgentCandidateWorkspacePlan(profileWorkspacePlan, task.stagingRoots.profileRoot, bundle.execution.cwd.workspace);
|
|
3783
3913
|
await verifyMaterializedProfileWorkspace(task.stagingRoots.profileRoot, profileApplication.profileActivation.profilePlan.material);
|
|
3784
3914
|
const profilePlanBytes = await readVerifiedArtifact(profileApplication.profileActivation.profilePlan.artifact, ports.artifacts);
|
|
@@ -4251,6 +4381,11 @@ function absoluteExecutionCwd(cwd, roots) {
|
|
|
4251
4381
|
if (absolute !== root && !absolute.startsWith(`${root}/`)) throw new Error("candidate cwd escapes its execution workspace");
|
|
4252
4382
|
return absolute;
|
|
4253
4383
|
}
|
|
4384
|
+
function profileSystemPromptExecutionPath(workspace, roots) {
|
|
4385
|
+
const root = workspace === "task" ? roots.taskRoot : roots.candidateRoot;
|
|
4386
|
+
if (!root) throw new Error("candidate profile target is missing its execution workspace root");
|
|
4387
|
+
return posix.join(root, ".tangle/system-prompt.md");
|
|
4388
|
+
}
|
|
4254
4389
|
function validateProtectedModelReservation(reservation, expectedLimits, preparationId, expiresAtMs) {
|
|
4255
4390
|
if (!/^sha256:[a-f0-9]{64}$/.test(reservation.digest)) throw new Error("protected model reservation has an invalid identity digest");
|
|
4256
4391
|
if (reservation.preparationId !== preparationId || reservation.expiresAtMs !== expiresAtMs) throw new Error("protected model reservation is not scoped to this preparation");
|
|
@@ -4306,4 +4441,4 @@ function errorMessage(error) {
|
|
|
4306
4441
|
//#endregion
|
|
4307
4442
|
export { parseExactAgentProfile as $, verifyMaterializedWorkspace as A, rejectedStage as B, assertNoGitIndirection as C, captureMaterializedWorkspace as D, candidateWorkspaceManifest as E, assertTerminalAllowedInPhase as F, agentCandidateProfileAsAgentProfile as G, sealTerminalDigest as H, assertTerminalMatchesClaim as I, candidateMaterializerHarness as J, applyExactAgentProfileDiff as K, assertTerminalMatchesStaged as L, candidateCleanupTimeout as M, withinCandidateCleanupDeadline as N, readVerifiedArtifact as O, assertRecoveryMatchesStaged as P, parseAgentCandidateProfileActivation as Q, recoveredTerminalRecord as R, CANDIDATE_TRACE_TAGS as S, runCandidateGit as T, terminalRecord as U, requireStagedTerminal as V, assertExactObjectKeys as W, freezeGenericAgentCandidateProfile as X, createAgentCandidateProfileActivation as Y, omitUndefinedObjectFields as Z, candidateExecutionClaim as _, persistCandidateOutputArtifact as a, deepFreezeCandidate as at, consumePreparedCandidateExecution as b, CANDIDATE_KNOWLEDGE_ROOT_ENV as c, omitTopLevelDigest as ct, verifiedResourceTextByDigest as d, parseExactAgentProfileDiff as et, verifyAgentCandidateBundle as f, candidateClaimFileInternals as g, InMemoryAgentCandidateExecutionClaimStore as h, persistCandidateModelSettlementEvidence as i, canonicalCandidateDocument as it, candidateCleanupDeadline as j, verifyBytes as k, candidateKnowledgeExecutionPaths as l, sha256Bytes as lt, usdToNanos as m, executePreparedAgentCandidate as n, canonicalCandidateBytes as nt, sealAgentCandidateExecutorStopAcknowledgement as o, embeddedCandidateArtifact as ot, sealAgentCandidateModelSettlement as p, assertCandidateProfileBinding as q, RecoveryAgentCandidateTraceStore as r, canonicalCandidateDigest$1 as rt, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV as s, immutableCandidateValue as st, prepareAgentCandidateExecution as t, parseExactCandidateProfile as tt, AGENT_CANDIDATE_EXECUTION_SUPPORT as u, verifyCanonicalCandidateDocument as ut, assertPreparedCandidateIntegrity as v, readCandidateGitTreeFiles as w, CANDIDATE_TRACE_ENV as x, beginPreparedCandidateDisposal as y, rejectedFinish as z };
|
|
4308
4443
|
|
|
4309
|
-
//# sourceMappingURL=prepare-
|
|
4444
|
+
//# sourceMappingURL=prepare-Pr19X93k.js.map
|