|
1 | 1 | # @openrouter/agent |
2 | 2 |
|
| 3 | +## 1.0.0 |
| 4 | + |
| 5 | +### Major Changes |
| 6 | + |
| 7 | +- [#110](https://github.com/OpenRouterTeam/typescript-agent/pull/110) [`9766f31`](https://github.com/OpenRouterTeam/typescript-agent/commit/9766f31ec2390cd294ca47dd81d0122941c0d586) Thanks [@LukasParke](https://github.com/LukasParke)! - Stop accumulating generator-tool `preliminaryResults` arrays. Yields are still broadcast live; the terminal `tool.result` event and `ToolExecutionResult` no longer carry the full yield history. |
| 8 | + |
| 9 | +### Minor Changes |
| 10 | + |
| 11 | +- [#118](https://github.com/OpenRouterTeam/typescript-agent/pull/118) [`4dce84e`](https://github.com/OpenRouterTeam/typescript-agent/commit/4dce84e4393ec36745875512d6ad1fcd8b38e502) Thanks [@sambarnes](https://github.com/sambarnes)! - Allow manual tools to provide a caller-owned JSON Schema for wire serialization. |
| 12 | + |
| 13 | + ```ts |
| 14 | + import { tool } from "@openrouter/agent"; |
| 15 | + import { z } from "zod"; |
| 16 | + |
| 17 | + const confirmTool = tool({ |
| 18 | + name: "confirm_action", |
| 19 | + inputSchema: z.object({ action: z.string() }), |
| 20 | + wireInputSchema: { |
| 21 | + type: "object", |
| 22 | + properties: { |
| 23 | + action: { type: "string" }, |
| 24 | + }, |
| 25 | + required: ["action"], |
| 26 | + }, |
| 27 | + execute: false, |
| 28 | + }); |
| 29 | + ``` |
| 30 | + |
| 31 | +- [#93](https://github.com/OpenRouterTeam/typescript-agent/pull/93) [`dacf4d1`](https://github.com/OpenRouterTeam/typescript-agent/commit/dacf4d166a8ece1c2aff77727e2db1da5417391b) Thanks [@LukasParke](https://github.com/LukasParke)! - Fix `fromChatMessages` dropping assistant tool calls and give both message converters precise array return types that work with `callModel`, `Item[]`, and the SDK's `InputsUnion`. |
| 32 | + |
| 33 | + Assistant `toolCalls` now become `function_call` items, preserving their already-serialized `arguments`. A message containing both text and tool calls emits both items; an empty assistant message is omitted only when tool calls replace it. |
| 34 | + |
| 35 | + ```ts |
| 36 | + import { |
| 37 | + callModel, |
| 38 | + fromChatMessages, |
| 39 | + type ChatMessages, |
| 40 | + type Item, |
| 41 | + } from "@openrouter/agent"; |
| 42 | + |
| 43 | + const messages: ChatMessages[] = [ |
| 44 | + { |
| 45 | + role: "assistant", |
| 46 | + content: null, |
| 47 | + toolCalls: [ |
| 48 | + { |
| 49 | + id: "call_1", |
| 50 | + type: "function", |
| 51 | + function: { name: "get_weather", arguments: '{"city":"Austin"}' }, |
| 52 | + }, |
| 53 | + ], |
| 54 | + }, |
| 55 | + ]; |
| 56 | + |
| 57 | + const input: Item[] = fromChatMessages(messages); |
| 58 | + const result = callModel(client, { model: "openai/gpt-4o-mini", input }); |
| 59 | + ``` |
| 60 | + |
| 61 | +### Patch Changes |
| 62 | + |
| 63 | +- [#120](https://github.com/OpenRouterTeam/typescript-agent/pull/120) [`ddab365`](https://github.com/OpenRouterTeam/typescript-agent/commit/ddab3652a47edf5ebaa842447864a3dc91b812e5) Thanks [@LukasParke](https://github.com/LukasParke)! - Identify Agent SDK requests with an Agent SDK user-agent suffix that includes the package version. |
| 64 | + |
| 65 | + ```ts |
| 66 | + import { OpenRouter } from "@openrouter/agent"; |
| 67 | + |
| 68 | + const client = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY }); |
| 69 | + // Requests use the Agent SDK user agent by default. |
| 70 | + // Pass userAgent to override the default identification. |
| 71 | + ``` |
| 72 | + |
3 | 73 | ## 0.11.0 |
4 | 74 |
|
5 | 75 | ### Minor Changes |
|
0 commit comments