@tangle-network/agent-runtime 0.48.0 → 0.50.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 +79 -15
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/{chunk-656G2XCL.js → chunk-BKAIVNFA.js} +3 -3
- package/dist/{chunk-IW2LMLK6.js → chunk-CM2IK7VS.js} +913 -152
- package/dist/chunk-CM2IK7VS.js.map +1 -0
- package/dist/{chunk-VR4JIC5H.js → chunk-ML4IXGTV.js} +2 -2
- package/dist/{chunk-TJS7S3HJ.js → chunk-NDM5VXZW.js} +19 -8
- package/dist/chunk-NDM5VXZW.js.map +1 -0
- package/dist/chunk-OM3YNZIW.js +978 -0
- package/dist/chunk-OM3YNZIW.js.map +1 -0
- package/dist/{chunk-JNPK46YH.js → chunk-RHW75JW5.js} +498 -350
- package/dist/chunk-RHW75JW5.js.map +1 -0
- package/dist/{coder-CVZNGbyg.d.ts → coder-_YCf3BAK.d.ts} +2 -2
- package/dist/{driver-DYU2sgHr.d.ts → driver-DLI1io57.d.ts} +1 -1
- package/dist/index.d.ts +34 -9
- package/dist/index.js +117 -27
- package/dist/index.js.map +1 -1
- package/dist/kb-gate-CHAyt4aI.d.ts +1571 -0
- package/dist/{loop-runner-bin-DEm4roYF.d.ts → loop-runner-bin-DFUNgpeK.d.ts} +4 -4
- package/dist/loop-runner-bin.d.ts +5 -5
- package/dist/loop-runner-bin.js +3 -3
- package/dist/loops.d.ts +6 -6
- package/dist/loops.js +17 -1
- package/dist/mcp/bin.js +206 -29
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +41 -177
- package/dist/mcp/index.js +40 -6
- package/dist/mcp/index.js.map +1 -1
- package/dist/openai-tools-D4HLDWgw.d.ts +45 -0
- package/dist/platform.js +2 -2
- package/dist/platform.js.map +1 -1
- package/dist/profiles.d.ts +2 -2
- package/dist/{run-loop-DvD4aGiE.d.ts → run-loop-BIineL1T.d.ts} +1 -1
- package/dist/runtime.d.ts +403 -24
- package/dist/runtime.js +17 -1
- package/dist/{types-BpDfCPUp.d.ts → types-5MGt5KTY.d.ts} +1 -1
- package/dist/{types-nBMuollC.d.ts → types-BEQsBhOE.d.ts} +1 -1
- package/dist/workflow.d.ts +2 -2
- package/dist/workflow.js +1 -1
- package/package.json +6 -5
- package/dist/chunk-IW2LMLK6.js.map +0 -1
- package/dist/chunk-JNPK46YH.js.map +0 -1
- package/dist/chunk-LX66I3SC.js +0 -218
- package/dist/chunk-LX66I3SC.js.map +0 -1
- package/dist/chunk-TJS7S3HJ.js.map +0 -1
- package/dist/kb-gate-51BlLlVM.d.ts +0 -529
- package/dist/otel-export-EzfsVUhh.d.ts +0 -191
- /package/dist/{chunk-656G2XCL.js.map → chunk-BKAIVNFA.js.map} +0 -0
- /package/dist/{chunk-VR4JIC5H.js.map → chunk-ML4IXGTV.js.map} +0 -0
|
@@ -1,529 +0,0 @@
|
|
|
1
|
-
import { C as CoderOutput, a as CoderTask } from './coder-CVZNGbyg.js';
|
|
2
|
-
import { S as SandboxClient, e as LoopTraceEmitter } from './types-nBMuollC.js';
|
|
3
|
-
import { SandboxInstance } from '@tangle-network/sandbox';
|
|
4
|
-
import { a as UiLens, U as UiFinding } from './substrate-CUgk7F7s.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @experimental
|
|
8
|
-
*
|
|
9
|
-
* Delegation executors — the layer between MCP delegates and the sandbox
|
|
10
|
-
* substrate. Each executor exposes a {@link SandboxClient} the kernel
|
|
11
|
-
* consumes plus a placement tag so the trace pipeline can correlate workers
|
|
12
|
-
* with their physical placement.
|
|
13
|
-
*
|
|
14
|
-
* Two implementations ship in-box:
|
|
15
|
-
*
|
|
16
|
-
* - {@link createSiblingSandboxExecutor} — every delegation spawns a fresh
|
|
17
|
-
* sandbox sibling to the caller. Default when the MCP server runs as a
|
|
18
|
-
* standalone CLI mounted outside a fleet.
|
|
19
|
-
*
|
|
20
|
-
* - {@link createFleetWorkspaceExecutor} — delegations dispatch onto machines
|
|
21
|
-
* in the caller's existing fleet so worker diffs land directly on the
|
|
22
|
-
* caller's filesystem (the fleet's shared workspace). Selected when the
|
|
23
|
-
* parent sandbox passes `TANGLE_FLEET_ID` into the MCP server's env.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/** @experimental */
|
|
27
|
-
interface DelegationExecutor {
|
|
28
|
-
/** Sandbox client the kernel calls. Returned with `describePlacement` set. */
|
|
29
|
-
readonly client: SandboxClient;
|
|
30
|
-
/** Best-effort one-liner used in stderr boot logs and diagnostics. */
|
|
31
|
-
describe(): string;
|
|
32
|
-
}
|
|
33
|
-
/** @experimental */
|
|
34
|
-
interface SiblingSandboxExecutorOptions {
|
|
35
|
-
client: SandboxClient;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Wrap a raw sandbox SDK client so the kernel emits
|
|
39
|
-
* `loop.iteration.dispatch` events with `{ placement: 'sibling', sandboxId }`.
|
|
40
|
-
*
|
|
41
|
-
* The returned client `.create()` delegates to the underlying client; the
|
|
42
|
-
* only added behavior is a `describePlacement` tag the kernel reads.
|
|
43
|
-
*
|
|
44
|
-
* @experimental
|
|
45
|
-
*/
|
|
46
|
-
declare function createSiblingSandboxExecutor(options: SiblingSandboxExecutorOptions): DelegationExecutor;
|
|
47
|
-
/**
|
|
48
|
-
* Minimal `SandboxFleet` surface the fleet executor calls. Declared
|
|
49
|
-
* structurally so tests can pass an in-memory stub without instantiating the
|
|
50
|
-
* sandbox SDK.
|
|
51
|
-
*
|
|
52
|
-
* @experimental
|
|
53
|
-
*/
|
|
54
|
-
interface FleetHandle {
|
|
55
|
-
readonly fleetId: string;
|
|
56
|
-
/** Machine ids in dispatch-eligible order. The executor round-robins. */
|
|
57
|
-
readonly ids: ReadonlyArray<string>;
|
|
58
|
-
/** Resolve a machine id to its `SandboxInstance` — that machine is mounted
|
|
59
|
-
* on the fleet's shared workspace, so any diff the worker writes lands on
|
|
60
|
-
* every other fleet machine's filesystem too. */
|
|
61
|
-
sandbox(machineId: string): Promise<SandboxInstance>;
|
|
62
|
-
}
|
|
63
|
-
/** @experimental */
|
|
64
|
-
interface FleetWorkspaceExecutorOptions {
|
|
65
|
-
fleet: FleetHandle;
|
|
66
|
-
/**
|
|
67
|
-
* Override the machine-selection policy. Default = round-robin across
|
|
68
|
-
* `fleet.ids`, skipping the optional `excludeMachineIds` set (typically the
|
|
69
|
-
* coordinator machine the MCP server is running on).
|
|
70
|
-
*/
|
|
71
|
-
selectMachine?: (call: {
|
|
72
|
-
callIndex: number;
|
|
73
|
-
ids: ReadonlyArray<string>;
|
|
74
|
-
}) => string;
|
|
75
|
-
/**
|
|
76
|
-
* Machine ids to skip during default round-robin. Set to the caller's own
|
|
77
|
-
* machineId so workers don't compete with the orchestrator on the same VM.
|
|
78
|
-
*/
|
|
79
|
-
excludeMachineIds?: ReadonlyArray<string>;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Build an executor that resolves each delegated iteration to an existing
|
|
83
|
-
* machine in `fleet`. The fleet's shared-workspace policy means the worker
|
|
84
|
-
* machine sees the caller's filesystem — diffs land in-place with no
|
|
85
|
-
* cross-sandbox copy step.
|
|
86
|
-
*
|
|
87
|
-
* @experimental
|
|
88
|
-
*/
|
|
89
|
-
declare function createFleetWorkspaceExecutor(options: FleetWorkspaceExecutorOptions): DelegationExecutor;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @experimental
|
|
93
|
-
*
|
|
94
|
-
* MCP delegation tool surface — the typed inputs/outputs the product agent
|
|
95
|
-
* sees over the wire. These types are the contract; the JSON schemas under
|
|
96
|
-
* `tools/*` mirror them for the MCP `tools/list` advertisement.
|
|
97
|
-
*
|
|
98
|
-
* Async semantics: `delegate_code` + `delegate_research` return a `taskId`
|
|
99
|
-
* immediately. The product agent polls `delegation_status` until the task
|
|
100
|
-
* transitions to `completed` | `failed` | `cancelled`. `delegate_feedback`
|
|
101
|
-
* + `delegation_history` are synchronous reads / writes against the local
|
|
102
|
-
* task queue + feedback store.
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
/** @experimental */
|
|
106
|
-
type DelegationProfile = 'coder' | 'researcher' | 'ui-auditor';
|
|
107
|
-
/** @experimental */
|
|
108
|
-
type DelegationStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
109
|
-
/**
|
|
110
|
-
* Minimal `CoderTask` overrides exposed over the MCP wire. The full
|
|
111
|
-
* `CoderTask` carries fields the kernel synthesizes from `goal` +
|
|
112
|
-
* `repoRoot` — the agent only edits the few that materially gate
|
|
113
|
-
* validator behavior.
|
|
114
|
-
*
|
|
115
|
-
* @experimental
|
|
116
|
-
*/
|
|
117
|
-
interface DelegateCodeConfig {
|
|
118
|
-
testCmd?: string;
|
|
119
|
-
typecheckCmd?: string;
|
|
120
|
-
forbiddenPaths?: string[];
|
|
121
|
-
maxDiffLines?: number;
|
|
122
|
-
}
|
|
123
|
-
/** @experimental */
|
|
124
|
-
interface DelegateCodeArgs {
|
|
125
|
-
/** Natural-language description of what the coder must accomplish. */
|
|
126
|
-
goal: string;
|
|
127
|
-
/** Absolute path inside the sandbox where the repo lives. */
|
|
128
|
-
repoRoot: string;
|
|
129
|
-
/** Optional free-form context the agent surfaces in the prompt prelude. */
|
|
130
|
-
contextHint?: string;
|
|
131
|
-
/**
|
|
132
|
-
* When > 1, dispatches `multiHarnessCoderFanout` across N harnesses
|
|
133
|
-
* (claude-code, codex, opencode-glm) and picks the highest-scoring
|
|
134
|
-
* passing patch. Default 1.
|
|
135
|
-
*/
|
|
136
|
-
variants?: number;
|
|
137
|
-
/** Validator + prompt overrides the agent knows for this repo. */
|
|
138
|
-
config?: DelegateCodeConfig;
|
|
139
|
-
/** Multi-tenant scope (customer-id, workspace-id). */
|
|
140
|
-
namespace?: string;
|
|
141
|
-
}
|
|
142
|
-
/** @experimental */
|
|
143
|
-
interface DelegateCodeResult {
|
|
144
|
-
taskId: string;
|
|
145
|
-
/** Best-effort hint — coder loops can take minutes-to-hours. */
|
|
146
|
-
estimatedDurationMs?: number;
|
|
147
|
-
}
|
|
148
|
-
/** @experimental */
|
|
149
|
-
type ResearchSource = 'web' | 'corpus' | 'twitter' | 'github' | 'docs';
|
|
150
|
-
/** @experimental */
|
|
151
|
-
interface DelegateResearchConfig {
|
|
152
|
-
recencyWindow?: {
|
|
153
|
-
since?: string;
|
|
154
|
-
until?: string;
|
|
155
|
-
};
|
|
156
|
-
maxItems?: number;
|
|
157
|
-
minConfidence?: number;
|
|
158
|
-
}
|
|
159
|
-
/** @experimental */
|
|
160
|
-
interface DelegateResearchArgs {
|
|
161
|
-
question: string;
|
|
162
|
-
namespace: string;
|
|
163
|
-
scope?: string;
|
|
164
|
-
sources?: ResearchSource[];
|
|
165
|
-
variants?: number;
|
|
166
|
-
config?: DelegateResearchConfig;
|
|
167
|
-
}
|
|
168
|
-
/** @experimental */
|
|
169
|
-
interface DelegateResearchResult {
|
|
170
|
-
taskId: string;
|
|
171
|
-
estimatedDurationMs?: number;
|
|
172
|
-
}
|
|
173
|
-
/** @experimental */
|
|
174
|
-
interface FeedbackRefersTo {
|
|
175
|
-
kind: 'delegation' | 'artifact' | 'outcome';
|
|
176
|
-
/** For `'delegation'`, this is the taskId. */
|
|
177
|
-
ref: string;
|
|
178
|
-
}
|
|
179
|
-
/** @experimental */
|
|
180
|
-
interface FeedbackRating {
|
|
181
|
-
/** [0, 1]. */
|
|
182
|
-
score: number;
|
|
183
|
-
label?: 'good' | 'bad' | 'neutral' | 'mixed';
|
|
184
|
-
notes: string;
|
|
185
|
-
}
|
|
186
|
-
/** @experimental */
|
|
187
|
-
interface DelegateFeedbackArgs {
|
|
188
|
-
refersTo: FeedbackRefersTo;
|
|
189
|
-
rating: FeedbackRating;
|
|
190
|
-
by: 'agent' | 'user' | 'downstream-judge';
|
|
191
|
-
/** ISO timestamp; defaults to server clock when omitted. */
|
|
192
|
-
capturedAt?: string;
|
|
193
|
-
namespace?: string;
|
|
194
|
-
}
|
|
195
|
-
/** @experimental */
|
|
196
|
-
interface DelegateFeedbackResult {
|
|
197
|
-
recorded: true;
|
|
198
|
-
id: string;
|
|
199
|
-
}
|
|
200
|
-
/** @experimental */
|
|
201
|
-
interface DelegationStatusArgs {
|
|
202
|
-
taskId: string;
|
|
203
|
-
}
|
|
204
|
-
/** @experimental */
|
|
205
|
-
interface DelegationProgress {
|
|
206
|
-
iteration: number;
|
|
207
|
-
phase: string;
|
|
208
|
-
}
|
|
209
|
-
/** @experimental */
|
|
210
|
-
interface DelegationError {
|
|
211
|
-
message: string;
|
|
212
|
-
kind: string;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Polymorphic `result` field: `CoderOutput` when the underlying profile
|
|
216
|
-
* is `'coder'`, a structurally-typed research output when `'researcher'`.
|
|
217
|
-
* The MCP wire carries it as JSON either way.
|
|
218
|
-
*
|
|
219
|
-
* @experimental
|
|
220
|
-
*/
|
|
221
|
-
type DelegationResultPayload = {
|
|
222
|
-
profile: 'coder';
|
|
223
|
-
output: CoderOutput;
|
|
224
|
-
} | {
|
|
225
|
-
profile: 'researcher';
|
|
226
|
-
output: ResearchOutputShape;
|
|
227
|
-
} | {
|
|
228
|
-
profile: 'ui-auditor';
|
|
229
|
-
output: UiAuditorDelegationOutput;
|
|
230
|
-
};
|
|
231
|
-
/**
|
|
232
|
-
* Wire-shape of a completed UI-audit delegation. The `findings` array
|
|
233
|
-
* contains every finding persisted to the workspace during the run,
|
|
234
|
-
* already enriched with `id` and `createdAt` by the writer. `workspaceDir`
|
|
235
|
-
* is the absolute path to the workspace; `indexFile` is the workspace-
|
|
236
|
-
* relative path to the regenerated index.md.
|
|
237
|
-
*
|
|
238
|
-
* @experimental
|
|
239
|
-
*/
|
|
240
|
-
interface UiAuditorDelegationOutput {
|
|
241
|
-
workspaceDir: string;
|
|
242
|
-
indexFile: string;
|
|
243
|
-
findings: UiFinding[];
|
|
244
|
-
/** Total iterations the loop ran for this delegation. */
|
|
245
|
-
iterations: number;
|
|
246
|
-
}
|
|
247
|
-
/** @experimental */
|
|
248
|
-
type UiAuditLensFilter = readonly UiLens[];
|
|
249
|
-
/** Optional per-route capture spec the agent surfaces over the wire. */
|
|
250
|
-
interface DelegateUiAuditRoute {
|
|
251
|
-
/** Stable route name (used in screenshot filenames + finding metadata). */
|
|
252
|
-
name: string;
|
|
253
|
-
/** Fully-qualified URL. */
|
|
254
|
-
url: string;
|
|
255
|
-
/** Viewports to capture at. Defaults to `[{ width: 1280, height: 800 }]`. */
|
|
256
|
-
viewports?: readonly {
|
|
257
|
-
width: number;
|
|
258
|
-
height: number;
|
|
259
|
-
}[];
|
|
260
|
-
/** Default false. Full-page captures for the broad lenses. */
|
|
261
|
-
fullPage?: boolean;
|
|
262
|
-
/** Selector to wait for before capture. */
|
|
263
|
-
waitFor?: string;
|
|
264
|
-
}
|
|
265
|
-
/** @experimental */
|
|
266
|
-
interface DelegateUiAuditConfig {
|
|
267
|
-
/**
|
|
268
|
-
* Lenses to iterate. Default: every lens except `'other'`. Order is
|
|
269
|
-
* preserved — the driver iterates lens-by-lens.
|
|
270
|
-
*/
|
|
271
|
-
lenses?: UiAuditLensFilter;
|
|
272
|
-
/** Maximum total iterations across all (lens × route) pairs. Default 33 (11 lenses × 3 routes). */
|
|
273
|
-
maxIterations?: number;
|
|
274
|
-
/** Maximum concurrent iterations within a single plan() round. Default 2. */
|
|
275
|
-
maxConcurrency?: number;
|
|
276
|
-
/** Free-form product context surfaced to the judge. */
|
|
277
|
-
productContext?: string;
|
|
278
|
-
}
|
|
279
|
-
/** @experimental */
|
|
280
|
-
interface DelegateUiAuditArgs {
|
|
281
|
-
/** Workspace root for the audit (absolute path). */
|
|
282
|
-
workspaceDir: string;
|
|
283
|
-
/** Routes to audit. Must be non-empty. */
|
|
284
|
-
routes: readonly DelegateUiAuditRoute[];
|
|
285
|
-
/** Multi-tenant scope. */
|
|
286
|
-
namespace?: string;
|
|
287
|
-
config?: DelegateUiAuditConfig;
|
|
288
|
-
}
|
|
289
|
-
/** @experimental */
|
|
290
|
-
interface DelegateUiAuditResult {
|
|
291
|
-
taskId: string;
|
|
292
|
-
estimatedDurationMs?: number;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Loose shape of a research output over the wire — the substrate cannot
|
|
296
|
-
* import the `ResearchOutput` type from agent-knowledge without inducing
|
|
297
|
-
* a dependency cycle, so the MCP layer treats it structurally.
|
|
298
|
-
*
|
|
299
|
-
* @experimental
|
|
300
|
-
*/
|
|
301
|
-
interface ResearchOutputShape {
|
|
302
|
-
items: unknown[];
|
|
303
|
-
citations: unknown[];
|
|
304
|
-
proposedWrites: unknown[];
|
|
305
|
-
gaps?: string[];
|
|
306
|
-
notes?: string;
|
|
307
|
-
[key: string]: unknown;
|
|
308
|
-
}
|
|
309
|
-
/** @experimental */
|
|
310
|
-
interface DelegationStatusResult {
|
|
311
|
-
taskId: string;
|
|
312
|
-
profile: DelegationProfile;
|
|
313
|
-
status: DelegationStatus;
|
|
314
|
-
progress?: DelegationProgress;
|
|
315
|
-
result?: DelegationResultPayload;
|
|
316
|
-
error?: DelegationError;
|
|
317
|
-
costUsd?: number;
|
|
318
|
-
startedAt: string;
|
|
319
|
-
completedAt?: string;
|
|
320
|
-
}
|
|
321
|
-
/** @experimental */
|
|
322
|
-
interface DelegationHistoryArgs {
|
|
323
|
-
namespace?: string;
|
|
324
|
-
profile?: DelegationProfile;
|
|
325
|
-
/** ISO date — only delegations started at-or-after `since` are returned. */
|
|
326
|
-
since?: string;
|
|
327
|
-
/** Default 50. Hard cap 500. */
|
|
328
|
-
limit?: number;
|
|
329
|
-
}
|
|
330
|
-
/** @experimental */
|
|
331
|
-
interface DelegationFeedbackSnapshot {
|
|
332
|
-
id: string;
|
|
333
|
-
score: number;
|
|
334
|
-
label?: FeedbackRating['label'];
|
|
335
|
-
by: DelegateFeedbackArgs['by'];
|
|
336
|
-
notes: string;
|
|
337
|
-
capturedAt: string;
|
|
338
|
-
}
|
|
339
|
-
/** @experimental */
|
|
340
|
-
interface DelegationHistoryEntry {
|
|
341
|
-
taskId: string;
|
|
342
|
-
profile: DelegationProfile;
|
|
343
|
-
namespace?: string;
|
|
344
|
-
args: DelegateCodeArgs | DelegateResearchArgs | DelegateUiAuditArgs;
|
|
345
|
-
status: DelegationStatus;
|
|
346
|
-
feedback?: DelegationFeedbackSnapshot[];
|
|
347
|
-
costUsd?: number;
|
|
348
|
-
startedAt: string;
|
|
349
|
-
completedAt?: string;
|
|
350
|
-
}
|
|
351
|
-
/** @experimental */
|
|
352
|
-
interface DelegationHistoryResult {
|
|
353
|
-
delegations: DelegationHistoryEntry[];
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/** @experimental */
|
|
357
|
-
interface DelegateRunCtx {
|
|
358
|
-
signal: AbortSignal;
|
|
359
|
-
report(progress: DelegationProgress): void;
|
|
360
|
-
}
|
|
361
|
-
/** @experimental */
|
|
362
|
-
type CoderDelegate = (args: DelegateCodeArgs, ctx: DelegateRunCtx) => Promise<CoderOutput>;
|
|
363
|
-
/** @experimental */
|
|
364
|
-
type ResearcherDelegate = (args: DelegateResearchArgs, ctx: DelegateRunCtx) => Promise<ResearchOutputShape>;
|
|
365
|
-
/**
|
|
366
|
-
* UI-auditor delegate — fully consumer-injected. agent-runtime ships no
|
|
367
|
-
* default factory because the inputs are workspace path + judge function
|
|
368
|
-
* + (optionally) a `SandboxClient`, and the judge is the consumer's
|
|
369
|
-
* model seam. See `createInProcessUiAuditClient` + `uiAuditorProfile` in
|
|
370
|
-
* `@tangle-network/agent-runtime/profiles` for the canonical wiring.
|
|
371
|
-
*
|
|
372
|
-
* @experimental
|
|
373
|
-
*/
|
|
374
|
-
type UiAuditorDelegate = (args: DelegateUiAuditArgs, ctx: DelegateRunCtx) => Promise<UiAuditorDelegationOutput>;
|
|
375
|
-
/** @experimental Structured review verdict over a coder candidate. */
|
|
376
|
-
interface CoderReview {
|
|
377
|
-
/** Gate: only approved candidates are eligible to win. */
|
|
378
|
-
approved: boolean;
|
|
379
|
-
/** Reviewer's recommendation — surfaced in traces. */
|
|
380
|
-
recommendation: 'ship' | 'approve-with-nits' | 'changes-requested' | 'reject';
|
|
381
|
-
/** Readiness 0..1, used by the `highest-readiness` winner-selection strategy. */
|
|
382
|
-
readiness: number;
|
|
383
|
-
notes?: string;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* @experimental
|
|
387
|
-
*
|
|
388
|
-
* Optional adversarial reviewer over a coder candidate that already passed
|
|
389
|
-
* mechanical validation (tests/typecheck/forbidden/diff/no-op/secrets). Folded
|
|
390
|
-
* from the ai-trading-blueprint delegation MCP: a candidate is only eligible to
|
|
391
|
-
* win if the reviewer approves it. The reviewer is the consumer's seam — an LLM
|
|
392
|
-
* judge, a `pnpm review` command, anything returning a `CoderReview`.
|
|
393
|
-
*/
|
|
394
|
-
type CoderReviewer = (output: CoderOutput, task: CoderTask, ctx: {
|
|
395
|
-
signal: AbortSignal;
|
|
396
|
-
}) => Promise<CoderReview> | CoderReview;
|
|
397
|
-
/**
|
|
398
|
-
* @experimental Winner-selection strategy among validated (+ reviewed)
|
|
399
|
-
* candidates. `highest-readiness` requires a `reviewer`. Default `highest-score`
|
|
400
|
-
* (the kernel's behavior — preserves backward compatibility).
|
|
401
|
-
*/
|
|
402
|
-
type CoderWinnerSelection = 'highest-score' | 'smallest-diff' | 'highest-readiness' | 'first-approved';
|
|
403
|
-
/** @experimental */
|
|
404
|
-
interface CreateDefaultCoderDelegateOptions {
|
|
405
|
-
/**
|
|
406
|
-
* Execution placement. Pass a {@link DelegationExecutor} (sibling or fleet)
|
|
407
|
-
* to control where worker iterations land. `sandboxClient` is a
|
|
408
|
-
* convenience shorthand that wraps the client in a sibling executor — pass
|
|
409
|
-
* one or the other, not both.
|
|
410
|
-
*/
|
|
411
|
-
executor?: DelegationExecutor;
|
|
412
|
-
/**
|
|
413
|
-
* Convenience shorthand for sibling placement. Equivalent to
|
|
414
|
-
* `executor: createSiblingSandboxExecutor({ client: sandboxClient })`.
|
|
415
|
-
*/
|
|
416
|
-
sandboxClient?: SandboxClient;
|
|
417
|
-
/** Backend harness for the single-coder path. Default comes from `coderProfile`. */
|
|
418
|
-
harness?: string;
|
|
419
|
-
/** Model override for the single-coder path. */
|
|
420
|
-
model?: string;
|
|
421
|
-
/** Default `['claude-code', 'codex', 'opencode/zai-coding-plan/glm-5.1']` when variants > 1. */
|
|
422
|
-
fanoutHarnesses?: string[];
|
|
423
|
-
/** Optional per-harness model override for `variants > 1`. */
|
|
424
|
-
fanoutModels?: (string | undefined)[];
|
|
425
|
-
/** Hard cap on the kernel's per-batch concurrency. Default 4. */
|
|
426
|
-
maxConcurrency?: number;
|
|
427
|
-
/**
|
|
428
|
-
* Optional adversarial reviewer. When set, a candidate must pass mechanical
|
|
429
|
-
* validation AND `reviewer.approved` to be eligible to win — empty/secret/
|
|
430
|
-
* test-failing patches are already gone; this catches the "compiles + passes
|
|
431
|
-
* but wrong/unsafe" class the deterministic validator can't see.
|
|
432
|
-
*/
|
|
433
|
-
reviewer?: CoderReviewer;
|
|
434
|
-
/** Winner-selection strategy among eligible candidates. Default `highest-score`. */
|
|
435
|
-
winnerSelection?: CoderWinnerSelection;
|
|
436
|
-
/**
|
|
437
|
-
* Loop trace emitter forwarded into every delegated `runLoop`. Wire
|
|
438
|
-
* `createPropagatingTraceEmitter(readTraceContextFromEnv())` here (the bin
|
|
439
|
-
* does) so delegated build-loops export their topology spans to the OTLP /
|
|
440
|
-
* Tangle Intelligence sink when `OTEL_EXPORTER_OTLP_ENDPOINT` is set — and
|
|
441
|
-
* are a cheap no-op when it isn't. Configurable by construction.
|
|
442
|
-
*/
|
|
443
|
-
traceEmitter?: LoopTraceEmitter;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Build a coder delegate that drives `runLoop` against the project's
|
|
447
|
-
* sandbox client + coder profile. When `args.variants > 1` it switches
|
|
448
|
-
* to the multi-harness fanout topology.
|
|
449
|
-
*
|
|
450
|
-
* @experimental
|
|
451
|
-
*/
|
|
452
|
-
declare function createDefaultCoderDelegate(options: CreateDefaultCoderDelegateOptions): CoderDelegate;
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* @experimental
|
|
456
|
-
*
|
|
457
|
-
* `createKbGate` — the valid-only knowledge-base growth gate, distilled from
|
|
458
|
-
* physim's KB-research subsystem. A research-in-a-loop delegate (or any KB
|
|
459
|
-
* writer) runs candidate facts through this before persisting, so the KB grows
|
|
460
|
-
* with ONLY grounded facts — hallucinated, unsourced, or laundered claims are
|
|
461
|
-
* vetoed at the gate.
|
|
462
|
-
*
|
|
463
|
-
* Fail-closed by construction: every judge must `accept`; the FIRST veto wins
|
|
464
|
-
* and the fact is rejected. The non-negotiable floor (always on, can't be
|
|
465
|
-
* disabled) is the **passage-present guard** — a fact's `verbatimPassage` MUST
|
|
466
|
-
* literally appear in its `sourceText`. That single check kills the dominant
|
|
467
|
-
* failure mode (a confident claim decoupled from any real source).
|
|
468
|
-
*
|
|
469
|
-
* Pure + dependency-free: it operates on fact candidates, not on a store, so it
|
|
470
|
-
* composes with `@tangle-network/agent-knowledge` or any persistence layer
|
|
471
|
-
* without importing it. The remediation policy (correct-on-veto vs
|
|
472
|
-
* escalate-as-unverified) is the caller's — this returns the verdict; it never
|
|
473
|
-
* drops a fact silently.
|
|
474
|
-
*/
|
|
475
|
-
/** @experimental A fact proposed for the KB, with its grounding. */
|
|
476
|
-
interface FactCandidate {
|
|
477
|
-
/** The atomic claim text. */
|
|
478
|
-
claim: string;
|
|
479
|
-
/** Optional extracted value (number or string) the claim asserts. */
|
|
480
|
-
value?: string | number;
|
|
481
|
-
/** Verbatim span lifted from the source that backs the claim. */
|
|
482
|
-
verbatimPassage: string;
|
|
483
|
-
/** The raw source text the passage must be grounded in. */
|
|
484
|
-
sourceText: string;
|
|
485
|
-
/** Where the fact claims to come from — checked for circular/self citations. */
|
|
486
|
-
citation?: string;
|
|
487
|
-
}
|
|
488
|
-
/** @experimental */
|
|
489
|
-
interface FactJudgeVerdict {
|
|
490
|
-
accept: boolean;
|
|
491
|
-
reason?: string;
|
|
492
|
-
}
|
|
493
|
-
/** @experimental A pluggable fact validator. Throw is NOT allowed — return a
|
|
494
|
-
* verdict; a thrown judge is a programmer error, not a veto. */
|
|
495
|
-
interface FactJudge {
|
|
496
|
-
name: string;
|
|
497
|
-
judge(candidate: FactCandidate): FactJudgeVerdict | Promise<FactJudgeVerdict>;
|
|
498
|
-
}
|
|
499
|
-
/** @experimental */
|
|
500
|
-
interface KbGateResult {
|
|
501
|
-
accepted: boolean;
|
|
502
|
-
/** Name of the judge that vetoed; undefined when accepted. */
|
|
503
|
-
vetoedBy?: string;
|
|
504
|
-
reason?: string;
|
|
505
|
-
}
|
|
506
|
-
/** @experimental */
|
|
507
|
-
interface CreateKbGateOptions {
|
|
508
|
-
/** Extra judges appended after the built-in floor (e.g. an LLM judge). */
|
|
509
|
-
judges?: FactJudge[];
|
|
510
|
-
/** Minimum verbatim-passage length. Default 12 — kills empty/stub passages. */
|
|
511
|
-
minPassageChars?: number;
|
|
512
|
-
/**
|
|
513
|
-
* Citation tokens that denote a SELF-generated artifact (e.g. `'spec'`,
|
|
514
|
-
* `'cad_params'`, `'requirements'`). A citation naming one is circular
|
|
515
|
-
* (laundering) — the fact cites a derived artifact, not a real source.
|
|
516
|
-
* Default `[]` (no circular check unless the consumer declares its kinds).
|
|
517
|
-
*/
|
|
518
|
-
selfArtifactKinds?: string[];
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* @experimental
|
|
522
|
-
*
|
|
523
|
-
* Build a fail-closed KB gate. The returned function runs the built-in floor
|
|
524
|
-
* (passage-non-empty → passage-present → value-in-passage → no-circular-citation)
|
|
525
|
-
* then any consumer judges, returning on the first veto.
|
|
526
|
-
*/
|
|
527
|
-
declare function createKbGate(options?: CreateKbGateOptions): (candidate: FactCandidate) => Promise<KbGateResult>;
|
|
528
|
-
|
|
529
|
-
export { type DelegateCodeConfig as A, type DelegateResearchConfig as B, type CoderReviewer as C, type DelegateCodeArgs as D, type DelegateRunCtx as E, type FactCandidate as F, type DelegateUiAuditConfig as G, type DelegateUiAuditRoute as H, type FactJudge as I, type FactJudgeVerdict as J, type FeedbackRating as K, type FeedbackRefersTo as L, type FleetWorkspaceExecutorOptions as M, type KbGateResult as N, type ResearchOutputShape as O, type UiAuditorDelegationOutput as P, createDefaultCoderDelegate as Q, type ResearcherDelegate as R, type SiblingSandboxExecutorOptions as S, createFleetWorkspaceExecutor as T, type UiAuditorDelegate as U, createKbGate as V, createSiblingSandboxExecutor as W, type CoderWinnerSelection as a, type CreateKbGateOptions as b, type FleetHandle as c, type DelegationExecutor as d, type DelegateFeedbackArgs as e, type DelegationFeedbackSnapshot as f, type DelegationProfile as g, type DelegateResearchArgs as h, type DelegateUiAuditArgs as i, type DelegationStatus as j, type DelegationProgress as k, type DelegationResultPayload as l, type DelegationError as m, type DelegationStatusResult as n, type DelegationHistoryArgs as o, type DelegationHistoryEntry as p, type CoderDelegate as q, type DelegateCodeResult as r, type DelegateFeedbackResult as s, type ResearchSource as t, type DelegateResearchResult as u, type DelegateUiAuditResult as v, type DelegationHistoryResult as w, type DelegationStatusArgs as x, type CoderReview as y, type CreateDefaultCoderDelegateOptions as z };
|