From 9ed2cf4e019b5f7f0e04d35c383675ca4b6cd137 Mon Sep 17 00:00:00 2001 From: Kris Braun Date: Tue, 21 Oct 2025 21:46:58 -0400 Subject: [PATCH] Rename call() to callCallback() --- .changeset/twenty-hands-melt.md | 5 +++++ agents/events/package.json | 3 ++- sdk/src/agent.ts | 8 ++++---- sdk/src/tools/auth.ts | 4 ++-- sdk/src/tools/callback.ts | 4 ++-- 5 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 .changeset/twenty-hands-melt.md diff --git a/.changeset/twenty-hands-melt.md b/.changeset/twenty-hands-melt.md new file mode 100644 index 0000000..f53831d --- /dev/null +++ b/.changeset/twenty-hands-melt.md @@ -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(). diff --git a/agents/events/package.json b/agents/events/package.json index 3a51214..b9828d4 100644 --- a/agents/events/package.json +++ b/agents/events/package.json @@ -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:^", diff --git a/sdk/src/agent.ts b/sdk/src/agent.ts index 989078a..430f657 100644 --- a/sdk/src/agent.ts +++ b/sdk/src/agent.ts @@ -98,8 +98,8 @@ export abstract class Agent { * @param args - Optional arguments to pass to the callback * @returns Promise resolving to the callback result */ - protected async call(token: Callback, args?: any): Promise { - return this._callbackTool.call(token, args); + protected async callCallback(token: Callback, args?: any): Promise { + return this._callbackTool.callCallback(token, args); } /** @@ -304,8 +304,8 @@ export abstract class Tool 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 { - return this._callbackTool.call(token, args); + protected async callCallback(token: Callback, args?: any): Promise { + return this._callbackTool.callCallback(token, args); } /** diff --git a/sdk/src/tools/auth.ts b/sdk/src/tools/auth.ts index a4771fe..9ebbdc3 100644 --- a/sdk/src/tools/auth.ts +++ b/sdk/src/tools/auth.ts @@ -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. @@ -55,7 +55,7 @@ export abstract class Auth extends ITool { level: AuthLevel; scopes: string[]; }, - _callback: Callback, + _callback: Callback ): Promise; /** diff --git a/sdk/src/tools/callback.ts b/sdk/src/tools/callback.ts index 1b15795..defee25 100644 --- a/sdk/src/tools/callback.ts +++ b/sdk/src/tools/callback.ts @@ -50,7 +50,7 @@ export type CallbackContext = 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 @@ -120,5 +120,5 @@ export abstract class CallbackTool 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; + abstract callCallback(_callback: Callback, _args?: any): Promise; }