@plotday/twister 0.42.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 +60 -20
- 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/tag.Tag.html +2 -1
- package/dist/docs/enums/tools_ai.AIModel.html +3 -4
- 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/interfaces/tools_ai.AIRequest.html +12 -12
- package/dist/docs/interfaces/tools_ai.AIResponse.html +9 -9
- package/dist/docs/interfaces/tools_ai.FilePart.html +5 -5
- package/dist/docs/interfaces/tools_ai.ImagePart.html +4 -4
- package/dist/docs/interfaces/tools_ai.ReasoningPart.html +4 -4
- package/dist/docs/interfaces/tools_ai.RedactedReasoningPart.html +3 -3
- package/dist/docs/interfaces/tools_ai.TextPart.html +3 -3
- package/dist/docs/interfaces/tools_ai.ToolCallPart.html +5 -5
- package/dist/docs/interfaces/tools_ai.ToolExecutionOptions.html +4 -4
- package/dist/docs/interfaces/tools_ai.ToolResultPart.html +5 -5
- 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 +9 -3
- 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 +4 -2
- 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 +7 -0
- package/dist/docs/types/plot.ThreadUpdate.html +1 -1
- package/dist/docs/types/plot.ThreadWithNotes.html +1 -1
- package/dist/docs/types/tools_ai.AIAssistantMessage.html +2 -2
- package/dist/docs/types/tools_ai.AIMessage.html +1 -1
- package/dist/docs/types/tools_ai.AISource.html +1 -1
- package/dist/docs/types/tools_ai.AISystemMessage.html +2 -2
- package/dist/docs/types/tools_ai.AITool.html +1 -1
- package/dist/docs/types/tools_ai.AIToolMessage.html +2 -2
- package/dist/docs/types/tools_ai.AIToolSet.html +1 -1
- package/dist/docs/types/tools_ai.AIUsage.html +5 -5
- package/dist/docs/types/tools_ai.AIUserMessage.html +2 -2
- package/dist/docs/types/tools_ai.DataContent.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/tag.d.ts +1 -1
- package/dist/llm-docs/tag.d.ts.map +1 -1
- package/dist/llm-docs/tag.js +1 -1
- package/dist/llm-docs/tag.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/ai.d.ts +1 -1
- package/dist/llm-docs/tools/ai.d.ts.map +1 -1
- package/dist/llm-docs/tools/ai.js +1 -1
- package/dist/llm-docs/tools/ai.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 +152 -19
- package/dist/plot.d.ts.map +1 -1
- package/dist/plot.js +2 -0
- package/dist/plot.js.map +1 -1
- package/dist/tag.d.ts +2 -1
- package/dist/tag.d.ts.map +1 -1
- package/dist/tag.js +1 -0
- package/dist/tag.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/ai.d.ts +3 -4
- package/dist/tools/ai.d.ts.map +1 -1
- package/dist/tools/ai.js +3 -4
- package/dist/tools/ai.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 +96 -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
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":["../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AC;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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smtp.js","sourceRoot":"","sources":["../../src/tools/smtp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAiE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,MAAM,OAAgB,IAAK,SAAQ,KAAK;IACtC,MAAM,CAAU,OAAO,CAGrB;CAuCH"}
|
package/dist/twist.d.ts
CHANGED
|
@@ -105,7 +105,16 @@ export declare abstract class Twist<TSelf> {
|
|
|
105
105
|
*/
|
|
106
106
|
protected deleteAllCallbacks(): Promise<void>;
|
|
107
107
|
/**
|
|
108
|
-
* Executes a callback by its token.
|
|
108
|
+
* Executes a callback by its token inline in the current execution.
|
|
109
|
+
*
|
|
110
|
+
* **Use `this.runTask()` instead for batch continuations and long-running work.**
|
|
111
|
+
* `this.run()` executes inline, sharing the current request count (~1000 limit)
|
|
112
|
+
* and blocking the HTTP response. This causes timeouts when used in lifecycle
|
|
113
|
+
* methods like `onChannelEnabled` or `syncBatch` continuations.
|
|
114
|
+
*
|
|
115
|
+
* `this.run()` is appropriate when you need the callback's **return value** —
|
|
116
|
+
* e.g., running a parent callback token that returns data. For fire-and-forget
|
|
117
|
+
* work, always prefer `this.runTask()`.
|
|
109
118
|
*
|
|
110
119
|
* @param token - The callback token to execute
|
|
111
120
|
* @param args - Optional arguments to pass to the callback
|
|
@@ -259,9 +268,14 @@ export declare abstract class Twist<TSelf> {
|
|
|
259
268
|
*
|
|
260
269
|
* Notes created by the twist itself are filtered out to prevent loops.
|
|
261
270
|
*
|
|
271
|
+
* Returning a string sets the note's `key` for future upsert matching,
|
|
272
|
+
* linking the Plot note to its external counterpart so that subsequent
|
|
273
|
+
* syncs (reactions, edits) update the existing note instead of creating duplicates.
|
|
274
|
+
*
|
|
262
275
|
* @param note - The newly created note
|
|
276
|
+
* @returns Optional note key for external deduplication
|
|
263
277
|
*/
|
|
264
|
-
onNoteCreated(note: Note, ...args: any[]): Promise<void>;
|
|
278
|
+
onNoteCreated(note: Note, ...args: any[]): Promise<string | void>;
|
|
265
279
|
/**
|
|
266
280
|
* Called when a link is created in a connected source channel.
|
|
267
281
|
* Requires `link: true` in Plot options.
|
package/dist/twist.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twist.d.ts","sourceRoot":"","sources":["../src/twist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,KAAK,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACvH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,8BAAsB,KAAK,CAAC,KAAK;IACnB,SAAS,CAAC,EAAE,EAAE,IAAI;IAAE,OAAO,CAAC,QAAQ;gBAA1B,EAAE,EAAE,IAAI,EAAU,QAAQ,EAAE,QAAQ;IAE1D;;;OAGG;IACH,SAAS,KAAK,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,CAEvC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAElE;;;;;;;;;;;;;OAaG;IACH,SA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executes a callback by its token.
|
|
82
|
+
* Executes a callback by its token inline in the current execution.
|
|
83
|
+
*
|
|
84
|
+
* **Use `this.runTask()` instead for batch continuations and long-running work.**
|
|
85
|
+
* `this.run()` executes inline, sharing the current request count (~1000 limit)
|
|
86
|
+
* and blocking the HTTP response. This causes timeouts when used in lifecycle
|
|
87
|
+
* methods like `onChannelEnabled` or `syncBatch` continuations.
|
|
88
|
+
*
|
|
89
|
+
* `this.run()` is appropriate when you need the callback's **return value** —
|
|
90
|
+
* e.g., running a parent callback token that returns data. For fire-and-forget
|
|
91
|
+
* work, always prefer `this.runTask()`.
|
|
83
92
|
*
|
|
84
93
|
* @param token - The callback token to execute
|
|
85
94
|
* @param args - Optional arguments to pass to the callback
|
|
@@ -255,7 +264,12 @@ export class Twist {
|
|
|
255
264
|
*
|
|
256
265
|
* Notes created by the twist itself are filtered out to prevent loops.
|
|
257
266
|
*
|
|
267
|
+
* Returning a string sets the note's `key` for future upsert matching,
|
|
268
|
+
* linking the Plot note to its external counterpart so that subsequent
|
|
269
|
+
* syncs (reactions, edits) update the existing note instead of creating duplicates.
|
|
270
|
+
*
|
|
258
271
|
* @param note - The newly created note
|
|
272
|
+
* @returns Optional note key for external deduplication
|
|
259
273
|
*/
|
|
260
274
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
261
275
|
onNoteCreated(note, ...args) {
|
package/dist/twist.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twist.js","sourceRoot":"","sources":["../src/twist.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAgB,KAAK;IACH;IAAkB;IAAxC,YAAsB,EAAQ,EAAU,QAAkB;QAApC,OAAE,GAAF,EAAE,CAAM;QAAU,aAAQ,GAAR,QAAQ,CAAU;IAAG,CAAC;IAE9D;;;OAGG;IACH,IAAc,KAAK;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAqB,C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A6D;IAC7D,aAAa,CAAC,IAAU,EAAE,KAAc;QACtC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACH,6DAA6D;IAC7D,iBAAiB,CAAC,IAAU,EAAE,IAAU;QACtC,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plotday/twister",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"description": "Plot Twist Creator - Build intelligent extensions that integrate and automate",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -89,6 +89,16 @@
|
|
|
89
89
|
"types": "./dist/tools/store.d.ts",
|
|
90
90
|
"default": "./dist/tools/store.js"
|
|
91
91
|
},
|
|
92
|
+
"./tools/imap": {
|
|
93
|
+
"@plotday/connector": "./src/tools/imap.ts",
|
|
94
|
+
"types": "./dist/tools/imap.d.ts",
|
|
95
|
+
"default": "./dist/tools/imap.js"
|
|
96
|
+
},
|
|
97
|
+
"./tools/smtp": {
|
|
98
|
+
"@plotday/connector": "./src/tools/smtp.ts",
|
|
99
|
+
"types": "./dist/tools/smtp.d.ts",
|
|
100
|
+
"default": "./dist/tools/smtp.js"
|
|
101
|
+
},
|
|
92
102
|
"./utils/types": {
|
|
93
103
|
"@plotday/connector": "./src/utils/types.ts",
|
|
94
104
|
"types": "./dist/utils/types.d.ts",
|
|
@@ -179,6 +189,16 @@
|
|
|
179
189
|
"types": "./dist/llm-docs/tools/store.d.ts",
|
|
180
190
|
"default": "./dist/llm-docs/tools/store.js"
|
|
181
191
|
},
|
|
192
|
+
"./llm-docs/tools/imap": {
|
|
193
|
+
"@plotday/connector": "./src/llm-docs/tools/imap.ts",
|
|
194
|
+
"types": "./dist/llm-docs/tools/imap.d.ts",
|
|
195
|
+
"default": "./dist/llm-docs/tools/imap.js"
|
|
196
|
+
},
|
|
197
|
+
"./llm-docs/tools/smtp": {
|
|
198
|
+
"@plotday/connector": "./src/llm-docs/tools/smtp.ts",
|
|
199
|
+
"types": "./dist/llm-docs/tools/smtp.d.ts",
|
|
200
|
+
"default": "./dist/llm-docs/tools/smtp.js"
|
|
201
|
+
},
|
|
182
202
|
"./tsconfig.base.json": "./tsconfig.base.json"
|
|
183
203
|
},
|
|
184
204
|
"files": [
|