@plotday/twister 0.20.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 (298) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +261 -0
  3. package/bin/commands/build.js +108 -0
  4. package/bin/commands/build.js.map +1 -0
  5. package/bin/commands/create.js +230 -0
  6. package/bin/commands/create.js.map +1 -0
  7. package/bin/commands/deploy.js +292 -0
  8. package/bin/commands/deploy.js.map +1 -0
  9. package/bin/commands/generate.js +301 -0
  10. package/bin/commands/generate.js.map +1 -0
  11. package/bin/commands/lint.js +69 -0
  12. package/bin/commands/lint.js.map +1 -0
  13. package/bin/commands/login.js +140 -0
  14. package/bin/commands/login.js.map +1 -0
  15. package/bin/commands/priority-create.js +102 -0
  16. package/bin/commands/priority-create.js.map +1 -0
  17. package/bin/commands/priority-list.js +47 -0
  18. package/bin/commands/priority-list.js.map +1 -0
  19. package/bin/commands/twist-logs.js +187 -0
  20. package/bin/commands/twist-logs.js.map +1 -0
  21. package/bin/index.js +129 -0
  22. package/bin/index.js.map +1 -0
  23. package/bin/package.json +3 -0
  24. package/bin/plot.cjs +3 -0
  25. package/bin/templates/AGENTS.template.md +403 -0
  26. package/bin/templates/CLAUDE.template.md +1 -0
  27. package/bin/templates/README.template.md +189 -0
  28. package/bin/utils/bundle.js +106 -0
  29. package/bin/utils/bundle.js.map +1 -0
  30. package/bin/utils/output.js +133 -0
  31. package/bin/utils/output.js.map +1 -0
  32. package/bin/utils/packageManager.js +65 -0
  33. package/bin/utils/packageManager.js.map +1 -0
  34. package/bin/utils/sse.js +100 -0
  35. package/bin/utils/sse.js.map +1 -0
  36. package/bin/utils/token.js +75 -0
  37. package/bin/utils/token.js.map +1 -0
  38. package/cli/templates/AGENTS.template.md +403 -0
  39. package/cli/templates/CLAUDE.template.md +1 -0
  40. package/cli/templates/README.template.md +189 -0
  41. package/dist/common/calendar.d.ts +144 -0
  42. package/dist/common/calendar.d.ts.map +1 -0
  43. package/dist/common/calendar.js +2 -0
  44. package/dist/common/calendar.js.map +1 -0
  45. package/dist/common/messaging.d.ts +84 -0
  46. package/dist/common/messaging.d.ts.map +1 -0
  47. package/dist/common/messaging.js +2 -0
  48. package/dist/common/messaging.js.map +1 -0
  49. package/dist/creator-docs.d.ts +11 -0
  50. package/dist/creator-docs.d.ts.map +1 -0
  51. package/dist/creator-docs.js +27 -0
  52. package/dist/creator-docs.js.map +1 -0
  53. package/dist/docs/.nojekyll +1 -0
  54. package/dist/docs/assets/favicon.svg +8 -0
  55. package/dist/docs/assets/hierarchy.js +1 -0
  56. package/dist/docs/assets/highlight.css +134 -0
  57. package/dist/docs/assets/icons.js +18 -0
  58. package/dist/docs/assets/icons.svg +1 -0
  59. package/dist/docs/assets/main.js +60 -0
  60. package/dist/docs/assets/navigation.js +1 -0
  61. package/dist/docs/assets/search.js +1 -0
  62. package/dist/docs/assets/style.css +1633 -0
  63. package/dist/docs/classes/tool.ITool.html +4 -0
  64. package/dist/docs/classes/tool.Tool.html +116 -0
  65. package/dist/docs/classes/tools_ai.AI.html +27 -0
  66. package/dist/docs/classes/tools_callbacks.Callbacks.html +45 -0
  67. package/dist/docs/classes/tools_integrations.Integrations.html +26 -0
  68. package/dist/docs/classes/tools_network.Network.html +68 -0
  69. package/dist/docs/classes/tools_plot.Plot.html +82 -0
  70. package/dist/docs/classes/tools_store.Store.html +53 -0
  71. package/dist/docs/classes/tools_tasks.Tasks.html +39 -0
  72. package/dist/docs/classes/tools_twists.Twists.html +59 -0
  73. package/dist/docs/classes/twist.Twist.html +96 -0
  74. package/dist/docs/documents/Advanced.html +91 -0
  75. package/dist/docs/documents/Building_Custom_Tools.html +200 -0
  76. package/dist/docs/documents/Built-in_Tools.html +170 -0
  77. package/dist/docs/documents/CLI_Reference.html +193 -0
  78. package/dist/docs/documents/Core_Concepts.html +163 -0
  79. package/dist/docs/documents/Getting_Started.html +94 -0
  80. package/dist/docs/documents/Runtime_Environment.html +128 -0
  81. package/dist/docs/enums/plot.ActivityLinkType.html +12 -0
  82. package/dist/docs/enums/plot.ActivityType.html +10 -0
  83. package/dist/docs/enums/plot.ActorType.html +10 -0
  84. package/dist/docs/enums/plot.ConferencingProvider.html +14 -0
  85. package/dist/docs/enums/tag.Tag.html +45 -0
  86. package/dist/docs/enums/tools_ai.AIModel.html +31 -0
  87. package/dist/docs/enums/tools_integrations.AuthLevel.html +7 -0
  88. package/dist/docs/enums/tools_integrations.AuthProvider.html +24 -0
  89. package/dist/docs/enums/tools_plot.ActivityAccess.html +8 -0
  90. package/dist/docs/enums/tools_plot.ContactAccess.html +5 -0
  91. package/dist/docs/enums/tools_plot.PriorityAccess.html +8 -0
  92. package/dist/docs/hierarchy.html +1 -0
  93. package/dist/docs/index.html +100 -0
  94. package/dist/docs/interfaces/common_calendar.Calendar.html +13 -0
  95. package/dist/docs/interfaces/common_calendar.CalendarTool.html +49 -0
  96. package/dist/docs/interfaces/common_calendar.SyncOptions.html +8 -0
  97. package/dist/docs/interfaces/tools_ai.AIRequest.html +46 -0
  98. package/dist/docs/interfaces/tools_ai.AIResponse.html +19 -0
  99. package/dist/docs/interfaces/tools_ai.FilePart.html +14 -0
  100. package/dist/docs/interfaces/tools_ai.ImagePart.html +11 -0
  101. package/dist/docs/interfaces/tools_ai.ReasoningPart.html +7 -0
  102. package/dist/docs/interfaces/tools_ai.RedactedReasoningPart.html +5 -0
  103. package/dist/docs/interfaces/tools_ai.TextPart.html +5 -0
  104. package/dist/docs/interfaces/tools_ai.ToolCallPart.html +9 -0
  105. package/dist/docs/interfaces/tools_ai.ToolExecutionOptions.html +9 -0
  106. package/dist/docs/interfaces/tools_ai.ToolResultPart.html +9 -0
  107. package/dist/docs/interfaces/tools_twists.TwistSource.html +13 -0
  108. package/dist/docs/interfaces/utils_types.ToolShed.html +11 -0
  109. package/dist/docs/modules/common_calendar.html +1 -0
  110. package/dist/docs/modules/index.html +1 -0
  111. package/dist/docs/modules/plot.html +1 -0
  112. package/dist/docs/modules/tag.html +1 -0
  113. package/dist/docs/modules/tool.html +1 -0
  114. package/dist/docs/modules/tools_ai.html +1 -0
  115. package/dist/docs/modules/tools_callbacks.html +1 -0
  116. package/dist/docs/modules/tools_integrations.html +1 -0
  117. package/dist/docs/modules/tools_network.html +1 -0
  118. package/dist/docs/modules/tools_plot.html +1 -0
  119. package/dist/docs/modules/tools_store.html +1 -0
  120. package/dist/docs/modules/tools_tasks.html +1 -0
  121. package/dist/docs/modules/tools_twists.html +1 -0
  122. package/dist/docs/modules/twist.html +1 -0
  123. package/dist/docs/modules/utils_types.html +1 -0
  124. package/dist/docs/modules.html +1 -0
  125. package/dist/docs/types/common_calendar.CalendarAuth.html +7 -0
  126. package/dist/docs/types/plot.Activity.html +64 -0
  127. package/dist/docs/types/plot.ActivityLink.html +22 -0
  128. package/dist/docs/types/plot.ActivityMeta.html +11 -0
  129. package/dist/docs/types/plot.ActivityUpdate.html +13 -0
  130. package/dist/docs/types/plot.Actor.html +15 -0
  131. package/dist/docs/types/plot.ActorId.html +4 -0
  132. package/dist/docs/types/plot.NewActivity.html +16 -0
  133. package/dist/docs/types/plot.NewContact.html +13 -0
  134. package/dist/docs/types/plot.NewPriority.html +5 -0
  135. package/dist/docs/types/plot.NoteType.html +1 -0
  136. package/dist/docs/types/plot.PickPriorityConfig.html +22 -0
  137. package/dist/docs/types/plot.Priority.html +8 -0
  138. package/dist/docs/types/tools_ai.AIAssistantMessage.html +4 -0
  139. package/dist/docs/types/tools_ai.AIMessage.html +3 -0
  140. package/dist/docs/types/tools_ai.AISource.html +11 -0
  141. package/dist/docs/types/tools_ai.AISystemMessage.html +7 -0
  142. package/dist/docs/types/tools_ai.AITool.html +19 -0
  143. package/dist/docs/types/tools_ai.AIToolMessage.html +4 -0
  144. package/dist/docs/types/tools_ai.AIToolSet.html +1 -0
  145. package/dist/docs/types/tools_ai.AIUsage.html +10 -0
  146. package/dist/docs/types/tools_ai.AIUserMessage.html +4 -0
  147. package/dist/docs/types/tools_ai.DataContent.html +2 -0
  148. package/dist/docs/types/tools_ai.ModelPreferences.html +24 -0
  149. package/dist/docs/types/tools_callbacks.Callback.html +8 -0
  150. package/dist/docs/types/tools_integrations.AuthToken.html +16 -0
  151. package/dist/docs/types/tools_integrations.Authorization.html +10 -0
  152. package/dist/docs/types/tools_network.WebhookRequest.html +15 -0
  153. package/dist/docs/types/tools_plot.ActivityIntentHandler.html +9 -0
  154. package/dist/docs/types/tools_twists.Log.html +6 -0
  155. package/dist/docs/types/tools_twists.TwistPermissions.html +12 -0
  156. package/dist/docs/types/utils_types.BuiltInTools.html +5 -0
  157. package/dist/docs/types/utils_types.CallbackMethods.html +3 -0
  158. package/dist/docs/types/utils_types.ExtractBuildReturn.html +2 -0
  159. package/dist/docs/types/utils_types.InferOptions.html +2 -0
  160. package/dist/docs/types/utils_types.InferTools.html +3 -0
  161. package/dist/docs/types/utils_types.NoFunctions.html +3 -0
  162. package/dist/docs/types/utils_types.NonFunction.html +2 -0
  163. package/dist/docs/types/utils_types.PromiseValues.html +3 -0
  164. package/dist/docs/types/utils_types.ToolBuilder.html +3 -0
  165. package/dist/index.d.ts +7 -0
  166. package/dist/index.d.ts.map +1 -0
  167. package/dist/index.js +7 -0
  168. package/dist/index.js.map +1 -0
  169. package/dist/llm-docs/common/calendar.d.ts +9 -0
  170. package/dist/llm-docs/common/calendar.d.ts.map +1 -0
  171. package/dist/llm-docs/common/calendar.js +8 -0
  172. package/dist/llm-docs/common/calendar.js.map +1 -0
  173. package/dist/llm-docs/common/messaging.d.ts +9 -0
  174. package/dist/llm-docs/common/messaging.d.ts.map +1 -0
  175. package/dist/llm-docs/common/messaging.js +8 -0
  176. package/dist/llm-docs/common/messaging.js.map +1 -0
  177. package/dist/llm-docs/creator-docs.d.ts +9 -0
  178. package/dist/llm-docs/creator-docs.d.ts.map +1 -0
  179. package/dist/llm-docs/creator-docs.js +8 -0
  180. package/dist/llm-docs/creator-docs.js.map +1 -0
  181. package/dist/llm-docs/index.d.ts +11 -0
  182. package/dist/llm-docs/index.d.ts.map +1 -0
  183. package/dist/llm-docs/index.js +42 -0
  184. package/dist/llm-docs/index.js.map +1 -0
  185. package/dist/llm-docs/plot.d.ts +9 -0
  186. package/dist/llm-docs/plot.d.ts.map +1 -0
  187. package/dist/llm-docs/plot.js +8 -0
  188. package/dist/llm-docs/plot.js.map +1 -0
  189. package/dist/llm-docs/tag.d.ts +9 -0
  190. package/dist/llm-docs/tag.d.ts.map +1 -0
  191. package/dist/llm-docs/tag.js +8 -0
  192. package/dist/llm-docs/tag.js.map +1 -0
  193. package/dist/llm-docs/tool.d.ts +9 -0
  194. package/dist/llm-docs/tool.d.ts.map +1 -0
  195. package/dist/llm-docs/tool.js +8 -0
  196. package/dist/llm-docs/tool.js.map +1 -0
  197. package/dist/llm-docs/tools/ai.d.ts +9 -0
  198. package/dist/llm-docs/tools/ai.d.ts.map +1 -0
  199. package/dist/llm-docs/tools/ai.js +8 -0
  200. package/dist/llm-docs/tools/ai.js.map +1 -0
  201. package/dist/llm-docs/tools/callbacks.d.ts +9 -0
  202. package/dist/llm-docs/tools/callbacks.d.ts.map +1 -0
  203. package/dist/llm-docs/tools/callbacks.js +8 -0
  204. package/dist/llm-docs/tools/callbacks.js.map +1 -0
  205. package/dist/llm-docs/tools/integrations.d.ts +9 -0
  206. package/dist/llm-docs/tools/integrations.d.ts.map +1 -0
  207. package/dist/llm-docs/tools/integrations.js +8 -0
  208. package/dist/llm-docs/tools/integrations.js.map +1 -0
  209. package/dist/llm-docs/tools/network.d.ts +9 -0
  210. package/dist/llm-docs/tools/network.d.ts.map +1 -0
  211. package/dist/llm-docs/tools/network.js +8 -0
  212. package/dist/llm-docs/tools/network.js.map +1 -0
  213. package/dist/llm-docs/tools/plot.d.ts +9 -0
  214. package/dist/llm-docs/tools/plot.d.ts.map +1 -0
  215. package/dist/llm-docs/tools/plot.js +8 -0
  216. package/dist/llm-docs/tools/plot.js.map +1 -0
  217. package/dist/llm-docs/tools/store.d.ts +9 -0
  218. package/dist/llm-docs/tools/store.d.ts.map +1 -0
  219. package/dist/llm-docs/tools/store.js +8 -0
  220. package/dist/llm-docs/tools/store.js.map +1 -0
  221. package/dist/llm-docs/tools/tasks.d.ts +9 -0
  222. package/dist/llm-docs/tools/tasks.d.ts.map +1 -0
  223. package/dist/llm-docs/tools/tasks.js +8 -0
  224. package/dist/llm-docs/tools/tasks.js.map +1 -0
  225. package/dist/llm-docs/tools/twists.d.ts +9 -0
  226. package/dist/llm-docs/tools/twists.d.ts.map +1 -0
  227. package/dist/llm-docs/tools/twists.js +8 -0
  228. package/dist/llm-docs/tools/twists.js.map +1 -0
  229. package/dist/llm-docs/twist-guide-template.d.ts +9 -0
  230. package/dist/llm-docs/twist-guide-template.d.ts.map +1 -0
  231. package/dist/llm-docs/twist-guide-template.js +8 -0
  232. package/dist/llm-docs/twist-guide-template.js.map +1 -0
  233. package/dist/llm-docs/twist.d.ts +9 -0
  234. package/dist/llm-docs/twist.d.ts.map +1 -0
  235. package/dist/llm-docs/twist.js +8 -0
  236. package/dist/llm-docs/twist.js.map +1 -0
  237. package/dist/plot.d.ts +463 -0
  238. package/dist/plot.d.ts.map +1 -0
  239. package/dist/plot.js +68 -0
  240. package/dist/plot.js.map +1 -0
  241. package/dist/tag.d.ts +47 -0
  242. package/dist/tag.d.ts.map +1 -0
  243. package/dist/tag.js +51 -0
  244. package/dist/tag.js.map +1 -0
  245. package/dist/tool.d.ts +242 -0
  246. package/dist/tool.d.ts.map +1 -0
  247. package/dist/tool.js +283 -0
  248. package/dist/tool.js.map +1 -0
  249. package/dist/tools/ai.d.ts +697 -0
  250. package/dist/tools/ai.d.ts.map +1 -0
  251. package/dist/tools/ai.js +104 -0
  252. package/dist/tools/ai.js.map +1 -0
  253. package/dist/tools/callbacks.d.ts +96 -0
  254. package/dist/tools/callbacks.d.ts.map +1 -0
  255. package/dist/tools/callbacks.js +40 -0
  256. package/dist/tools/callbacks.js.map +1 -0
  257. package/dist/tools/index.d.ts +9 -0
  258. package/dist/tools/index.d.ts.map +1 -0
  259. package/dist/tools/index.js +9 -0
  260. package/dist/tools/index.js.map +1 -0
  261. package/dist/tools/integrations.d.ts +142 -0
  262. package/dist/tools/integrations.d.ts.map +1 -0
  263. package/dist/tools/integrations.js +79 -0
  264. package/dist/tools/integrations.js.map +1 -0
  265. package/dist/tools/network.d.ts +188 -0
  266. package/dist/tools/network.d.ts.map +1 -0
  267. package/dist/tools/network.js +87 -0
  268. package/dist/tools/network.js.map +1 -0
  269. package/dist/tools/plot.d.ts +252 -0
  270. package/dist/tools/plot.d.ts.map +1 -0
  271. package/dist/tools/plot.js +72 -0
  272. package/dist/tools/plot.js.map +1 -0
  273. package/dist/tools/store.d.ts +90 -0
  274. package/dist/tools/store.d.ts.map +1 -0
  275. package/dist/tools/store.js +48 -0
  276. package/dist/tools/store.js.map +1 -0
  277. package/dist/tools/tasks.d.ts +93 -0
  278. package/dist/tools/tasks.d.ts.map +1 -0
  279. package/dist/tools/tasks.js +58 -0
  280. package/dist/tools/tasks.js.map +1 -0
  281. package/dist/tools/twists.d.ts +213 -0
  282. package/dist/tools/twists.d.ts.map +1 -0
  283. package/dist/tools/twists.js +26 -0
  284. package/dist/tools/twists.js.map +1 -0
  285. package/dist/twist-guide.d.ts +2 -0
  286. package/dist/twist-guide.d.ts.map +1 -0
  287. package/dist/twist-guide.js +9 -0
  288. package/dist/twist-guide.js.map +1 -0
  289. package/dist/twist.d.ts +204 -0
  290. package/dist/twist.d.ts.map +1 -0
  291. package/dist/twist.js +216 -0
  292. package/dist/twist.js.map +1 -0
  293. package/dist/utils/types.d.ts +91 -0
  294. package/dist/utils/types.d.ts.map +1 -0
  295. package/dist/utils/types.js +2 -0
  296. package/dist/utils/types.js.map +1 -0
  297. package/package.json +206 -0
  298. package/tsconfig.base.json +28 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/tools/ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA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Q,EAAE,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAEN,MAAM,MAAM,SAAS,GAAG,MAAM,CAC5B,MAAM,EACN,CACI,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GACpB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAChB,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAClB,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CACrB,GACC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,CACpC,CAAC;AAMF,KAAK,aAAa,CAAC,MAAM,SAAS,SAAS,IAAI;IAC7C,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,aAAa,CAAC,KAAK,SAAS,SAAS,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AAE1E,KAAK,eAAe,CAAC,MAAM,SAAS,SAAS,IAAI;IAC/C,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe,CAAC,KAAK,SAAS,SAAS,IAAI,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC"}
@@ -0,0 +1,104 @@
1
+ import { ITool } from "..";
2
+ /**
3
+ * Built-in tool for prompting Large Language Models (LLMs).
4
+ *
5
+ * The AI tool provides twists and tools with access to LLM capabilities
6
+ * for natural language processing, text generation, data extraction,
7
+ * and intelligent decision making within their workflows.
8
+ *
9
+ * **Features:**
10
+ * - Access to multiple AI providers (OpenAI, Anthropic, Google, Workers AI)
11
+ * - Multi-turn conversation support with `messages`
12
+ * - Tool calling with automatic execution
13
+ * - Structured output with Typebox schemas via `outputSchema`
14
+ * - Unified API across all models via Vercel AI SDK
15
+ * - Automatic response parsing and validation with full type inference
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import { Type } from "typebox";
20
+ *
21
+ * class SmartEmailTool extends Tool {
22
+ * private ai: AI;
23
+ *
24
+ * constructor(id: string, tools: ToolBuilder) {
25
+ * super();
26
+ * this.ai = tools.get(AI);
27
+ * }
28
+ *
29
+ * async categorizeEmail(emailContent: string) {
30
+ * // Define the output schema using Typebox
31
+ * const schema = Type.Object({
32
+ * category: Type.Union([
33
+ * Type.Literal("work"),
34
+ * Type.Literal("personal"),
35
+ * Type.Literal("spam"),
36
+ * Type.Literal("promotional")
37
+ * ]),
38
+ * confidence: Type.Number({ minimum: 0, maximum: 1 }),
39
+ * reasoning: Type.Optional(Type.String())
40
+ * });
41
+ *
42
+ * const response = await this.ai.prompt({
43
+ * model: { speed: "fast", cost: "medium" },
44
+ * system: "Classify emails into categories: work, personal, spam, or promotional.",
45
+ * prompt: `Categorize this email: ${emailContent}`,
46
+ * outputSchema: schema
47
+ * });
48
+ *
49
+ * return response.output;
50
+ * }
51
+ *
52
+ * async generateResponse(emailContent: string) {
53
+ * const response = await this.ai.prompt({
54
+ * model: { speed: "fast", cost: "medium" },
55
+ * system: "Generate professional email responses that are helpful and concise.",
56
+ * prompt: `Write a response to: ${emailContent}`
57
+ * });
58
+ *
59
+ * return response.text;
60
+ * }
61
+ * }
62
+ * ```
63
+ */
64
+ export class AI extends ITool {
65
+ }
66
+ /**
67
+ * Supported AI models available through Cloudflare AI Gateway and Workers AI.
68
+ *
69
+ * Models are organized by provider:
70
+ * - **OpenAI**: Latest GPT models via AI Gateway
71
+ * - **Anthropic**: Claude models via AI Gateway (prefix with "anthropic/")
72
+ * - **Google**: Gemini models via AI Gateway (prefix with "google-ai-studio/")
73
+ * - **Workers AI**: Models running on Cloudflare's network (free/low cost)
74
+ */
75
+ export var AIModel;
76
+ (function (AIModel) {
77
+ // OpenAI models - Latest GPT and reasoning models
78
+ AIModel["GPT_5"] = "openai/gpt-5";
79
+ AIModel["GPT_5_PRO"] = "openai/gpt-5-pro";
80
+ AIModel["GPT_5_MINI"] = "openai/gpt-5-mini";
81
+ AIModel["GPT_5_NANO"] = "openai/gpt-5-nano";
82
+ AIModel["GPT_4O"] = "openai/gpt-4o";
83
+ AIModel["GPT_4O_MINI"] = "openai/gpt-4o-mini";
84
+ AIModel["O3"] = "openai/o3";
85
+ AIModel["O3_MINI"] = "openai/o3-mini";
86
+ // Anthropic models - Claude 4.x and 3.7 series
87
+ AIModel["CLAUDE_SONNET_45"] = "anthropic/claude-sonnet-4-5";
88
+ AIModel["CLAUDE_HAIKU_45"] = "anthropic/claude-haiku-4-5";
89
+ AIModel["CLAUDE_OPUS_41"] = "anthropic/claude-opus-4-1";
90
+ AIModel["CLAUDE_37_SONNET"] = "anthropic/claude-3-7-sonnet-latest";
91
+ // Google models - Gemini 2.x series
92
+ AIModel["GEMINI_25_PRO"] = "google/gemini-2.5-pro";
93
+ AIModel["GEMINI_25_FLASH"] = "google/gemini-2.5-flash";
94
+ AIModel["GEMINI_25_FLASH_LITE"] = "google/gemini-2.5-flash-lite";
95
+ AIModel["GEMINI_20_FLASH"] = "google/gemini-2.0-flash";
96
+ AIModel["GEMINI_20_FLASH_LITE"] = "google/gemini-2.0-flash-lite";
97
+ // Cloudflare Workers AI models - Free/low-cost models running on Cloudflare's network
98
+ AIModel["LLAMA_4_SCOUT_17B"] = "meta/llama-4-scout-17b-16e-instruct";
99
+ AIModel["LLAMA_33_70B"] = "meta/llama-3.3-70b-instruct-fp8-fast";
100
+ AIModel["LLAMA_31_8B"] = "meta/llama-3.1-8b-instruct-fp8";
101
+ AIModel["LLAMA_32_1B"] = "meta/llama-3.2-1b-instruct";
102
+ AIModel["DEEPSEEK_R1_32B"] = "deepseek-ai/deepseek-r1-distill-qwen-32b";
103
+ })(AIModel || (AIModel = {}));
104
+ //# sourceMappingURL=ai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.js","sourceRoot":"","sources":["../../src/tools/ai.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,OAAgB,EAAG,SAAQ,KAAK;CAgFrC;AA0DD;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,OA8BX;AA9BD,WAAY,OAAO;IACjB,kDAAkD;IAClD,iCAAsB,CAAA;IACtB,yCAA8B,CAAA;IAC9B,2CAAgC,CAAA;IAChC,2CAAgC,CAAA;IAChC,mCAAwB,CAAA;IACxB,6CAAkC,CAAA;IAClC,2BAAgB,CAAA;IAChB,qCAA0B,CAAA;IAE1B,+CAA+C;IAC/C,2DAAgD,CAAA;IAChD,yDAA8C,CAAA;IAC9C,uDAA4C,CAAA;IAC5C,kEAAuD,CAAA;IAEvD,oCAAoC;IACpC,kDAAuC,CAAA;IACvC,sDAA2C,CAAA;IAC3C,gEAAqD,CAAA;IACrD,sDAA2C,CAAA;IAC3C,gEAAqD,CAAA;IAErD,sFAAsF;IACtF,oEAAyD,CAAA;IACzD,gEAAqD,CAAA;IACrD,yDAA8C,CAAA;IAC9C,qDAA0C,CAAA;IAC1C,uEAA4D,CAAA;AAC9D,CAAC,EA9BW,OAAO,KAAP,OAAO,QA8BlB"}
@@ -0,0 +1,96 @@
1
+ import { ITool } from "..";
2
+ import type { CallbackMethods, NoFunctions, NonFunction } from "../utils/types";
3
+ export type { CallbackMethods, NoFunctions, NonFunction };
4
+ /**
5
+ * Represents a callback token for persistent function references.
6
+ *
7
+ * Callbacks enable tools and twists to create persistent references to functions
8
+ * that can survive worker restarts and be invoked across different execution contexts.
9
+ *
10
+ * This is a branded string type to prevent mixing callback tokens with regular strings.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const callback = await this.callback(this.onCalendarSelected, "primary", "google");
15
+ * ```
16
+ */
17
+ export type Callback = string & {
18
+ readonly __brand: "Callback";
19
+ };
20
+ /**
21
+ * Built-in tool for creating and managing persistent callback references.
22
+ *
23
+ * The Callbacks tool enables twists and tools to create callback links that persist
24
+ * across worker invocations and restarts. This is essential for webhook handlers,
25
+ * scheduled operations, and user interaction flows that need to survive runtime
26
+ * boundaries.
27
+ *
28
+ * **Note:** Callback methods are also available directly on Twist and Tool classes
29
+ * via `this.callback()`, `this.deleteCallback()`, `this.deleteAllCallbacks()`, and
30
+ * `this.run()`. This is the recommended approach for most use cases.
31
+ *
32
+ * **When to use callbacks:**
33
+ * - Webhook handlers that need persistent function references
34
+ * - Scheduled operations that run after worker timeouts
35
+ * - User interaction links (ActivityLinkType.callback)
36
+ * - Cross-tool communication that survives restarts
37
+ *
38
+ * **Type Safety:**
39
+ * Callbacks are fully type-safe - extraArgs are type-checked against the function signature.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * class MyTool extends Tool {
44
+ * async setupWebhook() {
45
+ * // Using built-in callback method (recommended)
46
+ * const callback = await this.callback(this.handleWebhook, "calendar");
47
+ * return `https://api.plot.day/webhook/${callback}`;
48
+ * }
49
+ *
50
+ * async handleWebhook(data: any, webhookType: string) {
51
+ * console.log("Webhook received:", data, webhookType);
52
+ * }
53
+ * }
54
+ * ```
55
+ */
56
+ export declare abstract class Callbacks extends ITool {
57
+ /**
58
+ * Creates a persistent callback to a method on the current class.
59
+ *
60
+ * @param fn - The function to callback
61
+ * @param extraArgs - Additional arguments to pass to the function (must be serializable)
62
+ * @returns Promise resolving to a persistent callback token
63
+ */
64
+ abstract create(fn: Function, ...extraArgs: any[]): Promise<Callback>;
65
+ /**
66
+ * Creates a persistent callback to a function from the parent twist/tool.
67
+ * Use this when the callback function is passed in from outside this class.
68
+ *
69
+ * @param fn - The function to callback
70
+ * @param extraArgs - Additional arguments to pass to the function (must be serializable, validated at runtime)
71
+ * @returns Promise resolving to a persistent callback token
72
+ */
73
+ abstract createFromParent(fn: Function, ...extraArgs: any[]): Promise<Callback>;
74
+ /**
75
+ * Deletes a specific callback by its token.
76
+ *
77
+ * @param callback - The callback token to delete
78
+ * @returns Promise that resolves when the callback is deleted
79
+ */
80
+ abstract delete(callback: Callback): Promise<void>;
81
+ /**
82
+ * Deletes all callbacks for the tool's parent.
83
+ *
84
+ * @returns Promise that resolves when all callbacks are deleted
85
+ */
86
+ abstract deleteAll(): Promise<void>;
87
+ /**
88
+ * Executes a callback by its token.
89
+ *
90
+ * @param callback - The callback token returned by create()
91
+ * @param args - Optional arguments to pass to the callback function
92
+ * @returns Promise resolving to the callback result
93
+ */
94
+ abstract run<T = unknown>(callback: Callback, ...args: any[]): Promise<T>;
95
+ }
96
+ //# sourceMappingURL=callbacks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callbacks.d.ts","sourceRoot":"","sources":["../../src/tools/callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGhF,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,8BAAsB,SAAU,SAAQ,KAAK;IAC3C;;;;;;OAMG;IAEH,QAAQ,CAAC,MAAM,CACb,EAAE,EAAE,QAAQ,EACZ,GAAG,SAAS,EAAE,GAAG,EAAE,GAClB,OAAO,CAAC,QAAQ,CAAC;IAEpB;;;;;;;OAOG;IAEH,QAAQ,CAAC,gBAAgB,CACvB,EAAE,EAAE,QAAQ,EACZ,GAAG,SAAS,EAAE,GAAG,EAAE,GAClB,OAAO,CAAC,QAAQ,CAAC;IAEpB;;;;;OAKG;IAEH,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAElD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEnC;;;;;;OAMG;IAEH,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;CAC1E"}
@@ -0,0 +1,40 @@
1
+ import { ITool } from "..";
2
+ /**
3
+ * Built-in tool for creating and managing persistent callback references.
4
+ *
5
+ * The Callbacks tool enables twists and tools to create callback links that persist
6
+ * across worker invocations and restarts. This is essential for webhook handlers,
7
+ * scheduled operations, and user interaction flows that need to survive runtime
8
+ * boundaries.
9
+ *
10
+ * **Note:** Callback methods are also available directly on Twist and Tool classes
11
+ * via `this.callback()`, `this.deleteCallback()`, `this.deleteAllCallbacks()`, and
12
+ * `this.run()`. This is the recommended approach for most use cases.
13
+ *
14
+ * **When to use callbacks:**
15
+ * - Webhook handlers that need persistent function references
16
+ * - Scheduled operations that run after worker timeouts
17
+ * - User interaction links (ActivityLinkType.callback)
18
+ * - Cross-tool communication that survives restarts
19
+ *
20
+ * **Type Safety:**
21
+ * Callbacks are fully type-safe - extraArgs are type-checked against the function signature.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * class MyTool extends Tool {
26
+ * async setupWebhook() {
27
+ * // Using built-in callback method (recommended)
28
+ * const callback = await this.callback(this.handleWebhook, "calendar");
29
+ * return `https://api.plot.day/webhook/${callback}`;
30
+ * }
31
+ *
32
+ * async handleWebhook(data: any, webhookType: string) {
33
+ * console.log("Webhook received:", data, webhookType);
34
+ * }
35
+ * }
36
+ * ```
37
+ */
38
+ export class Callbacks extends ITool {
39
+ }
40
+ //# sourceMappingURL=callbacks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callbacks.js","sourceRoot":"","sources":["../../src/tools/callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAqB3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAgB,SAAU,SAAQ,KAAK;CAqD5C"}
@@ -0,0 +1,9 @@
1
+ export * from "./twists";
2
+ export * from "./ai";
3
+ export * from "./callbacks";
4
+ export * from "./integrations";
5
+ export * from "./network";
6
+ export * from "./plot";
7
+ export * from "./store";
8
+ export * from "./tasks";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from "./twists";
2
+ export * from "./ai";
3
+ export * from "./callbacks";
4
+ export * from "./integrations";
5
+ export * from "./network";
6
+ export * from "./plot";
7
+ export * from "./store";
8
+ export * from "./tasks";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,142 @@
1
+ import { type ActivityLink, ITool } from "..";
2
+ import { type NoFunctions } from "./callbacks";
3
+ /**
4
+ * Built-in tool for managing OAuth authentication flows.
5
+ *
6
+ * The Integrations tool provides a unified interface for requesting user authorization
7
+ * from external service providers like Google and Microsoft. It handles the
8
+ * OAuth flow creation, token management, and callback integration.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * class CalendarTool extends Tool {
13
+ * private auth: Integrations;
14
+ *
15
+ * constructor(id: string, tools: ToolBuilder) {
16
+ * super();
17
+ * this.integrations = tools.get(Integrations);
18
+ * }
19
+ *
20
+ * async requestAuth() {
21
+ * return await this.integrations.request({
22
+ * provider: AuthProvider.Google,
23
+ * level: AuthLevel.User,
24
+ * scopes: ["https://www.googleapis.com/auth/calendar.readonly"]
25
+ * }, {
26
+ * functionName: "onAuthComplete",
27
+ * context: { provider: "google" }
28
+ * });
29
+ * }
30
+ *
31
+ * async onAuthComplete(authResult: Authorization, context: any) {
32
+ * const authToken = await this.integrations.get(authResult);
33
+ * }
34
+ * }
35
+ * ```
36
+ */
37
+ export declare abstract class Integrations extends ITool {
38
+ /**
39
+ * Initiates an OAuth authentication flow.
40
+ *
41
+ * Creates an authentication link that users can click to authorize access
42
+ * to the specified provider with the requested scopes. When authorization
43
+ * completes, the callback will be invoked with the Authorization and any extraArgs.
44
+ *
45
+ * @param auth - Authentication configuration
46
+ * @param auth.provider - The OAuth provider to authenticate with
47
+ * @param auth.level - The authorization level (priority-scoped or user-scoped)
48
+ * @param auth.scopes - Array of OAuth scopes to request
49
+ * @param callback - Function receiving (authorization, ...extraArgs)
50
+ * @param extraArgs - Additional arguments to pass to the callback (type-checked, must be serializable)
51
+ * @returns Promise resolving to an ActivityLink for the auth flow
52
+ */
53
+ abstract request<TCallback extends (auth: Authorization, ...args: any[]) => any>(auth: {
54
+ provider: AuthProvider;
55
+ level: AuthLevel;
56
+ scopes: string[];
57
+ }, callback: TCallback, ...extraArgs: TCallback extends (auth: any, ...rest: infer R) => any ? NoFunctions<R> : []): Promise<ActivityLink>;
58
+ /**
59
+ * Retrieves an access token (refreshing it first if necessary).
60
+ *
61
+ * Returns null if the authorization is no longer valid or has been revoked.
62
+ *
63
+ * @param authorization - The authorization from the request callback
64
+ * @returns Promise resolving to the access token or null if no longer available
65
+ */
66
+ abstract get(authorization: Authorization): Promise<AuthToken | null>;
67
+ }
68
+ /**
69
+ * Enumeration of supported OAuth providers.
70
+ *
71
+ * Each provider has different OAuth endpoints, scopes, and token formats.
72
+ * The Integrations tool handles the provider-specific implementation details.
73
+ */
74
+ export declare enum AuthProvider {
75
+ /** Google OAuth provider for Google Workspace services */
76
+ Google = "google",
77
+ /** Microsoft OAuth provider for Microsoft 365 services */
78
+ Microsoft = "microsoft",
79
+ /** Notion OAuth provider for Notion workspaces */
80
+ Notion = "notion",
81
+ /** Slack OAuth provider for Slack workspaces */
82
+ Slack = "slack",
83
+ /** Atlassian OAuth provider for Jira and Confluence */
84
+ Atlassian = "atlassian",
85
+ /** Linear OAuth provider for Linear workspaces */
86
+ Linear = "linear",
87
+ /** Monday.com OAuth provider */
88
+ Monday = "monday",
89
+ /** GitHub OAuth provider for GitHub repositories and organizations */
90
+ GitHub = "github",
91
+ /** Asana OAuth provider for Asana workspaces */
92
+ Asana = "asana",
93
+ /** HubSpot OAuth provider for HubSpot CRM */
94
+ HubSpot = "hubspot"
95
+ }
96
+ /**
97
+ * Enumeration of authorization levels for OAuth flows.
98
+ *
99
+ * Different levels determine the scope and storage of authentication tokens.
100
+ */
101
+ export declare enum AuthLevel {
102
+ /** Priority-scoped authorization shared across twists in a priority */
103
+ Priority = "priority",
104
+ /** User-scoped authorization specific to individual users */
105
+ User = "user"
106
+ }
107
+ /**
108
+ * Represents authorization criteria for token lookup.
109
+ *
110
+ * Used to specify which authentication token to retrieve from storage
111
+ * based on provider, scopes, and authorization ID.
112
+ */
113
+ export type Authorization = {
114
+ /** Unique identifier for this authorization */
115
+ id: string;
116
+ /** The OAuth provider this authorization is for */
117
+ provider: AuthProvider;
118
+ /** Array of OAuth scopes this authorization covers */
119
+ scopes: string[];
120
+ };
121
+ /**
122
+ * Represents a stored OAuth authentication token.
123
+ *
124
+ * Contains the actual access token and the scopes it was granted,
125
+ * which may be a subset of the originally requested scopes.
126
+ */
127
+ export type AuthToken = {
128
+ /** The OAuth access token */
129
+ token: string;
130
+ /** Array of granted OAuth scopes */
131
+ scopes: string[];
132
+ /**
133
+ * Provider-specific metadata as key-value pairs.
134
+ *
135
+ * For Slack (AuthProvider.Slack):
136
+ * - authed_user_id: The authenticated user's Slack ID
137
+ * - bot_user_id: The bot user's Slack ID
138
+ * - team_name: The Slack workspace/team name
139
+ */
140
+ provider?: Record<string, string>;
141
+ };
142
+ //# sourceMappingURL=integrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/tools/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,8BAAsB,YAAa,SAAQ,KAAK;IAC9C;;;;;;;;;;;;;;OAcG;IAEH,QAAQ,CAAC,OAAO,CACd,SAAS,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAE9D,IAAI,EAAE;QACJ,QAAQ,EAAE,YAAY,CAAC;QACvB,KAAK,EAAE,SAAS,CAAC;QACjB,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,EACD,QAAQ,EAAE,SAAS,EACnB,GAAG,SAAS,EAAE,SAAS,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,GAAG,GAChE,WAAW,CAAC,CAAC,CAAC,GACd,EAAE,GACL,OAAO,CAAC,YAAY,CAAC;IAExB;;;;;;;OAOG;IAEH,QAAQ,CAAC,GAAG,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;CACtE;AAED;;;;;GAKG;AACH,oBAAY,YAAY;IACtB,0DAA0D;IAC1D,MAAM,WAAW;IACjB,0DAA0D;IAC1D,SAAS,cAAc;IACvB,kDAAkD;IAClD,MAAM,WAAW;IACjB,gDAAgD;IAChD,KAAK,UAAU;IACf,uDAAuD;IACvD,SAAS,cAAc;IACvB,kDAAkD;IAClD,MAAM,WAAW;IACjB,gCAAgC;IAChC,MAAM,WAAW;IACjB,sEAAsE;IACtE,MAAM,WAAW;IACjB,gDAAgD;IAChD,KAAK,UAAU;IACf,6CAA6C;IAC7C,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,oBAAY,SAAS;IACnB,uEAAuE;IACvE,QAAQ,aAAa;IACrB,6DAA6D;IAC7D,IAAI,SAAS;CACd;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,QAAQ,EAAE,YAAY,CAAC;IACvB,sDAAsD;IACtD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { ITool } from "..";
2
+ /**
3
+ * Built-in tool for managing OAuth authentication flows.
4
+ *
5
+ * The Integrations tool provides a unified interface for requesting user authorization
6
+ * from external service providers like Google and Microsoft. It handles the
7
+ * OAuth flow creation, token management, and callback integration.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * class CalendarTool extends Tool {
12
+ * private auth: Integrations;
13
+ *
14
+ * constructor(id: string, tools: ToolBuilder) {
15
+ * super();
16
+ * this.integrations = tools.get(Integrations);
17
+ * }
18
+ *
19
+ * async requestAuth() {
20
+ * return await this.integrations.request({
21
+ * provider: AuthProvider.Google,
22
+ * level: AuthLevel.User,
23
+ * scopes: ["https://www.googleapis.com/auth/calendar.readonly"]
24
+ * }, {
25
+ * functionName: "onAuthComplete",
26
+ * context: { provider: "google" }
27
+ * });
28
+ * }
29
+ *
30
+ * async onAuthComplete(authResult: Authorization, context: any) {
31
+ * const authToken = await this.integrations.get(authResult);
32
+ * }
33
+ * }
34
+ * ```
35
+ */
36
+ export class Integrations extends ITool {
37
+ }
38
+ /**
39
+ * Enumeration of supported OAuth providers.
40
+ *
41
+ * Each provider has different OAuth endpoints, scopes, and token formats.
42
+ * The Integrations tool handles the provider-specific implementation details.
43
+ */
44
+ export var AuthProvider;
45
+ (function (AuthProvider) {
46
+ /** Google OAuth provider for Google Workspace services */
47
+ AuthProvider["Google"] = "google";
48
+ /** Microsoft OAuth provider for Microsoft 365 services */
49
+ AuthProvider["Microsoft"] = "microsoft";
50
+ /** Notion OAuth provider for Notion workspaces */
51
+ AuthProvider["Notion"] = "notion";
52
+ /** Slack OAuth provider for Slack workspaces */
53
+ AuthProvider["Slack"] = "slack";
54
+ /** Atlassian OAuth provider for Jira and Confluence */
55
+ AuthProvider["Atlassian"] = "atlassian";
56
+ /** Linear OAuth provider for Linear workspaces */
57
+ AuthProvider["Linear"] = "linear";
58
+ /** Monday.com OAuth provider */
59
+ AuthProvider["Monday"] = "monday";
60
+ /** GitHub OAuth provider for GitHub repositories and organizations */
61
+ AuthProvider["GitHub"] = "github";
62
+ /** Asana OAuth provider for Asana workspaces */
63
+ AuthProvider["Asana"] = "asana";
64
+ /** HubSpot OAuth provider for HubSpot CRM */
65
+ AuthProvider["HubSpot"] = "hubspot";
66
+ })(AuthProvider || (AuthProvider = {}));
67
+ /**
68
+ * Enumeration of authorization levels for OAuth flows.
69
+ *
70
+ * Different levels determine the scope and storage of authentication tokens.
71
+ */
72
+ export var AuthLevel;
73
+ (function (AuthLevel) {
74
+ /** Priority-scoped authorization shared across twists in a priority */
75
+ AuthLevel["Priority"] = "priority";
76
+ /** User-scoped authorization specific to individual users */
77
+ AuthLevel["User"] = "user";
78
+ })(AuthLevel || (AuthLevel = {}));
79
+ //# sourceMappingURL=integrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../src/tools/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,IAAI,CAAC;AAG9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAgB,YAAa,SAAQ,KAAK;CAyC/C;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,YAqBX;AArBD,WAAY,YAAY;IACtB,0DAA0D;IAC1D,iCAAiB,CAAA;IACjB,0DAA0D;IAC1D,uCAAuB,CAAA;IACvB,kDAAkD;IAClD,iCAAiB,CAAA;IACjB,gDAAgD;IAChD,+BAAe,CAAA;IACf,uDAAuD;IACvD,uCAAuB,CAAA;IACvB,kDAAkD;IAClD,iCAAiB,CAAA;IACjB,gCAAgC;IAChC,iCAAiB,CAAA;IACjB,sEAAsE;IACtE,iCAAiB,CAAA;IACjB,gDAAgD;IAChD,+BAAe,CAAA;IACf,6CAA6C;IAC7C,mCAAmB,CAAA;AACrB,CAAC,EArBW,YAAY,KAAZ,YAAY,QAqBvB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,uEAAuE;IACvE,kCAAqB,CAAA;IACrB,6DAA6D;IAC7D,0BAAa,CAAA;AACf,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB"}