Repository navigation
feat(kimi-code): two-line collapsed tool cards with width-aware headers #3539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
b2d1ce8
b090435
6870f34
2f1ee91
44d8107
a332a8e
987e4c3
261f520
ac68756
779b39d
7f3a38f
c24562b
b5c0edf
481944d
8c8a170
261a440
341ebbb
dfd7697
d94c8f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@moonshot-ai/kimi-code": patch | ||
| --- | ||
|
|
||
| Collapse finished tool calls in the transcript to a header plus one marked outcome row: short output is shown whole, hidden output is counted (`N more lines`, `+N more`) and revealed by `Ctrl+O`, which the footer advertises while it is available. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,8 @@ export class ShellRunComponent extends Container { | |
| private backgrounded = false; | ||
| private disposed = false; | ||
| private expanded = false; | ||
| // Whether the collapsed running tail leaves rows (or a capped buffer) behind; refreshed by renderText(). | ||
| private runningHidesRows = false; | ||
| private readonly startedAt = Date.now(); | ||
| private timer: ReturnType<typeof setInterval> | undefined; | ||
|
|
||
|
|
@@ -74,6 +76,25 @@ export class ShellRunComponent extends Container { | |
| this.flush(); | ||
| } | ||
|
|
||
| /** | ||
| * Whether ctrl+o would change the card: a running tail with earlier rows | ||
| * (or a capped buffer) behind it, or a finished preview cut to its row cap. | ||
| * Drives the footer's ctrl+o hint. | ||
| */ | ||
| hasHiddenContent(): boolean { | ||
| if (this.disposed || this.backgrounded) return false; | ||
| if (this.running) return this.runningHidesRows; | ||
| // More physical lines than the collapsed cap is hidden for certain, even | ||
| // for a card that finished while already expanded; a wrapped overflow | ||
| // shows up once a collapsed render has recorded it. | ||
| return ( | ||
| this.finalOutput.split('\n').length > SHELL_OUTPUT_PREVIEW_LINES || | ||
|
Comment on lines
+91
to
+95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| this.children.some( | ||
| (child) => child instanceof TruncatedOutputComponent && child.wasTruncated(), | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| finishBackgrounded(): void { | ||
| if (this.disposed || !this.running) return; | ||
| this.running = false; | ||
|
|
@@ -155,6 +176,8 @@ export class ShellRunComponent extends Container { | |
| const elapsed = Math.floor((Date.now() - this.startedAt) / 1000); | ||
| const dim = (s: string): string => currentTheme.fg('textDim', s); | ||
| const trimmed = sanitizeShellOutput(this.combined).trimEnd(); | ||
| const lineCount = trimmed.length === 0 ? 0 : trimmed.split('\n').length; | ||
| this.runningHidesRows = this.combinedTruncated || lineCount > RUNNING_TAIL_LINES; | ||
| let body: string; | ||
| let extra = 0; | ||
| if (trimmed.length === 0) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.