@alfe.ai/openclaw-email 0.0.0-stage → 0.1.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/README.md +13 -2
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/plugin.cjs +8 -0
- package/dist/plugin.d.cts +196 -0
- package/dist/plugin.d.cts.map +1 -0
- package/dist/plugin.d.ts +196 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +2 -0
- package/dist/plugin2.cjs +1795 -0
- package/dist/plugin2.d.cts +2 -0
- package/dist/plugin2.d.ts +2 -0
- package/dist/plugin2.js +1780 -0
- package/dist/plugin2.js.map +1 -0
- package/openclaw.plugin.json +32 -0
- package/package.json +64 -3
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @alfe.ai/openclaw-email
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
OpenClaw channel plugin that lets people chat with an Alfe agent over email.
|
|
4
|
+
It polls the agent's connected Gmail or Outlook mailbox, admits senders that
|
|
5
|
+
hold `agent:chat` on the agent, runs one OpenClaw session per email thread, and
|
|
6
|
+
replies in the same thread. A sender whose mail passed DMARC gets a reply-all
|
|
7
|
+
(at most 20 recipients); an unverified sender gets a reply to the sender only.
|
|
8
|
+
|
|
9
|
+
- Requires OpenClaw 2026.9.5 or later.
|
|
10
|
+
- Config (projected from the agent's Connect `email` Channel; not edited by
|
|
11
|
+
hand): `{ "channelId": "...", "connectionId": "..." }`.
|
|
12
|
+
- State: `<stateDir>/email/<mailboxHash>.json`.
|
|
13
|
+
|
|
14
|
+
See `DEVELOPING.md` for the delivery and security contract.
|
package/dist/index.cjs
ADDED
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/plugin.cjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_plugin = require("./plugin2.cjs");
|
|
6
|
+
exports.PLUGIN_ID = require_plugin.PLUGIN_ID;
|
|
7
|
+
exports.default = require_plugin.plugin_default;
|
|
8
|
+
exports.parsePluginConfig = require_plugin.parsePluginConfig;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* OpenClaw SDK shapes used by the plugin, declared inline so the package does
|
|
4
|
+
* not import OpenClaw at build time. Verified against the 2026.9.5 dist
|
|
5
|
+
* (`channel-inbound-*.d.ts` `DispatchInboundDirectDmParams`, `envelope-*.mjs`).
|
|
6
|
+
*/
|
|
7
|
+
interface Logger {
|
|
8
|
+
info(msg: string, ...args: unknown[]): void;
|
|
9
|
+
warn(msg: string, ...args: unknown[]): void;
|
|
10
|
+
error(msg: string, ...args: unknown[]): void;
|
|
11
|
+
debug(msg: string, ...args: unknown[]): void;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/status.d.ts
|
|
15
|
+
|
|
16
|
+
type ChannelState = 'starting' | 'ok' | 'error' | 'stopped';
|
|
17
|
+
/**
|
|
18
|
+
* `reconnect`: the user must reconnect the mailbox (revoked consent, missing scope).
|
|
19
|
+
* `agent-auth`: the Agent API rejected this agent's own token.
|
|
20
|
+
*/
|
|
21
|
+
type ChannelErrorReason = 'reconnect' | 'agent-auth' | 'config' | 'unsupported-runtime';
|
|
22
|
+
/** Which path raised the error; only a success on the same path clears it. */
|
|
23
|
+
type ErrorSource = 'poll' | 'send';
|
|
24
|
+
interface ChannelStatusSnapshot {
|
|
25
|
+
state: ChannelState;
|
|
26
|
+
reason?: ChannelErrorReason;
|
|
27
|
+
message?: string;
|
|
28
|
+
source?: ErrorSource;
|
|
29
|
+
lastMessageAt: number | null;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/outbound.d.ts
|
|
33
|
+
|
|
34
|
+
type SendOutcome = {
|
|
35
|
+
kind: 'sent';
|
|
36
|
+
messageId: string;
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'empty';
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'duplicate';
|
|
41
|
+
} | {
|
|
42
|
+
kind: 'capped';
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'no-recipients';
|
|
45
|
+
};
|
|
46
|
+
/** Collects a turn's reply payloads. */
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/channel.d.ts
|
|
49
|
+
declare const CHANNEL_ID = "email";
|
|
50
|
+
/** What the channel needs from the running plugin. */
|
|
51
|
+
interface EmailChannelHandle {
|
|
52
|
+
status(): ChannelStatusSnapshot;
|
|
53
|
+
/** True when this mailbox has a conversation for the thread hash. */
|
|
54
|
+
hasThread(hash: string): boolean;
|
|
55
|
+
sendToThread(to: string, text: string): Promise<SendOutcome>;
|
|
56
|
+
}
|
|
57
|
+
interface OutboundDeliveryResult {
|
|
58
|
+
channel: typeof CHANNEL_ID;
|
|
59
|
+
messageId: string;
|
|
60
|
+
target: {
|
|
61
|
+
kind: 'conversation';
|
|
62
|
+
id: string;
|
|
63
|
+
};
|
|
64
|
+
timestamp: number;
|
|
65
|
+
}
|
|
66
|
+
declare function createEmailChannelPlugin(getHandle: () => EmailChannelHandle | null): {
|
|
67
|
+
id: string;
|
|
68
|
+
meta: {
|
|
69
|
+
id: string;
|
|
70
|
+
label: string;
|
|
71
|
+
selectionLabel: string;
|
|
72
|
+
detailLabel: string;
|
|
73
|
+
docsPath: string;
|
|
74
|
+
docsLabel: string;
|
|
75
|
+
blurb: string;
|
|
76
|
+
systemImage: string;
|
|
77
|
+
order: number;
|
|
78
|
+
forceAccountBinding: boolean;
|
|
79
|
+
showConfigured: boolean;
|
|
80
|
+
};
|
|
81
|
+
capabilities: {
|
|
82
|
+
chatTypes: "direct"[];
|
|
83
|
+
reactions: boolean;
|
|
84
|
+
edit: boolean;
|
|
85
|
+
unsend: boolean;
|
|
86
|
+
reply: boolean;
|
|
87
|
+
effects: boolean;
|
|
88
|
+
groupManagement: boolean;
|
|
89
|
+
threads: boolean;
|
|
90
|
+
media: boolean;
|
|
91
|
+
nativeCommands: boolean;
|
|
92
|
+
polls: boolean;
|
|
93
|
+
};
|
|
94
|
+
config: {
|
|
95
|
+
listAccountIds(): string[];
|
|
96
|
+
resolveAccount(_cfg: unknown, accountId?: string | null): {
|
|
97
|
+
accountId: string;
|
|
98
|
+
enabled: boolean;
|
|
99
|
+
};
|
|
100
|
+
defaultAccountId(): string;
|
|
101
|
+
isEnabled(): boolean;
|
|
102
|
+
isConfigured(): boolean;
|
|
103
|
+
describeAccount(account: {
|
|
104
|
+
accountId: string;
|
|
105
|
+
}): {
|
|
106
|
+
lastError: string | null;
|
|
107
|
+
lastMessageAt: number | null;
|
|
108
|
+
stateReason?: ChannelErrorReason | undefined;
|
|
109
|
+
accountId: string;
|
|
110
|
+
enabled: boolean;
|
|
111
|
+
configured: boolean;
|
|
112
|
+
running: boolean;
|
|
113
|
+
statusState: ChannelState;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
outbound: {
|
|
117
|
+
deliveryMode: "direct";
|
|
118
|
+
textChunkLimit: number;
|
|
119
|
+
resolveTarget(params: {
|
|
120
|
+
to?: string;
|
|
121
|
+
}): {
|
|
122
|
+
ok: true;
|
|
123
|
+
to: string;
|
|
124
|
+
} | {
|
|
125
|
+
ok: false;
|
|
126
|
+
error: Error;
|
|
127
|
+
};
|
|
128
|
+
sendText(ctx: {
|
|
129
|
+
to: string;
|
|
130
|
+
text: string;
|
|
131
|
+
}): Promise<OutboundDeliveryResult>;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/runtime-config.d.ts
|
|
136
|
+
/**
|
|
137
|
+
* Read the live OpenClaw config through the plugin runtime.
|
|
138
|
+
*
|
|
139
|
+
* OpenClaw 2026.9.x replaced `runtime.config.loadConfig()` with
|
|
140
|
+
* `runtime.config.current()`; 2026.6.11 exposes only `loadConfig()`. On 9.5
|
|
141
|
+
* `current()` returns the process-wide pinned config object BY REFERENCE (not a
|
|
142
|
+
* copy, not frozen): treat the result as read-only, mutating it corrupts config
|
|
143
|
+
* for every plugin in the process. Both verified on the dists (2026-09-21). A managed
|
|
144
|
+
* fleet is mixed across a runtime upgrade, so support both shapes.
|
|
145
|
+
*
|
|
146
|
+
* Kept local rather than in `@alfe.ai/openclaw-plugin-kit`: a kit release fans
|
|
147
|
+
* out to every plugin package and its manifest pin.
|
|
148
|
+
*/
|
|
149
|
+
interface RuntimeConfigApi {
|
|
150
|
+
current?: () => unknown;
|
|
151
|
+
loadConfig?: () => Record<string, unknown>;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/plugin.d.ts
|
|
155
|
+
declare const PLUGIN_ID = "@alfe.ai/openclaw-email";
|
|
156
|
+
interface PluginRuntime {
|
|
157
|
+
version?: unknown;
|
|
158
|
+
config: RuntimeConfigApi;
|
|
159
|
+
channel: unknown;
|
|
160
|
+
state?: {
|
|
161
|
+
resolveStateDir?: () => string;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
interface PluginServiceContext {
|
|
165
|
+
stateDir?: string;
|
|
166
|
+
logger?: Logger;
|
|
167
|
+
}
|
|
168
|
+
interface PluginApi {
|
|
169
|
+
logger: Logger;
|
|
170
|
+
registrationMode?: 'full' | 'setup-only' | 'setup-runtime' | 'cli-metadata';
|
|
171
|
+
pluginConfig?: unknown;
|
|
172
|
+
runtime?: PluginRuntime;
|
|
173
|
+
registerChannel(channel: ReturnType<typeof createEmailChannelPlugin>): void;
|
|
174
|
+
registerService(service: {
|
|
175
|
+
id: string;
|
|
176
|
+
start: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
177
|
+
stop?: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
178
|
+
}): void;
|
|
179
|
+
}
|
|
180
|
+
interface EmailPluginConfig {
|
|
181
|
+
channelId: string;
|
|
182
|
+
connectionId: string;
|
|
183
|
+
}
|
|
184
|
+
declare function parsePluginConfig(value: unknown): EmailPluginConfig | null;
|
|
185
|
+
declare const _default: {
|
|
186
|
+
register: (api: PluginApi) => void;
|
|
187
|
+
id: string;
|
|
188
|
+
name: string;
|
|
189
|
+
description: string;
|
|
190
|
+
version: string;
|
|
191
|
+
activate(api: PluginApi): void;
|
|
192
|
+
deactivate(api: PluginApi): Promise<void>;
|
|
193
|
+
};
|
|
194
|
+
//#endregion
|
|
195
|
+
export { parsePluginConfig as a, _default as i, PLUGIN_ID as n, PluginApi as r, EmailPluginConfig as t };
|
|
196
|
+
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/types.ts","../src/status.ts","../src/outbound.ts","../src/channel.ts","../src/runtime-config.ts","../src/plugin.ts"],"mappings":";;AAMA;;;;ACIY,UDJK,MAAA,CCIO;EAKZ,IAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAkB,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA;EAGlB,IAAA,CAAA,GAAA,EAAA,MAAW,EAAA,GAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA;EAEN,KAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAA,IAAqB,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA;EAAA,KAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA;;;;;AAAA,KAV1B,YAAA,GAU0B,UAAA,GAAA,IAAA,GAAA,OAAA,GAAA,SAAA;;;;;KAL1B,kBAAA;;KAGA,WAAA;ACmCA,UDjCK,qBAAA,CCiCM;SDhCd;WACE;;EETE,MAAA,CAAA,EFWF,WEXY;EAIN,aAAA,E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,EAuE7B,SAvE6B,EAAA,GAAA,IAAA;MAAlB,MAAA;MAGV,EAAA,MAAA;aAAgC,EAAA,MAAA;SAChC,EAAA,MAAA;UAAgC,CAAA,GAAA,EAmEjC,SAnEiC,CAAA,EAAA,IAAA;EAAO,UAAA,CAAA,GAAA,EA8FhC,SA9FgC,CAAA,EA8FvB,OA9FuB,CAAA,IAAA,CAAA;AAIxD,CAAA"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* OpenClaw SDK shapes used by the plugin, declared inline so the package does
|
|
4
|
+
* not import OpenClaw at build time. Verified against the 2026.9.5 dist
|
|
5
|
+
* (`channel-inbound-*.d.ts` `DispatchInboundDirectDmParams`, `envelope-*.mjs`).
|
|
6
|
+
*/
|
|
7
|
+
interface Logger {
|
|
8
|
+
info(msg: string, ...args: unknown[]): void;
|
|
9
|
+
warn(msg: string, ...args: unknown[]): void;
|
|
10
|
+
error(msg: string, ...args: unknown[]): void;
|
|
11
|
+
debug(msg: string, ...args: unknown[]): void;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/status.d.ts
|
|
15
|
+
|
|
16
|
+
type ChannelState = 'starting' | 'ok' | 'error' | 'stopped';
|
|
17
|
+
/**
|
|
18
|
+
* `reconnect`: the user must reconnect the mailbox (revoked consent, missing scope).
|
|
19
|
+
* `agent-auth`: the Agent API rejected this agent's own token.
|
|
20
|
+
*/
|
|
21
|
+
type ChannelErrorReason = 'reconnect' | 'agent-auth' | 'config' | 'unsupported-runtime';
|
|
22
|
+
/** Which path raised the error; only a success on the same path clears it. */
|
|
23
|
+
type ErrorSource = 'poll' | 'send';
|
|
24
|
+
interface ChannelStatusSnapshot {
|
|
25
|
+
state: ChannelState;
|
|
26
|
+
reason?: ChannelErrorReason;
|
|
27
|
+
message?: string;
|
|
28
|
+
source?: ErrorSource;
|
|
29
|
+
lastMessageAt: number | null;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/outbound.d.ts
|
|
33
|
+
|
|
34
|
+
type SendOutcome = {
|
|
35
|
+
kind: 'sent';
|
|
36
|
+
messageId: string;
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'empty';
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'duplicate';
|
|
41
|
+
} | {
|
|
42
|
+
kind: 'capped';
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'no-recipients';
|
|
45
|
+
};
|
|
46
|
+
/** Collects a turn's reply payloads. */
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/channel.d.ts
|
|
49
|
+
declare const CHANNEL_ID = "email";
|
|
50
|
+
/** What the channel needs from the running plugin. */
|
|
51
|
+
interface EmailChannelHandle {
|
|
52
|
+
status(): ChannelStatusSnapshot;
|
|
53
|
+
/** True when this mailbox has a conversation for the thread hash. */
|
|
54
|
+
hasThread(hash: string): boolean;
|
|
55
|
+
sendToThread(to: string, text: string): Promise<SendOutcome>;
|
|
56
|
+
}
|
|
57
|
+
interface OutboundDeliveryResult {
|
|
58
|
+
channel: typeof CHANNEL_ID;
|
|
59
|
+
messageId: string;
|
|
60
|
+
target: {
|
|
61
|
+
kind: 'conversation';
|
|
62
|
+
id: string;
|
|
63
|
+
};
|
|
64
|
+
timestamp: number;
|
|
65
|
+
}
|
|
66
|
+
declare function createEmailChannelPlugin(getHandle: () => EmailChannelHandle | null): {
|
|
67
|
+
id: string;
|
|
68
|
+
meta: {
|
|
69
|
+
id: string;
|
|
70
|
+
label: string;
|
|
71
|
+
selectionLabel: string;
|
|
72
|
+
detailLabel: string;
|
|
73
|
+
docsPath: string;
|
|
74
|
+
docsLabel: string;
|
|
75
|
+
blurb: string;
|
|
76
|
+
systemImage: string;
|
|
77
|
+
order: number;
|
|
78
|
+
forceAccountBinding: boolean;
|
|
79
|
+
showConfigured: boolean;
|
|
80
|
+
};
|
|
81
|
+
capabilities: {
|
|
82
|
+
chatTypes: "direct"[];
|
|
83
|
+
reactions: boolean;
|
|
84
|
+
edit: boolean;
|
|
85
|
+
unsend: boolean;
|
|
86
|
+
reply: boolean;
|
|
87
|
+
effects: boolean;
|
|
88
|
+
groupManagement: boolean;
|
|
89
|
+
threads: boolean;
|
|
90
|
+
media: boolean;
|
|
91
|
+
nativeCommands: boolean;
|
|
92
|
+
polls: boolean;
|
|
93
|
+
};
|
|
94
|
+
config: {
|
|
95
|
+
listAccountIds(): string[];
|
|
96
|
+
resolveAccount(_cfg: unknown, accountId?: string | null): {
|
|
97
|
+
accountId: string;
|
|
98
|
+
enabled: boolean;
|
|
99
|
+
};
|
|
100
|
+
defaultAccountId(): string;
|
|
101
|
+
isEnabled(): boolean;
|
|
102
|
+
isConfigured(): boolean;
|
|
103
|
+
describeAccount(account: {
|
|
104
|
+
accountId: string;
|
|
105
|
+
}): {
|
|
106
|
+
lastError: string | null;
|
|
107
|
+
lastMessageAt: number | null;
|
|
108
|
+
stateReason?: ChannelErrorReason | undefined;
|
|
109
|
+
accountId: string;
|
|
110
|
+
enabled: boolean;
|
|
111
|
+
configured: boolean;
|
|
112
|
+
running: boolean;
|
|
113
|
+
statusState: ChannelState;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
outbound: {
|
|
117
|
+
deliveryMode: "direct";
|
|
118
|
+
textChunkLimit: number;
|
|
119
|
+
resolveTarget(params: {
|
|
120
|
+
to?: string;
|
|
121
|
+
}): {
|
|
122
|
+
ok: true;
|
|
123
|
+
to: string;
|
|
124
|
+
} | {
|
|
125
|
+
ok: false;
|
|
126
|
+
error: Error;
|
|
127
|
+
};
|
|
128
|
+
sendText(ctx: {
|
|
129
|
+
to: string;
|
|
130
|
+
text: string;
|
|
131
|
+
}): Promise<OutboundDeliveryResult>;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/runtime-config.d.ts
|
|
136
|
+
/**
|
|
137
|
+
* Read the live OpenClaw config through the plugin runtime.
|
|
138
|
+
*
|
|
139
|
+
* OpenClaw 2026.9.x replaced `runtime.config.loadConfig()` with
|
|
140
|
+
* `runtime.config.current()`; 2026.6.11 exposes only `loadConfig()`. On 9.5
|
|
141
|
+
* `current()` returns the process-wide pinned config object BY REFERENCE (not a
|
|
142
|
+
* copy, not frozen): treat the result as read-only, mutating it corrupts config
|
|
143
|
+
* for every plugin in the process. Both verified on the dists (2026-09-21). A managed
|
|
144
|
+
* fleet is mixed across a runtime upgrade, so support both shapes.
|
|
145
|
+
*
|
|
146
|
+
* Kept local rather than in `@alfe.ai/openclaw-plugin-kit`: a kit release fans
|
|
147
|
+
* out to every plugin package and its manifest pin.
|
|
148
|
+
*/
|
|
149
|
+
interface RuntimeConfigApi {
|
|
150
|
+
current?: () => unknown;
|
|
151
|
+
loadConfig?: () => Record<string, unknown>;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/plugin.d.ts
|
|
155
|
+
declare const PLUGIN_ID = "@alfe.ai/openclaw-email";
|
|
156
|
+
interface PluginRuntime {
|
|
157
|
+
version?: unknown;
|
|
158
|
+
config: RuntimeConfigApi;
|
|
159
|
+
channel: unknown;
|
|
160
|
+
state?: {
|
|
161
|
+
resolveStateDir?: () => string;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
interface PluginServiceContext {
|
|
165
|
+
stateDir?: string;
|
|
166
|
+
logger?: Logger;
|
|
167
|
+
}
|
|
168
|
+
interface PluginApi {
|
|
169
|
+
logger: Logger;
|
|
170
|
+
registrationMode?: 'full' | 'setup-only' | 'setup-runtime' | 'cli-metadata';
|
|
171
|
+
pluginConfig?: unknown;
|
|
172
|
+
runtime?: PluginRuntime;
|
|
173
|
+
registerChannel(channel: ReturnType<typeof createEmailChannelPlugin>): void;
|
|
174
|
+
registerService(service: {
|
|
175
|
+
id: string;
|
|
176
|
+
start: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
177
|
+
stop?: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
178
|
+
}): void;
|
|
179
|
+
}
|
|
180
|
+
interface EmailPluginConfig {
|
|
181
|
+
channelId: string;
|
|
182
|
+
connectionId: string;
|
|
183
|
+
}
|
|
184
|
+
declare function parsePluginConfig(value: unknown): EmailPluginConfig | null;
|
|
185
|
+
declare const _default: {
|
|
186
|
+
register: (api: PluginApi) => void;
|
|
187
|
+
id: string;
|
|
188
|
+
name: string;
|
|
189
|
+
description: string;
|
|
190
|
+
version: string;
|
|
191
|
+
activate(api: PluginApi): void;
|
|
192
|
+
deactivate(api: PluginApi): Promise<void>;
|
|
193
|
+
};
|
|
194
|
+
//#endregion
|
|
195
|
+
export { parsePluginConfig as a, _default as i, PLUGIN_ID as n, PluginApi as r, EmailPluginConfig as t };
|
|
196
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","names":[],"sources":["../src/types.ts","../src/status.ts","../src/outbound.ts","../src/channel.ts","../src/runtime-config.ts","../src/plugin.ts"],"mappings":";;AAMA;;;;ACIY,UDJK,MAAA,CCIO;EAKZ,IAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAkB,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA;EAGlB,IAAA,CAAA,GAAA,EAAA,MAAW,EAAA,GAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA;EAEN,KAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAA,IAAqB,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA;EAAA,KAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA;;;;;AAAA,KAV1B,YAAA,GAU0B,UAAA,GAAA,IAAA,GAAA,OAAA,GAAA,SAAA;;;;;KAL1B,kBAAA;;KAGA,WAAA;ACmCA,UDjCK,qBAAA,CCiCM;SDhCd;WACE;;EETE,MAAA,CAAA,EFWF,WE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