@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.
- package/LICENSE +21 -0
- package/README.md +261 -0
- package/bin/commands/build.js +108 -0
- package/bin/commands/build.js.map +1 -0
- package/bin/commands/create.js +230 -0
- package/bin/commands/create.js.map +1 -0
- package/bin/commands/deploy.js +292 -0
- package/bin/commands/deploy.js.map +1 -0
- package/bin/commands/generate.js +301 -0
- package/bin/commands/generate.js.map +1 -0
- package/bin/commands/lint.js +69 -0
- package/bin/commands/lint.js.map +1 -0
- package/bin/commands/login.js +140 -0
- package/bin/commands/login.js.map +1 -0
- package/bin/commands/priority-create.js +102 -0
- package/bin/commands/priority-create.js.map +1 -0
- package/bin/commands/priority-list.js +47 -0
- package/bin/commands/priority-list.js.map +1 -0
- package/bin/commands/twist-logs.js +187 -0
- package/bin/commands/twist-logs.js.map +1 -0
- package/bin/index.js +129 -0
- package/bin/index.js.map +1 -0
- package/bin/package.json +3 -0
- package/bin/plot.cjs +3 -0
- package/bin/templates/AGENTS.template.md +403 -0
- package/bin/templates/CLAUDE.template.md +1 -0
- package/bin/templates/README.template.md +189 -0
- package/bin/utils/bundle.js +106 -0
- package/bin/utils/bundle.js.map +1 -0
- package/bin/utils/output.js +133 -0
- package/bin/utils/output.js.map +1 -0
- package/bin/utils/packageManager.js +65 -0
- package/bin/utils/packageManager.js.map +1 -0
- package/bin/utils/sse.js +100 -0
- package/bin/utils/sse.js.map +1 -0
- package/bin/utils/token.js +75 -0
- package/bin/utils/token.js.map +1 -0
- package/cli/templates/AGENTS.template.md +403 -0
- package/cli/templates/CLAUDE.template.md +1 -0
- package/cli/templates/README.template.md +189 -0
- package/dist/common/calendar.d.ts +144 -0
- package/dist/common/calendar.d.ts.map +1 -0
- package/dist/common/calendar.js +2 -0
- package/dist/common/calendar.js.map +1 -0
- package/dist/common/messaging.d.ts +84 -0
- package/dist/common/messaging.d.ts.map +1 -0
- package/dist/common/messaging.js +2 -0
- package/dist/common/messaging.js.map +1 -0
- package/dist/creator-docs.d.ts +11 -0
- package/dist/creator-docs.d.ts.map +1 -0
- package/dist/creator-docs.js +27 -0
- package/dist/creator-docs.js.map +1 -0
- package/dist/docs/.nojekyll +1 -0
- package/dist/docs/assets/favicon.svg +8 -0
- package/dist/docs/assets/hierarchy.js +1 -0
- package/dist/docs/assets/highlight.css +134 -0
- package/dist/docs/assets/icons.js +18 -0
- package/dist/docs/assets/icons.svg +1 -0
- package/dist/docs/assets/main.js +60 -0
- package/dist/docs/assets/navigation.js +1 -0
- package/dist/docs/assets/search.js +1 -0
- package/dist/docs/assets/style.css +1633 -0
- package/dist/docs/classes/tool.ITool.html +4 -0
- package/dist/docs/classes/tool.Tool.html +116 -0
- package/dist/docs/classes/tools_ai.AI.html +27 -0
- package/dist/docs/classes/tools_callbacks.Callbacks.html +45 -0
- package/dist/docs/classes/tools_integrations.Integrations.html +26 -0
- package/dist/docs/classes/tools_network.Network.html +68 -0
- package/dist/docs/classes/tools_plot.Plot.html +82 -0
- package/dist/docs/classes/tools_store.Store.html +53 -0
- package/dist/docs/classes/tools_tasks.Tasks.html +39 -0
- package/dist/docs/classes/tools_twists.Twists.html +59 -0
- package/dist/docs/classes/twist.Twist.html +96 -0
- package/dist/docs/documents/Advanced.html +91 -0
- package/dist/docs/documents/Building_Custom_Tools.html +200 -0
- package/dist/docs/documents/Built-in_Tools.html +170 -0
- package/dist/docs/documents/CLI_Reference.html +193 -0
- package/dist/docs/documents/Core_Concepts.html +163 -0
- package/dist/docs/documents/Getting_Started.html +94 -0
- package/dist/docs/documents/Runtime_Environment.html +128 -0
- package/dist/docs/enums/plot.ActivityLinkType.html +12 -0
- package/dist/docs/enums/plot.ActivityType.html +10 -0
- package/dist/docs/enums/plot.ActorType.html +10 -0
- package/dist/docs/enums/plot.ConferencingProvider.html +14 -0
- package/dist/docs/enums/tag.Tag.html +45 -0
- package/dist/docs/enums/tools_ai.AIModel.html +31 -0
- package/dist/docs/enums/tools_integrations.AuthLevel.html +7 -0
- package/dist/docs/enums/tools_integrations.AuthProvider.html +24 -0
- package/dist/docs/enums/tools_plot.ActivityAccess.html +8 -0
- package/dist/docs/enums/tools_plot.ContactAccess.html +5 -0
- package/dist/docs/enums/tools_plot.PriorityAccess.html +8 -0
- package/dist/docs/hierarchy.html +1 -0
- package/dist/docs/index.html +100 -0
- package/dist/docs/interfaces/common_calendar.Calendar.html +13 -0
- package/dist/docs/interfaces/common_calendar.CalendarTool.html +49 -0
- package/dist/docs/interfaces/common_calendar.SyncOptions.html +8 -0
- package/dist/docs/interfaces/tools_ai.AIRequest.html +46 -0
- package/dist/docs/interfaces/tools_ai.AIResponse.html +19 -0
- package/dist/docs/interfaces/tools_ai.FilePart.html +14 -0
- package/dist/docs/interfaces/tools_ai.ImagePart.html +11 -0
- package/dist/docs/interfaces/tools_ai.ReasoningPart.html +7 -0
- package/dist/docs/interfaces/tools_ai.RedactedReasoningPart.html +5 -0
- package/dist/docs/interfaces/tools_ai.TextPart.html +5 -0
- package/dist/docs/interfaces/tools_ai.ToolCallPart.html +9 -0
- package/dist/docs/interfaces/tools_ai.ToolExecutionOptions.html +9 -0
- package/dist/docs/interfaces/tools_ai.ToolResultPart.html +9 -0
- package/dist/docs/interfaces/tools_twists.TwistSource.html +13 -0
- package/dist/docs/interfaces/utils_types.ToolShed.html +11 -0
- package/dist/docs/modules/common_calendar.html +1 -0
- package/dist/docs/modules/index.html +1 -0
- package/dist/docs/modules/plot.html +1 -0
- package/dist/docs/modules/tag.html +1 -0
- package/dist/docs/modules/tool.html +1 -0
- package/dist/docs/modules/tools_ai.html +1 -0
- package/dist/docs/modules/tools_callbacks.html +1 -0
- package/dist/docs/modules/tools_integrations.html +1 -0
- package/dist/docs/modules/tools_network.html +1 -0
- package/dist/docs/modules/tools_plot.html +1 -0
- package/dist/docs/modules/tools_store.html +1 -0
- package/dist/docs/modules/tools_tasks.html +1 -0
- package/dist/docs/modules/tools_twists.html +1 -0
- package/dist/docs/modules/twist.html +1 -0
- package/dist/docs/modules/utils_types.html +1 -0
- package/dist/docs/modules.html +1 -0
- package/dist/docs/types/common_calendar.CalendarAuth.html +7 -0
- package/dist/docs/types/plot.Activity.html +64 -0
- package/dist/docs/types/plot.ActivityLink.html +22 -0
- package/dist/docs/types/plot.ActivityMeta.html +11 -0
- package/dist/docs/types/plot.ActivityUpdate.html +13 -0
- package/dist/docs/types/plot.Actor.html +15 -0
- package/dist/docs/types/plot.ActorId.html +4 -0
- package/dist/docs/types/plot.NewActivity.html +16 -0
- package/dist/docs/types/plot.NewContact.html +13 -0
- package/dist/docs/types/plot.NewPriority.html +5 -0
- package/dist/docs/types/plot.NoteType.html +1 -0
- package/dist/docs/types/plot.PickPriorityConfig.html +22 -0
- package/dist/docs/types/plot.Priority.html +8 -0
- package/dist/docs/types/tools_ai.AIAssistantMessage.html +4 -0
- package/dist/docs/types/tools_ai.AIMessage.html +3 -0
- package/dist/docs/types/tools_ai.AISource.html +11 -0
- package/dist/docs/types/tools_ai.AISystemMessage.html +7 -0
- package/dist/docs/types/tools_ai.AITool.html +19 -0
- package/dist/docs/types/tools_ai.AIToolMessage.html +4 -0
- package/dist/docs/types/tools_ai.AIToolSet.html +1 -0
- package/dist/docs/types/tools_ai.AIUsage.html +10 -0
- package/dist/docs/types/tools_ai.AIUserMessage.html +4 -0
- package/dist/docs/types/tools_ai.DataContent.html +2 -0
- package/dist/docs/types/tools_ai.ModelPreferences.html +24 -0
- package/dist/docs/types/tools_callbacks.Callback.html +8 -0
- package/dist/docs/types/tools_integrations.AuthToken.html +16 -0
- package/dist/docs/types/tools_integrations.Authorization.html +10 -0
- package/dist/docs/types/tools_network.WebhookRequest.html +15 -0
- package/dist/docs/types/tools_plot.ActivityIntentHandler.html +9 -0
- package/dist/docs/types/tools_twists.Log.html +6 -0
- package/dist/docs/types/tools_twists.TwistPermissions.html +12 -0
- package/dist/docs/types/utils_types.BuiltInTools.html +5 -0
- package/dist/docs/types/utils_types.CallbackMethods.html +3 -0
- package/dist/docs/types/utils_types.ExtractBuildReturn.html +2 -0
- package/dist/docs/types/utils_types.InferOptions.html +2 -0
- package/dist/docs/types/utils_types.InferTools.html +3 -0
- package/dist/docs/types/utils_types.NoFunctions.html +3 -0
- package/dist/docs/types/utils_types.NonFunction.html +2 -0
- package/dist/docs/types/utils_types.PromiseValues.html +3 -0
- package/dist/docs/types/utils_types.ToolBuilder.html +3 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/llm-docs/common/calendar.d.ts +9 -0
- package/dist/llm-docs/common/calendar.d.ts.map +1 -0
- package/dist/llm-docs/common/calendar.js +8 -0
- package/dist/llm-docs/common/calendar.js.map +1 -0
- package/dist/llm-docs/common/messaging.d.ts +9 -0
- package/dist/llm-docs/common/messaging.d.ts.map +1 -0
- package/dist/llm-docs/common/messaging.js +8 -0
- package/dist/llm-docs/common/messaging.js.map +1 -0
- package/dist/llm-docs/creator-docs.d.ts +9 -0
- package/dist/llm-docs/creator-docs.d.ts.map +1 -0
- package/dist/llm-docs/creator-docs.js +8 -0
- package/dist/llm-docs/creator-docs.js.map +1 -0
- package/dist/llm-docs/index.d.ts +11 -0
- package/dist/llm-docs/index.d.ts.map +1 -0
- package/dist/llm-docs/index.js +42 -0
- package/dist/llm-docs/index.js.map +1 -0
- package/dist/llm-docs/plot.d.ts +9 -0
- package/dist/llm-docs/plot.d.ts.map +1 -0
- package/dist/llm-docs/plot.js +8 -0
- package/dist/llm-docs/plot.js.map +1 -0
- package/dist/llm-docs/tag.d.ts +9 -0
- package/dist/llm-docs/tag.d.ts.map +1 -0
- package/dist/llm-docs/tag.js +8 -0
- package/dist/llm-docs/tag.js.map +1 -0
- package/dist/llm-docs/tool.d.ts +9 -0
- package/dist/llm-docs/tool.d.ts.map +1 -0
- package/dist/llm-docs/tool.js +8 -0
- package/dist/llm-docs/tool.js.map +1 -0
- package/dist/llm-docs/tools/ai.d.ts +9 -0
- package/dist/llm-docs/tools/ai.d.ts.map +1 -0
- package/dist/llm-docs/tools/ai.js +8 -0
- package/dist/llm-docs/tools/ai.js.map +1 -0
- package/dist/llm-docs/tools/callbacks.d.ts +9 -0
- package/dist/llm-docs/tools/callbacks.d.ts.map +1 -0
- package/dist/llm-docs/tools/callbacks.js +8 -0
- package/dist/llm-docs/tools/callbacks.js.map +1 -0
- package/dist/llm-docs/tools/integrations.d.ts +9 -0
- package/dist/llm-docs/tools/integrations.d.ts.map +1 -0
- package/dist/llm-docs/tools/integrations.js +8 -0
- package/dist/llm-docs/tools/integrations.js.map +1 -0
- package/dist/llm-docs/tools/network.d.ts +9 -0
- package/dist/llm-docs/tools/network.d.ts.map +1 -0
- package/dist/llm-docs/tools/network.js +8 -0
- package/dist/llm-docs/tools/network.js.map +1 -0
- package/dist/llm-docs/tools/plot.d.ts +9 -0
- package/dist/llm-docs/tools/plot.d.ts.map +1 -0
- package/dist/llm-docs/tools/plot.js +8 -0
- package/dist/llm-docs/tools/plot.js.map +1 -0
- package/dist/llm-docs/tools/store.d.ts +9 -0
- package/dist/llm-docs/tools/store.d.ts.map +1 -0
- package/dist/llm-docs/tools/store.js +8 -0
- package/dist/llm-docs/tools/store.js.map +1 -0
- package/dist/llm-docs/tools/tasks.d.ts +9 -0
- package/dist/llm-docs/tools/tasks.d.ts.map +1 -0
- package/dist/llm-docs/tools/tasks.js +8 -0
- package/dist/llm-docs/tools/tasks.js.map +1 -0
- package/dist/llm-docs/tools/twists.d.ts +9 -0
- package/dist/llm-docs/tools/twists.d.ts.map +1 -0
- package/dist/llm-docs/tools/twists.js +8 -0
- package/dist/llm-docs/tools/twists.js.map +1 -0
- package/dist/llm-docs/twist-guide-template.d.ts +9 -0
- package/dist/llm-docs/twist-guide-template.d.ts.map +1 -0
- package/dist/llm-docs/twist-guide-template.js +8 -0
- package/dist/llm-docs/twist-guide-template.js.map +1 -0
- package/dist/llm-docs/twist.d.ts +9 -0
- package/dist/llm-docs/twist.d.ts.map +1 -0
- package/dist/llm-docs/twist.js +8 -0
- package/dist/llm-docs/twist.js.map +1 -0
- package/dist/plot.d.ts +463 -0
- package/dist/plot.d.ts.map +1 -0
- package/dist/plot.js +68 -0
- package/dist/plot.js.map +1 -0
- package/dist/tag.d.ts +47 -0
- package/dist/tag.d.ts.map +1 -0
- package/dist/tag.js +51 -0
- package/dist/tag.js.map +1 -0
- package/dist/tool.d.ts +242 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +283 -0
- package/dist/tool.js.map +1 -0
- package/dist/tools/ai.d.ts +697 -0
- package/dist/tools/ai.d.ts.map +1 -0
- package/dist/tools/ai.js +104 -0
- package/dist/tools/ai.js.map +1 -0
- package/dist/tools/callbacks.d.ts +96 -0
- package/dist/tools/callbacks.d.ts.map +1 -0
- package/dist/tools/callbacks.js +40 -0
- package/dist/tools/callbacks.js.map +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +9 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/integrations.d.ts +142 -0
- package/dist/tools/integrations.d.ts.map +1 -0
- package/dist/tools/integrations.js +79 -0
- package/dist/tools/integrations.js.map +1 -0
- package/dist/tools/network.d.ts +188 -0
- package/dist/tools/network.d.ts.map +1 -0
- package/dist/tools/network.js +87 -0
- package/dist/tools/network.js.map +1 -0
- package/dist/tools/plot.d.ts +252 -0
- package/dist/tools/plot.d.ts.map +1 -0
- package/dist/tools/plot.js +72 -0
- package/dist/tools/plot.js.map +1 -0
- package/dist/tools/store.d.ts +90 -0
- package/dist/tools/store.d.ts.map +1 -0
- package/dist/tools/store.js +48 -0
- package/dist/tools/store.js.map +1 -0
- package/dist/tools/tasks.d.ts +93 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +58 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/twists.d.ts +213 -0
- package/dist/tools/twists.d.ts.map +1 -0
- package/dist/tools/twists.js +26 -0
- package/dist/tools/twists.js.map +1 -0
- package/dist/twist-guide.d.ts +2 -0
- package/dist/twist-guide.d.ts.map +1 -0
- package/dist/twist-guide.js +9 -0
- package/dist/twist-guide.js.map +1 -0
- package/dist/twist.d.ts +204 -0
- package/dist/twist.d.ts.map +1 -0
- package/dist/twist.js +216 -0
- package/dist/twist.js.map +1 -0
- package/dist/utils/types.d.ts +91 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +2 -0
- package/dist/utils/types.js.map +1 -0
- package/package.json +206 -0
- package/tsconfig.base.json +28 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { ITool } from "..";
|
|
2
|
+
import { type AuthProvider, type Authorization } from "./integrations";
|
|
3
|
+
/**
|
|
4
|
+
* Represents an incoming webhook request.
|
|
5
|
+
*
|
|
6
|
+
* This object is passed to webhook callback functions and contains all
|
|
7
|
+
* the information about the HTTP request that triggered the webhook.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* async onWebhookReceived(request: WebhookRequest, context: any) {
|
|
12
|
+
* console.log(`${request.method} request received`);
|
|
13
|
+
* console.log("Headers:", request.headers);
|
|
14
|
+
* console.log("Query params:", request.params);
|
|
15
|
+
* console.log("Body:", request.body);
|
|
16
|
+
* console.log("Context:", context);
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export type WebhookRequest = {
|
|
21
|
+
/** HTTP method of the request (GET, POST, etc.) */
|
|
22
|
+
method: string;
|
|
23
|
+
/** HTTP headers from the request */
|
|
24
|
+
headers: Record<string, string>;
|
|
25
|
+
/** Query string parameters from the request URL */
|
|
26
|
+
params: Record<string, string>;
|
|
27
|
+
/** Request body (parsed as JSON if applicable) */
|
|
28
|
+
body: any;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Built-in tool for requesting HTTP access permissions and managing webhooks.
|
|
32
|
+
*
|
|
33
|
+
* The Network tool serves two purposes:
|
|
34
|
+
* 1. Declares which URLs a twist or tool is allowed to access via HTTP/HTTPS
|
|
35
|
+
* 2. Provides webhook creation and management for receiving HTTP callbacks
|
|
36
|
+
*
|
|
37
|
+
* **IMPORTANT**: Must be requested in the Twist or Tool Init method to declare
|
|
38
|
+
* HTTP access permissions. Without requesting this tool with the appropriate URLs,
|
|
39
|
+
* all outbound HTTP requests (fetch, etc.) will be blocked.
|
|
40
|
+
*
|
|
41
|
+
* **Permission Patterns:**
|
|
42
|
+
* - `*` - Allow access to all URLs
|
|
43
|
+
* - `https://*.example.com` - Allow access to all subdomains
|
|
44
|
+
* - `https://api.example.com/*` - Allow access to all paths on the domain
|
|
45
|
+
* - `https://api.example.com/v1/*` - Allow access to specific path prefix
|
|
46
|
+
*
|
|
47
|
+
* **Webhook Characteristics:**
|
|
48
|
+
* - Persistent across worker restarts
|
|
49
|
+
* - Automatic callback routing to parent tool/twist
|
|
50
|
+
* - Support for all HTTP methods
|
|
51
|
+
* - Context preservation for callback execution
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* class MyTwist extends Twist<MyTwist> {
|
|
56
|
+
* build(build: ToolBuilder) {
|
|
57
|
+
* return {
|
|
58
|
+
* // Request HTTP access to specific APIs
|
|
59
|
+
* network: build(Network, {
|
|
60
|
+
* urls: [
|
|
61
|
+
* 'https://api.github.com/*',
|
|
62
|
+
* 'https://api.openai.com/*'
|
|
63
|
+
* ]
|
|
64
|
+
* })
|
|
65
|
+
* };
|
|
66
|
+
* }
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* class CalendarTool extends Tool<CalendarTool> {
|
|
73
|
+
* build(build: ToolBuilder) {
|
|
74
|
+
* return {
|
|
75
|
+
* network: build(Network, {
|
|
76
|
+
* urls: ['https://www.googleapis.com/calendar/*']
|
|
77
|
+
* })
|
|
78
|
+
* };
|
|
79
|
+
* }
|
|
80
|
+
*
|
|
81
|
+
* async setupCalendarWebhook(calendarId: string) {
|
|
82
|
+
* // Create webhook URL that will call onCalendarEvent
|
|
83
|
+
* const webhookUrl = await this.tools.network.createWebhook({
|
|
84
|
+
* callback: this.onCalendarEvent,
|
|
85
|
+
* extraArgs: [calendarId, "google"]
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* // Register webhook with Google Calendar API
|
|
89
|
+
* await this.registerWithGoogleCalendar(calendarId, webhookUrl);
|
|
90
|
+
*
|
|
91
|
+
* return webhookUrl;
|
|
92
|
+
* }
|
|
93
|
+
*
|
|
94
|
+
* async onCalendarEvent(request: WebhookRequest, calendarId: string, provider: string) {
|
|
95
|
+
* console.log("Calendar event received:", {
|
|
96
|
+
* method: request.method,
|
|
97
|
+
* calendarId,
|
|
98
|
+
* provider,
|
|
99
|
+
* body: request.body
|
|
100
|
+
* });
|
|
101
|
+
*
|
|
102
|
+
* // Process the calendar event change
|
|
103
|
+
* await this.processCalendarChange(request.body);
|
|
104
|
+
* }
|
|
105
|
+
*
|
|
106
|
+
* async cleanup(webhookUrl: string) {
|
|
107
|
+
* await this.tools.network.deleteWebhook(webhookUrl);
|
|
108
|
+
* }
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export declare abstract class Network extends ITool {
|
|
113
|
+
static readonly Options: {
|
|
114
|
+
/**
|
|
115
|
+
* All network access is blocked except the specified URLs.
|
|
116
|
+
* Wildcards (*) are supported for domains and paths.
|
|
117
|
+
*/
|
|
118
|
+
urls: string[];
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Creates a new webhook endpoint.
|
|
122
|
+
*
|
|
123
|
+
* Generates a unique HTTP endpoint that will invoke the callback function
|
|
124
|
+
* when requests are received. The callback receives the WebhookRequest plus any extraArgs.
|
|
125
|
+
*
|
|
126
|
+
* **Provider-Specific Behavior:**
|
|
127
|
+
* - **Slack**: Uses provider-specific routing via team_id. Requires `authorization` parameter.
|
|
128
|
+
* - **Gmail** (Google with Gmail scopes): Returns a Google Pub/Sub topic name instead of a webhook URL.
|
|
129
|
+
* The topic name (e.g., "projects/plot-prod/topics/gmail-webhook-abc123") should be passed
|
|
130
|
+
* to the Gmail API's `users.watch` endpoint. Requires `authorization` parameter with Gmail scopes.
|
|
131
|
+
* - **Default**: Returns a standard webhook URL for all other cases.
|
|
132
|
+
*
|
|
133
|
+
* @param options - Webhook creation options
|
|
134
|
+
* @param options.callback - Function receiving (request, ...extraArgs)
|
|
135
|
+
* @param options.extraArgs - Additional arguments to pass to the callback (type-checked)
|
|
136
|
+
* @param options.provider - Optional provider for provider-specific webhook routing
|
|
137
|
+
* @param options.authorization - Optional authorization for provider-specific webhooks (required for Slack and Gmail)
|
|
138
|
+
* @returns Promise resolving to the webhook URL, or for Gmail, a Pub/Sub topic name
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* // Gmail webhook - returns Pub/Sub topic name
|
|
143
|
+
* const topicName = await this.tools.network.createWebhook({
|
|
144
|
+
* callback: this.onGmailNotification,
|
|
145
|
+
* provider: AuthProvider.Google,
|
|
146
|
+
* authorization: gmailAuth,
|
|
147
|
+
* extraArgs: ["inbox"]
|
|
148
|
+
* });
|
|
149
|
+
* // topicName: "projects/plot-prod/topics/gmail-webhook-abc123"
|
|
150
|
+
*
|
|
151
|
+
* // Pass topic name to Gmail API
|
|
152
|
+
* await gmailApi.users.watch({
|
|
153
|
+
* userId: 'me',
|
|
154
|
+
* requestBody: {
|
|
155
|
+
* topicName: topicName, // Use the returned topic name
|
|
156
|
+
* labelIds: ['INBOX']
|
|
157
|
+
* }
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
abstract createWebhook<TCallback extends (request: WebhookRequest, ...args: any[]) => any>(options: {
|
|
162
|
+
callback: TCallback;
|
|
163
|
+
extraArgs?: TCallback extends (req: any, ...rest: infer R) => any ? R : [];
|
|
164
|
+
provider?: AuthProvider;
|
|
165
|
+
authorization?: Authorization;
|
|
166
|
+
}): Promise<string>;
|
|
167
|
+
/**
|
|
168
|
+
* Deletes an existing webhook endpoint.
|
|
169
|
+
*
|
|
170
|
+
* Removes the webhook endpoint and stops processing requests.
|
|
171
|
+
* Works with all webhook types (standard, Slack, and Gmail).
|
|
172
|
+
*
|
|
173
|
+
* **For Gmail webhooks:** Also deletes the associated Google Pub/Sub topic and subscription.
|
|
174
|
+
*
|
|
175
|
+
* **For Slack webhooks:** Removes the callback registration for the specific team.
|
|
176
|
+
*
|
|
177
|
+
* **For standard webhooks:** Removes the webhook endpoint. Any subsequent requests
|
|
178
|
+
* to the deleted webhook will return 404.
|
|
179
|
+
*
|
|
180
|
+
* @param url - The webhook identifier returned from `createWebhook()`.
|
|
181
|
+
* This can be a URL (standard webhooks), a Pub/Sub topic name (Gmail),
|
|
182
|
+
* or an opaque identifier (Slack). Always pass the exact value returned
|
|
183
|
+
* from `createWebhook()`.
|
|
184
|
+
* @returns Promise that resolves when the webhook is deleted
|
|
185
|
+
*/
|
|
186
|
+
abstract deleteWebhook(url: string): Promise<void>;
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/tools/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEvE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,kDAAkD;IAClD,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH,8BAAsB,OAAQ,SAAQ,KAAK;IACzC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;QACvB;;;WAGG;QACH,IAAI,EAAE,MAAM,EAAE,CAAC;KAChB,CAAC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,QAAQ,CAAC,aAAa,CACpB,SAAS,SAAS,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAClE,OAAO,EAAE;QACT,QAAQ,EAAE,SAAS,CAAC;QACpB,SAAS,CAAC,EAAE,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;QAC3E,QAAQ,CAAC,EAAE,YAAY,CAAC;QACxB,aAAa,CAAC,EAAE,aAAa,CAAC;KAC/B,GAAG,OAAO,CAAC,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CACnD"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ITool } from "..";
|
|
2
|
+
/**
|
|
3
|
+
* Built-in tool for requesting HTTP access permissions and managing webhooks.
|
|
4
|
+
*
|
|
5
|
+
* The Network tool serves two purposes:
|
|
6
|
+
* 1. Declares which URLs a twist or tool is allowed to access via HTTP/HTTPS
|
|
7
|
+
* 2. Provides webhook creation and management for receiving HTTP callbacks
|
|
8
|
+
*
|
|
9
|
+
* **IMPORTANT**: Must be requested in the Twist or Tool Init method to declare
|
|
10
|
+
* HTTP access permissions. Without requesting this tool with the appropriate URLs,
|
|
11
|
+
* all outbound HTTP requests (fetch, etc.) will be blocked.
|
|
12
|
+
*
|
|
13
|
+
* **Permission Patterns:**
|
|
14
|
+
* - `*` - Allow access to all URLs
|
|
15
|
+
* - `https://*.example.com` - Allow access to all subdomains
|
|
16
|
+
* - `https://api.example.com/*` - Allow access to all paths on the domain
|
|
17
|
+
* - `https://api.example.com/v1/*` - Allow access to specific path prefix
|
|
18
|
+
*
|
|
19
|
+
* **Webhook Characteristics:**
|
|
20
|
+
* - Persistent across worker restarts
|
|
21
|
+
* - Automatic callback routing to parent tool/twist
|
|
22
|
+
* - Support for all HTTP methods
|
|
23
|
+
* - Context preservation for callback execution
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* class MyTwist extends Twist<MyTwist> {
|
|
28
|
+
* build(build: ToolBuilder) {
|
|
29
|
+
* return {
|
|
30
|
+
* // Request HTTP access to specific APIs
|
|
31
|
+
* network: build(Network, {
|
|
32
|
+
* urls: [
|
|
33
|
+
* 'https://api.github.com/*',
|
|
34
|
+
* 'https://api.openai.com/*'
|
|
35
|
+
* ]
|
|
36
|
+
* })
|
|
37
|
+
* };
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* class CalendarTool extends Tool<CalendarTool> {
|
|
45
|
+
* build(build: ToolBuilder) {
|
|
46
|
+
* return {
|
|
47
|
+
* network: build(Network, {
|
|
48
|
+
* urls: ['https://www.googleapis.com/calendar/*']
|
|
49
|
+
* })
|
|
50
|
+
* };
|
|
51
|
+
* }
|
|
52
|
+
*
|
|
53
|
+
* async setupCalendarWebhook(calendarId: string) {
|
|
54
|
+
* // Create webhook URL that will call onCalendarEvent
|
|
55
|
+
* const webhookUrl = await this.tools.network.createWebhook({
|
|
56
|
+
* callback: this.onCalendarEvent,
|
|
57
|
+
* extraArgs: [calendarId, "google"]
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* // Register webhook with Google Calendar API
|
|
61
|
+
* await this.registerWithGoogleCalendar(calendarId, webhookUrl);
|
|
62
|
+
*
|
|
63
|
+
* return webhookUrl;
|
|
64
|
+
* }
|
|
65
|
+
*
|
|
66
|
+
* async onCalendarEvent(request: WebhookRequest, calendarId: string, provider: string) {
|
|
67
|
+
* console.log("Calendar event received:", {
|
|
68
|
+
* method: request.method,
|
|
69
|
+
* calendarId,
|
|
70
|
+
* provider,
|
|
71
|
+
* body: request.body
|
|
72
|
+
* });
|
|
73
|
+
*
|
|
74
|
+
* // Process the calendar event change
|
|
75
|
+
* await this.processCalendarChange(request.body);
|
|
76
|
+
* }
|
|
77
|
+
*
|
|
78
|
+
* async cleanup(webhookUrl: string) {
|
|
79
|
+
* await this.tools.network.deleteWebhook(webhookUrl);
|
|
80
|
+
* }
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export class Network extends ITool {
|
|
85
|
+
static Options;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/tools/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AA+B3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH,MAAM,OAAgB,OAAQ,SAAQ,KAAK;IACzC,MAAM,CAAU,OAAO,CAMrB;CAwEH"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { type Activity, type ActivityMeta, type ActivityUpdate, type Actor, type ActorId, ITool, type NewActivity, type NewContact, type NewPriority, type Priority, type Tag } from "..";
|
|
2
|
+
export declare enum ActivityAccess {
|
|
3
|
+
/**
|
|
4
|
+
* Create new Activity on a thread where the twist was mentioned.
|
|
5
|
+
* Add/remove tags on Activity where the twist was mentioned.
|
|
6
|
+
*/
|
|
7
|
+
Respond = 0,
|
|
8
|
+
/**
|
|
9
|
+
* Create new, top-level Activity.
|
|
10
|
+
* Create new Activity in a thread the twist created.
|
|
11
|
+
* All Respond permissions.
|
|
12
|
+
*/
|
|
13
|
+
Create = 1
|
|
14
|
+
}
|
|
15
|
+
export declare enum PriorityAccess {
|
|
16
|
+
/**
|
|
17
|
+
* Create a new Priority within the twist's Priority.
|
|
18
|
+
* Update Priority created by the twist.
|
|
19
|
+
*/
|
|
20
|
+
Create = 0,
|
|
21
|
+
/**
|
|
22
|
+
* Read all Priority within the twist's Priority.
|
|
23
|
+
* Create a new Priority within the twist's Priority.
|
|
24
|
+
* Update and archive any Priority within the twist's Priority.
|
|
25
|
+
*/
|
|
26
|
+
Full = 1
|
|
27
|
+
}
|
|
28
|
+
export declare enum ContactAccess {
|
|
29
|
+
/** Read existing contacts. */
|
|
30
|
+
Read = 0,
|
|
31
|
+
/** Create and update contacts. */
|
|
32
|
+
Write = 1
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Intent handler for activity mentions.
|
|
36
|
+
* Defines how the twist should respond when mentioned in an activity.
|
|
37
|
+
*/
|
|
38
|
+
export type ActivityIntentHandler = {
|
|
39
|
+
/** Human-readable description of what this intent handles */
|
|
40
|
+
description: string;
|
|
41
|
+
/** Example phrases or activity content that would match this intent */
|
|
42
|
+
examples: string[];
|
|
43
|
+
/** The function to call when this intent is matched */
|
|
44
|
+
handler: (activity: Activity) => Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Built-in tool for interacting with the core Plot data layer.
|
|
48
|
+
*
|
|
49
|
+
* The Plot tool provides twists with the ability to create and manage activities,
|
|
50
|
+
* priorities, and contacts within the Plot system. This is the primary interface
|
|
51
|
+
* for twists to persist data and interact with the Plot database.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* class MyTwist extends Twist {
|
|
56
|
+
* private plot: Plot;
|
|
57
|
+
*
|
|
58
|
+
* constructor(id: string, tools: ToolBuilder) {
|
|
59
|
+
* super();
|
|
60
|
+
* this.plot = tools.get(Plot);
|
|
61
|
+
* }
|
|
62
|
+
*
|
|
63
|
+
* async activate(priority) {
|
|
64
|
+
* // Create a welcome activity
|
|
65
|
+
* await this.plot.createActivity({
|
|
66
|
+
* type: ActivityType.Note,
|
|
67
|
+
* title: "Welcome to Plot!",
|
|
68
|
+
* links: [{
|
|
69
|
+
* title: "Get Started",
|
|
70
|
+
* type: ActivityLinkType.external,
|
|
71
|
+
* url: "https://plot.day/docs"
|
|
72
|
+
* }]
|
|
73
|
+
* });
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare abstract class Plot extends ITool {
|
|
79
|
+
static readonly Options: {
|
|
80
|
+
/**
|
|
81
|
+
* Activity event callbacks.
|
|
82
|
+
*/
|
|
83
|
+
activity?: {
|
|
84
|
+
access?: ActivityAccess;
|
|
85
|
+
/**
|
|
86
|
+
* Called when an activity is updated.
|
|
87
|
+
*
|
|
88
|
+
* @param activity - The updated activity
|
|
89
|
+
* @param changes - Optional changes object containing the previous version and tag modifications
|
|
90
|
+
*/
|
|
91
|
+
updated?: (activity: Activity, changes?: {
|
|
92
|
+
previous: Activity;
|
|
93
|
+
tagsAdded: Record<Tag, ActorId[]>;
|
|
94
|
+
tagsRemoved: Record<Tag, ActorId[]>;
|
|
95
|
+
}) => Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Intent handlers for activity mentions.
|
|
98
|
+
* When an activity mentions this twist, the system will match the activity
|
|
99
|
+
* content against these intent descriptions and call the matching handler.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* intents: [{
|
|
104
|
+
* description: "Schedule or reschedule calendar events",
|
|
105
|
+
* examples: ["Schedule a meeting tomorrow at 2pm", "Move my 3pm meeting to 4pm"],
|
|
106
|
+
* handler: this.onSchedulingRequest
|
|
107
|
+
* }, {
|
|
108
|
+
* description: "Find available meeting times",
|
|
109
|
+
* examples: ["When am I free this week?", "Find time for a 1 hour meeting"],
|
|
110
|
+
* handler: this.onAvailabilityRequest
|
|
111
|
+
* }]
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
intents?: ActivityIntentHandler[];
|
|
115
|
+
};
|
|
116
|
+
priority?: {
|
|
117
|
+
access?: PriorityAccess;
|
|
118
|
+
};
|
|
119
|
+
contact?: {
|
|
120
|
+
access?: ContactAccess;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Creates a new activity in the Plot system.
|
|
125
|
+
*
|
|
126
|
+
* The activity will be automatically assigned an ID and author information
|
|
127
|
+
* based on the current execution context. All other fields from NewActivity
|
|
128
|
+
* will be preserved in the created activity.
|
|
129
|
+
*
|
|
130
|
+
* @param activity - The activity data to create
|
|
131
|
+
* @returns Promise resolving to the complete created activity
|
|
132
|
+
*/
|
|
133
|
+
abstract createActivity(activity: NewActivity): Promise<Activity>;
|
|
134
|
+
/**
|
|
135
|
+
* Creates multiple activities in a single batch operation.
|
|
136
|
+
*
|
|
137
|
+
* This method efficiently creates multiple activities at once, which is
|
|
138
|
+
* more performant than calling createActivity() multiple times individually.
|
|
139
|
+
* All activities are created with the same author and access control rules.
|
|
140
|
+
*
|
|
141
|
+
* @param activities - Array of activity data to create
|
|
142
|
+
* @returns Promise resolving to array of created activities
|
|
143
|
+
*/
|
|
144
|
+
abstract createActivities(activities: NewActivity[]): Promise<Activity[]>;
|
|
145
|
+
/**
|
|
146
|
+
* Updates an existing activity in the Plot system.
|
|
147
|
+
*
|
|
148
|
+
* Only the fields provided in the update object will be modified - all other fields
|
|
149
|
+
* remain unchanged. This enables partial updates without needing to fetch and resend
|
|
150
|
+
* the entire activity object.
|
|
151
|
+
*
|
|
152
|
+
* For tags, provide a Record<number, boolean> where true adds a tag and false removes it.
|
|
153
|
+
* Tags not included in the update remain unchanged.
|
|
154
|
+
*
|
|
155
|
+
* When updating the parent, the activity's path will be automatically recalculated to
|
|
156
|
+
* maintain the correct hierarchical structure.
|
|
157
|
+
*
|
|
158
|
+
* When updating scheduling fields (start, end, recurrence*), the database will
|
|
159
|
+
* automatically recalculate duration and range values to maintain consistency.
|
|
160
|
+
*
|
|
161
|
+
* @param activity - The activity update containing the ID and fields to change
|
|
162
|
+
* @returns Promise that resolves when the update is complete
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* // Mark a task as complete
|
|
167
|
+
* await this.plot.updateActivity({
|
|
168
|
+
* id: "task-123",
|
|
169
|
+
* doneAt: new Date()
|
|
170
|
+
* });
|
|
171
|
+
*
|
|
172
|
+
* // Reschedule an event
|
|
173
|
+
* await this.plot.updateActivity({
|
|
174
|
+
* id: "event-456",
|
|
175
|
+
* start: new Date("2024-03-15T10:00:00Z"),
|
|
176
|
+
* end: new Date("2024-03-15T11:00:00Z")
|
|
177
|
+
* });
|
|
178
|
+
*
|
|
179
|
+
* // Add and remove tags
|
|
180
|
+
* await this.plot.updateActivity({
|
|
181
|
+
* id: "activity-789",
|
|
182
|
+
* tags: {
|
|
183
|
+
* 1: true, // Add tag with ID 1
|
|
184
|
+
* 2: false // Remove tag with ID 2
|
|
185
|
+
* }
|
|
186
|
+
* });
|
|
187
|
+
*
|
|
188
|
+
* // Update a recurring event exception
|
|
189
|
+
* await this.plot.updateActivity({
|
|
190
|
+
* id: "exception-123",
|
|
191
|
+
* occurrence: new Date("2024-03-20T09:00:00Z"),
|
|
192
|
+
* title: "Rescheduled meeting"
|
|
193
|
+
* });
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
abstract updateActivity(activity: ActivityUpdate): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Retrieves all activities in the same thread as the specified activity.
|
|
199
|
+
*
|
|
200
|
+
* A thread consists of related activities linked through parent-child
|
|
201
|
+
* relationships or other associative connections. This is useful for
|
|
202
|
+
* finding conversation histories or related task sequences.
|
|
203
|
+
*
|
|
204
|
+
* @param activity - The activity whose thread to retrieve
|
|
205
|
+
* @returns Promise resolving to array of activities in the thread
|
|
206
|
+
*/
|
|
207
|
+
abstract getThread(activity: Activity): Promise<Activity[]>;
|
|
208
|
+
/**
|
|
209
|
+
* Finds an activity by its metadata.
|
|
210
|
+
*
|
|
211
|
+
* This method enables lookup of activities that were created from external
|
|
212
|
+
* systems, using the metadata to locate the corresponding Plot activity.
|
|
213
|
+
* Useful for preventing duplicate imports and maintaining sync state.
|
|
214
|
+
*
|
|
215
|
+
* @param meta - The activity metadata to search for
|
|
216
|
+
* @returns Promise resolving to the matching activity or null if not found
|
|
217
|
+
*/
|
|
218
|
+
abstract getActivityByMeta(meta: ActivityMeta): Promise<Activity | null>;
|
|
219
|
+
/**
|
|
220
|
+
* Creates a new priority in the Plot system.
|
|
221
|
+
*
|
|
222
|
+
* Priorities serve as organizational containers for activities and twists.
|
|
223
|
+
* The created priority will be automatically assigned a unique ID.
|
|
224
|
+
*
|
|
225
|
+
* @param priority - The priority data to create
|
|
226
|
+
* @returns Promise resolving to the complete created priority
|
|
227
|
+
*/
|
|
228
|
+
abstract createPriority(priority: NewPriority): Promise<Priority>;
|
|
229
|
+
/**
|
|
230
|
+
* Adds contacts to the Plot system.
|
|
231
|
+
*
|
|
232
|
+
* Contacts are used for associating people with activities, such as
|
|
233
|
+
* event attendees or task assignees. Duplicate contacts (by email)
|
|
234
|
+
* will be merged or updated as appropriate.
|
|
235
|
+
* This method requires ContactAccess.Write permission.
|
|
236
|
+
*
|
|
237
|
+
* @param contacts - Array of contact information to add
|
|
238
|
+
* @returns Promise resolving to array of created/updated actors
|
|
239
|
+
*/
|
|
240
|
+
abstract addContacts(contacts: Array<NewContact>): Promise<Actor[]>;
|
|
241
|
+
/**
|
|
242
|
+
* Retrieves actors by their IDs.
|
|
243
|
+
*
|
|
244
|
+
* Actors represent users, contacts, or twists in the Plot system.
|
|
245
|
+
* This method requires ContactAccess.Read permission.
|
|
246
|
+
*
|
|
247
|
+
* @param ids - Array of actor IDs to retrieve
|
|
248
|
+
* @returns Promise resolving to array of actors
|
|
249
|
+
*/
|
|
250
|
+
abstract getActors(ids: ActorId[]): Promise<Actor[]>;
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=plot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,EACL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,GAAG,EACT,MAAM,IAAI,CAAC;AAEZ,oBAAY,cAAc;IACxB;;;OAGG;IACH,OAAO,IAAA;IACP;;;;OAIG;IACH,MAAM,IAAA;CACP;AAED,oBAAY,cAAc;IACxB;;;OAGG;IACH,MAAM,IAAA;IACN;;;;OAIG;IACH,IAAI,IAAA;CACL;AAED,oBAAY,aAAa;IACvB,8BAA8B;IAC9B,IAAI,IAAA;IACJ,kCAAkC;IAClC,KAAK,IAAA;CACN;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uDAAuD;IACvD,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,8BAAsB,IAAK,SAAQ,KAAK;IACtC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;QACvB;;WAEG;QACH,QAAQ,CAAC,EAAE;YACT,MAAM,CAAC,EAAE,cAAc,CAAC;YAExB;;;;;eAKG;YACH,OAAO,CAAC,EAAE,CACR,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE;gBACR,QAAQ,EAAE,QAAQ,CAAC;gBACnB,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;gBAClC,WAAW,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;aACrC,KACE,OAAO,CAAC,IAAI,CAAC,CAAC;YAEnB;;;;;;;;;;;;;;;;;eAiBG;YACH,OAAO,CAAC,EAAE,qBAAqB,EAAE,CAAC;SACnC,CAAC;QACF,QAAQ,CAAC,EAAE;YACT,MAAM,CAAC,EAAE,cAAc,CAAC;SACzB,CAAC;QACF,OAAO,CAAC,EAAE;YACR,MAAM,CAAC,EAAE,aAAa,CAAC;SACxB,CAAC;KACH,CAAC;IAEF;;;;;;;;;OASG;IAEH,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAEjE;;;;;;;;;OASG;IAEH,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkDG;IAEH,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAEhE;;;;;;;;;OASG;IAEH,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAE3D;;;;;;;;;OASG;IAEH,QAAQ,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAExE;;;;;;;;OAQG;IAEH,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAEjE;;;;;;;;;;OAUG;IAEH,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAEnE;;;;;;;;OAQG;IAEH,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;CACrD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ITool, } from "..";
|
|
2
|
+
export var ActivityAccess;
|
|
3
|
+
(function (ActivityAccess) {
|
|
4
|
+
/**
|
|
5
|
+
* Create new Activity on a thread where the twist was mentioned.
|
|
6
|
+
* Add/remove tags on Activity where the twist was mentioned.
|
|
7
|
+
*/
|
|
8
|
+
ActivityAccess[ActivityAccess["Respond"] = 0] = "Respond";
|
|
9
|
+
/**
|
|
10
|
+
* Create new, top-level Activity.
|
|
11
|
+
* Create new Activity in a thread the twist created.
|
|
12
|
+
* All Respond permissions.
|
|
13
|
+
*/
|
|
14
|
+
ActivityAccess[ActivityAccess["Create"] = 1] = "Create";
|
|
15
|
+
})(ActivityAccess || (ActivityAccess = {}));
|
|
16
|
+
export var PriorityAccess;
|
|
17
|
+
(function (PriorityAccess) {
|
|
18
|
+
/**
|
|
19
|
+
* Create a new Priority within the twist's Priority.
|
|
20
|
+
* Update Priority created by the twist.
|
|
21
|
+
*/
|
|
22
|
+
PriorityAccess[PriorityAccess["Create"] = 0] = "Create";
|
|
23
|
+
/**
|
|
24
|
+
* Read all Priority within the twist's Priority.
|
|
25
|
+
* Create a new Priority within the twist's Priority.
|
|
26
|
+
* Update and archive any Priority within the twist's Priority.
|
|
27
|
+
*/
|
|
28
|
+
PriorityAccess[PriorityAccess["Full"] = 1] = "Full";
|
|
29
|
+
})(PriorityAccess || (PriorityAccess = {}));
|
|
30
|
+
export var ContactAccess;
|
|
31
|
+
(function (ContactAccess) {
|
|
32
|
+
/** Read existing contacts. */
|
|
33
|
+
ContactAccess[ContactAccess["Read"] = 0] = "Read";
|
|
34
|
+
/** Create and update contacts. */
|
|
35
|
+
ContactAccess[ContactAccess["Write"] = 1] = "Write";
|
|
36
|
+
})(ContactAccess || (ContactAccess = {}));
|
|
37
|
+
/**
|
|
38
|
+
* Built-in tool for interacting with the core Plot data layer.
|
|
39
|
+
*
|
|
40
|
+
* The Plot tool provides twists with the ability to create and manage activities,
|
|
41
|
+
* priorities, and contacts within the Plot system. This is the primary interface
|
|
42
|
+
* for twists to persist data and interact with the Plot database.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* class MyTwist extends Twist {
|
|
47
|
+
* private plot: Plot;
|
|
48
|
+
*
|
|
49
|
+
* constructor(id: string, tools: ToolBuilder) {
|
|
50
|
+
* super();
|
|
51
|
+
* this.plot = tools.get(Plot);
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* async activate(priority) {
|
|
55
|
+
* // Create a welcome activity
|
|
56
|
+
* await this.plot.createActivity({
|
|
57
|
+
* type: ActivityType.Note,
|
|
58
|
+
* title: "Welcome to Plot!",
|
|
59
|
+
* links: [{
|
|
60
|
+
* title: "Get Started",
|
|
61
|
+
* type: ActivityLinkType.external,
|
|
62
|
+
* url: "https://plot.day/docs"
|
|
63
|
+
* }]
|
|
64
|
+
* });
|
|
65
|
+
* }
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export class Plot extends ITool {
|
|
70
|
+
static Options;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=plot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,GAMN,MAAM,IAAI,CAAC;AAEZ,MAAM,CAAN,IAAY,cAYX;AAZD,WAAY,cAAc;IACxB;;;OAGG;IACH,yDAAO,CAAA;IACP;;;;OAIG;IACH,uDAAM,CAAA;AACR,CAAC,EAZW,cAAc,KAAd,cAAc,QAYzB;AAED,MAAM,CAAN,IAAY,cAYX;AAZD,WAAY,cAAc;IACxB;;;OAGG;IACH,uDAAM,CAAA;IACN;;;;OAIG;IACH,mDAAI,CAAA;AACN,CAAC,EAZW,cAAc,KAAd,cAAc,QAYzB;AAED,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,8BAA8B;IAC9B,iDAAI,CAAA;IACJ,kCAAkC;IAClC,mDAAK,CAAA;AACP,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,OAAgB,IAAK,SAAQ,KAAK;IACtC,MAAM,CAAU,OAAO,CAgDrB;CAiJH"}
|