@tangle-network/agent-runtime 10.0.22 → 10.0.24

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 (82) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/{activation-D_J9qCzU.js → activation-DLbBM2S0.js} +2 -2
  3. package/dist/{activation-D_J9qCzU.js.map → activation-DLbBM2S0.js.map} +1 -1
  4. package/dist/{activation-BSRRW51N.d.ts → activation-DUYtmQH_.d.ts} +22 -4
  5. package/dist/agent.d.ts +1 -1
  6. package/dist/agent.js +3 -3
  7. package/dist/{delegate-DCZPcYy8.js → delegate-Cz2GF_z7.js} +2 -2
  8. package/dist/{delegate-DCZPcYy8.js.map → delegate-Cz2GF_z7.js.map} +1 -1
  9. package/dist/{driver-control-acknowledgers-CgGt3NcX.js → driver-control-acknowledgers-pDEPMuML.js} +7 -7
  10. package/dist/{driver-control-acknowledgers-CgGt3NcX.js.map → driver-control-acknowledgers-pDEPMuML.js.map} +1 -1
  11. package/dist/durable-writer-thread.js +2 -2
  12. package/dist/durable.d.ts +1 -1
  13. package/dist/durable.js +14 -13
  14. package/dist/durable.js.map +1 -1
  15. package/dist/{graph-B3pBmvnf.js → graph-D-LVPqrm.js} +7 -6
  16. package/dist/{graph-B3pBmvnf.js.map → graph-D-LVPqrm.js.map} +1 -1
  17. package/dist/{improve-BjKhfQ_b.js → improve-BJW9OcEn.js} +189 -63
  18. package/dist/improve-BJW9OcEn.js.map +1 -0
  19. package/dist/index.d.ts +41 -6
  20. package/dist/index.js +88 -41
  21. package/dist/index.js.map +1 -1
  22. package/dist/intelligence.d.ts +2 -2
  23. package/dist/intelligence.js +4 -4
  24. package/dist/kernel.d.ts +1 -1
  25. package/dist/kernel.js +15 -15
  26. package/dist/{loop-runner-L594gDYR.js → loop-runner-BZWObfqa.js} +2 -2
  27. package/dist/{loop-runner-L594gDYR.js.map → loop-runner-BZWObfqa.js.map} +1 -1
  28. package/dist/{loop-runner-Dk5NO0Sz.d.ts → loop-runner-ClANio8o.d.ts} +2 -2
  29. package/dist/loop-runner-bin.d.ts +1 -1
  30. package/dist/loop-runner-bin.js +1 -1
  31. package/dist/mcp/bin.js +3 -3
  32. package/dist/mcp/index.d.ts +1 -1
  33. package/dist/mcp/index.js +6 -6
  34. package/dist/mcp/memory-bin.js +1 -1
  35. package/dist/profiles.d.ts +1 -1
  36. package/dist/{provision-supervisor-Be-6HBsX.js → provision-supervisor-ChGKJz8s.js} +5 -5
  37. package/dist/{provision-supervisor-Be-6HBsX.js.map → provision-supervisor-ChGKJz8s.js.map} +1 -1
  38. package/dist/{result-blob-store-CJjp44Mz.js → result-blob-store-BZwRmrFF.js} +2 -2
  39. package/dist/{result-blob-store-CJjp44Mz.js.map → result-blob-store-BZwRmrFF.js.map} +1 -1
  40. package/dist/{run-cancellation-BNBmsY3a.js → run-cancellation-uCwV2Ra7.js} +2 -2
  41. package/dist/{run-cancellation-BNBmsY3a.js.map → run-cancellation-uCwV2Ra7.js.map} +1 -1
  42. package/dist/{run-reopen-Cr2SHmYa.js → run-reopen-YJwUAmv6.js} +6 -6
  43. package/dist/{run-reopen-Cr2SHmYa.js.map → run-reopen-YJwUAmv6.js.map} +1 -1
  44. package/dist/{run-state-Bko0BF0_.js → run-state-6jJzk6gB.js} +5 -5
  45. package/dist/{run-state-Bko0BF0_.js.map → run-state-6jJzk6gB.js.map} +1 -1
  46. package/dist/{runtime-Dfwc9cjt.js → runtime-Ddkn1wRr.js} +15 -15
  47. package/dist/{runtime-Dfwc9cjt.js.map → runtime-Ddkn1wRr.js.map} +1 -1
  48. package/dist/{search-executor-DnWnh4kj.js → search-executor-D9E9q-Pv.js} +4 -4
  49. package/dist/{search-executor-DnWnh4kj.js.map → search-executor-D9E9q-Pv.js.map} +1 -1
  50. package/dist/{server-RCsa_gyH.js → server-BhXz3JyW.js} +4 -4
  51. package/dist/{server-RCsa_gyH.js.map → server-BhXz3JyW.js.map} +1 -1
  52. package/dist/{settle-record-BlIw2MU1.js → settle-record-DWae7fwV.js} +2 -2
  53. package/dist/{settle-record-BlIw2MU1.js.map → settle-record-DWae7fwV.js.map} +1 -1
  54. package/dist/{structural-rollout-BLflx9cs.js → structural-rollout-BL8KLLw8.js} +4 -4
  55. package/dist/{structural-rollout-BLflx9cs.js.map → structural-rollout-BL8KLLw8.js.map} +1 -1
  56. package/dist/{supervise-037R-zl1.js → supervise-C7mDlK7S.js} +10 -7
  57. package/dist/supervise-C7mDlK7S.js.map +1 -0
  58. package/dist/{supervise-identity-CtxWEk1I.js → supervise-identity-DLPzZTp3.js} +2 -2
  59. package/dist/{supervise-identity-CtxWEk1I.js.map → supervise-identity-DLPzZTp3.js.map} +1 -1
  60. package/dist/{supervision-discovery-DKxqbnHf.js → supervision-discovery-8XnVtdOD.js} +3 -3
  61. package/dist/{supervision-discovery-DKxqbnHf.js.map → supervision-discovery-8XnVtdOD.js.map} +1 -1
  62. package/dist/{supervisor-DL4hO7UW.js → supervisor-BQwg_3T0.js} +494 -28
  63. package/dist/supervisor-BQwg_3T0.js.map +1 -0
  64. package/dist/{supervisor-accounting-DlDUl58C.js → supervisor-accounting-B0ofgTZX.js} +91 -14
  65. package/dist/supervisor-accounting-B0ofgTZX.js.map +1 -0
  66. package/dist/{supervisor-root-contract-BCbu1A4n.js → supervisor-root-contract-N7rW4Ynu.js} +3 -3
  67. package/dist/{supervisor-root-contract-BCbu1A4n.js.map → supervisor-root-contract-N7rW4Ynu.js.map} +1 -1
  68. package/dist/testing.d.ts +1 -1
  69. package/dist/testing.js +11 -11
  70. package/dist/{tool-server-n4XYpCok.js → tool-server-I63dnHZC.js} +39 -3
  71. package/dist/{tool-server-n4XYpCok.js.map → tool-server-I63dnHZC.js.map} +1 -1
  72. package/dist/{top-web-B-sHmI3g.js → top-web-BZM3es-m.js} +7 -7
  73. package/dist/{top-web-B-sHmI3g.js.map → top-web-BZM3es-m.js.map} +1 -1
  74. package/dist/tui/bin.js +3 -3
  75. package/dist/tui/index.d.ts +1 -1
  76. package/dist/tui/index.js +2 -2
  77. package/dist/{types-3p2eAICm.d.ts → types-CByvdC7k.d.ts} +23 -8
  78. package/package.json +1 -1
  79. package/dist/improve-BjKhfQ_b.js.map +0 -1
  80. package/dist/supervise-037R-zl1.js.map +0 -1
  81. package/dist/supervisor-DL4hO7UW.js.map +0 -1
  82. package/dist/supervisor-accounting-DlDUl58C.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { $y as SanitizedKnowledgeRequirement, AS as AgentEvalError, By as OtelExportConfig, C as RuntimeFailureCause, Cw as RuntimeRunRow, Da as ExecutorFactory, E as Budget, FS as NotFoundError, Gy as createOtelExporter, Hy as OtelExporter, IS as ValidationError, Jy as RuntimeStreamEventCollector, Ky as loopEventToOtelSpan, Lh as ExecutorConfig, MS as BackendTransportError, NS as ConfigError, OS as Redactor, PS as JudgeError, Qy as SanitizedKnowledgeReadinessReport, S as RuntimeStreamEvent, Sw as RuntimeRunPersistenceAdapter, T as RuntimeFailureOwner, Tm as SupervisorProfile, Tw as startRuntimeRun, Uy as OtelSpan, Vy as OtelExportStats, Wy as buildLoopOtelSpans, Xf as IsolatedCheckResult, Xy as RuntimeStreamEventSummary, Yy as RuntimeStreamEventSink, Zy as RuntimeTelemetryOptions, _ as RunAgentTaskOptions, _f as SuperviseOptions, a as AgentKnowledgeProvider, b as RuntimeSession, bw as RuntimeRunHandle, c as AgentTaskContext, d as AgentTaskStatus, eb as createRuntimeEventCollector, g as OpenAIChatToolChoice, h as OpenAIChatTool, i as AgentExecutionBackend, jS as AgentEvalErrorCode, l as AgentTaskRunResult, m as OpenAIChatResponseFormat, n as AgentBackendContext, nb as sanitizeKnowledgeReadinessReport, o as AgentRuntimeEvent, oi as DeepReadonly, p as KnowledgeReadinessDecision, qf as IsolatedCheckBoxEvidence, qy as RuntimeEventCollector, r as AgentBackendInput, s as AgentRuntimeEventSink, si as ReadonlyAgentProfile, t as AgentAdapter, tb as createRuntimeStreamEventCollector, u as AgentTaskSpec, v as RunAgentTaskStreamOptions, vw as RuntimeRunCompleteInput, w as RuntimeFailureCode, wa as SupervisedResult, ww as RuntimeRunStatus, x as RuntimeSessionStore, xw as RuntimeRunOptions, y as RuntimeCanonicalStreamEvent, yw as RuntimeRunCost, zy as OtelAttribute } from "./types-3p2eAICm.js";
2
- import { $ as ImproveCodeBaseOptions, At as SearchPromotion, B as DecideSearchImprovementOptions, Bt as sharedBoxLane, Ct as ImproveSearchOptions, Dt as ImprovementCodeCandidate, Et as ImproveSurface, Ft as SearchLaneOptions, G as ImproveTrainingOptions, Gt as AgenticGeneratorShotExecution, H as decideSearchImprovement, Ht as AgenticGeneratorExecutorForWorktree, It as SearchTraceOptions, J as ProfileTrainerRequest, Jt as VerifyResult, K as ImproveTrainingResult, Kt as AgenticGeneratorShotReceipt, L as improve, Lt as SharedBoxSearchLane, Mt as SearchEnvironmentFault, Nt as SearchLane, Ot as ImprovementProfileCandidate, Pt as SearchLaneKind, Q as ImproveCandidateValidator, R as SearchMethodOptions, Rt as dedicatedLane, St as ImproveSearchMethod, Tt as ImproveSkillsOptions, U as CheckpointServingPort, Ut as AgenticGeneratorOptions, V as SearchImprovementDecision, Vt as subscriptionLane, W as ControlledTrainingCommand, Wt as AgenticGeneratorShotDisposition, X as createCommandProfileTrainer, Xt as commandVerifier, Y as TrainingBoundaryResult, Yt as agenticGenerator, Z as ImproveCandidateValidationInput, Zt as CandidateGenerator, at as ImproveLineage, bt as ImproveSearchAgent, ct as ImproveMethodLineage, dt as ImproveMethodSource, et as ImproveCodeOptions, ft as ImproveOptimizationRunOptions, gt as ImproveProfileSurface, ht as ImproveProfileComponents, i as AgentImprovementActivationTransition, it as ImproveCustomCodeGeneratorOptions, jt as SearchCellContext, kt as SearchDispatchContext, lt as ImproveMethodOptions, mt as ImproveProfileAgent, n as AgentImprovementActivationResultStore, nt as ImproveCodeRunOptions, ot as ImproveMethodContext, q as ProfileTrainer, qt as Verifier, rt as ImproveCost, st as ImproveMethodFactory, t as AgentImprovementActivationReconciliation, tt as ImproveCodeResult, ut as ImproveMethodResult, vt as ImproveRuntimeCodeGeneratorOptions, wt as ImproveSearchResult, xt as ImproveSearchIdentity, yt as ImproveScenarioPartitions, z as searchMethod, zt as routerLane } from "./activation-BSRRW51N.js";
1
+ import { $y as SanitizedKnowledgeRequirement, AS as AgentEvalError, By as OtelExportConfig, C as RuntimeFailureCause, Cw as RuntimeRunRow, Da as ExecutorFactory, E as Budget, FS as NotFoundError, Gy as createOtelExporter, Hy as OtelExporter, IS as ValidationError, Jy as RuntimeStreamEventCollector, Ky as loopEventToOtelSpan, Lh as ExecutorConfig, MS as BackendTransportError, NS as ConfigError, OS as Redactor, PS as JudgeError, Qy as SanitizedKnowledgeReadinessReport, S as RuntimeStreamEvent, Sw as RuntimeRunPersistenceAdapter, T as RuntimeFailureOwner, Tm as SupervisorProfile, Tw as startRuntimeRun, Uy as OtelSpan, Vy as OtelExportStats, Wy as buildLoopOtelSpans, Xf as IsolatedCheckResult, Xy as RuntimeStreamEventSummary, Yy as RuntimeStreamEventSink, Zy as RuntimeTelemetryOptions, _ as RunAgentTaskOptions, _f as SuperviseOptions, a as AgentKnowledgeProvider, b as RuntimeSession, bw as RuntimeRunHandle, c as AgentTaskContext, d as AgentTaskStatus, eb as createRuntimeEventCollector, g as OpenAIChatToolChoice, h as OpenAIChatTool, i as AgentExecutionBackend, jS as AgentEvalErrorCode, l as AgentTaskRunResult, m as OpenAIChatResponseFormat, n as AgentBackendContext, nb as sanitizeKnowledgeReadinessReport, o as AgentRuntimeEvent, oi as DeepReadonly, p as KnowledgeReadinessDecision, qf as IsolatedCheckBoxEvidence, qy as RuntimeEventCollector, r as AgentBackendInput, s as AgentRuntimeEventSink, si as ReadonlyAgentProfile, t as AgentAdapter, tb as createRuntimeStreamEventCollector, u as AgentTaskSpec, v as RunAgentTaskStreamOptions, vw as RuntimeRunCompleteInput, w as RuntimeFailureCode, wa as SupervisedResult, ww as RuntimeRunStatus, x as RuntimeSessionStore, xw as RuntimeRunOptions, y as RuntimeCanonicalStreamEvent, yw as RuntimeRunCost, zy as OtelAttribute } from "./types-CByvdC7k.js";
2
+ import { $ as ImproveCodeBaseOptions, At as SearchPromotion, B as DecideSearchImprovementOptions, Bt as routerLane, Ct as ImproveSearchOptions, Dt as ImprovementCodeCandidate, Et as ImproveSurface, Ft as SearchLaneKind, G as ImproveTrainingOptions, Gt as AgenticGeneratorShotDisposition, H as decideSearchImprovement, Ht as subscriptionLane, It as SearchLaneOptions, J as ProfileTrainerRequest, Jt as Verifier, K as ImproveTrainingResult, Kt as AgenticGeneratorShotExecution, L as improve, Lt as SearchTraceOptions, Mt as SearchCellContext, Nt as SearchEnvironmentFault, Ot as ImprovementProfileCandidate, Pt as SearchLane, Q as ImproveCandidateValidator, Qt as CandidateGenerator, R as SearchMethodOptions, Rt as SharedBoxSearchLane, St as ImproveSearchMethod, Tt as ImproveSkillsOptions, U as CheckpointServingPort, Ut as AgenticGeneratorExecutorForWorktree, V as SearchImprovementDecision, Vt as sharedBoxLane, W as ControlledTrainingCommand, Wt as AgenticGeneratorOptions, X as createCommandProfileTrainer, Xt as agenticGenerator, Y as TrainingBoundaryResult, Yt as VerifyResult, Z as ImproveCandidateValidationInput, Zt as commandVerifier, at as ImproveLineage, bt as ImproveSearchAgent, ct as ImproveMethodLineage, dt as ImproveMethodSource, et as ImproveCodeOptions, ft as ImproveOptimizationRunOptions, gt as ImproveProfileSurface, ht as ImproveProfileComponents, i as AgentImprovementActivationTransition, it as ImproveCustomCodeGeneratorOptions, jt as SearchImprovementMemoryOptions, kt as SearchDispatchContext, lt as ImproveMethodOptions, mt as ImproveProfileAgent, n as AgentImprovementActivationResultStore, nt as ImproveCodeRunOptions, ot as ImproveMethodContext, q as ProfileTrainer, qt as AgenticGeneratorShotReceipt, rt as ImproveCost, st as ImproveMethodFactory, t as AgentImprovementActivationReconciliation, tt as ImproveCodeResult, ut as ImproveMethodResult, vt as ImproveRuntimeCodeGeneratorOptions, wt as ImproveSearchResult, xt as ImproveSearchIdentity, yt as ImproveScenarioPartitions, z as searchMethod, zt as dedicatedLane } from "./activation-DUYtmQH_.js";
3
3
  import { i as SurfaceImprovementEdit } from "./improvement-adapter-D5GRU1eY.js";
4
4
  import { a as ImprovementProposalSource } from "./types-qsqfyQoY.js";
5
5
  import { T as AgentCandidateOutputArtifactPort } from "./workspace-archive-DS9E9tUr.js";
6
- import { i as auditLoopRunner, r as DelegatedLoopRunner } from "./loop-runner-Dk5NO0Sz.js";
6
+ import { i as auditLoopRunner, r as DelegatedLoopRunner } from "./loop-runner-ClANio8o.js";
7
7
  import { a as RuntimeHookContext, c as RuntimeHookPhase, d as composeRuntimeHooks, f as defineRuntimeHooks, i as RuntimeExecutionAdmittedPayload, l as RuntimeHookTarget, o as RuntimeHookErrorContext, s as RuntimeHookEvent, u as RuntimeHooks } from "./runtime-hooks-DPghSHV7.js";
8
8
  import { toW3CSpanId as padSpanId, toW3CTraceId as padTraceId } from "@tangle-network/agent-trace-contract";
9
9
  import { AgentCandidateBundle, AgentCandidateCapturedArtifact, AgentCandidateKnowledge, AgentProfile, Sha256Digest } from "@tangle-network/agent-interface";
10
10
  import { AgentProfile as AgentProfile$1, ControlBudget, ControlDecision, ControlEvalResult, ControlEvalResult as ControlEvalResult$1, ControlRunResult, ControlStep, CustomTokenPricing, DataAcquisitionPlan, KnowledgeReadinessReport, KnowledgeReadinessReport as KnowledgeReadinessReport$1, KnowledgeRequirement, MaximumCharge, ProposalFinding, RunRecord, RunRecord as RunRecord$1 } from "@tangle-network/agent-eval";
11
11
  import { ZodType } from "zod";
12
- import { GepaOptimizationMethodConfig, MutableSurface, ProfileDispatchFn, Scenario, SearchScoredCell, SkillOptOptimizationMethodConfig, SurfaceProposer } from "@tangle-network/agent-eval/campaign";
12
+ import { GepaOptimizationMethodConfig, MutableSurface, OptimizationMethod, ProfileDispatchFn, Scenario, SearchScoredCell, SkillOptOptimizationMethodConfig, SurfaceProposer } from "@tangle-network/agent-eval/campaign";
13
13
  import { Scenario as Scenario$1 } from "@tangle-network/agent-eval/contract";
14
14
  import { KnowledgeImprovementCandidateRef, KnowledgeImprovementOptions, KnowledgeImprovementResult, PromoteKnowledgeCandidateOptions } from "@tangle-network/agent-knowledge";
15
15
  /** Wrap any custom async-iterable stream into a typed `AgentExecutionBackend`. @stable */
@@ -466,6 +466,40 @@ export declare function officialSkillOpt<TScenario extends {
466
466
  id: string;
467
467
  kind: string;
468
468
  }, TArtifact = unknown>(options: OfficialSkillOptOptions<TScenario, TArtifact>): ImproveMethodFactory<TScenario, TArtifact>;
469
+ type ExternalTextOptimizerContext<TScenario extends {
470
+ id: string;
471
+ kind: string;
472
+ }, TArtifact> = Pick<GepaOptimizationMethodConfig<TScenario, TArtifact>, 'objective' | 'evaluationId' | 'background' | 'describeScenario' | 'describeArtifact' | 'searchLedger'>;
473
+ type RuntimeOptimizerBindingOptions<TScenario extends {
474
+ id: string;
475
+ kind: string;
476
+ }, TArtifact> = OfficialOptimizerContextOptions & Pick<ExternalTextOptimizerContext<TScenario, TArtifact>, 'objective' | 'describeScenario' | 'describeArtifact'>;
477
+ interface ExternalTextOptimizerOptions<TScenario extends {
478
+ id: string;
479
+ kind: string;
480
+ }, TArtifact> extends RuntimeOptimizerBindingOptions<TScenario, TArtifact> {
481
+ /** Stable machine name of the external method, for example prism. */
482
+ name: string;
483
+ /** Exact model execution identity, excluding the transport or its credentials. */
484
+ optimizer: {
485
+ model: string;
486
+ callRef: string;
487
+ };
488
+ /** Finite JSON settings that affect the method's search identity. */
489
+ settings: Record<string, unknown>;
490
+ /** The caller binds its Eval adapter to the prepared redacted evidence and ledger. */
491
+ create: (context: ExternalTextOptimizerContext<TScenario, TArtifact>) => OptimizationMethod<TScenario, TArtifact>;
492
+ }
493
+ /**
494
+ * Bind an external text optimizer to Runtime's standard evidence and candidate controls.
495
+ * Use structured artifacts with `describeArtifact` for protected evidence. Some supported
496
+ * Eval versions use raw strings as optimizer evidence before consulting that hook, so this
497
+ * binding refuses string artifacts unless the caller explicitly uses `redact: false`.
498
+ */
499
+ export declare function externalTextOptimizer<TScenario extends {
500
+ id: string;
501
+ kind: string;
502
+ }, TArtifact = unknown>(options: ExternalTextOptimizerOptions<TScenario, TArtifact>): ImproveMethodFactory<TScenario, TArtifact>;
469
503
  /**
470
504
  * The senior scientific-method optimizer doctrine — the ONE substantial prompt
471
505
  * core shared by every builder/author surface (tool build, MCP build, codebase
@@ -795,7 +829,8 @@ export declare function validateChatModelId(modelId: unknown, options?: {
795
829
  export declare const ROUTER_PRICE_SOURCE: {
796
830
  readonly repository: "tangle-network/tangle-router";
797
831
  readonly path: "pricing/researched-provider-prices.json";
798
- readonly commit: "e3445f270eba5234a2f7e85dda1a88743c20f322";
832
+ readonly commit: "836217bcf57b860a83b43cf0921d8a23234885a0";
833
+ readonly committedAt: "2026-11-29T12:23:30-08:00";
799
834
  };
800
835
  interface TokenWork {
801
836
  readonly model: string;
@@ -857,5 +892,5 @@ interface ServerSentEventOptions {
857
892
  export declare function readinessServerSentEvent(report: KnowledgeReadinessReport$1, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
858
893
  /** Serialize a `RuntimeStreamEvent` as a Server-Sent Event string. @stable */
859
894
  export declare function runtimeStreamServerSentEvent(event: RuntimeStreamEvent, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
860
- export { type AgentAdapter, type AgentBackendContext, type AgentBackendInput, AgentEvalError, type AgentEvalErrorCode, type AgentExecutionBackend, type AgentImprovementActivationReconciliation, type AgentImprovementActivationResultStore, type AgentImprovementActivationTransition, type AgentKnowledgeProvider, type AgentRuntimeEvent, type AgentRuntimeEventSink, type AgentTaskContext, type AgentTaskRunResult, type AgentTaskSpec, type AgentTaskStatus, type AgenticGeneratorExecutorForWorktree, type AgenticGeneratorOptions, type AgenticGeneratorShotDisposition, type AgenticGeneratorShotExecution, type AgenticGeneratorShotReceipt, type AuthSource, type BackendCallPolicy, BackendTransportError, type CandidateGenerator, type ChatModelCandidate, type ChatModelValidation, type CheckpointServingPort, type CircuitBreakerConfig, ConfigError, type ControlBudget, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlStep, type ControlledTrainingCommand, type Conversation, type ConversationDriveState, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type CreateKnowledgeImprovementActivationExecutorOptions, type CreateProfileImprovementHarnessOptions, type DataAcquisitionPlan, type DecideSearchImprovementOptions, type DeepReadonly, type DelegatedLoopRunner, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, 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 ImproveProfileAgent, type ImproveProfileComponents, type ImproveProfileSurface, type ImproveRuntimeCodeGeneratorOptions, type ImproveScenarioPartitions, type ImproveSearchAgent, type ImproveSearchIdentity, type ImproveSearchMethod, type ImproveSearchOptions, type ImproveSearchResult, type ImproveSkillsOptions, type ImproveSurface, type ImproveTrainingOptions, type ImproveTrainingResult, type ImprovementCodeCandidate, type ImprovementProfileCandidate, JudgeError, type KnowledgeImprovementActivationExecutor, type KnowledgeImprovementCandidatePair, type KnowledgeImprovementExperimentBundles, type KnowledgeImprovementJobMeasurement, type KnowledgeImprovementJobResult, type KnowledgeReadinessCheck, type KnowledgeReadinessCheckInput, type KnowledgeReadinessCheckResult, type KnowledgeReadinessDecision, type KnowledgeReadinessReport, type KnowledgeRequirement, type ModelInfo, NotFoundError, type OfficialGepaOptions, type OfficialOptimizerContextOptions, type OfficialSensitiveCandidateInput, type OfficialSkillOptOptions, type OpenAIChatResponseFormat, type OpenAIChatTool, type OpenAIChatToolChoice, type OtelAttribute, type OtelExportConfig, type OtelExportStats, type OtelExporter, type OtelSpan, type PersonaConversationResult, type PersonaDriver, type ProfileImprovementHarness, type ProfileImprovementHarnessRunOptions, type ProfileImprovementHarnessTrainOptions, type ProfileTrainer, type ProfileTrainerRequest, type ReadonlyAgentProfile, type ReflectiveGeneratorOptions, type ReflectiveProfileProposerOptions, type ReflectiveProposerChat, type ReflectiveProposerParent, type ReflectiveProposerReply, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunAgentTaskOptions, type RunAgentTaskStreamOptions, type RunConversationOptions, type RunKnowledgeImprovementJobOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunRecord, type RuntimeCanonicalStreamEvent, type RuntimeEventCollector, type RuntimeExecutionAdmittedPayload, type RuntimeFailureCause, type RuntimeFailureCode, type RuntimeFailureOwner, type RuntimeHookContext, type RuntimeHookErrorContext, type RuntimeHookEvent, type RuntimeHookPhase, type RuntimeHookTarget, type RuntimeHooks, type RuntimeRunCompleteInput, type RuntimeRunCost, type RuntimeRunHandle, type RuntimeRunOptions, type RuntimeRunPersistenceAdapter, type RuntimeRunRow, type RuntimeRunStatus, type RuntimeSession, type RuntimeSessionStore, type RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeStreamEventSink, type RuntimeStreamEventSummary, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SanitizedKnowledgeRequirement, type SearchCellContext, type SearchDispatchContext, SearchEnvironmentFault, type SearchImprovementDecision, type SearchLane, type SearchLaneKind, type SearchLaneOptions, type SearchMethodOptions, type SearchPromotion, type SearchTraceOptions, type ServerSentEventOptions, type SharedBoxSearchLane, type SupervisedKnowledgeUpdateOptions, type TokenWork, type TrainingBoundaryResult, type TurnOrder, ValidationError, type Verifier, type VerifyResult, agenticGenerator, auditLoopRunner, buildLoopOtelSpans, commandVerifier, composeRuntimeHooks, createCommandProfileTrainer, createOtelExporter, createRuntimeEventCollector, createRuntimeStreamEventCollector, decideSearchImprovement, dedicatedLane, defineRuntimeHooks, improve, loopEventToOtelSpan, padSpanId, padTraceId, routerLane, sanitizeKnowledgeReadinessReport, searchMethod, sharedBoxLane, startRuntimeRun, subscriptionLane };
895
+ export { type AgentAdapter, type AgentBackendContext, type AgentBackendInput, AgentEvalError, type AgentEvalErrorCode, type AgentExecutionBackend, type AgentImprovementActivationReconciliation, type AgentImprovementActivationResultStore, type AgentImprovementActivationTransition, type AgentKnowledgeProvider, type AgentRuntimeEvent, type AgentRuntimeEventSink, type AgentTaskContext, type AgentTaskRunResult, type AgentTaskSpec, type AgentTaskStatus, type AgenticGeneratorExecutorForWorktree, type AgenticGeneratorOptions, type AgenticGeneratorShotDisposition, type AgenticGeneratorShotExecution, type AgenticGeneratorShotReceipt, type AuthSource, type BackendCallPolicy, BackendTransportError, type CandidateGenerator, type ChatModelCandidate, type ChatModelValidation, type CheckpointServingPort, type CircuitBreakerConfig, ConfigError, type ControlBudget, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlStep, type ControlledTrainingCommand, type Conversation, type ConversationDriveState, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type CreateKnowledgeImprovementActivationExecutorOptions, type CreateProfileImprovementHarnessOptions, type DataAcquisitionPlan, type DecideSearchImprovementOptions, type DeepReadonly, type DelegatedLoopRunner, type ExternalTextOptimizerContext, type ExternalTextOptimizerOptions, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, 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 ImproveProfileAgent, type ImproveProfileComponents, type ImproveProfileSurface, type ImproveRuntimeCodeGeneratorOptions, type ImproveScenarioPartitions, type ImproveSearchAgent, type ImproveSearchIdentity, type ImproveSearchMethod, type ImproveSearchOptions, type ImproveSearchResult, type ImproveSkillsOptions, type ImproveSurface, type ImproveTrainingOptions, type ImproveTrainingResult, type ImprovementCodeCandidate, type ImprovementProfileCandidate, JudgeError, type KnowledgeImprovementActivationExecutor, type KnowledgeImprovementCandidatePair, type KnowledgeImprovementExperimentBundles, type KnowledgeImprovementJobMeasurement, type KnowledgeImprovementJobResult, type KnowledgeReadinessCheck, type KnowledgeReadinessCheckInput, type KnowledgeReadinessCheckResult, type KnowledgeReadinessDecision, type KnowledgeReadinessReport, type KnowledgeRequirement, type ModelInfo, NotFoundError, type OfficialGepaOptions, type OfficialOptimizerContextOptions, type OfficialSensitiveCandidateInput, type OfficialSkillOptOptions, type OpenAIChatResponseFormat, type OpenAIChatTool, type OpenAIChatToolChoice, type OtelAttribute, type OtelExportConfig, type OtelExportStats, type OtelExporter, type OtelSpan, type PersonaConversationResult, type PersonaDriver, type ProfileImprovementHarness, type ProfileImprovementHarnessRunOptions, type ProfileImprovementHarnessTrainOptions, type ProfileTrainer, type ProfileTrainerRequest, type ReadonlyAgentProfile, type ReflectiveGeneratorOptions, type ReflectiveProfileProposerOptions, type ReflectiveProposerChat, type ReflectiveProposerParent, type ReflectiveProposerReply, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunAgentTaskOptions, type RunAgentTaskStreamOptions, type RunConversationOptions, type RunKnowledgeImprovementJobOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunRecord, type RuntimeCanonicalStreamEvent, type RuntimeEventCollector, type RuntimeExecutionAdmittedPayload, type RuntimeFailureCause, type RuntimeFailureCode, type RuntimeFailureOwner, type RuntimeHookContext, type RuntimeHookErrorContext, type RuntimeHookEvent, type RuntimeHookPhase, type RuntimeHookTarget, type RuntimeHooks, type RuntimeRunCompleteInput, type RuntimeRunCost, type RuntimeRunHandle, type RuntimeRunOptions, type RuntimeRunPersistenceAdapter, type RuntimeRunRow, type RuntimeRunStatus, type RuntimeSession, type RuntimeSessionStore, type RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeStreamEventSink, type RuntimeStreamEventSummary, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SanitizedKnowledgeRequirement, type SearchCellContext, type SearchDispatchContext, SearchEnvironmentFault, type SearchImprovementDecision, type SearchImprovementMemoryOptions, type SearchLane, type SearchLaneKind, type SearchLaneOptions, type SearchMethodOptions, type SearchPromotion, type SearchTraceOptions, type ServerSentEventOptions, type SharedBoxSearchLane, type SupervisedKnowledgeUpdateOptions, type TokenWork, type TrainingBoundaryResult, type TurnOrder, ValidationError, type Verifier, type VerifyResult, agenticGenerator, auditLoopRunner, buildLoopOtelSpans, commandVerifier, composeRuntimeHooks, createCommandProfileTrainer, createOtelExporter, createRuntimeEventCollector, createRuntimeStreamEventCollector, decideSearchImprovement, dedicatedLane, defineRuntimeHooks, improve, loopEventToOtelSpan, padSpanId, padTraceId, routerLane, sanitizeKnowledgeReadinessReport, searchMethod, sharedBoxLane, startRuntimeRun, subscriptionLane };
861
896
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import { B as InMemoryRuntimeSessionStore, C as optimizerMethod, H as nowIso, I as streamAgentTurn, L as createIterableBackend, R as createSandboxPromptBackend, U as startOrResumeRuntimeSession, V as newRuntimeSession, W as touchSession, z as normalizeBackendStreamEvent } from "./structural-rollout-BLflx9cs.js";
1
+ import { B as InMemoryRuntimeSessionStore, C as optimizerMethod, H as nowIso, I as streamAgentTurn, L as createIterableBackend, R as createSandboxPromptBackend, U as startOrResumeRuntimeSession, V as newRuntimeSession, W as touchSession, z as normalizeBackendStreamEvent } from "./structural-rollout-BL8KLLw8.js";
2
2
  import { a as JudgeError, f as RuntimeRunStateError, i as ConfigError, m as ValidationError, o as NotFoundError, r as BackendTransportError, t as AgentEvalError } from "./errors-DG8yufqX.js";
3
- import { Mi as providerMessageText, Zn as createOtelExporter, _i as executableAgentProfileSnapshot, er as loopEventToOtelSpan, ir as sanitizeRuntimeStreamEvent, nr as createRuntimeStreamEventCollector, qn as buildLoopOtelSpans, rr as sanitizeKnowledgeReadinessReport, tr as createRuntimeEventCollector } from "./supervisor-accounting-DlDUl58C.js";
3
+ import { Jn as buildLoopOtelSpans, Ni as providerMessageText, Qn as createOtelExporter, ar as sanitizeRuntimeStreamEvent, ir as sanitizeKnowledgeReadinessReport, nr as createRuntimeEventCollector, rr as createRuntimeStreamEventCollector, tr as loopEventToOtelSpan, vi as executableAgentProfileSnapshot } from "./supervisor-accounting-B0ofgTZX.js";
4
4
  import { v as sleep } from "./util-qsH5cC9S.js";
5
- import { c as assertNoCallerArtifactDescriptor, d as agenticGenerator, f as commandVerifier, h as isUsageAmount, i as assertCandidateValidator, l as withMethodRuntimeControls, m as createRuntimeUsageTotals, n as createCommandProfileTrainer, o as parseExecutionRef, p as addRuntimeUsage, r as searchMethod, s as privateValuePaths, t as improve } from "./improve-BjKhfQ_b.js";
5
+ import { c as assertNoCallerArtifactDescriptor, d as agenticGenerator, f as commandVerifier, h as isUsageAmount, i as assertCandidateValidator, l as withMethodRuntimeControls, m as createRuntimeUsageTotals, n as createCommandProfileTrainer, o as parseExecutionRef, p as addRuntimeUsage, r as searchMethod, s as privateValuePaths, t as improve } from "./improve-BJW9OcEn.js";
6
6
  import { _ as embeddedCandidateArtifact, a as captureMaterializedWorkspace, m as canonicalCandidateDigest$1, p as canonicalCandidateBytes$1, t as persistCandidateOutputArtifact, v as immutableCandidateValue, y as omitTopLevelDigest } from "./output-artifacts-AqkZ8lO2.js";
7
7
  import { m as resolveRedactor, p as defaultRedactorIdentityMaterial } from "./snapshot-BKLziJ5K.js";
8
- import { n as createAgentImprovementActivationResult } from "./activation-D_J9qCzU.js";
8
+ import { n as createAgentImprovementActivationResult } from "./activation-DLbBM2S0.js";
9
9
  import { t as sealAgentCandidateBundle } from "./bundle-9NLb1WO3.js";
10
10
  import { m as captureAgentCandidateWorkspaceFiles } from "./workspace-streams-C7PGLAUd.js";
11
11
  import { t as assertExecutableAgentProfile } from "./model-policy-DFuhCC0-.js";
12
- import { t as supervise } from "./supervise-037R-zl1.js";
13
- import { n as auditLoopRunner } from "./loop-runner-L594gDYR.js";
14
- import { l as sharedBoxLane, o as routerLane, r as dedicatedLane, t as SearchEnvironmentFault, u as subscriptionLane, y as decideSearchImprovement } from "./search-executor-DnWnh4kj.js";
15
- import { dt as priceTokens, ft as ROUTER_PRICE_SOURCE } from "./supervisor-DL4hO7UW.js";
16
- import { i as runtimeFailureCause } from "./tool-server-n4XYpCok.js";
17
- import { a as isolatedCheckBoxEvidenceSchema, o as isolatedCheckResultSchema } from "./graph-B3pBmvnf.js";
12
+ import { t as supervise } from "./supervise-C7mDlK7S.js";
13
+ import { n as auditLoopRunner } from "./loop-runner-BZWObfqa.js";
14
+ import { l as sharedBoxLane, o as routerLane, r as dedicatedLane, t as SearchEnvironmentFault, u as subscriptionLane, y as decideSearchImprovement } from "./search-executor-D9E9q-Pv.js";
15
+ import { dt as priceTokens, ft as ROUTER_PRICE_SOURCE } from "./supervisor-BQwg_3T0.js";
16
+ import { i as runtimeFailureCause } from "./tool-server-I63dnHZC.js";
17
+ import { a as isolatedCheckBoxEvidenceSchema, o as isolatedCheckResultSchema } from "./graph-D-LVPqrm.js";
18
18
  import { n as defineRuntimeHooks, t as composeRuntimeHooks } from "./runtime-hooks-CsW2pfFk.js";
19
19
  import { toW3CSpanId as padSpanId, toW3CTraceId as padTraceId } from "@tangle-network/agent-trace-contract";
20
20
  import { agentCandidateKnowledgeSchema, agentProfileSchema, canonicalAgentProfileDigest, sha256DigestSchema } from "@tangle-network/agent-interface";
@@ -1082,29 +1082,48 @@ var OfficialOptimizerUnavailableError = class extends ConfigError {
1082
1082
  * `adaptive-sequential`, `best-of`, `vote`, or `omni` explicitly.
1083
1083
  */
1084
1084
  function officialGepa(options) {
1085
- return officialOptimizer("gepa", options, (config) => gepaOptimizationMethod(config));
1085
+ return officialOptimizer("gepa", options, (config) => gepaOptimizationMethod(config), "gepa");
1086
1086
  }
1087
1087
  /** Build a complete method backed by Microsoft's official SkillOpt trainer. */
1088
1088
  function officialSkillOpt(options) {
1089
- return officialOptimizer("skillopt", options, (config) => skillOptOptimizationMethod(config));
1089
+ return officialOptimizer("skillopt", options, (config) => skillOptOptimizationMethod(config), "skillopt");
1090
1090
  }
1091
- /** Keep evidence redaction, identity, dependency errors, and candidate controls identical for both wrappers. */
1092
- function officialOptimizer(optimizer, options, create) {
1093
- const label = optimizer === "gepa" ? "officialGepa" : "officialSkillOpt";
1091
+ /**
1092
+ * Bind an external text optimizer to Runtime's standard evidence and candidate controls.
1093
+ * Use structured artifacts with `describeArtifact` for protected evidence. Some supported
1094
+ * Eval versions use raw strings as optimizer evidence before consulting that hook, so this
1095
+ * binding refuses string artifacts unless the caller explicitly uses `redact: false`.
1096
+ */
1097
+ function externalTextOptimizer(options) {
1098
+ const { name, create, ...binding } = options;
1099
+ if (!/^[a-z][a-z0-9-]*$/.test(name)) throw new ConfigError("External optimizer needs a stable lowercase name");
1100
+ const snapshot = {
1101
+ ...binding,
1102
+ optimizer: { ...binding.optimizer },
1103
+ settings: structuredClone(binding.settings)
1104
+ };
1105
+ canonicalCandidateDigest$1(snapshot.settings);
1106
+ return officialOptimizer(name, snapshot, create);
1107
+ }
1108
+ /** Share evidence redaction, identity, and candidate controls across external optimizers. */
1109
+ function officialOptimizer(optimizer, options, create, builtin) {
1110
+ const label = builtin === "gepa" ? "officialGepa" : builtin === "skillopt" ? "officialSkillOpt" : `externalTextOptimizer(${optimizer})`;
1094
1111
  const { background, includeFindings = true, maxFindingsChars, describeScenario, describeArtifact, redact, authorizeSensitiveCandidate, ...config } = options;
1095
1112
  const redactor = resolveRedactor(redact);
1096
1113
  const redactionPolicyRef = optimizerRedactionPolicyRef(redact);
1114
+ const guardStringArtifacts = builtin === void 0 && redact !== false;
1097
1115
  assertMaxFindingsChars(label, maxFindingsChars);
1098
1116
  const objective = redactOptimizerText(label, "objective", config.objective, redactor);
1099
1117
  return (context) => {
1100
1118
  const externalEvaluationRef = optimizerEvidencePolicyRef({
1101
1119
  runtimeEvaluationRef: context.evaluationRef,
1102
1120
  redactionPolicyRef,
1121
+ guardStringArtifacts,
1103
1122
  describeScenario,
1104
1123
  describeArtifact,
1105
1124
  authorizeSensitiveCandidate
1106
1125
  });
1107
- const method = withDependencyHelp(optimizer, externalEvaluationRef, redactor, redactionPolicyRef, create({
1126
+ const method = withOptimizerEvidence(label, builtin, externalEvaluationRef, redactor, redactionPolicyRef, guardStringArtifacts, create({
1108
1127
  ...config,
1109
1128
  objective,
1110
1129
  evaluationId: externalEvaluationRef,
@@ -1273,6 +1292,7 @@ function optimizerEvidencePolicyRef(input) {
1273
1292
  return canonicalCandidateDigest$1({
1274
1293
  runtimeEvaluationRef: input.runtimeEvaluationRef,
1275
1294
  redactionPolicyRef: input.redactionPolicyRef,
1295
+ ...input.guardStringArtifacts ? { stringArtifactPolicy: "refuse-before-eval" } : {},
1276
1296
  describeScenario: callbackSource(input.describeScenario),
1277
1297
  describeArtifact: callbackSource(input.describeArtifact),
1278
1298
  authorizeSensitiveCandidate: callbackSource(input.authorizeSensitiveCandidate)
@@ -1281,11 +1301,21 @@ function optimizerEvidencePolicyRef(input) {
1281
1301
  function callbackSource(callback) {
1282
1302
  return typeof callback === "function" ? Function.prototype.toString.call(callback) : null;
1283
1303
  }
1284
- function withDependencyHelp(optimizer, evaluationRef, redactor, redactionPolicyRef, method) {
1304
+ function withOptimizerEvidence(label, builtin, evaluationRef, redactor, redactionPolicyRef, guardStringArtifacts, method) {
1285
1305
  return {
1286
1306
  ...method,
1287
1307
  async optimize(input) {
1288
- assertNoCallerArtifactDescriptor(input, optimizer === "gepa" ? "officialGepa" : "officialSkillOpt");
1308
+ assertNoCallerArtifactDescriptor(input, label);
1309
+ let artifactRefusal;
1310
+ const guardedDispatch = async (surface, scenario, ctx) => {
1311
+ if (artifactRefusal) throw artifactRefusal;
1312
+ const artifact = await input.dispatchWithSurface(surface, scenario, ctx);
1313
+ if (typeof artifact === "string") {
1314
+ artifactRefusal ??= new ConfigError(`${label}: protected string artifacts are unsupported; return a structured artifact and describe it with describeArtifact`);
1315
+ throw artifactRefusal;
1316
+ }
1317
+ return artifact;
1318
+ };
1289
1319
  try {
1290
1320
  const judges = input.judges.map((judge) => Object.freeze({
1291
1321
  ...judge,
@@ -1300,12 +1330,16 @@ function withDependencyHelp(optimizer, evaluationRef, redactor, redactionPolicyR
1300
1330
  return redactJudgeScore(await judge.score(scoreInput), redactor);
1301
1331
  }
1302
1332
  }));
1303
- return await method.optimize({
1333
+ const result = await method.optimize({
1304
1334
  ...input,
1335
+ ...guardStringArtifacts ? { dispatchWithSurface: guardedDispatch } : {},
1305
1336
  judges: Object.freeze(judges)
1306
1337
  });
1338
+ if (artifactRefusal) throw artifactRefusal;
1339
+ return result;
1307
1340
  } catch (cause) {
1308
- if (isMissingDependency(optimizer, cause)) throw new OfficialOptimizerUnavailableError(optimizer, cause);
1341
+ if (artifactRefusal) throw artifactRefusal;
1342
+ if (builtin && isMissingDependency(builtin, cause)) throw new OfficialOptimizerUnavailableError(builtin, cause);
1309
1343
  throw cause;
1310
1344
  }
1311
1345
  }
@@ -1498,6 +1532,7 @@ function reflectiveProfileProposer(options) {
1498
1532
  trainCells: parent.nodeId && ctx.train ? [...ctx.train.scoredCells(parent.nodeId)] : []
1499
1533
  }));
1500
1534
  const shape = surfaceShape(ctx.currentSurface);
1535
+ const limit = ctx.populationSize ?? 1;
1501
1536
  const sections = [];
1502
1537
  for (const [index, parent] of parents.entries()) {
1503
1538
  const evidence = await evidenceOf(parent);
@@ -1513,7 +1548,7 @@ function reflectiveProfileProposer(options) {
1513
1548
  "",
1514
1549
  options.frame.trim(),
1515
1550
  "",
1516
- outputContract(shape, maxSurfaceChars)
1551
+ outputContract(shape, maxSurfaceChars, limit)
1517
1552
  ].join("\n");
1518
1553
  const user = [
1519
1554
  OPERATOR[ctx.operator ?? "improve"],
@@ -1564,8 +1599,7 @@ function reflectiveProfileProposer(options) {
1564
1599
  }
1565
1600
  });
1566
1601
  if (!paid.succeeded) throw paid.error;
1567
- const proposal = parseProposal(paid.value.content, shape, maxSurfaceChars);
1568
- return proposal === null ? [] : [proposal];
1602
+ return parseProposals(paid.value.content, shape, maxSurfaceChars, limit);
1569
1603
  }
1570
1604
  };
1571
1605
  }
@@ -1591,15 +1625,16 @@ function renderSurface(surface) {
1591
1625
  "\"\"\""
1592
1626
  ].join("\n")).join("\n");
1593
1627
  }
1594
- function outputContract(shape, maxChars) {
1595
- return [
1596
- "OUTPUT. Reply with one JSON object and nothing else:",
1597
- `{"label": "<at most 8 words naming the change>", "hypothesis": "<the dominant failure mode, the mechanism, and the predicted effect on the score>", ${shape.kind === "text" ? "\"surface\": \"<the complete new text>\"" : `"surface": { ${shape.names.map((name) => `"${name}": "<its complete new text>"`).join(", ")} }`}}`,
1598
- shape.kind === "text" ? `The surface must stand alone, at most ${maxChars} characters: the agent sees nothing else from you.` : `Return every component, each complete, at most ${maxChars} characters in all: the agent sees nothing else from you.`
1599
- ].join("\n");
1628
+ function outputContract(shape, maxChars, limit) {
1629
+ const candidate = `{"label": "<at most 8 words naming the change>", "hypothesis": "<the dominant failure mode, the mechanism, and the predicted effect on the score>", ${shape.kind === "text" ? "\"surface\": \"<the complete new text>\"" : `"surface": { ${shape.names.map((name) => `"${name}": "<its complete new text>"`).join(", ")} }`}}`;
1630
+ return [...limit === 1 ? ["OUTPUT. Reply with one JSON object and nothing else:", candidate] : [
1631
+ `OUTPUT. Reply with one JSON object containing up to ${limit} distinct candidates and nothing else:`,
1632
+ `{"candidates": [${candidate}]}`,
1633
+ "Try different mechanisms that can be evaluated independently. Each candidate replaces the parent on its own."
1634
+ ], shape.kind === "text" ? `The surface must stand alone, at most ${maxChars} characters: the agent sees nothing else from you.` : `Return every component, each complete, at most ${maxChars} characters in all: the agent sees nothing else from you.`].join("\n");
1600
1635
  }
1601
- /** The proposal in a reply: the whole reply as JSON, else its outermost {...} span. */
1602
- function parseProposal(content, shape, maxChars) {
1636
+ /** The whole JSON reply, else its outermost object (for example in a code fence). */
1637
+ function parseProposals(content, shape, maxChars, limit) {
1603
1638
  const start = content.indexOf("{");
1604
1639
  const end = content.lastIndexOf("}");
1605
1640
  for (const text of [content, start >= 0 && end > start ? content.slice(start, end + 1) : ""]) {
@@ -1610,16 +1645,28 @@ function parseProposal(content, shape, maxChars) {
1610
1645
  continue;
1611
1646
  }
1612
1647
  if (typeof value !== "object" || value === null) continue;
1613
- const { label, hypothesis, surface } = value;
1614
- const parsed = surfaceOf(surface, shape, maxChars);
1615
- if (parsed === null) continue;
1616
- return {
1617
- surface: parsed,
1618
- label: String(label ?? "").slice(0, 80),
1619
- rationale: String(hypothesis ?? "").slice(0, 4e3)
1620
- };
1648
+ const record = value;
1649
+ const candidates = limit > 1 && Array.isArray(record.candidates) ? record.candidates : [record];
1650
+ const proposals = [];
1651
+ const seen = /* @__PURE__ */ new Set();
1652
+ for (const candidate of candidates) {
1653
+ if (typeof candidate !== "object" || candidate === null) continue;
1654
+ const { label, hypothesis, surface } = candidate;
1655
+ const parsed = surfaceOf(surface, shape, maxChars);
1656
+ if (parsed === null) continue;
1657
+ const key = JSON.stringify(parsed);
1658
+ if (seen.has(key)) continue;
1659
+ seen.add(key);
1660
+ proposals.push({
1661
+ surface: parsed,
1662
+ label: String(label ?? "").slice(0, 80),
1663
+ rationale: String(hypothesis ?? "").slice(0, 4e3)
1664
+ });
1665
+ if (proposals.length >= limit) break;
1666
+ }
1667
+ return proposals;
1621
1668
  }
1622
- return null;
1669
+ return [];
1623
1670
  }
1624
1671
  function surfaceOf(value, shape, maxChars) {
1625
1672
  if (shape.kind === "text") return typeof value === "string" && value.trim() && value.length <= maxChars ? value : null;
@@ -2863,6 +2910,6 @@ function runtimeStreamServerSentEvent(event, options = {}) {
2863
2910
  function stripNewlines(value) {
2864
2911
  return value.replace(/[\r\n]/g, " ");
2865
2912
  }
2866
- export { AgentEvalError, BackendTransportError, ConfigError, DEFAULT_ROUTER_BASE_URL, InMemoryRuntimeSessionStore, JudgeError, NotFoundError, ROUTER_PRICE_SOURCE, SearchEnvironmentFault, ValidationError, agenticGenerator, auditLoopRunner, buildKnowledgeImprovementExperimentBundles, buildLoopOtelSpans, captureKnowledgeImprovementCandidatePair, cleanModelId, commandVerifier, composeRuntimeHooks, createCommandProfileTrainer, createConversationBackend, createIterableBackend, createKnowledgeImprovementActivationExecutor, createOtelExporter, createProfileExecutionBackend, createProfileImprovementHarness, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, decideKnowledgeReadiness, decideSearchImprovement, dedicatedLane, defineRuntimeHooks, getModels, improve, isolatedCheckBoxEvidenceSchema, isolatedCheckResultSchema, loopEventToOtelSpan, officialGepa, officialSkillOpt, optimizerMethod, padSpanId, padTraceId, priceTokens, readinessServerSentEvent, reflectiveGenerator, reflectiveProfileProposer, resolveChatModel, resolveRouterBaseUrl, routerLane, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runKnowledgeImprovementJob, runPersonaConversation, runPersonaDispatch, runtimeStreamServerSentEvent, sanitizeKnowledgeReadinessReport, searchMethod, sharedBoxLane, startRuntimeRun, subscriptionLane, validateChatModelId };
2913
+ export { AgentEvalError, BackendTransportError, ConfigError, DEFAULT_ROUTER_BASE_URL, InMemoryRuntimeSessionStore, JudgeError, NotFoundError, ROUTER_PRICE_SOURCE, SearchEnvironmentFault, ValidationError, agenticGenerator, auditLoopRunner, buildKnowledgeImprovementExperimentBundles, buildLoopOtelSpans, captureKnowledgeImprovementCandidatePair, cleanModelId, commandVerifier, composeRuntimeHooks, createCommandProfileTrainer, createConversationBackend, createIterableBackend, createKnowledgeImprovementActivationExecutor, createOtelExporter, createProfileExecutionBackend, createProfileImprovementHarness, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, decideKnowledgeReadiness, decideSearchImprovement, dedicatedLane, defineRuntimeHooks, externalTextOptimizer, getModels, improve, isolatedCheckBoxEvidenceSchema, isolatedCheckResultSchema, loopEventToOtelSpan, officialGepa, officialSkillOpt, optimizerMethod, padSpanId, padTraceId, priceTokens, readinessServerSentEvent, reflectiveGenerator, reflectiveProfileProposer, resolveChatModel, resolveRouterBaseUrl, routerLane, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runKnowledgeImprovementJob, runPersonaConversation, runPersonaDispatch, runtimeStreamServerSentEvent, sanitizeKnowledgeReadinessReport, searchMethod, sharedBoxLane, startRuntimeRun, subscriptionLane, validateChatModelId };
2867
2914
 
2868
2915
  //# sourceMappingURL=index.js.map