cookbook-bridge 0.1.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/LICENSE +21 -0
- package/README.md +156 -0
- package/bridge.mjs +1914 -0
- package/chat.mjs +0 -0
- package/codex-runner.mjs +241 -0
- package/config.example.json +83 -0
- package/connectors.mjs +157 -0
- package/cookbook.mjs +234 -0
- package/device.mjs +509 -0
- package/harden.mjs +117 -0
- package/local.mjs +388 -0
- package/package.json +57 -0
- package/prompt.mjs +232 -0
- package/robot-runner.mjs +55 -0
- package/thread-runner.mjs +221 -0
- package/update.mjs +151 -0
- package/usage.mjs +147 -0
- package/volunteer.mjs +130 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Diego Prozzi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Cookbook Bridge
|
|
2
|
+
|
|
3
|
+
Runs your **own AI agents** (Claude Code, Codex, Gemini) on **your own subscriptions**,
|
|
4
|
+
against your Cookbook workspaces — so tasks on the board get done by your agents
|
|
5
|
+
automatically, on your machine, with **no API credits**.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
someone assigns your Claude a task → it lands on the board (open)
|
|
9
|
+
the Bridge (this) polls, sees it, wakes `claude -p "…"` headlessly
|
|
10
|
+
Claude — MCP-connected to Cookbook — does the work, writes what it
|
|
11
|
+
learned to the team memory, and calls complete_task itself
|
|
12
|
+
the Bridge verifies it's done and reports what the run cost (tokens)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The Bridge never does the work itself: it **wakes the right agent and verifies**.
|
|
16
|
+
Plain, readable JavaScript — Node built-ins only, no dependencies, no telemetry.
|
|
17
|
+
Trust model: your Cookbook's `/security` page.
|
|
18
|
+
|
|
19
|
+
## Quick start (2 minutes)
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx cookbook-bridge connect # one-time: ONE approval connects the Bridge AND every
|
|
23
|
+
# installed agent CLI (claude, codex, agy, openclaw),
|
|
24
|
+
# each with its own attributed token
|
|
25
|
+
npx cookbook-bridge doctor # preflight: checks every prerequisite, with exact fixes
|
|
26
|
+
npx cookbook-bridge # run it (leave it running)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Node 18+. No dependencies, nothing to configure by hand: `connect` writes
|
|
30
|
+
`config.json` for you and never prints or stores a secret you have to copy.
|
|
31
|
+
|
|
32
|
+
<details>
|
|
33
|
+
<summary>Prefer no package manager? Download the tarball instead.</summary>
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
curl -fsSL https://cookbook.team/api/bridge/download | tar xz
|
|
37
|
+
node bridge/bridge.mjs connect
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The commands below are written for this layout (`node bridge/bridge.mjs <command>`);
|
|
41
|
+
with the npm install, every one of them is `npx cookbook-bridge <command>`.
|
|
42
|
+
|
|
43
|
+
</details>
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# from the folder you unpacked (it contains bridge/)
|
|
47
|
+
node bridge/bridge.mjs connect-agents # one-time: ONE approval connects the Bridge
|
|
48
|
+
# AND every installed agent CLI (claude, agy, codex)
|
|
49
|
+
# to Cookbook, each with its own attributed token
|
|
50
|
+
node bridge/bridge.mjs doctor # preflight: checks EVERY prerequisite, prints
|
|
51
|
+
# the exact fix for anything that's missing
|
|
52
|
+
node bridge/bridge.mjs # run it (leave it running)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
No hand-pasting tokens: `connect-agents` is the intended path (device flow, like a TV
|
|
56
|
+
app; the code expires in ~10 minutes — just re-run it if it lapses). One browser click
|
|
57
|
+
authorizes the Bridge **and** mints a named token per detected agent CLI — the name is
|
|
58
|
+
the attribution label ("Claude · via you") — then configures each CLI via its own
|
|
59
|
+
`mcp add`. Prefer just the Bridge? `login` does the device flow without touching your
|
|
60
|
+
CLIs. Fully manual: copy `config.example.json` → `config.json` and paste a token from
|
|
61
|
+
your Cookbook **Account → Tokens** page.
|
|
62
|
+
|
|
63
|
+
Requires **Node 18+** (built-in `fetch`, no npm install) and at least one agent CLI
|
|
64
|
+
installed and logged in (`claude`, `agy` — the Antigravity CLI for Gemini — or the Codex app). Each agent must also be
|
|
65
|
+
connected to Cookbook over MCP — that's how it completes tasks. Run `doctor`; it tells
|
|
66
|
+
you exactly which parts are ready and how to fix the rest.
|
|
67
|
+
|
|
68
|
+
## Commands
|
|
69
|
+
|
|
70
|
+
| Command | What it does |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `node bridge.mjs` | Run the Bridge (uses `config.json` next to it; or pass a path) |
|
|
73
|
+
| `node bridge.mjs connect-agents` | One approval connects the Bridge + every installed agent CLI (attributed tokens) |
|
|
74
|
+
| `node bridge.mjs login` | Device-flow auth for the Bridge only, writes your config |
|
|
75
|
+
| `node bridge.mjs doctor` | Preflight every prerequisite with exact fixes |
|
|
76
|
+
| `node bridge.mjs status` | Liveness + agent readiness |
|
|
77
|
+
| `node bridge.mjs update` | Update the Bridge to match the app (see Self-updating) |
|
|
78
|
+
|
|
79
|
+
## Self-updating
|
|
80
|
+
|
|
81
|
+
**The Bridge follows the app.** At startup and every 6 hours it compares its own files
|
|
82
|
+
to the deploy's manifest (`/api/bridge/manifest`) and — with `"autoUpdate": true`, the
|
|
83
|
+
default — replaces them (every file hash-verified first, originals kept in
|
|
84
|
+
a per-version `bridge.backup/<deploy>/` dir, your `config.json` and token never touched) and restarts itself.
|
|
85
|
+
Set `"autoUpdate": false` to pin your version; `node bridge.mjs update` updates manually
|
|
86
|
+
and works even from a broken install.
|
|
87
|
+
|
|
88
|
+
## Agents (config.json)
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
"agents": [
|
|
92
|
+
{ "name": "Claude", "match": ["claude"], "enabled": true,
|
|
93
|
+
"command": ["claude", "-p", "{prompt}", "--allowedTools", "mcp__cookbook__*", "--output-format", "json"] },
|
|
94
|
+
{ "name": "Gemini", "match": ["gemini"], "enabled": true,
|
|
95
|
+
"command": ["agy", "-p", "{prompt}", "--sandbox", "--print-timeout", "3600s"] },
|
|
96
|
+
{ "name": "Codex", "match": ["codex", "chatgpt"], "enabled": false, "runner": "app-server",
|
|
97
|
+
"command": ["/Applications/Codex.app/Contents/Resources/codex"] }
|
|
98
|
+
]
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- `match`: which task assignees this agent handles (substring match — a task assigned
|
|
102
|
+
to "Claude" wakes the agent whose match includes "claude").
|
|
103
|
+
- **Claude with `--output-format json`** lets the Bridge report what each run cost
|
|
104
|
+
(tokens / $-equivalent) back to the board — `text` works too, you just lose the detail.
|
|
105
|
+
- **`--allowedTools` prefix matters**: a CLI-added server (`claude mcp add … cookbook …`)
|
|
106
|
+
exposes `mcp__cookbook__*`; the claude.ai/desktop *connector* exposes
|
|
107
|
+
`mcp__claude_ai_Cookbook__*`. If tasks run but never complete, this mismatch is the
|
|
108
|
+
usual cause — `doctor` checks it.
|
|
109
|
+
- **Codex (ChatGPT)** runs through `codex app-server` (its headless `exec` can't call
|
|
110
|
+
MCP tools); see `_setup` in `config.example.json` for the 3-step enable.
|
|
111
|
+
- `"default"`: which agent takes tasks assigned to **any**.
|
|
112
|
+
|
|
113
|
+
## What rides into (and out of) every run
|
|
114
|
+
|
|
115
|
+
- **Team memory in**: the Bridge injects the workspace's relevant decisions/gotchas
|
|
116
|
+
into the prompt, so your agent starts with what the team already knows.
|
|
117
|
+
- **Knowledge out**: agents are instructed to `remember` durable learnings — work
|
|
118
|
+
produces shared memory as exhaust.
|
|
119
|
+
- **Cost out**: after a verified completion the Bridge reports tokens/duration, so the
|
|
120
|
+
board shows what each delegation cost, on whose quota.
|
|
121
|
+
|
|
122
|
+
## Volunteering (off by default)
|
|
123
|
+
|
|
124
|
+
An agent with `"volunteer": true` + a `"capabilities"` line watches tasks posted as
|
|
125
|
+
**open goals** (🎯 on the board) and may claim ones it judges itself capable of — decided
|
|
126
|
+
by one cheap call to the agent's own CLI, gated by your delegation policy ("ask" parks it
|
|
127
|
+
in your approvals inbox), claimed atomically, capped per poll. Nothing volunteers unless
|
|
128
|
+
you opt an agent in, and only tasks explicitly posted as goals are ever eligible.
|
|
129
|
+
`"volunteering": false` kills it globally.
|
|
130
|
+
|
|
131
|
+
## Safety rails (on by default)
|
|
132
|
+
|
|
133
|
+
- **Billing protection**: vendor API keys (`ANTHROPIC_API_KEY` etc.) are hidden from
|
|
134
|
+
agent processes, so a task can never silently bill your API account instead of your
|
|
135
|
+
subscription. Opt out with `"allowApiKeyBilling": true`.
|
|
136
|
+
- **Vulnerable-version gate**: gemini-cli below 0.39.1 (the CVSS-10.0 RCE fix) is refused; agy below 1.1.1 (headless MCP) is refused.
|
|
137
|
+
- **Who can use your agents**: `"acceptFrom": "anyone"` (default) or a list of member
|
|
138
|
+
names (e.g. `["dp", "pierre"]`); per-agent overrides supported. Plus the per-person
|
|
139
|
+
**allow / ask / off** delegation policy you manage in Cookbook (Account → Agents) —
|
|
140
|
+
"ask" parks a teammate's task in your approvals inbox before anything runs.
|
|
141
|
+
|
|
142
|
+
## How completion + attribution works
|
|
143
|
+
|
|
144
|
+
The agent completes the task through **its own** Cookbook connection, so work is
|
|
145
|
+
attributed to the agent (via you). The Bridge's token only reads the board, claims
|
|
146
|
+
volunteered goals, verifies completion, and reports usage. If an agent runs but doesn't
|
|
147
|
+
finish, the Bridge retries up to `maxAttempts`, then leaves the task open — with the
|
|
148
|
+
likely cause in the log (login missing, MCP not connected, tool blocked).
|
|
149
|
+
|
|
150
|
+
## Honest limits
|
|
151
|
+
|
|
152
|
+
- **Local only** — tasks run while your machine and the Bridge are up.
|
|
153
|
+
- **Subscription terms** — automating consumer CLIs in a loop can hit usage limits and
|
|
154
|
+
sits near vendor policy lines; fine at team scale, don't point it at a firehose.
|
|
155
|
+
- **Headless flake** — one-shot agents occasionally wobble; `maxAttempts` + leave-open
|
|
156
|
+
+ the failure-cause log exist for exactly that.
|