@plotday/twister 0.43.0 → 0.45.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/bin/commands/deploy.js +87 -10
- package/bin/commands/deploy.js.map +1 -1
- package/dist/connector.d.ts +92 -12
- package/dist/connector.d.ts.map +1 -1
- package/dist/connector.js +73 -4
- package/dist/connector.js.map +1 -1
- package/dist/docs/assets/hierarchy.js +1 -1
- package/dist/docs/assets/navigation.js +1 -1
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/classes/index.Connector.html +114 -54
- package/dist/docs/classes/index.Imap.html +52 -0
- package/dist/docs/classes/index.Options.html +2 -2
- package/dist/docs/classes/index.Smtp.html +33 -0
- package/dist/docs/classes/tool.ITool.html +1 -1
- package/dist/docs/classes/tool.Tool.html +30 -25
- package/dist/docs/classes/tools_ai.AI.html +1 -1
- package/dist/docs/classes/tools_callbacks.Callbacks.html +1 -1
- package/dist/docs/classes/tools_integrations.Integrations.html +11 -10
- package/dist/docs/classes/tools_network.Network.html +40 -7
- package/dist/docs/classes/tools_plot.Plot.html +72 -23
- package/dist/docs/classes/tools_store.Store.html +1 -1
- package/dist/docs/classes/tools_tasks.Tasks.html +1 -1
- package/dist/docs/classes/tools_twists.Twists.html +1 -1
- package/dist/docs/classes/twist.Twist.html +53 -35
- package/dist/docs/documents/Built-in_Tools.html +5 -3
- package/dist/docs/enums/plot.ActionType.html +9 -7
- package/dist/docs/enums/plot.ActorType.html +4 -4
- package/dist/docs/enums/plot.ConferencingProvider.html +6 -6
- package/dist/docs/enums/tools_integrations.AuthProvider.html +13 -11
- package/dist/docs/enums/tools_plot.ContactAccess.html +2 -2
- package/dist/docs/enums/tools_plot.LinkAccess.html +5 -0
- package/dist/docs/enums/tools_plot.PriorityAccess.html +7 -7
- package/dist/docs/enums/tools_plot.ThreadAccess.html +8 -3
- package/dist/docs/hierarchy.html +1 -1
- package/dist/docs/media/AGENTS.md +11 -7
- package/dist/docs/media/MULTI_USER_AUTH.md +14 -11
- package/dist/docs/modules/index.html +1 -1
- package/dist/docs/modules/plot.html +1 -1
- package/dist/docs/modules/tools_integrations.html +1 -1
- package/dist/docs/modules/tools_plot.html +1 -1
- package/dist/docs/types/index.BooleanDef.html +2 -2
- package/dist/docs/types/index.ImapAddress.html +6 -0
- package/dist/docs/types/index.ImapConnectOptions.html +12 -0
- package/dist/docs/types/index.ImapFetchOptions.html +8 -0
- package/dist/docs/types/index.ImapFlagOperation.html +2 -0
- package/dist/docs/types/index.ImapMailbox.html +10 -0
- package/dist/docs/types/index.ImapMailboxStatus.html +14 -0
- package/dist/docs/types/index.ImapMessage.html +28 -0
- package/dist/docs/types/index.ImapSearchCriteria.html +18 -0
- package/dist/docs/types/index.ImapSession.html +2 -0
- package/dist/docs/types/index.NumberDef.html +2 -2
- package/dist/docs/types/index.OptionDef.html +1 -1
- package/dist/docs/types/index.OptionsSchema.html +1 -1
- package/dist/docs/types/index.ResolvedOptions.html +1 -1
- package/dist/docs/types/index.SmtpAddress.html +6 -0
- package/dist/docs/types/index.SmtpConnectOptions.html +14 -0
- package/dist/docs/types/index.SmtpMessage.html +24 -0
- package/dist/docs/types/index.SmtpSendResult.html +8 -0
- package/dist/docs/types/index.SmtpSession.html +2 -0
- package/dist/docs/types/index.TextDef.html +5 -2
- package/dist/docs/types/plot.Action.html +6 -2
- package/dist/docs/types/plot.Actor.html +5 -5
- package/dist/docs/types/plot.Contact.html +9 -0
- package/dist/docs/types/plot.ContentType.html +1 -1
- package/dist/docs/types/plot.Link.html +21 -18
- package/dist/docs/types/plot.LinkUpdate.html +5 -0
- package/dist/docs/types/plot.NewActor.html +1 -1
- package/dist/docs/types/plot.NewContact.html +3 -17
- package/dist/docs/types/plot.NewLink.html +10 -7
- package/dist/docs/types/plot.NewLinkWithNotes.html +5 -4
- package/dist/docs/types/plot.NewNote.html +13 -3
- package/dist/docs/types/plot.NewTags.html +1 -1
- package/dist/docs/types/plot.NewThread.html +7 -5
- package/dist/docs/types/plot.NewThreadWithNotes.html +1 -1
- package/dist/docs/types/plot.Note.html +5 -2
- package/dist/docs/types/plot.NoteUpdate.html +4 -3
- package/dist/docs/types/plot.PlanOperation.html +10 -0
- package/dist/docs/types/plot.PriorityUpdate.html +5 -3
- package/dist/docs/types/plot.Tags.html +1 -1
- package/dist/docs/types/plot.Thread.html +1 -1
- package/dist/docs/types/plot.ThreadAccessLevel.html +7 -0
- package/dist/docs/types/plot.ThreadCommon.html +5 -9
- package/dist/docs/types/plot.ThreadFilter.html +2 -2
- package/dist/docs/types/plot.ThreadMeta.html +1 -1
- package/dist/docs/types/plot.ThreadType.html +3 -3
- package/dist/docs/types/plot.ThreadUpdate.html +1 -1
- package/dist/docs/types/plot.ThreadWithNotes.html +1 -1
- package/dist/docs/types/tools_integrations.ArchiveLinkFilter.html +5 -5
- package/dist/docs/types/tools_integrations.AuthToken.html +4 -4
- package/dist/docs/types/tools_integrations.Authorization.html +4 -4
- package/dist/docs/types/tools_integrations.Channel.html +4 -4
- package/dist/docs/types/tools_integrations.LinkTypeConfig.html +10 -3
- package/dist/docs/types/tools_integrations.SyncContext.html +10 -0
- package/dist/docs/types/tools_plot.LinkFilter.html +5 -5
- package/dist/docs/types/tools_plot.LinkSearchResult.html +1 -1
- package/dist/docs/types/tools_plot.NoteIntentHandler.html +4 -4
- package/dist/docs/types/tools_plot.NoteSearchResult.html +1 -1
- package/dist/docs/types/tools_plot.SearchOptions.html +6 -4
- package/dist/docs/types/tools_plot.SearchResult.html +1 -1
- package/dist/docs/variables/tools_plot.SEARCH_DEFAULT_LIMIT.html +1 -1
- package/dist/docs/variables/tools_plot.SEARCH_MAX_LIMIT.html +1 -1
- package/dist/llm-docs/connector.d.ts +1 -1
- package/dist/llm-docs/connector.d.ts.map +1 -1
- package/dist/llm-docs/connector.js +1 -1
- package/dist/llm-docs/connector.js.map +1 -1
- package/dist/llm-docs/index.d.ts.map +1 -1
- package/dist/llm-docs/index.js +4 -0
- package/dist/llm-docs/index.js.map +1 -1
- package/dist/llm-docs/options.d.ts +1 -1
- package/dist/llm-docs/options.d.ts.map +1 -1
- package/dist/llm-docs/options.js +1 -1
- package/dist/llm-docs/options.js.map +1 -1
- package/dist/llm-docs/plot.d.ts +1 -1
- package/dist/llm-docs/plot.d.ts.map +1 -1
- package/dist/llm-docs/plot.js +1 -1
- package/dist/llm-docs/plot.js.map +1 -1
- package/dist/llm-docs/tool.d.ts +1 -1
- package/dist/llm-docs/tool.d.ts.map +1 -1
- package/dist/llm-docs/tool.js +1 -1
- package/dist/llm-docs/tool.js.map +1 -1
- package/dist/llm-docs/tools/imap.d.ts +9 -0
- package/dist/llm-docs/tools/imap.d.ts.map +1 -0
- package/dist/llm-docs/tools/imap.js +8 -0
- package/dist/llm-docs/tools/imap.js.map +1 -0
- package/dist/llm-docs/tools/integrations.d.ts +1 -1
- package/dist/llm-docs/tools/integrations.d.ts.map +1 -1
- package/dist/llm-docs/tools/integrations.js +1 -1
- package/dist/llm-docs/tools/integrations.js.map +1 -1
- package/dist/llm-docs/tools/network.d.ts +1 -1
- package/dist/llm-docs/tools/network.d.ts.map +1 -1
- package/dist/llm-docs/tools/network.js +1 -1
- package/dist/llm-docs/tools/network.js.map +1 -1
- package/dist/llm-docs/tools/plot.d.ts +1 -1
- package/dist/llm-docs/tools/plot.d.ts.map +1 -1
- package/dist/llm-docs/tools/plot.js +1 -1
- package/dist/llm-docs/tools/plot.js.map +1 -1
- package/dist/llm-docs/tools/smtp.d.ts +9 -0
- package/dist/llm-docs/tools/smtp.d.ts.map +1 -0
- package/dist/llm-docs/tools/smtp.js +8 -0
- package/dist/llm-docs/tools/smtp.js.map +1 -0
- package/dist/llm-docs/twist.d.ts +1 -1
- package/dist/llm-docs/twist.d.ts.map +1 -1
- package/dist/llm-docs/twist.js +1 -1
- package/dist/llm-docs/twist.js.map +1 -1
- package/dist/options.d.ts +3 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js.map +1 -1
- package/dist/plot.d.ts +198 -76
- package/dist/plot.d.ts.map +1 -1
- package/dist/plot.js +2 -0
- package/dist/plot.js.map +1 -1
- package/dist/tool.d.ts +13 -6
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +12 -5
- package/dist/tool.js.map +1 -1
- package/dist/tools/imap.d.ts +235 -0
- package/dist/tools/imap.d.ts.map +1 -0
- package/dist/tools/imap.js +61 -0
- package/dist/tools/imap.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/integrations.d.ts +35 -5
- package/dist/tools/integrations.d.ts.map +1 -1
- package/dist/tools/integrations.js +2 -0
- package/dist/tools/integrations.js.map +1 -1
- package/dist/tools/network.d.ts +53 -16
- package/dist/tools/network.d.ts.map +1 -1
- package/dist/tools/network.js.map +1 -1
- package/dist/tools/plot.d.ts +124 -11
- package/dist/tools/plot.d.ts.map +1 -1
- package/dist/tools/plot.js +20 -6
- package/dist/tools/plot.js.map +1 -1
- package/dist/tools/smtp.d.ts +155 -0
- package/dist/tools/smtp.d.ts.map +1 -0
- package/dist/tools/smtp.js +62 -0
- package/dist/tools/smtp.js.map +1 -0
- package/dist/twist.d.ts +37 -15
- package/dist/twist.d.ts.map +1 -1
- package/dist/twist.js +35 -13
- package/dist/twist.js.map +1 -1
- package/package.json +21 -1
- package/dist/docs/types/plot.PickPriorityConfig.html +0 -20
package/dist/tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,MAAM,OAAgB,KAAK;CAAG;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAgB,IAAI;IAEZ;IACA;IACF;IAHV,YACY,EAAU,EACV,O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,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACH,WAAW;QACT,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED;;;;;;;;OAQG;IACH,aAAa;QACX,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACH,cAAc;QACZ,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { ITool } from "..";
|
|
2
|
+
/** Opaque session handle returned by connect(). */
|
|
3
|
+
export type ImapSession = string;
|
|
4
|
+
/** Credentials and server info for connecting to an IMAP server. */
|
|
5
|
+
export type ImapConnectOptions = {
|
|
6
|
+
/** IMAP server hostname (e.g. "imap.mail.me.com") */
|
|
7
|
+
host: string;
|
|
8
|
+
/** IMAP server port (e.g. 993 for TLS) */
|
|
9
|
+
port: number;
|
|
10
|
+
/** Whether to use TLS (true for port 993) */
|
|
11
|
+
tls: boolean;
|
|
12
|
+
/** IMAP username (typically the email address) */
|
|
13
|
+
username: string;
|
|
14
|
+
/** IMAP password (app-specific password for Apple) */
|
|
15
|
+
password: string;
|
|
16
|
+
};
|
|
17
|
+
/** A mailbox returned by listMailboxes(). */
|
|
18
|
+
export type ImapMailbox = {
|
|
19
|
+
/** Mailbox name (e.g. "INBOX", "Sent Messages") */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Hierarchy delimiter (e.g. "/") */
|
|
22
|
+
delimiter: string;
|
|
23
|
+
/** Mailbox flags (e.g. ["\\HasNoChildren"]) */
|
|
24
|
+
flags: string[];
|
|
25
|
+
/** Special-use attribute if present (e.g. "\\Sent", "\\Drafts", "\\Trash") */
|
|
26
|
+
specialUse?: string;
|
|
27
|
+
};
|
|
28
|
+
/** Status of a selected mailbox. */
|
|
29
|
+
export type ImapMailboxStatus = {
|
|
30
|
+
/** Mailbox name */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Total number of messages */
|
|
33
|
+
exists: number;
|
|
34
|
+
/** Number of recent messages */
|
|
35
|
+
recent: number;
|
|
36
|
+
/** UID validity value (changes if UIDs are reassigned) */
|
|
37
|
+
uidValidity: number;
|
|
38
|
+
/** Next UID to be assigned */
|
|
39
|
+
uidNext: number;
|
|
40
|
+
/** Number of unseen messages (may be absent) */
|
|
41
|
+
unseen?: number;
|
|
42
|
+
};
|
|
43
|
+
/** Criteria for searching messages. All fields are optional; they are ANDed together. */
|
|
44
|
+
export type ImapSearchCriteria = {
|
|
45
|
+
/** Messages with internal date on or after this date */
|
|
46
|
+
since?: Date | string;
|
|
47
|
+
/** Messages with internal date before this date */
|
|
48
|
+
before?: Date | string;
|
|
49
|
+
/** Messages with From header containing this string */
|
|
50
|
+
from?: string;
|
|
51
|
+
/** Messages with To header containing this string */
|
|
52
|
+
to?: string;
|
|
53
|
+
/** Messages with Subject containing this string */
|
|
54
|
+
subject?: string;
|
|
55
|
+
/** If true, only unseen messages; if false, only seen messages */
|
|
56
|
+
unseen?: boolean;
|
|
57
|
+
/** If true, only flagged messages; if false, only unflagged messages */
|
|
58
|
+
flagged?: boolean;
|
|
59
|
+
/** Specific UIDs to match */
|
|
60
|
+
uid?: number[];
|
|
61
|
+
};
|
|
62
|
+
/** An email address with optional display name. */
|
|
63
|
+
export type ImapAddress = {
|
|
64
|
+
/** Display name (e.g. "John Doe") */
|
|
65
|
+
name?: string;
|
|
66
|
+
/** Email address (e.g. "john@example.com") */
|
|
67
|
+
address: string;
|
|
68
|
+
};
|
|
69
|
+
/** A fetched message. Fields are populated based on ImapFetchOptions. */
|
|
70
|
+
export type ImapMessage = {
|
|
71
|
+
/** Message UID (stable across sessions if uidValidity hasn't changed) */
|
|
72
|
+
uid: number;
|
|
73
|
+
/** Message flags (e.g. ["\\Seen", "\\Flagged"]) */
|
|
74
|
+
flags: string[];
|
|
75
|
+
/** Internal date of the message */
|
|
76
|
+
date?: Date;
|
|
77
|
+
/** Subject header */
|
|
78
|
+
subject?: string;
|
|
79
|
+
/** From addresses */
|
|
80
|
+
from?: ImapAddress[];
|
|
81
|
+
/** To addresses */
|
|
82
|
+
to?: ImapAddress[];
|
|
83
|
+
/** CC addresses */
|
|
84
|
+
cc?: ImapAddress[];
|
|
85
|
+
/** Message-ID header */
|
|
86
|
+
messageId?: string;
|
|
87
|
+
/** In-Reply-To header (for threading) */
|
|
88
|
+
inReplyTo?: string;
|
|
89
|
+
/** References header (for threading) */
|
|
90
|
+
references?: string[];
|
|
91
|
+
/** Plain text body (when requested) */
|
|
92
|
+
bodyText?: string;
|
|
93
|
+
/** HTML body (when requested) */
|
|
94
|
+
bodyHtml?: string;
|
|
95
|
+
/** Message size in bytes */
|
|
96
|
+
size?: number;
|
|
97
|
+
};
|
|
98
|
+
/** Options for fetchMessages(). */
|
|
99
|
+
export type ImapFetchOptions = {
|
|
100
|
+
/** Fetch envelope/headers. Default: true. */
|
|
101
|
+
headers?: boolean;
|
|
102
|
+
/** Fetch body content. Default: false. */
|
|
103
|
+
body?: boolean;
|
|
104
|
+
/** Which body parts to fetch when body is true. Default: "both". */
|
|
105
|
+
bodyType?: "text" | "html" | "both";
|
|
106
|
+
};
|
|
107
|
+
/** How to modify flags. */
|
|
108
|
+
export type ImapFlagOperation = "add" | "remove" | "set";
|
|
109
|
+
/**
|
|
110
|
+
* Built-in tool for IMAP email access.
|
|
111
|
+
*
|
|
112
|
+
* Provides high-level IMAP operations for reading email and managing flags.
|
|
113
|
+
* Handles TCP/TLS connections, IMAP protocol details, and MIME decoding
|
|
114
|
+
* internally.
|
|
115
|
+
*
|
|
116
|
+
* **Permission model:** Connectors declare which IMAP hosts they need access
|
|
117
|
+
* to. Connections to undeclared hosts are rejected.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* class AppleMailConnector extends Connector<AppleMailConnector> {
|
|
122
|
+
* build(build: ConnectorBuilder) {
|
|
123
|
+
* return {
|
|
124
|
+
* options: build(Options, {
|
|
125
|
+
* email: { type: "text", label: "Apple ID Email", default: "" },
|
|
126
|
+
* password: { type: "text", label: "App-Specific Password", secure: true, default: "" },
|
|
127
|
+
* }),
|
|
128
|
+
*
|
|
129
|
+
* imap: build(Imap, { hosts: ["imap.mail.me.com"] }),
|
|
130
|
+
* integrations: build(Integrations),
|
|
131
|
+
* };
|
|
132
|
+
* }
|
|
133
|
+
*
|
|
134
|
+
* async syncInbox() {
|
|
135
|
+
* const session = await this.tools.imap.connect({
|
|
136
|
+
* host: "imap.mail.me.com",
|
|
137
|
+
* port: 993,
|
|
138
|
+
* tls: true,
|
|
139
|
+
* username: this.tools.options.email,
|
|
140
|
+
* password: this.tools.options.password,
|
|
141
|
+
* });
|
|
142
|
+
*
|
|
143
|
+
* try {
|
|
144
|
+
* await this.tools.imap.selectMailbox(session, "INBOX");
|
|
145
|
+
* const uids = await this.tools.imap.search(session, { unseen: true });
|
|
146
|
+
* const messages = await this.tools.imap.fetchMessages(session, uids, {
|
|
147
|
+
* body: true,
|
|
148
|
+
* bodyType: "html",
|
|
149
|
+
* });
|
|
150
|
+
*
|
|
151
|
+
* for (const msg of messages) {
|
|
152
|
+
* await this.tools.integrations.saveLink({
|
|
153
|
+
* source: `apple-mail:${msg.messageId}`,
|
|
154
|
+
* title: msg.subject ?? "(no subject)",
|
|
155
|
+
* // ...
|
|
156
|
+
* });
|
|
157
|
+
* }
|
|
158
|
+
* } finally {
|
|
159
|
+
* await this.tools.imap.disconnect(session);
|
|
160
|
+
* }
|
|
161
|
+
* }
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export declare abstract class Imap extends ITool {
|
|
166
|
+
static readonly Options: {
|
|
167
|
+
/** IMAP server hostnames this tool is allowed to connect to. */
|
|
168
|
+
hosts: string[];
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Opens a connection to an IMAP server and authenticates.
|
|
172
|
+
*
|
|
173
|
+
* @param options - Server address, port, TLS setting, and credentials
|
|
174
|
+
* @returns An opaque session handle for subsequent operations
|
|
175
|
+
* @throws If the host is not in the declared hosts list, connection fails, or auth fails
|
|
176
|
+
*/
|
|
177
|
+
abstract connect(options: ImapConnectOptions): Promise<ImapSession>;
|
|
178
|
+
/**
|
|
179
|
+
* Lists all mailboxes (folders) on the server.
|
|
180
|
+
*
|
|
181
|
+
* @param session - Session handle from connect()
|
|
182
|
+
* @returns Array of mailbox descriptors
|
|
183
|
+
*/
|
|
184
|
+
abstract listMailboxes(session: ImapSession): Promise<ImapMailbox[]>;
|
|
185
|
+
/**
|
|
186
|
+
* Selects a mailbox for subsequent search/fetch/flag operations.
|
|
187
|
+
*
|
|
188
|
+
* @param session - Session handle from connect()
|
|
189
|
+
* @param mailbox - Mailbox name (e.g. "INBOX")
|
|
190
|
+
* @returns Mailbox status including message count and UID validity
|
|
191
|
+
*/
|
|
192
|
+
abstract selectMailbox(session: ImapSession, mailbox: string): Promise<ImapMailboxStatus>;
|
|
193
|
+
/**
|
|
194
|
+
* Searches for messages matching the given criteria in the selected mailbox.
|
|
195
|
+
*
|
|
196
|
+
* All criteria fields are ANDed together. Returns UIDs (not sequence numbers).
|
|
197
|
+
*
|
|
198
|
+
* @param session - Session handle from connect()
|
|
199
|
+
* @param criteria - Search criteria (all optional, ANDed)
|
|
200
|
+
* @returns Array of matching message UIDs
|
|
201
|
+
*/
|
|
202
|
+
abstract search(session: ImapSession, criteria: ImapSearchCriteria): Promise<number[]>;
|
|
203
|
+
/**
|
|
204
|
+
* Fetches message data for the given UIDs.
|
|
205
|
+
*
|
|
206
|
+
* By default fetches headers only. Set `body: true` in options to include
|
|
207
|
+
* message body content. The implementation handles MIME decoding internally.
|
|
208
|
+
*
|
|
209
|
+
* @param session - Session handle from connect()
|
|
210
|
+
* @param uids - Array of message UIDs to fetch
|
|
211
|
+
* @param options - What to fetch (headers, body, body type)
|
|
212
|
+
* @returns Array of message objects with requested fields populated
|
|
213
|
+
*/
|
|
214
|
+
abstract fetchMessages(session: ImapSession, uids: number[], options?: ImapFetchOptions): Promise<ImapMessage[]>;
|
|
215
|
+
/**
|
|
216
|
+
* Modifies flags on messages.
|
|
217
|
+
*
|
|
218
|
+
* Common flags: "\\Seen" (read), "\\Flagged" (starred), "\\Deleted" (marked for deletion).
|
|
219
|
+
*
|
|
220
|
+
* @param session - Session handle from connect()
|
|
221
|
+
* @param uids - Array of message UIDs to modify
|
|
222
|
+
* @param flags - Flags to add/remove/set (e.g. ["\\Seen"])
|
|
223
|
+
* @param operation - "add", "remove", or "set" (replace all flags)
|
|
224
|
+
*/
|
|
225
|
+
abstract setFlags(session: ImapSession, uids: number[], flags: string[], operation: ImapFlagOperation): Promise<void>;
|
|
226
|
+
/**
|
|
227
|
+
* Closes the IMAP connection.
|
|
228
|
+
*
|
|
229
|
+
* Always call this when done, preferably in a finally block.
|
|
230
|
+
*
|
|
231
|
+
* @param session - Session handle from connect()
|
|
232
|
+
*/
|
|
233
|
+
abstract disconnect(session: ImapSession): Promise<void>;
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=imap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imap.d.ts","sourceRoot":"","sources":["../../src/tools/imap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAE3B,mDAAmD;AACnD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC,oEAAoE;AACpE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,GAAG,EAAE,OAAO,CAAC;IACb,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,sDA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QAAQ,CAAC,OAAO,EAAE;QACvB,gEAAgE;QAChE,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IAEF;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;IAEnE;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAEpE;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CACpB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,iBAAiB,CAAC;IAE7B;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CACb,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,EAAE,CAAC;IAEpB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,aAAa,CACpB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,WAAW,EAAE,CAAC;IAEzB;;;;;;;;;OASG;IACH,QAAQ,CAAC,QAAQ,CACf,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,EAAE,EACf,SAAS,EAAE,iBAAiB,GAC3B,OAAO,CAAC,IAAI,CAAC;IAEhB;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CACzD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ITool } from "..";
|
|
2
|
+
/**
|
|
3
|
+
* Built-in tool for IMAP email access.
|
|
4
|
+
*
|
|
5
|
+
* Provides high-level IMAP operations for reading email and managing flags.
|
|
6
|
+
* Handles TCP/TLS connections, IMAP protocol details, and MIME decoding
|
|
7
|
+
* internally.
|
|
8
|
+
*
|
|
9
|
+
* **Permission model:** Connectors declare which IMAP hosts they need access
|
|
10
|
+
* to. Connections to undeclared hosts are rejected.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* class AppleMailConnector extends Connector<AppleMailConnector> {
|
|
15
|
+
* build(build: ConnectorBuilder) {
|
|
16
|
+
* return {
|
|
17
|
+
* options: build(Options, {
|
|
18
|
+
* email: { type: "text", label: "Apple ID Email", default: "" },
|
|
19
|
+
* password: { type: "text", label: "App-Specific Password", secure: true, default: "" },
|
|
20
|
+
* }),
|
|
21
|
+
*
|
|
22
|
+
* imap: build(Imap, { hosts: ["imap.mail.me.com"] }),
|
|
23
|
+
* integrations: build(Integrations),
|
|
24
|
+
* };
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* async syncInbox() {
|
|
28
|
+
* const session = await this.tools.imap.connect({
|
|
29
|
+
* host: "imap.mail.me.com",
|
|
30
|
+
* port: 993,
|
|
31
|
+
* tls: true,
|
|
32
|
+
* username: this.tools.options.email,
|
|
33
|
+
* password: this.tools.options.password,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* try {
|
|
37
|
+
* await this.tools.imap.selectMailbox(session, "INBOX");
|
|
38
|
+
* const uids = await this.tools.imap.search(session, { unseen: true });
|
|
39
|
+
* const messages = await this.tools.imap.fetchMessages(session, uids, {
|
|
40
|
+
* body: true,
|
|
41
|
+
* bodyType: "html",
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* for (const msg of messages) {
|
|
45
|
+
* await this.tools.integrations.saveLink({
|
|
46
|
+
* source: `apple-mail:${msg.messageId}`,
|
|
47
|
+
* title: msg.subject ?? "(no subject)",
|
|
48
|
+
* // ...
|
|
49
|
+
* });
|
|
50
|
+
* }
|
|
51
|
+
* } finally {
|
|
52
|
+
* await this.tools.imap.disconnect(session);
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export class Imap extends ITool {
|
|
59
|
+
static Options;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=imap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imap.js","sourceRoot":"","sources":["../../src/tools/imap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAsH3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,OAAgB,IAAK,SAAQ,KAAK;IACtC,MAAM,CAAU,OAAO,CAGrB;CAuFH"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1 +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"}
|
|
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;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
|
package/dist/tools/index.js
CHANGED
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +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"}
|
|
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;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
|
|
@@ -13,8 +13,8 @@ export type Channel = {
|
|
|
13
13
|
title: string;
|
|
14
14
|
/** Optional nested channel resources (e.g., subfolders) */
|
|
15
15
|
children?: Channel[];
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/** Per-channel link type configs. Overrides twist-level linkTypes when present. */
|
|
17
|
+
linkTypes?: LinkTypeConfig[];
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Describes a link type that a connector creates.
|
|
@@ -41,9 +41,36 @@ export type LinkTypeConfig = {
|
|
|
41
41
|
tag?: Tag;
|
|
42
42
|
/** Whether this status represents completion (done, closed, merged, cancelled, etc.) */
|
|
43
43
|
done?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether this status represents the connector's "to-do" / active state.
|
|
46
|
+
* When a user adds a thread to Plot's agenda, done-status links flip to
|
|
47
|
+
* the status marked `todo: true` (e.g., Gmail's "starred", Linear's
|
|
48
|
+
* "todo") so the link widget and thread tags reflect the active state.
|
|
49
|
+
* At most one status per type should set this.
|
|
50
|
+
*/
|
|
51
|
+
todo?: boolean;
|
|
44
52
|
}>;
|
|
45
53
|
/** Whether this link type supports displaying and changing the assignee */
|
|
46
54
|
supportsAssignee?: boolean;
|
|
55
|
+
/** Default thread creation mode for this link type: 'all' | 'actionable' | 'manual' */
|
|
56
|
+
defaultCreateThreads?: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Context passed to onChannelEnabled with plan-based sync hints.
|
|
60
|
+
* Connectors can use these hints to limit initial sync scope.
|
|
61
|
+
*/
|
|
62
|
+
export type SyncContext = {
|
|
63
|
+
/**
|
|
64
|
+
* Earliest date to include in initial sync, based on the user's plan.
|
|
65
|
+
*
|
|
66
|
+
* Non-calendar connectors should use this as their date filter (timeMin,
|
|
67
|
+
* created.gte, etc.) during initial sync. Calendar connectors should
|
|
68
|
+
* ignore this for API queries (to avoid missing recurring events) — the
|
|
69
|
+
* API layer filters non-recurring items automatically.
|
|
70
|
+
*
|
|
71
|
+
* Undefined when no limit applies.
|
|
72
|
+
*/
|
|
73
|
+
syncHistoryMin?: Date;
|
|
47
74
|
};
|
|
48
75
|
/**
|
|
49
76
|
* Built-in tool for managing OAuth authentication and channel resources.
|
|
@@ -135,9 +162,10 @@ export declare abstract class Integrations extends ITool {
|
|
|
135
162
|
* This method is available only to Connectors (not regular Twists).
|
|
136
163
|
*
|
|
137
164
|
* @param link - The link with notes to save
|
|
138
|
-
* @returns Promise resolving to the saved thread's UUID
|
|
165
|
+
* @returns Promise resolving to the saved thread's UUID, or null if the
|
|
166
|
+
* link was filtered out (e.g. older than the plan's sync history limit)
|
|
139
167
|
*/
|
|
140
|
-
abstract saveLink(link: NewLinkWithNotes): Promise<Uuid>;
|
|
168
|
+
abstract saveLink(link: NewLinkWithNotes): Promise<Uuid | null>;
|
|
141
169
|
/**
|
|
142
170
|
* Saves contacts to the connector's priority.
|
|
143
171
|
*
|
|
@@ -208,7 +236,9 @@ export declare enum AuthProvider {
|
|
|
208
236
|
/** Asana OAuth provider for Asana workspaces */
|
|
209
237
|
Asana = "asana",
|
|
210
238
|
/** HubSpot OAuth provider for HubSpot CRM */
|
|
211
|
-
HubSpot = "hubspot"
|
|
239
|
+
HubSpot = "hubspot",
|
|
240
|
+
/** Todoist OAuth provider for Todoist task management */
|
|
241
|
+
Todoist = "todoist"
|
|
212
242
|
}
|
|
213
243
|
/**
|
|
214
244
|
* Represents a completed authorization from an OAuth flow.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/tools/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,EACL,YAAY,EACb,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAC;IACX,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,
|
|
1
|
+
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/tools/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,EACL,YAAY,EACb,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAC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,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;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;IACnB,yDAAyD;IACzD,OAAO,YAAY;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,mDAAmD;IACnD,QAAQ,EAAE,YAAY,CAAC;IACvB,sDAAsD;IACtD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,0EAA0E;IAC1E,KAAK,EAAE,KAAK,CAAC;CACd,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"}
|
|
@@ -78,5 +78,7 @@ export var AuthProvider;
|
|
|
78
78
|
AuthProvider["Asana"] = "asana";
|
|
79
79
|
/** HubSpot OAuth provider for HubSpot CRM */
|
|
80
80
|
AuthProvider["HubSpot"] = "hubspot";
|
|
81
|
+
/** Todoist OAuth provider for Todoist task management */
|
|
82
|
+
AuthProvider["Todoist"] = "todoist";
|
|
81
83
|
})(AuthProvider || (AuthProvider = {}));
|
|
82
84
|
//# sourceMappingURL=integrations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../src/tools/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,GAEN,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../src/tools/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,GAEN,MAAM,IAAI,CAAC;AA8EZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,OAAgB,YAAa,SAAQ,KAAK;IAC9C;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,WAAuB;QAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC;CAqGF;AAiBD;;;;;GAKG;AACH,MAAM,CAAN,IAAY,YAuBX;AAvBD,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;IACnB,yDAAyD;IACzD,mCAAmB,CAAA;AACrB,CAAC,EAvBW,YAAY,KAAZ,YAAY,QAuBvB"}
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -133,6 +133,10 @@ export declare abstract class Network extends ITool {
|
|
|
133
133
|
* - **Gmail** (Google with Gmail scopes): Returns a Google Pub/Sub topic name instead of a webhook URL.
|
|
134
134
|
* The topic name (e.g., "projects/plot-prod/topics/gmail-webhook-abc123") should be passed
|
|
135
135
|
* to the Gmail API's `users.watch` endpoint. Requires `authorization` parameter with Gmail scopes.
|
|
136
|
+
* - **Pub/Sub** (`pubsub: true`): Returns a Google Pub/Sub topic name instead of a webhook URL.
|
|
137
|
+
* Use this for services that deliver events via Pub/Sub (e.g., Google Workspace Events API).
|
|
138
|
+
* A Pub/Sub topic and push subscription are created automatically; the returned topic name
|
|
139
|
+
* can be passed to any Google API that accepts a Pub/Sub notification endpoint.
|
|
136
140
|
* - **Default**: Returns a standard webhook URL for all other cases.
|
|
137
141
|
*
|
|
138
142
|
* @param options - Webhook creation options
|
|
@@ -140,34 +144,67 @@ export declare abstract class Network extends ITool {
|
|
|
140
144
|
* @param options.authorization - Optional authorization for provider-specific webhooks (required for Slack and Gmail)
|
|
141
145
|
* @param callback - Function receiving (request, ...extraArgs)
|
|
142
146
|
* @param extraArgs - Additional arguments to pass to the callback (type-checked, no functions allowed)
|
|
143
|
-
* @returns Promise resolving to the webhook URL, or for Gmail, a Pub/Sub topic name
|
|
147
|
+
* @returns Promise resolving to the webhook URL, or for Gmail/Pub/Sub, a Pub/Sub topic name
|
|
144
148
|
*
|
|
145
149
|
* @example
|
|
146
150
|
* ```typescript
|
|
147
|
-
* //
|
|
151
|
+
* // Pub/Sub webhook for Workspace Events API
|
|
148
152
|
* const topicName = await this.tools.network.createWebhook(
|
|
149
|
-
* {
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
+
* { pubsub: true },
|
|
154
|
+
* this.onEventReceived,
|
|
155
|
+
* channelId
|
|
156
|
+
* );
|
|
157
|
+
* // topicName: "projects/plot-prod/topics/ps-abc123"
|
|
158
|
+
*
|
|
159
|
+
* // Pass topic name to Workspace Events API
|
|
160
|
+
* await api.createSubscription(targetResource, topicName, eventTypes);
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* // Gmail webhook - auto-detected from scopes, returns Pub/Sub topic name
|
|
166
|
+
* const topicName = await this.tools.network.createWebhook(
|
|
167
|
+
* {},
|
|
153
168
|
* this.onGmailNotification,
|
|
154
169
|
* "inbox"
|
|
155
170
|
* );
|
|
156
|
-
* // topicName: "projects/plot-prod/topics/gmail-webhook-abc123"
|
|
157
|
-
*
|
|
158
|
-
* // Pass topic name to Gmail API
|
|
159
|
-
* await gmailApi.users.watch({
|
|
160
|
-
* userId: 'me',
|
|
161
|
-
* requestBody: {
|
|
162
|
-
* topicName: topicName, // Use the returned topic name
|
|
163
|
-
* labelIds: ['INBOX']
|
|
164
|
-
* }
|
|
165
|
-
* });
|
|
166
171
|
* ```
|
|
167
172
|
*/
|
|
168
173
|
abstract createWebhook<TArgs extends Serializable[], TCallback extends (request: WebhookRequest, ...args: TArgs) => any>(options: {
|
|
169
174
|
provider?: AuthProvider;
|
|
170
175
|
authorization?: Authorization;
|
|
176
|
+
/** When true, creates a Google Pub/Sub topic instead of a webhook URL. */
|
|
177
|
+
pubsub?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Controls whether the returned webhook URL runs callbacks synchronously
|
|
180
|
+
* or asynchronously.
|
|
181
|
+
*
|
|
182
|
+
* **Async (default, `async: true`)** — Plot enqueues each incoming
|
|
183
|
+
* request and immediately returns `200 { queued: true }`. A background
|
|
184
|
+
* queue consumer runs the callback with bounded concurrency. The
|
|
185
|
+
* sender never sees the callback's return value or any error thrown
|
|
186
|
+
* by it, and delivery is at-least-once (the callback must be
|
|
187
|
+
* idempotent). This is the right default for the vast majority of
|
|
188
|
+
* webhooks — service event notifications, bulk-import fan-out, etc. —
|
|
189
|
+
* because it removes ingress-path database pressure and prevents
|
|
190
|
+
* sender-side retry storms when callbacks are slow.
|
|
191
|
+
*
|
|
192
|
+
* **Sync (`async: false`)** — Plot runs the callback inline and
|
|
193
|
+
* responds with the callback's return value. Required when:
|
|
194
|
+
* - The sender reads the response body (e.g. Microsoft Graph
|
|
195
|
+
* subscription validation, which POSTs with a `validationToken` and
|
|
196
|
+
* expects the token echoed as `text/plain`).
|
|
197
|
+
* - The sender uses the HTTP status code to decide whether to retry
|
|
198
|
+
* (e.g. to surface 4xx for permanent failures).
|
|
199
|
+
* - The handler must observe throws before the sender times out.
|
|
200
|
+
*
|
|
201
|
+
* When `async: false`, a callback returning a `string` is sent back
|
|
202
|
+
* with `Content-Type: text/plain`; any other value is serialized as
|
|
203
|
+
* JSON. `undefined` / `void` yields a plain `200 OK` body.
|
|
204
|
+
*
|
|
205
|
+
* Defaults to `true`.
|
|
206
|
+
*/
|
|
207
|
+
async?: boolean;
|
|
171
208
|
}, callback: TCallback, ...extraArgs: TArgs): Promise<string>;
|
|
172
209
|
/**
|
|
173
210
|
* Deletes an existing webhook endpoint.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/tools/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,KAAK,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9D,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,SAAS,CAAC;IAChB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,KAAK,KAAK,GAAG,EAElE,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,YAAY,CAAC;QACxB,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,0EAA0E;QAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA4BG;QACH,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,EACD,QAAQ,EAAE,SAAS,EACnB,GAAG,SAAS,EAAE,KAAK,GAClB,OAAO,CAAC,MAAM,CAAC;IAElB;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/tools/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAkC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,MAAM,OAAgB,OAAQ,SAAQ,KAAK;IACzC,MAAM,CAAU,OAAO,CAMrB;
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/tools/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAkC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,MAAM,OAAgB,OAAQ,SAAQ,KAAK;IACzC,MAAM,CAAU,OAAO,CAMrB;CAkHH"}
|