smol-symphony 0.1.0 → 0.2.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.
Files changed (140) hide show
  1. package/AGENTS.md +105 -38
  2. package/PRODUCT.md +2 -1
  3. package/README.md +195 -98
  4. package/SPEC.md +543 -1915
  5. package/WORKFLOW.md +654 -179
  6. package/WORKFLOW.template.md +761 -121
  7. package/dist/acp-bridge.js +324 -0
  8. package/dist/acp-bridge.js.map +1 -0
  9. package/dist/actions/cache.js +191 -0
  10. package/dist/actions/cache.js.map +1 -0
  11. package/dist/actions/effects.js +41 -0
  12. package/dist/actions/effects.js.map +1 -0
  13. package/dist/actions/executor.js +570 -0
  14. package/dist/actions/executor.js.map +1 -0
  15. package/dist/actions/index.js +13 -0
  16. package/dist/actions/index.js.map +1 -0
  17. package/dist/actions/parsing.js +273 -0
  18. package/dist/actions/parsing.js.map +1 -0
  19. package/dist/actions/predicate-env.js +27 -0
  20. package/dist/actions/predicate-env.js.map +1 -0
  21. package/dist/actions/predicates.js +49 -0
  22. package/dist/actions/predicates.js.map +1 -0
  23. package/dist/actions/templating.js +66 -0
  24. package/dist/actions/templating.js.map +1 -0
  25. package/dist/actions/types.js +15 -0
  26. package/dist/actions/types.js.map +1 -0
  27. package/dist/agent/acp.js +232 -63
  28. package/dist/agent/acp.js.map +1 -1
  29. package/dist/agent/adapter-names.js +159 -0
  30. package/dist/agent/adapter-names.js.map +1 -0
  31. package/dist/agent/adapters.js +338 -102
  32. package/dist/agent/adapters.js.map +1 -1
  33. package/dist/agent/credential-extractors.js +342 -0
  34. package/dist/agent/credential-extractors.js.map +1 -0
  35. package/dist/agent/credential-secrets.js +628 -0
  36. package/dist/agent/credential-secrets.js.map +1 -0
  37. package/dist/agent/credential-ticker.js +57 -0
  38. package/dist/agent/credential-ticker.js.map +1 -0
  39. package/dist/agent/gondolin-creds-staging.js +356 -0
  40. package/dist/agent/gondolin-creds-staging.js.map +1 -0
  41. package/dist/agent/gondolin-dispatch.js +375 -0
  42. package/dist/agent/gondolin-dispatch.js.map +1 -0
  43. package/dist/agent/gondolin.js +124 -0
  44. package/dist/agent/gondolin.js.map +1 -0
  45. package/dist/agent/runner-decisions.js +134 -0
  46. package/dist/agent/runner-decisions.js.map +1 -0
  47. package/dist/agent/runner.js +1352 -290
  48. package/dist/agent/runner.js.map +1 -1
  49. package/dist/agent/tool-call-summary.js +102 -0
  50. package/dist/agent/tool-call-summary.js.map +1 -0
  51. package/dist/agent/vm-acp-mapping.js +73 -0
  52. package/dist/agent/vm-acp-mapping.js.map +1 -0
  53. package/dist/agent/vm-guards.js +262 -0
  54. package/dist/agent/vm-guards.js.map +1 -0
  55. package/dist/agent/vm-port.js +22 -0
  56. package/dist/agent/vm-port.js.map +1 -0
  57. package/dist/agent/vm-process-registry.js +79 -0
  58. package/dist/agent/vm-process-registry.js.map +1 -0
  59. package/dist/bin/cli-args.js +105 -0
  60. package/dist/bin/cli-args.js.map +1 -0
  61. package/dist/bin/symphony.js +719 -130
  62. package/dist/bin/symphony.js.map +1 -1
  63. package/dist/errors.js +15 -0
  64. package/dist/errors.js.map +1 -0
  65. package/dist/http-disk.js +135 -0
  66. package/dist/http-disk.js.map +1 -0
  67. package/dist/http-handlers.js +180 -0
  68. package/dist/http-handlers.js.map +1 -0
  69. package/dist/http.js +1476 -764
  70. package/dist/http.js.map +1 -1
  71. package/dist/issues.js +178 -0
  72. package/dist/issues.js.map +1 -0
  73. package/dist/logging.js +163 -5
  74. package/dist/logging.js.map +1 -1
  75. package/dist/mcp.js +391 -163
  76. package/dist/mcp.js.map +1 -1
  77. package/dist/memory.js +85 -0
  78. package/dist/memory.js.map +1 -0
  79. package/dist/orchestrator-decisions.js +331 -0
  80. package/dist/orchestrator-decisions.js.map +1 -0
  81. package/dist/orchestrator.js +1189 -303
  82. package/dist/orchestrator.js.map +1 -1
  83. package/dist/prompt.js +5 -5
  84. package/dist/prompt.js.map +1 -1
  85. package/dist/reconciler/cache.js +65 -0
  86. package/dist/reconciler/cache.js.map +1 -0
  87. package/dist/reconciler/index.js +448 -0
  88. package/dist/reconciler/index.js.map +1 -0
  89. package/dist/reconciler/ledger.js +131 -0
  90. package/dist/reconciler/ledger.js.map +1 -0
  91. package/dist/reconciler/pr-adapters.js +174 -0
  92. package/dist/reconciler/pr-adapters.js.map +1 -0
  93. package/dist/reconciler/pr-decide.js +167 -0
  94. package/dist/reconciler/pr-decide.js.map +1 -0
  95. package/dist/reconciler/pr.js +422 -0
  96. package/dist/reconciler/pr.js.map +1 -0
  97. package/dist/reconciler/types.js +12 -0
  98. package/dist/reconciler/types.js.map +1 -0
  99. package/dist/reconciler/vm.js +243 -0
  100. package/dist/reconciler/vm.js.map +1 -0
  101. package/dist/reconciler/workspace-defaults.js +83 -0
  102. package/dist/reconciler/workspace-defaults.js.map +1 -0
  103. package/dist/reconciler/workspace.js +272 -0
  104. package/dist/reconciler/workspace.js.map +1 -0
  105. package/dist/runlog.js +403 -0
  106. package/dist/runlog.js.map +1 -0
  107. package/dist/scaffold.js +165 -0
  108. package/dist/scaffold.js.map +1 -0
  109. package/dist/trackers/local.js +234 -133
  110. package/dist/trackers/local.js.map +1 -1
  111. package/dist/trackers/types.js +1 -1
  112. package/dist/trackers/types.js.map +1 -1
  113. package/dist/types.js +1 -1
  114. package/dist/util/clock.js +12 -0
  115. package/dist/util/clock.js.map +1 -0
  116. package/dist/util/crypto.js +25 -0
  117. package/dist/util/crypto.js.map +1 -0
  118. package/dist/util/frontmatter.js +70 -0
  119. package/dist/util/frontmatter.js.map +1 -0
  120. package/dist/util/fs-issues.js +22 -0
  121. package/dist/util/fs-issues.js.map +1 -0
  122. package/dist/util/process.js +152 -0
  123. package/dist/util/process.js.map +1 -0
  124. package/dist/util/workspace-key.js +10 -0
  125. package/dist/util/workspace-key.js.map +1 -0
  126. package/dist/workflow-loader.js +147 -0
  127. package/dist/workflow-loader.js.map +1 -0
  128. package/dist/workflow.js +656 -219
  129. package/dist/workflow.js.map +1 -1
  130. package/dist/workspace-types.js +8 -0
  131. package/dist/workspace-types.js.map +1 -0
  132. package/dist/workspace.js +367 -120
  133. package/dist/workspace.js.map +1 -1
  134. package/package.json +14 -6
  135. package/scripts/vm-agent.mjs +211 -0
  136. package/dist/agent/codex.js +0 -439
  137. package/dist/agent/codex.js.map +0 -1
  138. package/dist/agent/smolvm.js +0 -174
  139. package/dist/agent/smolvm.js.map +0 -1
  140. package/scripts/build-vm.sh +0 -67
package/dist/agent/acp.js CHANGED
@@ -5,7 +5,7 @@
5
5
  // (`opencode acp`). The protocol is JSON-RPC over stdio.
6
6
  //
7
7
  // This wrapper:
8
- // * spawns the adapter command inside a smolvm machine (the child process stdio is the
8
+ // * spawns the adapter command inside a Gondolin VM (the child process stdio is the
9
9
  // transport; nothing local is mutated outside the VM)
10
10
  // * bridges Node child process stdio to the SDK's WHATWG streams via Readable.toWeb / etc.
11
11
  // * implements the small Client surface ACP requires — session update streaming,
@@ -13,9 +13,24 @@
13
13
  // posture (auto-approve, no client-side fs writes; the agent uses its own tools in-VM)
14
14
  // * exposes high-level methods `initSession()` and `runPrompt()` that the agent runner
15
15
  // uses to drive one turn of work.
16
- import { Readable, Writable } from 'node:stream';
16
+ import { Readable, Transform, Writable } from 'node:stream';
17
+ import { StringDecoder } from 'node:string_decoder';
17
18
  import { ClientSideConnection, ndJsonStream, PROTOCOL_VERSION, } from '@agentclientprotocol/sdk';
18
19
  import { log } from '../logging.js';
20
+ import { summarizeToolCall, summarizeToolCallUpdate } from './tool-call-summary.js';
21
+ // Connection/transport faults surfaced by the in-VM agent's model API client
22
+ // (ECONNRESET, socket hang up, "Unable to connect to API", …) arrive as a thrown
23
+ // JSON-RPC error on session/prompt — they are NOT an agent decision. Issue 135:
24
+ // bucketing these as `refusal` made a transient upstream stream reset look like
25
+ // the agent giving up, so a long turn's transport blip got scored an "agent turn
26
+ // refusal", the whole run was discarded, and the issue re-dispatched in a loop.
27
+ // Label them distinctly (`transport_error`) so the run log / summary stay honest
28
+ // and downstream policy can treat them as transient rather than as a refusal.
29
+ const TRANSPORT_ERROR_RE = /econnreset|etimedout|econnrefused|epipe|enetunreach|ehostunreach|eai_again|socket hang up|unable to connect to api|fetch failed|network error|other side closed|terminated/i;
30
+ /** True when a thrown prompt error is a connection/transport fault, not an agent decision. */
31
+ export function isTransportError(message) {
32
+ return TRANSPORT_ERROR_RE.test(message);
33
+ }
19
34
  export class AcpProtocolError extends Error {
20
35
  code;
21
36
  constructor(code, message) {
@@ -47,6 +62,124 @@ function extractTextContent(content) {
47
62
  return c.text;
48
63
  return '';
49
64
  }
65
+ function truncate(s, max) {
66
+ return s.length > max ? s.slice(0, max) + '…' : s;
67
+ }
68
+ // Transform that hands each newline-delimited frame to `onLine` while passing the raw bytes
69
+ // through to downstream consumers unchanged. Used to tap the ACP JSON-RPC transport in both
70
+ // directions for the per-issue JSONL run log. Buffering lives in `_transform`; a final flush
71
+ // surfaces any unterminated tail so a clean shutdown does not drop the last frame.
72
+ //
73
+ // We decode with a `StringDecoder` rather than `chunk.toString('utf8')` because TCP/stdout
74
+ // chunk boundaries can fall inside a multibyte UTF-8 sequence: an unaccompanied byte split
75
+ // would otherwise be silently converted to a U+FFFD replacement character, corrupting the
76
+ // JSON we record. The decoder buffers the trailing incomplete sequence and returns it
77
+ // prepended to the next chunk's decode.
78
+ class LineTap extends Transform {
79
+ onLine;
80
+ buf = '';
81
+ decoder = new StringDecoder('utf8');
82
+ constructor(onLine) {
83
+ super();
84
+ this.onLine = onLine;
85
+ }
86
+ _transform(chunk, _enc, cb) {
87
+ this.buf +=
88
+ typeof chunk === 'string' ? chunk : this.decoder.write(chunk);
89
+ let idx;
90
+ while ((idx = this.buf.indexOf('\n')) !== -1) {
91
+ const line = this.buf.slice(0, idx);
92
+ this.buf = this.buf.slice(idx + 1);
93
+ if (line.length > 0) {
94
+ try {
95
+ this.onLine(line);
96
+ }
97
+ catch {
98
+ // Tap failures must not interrupt the stream.
99
+ }
100
+ }
101
+ }
102
+ cb(null, chunk);
103
+ }
104
+ _flush(cb) {
105
+ // Drain any incomplete multibyte sequence the decoder is still holding, then surface
106
+ // an unterminated tail so a clean shutdown does not drop the last frame.
107
+ const tail = this.decoder.end();
108
+ if (tail.length > 0)
109
+ this.buf += tail;
110
+ if (this.buf.length > 0) {
111
+ try {
112
+ this.onLine(this.buf);
113
+ }
114
+ catch {
115
+ /* see _transform */
116
+ }
117
+ this.buf = '';
118
+ }
119
+ cb();
120
+ }
121
+ }
122
+ // Record one ACP frame to the run log. Lines that parse as JSON are stored as parsed values
123
+ // so the evaluator agent doesn't double-decode; anything else lands as `kind: "unparseable"`
124
+ // with the raw bytes preserved for forensic value.
125
+ //
126
+ // Before recording, capability tokens in the frame are redacted in place. The most common
127
+ // one is the symphony MCP bearer that we inject into `session/new` as
128
+ // `mcpServers[].headers[].value = "Bearer <token>"`; that token is the agent's per-issue
129
+ // capability to call `transition` and `request_human_steering`, and the JSONL log is a
130
+ // long-lived append-only file an evaluator may share. Replace any string starting with
131
+ // `Bearer ` with `Bearer <redacted>` anywhere in the tree.
132
+ function recordAcpFrame(runLog, direction, line) {
133
+ if (!runLog)
134
+ return;
135
+ let frame;
136
+ try {
137
+ frame = JSON.parse(line);
138
+ }
139
+ catch {
140
+ runLog.record({ channel: 'acp', direction, kind: 'unparseable', raw: line });
141
+ return;
142
+ }
143
+ redactBearerTokens(frame);
144
+ runLog.record({ channel: 'acp', direction, frame });
145
+ }
146
+ // Walk `value` and replace any string of the form `Bearer <token>` with `Bearer <redacted>`.
147
+ // Mutates in place; callers must pass the parsed JSON (which is single-use per call). We
148
+ // walk arrays and plain objects only; primitives other than strings are skipped, and we
149
+ // guard against cycles even though ACP frames shouldn't contain them.
150
+ function redactBearerTokens(value, seen = new WeakSet()) {
151
+ if (!value || typeof value !== 'object')
152
+ return;
153
+ if (seen.has(value))
154
+ return;
155
+ seen.add(value);
156
+ if (Array.isArray(value)) {
157
+ for (let i = 0; i < value.length; i++) {
158
+ const redacted = redactedBearer(value[i]);
159
+ if (redacted !== undefined)
160
+ value[i] = redacted;
161
+ else
162
+ redactBearerTokens(value[i], seen);
163
+ }
164
+ return;
165
+ }
166
+ const obj = value;
167
+ for (const k of Object.keys(obj)) {
168
+ const redacted = redactedBearer(obj[k]);
169
+ if (redacted !== undefined)
170
+ obj[k] = redacted;
171
+ else
172
+ redactBearerTokens(obj[k], seen);
173
+ }
174
+ }
175
+ // Returns the redacted replacement when `v` is a Bearer-token string, else
176
+ // undefined. Non-string and non-Bearer values fall through so the caller can
177
+ // decide whether to recurse.
178
+ function redactedBearer(v) {
179
+ if (typeof v === 'string' && v.startsWith('Bearer '))
180
+ return 'Bearer <redacted>';
181
+ return undefined;
182
+ }
50
183
  // One open ACP session bound to a single child process. The adapter is expected to be
51
184
  // already running; `initSession()` performs `initialize` + `session/new`, and `runPrompt()`
52
185
  // drives one prompt-to-stop_reason cycle.
@@ -58,33 +191,41 @@ export class AcpClient {
58
191
  cancelled = false;
59
192
  // Tracked here so the runner snapshot picks up the most recent assistant text per turn.
60
193
  lastAssistantText = '';
194
+ // Held so `handleTransportClose` can forcibly end the SDK's reader/writer streams.
195
+ // Without this, destroying the underlying socket emits `'close'` on `opts.stdout` but
196
+ // the LineTap Transform in between may not propagate end-of-stream synchronously to
197
+ // `Readable.toWeb`'s output. The SDK's `receive()` reader loop then stays parked in
198
+ // `reader.read()`, so the in-flight `session/prompt` promise never rejects and the
199
+ // runner hangs in `runPrompt()` despite the socket being gone.
200
+ inboundTap;
201
+ outboundTap;
61
202
  constructor(opts) {
62
203
  this.opts = opts;
63
204
  // Bridge child stdio to the WHATWG streams the SDK speaks. `ndJsonStream` expects raw
64
- // bytes; we use Readable.toWeb / Writable.toWeb for the conversion.
65
- const input = Readable.toWeb(opts.stdout);
66
- const output = Writable.toWeb(opts.stdin);
205
+ // bytes; we use Readable.toWeb / Writable.toWeb for the conversion. Both directions
206
+ // pass through a LineTap so the per-issue JSONL run log captures every JSON-RPC frame
207
+ // verbatim (parsed JSON when possible, raw bytes when not).
208
+ this.inboundTap = new LineTap((line) => recordAcpFrame(opts.runLog, 'vm_to_host', line));
209
+ this.outboundTap = new LineTap((line) => recordAcpFrame(opts.runLog, 'host_to_vm', line));
210
+ opts.stdout.pipe(this.inboundTap);
211
+ this.outboundTap.pipe(opts.stdin);
212
+ const input = Readable.toWeb(this.inboundTap);
213
+ const output = Writable.toWeb(this.outboundTap);
67
214
  const stream = ndJsonStream(output, input);
68
215
  this.conn = new ClientSideConnection((_agent) => this.makeClient(), stream);
69
- opts.stderr.setEncoding('utf8');
70
- opts.stderr.on('data', (chunk) => {
71
- const text = chunk.trim();
72
- if (text.length > 0) {
73
- this.emit('agent_stderr', summarize(text));
74
- // Adapters shouldn't normally write to stderr; when they do it's a real
75
- // condition (a failed in-VM cp, a missing binary, an SDK warning). Log
76
- // at info so it lands in the symphony log alongside other lifecycle
77
- // events instead of disappearing into the per-issue event ring buffer.
78
- log.info('agent stderr', { text: text.slice(0, 500) });
79
- }
80
- });
216
+ // Stderr handling lives in the AgentRunner now — it attaches a tap immediately after
217
+ // launching the sandbox process so pre-bridge startup failures (vm-agent missing,
218
+ // bad env, adapter crash before connect) are captured in the JSONL run log and the
219
+ // per-issue event ring. AcpClient no longer consumes opts.stderr; the field is kept
220
+ // on the options type for backward compatibility and so callers retain a single
221
+ // place to think about where the stderr stream goes.
81
222
  opts.stdout.on('close', () => this.handleTransportClose('stdout_closed'));
82
223
  opts.stdin.on('error', () => {
83
224
  /* surface through transport close */
84
225
  });
85
226
  }
86
227
  // The Client interface implementation that the adapter calls back into. Every method is
87
- // implemented because we run the agent inside a smolvm; ACP requires the client to handle
228
+ // implemented because we run the agent inside a Gondolin VM; ACP requires the client to handle
88
229
  // requests it advertises, and the SDK's Client interface lists them all.
89
230
  makeClient() {
90
231
  const self = this;
@@ -96,9 +237,9 @@ export class AcpClient {
96
237
  return self.onPermissionRequest(params);
97
238
  },
98
239
  async readTextFile(_params) {
99
- // §10.5 "high-trust" posture: the agent has direct workspace access inside the VM,
240
+ // §6.1 "high-trust" posture: the agent has direct workspace access inside the VM,
100
241
  // so client-mediated reads are unsupported. Returning an error keeps the session
101
- // alive (per §10.5 "unsupported dynamic tool calls return failure without stall").
242
+ // alive (per §6.1 "unsupported dynamic tool calls return failure without stall").
102
243
  throw new AcpProtocolError('client_capability_not_implemented', 'client fs read not supported');
103
244
  },
104
245
  async writeTextFile(_params) {
@@ -127,57 +268,53 @@ export class AcpClient {
127
268
  onSessionUpdate(params) {
128
269
  const update = params.update;
129
270
  switch (update.sessionUpdate) {
130
- case 'agent_message_chunk': {
131
- const text = extractTextContent(update.content);
132
- if (text) {
133
- this.lastAssistantText += text;
134
- this.emit('agent_message_chunk', text.length > 80 ? text.slice(0, 80) + '' : text);
135
- }
136
- return;
137
- }
138
- case 'agent_thought_chunk': {
139
- const text = extractTextContent(update.content);
140
- if (text)
141
- this.emit('agent_thought_chunk', text.length > 80 ? text.slice(0, 80) + '…' : text);
142
- return;
143
- }
144
- case 'tool_call': {
145
- const name = typeof update.title === 'string' ? update.title : String(update.toolCallId ?? '?');
146
- this.emit('tool_call', `${name}: ${summarize(update)}`);
147
- return;
148
- }
149
- case 'tool_call_update': {
150
- const status = typeof update.status === 'string' ? update.status : '';
151
- this.emit('tool_call_update', `${status}: ${summarize(update)}`);
152
- return;
153
- }
154
- case 'plan': {
155
- this.emit('plan', summarize(update.entries ?? update));
156
- return;
157
- }
158
- case 'usage_update': {
159
- // ACP usage is "context-window used / size", not cumulative I/O tokens. We map it
160
- // into total_tokens so the existing orchestrator accounting stays meaningful; the
161
- // I/O split is recorded as zero because ACP does not expose it.
162
- const used = Number(update.used ?? 0);
163
- const size = Number(update.size ?? 0);
164
- this.opts.onTokenUsage({ input_tokens: 0, output_tokens: 0, total_tokens: used });
165
- this.emit('usage_update', `used=${used}/${size}`);
166
- return;
167
- }
271
+ case 'agent_message_chunk':
272
+ return this.onAgentMessageChunk(update);
273
+ case 'agent_thought_chunk':
274
+ return this.onAgentThoughtChunk(update);
275
+ case 'tool_call':
276
+ return this.emit('tool_call', summarizeToolCall(update));
277
+ case 'tool_call_update':
278
+ return this.emit('tool_call_update', summarizeToolCallUpdate(update));
279
+ case 'plan':
280
+ return this.emit('plan', summarize(update.entries ?? update));
281
+ case 'usage_update':
282
+ return this.onUsageUpdate(update);
168
283
  default:
169
- this.emit('session_update', `${update.sessionUpdate}: ${summarize(update)}`);
284
+ return this.emit('session_update', `${update.sessionUpdate}: ${summarize(update)}`);
170
285
  }
171
286
  }
287
+ onAgentMessageChunk(update) {
288
+ const text = extractTextContent(update.content);
289
+ if (!text)
290
+ return;
291
+ this.lastAssistantText += text;
292
+ this.emit('agent_message_chunk', truncate(text, 80));
293
+ }
294
+ onAgentThoughtChunk(update) {
295
+ const text = extractTextContent(update.content);
296
+ if (text)
297
+ this.emit('agent_thought_chunk', truncate(text, 80));
298
+ }
299
+ // ACP usage is "context-window used / size", not cumulative I/O tokens. We map it
300
+ // into total_tokens so the existing orchestrator accounting stays meaningful; the
301
+ // I/O split is recorded as zero because ACP does not expose it.
302
+ onUsageUpdate(update) {
303
+ const used = Number(update.used ?? 0);
304
+ const size = Number(update.size ?? 0);
305
+ this.opts.onTokenUsage({ input_tokens: 0, output_tokens: 0, total_tokens: used });
306
+ this.emit('usage_update', `used=${used}/${size}`);
307
+ }
172
308
  onPermissionRequest(params) {
173
- // §10.5 high-trust posture: auto-approve every prompt with "allow_always" so the
309
+ // §6.1 high-trust posture: auto-approve every prompt with "allow_always" so the
174
310
  // agent doesn't ask twice in the same session. Falls back to the first listed option
175
311
  // if no "allow_*" kind is present, which keeps the session alive in degraded mode.
176
312
  const preferred = params.options.find((o) => o.kind === 'allow_always') ??
177
313
  params.options.find((o) => o.kind === 'allow_once') ??
178
314
  params.options[0];
179
315
  const optionId = preferred?.optionId ?? '';
180
- this.emit('approval_auto_approved', `${optionId || 'unknown'}: ${summarize(params.toolCall)}`);
316
+ const tool = summarizeToolCallUpdate(params.toolCall);
317
+ this.emit('approval_auto_approved', `${optionId || 'unknown'}: ${tool}`);
181
318
  return { outcome: { outcome: 'selected', optionId } };
182
319
  }
183
320
  handleTransportClose(reason) {
@@ -185,6 +322,35 @@ export class AcpClient {
185
322
  return;
186
323
  this.closed = true;
187
324
  this.emit('subprocess_exit', reason);
325
+ // Force-end the LineTap streams so the SDK's `receive()` reader loop observes
326
+ // `done: true` from `reader.read()`. That makes the SDK call its internal `close()`,
327
+ // which rejects every entry in `pendingResponses` (including the in-flight
328
+ // `session/prompt`). Without this, the runner hangs in `runPrompt()` for the full
329
+ // `prompt_timeout_ms` (30 min) even though the socket is gone, because `socket.destroy()`
330
+ // emits `'close'` on the socket but Node's pipe machinery does not always propagate an
331
+ // end-of-stream through the Transform synchronously. `Transform.end()` is idempotent
332
+ // and safe to call here even if the natural pipe-EOF would have eventually arrived.
333
+ try {
334
+ this.inboundTap.end();
335
+ }
336
+ catch {
337
+ /* idempotent — already ended */
338
+ }
339
+ try {
340
+ this.outboundTap.end();
341
+ }
342
+ catch {
343
+ /* idempotent — already ended */
344
+ }
345
+ }
346
+ /**
347
+ * Explicit force-close for cancel paths. Idempotent. Triggers `handleTransportClose`
348
+ * (and thus the SDK's internal close + pendingResponses rejection) without waiting for
349
+ * the underlying socket to surface its own `'close'` event. Safe to call from cancel
350
+ * timers that fire repeatedly.
351
+ */
352
+ forceClose(reason) {
353
+ this.handleTransportClose(reason);
188
354
  }
189
355
  // Negotiate protocol + open a session. Throws on either failure.
190
356
  async initSession() {
@@ -201,7 +367,7 @@ export class AcpClient {
201
367
  this.emit('session_init', `protocolVersion=${init.protocolVersion}`);
202
368
  // MCP is required for symphony operations: if the agent doesn't advertise support
203
369
  // for a requested transport, we refuse to start the session rather than silently
204
- // dropping the entry and running a degraded agent that has no mark_done /
370
+ // dropping the entry and running a degraded agent that has no transition /
205
371
  // request_human_steering tools. ACP's mcpCapabilities is optional and advertises
206
372
  // `http`/`sse`/`acp` as booleans; missing/undefined means "not supported." Stdio is
207
373
  // implicit (the spec treats it as the baseline) and has no `type` discriminator.
@@ -257,7 +423,10 @@ export class AcpClient {
257
423
  }
258
424
  if (this.closed)
259
425
  return { reason: 'subprocess_exit', message: err.message };
260
- return { reason: 'refusal', message: err.message };
426
+ const message = err.message;
427
+ if (isTransportError(message))
428
+ return { reason: 'transport_error', message };
429
+ return { reason: 'refusal', message };
261
430
  }
262
431
  return mapStopReason(resp.stopReason, this.lastAssistantText);
263
432
  }
@@ -1 +1 @@
1
- {"version":3,"file":"acp.js","sourceRoot":"","sources":["../../src/agent/acp.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,2FAA2F;AAC3F,2FAA2F;AAC3F,yDAAyD;AACzD,EAAE;AACF,gBAAgB;AAChB,yFAAyF;AACzF,0DAA0D;AAC1D,6FAA6F;AAC7F,mFAAmF;AACnF,wFAAwF;AACxF,2FAA2F;AAC3F,yFAAyF;AACzF,sCAAsC;AAEtC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,GA0BjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAsBpC,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACtB;IAAnB,YAAmB,IAAY,EAAE,OAAe;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,SAAI,GAAJ,IAAI,CAAQ;QAE7B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,SAAS,MAAM;IACb,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,SAAS,SAAS,CAAC,GAAY,EAAE,GAAG,GAAG,GAAG;IACxC,IAAI,CAAS,CAAC;IACd,IAAI,CAAC;QACH,CAAC,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC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SAAS,EAAE,OAAO,EAAE,uBAAuB,UAAU,EAAE,EAAE,CAAC;IAC/E,CAAC;AACH,CAAC;AAED,MAAM,YAAa,SAAQ,KAAK;CAAG;AAEnC,SAAS,WAAW,CAAI,CAAa,EAAE,EAAU,EAAE,KAAa;IAC9D,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxC,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,GAAG,KAAK,oBAAoB,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7F,CAAC,CAAC,IAAI,CACJ,CAAC,CAAC,EAAE,EAAE;YACJ,YAAY,CAAC,CAAC,CAAC,CAAC;YAChB,OAAO,CAAC,CAAC,CAAC,CAAC;QACb,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;YACJ,YAAY,CAAC,CAAC,CAAC,CAAC;YAChB,MAAM,CAAC,CAAU,CAAC,CAAC;QACrB,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,159 @@
1
+ // Known-adapter registry: id type and membership check.
2
+ //
3
+ // This module is the seam between the config layer (src/workflow.ts) and the IO
4
+ // adapter layer (src/agent/adapters.ts). Both sides need to agree on which adapter
5
+ // ids exist; pulling the registry out of adapters.ts lets workflow.ts validate
6
+ // configured ids without importing the IO layer (which would flip the layering
7
+ // direction). The full adapter *profile* (binary, model injection, effort
8
+ // injection, …) still lives in agent/adapters.ts.
9
+ import path from 'node:path';
10
+ import os from 'node:os';
11
+ export const KNOWN_ADAPTER_IDS = ['claude', 'codex', 'opencode'];
12
+ export function isKnownAdapter(id) {
13
+ return KNOWN_ADAPTER_IDS.includes(id);
14
+ }
15
+ /**
16
+ * Absolute path to the host's claude OAuth credential file. The host reads this
17
+ * to substitute the live access token into the outbound request at Gondolin
18
+ * egress (the guest only ever holds a token-shaped placeholder); the workflow
19
+ * loader probes its existence at startup so a missing file fails fast with a
20
+ * clear message instead of opaque per-request errors.
21
+ */
22
+ export function hostClaudeCredentialPath() {
23
+ return path.join(os.homedir(), '.claude', '.credentials.json');
24
+ }
25
+ /**
26
+ * Absolute path to the host's codex credential file. The host re-reads this to
27
+ * substitute the live token into the outbound request at Gondolin egress (a
28
+ * ChatGPT-OAuth `tokens.access_token` or a top-level `OPENAI_API_KEY`); the
29
+ * startup probe reads it once so a completely missing codex credential fails
30
+ * fast instead of surfacing as a mid-dispatch `503 no cached access token`.
31
+ */
32
+ export function hostCodexCredentialPath() {
33
+ return path.join(os.homedir(), '.codex', 'auth.json');
34
+ }
35
+ /**
36
+ * Absolute path to the host's opencode credential file. opencode stores its
37
+ * `opencode auth login` credentials at `$XDG_DATA_HOME/opencode/auth.json`
38
+ * (defaulting to `~/.local/share/opencode/auth.json`). The host reads the
39
+ * GitHub Copilot OAuth token out of this file to mint a short-lived Copilot
40
+ * token and substitute it into the outbound request at Gondolin egress, and the
41
+ * startup probe reads it once so a missing/empty opencode credential fails fast
42
+ * instead of surfacing mid-dispatch.
43
+ */
44
+ export function hostOpencodeCredentialPath() {
45
+ const xdg = process.env['XDG_DATA_HOME'];
46
+ const base = nonEmptyString(xdg) ? xdg : path.join(os.homedir(), '.local', 'share');
47
+ return path.join(base, 'opencode', 'auth.json');
48
+ }
49
+ /**
50
+ * Pure: pull the durable GitHub OAuth token out of opencode's parsed
51
+ * `auth.json`. opencode keys credentials by provider id; the GitHub Copilot
52
+ * entry is stored under `"github-copilot"` as an OAuth record. The DURABLE
53
+ * GitHub OAuth token (the secret the host keeps and exchanges for a short-lived
54
+ * Copilot token) lives under `refresh`; opencode caches the
55
+ * exchanged short-lived Copilot token under `access`/`expires` in the same
56
+ * record. We deliberately read `refresh` first — that is the long-lived token
57
+ * the exchange needs — and tolerate alternate field names for forward
58
+ * compatibility. Returns null when no github-copilot OAuth token is present.
59
+ *
60
+ * The exact shape is DOC-DERIVED (see docs/research/opencode-copilot-accept-matrix.md):
61
+ * `{ "github-copilot": { "type": "oauth", "refresh": "gho_…", "access": "tok…", "expires": <ms> } }`.
62
+ */
63
+ export function opencodeGithubTokenFromAuth(parsed) {
64
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
65
+ return null;
66
+ const entry = parsed['github-copilot'];
67
+ if (!entry || typeof entry !== 'object' || Array.isArray(entry))
68
+ return null;
69
+ const rec = entry;
70
+ // Prefer `refresh` (the durable GitHub OAuth token); fall back across plausible
71
+ // field names so a minor opencode storage-schema change doesn't silently break us.
72
+ for (const key of ['refresh', 'token', 'access', 'oauth']) {
73
+ if (nonEmptyString(rec[key]))
74
+ return rec[key];
75
+ }
76
+ return null;
77
+ }
78
+ /**
79
+ * Pure: read the GitHub OAuth token opencode would use for the Copilot
80
+ * exchange from the host environment, following opencode's documented
81
+ * precedence `COPILOT_GITHUB_TOKEN` > `GH_TOKEN` > `GITHUB_TOKEN`. Returns the
82
+ * first non-empty value, or null. The host uses this as the fallback when
83
+ * `auth.json` yields no token; the startup probe uses it to accept a dispatch
84
+ * the host could serve from the environment alone.
85
+ */
86
+ export function opencodeGithubTokenFromEnv(env) {
87
+ for (const key of ['COPILOT_GITHUB_TOKEN', 'GH_TOKEN', 'GITHUB_TOKEN']) {
88
+ if (nonEmptyString(env[key]))
89
+ return env[key];
90
+ }
91
+ return null;
92
+ }
93
+ /**
94
+ * Pure: does opencode have a resolvable GitHub Copilot credential from either
95
+ * source the host reads — a `github-copilot` token in `auth.json`, or one of
96
+ * the `COPILOT_GITHUB_TOKEN`/`GH_TOKEN`/`GITHUB_TOKEN` env vars? The shell
97
+ * reads the file (passing `null` when absent/unreadable) and its env in; this
98
+ * mirrors the host's egress read path so the startup probe accepts exactly when
99
+ * a dispatch would.
100
+ */
101
+ export function opencodeCredentialAvailable(authFileText, env) {
102
+ if (opencodeGithubTokenFromEnv(env) !== null)
103
+ return true;
104
+ if (authFileText === null)
105
+ return false;
106
+ let parsed;
107
+ try {
108
+ parsed = JSON.parse(authFileText);
109
+ }
110
+ catch {
111
+ return false;
112
+ }
113
+ return opencodeGithubTokenFromAuth(parsed) !== null;
114
+ }
115
+ /** Human-readable explanation of which opencode credential sources were checked. */
116
+ export function opencodeMissingCredentialMessage() {
117
+ return `adapter "opencode" requires a host GitHub Copilot credential, but none is available: neither a "github-copilot" token in ${hostOpencodeCredentialPath()} (run \`opencode auth login\` → GitHub Copilot on the host) nor a COPILOT_GITHUB_TOKEN/GH_TOKEN/GITHUB_TOKEN environment variable is present`;
118
+ }
119
+ /**
120
+ * Pure: does codex have a resolvable credential from either valid source? The
121
+ * host reads two — the `~/.codex/auth.json` token (a ChatGPT-OAuth
122
+ * `tokens.access_token` or a top-level `OPENAI_API_KEY`) or an `OPENAI_API_KEY`
123
+ * env var. The shell reads the file (passing `null` when absent/unreadable) and
124
+ * its env in; this mirrors the host's `extractCodexToken` + env fallback so the
125
+ * startup probe accepts exactly when a dispatch would.
126
+ */
127
+ export function codexCredentialAvailable(authFileText, env) {
128
+ if (nonEmptyString(env['OPENAI_API_KEY']))
129
+ return true;
130
+ if (authFileText === null)
131
+ return false;
132
+ let parsed;
133
+ try {
134
+ parsed = JSON.parse(authFileText);
135
+ }
136
+ catch {
137
+ return false;
138
+ }
139
+ return codexAuthFileHasToken(parsed);
140
+ }
141
+ /** Human-readable explanation of which codex credential sources were checked. */
142
+ export function codexMissingCredentialMessage() {
143
+ return `adapter "codex" requires a host credential, but none is available: neither a token in ${hostCodexCredentialPath()} (ChatGPT-OAuth tokens.access_token or OPENAI_API_KEY) nor an OPENAI_API_KEY environment variable is present`;
144
+ }
145
+ function codexAuthFileHasToken(parsed) {
146
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
147
+ return false;
148
+ const root = parsed;
149
+ const tokens = root['tokens'];
150
+ if (tokens && typeof tokens === 'object' && !Array.isArray(tokens)) {
151
+ if (nonEmptyString(tokens['access_token']))
152
+ return true;
153
+ }
154
+ return nonEmptyString(root['OPENAI_API_KEY']);
155
+ }
156
+ function nonEmptyString(v) {
157
+ return typeof v === 'string' && v.length > 0;
158
+ }
159
+ //# sourceMappingURL=adapter-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-names.js","sourceRoot":"","sources":["../../src/agent/adapter-names.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,gFAAgF;AAChF,mFAAmF;AACnF,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,kDAAkD;AAElD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AAIzB,MAAM,CAAC,MAAM,iBAAiB,GAA4B,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AAE1F,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAQ,iBAAuC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B;IACxC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrF,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,C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