an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
fix(office): word-wrap agent thought/tool cards instead of single-line truncate
Chaitanya Giri7f932255363d
diff --git a/src/renderer/src/scene/office/ThoughtBubble.ts b/src/renderer/src/scene/office/ThoughtBubble.tsindex d1fe4b1e..100898f3 100644--- a/src/renderer/src/scene/office/ThoughtBubble.ts+++ b/src/renderer/src/scene/office/ThoughtBubble.ts@@ -8,7 +8,7 @@ import { toolIcon } from './ToolBubble';// trailing-puff tail — the visual shorthand for "thinking". Built to DESIGN.md:// integer pixels, hard 1px ink outline, limited palette, no soft shadows.//-// Shares ToolBubble's fade state machine and text truncation so behaviour reads+// Shares ToolBubble's fade state machine and word-wrapping so behaviour reads// consistently; the differences are the look (cloud + tail, light fill) and that// it stays put until the action changes (no auto-linger while the agent works).@@ -26,6 +26,13 @@ const FADE_IN_DURATION = 0.15;const FADE_OUT_DURATION = 0.3;const LINGER_DURATION = 1.2; // only used when hide() is requestedconst DOTS_CYCLE_SPEED = 0.45;+// Word-wrap width in the inner (unscaled) space — the inner container renders at+// RENDER_SCALE, so the on-screen cap is MAX_WIDTH. breakWords splits unbroken+// tokens (long paths/hashes) that would otherwise still spill past the cloud.+const WRAP_WIDTH = MAX_WIDTH / RENDER_SCALE - PADDING_X * 2;+// Hard cap on raw characters so a pathological action string wraps to a few+// lines instead of a runaway-tall cloud (~4 lines at this width).+const MAX_CHARS = 160;type BubbleState = 'hidden' | 'fading-in' | 'visible' | 'lingering' | 'fading-out';@@ -62,7 +69,15 @@ export class ThoughtBubble {this.bg = new Graphics();this.label = new Text({text: '',- style: { fontSize: FONT_SIZE, fill: TEXT_COLOR, fontFamily: 'monospace' }+ style: {+ fontSize: FONT_SIZE,+ fill: TEXT_COLOR,+ fontFamily: 'monospace',+ align: 'left',+ wordWrap: true,+ wordWrapWidth: WRAP_WIDTH,+ breakWords: true+ }});this.label.x = PADDING_X;this.label.y = PADDING_Y;@@ -81,14 +96,12 @@ export class ThoughtBubble {this.label.text = '.';} else {const display = tool ? `${toolIcon(tool)} ${text}` : text;- this.label.text = display;- const maxTextW = MAX_WIDTH / RENDER_SCALE - PADDING_X * 2;- let iterations = 0;- let truncated = display;- while (truncated.length > 3 && this.label.width > maxTextW && iterations++ < 60) {- truncated = truncated.slice(0, -2) + '…';- this.label.text = truncated;- }+ // Word-wrap (style.wordWrap) handles the horizontal fit, so the card can no+ // longer overflow; we only cap the raw length so a very long action wraps to+ // a few lines rather than a wall of text.+ this.label.text = display.length > MAX_CHARS+ ? display.slice(0, MAX_CHARS - 1).trimEnd() + '…'+ : display;}this.redraw();this.reveal();diff --git a/src/renderer/src/scene/office/ToolBubble.ts b/src/renderer/src/scene/office/ToolBubble.tsindex adec29d7..1e03a8c5 100644--- a/src/renderer/src/scene/office/ToolBubble.ts+++ b/src/renderer/src/scene/office/ToolBubble.ts@@ -33,6 +33,12 @@ const FADE_IN_DURATION = 0.15;const FADE_OUT_DURATION = 0.3;const LINGER_DURATION = 2.0;const DOTS_CYCLE_SPEED = 0.5;+// Word-wrap width in the inner (unscaled) space — the inner renders at+// RENDER_SCALE, so the on-screen cap is MAX_WIDTH. breakWords splits unbroken+// tokens (long paths/hashes) that would otherwise still spill past the bubble.+const WRAP_WIDTH = MAX_WIDTH / RENDER_SCALE - PADDING_X * 2;+// Cap raw chars so a long target wraps to a few lines, not a runaway-tall bubble.+const MAX_CHARS = 150;type BubbleState = 'hidden' | 'fading-in' | 'visible' | 'lingering' | 'fading-out';@@ -68,7 +74,15 @@ export class ToolBubble {this.bg = new Graphics();this.label = new Text({text: '',- style: { fontSize: FONT_SIZE, fill: TEXT_COLOR, fontFamily: 'monospace' },+ style: {+ fontSize: FONT_SIZE,+ fill: TEXT_COLOR,+ fontFamily: 'monospace',+ align: 'left',+ wordWrap: true,+ wordWrapWidth: WRAP_WIDTH,+ breakWords: true,+ },});this.label.x = PADDING_X;this.label.y = PADDING_Y;@@ -87,16 +101,11 @@ export class ToolBubble {this.label.text = '.';} else {const displayText = target ? `${icon} ${target}` : icon;- this.label.text = displayText;- const maxTextW = MAX_WIDTH / RENDER_SCALE - PADDING_X * 2;- if (this.label.width > maxTextW) {- let truncated = displayText;- let iterations = 0;- while (truncated.length > 3 && this.label.width > maxTextW && iterations++ < 50) {- truncated = truncated.slice(0, -2) + '…';- this.label.text = truncated;- }- }+ // Word-wrap (style.wordWrap) handles the horizontal fit, so the bubble can no+ // longer overflow; we only cap the raw length to keep it a few lines tall.+ this.label.text = displayText.length > MAX_CHARS+ ? displayText.slice(0, MAX_CHARS - 1).trimEnd() + '…'+ : displayText;}this.redrawBg();@@ -108,16 +117,10 @@ export class ToolBubble {showText(text: string): void {this.isThinking = false;const display = text || '…';- this.label.text = display;- const maxTextW = MAX_WIDTH / RENDER_SCALE - PADDING_X * 2;- if (this.label.width > maxTextW) {- let truncated = display;- let iterations = 0;- while (truncated.length > 3 && this.label.width > maxTextW && iterations++ < 60) {- truncated = truncated.slice(0, -2) + '…';- this.label.text = truncated;- }- }+ // Word-wrap handles the horizontal fit; cap raw length to bound the height.+ this.label.text = display.length > MAX_CHARS+ ? display.slice(0, MAX_CHARS - 1).trimEnd() + '…'+ : display;this.redrawBg();this.reveal();}