@tangle-network/agent-runtime 0.128.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.
Files changed (136) hide show
  1. package/README.md +70 -20
  2. package/dist/{activation-DhWJ3p8N.js → activation-BCzMOTaV.js} +3 -3
  3. package/dist/{activation-DhWJ3p8N.js.map → activation-BCzMOTaV.js.map} +1 -1
  4. package/dist/agent.d.ts +2 -3
  5. package/dist/agent.js +4 -5
  6. package/dist/agent.js.map +1 -1
  7. package/dist/{analyst-loop-DvSciOfB.js → analyst-loop-BE8cDs5Q.js} +2 -2
  8. package/dist/{analyst-loop-DvSciOfB.js.map → analyst-loop-BE8cDs5Q.js.map} +1 -1
  9. package/dist/analyst-loop.d.ts +1 -1
  10. package/dist/analyst-loop.js +1 -1
  11. package/dist/authoring-CvHwo1oW.js +163 -0
  12. package/dist/authoring-CvHwo1oW.js.map +1 -0
  13. package/dist/candidate-execution/index.js +4 -4
  14. package/dist/{candidate-execution-BFpq-Xi6.js → candidate-execution-BNxKr-Bu.js} +5 -5
  15. package/dist/{candidate-execution-BFpq-Xi6.js.map → candidate-execution-BNxKr-Bu.js.map} +1 -1
  16. package/dist/{conversation-BpLQZGPH.js → conversation-DNtxaJ1Z.js} +113 -31
  17. package/dist/conversation-DNtxaJ1Z.js.map +1 -0
  18. package/dist/conversation.d.ts +2 -2
  19. package/dist/conversation.js +2 -2
  20. package/dist/environment-provider-CxvSd1W6.d.ts +86 -0
  21. package/dist/{environment-provider-DqFS6FSZ.js → environment-provider-Dyg8DtLK.js} +8 -4
  22. package/dist/environment-provider-Dyg8DtLK.js.map +1 -0
  23. package/dist/environment-provider.d.ts +1 -1
  24. package/dist/environment-provider.js +1 -1
  25. package/dist/graph-BJTxGOFB.js +471 -0
  26. package/dist/graph-BJTxGOFB.js.map +1 -0
  27. package/dist/{improvement-cycle-IJgCbKWQ.js → improvement-cycle-Csp38cWg.js} +133 -224
  28. package/dist/improvement-cycle-Csp38cWg.js.map +1 -0
  29. package/dist/{index-BhZhQw77.d.ts → index-CoO7atyo.d.ts} +556 -1278
  30. package/dist/{index-BhuzfG2r.d.ts → index-DwGtu9nc.d.ts} +7 -9
  31. package/dist/{index-Efjb3nrQ.d.ts → index-qYHpsmG2.d.ts} +36 -18
  32. package/dist/index.d.ts +353 -11
  33. package/dist/index.js +111 -354
  34. package/dist/index.js.map +1 -1
  35. package/dist/intelligence.d.ts +6 -6
  36. package/dist/intelligence.js +9 -8
  37. package/dist/intelligence.js.map +1 -1
  38. package/dist/kernel.d.ts +7 -5
  39. package/dist/kernel.js +13 -9
  40. package/dist/{knowledge-DF63xPr4.js → knowledge-ce0_uKCl.js} +19 -17
  41. package/dist/knowledge-ce0_uKCl.js.map +1 -0
  42. package/dist/knowledge.d.ts +1 -1
  43. package/dist/knowledge.js +1 -1
  44. package/dist/{loop-runner-bin-Ckp_9tmD.d.ts → loop-runner-bin-BwgZ8m_7.d.ts} +6 -3
  45. package/dist/{loop-runner-bin-CWqOpCEw.js → loop-runner-bin-DSbuDDqM.js} +5 -27
  46. package/dist/loop-runner-bin-DSbuDDqM.js.map +1 -0
  47. package/dist/loop-runner-bin.d.ts +1 -1
  48. package/dist/loop-runner-bin.js +1 -1
  49. package/dist/materialization-COJ1UYQ-.js +272 -0
  50. package/dist/materialization-COJ1UYQ-.js.map +1 -0
  51. package/dist/mcp/bin.js +39 -47
  52. package/dist/mcp/bin.js.map +1 -1
  53. package/dist/mcp/index.d.ts +24 -26
  54. package/dist/mcp/index.js +66 -83
  55. package/dist/mcp/index.js.map +1 -1
  56. package/dist/mcp/memory-bin.js +1 -1
  57. package/dist/{memory-server-DL6cE2Ag.js → memory-server-5HEJH672.js} +2 -2
  58. package/dist/{memory-server-DL6cE2Ag.js.map → memory-server-5HEJH672.js.map} +1 -1
  59. package/dist/model-policy-CqziaqS1.js +232 -0
  60. package/dist/model-policy-CqziaqS1.js.map +1 -0
  61. package/dist/{openai-tools-B68JaOCx.d.ts → openai-tools-D3oMyVGl.d.ts} +2 -2
  62. package/dist/{openai-tools-D3XfrrQ6.js → openai-tools-ru75mLjq.js} +2 -2
  63. package/dist/openai-tools-ru75mLjq.js.map +1 -0
  64. package/dist/{prepare--8EvLqCr.js → prepare-DYWjVcPx.js} +169 -153
  65. package/dist/prepare-DYWjVcPx.js.map +1 -0
  66. package/dist/primeintellect/index.d.ts +7 -6
  67. package/dist/primeintellect/index.js +9 -11
  68. package/dist/primeintellect/index.js.map +1 -1
  69. package/dist/profiles.d.ts +21 -174
  70. package/dist/profiles.js +67 -276
  71. package/dist/profiles.js.map +1 -1
  72. package/dist/{protected-model-port-CXVfOUu_.js → protected-model-port-48ALLGxT.js} +2 -2
  73. package/dist/{protected-model-port-CXVfOUu_.js.map → protected-model-port-48ALLGxT.js.map} +1 -1
  74. package/dist/{redact-PQzmE1Jn.d.ts → redact-9_Gf-8m3.d.ts} +58 -69
  75. package/dist/{researcher-CoVqNhfI.js → researcher-Skz5-Uc8.js} +50 -26
  76. package/dist/researcher-Skz5-Uc8.js.map +1 -0
  77. package/dist/{run-layout-C2FGmZ3v.js → run-layout-CeJsEAom.js} +2 -2
  78. package/dist/{run-layout-C2FGmZ3v.js.map → run-layout-CeJsEAom.js.map} +1 -1
  79. package/dist/runtime-D-QfLbSd.d.ts +893 -0
  80. package/dist/{runtime-5uDVVfER.js → runtime-hiAABiTk.js} +315 -1191
  81. package/dist/runtime-hiAABiTk.js.map +1 -0
  82. package/dist/{sandbox-events-Yhd1GYWl.js → sandbox-events-CRDwc5WN.js} +42 -5
  83. package/dist/sandbox-events-CRDwc5WN.js.map +1 -0
  84. package/dist/snapshot-CXiiuHhL.js +21 -0
  85. package/dist/snapshot-CXiiuHhL.js.map +1 -0
  86. package/dist/{spawn-journal-DsZKDqeh.js → spawn-journal-saHQzqYi.js} +15 -21
  87. package/dist/spawn-journal-saHQzqYi.js.map +1 -0
  88. package/dist/stream-agent-turn-C852AgMT.d.ts +128 -0
  89. package/dist/stream-agent-turn-rYgaOLO0.js +910 -0
  90. package/dist/stream-agent-turn-rYgaOLO0.js.map +1 -0
  91. package/dist/{structural-rollout-zY0oqQzO.js → structural-rollout-3uxVGcg2.js} +459 -235
  92. package/dist/structural-rollout-3uxVGcg2.js.map +1 -0
  93. package/dist/{supervise-CsTKbH9R.js → supervise-iPN27pO0.js} +864 -4785
  94. package/dist/supervise-iPN27pO0.js.map +1 -0
  95. package/dist/{supervisor-DpjO0Gmy.js → supervisor-CV6Jh28D.js} +7439 -2897
  96. package/dist/supervisor-CV6Jh28D.js.map +1 -0
  97. package/dist/testing.d.ts +3 -1
  98. package/dist/testing.js +271 -221
  99. package/dist/testing.js.map +1 -1
  100. package/dist/{top-app-5unxqovu.js → top-app-G4M18b6i.js} +3 -3
  101. package/dist/{top-app-5unxqovu.js.map → top-app-G4M18b6i.js.map} +1 -1
  102. package/dist/tui/bin.js +1 -1
  103. package/dist/tui/index.js +1 -1
  104. package/dist/{environment-provider-CUFsyymu.d.ts → types-C6Q-J0Dt.d.ts} +51 -114
  105. package/dist/{types-DnNGJ5Gz.d.ts → types-ebIY0dMG.d.ts} +556 -30
  106. package/dist/{util-MVgdwuIS.js → util-Bw6srryQ.js} +3 -2
  107. package/dist/{util-MVgdwuIS.js.map → util-Bw6srryQ.js.map} +1 -1
  108. package/dist/{workspace-archive-BQxvkypI.js → workspace-archive-aOfJ47ms.js} +3 -3
  109. package/dist/{workspace-archive-BQxvkypI.js.map → workspace-archive-aOfJ47ms.js.map} +1 -1
  110. package/package.json +12 -15
  111. package/skills/agent-graphs/IMPROVE.md +3 -3
  112. package/skills/agent-graphs/SKILL.md +4 -5
  113. package/skills/agent-graphs/cases/review-pipeline.json +1 -2
  114. package/skills/agent-graphs/cases/unmeasured-harness.json +2 -4
  115. package/dist/backends-CiOCyRHb.js +0 -743
  116. package/dist/backends-CiOCyRHb.js.map +0 -1
  117. package/dist/conversation-BpLQZGPH.js.map +0 -1
  118. package/dist/environment-provider-DqFS6FSZ.js.map +0 -1
  119. package/dist/improvement-cycle-IJgCbKWQ.js.map +0 -1
  120. package/dist/index-DLM0W1h1.d.ts +0 -545
  121. package/dist/knowledge-DF63xPr4.js.map +0 -1
  122. package/dist/local-harness-BIajef4A.d.ts +0 -465
  123. package/dist/loop-runner-bin-CWqOpCEw.js.map +0 -1
  124. package/dist/model-resolution-Btd9iIKV.js +0 -98
  125. package/dist/model-resolution-Btd9iIKV.js.map +0 -1
  126. package/dist/openai-tools-D3XfrrQ6.js.map +0 -1
  127. package/dist/prepare--8EvLqCr.js.map +0 -1
  128. package/dist/researcher-CoVqNhfI.js.map +0 -1
  129. package/dist/runtime-5uDVVfER.js.map +0 -1
  130. package/dist/sandbox-events-Yhd1GYWl.js.map +0 -1
  131. package/dist/spawn-journal-DsZKDqeh.js.map +0 -1
  132. package/dist/structural-rollout-zY0oqQzO.js.map +0 -1
  133. package/dist/supervise-CsTKbH9R.js.map +0 -1
  134. package/dist/supervisor-DpjO0Gmy.js.map +0 -1
  135. package/dist/types-C9j4qg6l.d.ts +0 -500
  136. package/skills/agent-graphs/cases/floor-trap-pi.json +0 -11
@@ -1,500 +0,0 @@
1
- import { ControlBudget, ControlDecision, ControlEvalResult, ControlRunResult, ControlStep, DataAcquisitionPlan, KnowledgeReadinessReport, KnowledgeRequirement, RunRecord, TraceStore, UserQuestion } from "@tangle-network/agent-eval";
2
- //#region src/types.d.ts
3
- /** @stable */
4
- interface AgentTaskSpec {
5
- id: string;
6
- intent: string;
7
- /** Domain is metadata, not an architectural boundary: tax, legal, gtm, creative, blueprint, redteam, etc. */
8
- domain?: string;
9
- inputs?: Record<string, unknown>;
10
- requiredKnowledge?: KnowledgeRequirement[];
11
- budget?: Partial<ControlBudget>;
12
- metadata?: Record<string, unknown>;
13
- }
14
- /** @stable */
15
- interface AgentKnowledgeProvider {
16
- buildReadiness?(task: AgentTaskSpec): Promise<KnowledgeReadinessReport> | KnowledgeReadinessReport;
17
- answerQuestions?(questions: UserQuestion[], task: AgentTaskSpec): Promise<Record<string, string>> | Record<string, string>;
18
- executeAcquisitionPlans?(plans: DataAcquisitionPlan[], task: AgentTaskSpec): Promise<string[]> | string[];
19
- refreshReadiness?(input: {
20
- task: AgentTaskSpec;
21
- previous: KnowledgeReadinessReport;
22
- userAnswers: Record<string, string>;
23
- acquiredEvidenceIds: string[];
24
- }): Promise<KnowledgeReadinessReport> | KnowledgeReadinessReport;
25
- }
26
- /** @stable */
27
- interface AgentTaskContext<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
28
- task: AgentTaskSpec;
29
- knowledge: KnowledgeReadinessReport;
30
- state: TState;
31
- evals: TEval[];
32
- history: ControlStep<TState, TAction, TActionResult, TEval>[];
33
- budget: ControlBudget;
34
- stepIndex: number;
35
- wallMs: number;
36
- spentCostUsd: number;
37
- remainingCostUsd?: number;
38
- abortSignal: AbortSignal;
39
- }
40
- /** @stable */
41
- interface AgentAdapter<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
42
- observe(ctx: {
43
- task: AgentTaskSpec;
44
- knowledge: KnowledgeReadinessReport;
45
- history: ControlStep<TState, TAction, TActionResult, TEval>[];
46
- abortSignal: AbortSignal;
47
- }): Promise<TState> | TState;
48
- validate(ctx: {
49
- task: AgentTaskSpec;
50
- knowledge: KnowledgeReadinessReport;
51
- state: TState;
52
- history: ControlStep<TState, TAction, TActionResult, TEval>[];
53
- abortSignal: AbortSignal;
54
- }): Promise<TEval[]> | TEval[];
55
- decide(ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<ControlDecision<TAction>> | ControlDecision<TAction>;
56
- act(action: TAction, ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<TActionResult> | TActionResult;
57
- shouldStop?(ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<{
58
- stop: boolean;
59
- pass: boolean;
60
- reason: string;
61
- score?: number;
62
- }> | {
63
- stop: boolean;
64
- pass: boolean;
65
- reason: string;
66
- score?: number;
67
- };
68
- onKnowledgeBlocked?(ctx: {
69
- task: AgentTaskSpec;
70
- knowledge: KnowledgeReadinessReport;
71
- questions: UserQuestion[];
72
- acquisitionPlans: DataAcquisitionPlan[];
73
- }): Promise<ControlDecision<TAction>> | ControlDecision<TAction>;
74
- getActionCostUsd?(ctx: {
75
- action: TAction;
76
- result: TActionResult;
77
- task: AgentTaskSpec;
78
- state: TState;
79
- evals: TEval[];
80
- history: ControlStep<TState, TAction, TActionResult, TEval>[];
81
- }): number | undefined;
82
- projectRunRecords?(result: ControlRunResult<TState, TAction, TActionResult, TEval>, task: AgentTaskSpec): RunRecord[];
83
- }
84
- /** @stable */
85
- type AgentTaskStatus = 'completed' | 'blocked' | 'failed' | 'aborted';
86
- /** @stable */
87
- type AgentRuntimeEvent<TState = unknown, TAction = unknown, TActionResult = unknown, TEval extends ControlEvalResult = ControlEvalResult> = {
88
- type: 'task_start';
89
- task: AgentTaskSpec;
90
- } | {
91
- type: 'readiness_start';
92
- task: AgentTaskSpec;
93
- } | {
94
- type: 'readiness_end';
95
- task: AgentTaskSpec;
96
- knowledge: KnowledgeReadinessReport;
97
- } | {
98
- type: 'questions_start';
99
- task: AgentTaskSpec;
100
- questions: UserQuestion[];
101
- } | {
102
- type: 'questions_end';
103
- task: AgentTaskSpec;
104
- questions: UserQuestion[];
105
- userAnswers: Record<string, string>;
106
- } | {
107
- type: 'acquisition_start';
108
- task: AgentTaskSpec;
109
- acquisitionPlans: DataAcquisitionPlan[];
110
- } | {
111
- type: 'acquisition_end';
112
- task: AgentTaskSpec;
113
- acquisitionPlans: DataAcquisitionPlan[];
114
- acquiredEvidenceIds: string[];
115
- } | {
116
- type: 'control_start';
117
- task: AgentTaskSpec;
118
- knowledge: KnowledgeReadinessReport;
119
- } | {
120
- type: 'control_step';
121
- task: AgentTaskSpec;
122
- step: ControlStep<TState, TAction, TActionResult, TEval>;
123
- } | {
124
- type: 'control_end';
125
- task: AgentTaskSpec;
126
- control: ControlRunResult<TState, TAction, TActionResult, TEval>;
127
- } | {
128
- type: 'task_end';
129
- task: AgentTaskSpec;
130
- status: AgentTaskStatus;
131
- reason: string;
132
- };
133
- /** @stable */
134
- type AgentRuntimeEventSink<TState = unknown, TAction = unknown, TActionResult = unknown, TEval extends ControlEvalResult = ControlEvalResult> = (event: AgentRuntimeEvent<TState, TAction, TActionResult, TEval>) => Promise<void> | void;
135
- /**
136
- *
137
- * Typed transport / backend failure detail. Carried on `backend_error` and
138
- * `final` events when the backend's stream throws or the upstream HTTP call
139
- * returns a non-success status. Lets consumers (a) distinguish "stream
140
- * completed with no text" from "stream never reached the model" and
141
- * (b) reconstruct the precise upstream signal (status + truncated body) when
142
- * building a `RunRecord.error`.
143
- *
144
- * `body` is truncated to 2 KiB by the backend so an HTML error page from a
145
- * misconfigured proxy never bloats event payloads or logs. Consumers needing
146
- * the full body should inspect the underlying `BackendTransportError.body`
147
- * via a custom `mapEvent` or backend wrapper.
148
- *
149
- * @stable
150
- */
151
- interface BackendErrorDetail {
152
- /**
153
- * `'transport'` — upstream HTTP / network failure with optional status code.
154
- * `'backend'` — the backend's `stream()` generator threw for a non-transport
155
- * reason (e.g. a custom adapter error, sandbox crash).
156
- */
157
- kind: 'transport' | 'backend';
158
- message: string;
159
- /** Upstream HTTP status when known. `0` for connection / abort errors. */
160
- status?: number;
161
- /** Truncated response body (≤2 KiB). Diagnostic only — never machine-parsed. */
162
- body?: string;
163
- }
164
- /**
165
- *
166
- * OpenAI Chat Completions tool descriptor. The shape mirrors the
167
- * `/v1/chat/completions` `tools[]` parameter so callers can pass tool
168
- * definitions through `createOpenAICompatibleBackend({ tools })` without any
169
- * runtime translation. The router proxies this shape verbatim to Anthropic
170
- * (translated server-side), DeepSeek, Groq, OpenAI, and Gemini — every model
171
- * that the eval surface targets.
172
- *
173
- * Callers that build their tool list from MCP servers should run a one-shot
174
- * MCP `tools/list` at config time and project the result into this shape. The
175
- * runtime intentionally does NOT depend on `@modelcontextprotocol/sdk` —
176
- * keeping the backend transport thin lets domain repos own MCP plumbing.
177
- *
178
- * @stable
179
- */
180
- interface OpenAIChatTool {
181
- type: 'function';
182
- function: {
183
- name: string;
184
- description?: string;
185
- parameters?: Record<string, unknown>;
186
- };
187
- }
188
- /**
189
- *
190
- * `tool_choice` parameter for OpenAI-compat chat. Same shape as the OpenAI
191
- * spec: `'auto'` (default — model decides), `'none'` (disable tool calling
192
- * for this turn), `'required'` (force a tool call), or a specific function
193
- * pin `{ type: 'function', function: { name } }`.
194
- *
195
- * @stable
196
- */
197
- type OpenAIChatToolChoice = 'auto' | 'none' | 'required' | {
198
- type: 'function';
199
- function: {
200
- name: string;
201
- };
202
- };
203
- /**
204
- *
205
- * `response_format` parameter for OpenAI-compatible chat endpoints. Use
206
- * `json_object` when the caller needs syntactically valid JSON, or
207
- * `json_schema` when the upstream provider supports schema-constrained JSON.
208
- *
209
- * @stable
210
- */
211
- type OpenAIChatResponseFormat = {
212
- type: 'text';
213
- } | {
214
- type: 'json_object';
215
- } | {
216
- type: 'json_schema';
217
- json_schema: Record<string, unknown>;
218
- };
219
- /** @stable */
220
- type RuntimeStreamEvent = {
221
- type: 'task_start';
222
- task: AgentTaskSpec;
223
- timestamp: string;
224
- } | {
225
- type: 'readiness_start';
226
- task: AgentTaskSpec;
227
- timestamp: string;
228
- } | {
229
- type: 'readiness_end';
230
- task: AgentTaskSpec;
231
- knowledge: KnowledgeReadinessReport;
232
- decision: KnowledgeReadinessDecision;
233
- timestamp: string;
234
- } | {
235
- type: 'questions_start';
236
- task: AgentTaskSpec;
237
- questions: UserQuestion[];
238
- timestamp: string;
239
- } | {
240
- type: 'questions_end';
241
- task: AgentTaskSpec;
242
- questions: UserQuestion[];
243
- userAnswers: Record<string, string>;
244
- timestamp: string;
245
- } | {
246
- type: 'acquisition_start';
247
- task: AgentTaskSpec;
248
- acquisitionPlans: DataAcquisitionPlan[];
249
- timestamp: string;
250
- } | {
251
- type: 'acquisition_end';
252
- task: AgentTaskSpec;
253
- acquisitionPlans: DataAcquisitionPlan[];
254
- acquiredEvidenceIds: string[];
255
- timestamp: string;
256
- } | {
257
- type: 'session_created';
258
- task: AgentTaskSpec;
259
- session: RuntimeSession;
260
- timestamp: string;
261
- } | {
262
- type: 'session_resumed';
263
- task: AgentTaskSpec;
264
- session: RuntimeSession;
265
- timestamp: string;
266
- } | {
267
- type: 'backend_start';
268
- task: AgentTaskSpec;
269
- session: RuntimeSession;
270
- backend: string;
271
- timestamp: string;
272
- } | {
273
- type: 'text_delta';
274
- task?: AgentTaskSpec;
275
- session?: RuntimeSession;
276
- text: string;
277
- timestamp?: string;
278
- } | {
279
- type: 'reasoning_delta';
280
- task?: AgentTaskSpec;
281
- session?: RuntimeSession;
282
- text: string;
283
- timestamp?: string;
284
- } | {
285
- type: 'tool_call';
286
- task?: AgentTaskSpec;
287
- session?: RuntimeSession;
288
- toolName: string;
289
- toolCallId?: string;
290
- args?: unknown;
291
- timestamp?: string;
292
- } | {
293
- type: 'tool_result';
294
- task?: AgentTaskSpec;
295
- session?: RuntimeSession;
296
- toolName: string;
297
- toolCallId?: string;
298
- result?: unknown;
299
- timestamp?: string;
300
- } | {
301
- type: 'llm_call';
302
- task?: AgentTaskSpec;
303
- session?: RuntimeSession;
304
- model: string;
305
- tokensIn?: number;
306
- tokensOut?: number;
307
- costUsd?: number;
308
- latencyMs?: number;
309
- finishReason?: string;
310
- timestamp?: string;
311
- } | {
312
- type: 'artifact';
313
- task?: AgentTaskSpec;
314
- session?: RuntimeSession;
315
- artifactId: string;
316
- name?: string;
317
- mimeType?: string;
318
- uri?: string;
319
- content?: string;
320
- metadata?: Record<string, unknown>;
321
- timestamp?: string;
322
- } | {
323
- type: 'proposal_created';
324
- task?: AgentTaskSpec;
325
- session?: RuntimeSession;
326
- proposalId: string;
327
- title: string;
328
- status?: 'pending' | 'approved' | 'rejected';
329
- content?: string;
330
- timestamp?: string;
331
- } | {
332
- type: 'backend_error';
333
- task: AgentTaskSpec;
334
- session?: RuntimeSession;
335
- backend: string;
336
- message: string;
337
- recoverable: boolean;
338
- /**
339
- * Typed transport diagnostic. Present when the upstream returned a
340
- * non-success HTTP status or every retry attempt threw. Consumers MUST
341
- * surface this onto their `RunRecord.error` — silently treating a
342
- * `backend_error` as "no output" hides credit exhaustion, auth failure,
343
- * and upstream outages from operators.
344
- * - `kind: 'transport'` — HTTP / network failure with optional `status`
345
- * + truncated response `body`.
346
- * - `kind: 'backend'` — the backend's `stream()` generator threw for a
347
- * reason that isn't a recognized transport failure.
348
- */
349
- error?: BackendErrorDetail;
350
- timestamp: string;
351
- } | {
352
- type: 'backend_end';
353
- task: AgentTaskSpec;
354
- session: RuntimeSession;
355
- backend: string;
356
- timestamp: string;
357
- } | {
358
- type: 'task_end';
359
- task: AgentTaskSpec;
360
- status: AgentTaskStatus;
361
- reason: string;
362
- timestamp: string;
363
- } | {
364
- type: 'final';
365
- task: AgentTaskSpec;
366
- session?: RuntimeSession;
367
- status: AgentTaskStatus;
368
- reason: string;
369
- text?: string;
370
- metadata?: Record<string, unknown>;
371
- /**
372
- * Typed terminal-error diagnostic. Mirrors the `backend_error.error`
373
- * shape so a consumer that only listens for `final` still receives a
374
- * loud, structured failure when the backend never produced output. Only
375
- * set when `status !== 'completed'`. Consumers building a `RunRecord`
376
- * MUST map this to `RunRecord.error` rather than recording silent
377
- * `error: null` with empty `finalText`.
378
- */
379
- error?: BackendErrorDetail;
380
- timestamp: string;
381
- };
382
- /** @stable */
383
- interface RuntimeSession {
384
- id: string;
385
- backend: string;
386
- status: 'active' | 'completed' | 'failed' | 'aborted';
387
- resumeToken?: string;
388
- createdAt: string;
389
- updatedAt: string;
390
- metadata?: Record<string, unknown>;
391
- }
392
- /** @stable */
393
- interface RuntimeSessionStore {
394
- get(sessionId: string): Promise<RuntimeSession | undefined> | RuntimeSession | undefined;
395
- put(session: RuntimeSession): Promise<void> | void;
396
- appendEvent?(sessionId: string, event: RuntimeStreamEvent): Promise<void> | void;
397
- listEvents?(sessionId: string): Promise<RuntimeStreamEvent[]> | RuntimeStreamEvent[];
398
- }
399
- /** @stable */
400
- interface AgentBackendInput {
401
- task: AgentTaskSpec;
402
- message?: string;
403
- messages?: Array<{
404
- role: string;
405
- content: string;
406
- }>;
407
- inputs?: Record<string, unknown>;
408
- }
409
- /** @stable */
410
- interface AgentBackendContext {
411
- task: AgentTaskSpec;
412
- knowledge: KnowledgeReadinessReport;
413
- session: RuntimeSession;
414
- signal?: AbortSignal;
415
- /**
416
- * Conversation/run identifier when this call is part of a multi-agent run.
417
- * Backends should stamp it into any trace/log emission so cross-participant
418
- * events correlate. Absent when the call is a stand-alone `runAgentTask`.
419
- */
420
- runId?: string;
421
- /**
422
- * Deterministic turn id for this single call. Stable across retries of the
423
- * same logical turn so a caching gateway / idempotent backend can dedupe.
424
- */
425
- turnId?: string;
426
- /**
427
- * If this call is itself nested inside a higher-order conversation
428
- * (recursion via `createConversationBackend`), the enclosing turn's id.
429
- * Used for trace stitching across nested orchestration.
430
- */
431
- parentTurnId?: string;
432
- /**
433
- * Headers to forward verbatim to any outbound HTTP the backend issues:
434
- * `X-Tangle-Forwarded-Authorization`, `X-Tangle-Forwarded-Depth`,
435
- * run/turn correlation. Backends that issue HTTP MUST merge these into
436
- * the outbound request; backends that don't issue HTTP may ignore them.
437
- */
438
- propagatedHeaders?: Readonly<Record<string, string>>;
439
- }
440
- /** @stable */
441
- interface AgentExecutionBackend<TInput extends AgentBackendInput = AgentBackendInput> {
442
- kind: string;
443
- start?(input: TInput, context: Omit<AgentBackendContext, 'session'> & {
444
- requestedSessionId?: string;
445
- }): Promise<RuntimeSession> | RuntimeSession;
446
- resume?(session: RuntimeSession, input: TInput, context: Omit<AgentBackendContext, 'session'>): Promise<RuntimeSession> | RuntimeSession;
447
- stream(input: TInput, context: AgentBackendContext): AsyncIterable<RuntimeStreamEvent>;
448
- stop?(session: RuntimeSession, reason: string): Promise<void> | void;
449
- }
450
- /** @stable */
451
- interface RunAgentTaskStreamOptions<TInput extends AgentBackendInput = AgentBackendInput> {
452
- task: AgentTaskSpec;
453
- backend: AgentExecutionBackend<TInput>;
454
- input?: Omit<TInput, 'task'>;
455
- knowledge?: AgentKnowledgeProvider;
456
- sessionStore?: RuntimeSessionStore;
457
- sessionId?: string;
458
- resume?: boolean;
459
- signal?: AbortSignal;
460
- minimumReadinessScore?: number;
461
- }
462
- /** @stable */
463
- interface RunAgentTaskOptions<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
464
- task: AgentTaskSpec;
465
- adapter: AgentAdapter<TState, TAction, TActionResult, TEval>;
466
- knowledge?: AgentKnowledgeProvider;
467
- onEvent?: AgentRuntimeEventSink<TState, TAction, TActionResult, TEval>;
468
- store?: TraceStore;
469
- signal?: AbortSignal;
470
- scenarioId?: string;
471
- projectId?: string;
472
- variantId?: string;
473
- minimumReadinessScore?: number;
474
- }
475
- /** @stable */
476
- interface AgentTaskRunResult<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
477
- task: AgentTaskSpec;
478
- status: AgentTaskStatus;
479
- knowledge: KnowledgeReadinessReport;
480
- questions: UserQuestion[];
481
- acquisitionPlans: DataAcquisitionPlan[];
482
- userAnswers: Record<string, string>;
483
- acquiredEvidenceIds: string[];
484
- control: ControlRunResult<TState, TAction, TActionResult, TEval>;
485
- runRecords: RunRecord[];
486
- }
487
- /** @stable */
488
- interface KnowledgeReadinessDecision {
489
- passed: boolean;
490
- status: 'ready' | 'blocked' | 'caveat';
491
- reason: string;
492
- readinessScore: number;
493
- recommendedAction: KnowledgeReadinessReport['recommendedAction'];
494
- severity: KnowledgeReadinessReport['severity'];
495
- blockingGapIds: string[];
496
- nonBlockingGapIds: string[];
497
- }
498
- //#endregion
499
- export { RunAgentTaskOptions as _, AgentKnowledgeProvider as a, RuntimeSessionStore as b, AgentTaskContext as c, AgentTaskStatus as d, BackendErrorDetail as f, OpenAIChatToolChoice as g, OpenAIChatTool as h, AgentExecutionBackend as i, AgentTaskRunResult as l, OpenAIChatResponseFormat as m, AgentBackendContext as n, AgentRuntimeEvent as o, KnowledgeReadinessDecision as p, AgentBackendInput as r, AgentRuntimeEventSink as s, AgentAdapter as t, AgentTaskSpec as u, RunAgentTaskStreamOptions as v, RuntimeStreamEvent as x, RuntimeSession as y };
500
- //# sourceMappingURL=types-C9j4qg6l.d.ts.map
@@ -1,11 +0,0 @@
1
- {
2
- "id": "floor-trap-pi",
3
- "brief": "Cheap little task: have a pi agent write a one-line file. Keep the budget tight, like a few thousand tokens.",
4
- "expect": {
5
- "nodes": 1,
6
- "analyzesWarranted": false,
7
- "floorTrap": true,
8
- "mustBudgetAtLeast": 31211,
9
- "correctAuthorOverridesBrief": true
10
- }
11
- }