botinabox 0.5.7 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +205 -130
- package/dist/index.js +3 -5
- package/package.json +2 -2
- package/dist/chunk-3X3YKI4T.js +0 -357
- package/dist/chunk-D47AIFOD.js +0 -351
- package/dist/chunk-DSNJKNEW.js +0 -328
- package/dist/connector-DDahQw-2.d.ts +0 -63
- package/dist/gmail-connector-2FVYTQJH.js +0 -6
- package/dist/gmail-connector-MNUBRNFM.js +0 -6
- package/dist/gmail-connector-URRFX6A3.js +0 -6
package/README.md
CHANGED
|
@@ -4,173 +4,248 @@ A modular TypeScript framework for building multi-agent bots with LLM orchestrat
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Multi-agent orchestration**
|
|
8
|
-
- **LLM provider abstraction**
|
|
9
|
-
- **Channel adapters**
|
|
10
|
-
- **Workflow engine**
|
|
11
|
-
- **SQLite data layer**
|
|
12
|
-
- **Event-driven hooks**
|
|
13
|
-
- **Budget controls**
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
|
|
18
|
-
##
|
|
7
|
+
- **Multi-agent orchestration** — Define agents with different models, roles, and execution adapters. Task queue with priority scheduling, retry policies, and followup chains.
|
|
8
|
+
- **LLM provider abstraction** — Swap between Anthropic, OpenAI, and Ollama with a unified interface. Model aliasing, purpose-based routing, and fallback chains.
|
|
9
|
+
- **Channel adapters** — Connect to Slack, Discord, and webhooks. Auto-discovery, session management, and notification queuing.
|
|
10
|
+
- **Workflow engine** — Define multi-step workflows with dependency resolution, parallel execution, and conditional branching.
|
|
11
|
+
- **SQLite data layer** — Schema-driven tables, migrations, entity context rendering, and query builder. WAL mode for concurrent reads.
|
|
12
|
+
- **Event-driven hooks** — Priority-ordered, filter-based event bus for decoupled inter-layer communication.
|
|
13
|
+
- **Budget controls** — Per-agent and global cost tracking with warning thresholds and hard stops.
|
|
14
|
+
- **Protected primitives** — Users and secrets are first-class, privacy-isolated objects. User identity resolution across channels. Secrets with optional AES-256-GCM at-rest encryption.
|
|
15
|
+
- **Security** — Input sanitization, field length enforcement, audit logging, and HMAC webhook verification.
|
|
16
|
+
- **Self-updating** — Built-in update checker with configurable policies and maintenance windows.
|
|
17
|
+
|
|
18
|
+
## Packages
|
|
19
|
+
|
|
20
|
+
| Package | Description |
|
|
21
|
+
|---------|-------------|
|
|
22
|
+
| [`@botinabox/core`](packages/core) | Core framework — config, data, hooks, LLM, orchestration, chat, security |
|
|
23
|
+
| [`@botinabox/shared`](packages/shared) | Shared types, interfaces, and constants (zero dependencies) |
|
|
24
|
+
| [`@botinabox/cli`](packages/cli) | CLI tool for scaffolding new projects |
|
|
25
|
+
| [`@botinabox/provider-anthropic`](packages/providers/anthropic) | Anthropic Claude provider |
|
|
26
|
+
| [`@botinabox/provider-openai`](packages/providers/openai) | OpenAI GPT provider |
|
|
27
|
+
| [`@botinabox/provider-ollama`](packages/providers/ollama) | Ollama local model provider |
|
|
28
|
+
| [`@botinabox/channel-slack`](packages/channels/slack) | Slack channel adapter |
|
|
29
|
+
| [`@botinabox/channel-discord`](packages/channels/discord) | Discord channel adapter |
|
|
30
|
+
| [`@botinabox/channel-webhook`](packages/channels/webhook) | Webhook channel adapter with HMAC verification |
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
### Prerequisites
|
|
35
|
+
|
|
36
|
+
- Node.js 20+
|
|
37
|
+
- pnpm 9+
|
|
38
|
+
|
|
39
|
+
### Install
|
|
19
40
|
|
|
20
41
|
```bash
|
|
21
|
-
|
|
42
|
+
git clone https://github.com/automated-industries/botinabox.git
|
|
43
|
+
cd botinabox
|
|
44
|
+
pnpm install
|
|
45
|
+
pnpm build
|
|
22
46
|
```
|
|
23
47
|
|
|
24
|
-
|
|
48
|
+
### Create a Project
|
|
25
49
|
|
|
26
50
|
```bash
|
|
27
|
-
|
|
28
|
-
|
|
51
|
+
npx botinabox init my-bot
|
|
52
|
+
cd my-bot
|
|
53
|
+
```
|
|
29
54
|
|
|
30
|
-
|
|
31
|
-
|
|
55
|
+
This generates a project with a config file, environment template, and entry point.
|
|
56
|
+
|
|
57
|
+
### Configure
|
|
58
|
+
|
|
59
|
+
Edit `botinabox.config.yml`:
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
data:
|
|
63
|
+
path: ./data/bot.db
|
|
64
|
+
walMode: true
|
|
65
|
+
|
|
66
|
+
channels:
|
|
67
|
+
slack:
|
|
68
|
+
enabled: true
|
|
69
|
+
botToken: ${SLACK_BOT_TOKEN}
|
|
70
|
+
|
|
71
|
+
providers:
|
|
72
|
+
anthropic:
|
|
73
|
+
enabled: true
|
|
74
|
+
apiKey: ${ANTHROPIC_API_KEY}
|
|
75
|
+
|
|
76
|
+
agents:
|
|
77
|
+
- slug: assistant
|
|
78
|
+
name: Assistant
|
|
79
|
+
adapter: api
|
|
80
|
+
model: smart
|
|
81
|
+
|
|
82
|
+
models:
|
|
83
|
+
default: claude-sonnet-4-6
|
|
84
|
+
aliases:
|
|
85
|
+
fast: claude-haiku-4-5
|
|
86
|
+
smart: claude-opus-4-6
|
|
87
|
+
balanced: claude-sonnet-4-6
|
|
88
|
+
routing:
|
|
89
|
+
conversation: fast
|
|
90
|
+
task_execution: smart
|
|
91
|
+
classification: fast
|
|
92
|
+
fallbackChain: []
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Set environment variables in `.env`:
|
|
32
96
|
|
|
33
|
-
|
|
34
|
-
|
|
97
|
+
```bash
|
|
98
|
+
ANTHROPIC_API_KEY=your_key_here
|
|
99
|
+
SLACK_BOT_TOKEN=xoxb-your-token
|
|
35
100
|
```
|
|
36
101
|
|
|
37
|
-
|
|
102
|
+
### Run
|
|
38
103
|
|
|
39
104
|
```typescript
|
|
40
|
-
import {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
//
|
|
105
|
+
import { HookBus } from '@botinabox/core';
|
|
106
|
+
import { loadConfig } from '@botinabox/core';
|
|
107
|
+
import { DataStore, defineCoreTables } from '@botinabox/core';
|
|
108
|
+
import { ProviderRegistry, ModelRouter } from '@botinabox/core';
|
|
109
|
+
import { AgentRegistry, TaskQueue, RunManager } from '@botinabox/core';
|
|
110
|
+
import { ChannelRegistry, MessagePipeline } from '@botinabox/core';
|
|
111
|
+
import createAnthropicProvider from '@botinabox/provider-anthropic';
|
|
112
|
+
import createSlackAdapter from '@botinabox/channel-slack';
|
|
113
|
+
|
|
114
|
+
// Load config
|
|
115
|
+
const { config } = loadConfig({ configPath: 'botinabox.config.yml' });
|
|
116
|
+
|
|
117
|
+
// Initialize systems
|
|
50
118
|
const hooks = new HookBus();
|
|
51
|
-
const db = new DataStore({ dbPath:
|
|
52
|
-
|
|
53
|
-
// 2. Define tables and initialize
|
|
119
|
+
const db = new DataStore({ dbPath: config.data.path, wal: config.data.walMode, hooks });
|
|
54
120
|
defineCoreTables(db);
|
|
55
|
-
|
|
121
|
+
db.init();
|
|
56
122
|
|
|
57
|
-
//
|
|
123
|
+
// LLM providers
|
|
124
|
+
const providers = new ProviderRegistry();
|
|
125
|
+
providers.register(createAnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY! }));
|
|
126
|
+
const router = new ModelRouter(providers, config.models);
|
|
127
|
+
|
|
128
|
+
// Channels
|
|
129
|
+
const channels = new ChannelRegistry();
|
|
130
|
+
channels.register(createSlackAdapter(), config.channels.slack);
|
|
131
|
+
|
|
132
|
+
// Orchestration
|
|
58
133
|
const agents = new AgentRegistry(db, hooks);
|
|
59
134
|
const tasks = new TaskQueue(db, hooks);
|
|
60
135
|
const runs = new RunManager(db, hooks);
|
|
136
|
+
const pipeline = new MessagePipeline(hooks, agents, tasks, config);
|
|
61
137
|
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
name: 'Assistant',
|
|
66
|
-
adapter: 'api',
|
|
67
|
-
role: 'general',
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// 5. Listen for task creation
|
|
71
|
-
hooks.register('task.created', async (ctx) => {
|
|
72
|
-
console.log(`Task created: ${ctx.taskId}`);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// 6. Create a task
|
|
76
|
-
const taskId = await tasks.create({
|
|
77
|
-
title: 'Summarize the quarterly report',
|
|
78
|
-
description: 'Read the Q4 report and produce a 3-paragraph summary.',
|
|
79
|
-
assignee_id: agentId,
|
|
80
|
-
priority: 3,
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// 7. Wire up task completion hooks
|
|
84
|
-
hooks.register('run.completed', async (ctx) => {
|
|
85
|
-
console.log(`Run finished for task ${ctx.taskId}, exit code: ${ctx.exitCode}`);
|
|
86
|
-
});
|
|
138
|
+
// Start
|
|
139
|
+
tasks.startPolling();
|
|
140
|
+
await channels.start();
|
|
87
141
|
```
|
|
88
142
|
|
|
89
|
-
## Subpath Exports
|
|
90
|
-
|
|
91
|
-
| Import path | Description |
|
|
92
|
-
|---|---|
|
|
93
|
-
| `botinabox` | Core framework -- HookBus, DataStore, AgentRegistry, TaskQueue, RunManager, ChannelRegistry, MessagePipeline, Scheduler, config, security, and all shared types |
|
|
94
|
-
| `botinabox/anthropic` | Anthropic Claude provider (`createAnthropicProvider`) |
|
|
95
|
-
| `botinabox/openai` | OpenAI GPT provider (`createOpenAIProvider`) |
|
|
96
|
-
| `botinabox/ollama` | Ollama local model provider (`createOllamaProvider`) |
|
|
97
|
-
| `botinabox/slack` | Slack channel adapter (`SlackAdapter`) |
|
|
98
|
-
| `botinabox/discord` | Discord channel adapter (`DiscordAdapter`) |
|
|
99
|
-
| `botinabox/webhook` | Webhook channel adapter with HMAC verification (`WebhookAdapter`) |
|
|
100
|
-
| `botinabox/google` | Google connectors -- Gmail and Calendar via OAuth2 |
|
|
101
|
-
|
|
102
143
|
## Architecture
|
|
103
144
|
|
|
104
145
|
```
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
┌─────────────────────────────────────┐
|
|
147
|
+
│ Channel Adapters │
|
|
148
|
+
│ Slack · Discord · Webhook │
|
|
149
|
+
└──────────────┬──────────────────────┘
|
|
150
|
+
│ InboundMessage
|
|
151
|
+
┌──────────────▼──────────────────────┐
|
|
152
|
+
│ Message Pipeline │
|
|
153
|
+
│ routing · policies · sessions │
|
|
154
|
+
└──────────────┬──────────────────────┘
|
|
155
|
+
│ Task
|
|
156
|
+
┌──────────────▼──────────────────────┐
|
|
157
|
+
│ Task Queue │
|
|
158
|
+
│ priority · retry · followup chains │
|
|
159
|
+
└──────────────┬──────────────────────┘
|
|
160
|
+
│
|
|
161
|
+
┌──────────────▼──────────────────────┐
|
|
162
|
+
│ Run Manager │
|
|
163
|
+
│ locking · retries · cost tracking │
|
|
164
|
+
└──────────────┬──────────────────────┘
|
|
165
|
+
│
|
|
166
|
+
┌────────────────────┼────────────────────┐
|
|
167
|
+
▼ ▼ ▼
|
|
168
|
+
┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐
|
|
169
|
+
│ CLI Adapter │ │ API Adapter │ │ Custom │
|
|
170
|
+
│ (subprocess) │ │ (LLM + tools) │ │ Adapters │
|
|
171
|
+
└─────────────────┘ └────────┬─────────┘ └──────────────┘
|
|
172
|
+
│
|
|
173
|
+
┌─────────────▼───────────────────────┐
|
|
174
|
+
│ LLM Layer │
|
|
175
|
+
│ ProviderRegistry · ModelRouter │
|
|
176
|
+
│ CostTracker · Tool Loop │
|
|
177
|
+
└─────────────┬───────────────────────┘
|
|
178
|
+
│
|
|
179
|
+
┌───────────────────┼───────────────────┐
|
|
180
|
+
▼ ▼ ▼
|
|
181
|
+
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
182
|
+
│ Anthropic │ │ OpenAI │ │ Ollama │
|
|
183
|
+
└──────────────┘ └──────────────┘ └──────────────┘
|
|
143
184
|
```
|
|
144
185
|
|
|
145
|
-
Cross-cutting concerns
|
|
186
|
+
Cross-cutting concerns — **HookBus** (events), **DataStore** (persistence), **Security** (sanitization + audit) — connect all layers.
|
|
146
187
|
|
|
147
|
-
##
|
|
188
|
+
## Documentation
|
|
148
189
|
|
|
149
|
-
|
|
190
|
+
- [Getting Started](docs/getting-started.md) — Installation, project setup, first bot
|
|
191
|
+
- [Configuration](docs/configuration.md) — Full config reference
|
|
192
|
+
- [Architecture](docs/architecture.md) — System design and patterns
|
|
193
|
+
- [Providers](docs/providers.md) — LLM provider setup and custom providers
|
|
194
|
+
- [Channels](docs/channels.md) — Channel adapter setup and custom adapters
|
|
195
|
+
- [Orchestration](docs/orchestration.md) — Agents, tasks, workflows, and budget controls
|
|
196
|
+
- [API Reference](docs/api-reference.md) — Complete API documentation
|
|
150
197
|
|
|
151
|
-
|
|
198
|
+
## Development
|
|
152
199
|
|
|
153
|
-
|
|
200
|
+
```bash
|
|
201
|
+
# Install dependencies
|
|
202
|
+
pnpm install
|
|
154
203
|
|
|
155
|
-
|
|
204
|
+
# Build all packages
|
|
205
|
+
pnpm build
|
|
156
206
|
|
|
157
|
-
|
|
207
|
+
# Run all tests
|
|
208
|
+
pnpm test:run
|
|
158
209
|
|
|
159
|
-
|
|
210
|
+
# Type-check
|
|
211
|
+
pnpm typecheck
|
|
212
|
+
```
|
|
160
213
|
|
|
161
|
-
|
|
214
|
+
### Project Structure
|
|
162
215
|
|
|
163
|
-
|
|
216
|
+
```
|
|
217
|
+
botinabox/
|
|
218
|
+
├── packages/
|
|
219
|
+
│ ├── core/ # Core framework
|
|
220
|
+
│ │ └── src/
|
|
221
|
+
│ │ ├── config/ # YAML config loader + validation
|
|
222
|
+
│ │ ├── data/ # SQLite ORM, migrations, entity rendering
|
|
223
|
+
│ │ ├── hooks/ # Event bus
|
|
224
|
+
│ │ ├── llm/ # Provider registry, model router, cost tracking
|
|
225
|
+
│ │ ├── chat/ # Channel registry, message pipeline, sessions
|
|
226
|
+
│ │ ├── orchestrator/ # Agents, tasks, runs, workflows, adapters
|
|
227
|
+
│ │ ├── security/ # Sanitizer, audit, column validation
|
|
228
|
+
│ │ └── update/ # Self-update system
|
|
229
|
+
│ ├── shared/ # Types and constants (zero deps)
|
|
230
|
+
│ ├── cli/ # CLI scaffolding tool
|
|
231
|
+
│ ├── providers/
|
|
232
|
+
│ │ ├── anthropic/ # Claude models
|
|
233
|
+
│ │ ├── openai/ # GPT models
|
|
234
|
+
│ │ └── ollama/ # Local models
|
|
235
|
+
│ └── channels/
|
|
236
|
+
│ ├── slack/ # Slack adapter
|
|
237
|
+
│ ├── discord/ # Discord adapter
|
|
238
|
+
│ └── webhook/ # Webhook adapter + HMAC
|
|
239
|
+
├── package.json
|
|
240
|
+
├── pnpm-workspace.yaml
|
|
241
|
+
└── tsconfig.json
|
|
242
|
+
```
|
|
164
243
|
|
|
165
|
-
##
|
|
244
|
+
## Staying up to date
|
|
245
|
+
|
|
246
|
+
**CLI users:** The `botinabox` CLI checks for new versions automatically and prints a notice when an update is available. Run `botinabox update` to upgrade in place. Alternatively, use `npx botinabox` to always run the latest version without a global install.
|
|
166
247
|
|
|
167
|
-
|
|
168
|
-
- [Configuration](docs/configuration.md) -- Full config reference
|
|
169
|
-
- [Architecture](docs/architecture.md) -- System design and patterns
|
|
170
|
-
- [Providers](docs/providers.md) -- LLM provider setup and custom providers
|
|
171
|
-
- [Channels](docs/channels.md) -- Channel adapter setup and custom adapters
|
|
172
|
-
- [Orchestration](docs/orchestration.md) -- Agents, tasks, workflows, and budget controls
|
|
173
|
-
- [API Reference](docs/api-reference.md) -- Complete API documentation
|
|
248
|
+
**Library consumers:** By default, `npm install botinabox` adds a `^` semver range to your `package.json`, so patch and minor updates are picked up on your next `npm install`. For fully automated dependency updates, set up [Dependabot](https://docs.github.com/en/code-security/dependabot) or [Renovate](https://github.com/renovatebot/renovate) — they'll create PRs in your repo whenever a new version is published.
|
|
174
249
|
|
|
175
250
|
## License
|
|
176
251
|
|
package/dist/index.js
CHANGED
|
@@ -1155,17 +1155,15 @@ var DataStore = class {
|
|
|
1155
1155
|
outputFile: def.indexFile,
|
|
1156
1156
|
render: def.indexRender ?? ((rows) => {
|
|
1157
1157
|
const active = rows.filter((r) => r.deleted_at == null);
|
|
1158
|
-
const
|
|
1159
|
-
const title = dir.charAt(0).toUpperCase() + dir.slice(1);
|
|
1158
|
+
const title = def.directory.charAt(0).toUpperCase() + def.directory.slice(1);
|
|
1160
1159
|
if (!active.length) return `# ${title}
|
|
1161
1160
|
|
|
1162
1161
|
None.
|
|
1163
1162
|
`;
|
|
1164
1163
|
const lines = active.map((r) => {
|
|
1165
|
-
const
|
|
1166
|
-
const name2 = String(r.name ?? slug);
|
|
1164
|
+
const name2 = String(r.name ?? r[def.slugColumn] ?? r.id ?? "unknown");
|
|
1167
1165
|
const status = r.status ? ` (${r.status})` : "";
|
|
1168
|
-
return `-
|
|
1166
|
+
return `- **${name2}**${status}`;
|
|
1169
1167
|
});
|
|
1170
1168
|
return `# ${title}
|
|
1171
1169
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "botinabox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Bot in a Box — framework for building multi-agent bots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@types/uuid": "^10.0.0",
|
|
60
60
|
"ajv": "^8.17.1",
|
|
61
61
|
"cron-parser": "^4.9.0",
|
|
62
|
-
"latticesql": "^0.
|
|
62
|
+
"latticesql": "^1.0.0",
|
|
63
63
|
"uuid": "^13.0.0",
|
|
64
64
|
"yaml": "^2.7.0"
|
|
65
65
|
},
|