diff --git a/.changeset/approval-decision-validation.md b/.changeset/approval-decision-validation.md deleted file mode 100644 index 03ef48a4..00000000 --- a/.changeset/approval-decision-validation.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -'@openrouter/agent': patch ---- - -Harden approval resumes. - -`approveToolCalls` / `rejectToolCalls` are now de-duplicated, so a call ID listed twice no longer executes an approval-gated tool twice (or skips the re-approval a `PreToolUse` argument mutation requires), and passing the same ID in both lists throws before anything runs. - -Resuming an `awaiting_approval` conversation without any decision now leaves it paused instead of sending a new model request. Any `input` passed with that call is not sent to the model and not saved to state, including a `function_call_output` for the gated call: only an approve/reject decision releases an approval gate. - -An `awaiting_hitl` conversation still resumes the documented way, by passing a `function_call_output` for a paused call in `input` (which runs `onResponseReceived`). Without one, and without decisions, it now stays paused too. A paused status with no pending tool calls continues with a normal request, as before. - -While a resume leaves the conversation paused, `getResponse()`, `getText()`, `getToolCalls()` and the stream getters reject with an explicit error that names the pause, lists up to 10 pending call IDs, and says when supplied `input` was dropped (previously the generic "Response not available" / "Stream not initialized"). `requiresApproval()`, `getPendingToolCalls()` and `getState()` keep working. - -```ts -const result = callModel(client, { model, input: [], tools, state }); -// state is awaiting_approval and no decisions were passed: -await result.requiresApproval(); // true, and no request was sent -await result.getResponse(); // throws: Conversation is awaiting approval ... Pending tool call IDs: call_1 -``` diff --git a/.changeset/openrouter-sdk-1-5.md b/.changeset/openrouter-sdk-1-5.md deleted file mode 100644 index 20e67f21..00000000 --- a/.changeset/openrouter-sdk-1-5.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@openrouter/agent': minor ---- - -Upgrade `@openrouter/sdk` from `^0.13.7` to `^1.5.85`. - -The SDK renamed the code-interpreter image output type to `CodeInterpreterImageOutput`. It is re-exported under that name, and the existing `OutputImage` and `OutputInputImage` exports remain as aliases of it. - -`BaseInputsUnion` no longer includes `any` in the SDK, so it now describes only the `instructions` field it is used for. Functions that took or returned a single input item typed as `BaseInputsUnion` (`appendToMessages`, `normalizeInputToArray`, `buildTaskResultMessage`) are typed with the SDK's `InputsUnion1` instead. diff --git a/packages/agent/CHANGELOG.md b/packages/agent/CHANGELOG.md index 687d3e89..4e1273a4 100644 --- a/packages/agent/CHANGELOG.md +++ b/packages/agent/CHANGELOG.md @@ -1,5 +1,34 @@ # @openrouter/agent +## 1.2.0 + +### Minor Changes + +- [#158](https://github.com/OpenRouterTeam/typescript-agent/pull/158) [`c93423b`](https://github.com/OpenRouterTeam/typescript-agent/commit/c93423bd4abfe09c21ffb3514d2d3aabab97c731) Thanks [@mattapperson](https://github.com/mattapperson)! - Upgrade `@openrouter/sdk` from `^0.13.7` to `^1.5.85`. + + The SDK renamed the code-interpreter image output type to `CodeInterpreterImageOutput`. It is re-exported under that name, and the existing `OutputImage` and `OutputInputImage` exports remain as aliases of it. + + `BaseInputsUnion` no longer includes `any` in the SDK, so it now describes only the `instructions` field it is used for. Functions that took or returned a single input item typed as `BaseInputsUnion` (`appendToMessages`, `normalizeInputToArray`, `buildTaskResultMessage`) are typed with the SDK's `InputsUnion1` instead. + +### Patch Changes + +- [#131](https://github.com/OpenRouterTeam/typescript-agent/pull/131) [`1601bff`](https://github.com/OpenRouterTeam/typescript-agent/commit/1601bff00f9091ef55daa3718b3ae2c3b3d386d8) Thanks [@LukasParke](https://github.com/LukasParke)! - Harden approval resumes. + + `approveToolCalls` / `rejectToolCalls` are now de-duplicated, so a call ID listed twice no longer executes an approval-gated tool twice (or skips the re-approval a `PreToolUse` argument mutation requires), and passing the same ID in both lists throws before anything runs. + + Resuming an `awaiting_approval` conversation without any decision now leaves it paused instead of sending a new model request. Any `input` passed with that call is not sent to the model and not saved to state, including a `function_call_output` for the gated call: only an approve/reject decision releases an approval gate. + + An `awaiting_hitl` conversation still resumes the documented way, by passing a `function_call_output` for a paused call in `input` (which runs `onResponseReceived`). Without one, and without decisions, it now stays paused too. A paused status with no pending tool calls continues with a normal request, as before. + + While a resume leaves the conversation paused, `getResponse()`, `getText()`, `getToolCalls()` and the stream getters reject with an explicit error that names the pause, lists up to 10 pending call IDs, and says when supplied `input` was dropped (previously the generic "Response not available" / "Stream not initialized"). `requiresApproval()`, `getPendingToolCalls()` and `getState()` keep working. + + ```ts + const result = callModel(client, { model, input: [], tools, state }); + // state is awaiting_approval and no decisions were passed: + await result.requiresApproval(); // true, and no request was sent + await result.getResponse(); // throws: Conversation is awaiting approval ... Pending tool call IDs: call_1 + ``` + ## 1.1.0 ### Minor Changes diff --git a/packages/agent/package.json b/packages/agent/package.json index 5ebaf092..025a2946 100644 --- a/packages/agent/package.json +++ b/packages/agent/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/agent", - "version": "1.1.0", + "version": "1.2.0", "author": "OpenRouter", "description": "Agent toolkit for building AI applications with OpenRouter — tool orchestration, streaming, multi-turn conversations, and format compatibility.", "keywords": [ diff --git a/packages/agent/src/mcp/version.ts b/packages/agent/src/mcp/version.ts index 89fd6b26..cbb7794d 100644 --- a/packages/agent/src/mcp/version.ts +++ b/packages/agent/src/mcp/version.ts @@ -2,4 +2,4 @@ // Run `pnpm --filter @openrouter/agent gen:version` after bumping the version. /** This package's version, self-reported to MCP servers as `clientInfo`. */ -export const PACKAGE_VERSION = '1.1.0'; +export const PACKAGE_VERSION = '1.2.0'; diff --git a/packages/mcp/CHANGELOG.md b/packages/mcp/CHANGELOG.md index 011b7339..b9422966 100644 --- a/packages/mcp/CHANGELOG.md +++ b/packages/mcp/CHANGELOG.md @@ -1,5 +1,12 @@ # @openrouter/mcp +## 1.1.5 + +### Patch Changes + +- Updated dependencies [[`1601bff`](https://github.com/OpenRouterTeam/typescript-agent/commit/1601bff00f9091ef55daa3718b3ae2c3b3d386d8), [`c93423b`](https://github.com/OpenRouterTeam/typescript-agent/commit/c93423bd4abfe09c21ffb3514d2d3aabab97c731)]: + - @openrouter/agent@1.2.0 + ## 1.1.4 ### Patch Changes diff --git a/packages/mcp/package.json b/packages/mcp/package.json index 8c7ba6c8..088ee7f5 100644 --- a/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/mcp", - "version": "1.1.4", + "version": "1.1.5", "engines": { "node": ">=20" },