aibroker 0.5.1 → 0.6.2
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 +263 -104
- package/dist/adapters/iterm/iterm2-api.d.ts +20 -0
- package/dist/adapters/iterm/iterm2-api.d.ts.map +1 -0
- package/dist/adapters/iterm/iterm2-api.js +244 -0
- package/dist/adapters/iterm/iterm2-api.js.map +1 -0
- package/dist/adapters/iterm/sessions.d.ts +1 -0
- package/dist/adapters/iterm/sessions.d.ts.map +1 -1
- package/dist/adapters/iterm/sessions.js +26 -2
- package/dist/adapters/iterm/sessions.js.map +1 -1
- package/dist/adapters/kokoro/media.js +2 -2
- package/dist/adapters/kokoro/media.js.map +1 -1
- package/dist/adapters/pailot/gateway.d.ts +5 -6
- package/dist/adapters/pailot/gateway.d.ts.map +1 -1
- package/dist/adapters/pailot/gateway.js +575 -34
- package/dist/adapters/pailot/gateway.js.map +1 -1
- package/dist/aibp/bridge.d.ts +123 -0
- package/dist/aibp/bridge.d.ts.map +1 -0
- package/dist/aibp/bridge.js +363 -0
- package/dist/aibp/bridge.js.map +1 -0
- package/dist/aibp/envelope.d.ts +26 -0
- package/dist/aibp/envelope.d.ts.map +1 -0
- package/dist/aibp/envelope.js +101 -0
- package/dist/aibp/envelope.js.map +1 -0
- package/dist/aibp/index.d.ts +11 -0
- package/dist/aibp/index.d.ts.map +1 -0
- package/dist/aibp/index.js +10 -0
- package/dist/aibp/index.js.map +1 -0
- package/dist/aibp/registry.d.ts +71 -0
- package/dist/aibp/registry.d.ts.map +1 -0
- package/dist/aibp/registry.js +408 -0
- package/dist/aibp/registry.js.map +1 -0
- package/dist/aibp/types.d.ts +91 -0
- package/dist/aibp/types.d.ts.map +1 -0
- package/dist/aibp/types.js +8 -0
- package/dist/aibp/types.js.map +1 -0
- package/dist/core/hybrid.d.ts +2 -0
- package/dist/core/hybrid.d.ts.map +1 -1
- package/dist/core/hybrid.js +8 -0
- package/dist/core/hybrid.js.map +1 -1
- package/dist/core/state.d.ts +12 -0
- package/dist/core/state.d.ts.map +1 -1
- package/dist/core/state.js +34 -0
- package/dist/core/state.js.map +1 -1
- package/dist/core/status-cache.d.ts +51 -0
- package/dist/core/status-cache.d.ts.map +1 -0
- package/dist/core/status-cache.js +62 -0
- package/dist/core/status-cache.js.map +1 -0
- package/dist/daemon/adapter-registry.d.ts +5 -0
- package/dist/daemon/adapter-registry.d.ts.map +1 -1
- package/dist/daemon/adapter-registry.js +94 -4
- package/dist/daemon/adapter-registry.js.map +1 -1
- package/dist/daemon/cli.d.ts +1 -0
- package/dist/daemon/cli.d.ts.map +1 -1
- package/dist/daemon/cli.js +95 -3
- package/dist/daemon/cli.js.map +1 -1
- package/dist/daemon/command-context.d.ts +28 -0
- package/dist/daemon/command-context.d.ts.map +1 -0
- package/dist/daemon/command-context.js +13 -0
- package/dist/daemon/command-context.js.map +1 -0
- package/dist/daemon/commands.d.ts +22 -0
- package/dist/daemon/commands.d.ts.map +1 -0
- package/dist/daemon/commands.js +849 -0
- package/dist/daemon/commands.js.map +1 -0
- package/dist/daemon/core-handlers.d.ts.map +1 -1
- package/dist/daemon/core-handlers.js +758 -3
- package/dist/daemon/core-handlers.js.map +1 -1
- package/dist/daemon/create-adapter.js +2 -1
- package/dist/daemon/create-adapter.js.map +1 -1
- package/dist/daemon/image-context.d.ts +56 -0
- package/dist/daemon/image-context.d.ts.map +1 -0
- package/dist/daemon/image-context.js +116 -0
- package/dist/daemon/image-context.js.map +1 -0
- package/dist/daemon/image-gen/index.d.ts +22 -0
- package/dist/daemon/image-gen/index.d.ts.map +1 -0
- package/dist/daemon/image-gen/index.js +129 -0
- package/dist/daemon/image-gen/index.js.map +1 -0
- package/dist/daemon/image-gen/providers/cloudflare.d.ts +13 -0
- package/dist/daemon/image-gen/providers/cloudflare.d.ts.map +1 -0
- package/dist/daemon/image-gen/providers/cloudflare.js +63 -0
- package/dist/daemon/image-gen/providers/cloudflare.js.map +1 -0
- package/dist/daemon/image-gen/providers/huggingface.d.ts +12 -0
- package/dist/daemon/image-gen/providers/huggingface.d.ts.map +1 -0
- package/dist/daemon/image-gen/providers/huggingface.js +58 -0
- package/dist/daemon/image-gen/providers/huggingface.js.map +1 -0
- package/dist/daemon/image-gen/providers/pollinations.d.ts +11 -0
- package/dist/daemon/image-gen/providers/pollinations.d.ts.map +1 -0
- package/dist/daemon/image-gen/providers/pollinations.js +39 -0
- package/dist/daemon/image-gen/providers/pollinations.js.map +1 -0
- package/dist/daemon/image-gen/providers/replicate.d.ts +9 -0
- package/dist/daemon/image-gen/providers/replicate.d.ts.map +1 -0
- package/dist/daemon/image-gen/providers/replicate.js +158 -0
- package/dist/daemon/image-gen/providers/replicate.js.map +1 -0
- package/dist/daemon/image-gen/types.d.ts +41 -0
- package/dist/daemon/image-gen/types.d.ts.map +1 -0
- package/dist/daemon/image-gen/types.js +5 -0
- package/dist/daemon/image-gen/types.js.map +1 -0
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +260 -6
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/screenshot.d.ts +12 -0
- package/dist/daemon/screenshot.d.ts.map +1 -0
- package/dist/daemon/screenshot.js +252 -0
- package/dist/daemon/screenshot.js.map +1 -0
- package/dist/daemon/session-content.d.ts +27 -0
- package/dist/daemon/session-content.d.ts.map +1 -0
- package/dist/daemon/session-content.js +76 -0
- package/dist/daemon/session-content.js.map +1 -0
- package/dist/daemon/vision.d.ts +46 -0
- package/dist/daemon/vision.d.ts.map +1 -0
- package/dist/daemon/vision.js +176 -0
- package/dist/daemon/vision.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/ipc/validate.d.ts +52 -0
- package/dist/ipc/validate.d.ts.map +1 -0
- package/dist/ipc/validate.js +129 -0
- package/dist/ipc/validate.js.map +1 -0
- package/dist/mcp/index.d.ts +23 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +787 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/types/broker.d.ts +3 -1
- package/dist/types/broker.d.ts.map +1 -1
- package/dist/types/broker.js.map +1 -1
- package/package.json +5 -2
- package/templates/adapter/ONBOARDING_PROMPT.md +51 -29
- package/templates/adapter/README.md.tmpl +14 -31
- package/templates/adapter/package.json.tmpl +1 -1
- package/templates/adapter/src/watcher/commands.ts.tmpl +24 -126
- package/templates/adapter/src/watcher/index.ts.tmpl +112 -88
- package/templates/adapter/src/watcher/ipc-server.ts.tmpl +27 -3
package/README.md
CHANGED
|
@@ -1,75 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AIBroker
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
bridges that connect WhatsApp, Telegram, and other channels to Claude Code.
|
|
3
|
+
Claude Code is locked inside your terminal. You can only talk to it by typing. AIBroker breaks it out — send a WhatsApp voice note from the train, text from Telegram on your phone, or use the PAILot iOS app with full session management. Claude hears you, works on it, and replies in the same channel. Voice in, voice out.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
Install AIBroker and your Claude Code sessions become reachable from anywhere. Ask Claude to check on your build while you're away from the desk. Send a screenshot request from WhatsApp. Switch between Claude sessions from your phone. It all routes through one daemon that owns the plumbing — TTS, transcription, image generation, screenshots, session management — so the adapters stay thin and the experience stays consistent.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
---
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
Messaging Services AIBroker Hub AI Backends
|
|
12
|
-
───────────────── ──────────── ───────────
|
|
13
|
-
WhatsApp (Whazaa) ──────> ──────> Anthropic Claude
|
|
14
|
-
Telegram (Telex) ──────> Hub Daemon ──────> OpenAI
|
|
15
|
-
iOS App (PAILot) ──────> ──────> Ollama (local)
|
|
16
|
-
Your Adapter ──────> ──────> Custom Backend
|
|
17
|
-
```
|
|
9
|
+
## What You Can Do
|
|
18
10
|
|
|
19
|
-
|
|
11
|
+
### Talk to Claude from Your Phone
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
- **WhatsApp** — Send a text or voice note. Claude gets it, processes it, replies back. Voice in → voice out.
|
|
14
|
+
- **Telegram** — Same experience, different app. Text and voice both work.
|
|
15
|
+
- **PAILot** (iOS app) — Native companion app with session switching, voice messages, typing indicators, and message history.
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
### Manage Sessions Remotely
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
- "Show me all sessions" — see every running Claude Code session
|
|
20
|
+
- "Switch to session 2" — route your messages to a different session
|
|
21
|
+
- "Start a new session for ~/projects/api" — launch a fresh Claude session from your phone
|
|
22
|
+
- "Screenshot" — capture what Claude is showing in iTerm right now
|
|
23
|
+
- "What's the status?" — see which sessions are busy, idle, or waiting
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
### Voice and Media
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
- **Voice notes** — Send a voice note from WhatsApp or Telegram. Whisper transcribes it, Claude processes it, Kokoro speaks the reply back as a voice note.
|
|
28
|
+
- **Image generation** — "Send me an image of a sunset over mountains" — Flux generates it, delivers it to your chat.
|
|
29
|
+
- **Screenshots** — Capture any iTerm session and receive the image on your phone.
|
|
30
|
+
- **Video analysis** — Send a video, Gemini analyzes it, Claude discusses the results.
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
### Slash Commands from Anywhere
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|----------|-------------|----------|---------------------|
|
|
39
|
-
| **Anthropic Claude** | Claude Agent SDK subprocess | Yes (full tool access) | Yes (session resume) |
|
|
40
|
-
| **OpenAI** | Chat Completions API | No | No (stateless) |
|
|
41
|
-
| **Ollama** | Local Ollama HTTP API | No | No (stateless) |
|
|
42
|
-
| **Custom** | Your implementation | Optional | Optional |
|
|
34
|
+
Type these in any channel — WhatsApp, Telegram, PAILot, or terminal:
|
|
43
35
|
|
|
44
|
-
|
|
36
|
+
| Command | What it does |
|
|
37
|
+
|---------|-------------|
|
|
38
|
+
| `/s` | List all sessions |
|
|
39
|
+
| `/n ~/project` | Start a new visual session |
|
|
40
|
+
| `/ss` | Screenshot the active session |
|
|
41
|
+
| `/status` | Show all session statuses |
|
|
42
|
+
| `/image a cat in space` | Generate and deliver an image |
|
|
43
|
+
| `/e 3` | End session 3 |
|
|
44
|
+
| `/aibp` | AIBP protocol status — plugins, channels, commands |
|
|
45
|
+
| `/aibp plugins` | Detailed plugin list with capabilities |
|
|
46
|
+
| `/aibp commands` | All registered commands by owner |
|
|
47
|
+
| `/aibp help` | List all `/aibp` subcommands |
|
|
45
48
|
|
|
46
49
|
---
|
|
47
50
|
|
|
48
51
|
## Quick Start
|
|
49
52
|
|
|
53
|
+
Tell Claude Code:
|
|
54
|
+
|
|
55
|
+
> Clone https://github.com/mnott/AIBroker and set it up for me
|
|
56
|
+
|
|
57
|
+
Or manually:
|
|
58
|
+
|
|
50
59
|
### 1. Install
|
|
51
60
|
|
|
52
61
|
```bash
|
|
53
|
-
|
|
62
|
+
git clone https://github.com/mnott/AIBroker
|
|
63
|
+
cd AIBroker
|
|
64
|
+
npm install
|
|
65
|
+
npm run build
|
|
54
66
|
```
|
|
55
67
|
|
|
56
|
-
### 2. Configure
|
|
68
|
+
### 2. Configure the MCP server
|
|
57
69
|
|
|
58
|
-
|
|
70
|
+
Add to `~/.claude.json` under `mcpServers`:
|
|
59
71
|
|
|
60
72
|
```json
|
|
61
|
-
{
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"socketPath": "/tmp/whazaa-watcher.sock"
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
"backend": {
|
|
69
|
-
"type": "api",
|
|
70
|
-
"provider": "anthropic",
|
|
71
|
-
"model": "claude-opus-4-5"
|
|
72
|
-
}
|
|
73
|
+
"aibroker": {
|
|
74
|
+
"type": "stdio",
|
|
75
|
+
"command": "node",
|
|
76
|
+
"args": ["/path/to/AIBroker/dist/mcp/index.js"]
|
|
73
77
|
}
|
|
74
78
|
```
|
|
75
79
|
|
|
@@ -79,121 +83,276 @@ Create `~/.aibroker/config.json`:
|
|
|
79
83
|
aibroker start
|
|
80
84
|
```
|
|
81
85
|
|
|
82
|
-
|
|
86
|
+
The daemon runs as a macOS launchd service (`com.aibroker.daemon`). It owns the IPC socket at `/tmp/aibroker.sock` and the PAILot WebSocket gateway on port 8765.
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
aibroker status
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### 4. Install and start an adapter
|
|
88
|
+
### 4. Connect an adapter
|
|
89
89
|
|
|
90
90
|
```bash
|
|
91
|
+
# WhatsApp
|
|
91
92
|
npm install -g whazaa
|
|
92
93
|
whazaa watch
|
|
94
|
+
|
|
95
|
+
# Telegram
|
|
96
|
+
npm install -g telex
|
|
97
|
+
telex watch
|
|
93
98
|
```
|
|
94
99
|
|
|
95
|
-
Once
|
|
100
|
+
Once connected, messages from your phone route to Claude and replies come back automatically.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Architecture
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
Your Phone AIBroker Daemon Claude Code
|
|
108
|
+
────────── ─────────────── ──────────
|
|
109
|
+
WhatsApp ───► Whazaa ──┐ ┌──► Session 1 (iTerm)
|
|
110
|
+
Telegram ───► Telex ──┤ Hub (IPC + AIBP routing) ├──► Session 2 (iTerm)
|
|
111
|
+
PAILot ───► WS:8765 ──┤ TTS · STT · Screenshots ├──► Session 3 (iTerm)
|
|
112
|
+
Your App ───► Adapter ──┘ Image Gen · Session Mgmt └──► Headless (API)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**AIBroker is the runtime.** Adapters are thin transport plugins — they handle the network connection and nothing else. All intelligence lives in the hub: command parsing, message routing, media pipelines, session orchestration.
|
|
116
|
+
|
|
117
|
+
### AIBP Protocol
|
|
118
|
+
|
|
119
|
+
Internally, all messages flow through AIBP (AIBroker Protocol) — an IRC-inspired routing layer with explicit source/destination addressing, typed channels, and plugin registration.
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
Plugin A ──message──► #session:abc ──fan-out──► Plugin B, Plugin C, Plugin D
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Every plugin declares its type and capabilities:
|
|
126
|
+
|
|
127
|
+
| Plugin Type | Examples | Capabilities |
|
|
128
|
+
|------------|----------|-------------|
|
|
129
|
+
| `transport` | Whazaa, Telex | TEXT, VOICE, IMAGE, FILE |
|
|
130
|
+
| `terminal` | iTerm2 | TEXT, COMMAND |
|
|
131
|
+
| `mobile` | PAILot | TEXT, VOICE, IMAGE, TYPING, STATUS |
|
|
132
|
+
| `mcp` | Claude Code sessions | TEXT, VOICE, IMAGE, COMMAND |
|
|
133
|
+
| `bridge` | Remote hubs | TEXT, VOICE, IMAGE, COMMAND, FILE |
|
|
134
|
+
|
|
135
|
+
Messages carry explicit `src` and `dst` addresses — no guessing which session should receive what. Cross-session messaging, mesh networking between machines, and channel fan-out all work through the same protocol.
|
|
136
|
+
|
|
137
|
+
### Inspecting the Protocol
|
|
138
|
+
|
|
139
|
+
Use `/aibp` from any channel (WhatsApp, Telegram, PAILot) or the `aibroker_aibp_status` MCP tool from Claude Code to see the live state of the routing infrastructure:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
/aibp → combined overview (sessions, plugins, channels, peers)
|
|
143
|
+
/aibp plugins → registered plugins with type, status, capabilities
|
|
144
|
+
/aibp channels → active channels with members and activity
|
|
145
|
+
/aibp commands → all commands grouped by owning plugin
|
|
146
|
+
/aibp peers → mesh network peers
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`/status` and `/st` are shortcuts for `/aibp status`.
|
|
150
|
+
|
|
151
|
+
For the full protocol spec, see [docs/protocol.md](docs/protocol.md).
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## MCP Tools
|
|
156
|
+
|
|
157
|
+
AIBroker exposes 42 MCP tools through a single unified server. Claude uses these automatically based on message routing rules — you don't need to call them manually.
|
|
158
|
+
|
|
159
|
+
### Message Routing
|
|
160
|
+
|
|
161
|
+
When a message arrives with a prefix, Claude knows where it came from and replies through the matching channel:
|
|
162
|
+
|
|
163
|
+
| Prefix | Source | Claude replies with |
|
|
164
|
+
|--------|--------|-------------------|
|
|
165
|
+
| `[Whazaa]` | WhatsApp text | `whatsapp_send` |
|
|
166
|
+
| `[Whazaa:voice]` | WhatsApp voice note | `whatsapp_tts` |
|
|
167
|
+
| `[Telex]` | Telegram text | `telegram_send` |
|
|
168
|
+
| `[Telex:voice]` | Telegram voice note | `telegram_tts` |
|
|
169
|
+
| `[PAILot]` | PAILot app text | `pailot_send` |
|
|
170
|
+
| `[PAILot:voice]` | PAILot app voice | `pailot_tts` |
|
|
171
|
+
| _(no prefix)_ | Terminal keyboard | Terminal only |
|
|
172
|
+
|
|
173
|
+
### Tool Categories
|
|
174
|
+
|
|
175
|
+
| Category | Tools | What they do |
|
|
176
|
+
|----------|-------|-------------|
|
|
177
|
+
| `whatsapp_*` | send, tts, contacts, chats, history, login, status | WhatsApp messaging and management |
|
|
178
|
+
| `telegram_*` | send, tts, contacts, chats, history, login, status | Telegram messaging and management |
|
|
179
|
+
| `pailot_*` | send, tts, receive | PAILot app communication |
|
|
180
|
+
| `aibroker_*` | status, sessions, switch, discover, speak, dictate, generate_image, ... | Hub-level operations |
|
|
181
|
+
|
|
182
|
+
For the complete reference, see [docs/mcp-tools.md](docs/mcp-tools.md).
|
|
96
183
|
|
|
97
184
|
---
|
|
98
185
|
|
|
99
186
|
## Bring Your Own Messenger
|
|
100
187
|
|
|
101
|
-
AIBroker adapters are standalone npm packages.
|
|
188
|
+
AIBroker adapters are standalone npm packages. A scaffold generator handles all the IPC wiring, MCP registration, and hub integration. You implement two things: how to connect and how to send.
|
|
102
189
|
|
|
103
190
|
```bash
|
|
104
191
|
aibroker create-adapter my-signal
|
|
105
192
|
cd my-signal
|
|
106
|
-
|
|
193
|
+
npm install
|
|
107
194
|
```
|
|
108
195
|
|
|
109
|
-
Full guide: [docs/
|
|
196
|
+
Full guide: [docs/adapters.md](docs/adapters.md)
|
|
110
197
|
|
|
111
198
|
---
|
|
112
199
|
|
|
113
|
-
##
|
|
200
|
+
## Media Pipelines
|
|
201
|
+
|
|
202
|
+
All media processing is centralized in the hub — adapters never touch TTS, transcription, or image generation directly.
|
|
114
203
|
|
|
115
|
-
|
|
204
|
+
| Pipeline | Technology | What happens |
|
|
205
|
+
|----------|-----------|-------------|
|
|
206
|
+
| **Text-to-Speech** | Kokoro (local) | Text → WAV → OGG Opus → delivered as voice note |
|
|
207
|
+
| **Speech-to-Text** | Whisper (local) | Voice note → transcription → delivered as text to Claude |
|
|
208
|
+
| **Image Generation** | Pluggable (see below) | Prompt → image → delivered to chat |
|
|
209
|
+
| **Image Analysis** | Claude Vision | Image → description → text response (no extra API cost on Max plan) |
|
|
210
|
+
| **Video Analysis** | Gemini 2.0 Flash | Video → analysis → text response (free tier: 15 RPM) |
|
|
211
|
+
| **Screenshots** | iTerm2 AppleScript | Capture terminal → PNG → delivered to chat |
|
|
212
|
+
|
|
213
|
+
### Image Generation — Works Out of the Box
|
|
214
|
+
|
|
215
|
+
Image generation uses [Pollinations.ai](https://pollinations.ai) by default — free, unlimited, no API key, no signup. Just ask Claude to generate an image and it works.
|
|
216
|
+
|
|
217
|
+
Want faster results? Upgrade to a paid provider by setting a single environment variable in `~/.aibroker/env`:
|
|
218
|
+
|
|
219
|
+
| Provider | Setup | Speed | Cost |
|
|
220
|
+
|----------|-------|-------|------|
|
|
221
|
+
| **Pollinations** _(default)_ | Nothing — works immediately | ~20s | Free |
|
|
222
|
+
| **Replicate** | `REPLICATE_API_TOKEN=r8_...` | 2-4s | ~$0.003/image |
|
|
223
|
+
| **Cloudflare Workers AI** | `CLOUDFLARE_AI_TOKEN=...` + `CLOUDFLARE_ACCOUNT_ID=...` | 3-5s | Free (~100/day) |
|
|
224
|
+
| **Hugging Face** | `HF_API_TOKEN=hf_...` | 5-15s | Free (rate-limited) |
|
|
225
|
+
|
|
226
|
+
AIBroker auto-detects which token is set and uses that provider. No config file needed.
|
|
227
|
+
|
|
228
|
+
**Pin a specific provider** with `~/.aibroker/image-gen.json`:
|
|
116
229
|
|
|
117
230
|
```json
|
|
118
231
|
{
|
|
119
|
-
"
|
|
120
|
-
"type": "api",
|
|
121
|
-
"provider": "ollama",
|
|
122
|
-
"model": "llama3.2"
|
|
123
|
-
}
|
|
232
|
+
"provider": "replicate"
|
|
124
233
|
}
|
|
125
234
|
```
|
|
126
235
|
|
|
236
|
+
**Bring your own provider** — point to any Node.js module that implements the `ImageProvider` interface:
|
|
237
|
+
|
|
127
238
|
```json
|
|
128
239
|
{
|
|
129
|
-
"
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
"options": { "model": "my-model" }
|
|
133
|
-
}
|
|
240
|
+
"provider": "custom",
|
|
241
|
+
"modulePath": "/path/to/my-provider.js",
|
|
242
|
+
"options": { "apiKey": "...", "endpoint": "https://my-api.com" }
|
|
134
243
|
}
|
|
135
244
|
```
|
|
136
245
|
|
|
137
|
-
|
|
246
|
+
Your module exports one function:
|
|
138
247
|
|
|
139
|
-
|
|
248
|
+
```typescript
|
|
249
|
+
import type { ImageProvider, ImageProviderConfig } from "aibroker";
|
|
250
|
+
|
|
251
|
+
export function createProvider(config: ImageProviderConfig): ImageProvider {
|
|
252
|
+
return {
|
|
253
|
+
name: "my-provider",
|
|
254
|
+
async generate(opts) {
|
|
255
|
+
const res = await fetch(config.options.endpoint, { /* ... */ });
|
|
256
|
+
return {
|
|
257
|
+
images: [Buffer.from(await res.arrayBuffer())],
|
|
258
|
+
model: "my-model",
|
|
259
|
+
durationMs: 0,
|
|
260
|
+
};
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
All built-in providers use FLUX.1 Schnell by default. Override with `"model": "your-model-id"` in the config.
|
|
267
|
+
|
|
268
|
+
### Iterative Refinement
|
|
269
|
+
|
|
270
|
+
Image generation is conversational. Generate an image, then refine it with follow-up messages:
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
You: "Send me an image of a fish sitting on a chair"
|
|
274
|
+
Claude: [image]
|
|
275
|
+
You: "Put a tie on it"
|
|
276
|
+
Claude: [refined image — fish on chair, now wearing a tie]
|
|
277
|
+
You: "Make it watercolor style"
|
|
278
|
+
Claude: [refined image — watercolor fish with tie on chair]
|
|
279
|
+
```
|
|
140
280
|
|
|
141
|
-
|
|
281
|
+
AIBroker detects refinement intent from modification verbs ("put", "add", "make"), image references ("it", "the image"), style keywords ("watercolor", "cartoon"), and prepositional modifiers ("with a hat", "without the chair"). Messages that don't reference the image pass through to Claude normally — no manual "stop" needed.
|
|
142
282
|
|
|
143
|
-
|
|
144
|
-
- Session state management and message queuing
|
|
145
|
-
- File persistence with configurable data dir (`setAppDir`)
|
|
146
|
-
- Unix Domain Socket IPC (server + client)
|
|
147
|
-
- macOS iTerm2 adapter (AppleScript session management)
|
|
148
|
-
- Kokoro TTS (local speech synthesis + Whisper transcription)
|
|
149
|
-
- PAILot WebSocket gateway (iOS companion app support)
|
|
283
|
+
Image context is scoped per source, recipient, and session, so multiple users or devices never interfere. Context expires after 30 minutes of inactivity. Say "new image" or "start over" to reset explicitly.
|
|
150
284
|
|
|
151
285
|
---
|
|
152
286
|
|
|
153
|
-
##
|
|
287
|
+
## PAILot Companion App
|
|
154
288
|
|
|
155
|
-
|
|
156
|
-
import { setLogPrefix, setAppDir, log } from "aibroker";
|
|
289
|
+
PAILot is a native iOS app that connects to AIBroker over WebSocket. It provides:
|
|
157
290
|
|
|
158
|
-
|
|
159
|
-
|
|
291
|
+
- **Session management** — switch between Claude sessions, start new ones, end old ones
|
|
292
|
+
- **Voice messages** — record and send, receive voice replies with chain playback
|
|
293
|
+
- **Typing indicators** — see when Claude is processing
|
|
294
|
+
- **Message history** — persistent chat with text and voice
|
|
295
|
+
- **Offline queuing** — messages buffer on the server when you're disconnected, drain on reconnect
|
|
296
|
+
- **Session isolation** — the gateway tracks which session each client is viewing and only delivers matching messages, preventing cross-session content bleed
|
|
160
297
|
|
|
161
|
-
|
|
162
|
-
```
|
|
298
|
+
PAILot connects to `ws://your-mac:8765`. See [docs/pailot.md](docs/pailot.md).
|
|
163
299
|
|
|
164
|
-
|
|
300
|
+
---
|
|
165
301
|
|
|
166
|
-
|
|
167
|
-
|
|
302
|
+
## Mesh Networking
|
|
303
|
+
|
|
304
|
+
Two AIBroker instances on different machines can exchange messages through AIBP bridge plugins. A message from PAILot on Machine A can reach a Claude session on Machine B:
|
|
168
305
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
306
|
+
```
|
|
307
|
+
Machine A Machine B
|
|
308
|
+
───────── ─────────
|
|
309
|
+
PAILot ──► Hub A ──bridge──► Hub B ──► Claude Session
|
|
172
310
|
```
|
|
173
311
|
|
|
174
|
-
|
|
312
|
+
Addressing is explicit: `hub:machine-b/session:abc` routes through the bridge to the remote hub. See [docs/mesh.md](docs/mesh.md).
|
|
175
313
|
|
|
176
|
-
|
|
314
|
+
---
|
|
177
315
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
316
|
+
## Documentation
|
|
317
|
+
|
|
318
|
+
| Document | What it covers |
|
|
319
|
+
|----------|---------------|
|
|
320
|
+
| [architecture.md](docs/architecture.md) | System design, component interactions, data flow |
|
|
321
|
+
| [protocol.md](docs/protocol.md) | AIBP protocol specification |
|
|
322
|
+
| [plugins.md](docs/plugins.md) | Plugin types, registration, capabilities |
|
|
323
|
+
| [routing.md](docs/routing.md) | Message routing logic and channel system |
|
|
324
|
+
| [sessions.md](docs/sessions.md) | Session management and lifecycle |
|
|
325
|
+
| [commands.md](docs/commands.md) | Slash command reference |
|
|
326
|
+
| [mcp-tools.md](docs/mcp-tools.md) | All 42 MCP tools with parameters |
|
|
327
|
+
| [adapters.md](docs/adapters.md) | Adapter development guide |
|
|
328
|
+
| [pailot.md](docs/pailot.md) | PAILot iOS app integration |
|
|
329
|
+
| [mesh.md](docs/mesh.md) | Multi-machine mesh networking |
|
|
330
|
+
| [ipc.md](docs/ipc.md) | IPC protocol and message format |
|
|
331
|
+
| [tts-stt.md](docs/tts-stt.md) | Voice pipeline details |
|
|
332
|
+
| [use-cases.md](docs/use-cases.md) | End-to-end message flow diagrams |
|
|
333
|
+
| [protocol-landscape.md](docs/protocol-landscape.md) | How AIBP relates to A2A, MCP, and other standards |
|
|
334
|
+
| [configuration.md](docs/configuration.md) | Configuration reference |
|
|
335
|
+
| [development.md](docs/development.md) | Development setup and testing |
|
|
181
336
|
|
|
182
337
|
---
|
|
183
338
|
|
|
184
|
-
##
|
|
339
|
+
## Hard Rule
|
|
185
340
|
|
|
186
|
-
|
|
187
|
-
|---------|---------|------|
|
|
188
|
-
| **aibroker** | Shared core | [github.com/mnott/AIBroker](https://github.com/mnott/AIBroker) |
|
|
189
|
-
| **whazaa** | WhatsApp | [github.com/mnott/Whazaa](https://github.com/mnott/Whazaa) |
|
|
190
|
-
| **telex** | Telegram | [github.com/mnott/Telex](https://github.com/mnott/Telex) |
|
|
341
|
+
AIBroker never imports `@whiskeysockets/baileys`, `telegram`/`gramjs`, `better-sqlite3`, `qrcode`, or any transport-specific SDK. Platform-specific dependencies belong in the adapter packages.
|
|
191
342
|
|
|
192
343
|
---
|
|
193
344
|
|
|
194
|
-
##
|
|
345
|
+
## Companion Projects
|
|
195
346
|
|
|
196
|
-
|
|
347
|
+
| Package | What it does | Repo |
|
|
348
|
+
|---------|-------------|------|
|
|
349
|
+
| **[PAI](https://github.com/mnott/PAI)** | Knowledge OS — persistent memory, session continuity, semantic search for Claude Code | [github.com/mnott/PAI](https://github.com/mnott/PAI) |
|
|
350
|
+
| **[Whazaa](https://github.com/mnott/Whazaa)** | WhatsApp adapter — voice notes, media, contact management | [github.com/mnott/Whazaa](https://github.com/mnott/Whazaa) |
|
|
351
|
+
| **[Telex](https://github.com/mnott/Telex)** | Telegram adapter — text and voice messaging | [github.com/mnott/Telex](https://github.com/mnott/Telex) |
|
|
352
|
+
| **[Coogle](https://github.com/mnott/Coogle)** | Google Workspace MCP — Gmail, Calendar, Drive multiplexing | [github.com/mnott/Coogle](https://github.com/mnott/Coogle) |
|
|
353
|
+
| **[DEVONthink MCP](https://github.com/mnott/devonthink-mcp)** | DEVONthink integration — document search and archival | [github.com/mnott/devonthink-mcp](https://github.com/mnott/devonthink-mcp) |
|
|
354
|
+
|
|
355
|
+
---
|
|
197
356
|
|
|
198
357
|
## License
|
|
199
358
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* adapters/iterm/iterm2-api.ts — Native iTerm2 API client via WebSocket + protobuf.
|
|
3
|
+
*
|
|
4
|
+
* Connects to iTerm2's local API (unix socket or TCP) to perform operations
|
|
5
|
+
* that aren't possible via AppleScript alone, such as setting the tab title
|
|
6
|
+
* override (the persistent title set by double-click rename).
|
|
7
|
+
*
|
|
8
|
+
* Zero external dependencies beyond `ws` (already in the project).
|
|
9
|
+
* Replaces the Python `iterm2` module dependency.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Set the tab title override for the tab containing a given iTerm2 session.
|
|
13
|
+
* This is the same as double-click renaming a tab — it persists until changed.
|
|
14
|
+
*
|
|
15
|
+
* Uses iTerm2's native WebSocket API (unix socket at
|
|
16
|
+
* ~/Library/Application Support/iTerm2/private/socket).
|
|
17
|
+
* No Python dependency required.
|
|
18
|
+
*/
|
|
19
|
+
export declare function iterm2SetTabTitle(sessionId: string, newTitle: string): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=iterm2-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iterm2-api.d.ts","sourceRoot":"","sources":["../../../src/adapters/iterm/iterm2-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoMH;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwD1F"}
|