@plotday/twister 0.28.0 → 0.30.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.
Files changed (174) hide show
  1. package/bin/commands/deploy.js +1 -1
  2. package/bin/commands/deploy.js.map +1 -1
  3. package/dist/common/calendar.d.ts +24 -15
  4. package/dist/common/calendar.d.ts.map +1 -1
  5. package/dist/common/messaging.d.ts +17 -13
  6. package/dist/common/messaging.d.ts.map +1 -1
  7. package/dist/common/projects.d.ts +23 -18
  8. package/dist/common/projects.d.ts.map +1 -1
  9. package/dist/docs/assets/hierarchy.js +1 -1
  10. package/dist/docs/assets/navigation.js +1 -1
  11. package/dist/docs/assets/search.js +1 -1
  12. package/dist/docs/classes/tool.ITool.html +1 -1
  13. package/dist/docs/classes/tool.Tool.html +34 -35
  14. package/dist/docs/classes/tools_ai.AI.html +1 -1
  15. package/dist/docs/classes/tools_callbacks.Callbacks.html +21 -12
  16. package/dist/docs/classes/tools_integrations.Integrations.html +6 -6
  17. package/dist/docs/classes/tools_network.Network.html +12 -12
  18. package/dist/docs/classes/tools_plot.Plot.html +40 -30
  19. package/dist/docs/classes/tools_store.Store.html +29 -18
  20. package/dist/docs/classes/tools_tasks.Tasks.html +5 -5
  21. package/dist/docs/classes/tools_twists.Twists.html +1 -1
  22. package/dist/docs/classes/twist.Twist.html +39 -27
  23. package/dist/docs/enums/plot.ActivityLinkType.html +5 -5
  24. package/dist/docs/enums/plot.ActivityType.html +4 -4
  25. package/dist/docs/enums/plot.ActorType.html +4 -4
  26. package/dist/docs/enums/plot.ConferencingProvider.html +6 -6
  27. package/dist/docs/enums/tools_integrations.AuthLevel.html +3 -3
  28. package/dist/docs/enums/tools_integrations.AuthProvider.html +11 -11
  29. package/dist/docs/enums/tools_plot.ActivityAccess.html +3 -3
  30. package/dist/docs/enums/tools_plot.ContactAccess.html +3 -3
  31. package/dist/docs/enums/tools_plot.PriorityAccess.html +3 -3
  32. package/dist/docs/hierarchy.html +1 -1
  33. package/dist/docs/interfaces/tools_ai.AIResponse.html +2 -2
  34. package/dist/docs/interfaces/tools_ai.FilePart.html +2 -2
  35. package/dist/docs/interfaces/tools_ai.ImagePart.html +2 -2
  36. package/dist/docs/interfaces/utils_types.ToolShed.html +5 -5
  37. package/dist/docs/modules/common_calendar.html +1 -1
  38. package/dist/docs/modules/index.html +1 -1
  39. package/dist/docs/modules/plot.html +1 -1
  40. package/dist/docs/modules/tools_callbacks.html +1 -1
  41. package/dist/docs/modules/utils_types.html +1 -1
  42. package/dist/docs/{interfaces → types}/common_calendar.Calendar.html +2 -2
  43. package/dist/docs/types/common_calendar.CalendarTool.html +71 -0
  44. package/dist/docs/{interfaces → types}/common_calendar.SyncOptions.html +2 -2
  45. package/dist/docs/types/index.Serializable.html +17 -0
  46. package/dist/docs/types/plot.Activity.html +1 -1
  47. package/dist/docs/types/plot.ActivityCommon.html +8 -10
  48. package/dist/docs/types/plot.ActivityLink.html +1 -1
  49. package/dist/docs/types/plot.ActivityMeta.html +5 -3
  50. package/dist/docs/types/plot.ActivityUpdate.html +2 -2
  51. package/dist/docs/types/plot.ActivityWithNotes.html +1 -1
  52. package/dist/docs/types/plot.Actor.html +15 -5
  53. package/dist/docs/types/plot.ActorId.html +1 -1
  54. package/dist/docs/types/plot.ContentType.html +1 -1
  55. package/dist/docs/types/plot.NewActivity.html +1 -1
  56. package/dist/docs/types/plot.NewActivityWithNotes.html +1 -1
  57. package/dist/docs/types/plot.NewActor.html +1 -1
  58. package/dist/docs/types/plot.NewContact.html +4 -4
  59. package/dist/docs/types/plot.NewNote.html +1 -1
  60. package/dist/docs/types/plot.NewPriority.html +15 -5
  61. package/dist/docs/types/plot.NewTags.html +1 -1
  62. package/dist/docs/types/plot.Note.html +1 -1
  63. package/dist/docs/types/plot.NoteUpdate.html +2 -2
  64. package/dist/docs/types/plot.PickPriorityConfig.html +3 -3
  65. package/dist/docs/types/plot.Priority.html +9 -4
  66. package/dist/docs/types/plot.PriorityUpdate.html +3 -0
  67. package/dist/docs/types/plot.SyncUpdate.html +1 -1
  68. package/dist/docs/types/plot.Tags.html +1 -1
  69. package/dist/docs/types/tools_callbacks.Callback.html +3 -2
  70. package/dist/docs/types/tools_integrations.AuthToken.html +4 -4
  71. package/dist/docs/types/tools_integrations.Authorization.html +4 -4
  72. package/dist/docs/types/tools_network.WebhookRequest.html +6 -6
  73. package/dist/docs/types/tools_plot.NoteIntentHandler.html +4 -4
  74. package/dist/docs/types/utils_types.BuiltInTools.html +2 -2
  75. package/dist/docs/types/utils_types.ExtractBuildReturn.html +1 -1
  76. package/dist/docs/types/utils_types.InferOptions.html +1 -1
  77. package/dist/docs/types/utils_types.InferTools.html +1 -1
  78. package/dist/docs/types/utils_types.JSONValue.html +7 -0
  79. package/dist/docs/types/utils_types.PromiseValues.html +1 -1
  80. package/dist/docs/types/utils_types.ToolBuilder.html +1 -1
  81. package/dist/index.d.ts +1 -0
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +1 -0
  84. package/dist/index.js.map +1 -1
  85. package/dist/llm-docs/common/calendar.d.ts +1 -1
  86. package/dist/llm-docs/common/calendar.d.ts.map +1 -1
  87. package/dist/llm-docs/common/calendar.js +1 -1
  88. package/dist/llm-docs/common/calendar.js.map +1 -1
  89. package/dist/llm-docs/common/messaging.d.ts +1 -1
  90. package/dist/llm-docs/common/messaging.d.ts.map +1 -1
  91. package/dist/llm-docs/common/messaging.js +1 -1
  92. package/dist/llm-docs/common/messaging.js.map +1 -1
  93. package/dist/llm-docs/common/projects.d.ts +1 -1
  94. package/dist/llm-docs/common/projects.d.ts.map +1 -1
  95. package/dist/llm-docs/common/projects.js +1 -1
  96. package/dist/llm-docs/common/projects.js.map +1 -1
  97. package/dist/llm-docs/plot.d.ts +1 -1
  98. package/dist/llm-docs/plot.d.ts.map +1 -1
  99. package/dist/llm-docs/plot.js +1 -1
  100. package/dist/llm-docs/plot.js.map +1 -1
  101. package/dist/llm-docs/tool.d.ts +1 -1
  102. package/dist/llm-docs/tool.d.ts.map +1 -1
  103. package/dist/llm-docs/tool.js +1 -1
  104. package/dist/llm-docs/tool.js.map +1 -1
  105. package/dist/llm-docs/tools/callbacks.d.ts +1 -1
  106. package/dist/llm-docs/tools/callbacks.d.ts.map +1 -1
  107. package/dist/llm-docs/tools/callbacks.js +1 -1
  108. package/dist/llm-docs/tools/callbacks.js.map +1 -1
  109. package/dist/llm-docs/tools/integrations.d.ts +1 -1
  110. package/dist/llm-docs/tools/integrations.d.ts.map +1 -1
  111. package/dist/llm-docs/tools/integrations.js +1 -1
  112. package/dist/llm-docs/tools/integrations.js.map +1 -1
  113. package/dist/llm-docs/tools/network.d.ts +1 -1
  114. package/dist/llm-docs/tools/network.d.ts.map +1 -1
  115. package/dist/llm-docs/tools/network.js +1 -1
  116. package/dist/llm-docs/tools/network.js.map +1 -1
  117. package/dist/llm-docs/tools/plot.d.ts +1 -1
  118. package/dist/llm-docs/tools/plot.d.ts.map +1 -1
  119. package/dist/llm-docs/tools/plot.js +1 -1
  120. package/dist/llm-docs/tools/plot.js.map +1 -1
  121. package/dist/llm-docs/tools/store.d.ts +1 -1
  122. package/dist/llm-docs/tools/store.d.ts.map +1 -1
  123. package/dist/llm-docs/tools/store.js +1 -1
  124. package/dist/llm-docs/tools/store.js.map +1 -1
  125. package/dist/llm-docs/tools/tasks.d.ts +1 -1
  126. package/dist/llm-docs/tools/tasks.d.ts.map +1 -1
  127. package/dist/llm-docs/tools/tasks.js +1 -1
  128. package/dist/llm-docs/tools/tasks.js.map +1 -1
  129. package/dist/llm-docs/twist.d.ts +1 -1
  130. package/dist/llm-docs/twist.d.ts.map +1 -1
  131. package/dist/llm-docs/twist.js +1 -1
  132. package/dist/llm-docs/twist.js.map +1 -1
  133. package/dist/plot.d.ts +125 -16
  134. package/dist/plot.d.ts.map +1 -1
  135. package/dist/plot.js.map +1 -1
  136. package/dist/tool.d.ts +28 -20
  137. package/dist/tool.d.ts.map +1 -1
  138. package/dist/tool.js +25 -17
  139. package/dist/tool.js.map +1 -1
  140. package/dist/tools/callbacks.d.ts +10 -8
  141. package/dist/tools/callbacks.d.ts.map +1 -1
  142. package/dist/tools/callbacks.js.map +1 -1
  143. package/dist/tools/integrations.d.ts +3 -4
  144. package/dist/tools/integrations.d.ts.map +1 -1
  145. package/dist/tools/integrations.js.map +1 -1
  146. package/dist/tools/network.d.ts +20 -17
  147. package/dist/tools/network.d.ts.map +1 -1
  148. package/dist/tools/network.js +6 -4
  149. package/dist/tools/network.js.map +1 -1
  150. package/dist/tools/plot.d.ts +91 -24
  151. package/dist/tools/plot.d.ts.map +1 -1
  152. package/dist/tools/plot.js +45 -0
  153. package/dist/tools/plot.js.map +1 -1
  154. package/dist/tools/store.d.ts +43 -18
  155. package/dist/tools/store.d.ts.map +1 -1
  156. package/dist/tools/store.js +12 -1
  157. package/dist/tools/store.js.map +1 -1
  158. package/dist/tools/tasks.d.ts +4 -4
  159. package/dist/tools/tasks.js +4 -4
  160. package/dist/twist.d.ts +45 -12
  161. package/dist/twist.d.ts.map +1 -1
  162. package/dist/twist.js +40 -6
  163. package/dist/twist.js.map +1 -1
  164. package/dist/utils/serializable.d.ts +40 -0
  165. package/dist/utils/serializable.d.ts.map +1 -0
  166. package/dist/utils/serializable.js +2 -0
  167. package/dist/utils/serializable.js.map +1 -0
  168. package/dist/utils/types.d.ts +18 -16
  169. package/dist/utils/types.d.ts.map +1 -1
  170. package/package.json +1 -1
  171. package/dist/docs/interfaces/common_calendar.CalendarTool.html +0 -65
  172. package/dist/docs/types/utils_types.CallbackMethods.html +0 -3
  173. package/dist/docs/types/utils_types.NoFunctions.html +0 -3
  174. package/dist/docs/types/utils_types.NonFunction.html +0 -2
@@ -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,MAA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CAAC,MAAM,CAAC;IAElB;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CACnD"}
@@ -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
- * callback: this.onCalendarEvent,
57
- * extraArgs: [calendarId, "google"]
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;AAiC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH,MAAM,OAAgB,OAAQ,SAAQ,KAAK;IACzC,MAAM,CAAU,OAAO,CAMrB;CAwEH"}
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;CA6EH"}
@@ -1,4 +1,4 @@
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 "..";
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.
@@ -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
  /**
@@ -90,8 +136,6 @@ export declare abstract class Plot extends ITool {
90
136
  * @param changes - Changes to the activity and the previous version
91
137
  */
92
138
  updated?: (activity: Activity, changes: {
93
- update: ActivityUpdate;
94
- previous: Activity;
95
139
  tagsAdded: Record<Tag, ActorId[]>;
96
140
  tagsRemoved: Record<Tag, ActorId[]>;
97
141
  }) => Promise<void>;
@@ -308,35 +352,35 @@ export declare abstract class Plot extends ITool {
308
352
  */
309
353
  abstract updateNote(note: NoteUpdate): Promise<void>;
310
354
  /**
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.
355
+ * Retrieves an activity by ID or source.
315
356
  *
316
- * By default, archived activities are excluded from the search. Set includeArchived
317
- * to true to include them in the results.
357
+ * This method enables lookup of activities either by their unique ID or by their
358
+ * source identifier (canonical URL from an external system). Archived activities
359
+ * are included in the results.
318
360
  *
319
- * @param source - The meta.source value to search for
320
- * @param includeArchived - Whether to include archived activities in search (default: false)
361
+ * @param activity - Activity lookup by ID or source
321
362
  * @returns Promise resolving to the matching activity or null if not found
322
363
  */
323
- abstract getActivityBySource(source: string, includeArchived?: boolean): Promise<Activity | null>;
364
+ abstract getActivity(activity: {
365
+ id: Uuid;
366
+ } | {
367
+ source: string;
368
+ }): Promise<Activity | null>;
324
369
  /**
325
- * Finds an activity by its metadata.
370
+ * Retrieves a note by ID or key.
326
371
  *
327
- * This method enables lookup of activities that were created from external
328
- * systems, using the metadata to locate the corresponding Plot activity.
329
- * Uses JSON containment matching - the provided meta must be contained
330
- * within the activity's meta field.
372
+ * This method enables lookup of notes either by their unique ID or by their
373
+ * key (unique identifier within the activity). Archived notes are included
374
+ * in the results.
331
375
  *
332
- * By default, archived activities are excluded from the search. Set includeArchived
333
- * to true to include them in the results.
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
376
+ * @param note - Note lookup by ID or key
377
+ * @returns Promise resolving to the matching note or null if not found
338
378
  */
339
- abstract getActivityByMeta(meta: ActivityMeta, includeArchived?: boolean): Promise<Activity | null>;
379
+ abstract getNote(note: {
380
+ id: Uuid;
381
+ } | {
382
+ key: string;
383
+ }): Promise<Note | null>;
340
384
  /**
341
385
  * Creates a new priority in the Plot system.
342
386
  *
@@ -347,6 +391,29 @@ export declare abstract class Plot extends ITool {
347
391
  * @returns Promise resolving to the complete created priority
348
392
  */
349
393
  abstract createPriority(priority: NewPriority): Promise<Priority>;
394
+ /**
395
+ * Retrieves a priority by ID or key.
396
+ *
397
+ * Archived priorities are included in the results.
398
+ *
399
+ * @param priority - Priority lookup by ID or key
400
+ * @returns Promise resolving to the matching priority or null if not found
401
+ */
402
+ abstract getPriority(priority: {
403
+ id: Uuid;
404
+ } | {
405
+ key: string;
406
+ }): Promise<Priority | null>;
407
+ /**
408
+ * Updates an existing priority in the Plot system.
409
+ *
410
+ * The priority is identified by either its ID or key.
411
+ * Only the fields specified in the update will be changed.
412
+ *
413
+ * @param update - Priority update containing ID/key and fields to change
414
+ * @returns Promise that resolves when the update is complete
415
+ */
416
+ abstract updatePriority(update: PriorityUpdate): Promise<void>;
350
417
  /**
351
418
  * Adds contacts to the Plot system.
352
419
  *
@@ -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,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,UAAU,EACf,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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AG,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"}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,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;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,OAAgB,IAAK,SAAQ,KAAK;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,MAAM,CAAU,OAAO,CA6DrB;CAyRH"}
@@ -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 any JSON-serializable data
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,39 +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
- * @template T - The expected type of the stored value
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 JSON-serialized and stored persistently.
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
- * **Handling undefined values:**
65
- * - Object keys with undefined values are automatically removed
66
- * - Arrays with undefined elements will throw a validation error
67
- * - Use null instead of undefined for array elements
78
+ * SuperJSON automatically handles Date objects, Maps, Sets, undefined values,
79
+ * and other complex types that standard JSON doesn't support.
68
80
  *
69
- * @template T - The type of value being stored
81
+ * @template T - The type of value being stored (must be Serializable)
70
82
  * @param key - The storage key to use
71
- * @param value - The value to store (must be JSON-serializable)
83
+ * @param value - The value to store (must be SuperJSON-serializable)
72
84
  * @returns Promise that resolves when the value is stored
73
85
  *
74
86
  * @example
75
87
  * ```typescript
76
- * // Object keys with undefined are removed
77
- * await this.set('data', { name: 'test', optional: undefined });
78
- * // Stores: { name: 'test' }
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
79
104
  *
80
- * // Arrays with undefined throw errors - use null instead
81
- * await this.set('items', [1, null, 3]); // ✅ Works
82
- * await this.set('items', [1, undefined, 3]); // Throws error
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
83
108
  * ```
84
109
  */
85
- abstract set<T>(key: string, value: T): Promise<void>;
110
+ abstract set<T extends Serializable>(key: string, value: T): Promise<void>;
86
111
  /**
87
112
  * Removes a specific key from storage.
88
113
  *
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/t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AEH,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1C;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CACnC"}
@@ -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 any JSON-serializable data
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
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/tools/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,OAAgB,KAAM,SAAQ,KAAK;CAiExC"}
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"}
@@ -3,12 +3,12 @@ import type { Callback } from "./callbacks";
3
3
  /**
4
4
  * Run background tasks and scheduled jobs.
5
5
  *
6
- * The Run tool enables twists and tools to queue callbacks. This is especially
7
- * iportant for long-running operations and batch processing, since twists
8
- * operate within runtime limits. Run callbacks also benefit from automatic
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:** Run methods are also available directly on Twist and Tool classes
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
  *
@@ -2,12 +2,12 @@ import { ITool } from "..";
2
2
  /**
3
3
  * Run background tasks and scheduled jobs.
4
4
  *
5
- * The Run tool enables twists and tools to queue callbacks. This is especially
6
- * iportant for long-running operations and batch processing, since twists
7
- * operate within runtime limits. Run callbacks also benefit from automatic
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:** Run methods are also available directly on Twist and Tool classes
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
  *
package/dist/twist.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { type Priority } from "./plot";
1
+ import { ActivityLink, type Priority, Uuid } from "./plot";
2
2
  import { type ITool } from "./tool";
3
3
  import type { Callback } from "./tools/callbacks";
4
+ import type { Serializable } from "./utils/serializable";
4
5
  import type { InferTools, ToolBuilder, ToolShed } from "./utils/types";
5
6
  /**
6
7
  * Base class for all twists.
@@ -30,9 +31,9 @@ import type { InferTools, ToolBuilder, ToolShed } from "./utils/types";
30
31
  * ```
31
32
  */
32
33
  export declare abstract class Twist<TSelf> {
33
- protected id: string;
34
+ protected id: Uuid;
34
35
  private toolShed;
35
- constructor(id: string, toolShed: ToolShed);
36
+ constructor(id: Uuid, toolShed: ToolShed);
36
37
  /**
37
38
  * Gets the initialized tools for this twist.
38
39
  * @throws Error if called before initialization is complete
@@ -59,7 +60,7 @@ export declare abstract class Twist<TSelf> {
59
60
  /**
60
61
  * Creates a persistent callback to a method on this twist.
61
62
  *
62
- * ExtraArgs are strongly typed to match the method's signature after the first argument.
63
+ * ExtraArgs are strongly typed to match the method's signature. They must be serializable.
63
64
  *
64
65
  * @param fn - The method to callback
65
66
  * @param extraArgs - Additional arguments to pass (type-checked, must be serializable)
@@ -70,7 +71,25 @@ export declare abstract class Twist<TSelf> {
70
71
  * const callback = await this.callback(this.onWebhook, "calendar", 123);
71
72
  * ```
72
73
  */
73
- protected callback(fn: Function, ...extraArgs: any[]): Promise<Callback>;
74
+ protected callback<TArgs extends Serializable[], Fn extends (...args: TArgs) => any>(fn: Fn, ...extraArgs: TArgs): Promise<Callback>;
75
+ /**
76
+ * Like callback(), but for an ActivityLink, which receives the link as the first argument.
77
+ *
78
+ * @param fn - The method to callback
79
+ * @param extraArgs - Additional arguments to pass after the link
80
+ * @returns Promise resolving to a persistent callback token
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * const callback = await this.linkCallback(this.doSomething, 123);
85
+ * const link: ActivityLink = {
86
+ * type: ActivityLinkType.Callback,
87
+ * title: "Do Something",
88
+ * callback,
89
+ * };
90
+ * ```
91
+ */
92
+ protected linkCallback<TArgs extends Serializable[], Fn extends (link: ActivityLink, ...extraArgs: TArgs) => any>(fn: Fn, ...extraArgs: TArgs): Promise<Callback>;
74
93
  /**
75
94
  * Deletes a specific callback by its token.
76
95
  *
@@ -95,21 +114,35 @@ export declare abstract class Twist<TSelf> {
95
114
  /**
96
115
  * Retrieves a value from persistent storage by key.
97
116
  *
98
- * @template T - The expected type of the stored value
117
+ * Values are automatically deserialized using SuperJSON, which
118
+ * properly restores Date objects, Maps, Sets, and other complex types.
119
+ *
120
+ * @template T - The expected type of the stored value (must be Serializable)
99
121
  * @param key - The storage key to retrieve
100
122
  * @returns Promise resolving to the stored value or null
101
123
  */
102
- protected get<T>(key: string): Promise<T | null>;
124
+ protected get<T extends import("./index").Serializable>(key: string): Promise<T | null>;
103
125
  /**
104
126
  * Stores a value in persistent storage.
105
127
  *
106
- * **Important**: Values must be JSON-serializable. Functions, Symbols, and undefined values
107
- * cannot be stored directly.
128
+ * The value will be serialized using SuperJSON and stored persistently.
129
+ * SuperJSON automatically handles Date objects, Maps, Sets, undefined values,
130
+ * and other complex types that standard JSON doesn't support.
108
131
  *
132
+ * **Important**: Functions and Symbols cannot be stored.
109
133
  * **For function references**: Use callbacks instead of storing functions directly.
110
134
  *
111
135
  * @example
112
136
  * ```typescript
137
+ * // ✅ Date objects are preserved
138
+ * await this.set("sync_state", {
139
+ * lastSync: new Date(),
140
+ * minDate: new Date(2024, 0, 1)
141
+ * });
142
+ *
143
+ * // ✅ undefined is now supported
144
+ * await this.set("data", { name: "test", optional: undefined });
145
+ *
113
146
  * // ❌ WRONG: Cannot store functions directly
114
147
  * await this.set("handler", this.myHandler);
115
148
  *
@@ -122,12 +155,12 @@ export declare abstract class Twist<TSelf> {
122
155
  * await this.run(token, args);
123
156
  * ```
124
157
  *
125
- * @template T - The type of value being stored
158
+ * @template T - The type of value being stored (must be Serializable)
126
159
  * @param key - The storage key to use
127
- * @param value - The value to store (must be JSON-serializable)
160
+ * @param value - The value to store (must be SuperJSON-serializable)
128
161
  * @returns Promise that resolves when the value is stored
129
162
  */
130
- protected set<T>(key: string, value: T): Promise<void>;
163
+ protected set<T extends import("./index").Serializable>(key: string, value: T): Promise<void>;
131
164
  /**
132
165
  * Removes a specific key from persistent storage.
133
166
  *
@@ -1 +1 @@
1
- {"version":3,"file":"twist.d.ts","sourceRoot":"","sources":["../src/twist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AACpC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,SAAS,EAAE,YAAY,EAC1D,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,CAAC,GACP,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;OAKG;cACa,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD;;;;OAIG;cACa,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzC;;;;;;;OAOG;cACa,OAAO,CACrB,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,IAAI,CAAA;KAAE,GACzB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIzB;;;;;OAKG;cACa,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD;;;;OAIG;cACa,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/C;;;;;;;;OAQG;IAEH,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD;;;;;;;;OAQG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB;;;;;;;OAOG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;;OAIG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC"}
package/dist/twist.js CHANGED
@@ -42,7 +42,7 @@ export class Twist {
42
42
  /**
43
43
  * Creates a persistent callback to a method on this twist.
44
44
  *
45
- * ExtraArgs are strongly typed to match the method's signature after the first argument.
45
+ * ExtraArgs are strongly typed to match the method's signature. They must be serializable.
46
46
  *
47
47
  * @param fn - The method to callback
48
48
  * @param extraArgs - Additional arguments to pass (type-checked, must be serializable)
@@ -56,6 +56,26 @@ export class Twist {
56
56
  async callback(fn, ...extraArgs) {
57
57
  return this.tools.callbacks.create(fn, ...extraArgs);
58
58
  }
59
+ /**
60
+ * Like callback(), but for an ActivityLink, which receives the link as the first argument.
61
+ *
62
+ * @param fn - The method to callback
63
+ * @param extraArgs - Additional arguments to pass after the link
64
+ * @returns Promise resolving to a persistent callback token
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const callback = await this.linkCallback(this.doSomething, 123);
69
+ * const link: ActivityLink = {
70
+ * type: ActivityLinkType.Callback,
71
+ * title: "Do Something",
72
+ * callback,
73
+ * };
74
+ * ```
75
+ */
76
+ async linkCallback(fn, ...extraArgs) {
77
+ return this.tools.callbacks.create(fn, ...extraArgs);
78
+ }
59
79
  /**
60
80
  * Deletes a specific callback by its token.
61
81
  *
@@ -86,7 +106,10 @@ export class Twist {
86
106
  /**
87
107
  * Retrieves a value from persistent storage by key.
88
108
  *
89
- * @template T - The expected type of the stored value
109
+ * Values are automatically deserialized using SuperJSON, which
110
+ * properly restores Date objects, Maps, Sets, and other complex types.
111
+ *
112
+ * @template T - The expected type of the stored value (must be Serializable)
90
113
  * @param key - The storage key to retrieve
91
114
  * @returns Promise resolving to the stored value or null
92
115
  */
@@ -96,13 +119,24 @@ export class Twist {
96
119
  /**
97
120
  * Stores a value in persistent storage.
98
121
  *
99
- * **Important**: Values must be JSON-serializable. Functions, Symbols, and undefined values
100
- * cannot be stored directly.
122
+ * The value will be serialized using SuperJSON and stored persistently.
123
+ * SuperJSON automatically handles Date objects, Maps, Sets, undefined values,
124
+ * and other complex types that standard JSON doesn't support.
101
125
  *
126
+ * **Important**: Functions and Symbols cannot be stored.
102
127
  * **For function references**: Use callbacks instead of storing functions directly.
103
128
  *
104
129
  * @example
105
130
  * ```typescript
131
+ * // ✅ Date objects are preserved
132
+ * await this.set("sync_state", {
133
+ * lastSync: new Date(),
134
+ * minDate: new Date(2024, 0, 1)
135
+ * });
136
+ *
137
+ * // ✅ undefined is now supported
138
+ * await this.set("data", { name: "test", optional: undefined });
139
+ *
106
140
  * // ❌ WRONG: Cannot store functions directly
107
141
  * await this.set("handler", this.myHandler);
108
142
  *
@@ -115,9 +149,9 @@ export class Twist {
115
149
  * await this.run(token, args);
116
150
  * ```
117
151
  *
118
- * @template T - The type of value being stored
152
+ * @template T - The type of value being stored (must be Serializable)
119
153
  * @param key - The storage key to use
120
- * @param value - The value to store (must be JSON-serializable)
154
+ * @param value - The value to store (must be SuperJSON-serializable)
121
155
  * @returns Promise that resolves when the value is stored
122
156
  */
123
157
  async set(key, value) {