@poolzin/pool-bot 2026.3.7 → 2026.3.10

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 (150) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +147 -69
  3. package/dist/.buildstamp +1 -1
  4. package/dist/agents/error-classifier.js +251 -0
  5. package/dist/agents/skills/security.js +211 -0
  6. package/dist/build-info.json +3 -3
  7. package/dist/cli/cron-cli/register.cron-dashboard.js +339 -0
  8. package/dist/cli/cron-cli/register.js +2 -0
  9. package/dist/cli/errors.js +187 -0
  10. package/dist/cli/lazy-commands.example.js +113 -0
  11. package/dist/cli/lazy-commands.js +329 -0
  12. package/dist/cli/program/command-registry.js +26 -0
  13. package/dist/cli/program/register.maintenance.js +21 -0
  14. package/dist/cli/program/register.skills.js +4 -0
  15. package/dist/cli/program/register.subclis.js +9 -0
  16. package/dist/cli/swarm-cli/register.js +8 -0
  17. package/dist/cli/swarm-cli/register.swarm-status.js +488 -0
  18. package/dist/cli/telemetry-cli/register.js +10 -0
  19. package/dist/cli/telemetry-cli/register.telemetry-alerts.js +176 -0
  20. package/dist/cli/telemetry-cli/register.telemetry-metrics.js +323 -0
  21. package/dist/cli/telemetry-cli/register.telemetry-status.js +179 -0
  22. package/dist/commands/doctor-checks.js +498 -0
  23. package/dist/config/config.js +1 -0
  24. package/dist/config/secrets-integration.js +88 -0
  25. package/dist/context-engine/index.js +33 -0
  26. package/dist/context-engine/legacy.js +179 -0
  27. package/dist/context-engine/registry.js +86 -0
  28. package/dist/context-engine/summarizing.js +290 -0
  29. package/dist/context-engine/types.js +7 -0
  30. package/dist/cron/service/timer.js +18 -0
  31. package/dist/gateway/protocol/index.js +5 -2
  32. package/dist/gateway/protocol/schema/error-codes.js +1 -0
  33. package/dist/gateway/protocol/schema/swarm.js +80 -0
  34. package/dist/gateway/protocol/schema.js +1 -0
  35. package/dist/gateway/server-close.js +4 -0
  36. package/dist/gateway/server-constants.js +1 -0
  37. package/dist/gateway/server-cron.js +29 -0
  38. package/dist/gateway/server-maintenance.js +35 -2
  39. package/dist/gateway/server-methods/swarm.js +58 -0
  40. package/dist/gateway/server-methods/telemetry.js +71 -0
  41. package/dist/gateway/server-methods-list.js +8 -0
  42. package/dist/gateway/server-methods.js +9 -2
  43. package/dist/gateway/server.impl.js +33 -16
  44. package/dist/infra/abort-pattern.js +106 -0
  45. package/dist/infra/retry.js +96 -0
  46. package/dist/secrets/index.js +28 -0
  47. package/dist/secrets/resolver.js +185 -0
  48. package/dist/secrets/runtime.js +142 -0
  49. package/dist/secrets/types.js +11 -0
  50. package/dist/security/dangerous-tools.js +80 -0
  51. package/dist/security/types.js +12 -0
  52. package/dist/skills/commands.js +333 -0
  53. package/dist/skills/index.js +164 -0
  54. package/dist/skills/loader.js +282 -0
  55. package/dist/skills/parser.js +446 -0
  56. package/dist/skills/registry.js +394 -0
  57. package/dist/skills/security.js +312 -0
  58. package/dist/skills/types.js +21 -0
  59. package/dist/swarm/service.js +247 -0
  60. package/dist/telemetry/alert-engine.js +258 -0
  61. package/dist/telemetry/cron-instrumentation.js +49 -0
  62. package/dist/telemetry/gateway-instrumentation.js +80 -0
  63. package/dist/telemetry/instrumentation.js +66 -0
  64. package/dist/telemetry/service.js +345 -0
  65. package/dist/test-utils/index.js +219 -0
  66. package/dist/tui/components/assistant-message.js +6 -2
  67. package/dist/tui/components/hyperlink-markdown.js +32 -0
  68. package/dist/tui/components/searchable-select-list.js +12 -1
  69. package/dist/tui/components/user-message.js +6 -2
  70. package/dist/tui/index.js +611 -0
  71. package/dist/tui/theme/theme-detection.js +226 -0
  72. package/dist/tui/tui-command-handlers.js +20 -0
  73. package/dist/tui/tui-formatters.js +4 -3
  74. package/dist/tui/utils/ctrl-c-handler.js +67 -0
  75. package/dist/tui/utils/osc8-hyperlinks.js +208 -0
  76. package/dist/tui/utils/safe-stop.js +180 -0
  77. package/dist/tui/utils/session-key-utils.js +81 -0
  78. package/dist/tui/utils/text-sanitization.js +284 -0
  79. package/dist/utils/lru-cache.js +116 -0
  80. package/dist/utils/performance.js +199 -0
  81. package/dist/utils/retry.js +240 -0
  82. package/docs/INTEGRATION_PLAN.md +475 -0
  83. package/docs/INTEGRATION_SUMMARY.md +215 -0
  84. package/docs/MELHORIAS_IMPLEMENTADAS.md +228 -0
  85. package/docs/MELHORIAS_PROFISSIONAIS.md +282 -0
  86. package/docs/PLANO_ACAO_TUI.md +357 -0
  87. package/docs/PROGRESSO_TUI.md +66 -0
  88. package/docs/RELATORIO_FINAL.md +217 -0
  89. package/docs/diagnostico-shell-completion.md +265 -0
  90. package/docs/features/advanced-memory.md +585 -0
  91. package/docs/features/discord-components-v2.md +277 -0
  92. package/docs/features/swarm.md +100 -0
  93. package/docs/features/telemetry.md +284 -0
  94. package/docs/integrations/HEXSTRIKE_PLAN.md +796 -0
  95. package/docs/integrations/INTEGRATION_PLAN.md +744 -0
  96. package/docs/integrations/PAGE_AGENT_PLAN.md +370 -0
  97. package/docs/integrations/XYOPS_PLAN.md +978 -0
  98. package/docs/models/provider-infrastructure.md +400 -0
  99. package/docs/security/exec-approvals.md +294 -0
  100. package/docs/skills/IMPLEMENTATION_SUMMARY.md +145 -0
  101. package/docs/skills/SKILL.md +524 -0
  102. package/docs/skills.md +405 -0
  103. package/extensions/bluebubbles/package.json +1 -1
  104. package/extensions/copilot-proxy/package.json +1 -1
  105. package/extensions/diagnostics-otel/package.json +1 -1
  106. package/extensions/discord/package.json +1 -1
  107. package/extensions/feishu/package.json +1 -1
  108. package/extensions/google-antigravity-auth/package.json +1 -1
  109. package/extensions/google-gemini-cli-auth/package.json +1 -1
  110. package/extensions/googlechat/package.json +1 -1
  111. package/extensions/hexstrike-bridge/README.md +119 -0
  112. package/extensions/hexstrike-bridge/index.test.ts +247 -0
  113. package/extensions/hexstrike-bridge/index.ts +487 -0
  114. package/extensions/hexstrike-bridge/package.json +17 -0
  115. package/extensions/imessage/package.json +1 -1
  116. package/extensions/irc/package.json +1 -1
  117. package/extensions/line/package.json +1 -1
  118. package/extensions/llm-task/package.json +1 -1
  119. package/extensions/lobster/package.json +1 -1
  120. package/extensions/matrix/CHANGELOG.md +5 -0
  121. package/extensions/matrix/package.json +1 -1
  122. package/extensions/mattermost/package.json +1 -1
  123. package/extensions/mcp-server/index.ts +14 -0
  124. package/extensions/mcp-server/package.json +11 -0
  125. package/extensions/mcp-server/src/service.ts +540 -0
  126. package/extensions/memory-core/package.json +1 -1
  127. package/extensions/memory-lancedb/package.json +1 -1
  128. package/extensions/minimax-portal-auth/package.json +1 -1
  129. package/extensions/msteams/CHANGELOG.md +5 -0
  130. package/extensions/msteams/package.json +1 -1
  131. package/extensions/nextcloud-talk/package.json +1 -1
  132. package/extensions/nostr/CHANGELOG.md +5 -0
  133. package/extensions/nostr/package.json +1 -1
  134. package/extensions/open-prose/package.json +1 -1
  135. package/extensions/openai-codex-auth/package.json +1 -1
  136. package/extensions/signal/package.json +1 -1
  137. package/extensions/slack/package.json +1 -1
  138. package/extensions/telegram/package.json +1 -1
  139. package/extensions/tlon/package.json +1 -1
  140. package/extensions/twitch/CHANGELOG.md +5 -0
  141. package/extensions/twitch/package.json +1 -1
  142. package/extensions/voice-call/CHANGELOG.md +5 -0
  143. package/extensions/voice-call/package.json +1 -1
  144. package/extensions/whatsapp/package.json +1 -1
  145. package/extensions/zalo/CHANGELOG.md +5 -0
  146. package/extensions/zalo/package.json +1 -1
  147. package/extensions/zalouser/CHANGELOG.md +5 -0
  148. package/extensions/zalouser/package.json +1 -1
  149. package/package.json +8 -1
  150. package/skills/example-skill/SKILL.md +195 -0
@@ -0,0 +1,370 @@
1
+ # Page Agent Integration - Implementation Plan
2
+
3
+ **Status**: Ready for implementation
4
+ **Priority**: High
5
+ **Estimated Duration**: 2 weeks
6
+ **Dependencies**: Gateway Node protocol
7
+
8
+ ---
9
+
10
+ ## Overview
11
+
12
+ Integrate Alibaba's Page Agent as a Gateway Node to enable natural language browser automation within PoolBot.
13
+
14
+ ## Architecture
15
+
16
+ ```
17
+ ┌─────────────────────────────────────────────────────────────┐
18
+ │ PoolBot Core │
19
+ │ ┌─────────────────────────────────────────────────────┐ │
20
+ │ │ Gateway Server (WebSocket) │ │
21
+ │ └──────────────────────┬──────────────────────────────┘ │
22
+ └─────────────────────────┼───────────────────────────────────┘
23
+
24
+ │ WebSocket (JSON-RPC)
25
+
26
+ ┌─────────────────────────────────────────────────────────────┐
27
+ │ Page Agent Gateway Node │
28
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
29
+ │ │ Node Client │ │ Page Agent │ │ Browser │ │
30
+ │ │ (WebSocket) │──│ Core │──│ Controller │ │
31
+ │ └──────────────┘ └──────────────┘ └──────────────┘ │
32
+ └─────────────────────────────────────────────────────────────┘
33
+
34
+ │ Chrome DevTools Protocol
35
+
36
+ ┌─────────────────────────────────────────────────────────────┐
37
+ │ Chrome Browser (with Extension) │
38
+ └─────────────────────────────────────────────────────────────┘
39
+ ```
40
+
41
+ ## Implementation Steps
42
+
43
+ ### Week 1: Gateway Node Foundation
44
+
45
+ #### Day 1-2: Node SDK
46
+ ```typescript
47
+ // extensions/node-sdk/src/gateway-node.ts
48
+ export abstract class GatewayNode {
49
+ protected ws: WebSocket;
50
+ protected nodeId: string;
51
+ protected capabilities: string[];
52
+
53
+ constructor(config: NodeConfig) {
54
+ this.ws = new WebSocket(config.gatewayEndpoint);
55
+ this.setupHandlers();
56
+ }
57
+
58
+ abstract register(): Promise<void>;
59
+ abstract handleToolCall(call: ToolCall): Promise<ToolResult>;
60
+ }
61
+ ```
62
+
63
+ #### Day 3-4: Page Agent Bridge
64
+ ```typescript
65
+ // extensions/page-agent-gateway/src/bridge.ts
66
+ import { PageAgent } from '@page-agent/core';
67
+ import { GatewayNode } from '@poolbot/node-sdk';
68
+
69
+ export class PageAgentNode extends GatewayNode {
70
+ private pageAgent: PageAgent;
71
+
72
+ async register() {
73
+ await this.send({
74
+ type: 'register',
75
+ payload: {
76
+ nodeId: this.nodeId,
77
+ capabilities: ['tools.browser.*', 'tools.page.*'],
78
+ tools: [
79
+ {
80
+ name: 'browser.navigate',
81
+ description: 'Navigate to a URL',
82
+ parameters: {
83
+ type: 'object',
84
+ properties: {
85
+ url: { type: 'string' }
86
+ }
87
+ }
88
+ },
89
+ {
90
+ name: 'page.agent',
91
+ description: 'Control page using natural language',
92
+ parameters: {
93
+ type: 'object',
94
+ properties: {
95
+ instruction: { type: 'string' },
96
+ url: { type: 'string' }
97
+ }
98
+ }
99
+ }
100
+ ]
101
+ }
102
+ });
103
+ }
104
+
105
+ async handleToolCall(call: ToolCall): Promise<ToolResult> {
106
+ switch (call.tool) {
107
+ case 'browser.navigate':
108
+ return this.pageAgent.navigate(call.params.url);
109
+ case 'page.agent':
110
+ return this.pageAgent.execute(call.params.instruction);
111
+ default:
112
+ throw new Error(`Unknown tool: ${call.tool}`);
113
+ }
114
+ }
115
+ }
116
+ ```
117
+
118
+ #### Day 5: Tool Definitions
119
+ ```typescript
120
+ // extensions/page-agent-gateway/src/tools.ts
121
+ export const browserTools = [
122
+ {
123
+ name: 'browser.navigate',
124
+ description: 'Navigate browser to specified URL',
125
+ parameters: z.object({
126
+ url: z.string().url(),
127
+ waitForLoad: z.boolean().optional()
128
+ })
129
+ },
130
+ {
131
+ name: 'browser.click',
132
+ description: 'Click element by selector or text',
133
+ parameters: z.object({
134
+ selector: z.string().optional(),
135
+ text: z.string().optional(),
136
+ xpath: z.string().optional()
137
+ })
138
+ },
139
+ {
140
+ name: 'browser.type',
141
+ description: 'Type text into input field',
142
+ parameters: z.object({
143
+ selector: z.string(),
144
+ text: z.string(),
145
+ clearFirst: z.boolean().optional()
146
+ })
147
+ },
148
+ {
149
+ name: 'browser.extract',
150
+ description: 'Extract data from page',
151
+ parameters: z.object({
152
+ selector: z.string(),
153
+ attribute: z.string().optional(),
154
+ multiple: z.boolean().optional()
155
+ })
156
+ },
157
+ {
158
+ name: 'page.agent',
159
+ description: 'Execute natural language instruction on page',
160
+ parameters: z.object({
161
+ instruction: z.string().describe('Natural language command'),
162
+ url: z.string().url().optional(),
163
+ maxSteps: z.number().optional()
164
+ })
165
+ }
166
+ ];
167
+ ```
168
+
169
+ ### Week 2: Integration & Testing
170
+
171
+ #### Day 6-7: PoolBot Gateway Integration
172
+ ```typescript
173
+ // src/gateway/nodes/page-agent.ts
174
+ export class PageAgentNodeController extends NodeController {
175
+ async onRegister(node: NodeRegistration) {
176
+ // Register tools with PoolBot's skill system
177
+ for (const tool of node.tools) {
178
+ await skillRegistry.register({
179
+ name: tool.name,
180
+ description: tool.description,
181
+ parameters: tool.parameters,
182
+ handler: (params) => this.proxyToolCall(node.nodeId, tool.name, params)
183
+ });
184
+ }
185
+ }
186
+ }
187
+ ```
188
+
189
+ #### Day 8-9: CLI Integration
190
+ ```typescript
191
+ // src/cli/mods.ts (enhancement)
192
+ command('mods:page-agent')
193
+ .description('Manage Page Agent integration')
194
+ .option('--start', 'Start Page Agent node')
195
+ .option('--stop', 'Stop Page Agent node')
196
+ .option('--status', 'Check status')
197
+ .action(async (options) => {
198
+ if (options.start) {
199
+ await startPageAgentNode();
200
+ }
201
+ // ...
202
+ });
203
+ ```
204
+
205
+ #### Day 10: Testing & Documentation
206
+ - Unit tests for bridge
207
+ - Integration tests with Gateway
208
+ - Example workflows
209
+ - Documentation
210
+
211
+ ## File Structure
212
+
213
+ ```
214
+ extensions/page-agent-gateway/
215
+ ├── src/
216
+ │ ├── index.ts # Main entry
217
+ │ ├── node.ts # GatewayNode implementation
218
+ │ ├── bridge.ts # Page Agent bridge
219
+ │ ├── tools.ts # Tool definitions
220
+ │ ├── browser-controller.ts # Browser management
221
+ │ └── config.ts # Configuration
222
+ ├── tests/
223
+ │ ├── node.test.ts
224
+ │ ├── bridge.test.ts
225
+ │ └── integration.test.ts
226
+ ├── package.json
227
+ ├── tsconfig.json
228
+ └── README.md
229
+ ```
230
+
231
+ ## Configuration
232
+
233
+ ```typescript
234
+ // config.ts
235
+ export interface PageAgentConfig {
236
+ gateway: {
237
+ endpoint: string;
238
+ token: string;
239
+ };
240
+ browser: {
241
+ headless: boolean;
242
+ executablePath?: string;
243
+ args: string[];
244
+ };
245
+ pageAgent: {
246
+ maxSteps: number;
247
+ timeout: number;
248
+ };
249
+ }
250
+
251
+ export const defaultConfig: PageAgentConfig = {
252
+ gateway: {
253
+ endpoint: 'ws://localhost:8080/gateway',
254
+ token: process.env.POOLBOT_GATEWAY_TOKEN!
255
+ },
256
+ browser: {
257
+ headless: true,
258
+ args: ['--no-sandbox', '--disable-setuid-sandbox']
259
+ },
260
+ pageAgent: {
261
+ maxSteps: 10,
262
+ timeout: 30000
263
+ }
264
+ };
265
+ ```
266
+
267
+ ## Usage Examples
268
+
269
+ ### Example 1: Simple Navigation
270
+ ```typescript
271
+ // Agent uses Page Agent skill
272
+ await agent.execute({
273
+ skill: 'browser.navigate',
274
+ params: { url: 'https://example.com' }
275
+ });
276
+ ```
277
+
278
+ ### Example 2: Natural Language Control
279
+ ```typescript
280
+ // Agent uses natural language
281
+ await agent.execute({
282
+ skill: 'page.agent',
283
+ params: {
284
+ instruction: 'Find the pricing page and extract all plan names and prices'
285
+ }
286
+ });
287
+ ```
288
+
289
+ ### Example 3: Multi-step Workflow
290
+ ```typescript
291
+ // Complex workflow
292
+ const result = await agent.execute({
293
+ skill: 'page.agent',
294
+ params: {
295
+ instruction: `
296
+ 1. Go to https://news.ycombinator.com
297
+ 2. Find the top 5 stories
298
+ 3. Extract title, URL, and points for each
299
+ 4. Return as JSON
300
+ `,
301
+ maxSteps: 20
302
+ }
303
+ });
304
+ ```
305
+
306
+ ## Testing Strategy
307
+
308
+ ```typescript
309
+ // tests/integration.test.ts
310
+ describe('Page Agent Gateway', () => {
311
+ let node: PageAgentNode;
312
+ let gateway: MockGateway;
313
+
314
+ beforeEach(async () => {
315
+ gateway = new MockGateway();
316
+ node = new PageAgentNode({
317
+ gatewayEndpoint: gateway.url,
318
+ nodeId: 'test-page-agent'
319
+ });
320
+ await node.connect();
321
+ });
322
+
323
+ test('registers tools on connect', async () => {
324
+ const registration = await gateway.waitForRegistration();
325
+ expect(registration.tools).toHaveLength(5);
326
+ expect(registration.capabilities).toContain('tools.browser.*');
327
+ });
328
+
329
+ test('handles browser.navigate', async () => {
330
+ const result = await gateway.callTool('browser.navigate', {
331
+ url: 'https://example.com'
332
+ });
333
+ expect(result.success).toBe(true);
334
+ });
335
+
336
+ test('handles page.agent natural language', async () => {
337
+ const result = await gateway.callTool('page.agent', {
338
+ instruction: 'Click the login button'
339
+ });
340
+ expect(result.success).toBe(true);
341
+ expect(result.actions).toBeDefined();
342
+ });
343
+ });
344
+ ```
345
+
346
+ ## Security Considerations
347
+
348
+ 1. **Sandboxed Browser**: Run browser in isolated environment
349
+ 2. **URL Allowlist**: Restrict which URLs can be accessed
350
+ 3. **Rate Limiting**: Prevent abuse of automation
351
+ 4. **Audit Logging**: Log all browser actions
352
+ 5. **Credential Isolation**: Don't share cookies with PoolBot
353
+
354
+ ## Success Criteria
355
+
356
+ - [ ] Page Agent connects as Gateway Node
357
+ - [ ] All 5 tools functional
358
+ - [ ] Natural language instructions work
359
+ - [ ] <100ms latency for simple commands
360
+ - [ ] Multi-page workflows supported
361
+ - [ ] Tests pass (>80% coverage)
362
+ - [ ] Documentation complete
363
+
364
+ ## Next Steps
365
+
366
+ 1. Create branch `feat/page-agent-gateway`
367
+ 2. Implement Node SDK
368
+ 3. Implement Page Agent bridge
369
+ 4. Add tests
370
+ 5. Create PR