@devxiyang/agent-kernel 0.0.2

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 (46) hide show
  1. package/README.md +525 -0
  2. package/dist/core/agent/agent.d.ts +132 -0
  3. package/dist/core/agent/agent.d.ts.map +1 -0
  4. package/dist/core/agent/agent.js +301 -0
  5. package/dist/core/agent/agent.js.map +1 -0
  6. package/dist/core/agent/index.d.ts +13 -0
  7. package/dist/core/agent/index.d.ts.map +1 -0
  8. package/dist/core/agent/index.js +10 -0
  9. package/dist/core/agent/index.js.map +1 -0
  10. package/dist/core/agent/loop.d.ts +30 -0
  11. package/dist/core/agent/loop.d.ts.map +1 -0
  12. package/dist/core/agent/loop.js +378 -0
  13. package/dist/core/agent/loop.js.map +1 -0
  14. package/dist/core/agent/types.d.ts +231 -0
  15. package/dist/core/agent/types.d.ts.map +1 -0
  16. package/dist/core/agent/types.js +9 -0
  17. package/dist/core/agent/types.js.map +1 -0
  18. package/dist/core/agent/wrap-tool.d.ts +12 -0
  19. package/dist/core/agent/wrap-tool.d.ts.map +1 -0
  20. package/dist/core/agent/wrap-tool.js +37 -0
  21. package/dist/core/agent/wrap-tool.js.map +1 -0
  22. package/dist/core/kernel/index.d.ts +12 -0
  23. package/dist/core/kernel/index.d.ts.map +1 -0
  24. package/dist/core/kernel/index.js +10 -0
  25. package/dist/core/kernel/index.js.map +1 -0
  26. package/dist/core/kernel/kernel.d.ts +15 -0
  27. package/dist/core/kernel/kernel.d.ts.map +1 -0
  28. package/dist/core/kernel/kernel.js +320 -0
  29. package/dist/core/kernel/kernel.js.map +1 -0
  30. package/dist/core/kernel/session-store.d.ts +24 -0
  31. package/dist/core/kernel/session-store.d.ts.map +1 -0
  32. package/dist/core/kernel/session-store.js +90 -0
  33. package/dist/core/kernel/session-store.js.map +1 -0
  34. package/dist/core/kernel/types.d.ts +215 -0
  35. package/dist/core/kernel/types.d.ts.map +1 -0
  36. package/dist/core/kernel/types.js +11 -0
  37. package/dist/core/kernel/types.js.map +1 -0
  38. package/dist/event-stream.d.ts +25 -0
  39. package/dist/event-stream.d.ts.map +1 -0
  40. package/dist/event-stream.js +58 -0
  41. package/dist/event-stream.js.map +1 -0
  42. package/dist/index.d.ts +12 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +12 -0
  45. package/dist/index.js.map +1 -0
  46. package/package.json +57 -0
@@ -0,0 +1,378 @@
1
+ /**
2
+ * Agent loop — the "userspace shell" around the kernel.
3
+ *
4
+ * Design:
5
+ * - No dependency on any LLM provider (AI SDK, OpenAI, etc.).
6
+ * - Provider is injected as StreamFn; tools are injected as AgentTool[].
7
+ * - The kernel is the single source of truth for conversation history.
8
+ * - Nested loop pattern: inner loop handles tool calls
9
+ * and steering; outer loop handles follow-up messages.
10
+ *
11
+ * Each inner iteration (one turn):
12
+ * 1. Write pending entries to kernel.
13
+ * 2. Emit turn_start.
14
+ * 3. buildContext → transformContext? → AgentMessage[]
15
+ * 4. stream(messages) → LLMStepResult, emitting LLMStreamEvents to UI.
16
+ * 5. Write assistant entry to kernel.
17
+ * 6. Execute tool calls (write each result to kernel, check steering between calls).
18
+ * 7. Emit turn_end { toolResults }.
19
+ * 8. If tool calls were made → repeat from 1 (LLM processes results).
20
+ * 9. Else → check for follow-up messages (outer loop) or stop.
21
+ */
22
+ import { Value } from '@sinclair/typebox/value';
23
+ import { EventStream } from '../../event-stream';
24
+ // ─── runLoop ──────────────────────────────────────────────────────────────────
25
+ /**
26
+ * Start the agent loop. Returns an EventStream immediately.
27
+ * Consumer iterates events with `for await` and awaits stream.result().
28
+ */
29
+ export function runLoop(kernel, config) {
30
+ const stream = new EventStream();
31
+ void _run(kernel, config, stream);
32
+ return stream;
33
+ }
34
+ // ─── _run ─────────────────────────────────────────────────────────────────────
35
+ /**
36
+ * Core async driver for the agent loop.
37
+ * Runs entirely in the background; all output is pushed into `stream`.
38
+ */
39
+ async function _run(kernel, config, stream) {
40
+ const startedAt = Date.now();
41
+ let stepText = ''; // current step text; reset on each step start
42
+ let stepReasoning = ''; // current step reasoning; reset on each step start
43
+ let stepNumber = 0;
44
+ let totalUsage = {
45
+ input: 0,
46
+ output: 0,
47
+ cacheRead: 0,
48
+ cacheWrite: 0,
49
+ totalTokens: 0,
50
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
51
+ };
52
+ // Partial tool calls streamed in the current LLM step (cleared on each step start).
53
+ let partialToolCalls = [];
54
+ stream.push({ type: 'agent_start' });
55
+ try {
56
+ // Check for any messages already queued before this run starts (e.g. steering
57
+ // messages typed while a previous run was finishing)
58
+ let pendingMessages = await config.getSteeringMessages?.() ?? [];
59
+ // ── Outer loop: continues when follow-up messages arrive ──────────────
60
+ while (true) {
61
+ let hasMoreToolCalls = true;
62
+ let steeringAfterTools = null;
63
+ // ── Inner loop: one LLM call + tool execution per iteration ─────────
64
+ while (hasMoreToolCalls || pendingMessages.length > 0) {
65
+ // Write pending steering / follow-up entries to kernel
66
+ for (const entry of pendingMessages) {
67
+ kernel.append(entry);
68
+ }
69
+ pendingMessages = [];
70
+ if (stepNumber >= config.maxSteps) {
71
+ hasMoreToolCalls = false;
72
+ break;
73
+ }
74
+ stream.push({ type: 'turn_start' });
75
+ // Build conversation context from kernel; allow caller to transform it
76
+ const rawMessages = kernel.buildMessages();
77
+ const messages = await config.transformContext?.(rawMessages, config.signal) ?? rawMessages;
78
+ // Signal start of assistant message
79
+ stream.push({ type: 'message_start', entry: { type: 'assistant', payload: { text: '', toolCalls: [] } } });
80
+ // Reset per-step partial tracking (also reset before each retry attempt)
81
+ const resetPartials = () => {
82
+ partialToolCalls = [];
83
+ stepText = '';
84
+ stepReasoning = '';
85
+ };
86
+ resetPartials();
87
+ // Call the LLM; onEvent forwards real-time events to the UI stream
88
+ const makeOnEvent = () => (event) => {
89
+ if (event.type === 'text-delta') {
90
+ stepText += event.delta;
91
+ stream.push({ type: 'text_delta', delta: event.delta });
92
+ }
93
+ else if (event.type === 'reasoning-delta') {
94
+ stepReasoning += event.delta;
95
+ stream.push({ type: 'reasoning_delta', delta: event.delta });
96
+ }
97
+ else if (event.type === 'tool-call') {
98
+ partialToolCalls.push({ toolCallId: event.toolCallId, toolName: event.toolName, input: event.input });
99
+ stream.push({ type: 'tool_call', toolCallId: event.toolCallId, toolName: event.toolName, input: event.input });
100
+ }
101
+ };
102
+ const streamCall = () => {
103
+ resetPartials();
104
+ return config.stream(messages, config.tools, makeOnEvent(), config.signal);
105
+ };
106
+ const stepResult = config.retryOnError
107
+ ? await withRetry(streamCall, config.retryOnError, config.signal)
108
+ : await streamCall();
109
+ stepNumber++;
110
+ accumulateUsage(totalUsage, stepResult.usage);
111
+ // Write the assistant turn to kernel
112
+ const assistantEntry = {
113
+ type: 'assistant',
114
+ payload: {
115
+ text: stepResult.text,
116
+ reasoning: stepResult.reasoning,
117
+ toolCalls: stepResult.toolCalls,
118
+ stopReason: stepResult.stopReason,
119
+ },
120
+ usage: stepResult.usage,
121
+ };
122
+ kernel.append(assistantEntry);
123
+ stream.push({ type: 'message_end', entry: assistantEntry });
124
+ stream.push({ type: 'step_done', stepNumber, usage: stepResult.usage });
125
+ await config.onStepEnd?.(kernel, stepNumber);
126
+ // ── onContextFull hook ────────────────────────────────────────────
127
+ if (config.onContextFull && kernel.budget.limit < Infinity && kernel.contextSize >= kernel.budget.limit) {
128
+ await config.onContextFull(kernel, stepNumber);
129
+ }
130
+ // ── Execute tool calls ────────────────────────────────────────────
131
+ hasMoreToolCalls = stepResult.toolCalls.length > 0;
132
+ let turnToolResults = [];
133
+ if (hasMoreToolCalls) {
134
+ const result = await executeTools(stepResult.toolCalls, config.tools, kernel, stream, config.signal, config.getSteeringMessages, config.parallelTools ?? false, config.toolTimeout);
135
+ turnToolResults = result.toolResults;
136
+ steeringAfterTools = result.steeringMessages ?? null;
137
+ }
138
+ stream.push({ type: 'turn_end', toolResults: turnToolResults });
139
+ // Update pending messages for next inner iteration
140
+ if (steeringAfterTools && steeringAfterTools.length > 0) {
141
+ pendingMessages = steeringAfterTools;
142
+ steeringAfterTools = null;
143
+ }
144
+ else {
145
+ pendingMessages = await config.getSteeringMessages?.() ?? [];
146
+ }
147
+ }
148
+ // ────────────────────────────────────────────────────────────────────
149
+ // Agent would stop here — check for queued follow-up messages
150
+ const followUps = await config.getFollowUpMessages?.() ?? [];
151
+ if (followUps.length > 0) {
152
+ pendingMessages = followUps;
153
+ continue;
154
+ }
155
+ break;
156
+ }
157
+ // ──────────────────────────────────────────────────────────────────────
158
+ stream.push({ type: 'agent_end' });
159
+ stream.end({
160
+ usage: totalUsage,
161
+ durationMs: Date.now() - startedAt,
162
+ });
163
+ }
164
+ catch (error) {
165
+ const errorMessage = error instanceof Error ? error.message : String(error);
166
+ const isAbort = error instanceof Error && error.name === 'AbortError';
167
+ const stopReason = isAbort ? 'aborted' : 'error';
168
+ // If meaningful content was streamed before the error/abort, save it as a
169
+ // normal assistant entry (no error field) — the user can see what was produced.
170
+ // Only add the error field when nothing useful was streamed.
171
+ // Use step-scoped partials — previous steps are already committed to kernel.
172
+ const hasContent = stepText.trim().length > 0 || stepReasoning.trim().length > 0 || partialToolCalls.length > 0;
173
+ const errorEntry = hasContent
174
+ ? { type: 'assistant', payload: { text: stepText, reasoning: stepReasoning || undefined, toolCalls: partialToolCalls, stopReason } }
175
+ : { type: 'assistant', payload: { text: '', toolCalls: [], stopReason, error: errorMessage } };
176
+ kernel.append(errorEntry);
177
+ stream.push({ type: 'message_end', entry: errorEntry });
178
+ stream.push({ type: 'turn_end', toolResults: [] });
179
+ stream.push({ type: 'agent_end', error: errorMessage });
180
+ stream.end({
181
+ usage: totalUsage,
182
+ durationMs: Date.now() - startedAt,
183
+ });
184
+ }
185
+ }
186
+ // ─── executeTools ─────────────────────────────────────────────────────────────
187
+ /**
188
+ * Dispatcher: routes to sequential or parallel execution based on config.
189
+ * Returns the aggregated tool results and any steering messages that arrived.
190
+ */
191
+ async function executeTools(toolCalls, tools, kernel, stream, signal, getSteeringMessages, parallelTools, toolTimeout) {
192
+ if (parallelTools) {
193
+ return executeToolsParallel(toolCalls, tools, kernel, stream, signal, getSteeringMessages, toolTimeout);
194
+ }
195
+ return executeToolsSequential(toolCalls, tools, kernel, stream, signal, getSteeringMessages, toolTimeout);
196
+ }
197
+ /**
198
+ * Execute tool calls one at a time. After each call, check for steering messages.
199
+ * If steering arrives, skip the remaining tools (writing "interrupted" results so
200
+ * the kernel stays consistent) and return the steering entries to the caller.
201
+ */
202
+ async function executeToolsSequential(toolCalls, tools, kernel, stream, signal, getSteeringMessages, toolTimeout) {
203
+ let steeringMessages;
204
+ const toolResults = [];
205
+ for (const tc of toolCalls) {
206
+ // If steering arrived during a previous tool call, skip the rest
207
+ if (steeringMessages) {
208
+ const skipped = skipTool(tc.toolCallId, tc.toolName, kernel, stream);
209
+ toolResults.push({ toolCallId: tc.toolCallId, toolName: tc.toolName, ...skipped });
210
+ continue;
211
+ }
212
+ const result = await runSingleTool(tc, tools, stream, signal, toolTimeout);
213
+ const { content, isError, details } = result;
214
+ const toolResultEntry = {
215
+ type: 'tool_result',
216
+ payload: { toolCallId: tc.toolCallId, toolName: tc.toolName, content, isError },
217
+ };
218
+ kernel.append(toolResultEntry);
219
+ stream.push({ type: 'tool_result', toolCallId: tc.toolCallId, content, isError, details });
220
+ toolResults.push({ toolCallId: tc.toolCallId, toolName: tc.toolName, content, isError, details });
221
+ // Check for steering messages between tool calls (SIGINT semantics)
222
+ const steering = await getSteeringMessages?.() ?? [];
223
+ if (steering.length > 0) {
224
+ steeringMessages = steering;
225
+ }
226
+ }
227
+ return { steeringMessages, toolResults };
228
+ }
229
+ /**
230
+ * Execute all tool calls concurrently with Promise.allSettled.
231
+ * Each tool gets its own AbortController linked to the parent signal.
232
+ * Steering is checked once after all tools complete; if present, all results
233
+ * are discarded and "interrupted" placeholders are written to the kernel.
234
+ */
235
+ async function executeToolsParallel(toolCalls, tools, kernel, stream, signal, getSteeringMessages, toolTimeout) {
236
+ let steeringArrived = false;
237
+ // Per-tool AbortControllers linked to the parent signal
238
+ const controllers = toolCalls.map(() => new AbortController());
239
+ if (signal) {
240
+ const onAbort = () => controllers.forEach(c => c.abort());
241
+ signal.addEventListener('abort', onAbort, { once: true });
242
+ }
243
+ // Run all tools concurrently
244
+ const settled = await Promise.allSettled(toolCalls.map((tc, i) => runSingleTool(tc, tools, stream, controllers[i].signal, toolTimeout)));
245
+ // Check for steering after all tools complete
246
+ const steeringMessages = await getSteeringMessages?.() ?? [];
247
+ if (steeringMessages.length > 0) {
248
+ steeringArrived = true;
249
+ }
250
+ const toolResults = [];
251
+ for (let i = 0; i < toolCalls.length; i++) {
252
+ const tc = toolCalls[i];
253
+ const outcome = settled[i];
254
+ // If steering arrived, discard results and skip remaining
255
+ if (steeringArrived) {
256
+ const skipped = skipTool(tc.toolCallId, tc.toolName, kernel, stream);
257
+ toolResults.push({ toolCallId: tc.toolCallId, toolName: tc.toolName, ...skipped });
258
+ continue;
259
+ }
260
+ const result = outcome.status === 'fulfilled'
261
+ ? outcome.value
262
+ : { content: outcome.reason instanceof Error ? outcome.reason.message : String(outcome.reason), isError: true };
263
+ const { content, isError, details } = result;
264
+ const toolResultEntry = {
265
+ type: 'tool_result',
266
+ payload: { toolCallId: tc.toolCallId, toolName: tc.toolName, content, isError },
267
+ };
268
+ kernel.append(toolResultEntry);
269
+ stream.push({ type: 'tool_result', toolCallId: tc.toolCallId, content, isError, details });
270
+ toolResults.push({ toolCallId: tc.toolCallId, toolName: tc.toolName, content, isError, details });
271
+ }
272
+ return { steeringMessages: steeringArrived ? steeringMessages : undefined, toolResults };
273
+ }
274
+ /**
275
+ * Validate input and execute a single tool call.
276
+ * Wraps execution with an optional timeout. Any thrown error is converted to
277
+ * an error ToolResult rather than propagating (keeps the loop alive).
278
+ */
279
+ async function runSingleTool(tc, tools, stream, signal, toolTimeout) {
280
+ const tool = tools.find((t) => t.name === tc.toolName);
281
+ try {
282
+ if (!tool)
283
+ throw new Error(`Tool not found: ${tc.toolName}`);
284
+ const validated = validateInput(tool, tc.input);
285
+ if (!validated.ok) {
286
+ return { content: validated.content, isError: true };
287
+ }
288
+ const execPromise = tool.execute(tc.toolCallId, validated.value, signal, (partial) => stream.push({ type: 'tool_update', toolCallId: tc.toolCallId, partial }));
289
+ return await (toolTimeout ? withTimeout(execPromise, toolTimeout, signal) : execPromise);
290
+ }
291
+ catch (err) {
292
+ return { content: err instanceof Error ? err.message : String(err), isError: true };
293
+ }
294
+ }
295
+ // ─── withTimeout ──────────────────────────────────────────────────────────────
296
+ /**
297
+ * Race a promise against a deadline. Rejects with a timeout error if the
298
+ * promise does not settle within `ms` milliseconds. Clears the timer on abort.
299
+ */
300
+ function withTimeout(promise, ms, signal) {
301
+ return new Promise((resolve, reject) => {
302
+ const timer = setTimeout(() => reject(new Error(`Tool timed out after ${ms}ms`)), ms);
303
+ const clear = () => clearTimeout(timer);
304
+ signal?.addEventListener('abort', clear);
305
+ promise.then(v => { clear(); resolve(v); }, e => { clear(); reject(e); });
306
+ });
307
+ }
308
+ // ─── withRetry ────────────────────────────────────────────────────────────────
309
+ /**
310
+ * Retry `fn` up to `opts.maxAttempts` times with a fixed `opts.delayMs` pause
311
+ * between attempts. Aborts immediately if the signal is already cancelled.
312
+ */
313
+ async function withRetry(fn, opts, signal) {
314
+ let lastErr;
315
+ for (let attempt = 1; attempt <= opts.maxAttempts; attempt++) {
316
+ if (signal?.aborted)
317
+ throw new DOMException('Aborted', 'AbortError');
318
+ try {
319
+ return await fn();
320
+ }
321
+ catch (err) {
322
+ if (signal?.aborted)
323
+ throw err;
324
+ if (attempt === opts.maxAttempts)
325
+ throw err;
326
+ lastErr = err;
327
+ await new Promise(r => setTimeout(r, opts.delayMs));
328
+ }
329
+ }
330
+ throw lastErr;
331
+ }
332
+ // ─── accumulateUsage ──────────────────────────────────────────────────────────
333
+ /** Add per-step token/cost counters into the running totals for the whole run. */
334
+ function accumulateUsage(acc, step) {
335
+ acc.input += step.input;
336
+ acc.output += step.output;
337
+ acc.cacheRead += step.cacheRead;
338
+ acc.cacheWrite += step.cacheWrite;
339
+ acc.totalTokens += step.totalTokens;
340
+ acc.cost.input += step.cost.input;
341
+ acc.cost.output += step.cost.output;
342
+ acc.cost.cacheRead += step.cost.cacheRead;
343
+ acc.cost.cacheWrite += step.cost.cacheWrite;
344
+ acc.cost.total += step.cost.total;
345
+ }
346
+ /**
347
+ * Validate and coerce tool input against its TypeBox schema.
348
+ * Returns the cleaned value on success, or a human-readable error string on failure.
349
+ * If the tool has no schema, the raw input is passed through unchanged.
350
+ */
351
+ function validateInput(tool, input) {
352
+ if (!tool.parameters)
353
+ return { ok: true, value: input };
354
+ try {
355
+ const value = Value.Parse(tool.parameters, input);
356
+ return { ok: true, value };
357
+ }
358
+ catch {
359
+ const errors = [...Value.Errors(tool.parameters, input)];
360
+ const detail = errors.map((e) => `${e.path || '(root)'}: ${e.message}`).join('; ');
361
+ return { ok: false, content: detail || 'Parameter validation failed' };
362
+ }
363
+ }
364
+ // ─── skipTool ─────────────────────────────────────────────────────────────────
365
+ /**
366
+ * Write an "interrupted" tool_result placeholder for a skipped tool call.
367
+ * Used when steering arrives mid-batch so the kernel never has unmatched tool calls.
368
+ */
369
+ function skipTool(toolCallId, toolName, kernel, stream) {
370
+ const content = 'Skipped: user interrupted.';
371
+ kernel.append({
372
+ type: 'tool_result',
373
+ payload: { toolCallId, toolName, content, isError: true },
374
+ });
375
+ stream.push({ type: 'tool_result', toolCallId, content, isError: true });
376
+ return { content, isError: true };
377
+ }
378
+ //# sourceMappingURL=loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop.js","sourceRoot":"","sources":["../../../src/core/agent/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAehD,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,UA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,CAAA;IACxE,CAAC;AACH,CAAC;AAED,iFAAiF;AAEjF;;;GAGG;AACH,SAAS,QAAQ,CACf,UAAkB,EAClB,QAAkB,EAClB,MAAuB,EACvB,MAAgD;IAEhD,MAAM,OAAO,GAAG,4BAA4B,CAAA;IAC5C,MAAM,CAAC,MAAM,CAAC;QACZ,IAAI,EAAK,aAAa;QACtB,OAAO,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;KAC1D,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;IACxE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AACnC,CAAC"}
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Type definitions for the Agent module.
3
+ *
4
+ * Covers the provider-agnostic LLM streaming contract (StreamFn / LLMStreamEvent),
5
+ * tool definitions (AgentTool / ToolResult), execution hooks (ToolWrapHooks),
6
+ * agent configuration (AgentConfig / AgentOptions), and the event bus (AgentEvent).
7
+ */
8
+ import type { TObject, Static } from '@sinclair/typebox';
9
+ import type { Usage, AgentEntry, AgentMessage, AgentKernel, ContentPart, ToolCallInfo } from '../kernel';
10
+ export type { Usage, StopReason, ToolCallInfo, AgentEntry, AgentMessage, } from '../kernel';
11
+ /**
12
+ * Real-time events emitted by the provider during a single LLM call.
13
+ * The loop forwards these to the UI event stream as they arrive.
14
+ */
15
+ export type LLMStreamEvent = {
16
+ type: 'text-delta';
17
+ delta: string;
18
+ } | {
19
+ type: 'reasoning-delta';
20
+ delta: string;
21
+ } | {
22
+ type: 'tool-call';
23
+ toolCallId: string;
24
+ toolName: string;
25
+ input: Record<string, unknown>;
26
+ };
27
+ /** Reason the LLM stopped generating in a given step. */
28
+ export type LLMStopReason = 'stop' | 'tool_use' | 'length' | 'content_filter' | (string & {});
29
+ /**
30
+ * Resolved value returned by StreamFn after a single LLM call completes.
31
+ * Contains the full text/reasoning, all tool calls requested, and token usage.
32
+ */
33
+ export type LLMStepResult = {
34
+ text: string;
35
+ reasoning?: string;
36
+ toolCalls: ToolCallInfo[];
37
+ stopReason: LLMStopReason;
38
+ usage: Usage;
39
+ };
40
+ /**
41
+ * Provider-injected stream function. Implementer closes over model, API key,
42
+ * system prompt, and any other provider config.
43
+ *
44
+ * `tools` carries the full AgentTool definitions (name, description, parameters)
45
+ * so the provider adapter can build its own tool schema without hardcoding it.
46
+ */
47
+ export type StreamFn = (messages: AgentMessage[], tools: AgentTool[], onEvent: (event: LLMStreamEvent) => void, signal?: AbortSignal) => Promise<LLMStepResult>;
48
+ export type ToolContent = string | ContentPart[];
49
+ /**
50
+ * Result returned by a tool's execute function.
51
+ *
52
+ * - `content` — what the LLM sees (text or multimodal parts)
53
+ * - `isError` — whether this is an error result
54
+ * - `details` — structured data for the UI only; the LLM never sees this
55
+ */
56
+ export type ToolResult<TDetails = unknown> = {
57
+ content: ToolContent;
58
+ isError: boolean;
59
+ details?: TDetails;
60
+ };
61
+ export type AgentTool<TSchema extends TObject = TObject, TDetails = unknown> = {
62
+ name: string;
63
+ /** Human-readable label for UI display. Defaults to `name` if omitted. */
64
+ label?: string;
65
+ /** Passed to the LLM provider as the tool description. */
66
+ description: string;
67
+ /**
68
+ * TypeBox schema for the tool's input parameters.
69
+ * Used for runtime validation in the loop and passed directly to the provider
70
+ * as JSON Schema (TypeBox schemas are standard JSON Schema at runtime).
71
+ */
72
+ parameters?: TSchema;
73
+ execute: (toolCallId: string, input: Static<TSchema>, signal?: AbortSignal, onUpdate?: (partial: ToolResult<TDetails>) => void) => Promise<ToolResult<TDetails>>;
74
+ };
75
+ /**
76
+ * Return value from BeforeToolCallHook:
77
+ * - `{ action: 'block', reason }` — framework-handled: skip tool, return reason as error
78
+ * - `{ action: string }` — caller-defined extension; framework passes through as-is
79
+ * - `void` — allow as-is
80
+ */
81
+ export type BlockResult = {
82
+ action: 'block';
83
+ reason: string;
84
+ };
85
+ export type BeforeToolCallResult = BlockResult | {
86
+ action: string & {};
87
+ };
88
+ export type BeforeToolCallHook = (toolCallId: string, toolName: string, input: Record<string, unknown>) => Promise<BeforeToolCallResult | void> | BeforeToolCallResult | void;
89
+ /**
90
+ * Partial override of the tool result. Only fields you return are applied;
91
+ * return void to keep the original unchanged.
92
+ */
93
+ export type AfterToolCallResult = {
94
+ content?: ToolContent;
95
+ isError?: boolean;
96
+ details?: unknown;
97
+ };
98
+ export type AfterToolCallHook = (toolCallId: string, toolName: string, result: ToolResult) => Promise<AfterToolCallResult | void> | AfterToolCallResult | void;
99
+ export type ToolWrapHooks = {
100
+ before?: BeforeToolCallHook;
101
+ after?: AfterToolCallHook;
102
+ };
103
+ export type ToolResultInfo = {
104
+ toolCallId: string;
105
+ toolName: string;
106
+ content: ToolContent;
107
+ isError: boolean;
108
+ details?: unknown;
109
+ };
110
+ /**
111
+ * Runtime configuration passed to runLoop on each execution.
112
+ * Most fields mirror AgentOptions; the queue-drain callbacks are wired by Agent.
113
+ */
114
+ export interface AgentConfig {
115
+ /** Provider-injected streaming function. */
116
+ stream: StreamFn;
117
+ /** Tools made available to the LLM for this run. */
118
+ tools: AgentTool[];
119
+ /** Maximum number of LLM + tool-execution cycles before the loop stops. */
120
+ maxSteps: number;
121
+ /** Abort signal forwarded to stream calls and tool executions. */
122
+ signal?: AbortSignal;
123
+ /** Returns queued steering entries; called between tool calls and before each LLM step. */
124
+ getSteeringMessages?: () => Promise<AgentEntry[]>;
125
+ /** Returns queued follow-up entries; checked after the agent would otherwise stop. */
126
+ getFollowUpMessages?: () => Promise<AgentEntry[]>;
127
+ /**
128
+ * Optional hook to modify or replace the message array before each LLM call.
129
+ * Useful for injecting system context, filtering, or summarising long threads.
130
+ */
131
+ transformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;
132
+ /** Called after every completed LLM step. Useful for side-effects or logging. */
133
+ onStepEnd?: (kernel: AgentKernel, stepNumber: number) => Promise<void>;
134
+ /** Run tool calls concurrently. Default: false (sequential). */
135
+ parallelTools?: boolean;
136
+ /** Fired when context size reaches or exceeds budget.limit. Callback should call kernel.compact(). */
137
+ onContextFull?: (kernel: AgentKernel, stepNumber: number) => Promise<void>;
138
+ /** Per-tool execution timeout in ms. Undefined = no timeout. */
139
+ toolTimeout?: number;
140
+ /** Retry config for LLM stream errors. */
141
+ retryOnError?: {
142
+ maxAttempts: number;
143
+ delayMs: number;
144
+ };
145
+ }
146
+ /**
147
+ * All events emitted by the agent loop.
148
+ *
149
+ * Lifecycle: agent_start → (turn_start → message_start → … → message_end
150
+ * → tool_call* → tool_result* → turn_end → step_done)* → agent_end
151
+ *
152
+ * - agent_start / agent_end — wraps the entire run
153
+ * - turn_start / turn_end — wraps one LLM call + tool execution cycle
154
+ * - message_start / message_end — wraps the streaming assistant message
155
+ * - text_delta / reasoning_delta — incremental text chunks from the LLM
156
+ * - tool_call — a tool the LLM requested to execute
157
+ * - tool_update — partial progress update from a long-running tool
158
+ * - tool_result — final result after a tool finishes
159
+ * - step_done — emitted after tool results are written to kernel
160
+ */
161
+ export type AgentEvent = {
162
+ type: 'agent_start';
163
+ } | {
164
+ type: 'agent_end';
165
+ error?: string;
166
+ } | {
167
+ type: 'turn_start';
168
+ } | {
169
+ type: 'turn_end';
170
+ toolResults: ToolResultInfo[];
171
+ } | {
172
+ type: 'message_start';
173
+ entry: AgentEntry;
174
+ } | {
175
+ type: 'message_end';
176
+ entry: AgentEntry;
177
+ } | {
178
+ type: 'text_delta';
179
+ delta: string;
180
+ } | {
181
+ type: 'reasoning_delta';
182
+ delta: string;
183
+ } | {
184
+ type: 'tool_call';
185
+ toolCallId: string;
186
+ toolName: string;
187
+ input: Record<string, unknown>;
188
+ } | {
189
+ type: 'tool_update';
190
+ toolCallId: string;
191
+ partial: ToolResult;
192
+ } | {
193
+ type: 'tool_result';
194
+ toolCallId: string;
195
+ content: ToolContent;
196
+ isError: boolean;
197
+ details?: unknown;
198
+ } | {
199
+ type: 'step_done';
200
+ stepNumber: number;
201
+ usage: Usage;
202
+ };
203
+ /** Resolved value of EventStream.result() after a successful agent run. */
204
+ export type AgentResult = {
205
+ /** Aggregated token usage across all steps in the run. */
206
+ usage: Usage;
207
+ /** Wall-clock duration of the entire run in milliseconds. */
208
+ durationMs: number;
209
+ };
210
+ /**
211
+ * Controls how queued steering or follow-up messages are drained each time the
212
+ * agent checks the queue.
213
+ *
214
+ * - 'one-at-a-time' — dequeue a single entry per check (default)
215
+ * - 'all' — dequeue all pending entries at once
216
+ */
217
+ export type QueueMode = 'all' | 'one-at-a-time';
218
+ export interface AgentOptions {
219
+ stream: StreamFn;
220
+ tools: AgentTool[];
221
+ maxSteps: number;
222
+ transformContext?: AgentConfig['transformContext'];
223
+ onStepEnd?: AgentConfig['onStepEnd'];
224
+ steeringMode?: QueueMode;
225
+ followUpMode?: QueueMode;
226
+ parallelTools?: AgentConfig['parallelTools'];
227
+ onContextFull?: AgentConfig['onContextFull'];
228
+ toolTimeout?: AgentConfig['toolTimeout'];
229
+ retryOnError?: AgentConfig['retryOnError'];
230
+ }
231
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/agent/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EACV,KAAK,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,YAAY,EACb,MAAM,WAAW,CAAA;AAElB,YAAY,EACV,KAAK,EACL,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,GACb,MAAM,WAAW,CAAA;AAIlB;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAM,KAAK,EAAE,MAAM,CAAA;CAAE,G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AAO,KAAK,CAAA;IACjB,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAID;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,eAAe,CAAA;AAE/C,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAa,QAAQ,CAAA;IAC3B,KAAK,EAAc,SAAS,EAAE,CAAA;IAC9B,QAAQ,EAAW,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAA;IAClD,SAAS,CAAC,EAAS,WAAW,CAAC,WAAW,CAAC,CAAA;IAC3C,YAAY,CAAC,EAAM,SAAS,CAAA;IAC5B,YAAY,CAAC,EAAM,SAAS,CAAA;IAC5B,aAAa,CAAC,EAAK,WAAW,CAAC,eAAe,CAAC,CAAA;IAC/C,aAAa,CAAC,EAAK,WAAW,CAAC,eAAe,CAAC,CAAA;IAC/C,WAAW,CAAC,EAAO,WAAW,CAAC,aAAa,CAAC,CAAA;IAC7C,YAAY,CAAC,EAAM,WAAW,CAAC,cAAc,CAAC,CAAA;CAC/C"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Type definitions for the Agent module.
3
+ *
4
+ * Covers the provider-agnostic LLM streaming contract (StreamFn / LLMStreamEvent),
5
+ * tool definitions (AgentTool / ToolResult), execution hooks (ToolWrapHooks),
6
+ * agent configuration (AgentConfig / AgentOptions), and the event bus (AgentEvent).
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/agent/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}