feat: Add new dependencies and export computerTool in the SDK#2
feat: Add new dependencies and export computerTool in the SDK#2ellispinsky wants to merge 2 commits intomainfrom
Conversation
- Updated package.json to include new dependencies: @ai-sdk/anthropic and @ai-sdk/provider-utils. - Added "computer" to the list of tools exported from index.ts, along with its type definitions.
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "postman.settings.dotenv-detection-notification-visibility": false | |||
| } No newline at end of file | |||
There was a problem hiding this comment.
Bug: VSCode settings file committed despite being in gitignore
The .vscode/settings.json file is being committed to the repository in the same PR that adds .vscode/ to the .gitignore. This appears to be accidentally committed IDE configuration that contains personal Postman settings and contradicts the intent of adding the directory to .gitignore.
Additional Locations (1)
|
|
||
| return messages.map((message) => { | ||
| // check if last message part is a tool invocation in a call state, then append a part with the tool result | ||
| message.parts = message.parts.map((part) => { |
There was a problem hiding this comment.
Bug: prunedMessages mutates input message objects directly
The prunedMessages function directly mutates the original message objects by assigning to message.parts. While .map() creates a new array, the line message.parts = message.parts.map(...) modifies the original message object's parts property in place. This can cause unexpected side effects since the function is exported and the caller's data is modified. The function needs to return new message objects by spreading the original (e.g., { ...message, parts: ... }) instead of mutating.
| }, | ||
| ], | ||
| }, | ||
| ]); |
There was a problem hiding this comment.
Bug: Stale closure in stop function causes incorrect state updates
The stop function captures lastMessage and lastMessageLastPart from the messages closure before calling setMessages, then uses these stale values inside the setMessages callback. The callback receives prev (the latest state) but mixes it with the potentially stale lastMessage object. If messages are updated between when stop is called and when React processes the state update, this could result in incorrect message state where the wrong message object is modified or messages are duplicated. The values need to be derived from prev inside the callback instead.
Note
Adds a new Anthropic-powered
computerToolintegrated with Onkernel, exports it from the SDK, and introduces a Next.js example app demonstrating computer use.src/computer.ts: Anthropiccomputer_20250124tool wired to Onkernel browser API (click, type, scroll, drag, screenshot, wait) with result translation.computerToolandComputerToolOptionsfromsrc/index.ts.examples/computer-use-nextjswith API routes, UI components, Tailwind v4 config, and assets to demo computer use.pnpm-workspace.yamlto include root andexamples/*.Written by Cursor Bugbot for commit 72eb460. This will update automatically on new commits. Configure here.