@kenkaiiii/ggcoder 4.3.216 → 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.
- package/dist/cli/command-routing.d.ts +28 -0
- package/dist/cli/command-routing.d.ts.map +1 -0
- package/dist/cli/command-routing.js +51 -0
- package/dist/cli/command-routing.js.map +1 -0
- package/dist/cli/command-routing.test.d.ts +2 -0
- package/dist/cli/command-routing.test.d.ts.map +1 -0
- package/dist/cli/command-routing.test.js +59 -0
- package/dist/cli/command-routing.test.js.map +1 -0
- package/dist/cli.d.ts +3 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +63 -108
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-compaction.test.d.ts +2 -0
- package/dist/core/agent-session-compaction.test.d.ts.map +1 -0
- package/dist/core/agent-session-compaction.test.js +121 -0
- package/dist/core/agent-session-compaction.test.js.map +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +6 -7
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/goal-controller.d.ts.map +1 -1
- package/dist/core/goal-controller.js +46 -1
- package/dist/core/goal-controller.js.map +1 -1
- package/dist/core/goal-controller.test.js +39 -0
- package/dist/core/goal-controller.test.js.map +1 -1
- package/dist/core/goal-store.d.ts +18 -0
- package/dist/core/goal-store.d.ts.map +1 -1
- package/dist/core/goal-store.js +48 -0
- package/dist/core/goal-store.js.map +1 -1
- package/dist/core/goal-store.test.js +10 -0
- package/dist/core/goal-store.test.js.map +1 -1
- package/dist/core/goal-worker.d.ts +9 -1
- package/dist/core/goal-worker.d.ts.map +1 -1
- package/dist/core/goal-worker.js +66 -19
- package/dist/core/goal-worker.js.map +1 -1
- package/dist/core/goal-worker.test.js +120 -1
- package/dist/core/goal-worker.test.js.map +1 -1
- package/dist/core/goal-worktree.d.ts +33 -0
- package/dist/core/goal-worktree.d.ts.map +1 -0
- package/dist/core/goal-worktree.js +67 -0
- package/dist/core/goal-worktree.js.map +1 -0
- package/dist/core/goal-worktree.test.d.ts +2 -0
- package/dist/core/goal-worktree.test.d.ts.map +1 -0
- package/dist/core/goal-worktree.test.js +101 -0
- package/dist/core/goal-worktree.test.js.map +1 -0
- package/dist/core/repomap-budget.d.ts +7 -0
- package/dist/core/repomap-budget.d.ts.map +1 -0
- package/dist/core/repomap-budget.js +10 -0
- package/dist/core/repomap-budget.js.map +1 -0
- package/dist/core/repomap-budget.test.d.ts +2 -0
- package/dist/core/repomap-budget.test.d.ts.map +1 -0
- package/dist/core/repomap-budget.test.js +26 -0
- package/dist/core/repomap-budget.test.js.map +1 -0
- package/dist/system-prompt.d.ts.map +1 -1
- package/dist/system-prompt.js +4 -0
- package/dist/system-prompt.js.map +1 -1
- package/dist/system-prompt.test.js +18 -0
- package/dist/system-prompt.test.js.map +1 -1
- package/dist/tools/goals.d.ts +9 -0
- package/dist/tools/goals.d.ts.map +1 -1
- package/dist/tools/goals.js +79 -27
- package/dist/tools/goals.js.map +1 -1
- package/dist/tools/goals.test.js +91 -22
- package/dist/tools/goals.test.js.map +1 -1
- package/dist/ui/App.d.ts +11 -385
- package/dist/ui/App.d.ts.map +1 -1
- package/dist/ui/App.js +109 -559
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/app-items.d.ts +207 -0
- package/dist/ui/app-items.d.ts.map +1 -0
- package/dist/ui/app-items.js +2 -0
- package/dist/ui/app-items.js.map +1 -0
- package/dist/ui/app-state-persistence.test.js +4 -1
- package/dist/ui/app-state-persistence.test.js.map +1 -1
- package/dist/ui/chat-layout-pinning.test.js +11 -1
- package/dist/ui/chat-layout-pinning.test.js.map +1 -1
- package/dist/ui/components/AnimationContext.d.ts.map +1 -1
- package/dist/ui/components/AnimationContext.js +3 -5
- package/dist/ui/components/AnimationContext.js.map +1 -1
- package/dist/ui/components/AssistantMessage.test.js +12 -12
- package/dist/ui/components/AssistantMessage.test.js.map +1 -1
- package/dist/ui/components/CompactionNotice.js +2 -2
- package/dist/ui/components/CompactionNotice.js.map +1 -1
- package/dist/ui/components/Footer.d.ts +1 -0
- package/dist/ui/components/Footer.d.ts.map +1 -1
- package/dist/ui/components/Footer.js +5 -2
- package/dist/ui/components/Footer.js.map +1 -1
- package/dist/ui/components/ServerToolExecution.d.ts.map +1 -1
- package/dist/ui/components/ServerToolExecution.js +5 -23
- package/dist/ui/components/ServerToolExecution.js.map +1 -1
- package/dist/ui/components/SubAgentPanel.d.ts.map +1 -1
- package/dist/ui/components/SubAgentPanel.js +3 -2
- package/dist/ui/components/SubAgentPanel.js.map +1 -1
- package/dist/ui/components/ToolExecution.d.ts.map +1 -1
- package/dist/ui/components/ToolExecution.js +12 -30
- package/dist/ui/components/ToolExecution.js.map +1 -1
- package/dist/ui/components/ToolGroupExecution.d.ts.map +1 -1
- package/dist/ui/components/ToolGroupExecution.js +5 -24
- package/dist/ui/components/ToolGroupExecution.js.map +1 -1
- package/dist/ui/components/ToolUseLoader.d.ts +3 -1
- package/dist/ui/components/ToolUseLoader.d.ts.map +1 -1
- package/dist/ui/components/ToolUseLoader.js +2 -2
- package/dist/ui/components/ToolUseLoader.js.map +1 -1
- package/dist/ui/footer-status-layout.test.js +9 -1
- package/dist/ui/footer-status-layout.test.js.map +1 -1
- package/dist/ui/goal-events.d.ts +4 -0
- package/dist/ui/goal-events.d.ts.map +1 -1
- package/dist/ui/goal-events.js +19 -1
- package/dist/ui/goal-events.js.map +1 -1
- package/dist/ui/goal-events.test.js +15 -1
- package/dist/ui/goal-events.test.js.map +1 -1
- package/dist/ui/goal-lifecycle-orchestration.test.js +20 -1
- package/dist/ui/goal-lifecycle-orchestration.test.js.map +1 -1
- package/dist/ui/goal-progress.d.ts +31 -0
- package/dist/ui/goal-progress.d.ts.map +1 -0
- package/dist/ui/goal-progress.js +152 -0
- package/dist/ui/goal-progress.js.map +1 -0
- package/dist/ui/item-helpers.d.ts +24 -0
- package/dist/ui/item-helpers.d.ts.map +1 -0
- package/dist/ui/item-helpers.js +96 -0
- package/dist/ui/item-helpers.js.map +1 -0
- package/dist/ui/layout-decisions.d.ts +113 -0
- package/dist/ui/layout-decisions.d.ts.map +1 -0
- package/dist/ui/layout-decisions.js +173 -0
- package/dist/ui/layout-decisions.js.map +1 -0
- package/dist/ui/prompt-routing.d.ts +29 -0
- package/dist/ui/prompt-routing.d.ts.map +1 -0
- package/dist/ui/prompt-routing.js +105 -0
- package/dist/ui/prompt-routing.js.map +1 -0
- package/dist/ui/queued-message.test.js +19 -1
- package/dist/ui/queued-message.test.js.map +1 -1
- package/dist/ui/render.d.ts +1 -0
- package/dist/ui/render.d.ts.map +1 -1
- package/dist/ui/render.js +1 -0
- package/dist/ui/render.js.map +1 -1
- package/dist/ui/scroll-stabilization.test.js +1 -1
- package/dist/ui/scroll-stabilization.test.js.map +1 -1
- package/dist/ui/slash-command-images.test.js +1 -1
- package/dist/ui/slash-command-images.test.js.map +1 -1
- package/dist/ui/terminal-history-format.d.ts +41 -0
- package/dist/ui/terminal-history-format.d.ts.map +1 -0
- package/dist/ui/terminal-history-format.js +131 -0
- package/dist/ui/terminal-history-format.js.map +1 -0
- package/dist/ui/terminal-history-spacing.d.ts +3 -0
- package/dist/ui/terminal-history-spacing.d.ts.map +1 -0
- package/dist/ui/terminal-history-spacing.js +28 -0
- package/dist/ui/terminal-history-spacing.js.map +1 -0
- package/dist/ui/terminal-history-status-renderers.d.ts +16 -0
- package/dist/ui/terminal-history-status-renderers.d.ts.map +1 -0
- package/dist/ui/terminal-history-status-renderers.js +83 -0
- package/dist/ui/terminal-history-status-renderers.js.map +1 -0
- package/dist/ui/terminal-history.d.ts.map +1 -1
- package/dist/ui/terminal-history.js +30 -246
- package/dist/ui/terminal-history.js.map +1 -1
- package/dist/ui/terminal-history.test.js +21 -7
- package/dist/ui/terminal-history.test.js.map +1 -1
- package/dist/ui/thinking-level-cycle.test.d.ts +2 -0
- package/dist/ui/thinking-level-cycle.test.d.ts.map +1 -0
- package/dist/ui/thinking-level-cycle.test.js +25 -0
- package/dist/ui/thinking-level-cycle.test.js.map +1 -0
- package/dist/ui/thinking-level.d.ts +5 -0
- package/dist/ui/thinking-level.d.ts.map +1 -0
- package/dist/ui/thinking-level.js +30 -0
- package/dist/ui/thinking-level.js.map +1 -0
- package/dist/ui/tool-group-summary.d.ts.map +1 -1
- package/dist/ui/tool-group-summary.js +117 -8
- package/dist/ui/tool-group-summary.js.map +1 -1
- package/dist/ui/tool-group-summary.test.d.ts +2 -0
- package/dist/ui/tool-group-summary.test.d.ts.map +1 -0
- package/dist/ui/tool-group-summary.test.js +79 -0
- package/dist/ui/tool-group-summary.test.js.map +1 -0
- package/dist/ui/tui-history-parity.test.js +34 -13
- package/dist/ui/tui-history-parity.test.js.map +1 -1
- package/package.json +4 -4
|
@@ -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,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACjE,OAAO,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,KAAa,EACb,QAA4B,EAC5B,OAA+B;IAE/B,OAAO,GAAG,qBAAqB,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,KAAK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AAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-history.d.ts","sourceRoot":"","sources":["../../src/ui/terminal-history.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"terminal-history.d.ts","sourceRoot":"","sources":["../../src/ui/terminal-history.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AA8D9C,MAAM,WAAW,sBAAsB;IACrC,KAAK,CACH,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,OAAO,EAAE,sBAAsB,EAC/B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,GAC5D,IAAI,CAAC;IACR,KAAK,IAAI,IAAI,CAAC;IACd,YAAY,IAAI,IAAI,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,6BAA6B;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,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,11 +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";
|
|
6
|
+
import { SPINNER_FRAMES } from "./spinner-frames.js";
|
|
7
7
|
import { getUserMessageDisplayParts } from "./utils/user-message-display.js";
|
|
8
8
|
import { buildToolGroupSummary, segmentsToPlainText } from "./tool-group-summary.js";
|
|
9
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";
|
|
10
13
|
const LOGO_LINES = [" ▄▀▀▀ ▄▀▀▀", " █ ▀█ █ ▀█", " ▀▄▄▀ ▀▄▄▀"];
|
|
11
14
|
const GRADIENT = [
|
|
12
15
|
"#60a5fa",
|
|
@@ -25,53 +28,9 @@ const GRADIENT = [
|
|
|
25
28
|
const GAP = " ";
|
|
26
29
|
const LOGO_WIDTH = 9;
|
|
27
30
|
const SIDE_BY_SIDE_MIN = LOGO_WIDTH + GAP.length + 20;
|
|
28
|
-
const MAX_OUTPUT_LINES = 4;
|
|
29
|
-
const RESPONSE_LEFT_PADDING = " ";
|
|
30
|
-
const USER_MESSAGE_BACKGROUND = "#374151";
|
|
31
|
-
const USER_MESSAGE_PREFIX = "> ";
|
|
32
|
-
const USER_MESSAGE_TOP_FILL = "▄";
|
|
33
|
-
const USER_MESSAGE_BOTTOM_FILL = "▀";
|
|
34
|
-
const USER_MESSAGE_HORIZONTAL_PADDING = 2;
|
|
35
|
-
const ANSI_ESCAPE_PATTERN = new RegExp(String.raw `\u001B\[[0-?]*[ -/]*[@-~]`, "gu");
|
|
36
31
|
const COMPACT_TOOLS = new Set(["read", "grep", "find", "ls", "source_path"]);
|
|
37
32
|
const STATE_TOOLS = new Set(["tasks", "goals"]);
|
|
38
33
|
const SERVER_STYLE_TOOLS = new Set(["web_search"]);
|
|
39
|
-
const SINGLE_LEFT_BORDER = "│";
|
|
40
|
-
const ROUND_BORDER = {
|
|
41
|
-
topLeft: "╭",
|
|
42
|
-
topRight: "╮",
|
|
43
|
-
bottomLeft: "╰",
|
|
44
|
-
bottomRight: "╯",
|
|
45
|
-
horizontal: "─",
|
|
46
|
-
vertical: "│",
|
|
47
|
-
};
|
|
48
|
-
function isAgentSpacingKind(kind) {
|
|
49
|
-
return [
|
|
50
|
-
"assistant",
|
|
51
|
-
"queued",
|
|
52
|
-
"goal_progress",
|
|
53
|
-
"tool_start",
|
|
54
|
-
"tool_done",
|
|
55
|
-
"tool_group",
|
|
56
|
-
"server_tool_start",
|
|
57
|
-
"server_tool_done",
|
|
58
|
-
"subagent_group",
|
|
59
|
-
"info",
|
|
60
|
-
"error",
|
|
61
|
-
"stopped",
|
|
62
|
-
"plan_transition",
|
|
63
|
-
"goal_agent_transition",
|
|
64
|
-
"thinking_transition",
|
|
65
|
-
"model_transition",
|
|
66
|
-
"theme_transition",
|
|
67
|
-
"plan_event",
|
|
68
|
-
"update_notice",
|
|
69
|
-
"compacting",
|
|
70
|
-
"compacted",
|
|
71
|
-
"style_pack",
|
|
72
|
-
"setup_hint",
|
|
73
|
-
].includes(kind);
|
|
74
|
-
}
|
|
75
34
|
export function createTerminalHistoryPrinter({ stream = process.stdout, } = {}) {
|
|
76
35
|
const printed = new Set();
|
|
77
36
|
let previousPrintedKind = null;
|
|
@@ -118,7 +77,7 @@ export function serializeCompletedItemToTerminalHistory(item, context) {
|
|
|
118
77
|
case "queued":
|
|
119
78
|
return renderQueued(item.text, item.imageCount, context);
|
|
120
79
|
case "assistant":
|
|
121
|
-
return renderAssistant(item.text,
|
|
80
|
+
return renderAssistant(item.text, context, item.continuation);
|
|
122
81
|
case "tool_start":
|
|
123
82
|
return renderToolStart(item.name, item.args, item.progressOutput, context);
|
|
124
83
|
case "tool_done":
|
|
@@ -150,13 +109,11 @@ export function serializeCompletedItemToTerminalHistory(item, context) {
|
|
|
150
109
|
case "compacted":
|
|
151
110
|
return renderCompacted(item.originalCount, item.newCount, item.tokensBefore, item.tokensAfter, context);
|
|
152
111
|
case "duration":
|
|
153
|
-
return dim(context, `✻ ${item.verb} ${formatDuration(item.durationMs)}`);
|
|
112
|
+
return indent(dim(context, `✻ ${item.verb} ${formatDuration(item.durationMs)}`), RESPONSE_LEFT_PADDING);
|
|
154
113
|
case "plan_transition":
|
|
155
|
-
return renderStatusLine(
|
|
114
|
+
return renderStatusLine(BLACK_CIRCLE, normalizeStatusText(item.text), context, context.theme.commandColor, true);
|
|
156
115
|
case "goal_agent_transition":
|
|
157
|
-
return renderStatusLine(
|
|
158
|
-
case "thinking_transition":
|
|
159
|
-
return renderStatusLine("✻", item.active ? "Thinking ON" : "Thinking OFF", context, item.active ? context.theme.commandColor : context.theme.textDim, true);
|
|
116
|
+
return renderStatusLine(BLACK_CIRCLE, normalizeStatusText(item.text), context, context.theme.commandColor, true);
|
|
160
117
|
case "model_transition":
|
|
161
118
|
return renderStatusLine("▸", `${dim(context, "Switched to ")}${color(context.theme.commandColor, item.modelName, true)}`, context, context.theme.commandColor, true, true);
|
|
162
119
|
case "theme_transition":
|
|
@@ -171,49 +128,12 @@ export function serializeCompletedItemToTerminalHistory(item, context) {
|
|
|
171
128
|
return "";
|
|
172
129
|
}
|
|
173
130
|
}
|
|
174
|
-
function normalizeStatusText(text) {
|
|
175
|
-
return text.replace(/\\n/g, "\n").replace(/^\n+|\n+$/g, "");
|
|
176
|
-
}
|
|
177
|
-
function renderStatusLine(glyph, text, context, glyphColor, bold, textAlreadyStyled = false) {
|
|
178
|
-
const prefix = ` ${color(glyphColor, glyph, true)} `;
|
|
179
|
-
const continuation = " ";
|
|
180
|
-
const body = textAlreadyStyled
|
|
181
|
-
? text
|
|
182
|
-
: color(bold ? glyphColor : context.theme.textDim, text, bold);
|
|
183
|
-
return prefixFirstLine(body, prefix, continuation);
|
|
184
|
-
}
|
|
185
|
-
function renderRoundBorderBox(lines, context, borderColor) {
|
|
186
|
-
const frameWidth = Math.max(4, context.columns);
|
|
187
|
-
const contentWidth = Math.max(1, frameWidth - 4);
|
|
188
|
-
const horizontal = color(borderColor, ROUND_BORDER.horizontal.repeat(frameWidth - 2));
|
|
189
|
-
const top = `${color(borderColor, ROUND_BORDER.topLeft)}${horizontal}${color(borderColor, ROUND_BORDER.topRight)}`;
|
|
190
|
-
const bottom = `${color(borderColor, ROUND_BORDER.bottomLeft)}${horizontal}${color(borderColor, ROUND_BORDER.bottomRight)}`;
|
|
191
|
-
const rows = lines.flatMap((lineText) => wrapBoxLine(lineText, contentWidth));
|
|
192
|
-
const body = rows.map((lineText) => {
|
|
193
|
-
const fillWidth = Math.max(0, contentWidth - stringWidth(stripAnsi(lineText)));
|
|
194
|
-
return `${color(borderColor, ROUND_BORDER.vertical)} ${lineText}${" ".repeat(fillWidth)} ${color(borderColor, ROUND_BORDER.vertical)}`;
|
|
195
|
-
});
|
|
196
|
-
return [top, ...body, bottom].join("\n");
|
|
197
|
-
}
|
|
198
|
-
function renderLeftBorderBox(lines, borderColor) {
|
|
199
|
-
return lines
|
|
200
|
-
.map((lineText) => `${color(borderColor, SINGLE_LEFT_BORDER)} ${lineText}`)
|
|
201
|
-
.join("\n");
|
|
202
|
-
}
|
|
203
|
-
function formatHistoryWrite(output, options) {
|
|
204
|
-
const trimmed = output.replace(/\n+$/u, "");
|
|
205
|
-
if (trimmed.length === 0)
|
|
206
|
-
return "";
|
|
207
|
-
const leading = options.leadingSeparator ? "\n" : "";
|
|
208
|
-
const trailing = options.trailingBlankLine ? "\n\n" : "\n";
|
|
209
|
-
return `${leading}${trimmed}${trailing}`;
|
|
210
|
-
}
|
|
211
131
|
function renderBanner(context) {
|
|
212
132
|
const modelInfo = getModel(context.model);
|
|
213
133
|
const modelName = modelInfo?.name ?? context.model;
|
|
214
134
|
const home = process.env.HOME ?? "";
|
|
215
135
|
const displayPath = home && context.cwd.startsWith(home) ? `~${context.cwd.slice(home.length)}` : context.cwd;
|
|
216
|
-
const logo = LOGO_LINES.map((lineText) => gradientLine(lineText));
|
|
136
|
+
const logo = LOGO_LINES.map((lineText) => gradientLine(lineText, GRADIENT));
|
|
217
137
|
if (context.columns < SIDE_BY_SIDE_MIN) {
|
|
218
138
|
return block([
|
|
219
139
|
"",
|
|
@@ -233,9 +153,6 @@ function renderBanner(context) {
|
|
|
233
153
|
"",
|
|
234
154
|
]);
|
|
235
155
|
}
|
|
236
|
-
function stripAnsi(value) {
|
|
237
|
-
return value.replace(ANSI_ESCAPE_PATTERN, "");
|
|
238
|
-
}
|
|
239
156
|
function renderUser(text, imageCount, pasteInfo, context) {
|
|
240
157
|
const imageBadges = Array.from({ length: imageCount ?? 0 }, (_, index) => userChipSegment(`[Image #${index + 1}]`, context.theme.accent));
|
|
241
158
|
const userMessageText = context.theme.commandColor;
|
|
@@ -268,13 +185,8 @@ function renderQueued(text, imageCount, context) {
|
|
|
268
185
|
const suffix = imageCount ? ` (+${imageCount} image${imageCount > 1 ? "s" : ""})` : "";
|
|
269
186
|
return prefixFirstLine(wrapPlain(`${dim(context, "Queued: ")}${color(context.theme.text, text || "(empty)")}${color(context.theme.text, suffix)}`, context.columns - 4), ` ${color(context.theme.warning, "•", true)} `, " ");
|
|
270
187
|
}
|
|
271
|
-
function renderAssistant(text,
|
|
188
|
+
function renderAssistant(text, context, continuation = false) {
|
|
272
189
|
const lines = [];
|
|
273
|
-
if (thinking?.trim()) {
|
|
274
|
-
const label = `✦ Thought${thinkingMs ? ` for ${formatDuration(thinkingMs)}` : ""}`;
|
|
275
|
-
lines.push(color(context.theme.textMuted, label));
|
|
276
|
-
lines.push(dim(context, indent(wrapPlain(thinking.trim(), context.columns - 2), " ")));
|
|
277
|
-
}
|
|
278
190
|
const body = renderMarkdownToAnsiLines({
|
|
279
191
|
text,
|
|
280
192
|
theme: context.theme,
|
|
@@ -294,7 +206,7 @@ function renderToolStart(name, args, progressOutput, context) {
|
|
|
294
206
|
const { label, detail } = getToolHeaderParts(name, args);
|
|
295
207
|
return block([
|
|
296
208
|
toolHeader("running", label, detail, context, { quoteDetail: true }),
|
|
297
|
-
...messageResponse([dim(context, "
|
|
209
|
+
...messageResponse([dim(context, "Searching...")], context),
|
|
298
210
|
]);
|
|
299
211
|
}
|
|
300
212
|
if (COMPACT_TOOLS.has(name)) {
|
|
@@ -305,9 +217,7 @@ function renderToolStart(name, args, progressOutput, context) {
|
|
|
305
217
|
return stateToolHeader("running", label, detail, "", context);
|
|
306
218
|
}
|
|
307
219
|
const { label, detail } = getToolHeaderParts(name, args);
|
|
308
|
-
const header =
|
|
309
|
-
? toolHeader("running", `· ${label}`, detail, context)
|
|
310
|
-
: toolHeader("running", label, detail, context);
|
|
220
|
+
const header = toolHeader("running", label, detail, context);
|
|
311
221
|
if (name !== "bash" || !progressOutput?.trim())
|
|
312
222
|
return header;
|
|
313
223
|
return block([
|
|
@@ -350,7 +260,7 @@ function renderServerToolStart(name, input, context) {
|
|
|
350
260
|
const { label, detail } = getServerToolHeaderParts(name, input);
|
|
351
261
|
return block([
|
|
352
262
|
toolHeader("running", label, detail, context, { quoteDetail: true }),
|
|
353
|
-
...messageResponse([dim(context, "
|
|
263
|
+
...messageResponse([dim(context, "Searching...")], context),
|
|
354
264
|
]);
|
|
355
265
|
}
|
|
356
266
|
function renderServerToolDone(name, input, resultType, durationMs, context) {
|
|
@@ -373,16 +283,13 @@ function renderSubAgentGroup(agents, aborted, context) {
|
|
|
373
283
|
? `${agents.length} agent${agents.length !== 1 ? "s" : ""} completed`
|
|
374
284
|
: `${agents.length} agent${agents.length !== 1 ? "s" : ""} launched`;
|
|
375
285
|
const lines = [
|
|
376
|
-
toolHeader(aborted ? "error" : allDone ? "done" : "running", headerText, "", context)
|
|
286
|
+
toolHeader(aborted ? "error" : allDone ? "done" : "running", headerText, "", context),
|
|
377
287
|
];
|
|
378
288
|
agents.forEach((agent, index) => {
|
|
379
289
|
lines.push(...renderSubAgentRows(agent, index === agents.length - 1, aborted === true, context));
|
|
380
290
|
});
|
|
381
291
|
return block(lines);
|
|
382
292
|
}
|
|
383
|
-
function renderGoal(title, workerId, context) {
|
|
384
|
-
return `${color(context.theme.success, "▶", true)} ${dim(context, "Goal: ")}${color(context.theme.success, title)}${workerId ? dim(context, ` · worker ${workerId}`) : ""}`;
|
|
385
|
-
}
|
|
386
293
|
function renderGoalProgress(item, context) {
|
|
387
294
|
const isError = item.status === "failed" || item.status === "fail" || item.status === "blocked";
|
|
388
295
|
const status = isError
|
|
@@ -403,7 +310,10 @@ function renderGoalProgress(item, context) {
|
|
|
403
310
|
: item.phase === "continuing"
|
|
404
311
|
? context.theme.warning
|
|
405
312
|
: context.theme.primary;
|
|
406
|
-
const header = `${toolHeader(status, color(labelColor, item.title, true), "", context
|
|
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}`) : ""}`;
|
|
407
317
|
const bodyLines = [];
|
|
408
318
|
if (item.detail) {
|
|
409
319
|
bodyLines.push(dim(context, wrapPlain(item.detail, context.columns - 8)));
|
|
@@ -419,63 +329,6 @@ function renderGoalProgress(item, context) {
|
|
|
419
329
|
}
|
|
420
330
|
return block([header, ...messageResponse(bodyLines, context)]);
|
|
421
331
|
}
|
|
422
|
-
function renderError(headline, message, guidance, context) {
|
|
423
|
-
const lines = [color(context.theme.error, `✗ ${headline}`)];
|
|
424
|
-
if (message && message !== headline) {
|
|
425
|
-
lines.push(dim(context, indent(wrapPlain(message, context.columns - 4), " ")));
|
|
426
|
-
}
|
|
427
|
-
lines.push(dim(context, indent(wrapPlain(`→ ${guidance}`, context.columns - 4), " ")));
|
|
428
|
-
return indent(block(lines), RESPONSE_LEFT_PADDING);
|
|
429
|
-
}
|
|
430
|
-
function renderStylePack(added, showSetupHint, context) {
|
|
431
|
-
const names = added.map((id) => LANGUAGE_DISPLAY_NAMES[id] ?? id).join(", ");
|
|
432
|
-
const headerLabel = added.length > 1 ? "STYLE PACKS ACTIVE" : "STYLE PACK ACTIVE";
|
|
433
|
-
const lines = [
|
|
434
|
-
`${color(context.theme.language, "◆ ", true)}${color(context.theme.language, headerLabel, true)}`,
|
|
435
|
-
color(context.theme.text, names, true),
|
|
436
|
-
];
|
|
437
|
-
if (showSetupHint) {
|
|
438
|
-
lines.push("", `${dim(context, "Tip: run ")}${color(context.theme.language, "/setup", true)}${dim(context, " to audit this project against the active pack(s)")}`);
|
|
439
|
-
}
|
|
440
|
-
return renderRoundBorderBox(lines, context, context.theme.language);
|
|
441
|
-
}
|
|
442
|
-
function renderSetupHint(context) {
|
|
443
|
-
return renderRoundBorderBox([
|
|
444
|
-
`${color(context.theme.language, "◆ ", true)}${color(context.theme.language, "NO STYLE PACKS DETECTED", true)}`,
|
|
445
|
-
dim(context, "This directory has no recognized language manifest at its root."),
|
|
446
|
-
"",
|
|
447
|
-
`${dim(context, "Tip: run ")}${color(context.theme.language, "/setup", true)}${dim(context, " to audit project hygiene or bootstrap a new project from scratch")}`,
|
|
448
|
-
], context, context.theme.language);
|
|
449
|
-
}
|
|
450
|
-
function renderUpdateNotice(text, context) {
|
|
451
|
-
return renderRoundBorderBox([color(context.theme.commandColor, `✨ ${text}`, true)], context, context.theme.commandColor);
|
|
452
|
-
}
|
|
453
|
-
function renderCompacting(context) {
|
|
454
|
-
return renderLeftBorderBox([
|
|
455
|
-
`${color(context.theme.warning, "· ")}${dim(context, "Compacting conversation")}${dim(context, "...")}`,
|
|
456
|
-
], context.theme.warning);
|
|
457
|
-
}
|
|
458
|
-
function renderCompacted(originalCount, newCount, tokensBefore, tokensAfter, context) {
|
|
459
|
-
const reduction = tokensBefore > 0 ? Math.round((1 - tokensAfter / tokensBefore) * 100) : 0;
|
|
460
|
-
return renderLeftBorderBox([
|
|
461
|
-
`${color(context.theme.warning, "⟳ ")}${dim(context, "Conversation compacted")}`,
|
|
462
|
-
dim(context, ` ${originalCount} → ${newCount} messages · ${formatTokenCount(tokensBefore)} → ${formatTokenCount(tokensAfter)} tokens · ${reduction}% reduction`),
|
|
463
|
-
], context.theme.warning);
|
|
464
|
-
}
|
|
465
|
-
function renderPlanEvent(event, detail, context) {
|
|
466
|
-
const labels = {
|
|
467
|
-
approved: "Plan approved",
|
|
468
|
-
rejected: "Plan rejected",
|
|
469
|
-
dismissed: "Plan dismissed",
|
|
470
|
-
};
|
|
471
|
-
const lines = [color(context.theme.commandColor, ` ○ ${labels[event]}`, true)];
|
|
472
|
-
if (detail)
|
|
473
|
-
lines[0] += dim(context, ` — "${detail}"`);
|
|
474
|
-
return block(lines);
|
|
475
|
-
}
|
|
476
|
-
function renderStepDone(stepNum, description, context) {
|
|
477
|
-
return `${color(context.theme.success, "✓", true)} ${color(context.theme.success, `Step ${stepNum} done`, true)}${description ? dim(context, ` — ${description}`) : ""}`;
|
|
478
|
-
}
|
|
479
332
|
function renderServerStyleToolDone(name, args, result, isError, context) {
|
|
480
333
|
const { label, detail } = getToolHeaderParts(name, args);
|
|
481
334
|
const searchCount = (result.match(/^\d+\./gm) ?? []).length;
|
|
@@ -498,7 +351,7 @@ function renderSubAgentRows(agent, isLast, aborted, context) {
|
|
|
498
351
|
: agent.status === "error"
|
|
499
352
|
? color(context.theme.error, "✗ ", true)
|
|
500
353
|
: "";
|
|
501
|
-
const taskLine = `${dim(context, `
|
|
354
|
+
const taskLine = `${dim(context, ` ${branch.padEnd(3)}`)}${taskPrefix}${color(agent.status === "done" ? context.theme.success : context.theme.text, taskDisplay, isRunning)}`;
|
|
502
355
|
const totalTokens = agent.tokenUsage ? agent.tokenUsage.input + agent.tokenUsage.output : 0;
|
|
503
356
|
let detail;
|
|
504
357
|
if (isRunning) {
|
|
@@ -510,7 +363,7 @@ function renderSubAgentRows(agent, isLast, aborted, context) {
|
|
|
510
363
|
else {
|
|
511
364
|
detail = color(context.theme.error, `${agent.status === "aborted" || aborted ? "Interrupted" : "Failed"}${agent.durationMs != null ? ` · ${formatDuration(agent.durationMs)}` : ""}`);
|
|
512
365
|
}
|
|
513
|
-
return [taskLine, `${dim(context, `
|
|
366
|
+
return [taskLine, `${dim(context, ` ${continuation}${RETURN_SYMBOL} `)}${detail}`];
|
|
514
367
|
}
|
|
515
368
|
function toolResultPreview(name, result, isError, context) {
|
|
516
369
|
if (isError)
|
|
@@ -541,17 +394,23 @@ function outputPreview(text, context, colorHex, options = {}) {
|
|
|
541
394
|
return display;
|
|
542
395
|
}
|
|
543
396
|
function toolHeader(status, label, detail, context, options = {}) {
|
|
544
|
-
const dotColor =
|
|
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);
|
|
404
|
+
const labelColor = status === "error"
|
|
545
405
|
? context.theme.error
|
|
546
406
|
: status === "done"
|
|
547
407
|
? context.theme.success
|
|
548
|
-
: context.theme.
|
|
549
|
-
const labelColor = status === "error" ? context.theme.toolError : context.theme.toolName;
|
|
408
|
+
: context.theme.toolName;
|
|
550
409
|
const detailText = detail
|
|
551
410
|
? color(context.theme.text, options.quoteDetail ? `(${dim(context, '"')}${detail}${dim(context, '"')})` : `(${detail})`)
|
|
552
411
|
: "";
|
|
553
412
|
const suffixText = options.suffix ? dim(context, ` ${options.suffix}`) : "";
|
|
554
|
-
return `${RESPONSE_LEFT_PADDING}${color(dotColor,
|
|
413
|
+
return `${RESPONSE_LEFT_PADDING}${color(dotColor, indicator)} ${color(labelColor, label, true)}${detailText}${suffixText}`;
|
|
555
414
|
}
|
|
556
415
|
function stateToolHeader(status, label, detail, inline, context) {
|
|
557
416
|
const suffix = [detail, inline ? `· ${inline}` : ""]
|
|
@@ -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
|