Skip to content

refactor!: remove duplicated agent surface (callModel, tools, ModelResult) - #806

Draft
christineschen wants to merge 2 commits into
mainfrom
devin/1786568636-remove-agent-surface
Draft

refactor!: remove duplicated agent surface (callModel, tools, ModelResult)#806
christineschen wants to merge 2 commits into
mainfrom
devin/1786568636-remove-agent-surface

Conversation

@christineschen

Copy link
Copy Markdown
Contributor

Summary

Deletes the agent implementation that now lives in @openrouter/agent, per the migration already announced in the README. 20 hand-written source files, their unit tests, and the examples that only demo them are gone, along with OpenRouter.callModel and the ToolType re-export from the generated client class.

This is a breaking public API change and needs a major release. Not a semver-patch cleanup, even though the code is internally dead: callModel is a published method, and package.json's wildcard exports (./*, ./*.js) made every deleted module externally addressable.

- client.callModel({ model, messages, tools })   // @openrouter/sdk
+ callModel(client, { model, messages, tools })  // @openrouter/agent

- import { tool } from '@openrouter/sdk/lib/tool'
+ import { tool } from '@openrouter/agent/tool'

Removed subpaths a consumer could have been importing: lib/tool, lib/tool-types, lib/tool-executor, lib/tool-orchestrator, lib/tool-context, lib/tool-event-broadcaster, lib/model-result, lib/conversation-state, lib/turn-context, lib/next-turn-params, lib/async-params, lib/stop-conditions, lib/reusable-stream, lib/stream-transformers, lib/stream-type-guards, lib/chat-compat, lib/anthropic-compat, lib/claude-constants, lib/claude-type-guards, funcs/call-model.

Every one of these has a counterpart in @openrouter/agent except three that were SDK internals and are not dedicated agent exports: tool-executor, tool-orchestrator, stream-type-guards. src/models/claude-message.ts is generated and untouched.

The callModel method and its imports lived in the two persistent-edit regions of src/sdk/sdk.ts, so the deletion is expressed by emptying those regions rather than by an overlay. Worth a second pair of eyes from whoever owns the generation pipeline: if regeneration re-derives the class body from a source other than these regions, the method could come back.

Verification

pnpm lint, pnpm typecheck, pnpm build, and npx vitest run --project unit pass, and no reference to a deleted module remains under src/. E2E tests were not run (they need a live OPENROUTER_API_KEY).

Related

  • openrouter-web#33661 moves the last internal runtime importer to @openrouter/agent/tool. It should land before this SDK version ships.

Link to Devin session: https://openrouter.devinenterprise.com/sessions/cc64b378b1f04154aae4b8cf03d67d0b
Requested by: @christineschen

@christineschen christineschen self-assigned this Aug 12, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor
Original prompt from christine.chen

SYSTEM:
=== BEGIN THREAD HISTORY ===
<most_recent_message>
Christine Chen (U0B8QM7RKLL) [ts=1786568155.436339]: Create a PR to remove these files but also ensure they are in the sdk as stated

[Slack unfurl — this is an automatic link preview, not a user message]
Quote of conversation (https://openrouter.slack.com/archives/C0BCDN7RHJM/p1786558308342879?thread_ts=1786558308.342879&amp;cid=C0BCDN7RHJM):
> From sam
> any thoughts on this patch? l think src/lib/ is where we put our non-generated stuff right?
> <https://openrouter.slack.com/archives/C0A3LMAP2D6/p1786497807373249?thread_ts=1786370592.446849&amp;amp;cid=C0A3LMAP2D6|https://openrouter.slack.com/archives/C0A3LMAP2D6/p1786497807373249?thread_ts=1786370592.446849&amp;amp;cid=C0A3LMAP2D6>
> <https://openrouter.slack.com/archives/C0A3LMAP2D6/p1786497807373249?thread_ts=1786370592.446849&amp;amp;cid=C0A3LMAP2D6>
> Posted on August 12, 2026 at 06:11 PM

</most_recent_message>
=== END THREAD HISTORY ===
Channel ID: D0B9SPV4LV9
Thread URL: https://openrouter.slack.com/archives/D0B9SPV4LV9/p1786568155436339?thread_ts=1786568155.436339&amp;cid=D0B9SPV4LV9

The latest message is the one right above that tagged you. The <most_recent_message> is the message that you should use to guide your goals + task for this session, and you should use the rest of the slack thread as context.
A [ts=...] marker on a Slack message is that message's timestamp. To act on a specific message with the slack tool (e.g. adding an emoji reaction via the reaction command), pass that value as timestamp along with the Channel ID — no extra lookup call is needed.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant