@dreb/coding-agent 2.30.0 → 2.30.1

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.
@@ -30,7 +30,7 @@ import { getChangelogPath, getNewEntries, parseChangelog } from "../../utils/cha
30
30
  import { copyToClipboard } from "../../utils/clipboard.js";
31
31
  import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
32
32
  import { parseGitUrl } from "../../utils/git.js";
33
- import { extractCopyableText, getMessagePreview, getMessageRoleLabel } from "../../utils/message-text.js";
33
+ import { extractCopyableText, extractThinkingText, getMessagePreview, getMessageRoleLabel, toSingleLinePreview, } from "../../utils/message-text.js";
34
34
  import { ensureTool } from "../../utils/tools-manager.js";
35
35
  import { ArminComponent } from "./components/armin.js";
36
36
  import { AssistantMessageComponent } from "./components/assistant-message.js";
@@ -3833,12 +3833,26 @@ export class InteractiveMode {
3833
3833
  this.showStatus("No messages to copy");
3834
3834
  return;
3835
3835
  }
3836
- // Build items from session messages
3837
- const items = messages.map((msg, index) => ({
3838
- index,
3839
- roleLabel: getMessageRoleLabel(msg),
3840
- preview: getMessagePreview(msg),
3841
- }));
3836
+ // Build items from session messages. Each assistant message that carries
3837
+ // thinking gets an extra "Thinking" row listed directly ABOVE its message
3838
+ // (matching the TUI's thinking-above-answer presentation), so when both are
3839
+ // selected the reasoning lands at the top of the combined copy.
3840
+ const items = [];
3841
+ for (const msg of messages) {
3842
+ const thinking = extractThinkingText(msg);
3843
+ if (thinking) {
3844
+ items.push({
3845
+ roleLabel: "Thinking",
3846
+ preview: toSingleLinePreview(thinking),
3847
+ text: thinking,
3848
+ });
3849
+ }
3850
+ items.push({
3851
+ roleLabel: getMessageRoleLabel(msg),
3852
+ preview: getMessagePreview(msg),
3853
+ text: extractCopyableText(msg),
3854
+ });
3855
+ }
3842
3856
  // Hide buddy while selector is open to free vertical space
3843
3857
  const hadBuddy = this.buddyComponent !== null;
3844
3858
  if (hadBuddy) {
@@ -3851,20 +3865,18 @@ export class InteractiveMode {
3851
3865
  const overhead = 12;
3852
3866
  const maxVisible = Math.max(3, Math.min(15, terminalRows - overhead));
3853
3867
  this.showSelector((done) => {
3854
- const selector = new CopySelectorComponent(items, async (selectedIndices) => {
3868
+ const selector = new CopySelectorComponent(items, async (selectedPositions) => {
3855
3869
  done();
3856
3870
  // Restore buddy
3857
3871
  if (hadBuddy)
3858
3872
  this.renderWidgets();
3859
3873
  this.ui.requestRender();
3860
- if (selectedIndices.length === 0) {
3874
+ if (selectedPositions.length === 0) {
3861
3875
  this.showWarning("No messages selected");
3862
3876
  return;
3863
3877
  }
3864
- // Extract text from selected messages in chronological order
3865
- const selectedTexts = selectedIndices
3866
- .map((i) => extractCopyableText(messages[i]))
3867
- .filter((text) => text.length > 0);
3878
+ // Extract pre-built text from selected rows in chronological (list) order
3879
+ const selectedTexts = selectedPositions.map((pos) => items[pos].text).filter((text) => text.length > 0);
3868
3880
  if (selectedTexts.length === 0) {
3869
3881
  this.showWarning("Selected messages have no copyable text");
3870
3882
  return;