@tangle-network/agent-runtime 0.93.2 → 0.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -4
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/candidate-execution/index.d.ts +10 -3
- package/dist/candidate-execution/index.js +8 -2
- package/dist/{chunk-XDSWWUKE.js → chunk-4E2GM63H.js} +6 -29
- package/dist/chunk-4E2GM63H.js.map +1 -0
- package/dist/{chunk-TU73X3I6.js → chunk-4GBT4WQ6.js} +2 -2
- package/dist/{chunk-Z7K5BPKZ.js → chunk-55P6V5JT.js} +2 -2
- package/dist/{chunk-OX3QRJOA.js → chunk-7I2AOKCI.js} +280 -250
- package/dist/chunk-7I2AOKCI.js.map +1 -0
- package/dist/{chunk-2BQMAZAB.js → chunk-FHZHADIM.js} +1327 -19
- package/dist/chunk-FHZHADIM.js.map +1 -0
- package/dist/{chunk-WGR6QJ5H.js → chunk-H2D3DCEB.js} +7 -160
- package/dist/chunk-H2D3DCEB.js.map +1 -0
- package/dist/chunk-ISTDY47H.js +849 -0
- package/dist/chunk-ISTDY47H.js.map +1 -0
- package/dist/{chunk-X5KJKS33.js → chunk-MRYPFDHJ.js} +3 -3
- package/dist/{chunk-6K5CI33W.js → chunk-OO4EK3JB.js} +1228 -18
- package/dist/chunk-OO4EK3JB.js.map +1 -0
- package/dist/{chunk-R5GWDTM3.js → chunk-ZEYAT33L.js} +2 -2
- package/dist/{completion-gate-BLaiN0-X.d.ts → completion-gate-BDkEYB_-.d.ts} +1 -1
- package/dist/{coordination-DxJ83oZA.d.ts → coordination-EGoRbbsd.d.ts} +4 -4
- package/dist/environment-provider.d.ts +2 -2
- package/dist/{improve-DDhQaaJT.d.ts → improve-ZzTEkpF_.d.ts} +11 -14
- package/dist/index.d.ts +35 -106
- package/dist/index.js +89 -33
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +22 -5
- package/dist/intelligence.js +111 -17
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.d.ts +6 -6
- package/dist/knowledge.js +3 -3
- package/dist/{loop-runner-bin-kKUNGLyV.d.ts → loop-runner-bin-BRXC1RwC.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +5 -5
- package/dist/loop-runner-bin.js +4 -5
- package/dist/loops.d.ts +456 -17
- package/dist/loops.js +37 -39
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +8 -8
- package/dist/mcp/index.js +5 -6
- package/dist/mcp/index.js.map +1 -1
- package/dist/{openai-tools-E3woykz9.d.ts → openai-tools-D0ZSRCC6.d.ts} +1 -1
- package/dist/{prepare-DiVGKcwS.d.ts → prepare-BKxAiUcH.d.ts} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{sanitize-C9go6tXj.d.ts → sanitize-C2jicjNf.d.ts} +1 -1
- package/dist/{supervise-T2pazU3G.d.ts → supervise-Gmf709kn.d.ts} +4 -4
- package/dist/{types-DAdIm4AC.d.ts → types-Cg_teUPO.d.ts} +2 -2
- package/dist/{types-B00NtbCs.d.ts → types-DWA64rbJ.d.ts} +1 -1
- package/dist/{worktree-fanout-BUb2Ag02.d.ts → worktree-fanout-BrB4att3.d.ts} +233 -233
- package/package.json +4 -4
- package/skills/build-with-agent-runtime/SKILL.md +1 -1
- package/dist/chunk-2BQMAZAB.js.map +0 -1
- package/dist/chunk-6K5CI33W.js.map +0 -1
- package/dist/chunk-FDJ7AHXG.js +0 -1229
- package/dist/chunk-FDJ7AHXG.js.map +0 -1
- package/dist/chunk-J2K6WIG6.js +0 -2172
- package/dist/chunk-J2K6WIG6.js.map +0 -1
- package/dist/chunk-OX3QRJOA.js.map +0 -1
- package/dist/chunk-WGR6QJ5H.js.map +0 -1
- package/dist/chunk-XDSWWUKE.js.map +0 -1
- package/dist/structural-rollout-DHGDbhvR.d.ts +0 -446
- /package/dist/{chunk-TU73X3I6.js.map → chunk-4GBT4WQ6.js.map} +0 -0
- /package/dist/{chunk-Z7K5BPKZ.js.map → chunk-55P6V5JT.js.map} +0 -0
- /package/dist/{chunk-X5KJKS33.js.map → chunk-MRYPFDHJ.js.map} +0 -0
- /package/dist/{chunk-R5GWDTM3.js.map → chunk-ZEYAT33L.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildLoopOtelSpans,
|
|
3
3
|
createOtelExporter
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ISTDY47H.js";
|
|
5
5
|
|
|
6
6
|
// src/mcp/trace-propagation.ts
|
|
7
7
|
function readTraceContextFromEnv() {
|
|
@@ -49,4 +49,4 @@ export {
|
|
|
49
49
|
createPropagatingTraceEmitter,
|
|
50
50
|
traceContextToEnv
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=chunk-
|
|
52
|
+
//# sourceMappingURL=chunk-ZEYAT33L.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { E as ExecutorFactory,
|
|
1
|
+
import { E as ExecutorFactory, e as ExecutorRegistry, i as Spend, A as Agent, S as Scope, a as ResultBlobStore, B as Budget } from './types-Cg_teUPO.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, g as LoopTraceEmitter, f as LoopTraceEvent, a as RuntimeStreamEvent, d as AgentRunSpec } from './types-DWA64rbJ.js';
|
|
5
5
|
import { BackendType, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
|
|
6
6
|
import { AgentEvalError } from '@tangle-network/agent-eval';
|
|
7
|
-
import { b as ToolSpec, c as RuntimeTelemetryOptions, R as RouterConfig } from './sanitize-
|
|
8
|
-
import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-
|
|
7
|
+
import { b as ToolSpec, c as RuntimeTelemetryOptions, R as RouterConfig } from './sanitize-C2jicjNf.js';
|
|
8
|
+
import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-BDkEYB_-.js';
|
|
9
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';
|
|
@@ -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-Cg_teUPO.js';
|
|
6
|
+
import { S as SandboxClient } from './types-DWA64rbJ.js';
|
|
7
7
|
import '@tangle-network/agent-eval';
|
|
8
8
|
|
|
9
9
|
/** Provider object or registry name accepted by runtime provider adapters.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Scenario, SelfImproveOptions, SurfaceProposer, SelfImproveResult } from '@tangle-network/agent-eval/contract';
|
|
1
|
+
import { Scenario, SelfImproveOptions, SurfaceProposer, SelfImproveResult, MutableSurface } from '@tangle-network/agent-eval/contract';
|
|
2
2
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
3
3
|
import { L as LocalHarness } from './local-harness-dcD5WTTr.js';
|
|
4
4
|
import { V as Verifier, C as CandidateGenerator } from './agentic-generator-B8oeE2Yv.js';
|
|
@@ -21,12 +21,7 @@ import { V as Verifier, C as CandidateGenerator } from './agentic-generator-B8oe
|
|
|
21
21
|
* lesson document supplied through `opts.memory`.
|
|
22
22
|
* - `surface: 'agent-profile'` → caller-supplied proposer mutates the complete
|
|
23
23
|
* canonical AgentProfile JSON in one candidate.
|
|
24
|
-
* - `surface
|
|
25
|
-
* inference-time `StructuralRolloutPolicy` dials ({ k, repairRounds, testgen })
|
|
26
|
-
* persisted in `profile.extensions['structural-rollout']` — deterministic
|
|
27
|
-
* bounded neighbor enumeration; the held-out gate does the deciding. No-op
|
|
28
|
-
* (nothing proposed, nothing shipped) when the profile has no such extension.
|
|
29
|
-
* - `surface` ∈ {`tools`, `mcp`, `hooks`, `subagents`, `workflow`, `agent-profile`, `code`} → no zero-config default
|
|
24
|
+
* - `surface` ∈ {`tools`, `mcp`, `hooks`, `subagents`, `agent-profile`, `code`} → no zero-config default
|
|
30
25
|
* proposer exists (a code/config proposer needs caller-supplied wiring — a
|
|
31
26
|
* worktree repo root, a candidate generator, a serializer). The facade
|
|
32
27
|
* requires an explicit `opts.generator` for these and throws a `ConfigError`
|
|
@@ -40,17 +35,16 @@ import { V as Verifier, C as CandidateGenerator } from './agentic-generator-B8oe
|
|
|
40
35
|
* @experimental
|
|
41
36
|
*/
|
|
42
37
|
|
|
43
|
-
/** The agent
|
|
44
|
-
*
|
|
45
|
-
* the
|
|
46
|
-
|
|
47
|
-
type ImproveSurface = 'prompt' | 'skills' | 'tools' | 'mcp' | 'hooks' | 'subagents' | 'workflow' | 'agent-profile' | 'memory' | 'code' | 'rollout-policy';
|
|
38
|
+
/** The executable agent lever `improve` optimizes. Profile fields remain
|
|
39
|
+
* portable AgentProfile coordinates; implementation and orchestration files
|
|
40
|
+
* use the code surface so a winner can be sealed into an exact candidate. */
|
|
41
|
+
type ImproveSurface = 'prompt' | 'skills' | 'tools' | 'mcp' | 'hooks' | 'subagents' | 'agent-profile' | 'memory' | 'code';
|
|
48
42
|
type ImproveOptions<TScenario extends Scenario, TArtifact> = Omit<SelfImproveOptions<TScenario, TArtifact>, 'analyzeGeneration' | 'baselineSurface' | 'findings' | 'gate' | 'proposer'> & {
|
|
49
43
|
/** Which profile lever to optimize. Default `'prompt'`. Selects the default
|
|
50
44
|
* generator + the baseline-surface extraction shape. */
|
|
51
45
|
surface?: ImproveSurface;
|
|
52
46
|
/** The `SurfaceProposer` that mutates the surface. When unset, the facade
|
|
53
|
-
* picks the default for prompt, skills,
|
|
47
|
+
* picks the default for prompt, skills, and memory; surfaces
|
|
54
48
|
* with no default REQUIRE this (fail-loud otherwise). */
|
|
55
49
|
generator?: SurfaceProposer;
|
|
56
50
|
/** Gate mode. `'holdout'` (default) runs the held-out promotion gate;
|
|
@@ -146,6 +140,9 @@ interface ImproveResult<TScenario extends Scenario, TArtifact> {
|
|
|
146
140
|
/** Full `selfImprove` result for advanced inspection. */
|
|
147
141
|
raw: SelfImproveResult<TScenario, TArtifact>;
|
|
148
142
|
}
|
|
143
|
+
/** Apply a promoted winner surface back into the profile field for `surface`.
|
|
144
|
+
* Returns a shallow copy; never mutates the input profile. */
|
|
145
|
+
declare function applyImprovementWinnerToProfile(profile: AgentProfile, surface: ImproveSurface, winner: MutableSurface): AgentProfile;
|
|
149
146
|
/**
|
|
150
147
|
* Run the held-out-gated self-improvement loop on ONE profile surface.
|
|
151
148
|
*
|
|
@@ -161,4 +158,4 @@ interface ImproveResult<TScenario extends Scenario, TArtifact> {
|
|
|
161
158
|
*/
|
|
162
159
|
declare function improve<TScenario extends Scenario, TArtifact>(profile: AgentProfile, findings: unknown[], opts: ImproveOptions<TScenario, TArtifact>): Promise<ImproveResult<TScenario, TArtifact>>;
|
|
163
160
|
|
|
164
|
-
export { type ImproveSurface as I, type ImproveOptions as a, type ImproveResult as b, type ImproveCodeOptions as c, type ImproveMemoryOptions as d, type ImproveSkillsOptions as e, improve as i };
|
|
161
|
+
export { type ImproveSurface as I, type ImproveOptions as a, type ImproveResult as b, type ImproveCodeOptions as c, type ImproveMemoryOptions as d, type ImproveSkillsOptions as e, applyImprovementWinnerToProfile as f, improve as i };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
import { AgentProfile, AgentEvalError, AnalystFinding, KnowledgeReadinessReport, RunRecord, ControlEvalResult } 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
|
-
export { AgentCandidateCodeSource, AgentCandidateCodeSurfaceSource, AgentCandidateModelGrantActivateInput, AgentCandidateModelGrantClient, AgentCandidateModelGrantReservation, AgentCandidateModelGrantReserveInput, AgentCandidateModelGrantSettleInput, AgentCandidateProfileSource, BuildAgentCandidateBundleInput, CreateProtectedAgentCandidateModelPortOptions, DisposePreparedAgentCandidateOptions, FileAgentCandidateExecutionClaimStore, FileAgentCandidateExecutionClaimStoreOptions, RecoverExpiredAgentCandidateOptions, buildAgentCandidateBundle, candidateExecutionClaim, createProtectedAgentCandidateModelPort, disposePreparedAgentCandidateExecution, persistCandidateOutputArtifact, recoverExpiredAgentCandidateExecution, verifyAgentCandidateBundle } from './candidate-execution/index.js';
|
|
6
|
-
export { d as AgentCandidateArtifactPort, e as AgentCandidateBenchmarkGraderIdentity, f as AgentCandidateBenchmarkGraderPort,
|
|
7
|
-
import { Scenario, ProfileDispatchFn,
|
|
3
|
+
import { h as AgentBackendInput, O as OpenAIChatTool, i as OpenAIChatToolChoice, j as OpenAIChatResponseFormat, k as AgentExecutionBackend, l as AgentBackendContext, a as RuntimeStreamEvent, K as KnowledgeReadinessDecision, m as RunAgentTaskOptions, n as AgentTaskRunResult, o as RunAgentTaskStreamOptions, p as RuntimeSessionStore, q as RuntimeSession, R as RuntimeHooks } from './types-DWA64rbJ.js';
|
|
4
|
+
export { r as AgentAdapter, s as AgentKnowledgeProvider, A as AgentRuntimeEvent, t as AgentRuntimeEventSink, u as AgentTaskContext, v as AgentTaskSpec, b as AgentTaskStatus, B as BackendErrorDetail, w as RuntimeDecisionEvidenceRef, x as RuntimeDecisionKind, y as RuntimeDecisionPoint, z as RuntimeHookContext, C as RuntimeHookErrorContext, F as RuntimeHookEvent, G as RuntimeHookPhase, H as RuntimeHookTarget, J as RuntimeRunHandle, M as RuntimeRunPersistenceAdapter, N as RuntimeRunRow, P as composeRuntimeHooks, Q as defineRuntimeHooks, T as notifyRuntimeDecisionPoint, U as notifyRuntimeHookEvent, W as startRuntimeRun } from './types-DWA64rbJ.js';
|
|
5
|
+
export { AgentCandidateCodeSource, AgentCandidateCodeSurfaceSource, AgentCandidateModelGrantActivateInput, AgentCandidateModelGrantClient, AgentCandidateModelGrantReservation, AgentCandidateModelGrantReserveInput, AgentCandidateModelGrantSettleInput, AgentCandidateProfileSource, BuildAgentCandidateBundleInput, CreateProtectedAgentCandidateModelPortOptions, DisposePreparedAgentCandidateOptions, FileAgentCandidateExecutionClaimStore, FileAgentCandidateExecutionClaimStoreOptions, RecoverExpiredAgentCandidateOptions, applyExactAgentProfileDiff, buildAgentCandidateBundle, candidateExecutionClaim, createProtectedAgentCandidateModelPort, disposePreparedAgentCandidateExecution, parseExactAgentProfile, parseExactAgentProfileDiff, persistCandidateOutputArtifact, recoverExpiredAgentCandidateExecution, verifyAgentCandidateBundle } from './candidate-execution/index.js';
|
|
6
|
+
export { d as AgentCandidateArtifactPort, e as AgentCandidateBenchmarkGraderIdentity, f as AgentCandidateBenchmarkGraderPort, A as AgentCandidateBundleInput, g as AgentCandidateContainerPort, h as AgentCandidateExecutionAttemptRecord, i as AgentCandidateExecutionAttemptRef, j as AgentCandidateExecutionClaim, k as AgentCandidateExecutionClaimResult, l as AgentCandidateExecutionClaimStore, m as AgentCandidateExecutionCleanupHandles, n as AgentCandidateExecutionFailureClass, o as AgentCandidateExecutionFinishResult, p as AgentCandidateExecutionLease, q as AgentCandidateExecutionPhase, r as AgentCandidateExecutionPhaseResult, b as AgentCandidateExecutionPorts, s as AgentCandidateExecutionRecoveryEvidence, t as AgentCandidateExecutionStageResult, u as AgentCandidateExecutionTerminalRecord, v as AgentCandidateExecutionTerminalResult, w as AgentCandidateExecutionUsage, x as AgentCandidateExecutorFinalCapture, y as AgentCandidateExecutorMemoryCapture, z as AgentCandidateExecutorPort, B as AgentCandidateExecutorProfileFile, C as AgentCandidateExecutorRequest, D as AgentCandidateExecutorStopRequest, F as AgentCandidateExecutorTaskOutcomeCapture, G as AgentCandidateExecutorWorkspaceFile, H as AgentCandidateExecutorWorkspaceInput, I as AgentCandidateMemoryPort, J as AgentCandidateMemoryResetResult, K as AgentCandidateModelLimits, L as AgentCandidateModelPort, M as AgentCandidateOutputArtifactPort, N as AgentCandidateOutputPurpose, O as AgentCandidateProtectedModelActivation, Q as AgentCandidateProtectedModelCall, R as AgentCandidateProtectedModelReservation, S as AgentCandidateProtectedModelSettlement, T as AgentCandidateProtectedRunCapture, U as AgentCandidateRepositoryPort, V as AgentCandidateRetryRejection, c as AgentCandidateRunFinalization, a as AgentCandidateTaskExecution, W as AgentCandidateVerificationPorts, X as AgentCandidateWorkspacePort, Y as CANDIDATE_TRACE_ENV, Z as CANDIDATE_TRACE_TAGS, _ as CanonicalCandidateDocument, E as ExecutePreparedAgentCandidateOptions, $ as InMemoryAgentCandidateExecutionClaimStore, P as PrepareAgentCandidateExecutionOptions, a0 as PreparedAgentCandidateExecution, a1 as PreparedAgentCandidateInstruction, a2 as PreparedAgentCandidateLaunch, a3 as PreparedAgentCandidateTrace, a4 as ResolvedAgentCandidateContainer, a5 as VerifiedAgentCandidate, a6 as VerifiedAgentCandidateTaskOutcome, a7 as executePreparedAgentCandidate, a8 as prepareAgentCandidateExecution, a9 as sealAgentCandidateBundle } from './prepare-BKxAiUcH.js';
|
|
7
|
+
import { Scenario, ProfileDispatchFn, ProposeContext, SurfaceProposer } from '@tangle-network/agent-eval/campaign';
|
|
8
8
|
import { C as CandidateGenerator } from './agentic-generator-B8oeE2Yv.js';
|
|
9
9
|
export { A as AgenticGeneratorOptions, I as ImprovementDriverOptions, M as ManagedImprovementDriver, V as Verifier, a as VerifyResult, b as agenticGenerator, c as commandVerifier, i as improvementDriver } from './agentic-generator-B8oeE2Yv.js';
|
|
10
|
-
export { c as ImproveCodeOptions, d as ImproveMemoryOptions, a as ImproveOptions, b as ImproveResult, e as ImproveSkillsOptions, I as ImproveSurface, i as improve } from './improve-
|
|
10
|
+
export { c as ImproveCodeOptions, d as ImproveMemoryOptions, a as ImproveOptions, b as ImproveResult, e as ImproveSkillsOptions, I as ImproveSurface, f as applyImprovementWinnerToProfile, i as improve } from './improve-ZzTEkpF_.js';
|
|
11
11
|
export { M as McpServeSpec, m as mcpServeVerifier } from './mcp-serve-verifier-Bg4C3p5S.js';
|
|
12
|
+
import { AgentProfileDiff, AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
12
13
|
import { Scenario as Scenario$1, SelfImproveOptions } from '@tangle-network/agent-eval/contract';
|
|
13
14
|
import { S as SurfaceImprovementEdit } from './improvement-adapter-BieWeK5J.js';
|
|
14
15
|
import { I as ImprovementAdapter } from './types-BC3bZpH0.js';
|
|
15
|
-
import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
16
|
-
import { S as StructuralRolloutPolicy } from './structural-rollout-DHGDbhvR.js';
|
|
17
16
|
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';
|
|
18
|
-
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-
|
|
19
|
-
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-
|
|
20
|
-
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 RuntimeEventOtelOptions, bb as buildLoopOtelSpans, bc as buildLoopSpanNodes, bd as buildRuntimeEventOtelSpans, be as createOtelExporter, bf as exportEvalRuns, bg as loopEventToOtelSpan } from './coordination-
|
|
21
|
-
import { c as RuntimeTelemetryOptions } from './sanitize-
|
|
22
|
-
export { d as RuntimeEventCollector, e as RuntimeStreamEventCollector, S as SanitizedKnowledgeReadinessReport, f as createRuntimeEventCollector, g as createRuntimeStreamEventCollector, s as sanitizeAgentRuntimeEvent, h as sanitizeKnowledgeReadinessReport, i as sanitizeRuntimeStreamEvent } from './sanitize-
|
|
17
|
+
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-BRXC1RwC.js';
|
|
18
|
+
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-D0ZSRCC6.js';
|
|
19
|
+
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 RuntimeEventOtelOptions, bb as buildLoopOtelSpans, bc as buildLoopSpanNodes, bd as buildRuntimeEventOtelSpans, be as createOtelExporter, bf as exportEvalRuns, bg as loopEventToOtelSpan } from './coordination-EGoRbbsd.js';
|
|
20
|
+
import { c as RuntimeTelemetryOptions } from './sanitize-C2jicjNf.js';
|
|
21
|
+
export { d as RuntimeEventCollector, e as RuntimeStreamEventCollector, S as SanitizedKnowledgeReadinessReport, f as createRuntimeEventCollector, g as createRuntimeStreamEventCollector, s as sanitizeAgentRuntimeEvent, h as sanitizeKnowledgeReadinessReport, i as sanitizeRuntimeStreamEvent } from './sanitize-C2jicjNf.js';
|
|
23
22
|
import '@tangle-network/sandbox';
|
|
24
23
|
import './local-harness-dcD5WTTr.js';
|
|
25
24
|
import 'node:child_process';
|
|
26
|
-
import './worktree-fanout-BUb2Ag02.js';
|
|
27
|
-
import './types-DAdIm4AC.js';
|
|
28
|
-
import './completion-gate-BLaiN0-X.js';
|
|
29
25
|
import '@tangle-network/agent-knowledge';
|
|
30
|
-
import './supervise-
|
|
26
|
+
import './supervise-Gmf709kn.js';
|
|
27
|
+
import './types-Cg_teUPO.js';
|
|
28
|
+
import './completion-gate-BDkEYB_-.js';
|
|
31
29
|
import './kb-gate-CwHO0vz6.js';
|
|
30
|
+
import './worktree-fanout-BrB4att3.js';
|
|
32
31
|
import './substrate-DO2GHNg2.js';
|
|
33
32
|
import './environment-provider.js';
|
|
34
33
|
import '@tangle-network/agent-interface/environment-provider';
|
|
@@ -1174,6 +1173,24 @@ declare function toolBuildPrompt(args: FindingsArg): string;
|
|
|
1174
1173
|
/** Build the starting instruction for a coder agent tasked with implementing a new MCP server. */
|
|
1175
1174
|
declare function mcpBuildPrompt(args: FindingsArg): string;
|
|
1176
1175
|
|
|
1176
|
+
interface AgentProfileDiffProposal {
|
|
1177
|
+
diff: AgentProfileDiff;
|
|
1178
|
+
label?: string;
|
|
1179
|
+
rationale?: string;
|
|
1180
|
+
}
|
|
1181
|
+
type ProfileDiffProposerContext<TFindings = unknown> = ProposeContext<TFindings> & {
|
|
1182
|
+
profile: AgentProfile$1;
|
|
1183
|
+
};
|
|
1184
|
+
interface ProfileDiffProposerOptions<TFindings = unknown> {
|
|
1185
|
+
proposeDiffs(context: ProfileDiffProposerContext<TFindings>): Promise<readonly AgentProfileDiffProposal[]> | readonly AgentProfileDiffProposal[];
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Turn exact AgentProfileDiffs from any source into full profile candidates for
|
|
1189
|
+
* the shared optimization loop. Research, catalogs, humans, and trace miners
|
|
1190
|
+
* differ only in `proposeDiffs`; measurement and promotion stay identical.
|
|
1191
|
+
*/
|
|
1192
|
+
declare function profileDiffProposer<TFindings = unknown>(options: ProfileDiffProposerOptions<TFindings>): SurfaceProposer<TFindings>;
|
|
1193
|
+
|
|
1177
1194
|
/**
|
|
1178
1195
|
*
|
|
1179
1196
|
* `rawTraceDistiller` — the meta-harness `analyzeGeneration` producer.
|
|
@@ -1264,94 +1281,6 @@ interface ReflectiveGeneratorOptions {
|
|
|
1264
1281
|
/** Cheap no-sandbox `CandidateGenerator` (the `shots=1` setting): draft surface edits via the improvement adapter and apply them as one coherent candidate. */
|
|
1265
1282
|
declare function reflectiveGenerator(opts: ReflectiveGeneratorOptions): CandidateGenerator;
|
|
1266
1283
|
|
|
1267
|
-
/**
|
|
1268
|
-
* `rolloutPolicyProposer` — the `'rollout-policy'` surface for `improve()`: the
|
|
1269
|
-
* inference-time `StructuralRolloutPolicy` dials { k, repairRounds, testgen } as a
|
|
1270
|
-
* held-out-gated optimizable surface.
|
|
1271
|
-
*
|
|
1272
|
-
* Why this seam: agent-eval's loop contract is already generic — `MutableSurface`
|
|
1273
|
-
* admits any string, documented as "serialized tool config" — so the policy rides
|
|
1274
|
-
* the SAME serialize→propose→gate→parse-back cycle the tools/mcp/hooks surfaces
|
|
1275
|
-
* use. No agent-eval changes; the only net-new piece is this proposer.
|
|
1276
|
-
*
|
|
1277
|
-
* Why deterministic: prompt-wording proposals are a measured zero on this stack,
|
|
1278
|
-
* and the policy space is tiny and fully enumerable. The proposer emits bounded
|
|
1279
|
-
* single-dial neighbors (k±2 in [1,10], repairRounds±1 in [0,3], testgen±3 in
|
|
1280
|
-
* [0,10], ≤4 per generation) and lets the held-out gate do ALL the deciding — an
|
|
1281
|
-
* LLM proposer would add cost and nondeterminism with nothing to reason about.
|
|
1282
|
-
*
|
|
1283
|
-
* Persistence: the policy lives in `profile.extensions['structural-rollout']`
|
|
1284
|
-
* (AgentProfile's designed slot for runtime-specific config). A gated winner is
|
|
1285
|
-
* written back there by `improve()`, the same profile-field write-back every other
|
|
1286
|
-
* config surface gets; `structuralRolloutPolicyFromProfile` is the read side a
|
|
1287
|
-
* runtime caller feeds to `structuralRollout({ policy })`.
|
|
1288
|
-
*
|
|
1289
|
-
* @experimental
|
|
1290
|
-
*/
|
|
1291
|
-
|
|
1292
|
-
/** The profile extensions namespace the policy persists under. */
|
|
1293
|
-
declare const ROLLOUT_POLICY_EXTENSION = "structural-rollout";
|
|
1294
|
-
/** Proposal bounds per dial. These are the SEARCH bounds (what the proposer may
|
|
1295
|
-
* explore), chosen so every reachable value is a measured-sane recipe: k=1 is the
|
|
1296
|
-
* low-compute preset, testgen=0 disables check authoring, repairRounds caps where
|
|
1297
|
-
* the measured increment flattens (+1–3pp beyond round 2). */
|
|
1298
|
-
declare const ROLLOUT_POLICY_BOUNDS: {
|
|
1299
|
-
readonly k: {
|
|
1300
|
-
readonly min: 1;
|
|
1301
|
-
readonly max: 10;
|
|
1302
|
-
readonly step: 2;
|
|
1303
|
-
};
|
|
1304
|
-
readonly repairRounds: {
|
|
1305
|
-
readonly min: 0;
|
|
1306
|
-
readonly max: 3;
|
|
1307
|
-
readonly step: 1;
|
|
1308
|
-
};
|
|
1309
|
-
readonly testgen: {
|
|
1310
|
-
readonly min: 0;
|
|
1311
|
-
readonly max: 10;
|
|
1312
|
-
readonly step: 3;
|
|
1313
|
-
};
|
|
1314
|
-
};
|
|
1315
|
-
/** Parse a serialized policy surface. Defensive by design — the proposer reads
|
|
1316
|
-
* `ctx.currentSurface`, which the loop types as `string | CodeSurface`. Returns
|
|
1317
|
-
* `undefined` (never throws) for non-strings, malformed JSON, or a shape that
|
|
1318
|
-
* violates the policy's own invariants: the no-op signal. Unknown dials are
|
|
1319
|
-
* dropped; `diverse`/`temperature` ride through untouched (the proposer never
|
|
1320
|
-
* mutates them — `diverse` is a measured paired null). */
|
|
1321
|
-
declare function parseRolloutPolicy(surface: MutableSurface): StructuralRolloutPolicy | undefined;
|
|
1322
|
-
/** Normalize an untyped policy bag (a parsed surface or a profile extension) into
|
|
1323
|
-
* a full `StructuralRolloutPolicy`, defaults merged. Returns `undefined` when any
|
|
1324
|
-
* present dial violates the policy invariants (mirrors `resolvePolicy`: integer
|
|
1325
|
-
* k ≥ 1, repairRounds ≥ 0, testgen ≥ 0) — a corrupt config must read as "not
|
|
1326
|
-
* configured", never as a fabricated recipe. */
|
|
1327
|
-
declare function normalizeRolloutPolicy(raw: unknown): StructuralRolloutPolicy | undefined;
|
|
1328
|
-
/** Stable serialization — dial order is fixed so identical policies produce
|
|
1329
|
-
* identical surfaces (the loop dedupes/hashes candidates by surface content). */
|
|
1330
|
-
declare function serializeRolloutPolicy(policy: StructuralRolloutPolicy): string;
|
|
1331
|
-
/** Read the persisted policy off the profile. `undefined` when the profile does
|
|
1332
|
-
* not opt into structural rollout — the improve() surface no-ops then, because
|
|
1333
|
-
* tuning dials nothing consumes would ship dead config. */
|
|
1334
|
-
declare function structuralRolloutPolicyFromProfile(profile: AgentProfile$1): StructuralRolloutPolicy | undefined;
|
|
1335
|
-
/** Persist a policy into the profile's extensions namespace. Shallow copy; never
|
|
1336
|
-
* mutates the input profile (the applyWinnerToProfile contract). */
|
|
1337
|
-
declare function applyRolloutPolicyToProfile(profile: AgentProfile$1, policy: StructuralRolloutPolicy): AgentProfile$1;
|
|
1338
|
-
/** All bounded single-dial neighbors of `policy`, in a fixed priority order: k
|
|
1339
|
-
* first (selection breadth carries 85–92% of the measured effect), then
|
|
1340
|
-
* repairRounds, then testgen. Steps clamp to the dial's bounds; clamped-to-no-op
|
|
1341
|
-
* and duplicate policies are dropped. */
|
|
1342
|
-
declare function enumerateNeighborPolicies(policy: StructuralRolloutPolicy): StructuralRolloutPolicy[];
|
|
1343
|
-
/**
|
|
1344
|
-
* The deterministic `SurfaceProposer` for the `'rollout-policy'` surface.
|
|
1345
|
-
*
|
|
1346
|
-
* Each generation: parse the current policy surface, enumerate its bounded
|
|
1347
|
-
* single-dial neighbors, and return at most `min(populationSize, 4)` of them,
|
|
1348
|
-
* rotating the enumeration window by generation so successive generations explore
|
|
1349
|
-
* different neighbors when nothing promoted. Proposes NOTHING when the surface
|
|
1350
|
-
* carries no policy (the profile never opted in) — an empty proposal is the
|
|
1351
|
-
* loop-native no-op, mirroring `improvementDriver`'s no-findings behavior.
|
|
1352
|
-
*/
|
|
1353
|
-
declare function rolloutPolicyProposer(): SurfaceProposer;
|
|
1354
|
-
|
|
1355
1284
|
/**
|
|
1356
1285
|
*
|
|
1357
1286
|
* Chat-model resolution + catalog validation — the shared primitive every
|
|
@@ -1777,4 +1706,4 @@ interface StreamToolLoopOptions<Raw> {
|
|
|
1777
1706
|
* `capped` if it stops for any non-completed reason with calls still pending. */
|
|
1778
1707
|
declare function streamToolLoop<Raw>(opts: StreamToolLoopOptions<Raw>): AsyncGenerator<StreamToolLoopYield<Raw>, void, unknown>;
|
|
1779
1708
|
|
|
1780
|
-
export { AgentBackendContext, AgentBackendInput, type AgentBackendKind, AgentExecutionBackend, AgentTaskRunResult, 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, InMemoryConversationJournal, InMemoryRuntimeSessionStore, type ModelInfo, OpenAIChatResponseFormat, OpenAIChatTool, OpenAIChatToolChoice, type PersonaConversationResult, type PersonaDriver, PlannerError, type
|
|
1709
|
+
export { AgentBackendContext, AgentBackendInput, type AgentBackendKind, AgentExecutionBackend, type AgentProfileDiffProposal, AgentTaskRunResult, 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, InMemoryConversationJournal, InMemoryRuntimeSessionStore, type ModelInfo, OpenAIChatResponseFormat, OpenAIChatTool, OpenAIChatToolChoice, type PersonaConversationResult, type PersonaDriver, PlannerError, type ProfileDiffProposerContext, type ProfileDiffProposerOptions, 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, RuntimeHooks, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, RuntimeTelemetryOptions, type SqlAdapter, SqlConversationJournal, type StreamToolLoopOptions, type StreamToolLoopYield, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, type TurnOrder, applyRunRecordDefaults, buildForwardHeaders, cleanModelId, computeBackoff, createConversationBackend, createIterableBackend, createOpenAICompatibleBackend, createSandboxPromptBackend, d1ToSqlAdapter, decideKnowledgeReadiness, defaultIsRetryable, defineConversation, deriveExecutionId, getModels, handleChatTurn, isDepthExceeded, makePerAttemptSignal, mcpBuildPrompt, profileDiffProposer, rawTraceDistiller, readDepth, readinessServerSentEvent, reflectiveGenerator, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runPersonaConversation, runPersonaDispatch, runToolLoop, runtimeStreamServerSentEvent, sleep, slugifySpeaker, streamToolLoop, toolBuildPrompt, turnId, validateChatModelId };
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
createProtectedAgentCandidateModelPort,
|
|
5
5
|
disposePreparedAgentCandidateExecution,
|
|
6
6
|
recoverExpiredAgentCandidateExecution
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4E2GM63H.js";
|
|
8
8
|
import {
|
|
9
9
|
mcpToolsForRuntimeMcp,
|
|
10
10
|
mcpToolsForRuntimeMcpSubset
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-55P6V5JT.js";
|
|
12
12
|
import {
|
|
13
13
|
DEFAULT_ROUTER_BASE_URL,
|
|
14
14
|
cleanModelId,
|
|
@@ -27,33 +27,29 @@ import {
|
|
|
27
27
|
runLoopRunnerCli,
|
|
28
28
|
selfImproveLoopRunner,
|
|
29
29
|
worktreeLoopRunner
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-MRYPFDHJ.js";
|
|
31
31
|
import "./chunk-SGKPNBXE.js";
|
|
32
32
|
import {
|
|
33
|
-
|
|
34
|
-
ROLLOUT_POLICY_EXTENSION,
|
|
35
|
-
applyRolloutPolicyToProfile,
|
|
36
|
-
enumerateNeighborPolicies,
|
|
33
|
+
applyImprovementWinnerToProfile,
|
|
37
34
|
improve,
|
|
38
35
|
improvementDriver,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
rawTraceDistiller,
|
|
42
|
-
rolloutPolicyProposer,
|
|
43
|
-
serializeRolloutPolicy,
|
|
44
|
-
structuralRolloutPolicyFromProfile
|
|
45
|
-
} from "./chunk-WGR6QJ5H.js";
|
|
36
|
+
rawTraceDistiller
|
|
37
|
+
} from "./chunk-H2D3DCEB.js";
|
|
46
38
|
import {
|
|
47
39
|
CANDIDATE_TRACE_ENV,
|
|
48
40
|
CANDIDATE_TRACE_TAGS,
|
|
49
41
|
InMemoryAgentCandidateExecutionClaimStore,
|
|
42
|
+
applyExactAgentProfileDiff,
|
|
50
43
|
candidateExecutionClaim,
|
|
44
|
+
canonicalCandidateDigest,
|
|
51
45
|
executePreparedAgentCandidate,
|
|
46
|
+
parseExactAgentProfile,
|
|
47
|
+
parseExactAgentProfileDiff,
|
|
52
48
|
persistCandidateOutputArtifact,
|
|
53
49
|
prepareAgentCandidateExecution,
|
|
54
50
|
sealAgentCandidateBundle,
|
|
55
51
|
verifyAgentCandidateBundle
|
|
56
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-7I2AOKCI.js";
|
|
57
53
|
import {
|
|
58
54
|
InMemoryRuntimeSessionStore,
|
|
59
55
|
createIterableBackend,
|
|
@@ -63,8 +59,7 @@ import {
|
|
|
63
59
|
normalizeBackendStreamEvent,
|
|
64
60
|
nowIso,
|
|
65
61
|
touchSession
|
|
66
|
-
} from "./chunk-
|
|
67
|
-
import "./chunk-FDJ7AHXG.js";
|
|
62
|
+
} from "./chunk-OO4EK3JB.js";
|
|
68
63
|
import "./chunk-ZQZX77MM.js";
|
|
69
64
|
import {
|
|
70
65
|
mcpBuildPrompt,
|
|
@@ -83,28 +78,29 @@ import {
|
|
|
83
78
|
knowledgeReadinessDeliverable,
|
|
84
79
|
runKnowledgeImprovementJob,
|
|
85
80
|
runSupervisedKnowledgeUpdate
|
|
86
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-4GBT4WQ6.js";
|
|
87
82
|
import "./chunk-5QOB7H74.js";
|
|
88
|
-
import
|
|
83
|
+
import {
|
|
84
|
+
composeRuntimeHooks,
|
|
85
|
+
defineRuntimeHooks,
|
|
86
|
+
notifyRuntimeDecisionPoint,
|
|
87
|
+
notifyRuntimeHookEvent
|
|
88
|
+
} from "./chunk-FHZHADIM.js";
|
|
89
89
|
import "./chunk-DPEUKJRO.js";
|
|
90
90
|
import {
|
|
91
91
|
INTELLIGENCE_WIRE_VERSION,
|
|
92
92
|
buildLoopOtelSpans,
|
|
93
93
|
buildLoopSpanNodes,
|
|
94
94
|
buildRuntimeEventOtelSpans,
|
|
95
|
-
composeRuntimeHooks,
|
|
96
95
|
createOtelExporter,
|
|
97
96
|
createRuntimeEventCollector,
|
|
98
97
|
createRuntimeStreamEventCollector,
|
|
99
|
-
defineRuntimeHooks,
|
|
100
98
|
exportEvalRuns,
|
|
101
99
|
loopEventToOtelSpan,
|
|
102
|
-
notifyRuntimeDecisionPoint,
|
|
103
|
-
notifyRuntimeHookEvent,
|
|
104
100
|
sanitizeAgentRuntimeEvent,
|
|
105
101
|
sanitizeKnowledgeReadinessReport,
|
|
106
102
|
sanitizeRuntimeStreamEvent
|
|
107
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-ISTDY47H.js";
|
|
108
104
|
import "./chunk-3D2RHC4K.js";
|
|
109
105
|
import "./chunk-VSWBYWFK.js";
|
|
110
106
|
import "./chunk-3MDZX7YU.js";
|
|
@@ -1322,6 +1318,70 @@ function deriveExecutionId(input) {
|
|
|
1322
1318
|
return `${input.projectId}:${input.sessionId}:${input.turnIndex}`;
|
|
1323
1319
|
}
|
|
1324
1320
|
|
|
1321
|
+
// src/improvement/profile-diff-proposer.ts
|
|
1322
|
+
import { canonicalJson } from "@tangle-network/agent-eval";
|
|
1323
|
+
import {
|
|
1324
|
+
changedAgentProfileAxes
|
|
1325
|
+
} from "@tangle-network/agent-interface";
|
|
1326
|
+
function profileDiffProposer(options) {
|
|
1327
|
+
return {
|
|
1328
|
+
kind: "agent-profile-diff",
|
|
1329
|
+
async propose(ctx) {
|
|
1330
|
+
if (typeof ctx.currentSurface !== "string") {
|
|
1331
|
+
throw new Error("profileDiffProposer requires a serialized AgentProfile surface");
|
|
1332
|
+
}
|
|
1333
|
+
const profile = parseSerializedProfile(ctx.currentSurface);
|
|
1334
|
+
const proposals = await options.proposeDiffs({
|
|
1335
|
+
...ctx,
|
|
1336
|
+
profile
|
|
1337
|
+
});
|
|
1338
|
+
const candidates = [];
|
|
1339
|
+
const normalizedBaseline = applyExactAgentProfileDiff(
|
|
1340
|
+
profile,
|
|
1341
|
+
{ schemaVersion: 1, kind: "agent-profile-diff" },
|
|
1342
|
+
"profile diff baseline"
|
|
1343
|
+
);
|
|
1344
|
+
const seen = /* @__PURE__ */ new Set([canonicalJson(normalizedBaseline)]);
|
|
1345
|
+
for (const [index, proposal] of proposals.entries()) {
|
|
1346
|
+
if (candidates.length >= ctx.populationSize || ctx.signal.aborted) break;
|
|
1347
|
+
const diff = parseExactAgentProfileDiff(proposal.diff, `profile diff proposal ${index}`);
|
|
1348
|
+
const axes = changedAgentProfileAxes(diff);
|
|
1349
|
+
if (axes.length === 0) continue;
|
|
1350
|
+
const candidate = applyExactAgentProfileDiff(
|
|
1351
|
+
profile,
|
|
1352
|
+
diff,
|
|
1353
|
+
`profile diff candidate ${index}`
|
|
1354
|
+
);
|
|
1355
|
+
const surface = canonicalJson(candidate);
|
|
1356
|
+
if (seen.has(surface)) continue;
|
|
1357
|
+
seen.add(surface);
|
|
1358
|
+
candidates.push({
|
|
1359
|
+
surface,
|
|
1360
|
+
label: proposal.label ?? diff.title ?? diff.id ?? `Change ${axes.join(", ")}`,
|
|
1361
|
+
rationale: candidateRationale(proposal, diff, axes)
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
return candidates;
|
|
1365
|
+
}
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
function candidateRationale(proposal, diff, axes) {
|
|
1369
|
+
const reason = proposal.rationale ?? diff.rationale ?? `Changes profile axes: ${axes.join(", ")}.`;
|
|
1370
|
+
const source = diff.source ? [diff.source.kind, ...diff.source.artifacts ?? []].join(" \xB7 ") : "source unspecified";
|
|
1371
|
+
return `${reason} Source: ${source}. Diff: ${canonicalCandidateDigest(diff)}.`;
|
|
1372
|
+
}
|
|
1373
|
+
function parseSerializedProfile(surface) {
|
|
1374
|
+
let raw;
|
|
1375
|
+
try {
|
|
1376
|
+
raw = JSON.parse(surface);
|
|
1377
|
+
} catch (cause) {
|
|
1378
|
+
throw new Error("profileDiffProposer current surface is not valid AgentProfile JSON", {
|
|
1379
|
+
cause
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
return parseExactAgentProfile(raw, "profileDiffProposer current profile");
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1325
1385
|
// src/improvement/reflective-generator.ts
|
|
1326
1386
|
import { spawnSync } from "child_process";
|
|
1327
1387
|
function reflectiveGenerator(opts) {
|
|
@@ -2437,13 +2497,12 @@ export {
|
|
|
2437
2497
|
NotFoundError,
|
|
2438
2498
|
PlannerError,
|
|
2439
2499
|
RESEARCH_SUPERVISOR_SYSTEM_PROMPT,
|
|
2440
|
-
ROLLOUT_POLICY_BOUNDS,
|
|
2441
|
-
ROLLOUT_POLICY_EXTENSION,
|
|
2442
2500
|
RuntimeRunStateError,
|
|
2443
2501
|
SqlConversationJournal,
|
|
2444
2502
|
ValidationError,
|
|
2445
2503
|
agenticGenerator,
|
|
2446
|
-
|
|
2504
|
+
applyExactAgentProfileDiff,
|
|
2505
|
+
applyImprovementWinnerToProfile,
|
|
2447
2506
|
applyRunRecordDefaults,
|
|
2448
2507
|
auditLoopRunner,
|
|
2449
2508
|
buildAgentCandidateBundle,
|
|
@@ -2473,7 +2532,6 @@ export {
|
|
|
2473
2532
|
defineRuntimeHooks,
|
|
2474
2533
|
deriveExecutionId,
|
|
2475
2534
|
disposePreparedAgentCandidateExecution,
|
|
2476
|
-
enumerateNeighborPolicies,
|
|
2477
2535
|
executePreparedAgentCandidate,
|
|
2478
2536
|
exportEvalRuns,
|
|
2479
2537
|
formatSupervisedKnowledgeTask,
|
|
@@ -2490,13 +2548,14 @@ export {
|
|
|
2490
2548
|
mcpServeVerifier,
|
|
2491
2549
|
mcpToolsForRuntimeMcp,
|
|
2492
2550
|
mcpToolsForRuntimeMcpSubset,
|
|
2493
|
-
normalizeRolloutPolicy,
|
|
2494
2551
|
notifyRuntimeDecisionPoint,
|
|
2495
2552
|
notifyRuntimeHookEvent,
|
|
2553
|
+
parseExactAgentProfile,
|
|
2554
|
+
parseExactAgentProfileDiff,
|
|
2496
2555
|
parseLoopRunnerArgv,
|
|
2497
|
-
parseRolloutPolicy,
|
|
2498
2556
|
persistCandidateOutputArtifact,
|
|
2499
2557
|
prepareAgentCandidateExecution,
|
|
2558
|
+
profileDiffProposer,
|
|
2500
2559
|
rawTraceDistiller,
|
|
2501
2560
|
readDepth,
|
|
2502
2561
|
readinessServerSentEvent,
|
|
@@ -2506,7 +2565,6 @@ export {
|
|
|
2506
2565
|
resolveAgentBackend,
|
|
2507
2566
|
resolveChatModel,
|
|
2508
2567
|
resolveRouterBaseUrl,
|
|
2509
|
-
rolloutPolicyProposer,
|
|
2510
2568
|
runAgentTask,
|
|
2511
2569
|
runAgentTaskStream,
|
|
2512
2570
|
runConversation,
|
|
@@ -2524,12 +2582,10 @@ export {
|
|
|
2524
2582
|
sanitizeRuntimeStreamEvent,
|
|
2525
2583
|
sealAgentCandidateBundle,
|
|
2526
2584
|
selfImproveLoopRunner,
|
|
2527
|
-
serializeRolloutPolicy,
|
|
2528
2585
|
sleep,
|
|
2529
2586
|
slugifySpeaker,
|
|
2530
2587
|
startRuntimeRun,
|
|
2531
2588
|
streamToolLoop,
|
|
2532
|
-
structuralRolloutPolicyFromProfile,
|
|
2533
2589
|
toolBuildPrompt,
|
|
2534
2590
|
turnId,
|
|
2535
2591
|
validateChatModelId,
|