Skip to content

Commit ea798d0

Browse files
authored
Merge pull request #47 from plotday/fix/rename-call
Rename call() to callCallback()
2 parents 5d3a6d5 + 9ed2cf4 commit ea798d0

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

.changeset/twenty-hands-melt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@plotday/sdk": minor
3+
---
4+
5+
Changed: BREAKING: Rename Agent.call() and Tool.call() to callCallback() to avoid confusion with JavaScript's Object.call().

agents/events/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"private": true,
1111
"scripts": {
1212
"deploy": "plot agent deploy",
13-
"lint": "plot agent lint"
13+
"lint": "plot agent lint",
14+
"logs": "plot agent logs"
1415
},
1516
"dependencies": {
1617
"@plotday/sdk": "workspace:^",

sdk/src/agent.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ export abstract class Agent<TSelf = any> {
9898
* @param args - Optional arguments to pass to the callback
9999
* @returns Promise resolving to the callback result
100100
*/
101-
protected async call(token: Callback, args?: any): Promise<any> {
102-
return this._callbackTool.call(token, args);
101+
protected async callCallback(token: Callback, args?: any): Promise<any> {
102+
return this._callbackTool.callCallback(token, args);
103103
}
104104

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

311311
/**

sdk/src/tools/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type ActivityLink, type Callback, ITool, type Tools } from "..";
1+
import { type ActivityLink, type Callback, ITool } from "..";
22

33
/**
44
* Built-in tool for managing OAuth authentication flows.
@@ -55,7 +55,7 @@ export abstract class Auth extends ITool {
5555
level: AuthLevel;
5656
scopes: string[];
5757
},
58-
_callback: Callback,
58+
_callback: Callback
5959
): Promise<ActivityLink>;
6060

6161
/**

sdk/src/tools/callback.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export type CallbackContext<T, K extends keyof T> = T[K] extends (
5050
*
5151
* **Note:** Callback methods are also available directly on Agent and Tool classes
5252
* via `this.callback()`, `this.deleteCallback()`, `this.deleteAllCallbacks()`, and
53-
* `this.call()`. This is the recommended approach for most use cases.
53+
* `this.callCallback()`. This is the recommended approach for most use cases.
5454
*
5555
* **When to use callbacks:**
5656
* - Webhook handlers that need persistent function references
@@ -120,5 +120,5 @@ export abstract class CallbackTool<TParent = any> extends ITool {
120120
* @param args - Optional arguments to pass to the callback function
121121
* @returns Promise resolving to the callback result
122122
*/
123-
abstract call(_callback: Callback, _args?: any): Promise<any>;
123+
abstract callCallback(_callback: Callback, _args?: any): Promise<any>;
124124
}

0 commit comments

Comments
 (0)