@tangle-network/agent-runtime 0.126.0 → 0.131.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 +70 -20
- package/dist/{activation-DhWJ3p8N.js → activation-BCzMOTaV.js} +3 -3
- package/dist/{activation-DhWJ3p8N.js.map → activation-BCzMOTaV.js.map} +1 -1
- package/dist/agent.d.ts +2 -3
- package/dist/agent.js +4 -5
- package/dist/agent.js.map +1 -1
- package/dist/{analyst-loop-DvSciOfB.js → analyst-loop-BE8cDs5Q.js} +2 -2
- package/dist/{analyst-loop-DvSciOfB.js.map → analyst-loop-BE8cDs5Q.js.map} +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/analyst-loop.js +1 -1
- package/dist/authoring-CvHwo1oW.js +163 -0
- package/dist/authoring-CvHwo1oW.js.map +1 -0
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{candidate-execution-BFpq-Xi6.js → candidate-execution-BNxKr-Bu.js} +5 -5
- package/dist/{candidate-execution-BFpq-Xi6.js.map → candidate-execution-BNxKr-Bu.js.map} +1 -1
- package/dist/{conversation-BpLQZGPH.js → conversation-DNtxaJ1Z.js} +113 -31
- package/dist/conversation-DNtxaJ1Z.js.map +1 -0
- package/dist/conversation.d.ts +2 -2
- package/dist/conversation.js +2 -2
- package/dist/environment-provider-CxvSd1W6.d.ts +86 -0
- package/dist/{environment-provider-DqFS6FSZ.js → environment-provider-Dyg8DtLK.js} +8 -4
- package/dist/environment-provider-Dyg8DtLK.js.map +1 -0
- package/dist/environment-provider.d.ts +1 -1
- package/dist/environment-provider.js +1 -1
- package/dist/graph-BJTxGOFB.js +471 -0
- package/dist/graph-BJTxGOFB.js.map +1 -0
- package/dist/{improvement-cycle-IJgCbKWQ.js → improvement-cycle-Csp38cWg.js} +133 -224
- package/dist/improvement-cycle-Csp38cWg.js.map +1 -0
- package/dist/{index-EdjCQBV9.d.ts → index-CoO7atyo.d.ts} +640 -1184
- package/dist/{index-DIV33AF5.d.ts → index-DwGtu9nc.d.ts} +7 -9
- package/dist/{index-Efjb3nrQ.d.ts → index-qYHpsmG2.d.ts} +36 -18
- package/dist/index.d.ts +353 -11
- package/dist/index.js +111 -354
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +6 -6
- package/dist/intelligence.js +9 -8
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +7 -5
- package/dist/kernel.js +13 -9
- package/dist/{knowledge-EnuEqm_Y.js → knowledge-ce0_uKCl.js} +19 -17
- package/dist/knowledge-ce0_uKCl.js.map +1 -0
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-Bo29_fiD.d.ts → loop-runner-bin-BwgZ8m_7.d.ts} +6 -3
- package/dist/{loop-runner-bin-qwT_4F5I.js → loop-runner-bin-DSbuDDqM.js} +5 -27
- package/dist/loop-runner-bin-DSbuDDqM.js.map +1 -0
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/materialization-COJ1UYQ-.js +272 -0
- package/dist/materialization-COJ1UYQ-.js.map +1 -0
- package/dist/mcp/bin.js +39 -47
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +24 -30
- package/dist/mcp/index.js +66 -83
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-bin.js +1 -1
- package/dist/{memory-server-DL6cE2Ag.js → memory-server-5HEJH672.js} +2 -2
- package/dist/{memory-server-DL6cE2Ag.js.map → memory-server-5HEJH672.js.map} +1 -1
- package/dist/model-policy-CqziaqS1.js +232 -0
- package/dist/model-policy-CqziaqS1.js.map +1 -0
- package/dist/{openai-tools-B68JaOCx.d.ts → openai-tools-D3oMyVGl.d.ts} +2 -2
- package/dist/{openai-tools-Bp1KSkP6.js → openai-tools-ru75mLjq.js} +2 -2
- package/dist/openai-tools-ru75mLjq.js.map +1 -0
- package/dist/{prepare--8EvLqCr.js → prepare-DYWjVcPx.js} +169 -153
- package/dist/prepare-DYWjVcPx.js.map +1 -0
- package/dist/primeintellect/index.d.ts +7 -6
- package/dist/primeintellect/index.js +9 -11
- package/dist/primeintellect/index.js.map +1 -1
- package/dist/profiles.d.ts +21 -174
- package/dist/profiles.js +67 -276
- package/dist/profiles.js.map +1 -1
- package/dist/{protected-model-port-CXVfOUu_.js → protected-model-port-48ALLGxT.js} +2 -2
- package/dist/{protected-model-port-CXVfOUu_.js.map → protected-model-port-48ALLGxT.js.map} +1 -1
- package/dist/{redact-PQzmE1Jn.d.ts → redact-9_Gf-8m3.d.ts} +58 -69
- package/dist/{researcher-CoVqNhfI.js → researcher-Skz5-Uc8.js} +50 -26
- package/dist/researcher-Skz5-Uc8.js.map +1 -0
- package/dist/{run-layout-C2FGmZ3v.js → run-layout-CeJsEAom.js} +2 -2
- package/dist/{run-layout-C2FGmZ3v.js.map → run-layout-CeJsEAom.js.map} +1 -1
- package/dist/runtime-D-QfLbSd.d.ts +893 -0
- package/dist/{runtime-BzXz7OjS.js → runtime-hiAABiTk.js} +329 -854
- package/dist/runtime-hiAABiTk.js.map +1 -0
- package/dist/{sandbox-events-Yhd1GYWl.js → sandbox-events-CRDwc5WN.js} +42 -5
- package/dist/sandbox-events-CRDwc5WN.js.map +1 -0
- package/dist/snapshot-CXiiuHhL.js +21 -0
- package/dist/snapshot-CXiiuHhL.js.map +1 -0
- package/dist/{spawn-journal-DsZKDqeh.js → spawn-journal-saHQzqYi.js} +15 -21
- package/dist/spawn-journal-saHQzqYi.js.map +1 -0
- package/dist/stream-agent-turn-C852AgMT.d.ts +128 -0
- package/dist/stream-agent-turn-rYgaOLO0.js +910 -0
- package/dist/stream-agent-turn-rYgaOLO0.js.map +1 -0
- package/dist/{structural-rollout-zY0oqQzO.js → structural-rollout-3uxVGcg2.js} +459 -235
- package/dist/structural-rollout-3uxVGcg2.js.map +1 -0
- package/dist/{supervise-Ds8FtyI9.js → supervise-iPN27pO0.js} +932 -4771
- package/dist/supervise-iPN27pO0.js.map +1 -0
- package/dist/{supervisor-DpjO0Gmy.js → supervisor-CV6Jh28D.js} +7439 -2897
- package/dist/supervisor-CV6Jh28D.js.map +1 -0
- package/dist/testing.d.ts +3 -1
- package/dist/testing.js +271 -221
- package/dist/testing.js.map +1 -1
- package/dist/{top-app-5unxqovu.js → top-app-G4M18b6i.js} +3 -3
- package/dist/{top-app-5unxqovu.js.map → top-app-G4M18b6i.js.map} +1 -1
- package/dist/tui/bin.js +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{environment-provider-PM9PeW_J.d.ts → types-C6Q-J0Dt.d.ts} +57 -114
- package/dist/{types-DnNGJ5Gz.d.ts → types-ebIY0dMG.d.ts} +556 -30
- package/dist/{util-MVgdwuIS.js → util-Bw6srryQ.js} +3 -2
- package/dist/{util-MVgdwuIS.js.map → util-Bw6srryQ.js.map} +1 -1
- package/dist/{workspace-archive-BQxvkypI.js → workspace-archive-aOfJ47ms.js} +3 -3
- package/dist/{workspace-archive-BQxvkypI.js.map → workspace-archive-aOfJ47ms.js.map} +1 -1
- package/package.json +12 -15
- package/skills/agent-graphs/IMPROVE.md +58 -0
- package/skills/agent-graphs/SKILL.md +139 -0
- package/skills/agent-graphs/cases/artifact-mission-release-notes.json +10 -0
- package/skills/agent-graphs/cases/audited-single-writer.json +9 -0
- package/skills/agent-graphs/cases/cap-as-stop-mistake.json +8 -0
- package/skills/agent-graphs/cases/mission-in-deliverable.json +8 -0
- package/skills/agent-graphs/cases/review-pipeline.json +13 -0
- package/skills/agent-graphs/cases/runtime-discovered-fanout.json +8 -0
- package/skills/agent-graphs/cases/single-agent-suffices.json +7 -0
- package/skills/agent-graphs/cases/steer-heavy-drafting.json +9 -0
- package/skills/agent-graphs/cases/unmeasured-harness.json +7 -0
- package/skills/agent-graphs/generations/gen1-baseline.json +248 -0
- package/skills/agent-graphs/generations/gen2.json +375 -0
- package/skills/agent-graphs/generations/gen3.json +702 -0
- package/skills/build-with-agent-runtime/SKILL.md +1 -0
- package/dist/backends-CiOCyRHb.js +0 -743
- package/dist/backends-CiOCyRHb.js.map +0 -1
- package/dist/conversation-BpLQZGPH.js.map +0 -1
- package/dist/environment-provider-DqFS6FSZ.js.map +0 -1
- package/dist/improvement-cycle-IJgCbKWQ.js.map +0 -1
- package/dist/index-D_M4d1_B.d.ts +0 -545
- package/dist/knowledge-EnuEqm_Y.js.map +0 -1
- package/dist/local-harness-BIajef4A.d.ts +0 -465
- package/dist/loop-runner-bin-qwT_4F5I.js.map +0 -1
- package/dist/model-resolution-Btd9iIKV.js +0 -98
- package/dist/model-resolution-Btd9iIKV.js.map +0 -1
- package/dist/openai-tools-Bp1KSkP6.js.map +0 -1
- package/dist/prepare--8EvLqCr.js.map +0 -1
- package/dist/researcher-CoVqNhfI.js.map +0 -1
- package/dist/runtime-BzXz7OjS.js.map +0 -1
- package/dist/sandbox-events-Yhd1GYWl.js.map +0 -1
- package/dist/spawn-journal-DsZKDqeh.js.map +0 -1
- package/dist/structural-rollout-zY0oqQzO.js.map +0 -1
- package/dist/supervise-Ds8FtyI9.js.map +0 -1
- package/dist/supervisor-DpjO0Gmy.js.map +0 -1
- package/dist/types-C9j4qg6l.d.ts +0 -500
package/dist/index-D_M4d1_B.d.ts
DELETED
|
@@ -1,545 +0,0 @@
|
|
|
1
|
-
import { _ as RunAgentTaskOptions, b as RuntimeSessionStore, g as OpenAIChatToolChoice, h as OpenAIChatTool, i as AgentExecutionBackend, l as AgentTaskRunResult, m as OpenAIChatResponseFormat, n as AgentBackendContext, p as KnowledgeReadinessDecision, r as AgentBackendInput, v as RunAgentTaskStreamOptions, x as RuntimeStreamEvent, y as RuntimeSession } from "./types-C9j4qg6l.js";
|
|
2
|
-
import { i as SurfaceImprovementEdit } from "./improvement-adapter-D5gwwoXQ.js";
|
|
3
|
-
import { o as ImprovementProposalSource } from "./types-zWfqDjeL.js";
|
|
4
|
-
import { tf as ConfigError, zr as StructuralRolloutPolicy } from "./index-EdjCQBV9.js";
|
|
5
|
-
import "./types-DnNGJ5Gz.js";
|
|
6
|
-
import { hn as RuntimeTelemetryOptions } from "./environment-provider-PM9PeW_J.js";
|
|
7
|
-
import { f as runLocalHarness, o as LocalHarness, w as ToolLoopChat } from "./local-harness-BIajef4A.js";
|
|
8
|
-
import "./index-B3bHsVLw.js";
|
|
9
|
-
import "./index-Efjb3nrQ.js";
|
|
10
|
-
import { H as CandidateGenerator, L as Verifier, a as ImproveCandidateValidationInput, j as ReadonlyAgentProfile, p as ImproveMethodFactory, t as Redactor } from "./redact-PQzmE1Jn.js";
|
|
11
|
-
import "./index-DIV33AF5.js";
|
|
12
|
-
import "./loop-runner-bin-Bo29_fiD.js";
|
|
13
|
-
import "./openai-tools-B68JaOCx.js";
|
|
14
|
-
import { ControlBudget as ControlBudget$1, ControlDecision as ControlDecision$1, ControlEvalResult, ControlEvalResult as ControlEvalResult$1, ControlRunResult as ControlRunResult$1, ControlStep as ControlStep$1, DataAcquisitionPlan as DataAcquisitionPlan$1, KnowledgeReadinessReport, KnowledgeReadinessReport as KnowledgeReadinessReport$1, KnowledgeRequirement as KnowledgeRequirement$1, ProposalFinding, RunRecord, RunRecord as RunRecord$1 } from "@tangle-network/agent-eval";
|
|
15
|
-
import { GepaOptimizationMethodConfig, SkillOptOptimizationMethodConfig } from "@tangle-network/agent-eval/campaign";
|
|
16
|
-
import { AgentProfile as AgentProfile$1 } from "@tangle-network/agent-interface";
|
|
17
|
-
import { MutableSurface, Scenario as Scenario$1, SelfImproveOptions } from "@tangle-network/agent-eval/contract";
|
|
18
|
-
//#region src/backends.d.ts
|
|
19
|
-
/** Wrap any custom async-iterable stream into a typed `AgentExecutionBackend`. @stable */
|
|
20
|
-
declare function createIterableBackend<TInput extends AgentBackendInput>(options: {
|
|
21
|
-
kind: string;
|
|
22
|
-
start?: AgentExecutionBackend<TInput>['start'];
|
|
23
|
-
resume?: AgentExecutionBackend<TInput>['resume'];
|
|
24
|
-
stream: AgentExecutionBackend<TInput>['stream'];
|
|
25
|
-
stop?: AgentExecutionBackend<TInput>['stop'];
|
|
26
|
-
}): AgentExecutionBackend<TInput>;
|
|
27
|
-
/** Build an `AgentExecutionBackend` backed by a sandbox/sidecar `streamPrompt` call. @stable */
|
|
28
|
-
declare function createSandboxPromptBackend<TBox, TInput extends AgentBackendInput = AgentBackendInput>(options: {
|
|
29
|
-
kind?: string;
|
|
30
|
-
getBox(input: TInput, context: Omit<AgentBackendContext, 'session'>): Promise<TBox> | TBox;
|
|
31
|
-
streamPrompt(box: TBox, message: string, context: AgentBackendContext): AsyncIterable<unknown>;
|
|
32
|
-
mapEvent?: (event: unknown, context: AgentBackendContext) => RuntimeStreamEvent | undefined;
|
|
33
|
-
getSessionId?: (box: TBox, input: TInput) => string | undefined;
|
|
34
|
-
}): AgentExecutionBackend<TInput>;
|
|
35
|
-
/** @stable */
|
|
36
|
-
/**
|
|
37
|
-
* Retry policy for transient transport errors (rate limits, upstream
|
|
38
|
-
* timeouts). Defaults to 5 attempts with exponential backoff starting at
|
|
39
|
-
* 1s, ±25% jitter, capped at 30s. Set `maxAttempts: 1` to disable retries.
|
|
40
|
-
*
|
|
41
|
-
* Retried status codes:
|
|
42
|
-
* - 408 Request Timeout
|
|
43
|
-
* - 425 Too Early
|
|
44
|
-
* - 429 Too Many Requests
|
|
45
|
-
* - 500 / 502 / 503 / 504 — upstream transient failures
|
|
46
|
-
*
|
|
47
|
-
* Hard failures (401, 403, 4xx other than the above) propagate immediately.
|
|
48
|
-
*/
|
|
49
|
-
interface BackendRetryPolicy {
|
|
50
|
-
/** Total attempts including the first try. Default 5. */
|
|
51
|
-
maxAttempts?: number;
|
|
52
|
-
/** Initial backoff in ms before the second attempt. Default 1000. */
|
|
53
|
-
initialBackoffMs?: number;
|
|
54
|
-
/** Hard ceiling on backoff in ms. Default 30000. */
|
|
55
|
-
maxBackoffMs?: number;
|
|
56
|
-
/** Jitter fraction in [0, 1]. Default 0.25 (±25%). */
|
|
57
|
-
jitter?: number;
|
|
58
|
-
/** Status codes that trigger a retry. Default: 408, 425, 429, 500, 502, 503, 504. */
|
|
59
|
-
retryStatuses?: ReadonlyArray<number>;
|
|
60
|
-
/**
|
|
61
|
-
* Per-attempt wall-clock deadline in ms. If a single fetch attempt does
|
|
62
|
-
* not return headers within this window the attempt is aborted and
|
|
63
|
-
* retried. Default 120000 (2 min). Without this a hung upstream blocks
|
|
64
|
-
* the attempt indefinitely — observed in production as a 15-minute
|
|
65
|
-
* `fetch failed` that burned an entire eval persona. Set to 0 to disable.
|
|
66
|
-
*/
|
|
67
|
-
requestTimeoutMs?: number;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
* OpenAI-compat streaming backend. Routes `runAgentTaskStream` through any
|
|
72
|
-
* `POST /chat/completions` endpoint that speaks OpenAI's SSE protocol —
|
|
73
|
-
* Tangle Router, OpenAI direct, OpenRouter, Groq, DeepSeek, Together. The
|
|
74
|
-
* router also fronts Anthropic models in Anthropic-native SSE shape; this
|
|
75
|
-
* backend handles both.
|
|
76
|
-
*
|
|
77
|
-
* ### Tool calls
|
|
78
|
-
*
|
|
79
|
-
* Pass `tools` (and optionally `toolChoice`) to forward an OpenAI Chat
|
|
80
|
-
* Completions `tools[]` array on every request. Streamed `tool_call` chunks
|
|
81
|
-
* are buffered until the model finalizes them (either `finish_reason:
|
|
82
|
-
* 'tool_calls'` for OpenAI shape or a `content_block_stop` for Anthropic
|
|
83
|
-
* `tool_use` blocks proxied through the router), then emitted as a single
|
|
84
|
-
* `tool_call` RuntimeStreamEvent with the assembled `args`.
|
|
85
|
-
*
|
|
86
|
-
* The backend does NOT execute tools — it surfaces calls for the caller's
|
|
87
|
-
* own dispatcher (typically the product's MCP / sandbox runtime) to fulfill
|
|
88
|
-
* and feed back as a subsequent `messages` turn. This keeps the transport
|
|
89
|
-
* thin and lets the agent host own tool dispatch policy.
|
|
90
|
-
*
|
|
91
|
-
* ### Fail-loud errors
|
|
92
|
-
*
|
|
93
|
-
* Non-success HTTP responses (4xx/5xx) and exhausted retry budgets throw
|
|
94
|
-
* `BackendTransportError` from inside the `stream()` generator. The runtime
|
|
95
|
-
* catches the throw, yields a `backend_error` with a typed `error` field
|
|
96
|
-
* (`kind`, `status`, truncated `body`) and a terminal `final` event with
|
|
97
|
-
* `status: 'failed'` carrying the same detail. Consumers MUST map
|
|
98
|
-
* `final.error` onto their `RunRecord.error` — silently treating an empty
|
|
99
|
-
* `finalText` as "agent produced nothing" hides credit exhaustion, auth
|
|
100
|
-
* failure, and upstream outages.
|
|
101
|
-
*
|
|
102
|
-
* @stable
|
|
103
|
-
*/
|
|
104
|
-
declare function createOpenAICompatibleBackend<TInput extends AgentBackendInput = AgentBackendInput>(options: {
|
|
105
|
-
apiKey: string;
|
|
106
|
-
baseUrl: string;
|
|
107
|
-
model: string;
|
|
108
|
-
kind?: string;
|
|
109
|
-
/**
|
|
110
|
-
* OpenAI Chat Completions `tools[]` definitions surfaced to the model on
|
|
111
|
-
* every request. Omit to send a tool-free request (existing behavior).
|
|
112
|
-
* The runtime makes no assumption about the dispatcher — calls stream out
|
|
113
|
-
* as `tool_call` events and the caller is responsible for executing them
|
|
114
|
-
* and feeding `tool_result` messages back on a follow-up turn.
|
|
115
|
-
*/
|
|
116
|
-
tools?: ReadonlyArray<OpenAIChatTool>;
|
|
117
|
-
/**
|
|
118
|
-
* OpenAI Chat Completions `tool_choice`. Default `undefined` (request
|
|
119
|
-
* omits the field; provider falls back to its own default — typically
|
|
120
|
-
* `'auto'`).
|
|
121
|
-
*/
|
|
122
|
-
toolChoice?: OpenAIChatToolChoice;
|
|
123
|
-
/**
|
|
124
|
-
* OpenAI Chat Completions `response_format`. Omit for provider default text.
|
|
125
|
-
*/
|
|
126
|
-
responseFormat?: OpenAIChatResponseFormat;
|
|
127
|
-
/** OpenAI Chat Completions `temperature`. Omit for provider default. */
|
|
128
|
-
temperature?: number;
|
|
129
|
-
/** Maximum completion tokens, sent as OpenAI-compatible `max_tokens`. Omit for provider default. */
|
|
130
|
-
maxTokens?: number;
|
|
131
|
-
fetchImpl?: typeof fetch;
|
|
132
|
-
retry?: BackendRetryPolicy;
|
|
133
|
-
}): AgentExecutionBackend<TInput>;
|
|
134
|
-
//#endregion
|
|
135
|
-
//#region src/improvement/build-prompts.d.ts
|
|
136
|
-
/** Evidence supplied to a generated tool or MCP build instruction. */
|
|
137
|
-
interface BuildPromptFindingsInput {
|
|
138
|
-
findings: ReadonlyArray<ProposalFinding>;
|
|
139
|
-
}
|
|
140
|
-
/** Render findings as the ranked-evidence block every build prompt ends with. */
|
|
141
|
-
declare function findingLines(findings: ReadonlyArray<ProposalFinding>): string[];
|
|
142
|
-
/** Build the starting instruction for a coder agent tasked with implementing a new tool. */
|
|
143
|
-
declare function toolBuildPrompt(args: BuildPromptFindingsInput): string;
|
|
144
|
-
/** Build the starting instruction for a coder agent tasked with implementing a new MCP server. */
|
|
145
|
-
declare function mcpBuildPrompt(args: BuildPromptFindingsInput): string;
|
|
146
|
-
//#endregion
|
|
147
|
-
//#region src/improvement/driver-loop-generator.d.ts
|
|
148
|
-
interface DriverLoopGeneratorOptions {
|
|
149
|
-
/** The driver-LLM seam — ONE inference turn over the conversation + tool specs (the canonical
|
|
150
|
-
* `ToolLoopChat`, same seam as `driverAgent`): `routerBrain(cfg)` in production, a scripted
|
|
151
|
-
* mock in tests. */
|
|
152
|
-
brain: ToolLoopChat;
|
|
153
|
-
/** Local coding harness the driver's worker sessions run in the worktree. Default `claude-code`. */
|
|
154
|
-
harness?: LocalHarness;
|
|
155
|
-
/** Per-worker-session wall-clock timeout (ms). Default = `runLocalHarness` default (5m). */
|
|
156
|
-
timeoutMs?: number;
|
|
157
|
-
/** Build the driver's task briefing (domain framing + method + findings) — the same senior
|
|
158
|
-
* prompt the worker path uses (`toolBuildPrompt` / `mcpBuildPrompt`). The driver reads it and
|
|
159
|
-
* folds what each worker needs into its instruction. Default `defaultBuildPrompt`. */
|
|
160
|
-
buildPrompt?: (args: {
|
|
161
|
-
findings: ReadonlyArray<ProposalFinding>;
|
|
162
|
-
}) => string;
|
|
163
|
-
/** Verify the worktree (the intrinsic check). Exposed to the driver as `run_verifier` AND
|
|
164
|
-
* re-run by code as the final keep/discard gate. Omitted ⇒ the final gate is dirty-tree only
|
|
165
|
-
* (legacy `agenticGenerator` behavior sans verifier). */
|
|
166
|
-
verify?: Verifier;
|
|
167
|
-
/** Max driver inference turns. Default `max(8, 2 + maxShots * 3)` — room for one
|
|
168
|
-
* observe/rate/decide cycle per worker session plus orientation. */
|
|
169
|
-
maxTurns?: number;
|
|
170
|
-
/** The research seam (adopt-not-build): when set, the driver gets a
|
|
171
|
-
* `research{query}` tool + the `researchDriverNote` doctrine, so it can
|
|
172
|
-
* discover an EXISTING external MCP instead of building one. Wire a real
|
|
173
|
-
* web/search backend here — none is provisioned by default (the build
|
|
174
|
-
* harness has no live web access yet; flagged). */
|
|
175
|
-
research?: (query: string) => Promise<string>;
|
|
176
|
-
/** Test seam — inject the harness runner (defaults to `runLocalHarness`). */
|
|
177
|
-
runHarness?: typeof runLocalHarness;
|
|
178
|
-
/** Test seam — inject the worktree diff reader (defaults to `git diff` in the worktree). */
|
|
179
|
-
readDiff?: (worktreePath: string) => string;
|
|
180
|
-
/** Test seam — inject the changed-paths reader (defaults to `git status --porcelain`). */
|
|
181
|
-
changedPaths?: (worktreePath: string) => string[];
|
|
182
|
-
}
|
|
183
|
-
/** Driver→worker `CandidateGenerator`: an LLM driver on the canonical tool-loop authors, observes, rates, and steers coding-harness sessions in the worktree until the verifier passes or the session budget is spent. */
|
|
184
|
-
declare function driverLoopGenerator(opts: DriverLoopGeneratorOptions): CandidateGenerator;
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/improvement/mcp-serve-verifier.d.ts
|
|
187
|
-
interface McpServeSpec {
|
|
188
|
-
/** Command that starts the built MCP server in the worktree (stdio transport). */
|
|
189
|
-
command: string;
|
|
190
|
-
args?: string[];
|
|
191
|
-
/** Extra env for the server process (merged over `process.env`). */
|
|
192
|
-
env?: Record<string, string>;
|
|
193
|
-
/** Handshake timeout (ms). Default 30s. */
|
|
194
|
-
timeoutMs?: number;
|
|
195
|
-
/** Minimum tools the server must expose to pass. Default 1. */
|
|
196
|
-
minTools?: number;
|
|
197
|
-
}
|
|
198
|
-
/** Build a `Verifier` that boots a generated MCP server over stdio and checks it exposes tools. */
|
|
199
|
-
declare function mcpServeVerifier(spec: McpServeSpec): Verifier;
|
|
200
|
-
//#endregion
|
|
201
|
-
//#region src/improvement/official-optimizers.d.ts
|
|
202
|
-
/** Runtime context appended to an official optimizer's own configuration. */
|
|
203
|
-
interface OfficialOptimizerContextOptions {
|
|
204
|
-
/** Context supplied to the optimizer before Runtime appends the profile surface and findings. */
|
|
205
|
-
background?: string;
|
|
206
|
-
/** Include current trace or analyst findings in the optimizer background. Default true. */
|
|
207
|
-
includeFindings?: boolean;
|
|
208
|
-
/** Reject oversized serialized findings before starting Python. Default 50,000 characters. */
|
|
209
|
-
maxFindingsChars?: number;
|
|
210
|
-
/**
|
|
211
|
-
* Redact caller-supplied context and descriptors before they leave Runtime.
|
|
212
|
-
* The built-in redactor is the default. Pass `false` only for public data
|
|
213
|
-
* that has already been reviewed.
|
|
214
|
-
*/
|
|
215
|
-
redact?: Redactor | false;
|
|
216
|
-
/** Authorize one exact candidate containing structurally sensitive fields.
|
|
217
|
-
* The callback must return true for every accepted baseline and candidate. */
|
|
218
|
-
authorizeSensitiveCandidate?: (input: OfficialSensitiveCandidateInput) => boolean;
|
|
219
|
-
}
|
|
220
|
-
interface OfficialSensitiveCandidateInput extends ImproveCandidateValidationInput {
|
|
221
|
-
sensitivePaths: readonly string[];
|
|
222
|
-
}
|
|
223
|
-
/** Official GEPA configuration plus bounded Runtime findings context. */
|
|
224
|
-
type OfficialGepaOptions<TScenario extends {
|
|
225
|
-
id: string;
|
|
226
|
-
kind: string;
|
|
227
|
-
}, TArtifact = unknown> = Omit<GepaOptimizationMethodConfig<TScenario, TArtifact>, 'background' | 'evaluationId'> & OfficialOptimizerContextOptions;
|
|
228
|
-
/** Official SkillOpt configuration plus bounded Runtime findings context. */
|
|
229
|
-
type OfficialSkillOptOptions<TScenario extends {
|
|
230
|
-
id: string;
|
|
231
|
-
kind: string;
|
|
232
|
-
}, TArtifact = unknown> = Omit<SkillOptOptimizationMethodConfig<TScenario, TArtifact>, 'background' | 'evaluationId'> & OfficialOptimizerContextOptions;
|
|
233
|
-
/** Missing optional Python dependencies for an official optimizer. */
|
|
234
|
-
declare class OfficialOptimizerUnavailableError extends ConfigError {
|
|
235
|
-
readonly optimizer: 'gepa' | 'skillopt';
|
|
236
|
-
constructor(optimizer: 'gepa' | 'skillopt', cause: unknown);
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Build a complete method backed by GEPA's official Optimize Anything API.
|
|
240
|
-
*
|
|
241
|
-
* The recipe is passed through unchanged. Use `engine`, `sequential`,
|
|
242
|
-
* `adaptive-sequential`, `best-of`, `vote`, or `omni` explicitly.
|
|
243
|
-
*/
|
|
244
|
-
declare function officialGepa<TScenario extends {
|
|
245
|
-
id: string;
|
|
246
|
-
kind: string;
|
|
247
|
-
}, TArtifact = unknown>(options: OfficialGepaOptions<TScenario, TArtifact>): ImproveMethodFactory<TScenario, TArtifact>;
|
|
248
|
-
/** Build a complete method backed by Microsoft's official SkillOpt trainer. */
|
|
249
|
-
declare function officialSkillOpt<TScenario extends {
|
|
250
|
-
id: string;
|
|
251
|
-
kind: string;
|
|
252
|
-
}, TArtifact = unknown>(options: OfficialSkillOptOptions<TScenario, TArtifact>): ImproveMethodFactory<TScenario, TArtifact>;
|
|
253
|
-
//#endregion
|
|
254
|
-
//#region src/improvement/optimizer-prompt.d.ts
|
|
255
|
-
/**
|
|
256
|
-
* The senior scientific-method optimizer doctrine — the ONE substantial prompt
|
|
257
|
-
* core shared by every builder/author surface (tool build, MCP build, codebase
|
|
258
|
-
* improvement, strategy authoring) and by the driver that steers build workers
|
|
259
|
-
* (`driverLoopGenerator`).
|
|
260
|
-
*
|
|
261
|
-
* Seeded from the proven senior prompts rather than invented: GEPA's
|
|
262
|
-
* `REFLECTION_SYSTEM` (localize → diagnose → minimal generalizable fix →
|
|
263
|
-
* preserve what works), the /evolve loop (one hypothesis with a mechanism and a
|
|
264
|
-
* falsifiable prediction; attack the largest measured gap first), /pursue (one
|
|
265
|
-
* coherent change set, no partial scaffolding), and the self-improving-loop /
|
|
266
|
-
* supervisor doctrine (a keep is decided by a real check, never by the author;
|
|
267
|
-
* observe → rate → decide). Generalized from "mutate a prompt string" to
|
|
268
|
-
* "build a code surface a held-out measurement will grade".
|
|
269
|
-
*/
|
|
270
|
-
/**
|
|
271
|
-
* The shared method block every build/author prompt embeds. Domain framing
|
|
272
|
-
* (what a tool/MCP/codebase-edit deliverable looks like) wraps around it; this
|
|
273
|
-
* is the process itself.
|
|
274
|
-
*/
|
|
275
|
-
declare const optimizerMethod: string;
|
|
276
|
-
/**
|
|
277
|
-
* The driver's stance for `driverLoopGenerator` — the build-domain instance of
|
|
278
|
-
* the supervisor doctrine (observe → rate → decide; refine / re-scope /
|
|
279
|
-
* decompose; the check decides delivery, never the driver's prose).
|
|
280
|
-
*/
|
|
281
|
-
declare const buildDriverSystem: string;
|
|
282
|
-
/**
|
|
283
|
-
* The driver's ADOPT-not-build doctrine, appended to `buildDriverSystem` when
|
|
284
|
-
* a `research` tool is wired into the loop (`DriverLoopGeneratorOptions.
|
|
285
|
-
* research`). Kept separate so a driver WITHOUT the tool is never told to
|
|
286
|
-
* call a tool it does not have.
|
|
287
|
-
*/
|
|
288
|
-
declare const researchDriverNote: string;
|
|
289
|
-
/**
|
|
290
|
-
* The senior authoring process for `authorStrategy` — the same method, shaped
|
|
291
|
-
* to the strategy contract (author-blind, conserved budget, one module out).
|
|
292
|
-
*/
|
|
293
|
-
declare const strategyAuthorMethod: string;
|
|
294
|
-
//#endregion
|
|
295
|
-
//#region src/improvement/raw-trace-distiller.d.ts
|
|
296
|
-
interface RawTraceDistillerOptions {
|
|
297
|
-
/** Anchor the emitted paths at this run root instead of the generation `runDir`
|
|
298
|
-
* the loop passes in. Normally unset — each call points at that generation's
|
|
299
|
-
* own directory (`input.runDir`). Pass an absolute path when you construct the
|
|
300
|
-
* producer ahead of the loop and want a fixed anchor (e.g. a test fixture). */
|
|
301
|
-
runDir?: string;
|
|
302
|
-
/** Max candidates to surface trace paths for, worst-scoring first. Default 12. */
|
|
303
|
-
maxCandidates?: number;
|
|
304
|
-
/** Max failing cells to enumerate per candidate before collapsing the rest into
|
|
305
|
-
* an "ls the candidate dir" pointer. Default 8. */
|
|
306
|
-
maxCellsPerCandidate?: number;
|
|
307
|
-
/** Max concrete file paths to list per cell (the agent can always `ls` the dir
|
|
308
|
-
* for the rest). Default 24. */
|
|
309
|
-
maxFilesPerCell?: number;
|
|
310
|
-
/** Findings to fall back to when the generation had NO failing cells, so a
|
|
311
|
-
* clean round never wipes the proposer's steering context. Mirrors the default
|
|
312
|
-
* distiller's static-seed fallback. Default: a single instruction finding. */
|
|
313
|
-
fallbackFindings?: ReadonlyArray<ProposalFinding>;
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Build an `analyzeGeneration` producer that feeds the proposer RAW-TRACE
|
|
317
|
-
* FILESYSTEM CONTEXT — paths into the prior generation's real run traces plus a
|
|
318
|
-
* grep/cat-to-diagnose instruction — instead of a pre-summarized digest.
|
|
319
|
-
*
|
|
320
|
-
* Drop-in for `analyzeGeneration` on `improve({ surface: 'code' })`:
|
|
321
|
-
*
|
|
322
|
-
* await improve({
|
|
323
|
-
* surface: 'code',
|
|
324
|
-
* findings: seedFindings,
|
|
325
|
-
* code: { repoRoot },
|
|
326
|
-
* runDir: '/abs/run', // MUST be a real path — the traces live here
|
|
327
|
-
* analyzeGeneration: rawTraceDistiller(),
|
|
328
|
-
* scenarios, judge, agent,
|
|
329
|
-
* })
|
|
330
|
-
*/
|
|
331
|
-
declare function rawTraceDistiller<TScenario extends Scenario$1 = Scenario$1, TArtifact = unknown>(options?: RawTraceDistillerOptions): NonNullable<SelfImproveOptions<TScenario, TArtifact>['analyzeGeneration']>;
|
|
332
|
-
//#endregion
|
|
333
|
-
//#region src/improvement/reflective-generator.d.ts
|
|
334
|
-
interface ReflectiveGeneratorOptions {
|
|
335
|
-
improvementProposalSource: ImprovementProposalSource<SurfaceImprovementEdit>;
|
|
336
|
-
}
|
|
337
|
-
/** Cheap no-sandbox `CandidateGenerator` (the `shots=1` setting): draft surface edits via the improvement adapter and apply them as one coherent candidate. */
|
|
338
|
-
declare function reflectiveGenerator(opts: ReflectiveGeneratorOptions): CandidateGenerator;
|
|
339
|
-
//#endregion
|
|
340
|
-
//#region src/improvement/rollout-policy.d.ts
|
|
341
|
-
/** The profile extensions namespace the policy persists under. */
|
|
342
|
-
declare const ROLLOUT_POLICY_EXTENSION = "structural-rollout";
|
|
343
|
-
/** Parse a serialized policy surface. Returns `undefined` for non-strings,
|
|
344
|
-
* malformed JSON, or values outside the policy invariants. Unknown fields are
|
|
345
|
-
* dropped; supported optional fields are preserved. */
|
|
346
|
-
declare function parseRolloutPolicy(surface: MutableSurface): StructuralRolloutPolicy | undefined;
|
|
347
|
-
/** Normalize an untyped policy bag (a parsed surface or a profile extension) into
|
|
348
|
-
* a full `StructuralRolloutPolicy`, defaults merged. Returns `undefined` when any
|
|
349
|
-
* present dial violates the policy invariants (mirrors `resolvePolicy`: integer
|
|
350
|
-
* k ≥ 1, repairRounds ≥ 0, testgen ≥ 0) — a corrupt config must read as "not
|
|
351
|
-
* configured", never as a fabricated recipe. */
|
|
352
|
-
declare function normalizeRolloutPolicy(raw: unknown): StructuralRolloutPolicy | undefined;
|
|
353
|
-
/** Stable serialization with fixed field order. */
|
|
354
|
-
declare function serializeRolloutPolicy(policy: StructuralRolloutPolicy): string;
|
|
355
|
-
/** Read the persisted policy off the profile. `undefined` when the profile does
|
|
356
|
-
* not opt into structural rollout. */
|
|
357
|
-
declare function structuralRolloutPolicyFromProfile(profile: ReadonlyAgentProfile): StructuralRolloutPolicy | undefined;
|
|
358
|
-
/** Persist a detached policy under the profile extension without mutating the input. */
|
|
359
|
-
declare function applyRolloutPolicyToProfile(profile: ReadonlyAgentProfile, policy: StructuralRolloutPolicy): AgentProfile$1;
|
|
360
|
-
//#endregion
|
|
361
|
-
//#region src/model-resolution.d.ts
|
|
362
|
-
/**
|
|
363
|
-
*
|
|
364
|
-
* Chat-model resolution + catalog validation — the shared primitive every
|
|
365
|
-
* product chat handler needs and was, until now, hand-rolling. Lifts the
|
|
366
|
-
* router `/v1/models` fetch, the fail-closed id validation, and the
|
|
367
|
-
* precedence resolver out of four near-identical per-repo copies.
|
|
368
|
-
*
|
|
369
|
-
* Policy-free by design: callers pass their own precedence order
|
|
370
|
-
* (`resolveChatModel`) and their own known-good `allowlist`
|
|
371
|
-
* (`validateChatModelId`), so each product keeps its resolution policy while
|
|
372
|
-
* sharing the catalog fetch, the malformed-id guard, and the fail-closed
|
|
373
|
-
* admission rule. No React, no `process.env` assumption — `env` is an
|
|
374
|
-
* explicit narrow record so this runs unchanged in Node and in Workers.
|
|
375
|
-
*
|
|
376
|
-
* @stable
|
|
377
|
-
*/
|
|
378
|
-
/**
|
|
379
|
-
* A model entry as returned by the Tangle Router `/v1/models` endpoint.
|
|
380
|
-
* Intentionally minimal — only the fields resolution + validation read.
|
|
381
|
-
*/
|
|
382
|
-
interface ModelInfo {
|
|
383
|
-
id: string;
|
|
384
|
-
name?: string;
|
|
385
|
-
description?: string;
|
|
386
|
-
/** Provider slug, when the router exposes it (`provider` or `_provider`). */
|
|
387
|
-
provider?: string;
|
|
388
|
-
_provider?: string;
|
|
389
|
-
architecture?: {
|
|
390
|
-
modality?: string;
|
|
391
|
-
input_modalities?: string[];
|
|
392
|
-
output_modalities?: string[];
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
/** Env keys the router base URL is resolved from. */
|
|
396
|
-
interface RouterEnv {
|
|
397
|
-
TANGLE_ROUTER_URL?: string;
|
|
398
|
-
TANGLE_ROUTER_BASE_URL?: string;
|
|
399
|
-
}
|
|
400
|
-
/** Default Tangle Router base URL used when no env override is set. */
|
|
401
|
-
declare const DEFAULT_ROUTER_BASE_URL = "https://router.tangle.tools";
|
|
402
|
-
/** Resolve the router base URL from env, normalised — no trailing `/v1` or `/`. */
|
|
403
|
-
declare function resolveRouterBaseUrl(env?: RouterEnv): string;
|
|
404
|
-
/**
|
|
405
|
-
* Fetch the model catalog from the router's `/v1/models`. Throws on a non-2xx
|
|
406
|
-
* response — callers decide whether to fail open (empty catalog) or closed.
|
|
407
|
-
*/
|
|
408
|
-
declare function getModels(routerBaseUrl?: string): Promise<ModelInfo[]>;
|
|
409
|
-
/** Trim a candidate model id; `undefined` for non-strings and blanks. */
|
|
410
|
-
declare function cleanModelId(value: unknown): string | undefined;
|
|
411
|
-
interface ChatModelCandidate {
|
|
412
|
-
/** Stable label for telemetry — e.g. `request`, `workspace`, `env`. */
|
|
413
|
-
source: string;
|
|
414
|
-
model: string | undefined;
|
|
415
|
-
}
|
|
416
|
-
interface ResolvedChatModel {
|
|
417
|
-
source: string;
|
|
418
|
-
model: string;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Resolve a chat model by precedence: the first candidate carrying a
|
|
422
|
-
* non-blank model wins, else `fallback`. The caller owns the precedence
|
|
423
|
-
* order, so each product keeps its own policy (request → workspace → env,
|
|
424
|
-
* etc.) while the first-non-blank logic and the telemetry shape stay shared.
|
|
425
|
-
*/
|
|
426
|
-
declare function resolveChatModel(candidates: ChatModelCandidate[], fallback: ResolvedChatModel): ResolvedChatModel;
|
|
427
|
-
type ChatModelValidation = {
|
|
428
|
-
succeeded: true;
|
|
429
|
-
value: string;
|
|
430
|
-
} | {
|
|
431
|
-
succeeded: false;
|
|
432
|
-
error: string;
|
|
433
|
-
};
|
|
434
|
-
/**
|
|
435
|
-
* Validate a caller-supplied chat-model id. Rejects non-strings, malformed
|
|
436
|
-
* ids, and ids absent from both the caller's `allowlist` and the live router
|
|
437
|
-
* catalog. Fails closed: when the catalog cannot be fetched, an unverifiable
|
|
438
|
-
* id is rejected rather than admitted — a bad model never reaches the agent.
|
|
439
|
-
*/
|
|
440
|
-
declare function validateChatModelId(modelId: unknown, options?: {
|
|
441
|
-
/**
|
|
442
|
-
* Known-good ids that skip the catalog round trip — e.g. the product's
|
|
443
|
-
* default model plus any env-configured ids.
|
|
444
|
-
*/
|
|
445
|
-
allowlist?: string[];
|
|
446
|
-
routerBaseUrl?: string;
|
|
447
|
-
/** Injectable catalog loader — overridden in tests. */
|
|
448
|
-
loadModels?: (routerBaseUrl: string) => Promise<ModelInfo[]>;
|
|
449
|
-
}): Promise<ChatModelValidation>;
|
|
450
|
-
//#endregion
|
|
451
|
-
//#region src/readiness.d.ts
|
|
452
|
-
/**
|
|
453
|
-
* Map a `KnowledgeReadinessReport` to a three-state branch (`ready` / `blocked` / `caveat`) the runtime, route handlers, and UI shells all switch on.
|
|
454
|
-
*
|
|
455
|
-
* @stable
|
|
456
|
-
*/
|
|
457
|
-
declare function decideKnowledgeReadiness(report: KnowledgeReadinessReport, options?: {
|
|
458
|
-
minimumScore?: number;
|
|
459
|
-
}): KnowledgeReadinessDecision;
|
|
460
|
-
//#endregion
|
|
461
|
-
//#region src/resolve-agent-backend.d.ts
|
|
462
|
-
/** The transport a chat backend runs on. */
|
|
463
|
-
type AgentBackendKind = 'router' | 'tcloud' | 'cli-bridge' | 'sandbox';
|
|
464
|
-
/**
|
|
465
|
-
* OpenAI-compat passthrough forwarded to `createOpenAICompatibleBackend` for
|
|
466
|
-
* the `router` / `tcloud` / `cli-bridge` kinds. Mirrors that factory's optional
|
|
467
|
-
* inputs so a product keeps its tool advertising / capture-fetch without
|
|
468
|
-
* re-implementing the backend branch.
|
|
469
|
-
*/
|
|
470
|
-
type OpenAICompatPassthrough = Pick<Parameters<typeof createOpenAICompatibleBackend>[0], 'tools' | 'toolChoice' | 'responseFormat' | 'temperature' | 'maxTokens' | 'fetchImpl' | 'retry'>;
|
|
471
|
-
interface ResolveAgentBackendOptions<TInput extends AgentBackendInput = AgentBackendInput> extends OpenAICompatPassthrough {
|
|
472
|
-
/** The chat transport to resolve. */
|
|
473
|
-
kind: AgentBackendKind;
|
|
474
|
-
/**
|
|
475
|
-
* Bearer credential for the OpenAI-compat kinds. Empty string is valid for a
|
|
476
|
-
* loopback-anonymous cli-bridge; a `router`/`tcloud` route with an empty key
|
|
477
|
-
* is a caller bug the product surfaces before calling in.
|
|
478
|
-
*/
|
|
479
|
-
apiKey: string;
|
|
480
|
-
/** Base URL for the OpenAI-compat kinds. cli-bridge's is its `/v1`. */
|
|
481
|
-
baseUrl: string;
|
|
482
|
-
/** Model id sent on every request. cli-bridge rejects a request without it. */
|
|
483
|
-
model: string;
|
|
484
|
-
/** `kind` label stamped on the resolved backend + its traces. Defaults to `kind`. */
|
|
485
|
-
label?: string;
|
|
486
|
-
/**
|
|
487
|
-
* `sandbox` kind: the product's own domain backend. Required for that kind —
|
|
488
|
-
* the substrate owns no product sandbox shape, so a `sandbox` resolution with
|
|
489
|
-
* no seam is a caller bug, not a silent fallback.
|
|
490
|
-
*/
|
|
491
|
-
sandboxBackend?: () => AgentExecutionBackend<TInput>;
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Resolve the `AgentExecutionBackend` for the chosen `kind`. Reuse this instead
|
|
495
|
-
* of hand-rolling the `createOpenAICompatibleBackend` branch in each product.
|
|
496
|
-
*/
|
|
497
|
-
declare function resolveAgentBackend<TInput extends AgentBackendInput = AgentBackendInput>(opts: ResolveAgentBackendOptions<TInput>): AgentExecutionBackend<TInput>;
|
|
498
|
-
//#endregion
|
|
499
|
-
//#region src/run.d.ts
|
|
500
|
-
/** Stamp cross-cutting defaults onto adapter-projected RunRecords without
|
|
501
|
-
* overriding anything the adapter set explicitly:
|
|
502
|
-
* - `scenarioId` — the run's scenario, when the record omits one.
|
|
503
|
-
* - `failureClass` — the control layer's failure classification promoted
|
|
504
|
-
* onto the canonical cross-agent key, but ONLY when it's a real taxonomy
|
|
505
|
-
* class. This is what lets the substrate aggregate failures across every
|
|
506
|
-
* agent in one vocabulary instead of per-agent ad-hoc strings. */
|
|
507
|
-
declare function applyRunRecordDefaults(records: RunRecord[], scenarioId: string, controlFailureClass: string | undefined): RunRecord[];
|
|
508
|
-
/**
|
|
509
|
-
* Single-shot task lifecycle for adapter-driven tasks: readiness-gated, emits the runtime lifecycle event vocabulary, session-store pluggable.
|
|
510
|
-
*
|
|
511
|
-
* @stable
|
|
512
|
-
*/
|
|
513
|
-
declare function runAgentTask<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult>(options: RunAgentTaskOptions<TState, TAction, TActionResult, TEval>): Promise<AgentTaskRunResult<TState, TAction, TActionResult, TEval>>;
|
|
514
|
-
/**
|
|
515
|
-
* Streaming task lifecycle: delegates execution to an `AgentExecutionBackend` (model API, sandbox, or custom iterable) and yields lifecycle events as they happen.
|
|
516
|
-
*
|
|
517
|
-
* @stable
|
|
518
|
-
*/
|
|
519
|
-
declare function runAgentTaskStream<TInput extends AgentBackendInput = AgentBackendInput>(options: RunAgentTaskStreamOptions<TInput>): AsyncIterable<RuntimeStreamEvent>;
|
|
520
|
-
//#endregion
|
|
521
|
-
//#region src/sessions.d.ts
|
|
522
|
-
/** In-memory `RuntimeSessionStore` for single-process use and tests. @stable */
|
|
523
|
-
declare class InMemoryRuntimeSessionStore implements RuntimeSessionStore {
|
|
524
|
-
private readonly sessions;
|
|
525
|
-
private readonly events;
|
|
526
|
-
get(sessionId: string): RuntimeSession | undefined;
|
|
527
|
-
put(session: RuntimeSession): void;
|
|
528
|
-
appendEvent(sessionId: string, event: RuntimeStreamEvent): void;
|
|
529
|
-
listEvents(sessionId: string): RuntimeStreamEvent[];
|
|
530
|
-
}
|
|
531
|
-
//#endregion
|
|
532
|
-
//#region src/sse.d.ts
|
|
533
|
-
/** @stable */
|
|
534
|
-
interface ServerSentEventOptions {
|
|
535
|
-
event?: string;
|
|
536
|
-
id?: string;
|
|
537
|
-
retry?: number;
|
|
538
|
-
}
|
|
539
|
-
/** Serialize a `KnowledgeReadinessReport` as a Server-Sent Event string. @stable */
|
|
540
|
-
declare function readinessServerSentEvent(report: KnowledgeReadinessReport, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
|
|
541
|
-
/** Serialize a `RuntimeStreamEvent` as a Server-Sent Event string. @stable */
|
|
542
|
-
declare function runtimeStreamServerSentEvent(event: RuntimeStreamEvent, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
|
|
543
|
-
//#endregion
|
|
544
|
-
export { McpServeSpec as $, resolveRouterBaseUrl as A, RawTraceDistillerOptions as B, DEFAULT_ROUTER_BASE_URL as C, cleanModelId as D, RouterEnv as E, parseRolloutPolicy as F, strategyAuthorMethod as G, buildDriverSystem as H, serializeRolloutPolicy as I, OfficialOptimizerUnavailableError as J, OfficialGepaOptions as K, structuralRolloutPolicyFromProfile as L, ROLLOUT_POLICY_EXTENSION as M, applyRolloutPolicyToProfile as N, getModels as O, normalizeRolloutPolicy as P, officialSkillOpt as Q, ReflectiveGeneratorOptions as R, ChatModelValidation as S, ResolvedChatModel as T, optimizerMethod as U, rawTraceDistiller as V, researchDriverNote as W, OfficialSkillOptOptions as X, OfficialSensitiveCandidateInput as Y, officialGepa as Z, AgentBackendKind as _, ControlStep$1 as a, mcpBuildPrompt as at, decideKnowledgeReadiness as b, KnowledgeRequirement$1 as c, createIterableBackend as ct, readinessServerSentEvent as d, mcpServeVerifier as et, runtimeStreamServerSentEvent as f, runAgentTaskStream as g, runAgentTask as h, ControlRunResult$1 as i, findingLines as it, validateChatModelId as j, resolveChatModel as k, RunRecord$1 as l, createOpenAICompatibleBackend as lt, applyRunRecordDefaults as m, ControlDecision$1 as n, driverLoopGenerator as nt, DataAcquisitionPlan$1 as o, toolBuildPrompt as ot, InMemoryRuntimeSessionStore as p, OfficialOptimizerContextOptions as q, ControlEvalResult$1 as r, BuildPromptFindingsInput as rt, KnowledgeReadinessReport$1 as s, BackendRetryPolicy as st, ControlBudget$1 as t, DriverLoopGeneratorOptions as tt, ServerSentEventOptions as u, createSandboxPromptBackend as ut, ResolveAgentBackendOptions as v, ModelInfo as w, ChatModelCandidate as x, resolveAgentBackend as y, reflectiveGenerator as z };
|
|
545
|
-
//# sourceMappingURL=index-D_M4d1_B.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge-EnuEqm_Y.js","names":[],"sources":["../src/knowledge/activation.ts","../src/knowledge/supervised-update.ts","../src/knowledge/improvement-job.ts"],"sourcesContent":["import type {\n AgentImprovementActivationOutcome,\n AgentImprovementActivationResult,\n AgentImprovementActivationTarget,\n Sha256Digest,\n} from '@tangle-network/agent-interface'\nimport { sha256DigestSchema } from '@tangle-network/agent-interface'\nimport {\n fromAgentCandidateKnowledgeRef,\n type KnowledgeImprovementMutationReceipt,\n loadKnowledgeImprovementActivationResult,\n type PromoteKnowledgeCandidateOptions,\n promoteKnowledgeCandidate,\n restoreKnowledgeCandidateBaseline,\n} from '@tangle-network/agent-knowledge'\n\nimport {\n type AgentImprovementActivationReconciliation,\n type AgentImprovementActivationResultStore,\n type AgentImprovementActivationTransition,\n type AgentImprovementActivationTransitionInput,\n createAgentImprovementActivationResult,\n} from '../intelligence/activation'\n\nexport interface CreateKnowledgeImprovementActivationExecutorOptions\n extends Omit<PromoteKnowledgeCandidateOptions, 'root' | 'candidate'> {\n root: string\n identity: string\n results: AgentImprovementActivationResultStore\n}\n\nexport interface KnowledgeImprovementActivationExecutor {\n transition: AgentImprovementActivationTransition\n reconcile: AgentImprovementActivationReconciliation\n}\n\n/** Apply or restore one local knowledge candidate through the shared activation contract. */\nexport function createKnowledgeImprovementActivationExecutor(\n options: CreateKnowledgeImprovementActivationExecutorOptions,\n): KnowledgeImprovementActivationExecutor {\n if (!options.identity.trim()) throw new Error('knowledge activation identity is required')\n return {\n reconcile: async (transition) => {\n const inspected = await inspectKnowledgeActivation(options, transition)\n return inspected.settled ? inspected.result : undefined\n },\n transition: async (transition) => {\n if (transition.expired) {\n throw new Error('knowledge write transition cannot run after authorization expires')\n }\n const inspected = await inspectKnowledgeActivation(options, transition)\n if (inspected.settled) return inspected.result\n\n const mutationOptions = {\n root: options.root,\n candidate: inspected.candidate,\n activation: {\n activation: transition.activation,\n attemptedAt: transition.attemptedAt,\n identity: options.identity,\n createResult: (receipt: KnowledgeImprovementMutationReceipt) =>\n inspected.create(\n knowledgeMutationOutcome(receipt, inspected, transition.activation.intent),\n ),\n },\n ...(options.ownerId ? { ownerId: options.ownerId } : {}),\n ...(options.leaseTtlMs === undefined ? {} : { leaseTtlMs: options.leaseTtlMs }),\n ...(options.now ? { now: options.now } : {}),\n ...(options.onState ? { onState: options.onState } : {}),\n }\n const improvement =\n transition.activation.intent === 'activate-candidate'\n ? await promoteKnowledgeCandidate(mutationOptions)\n : await restoreKnowledgeCandidateBaseline(mutationOptions)\n if (!improvement.activationResult) {\n throw new Error('knowledge mutation did not persist its shared activation result')\n }\n return options.results.putIfAbsent(improvement.activationResult)\n },\n }\n}\n\ntype CreateKnowledgeActivation = (\n outcome: AgentImprovementActivationOutcome,\n) => AgentImprovementActivationResult\n\ntype InspectedKnowledgeActivation =\n | { settled: true; result: unknown | undefined }\n | {\n settled: false\n target: AgentImprovementActivationTransitionInput['targets'][number]\n candidate: PromoteKnowledgeCandidateOptions['candidate']\n expectedDigest: Sha256Digest\n desiredDigest: Sha256Digest\n create: CreateKnowledgeActivation\n }\n\nasync function inspectKnowledgeActivation(\n options: CreateKnowledgeImprovementActivationExecutorOptions,\n transition: AgentImprovementActivationTransitionInput,\n): Promise<InspectedKnowledgeActivation> {\n const stored = await options.results.load(transition.activation.digest)\n if (stored !== undefined) return { settled: true, result: stored }\n\n const create: CreateKnowledgeActivation = (outcome) =>\n createAgentImprovementActivationResult(transition, {\n completedAt: completionTime(transition, options.now),\n outcome,\n })\n const store = (outcome: AgentImprovementActivationOutcome) =>\n options.results.putIfAbsent(create(outcome))\n if (transition.kind !== 'sealed-candidate') {\n if (transition.expired) return { settled: true, result: undefined }\n return {\n settled: true,\n result: await store({\n status: 'unsupported',\n code: 'KNOWLEDGE_PROFILE_TRANSITION_UNSUPPORTED',\n message: 'The knowledge adapter accepts only sealed knowledge candidates.',\n }),\n }\n }\n const target = supportedKnowledgeTarget(transition, options.identity)\n if (!target) {\n if (transition.expired) return { settled: true, result: undefined }\n return {\n settled: true,\n result: await store({\n status: 'unsupported',\n code: 'KNOWLEDGE_TARGET_SET_UNSUPPORTED',\n message: 'The knowledge adapter requires exactly one matching knowledge target.',\n }),\n }\n }\n const knowledge = transition.candidateBundle.knowledge\n if (!knowledge) {\n if (transition.expired) return { settled: true, result: undefined }\n return {\n settled: true,\n result: await store({\n status: 'unsupported',\n code: 'KNOWLEDGE_CANDIDATE_MISSING',\n message: 'The measured candidate bundle does not contain a knowledge candidate.',\n }),\n }\n }\n const candidate = fromAgentCandidateKnowledgeRef(knowledge.candidate)\n const expectedDigest =\n transition.activation.intent === 'activate-candidate'\n ? knowledge.candidate.baseHash\n : knowledge.candidate.candidateHash\n const desiredDigest =\n transition.activation.intent === 'activate-candidate'\n ? knowledge.candidate.candidateHash\n : knowledge.candidate.baseHash\n if (target.expectedBaseDigest !== expectedDigest || target.desiredDigest !== desiredDigest) {\n if (transition.expired) return { settled: true, result: undefined }\n return {\n settled: true,\n result: await store({\n status: 'failed',\n code: 'KNOWLEDGE_TARGET_MISMATCH',\n message: 'The activation target does not match the measured knowledge candidate.',\n }),\n }\n }\n\n const durable = await loadKnowledgeImprovementActivationResult({\n root: options.root,\n candidate,\n activation: transition.activation,\n identity: options.identity,\n })\n if (durable) {\n return {\n settled: true,\n result: await options.results.putIfAbsent(durable),\n }\n }\n if (transition.expired) return { settled: true, result: undefined }\n return { settled: false, target, candidate, expectedDigest, desiredDigest, create }\n}\n\nfunction supportedKnowledgeTarget(\n transition: AgentImprovementActivationTransitionInput,\n identity: string,\n): AgentImprovementActivationTransitionInput['targets'][number] | undefined {\n if (transition.targets.length !== 1) return undefined\n const target = transition.targets[0]\n return target.surface === 'knowledge' && target.identity === identity ? target : undefined\n}\n\nfunction knowledgeMutationOutcome(\n receipt: KnowledgeImprovementMutationReceipt,\n inspected: Extract<InspectedKnowledgeActivation, { settled: false }>,\n intent: AgentImprovementActivationTransitionInput['activation']['intent'],\n): AgentImprovementActivationOutcome {\n const expectedTarget = intent === 'activate-candidate' ? 'candidate' : 'baseline'\n const beforeDigest = prefixedDigest(receipt.beforeHash)\n const afterDigest = prefixedDigest(receipt.afterHash)\n if (\n receipt.target !== expectedTarget ||\n receipt.changed !== (beforeDigest !== afterDigest) ||\n (!receipt.changed && (receipt.transactionId !== null || receipt.recovered))\n ) {\n throw new Error('knowledge mutation returned inconsistent state evidence')\n }\n if (receipt.changed) {\n if (\n receipt.transactionId === null ||\n beforeDigest !== inspected.expectedDigest ||\n afterDigest !== inspected.desiredDigest\n ) {\n throw new Error('knowledge activation did not apply its authorized content transition')\n }\n return {\n status: 'applied',\n transactionId: receipt.transactionId,\n targets: [\n {\n surface: inspected.target.surface,\n identity: inspected.target.identity,\n beforeDigest,\n afterDigest,\n },\n ],\n }\n }\n if (afterDigest === inspected.desiredDigest) {\n return {\n status: 'already-applied',\n targets: [targetState(inspected.target, afterDigest)],\n }\n }\n if (afterDigest === inspected.expectedDigest) {\n throw new Error('knowledge activation did not attempt its authorized content transition')\n }\n return {\n status: 'conflict',\n targets: [targetState(inspected.target, afterDigest)],\n }\n}\n\nfunction targetState(target: AgentImprovementActivationTarget, currentDigest: Sha256Digest) {\n return {\n surface: target.surface,\n identity: target.identity,\n currentDigest,\n }\n}\n\nfunction prefixedDigest(hash: string): Sha256Digest {\n return sha256DigestSchema.parse(`sha256:${hash}`)\n}\n\nfunction completionTime(\n transition: AgentImprovementActivationTransitionInput,\n now: (() => Date) | undefined,\n): string {\n const completedAt = (now ?? (() => new Date()))().toISOString()\n return Date.parse(completedAt) < Date.parse(transition.attemptedAt)\n ? transition.attemptedAt\n : completedAt\n}\n","import type { RagKnowledgeUpdateResult } from '@tangle-network/agent-knowledge'\nimport { researcherProfile } from '../profiles/researcher'\nimport type { DeliverableSpec } from '../runtime/supervise/completion-gate'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport { type SuperviseOptions, supervise } from '../runtime/supervise/supervise'\nimport type { SupervisorProfile } from '../runtime/supervise/supervisor-agent'\nimport type { Budget, SupervisedResult } from '../runtime/supervise/types'\n\n/** Standing prompt for a supervisor that grows a shared knowledge base through spawned researchers. */\nexport const RESEARCH_SUPERVISOR_SYSTEM_PROMPT = [\n 'You are a research supervisor. You do not answer the research question yourself.',\n 'You create and manage researcher workers that improve one shared knowledge base until it is ready.',\n '',\n 'Each round:',\n '1. Read the goal and the gaps the readiness check still reports.',\n '2. Decompose the open work into independent sub-topics.',\n '3. Spawn one researcher per sub-topic; split by sub-topic, never duplicate work.',\n '4. Wait for researchers to settle, steer or re-spawn thin sub-topics, then stop when the check passes.',\n '',\n 'Conserve the shared budget. Prefer a small number of well-scoped researchers over a large fanout that re-covers the same ground.',\n].join('\\n')\n\nexport interface KnowledgeReadinessCheckInput {\n root: string\n goal: string\n readinessSpecs?: readonly unknown[]\n readinessTaskId?: string\n readiness?: unknown\n}\n\nexport type KnowledgeReadinessCheckResult =\n | boolean\n | {\n ready: boolean\n summary?: string\n metadata?: Record<string, unknown>\n }\n\nexport type KnowledgeReadinessCheck = (\n input: KnowledgeReadinessCheckInput,\n) => Promise<KnowledgeReadinessCheckResult> | KnowledgeReadinessCheckResult\n\nexport interface SupervisedKnowledgeUpdateInput {\n goal?: string\n root?: string\n candidateRoot?: string\n findings?: readonly unknown[]\n metadata?: Record<string, unknown>\n}\n\nexport interface SupervisedKnowledgeUpdateResult {\n applied: boolean\n summary: string\n supervised: SupervisedResult<unknown>\n metadata: NonNullable<RagKnowledgeUpdateResult['metadata']>\n}\n\nexport interface SupervisedKnowledgeUpdateOptions {\n root: string\n goal: string\n readiness: KnowledgeReadinessCheck\n readinessSpecs?: readonly unknown[]\n readinessTaskId?: string\n readinessOptions?: unknown\n findings?: readonly unknown[]\n metadata?: Record<string, unknown>\n budget: Budget\n backend?: ExecutorConfig\n makeWorkerAgent?: SuperviseOptions['makeWorkerAgent']\n harness?: string\n supervisorModel?: string\n supervisorSystemPrompt?: string\n superviseOptions?: Partial<\n Omit<\n SuperviseOptions,\n 'budget' | 'backend' | 'deliverable' | 'makeWorkerAgent' | 'allowedModels'\n >\n >\n allowedModels?: readonly string[]\n runSupervised?: (\n profile: SupervisorProfile,\n task: unknown,\n opts: SuperviseOptions,\n ) => Promise<SupervisedResult<unknown>>\n}\n\nexport type SupervisedKnowledgeUpdater = (\n input: SupervisedKnowledgeUpdateInput,\n) => Promise<SupervisedKnowledgeUpdateResult>\n\n/** Build the completion check a supervised KB update uses to stop only when the KB is ready. */\nexport function knowledgeReadinessDeliverable(\n options: Pick<\n SupervisedKnowledgeUpdateOptions,\n 'root' | 'goal' | 'readiness' | 'readinessSpecs' | 'readinessTaskId' | 'readinessOptions'\n >,\n): DeliverableSpec<unknown> {\n return {\n describe: `knowledge base at ${options.root} is ready for: ${options.goal}`,\n async check() {\n const result = await options.readiness({\n root: options.root,\n goal: options.goal,\n readinessSpecs: options.readinessSpecs,\n readinessTaskId: options.readinessTaskId,\n readiness: options.readinessOptions,\n })\n return typeof result === 'boolean' ? result : result.ready\n },\n }\n}\n\n/** Create an `improveKnowledgeBase` update callback backed by runtime supervision. */\nexport function createSupervisedKnowledgeUpdater(\n options: SupervisedKnowledgeUpdateOptions,\n): SupervisedKnowledgeUpdater {\n return (input) =>\n runSupervisedKnowledgeUpdate({\n ...options,\n root: input.candidateRoot ?? input.root ?? options.root,\n goal: input.goal ?? options.goal,\n findings: input.findings ?? options.findings,\n metadata: { ...options.metadata, ...input.metadata },\n })\n}\n\n/** Run a runtime supervisor that updates one candidate knowledge base and stops on readiness. */\nexport async function runSupervisedKnowledgeUpdate(\n options: SupervisedKnowledgeUpdateOptions,\n): Promise<SupervisedKnowledgeUpdateResult> {\n const { profile: workerProfile } = researcherProfile({ harness: options.harness })\n const baseInstructions = options.supervisorSystemPrompt ?? RESEARCH_SUPERVISOR_SYSTEM_PROMPT\n const workerContract = workerProfile.prompt?.systemPrompt\n const systemPrompt = workerContract\n ? `${baseInstructions}\\n\\nEach researcher worker you spawn follows this contract:\\n${workerContract}`\n : baseInstructions\n\n const profile: SupervisorProfile = {\n name: 'knowledge-research-supervisor',\n ...(options.supervisorModel ? { model: { default: options.supervisorModel } } : {}),\n prompt: { systemPrompt },\n }\n const run = options.runSupervised ?? supervise\n const task = formatSupervisedKnowledgeTask(options)\n const supervised = await run(profile, task, {\n ...options.superviseOptions,\n budget: options.budget,\n backend: options.backend,\n deliverable: knowledgeReadinessDeliverable(options),\n makeWorkerAgent: options.makeWorkerAgent,\n allowedModels: options.allowedModels,\n })\n return {\n applied: supervised.kind === 'winner',\n summary:\n supervised.kind === 'winner'\n ? 'research supervisor completed and the knowledge base passed readiness'\n : `research supervisor stopped without a ready knowledge base: ${supervised.reason}`,\n supervised,\n metadata: {\n supervised: true,\n root: options.root,\n goal: options.goal,\n result: supervised.kind,\n },\n }\n}\n\n/** Format the supervisor task with the KB root, readiness requirements, current findings, and metadata. */\nexport function formatSupervisedKnowledgeTask(\n options: Pick<\n SupervisedKnowledgeUpdateOptions,\n 'root' | 'goal' | 'readinessSpecs' | 'readinessTaskId' | 'findings' | 'metadata'\n >,\n): string {\n const sections = [\n `Goal: ${options.goal}`,\n `Knowledge base root: ${options.root}`,\n options.readinessTaskId ? `Readiness task id: ${options.readinessTaskId}` : undefined,\n options.readinessSpecs?.length\n ? `Readiness specs:\\n${JSON.stringify(options.readinessSpecs, null, 2)}`\n : undefined,\n options.findings?.length\n ? `Current findings:\\n${JSON.stringify(options.findings, null, 2)}`\n : undefined,\n options.metadata && Object.keys(options.metadata).length > 0\n ? `Metadata:\\n${JSON.stringify(options.metadata, null, 2)}`\n : undefined,\n ].filter((section): section is string => Boolean(section))\n return `${sections.join('\\n\\n')}\\n\\nUpdate files under the knowledge base root only. Stop when the readiness check passes.`\n}\n","import { realpath } from 'node:fs/promises'\nimport {\n type AgentCandidateBundle,\n type AgentCandidateCapturedArtifact,\n type AgentCandidateKnowledge,\n agentCandidateKnowledgeSchema,\n} from '@tangle-network/agent-interface'\nimport {\n type BuildEvalKnowledgeBundleOptions,\n evaluateKnowledgeBaseReadiness,\n improveKnowledgeBase,\n type KnowledgeBaseQualityOptions,\n type KnowledgeImprovementOptions,\n type KnowledgeImprovementResult,\n type KnowledgeReadinessSpec,\n knowledgeImprovementCandidateRef,\n toAgentCandidateKnowledgeRef,\n withKnowledgeImprovementComparison,\n} from '@tangle-network/agent-knowledge'\nimport { sealAgentCandidateBundle } from '../candidate-execution/bundle'\nimport {\n canonicalCandidateBytes,\n embeddedCandidateArtifact,\n omitTopLevelDigest,\n} from '../candidate-execution/digest'\nimport { persistCandidateOutputArtifact } from '../candidate-execution/output-artifacts'\nimport type { AgentCandidateOutputArtifactPort } from '../candidate-execution/types'\nimport { captureAgentCandidateWorkspace } from '../candidate-execution/workspace-archive'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { SuperviseOptions } from '../runtime/supervise/supervise'\nimport type { SupervisorProfile } from '../runtime/supervise/supervisor-agent'\nimport type { Budget, SupervisedResult } from '../runtime/supervise/types'\nimport {\n createSupervisedKnowledgeUpdater,\n type KnowledgeReadinessCheck,\n type KnowledgeReadinessCheckResult,\n type SupervisedKnowledgeUpdateOptions,\n} from './supervised-update'\n\nexport interface RunKnowledgeImprovementJobOptions\n extends Omit<KnowledgeImprovementOptions, 'updateKnowledge'> {\n budget: Budget\n readinessCheck?: KnowledgeReadinessCheck\n backend?: ExecutorConfig\n makeWorkerAgent?: SuperviseOptions['makeWorkerAgent']\n harness?: string\n supervisorModel?: string\n supervisorSystemPrompt?: string\n superviseOptions?: Partial<\n Omit<\n SuperviseOptions,\n 'budget' | 'backend' | 'deliverable' | 'makeWorkerAgent' | 'allowedModels'\n >\n >\n allowedModels?: readonly string[]\n runSupervised?: (\n profile: SupervisorProfile,\n task: unknown,\n opts: SuperviseOptions,\n ) => Promise<SupervisedResult<unknown>>\n candidateArtifacts?: AgentCandidateOutputArtifactPort\n onMeasurement?: (measurement: KnowledgeImprovementJobMeasurement) => Promise<void> | void\n}\n\nexport interface KnowledgeImprovementJobMeasurement {\n startedAt: string\n finishedAt: string\n durationMs: number\n updateCalls: number\n updateDurationMs: number\n supervisedSpent: {\n iterations: number\n inputTokens: number\n outputTokens: number\n usdKnown: boolean\n usd: number\n ms: number\n }\n}\n\nexport interface KnowledgeImprovementJobResult {\n improvement: KnowledgeImprovementResult\n knowledge?: KnowledgeImprovementCandidatePair\n measurement: KnowledgeImprovementJobMeasurement\n blocked: boolean\n}\n\nexport interface KnowledgeImprovementCandidatePair {\n reference: AgentCandidateKnowledge['candidate']\n evaluation: AgentCandidateCapturedArtifact\n baseline: AgentCandidateKnowledge['snapshot']\n candidate: AgentCandidateKnowledge['snapshot']\n}\n\nexport interface KnowledgeImprovementExperimentBundles {\n baseline: AgentCandidateBundle\n candidate: AgentCandidateBundle\n}\n\nexport interface AgentKnowledgeReadinessCheckOptions {\n goal: string\n readinessSpecs?: readonly KnowledgeReadinessSpec[]\n readinessTaskId?: string\n readiness?: Omit<BuildEvalKnowledgeBundleOptions, 'taskId' | 'index' | 'specs'>\n strict?: boolean\n kbQuality?: KnowledgeBaseQualityOptions\n}\n\n/** Build the default readiness check backed by `@tangle-network/agent-knowledge` validation and scoring. */\nexport function createAgentKnowledgeReadinessCheck(\n options: AgentKnowledgeReadinessCheckOptions,\n): KnowledgeReadinessCheck {\n return async (input): Promise<KnowledgeReadinessCheckResult> => {\n const readiness = await evaluateKnowledgeBaseReadiness({\n root: input.root,\n goal: input.goal ?? options.goal,\n readinessSpecs:\n (input.readinessSpecs as readonly KnowledgeReadinessSpec[] | undefined) ??\n options.readinessSpecs,\n readinessTaskId: input.readinessTaskId ?? options.readinessTaskId,\n readiness:\n (input.readiness as AgentKnowledgeReadinessCheckOptions['readiness'] | undefined) ??\n options.readiness,\n strict: options.strict,\n kbQuality: options.kbQuality,\n })\n return {\n ready: readiness.ready,\n summary: readiness.summary,\n metadata: {\n dimensions: readiness.dimensions,\n validationOk: readiness.validation.ok,\n kbQualityOk: readiness.kbQuality.ok,\n blockingMissing: readiness.readiness?.report.blockingMissingRequirements.length ?? 0,\n },\n }\n }\n}\n\n/** Produce a frozen KB candidate while leaving live knowledge content unchanged. */\nexport async function runKnowledgeImprovementJob(\n options: RunKnowledgeImprovementJobOptions,\n): Promise<KnowledgeImprovementJobResult> {\n const {\n allowedModels,\n backend,\n budget,\n candidateArtifacts,\n harness,\n makeWorkerAgent,\n onMeasurement,\n readinessCheck,\n runSupervised,\n supervisorModel,\n supervisorSystemPrompt,\n superviseOptions,\n ...knowledgeOptions\n } = options\n const startedAtMs = Date.now()\n const startedAt = new Date(startedAtMs).toISOString()\n const supervisedSpent = emptySpent()\n let updateCalls = 0\n let updateDurationMs = 0\n\n const readiness = readinessCheck ?? createAgentKnowledgeReadinessCheck(options)\n const updateKnowledge = createSupervisedKnowledgeUpdater({\n root: options.root,\n goal: options.goal,\n readiness,\n readinessSpecs: options.readinessSpecs,\n readinessTaskId: options.readinessTaskId,\n readinessOptions: options.readiness,\n budget,\n backend,\n makeWorkerAgent,\n harness,\n supervisorModel,\n supervisorSystemPrompt,\n superviseOptions,\n allowedModels,\n runSupervised,\n } satisfies SupervisedKnowledgeUpdateOptions)\n\n const instrumentedUpdateKnowledge: KnowledgeImprovementOptions['updateKnowledge'] = async (\n input,\n ) => {\n const updateStartedAt = Date.now()\n updateCalls += 1\n const result = await updateKnowledge(input)\n updateDurationMs += Date.now() - updateStartedAt\n addSpent(supervisedSpent, result.supervised)\n return result\n }\n const resolvedImprovement = await improveKnowledgeBase({\n ...knowledgeOptions,\n updateKnowledge: instrumentedUpdateKnowledge,\n })\n let knowledge: KnowledgeImprovementCandidatePair | undefined\n if (\n resolvedImprovement.candidate?.status === 'candidate-ready' ||\n resolvedImprovement.candidate?.status === 'promoted'\n ) {\n knowledge = await freezeKnowledgeCandidatePair(\n options.root,\n resolvedImprovement,\n candidateArtifacts,\n knowledgeOptions.signal,\n )\n }\n const finishedAtMs = Date.now()\n const measurement: KnowledgeImprovementJobMeasurement = {\n startedAt,\n finishedAt: new Date(finishedAtMs).toISOString(),\n durationMs: finishedAtMs - startedAtMs,\n updateCalls,\n updateDurationMs,\n supervisedSpent,\n }\n await onMeasurement?.(measurement)\n return {\n improvement: resolvedImprovement,\n ...(knowledge ? { knowledge } : {}),\n measurement,\n blocked: resolvedImprovement.blocked,\n }\n}\n\n/** Attach both frozen knowledge inputs to one otherwise-identical bundle pair. */\nexport function buildKnowledgeImprovementExperimentBundles(\n bundle: AgentCandidateBundle,\n knowledge: KnowledgeImprovementCandidatePair,\n): KnowledgeImprovementExperimentBundles {\n const input = omitTopLevelDigest(bundle)\n const withSnapshot = (snapshot: AgentCandidateKnowledge['snapshot']) =>\n agentCandidateKnowledgeSchema.parse({\n candidate: knowledge.reference,\n snapshot,\n evaluation: knowledge.evaluation,\n })\n return Object.freeze({\n baseline: sealAgentCandidateBundle({ ...input, knowledge: withSnapshot(knowledge.baseline) }),\n candidate: sealAgentCandidateBundle({ ...input, knowledge: withSnapshot(knowledge.candidate) }),\n })\n}\n\nasync function freezeKnowledgeCandidatePair(\n root: string,\n improvement: KnowledgeImprovementResult,\n artifacts: AgentCandidateOutputArtifactPort | undefined,\n signal: AbortSignal | undefined,\n): Promise<KnowledgeImprovementCandidatePair> {\n const candidate = knowledgeImprovementCandidateRef(improvement)\n const candidateRef = toAgentCandidateKnowledgeRef(candidate)\n return withKnowledgeImprovementComparison({ root, candidate }, async (comparison) => {\n const freeze = async (\n target: 'baseline' | 'candidate',\n ): Promise<AgentCandidateKnowledge['snapshot']> => {\n const executionId = `knowledge-${candidate.candidateId}-${target}`\n const captured = await captureAgentCandidateWorkspace(\n await realpath(comparison[target].root),\n {\n ...(artifacts\n ? {\n artifactPersistence: {\n executionId,\n outputArtifacts: artifacts,\n ...(signal ? { signal } : {}),\n },\n }\n : {}),\n },\n )\n return captured.snapshot\n }\n const evaluation = await captureKnowledgeEvidence(\n canonicalCandidateBytes({\n kind: 'agent-knowledge-candidate-evaluation',\n candidate: candidateRef,\n metric: comparison.evaluation,\n }),\n 'knowledge-evaluation',\n `knowledge-${candidate.candidateId}`,\n artifacts,\n signal,\n )\n const baseline = await freeze('baseline')\n const proposed = await freeze('candidate')\n return Object.freeze({\n reference: candidateRef,\n evaluation,\n baseline,\n candidate: proposed,\n })\n })\n}\n\nasync function captureKnowledgeEvidence(\n bytes: Uint8Array,\n purpose: 'knowledge-evaluation',\n executionId: string,\n artifacts: AgentCandidateOutputArtifactPort | undefined,\n signal: AbortSignal | undefined,\n): Promise<AgentCandidateCapturedArtifact> {\n if (!artifacts) return embeddedCandidateArtifact(bytes)\n return persistCandidateOutputArtifact(artifacts, {\n executionId,\n purpose,\n bytes,\n ...(signal ? { signal } : {}),\n })\n}\n\nfunction emptySpent(): KnowledgeImprovementJobMeasurement['supervisedSpent'] {\n return { iterations: 0, inputTokens: 0, outputTokens: 0, usdKnown: true, usd: 0, ms: 0 }\n}\n\nfunction addSpent(\n target: KnowledgeImprovementJobMeasurement['supervisedSpent'],\n result: SupervisedResult<unknown>,\n): void {\n const spent = result.spentTotal\n target.iterations += spent.iterations\n target.inputTokens += spent.tokens.input\n target.outputTokens += spent.tokens.output\n target.usdKnown = target.usdKnown && spent.usdKnown !== false\n target.usd += spent.usd\n target.ms += spent.ms\n}\n"],"mappings":";;;;;;;;;;AAqCA,SAAgB,6CACd,SACwC;CACxC,IAAI,CAAC,QAAQ,SAAS,KAAK,GAAG,MAAM,IAAI,MAAM,2CAA2C;CACzF,OAAO;EACL,WAAW,OAAO,eAAe;GAC/B,MAAM,YAAY,MAAM,2BAA2B,SAAS,UAAU;GACtE,OAAO,UAAU,UAAU,UAAU,SAAS,KAAA;EAChD;EACA,YAAY,OAAO,eAAe;GAChC,IAAI,WA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