@trops/dash-core 0.1.388 → 0.1.390

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.
@@ -51545,6 +51545,36 @@ const cliController$2 = {
51545
51545
  sessions.set(widgetUuid, capturedSessionId);
51546
51546
  }
51547
51547
 
51548
+ // Claude Code's stream-json emits complete-message envelopes
51549
+ // ({"type": "assistant", "message": {content: [...]}}) rather
51550
+ // than the granular content_block_start/delta/stop events used
51551
+ // by the raw Anthropic streaming API. We handle both shapes —
51552
+ // the complete-message path is the one that actually fires in
51553
+ // CLI mode today (the content_block_* branches remain in case a
51554
+ // future CLI version or --include-partial-messages flag brings
51555
+ // back the granular form).
51556
+ if (parsed.type === "assistant" && parsed.message?.content) {
51557
+ for (const block of parsed.message.content) {
51558
+ if (block?.type === "text" && block.text) {
51559
+ // Emit as a single delta so the renderer sees the text.
51560
+ // (Granular deltas aren't produced in this mode.)
51561
+ safeSend(win, LLM_STREAM_DELTA$2, {
51562
+ requestId,
51563
+ text: block.text,
51564
+ });
51565
+ } else if (block?.type === "tool_use" && block.id && block.name) {
51566
+ safeSend(win, LLM_STREAM_TOOL_CALL$2, {
51567
+ requestId,
51568
+ toolUseId: block.id,
51569
+ toolName: block.name,
51570
+ serverName: "Claude Code",
51571
+ input: block.input || {},
51572
+ });
51573
+ }
51574
+ }
51575
+ continue;
51576
+ }
51577
+
51548
51578
  // Map CLI stream-json events to IPC events
51549
51579
  if (parsed.type === "content_block_delta") {
51550
51580
  if (parsed.delta?.type === "text_delta" && parsed.delta.text) {
@@ -51566,24 +51596,38 @@ const cliController$2 = {
51566
51596
  activeToolCalls.set(parsed.index, {
51567
51597
  toolUseId: toolBlock.id,
51568
51598
  toolName: toolBlock.name,
51599
+ // Seed with any input already present on the start event.
51600
+ seedInput: toolBlock.input || {},
51569
51601
  partialInput: "",
51570
51602
  });
51571
- safeSend(win, LLM_STREAM_TOOL_CALL$2, {
51572
- requestId,
51573
- toolUseId: toolBlock.id,
51574
- toolName: toolBlock.name,
51575
- serverName: "Claude Code",
51576
- input: toolBlock.input || {},
51577
- });
51603
+ // Emission deferred to content_block_stop so the renderer
51604
+ // receives the fully-parsed input (the Anthropic streaming
51605
+ // format delivers input as incremental JSON deltas).
51578
51606
  }
51579
51607
  } else if (parsed.type === "content_block_stop") {
51580
- // Tool call completed — try to parse the accumulated input
51608
+ // Tool call completed — parse accumulated input and emit the
51609
+ // single LLM_STREAM_TOOL_CALL for this tool with the real input.
51581
51610
  const tc = activeToolCalls.get(parsed.index);
51582
- if (tc && tc.partialInput) {
51583
- try {
51584
- tc.finalInput = JSON.parse(tc.partialInput);
51585
- } catch {
51586
- tc.finalInput = tc.partialInput;
51611
+ if (tc) {
51612
+ if (tc.partialInput) {
51613
+ try {
51614
+ tc.finalInput = JSON.parse(tc.partialInput);
51615
+ } catch {
51616
+ tc.finalInput = tc.partialInput;
51617
+ }
51618
+ }
51619
+ const resolvedInput =
51620
+ tc.finalInput !== undefined
51621
+ ? tc.finalInput
51622
+ : tc.seedInput || {};
51623
+ if (tc.toolUseId && tc.toolName) {
51624
+ safeSend(win, LLM_STREAM_TOOL_CALL$2, {
51625
+ requestId,
51626
+ toolUseId: tc.toolUseId,
51627
+ toolName: tc.toolName,
51628
+ serverName: "Claude Code",
51629
+ input: resolvedInput,
51630
+ });
51587
51631
  }
51588
51632
  }
51589
51633
  } else if (parsed.type === "message_stop") {