@plotday/twister 0.43.0 → 0.44.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 +87 -7
- package/dist/connector.d.ts.map +1 -1
- package/dist/connector.js +70 -0
- 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 +102 -45
- 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 +23 -16
- 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 +9 -9
- package/dist/docs/classes/tools_network.Network.html +15 -7
- package/dist/docs/classes/tools_plot.Plot.html +57 -21
- 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 +29 -18
- 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 +3 -3
- package/dist/docs/enums/tools_plot.ThreadAccess.html +8 -3
- package/dist/docs/hierarchy.html +1 -1
- package/dist/docs/media/AGENTS.md +10 -6
- 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_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.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 +6 -4
- package/dist/docs/types/plot.NewLinkWithNotes.html +5 -4
- package/dist/docs/types/plot.NewNote.html +6 -2
- package/dist/docs/types/plot.NewTags.html +1 -1
- package/dist/docs/types/plot.NewThread.html +1 -1
- package/dist/docs/types/plot.NewThreadWithNotes.html +1 -1
- package/dist/docs/types/plot.Note.html +1 -1
- package/dist/docs/types/plot.NoteUpdate.html +1 -1
- package/dist/docs/types/plot.PickPriorityConfig.html +2 -2
- 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.ThreadCommon.html +7 -7
- 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 -2
- package/dist/docs/types/tools_integrations.LinkTypeConfig.html +10 -8
- 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 +4 -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 +132 -21
- 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 +10 -1
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +10 -1
- 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 +7 -1
- 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 +23 -16
- package/dist/tools/network.d.ts.map +1 -1
- package/dist/tools/network.js.map +1 -1
- package/dist/tools/plot.d.ts +90 -3
- package/dist/tools/plot.d.ts.map +1 -1
- package/dist/tools/plot.js +14 -0
- 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 +16 -2
- package/dist/twist.d.ts.map +1 -1
- package/dist/twist.js +15 -1
- package/dist/twist.js.map +1 -1
- package/package.json +21 -1
|
@@ -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"}
|
|
@@ -15,6 +15,8 @@ export type Channel = {
|
|
|
15
15
|
children?: Channel[];
|
|
16
16
|
/** Priority ID this channel is routed to (set when channel is enabled) */
|
|
17
17
|
priorityId?: string;
|
|
18
|
+
/** Per-channel link type configs. Overrides twist-level linkTypes when present. */
|
|
19
|
+
linkTypes?: LinkTypeConfig[];
|
|
18
20
|
};
|
|
19
21
|
/**
|
|
20
22
|
* Describes a link type that a connector creates.
|
|
@@ -44,6 +46,8 @@ export type LinkTypeConfig = {
|
|
|
44
46
|
}>;
|
|
45
47
|
/** Whether this link type supports displaying and changing the assignee */
|
|
46
48
|
supportsAssignee?: boolean;
|
|
49
|
+
/** Default thread creation mode for this link type: 'all' | 'actionable' | 'manual' */
|
|
50
|
+
defaultCreateThreads?: string;
|
|
47
51
|
};
|
|
48
52
|
/**
|
|
49
53
|
* Built-in tool for managing OAuth authentication and channel resources.
|
|
@@ -208,7 +212,9 @@ export declare enum AuthProvider {
|
|
|
208
212
|
/** Asana OAuth provider for Asana workspaces */
|
|
209
213
|
Asana = "asana",
|
|
210
214
|
/** HubSpot OAuth provider for HubSpot CRM */
|
|
211
|
-
HubSpot = "hubspot"
|
|
215
|
+
HubSpot = "hubspot",
|
|
216
|
+
/** Todoist OAuth provider for Todoist task management */
|
|
217
|
+
Todoist = "todoist"
|
|
212
218
|
}
|
|
213
219
|
/**
|
|
214
220
|
* 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,K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AAW;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;AAsDZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;CAoGF;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,37 @@ 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;
|
|
171
178
|
}, callback: TCallback, ...extraArgs: TArgs): Promise<string>;
|
|
172
179
|
/**
|
|
173
180
|
* 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,8BAAsB,OAAQ,SAAQ,KAAK;IACzC,MAAM,CAAC,QAAQ,CA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xB,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,0EAA0E;QAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,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;CAoFH"}
|
package/dist/tools/plot.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type Thread, type ThreadUpdate, type Actor, type ActorId, ITool, type Link, type NewThread, type NewThreadWithNotes, type NewNote, type NewPriority, type Note, type NoteUpdate, type Priority, type PriorityUpdate, Uuid } from "..";
|
|
1
|
+
import { type Action, type Thread, type ThreadUpdate, type Actor, type ActorId, ITool, type Link, type LinkUpdate, type NewThread, type NewThreadWithNotes, type NewNote, type NewPriority, type Note, type NoteUpdate, type PlanOperation, type Priority, type PriorityUpdate, Uuid } from "..";
|
|
2
2
|
import { type Schedule, type NewSchedule } from "../schedule";
|
|
3
|
+
import type { Callback } from "./callbacks";
|
|
3
4
|
export declare enum ThreadAccess {
|
|
4
5
|
/**
|
|
5
6
|
* Create new Note on a Thread where the twist was mentioned.
|
|
@@ -11,7 +12,14 @@ export declare enum ThreadAccess {
|
|
|
11
12
|
* Create new Note in a Thread the twist created.
|
|
12
13
|
* All Respond permissions.
|
|
13
14
|
*/
|
|
14
|
-
Create = 1
|
|
15
|
+
Create = 1,
|
|
16
|
+
/**
|
|
17
|
+
* List/query all Threads in the twist's priority scope.
|
|
18
|
+
* Update any Thread (title, tags, archived, type, priority) regardless of creator.
|
|
19
|
+
* Create Notes on any Thread (not just own or mentioned).
|
|
20
|
+
* All Create permissions.
|
|
21
|
+
*/
|
|
22
|
+
Full = 2
|
|
15
23
|
}
|
|
16
24
|
export declare enum PriorityAccess {
|
|
17
25
|
/**
|
|
@@ -30,6 +38,12 @@ export declare enum ContactAccess {
|
|
|
30
38
|
/** Read existing contact details. Without this, only the ID will be provided. */
|
|
31
39
|
Read = 0
|
|
32
40
|
}
|
|
41
|
+
export declare enum LinkAccess {
|
|
42
|
+
/** Read links on any thread in the twist's priority scope. */
|
|
43
|
+
Read = 0,
|
|
44
|
+
/** Read + update links, including moving links between threads within scope. */
|
|
45
|
+
Full = 1
|
|
46
|
+
}
|
|
33
47
|
/**
|
|
34
48
|
* Intent handler for thread mentions.
|
|
35
49
|
* Defines how the twist should respond when mentioned in a thread.
|
|
@@ -202,7 +216,10 @@ export declare abstract class Plot extends ITool {
|
|
|
202
216
|
intents?: NoteIntentHandler[];
|
|
203
217
|
};
|
|
204
218
|
/** Enable link processing from connected source channels. */
|
|
205
|
-
link?: true
|
|
219
|
+
link?: true | {
|
|
220
|
+
/** Access level for links. When omitted with `link: true`, only source channel links are accessible. */
|
|
221
|
+
access?: LinkAccess;
|
|
222
|
+
};
|
|
206
223
|
priority?: {
|
|
207
224
|
access?: PriorityAccess;
|
|
208
225
|
};
|
|
@@ -211,6 +228,12 @@ export declare abstract class Plot extends ITool {
|
|
|
211
228
|
};
|
|
212
229
|
/** Enable semantic search across notes and links in the twist's priority scope. */
|
|
213
230
|
search?: true;
|
|
231
|
+
/**
|
|
232
|
+
* When true, admin write operations (on threads/notes/links/priorities not created by this twist)
|
|
233
|
+
* require user approval via plan actions instead of executing immediately.
|
|
234
|
+
* Read operations and operations on the twist's own content still work directly.
|
|
235
|
+
*/
|
|
236
|
+
requireApproval?: boolean;
|
|
214
237
|
};
|
|
215
238
|
/**
|
|
216
239
|
* Creates a new thread in the Plot system.
|
|
@@ -511,6 +534,70 @@ export declare abstract class Plot extends ITool {
|
|
|
511
534
|
* @returns Promise resolving to array of search results ordered by similarity
|
|
512
535
|
*/
|
|
513
536
|
abstract search(query: string, options?: SearchOptions): Promise<SearchResult[]>;
|
|
537
|
+
/**
|
|
538
|
+
* Lists threads in a priority and optionally its descendants.
|
|
539
|
+
*
|
|
540
|
+
* Requires `ThreadAccess.Full`.
|
|
541
|
+
*
|
|
542
|
+
* @param options - Query options for filtering threads
|
|
543
|
+
* @returns Promise resolving to array of threads
|
|
544
|
+
*/
|
|
545
|
+
abstract getThreads(options?: {
|
|
546
|
+
/** Priority to list threads from. Defaults to the twist's installed priority. */
|
|
547
|
+
priorityId?: Uuid;
|
|
548
|
+
/** Include threads from descendant priorities. Default: true. */
|
|
549
|
+
includeDescendants?: boolean;
|
|
550
|
+
/** Include archived threads. Default: false. */
|
|
551
|
+
includeArchived?: boolean;
|
|
552
|
+
/** Maximum number of threads to return. Default: 50, max: 200. */
|
|
553
|
+
limit?: number;
|
|
554
|
+
/** Number of threads to skip for pagination. Default: 0. */
|
|
555
|
+
offset?: number;
|
|
556
|
+
}): Promise<Thread[]>;
|
|
557
|
+
/**
|
|
558
|
+
* Lists priorities within the twist's scope.
|
|
559
|
+
*
|
|
560
|
+
* Requires `PriorityAccess.Full`.
|
|
561
|
+
*
|
|
562
|
+
* @param options - Query options for filtering priorities
|
|
563
|
+
* @returns Promise resolving to array of priorities
|
|
564
|
+
*/
|
|
565
|
+
abstract getPriorities(options?: {
|
|
566
|
+
/** Parent priority to list children of. Defaults to the twist's installed priority. */
|
|
567
|
+
parentId?: Uuid;
|
|
568
|
+
/** Include all descendants, not just direct children. Default: false. */
|
|
569
|
+
includeDescendants?: boolean;
|
|
570
|
+
/** Include archived priorities. Default: false. */
|
|
571
|
+
includeArchived?: boolean;
|
|
572
|
+
}): Promise<Priority[]>;
|
|
573
|
+
/**
|
|
574
|
+
* Updates a link.
|
|
575
|
+
*
|
|
576
|
+
* Requires `LinkAccess.Full`. Set `threadId` to move the link to a different thread.
|
|
577
|
+
*
|
|
578
|
+
* @param link - The link update containing the ID and fields to change
|
|
579
|
+
* @returns Promise that resolves when the update is complete
|
|
580
|
+
*/
|
|
581
|
+
abstract updateLink(link: LinkUpdate): Promise<void>;
|
|
582
|
+
/**
|
|
583
|
+
* Creates a plan of operations for user approval.
|
|
584
|
+
*
|
|
585
|
+
* Returns an Action that can be attached to a note. The user can approve,
|
|
586
|
+
* deny, or request changes. On approval, operations are executed by the API.
|
|
587
|
+
*
|
|
588
|
+
* Requires `requireApproval: true` in Plot options.
|
|
589
|
+
*
|
|
590
|
+
* @param options - Plan configuration
|
|
591
|
+
* @returns An Action of type `plan` to attach to a note
|
|
592
|
+
*/
|
|
593
|
+
abstract createPlan(options: {
|
|
594
|
+
/** Human-readable title summarizing the plan */
|
|
595
|
+
title: string;
|
|
596
|
+
/** Array of operations to execute on approval */
|
|
597
|
+
operations: PlanOperation[];
|
|
598
|
+
/** Callback invoked with (action, approved: boolean) when the user responds */
|
|
599
|
+
callback: Callback;
|
|
600
|
+
}): Action;
|
|
514
601
|
}
|
|
515
602
|
export {};
|
|
516
603
|
//# sourceMappingURL=plot.d.ts.map
|
package/dist/tools/plot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,IAAI,EACL,MAAM,IAAI,CAAC;AACZ,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,EACL,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,IAAI,EACL,MAAM,IAAI,CAAC;AACZ,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,oBAAY,YAAY;IACtB;;;OAGG;IACH,OAAO,IAAA;IACP;;;;OAIG;IACH,MAAM,IAAA;IACN;;;;;OAKG;IACH,IAAI,IAAA;CACL;AAED,oBAAY,cAAc;IACxB;;;OAGG;IACH,MAAM,IAAA;IACN;;;;OAIG;IACH,IAAI,IAAA;CACL;AAED,oBAAY,aAAa;IACvB,iFAAiF;IACjF,IAAI,IAAA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AC;IAEhF;;;;;;;OAOG;IAEH,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,iFAAiF;QACjF,UAAU,CAAC,EAAE,IAAI,CAAC;QAClB,iEAAiE;QACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,gDAAgD;QAChD,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,kEAAkE;QAClE,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,4DAA4D;QAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAErB;;;;;;;OAOG;IAEH,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QAC/B,uFAAuF;QACvF,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,yEAAyE;QACzE,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,mDAAmD;QACnD,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEvB;;;;;;;OAOG;IAEH,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAEpD;;;;;;;;;;OAUG;IAEH,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE;QAC3B,gDAAgD;QAChD,KAAK,EAAE,MAAM,CAAC;QACd,iDAAiD;QACjD,UAAU,EAAE,aAAa,EAAE,CAAC;QAC5B,+EAA+E;QAC/E,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,MAAM;CACX"}
|
package/dist/tools/plot.js
CHANGED
|
@@ -12,6 +12,13 @@ export var ThreadAccess;
|
|
|
12
12
|
* All Respond permissions.
|
|
13
13
|
*/
|
|
14
14
|
ThreadAccess[ThreadAccess["Create"] = 1] = "Create";
|
|
15
|
+
/**
|
|
16
|
+
* List/query all Threads in the twist's priority scope.
|
|
17
|
+
* Update any Thread (title, tags, archived, type, priority) regardless of creator.
|
|
18
|
+
* Create Notes on any Thread (not just own or mentioned).
|
|
19
|
+
* All Create permissions.
|
|
20
|
+
*/
|
|
21
|
+
ThreadAccess[ThreadAccess["Full"] = 2] = "Full";
|
|
15
22
|
})(ThreadAccess || (ThreadAccess = {}));
|
|
16
23
|
export var PriorityAccess;
|
|
17
24
|
(function (PriorityAccess) {
|
|
@@ -32,6 +39,13 @@ export var ContactAccess;
|
|
|
32
39
|
/** Read existing contact details. Without this, only the ID will be provided. */
|
|
33
40
|
ContactAccess[ContactAccess["Read"] = 0] = "Read";
|
|
34
41
|
})(ContactAccess || (ContactAccess = {}));
|
|
42
|
+
export var LinkAccess;
|
|
43
|
+
(function (LinkAccess) {
|
|
44
|
+
/** Read links on any thread in the twist's priority scope. */
|
|
45
|
+
LinkAccess[LinkAccess["Read"] = 0] = "Read";
|
|
46
|
+
/** Read + update links, including moving links between threads within scope. */
|
|
47
|
+
LinkAccess[LinkAccess["Full"] = 1] = "Full";
|
|
48
|
+
})(LinkAccess || (LinkAccess = {}));
|
|
35
49
|
/** Default number of search results returned */
|
|
36
50
|
export const SEARCH_DEFAULT_LIMIT = 10;
|
|
37
51
|
/** Maximum number of search results allowed */
|
package/dist/tools/plot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/tools/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,GAaN,MAAM,IAAI,CAAC;AAOZ,MAAM,CAAN,IAAY,YAmBX;AAnBD,WAAY,YAAY;IACtB;;;OAGG;IACH,qDAAO,CAAA;IACP;;;;OAIG;IACH,mDAAM,CAAA;IACN;;;;;OAKG;IACH,+CAAI,CAAA;AACN,CAAC,EAnBW,YAAY,KAAZ,YAAY,QAmBvB;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,aAGX;AAHD,WAAY,aAAa;IACvB,iFAAiF;IACjF,iDAAI,CAAA;AACN,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,8DAA8D;IAC9D,2CAAI,CAAA;IACJ,gFAAgF;IAChF,2CAAI,CAAA;AACN,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB;AAmDD,gDAAgD;AAChD,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAWnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAgB,IAAK,SAAQ,KAAK;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACH,MAAM,CAAU,OAAO,CAqDrB;CA8YH"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { ITool } from "..";
|
|
2
|
+
/** Opaque session handle returned by connect(). */
|
|
3
|
+
export type SmtpSession = string;
|
|
4
|
+
/** Credentials and server info for connecting to an SMTP server. */
|
|
5
|
+
export type SmtpConnectOptions = {
|
|
6
|
+
/** SMTP server hostname (e.g. "smtp.mail.me.com") */
|
|
7
|
+
host: string;
|
|
8
|
+
/** SMTP server port (e.g. 465 for TLS, 587 for STARTTLS) */
|
|
9
|
+
port: number;
|
|
10
|
+
/** Whether to use implicit TLS (true for port 465) */
|
|
11
|
+
tls: boolean;
|
|
12
|
+
/** Whether to upgrade to TLS via STARTTLS (true for port 587) */
|
|
13
|
+
starttls: boolean;
|
|
14
|
+
/** SMTP username (typically the email address) */
|
|
15
|
+
username: string;
|
|
16
|
+
/** SMTP password (app-specific password for Apple) */
|
|
17
|
+
password: string;
|
|
18
|
+
};
|
|
19
|
+
/** An email address with optional display name. */
|
|
20
|
+
export type SmtpAddress = {
|
|
21
|
+
/** Display name (e.g. "John Doe") */
|
|
22
|
+
name?: string;
|
|
23
|
+
/** Email address (e.g. "john@example.com") */
|
|
24
|
+
address: string;
|
|
25
|
+
};
|
|
26
|
+
/** An email message to send. */
|
|
27
|
+
export type SmtpMessage = {
|
|
28
|
+
/** Sender address */
|
|
29
|
+
from: SmtpAddress;
|
|
30
|
+
/** Primary recipients */
|
|
31
|
+
to: SmtpAddress[];
|
|
32
|
+
/** Carbon copy recipients */
|
|
33
|
+
cc?: SmtpAddress[];
|
|
34
|
+
/** Blind carbon copy recipients (not visible in headers) */
|
|
35
|
+
bcc?: SmtpAddress[];
|
|
36
|
+
/** Reply-To address (if different from From) */
|
|
37
|
+
replyTo?: SmtpAddress;
|
|
38
|
+
/** Message-ID of the message being replied to (for threading) */
|
|
39
|
+
inReplyTo?: string;
|
|
40
|
+
/** Message-ID chain for threading */
|
|
41
|
+
references?: string[];
|
|
42
|
+
/** Email subject line */
|
|
43
|
+
subject: string;
|
|
44
|
+
/** Plain text body */
|
|
45
|
+
text?: string;
|
|
46
|
+
/** HTML body */
|
|
47
|
+
html?: string;
|
|
48
|
+
/** Custom Message-ID; auto-generated as <uuid@plot.day> if omitted */
|
|
49
|
+
messageId?: string;
|
|
50
|
+
};
|
|
51
|
+
/** Result of sending an email. */
|
|
52
|
+
export type SmtpSendResult = {
|
|
53
|
+
/** The Message-ID that was used (auto-generated or from SmtpMessage) */
|
|
54
|
+
messageId: string;
|
|
55
|
+
/** Email addresses that were accepted by the server */
|
|
56
|
+
accepted: string[];
|
|
57
|
+
/** Email addresses that were rejected by the server */
|
|
58
|
+
rejected: string[];
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Built-in tool for SMTP email sending.
|
|
62
|
+
*
|
|
63
|
+
* Provides high-level SMTP operations for composing and sending email.
|
|
64
|
+
* Handles TCP/TLS connections, STARTTLS upgrades, SMTP protocol details,
|
|
65
|
+
* and RFC 2822 message formatting internally.
|
|
66
|
+
*
|
|
67
|
+
* **Permission model:** Connectors declare which SMTP hosts they need access
|
|
68
|
+
* to. Connections to undeclared hosts are rejected.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* class AppleMailConnector extends Connector<AppleMailConnector> {
|
|
73
|
+
* build(build: ConnectorBuilder) {
|
|
74
|
+
* return {
|
|
75
|
+
* options: build(Options, {
|
|
76
|
+
* email: { type: "text", label: "Apple ID Email", default: "" },
|
|
77
|
+
* password: { type: "text", label: "App-Specific Password", secure: true, default: "" },
|
|
78
|
+
* }),
|
|
79
|
+
*
|
|
80
|
+
* imap: build(Imap, { hosts: ["imap.mail.me.com"] }),
|
|
81
|
+
* smtp: build(Smtp, { hosts: ["smtp.mail.me.com"] }),
|
|
82
|
+
* integrations: build(Integrations),
|
|
83
|
+
* };
|
|
84
|
+
* }
|
|
85
|
+
*
|
|
86
|
+
* async sendReply(originalMessage: ImapMessage, replyBody: string) {
|
|
87
|
+
* const session = await this.tools.smtp.connect({
|
|
88
|
+
* host: "smtp.mail.me.com",
|
|
89
|
+
* port: 587,
|
|
90
|
+
* tls: false,
|
|
91
|
+
* starttls: true,
|
|
92
|
+
* username: this.tools.options.email,
|
|
93
|
+
* password: this.tools.options.password,
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* try {
|
|
97
|
+
* const result = await this.tools.smtp.send(session, {
|
|
98
|
+
* from: { address: this.tools.options.email },
|
|
99
|
+
* to: originalMessage.from ?? [],
|
|
100
|
+
* subject: `Re: ${originalMessage.subject ?? "(no subject)"}`,
|
|
101
|
+
* text: replyBody,
|
|
102
|
+
* inReplyTo: originalMessage.messageId,
|
|
103
|
+
* references: [
|
|
104
|
+
* ...(originalMessage.references ?? []),
|
|
105
|
+
* ...(originalMessage.messageId ? [originalMessage.messageId] : []),
|
|
106
|
+
* ],
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* console.log(`Sent reply, Message-ID: ${result.messageId}`);
|
|
110
|
+
* } finally {
|
|
111
|
+
* await this.tools.smtp.disconnect(session);
|
|
112
|
+
* }
|
|
113
|
+
* }
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export declare abstract class Smtp extends ITool {
|
|
118
|
+
static readonly Options: {
|
|
119
|
+
/** SMTP server hostnames this tool is allowed to connect to. */
|
|
120
|
+
hosts: string[];
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Opens a connection to an SMTP server and authenticates.
|
|
124
|
+
*
|
|
125
|
+
* Handles the full SMTP handshake: greeting, EHLO, optional STARTTLS
|
|
126
|
+
* upgrade, and AUTH LOGIN authentication.
|
|
127
|
+
*
|
|
128
|
+
* @param options - Server address, port, TLS/STARTTLS setting, and credentials
|
|
129
|
+
* @returns An opaque session handle for subsequent operations
|
|
130
|
+
* @throws If the host is not in the declared hosts list, connection fails, or auth fails
|
|
131
|
+
*/
|
|
132
|
+
abstract connect(options: SmtpConnectOptions): Promise<SmtpSession>;
|
|
133
|
+
/**
|
|
134
|
+
* Sends an email message.
|
|
135
|
+
*
|
|
136
|
+
* Constructs a properly formatted RFC 2822 message with MIME support
|
|
137
|
+
* and sends it via the SMTP protocol. Handles multipart messages when
|
|
138
|
+
* both text and HTML bodies are provided.
|
|
139
|
+
*
|
|
140
|
+
* @param session - Session handle from connect()
|
|
141
|
+
* @param message - The email message to send
|
|
142
|
+
* @returns Send result with Message-ID and per-recipient acceptance status
|
|
143
|
+
* @throws If the session is invalid or the server rejects the message entirely
|
|
144
|
+
*/
|
|
145
|
+
abstract send(session: SmtpSession, message: SmtpMessage): Promise<SmtpSendResult>;
|
|
146
|
+
/**
|
|
147
|
+
* Closes the SMTP connection.
|
|
148
|
+
*
|
|
149
|
+
* Always call this when done, preferably in a finally block.
|
|
150
|
+
*
|
|
151
|
+
* @param session - Session handle from connect()
|
|
152
|
+
*/
|
|
153
|
+
abstract disconnect(session: SmtpSession): Promise<void>;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=smtp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smtp.d.ts","sourceRoot":"","sources":["../../src/tools/smtp.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,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,GAAG,EAAE,OAAO,CAAC;IACb,iEAAiE;IACjE,QAAQ,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,mDAAmD;AACnD,MAAM,MAAM,WAAW,GAAG;IACxB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,gCAAgC;AAChC,MAAM,MAAM,WAAW,GAAG;IACxB,qBAAqB;IACrB,IAAI,EAAE,WAAW,CAAC;IAClB,yBAAyB;IACzB,EAAE,EAAE,WAAW,EAAE,CAAC;IAClB,6BAA6B;IAC7B,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC;IACnB,4DAA4D;IAC5D,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC;IACpB,gDAAgD;IAChD,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,kCAAkC;AAClC,MAAM,MAAM,cAAc,GAAG;IAC3B,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uDAAuD;IACvD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,8BAAsB,IAAK,SAAQ,KAAK;IACtC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;QACvB,gEAAgE;QAChE,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IAEF;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;IAEnE;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,IAAI,CACX,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,cAAc,CAAC;IAE1B;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CACzD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ITool } from "..";
|
|
2
|
+
/**
|
|
3
|
+
* Built-in tool for SMTP email sending.
|
|
4
|
+
*
|
|
5
|
+
* Provides high-level SMTP operations for composing and sending email.
|
|
6
|
+
* Handles TCP/TLS connections, STARTTLS upgrades, SMTP protocol details,
|
|
7
|
+
* and RFC 2822 message formatting internally.
|
|
8
|
+
*
|
|
9
|
+
* **Permission model:** Connectors declare which SMTP 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
|
+
* smtp: build(Smtp, { hosts: ["smtp.mail.me.com"] }),
|
|
24
|
+
* integrations: build(Integrations),
|
|
25
|
+
* };
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* async sendReply(originalMessage: ImapMessage, replyBody: string) {
|
|
29
|
+
* const session = await this.tools.smtp.connect({
|
|
30
|
+
* host: "smtp.mail.me.com",
|
|
31
|
+
* port: 587,
|
|
32
|
+
* tls: false,
|
|
33
|
+
* starttls: true,
|
|
34
|
+
* username: this.tools.options.email,
|
|
35
|
+
* password: this.tools.options.password,
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* try {
|
|
39
|
+
* const result = await this.tools.smtp.send(session, {
|
|
40
|
+
* from: { address: this.tools.options.email },
|
|
41
|
+
* to: originalMessage.from ?? [],
|
|
42
|
+
* subject: `Re: ${originalMessage.subject ?? "(no subject)"}`,
|
|
43
|
+
* text: replyBody,
|
|
44
|
+
* inReplyTo: originalMessage.messageId,
|
|
45
|
+
* references: [
|
|
46
|
+
* ...(originalMessage.references ?? []),
|
|
47
|
+
* ...(originalMessage.messageId ? [originalMessage.messageId] : []),
|
|
48
|
+
* ],
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* console.log(`Sent reply, Message-ID: ${result.messageId}`);
|
|
52
|
+
* } finally {
|
|
53
|
+
* await this.tools.smtp.disconnect(session);
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export class Smtp extends ITool {
|
|
60
|
+
static Options;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=smtp.js.map
|