@tbrandenburg/opencode-a2a-lite 0.3.2 → 0.3.3

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 CHANGED
@@ -124,6 +124,8 @@ reusing the ACP session for that context.
124
124
  - Only ACP `end_turn` means completed; confirmed `cancelled` means canceled.
125
125
  Errors and other stop reasons fail the task without publishing private diagnostics.
126
126
  - Permission requests are rejected/canceled, not silently approved.
127
+ - A failed task names the failing phase (for example `ACP session creation failed`); the
128
+ underlying OpenCode diagnostic is never published. A bridge failure is permanent until restart.
127
129
  - Defaults: 30-second startup/session allocation, 120-second prompt, 5-second
128
130
  cancellation and 5-second ACP shutdown. Failure retires the unhealthy bridge.
129
131
  - Streaming sends stable artifact IDs and ordered append events. Task states are
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbrandenburg/opencode-a2a-lite",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "OpenCode ACP to A2A gateway for trusted workspaces",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -3,6 +3,7 @@ import { isAbsolute } from "node:path";
3
3
  import { Readable, Writable } from "node:stream";
4
4
  import * as acp from "@agentclientprotocol/sdk";
5
5
  import manifest from "../package.json" with { type: "json" };
6
+ import { BridgeError } from "./bridge-error.js";
6
7
  import { supportedOpenCode } from "./opencode-version.js";
7
8
  import { StartupError } from "./startup-error.js";
8
9
  export function createAcpBridge(options) {
@@ -32,7 +33,7 @@ export function createAcpBridge(options) {
32
33
  function fail(message) {
33
34
  if (failure.signal.aborted)
34
35
  return;
35
- failure.abort(message instanceof StartupError ? message : new Error(message));
36
+ failure.abort(message instanceof StartupError ? message : new BridgeError(message));
36
37
  ready = false;
37
38
  connection?.close();
38
39
  // Retain the cleanup result for close(); request errors never contain peer diagnostics.
@@ -70,14 +71,14 @@ export function createAcpBridge(options) {
70
71
  }
71
72
  function requireConnection(sessionId) {
72
73
  if (!ready || !connection || failure.signal.aborted || stopping)
73
- throw new Error("ACP bridge unavailable");
74
+ throw new BridgeError("ACP bridge unavailable");
74
75
  if (sessionId !== undefined && !sessions.has(sessionId))
75
76
  throw new Error("Unknown ACP session");
76
77
  return connection;
77
78
  }
78
79
  function start() {
79
80
  if (failure.signal.aborted || stopping)
80
- return Promise.reject(new Error("ACP bridge unavailable"));
81
+ return Promise.reject(new BridgeError("ACP bridge unavailable"));
81
82
  if (starting)
82
83
  return starting;
83
84
  starting = bounded(async () => {
@@ -0,0 +1,7 @@
1
+ /** Failure whose message is gateway-authored, phase-level and safe to publish to A2A clients. */
2
+ export class BridgeError extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = "BridgeError";
6
+ }
7
+ }
@@ -2,6 +2,7 @@ import { randomUUID } from "node:crypto";
2
2
  import { Role, TaskState } from "@a2a-js/sdk";
3
3
  import { TaskNotCancelableError } from "@a2a-js/sdk/errors";
4
4
  import { AgentEvent, } from "@a2a-js/sdk/server";
5
+ import { BridgeError } from "./bridge-error.js";
5
6
  export const EXPLICIT_CONTEXT = "opencode.explicitContext";
6
7
  function textPart(text) {
7
8
  return {
@@ -139,10 +140,11 @@ export function createAgentExecutor(bridge, options = {}) {
139
140
  sessions.delete(contextId);
140
141
  finish(TaskState.TASK_STATE_FAILED, "ACP did not complete the turn");
141
142
  }
142
- catch {
143
+ catch (error) {
143
144
  sessions.delete(contextId);
145
+ // Only gateway-authored phase messages are published; peer diagnostics never are.
144
146
  if (!terminal)
145
- finish(TaskState.TASK_STATE_FAILED, "ACP execution failed");
147
+ finish(TaskState.TASK_STATE_FAILED, error instanceof BridgeError ? error.message : "ACP execution failed");
146
148
  }
147
149
  finally {
148
150
  record.terminal = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbrandenburg/opencode-a2a-lite",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "OpenCode ACP to A2A gateway for trusted workspaces",
5
5
  "license": "MIT",
6
6
  "repository": {