@orkestrel/ollama 0.0.18 → 0.0.20
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/dist/src/core/index.cjs.map +1 -1
- package/package.json +21 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/core/constants.ts","../../../src/core/helpers.ts","../../../src/core/OllamaProvider.ts","../../../src/core/factories.ts"],"sourcesContent":["// Ollama constants — the provider's defaults.\n\n/**\n * Names the local Ollama daemon base URL, `'http://localhost:11434'`, assumed when\n * `OllamaOptions.url` is omitted.\n */\nexport const DEFAULT_OLLAMA_URL = 'http://localhost:11434'\n\n/**\n * Names how long the model stays resident after a call — `'5m'` when\n * `OllamaOptions.keepAlive` is omitted, Ollama's own `keep_alive` default, expressed as a\n * duration string.\n *\n * @remarks\n * The name mirrors the Ollama `/api/chat` `keep_alive` field this value is sent as, so\n * the constant, the `OllamaOptions.keepAlive` key, and the wire member read as one term.\n */\nexport const DEFAULT_KEEP_ALIVE = '5m'\n\n/** Names the Ollama chat endpoint appended to the configured base URL. */\nexport const OLLAMA_CHAT_PATH = '/api/chat'\n","// The Ollama wire leaves — the request projections and the response extractions\n// `OllamaProvider` composes. Each is a pure, total function of its parameters: a missing\n// or malformed wire field degrades to a sensible default (empty content, no usage, `{}`\n// arguments), never a throw, and no value is reached through `as`.\n\nimport type { Message } from '@orkestrel/agent'\nimport type { TokenUsage } from '@orkestrel/budget'\nimport type { ToolCall } from '@orkestrel/tool'\nimport type { WireChatRequest } from './types.js'\nimport { isArray, isNumber, isRecord, isString, parseJSONAs } from '@orkestrel/contract'\n\n/**\n * Maps conversation turns onto the `/api/chat` wire's minimal message shape.\n *\n * @remarks\n * `tool_calls` is emitted only on a turn that replays them and `images` only on a\n * multimodal turn, so an empty optional never reaches the wire.\n *\n * @param messages - The conversation turns to send\n * @returns The wire `messages` array, one entry per turn, in order\n *\n * @example\n * ```ts\n * mapMessages([{ id: '1', role: 'user', content: 'Say hello.' }])\n * // [{ role: 'user', content: 'Say hello.' }]\n * ```\n */\nexport function mapMessages(messages: readonly Message[]): WireChatRequest['messages'] {\n\treturn messages.map((message) => ({\n\t\trole: message.role,\n\t\tcontent: message.content,\n\t\t...(message.calls !== undefined && message.calls.length > 0\n\t\t\t? {\n\t\t\t\t\ttool_calls: message.calls.map((call) => ({\n\t\t\t\t\t\tfunction: { name: call.name, arguments: call.arguments },\n\t\t\t\t\t})),\n\t\t\t\t}\n\t\t\t: {}),\n\t\t// Forward multimodal image data — Ollama accepts a base64 `images` array on a\n\t\t// message, which a vision-capable model receives alongside the text content.\n\t\t...(message.images !== undefined && message.images.length > 0\n\t\t\t? { images: [...message.images] }\n\t\t\t: {}),\n\t}))\n}\n\n/**\n * Extracts the assistant text of one wire record.\n *\n * @param record - One parsed `/api/chat` NDJSON record\n * @returns The record's `message.content` when it is a string, else `''`\n *\n * @example\n * ```ts\n * extractContent({ message: { content: 'ok' } }) // 'ok'\n * ```\n */\nexport function extractContent(record: Readonly<Record<string, unknown>>): string {\n\tconst message = Reflect.get(record, 'message')\n\tif (!isRecord(message)) return ''\n\tconst content = Reflect.get(message, 'content')\n\treturn isString(content) ? content : ''\n}\n\n/**\n * Extracts the daemon-side reasoning of one wire record.\n *\n * @remarks\n * `message.thinking` is the `think: true` wire shape. It is read whatever the configured\n * flag says, because a daemon may separate reasoning on its own.\n *\n * @param record - One parsed `/api/chat` NDJSON record\n * @returns The record's `message.thinking` when it is a string, else `''`\n *\n * @example\n * ```ts\n * extractThinking({ message: { thinking: 'weighing it' } }) // 'weighing it'\n * ```\n */\nexport function extractThinking(record: Readonly<Record<string, unknown>>): string {\n\tconst message = Reflect.get(record, 'message')\n\tif (!isRecord(message)) return ''\n\tconst thinking = Reflect.get(message, 'thinking')\n\treturn isString(thinking) ? thinking : ''\n}\n\n/**\n * Extracts the token usage of one wire record.\n *\n * @remarks\n * Both counts must be numbers, which is true of the stream's `done: true` line. A\n * delta line carries neither, so it yields `undefined`.\n *\n * @param record - One parsed `/api/chat` NDJSON record\n * @returns The `TokenUsage` shape, or `undefined` when either count is absent\n *\n * @example\n * ```ts\n * extractUsage({ prompt_eval_count: 3, eval_count: 4 })\n * // { prompt: 3, completion: 4, total: 7 }\n * ```\n */\nexport function extractUsage(record: Readonly<Record<string, unknown>>): TokenUsage | undefined {\n\tconst prompt = Reflect.get(record, 'prompt_eval_count')\n\tconst completion = Reflect.get(record, 'eval_count')\n\tif (!isNumber(prompt) || !isNumber(completion)) return undefined\n\treturn { prompt, completion, total: prompt + completion }\n}\n\n/**\n * Extracts the tool calls of one wire record's `message.tool_calls`.\n *\n * @remarks\n * Each entry narrows to `{ id, name, arguments }`: the entry and its `function` must be\n * records and `name` a string, else the entry is dropped. An id is minted when the wire\n * omits one.\n *\n * @param record - One parsed `/api/chat` NDJSON record\n * @returns The narrowed tool calls, empty when the record carries none\n *\n * @example\n * ```ts\n * extractTools({ message: { tool_calls: [{ function: { name: 'weather' } }] } })\n * // [{ id: '…', name: 'weather', arguments: {} }]\n * ```\n */\nexport function extractTools(record: Readonly<Record<string, unknown>>): readonly ToolCall[] {\n\tconst message = Reflect.get(record, 'message')\n\tif (!isRecord(message)) return []\n\tconst calls = Reflect.get(message, 'tool_calls')\n\tif (!isArray(calls)) return []\n\tconst out: ToolCall[] = []\n\tfor (const entry of calls) {\n\t\tif (!isRecord(entry)) continue\n\t\tconst callable = Reflect.get(entry, 'function')\n\t\tif (!isRecord(callable)) continue\n\t\tconst name = Reflect.get(callable, 'name')\n\t\tif (!isString(name)) continue\n\t\tconst id = Reflect.get(entry, 'id')\n\t\tout.push({\n\t\t\tid: isString(id) ? id : crypto.randomUUID(),\n\t\t\tname,\n\t\t\targuments: extractArguments(Reflect.get(callable, 'arguments')),\n\t\t})\n\t}\n\treturn out\n}\n\n/**\n * Extracts a wire `arguments` value as a record.\n *\n * @remarks\n * Total: an object passes through, a JSON string is parsed when it yields a record, and\n * a malformed string yields `{}` rather than throwing.\n *\n * @param value - The wire's `function.arguments` value, of unknown shape\n * @returns The argument record, or `{}` when the value carries none\n *\n * @example\n * ```ts\n * extractArguments('{\"city\":\"Oslo\"}') // { city: 'Oslo' }\n * ```\n */\nexport function extractArguments(value: unknown): Readonly<Record<string, unknown>> {\n\tif (isRecord(value)) return value\n\tif (isString(value)) return parseJSONAs(value, isRecord) ?? {}\n\treturn {}\n}\n","import type {\n\tAgentProviderInterface,\n\tProviderIncrement,\n\tProviderParserInterface,\n\tProviderRequest,\n} from '@orkestrel/agent'\nimport type { OllamaOptions, WireChatRequest } from './types.js'\nimport { AgentProvider } from '@orkestrel/agent'\nimport { createNDJSONParser } from '@orkestrel/ndjson'\nimport { DEFAULT_KEEP_ALIVE, DEFAULT_OLLAMA_URL, OLLAMA_CHAT_PATH } from './constants.js'\nimport {\n\textractContent,\n\textractThinking,\n\textractTools,\n\textractUsage,\n\tmapMessages,\n} from './helpers.js'\n\n/**\n * Implements the Ollama `/api/chat` wire over the shared {@link AgentProvider} engine.\n *\n * @remarks\n * Every request uses NDJSON streaming. The base assembles complete turns, separates\n * reasoning, and bounds requests; this class supplies Ollama framing and projections.\n * Usage comes only from a `done: true` record carrying the token counts.\n *\n * @example\n * ```ts\n * const provider = new OllamaProvider({ model: 'qwen3.5:2b-q4_K_M' })\n * const result = await provider.generate(messages, abort.signal)\n * ```\n */\nexport class OllamaProvider extends AgentProvider implements AgentProviderInterface {\n\treadonly name = 'ollama'\n\treadonly #model: string\n\treadonly #keepAlive: string | number\n\treadonly #think: boolean\n\treadonly #options: Readonly<Record<string, unknown>> | undefined\n\n\tconstructor(options: OllamaOptions) {\n\t\tsuper({\n\t\t\turl: options.url ?? DEFAULT_OLLAMA_URL,\n\t\t\tpath: OLLAMA_CHAT_PATH,\n\t\t\t...(options.timeout === undefined ? {} : { timeout: options.timeout }),\n\t\t\t...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n\t\t\t...(options.headers === undefined ? {} : { headers: options.headers }),\n\t\t\t...(options.format === undefined ? {} : { format: options.format }),\n\t\t})\n\t\tthis.#model = options.model\n\t\tthis.#keepAlive = options.keepAlive ?? DEFAULT_KEEP_ALIVE\n\t\tthis.#think = options.think ?? false\n\t\tthis.#options = options.options\n\t}\n\n\t/**\n\t * Creates fresh NDJSON framing state for a call.\n\t *\n\t * @returns The parser that buffers incomplete Ollama records\n\t */\n\tframe(): ProviderParserInterface {\n\t\treturn createNDJSONParser()\n\t}\n\n\t/**\n\t * Projects conversation turns and per-call options onto the Ollama request body.\n\t *\n\t * @remarks\n\t * A tool's `title` and `annotations` are never sent: the `/api/chat` tool function\n\t * object carries no field for either.\n\t *\n\t * @param request - The conversation, advertised tools, and per-call overrides\n\t * @returns The `/api/chat` body with streaming enabled\n\t */\n\tbody(request: ProviderRequest): WireChatRequest {\n\t\treturn {\n\t\t\tmodel: this.#model,\n\t\t\tmessages: mapMessages(request.messages),\n\t\t\tstream: true,\n\t\t\tkeep_alive: this.#keepAlive,\n\t\t\tthink: request.options?.think ?? this.#think,\n\t\t\t...(this.#options !== undefined ? { options: this.#options } : {}),\n\t\t\t...(request.options?.schema !== undefined ? { format: request.options.schema } : {}),\n\t\t\t...(request.tools !== undefined && request.tools.length > 0\n\t\t\t\t? {\n\t\t\t\t\t\ttools: request.tools.map((tool): NonNullable<WireChatRequest['tools']>[number] => ({\n\t\t\t\t\t\t\ttype: 'function',\n\t\t\t\t\t\t\tfunction: {\n\t\t\t\t\t\t\t\tname: tool.name,\n\t\t\t\t\t\t\t\t...(tool.description === undefined ? {} : { description: tool.description }),\n\t\t\t\t\t\t\t\t...(tool.parameters === undefined ? {} : { parameters: tool.parameters }),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t}\n\t}\n\n\t/**\n\t * Extracts a record's content, reasoning, tools, and completed usage report.\n\t *\n\t * @param record - One parsed Ollama NDJSON record\n\t * @returns The turn increment, omitting usage until `done` and the counts are present\n\t */\n\tread(record: Readonly<Record<string, unknown>>): ProviderIncrement {\n\t\tconst usage = Reflect.get(record, 'done') === true ? extractUsage(record) : undefined\n\t\treturn {\n\t\t\tcontent: extractContent(record),\n\t\t\tthinking: extractThinking(record),\n\t\t\ttools: extractTools(record),\n\t\t\t...(usage === undefined ? {} : { usage }),\n\t\t}\n\t}\n\n\t/**\n\t * Recovers a final NDJSON record that arrived without its line terminator.\n\t *\n\t * @param parser - The call's parser holding any unterminated input\n\t * @returns The records completed by the final newline\n\t */\n\tfinish(parser: ProviderParserInterface): ReadonlyArray<Readonly<Record<string, unknown>>> {\n\t\treturn parser.parse('\\n')\n\t}\n}\n","import type { ProviderInterface } from '@orkestrel/agent'\nimport type { OllamaOptions } from './types.js'\nimport { OllamaProvider } from './OllamaProvider.js'\n\n/**\n * Creates a local Ollama inference provider — a {@link ProviderInterface} over the\n * daemon's `POST /api/chat`, assembling `generate` from the same NDJSON engine as `stream`.\n *\n * @remarks\n * Only `model` is required; `url` defaults to the local daemon, `keepAlive` to `'5m'`,\n * `timeout` to `120_000`ms, and `options` is forwarded verbatim as sampling\n * parameters (`temperature`, `seed`, and `num_predict`). Each call takes an\n * `AbortSignal` to bound the request; a `stream` cancelled mid-flight throws a\n * `ProviderAbortError` carrying the partial result.\n *\n * The optional `fetch` + `headers` form a transport seam (see {@link OllamaOptions}):\n * point `url` at your own server, inject a custom `fetch`, and have `headers` attach a\n * generated/obfuscated bearer token your server validates — so a browser runtime\n * reaches the LLM through your middleware without this library ever handling the real API\n * key. Both omitted ⇒ the global `fetch` and only a JSON content type.\n *\n * The optional `format` is the provider's context-framing default — the provider-default\n * level of `AgentContext`'s format cascade (beaten by a manager-options or per-item\n * override, beating the managers' built-in framing), declaring how this\n * provider's models prefer context sections framed (for example XML group wrappers vs. Markdown\n * headers). It is exposed on the provider for the Agent's `build()` and is not Ollama's\n * `/api/chat` `format` wire parameter (structured output) — the framing default and that\n * wire parameter are unrelated despite the shared word. Omitted ⇒ the provider is\n * framing-agnostic (core's built-in defaults).\n *\n * @param options - `model` (required), and optional `url` / `keepAlive` / `timeout` /\n * `options` / `fetch` / `headers` / `format` (see {@link OllamaOptions})\n * @returns A working {@link ProviderInterface} backed by Ollama\n *\n * @example createOllama + generate\n * ```ts\n * import { createAbort } from '@orkestrel/abort'\n * import type { TokenUsage } from '@orkestrel/budget'\n * import { createOllama } from '@orkestrel/ollama'\n *\n * declare function charge(usage: TokenUsage): void // your billing integration\n *\n * const provider = createOllama({ model: 'qwen3.5:2b-q4_K_M', options: { temperature: 0 } })\n * const abort = createAbort()\n * const messages = [\n * \t{ id: '1', role: 'user', content: 'Summarize the release notes for version 2.0.' },\n * ] as const\n *\n * const result = await provider.generate(messages, abort.signal)\n * console.log(result.content)\n * if (result.usage) charge(result.usage) // fold into a token budget\n * ```\n *\n * @example\n * Route through your own server with an obfuscated token:\n * ```ts\n * const provider = createOllama({\n * model: 'qwen3.5:2b-q4_K_M',\n * url: 'https://my-app.example.com/llm', // your server, not the daemon\n * fetch: myFetch, // optional custom transport\n * headers: () => ({ authorization: `Bearer ${myToken}` }), // your server validates this\n * })\n * ```\n *\n * @example\n * Declare a context-framing default — wrap the instructions section in an XML group (the\n * provider-default level of `AgentContext`'s cascade; not the wire `format`):\n * ```ts\n * const provider = createOllama({\n * model: 'qwen3.5:2b-q4_K_M',\n * format: {\n * instructions: {\n * open: '<instructions>',\n * render: (i) => `<instruction>${i.content}</instruction>`,\n * close: '</instructions>',\n * },\n * },\n * })\n * ```\n */\nexport function createOllama(options: OllamaOptions): ProviderInterface {\n\treturn new OllamaProvider(options)\n}\n"],"mappings":";;;;;;;;;AAMA,IAAa,qBAAqB;;;;;;;;;;AAWlC,IAAa,qBAAqB;;AAGlC,IAAa,mBAAmB;;;;;;;;;;;;;;;;;;;ACOhC,SAAgB,YAAY,UAA2D;CACtF,OAAO,SAAS,KAAK,aAAa;EACjC,MAAM,QAAQ;EACd,SAAS,QAAQ;EACjB,GAAI,QAAQ,UAAU,KAAA,KAAa,Q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,IAAI,EAAE,MAAM;EACxC;CACD;;;;;;;CAQA,OAAO,QAAmF;EACzF,OAAO,OAAO,MAAM,IAAI;CACzB;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1CA,SAAgB,aAAa,SAA2C;CACvE,OAAO,IAAI,eAAe,OAAO;AAClC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["isRecord","isString","isNumber","isArray","parseJSONAs","AgentProvider","createNDJSONParser"],"sources":["../../../src/core/constants.ts","../../../src/core/helpers.ts","../../../src/core/OllamaProvider.ts","../../../src/core/factories.ts"],"sourcesContent":["// Ollama constants — the provider's defaults.\n\n/**\n * Names the local Ollama daemon base URL, `'http://localhost:11434'`, assumed when\n * `OllamaOptions.url` is omitted.\n */\nexport const DEFAULT_OLLAMA_URL = 'http://localhost:11434'\n\n/**\n * Names how long the model stays resident after a call — `'5m'` when\n * `OllamaOptions.keepAlive` is omitted, Ollama's own `keep_alive` default, expressed as a\n * duration string.\n *\n * @remarks\n * The name mirrors the Ollama `/api/chat` `keep_alive` field this value is sent as, so\n * the constant, the `OllamaOptions.keepAlive` key, and the wire member read as one term.\n */\nexport const DEFAULT_KEEP_ALIVE = '5m'\n\n/** Names the Ollama chat endpoint appended to the configured base URL. */\nexport const OLLAMA_CHAT_PATH = '/api/chat'\n","// The Ollama wire leaves — the request projections and the response extractions\n// `OllamaProvider` composes. Each is a pure, total function of its parameters: a missing\n// or malformed wire field degrades to a sensible default (empty content, no usage, `{}`\n// arguments), never a throw, and no value is reached through `as`.\n\nimport type { Message } from '@orkestrel/agent'\nimport type { TokenUsage } from '@orkestrel/budget'\nimport type { ToolCall } from '@orkestrel/tool'\nimport type { WireChatRequest } from './types.js'\nimport { isArray, isNumber, isRecord, isString, parseJSONAs } from '@orkestrel/contract'\n\n/**\n * Maps conversation turns onto the `/api/chat` wire's minimal message shape.\n *\n * @remarks\n * `tool_calls` is emitted only on a turn that replays them and `images` only on a\n * multimodal turn, so an empty optional never reaches the wire.\n *\n * @param messages - The conversation turns to send\n * @returns The wire `messages` array, one entry per turn, in order\n *\n * @example\n * ```ts\n * mapMessages([{ id: '1', role: 'user', content: 'Say hello.' }])\n * // [{ role: 'user', content: 'Say hello.' }]\n * ```\n */\nexport function mapMessages(messages: readonly Message[]): WireChatRequest['messages'] {\n\treturn messages.map((message) => ({\n\t\trole: message.role,\n\t\tcontent: message.content,\n\t\t...(message.calls !== undefined && message.calls.length > 0\n\t\t\t? {\n\t\t\t\t\ttool_calls: message.calls.map((call) => ({\n\t\t\t\t\t\tfunction: { name: call.name, arguments: call.arguments },\n\t\t\t\t\t})),\n\t\t\t\t}\n\t\t\t: {}),\n\t\t// Forward multimodal image data — Ollama accepts a base64 `images` array on a\n\t\t// message, which a vision-capable model receives alongside the text content.\n\t\t...(message.images !== undefined && message.images.length > 0\n\t\t\t? { images: [...message.images] }\n\t\t\t: {}),\n\t}))\n}\n\n/**\n * Extracts the assistant text of one wire record.\n *\n * @param record - One parsed `/api/chat` NDJSON record\n * @returns The record's `message.content` when it is a string, else `''`\n *\n * @example\n * ```ts\n * extractContent({ message: { content: 'ok' } }) // 'ok'\n * ```\n */\nexport function extractContent(record: Readonly<Record<string, unknown>>): string {\n\tconst message = Reflect.get(record, 'message')\n\tif (!isRecord(message)) return ''\n\tconst content = Reflect.get(message, 'content')\n\treturn isString(content) ? content : ''\n}\n\n/**\n * Extracts the daemon-side reasoning of one wire record.\n *\n * @remarks\n * `message.thinking` is the `think: true` wire shape. It is read whatever the configured\n * flag says, because a daemon may separate reasoning on its own.\n *\n * @param record - One parsed `/api/chat` NDJSON record\n * @returns The record's `message.thinking` when it is a string, else `''`\n *\n * @example\n * ```ts\n * extractThinking({ message: { thinking: 'weighing it' } }) // 'weighing it'\n * ```\n */\nexport function extractThinking(record: Readonly<Record<string, unknown>>): string {\n\tconst message = Reflect.get(record, 'message')\n\tif (!isRecord(message)) return ''\n\tconst thinking = Reflect.get(message, 'thinking')\n\treturn isString(thinking) ? thinking : ''\n}\n\n/**\n * Extracts the token usage of one wire record.\n *\n * @remarks\n * Both counts must be numbers, which is true of the stream's `done: true` line. A\n * delta line carries neither, so it yields `undefined`.\n *\n * @param record - One parsed `/api/chat` NDJSON record\n * @returns The `TokenUsage` shape, or `undefined` when either count is absent\n *\n * @example\n * ```ts\n * extractUsage({ prompt_eval_count: 3, eval_count: 4 })\n * // { prompt: 3, completion: 4, total: 7 }\n * ```\n */\nexport function extractUsage(record: Readonly<Record<string, unknown>>): TokenUsage | undefined {\n\tconst prompt = Reflect.get(record, 'prompt_eval_count')\n\tconst completion = Reflect.get(record, 'eval_count')\n\tif (!isNumber(prompt) || !isNumber(completion)) return undefined\n\treturn { prompt, completion, total: prompt + completion }\n}\n\n/**\n * Extracts the tool calls of one wire record's `message.tool_calls`.\n *\n * @remarks\n * Each entry narrows to `{ id, name, arguments }`: the entry and its `function` must be\n * records and `name` a string, else the entry is dropped. An id is minted when the wire\n * omits one.\n *\n * @param record - One parsed `/api/chat` NDJSON record\n * @returns The narrowed tool calls, empty when the record carries none\n *\n * @example\n * ```ts\n * extractTools({ message: { tool_calls: [{ function: { name: 'weather' } }] } })\n * // [{ id: '…', name: 'weather', arguments: {} }]\n * ```\n */\nexport function extractTools(record: Readonly<Record<string, unknown>>): readonly ToolCall[] {\n\tconst message = Reflect.get(record, 'message')\n\tif (!isRecord(message)) return []\n\tconst calls = Reflect.get(message, 'tool_calls')\n\tif (!isArray(calls)) return []\n\tconst out: ToolCall[] = []\n\tfor (const entry of calls) {\n\t\tif (!isRecord(entry)) continue\n\t\tconst callable = Reflect.get(entry, 'function')\n\t\tif (!isRecord(callable)) continue\n\t\tconst name = Reflect.get(callable, 'name')\n\t\tif (!isString(name)) continue\n\t\tconst id = Reflect.get(entry, 'id')\n\t\tout.push({\n\t\t\tid: isString(id) ? id : crypto.randomUUID(),\n\t\t\tname,\n\t\t\targuments: extractArguments(Reflect.get(callable, 'arguments')),\n\t\t})\n\t}\n\treturn out\n}\n\n/**\n * Extracts a wire `arguments` value as a record.\n *\n * @remarks\n * Total: an object passes through, a JSON string is parsed when it yields a record, and\n * a malformed string yields `{}` rather than throwing.\n *\n * @param value - The wire's `function.arguments` value, of unknown shape\n * @returns The argument record, or `{}` when the value carries none\n *\n * @example\n * ```ts\n * extractArguments('{\"city\":\"Oslo\"}') // { city: 'Oslo' }\n * ```\n */\nexport function extractArguments(value: unknown): Readonly<Record<string, unknown>> {\n\tif (isRecord(value)) return value\n\tif (isString(value)) return parseJSONAs(value, isRecord) ?? {}\n\treturn {}\n}\n","import type {\n\tAgentProviderInterface,\n\tProviderIncrement,\n\tProviderParserInterface,\n\tProviderRequest,\n} from '@orkestrel/agent'\nimport type { OllamaOptions, WireChatRequest } from './types.js'\nimport { AgentProvider } from '@orkestrel/agent'\nimport { createNDJSONParser } from '@orkestrel/ndjson'\nimport { DEFAULT_KEEP_ALIVE, DEFAULT_OLLAMA_URL, OLLAMA_CHAT_PATH } from './constants.js'\nimport {\n\textractContent,\n\textractThinking,\n\textractTools,\n\textractUsage,\n\tmapMessages,\n} from './helpers.js'\n\n/**\n * Implements the Ollama `/api/chat` wire over the shared {@link AgentProvider} engine.\n *\n * @remarks\n * Every request uses NDJSON streaming. The base assembles complete turns, separates\n * reasoning, and bounds requests; this class supplies Ollama framing and projections.\n * Usage comes only from a `done: true` record carrying the token counts.\n *\n * @example\n * ```ts\n * const provider = new OllamaProvider({ model: 'qwen3.5:2b-q4_K_M' })\n * const result = await provider.generate(messages, abort.signal)\n * ```\n */\nexport class OllamaProvider extends AgentProvider implements AgentProviderInterface {\n\treadonly name = 'ollama'\n\treadonly #model: string\n\treadonly #keepAlive: string | number\n\treadonly #think: boolean\n\treadonly #options: Readonly<Record<string, unknown>> | undefined\n\n\tconstructor(options: OllamaOptions) {\n\t\tsuper({\n\t\t\turl: options.url ?? DEFAULT_OLLAMA_URL,\n\t\t\tpath: OLLAMA_CHAT_PATH,\n\t\t\t...(options.timeout === undefined ? {} : { timeout: options.timeout }),\n\t\t\t...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n\t\t\t...(options.headers === undefined ? {} : { headers: options.headers }),\n\t\t\t...(options.format === undefined ? {} : { format: options.format }),\n\t\t})\n\t\tthis.#model = options.model\n\t\tthis.#keepAlive = options.keepAlive ?? DEFAULT_KEEP_ALIVE\n\t\tthis.#think = options.think ?? false\n\t\tthis.#options = options.options\n\t}\n\n\t/**\n\t * Creates fresh NDJSON framing state for a call.\n\t *\n\t * @returns The parser that buffers incomplete Ollama records\n\t */\n\tframe(): ProviderParserInterface {\n\t\treturn createNDJSONParser()\n\t}\n\n\t/**\n\t * Projects conversation turns and per-call options onto the Ollama request body.\n\t *\n\t * @remarks\n\t * A tool's `title` and `annotations` are never sent: the `/api/chat` tool function\n\t * object carries no field for either.\n\t *\n\t * @param request - The conversation, advertised tools, and per-call overrides\n\t * @returns The `/api/chat` body with streaming enabled\n\t */\n\tbody(request: ProviderRequest): WireChatRequest {\n\t\treturn {\n\t\t\tmodel: this.#model,\n\t\t\tmessages: mapMessages(request.messages),\n\t\t\tstream: true,\n\t\t\tkeep_alive: this.#keepAlive,\n\t\t\tthink: request.options?.think ?? this.#think,\n\t\t\t...(this.#options !== undefined ? { options: this.#options } : {}),\n\t\t\t...(request.options?.schema !== undefined ? { format: request.options.schema } : {}),\n\t\t\t...(request.tools !== undefined && request.tools.length > 0\n\t\t\t\t? {\n\t\t\t\t\t\ttools: request.tools.map((tool): NonNullable<WireChatRequest['tools']>[number] => ({\n\t\t\t\t\t\t\ttype: 'function',\n\t\t\t\t\t\t\tfunction: {\n\t\t\t\t\t\t\t\tname: tool.name,\n\t\t\t\t\t\t\t\t...(tool.description === undefined ? {} : { description: tool.description }),\n\t\t\t\t\t\t\t\t...(tool.parameters === undefined ? {} : { parameters: tool.parameters }),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t}\n\t}\n\n\t/**\n\t * Extracts a record's content, reasoning, tools, and completed usage report.\n\t *\n\t * @param record - One parsed Ollama NDJSON record\n\t * @returns The turn increment, omitting usage until `done` and the counts are present\n\t */\n\tread(record: Readonly<Record<string, unknown>>): ProviderIncrement {\n\t\tconst usage = Reflect.get(record, 'done') === true ? extractUsage(record) : undefined\n\t\treturn {\n\t\t\tcontent: extractContent(record),\n\t\t\tthinking: extractThinking(record),\n\t\t\ttools: extractTools(record),\n\t\t\t...(usage === undefined ? {} : { usage }),\n\t\t}\n\t}\n\n\t/**\n\t * Recovers a final NDJSON record that arrived without its line terminator.\n\t *\n\t * @param parser - The call's parser holding any unterminated input\n\t * @returns The records completed by the final newline\n\t */\n\tfinish(parser: ProviderParserInterface): ReadonlyArray<Readonly<Record<string, unknown>>> {\n\t\treturn parser.parse('\\n')\n\t}\n}\n","import type { ProviderInterface } from '@orkestrel/agent'\nimport type { OllamaOptions } from './types.js'\nimport { OllamaProvider } from './OllamaProvider.js'\n\n/**\n * Creates a local Ollama inference provider — a {@link ProviderInterface} over the\n * daemon's `POST /api/chat`, assembling `generate` from the same NDJSON engine as `stream`.\n *\n * @remarks\n * Only `model` is required; `url` defaults to the local daemon, `keepAlive` to `'5m'`,\n * `timeout` to `120_000`ms, and `options` is forwarded verbatim as sampling\n * parameters (`temperature`, `seed`, and `num_predict`). Each call takes an\n * `AbortSignal` to bound the request; a `stream` cancelled mid-flight throws a\n * `ProviderAbortError` carrying the partial result.\n *\n * The optional `fetch` + `headers` form a transport seam (see {@link OllamaOptions}):\n * point `url` at your own server, inject a custom `fetch`, and have `headers` attach a\n * generated/obfuscated bearer token your server validates — so a browser runtime\n * reaches the LLM through your middleware without this library ever handling the real API\n * key. Both omitted ⇒ the global `fetch` and only a JSON content type.\n *\n * The optional `format` is the provider's context-framing default — the provider-default\n * level of `AgentContext`'s format cascade (beaten by a manager-options or per-item\n * override, beating the managers' built-in framing), declaring how this\n * provider's models prefer context sections framed (for example XML group wrappers vs. Markdown\n * headers). It is exposed on the provider for the Agent's `build()` and is not Ollama's\n * `/api/chat` `format` wire parameter (structured output) — the framing default and that\n * wire parameter are unrelated despite the shared word. Omitted ⇒ the provider is\n * framing-agnostic (core's built-in defaults).\n *\n * @param options - `model` (required), and optional `url` / `keepAlive` / `timeout` /\n * `options` / `fetch` / `headers` / `format` (see {@link OllamaOptions})\n * @returns A working {@link ProviderInterface} backed by Ollama\n *\n * @example createOllama + generate\n * ```ts\n * import { createAbort } from '@orkestrel/abort'\n * import type { TokenUsage } from '@orkestrel/budget'\n * import { createOllama } from '@orkestrel/ollama'\n *\n * declare function charge(usage: TokenUsage): void // your billing integration\n *\n * const provider = createOllama({ model: 'qwen3.5:2b-q4_K_M', options: { temperature: 0 } })\n * const abort = createAbort()\n * const messages = [\n * \t{ id: '1', role: 'user', content: 'Summarize the release notes for version 2.0.' },\n * ] as const\n *\n * const result = await provider.generate(messages, abort.signal)\n * console.log(result.content)\n * if (result.usage) charge(result.usage) // fold into a token budget\n * ```\n *\n * @example\n * Route through your own server with an obfuscated token:\n * ```ts\n * const provider = createOllama({\n * model: 'qwen3.5:2b-q4_K_M',\n * url: 'https://my-app.example.com/llm', // your server, not the daemon\n * fetch: myFetch, // optional custom transport\n * headers: () => ({ authorization: `Bearer ${myToken}` }), // your server validates this\n * })\n * ```\n *\n * @example\n * Declare a context-framing default — wrap the instructions section in an XML group (the\n * provider-default level of `AgentContext`'s cascade; not the wire `format`):\n * ```ts\n * const provider = createOllama({\n * model: 'qwen3.5:2b-q4_K_M',\n * format: {\n * instructions: {\n * open: '<instructions>',\n * render: (i) => `<instruction>${i.content}</instruction>`,\n * close: '</instructions>',\n * },\n * },\n * })\n * ```\n */\nexport function createOllama(options: OllamaOptions): ProviderInterface {\n\treturn new OllamaProvider(options)\n}\n"],"mappings":";;;;;;;;;AAMA,IAAa,qBAAqB;;;;;;;;;;AAWlC,IAAa,qBAAqB;;AAGlC,IAAa,mBAAmB;;;;;;;;;;;;;;;;;;;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AQ,IAAI,QAAQ,MAAM,MAAM,OAAO,aAAa,MAAM,IAAI,KAAA;EAC5E,OAAO;GACN,SAAS,eAAe,MAAM;GAC9B,UAAU,gBAAgB,MAAM;GAChC,OAAO,aAAa,MAAM;GAC1B,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;EACxC;CACD;;;;;;;CAQA,OAAO,QAAmF;EACzF,OAAO,OAAO,MAAM,IAAI;CACzB;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1CA,SAAgB,aAAa,SAA2C;CACvE,OAAO,IAAI,eAAe,OAAO;AAClC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orkestrel/ollama",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "A typed local-LLM provider for the @orkestrel line — a ProviderInterface over a local Ollama daemon's /api/chat with NDJSON streaming and guard-narrowed wire boundaries. Part of the @orkestrel line.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -72,30 +72,30 @@
|
|
|
72
72
|
"prepack": "npm run build"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@orkestrel/agent": "^0.0.
|
|
76
|
-
"@orkestrel/budget": "^0.0.
|
|
77
|
-
"@orkestrel/contract": "^0.0.
|
|
78
|
-
"@orkestrel/ndjson": "^0.0.
|
|
79
|
-
"@orkestrel/tool": "^0.0.
|
|
75
|
+
"@orkestrel/agent": "^0.0.25",
|
|
76
|
+
"@orkestrel/budget": "^0.0.12",
|
|
77
|
+
"@orkestrel/contract": "^0.0.19",
|
|
78
|
+
"@orkestrel/ndjson": "^0.0.11",
|
|
79
|
+
"@orkestrel/tool": "^0.0.18"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@microsoft/api-extractor": "^7.59.
|
|
83
|
-
"@orkestrel/abort": "^0.0.
|
|
84
|
-
"@orkestrel/browser": "^0.0.
|
|
85
|
-
"@orkestrel/guide": "^0.0.
|
|
86
|
-
"@orkestrel/probe": "^0.0.
|
|
87
|
-
"@orkestrel/router": "^0.0.
|
|
88
|
-
"@orkestrel/scaffold": "^0.0.
|
|
89
|
-
"@orkestrel/server": "^0.0.
|
|
90
|
-
"@orkestrel/test": "^0.0.
|
|
91
|
-
"@orkestrel/timeout": "^0.0.
|
|
92
|
-
"@orkestrel/workspace": "^0.0.
|
|
93
|
-
"@types/node": "^26.6.
|
|
82
|
+
"@microsoft/api-extractor": "^7.59.3",
|
|
83
|
+
"@orkestrel/abort": "^0.0.12",
|
|
84
|
+
"@orkestrel/browser": "^0.0.20",
|
|
85
|
+
"@orkestrel/guide": "^0.0.22",
|
|
86
|
+
"@orkestrel/probe": "^0.0.19",
|
|
87
|
+
"@orkestrel/router": "^0.0.16",
|
|
88
|
+
"@orkestrel/scaffold": "^0.0.82",
|
|
89
|
+
"@orkestrel/server": "^0.0.22",
|
|
90
|
+
"@orkestrel/test": "^0.0.24",
|
|
91
|
+
"@orkestrel/timeout": "^0.0.12",
|
|
92
|
+
"@orkestrel/workspace": "^0.0.10",
|
|
93
|
+
"@types/node": "^26.6.3",
|
|
94
94
|
"ollama": "0.6.3",
|
|
95
|
-
"oxfmt": "^0.
|
|
96
|
-
"oxlint": "^1.
|
|
95
|
+
"oxfmt": "^0.71.0",
|
|
96
|
+
"oxlint": "^1.86.0",
|
|
97
97
|
"typescript": "^6.0.3",
|
|
98
|
-
"vite": "^8.3.
|
|
98
|
+
"vite": "^8.3.2",
|
|
99
99
|
"vitest": "^4.1.11"
|
|
100
100
|
},
|
|
101
101
|
"engines": {
|