@tangle-network/agent-runtime 0.90.0 → 0.90.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.
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +4 -4
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/{chunk-4WXGK6GV.js → chunk-7ON74BQO.js} +2 -2
- package/dist/{chunk-7LO5GMAO.js → chunk-CMYMTRGA.js} +14 -5
- package/dist/chunk-CMYMTRGA.js.map +1 -0
- package/dist/{chunk-UD4BHQMI.js → chunk-IVGYLCFH.js} +2 -2
- package/dist/{chunk-UD4BHQMI.js.map → chunk-IVGYLCFH.js.map} +1 -1
- package/dist/{chunk-XMOU4WEY.js → chunk-OOL3675H.js} +12 -2
- package/dist/chunk-OOL3675H.js.map +1 -0
- package/dist/{chunk-XQEISTK2.js → chunk-QK4DV5PR.js} +2 -2
- package/dist/{chunk-74SBMDTO.js → chunk-R2VAJGR3.js} +2 -2
- package/dist/{chunk-QSNSMJSZ.js → chunk-RYBVU4M3.js} +963 -957
- package/dist/chunk-RYBVU4M3.js.map +1 -0
- package/dist/{chunk-MHK62APK.js → chunk-WRUSWK4F.js} +3 -3
- package/dist/{chunk-4IBAMGBE.js → chunk-ZV4LXYCJ.js} +420 -23
- package/dist/chunk-ZV4LXYCJ.js.map +1 -0
- package/dist/{completion-gate-BDaBP8dd.d.ts → completion-gate-DkAnUmpb.d.ts} +2 -2
- package/dist/{coordination-DxHduZg7.d.ts → coordination-rRj5hjJK.d.ts} +5 -5
- package/dist/environment-provider.d.ts +2 -2
- package/dist/index.d.ts +112 -16
- package/dist/index.js +155 -10
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +227 -83
- package/dist/intelligence.js +259 -166
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.d.ts +6 -6
- package/dist/knowledge.js +4 -4
- package/dist/lifecycle.d.ts +2 -2
- package/dist/lifecycle.js +2 -2
- package/dist/{local-harness-sI0S_XNA.d.ts → local-harness-dcD5WTTr.d.ts} +3 -0
- package/dist/{loop-runner-bin-D3GmB2Ru.d.ts → loop-runner-bin-DTbZVGfM.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +6 -6
- package/dist/loop-runner-bin.js +5 -5
- package/dist/loops.d.ts +16 -256
- package/dist/loops.js +30 -4
- package/dist/mcp/bin.js +4 -4
- package/dist/mcp/index.d.ts +9 -9
- package/dist/mcp/index.js +6 -6
- package/dist/{mcp-serve-verifier-FL7-ZEb_.d.ts → mcp-serve-verifier-XsX8rkB9.d.ts} +12 -1
- package/dist/{openai-tools-D0xmzo0y.d.ts → openai-tools-C4ZfUD4L.d.ts} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/structural-rollout-MwlpgQ-6.d.ts +446 -0
- package/dist/{supervise-BpCdssu0.d.ts → supervise-DPmYPk0j.d.ts} +3 -3
- package/dist/{types-Dnk189QA.d.ts → types-SyuwunY_.d.ts} +1 -1
- package/dist/{types-DAJQRIUD.d.ts → types-eMNgWgFi.d.ts} +2 -2
- package/dist/{worktree-fanout-CfRXYmgV.d.ts → worktree-fanout-BDFQIO-Y.d.ts} +234 -234
- package/package.json +1 -1
- package/skills/build-with-agent-runtime/SKILL.md +20 -17
- package/dist/chunk-4IBAMGBE.js.map +0 -1
- package/dist/chunk-7LO5GMAO.js.map +0 -1
- package/dist/chunk-QSNSMJSZ.js.map +0 -1
- package/dist/chunk-XMOU4WEY.js.map +0 -1
- /package/dist/{chunk-4WXGK6GV.js.map → chunk-7ON74BQO.js.map} +0 -0
- /package/dist/{chunk-XQEISTK2.js.map → chunk-QK4DV5PR.js.map} +0 -0
- /package/dist/{chunk-74SBMDTO.js.map → chunk-R2VAJGR3.js.map} +0 -0
- /package/dist/{chunk-MHK62APK.js.map → chunk-WRUSWK4F.js.map} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { E as ExecutorFactory,
|
|
1
|
+
import { E as ExecutorFactory, h as ExecutorRegistry, e as Spend, A as Agent, S as Scope, a as ResultBlobStore, B as Budget } from './types-eMNgWgFi.js';
|
|
2
2
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
3
3
|
import { U as UiLens, a as UiFinding, C as CoderTask } from './substrate-DO2GHNg2.js';
|
|
4
|
-
import { S as SandboxClient, E as ExecCtx,
|
|
4
|
+
import { S as SandboxClient, E as ExecCtx, f as LoopTraceEmitter, d as LoopTraceEvent, A as AgentRunSpec } from './types-SyuwunY_.js';
|
|
5
5
|
import { BackendType, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
|
|
6
6
|
import { AgentEvalError } from '@tangle-network/agent-eval';
|
|
7
7
|
import { b as ToolSpec, R as RouterConfig } from './router-client-DJImUDlm.js';
|
|
8
|
-
import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-
|
|
9
|
-
import { L as LocalHarness } from './local-harness-
|
|
8
|
+
import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-DkAnUmpb.js';
|
|
9
|
+
import { L as LocalHarness } from './local-harness-dcD5WTTr.js';
|
|
10
10
|
import { ProviderExecutorOptions, AgentEnvironmentProviderRegistry } from './environment-provider.js';
|
|
11
11
|
import { AgentEnvironmentProvider } from '@tangle-network/agent-interface/environment-provider';
|
|
12
12
|
|
|
@@ -717,7 +717,7 @@ interface EvalRunEvent {
|
|
|
717
717
|
interface EvalRunsExportConfig {
|
|
718
718
|
/** Bearer key — tenant is resolved server-side from it. Reads TANGLE_API_KEY. */
|
|
719
719
|
apiKey?: string;
|
|
720
|
-
/** Intelligence base. Reads
|
|
720
|
+
/** Intelligence base. Reads TANGLE_INTELLIGENCE_URL env, else prod. */
|
|
721
721
|
base?: string;
|
|
722
722
|
/** Idempotency-Key header (e.g. the runId) — safe retries + upsert. */
|
|
723
723
|
idempotencyKey?: string;
|
|
@@ -2,8 +2,8 @@ import { AgentProfile, AgentProfileValidationResult } from '@tangle-network/agen
|
|
|
2
2
|
import { CreateAgentEnvironmentInput, AgentTurnInput, AgentEnvironmentProvider, AgentEnvironmentCapabilities, AgentProfileRef } from '@tangle-network/agent-interface/environment-provider';
|
|
3
3
|
export { AgentEnvironment, AgentEnvironmentCapabilities, AgentEnvironmentEvent, AgentEnvironmentProvider, AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSession, AgentSessionRef, AgentSessionStatus, AgentTurnInput, AgentTurnResult, CheckpointRef, CheckpointRequest, CreateAgentEnvironmentInput, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from '@tangle-network/agent-interface/environment-provider';
|
|
4
4
|
import { CreateSandboxOptions, BackendType } from '@tangle-network/sandbox';
|
|
5
|
-
import { R as Runtime, E as ExecutorFactory } from './types-
|
|
6
|
-
import { S as SandboxClient } from './types-
|
|
5
|
+
import { R as Runtime, E as ExecutorFactory } from './types-eMNgWgFi.js';
|
|
6
|
+
import { S as SandboxClient } from './types-SyuwunY_.js';
|
|
7
7
|
import '@tangle-network/agent-eval';
|
|
8
8
|
|
|
9
9
|
/** Provider object or registry name accepted by runtime provider adapters.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { AgentProfile, AgentEvalError, AnalystFinding, KnowledgeReadinessReport, RunRecord, ControlEvalResult, KnowledgeRequirement } from '@tangle-network/agent-eval';
|
|
2
2
|
export { AgentEvalError, AgentEvalErrorCode, ConfigError, ControlBudget, ControlDecision, ControlEvalResult, ControlRunResult, ControlStep, DataAcquisitionPlan, JudgeError, KnowledgeReadinessReport, KnowledgeRequirement, NotFoundError, RunRecord, ValidationError } from '@tangle-network/agent-eval';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import { Scenario, ProfileDispatchFn } from '@tangle-network/agent-eval/campaign';
|
|
6
|
-
import { V as Verifier, C as CandidateGenerator } from './mcp-serve-verifier-
|
|
7
|
-
export { A as AgenticGeneratorOptions, I as ImprovementDriverOptions, M as McpServeSpec, a as VerifyResult, b as agenticGenerator, c as commandVerifier, i as improvementDriver, m as mcpServeVerifier } from './mcp-serve-verifier-
|
|
3
|
+
import { g as AgentBackendInput, O as OpenAIChatTool, h as OpenAIChatToolChoice, i as OpenAIChatResponseFormat, j as AgentExecutionBackend, k as AgentBackendContext, b as RuntimeStreamEvent, K as KnowledgeReadinessDecision, l as RunAgentTaskOptions, m as AgentTaskRunResult, n as RunAgentTaskStreamOptions, o as AgentRuntimeEvent, p as AgentTaskStatus, q as RuntimeSessionStore, r as RuntimeSession, R as RuntimeHooks } from './types-SyuwunY_.js';
|
|
4
|
+
export { s as AgentAdapter, t as AgentKnowledgeProvider, u as AgentRuntimeEventSink, v as AgentTaskContext, w as AgentTaskSpec, B as BackendErrorDetail, x as RuntimeDecisionEvidenceRef, y as RuntimeDecisionKind, z as RuntimeDecisionPoint, C as RuntimeHookContext, F as RuntimeHookErrorContext, G as RuntimeHookEvent, H as RuntimeHookPhase, J as RuntimeHookTarget, M as RuntimeRunHandle, N as RuntimeRunPersistenceAdapter, P as RuntimeRunRow, Q as composeRuntimeHooks, T as defineRuntimeHooks, U as notifyRuntimeDecisionPoint, W as notifyRuntimeHookEvent, X as startRuntimeRun } from './types-SyuwunY_.js';
|
|
5
|
+
import { Scenario, ProfileDispatchFn, MutableSurface as MutableSurface$1, SurfaceProposer as SurfaceProposer$1 } from '@tangle-network/agent-eval/campaign';
|
|
6
|
+
import { V as Verifier, C as CandidateGenerator } from './mcp-serve-verifier-XsX8rkB9.js';
|
|
7
|
+
export { A as AgenticGeneratorOptions, I as ImprovementDriverOptions, M as McpServeSpec, a as VerifyResult, b as agenticGenerator, c as commandVerifier, i as improvementDriver, m as mcpServeVerifier } from './mcp-serve-verifier-XsX8rkB9.js';
|
|
8
8
|
import { Scenario as Scenario$1, SurfaceProposer, JudgeConfig, MutableSurface, DispatchContext, SelfImproveBudget, SelfImproveLlm, SelfImproveOptions, SelfImproveResult } from '@tangle-network/agent-eval/contract';
|
|
9
9
|
import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
10
|
-
import { L as LocalHarness } from './local-harness-
|
|
10
|
+
import { L as LocalHarness } from './local-harness-dcD5WTTr.js';
|
|
11
11
|
import { S as SurfaceImprovementEdit } from './improvement-adapter-CDR8QNVM.js';
|
|
12
12
|
import { I as ImprovementAdapter } from './types-BC3bZpH0.js';
|
|
13
|
+
import { S as StructuralRolloutPolicy } from './structural-rollout-MwlpgQ-6.js';
|
|
13
14
|
export { AgentKnowledgeReadinessCheckOptions, KnowledgeImprovementJobMeasurement, KnowledgeImprovementJobResult, KnowledgeReadinessCheck, KnowledgeReadinessCheckInput, KnowledgeReadinessCheckResult, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, RunKnowledgeImprovementJobOptions, SupervisedKnowledgeUpdateInput, SupervisedKnowledgeUpdateOptions, SupervisedKnowledgeUpdateResult, SupervisedKnowledgeUpdater, createAgentKnowledgeReadinessCheck, createSupervisedKnowledgeUpdater, formatSupervisedKnowledgeTask, knowledgeReadinessDeliverable, runKnowledgeImprovementJob, runSupervisedKnowledgeUpdate } from './knowledge.js';
|
|
14
|
-
export { D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, j as runDelegatedLoop, k as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-
|
|
15
|
-
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-
|
|
16
|
-
export { b0 as EvalRunEvent, b1 as EvalRunGeneration, b2 as EvalRunsExportConfig, b3 as EvalRunsExportResult, b4 as INTELLIGENCE_WIRE_VERSION, b5 as LoopSpanNode, b6 as OtelAttribute, b7 as OtelExportConfig, b8 as OtelExporter, b9 as OtelSpan, ba as buildLoopOtelSpans, bb as buildLoopSpanNodes, bc as createOtelExporter, bd as exportEvalRuns, be as loopEventToOtelSpan } from './coordination-
|
|
15
|
+
export { D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, j as runDelegatedLoop, k as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-DTbZVGfM.js';
|
|
16
|
+
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-C4ZfUD4L.js';
|
|
17
|
+
export { b0 as EvalRunEvent, b1 as EvalRunGeneration, b2 as EvalRunsExportConfig, b3 as EvalRunsExportResult, b4 as INTELLIGENCE_WIRE_VERSION, b5 as LoopSpanNode, b6 as OtelAttribute, b7 as OtelExportConfig, b8 as OtelExporter, b9 as OtelSpan, ba as buildLoopOtelSpans, bb as buildLoopSpanNodes, bc as createOtelExporter, bd as exportEvalRuns, be as loopEventToOtelSpan } from './coordination-rRj5hjJK.js';
|
|
17
18
|
import '@tangle-network/sandbox';
|
|
18
19
|
import 'node:child_process';
|
|
20
|
+
import './worktree-fanout-BDFQIO-Y.js';
|
|
21
|
+
import './types-eMNgWgFi.js';
|
|
22
|
+
import './completion-gate-DkAnUmpb.js';
|
|
19
23
|
import '@tangle-network/agent-knowledge';
|
|
20
|
-
import './supervise-
|
|
21
|
-
import './types-DAJQRIUD.js';
|
|
24
|
+
import './supervise-DPmYPk0j.js';
|
|
22
25
|
import './router-client-DJImUDlm.js';
|
|
23
|
-
import './completion-gate-BDaBP8dd.js';
|
|
24
26
|
import './kb-gate-CwHO0vz6.js';
|
|
25
|
-
import './worktree-fanout-CfRXYmgV.js';
|
|
26
27
|
import './substrate-DO2GHNg2.js';
|
|
27
28
|
import './environment-provider.js';
|
|
28
29
|
import '@tangle-network/agent-interface/environment-provider';
|
|
@@ -1182,6 +1183,11 @@ declare function mcpBuildPrompt(args: FindingsArg): string;
|
|
|
1182
1183
|
*
|
|
1183
1184
|
* - `surface: 'prompt'` → `gepaProposer` mutates `profile.prompt.systemPrompt`.
|
|
1184
1185
|
* - `surface: 'skills'` → `skillOptProposer` mutates a skills document string.
|
|
1186
|
+
* - `surface: 'rollout-policy'` → `rolloutPolicyProposer` mutates the
|
|
1187
|
+
* inference-time `StructuralRolloutPolicy` dials ({ k, repairRounds, testgen })
|
|
1188
|
+
* persisted in `profile.extensions['structural-rollout']` — deterministic
|
|
1189
|
+
* bounded neighbor enumeration; the held-out gate does the deciding. No-op
|
|
1190
|
+
* (nothing proposed, nothing shipped) when the profile has no such extension.
|
|
1185
1191
|
* - `surface` ∈ {`tools`, `mcp`, `hooks`, `code`} → no zero-config default
|
|
1186
1192
|
* proposer exists (a code/config proposer needs caller-supplied wiring — a
|
|
1187
1193
|
* worktree repo root, a candidate generator, a serializer). The facade
|
|
@@ -1196,8 +1202,10 @@ declare function mcpBuildPrompt(args: FindingsArg): string;
|
|
|
1196
1202
|
*/
|
|
1197
1203
|
|
|
1198
1204
|
/** The agent-profile lever `improve` optimizes. Mirrors the AgentProfile-law
|
|
1199
|
-
* profile levers; `code` is the implementation-tier surface
|
|
1200
|
-
|
|
1205
|
+
* profile levers; `code` is the implementation-tier surface, `rollout-policy`
|
|
1206
|
+
* the inference-time structuralRollout dials
|
|
1207
|
+
* (`profile.extensions['structural-rollout']`). */
|
|
1208
|
+
type ImproveSurface = 'prompt' | 'skills' | 'tools' | 'mcp' | 'hooks' | 'code' | 'rollout-policy';
|
|
1201
1209
|
interface ImproveOptions<TScenario extends Scenario$1, TArtifact> {
|
|
1202
1210
|
/** Which profile lever to optimize. Default `'prompt'`. Selects the default
|
|
1203
1211
|
* generator + the baseline-surface extraction shape. */
|
|
@@ -1411,6 +1419,94 @@ interface ReflectiveGeneratorOptions {
|
|
|
1411
1419
|
/** Cheap no-sandbox `CandidateGenerator` (the `shots=1` setting): draft surface edits via the improvement adapter and apply them as one coherent candidate. */
|
|
1412
1420
|
declare function reflectiveGenerator(opts: ReflectiveGeneratorOptions): CandidateGenerator;
|
|
1413
1421
|
|
|
1422
|
+
/**
|
|
1423
|
+
* `rolloutPolicyProposer` — the `'rollout-policy'` surface for `improve()`: the
|
|
1424
|
+
* inference-time `StructuralRolloutPolicy` dials { k, repairRounds, testgen } as a
|
|
1425
|
+
* held-out-gated optimizable surface.
|
|
1426
|
+
*
|
|
1427
|
+
* Why this seam: agent-eval's loop contract is already generic — `MutableSurface`
|
|
1428
|
+
* admits any string, documented as "serialized tool config" — so the policy rides
|
|
1429
|
+
* the SAME serialize→propose→gate→parse-back cycle the tools/mcp/hooks surfaces
|
|
1430
|
+
* use. No agent-eval changes; the only net-new piece is this proposer.
|
|
1431
|
+
*
|
|
1432
|
+
* Why deterministic: prompt-wording proposals are a measured zero on this stack,
|
|
1433
|
+
* and the policy space is tiny and fully enumerable. The proposer emits bounded
|
|
1434
|
+
* single-dial neighbors (k±2 in [1,10], repairRounds±1 in [0,3], testgen±3 in
|
|
1435
|
+
* [0,10], ≤4 per generation) and lets the held-out gate do ALL the deciding — an
|
|
1436
|
+
* LLM proposer would add cost and nondeterminism with nothing to reason about.
|
|
1437
|
+
*
|
|
1438
|
+
* Persistence: the policy lives in `profile.extensions['structural-rollout']`
|
|
1439
|
+
* (AgentProfile's designed slot for runtime-specific config). A gated winner is
|
|
1440
|
+
* written back there by `improve()`, the same profile-field write-back every other
|
|
1441
|
+
* config surface gets; `structuralRolloutPolicyFromProfile` is the read side a
|
|
1442
|
+
* runtime caller feeds to `structuralRollout({ policy })`.
|
|
1443
|
+
*
|
|
1444
|
+
* @experimental
|
|
1445
|
+
*/
|
|
1446
|
+
|
|
1447
|
+
/** The profile extensions namespace the policy persists under. */
|
|
1448
|
+
declare const ROLLOUT_POLICY_EXTENSION = "structural-rollout";
|
|
1449
|
+
/** Proposal bounds per dial. These are the SEARCH bounds (what the proposer may
|
|
1450
|
+
* explore), chosen so every reachable value is a measured-sane recipe: k=1 is the
|
|
1451
|
+
* low-compute preset, testgen=0 disables check authoring, repairRounds caps where
|
|
1452
|
+
* the measured increment flattens (+1–3pp beyond round 2). */
|
|
1453
|
+
declare const ROLLOUT_POLICY_BOUNDS: {
|
|
1454
|
+
readonly k: {
|
|
1455
|
+
readonly min: 1;
|
|
1456
|
+
readonly max: 10;
|
|
1457
|
+
readonly step: 2;
|
|
1458
|
+
};
|
|
1459
|
+
readonly repairRounds: {
|
|
1460
|
+
readonly min: 0;
|
|
1461
|
+
readonly max: 3;
|
|
1462
|
+
readonly step: 1;
|
|
1463
|
+
};
|
|
1464
|
+
readonly testgen: {
|
|
1465
|
+
readonly min: 0;
|
|
1466
|
+
readonly max: 10;
|
|
1467
|
+
readonly step: 3;
|
|
1468
|
+
};
|
|
1469
|
+
};
|
|
1470
|
+
/** Parse a serialized policy surface. Defensive by design — the proposer reads
|
|
1471
|
+
* `ctx.currentSurface`, which the loop types as `string | CodeSurface`. Returns
|
|
1472
|
+
* `undefined` (never throws) for non-strings, malformed JSON, or a shape that
|
|
1473
|
+
* violates the policy's own invariants: the no-op signal. Unknown dials are
|
|
1474
|
+
* dropped; `diverse`/`temperature` ride through untouched (the proposer never
|
|
1475
|
+
* mutates them — `diverse` is a measured paired null). */
|
|
1476
|
+
declare function parseRolloutPolicy(surface: MutableSurface$1): StructuralRolloutPolicy | undefined;
|
|
1477
|
+
/** Normalize an untyped policy bag (a parsed surface or a profile extension) into
|
|
1478
|
+
* a full `StructuralRolloutPolicy`, defaults merged. Returns `undefined` when any
|
|
1479
|
+
* present dial violates the policy invariants (mirrors `resolvePolicy`: integer
|
|
1480
|
+
* k ≥ 1, repairRounds ≥ 0, testgen ≥ 0) — a corrupt config must read as "not
|
|
1481
|
+
* configured", never as a fabricated recipe. */
|
|
1482
|
+
declare function normalizeRolloutPolicy(raw: unknown): StructuralRolloutPolicy | undefined;
|
|
1483
|
+
/** Stable serialization — dial order is fixed so identical policies produce
|
|
1484
|
+
* identical surfaces (the loop dedupes/hashes candidates by surface content). */
|
|
1485
|
+
declare function serializeRolloutPolicy(policy: StructuralRolloutPolicy): string;
|
|
1486
|
+
/** Read the persisted policy off the profile. `undefined` when the profile does
|
|
1487
|
+
* not opt into structural rollout — the improve() surface no-ops then, because
|
|
1488
|
+
* tuning dials nothing consumes would ship dead config. */
|
|
1489
|
+
declare function structuralRolloutPolicyFromProfile(profile: AgentProfile$1): StructuralRolloutPolicy | undefined;
|
|
1490
|
+
/** Persist a policy into the profile's extensions namespace. Shallow copy; never
|
|
1491
|
+
* mutates the input profile (the applyWinnerToProfile contract). */
|
|
1492
|
+
declare function applyRolloutPolicyToProfile(profile: AgentProfile$1, policy: StructuralRolloutPolicy): AgentProfile$1;
|
|
1493
|
+
/** All bounded single-dial neighbors of `policy`, in a fixed priority order: k
|
|
1494
|
+
* first (selection breadth carries 85–92% of the measured effect), then
|
|
1495
|
+
* repairRounds, then testgen. Steps clamp to the dial's bounds; clamped-to-no-op
|
|
1496
|
+
* and duplicate policies are dropped. */
|
|
1497
|
+
declare function enumerateNeighborPolicies(policy: StructuralRolloutPolicy): StructuralRolloutPolicy[];
|
|
1498
|
+
/**
|
|
1499
|
+
* The deterministic `SurfaceProposer` for the `'rollout-policy'` surface.
|
|
1500
|
+
*
|
|
1501
|
+
* Each generation: parse the current policy surface, enumerate its bounded
|
|
1502
|
+
* single-dial neighbors, and return at most `min(populationSize, 4)` of them,
|
|
1503
|
+
* rotating the enumeration window by generation so successive generations explore
|
|
1504
|
+
* different neighbors when nothing promoted. Proposes NOTHING when the surface
|
|
1505
|
+
* carries no policy (the profile never opted in) — an empty proposal is the
|
|
1506
|
+
* loop-native no-op, mirroring `improvementDriver`'s no-findings behavior.
|
|
1507
|
+
*/
|
|
1508
|
+
declare function rolloutPolicyProposer(): SurfaceProposer$1;
|
|
1509
|
+
|
|
1414
1510
|
/**
|
|
1415
1511
|
*
|
|
1416
1512
|
* Chat-model resolution + catalog validation — the shared primitive every
|
|
@@ -1945,4 +2041,4 @@ interface StreamToolLoopOptions<Raw> {
|
|
|
1945
2041
|
* `capped` if it stops for any non-completed reason with calls still pending. */
|
|
1946
2042
|
declare function streamToolLoop<Raw>(opts: StreamToolLoopOptions<Raw>): AsyncGenerator<StreamToolLoopYield<Raw>, void, unknown>;
|
|
1947
2043
|
|
|
1948
|
-
export { AgentBackendContext, AgentBackendInput, type AgentBackendKind, AgentExecutionBackend, AgentRuntimeEvent, AgentTaskRunResult, AgentTaskStatus, type AuthSource, type BackendCallPolicy, BackendTransportError, CandidateGenerator, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, type Conversation, type ConversationDriveState, type ConversationJournal, type ConversationJournalEntry, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type D1DatabaseLike, type D1StmtLike, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DeadlineExceededError, FORWARD_HEADERS, FileConversationJournal, type ForwardHeaderName, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, type ImproveOptions, type ImproveResult, type ImproveSurface, InMemoryConversationJournal, InMemoryRuntimeSessionStore, type ModelInfo, OpenAIChatResponseFormat, OpenAIChatTool, OpenAIChatToolChoice, type PersonaConversationResult, type PersonaDriver, PlannerError, type PropagatedHeaders, type RawTraceDistillerOptions, type ReflectiveGeneratorOptions, type ResolveAgentBackendOptions, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunChatTurnInput, type RunConversationOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunToolLoopOptions, type RuntimeEventCollector, RuntimeHooks, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SqlAdapter, SqlConversationJournal, type StreamToolLoopOptions, type StreamToolLoopYield, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, type TurnOrder, Verifier, applyRunRecordDefaults, buildForwardHeaders, cleanModelId, computeBackoff, createConversationBackend, createIterableBackend, createOpenAICompatibleBackend, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, d1ToSqlAdapter, decideKnowledgeReadiness, defaultIsRetryable, defineConversation, deriveExecutionId, getModels, handleChatTurn, improve, isDepthExceeded, makePerAttemptSignal, mcpBuildPrompt, rawTraceDistiller, readDepth, readinessServerSentEvent, reflectiveGenerator, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runPersonaConversation, runPersonaDispatch, runToolLoop, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sleep, slugifySpeaker, streamToolLoop, toolBuildPrompt, turnId, validateChatModelId };
|
|
2044
|
+
export { AgentBackendContext, AgentBackendInput, type AgentBackendKind, AgentExecutionBackend, AgentRuntimeEvent, AgentTaskRunResult, AgentTaskStatus, type AuthSource, type BackendCallPolicy, BackendTransportError, CandidateGenerator, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, type Conversation, type ConversationDriveState, type ConversationJournal, type ConversationJournalEntry, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type D1DatabaseLike, type D1StmtLike, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DeadlineExceededError, FORWARD_HEADERS, FileConversationJournal, type ForwardHeaderName, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, type ImproveOptions, type ImproveResult, type ImproveSurface, InMemoryConversationJournal, InMemoryRuntimeSessionStore, type ModelInfo, OpenAIChatResponseFormat, OpenAIChatTool, OpenAIChatToolChoice, type PersonaConversationResult, type PersonaDriver, PlannerError, type PropagatedHeaders, ROLLOUT_POLICY_BOUNDS, ROLLOUT_POLICY_EXTENSION, type RawTraceDistillerOptions, type ReflectiveGeneratorOptions, type ResolveAgentBackendOptions, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunChatTurnInput, type RunConversationOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunToolLoopOptions, type RuntimeEventCollector, RuntimeHooks, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SqlAdapter, SqlConversationJournal, type StreamToolLoopOptions, type StreamToolLoopYield, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, type TurnOrder, Verifier, applyRolloutPolicyToProfile, applyRunRecordDefaults, buildForwardHeaders, cleanModelId, computeBackoff, createConversationBackend, createIterableBackend, createOpenAICompatibleBackend, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, d1ToSqlAdapter, decideKnowledgeReadiness, defaultIsRetryable, defineConversation, deriveExecutionId, enumerateNeighborPolicies, getModels, handleChatTurn, improve, isDepthExceeded, makePerAttemptSignal, mcpBuildPrompt, normalizeRolloutPolicy, parseRolloutPolicy, rawTraceDistiller, readDepth, readinessServerSentEvent, reflectiveGenerator, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, rolloutPolicyProposer, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runPersonaConversation, runPersonaDispatch, runToolLoop, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, serializeRolloutPolicy, sleep, slugifySpeaker, streamToolLoop, structuralRolloutPolicyFromProfile, toolBuildPrompt, turnId, validateChatModelId };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mcpToolsForRuntimeMcp,
|
|
3
3
|
mcpToolsForRuntimeMcpSubset
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QK4DV5PR.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_ROUTER_BASE_URL,
|
|
7
7
|
cleanModelId,
|
|
@@ -20,18 +20,19 @@ import {
|
|
|
20
20
|
runLoopRunnerCli,
|
|
21
21
|
selfImproveLoopRunner,
|
|
22
22
|
worktreeLoopRunner
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-WRUSWK4F.js";
|
|
24
24
|
import "./chunk-SGKPNBXE.js";
|
|
25
25
|
import {
|
|
26
26
|
InMemoryRuntimeSessionStore,
|
|
27
27
|
createIterableBackend,
|
|
28
28
|
createOpenAICompatibleBackend,
|
|
29
29
|
createSandboxPromptBackend,
|
|
30
|
+
defaultStructuralRolloutPolicy,
|
|
30
31
|
newRuntimeSession,
|
|
31
32
|
normalizeBackendStreamEvent,
|
|
32
33
|
nowIso,
|
|
33
34
|
touchSession
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-ZV4LXYCJ.js";
|
|
35
36
|
import "./chunk-ZQZX77MM.js";
|
|
36
37
|
import {
|
|
37
38
|
agenticGenerator,
|
|
@@ -39,7 +40,7 @@ import {
|
|
|
39
40
|
mcpBuildPrompt,
|
|
40
41
|
mcpServeVerifier,
|
|
41
42
|
toolBuildPrompt
|
|
42
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-OOL3675H.js";
|
|
43
44
|
import {
|
|
44
45
|
RESEARCH_SUPERVISOR_SYSTEM_PROMPT,
|
|
45
46
|
createAgentKnowledgeReadinessCheck,
|
|
@@ -48,7 +49,7 @@ import {
|
|
|
48
49
|
knowledgeReadinessDeliverable,
|
|
49
50
|
runKnowledgeImprovementJob,
|
|
50
51
|
runSupervisedKnowledgeUpdate
|
|
51
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-R2VAJGR3.js";
|
|
52
53
|
import "./chunk-5QOB7H74.js";
|
|
53
54
|
import {
|
|
54
55
|
assertModelAllowed,
|
|
@@ -56,7 +57,7 @@ import {
|
|
|
56
57
|
defineRuntimeHooks,
|
|
57
58
|
notifyRuntimeDecisionPoint,
|
|
58
59
|
notifyRuntimeHookEvent
|
|
59
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-RYBVU4M3.js";
|
|
60
61
|
import "./chunk-DPEUKJRO.js";
|
|
61
62
|
import {
|
|
62
63
|
INTELLIGENCE_WIRE_VERSION,
|
|
@@ -65,10 +66,10 @@ import {
|
|
|
65
66
|
createOtelExporter,
|
|
66
67
|
exportEvalRuns,
|
|
67
68
|
loopEventToOtelSpan
|
|
68
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-IVGYLCFH.js";
|
|
69
70
|
import "./chunk-BZF3KQ6G.js";
|
|
70
71
|
import "./chunk-FVJ7M3DA.js";
|
|
71
|
-
import "./chunk-
|
|
72
|
+
import "./chunk-CMYMTRGA.js";
|
|
72
73
|
import {
|
|
73
74
|
AgentEvalError,
|
|
74
75
|
BackendTransportError,
|
|
@@ -1298,7 +1299,9 @@ function improvementDriver(opts) {
|
|
|
1298
1299
|
kind: `improvement:${opts.generator.kind}`,
|
|
1299
1300
|
async propose(ctx) {
|
|
1300
1301
|
const findings = resolveFindings(ctx);
|
|
1301
|
-
if (findings.length === 0 && ctx.report === void 0)
|
|
1302
|
+
if (findings.length === 0 && ctx.report === void 0 && !opts.generator.proposesWithoutFindings) {
|
|
1303
|
+
return [];
|
|
1304
|
+
}
|
|
1302
1305
|
const surfaces = [];
|
|
1303
1306
|
for (let i = 0; i < ctx.populationSize; i++) {
|
|
1304
1307
|
if (ctx.signal.aborted) break;
|
|
@@ -1360,7 +1363,10 @@ function rawTraceDistiller(options = {}) {
|
|
|
1360
1363
|
})).sort((a, b) => a.composite - b.composite).slice(0, maxCandidates);
|
|
1361
1364
|
const totalFailingCells = ranked.reduce((n, c) => n + c.cells.length, 0);
|
|
1362
1365
|
if (totalFailingCells === 0) {
|
|
1363
|
-
|
|
1366
|
+
if (options.fallbackFindings && options.fallbackFindings.length > 0) {
|
|
1367
|
+
return options.fallbackFindings;
|
|
1368
|
+
}
|
|
1369
|
+
return [
|
|
1364
1370
|
makeFinding({
|
|
1365
1371
|
analyst_id: ANALYST_ID,
|
|
1366
1372
|
severity: "info",
|
|
@@ -1508,6 +1514,121 @@ function truncate(s, n) {
|
|
|
1508
1514
|
return s.length <= n ? s : `${s.slice(0, n - 1)}\u2026`;
|
|
1509
1515
|
}
|
|
1510
1516
|
|
|
1517
|
+
// src/improvement/rollout-policy.ts
|
|
1518
|
+
var ROLLOUT_POLICY_EXTENSION = "structural-rollout";
|
|
1519
|
+
var ROLLOUT_POLICY_BOUNDS = {
|
|
1520
|
+
k: { min: 1, max: 10, step: 2 },
|
|
1521
|
+
repairRounds: { min: 0, max: 3, step: 1 },
|
|
1522
|
+
testgen: { min: 0, max: 10, step: 3 }
|
|
1523
|
+
};
|
|
1524
|
+
var MAX_CANDIDATES_PER_GENERATION = 4;
|
|
1525
|
+
var clamp = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
1526
|
+
var isBoundedInt = (v, min) => typeof v === "number" && Number.isInteger(v) && v >= min;
|
|
1527
|
+
function parseRolloutPolicy(surface) {
|
|
1528
|
+
if (typeof surface !== "string" || surface.trim().length === 0) return void 0;
|
|
1529
|
+
let raw;
|
|
1530
|
+
try {
|
|
1531
|
+
raw = JSON.parse(surface);
|
|
1532
|
+
} catch {
|
|
1533
|
+
return void 0;
|
|
1534
|
+
}
|
|
1535
|
+
return normalizeRolloutPolicy(raw);
|
|
1536
|
+
}
|
|
1537
|
+
function normalizeRolloutPolicy(raw) {
|
|
1538
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return void 0;
|
|
1539
|
+
const bag = raw;
|
|
1540
|
+
const k = bag.k ?? defaultStructuralRolloutPolicy.k;
|
|
1541
|
+
const repairRounds = bag.repairRounds ?? defaultStructuralRolloutPolicy.repairRounds;
|
|
1542
|
+
const testgen = bag.testgen ?? defaultStructuralRolloutPolicy.testgen;
|
|
1543
|
+
if (!isBoundedInt(k, 1) || !isBoundedInt(repairRounds, 0) || !isBoundedInt(testgen, 0)) {
|
|
1544
|
+
return void 0;
|
|
1545
|
+
}
|
|
1546
|
+
return {
|
|
1547
|
+
k,
|
|
1548
|
+
repairRounds,
|
|
1549
|
+
testgen,
|
|
1550
|
+
...typeof bag.diverse === "boolean" ? { diverse: bag.diverse } : {},
|
|
1551
|
+
...typeof bag.temperature === "number" ? { temperature: bag.temperature } : {}
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
function serializeRolloutPolicy(policy) {
|
|
1555
|
+
return JSON.stringify({
|
|
1556
|
+
k: policy.k,
|
|
1557
|
+
repairRounds: policy.repairRounds,
|
|
1558
|
+
testgen: policy.testgen,
|
|
1559
|
+
...policy.diverse !== void 0 ? { diverse: policy.diverse } : {},
|
|
1560
|
+
...policy.temperature !== void 0 ? { temperature: policy.temperature } : {}
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
function structuralRolloutPolicyFromProfile(profile) {
|
|
1564
|
+
const bag = profile.extensions?.[ROLLOUT_POLICY_EXTENSION];
|
|
1565
|
+
if (bag === void 0) return void 0;
|
|
1566
|
+
return normalizeRolloutPolicy(bag);
|
|
1567
|
+
}
|
|
1568
|
+
function applyRolloutPolicyToProfile(profile, policy) {
|
|
1569
|
+
const bag = {
|
|
1570
|
+
k: policy.k,
|
|
1571
|
+
repairRounds: policy.repairRounds,
|
|
1572
|
+
testgen: policy.testgen,
|
|
1573
|
+
...policy.diverse !== void 0 ? { diverse: policy.diverse } : {},
|
|
1574
|
+
...policy.temperature !== void 0 ? { temperature: policy.temperature } : {}
|
|
1575
|
+
};
|
|
1576
|
+
return {
|
|
1577
|
+
...profile,
|
|
1578
|
+
extensions: { ...profile.extensions, [ROLLOUT_POLICY_EXTENSION]: bag }
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
function enumerateNeighborPolicies(policy) {
|
|
1582
|
+
const moves = [
|
|
1583
|
+
{ dial: "k", delta: 1 },
|
|
1584
|
+
{ dial: "k", delta: -1 },
|
|
1585
|
+
{ dial: "repairRounds", delta: 1 },
|
|
1586
|
+
{ dial: "repairRounds", delta: -1 },
|
|
1587
|
+
{ dial: "testgen", delta: 1 },
|
|
1588
|
+
{ dial: "testgen", delta: -1 }
|
|
1589
|
+
];
|
|
1590
|
+
const seen = /* @__PURE__ */ new Set([serializeRolloutPolicy(policy)]);
|
|
1591
|
+
const neighbors = [];
|
|
1592
|
+
for (const move of moves) {
|
|
1593
|
+
const bounds = ROLLOUT_POLICY_BOUNDS[move.dial];
|
|
1594
|
+
const next = clamp(policy[move.dial] + move.delta * bounds.step, bounds.min, bounds.max);
|
|
1595
|
+
const candidate = { ...policy, [move.dial]: next };
|
|
1596
|
+
const key = serializeRolloutPolicy(candidate);
|
|
1597
|
+
if (seen.has(key)) continue;
|
|
1598
|
+
seen.add(key);
|
|
1599
|
+
neighbors.push(candidate);
|
|
1600
|
+
}
|
|
1601
|
+
return neighbors;
|
|
1602
|
+
}
|
|
1603
|
+
function candidateLabel(base, next) {
|
|
1604
|
+
for (const dial of ["k", "repairRounds", "testgen"]) {
|
|
1605
|
+
if (next[dial] !== base[dial]) return `${dial} ${base[dial]}\u2192${next[dial]}`;
|
|
1606
|
+
}
|
|
1607
|
+
return "unchanged";
|
|
1608
|
+
}
|
|
1609
|
+
function rolloutPolicyProposer() {
|
|
1610
|
+
return {
|
|
1611
|
+
kind: "rollout-policy",
|
|
1612
|
+
async propose(ctx) {
|
|
1613
|
+
const policy = parseRolloutPolicy(ctx.currentSurface);
|
|
1614
|
+
if (!policy) return [];
|
|
1615
|
+
const neighbors = enumerateNeighborPolicies(policy);
|
|
1616
|
+
if (neighbors.length === 0) return [];
|
|
1617
|
+
const cap = Math.max(1, Math.min(ctx.populationSize, MAX_CANDIDATES_PER_GENERATION));
|
|
1618
|
+
const start = ctx.generation * cap % neighbors.length;
|
|
1619
|
+
const window = [];
|
|
1620
|
+
for (let i = 0; i < Math.min(cap, neighbors.length); i += 1) {
|
|
1621
|
+
window.push(neighbors[(start + i) % neighbors.length]);
|
|
1622
|
+
}
|
|
1623
|
+
return window.map((candidate) => ({
|
|
1624
|
+
surface: serializeRolloutPolicy(candidate),
|
|
1625
|
+
label: candidateLabel(policy, candidate),
|
|
1626
|
+
rationale: "bounded single-dial neighbor of the current structuralRollout policy; the held-out gate decides (deterministic enumeration \u2014 the dial space is tiny and prompt-style reflective proposals are a measured zero here)"
|
|
1627
|
+
}));
|
|
1628
|
+
}
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1511
1632
|
// src/improvement/improve.ts
|
|
1512
1633
|
var defaultReflectionModel = "deepseek-v4-flash";
|
|
1513
1634
|
function llmClientOptions(llm) {
|
|
@@ -1520,6 +1641,8 @@ function defaultGeneratorFor(surface, llm) {
|
|
|
1520
1641
|
return gepaProposer({ llm: llmClientOptions(llm), model, target: "agent system prompt" });
|
|
1521
1642
|
case "skills":
|
|
1522
1643
|
return skillOptProposer({ llm: llmClientOptions(llm), model, target: "agent skill document" });
|
|
1644
|
+
case "rollout-policy":
|
|
1645
|
+
return rolloutPolicyProposer();
|
|
1523
1646
|
default:
|
|
1524
1647
|
return void 0;
|
|
1525
1648
|
}
|
|
@@ -1536,6 +1659,10 @@ function baselineSurfaceFor(profile, surface, skills) {
|
|
|
1536
1659
|
return JSON.stringify(profile.mcp ?? {});
|
|
1537
1660
|
case "hooks":
|
|
1538
1661
|
return JSON.stringify(profile.hooks ?? {});
|
|
1662
|
+
case "rollout-policy": {
|
|
1663
|
+
const policy = structuralRolloutPolicyFromProfile(profile);
|
|
1664
|
+
return policy ? serializeRolloutPolicy(policy) : "";
|
|
1665
|
+
}
|
|
1539
1666
|
case "code":
|
|
1540
1667
|
return "";
|
|
1541
1668
|
}
|
|
@@ -1609,6 +1736,15 @@ function applyWinnerToProfile(profile, surface, winner) {
|
|
|
1609
1736
|
return { ...profile, mcp: parseWinnerJson(winner, surface) };
|
|
1610
1737
|
case "hooks":
|
|
1611
1738
|
return { ...profile, hooks: parseWinnerJson(winner, surface) };
|
|
1739
|
+
case "rollout-policy": {
|
|
1740
|
+
const policy = normalizeRolloutPolicy(parseWinnerJson(winner, surface));
|
|
1741
|
+
if (!policy) {
|
|
1742
|
+
throw new ConfigError(
|
|
1743
|
+
`improve(): the shipped 'rollout-policy' winner is not a valid StructuralRolloutPolicy (integer k >= 1, repairRounds >= 0, testgen >= 0), so it cannot be applied: ${winner}`
|
|
1744
|
+
);
|
|
1745
|
+
}
|
|
1746
|
+
return applyRolloutPolicyToProfile(profile, policy);
|
|
1747
|
+
}
|
|
1612
1748
|
case "code":
|
|
1613
1749
|
return profile;
|
|
1614
1750
|
}
|
|
@@ -3127,10 +3263,13 @@ export {
|
|
|
3127
3263
|
NotFoundError,
|
|
3128
3264
|
PlannerError,
|
|
3129
3265
|
RESEARCH_SUPERVISOR_SYSTEM_PROMPT,
|
|
3266
|
+
ROLLOUT_POLICY_BOUNDS,
|
|
3267
|
+
ROLLOUT_POLICY_EXTENSION,
|
|
3130
3268
|
RuntimeRunStateError,
|
|
3131
3269
|
SqlConversationJournal,
|
|
3132
3270
|
ValidationError,
|
|
3133
3271
|
agenticGenerator,
|
|
3272
|
+
applyRolloutPolicyToProfile,
|
|
3134
3273
|
applyRunRecordDefaults,
|
|
3135
3274
|
auditLoopRunner,
|
|
3136
3275
|
buildForwardHeaders,
|
|
@@ -3155,6 +3294,7 @@ export {
|
|
|
3155
3294
|
defineConversation,
|
|
3156
3295
|
defineRuntimeHooks,
|
|
3157
3296
|
deriveExecutionId,
|
|
3297
|
+
enumerateNeighborPolicies,
|
|
3158
3298
|
exportEvalRuns,
|
|
3159
3299
|
formatSupervisedKnowledgeTask,
|
|
3160
3300
|
getModels,
|
|
@@ -3170,9 +3310,11 @@ export {
|
|
|
3170
3310
|
mcpServeVerifier,
|
|
3171
3311
|
mcpToolsForRuntimeMcp,
|
|
3172
3312
|
mcpToolsForRuntimeMcpSubset,
|
|
3313
|
+
normalizeRolloutPolicy,
|
|
3173
3314
|
notifyRuntimeDecisionPoint,
|
|
3174
3315
|
notifyRuntimeHookEvent,
|
|
3175
3316
|
parseLoopRunnerArgv,
|
|
3317
|
+
parseRolloutPolicy,
|
|
3176
3318
|
rawTraceDistiller,
|
|
3177
3319
|
readDepth,
|
|
3178
3320
|
readinessServerSentEvent,
|
|
@@ -3181,6 +3323,7 @@ export {
|
|
|
3181
3323
|
resolveAgentBackend,
|
|
3182
3324
|
resolveChatModel,
|
|
3183
3325
|
resolveRouterBaseUrl,
|
|
3326
|
+
rolloutPolicyProposer,
|
|
3184
3327
|
runAgentTask,
|
|
3185
3328
|
runAgentTaskStream,
|
|
3186
3329
|
runConversation,
|
|
@@ -3197,10 +3340,12 @@ export {
|
|
|
3197
3340
|
sanitizeKnowledgeReadinessReport,
|
|
3198
3341
|
sanitizeRuntimeStreamEvent,
|
|
3199
3342
|
selfImproveLoopRunner,
|
|
3343
|
+
serializeRolloutPolicy,
|
|
3200
3344
|
sleep,
|
|
3201
3345
|
slugifySpeaker,
|
|
3202
3346
|
startRuntimeRun,
|
|
3203
3347
|
streamToolLoop,
|
|
3348
|
+
structuralRolloutPolicyFromProfile,
|
|
3204
3349
|
toolBuildPrompt,
|
|
3205
3350
|
turnId,
|
|
3206
3351
|
validateChatModelId,
|