@symerian/symi 3.0.20 → 3.0.21

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.
Files changed (52) hide show
  1. package/dist/{audio-preflight-BaCdNfrk.js → audio-preflight-D7BVT-ls.js} +4 -4
  2. package/dist/build-info.json +3 -3
  3. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  4. package/dist/{chrome-UfmVM0xR.js → chrome-B5CO2vB5.js} +7 -7
  5. package/dist/{deliver-BqXdac6W.js → deliver-CrwjsDwv.js} +1 -1
  6. package/dist/extensionAPI.js +7 -7
  7. package/dist/{image-DIWsXYcW.js → image-Csu7WcLW.js} +1 -1
  8. package/dist/{manager-DW3SxcPr.js → manager-BkkVjTO8.js} +1 -1
  9. package/dist/{pi-embedded-BNch0U5F.js → pi-embedded-Dhp64z5l.js} +16 -16
  10. package/dist/{pi-embedded-helpers-IkHl02JF.js → pi-embedded-helpers-840E4hop.js} +4 -4
  11. package/dist/{pw-ai-nMkA-oDJ.js → pw-ai-CBgJf_RR.js} +1 -1
  12. package/dist/{runner-DNEC58JI.js → runner-BbFKo1ne.js} +1 -1
  13. package/dist/{synthesis-BWAr0sZ9.js → synthesis-DoEM0E8_.js} +7 -7
  14. package/dist/{web-7a-m_UxL.js → web-BYXJn-Ps.js} +7 -7
  15. package/package.json +1 -1
  16. package/extensions/imessage/index.ts +0 -17
  17. package/extensions/imessage/node_modules/.bin/symi +0 -21
  18. package/extensions/imessage/package.json +0 -15
  19. package/extensions/imessage/src/channel.outbound.test.ts +0 -66
  20. package/extensions/imessage/src/channel.ts +0 -298
  21. package/extensions/imessage/src/runtime.ts +0 -14
  22. package/extensions/imessage/symi.plugin.json +0 -9
  23. package/extensions/line/index.ts +0 -19
  24. package/extensions/line/node_modules/.bin/symi +0 -21
  25. package/extensions/line/package.json +0 -30
  26. package/extensions/line/src/card-command.ts +0 -344
  27. package/extensions/line/src/channel.logout.test.ts +0 -133
  28. package/extensions/line/src/channel.sendPayload.test.ts +0 -312
  29. package/extensions/line/src/channel.startup.test.ts +0 -133
  30. package/extensions/line/src/channel.ts +0 -801
  31. package/extensions/line/src/runtime.ts +0 -14
  32. package/extensions/line/symi.plugin.json +0 -9
  33. package/extensions/signal/index.ts +0 -17
  34. package/extensions/signal/node_modules/.bin/symi +0 -21
  35. package/extensions/signal/package.json +0 -15
  36. package/extensions/signal/src/channel.ts +0 -302
  37. package/extensions/signal/src/runtime.ts +0 -14
  38. package/extensions/signal/symi.plugin.json +0 -9
  39. package/extensions/telegram/index.ts +0 -17
  40. package/extensions/telegram/node_modules/.bin/symi +0 -21
  41. package/extensions/telegram/package.json +0 -15
  42. package/extensions/telegram/src/channel.test.ts +0 -125
  43. package/extensions/telegram/src/channel.ts +0 -560
  44. package/extensions/telegram/src/runtime.ts +0 -14
  45. package/extensions/telegram/symi.plugin.json +0 -9
  46. package/extensions/whatsapp/index.ts +0 -17
  47. package/extensions/whatsapp/node_modules/.bin/symi +0 -21
  48. package/extensions/whatsapp/package.json +0 -15
  49. package/extensions/whatsapp/src/channel.ts +0 -465
  50. package/extensions/whatsapp/src/resolve-target.test.ts +0 -170
  51. package/extensions/whatsapp/src/runtime.ts +0 -14
  52. package/extensions/whatsapp/symi.plugin.json +0 -9
@@ -1,298 +0,0 @@
1
- import {
2
- applyAccountNameToChannelSection,
3
- buildChannelConfigSchema,
4
- DEFAULT_ACCOUNT_ID,
5
- deleteAccountFromConfigSection,
6
- formatPairingApproveHint,
7
- getChatChannelMeta,
8
- imessageOnboardingAdapter,
9
- IMessageConfigSchema,
10
- listIMessageAccountIds,
11
- looksLikeIMessageTargetId,
12
- migrateBaseNameToDefaultAccount,
13
- normalizeAccountId,
14
- normalizeIMessageMessagingTarget,
15
- PAIRING_APPROVED_MESSAGE,
16
- resolveChannelMediaMaxBytes,
17
- resolveDefaultIMessageAccountId,
18
- resolveIMessageAccount,
19
- resolveIMessageGroupRequireMention,
20
- resolveIMessageGroupToolPolicy,
21
- setAccountEnabledInConfigSection,
22
- type ChannelPlugin,
23
- type ResolvedIMessageAccount,
24
- } from "symi/plugin-sdk";
25
- import { getIMessageRuntime } from "./runtime.js";
26
-
27
- const meta = getChatChannelMeta("imessage");
28
-
29
- export const imessagePlugin: ChannelPlugin<ResolvedIMessageAccount> = {
30
- id: "imessage",
31
- meta: {
32
- ...meta,
33
- aliases: ["imsg"],
34
- showConfigured: false,
35
- },
36
- onboarding: imessageOnboardingAdapter,
37
- pairing: {
38
- idLabel: "imessageSenderId",
39
- notifyApproval: async ({ id }) => {
40
- await getIMessageRuntime().channel.imessage.sendMessageIMessage(id, PAIRING_APPROVED_MESSAGE);
41
- },
42
- },
43
- capabilities: {
44
- chatTypes: ["direct", "group"],
45
- media: true,
46
- },
47
- reload: { configPrefixes: ["channels.imessage"] },
48
- configSchema: buildChannelConfigSchema(IMessageConfigSchema),
49
- config: {
50
- listAccountIds: (cfg) => listIMessageAccountIds(cfg),
51
- resolveAccount: (cfg, accountId) => resolveIMessageAccount({ cfg, accountId }),
52
- defaultAccountId: (cfg) => resolveDefaultIMessageAccountId(cfg),
53
- setAccountEnabled: ({ cfg, accountId, enabled }) =>
54
- setAccountEnabledInConfigSection({
55
- cfg,
56
- sectionKey: "imessage",
57
- accountId,
58
- enabled,
59
- allowTopLevel: true,
60
- }),
61
- deleteAccount: ({ cfg, accountId }) =>
62
- deleteAccountFromConfigSection({
63
- cfg,
64
- sectionKey: "imessage",
65
- accountId,
66
- clearBaseFields: ["cliPath", "dbPath", "service", "region", "name"],
67
- }),
68
- isConfigured: (account) => account.configured,
69
- describeAccount: (account) => ({
70
- accountId: account.accountId,
71
- name: account.name,
72
- enabled: account.enabled,
73
- configured: account.configured,
74
- }),
75
- resolveAllowFrom: ({ cfg, accountId }) =>
76
- (resolveIMessageAccount({ cfg, accountId }).config.allowFrom ?? []).map((entry) =>
77
- String(entry),
78
- ),
79
- formatAllowFrom: ({ allowFrom }) =>
80
- allowFrom.map((entry) => String(entry).trim()).filter(Boolean),
81
- resolveDefaultTo: ({ cfg, accountId }) =>
82
- resolveIMessageAccount({ cfg, accountId }).config.defaultTo?.trim() || undefined,
83
- },
84
- security: {
85
- resolveDmPolicy: ({ cfg, accountId, account }) => {
86
- const resolvedAccountId = accountId ?? account.accountId ?? DEFAULT_ACCOUNT_ID;
87
- const useAccountPath = Boolean(cfg.channels?.imessage?.accounts?.[resolvedAccountId]);
88
- const basePath = useAccountPath
89
- ? `channels.imessage.accounts.${resolvedAccountId}.`
90
- : "channels.imessage.";
91
- return {
92
- policy: account.config.dmPolicy ?? "pairing",
93
- allowFrom: account.config.allowFrom ?? [],
94
- policyPath: `${basePath}dmPolicy`,
95
- allowFromPath: basePath,
96
- approveHint: formatPairingApproveHint("imessage"),
97
- };
98
- },
99
- collectWarnings: ({ account, cfg }) => {
100
- const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
101
- const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? "allowlist";
102
- if (groupPolicy !== "open") {
103
- return [];
104
- }
105
- return [
106
- `- iMessage groups: groupPolicy="open" allows any member to trigger the bot. Set channels.imessage.groupPolicy="allowlist" + channels.imessage.groupAllowFrom to restrict senders.`,
107
- ];
108
- },
109
- },
110
- groups: {
111
- resolveRequireMention: resolveIMessageGroupRequireMention,
112
- resolveToolPolicy: resolveIMessageGroupToolPolicy,
113
- },
114
- messaging: {
115
- normalizeTarget: normalizeIMessageMessagingTarget,
116
- targetResolver: {
117
- looksLikeId: looksLikeIMessageTargetId,
118
- hint: "<handle|chat_id:ID>",
119
- },
120
- },
121
- setup: {
122
- resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
123
- applyAccountName: ({ cfg, accountId, name }) =>
124
- applyAccountNameToChannelSection({
125
- cfg,
126
- channelKey: "imessage",
127
- accountId,
128
- name,
129
- }),
130
- applyAccountConfig: ({ cfg, accountId, input }) => {
131
- const namedConfig = applyAccountNameToChannelSection({
132
- cfg,
133
- channelKey: "imessage",
134
- accountId,
135
- name: input.name,
136
- });
137
- const next =
138
- accountId !== DEFAULT_ACCOUNT_ID
139
- ? migrateBaseNameToDefaultAccount({
140
- cfg: namedConfig,
141
- channelKey: "imessage",
142
- })
143
- : namedConfig;
144
- if (accountId === DEFAULT_ACCOUNT_ID) {
145
- return {
146
- ...next,
147
- channels: {
148
- ...next.channels,
149
- imessage: {
150
- ...next.channels?.imessage,
151
- enabled: true,
152
- ...(input.cliPath ? { cliPath: input.cliPath } : {}),
153
- ...(input.dbPath ? { dbPath: input.dbPath } : {}),
154
- ...(input.service ? { service: input.service } : {}),
155
- ...(input.region ? { region: input.region } : {}),
156
- },
157
- },
158
- };
159
- }
160
- return {
161
- ...next,
162
- channels: {
163
- ...next.channels,
164
- imessage: {
165
- ...next.channels?.imessage,
166
- enabled: true,
167
- accounts: {
168
- ...next.channels?.imessage?.accounts,
169
- [accountId]: {
170
- ...next.channels?.imessage?.accounts?.[accountId],
171
- enabled: true,
172
- ...(input.cliPath ? { cliPath: input.cliPath } : {}),
173
- ...(input.dbPath ? { dbPath: input.dbPath } : {}),
174
- ...(input.service ? { service: input.service } : {}),
175
- ...(input.region ? { region: input.region } : {}),
176
- },
177
- },
178
- },
179
- },
180
- };
181
- },
182
- },
183
- outbound: {
184
- deliveryMode: "direct",
185
- chunker: (text, limit) => getIMessageRuntime().channel.text.chunkText(text, limit),
186
- chunkerMode: "text",
187
- textChunkLimit: 4000,
188
- sendText: async ({ cfg, to, text, accountId, deps, replyToId }) => {
189
- const send = deps?.sendIMessage ?? getIMessageRuntime().channel.imessage.sendMessageIMessage;
190
- const maxBytes = resolveChannelMediaMaxBytes({
191
- cfg,
192
- resolveChannelLimitMb: ({ cfg, accountId }) =>
193
- cfg.channels?.imessage?.accounts?.[accountId]?.mediaMaxMb ??
194
- cfg.channels?.imessage?.mediaMaxMb,
195
- accountId,
196
- });
197
- const result = await send(to, text, {
198
- maxBytes,
199
- accountId: accountId ?? undefined,
200
- replyToId: replyToId ?? undefined,
201
- });
202
- return { channel: "imessage", ...result };
203
- },
204
- sendMedia: async ({ cfg, to, text, mediaUrl, accountId, deps, replyToId }) => {
205
- const send = deps?.sendIMessage ?? getIMessageRuntime().channel.imessage.sendMessageIMessage;
206
- const maxBytes = resolveChannelMediaMaxBytes({
207
- cfg,
208
- resolveChannelLimitMb: ({ cfg, accountId }) =>
209
- cfg.channels?.imessage?.accounts?.[accountId]?.mediaMaxMb ??
210
- cfg.channels?.imessage?.mediaMaxMb,
211
- accountId,
212
- });
213
- const result = await send(to, text, {
214
- mediaUrl,
215
- maxBytes,
216
- accountId: accountId ?? undefined,
217
- replyToId: replyToId ?? undefined,
218
- });
219
- return { channel: "imessage", ...result };
220
- },
221
- },
222
- status: {
223
- defaultRuntime: {
224
- accountId: DEFAULT_ACCOUNT_ID,
225
- running: false,
226
- lastStartAt: null,
227
- lastStopAt: null,
228
- lastError: null,
229
- cliPath: null,
230
- dbPath: null,
231
- },
232
- collectStatusIssues: (accounts) =>
233
- accounts.flatMap((account) => {
234
- const lastError = typeof account.lastError === "string" ? account.lastError.trim() : "";
235
- if (!lastError) {
236
- return [];
237
- }
238
- return [
239
- {
240
- channel: "imessage",
241
- accountId: account.accountId,
242
- kind: "runtime",
243
- message: `Channel error: ${lastError}`,
244
- },
245
- ];
246
- }),
247
- buildChannelSummary: ({ snapshot }) => ({
248
- configured: snapshot.configured ?? false,
249
- running: snapshot.running ?? false,
250
- lastStartAt: snapshot.lastStartAt ?? null,
251
- lastStopAt: snapshot.lastStopAt ?? null,
252
- lastError: snapshot.lastError ?? null,
253
- cliPath: snapshot.cliPath ?? null,
254
- dbPath: snapshot.dbPath ?? null,
255
- probe: snapshot.probe,
256
- lastProbeAt: snapshot.lastProbeAt ?? null,
257
- }),
258
- probeAccount: async ({ timeoutMs }) =>
259
- getIMessageRuntime().channel.imessage.probeIMessage(timeoutMs),
260
- buildAccountSnapshot: ({ account, runtime, probe }) => ({
261
- accountId: account.accountId,
262
- name: account.name,
263
- enabled: account.enabled,
264
- configured: account.configured,
265
- running: runtime?.running ?? false,
266
- lastStartAt: runtime?.lastStartAt ?? null,
267
- lastStopAt: runtime?.lastStopAt ?? null,
268
- lastError: runtime?.lastError ?? null,
269
- cliPath: runtime?.cliPath ?? account.config.cliPath ?? null,
270
- dbPath: runtime?.dbPath ?? account.config.dbPath ?? null,
271
- probe,
272
- lastInboundAt: runtime?.lastInboundAt ?? null,
273
- lastOutboundAt: runtime?.lastOutboundAt ?? null,
274
- }),
275
- resolveAccountState: ({ enabled }) => (enabled ? "enabled" : "disabled"),
276
- },
277
- gateway: {
278
- startAccount: async (ctx) => {
279
- const account = ctx.account;
280
- const cliPath = account.config.cliPath?.trim() || "imsg";
281
- const dbPath = account.config.dbPath?.trim();
282
- ctx.setStatus({
283
- accountId: account.accountId,
284
- cliPath,
285
- dbPath: dbPath ?? null,
286
- });
287
- ctx.log?.info(
288
- `[${account.accountId}] starting provider (${cliPath}${dbPath ? ` db=${dbPath}` : ""})`,
289
- );
290
- return getIMessageRuntime().channel.imessage.monitorIMessageProvider({
291
- accountId: account.accountId,
292
- config: ctx.cfg,
293
- runtime: ctx.runtime,
294
- abortSignal: ctx.abortSignal,
295
- });
296
- },
297
- },
298
- };
@@ -1,14 +0,0 @@
1
- import type { PluginRuntime } from "symi/plugin-sdk";
2
-
3
- let runtime: PluginRuntime | null = null;
4
-
5
- export function setIMessageRuntime(next: PluginRuntime) {
6
- runtime = next;
7
- }
8
-
9
- export function getIMessageRuntime(): PluginRuntime {
10
- if (!runtime) {
11
- throw new Error("iMessage runtime not initialized");
12
- }
13
- return runtime;
14
- }
@@ -1,9 +0,0 @@
1
- {
2
- "id": "imessage",
3
- "channels": ["imessage"],
4
- "configSchema": {
5
- "type": "object",
6
- "additionalProperties": false,
7
- "properties": {}
8
- }
9
- }
@@ -1,19 +0,0 @@
1
- import type { SymiPluginApi } from "symi/plugin-sdk";
2
- import { emptyPluginConfigSchema } from "symi/plugin-sdk";
3
- import { registerLineCardCommand } from "./src/card-command.js";
4
- import { linePlugin } from "./src/channel.js";
5
- import { setLineRuntime } from "./src/runtime.js";
6
-
7
- const plugin = {
8
- id: "line",
9
- name: "LINE",
10
- description: "LINE Messaging API channel plugin",
11
- configSchema: emptyPluginConfigSchema(),
12
- register(api: SymiPluginApi) {
13
- setLineRuntime(api.runtime);
14
- api.registerChannel({ plugin: linePlugin });
15
- registerLineCardCommand(api);
16
- },
17
- };
18
-
19
- export default plugin;
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/home/symi/projects/symi/node_modules:/home/symi/projects/node_modules:/home/symi/node_modules:/home/node_modules:/node_modules:/home/symi/projects/symi/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/home/symi/projects/symi/node_modules:/home/symi/projects/node_modules:/home/symi/node_modules:/home/node_modules:/node_modules:/home/symi/projects/symi/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../@symerian/symi/symi.mjs" "$@"
19
- else
20
- exec node "$basedir/../@symerian/symi/symi.mjs" "$@"
21
- fi
@@ -1,30 +0,0 @@
1
- {
2
- "name": "@symi/line",
3
- "version": "3.0.9",
4
- "private": true,
5
- "description": "Symi LINE channel plugin",
6
- "type": "module",
7
- "devDependencies": {
8
- "@symerian/symi": "workspace:*"
9
- },
10
- "symi": {
11
- "extensions": [
12
- "./index.ts"
13
- ],
14
- "channel": {
15
- "id": "line",
16
- "label": "LINE",
17
- "selectionLabel": "LINE (Messaging API)",
18
- "docsPath": "/channels/line",
19
- "docsLabel": "line",
20
- "blurb": "LINE Messaging API bot for Japan/Taiwan/Thailand markets.",
21
- "order": 75,
22
- "quickstartAllowFrom": true
23
- },
24
- "install": {
25
- "npmSpec": "@symi/line",
26
- "localPath": "extensions/line",
27
- "defaultChoice": "npm"
28
- }
29
- }
30
- }