@openagents-org/agent-launcher 0.2.216 → 0.2.217

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openagents-org/agent-launcher",
3
- "version": "0.2.216",
3
+ "version": "0.2.217",
4
4
  "description": "OpenAgents Launcher — install, configure, and run AI coding agents from your terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -159,7 +159,10 @@ class OpenCodeAdapter extends BaseAdapter {
159
159
  // opencode hangs waiting for interactive provider/model selection.
160
160
  // Connected agents run unattended: let the CLI resolve permission prompts
161
161
  // automatically instead of rejecting tools outside the working directory.
162
- const args = ['run', '--format', 'json', '--dangerously-skip-permissions', '--dir', runCwd, '--model', model];
162
+ // --thinking adds the model's reasoning to the JSON stream as `reasoning`
163
+ // events, shown live as thinking (like Claude and Codex). Available since
164
+ // the minimum supported 1.17.0.
165
+ const args = ['run', '--format', 'json', '--thinking', '--dangerously-skip-permissions', '--dir', runCwd, '--model', model];
163
166
  if (sessionId) args.push('--session', sessionId);
164
167
  return args;
165
168
  }
@@ -504,6 +507,7 @@ class OpenCodeAdapter extends BaseAdapter {
504
507
  const eventType = String(event.type || '').toLowerCase();
505
508
  if (['step_start', 'step-start', 'step_finish', 'step-finish', 'tool_use', 'tool'].includes(eventType)) return null;
506
509
  if (OpenCodeAdapter._isToolEvent(event)) return null;
510
+ if (OpenCodeAdapter._isReasoningEvent(event)) return null;
507
511
  if (eventType.includes('error')) return null;
508
512
 
509
513
  const part = event.part;
@@ -574,6 +578,13 @@ class OpenCodeAdapter extends BaseAdapter {
574
578
  }
575
579
 
576
580
  async _handleStreamEvent(event, msgChannel, responseState = null) {
581
+ // Reasoning is a live thinking trace only: it never counts toward the reply.
582
+ const reasoning = OpenCodeAdapter._reasoningFromEvent(event);
583
+ if (reasoning !== null) {
584
+ if (reasoning.trim()) await this.sendThinking(msgChannel, reasoning.trim());
585
+ return;
586
+ }
587
+
577
588
  const status = OpenCodeAdapter._toolStatusFromEvent(event);
578
589
  if (status) {
579
590
  // A tool call resets `finalText` (the "text since the last tool"), so the
@@ -1262,6 +1273,24 @@ class OpenCodeAdapter extends BaseAdapter {
1262
1273
  // ------------------------------------------------------------------
1263
1274
 
1264
1275
  /** True when an event is a tool call, across opencode's version-varying shapes. */
1276
+ /** A `--thinking` reasoning event (`{type:"reasoning", part:{type:"reasoning", text}}`). */
1277
+ static _isReasoningEvent(event) {
1278
+ if (!event || typeof event !== 'object') return false;
1279
+ if (String(event.type || '').toLowerCase() === 'reasoning') return true;
1280
+ const part = event.part;
1281
+ return !!(part && typeof part === 'object' && String(part.type || '').toLowerCase() === 'reasoning');
1282
+ }
1283
+
1284
+ /** Reasoning text from a reasoning event ('' when empty), or null for any other event. */
1285
+ static _reasoningFromEvent(event) {
1286
+ if (!OpenCodeAdapter._isReasoningEvent(event)) return null;
1287
+ const part = (event.part && typeof event.part === 'object') ? event.part : event;
1288
+ const text = part.text || part.content || '';
1289
+ // Summaries of several reasoning steps arrive glued together
1290
+ // ("**Checking A****Testing B**"); give each heading its own paragraph.
1291
+ return typeof text === 'string' ? text.replace(/\*\*\*\*(?=\S)/g, '**\n\n**') : '';
1292
+ }
1293
+
1265
1294
  static _isToolEvent(event) {
1266
1295
  if (!event || typeof event !== 'object') return false;
1267
1296
  const t = String(event.type || '').toLowerCase();