@ozaiya/openclaw-channel 0.10.37 → 0.10.38
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/dist/src/botEmail.d.ts +85 -0
- package/dist/src/botEmail.js +713 -0
- package/dist/src/botEmail.js.map +1 -0
- package/dist/src/channel.js +159 -0
- package/dist/src/channel.js.map +1 -1
- package/dist/src/desktopContainer.d.ts +0 -1
- package/dist/src/gateway.js +24 -6
- package/dist/src/gateway.js.map +1 -1
- package/dist/src/mailCompose.d.ts +40 -0
- package/dist/src/mailCompose.js +50 -0
- package/dist/src/mailCompose.js.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ChannelAgentTool } from "openclaw/plugin-sdk";
|
|
2
|
+
import type { ResolvedOzaiyaAccount } from "./types.js";
|
|
3
|
+
export interface MailServer {
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
secure: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** One mailbox as the server delivers it (channels.ozaiya.addons.email.accounts[]). */
|
|
9
|
+
export interface MailboxConfig {
|
|
10
|
+
id: string;
|
|
11
|
+
email: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
senderName?: string;
|
|
14
|
+
user?: string;
|
|
15
|
+
imap: MailServer;
|
|
16
|
+
smtp: MailServer;
|
|
17
|
+
receiveOnly?: boolean;
|
|
18
|
+
/** `{"password": "…"}` sealed to the bot's public key (ephemeral key + nonce + box, base64). */
|
|
19
|
+
sealed: string;
|
|
20
|
+
}
|
|
21
|
+
export interface EmailAddonConfig {
|
|
22
|
+
accounts?: MailboxConfig[];
|
|
23
|
+
/** A reply to someone who wrote to the mailbox goes out without a card (writing to anyone new always asks). */
|
|
24
|
+
replyWithoutAsking?: boolean;
|
|
25
|
+
/** The owner's direct chat with the bot: approval cards and new-mail notices go there. */
|
|
26
|
+
ownerGroupId?: string;
|
|
27
|
+
}
|
|
28
|
+
/** The add-on's config when the bot has at least one mailbox. */
|
|
29
|
+
export declare function emailAddonOf(account: ResolvedOzaiyaAccount): EmailAddonConfig | null;
|
|
30
|
+
/** "Your own email address…" for the agent's system prompt, or null without a mailbox. */
|
|
31
|
+
export declare function emailIdentityLine(addons: Record<string, Record<string, unknown>> | undefined): string | null;
|
|
32
|
+
export declare function parseMailServer(value: unknown): MailServer | undefined;
|
|
33
|
+
/** Why a mail server connection or login failed, in terms the owner can act on. */
|
|
34
|
+
export type MailFailureReason = "auth" | "blocked" | "timeout" | "notFound" | "refused" | "tls" | "other";
|
|
35
|
+
export interface MailFailure {
|
|
36
|
+
stage: "imap" | "smtp";
|
|
37
|
+
reason: MailFailureReason;
|
|
38
|
+
/** host:port */
|
|
39
|
+
server: string;
|
|
40
|
+
error: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Sort an imapflow / nodemailer failure. "blocked" is a connection cut off before TLS was set up —
|
|
44
|
+
* what a VPN or proxy node that drops mail ports looks like (Clash in global mode, for one).
|
|
45
|
+
*/
|
|
46
|
+
export declare function classifyMailError(e: unknown): MailFailureReason;
|
|
47
|
+
export declare function describeMailFailure(failure: MailFailure): string;
|
|
48
|
+
/**
|
|
49
|
+
* The `email-check` gateway RPC: sign in to a mailbox the owner is adding — its password sealed to
|
|
50
|
+
* the bot's key — from this gateway's network, before the app saves it. A failure says which server
|
|
51
|
+
* and why; when only sending failed it can still be kept for reading (`canReceiveOnly`).
|
|
52
|
+
*/
|
|
53
|
+
export declare function checkNewMailbox(input: Record<string, unknown>, botPrivateKey: Uint8Array): Promise<Record<string, unknown>>;
|
|
54
|
+
export interface BotEmailToolDeps {
|
|
55
|
+
/** True when the turn calling the tool is the owner's own chat with the bot (and nothing else is running). */
|
|
56
|
+
inOwnerChat: () => boolean;
|
|
57
|
+
/** Show an approval card in the owner's chat and wait for the answer (false on reject or no answer). */
|
|
58
|
+
askOwner: (label: string, params: Record<string, string>) => Promise<boolean>;
|
|
59
|
+
}
|
|
60
|
+
/** The `email` tool for a bot with the add-on: its own mailbox(es). */
|
|
61
|
+
export declare function createBotEmailTool(account: ResolvedOzaiyaAccount, config: EmailAddonConfig, deps: BotEmailToolDeps): ChannelAgentTool;
|
|
62
|
+
export interface NewMail {
|
|
63
|
+
uid: number;
|
|
64
|
+
from: string;
|
|
65
|
+
subject: string;
|
|
66
|
+
when: string;
|
|
67
|
+
}
|
|
68
|
+
export interface MailWatchDeps {
|
|
69
|
+
/** Where each mailbox remembers what it has already announced. */
|
|
70
|
+
stateDir: string;
|
|
71
|
+
onNewMail: (mailbox: {
|
|
72
|
+
id: string;
|
|
73
|
+
email: string;
|
|
74
|
+
}, mails: NewMail[]) => Promise<void>;
|
|
75
|
+
log: {
|
|
76
|
+
info: (msg: string) => void;
|
|
77
|
+
warn: (msg: string) => void;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** What the agent is told when new mail reaches its mailbox (the turn runs in the owner's chat). */
|
|
81
|
+
export declare function newMailNotice(mailbox: {
|
|
82
|
+
email: string;
|
|
83
|
+
}, mails: NewMail[], replyWithoutAsking: boolean): string;
|
|
84
|
+
/** Watch every mailbox of a bot with the add-on; the returned function stops it all. */
|
|
85
|
+
export declare function watchMailboxes(account: ResolvedOzaiyaAccount, deps: MailWatchDeps): () => void;
|