@kenkaiiii/ggcoder 4.3.217 → 4.3.218

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.
Files changed (126) hide show
  1. package/dist/cli/command-routing.d.ts +28 -0
  2. package/dist/cli/command-routing.d.ts.map +1 -0
  3. package/dist/cli/command-routing.js +51 -0
  4. package/dist/cli/command-routing.js.map +1 -0
  5. package/dist/cli/command-routing.test.d.ts +2 -0
  6. package/dist/cli/command-routing.test.d.ts.map +1 -0
  7. package/dist/cli/command-routing.test.js +59 -0
  8. package/dist/cli/command-routing.test.js.map +1 -0
  9. package/dist/cli.d.ts +1 -1
  10. package/dist/cli.d.ts.map +1 -1
  11. package/dist/cli.js +46 -103
  12. package/dist/cli.js.map +1 -1
  13. package/dist/core/agent-session-compaction.test.d.ts +2 -0
  14. package/dist/core/agent-session-compaction.test.d.ts.map +1 -0
  15. package/dist/core/agent-session-compaction.test.js +121 -0
  16. package/dist/core/agent-session-compaction.test.js.map +1 -0
  17. package/dist/core/agent-session.d.ts.map +1 -1
  18. package/dist/core/agent-session.js +6 -7
  19. package/dist/core/agent-session.js.map +1 -1
  20. package/dist/core/goal-store.d.ts +9 -0
  21. package/dist/core/goal-store.d.ts.map +1 -1
  22. package/dist/core/goal-store.js +24 -0
  23. package/dist/core/goal-store.js.map +1 -1
  24. package/dist/core/goal-worker.d.ts +7 -0
  25. package/dist/core/goal-worker.d.ts.map +1 -1
  26. package/dist/core/goal-worker.js +62 -20
  27. package/dist/core/goal-worker.js.map +1 -1
  28. package/dist/core/goal-worker.test.js +92 -2
  29. package/dist/core/goal-worker.test.js.map +1 -1
  30. package/dist/core/goal-worktree.d.ts +33 -0
  31. package/dist/core/goal-worktree.d.ts.map +1 -0
  32. package/dist/core/goal-worktree.js +67 -0
  33. package/dist/core/goal-worktree.js.map +1 -0
  34. package/dist/core/goal-worktree.test.d.ts +2 -0
  35. package/dist/core/goal-worktree.test.d.ts.map +1 -0
  36. package/dist/core/goal-worktree.test.js +101 -0
  37. package/dist/core/goal-worktree.test.js.map +1 -0
  38. package/dist/core/repomap-budget.d.ts +7 -0
  39. package/dist/core/repomap-budget.d.ts.map +1 -0
  40. package/dist/core/repomap-budget.js +10 -0
  41. package/dist/core/repomap-budget.js.map +1 -0
  42. package/dist/core/repomap-budget.test.d.ts +2 -0
  43. package/dist/core/repomap-budget.test.d.ts.map +1 -0
  44. package/dist/core/repomap-budget.test.js +26 -0
  45. package/dist/core/repomap-budget.test.js.map +1 -0
  46. package/dist/system-prompt.js +2 -2
  47. package/dist/system-prompt.js.map +1 -1
  48. package/dist/system-prompt.test.js +2 -2
  49. package/dist/system-prompt.test.js.map +1 -1
  50. package/dist/tools/goals.d.ts.map +1 -1
  51. package/dist/tools/goals.js +30 -26
  52. package/dist/tools/goals.js.map +1 -1
  53. package/dist/tools/goals.test.js +47 -1
  54. package/dist/tools/goals.test.js.map +1 -1
  55. package/dist/ui/App.d.ts +11 -381
  56. package/dist/ui/App.d.ts.map +1 -1
  57. package/dist/ui/App.js +61 -554
  58. package/dist/ui/App.js.map +1 -1
  59. package/dist/ui/app-items.d.ts +207 -0
  60. package/dist/ui/app-items.d.ts.map +1 -0
  61. package/dist/ui/app-items.js +2 -0
  62. package/dist/ui/app-items.js.map +1 -0
  63. package/dist/ui/app-state-persistence.test.js +4 -1
  64. package/dist/ui/app-state-persistence.test.js.map +1 -1
  65. package/dist/ui/chat-layout-pinning.test.js +2 -1
  66. package/dist/ui/chat-layout-pinning.test.js.map +1 -1
  67. package/dist/ui/components/ToolUseLoader.d.ts +3 -1
  68. package/dist/ui/components/ToolUseLoader.d.ts.map +1 -1
  69. package/dist/ui/components/ToolUseLoader.js +2 -2
  70. package/dist/ui/components/ToolUseLoader.js.map +1 -1
  71. package/dist/ui/goal-events.test.js +2 -1
  72. package/dist/ui/goal-events.test.js.map +1 -1
  73. package/dist/ui/goal-lifecycle-orchestration.test.js +20 -1
  74. package/dist/ui/goal-lifecycle-orchestration.test.js.map +1 -1
  75. package/dist/ui/goal-progress.d.ts +31 -0
  76. package/dist/ui/goal-progress.d.ts.map +1 -0
  77. package/dist/ui/goal-progress.js +152 -0
  78. package/dist/ui/goal-progress.js.map +1 -0
  79. package/dist/ui/item-helpers.d.ts +24 -0
  80. package/dist/ui/item-helpers.d.ts.map +1 -0
  81. package/dist/ui/item-helpers.js +96 -0
  82. package/dist/ui/item-helpers.js.map +1 -0
  83. package/dist/ui/layout-decisions.d.ts +113 -0
  84. package/dist/ui/layout-decisions.d.ts.map +1 -0
  85. package/dist/ui/layout-decisions.js +173 -0
  86. package/dist/ui/layout-decisions.js.map +1 -0
  87. package/dist/ui/prompt-routing.d.ts +29 -0
  88. package/dist/ui/prompt-routing.d.ts.map +1 -0
  89. package/dist/ui/prompt-routing.js +105 -0
  90. package/dist/ui/prompt-routing.js.map +1 -0
  91. package/dist/ui/queued-message.test.js +1 -1
  92. package/dist/ui/queued-message.test.js.map +1 -1
  93. package/dist/ui/render.d.ts +1 -0
  94. package/dist/ui/render.d.ts.map +1 -1
  95. package/dist/ui/render.js +1 -0
  96. package/dist/ui/render.js.map +1 -1
  97. package/dist/ui/scroll-stabilization.test.js +1 -1
  98. package/dist/ui/scroll-stabilization.test.js.map +1 -1
  99. package/dist/ui/slash-command-images.test.js +1 -1
  100. package/dist/ui/slash-command-images.test.js.map +1 -1
  101. package/dist/ui/terminal-history-format.d.ts +41 -0
  102. package/dist/ui/terminal-history-format.d.ts.map +1 -0
  103. package/dist/ui/terminal-history-format.js +131 -0
  104. package/dist/ui/terminal-history-format.js.map +1 -0
  105. package/dist/ui/terminal-history-spacing.d.ts +3 -0
  106. package/dist/ui/terminal-history-spacing.d.ts.map +1 -0
  107. package/dist/ui/terminal-history-spacing.js +28 -0
  108. package/dist/ui/terminal-history-spacing.js.map +1 -0
  109. package/dist/ui/terminal-history-status-renderers.d.ts +16 -0
  110. package/dist/ui/terminal-history-status-renderers.d.ts.map +1 -0
  111. package/dist/ui/terminal-history-status-renderers.js +83 -0
  112. package/dist/ui/terminal-history-status-renderers.js.map +1 -0
  113. package/dist/ui/terminal-history.d.ts.map +1 -1
  114. package/dist/ui/terminal-history.js +17 -233
  115. package/dist/ui/terminal-history.js.map +1 -1
  116. package/dist/ui/terminal-history.test.js +2 -1
  117. package/dist/ui/terminal-history.test.js.map +1 -1
  118. package/dist/ui/thinking-level-cycle.test.js +7 -1
  119. package/dist/ui/thinking-level-cycle.test.js.map +1 -1
  120. package/dist/ui/thinking-level.d.ts +5 -0
  121. package/dist/ui/thinking-level.d.ts.map +1 -0
  122. package/dist/ui/thinking-level.js +30 -0
  123. package/dist/ui/thinking-level.js.map +1 -0
  124. package/dist/ui/tui-history-parity.test.js +4 -3
  125. package/dist/ui/tui-history-parity.test.js.map +1 -1
  126. package/package.json +3 -3
@@ -0,0 +1,131 @@
1
+ import chalk from "chalk";
2
+ import stringWidth from "string-width";
3
+ import wrapAnsi from "wrap-ansi";
4
+ export const RESPONSE_LEFT_PADDING = " ";
5
+ export const MAX_OUTPUT_LINES = 4;
6
+ export const USER_MESSAGE_BACKGROUND = "#374151";
7
+ export const USER_MESSAGE_PREFIX = "> ";
8
+ export const USER_MESSAGE_TOP_FILL = "▄";
9
+ export const USER_MESSAGE_BOTTOM_FILL = "▀";
10
+ export const USER_MESSAGE_HORIZONTAL_PADDING = 2;
11
+ export const ANSI_ESCAPE_PATTERN = new RegExp(String.raw `\u001B\[[0-?]*[ -/]*[@-~]`, "gu");
12
+ export const SINGLE_LEFT_BORDER = "│";
13
+ export const ROUND_BORDER = {
14
+ topLeft: "╭",
15
+ topRight: "╮",
16
+ bottomLeft: "╰",
17
+ bottomRight: "╯",
18
+ horizontal: "─",
19
+ vertical: "│",
20
+ };
21
+ export function formatHistoryWrite(output, options) {
22
+ const trimmed = output.replace(/\n+$/u, "");
23
+ if (trimmed.length === 0)
24
+ return "";
25
+ const leading = options.leadingSeparator ? "\n" : "";
26
+ const trailing = options.trailingBlankLine ? "\n\n" : "\n";
27
+ return `${leading}${trimmed}${trailing}`;
28
+ }
29
+ export function normalizeStatusText(text) {
30
+ return text.replace(/\\n/g, "\n").replace(/^\n+|\n+$/g, "");
31
+ }
32
+ export function renderRoundBorderBox(lines, context, borderColor) {
33
+ const longestLineWidth = Math.max(0, ...lines.map((lineText) => stringWidth(stripAnsi(lineText))));
34
+ const maxFrameWidth = Math.max(4, context.columns - stringWidth(RESPONSE_LEFT_PADDING));
35
+ const frameWidth = Math.max(4, Math.min(maxFrameWidth, longestLineWidth + 4));
36
+ const contentWidth = Math.max(1, frameWidth - 4);
37
+ const horizontal = color(borderColor, ROUND_BORDER.horizontal.repeat(frameWidth - 2));
38
+ const top = `${color(borderColor, ROUND_BORDER.topLeft)}${horizontal}${color(borderColor, ROUND_BORDER.topRight)}`;
39
+ const bottom = `${color(borderColor, ROUND_BORDER.bottomLeft)}${horizontal}${color(borderColor, ROUND_BORDER.bottomRight)}`;
40
+ const rows = lines.flatMap((lineText) => wrapBoxLine(lineText, contentWidth));
41
+ const body = rows.map((lineText) => {
42
+ const fillWidth = Math.max(0, contentWidth - stringWidth(stripAnsi(lineText)));
43
+ return `${color(borderColor, ROUND_BORDER.vertical)} ${lineText}${" ".repeat(fillWidth)} ${color(borderColor, ROUND_BORDER.vertical)}`;
44
+ });
45
+ return indent([top, ...body, bottom].join("\n"), RESPONSE_LEFT_PADDING);
46
+ }
47
+ export function renderLeftBorderBox(lines, borderColor, options = {}) {
48
+ const padding = " ".repeat(options.padding ?? 1);
49
+ return indent(lines
50
+ .map((lineText) => `${color(borderColor, SINGLE_LEFT_BORDER)}${padding}${lineText}`)
51
+ .join("\n"), RESPONSE_LEFT_PADDING);
52
+ }
53
+ export function stripAnsi(value) {
54
+ return value.replace(ANSI_ESCAPE_PATTERN, "");
55
+ }
56
+ export function block(lines) {
57
+ return lines.filter((lineText) => lineText.length > 0).join("\n");
58
+ }
59
+ export function wrapPlain(text, width) {
60
+ return wrapAnsi(text, Math.max(10, width), { hard: true, wordWrap: true });
61
+ }
62
+ export function wrapBoxLine(text, width) {
63
+ if (text.length === 0)
64
+ return [""];
65
+ return wrapAnsi(text, Math.max(1, width), { hard: true, wordWrap: true, trim: false }).split("\n");
66
+ }
67
+ export function indent(text, prefix) {
68
+ return text
69
+ .split("\n")
70
+ .map((lineText) => `${prefix}${lineText}`)
71
+ .join("\n");
72
+ }
73
+ export function truncatePlain(text, width) {
74
+ const max = Math.max(1, width);
75
+ if (stringWidth(text) <= max)
76
+ return text;
77
+ let result = "";
78
+ for (const char of text) {
79
+ if (stringWidth(`${result}${char}…`) > max)
80
+ break;
81
+ result += char;
82
+ }
83
+ return `${result}…`;
84
+ }
85
+ export function color(hex, text, bold = false) {
86
+ const styled = chalk.hex(hex)(text);
87
+ return bold ? chalk.bold(styled) : styled;
88
+ }
89
+ export function userChipSegment(text, foregroundHex, bold = false) {
90
+ const styled = chalk.bgHex(USER_MESSAGE_BACKGROUND).hex(foregroundHex)(text);
91
+ return bold ? chalk.bold(styled) : styled;
92
+ }
93
+ export function dim(context, text) {
94
+ return color(context.theme.textDim, text);
95
+ }
96
+ export function formatDuration(ms) {
97
+ const totalSec = Math.round(ms / 1000);
98
+ if (totalSec < 60)
99
+ return `${totalSec}s`;
100
+ const min = Math.floor(totalSec / 60);
101
+ const sec = totalSec % 60;
102
+ return sec > 0 ? `${min}m ${sec}s` : `${min}m`;
103
+ }
104
+ export function formatCompactTokens(n) {
105
+ if (n >= 1_000_000)
106
+ return `${(n / 1_000_000).toFixed(1)}M`;
107
+ if (n >= 1_000)
108
+ return `${(n / 1_000).toFixed(1)}k`;
109
+ return String(n);
110
+ }
111
+ export function formatTokenCount(n) {
112
+ if (n >= 1000) {
113
+ const k = n / 1000;
114
+ return k >= 10 ? `${Math.round(k)}k` : `${k.toFixed(1)}k`;
115
+ }
116
+ return String(n);
117
+ }
118
+ export function gradientLine(text, gradient) {
119
+ let colorIndex = 0;
120
+ let result = "";
121
+ for (const char of text) {
122
+ if (char === " ") {
123
+ result += char;
124
+ continue;
125
+ }
126
+ result += chalk.hex(gradient[colorIndex % gradient.length] ?? gradient[0])(char);
127
+ colorIndex++;
128
+ }
129
+ return result;
130
+ }
131
+ //# sourceMappingURL=terminal-history-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-history-format.js","sourceRoot":"","sources":["../../src/ui/terminal-history-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,QAAQ,MAAM,WAAW,CAAC;AAGjC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AACzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,uBAAuB,GAAG,SAAS,CAAC;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AACzC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAC5C,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,2BAA2B,EAAE,IAAI,CAAC,CAAC;AAC3F,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,GAAG;IACb,UAAU,EAAE,GAAG;IACf,WAAW,EAAE,GAAG;IAChB,UAAU,EAAE,GAAG;IACf,QAAQ,EAAE,GAAG;CACL,CAAC;AAEX,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,OAAkE;IAElE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC5C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,O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I,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,MAAM,IAAI,IAAI,CAAC;YACf,SAAS;QACX,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjF,UAAU,EAAE,CAAC;IACf,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CompletedItem } from "./App.js";
2
+ export declare function isAgentSpacingKind(kind: CompletedItem["kind"]): boolean;
3
+ //# sourceMappingURL=terminal-history-spacing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-history-spacing.d.ts","sourceRoot":"","sources":["../../src/ui/terminal-history-spacing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CA0BvE"}
@@ -0,0 +1,28 @@
1
+ export function isAgentSpacingKind(kind) {
2
+ return [
3
+ "assistant",
4
+ "queued",
5
+ "goal_progress",
6
+ "tool_start",
7
+ "tool_done",
8
+ "tool_group",
9
+ "server_tool_start",
10
+ "server_tool_done",
11
+ "subagent_group",
12
+ "info",
13
+ "error",
14
+ "stopped",
15
+ "plan_transition",
16
+ "goal_agent_transition",
17
+ "thinking_transition",
18
+ "model_transition",
19
+ "theme_transition",
20
+ "plan_event",
21
+ "update_notice",
22
+ "compacting",
23
+ "compacted",
24
+ "style_pack",
25
+ "setup_hint",
26
+ ].includes(kind);
27
+ }
28
+ //# sourceMappingURL=terminal-history-spacing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-history-spacing.js","sourceRoot":"","sources":["../../src/ui/terminal-history-spacing.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,IAA2B;IAC5D,OAAO;QACL,WAAW;QACX,QAAQ;QACR,eAAe;QACf,YAAY;QACZ,WAAW;QACX,YAAY;QACZ,mBAAmB;QACnB,kBAAkB;QAClB,gBAAgB;QAChB,MAAM;QACN,OAAO;QACP,SAAS;QACT,iBAAiB;QACjB,uBAAuB;QACvB,qBAAqB;QACrB,kBAAkB;QAClB,kBAAkB;QAClB,YAAY;QACZ,eAAe;QACf,YAAY;QACZ,WAAW;QACX,YAAY;QACZ,YAAY;KACb,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { type LanguageId } from "../core/language-detector.js";
2
+ import type { TerminalHistoryContext } from "./terminal-history.js";
3
+ import { BLACK_CIRCLE } from "./constants/figures.js";
4
+ import { normalizeStatusText } from "./terminal-history-format.js";
5
+ export declare function renderStatusLine(glyph: string, text: string, context: TerminalHistoryContext, glyphColor: string, bold: boolean, textAlreadyStyled?: boolean): string;
6
+ export declare function renderGoal(title: string, workerId: string | undefined, context: TerminalHistoryContext): string;
7
+ export declare function renderError(headline: string, message: string, guidance: string, context: TerminalHistoryContext): string;
8
+ export declare function renderStylePack(added: readonly LanguageId[], showSetupHint: boolean, context: TerminalHistoryContext): string;
9
+ export declare function renderSetupHint(context: TerminalHistoryContext): string;
10
+ export declare function renderUpdateNotice(text: string, context: TerminalHistoryContext): string;
11
+ export declare function renderCompacting(context: TerminalHistoryContext): string;
12
+ export declare function renderCompacted(originalCount: number, newCount: number, tokensBefore: number, tokensAfter: number, context: TerminalHistoryContext): string;
13
+ export declare function renderPlanEvent(event: "approved" | "rejected" | "dismissed", detail: string | undefined, context: TerminalHistoryContext): string;
14
+ export declare function renderStepDone(stepNum: number, description: string, context: TerminalHistoryContext): string;
15
+ export { BLACK_CIRCLE, normalizeStatusText };
16
+ //# sourceMappingURL=terminal-history-status-renderers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-history-status-renderers.d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9B,MAAM,CAYR;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,WAAW,EAC5C,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,sBAAsB,GAC9B,MAAM,CASR;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,sBAAsB,GAC9B,MAAM,CAER;AAED,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,83 @@
1
+ import { LANGUAGE_DISPLAY_NAMES } from "../core/language-detector.js";
2
+ import { BLACK_CIRCLE } from "./constants/figures.js";
3
+ import { RESPONSE_LEFT_PADDING, block, color, dim, formatTokenCount, indent, normalizeStatusText, renderLeftBorderBox, renderRoundBorderBox, wrapPlain, } from "./terminal-history-format.js";
4
+ export function renderStatusLine(glyph, text, context, glyphColor, bold, textAlreadyStyled = false) {
5
+ const prefix = ` ${color(glyphColor, glyph, true)} `;
6
+ const continuation = " ";
7
+ const body = textAlreadyStyled
8
+ ? text
9
+ : color(bold ? glyphColor : context.theme.textDim, text, bold);
10
+ return prefixFirstLine(body, prefix, continuation);
11
+ }
12
+ export function renderGoal(title, workerId, context) {
13
+ return `${RESPONSE_LEFT_PADDING}${color(context.theme.success, "▶", true)} ${dim(context, "Goal: ")}${color(context.theme.success, title)}${workerId ? dim(context, ` · worker ${workerId}`) : ""}`;
14
+ }
15
+ export function renderError(headline, message, guidance, context) {
16
+ const lines = [color(context.theme.error, `✗ ${headline}`)];
17
+ if (message && message !== headline) {
18
+ lines.push(dim(context, indent(wrapPlain(message, context.columns - 4), " ")));
19
+ }
20
+ lines.push(dim(context, indent(wrapPlain(`→ ${guidance}`, context.columns - 4), " ")));
21
+ return indent(block(lines), RESPONSE_LEFT_PADDING);
22
+ }
23
+ export function renderStylePack(added, showSetupHint, context) {
24
+ const names = added.map((id) => LANGUAGE_DISPLAY_NAMES[id] ?? id).join(", ");
25
+ const headerLabel = added.length > 1 ? "STYLE PACKS ACTIVE" : "STYLE PACK ACTIVE";
26
+ const lines = [
27
+ `${color(context.theme.language, "◆ ", true)}${color(context.theme.language, headerLabel, true)}`,
28
+ color(context.theme.text, names, true),
29
+ ];
30
+ if (showSetupHint) {
31
+ lines.push("", `${dim(context, "Tip: run ")}${color(context.theme.language, "/setup", true)}${dim(context, " to audit this project against the active pack(s)")}`);
32
+ }
33
+ return renderRoundBorderBox(lines, context, context.theme.language);
34
+ }
35
+ export function renderSetupHint(context) {
36
+ return renderRoundBorderBox([
37
+ `${color(context.theme.language, "◆ ", true)}${color(context.theme.language, "NO STYLE PACKS DETECTED", true)}`,
38
+ dim(context, "This directory has no recognized language manifest at its root."),
39
+ "",
40
+ `${dim(context, "Tip: run ")}${color(context.theme.language, "/setup", true)}${dim(context, " to audit project hygiene or bootstrap a new project from scratch")}`,
41
+ ], context, context.theme.language);
42
+ }
43
+ export function renderUpdateNotice(text, context) {
44
+ return renderRoundBorderBox([color(context.theme.commandColor, `✨ ${text}`, true)], context, context.theme.commandColor);
45
+ }
46
+ export function renderCompacting(context) {
47
+ return renderLeftBorderBox([
48
+ `${color(context.theme.warning, "· ")}${dim(context, "Compacting conversation")}${dim(context, "...")}`,
49
+ ], context.theme.warning, { padding: 2 });
50
+ }
51
+ export function renderCompacted(originalCount, newCount, tokensBefore, tokensAfter, context) {
52
+ const reduction = tokensBefore > 0 ? Math.round((1 - tokensAfter / tokensBefore) * 100) : 0;
53
+ return renderLeftBorderBox([
54
+ `${color(context.theme.warning, "⟳ ")}${dim(context, "Conversation compacted")}`,
55
+ dim(context, ` ${originalCount} → ${newCount} messages · ${formatTokenCount(tokensBefore)} → ${formatTokenCount(tokensAfter)} tokens · ${reduction}% reduction`),
56
+ ], context.theme.warning);
57
+ }
58
+ export function renderPlanEvent(event, detail, context) {
59
+ const labels = {
60
+ approved: "Plan approved",
61
+ rejected: "Plan rejected",
62
+ dismissed: "Plan dismissed",
63
+ };
64
+ const lines = [color(context.theme.commandColor, ` ○ ${labels[event]}`, true)];
65
+ if (detail)
66
+ lines[0] += dim(context, ` — "${detail}"`);
67
+ return block(lines);
68
+ }
69
+ export function renderStepDone(stepNum, description, context) {
70
+ return `${RESPONSE_LEFT_PADDING}${color(context.theme.success, "✓", true)} ${color(context.theme.success, `Step ${stepNum} done`, true)}${description ? dim(context, ` — ${description}`) : ""}`;
71
+ }
72
+ export { BLACK_CIRCLE, normalizeStatusText };
73
+ function prefixFirstLine(text, firstPrefix, nextPrefix) {
74
+ return text
75
+ .split("\n")
76
+ .map((lineText, index) => {
77
+ if (lineText.length === 0)
78
+ return "";
79
+ return `${index === 0 ? firstPrefix : nextPrefix}${lineText}`;
80
+ })
81
+ .join("\n");
82
+ }
83
+ //# sourceMappingURL=terminal-history-status-renderers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-history-status-renderers.js","sourceRoot":"","sources":["../../src/ui/terminal-history-status-renderers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAmB,MAAM,8BAA8B,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EACL,qBAAqB,EACrB,KAAK,EACL,KAAK,EACL,GAAG,EACH,gBAAgB,EAChB,MAAM,EACN,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,GACV,MAAM,8BAA8B,CAAC;AAEtC,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,IAAY,EACZ,OAA+B,EAC/B,UAAkB,EAClB,IAAa,EACb,iBAAiB,GAAG,KAAK;IAEzB,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC;IACrD,MAAM,YAAY,GAAG,KAAK,CAAC;IAC3B,MAAM,IAAI,GAAG,iBAAiB;QAC5B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,KAAK,CAAC,IAAI,C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,wBAAgB,4BAA4B,CAAC,EAC3C,MAAuB,GACxB,GAAE,6BAAkC,GAAG,sBAAsB,CAoC7D;AAED,wBAAgB,uCAAuC,CACrD,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,sBAAsB,GAC9B,MAAM,CAiHR"}
@@ -2,12 +2,14 @@ import chalk from "chalk";
2
2
  import stringWidth from "string-width";
3
3
  import wrapAnsi from "wrap-ansi";
4
4
  import { getModel } from "../core/model-registry.js";
5
- import { LANGUAGE_DISPLAY_NAMES } from "../core/language-detector.js";
6
5
  import { BLACK_CIRCLE, RETURN_SYMBOL } from "./constants/figures.js";
7
6
  import { SPINNER_FRAMES } from "./spinner-frames.js";
8
7
  import { getUserMessageDisplayParts } from "./utils/user-message-display.js";
9
8
  import { buildToolGroupSummary, segmentsToPlainText } from "./tool-group-summary.js";
10
9
  import { renderMarkdownToAnsiLines } from "./utils/markdown-renderer.js";
10
+ import { isAgentSpacingKind } from "./terminal-history-spacing.js";
11
+ import { MAX_OUTPUT_LINES, RESPONSE_LEFT_PADDING, USER_MESSAGE_BACKGROUND, USER_MESSAGE_BOTTOM_FILL, USER_MESSAGE_HORIZONTAL_PADDING, USER_MESSAGE_PREFIX, USER_MESSAGE_TOP_FILL, block, color, dim, formatCompactTokens, formatDuration, formatHistoryWrite, gradientLine, indent, stripAnsi, truncatePlain, userChipSegment, wrapPlain, } from "./terminal-history-format.js";
12
+ import { normalizeStatusText, renderCompacted, renderCompacting, renderError, renderGoal, renderPlanEvent, renderSetupHint, renderStatusLine, renderStepDone, renderStylePack, renderUpdateNotice, } from "./terminal-history-status-renderers.js";
11
13
  const LOGO_LINES = [" ▄▀▀▀ ▄▀▀▀", " █ ▀█ █ ▀█", " ▀▄▄▀ ▀▄▄▀"];
12
14
  const GRADIENT = [
13
15
  "#60a5fa",
@@ -26,53 +28,9 @@ const GRADIENT = [
26
28
  const GAP = " ";
27
29
  const LOGO_WIDTH = 9;
28
30
  const SIDE_BY_SIDE_MIN = LOGO_WIDTH + GAP.length + 20;
29
- const MAX_OUTPUT_LINES = 4;
30
- const RESPONSE_LEFT_PADDING = " ";
31
- const USER_MESSAGE_BACKGROUND = "#374151";
32
- const USER_MESSAGE_PREFIX = "> ";
33
- const USER_MESSAGE_TOP_FILL = "▄";
34
- const USER_MESSAGE_BOTTOM_FILL = "▀";
35
- const USER_MESSAGE_HORIZONTAL_PADDING = 2;
36
- const ANSI_ESCAPE_PATTERN = new RegExp(String.raw `\u001B\[[0-?]*[ -/]*[@-~]`, "gu");
37
31
  const COMPACT_TOOLS = new Set(["read", "grep", "find", "ls", "source_path"]);
38
32
  const STATE_TOOLS = new Set(["tasks", "goals"]);
39
33
  const SERVER_STYLE_TOOLS = new Set(["web_search"]);
40
- const SINGLE_LEFT_BORDER = "│";
41
- const ROUND_BORDER = {
42
- topLeft: "╭",
43
- topRight: "╮",
44
- bottomLeft: "╰",
45
- bottomRight: "╯",
46
- horizontal: "─",
47
- vertical: "│",
48
- };
49
- function isAgentSpacingKind(kind) {
50
- return [
51
- "assistant",
52
- "queued",
53
- "goal_progress",
54
- "tool_start",
55
- "tool_done",
56
- "tool_group",
57
- "server_tool_start",
58
- "server_tool_done",
59
- "subagent_group",
60
- "info",
61
- "error",
62
- "stopped",
63
- "plan_transition",
64
- "goal_agent_transition",
65
- "thinking_transition",
66
- "model_transition",
67
- "theme_transition",
68
- "plan_event",
69
- "update_notice",
70
- "compacting",
71
- "compacted",
72
- "style_pack",
73
- "setup_hint",
74
- ].includes(kind);
75
- }
76
34
  export function createTerminalHistoryPrinter({ stream = process.stdout, } = {}) {
77
35
  const printed = new Set();
78
36
  let previousPrintedKind = null;
@@ -153,9 +111,9 @@ export function serializeCompletedItemToTerminalHistory(item, context) {
153
111
  case "duration":
154
112
  return indent(dim(context, `✻ ${item.verb} ${formatDuration(item.durationMs)}`), RESPONSE_LEFT_PADDING);
155
113
  case "plan_transition":
156
- return renderStatusLine("●", normalizeStatusText(item.text), context, context.theme.commandColor, true);
114
+ return renderStatusLine(BLACK_CIRCLE, normalizeStatusText(item.text), context, context.theme.commandColor, true);
157
115
  case "goal_agent_transition":
158
- return renderStatusLine("●", normalizeStatusText(item.text), context, context.theme.commandColor, true);
116
+ return renderStatusLine(BLACK_CIRCLE, normalizeStatusText(item.text), context, context.theme.commandColor, true);
159
117
  case "model_transition":
160
118
  return renderStatusLine("▸", `${dim(context, "Switched to ")}${color(context.theme.commandColor, item.modelName, true)}`, context, context.theme.commandColor, true, true);
161
119
  case "theme_transition":
@@ -170,52 +128,12 @@ export function serializeCompletedItemToTerminalHistory(item, context) {
170
128
  return "";
171
129
  }
172
130
  }
173
- function normalizeStatusText(text) {
174
- return text.replace(/\\n/g, "\n").replace(/^\n+|\n+$/g, "");
175
- }
176
- function renderStatusLine(glyph, text, context, glyphColor, bold, textAlreadyStyled = false) {
177
- const prefix = ` ${color(glyphColor, glyph, true)} `;
178
- const continuation = " ";
179
- const body = textAlreadyStyled
180
- ? text
181
- : color(bold ? glyphColor : context.theme.textDim, text, bold);
182
- return prefixFirstLine(body, prefix, continuation);
183
- }
184
- function renderRoundBorderBox(lines, context, borderColor) {
185
- const longestLineWidth = Math.max(0, ...lines.map((lineText) => stringWidth(stripAnsi(lineText))));
186
- const maxFrameWidth = Math.max(4, context.columns - stringWidth(RESPONSE_LEFT_PADDING));
187
- const frameWidth = Math.max(4, Math.min(maxFrameWidth, longestLineWidth + 4));
188
- const contentWidth = Math.max(1, frameWidth - 4);
189
- const horizontal = color(borderColor, ROUND_BORDER.horizontal.repeat(frameWidth - 2));
190
- const top = `${color(borderColor, ROUND_BORDER.topLeft)}${horizontal}${color(borderColor, ROUND_BORDER.topRight)}`;
191
- const bottom = `${color(borderColor, ROUND_BORDER.bottomLeft)}${horizontal}${color(borderColor, ROUND_BORDER.bottomRight)}`;
192
- const rows = lines.flatMap((lineText) => wrapBoxLine(lineText, contentWidth));
193
- const body = rows.map((lineText) => {
194
- const fillWidth = Math.max(0, contentWidth - stringWidth(stripAnsi(lineText)));
195
- return `${color(borderColor, ROUND_BORDER.vertical)} ${lineText}${" ".repeat(fillWidth)} ${color(borderColor, ROUND_BORDER.vertical)}`;
196
- });
197
- return indent([top, ...body, bottom].join("\n"), RESPONSE_LEFT_PADDING);
198
- }
199
- function renderLeftBorderBox(lines, borderColor, options = {}) {
200
- const padding = " ".repeat(options.padding ?? 1);
201
- return indent(lines
202
- .map((lineText) => `${color(borderColor, SINGLE_LEFT_BORDER)}${padding}${lineText}`)
203
- .join("\n"), RESPONSE_LEFT_PADDING);
204
- }
205
- function formatHistoryWrite(output, options) {
206
- const trimmed = output.replace(/\n+$/u, "");
207
- if (trimmed.length === 0)
208
- return "";
209
- const leading = options.leadingSeparator ? "\n" : "";
210
- const trailing = options.trailingBlankLine ? "\n\n" : "\n";
211
- return `${leading}${trimmed}${trailing}`;
212
- }
213
131
  function renderBanner(context) {
214
132
  const modelInfo = getModel(context.model);
215
133
  const modelName = modelInfo?.name ?? context.model;
216
134
  const home = process.env.HOME ?? "";
217
135
  const displayPath = home && context.cwd.startsWith(home) ? `~${context.cwd.slice(home.length)}` : context.cwd;
218
- const logo = LOGO_LINES.map((lineText) => gradientLine(lineText));
136
+ const logo = LOGO_LINES.map((lineText) => gradientLine(lineText, GRADIENT));
219
137
  if (context.columns < SIDE_BY_SIDE_MIN) {
220
138
  return block([
221
139
  "",
@@ -235,9 +153,6 @@ function renderBanner(context) {
235
153
  "",
236
154
  ]);
237
155
  }
238
- function stripAnsi(value) {
239
- return value.replace(ANSI_ESCAPE_PATTERN, "");
240
- }
241
156
  function renderUser(text, imageCount, pasteInfo, context) {
242
157
  const imageBadges = Array.from({ length: imageCount ?? 0 }, (_, index) => userChipSegment(`[Image #${index + 1}]`, context.theme.accent));
243
158
  const userMessageText = context.theme.commandColor;
@@ -375,9 +290,6 @@ function renderSubAgentGroup(agents, aborted, context) {
375
290
  });
376
291
  return block(lines);
377
292
  }
378
- function renderGoal(title, workerId, context) {
379
- return `${RESPONSE_LEFT_PADDING}${color(context.theme.success, "▶", true)} ${dim(context, "Goal: ")}${color(context.theme.success, title)}${workerId ? dim(context, ` · worker ${workerId}`) : ""}`;
380
- }
381
293
  function renderGoalProgress(item, context) {
382
294
  const isError = item.status === "failed" || item.status === "fail" || item.status === "blocked";
383
295
  const status = isError
@@ -398,7 +310,10 @@ function renderGoalProgress(item, context) {
398
310
  : item.phase === "continuing"
399
311
  ? context.theme.warning
400
312
  : context.theme.primary;
401
- const header = `${toolHeader(status, color(labelColor, item.title, true), "", context)}${item.workerId ? dim(context, ` · worker ${item.workerId}`) : ""}`;
313
+ const header = `${toolHeader(status, color(labelColor, item.title, true), "", context, {
314
+ dotColor: labelColor,
315
+ indicator: BLACK_CIRCLE,
316
+ })}${item.workerId ? dim(context, ` · worker ${item.workerId}`) : ""}`;
402
317
  const bodyLines = [];
403
318
  if (item.detail) {
404
319
  bodyLines.push(dim(context, wrapPlain(item.detail, context.columns - 8)));
@@ -414,63 +329,6 @@ function renderGoalProgress(item, context) {
414
329
  }
415
330
  return block([header, ...messageResponse(bodyLines, context)]);
416
331
  }
417
- function renderError(headline, message, guidance, context) {
418
- const lines = [color(context.theme.error, `✗ ${headline}`)];
419
- if (message && message !== headline) {
420
- lines.push(dim(context, indent(wrapPlain(message, context.columns - 4), " ")));
421
- }
422
- lines.push(dim(context, indent(wrapPlain(`→ ${guidance}`, context.columns - 4), " ")));
423
- return indent(block(lines), RESPONSE_LEFT_PADDING);
424
- }
425
- function renderStylePack(added, showSetupHint, context) {
426
- const names = added.map((id) => LANGUAGE_DISPLAY_NAMES[id] ?? id).join(", ");
427
- const headerLabel = added.length > 1 ? "STYLE PACKS ACTIVE" : "STYLE PACK ACTIVE";
428
- const lines = [
429
- `${color(context.theme.language, "◆ ", true)}${color(context.theme.language, headerLabel, true)}`,
430
- color(context.theme.text, names, true),
431
- ];
432
- if (showSetupHint) {
433
- lines.push("", `${dim(context, "Tip: run ")}${color(context.theme.language, "/setup", true)}${dim(context, " to audit this project against the active pack(s)")}`);
434
- }
435
- return renderRoundBorderBox(lines, context, context.theme.language);
436
- }
437
- function renderSetupHint(context) {
438
- return renderRoundBorderBox([
439
- `${color(context.theme.language, "◆ ", true)}${color(context.theme.language, "NO STYLE PACKS DETECTED", true)}`,
440
- dim(context, "This directory has no recognized language manifest at its root."),
441
- "",
442
- `${dim(context, "Tip: run ")}${color(context.theme.language, "/setup", true)}${dim(context, " to audit project hygiene or bootstrap a new project from scratch")}`,
443
- ], context, context.theme.language);
444
- }
445
- function renderUpdateNotice(text, context) {
446
- return renderRoundBorderBox([color(context.theme.commandColor, `✨ ${text}`, true)], context, context.theme.commandColor);
447
- }
448
- function renderCompacting(context) {
449
- return renderLeftBorderBox([
450
- `${color(context.theme.warning, "· ")}${dim(context, "Compacting conversation")}${dim(context, "...")}`,
451
- ], context.theme.warning, { padding: 2 });
452
- }
453
- function renderCompacted(originalCount, newCount, tokensBefore, tokensAfter, context) {
454
- const reduction = tokensBefore > 0 ? Math.round((1 - tokensAfter / tokensBefore) * 100) : 0;
455
- return renderLeftBorderBox([
456
- `${color(context.theme.warning, "⟳ ")}${dim(context, "Conversation compacted")}`,
457
- dim(context, ` ${originalCount} → ${newCount} messages · ${formatTokenCount(tokensBefore)} → ${formatTokenCount(tokensAfter)} tokens · ${reduction}% reduction`),
458
- ], context.theme.warning);
459
- }
460
- function renderPlanEvent(event, detail, context) {
461
- const labels = {
462
- approved: "Plan approved",
463
- rejected: "Plan rejected",
464
- dismissed: "Plan dismissed",
465
- };
466
- const lines = [color(context.theme.commandColor, ` ○ ${labels[event]}`, true)];
467
- if (detail)
468
- lines[0] += dim(context, ` — "${detail}"`);
469
- return block(lines);
470
- }
471
- function renderStepDone(stepNum, description, context) {
472
- return `${RESPONSE_LEFT_PADDING}${color(context.theme.success, "✓", true)} ${color(context.theme.success, `Step ${stepNum} done`, true)}${description ? dim(context, ` — ${description}`) : ""}`;
473
- }
474
332
  function renderServerStyleToolDone(name, args, result, isError, context) {
475
333
  const { label, detail } = getToolHeaderParts(name, args);
476
334
  const searchCount = (result.match(/^\d+\./gm) ?? []).length;
@@ -536,12 +394,13 @@ function outputPreview(text, context, colorHex, options = {}) {
536
394
  return display;
537
395
  }
538
396
  function toolHeader(status, label, detail, context, options = {}) {
539
- const dotColor = status === "error"
540
- ? context.theme.error
541
- : status === "done"
542
- ? context.theme.success
543
- : context.theme.spinnerColor;
544
- const indicator = status === "running" ? SPINNER_FRAMES[0] : BLACK_CIRCLE;
397
+ const dotColor = options.dotColor ??
398
+ (status === "error"
399
+ ? context.theme.error
400
+ : status === "done"
401
+ ? context.theme.success
402
+ : context.theme.spinnerColor);
403
+ const indicator = options.indicator ?? (status === "running" ? SPINNER_FRAMES[0] : BLACK_CIRCLE);
545
404
  const labelColor = status === "error"
546
405
  ? context.theme.error
547
406
  : status === "done"
@@ -578,14 +437,6 @@ function prefixFirstLine(text, firstPrefix, nextPrefix) {
578
437
  })
579
438
  .join("\n");
580
439
  }
581
- function formatDuration(ms) {
582
- const totalSec = Math.round(ms / 1000);
583
- if (totalSec < 60)
584
- return `${totalSec}s`;
585
- const min = Math.floor(totalSec / 60);
586
- const sec = totalSec % 60;
587
- return sec > 0 ? `${min}m ${sec}s` : `${min}m`;
588
- }
589
440
  function getToolHeaderParts(name, args) {
590
441
  const displayName = toolDisplayName(name);
591
442
  switch (name) {
@@ -880,71 +731,4 @@ function colorCode(text, lang, context) {
880
731
  return color(context.theme.text, text);
881
732
  return color(context.theme.text, text);
882
733
  }
883
- function formatCompactTokens(n) {
884
- if (n >= 1_000_000)
885
- return `${(n / 1_000_000).toFixed(1)}M`;
886
- if (n >= 1_000)
887
- return `${(n / 1_000).toFixed(1)}k`;
888
- return String(n);
889
- }
890
- function formatTokenCount(n) {
891
- if (n >= 1000) {
892
- const k = n / 1000;
893
- return k >= 10 ? `${Math.round(k)}k` : `${k.toFixed(1)}k`;
894
- }
895
- return String(n);
896
- }
897
- function block(lines) {
898
- return lines.filter((lineText) => lineText.length > 0).join("\n");
899
- }
900
- function wrapPlain(text, width) {
901
- return wrapAnsi(text, Math.max(10, width), { hard: true, wordWrap: true });
902
- }
903
- function wrapBoxLine(text, width) {
904
- if (text.length === 0)
905
- return [""];
906
- return wrapAnsi(text, Math.max(1, width), { hard: true, wordWrap: true, trim: false }).split("\n");
907
- }
908
- function indent(text, prefix) {
909
- return text
910
- .split("\n")
911
- .map((lineText) => `${prefix}${lineText}`)
912
- .join("\n");
913
- }
914
- function truncatePlain(text, width) {
915
- const max = Math.max(1, width);
916
- if (stringWidth(text) <= max)
917
- return text;
918
- let result = "";
919
- for (const char of text) {
920
- if (stringWidth(`${result}${char}…`) > max)
921
- break;
922
- result += char;
923
- }
924
- return `${result}…`;
925
- }
926
- function color(hex, text, bold = false) {
927
- const styled = chalk.hex(hex)(text);
928
- return bold ? chalk.bold(styled) : styled;
929
- }
930
- function userChipSegment(text, foregroundHex, bold = false) {
931
- const styled = chalk.bgHex(USER_MESSAGE_BACKGROUND).hex(foregroundHex)(text);
932
- return bold ? chalk.bold(styled) : styled;
933
- }
934
- function dim(context, text) {
935
- return color(context.theme.textDim, text);
936
- }
937
- function gradientLine(text) {
938
- let colorIndex = 0;
939
- let result = "";
940
- for (const char of text) {
941
- if (char === " ") {
942
- result += char;
943
- continue;
944
- }
945
- result += chalk.hex(GRADIENT[colorIndex % GRADIENT.length] ?? GRADIENT[0])(char);
946
- colorIndex++;
947
- }
948
- return result;
949
- }
950
734
  //# sourceMappingURL=terminal-history.js.map