@tangle-network/agent-runtime 0.94.10 → 0.94.12
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 +65 -1
- package/dist/agent.d.ts +2 -1
- package/dist/agent.js +2 -1
- package/dist/agent.js.map +1 -1
- package/dist/{agentic-generator-1g7GDba7.d.ts → agentic-generator-DDMM45kZ.d.ts} +46 -6
- package/dist/analyst-loop.d.ts +2 -1
- package/dist/backends-BO4Jqoe2.d.ts +134 -0
- package/dist/chunk-AEG3NGJ2.js +639 -0
- package/dist/chunk-AEG3NGJ2.js.map +1 -0
- package/dist/{chunk-GHXW56PO.js → chunk-D3H7F6L2.js} +136 -36
- package/dist/chunk-D3H7F6L2.js.map +1 -0
- package/dist/{chunk-7NCP74SL.js → chunk-PCURO3DL.js} +4 -4
- package/dist/chunk-PCURO3DL.js.map +1 -0
- package/dist/{chunk-YP6B7RZ2.js → chunk-U33YZ7B2.js} +6 -635
- package/dist/chunk-U33YZ7B2.js.map +1 -0
- package/dist/chunk-VYA2YEKA.js +1187 -0
- package/dist/chunk-VYA2YEKA.js.map +1 -0
- package/dist/{chunk-MXBQNVFE.js → chunk-XP5KDM3R.js} +5 -5
- package/dist/{completion-gate-BB4IZwyh.d.ts → completion-gate-D1gX1-hg.d.ts} +2 -2
- package/dist/conversation.d.ts +793 -0
- package/dist/conversation.js +56 -0
- package/dist/conversation.js.map +1 -0
- package/dist/{coordination-CyVQ61My.d.ts → coordination-Dr_axlAf.d.ts} +6 -5
- package/dist/environment-provider.d.ts +3 -2
- package/dist/{improve-DZeatcs7.d.ts → improve-BN3HyXIO.d.ts} +2 -2
- package/dist/index.d.ts +29 -943
- package/dist/index.js +58 -1159
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +6 -5
- package/dist/intelligence.js +5 -5
- package/dist/knowledge.d.ts +8 -7
- package/dist/lifecycle.d.ts +3 -3
- package/dist/lifecycle.js +1 -1
- package/dist/{local-harness-ZLMkKdZc.d.ts → local-harness-ZqCx51u7.d.ts} +1 -1
- package/dist/{loop-runner-bin-DA3ccCAs.d.ts → loop-runner-bin-BRQSQdHa.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +7 -6
- package/dist/loop-runner-bin.js +4 -3
- package/dist/loops.d.ts +16 -15
- package/dist/loops.js +2 -1
- package/dist/mcp/index.d.ts +11 -10
- package/dist/mcp/index.js +2 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/{mcp-serve-verifier-BO4MEsR3.d.ts → mcp-serve-verifier-DQQDbuyz.d.ts} +1 -1
- package/dist/{openai-tools-0wACz8f8.d.ts → openai-tools-fnj6SRVg.d.ts} +1 -1
- package/dist/primeintellect/index.d.ts +214 -0
- package/dist/primeintellect/index.js +1120 -0
- package/dist/primeintellect/index.js.map +1 -0
- package/dist/profiles.d.ts +2 -1
- package/dist/{sanitize-Dcbjp0tU.d.ts → sanitize-BTSsdBXw.d.ts} +1 -1
- package/dist/{supervise-BaEsCHNh.d.ts → supervise-DmYOug5f.d.ts} +4 -4
- package/dist/{types-CogNCaw7.d.ts → types-1d5QGK3t.d.ts} +1 -1
- package/dist/types-BwoZWq-i.d.ts +510 -0
- package/dist/{types-CKmyZ9TP.d.ts → types-ByAYqlVb.d.ts} +3 -509
- package/dist/{worktree-fanout-Do2YbtFD.d.ts → worktree-fanout-CPprU-qI.d.ts} +4 -4
- package/package.json +15 -3
- package/dist/chunk-7NCP74SL.js.map +0 -1
- package/dist/chunk-GHXW56PO.js.map +0 -1
- package/dist/chunk-YP6B7RZ2.js.map +0 -1
- /package/dist/{chunk-MXBQNVFE.js.map → chunk-XP5KDM3R.js.map} +0 -0
|
@@ -1,512 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DefaultVerdict } from '@tangle-network/agent-eval';
|
|
2
2
|
import { CreateSandboxOptions, SandboxInstance, SandboxEvent, AgentProfile } from '@tangle-network/sandbox';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* Core task, session, adapter, and stream-event types for the runtime.
|
|
7
|
-
*
|
|
8
|
-
* This module owns the public shape of every cross-cutting record (`TaskSpec`,
|
|
9
|
-
* `RuntimeSession`, `RuntimeStreamEvent`). Everything else in the runtime
|
|
10
|
-
* imports from here so type-level changes ripple in one place.
|
|
11
|
-
*
|
|
12
|
-
* @stable
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/** @stable */
|
|
16
|
-
interface AgentTaskSpec {
|
|
17
|
-
id: string;
|
|
18
|
-
intent: string;
|
|
19
|
-
/** Domain is metadata, not an architectural boundary: tax, legal, gtm, creative, blueprint, redteam, etc. */
|
|
20
|
-
domain?: string;
|
|
21
|
-
inputs?: Record<string, unknown>;
|
|
22
|
-
requiredKnowledge?: KnowledgeRequirement[];
|
|
23
|
-
budget?: Partial<ControlBudget>;
|
|
24
|
-
metadata?: Record<string, unknown>;
|
|
25
|
-
}
|
|
26
|
-
/** @stable */
|
|
27
|
-
interface AgentKnowledgeProvider {
|
|
28
|
-
buildReadiness?(task: AgentTaskSpec): Promise<KnowledgeReadinessReport> | KnowledgeReadinessReport;
|
|
29
|
-
answerQuestions?(questions: UserQuestion[], task: AgentTaskSpec): Promise<Record<string, string>> | Record<string, string>;
|
|
30
|
-
executeAcquisitionPlans?(plans: DataAcquisitionPlan[], task: AgentTaskSpec): Promise<string[]> | string[];
|
|
31
|
-
refreshReadiness?(input: {
|
|
32
|
-
task: AgentTaskSpec;
|
|
33
|
-
previous: KnowledgeReadinessReport;
|
|
34
|
-
userAnswers: Record<string, string>;
|
|
35
|
-
acquiredEvidenceIds: string[];
|
|
36
|
-
}): Promise<KnowledgeReadinessReport> | KnowledgeReadinessReport;
|
|
37
|
-
}
|
|
38
|
-
/** @stable */
|
|
39
|
-
interface AgentTaskContext<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
|
|
40
|
-
task: AgentTaskSpec;
|
|
41
|
-
knowledge: KnowledgeReadinessReport;
|
|
42
|
-
state: TState;
|
|
43
|
-
evals: TEval[];
|
|
44
|
-
history: ControlStep<TState, TAction, TActionResult, TEval>[];
|
|
45
|
-
budget: ControlBudget;
|
|
46
|
-
stepIndex: number;
|
|
47
|
-
wallMs: number;
|
|
48
|
-
spentCostUsd: number;
|
|
49
|
-
remainingCostUsd?: number;
|
|
50
|
-
abortSignal: AbortSignal;
|
|
51
|
-
}
|
|
52
|
-
/** @stable */
|
|
53
|
-
interface AgentAdapter<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
|
|
54
|
-
observe(ctx: {
|
|
55
|
-
task: AgentTaskSpec;
|
|
56
|
-
knowledge: KnowledgeReadinessReport;
|
|
57
|
-
history: ControlStep<TState, TAction, TActionResult, TEval>[];
|
|
58
|
-
abortSignal: AbortSignal;
|
|
59
|
-
}): Promise<TState> | TState;
|
|
60
|
-
validate(ctx: {
|
|
61
|
-
task: AgentTaskSpec;
|
|
62
|
-
knowledge: KnowledgeReadinessReport;
|
|
63
|
-
state: TState;
|
|
64
|
-
history: ControlStep<TState, TAction, TActionResult, TEval>[];
|
|
65
|
-
abortSignal: AbortSignal;
|
|
66
|
-
}): Promise<TEval[]> | TEval[];
|
|
67
|
-
decide(ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<ControlDecision<TAction>> | ControlDecision<TAction>;
|
|
68
|
-
act(action: TAction, ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<TActionResult> | TActionResult;
|
|
69
|
-
shouldStop?(ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<{
|
|
70
|
-
stop: boolean;
|
|
71
|
-
pass: boolean;
|
|
72
|
-
reason: string;
|
|
73
|
-
score?: number;
|
|
74
|
-
}> | {
|
|
75
|
-
stop: boolean;
|
|
76
|
-
pass: boolean;
|
|
77
|
-
reason: string;
|
|
78
|
-
score?: number;
|
|
79
|
-
};
|
|
80
|
-
onKnowledgeBlocked?(ctx: {
|
|
81
|
-
task: AgentTaskSpec;
|
|
82
|
-
knowledge: KnowledgeReadinessReport;
|
|
83
|
-
questions: UserQuestion[];
|
|
84
|
-
acquisitionPlans: DataAcquisitionPlan[];
|
|
85
|
-
}): Promise<ControlDecision<TAction>> | ControlDecision<TAction>;
|
|
86
|
-
getActionCostUsd?(ctx: {
|
|
87
|
-
action: TAction;
|
|
88
|
-
result: TActionResult;
|
|
89
|
-
task: AgentTaskSpec;
|
|
90
|
-
state: TState;
|
|
91
|
-
evals: TEval[];
|
|
92
|
-
history: ControlStep<TState, TAction, TActionResult, TEval>[];
|
|
93
|
-
}): number | undefined;
|
|
94
|
-
projectRunRecords?(result: ControlRunResult<TState, TAction, TActionResult, TEval>, task: AgentTaskSpec): RunRecord[];
|
|
95
|
-
}
|
|
96
|
-
/** @stable */
|
|
97
|
-
type AgentTaskStatus = 'completed' | 'blocked' | 'failed' | 'aborted';
|
|
98
|
-
/** @stable */
|
|
99
|
-
type AgentRuntimeEvent<TState = unknown, TAction = unknown, TActionResult = unknown, TEval extends ControlEvalResult = ControlEvalResult> = {
|
|
100
|
-
type: 'task_start';
|
|
101
|
-
task: AgentTaskSpec;
|
|
102
|
-
} | {
|
|
103
|
-
type: 'readiness_start';
|
|
104
|
-
task: AgentTaskSpec;
|
|
105
|
-
} | {
|
|
106
|
-
type: 'readiness_end';
|
|
107
|
-
task: AgentTaskSpec;
|
|
108
|
-
knowledge: KnowledgeReadinessReport;
|
|
109
|
-
} | {
|
|
110
|
-
type: 'questions_start';
|
|
111
|
-
task: AgentTaskSpec;
|
|
112
|
-
questions: UserQuestion[];
|
|
113
|
-
} | {
|
|
114
|
-
type: 'questions_end';
|
|
115
|
-
task: AgentTaskSpec;
|
|
116
|
-
questions: UserQuestion[];
|
|
117
|
-
userAnswers: Record<string, string>;
|
|
118
|
-
} | {
|
|
119
|
-
type: 'acquisition_start';
|
|
120
|
-
task: AgentTaskSpec;
|
|
121
|
-
acquisitionPlans: DataAcquisitionPlan[];
|
|
122
|
-
} | {
|
|
123
|
-
type: 'acquisition_end';
|
|
124
|
-
task: AgentTaskSpec;
|
|
125
|
-
acquisitionPlans: DataAcquisitionPlan[];
|
|
126
|
-
acquiredEvidenceIds: string[];
|
|
127
|
-
} | {
|
|
128
|
-
type: 'control_start';
|
|
129
|
-
task: AgentTaskSpec;
|
|
130
|
-
knowledge: KnowledgeReadinessReport;
|
|
131
|
-
} | {
|
|
132
|
-
type: 'control_step';
|
|
133
|
-
task: AgentTaskSpec;
|
|
134
|
-
step: ControlStep<TState, TAction, TActionResult, TEval>;
|
|
135
|
-
} | {
|
|
136
|
-
type: 'control_end';
|
|
137
|
-
task: AgentTaskSpec;
|
|
138
|
-
control: ControlRunResult<TState, TAction, TActionResult, TEval>;
|
|
139
|
-
} | {
|
|
140
|
-
type: 'task_end';
|
|
141
|
-
task: AgentTaskSpec;
|
|
142
|
-
status: AgentTaskStatus;
|
|
143
|
-
reason: string;
|
|
144
|
-
};
|
|
145
|
-
/** @stable */
|
|
146
|
-
type AgentRuntimeEventSink<TState = unknown, TAction = unknown, TActionResult = unknown, TEval extends ControlEvalResult = ControlEvalResult> = (event: AgentRuntimeEvent<TState, TAction, TActionResult, TEval>) => Promise<void> | void;
|
|
147
|
-
/**
|
|
148
|
-
*
|
|
149
|
-
* Typed transport / backend failure detail. Carried on `backend_error` and
|
|
150
|
-
* `final` events when the backend's stream throws or the upstream HTTP call
|
|
151
|
-
* returns a non-success status. Lets consumers (a) distinguish "stream
|
|
152
|
-
* completed with no text" from "stream never reached the model" and
|
|
153
|
-
* (b) reconstruct the precise upstream signal (status + truncated body) when
|
|
154
|
-
* building a `RunRecord.error`.
|
|
155
|
-
*
|
|
156
|
-
* `body` is truncated to 2 KiB by the backend so an HTML error page from a
|
|
157
|
-
* misconfigured proxy never bloats event payloads or logs. Consumers needing
|
|
158
|
-
* the full body should inspect the underlying `BackendTransportError.body`
|
|
159
|
-
* via a custom `mapEvent` or backend wrapper.
|
|
160
|
-
*
|
|
161
|
-
* @stable
|
|
162
|
-
*/
|
|
163
|
-
interface BackendErrorDetail {
|
|
164
|
-
/**
|
|
165
|
-
* `'transport'` — upstream HTTP / network failure with optional status code.
|
|
166
|
-
* `'backend'` — the backend's `stream()` generator threw for a non-transport
|
|
167
|
-
* reason (e.g. a custom adapter error, sandbox crash).
|
|
168
|
-
*/
|
|
169
|
-
kind: 'transport' | 'backend';
|
|
170
|
-
message: string;
|
|
171
|
-
/** Upstream HTTP status when known. `0` for connection / abort errors. */
|
|
172
|
-
status?: number;
|
|
173
|
-
/** Truncated response body (≤2 KiB). Diagnostic only — never machine-parsed. */
|
|
174
|
-
body?: string;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
*
|
|
178
|
-
* OpenAI Chat Completions tool descriptor. The shape mirrors the
|
|
179
|
-
* `/v1/chat/completions` `tools[]` parameter so callers can pass tool
|
|
180
|
-
* definitions through `createOpenAICompatibleBackend({ tools })` without any
|
|
181
|
-
* runtime translation. The router proxies this shape verbatim to Anthropic
|
|
182
|
-
* (translated server-side), DeepSeek, Groq, OpenAI, and Gemini — every model
|
|
183
|
-
* that the eval surface targets.
|
|
184
|
-
*
|
|
185
|
-
* Callers that build their tool list from MCP servers should run a one-shot
|
|
186
|
-
* MCP `tools/list` at config time and project the result into this shape. The
|
|
187
|
-
* runtime intentionally does NOT depend on `@modelcontextprotocol/sdk` —
|
|
188
|
-
* keeping the backend transport thin lets domain repos own MCP plumbing.
|
|
189
|
-
*
|
|
190
|
-
* @stable
|
|
191
|
-
*/
|
|
192
|
-
interface OpenAIChatTool {
|
|
193
|
-
type: 'function';
|
|
194
|
-
function: {
|
|
195
|
-
name: string;
|
|
196
|
-
description?: string;
|
|
197
|
-
parameters?: Record<string, unknown>;
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
*
|
|
202
|
-
* `tool_choice` parameter for OpenAI-compat chat. Same shape as the OpenAI
|
|
203
|
-
* spec: `'auto'` (default — model decides), `'none'` (disable tool calling
|
|
204
|
-
* for this turn), `'required'` (force a tool call), or a specific function
|
|
205
|
-
* pin `{ type: 'function', function: { name } }`.
|
|
206
|
-
*
|
|
207
|
-
* @stable
|
|
208
|
-
*/
|
|
209
|
-
type OpenAIChatToolChoice = 'auto' | 'none' | 'required' | {
|
|
210
|
-
type: 'function';
|
|
211
|
-
function: {
|
|
212
|
-
name: string;
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
/**
|
|
216
|
-
*
|
|
217
|
-
* `response_format` parameter for OpenAI-compatible chat endpoints. Use
|
|
218
|
-
* `json_object` when the caller needs syntactically valid JSON, or
|
|
219
|
-
* `json_schema` when the upstream provider supports schema-constrained JSON.
|
|
220
|
-
*
|
|
221
|
-
* @stable
|
|
222
|
-
*/
|
|
223
|
-
type OpenAIChatResponseFormat = {
|
|
224
|
-
type: 'text';
|
|
225
|
-
} | {
|
|
226
|
-
type: 'json_object';
|
|
227
|
-
} | {
|
|
228
|
-
type: 'json_schema';
|
|
229
|
-
json_schema: Record<string, unknown>;
|
|
230
|
-
};
|
|
231
|
-
/** @stable */
|
|
232
|
-
type RuntimeStreamEvent = {
|
|
233
|
-
type: 'task_start';
|
|
234
|
-
task: AgentTaskSpec;
|
|
235
|
-
timestamp: string;
|
|
236
|
-
} | {
|
|
237
|
-
type: 'readiness_start';
|
|
238
|
-
task: AgentTaskSpec;
|
|
239
|
-
timestamp: string;
|
|
240
|
-
} | {
|
|
241
|
-
type: 'readiness_end';
|
|
242
|
-
task: AgentTaskSpec;
|
|
243
|
-
knowledge: KnowledgeReadinessReport;
|
|
244
|
-
decision: KnowledgeReadinessDecision;
|
|
245
|
-
timestamp: string;
|
|
246
|
-
} | {
|
|
247
|
-
type: 'questions_start';
|
|
248
|
-
task: AgentTaskSpec;
|
|
249
|
-
questions: UserQuestion[];
|
|
250
|
-
timestamp: string;
|
|
251
|
-
} | {
|
|
252
|
-
type: 'questions_end';
|
|
253
|
-
task: AgentTaskSpec;
|
|
254
|
-
questions: UserQuestion[];
|
|
255
|
-
userAnswers: Record<string, string>;
|
|
256
|
-
timestamp: string;
|
|
257
|
-
} | {
|
|
258
|
-
type: 'acquisition_start';
|
|
259
|
-
task: AgentTaskSpec;
|
|
260
|
-
acquisitionPlans: DataAcquisitionPlan[];
|
|
261
|
-
timestamp: string;
|
|
262
|
-
} | {
|
|
263
|
-
type: 'acquisition_end';
|
|
264
|
-
task: AgentTaskSpec;
|
|
265
|
-
acquisitionPlans: DataAcquisitionPlan[];
|
|
266
|
-
acquiredEvidenceIds: string[];
|
|
267
|
-
timestamp: string;
|
|
268
|
-
} | {
|
|
269
|
-
type: 'session_created';
|
|
270
|
-
task: AgentTaskSpec;
|
|
271
|
-
session: RuntimeSession;
|
|
272
|
-
timestamp: string;
|
|
273
|
-
} | {
|
|
274
|
-
type: 'session_resumed';
|
|
275
|
-
task: AgentTaskSpec;
|
|
276
|
-
session: RuntimeSession;
|
|
277
|
-
timestamp: string;
|
|
278
|
-
} | {
|
|
279
|
-
type: 'backend_start';
|
|
280
|
-
task: AgentTaskSpec;
|
|
281
|
-
session: RuntimeSession;
|
|
282
|
-
backend: string;
|
|
283
|
-
timestamp: string;
|
|
284
|
-
} | {
|
|
285
|
-
type: 'text_delta';
|
|
286
|
-
task?: AgentTaskSpec;
|
|
287
|
-
session?: RuntimeSession;
|
|
288
|
-
text: string;
|
|
289
|
-
timestamp?: string;
|
|
290
|
-
} | {
|
|
291
|
-
type: 'reasoning_delta';
|
|
292
|
-
task?: AgentTaskSpec;
|
|
293
|
-
session?: RuntimeSession;
|
|
294
|
-
text: string;
|
|
295
|
-
timestamp?: string;
|
|
296
|
-
} | {
|
|
297
|
-
type: 'tool_call';
|
|
298
|
-
task?: AgentTaskSpec;
|
|
299
|
-
session?: RuntimeSession;
|
|
300
|
-
toolName: string;
|
|
301
|
-
toolCallId?: string;
|
|
302
|
-
args?: unknown;
|
|
303
|
-
timestamp?: string;
|
|
304
|
-
} | {
|
|
305
|
-
type: 'tool_result';
|
|
306
|
-
task?: AgentTaskSpec;
|
|
307
|
-
session?: RuntimeSession;
|
|
308
|
-
toolName: string;
|
|
309
|
-
toolCallId?: string;
|
|
310
|
-
result?: unknown;
|
|
311
|
-
timestamp?: string;
|
|
312
|
-
} | {
|
|
313
|
-
type: 'llm_call';
|
|
314
|
-
task?: AgentTaskSpec;
|
|
315
|
-
session?: RuntimeSession;
|
|
316
|
-
model: string;
|
|
317
|
-
tokensIn?: number;
|
|
318
|
-
tokensOut?: number;
|
|
319
|
-
costUsd?: number;
|
|
320
|
-
latencyMs?: number;
|
|
321
|
-
finishReason?: string;
|
|
322
|
-
timestamp?: string;
|
|
323
|
-
} | {
|
|
324
|
-
type: 'artifact';
|
|
325
|
-
task?: AgentTaskSpec;
|
|
326
|
-
session?: RuntimeSession;
|
|
327
|
-
artifactId: string;
|
|
328
|
-
name?: string;
|
|
329
|
-
mimeType?: string;
|
|
330
|
-
uri?: string;
|
|
331
|
-
content?: string;
|
|
332
|
-
metadata?: Record<string, unknown>;
|
|
333
|
-
timestamp?: string;
|
|
334
|
-
} | {
|
|
335
|
-
type: 'proposal_created';
|
|
336
|
-
task?: AgentTaskSpec;
|
|
337
|
-
session?: RuntimeSession;
|
|
338
|
-
proposalId: string;
|
|
339
|
-
title: string;
|
|
340
|
-
status?: 'pending' | 'approved' | 'rejected';
|
|
341
|
-
content?: string;
|
|
342
|
-
timestamp?: string;
|
|
343
|
-
} | {
|
|
344
|
-
type: 'backend_error';
|
|
345
|
-
task: AgentTaskSpec;
|
|
346
|
-
session?: RuntimeSession;
|
|
347
|
-
backend: string;
|
|
348
|
-
message: string;
|
|
349
|
-
recoverable: boolean;
|
|
350
|
-
/**
|
|
351
|
-
* Typed transport diagnostic. Present when the upstream returned a
|
|
352
|
-
* non-success HTTP status or every retry attempt threw. Consumers MUST
|
|
353
|
-
* surface this onto their `RunRecord.error` — silently treating a
|
|
354
|
-
* `backend_error` as "no output" hides credit exhaustion, auth failure,
|
|
355
|
-
* and upstream outages from operators.
|
|
356
|
-
* - `kind: 'transport'` — HTTP / network failure with optional `status`
|
|
357
|
-
* + truncated response `body`.
|
|
358
|
-
* - `kind: 'backend'` — the backend's `stream()` generator threw for a
|
|
359
|
-
* reason that isn't a recognized transport failure.
|
|
360
|
-
*/
|
|
361
|
-
error?: BackendErrorDetail;
|
|
362
|
-
timestamp: string;
|
|
363
|
-
} | {
|
|
364
|
-
type: 'backend_end';
|
|
365
|
-
task: AgentTaskSpec;
|
|
366
|
-
session: RuntimeSession;
|
|
367
|
-
backend: string;
|
|
368
|
-
timestamp: string;
|
|
369
|
-
} | {
|
|
370
|
-
type: 'task_end';
|
|
371
|
-
task: AgentTaskSpec;
|
|
372
|
-
status: AgentTaskStatus;
|
|
373
|
-
reason: string;
|
|
374
|
-
timestamp: string;
|
|
375
|
-
} | {
|
|
376
|
-
type: 'final';
|
|
377
|
-
task: AgentTaskSpec;
|
|
378
|
-
session?: RuntimeSession;
|
|
379
|
-
status: AgentTaskStatus;
|
|
380
|
-
reason: string;
|
|
381
|
-
text?: string;
|
|
382
|
-
metadata?: Record<string, unknown>;
|
|
383
|
-
/**
|
|
384
|
-
* Typed terminal-error diagnostic. Mirrors the `backend_error.error`
|
|
385
|
-
* shape so a consumer that only listens for `final` still receives a
|
|
386
|
-
* loud, structured failure when the backend never produced output. Only
|
|
387
|
-
* set when `status !== 'completed'`. Consumers building a `RunRecord`
|
|
388
|
-
* MUST map this to `RunRecord.error` rather than recording silent
|
|
389
|
-
* `error: null` with empty `finalText`.
|
|
390
|
-
*/
|
|
391
|
-
error?: BackendErrorDetail;
|
|
392
|
-
timestamp: string;
|
|
393
|
-
};
|
|
394
|
-
/** @stable */
|
|
395
|
-
interface RuntimeSession {
|
|
396
|
-
id: string;
|
|
397
|
-
backend: string;
|
|
398
|
-
status: 'active' | 'completed' | 'failed' | 'aborted';
|
|
399
|
-
resumeToken?: string;
|
|
400
|
-
createdAt: string;
|
|
401
|
-
updatedAt: string;
|
|
402
|
-
metadata?: Record<string, unknown>;
|
|
403
|
-
}
|
|
404
|
-
/** @stable */
|
|
405
|
-
interface RuntimeSessionStore {
|
|
406
|
-
get(sessionId: string): Promise<RuntimeSession | undefined> | RuntimeSession | undefined;
|
|
407
|
-
put(session: RuntimeSession): Promise<void> | void;
|
|
408
|
-
appendEvent?(sessionId: string, event: RuntimeStreamEvent): Promise<void> | void;
|
|
409
|
-
listEvents?(sessionId: string): Promise<RuntimeStreamEvent[]> | RuntimeStreamEvent[];
|
|
410
|
-
}
|
|
411
|
-
/** @stable */
|
|
412
|
-
interface AgentBackendInput {
|
|
413
|
-
task: AgentTaskSpec;
|
|
414
|
-
message?: string;
|
|
415
|
-
messages?: Array<{
|
|
416
|
-
role: string;
|
|
417
|
-
content: string;
|
|
418
|
-
}>;
|
|
419
|
-
inputs?: Record<string, unknown>;
|
|
420
|
-
}
|
|
421
|
-
/** @stable */
|
|
422
|
-
interface AgentBackendContext {
|
|
423
|
-
task: AgentTaskSpec;
|
|
424
|
-
knowledge: KnowledgeReadinessReport;
|
|
425
|
-
session: RuntimeSession;
|
|
426
|
-
signal?: AbortSignal;
|
|
427
|
-
/**
|
|
428
|
-
* Conversation/run identifier when this call is part of a multi-agent run.
|
|
429
|
-
* Backends should stamp it into any trace/log emission so cross-participant
|
|
430
|
-
* events correlate. Absent when the call is a stand-alone `runAgentTask`.
|
|
431
|
-
*/
|
|
432
|
-
runId?: string;
|
|
433
|
-
/**
|
|
434
|
-
* Deterministic turn id for this single call. Stable across retries of the
|
|
435
|
-
* same logical turn so a caching gateway / idempotent backend can dedupe.
|
|
436
|
-
*/
|
|
437
|
-
turnId?: string;
|
|
438
|
-
/**
|
|
439
|
-
* If this call is itself nested inside a higher-order conversation
|
|
440
|
-
* (recursion via `createConversationBackend`), the enclosing turn's id.
|
|
441
|
-
* Used for trace stitching across nested orchestration.
|
|
442
|
-
*/
|
|
443
|
-
parentTurnId?: string;
|
|
444
|
-
/**
|
|
445
|
-
* Headers to forward verbatim to any outbound HTTP the backend issues:
|
|
446
|
-
* `X-Tangle-Forwarded-Authorization`, `X-Tangle-Forwarded-Depth`,
|
|
447
|
-
* run/turn correlation. Backends that issue HTTP MUST merge these into
|
|
448
|
-
* the outbound request; backends that don't issue HTTP may ignore them.
|
|
449
|
-
*/
|
|
450
|
-
propagatedHeaders?: Readonly<Record<string, string>>;
|
|
451
|
-
}
|
|
452
|
-
/** @stable */
|
|
453
|
-
interface AgentExecutionBackend<TInput extends AgentBackendInput = AgentBackendInput> {
|
|
454
|
-
kind: string;
|
|
455
|
-
start?(input: TInput, context: Omit<AgentBackendContext, 'session'> & {
|
|
456
|
-
requestedSessionId?: string;
|
|
457
|
-
}): Promise<RuntimeSession> | RuntimeSession;
|
|
458
|
-
resume?(session: RuntimeSession, input: TInput, context: Omit<AgentBackendContext, 'session'>): Promise<RuntimeSession> | RuntimeSession;
|
|
459
|
-
stream(input: TInput, context: AgentBackendContext): AsyncIterable<RuntimeStreamEvent>;
|
|
460
|
-
stop?(session: RuntimeSession, reason: string): Promise<void> | void;
|
|
461
|
-
}
|
|
462
|
-
/** @stable */
|
|
463
|
-
interface RunAgentTaskStreamOptions<TInput extends AgentBackendInput = AgentBackendInput> {
|
|
464
|
-
task: AgentTaskSpec;
|
|
465
|
-
backend: AgentExecutionBackend<TInput>;
|
|
466
|
-
input?: Omit<TInput, 'task'>;
|
|
467
|
-
knowledge?: AgentKnowledgeProvider;
|
|
468
|
-
sessionStore?: RuntimeSessionStore;
|
|
469
|
-
sessionId?: string;
|
|
470
|
-
resume?: boolean;
|
|
471
|
-
signal?: AbortSignal;
|
|
472
|
-
minimumReadinessScore?: number;
|
|
473
|
-
}
|
|
474
|
-
/** @stable */
|
|
475
|
-
interface RunAgentTaskOptions<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
|
|
476
|
-
task: AgentTaskSpec;
|
|
477
|
-
adapter: AgentAdapter<TState, TAction, TActionResult, TEval>;
|
|
478
|
-
knowledge?: AgentKnowledgeProvider;
|
|
479
|
-
onEvent?: AgentRuntimeEventSink<TState, TAction, TActionResult, TEval>;
|
|
480
|
-
store?: TraceStore;
|
|
481
|
-
signal?: AbortSignal;
|
|
482
|
-
scenarioId?: string;
|
|
483
|
-
projectId?: string;
|
|
484
|
-
variantId?: string;
|
|
485
|
-
minimumReadinessScore?: number;
|
|
486
|
-
}
|
|
487
|
-
/** @stable */
|
|
488
|
-
interface AgentTaskRunResult<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
|
|
489
|
-
task: AgentTaskSpec;
|
|
490
|
-
status: AgentTaskStatus;
|
|
491
|
-
knowledge: KnowledgeReadinessReport;
|
|
492
|
-
questions: UserQuestion[];
|
|
493
|
-
acquisitionPlans: DataAcquisitionPlan[];
|
|
494
|
-
userAnswers: Record<string, string>;
|
|
495
|
-
acquiredEvidenceIds: string[];
|
|
496
|
-
control: ControlRunResult<TState, TAction, TActionResult, TEval>;
|
|
497
|
-
runRecords: RunRecord[];
|
|
498
|
-
}
|
|
499
|
-
/** @stable */
|
|
500
|
-
interface KnowledgeReadinessDecision {
|
|
501
|
-
passed: boolean;
|
|
502
|
-
status: 'ready' | 'blocked' | 'caveat';
|
|
503
|
-
reason: string;
|
|
504
|
-
readinessScore: number;
|
|
505
|
-
recommendedAction: KnowledgeReadinessReport['recommendedAction'];
|
|
506
|
-
severity: KnowledgeReadinessReport['severity'];
|
|
507
|
-
blockingGapIds: string[];
|
|
508
|
-
nonBlockingGapIds: string[];
|
|
509
|
-
}
|
|
3
|
+
import { g as AgentTaskSpec, R as RuntimeStreamEvent } from './types-BwoZWq-i.js';
|
|
510
4
|
|
|
511
5
|
/**
|
|
512
6
|
*
|
|
@@ -1305,4 +799,4 @@ interface ExecCtx {
|
|
|
1305
799
|
parentSpanId?: string;
|
|
1306
800
|
}
|
|
1307
801
|
|
|
1308
|
-
export { type
|
|
802
|
+
export { type AgentRunSpec as A, type LoopIterationEndedPayload as B, type LoopIterationStartedPayload as C, type Driver as D, type ExecCtx as E, type LoopPlanDescription as F, type LoopPlanPayload as G, type LoopStartedPayload as H, type Iteration as I, type LoopTeardownFailedPayload as J, type MountManifestEntry as K, type LoopTokenUsage as L, type MountRecorder as M, type RunProvenance as N, type OutputAdapter as O, type ValidationCtx as P, type RuntimeHooks as R, type SandboxClient as S, type Validator as V, type LoopTraceEvent as a, type LoopSandboxPlacement as b, type RuntimeDecisionEvidenceRef as c, type RuntimeDecisionKind as d, type RuntimeDecisionPoint as e, type RuntimeHookContext as f, type RuntimeHookErrorContext as g, type RuntimeHookEvent as h, type RuntimeHookPhase as i, type RuntimeHookTarget as j, type RuntimeRunHandle as k, type RuntimeRunPersistenceAdapter as l, type RuntimeRunRow as m, composeRuntimeHooks as n, defineRuntimeHooks as o, notifyRuntimeDecisionPoint as p, notifyRuntimeHookEvent as q, type LoopTraceEmitter as r, startRuntimeRun as s, type LoopWinner as t, type LoopLineageOptions as u, type LoopResult as v, type SelectionReceipt as w, type LoopDecisionPayload as x, type LoopEndedPayload as y, type LoopIterationDispatchPayload as z };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
2
2
|
import { AnalystFinding, DefaultVerdict } from '@tangle-network/agent-eval';
|
|
3
|
-
import { d as AgentSpec, e as ExecutorRegistry, B as Budget, A as Agent, f as SpawnJournal, a as ResultBlobStore, g as RootHandle, b as SupervisedResult, N as NodeId, h as Settled, i as Spend, S as Scope, c as Executor } from './types-
|
|
4
|
-
import { R as RuntimeHooks, I as Iteration } from './types-
|
|
3
|
+
import { d as AgentSpec, e as ExecutorRegistry, B as Budget, A as Agent, f as SpawnJournal, a as ResultBlobStore, g as RootHandle, b as SupervisedResult, N as NodeId, h as Settled, i as Spend, S as Scope, c as Executor } from './types-1d5QGK3t.js';
|
|
4
|
+
import { R as RuntimeHooks, I as Iteration } from './types-ByAYqlVb.js';
|
|
5
5
|
import { BackendType } from '@tangle-network/sandbox';
|
|
6
|
-
import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-
|
|
7
|
-
import { L as LocalHarness, r as runLocalHarness } from './local-harness-
|
|
6
|
+
import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-D1gX1-hg.js';
|
|
7
|
+
import { L as LocalHarness, r as runLocalHarness } from './local-harness-ZqCx51u7.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-runtime",
|
|
3
|
-
"version": "0.94.
|
|
3
|
+
"version": "0.94.12",
|
|
4
4
|
"description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
|
|
5
5
|
"homepage": "https://github.com/tangle-network/agent-runtime#readme",
|
|
6
6
|
"repository": {
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"import": "./dist/agent.js",
|
|
25
25
|
"default": "./dist/agent.js"
|
|
26
26
|
},
|
|
27
|
+
"./conversation": {
|
|
28
|
+
"types": "./dist/conversation.d.ts",
|
|
29
|
+
"import": "./dist/conversation.js",
|
|
30
|
+
"default": "./dist/conversation.js"
|
|
31
|
+
},
|
|
27
32
|
"./intelligence": {
|
|
28
33
|
"types": "./dist/intelligence.d.ts",
|
|
29
34
|
"import": "./dist/intelligence.js",
|
|
@@ -64,6 +69,11 @@
|
|
|
64
69
|
"import": "./dist/platform.js",
|
|
65
70
|
"default": "./dist/platform.js"
|
|
66
71
|
},
|
|
72
|
+
"./primeintellect": {
|
|
73
|
+
"types": "./dist/primeintellect/index.d.ts",
|
|
74
|
+
"import": "./dist/primeintellect/index.js",
|
|
75
|
+
"default": "./dist/primeintellect/index.js"
|
|
76
|
+
},
|
|
67
77
|
"./candidate-execution": {
|
|
68
78
|
"types": "./dist/candidate-execution/index.d.ts",
|
|
69
79
|
"import": "./dist/candidate-execution/index.js",
|
|
@@ -98,13 +108,15 @@
|
|
|
98
108
|
"typecheck": "tsc --noEmit && pnpm run typecheck:examples",
|
|
99
109
|
"typecheck:examples": "tsc --noEmit -p tsconfig.examples.json",
|
|
100
110
|
"verify:package": "node scripts/verify-package-exports.mjs",
|
|
111
|
+
"verify:primeintellect": "pnpm build && node scripts/verify-primeintellect-v1.mjs",
|
|
112
|
+
"verify:primeintellect:live": "pnpm build && node scripts/verify-primeintellect-live.mjs",
|
|
101
113
|
"docs:api": "typedoc && node scripts/gen-primitive-catalog.mjs",
|
|
102
114
|
"docs:freshness": "node scripts/check-docs-freshness.mjs",
|
|
103
115
|
"docs:check": "pnpm run docs:api && git diff --exit-code -- docs/api && pnpm run docs:freshness"
|
|
104
116
|
},
|
|
105
117
|
"devDependencies": {
|
|
106
118
|
"@biomejs/biome": "^2.4.15",
|
|
107
|
-
"@tangle-network/agent-eval": "0.
|
|
119
|
+
"@tangle-network/agent-eval": "0.120.1",
|
|
108
120
|
"@tangle-network/agent-interface": "^0.25.0",
|
|
109
121
|
"@tangle-network/sandbox": "^0.9.7",
|
|
110
122
|
"@types/node": "^25.9.3",
|
|
@@ -135,7 +147,7 @@
|
|
|
135
147
|
"license": "MIT",
|
|
136
148
|
"packageManager": "pnpm@10.28.0",
|
|
137
149
|
"peerDependencies": {
|
|
138
|
-
"@tangle-network/agent-eval": ">=0.
|
|
150
|
+
"@tangle-network/agent-eval": ">=0.120.1 <0.121.0",
|
|
139
151
|
"@tangle-network/agent-interface": ">=0.25.0 <0.26.0",
|
|
140
152
|
"@tangle-network/sandbox": ">=0.8.0 <1.0.0",
|
|
141
153
|
"playwright": "^1.40.0"
|