@fro.bot/space-bus 0.5.0 → 0.6.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 +38 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +961 -0
- package/dist/config.d.ts +34 -1
- package/dist/config.js +425 -17
- package/dist/contract.d.ts +1 -0
- package/dist/contract.js +8 -1
- package/dist/core.js +7 -2
- package/dist/discovery.d.ts +126 -0
- package/dist/index.js +803 -151
- package/dist/mcp.js +825 -166
- package/dist/server.d.ts +65 -0
- package/dist/server.js +816 -0
- package/dist/tools/shared.d.ts +2 -0
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -67,6 +67,44 @@ Set `SPACE_BUS_CONFIG` to override roster discovery — it must be an absolute p
|
|
|
67
67
|
- `bus_status` — Report a space-bus session's status plus a summary of its latest todo and diff. Also reports when the session is blocked on an interactive question awaiting a reply.
|
|
68
68
|
- `bus_result` — Return a completed space-bus session's final assistant message and diff. Errors if the session is still running — use `bus_status` to check first.
|
|
69
69
|
|
|
70
|
+
## Managed server
|
|
71
|
+
|
|
72
|
+
Two roster modes for `server`, mutually exclusive:
|
|
73
|
+
|
|
74
|
+
- `server.baseUrl` — externally-managed, attach-only. Today's default behavior: you start `opencode serve`/`harness serve` yourself; the plugin just connects.
|
|
75
|
+
- `server.managed` — plugin-managed lifecycle. The plugin spawns and supervises the server for you.
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"server": {
|
|
80
|
+
"managed": {
|
|
81
|
+
"command": ["harness", "serve"],
|
|
82
|
+
"cwd": "~/src/my-workspace",
|
|
83
|
+
"port": 0
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"projects": [{ "name": "my-project", "path": "~/src/my-project" }]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`command`, `cwd`, and `port` are all optional (defaults: `harness serve` — set `managed.command` for a custom command such as `opencode serve` — the roster's directory, and an ephemeral port, respectively).
|
|
91
|
+
|
|
92
|
+
First-caller-spawns: whichever consumer touches the managed roster first spawns the server on demand — a generated password and a 0600 discovery file land under the state dir (`$XDG_STATE_HOME|~/.local/state/space-bus/<hash>/discovery.json`), every subsequent caller attaches to the same instance. It's a persistent daemon, not a request-scoped process — it outlives the caller and there's no auto-restart if it dies; the next `ensure` call notices the stale discovery file and heals by spawning fresh.
|
|
93
|
+
|
|
94
|
+
CLI (`space-bus`, wraps the same lifecycle):
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
space-bus serve [--foreground] [--json] [--config <path>]
|
|
98
|
+
space-bus status [--json] [--config <path>]
|
|
99
|
+
space-bus stop [--json] [--config <path>]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
MCP is attach-only by default — it never spawns. Set `SPACE_BUS_MCP_SPAWN=1` in the MCP server's env to opt it into ensuring a managed roster's server on startup.
|
|
103
|
+
|
|
104
|
+
Security posture: each spawn gets a freshly generated password (never reused, never in argv, never logged); the loopback guard travels with the discovery handshake, so an attached endpoint is re-validated as localhost-only regardless of source. Same-user process compromise is out of scope — anyone who can read your state dir or ptrace the child already has what they need.
|
|
105
|
+
|
|
106
|
+
Programmatic consumers (e.g. Mothership) that want to drive the lifecycle directly without the CLI can import `@fro.bot/space-bus/server` (Node-only; `ensureServer`/`serverStatus`/`stopServer`).
|
|
107
|
+
|
|
70
108
|
## Library surface
|
|
71
109
|
|
|
72
110
|
Experimental subpath exports expose the bus's semantics directly — the same functions the four tools run on — for renderers and other consumers that want structured state instead of formatted strings. Subpaths are experimental: shapes may change in minor releases; pin the version if you adopt them.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|