@noetaris/harness-types 0.6.0 → 0.7.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 +33 -4
- package/dist/index.d.ts +34 -3
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This package defines the common TypeScript interfaces that all LLM adapter packa
|
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
|
-
`@noetaris/harness-types` is a types package with zero dependencies and
|
|
9
|
+
`@noetaris/harness-types` is a types package with zero dependencies and two small runtime helpers, `toBlocks()` and `runTool()`. It provides the canonical definitions for messages, tools, and the `LLM` interface — the surface that all adapters (Anthropic, OpenAI, Gemini, etc.) must satisfy.
|
|
10
10
|
|
|
11
11
|
## Types
|
|
12
12
|
|
|
@@ -19,13 +19,15 @@ This package defines the common TypeScript interfaces that all LLM adapter packa
|
|
|
19
19
|
| `Tool` | `{ name: string; description: string; inputSchema: Record<string, unknown> }` |
|
|
20
20
|
| `ToolCall` | `{ id: string; name: string; input: unknown }` |
|
|
21
21
|
| `LLMResponse` | `{ text: string; toolCalls: ToolCall[]; stopReason: 'end' \| 'tool_use' \| 'max_tokens'; usage: { inputTokens: number; outputTokens: number; contextWindowSize?: number } }` — `usage` is always present; all adapters must populate it |
|
|
22
|
-
| `LLMRequestEvent` | `"llm.request"` payload: `{ modelId: string; providerName: string; messages?: unknown; tools?: unknown }` (`messages`/`tools` opt-in) |
|
|
22
|
+
| `LLMRequestEvent` | `"llm.request"` payload: `{ modelId: string; providerName: string; messages?: unknown; tools?: unknown; callId?: string }` (`messages`/`tools` opt-in; `callId` pairs the event with its `"llm.response"`) |
|
|
23
23
|
| `LLMUsageEvent` | `"llm.response"` payload: `{ tokens: { input: number; output: number }; modelId: string; stopReason: LLMResponse['stopReason']; providerName: string; output?: unknown; contextWindowSize?: number }` |
|
|
24
24
|
| `ToolCallEvent` | `"tool.call"` payload: `{ toolName: string; toolCallId: string; input?: unknown }` (`input` opt-in) |
|
|
25
|
-
| `ToolResultEvent` | `"tool.result"` payload: `{ toolName: string; toolCallId: string; durationMs: number; result?: unknown; error?: unknown }` (`result
|
|
25
|
+
| `ToolResultEvent` | `"tool.result"` payload: `{ toolName: string; toolCallId: string; durationMs: number; result?: unknown; error?: unknown }` (`result` opt-in; `error` is set whenever the tool threw) |
|
|
26
|
+
| `ToolRunContext` | `{ emit(name, payload?): void; within<T>(type, payload, fn): Promise<T> }` — the part of a step `ctx` that `runTool` needs |
|
|
27
|
+
| `RunToolOptions` | `{ captureIO?: boolean }` — options of `runTool` |
|
|
26
28
|
| `LLM` | `{ invoke(messages: Message[], options?: { tools?: Tool[] }): Promise<LLMResponse> }` |
|
|
27
29
|
|
|
28
|
-
The
|
|
30
|
+
The runtime exports are `toBlocks(content: string | ContentBlock[]): ContentBlock[]`, which turns a string into a single text block and returns an array as it is, and [`runTool`](#reporting-tool-calls).
|
|
29
31
|
|
|
30
32
|
## Image input
|
|
31
33
|
|
|
@@ -51,6 +53,33 @@ const message: Message = {
|
|
|
51
53
|
- The model must be able to read images. The adapters do not check this.
|
|
52
54
|
- Large images in session state are expensive to store. See [Large media in session state](https://github.com/noetaris-lab/harness/blob/main/LIMITATIONS.md).
|
|
53
55
|
|
|
56
|
+
## Reporting tool calls
|
|
57
|
+
|
|
58
|
+
`runTool(ctx, call, fn, options?)` runs one tool call and reports it. It emits `"tool.call"`,
|
|
59
|
+
runs `fn` inside `ctx.within('tool.call', { toolCallId })`, then emits `"tool.result"` with
|
|
60
|
+
`durationMs`. If `fn` throws, `"tool.result"` carries the thrown value as `error` and the same
|
|
61
|
+
value is rethrown. It returns `fn`'s value.
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { runTool } from '@noetaris/harness-types'
|
|
65
|
+
|
|
66
|
+
// inside a step
|
|
67
|
+
const outputs = await Promise.all(
|
|
68
|
+
state.toolCalls.map(call => runTool(ctx, call, () => toolImpls[call.name](call.input))),
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- `ctx` is the step's `ctx` from `@noetaris/harness` 0.7 or later, or any object with `emit` and
|
|
73
|
+
`within` (see `ToolRunContext`). With an OTel observer, the tool's span is the active span while
|
|
74
|
+
`fn` runs, so a sub agent or an instrumented HTTP call made by the tool nests under it. See the
|
|
75
|
+
[OTel bridge](https://github.com/noetaris-lab/harness-otel).
|
|
76
|
+
- `options.captureIO` (default `false`) puts the call's `input` on `"tool.call"` and the tool's
|
|
77
|
+
result on `"tool.result"`. They may contain sensitive data. An OTel observer records them only
|
|
78
|
+
when its `captureToolIO` option is on as well.
|
|
79
|
+
- `"tool.result"` always carries `error` when the tool threw, whatever `captureIO` says; a thrown
|
|
80
|
+
`undefined` is reported as `Error('tool threw undefined')`.
|
|
81
|
+
- Calls made at the same time keep their own events, told apart by `toolCallId`.
|
|
82
|
+
|
|
54
83
|
## Installation
|
|
55
84
|
|
|
56
85
|
```sh
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of a step ctx {@link runTool} needs. The `@noetaris/harness` step ctx (0.7 and
|
|
3
|
+
* later) satisfies it structurally.
|
|
4
|
+
*/
|
|
5
|
+
interface ToolRunContext {
|
|
6
|
+
emit(name: string, payload?: unknown): void;
|
|
7
|
+
within<T>(type: string, payload: unknown, fn: () => Promise<T>): Promise<T>;
|
|
8
|
+
}
|
|
9
|
+
interface RunToolOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Put the tool's `input` on `"tool.call"` and its `result` on `"tool.result"`. They may
|
|
12
|
+
* contain sensitive data. Default: `false`.
|
|
13
|
+
*/
|
|
14
|
+
captureIO?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Run one tool call and report it: emits `"tool.call"`, runs `fn` inside the observer's scope
|
|
18
|
+
* for that event (`ctx.within('tool.call', { toolCallId })`), then emits `"tool.result"` with
|
|
19
|
+
* `durationMs` — and `error` when `fn` threw, in which case the same value is rethrown.
|
|
20
|
+
* Returns `fn`'s value.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const outputs = await Promise.all(
|
|
25
|
+
* res.toolCalls.map(call => runTool(ctx, call, () => toolImpls[call.name](call.input))),
|
|
26
|
+
* )
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare function runTool<T>(ctx: ToolRunContext, call: Pick<ToolCall, 'id' | 'name' | 'input'>, fn: () => Promise<T>, options?: RunToolOptions): Promise<T>;
|
|
30
|
+
|
|
1
31
|
/**
|
|
2
32
|
* Shared LLM protocol types used by all harness LLM adapters.
|
|
3
33
|
*
|
|
@@ -152,8 +182,9 @@ interface ToolCallEvent {
|
|
|
152
182
|
/**
|
|
153
183
|
* Payload emitted on `"tool.result"` after a tool completes or throws.
|
|
154
184
|
*
|
|
155
|
-
* `result`
|
|
156
|
-
*
|
|
185
|
+
* `result` is opt-in — it may contain sensitive data; omit by default.
|
|
186
|
+
* `error` is set whenever the tool threw (the thrown value) and absent on success; it is how
|
|
187
|
+
* consumers tell a failed call from a successful one, so it is not gated.
|
|
157
188
|
*/
|
|
158
189
|
interface ToolResultEvent {
|
|
159
190
|
toolName: string;
|
|
@@ -182,4 +213,4 @@ interface LLM {
|
|
|
182
213
|
}): Promise<LLMResponse>;
|
|
183
214
|
}
|
|
184
215
|
|
|
185
|
-
export { type ContentBlock, type ImageBlock, type LLM, type LLMRequestEvent, type LLMResponse, type LLMUsageEvent, type Message, type TextBlock, type Tool, type ToolCall, type ToolCallEvent, type ToolResultEvent, toBlocks };
|
|
216
|
+
export { type ContentBlock, type ImageBlock, type LLM, type LLMRequestEvent, type LLMResponse, type LLMUsageEvent, type Message, type RunToolOptions, type TextBlock, type Tool, type ToolCall, type ToolCallEvent, type ToolResultEvent, type ToolRunContext, runTool, toBlocks };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
|
+
// src/run-tool.ts
|
|
2
|
+
async function runTool(ctx, call, fn, options) {
|
|
3
|
+
const captureIO = options?.captureIO === true;
|
|
4
|
+
const base = { toolName: call.name, toolCallId: call.id };
|
|
5
|
+
const callEvent = captureIO ? { ...base, input: call.input } : base;
|
|
6
|
+
ctx.emit("tool.call", callEvent);
|
|
7
|
+
const start = Date.now();
|
|
8
|
+
let value;
|
|
9
|
+
try {
|
|
10
|
+
value = await ctx.within("tool.call", { toolCallId: call.id }, fn);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
const failed = {
|
|
13
|
+
...base,
|
|
14
|
+
durationMs: Date.now() - start,
|
|
15
|
+
// Consumers read `error !== undefined` as "the tool failed", so a thrown undefined is named.
|
|
16
|
+
error: error === void 0 ? new Error("tool threw undefined") : error
|
|
17
|
+
};
|
|
18
|
+
ctx.emit("tool.result", failed);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
const succeeded = captureIO ? { ...base, durationMs: Date.now() - start, result: value } : { ...base, durationMs: Date.now() - start };
|
|
22
|
+
ctx.emit("tool.result", succeeded);
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
|
|
1
26
|
// src/index.ts
|
|
2
27
|
function toBlocks(content) {
|
|
3
28
|
return typeof content === "string" ? [{ type: "text", text: content }] : content;
|
|
4
29
|
}
|
|
5
30
|
export {
|
|
31
|
+
runTool,
|
|
6
32
|
toBlocks
|
|
7
33
|
};
|
|
8
34
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Shared LLM protocol types used by all harness LLM adapters.\n *\n * @packageDocumentation\n */\n\n/** A run of plain text inside a user message. */\nexport type TextBlock = { type: 'text'; text: string }\n\n/**\n * An image inside a user message.\n *\n * `data` is raw base64 with no `data:` prefix. `mediaType` is the MIME type\n * (e.g. `'image/png'`); Anthropic, OpenAI and Ollama throw on types they do not accept; Gemini passes any value through.\n */\nexport type ImageBlock = { type: 'image'; data: string; mediaType: string }\n\n/** One piece of user-message content. */\nexport type ContentBlock = TextBlock | ImageBlock\n\n/**\n * A single turn in a conversation.\n *\n * - `user` — input from the human side: a string, or blocks mixing text and images.\n * An empty block array is allowed by the type but may be rejected by providers; don't send one.\n * - `assistant` — model reply, optionally carrying tool-call requests.\n * - `tool` — result returned to the model after a tool call.\n */\nexport type Message =\n | { role: 'user'; content: string | ContentBlock[] }\n | { role: 'assistant'; content?: string; toolCalls?: ToolCall[] }\n | { role: 'tool'; toolCallId: string; content: string }\n\n/**\n * Normalize user-message content to blocks.\n *\n * A string becomes one text block (an empty string stays one empty text block).\n * An array is returned as-is, same reference, with no validation.\n */\nexport function toBlocks(content: string | ContentBlock[]): ContentBlock[] {\n return typeof content === 'string' ? [{ type: 'text', text: content }] : content\n}\n\n/**\n * A tool the LLM may invoke during a conversation turn.\n *\n * `inputSchema` must be a valid JSON Schema object describing the tool's\n * input parameters (LLM adapters pass it to the provider as-is).\n */\nexport interface Tool {\n name: string\n description: string\n inputSchema: Record<string, unknown>\n}\n\n/**\n * A single tool-call request emitted by the LLM in an assistant turn.\n *\n * `id` is provider-assigned and must be echoed back in the corresponding\n * `role: 'tool'` message so the model can correlate results.\n */\nexport interface ToolCall {\n id: string\n name: string\n input: unknown\n}\n\n/**\n * Normalized response returned by every {@link LLM} adapter.\n *\n * `text` may be empty when `stopReason` is `'tool_use'`.\n * `toolCalls` is empty when `stopReason` is `'end'` or `'max_tokens'`.\n * `usage` is always present — all adapters must populate it.\n */\nexport interface LLMResponse {\n text: string\n toolCalls: ToolCall[]\n stopReason: 'end' | 'tool_use' | 'max_tokens'\n usage: {\n /** Number of input tokens consumed by this call. */\n inputTokens: number\n /** Number of output tokens generated by this call. */\n outputTokens: number\n /**\n * The model's total context window capacity in tokens.\n * Present only when the adapter can determine it.\n * Absent when the adapter cannot determine capacity.\n */\n contextWindowSize?: number\n }\n}\n\n/**\n * Payload emitted by LLM adapters as an `\"llm.request\"` observer event,\n * immediately before the provider call is made.\n *\n * `messages` and `tools` are opt-in — they may contain sensitive data and are\n * typed as `unknown` because adapters pass their internal translated\n * representations; the framework never inspects this content.\n */\nexport interface LLMRequestEvent {\n modelId: string\n providerName: string\n messages?: unknown // opt-in; adapter's internal translated representation\n tools?: unknown // opt-in; adapter's internal translated representation\n /**\n * Correlation id for this single `invoke()` call, minted per call by the adapter and\n * carried on both the `\"llm.request\"` and the matching `\"llm.response\"` event, so an\n * observer can pair them reliably even when concurrent fork branches interleave.\n */\n callId?: string\n}\n\n/**\n * Token-usage payload emitted by LLM adapters as an `\"llm.response\"` observer event.\n *\n * Adapters that cannot report real token counts (e.g. mock adapters) emit `{ input: 0, output: 0 }`.\n *\n * `output` is opt-in — it may contain sensitive data; adapters default to omitting it.\n * `contextWindowSize` mirrors `LLMResponse.usage.contextWindowSize` — present when the\n * adapter can determine it; absent otherwise.\n */\nexport interface LLMUsageEvent {\n tokens: { input: number; output: number }\n modelId: string\n stopReason: LLMResponse['stopReason']\n providerName: string\n output?: unknown // opt-in; normalized LLMResponse or raw provider output; may be sensitive\n contextWindowSize?: number\n /**\n * Correlation id matching the `\"llm.request\"` event for the same `invoke()` call\n * (see {@link LLMRequestEvent.callId}). Lets an observer pair request and response.\n */\n callId?: string\n}\n\n/**\n * Payload emitted on `\"tool.call\"` before a tool is dispatched.\n *\n * `input` is opt-in — it may contain sensitive data; omit by default.\n */\nexport interface ToolCallEvent {\n toolName: string\n toolCallId: string\n input?: unknown\n}\n\n/**\n * Payload emitted on `\"tool.result\"` after a tool completes or throws.\n *\n * `result`
|
|
1
|
+
{"version":3,"sources":["../src/run-tool.ts","../src/index.ts"],"sourcesContent":["import type { ToolCall, ToolCallEvent, ToolResultEvent } from './index.js'\n\n/**\n * The part of a step ctx {@link runTool} needs. The `@noetaris/harness` step ctx (0.7 and\n * later) satisfies it structurally.\n */\nexport interface ToolRunContext {\n emit(name: string, payload?: unknown): void\n within<T>(type: string, payload: unknown, fn: () => Promise<T>): Promise<T>\n}\n\nexport interface RunToolOptions {\n /**\n * Put the tool's `input` on `\"tool.call\"` and its `result` on `\"tool.result\"`. They may\n * contain sensitive data. Default: `false`.\n */\n captureIO?: boolean\n}\n\n/**\n * Run one tool call and report it: emits `\"tool.call\"`, runs `fn` inside the observer's scope\n * for that event (`ctx.within('tool.call', { toolCallId })`), then emits `\"tool.result\"` with\n * `durationMs` — and `error` when `fn` threw, in which case the same value is rethrown.\n * Returns `fn`'s value.\n *\n * @example\n * ```ts\n * const outputs = await Promise.all(\n * res.toolCalls.map(call => runTool(ctx, call, () => toolImpls[call.name](call.input))),\n * )\n * ```\n */\nexport async function runTool<T>(\n ctx: ToolRunContext,\n call: Pick<ToolCall, 'id' | 'name' | 'input'>,\n fn: () => Promise<T>,\n options?: RunToolOptions,\n): Promise<T> {\n const captureIO = options?.captureIO === true\n const base = { toolName: call.name, toolCallId: call.id }\n const callEvent: ToolCallEvent = captureIO ? { ...base, input: call.input } : base\n ctx.emit('tool.call', callEvent)\n\n const start = Date.now()\n let value: T\n try {\n value = await ctx.within('tool.call', { toolCallId: call.id }, fn)\n } catch (error) {\n const failed: ToolResultEvent = {\n ...base,\n durationMs: Date.now() - start,\n // Consumers read `error !== undefined` as \"the tool failed\", so a thrown undefined is named.\n error: error === undefined ? new Error('tool threw undefined') : error,\n }\n ctx.emit('tool.result', failed)\n throw error\n }\n const succeeded: ToolResultEvent = captureIO\n ? { ...base, durationMs: Date.now() - start, result: value }\n : { ...base, durationMs: Date.now() - start }\n ctx.emit('tool.result', succeeded)\n return value\n}\n","/**\n * Shared LLM protocol types used by all harness LLM adapters.\n *\n * @packageDocumentation\n */\n\n/** A run of plain text inside a user message. */\nexport type TextBlock = { type: 'text'; text: string }\n\n/**\n * An image inside a user message.\n *\n * `data` is raw base64 with no `data:` prefix. `mediaType` is the MIME type\n * (e.g. `'image/png'`); Anthropic, OpenAI and Ollama throw on types they do not accept; Gemini passes any value through.\n */\nexport type ImageBlock = { type: 'image'; data: string; mediaType: string }\n\n/** One piece of user-message content. */\nexport type ContentBlock = TextBlock | ImageBlock\n\n/**\n * A single turn in a conversation.\n *\n * - `user` — input from the human side: a string, or blocks mixing text and images.\n * An empty block array is allowed by the type but may be rejected by providers; don't send one.\n * - `assistant` — model reply, optionally carrying tool-call requests.\n * - `tool` — result returned to the model after a tool call.\n */\nexport type Message =\n | { role: 'user'; content: string | ContentBlock[] }\n | { role: 'assistant'; content?: string; toolCalls?: ToolCall[] }\n | { role: 'tool'; toolCallId: string; content: string }\n\n/**\n * Normalize user-message content to blocks.\n *\n * A string becomes one text block (an empty string stays one empty text block).\n * An array is returned as-is, same reference, with no validation.\n */\nexport function toBlocks(content: string | ContentBlock[]): ContentBlock[] {\n return typeof content === 'string' ? [{ type: 'text', text: content }] : content\n}\n\n/**\n * A tool the LLM may invoke during a conversation turn.\n *\n * `inputSchema` must be a valid JSON Schema object describing the tool's\n * input parameters (LLM adapters pass it to the provider as-is).\n */\nexport interface Tool {\n name: string\n description: string\n inputSchema: Record<string, unknown>\n}\n\n/**\n * A single tool-call request emitted by the LLM in an assistant turn.\n *\n * `id` is provider-assigned and must be echoed back in the corresponding\n * `role: 'tool'` message so the model can correlate results.\n */\nexport interface ToolCall {\n id: string\n name: string\n input: unknown\n}\n\n/**\n * Normalized response returned by every {@link LLM} adapter.\n *\n * `text` may be empty when `stopReason` is `'tool_use'`.\n * `toolCalls` is empty when `stopReason` is `'end'` or `'max_tokens'`.\n * `usage` is always present — all adapters must populate it.\n */\nexport interface LLMResponse {\n text: string\n toolCalls: ToolCall[]\n stopReason: 'end' | 'tool_use' | 'max_tokens'\n usage: {\n /** Number of input tokens consumed by this call. */\n inputTokens: number\n /** Number of output tokens generated by this call. */\n outputTokens: number\n /**\n * The model's total context window capacity in tokens.\n * Present only when the adapter can determine it.\n * Absent when the adapter cannot determine capacity.\n */\n contextWindowSize?: number\n }\n}\n\n/**\n * Payload emitted by LLM adapters as an `\"llm.request\"` observer event,\n * immediately before the provider call is made.\n *\n * `messages` and `tools` are opt-in — they may contain sensitive data and are\n * typed as `unknown` because adapters pass their internal translated\n * representations; the framework never inspects this content.\n */\nexport interface LLMRequestEvent {\n modelId: string\n providerName: string\n messages?: unknown // opt-in; adapter's internal translated representation\n tools?: unknown // opt-in; adapter's internal translated representation\n /**\n * Correlation id for this single `invoke()` call, minted per call by the adapter and\n * carried on both the `\"llm.request\"` and the matching `\"llm.response\"` event, so an\n * observer can pair them reliably even when concurrent fork branches interleave.\n */\n callId?: string\n}\n\n/**\n * Token-usage payload emitted by LLM adapters as an `\"llm.response\"` observer event.\n *\n * Adapters that cannot report real token counts (e.g. mock adapters) emit `{ input: 0, output: 0 }`.\n *\n * `output` is opt-in — it may contain sensitive data; adapters default to omitting it.\n * `contextWindowSize` mirrors `LLMResponse.usage.contextWindowSize` — present when the\n * adapter can determine it; absent otherwise.\n */\nexport interface LLMUsageEvent {\n tokens: { input: number; output: number }\n modelId: string\n stopReason: LLMResponse['stopReason']\n providerName: string\n output?: unknown // opt-in; normalized LLMResponse or raw provider output; may be sensitive\n contextWindowSize?: number\n /**\n * Correlation id matching the `\"llm.request\"` event for the same `invoke()` call\n * (see {@link LLMRequestEvent.callId}). Lets an observer pair request and response.\n */\n callId?: string\n}\n\n/**\n * Payload emitted on `\"tool.call\"` before a tool is dispatched.\n *\n * `input` is opt-in — it may contain sensitive data; omit by default.\n */\nexport interface ToolCallEvent {\n toolName: string\n toolCallId: string\n input?: unknown\n}\n\n/**\n * Payload emitted on `\"tool.result\"` after a tool completes or throws.\n *\n * `result` is opt-in — it may contain sensitive data; omit by default.\n * `error` is set whenever the tool threw (the thrown value) and absent on success; it is how\n * consumers tell a failed call from a successful one, so it is not gated.\n */\nexport interface ToolResultEvent {\n toolName: string\n toolCallId: string\n durationMs: number\n result?: unknown\n error?: unknown\n}\n\n/**\n * Core interface every LLM adapter must implement.\n *\n * @example\n * ```ts\n * const response = await llm.invoke(messages, { tools: [myTool] })\n * ```\n */\nexport interface LLM {\n /**\n * Send a message list to the LLM and return a normalized response.\n *\n * @param messages - Conversation history, oldest first.\n * @param options.tools - Optional tools the model may invoke.\n */\n invoke(messages: Message[], options?: { tools?: Tool[] }): Promise<LLMResponse>\n}\n\nexport { runTool, type ToolRunContext, type RunToolOptions } from './run-tool.js'\n"],"mappings":";AAgCA,eAAsB,QACpB,KACA,MACA,IACA,SACY;AACZ,QAAM,YAAY,SAAS,cAAc;AACzC,QAAM,OAAO,EAAE,UAAU,KAAK,MAAM,YAAY,KAAK,GAAG;AACxD,QAAM,YAA2B,YAAY,EAAE,GAAG,MAAM,OAAO,KAAK,MAAM,IAAI;AAC9E,MAAI,KAAK,aAAa,SAAS;AAE/B,QAAM,QAAQ,KAAK,IAAI;AACvB,MAAI;AACJ,MAAI;AACF,YAAQ,MAAM,IAAI,OAAO,aAAa,EAAE,YAAY,KAAK,GAAG,GAAG,EAAE;AAAA,EACnE,SAAS,OAAO;AACd,UAAM,SAA0B;AAAA,MAC9B,GAAG;AAAA,MACH,YAAY,KAAK,IAAI,IAAI;AAAA;AAAA,MAEzB,OAAO,UAAU,SAAY,IAAI,MAAM,sBAAsB,IAAI;AAAA,IACnE;AACA,QAAI,KAAK,eAAe,MAAM;AAC9B,UAAM;AAAA,EACR;AACA,QAAM,YAA6B,YAC/B,EAAE,GAAG,MAAM,YAAY,KAAK,IAAI,IAAI,OAAO,QAAQ,MAAM,IACzD,EAAE,GAAG,MAAM,YAAY,KAAK,IAAI,IAAI,MAAM;AAC9C,MAAI,KAAK,eAAe,SAAS;AACjC,SAAO;AACT;;;ACvBO,SAAS,SAAS,SAAkD;AACzE,SAAO,OAAO,YAAY,WAAW,CAAC,EAAE,MAAM,QAAQ,MAAM,QAAQ,CAAC,IAAI;AAC3E;","names":[]}
|