@plotday/twister 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/bin/templates/AGENTS.template.md +91 -29
- package/cli/templates/AGENTS.template.md +91 -29
- package/dist/common/calendar.d.ts +35 -28
- package/dist/common/calendar.d.ts.map +1 -1
- package/dist/common/messaging.d.ts +24 -10
- package/dist/common/messaging.d.ts.map +1 -1
- package/dist/common/projects.d.ts +30 -15
- package/dist/common/projects.d.ts.map +1 -1
- package/dist/common/serializable.d.ts +40 -0
- package/dist/common/serializable.d.ts.map +1 -0
- package/dist/common/serializable.js +2 -0
- package/dist/common/serializable.js.map +1 -0
- package/dist/docs/assets/hierarchy.js +1 -1
- package/dist/docs/assets/navigation.js +1 -1
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/classes/tool.ITool.html +1 -1
- package/dist/docs/classes/tool.Tool.html +32 -28
- package/dist/docs/classes/tools_ai.AI.html +2 -2
- package/dist/docs/classes/tools_callbacks.Callbacks.html +6 -6
- package/dist/docs/classes/tools_integrations.Integrations.html +3 -3
- package/dist/docs/classes/tools_network.Network.html +12 -12
- package/dist/docs/classes/tools_plot.Plot.html +41 -31
- package/dist/docs/classes/tools_store.Store.html +31 -11
- package/dist/docs/classes/tools_tasks.Tasks.html +8 -8
- package/dist/docs/classes/tools_twists.Twists.html +5 -5
- package/dist/docs/classes/twist.Twist.html +28 -24
- package/dist/docs/documents/Building_Custom_Tools.html +8 -2
- package/dist/docs/documents/Built-in_Tools.html +19 -8
- package/dist/docs/documents/Core_Concepts.html +14 -6
- package/dist/docs/documents/Getting_Started.html +11 -4
- package/dist/docs/enums/plot.ActivityLinkType.html +5 -5
- package/dist/docs/enums/plot.ActivityType.html +4 -4
- package/dist/docs/enums/plot.ActorType.html +4 -4
- package/dist/docs/enums/plot.ConferencingProvider.html +6 -6
- package/dist/docs/enums/tag.Tag.html +2 -2
- package/dist/docs/enums/tools_ai.AIModel.html +2 -2
- package/dist/docs/enums/tools_integrations.AuthLevel.html +3 -3
- package/dist/docs/enums/tools_integrations.AuthProvider.html +11 -11
- package/dist/docs/enums/tools_plot.ActivityAccess.html +3 -3
- package/dist/docs/enums/tools_plot.ContactAccess.html +4 -4
- package/dist/docs/enums/tools_plot.PriorityAccess.html +3 -3
- package/dist/docs/functions/index.Uuid.Generate.html +1 -1
- package/dist/docs/functions/utils_hash.quickHash.html +1 -1
- package/dist/docs/hierarchy.html +1 -1
- package/dist/docs/index.html +10 -0
- package/dist/docs/interfaces/common_calendar.Calendar.html +5 -5
- package/dist/docs/interfaces/common_calendar.CalendarTool.html +29 -15
- package/dist/docs/interfaces/common_calendar.SyncOptions.html +3 -3
- package/dist/docs/interfaces/index.SerializableArray.html +2 -0
- package/dist/docs/interfaces/index.SerializableMap.html +2 -0
- package/dist/docs/interfaces/index.SerializableObject.html +2 -0
- package/dist/docs/interfaces/index.SerializableSet.html +2 -0
- package/dist/docs/interfaces/tools_ai.AIRequest.html +11 -11
- package/dist/docs/interfaces/tools_ai.AIResponse.html +9 -9
- package/dist/docs/interfaces/tools_ai.FilePart.html +5 -5
- package/dist/docs/interfaces/tools_ai.ImagePart.html +4 -4
- package/dist/docs/interfaces/tools_ai.ReasoningPart.html +4 -4
- package/dist/docs/interfaces/tools_ai.RedactedReasoningPart.html +3 -3
- package/dist/docs/interfaces/tools_ai.TextPart.html +3 -3
- package/dist/docs/interfaces/tools_ai.ToolCallPart.html +5 -5
- package/dist/docs/interfaces/tools_ai.ToolExecutionOptions.html +4 -4
- package/dist/docs/interfaces/tools_ai.ToolResultPart.html +5 -5
- package/dist/docs/interfaces/tools_twists.TwistSource.html +3 -3
- package/dist/docs/interfaces/utils_types.ToolShed.html +5 -5
- package/dist/docs/media/SYNC_STRATEGIES.md +651 -0
- package/dist/docs/modules/index.html +1 -1
- package/dist/docs/modules/plot.html +1 -1
- package/dist/docs/modules/utils_types.html +1 -1
- package/dist/docs/types/common_calendar.CalendarAuth.html +2 -2
- package/dist/docs/types/index.Serializable.html +17 -0
- package/dist/docs/types/index.Uuid.html +1 -1
- package/dist/docs/types/plot.Activity.html +17 -8
- package/dist/docs/types/plot.ActivityCommon.html +10 -10
- package/dist/docs/types/plot.ActivityLink.html +1 -1
- package/dist/docs/types/plot.ActivityMeta.html +5 -3
- package/dist/docs/types/plot.ActivityUpdate.html +4 -2
- package/dist/docs/types/plot.ActivityWithNotes.html +1 -1
- package/dist/docs/types/plot.Actor.html +15 -5
- package/dist/docs/types/plot.ActorId.html +1 -1
- package/dist/docs/types/plot.ContentType.html +1 -1
- package/dist/docs/types/plot.NewActivity.html +26 -12
- package/dist/docs/types/plot.NewActivityWithNotes.html +1 -1
- package/dist/docs/types/plot.NewActor.html +1 -1
- package/dist/docs/types/plot.NewContact.html +4 -4
- package/dist/docs/types/plot.NewNote.html +9 -4
- package/dist/docs/types/plot.NewPriority.html +15 -5
- package/dist/docs/types/plot.NewTags.html +1 -1
- package/dist/docs/types/plot.Note.html +6 -3
- package/dist/docs/types/plot.NoteUpdate.html +4 -3
- package/dist/docs/types/plot.PickPriorityConfig.html +3 -3
- package/dist/docs/types/plot.Priority.html +9 -4
- package/dist/docs/types/plot.PriorityUpdate.html +3 -0
- package/dist/docs/types/plot.SyncUpdate.html +1 -1
- package/dist/docs/types/plot.Tags.html +1 -1
- package/dist/docs/types/tools_ai.AIAssistantMessage.html +2 -2
- package/dist/docs/types/tools_ai.AIMessage.html +1 -1
- package/dist/docs/types/tools_ai.AISource.html +1 -1
- package/dist/docs/types/tools_ai.AISystemMessage.html +2 -2
- package/dist/docs/types/tools_ai.AITool.html +1 -1
- package/dist/docs/types/tools_ai.AIToolMessage.html +2 -2
- package/dist/docs/types/tools_ai.AIToolSet.html +1 -1
- package/dist/docs/types/tools_ai.AIUsage.html +5 -5
- package/dist/docs/types/tools_ai.AIUserMessage.html +2 -2
- package/dist/docs/types/tools_ai.DataContent.html +1 -1
- package/dist/docs/types/tools_ai.ModelPreferences.html +4 -4
- package/dist/docs/types/tools_callbacks.Callback.html +1 -1
- package/dist/docs/types/tools_integrations.AuthToken.html +4 -4
- package/dist/docs/types/tools_integrations.Authorization.html +4 -4
- package/dist/docs/types/tools_network.WebhookRequest.html +6 -6
- package/dist/docs/types/tools_plot.NoteIntentHandler.html +4 -4
- package/dist/docs/types/tools_twists.Log.html +2 -2
- package/dist/docs/types/tools_twists.TwistPermissions.html +1 -1
- package/dist/docs/types/utils_types.BuiltInTools.html +2 -2
- package/dist/docs/types/utils_types.CallbackMethods.html +1 -1
- package/dist/docs/types/utils_types.ExtractBuildReturn.html +1 -1
- package/dist/docs/types/utils_types.InferOptions.html +1 -1
- package/dist/docs/types/utils_types.InferTools.html +1 -1
- package/dist/docs/types/utils_types.JSONValue.html +7 -0
- package/dist/docs/types/utils_types.NoFunctions.html +1 -1
- package/dist/docs/types/utils_types.NonFunction.html +1 -1
- package/dist/docs/types/utils_types.PromiseValues.html +1 -1
- package/dist/docs/types/utils_types.ToolBuilder.html +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/llm-docs/common/calendar.d.ts +1 -1
- package/dist/llm-docs/common/calendar.d.ts.map +1 -1
- package/dist/llm-docs/common/calendar.js +1 -1
- package/dist/llm-docs/common/calendar.js.map +1 -1
- package/dist/llm-docs/common/messaging.d.ts +1 -1
- package/dist/llm-docs/common/messaging.d.ts.map +1 -1
- package/dist/llm-docs/common/messaging.js +1 -1
- package/dist/llm-docs/common/messaging.js.map +1 -1
- package/dist/llm-docs/common/projects.d.ts +1 -1
- package/dist/llm-docs/common/projects.d.ts.map +1 -1
- package/dist/llm-docs/common/projects.js +1 -1
- package/dist/llm-docs/common/projects.js.map +1 -1
- package/dist/llm-docs/plot.d.ts +1 -1
- package/dist/llm-docs/plot.d.ts.map +1 -1
- package/dist/llm-docs/plot.js +1 -1
- package/dist/llm-docs/plot.js.map +1 -1
- package/dist/llm-docs/tool.d.ts +1 -1
- package/dist/llm-docs/tool.d.ts.map +1 -1
- package/dist/llm-docs/tool.js +1 -1
- package/dist/llm-docs/tool.js.map +1 -1
- package/dist/llm-docs/tools/network.d.ts +1 -1
- package/dist/llm-docs/tools/network.d.ts.map +1 -1
- package/dist/llm-docs/tools/network.js +1 -1
- package/dist/llm-docs/tools/network.js.map +1 -1
- package/dist/llm-docs/tools/plot.d.ts +1 -1
- package/dist/llm-docs/tools/plot.d.ts.map +1 -1
- package/dist/llm-docs/tools/plot.js +1 -1
- package/dist/llm-docs/tools/plot.js.map +1 -1
- package/dist/llm-docs/tools/store.d.ts +1 -1
- package/dist/llm-docs/tools/store.d.ts.map +1 -1
- package/dist/llm-docs/tools/store.js +1 -1
- package/dist/llm-docs/tools/store.js.map +1 -1
- package/dist/llm-docs/tools/tasks.d.ts +1 -1
- package/dist/llm-docs/tools/tasks.d.ts.map +1 -1
- package/dist/llm-docs/tools/tasks.js +1 -1
- package/dist/llm-docs/tools/tasks.js.map +1 -1
- package/dist/llm-docs/twist-guide-template.d.ts +1 -1
- package/dist/llm-docs/twist-guide-template.d.ts.map +1 -1
- package/dist/llm-docs/twist-guide-template.js +1 -1
- package/dist/llm-docs/twist-guide-template.js.map +1 -1
- package/dist/llm-docs/twist.d.ts +1 -1
- package/dist/llm-docs/twist.d.ts.map +1 -1
- package/dist/llm-docs/twist.js +1 -1
- package/dist/llm-docs/twist.js.map +1 -1
- package/dist/plot.d.ts +232 -56
- package/dist/plot.d.ts.map +1 -1
- package/dist/plot.js.map +1 -1
- package/dist/tool.d.ts +30 -8
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +29 -7
- package/dist/tool.js.map +1 -1
- package/dist/tools/network.d.ts +19 -16
- package/dist/tools/network.d.ts.map +1 -1
- package/dist/tools/network.js +6 -4
- package/dist/tools/network.js.map +1 -1
- package/dist/tools/plot.d.ts +93 -24
- package/dist/tools/plot.d.ts.map +1 -1
- package/dist/tools/plot.js +46 -1
- package/dist/tools/plot.js.map +1 -1
- package/dist/tools/store.d.ts +49 -8
- package/dist/tools/store.d.ts.map +1 -1
- package/dist/tools/store.js +12 -1
- package/dist/tools/store.js.map +1 -1
- package/dist/tools/tasks.d.ts +4 -4
- package/dist/tools/tasks.js +4 -4
- package/dist/twist-guide.d.ts +1 -1
- package/dist/twist-guide.d.ts.map +1 -1
- package/dist/twist.d.ts +24 -10
- package/dist/twist.d.ts.map +1 -1
- package/dist/twist.js +19 -5
- package/dist/twist.js.map +1 -1
- package/dist/utils/types.d.ts +19 -0
- package/dist/utils/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/tool.js
CHANGED
|
@@ -110,13 +110,16 @@ export class Tool {
|
|
|
110
110
|
* @param args - Optional arguments to pass to the callback
|
|
111
111
|
* @returns Promise resolving to the callback result
|
|
112
112
|
*/
|
|
113
|
-
async run(token, args) {
|
|
114
|
-
return this.tools.callbacks.run(token, args);
|
|
113
|
+
async run(token, ...args) {
|
|
114
|
+
return this.tools.callbacks.run(token, ...args);
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
117
|
* Retrieves a value from persistent storage by key.
|
|
118
118
|
*
|
|
119
|
-
*
|
|
119
|
+
* Values are automatically deserialized using SuperJSON, which
|
|
120
|
+
* properly restores Date objects, Maps, Sets, and other complex types.
|
|
121
|
+
*
|
|
122
|
+
* @template T - The expected type of the stored value (must be Serializable)
|
|
120
123
|
* @param key - The storage key to retrieve
|
|
121
124
|
* @returns Promise resolving to the stored value or null
|
|
122
125
|
*/
|
|
@@ -126,13 +129,32 @@ export class Tool {
|
|
|
126
129
|
/**
|
|
127
130
|
* Stores a value in persistent storage.
|
|
128
131
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
132
|
+
* The value will be serialized using SuperJSON and stored persistently.
|
|
133
|
+
* SuperJSON automatically handles Date objects, Maps, Sets, undefined values,
|
|
134
|
+
* and other complex types that standard JSON doesn't support.
|
|
131
135
|
*
|
|
136
|
+
* **Important**: Functions and Symbols cannot be stored.
|
|
132
137
|
* **For function references**: Use callbacks instead of storing functions directly.
|
|
133
138
|
*
|
|
134
139
|
* @example
|
|
135
140
|
* ```typescript
|
|
141
|
+
* // ✅ Date objects are preserved
|
|
142
|
+
* await this.set("sync_state", {
|
|
143
|
+
* lastSync: new Date(),
|
|
144
|
+
* minDate: new Date(2024, 0, 1)
|
|
145
|
+
* });
|
|
146
|
+
*
|
|
147
|
+
* // ✅ undefined is now supported
|
|
148
|
+
* await this.set("data", { name: "test", optional: undefined });
|
|
149
|
+
*
|
|
150
|
+
* // ✅ Arrays with undefined are supported
|
|
151
|
+
* await this.set("items", [1, undefined, 3]);
|
|
152
|
+
* await this.set("items", [1, null, 3]); // Also works
|
|
153
|
+
*
|
|
154
|
+
* // ✅ Maps and Sets are supported
|
|
155
|
+
* await this.set("mapping", new Map([["key", "value"]]));
|
|
156
|
+
* await this.set("tags", new Set(["tag1", "tag2"]));
|
|
157
|
+
*
|
|
136
158
|
* // ❌ WRONG: Cannot store functions directly
|
|
137
159
|
* await this.set("handler", this.myHandler);
|
|
138
160
|
*
|
|
@@ -145,9 +167,9 @@ export class Tool {
|
|
|
145
167
|
* await this.run(token, args);
|
|
146
168
|
* ```
|
|
147
169
|
*
|
|
148
|
-
* @template T - The type of value being stored
|
|
170
|
+
* @template T - The type of value being stored (must be Serializable)
|
|
149
171
|
* @param key - The storage key to use
|
|
150
|
-
* @param value - The value to store (must be
|
|
172
|
+
* @param value - The value to store (must be SuperJSON-serializable)
|
|
151
173
|
* @returns Promise that resolves when the value is stored
|
|
152
174
|
*/
|
|
153
175
|
async set(key, value) {
|
package/dist/tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,OAAgB,KAAK;CAAG;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAgB,IAAI;IAE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IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;CACF"}
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ITool } from "..";
|
|
2
2
|
import { type AuthProvider, type Authorization } from "./integrations";
|
|
3
|
+
import { type NoFunctions, type JSONValue } from "../utils/types";
|
|
3
4
|
/**
|
|
4
5
|
* Represents an incoming webhook request.
|
|
5
6
|
*
|
|
@@ -25,7 +26,7 @@ export type WebhookRequest = {
|
|
|
25
26
|
/** Query string parameters from the request URL */
|
|
26
27
|
params: Record<string, string>;
|
|
27
28
|
/** Request body (parsed as JSON if applicable) */
|
|
28
|
-
body:
|
|
29
|
+
body: JSONValue;
|
|
29
30
|
/** Raw request body (for signature verification) */
|
|
30
31
|
rawBody?: string;
|
|
31
32
|
};
|
|
@@ -82,10 +83,12 @@ export type WebhookRequest = {
|
|
|
82
83
|
*
|
|
83
84
|
* async setupCalendarWebhook(calendarId: string) {
|
|
84
85
|
* // Create webhook URL that will call onCalendarEvent
|
|
85
|
-
* const webhookUrl = await this.tools.network.createWebhook(
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
86
|
+
* const webhookUrl = await this.tools.network.createWebhook(
|
|
87
|
+
* {},
|
|
88
|
+
* this.onCalendarEvent,
|
|
89
|
+
* calendarId,
|
|
90
|
+
* "google"
|
|
91
|
+
* );
|
|
89
92
|
*
|
|
90
93
|
* // Register webhook with Google Calendar API
|
|
91
94
|
* await this.registerWithGoogleCalendar(calendarId, webhookUrl);
|
|
@@ -133,21 +136,23 @@ export declare abstract class Network extends ITool {
|
|
|
133
136
|
* - **Default**: Returns a standard webhook URL for all other cases.
|
|
134
137
|
*
|
|
135
138
|
* @param options - Webhook creation options
|
|
136
|
-
* @param options.callback - Function receiving (request, ...extraArgs)
|
|
137
|
-
* @param options.extraArgs - Additional arguments to pass to the callback (type-checked)
|
|
138
139
|
* @param options.provider - Optional provider for provider-specific webhook routing
|
|
139
140
|
* @param options.authorization - Optional authorization for provider-specific webhooks (required for Slack and Gmail)
|
|
141
|
+
* @param callback - Function receiving (request, ...extraArgs)
|
|
142
|
+
* @param extraArgs - Additional arguments to pass to the callback (type-checked, no functions allowed)
|
|
140
143
|
* @returns Promise resolving to the webhook URL, or for Gmail, a Pub/Sub topic name
|
|
141
144
|
*
|
|
142
145
|
* @example
|
|
143
146
|
* ```typescript
|
|
144
147
|
* // Gmail webhook - returns Pub/Sub topic name
|
|
145
|
-
* const topicName = await this.tools.network.createWebhook(
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
148
|
+
* const topicName = await this.tools.network.createWebhook(
|
|
149
|
+
* {
|
|
150
|
+
* provider: AuthProvider.Google,
|
|
151
|
+
* authorization: gmailAuth
|
|
152
|
+
* },
|
|
153
|
+
* this.onGmailNotification,
|
|
154
|
+
* "inbox"
|
|
155
|
+
* );
|
|
151
156
|
* // topicName: "projects/plot-prod/topics/gmail-webhook-abc123"
|
|
152
157
|
*
|
|
153
158
|
* // Pass topic name to Gmail API
|
|
@@ -161,11 +166,9 @@ export declare abstract class Network extends ITool {
|
|
|
161
166
|
* ```
|
|
162
167
|
*/
|
|
163
168
|
abstract createWebhook<TCallback extends (request: WebhookRequest, ...args: any[]) => any>(options: {
|
|
164
|
-
callback: TCallback;
|
|
165
|
-
extraArgs?: TCallback extends (req: any, ...rest: infer R) => any ? R : [];
|
|
166
169
|
provider?: AuthProvider;
|
|
167
170
|
authorization?: Authorization;
|
|
168
|
-
}): Promise<string>;
|
|
171
|
+
}, callback: TCallback, ...extraArgs: TCallback extends (req: any, ...rest: infer R) => any ? NoFunctions<R> : []): Promise<string>;
|
|
169
172
|
/**
|
|
170
173
|
* Deletes an existing webhook endpoint.
|
|
171
174
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/tools/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/tools/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAElE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,kDAAkD;IAClD,IAAI,EAAE,SAAS,CAAC;IAChB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,8BAAsB,OAAQ,SAAQ,KAAK;IACzC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;QACvB;;;WAGG;QACH,IAAI,EAAE,MAAM,EAAE,CAAC;KAChB,CAAC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,QAAQ,CAAC,aAAa,CACpB,SAAS,SAAS,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAElE,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,YAAY,CAAC;QACxB,aAAa,CAAC,EAAE,aAAa,CAAC;KAC/B,EACD,QAAQ,EAAE,SAAS,EACnB,GAAG,SAAS,EAAE,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,GAAG,GAC/D,WAAW,CAAC,CAAC,CAAC,GACd,EAAE,GACL,OAAO,CAAC,MAAM,CAAC;IAElB;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CACnD"}
|
package/dist/tools/network.js
CHANGED
|
@@ -52,10 +52,12 @@ import { ITool } from "..";
|
|
|
52
52
|
*
|
|
53
53
|
* async setupCalendarWebhook(calendarId: string) {
|
|
54
54
|
* // Create webhook URL that will call onCalendarEvent
|
|
55
|
-
* const webhookUrl = await this.tools.network.createWebhook(
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
55
|
+
* const webhookUrl = await this.tools.network.createWebhook(
|
|
56
|
+
* {},
|
|
57
|
+
* this.onCalendarEvent,
|
|
58
|
+
* calendarId,
|
|
59
|
+
* "google"
|
|
60
|
+
* );
|
|
59
61
|
*
|
|
60
62
|
* // Register webhook with Google Calendar API
|
|
61
63
|
* await this.registerWithGoogleCalendar(calendarId, webhookUrl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/tools/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/tools/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAkC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,MAAM,OAAgB,OAAQ,SAAQ,KAAK;IACzC,MAAM,CAAU,OAAO,CAMrB;CA8EH"}
|
package/dist/tools/plot.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Activity, type
|
|
1
|
+
import { type Activity, type ActivityUpdate, type Actor, type ActorId, ITool, type NewActivity, type NewActivityWithNotes, type NewContact, type NewNote, type NewPriority, type Note, type NoteUpdate, type Priority, type PriorityUpdate, type Tag, Uuid } from "..";
|
|
2
2
|
export declare enum ActivityAccess {
|
|
3
3
|
/**
|
|
4
4
|
* Create new Note on an Activity where the twist was mentioned.
|
|
@@ -26,7 +26,7 @@ export declare enum PriorityAccess {
|
|
|
26
26
|
Full = 1
|
|
27
27
|
}
|
|
28
28
|
export declare enum ContactAccess {
|
|
29
|
-
/** Read existing
|
|
29
|
+
/** Read existing contact details. Without this, only the ID will be provided. */
|
|
30
30
|
Read = 0,
|
|
31
31
|
/** Create and update contacts. */
|
|
32
32
|
Write = 1
|
|
@@ -76,10 +76,56 @@ export type NoteIntentHandler = {
|
|
|
76
76
|
* ```
|
|
77
77
|
*/
|
|
78
78
|
export declare abstract class Plot extends ITool {
|
|
79
|
+
/**
|
|
80
|
+
* Configuration options for the Plot tool.
|
|
81
|
+
*
|
|
82
|
+
* **Important**: All permissions must be explicitly requested. There are no default permissions.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* // Minimal configuration with required permissions
|
|
87
|
+
* build(build: ToolBuilder) {
|
|
88
|
+
* return {
|
|
89
|
+
* plot: build(Plot, {
|
|
90
|
+
* activity: {
|
|
91
|
+
* access: ActivityAccess.Create
|
|
92
|
+
* }
|
|
93
|
+
* })
|
|
94
|
+
* };
|
|
95
|
+
* }
|
|
96
|
+
*
|
|
97
|
+
* // Full configuration with callbacks
|
|
98
|
+
* build(build: ToolBuilder) {
|
|
99
|
+
* return {
|
|
100
|
+
* plot: build(Plot, {
|
|
101
|
+
* activity: {
|
|
102
|
+
* access: ActivityAccess.Create,
|
|
103
|
+
* updated: this.onActivityUpdated
|
|
104
|
+
* },
|
|
105
|
+
* note: {
|
|
106
|
+
* intents: [{
|
|
107
|
+
* description: "Schedule meetings",
|
|
108
|
+
* examples: ["Schedule a meeting tomorrow"],
|
|
109
|
+
* handler: this.onSchedulingIntent
|
|
110
|
+
* }],
|
|
111
|
+
* created: this.onNoteCreated
|
|
112
|
+
* },
|
|
113
|
+
* priority: {
|
|
114
|
+
* access: PriorityAccess.Full
|
|
115
|
+
* },
|
|
116
|
+
* contact: {
|
|
117
|
+
* access: ContactAccess.Write
|
|
118
|
+
* }
|
|
119
|
+
* })
|
|
120
|
+
* };
|
|
121
|
+
* }
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
79
124
|
static readonly Options: {
|
|
80
125
|
activity?: {
|
|
81
126
|
/**
|
|
82
127
|
* Capability to create Notes and modify tags.
|
|
128
|
+
* Must be explicitly set to grant permissions.
|
|
83
129
|
*/
|
|
84
130
|
access?: ActivityAccess;
|
|
85
131
|
/**
|
|
@@ -182,7 +228,7 @@ export declare abstract class Plot extends ITool {
|
|
|
182
228
|
* // Mark a task as complete
|
|
183
229
|
* await this.plot.updateActivity({
|
|
184
230
|
* id: "task-123",
|
|
185
|
-
*
|
|
231
|
+
* done: new Date()
|
|
186
232
|
* });
|
|
187
233
|
*
|
|
188
234
|
* // Reschedule an event
|
|
@@ -308,35 +354,35 @@ export declare abstract class Plot extends ITool {
|
|
|
308
354
|
*/
|
|
309
355
|
abstract updateNote(note: NoteUpdate): Promise<void>;
|
|
310
356
|
/**
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* This method enables lookup of activities that were created from external
|
|
314
|
-
* systems, using the metadata to locate the corresponding Plot activity.
|
|
357
|
+
* Retrieves an activity by ID or source.
|
|
315
358
|
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
359
|
+
* This method enables lookup of activities either by their unique ID or by their
|
|
360
|
+
* source identifier (canonical URL from an external system). Archived activities
|
|
361
|
+
* are included in the results.
|
|
318
362
|
*
|
|
319
|
-
* @param
|
|
320
|
-
* @param includeArchived - Whether to include archived activities in search (default: false)
|
|
363
|
+
* @param activity - Activity lookup by ID or source
|
|
321
364
|
* @returns Promise resolving to the matching activity or null if not found
|
|
322
365
|
*/
|
|
323
|
-
abstract
|
|
366
|
+
abstract getActivity(activity: {
|
|
367
|
+
id: Uuid;
|
|
368
|
+
} | {
|
|
369
|
+
source: string;
|
|
370
|
+
}): Promise<Activity | null>;
|
|
324
371
|
/**
|
|
325
|
-
*
|
|
372
|
+
* Retrieves a note by ID or key.
|
|
326
373
|
*
|
|
327
|
-
* This method enables lookup of
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
* within the activity's meta field.
|
|
374
|
+
* This method enables lookup of notes either by their unique ID or by their
|
|
375
|
+
* key (unique identifier within the activity). Archived notes are included
|
|
376
|
+
* in the results.
|
|
331
377
|
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
* @param meta - The metadata to search for (uses JSON containment matching)
|
|
336
|
-
* @param includeArchived - Whether to include archived activities in search (default: false)
|
|
337
|
-
* @returns Promise resolving to the matching activity or null if not found
|
|
378
|
+
* @param note - Note lookup by ID or key
|
|
379
|
+
* @returns Promise resolving to the matching note or null if not found
|
|
338
380
|
*/
|
|
339
|
-
abstract
|
|
381
|
+
abstract getNote(note: {
|
|
382
|
+
id: Uuid;
|
|
383
|
+
} | {
|
|
384
|
+
key: string;
|
|
385
|
+
}): Promise<Note | null>;
|
|
340
386
|
/**
|
|
341
387
|
* Creates a new priority in the Plot system.
|
|
342
388
|
*
|
|
@@ -347,6 +393,29 @@ export declare abstract class Plot extends ITool {
|
|
|
347
393
|
* @returns Promise resolving to the complete created priority
|
|
348
394
|
*/
|
|
349
395
|
abstract createPriority(priority: NewPriority): Promise<Priority>;
|
|
396
|
+
/**
|
|
397
|
+
* Retrieves a priority by ID or key.
|
|
398
|
+
*
|
|
399
|
+
* Archived priorities are included in the results.
|
|
400
|
+
*
|
|
401
|
+
* @param priority - Priority lookup by ID or key
|
|
402
|
+
* @returns Promise resolving to the matching priority or null if not found
|
|
403
|
+
*/
|
|
404
|
+
abstract getPriority(priority: {
|
|
405
|
+
id: Uuid;
|
|
406
|
+
} | {
|
|
407
|
+
key: string;
|
|
408
|
+
}): Promise<Priority | null>;
|
|
409
|
+
/**
|
|
410
|
+
* Updates an existing priority in the Plot system.
|
|
411
|
+
*
|
|
412
|
+
* The priority is identified by either its ID or key.
|
|
413
|
+
* Only the fields specified in the update will be changed.
|
|
414
|
+
*
|
|
415
|
+
* @param update - Priority update containing ID/key and fields to change
|
|
416
|
+
* @returns Promise that resolves when the update is complete
|
|
417
|
+
*/
|
|
418
|
+
abstract updatePriority(update: PriorityUpdate): Promise<void>;
|
|
350
419
|
/**
|
|
351
420
|
* Adds contacts to the Plot system.
|
|
352
421
|
*
|
package/dist/tools/plot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,EACL,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,GAAG,EACR,IAAI,EACL,MAAM,IAAI,CAAC;AAEZ,oBAAY,cAAc;IACxB;;;OAGG;IACH,OAAO,IAAA;I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,CAAA;KAAE,GAC1C,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAE3B;;;;;;;;;OASG;IAEH,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAE5E;;;;;;;;OAQG;IAEH,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAEjE;;;;;;;OAOG;IAEH,QAAQ,CAAC,WAAW,CAClB,QAAQ,EAAE;QAAE,EAAE,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GACvC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAE3B;;;;;;;;OAQG;IAEH,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAE9D;;;;;;;;;;OAUG;IAEH,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAEnE;;;;;;;;OAQG;IAEH,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;CACrD"}
|
package/dist/tools/plot.js
CHANGED
|
@@ -29,7 +29,7 @@ export var PriorityAccess;
|
|
|
29
29
|
})(PriorityAccess || (PriorityAccess = {}));
|
|
30
30
|
export var ContactAccess;
|
|
31
31
|
(function (ContactAccess) {
|
|
32
|
-
/** Read existing
|
|
32
|
+
/** Read existing contact details. Without this, only the ID will be provided. */
|
|
33
33
|
ContactAccess[ContactAccess["Read"] = 0] = "Read";
|
|
34
34
|
/** Create and update contacts. */
|
|
35
35
|
ContactAccess[ContactAccess["Write"] = 1] = "Write";
|
|
@@ -67,6 +67,51 @@ export var ContactAccess;
|
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
69
|
export class Plot extends ITool {
|
|
70
|
+
/**
|
|
71
|
+
* Configuration options for the Plot tool.
|
|
72
|
+
*
|
|
73
|
+
* **Important**: All permissions must be explicitly requested. There are no default permissions.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* // Minimal configuration with required permissions
|
|
78
|
+
* build(build: ToolBuilder) {
|
|
79
|
+
* return {
|
|
80
|
+
* plot: build(Plot, {
|
|
81
|
+
* activity: {
|
|
82
|
+
* access: ActivityAccess.Create
|
|
83
|
+
* }
|
|
84
|
+
* })
|
|
85
|
+
* };
|
|
86
|
+
* }
|
|
87
|
+
*
|
|
88
|
+
* // Full configuration with callbacks
|
|
89
|
+
* build(build: ToolBuilder) {
|
|
90
|
+
* return {
|
|
91
|
+
* plot: build(Plot, {
|
|
92
|
+
* activity: {
|
|
93
|
+
* access: ActivityAccess.Create,
|
|
94
|
+
* updated: this.onActivityUpdated
|
|
95
|
+
* },
|
|
96
|
+
* note: {
|
|
97
|
+
* intents: [{
|
|
98
|
+
* description: "Schedule meetings",
|
|
99
|
+
* examples: ["Schedule a meeting tomorrow"],
|
|
100
|
+
* handler: this.onSchedulingIntent
|
|
101
|
+
* }],
|
|
102
|
+
* created: this.onNoteCreated
|
|
103
|
+
* },
|
|
104
|
+
* priority: {
|
|
105
|
+
* access: PriorityAccess.Full
|
|
106
|
+
* },
|
|
107
|
+
* contact: {
|
|
108
|
+
* access: ContactAccess.Write
|
|
109
|
+
* }
|
|
110
|
+
* })
|
|
111
|
+
* };
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
70
115
|
static Options;
|
|
71
116
|
}
|
|
72
117
|
//# sourceMappingURL=plot.js.map
|
package/dist/tools/plot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,
|
|
1
|
+
{"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,GAYN,MAAM,IAAI,CAAC;AAEZ,MAAM,CAAN,IAAY,cAYX;AAZD,WAAY,cAAc;IACxB;;;OAGG;IACH,yDAAO,CAAA;IACP;;;;OAIG;IACH,uDAAM,CAAA;AACR,CAAC,EAZW,cAAc,KAAd,cAAc,QAYzB;AAED,MAAM,CAAN,IAAY,cAYX;AAZD,WAAY,cAAc;IACxB;;;OAGG;IACH,uDAAM,CAAA;IACN;;;;OAIG;IACH,mDAAI,CAAA;AACN,CAAC,EAZW,cAAc,KAAd,cAAc,QAYzB;AAED,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,iFAAiF;IACjF,iDAAI,CAAA;IACJ,kCAAkC;IAClC,mDAAK,CAAA;AACP,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,OAAgB,IAAK,SAAQ,KAAK;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,MAAM,CAAU,OAAO,CA+DrB;CAyRH"}
|
package/dist/tools/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITool } from "..";
|
|
1
|
+
import { ITool, type Serializable } from "..";
|
|
2
2
|
/**
|
|
3
3
|
* Built-in tool for persistent key-value storage.
|
|
4
4
|
*
|
|
@@ -13,9 +13,20 @@ import { ITool } from "..";
|
|
|
13
13
|
* **Storage Characteristics:**
|
|
14
14
|
* - Persistent across worker restarts
|
|
15
15
|
* - Isolated per twist/tool instance
|
|
16
|
-
* - Supports
|
|
16
|
+
* - Supports SuperJSON-serializable data (see below)
|
|
17
17
|
* - Async operations for scalability
|
|
18
18
|
*
|
|
19
|
+
* **Supported Data Types (via SuperJSON):**
|
|
20
|
+
* - Primitives: string, number, boolean, null, undefined
|
|
21
|
+
* - Complex types: Date, RegExp, Map, Set, Error, URL, BigInt
|
|
22
|
+
* - Collections: Arrays and objects (recursively)
|
|
23
|
+
*
|
|
24
|
+
* **NOT Supported (will throw validation errors):**
|
|
25
|
+
* - Functions (use callback tokens instead - see Callbacks tool)
|
|
26
|
+
* - Symbols
|
|
27
|
+
* - Circular references
|
|
28
|
+
* - Custom class instances
|
|
29
|
+
*
|
|
19
30
|
* **Use Cases:**
|
|
20
31
|
* - Storing authentication tokens
|
|
21
32
|
* - Caching configuration data
|
|
@@ -50,23 +61,53 @@ export declare abstract class Store extends ITool {
|
|
|
50
61
|
* Returns the stored value deserialized to the specified type,
|
|
51
62
|
* or null if the key doesn't exist or the value is null.
|
|
52
63
|
*
|
|
53
|
-
*
|
|
64
|
+
* Values are automatically deserialized using SuperJSON, which
|
|
65
|
+
* properly restores Date objects, Maps, Sets, and other complex types.
|
|
66
|
+
*
|
|
67
|
+
* @template T - The expected type of the stored value (must be Serializable)
|
|
54
68
|
* @param key - The storage key to retrieve
|
|
55
69
|
* @returns Promise resolving to the stored value or null
|
|
56
70
|
*/
|
|
57
|
-
abstract get<T>(key: string): Promise<T | null>;
|
|
71
|
+
abstract get<T extends Serializable>(key: string): Promise<T | null>;
|
|
58
72
|
/**
|
|
59
73
|
* Stores a value in persistent storage.
|
|
60
74
|
*
|
|
61
|
-
* The value will be
|
|
75
|
+
* The value will be serialized using SuperJSON and stored persistently.
|
|
62
76
|
* Any existing value at the same key will be overwritten.
|
|
63
77
|
*
|
|
64
|
-
*
|
|
78
|
+
* SuperJSON automatically handles Date objects, Maps, Sets, undefined values,
|
|
79
|
+
* and other complex types that standard JSON doesn't support.
|
|
80
|
+
*
|
|
81
|
+
* @template T - The type of value being stored (must be Serializable)
|
|
65
82
|
* @param key - The storage key to use
|
|
66
|
-
* @param value - The value to store (must be
|
|
83
|
+
* @param value - The value to store (must be SuperJSON-serializable)
|
|
67
84
|
* @returns Promise that resolves when the value is stored
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* // Date objects are preserved
|
|
89
|
+
* await this.set('sync_state', {
|
|
90
|
+
* lastSync: new Date(),
|
|
91
|
+
* minDate: new Date(2024, 0, 1)
|
|
92
|
+
* });
|
|
93
|
+
*
|
|
94
|
+
* // undefined is now supported
|
|
95
|
+
* await this.set('data', { name: 'test', optional: undefined }); // ✅ Works
|
|
96
|
+
*
|
|
97
|
+
* // Arrays with undefined are supported
|
|
98
|
+
* await this.set('items', [1, undefined, 3]); // ✅ Works
|
|
99
|
+
* await this.set('items', [1, null, 3]); // ✅ Also works
|
|
100
|
+
*
|
|
101
|
+
* // Maps and Sets are supported
|
|
102
|
+
* await this.set('mapping', new Map([['key', 'value']])); // ✅ Works
|
|
103
|
+
* await this.set('tags', new Set(['tag1', 'tag2'])); // ✅ Works
|
|
104
|
+
*
|
|
105
|
+
* // Functions are NOT supported - use callback tokens instead
|
|
106
|
+
* const token = await this.callback(this.myFunction);
|
|
107
|
+
* await this.set('callback_ref', token); // ✅ Use callback token
|
|
108
|
+
* ```
|
|
68
109
|
*/
|
|
69
|
-
abstract set<T>(key: string, value: T): Promise<void>;
|
|
110
|
+
abstract set<T extends Serializable>(key: string, value: T): Promise<void>;
|
|
70
111
|
/**
|
|
71
112
|
* Removes a specific key from storage.
|
|
72
113
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/tools/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/tools/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,IAAI,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,8BAAsB,KAAM,SAAQ,KAAK;IACvC;;;;;;;;;;;;OAYG;IAEH,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IAEH,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1E;;;;;;;;OAQG;IAEH,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1C;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CACnC"}
|
package/dist/tools/store.js
CHANGED
|
@@ -13,9 +13,20 @@ import { ITool } from "..";
|
|
|
13
13
|
* **Storage Characteristics:**
|
|
14
14
|
* - Persistent across worker restarts
|
|
15
15
|
* - Isolated per twist/tool instance
|
|
16
|
-
* - Supports
|
|
16
|
+
* - Supports SuperJSON-serializable data (see below)
|
|
17
17
|
* - Async operations for scalability
|
|
18
18
|
*
|
|
19
|
+
* **Supported Data Types (via SuperJSON):**
|
|
20
|
+
* - Primitives: string, number, boolean, null, undefined
|
|
21
|
+
* - Complex types: Date, RegExp, Map, Set, Error, URL, BigInt
|
|
22
|
+
* - Collections: Arrays and objects (recursively)
|
|
23
|
+
*
|
|
24
|
+
* **NOT Supported (will throw validation errors):**
|
|
25
|
+
* - Functions (use callback tokens instead - see Callbacks tool)
|
|
26
|
+
* - Symbols
|
|
27
|
+
* - Circular references
|
|
28
|
+
* - Custom class instances
|
|
29
|
+
*
|
|
19
30
|
* **Use Cases:**
|
|
20
31
|
* - Storing authentication tokens
|
|
21
32
|
* - Caching configuration data
|
package/dist/tools/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/tools/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/tools/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,IAAI,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,OAAgB,KAAM,SAAQ,KAAK;CA+ExC"}
|
package/dist/tools/tasks.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import type { Callback } from "./callbacks";
|
|
|
3
3
|
/**
|
|
4
4
|
* Run background tasks and scheduled jobs.
|
|
5
5
|
*
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
8
|
-
* operate within runtime limits.
|
|
6
|
+
* The Tasks tool enables twists and tools to queue callbacks. This is especially
|
|
7
|
+
* important for long-running operations and batch processing, since twists
|
|
8
|
+
* operate within runtime limits. Task callbacks also benefit from automatic
|
|
9
9
|
* retries on failure.
|
|
10
10
|
*
|
|
11
|
-
* **Note:**
|
|
11
|
+
* **Note:** Tasks tool methods are also available directly on Twist and Tool classes
|
|
12
12
|
* via `this.runTask()`, `this.cancelTask()`, and `this.cancelAllTasks()`.
|
|
13
13
|
* This is the recommended approach for most use cases.
|
|
14
14
|
*
|
package/dist/tools/tasks.js
CHANGED
|
@@ -2,12 +2,12 @@ import { ITool } from "..";
|
|
|
2
2
|
/**
|
|
3
3
|
* Run background tasks and scheduled jobs.
|
|
4
4
|
*
|
|
5
|
-
* The
|
|
6
|
-
*
|
|
7
|
-
* operate within runtime limits.
|
|
5
|
+
* The Tasks tool enables twists and tools to queue callbacks. This is especially
|
|
6
|
+
* important for long-running operations and batch processing, since twists
|
|
7
|
+
* operate within runtime limits. Task callbacks also benefit from automatic
|
|
8
8
|
* retries on failure.
|
|
9
9
|
*
|
|
10
|
-
* **Note:**
|
|
10
|
+
* **Note:** Tasks tool methods are also available directly on Twist and Tool classes
|
|
11
11
|
* via `this.runTask()`, `this.cancelTask()`, and `this.cancelAllTasks()`.
|
|
12
12
|
* This is the recommended approach for most use cases.
|
|
13
13
|
*
|