@plotday/twister 0.36.0 → 0.38.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 (243) hide show
  1. package/README.md +4 -2
  2. package/bin/commands/create.js +37 -3
  3. package/bin/commands/create.js.map +1 -1
  4. package/bin/commands/deploy.js +4 -0
  5. package/bin/commands/deploy.js.map +1 -1
  6. package/bin/index.js +1 -0
  7. package/bin/index.js.map +1 -1
  8. package/bin/templates/AGENTS.template.md +101 -189
  9. package/bin/templates/README.template.md +2 -23
  10. package/cli/templates/AGENTS.template.md +101 -189
  11. package/cli/templates/README.template.md +2 -23
  12. package/dist/docs/assets/hierarchy.js +1 -1
  13. package/dist/docs/assets/navigation.js +1 -1
  14. package/dist/docs/assets/search.js +1 -1
  15. package/dist/docs/classes/index.Options.html +1 -1
  16. package/dist/docs/classes/index.Source.html +200 -0
  17. package/dist/docs/classes/tool.ITool.html +1 -1
  18. package/dist/docs/classes/tool.Tool.html +21 -21
  19. package/dist/docs/classes/tools_ai.AI.html +1 -1
  20. package/dist/docs/classes/tools_callbacks.Callbacks.html +2 -2
  21. package/dist/docs/classes/tools_integrations.Integrations.html +45 -16
  22. package/dist/docs/classes/tools_network.Network.html +1 -1
  23. package/dist/docs/classes/tools_plot.Plot.html +93 -60
  24. package/dist/docs/classes/tools_store.Store.html +1 -1
  25. package/dist/docs/classes/tools_tasks.Tasks.html +1 -1
  26. package/dist/docs/classes/tools_twists.Twists.html +1 -1
  27. package/dist/docs/classes/twist.Twist.html +42 -10
  28. package/dist/docs/documents/Building_Sources.html +137 -0
  29. package/dist/docs/documents/Built-in_Tools.html +11 -2
  30. package/dist/docs/documents/Core_Concepts.html +5 -10
  31. package/dist/docs/documents/Getting_Started.html +1 -1
  32. package/dist/docs/enums/{plot.ActivityLinkType.html → plot.ActionType.html} +10 -8
  33. package/dist/docs/enums/plot.ActorType.html +7 -7
  34. package/dist/docs/enums/plot.ConferencingProvider.html +6 -6
  35. package/dist/docs/enums/plot.ThemeColor.html +9 -9
  36. package/dist/docs/enums/tag.Tag.html +3 -10
  37. package/dist/docs/enums/tools_integrations.AuthProvider.html +11 -11
  38. package/dist/docs/enums/tools_plot.ContactAccess.html +3 -3
  39. package/dist/docs/enums/tools_plot.PriorityAccess.html +3 -3
  40. package/dist/docs/enums/{tools_plot.ActivityAccess.html → tools_plot.ThreadAccess.html} +6 -6
  41. package/dist/docs/hierarchy.html +1 -1
  42. package/dist/docs/index.html +5 -6
  43. package/dist/docs/media/AGENTS.md +910 -0
  44. package/dist/docs/media/MULTI_USER_AUTH.md +111 -0
  45. package/dist/docs/media/SYNC_STRATEGIES.md +7 -7
  46. package/dist/docs/modules/index.html +1 -1
  47. package/dist/docs/modules/plot.html +1 -1
  48. package/dist/docs/modules/tool.html +1 -1
  49. package/dist/docs/modules/tools_integrations.html +1 -1
  50. package/dist/docs/modules/tools_plot.html +1 -1
  51. package/dist/docs/modules.html +1 -1
  52. package/dist/docs/types/index.NewSchedule.html +33 -0
  53. package/dist/docs/types/index.NewScheduleContact.html +5 -0
  54. package/dist/docs/types/index.NewScheduleOccurrence.html +6 -0
  55. package/dist/docs/types/index.Schedule.html +37 -0
  56. package/dist/docs/types/index.ScheduleContact.html +5 -0
  57. package/dist/docs/types/index.ScheduleContactRole.html +1 -0
  58. package/dist/docs/types/index.ScheduleContactStatus.html +1 -0
  59. package/dist/docs/types/index.ScheduleOccurrence.html +17 -0
  60. package/dist/docs/types/index.ScheduleOccurrenceUpdate.html +2 -0
  61. package/dist/docs/types/plot.Action.html +28 -0
  62. package/dist/docs/types/plot.Actor.html +6 -6
  63. package/dist/docs/types/plot.ActorId.html +1 -1
  64. package/dist/docs/types/plot.ContentType.html +1 -1
  65. package/dist/docs/types/plot.Link.html +36 -0
  66. package/dist/docs/types/plot.NewActor.html +1 -1
  67. package/dist/docs/types/plot.NewContact.html +5 -5
  68. package/dist/docs/types/plot.NewLink.html +26 -0
  69. package/dist/docs/types/plot.NewLinkWithNotes.html +7 -0
  70. package/dist/docs/types/plot.NewNote.html +10 -10
  71. package/dist/docs/types/plot.NewPriority.html +1 -1
  72. package/dist/docs/types/plot.NewTags.html +1 -1
  73. package/dist/docs/types/plot.NewThread.html +27 -0
  74. package/dist/docs/types/plot.NewThreadWithNotes.html +1 -0
  75. package/dist/docs/types/plot.Note.html +9 -8
  76. package/dist/docs/types/plot.NoteUpdate.html +2 -2
  77. package/dist/docs/types/plot.PickPriorityConfig.html +8 -10
  78. package/dist/docs/types/plot.Priority.html +6 -6
  79. package/dist/docs/types/plot.PriorityUpdate.html +1 -1
  80. package/dist/docs/types/plot.Tags.html +1 -1
  81. package/dist/docs/types/plot.Thread.html +1 -0
  82. package/dist/docs/types/plot.ThreadCommon.html +17 -0
  83. package/dist/docs/types/plot.ThreadFilter.html +2 -0
  84. package/dist/docs/types/plot.ThreadMeta.html +11 -0
  85. package/dist/docs/types/plot.ThreadUpdate.html +3 -0
  86. package/dist/docs/types/plot.ThreadWithNotes.html +1 -0
  87. package/dist/docs/types/tools_integrations.ArchiveLinkFilter.html +11 -0
  88. package/dist/docs/types/tools_integrations.AuthToken.html +4 -4
  89. package/dist/docs/types/tools_integrations.Authorization.html +4 -4
  90. package/dist/docs/types/tools_integrations.Channel.html +11 -0
  91. package/dist/docs/types/tools_integrations.LinkTypeConfig.html +17 -0
  92. package/dist/docs/types/tools_plot.LinkFilter.html +10 -0
  93. package/dist/docs/types/tools_plot.LinkSearchResult.html +1 -0
  94. package/dist/docs/types/tools_plot.NoteIntentHandler.html +6 -6
  95. package/dist/docs/types/tools_plot.NoteSearchResult.html +1 -0
  96. package/dist/docs/types/tools_plot.SearchOptions.html +7 -0
  97. package/dist/docs/types/tools_plot.SearchResult.html +1 -0
  98. package/dist/docs/types/tools_twists.TwistPermissions.html +1 -1
  99. package/dist/docs/variables/tools_plot.SEARCH_DEFAULT_LIMIT.html +2 -0
  100. package/dist/docs/variables/tools_plot.SEARCH_MAX_LIMIT.html +2 -0
  101. package/dist/index.d.ts +2 -0
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +2 -0
  104. package/dist/index.js.map +1 -1
  105. package/dist/llm-docs/index.d.ts.map +1 -1
  106. package/dist/llm-docs/index.js +4 -8
  107. package/dist/llm-docs/index.js.map +1 -1
  108. package/dist/llm-docs/plot.d.ts +1 -1
  109. package/dist/llm-docs/plot.d.ts.map +1 -1
  110. package/dist/llm-docs/plot.js +1 -1
  111. package/dist/llm-docs/plot.js.map +1 -1
  112. package/dist/llm-docs/schedule.d.ts +9 -0
  113. package/dist/llm-docs/schedule.d.ts.map +1 -0
  114. package/dist/llm-docs/schedule.js +8 -0
  115. package/dist/llm-docs/schedule.js.map +1 -0
  116. package/dist/llm-docs/source.d.ts +9 -0
  117. package/dist/llm-docs/source.d.ts.map +1 -0
  118. package/dist/llm-docs/source.js +8 -0
  119. package/dist/llm-docs/source.js.map +1 -0
  120. package/dist/llm-docs/tag.d.ts +1 -1
  121. package/dist/llm-docs/tag.d.ts.map +1 -1
  122. package/dist/llm-docs/tag.js +1 -1
  123. package/dist/llm-docs/tag.js.map +1 -1
  124. package/dist/llm-docs/tool.d.ts +1 -1
  125. package/dist/llm-docs/tool.d.ts.map +1 -1
  126. package/dist/llm-docs/tool.js +1 -1
  127. package/dist/llm-docs/tool.js.map +1 -1
  128. package/dist/llm-docs/tools/callbacks.d.ts +1 -1
  129. package/dist/llm-docs/tools/callbacks.d.ts.map +1 -1
  130. package/dist/llm-docs/tools/callbacks.js +1 -1
  131. package/dist/llm-docs/tools/callbacks.js.map +1 -1
  132. package/dist/llm-docs/tools/integrations.d.ts +1 -1
  133. package/dist/llm-docs/tools/integrations.d.ts.map +1 -1
  134. package/dist/llm-docs/tools/integrations.js +1 -1
  135. package/dist/llm-docs/tools/integrations.js.map +1 -1
  136. package/dist/llm-docs/tools/plot.d.ts +1 -1
  137. package/dist/llm-docs/tools/plot.d.ts.map +1 -1
  138. package/dist/llm-docs/tools/plot.js +1 -1
  139. package/dist/llm-docs/tools/plot.js.map +1 -1
  140. package/dist/llm-docs/tools/twists.d.ts +1 -1
  141. package/dist/llm-docs/tools/twists.d.ts.map +1 -1
  142. package/dist/llm-docs/tools/twists.js +1 -1
  143. package/dist/llm-docs/tools/twists.js.map +1 -1
  144. package/dist/llm-docs/twist-guide-template.d.ts +1 -1
  145. package/dist/llm-docs/twist-guide-template.d.ts.map +1 -1
  146. package/dist/llm-docs/twist-guide-template.js +1 -1
  147. package/dist/llm-docs/twist-guide-template.js.map +1 -1
  148. package/dist/llm-docs/twist.d.ts +1 -1
  149. package/dist/llm-docs/twist.d.ts.map +1 -1
  150. package/dist/llm-docs/twist.js +1 -1
  151. package/dist/llm-docs/twist.js.map +1 -1
  152. package/dist/plot.d.ts +264 -589
  153. package/dist/plot.d.ts.map +1 -1
  154. package/dist/plot.js +18 -49
  155. package/dist/plot.js.map +1 -1
  156. package/dist/schedule.d.ts +172 -0
  157. package/dist/schedule.d.ts.map +1 -0
  158. package/dist/schedule.js +2 -0
  159. package/dist/schedule.js.map +1 -0
  160. package/dist/source.d.ts +158 -0
  161. package/dist/source.d.ts.map +1 -0
  162. package/dist/source.js +144 -0
  163. package/dist/source.js.map +1 -0
  164. package/dist/tag.d.ts +3 -10
  165. package/dist/tag.d.ts.map +1 -1
  166. package/dist/tag.js +2 -11
  167. package/dist/tag.js.map +1 -1
  168. package/dist/tool.d.ts +1 -15
  169. package/dist/tool.d.ts.map +1 -1
  170. package/dist/tool.js.map +1 -1
  171. package/dist/tools/callbacks.d.ts +1 -1
  172. package/dist/tools/callbacks.js +1 -1
  173. package/dist/tools/integrations.d.ts +119 -52
  174. package/dist/tools/integrations.d.ts.map +1 -1
  175. package/dist/tools/integrations.js +23 -22
  176. package/dist/tools/integrations.js.map +1 -1
  177. package/dist/tools/plot.d.ts +182 -117
  178. package/dist/tools/plot.d.ts.map +1 -1
  179. package/dist/tools/plot.js +23 -21
  180. package/dist/tools/plot.js.map +1 -1
  181. package/dist/tools/twists.d.ts +1 -1
  182. package/dist/twist-guide.d.ts +1 -1
  183. package/dist/twist-guide.d.ts.map +1 -1
  184. package/dist/twist.d.ts +66 -11
  185. package/dist/twist.d.ts.map +1 -1
  186. package/dist/twist.js +79 -10
  187. package/dist/twist.js.map +1 -1
  188. package/package.json +11 -41
  189. package/dist/common/calendar.d.ts +0 -135
  190. package/dist/common/calendar.d.ts.map +0 -1
  191. package/dist/common/calendar.js +0 -2
  192. package/dist/common/calendar.js.map +0 -1
  193. package/dist/common/documents.d.ts +0 -122
  194. package/dist/common/documents.d.ts.map +0 -1
  195. package/dist/common/documents.js +0 -2
  196. package/dist/common/documents.js.map +0 -1
  197. package/dist/common/messaging.d.ts +0 -84
  198. package/dist/common/messaging.d.ts.map +0 -1
  199. package/dist/common/messaging.js +0 -2
  200. package/dist/common/messaging.js.map +0 -1
  201. package/dist/common/projects.d.ts +0 -112
  202. package/dist/common/projects.d.ts.map +0 -1
  203. package/dist/common/projects.js +0 -2
  204. package/dist/common/projects.js.map +0 -1
  205. package/dist/docs/documents/Building_Custom_Tools.html +0 -215
  206. package/dist/docs/enums/plot.ActivityKind.html +0 -14
  207. package/dist/docs/enums/plot.ActivityType.html +0 -10
  208. package/dist/docs/modules/common_calendar.html +0 -1
  209. package/dist/docs/types/common_calendar.Calendar.html +0 -13
  210. package/dist/docs/types/common_calendar.CalendarTool.html +0 -81
  211. package/dist/docs/types/common_calendar.SyncOptions.html +0 -24
  212. package/dist/docs/types/plot.Activity.html +0 -2
  213. package/dist/docs/types/plot.ActivityCommon.html +0 -20
  214. package/dist/docs/types/plot.ActivityFilter.html +0 -3
  215. package/dist/docs/types/plot.ActivityLink.html +0 -26
  216. package/dist/docs/types/plot.ActivityMeta.html +0 -11
  217. package/dist/docs/types/plot.ActivityOccurrence.html +0 -22
  218. package/dist/docs/types/plot.ActivityOccurrenceUpdate.html +0 -3
  219. package/dist/docs/types/plot.ActivityUpdate.html +0 -3
  220. package/dist/docs/types/plot.ActivityWithNotes.html +0 -1
  221. package/dist/docs/types/plot.NewActivity.html +0 -81
  222. package/dist/docs/types/plot.NewActivityOccurrence.html +0 -24
  223. package/dist/docs/types/plot.NewActivityWithNotes.html +0 -1
  224. package/dist/docs/types/tool.SyncToolOptions.html +0 -9
  225. package/dist/docs/types/tools_integrations.IntegrationOptions.html +0 -4
  226. package/dist/docs/types/tools_integrations.IntegrationProviderConfig.html +0 -13
  227. package/dist/docs/types/tools_integrations.Syncable.html +0 -9
  228. package/dist/llm-docs/common/calendar.d.ts +0 -9
  229. package/dist/llm-docs/common/calendar.d.ts.map +0 -1
  230. package/dist/llm-docs/common/calendar.js +0 -8
  231. package/dist/llm-docs/common/calendar.js.map +0 -1
  232. package/dist/llm-docs/common/documents.d.ts +0 -9
  233. package/dist/llm-docs/common/documents.d.ts.map +0 -1
  234. package/dist/llm-docs/common/documents.js +0 -8
  235. package/dist/llm-docs/common/documents.js.map +0 -1
  236. package/dist/llm-docs/common/messaging.d.ts +0 -9
  237. package/dist/llm-docs/common/messaging.d.ts.map +0 -1
  238. package/dist/llm-docs/common/messaging.js +0 -8
  239. package/dist/llm-docs/common/messaging.js.map +0 -1
  240. package/dist/llm-docs/common/projects.d.ts +0 -9
  241. package/dist/llm-docs/common/projects.d.ts.map +0 -1
  242. package/dist/llm-docs/common/projects.js +0 -8
  243. package/dist/llm-docs/common/projects.js.map +0 -1
package/dist/plot.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { NewSchedule, NewScheduleOccurrence, Schedule } from "./schedule";
1
2
  import { type Tag } from "./tag";
2
3
  import { type Callback } from "./tools/callbacks";
3
4
  import { type AuthProvider } from "./tools/integrations";
@@ -9,15 +10,15 @@ export { type JSONValue } from "./utils/types";
9
10
  export { type AuthProvider } from "./tools/integrations";
10
11
  /**
11
12
  * @fileoverview
12
- * Core Plot entity types for working with activities, notes, priorities, and contacts.
13
+ * Core Plot entity types for working with threads, notes, priorities, and contacts.
13
14
  *
14
15
  * ## Type Pattern: Null vs Undefined Semantics
15
16
  *
16
17
  * Plot entity types use a consistent pattern to distinguish between missing, unset, and explicitly cleared values:
17
18
  *
18
- * ### Entity Types (Activity, Priority, Note, Actor)
19
+ * ### Entity Types (Thread, Priority, Note, Actor)
19
20
  * - **Required fields**: No `?`, cannot be `undefined`
20
- * - Example: `id: Uuid`, `type: ActivityType`
21
+ * - Example: `id: Uuid`, `title: string`
21
22
  * - **Nullable fields**: Use `| null` to allow explicit clearing
22
23
  * - Example: `assignee: ActorId | null`, `done: Date | null`
23
24
  * - `null` = field is explicitly unset/cleared
@@ -28,10 +29,10 @@ export { type AuthProvider } from "./tools/integrations";
28
29
  * - `null` = field included but not set
29
30
  * - Value = field has a value
30
31
  *
31
- * ### New* Types (NewActivity, NewNote, NewPriority)
32
+ * ### New* Types (NewThread, NewNote, NewPriority)
32
33
  * Used for creating or updating entities. Support partial updates by distinguishing omitted vs cleared fields:
33
34
  * - **Required fields**: Must be provided (no `?`)
34
- * - Example: `type: ActivityType` in NewActivity
35
+ * - Example: `title: string` in NewPriority
35
36
  * - **Optional fields**: Use `?` to make them optional
36
37
  * - Example: `title?: string`, `author?: NewActor`
37
38
  * - `undefined` (omitted) = don't set/update this field
@@ -49,20 +50,15 @@ export { type AuthProvider } from "./tools/integrations";
49
50
  *
50
51
  * @example
51
52
  * ```typescript
52
- * // Creating a new activity
53
- * const newActivity: NewActivity = {
54
- * type: ActivityType.Action, // Required
55
- * title: "Review PR", // Optional, provided
56
- * assignee: null, // Optional nullable, explicitly clearing
57
- * // priority is omitted (undefined), will auto-select or use default
53
+ * // Creating a new thread
54
+ * const newThread: NewThread = {
55
+ * title: "Review pull request",
58
56
  * };
59
57
  *
60
- * // Updating an activity - only change what's specified
61
- * const update: ActivityUpdate = {
62
- * id: activityId,
63
- * done: new Date(), // Mark as done
64
- * assignee: null, // Clear assignee
65
- * // title is omitted, won't be changed
58
+ * // Updating a thread - only change what's specified
59
+ * const update: ThreadUpdate = {
60
+ * id: threadId,
61
+ * archived: true,
66
62
  * };
67
63
  * ```
68
64
  */
@@ -161,53 +157,24 @@ export type PriorityUpdate = ({
161
157
  key: string;
162
158
  }) & Partial<Pick<Priority, "title" | "archived">>;
163
159
  /**
164
- * Enumeration of supported activity types in Plot.
160
+ * Enumeration of supported action types.
165
161
  *
166
- * Each activity type has different behaviors and rendering characteristics
167
- * within the Plot application.
168
- */
169
- export declare enum ActivityType {
170
- /** A note or piece of information without actionable requirements */
171
- Note = 0,
172
- /** An actionable item that can be completed */
173
- Action = 1,
174
- /** A scheduled occurrence with start and optional end time */
175
- Event = 2
176
- }
177
- /**
178
- * Kinds of activities. Used only for visual categorization (icon).
179
- */
180
- export declare enum ActivityKind {
181
- document = "document",// any external document or item in an external system
182
- messages = "messages",// emails and chat threads
183
- meeting = "meeting",// in-person meeting
184
- videoconference = "videoconference",
185
- phone = "phone",
186
- focus = "focus",
187
- meal = "meal",
188
- exercise = "exercise",
189
- family = "family",
190
- travel = "travel",
191
- social = "social",
192
- entertainment = "entertainment"
193
- }
194
- /**
195
- * Enumeration of supported activity link types.
196
- *
197
- * Different link types have different behaviors when clicked by users
162
+ * Different action types have different behaviors when clicked by users
198
163
  * and may require different rendering approaches.
199
164
  */
200
- export declare enum ActivityLinkType {
165
+ export declare enum ActionType {
201
166
  /** External web links that open in browser */
202
167
  external = "external",
203
168
  /** Authentication flows for connecting services */
204
169
  auth = "auth",
205
- /** Callback links that trigger twist methods when clicked */
170
+ /** Callback actions that trigger twist methods when clicked */
206
171
  callback = "callback",
207
172
  /** Video conferencing links with provider-specific handling */
208
173
  conferencing = "conferencing",
209
174
  /** File attachment links stored in R2 */
210
- file = "file"
175
+ file = "file",
176
+ /** Thread reference links for navigating to related threads */
177
+ thread = "thread"
211
178
  }
212
179
  /**
213
180
  * Video conferencing providers for conferencing links.
@@ -228,61 +195,61 @@ export declare enum ConferencingProvider {
228
195
  other = "other"
229
196
  }
230
197
  /**
231
- * Represents a clickable link attached to an activity.
198
+ * Represents a clickable action attached to a thread.
232
199
  *
233
- * Activity links are rendered as buttons that enable user interaction with activities.
234
- * Different link types have specific behaviors and required fields for proper functionality.
200
+ * Thread actions are rendered as buttons that enable user interaction with threads.
201
+ * Different action types have specific behaviors and required fields for proper functionality.
235
202
  *
236
203
  * @example
237
204
  * ```typescript
238
- * // External link - opens URL in browser
239
- * const externalLink: ActivityLink = {
240
- * type: ActivityLinkType.external,
205
+ * // External action - opens URL in browser
206
+ * const externalAction: Action = {
207
+ * type: ActionType.external,
241
208
  * title: "Open in Google Calendar",
242
209
  * url: "https://calendar.google.com/event/123",
243
210
  * };
244
211
  *
245
- * // Conferencing link - opens video conference with provider info
246
- * const conferencingLink: ActivityLink = {
247
- * type: ActivityLinkType.conferencing,
212
+ * // Conferencing action - opens video conference with provider info
213
+ * const conferencingAction: Action = {
214
+ * type: ActionType.conferencing,
248
215
  * url: "https://meet.google.com/abc-defg-hij",
249
216
  * provider: ConferencingProvider.googleMeet,
250
217
  * };
251
218
  *
252
- * // Integrations link - initiates OAuth flow
253
- * const authLink: ActivityLink = {
254
- * type: ActivityLinkType.auth,
219
+ * // Integrations action - initiates OAuth flow
220
+ * const authAction: Action = {
221
+ * type: ActionType.auth,
255
222
  * title: "Continue with Google",
256
223
  * provider: AuthProvider.Google,
257
224
  * scopes: ["https://www.googleapis.com/auth/calendar.readonly"],
258
225
  * callback: "callback-token-for-auth-completion"
259
226
  * };
260
227
  *
261
- * // Callback link - triggers a twist method
262
- * const callbackLink: ActivityLink = {
263
- * type: ActivityLinkType.callback,
228
+ * // Callback action - triggers a twist method
229
+ * const callbackAction: Action = {
230
+ * type: ActionType.callback,
264
231
  * title: "📅 Primary Calendar",
265
232
  * token: "callback-token-here"
266
233
  * };
267
234
  * ```
268
235
  */
269
- export type ActivityLink = {
236
+ export type Action = {
270
237
  /** External web link that opens in browser */
271
- type: ActivityLinkType.external;
272
- /** Display text for the link button */
238
+ type: ActionType.external;
239
+ /** Display text for the action button */
273
240
  title: string;
274
241
  /** URL to open when clicked */
275
242
  url: string;
276
243
  } | {
277
- /** Video conferencing link with provider-specific handling */
278
- type: ActivityLinkType.conferencing;
244
+ /** Video conferencing action with provider-specific handling */
245
+ type: ActionType.conferencing;
279
246
  /** URL to join the conference */
280
247
  url: string;
281
248
  /** Conferencing provider for UI customization */
282
249
  provider: ConferencingProvider;
283
250
  } | {
284
- /** Authentication link that initiates an OAuth flow */
285
- type: ActivityLinkType.auth;
251
+ /** Authentication action that initiates an OAuth flow */
252
+ type: ActionType.auth;
286
253
  /** Display text for the auth button */
287
254
  title: string;
288
255
  /** OAuth provider (e.g., "google", "microsoft") */
@@ -292,15 +259,15 @@ export type ActivityLink = {
292
259
  /** Callback token for auth completion notification */
293
260
  callback: Callback;
294
261
  } | {
295
- /** Callback link that triggers a twist method when clicked */
296
- type: ActivityLinkType.callback;
262
+ /** Callback action that triggers a twist method when clicked */
263
+ type: ActionType.callback;
297
264
  /** Display text for the callback button */
298
265
  title: string;
299
266
  /** Token identifying the callback to execute */
300
267
  callback: Callback;
301
268
  } | {
302
- /** File attachment link stored in R2 */
303
- type: ActivityLinkType.file;
269
+ /** File attachment action stored in R2 */
270
+ type: ActionType.file;
304
271
  /** Unique identifier for the stored file */
305
272
  fileId: string;
306
273
  /** Original filename */
@@ -309,11 +276,16 @@ export type ActivityLink = {
309
276
  fileSize: number;
310
277
  /** MIME type of the file */
311
278
  mimeType: string;
279
+ } | {
280
+ /** Thread reference action for navigating to a related thread */
281
+ type: ActionType.thread;
282
+ /** UUID of the referenced thread */
283
+ threadId: Uuid;
312
284
  };
313
285
  /**
314
- * Represents metadata about an activity, typically from an external system.
286
+ * Represents metadata about a thread, typically from an external system.
315
287
  *
316
- * Activity metadata enables storing additional information about activities,
288
+ * Thread metadata enables storing additional information about threads,
317
289
  * which is useful for synchronization, linking back to external systems,
318
290
  * and storing tool-specific data.
319
291
  *
@@ -323,10 +295,8 @@ export type ActivityLink = {
323
295
  * @example
324
296
  * ```typescript
325
297
  * // Calendar event metadata
326
- * await plot.createActivity({
327
- * type: ActivityType.Event,
298
+ * await plot.createThread({
328
299
  * title: "Team Meeting",
329
- * start: new Date("2024-01-15T10:00:00Z"),
330
300
  * meta: {
331
301
  * calendarId: "primary",
332
302
  * htmlLink: "https://calendar.google.com/event/abc123",
@@ -335,8 +305,7 @@ export type ActivityLink = {
335
305
  * });
336
306
  *
337
307
  * // Project issue metadata
338
- * await plot.createActivity({
339
- * type: ActivityType.Action,
308
+ * await plot.createThread({
340
309
  * title: "Fix login bug",
341
310
  * meta: {
342
311
  * projectId: "TEAM",
@@ -346,7 +315,7 @@ export type ActivityLink = {
346
315
  * });
347
316
  * ```
348
317
  */
349
- export type ActivityMeta = {
318
+ export type ThreadMeta = {
350
319
  /** Source-specific properties and metadata */
351
320
  [key: string]: JSONValue;
352
321
  };
@@ -363,286 +332,59 @@ export type NewTags = {
363
332
  [K in Tag]?: NewActor[];
364
333
  };
365
334
  /**
366
- * Common fields shared by both Activity and Note entities.
335
+ * Common fields shared by both Thread and Note entities.
367
336
  */
368
- export type ActivityCommon = {
369
- /** Unique identifier for the activity */
337
+ export type ThreadCommon = {
338
+ /** Unique identifier for the thread */
370
339
  id: Uuid;
371
340
  /**
372
- * When this activity was originally created in its source system.
373
- *
374
- * For activities created in Plot, this is when the user created it.
375
- * For activities synced from external systems (GitHub issues, emails, calendar events),
376
- * this is the original creation time in that system.
341
+ * When this item was created.
377
342
  *
378
- * Defaults to the current time when creating new activities.
343
+ * **For sources:** Set this to the external system's timestamp (e.g., email
344
+ * sent date, comment creation date), NOT the sync time. If omitted, defaults
345
+ * to the current time, which is almost never correct for synced data.
379
346
  */
380
347
  created: Date;
381
- /** Information about who created the activity */
382
- author: Actor;
383
- /** Whether this activity is private (only visible to author) */
348
+ /** Whether this thread is private (only visible to creator) */
384
349
  private: boolean;
385
- /** Whether this activity has been archived */
350
+ /** Whether this thread has been archived */
386
351
  archived: boolean;
387
- /** Tags attached to this activity. Maps tag ID to array of actor IDs who added that tag. */
352
+ /** Tags attached to this thread. Maps tag ID to array of actor IDs who added that tag. */
388
353
  tags: Tags;
389
- /** Array of actor IDs (users, contacts, or twists) mentioned in this activity via @-mentions */
354
+ /** Array of actor IDs (users, contacts, or twists) mentioned in this thread via @-mentions */
390
355
  mentions: ActorId[];
391
356
  };
392
357
  /**
393
- * Common fields shared by all activity types (Note, Action, Event).
394
- * Does not include the discriminant `type` field or type-specific fields like `done`.
358
+ * Fields on a Thread entity.
359
+ * Threads are simple containers for links and notes.
395
360
  */
396
- type ActivityFields = ActivityCommon & {
397
- /**
398
- * Globally unique, stable identifier for the item in an external system.
399
- * MUST use immutable system-generated IDs, not human-readable slugs or titles.
400
- *
401
- * Recommended format: `${domain}:${type}:${id}`
402
- *
403
- * Examples:
404
- * - `linear:issue:549dd8bd-2bc9-43d1-95d5-4b4af0c5af1b` (Linear issue by UUID)
405
- * - `jira:10001:issue:12345` (Jira issue by numeric ID with cloud ID)
406
- * - `gmail:thread:18d4e5f2a3b1c9d7` (Gmail thread by system ID)
407
- *
408
- * ⚠️ AVOID: URLs with mutable components like team names or issue keys
409
- * - Bad: `https://linear.app/team/issue/TEAM-123/title` (team and title can change)
410
- * - Bad: `jira:issue:PROJECT-42` (issue key can change)
411
- *
412
- * When set, uniquely identifies the activity within a priority tree for upsert operations.
413
- */
414
- source: string | null;
415
- /** The display title/summary of the activity */
361
+ type ThreadFields = ThreadCommon & {
362
+ /** The display title/summary of the thread */
416
363
  title: string;
417
- /** Optional kind for additional categorization within the activity */
418
- kind: ActivityKind | null;
419
- /**
420
- * The actor assigned to this activity.
421
- *
422
- * **For actions (tasks):**
423
- * - If not provided (undefined), defaults to the user who installed the twist (twist owner)
424
- * - To create an **unassigned action**, explicitly set `assignee: null`
425
- * - For synced tasks from external systems, typically set `assignee: null` for unassigned items
426
- *
427
- * **For notes and events:** Assignee is optional and typically null.
428
- * When marking an activity as done, it becomes an Action; if no assignee is set,
429
- * the twist owner is assigned automatically.
430
- *
431
- * @example
432
- * ```typescript
433
- * // Create action assigned to twist owner (default behavior)
434
- * const task: NewActivity = {
435
- * type: ActivityType.Action,
436
- * title: "Follow up on email"
437
- * // assignee omitted → defaults to twist owner
438
- * };
439
- *
440
- * // Create UNASSIGNED action (for backlog items)
441
- * const backlogTask: NewActivity = {
442
- * type: ActivityType.Action,
443
- * title: "Review PR #123",
444
- * assignee: null // Explicitly set to null
445
- * };
446
- *
447
- * // Create action with explicit assignee
448
- * const assignedTask: NewActivity = {
449
- * type: ActivityType.Action,
450
- * title: "Deploy to production",
451
- * assignee: {
452
- * id: userId as ActorId,
453
- * type: ActorType.User,
454
- * name: "Alice"
455
- * }
456
- * };
457
- * ```
458
- */
459
- assignee: Actor | null;
460
- /**
461
- * Start time of a scheduled activity. Notes are not typically scheduled unless they're about specific times.
462
- * For recurring events, this represents the start of the first occurrence.
463
- * Can be a Date object for timed events or a date string in "YYYY-MM-DD" format for all-day events.
464
- *
465
- * **Activity Scheduling States** (for Actions):
466
- * - **Do Now** (current/actionable): When creating an Action, omitting `start` defaults to current time
467
- * - **Do Later** (future scheduled): Set `start` to a future Date or date string
468
- * - **Do Someday** (unscheduled backlog): Explicitly set `start: null`
469
- *
470
- * **Important for synced tasks**: When syncing unassigned backlog items from external systems,
471
- * set BOTH `start: null` AND `assignee: null` to create unscheduled, unassigned actions.
472
- *
473
- * @example
474
- * ```typescript
475
- * // "Do Now" - assigned to twist owner, actionable immediately
476
- * await this.tools.plot.createActivity({
477
- * type: ActivityType.Action,
478
- * title: "Urgent task"
479
- * // start omitted → defaults to now
480
- * // assignee omitted → defaults to twist owner
481
- * });
482
- *
483
- * // "Do Later" - scheduled for a specific time
484
- * await this.tools.plot.createActivity({
485
- * type: ActivityType.Action,
486
- * title: "Future task",
487
- * start: new Date("2025-02-01")
488
- * });
489
- *
490
- * // "Do Someday" - unassigned backlog item (common for synced tasks)
491
- * await this.tools.plot.createActivity({
492
- * type: ActivityType.Action,
493
- * title: "Backlog task",
494
- * start: null, // Explicitly unscheduled
495
- * assignee: null // Explicitly unassigned
496
- * });
497
- * ```
498
- */
499
- start: Date | string | null;
500
- /**
501
- * End time of a scheduled activity. Notes are not typically scheduled unless they're about specific times.
502
- * For recurring events, this represents the end of the first occurrence.
503
- * Can be a Date object for timed events or a date string in "YYYY-MM-DD" format for all-day events.
504
- * Null for tasks or activities without defined end times.
505
- */
506
- end: Date | string | null;
507
- /**
508
- * For recurring activities, the last occurrence date (inclusive).
509
- * Can be a Date object, date string in "YYYY-MM-DD" format, or null if recurring indefinitely.
510
- * When both recurrenceCount and recurrenceUntil are provided, recurrenceCount takes precedence.
511
- */
512
- recurrenceUntil: Date | string | null;
513
- /**
514
- * For recurring activities, the number of occurrences to generate.
515
- * Takes precedence over recurrenceUntil if both are provided.
516
- * Null for non-recurring activities or indefinite recurrence.
517
- */
518
- recurrenceCount: number | null;
519
- /** The priority context this activity belongs to */
364
+ /** The priority context this thread belongs to */
520
365
  priority: Priority;
521
- /** Recurrence rule in RFC 5545 RRULE format (e.g., "FREQ=WEEKLY;BYDAY=MO,WE,FR") */
522
- recurrenceRule: string | null;
523
- /** Array of dates to exclude from the recurrence pattern */
524
- recurrenceExdates: Date[] | null;
525
- /** Metadata about the activity, typically from an external system that created it */
526
- meta: ActivityMeta | null;
527
- /** Sort order for the activity (fractional positioning) */
528
- order: number;
366
+ /** The schedule associated with this thread, if any */
367
+ schedule?: Schedule;
368
+ /** Source-specific metadata from the thread's link, populated on callbacks */
369
+ meta?: ThreadMeta;
529
370
  };
530
- export type Activity = ActivityFields & ({
531
- type: ActivityType.Note;
532
- } | {
533
- type: ActivityType.Action;
534
- /**
535
- * Timestamp when the activity was marked as complete. Null if not completed.
536
- */
537
- done: Date | null;
538
- } | {
539
- type: ActivityType.Event;
540
- });
541
- export type ActivityWithNotes = Activity & {
371
+ export type Thread = ThreadFields;
372
+ export type ThreadWithNotes = Thread & {
542
373
  notes: Note[];
543
374
  };
544
- export type NewActivityWithNotes = NewActivity & {
545
- notes: Omit<NewNote, "activity">[];
546
- };
547
- /**
548
- * Represents a specific instance of a recurring activity.
549
- * All field values are computed by merging the recurring activity's
550
- * defaults with any occurrence-specific overrides.
551
- */
552
- export type ActivityOccurrence = {
553
- /**
554
- * Original date/datetime of this occurrence.
555
- * Use start for the occurrence's current start time.
556
- * Format: Date object or "YYYY-MM-DD" for all-day events.
557
- */
558
- occurrence: Date | string;
559
- /**
560
- * The recurring activity of which this is an occurrence.
561
- */
562
- activity: Activity;
563
- /**
564
- * Effective values for this occurrence (series defaults + overrides).
565
- * These are the actual values that apply to this specific instance.
566
- */
567
- start: Date | string;
568
- end: Date | string | null;
569
- done: Date | null;
570
- title: string;
571
- /**
572
- * Meta is merged, with the occurrence's meta taking precedence.
573
- */
574
- meta: ActivityMeta | null;
575
- /**
576
- * Tags for this occurrence (merged with the recurring tags).
577
- */
578
- tags: Tags;
579
- /**
580
- * True if the occurrence is archived.
581
- */
582
- archived: boolean;
583
- };
584
- /**
585
- * Type for creating or updating activity occurrences.
586
- *
587
- * Follows the same pattern as Activity/NewActivity:
588
- * - Required fields: `occurrence` (key) and `start` (for scheduling)
589
- * - Optional fields: All others from ActivityOccurrence
590
- * - Additional fields: `twistTags` for add/remove, `unread` for notification control
591
- *
592
- * @example
593
- * ```typescript
594
- * const activity: NewActivity = {
595
- * type: ActivityType.Event,
596
- * recurrenceRule: "FREQ=WEEKLY;BYDAY=MO",
597
- * occurrences: [
598
- * {
599
- * occurrence: new Date("2025-01-27T14:00:00Z"),
600
- * start: new Date("2025-01-27T14:00:00Z"),
601
- * tags: { [Tag.Skip]: [user] }
602
- * }
603
- * ]
604
- * };
605
- * ```
606
- */
607
- export type NewActivityOccurrence = Pick<ActivityOccurrence, "occurrence" | "start"> & Partial<Omit<ActivityOccurrence, "occurrence" | "start" | "activity" | "tags">> & {
608
- /**
609
- * Tags specific to this occurrence.
610
- * These replace any recurrence-level tags for this occurrence.
611
- */
612
- tags?: NewTags;
613
- /**
614
- * Add or remove the twist's tags on this occurrence.
615
- * Maps tag ID to boolean: true = add tag, false = remove tag.
616
- */
617
- twistTags?: Partial<Record<Tag, boolean>>;
618
- /**
619
- * Whether this occurrence should be marked as unread for users.
620
- * - undefined/omitted (default): Occurrence is unread for users, except auto-marked
621
- * as read for the author if they are the twist owner (user)
622
- * - true: Occurrence is explicitly unread for ALL users (use sparingly)
623
- * - false: Occurrence is marked as read for all users
624
- *
625
- * For the default behavior, omit this field entirely.
626
- * Use false for initial sync to avoid marking historical items as unread.
627
- */
628
- unread?: boolean;
375
+ export type NewThreadWithNotes = NewThread & {
376
+ notes: Omit<NewNote, "thread">[];
629
377
  };
630
378
  /**
631
- * Inline type for creating/updating occurrences within NewActivity/ActivityUpdate.
632
- * Used to specify occurrence-specific overrides when creating or updating a recurring activity.
633
- */
634
- export type ActivityOccurrenceUpdate = Pick<NewActivityOccurrence, "occurrence"> & Partial<Omit<NewActivityOccurrence, "occurrence" | "activity">>;
635
- /**
636
- * Configuration for automatic priority selection based on activity similarity.
379
+ * Configuration for automatic priority selection based on thread similarity.
637
380
  *
638
- * Maps activity fields to scoring weights or required exact matches:
381
+ * Maps thread fields to scoring weights or required exact matches:
639
382
  * - Number value: Maximum score for similarity matching on this field
640
- * - `true` value: Required exact match - activities must match exactly or be excluded
383
+ * - `true` value: Required exact match - threads must match exactly or be excluded
641
384
  *
642
385
  * Scoring rules:
643
- * - content: Uses vector similarity on activity embedding (cosine similarity)
644
- * - type: Exact match on ActivityType
645
- * - mentions: Percentage of existing activity's mentions that appear in new activity
386
+ * - content: Uses vector similarity on thread embedding (cosine similarity)
387
+ * - mentions: Percentage of existing thread's mentions that appear in new thread
646
388
  * - meta.field: Exact match on top-level meta fields (e.g., "meta.sourceId")
647
389
  *
648
390
  * When content is `true`, applies a strong similarity threshold to ensure only close matches.
@@ -653,8 +395,8 @@ export type ActivityOccurrenceUpdate = Pick<NewActivityOccurrence, "occurrence">
653
395
  * // Require exact content match with strong similarity
654
396
  * pickPriority: { content: true }
655
397
  *
656
- * // Score based on content (max 100 points) and require exact type match
657
- * pickPriority: { content: 100, type: true }
398
+ * // Score based on content (max 100 points) and mentions
399
+ * pickPriority: { content: 100, mentions: true }
658
400
  *
659
401
  * // Match on meta and score content
660
402
  * pickPriority: { "meta.projectId": true, content: 50 }
@@ -662,103 +404,24 @@ export type ActivityOccurrenceUpdate = Pick<NewActivityOccurrence, "occurrence">
662
404
  */
663
405
  export type PickPriorityConfig = {
664
406
  content?: number | true;
665
- type?: number | true;
666
407
  mentions?: number | true;
667
408
  [key: `meta.${string}`]: number | true;
668
409
  };
669
410
  /**
670
- * Type for creating new activities.
671
- *
672
- * Requires only the activity type, with all other fields optional.
673
- * The author will be automatically assigned by the Plot system based on
674
- * the current execution context. The ID can be optionally provided by
675
- * tools for tracking and update detection purposes.
411
+ * Type for creating new threads.
676
412
  *
677
- * **Important: Defaults for Actions**
678
- *
679
- * When creating an Activity of type `Action`:
680
- * - **`start` omitted** → Defaults to current time (now) → "Do Now"
681
- * - **`assignee` omitted** → Defaults to twist owner → Assigned action
682
- *
683
- * To create unassigned backlog items (common for synced tasks), you MUST explicitly set BOTH:
684
- * - `start: null` → "Do Someday" (unscheduled)
685
- * - `assignee: null` → Unassigned
686
- *
687
- * **Scheduling States**:
688
- * - **"Do Now"** (actionable today): Omit `start` or set to current time
689
- * - **"Do Later"** (scheduled): Set `start` to a future Date
690
- * - **"Do Someday"** (backlog): Set `start: null`
691
- *
692
- * Priority can be specified in three ways:
693
- * 1. Explicit priority: `priority: { id: "..." }` - Use specific priority (disables pickPriority)
694
- * 2. Pick priority config: `pickPriority: { ... }` - Auto-select based on similarity
695
- * 3. Neither: Defaults to `pickPriority: { content: true }` for automatic matching
413
+ * Threads are simple containers. All other fields are optional.
696
414
  *
697
415
  * @example
698
416
  * ```typescript
699
- * // "Do Now" - Assigned to twist owner, actionable immediately
700
- * const urgentTask: NewActivity = {
701
- * type: ActivityType.Action,
417
+ * const thread: NewThread = {
702
418
  * title: "Review pull request"
703
- * // start omitted → defaults to now
704
- * // assignee omitted → defaults to twist owner
705
- * };
706
- *
707
- * // "Do Someday" - UNASSIGNED backlog item (for synced tasks)
708
- * const backlogTask: NewActivity = {
709
- * type: ActivityType.Action,
710
- * title: "Refactor user service",
711
- * start: null, // Must explicitly set to null
712
- * assignee: null // Must explicitly set to null
713
- * };
714
- *
715
- * // "Do Later" - Scheduled for specific date
716
- * const futureTask: NewActivity = {
717
- * type: ActivityType.Action,
718
- * title: "Prepare Q1 review",
719
- * start: new Date("2025-03-15")
720
- * };
721
- *
722
- * // Note (typically unscheduled)
723
- * const note: NewActivity = {
724
- * type: ActivityType.Note,
725
- * title: "Meeting notes",
726
- * content: "Discussed Q4 roadmap...",
727
- * start: null // Notes typically don't have scheduled times
728
- * };
729
- *
730
- * // Event (always has explicit start/end times)
731
- * const event: NewActivity = {
732
- * type: ActivityType.Event,
733
- * title: "Team standup",
734
- * start: new Date("2025-01-15T10:00:00"),
735
- * end: new Date("2025-01-15T10:30:00")
736
419
  * };
737
420
  * ```
738
421
  */
739
- export type NewActivity = ({
740
- type: ActivityType.Note;
741
- done?: never;
742
- } | {
743
- type: ActivityType.Action;
744
- done?: Date | null;
745
- } | {
746
- type: ActivityType.Event;
747
- done?: never;
748
- }) & Partial<Omit<ActivityFields, "author" | "assignee" | "priority" | "tags" | "mentions" | "id" | "source">> & ({
749
- /**
750
- * Unique identifier for the activity, generated by Uuid.Generate().
751
- * Specifying an ID allows tools to track and upsert activities.
752
- */
422
+ export type NewThread = Partial<Omit<ThreadFields, "priority" | "tags" | "mentions" | "id">> & ({
423
+ /** Unique identifier for the thread, generated by Uuid.Generate(). */
753
424
  id: Uuid;
754
- } | {
755
- /**
756
- * Canonical URL for the item in an external system.
757
- * For example, https://acme.atlassian.net/browse/PROJ-42 could represent a Jira issue.
758
- * When set, it uniquely identifies the activity within a priority tree. This performs
759
- * an upsert.
760
- */
761
- source: string;
762
425
  } | {}) & ({
763
426
  /** Explicit priority (required when specified) - disables automatic priority matching */
764
427
  priority: Pick<Priority, "id">;
@@ -767,201 +430,98 @@ export type NewActivity = ({
767
430
  pickPriority?: PickPriorityConfig;
768
431
  }) & {
769
432
  /**
770
- * The person that created the item. By default, it will be the twist itself.
771
- */
772
- author?: NewActor;
773
- /**
774
- * The person that assigned to the item.
775
- */
776
- assignee?: NewActor | null;
777
- /**
778
- * All tags to set on the new activity.
433
+ * All tags to set on the new thread.
779
434
  */
780
435
  tags?: NewTags;
781
436
  /**
782
- * Whether the activity should be marked as unread for users.
783
- * - undefined/omitted (default): Activity is unread for users, except auto-marked
437
+ * Whether the thread should be marked as unread for users.
438
+ * - undefined/omitted (default): Thread is unread for users, except auto-marked
784
439
  * as read for the author if they are the twist owner (user)
785
- * - true: Activity is explicitly unread for ALL users (use sparingly)
786
- * - false: Activity is marked as read for all users in the priority at creation time
787
- *
788
- * For the default behavior, omit this field entirely.
789
- * Use false for initial sync to avoid marking historical items as unread.
440
+ * - true: Thread is explicitly unread for ALL users (use sparingly)
441
+ * - false: Thread is marked as read for all users in the priority at creation time
790
442
  */
791
443
  unread?: boolean;
792
444
  /**
793
- * Whether the activity is archived.
794
- * - true: Archive the activity
795
- * - false: Unarchive the activity
445
+ * Whether the thread is archived.
446
+ * - true: Archive the thread
447
+ * - false: Unarchive the thread
796
448
  * - undefined (default): Preserve current archive state
797
- *
798
- * Best practice: Set to false during initial syncs to ensure activities
799
- * are unarchived. Omit during incremental syncs to preserve user's choice.
800
449
  */
801
450
  archived?: boolean;
802
451
  /**
803
- * Optional preview content for the activity. Can be Markdown formatted.
452
+ * Optional preview content for the thread. Can be Markdown formatted.
804
453
  * The preview will be automatically generated from this content (truncated to 100 chars).
805
- *
806
- * - string: Use this content for preview generation
807
- * - null: Explicitly disable preview (no preview will be shown)
808
- * - undefined (default): Fall back to legacy behavior (generate from first note with content)
809
- *
810
- * This field is write-only and won't be returned when reading activities.
811
454
  */
812
455
  preview?: string | null;
813
456
  /**
814
- * Create or update specific occurrences of a recurring activity.
815
- * Each entry specifies overrides for a specific occurrence.
816
- *
817
- * When occurrence matches the recurrence rule but only tags are specified,
818
- * the occurrence is created with just tags in activity_tag.occurrence (no activity_exception).
819
- *
820
- * When any other field is specified, creates/updates an activity_exception row.
821
- *
822
- * @example
823
- * ```typescript
824
- * // Create recurring event with per-occurrence RSVPs
825
- * const meeting: NewActivity = {
826
- * type: ActivityType.Event,
827
- * recurrenceRule: "FREQ=WEEKLY;BYDAY=MO",
828
- * start: new Date("2025-01-20T14:00:00Z"),
829
- * duration: 1800000, // 30 minutes
830
- * occurrences: [
831
- * {
832
- * occurrence: new Date("2025-01-27T14:00:00Z"),
833
- * tags: { [Tag.Skip]: [{ email: "user@example.com" }] }
834
- * },
835
- * {
836
- * occurrence: new Date("2025-02-03T14:00:00Z"),
837
- * start: new Date("2025-02-03T15:00:00Z"), // Reschedule this one
838
- * tags: { [Tag.Attend]: [{ email: "user@example.com" }] }
839
- * }
840
- * ]
841
- * };
842
- * ```
843
- */
844
- occurrences?: NewActivityOccurrence[];
845
- /**
846
- * Dates to add to the recurrence exclusion list.
847
- * These are merged with existing exdates. Use this for incremental updates
848
- * (e.g., cancelling a single occurrence) instead of replacing the full list.
457
+ * Optional schedules to create alongside the thread.
849
458
  */
850
- addRecurrenceExdates?: Date[];
459
+ schedules?: Array<Omit<NewSchedule, "threadId">>;
851
460
  /**
852
- * Dates to remove from the recurrence exclusion list.
853
- * Use this to "uncancel" a previously excluded occurrence.
461
+ * Optional schedule occurrence overrides.
854
462
  */
855
- removeRecurrenceExdates?: Date[];
463
+ scheduleOccurrences?: NewScheduleOccurrence[];
856
464
  };
857
- export type ActivityFilter = {
858
- type?: ActorType;
465
+ export type ThreadFilter = {
859
466
  meta?: {
860
467
  [key: string]: JSONValue;
861
468
  };
862
469
  };
863
470
  /**
864
471
  * Fields supported by bulk updates via `match`. Only simple scalar fields
865
- * that can be applied uniformly across many activities are included.
472
+ * that can be applied uniformly across many threads are included.
866
473
  */
867
- type ActivityBulkUpdateFields = Partial<Pick<ActivityFields, "kind" | "title" | "private" | "archived" | "meta" | "order">> & {
868
- /** Update the type of all matching activities. */
869
- type?: ActivityType;
870
- /**
871
- * Timestamp when the activities were marked as complete. Null to clear.
872
- * Setting done will automatically set the type to Action if not already.
873
- */
874
- done?: Date | null;
875
- };
474
+ type ThreadBulkUpdateFields = Partial<Pick<ThreadFields, "title" | "private" | "archived">>;
876
475
  /**
877
- * Fields supported by single-activity updates via `id` or `source`.
878
- * Includes all bulk fields plus scheduling, recurrence, tags, and occurrences.
476
+ * Fields supported by single-thread updates via `id` or `source`.
477
+ * Includes all bulk fields plus tags and preview.
879
478
  */
880
- type ActivitySingleUpdateFields = ActivityBulkUpdateFields & Partial<Pick<ActivityFields, "start" | "end" | "assignee" | "recurrenceRule" | "recurrenceExdates" | "recurrenceUntil" | "recurrenceCount">> & {
479
+ type ThreadSingleUpdateFields = ThreadBulkUpdateFields & {
881
480
  /**
882
- * Tags to change on the activity. Use an empty array of NewActor to remove a tag.
481
+ * Tags to change on the thread. Use an empty array of NewActor to remove a tag.
883
482
  * Use twistTags to add/remove the twist from tags to avoid clearing other actors' tags.
884
483
  */
885
484
  tags?: NewTags;
886
485
  /**
887
486
  * Add or remove the twist's tags.
888
487
  * Maps tag ID to boolean: true = add tag, false = remove tag.
889
- * This is allowed on all activities the twist has access to.
488
+ * This is allowed on all threads the twist has access to.
890
489
  */
891
490
  twistTags?: Partial<Record<Tag, boolean>>;
892
491
  /**
893
- * Optional preview content for the activity. Can be Markdown formatted.
492
+ * Optional preview content for the thread. Can be Markdown formatted.
894
493
  * The preview will be automatically generated from this content (truncated to 100 chars).
895
494
  *
896
495
  * - string: Use this content for preview generation
897
496
  * - null: Explicitly disable preview (no preview will be shown)
898
497
  * - undefined (omitted): Preserve current preview value
899
498
  *
900
- * This field is write-only and won't be returned when reading activities.
499
+ * This field is write-only and won't be returned when reading threads.
901
500
  */
902
501
  preview?: string | null;
903
- /**
904
- * Create or update specific occurrences of this recurring activity.
905
- * Each entry specifies overrides for a specific occurrence.
906
- *
907
- * Setting a field to null reverts it to the series default.
908
- * Omitting a field leaves it unchanged.
909
- *
910
- * @example
911
- * ```typescript
912
- * // Update RSVPs for specific occurrences
913
- * await plot.updateActivity({
914
- * id: meetingId,
915
- * occurrences: [
916
- * {
917
- * occurrence: new Date("2025-01-27T14:00:00Z"),
918
- * tags: { [Tag.Skip]: [user] }
919
- * },
920
- * {
921
- * occurrence: new Date("2025-02-03T14:00:00Z"),
922
- * tags: { [Tag.Attend]: [user] }
923
- * },
924
- * {
925
- * occurrence: new Date("2025-02-10T14:00:00Z"),
926
- * archived: true // Cancel this occurrence
927
- * }
928
- * ]
929
- * });
930
- * ```
931
- */
932
- occurrences?: (NewActivityOccurrence | ActivityOccurrenceUpdate)[];
933
- /**
934
- * Dates to add to the recurrence exclusion list.
935
- * These are merged with existing exdates. Use this for incremental updates
936
- * (e.g., cancelling a single occurrence) instead of replacing the full list.
937
- */
938
- addRecurrenceExdates?: Date[];
939
- /**
940
- * Dates to remove from the recurrence exclusion list.
941
- * Use this to "uncancel" a previously excluded occurrence.
942
- */
943
- removeRecurrenceExdates?: Date[];
944
502
  };
945
- export type ActivityUpdate = (({
503
+ export type ThreadUpdate = (({
946
504
  id: Uuid;
947
505
  } | {
948
506
  source: string;
949
- }) & ActivitySingleUpdateFields) | ({
507
+ }) & ThreadSingleUpdateFields) | ({
950
508
  /**
951
- * Update all activities matching the specified criteria. Only activities
509
+ * Update all threads matching the specified criteria. Only threads
952
510
  * that match all provided fields and were created by the twist will be updated.
953
511
  */
954
- match: ActivityFilter;
955
- } & ActivityBulkUpdateFields);
512
+ match: ThreadFilter;
513
+ } & ThreadBulkUpdateFields);
956
514
  /**
957
- * Represents a note within an activity.
515
+ * Represents a note within a thread.
958
516
  *
959
- * Notes contain the detailed content (note text, links) associated with an activity.
960
- * They are always ordered by creation time within their parent activity.
517
+ * Notes contain the detailed content (note text, actions) associated with a thread.
518
+ * They are always ordered by creation time within their parent thread.
961
519
  */
962
- export type Note = ActivityCommon & {
520
+ export type Note = ThreadCommon & {
521
+ /** The author of this note */
522
+ author: Actor;
963
523
  /**
964
- * Globally unique, stable identifier for the note within its activity.
524
+ * Globally unique, stable identifier for the note within its thread.
965
525
  * Can be used to upsert without knowing the id.
966
526
  *
967
527
  * Use one of these patterns:
@@ -973,15 +533,15 @@ export type Note = ActivityCommon & {
973
533
  * - `"comment:12345"` (for a specific comment by ID)
974
534
  * - `"gmail:msg:18d4e5f2a3b1c9d7"` (for a Gmail message within a thread)
975
535
  *
976
- * ⚠️ Ensure IDs are immutable - avoid human-readable slugs or titles.
536
+ * Ensure IDs are immutable - avoid human-readable slugs or titles.
977
537
  */
978
538
  key: string | null;
979
- /** The parent activity this note belongs to */
980
- activity: Activity;
539
+ /** The parent thread this note belongs to */
540
+ thread: Thread;
981
541
  /** Primary content for the note (markdown) */
982
542
  content: string | null;
983
- /** Array of interactive links attached to the note */
984
- links: Array<ActivityLink> | null;
543
+ /** Array of interactive actions attached to the note */
544
+ actions: Array<Action> | null;
985
545
  /** The note this is a reply to, or null if not a reply */
986
546
  reNote: {
987
547
  id: Uuid;
@@ -990,19 +550,19 @@ export type Note = ActivityCommon & {
990
550
  /**
991
551
  * Type for creating new notes.
992
552
  *
993
- * Requires the activity reference, with all other fields optional.
553
+ * Requires the thread reference, with all other fields optional.
994
554
  * Can provide id, key, or neither for note identification:
995
555
  * - id: Provide a specific UUID for the note
996
- * - key: Provide an external identifier for upsert within the activity
556
+ * - key: Provide an external identifier for upsert within the thread
997
557
  * - neither: A new note with auto-generated UUID will be created
998
558
  */
999
- export type NewNote = Partial<Omit<Note, "author" | "activity" | "tags" | "mentions" | "id" | "key" | "reNote">> & ({
559
+ export type NewNote = Partial<Omit<Note, "author" | "thread" | "tags" | "mentions" | "id" | "key" | "reNote">> & ({
1000
560
  id: Uuid;
1001
561
  } | {
1002
562
  key: string;
1003
563
  } | {}) & {
1004
- /** Reference to the parent activity (required) */
1005
- activity: Pick<Activity, "id"> | {
564
+ /** Reference to the parent thread (required) */
565
+ thread: Pick<Thread, "id"> | {
1006
566
  source: string;
1007
567
  };
1008
568
  /**
@@ -1017,7 +577,7 @@ export type NewNote = Partial<Omit<Note, "author" | "activity" | "tags" | "menti
1017
577
  */
1018
578
  contentType?: ContentType;
1019
579
  /**
1020
- * Tags to change on the activity. Use an empty array of NewActor to remove a tag.
580
+ * Tags to change on the thread. Use an empty array of NewActor to remove a tag.
1021
581
  * Use twistTags to add/remove the twist from tags to avoid clearing other actors' tags.
1022
582
  */
1023
583
  tags?: NewTags;
@@ -1026,11 +586,11 @@ export type NewNote = Partial<Omit<Note, "author" | "activity" | "tags" | "menti
1026
586
  */
1027
587
  mentions?: NewActor[];
1028
588
  /**
1029
- * Whether the note should mark the parent activity as unread for users.
1030
- * - undefined/omitted (default): Activity is unread for users, except auto-marked
589
+ * Whether the note should mark the parent thread as unread for users.
590
+ * - undefined/omitted (default): Thread is unread for users, except auto-marked
1031
591
  * as read for the author if they are the twist owner (user)
1032
- * - true: Activity is explicitly unread for ALL users (use sparingly)
1033
- * - false: Activity is marked as read for all users in the priority at note creation time
592
+ * - true: Thread is explicitly unread for ALL users (use sparingly)
593
+ * - false: Thread is marked as read for all users in the priority at note creation time
1034
594
  *
1035
595
  * For the default behavior, omit this field entirely.
1036
596
  * Use false for initial sync to avoid marking historical items as unread.
@@ -1058,7 +618,7 @@ export type NoteUpdate = ({
1058
618
  key?: string;
1059
619
  } | {
1060
620
  key: string;
1061
- }) & Partial<Pick<Note, "private" | "archived" | "content" | "links" | "reNote">> & {
621
+ }) & Partial<Pick<Note, "private" | "archived" | "content" | "actions" | "reNote">> & {
1062
622
  /**
1063
623
  * Format of the note content. Determines how the note is processed:
1064
624
  * - 'text': Plain text that will be converted to markdown (auto-links URLs, preserves line breaks)
@@ -1085,7 +645,7 @@ export type NoteUpdate = ({
1085
645
  /**
1086
646
  * Represents an actor in Plot - a user, contact, or twist.
1087
647
  *
1088
- * Actors can be associated with activities as authors, assignees, or mentions.
648
+ * Actors can be associated with threads as authors, assignees, or mentions.
1089
649
  * The email field is only included when ContactAccess.Read permission is granted.
1090
650
  *
1091
651
  * @example
@@ -1126,17 +686,17 @@ export type NewActor = {
1126
686
  id: ActorId;
1127
687
  } | NewContact;
1128
688
  /**
1129
- * Enumeration of author types that can create activities.
689
+ * Enumeration of author types that can create threads.
1130
690
  *
1131
- * The author type affects how activities are displayed and processed
691
+ * The author type affects how threads are displayed and processed
1132
692
  * within the Plot system.
1133
693
  */
1134
694
  export declare enum ActorType {
1135
- /** Activities created by human users */
695
+ /** Threads created by human users */
1136
696
  User = 0,
1137
- /** Activities created by external contacts */
697
+ /** Threads created by external contacts */
1138
698
  Contact = 1,
1139
- /** Activities created by automated twists */
699
+ /** Threads created by automated twists */
1140
700
  Twist = 2
1141
701
  }
1142
702
  /**
@@ -1172,4 +732,119 @@ export type NewContact = {
1172
732
  };
1173
733
  };
1174
734
  export type ContentType = "text" | "markdown" | "html";
735
+ /**
736
+ * Represents an external entity linked to a thread.
737
+ *
738
+ * Links are created by sources to represent external entities (issues, emails, calendar events)
739
+ * attached to a thread container. A thread can have multiple links (1:many).
740
+ * Links store source-specific data like type, status, metadata, and embeddings.
741
+ *
742
+ * @example
743
+ * ```typescript
744
+ * // A link representing a Linear issue
745
+ * const link: Link = {
746
+ * id: "..." as Uuid,
747
+ * threadId: "..." as Uuid,
748
+ * source: "linear:issue:549dd8bd-2bc9-43d1-95d5-4b4af0c5af1b",
749
+ * created: new Date(),
750
+ * author: { id: "..." as ActorId, type: ActorType.Contact, name: "Alice" },
751
+ * title: "Fix login bug",
752
+ * type: "issue",
753
+ * status: "open",
754
+ * meta: { projectId: "TEAM", url: "https://linear.app/team/TEAM-123" },
755
+ * assignee: null,
756
+ * actions: null,
757
+ * };
758
+ * ```
759
+ */
760
+ export type Link = {
761
+ /** Unique identifier for the link */
762
+ id: Uuid;
763
+ /** The thread this link belongs to */
764
+ threadId: Uuid;
765
+ /** External source identifier for dedup/upsert */
766
+ source: string | null;
767
+ /** When this link was originally created in its source system */
768
+ created: Date;
769
+ /** The actor credited with creating this link */
770
+ author: Actor | null;
771
+ /** Display title */
772
+ title: string;
773
+ /** Truncated preview */
774
+ preview: string | null;
775
+ /** The actor assigned to this link */
776
+ assignee: Actor | null;
777
+ /** Source-defined type string (e.g., issue, pull_request, email, event) */
778
+ type: string | null;
779
+ /** Source-defined status string (e.g., open, done, closed) */
780
+ status: string | null;
781
+ /** Interactive action buttons */
782
+ actions: Array<Action> | null;
783
+ /** Source metadata */
784
+ meta: ThreadMeta | null;
785
+ /** URL to open the original item in its source application (e.g., "Open in Linear") */
786
+ sourceUrl: string | null;
787
+ /** Channel ID that produced this link (matches source_channel.channel_id) */
788
+ channelId: string | null;
789
+ };
790
+ /**
791
+ * Type for creating new links.
792
+ *
793
+ * Links are created by sources to represent external entities.
794
+ * Requires a source identifier for dedup/upsert.
795
+ */
796
+ export type NewLink = ({
797
+ /** Unique identifier for the link, generated by Uuid.Generate() */
798
+ id: Uuid;
799
+ } | {
800
+ /**
801
+ * Canonical ID for the item in an external system.
802
+ * When set, uniquely identifies the link within a priority tree. This performs
803
+ * an upsert.
804
+ */
805
+ source: string;
806
+ } | {}) & Partial<Omit<Link, "id" | "source" | "author" | "assignee" | "threadId">> & {
807
+ /** The person that created the item. By default, it will be the twist itself. */
808
+ author?: NewActor;
809
+ /** The person assigned to the item. */
810
+ assignee?: NewActor | null;
811
+ /**
812
+ * Whether the thread should be marked as unread for users.
813
+ * - undefined/omitted (default): Thread is unread for users, except auto-marked
814
+ * as read for the author if they are the twist owner (user)
815
+ * - false: Thread is marked as read for all users in the priority at creation time
816
+ */
817
+ unread?: boolean;
818
+ /**
819
+ * Whether the thread is archived.
820
+ * - true: Archive the thread
821
+ * - false: Unarchive the thread
822
+ * - undefined (default): Preserve current archive state
823
+ */
824
+ archived?: boolean;
825
+ /**
826
+ * Configuration for automatic priority selection based on similarity.
827
+ * Only used when the link creates a new thread.
828
+ */
829
+ pickPriority?: PickPriorityConfig;
830
+ /**
831
+ * Explicit priority (disables automatic priority matching).
832
+ * Only used when the link creates a new thread.
833
+ */
834
+ priority?: Pick<Priority, "id">;
835
+ };
836
+ /**
837
+ * A new link with notes to save via integrations.saveLink().
838
+ * Creates a thread+link pair, with notes attached to the thread.
839
+ */
840
+ export type NewLinkWithNotes = NewLink & {
841
+ /** Title for the link and its thread container */
842
+ title: string;
843
+ /** Notes to attach to the thread */
844
+ notes?: Omit<NewNote, "thread">[];
845
+ /** Schedules to create for the link */
846
+ schedules?: Array<Omit<NewSchedule, "threadId">>;
847
+ /** Schedule occurrence overrides */
848
+ scheduleOccurrences?: NewScheduleOccurrence[];
849
+ };
1175
850
  //# sourceMappingURL=plot.d.ts.map