backeer-opencode 0.3.2 → 0.5.1
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/CHANGELOG.md +42 -0
- package/README.md +91 -17
- package/bin/backeer-opencode-mcp.js +9 -0
- package/dist/backeer-permission.js +3251 -88
- package/docs/live-control.md +80 -0
- package/package.json +12 -5
- package/src/config.js +4 -0
- package/src/index.js +6 -1
- package/src/live-bridge-client.js +52 -0
- package/src/live-bridge-config.js +48 -0
- package/src/live-bridge-events.js +80 -0
- package/src/live-bridge.js +273 -0
- package/src/live-connection.js +50 -0
- package/src/live-control-client.js +361 -0
- package/src/live-control-mcp.js +79 -0
- package/src/opencode-v2-client.js +147 -0
- package/src/opencode-v2-forms.js +24 -0
- package/src/opencode-v2.js +105 -0
- package/src/plugin.js +57 -49
- package/src/updates.js +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `backeer-opencode` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.5.1 - 2026-11-03
|
|
6
|
+
|
|
7
|
+
- Keep live tracking active during hours of agent silence; retain 15-second
|
|
8
|
+
heartbeats and detect dead transport only after 45 seconds without traffic.
|
|
9
|
+
- Retry live SSE and native V2 subscriptions every three seconds indefinitely,
|
|
10
|
+
including initial unavailability and authentication failures. Preserve explicit
|
|
11
|
+
history-gap reporting while reconnecting the transport automatically.
|
|
12
|
+
- Send disconnect/reconnect application notifications through the existing
|
|
13
|
+
Backeer mobile gateway once per aggregate connection transition. Keep pending
|
|
14
|
+
delivery bounded and avoid notifications on deliberate plugin disposal.
|
|
15
|
+
- Document a reconnecting SSH tunnel and the distinction between tool waits,
|
|
16
|
+
transport timeouts and long-running agent jobs.
|
|
17
|
+
|
|
18
|
+
## 0.5.0 - 2026-11-03
|
|
19
|
+
|
|
20
|
+
- Add optional authenticated loopback live control inside the existing OpenCode
|
|
21
|
+
process: bounded SSE replay, reconnect/gap signaling, exact-session normal
|
|
22
|
+
prompts and 24-hour instruction idempotency.
|
|
23
|
+
- Add a local stdio MCP adapter for session status, incremental reads, bounded
|
|
24
|
+
SSE waits and explicit instructions over an existing SSH tunnel.
|
|
25
|
+
- Preserve mobile approvals/questions, reject cross-project access, and keep
|
|
26
|
+
live credentials separate and owner-readable. No remote deployment or public
|
|
27
|
+
listener is enabled automatically.
|
|
28
|
+
- Document supported V1/V2 output events and observed-session discovery limits.
|
|
29
|
+
|
|
30
|
+
## 0.4.0 - 2026-10-11
|
|
31
|
+
|
|
32
|
+
- Add a V2 default definition with a stable ID, setup, event subscription,
|
|
33
|
+
command transform, prompt hook, and abortable cleanup; retain the V1 server
|
|
34
|
+
entrypoint for OpenCode 1.18.29 and newer.
|
|
35
|
+
- Adapt native V2 permission replies, question forms, and execution lifecycle
|
|
36
|
+
events, with location isolation and reconnect handling.
|
|
37
|
+
- Use the V2 plugin installation command for explicitly requested updates.
|
|
38
|
+
- Keep automatic delivery feedback in server logs on V2 rather than injecting
|
|
39
|
+
it into model context. Native V2 no longer provides ignored conversation
|
|
40
|
+
entries or todo.updated events; todo notifications remain available on V1.
|
|
41
|
+
- Rebuild the dependency-free installer bundle and add V2 regression tests.
|
|
42
|
+
- Verification: `npm run check` passes all 49 tests; `npm audit --omit=dev`
|
|
43
|
+
reports no vulnerabilities. The packed installer loads as active on an isolated
|
|
44
|
+
OpenCode 2.0.26 service, `/backeer token` executes without an agent turn, and
|
|
45
|
+
native question answer/cancel calls pass through authenticated discovery.
|
|
46
|
+
|
|
5
47
|
## 0.3.2 - 2026-09-02
|
|
6
48
|
|
|
7
49
|
- Synchronize the plugin's reported runtime version with the published package
|
package/README.md
CHANGED
|
@@ -8,12 +8,66 @@ command stream. An authorized user can choose **Allow once**, **Always allow**,
|
|
|
8
8
|
or **Reject** for permissions and can answer or reject AI questions from the
|
|
9
9
|
Backeer iOS application.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Mobile notifications and approvals use outbound HTTPS only. The optional live
|
|
12
|
+
control feature adds an authenticated loopback-only listener inside OpenCode;
|
|
13
|
+
it needs no public port, inbound firewall rule, or separately hosted server.
|
|
14
|
+
See [Live control setup](docs/live-control.md) for the SSE/MCP connection.
|
|
15
|
+
|
|
16
|
+
## Live output and instructions
|
|
17
|
+
|
|
18
|
+
The opt-in live channel lets a local MCP client send an instruction to an exact
|
|
19
|
+
OpenCode session and follow assistant text, tool results, status and pending
|
|
20
|
+
approval metadata over SSE. It does not record the whole terminal, export
|
|
21
|
+
reasoning or authentication forms, or approve permissions. Mobile approval and
|
|
22
|
+
question replies continue through Backeer as before.
|
|
23
|
+
|
|
24
|
+
Create a separate protected live-control credential file on the OpenCode host;
|
|
25
|
+
use the same credential in an owner-only file on the MCP computer. Do not reuse
|
|
26
|
+
the Backeer ingest token. Values never belong in plugin options or chat text.
|
|
27
|
+
For example, generate a file without printing its contents:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
install -d -m 700 "$HOME/.config/opencode/secrets"
|
|
31
|
+
(set -C; umask 077; openssl rand -hex 32 > "$HOME/.config/opencode/secrets/backeer-live-token")
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This refuses to overwrite an existing live-control file; generate it once for
|
|
35
|
+
initial setup, not during a running session. Enable the plugin with non-secret
|
|
36
|
+
options (use an actual absolute path):
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"plugins": [{
|
|
41
|
+
"package": "backeer-opencode",
|
|
42
|
+
"options": {
|
|
43
|
+
"liveBridge": {
|
|
44
|
+
"enabled": true,
|
|
45
|
+
"port": 43871,
|
|
46
|
+
"tokenFile": "/absolute/private/path/backeer-live-token"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For side-loaded installations, the equivalent environment variables are
|
|
54
|
+
`BACKEER_LIVE_ENABLED=true`, `BACKEER_LIVE_PORT=43871`, and
|
|
55
|
+
`BACKEER_LIVE_TOKEN_FILE=/absolute/private/path/backeer-live-token`. Defaults:
|
|
56
|
+
disabled; port `43871`; token file under the existing OpenCode configuration
|
|
57
|
+
directory at `secrets/backeer-live-token`. An invalid live configuration disables
|
|
58
|
+
only the live channel, leaving existing mobile integration available. Restart
|
|
59
|
+
the intended OpenCode process after explicitly installing/enabling this version;
|
|
60
|
+
existing running sessions are not modified by this source checkout.
|
|
61
|
+
|
|
62
|
+
The matching `backeer-opencode-mcp` executable is provided in the package.
|
|
63
|
+
Connect through an existing SSH tunnel and register the local stdio executable
|
|
64
|
+
as described in [the complete setup guide](docs/live-control.md). Version 0.5.1
|
|
65
|
+
in this checkout must be installed from its built package or installer bundle
|
|
66
|
+
until it has been separately published; do not assume npm `latest` contains it.
|
|
13
67
|
|
|
14
68
|
## Requirements
|
|
15
69
|
|
|
16
|
-
- OpenCode
|
|
70
|
+
- OpenCode V2 (tested against 2.0.26), or V1 1.18.29 and newer
|
|
17
71
|
- Node.js 18 or newer for the local installer and tests
|
|
18
72
|
- Outbound HTTPS access to `external-gateway.backeer.com:443`
|
|
19
73
|
- A Backeer source ingest token
|
|
@@ -24,7 +78,7 @@ uses that token and weakens host-level auditing and revocation.
|
|
|
24
78
|
|
|
25
79
|
## Local installation
|
|
26
80
|
|
|
27
|
-
The local installer copies a single
|
|
81
|
+
The local installer copies a single self-contained plugin file into OpenCode's
|
|
28
82
|
global plugin directory. OpenCode discovers it automatically.
|
|
29
83
|
|
|
30
84
|
```sh
|
|
@@ -54,7 +108,7 @@ Restart OpenCode after installation or update.
|
|
|
54
108
|
Install the package in OpenCode's global configuration:
|
|
55
109
|
|
|
56
110
|
```sh
|
|
57
|
-
opencode plugin backeer-opencode
|
|
111
|
+
opencode plugin add backeer-opencode
|
|
58
112
|
npx backeer-opencode@latest configure
|
|
59
113
|
```
|
|
60
114
|
|
|
@@ -67,7 +121,7 @@ Alternatively, add it to `~/.config/opencode/opencode.json` manually:
|
|
|
67
121
|
```json
|
|
68
122
|
{
|
|
69
123
|
"$schema": "https://opencode.ai/config.json",
|
|
70
|
-
"
|
|
124
|
+
"plugins": ["backeer-opencode"]
|
|
71
125
|
}
|
|
72
126
|
```
|
|
73
127
|
|
|
@@ -121,14 +175,14 @@ environment variables are supported:
|
|
|
121
175
|
| `BACKEER_LOG_LEVEL` | `info` (default), `error`, `debug`, or `silent` |
|
|
122
176
|
|
|
123
177
|
For npm installations, non-secret options can also be supplied through the
|
|
124
|
-
OpenCode plugin
|
|
178
|
+
OpenCode V2 plugin options syntax:
|
|
125
179
|
|
|
126
180
|
```json
|
|
127
181
|
{
|
|
128
|
-
"
|
|
129
|
-
|
|
130
|
-
"backeer-opencode",
|
|
131
|
-
{
|
|
182
|
+
"plugins": [
|
|
183
|
+
{
|
|
184
|
+
"package": "backeer-opencode",
|
|
185
|
+
"options": {
|
|
132
186
|
"permissions": true,
|
|
133
187
|
"questions": true,
|
|
134
188
|
"todos": true,
|
|
@@ -142,18 +196,18 @@ OpenCode plugin tuple syntax:
|
|
|
142
196
|
"retryAttemptThreshold": 3
|
|
143
197
|
}
|
|
144
198
|
}
|
|
145
|
-
|
|
199
|
+
}
|
|
146
200
|
]
|
|
147
201
|
}
|
|
148
202
|
```
|
|
149
203
|
|
|
150
204
|
Supported options are `origin`, `tokenFile`, `permissions`, `questions`,
|
|
151
|
-
`todos`, `lifecycle`, and `logLevel`. Use `"lifecycle": false` to disable the
|
|
205
|
+
`todos`, `lifecycle`, `liveBridge`, and `logLevel`. Use `"lifecycle": false` to disable the
|
|
152
206
|
entire lifecycle group. The token itself is deliberately not a plugin option.
|
|
153
207
|
|
|
154
208
|
## Conversation feedback
|
|
155
209
|
|
|
156
|
-
|
|
210
|
+
On OpenCode V1, user-facing status messages appear as compact Backeer entries in the OpenCode
|
|
157
211
|
conversation:
|
|
158
212
|
|
|
159
213
|
```text
|
|
@@ -170,8 +224,13 @@ an agent is active, a permission prompt is open, or a question is awaiting an
|
|
|
170
224
|
answer remains queued until the interaction closes and the session becomes idle.
|
|
171
225
|
It never writes to the user's input field or replaces interactive OpenCode UI.
|
|
172
226
|
|
|
173
|
-
|
|
174
|
-
|
|
227
|
+
On V2, automatic delivery feedback stays in server logs: the V1 ignored/noReply
|
|
228
|
+
conversation API no longer exists. `/backeer` command results use a synthetic
|
|
229
|
+
entry with `resume: false`, so they do not start an agent turn, but they can be
|
|
230
|
+
included in later model context. No credentials are displayed.
|
|
231
|
+
|
|
232
|
+
Technical diagnostics use V1's structured application log API or V2's captured
|
|
233
|
+
server stderr, never stdout. Normal `info` logging omits HTTP details; set
|
|
175
234
|
`BACKEER_LOG_LEVEL=debug` when technical details are needed. Set it to `error`
|
|
176
235
|
for failures only or `silent` to disable structured logs.
|
|
177
236
|
|
|
@@ -228,7 +287,22 @@ package caches.
|
|
|
228
287
|
|
|
229
288
|
## Events and decisions
|
|
230
289
|
|
|
231
|
-
|
|
290
|
+
On V2, native `form.created` question forms are adapted to Backeer question
|
|
291
|
+
cards, replies use `session.form.reply/cancel`, and
|
|
292
|
+
`session.execution.started/succeeded/failed/interrupted` drive lifecycle
|
|
293
|
+
notifications. Only forms marked `metadata.kind: "question"` are forwarded;
|
|
294
|
+
authentication and other forms are never exported. Events from other locations
|
|
295
|
+
are ignored. V2 has no native `todo.updated` event, so todo notifications are
|
|
296
|
+
disabled there regardless of the `todos` option.
|
|
297
|
+
|
|
298
|
+
V2 remote question replies require the managed shared service. OpenCode 2.0.26
|
|
299
|
+
does not expose forms on the plugin context, so the plugin uses the official
|
|
300
|
+
client's authenticated service discovery and verifies session location before
|
|
301
|
+
answering. It never starts another service. Notifications work in standalone
|
|
302
|
+
mode, but remote question replies fail explicitly there rather than contacting
|
|
303
|
+
a different session.
|
|
304
|
+
|
|
305
|
+
The V1 event mappings are:
|
|
232
306
|
|
|
233
307
|
| OpenCode event | Backeer behavior |
|
|
234
308
|
|---|---|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runLiveControlMcp } from "../src/live-control-mcp.js"
|
|
3
|
+
|
|
4
|
+
try {
|
|
5
|
+
await runLiveControlMcp()
|
|
6
|
+
} catch {
|
|
7
|
+
console.error("Backeer live-control MCP failed to start. Check BACKEER_LIVE_TOKEN_FILE, its owner-only permissions, and BACKEER_LIVE_URL.")
|
|
8
|
+
process.exitCode = 1
|
|
9
|
+
}
|