@plotday/twister 0.21.0 → 0.26.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/LICENSE +1 -1
- package/README.md +35 -6
- package/bin/commands/deploy.js +234 -2
- package/bin/commands/deploy.js.map +1 -1
- package/bin/commands/generate.js +11 -2
- package/bin/commands/generate.js.map +1 -1
- package/bin/commands/login.js +19 -3
- package/bin/commands/login.js.map +1 -1
- package/bin/commands/priority-create.js +7 -2
- package/bin/commands/priority-create.js.map +1 -1
- package/bin/commands/priority-list.js +6 -1
- package/bin/commands/priority-list.js.map +1 -1
- package/bin/commands/twist-logs.js +12 -3
- package/bin/commands/twist-logs.js.map +1 -1
- package/bin/templates/AGENTS.template.md +109 -20
- package/bin/utils/bundle.js +40 -0
- package/bin/utils/bundle.js.map +1 -1
- package/bin/utils/network-error.js +149 -0
- package/bin/utils/network-error.js.map +1 -0
- package/cli/templates/AGENTS.template.md +109 -20
- package/dist/common/calendar.d.ts +12 -4
- package/dist/common/calendar.d.ts.map +1 -1
- package/dist/common/messaging.d.ts +8 -7
- package/dist/common/messaging.d.ts.map +1 -1
- package/dist/common/projects.d.ts +123 -0
- package/dist/common/projects.d.ts.map +1 -0
- package/dist/common/projects.js +2 -0
- package/dist/common/projects.js.map +1 -0
- package/dist/docs/assets/hierarchy.js +1 -1
- package/dist/docs/assets/highlight.css +6 -6
- 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 +5 -5
- package/dist/docs/classes/tools_ai.AI.html +3 -3
- package/dist/docs/classes/tools_callbacks.Callbacks.html +4 -4
- package/dist/docs/classes/tools_integrations.Integrations.html +1 -1
- package/dist/docs/classes/tools_network.Network.html +4 -4
- package/dist/docs/classes/tools_plot.Plot.html +64 -29
- package/dist/docs/classes/tools_store.Store.html +1 -1
- package/dist/docs/classes/tools_tasks.Tasks.html +2 -2
- package/dist/docs/classes/tools_twists.Twists.html +5 -5
- package/dist/docs/classes/twist.Twist.html +1 -1
- package/dist/docs/documents/Building_Custom_Tools.html +5 -6
- package/dist/docs/documents/Built-in_Tools.html +33 -14
- package/dist/docs/documents/Core_Concepts.html +59 -8
- package/dist/docs/documents/Getting_Started.html +19 -3
- package/dist/docs/documents/Runtime_Environment.html +7 -8
- 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 +3 -4
- package/dist/docs/enums/tools_plot.ActivityAccess.html +6 -6
- package/dist/docs/enums/tools_plot.ContactAccess.html +3 -3
- package/dist/docs/enums/tools_plot.PriorityAccess.html +3 -3
- package/dist/docs/functions/utils_hash.quickHash.html +1 -0
- package/dist/docs/hierarchy.html +1 -1
- package/dist/docs/index.html +2 -11
- package/dist/docs/interfaces/common_calendar.CalendarTool.html +14 -8
- package/dist/docs/interfaces/tools_ai.AIRequest.html +4 -4
- package/dist/docs/interfaces/tools_ai.AIResponse.html +2 -2
- package/dist/docs/interfaces/tools_twists.TwistSource.html +1 -1
- package/dist/docs/modules/index.html +1 -1
- package/dist/docs/modules/plot.html +1 -1
- package/dist/docs/modules/tools_plot.html +1 -1
- package/dist/docs/modules/utils_hash.html +1 -0
- package/dist/docs/modules.html +1 -1
- package/dist/docs/types/plot.Activity.html +37 -52
- package/dist/docs/types/plot.ActivityCommon.html +22 -0
- package/dist/docs/types/plot.ActivityLink.html +1 -1
- package/dist/docs/types/plot.ActivityMeta.html +24 -6
- package/dist/docs/types/plot.ActivityUpdate.html +2 -8
- package/dist/docs/types/plot.ActivityWithNotes.html +1 -0
- package/dist/docs/types/plot.Actor.html +5 -5
- package/dist/docs/types/plot.ActorId.html +8 -3
- package/dist/docs/types/plot.ContentType.html +1 -0
- package/dist/docs/types/plot.NewActivity.html +18 -3
- package/dist/docs/types/plot.NewActivityWithNotes.html +1 -0
- package/dist/docs/types/plot.NewContact.html +4 -4
- package/dist/docs/types/plot.NewNote.html +16 -0
- package/dist/docs/types/plot.NewPriority.html +1 -1
- package/dist/docs/types/plot.Note.html +7 -0
- package/dist/docs/types/plot.NoteUpdate.html +14 -0
- package/dist/docs/types/plot.PickPriorityConfig.html +3 -3
- package/dist/docs/types/plot.Priority.html +3 -3
- package/dist/docs/types/plot.Tags.html +1 -0
- package/dist/docs/types/tools_ai.DataContent.html +1 -1
- package/dist/docs/types/tools_network.WebhookRequest.html +4 -2
- package/dist/docs/types/{tools_plot.ActivityIntentHandler.html → tools_plot.NoteIntentHandler.html} +5 -5
- package/dist/llm-docs/common/calendar.d.ts +2 -2
- package/dist/llm-docs/common/calendar.d.ts.map +1 -1
- package/dist/llm-docs/common/calendar.js +2 -2
- package/dist/llm-docs/common/calendar.js.map +1 -1
- package/dist/llm-docs/common/messaging.d.ts +2 -2
- package/dist/llm-docs/common/messaging.d.ts.map +1 -1
- package/dist/llm-docs/common/messaging.js +2 -2
- package/dist/llm-docs/common/messaging.js.map +1 -1
- package/dist/llm-docs/common/projects.d.ts +9 -0
- package/dist/llm-docs/common/projects.d.ts.map +1 -0
- package/dist/llm-docs/common/projects.js +8 -0
- package/dist/llm-docs/common/projects.js.map +1 -0
- package/dist/llm-docs/index.d.ts +1 -1
- package/dist/llm-docs/index.js +17 -17
- package/dist/llm-docs/index.js.map +1 -1
- package/dist/llm-docs/plot.d.ts +2 -2
- package/dist/llm-docs/plot.d.ts.map +1 -1
- package/dist/llm-docs/plot.js +2 -2
- package/dist/llm-docs/plot.js.map +1 -1
- package/dist/llm-docs/tag.d.ts +2 -2
- package/dist/llm-docs/tag.d.ts.map +1 -1
- package/dist/llm-docs/tag.js +2 -2
- package/dist/llm-docs/tag.js.map +1 -1
- package/dist/llm-docs/tool.d.ts +2 -2
- package/dist/llm-docs/tool.d.ts.map +1 -1
- package/dist/llm-docs/tool.js +2 -2
- package/dist/llm-docs/tool.js.map +1 -1
- package/dist/llm-docs/tools/ai.d.ts +2 -2
- package/dist/llm-docs/tools/ai.d.ts.map +1 -1
- package/dist/llm-docs/tools/ai.js +2 -2
- package/dist/llm-docs/tools/ai.js.map +1 -1
- package/dist/llm-docs/tools/callbacks.d.ts +2 -2
- package/dist/llm-docs/tools/callbacks.d.ts.map +1 -1
- package/dist/llm-docs/tools/callbacks.js +2 -2
- package/dist/llm-docs/tools/callbacks.js.map +1 -1
- package/dist/llm-docs/tools/integrations.d.ts +1 -1
- package/dist/llm-docs/tools/integrations.js +1 -1
- package/dist/llm-docs/tools/network.d.ts +2 -2
- package/dist/llm-docs/tools/network.d.ts.map +1 -1
- package/dist/llm-docs/tools/network.js +2 -2
- package/dist/llm-docs/tools/network.js.map +1 -1
- package/dist/llm-docs/tools/plot.d.ts +2 -2
- package/dist/llm-docs/tools/plot.d.ts.map +1 -1
- package/dist/llm-docs/tools/plot.js +2 -2
- 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.js +1 -1
- package/dist/llm-docs/tools/tasks.d.ts +1 -1
- package/dist/llm-docs/tools/tasks.js +1 -1
- package/dist/llm-docs/tools/twists.d.ts +2 -2
- package/dist/llm-docs/tools/twists.d.ts.map +1 -1
- package/dist/llm-docs/tools/twists.js +2 -2
- package/dist/llm-docs/tools/twists.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.js +1 -1
- package/dist/plot.d.ts +271 -61
- package/dist/plot.d.ts.map +1 -1
- package/dist/plot.js.map +1 -1
- package/dist/tag.d.ts +2 -3
- package/dist/tag.d.ts.map +1 -1
- package/dist/tag.js +2 -3
- package/dist/tag.js.map +1 -1
- package/dist/tool.d.ts +2 -2
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +1 -1
- package/dist/tool.js.map +1 -1
- package/dist/tools/ai.d.ts +2 -2
- package/dist/tools/ai.d.ts.map +1 -1
- package/dist/tools/callbacks.d.ts +1 -1
- package/dist/tools/callbacks.d.ts.map +1 -1
- package/dist/tools/network.d.ts +2 -0
- package/dist/tools/network.d.ts.map +1 -1
- package/dist/tools/network.js.map +1 -1
- package/dist/tools/plot.d.ts +150 -29
- package/dist/tools/plot.d.ts.map +1 -1
- package/dist/tools/plot.js +4 -4
- package/dist/tools/plot.js.map +1 -1
- package/dist/tools/twists.d.ts +2 -2
- package/dist/twist-guide.d.ts +1 -1
- package/dist/twist-guide.d.ts.map +1 -1
- package/dist/utils/hash.d.ts +2 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +9 -0
- package/dist/utils/hash.js.map +1 -0
- package/package.json +56 -2
- package/tsconfig.base.json +1 -0
- package/dist/docs/documents/Advanced.html +0 -91
- package/dist/docs/types/plot.NoteType.html +0 -1
- package/dist/llm-docs/creator-docs.d.ts +0 -9
- package/dist/llm-docs/creator-docs.d.ts.map +0 -1
- package/dist/llm-docs/creator-docs.js +0 -8
- package/dist/llm-docs/creator-docs.js.map +0 -1
package/dist/tool.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export declare abstract class Tool<TSelf> implements ITool {
|
|
|
67
67
|
/**
|
|
68
68
|
* Creates a persistent callback to a method on this tool.
|
|
69
69
|
*
|
|
70
|
-
* ExtraArgs are strongly typed to match the method's signature
|
|
70
|
+
* ExtraArgs are strongly typed to match the method's signature.
|
|
71
71
|
*
|
|
72
72
|
* @param fn - The method to callback
|
|
73
73
|
* @param extraArgs - Additional arguments to pass (type-checked, must be serializable)
|
|
@@ -78,7 +78,7 @@ export declare abstract class Tool<TSelf> implements ITool {
|
|
|
78
78
|
* const callback = await this.callback(this.onWebhook, "calendar", 123);
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
protected callback(fn:
|
|
81
|
+
protected callback<Fn extends (...args: any[]) => any>(fn: Fn, ...extraArgs: Parameters<Fn>): Promise<Callback>;
|
|
82
82
|
/**
|
|
83
83
|
* Deletes a specific callback by its token.
|
|
84
84
|
*
|
package/dist/tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,QAAQ,EACT,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B;;;GAGG;AACH,8BAAsB,KAAK;CAAG;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,8BAAsB,IAAI,CAAC,KAAK,CAAE,YAAW,KAAK;IAE9C,SAAS,CAAC,EAAE,EAAE,MAAM;IACpB,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;IACtC,OAAO,CAAC,QAAQ;gBAFN,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,EAC9B,QAAQ,EAAE,QAAQ;IAG5B;;;OAGG;IACH,SAAS,KAAK,KAAK,sBAElB;IAED;;;;;;;;;;;;;;;;OAgBG;IAEH,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAIzD;;;;;;;;;;;;;OAaG;cACa,QAAQ,
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,QAA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istent callback to a method on this tool.
|
|
74
74
|
*
|
|
75
|
-
* ExtraArgs are strongly typed to match the method's signature
|
|
75
|
+
* ExtraArgs are strongly typed to match the method's signature.
|
|
76
76
|
*
|
|
77
77
|
* @param fn - The method to callback
|
|
78
78
|
* @param extraArgs - Additional arguments to pass (type-checked, must be serializable)
|
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;IAEZ;IACA;IACF;IAHV,YACY,EAAU,EACV,OAA4B,EAC9B,QAAkB;QAFhB,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAqB;QAC9B,aAAQ,GAAR,QAAQ,CAAU;IACzB,CAAC;IAEJ;;;OAGG;IACH,IAAc,KAAK;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAqB,CAAC;IACrD,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,6DAA6D;IAC7D,KAAK,CAAC,KAAkB;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;;;;;;;;;;OAaG;IACO,KAAK,CAAC,QAAQ,CACtB,
|
|
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;IAEZ;IACA;IACF;IAHV,YACY,EAAU,EACV,OAA4B,EAC9B,QAAkB;QAFhB,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAqB;QAC9B,aAAQ,GAAR,QAAQ,CAAU;IACzB,CAAC;IAEJ;;;OAGG;IAC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C,QAAQ,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;CACF"}
|
package/dist/tools/ai.d.ts
CHANGED
|
@@ -453,9 +453,9 @@ export interface TextPart {
|
|
|
453
453
|
text: string;
|
|
454
454
|
}
|
|
455
455
|
/**
|
|
456
|
-
* Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer
|
|
456
|
+
* Data content. Can either be a base64-encoded string, a Uint8Array, or an ArrayBuffer.
|
|
457
457
|
*/
|
|
458
|
-
export type DataContent = string | Uint8Array | ArrayBuffer
|
|
458
|
+
export type DataContent = string | Uint8Array | ArrayBuffer;
|
|
459
459
|
/**
|
|
460
460
|
* Image content part of a prompt. It contains an image.
|
|
461
461
|
*/
|
package/dist/tools/ai.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/tools/ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,8BAAsB,EAAG,SAAQ,KAAK;IACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0EG;IAEH,QAAQ,CAAC,MAAM,CAAC,KAAK,SAAS,SAAS,EAAE,MAAM,SAAS,OAAO,GAAG,KAAK,EACrE,OAAO,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;OAKG;IACH,KAAK,EAAE,MA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to the function (must be serializable)
|
|
62
62
|
* @returns Promise resolving to a persistent callback token
|
|
63
63
|
*/
|
|
64
|
-
abstract create(fn:
|
|
64
|
+
abstract create<Fn extends (...args: any[]) => any>(fn: Fn, ...extraArgs: Parameters<Fn>): Promise<Callback>;
|
|
65
65
|
/**
|
|
66
66
|
* Creates a persistent callback to a function from the parent twist/tool.
|
|
67
67
|
* Use this when the callback function is passed in from outside this class.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbacks.d.ts","sourceRoot":"","sources":["../../src/tools/callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGhF,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,8BAAsB,SAAU,SAAQ,KAAK;IAC3C;;;;;;OAMG;IAEH,QAAQ,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"callbacks.d.ts","sourceRoot":"","sources":["../../src/tools/callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGhF,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,8BAAsB,SAAU,SAAQ,KAAK;IAC3C;;;;;;OAMG;IAEH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAChD,EAAE,EAAE,EAAE,EACN,GAAG,SAAS,EAAE,UAAU,CAAC,EAAE,CAAC,GAC3B,OAAO,CAAC,QAAQ,CAAC;IAEpB;;;;;;;OAOG;IAEH,QAAQ,CAAC,gBAAgB,CACvB,EAAE,EAAE,QAAQ,EACZ,GAAG,SAAS,EAAE,GAAG,EAAE,GAClB,OAAO,CAAC,QAAQ,CAAC;IAEpB;;;;;OAKG;IAEH,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAElD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEnC;;;;;;OAMG;IAEH,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;CAC1E"}
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export type WebhookRequest = {
|
|
|
26
26
|
params: Record<string, string>;
|
|
27
27
|
/** Request body (parsed as JSON if applicable) */
|
|
28
28
|
body: any;
|
|
29
|
+
/** Raw request body (for signature verification) */
|
|
30
|
+
rawBody?: string;
|
|
29
31
|
};
|
|
30
32
|
/**
|
|
31
33
|
* Built-in tool for requesting HTTP access permissions and managing webhooks.
|
|
@@ -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,a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B,SAAS,SAAS,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAClE,OAAO,EAAE;QACT,QAAQ,EAAE,SAAS,CAAC;QACpB,SAAS,CAAC,EAAE,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;QAC3E,QAAQ,CAAC,EAAE,YAAY,CAAC;QACxB,aAAa,CAAC,EAAE,aAAa,CAAC;KAC/B,GAAG,OAAO,CAAC,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CACnD"}
|
|
@@ -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;AAiC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH,MAAM,OAAgB,OAAQ,SAAQ,KAAK;IACzC,MAAM,CAAU,OAAO,CAMrB;CAwEH"}
|
package/dist/tools/plot.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { type Activity, type ActivityMeta, type ActivityUpdate, type Actor, type ActorId, ITool, type NewActivity, type NewContact, type NewPriority, type Priority, type Tag } from "..";
|
|
1
|
+
import { type Activity, type ActivityMeta, type ActivityUpdate, type Actor, type ActorId, ITool, type NewActivity, type NewActivityWithNotes, type NewContact, type NewNote, type NewPriority, type Note, type NoteUpdate, type Priority, type Tag } from "..";
|
|
2
2
|
export declare enum ActivityAccess {
|
|
3
3
|
/**
|
|
4
|
-
* Create new
|
|
5
|
-
* Add/remove tags on Activity where the twist was mentioned.
|
|
4
|
+
* Create new Note on an Activity where the twist was mentioned.
|
|
5
|
+
* Add/remove tags on Activity or Note where the twist was mentioned.
|
|
6
6
|
*/
|
|
7
7
|
Respond = 0,
|
|
8
8
|
/**
|
|
9
|
-
* Create new
|
|
10
|
-
* Create new
|
|
9
|
+
* Create new Activity.
|
|
10
|
+
* Create new Note in an Activity the twist created.
|
|
11
11
|
* All Respond permissions.
|
|
12
12
|
*/
|
|
13
13
|
Create = 1
|
|
@@ -35,13 +35,13 @@ export declare enum ContactAccess {
|
|
|
35
35
|
* Intent handler for activity mentions.
|
|
36
36
|
* Defines how the twist should respond when mentioned in an activity.
|
|
37
37
|
*/
|
|
38
|
-
export type
|
|
38
|
+
export type NoteIntentHandler = {
|
|
39
39
|
/** Human-readable description of what this intent handles */
|
|
40
40
|
description: string;
|
|
41
41
|
/** Example phrases or activity content that would match this intent */
|
|
42
42
|
examples: string[];
|
|
43
43
|
/** The function to call when this intent is matched */
|
|
44
|
-
handler: (
|
|
44
|
+
handler: (note: Note) => Promise<void>;
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
47
|
* Built-in tool for interacting with the core Plot data layer.
|
|
@@ -77,26 +77,31 @@ export type ActivityIntentHandler = {
|
|
|
77
77
|
*/
|
|
78
78
|
export declare abstract class Plot extends ITool {
|
|
79
79
|
static readonly Options: {
|
|
80
|
-
/**
|
|
81
|
-
* Activity event callbacks.
|
|
82
|
-
*/
|
|
83
80
|
activity?: {
|
|
81
|
+
/**
|
|
82
|
+
* Capability to create Notes and modify tags.
|
|
83
|
+
*/
|
|
84
84
|
access?: ActivityAccess;
|
|
85
85
|
/**
|
|
86
|
-
* Called when an activity is updated.
|
|
86
|
+
* Called when an activity created by this twist is updated.
|
|
87
|
+
* This is often used to implement two-way sync with an external system.
|
|
87
88
|
*
|
|
88
89
|
* @param activity - The updated activity
|
|
89
|
-
* @param changes -
|
|
90
|
+
* @param changes - Changes to the activity and the previous version
|
|
90
91
|
*/
|
|
91
|
-
updated?: (activity: Activity, changes
|
|
92
|
+
updated?: (activity: Activity, changes: {
|
|
93
|
+
update: ActivityUpdate;
|
|
92
94
|
previous: Activity;
|
|
93
95
|
tagsAdded: Record<Tag, ActorId[]>;
|
|
94
96
|
tagsRemoved: Record<Tag, ActorId[]>;
|
|
95
97
|
}) => Promise<void>;
|
|
98
|
+
};
|
|
99
|
+
note?: {
|
|
96
100
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
101
|
+
* Respond to mentions in notes.
|
|
102
|
+
*
|
|
103
|
+
* When a note mentions this twist, the system will match the note
|
|
104
|
+
* content against these intents and call the matching handler.
|
|
100
105
|
*
|
|
101
106
|
* @example
|
|
102
107
|
* ```typescript
|
|
@@ -111,7 +116,18 @@ export declare abstract class Plot extends ITool {
|
|
|
111
116
|
* }]
|
|
112
117
|
* ```
|
|
113
118
|
*/
|
|
114
|
-
intents?:
|
|
119
|
+
intents?: NoteIntentHandler[];
|
|
120
|
+
/**
|
|
121
|
+
* Called when a note is created on an activity created by this twist.
|
|
122
|
+
* This is often used to implement two-way sync with an external system,
|
|
123
|
+
* such as syncing notes as comments back to the source system.
|
|
124
|
+
*
|
|
125
|
+
* Notes created by the twist itself are automatically filtered out to prevent loops.
|
|
126
|
+
* The parent activity is available via note.activity.
|
|
127
|
+
*
|
|
128
|
+
* @param note - The newly created note
|
|
129
|
+
*/
|
|
130
|
+
created?: (note: Note) => Promise<void>;
|
|
115
131
|
};
|
|
116
132
|
priority?: {
|
|
117
133
|
access?: PriorityAccess;
|
|
@@ -130,7 +146,7 @@ export declare abstract class Plot extends ITool {
|
|
|
130
146
|
* @param activity - The activity data to create
|
|
131
147
|
* @returns Promise resolving to the complete created activity
|
|
132
148
|
*/
|
|
133
|
-
abstract createActivity(activity: NewActivity): Promise<Activity>;
|
|
149
|
+
abstract createActivity(activity: NewActivity | NewActivityWithNotes): Promise<Activity>;
|
|
134
150
|
/**
|
|
135
151
|
* Creates multiple activities in a single batch operation.
|
|
136
152
|
*
|
|
@@ -141,7 +157,7 @@ export declare abstract class Plot extends ITool {
|
|
|
141
157
|
* @param activities - Array of activity data to create
|
|
142
158
|
* @returns Promise resolving to array of created activities
|
|
143
159
|
*/
|
|
144
|
-
abstract createActivities(activities: NewActivity[]): Promise<Activity[]>;
|
|
160
|
+
abstract createActivities(activities: (NewActivity | NewActivityWithNotes)[]): Promise<Activity[]>;
|
|
145
161
|
/**
|
|
146
162
|
* Updates an existing activity in the Plot system.
|
|
147
163
|
*
|
|
@@ -195,27 +211,132 @@ export declare abstract class Plot extends ITool {
|
|
|
195
211
|
*/
|
|
196
212
|
abstract updateActivity(activity: ActivityUpdate): Promise<void>;
|
|
197
213
|
/**
|
|
198
|
-
* Retrieves all
|
|
214
|
+
* Retrieves all notes within an activity.
|
|
215
|
+
*
|
|
216
|
+
* Notes are detailed entries within an activity, ordered by creation time.
|
|
217
|
+
* Each note can contain markdown content, links, and other detailed information
|
|
218
|
+
* related to the parent activity.
|
|
219
|
+
*
|
|
220
|
+
* @param activity - The activity whose notes to retrieve
|
|
221
|
+
* @returns Promise resolving to array of notes in the activity
|
|
222
|
+
*/
|
|
223
|
+
abstract getNotes(activity: Activity): Promise<Note[]>;
|
|
224
|
+
/**
|
|
225
|
+
* Creates a new note in an activity.
|
|
226
|
+
*
|
|
227
|
+
* Notes provide detailed content within an activity, supporting markdown,
|
|
228
|
+
* links, and other rich content. The note will be automatically assigned
|
|
229
|
+
* an ID and author information based on the current execution context.
|
|
230
|
+
*
|
|
231
|
+
* @param note - The note data to create
|
|
232
|
+
* @returns Promise resolving to the complete created note
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* // Create a note with content
|
|
237
|
+
* await this.plot.createNote({
|
|
238
|
+
* activity: { id: "activity-123" },
|
|
239
|
+
* note: "Discussion notes from the meeting...",
|
|
240
|
+
* contentType: "markdown"
|
|
241
|
+
* });
|
|
242
|
+
*
|
|
243
|
+
* // Create a note with links
|
|
244
|
+
* await this.plot.createNote({
|
|
245
|
+
* activity: { id: "activity-456" },
|
|
246
|
+
* note: "Meeting recording available",
|
|
247
|
+
* links: [{
|
|
248
|
+
* type: ActivityLinkType.external,
|
|
249
|
+
* title: "View Recording",
|
|
250
|
+
* url: "https://example.com/recording"
|
|
251
|
+
* }]
|
|
252
|
+
* });
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
abstract createNote(note: NewNote): Promise<Note>;
|
|
256
|
+
/**
|
|
257
|
+
* Creates multiple notes in a single batch operation.
|
|
258
|
+
*
|
|
259
|
+
* This method efficiently creates multiple notes at once, which is
|
|
260
|
+
* more performant than calling createNote() multiple times individually.
|
|
261
|
+
* All notes are created with the same author and access control rules.
|
|
262
|
+
*
|
|
263
|
+
* @param notes - Array of note data to create
|
|
264
|
+
* @returns Promise resolving to array of created notes
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* // Create multiple notes in one batch
|
|
269
|
+
* await this.plot.createNotes([
|
|
270
|
+
* {
|
|
271
|
+
* activity: { id: "activity-123" },
|
|
272
|
+
* note: "First message in thread"
|
|
273
|
+
* },
|
|
274
|
+
* {
|
|
275
|
+
* activity: { id: "activity-123" },
|
|
276
|
+
* note: "Second message in thread"
|
|
277
|
+
* }
|
|
278
|
+
* ]);
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
abstract createNotes(notes: NewNote[]): Promise<Note[]>;
|
|
282
|
+
/**
|
|
283
|
+
* Updates an existing note in the Plot system.
|
|
284
|
+
*
|
|
285
|
+
* Only the fields provided in the update object will be modified - all other fields
|
|
286
|
+
* remain unchanged. This enables partial updates without needing to fetch and resend
|
|
287
|
+
* the entire note object.
|
|
288
|
+
*
|
|
289
|
+
* @param note - The note update containing the ID and fields to change
|
|
290
|
+
* @returns Promise that resolves when the update is complete
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* // Update note content
|
|
295
|
+
* await this.plot.updateNote({
|
|
296
|
+
* id: "note-123",
|
|
297
|
+
* note: "Updated content with more details"
|
|
298
|
+
* });
|
|
299
|
+
*
|
|
300
|
+
* // Add tags to a note
|
|
301
|
+
* await this.plot.updateNote({
|
|
302
|
+
* id: "note-456",
|
|
303
|
+
* twistTags: {
|
|
304
|
+
* [Tag.Important]: true
|
|
305
|
+
* }
|
|
306
|
+
* });
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
abstract updateNote(note: NoteUpdate): Promise<void>;
|
|
310
|
+
/**
|
|
311
|
+
* Finds an activity by its meta.source.
|
|
312
|
+
*
|
|
313
|
+
* This method enables lookup of activities that were created from external
|
|
314
|
+
* systems, using the metadata to locate the corresponding Plot activity.
|
|
199
315
|
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* finding conversation histories or related task sequences.
|
|
316
|
+
* By default, archived activities are excluded from the search. Set includeArchived
|
|
317
|
+
* to true to include them in the results.
|
|
203
318
|
*
|
|
204
|
-
* @param
|
|
205
|
-
* @
|
|
319
|
+
* @param source - The meta.source value to search for
|
|
320
|
+
* @param includeArchived - Whether to include archived activities in search (default: false)
|
|
321
|
+
* @returns Promise resolving to the matching activity or null if not found
|
|
206
322
|
*/
|
|
207
|
-
abstract
|
|
323
|
+
abstract getActivityBySource(source: string, includeArchived?: boolean): Promise<Activity | null>;
|
|
208
324
|
/**
|
|
209
325
|
* Finds an activity by its metadata.
|
|
210
326
|
*
|
|
211
327
|
* This method enables lookup of activities that were created from external
|
|
212
328
|
* systems, using the metadata to locate the corresponding Plot activity.
|
|
213
|
-
*
|
|
329
|
+
* Uses JSON containment matching - the provided meta must be contained
|
|
330
|
+
* within the activity's meta field.
|
|
331
|
+
*
|
|
332
|
+
* By default, archived activities are excluded from the search. Set includeArchived
|
|
333
|
+
* to true to include them in the results.
|
|
214
334
|
*
|
|
215
|
-
* @param meta - The
|
|
335
|
+
* @param meta - The metadata to search for (uses JSON containment matching)
|
|
336
|
+
* @param includeArchived - Whether to include archived activities in search (default: false)
|
|
216
337
|
* @returns Promise resolving to the matching activity or null if not found
|
|
217
338
|
*/
|
|
218
|
-
abstract getActivityByMeta(meta: ActivityMeta): Promise<Activity | null>;
|
|
339
|
+
abstract getActivityByMeta(meta: ActivityMeta, includeArchived?: boolean): Promise<Activity | null>;
|
|
219
340
|
/**
|
|
220
341
|
* Creates a new priority in the Plot system.
|
|
221
342
|
*
|
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,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,EACL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,GAAG,EACT,MAAM,IAAI,CAAC;AAEZ,oBAAY,cAAc;IACxB;;;OAGG;IACH,OAAO,IAAA;IACP;;;;OAIG;IACH,MAAM,IAAA;CACP;AAED,oBAAY,cAAc;IACxB;;;OAGG;IACH,MAAM,IAAA;IACN;;;;OAIG;IACH,IAAI,IAAA;CACL;AAED,oBAAY,aAAa;IACvB,8BAA8B;IAC9B,IAAI,IAAA;IACJ,kCAAkC;IAClC,KAAK,IAAA;CACN;AAED;;;GAGG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,OAAO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CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAEpD;;;;;;;;;;;;OAYG;IAEH,QAAQ,CAAC,mBAAmB,CAC1B,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAE3B;;;;;;;;;;;;;;OAcG;IAEH,QAAQ,CAAC,iBAAiB,CACxB,IAAI,EAAE,YAAY,EAClB,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAE3B;;;;;;;;OAQG;IAEH,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAEjE;;;;;;;;;;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
|
@@ -2,13 +2,13 @@ import { ITool, } from "..";
|
|
|
2
2
|
export var ActivityAccess;
|
|
3
3
|
(function (ActivityAccess) {
|
|
4
4
|
/**
|
|
5
|
-
* Create new
|
|
6
|
-
* Add/remove tags on Activity where the twist was mentioned.
|
|
5
|
+
* Create new Note on an Activity where the twist was mentioned.
|
|
6
|
+
* Add/remove tags on Activity or Note where the twist was mentioned.
|
|
7
7
|
*/
|
|
8
8
|
ActivityAccess[ActivityAccess["Respond"] = 0] = "Respond";
|
|
9
9
|
/**
|
|
10
|
-
* Create new
|
|
11
|
-
* Create new
|
|
10
|
+
* Create new Activity.
|
|
11
|
+
* Create new Note in an Activity the twist created.
|
|
12
12
|
* All Respond permissions.
|
|
13
13
|
*/
|
|
14
14
|
ActivityAccess[ActivityAccess["Create"] = 1] = "Create";
|
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,GAUN,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,8BAA8B;IAC9B,iDAAI,CAAA;IACJ,kCAAkC;IAClC,mDAAK,CAAA;AACP,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,OAAgB,IAAK,SAAQ,KAAK;IACtC,MAAM,CAAU,OAAO,CA8DrB;CA4QH"}
|
package/dist/tools/twists.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { type Callback, ITool } from "..";
|
|
|
5
5
|
export interface TwistSource {
|
|
6
6
|
/**
|
|
7
7
|
* Package dependencies with version specifiers
|
|
8
|
-
* @example { "@plotday/
|
|
8
|
+
* @example { "@plotday/twister": "workspace:^", "@plotday/tool-google-calendar": "^1.0.0" }
|
|
9
9
|
*/
|
|
10
10
|
dependencies: Record<string, string>;
|
|
11
11
|
/**
|
|
@@ -108,7 +108,7 @@ export declare abstract class Twists extends ITool {
|
|
|
108
108
|
* - Create activities from events
|
|
109
109
|
* `);
|
|
110
110
|
*
|
|
111
|
-
* // source.dependencies: { "@plotday/
|
|
111
|
+
* // source.dependencies: { "@plotday/twister": "workspace:^", ... }
|
|
112
112
|
* // source.files: { "index.ts": "export default class..." }
|
|
113
113
|
* ```
|
|
114
114
|
*/
|
package/dist/twist-guide.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const TWIST_GUIDE = "# Twist Implementation Guide for LLMs\n\nThis document provides context for AI assistants generating or modifying twists.\n\n## Architecture Overview\n\nPlot Twists are TypeScript classes that extend the `Twist` base class. Twists interact with external services and Plot's core functionality through a tool-based architecture.\n\n### Runtime Environment\n\n**Critical**: All Twists and tool functions are executed in a sandboxed, ephemeral environment with limited resources:\n\n- **Memory is temporary**: Anything stored in memory (e.g. as a variable in the twist/tool object) is lost after the function completes. Use the Store tool instead. Only use memory for temporary caching.\n- **Limited CPU time**: Each execution has limited CPU time (typically 10 seconds) and memory (128MB)\n- **Use the Run tool**: Queue separate chunks of work with `run.now(functionName, context)`\n- **Break long operations**: Split large operations into smaller batches that can be processed independently\n- **Store intermediate state**: Use the Store tool to persist state between batches\n- **Examples**: Syncing large datasets, processing many API calls, or performing batch operations\n\n## twist Structure Pattern\n\n```typescript\nimport {\n type Activity,\n twist,\n type Priority,\n type ToolBuilder,\n} from \"@plotday/twister\";\nimport { Plot } from \"@plotday/twister/tools/plot\";\n\nexport default class MyTwist extends Twist<MyTwist> {\n build(build: ToolBuilder) {\n return {\n plot: build(Plot),\n };\n }\n\n async activate(priority: Pick<Priority, \"id\">) {\n // Called when twist is enabled for a priority\n // Common actions: request auth, create setup activities\n }\n\n async activity(activity: Activity) {\n // Called when an activity is routed to this twist\n // Common actions: process external events, update activities\n }\n}\n```\n\n## Tool System\n\n### Accessing Tools\n\nAll tools are declared in the `build` method:\n\n```typescript\nbuild(build: ToolBuilder) {\n return {\n toolName: build(ToolClass),\n };\n}\n```\n\nAll `build()` calls must occur in the `build` method as they are used for dependency analysis.\n\nIMPORTANT: HTTP access is restricted to URLs requested via `build(Network, { urls: [url1, url2, ...] })` in the `build` method. Wildcards are supported. Use `build(Network, { urls: ['*'] })` if full access is needed.\n\n### Built-in Tools (Always Available)\n\nFor complete API documentation of built-in tools including all methods, types, and detailed examples, see the TypeScript definitions in your installed package at `node_modules/@plotday/twister/src/tools/*.ts`. Each tool file contains comprehensive JSDoc documentation.\n\n**Quick reference - Available tools:**\n\n- `@plotday/twister/tools/plot` - Core data layer (create/update activities, priorities, contacts)\n- `@plotday/twister/tools/ai` - LLM integration (text generation, structured output, reasoning)\n - Use ModelPreferences to specify `speed` (fast/balanced/capable) and `cost` (low/medium/high)\n- `@plotday/twister/tools/store` - Persistent key-value storage (also via `this.set()`, `this.get()`)\n- `@plotday/twister/tools/tasks` - Queue batched work (also via `this.run()`)\n- `@plotday/twister/tools/callbacks` - Persistent function references (also via `this.callback()`)\n- `@plotday/twister/tools/integrations` - OAuth2 authentication flows\n- `@plotday/twister/tools/network` - HTTP access permissions and webhook management\n- `@plotday/twister/tools/twists` - Manage other Twists\n\n**Critical**: Never use instance variables for state. They are lost after function execution. Always use Store methods.\n\n### External Tools (Add to package.json)\n\nAdd tool dependencies to `package.json`:\n\n```json\n{\n \"dependencies\": {\n \"@plotday/twister\": \"workspace:^\",\n \"@plotday/tool-google-calendar\": \"workspace:^\"\n }\n}\n```\n\n#### Common External Tools\n\n- `@plotday/tool-google-calendar`: Google Calendar integration\n- `@plotday/tool-outlook-calendar`: Outlook Calendar integration\n- `@plotday/tool-google-contacts`: Google Contacts integration\n\n## Lifecycle Methods\n\n### activate(priority: Pick<Priority, \"id\">)\n\nCalled when the twist is enabled for a priority. Common patterns:\n\n**Request Authentication:**\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n const authLink = await this.tools.externalTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n await this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Connect your account\",\n links: [authLink],\n });\n}\n```\n\n**Store Parent Activity for Later:**\n\n```typescript\nconst activity = await this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Setup\",\n});\n\nawait this.set(\"setup_activity_id\", activity.id);\n```\n\n### activity(activity: Activity)\n\nCalled when an activity is routed to the twist. Common patterns:\n\n**Create Activities from External Events:**\n\n```typescript\nasync activity(activity: Activity) {\n await this.tools.plot.createActivity(activity);\n}\n```\n\n**Update Based on User Action:**\n\n```typescript\nasync activity(activity: Activity) {\n if (activity.completed) {\n await this.handleCompletion(activity);\n }\n}\n```\n\n## Activity Links\n\nActivity links enable user interaction:\n\n```typescript\nimport { type ActivityLink, ActivityLinkType } from \"@plotday/twister\";\n\n// URL link\nconst urlLink: ActivityLink = {\n title: \"Open website\",\n type: ActivityLinkType.url,\n url: \"https://example.com\",\n};\n\n// Callback link (uses Callbacks tool)\nconst token = await this.callback(this.onLinkClicked, \"context\");\nconst callbackLink: ActivityLink = {\n title: \"Click me\",\n type: ActivityLinkType.callback,\n token: token,\n};\n\n// Add to activity\nawait this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Task with links\",\n links: [urlLink, callbackLink],\n});\n```\n\n## Authentication Pattern\n\nCommon pattern for OAuth authentication:\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n // Request auth link from tool with callback\n const authLink = await this.tools.googleTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n // Create activity with auth link\n const activity = await this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Connect Google account\",\n links: [authLink],\n });\n\n // Store for later use\n await this.set(\"auth_activity_id\", activity.id);\n}\n\nasync onAuthComplete(authResult: { authToken: string }, provider: string) {\n // Store auth token\n await this.set(`${provider}_auth`, authResult.authToken);\n\n // Continue setup flow\n await this.setupSyncOptions(authResult.authToken);\n}\n```\n\n## Sync Pattern\n\nPattern for syncing external data with callbacks:\n\n```typescript\nasync startSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n\n await this.tools.calendarTool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n calendarId\n );\n}\n\nasync handleEvent(activity: Activity, calendarId: string): Promise<void> {\n // Process incoming event from external service\n await this.tools.plot.createActivity(activity);\n}\n\nasync stopSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n await this.tools.calendarTool.stopSync(authToken, calendarId);\n}\n```\n\n## Calendar Selection Pattern\n\nPattern for letting users select from multiple calendars/accounts:\n\n```typescript\nprivate async createCalendarSelectionActivity(\n provider: string,\n calendars: Calendar[],\n authToken: string\n): Promise<void> {\n const links: ActivityLink[] = [];\n\n for (const calendar of calendars) {\n const token = await this.callback(\n this.onCalendarSelected,\n provider,\n calendar.id,\n calendar.name,\n authToken\n );\n\n links.push({\n title: `\uD83D\uDCC5 ${calendar.name}${calendar.primary ? \" (Primary)\" : \"\"}`,\n type: ActivityLinkType.callback,\n token: token,\n });\n }\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Which calendars would you like to connect?\",\n links,\n });\n}\n\nasync onCalendarSelected(\n link: ActivityLink,\n provider: string,\n calendarId: string,\n calendarName: string,\n authToken: string\n): Promise<void> {\n // Start sync for selected calendar\n await this.tools.tool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n provider,\n calendarId\n );\n}\n```\n\n## Batch Processing Pattern\n\n**Important**: Because Twists run in an ephemeral environment with limited execution time, you must break long operations into batches. Each batch runs independently in a new execution context.\n\n### Key Principles\n\n1. **Store state between batches**: Use the Store tool to persist progress\n2. **Queue next batch**: Use the Run tool to schedule the next chunk\n3. **Clean up when done**: Delete stored state after completion\n4. **Handle failures**: Store enough state to resume if a batch fails\n\n### Example Implementation\n\n```typescript\nasync startSync(resourceId: string): Promise<void> {\n // Initialize state in Store (persists between executions)\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: null,\n batchNumber: 1,\n itemsProcessed: 0,\n });\n\n // Queue first batch using runTask method\n const callback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(callback);\n}\n\nasync syncBatch(args: any, resourceId: string): Promise<void> {\n // Load state from Store (set by previous execution)\n const state = await this.get(`sync_state_${resourceId}`);\n\n // Process one batch (keep under time limit)\n const result = await this.fetchBatch(state.nextPageToken);\n\n // Process results\n for (const item of result.items) {\n await this.tools.plot.createActivity(item);\n }\n\n if (result.nextPageToken) {\n // Update state in Store for next batch\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: result.nextPageToken,\n batchNumber: state.batchNumber + 1,\n itemsProcessed: state.itemsProcessed + result.items.length,\n });\n\n // Queue next batch (runs in new execution context)\n const nextCallback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(nextCallback);\n } else {\n // Cleanup when complete\n await this.clear(`sync_state_${resourceId}`);\n\n // Optionally notify user of completion\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n note: `Sync complete: ${state.itemsProcessed + result.items.length} items processed`,\n });\n }\n}\n```\n\n## Error Handling\n\nAlways handle errors gracefully and communicate them to users:\n\n```typescript\ntry {\n await this.externalOperation();\n} catch (error) {\n console.error(\"Operation failed:\", error);\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n note: `Failed to complete operation: ${error.message}`,\n });\n}\n```\n\n## Common Pitfalls\n\n- **Don't use instance variables for state** - Anything stored in memory is lost after function execution. Always use the Store tool for data that needs to persist.\n- **Processing self-created activities** - Other users may change an Activity created by the twist, resulting in an \\`activity\\` call. Be sure to check the \\`changes === null\\` and/or \\`activity.author.id !== this.id\\` to avoid re-processing.\n- Most activity should be `type = ActivityType.Note` with a `title` and `note`, and no `start` or `end`. This represents a typical message. `start` and `end` should only be used for a note if it should be displayed for a specific date or time, such as a birthday.\n- Tools are declared in the `build` method and accessed via `this.tools.toolName` in twist methods.\n- **Don't forget runtime limits** - Each execution has ~10 seconds. Break long operations into batches with the Tasks tool. Process enough items per batch to be efficient, but few enough to stay under time limits.\n- **Always use Callbacks tool for persistent references** - Direct function references don't survive worker restarts.\n- **Store auth tokens** - Don't re-request authentication unnecessarily.\n- **Clean up callbacks and stored state** - Delete callbacks and Store entries when no longer needed.\n- **Handle missing auth gracefully** - Check for stored auth before operations.\n\n## Testing\n\nBefore deploying, verify:\n\n1. Linting passes: `{{packageManager}} lint`\n2. All dependencies are in package.json\n3. Authentication flow works end-to-end\n4. Batch operations handle pagination correctly\n5. Error cases are handled gracefully\n";
|
|
1
|
+
export declare const TWIST_GUIDE = "# Twist Implementation Guide for LLMs\n\nThis document provides context for AI assistants generating or modifying twists.\n\n## Architecture Overview\n\nPlot Twists are TypeScript classes that extend the `Twist` base class. Twists interact with external services and Plot's core functionality through a tool-based architecture.\n\n### Runtime Environment\n\n**Critical**: All Twists and tool functions are executed in a sandboxed, ephemeral environment with limited resources:\n\n- **Memory is temporary**: Anything stored in memory (e.g. as a variable in the twist/tool object) is lost after the function completes. Use the Store tool instead. Only use memory for temporary caching.\n- **Limited CPU time**: Each execution has limited CPU time (typically 10 seconds) and memory (128MB)\n- **Use the Run tool**: Queue separate chunks of work with `run.now(functionName, context)`\n- **Break long operations**: Split large operations into smaller batches that can be processed independently\n- **Store intermediate state**: Use the Store tool to persist state between batches\n- **Examples**: Syncing large datasets, processing many API calls, or performing batch operations\n\n## Understanding Activities and Notes\n\n**CRITICAL CONCEPT**: An **Activity** represents something done or to be done (a task, event, or conversation), while **Notes** represent the updates and details on that activity.\n\n**Think of an Activity as a thread** on a messaging platform, and **Notes as the messages in that thread**.\n\n### Key Guidelines\n\n1. **Always create Activities with an initial Note** - The title is just a summary; detailed content goes in Notes\n2. **Add Notes to existing Activities for updates** - Don't create a new Activity for each related message\n3. **Use `source` field for deduplication** - Enables safe, idempotent sync from external systems\n4. **Most Activities should be `ActivityType.Note`** - Use `Action` only for tasks with `doneAt`, use `Event` only for items with `start`/`end`\n\n### Decision Tree\n\n```\nNew event/task/conversation?\n \u251C\u2500 Yes \u2192 Create new Activity with initial Note\n \u2502 Include `source` field for deduplication\n \u2502\n \u2514\u2500 No (update/reply/comment) \u2192 Check for existing Activity\n \u251C\u2500 Found \u2192 Add Note to existing Activity\n \u2514\u2500 Not found \u2192 Create new Activity with initial Note\n```\n\n## Twist Structure Pattern\n\n```typescript\nimport {\n type Activity,\n type Priority,\n type ToolBuilder,\n twist,\n} from \"@plotday/twister\";\nimport { Plot } from \"@plotday/twister/tools/plot\";\n\nexport default class MyTwist extends Twist<MyTwist> {\n build(build: ToolBuilder) {\n return {\n plot: build(Plot),\n };\n }\n\n async activate(priority: Pick<Priority, \"id\">) {\n // Called when twist is enabled for a priority\n // Common actions: request auth, create setup activities\n }\n\n async activity(activity: Activity) {\n // Called when an activity is routed to this twist\n // Common actions: process external events, update activities\n }\n}\n```\n\n## Tool System\n\n### Accessing Tools\n\nAll tools are declared in the `build` method:\n\n```typescript\nbuild(build: ToolBuilder) {\n return {\n toolName: build(ToolClass),\n };\n}\n```\n\nAll `build()` calls must occur in the `build` method as they are used for dependency analysis.\n\nIMPORTANT: HTTP access is restricted to URLs requested via `build(Network, { urls: [url1, url2, ...] })` in the `build` method. Wildcards are supported. Use `build(Network, { urls: ['*'] })` if full access is needed.\n\n### Built-in Tools (Always Available)\n\nFor complete API documentation of built-in tools including all methods, types, and detailed examples, see the TypeScript definitions in your installed package at `node_modules/@plotday/twister/src/tools/*.ts`. Each tool file contains comprehensive JSDoc documentation.\n\n**Quick reference - Available tools:**\n\n- `@plotday/twister/tools/plot` - Core data layer (create/update activities, priorities, contacts)\n- `@plotday/twister/tools/ai` - LLM integration (text generation, structured output, reasoning)\n - Use ModelPreferences to specify `speed` (fast/balanced/capable) and `cost` (low/medium/high)\n- `@plotday/twister/tools/store` - Persistent key-value storage (also via `this.set()`, `this.get()`)\n- `@plotday/twister/tools/tasks` - Queue batched work (also via `this.run()`)\n- `@plotday/twister/tools/callbacks` - Persistent function references (also via `this.callback()`)\n- `@plotday/twister/tools/integrations` - OAuth2 authentication flows\n- `@plotday/twister/tools/network` - HTTP access permissions and webhook management\n- `@plotday/twister/tools/twists` - Manage other Twists\n\n**Critical**: Never use instance variables for state. They are lost after function execution. Always use Store methods.\n\n### External Tools (Add to package.json)\n\nAdd tool dependencies to `package.json`:\n\n```json\n{\n \"dependencies\": {\n \"@plotday/twister\": \"workspace:^\",\n \"@plotday/tool-google-calendar\": \"workspace:^\"\n }\n}\n```\n\n#### Common External Tools\n\n- `@plotday/tool-google-calendar`: Google Calendar integration\n- `@plotday/tool-outlook-calendar`: Outlook Calendar integration\n- `@plotday/tool-google-contacts`: Google Contacts integration\n\n## Lifecycle Methods\n\n### activate(priority: Pick<Priority, \"id\">)\n\nCalled when the twist is enabled for a priority. Common patterns:\n\n**Request Authentication:**\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n const authLink = await this.tools.externalTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Connect your account\",\n notes: [\n {\n content: \"Click the link below to connect your account and start syncing.\",\n links: [authLink],\n },\n ],\n });\n}\n```\n\n**Store Parent Activity for Later:**\n\n```typescript\nconst activity = await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Setup\",\n notes: [\n {\n content: \"Your twist is being set up. Configuration steps will appear here.\",\n },\n ],\n});\n\nawait this.set(\"setup_activity_id\", activity.id);\n```\n\n### activity(activity: Activity)\n\nCalled when an activity is routed to the twist. Common patterns:\n\n**Create Activities from External Events:**\n\n```typescript\nasync activity(activity: Activity) {\n await this.tools.plot.createActivity(activity);\n}\n```\n\n**Update Based on User Action:**\n\n```typescript\nasync activity(activity: Activity) {\n if (activity.completed) {\n await this.handleCompletion(activity);\n }\n}\n```\n\n## Activity Links\n\nActivity links enable user interaction:\n\n```typescript\nimport { type ActivityLink, ActivityLinkType } from \"@plotday/twister\";\n\n// URL link\nconst urlLink: ActivityLink = {\n title: \"Open website\",\n type: ActivityLinkType.url,\n url: \"https://example.com\",\n};\n\n// Callback link (uses Callbacks tool)\nconst token = await this.callback(this.onLinkClicked, \"context\");\nconst callbackLink: ActivityLink = {\n title: \"Click me\",\n type: ActivityLinkType.callback,\n token: token,\n};\n\n// Add to activity note\nawait this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Task with links\",\n notes: [\n {\n content: \"Click the links below to take action.\",\n links: [urlLink, callbackLink],\n },\n ],\n});\n```\n\n## Authentication Pattern\n\nCommon pattern for OAuth authentication:\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n // Request auth link from tool with callback\n const authLink = await this.tools.googleTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n // Create activity with auth link\n const activity = await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Connect Google account\",\n notes: [\n {\n content: \"Click below to connect your Google account and start syncing.\",\n links: [authLink],\n },\n ],\n });\n\n // Store for later use\n await this.set(\"auth_activity_id\", activity.id);\n}\n\nasync onAuthComplete(authResult: { authToken: string }, provider: string) {\n // Store auth token\n await this.set(`${provider}_auth`, authResult.authToken);\n\n // Continue setup flow\n await this.setupSyncOptions(authResult.authToken);\n}\n```\n\n## Sync Pattern\n\nPattern for syncing external data - demonstrates adding Notes to existing Activities:\n\n```typescript\nasync startSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n\n await this.tools.calendarTool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n calendarId\n );\n}\n\nasync handleEvent(\n incomingActivity: NewActivityWithNotes,\n calendarId: string\n): Promise<void> {\n // Check if this activity already exists (using source for deduplication)\n if (incomingActivity.source) {\n const existing = await this.tools.plot.getActivityBySource(\n incomingActivity.source\n );\n\n if (existing) {\n // Add update as a Note to existing Activity (add message to thread)\n if (incomingActivity.notes?.[0]?.content) {\n await this.tools.plot.createNote({\n activity: { id: existing.id },\n content: incomingActivity.notes[0].content,\n });\n }\n return;\n }\n }\n\n // Create new Activity with initial Note (new thread with first message)\n await this.tools.plot.createActivity(incomingActivity);\n}\n\nasync stopSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n await this.tools.calendarTool.stopSync(authToken, calendarId);\n}\n```\n\n## Calendar Selection Pattern\n\nPattern for letting users select from multiple calendars/accounts:\n\n```typescript\nprivate async createCalendarSelectionActivity(\n provider: string,\n calendars: Calendar[],\n authToken: string\n): Promise<void> {\n const links: ActivityLink[] = [];\n\n for (const calendar of calendars) {\n const token = await this.callback(\n this.onCalendarSelected,\n provider,\n calendar.id,\n calendar.name,\n authToken\n );\n\n links.push({\n title: `\uD83D\uDCC5 ${calendar.name}${calendar.primary ? \" (Primary)\" : \"\"}`,\n type: ActivityLinkType.callback,\n token: token,\n });\n }\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Which calendars would you like to connect?\",\n notes: [\n {\n content: \"Select the calendars you want to sync:\",\n links,\n },\n ],\n });\n}\n\nasync onCalendarSelected(\n link: ActivityLink,\n provider: string,\n calendarId: string,\n calendarName: string,\n authToken: string\n): Promise<void> {\n // Start sync for selected calendar\n await this.tools.tool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n provider,\n calendarId\n );\n}\n```\n\n## Batch Processing Pattern\n\n**Important**: Because Twists run in an ephemeral environment with limited execution time, you must break long operations into batches. Each batch runs independently in a new execution context.\n\n### Key Principles\n\n1. **Store state between batches**: Use the Store tool to persist progress\n2. **Queue next batch**: Use the Run tool to schedule the next chunk\n3. **Clean up when done**: Delete stored state after completion\n4. **Handle failures**: Store enough state to resume if a batch fails\n\n### Example Implementation\n\n```typescript\nasync startSync(resourceId: string): Promise<void> {\n // Initialize state in Store (persists between executions)\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: null,\n batchNumber: 1,\n itemsProcessed: 0,\n });\n\n // Queue first batch using runTask method\n const callback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(callback);\n}\n\nasync syncBatch(args: any, resourceId: string): Promise<void> {\n // Load state from Store (set by previous execution)\n const state = await this.get(`sync_state_${resourceId}`);\n\n // Process one batch (keep under time limit)\n const result = await this.fetchBatch(state.nextPageToken);\n\n // Process results (create activities with Notes)\n for (const item of result.items) {\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: item.title,\n source: `external:${item.id}`, // For deduplication\n notes: [{ content: item.description }],\n });\n }\n\n if (result.nextPageToken) {\n // Update state in Store for next batch\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: result.nextPageToken,\n batchNumber: state.batchNumber + 1,\n itemsProcessed: state.itemsProcessed + result.items.length,\n });\n\n // Queue next batch (runs in new execution context)\n const nextCallback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(nextCallback);\n } else {\n // Cleanup when complete\n await this.clear(`sync_state_${resourceId}`);\n\n // Optionally notify user of completion\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Sync complete\",\n notes: [\n {\n content: `Successfully processed ${state.itemsProcessed + result.items.length} items.`,\n },\n ],\n });\n }\n}\n```\n\n## Error Handling\n\nAlways handle errors gracefully and communicate them to users:\n\n```typescript\ntry {\n await this.externalOperation();\n} catch (error) {\n console.error(\"Operation failed:\", error);\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Operation failed\",\n notes: [\n {\n content: `Failed to complete operation: ${error.message}`,\n },\n ],\n });\n}\n```\n\n## Common Pitfalls\n\n- **Don't use instance variables for state** - Anything stored in memory is lost after function execution. Always use the Store tool for data that needs to persist.\n- **Processing self-created activities** - Other users may change an Activity created by the twist, resulting in an \\`activity\\` call. Be sure to check the \\`changes === null\\` and/or \\`activity.author.id !== this.id\\` to avoid re-processing.\n- **Always create Activities with Notes** - See \"Understanding Activities and Notes\" section above for the thread/message pattern and decision tree.\n- **Use correct Activity types** - Most should be `ActivityType.Note`. Only use `Action` for tasks with `doneAt`, and `Event` for items with `start`/`end`.\n- **Use `source` field for deduplication** - Always include `source` when syncing external data to enable safe, idempotent operations.\n- **Add Notes to existing Activities** - Check for existing Activities with `getActivityBySource()` before creating new ones. Think thread replies, not new threads.\n- Tools are declared in the `build` method and accessed via `this.tools.toolName` in twist methods.\n- **Don't forget runtime limits** - Each execution has ~10 seconds. Break long operations into batches with the Tasks tool. Process enough items per batch to be efficient, but few enough to stay under time limits.\n- **Always use Callbacks tool for persistent references** - Direct function references don't survive worker restarts.\n- **Store auth tokens** - Don't re-request authentication unnecessarily.\n- **Clean up callbacks and stored state** - Delete callbacks and Store entries when no longer needed.\n- **Handle missing auth gracefully** - Check for stored auth before operations.\n\n## Testing\n\nBefore deploying, verify:\n\n1. Linting passes: `{{packageManager}} lint`\n2. All dependencies are in package.json\n3. Authentication flow works end-to-end\n4. Batch operations handle pagination correctly\n5. Error cases are handled gracefully\n";
|
|
2
2
|
//# sourceMappingURL=twist-guide.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twist-guide.d.ts","sourceRoot":"","sources":["../src/twist-guide.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"twist-guide.d.ts","sourceRoot":"","sources":["../src/twist-guide.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW,mvfAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/utils/hash.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,UAOpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/utils/hash.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,IAAI,IAAI,GAAG,UAAU,CAAC;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACpC,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,GAAG,CAAC,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC"}
|