botinabox 2.1.3 → 2.2.1
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/README.md +54 -51
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -4,26 +4,28 @@ A modular TypeScript framework for building multi-agent bots with LLM orchestrat
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
+
- **Execution engine** -- Generic task executor with 22 built-in tools and a tool loop (up to 5 iterations). Agents can read files, send documents, dispatch tasks, search conversations, and more. Apps register tools declaratively.
|
|
8
|
+
- **22 built-in tools** -- File ops (send, read, list, register), task ops (dispatch, cancel, reassign), system status (task, agent, system, active tasks), entity lookup (agents, projects, agent detail), messaging (send message, task comment, read/search conversation), management (create agent, create project). All channel-agnostic.
|
|
9
|
+
- **Chat pipeline** -- Configurable 6-layer chat orchestration: dedup, storage, fast ack (<2s via Haiku), async interpretation, task dispatch, and completion response. Apps provide system prompt and routing rules; framework handles everything else.
|
|
10
|
+
- **Slack integration** -- `SlackBoltAdapter` handles Bolt Socket Mode, message parsing, response delivery, and file uploads. One import, one `start()` call.
|
|
11
|
+
- **Unified config** -- All settings in one `botinabox.config.yml`: models, execution, chat, routing, safety, budget. YAML with env var interpolation. Auto-initializes with sensible defaults.
|
|
12
|
+
- **Message store** -- Store-before-respond guarantee. Inbound messages and attachments stored before any bot response. Channel history for conversation context.
|
|
13
|
+
- **Message interpretation** -- Async structured extraction from messages into tasks, memories, files, and user context. Pluggable extractors for custom data types. Programmatic task creation (no LLM dependency).
|
|
14
|
+
- **Triage routing** -- Content-aware message routing with keyword/regex matching, priority rules, and LLM fallback. Ownership chain logging for every routing decision.
|
|
7
15
|
- **Multi-agent orchestration** -- Define agents with different models, roles, and execution adapters. Task queue with priority scheduling, retry policies, and followup chains.
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **Channel adapters** -- Connect to Slack, Discord, and webhooks. Auto-discovery, session management, and notification queuing.
|
|
18
|
-
- **Workflow engine** -- Define multi-step workflows with dependency resolution, parallel execution, and conditional branching.
|
|
19
|
-
- **SQLite data layer** -- Schema-driven tables, migrations, entity context rendering, and query builder via [latticesql](https://github.com/automated-industries/lattice). WAL mode for concurrent reads.
|
|
20
|
-
- **Event-driven hooks** -- Priority-ordered, filter-based event bus for decoupled inter-layer communication.
|
|
16
|
+
- **Loop detection and circuit breakers** -- Pattern-based loop detection (self-loops, ping-pong, blocked re-entry) plus circuit breakers with automatic human escalation.
|
|
17
|
+
- **Learning pipeline** -- Structured feedback capture with auto-promotion: 3+ similar records become a playbook, 3+ agents become a reusable skill.
|
|
18
|
+
- **Governance gates** -- Independent QA, quality, and drift gates that validate agent output and report to the human operator.
|
|
19
|
+
- **Permission relay** -- Remote approval via messaging platforms (Slack, Discord, Telegram). Dual approval: local + remote, first wins.
|
|
20
|
+
- **LLM provider abstraction** -- Swap between Anthropic, OpenAI, and Ollama. Model aliasing, purpose-based routing, fallback chains. Default LLM call wrapper included.
|
|
21
|
+
- **Channel adapters** -- Slack (Bolt Socket Mode), Discord, and webhooks. Auto-discovery, session management, notification queuing.
|
|
22
|
+
- **Workflow engine** -- Multi-step workflows with dependency resolution, parallel execution, and conditional branching.
|
|
23
|
+
- **SQLite data layer** -- 27 core tables, migrations, entity context rendering via [latticesql](https://github.com/automated-industries/lattice). WAL mode.
|
|
24
|
+
- **Event-driven hooks** -- Priority-ordered, filter-based event bus for decoupled communication.
|
|
21
25
|
- **Budget controls** -- Per-agent and global cost tracking with warning thresholds and hard stops.
|
|
22
|
-
- **Scheduling** -- Database-backed cron and one-time schedules
|
|
23
|
-
- **Connectors** --
|
|
24
|
-
- **
|
|
25
|
-
- **Auto-update** -- `autoUpdate()` checks npm for newer versions and installs them at startup.
|
|
26
|
-
- **Security** -- Input sanitization, field length enforcement, audit logging, and HMAC webhook verification.
|
|
26
|
+
- **Scheduling** -- Database-backed cron and one-time schedules.
|
|
27
|
+
- **Connectors** -- Google Gmail and Calendar via OAuth2 and service account.
|
|
28
|
+
- **Security** -- Input sanitization, field length enforcement, audit logging, HMAC webhook verification.
|
|
27
29
|
|
|
28
30
|
## Install
|
|
29
31
|
|
|
@@ -48,59 +50,60 @@ npm install googleapis
|
|
|
48
50
|
|
|
49
51
|
```typescript
|
|
50
52
|
import {
|
|
51
|
-
HookBus,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
TaskQueue,
|
|
56
|
-
RunManager,
|
|
53
|
+
HookBus, DataStore, defineCoreTables, initConfig,
|
|
54
|
+
TaskQueue, RunManager, WakeupQueue, ChatPipeline,
|
|
55
|
+
registerExecutionEngine, createDefaultLLMCall,
|
|
56
|
+
sendFileTool, readFileTool, listAgentsTool, getTaskStatusTool,
|
|
57
57
|
} from 'botinabox';
|
|
58
|
+
import { SlackBoltAdapter } from 'botinabox/slack';
|
|
59
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
58
60
|
|
|
59
|
-
// 1.
|
|
61
|
+
// 1. Config (auto-loads botinabox.config.yml or uses defaults)
|
|
62
|
+
initConfig({});
|
|
60
63
|
const hooks = new HookBus();
|
|
61
64
|
const db = new DataStore({ dbPath: './data/bot.db', wal: true, hooks });
|
|
62
|
-
|
|
63
|
-
// 2. Define tables and initialize
|
|
64
65
|
defineCoreTables(db);
|
|
65
66
|
await db.init();
|
|
66
67
|
|
|
67
|
-
//
|
|
68
|
-
const agents = new AgentRegistry(db, hooks);
|
|
68
|
+
// 2. Orchestration
|
|
69
69
|
const tasks = new TaskQueue(db, hooks);
|
|
70
70
|
const runs = new RunManager(db, hooks);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
hooks.register('task.created', async (ctx) => {
|
|
82
|
-
console.log(`Task created: ${ctx.taskId}`);
|
|
71
|
+
const wakeups = new WakeupQueue(db);
|
|
72
|
+
|
|
73
|
+
// 3. Execution engine with built-in tools
|
|
74
|
+
const client = new Anthropic();
|
|
75
|
+
await registerExecutionEngine({
|
|
76
|
+
db, hooks, runs,
|
|
77
|
+
config: {
|
|
78
|
+
client,
|
|
79
|
+
tools: [sendFileTool, readFileTool, listAgentsTool, getTaskStatusTool],
|
|
80
|
+
},
|
|
83
81
|
});
|
|
84
82
|
|
|
85
|
-
//
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
// 4. Chat pipeline (6-layer: dedup → ack → interpret → dispatch → execute → respond)
|
|
84
|
+
const llmCall = createDefaultLLMCall(client);
|
|
85
|
+
const pipeline = new ChatPipeline(db, hooks, {
|
|
86
|
+
llmCall, tasks, wakeups,
|
|
87
|
+
systemPrompt: 'You are a helpful AI assistant.',
|
|
88
|
+
routingRules: [{ agentSlug: 'assistant', keywords: ['help'] }],
|
|
89
|
+
fallbackAgent: 'assistant',
|
|
91
90
|
});
|
|
92
91
|
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
// 5. Slack (one import, one start)
|
|
93
|
+
const slack = new SlackBoltAdapter({
|
|
94
|
+
botToken: process.env.SLACK_BOT_TOKEN!,
|
|
95
|
+
appToken: process.env.SLACK_APP_TOKEN!,
|
|
96
|
+
hooks, pipeline,
|
|
96
97
|
});
|
|
98
|
+
await slack.start();
|
|
99
|
+
tasks.startPolling();
|
|
97
100
|
```
|
|
98
101
|
|
|
99
102
|
## Subpath Exports
|
|
100
103
|
|
|
101
104
|
| Import path | Description |
|
|
102
105
|
|---|---|
|
|
103
|
-
| `botinabox` | Core framework -- HookBus, DataStore, AgentRegistry, TaskQueue, RunManager,
|
|
106
|
+
| `botinabox` | Core framework -- HookBus, DataStore, ChatPipeline, ExecutionEngine, 22 built-in tools, config (loadConfig/getConfig), AgentRegistry, TaskQueue, RunManager, Scheduler, MessageStore, ChatResponder, MessageInterpreter, TriageRouter, createDefaultLLMCall, buildSystemContext, and all shared types |
|
|
104
107
|
| `botinabox/anthropic` | Anthropic Claude provider (`createAnthropicProvider`) |
|
|
105
108
|
| `botinabox/openai` | OpenAI GPT provider (`createOpenAIProvider`) |
|
|
106
109
|
| `botinabox/ollama` | Ollama local model provider (`createOllamaProvider`) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "botinabox",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Bot in a Box — framework for building multi-agent bots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -53,13 +53,14 @@
|
|
|
53
53
|
"build": "tsup",
|
|
54
54
|
"test": "vitest run",
|
|
55
55
|
"typecheck": "tsc --noEmit",
|
|
56
|
-
"
|
|
56
|
+
"check-docs": "bash scripts/check-docs.sh",
|
|
57
|
+
"prepublishOnly": "npm run build && npm run typecheck && npm test && npm run check-docs"
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
60
|
"@types/uuid": "^10.0.0",
|
|
60
61
|
"ajv": "^8.17.1",
|
|
61
62
|
"cron-parser": "^4.9.0",
|
|
62
|
-
"latticesql": "^1.
|
|
63
|
+
"latticesql": "^1.4.0",
|
|
63
64
|
"uuid": "^13.0.0",
|
|
64
65
|
"yaml": "^2.7.0"
|
|
65
66
|
},
|