borgmcp 2.7.3 → 2.8.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 +96 -230
- package/dist/drone-lifecycle.d.ts +8 -0
- package/dist/drone-lifecycle.d.ts.map +1 -1
- package/dist/drone-lifecycle.js +19 -0
- package/dist/drone-lifecycle.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/log-stream.d.ts +4 -0
- package/dist/log-stream.d.ts.map +1 -1
- package/dist/log-stream.js +28 -4
- package/dist/log-stream.js.map +1 -1
- package/dist/remote-client.d.ts +1 -1
- package/dist/remote-client.d.ts.map +1 -1
- package/dist/remote-client.js +42 -7
- package/dist/remote-client.js.map +1 -1
- package/dist/server-errors.d.ts +8 -0
- package/dist/server-errors.d.ts.map +1 -1
- package/dist/server-errors.js +19 -0
- package/dist/server-errors.js.map +1 -1
- package/dist/server-handshake.d.ts +1 -1
- package/dist/server-trust.d.ts.map +1 -1
- package/dist/server-trust.js +10 -0
- package/dist/server-trust.js.map +1 -1
- package/dist/tool-manifest.d.ts.map +1 -1
- package/dist/tool-manifest.js +3 -2
- package/dist/tool-manifest.js.map +1 -1
- package/dist/update-cmd.d.ts.map +1 -1
- package/dist/update-cmd.js +122 -16
- package/dist/update-cmd.js.map +1 -1
- package/docs/EXTRACTION_PROVENANCE.md +7 -7
- package/docs/LOCAL_SERVER.md +3 -3
- package/docs/RELEASING.md +11 -6
- package/package.json +2 -2
- package/src/drone-lifecycle.ts +25 -0
- package/src/index.ts +15 -1
- package/src/log-stream.ts +26 -5
- package/src/remote-client.ts +56 -5
- package/src/server-errors.ts +24 -0
- package/src/server-handshake.ts +1 -1
- package/src/server-trust.ts +11 -0
- package/src/tool-manifest.ts +3 -2
- package/src/update-cmd.ts +145 -16
package/README.md
CHANGED
|
@@ -2,66 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
Multi-agent coordination for AI coding agents.
|
|
4
4
|
|
|
5
|
-
Borg MCP lets Claude Code, Codex, and OpenCode sessions
|
|
5
|
+
Borg MCP lets Claude Code, Codex, and OpenCode sessions coordinate in the same
|
|
6
|
+
project. A shared coordination space is a **cube**, and each connected agent
|
|
7
|
+
session is a **drone**. Roles are yours to define, with names such as builder,
|
|
8
|
+
reviewer, coordinator, or designer.
|
|
6
9
|
|
|
7
10
|
## What you get
|
|
8
11
|
|
|
9
|
-
- Shared
|
|
10
|
-
-
|
|
11
|
-
- Live
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- Self-hosted authority: attach to a trusted `borgmcp-server` endpoint you run
|
|
15
|
-
on localhost or your LAN. No account or subscription — local-only.
|
|
12
|
+
- Shared project context, role instructions, a roster, and an activity log.
|
|
13
|
+
- Direct and broadcast messages between agent sessions.
|
|
14
|
+
- Live wake-up support so agents can react to new activity.
|
|
15
|
+
- Launchers for Claude Code, Codex, and OpenCode, including sibling worktrees.
|
|
16
|
+
- A self-hosted server for localhost or LAN use, with no account or subscription.
|
|
16
17
|
|
|
17
18
|
## Install
|
|
18
19
|
|
|
19
|
-
Install the
|
|
20
|
+
Install the client from npm:
|
|
20
21
|
|
|
21
22
|
```bash
|
|
22
|
-
npm install -g borgmcp
|
|
23
|
+
npm install -g borgmcp
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
You also need at least one supported agent CLI: Claude Code, Codex, or OpenCode.
|
|
27
|
+
|
|
28
|
+
Verify the installation:
|
|
26
29
|
|
|
27
30
|
```bash
|
|
28
31
|
borg --version
|
|
29
32
|
borg --help
|
|
30
33
|
```
|
|
31
34
|
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
Use the whole-product update command for an existing npm-global installation:
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
borg update
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Before changing either package, Borg reads the exact published `borgmcp` and
|
|
41
|
-
`borgmcp-server` manifests and requires the same exact `borgmcp-shared` pin. It
|
|
42
|
-
then verifies that the running client and any installed server controller belong
|
|
43
|
-
to one stable npm executable, global prefix, and global root. Registry lookup and
|
|
44
|
-
installation are bound to `https://registry.npmjs.org/`. An alternate configured
|
|
45
|
-
registry, changed npm context, or unsupported or ambiguous package-manager
|
|
46
|
-
provenance fails without changing either package; use that package manager's
|
|
47
|
-
manual update flow instead.
|
|
48
|
-
|
|
49
|
-
After confirmation, Borg installs the client first and continues under the
|
|
50
|
-
verified new client. If a local server was already installed, it installs the
|
|
51
|
-
matching server controller, delegates runtime verification and activation to
|
|
52
|
-
the server updater, and verifies the final installed, prepared, running, and
|
|
53
|
-
protocol identities. A server that was stopped remains stopped and is reported
|
|
54
|
-
as `prepared; still stopped`. If no local server was installed, that phase is
|
|
55
|
-
explicitly skipped. Use `borg update --yes` for a non-interactive invocation.
|
|
56
|
-
|
|
57
|
-
Partial completion is reported with `borg update --yes` as the idempotent retry.
|
|
58
|
-
During interactive setup or a first `borg assimilate` with no selected server,
|
|
59
|
-
Borg offers to install the exact compatible `borgmcp-server` release. It never
|
|
60
|
-
installs an absent server from a non-interactive invocation. Borg does not start
|
|
61
|
-
a stopped server or restart agent processes. Restart active agent sessions
|
|
62
|
-
yourself after the client changes.
|
|
63
|
-
|
|
64
|
-
## First-time setup
|
|
35
|
+
## Quick Start
|
|
65
36
|
|
|
66
37
|
Run the setup wizard:
|
|
67
38
|
|
|
@@ -69,251 +40,146 @@ Run the setup wizard:
|
|
|
69
40
|
borg setup
|
|
70
41
|
```
|
|
71
42
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
on your machine. The client and server remain separate local-only packages. No
|
|
75
|
-
account, sign-in, or subscription is required.
|
|
43
|
+
If the local server is not installed, the wizard offers to install a compatible
|
|
44
|
+
version. It also configures the supported agent CLIs found on your machine.
|
|
76
45
|
|
|
77
|
-
|
|
78
|
-
you ask your agent to run inside Claude Code, Codex, or OpenCode.
|
|
79
|
-
|
|
80
|
-
If multiple CLIs are installed, use `--cli` when launching or assimilating if you want to choose explicitly:
|
|
46
|
+
Prepare and start the server in one terminal:
|
|
81
47
|
|
|
82
48
|
```bash
|
|
83
|
-
borg
|
|
84
|
-
borg
|
|
85
|
-
borg assimilate --cli opencode
|
|
49
|
+
borg server setup
|
|
50
|
+
borg server start
|
|
86
51
|
```
|
|
87
52
|
|
|
88
|
-
|
|
53
|
+
`borg server start` stays in the foreground. Leave that terminal open while you
|
|
54
|
+
use Borg; press Ctrl-C when you want to stop the server.
|
|
89
55
|
|
|
90
|
-
|
|
56
|
+
In a second terminal, open your project's Git repository and join its cube:
|
|
91
57
|
|
|
92
58
|
```bash
|
|
59
|
+
cd ~/code/my-app
|
|
93
60
|
borg assimilate
|
|
94
61
|
```
|
|
95
62
|
|
|
96
|
-
|
|
97
|
-
|
|
63
|
+
Borg creates or reuses a repository-specific cube, registers the new drone, and
|
|
64
|
+
launches your agent CLI with the cube's context.
|
|
98
65
|
|
|
99
|
-
To
|
|
66
|
+
To run another agent at the same time, open a third terminal and change to the
|
|
67
|
+
same Git repository:
|
|
100
68
|
|
|
101
69
|
```bash
|
|
102
|
-
|
|
70
|
+
cd ~/code/my-app
|
|
71
|
+
borg assimilate builder
|
|
103
72
|
```
|
|
104
73
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
`borg assimilate --yes` and other non-interactive runs require an explicit
|
|
108
|
-
`--host <server>`. Without a selected local server, assimilation fails closed
|
|
109
|
-
with an actionable `No local server selected` error. The host names a
|
|
110
|
-
self-hosted `borgmcp-server` on localhost or your LAN.
|
|
111
|
-
|
|
112
|
-
To connect directly to a local server non-interactively:
|
|
74
|
+
Two sessions of the same agent CLI work. To choose a CLI explicitly, use one of:
|
|
113
75
|
|
|
114
76
|
```bash
|
|
115
|
-
borg assimilate --
|
|
77
|
+
borg assimilate --cli claude
|
|
78
|
+
borg assimilate --cli codex
|
|
79
|
+
borg assimilate --cli opencode
|
|
116
80
|
```
|
|
117
81
|
|
|
118
|
-
|
|
119
|
-
|
|
82
|
+
`borg ...` commands run in your terminal. `borg_...` commands are MCP tools that
|
|
83
|
+
you or the agent use inside an agent session.
|
|
120
84
|
|
|
121
|
-
|
|
122
|
-
npm install -g borgmcp-server
|
|
123
|
-
borg server setup
|
|
124
|
-
borg server start
|
|
125
|
-
```
|
|
85
|
+
## Cubes And Roles
|
|
126
86
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
87
|
+
On first use in a repository, Borg shows the proposed cube name and template
|
|
88
|
+
before creating anything. If it finds one accessible cube with the same name,
|
|
89
|
+
it asks before linking that cube to the repository. It never links an existing
|
|
90
|
+
cube by name during a non-interactive run.
|
|
131
91
|
|
|
132
|
-
|
|
133
|
-
update` remains the server-runtime-only escape hatch and may report a separate
|
|
134
|
-
controller install action rather than changing the global controller itself.
|
|
135
|
-
|
|
136
|
-
Open a second operator terminal in the project checkout and run:
|
|
92
|
+
To create a repository cube without launching an agent:
|
|
137
93
|
|
|
138
94
|
```bash
|
|
139
|
-
borg
|
|
95
|
+
borg server cube init
|
|
140
96
|
```
|
|
141
97
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
role seat, and launches the selected agent. For another client or device, run
|
|
146
|
-
`borg server invite`, then use `borg assimilate --host <server> --enroll` on the
|
|
147
|
-
intended recipient and enter the invitation at its hidden prompt.
|
|
148
|
-
In the launched agent, run `borg_whoami` and `borg_roster` to verify the seat and
|
|
149
|
-
begin coordinating.
|
|
150
|
-
|
|
151
|
-
An ordinary enrolled client cannot create a cube. The server operator must grant
|
|
152
|
-
it access before it reruns `borg assimilate --host 127.0.0.1:7091`. Enrollment
|
|
153
|
-
credentials and retry state remain in the local seat store on this machine (a
|
|
154
|
-
0600-permission file store). See the
|
|
155
|
-
complete setup, recovery, second-seat, and security flow in
|
|
156
|
-
[`docs/LOCAL_SERVER.md`](docs/LOCAL_SERVER.md).
|
|
157
|
-
The exact saved-seat states, re-attach behavior, recovery copy, and multi-seat
|
|
158
|
-
selection rules are in
|
|
159
|
-
[`docs/SEAT_LIFECYCLE.md`](docs/SEAT_LIFECYCLE.md).
|
|
160
|
-
|
|
161
|
-
To start another drone in a sibling worktree:
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
borg assimilate builder --worktree drone-2
|
|
165
|
-
```
|
|
98
|
+
To supply creation defaults non-interactively, pass `--host`, `--cube-name`, and
|
|
99
|
+
`--yes`. The `--yes` flag accepts defaults for a new cube; it does not approve
|
|
100
|
+
linking an existing cube.
|
|
166
101
|
|
|
167
|
-
To
|
|
102
|
+
To launch a drone in a named sibling worktree:
|
|
168
103
|
|
|
169
104
|
```bash
|
|
170
|
-
borg assimilate
|
|
105
|
+
borg assimilate builder --worktree drone-2
|
|
171
106
|
```
|
|
172
107
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
any Borg operation invoked through that dispatcher. Direct shell, file, and web
|
|
178
|
-
actions remain outside Borg's allowlist.
|
|
179
|
-
|
|
180
|
-
- Claude Code launches receive `--allowedTools mcp__borg__*`.
|
|
181
|
-
- Codex launches query Codex's native effective-config resolver at the launch
|
|
182
|
-
directory, including system/managed, user, selected profile, project, and
|
|
183
|
-
command-line layers. If coordination tools are restrictive, an interactive
|
|
184
|
-
launch asks before applying exact, launch-only `approval_mode="auto"`
|
|
185
|
-
overrides. The consent prompt explicitly discloses the dispatcher's
|
|
186
|
-
transitive scope. Declining or launching non-interactively changes nothing
|
|
187
|
-
and prints the exact TOML needed for a global repair.
|
|
188
|
-
- OpenCode launches do not use its broad `--auto` switch. Borg queries
|
|
189
|
-
`opencode debug config` for its resolved JSONC/managed/global/custom/project/
|
|
190
|
-
inline configuration and, with interactive consent, supplies
|
|
191
|
-
exact launch-only `allow` rules through `OPENCODE_PERMISSION`. Other OpenCode
|
|
192
|
-
permission rules remain in force.
|
|
193
|
-
|
|
194
|
-
`borg setup` performs the same inspection and prints exact global repair
|
|
195
|
-
snippets. Borg never silently rewrites approval policy.
|
|
196
|
-
|
|
197
|
-
## Core MCP tools
|
|
198
|
-
|
|
199
|
-
After assimilation, the agent session has `borg_` tools available:
|
|
200
|
-
|
|
201
|
-
- `borg_regen` - Refresh cube context, role instructions, roster, and recent log.
|
|
202
|
-
- `borg_log` - Append to the shared activity log. Can broadcast or direct messages to drones/roles.
|
|
203
|
-
- `borg_read-log` - Read recent log entries, optionally since an entry id or timestamp.
|
|
204
|
-
- `borg_ack` - Acknowledge a routed log entry without adding noise to the activity log.
|
|
205
|
-
- `borg_roster` - List drones and liveness markers in the cube.
|
|
206
|
-
- `borg_stream-status` - Diagnose the SSE/inbox wake path.
|
|
207
|
-
- `borg_cube`, `borg_role`, `borg_whoami` - Inspect current cube, role, and identity.
|
|
208
|
-
- `borg_create-cube`, `borg_update-cube`, `borg_delete-cube` - Manage cubes.
|
|
209
|
-
- `borg_create-role`, `borg_update-role`, `borg_reassign-drone` - Manage roles and drone assignments.
|
|
210
|
-
- `borg_apply-template`, `borg_sync-roles`, `borg_patch-taxonomy-class` - Bootstrap and maintain role/message-taxonomy templates.
|
|
211
|
-
|
|
212
|
-
## Typical two-agent flow
|
|
108
|
+
See [`docs/LOCAL_SERVER.md`](docs/LOCAL_SERVER.md) for remote enrollment,
|
|
109
|
+
invitations, server recovery, and security details. See
|
|
110
|
+
[`docs/SEAT_LIFECYCLE.md`](docs/SEAT_LIFECYCLE.md) for saved-seat and re-attach
|
|
111
|
+
behavior.
|
|
213
112
|
|
|
214
|
-
|
|
113
|
+
## Agent Permissions
|
|
215
114
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
```
|
|
115
|
+
Borg can remove repeated approval prompts for its own coordination tools. It
|
|
116
|
+
does not approve shell commands, file operations, or web access.
|
|
219
117
|
|
|
220
|
-
|
|
118
|
+
Claude Code receives Borg's MCP tool allowlist at launch. For Codex and OpenCode,
|
|
119
|
+
Borg checks the effective configuration and asks before applying launch-only
|
|
120
|
+
permission changes. Declining leaves the agent's configuration unchanged.
|
|
121
|
+
`borg setup` can show the corresponding persistent configuration snippets.
|
|
221
122
|
|
|
222
|
-
|
|
223
|
-
cd ~/code/my-app
|
|
224
|
-
borg assimilate --cli claude
|
|
225
|
-
```
|
|
123
|
+
## Core MCP Tools
|
|
226
124
|
|
|
227
|
-
|
|
125
|
+
After assimilation, the agent session can use these tools:
|
|
228
126
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
127
|
+
- `borg_regen` refreshes cube context, role instructions, and roster state.
|
|
128
|
+
- `borg_log` posts to the shared activity log; `borg_read-log` reads it.
|
|
129
|
+
- `borg_ack` acknowledges a routed entry without posting another log message.
|
|
130
|
+
- `borg_roster` lists drones and liveness markers.
|
|
131
|
+
- `borg_stream-status` diagnoses the wake-up path.
|
|
132
|
+
- `borg_cube`, `borg_role`, and `borg_whoami` inspect the current identity.
|
|
133
|
+
- `borg_create-cube` creates a cube; `borg_update-cube` updates its directive or
|
|
134
|
+
message taxonomy.
|
|
135
|
+
- `borg_delete-cube` deletes a cube after explicit confirmation of its exact
|
|
136
|
+
cube ID.
|
|
137
|
+
- `borg_create-role`, `borg_update-role`, and `borg_reassign-drone` manage roles
|
|
138
|
+
and assignments.
|
|
139
|
+
- `borg_apply-template`, `borg_sync-roles`, and `borg_patch-taxonomy-class`
|
|
140
|
+
maintain role and message-taxonomy templates.
|
|
233
141
|
|
|
234
|
-
|
|
235
|
-
`--cli claude` only when you want to choose explicitly.
|
|
142
|
+
The available tools are also discoverable from the agent's MCP tool list.
|
|
236
143
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
```text
|
|
240
|
-
borg_whoami
|
|
241
|
-
borg_roster
|
|
242
|
-
borg_log "STARTING: review feat/login"
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
## Troubleshooting
|
|
246
|
-
|
|
247
|
-
### Authentication expired
|
|
144
|
+
## Update
|
|
248
145
|
|
|
249
|
-
|
|
146
|
+
For npm-global installations, update the client and an installed local server
|
|
147
|
+
together:
|
|
250
148
|
|
|
251
149
|
```bash
|
|
252
|
-
borg
|
|
150
|
+
borg update
|
|
253
151
|
```
|
|
254
152
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
153
|
+
Borg checks that compatible client and server versions are available, asks for
|
|
154
|
+
confirmation, and reports any manual recovery step. Use `borg update --yes` for
|
|
155
|
+
a non-interactive update. A server that was stopped remains stopped, and active
|
|
156
|
+
agent sessions must be restarted after the client changes.
|
|
258
157
|
|
|
259
|
-
|
|
260
|
-
borg --cli claude
|
|
261
|
-
borg --cli codex
|
|
262
|
-
borg assimilate --cli claude
|
|
263
|
-
borg assimilate --cli codex
|
|
264
|
-
```
|
|
158
|
+
## Troubleshooting
|
|
265
159
|
|
|
266
160
|
### Not connected to a cube
|
|
267
161
|
|
|
268
|
-
Run assimilation from
|
|
162
|
+
Run assimilation from the project repository:
|
|
269
163
|
|
|
270
164
|
```bash
|
|
271
165
|
borg assimilate
|
|
272
166
|
```
|
|
273
167
|
|
|
274
|
-
Then
|
|
275
|
-
|
|
276
|
-
### Wake path warning
|
|
277
|
-
|
|
278
|
-
If `borg_regen` or `borg_stream-status` reports a broken wake path, follow the
|
|
279
|
-
CLI-specific recovery it prints:
|
|
280
|
-
|
|
281
|
-
- Claude Code: arm the inbox monitor command. The monitor wakes the agent
|
|
282
|
-
session when another drone posts to the cube. The printed command includes
|
|
283
|
-
its required worktree-local `--state-root`; keep that value intact so the
|
|
284
|
-
config inbox can remain read-only and monitor runtime files do not dirty Git.
|
|
285
|
-
If it reports a stale legacy `.monitor.pid` or `.monitor.heartbeat`, confirm
|
|
286
|
-
the old Monitor has stopped, remove those legacy files, and arm the printed
|
|
287
|
-
command again; the new Monitor deliberately never deletes them automatically.
|
|
288
|
-
- Codex: check the remote-control socket status, relaunch with `borg --cli codex`
|
|
289
|
-
or `borg assimilate --cli codex` if needed, and run `borg_regen` manually when
|
|
290
|
-
returning to the session if no wake arrived.
|
|
168
|
+
Then use `borg_whoami` and `borg_roster` inside the agent session.
|
|
291
169
|
|
|
292
|
-
|
|
170
|
+
### Wake-up warning
|
|
293
171
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
npm ci --ignore-scripts
|
|
298
|
-
npm run check
|
|
299
|
-
npm test
|
|
300
|
-
npm run build
|
|
301
|
-
npm run onboarding:smoke
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
To install and exercise the reviewed checkout globally:
|
|
305
|
-
|
|
306
|
-
```bash
|
|
307
|
-
npm install -g .
|
|
308
|
-
```
|
|
172
|
+
If `borg_regen` or `borg_stream-status` reports a wake-up problem, follow the
|
|
173
|
+
recovery command it prints. For Codex or OpenCode, relaunch through `borg` if the
|
|
174
|
+
agent's local control connection is no longer available.
|
|
309
175
|
|
|
310
176
|
## License
|
|
311
177
|
|
|
312
|
-
Licensed under Apache-2.0. See [LICENSE](
|
|
178
|
+
Licensed under Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
313
179
|
|
|
314
180
|
## Links
|
|
315
181
|
|
|
316
|
-
- Client repository
|
|
317
|
-
- Shared contracts
|
|
318
|
-
- Self-hosted server
|
|
319
|
-
-
|
|
182
|
+
- [Client repository](https://github.com/Byte-Ventures/borg-mcp-client)
|
|
183
|
+
- [Shared contracts](https://github.com/Byte-Ventures/borg-mcp-shared)
|
|
184
|
+
- [Self-hosted server](https://github.com/Byte-Ventures/borg-mcp-server)
|
|
185
|
+
- [Issue tracker](https://github.com/Byte-Ventures/borg-mcp-client/issues)
|
|
@@ -11,20 +11,28 @@
|
|
|
11
11
|
* a WAKE HINT — the agent confirms via an authed call returning this code.
|
|
12
12
|
*/
|
|
13
13
|
export declare const DRONE_EVICTED_CODE = "DRONE_EVICTED";
|
|
14
|
+
export declare const CUBE_DELETED_CODE = "CUBE_DELETED";
|
|
14
15
|
export declare class DroneEvictedError extends Error {
|
|
15
16
|
constructor(message?: string);
|
|
16
17
|
}
|
|
18
|
+
export declare class CubeDeletedError extends Error {
|
|
19
|
+
readonly cubeName?: string | undefined;
|
|
20
|
+
constructor(cubeName?: string | undefined);
|
|
21
|
+
}
|
|
17
22
|
/**
|
|
18
23
|
* Marker the agent's /loop + role playbook branch on. Single-sourced so the
|
|
19
24
|
* SSE wake sentinel (log-stream) and the tool-result funnel (index) agree.
|
|
20
25
|
*/
|
|
21
26
|
export declare const EVICTED_RESULT_MARKER = "[CUBE-EVICTED]";
|
|
27
|
+
export declare const CUBE_DELETED_RESULT_MARKER = "[CUBE-DELETED]";
|
|
22
28
|
/**
|
|
23
29
|
* The recognizable tool RESULT the agent sees when an authed call returns the
|
|
24
30
|
* AUTHORITATIVE 410 DRONE_EVICTED. Spells out the sanctioned graceful-shutdown
|
|
25
31
|
* sequence so the agent acts on it deterministically.
|
|
26
32
|
*/
|
|
27
33
|
export declare function formatEvictedToolResult(cubeName?: string): string;
|
|
34
|
+
export declare function formatCubeDeletedToolResult(cubeName?: string): string;
|
|
35
|
+
export declare function formatCubeDeletedErrorToolResult(error: CubeDeletedError, activeCubeName?: string): string;
|
|
28
36
|
/**
|
|
29
37
|
* Extract the structured error code from a worker error body. The worker error
|
|
30
38
|
* funnel (sanitizeError → createHttpError) emits `{ code, message }`; some
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drone-lifecycle.d.ts","sourceRoot":"","sources":["../src/drone-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"drone-lifecycle.d.ts","sourceRoot":"","sources":["../src/drone-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAClD,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,qBAAa,iBAAkB,SAAQ,KAAK;gBAExC,OAAO,SAAyC;CAKnD;AAED,qBAAa,gBAAiB,SAAQ,KAAK;aACb,QAAQ,CAAC,EAAE,MAAM;gBAAjB,QAAQ,CAAC,EAAE,MAAM,YAAA;CAI9C;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AACtD,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAQjE;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAOrE;AAED,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,gBAAgB,EACvB,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS7D"}
|
package/dist/drone-lifecycle.js
CHANGED
|
@@ -11,17 +11,27 @@
|
|
|
11
11
|
* a WAKE HINT — the agent confirms via an authed call returning this code.
|
|
12
12
|
*/
|
|
13
13
|
export const DRONE_EVICTED_CODE = 'DRONE_EVICTED';
|
|
14
|
+
export const CUBE_DELETED_CODE = 'CUBE_DELETED';
|
|
14
15
|
export class DroneEvictedError extends Error {
|
|
15
16
|
constructor(message = 'This seat was removed from the cube.') {
|
|
16
17
|
super(message);
|
|
17
18
|
this.name = 'DroneEvictedError';
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
export class CubeDeletedError extends Error {
|
|
22
|
+
cubeName;
|
|
23
|
+
constructor(cubeName) {
|
|
24
|
+
super('This cube was deleted.');
|
|
25
|
+
this.cubeName = cubeName;
|
|
26
|
+
this.name = 'CubeDeletedError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
20
29
|
/**
|
|
21
30
|
* Marker the agent's /loop + role playbook branch on. Single-sourced so the
|
|
22
31
|
* SSE wake sentinel (log-stream) and the tool-result funnel (index) agree.
|
|
23
32
|
*/
|
|
24
33
|
export const EVICTED_RESULT_MARKER = '[CUBE-EVICTED]';
|
|
34
|
+
export const CUBE_DELETED_RESULT_MARKER = '[CUBE-DELETED]';
|
|
25
35
|
/**
|
|
26
36
|
* The recognizable tool RESULT the agent sees when an authed call returns the
|
|
27
37
|
* AUTHORITATIVE 410 DRONE_EVICTED. Spells out the sanctioned graceful-shutdown
|
|
@@ -34,6 +44,15 @@ export function formatEvictedToolResult(cubeName) {
|
|
|
34
44
|
'Your worktree and project files are unchanged. Finish any local file safety checks, then end this agent session.\n\n' +
|
|
35
45
|
'To rejoin later, start a new session and use a new invitation from the server operator. Do not re-assimilate from this evicted session.');
|
|
36
46
|
}
|
|
47
|
+
export function formatCubeDeletedToolResult(cubeName) {
|
|
48
|
+
const cube = cubeName ?? 'the selected cube';
|
|
49
|
+
return (`${CUBE_DELETED_RESULT_MARKER} Cube ${cube} was deleted.\n\n` +
|
|
50
|
+
'Borg has stopped listening for activity for this cube. Do not retry this request or restart the loop.\n\n' +
|
|
51
|
+
'Your worktree and project files are unchanged. Finish any local file safety checks, then end this agent session.');
|
|
52
|
+
}
|
|
53
|
+
export function formatCubeDeletedErrorToolResult(error, activeCubeName) {
|
|
54
|
+
return formatCubeDeletedToolResult(error.cubeName ?? activeCubeName);
|
|
55
|
+
}
|
|
37
56
|
/**
|
|
38
57
|
* Extract the structured error code from a worker error body. The worker error
|
|
39
58
|
* funnel (sanitizeError → createHttpError) emits `{ code, message }`; some
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drone-lifecycle.js","sourceRoot":"","sources":["../src/drone-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"drone-lifecycle.js","sourceRoot":"","sources":["../src/drone-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAClD,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEhD,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YACE,OAAO,GAAG,sCAAsC;QAEhD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACb;IAA5B,YAA4B,QAAiB;QAC3C,KAAK,CAAC,wBAAwB,CAAC,CAAC;QADN,aAAQ,GAAR,QAAQ,CAAS;QAE3C,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AACtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAiB;IACvD,MAAM,IAAI,GAAG,QAAQ,IAAI,mBAAmB,CAAC;IAC7C,OAAO,CACL,GAAG,qBAAqB,oCAAoC,IAAI,OAAO;QACvE,2GAA2G;QAC3G,sHAAsH;QACtH,yIAAyI,CAC1I,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,QAAiB;IAC3D,MAAM,IAAI,GAAG,QAAQ,IAAI,mBAAmB,CAAC;IAC7C,OAAO,CACL,GAAG,0BAA0B,SAAS,IAAI,mBAAmB;QAC7D,2GAA2G;QAC3G,kHAAkH,CACnH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,KAAuB,EACvB,cAAuB;IAEvB,OAAO,2BAA2B,CAAC,KAAK,CAAC,QAAQ,IAAI,cAAc,CAAC,CAAC;AACvE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAQ,CAAC;QACvC,IAAI,OAAO,MAAM,EAAE,IAAI,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC,IAAI,CAAC;QACzD,IAAI,OAAO,MAAM,EAAE,KAAK,EAAE,IAAI,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,WAAW;IACb,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AAcH,OAAO,EAcL,UAAU,EAQV,oBAAoB,EAIpB,aAAa,EAGb,KAAK,oBAAoB,EAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAML,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAkHlC,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,oBAAoB,EAC/B,IAAI,GAAE;IACJ,aAAa,CAAC,EAAE,OAAO,aAAa,CAAC;IACrC,oBAAoB,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACnD,UAAU,CAAC,EAAE,OAAO,UAAU,CAAC;CAC3B,GACL,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC,CAiBvF;AAeD;;GAEG;AACH,wBAAsB,IAAI,kBAmmCzB"}
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
|
13
13
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
14
14
|
import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
15
15
|
import { assertRoleMatches } from './role-match.js';
|
|
16
|
+
import { CubeDeletionConfirmationError } from './server-errors.js';
|
|
16
17
|
import { getCubeInfo, getRoleInfo, getRoleInfoByName, getRoster, readLog, appendLog, ackLogEntry, recordDecision, removeDecision, listDecisions, regen, listCubes, createCube, updateCube, deleteCube, createRole, updateRole, patchRoleSection, patchTaxonomyClass, deleteRole, getCube, getCubeForManagement, resolveLocalManageAuthority, listRoles, syncRoles, applyTemplate, whoami, roleRationale, } from './remote-client.js';
|
|
17
18
|
import { getTemplate, listTemplateNames, resolveCubeDirectiveForCreate, resolveCubeDirectiveForApply, resolveMessageTaxonomyForCreate, } from 'borgmcp-shared/templates';
|
|
18
19
|
import { activeCubeWithFreshRegenIdentity, getActiveCube, getActiveCubeForWorktree, refreshActiveCubeMetadata, findProjectRoot, inboxPathForDrone, pinMcpSeatIdentity, } from './cubes.js';
|
|
@@ -31,7 +32,7 @@ import { renderStreamStatus, formatWakePathPrefix, shouldShowWakePathWarning, }
|
|
|
31
32
|
import { inspectWakePath } from './wake-path-health.js';
|
|
32
33
|
import { RUNTIME_METADATA_ADVISORY, renderRoster, renderRuntimeMetadataLines, } from './roster-render.js';
|
|
33
34
|
import { resolveWorkingRepo } from './working-repo.js';
|
|
34
|
-
import { DroneEvictedError, formatEvictedToolResult, } from './drone-lifecycle.js';
|
|
35
|
+
import { CubeDeletedError, DroneEvictedError, formatCubeDeletedErrorToolResult, formatEvictedToolResult, } from './drone-lifecycle.js';
|
|
35
36
|
import { classifyInSessionAssimilate, reattachOnlyRefusal, reattachFailureMessage, } from './assimilate-guard.js';
|
|
36
37
|
import { gateAllowsActivation, borgSessionToolNotice } from './launch-gate.js';
|
|
37
38
|
import { renderSyncRolesResult } from './sync-roles-render.js';
|
|
@@ -856,7 +857,11 @@ export async function main() {
|
|
|
856
857
|
const cubeId = args?.cube_id;
|
|
857
858
|
if (!cubeId)
|
|
858
859
|
throw new Error('cube_id is required');
|
|
859
|
-
|
|
860
|
+
const confirmCubeId = args?.confirm_cube_id;
|
|
861
|
+
if (confirmCubeId !== cubeId) {
|
|
862
|
+
throw new CubeDeletionConfirmationError(cubeId, confirmCubeId);
|
|
863
|
+
}
|
|
864
|
+
await deleteCube(cubeId, confirmCubeId);
|
|
860
865
|
return { content: [{ type: 'text', text: `Deleted cube ${cubeId} (and all its roles, drones, log entries).` }] };
|
|
861
866
|
}
|
|
862
867
|
case 'borg_create-role': {
|
|
@@ -1080,6 +1085,13 @@ export async function main() {
|
|
|
1080
1085
|
isError: true,
|
|
1081
1086
|
};
|
|
1082
1087
|
}
|
|
1088
|
+
if (error instanceof CubeDeletedError) {
|
|
1089
|
+
const active = await getActiveCube();
|
|
1090
|
+
return {
|
|
1091
|
+
content: [{ type: 'text', text: formatCubeDeletedErrorToolResult(error, active?.name) }],
|
|
1092
|
+
isError: true,
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1083
1095
|
const localManageResult = formatLocalManageToolResult(error);
|
|
1084
1096
|
if (localManageResult)
|
|
1085
1097
|
return localManageResult;
|