@yemi33/minions 0.1.2213 → 0.1.2214

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/dashboard.js CHANGED
@@ -4672,6 +4672,7 @@ async function ccCallStreaming(message, { store = 'cc', sessionKey, extraContext
4672
4672
  engineConfig: CONFIG.engine,
4673
4673
  onChunk,
4674
4674
  onToolUse,
4675
+ onToolUpdate,
4675
4676
  });
4676
4677
  if (onAbortReady) onAbortReady(p1.abort);
4677
4678
  result = await p1;
@@ -4710,6 +4711,7 @@ async function ccCallStreaming(message, { store = 'cc', sessionKey, extraContext
4710
4711
  engineConfig: CONFIG.engine,
4711
4712
  onChunk,
4712
4713
  onToolUse,
4714
+ onToolUpdate,
4713
4715
  });
4714
4716
  if (onAbortReady) onAbortReady(p2.abort);
4715
4717
  result = await p2;
@@ -4730,6 +4732,7 @@ async function ccCallStreaming(message, { store = 'cc', sessionKey, extraContext
4730
4732
  engineConfig: CONFIG.engine,
4731
4733
  onChunk,
4732
4734
  onToolUse,
4735
+ onToolUpdate,
4733
4736
  });
4734
4737
  if (onAbortReady) onAbortReady(p3.abort);
4735
4738
  result = await p3;
@@ -9255,12 +9258,22 @@ What would you like to discuss or change? When you're happy, say "approve" and I
9255
9258
  liveState.text = text;
9256
9259
  if (liveState.writer) liveState.writer({ type: 'chunk', text, segmentId });
9257
9260
  },
9258
- onToolUse: (name, input) => {
9261
+ onToolUse: (name, input, id) => {
9259
9262
  _touchCcLiveStream(liveState);
9260
- const entry = { name, input: input || {}, id: null, status: null };
9263
+ // Claude (direct) now threads a tool_use id; with an id the chip starts
9264
+ // 'pending' and can be flipped to completed/failed by onToolUpdate.
9265
+ const entry = { name, input: input || {}, id: id || null, status: id ? 'pending' : null };
9261
9266
  toolUses.push(entry);
9262
9267
  liveState.tools.push(entry);
9263
- if (liveState.writer) liveState.writer({ type: 'tool', name, input: _lightToolInput(input), id: null });
9268
+ if (liveState.writer) liveState.writer({ type: 'tool', name, input: _lightToolInput(input), id: id || null });
9269
+ },
9270
+ onToolUpdate: (id, status) => {
9271
+ _touchCcLiveStream(liveState);
9272
+ // toolUses and liveState.tools share entry references — patch once so a
9273
+ // reconnect replays the resolved (green/red) state, not just pending.
9274
+ const entry = toolUses.find((e) => e && e.id === id);
9275
+ if (entry) entry.status = status;
9276
+ if (liveState.writer) liveState.writer({ type: 'tool-update', id, status });
9264
9277
  },
9265
9278
  });
9266
9279
  }
@@ -9673,7 +9686,12 @@ What would you like to discuss or change? When you're happy, say "approve" and I
9673
9686
  reconnectDone();
9674
9687
  });
9675
9688
  for (const tool of live.tools || []) {
9676
- writeCcEvent({ type: 'tool', name: tool.name, input: _lightToolInput(tool.input) });
9689
+ writeCcEvent({ type: 'tool', name: tool.name, input: _lightToolInput(tool.input), id: tool.id || null });
9690
+ // Replay the resolved chip state (green check / red X) for tools that
9691
+ // already finished, so a reconnect doesn't stick on the pending dot.
9692
+ if (tool.id && tool.status && tool.status !== 'pending') {
9693
+ writeCcEvent({ type: 'tool-update', id: tool.id, status: tool.status });
9694
+ }
9677
9695
  }
9678
9696
  if (live.text) writeCcEvent({ type: 'chunk', text: live.text });
9679
9697
  if (live.donePayload) {
package/engine/llm.js CHANGED
@@ -507,6 +507,7 @@ function _createStreamAccumulator({
507
507
  maxTextLength = 0,
508
508
  onChunk = null,
509
509
  onToolUse = null,
510
+ onToolUpdate = null,
510
511
  onTaskComplete = null,
511
512
  onTerminalResult = null,
512
513
  onThinking = null,
@@ -574,12 +575,21 @@ function _createStreamAccumulator({
574
575
  onTerminalResult();
575
576
  }
576
577
  },
577
- pushToolUse(name, input) {
578
+ pushToolUse(name, input, id = null) {
578
579
  if (!name) return;
579
- const toolUse = { name, input: input || {} };
580
+ const toolUse = { name, input: input || {}, id: id || null };
580
581
  toolUses.push(toolUse);
581
582
  sawToolSinceText = true;
582
- if (onToolUse) onToolUse(toolUse.name, toolUse.input);
583
+ if (onToolUse) onToolUse(toolUse.name, toolUse.input, toolUse.id);
584
+ },
585
+ updateToolUse(id, status) {
586
+ // Runtime-agnostic tool-completion signal. Adapters whose stream carries
587
+ // a per-tool result event (Claude's tool_result, Copilot's
588
+ // tool_call_update) call this to flip a previously-pushed chip from the
589
+ // neutral pending dot to a green check / red X. Adapters without such a
590
+ // signal simply never call it and the chip stays pending.
591
+ if (!id || !onToolUpdate) return;
592
+ onToolUpdate(id, status);
583
593
  },
584
594
  toolUseAlreadySeen(name, input) {
585
595
  if (!name) return false;
@@ -869,7 +879,7 @@ function callLLM(promptText, sysPromptText, opts = {}) {
869
879
  function callLLMStreaming(promptText, sysPromptText, opts = {}) {
870
880
  const {
871
881
  timeout = 120000, label = 'llm', maxTurns = 1, allowedTools = '',
872
- sessionId = null, onChunk = () => {}, onToolUse = null,
882
+ sessionId = null, onChunk = () => {}, onToolUse = null, onToolUpdate = null,
873
883
  effort = null, direct = false,
874
884
  model: modelOverride, cli: cliOverride, engineConfig,
875
885
  maxBudget, bare, fallbackModel,
@@ -911,6 +921,7 @@ function callLLMStreaming(promptText, sysPromptText, opts = {}) {
911
921
  maxLineBufferBytes: ENGINE_DEFAULTS.maxLlmLineBufferBytes,
912
922
  onChunk,
913
923
  onToolUse,
924
+ onToolUpdate,
914
925
  // Terminal text from the runtime adapter signals the LLM has logically
915
926
  // completed — kick the drain timer so we don't block on a delayed
916
927
  // 'exit'/'close' when an inherited pipe keeps the parent's FDs open.
@@ -636,8 +636,9 @@ function parseError(rawOutput) {
636
636
  // tracking) and translates Claude event shapes into ctx callbacks.
637
637
  //
638
638
  // `ctx` shape (provided by accumulator):
639
- // maxTextLength, pushText(value), pushToolUse(name, input),
640
- // notifyThinking(), notifyTaskComplete(summary, success),
639
+ // maxTextLength, pushText(value), pushToolUse(name, input, id),
640
+ // updateToolUse(id, status), notifyThinking(),
641
+ // notifyTaskComplete(summary, success),
641
642
  // setUsage(usage), setSessionId(id), setText(value),
642
643
  // toolUseAlreadySeen(name, input)
643
644
 
@@ -743,11 +744,27 @@ function createStreamConsumer(ctx) {
743
744
  } else if (THINKING_BLOCK_TYPES.has(block?.type)) {
744
745
  ctx.notifyThinking();
745
746
  } else if (block?.type === 'tool_use' && block.name) {
746
- ctx.pushToolUse(block.name, block.input || {});
747
+ // Thread the tool_use id so the dashboard can flip this chip from
748
+ // pending → completed/failed when the matching tool_result lands.
749
+ ctx.pushToolUse(block.name, block.input || {}, block.id);
747
750
  }
748
751
  }
749
752
  if (assistantText) ctx.pushText(assistantText);
750
753
  }
754
+
755
+ if (obj.type === 'user' && Array.isArray(obj.message?.content)) {
756
+ // Claude reports tool execution results in a subsequent `user` turn:
757
+ // each block is {type:'tool_result', tool_use_id, is_error, content}.
758
+ // Flip the previously-pushed chip to completed (success) or failed
759
+ // (is_error). This is the Claude-direct analogue of Copilot's ACP
760
+ // tool_call_update; engine/llm.js stays runtime-agnostic — the chip
761
+ // turns green/red only because this adapter calls ctx.updateToolUse.
762
+ for (const block of obj.message.content) {
763
+ if (block?.type === 'tool_result' && block.tool_use_id) {
764
+ ctx.updateToolUse(block.tool_use_id, block.is_error ? 'failed' : 'completed');
765
+ }
766
+ }
767
+ }
751
768
  }
752
769
 
753
770
  function reset() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2213",
3
+ "version": "0.1.2214",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"