@tangle-network/agent-runtime 0.89.0 → 0.90.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 +51 -18
- package/dist/agent.d.ts +53 -2
- package/dist/agent.js +166 -4
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/{chunk-PIPPLSOF.js → chunk-4IBAMGBE.js} +33 -3
- package/dist/chunk-4IBAMGBE.js.map +1 -0
- package/dist/chunk-5QOB7H74.js +387 -0
- package/dist/chunk-5QOB7H74.js.map +1 -0
- package/dist/chunk-74SBMDTO.js +214 -0
- package/dist/chunk-74SBMDTO.js.map +1 -0
- package/dist/{chunk-BQPFZE2C.js → chunk-MHK62APK.js} +5 -5
- package/dist/{chunk-N7EJV7N3.js → chunk-QSNSMJSZ.js} +3417 -3393
- package/dist/chunk-QSNSMJSZ.js.map +1 -0
- package/dist/{chunk-VNOOH22O.js → chunk-XMOU4WEY.js} +74 -3
- package/dist/chunk-XMOU4WEY.js.map +1 -0
- package/dist/{chunk-5AVV7KAH.js → chunk-XQEISTK2.js} +2 -2
- package/dist/{worktree-harness-CX_McRLp.d.ts → completion-gate-BDaBP8dd.d.ts} +44 -44
- package/dist/{coordination-CuDLO8wj.d.ts → coordination-DxHduZg7.d.ts} +414 -226
- package/dist/environment-provider.d.ts +3 -3
- package/dist/index.d.ts +156 -13
- package/dist/index.js +316 -70
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +2 -2
- package/dist/knowledge.d.ts +120 -0
- package/dist/knowledge.js +28 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/lifecycle.js +1 -1
- package/dist/{loop-runner-bin-hQDUL8Ld.d.ts → loop-runner-bin-D3GmB2Ru.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +5 -5
- package/dist/loop-runner-bin.js +5 -5
- package/dist/loops.d.ts +46 -141
- package/dist/loops.js +3 -3
- package/dist/mcp/bin.js +2 -2
- package/dist/mcp/index.d.ts +8 -9
- package/dist/mcp/index.js +7 -7
- package/dist/{openai-tools-BnrOmGjN.d.ts → openai-tools-D0xmzo0y.d.ts} +1 -1
- package/dist/profiles.d.ts +196 -5
- package/dist/profiles.js +8 -0
- package/dist/profiles.js.map +1 -1
- package/dist/{router-client-r8y_VFVM.d.ts → router-client-DJImUDlm.d.ts} +1 -1
- package/dist/supervise-BpCdssu0.d.ts +131 -0
- package/dist/{types-Driepl87.d.ts → types-DAJQRIUD.d.ts} +2 -2
- package/dist/{types-ESeMOj94.d.ts → types-Dnk189QA.d.ts} +1 -1
- package/dist/{worktree-fanout-D6xR2CIA.d.ts → worktree-fanout-CfRXYmgV.d.ts} +3 -3
- package/package.json +12 -4
- package/skills/agent-runtime-adoption/SKILL.md +74 -24
- package/skills/build-with-agent-runtime/SKILL.md +3 -3
- package/skills/loop-writer/SKILL.md +6 -5
- package/skills/supervise/SKILL.md +2 -2
- package/dist/chunk-N7EJV7N3.js.map +0 -1
- package/dist/chunk-PIPPLSOF.js.map +0 -1
- package/dist/chunk-VNOOH22O.js.map +0 -1
- package/dist/otel-export-BKmNwiCb.d.ts +0 -180
- /package/dist/{chunk-BQPFZE2C.js.map → chunk-MHK62APK.js.map} +0 -0
- /package/dist/{chunk-5AVV7KAH.js.map → chunk-XQEISTK2.js.map} +0 -0
package/dist/mcp/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
coderTaskToPrompt
|
|
3
|
+
} from "../chunk-5IBQAPVB.js";
|
|
1
4
|
import {
|
|
2
5
|
createPropagatingTraceEmitter,
|
|
3
6
|
readTraceContextFromEnv,
|
|
@@ -6,7 +9,7 @@ import {
|
|
|
6
9
|
import {
|
|
7
10
|
mcpToolsForRuntimeMcp,
|
|
8
11
|
mcpToolsForRuntimeMcpSubset
|
|
9
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-XQEISTK2.js";
|
|
10
13
|
import {
|
|
11
14
|
createKbGate
|
|
12
15
|
} from "../chunk-SGKPNBXE.js";
|
|
@@ -14,7 +17,7 @@ import {
|
|
|
14
17
|
assertTraceDerivedFindings,
|
|
15
18
|
runCoderChecks,
|
|
16
19
|
selectValidWinner
|
|
17
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-4IBAMGBE.js";
|
|
18
21
|
import {
|
|
19
22
|
DELEGATE_DESCRIPTION,
|
|
20
23
|
DELEGATE_FEEDBACK_DESCRIPTION,
|
|
@@ -64,7 +67,8 @@ import {
|
|
|
64
67
|
validateDelegateUiAuditArgs,
|
|
65
68
|
validateDelegationHistoryArgs,
|
|
66
69
|
validateDelegationStatusArgs
|
|
67
|
-
} from "../chunk-
|
|
70
|
+
} from "../chunk-QSNSMJSZ.js";
|
|
71
|
+
import "../chunk-DPEUKJRO.js";
|
|
68
72
|
import "../chunk-UD4BHQMI.js";
|
|
69
73
|
import {
|
|
70
74
|
deleteBoxSafe,
|
|
@@ -79,10 +83,6 @@ import {
|
|
|
79
83
|
import {
|
|
80
84
|
ValidationError
|
|
81
85
|
} from "../chunk-YEJR7IXO.js";
|
|
82
|
-
import {
|
|
83
|
-
coderTaskToPrompt
|
|
84
|
-
} from "../chunk-5IBQAPVB.js";
|
|
85
|
-
import "../chunk-DPEUKJRO.js";
|
|
86
86
|
import "../chunk-DGUM43GV.js";
|
|
87
87
|
|
|
88
88
|
// src/mcp/executor.ts
|
package/dist/profiles.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as UiFinding, U as UiLens } from './substrate-DO2GHNg2.js';
|
|
2
2
|
export { C as CoderTask, b as UI_FINDING_SEVERITIES, c as UI_LENSES, d as UiFindingScreenshot, e as UiFindingSeverity, f as coderTaskToPrompt } from './substrate-DO2GHNg2.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
3
|
+
import { AgentProfile, SandboxEvent } from '@tangle-network/sandbox';
|
|
4
|
+
import { V as Validator, A as AgentRunSpec, b as OutputAdapter, D as Driver, S as SandboxClient } from './types-Dnk189QA.js';
|
|
5
|
+
import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
6
6
|
import '@tangle-network/agent-eval';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -96,6 +96,197 @@ declare function summarizeRegistry(reg: AuditRegistry): AuditIndex;
|
|
|
96
96
|
*/
|
|
97
97
|
declare function writeAuditIndex(workspaceDir: string): Promise<string>;
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Opinionated preset for source-grounded research
|
|
101
|
+
* tasks. The agent is told to:
|
|
102
|
+
* - bound its work to a single `knowledgeNamespace`
|
|
103
|
+
* - emit `items[]` carrying provenance + confidence
|
|
104
|
+
* - emit `citations[]` linking quotes back to source urls
|
|
105
|
+
* - emit `proposedWrites[]` — never call materialize itself
|
|
106
|
+
* - describe `gaps` it could not answer
|
|
107
|
+
*
|
|
108
|
+
* The profile is stateless and agent-agnostic. `harness` selects the
|
|
109
|
+
* sandbox-SDK backend. For heterogeneous fanout, use
|
|
110
|
+
* `multiHarnessResearcherFanout`.
|
|
111
|
+
*
|
|
112
|
+
* Propose-don't-apply: the profile NEVER writes to the knowledge base.
|
|
113
|
+
* It produces `proposedWrites: KnowledgeUpdate[]` in the output. The
|
|
114
|
+
* caller (gtm-agent, journey-eval, user) decides whether to feed those
|
|
115
|
+
* updates through `applyKnowledgeWriteBlocks` / a KbStore put.
|
|
116
|
+
*
|
|
117
|
+
* Namespace isolation: every `KnowledgeItem` + `KnowledgeUpdate` in the
|
|
118
|
+
* output carries `namespace`. The validator hard-fails when any item
|
|
119
|
+
* touches a namespace other than `task.knowledgeNamespace`.
|
|
120
|
+
*
|
|
121
|
+
* @experimental
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/** Source families a researcher profile may prefer for a task. @experimental */
|
|
125
|
+
type ResearchSource = 'web' | 'corpus' | 'twitter' | 'github' | 'docs';
|
|
126
|
+
/** Task contract for a source-grounded research agent. @experimental */
|
|
127
|
+
interface ResearchTask {
|
|
128
|
+
/** The research question to answer. */
|
|
129
|
+
question: string;
|
|
130
|
+
/** Bound: e.g. "audience for cpg-founder ICP". */
|
|
131
|
+
scope?: string;
|
|
132
|
+
/** Multi-tenant scope (customer-id, workspace-id). Validator enforces. */
|
|
133
|
+
knowledgeNamespace: string;
|
|
134
|
+
sources?: ResearchSource[];
|
|
135
|
+
recencyWindow?: {
|
|
136
|
+
since?: Date;
|
|
137
|
+
until?: Date;
|
|
138
|
+
};
|
|
139
|
+
maxItems?: number;
|
|
140
|
+
/** Per-item minimum confidence in [0, 1]. Validator scores recall vs this. */
|
|
141
|
+
minConfidence?: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Knowledge item emitted by the researcher.
|
|
145
|
+
*
|
|
146
|
+
* Profile-local type. When agent-knowledge promotes `KnowledgeClaim` →
|
|
147
|
+
* top-level `KnowledgeItem` substrate-wide, these fields collapse 1:1.
|
|
148
|
+
*
|
|
149
|
+
* @experimental
|
|
150
|
+
*/
|
|
151
|
+
interface KnowledgeItem {
|
|
152
|
+
id: string;
|
|
153
|
+
/** Multi-tenant scope. MUST equal `task.knowledgeNamespace`. */
|
|
154
|
+
namespace: string;
|
|
155
|
+
/** The factual claim, in the researcher's words. */
|
|
156
|
+
claim: string;
|
|
157
|
+
/** Provenance — at least one entry required. */
|
|
158
|
+
evidence: Array<{
|
|
159
|
+
source: string;
|
|
160
|
+
quote?: string;
|
|
161
|
+
url?: string;
|
|
162
|
+
capturedAt: number;
|
|
163
|
+
}>;
|
|
164
|
+
/** Researcher's self-reported confidence in [0, 1]. */
|
|
165
|
+
confidence: number;
|
|
166
|
+
/** Prior item ids this supersedes (chain). */
|
|
167
|
+
supersedes?: string[];
|
|
168
|
+
/** Set if the agent is retracting an earlier item. Unix ms. */
|
|
169
|
+
retractedAt?: number;
|
|
170
|
+
authoredBy: {
|
|
171
|
+
kind: 'human' | 'agent';
|
|
172
|
+
id: string;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* A proposed write to the knowledge base. The profile does NOT apply
|
|
177
|
+
* these — the caller decides.
|
|
178
|
+
*
|
|
179
|
+
* @experimental
|
|
180
|
+
*/
|
|
181
|
+
type KnowledgeUpdate = {
|
|
182
|
+
kind: 'insert';
|
|
183
|
+
namespace: string;
|
|
184
|
+
item: KnowledgeItem;
|
|
185
|
+
} | {
|
|
186
|
+
kind: 'supersede';
|
|
187
|
+
namespace: string;
|
|
188
|
+
previousId: string;
|
|
189
|
+
item: KnowledgeItem;
|
|
190
|
+
} | {
|
|
191
|
+
kind: 'retract';
|
|
192
|
+
namespace: string;
|
|
193
|
+
itemId: string;
|
|
194
|
+
reason: string;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Researcher output. Required fields are typed; optional fields preserve
|
|
198
|
+
* the agent's free-form intelligence (`notes`, `raw`). The validator
|
|
199
|
+
* enforces the typed minimum.
|
|
200
|
+
*
|
|
201
|
+
* @experimental
|
|
202
|
+
*/
|
|
203
|
+
interface ResearchOutput {
|
|
204
|
+
items: KnowledgeItem[];
|
|
205
|
+
citations: Array<{
|
|
206
|
+
url: string;
|
|
207
|
+
quote: string;
|
|
208
|
+
confidence: number;
|
|
209
|
+
}>;
|
|
210
|
+
proposedWrites: KnowledgeUpdate[];
|
|
211
|
+
gaps?: string[];
|
|
212
|
+
notes?: string;
|
|
213
|
+
/** Anything the agent emitted beyond the typed fields. */
|
|
214
|
+
raw?: unknown;
|
|
215
|
+
}
|
|
216
|
+
/** Options for the source-grounded researcher profile preset. @experimental */
|
|
217
|
+
interface ResearcherProfileOptions {
|
|
218
|
+
/** Sandbox-SDK backend.type. Default `'opencode/zai-coding-plan/glm-5.1'`. */
|
|
219
|
+
harness?: string;
|
|
220
|
+
/** Default model id passed in `AgentProfile.model.default`. */
|
|
221
|
+
model?: string;
|
|
222
|
+
/** Custom system prompt replacement. Default = built-in researcher preset. */
|
|
223
|
+
systemPrompt?: string;
|
|
224
|
+
/** Stable name for `AgentRunSpec.name`. Default = `researcher-${harness}`. */
|
|
225
|
+
name?: string;
|
|
226
|
+
/**
|
|
227
|
+
* Default 0.7. Minimum (citations with quote) / items ratio for `valid=true`.
|
|
228
|
+
* Below this floor, citation_density scores < 1 and the item set is gated.
|
|
229
|
+
*/
|
|
230
|
+
citationDensityMin?: number;
|
|
231
|
+
}
|
|
232
|
+
/** Build a source-grounded researcher profile with output parsing and validation. @experimental */
|
|
233
|
+
declare function researcherProfile(options?: ResearcherProfileOptions & {
|
|
234
|
+
task?: ResearchTask;
|
|
235
|
+
}): {
|
|
236
|
+
profile: AgentProfile;
|
|
237
|
+
taskToPrompt: (task: ResearchTask) => string;
|
|
238
|
+
output: OutputAdapter<ResearchOutput>;
|
|
239
|
+
validator: Validator<ResearchOutput>;
|
|
240
|
+
agentRunSpec: AgentRunSpec<ResearchTask>;
|
|
241
|
+
};
|
|
242
|
+
/** @experimental */
|
|
243
|
+
interface MultiHarnessResearcherFanoutOptions {
|
|
244
|
+
/** Backend.type identifiers, one per parallel agent. */
|
|
245
|
+
harnesses?: string[];
|
|
246
|
+
/** Optional per-harness model override. Indexed parallel to `harnesses`. */
|
|
247
|
+
models?: (string | undefined)[];
|
|
248
|
+
/** Default citation density floor for the shared validator. */
|
|
249
|
+
citationDensityMin?: number;
|
|
250
|
+
/** Optional task — narrows the validator's namespace check. */
|
|
251
|
+
task?: ResearchTask;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Build a fanout topology over multiple harnesses. The kernel round-robins
|
|
255
|
+
* `agentRuns` across the N parallel iterations and the `FanoutVote` driver
|
|
256
|
+
* picks the highest-scoring valid output.
|
|
257
|
+
*
|
|
258
|
+
* @experimental
|
|
259
|
+
*/
|
|
260
|
+
declare function multiHarnessResearcherFanout(options?: MultiHarnessResearcherFanoutOptions): {
|
|
261
|
+
agentRuns: AgentRunSpec<ResearchTask>[];
|
|
262
|
+
output: OutputAdapter<ResearchOutput>;
|
|
263
|
+
validator: Validator<ResearchOutput>;
|
|
264
|
+
driver: Driver<ResearchTask, ResearchOutput, 'done'>;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Build a validator that closes over a specific `ResearchTask`'s constraints.
|
|
268
|
+
*
|
|
269
|
+
* Checks in order:
|
|
270
|
+
* 1. Items must be non-empty.
|
|
271
|
+
* 2. Every item carries `evidence.length >= 1`.
|
|
272
|
+
* 3. Every item + proposedWrite is scoped to `task.knowledgeNamespace`
|
|
273
|
+
* (hard-fail on any namespace mismatch — defence in depth for the
|
|
274
|
+
* multi-tenant invariant).
|
|
275
|
+
* 4. Citation density (citations with quote / items) >= floor.
|
|
276
|
+
*
|
|
277
|
+
* Aggregate score:
|
|
278
|
+
* 0.4 · citation_density
|
|
279
|
+
* + 0.2 · source_diversity (distinct sources / max(items, 1))
|
|
280
|
+
* + 0.2 · recency_match (mean fraction within `recencyWindow`)
|
|
281
|
+
* + 0.2 · (1 − gaps/maxGaps), maxGaps = max(items, 1)
|
|
282
|
+
*
|
|
283
|
+
* @experimental
|
|
284
|
+
*/
|
|
285
|
+
declare function createResearcherValidator(task: ResearchTask, config?: {
|
|
286
|
+
citationDensityMin?: number;
|
|
287
|
+
namespaceCheck?: boolean;
|
|
288
|
+
}): Validator<ResearchOutput>;
|
|
289
|
+
|
|
99
290
|
/**
|
|
100
291
|
*
|
|
101
292
|
* UI auditor task + output shapes — what one iteration of the audit loop
|
|
@@ -440,7 +631,7 @@ interface UiAuditorProfileOptions {
|
|
|
440
631
|
* @experimental
|
|
441
632
|
*/
|
|
442
633
|
declare function uiAuditorProfile(options?: UiAuditorProfileOptions): {
|
|
443
|
-
profile: AgentProfile;
|
|
634
|
+
profile: AgentProfile$1;
|
|
444
635
|
taskToPrompt: (task: UiAuditTask) => string;
|
|
445
636
|
output: OutputAdapter<UiAuditOutput>;
|
|
446
637
|
validator: Validator<UiAuditOutput>;
|
|
@@ -511,4 +702,4 @@ declare function formatAuditorPrompt(task: UiAuditTask): string;
|
|
|
511
702
|
/** Build a `Validator` that rejects off-lens findings and findings missing screenshot evidence. @experimental */
|
|
512
703
|
declare function createUiAuditorValidator(task: UiAuditTask): Validator<UiAuditOutput>;
|
|
513
704
|
|
|
514
|
-
export { type AppendFindingsResult, type AuditIndex, type AuditRegistry, type AuditRegistryCapture, type BrowserContextHandle, type BrowserHandle, type InProcessUiAuditClientOptions, LENS_BRIEFS, type PageHandle, type RegisterCapturesOptions, SHARED_AUDITOR_RULES, type UiAuditCapture, type UiAuditCaptureRequest, type UiAuditOutput, type UiAuditTask, type UiAuditViewport, type UiAuditorProfileOptions, UiFinding, type UiJudge, type UiJudgeInput, type UiJudgeOutput, type UiJudgeTokenUsage, UiLens, appendFindings, buildAuditorSystemPrompt, createInProcessUiAuditClient, createUiAuditorValidator, decodeAuditTaskEnvelope, encodeAuditTaskEnvelope, formatAuditorPrompt, initAuditWorkspace, parseAuditorEvents, readAuditRegistry, registerCaptures, summarizeRegistry, uiAuditorProfile, writeAuditIndex };
|
|
705
|
+
export { type AppendFindingsResult, type AuditIndex, type AuditRegistry, type AuditRegistryCapture, type BrowserContextHandle, type BrowserHandle, type InProcessUiAuditClientOptions, type KnowledgeItem, type KnowledgeUpdate, LENS_BRIEFS, type MultiHarnessResearcherFanoutOptions, type PageHandle, type RegisterCapturesOptions, type ResearchOutput, type ResearchSource, type ResearchTask, type ResearcherProfileOptions, SHARED_AUDITOR_RULES, type UiAuditCapture, type UiAuditCaptureRequest, type UiAuditOutput, type UiAuditTask, type UiAuditViewport, type UiAuditorProfileOptions, UiFinding, type UiJudge, type UiJudgeInput, type UiJudgeOutput, type UiJudgeTokenUsage, UiLens, appendFindings, buildAuditorSystemPrompt, createInProcessUiAuditClient, createResearcherValidator, createUiAuditorValidator, decodeAuditTaskEnvelope, encodeAuditTaskEnvelope, formatAuditorPrompt, initAuditWorkspace, multiHarnessResearcherFanout, parseAuditorEvents, readAuditRegistry, registerCaptures, researcherProfile, summarizeRegistry, uiAuditorProfile, writeAuditIndex };
|
package/dist/profiles.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
coderTaskToPrompt
|
|
3
3
|
} from "./chunk-5IBQAPVB.js";
|
|
4
|
+
import {
|
|
5
|
+
createResearcherValidator,
|
|
6
|
+
multiHarnessResearcherFanout,
|
|
7
|
+
researcherProfile
|
|
8
|
+
} from "./chunk-5QOB7H74.js";
|
|
4
9
|
import {
|
|
5
10
|
UI_FINDING_SEVERITIES,
|
|
6
11
|
UI_LENSES
|
|
@@ -851,14 +856,17 @@ export {
|
|
|
851
856
|
buildAuditorSystemPrompt,
|
|
852
857
|
coderTaskToPrompt,
|
|
853
858
|
createInProcessUiAuditClient,
|
|
859
|
+
createResearcherValidator,
|
|
854
860
|
createUiAuditorValidator,
|
|
855
861
|
decodeAuditTaskEnvelope,
|
|
856
862
|
encodeAuditTaskEnvelope,
|
|
857
863
|
formatAuditorPrompt,
|
|
858
864
|
initAuditWorkspace,
|
|
865
|
+
multiHarnessResearcherFanout,
|
|
859
866
|
parseAuditorEvents,
|
|
860
867
|
readAuditRegistry,
|
|
861
868
|
registerCaptures,
|
|
869
|
+
researcherProfile,
|
|
862
870
|
summarizeRegistry,
|
|
863
871
|
uiAuditorProfile,
|
|
864
872
|
writeAuditIndex
|