Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/twenty-hands-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@plotday/sdk": minor
---

Changed: BREAKING: Rename Agent.call() and Tool.call() to callCallback() to avoid confusion with JavaScript's Object.call().
3 changes: 2 additions & 1 deletion agents/events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"private": true,
"scripts": {
"deploy": "plot agent deploy",
"lint": "plot agent lint"
"lint": "plot agent lint",
"logs": "plot agent logs"
},
"dependencies": {
"@plotday/sdk": "workspace:^",
Expand Down
8 changes: 4 additions & 4 deletions sdk/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export abstract class Agent<TSelf = any> {
* @param args - Optional arguments to pass to the callback
* @returns Promise resolving to the callback result
*/
protected async call(token: Callback, args?: any): Promise<any> {
return this._callbackTool.call(token, args);
protected async callCallback(token: Callback, args?: any): Promise<any> {
return this._callbackTool.callCallback(token, args);
}

/**
Expand Down Expand Up @@ -304,8 +304,8 @@ export abstract class Tool<TSelf = any> implements ITool {
* @param args - Optional arguments to pass to the callback
* @returns Promise resolving to the callback result
*/
protected async call(token: Callback, args?: any): Promise<any> {
return this._callbackTool.call(token, args);
protected async callCallback(token: Callback, args?: any): Promise<any> {
return this._callbackTool.callCallback(token, args);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/tools/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ActivityLink, type Callback, ITool, type Tools } from "..";
import { type ActivityLink, type Callback, ITool } from "..";

/**
* Built-in tool for managing OAuth authentication flows.
Expand Down Expand Up @@ -55,7 +55,7 @@ export abstract class Auth extends ITool {
level: AuthLevel;
scopes: string[];
},
_callback: Callback,
_callback: Callback
): Promise<ActivityLink>;

/**
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/tools/callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export type CallbackContext<T, K extends keyof T> = T[K] extends (
*
* **Note:** Callback methods are also available directly on Agent and Tool classes
* via `this.callback()`, `this.deleteCallback()`, `this.deleteAllCallbacks()`, and
* `this.call()`. This is the recommended approach for most use cases.
* `this.callCallback()`. This is the recommended approach for most use cases.
*
* **When to use callbacks:**
* - Webhook handlers that need persistent function references
Expand Down Expand Up @@ -120,5 +120,5 @@ export abstract class CallbackTool<TParent = any> extends ITool {
* @param args - Optional arguments to pass to the callback function
* @returns Promise resolving to the callback result
*/
abstract call(_callback: Callback, _args?: any): Promise<any>;
abstract callCallback(_callback: Callback, _args?: any): Promise<any>;
}