@plotday/twister 0.22.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +35 -6
  3. package/bin/commands/deploy.js +234 -2
  4. package/bin/commands/deploy.js.map +1 -1
  5. package/bin/commands/generate.js +11 -2
  6. package/bin/commands/generate.js.map +1 -1
  7. package/bin/commands/login.js +19 -3
  8. package/bin/commands/login.js.map +1 -1
  9. package/bin/commands/priority-create.js +7 -2
  10. package/bin/commands/priority-create.js.map +1 -1
  11. package/bin/commands/priority-list.js +6 -1
  12. package/bin/commands/priority-list.js.map +1 -1
  13. package/bin/commands/twist-logs.js +12 -3
  14. package/bin/commands/twist-logs.js.map +1 -1
  15. package/bin/templates/AGENTS.template.md +109 -20
  16. package/bin/utils/bundle.js +40 -0
  17. package/bin/utils/bundle.js.map +1 -1
  18. package/bin/utils/network-error.js +149 -0
  19. package/bin/utils/network-error.js.map +1 -0
  20. package/cli/templates/AGENTS.template.md +109 -20
  21. package/dist/common/calendar.d.ts +10 -2
  22. package/dist/common/calendar.d.ts.map +1 -1
  23. package/dist/common/projects.d.ts +123 -0
  24. package/dist/common/projects.d.ts.map +1 -0
  25. package/dist/common/projects.js +2 -0
  26. package/dist/common/projects.js.map +1 -0
  27. package/dist/docs/assets/hierarchy.js +1 -1
  28. package/dist/docs/assets/highlight.css +4 -4
  29. package/dist/docs/assets/navigation.js +1 -1
  30. package/dist/docs/assets/search.js +1 -1
  31. package/dist/docs/classes/tool.Tool.html +5 -5
  32. package/dist/docs/classes/tools_ai.AI.html +3 -3
  33. package/dist/docs/classes/tools_callbacks.Callbacks.html +4 -4
  34. package/dist/docs/classes/tools_integrations.Integrations.html +1 -1
  35. package/dist/docs/classes/tools_network.Network.html +4 -4
  36. package/dist/docs/classes/tools_plot.Plot.html +28 -14
  37. package/dist/docs/classes/tools_store.Store.html +1 -1
  38. package/dist/docs/classes/tools_tasks.Tasks.html +2 -2
  39. package/dist/docs/classes/tools_twists.Twists.html +4 -4
  40. package/dist/docs/classes/twist.Twist.html +1 -1
  41. package/dist/docs/documents/Building_Custom_Tools.html +6 -6
  42. package/dist/docs/documents/Built-in_Tools.html +24 -17
  43. package/dist/docs/documents/Core_Concepts.html +42 -9
  44. package/dist/docs/documents/Getting_Started.html +10 -3
  45. package/dist/docs/documents/Runtime_Environment.html +7 -7
  46. package/dist/docs/enums/plot.ActivityLinkType.html +5 -5
  47. package/dist/docs/enums/plot.ActivityType.html +4 -4
  48. package/dist/docs/enums/plot.ActorType.html +4 -4
  49. package/dist/docs/enums/plot.ConferencingProvider.html +6 -6
  50. package/dist/docs/enums/tag.Tag.html +3 -4
  51. package/dist/docs/enums/tools_plot.ActivityAccess.html +3 -3
  52. package/dist/docs/enums/tools_plot.ContactAccess.html +3 -3
  53. package/dist/docs/enums/tools_plot.PriorityAccess.html +3 -3
  54. package/dist/docs/hierarchy.html +1 -1
  55. package/dist/docs/interfaces/common_calendar.CalendarTool.html +13 -7
  56. package/dist/docs/interfaces/tools_ai.AIResponse.html +2 -2
  57. package/dist/docs/interfaces/tools_twists.TwistSource.html +1 -1
  58. package/dist/docs/modules/index.html +1 -1
  59. package/dist/docs/modules/plot.html +1 -1
  60. package/dist/docs/types/plot.Activity.html +28 -7
  61. package/dist/docs/types/plot.ActivityCommon.html +10 -8
  62. package/dist/docs/types/plot.ActivityLink.html +1 -1
  63. package/dist/docs/types/plot.ActivityMeta.html +24 -6
  64. package/dist/docs/types/plot.ActivityUpdate.html +2 -2
  65. package/dist/docs/types/plot.ActivityWithNotes.html +1 -1
  66. package/dist/docs/types/plot.Actor.html +5 -5
  67. package/dist/docs/types/plot.ActorId.html +8 -3
  68. package/dist/docs/types/plot.ContentType.html +1 -0
  69. package/dist/docs/types/plot.NewActivity.html +18 -3
  70. package/dist/docs/types/plot.NewActivityWithNotes.html +1 -1
  71. package/dist/docs/types/plot.NewContact.html +4 -4
  72. package/dist/docs/types/plot.NewNote.html +9 -3
  73. package/dist/docs/types/plot.NewPriority.html +1 -1
  74. package/dist/docs/types/plot.Note.html +3 -3
  75. package/dist/docs/types/plot.NoteUpdate.html +4 -4
  76. package/dist/docs/types/plot.PickPriorityConfig.html +3 -3
  77. package/dist/docs/types/plot.Priority.html +3 -3
  78. package/dist/docs/types/plot.Tags.html +1 -0
  79. package/dist/docs/types/tools_ai.DataContent.html +1 -1
  80. package/dist/docs/types/tools_network.WebhookRequest.html +5 -3
  81. package/dist/docs/types/tools_plot.NoteIntentHandler.html +4 -4
  82. package/dist/llm-docs/common/calendar.d.ts +2 -2
  83. package/dist/llm-docs/common/calendar.d.ts.map +1 -1
  84. package/dist/llm-docs/common/calendar.js +2 -2
  85. package/dist/llm-docs/common/calendar.js.map +1 -1
  86. package/dist/llm-docs/common/messaging.d.ts +1 -1
  87. package/dist/llm-docs/common/messaging.js +1 -1
  88. package/dist/llm-docs/common/projects.d.ts +9 -0
  89. package/dist/llm-docs/common/projects.d.ts.map +1 -0
  90. package/dist/llm-docs/common/projects.js +8 -0
  91. package/dist/llm-docs/common/projects.js.map +1 -0
  92. package/dist/llm-docs/index.d.ts +1 -1
  93. package/dist/llm-docs/index.js +17 -17
  94. package/dist/llm-docs/index.js.map +1 -1
  95. package/dist/llm-docs/plot.d.ts +2 -2
  96. package/dist/llm-docs/plot.d.ts.map +1 -1
  97. package/dist/llm-docs/plot.js +2 -2
  98. package/dist/llm-docs/plot.js.map +1 -1
  99. package/dist/llm-docs/tag.d.ts +2 -2
  100. package/dist/llm-docs/tag.d.ts.map +1 -1
  101. package/dist/llm-docs/tag.js +2 -2
  102. package/dist/llm-docs/tag.js.map +1 -1
  103. package/dist/llm-docs/tool.d.ts +2 -2
  104. package/dist/llm-docs/tool.d.ts.map +1 -1
  105. package/dist/llm-docs/tool.js +2 -2
  106. package/dist/llm-docs/tool.js.map +1 -1
  107. package/dist/llm-docs/tools/ai.d.ts +2 -2
  108. package/dist/llm-docs/tools/ai.d.ts.map +1 -1
  109. package/dist/llm-docs/tools/ai.js +2 -2
  110. package/dist/llm-docs/tools/ai.js.map +1 -1
  111. package/dist/llm-docs/tools/callbacks.d.ts +2 -2
  112. package/dist/llm-docs/tools/callbacks.d.ts.map +1 -1
  113. package/dist/llm-docs/tools/callbacks.js +2 -2
  114. package/dist/llm-docs/tools/callbacks.js.map +1 -1
  115. package/dist/llm-docs/tools/integrations.d.ts +1 -1
  116. package/dist/llm-docs/tools/integrations.js +1 -1
  117. package/dist/llm-docs/tools/network.d.ts +2 -2
  118. package/dist/llm-docs/tools/network.d.ts.map +1 -1
  119. package/dist/llm-docs/tools/network.js +2 -2
  120. package/dist/llm-docs/tools/network.js.map +1 -1
  121. package/dist/llm-docs/tools/plot.d.ts +2 -2
  122. package/dist/llm-docs/tools/plot.d.ts.map +1 -1
  123. package/dist/llm-docs/tools/plot.js +2 -2
  124. package/dist/llm-docs/tools/plot.js.map +1 -1
  125. package/dist/llm-docs/tools/store.d.ts +1 -1
  126. package/dist/llm-docs/tools/store.js +1 -1
  127. package/dist/llm-docs/tools/tasks.d.ts +1 -1
  128. package/dist/llm-docs/tools/tasks.js +1 -1
  129. package/dist/llm-docs/tools/twists.d.ts +2 -2
  130. package/dist/llm-docs/tools/twists.d.ts.map +1 -1
  131. package/dist/llm-docs/tools/twists.js +2 -2
  132. package/dist/llm-docs/tools/twists.js.map +1 -1
  133. package/dist/llm-docs/twist-guide-template.d.ts +1 -1
  134. package/dist/llm-docs/twist-guide-template.d.ts.map +1 -1
  135. package/dist/llm-docs/twist-guide-template.js +1 -1
  136. package/dist/llm-docs/twist-guide-template.js.map +1 -1
  137. package/dist/llm-docs/twist.d.ts +1 -1
  138. package/dist/llm-docs/twist.js +1 -1
  139. package/dist/plot.d.ts +203 -35
  140. package/dist/plot.d.ts.map +1 -1
  141. package/dist/plot.js.map +1 -1
  142. package/dist/tag.d.ts +2 -3
  143. package/dist/tag.d.ts.map +1 -1
  144. package/dist/tag.js +2 -3
  145. package/dist/tag.js.map +1 -1
  146. package/dist/tool.d.ts +2 -2
  147. package/dist/tool.d.ts.map +1 -1
  148. package/dist/tool.js +1 -1
  149. package/dist/tool.js.map +1 -1
  150. package/dist/tools/ai.d.ts +2 -2
  151. package/dist/tools/ai.d.ts.map +1 -1
  152. package/dist/tools/callbacks.d.ts +1 -1
  153. package/dist/tools/callbacks.d.ts.map +1 -1
  154. package/dist/tools/network.d.ts +2 -0
  155. package/dist/tools/network.d.ts.map +1 -1
  156. package/dist/tools/network.js.map +1 -1
  157. package/dist/tools/plot.d.ts +36 -4
  158. package/dist/tools/plot.d.ts.map +1 -1
  159. package/dist/tools/plot.js.map +1 -1
  160. package/dist/tools/twists.d.ts +2 -2
  161. package/dist/twist-guide.d.ts +1 -1
  162. package/dist/twist-guide.d.ts.map +1 -1
  163. package/package.json +52 -2
  164. package/tsconfig.base.json +1 -0
  165. package/dist/docs/types/plot.NoteType.html +0 -1
  166. package/dist/llm-docs/creator-docs.d.ts +0 -9
  167. package/dist/llm-docs/creator-docs.d.ts.map +0 -1
  168. package/dist/llm-docs/creator-docs.js +0 -8
  169. package/dist/llm-docs/creator-docs.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Generated LLM documentation for @plotday/sdk/tools/twists
2
+ * Generated LLM documentation for @plotday/twister/tools/twists
3
3
  *
4
4
  * This file is auto-generated during build. Do not edit manually.
5
5
  * Generated from: prebuild.ts
6
6
  */
7
- export default "import { type Callback, ITool } from \"..\";\n\n/**\n * Twist source code structure containing dependencies and source files.\n */\nexport interface TwistSource {\n /**\n * Package dependencies with version specifiers\n * @example { \"@plotday/sdk\": \"workspace:^\", \"@plotday/tool-google-calendar\": \"^1.0.0\" }\n */\n dependencies: Record<string, string>;\n\n /**\n * Source files with their content\n * Must include \"index.ts\" as the entry point\n * @example { \"index.ts\": \"export default class MyTwist extends Twist {...}\" }\n */\n files: Record<string, string>;\n}\n\n/**\n * Represents a log entry from a twist execution.\n */\nexport type Log = {\n timestamp: Date;\n environment: \"personal\" | \"private\" | \"review\" | \"public\";\n severity: \"log\" | \"error\" | \"warn\" | \"info\";\n message: string;\n};\n\n/**\n * Twist permissions returned after deployment.\n * Nested structure mapping domains to entities to permission flags.\n *\n * Format: { domain: { entity: flags[] } }\n * - domain: Tool name (e.g., \"network\", \"plot\")\n * - entity: Domain-specific identifier (e.g., URL pattern, resource type)\n * - flags: Array of permission flags (\"read\", \"write\", \"update\", \"use\")\n *\n * @example\n * ```typescript\n * {\n * \"network\": {\n * \"https://api.example.com/*\": [\"use\"],\n * \"https://googleapis.com/*\": [\"use\"]\n * },\n * \"plot\": {\n * \"activity:mentioned\": [\"read\", \"write\", \"update\"],\n * \"priority\": [\"read\", \"write\", \"update\"]\n * }\n * }\n * ```\n */\nexport type TwistPermissions = Record<string, Record<string, string[]>>;\n\n/**\n * Built-in tool for managing twists and deployments.\n *\n * The Twists tool provides twists with the ability to create twist IDs\n * and programmatically deploy twists.\n *\n * @example\n * ```typescript\n * class TwistBuilderTwist extends Twist {\n * build(build: ToolBuilder) {\n * return {\n * twists: build.get(Twists)\n * }\n * }\n *\n * async activate() {\n * const twistId = await this.tools.twists.create();\n * // Display twist ID to user\n * }\n * }\n * ```\n */\nexport abstract class Twists extends ITool {\n /**\n * Creates a new twist ID and grants access to people in the current priority.\n *\n * @returns Promise resolving to the generated twist ID\n * @throws When twist creation fails\n *\n * @example\n * ```typescript\n * const twistId = await twist.create();\n * console.log(`Your twist ID: ${twistId}`);\n * ```\n */\n abstract create(): Promise<string>;\n\n /**\n * Generates twist source code from a specification using AI.\n *\n * This method uses Claude AI to generate TypeScript source code and dependencies\n * from a markdown specification. The generated source is validated by attempting\n * to build it, with iterative error correction (up to 3 attempts).\n *\n * @param spec - Markdown specification describing the twist functionality\n * @returns Promise resolving to twist source (dependencies and files)\n * @throws When generation fails after maximum attempts\n *\n * @example\n * ```typescript\n * const source = await twist.generate(`\n * # Calendar Sync Twist\n *\n * This twist syncs Google Calendar events to Plot activities.\n *\n * ## Features\n * - Authenticate with Google\n * - Sync calendar events\n * - Create activities from events\n * `);\n *\n * // source.dependencies: { \"@plotday/sdk\": \"workspace:^\", ... }\n * // source.files: { \"index.ts\": \"export default class...\" }\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n abstract generate(spec: string): Promise<TwistSource>;\n\n /**\n * Deploys a twist programmatically.\n *\n * This method provides the same functionality as the plot deploy CLI\n * command, but can be called from within a twist. Accepts either:\n * - A pre-bundled module (JavaScript code)\n * - A source object (dependencies + files) which is built in a sandbox\n *\n * @param options - Deployment configuration\n * @param options.twistId - Twist ID for deployment\n * @param options.module - Pre-bundled twist module code (mutually exclusive with source)\n * @param options.source - Twist source code with dependencies (mutually exclusive with module)\n * @param options.environment - Target environment (defaults to \"personal\")\n * @param options.name - Optional twist name (required for first deploy)\n * @param options.description - Optional twist description (required for first deploy)\n * @param options.dryRun - If true, validates without deploying (returns errors if any)\n * @returns Promise resolving to deployment result with version and optional errors\n * @throws When deployment fails or user lacks access\n *\n * @example\n * ```typescript\n * // Deploy with a module\n * const result = await twist.deploy({\n * twistId: 'abc-123-...',\n * module: 'export default class MyTwist extends Twist {...}',\n * environment: 'personal',\n * name: 'My Twist',\n * description: 'Does something cool'\n * });\n * console.log(`Deployed version ${result.version}`);\n *\n * // Deploy with source\n * const source = await twist.generate(spec);\n * const result = await twist.deploy({\n * twistId: 'abc-123-...',\n * source,\n * environment: 'personal',\n * name: 'My Twist',\n * });\n *\n * // Validate with dryRun\n * const result = await twist.deploy({\n * twistId: 'abc-123-...',\n * source,\n * dryRun: true,\n * });\n * if (result.errors?.length) {\n * console.error('Build errors:', result.errors);\n * }\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n abstract deploy(\n options: {\n twistId: string;\n environment?: \"personal\" | \"private\" | \"review\";\n name?: string;\n description?: string;\n dryRun?: boolean;\n } & (\n | {\n module: string;\n }\n | {\n source: TwistSource;\n }\n )\n ): Promise<{\n version: string;\n permissions: TwistPermissions;\n errors?: string[];\n }>;\n\n /**\n * Subscribes to logs from a twist.\n *\n * This method registers a callback to receive batches of logs from twist executions.\n * The callback will be invoked with an array of logs whenever new logs are captured\n * from the twist's console output.\n *\n * @param twistId - Twist ID (root ID) to watch logs for\n * @param callback - Callback token created via CallbackTool that will receive log batches\n * @returns Promise that resolves when the subscription is created\n * @throws When subscription fails\n *\n * @example\n * ```typescript\n * // Create twist and callback\n * const twistId = await this.twist.create();\n * const callback = await this.callback.create(\"onLogs\");\n *\n * // Subscribe to logs\n * await this.twist.watchLogs(twistId, callback);\n *\n * // Implement handler\n * async onLogs(logs: Log[]) {\n * for (const log of logs) {\n * console.log(`[${log.environment}] ${log.severity}: ${log.message}`);\n * }\n * }\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n abstract watchLogs(twistId: string, callback: Callback): Promise<void>;\n}\n";
7
+ export default "import { type Callback, ITool } from \"..\";\n\n/**\n * Twist source code structure containing dependencies and source files.\n */\nexport interface TwistSource {\n /**\n * Package dependencies with version specifiers\n * @example { \"@plotday/twister\": \"workspace:^\", \"@plotday/tool-google-calendar\": \"^1.0.0\" }\n */\n dependencies: Record<string, string>;\n\n /**\n * Source files with their content\n * Must include \"index.ts\" as the entry point\n * @example { \"index.ts\": \"export default class MyTwist extends Twist {...}\" }\n */\n files: Record<string, string>;\n}\n\n/**\n * Represents a log entry from a twist execution.\n */\nexport type Log = {\n timestamp: Date;\n environment: \"personal\" | \"private\" | \"review\" | \"public\";\n severity: \"log\" | \"error\" | \"warn\" | \"info\";\n message: string;\n};\n\n/**\n * Twist permissions returned after deployment.\n * Nested structure mapping domains to entities to permission flags.\n *\n * Format: { domain: { entity: flags[] } }\n * - domain: Tool name (e.g., \"network\", \"plot\")\n * - entity: Domain-specific identifier (e.g., URL pattern, resource type)\n * - flags: Array of permission flags (\"read\", \"write\", \"update\", \"use\")\n *\n * @example\n * ```typescript\n * {\n * \"network\": {\n * \"https://api.example.com/*\": [\"use\"],\n * \"https://googleapis.com/*\": [\"use\"]\n * },\n * \"plot\": {\n * \"activity:mentioned\": [\"read\", \"write\", \"update\"],\n * \"priority\": [\"read\", \"write\", \"update\"]\n * }\n * }\n * ```\n */\nexport type TwistPermissions = Record<string, Record<string, string[]>>;\n\n/**\n * Built-in tool for managing twists and deployments.\n *\n * The Twists tool provides twists with the ability to create twist IDs\n * and programmatically deploy twists.\n *\n * @example\n * ```typescript\n * class TwistBuilderTwist extends Twist {\n * build(build: ToolBuilder) {\n * return {\n * twists: build.get(Twists)\n * }\n * }\n *\n * async activate() {\n * const twistId = await this.tools.twists.create();\n * // Display twist ID to user\n * }\n * }\n * ```\n */\nexport abstract class Twists extends ITool {\n /**\n * Creates a new twist ID and grants access to people in the current priority.\n *\n * @returns Promise resolving to the generated twist ID\n * @throws When twist creation fails\n *\n * @example\n * ```typescript\n * const twistId = await twist.create();\n * console.log(`Your twist ID: ${twistId}`);\n * ```\n */\n abstract create(): Promise<string>;\n\n /**\n * Generates twist source code from a specification using AI.\n *\n * This method uses Claude AI to generate TypeScript source code and dependencies\n * from a markdown specification. The generated source is validated by attempting\n * to build it, with iterative error correction (up to 3 attempts).\n *\n * @param spec - Markdown specification describing the twist functionality\n * @returns Promise resolving to twist source (dependencies and files)\n * @throws When generation fails after maximum attempts\n *\n * @example\n * ```typescript\n * const source = await twist.generate(`\n * # Calendar Sync Twist\n *\n * This twist syncs Google Calendar events to Plot activities.\n *\n * ## Features\n * - Authenticate with Google\n * - Sync calendar events\n * - Create activities from events\n * `);\n *\n * // source.dependencies: { \"@plotday/twister\": \"workspace:^\", ... }\n * // source.files: { \"index.ts\": \"export default class...\" }\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n abstract generate(spec: string): Promise<TwistSource>;\n\n /**\n * Deploys a twist programmatically.\n *\n * This method provides the same functionality as the plot deploy CLI\n * command, but can be called from within a twist. Accepts either:\n * - A pre-bundled module (JavaScript code)\n * - A source object (dependencies + files) which is built in a sandbox\n *\n * @param options - Deployment configuration\n * @param options.twistId - Twist ID for deployment\n * @param options.module - Pre-bundled twist module code (mutually exclusive with source)\n * @param options.source - Twist source code with dependencies (mutually exclusive with module)\n * @param options.environment - Target environment (defaults to \"personal\")\n * @param options.name - Optional twist name (required for first deploy)\n * @param options.description - Optional twist description (required for first deploy)\n * @param options.dryRun - If true, validates without deploying (returns errors if any)\n * @returns Promise resolving to deployment result with version and optional errors\n * @throws When deployment fails or user lacks access\n *\n * @example\n * ```typescript\n * // Deploy with a module\n * const result = await twist.deploy({\n * twistId: 'abc-123-...',\n * module: 'export default class MyTwist extends Twist {...}',\n * environment: 'personal',\n * name: 'My Twist',\n * description: 'Does something cool'\n * });\n * console.log(`Deployed version ${result.version}`);\n *\n * // Deploy with source\n * const source = await twist.generate(spec);\n * const result = await twist.deploy({\n * twistId: 'abc-123-...',\n * source,\n * environment: 'personal',\n * name: 'My Twist',\n * });\n *\n * // Validate with dryRun\n * const result = await twist.deploy({\n * twistId: 'abc-123-...',\n * source,\n * dryRun: true,\n * });\n * if (result.errors?.length) {\n * console.error('Build errors:', result.errors);\n * }\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n abstract deploy(\n options: {\n twistId: string;\n environment?: \"personal\" | \"private\" | \"review\";\n name?: string;\n description?: string;\n dryRun?: boolean;\n } & (\n | {\n module: string;\n }\n | {\n source: TwistSource;\n }\n )\n ): Promise<{\n version: string;\n permissions: TwistPermissions;\n errors?: string[];\n }>;\n\n /**\n * Subscribes to logs from a twist.\n *\n * This method registers a callback to receive batches of logs from twist executions.\n * The callback will be invoked with an array of logs whenever new logs are captured\n * from the twist's console output.\n *\n * @param twistId - Twist ID (root ID) to watch logs for\n * @param callback - Callback token created via CallbackTool that will receive log batches\n * @returns Promise that resolves when the subscription is created\n * @throws When subscription fails\n *\n * @example\n * ```typescript\n * // Create twist and callback\n * const twistId = await this.twist.create();\n * const callback = await this.callback.create(\"onLogs\");\n *\n * // Subscribe to logs\n * await this.twist.watchLogs(twistId, callback);\n *\n * // Implement handler\n * async onLogs(logs: Log[]) {\n * for (const log of logs) {\n * console.log(`[${log.environment}] ${log.severity}: ${log.message}`);\n * }\n * }\n * ```\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n abstract watchLogs(twistId: string, callback: Callback): Promise<void>;\n}\n";
8
8
  //# sourceMappingURL=twists.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"twists.js","sourceRoot":"","sources":["../../../src/llm-docs/tools/twists.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAe,kuOAAkuO,CAAC"}
1
+ {"version":3,"file":"twists.js","sourceRoot":"","sources":["../../../src/llm-docs/tools/twists.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAe,0uOAA0uO,CAAC"}
@@ -4,6 +4,6 @@
4
4
  * This file is auto-generated during build. Do not edit manually.
5
5
  * Generated from: cli/templates/AGENTS.template.md
6
6
  */
7
- declare const _default: "# Twist Implementation Guide for LLMs\n\nThis document provides context for AI assistants generating or modifying twists.\n\n## Architecture Overview\n\nPlot Twists are TypeScript classes that extend the `Twist` base class. Twists interact with external services and Plot's core functionality through a tool-based architecture.\n\n### Runtime Environment\n\n**Critical**: All Twists and tool functions are executed in a sandboxed, ephemeral environment with limited resources:\n\n- **Memory is temporary**: Anything stored in memory (e.g. as a variable in the twist/tool object) is lost after the function completes. Use the Store tool instead. Only use memory for temporary caching.\n- **Limited CPU time**: Each execution has limited CPU time (typically 10 seconds) and memory (128MB)\n- **Use the Run tool**: Queue separate chunks of work with `run.now(functionName, context)`\n- **Break long operations**: Split large operations into smaller batches that can be processed independently\n- **Store intermediate state**: Use the Store tool to persist state between batches\n- **Examples**: Syncing large datasets, processing many API calls, or performing batch operations\n\n## twist Structure Pattern\n\n```typescript\nimport {\n type Activity,\n twist,\n type Priority,\n type ToolBuilder,\n} from \"@plotday/twister\";\nimport { Plot } from \"@plotday/twister/tools/plot\";\n\nexport default class MyTwist extends Twist<MyTwist> {\n build(build: ToolBuilder) {\n return {\n plot: build(Plot),\n };\n }\n\n async activate(priority: Pick<Priority, \"id\">) {\n // Called when twist is enabled for a priority\n // Common actions: request auth, create setup activities\n }\n\n async activity(activity: Activity) {\n // Called when an activity is routed to this twist\n // Common actions: process external events, update activities\n }\n}\n```\n\n## Tool System\n\n### Accessing Tools\n\nAll tools are declared in the `build` method:\n\n```typescript\nbuild(build: ToolBuilder) {\n return {\n toolName: build(ToolClass),\n };\n}\n```\n\nAll `build()` calls must occur in the `build` method as they are used for dependency analysis.\n\nIMPORTANT: HTTP access is restricted to URLs requested via `build(Network, { urls: [url1, url2, ...] })` in the `build` method. Wildcards are supported. Use `build(Network, { urls: ['*'] })` if full access is needed.\n\n### Built-in Tools (Always Available)\n\nFor complete API documentation of built-in tools including all methods, types, and detailed examples, see the TypeScript definitions in your installed package at `node_modules/@plotday/twister/src/tools/*.ts`. Each tool file contains comprehensive JSDoc documentation.\n\n**Quick reference - Available tools:**\n\n- `@plotday/twister/tools/plot` - Core data layer (create/update activities, priorities, contacts)\n- `@plotday/twister/tools/ai` - LLM integration (text generation, structured output, reasoning)\n - Use ModelPreferences to specify `speed` (fast/balanced/capable) and `cost` (low/medium/high)\n- `@plotday/twister/tools/store` - Persistent key-value storage (also via `this.set()`, `this.get()`)\n- `@plotday/twister/tools/tasks` - Queue batched work (also via `this.run()`)\n- `@plotday/twister/tools/callbacks` - Persistent function references (also via `this.callback()`)\n- `@plotday/twister/tools/integrations` - OAuth2 authentication flows\n- `@plotday/twister/tools/network` - HTTP access permissions and webhook management\n- `@plotday/twister/tools/twists` - Manage other Twists\n\n**Critical**: Never use instance variables for state. They are lost after function execution. Always use Store methods.\n\n### External Tools (Add to package.json)\n\nAdd tool dependencies to `package.json`:\n\n```json\n{\n \"dependencies\": {\n \"@plotday/twister\": \"workspace:^\",\n \"@plotday/tool-google-calendar\": \"workspace:^\"\n }\n}\n```\n\n#### Common External Tools\n\n- `@plotday/tool-google-calendar`: Google Calendar integration\n- `@plotday/tool-outlook-calendar`: Outlook Calendar integration\n- `@plotday/tool-google-contacts`: Google Contacts integration\n\n## Lifecycle Methods\n\n### activate(priority: Pick<Priority, \"id\">)\n\nCalled when the twist is enabled for a priority. Common patterns:\n\n**Request Authentication:**\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n const authLink = await this.tools.externalTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n await this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Connect your account\",\n links: [authLink],\n });\n}\n```\n\n**Store Parent Activity for Later:**\n\n```typescript\nconst activity = await this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Setup\",\n});\n\nawait this.set(\"setup_activity_id\", activity.id);\n```\n\n### activity(activity: Activity)\n\nCalled when an activity is routed to the twist. Common patterns:\n\n**Create Activities from External Events:**\n\n```typescript\nasync activity(activity: Activity) {\n await this.tools.plot.createActivity(activity);\n}\n```\n\n**Update Based on User Action:**\n\n```typescript\nasync activity(activity: Activity) {\n if (activity.completed) {\n await this.handleCompletion(activity);\n }\n}\n```\n\n## Activity Links\n\nActivity links enable user interaction:\n\n```typescript\nimport { type ActivityLink, ActivityLinkType } from \"@plotday/twister\";\n\n// URL link\nconst urlLink: ActivityLink = {\n title: \"Open website\",\n type: ActivityLinkType.url,\n url: \"https://example.com\",\n};\n\n// Callback link (uses Callbacks tool)\nconst token = await this.callback(this.onLinkClicked, \"context\");\nconst callbackLink: ActivityLink = {\n title: \"Click me\",\n type: ActivityLinkType.callback,\n token: token,\n};\n\n// Add to activity\nawait this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Task with links\",\n links: [urlLink, callbackLink],\n});\n```\n\n## Authentication Pattern\n\nCommon pattern for OAuth authentication:\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n // Request auth link from tool with callback\n const authLink = await this.tools.googleTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n // Create activity with auth link\n const activity = await this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Connect Google account\",\n links: [authLink],\n });\n\n // Store for later use\n await this.set(\"auth_activity_id\", activity.id);\n}\n\nasync onAuthComplete(authResult: { authToken: string }, provider: string) {\n // Store auth token\n await this.set(`${provider}_auth`, authResult.authToken);\n\n // Continue setup flow\n await this.setupSyncOptions(authResult.authToken);\n}\n```\n\n## Sync Pattern\n\nPattern for syncing external data with callbacks:\n\n```typescript\nasync startSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n\n await this.tools.calendarTool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n calendarId\n );\n}\n\nasync handleEvent(activity: Activity, calendarId: string): Promise<void> {\n // Process incoming event from external service\n await this.tools.plot.createActivity(activity);\n}\n\nasync stopSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n await this.tools.calendarTool.stopSync(authToken, calendarId);\n}\n```\n\n## Calendar Selection Pattern\n\nPattern for letting users select from multiple calendars/accounts:\n\n```typescript\nprivate async createCalendarSelectionActivity(\n provider: string,\n calendars: Calendar[],\n authToken: string\n): Promise<void> {\n const links: ActivityLink[] = [];\n\n for (const calendar of calendars) {\n const token = await this.callback(\n this.onCalendarSelected,\n provider,\n calendar.id,\n calendar.name,\n authToken\n );\n\n links.push({\n title: `\uD83D\uDCC5 ${calendar.name}${calendar.primary ? \" (Primary)\" : \"\"}`,\n type: ActivityLinkType.callback,\n token: token,\n });\n }\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Which calendars would you like to connect?\",\n links,\n });\n}\n\nasync onCalendarSelected(\n link: ActivityLink,\n provider: string,\n calendarId: string,\n calendarName: string,\n authToken: string\n): Promise<void> {\n // Start sync for selected calendar\n await this.tools.tool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n provider,\n calendarId\n );\n}\n```\n\n## Batch Processing Pattern\n\n**Important**: Because Twists run in an ephemeral environment with limited execution time, you must break long operations into batches. Each batch runs independently in a new execution context.\n\n### Key Principles\n\n1. **Store state between batches**: Use the Store tool to persist progress\n2. **Queue next batch**: Use the Run tool to schedule the next chunk\n3. **Clean up when done**: Delete stored state after completion\n4. **Handle failures**: Store enough state to resume if a batch fails\n\n### Example Implementation\n\n```typescript\nasync startSync(resourceId: string): Promise<void> {\n // Initialize state in Store (persists between executions)\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: null,\n batchNumber: 1,\n itemsProcessed: 0,\n });\n\n // Queue first batch using runTask method\n const callback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(callback);\n}\n\nasync syncBatch(args: any, resourceId: string): Promise<void> {\n // Load state from Store (set by previous execution)\n const state = await this.get(`sync_state_${resourceId}`);\n\n // Process one batch (keep under time limit)\n const result = await this.fetchBatch(state.nextPageToken);\n\n // Process results\n for (const item of result.items) {\n await this.tools.plot.createActivity(item);\n }\n\n if (result.nextPageToken) {\n // Update state in Store for next batch\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: result.nextPageToken,\n batchNumber: state.batchNumber + 1,\n itemsProcessed: state.itemsProcessed + result.items.length,\n });\n\n // Queue next batch (runs in new execution context)\n const nextCallback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(nextCallback);\n } else {\n // Cleanup when complete\n await this.clear(`sync_state_${resourceId}`);\n\n // Optionally notify user of completion\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n note: `Sync complete: ${state.itemsProcessed + result.items.length} items processed`,\n });\n }\n}\n```\n\n## Error Handling\n\nAlways handle errors gracefully and communicate them to users:\n\n```typescript\ntry {\n await this.externalOperation();\n} catch (error) {\n console.error(\"Operation failed:\", error);\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n note: `Failed to complete operation: ${error.message}`,\n });\n}\n```\n\n## Common Pitfalls\n\n- **Don't use instance variables for state** - Anything stored in memory is lost after function execution. Always use the Store tool for data that needs to persist.\n- **Processing self-created activities** - Other users may change an Activity created by the twist, resulting in an \\`activity\\` call. Be sure to check the \\`changes === null\\` and/or \\`activity.author.id !== this.id\\` to avoid re-processing.\n- Most activity should be `type = ActivityType.Note` with a `title` and `note`, and no `start` or `end`. This represents a typical message. `start` and `end` should only be used for a note if it should be displayed for a specific date or time, such as a birthday.\n- Tools are declared in the `build` method and accessed via `this.tools.toolName` in twist methods.\n- **Don't forget runtime limits** - Each execution has ~10 seconds. Break long operations into batches with the Tasks tool. Process enough items per batch to be efficient, but few enough to stay under time limits.\n- **Always use Callbacks tool for persistent references** - Direct function references don't survive worker restarts.\n- **Store auth tokens** - Don't re-request authentication unnecessarily.\n- **Clean up callbacks and stored state** - Delete callbacks and Store entries when no longer needed.\n- **Handle missing auth gracefully** - Check for stored auth before operations.\n\n## Testing\n\nBefore deploying, verify:\n\n1. Linting passes: `{{packageManager}} lint`\n2. All dependencies are in package.json\n3. Authentication flow works end-to-end\n4. Batch operations handle pagination correctly\n5. Error cases are handled gracefully\n";
7
+ declare const _default: "# Twist Implementation Guide for LLMs\n\nThis document provides context for AI assistants generating or modifying twists.\n\n## Architecture Overview\n\nPlot Twists are TypeScript classes that extend the `Twist` base class. Twists interact with external services and Plot's core functionality through a tool-based architecture.\n\n### Runtime Environment\n\n**Critical**: All Twists and tool functions are executed in a sandboxed, ephemeral environment with limited resources:\n\n- **Memory is temporary**: Anything stored in memory (e.g. as a variable in the twist/tool object) is lost after the function completes. Use the Store tool instead. Only use memory for temporary caching.\n- **Limited CPU time**: Each execution has limited CPU time (typically 10 seconds) and memory (128MB)\n- **Use the Run tool**: Queue separate chunks of work with `run.now(functionName, context)`\n- **Break long operations**: Split large operations into smaller batches that can be processed independently\n- **Store intermediate state**: Use the Store tool to persist state between batches\n- **Examples**: Syncing large datasets, processing many API calls, or performing batch operations\n\n## Understanding Activities and Notes\n\n**CRITICAL CONCEPT**: An **Activity** represents something done or to be done (a task, event, or conversation), while **Notes** represent the updates and details on that activity.\n\n**Think of an Activity as a thread** on a messaging platform, and **Notes as the messages in that thread**.\n\n### Key Guidelines\n\n1. **Always create Activities with an initial Note** - The title is just a summary; detailed content goes in Notes\n2. **Add Notes to existing Activities for updates** - Don't create a new Activity for each related message\n3. **Use `source` field for deduplication** - Enables safe, idempotent sync from external systems\n4. **Most Activities should be `ActivityType.Note`** - Use `Action` only for tasks with `doneAt`, use `Event` only for items with `start`/`end`\n\n### Decision Tree\n\n```\nNew event/task/conversation?\n \u251C\u2500 Yes \u2192 Create new Activity with initial Note\n \u2502 Include `source` field for deduplication\n \u2502\n \u2514\u2500 No (update/reply/comment) \u2192 Check for existing Activity\n \u251C\u2500 Found \u2192 Add Note to existing Activity\n \u2514\u2500 Not found \u2192 Create new Activity with initial Note\n```\n\n## Twist Structure Pattern\n\n```typescript\nimport {\n type Activity,\n type Priority,\n type ToolBuilder,\n twist,\n} from \"@plotday/twister\";\nimport { Plot } from \"@plotday/twister/tools/plot\";\n\nexport default class MyTwist extends Twist<MyTwist> {\n build(build: ToolBuilder) {\n return {\n plot: build(Plot),\n };\n }\n\n async activate(priority: Pick<Priority, \"id\">) {\n // Called when twist is enabled for a priority\n // Common actions: request auth, create setup activities\n }\n\n async activity(activity: Activity) {\n // Called when an activity is routed to this twist\n // Common actions: process external events, update activities\n }\n}\n```\n\n## Tool System\n\n### Accessing Tools\n\nAll tools are declared in the `build` method:\n\n```typescript\nbuild(build: ToolBuilder) {\n return {\n toolName: build(ToolClass),\n };\n}\n```\n\nAll `build()` calls must occur in the `build` method as they are used for dependency analysis.\n\nIMPORTANT: HTTP access is restricted to URLs requested via `build(Network, { urls: [url1, url2, ...] })` in the `build` method. Wildcards are supported. Use `build(Network, { urls: ['*'] })` if full access is needed.\n\n### Built-in Tools (Always Available)\n\nFor complete API documentation of built-in tools including all methods, types, and detailed examples, see the TypeScript definitions in your installed package at `node_modules/@plotday/twister/src/tools/*.ts`. Each tool file contains comprehensive JSDoc documentation.\n\n**Quick reference - Available tools:**\n\n- `@plotday/twister/tools/plot` - Core data layer (create/update activities, priorities, contacts)\n- `@plotday/twister/tools/ai` - LLM integration (text generation, structured output, reasoning)\n - Use ModelPreferences to specify `speed` (fast/balanced/capable) and `cost` (low/medium/high)\n- `@plotday/twister/tools/store` - Persistent key-value storage (also via `this.set()`, `this.get()`)\n- `@plotday/twister/tools/tasks` - Queue batched work (also via `this.run()`)\n- `@plotday/twister/tools/callbacks` - Persistent function references (also via `this.callback()`)\n- `@plotday/twister/tools/integrations` - OAuth2 authentication flows\n- `@plotday/twister/tools/network` - HTTP access permissions and webhook management\n- `@plotday/twister/tools/twists` - Manage other Twists\n\n**Critical**: Never use instance variables for state. They are lost after function execution. Always use Store methods.\n\n### External Tools (Add to package.json)\n\nAdd tool dependencies to `package.json`:\n\n```json\n{\n \"dependencies\": {\n \"@plotday/twister\": \"workspace:^\",\n \"@plotday/tool-google-calendar\": \"workspace:^\"\n }\n}\n```\n\n#### Common External Tools\n\n- `@plotday/tool-google-calendar`: Google Calendar integration\n- `@plotday/tool-outlook-calendar`: Outlook Calendar integration\n- `@plotday/tool-google-contacts`: Google Contacts integration\n\n## Lifecycle Methods\n\n### activate(priority: Pick<Priority, \"id\">)\n\nCalled when the twist is enabled for a priority. Common patterns:\n\n**Request Authentication:**\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n const authLink = await this.tools.externalTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Connect your account\",\n notes: [\n {\n content: \"Click the link below to connect your account and start syncing.\",\n links: [authLink],\n },\n ],\n });\n}\n```\n\n**Store Parent Activity for Later:**\n\n```typescript\nconst activity = await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Setup\",\n notes: [\n {\n content: \"Your twist is being set up. Configuration steps will appear here.\",\n },\n ],\n});\n\nawait this.set(\"setup_activity_id\", activity.id);\n```\n\n### activity(activity: Activity)\n\nCalled when an activity is routed to the twist. Common patterns:\n\n**Create Activities from External Events:**\n\n```typescript\nasync activity(activity: Activity) {\n await this.tools.plot.createActivity(activity);\n}\n```\n\n**Update Based on User Action:**\n\n```typescript\nasync activity(activity: Activity) {\n if (activity.completed) {\n await this.handleCompletion(activity);\n }\n}\n```\n\n## Activity Links\n\nActivity links enable user interaction:\n\n```typescript\nimport { type ActivityLink, ActivityLinkType } from \"@plotday/twister\";\n\n// URL link\nconst urlLink: ActivityLink = {\n title: \"Open website\",\n type: ActivityLinkType.url,\n url: \"https://example.com\",\n};\n\n// Callback link (uses Callbacks tool)\nconst token = await this.callback(this.onLinkClicked, \"context\");\nconst callbackLink: ActivityLink = {\n title: \"Click me\",\n type: ActivityLinkType.callback,\n token: token,\n};\n\n// Add to activity note\nawait this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Task with links\",\n notes: [\n {\n content: \"Click the links below to take action.\",\n links: [urlLink, callbackLink],\n },\n ],\n});\n```\n\n## Authentication Pattern\n\nCommon pattern for OAuth authentication:\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n // Request auth link from tool with callback\n const authLink = await this.tools.googleTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n // Create activity with auth link\n const activity = await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Connect Google account\",\n notes: [\n {\n content: \"Click below to connect your Google account and start syncing.\",\n links: [authLink],\n },\n ],\n });\n\n // Store for later use\n await this.set(\"auth_activity_id\", activity.id);\n}\n\nasync onAuthComplete(authResult: { authToken: string }, provider: string) {\n // Store auth token\n await this.set(`${provider}_auth`, authResult.authToken);\n\n // Continue setup flow\n await this.setupSyncOptions(authResult.authToken);\n}\n```\n\n## Sync Pattern\n\nPattern for syncing external data - demonstrates adding Notes to existing Activities:\n\n```typescript\nasync startSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n\n await this.tools.calendarTool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n calendarId\n );\n}\n\nasync handleEvent(\n incomingActivity: NewActivityWithNotes,\n calendarId: string\n): Promise<void> {\n // Check if this activity already exists (using source for deduplication)\n if (incomingActivity.source) {\n const existing = await this.tools.plot.getActivityBySource(\n incomingActivity.source\n );\n\n if (existing) {\n // Add update as a Note to existing Activity (add message to thread)\n if (incomingActivity.notes?.[0]?.content) {\n await this.tools.plot.createNote({\n activity: { id: existing.id },\n content: incomingActivity.notes[0].content,\n });\n }\n return;\n }\n }\n\n // Create new Activity with initial Note (new thread with first message)\n await this.tools.plot.createActivity(incomingActivity);\n}\n\nasync stopSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n await this.tools.calendarTool.stopSync(authToken, calendarId);\n}\n```\n\n## Calendar Selection Pattern\n\nPattern for letting users select from multiple calendars/accounts:\n\n```typescript\nprivate async createCalendarSelectionActivity(\n provider: string,\n calendars: Calendar[],\n authToken: string\n): Promise<void> {\n const links: ActivityLink[] = [];\n\n for (const calendar of calendars) {\n const token = await this.callback(\n this.onCalendarSelected,\n provider,\n calendar.id,\n calendar.name,\n authToken\n );\n\n links.push({\n title: `\uD83D\uDCC5 ${calendar.name}${calendar.primary ? \" (Primary)\" : \"\"}`,\n type: ActivityLinkType.callback,\n token: token,\n });\n }\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Which calendars would you like to connect?\",\n notes: [\n {\n content: \"Select the calendars you want to sync:\",\n links,\n },\n ],\n });\n}\n\nasync onCalendarSelected(\n link: ActivityLink,\n provider: string,\n calendarId: string,\n calendarName: string,\n authToken: string\n): Promise<void> {\n // Start sync for selected calendar\n await this.tools.tool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n provider,\n calendarId\n );\n}\n```\n\n## Batch Processing Pattern\n\n**Important**: Because Twists run in an ephemeral environment with limited execution time, you must break long operations into batches. Each batch runs independently in a new execution context.\n\n### Key Principles\n\n1. **Store state between batches**: Use the Store tool to persist progress\n2. **Queue next batch**: Use the Run tool to schedule the next chunk\n3. **Clean up when done**: Delete stored state after completion\n4. **Handle failures**: Store enough state to resume if a batch fails\n\n### Example Implementation\n\n```typescript\nasync startSync(resourceId: string): Promise<void> {\n // Initialize state in Store (persists between executions)\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: null,\n batchNumber: 1,\n itemsProcessed: 0,\n });\n\n // Queue first batch using runTask method\n const callback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(callback);\n}\n\nasync syncBatch(args: any, resourceId: string): Promise<void> {\n // Load state from Store (set by previous execution)\n const state = await this.get(`sync_state_${resourceId}`);\n\n // Process one batch (keep under time limit)\n const result = await this.fetchBatch(state.nextPageToken);\n\n // Process results (create activities with Notes)\n for (const item of result.items) {\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: item.title,\n source: `external:${item.id}`, // For deduplication\n notes: [{ content: item.description }],\n });\n }\n\n if (result.nextPageToken) {\n // Update state in Store for next batch\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: result.nextPageToken,\n batchNumber: state.batchNumber + 1,\n itemsProcessed: state.itemsProcessed + result.items.length,\n });\n\n // Queue next batch (runs in new execution context)\n const nextCallback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(nextCallback);\n } else {\n // Cleanup when complete\n await this.clear(`sync_state_${resourceId}`);\n\n // Optionally notify user of completion\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Sync complete\",\n notes: [\n {\n content: `Successfully processed ${state.itemsProcessed + result.items.length} items.`,\n },\n ],\n });\n }\n}\n```\n\n## Error Handling\n\nAlways handle errors gracefully and communicate them to users:\n\n```typescript\ntry {\n await this.externalOperation();\n} catch (error) {\n console.error(\"Operation failed:\", error);\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Operation failed\",\n notes: [\n {\n content: `Failed to complete operation: ${error.message}`,\n },\n ],\n });\n}\n```\n\n## Common Pitfalls\n\n- **Don't use instance variables for state** - Anything stored in memory is lost after function execution. Always use the Store tool for data that needs to persist.\n- **Processing self-created activities** - Other users may change an Activity created by the twist, resulting in an \\`activity\\` call. Be sure to check the \\`changes === null\\` and/or \\`activity.author.id !== this.id\\` to avoid re-processing.\n- **Always create Activities with Notes** - See \"Understanding Activities and Notes\" section above for the thread/message pattern and decision tree.\n- **Use correct Activity types** - Most should be `ActivityType.Note`. Only use `Action` for tasks with `doneAt`, and `Event` for items with `start`/`end`.\n- **Use `source` field for deduplication** - Always include `source` when syncing external data to enable safe, idempotent operations.\n- **Add Notes to existing Activities** - Check for existing Activities with `getActivityBySource()` before creating new ones. Think thread replies, not new threads.\n- Tools are declared in the `build` method and accessed via `this.tools.toolName` in twist methods.\n- **Don't forget runtime limits** - Each execution has ~10 seconds. Break long operations into batches with the Tasks tool. Process enough items per batch to be efficient, but few enough to stay under time limits.\n- **Always use Callbacks tool for persistent references** - Direct function references don't survive worker restarts.\n- **Store auth tokens** - Don't re-request authentication unnecessarily.\n- **Clean up callbacks and stored state** - Delete callbacks and Store entries when no longer needed.\n- **Handle missing auth gracefully** - Check for stored auth before operations.\n\n## Testing\n\nBefore deploying, verify:\n\n1. Linting passes: `{{packageManager}} lint`\n2. All dependencies are in package.json\n3. Authentication flow works end-to-end\n4. Batch operations handle pagination correctly\n5. Error cases are handled gracefully\n";
8
8
  export default _default;
9
9
  //# sourceMappingURL=twist-guide-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"twist-guide-template.d.ts","sourceRoot":"","sources":["../../src/llm-docs/twist-guide-template.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;wBAEY,ynZAA+mZ;AAA9nZ,wBAA+nZ"}
1
+ {"version":3,"file":"twist-guide-template.d.ts","sourceRoot":"","sources":["../../src/llm-docs/twist-guide-template.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;wBAEY,gvfAAgqf;AAA/qf,wBAAgrf"}
@@ -4,5 +4,5 @@
4
4
  * This file is auto-generated during build. Do not edit manually.
5
5
  * Generated from: cli/templates/AGENTS.template.md
6
6
  */
7
- export default "# Twist Implementation Guide for LLMs\n\nThis document provides context for AI assistants generating or modifying twists.\n\n## Architecture Overview\n\nPlot Twists are TypeScript classes that extend the `Twist` base class. Twists interact with external services and Plot's core functionality through a tool-based architecture.\n\n### Runtime Environment\n\n**Critical**: All Twists and tool functions are executed in a sandboxed, ephemeral environment with limited resources:\n\n- **Memory is temporary**: Anything stored in memory (e.g. as a variable in the twist/tool object) is lost after the function completes. Use the Store tool instead. Only use memory for temporary caching.\n- **Limited CPU time**: Each execution has limited CPU time (typically 10 seconds) and memory (128MB)\n- **Use the Run tool**: Queue separate chunks of work with `run.now(functionName, context)`\n- **Break long operations**: Split large operations into smaller batches that can be processed independently\n- **Store intermediate state**: Use the Store tool to persist state between batches\n- **Examples**: Syncing large datasets, processing many API calls, or performing batch operations\n\n## twist Structure Pattern\n\n```typescript\nimport {\n type Activity,\n twist,\n type Priority,\n type ToolBuilder,\n} from \"@plotday/twister\";\nimport { Plot } from \"@plotday/twister/tools/plot\";\n\nexport default class MyTwist extends Twist<MyTwist> {\n build(build: ToolBuilder) {\n return {\n plot: build(Plot),\n };\n }\n\n async activate(priority: Pick<Priority, \"id\">) {\n // Called when twist is enabled for a priority\n // Common actions: request auth, create setup activities\n }\n\n async activity(activity: Activity) {\n // Called when an activity is routed to this twist\n // Common actions: process external events, update activities\n }\n}\n```\n\n## Tool System\n\n### Accessing Tools\n\nAll tools are declared in the `build` method:\n\n```typescript\nbuild(build: ToolBuilder) {\n return {\n toolName: build(ToolClass),\n };\n}\n```\n\nAll `build()` calls must occur in the `build` method as they are used for dependency analysis.\n\nIMPORTANT: HTTP access is restricted to URLs requested via `build(Network, { urls: [url1, url2, ...] })` in the `build` method. Wildcards are supported. Use `build(Network, { urls: ['*'] })` if full access is needed.\n\n### Built-in Tools (Always Available)\n\nFor complete API documentation of built-in tools including all methods, types, and detailed examples, see the TypeScript definitions in your installed package at `node_modules/@plotday/twister/src/tools/*.ts`. Each tool file contains comprehensive JSDoc documentation.\n\n**Quick reference - Available tools:**\n\n- `@plotday/twister/tools/plot` - Core data layer (create/update activities, priorities, contacts)\n- `@plotday/twister/tools/ai` - LLM integration (text generation, structured output, reasoning)\n - Use ModelPreferences to specify `speed` (fast/balanced/capable) and `cost` (low/medium/high)\n- `@plotday/twister/tools/store` - Persistent key-value storage (also via `this.set()`, `this.get()`)\n- `@plotday/twister/tools/tasks` - Queue batched work (also via `this.run()`)\n- `@plotday/twister/tools/callbacks` - Persistent function references (also via `this.callback()`)\n- `@plotday/twister/tools/integrations` - OAuth2 authentication flows\n- `@plotday/twister/tools/network` - HTTP access permissions and webhook management\n- `@plotday/twister/tools/twists` - Manage other Twists\n\n**Critical**: Never use instance variables for state. They are lost after function execution. Always use Store methods.\n\n### External Tools (Add to package.json)\n\nAdd tool dependencies to `package.json`:\n\n```json\n{\n \"dependencies\": {\n \"@plotday/twister\": \"workspace:^\",\n \"@plotday/tool-google-calendar\": \"workspace:^\"\n }\n}\n```\n\n#### Common External Tools\n\n- `@plotday/tool-google-calendar`: Google Calendar integration\n- `@plotday/tool-outlook-calendar`: Outlook Calendar integration\n- `@plotday/tool-google-contacts`: Google Contacts integration\n\n## Lifecycle Methods\n\n### activate(priority: Pick<Priority, \"id\">)\n\nCalled when the twist is enabled for a priority. Common patterns:\n\n**Request Authentication:**\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n const authLink = await this.tools.externalTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n await this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Connect your account\",\n links: [authLink],\n });\n}\n```\n\n**Store Parent Activity for Later:**\n\n```typescript\nconst activity = await this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Setup\",\n});\n\nawait this.set(\"setup_activity_id\", activity.id);\n```\n\n### activity(activity: Activity)\n\nCalled when an activity is routed to the twist. Common patterns:\n\n**Create Activities from External Events:**\n\n```typescript\nasync activity(activity: Activity) {\n await this.tools.plot.createActivity(activity);\n}\n```\n\n**Update Based on User Action:**\n\n```typescript\nasync activity(activity: Activity) {\n if (activity.completed) {\n await this.handleCompletion(activity);\n }\n}\n```\n\n## Activity Links\n\nActivity links enable user interaction:\n\n```typescript\nimport { type ActivityLink, ActivityLinkType } from \"@plotday/twister\";\n\n// URL link\nconst urlLink: ActivityLink = {\n title: \"Open website\",\n type: ActivityLinkType.url,\n url: \"https://example.com\",\n};\n\n// Callback link (uses Callbacks tool)\nconst token = await this.callback(this.onLinkClicked, \"context\");\nconst callbackLink: ActivityLink = {\n title: \"Click me\",\n type: ActivityLinkType.callback,\n token: token,\n};\n\n// Add to activity\nawait this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Task with links\",\n links: [urlLink, callbackLink],\n});\n```\n\n## Authentication Pattern\n\nCommon pattern for OAuth authentication:\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n // Request auth link from tool with callback\n const authLink = await this.tools.googleTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n // Create activity with auth link\n const activity = await this.tools.plot.createActivity({\n type: ActivityType.Action,\n title: \"Connect Google account\",\n links: [authLink],\n });\n\n // Store for later use\n await this.set(\"auth_activity_id\", activity.id);\n}\n\nasync onAuthComplete(authResult: { authToken: string }, provider: string) {\n // Store auth token\n await this.set(`${provider}_auth`, authResult.authToken);\n\n // Continue setup flow\n await this.setupSyncOptions(authResult.authToken);\n}\n```\n\n## Sync Pattern\n\nPattern for syncing external data with callbacks:\n\n```typescript\nasync startSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n\n await this.tools.calendarTool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n calendarId\n );\n}\n\nasync handleEvent(activity: Activity, calendarId: string): Promise<void> {\n // Process incoming event from external service\n await this.tools.plot.createActivity(activity);\n}\n\nasync stopSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n await this.tools.calendarTool.stopSync(authToken, calendarId);\n}\n```\n\n## Calendar Selection Pattern\n\nPattern for letting users select from multiple calendars/accounts:\n\n```typescript\nprivate async createCalendarSelectionActivity(\n provider: string,\n calendars: Calendar[],\n authToken: string\n): Promise<void> {\n const links: ActivityLink[] = [];\n\n for (const calendar of calendars) {\n const token = await this.callback(\n this.onCalendarSelected,\n provider,\n calendar.id,\n calendar.name,\n authToken\n );\n\n links.push({\n title: `📅 ${calendar.name}${calendar.primary ? \" (Primary)\" : \"\"}`,\n type: ActivityLinkType.callback,\n token: token,\n });\n }\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Which calendars would you like to connect?\",\n links,\n });\n}\n\nasync onCalendarSelected(\n link: ActivityLink,\n provider: string,\n calendarId: string,\n calendarName: string,\n authToken: string\n): Promise<void> {\n // Start sync for selected calendar\n await this.tools.tool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n provider,\n calendarId\n );\n}\n```\n\n## Batch Processing Pattern\n\n**Important**: Because Twists run in an ephemeral environment with limited execution time, you must break long operations into batches. Each batch runs independently in a new execution context.\n\n### Key Principles\n\n1. **Store state between batches**: Use the Store tool to persist progress\n2. **Queue next batch**: Use the Run tool to schedule the next chunk\n3. **Clean up when done**: Delete stored state after completion\n4. **Handle failures**: Store enough state to resume if a batch fails\n\n### Example Implementation\n\n```typescript\nasync startSync(resourceId: string): Promise<void> {\n // Initialize state in Store (persists between executions)\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: null,\n batchNumber: 1,\n itemsProcessed: 0,\n });\n\n // Queue first batch using runTask method\n const callback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(callback);\n}\n\nasync syncBatch(args: any, resourceId: string): Promise<void> {\n // Load state from Store (set by previous execution)\n const state = await this.get(`sync_state_${resourceId}`);\n\n // Process one batch (keep under time limit)\n const result = await this.fetchBatch(state.nextPageToken);\n\n // Process results\n for (const item of result.items) {\n await this.tools.plot.createActivity(item);\n }\n\n if (result.nextPageToken) {\n // Update state in Store for next batch\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: result.nextPageToken,\n batchNumber: state.batchNumber + 1,\n itemsProcessed: state.itemsProcessed + result.items.length,\n });\n\n // Queue next batch (runs in new execution context)\n const nextCallback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(nextCallback);\n } else {\n // Cleanup when complete\n await this.clear(`sync_state_${resourceId}`);\n\n // Optionally notify user of completion\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n note: `Sync complete: ${state.itemsProcessed + result.items.length} items processed`,\n });\n }\n}\n```\n\n## Error Handling\n\nAlways handle errors gracefully and communicate them to users:\n\n```typescript\ntry {\n await this.externalOperation();\n} catch (error) {\n console.error(\"Operation failed:\", error);\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n note: `Failed to complete operation: ${error.message}`,\n });\n}\n```\n\n## Common Pitfalls\n\n- **Don't use instance variables for state** - Anything stored in memory is lost after function execution. Always use the Store tool for data that needs to persist.\n- **Processing self-created activities** - Other users may change an Activity created by the twist, resulting in an \\`activity\\` call. Be sure to check the \\`changes === null\\` and/or \\`activity.author.id !== this.id\\` to avoid re-processing.\n- Most activity should be `type = ActivityType.Note` with a `title` and `note`, and no `start` or `end`. This represents a typical message. `start` and `end` should only be used for a note if it should be displayed for a specific date or time, such as a birthday.\n- Tools are declared in the `build` method and accessed via `this.tools.toolName` in twist methods.\n- **Don't forget runtime limits** - Each execution has ~10 seconds. Break long operations into batches with the Tasks tool. Process enough items per batch to be efficient, but few enough to stay under time limits.\n- **Always use Callbacks tool for persistent references** - Direct function references don't survive worker restarts.\n- **Store auth tokens** - Don't re-request authentication unnecessarily.\n- **Clean up callbacks and stored state** - Delete callbacks and Store entries when no longer needed.\n- **Handle missing auth gracefully** - Check for stored auth before operations.\n\n## Testing\n\nBefore deploying, verify:\n\n1. Linting passes: `{{packageManager}} lint`\n2. All dependencies are in package.json\n3. Authentication flow works end-to-end\n4. Batch operations handle pagination correctly\n5. Error cases are handled gracefully\n";
7
+ export default "# Twist Implementation Guide for LLMs\n\nThis document provides context for AI assistants generating or modifying twists.\n\n## Architecture Overview\n\nPlot Twists are TypeScript classes that extend the `Twist` base class. Twists interact with external services and Plot's core functionality through a tool-based architecture.\n\n### Runtime Environment\n\n**Critical**: All Twists and tool functions are executed in a sandboxed, ephemeral environment with limited resources:\n\n- **Memory is temporary**: Anything stored in memory (e.g. as a variable in the twist/tool object) is lost after the function completes. Use the Store tool instead. Only use memory for temporary caching.\n- **Limited CPU time**: Each execution has limited CPU time (typically 10 seconds) and memory (128MB)\n- **Use the Run tool**: Queue separate chunks of work with `run.now(functionName, context)`\n- **Break long operations**: Split large operations into smaller batches that can be processed independently\n- **Store intermediate state**: Use the Store tool to persist state between batches\n- **Examples**: Syncing large datasets, processing many API calls, or performing batch operations\n\n## Understanding Activities and Notes\n\n**CRITICAL CONCEPT**: An **Activity** represents something done or to be done (a task, event, or conversation), while **Notes** represent the updates and details on that activity.\n\n**Think of an Activity as a thread** on a messaging platform, and **Notes as the messages in that thread**.\n\n### Key Guidelines\n\n1. **Always create Activities with an initial Note** - The title is just a summary; detailed content goes in Notes\n2. **Add Notes to existing Activities for updates** - Don't create a new Activity for each related message\n3. **Use `source` field for deduplication** - Enables safe, idempotent sync from external systems\n4. **Most Activities should be `ActivityType.Note`** - Use `Action` only for tasks with `doneAt`, use `Event` only for items with `start`/`end`\n\n### Decision Tree\n\n```\nNew event/task/conversation?\n ├─ Yes → Create new Activity with initial Note\n │ Include `source` field for deduplication\n │\n └─ No (update/reply/comment) → Check for existing Activity\n ├─ Found → Add Note to existing Activity\n └─ Not found → Create new Activity with initial Note\n```\n\n## Twist Structure Pattern\n\n```typescript\nimport {\n type Activity,\n type Priority,\n type ToolBuilder,\n twist,\n} from \"@plotday/twister\";\nimport { Plot } from \"@plotday/twister/tools/plot\";\n\nexport default class MyTwist extends Twist<MyTwist> {\n build(build: ToolBuilder) {\n return {\n plot: build(Plot),\n };\n }\n\n async activate(priority: Pick<Priority, \"id\">) {\n // Called when twist is enabled for a priority\n // Common actions: request auth, create setup activities\n }\n\n async activity(activity: Activity) {\n // Called when an activity is routed to this twist\n // Common actions: process external events, update activities\n }\n}\n```\n\n## Tool System\n\n### Accessing Tools\n\nAll tools are declared in the `build` method:\n\n```typescript\nbuild(build: ToolBuilder) {\n return {\n toolName: build(ToolClass),\n };\n}\n```\n\nAll `build()` calls must occur in the `build` method as they are used for dependency analysis.\n\nIMPORTANT: HTTP access is restricted to URLs requested via `build(Network, { urls: [url1, url2, ...] })` in the `build` method. Wildcards are supported. Use `build(Network, { urls: ['*'] })` if full access is needed.\n\n### Built-in Tools (Always Available)\n\nFor complete API documentation of built-in tools including all methods, types, and detailed examples, see the TypeScript definitions in your installed package at `node_modules/@plotday/twister/src/tools/*.ts`. Each tool file contains comprehensive JSDoc documentation.\n\n**Quick reference - Available tools:**\n\n- `@plotday/twister/tools/plot` - Core data layer (create/update activities, priorities, contacts)\n- `@plotday/twister/tools/ai` - LLM integration (text generation, structured output, reasoning)\n - Use ModelPreferences to specify `speed` (fast/balanced/capable) and `cost` (low/medium/high)\n- `@plotday/twister/tools/store` - Persistent key-value storage (also via `this.set()`, `this.get()`)\n- `@plotday/twister/tools/tasks` - Queue batched work (also via `this.run()`)\n- `@plotday/twister/tools/callbacks` - Persistent function references (also via `this.callback()`)\n- `@plotday/twister/tools/integrations` - OAuth2 authentication flows\n- `@plotday/twister/tools/network` - HTTP access permissions and webhook management\n- `@plotday/twister/tools/twists` - Manage other Twists\n\n**Critical**: Never use instance variables for state. They are lost after function execution. Always use Store methods.\n\n### External Tools (Add to package.json)\n\nAdd tool dependencies to `package.json`:\n\n```json\n{\n \"dependencies\": {\n \"@plotday/twister\": \"workspace:^\",\n \"@plotday/tool-google-calendar\": \"workspace:^\"\n }\n}\n```\n\n#### Common External Tools\n\n- `@plotday/tool-google-calendar`: Google Calendar integration\n- `@plotday/tool-outlook-calendar`: Outlook Calendar integration\n- `@plotday/tool-google-contacts`: Google Contacts integration\n\n## Lifecycle Methods\n\n### activate(priority: Pick<Priority, \"id\">)\n\nCalled when the twist is enabled for a priority. Common patterns:\n\n**Request Authentication:**\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n const authLink = await this.tools.externalTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Connect your account\",\n notes: [\n {\n content: \"Click the link below to connect your account and start syncing.\",\n links: [authLink],\n },\n ],\n });\n}\n```\n\n**Store Parent Activity for Later:**\n\n```typescript\nconst activity = await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Setup\",\n notes: [\n {\n content: \"Your twist is being set up. Configuration steps will appear here.\",\n },\n ],\n});\n\nawait this.set(\"setup_activity_id\", activity.id);\n```\n\n### activity(activity: Activity)\n\nCalled when an activity is routed to the twist. Common patterns:\n\n**Create Activities from External Events:**\n\n```typescript\nasync activity(activity: Activity) {\n await this.tools.plot.createActivity(activity);\n}\n```\n\n**Update Based on User Action:**\n\n```typescript\nasync activity(activity: Activity) {\n if (activity.completed) {\n await this.handleCompletion(activity);\n }\n}\n```\n\n## Activity Links\n\nActivity links enable user interaction:\n\n```typescript\nimport { type ActivityLink, ActivityLinkType } from \"@plotday/twister\";\n\n// URL link\nconst urlLink: ActivityLink = {\n title: \"Open website\",\n type: ActivityLinkType.url,\n url: \"https://example.com\",\n};\n\n// Callback link (uses Callbacks tool)\nconst token = await this.callback(this.onLinkClicked, \"context\");\nconst callbackLink: ActivityLink = {\n title: \"Click me\",\n type: ActivityLinkType.callback,\n token: token,\n};\n\n// Add to activity note\nawait this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Task with links\",\n notes: [\n {\n content: \"Click the links below to take action.\",\n links: [urlLink, callbackLink],\n },\n ],\n});\n```\n\n## Authentication Pattern\n\nCommon pattern for OAuth authentication:\n\n```typescript\nasync activate(_priority: Pick<Priority, \"id\">) {\n // Request auth link from tool with callback\n const authLink = await this.tools.googleTool.requestAuth(\n this.onAuthComplete,\n \"google\"\n );\n\n // Create activity with auth link\n const activity = await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Connect Google account\",\n notes: [\n {\n content: \"Click below to connect your Google account and start syncing.\",\n links: [authLink],\n },\n ],\n });\n\n // Store for later use\n await this.set(\"auth_activity_id\", activity.id);\n}\n\nasync onAuthComplete(authResult: { authToken: string }, provider: string) {\n // Store auth token\n await this.set(`${provider}_auth`, authResult.authToken);\n\n // Continue setup flow\n await this.setupSyncOptions(authResult.authToken);\n}\n```\n\n## Sync Pattern\n\nPattern for syncing external data - demonstrates adding Notes to existing Activities:\n\n```typescript\nasync startSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n\n await this.tools.calendarTool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n calendarId\n );\n}\n\nasync handleEvent(\n incomingActivity: NewActivityWithNotes,\n calendarId: string\n): Promise<void> {\n // Check if this activity already exists (using source for deduplication)\n if (incomingActivity.source) {\n const existing = await this.tools.plot.getActivityBySource(\n incomingActivity.source\n );\n\n if (existing) {\n // Add update as a Note to existing Activity (add message to thread)\n if (incomingActivity.notes?.[0]?.content) {\n await this.tools.plot.createNote({\n activity: { id: existing.id },\n content: incomingActivity.notes[0].content,\n });\n }\n return;\n }\n }\n\n // Create new Activity with initial Note (new thread with first message)\n await this.tools.plot.createActivity(incomingActivity);\n}\n\nasync stopSync(calendarId: string): Promise<void> {\n const authToken = await this.get<string>(\"auth_token\");\n await this.tools.calendarTool.stopSync(authToken, calendarId);\n}\n```\n\n## Calendar Selection Pattern\n\nPattern for letting users select from multiple calendars/accounts:\n\n```typescript\nprivate async createCalendarSelectionActivity(\n provider: string,\n calendars: Calendar[],\n authToken: string\n): Promise<void> {\n const links: ActivityLink[] = [];\n\n for (const calendar of calendars) {\n const token = await this.callback(\n this.onCalendarSelected,\n provider,\n calendar.id,\n calendar.name,\n authToken\n );\n\n links.push({\n title: `📅 ${calendar.name}${calendar.primary ? \" (Primary)\" : \"\"}`,\n type: ActivityLinkType.callback,\n token: token,\n });\n }\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Which calendars would you like to connect?\",\n notes: [\n {\n content: \"Select the calendars you want to sync:\",\n links,\n },\n ],\n });\n}\n\nasync onCalendarSelected(\n link: ActivityLink,\n provider: string,\n calendarId: string,\n calendarName: string,\n authToken: string\n): Promise<void> {\n // Start sync for selected calendar\n await this.tools.tool.startSync(\n authToken,\n calendarId,\n this.handleEvent,\n provider,\n calendarId\n );\n}\n```\n\n## Batch Processing Pattern\n\n**Important**: Because Twists run in an ephemeral environment with limited execution time, you must break long operations into batches. Each batch runs independently in a new execution context.\n\n### Key Principles\n\n1. **Store state between batches**: Use the Store tool to persist progress\n2. **Queue next batch**: Use the Run tool to schedule the next chunk\n3. **Clean up when done**: Delete stored state after completion\n4. **Handle failures**: Store enough state to resume if a batch fails\n\n### Example Implementation\n\n```typescript\nasync startSync(resourceId: string): Promise<void> {\n // Initialize state in Store (persists between executions)\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: null,\n batchNumber: 1,\n itemsProcessed: 0,\n });\n\n // Queue first batch using runTask method\n const callback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(callback);\n}\n\nasync syncBatch(args: any, resourceId: string): Promise<void> {\n // Load state from Store (set by previous execution)\n const state = await this.get(`sync_state_${resourceId}`);\n\n // Process one batch (keep under time limit)\n const result = await this.fetchBatch(state.nextPageToken);\n\n // Process results (create activities with Notes)\n for (const item of result.items) {\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: item.title,\n source: `external:${item.id}`, // For deduplication\n notes: [{ content: item.description }],\n });\n }\n\n if (result.nextPageToken) {\n // Update state in Store for next batch\n await this.set(`sync_state_${resourceId}`, {\n nextPageToken: result.nextPageToken,\n batchNumber: state.batchNumber + 1,\n itemsProcessed: state.itemsProcessed + result.items.length,\n });\n\n // Queue next batch (runs in new execution context)\n const nextCallback = await this.callback(this.syncBatch, resourceId);\n await this.runTask(nextCallback);\n } else {\n // Cleanup when complete\n await this.clear(`sync_state_${resourceId}`);\n\n // Optionally notify user of completion\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Sync complete\",\n notes: [\n {\n content: `Successfully processed ${state.itemsProcessed + result.items.length} items.`,\n },\n ],\n });\n }\n}\n```\n\n## Error Handling\n\nAlways handle errors gracefully and communicate them to users:\n\n```typescript\ntry {\n await this.externalOperation();\n} catch (error) {\n console.error(\"Operation failed:\", error);\n\n await this.tools.plot.createActivity({\n type: ActivityType.Note,\n title: \"Operation failed\",\n notes: [\n {\n content: `Failed to complete operation: ${error.message}`,\n },\n ],\n });\n}\n```\n\n## Common Pitfalls\n\n- **Don't use instance variables for state** - Anything stored in memory is lost after function execution. Always use the Store tool for data that needs to persist.\n- **Processing self-created activities** - Other users may change an Activity created by the twist, resulting in an \\`activity\\` call. Be sure to check the \\`changes === null\\` and/or \\`activity.author.id !== this.id\\` to avoid re-processing.\n- **Always create Activities with Notes** - See \"Understanding Activities and Notes\" section above for the thread/message pattern and decision tree.\n- **Use correct Activity types** - Most should be `ActivityType.Note`. Only use `Action` for tasks with `doneAt`, and `Event` for items with `start`/`end`.\n- **Use `source` field for deduplication** - Always include `source` when syncing external data to enable safe, idempotent operations.\n- **Add Notes to existing Activities** - Check for existing Activities with `getActivityBySource()` before creating new ones. Think thread replies, not new threads.\n- Tools are declared in the `build` method and accessed via `this.tools.toolName` in twist methods.\n- **Don't forget runtime limits** - Each execution has ~10 seconds. Break long operations into batches with the Tasks tool. Process enough items per batch to be efficient, but few enough to stay under time limits.\n- **Always use Callbacks tool for persistent references** - Direct function references don't survive worker restarts.\n- **Store auth tokens** - Don't re-request authentication unnecessarily.\n- **Clean up callbacks and stored state** - Delete callbacks and Store entries when no longer needed.\n- **Handle missing auth gracefully** - Check for stored auth before operations.\n\n## Testing\n\nBefore deploying, verify:\n\n1. Linting passes: `{{packageManager}} lint`\n2. All dependencies are in package.json\n3. Authentication flow works end-to-end\n4. Batch operations handle pagination correctly\n5. Error cases are handled gracefully\n";
8
8
  //# sourceMappingURL=twist-guide-template.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"twist-guide-template.js","sourceRoot":"","sources":["../../src/llm-docs/twist-guide-template.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAe,+mZAA+mZ,CAAC"}
1
+ {"version":3,"file":"twist-guide-template.js","sourceRoot":"","sources":["../../src/llm-docs/twist-guide-template.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAe,gqfAAgqf,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated LLM documentation for @plotday/sdk/twist
2
+ * Generated LLM documentation for @plotday/twister/twist
3
3
  *
4
4
  * This file is auto-generated during build. Do not edit manually.
5
5
  * Generated from: prebuild.ts
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated LLM documentation for @plotday/sdk/twist
2
+ * Generated LLM documentation for @plotday/twister/twist
3
3
  *
4
4
  * This file is auto-generated during build. Do not edit manually.
5
5
  * Generated from: prebuild.ts
package/dist/plot.d.ts CHANGED
@@ -4,8 +4,11 @@ export { Tag } from "./tag";
4
4
  /**
5
5
  * Represents a unique user, contact, or twist in Plot.
6
6
  *
7
- * Note contacts (i.e. people not using Plot) are also represented by ActorIds. They may be
8
- * people interacting with other connected services (e.g. an email sender or event attendee).
7
+ * ActorIds are used throughout Plot for:
8
+ * - Activity authors and assignees
9
+ * - Tag creators (actor_id in activity_tag/note_tag)
10
+ * - Mentions in activities and notes
11
+ * - Any entity that can perform actions in Plot
9
12
  */
10
13
  export type ActorId = string & {
11
14
  readonly __brand: "ActorId";
@@ -162,22 +165,65 @@ export type ActivityLink = {
162
165
  * which is useful for synchronization, deduplication, and linking
163
166
  * back to external systems.
164
167
  *
168
+ * ## Source-Based Upsert
169
+ *
170
+ * When creating an activity with a `source` field, Plot automatically implements
171
+ * **upsert behavior**. If an activity with the same source already exists (created
172
+ * by the same twist definition), it will be **updated** instead of creating a duplicate.
173
+ * This enables safe, idempotent sync operations.
174
+ *
175
+ * ### How Source Uniqueness Works
176
+ *
177
+ * - **Scoped to twist definition**: Sources are unique per twist, not per twist instance.
178
+ * Different instances of the same twist (installed in different priorities) share
179
+ * the same source namespace.
180
+ * - **Independent twists**: Different twists can have activities with the same source value.
181
+ * - **Archived activities**: Archived activities don't conflict with active ones - you can
182
+ * create a new activity with the same source after archiving.
183
+ * - **Optional**: Activities without sources are always created fresh - no deduplication.
184
+ *
185
+ * ### Upsert Behavior Details
186
+ *
187
+ * When an activity is upserted (updated instead of created):
188
+ * - **All provided fields** are updated with new values
189
+ * - **Tags** are merged (existing tags + new tags)
190
+ * - **Notes** are appended (existing notes kept, new ones added)
191
+ * - **Priority** is NOT changed (stays in original priority)
192
+ *
165
193
  * @example
166
194
  * ```typescript
167
- * const googleCalendarMeta: ActivityMeta = {
168
- * type: "google-calendar-event",
169
- * id: "event-123",
170
- * calendarId: "primary",
171
- * htmlLink: "https://calendar.google.com/event/123"
172
- * };
195
+ * // First call creates the activity
196
+ * await plot.createActivity({
197
+ * type: ActivityType.Event,
198
+ * title: "Team Meeting",
199
+ * start: new Date("2024-01-15T10:00:00Z"),
200
+ * source: "google-calendar:event-abc123",
201
+ * meta: {
202
+ * calendarId: "primary",
203
+ * htmlLink: "https://calendar.google.com/event/abc123"
204
+ * }
205
+ * });
206
+ *
207
+ * // Second call with same source updates the existing activity
208
+ * await plot.createActivity({
209
+ * type: ActivityType.Event,
210
+ * title: "Team Meeting (Updated)", // Title will be updated
211
+ * start: new Date("2024-01-15T14:00:00Z"), // Time will be updated
212
+ * source: "google-calendar:event-abc123" // Same source = upsert
213
+ * });
214
+ *
215
+ * // Different twist, same source = creates new activity (independent)
216
+ * // Different source = creates new activity
217
+ * // No source = creates new activity (no deduplication)
173
218
  * ```
174
219
  */
175
220
  export type ActivityMeta = {
176
- /** The type identifier for the source system */
177
- source: string;
178
- /** Additional source-specific properties */
221
+ /** Source-specific properties and metadata */
179
222
  [key: string]: any;
180
223
  };
224
+ export type Tags = {
225
+ [K in Tag]?: ActorId[];
226
+ };
181
227
  /**
182
228
  * Represents a complete activity within the Plot system.
183
229
  *
@@ -191,7 +237,7 @@ export type ActivityMeta = {
191
237
  * const task: Activity = {
192
238
  * type: ActivityType.Note,
193
239
  * title: "New campaign brainstorming ideas",
194
- * note: "We could rent a bouncy castle...",
240
+ * content: "We could rent a bouncy castle...",
195
241
  * author: { id: "user-1", name: "John Doe", type: ActorType.User },
196
242
  * priority: { id: "work", title: "Work" },
197
243
  * // ... other fields
@@ -225,8 +271,10 @@ export type ActivityCommon = {
225
271
  draft: boolean;
226
272
  /** Whether this activity is private (only visible to author) */
227
273
  private: boolean;
274
+ /** Whether this activity has been archived */
275
+ archived: boolean;
228
276
  /** Tags attached to this activity. Maps tag ID to array of actor IDs who added that tag. */
229
- tags: Partial<Record<Tag, ActorId[]>> | null;
277
+ tags: Tags | null;
230
278
  /** Array of actor IDs (users, contacts, or twists) mentioned in this activity via @-mentions */
231
279
  mentions: ActorId[] | null;
232
280
  };
@@ -235,7 +283,45 @@ export type Activity = ActivityCommon & {
235
283
  title: string | null;
236
284
  /** The type of activity (Note, Task, or Event) */
237
285
  type: ActivityType;
238
- /** Who this activity note is assigned to */
286
+ /**
287
+ * The actor assigned to this activity.
288
+ *
289
+ * **For actions (tasks):** An assignee is required. If not explicitly provided when creating
290
+ * an action, the assignee will default to the user who installed the twist (the twist owner).
291
+ *
292
+ * **For notes and events:** Assignee is optional and typically null.
293
+ *
294
+ * @example
295
+ * ```typescript
296
+ * // Create action with explicit assignee
297
+ * const task: NewActivity = {
298
+ * type: ActivityType.Action,
299
+ * title: "Review PR #123",
300
+ * assignee: {
301
+ * id: userId as ActorId,
302
+ * type: ActorType.User,
303
+ * name: "Alice"
304
+ * }
305
+ * };
306
+ *
307
+ * // Create action with auto-assignment (defaults to twist owner)
308
+ * const task: NewActivity = {
309
+ * type: ActivityType.Action,
310
+ * title: "Follow up on email"
311
+ * // assignee will be set automatically to twist owner
312
+ * };
313
+ *
314
+ * // Update assignee
315
+ * await plot.updateActivity({
316
+ * id: activityId,
317
+ * assignee: {
318
+ * id: newUserId as ActorId,
319
+ * type: ActorType.User,
320
+ * name: "Bob"
321
+ * }
322
+ * });
323
+ * ```
324
+ */
239
325
  assignee: Actor | null;
240
326
  /** Timestamp when the activity was marked as complete. Null if not completed. */
241
327
  doneAt: Date | null;
@@ -243,7 +329,31 @@ export type Activity = ActivityCommon & {
243
329
  * Start time of a scheduled activity. Notes are not typically scheduled unless they're about specific times.
244
330
  * For recurring events, this represents the start of the first occurrence.
245
331
  * Can be a Date object for timed events or a date string in "YYYY-MM-DD" format for all-day events.
246
- * Null for activities without scheduled start times.
332
+ *
333
+ * **Activity Scheduling States** (for Actions):
334
+ * - **Do Now** (current/actionable): When creating a NewActivity of type Action, omitting `start` defaults to current time
335
+ * - **Do Later** (future scheduled): Set `start` to a future Date or date string
336
+ * - **Do Someday** (unscheduled backlog): Explicitly set `start: null`
337
+ *
338
+ * @example
339
+ * ```typescript
340
+ * // "Do Now" - defaults to current time when start is omitted
341
+ * await this.tools.plot.createActivity({ type: ActivityType.Action, title: "Urgent task" });
342
+ *
343
+ * // "Do Later" - scheduled for a specific time
344
+ * await this.tools.plot.createActivity({
345
+ * type: ActivityType.Action,
346
+ * title: "Future task",
347
+ * start: new Date("2025-02-01")
348
+ * });
349
+ *
350
+ * // "Do Someday" - unscheduled backlog item
351
+ * await this.tools.plot.createActivity({
352
+ * type: ActivityType.Action,
353
+ * title: "Backlog task",
354
+ * start: null
355
+ * });
356
+ * ```
247
357
  */
248
358
  start: Date | string | null;
249
359
  /**
@@ -283,6 +393,18 @@ export type Activity = ActivityCommon & {
283
393
  * Used to identify which occurrence of a recurring event this exception replaces.
284
394
  */
285
395
  occurrence: Date | null;
396
+ /**
397
+ * Unique identifier for this activity in the source system.
398
+ *
399
+ * Used for deduplication - activities with the same source are upserted instead
400
+ * of creating duplicates. Format is typically "source-name:external-id"
401
+ * (e.g., "google-calendar:event-123", "outlook:message-456").
402
+ *
403
+ * When provided, enables idempotent sync operations - calling createActivity()
404
+ * multiple times with the same source will update the existing activity rather
405
+ * than creating duplicates.
406
+ */
407
+ source: string | null;
286
408
  /** Metadata about the activity, typically from an external system that created it */
287
409
  meta: ActivityMeta | null;
288
410
  };
@@ -333,6 +455,16 @@ export type PickPriorityConfig = {
333
455
  * The ID and author will be automatically assigned by the Plot system
334
456
  * based on the current execution context.
335
457
  *
458
+ * **Important: Scheduling Defaults for Actions**
459
+ *
460
+ * When creating an Activity of type `Action`, the `start` field determines its scheduling state:
461
+ * - **Omit `start`** → Defaults to current time → "Do Now" (appears in today's actionable list)
462
+ * - **Set `start: null`** → Unscheduled → "Do Someday" (backlog item, no specific time)
463
+ * - **Set `start` to future Date** → Scheduled → "Do Later" (appears on that date)
464
+ *
465
+ * For most external task integrations (project management, issue trackers), use `start: null`
466
+ * to create backlog items unless the task is explicitly marked as current/active.
467
+ *
336
468
  * Priority can be specified in three ways:
337
469
  * 1. Explicit priority: `priority: { id: "..." }` - Use specific priority (disables pickPriority)
338
470
  * 2. Pick priority config: `pickPriority: { ... }` - Auto-select based on similarity
@@ -340,26 +472,41 @@ export type PickPriorityConfig = {
340
472
  *
341
473
  * @example
342
474
  * ```typescript
343
- * // Explicit priority (disables automatic matching)
344
- * const newTask: NewActivity = {
475
+ * // "Do Now" - Action defaults to current time (actionable today)
476
+ * const urgentTask: NewActivity = {
477
+ * type: ActivityType.Action,
478
+ * title: "Review pull request"
479
+ * // Omitting start defaults to new Date()
480
+ * };
481
+ *
482
+ * // "Do Someday" - Backlog item (recommended for most synced tasks)
483
+ * const backlogTask: NewActivity = {
484
+ * type: ActivityType.Action,
485
+ * title: "Refactor user service",
486
+ * start: null // Explicitly set to null for backlog
487
+ * };
488
+ *
489
+ * // "Do Later" - Scheduled for specific date
490
+ * const futureTask: NewActivity = {
345
491
  * type: ActivityType.Action,
346
- * title: "Review pull request",
347
- * priority: { id: "work-project-123" }
492
+ * title: "Prepare Q1 review",
493
+ * start: new Date("2025-03-15")
348
494
  * };
349
495
  *
350
- * // Automatic priority matching (default behavior)
351
- * const newNote: NewActivity = {
496
+ * // Note (typically unscheduled)
497
+ * const note: NewActivity = {
352
498
  * type: ActivityType.Note,
353
499
  * title: "Meeting notes",
354
- * note: "Discussed Q4 roadmap..."
355
- * // Defaults to pickPriority: { content: true }
500
+ * content: "Discussed Q4 roadmap...",
501
+ * start: null // Notes typically don't have scheduled times
356
502
  * };
357
503
  *
358
- * // Custom priority matching
359
- * const newEvent: NewActivity = {
504
+ * // Event (always has explicit start/end times)
505
+ * const event: NewActivity = {
360
506
  * type: ActivityType.Event,
361
507
  * title: "Team standup",
362
- * pickPriority: { type: true, content: 50 }
508
+ * start: new Date("2025-01-15T10:00:00"),
509
+ * end: new Date("2025-01-15T10:30:00")
363
510
  * };
364
511
  * ```
365
512
  */
@@ -369,14 +516,25 @@ export type NewActivity = Pick<Activity, "type"> & Partial<Omit<Activity, "id" |
369
516
  } | {
370
517
  /** Configuration for automatic priority selection based on similarity */
371
518
  pickPriority?: PickPriorityConfig;
372
- } | {});
373
- export type ActivityUpdate = Pick<Activity, "id"> & Partial<Pick<Activity, "type" | "start" | "end" | "doneAt" | "title" | "draft" | "private" | "meta" | "recurrenceRule" | "recurrenceDates" | "recurrenceExdates" | "recurrenceUntil" | "recurrenceCount" | "occurrence">> & {
519
+ } | {}) & {
520
+ /**
521
+ * Whether the activity should be marked as unread for users.
522
+ * - true (default): Activity is unread for all users in the priority
523
+ * - false: Activity is marked as read for all users in the priority at creation time
524
+ *
525
+ * Use false for historical imports to avoid marking old items as unread.
526
+ */
527
+ unread?: boolean;
528
+ };
529
+ export type ActivityUpdate = Pick<Activity, "id"> & Partial<Pick<Activity, "type" | "start" | "end" | "doneAt" | "title" | "assignee" | "draft" | "private" | "source" | "meta" | "recurrenceRule" | "recurrenceDates" | "recurrenceExdates" | "recurrenceUntil" | "recurrenceCount" | "occurrence">> & {
374
530
  /**
375
531
  * Full tags object from Activity. Maps tag ID to array of actor IDs who added that tag.
376
532
  * Only allowed for activities created by the twist.
377
533
  * Use twistTags instead for adding/removing the twist's tags on other activities.
378
534
  */
379
- tags?: Partial<Record<Tag, ActorId[]>>;
535
+ tags?: {
536
+ [K in Tag]?: ActorId[];
537
+ };
380
538
  /**
381
539
  * Add or remove the twist's tags.
382
540
  * Maps tag ID to boolean: true = add tag, false = remove tag.
@@ -394,7 +552,7 @@ export type Note = Omit<ActivityCommon, "type"> & {
394
552
  /** The parent activity this note belongs to */
395
553
  activity: Activity;
396
554
  /** Primary content for the note (markdown) */
397
- note: string | null;
555
+ content: string | null;
398
556
  /** Array of interactive links attached to the note */
399
557
  links: Array<ActivityLink> | null;
400
558
  };
@@ -412,25 +570,35 @@ export type NewNote = Partial<Omit<Note, "id" | "author" | "activity">> & {
412
570
  * - 'markdown': Already in markdown format (default, no conversion)
413
571
  * - 'html': HTML content that will be converted to markdown
414
572
  */
415
- noteType?: NoteType;
573
+ contentType?: ContentType;
574
+ /**
575
+ * Whether the note should mark the parent activity as unread for users.
576
+ * - true (default): Activity becomes unread for users who haven't authored the note
577
+ * - false: Activity is marked as read for all users in the priority at note creation time
578
+ *
579
+ * Use false for historical imports to avoid marking old items as unread.
580
+ */
581
+ unread?: boolean;
416
582
  };
417
583
  /**
418
584
  * Type for updating existing notes.
419
585
  */
420
- export type NoteUpdate = Pick<Note, "id"> & Partial<Pick<Note, "draft" | "private" | "note" | "links" | "mentions">> & {
586
+ export type NoteUpdate = Pick<Note, "id"> & Partial<Pick<Note, "draft" | "private" | "content" | "links" | "mentions">> & {
421
587
  /**
422
588
  * Format of the note content. Determines how the note is processed:
423
589
  * - 'text': Plain text that will be converted to markdown (auto-links URLs, preserves line breaks)
424
590
  * - 'markdown': Already in markdown format (default, no conversion)
425
591
  * - 'html': HTML content that will be converted to markdown
426
592
  */
427
- noteType?: NoteType;
593
+ contentType?: ContentType;
428
594
  /**
429
595
  * Full tags object from Note. Maps tag ID to array of actor IDs who added that tag.
430
596
  * Only allowed for notes created by the twist.
431
597
  * Use twistTags instead for adding/removing the twist's tags on other notes.
432
598
  */
433
- tags?: Partial<Record<Tag, ActorId[]>>;
599
+ tags?: {
600
+ [K in Tag]?: ActorId[];
601
+ };
434
602
  /**
435
603
  * Add or remove the twist's tags.
436
604
  * Maps tag ID to boolean: true = add tag, false = remove tag.
@@ -501,5 +669,5 @@ export type NewContact = {
501
669
  /** Optional avatar image URL for the contact */
502
670
  avatar?: string;
503
671
  };
504
- export type NoteType = "text" | "markdown" | "html";
672
+ export type ContentType = "text" | "markdown" | "html";
505
673
  //# sourceMappingURL=plot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../src/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG;IAC/C,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,YAAY;IACtB,qEAAqE;IACrE,IAAI,IAAA;IACJ,+CAA+C;IAC/C,MAAM,IAAA;IACN,8DAA8D;IAC9D,KAAK,IAAA;CACN;AAED;;;;;GAKG;AACH,oBAAY,gBAAgB;IAC1B,8CAA8C;IAC9C,QAAQ,aAAa;IACrB,mDAAmD;IACnD,IAAI,SAAS;IACb,6DAA6D;IAC7D,QAAQ,aAAa;IACrB,+DAA+D;IAC/D,YAAY,iBAAiB;CAC9B;AAED;;;;;GAKG;AACH,oBAAY,oB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