@tangle-network/agent-runtime 0.138.0 → 0.138.1

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.
Files changed (51) hide show
  1. package/dist/{activation-BHoMDzMv.js → activation-AyIFaunX.js} +3 -3
  2. package/dist/{activation-BHoMDzMv.js.map → activation-AyIFaunX.js.map} +1 -1
  3. package/dist/agent.js +2 -2
  4. package/dist/{authoring-rEOOEWn6.js → authoring-Cw6Ufsng.js} +2 -2
  5. package/dist/{authoring-rEOOEWn6.js.map → authoring-Cw6Ufsng.js.map} +1 -1
  6. package/dist/candidate-execution/index.js +4 -4
  7. package/dist/{candidate-execution-CyCLYLfK.js → candidate-execution-CN2hO-og.js} +4 -4
  8. package/dist/{candidate-execution-CyCLYLfK.js.map → candidate-execution-CN2hO-og.js.map} +1 -1
  9. package/dist/durable.d.ts +34 -1
  10. package/dist/durable.js +82 -1
  11. package/dist/durable.js.map +1 -1
  12. package/dist/{graph-yaEG0ZiR.js → graph-DxU92LTL.js} +3 -3
  13. package/dist/{graph-yaEG0ZiR.js.map → graph-DxU92LTL.js.map} +1 -1
  14. package/dist/{improvement-cycle-BeVj-EGJ.js → improvement-cycle-hIOGxDtV.js} +4 -4
  15. package/dist/{improvement-cycle-BeVj-EGJ.js.map → improvement-cycle-hIOGxDtV.js.map} +1 -1
  16. package/dist/index.d.ts +72 -2
  17. package/dist/index.js +106 -15
  18. package/dist/index.js.map +1 -1
  19. package/dist/intelligence.js +5 -5
  20. package/dist/jsonl-file-DtxhdAkZ.js +57 -0
  21. package/dist/jsonl-file-DtxhdAkZ.js.map +1 -0
  22. package/dist/kernel.js +7 -7
  23. package/dist/{knowledge-C1TcOBf6.js → knowledge-C-JiS5Xg.js} +5 -5
  24. package/dist/{knowledge-C1TcOBf6.js.map → knowledge-C-JiS5Xg.js.map} +1 -1
  25. package/dist/knowledge.js +1 -1
  26. package/dist/{loop-runner-bin-DhUWzpNp.js → loop-runner-bin-B_Ww2iqY.js} +3 -3
  27. package/dist/{loop-runner-bin-DhUWzpNp.js.map → loop-runner-bin-B_Ww2iqY.js.map} +1 -1
  28. package/dist/loop-runner-bin.js +1 -1
  29. package/dist/mcp/bin.js +3 -3
  30. package/dist/mcp/index.js +4 -4
  31. package/dist/{openai-tools-K38wcStR.js → openai-tools-BKJqaQ1b.js} +2 -2
  32. package/dist/{openai-tools-K38wcStR.js.map → openai-tools-BKJqaQ1b.js.map} +1 -1
  33. package/dist/{prepare-Czki1LBy.js → prepare-CYqGSYza.js} +2 -2
  34. package/dist/{prepare-Czki1LBy.js.map → prepare-CYqGSYza.js.map} +1 -1
  35. package/dist/{protected-model-port-OhS0l_6m.js → protected-model-port-B6DW_x2I.js} +2 -2
  36. package/dist/{protected-model-port-OhS0l_6m.js.map → protected-model-port-B6DW_x2I.js.map} +1 -1
  37. package/dist/{runtime-yCuqlhou.js → runtime-CUpB4rEP.js} +7 -7
  38. package/dist/{runtime-yCuqlhou.js.map → runtime-CUpB4rEP.js.map} +1 -1
  39. package/dist/{spawn-journal-ZKEKel8N.js → spawn-journal-DVFqdzO9.js} +3 -56
  40. package/dist/spawn-journal-DVFqdzO9.js.map +1 -0
  41. package/dist/{structural-rollout-2Z6J5ttt.js → structural-rollout-CwtVIJf-.js} +3 -3
  42. package/dist/{structural-rollout-2Z6J5ttt.js.map → structural-rollout-CwtVIJf-.js.map} +1 -1
  43. package/dist/{supervise-to2ynnCG.js → supervise-CUJRmx3s.js} +4 -3
  44. package/dist/{supervise-to2ynnCG.js.map → supervise-CUJRmx3s.js.map} +1 -1
  45. package/dist/{supervisor-BfJNS2Z3.js → supervisor-BoC2tFgH.js} +2 -2
  46. package/dist/{supervisor-BfJNS2Z3.js.map → supervisor-BoC2tFgH.js.map} +1 -1
  47. package/dist/testing.js +12 -12
  48. package/dist/{workspace-archive-B_JDld25.js → workspace-archive-C7AvjSVb.js} +2 -2
  49. package/dist/{workspace-archive-B_JDld25.js.map → workspace-archive-C7AvjSVb.js.map} +1 -1
  50. package/package.json +4 -4
  51. package/dist/spawn-journal-ZKEKel8N.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ import { _ as researchLoopRunner, a as DELEGATED_LOOP_MODES, c as DelegatedLoopR
15
15
  import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "./openai-tools-DU3TZvFY.js";
16
16
  import { ControlBudget, ControlDecision, ControlEvalResult, ControlEvalResult as ControlEvalResult$1, ControlRunResult, ControlStep, DataAcquisitionPlan, KnowledgeReadinessReport, KnowledgeReadinessReport as KnowledgeReadinessReport$1, KnowledgeRequirement, ProposalFinding, RunRecord, RunRecord as RunRecord$1 } from "@tangle-network/agent-eval";
17
17
  import { GepaOptimizationMethodConfig, SkillOptOptimizationMethodConfig } from "@tangle-network/agent-eval/campaign";
18
- import { AgentProfile as AgentProfile$1 } from "@tangle-network/agent-interface";
18
+ import { AgentProfile as AgentProfile$1, Sha256Digest } from "@tangle-network/agent-interface";
19
19
  import { MutableSurface, Scenario as Scenario$1, SelfImproveOptions } from "@tangle-network/agent-eval/contract";
20
20
  //#region src/backends.d.ts
21
21
  /** Wrap any custom async-iterable stream into a typed `AgentExecutionBackend`. @stable */
@@ -142,6 +142,76 @@ declare const optimizerMethod: string;
142
142
  */
143
143
  declare const strategyAuthorMethod: string;
144
144
  //#endregion
145
+ //#region src/improvement/profile-improvement-harness.d.ts
146
+ interface CreateProfileImprovementHarnessOptions<TScenario extends Scenario$1, TArtifact> {
147
+ /** Exact baseline profile. It is parsed, detached, and frozen at construction. */
148
+ profile: AgentProfile$1;
149
+ /**
150
+ * Immutable identity of the bound executor, models, tools, component mapping,
151
+ * and every closure or external setting that can change measured behavior.
152
+ */
153
+ executionRef: Sha256Digest;
154
+ /** Execute one exact materialized profile on one scenario. */
155
+ agent: ImproveProfileAgent<TScenario, TArtifact>;
156
+ /** Optional validator shared by every run from this harness. */
157
+ validateCandidate?: ImproveCandidateValidator;
158
+ }
159
+ type ProfileImprovementHarnessRunOptions<TScenario extends Scenario$1, TArtifact> = Omit<ImproveMethodOptions<TScenario, TArtifact>, 'executionRef' | 'agent' | 'validateCandidate'> & {
160
+ /** Override the harness-level validator for this run. */
161
+ validateCandidate?: ImproveCandidateValidator;
162
+ };
163
+ /**
164
+ * A small, reusable front door over `improve(profile, options)`.
165
+ *
166
+ * The harness freezes the baseline and binds execution identity once, which
167
+ * removes the two easiest sources of accidental experiment drift when a
168
+ * developer runs several methods, surfaces, or held-out suites against the
169
+ * same agent. It does not replace or narrow `improve`; callers retain every
170
+ * method option and may still use the lower-level API directly.
171
+ */
172
+ interface ProfileImprovementHarness<TScenario extends Scenario$1, TArtifact> {
173
+ /** Detached immutable baseline actually used by every run. */
174
+ readonly profile: ReadonlyAgentProfile;
175
+ /** Canonical digest of the bound baseline profile. */
176
+ readonly profileDigest: Sha256Digest;
177
+ /** Exact execution identity bound at construction. */
178
+ readonly executionRef: Sha256Digest;
179
+ run(options: ProfileImprovementHarnessRunOptions<TScenario, TArtifact>): Promise<ImproveMethodResult>;
180
+ }
181
+ /**
182
+ * Bind one exact profile and executor into a repeatable self-improvement
183
+ * harness. The returned `run` method remains generic over every existing
184
+ * profile surface, optimization method, split, gate, and budget option.
185
+ */
186
+ declare function createProfileImprovementHarness<TScenario extends Scenario$1, TArtifact>(options: CreateProfileImprovementHarnessOptions<TScenario, TArtifact>): ProfileImprovementHarness<TScenario, TArtifact>;
187
+ //#endregion
188
+ //#region src/improvement/prompt-instructions-profile-components.d.ts
189
+ /** Stable component-name prefix used for `profile.prompt.instructions`. */
190
+ declare const PROMPT_INSTRUCTION_COMPONENT_PREFIX = "prompt.instruction:";
191
+ /**
192
+ * Canonical `ImproveProfileComponents` mapping for the ordered
193
+ * `AgentProfile.prompt.instructions` list.
194
+ *
195
+ * Use it with `surface: 'agent-profile'` when an optimizer should rewrite the
196
+ * exact instruction texts without being allowed to change their count, order,
197
+ * labels, or any unrelated profile field:
198
+ *
199
+ * ```ts
200
+ * await improve(profile, {
201
+ * surface: 'agent-profile',
202
+ * profileComponents: promptInstructionsProfileComponents,
203
+ * // method, scenarios, judge, executionRef, agent, ...
204
+ * })
205
+ * ```
206
+ *
207
+ * Component names are zero-padded and stable. Runtime's existing component
208
+ * materializer requires every candidate to preserve the exact key set and
209
+ * verifies that `apply(read(profile))` reproduces the baseline profile. A
210
+ * profile with no prompt instructions is refused rather than inventing a
211
+ * sentinel instruction that could accidentally ship.
212
+ */
213
+ declare const promptInstructionsProfileComponents: ImproveProfileComponents;
214
+ //#endregion
145
215
  //#region src/improvement/raw-trace-distiller.d.ts
146
216
  interface RawTraceDistillerOptions {
147
217
  /** Anchor the emitted paths at this run root instead of the generation `runDir`
@@ -353,5 +423,5 @@ declare function readinessServerSentEvent(report: KnowledgeReadinessReport$1, op
353
423
  /** Serialize a `RuntimeStreamEvent` as a Server-Sent Event string. @stable */
354
424
  declare function runtimeStreamServerSentEvent(event: RuntimeStreamEvent, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
355
425
  //#endregion
356
- export { AGENT_CANDIDATE_EXECUTION_SUPPORT, type AgentAdapter, type AgentBackendContext, type AgentBackendInput, type AgentCandidateArtifactPort, type AgentCandidateBenchmarkGraderIdentity, type AgentCandidateBenchmarkGraderPort, type AgentCandidateBundleInput, type AgentCandidateCodeSource, type AgentCandidateCodeSurfaceSource, type AgentCandidateContainerPort, type AgentCandidateExecutionAttemptRecord, type AgentCandidateExecutionAttemptRef, type AgentCandidateExecutionClaim, type AgentCandidateExecutionClaimResult, type AgentCandidateExecutionClaimStore, type AgentCandidateExecutionCleanupHandles, type AgentCandidateExecutionFailureClass, type AgentCandidateExecutionFinishResult, type AgentCandidateExecutionLease, type AgentCandidateExecutionPhase, type AgentCandidateExecutionPhaseResult, type AgentCandidateExecutionPorts, type AgentCandidateExecutionRecoveryEvidence, type AgentCandidateExecutionStageResult, type AgentCandidateExecutionTerminalRecord, type AgentCandidateExecutionTerminalResult, type AgentCandidateExecutorFinalCapture, type AgentCandidateExecutorMemoryCapture, type AgentCandidateExecutorPort, type AgentCandidateExecutorProfileFile, type AgentCandidateExecutorRequest, type AgentCandidateExecutorStopRequest, type AgentCandidateExecutorTaskOutcomeCapture, type AgentCandidateExecutorWorkspaceFile, type AgentCandidateExecutorWorkspaceInput, type AgentCandidateMemoryPort, type AgentCandidateMemoryResetResult, type AgentCandidateModelGrantActivateInput, type AgentCandidateModelGrantClient, type AgentCandidateModelGrantReservation, type AgentCandidateModelGrantReserveInput, type AgentCandidateModelGrantRunReservationInput, type AgentCandidateModelGrantSettleInput, type AgentCandidateModelLimits, type AgentCandidateModelPort, type AgentCandidateOutputArtifactPort, type AgentCandidateOutputPurpose, type AgentCandidatePreparationEvidence, type AgentCandidateProfileSource, type AgentCandidateProtectedModelActivation, type AgentCandidateProtectedModelReservation, type AgentCandidateProtectedModelSettlement, type AgentCandidateProtectedModelSettlementCall, type AgentCandidateProtectedRunCapture, type AgentCandidateRepositoryPort, type AgentCandidateRetryRejection, type AgentCandidateRunFinalization, type AgentCandidateTaskExecution, type AgentCandidateVerificationPorts, type AgentCandidateWorkspaceArchiveLimits, type AgentCandidateWorkspacePort, AgentEvalError, type AgentEvalErrorCode, type AgentExecutionBackend, type AgentKnowledgeProvider, type AgentKnowledgeReadinessCheckOptions, type AgentRuntimeEvent, type AgentRuntimeEventSink, type AgentSpec, type AgentTaskContext, type AgentTaskRunResult, type AgentTaskSpec, type AgentTaskStatus, type AgenticGeneratorExecutorForWorktree, type AgenticGeneratorOptions, type AgenticGeneratorShotDisposition, type AgenticGeneratorShotExecution, type AgenticGeneratorShotReceipt, type AnalystRegistry, type AuthSource, type BackendCallPolicy, type BackendErrorDetail, BackendTransportError, type Budget, type BuildAgentCandidateBundleInput, type BuildPromptFindingsInput, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, CANDIDATE_KNOWLEDGE_ROOT_ENV, CANDIDATE_TRACE_ENV, CANDIDATE_TRACE_TAGS, type CandidateGenerator, type CanonicalCandidateDocument, type CaptureAgentCandidateWorkspaceOptions, type CapturedAgentCandidateWorkspace, type ChatModelCandidate, type ChatModelValidation, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, ConfigError, type ControlBudget, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlStep, type Conversation, type ConversationDriveState, type ConversationJournal, type ConversationJournalEntry, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type CoordinationEvent, type CreateAgentCandidateWorkspacePortOptions, type CreateKnowledgeImprovementActivationExecutorOptions, type CreateProtectedAgentCandidateModelPortOptions, type D1DatabaseLike, type D1StmtLike, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DELEGATED_LOOP_MODES, type DataAcquisitionPlan, DeadlineExceededError, type DeepReadonly, type DelegatedLoopMode, type DelegatedLoopRegistry, type DelegatedLoopResult, type DelegatedLoopRunner, type DisposePreparedAgentCandidateOptions, type Driver, type EvalRunEvent, type EvalRunGeneration, type EvalRunsExportConfig, type EvalRunsExportResult, type ExactProcessCandidateExecutorOptions, type ExecutePreparedAgentCandidateOptions, type Executor, type ExecutorRegistry, FORWARD_HEADERS, FileAgentCandidateExecutionClaimStore, type FileAgentCandidateExecutionClaimStoreOptions, FileConversationJournal, type FinalizeContext, type ForwardHeaderName, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, INTELLIGENCE_WIRE_VERSION, type ImproveCandidateValidationInput, type ImproveCandidateValidator, type ImproveCodeBaseOptions, type ImproveCodeOptions, type ImproveCodeResult, type ImproveCodeRunOptions, type ImproveCost, type ImproveCustomCodeGeneratorOptions, type ImproveLineage, type ImproveMethodContext, type ImproveMethodFactory, type ImproveMethodLineage, type ImproveMethodOptions, type ImproveMethodResult, type ImproveMethodSource, type ImproveOptimizationRunOptions, type ImproveOptions, type ImproveProfileAgent, type ImproveProfileComponents, type ImproveProfileSurface, type ImproveResult, type ImproveRuntimeCodeGeneratorOptions, type ImproveScenarioPartitions, type ImproveSkillsOptions, type ImproveSurface, type ImprovementCandidate, type ImprovementCodeCandidate, type ImprovementMaterializedProfilePopulationCandidate, type ImprovementProfileCandidate, type ImprovementProfileCandidatePopulation, type ImprovementProfileCandidatePopulationAvailable, type ImprovementProfileCandidatePopulationUnavailable, type ImprovementProfilePopulationArtifactSource, type ImprovementProfilePopulationCandidate, type ImprovementProfilePopulationCandidateSource, type ImprovementProfilePopulationLineage, type ImprovementProfilePopulationLineageNode, type ImprovementProfilePopulationObservationSource, type ImprovementRefusedProfilePopulationCandidate, InMemoryAgentCandidateExecutionClaimStore, type InMemoryAgentCandidateExecutionClaimStoreOptions, InMemoryConversationJournal, InMemoryRuntimeSessionStore, JudgeError, type KnowledgeImprovementActivationExecutor, type KnowledgeImprovementCandidatePair, type KnowledgeImprovementExperimentBundles, type KnowledgeImprovementJobMeasurement, type KnowledgeImprovementJobResult, type KnowledgeReadinessCheck, type KnowledgeReadinessCheckInput, type KnowledgeReadinessCheckResult, type KnowledgeReadinessDecision, type KnowledgeReadinessReport, type KnowledgeRequirement, type LoopResult, type LoopRunnerCliArgs, type LoopRunnerCliResult, type LoopSpanNode, type McpServeSpec, type ModelInfo, NotFoundError, type OfficialGepaOptions, type OfficialOptimizerContextOptions, OfficialOptimizerUnavailableError, type OfficialSensitiveCandidateInput, type OfficialSkillOptOptions, type OpenAIChatResponseFormat, type OpenAIChatTool, type OpenAIChatToolChoice, type OtelAttribute, type OtelExportConfig, type OtelExporter, type OtelSpan, type PersistedTaskOutcomeEvidence, type PersonaConversationResult, type PersonaDriver, PlannerError, type PrepareAgentCandidateExecutionOptions, type PreparedAgentCandidateExecution, type PreparedAgentCandidateInstruction, type PreparedAgentCandidateKnowledge, type PreparedAgentCandidateLaunch, type PreparedAgentCandidateTrace, type PropagatedHeaders, type ProtectedAgentCandidateModelGrantContext, type ProviderModelAttemptEvidence, type ProviderModelExecutionEvidence, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, ROLLOUT_POLICY_EXTENSION, type RawTraceDistillerOptions, type ReadonlyAgentProfile, type RecoverExpiredAgentCandidateOptions, type ReflectiveGeneratorOptions, type ResearchLoopResult, type ResearchLoopRunnerOptions, type ResolvedAgentCandidateContainer, type ResolvedChatModel, RetainedRunAdmissionError, RetainedRunDispatchBindingError, type RetryBackoff, type RetryableErrorPredicate, type RootProviderModelEvidence, type RouterEnv, type RunAgentTaskOptions, type RunAgentTaskStreamOptions, type RunConversationOptions, type RunDelegatedLoopOptions, type RunKnowledgeImprovementJobOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunProtectedAgentCandidateModelGrantOptions, type RunProtectedAgentCandidateModelGrantResult, type RunRecord, type RuntimeDecisionEvidenceRef, type RuntimeDecisionKind, type RuntimeDecisionPoint, type RuntimeEventCollector, type RuntimeEventOtelOptions, type RuntimeHookContext, type RuntimeHookErrorContext, type RuntimeHookEvent, type RuntimeHookPhase, type RuntimeHookTarget, type RuntimeHooks, type RuntimeRunCompleteInput, type RuntimeRunCost, type RuntimeRunHandle, type RuntimeRunOptions, type RuntimeRunPersistenceAdapter, type RuntimeRunRow, RuntimeRunStateError, type RuntimeRunStatus, type RuntimeSession, type RuntimeSessionStore, type RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeStreamEventSink, type RuntimeStreamEventSummary, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SanitizedKnowledgeRequirement, type Scope, type ServerSentEventOptions, type Settled, type Spend, type SpendChannel, type SpendGap, type SqlAdapter, SqlConversationJournal, type SupervisedKnowledgeUpdateInput, type SupervisedKnowledgeUpdateOptions, type SupervisedKnowledgeUpdateResult, type SupervisedKnowledgeUpdater, type SupervisedResult, type Supervisor, type SupervisorFinalizer, type TurnOrder, ValidationError, type VerifiedAgentCandidate, type VerifiedAgentCandidateTaskOutcome, type Verifier, type VerifyResult, type VetoedFact, type WorkerTraceEvidence, type WorkerTraceUnavailableReason, type WorktreeCheckRunner, type WorktreeLoopRunnerOptions, agentCandidateProfileAsAgentProfile, agenticGenerator, applyExactAgentProfileDiff, applyRolloutPolicyToProfile, applyRunRecordDefaults, assertCandidateProfileBinding, auditLoopRunner, buildAgentCandidateBundle, buildForwardHeaders, buildKnowledgeImprovementExperimentBundles, buildLoopOtelSpans, buildLoopSpanNodes, buildRuntimeEventOtelSpans, candidateExecutionClaim, candidateKnowledgeExecutionPaths, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, cleanModelId, commandVerifier, composeRuntimeHooks, computeBackoff, createAgentCandidateWorkspacePort, createAgentKnowledgeReadinessCheck, createConversationBackend, createIterableBackend, createKnowledgeImprovementActivationExecutor, createOpenInferenceFileExporter, createOtelExporter, createProfileExecutionBackend, createProtectedAgentCandidateModelPort, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, createSupervisedKnowledgeUpdater, d1ToSqlAdapter, decideKnowledgeReadiness, defaultBuildPrompt, defaultIsRetryable, defineConversation, defineRuntimeHooks, disposePreparedAgentCandidateExecution, exactProcessProviderAsCandidateExecutor, executePreparedAgentCandidate, exportEvalRuns, findingLines, formatSupervisedKnowledgeTask, freezeGenericAgentCandidateProfile, generateSpanId, getModels, improve, isDelegatedLoopMode, isDepthExceeded, knowledgeReadinessDeliverable, loopEventToOtelSpan, makePerAttemptSignal, mcpBuildPrompt, mcpServeVerifier, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, normalizeRolloutPolicy, notifyRuntimeDecisionPoint, notifyRuntimeHookEvent, officialGepa, officialSkillOpt, omitUndefinedObjectFields, optimizerMethod, padSpanId, padTraceId, parseExactAgentProfile, parseExactAgentProfileDiff, parseExactCandidateProfile, parseLoopRunnerArgv, parseRolloutPolicy, persistCandidateOutputArtifact, prepareAgentCandidateExecution, rawTraceDistiller, readDepth, readinessServerSentEvent, recoverExpiredAgentCandidateExecution, reflectiveGenerator, researchLoopRunner, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runDelegatedLoop, runKnowledgeImprovementJob, runLoopRunnerCli, runPersonaConversation, runPersonaDispatch, runProtectedAgentCandidateModelGrant, runSupervisedKnowledgeUpdate, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sealAgentCandidateBundle, serializeRolloutPolicy, sleep, slugifySpeaker, startRuntimeRun, strategyAuthorMethod, structuralRolloutPolicyFromProfile, toOtelAttributes, toolBuildPrompt, turnId, validateChatModelId, verifyAgentCandidateBundle, worktreeLoopRunner };
426
+ export { AGENT_CANDIDATE_EXECUTION_SUPPORT, type AgentAdapter, type AgentBackendContext, type AgentBackendInput, type AgentCandidateArtifactPort, type AgentCandidateBenchmarkGraderIdentity, type AgentCandidateBenchmarkGraderPort, type AgentCandidateBundleInput, type AgentCandidateCodeSource, type AgentCandidateCodeSurfaceSource, type AgentCandidateContainerPort, type AgentCandidateExecutionAttemptRecord, type AgentCandidateExecutionAttemptRef, type AgentCandidateExecutionClaim, type AgentCandidateExecutionClaimResult, type AgentCandidateExecutionClaimStore, type AgentCandidateExecutionCleanupHandles, type AgentCandidateExecutionFailureClass, type AgentCandidateExecutionFinishResult, type AgentCandidateExecutionLease, type AgentCandidateExecutionPhase, type AgentCandidateExecutionPhaseResult, type AgentCandidateExecutionPorts, type AgentCandidateExecutionRecoveryEvidence, type AgentCandidateExecutionStageResult, type AgentCandidateExecutionTerminalRecord, type AgentCandidateExecutionTerminalResult, type AgentCandidateExecutorFinalCapture, type AgentCandidateExecutorMemoryCapture, type AgentCandidateExecutorPort, type AgentCandidateExecutorProfileFile, type AgentCandidateExecutorRequest, type AgentCandidateExecutorStopRequest, type AgentCandidateExecutorTaskOutcomeCapture, type AgentCandidateExecutorWorkspaceFile, type AgentCandidateExecutorWorkspaceInput, type AgentCandidateMemoryPort, type AgentCandidateMemoryResetResult, type AgentCandidateModelGrantActivateInput, type AgentCandidateModelGrantClient, type AgentCandidateModelGrantReservation, type AgentCandidateModelGrantReserveInput, type AgentCandidateModelGrantRunReservationInput, type AgentCandidateModelGrantSettleInput, type AgentCandidateModelLimits, type AgentCandidateModelPort, type AgentCandidateOutputArtifactPort, type AgentCandidateOutputPurpose, type AgentCandidatePreparationEvidence, type AgentCandidateProfileSource, type AgentCandidateProtectedModelActivation, type AgentCandidateProtectedModelReservation, type AgentCandidateProtectedModelSettlement, type AgentCandidateProtectedModelSettlementCall, type AgentCandidateProtectedRunCapture, type AgentCandidateRepositoryPort, type AgentCandidateRetryRejection, type AgentCandidateRunFinalization, type AgentCandidateTaskExecution, type AgentCandidateVerificationPorts, type AgentCandidateWorkspaceArchiveLimits, type AgentCandidateWorkspacePort, AgentEvalError, type AgentEvalErrorCode, type AgentExecutionBackend, type AgentKnowledgeProvider, type AgentKnowledgeReadinessCheckOptions, type AgentRuntimeEvent, type AgentRuntimeEventSink, type AgentSpec, type AgentTaskContext, type AgentTaskRunResult, type AgentTaskSpec, type AgentTaskStatus, type AgenticGeneratorExecutorForWorktree, type AgenticGeneratorOptions, type AgenticGeneratorShotDisposition, type AgenticGeneratorShotExecution, type AgenticGeneratorShotReceipt, type AnalystRegistry, type AuthSource, type BackendCallPolicy, type BackendErrorDetail, BackendTransportError, type Budget, type BuildAgentCandidateBundleInput, type BuildPromptFindingsInput, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, CANDIDATE_KNOWLEDGE_ROOT_ENV, CANDIDATE_TRACE_ENV, CANDIDATE_TRACE_TAGS, type CandidateGenerator, type CanonicalCandidateDocument, type CaptureAgentCandidateWorkspaceOptions, type CapturedAgentCandidateWorkspace, type ChatModelCandidate, type ChatModelValidation, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, ConfigError, type ControlBudget, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlStep, type Conversation, type ConversationDriveState, type ConversationJournal, type ConversationJournalEntry, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type CoordinationEvent, type CreateAgentCandidateWorkspacePortOptions, type CreateKnowledgeImprovementActivationExecutorOptions, type CreateProfileImprovementHarnessOptions, type CreateProtectedAgentCandidateModelPortOptions, type D1DatabaseLike, type D1StmtLike, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DELEGATED_LOOP_MODES, type DataAcquisitionPlan, DeadlineExceededError, type DeepReadonly, type DelegatedLoopMode, type DelegatedLoopRegistry, type DelegatedLoopResult, type DelegatedLoopRunner, type DisposePreparedAgentCandidateOptions, type Driver, type EvalRunEvent, type EvalRunGeneration, type EvalRunsExportConfig, type EvalRunsExportResult, type ExactProcessCandidateExecutorOptions, type ExecutePreparedAgentCandidateOptions, type Executor, type ExecutorRegistry, FORWARD_HEADERS, FileAgentCandidateExecutionClaimStore, type FileAgentCandidateExecutionClaimStoreOptions, FileConversationJournal, type FinalizeContext, type ForwardHeaderName, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, INTELLIGENCE_WIRE_VERSION, type ImproveCandidateValidationInput, type ImproveCandidateValidator, type ImproveCodeBaseOptions, type ImproveCodeOptions, type ImproveCodeResult, type ImproveCodeRunOptions, type ImproveCost, type ImproveCustomCodeGeneratorOptions, type ImproveLineage, type ImproveMethodContext, type ImproveMethodFactory, type ImproveMethodLineage, type ImproveMethodOptions, type ImproveMethodResult, type ImproveMethodSource, type ImproveOptimizationRunOptions, type ImproveOptions, type ImproveProfileAgent, type ImproveProfileComponents, type ImproveProfileSurface, type ImproveResult, type ImproveRuntimeCodeGeneratorOptions, type ImproveScenarioPartitions, type ImproveSkillsOptions, type ImproveSurface, type ImprovementCandidate, type ImprovementCodeCandidate, type ImprovementMaterializedProfilePopulationCandidate, type ImprovementProfileCandidate, type ImprovementProfileCandidatePopulation, type ImprovementProfileCandidatePopulationAvailable, type ImprovementProfileCandidatePopulationUnavailable, type ImprovementProfilePopulationArtifactSource, type ImprovementProfilePopulationCandidate, type ImprovementProfilePopulationCandidateSource, type ImprovementProfilePopulationLineage, type ImprovementProfilePopulationLineageNode, type ImprovementProfilePopulationObservationSource, type ImprovementRefusedProfilePopulationCandidate, InMemoryAgentCandidateExecutionClaimStore, type InMemoryAgentCandidateExecutionClaimStoreOptions, InMemoryConversationJournal, InMemoryRuntimeSessionStore, JudgeError, type KnowledgeImprovementActivationExecutor, type KnowledgeImprovementCandidatePair, type KnowledgeImprovementExperimentBundles, type KnowledgeImprovementJobMeasurement, type KnowledgeImprovementJobResult, type KnowledgeReadinessCheck, type KnowledgeReadinessCheckInput, type KnowledgeReadinessCheckResult, type KnowledgeReadinessDecision, type KnowledgeReadinessReport, type KnowledgeRequirement, type LoopResult, type LoopRunnerCliArgs, type LoopRunnerCliResult, type LoopSpanNode, type McpServeSpec, type ModelInfo, NotFoundError, type OfficialGepaOptions, type OfficialOptimizerContextOptions, OfficialOptimizerUnavailableError, type OfficialSensitiveCandidateInput, type OfficialSkillOptOptions, type OpenAIChatResponseFormat, type OpenAIChatTool, type OpenAIChatToolChoice, type OtelAttribute, type OtelExportConfig, type OtelExporter, type OtelSpan, PROMPT_INSTRUCTION_COMPONENT_PREFIX, type PersistedTaskOutcomeEvidence, type PersonaConversationResult, type PersonaDriver, PlannerError, type PrepareAgentCandidateExecutionOptions, type PreparedAgentCandidateExecution, type PreparedAgentCandidateInstruction, type PreparedAgentCandidateKnowledge, type PreparedAgentCandidateLaunch, type PreparedAgentCandidateTrace, type ProfileImprovementHarness, type ProfileImprovementHarnessRunOptions, type PropagatedHeaders, type ProtectedAgentCandidateModelGrantContext, type ProviderModelAttemptEvidence, type ProviderModelExecutionEvidence, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, ROLLOUT_POLICY_EXTENSION, type RawTraceDistillerOptions, type ReadonlyAgentProfile, type RecoverExpiredAgentCandidateOptions, type ReflectiveGeneratorOptions, type ResearchLoopResult, type ResearchLoopRunnerOptions, type ResolvedAgentCandidateContainer, type ResolvedChatModel, RetainedRunAdmissionError, RetainedRunDispatchBindingError, type RetryBackoff, type RetryableErrorPredicate, type RootProviderModelEvidence, type RouterEnv, type RunAgentTaskOptions, type RunAgentTaskStreamOptions, type RunConversationOptions, type RunDelegatedLoopOptions, type RunKnowledgeImprovementJobOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunProtectedAgentCandidateModelGrantOptions, type RunProtectedAgentCandidateModelGrantResult, type RunRecord, type RuntimeDecisionEvidenceRef, type RuntimeDecisionKind, type RuntimeDecisionPoint, type RuntimeEventCollector, type RuntimeEventOtelOptions, type RuntimeHookContext, type RuntimeHookErrorContext, type RuntimeHookEvent, type RuntimeHookPhase, type RuntimeHookTarget, type RuntimeHooks, type RuntimeRunCompleteInput, type RuntimeRunCost, type RuntimeRunHandle, type RuntimeRunOptions, type RuntimeRunPersistenceAdapter, type RuntimeRunRow, RuntimeRunStateError, type RuntimeRunStatus, type RuntimeSession, type RuntimeSessionStore, type RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeStreamEventSink, type RuntimeStreamEventSummary, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SanitizedKnowledgeRequirement, type Scope, type ServerSentEventOptions, type Settled, type Spend, type SpendChannel, type SpendGap, type SqlAdapter, SqlConversationJournal, type SupervisedKnowledgeUpdateInput, type SupervisedKnowledgeUpdateOptions, type SupervisedKnowledgeUpdateResult, type SupervisedKnowledgeUpdater, type SupervisedResult, type Supervisor, type SupervisorFinalizer, type TurnOrder, ValidationError, type VerifiedAgentCandidate, type VerifiedAgentCandidateTaskOutcome, type Verifier, type VerifyResult, type VetoedFact, type WorkerTraceEvidence, type WorkerTraceUnavailableReason, type WorktreeCheckRunner, type WorktreeLoopRunnerOptions, agentCandidateProfileAsAgentProfile, agenticGenerator, applyExactAgentProfileDiff, applyRolloutPolicyToProfile, applyRunRecordDefaults, assertCandidateProfileBinding, auditLoopRunner, buildAgentCandidateBundle, buildForwardHeaders, buildKnowledgeImprovementExperimentBundles, buildLoopOtelSpans, buildLoopSpanNodes, buildRuntimeEventOtelSpans, candidateExecutionClaim, candidateKnowledgeExecutionPaths, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, cleanModelId, commandVerifier, composeRuntimeHooks, computeBackoff, createAgentCandidateWorkspacePort, createAgentKnowledgeReadinessCheck, createConversationBackend, createIterableBackend, createKnowledgeImprovementActivationExecutor, createOpenInferenceFileExporter, createOtelExporter, createProfileExecutionBackend, createProfileImprovementHarness, createProtectedAgentCandidateModelPort, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, createSupervisedKnowledgeUpdater, d1ToSqlAdapter, decideKnowledgeReadiness, defaultBuildPrompt, defaultIsRetryable, defineConversation, defineRuntimeHooks, disposePreparedAgentCandidateExecution, exactProcessProviderAsCandidateExecutor, executePreparedAgentCandidate, exportEvalRuns, findingLines, formatSupervisedKnowledgeTask, freezeGenericAgentCandidateProfile, generateSpanId, getModels, improve, isDelegatedLoopMode, isDepthExceeded, knowledgeReadinessDeliverable, loopEventToOtelSpan, makePerAttemptSignal, mcpBuildPrompt, mcpServeVerifier, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, normalizeRolloutPolicy, notifyRuntimeDecisionPoint, notifyRuntimeHookEvent, officialGepa, officialSkillOpt, omitUndefinedObjectFields, optimizerMethod, padSpanId, padTraceId, parseExactAgentProfile, parseExactAgentProfileDiff, parseExactCandidateProfile, parseLoopRunnerArgv, parseRolloutPolicy, persistCandidateOutputArtifact, prepareAgentCandidateExecution, promptInstructionsProfileComponents, rawTraceDistiller, readDepth, readinessServerSentEvent, recoverExpiredAgentCandidateExecution, reflectiveGenerator, researchLoopRunner, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runDelegatedLoop, runKnowledgeImprovementJob, runLoopRunnerCli, runPersonaConversation, runPersonaDispatch, runProtectedAgentCandidateModelGrant, runSupervisedKnowledgeUpdate, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sealAgentCandidateBundle, serializeRolloutPolicy, sleep, slugifySpeaker, startRuntimeRun, strategyAuthorMethod, structuralRolloutPolicyFromProfile, toOtelAttributes, toolBuildPrompt, turnId, validateChatModelId, verifyAgentCandidateBundle, worktreeLoopRunner };
357
427
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,21 +1,22 @@
1
1
  import { a as JudgeError, c as RetainedRunAdmissionError, f as ValidationError, i as ConfigError, l as RetainedRunDispatchBindingError, o as NotFoundError, r as BackendTransportError, s as PlannerError, t as AgentEvalError, u as RuntimeRunStateError } from "./errors-CVIDr7GQ.js";
2
2
  import { a as normalizeBackendStreamEvent, c as nowIso, i as createSandboxPromptBackend, l as startOrResumeRuntimeSession, o as InMemoryRuntimeSessionStore, r as createIterableBackend, u as touchSession } from "./stream-agent-turn-Q5ellSUu.js";
3
- import { $ as parseExactAgentProfile, G as agentCandidateProfileAsAgentProfile, K as applyExactAgentProfileDiff, S as CANDIDATE_TRACE_TAGS, Y as freezeGenericAgentCandidateProfile, Z as omitUndefinedObjectFields, _ as candidateExecutionClaim, a as persistCandidateOutputArtifact, c as CANDIDATE_KNOWLEDGE_ROOT_ENV, et as parseExactAgentProfileDiff, f as verifyAgentCandidateBundle, h as InMemoryAgentCandidateExecutionClaimStore, l as candidateKnowledgeExecutionPaths, n as executePreparedAgentCandidate, q as assertCandidateProfileBinding, rt as canonicalCandidateDigest, s as CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, t as prepareAgentCandidateExecution, tt as parseExactCandidateProfile, u as AGENT_CANDIDATE_EXECUTION_SUPPORT, x as CANDIDATE_TRACE_ENV } from "./prepare-Czki1LBy.js";
4
- import { i as sealAgentCandidateBundle, n as captureAgentCandidateWorkspaceFiles, r as createAgentCandidateWorkspacePort, t as captureAgentCandidateWorkspace } from "./workspace-archive-B_JDld25.js";
5
- import { a as buildAgentCandidateBundle, i as FileAgentCandidateExecutionClaimStore, n as runProtectedAgentCandidateModelGrant, r as disposePreparedAgentCandidateExecution, t as recoverExpiredAgentCandidateExecution } from "./candidate-execution-CyCLYLfK.js";
6
- import { n as exactProcessProviderAsCandidateExecutor, t as createProtectedAgentCandidateModelPort } from "./protected-model-port-OhS0l_6m.js";
3
+ import { $ as parseExactAgentProfile, G as agentCandidateProfileAsAgentProfile, K as applyExactAgentProfileDiff, S as CANDIDATE_TRACE_TAGS, Y as freezeGenericAgentCandidateProfile, Z as omitUndefinedObjectFields, _ as candidateExecutionClaim, a as persistCandidateOutputArtifact, c as CANDIDATE_KNOWLEDGE_ROOT_ENV, et as parseExactAgentProfileDiff, f as verifyAgentCandidateBundle, h as InMemoryAgentCandidateExecutionClaimStore, l as candidateKnowledgeExecutionPaths, n as executePreparedAgentCandidate, q as assertCandidateProfileBinding, rt as canonicalCandidateDigest$1, s as CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, st as immutableCandidateValue, t as prepareAgentCandidateExecution, tt as parseExactCandidateProfile, u as AGENT_CANDIDATE_EXECUTION_SUPPORT, x as CANDIDATE_TRACE_ENV } from "./prepare-CYqGSYza.js";
4
+ import { i as sealAgentCandidateBundle, n as captureAgentCandidateWorkspaceFiles, r as createAgentCandidateWorkspacePort, t as captureAgentCandidateWorkspace } from "./workspace-archive-C7AvjSVb.js";
5
+ import { a as buildAgentCandidateBundle, i as FileAgentCandidateExecutionClaimStore, n as runProtectedAgentCandidateModelGrant, r as disposePreparedAgentCandidateExecution, t as recoverExpiredAgentCandidateExecution } from "./candidate-execution-CN2hO-og.js";
6
+ import { n as exactProcessProviderAsCandidateExecutor, t as createProtectedAgentCandidateModelPort } from "./protected-model-port-B6DW_x2I.js";
7
7
  import { C as makePerAttemptSignal, S as defaultIsRetryable, T as createProfileExecutionBackend, _ as readDepth, a as FileConversationJournal, b as DeadlineExceededError, c as createConversationBackend, d as slugifySpeaker, f as turnId, g as isDepthExceeded, h as buildForwardHeaders, i as d1ToSqlAdapter, l as runConversation, m as FORWARD_HEADERS, n as runPersonaDispatch, o as InMemoryConversationJournal, p as DEFAULT_MAX_DEPTH, r as SqlConversationJournal, s as defineConversation, t as runPersonaConversation, u as runConversationStream, v as CircuitBreakerState, w as sleep, x as computeBackoff, y as CircuitOpenError } from "./conversation-DIUtiLkC.js";
8
- import { At as exportEvalRuns, Bt as sanitizeKnowledgeReadinessReport, Dt as buildRuntimeEventOtelSpans, Et as buildLoopSpanNodes, Ft as padTraceId, It as toOtelAttributes, Lt as createRuntimeEventCollector, Mt as generateSpanId, Nt as loopEventToOtelSpan, Ot as createOpenInferenceFileExporter, Pt as padSpanId, Rt as createRuntimeStreamEventCollector, Tt as buildLoopOtelSpans, Vt as sanitizeRuntimeStreamEvent, kt as createOtelExporter, wt as INTELLIGENCE_WIRE_VERSION, zt as sanitizeAgentRuntimeEvent } from "./supervisor-BfJNS2Z3.js";
8
+ import { At as exportEvalRuns, Bt as sanitizeKnowledgeReadinessReport, Dt as buildRuntimeEventOtelSpans, Et as buildLoopSpanNodes, Ft as padTraceId, It as toOtelAttributes, Lt as createRuntimeEventCollector, Mt as generateSpanId, Nt as loopEventToOtelSpan, Ot as createOpenInferenceFileExporter, Pt as padSpanId, Rt as createRuntimeStreamEventCollector, Tt as buildLoopOtelSpans, Vt as sanitizeRuntimeStreamEvent, kt as createOtelExporter, wt as INTELLIGENCE_WIRE_VERSION, zt as sanitizeAgentRuntimeEvent } from "./supervisor-BoC2tFgH.js";
9
9
  import { i as notifyRuntimeHookEvent, n as defineRuntimeHooks, r as notifyRuntimeDecisionPoint, t as composeRuntimeHooks } from "./runtime-hooks-C7iJOWm3.js";
10
- import { D as optimizerMethod, O as strategyAuthorMethod } from "./structural-rollout-2Z6J5ttt.js";
11
- import { A as improve, B as commandVerifier, F as normalizeRolloutPolicy, I as parseRolloutPolicy, L as serializeRolloutPolicy, M as rawTraceDistiller, N as ROLLOUT_POLICY_EXTENSION, P as applyRolloutPolicyToProfile, R as structuralRolloutPolicyFromProfile, V as defaultBuildPrompt, j as withMethodRuntimeControls, z as agenticGenerator } from "./improvement-cycle-BeVj-EGJ.js";
12
- import { Ft as McpSpawnFault, It as connectStdioMcp } from "./runtime-yCuqlhou.js";
10
+ import { D as optimizerMethod, O as strategyAuthorMethod } from "./structural-rollout-CwtVIJf-.js";
11
+ import { A as improve, B as commandVerifier, F as normalizeRolloutPolicy, I as parseRolloutPolicy, L as serializeRolloutPolicy, M as rawTraceDistiller, N as ROLLOUT_POLICY_EXTENSION, P as applyRolloutPolicyToProfile, R as structuralRolloutPolicyFromProfile, V as defaultBuildPrompt, j as withMethodRuntimeControls, z as agenticGenerator } from "./improvement-cycle-hIOGxDtV.js";
12
+ import { Ft as McpSpawnFault, It as connectStdioMcp } from "./runtime-CUpB4rEP.js";
13
13
  import { n as defaultRedactorIdentityMaterial, r as resolveRedactor, t as defaultRedactor } from "./redact-D-u-rrcn.js";
14
- import { a as createSupervisedKnowledgeUpdater, c as runSupervisedKnowledgeUpdate, i as RESEARCH_SUPERVISOR_SYSTEM_PROMPT, l as createKnowledgeImprovementActivationExecutor, n as createAgentKnowledgeReadinessCheck, o as formatSupervisedKnowledgeTask, r as runKnowledgeImprovementJob, s as knowledgeReadinessDeliverable, t as buildKnowledgeImprovementExperimentBundles } from "./knowledge-C1TcOBf6.js";
15
- import { a as isDelegatedLoopMode, c as worktreeLoopRunner, i as auditLoopRunner, n as runLoopRunnerCli, o as researchLoopRunner, r as DELEGATED_LOOP_MODES, s as runDelegatedLoop, t as parseLoopRunnerArgv } from "./loop-runner-bin-DhUWzpNp.js";
16
- import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "./openai-tools-K38wcStR.js";
14
+ import { a as createSupervisedKnowledgeUpdater, c as runSupervisedKnowledgeUpdate, i as RESEARCH_SUPERVISOR_SYSTEM_PROMPT, l as createKnowledgeImprovementActivationExecutor, n as createAgentKnowledgeReadinessCheck, o as formatSupervisedKnowledgeTask, r as runKnowledgeImprovementJob, s as knowledgeReadinessDeliverable, t as buildKnowledgeImprovementExperimentBundles } from "./knowledge-C-JiS5Xg.js";
15
+ import { a as isDelegatedLoopMode, c as worktreeLoopRunner, i as auditLoopRunner, n as runLoopRunnerCli, o as researchLoopRunner, r as DELEGATED_LOOP_MODES, s as runDelegatedLoop, t as parseLoopRunnerArgv } from "./loop-runner-bin-B_Ww2iqY.js";
16
+ import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "./openai-tools-BKJqaQ1b.js";
17
17
  import { FAILURE_CLASSES, acquisitionPlansForKnowledgeGaps, blockingKnowledgeEval, canonicalJson, runAgentControlLoop, scoreKnowledgeReadiness, userQuestionsForKnowledgeGaps } from "@tangle-network/agent-eval";
18
18
  import { gepaOptimizationMethod, skillOptOptimizationMethod } from "@tangle-network/agent-eval/campaign";
19
+ import { agentProfileSchema, canonicalAgentProfileDigest } from "@tangle-network/agent-interface";
19
20
  import { spawnSync } from "node:child_process";
20
21
  import { isDeepStrictEqual } from "node:util";
21
22
  //#region src/improvement/build-prompts.ts
@@ -329,7 +330,7 @@ function redactJudgeScore(score, redactor) {
329
330
  }
330
331
  function optimizerRedactionPolicyRef(redact, builtInIdentity = defaultRedactorIdentityMaterial()) {
331
332
  if (redact === false) return "caller-approved-raw";
332
- return canonicalCandidateDigest({
333
+ return canonicalCandidateDigest$1({
333
334
  kind: redact === void 0 ? "default-redactor" : "caller-redactor-with-default",
334
335
  builtIn: builtInIdentity,
335
336
  ...redact === void 0 ? {} : {
@@ -339,7 +340,7 @@ function optimizerRedactionPolicyRef(redact, builtInIdentity = defaultRedactorId
339
340
  });
340
341
  }
341
342
  function optimizerEvidencePolicyRef(input) {
342
- return canonicalCandidateDigest({
343
+ return canonicalCandidateDigest$1({
343
344
  runtimeEvaluationRef: input.runtimeEvaluationRef,
344
345
  redactionPolicyRef: input.redactionPolicyRef,
345
346
  describeScenario: callbackSource(input.describeScenario),
@@ -357,7 +358,7 @@ function withDependencyHelp(optimizer, evaluationRef, redactor, redactionPolicyR
357
358
  try {
358
359
  const judges = input.judges.map((judge) => Object.freeze({
359
360
  ...judge,
360
- judgeVersion: canonicalCandidateDigest({
361
+ judgeVersion: canonicalCandidateDigest$1({
361
362
  evaluationRef,
362
363
  name: judge.name,
363
364
  dimensions: judge.dimensions,
@@ -401,6 +402,96 @@ function isMissingDependency(optimizer, cause) {
401
402
  return [...common, ...specific].some((fragment) => message.includes(fragment));
402
403
  }
403
404
  //#endregion
405
+ //#region src/improvement/profile-improvement-harness.ts
406
+ /**
407
+ * Bind one exact profile and executor into a repeatable self-improvement
408
+ * harness. The returned `run` method remains generic over every existing
409
+ * profile surface, optimization method, split, gate, and budget option.
410
+ */
411
+ function createProfileImprovementHarness(options) {
412
+ const parsed = agentProfileSchema.safeParse(options.profile);
413
+ if (!parsed.success) throw new ConfigError(`createProfileImprovementHarness: invalid AgentProfile: ${parsed.error.message}`);
414
+ if (!/^sha256:[0-9a-f]{64}$/.test(options.executionRef)) throw new ConfigError("createProfileImprovementHarness: executionRef must be a lowercase sha256 digest");
415
+ if (typeof options.agent !== "function") throw new ConfigError("createProfileImprovementHarness: agent must be a function");
416
+ if (options.validateCandidate !== void 0 && typeof options.validateCandidate !== "function") throw new ConfigError("createProfileImprovementHarness: validateCandidate must be a function when present");
417
+ const profile = immutableCandidateValue(parsed.data);
418
+ const executionRef = options.executionRef;
419
+ const agent = options.agent;
420
+ const defaultValidator = options.validateCandidate;
421
+ return Object.freeze({
422
+ profile,
423
+ profileDigest: canonicalAgentProfileDigest(profile),
424
+ executionRef,
425
+ run(runOptions) {
426
+ if (runOptions.validateCandidate !== void 0 && typeof runOptions.validateCandidate !== "function") throw new ConfigError("ProfileImprovementHarness.run: validateCandidate must be a function when present");
427
+ const validateCandidate = runOptions.validateCandidate ?? defaultValidator;
428
+ return improve(profile, {
429
+ ...runOptions,
430
+ executionRef,
431
+ agent,
432
+ ...validateCandidate === void 0 ? {} : { validateCandidate }
433
+ });
434
+ }
435
+ });
436
+ }
437
+ //#endregion
438
+ //#region src/improvement/prompt-instructions-profile-components.ts
439
+ /** Stable component-name prefix used for `profile.prompt.instructions`. */
440
+ const PROMPT_INSTRUCTION_COMPONENT_PREFIX = "prompt.instruction:";
441
+ const COMPONENT_INDEX_WIDTH = 6;
442
+ function componentName(index) {
443
+ return `${PROMPT_INSTRUCTION_COMPONENT_PREFIX}${String(index).padStart(COMPONENT_INDEX_WIDTH, "0")}`;
444
+ }
445
+ function orderedInstructionValues(components) {
446
+ const entries = Object.entries(components).sort(([left], [right]) => left.localeCompare(right));
447
+ if (entries.length === 0) throw new ConfigError("promptInstructionsProfileComponents: at least one prompt instruction is required");
448
+ for (const [index, [name, value]] of entries.entries()) {
449
+ const expected = componentName(index);
450
+ if (name !== expected) throw new ConfigError(`promptInstructionsProfileComponents: expected component ${JSON.stringify(expected)}, got ${JSON.stringify(name)}`);
451
+ if (typeof value !== "string") throw new ConfigError(`promptInstructionsProfileComponents: component ${JSON.stringify(name)} must be a string`);
452
+ }
453
+ return entries.map(([, value]) => value);
454
+ }
455
+ /**
456
+ * Canonical `ImproveProfileComponents` mapping for the ordered
457
+ * `AgentProfile.prompt.instructions` list.
458
+ *
459
+ * Use it with `surface: 'agent-profile'` when an optimizer should rewrite the
460
+ * exact instruction texts without being allowed to change their count, order,
461
+ * labels, or any unrelated profile field:
462
+ *
463
+ * ```ts
464
+ * await improve(profile, {
465
+ * surface: 'agent-profile',
466
+ * profileComponents: promptInstructionsProfileComponents,
467
+ * // method, scenarios, judge, executionRef, agent, ...
468
+ * })
469
+ * ```
470
+ *
471
+ * Component names are zero-padded and stable. Runtime's existing component
472
+ * materializer requires every candidate to preserve the exact key set and
473
+ * verifies that `apply(read(profile))` reproduces the baseline profile. A
474
+ * profile with no prompt instructions is refused rather than inventing a
475
+ * sentinel instruction that could accidentally ship.
476
+ */
477
+ const promptInstructionsProfileComponents = Object.freeze({
478
+ read(profile) {
479
+ const instructions = profile.prompt?.instructions ?? [];
480
+ if (instructions.length === 0) throw new ConfigError("promptInstructionsProfileComponents: profile.prompt.instructions must contain at least one instruction");
481
+ return Object.fromEntries(instructions.map((instruction, index) => [componentName(index), instruction]));
482
+ },
483
+ apply(profile, components) {
484
+ const instructions = orderedInstructionValues(components);
485
+ return agentProfileSchema.parse({
486
+ ...profile,
487
+ prompt: {
488
+ ...profile.prompt,
489
+ instructions
490
+ }
491
+ });
492
+ }
493
+ });
494
+ //#endregion
404
495
  //#region src/improvement/reflective-generator.ts
405
496
  /**
406
497
  *
@@ -1235,6 +1326,6 @@ function stripNewlines(value) {
1235
1326
  return value.replace(/[\r\n]/g, " ");
1236
1327
  }
1237
1328
  //#endregion
1238
- export { AGENT_CANDIDATE_EXECUTION_SUPPORT, AgentEvalError, BackendTransportError, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, CANDIDATE_KNOWLEDGE_ROOT_ENV, CANDIDATE_TRACE_ENV, CANDIDATE_TRACE_TAGS, CircuitBreakerState, CircuitOpenError, ConfigError, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DELEGATED_LOOP_MODES, DeadlineExceededError, FORWARD_HEADERS, FileAgentCandidateExecutionClaimStore, FileConversationJournal, INTELLIGENCE_WIRE_VERSION, InMemoryAgentCandidateExecutionClaimStore, InMemoryConversationJournal, InMemoryRuntimeSessionStore, JudgeError, NotFoundError, OfficialOptimizerUnavailableError, PlannerError, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, ROLLOUT_POLICY_EXTENSION, RetainedRunAdmissionError, RetainedRunDispatchBindingError, RuntimeRunStateError, SqlConversationJournal, ValidationError, agentCandidateProfileAsAgentProfile, agenticGenerator, applyExactAgentProfileDiff, applyRolloutPolicyToProfile, applyRunRecordDefaults, assertCandidateProfileBinding, auditLoopRunner, buildAgentCandidateBundle, buildForwardHeaders, buildKnowledgeImprovementExperimentBundles, buildLoopOtelSpans, buildLoopSpanNodes, buildRuntimeEventOtelSpans, candidateExecutionClaim, candidateKnowledgeExecutionPaths, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, cleanModelId, commandVerifier, composeRuntimeHooks, computeBackoff, createAgentCandidateWorkspacePort, createAgentKnowledgeReadinessCheck, createConversationBackend, createIterableBackend, createKnowledgeImprovementActivationExecutor, createOpenInferenceFileExporter, createOtelExporter, createProfileExecutionBackend, createProtectedAgentCandidateModelPort, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, createSupervisedKnowledgeUpdater, d1ToSqlAdapter, decideKnowledgeReadiness, defaultBuildPrompt, defaultIsRetryable, defineConversation, defineRuntimeHooks, disposePreparedAgentCandidateExecution, exactProcessProviderAsCandidateExecutor, executePreparedAgentCandidate, exportEvalRuns, findingLines, formatSupervisedKnowledgeTask, freezeGenericAgentCandidateProfile, generateSpanId, getModels, improve, isDelegatedLoopMode, isDepthExceeded, knowledgeReadinessDeliverable, loopEventToOtelSpan, makePerAttemptSignal, mcpBuildPrompt, mcpServeVerifier, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, normalizeRolloutPolicy, notifyRuntimeDecisionPoint, notifyRuntimeHookEvent, officialGepa, officialSkillOpt, omitUndefinedObjectFields, optimizerMethod, padSpanId, padTraceId, parseExactAgentProfile, parseExactAgentProfileDiff, parseExactCandidateProfile, parseLoopRunnerArgv, parseRolloutPolicy, persistCandidateOutputArtifact, prepareAgentCandidateExecution, rawTraceDistiller, readDepth, readinessServerSentEvent, recoverExpiredAgentCandidateExecution, reflectiveGenerator, researchLoopRunner, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runDelegatedLoop, runKnowledgeImprovementJob, runLoopRunnerCli, runPersonaConversation, runPersonaDispatch, runProtectedAgentCandidateModelGrant, runSupervisedKnowledgeUpdate, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sealAgentCandidateBundle, serializeRolloutPolicy, sleep, slugifySpeaker, startRuntimeRun, strategyAuthorMethod, structuralRolloutPolicyFromProfile, toOtelAttributes, toolBuildPrompt, turnId, validateChatModelId, verifyAgentCandidateBundle, worktreeLoopRunner };
1329
+ export { AGENT_CANDIDATE_EXECUTION_SUPPORT, AgentEvalError, BackendTransportError, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, CANDIDATE_KNOWLEDGE_ROOT_ENV, CANDIDATE_TRACE_ENV, CANDIDATE_TRACE_TAGS, CircuitBreakerState, CircuitOpenError, ConfigError, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DELEGATED_LOOP_MODES, DeadlineExceededError, FORWARD_HEADERS, FileAgentCandidateExecutionClaimStore, FileConversationJournal, INTELLIGENCE_WIRE_VERSION, InMemoryAgentCandidateExecutionClaimStore, InMemoryConversationJournal, InMemoryRuntimeSessionStore, JudgeError, NotFoundError, OfficialOptimizerUnavailableError, PROMPT_INSTRUCTION_COMPONENT_PREFIX, PlannerError, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, ROLLOUT_POLICY_EXTENSION, RetainedRunAdmissionError, RetainedRunDispatchBindingError, RuntimeRunStateError, SqlConversationJournal, ValidationError, agentCandidateProfileAsAgentProfile, agenticGenerator, applyExactAgentProfileDiff, applyRolloutPolicyToProfile, applyRunRecordDefaults, assertCandidateProfileBinding, auditLoopRunner, buildAgentCandidateBundle, buildForwardHeaders, buildKnowledgeImprovementExperimentBundles, buildLoopOtelSpans, buildLoopSpanNodes, buildRuntimeEventOtelSpans, candidateExecutionClaim, candidateKnowledgeExecutionPaths, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, cleanModelId, commandVerifier, composeRuntimeHooks, computeBackoff, createAgentCandidateWorkspacePort, createAgentKnowledgeReadinessCheck, createConversationBackend, createIterableBackend, createKnowledgeImprovementActivationExecutor, createOpenInferenceFileExporter, createOtelExporter, createProfileExecutionBackend, createProfileImprovementHarness, createProtectedAgentCandidateModelPort, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, createSupervisedKnowledgeUpdater, d1ToSqlAdapter, decideKnowledgeReadiness, defaultBuildPrompt, defaultIsRetryable, defineConversation, defineRuntimeHooks, disposePreparedAgentCandidateExecution, exactProcessProviderAsCandidateExecutor, executePreparedAgentCandidate, exportEvalRuns, findingLines, formatSupervisedKnowledgeTask, freezeGenericAgentCandidateProfile, generateSpanId, getModels, improve, isDelegatedLoopMode, isDepthExceeded, knowledgeReadinessDeliverable, loopEventToOtelSpan, makePerAttemptSignal, mcpBuildPrompt, mcpServeVerifier, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, normalizeRolloutPolicy, notifyRuntimeDecisionPoint, notifyRuntimeHookEvent, officialGepa, officialSkillOpt, omitUndefinedObjectFields, optimizerMethod, padSpanId, padTraceId, parseExactAgentProfile, parseExactAgentProfileDiff, parseExactCandidateProfile, parseLoopRunnerArgv, parseRolloutPolicy, persistCandidateOutputArtifact, prepareAgentCandidateExecution, promptInstructionsProfileComponents, rawTraceDistiller, readDepth, readinessServerSentEvent, recoverExpiredAgentCandidateExecution, reflectiveGenerator, researchLoopRunner, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runDelegatedLoop, runKnowledgeImprovementJob, runLoopRunnerCli, runPersonaConversation, runPersonaDispatch, runProtectedAgentCandidateModelGrant, runSupervisedKnowledgeUpdate, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sealAgentCandidateBundle, serializeRolloutPolicy, sleep, slugifySpeaker, startRuntimeRun, strategyAuthorMethod, structuralRolloutPolicyFromProfile, toOtelAttributes, toolBuildPrompt, turnId, validateChatModelId, verifyAgentCandidateBundle, worktreeLoopRunner };
1239
1330
 
1240
1331
  //# sourceMappingURL=index.js.map