@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.
- package/CHANGELOG.md +40 -0
- package/README.md +147 -69
- package/dist/.buildstamp +1 -1
- package/dist/agents/error-classifier.js +251 -0
- package/dist/agents/skills/security.js +211 -0
- package/dist/build-info.json +3 -3
- package/dist/cli/cron-cli/register.cron-dashboard.js +339 -0
- package/dist/cli/cron-cli/register.js +2 -0
- package/dist/cli/errors.js +187 -0
- package/dist/cli/lazy-commands.example.js +113 -0
- package/dist/cli/lazy-commands.js +329 -0
- package/dist/cli/program/command-registry.js +26 -0
- package/dist/cli/program/register.maintenance.js +21 -0
- package/dist/cli/program/register.skills.js +4 -0
- package/dist/cli/program/register.subclis.js +9 -0
- package/dist/cli/swarm-cli/register.js +8 -0
- package/dist/cli/swarm-cli/register.swarm-status.js +488 -0
- package/dist/cli/telemetry-cli/register.js +10 -0
- package/dist/cli/telemetry-cli/register.telemetry-alerts.js +176 -0
- package/dist/cli/telemetry-cli/register.telemetry-metrics.js +323 -0
- package/dist/cli/telemetry-cli/register.telemetry-status.js +179 -0
- package/dist/commands/doctor-checks.js +498 -0
- package/dist/config/config.js +1 -0
- package/dist/config/secrets-integration.js +88 -0
- package/dist/context-engine/index.js +33 -0
- package/dist/context-engine/legacy.js +179 -0
- package/dist/context-engine/registry.js +86 -0
- package/dist/context-engine/summarizing.js +290 -0
- package/dist/context-engine/types.js +7 -0
- package/dist/cron/service/timer.js +18 -0
- package/dist/gateway/protocol/index.js +5 -2
- package/dist/gateway/protocol/schema/error-codes.js +1 -0
- package/dist/gateway/protocol/schema/swarm.js +80 -0
- package/dist/gateway/protocol/schema.js +1 -0
- package/dist/gateway/server-close.js +4 -0
- package/dist/gateway/server-constants.js +1 -0
- package/dist/gateway/server-cron.js +29 -0
- package/dist/gateway/server-maintenance.js +35 -2
- package/dist/gateway/server-methods/swarm.js +58 -0
- package/dist/gateway/server-methods/telemetry.js +71 -0
- package/dist/gateway/server-methods-list.js +8 -0
- package/dist/gateway/server-methods.js +9 -2
- package/dist/gateway/server.impl.js +33 -16
- package/dist/infra/abort-pattern.js +106 -0
- package/dist/infra/retry.js +96 -0
- package/dist/secrets/index.js +28 -0
- package/dist/secrets/resolver.js +185 -0
- package/dist/secrets/runtime.js +142 -0
- package/dist/secrets/types.js +11 -0
- package/dist/security/dangerous-tools.js +80 -0
- package/dist/security/types.js +12 -0
- package/dist/skills/commands.js +333 -0
- package/dist/skills/index.js +164 -0
- package/dist/skills/loader.js +282 -0
- package/dist/skills/parser.js +446 -0
- package/dist/skills/registry.js +394 -0
- package/dist/skills/security.js +312 -0
- package/dist/skills/types.js +21 -0
- package/dist/swarm/service.js +247 -0
- package/dist/telemetry/alert-engine.js +258 -0
- package/dist/telemetry/cron-instrumentation.js +49 -0
- package/dist/telemetry/gateway-instrumentation.js +80 -0
- package/dist/telemetry/instrumentation.js +66 -0
- package/dist/telemetry/service.js +345 -0
- package/dist/test-utils/index.js +219 -0
- package/dist/tui/components/assistant-message.js +6 -2
- package/dist/tui/components/hyperlink-markdown.js +32 -0
- package/dist/tui/components/searchable-select-list.js +12 -1
- package/dist/tui/components/user-message.js +6 -2
- package/dist/tui/index.js +611 -0
- package/dist/tui/theme/theme-detection.js +226 -0
- package/dist/tui/tui-command-handlers.js +20 -0
- package/dist/tui/tui-formatters.js +4 -3
- package/dist/tui/utils/ctrl-c-handler.js +67 -0
- package/dist/tui/utils/osc8-hyperlinks.js +208 -0
- package/dist/tui/utils/safe-stop.js +180 -0
- package/dist/tui/utils/session-key-utils.js +81 -0
- package/dist/tui/utils/text-sanitization.js +284 -0
- package/dist/utils/lru-cache.js +116 -0
- package/dist/utils/performance.js +199 -0
- package/dist/utils/retry.js +240 -0
- package/docs/INTEGRATION_PLAN.md +475 -0
- package/docs/INTEGRATION_SUMMARY.md +215 -0
- package/docs/MELHORIAS_IMPLEMENTADAS.md +228 -0
- package/docs/MELHORIAS_PROFISSIONAIS.md +282 -0
- package/docs/PLANO_ACAO_TUI.md +357 -0
- package/docs/PROGRESSO_TUI.md +66 -0
- package/docs/RELATORIO_FINAL.md +217 -0
- package/docs/diagnostico-shell-completion.md +265 -0
- package/docs/features/advanced-memory.md +585 -0
- package/docs/features/discord-components-v2.md +277 -0
- package/docs/features/swarm.md +100 -0
- package/docs/features/telemetry.md +284 -0
- package/docs/integrations/HEXSTRIKE_PLAN.md +796 -0
- package/docs/integrations/INTEGRATION_PLAN.md +744 -0
- package/docs/integrations/PAGE_AGENT_PLAN.md +370 -0
- package/docs/integrations/XYOPS_PLAN.md +978 -0
- package/docs/models/provider-infrastructure.md +400 -0
- package/docs/security/exec-approvals.md +294 -0
- package/docs/skills/IMPLEMENTATION_SUMMARY.md +145 -0
- package/docs/skills/SKILL.md +524 -0
- package/docs/skills.md +405 -0
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/discord/package.json +1 -1
- package/extensions/feishu/package.json +1 -1
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/hexstrike-bridge/README.md +119 -0
- package/extensions/hexstrike-bridge/index.test.ts +247 -0
- package/extensions/hexstrike-bridge/index.ts +487 -0
- package/extensions/hexstrike-bridge/package.json +17 -0
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +5 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/mcp-server/index.ts +14 -0
- package/extensions/mcp-server/package.json +11 -0
- package/extensions/mcp-server/src/service.ts +540 -0
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +5 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +5 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/openai-codex-auth/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/package.json +1 -1
- package/extensions/telegram/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +5 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +5 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +5 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +5 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +8 -1
- package/skills/example-skill/SKILL.md +195 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
## v2026.3.10 (2026-03-10)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
- **Telemetry Alert System:** intelligent alerting engine for proactive monitoring
|
|
5
|
+
- Real-time alert evaluation with configurable thresholds
|
|
6
|
+
- Built-in rules for cron failures, security scans, swarm tasks, gateway health
|
|
7
|
+
- Webhook and announce channel notifications
|
|
8
|
+
- Alert history tracking with automatic cleanup
|
|
9
|
+
- **Swarm State Persistence:** swarm task state now persisted to `~/.poolbot/swarm-state.json`
|
|
10
|
+
- Survives gateway restarts without losing task queue
|
|
11
|
+
- Automatic state recovery on startup
|
|
12
|
+
- **HexStrike Bridge Telemetry:** comprehensive metrics for HexStrike AI integration
|
|
13
|
+
- Request latency tracking with histograms
|
|
14
|
+
- Rate limiting with configurable thresholds
|
|
15
|
+
- Health check monitoring with automatic failover
|
|
16
|
+
- **Critical Bug Fix:** telemetry service now properly starts with gateway (was missing `await`)
|
|
17
|
+
|
|
18
|
+
### Improvements
|
|
19
|
+
- Optimized alert thresholds for production workloads
|
|
20
|
+
- Enhanced gateway instrumentation with memory and CPU metrics
|
|
21
|
+
- Improved error handling in telemetry pipeline
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## v2026.3.9 (2026-03-09)
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
- **Modular Skills System:** new comprehensive skills management system in `src/skills/` — 8 core modules providing SKILL.md parsing, security scanning, registry management, progressive disclosure loading, and CLI commands (`poolbot mods`)
|
|
29
|
+
- `types.ts`: Type definitions compatible with agentskills.io specification
|
|
30
|
+
- `parser.ts`: YAML frontmatter parser for SKILL.md files with validation
|
|
31
|
+
- `registry.ts`: EventEmitter-based skills registry with lifecycle management
|
|
32
|
+
- `loader.ts`: Progressive disclosure loader with dependency resolution
|
|
33
|
+
- `security.ts`: Security scanner for prompt injection and path traversal detection
|
|
34
|
+
- `commands.ts`: CLI commands for skill management
|
|
35
|
+
- `index.ts`: Public API exports
|
|
36
|
+
- Comprehensive test suite with 52 passing tests
|
|
37
|
+
- **Integration Plans:** detailed implementation plans for external project integrations (Page Agent, HexStrike AI, xyOps) via Gateway Node protocol
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
1
41
|
## v2026.3.6 (2026-03-06)
|
|
2
42
|
|
|
3
43
|
### Features
|
package/README.md
CHANGED
|
@@ -1,123 +1,201 @@
|
|
|
1
1
|
# 🎱 Pool Bot
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **The AI Gateway for Teams That Need More Than Chatbots**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Pool Bot transforms your messaging apps into a powerful AI command center. Connect Claude, GPT, Gemini, and local models to WhatsApp, Telegram, Discord, Slack, Signal, and 15+ other channels—then extend with custom skills for your specific workflows.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@poolzin/pool-bot)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://docs.poolbot.dev)
|
|
6
10
|
|
|
7
11
|

|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
---
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
- 🧠 **Enhanced Memory** - Advanced context management
|
|
13
|
-
- 🛠️ **Developer Tools** - Built for development teams
|
|
14
|
-
- 🔒 **Private & Secure** - Your data, your control
|
|
15
|
-
- 🌐 **Multi-Channel Support** - WhatsApp, Telegram, Discord, Slack, Signal, and more
|
|
15
|
+
## ✨ What Makes Pool Bot Different
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
| Feature | What It Means For You |
|
|
18
|
+
|---------|----------------------|
|
|
19
|
+
| **🧩 Modular Skills System** | Add capabilities via YAML-based skills—no coding required for most extensions |
|
|
20
|
+
| **🌐 Universal Gateway** | One AI backend, unlimited channels. Add new messaging platforms without reconfiguration |
|
|
21
|
+
| **🧠 Advanced Memory** | MMR reranking, temporal decay, hybrid search—conversations that actually remember context |
|
|
22
|
+
| **⚡ Provider Infrastructure** | Multi-key pools, intelligent rate limiting, automatic failover across 10+ LLM providers |
|
|
23
|
+
| **🔒 Security-First** | Command approval workflows, audit logging, PII detection, configurable guardrails |
|
|
24
|
+
| **📱 Device Control** | Pair iOS/Android devices for remote automation, screenshots, and notifications |
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
npm install -g @poolzin/pool-bot
|
|
21
|
-
poolbot --help
|
|
22
|
-
```
|
|
26
|
+
---
|
|
23
27
|
|
|
24
|
-
## Quick Start
|
|
28
|
+
## 🚀 Quick Start
|
|
25
29
|
|
|
26
30
|
```bash
|
|
31
|
+
# Install globally
|
|
32
|
+
npm install -g @poolzin/pool-bot
|
|
33
|
+
|
|
27
34
|
# Start the gateway
|
|
28
35
|
poolbot gateway start
|
|
29
36
|
|
|
30
|
-
# Connect
|
|
31
|
-
poolbot channels login
|
|
37
|
+
# Connect your first channel
|
|
38
|
+
poolbot channels login whatsapp
|
|
32
39
|
|
|
33
|
-
# Check
|
|
40
|
+
# Check everything is running
|
|
34
41
|
poolbot status
|
|
35
42
|
```
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
**That's it.** Your AI assistant is now available on WhatsApp. Add more channels anytime.
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- 📱 **Node Pairing** - Control iOS/Android devices remotely
|
|
43
|
-
- 🎨 **Canvas** - Visual browser automation
|
|
44
|
-
- 🔧 **Skills System** - Extensible plugin architecture
|
|
45
|
-
- 📊 **PLCODE Dashboard** - Real-time development metrics
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 📡 Supported Channels
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
**Messaging Platforms:**
|
|
51
|
+
WhatsApp • Telegram • Discord • Slack • Signal • iMessage • Facebook Messenger • Instagram • LINE • Matrix • Mattermost • Zalo • Microsoft Teams
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
**Voice & Web:**
|
|
54
|
+
Web Interface • WebRTC • Voice Calls
|
|
50
55
|
|
|
51
|
-
|
|
56
|
+
**Custom:**
|
|
57
|
+
Webhooks • API • Custom integrations via skills
|
|
52
58
|
|
|
53
|
-
|
|
59
|
+
---
|
|
54
60
|
|
|
55
|
-
|
|
56
|
-
- 🔍 **GitHub Integration** - Issues, PRs, and CI management
|
|
57
|
-
- 🌦️ **Weather** - Current weather and forecasts
|
|
58
|
-
- 📧 **Notion** - Database and page management
|
|
59
|
-
- 🐦 **X/Twitter** - Social media engagement
|
|
60
|
-
- And more...
|
|
61
|
+
## 🤖 Supported AI Providers
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
| Provider | Models | Features |
|
|
64
|
+
|----------|--------|----------|
|
|
65
|
+
| **Anthropic** | Claude 3.5/3 Opus/Sonnet/Haiku | Full tool use, vision, extended thinking |
|
|
66
|
+
| **OpenAI** | GPT-4o, GPT-4, GPT-3.5 | Function calling, vision, DALL-E |
|
|
67
|
+
| **Google** | Gemini 1.5 Pro/Flash | Multimodal, 1M+ context window |
|
|
68
|
+
| **Groq** | Llama 3, Mixtral | Ultra-fast inference |
|
|
69
|
+
| **Ollama** | Local models | Privacy-first, offline capable |
|
|
70
|
+
| **Together** | 50+ open models | Mixtral, Llama, Qwen, and more |
|
|
71
|
+
| **OpenRouter** | 100+ models | Unified API for multiple providers |
|
|
72
|
+
| **Mistral** | Mistral Large/Medium/Small | European AI, GDPR compliant |
|
|
73
|
+
| **Cohere** | Command R/R+ | Enterprise-focused |
|
|
74
|
+
| **AI21** | Jamba/Jurassic | Long context specialist |
|
|
63
75
|
|
|
64
|
-
|
|
76
|
+
---
|
|
65
77
|
|
|
66
|
-
|
|
78
|
+
## 🛠️ Skills System
|
|
67
79
|
|
|
68
|
-
|
|
69
|
-
- 🪟 **Windows Node v2** (Python) - Local LLM, STT/TTS, automation
|
|
70
|
-
- 📱 **Android** - Native mobile app
|
|
71
|
-
- 🍎 **iOS/macOS** - Apple ecosystem apps
|
|
80
|
+
Pool Bot's unique skill system lets you add capabilities without touching core code:
|
|
72
81
|
|
|
73
|
-
|
|
82
|
+
```yaml
|
|
83
|
+
# Example: Weather Skill (skills/weather/SKILL.md)
|
|
84
|
+
---
|
|
85
|
+
name: weather
|
|
86
|
+
description: Get weather forecasts
|
|
87
|
+
tools:
|
|
88
|
+
- name: get_weather
|
|
89
|
+
description: Get current weather for a location
|
|
90
|
+
parameters:
|
|
91
|
+
location: string
|
|
92
|
+
units: enum[celsius, fahrenheit]
|
|
93
|
+
---
|
|
94
|
+
```
|
|
74
95
|
|
|
75
|
-
|
|
96
|
+
**Built-in Skills:**
|
|
97
|
+
- 🎮 **WebGPU Three.js** - 3D development and visualization
|
|
98
|
+
- 🔍 **GitHub** - Issues, PRs, CI/CD management
|
|
99
|
+
- 🌦️ **Weather** - Current conditions and forecasts
|
|
100
|
+
- 📝 **Notion** - Database and page management
|
|
101
|
+
- 🐦 **X/Twitter** - Social media automation
|
|
102
|
+
- 📧 **Gmail** - Email management
|
|
103
|
+
- 📅 **Calendar** - Schedule management
|
|
104
|
+
- 🔐 **1Password** - Secure credential access
|
|
105
|
+
- 🎨 **Canvas** - Visual browser automation
|
|
106
|
+
- 🖼️ **Image Generation** - DALL-E, Stable Diffusion integration
|
|
76
107
|
|
|
77
|
-
|
|
78
|
-
# Use default profile
|
|
79
|
-
poolbot gateway start
|
|
108
|
+
**Create your own:** See [Creating Skills](https://docs.poolbot.dev/skills/creating)
|
|
80
109
|
|
|
81
|
-
|
|
82
|
-
poolbot --profile production gateway start
|
|
110
|
+
---
|
|
83
111
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
112
|
+
## 🏗️ Architecture Highlights
|
|
113
|
+
|
|
114
|
+
### Provider Infrastructure
|
|
115
|
+
- **Multi-key pools** - Rotate across multiple API keys for higher rate limits
|
|
116
|
+
- **Intelligent routing** - Route by model capability, cost, or latency
|
|
117
|
+
- **Automatic failover** - Seamless fallback when providers degrade
|
|
118
|
+
- **Usage tracking** - Per-key, per-model cost analytics
|
|
119
|
+
|
|
120
|
+
### Memory System
|
|
121
|
+
- **Semantic search** - Find relevant context across conversation history
|
|
122
|
+
- **MMR reranking** - Diverse, non-redundant context retrieval
|
|
123
|
+
- **Temporal decay** - Recent conversations weighted higher
|
|
124
|
+
- **Hybrid search** - Combine vector similarity with keyword matching
|
|
125
|
+
|
|
126
|
+
---
|
|
87
127
|
|
|
88
|
-
##
|
|
128
|
+
## 📱 Companion Apps
|
|
129
|
+
|
|
130
|
+
Extend Pool Bot to your devices:
|
|
131
|
+
|
|
132
|
+
| Platform | Features | Repository |
|
|
133
|
+
|----------|----------|------------|
|
|
134
|
+
| **Windows** | Local LLM, STT/TTS, automation, system control | [pool-apps](https://github.com/plcunha/pool-apps) |
|
|
135
|
+
| **Android** | Native messaging, notifications, device automation | [pool-apps](https://github.com/plcunha/pool-apps) |
|
|
136
|
+
| **iOS/macOS** | Apple ecosystem integration, Shortcuts support | [pool-apps](https://github.com/plcunha/pool-apps) |
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 💻 Development
|
|
89
141
|
|
|
90
142
|
```bash
|
|
91
|
-
# Clone
|
|
143
|
+
# Clone and setup
|
|
92
144
|
git clone https://github.com/plcunha/pool-bot.git
|
|
93
145
|
cd pool-bot
|
|
94
|
-
|
|
95
|
-
# Install dependencies
|
|
96
146
|
pnpm install
|
|
97
147
|
|
|
148
|
+
# Development mode
|
|
149
|
+
pnpm dev
|
|
150
|
+
|
|
98
151
|
# Build
|
|
99
152
|
pnpm build
|
|
100
153
|
|
|
101
154
|
# Run tests
|
|
102
155
|
pnpm test
|
|
103
156
|
|
|
104
|
-
#
|
|
105
|
-
|
|
157
|
+
# Lint and format
|
|
158
|
+
pnpm lint
|
|
159
|
+
pnpm format
|
|
106
160
|
```
|
|
107
161
|
|
|
108
|
-
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 📚 Documentation
|
|
165
|
+
|
|
166
|
+
- **[Getting Started](https://docs.poolbot.dev/getting-started)** - Installation and first steps
|
|
167
|
+
- **[Configuration](https://docs.poolbot.dev/configuration)** - Profiles, channels, and providers
|
|
168
|
+
- **[Skills](https://docs.poolbot.dev/skills)** - Built-in and custom skills
|
|
169
|
+
- **[Architecture](https://docs.poolbot.dev/architecture)** - Mesh networking, memory, security
|
|
170
|
+
- **[API Reference](https://docs.poolbot.dev/api)** - REST API and webhooks
|
|
171
|
+
- **[Deployment](https://docs.poolbot.dev/deployment)** - Docker, cloud, and self-hosting
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 🔐 Security
|
|
176
|
+
|
|
177
|
+
- **Command Approval** - Require human approval for destructive operations
|
|
178
|
+
- **Audit Logging** - Complete trace of all AI actions
|
|
179
|
+
- **PII Detection** - Automatic redaction of sensitive data
|
|
180
|
+
- **Sandboxed Execution** - Isolated environment for untrusted skills
|
|
181
|
+
- **End-to-End Encryption** - For supported channels
|
|
182
|
+
|
|
183
|
+
See [Security Documentation](https://docs.poolbot.dev/security)
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 🤝 Community
|
|
188
|
+
|
|
189
|
+
- **Discord:** [discord.gg/poolbot](https://discord.gg/poolbot)
|
|
190
|
+
- **GitHub Issues:** [Report bugs, request features](https://github.com/plcunha/pool-bot/issues)
|
|
191
|
+
- **Discussions:** [Q&A, show and tell](https://github.com/plcunha/pool-bot/discussions)
|
|
109
192
|
|
|
110
|
-
|
|
111
|
-
- **GitHub Issues**: https://github.com/plcunha/pool-bot/issues
|
|
112
|
-
- **Community**: https://discord.com/discord.gg/poolbot
|
|
193
|
+
---
|
|
113
194
|
|
|
114
|
-
##
|
|
195
|
+
## 📄 License
|
|
115
196
|
|
|
116
|
-
|
|
117
|
-
- Email: jvsantos.cunha@gmail.com
|
|
118
|
-
- GitHub: @plcunha
|
|
119
|
-
- Telegram: @poolzin
|
|
197
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
120
198
|
|
|
121
|
-
|
|
199
|
+
---
|
|
122
200
|
|
|
123
|
-
|
|
201
|
+
**Made with 🎱 by [João Vitor Cunha](https://github.com/plcunha)**
|
package/dist/.buildstamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1773140740628
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Classification System
|
|
3
|
+
*
|
|
4
|
+
* Provides comprehensive error classification for LLM/AI operations.
|
|
5
|
+
* Detects specific error types like context overflow, rate limits, etc.
|
|
6
|
+
*/
|
|
7
|
+
// OpenAI error patterns
|
|
8
|
+
const OPENAI_PATTERNS = {
|
|
9
|
+
context_overflow: [
|
|
10
|
+
/context length exceeded/i,
|
|
11
|
+
/maximum context length/i,
|
|
12
|
+
/token limit exceeded/i,
|
|
13
|
+
/too many tokens/i,
|
|
14
|
+
/rate_limit_exceeded.*context/i,
|
|
15
|
+
],
|
|
16
|
+
rate_limit: [/rate limit exceeded/i, /too many requests/i, /ratelimit/i],
|
|
17
|
+
authentication: [/invalid api key/i, /incorrect api key/i, /authentication/i, /unauthorized/i],
|
|
18
|
+
invalid_request: [/invalid_request_error/i, /bad request/i, /invalid parameter/i],
|
|
19
|
+
};
|
|
20
|
+
// Anthropic error patterns
|
|
21
|
+
const ANTHROPIC_PATTERNS = {
|
|
22
|
+
context_overflow: [/context window exceeded/i, /maximum token count/i, /too many tokens/i],
|
|
23
|
+
rate_limit: [/rate limit/i, /too many requests/i],
|
|
24
|
+
authentication: [/invalid api key/i, /authentication failed/i],
|
|
25
|
+
authorization: [
|
|
26
|
+
/forbidden/i,
|
|
27
|
+
/access denied/i,
|
|
28
|
+
/unauthorized.*resource/i,
|
|
29
|
+
/insufficient.*permission/i,
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
// Google/Gemini error patterns
|
|
33
|
+
const GEMINI_PATTERNS = {
|
|
34
|
+
context_overflow: [/token limit exceeded/i, /maximum input size/i, /context too long/i],
|
|
35
|
+
rate_limit: [/rate limit exceeded/i, /quota exceeded/i, /too many requests/i],
|
|
36
|
+
quota_exceeded: [/quota exceeded/i, /billing limit/i, /project quota/i],
|
|
37
|
+
};
|
|
38
|
+
// Generic patterns
|
|
39
|
+
const GENERIC_PATTERNS = {
|
|
40
|
+
context_overflow: [
|
|
41
|
+
/context.*overflow/i,
|
|
42
|
+
/context.*exceeded/i,
|
|
43
|
+
/token.*limit/i,
|
|
44
|
+
/maximum.*context/i,
|
|
45
|
+
/message too long/i,
|
|
46
|
+
/input too long/i,
|
|
47
|
+
],
|
|
48
|
+
rate_limit: [/rate.?limit/i, /too many requests/i, /throttled/i, /429/i],
|
|
49
|
+
timeout: [/timeout/i, /timed out/i, /etimedout/i],
|
|
50
|
+
network_error: [/network error/i, /econnreset/i, /econnrefused/i, /enotfound/i, /network/i],
|
|
51
|
+
server_error: [/server error/i, /internal error/i, /500/i, /502/i, /503/i, /504/i],
|
|
52
|
+
compaction_failure: [/compaction failed/i, /summarization failed/i, /failed to compact/i],
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Classify an error based on message patterns
|
|
56
|
+
*/
|
|
57
|
+
export function classifyError(error) {
|
|
58
|
+
if (!(error instanceof Error)) {
|
|
59
|
+
return {
|
|
60
|
+
type: "unknown",
|
|
61
|
+
retryable: false,
|
|
62
|
+
message: String(error),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const message = error.message.toLowerCase();
|
|
66
|
+
// Check context overflow first (highest priority for LLM errors)
|
|
67
|
+
for (const pattern of [
|
|
68
|
+
...OPENAI_PATTERNS.context_overflow,
|
|
69
|
+
...ANTHROPIC_PATTERNS.context_overflow,
|
|
70
|
+
...GEMINI_PATTERNS.context_overflow,
|
|
71
|
+
...GENERIC_PATTERNS.context_overflow,
|
|
72
|
+
]) {
|
|
73
|
+
if (pattern.test(message)) {
|
|
74
|
+
return {
|
|
75
|
+
type: "context_overflow",
|
|
76
|
+
retryable: false,
|
|
77
|
+
message: error.message,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Check quota exceeded (before rate limit to avoid false positives)
|
|
82
|
+
for (const pattern of GEMINI_PATTERNS.quota_exceeded) {
|
|
83
|
+
if (pattern.test(message)) {
|
|
84
|
+
return {
|
|
85
|
+
type: "quota_exceeded",
|
|
86
|
+
retryable: false,
|
|
87
|
+
message: error.message,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Check rate limit
|
|
92
|
+
for (const pattern of [
|
|
93
|
+
...OPENAI_PATTERNS.rate_limit,
|
|
94
|
+
...ANTHROPIC_PATTERNS.rate_limit,
|
|
95
|
+
...GEMINI_PATTERNS.rate_limit,
|
|
96
|
+
...GENERIC_PATTERNS.rate_limit,
|
|
97
|
+
]) {
|
|
98
|
+
if (pattern.test(message)) {
|
|
99
|
+
return {
|
|
100
|
+
type: "rate_limit",
|
|
101
|
+
retryable: true,
|
|
102
|
+
message: error.message,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Check authentication
|
|
107
|
+
for (const pattern of [...OPENAI_PATTERNS.authentication, ...ANTHROPIC_PATTERNS.authentication]) {
|
|
108
|
+
if (pattern.test(message)) {
|
|
109
|
+
return {
|
|
110
|
+
type: "authentication",
|
|
111
|
+
retryable: false,
|
|
112
|
+
message: error.message,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Check authorization (403-like errors)
|
|
117
|
+
for (const pattern of ANTHROPIC_PATTERNS.authorization) {
|
|
118
|
+
if (pattern.test(message)) {
|
|
119
|
+
return {
|
|
120
|
+
type: "authorization",
|
|
121
|
+
retryable: false,
|
|
122
|
+
message: error.message,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Check timeout
|
|
127
|
+
for (const pattern of GENERIC_PATTERNS.timeout) {
|
|
128
|
+
if (pattern.test(message)) {
|
|
129
|
+
return {
|
|
130
|
+
type: "timeout",
|
|
131
|
+
retryable: true,
|
|
132
|
+
message: error.message,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Check network errors
|
|
137
|
+
for (const pattern of GENERIC_PATTERNS.network_error) {
|
|
138
|
+
if (pattern.test(message)) {
|
|
139
|
+
return {
|
|
140
|
+
type: "network_error",
|
|
141
|
+
retryable: true,
|
|
142
|
+
message: error.message,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Check server errors
|
|
147
|
+
for (const pattern of GENERIC_PATTERNS.server_error) {
|
|
148
|
+
if (pattern.test(message)) {
|
|
149
|
+
return {
|
|
150
|
+
type: "server_error",
|
|
151
|
+
retryable: true,
|
|
152
|
+
message: error.message,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Check compaction failure
|
|
157
|
+
for (const pattern of GENERIC_PATTERNS.compaction_failure) {
|
|
158
|
+
if (pattern.test(message)) {
|
|
159
|
+
return {
|
|
160
|
+
type: "compaction_failure",
|
|
161
|
+
retryable: true,
|
|
162
|
+
message: error.message,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Default to unknown
|
|
167
|
+
return {
|
|
168
|
+
type: "unknown",
|
|
169
|
+
retryable: false,
|
|
170
|
+
message: error.message,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Check if error is a context overflow error
|
|
175
|
+
*/
|
|
176
|
+
export function isContextOverflowError(error) {
|
|
177
|
+
const classification = classifyError(error);
|
|
178
|
+
return classification.type === "context_overflow";
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Check if error is a rate limit error
|
|
182
|
+
*/
|
|
183
|
+
export function isRateLimitError(error) {
|
|
184
|
+
const classification = classifyError(error);
|
|
185
|
+
return classification.type === "rate_limit";
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Check if error is a compaction failure
|
|
189
|
+
*/
|
|
190
|
+
export function isCompactionFailureError(error) {
|
|
191
|
+
const classification = classifyError(error);
|
|
192
|
+
return classification.type === "compaction_failure";
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Check if error is likely a context overflow (heuristic)
|
|
196
|
+
*/
|
|
197
|
+
export function isLikelyContextOverflowError(error) {
|
|
198
|
+
if (!(error instanceof Error)) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
const message = error.message.toLowerCase();
|
|
202
|
+
// Check for common indicators
|
|
203
|
+
const indicators = [
|
|
204
|
+
"context",
|
|
205
|
+
"token",
|
|
206
|
+
"length",
|
|
207
|
+
"exceeded",
|
|
208
|
+
"maximum",
|
|
209
|
+
"limit",
|
|
210
|
+
"too long",
|
|
211
|
+
"too many",
|
|
212
|
+
];
|
|
213
|
+
const score = indicators.reduce((acc, indicator) => {
|
|
214
|
+
return acc + (message.includes(indicator) ? 1 : 0);
|
|
215
|
+
}, 0);
|
|
216
|
+
// If 3+ indicators present, likely context overflow
|
|
217
|
+
return score >= 3;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Get retry delay for error type
|
|
221
|
+
*/
|
|
222
|
+
export function getRetryDelayForError(error, attempt) {
|
|
223
|
+
const classification = classifyError(error);
|
|
224
|
+
switch (classification.type) {
|
|
225
|
+
case "rate_limit":
|
|
226
|
+
// Rate limits: start with 2s, double each attempt
|
|
227
|
+
return Math.min(2000 * 2 ** attempt, 60000);
|
|
228
|
+
case "timeout":
|
|
229
|
+
case "network_error":
|
|
230
|
+
// Network issues: start with 500ms
|
|
231
|
+
return Math.min(500 * 2 ** attempt, 30000);
|
|
232
|
+
case "server_error":
|
|
233
|
+
// Server errors: start with 1s
|
|
234
|
+
return Math.min(1000 * 2 ** attempt, 30000);
|
|
235
|
+
case "compaction_failure":
|
|
236
|
+
// Compaction: shorter delays
|
|
237
|
+
return Math.min(500 * 2 ** attempt, 5000);
|
|
238
|
+
default:
|
|
239
|
+
return 1000;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Format error for logging (sanitized)
|
|
244
|
+
*/
|
|
245
|
+
export function formatErrorForLogging(error) {
|
|
246
|
+
if (error instanceof Error) {
|
|
247
|
+
const classification = classifyError(error);
|
|
248
|
+
return `[${classification.type}] ${classification.message}`;
|
|
249
|
+
}
|
|
250
|
+
return `[unknown] ${String(error)}`;
|
|
251
|
+
}
|