@poolzin/pool-bot 2026.1.39 → 2026.2.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/assets/chrome-extension/README.md +3 -3
- package/assets/chrome-extension/background.js +5 -5
- package/assets/chrome-extension/manifest.json +3 -3
- package/assets/chrome-extension/options.html +4 -4
- package/assets/chrome-extension/options.js +1 -1
- package/dist/acp/client.js +3 -3
- package/dist/acp/types.js +1 -1
- package/dist/agents/agent-paths.js +3 -3
- package/dist/agents/auth-profiles/paths.js +3 -3
- package/dist/agents/cli-runner/helpers.js +1 -1
- package/dist/agents/cli-runner.js +2 -2
- package/dist/agents/cloudflare-ai-gateway.js +31 -0
- package/dist/agents/compaction.js +16 -2
- package/dist/agents/context-window-guard.js +13 -10
- package/dist/agents/context.js +4 -4
- package/dist/agents/docs-path.js +1 -1
- package/dist/agents/minimax-vlm.js +1 -1
- package/dist/agents/model-auth.js +12 -1
- package/dist/agents/model-catalog.js +4 -4
- package/dist/agents/model-selection.js +10 -4
- package/dist/agents/models-config.js +3 -3
- package/dist/agents/models-config.providers.js +147 -39
- package/dist/agents/pi-embedded-helpers/openai.js +1 -1
- package/dist/agents/pi-embedded-runner/compact.js +8 -8
- package/dist/agents/pi-embedded-runner/model.js +2 -2
- package/dist/agents/pi-embedded-runner/run/attempt.js +6 -6
- package/dist/agents/pi-embedded-runner/run.js +4 -4
- package/dist/agents/pi-embedded-runner/tool-result-truncation.js +275 -0
- package/dist/agents/pi-embedded-runner/utils.js +1 -1
- package/dist/agents/pi-model-discovery.js +10 -0
- package/dist/agents/pi-tool-definition-adapter.js +50 -9
- package/dist/agents/pi-tools.before-tool-call.js +67 -0
- package/dist/agents/pi-tools.js +10 -5
- package/dist/agents/pi-tools.read.js +2 -2
- package/dist/agents/session-file-repair.js +83 -0
- package/dist/agents/session-transcript-repair.js +68 -0
- package/dist/agents/skills/frontmatter.js +1 -1
- package/dist/agents/skills/workspace.js +2 -2
- package/dist/agents/system-prompt.js +28 -4
- package/dist/agents/together-models.js +127 -0
- package/dist/agents/tool-images.js +1 -1
- package/dist/agents/tool-policy.js +1 -1
- package/dist/agents/tools/browser-tool.js +3 -3
- package/dist/agents/tools/image-tool.js +2 -2
- package/dist/agents/tools/memory-tool.js +93 -5
- package/dist/agents/tools/web-search.js +1 -1
- package/dist/auto-reply/commands-registry.data.js +1 -1
- package/dist/auto-reply/reply/commands-context-report.js +2 -2
- package/dist/auto-reply/reply/commands-session.js +2 -2
- package/dist/auto-reply/reply/get-reply-run.js +14 -4
- package/dist/auto-reply/reply/groups.js +1 -1
- package/dist/auto-reply/reply/inbound-context.js +4 -0
- package/dist/auto-reply/reply/inbound-meta.js +130 -0
- package/dist/auto-reply/reply/untrusted-context.js +15 -0
- package/dist/auto-reply/status.js +1 -1
- package/dist/browser/client-fetch.js +1 -1
- package/dist/browser/config.js +1 -1
- package/dist/browser/extension-relay.js +3 -3
- package/dist/browser/server-context.js +2 -2
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui.js +3 -3
- package/dist/channels/plugins/catalog.js +2 -2
- package/dist/channels/plugins/onboarding/imessage.js +1 -1
- package/dist/channels/plugins/onboarding/signal.js +1 -1
- package/dist/channels/plugins/onboarding/slack.js +4 -4
- package/dist/channels/plugins/onboarding/whatsapp.js +3 -3
- package/dist/channels/plugins/pairing-message.js +1 -1
- package/dist/cli/browser-cli-extension.js +2 -2
- package/dist/cli/docs-cli.js +1 -1
- package/dist/cli/gateway-cli/dev.js +1 -1
- package/dist/cli/memory-cli.js +25 -15
- package/dist/cli/nodes-cli/register.canvas.js +1 -1
- package/dist/cli/plugins-cli.js +1 -1
- package/dist/cli/run-main.js +2 -2
- package/dist/cli/security-cli.js +1 -1
- package/dist/cli/tagline.js +1 -1
- package/dist/cli/update-cli.js +4 -4
- package/dist/cli/webhooks-cli.js +5 -5
- package/dist/commands/agents.commands.add.js +1 -1
- package/dist/commands/auth-choice.apply.api-providers.js +305 -17
- package/dist/commands/auth-choice.apply.js +4 -1
- package/dist/commands/auth-choice.apply.plugin-provider.js +2 -2
- package/dist/commands/auth-choice.apply.xai.js +63 -0
- package/dist/commands/auth-choice.preferred-provider.js +7 -1
- package/dist/commands/configure.wizard.js +1 -1
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/docs.js +1 -1
- package/dist/commands/doctor-gateway-services.js +3 -3
- package/dist/commands/doctor-update.js +3 -3
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/models/list.probe.js +2 -2
- package/dist/commands/models/list.registry.js +4 -4
- package/dist/commands/models/list.status-command.js +2 -2
- package/dist/commands/onboard-auth.config-core.js +366 -28
- package/dist/commands/onboard-auth.credentials.js +71 -9
- package/dist/commands/onboard-auth.js +3 -3
- package/dist/commands/onboard-auth.models.js +26 -24
- package/dist/commands/onboard-non-interactive/local/auth-choice.js +140 -6
- package/dist/commands/status-all/report-lines.js +1 -1
- package/dist/commands/status.command.js +1 -1
- package/dist/commands/uninstall.js +3 -3
- package/dist/compat/legacy-names.js +1 -1
- package/dist/config/io.js +3 -3
- package/dist/config/schema.js +1 -1
- package/dist/config/types.memory.js +1 -0
- package/dist/config/version.js +4 -4
- package/dist/daemon/constants.js +7 -7
- package/dist/daemon/inspect.js +6 -6
- package/dist/daemon/systemd-unit.js +1 -1
- package/dist/gateway/live-image-probe.js +1 -66
- package/dist/gateway/openai-http.js +2 -2
- package/dist/gateway/openresponses-http.js +4 -4
- package/dist/gateway/server-discovery.js +2 -2
- package/dist/gateway/server-http.js +1 -1
- package/dist/gateway/server.impl.js +2 -2
- package/dist/hooks/frontmatter.js +1 -1
- package/dist/hooks/hooks-status.js +1 -1
- package/dist/hooks/install.js +2 -2
- package/dist/hooks/loader.js +1 -1
- package/dist/hooks/workspace.js +3 -3
- package/dist/index.js +2 -2
- package/dist/infra/bonjour.js +3 -3
- package/dist/infra/path-env.js +3 -3
- package/dist/infra/provider-usage.fetch.minimax.js +1 -1
- package/dist/infra/restart.js +1 -1
- package/dist/infra/tailscale.js +1 -1
- package/dist/macos/relay.js +2 -2
- package/dist/media/input-files.js +1 -1
- package/dist/media/mime.js +4 -0
- package/dist/media/png-encode.js +74 -0
- package/dist/media-understanding/providers/image.js +2 -2
- package/dist/memory/backend-config.js +207 -0
- package/dist/memory/embeddings.js +1 -1
- package/dist/memory/manager.js +1 -0
- package/dist/memory/types.js +1 -0
- package/dist/node-host/runner.js +2 -2
- package/dist/pairing/pairing-messages.js +1 -1
- package/dist/plugins/discovery.js +1 -1
- package/dist/plugins/install.js +2 -2
- package/dist/plugins/update.js +1 -1
- package/dist/security/audit.js +2 -2
- package/dist/shared/text/reasoning-tags.js +52 -7
- package/dist/tailscale/detect.js +146 -0
- package/dist/telegram/bot-message-context.js +1 -1
- package/dist/test-helpers/workspace.js +11 -0
- package/dist/test-utils/channel-plugins.js +82 -0
- package/dist/test-utils/ports.js +73 -0
- package/dist/utils/shell-argv.js +61 -0
- package/dist/utils.js +10 -0
- package/dist/web/qr-image.js +1 -61
- package/dist/wizard/onboarding.finalize.js +7 -7
- package/dist/wizard/onboarding.js +3 -3
- package/docs/RELEASE_WORKFOTS_COMPARISON.md +3 -3
- package/docs/_config.yml +2 -2
- package/docs/_layouts/default.html +9 -9
- package/docs/concepts/typebox.md +1 -1
- package/docs/docs.json +1 -1
- package/docs/northflank.mdx +7 -7
- package/docs/railway.mdx +3 -3
- package/docs/render.mdx +5 -5
- package/docs/start/lore.md +2 -2
- package/extensions/bluebubbles/index.ts +2 -2
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/bluebubbles/src/accounts.ts +8 -8
- package/extensions/bluebubbles/src/actions.test.ts +22 -22
- package/extensions/bluebubbles/src/actions.ts +5 -5
- package/extensions/bluebubbles/src/attachments.ts +2 -2
- package/extensions/bluebubbles/src/channel.ts +16 -16
- package/extensions/bluebubbles/src/chat.ts +2 -2
- package/extensions/bluebubbles/src/media-send.ts +2 -2
- package/extensions/bluebubbles/src/monitor.test.ts +46 -46
- package/extensions/bluebubbles/src/monitor.ts +5 -5
- package/extensions/bluebubbles/src/onboarding.ts +7 -7
- package/extensions/bluebubbles/src/reactions.ts +2 -2
- package/extensions/bluebubbles/src/send.ts +2 -2
- package/extensions/copilot-proxy/README.md +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/index.ts +2 -2
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/diagnostics-otel/src/service.ts +3 -3
- package/extensions/discord/index.ts +2 -2
- package/extensions/discord/package.json +1 -1
- package/extensions/google-antigravity-auth/README.md +1 -1
- package/extensions/google-antigravity-auth/index.ts +1 -1
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/README.md +1 -1
- package/extensions/google-gemini-cli-auth/oauth.ts +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/index.ts +3 -3
- package/extensions/googlechat/package.json +1 -1
- package/extensions/googlechat/src/accounts.ts +8 -8
- package/extensions/googlechat/src/actions.ts +6 -6
- package/extensions/googlechat/src/channel.ts +21 -21
- package/extensions/googlechat/src/monitor.ts +8 -8
- package/extensions/googlechat/src/onboarding.ts +10 -10
- package/extensions/imessage/index.ts +2 -2
- package/extensions/imessage/package.json +1 -1
- package/extensions/line/index.ts +2 -2
- package/extensions/line/package.json +1 -1
- package/extensions/line/src/card-command.ts +2 -2
- package/extensions/line/src/channel.logout.test.ts +4 -4
- package/extensions/line/src/channel.sendPayload.test.ts +8 -8
- package/extensions/line/src/channel.ts +3 -3
- package/extensions/llm-task/README.md +3 -3
- package/extensions/llm-task/index.ts +2 -2
- package/extensions/llm-task/package.json +1 -1
- package/extensions/llm-task/src/llm-task-tool.ts +4 -4
- package/extensions/lobster/README.md +6 -6
- package/extensions/lobster/index.ts +2 -2
- package/extensions/lobster/src/lobster-tool.test.ts +4 -4
- package/extensions/lobster/src/lobster-tool.ts +2 -2
- package/extensions/matrix/index.ts +2 -2
- package/extensions/matrix/package.json +1 -1
- package/extensions/matrix/src/matrix/client/config.ts +1 -1
- package/extensions/matrix/src/matrix/monitor/handler.ts +1 -1
- package/extensions/matrix/src/onboarding.ts +1 -1
- package/extensions/mattermost/index.ts +2 -2
- package/extensions/mattermost/package.json +1 -1
- package/extensions/mattermost/src/mattermost/accounts.ts +8 -8
- package/extensions/mattermost/src/mattermost/monitor-helpers.ts +5 -5
- package/extensions/mattermost/src/mattermost/monitor.ts +2 -2
- package/extensions/mattermost/src/onboarding-helpers.ts +3 -3
- package/extensions/mattermost/src/onboarding.ts +2 -2
- package/extensions/memory-core/index.ts +2 -2
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/index.ts +3 -3
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/msteams/index.ts +2 -2
- package/extensions/msteams/package.json +1 -1
- package/extensions/msteams/src/channel.directory.test.ts +2 -2
- package/extensions/msteams/src/channel.ts +2 -2
- package/extensions/msteams/src/graph-upload.ts +4 -4
- package/extensions/msteams/src/monitor-handler.ts +2 -2
- package/extensions/msteams/src/monitor.ts +2 -2
- package/extensions/msteams/src/onboarding.ts +9 -9
- package/extensions/msteams/src/reply-dispatcher.ts +2 -2
- package/extensions/msteams/src/send-context.ts +2 -2
- package/extensions/msteams/src/send.ts +4 -4
- package/extensions/nextcloud-talk/index.ts +2 -2
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nextcloud-talk/src/channel.ts +7 -7
- package/extensions/nextcloud-talk/src/inbound.ts +7 -7
- package/extensions/nextcloud-talk/src/onboarding.ts +1 -1
- package/extensions/nostr/README.md +2 -2
- package/extensions/nostr/index.ts +5 -5
- package/extensions/nostr/package.json +1 -1
- package/extensions/nostr/src/types.ts +4 -4
- package/extensions/open-prose/index.ts +2 -2
- package/extensions/qwen-portal-auth/README.md +1 -1
- package/extensions/signal/index.ts +2 -2
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/index.ts +2 -2
- package/extensions/slack/package.json +1 -1
- package/extensions/telegram/index.ts +2 -2
- package/extensions/telegram/package.json +1 -1
- package/extensions/telegram/src/channel.ts +2 -2
- package/extensions/tlon/README.md +2 -2
- package/extensions/tlon/index.ts +2 -2
- package/extensions/tlon/package.json +1 -1
- package/extensions/tlon/src/channel.ts +13 -13
- package/extensions/tlon/src/monitor/index.ts +3 -3
- package/extensions/tlon/src/onboarding.ts +3 -3
- package/extensions/tlon/src/types.ts +3 -3
- package/extensions/twitch/README.md +1 -1
- package/extensions/twitch/index.ts +2 -2
- package/extensions/twitch/package.json +1 -1
- package/extensions/twitch/src/config.ts +3 -3
- package/extensions/twitch/src/monitor.ts +3 -3
- package/extensions/twitch/src/onboarding.ts +9 -9
- package/extensions/twitch/src/outbound.test.ts +2 -2
- package/extensions/twitch/src/plugin.test.ts +2 -2
- package/extensions/twitch/src/plugin.ts +8 -8
- package/extensions/twitch/src/send.test.ts +2 -2
- package/extensions/twitch/src/send.ts +4 -4
- package/extensions/twitch/src/token.test.ts +8 -8
- package/extensions/twitch/src/token.ts +3 -3
- package/extensions/twitch/src/twitch-client.ts +3 -3
- package/extensions/twitch/src/types.ts +3 -3
- package/extensions/twitch/src/utils/markdown.ts +1 -1
- package/extensions/voice-call/README.md +3 -3
- package/extensions/voice-call/package.json +1 -1
- package/extensions/voice-call/src/core-bridge.ts +2 -2
- package/extensions/voice-call/src/response-generator.ts +1 -1
- package/extensions/whatsapp/index.ts +2 -2
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/README.md +1 -1
- package/extensions/zalo/index.ts +2 -2
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalo/src/accounts.ts +8 -8
- package/extensions/zalo/src/actions.ts +4 -4
- package/extensions/zalo/src/channel.directory.test.ts +2 -2
- package/extensions/zalo/src/channel.ts +18 -18
- package/extensions/zalo/src/monitor.ts +9 -9
- package/extensions/zalo/src/monitor.webhook.test.ts +2 -2
- package/extensions/zalo/src/onboarding.ts +24 -24
- package/extensions/zalo/src/send.ts +2 -2
- package/extensions/zalouser/README.md +2 -2
- package/extensions/zalouser/index.ts +2 -2
- package/extensions/zalouser/package.json +1 -1
- package/extensions/zalouser/src/accounts.ts +9 -9
- package/extensions/zalouser/src/channel.ts +24 -24
- package/extensions/zalouser/src/monitor.ts +4 -4
- package/extensions/zalouser/src/onboarding.ts +28 -28
- package/package.json +13 -251
- package/skills/nano-banana-pro/scripts/generate_image.py +1 -1
- package/skills/tmux/scripts/find-sessions.sh +1 -1
- package/CHANGELOG.md +0 -102
- package/README-header.png +0 -0
- package/git-hooks/pre-commit +0 -4
- package/scripts/format-staged.js +0 -148
- package/scripts/postinstall.js +0 -300
- package/scripts/setup-git-hooks.js +0 -96
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
ChannelDock,
|
|
5
5
|
ChannelGroupContext,
|
|
6
6
|
ChannelPlugin,
|
|
7
|
-
|
|
7
|
+
PoolbotConfig,
|
|
8
8
|
GroupToolPolicyConfig,
|
|
9
9
|
} from "poolbot/plugin-sdk";
|
|
10
10
|
import {
|
|
@@ -85,7 +85,7 @@ function resolveZalouserGroupToolPolicy(
|
|
|
85
85
|
params: ChannelGroupContext,
|
|
86
86
|
): GroupToolPolicyConfig | undefined {
|
|
87
87
|
const account = resolveZalouserAccountSync({
|
|
88
|
-
cfg: params.cfg as
|
|
88
|
+
cfg: params.cfg as PoolbotConfig,
|
|
89
89
|
accountId: params.accountId ?? undefined,
|
|
90
90
|
});
|
|
91
91
|
const groups = account.config.groups ?? {};
|
|
@@ -111,7 +111,7 @@ export const zalouserDock: ChannelDock = {
|
|
|
111
111
|
outbound: { textChunkLimit: 2000 },
|
|
112
112
|
config: {
|
|
113
113
|
resolveAllowFrom: ({ cfg, accountId }) =>
|
|
114
|
-
(resolveZalouserAccountSync({ cfg: cfg as
|
|
114
|
+
(resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig, accountId }).config.allowFrom ?? []).map(
|
|
115
115
|
(entry) => String(entry),
|
|
116
116
|
),
|
|
117
117
|
formatAllowFrom: ({ allowFrom }) =>
|
|
@@ -146,13 +146,13 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
146
146
|
reload: { configPrefixes: ["channels.zalouser"] },
|
|
147
147
|
configSchema: buildChannelConfigSchema(ZalouserConfigSchema),
|
|
148
148
|
config: {
|
|
149
|
-
listAccountIds: (cfg) => listZalouserAccountIds(cfg as
|
|
149
|
+
listAccountIds: (cfg) => listZalouserAccountIds(cfg as PoolbotConfig),
|
|
150
150
|
resolveAccount: (cfg, accountId) =>
|
|
151
|
-
resolveZalouserAccountSync({ cfg: cfg as
|
|
152
|
-
defaultAccountId: (cfg) => resolveDefaultZalouserAccountId(cfg as
|
|
151
|
+
resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig, accountId }),
|
|
152
|
+
defaultAccountId: (cfg) => resolveDefaultZalouserAccountId(cfg as PoolbotConfig),
|
|
153
153
|
setAccountEnabled: ({ cfg, accountId, enabled }) =>
|
|
154
154
|
setAccountEnabledInConfigSection({
|
|
155
|
-
cfg: cfg as
|
|
155
|
+
cfg: cfg as PoolbotConfig,
|
|
156
156
|
sectionKey: "zalouser",
|
|
157
157
|
accountId,
|
|
158
158
|
enabled,
|
|
@@ -160,7 +160,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
160
160
|
}),
|
|
161
161
|
deleteAccount: ({ cfg, accountId }) =>
|
|
162
162
|
deleteAccountFromConfigSection({
|
|
163
|
-
cfg: cfg as
|
|
163
|
+
cfg: cfg as PoolbotConfig,
|
|
164
164
|
sectionKey: "zalouser",
|
|
165
165
|
accountId,
|
|
166
166
|
clearBaseFields: ["profile", "name", "dmPolicy", "allowFrom", "groupPolicy", "groups", "messagePrefix"],
|
|
@@ -180,7 +180,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
180
180
|
configured: undefined,
|
|
181
181
|
}),
|
|
182
182
|
resolveAllowFrom: ({ cfg, accountId }) =>
|
|
183
|
-
(resolveZalouserAccountSync({ cfg: cfg as
|
|
183
|
+
(resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig, accountId }).config.allowFrom ?? []).map(
|
|
184
184
|
(entry) => String(entry),
|
|
185
185
|
),
|
|
186
186
|
formatAllowFrom: ({ allowFrom }) =>
|
|
@@ -194,7 +194,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
194
194
|
resolveDmPolicy: ({ cfg, accountId, account }) => {
|
|
195
195
|
const resolvedAccountId = accountId ?? account.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
196
196
|
const useAccountPath = Boolean(
|
|
197
|
-
(cfg as
|
|
197
|
+
(cfg as PoolbotConfig).channels?.zalouser?.accounts?.[resolvedAccountId],
|
|
198
198
|
);
|
|
199
199
|
const basePath = useAccountPath
|
|
200
200
|
? `channels.zalouser.accounts.${resolvedAccountId}.`
|
|
@@ -220,7 +220,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
220
220
|
resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
|
|
221
221
|
applyAccountName: ({ cfg, accountId, name }) =>
|
|
222
222
|
applyAccountNameToChannelSection({
|
|
223
|
-
cfg: cfg as
|
|
223
|
+
cfg: cfg as PoolbotConfig,
|
|
224
224
|
channelKey: "zalouser",
|
|
225
225
|
accountId,
|
|
226
226
|
name,
|
|
@@ -228,7 +228,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
228
228
|
validateInput: () => null,
|
|
229
229
|
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
230
230
|
const namedConfig = applyAccountNameToChannelSection({
|
|
231
|
-
cfg: cfg as
|
|
231
|
+
cfg: cfg as PoolbotConfig,
|
|
232
232
|
channelKey: "zalouser",
|
|
233
233
|
accountId,
|
|
234
234
|
name: input.name,
|
|
@@ -250,7 +250,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
250
250
|
enabled: true,
|
|
251
251
|
},
|
|
252
252
|
},
|
|
253
|
-
} as
|
|
253
|
+
} as PoolbotConfig;
|
|
254
254
|
}
|
|
255
255
|
return {
|
|
256
256
|
...next,
|
|
@@ -268,7 +268,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
268
268
|
},
|
|
269
269
|
},
|
|
270
270
|
},
|
|
271
|
-
} as
|
|
271
|
+
} as PoolbotConfig;
|
|
272
272
|
},
|
|
273
273
|
},
|
|
274
274
|
messaging: {
|
|
@@ -290,7 +290,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
290
290
|
self: async ({ cfg, accountId, runtime }) => {
|
|
291
291
|
const ok = await checkZcaInstalled();
|
|
292
292
|
if (!ok) throw new Error("Missing dependency: `zca` not found in PATH");
|
|
293
|
-
const account = resolveZalouserAccountSync({ cfg: cfg as
|
|
293
|
+
const account = resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig, accountId });
|
|
294
294
|
const result = await runZca(["me", "info", "-j"], { profile: account.profile, timeout: 10000 });
|
|
295
295
|
if (!result.ok) {
|
|
296
296
|
runtime.error(result.stderr || "Failed to fetch profile");
|
|
@@ -308,7 +308,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
308
308
|
listPeers: async ({ cfg, accountId, query, limit }) => {
|
|
309
309
|
const ok = await checkZcaInstalled();
|
|
310
310
|
if (!ok) throw new Error("Missing dependency: `zca` not found in PATH");
|
|
311
|
-
const account = resolveZalouserAccountSync({ cfg: cfg as
|
|
311
|
+
const account = resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig, accountId });
|
|
312
312
|
const args = query?.trim()
|
|
313
313
|
? ["friend", "find", query.trim()]
|
|
314
314
|
: ["friend", "list", "-j"];
|
|
@@ -332,7 +332,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
332
332
|
listGroups: async ({ cfg, accountId, query, limit }) => {
|
|
333
333
|
const ok = await checkZcaInstalled();
|
|
334
334
|
if (!ok) throw new Error("Missing dependency: `zca` not found in PATH");
|
|
335
|
-
const account = resolveZalouserAccountSync({ cfg: cfg as
|
|
335
|
+
const account = resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig, accountId });
|
|
336
336
|
const result = await runZca(["group", "list", "-j"], { profile: account.profile, timeout: 15000 });
|
|
337
337
|
if (!result.ok) {
|
|
338
338
|
throw new Error(result.stderr || "Failed to list groups");
|
|
@@ -356,7 +356,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
356
356
|
listGroupMembers: async ({ cfg, accountId, groupId, limit }) => {
|
|
357
357
|
const ok = await checkZcaInstalled();
|
|
358
358
|
if (!ok) throw new Error("Missing dependency: `zca` not found in PATH");
|
|
359
|
-
const account = resolveZalouserAccountSync({ cfg: cfg as
|
|
359
|
+
const account = resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig, accountId });
|
|
360
360
|
const result = await runZca(["group", "members", groupId, "-j"], {
|
|
361
361
|
profile: account.profile,
|
|
362
362
|
timeout: 20000,
|
|
@@ -398,7 +398,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
398
398
|
}
|
|
399
399
|
try {
|
|
400
400
|
const account = resolveZalouserAccountSync({
|
|
401
|
-
cfg: cfg as
|
|
401
|
+
cfg: cfg as PoolbotConfig,
|
|
402
402
|
accountId: accountId ?? DEFAULT_ACCOUNT_ID,
|
|
403
403
|
});
|
|
404
404
|
const args =
|
|
@@ -454,7 +454,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
454
454
|
idLabel: "zalouserUserId",
|
|
455
455
|
normalizeAllowEntry: (entry) => entry.replace(/^(zalouser|zlu):/i, ""),
|
|
456
456
|
notifyApproval: async ({ cfg, id }) => {
|
|
457
|
-
const account = resolveZalouserAccountSync({ cfg: cfg as
|
|
457
|
+
const account = resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig });
|
|
458
458
|
const authenticated = await checkZcaAuthenticated(account.profile);
|
|
459
459
|
if (!authenticated) throw new Error("Zalouser not authenticated");
|
|
460
460
|
await sendMessageZalouser(id, "Your pairing request has been approved.", {
|
|
@@ -465,7 +465,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
465
465
|
auth: {
|
|
466
466
|
login: async ({ cfg, accountId, runtime }) => {
|
|
467
467
|
const account = resolveZalouserAccountSync({
|
|
468
|
-
cfg: cfg as
|
|
468
|
+
cfg: cfg as PoolbotConfig,
|
|
469
469
|
accountId: accountId ?? DEFAULT_ACCOUNT_ID,
|
|
470
470
|
});
|
|
471
471
|
const ok = await checkZcaInstalled();
|
|
@@ -509,7 +509,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
509
509
|
chunkerMode: "text",
|
|
510
510
|
textChunkLimit: 2000,
|
|
511
511
|
sendText: async ({ to, text, accountId, cfg }) => {
|
|
512
|
-
const account = resolveZalouserAccountSync({ cfg: cfg as
|
|
512
|
+
const account = resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig, accountId });
|
|
513
513
|
const result = await sendMessageZalouser(to, text, { profile: account.profile });
|
|
514
514
|
return {
|
|
515
515
|
channel: "zalouser",
|
|
@@ -519,7 +519,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
519
519
|
};
|
|
520
520
|
},
|
|
521
521
|
sendMedia: async ({ to, text, mediaUrl, accountId, cfg }) => {
|
|
522
|
-
const account = resolveZalouserAccountSync({ cfg: cfg as
|
|
522
|
+
const account = resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig, accountId });
|
|
523
523
|
const result = await sendMessageZalouser(to, text, {
|
|
524
524
|
profile: account.profile,
|
|
525
525
|
mediaUrl,
|
|
@@ -589,7 +589,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
|
|
589
589
|
const { monitorZalouserProvider } = await import("./monitor.js");
|
|
590
590
|
return monitorZalouserProvider({
|
|
591
591
|
account,
|
|
592
|
-
config: ctx.cfg as
|
|
592
|
+
config: ctx.cfg as PoolbotConfig,
|
|
593
593
|
runtime: ctx.runtime,
|
|
594
594
|
abortSignal: ctx.abortSignal,
|
|
595
595
|
statusSink: (patch) => ctx.setStatus({ accountId: ctx.accountId, ...patch }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChildProcess } from "node:child_process";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { PoolbotConfig, MarkdownTableMode, RuntimeEnv } from "poolbot/plugin-sdk";
|
|
4
4
|
import { mergeAllowlist, summarizeMapping } from "poolbot/plugin-sdk";
|
|
5
5
|
import { sendMessageZalouser } from "./send.js";
|
|
6
6
|
import type {
|
|
@@ -14,7 +14,7 @@ import { parseJsonOutput, runZca, runZcaStreaming } from "./zca.js";
|
|
|
14
14
|
|
|
15
15
|
export type ZalouserMonitorOptions = {
|
|
16
16
|
account: ResolvedZalouserAccount;
|
|
17
|
-
config:
|
|
17
|
+
config: PoolbotConfig;
|
|
18
18
|
runtime: RuntimeEnv;
|
|
19
19
|
abortSignal: AbortSignal;
|
|
20
20
|
statusSink?: (patch: { lastInboundAt?: number; lastOutboundAt?: number }) => void;
|
|
@@ -149,7 +149,7 @@ function startZcaListener(
|
|
|
149
149
|
async function processMessage(
|
|
150
150
|
message: ZcaMessage,
|
|
151
151
|
account: ResolvedZalouserAccount,
|
|
152
|
-
config:
|
|
152
|
+
config: PoolbotConfig,
|
|
153
153
|
core: ZalouserCoreRuntime,
|
|
154
154
|
runtime: RuntimeEnv,
|
|
155
155
|
statusSink?: (patch: { lastInboundAt?: number; lastOutboundAt?: number }) => void,
|
|
@@ -358,7 +358,7 @@ async function deliverZalouserReply(params: {
|
|
|
358
358
|
isGroup: boolean;
|
|
359
359
|
runtime: RuntimeEnv;
|
|
360
360
|
core: ZalouserCoreRuntime;
|
|
361
|
-
config:
|
|
361
|
+
config: PoolbotConfig;
|
|
362
362
|
accountId?: string;
|
|
363
363
|
statusSink?: (patch: { lastInboundAt?: number; lastOutboundAt?: number }) => void;
|
|
364
364
|
tableMode?: MarkdownTableMode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ChannelOnboardingAdapter,
|
|
3
3
|
ChannelOnboardingDmPolicy,
|
|
4
|
-
|
|
4
|
+
PoolbotConfig,
|
|
5
5
|
WizardPrompter,
|
|
6
6
|
} from "poolbot/plugin-sdk";
|
|
7
7
|
import {
|
|
@@ -24,9 +24,9 @@ import type { ZcaFriend, ZcaGroup } from "./types.js";
|
|
|
24
24
|
const channel = "zalouser" as const;
|
|
25
25
|
|
|
26
26
|
function setZalouserDmPolicy(
|
|
27
|
-
cfg:
|
|
27
|
+
cfg: PoolbotConfig,
|
|
28
28
|
dmPolicy: "pairing" | "allowlist" | "open" | "disabled",
|
|
29
|
-
):
|
|
29
|
+
): PoolbotConfig {
|
|
30
30
|
const allowFrom =
|
|
31
31
|
dmPolicy === "open"
|
|
32
32
|
? addWildcardAllowFrom(cfg.channels?.zalouser?.allowFrom)
|
|
@@ -41,7 +41,7 @@ function setZalouserDmPolicy(
|
|
|
41
41
|
...(allowFrom ? { allowFrom } : {}),
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
|
-
} as
|
|
44
|
+
} as PoolbotConfig;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
async function noteZalouserHelp(prompter: WizardPrompter): Promise<void> {
|
|
@@ -60,10 +60,10 @@ async function noteZalouserHelp(prompter: WizardPrompter): Promise<void> {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
async function promptZalouserAllowFrom(params: {
|
|
63
|
-
cfg:
|
|
63
|
+
cfg: PoolbotConfig;
|
|
64
64
|
prompter: WizardPrompter;
|
|
65
65
|
accountId: string;
|
|
66
|
-
}): Promise<
|
|
66
|
+
}): Promise<PoolbotConfig> {
|
|
67
67
|
const { cfg, prompter, accountId } = params;
|
|
68
68
|
const resolved = resolveZalouserAccountSync({ cfg, accountId });
|
|
69
69
|
const existingAllowFrom = resolved.config.allowFrom ?? [];
|
|
@@ -131,7 +131,7 @@ async function promptZalouserAllowFrom(params: {
|
|
|
131
131
|
allowFrom: unique,
|
|
132
132
|
},
|
|
133
133
|
},
|
|
134
|
-
} as
|
|
134
|
+
} as PoolbotConfig;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
return {
|
|
@@ -152,15 +152,15 @@ async function promptZalouserAllowFrom(params: {
|
|
|
152
152
|
},
|
|
153
153
|
},
|
|
154
154
|
},
|
|
155
|
-
} as
|
|
155
|
+
} as PoolbotConfig;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
function setZalouserGroupPolicy(
|
|
160
|
-
cfg:
|
|
160
|
+
cfg: PoolbotConfig,
|
|
161
161
|
accountId: string,
|
|
162
162
|
groupPolicy: "open" | "allowlist" | "disabled",
|
|
163
|
-
):
|
|
163
|
+
): PoolbotConfig {
|
|
164
164
|
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
165
165
|
return {
|
|
166
166
|
...cfg,
|
|
@@ -172,7 +172,7 @@ function setZalouserGroupPolicy(
|
|
|
172
172
|
groupPolicy,
|
|
173
173
|
},
|
|
174
174
|
},
|
|
175
|
-
} as
|
|
175
|
+
} as PoolbotConfig;
|
|
176
176
|
}
|
|
177
177
|
return {
|
|
178
178
|
...cfg,
|
|
@@ -191,14 +191,14 @@ function setZalouserGroupPolicy(
|
|
|
191
191
|
},
|
|
192
192
|
},
|
|
193
193
|
},
|
|
194
|
-
} as
|
|
194
|
+
} as PoolbotConfig;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
function setZalouserGroupAllowlist(
|
|
198
|
-
cfg:
|
|
198
|
+
cfg: PoolbotConfig,
|
|
199
199
|
accountId: string,
|
|
200
200
|
groupKeys: string[],
|
|
201
|
-
):
|
|
201
|
+
): PoolbotConfig {
|
|
202
202
|
const groups = Object.fromEntries(groupKeys.map((key) => [key, { allow: true }]));
|
|
203
203
|
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
204
204
|
return {
|
|
@@ -211,7 +211,7 @@ function setZalouserGroupAllowlist(
|
|
|
211
211
|
groups,
|
|
212
212
|
},
|
|
213
213
|
},
|
|
214
|
-
} as
|
|
214
|
+
} as PoolbotConfig;
|
|
215
215
|
}
|
|
216
216
|
return {
|
|
217
217
|
...cfg,
|
|
@@ -230,11 +230,11 @@ function setZalouserGroupAllowlist(
|
|
|
230
230
|
},
|
|
231
231
|
},
|
|
232
232
|
},
|
|
233
|
-
} as
|
|
233
|
+
} as PoolbotConfig;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
async function resolveZalouserGroups(params: {
|
|
237
|
-
cfg:
|
|
237
|
+
cfg: PoolbotConfig;
|
|
238
238
|
accountId: string;
|
|
239
239
|
entries: string[];
|
|
240
240
|
}): Promise<Array<{ input: string; resolved: boolean; id?: string }>> {
|
|
@@ -270,15 +270,15 @@ const dmPolicy: ChannelOnboardingDmPolicy = {
|
|
|
270
270
|
channel,
|
|
271
271
|
policyKey: "channels.zalouser.dmPolicy",
|
|
272
272
|
allowFromKey: "channels.zalouser.allowFrom",
|
|
273
|
-
getCurrent: (cfg) => ((cfg as
|
|
274
|
-
setPolicy: (cfg, policy) => setZalouserDmPolicy(cfg as
|
|
273
|
+
getCurrent: (cfg) => ((cfg as PoolbotConfig).channels?.zalouser?.dmPolicy ?? "pairing") as "pairing",
|
|
274
|
+
setPolicy: (cfg, policy) => setZalouserDmPolicy(cfg as PoolbotConfig, policy),
|
|
275
275
|
promptAllowFrom: async ({ cfg, prompter, accountId }) => {
|
|
276
276
|
const id =
|
|
277
277
|
accountId && normalizeAccountId(accountId)
|
|
278
278
|
? normalizeAccountId(accountId) ?? DEFAULT_ACCOUNT_ID
|
|
279
|
-
: resolveDefaultZalouserAccountId(cfg as
|
|
279
|
+
: resolveDefaultZalouserAccountId(cfg as PoolbotConfig);
|
|
280
280
|
return promptZalouserAllowFrom({
|
|
281
|
-
cfg: cfg as
|
|
281
|
+
cfg: cfg as PoolbotConfig,
|
|
282
282
|
prompter,
|
|
283
283
|
accountId: id,
|
|
284
284
|
});
|
|
@@ -289,10 +289,10 @@ export const zalouserOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
289
289
|
channel,
|
|
290
290
|
dmPolicy,
|
|
291
291
|
getStatus: async ({ cfg }) => {
|
|
292
|
-
const ids = listZalouserAccountIds(cfg as
|
|
292
|
+
const ids = listZalouserAccountIds(cfg as PoolbotConfig);
|
|
293
293
|
let configured = false;
|
|
294
294
|
for (const accountId of ids) {
|
|
295
|
-
const account = resolveZalouserAccountSync({ cfg: cfg as
|
|
295
|
+
const account = resolveZalouserAccountSync({ cfg: cfg as PoolbotConfig, accountId });
|
|
296
296
|
const isAuth = await checkZcaAuthenticated(account.profile);
|
|
297
297
|
if (isAuth) {
|
|
298
298
|
configured = true;
|
|
@@ -324,14 +324,14 @@ export const zalouserOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
const zalouserOverride = accountOverrides.zalouser?.trim();
|
|
327
|
-
const defaultAccountId = resolveDefaultZalouserAccountId(cfg as
|
|
327
|
+
const defaultAccountId = resolveDefaultZalouserAccountId(cfg as PoolbotConfig);
|
|
328
328
|
let accountId = zalouserOverride
|
|
329
329
|
? normalizeAccountId(zalouserOverride)
|
|
330
330
|
: defaultAccountId;
|
|
331
331
|
|
|
332
332
|
if (shouldPromptAccountIds && !zalouserOverride) {
|
|
333
333
|
accountId = await promptAccountId({
|
|
334
|
-
cfg: cfg as
|
|
334
|
+
cfg: cfg as PoolbotConfig,
|
|
335
335
|
prompter,
|
|
336
336
|
label: "Zalo Personal",
|
|
337
337
|
currentId: accountId,
|
|
@@ -340,7 +340,7 @@ export const zalouserOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
let next = cfg as
|
|
343
|
+
let next = cfg as PoolbotConfig;
|
|
344
344
|
const account = resolveZalouserAccountSync({ cfg: next, accountId });
|
|
345
345
|
const alreadyAuthenticated = await checkZcaAuthenticated(account.profile);
|
|
346
346
|
|
|
@@ -398,7 +398,7 @@ export const zalouserOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
398
398
|
profile: account.profile !== "default" ? account.profile : undefined,
|
|
399
399
|
},
|
|
400
400
|
},
|
|
401
|
-
} as
|
|
401
|
+
} as PoolbotConfig;
|
|
402
402
|
} else {
|
|
403
403
|
next = {
|
|
404
404
|
...next,
|
|
@@ -417,7 +417,7 @@ export const zalouserOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
417
417
|
},
|
|
418
418
|
},
|
|
419
419
|
},
|
|
420
|
-
} as
|
|
420
|
+
} as PoolbotConfig;
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
if (forceAllowFrom) {
|