@poolzin/pool-bot 2026.3.25 → 2026.3.26

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 (271) hide show
  1. package/dist/agents/model-fallback.js +5 -4
  2. package/dist/agents/tools/common.js +16 -201
  3. package/dist/auto-reply/auto-reply/reply/agent-runner-execution.js +502 -0
  4. package/dist/auto-reply/auto-reply/reply/agent-runner-helpers.js +65 -0
  5. package/dist/auto-reply/auto-reply/reply/agent-runner-memory.js +160 -0
  6. package/dist/auto-reply/auto-reply/reply/agent-runner-payloads.js +85 -0
  7. package/dist/auto-reply/auto-reply/reply/agent-runner-utils.js +101 -0
  8. package/dist/auto-reply/auto-reply/reply/bash-command.js +338 -0
  9. package/dist/auto-reply/auto-reply/reply/block-streaming.js +91 -0
  10. package/dist/auto-reply/auto-reply/reply/commands-approve.js +88 -0
  11. package/dist/auto-reply/auto-reply/reply/commands-bash.js +26 -0
  12. package/dist/auto-reply/auto-reply/reply/commands-compact.js +107 -0
  13. package/dist/auto-reply/auto-reply/reply/commands-config.js +241 -0
  14. package/dist/auto-reply/auto-reply/reply/commands-context-report.js +295 -0
  15. package/dist/auto-reply/auto-reply/reply/commands-context.js +30 -0
  16. package/dist/auto-reply/auto-reply/reply/commands-core.js +151 -0
  17. package/dist/auto-reply/auto-reply/reply/commands-export-session.js +163 -0
  18. package/dist/auto-reply/auto-reply/reply/commands-info.js +184 -0
  19. package/dist/auto-reply/auto-reply/reply/commands-models.js +299 -0
  20. package/dist/auto-reply/auto-reply/reply/commands-plugin.js +35 -0
  21. package/dist/auto-reply/auto-reply/reply/commands-ptt.js +171 -0
  22. package/dist/auto-reply/auto-reply/reply/commands-setunset-standard.js +13 -0
  23. package/dist/auto-reply/auto-reply/reply/commands-setunset.js +73 -0
  24. package/dist/auto-reply/auto-reply/reply/commands-slash-parse.js +31 -0
  25. package/dist/auto-reply/auto-reply/reply/commands-status.js +178 -0
  26. package/dist/auto-reply/auto-reply/reply/commands-subagents.js +73 -0
  27. package/dist/auto-reply/auto-reply/reply/commands-system-prompt.js +117 -0
  28. package/dist/auto-reply/auto-reply/reply/commands-tts.js +231 -0
  29. package/dist/auto-reply/auto-reply/reply/directive-handling.impl.js +380 -0
  30. package/dist/auto-reply/auto-reply/reply/followup-runner.js +227 -0
  31. package/dist/auto-reply/auto-reply/reply/get-reply-directives-apply.js +201 -0
  32. package/dist/auto-reply/auto-reply/reply/get-reply-directives-utils.js +54 -0
  33. package/dist/auto-reply/auto-reply/reply/get-reply-directives.js +332 -0
  34. package/dist/auto-reply/auto-reply/reply/get-reply-inline-actions.js +258 -0
  35. package/dist/auto-reply/auto-reply/reply/get-reply-run.js +297 -0
  36. package/dist/auto-reply/auto-reply/reply/groups.js +102 -0
  37. package/dist/auto-reply/auto-reply/reply/mentions.js +129 -0
  38. package/dist/auto-reply/auto-reply/reply/reply-delivery.js +92 -0
  39. package/dist/auto-reply/auto-reply/reply/reply-directives.js +30 -0
  40. package/dist/auto-reply/auto-reply/reply/reply-dispatcher.js +152 -0
  41. package/dist/auto-reply/auto-reply/reply/reply-elevated.js +166 -0
  42. package/dist/auto-reply/auto-reply/reply/reply-inline.js +28 -0
  43. package/dist/auto-reply/auto-reply/reply/reply-payloads.js +114 -0
  44. package/dist/auto-reply/auto-reply/reply/reply-reference.js +36 -0
  45. package/dist/auto-reply/auto-reply/reply/reply-tags.js +13 -0
  46. package/dist/auto-reply/auto-reply/reply/reply-threading.js +41 -0
  47. package/dist/auto-reply/auto-reply/reply/session-updates.js +233 -0
  48. package/dist/auto-reply/auto-reply/reply/stage-sandbox-media.js +146 -0
  49. package/dist/build-info.json +3 -3
  50. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  51. package/dist/canvas-host/a2ui/a2ui.bundle.js +2 -17772
  52. package/dist/canvas-host/a2ui/index.html +1 -307
  53. package/dist/channels/channels/directory-config.js +185 -0
  54. package/dist/channels/channels/discord/handle-action.guild-admin.js +332 -0
  55. package/dist/channels/channels/discord/handle-action.js +165 -0
  56. package/dist/channels/channels/discord.js +413 -0
  57. package/dist/channels/channels/dock.js +436 -0
  58. package/dist/channels/channels/index.js +51 -0
  59. package/dist/channels/channels/plugins/outbound/discord.js +101 -0
  60. package/dist/channels/channels/whatsapp.js +17 -0
  61. package/dist/channels/plugins/types.js +1 -1
  62. package/dist/channels/run-state-machine.js +7 -0
  63. package/dist/commands/models/auth.js +47 -1
  64. package/dist/commands-subagents/action-agents.js +44 -0
  65. package/dist/commands-subagents/action-focus.js +64 -0
  66. package/dist/commands-subagents/action-help.js +4 -0
  67. package/dist/commands-subagents/action-info.js +45 -0
  68. package/dist/commands-subagents/action-kill.js +60 -0
  69. package/dist/commands-subagents/action-list.js +44 -0
  70. package/dist/commands-subagents/action-log.js +29 -0
  71. package/dist/commands-subagents/action-send.js +119 -0
  72. package/dist/commands-subagents/action-spawn.js +52 -0
  73. package/dist/commands-subagents/action-unfocus.js +30 -0
  74. package/dist/commands-subagents/shared.js +303 -0
  75. package/dist/config/config.js +1 -8
  76. package/dist/config/types.secrets.js +61 -0
  77. package/dist/control-ui/assets/{index-D7shnQwQ.js → index-umCsvrWy.js} +884 -741
  78. package/dist/control-ui/assets/index-umCsvrWy.js.map +1 -0
  79. package/dist/control-ui/assets/pt-BR-DedEVAvY.js +2 -0
  80. package/dist/control-ui/assets/pt-BR-DedEVAvY.js.map +1 -0
  81. package/dist/control-ui/assets/zh-CN-CDzeklK-.js +2 -0
  82. package/dist/control-ui/assets/zh-CN-CDzeklK-.js.map +1 -0
  83. package/dist/control-ui/assets/zh-TW-BJCRYNWH.js +2 -0
  84. package/dist/control-ui/assets/zh-TW-BJCRYNWH.js.map +1 -0
  85. package/dist/control-ui/index.html +1 -1
  86. package/dist/gateway/method-scopes.js +9 -1
  87. package/dist/gateway/node-pending-work.js +142 -0
  88. package/dist/gateway/protocol/index.js +5 -1
  89. package/dist/gateway/protocol/schema/nodes.js +18 -0
  90. package/dist/gateway/server-methods/nodes-pending.js +96 -0
  91. package/dist/gateway/server-methods-list.js +4 -0
  92. package/dist/gateway/server-methods.js +2 -0
  93. package/dist/imessage/channel.js +253 -0
  94. package/dist/imessage/monitor/echo-cache.js +70 -0
  95. package/dist/imessage/monitor/loop-rate-limiter.js +51 -0
  96. package/dist/imessage/monitor/reflection-guard.js +50 -0
  97. package/dist/imessage/monitor/sanitize-outbound.js +25 -0
  98. package/dist/imessage/monitor/self-chat-cache.js +75 -0
  99. package/dist/imessage/runtime.js +3 -0
  100. package/dist/infra/exec-approval-reply.js +7 -0
  101. package/dist/infra/tmp-openclaw-dir.js +84 -0
  102. package/dist/pairing/pairing-challenge.js +15 -0
  103. package/dist/plugin-sdk/account-id.d.ts +1 -0
  104. package/dist/plugin-sdk/agent-media-payload.d.ts +12 -0
  105. package/dist/plugin-sdk/allow-from.d.ts +27 -0
  106. package/dist/plugin-sdk/command-auth.d.ts +25 -0
  107. package/dist/plugin-sdk/command-auth.js +3 -1
  108. package/dist/plugin-sdk/config-paths.d.ts +6 -0
  109. package/dist/plugin-sdk/file-lock.d.ts +16 -0
  110. package/dist/plugin-sdk/index.d.ts +428 -0
  111. package/dist/plugin-sdk/index.js +237 -103
  112. package/dist/plugin-sdk/json-store.d.ts +5 -0
  113. package/dist/plugin-sdk/keyed-async-queue.d.ts +12 -0
  114. package/dist/plugin-sdk/onboarding.d.ts +11 -0
  115. package/dist/plugin-sdk/provider-auth-result.d.ts +14 -0
  116. package/dist/plugin-sdk/slack-message-actions.d.ts +11 -0
  117. package/dist/plugin-sdk/status-helpers.d.ts +25 -0
  118. package/dist/plugin-sdk/temp-path.d.ts +12 -0
  119. package/dist/plugin-sdk/text-chunking.d.ts +1 -0
  120. package/dist/plugin-sdk/tool-send.d.ts +4 -0
  121. package/dist/plugin-sdk/webhook-path.d.ts +6 -0
  122. package/dist/plugin-sdk/webhook-targets.d.ts +23 -0
  123. package/dist/plugin-sdk/windows-spawn.d.ts +39 -0
  124. package/dist/plugin-sdk-internal/accounts.js +6 -0
  125. package/dist/plugin-sdk-internal/discord.js +23 -0
  126. package/dist/plugin-sdk-internal/imessage.js +13 -0
  127. package/dist/plugin-sdk-internal/setup.js +9 -0
  128. package/dist/plugin-sdk-internal/signal.js +13 -0
  129. package/dist/plugin-sdk-internal/slack.js +22 -0
  130. package/dist/plugin-sdk-internal/telegram.js +32 -0
  131. package/dist/plugin-sdk-internal/whatsapp.js +29 -0
  132. package/dist/routing/session-key.js +4 -185
  133. package/dist/shared/pid-alive.js +2 -61
  134. package/dist/shared/process-scoped-map.js +5 -7
  135. package/dist/signal/channel.js +264 -0
  136. package/dist/signal/monitor/access-policy.js +60 -0
  137. package/dist/signal/runtime.js +3 -0
  138. package/dist/slack/account-inspect.js +135 -0
  139. package/dist/slack/blocks-input.js +7 -38
  140. package/dist/slack/channel.js +394 -0
  141. package/dist/slack/interactive-replies.js +28 -0
  142. package/dist/slack/monitor/channel-type.js +31 -0
  143. package/dist/slack/monitor/dm-auth.js +49 -0
  144. package/dist/slack/monitor/events/interactions.modal.js +137 -0
  145. package/dist/slack/monitor/events/message-subtype-handlers.js +68 -0
  146. package/dist/slack/monitor/events/system-event-context.js +29 -0
  147. package/dist/slack/monitor/events/system-event-test-harness.js +41 -0
  148. package/dist/slack/monitor/external-arg-menu-store.js +46 -0
  149. package/dist/slack/monitor/message-handler/prepare-content.js +69 -0
  150. package/dist/slack/monitor/message-handler/prepare-thread-context.js +91 -0
  151. package/dist/slack/monitor/message-handler/prepare.test-helpers.js +55 -0
  152. package/dist/slack/monitor/reconnect-policy.js +78 -0
  153. package/dist/slack/monitor/slash-commands.runtime.js +1 -0
  154. package/dist/slack/monitor/slash-dispatch.runtime.js +9 -0
  155. package/dist/slack/monitor/slash-skill-commands.runtime.js +1 -0
  156. package/dist/slack/resolve-allowlist-common.js +36 -0
  157. package/dist/slack/runtime.js +3 -0
  158. package/dist/slack/sent-thread-cache.js +61 -0
  159. package/dist/slack/truncate.js +10 -0
  160. package/dist/telegram/account-inspect.js +175 -0
  161. package/dist/telegram/allow-from.js +10 -0
  162. package/dist/telegram/api-fetch.js +18 -0
  163. package/dist/telegram/approval-buttons.js +30 -0
  164. package/dist/telegram/audit-membership-runtime.js +61 -0
  165. package/dist/telegram/bot/delivery.replies.js +508 -0
  166. package/dist/telegram/bot/delivery.resolve-media.js +227 -0
  167. package/dist/telegram/bot/delivery.send.js +132 -0
  168. package/dist/telegram/bot/reply-threading.js +46 -0
  169. package/dist/telegram/bot-message-context.body.js +186 -0
  170. package/dist/telegram/bot-message-context.session.js +207 -0
  171. package/dist/telegram/bot-message-context.types.js +1 -0
  172. package/dist/telegram/bot-native-commands.test-helpers.js +117 -0
  173. package/dist/telegram/bot.media.e2e-harness.js +81 -0
  174. package/dist/telegram/bot.media.test-utils.js +81 -0
  175. package/dist/telegram/channel-actions.js +225 -0
  176. package/dist/telegram/channel.js +515 -0
  177. package/dist/telegram/conversation-route.js +107 -0
  178. package/dist/telegram/delivery.js +2 -0
  179. package/dist/telegram/delivery.replies.js +508 -0
  180. package/dist/telegram/dm-access.js +86 -0
  181. package/dist/telegram/draft-stream.test-helpers.js +62 -0
  182. package/dist/telegram/exec-approvals-handler.js +281 -0
  183. package/dist/telegram/exec-approvals.js +62 -0
  184. package/dist/telegram/forum-service-message.js +22 -0
  185. package/dist/telegram/group-config-helpers.js +10 -0
  186. package/dist/telegram/lane-delivery-state.js +19 -0
  187. package/dist/telegram/lane-delivery-text-deliverer.js +357 -0
  188. package/dist/telegram/lane-delivery.js +2 -0
  189. package/dist/telegram/normalize.js +37 -0
  190. package/dist/telegram/onboarding.js +192 -0
  191. package/dist/telegram/outbound-adapter.js +100 -0
  192. package/dist/telegram/polling-session.js +275 -0
  193. package/dist/telegram/runtime.js +3 -0
  194. package/dist/telegram/sendchataction-401-backoff.js +71 -0
  195. package/dist/telegram/sequential-key.js +46 -0
  196. package/dist/telegram/status-issues.js +105 -0
  197. package/dist/telegram/target-writeback.js +165 -0
  198. package/dist/telegram/thread-bindings.js +560 -0
  199. package/dist/utils.js +10 -276
  200. package/dist/wizard/prompts.js +5 -5
  201. package/extensions/feishu/src/policy.ts +1 -1
  202. package/extensions/firecrawl/index.test.ts +82 -0
  203. package/extensions/firecrawl/index.ts +20 -0
  204. package/extensions/firecrawl/openclaw.plugin.json +8 -0
  205. package/extensions/firecrawl/package.json +12 -0
  206. package/extensions/firecrawl/src/config.ts +159 -0
  207. package/extensions/firecrawl/src/firecrawl-client.ts +446 -0
  208. package/extensions/firecrawl/src/firecrawl-scrape-tool.ts +89 -0
  209. package/extensions/firecrawl/src/firecrawl-search-provider.ts +63 -0
  210. package/extensions/firecrawl/src/firecrawl-search-tool.ts +76 -0
  211. package/package.json +1 -1
  212. package/dist/.buildstamp +0 -1
  213. package/dist/acp/bindings-store.js +0 -209
  214. package/dist/acp/control-plane/runtime-cache.js +0 -54
  215. package/dist/acp/control-plane/runtime-options.js +0 -215
  216. package/dist/acp/control-plane/session-actor-queue.js +0 -36
  217. package/dist/acp/index.js +0 -2
  218. package/dist/acp/runtime/errors.js +0 -47
  219. package/dist/acp/runtime/registry.js +0 -86
  220. package/dist/acp/secret-file.js +0 -22
  221. package/dist/agents/auth-profiles.resolve-auth-profile-order.fixtures.js +0 -23
  222. package/dist/agents/bash-process-registry.test-helpers.js +0 -29
  223. package/dist/agents/bash-tools.exec-approval-request.js +0 -20
  224. package/dist/agents/bash-tools.exec-host-gateway.js +0 -240
  225. package/dist/agents/bash-tools.exec-host-node.js +0 -235
  226. package/dist/agents/checkpoint-manager.js +0 -290
  227. package/dist/agents/claude-cli-runner.js +0 -3
  228. package/dist/agents/error-classifier.js +0 -251
  229. package/dist/agents/live-model-filter.js +0 -84
  230. package/dist/agents/nvidia-models.js +0 -228
  231. package/dist/agents/pi-embedded-runner/run.overflow-compaction.fixture.js +0 -34
  232. package/dist/agents/pi-embedded-runner/run.overflow-compaction.mocks.shared.js +0 -156
  233. package/dist/agents/pi-embedded-subscribe.handlers.tools.media.test-helpers.js +0 -30
  234. package/dist/agents/provider/config-loader.js +0 -76
  235. package/dist/agents/provider/index.js +0 -15
  236. package/dist/agents/provider/models-dev.js +0 -129
  237. package/dist/agents/provider/session-binding.js +0 -376
  238. package/dist/agents/queued-file-writer.js +0 -22
  239. package/dist/agents/skills/bundled-context.js +0 -23
  240. package/dist/agents/skills/security.js +0 -211
  241. package/dist/agents/skills/tools-dir.js +0 -9
  242. package/dist/agents/skills-install-download.js +0 -290
  243. package/dist/agents/skills-install-output.js +0 -30
  244. package/dist/agents/skills-install.download-test-utils.js +0 -36
  245. package/dist/agents/skills.test-helpers.js +0 -13
  246. package/dist/agents/subagent-announce-reliability.js +0 -160
  247. package/dist/agents/subagent-registry.mocks.shared.js +0 -12
  248. package/dist/agents/test-helpers/assistant-message-fixtures.js +0 -29
  249. package/dist/agents/test-helpers/fast-coding-tools.js +0 -1
  250. package/dist/agents/test-helpers/fast-core-tools.js +0 -8
  251. package/dist/agents/test-helpers/fast-tool-stubs.js +0 -18
  252. package/dist/agents/test-helpers/host-sandbox-fs-bridge.js +0 -74
  253. package/dist/agents/test-helpers/pi-tools-sandbox-context.js +0 -27
  254. package/dist/agents/tool-display-common.js +0 -915
  255. package/dist/agents/tool-policy-shared.js +0 -108
  256. package/dist/agents/tool-policy.conformance.js +0 -14
  257. package/dist/agents/tool-result-truncation.js +0 -299
  258. package/dist/agents/tools/cron-tool.test-helpers.js +0 -12
  259. package/dist/agents/tools/discord-actions-moderation-shared.js +0 -27
  260. package/dist/agents/tools/discord-actions-presence.js +0 -78
  261. package/dist/control-ui/assets/index-D7shnQwQ.js.map +0 -1
  262. package/dist/discord/discord-improvements.js +0 -167
  263. package/dist/discord/index.js +0 -2
  264. package/dist/hooks/bundled/boot-md/HOOK.md +0 -19
  265. package/dist/hooks/bundled/command-logger/HOOK.md +0 -122
  266. package/dist/hooks/bundled/session-memory/HOOK.md +0 -86
  267. package/dist/hooks/bundled/soul-evil/HOOK.md +0 -71
  268. package/dist/whatsapp/normalize.js +0 -66
  269. package/dist/whatsapp/resolve-outbound-target.js +0 -42
  270. /package/dist/{acp/runtime/types.js → auto-reply/auto-reply/reply/commands-types.js} +0 -0
  271. /package/dist/{agents/pi-embedded-payloads.js → slack/account-surface-fields.js} +0 -0
@@ -1,167 +0,0 @@
1
- /**
2
- * Discord Channel Improvements
3
- *
4
- * Implements OpenClaw improvements:
5
- * - Thread-bound subagent sessions (enhanced)
6
- * - Status reactions configuráveis
7
- * - Voice channel join/leave via /vc
8
- * - Native slash command auth
9
- * - Component interactions with wildcard handlers
10
- *
11
- * OpenClaw #32384, #30951
12
- */
13
- export const DEFAULT_VOICE_CHANNEL_CONFIG = {
14
- enabled: true,
15
- autoJoin: false,
16
- autoLeaveAfterSilenceMs: 5 * 60 * 1000, // 5 minutes
17
- maxChannelsPerGuild: 5,
18
- enableTts: false,
19
- };
20
- const voiceChannelSessions = new Map();
21
- /**
22
- * Get or create voice channel session
23
- */
24
- export function getOrCreateVoiceChannelSession(params) {
25
- const { channelId, guildId, ttsEnabled = false } = params;
26
- const key = `${guildId}:${channelId}`;
27
- const existing = voiceChannelSessions.get(key);
28
- if (existing) {
29
- return existing;
30
- }
31
- const session = {
32
- channelId,
33
- guildId,
34
- joinedAt: Date.now(),
35
- lastActivityAt: Date.now(),
36
- ttsEnabled,
37
- };
38
- voiceChannelSessions.set(key, session);
39
- return session;
40
- }
41
- /**
42
- * Update voice channel session activity
43
- */
44
- export function updateVoiceChannelActivity(channelId, guildId) {
45
- const key = `${guildId}:${channelId}`;
46
- const session = voiceChannelSessions.get(key);
47
- if (session) {
48
- session.lastActivityAt = Date.now();
49
- }
50
- }
51
- /**
52
- * Remove voice channel session
53
- */
54
- export function removeVoiceChannelSession(channelId, guildId) {
55
- const key = `${guildId}:${channelId}`;
56
- return voiceChannelSessions.delete(key);
57
- }
58
- /**
59
- * Check for stale voice channel sessions
60
- */
61
- export function getStaleVoiceChannelSessions(config = DEFAULT_VOICE_CHANNEL_CONFIG) {
62
- const now = Date.now();
63
- const stale = [];
64
- for (const session of voiceChannelSessions.values()) {
65
- if (now - session.lastActivityAt > config.autoLeaveAfterSilenceMs) {
66
- stale.push(session);
67
- }
68
- }
69
- return stale;
70
- }
71
- export const DEFAULT_SLASH_COMMAND_AUTH_CONFIG = {
72
- enabled: true,
73
- requireAuthForAll: false,
74
- protectedCommands: ["admin", "config", "pair", "auth"],
75
- allowLoopback: true,
76
- authTimeoutMs: 5 * 60 * 1000, // 5 minutes
77
- };
78
- /**
79
- * Check if a slash command requires authentication
80
- */
81
- export function isSlashCommandProtected(commandName, config = DEFAULT_SLASH_COMMAND_AUTH_CONFIG) {
82
- if (!config.enabled) {
83
- return false;
84
- }
85
- if (config.requireAuthForAll) {
86
- return true;
87
- }
88
- return config.protectedCommands.includes(commandName.toLowerCase());
89
- }
90
- export const DEFAULT_COMPONENT_INTERACTION_CONFIG = {
91
- enabled: true,
92
- wildcardPatterns: ["action:*", "button:*", "select:*", "modal:*"],
93
- rateLimitPerMinute: 60,
94
- responseTimeoutMs: 3000, // Discord requires response within 3 seconds
95
- };
96
- /**
97
- * Match custom ID against wildcard patterns
98
- */
99
- export function matchWildcardPattern(customId, config = DEFAULT_COMPONENT_INTERACTION_CONFIG) {
100
- if (!config.enabled) {
101
- return null;
102
- }
103
- for (const pattern of config.wildcardPatterns) {
104
- // Convert wildcard pattern to regex
105
- // * matches any characters except :
106
- const regexPattern = pattern.replace(/\*/g, "[^:]*");
107
- const regex = new RegExp(`^${regexPattern}$`);
108
- if (regex.test(customId)) {
109
- return pattern;
110
- }
111
- }
112
- return null;
113
- }
114
- /**
115
- * Component interaction rate limiting
116
- */
117
- const interactionCounts = new Map();
118
- /**
119
- * Check if component interaction is rate limited
120
- */
121
- export function checkComponentInteractionRateLimit(userId, config = DEFAULT_COMPONENT_INTERACTION_CONFIG) {
122
- const now = Date.now();
123
- const windowMs = 60_000; // 1 minute
124
- const timestamps = interactionCounts.get(userId) ?? [];
125
- const recentTimestamps = timestamps.filter((ts) => now - ts < windowMs);
126
- if (recentTimestamps.length >= config.rateLimitPerMinute) {
127
- const oldestTimestamp = recentTimestamps[0];
128
- const retryAfterMs = windowMs - (now - oldestTimestamp);
129
- return { allowed: false, retryAfterMs };
130
- }
131
- recentTimestamps.push(now);
132
- interactionCounts.set(userId, recentTimestamps);
133
- return { allowed: true };
134
- }
135
- export const DEFAULT_THREAD_BINDING_ENHANCEMENT = {
136
- autoBindSubagents: true,
137
- threadTtlMs: 60 * 60 * 1000, // 1 hour
138
- autoUnbindOnSessionEnd: true,
139
- maxThreadsPerSession: 10,
140
- };
141
- export const DEFAULT_DISCORD_STATUS_REACTION_CONFIG = {
142
- enabled: true,
143
- showInThreads: true,
144
- showInChannels: false, // Don't spam channels by default
145
- useEmojiReactions: true,
146
- useEmbedStatus: false,
147
- emojis: {
148
- queued: "👀",
149
- thinking: "🤔",
150
- tool: "⚡",
151
- coding: "👨‍💻",
152
- web: "🌐",
153
- done: "✅",
154
- error: "❌",
155
- stallSoft: "⏳",
156
- stallHard: "⚠️",
157
- },
158
- };
159
- /**
160
- * Get status reaction emoji for a given status
161
- */
162
- export function getStatusReactionEmoji(status, config = DEFAULT_DISCORD_STATUS_REACTION_CONFIG) {
163
- if (!config.enabled) {
164
- return null;
165
- }
166
- return config.emojis[status.toLowerCase()] ?? null;
167
- }
@@ -1,2 +0,0 @@
1
- export { monitorDiscordProvider } from "./monitor.js";
2
- export { sendMessageDiscord, sendPollDiscord } from "./send.js";
@@ -1,19 +0,0 @@
1
- ---
2
- name: boot-md
3
- description: "Run BOOT.md on gateway startup"
4
- homepage: https://docs.molt.bot/hooks#boot-md
5
- metadata:
6
- {
7
- "poolbot":
8
- {
9
- "emoji": "🚀",
10
- "events": ["gateway:startup"],
11
- "requires": { "config": ["workspace.dir"] },
12
- "install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Pool Bot" }],
13
- },
14
- }
15
- ---
16
-
17
- # Boot Checklist Hook
18
-
19
- Runs `BOOT.md` every time the gateway starts, if the file exists in the workspace.
@@ -1,122 +0,0 @@
1
- ---
2
- name: command-logger
3
- description: "Log all command events to a centralized audit file"
4
- homepage: https://docs.molt.bot/hooks#command-logger
5
- metadata:
6
- {
7
- "poolbot":
8
- {
9
- "emoji": "📝",
10
- "events": ["command"],
11
- "install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Pool Bot" }],
12
- },
13
- }
14
- ---
15
-
16
- # Command Logger Hook
17
-
18
- Logs all command events (`/new`, `/reset`, `/stop`, etc.) to a centralized audit log file for debugging and monitoring purposes.
19
-
20
- ## What It Does
21
-
22
- Every time you issue a command to the agent:
23
-
24
- 1. **Captures event details** - Command action, timestamp, session key, sender ID, source
25
- 2. **Appends to log file** - Writes a JSON line to `~/.poolbot/logs/commands.log`
26
- 3. **Silent operation** - Runs in the background without user notifications
27
-
28
- ## Output Format
29
-
30
- Log entries are written in JSONL (JSON Lines) format:
31
-
32
- ```json
33
- {"timestamp":"2026-01-16T14:30:00.000Z","action":"new","sessionKey":"agent:main:main","senderId":"+1234567890","source":"telegram"}
34
- {"timestamp":"2026-01-16T15:45:22.000Z","action":"stop","sessionKey":"agent:main:main","senderId":"user@example.com","source":"whatsapp"}
35
- ```
36
-
37
- ## Use Cases
38
-
39
- - **Debugging**: Track when commands were issued and from which source
40
- - **Auditing**: Monitor command usage across different channels
41
- - **Analytics**: Analyze command patterns and frequency
42
- - **Troubleshooting**: Investigate issues by reviewing command history
43
-
44
- ## Log File Location
45
-
46
- `~/.poolbot/logs/commands.log`
47
-
48
- ## Requirements
49
-
50
- No requirements - this hook works out of the box on all platforms.
51
-
52
- ## Configuration
53
-
54
- No configuration needed. The hook automatically:
55
-
56
- - Creates the log directory if it doesn't exist
57
- - Appends to the log file (doesn't overwrite)
58
- - Handles errors silently without disrupting command execution
59
-
60
- ## Disabling
61
-
62
- To disable this hook:
63
-
64
- ```bash
65
- poolbot hooks disable command-logger
66
- ```
67
-
68
- Or via config:
69
-
70
- ```json
71
- {
72
- "hooks": {
73
- "internal": {
74
- "entries": {
75
- "command-logger": { "enabled": false }
76
- }
77
- }
78
- }
79
- }
80
- ```
81
-
82
- ## Log Rotation
83
-
84
- The hook does not automatically rotate logs. To manage log size, you can:
85
-
86
- 1. **Manual rotation**:
87
-
88
- ```bash
89
- mv ~/.poolbot/logs/commands.log ~/.poolbot/logs/commands.log.old
90
- ```
91
-
92
- 2. **Use logrotate** (Linux):
93
- Create `/etc/logrotate.d/poolbot`:
94
- ```
95
- /home/username/.poolbot/logs/commands.log {
96
- weekly
97
- rotate 4
98
- compress
99
- missingok
100
- notifempty
101
- }
102
- ```
103
-
104
- ## Viewing Logs
105
-
106
- View recent commands:
107
-
108
- ```bash
109
- tail -n 20 ~/.poolbot/logs/commands.log
110
- ```
111
-
112
- Pretty-print with jq:
113
-
114
- ```bash
115
- cat ~/.poolbot/logs/commands.log | jq .
116
- ```
117
-
118
- Filter by action:
119
-
120
- ```bash
121
- grep '"action":"new"' ~/.poolbot/logs/commands.log | jq .
122
- ```
@@ -1,86 +0,0 @@
1
- ---
2
- name: session-memory
3
- description: "Save session context to memory when /new command is issued"
4
- homepage: https://docs.molt.bot/hooks#session-memory
5
- metadata:
6
- {
7
- "poolbot":
8
- {
9
- "emoji": "💾",
10
- "events": ["command:new"],
11
- "requires": { "config": ["workspace.dir"] },
12
- "install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Pool Bot" }],
13
- },
14
- }
15
- ---
16
-
17
- # Session Memory Hook
18
-
19
- Automatically saves session context to your workspace memory when you issue the `/new` command.
20
-
21
- ## What It Does
22
-
23
- When you run `/new` to start a fresh session:
24
-
25
- 1. **Finds the previous session** - Uses the pre-reset session entry to locate the correct transcript
26
- 2. **Extracts conversation** - Reads the last 15 lines of conversation from the session
27
- 3. **Generates descriptive slug** - Uses LLM to create a meaningful filename slug based on conversation content
28
- 4. **Saves to memory** - Creates a new file at `<workspace>/memory/YYYY-MM-DD-slug.md`
29
- 5. **Sends confirmation** - Notifies you with the file path
30
-
31
- ## Output Format
32
-
33
- Memory files are created with the following format:
34
-
35
- ```markdown
36
- # Session: 2026-01-16 14:30:00 UTC
37
-
38
- - **Session Key**: agent:main:main
39
- - **Session ID**: abc123def456
40
- - **Source**: telegram
41
- ```
42
-
43
- ## Filename Examples
44
-
45
- The LLM generates descriptive slugs based on your conversation:
46
-
47
- - `2026-01-16-vendor-pitch.md` - Discussion about vendor evaluation
48
- - `2026-01-16-api-design.md` - API architecture planning
49
- - `2026-01-16-bug-fix.md` - Debugging session
50
- - `2026-01-16-1430.md` - Fallback timestamp if slug generation fails
51
-
52
- ## Requirements
53
-
54
- - **Config**: `workspace.dir` must be set (automatically configured during onboarding)
55
-
56
- The hook uses your configured LLM provider to generate slugs, so it works with any provider (Anthropic, OpenAI, etc.).
57
-
58
- ## Configuration
59
-
60
- No additional configuration required. The hook automatically:
61
-
62
- - Uses your workspace directory (`~/clawd` by default)
63
- - Uses your configured LLM for slug generation
64
- - Falls back to timestamp slugs if LLM is unavailable
65
-
66
- ## Disabling
67
-
68
- To disable this hook:
69
-
70
- ```bash
71
- poolbot hooks disable session-memory
72
- ```
73
-
74
- Or remove it from your config:
75
-
76
- ```json
77
- {
78
- "hooks": {
79
- "internal": {
80
- "entries": {
81
- "session-memory": { "enabled": false }
82
- }
83
- }
84
- }
85
- }
86
- ```
@@ -1,71 +0,0 @@
1
- ---
2
- name: soul-evil
3
- description: "Swap SOUL.md with SOUL_EVIL.md during a purge window or by random chance"
4
- homepage: https://docs.molt.bot/hooks/soul-evil
5
- metadata:
6
- {
7
- "poolbot":
8
- {
9
- "emoji": "😈",
10
- "events": ["agent:bootstrap"],
11
- "requires": { "config": ["hooks.internal.entries.soul-evil.enabled"] },
12
- "install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Pool Bot" }],
13
- },
14
- }
15
- ---
16
-
17
- # SOUL Evil Hook
18
-
19
- Replaces the injected `SOUL.md` content with `SOUL_EVIL.md` during a daily purge window or by random chance.
20
-
21
- ## What It Does
22
-
23
- When enabled and the trigger conditions match, the hook swaps the **injected** `SOUL.md` content before the system prompt is built. It does **not** modify files on disk.
24
-
25
- ## Files
26
-
27
- - `SOUL.md` — normal persona (always read)
28
- - `SOUL_EVIL.md` — alternate persona (read only when triggered)
29
-
30
- You can change the filename via hook config.
31
-
32
- ## Configuration
33
-
34
- Add this to your config (`~/.poolbot/poolbot.json`):
35
-
36
- ```json
37
- {
38
- "hooks": {
39
- "internal": {
40
- "enabled": true,
41
- "entries": {
42
- "soul-evil": {
43
- "enabled": true,
44
- "file": "SOUL_EVIL.md",
45
- "chance": 0.1,
46
- "purge": { "at": "21:00", "duration": "15m" }
47
- }
48
- }
49
- }
50
- }
51
- }
52
- ```
53
-
54
- ### Options
55
-
56
- - `file` (string): alternate SOUL filename (default: `SOUL_EVIL.md`)
57
- - `chance` (number 0–1): random chance per run to swap in SOUL_EVIL
58
- - `purge.at` (HH:mm): daily purge window start time (24h)
59
- - `purge.duration` (duration): window length (e.g. `30s`, `10m`, `1h`)
60
-
61
- **Precedence:** purge window wins over chance.
62
-
63
- ## Requirements
64
-
65
- - `hooks.internal.entries.soul-evil.enabled` must be set to `true`
66
-
67
- ## Enable
68
-
69
- ```bash
70
- poolbot hooks enable soul-evil
71
- ```
@@ -1,66 +0,0 @@
1
- import { normalizeE164 } from "../utils.js";
2
- const WHATSAPP_USER_JID_RE = /^(\d+)(?::\d+)?@s\.whatsapp\.net$/i;
3
- const WHATSAPP_LID_RE = /^(\d+)@lid$/i;
4
- function stripWhatsAppTargetPrefixes(value) {
5
- let candidate = value.trim();
6
- for (;;) {
7
- const before = candidate;
8
- candidate = candidate.replace(/^whatsapp:/i, "").trim();
9
- if (candidate === before)
10
- return candidate;
11
- }
12
- }
13
- export function isWhatsAppGroupJid(value) {
14
- const candidate = stripWhatsAppTargetPrefixes(value);
15
- const lower = candidate.toLowerCase();
16
- if (!lower.endsWith("@g.us"))
17
- return false;
18
- const localPart = candidate.slice(0, candidate.length - "@g.us".length);
19
- if (!localPart || localPart.includes("@"))
20
- return false;
21
- return /^[0-9]+(-[0-9]+)*$/.test(localPart);
22
- }
23
- /**
24
- * Check if value looks like a WhatsApp user target (e.g. "41796666864:0@s.whatsapp.net" or "123@lid").
25
- */
26
- export function isWhatsAppUserTarget(value) {
27
- const candidate = stripWhatsAppTargetPrefixes(value);
28
- return WHATSAPP_USER_JID_RE.test(candidate) || WHATSAPP_LID_RE.test(candidate);
29
- }
30
- /**
31
- * Extract the phone number from a WhatsApp user JID.
32
- * "41796666864:0@s.whatsapp.net" -> "41796666864"
33
- * "123456@lid" -> "123456"
34
- */
35
- function extractUserJidPhone(jid) {
36
- const userMatch = jid.match(WHATSAPP_USER_JID_RE);
37
- if (userMatch)
38
- return userMatch[1];
39
- const lidMatch = jid.match(WHATSAPP_LID_RE);
40
- if (lidMatch)
41
- return lidMatch[1];
42
- return null;
43
- }
44
- export function normalizeWhatsAppTarget(value) {
45
- const candidate = stripWhatsAppTargetPrefixes(value);
46
- if (!candidate)
47
- return null;
48
- if (isWhatsAppGroupJid(candidate)) {
49
- const localPart = candidate.slice(0, candidate.length - "@g.us".length);
50
- return `${localPart}@g.us`;
51
- }
52
- // Handle user JIDs (e.g. "41796666864:0@s.whatsapp.net")
53
- if (isWhatsAppUserTarget(candidate)) {
54
- const phone = extractUserJidPhone(candidate);
55
- if (!phone)
56
- return null;
57
- const normalized = normalizeE164(phone);
58
- return normalized.length > 1 ? normalized : null;
59
- }
60
- // If the caller passed a JID-ish string that we don't understand, fail fast.
61
- // Otherwise normalizeE164 would happily treat "group:120@g.us" as a phone number.
62
- if (candidate.includes("@"))
63
- return null;
64
- const normalized = normalizeE164(candidate);
65
- return normalized.length > 1 ? normalized : null;
66
- }
@@ -1,42 +0,0 @@
1
- import { missingTargetError } from "../infra/outbound/target-errors.js";
2
- import { isWhatsAppGroupJid, normalizeWhatsAppTarget } from "./normalize.js";
3
- export function resolveWhatsAppOutboundTarget(params) {
4
- const trimmed = params.to?.trim() ?? "";
5
- const allowListRaw = (params.allowFrom ?? [])
6
- .map((entry) => String(entry).trim())
7
- .filter(Boolean);
8
- const hasWildcard = allowListRaw.includes("*");
9
- const allowList = allowListRaw
10
- .filter((entry) => entry !== "*")
11
- .map((entry) => normalizeWhatsAppTarget(entry))
12
- .filter((entry) => Boolean(entry));
13
- if (trimmed) {
14
- const normalizedTo = normalizeWhatsAppTarget(trimmed);
15
- if (!normalizedTo) {
16
- return {
17
- ok: false,
18
- error: missingTargetError("WhatsApp", "<E.164|group JID>"),
19
- };
20
- }
21
- if (isWhatsAppGroupJid(normalizedTo)) {
22
- return { ok: true, to: normalizedTo };
23
- }
24
- if (params.mode === "implicit" || params.mode === "heartbeat") {
25
- if (hasWildcard || allowList.length === 0) {
26
- return { ok: true, to: normalizedTo };
27
- }
28
- if (allowList.includes(normalizedTo)) {
29
- return { ok: true, to: normalizedTo };
30
- }
31
- return {
32
- ok: false,
33
- error: missingTargetError("WhatsApp", "<E.164|group JID>"),
34
- };
35
- }
36
- return { ok: true, to: normalizedTo };
37
- }
38
- return {
39
- ok: false,
40
- error: missingTargetError("WhatsApp", "<E.164|group JID>"),
41
- };
42
- }