@monoes/monomindcli 2.10.21 → 2.10.23

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.
@@ -75,6 +75,22 @@ export class ClaudeAgentRunner {
75
75
  const unsubscribe = killOnAbort(args.signal, {
76
76
  kill: () => abortController.abort(),
77
77
  });
78
+ // Incremental text streaming is opt-in via extras, not unconditional:
79
+ // this runner has two independent consumers. agent-exec.ts (the Agent
80
+ // Exec Protocol) wants incremental `assistant` messages — its own
81
+ // protocol doc already documents the `assistant` frame as "Incremental
82
+ // assistant text ... callers append" (doc/agent-exec-protocol.md §3.2)
83
+ // — and sets this. session.ts (the org runtime) treats each
84
+ // `assistant` AgentMessage as ONE COMPLETE TURN: it feeds the full text
85
+ // into StateDetector's regex pattern-matching and emits ONE org
86
+ // chat-bus event per turn (`bus.emit({type:'chat', ..., msg: text})`).
87
+ // Streaming there unconditionally would fragment the chat log into
88
+ // per-token pieces and pattern-match against incomplete prose.
89
+ // session.ts never sets this (verified: its only `extras` use is the
90
+ // `_orgTest` test seam, and only when no real runner is configured) —
91
+ // so leaving this opt-in, rather than always-on, keeps the org runtime
92
+ // byte-for-byte unchanged.
93
+ const streamPartials = args.extras?.includePartialMessages === true;
78
94
  const stream = this.queryFn({
79
95
  prompt: args.prompt,
80
96
  options: {
@@ -119,14 +135,74 @@ export class ClaudeAgentRunner {
119
135
  ...(args.extras || {}),
120
136
  },
121
137
  });
138
+ // Per-turn incremental-streaming state (only meaningfully used when
139
+ // streamPartials — see above). blockTexts accumulates each text
140
+ // content-block's own text by index; visibleSoFar is the fence-free
141
+ // equivalent of antigravity-runner.ts's own visibleSoFar: the fully
142
+ // assembled, already-yielded prefix, recomputed and diffed against on
143
+ // every delta so the incremental and complete-message reconstructions
144
+ // (both index-sorted-join-with-'\n') always agree — see
145
+ // antigravity-runner.ts's computeSafeChunk/emitVisible/flushText for
146
+ // the sibling pattern this mirrors (no fence-safety concern here,
147
+ // since Claude's content blocks are already cleanly delimited by
148
+ // index rather than needing to be scanned out of raw text).
149
+ let blockTexts = new Map();
150
+ let visibleSoFar = '';
151
+ const assembleVisible = () => [...blockTexts.entries()]
152
+ .sort((a, b) => a[0] - b[0])
153
+ .map(([, t]) => t)
154
+ .join('\n');
122
155
  try {
123
156
  for await (const m of stream) {
124
157
  const session_id = m.session_id;
125
- if (m.type === 'assistant') {
126
- const text = (m.message?.content ?? [])
158
+ if (streamPartials && m.type === 'stream_event') {
159
+ const event = m.event;
160
+ if (event?.type === 'message_start') {
161
+ // Defends against a turn that errors/aborts without ever
162
+ // reaching the 'assistant' branch below (which normally does
163
+ // this reset) — without it, leftover block text from an
164
+ // incomplete turn would contaminate the next turn's indices.
165
+ blockTexts = new Map();
166
+ visibleSoFar = '';
167
+ }
168
+ else if (event?.type === 'content_block_delta' && event.delta?.type === 'text_delta') {
169
+ const idx = event.index ?? 0;
170
+ const deltaText = event.delta.text ?? '';
171
+ if (deltaText) {
172
+ blockTexts.set(idx, (blockTexts.get(idx) ?? '') + deltaText);
173
+ const assembled = assembleVisible();
174
+ if (assembled.length > visibleSoFar.length) {
175
+ const increment = assembled.slice(visibleSoFar.length);
176
+ visibleSoFar = assembled;
177
+ yield { type: 'assistant', session_id, text: increment };
178
+ }
179
+ }
180
+ }
181
+ // Other stream_event subtypes (content_block_start/stop,
182
+ // message_delta/stop, and non-text deltas like input_json_delta
183
+ // for tool-call args or thinking_delta) carry no additional
184
+ // visible-text signal — ignored, matching how they were never
185
+ // surfaced in the pre-streaming design either (the complete
186
+ // message's own content array, filtered to text blocks, was
187
+ // always the sole source of visible text).
188
+ }
189
+ else if (m.type === 'assistant') {
190
+ const fullText = (m.message?.content ?? [])
127
191
  .filter((b) => b.type === 'text')
128
192
  .map((b) => b.text)
129
193
  .join('\n');
194
+ // Without streamPartials, `text` is always the complete fullText
195
+ // (including '' for a text-less, e.g. tool-use-only, turn) —
196
+ // byte-for-byte the prior behavior session.ts depends on. With
197
+ // it, this yields only whatever safe increment hasn't already
198
+ // been streamed above (normally undefined — already fully shown).
199
+ const text = streamPartials
200
+ ? fullText.length > visibleSoFar.length
201
+ ? fullText.slice(visibleSoFar.length)
202
+ : undefined
203
+ : fullText;
204
+ blockTexts = new Map();
205
+ visibleSoFar = '';
130
206
  yield {
131
207
  type: 'assistant',
132
208
  session_id,
@@ -1 +1 @@
1
- {"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../../src/orgrt/agent-runner.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAyCjF;;;;;2CAK2C;AAC3C,MAAM,UAAU,WAAW,CACzB,MAA+B,EAC/B,KAAiD,EACjD,OAAO,GAAG,IAAI;IAEd,IAAI,CAAC,MAAM;QAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,IAAI,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,kBAAkB;QACpB,CAAC;QACD,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE;YACxB,IAAI,CAAC;gBACH,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACxB,CAAC;YAAC,MAAM,CAAC;gBACP,kBAAkB;YACpB,CAAC;QACH,CAAC,EAAE,OAAO,CAAC,CAAC;QACZ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;IACd,CAAC,CAAC;IACF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;QACV,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,OAA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C,CAAC,KAAK,EAAE,aAAa,IAAI,CAAC;wBAC1C,QAAQ,EAAE,CAAC,CAAC,cAAc;qBAC3B,CAAC;gBACJ,CAAC;gBACD,kEAAkE;gBAClE,mEAAmE;gBACnE,mEAAmE;YACrE,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,WAAW,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;CACF;AAED,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
@@ -15,6 +15,30 @@ export interface AgyStreamEvent {
15
15
  toolName?: string;
16
16
  conversationId?: string;
17
17
  }
18
+ /**
19
+ * Fence-boundary-aware incremental streaming cursor. Given the full text
20
+ * accumulated so far for one in-progress agent_response step and how much
21
+ * of it (from the start) has already been surfaced as visible text, returns
22
+ * the additional prefix that is now also safe to surface, plus the new
23
+ * high-water mark to pass back in on the next call.
24
+ *
25
+ * "Safe" means: never any part of an unclosed ```tool_call fence (its
26
+ * content must never reach the user, complete or not — same as
27
+ * TOOL_CALL_RE's own stripping), and never a trailing partial match of the
28
+ * "```tool_call" opening marker itself, which could still complete into a
29
+ * real fence as more text arrives on the next call. A complete fence found
30
+ * along the way is skipped in its entirety — scanning resumes right after
31
+ * its closing ``` — so the fence never appears in the returned chunk.
32
+ *
33
+ * Pure and only ever reads forward from flushedUpTo, so calling it once
34
+ * per accumulated string or once per tiny incremental slice (as real
35
+ * per-token deltas arrive) converges on the identical assembled output —
36
+ * exercised directly in this file's own test suite.
37
+ */
38
+ export declare function computeSafeChunk(text: string, flushedUpTo: number): {
39
+ chunk: string;
40
+ safeEnd: number;
41
+ };
18
42
  export declare class AntigravityAgentRunner implements AgentRunner {
19
43
  private agyBin?;
20
44
  constructor(agyBin?: string | undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity-runner.d.ts","sourceRoot":"","sources":["../../../src/orgrt/antigravity-runner.ts"],"names":[],"mappings":"AA2DA,OAAO,EACL,KAAK,YAAY,EAC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3B,YAAoB,MAAM,CAAC,EAAE,MAAM,YAAA,EAAI;IAEhC,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,CA2H1D;IAED;;;;;;;OAOG;YACY,UAAU;CAkS1B"}
@@ -61,6 +61,71 @@ import { killOnAbort, } from './agent-runner.js';
61
61
  import { classifyStderr } from './kimicode-runner.js';
62
62
  import { buildToolProtocol, executeToolCall, formatToolResults, MAX_TOOL_ROUNDS, parseToolCalls, TOOL_CALL_RE, } from './tool-fence.js';
63
63
  const TURN_TIMEOUT_MS = 2 * 60 * 60 * 1000; // 2 hours, matching kimi/codex runners
64
+ // The opening marker TOOL_CALL_RE looks for (see tool-fence.ts:
65
+ // /```tool_call\s*\n([\s\S]*?)```/g). computeSafeChunk matches on this
66
+ // literal substring rather than the full regex (including its \s*\n
67
+ // requirement) — a deliberate simplification: the only cost of being
68
+ // slightly less strict is that literal prose containing "```tool_call" not
69
+ // followed by a real fence body would be held back until the step ends,
70
+ // at which point it flushes as-is (matching TOOL_CALL_RE's own behavior
71
+ // for anything that never forms a complete, well-closed fence). That is
72
+ // an acceptable, self-correcting edge case for something the model is
73
+ // never instructed to write outside the real fence protocol.
74
+ const FENCE_OPEN = '```tool_call';
75
+ /**
76
+ * Fence-boundary-aware incremental streaming cursor. Given the full text
77
+ * accumulated so far for one in-progress agent_response step and how much
78
+ * of it (from the start) has already been surfaced as visible text, returns
79
+ * the additional prefix that is now also safe to surface, plus the new
80
+ * high-water mark to pass back in on the next call.
81
+ *
82
+ * "Safe" means: never any part of an unclosed ```tool_call fence (its
83
+ * content must never reach the user, complete or not — same as
84
+ * TOOL_CALL_RE's own stripping), and never a trailing partial match of the
85
+ * "```tool_call" opening marker itself, which could still complete into a
86
+ * real fence as more text arrives on the next call. A complete fence found
87
+ * along the way is skipped in its entirety — scanning resumes right after
88
+ * its closing ``` — so the fence never appears in the returned chunk.
89
+ *
90
+ * Pure and only ever reads forward from flushedUpTo, so calling it once
91
+ * per accumulated string or once per tiny incremental slice (as real
92
+ * per-token deltas arrive) converges on the identical assembled output —
93
+ * exercised directly in this file's own test suite.
94
+ */
95
+ export function computeSafeChunk(text, flushedUpTo) {
96
+ let cursor = flushedUpTo;
97
+ let visibleStart = flushedUpTo;
98
+ let chunk = '';
99
+ for (;;) {
100
+ const openIdx = text.indexOf(FENCE_OPEN, cursor);
101
+ if (openIdx === -1) {
102
+ // No complete opening marker ahead. The tail might still be the
103
+ // start of one forming — hold back the longest suffix of the
104
+ // unscanned text that exactly matches a prefix of FENCE_OPEN.
105
+ const tail = text.slice(cursor);
106
+ let holdBack = 0;
107
+ for (let n = Math.min(FENCE_OPEN.length - 1, tail.length); n > 0; n--) {
108
+ if (FENCE_OPEN.startsWith(tail.slice(-n))) {
109
+ holdBack = n;
110
+ break;
111
+ }
112
+ }
113
+ const safeEnd = text.length - holdBack;
114
+ chunk += text.slice(visibleStart, safeEnd);
115
+ return { chunk, safeEnd };
116
+ }
117
+ // Everything before the opening marker is safe.
118
+ chunk += text.slice(visibleStart, openIdx);
119
+ const closeIdx = text.indexOf('```', openIdx + FENCE_OPEN.length);
120
+ if (closeIdx === -1) {
121
+ // Opened but not yet closed — nothing from here on is safe yet.
122
+ return { chunk, safeEnd: openIdx };
123
+ }
124
+ // Fully closed — skip the entire fence, keep scanning after it.
125
+ cursor = closeIdx + 3;
126
+ visibleStart = cursor;
127
+ }
128
+ }
64
129
  export class AntigravityAgentRunner {
65
130
  agyBin;
66
131
  constructor(agyBin) {
@@ -100,14 +165,21 @@ export class AntigravityAgentRunner {
100
165
  for await (const ev of this.streamTurn(bin, promptWithSystem, conversationId, args, outcome)) {
101
166
  if (ev.conversationId)
102
167
  conversationId = ev.conversationId;
103
- if (ev.kind === 'assistant' && ev.rawText !== undefined) {
104
- rawTexts.push(ev.rawText);
105
- // Yield assistant prose AS IT ARRIVES (per agent_response DONE
106
- // boundary, not after process exit): an agy turn can run many
107
- // minutes, and session.ts's watchdog must see messages DURING
108
- // the turn. Note this means partial output may already be
168
+ if (ev.kind === 'assistant') {
169
+ // rawText bookkeeping (fence-parsing input) and visible text
170
+ // are independent: an incremental event carries text with no
171
+ // rawText (must NOT feed rawTexts — it's a fragment, not the
172
+ // step's accumulated text), while a flush event carries
173
+ // rawText and, only if emitVisible hasn't already shown
174
+ // everything, a final text remainder too. Yield assistant
175
+ // prose AS IT ARRIVES (per safe increment or step boundary,
176
+ // not after process exit): an agy turn can run many minutes,
177
+ // and session.ts's watchdog must see messages DURING the
178
+ // turn. Note this means partial output may already be
109
179
  // yielded when a turn later exits non-zero — preferable to
110
180
  // losing it entirely.
181
+ if (ev.rawText !== undefined)
182
+ rawTexts.push(ev.rawText);
111
183
  if (ev.text)
112
184
  yield { type: 'assistant', session_id: conversationId, text: ev.text };
113
185
  }
@@ -242,53 +314,101 @@ export class AntigravityAgentRunner {
242
314
  exitPromise.catch(() => { });
243
315
  let lastConversationId = conversationId;
244
316
  // Per-token text_delta fragments are accumulated per agent_response step
245
- // and flushed as ONE assistant event at the step's DONE boundary (or at
246
- // end of stream if no DONE arrives). Fence stripping needs the complete
247
- // text — per-token deltas would split a ```tool_call fence across events.
317
+ // (pendingText, raw, fences intact) so fence stripping at flush time
318
+ // always sees the complete text — a per-token delta could split a
319
+ // ```tool_call fence across events. rawText bookkeeping (what
320
+ // parseToolCalls sees) is therefore still computed exactly once per
321
+ // step, at the same DONE/step-change/end-of-stream boundaries as
322
+ // before. visibleSoFar decouples FROM that: it is the fence-safe
323
+ // prefix of pendingText already shown to the user (via computeSafeChunk
324
+ // — see its header for the safety definition), and lets emitVisible()
325
+ // stream new safe text live, mid-step, instead of waiting for the
326
+ // step's rawText flush.
248
327
  let pendingText = '';
249
328
  let pendingStepIndex;
329
+ let visibleSoFar = '';
250
330
  let sawStreamedText = false;
251
331
  let resultResponse;
252
- // Flush the accumulated agent_response text as one assistant event.
253
- // Defined as a closure returning the event (or null) so both the DONE
254
- // boundary and the end-of-stream path share the exact same logic.
332
+ // Stream any NEWLY safe text since the last call, as its own event
333
+ // (rawText intentionally omitted — this must never feed rawTexts,
334
+ // which needs one accumulated-per-step string, not fragments).
335
+ // Recomputes computeSafeChunk(pendingText, 0) from scratch each call
336
+ // rather than tracking a raw-text cursor: computeSafeChunk's chunk is
337
+ // provably prefix-stable as pendingText grows (exercised directly by
338
+ // this file's own "handles a fence delivered across many small
339
+ // incremental calls" test), so diffing against visibleSoFar is both
340
+ // correct and — for chat-sized text — cheap enough not to matter.
341
+ const emitVisible = () => {
342
+ const { chunk } = computeSafeChunk(pendingText, 0);
343
+ // Trailing whitespace is held back rather than shown immediately:
344
+ // it might be interior (more text follows, e.g. the blank line
345
+ // before a fence) or truly trailing (nothing follows, and old
346
+ // behavior's whole-text `.trim()` would have dropped it) — which
347
+ // one it is isn't known until the step ends, so flushText's own
348
+ // finalStripped diff (also `.trim()`-ed) is what ultimately
349
+ // resolves it, one way or the other.
350
+ const trimmed = chunk.replace(/\s+$/, '');
351
+ if (trimmed.length <= visibleSoFar.length)
352
+ return null;
353
+ const increment = trimmed.slice(visibleSoFar.length);
354
+ visibleSoFar = trimmed;
355
+ return { kind: 'assistant', text: increment, conversationId: lastConversationId };
356
+ };
357
+ // Flush the accumulated agent_response text as one assistant event:
358
+ // rawText is the full accumulated text (fence parsing's input, UNCHANGED
359
+ // from before incremental streaming existed), text is whatever fence-safe
360
+ // content hasn't already been streamed by emitVisible (undefined once
361
+ // emitVisible has already shown everything there is to show). Using the
362
+ // same TOOL_CALL_RE + trim as the old single-shot design — rather than
363
+ // computeSafeChunk — for this final reveal is deliberate: an unclosed
364
+ // fence must still leak through unchanged at true end-of-stream (matching
365
+ // TOOL_CALL_RE leaving it untouched — computeSafeChunk withholds it
366
+ // forever, since it can never be told a step is truly over), and
367
+ // trailing whitespace must still be dropped exactly the way the old
368
+ // whole-text `.trim()` dropped it.
255
369
  const flushText = () => {
256
370
  if (!pendingText)
257
- return null;
371
+ return [];
258
372
  const raw = pendingText;
373
+ const finalStripped = raw.replace(TOOL_CALL_RE, '').trim();
374
+ const remainder = finalStripped.length > visibleSoFar.length ? finalStripped.slice(visibleSoFar.length) : undefined;
259
375
  pendingText = '';
260
376
  pendingStepIndex = undefined;
261
- const stripped = raw.replace(TOOL_CALL_RE, '').trim();
262
- return {
263
- kind: 'assistant',
264
- rawText: raw,
265
- text: stripped || undefined,
266
- conversationId: lastConversationId,
267
- };
377
+ visibleSoFar = '';
378
+ return [{ kind: 'assistant', rawText: raw, text: remainder, conversationId: lastConversationId }];
268
379
  };
269
380
  // Normalize one parsed wire event: capture the conversation id from ANY
270
381
  // event that carries it (resume needs it on the next turn), record result
271
- // envelope state, and return the AgyStreamEvent to yield (or null).
382
+ // envelope state, and return the AgyStreamEvents to yield (zero, one, or
383
+ // — on a step-index change that both flushes the old step AND streams
384
+ // the new step's first delta — two).
272
385
  // init and other event kinds matter only for the conversation id.
273
386
  const handleEvent = (ev) => {
274
387
  const cid = ev.conversation_id ?? ev.step_update?.conversation_id ?? ev.result?.conversation_id;
275
388
  if (cid)
276
389
  lastConversationId = cid;
390
+ const events = [];
277
391
  if (ev.event === 'step_update' && ev.step_update) {
278
392
  const step = ev.step_update;
279
393
  if (step.step_type === 'agent_response') {
280
394
  if (pendingStepIndex !== undefined &&
281
395
  step.step_index !== undefined &&
282
396
  step.step_index !== pendingStepIndex) {
283
- // A new response step started — flush the previous one.
284
- const flushed = flushText();
285
- if (step.step_index !== undefined)
286
- pendingStepIndex = step.step_index;
397
+ // A new response step started — flush the previous one. rawText
398
+ // bookkeeping timing is UNCHANGED from before incremental
399
+ // streaming: still exactly one flush for the OLD step here: the
400
+ // new step's own delta (if any) just joins pendingText for a
401
+ // LATER event to flush, same as before.
402
+ events.push(...flushText());
403
+ pendingStepIndex = step.step_index;
287
404
  if (typeof step.text_delta === 'string') {
288
405
  sawStreamedText = true;
289
406
  pendingText += step.text_delta;
407
+ const inc = emitVisible();
408
+ if (inc)
409
+ events.push(inc);
290
410
  }
291
- return flushed;
411
+ return events;
292
412
  }
293
413
  if (step.step_index !== undefined)
294
414
  pendingStepIndex = step.step_index;
@@ -305,15 +425,23 @@ export class AntigravityAgentRunner {
305
425
  pendingText += step.text_delta;
306
426
  }
307
427
  }
308
- if (step.state === 'DONE')
309
- return flushText();
428
+ if (step.state === 'DONE') {
429
+ events.push(...flushText());
430
+ }
431
+ else {
432
+ const inc = emitVisible();
433
+ if (inc)
434
+ events.push(inc);
435
+ }
436
+ return events;
310
437
  }
311
438
  else if (step.step_type === 'tool' && step.tool_info?.name) {
312
- return {
439
+ events.push({
313
440
  kind: 'tool',
314
441
  toolName: step.tool_info.name.slice(0, 200),
315
442
  conversationId: lastConversationId,
316
- };
443
+ });
444
+ return events;
317
445
  }
318
446
  }
319
447
  else if (ev.event === 'result' && ev.result) {
@@ -328,7 +456,7 @@ export class AntigravityAgentRunner {
328
456
  if (result.response)
329
457
  resultResponse = result.response;
330
458
  }
331
- return null;
459
+ return events;
332
460
  };
333
461
  try {
334
462
  // Immediate liveness yield: session.ts races the FIRST pull against a
@@ -353,16 +481,14 @@ export class AntigravityAgentRunner {
353
481
  catch {
354
482
  continue;
355
483
  }
356
- const out = handleEvent(ev);
357
- if (out)
484
+ for (const out of handleEvent(ev))
358
485
  yield out;
359
486
  }
360
487
  }
361
488
  const tail = buf.trim();
362
489
  if (tail?.startsWith('{')) {
363
490
  try {
364
- const out = handleEvent(JSON.parse(tail));
365
- if (out)
491
+ for (const out of handleEvent(JSON.parse(tail)))
366
492
  yield out;
367
493
  }
368
494
  catch {
@@ -370,8 +496,7 @@ export class AntigravityAgentRunner {
370
496
  }
371
497
  }
372
498
  // Flush any trailing text whose DONE boundary never arrived.
373
- const flushed = flushText();
374
- if (flushed)
499
+ for (const flushed of flushText())
375
500
  yield flushed;
376
501
  // Fallback for agy versions that only return result.response (no
377
502
  // streaming): surface it as the turn's assistant text.
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity-runner.js","sourceRoot":"","sources":["../../../src/orgrt/antigravity-runner.ts"],"names":[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AAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC5E,CAAC;AACJ,CAAC"}
@@ -7,26 +7,58 @@
7
7
  * can register org tools (org_send, ask_human, …) directly via
8
8
  * createSdkMcpServer.
9
9
  * - opencode runs the agent loop in its OWN server process. The SDK is a
10
- * remote client: create a session, POST prompts, read the response.
10
+ * remote client: create a session, kick off a prompt, watch a shared
11
+ * event stream for what happens.
11
12
  *
12
- * Verified against @opencode-ai/sdk 1.18.x (NOT the docs — the .d.ts and a
13
- * live probe):
14
- * - `createOpencode()` spawns a server and returns { client, server }.
15
- * - `client.session.create({ body: { title } })` → `{ data: { id } }`.
16
- * - `client.session.prompt({ path: { id }, body: { parts: [{ type: 'text',
17
- * text }], system?, model? } })` BLOCKS for the whole turn and returns
18
- * `{ data: { info, parts } }` — info carries tokens
19
- * ({ input, output, reasoning, cache: { read, write } }) and cost; the
20
- * assistant text lives in parts of type "text".
21
- * - Because prompt() blocks, undici's default headers timeout (~30s) kills
22
- * any real turn with UND_ERR_HEADERS_TIMEOUT. This runner installs a
23
- * dispatcher with headersTimeout matching TURN_TIMEOUT_MS — without it
24
- * every non-trivial org turn dies.
13
+ * Streaming — LIVE-VERIFIED against a real opencode server (v1.18.30,
14
+ * @opencode-ai/sdk 1.18.15), not just the installed .d.ts, which turned out
15
+ * to be incomplete for this specific need:
16
+ * - `client.session.promptAsync({ path, body })` is fire-and-forget —
17
+ * `POST /session/{id}/prompt_async` returns 204 with no body. Unlike the
18
+ * blocking `session.prompt()` this runner used before, there is no
19
+ * response to read text or usage from; everything comes from the event
20
+ * stream below.
21
+ * - `client.event.subscribe()` resolves `{ stream: AsyncGenerator<Event> }`
22
+ * (SSE). The two events this runner needs:
23
+ * `message.part.delta` — `{sessionID, messageID, partID, field, delta}`
24
+ * — the REAL per-token/per-chunk text event. This is NOT in the
25
+ * installed SDK's own `Event` union type at all (only
26
+ * `message.part.updated` is, whose own `delta?: string` field was
27
+ * observed to always be `undefined` live — the .d.ts is stale
28
+ * relative to the server's actual wire format). Confirmed live: a
29
+ * real generation emits dozens of these per part.
30
+ * `message.updated` — `{info: AssistantMessage}` — fires repeatedly as
31
+ * a message evolves; `info.time.completed` being set (confirmed live
32
+ * on both a normal completion and a provider error) is the reliable
33
+ * "this assistant message is fully done" signal, at which point
34
+ * `info.tokens`/`info.cost` are the final values for the round.
35
+ * `message.part.updated`'s own full `part.text` snapshot (fired once
36
+ * when a part is created, empty, and again as it's completed) is kept as
37
+ * a checkpoint but the incremental visible stream is driven by
38
+ * `message.part.delta` — same decouple-and-diff shape as
39
+ * antigravity-runner.ts/qwen-rpc-runner.ts: `computeSafeChunk` picks out
40
+ * what's fence-safe to reveal from the accumulating per-part raw text,
41
+ * diffed against how much of that part has already been shown; the
42
+ * final reconciliation at round end reveals anything the incremental
43
+ * path hasn't (normally nothing).
44
+ * - A message's `reasoning`-type parts also emit `message.part.delta`
45
+ * events with `field:"text"` — excluded from visible output the same
46
+ * way Claude's thinking blocks are, by checking the owning part's own
47
+ * `type` (tracked from `message.part.updated`, which always precedes
48
+ * that part's first delta).
49
+ * - Because prompt() no longer blocks, the previous undici headers-timeout
50
+ * workaround is less critical for the prompt call itself (which now
51
+ * returns near-instantly), but the SSE connection is still a long-lived
52
+ * body stream for the whole role's lifetime — the same generous
53
+ * dispatcher (headersTimeout + bodyTimeout:0) is kept for it.
25
54
  *
26
55
  * Org tools (org_send, knowledge_search, …) travel over the shared FENCE
27
56
  * PROTOCOL (tool-fence.ts): rendered into the system prompt, parsed out of
28
57
  * the assistant text, executed in-process, results fed back into the same
29
- * session — same mechanism as KimiCodeAgentRunner.
58
+ * session — same mechanism as KimiCodeAgentRunner. `parseToolCalls` needs
59
+ * each text part's RAW (fence-intact) text, so that — not the fence-stripped
60
+ * visible text — is what's collected per part for it, exactly as the
61
+ * previous blocking-call implementation did.
30
62
  *
31
63
  * Non-disturbance guarantees:
32
64
  * - The SDK is imported dynamically; the package has no hard dependency on
@@ -1 +1 @@
1
- {"version":3,"file":"opencode-runner.d.ts","sourceRoot":"","sources":["../../../src/orgrt/opencode-runner.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAe3B,qBAAa,mBAAoB,YAAW,WAAW;IACzC,OAAO,CAAC,WAAW,CAAC;IAAhC,YAAoB,WAAW,CAAC,EAAE,MAAM,YAAA,EAAI;IAErC,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,CAgM1D;CACF"}
1
+ {"version":3,"file":"opencode-runner.d.ts","sourceRoot":"","sources":["../../../src/orgrt/opencode-runner.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAoB3B,qBAAa,mBAAoB,YAAW,WAAW;IACzC,OAAO,CAAC,WAAW,CAAC;IAAhC,YAAoB,WAAW,CAAC,EAAE,MAAM,YAAA,EAAI;IAErC,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,CAkT1D;CACF"}