@tbrandenburg/opencode-a2a-lite 0.3.0 → 0.3.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 +18 -9
- package/dist/package.json +1 -1
- package/dist/src/acp-client.js +4 -0
- package/dist/src/server.js +14 -2
- package/dist/src/terminal-output.js +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,12 @@ A2A client ──HTTP/SSE──▶ opencode-a2a-lite ──ACP (stdio)──▶
|
|
|
24
24
|
> exposed through a public proxy. It inherits OpenCode configuration, tools, plugins and MCP. Rejecting ACP
|
|
25
25
|
> permission requests is **not** an OS sandbox, and cancellation does not roll back work.
|
|
26
26
|
|
|
27
|
+
Choosing a workspace is an explicit trust decision, not a filesystem boundary:
|
|
28
|
+
OpenCode runs as the invoking user and can access resources permitted to that user.
|
|
29
|
+
For stronger isolation use a separately secured VM or container with minimal
|
|
30
|
+
workspace mounts, credentials and network access. The isolated demo uses a private
|
|
31
|
+
HOME/configuration, but is not an OS sandbox.
|
|
32
|
+
|
|
27
33
|
## Contents
|
|
28
34
|
|
|
29
35
|
- [Quick start](#quick-start)
|
|
@@ -44,8 +50,9 @@ npx --yes @tbrandenburg/opencode-a2a-lite@latest --workspace /absolute/path/to/t
|
|
|
44
50
|
|
|
45
51
|
This starts a **gateway server** on `127.0.0.1` and launches `opencode` as a child
|
|
46
52
|
process over ACP in that workspace. It does not run any task by itself: OpenCode only
|
|
47
|
-
works when an A2A client sends a prompt.
|
|
48
|
-
|
|
53
|
+
works when an A2A client sends a prompt. On startup, the CLI prints aligned lifecycle
|
|
54
|
+
status to stderr and a machine-readable readiness record to stdout
|
|
55
|
+
(`{"ready":true,"url":"http://127.0.0.1:.../"}`). In a second terminal use the
|
|
49
56
|
**actual** URL (default port 41241):
|
|
50
57
|
|
|
51
58
|
```sh
|
|
@@ -54,8 +61,10 @@ a2a send -a http://127.0.0.1:41241 "Reply with a short greeting." --stream
|
|
|
54
61
|
a2a send -a http://127.0.0.1:41241 --context-id <returned-context-id> "Follow up"
|
|
55
62
|
```
|
|
56
63
|
|
|
57
|
-
The server runs in the foreground
|
|
58
|
-
|
|
64
|
+
The server runs in the foreground. Press Ctrl-C to see shutdown progress; it reports
|
|
65
|
+
`stopped` only after closing the listener and releasing its owned OpenCode process.
|
|
66
|
+
Status lines use color only on interactive terminals, honor `NO_COLOR`, and remain
|
|
67
|
+
plain when redirected. Startup JSON stays on stdout; human-readable status is on stderr.
|
|
59
68
|
|
|
60
69
|
## Requirements
|
|
61
70
|
|
|
@@ -121,7 +130,7 @@ reusing the ACP session for that context.
|
|
|
121
130
|
SDK-owned; the small [request-handler adapter](src/request-handler.ts) is retained
|
|
122
131
|
for a documented upstream cancellation persistence defect.
|
|
123
132
|
|
|
124
|
-
See [architecture
|
|
133
|
+
See [architecture and implementation pitfalls](docs/architecture.md) and
|
|
125
134
|
[SDK cancellation removal criteria](docs/sdk-cancellation.md).
|
|
126
135
|
Full A2A TCK certification, interactive approval, rich media, push notifications
|
|
127
136
|
and runtime-selected workspaces are not claimed.
|
|
@@ -154,7 +163,8 @@ Live demo/E2E are explicit manual commands requiring a provider key,
|
|
|
154
163
|
OpenCode and the official A2A CLI; `make demo` also needs `jq` and GNU `timeout`.
|
|
155
164
|
On macOS its isolated workspace cleanup additionally uses `/usr/sbin/lsof`.
|
|
156
165
|
For the exact live evidence/limitations see [acceptance](docs/acceptance.md).
|
|
157
|
-
|
|
166
|
+
`bun scripts/quality-report.ts` summarizes the latest local measurements;
|
|
167
|
+
native line/function coverage is not branch coverage or a correctness guarantee.
|
|
158
168
|
|
|
159
169
|
## Multi-agent coordination
|
|
160
170
|
|
|
@@ -167,9 +177,8 @@ For a manually owned model-issued MCP → A2A flow use the
|
|
|
167
177
|
[explicit two-worker pipeline recipe](docs/manual-two-worker-pipeline.md) and
|
|
168
178
|
[passive supervision](docs/passive-mcp-supervision.md). The
|
|
169
179
|
[portable OpenCode multi-agent skill](.opencode/skills/multi-a2a-agent/SKILL.md)
|
|
170
|
-
includes eight topology procedures
|
|
171
|
-
|
|
172
|
-
observations, not proof of general reliability.
|
|
180
|
+
includes eight topology procedures. The [historical research index](docs/history.md)
|
|
181
|
+
links scoped observations, not proof of general reliability.
|
|
173
182
|
|
|
174
183
|
The managed network/topology research lab has been **retired, not fixed**. Its
|
|
175
184
|
original failures and unverified outcomes are linked in the
|
package/dist/package.json
CHANGED
package/dist/src/acp-client.js
CHANGED
|
@@ -239,6 +239,10 @@ export function createAcpBridge(options) {
|
|
|
239
239
|
catch (error) {
|
|
240
240
|
if (error instanceof Error && "code" in error && error.code === "ESRCH")
|
|
241
241
|
return false;
|
|
242
|
+
// On macOS an unreaped process group can briefly return EPERM after SIGKILL.
|
|
243
|
+
// Treat an existence probe as inconclusive, never as proof of cleanup.
|
|
244
|
+
if (signal === 0 && error instanceof Error && "code" in error && error.code === "EPERM")
|
|
245
|
+
return true;
|
|
242
246
|
throw new Error("ACP owned process cleanup failed");
|
|
243
247
|
}
|
|
244
248
|
}
|
package/dist/src/server.js
CHANGED
|
@@ -12,6 +12,7 @@ import { createRequestHandler } from "./request-handler.js";
|
|
|
12
12
|
import { parseOptions } from "./cli-options.js";
|
|
13
13
|
import { reportStartupError, StartupError } from "./startup-error.js";
|
|
14
14
|
import { validateIdentity } from "./identity.js";
|
|
15
|
+
import { formatStatus, supportsTerminalColor } from "./terminal-output.js";
|
|
15
16
|
export function createGateway(options) {
|
|
16
17
|
const identity = validateIdentity(options.identity);
|
|
17
18
|
if (!isAbsolute(options.workspace))
|
|
@@ -171,9 +172,14 @@ export function createGateway(options) {
|
|
|
171
172
|
}
|
|
172
173
|
export async function launchGateway(options) {
|
|
173
174
|
const gateway = createGateway(options);
|
|
175
|
+
const status = (label, detail) => console.error(formatStatus(label, detail, supportsTerminalColor(process.stderr, process.env)));
|
|
174
176
|
const stop = () => {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
+
status("stopping", "gateway · draining active work and closing the listener");
|
|
178
|
+
void gateway
|
|
179
|
+
.close()
|
|
180
|
+
.then(() => status("stopped", "gateway · listener closed and OpenCode process released"))
|
|
181
|
+
.catch(() => {
|
|
182
|
+
status("error", "gateway shutdown failed · inspect the process before restarting");
|
|
177
183
|
process.exitCode = 1;
|
|
178
184
|
});
|
|
179
185
|
};
|
|
@@ -182,6 +188,12 @@ export async function launchGateway(options) {
|
|
|
182
188
|
try {
|
|
183
189
|
const ready = await gateway.start();
|
|
184
190
|
console.log(JSON.stringify({ ready: true, url: ready.url }));
|
|
191
|
+
const cardUrl = new URL(".well-known/agent-card.json", ready.url).href;
|
|
192
|
+
status("ready", `gateway · ${ready.url}`);
|
|
193
|
+
status("workspace", options.workspace);
|
|
194
|
+
status("agent card", cardUrl);
|
|
195
|
+
status("connect", `a2a send -a ${ready.url} "Reply with a short greeting." --stream`);
|
|
196
|
+
status("stop", "press Ctrl-C to stop the gateway");
|
|
185
197
|
}
|
|
186
198
|
catch (error) {
|
|
187
199
|
process.removeListener("SIGINT", stop);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const statusWidth = 10;
|
|
2
|
+
const accent = "\u001b[1;36m";
|
|
3
|
+
const reset = "\u001b[0m";
|
|
4
|
+
export function formatStatus(label, detail, color) {
|
|
5
|
+
const status = label.padEnd(statusWidth);
|
|
6
|
+
return color ? ` ${accent}${status}${reset} ${detail}` : ` ${status} ${detail}`;
|
|
7
|
+
}
|
|
8
|
+
export function supportsTerminalColor(stream, env) {
|
|
9
|
+
return Boolean(stream.isTTY && env.NO_COLOR === undefined && env.TERM !== "dumb");
|
|
10
|
+
}
|