@kolisachint/hoocode-agent 0.5.5 → 0.5.7
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/CHANGELOG.md +70 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +9 -2
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/theme/colorsafe-dark.json +1 -1
- package/dist/modes/interactive/theme/colorsafe-light.json +38 -39
- package/dist/modes/interactive/theme/high-contrast-dark.json +3 -3
- package/dist/modes/interactive/theme/high-contrast-light.json +9 -9
- package/dist/modes/interactive/theme/light.json +45 -41
- package/dist/modes/interactive/theme/theme-schema.json +16 -8
- package/dist/modes/interactive/theme/theme.d.ts +6 -2
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +15 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/theme/vox-dark.json +97 -0
- package/dist/modes/interactive/theme/vox-light.json +101 -0
- package/dist/modes/interactive/theme/warm-dark.json +3 -3
- package/dist/modes/interactive/theme/warm-light.json +12 -12
- package/docs/themes.md +65 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.7] - 2026-08-12
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **`vox-dark` and `vox-light` themes** — explanatory-journalism styling: one
|
|
8
|
+
loud yellow used sparingly against a newsprint-quiet palette. The yellow is
|
|
9
|
+
reserved for four roles (`accent`, `mdHeading`, `selectedBg`, `borderAccent`)
|
|
10
|
+
and never carries a status, so `warning` is orange rather than the usual
|
|
11
|
+
yellow — a yellow `◐` or context gauge stops reading as a signal when yellow
|
|
12
|
+
is already the accent. Both are AA, not AAA, and are not covered by
|
|
13
|
+
`test/theme-contrast.test.ts`, but they are held to the same standards the
|
|
14
|
+
default `light` theme gained in 0.5.6: every text token clears 4.5:1 on every
|
|
15
|
+
surface it paints, rules and inactive chrome clear 2.8:1, and no two tokens
|
|
16
|
+
that mean different things sit closer than ΔE 11. Rules stay neutral rather
|
|
17
|
+
than saturated — a separator carries no meaning through hue — which is the one
|
|
18
|
+
deliberate departure, documented in `docs/themes.md`.
|
|
19
|
+
- Optional `brandBg` / `brandText` theme tokens, honored only as a pair, paint
|
|
20
|
+
the footer's brand mark as a filled chip instead of accent-colored text.
|
|
21
|
+
Themes that omit them are unchanged. Added for light themes, where a brand
|
|
22
|
+
hue vivid enough to be recognizable is rarely legible as text on a light
|
|
23
|
+
canvas. `vox-light` is the only built-in that sets them.
|
|
24
|
+
|
|
25
|
+
## [0.5.6] - 2026-08-12
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- **The default `light` theme now uses saturated, deep hues instead of pastels.**
|
|
30
|
+
Its colors were pale enough to blur into the grays around them on a light
|
|
31
|
+
terminal: `success` and `bashMode` were a 20%-saturation sage, `error` a dusty
|
|
32
|
+
rose, `thinkingHigh` and `mcp` near-gray mauves, and almost every token sat at
|
|
33
|
+
4.0–4.9:1 against the page. Every hue is now 65%+ saturated, every foreground
|
|
34
|
+
clears WCAG AA (4.5:1) on all six message/tool surfaces plus the export
|
|
35
|
+
canvases, and rules and inactive chrome (`borderMuted`, `mdHr`,
|
|
36
|
+
`thinkingOff`) went from a near-invisible 2.0:1 to 3.0:1. The tool-state
|
|
37
|
+
backgrounds are tinted far enough apart to tell pending, success, and error
|
|
38
|
+
apart at a glance, and unlanguaged code blocks render as dark ink rather than
|
|
39
|
+
green so syntax highlighting carries the color. `test/theme-contrast.test.ts`
|
|
40
|
+
enforces both the contrast floor and the saturation floor.
|
|
41
|
+
- **The six accessible themes no longer paint different things the same color.**
|
|
42
|
+
They all cleared AAA, but contrast says nothing about whether two tokens read
|
|
43
|
+
as the *same* color, and crushing a palette dark enough to clear 7:1 on white
|
|
44
|
+
is exactly what collapses distinct hues together. Measured with CIEDE2000,
|
|
45
|
+
`mcp` was byte-identical to an agent color in three themes — an MCP row and a
|
|
46
|
+
subagent row in the same task panel drew their tags in one color — and the two
|
|
47
|
+
quietest thinking levels were 2.0-2.6 apart, below the threshold where they
|
|
48
|
+
read as different at all. Every group a user reads against itself (core UI,
|
|
49
|
+
the agent palette, syntax, thinking levels, diff) now holds ΔE 11 or better,
|
|
50
|
+
up from 0.0 at worst.
|
|
51
|
+
- **`colorsafe-light` now delivers what its name promises.** It picked
|
|
52
|
+
color-blind-safe hues, but those palettes lean on lightness differences and
|
|
53
|
+
darkening every token for AAA removed exactly that. Simulated, `error` and
|
|
54
|
+
`warning` were ΔE 2.8 apart under deuteranopia, `syntaxFunction` and
|
|
55
|
+
`syntaxNumber` were identical, and an added diff line was ΔE 3.1 from
|
|
56
|
+
unchanged context. Its palette is rebuilt on blue/violet/magenta, where every
|
|
57
|
+
semantic pair now holds ΔE 12 or better under all three dichromat
|
|
58
|
+
simulations. The theme's `vars` are renamed to describe the colors they
|
|
59
|
+
actually hold, and its description no longer claims Okabe-Ito hues.
|
|
60
|
+
|
|
61
|
+
### Known limitations
|
|
62
|
+
|
|
63
|
+
- `colorsafe-dark` still shares one color between `mcp` and `agent2`. Six agent
|
|
64
|
+
identities already spend the color-blind-safe hues available at AAA on a dark
|
|
65
|
+
ground, and every remaining candidate degenerates to near-white, which reads
|
|
66
|
+
as plain text. Tracked in `theme-contrast.test.ts` rather than papered over.
|
|
67
|
+
- In 256-color terminals (Apple Terminal, GNU screen), `warm-light` draws
|
|
68
|
+
`accent` and `warning` with the same palette index. The 6x6x6 cube has almost
|
|
69
|
+
no resolution below channel value 135, so any palette dark enough for AAA on
|
|
70
|
+
white loses distinctions there. The default `light` theme is checked against
|
|
71
|
+
this and stays clear; the AAA themes cannot be.
|
|
72
|
+
|
|
3
73
|
## [0.5.5] - 2026-08-10
|
|
4
74
|
|
|
5
75
|
### Added
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAiC,MAAM,0BAA0B,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AA2FxF;;;GAGG;AACH,qBAAa,eAAgB,YAAW,SAAS;IAI/C,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;IAJnB,OAAO,CAAC,kBAAkB,CAAQ;IAElC,YACS,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,0BAA0B,EAC3C;IAEJ,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAEtC;IAED,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE5C;IAED;;;OAGG;IACH,UAAU,IAAI,IAAI,CAEjB;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,CAEd;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA+I9B;CACD","sourcesContent":["import { type Component, truncateToWidth, visibleWidth } from \"@kolisachint/hoocode-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.js\";\nimport { sumAssistantUsage } from \"../../../core/agent-session-stats.js\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.js\";\nimport { formatTokens } from \"../../../core/format-tokens.js\";\nimport { type StartupProgress, startupProgress } from \"../../../core/startup-progress.js\";\nimport { taskStore } from \"../../../core/task-store.js\";\nimport { BRAND_MARK, GIT_BRANCH_GLYPH } from \"../brand.js\";\nimport { theme } from \"../theme/theme.js\";\n\n/**\n * Assemble one footer line: `left` flush left, `right` flush right when it fits\n * (≥2 cols between), padded to the full width. When it doesn't fit, drop `right`\n * and pad; when even `left` overflows, truncate it. Width math runs on the plain\n * strings; the styled strings carry the colour. Every returned line is exactly\n * `width` cells or fewer — the invariant the footer-width tests hold us to.\n */\nfunction assembleLine(width: number, leftPlain: string, leftStyled: string, rightPlain = \"\", rightStyled = \"\"): string {\n\tconst lw = visibleWidth(leftPlain);\n\tif (rightPlain && lw + 2 + visibleWidth(rightPlain) <= width) {\n\t\treturn leftStyled + \" \".repeat(width - lw - visibleWidth(rightPlain)) + rightStyled;\n\t}\n\tif (lw <= width) return leftStyled + \" \".repeat(width - lw);\n\treturn truncateToWidth(leftStyled, width, theme.fg(\"dim\", \"…\"));\n}\n\n/** A compact context-fill gauge, coloured by proximity to the auto-compact trip point. */\nfunction contextGauge(percent: number, errorLevel: number, warnLevel: number): { plain: string; styled: string } {\n\tconst CELLS = 8;\n\tconst filled = Math.max(0, Math.min(CELLS, Math.round((percent / 100) * CELLS)));\n\tconst fill = \"▰\".repeat(filled);\n\tconst track = \"▱\".repeat(CELLS - filled);\n\tconst color = percent >= errorLevel ? \"error\" : percent >= warnLevel ? \"warning\" : \"accent\";\n\treturn { plain: fill + track, styled: theme.fg(color, fill) + theme.fg(\"dim\", track) };\n}\n\n/** Count subagent runs currently in flight, for the footer's live delegation cue. */\nfunction activeSubagentCount(): number {\n\treturn taskStore.list().filter((t) => t.source === \"subagent\" && t.status === \"in_progress\").length;\n}\n\n/**\n * Sanitize text for display in a single-line status.\n * Removes newlines, tabs, carriage returns, and other control characters.\n */\nfunction sanitizeStatusText(text: string): string {\n\t// Replace newlines, tabs, carriage returns with space, then collapse multiple spaces\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\n/** Cells in a startup-progress bar; compact so several tools fit the footer. */\nconst STARTUP_BAR_CELLS = 12;\n\nfunction formatMb(bytes: number): string {\n\treturn `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * One footer line for a transient startup-progress entry (tool download or\n * index build), styled like the voice download bar: a `·` fill over a dim\n * track with percent and a `received / total` (or `done/total`) detail. An\n * indeterminate download (no Content-Length) drops the bar for a running byte\n * count; an error entry renders as a dim message. Returns a styled string; the\n * caller width-clamps it.\n */\nfunction renderStartupLine(entry: StartupProgress): string {\n\tif (entry.kind === \"error\") {\n\t\treturn theme.fg(\"dim\", `${entry.label}: ${entry.message}`);\n\t}\n\tconst label = theme.fg(\"text\", entry.label);\n\tif (entry.kind === \"download\") {\n\t\tif (entry.totalBytes === null || entry.totalBytes <= 0) {\n\t\t\treturn `${label} ${theme.fg(\"dim\", `${formatMb(entry.receivedBytes)}…`)}`;\n\t\t}\n\t\tconst detail = `${formatMb(entry.receivedBytes)} / ${formatMb(entry.totalBytes)}`;\n\t\treturn `${label} ${determinateBar(entry.receivedBytes / entry.totalBytes, detail)}`;\n\t}\n\tconst detail = `${entry.done}/${entry.total} ${entry.unit}`;\n\tconst ratio = entry.total > 0 ? entry.done / entry.total : 0;\n\treturn `${label} ${determinateBar(ratio, detail)}`;\n}\n\n/** `·`-fill bar + percent + trailing detail, matching the voice download bar. */\nfunction determinateBar(ratio: number, detail: string): string {\n\tconst clamped = Math.max(0, Math.min(1, ratio));\n\tconst filled = Math.round(clamped * STARTUP_BAR_CELLS);\n\tconst bar = theme.fg(\"accent\", \"·\".repeat(filled)) + theme.fg(\"dim\", \"·\".repeat(STARTUP_BAR_CELLS - filled));\n\tconst pct = `${Math.round(clamped * 100)}%`;\n\treturn `${bar} ${theme.fg(\"muted\", pct)} ${theme.fg(\"dim\", `· ${detail}`)}`;\n}\n\n/**\n * Footer component that shows pwd, token stats, and context usage.\n * Computes token/context stats from session, gets git branch and extension statuses from provider.\n */\nexport class FooterComponent implements Component {\n\tprivate autoCompactEnabled = true;\n\n\tconstructor(\n\t\tprivate session: AgentSession,\n\t\tprivate footerData: ReadonlyFooterDataProvider,\n\t) {}\n\n\tsetSession(session: AgentSession): void {\n\t\tthis.session = session;\n\t}\n\n\tsetAutoCompactEnabled(enabled: boolean): void {\n\t\tthis.autoCompactEnabled = enabled;\n\t}\n\n\t/**\n\t * No-op: git branch caching now handled by provider.\n\t * Kept for compatibility with existing call sites in interactive-mode.\n\t */\n\tinvalidate(): void {\n\t\t// No-op: git branch is cached/invalidated by provider\n\t}\n\n\t/**\n\t * Clean up resources.\n\t * Git watcher cleanup now handled by provider.\n\t */\n\tdispose(): void {\n\t\t// Git watcher cleanup handled by provider\n\t}\n\n\trender(width: number): string[] {\n\t\tconst state = this.session.state;\n\n\t\t// Cumulative usage across ALL session entries (not just post-compaction\n\t\t// messages). Shares sumAssistantUsage with the per-request cost line the\n\t\t// transcript prints at agent_end, so the footer total and that line are always\n\t\t// derived from the same accounting.\n\t\tconst {\n\t\t\tinput: totalInput,\n\t\t\toutput: totalOutput,\n\t\t\tcacheRead: totalCacheRead,\n\t\t\tcacheWrite: totalCacheWrite,\n\t\t\tcost: totalCost,\n\t\t} = sumAssistantUsage(this.session.sessionManager.getEntries());\n\n\t\t// Calculate context usage from session (handles compaction correctly).\n\t\t// After compaction, tokens are unknown until the next LLM response.\n\t\tconst contextUsage = this.session.getContextUsage();\n\t\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\t\tconst contextPercentValue = contextUsage?.percent ?? 0;\n\t\tconst contextPercent = contextUsage?.percent !== null ? contextPercentValue.toFixed(1) : \"?\";\n\n\t\t// Replace home directory with ~\n\t\tlet pwd = this.session.sessionManager.getCwd();\n\t\tconst home = process.env.HOME || process.env.USERPROFILE;\n\t\tif (home && pwd.startsWith(home)) {\n\t\t\tpwd = `~${pwd.slice(home.length)}`;\n\t\t}\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\t\tconst modeLabel = this.footerData.getActiveMode();\n\n\t\t// ── Line 1 — identity & location ────────────────────────────────────────\n\t\t// Lead with the brand mark + MODE (the agent's guardrail: Ask/Plan/Build/\n\t\t// Debug) in bold accent so it is the first thing the eye lands on, then the\n\t\t// path, git branch, and session name in descending emphasis. The live\n\t\t// subagent count sits flush right — present only while work is delegated.\n\t\tconst modeUp = modeLabel.toUpperCase();\n\t\tconst brand = `${BRAND_MARK} ${modeUp}`;\n\t\tlet l1Plain = `${brand} ${pwd}`;\n\t\tlet l1Styled = `${theme.bold(theme.fg(\"accent\", brand))} ${theme.fg(\"muted\", pwd)}`;\n\t\tif (branch) {\n\t\t\tl1Plain += ` ${GIT_BRANCH_GLYPH} ${branch}`;\n\t\t\tl1Styled += ` ${theme.fg(\"dim\", GIT_BRANCH_GLYPH)} ${theme.fg(\"muted\", branch)}`;\n\t\t}\n\t\tif (sessionName) {\n\t\t\tl1Plain += ` • ${sessionName}`;\n\t\t\tl1Styled += theme.fg(\"dim\", ` • ${sessionName}`);\n\t\t}\n\t\tconst nSub = activeSubagentCount();\n\t\tconst l1RightPlain = nSub > 0 ? `◇${nSub} running` : \"\";\n\t\tconst l1RightStyled = nSub > 0 ? theme.fg(\"accent\", `◇${nSub}`) + theme.fg(\"dim\", \" running\") : \"\";\n\t\tconst line1 = assembleLine(width, l1Plain, l1Styled, l1RightPlain, l1RightStyled);\n\n\t\t// ── Line 2 — session vitals ─────────────────────────────────────────────\n\t\t// A context-fill gauge (coloured by proximity to the auto-compact trip\n\t\t// point) leads, then token/cost deltas, with the model + thinking level\n\t\t// flush right. Numbers read in muted, labels/arrows in dim — a legible\n\t\t// hierarchy in place of the old uniform grey.\n\t\tlet thresholdPercent: number | undefined;\n\t\tif (this.autoCompactEnabled && contextWindow > 0) {\n\t\t\tconst reserveTokens = this.session.settingsManager.getCompactionSettings().reserveTokens;\n\t\t\tconst effective = contextWindow - reserveTokens;\n\t\t\tif (effective > 0) thresholdPercent = (effective / contextWindow) * 100;\n\t\t}\n\t\tconst errorLevel = thresholdPercent !== undefined ? thresholdPercent - 3 : 90;\n\t\tconst warnLevel = thresholdPercent !== undefined ? thresholdPercent - 10 : 70;\n\t\tconst autoIndicator =\n\t\t\tthresholdPercent !== undefined\n\t\t\t\t? ` auto@${thresholdPercent.toFixed(0)}%`\n\t\t\t\t: this.autoCompactEnabled\n\t\t\t\t\t? \" auto\"\n\t\t\t\t\t: \"\";\n\n\t\tconst gauge = contextGauge(contextPercentValue, errorLevel, warnLevel);\n\t\tconst pctText = contextPercent === \"?\" ? \"?\" : `${contextPercent}%`;\n\t\tconst pctColor =\n\t\t\tcontextPercentValue >= errorLevel ? \"error\" : contextPercentValue >= warnLevel ? \"warning\" : \"muted\";\n\t\tconst winText = `${formatTokens(contextWindow)}${autoIndicator}`;\n\n\t\tconst segs: Array<{ plain: string; styled: string }> = [\n\t\t\t{\n\t\t\t\tplain: `${gauge.plain} ${pctText} ${winText}`,\n\t\t\t\tstyled: `${gauge.styled} ${theme.fg(pctColor, pctText)} ${theme.fg(\"dim\", winText)}`,\n\t\t\t},\n\t\t];\n\t\tconst arrow = (a: string, n: number) => ({\n\t\t\tplain: `${a}${formatTokens(n)}`,\n\t\t\tstyled: theme.fg(\"dim\", a) + theme.fg(\"muted\", formatTokens(n)),\n\t\t});\n\t\tif (totalInput) segs.push(arrow(\"↑\", totalInput));\n\t\tif (totalOutput) segs.push(arrow(\"↓\", totalOutput));\n\t\tif (totalCacheRead) segs.push(arrow(\"R\", totalCacheRead));\n\t\tif (totalCacheWrite) segs.push(arrow(\"W\", totalCacheWrite));\n\t\tconst usingSubscription = state.model ? this.session.modelRegistry.isUsingOAuth(state.model) : false;\n\t\tif (totalCost || usingSubscription) {\n\t\t\tconst costStr = `$${totalCost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`;\n\t\t\tsegs.push({ plain: costStr, styled: theme.fg(\"muted\", costStr) });\n\t\t}\n\t\tconst l2Plain = segs.map((s) => s.plain).join(\" \");\n\t\tconst l2Styled = segs.map((s) => s.styled).join(\" \");\n\n\t\t// Right: model, thinking level, and provider (when several are configured).\n\t\tconst modelName = state.model?.id || \"no-model\";\n\t\tlet r2Plain = modelName;\n\t\tlet r2Styled = theme.fg(\"muted\", modelName);\n\t\tif (state.model?.reasoning) {\n\t\t\tconst tl = state.thinkingLevel || \"off\";\n\t\t\tconst tstr = tl === \"off\" ? \"thinking off\" : tl;\n\t\t\tr2Plain += ` • ${tstr}`;\n\t\t\tr2Styled += theme.fg(\"dim\", ` • ${tstr}`);\n\t\t}\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\t// Prepend the provider only when the whole right cluster still fits.\n\t\t\tconst withProv = `(${state.model.provider}) ${r2Plain}`;\n\t\t\tif (visibleWidth(l2Plain) + 2 + visibleWidth(withProv) <= width) {\n\t\t\t\tr2Plain = withProv;\n\t\t\t\tr2Styled = theme.fg(\"dim\", `(${state.model.provider}) `) + r2Styled;\n\t\t\t}\n\t\t}\n\t\tconst line2 = assembleLine(width, l2Plain, l2Styled, r2Plain, r2Styled);\n\n\t\tconst lines = [line1, line2];\n\n\t\t// Add extension statuses on a single line, sorted by key alphabetically\n\t\tconst extensionStatuses = this.footerData.getExtensionStatuses();\n\t\tif (extensionStatuses.size > 0) {\n\t\t\tconst sortedStatuses = Array.from(extensionStatuses.entries())\n\t\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t\t.map(([, text]) => sanitizeStatusText(text));\n\t\t\tconst statusLine = sortedStatuses.join(\" \");\n\t\t\t// Truncate to terminal width with dim ellipsis for consistency with footer style\n\t\t\tlines.push(truncateToWidth(statusLine, width, theme.fg(\"dim\", \"...\")));\n\t\t}\n\n\t\t// Transient startup progress (first-run tool downloads, index build): one\n\t\t// determinate bar per entry, cleared as each settles. Width-clamped like the\n\t\t// status line so the footer never overflows.\n\t\tfor (const entry of startupProgress.list()) {\n\t\t\tlines.push(truncateToWidth(renderStartupLine(entry), width, theme.fg(\"dim\", \"…\")));\n\t\t}\n\n\t\treturn lines;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAiC,MAAM,0BAA0B,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AA2FxF;;;GAGG;AACH,qBAAa,eAAgB,YAAW,SAAS;IAI/C,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;IAJnB,OAAO,CAAC,kBAAkB,CAAQ;IAElC,YACS,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,0BAA0B,EAC3C;IAEJ,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAEtC;IAED,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE5C;IAED;;;OAGG;IACH,UAAU,IAAI,IAAI,CAEjB;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,CAEd;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAsJ9B;CACD","sourcesContent":["import { type Component, truncateToWidth, visibleWidth } from \"@kolisachint/hoocode-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.js\";\nimport { sumAssistantUsage } from \"../../../core/agent-session-stats.js\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.js\";\nimport { formatTokens } from \"../../../core/format-tokens.js\";\nimport { type StartupProgress, startupProgress } from \"../../../core/startup-progress.js\";\nimport { taskStore } from \"../../../core/task-store.js\";\nimport { BRAND_MARK, GIT_BRANCH_GLYPH } from \"../brand.js\";\nimport { theme } from \"../theme/theme.js\";\n\n/**\n * Assemble one footer line: `left` flush left, `right` flush right when it fits\n * (≥2 cols between), padded to the full width. When it doesn't fit, drop `right`\n * and pad; when even `left` overflows, truncate it. Width math runs on the plain\n * strings; the styled strings carry the colour. Every returned line is exactly\n * `width` cells or fewer — the invariant the footer-width tests hold us to.\n */\nfunction assembleLine(width: number, leftPlain: string, leftStyled: string, rightPlain = \"\", rightStyled = \"\"): string {\n\tconst lw = visibleWidth(leftPlain);\n\tif (rightPlain && lw + 2 + visibleWidth(rightPlain) <= width) {\n\t\treturn leftStyled + \" \".repeat(width - lw - visibleWidth(rightPlain)) + rightStyled;\n\t}\n\tif (lw <= width) return leftStyled + \" \".repeat(width - lw);\n\treturn truncateToWidth(leftStyled, width, theme.fg(\"dim\", \"…\"));\n}\n\n/** A compact context-fill gauge, coloured by proximity to the auto-compact trip point. */\nfunction contextGauge(percent: number, errorLevel: number, warnLevel: number): { plain: string; styled: string } {\n\tconst CELLS = 8;\n\tconst filled = Math.max(0, Math.min(CELLS, Math.round((percent / 100) * CELLS)));\n\tconst fill = \"▰\".repeat(filled);\n\tconst track = \"▱\".repeat(CELLS - filled);\n\tconst color = percent >= errorLevel ? \"error\" : percent >= warnLevel ? \"warning\" : \"accent\";\n\treturn { plain: fill + track, styled: theme.fg(color, fill) + theme.fg(\"dim\", track) };\n}\n\n/** Count subagent runs currently in flight, for the footer's live delegation cue. */\nfunction activeSubagentCount(): number {\n\treturn taskStore.list().filter((t) => t.source === \"subagent\" && t.status === \"in_progress\").length;\n}\n\n/**\n * Sanitize text for display in a single-line status.\n * Removes newlines, tabs, carriage returns, and other control characters.\n */\nfunction sanitizeStatusText(text: string): string {\n\t// Replace newlines, tabs, carriage returns with space, then collapse multiple spaces\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\n/** Cells in a startup-progress bar; compact so several tools fit the footer. */\nconst STARTUP_BAR_CELLS = 12;\n\nfunction formatMb(bytes: number): string {\n\treturn `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * One footer line for a transient startup-progress entry (tool download or\n * index build), styled like the voice download bar: a `·` fill over a dim\n * track with percent and a `received / total` (or `done/total`) detail. An\n * indeterminate download (no Content-Length) drops the bar for a running byte\n * count; an error entry renders as a dim message. Returns a styled string; the\n * caller width-clamps it.\n */\nfunction renderStartupLine(entry: StartupProgress): string {\n\tif (entry.kind === \"error\") {\n\t\treturn theme.fg(\"dim\", `${entry.label}: ${entry.message}`);\n\t}\n\tconst label = theme.fg(\"text\", entry.label);\n\tif (entry.kind === \"download\") {\n\t\tif (entry.totalBytes === null || entry.totalBytes <= 0) {\n\t\t\treturn `${label} ${theme.fg(\"dim\", `${formatMb(entry.receivedBytes)}…`)}`;\n\t\t}\n\t\tconst detail = `${formatMb(entry.receivedBytes)} / ${formatMb(entry.totalBytes)}`;\n\t\treturn `${label} ${determinateBar(entry.receivedBytes / entry.totalBytes, detail)}`;\n\t}\n\tconst detail = `${entry.done}/${entry.total} ${entry.unit}`;\n\tconst ratio = entry.total > 0 ? entry.done / entry.total : 0;\n\treturn `${label} ${determinateBar(ratio, detail)}`;\n}\n\n/** `·`-fill bar + percent + trailing detail, matching the voice download bar. */\nfunction determinateBar(ratio: number, detail: string): string {\n\tconst clamped = Math.max(0, Math.min(1, ratio));\n\tconst filled = Math.round(clamped * STARTUP_BAR_CELLS);\n\tconst bar = theme.fg(\"accent\", \"·\".repeat(filled)) + theme.fg(\"dim\", \"·\".repeat(STARTUP_BAR_CELLS - filled));\n\tconst pct = `${Math.round(clamped * 100)}%`;\n\treturn `${bar} ${theme.fg(\"muted\", pct)} ${theme.fg(\"dim\", `· ${detail}`)}`;\n}\n\n/**\n * Footer component that shows pwd, token stats, and context usage.\n * Computes token/context stats from session, gets git branch and extension statuses from provider.\n */\nexport class FooterComponent implements Component {\n\tprivate autoCompactEnabled = true;\n\n\tconstructor(\n\t\tprivate session: AgentSession,\n\t\tprivate footerData: ReadonlyFooterDataProvider,\n\t) {}\n\n\tsetSession(session: AgentSession): void {\n\t\tthis.session = session;\n\t}\n\n\tsetAutoCompactEnabled(enabled: boolean): void {\n\t\tthis.autoCompactEnabled = enabled;\n\t}\n\n\t/**\n\t * No-op: git branch caching now handled by provider.\n\t * Kept for compatibility with existing call sites in interactive-mode.\n\t */\n\tinvalidate(): void {\n\t\t// No-op: git branch is cached/invalidated by provider\n\t}\n\n\t/**\n\t * Clean up resources.\n\t * Git watcher cleanup now handled by provider.\n\t */\n\tdispose(): void {\n\t\t// Git watcher cleanup handled by provider\n\t}\n\n\trender(width: number): string[] {\n\t\tconst state = this.session.state;\n\n\t\t// Cumulative usage across ALL session entries (not just post-compaction\n\t\t// messages). Shares sumAssistantUsage with the per-request cost line the\n\t\t// transcript prints at agent_end, so the footer total and that line are always\n\t\t// derived from the same accounting.\n\t\tconst {\n\t\t\tinput: totalInput,\n\t\t\toutput: totalOutput,\n\t\t\tcacheRead: totalCacheRead,\n\t\t\tcacheWrite: totalCacheWrite,\n\t\t\tcost: totalCost,\n\t\t} = sumAssistantUsage(this.session.sessionManager.getEntries());\n\n\t\t// Calculate context usage from session (handles compaction correctly).\n\t\t// After compaction, tokens are unknown until the next LLM response.\n\t\tconst contextUsage = this.session.getContextUsage();\n\t\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\t\tconst contextPercentValue = contextUsage?.percent ?? 0;\n\t\tconst contextPercent = contextUsage?.percent !== null ? contextPercentValue.toFixed(1) : \"?\";\n\n\t\t// Replace home directory with ~\n\t\tlet pwd = this.session.sessionManager.getCwd();\n\t\tconst home = process.env.HOME || process.env.USERPROFILE;\n\t\tif (home && pwd.startsWith(home)) {\n\t\t\tpwd = `~${pwd.slice(home.length)}`;\n\t\t}\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\t\tconst modeLabel = this.footerData.getActiveMode();\n\n\t\t// ── Line 1 — identity & location ────────────────────────────────────────\n\t\t// Lead with the brand mark + MODE (the agent's guardrail: Ask/Plan/Build/\n\t\t// Debug) in bold accent so it is the first thing the eye lands on, then the\n\t\t// path, git branch, and session name in descending emphasis. The live\n\t\t// subagent count sits flush right — present only while work is delegated.\n\t\tconst modeUp = modeLabel.toUpperCase();\n\t\t// Themes that define the brandBg/brandText pair paint the mark as a filled\n\t\t// chip; the padding lives in the plain string too so width math and\n\t\t// truncation stay honest. Themes without the pair keep accent-coloured text.\n\t\tconst chip = theme.hasBg(\"brandBg\") && theme.has(\"brandText\");\n\t\tconst brand = chip ? ` ${BRAND_MARK} ${modeUp} ` : `${BRAND_MARK} ${modeUp}`;\n\t\tlet l1Plain = `${brand} ${pwd}`;\n\t\tconst brandStyled = chip\n\t\t\t? theme.bg(\"brandBg\", theme.bold(theme.fg(\"brandText\", brand)))\n\t\t\t: theme.bold(theme.fg(\"accent\", brand));\n\t\tlet l1Styled = `${brandStyled} ${theme.fg(\"muted\", pwd)}`;\n\t\tif (branch) {\n\t\t\tl1Plain += ` ${GIT_BRANCH_GLYPH} ${branch}`;\n\t\t\tl1Styled += ` ${theme.fg(\"dim\", GIT_BRANCH_GLYPH)} ${theme.fg(\"muted\", branch)}`;\n\t\t}\n\t\tif (sessionName) {\n\t\t\tl1Plain += ` • ${sessionName}`;\n\t\t\tl1Styled += theme.fg(\"dim\", ` • ${sessionName}`);\n\t\t}\n\t\tconst nSub = activeSubagentCount();\n\t\tconst l1RightPlain = nSub > 0 ? `◇${nSub} running` : \"\";\n\t\tconst l1RightStyled = nSub > 0 ? theme.fg(\"accent\", `◇${nSub}`) + theme.fg(\"dim\", \" running\") : \"\";\n\t\tconst line1 = assembleLine(width, l1Plain, l1Styled, l1RightPlain, l1RightStyled);\n\n\t\t// ── Line 2 — session vitals ─────────────────────────────────────────────\n\t\t// A context-fill gauge (coloured by proximity to the auto-compact trip\n\t\t// point) leads, then token/cost deltas, with the model + thinking level\n\t\t// flush right. Numbers read in muted, labels/arrows in dim — a legible\n\t\t// hierarchy in place of the old uniform grey.\n\t\tlet thresholdPercent: number | undefined;\n\t\tif (this.autoCompactEnabled && contextWindow > 0) {\n\t\t\tconst reserveTokens = this.session.settingsManager.getCompactionSettings().reserveTokens;\n\t\t\tconst effective = contextWindow - reserveTokens;\n\t\t\tif (effective > 0) thresholdPercent = (effective / contextWindow) * 100;\n\t\t}\n\t\tconst errorLevel = thresholdPercent !== undefined ? thresholdPercent - 3 : 90;\n\t\tconst warnLevel = thresholdPercent !== undefined ? thresholdPercent - 10 : 70;\n\t\tconst autoIndicator =\n\t\t\tthresholdPercent !== undefined\n\t\t\t\t? ` auto@${thresholdPercent.toFixed(0)}%`\n\t\t\t\t: this.autoCompactEnabled\n\t\t\t\t\t? \" auto\"\n\t\t\t\t\t: \"\";\n\n\t\tconst gauge = contextGauge(contextPercentValue, errorLevel, warnLevel);\n\t\tconst pctText = contextPercent === \"?\" ? \"?\" : `${contextPercent}%`;\n\t\tconst pctColor =\n\t\t\tcontextPercentValue >= errorLevel ? \"error\" : contextPercentValue >= warnLevel ? \"warning\" : \"muted\";\n\t\tconst winText = `${formatTokens(contextWindow)}${autoIndicator}`;\n\n\t\tconst segs: Array<{ plain: string; styled: string }> = [\n\t\t\t{\n\t\t\t\tplain: `${gauge.plain} ${pctText} ${winText}`,\n\t\t\t\tstyled: `${gauge.styled} ${theme.fg(pctColor, pctText)} ${theme.fg(\"dim\", winText)}`,\n\t\t\t},\n\t\t];\n\t\tconst arrow = (a: string, n: number) => ({\n\t\t\tplain: `${a}${formatTokens(n)}`,\n\t\t\tstyled: theme.fg(\"dim\", a) + theme.fg(\"muted\", formatTokens(n)),\n\t\t});\n\t\tif (totalInput) segs.push(arrow(\"↑\", totalInput));\n\t\tif (totalOutput) segs.push(arrow(\"↓\", totalOutput));\n\t\tif (totalCacheRead) segs.push(arrow(\"R\", totalCacheRead));\n\t\tif (totalCacheWrite) segs.push(arrow(\"W\", totalCacheWrite));\n\t\tconst usingSubscription = state.model ? this.session.modelRegistry.isUsingOAuth(state.model) : false;\n\t\tif (totalCost || usingSubscription) {\n\t\t\tconst costStr = `$${totalCost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`;\n\t\t\tsegs.push({ plain: costStr, styled: theme.fg(\"muted\", costStr) });\n\t\t}\n\t\tconst l2Plain = segs.map((s) => s.plain).join(\" \");\n\t\tconst l2Styled = segs.map((s) => s.styled).join(\" \");\n\n\t\t// Right: model, thinking level, and provider (when several are configured).\n\t\tconst modelName = state.model?.id || \"no-model\";\n\t\tlet r2Plain = modelName;\n\t\tlet r2Styled = theme.fg(\"muted\", modelName);\n\t\tif (state.model?.reasoning) {\n\t\t\tconst tl = state.thinkingLevel || \"off\";\n\t\t\tconst tstr = tl === \"off\" ? \"thinking off\" : tl;\n\t\t\tr2Plain += ` • ${tstr}`;\n\t\t\tr2Styled += theme.fg(\"dim\", ` • ${tstr}`);\n\t\t}\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\t// Prepend the provider only when the whole right cluster still fits.\n\t\t\tconst withProv = `(${state.model.provider}) ${r2Plain}`;\n\t\t\tif (visibleWidth(l2Plain) + 2 + visibleWidth(withProv) <= width) {\n\t\t\t\tr2Plain = withProv;\n\t\t\t\tr2Styled = theme.fg(\"dim\", `(${state.model.provider}) `) + r2Styled;\n\t\t\t}\n\t\t}\n\t\tconst line2 = assembleLine(width, l2Plain, l2Styled, r2Plain, r2Styled);\n\n\t\tconst lines = [line1, line2];\n\n\t\t// Add extension statuses on a single line, sorted by key alphabetically\n\t\tconst extensionStatuses = this.footerData.getExtensionStatuses();\n\t\tif (extensionStatuses.size > 0) {\n\t\t\tconst sortedStatuses = Array.from(extensionStatuses.entries())\n\t\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t\t.map(([, text]) => sanitizeStatusText(text));\n\t\t\tconst statusLine = sortedStatuses.join(\" \");\n\t\t\t// Truncate to terminal width with dim ellipsis for consistency with footer style\n\t\t\tlines.push(truncateToWidth(statusLine, width, theme.fg(\"dim\", \"...\")));\n\t\t}\n\n\t\t// Transient startup progress (first-run tool downloads, index build): one\n\t\t// determinate bar per entry, cleared as each settles. Width-clamped like the\n\t\t// status line so the footer never overflows.\n\t\tfor (const entry of startupProgress.list()) {\n\t\t\tlines.push(truncateToWidth(renderStartupLine(entry), width, theme.fg(\"dim\", \"…\")));\n\t\t}\n\n\t\treturn lines;\n\t}\n}\n"]}
|
|
@@ -142,9 +142,16 @@ export class FooterComponent {
|
|
|
142
142
|
// path, git branch, and session name in descending emphasis. The live
|
|
143
143
|
// subagent count sits flush right — present only while work is delegated.
|
|
144
144
|
const modeUp = modeLabel.toUpperCase();
|
|
145
|
-
|
|
145
|
+
// Themes that define the brandBg/brandText pair paint the mark as a filled
|
|
146
|
+
// chip; the padding lives in the plain string too so width math and
|
|
147
|
+
// truncation stay honest. Themes without the pair keep accent-coloured text.
|
|
148
|
+
const chip = theme.hasBg("brandBg") && theme.has("brandText");
|
|
149
|
+
const brand = chip ? ` ${BRAND_MARK} ${modeUp} ` : `${BRAND_MARK} ${modeUp}`;
|
|
146
150
|
let l1Plain = `${brand} ${pwd}`;
|
|
147
|
-
|
|
151
|
+
const brandStyled = chip
|
|
152
|
+
? theme.bg("brandBg", theme.bold(theme.fg("brandText", brand)))
|
|
153
|
+
: theme.bold(theme.fg("accent", brand));
|
|
154
|
+
let l1Styled = `${brandStyled} ${theme.fg("muted", pwd)}`;
|
|
148
155
|
if (branch) {
|
|
149
156
|
l1Plain += ` ${GIT_BRANCH_GLYPH} ${branch}`;
|
|
150
157
|
l1Styled += ` ${theme.fg("dim", GIT_BRANCH_GLYPH)} ${theme.fg("muted", branch)}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,eAAe,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAwB,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,M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AC,eAAe,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAG,CAAC,CAAC,CAAC,CAAC;QACpF,CAAC;QAED,OAAO,KAAK,CAAC;IAAA,CACb;CACD","sourcesContent":["import { type Component, truncateToWidth, visibleWidth } from \"@kolisachint/hoocode-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.js\";\nimport { sumAssistantUsage } from \"../../../core/agent-session-stats.js\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.js\";\nimport { formatTokens } from \"../../../core/format-tokens.js\";\nimport { type StartupProgress, startupProgress } from \"../../../core/startup-progress.js\";\nimport { taskStore } from \"../../../core/task-store.js\";\nimport { BRAND_MARK, GIT_BRANCH_GLYPH } from \"../brand.js\";\nimport { theme } from \"../theme/theme.js\";\n\n/**\n * Assemble one footer line: `left` flush left, `right` flush right when it fits\n * (≥2 cols between), padded to the full width. When it doesn't fit, drop `right`\n * and pad; when even `left` overflows, truncate it. Width math runs on the plain\n * strings; the styled strings carry the colour. Every returned line is exactly\n * `width` cells or fewer — the invariant the footer-width tests hold us to.\n */\nfunction assembleLine(width: number, leftPlain: string, leftStyled: string, rightPlain = \"\", rightStyled = \"\"): string {\n\tconst lw = visibleWidth(leftPlain);\n\tif (rightPlain && lw + 2 + visibleWidth(rightPlain) <= width) {\n\t\treturn leftStyled + \" \".repeat(width - lw - visibleWidth(rightPlain)) + rightStyled;\n\t}\n\tif (lw <= width) return leftStyled + \" \".repeat(width - lw);\n\treturn truncateToWidth(leftStyled, width, theme.fg(\"dim\", \"…\"));\n}\n\n/** A compact context-fill gauge, coloured by proximity to the auto-compact trip point. */\nfunction contextGauge(percent: number, errorLevel: number, warnLevel: number): { plain: string; styled: string } {\n\tconst CELLS = 8;\n\tconst filled = Math.max(0, Math.min(CELLS, Math.round((percent / 100) * CELLS)));\n\tconst fill = \"▰\".repeat(filled);\n\tconst track = \"▱\".repeat(CELLS - filled);\n\tconst color = percent >= errorLevel ? \"error\" : percent >= warnLevel ? \"warning\" : \"accent\";\n\treturn { plain: fill + track, styled: theme.fg(color, fill) + theme.fg(\"dim\", track) };\n}\n\n/** Count subagent runs currently in flight, for the footer's live delegation cue. */\nfunction activeSubagentCount(): number {\n\treturn taskStore.list().filter((t) => t.source === \"subagent\" && t.status === \"in_progress\").length;\n}\n\n/**\n * Sanitize text for display in a single-line status.\n * Removes newlines, tabs, carriage returns, and other control characters.\n */\nfunction sanitizeStatusText(text: string): string {\n\t// Replace newlines, tabs, carriage returns with space, then collapse multiple spaces\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\n/** Cells in a startup-progress bar; compact so several tools fit the footer. */\nconst STARTUP_BAR_CELLS = 12;\n\nfunction formatMb(bytes: number): string {\n\treturn `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * One footer line for a transient startup-progress entry (tool download or\n * index build), styled like the voice download bar: a `·` fill over a dim\n * track with percent and a `received / total` (or `done/total`) detail. An\n * indeterminate download (no Content-Length) drops the bar for a running byte\n * count; an error entry renders as a dim message. Returns a styled string; the\n * caller width-clamps it.\n */\nfunction renderStartupLine(entry: StartupProgress): string {\n\tif (entry.kind === \"error\") {\n\t\treturn theme.fg(\"dim\", `${entry.label}: ${entry.message}`);\n\t}\n\tconst label = theme.fg(\"text\", entry.label);\n\tif (entry.kind === \"download\") {\n\t\tif (entry.totalBytes === null || entry.totalBytes <= 0) {\n\t\t\treturn `${label} ${theme.fg(\"dim\", `${formatMb(entry.receivedBytes)}…`)}`;\n\t\t}\n\t\tconst detail = `${formatMb(entry.receivedBytes)} / ${formatMb(entry.totalBytes)}`;\n\t\treturn `${label} ${determinateBar(entry.receivedBytes / entry.totalBytes, detail)}`;\n\t}\n\tconst detail = `${entry.done}/${entry.total} ${entry.unit}`;\n\tconst ratio = entry.total > 0 ? entry.done / entry.total : 0;\n\treturn `${label} ${determinateBar(ratio, detail)}`;\n}\n\n/** `·`-fill bar + percent + trailing detail, matching the voice download bar. */\nfunction determinateBar(ratio: number, detail: string): string {\n\tconst clamped = Math.max(0, Math.min(1, ratio));\n\tconst filled = Math.round(clamped * STARTUP_BAR_CELLS);\n\tconst bar = theme.fg(\"accent\", \"·\".repeat(filled)) + theme.fg(\"dim\", \"·\".repeat(STARTUP_BAR_CELLS - filled));\n\tconst pct = `${Math.round(clamped * 100)}%`;\n\treturn `${bar} ${theme.fg(\"muted\", pct)} ${theme.fg(\"dim\", `· ${detail}`)}`;\n}\n\n/**\n * Footer component that shows pwd, token stats, and context usage.\n * Computes token/context stats from session, gets git branch and extension statuses from provider.\n */\nexport class FooterComponent implements Component {\n\tprivate autoCompactEnabled = true;\n\n\tconstructor(\n\t\tprivate session: AgentSession,\n\t\tprivate footerData: ReadonlyFooterDataProvider,\n\t) {}\n\n\tsetSession(session: AgentSession): void {\n\t\tthis.session = session;\n\t}\n\n\tsetAutoCompactEnabled(enabled: boolean): void {\n\t\tthis.autoCompactEnabled = enabled;\n\t}\n\n\t/**\n\t * No-op: git branch caching now handled by provider.\n\t * Kept for compatibility with existing call sites in interactive-mode.\n\t */\n\tinvalidate(): void {\n\t\t// No-op: git branch is cached/invalidated by provider\n\t}\n\n\t/**\n\t * Clean up resources.\n\t * Git watcher cleanup now handled by provider.\n\t */\n\tdispose(): void {\n\t\t// Git watcher cleanup handled by provider\n\t}\n\n\trender(width: number): string[] {\n\t\tconst state = this.session.state;\n\n\t\t// Cumulative usage across ALL session entries (not just post-compaction\n\t\t// messages). Shares sumAssistantUsage with the per-request cost line the\n\t\t// transcript prints at agent_end, so the footer total and that line are always\n\t\t// derived from the same accounting.\n\t\tconst {\n\t\t\tinput: totalInput,\n\t\t\toutput: totalOutput,\n\t\t\tcacheRead: totalCacheRead,\n\t\t\tcacheWrite: totalCacheWrite,\n\t\t\tcost: totalCost,\n\t\t} = sumAssistantUsage(this.session.sessionManager.getEntries());\n\n\t\t// Calculate context usage from session (handles compaction correctly).\n\t\t// After compaction, tokens are unknown until the next LLM response.\n\t\tconst contextUsage = this.session.getContextUsage();\n\t\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\t\tconst contextPercentValue = contextUsage?.percent ?? 0;\n\t\tconst contextPercent = contextUsage?.percent !== null ? contextPercentValue.toFixed(1) : \"?\";\n\n\t\t// Replace home directory with ~\n\t\tlet pwd = this.session.sessionManager.getCwd();\n\t\tconst home = process.env.HOME || process.env.USERPROFILE;\n\t\tif (home && pwd.startsWith(home)) {\n\t\t\tpwd = `~${pwd.slice(home.length)}`;\n\t\t}\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\t\tconst modeLabel = this.footerData.getActiveMode();\n\n\t\t// ── Line 1 — identity & location ────────────────────────────────────────\n\t\t// Lead with the brand mark + MODE (the agent's guardrail: Ask/Plan/Build/\n\t\t// Debug) in bold accent so it is the first thing the eye lands on, then the\n\t\t// path, git branch, and session name in descending emphasis. The live\n\t\t// subagent count sits flush right — present only while work is delegated.\n\t\tconst modeUp = modeLabel.toUpperCase();\n\t\tconst brand = `${BRAND_MARK} ${modeUp}`;\n\t\tlet l1Plain = `${brand} ${pwd}`;\n\t\tlet l1Styled = `${theme.bold(theme.fg(\"accent\", brand))} ${theme.fg(\"muted\", pwd)}`;\n\t\tif (branch) {\n\t\t\tl1Plain += ` ${GIT_BRANCH_GLYPH} ${branch}`;\n\t\t\tl1Styled += ` ${theme.fg(\"dim\", GIT_BRANCH_GLYPH)} ${theme.fg(\"muted\", branch)}`;\n\t\t}\n\t\tif (sessionName) {\n\t\t\tl1Plain += ` • ${sessionName}`;\n\t\t\tl1Styled += theme.fg(\"dim\", ` • ${sessionName}`);\n\t\t}\n\t\tconst nSub = activeSubagentCount();\n\t\tconst l1RightPlain = nSub > 0 ? `◇${nSub} running` : \"\";\n\t\tconst l1RightStyled = nSub > 0 ? theme.fg(\"accent\", `◇${nSub}`) + theme.fg(\"dim\", \" running\") : \"\";\n\t\tconst line1 = assembleLine(width, l1Plain, l1Styled, l1RightPlain, l1RightStyled);\n\n\t\t// ── Line 2 — session vitals ─────────────────────────────────────────────\n\t\t// A context-fill gauge (coloured by proximity to the auto-compact trip\n\t\t// point) leads, then token/cost deltas, with the model + thinking level\n\t\t// flush right. Numbers read in muted, labels/arrows in dim — a legible\n\t\t// hierarchy in place of the old uniform grey.\n\t\tlet thresholdPercent: number | undefined;\n\t\tif (this.autoCompactEnabled && contextWindow > 0) {\n\t\t\tconst reserveTokens = this.session.settingsManager.getCompactionSettings().reserveTokens;\n\t\t\tconst effective = contextWindow - reserveTokens;\n\t\t\tif (effective > 0) thresholdPercent = (effective / contextWindow) * 100;\n\t\t}\n\t\tconst errorLevel = thresholdPercent !== undefined ? thresholdPercent - 3 : 90;\n\t\tconst warnLevel = thresholdPercent !== undefined ? thresholdPercent - 10 : 70;\n\t\tconst autoIndicator =\n\t\t\tthresholdPercent !== undefined\n\t\t\t\t? ` auto@${thresholdPercent.toFixed(0)}%`\n\t\t\t\t: this.autoCompactEnabled\n\t\t\t\t\t? \" auto\"\n\t\t\t\t\t: \"\";\n\n\t\tconst gauge = contextGauge(contextPercentValue, errorLevel, warnLevel);\n\t\tconst pctText = contextPercent === \"?\" ? \"?\" : `${contextPercent}%`;\n\t\tconst pctColor =\n\t\t\tcontextPercentValue >= errorLevel ? \"error\" : contextPercentValue >= warnLevel ? \"warning\" : \"muted\";\n\t\tconst winText = `${formatTokens(contextWindow)}${autoIndicator}`;\n\n\t\tconst segs: Array<{ plain: string; styled: string }> = [\n\t\t\t{\n\t\t\t\tplain: `${gauge.plain} ${pctText} ${winText}`,\n\t\t\t\tstyled: `${gauge.styled} ${theme.fg(pctColor, pctText)} ${theme.fg(\"dim\", winText)}`,\n\t\t\t},\n\t\t];\n\t\tconst arrow = (a: string, n: number) => ({\n\t\t\tplain: `${a}${formatTokens(n)}`,\n\t\t\tstyled: theme.fg(\"dim\", a) + theme.fg(\"muted\", formatTokens(n)),\n\t\t});\n\t\tif (totalInput) segs.push(arrow(\"↑\", totalInput));\n\t\tif (totalOutput) segs.push(arrow(\"↓\", totalOutput));\n\t\tif (totalCacheRead) segs.push(arrow(\"R\", totalCacheRead));\n\t\tif (totalCacheWrite) segs.push(arrow(\"W\", totalCacheWrite));\n\t\tconst usingSubscription = state.model ? this.session.modelRegistry.isUsingOAuth(state.model) : false;\n\t\tif (totalCost || usingSubscription) {\n\t\t\tconst costStr = `$${totalCost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`;\n\t\t\tsegs.push({ plain: costStr, styled: theme.fg(\"muted\", costStr) });\n\t\t}\n\t\tconst l2Plain = segs.map((s) => s.plain).join(\" \");\n\t\tconst l2Styled = segs.map((s) => s.styled).join(\" \");\n\n\t\t// Right: model, thinking level, and provider (when several are configured).\n\t\tconst modelName = state.model?.id || \"no-model\";\n\t\tlet r2Plain = modelName;\n\t\tlet r2Styled = theme.fg(\"muted\", modelName);\n\t\tif (state.model?.reasoning) {\n\t\t\tconst tl = state.thinkingLevel || \"off\";\n\t\t\tconst tstr = tl === \"off\" ? \"thinking off\" : tl;\n\t\t\tr2Plain += ` • ${tstr}`;\n\t\t\tr2Styled += theme.fg(\"dim\", ` • ${tstr}`);\n\t\t}\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\t// Prepend the provider only when the whole right cluster still fits.\n\t\t\tconst withProv = `(${state.model.provider}) ${r2Plain}`;\n\t\t\tif (visibleWidth(l2Plain) + 2 + visibleWidth(withProv) <= width) {\n\t\t\t\tr2Plain = withProv;\n\t\t\t\tr2Styled = theme.fg(\"dim\", `(${state.model.provider}) `) + r2Styled;\n\t\t\t}\n\t\t}\n\t\tconst line2 = assembleLine(width, l2Plain, l2Styled, r2Plain, r2Styled);\n\n\t\tconst lines = [line1, line2];\n\n\t\t// Add extension statuses on a single line, sorted by key alphabetically\n\t\tconst extensionStatuses = this.footerData.getExtensionStatuses();\n\t\tif (extensionStatuses.size > 0) {\n\t\t\tconst sortedStatuses = Array.from(extensionStatuses.entries())\n\t\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t\t.map(([, text]) => sanitizeStatusText(text));\n\t\t\tconst statusLine = sortedStatuses.join(\" \");\n\t\t\t// Truncate to terminal width with dim ellipsis for consistency with footer style\n\t\t\tlines.push(truncateToWidth(statusLine, width, theme.fg(\"dim\", \"...\")));\n\t\t}\n\n\t\t// Transient startup progress (first-run tool downloads, index build): one\n\t\t// determinate bar per entry, cleared as each settles. Width-clamped like the\n\t\t// status line so the footer never overflows.\n\t\tfor (const entry of startupProgress.list()) {\n\t\t\tlines.push(truncateToWidth(renderStartupLine(entry), width, theme.fg(\"dim\", \"…\")));\n\t\t}\n\n\t\treturn lines;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,eAAe,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAwB,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,KAAa,EAAE,SAAiB,EAAE,UAAkB,EAAE,UAAU,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAU;IACtH,MAAM,EAAE,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,UAAU,IAAI,EAAE,GAAG,CAAC,GAAG,YAA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Ae,CAAC,IAAI,EAAE,EAAE,CAAC;YAC5C,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAG,CAAC,CAAC,CAAC,CAAC;QACpF,CAAC;QAED,OAAO,KAAK,CAAC;IAAA,CACb;CACD","sourcesContent":["import { type Component, truncateToWidth, visibleWidth } from \"@kolisachint/hoocode-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.js\";\nimport { sumAssistantUsage } from \"../../../core/agent-session-stats.js\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.js\";\nimport { formatTokens } from \"../../../core/format-tokens.js\";\nimport { type StartupProgress, startupProgress } from \"../../../core/startup-progress.js\";\nimport { taskStore } from \"../../../core/task-store.js\";\nimport { BRAND_MARK, GIT_BRANCH_GLYPH } from \"../brand.js\";\nimport { theme } from \"../theme/theme.js\";\n\n/**\n * Assemble one footer line: `left` flush left, `right` flush right when it fits\n * (≥2 cols between), padded to the full width. When it doesn't fit, drop `right`\n * and pad; when even `left` overflows, truncate it. Width math runs on the plain\n * strings; the styled strings carry the colour. Every returned line is exactly\n * `width` cells or fewer — the invariant the footer-width tests hold us to.\n */\nfunction assembleLine(width: number, leftPlain: string, leftStyled: string, rightPlain = \"\", rightStyled = \"\"): string {\n\tconst lw = visibleWidth(leftPlain);\n\tif (rightPlain && lw + 2 + visibleWidth(rightPlain) <= width) {\n\t\treturn leftStyled + \" \".repeat(width - lw - visibleWidth(rightPlain)) + rightStyled;\n\t}\n\tif (lw <= width) return leftStyled + \" \".repeat(width - lw);\n\treturn truncateToWidth(leftStyled, width, theme.fg(\"dim\", \"…\"));\n}\n\n/** A compact context-fill gauge, coloured by proximity to the auto-compact trip point. */\nfunction contextGauge(percent: number, errorLevel: number, warnLevel: number): { plain: string; styled: string } {\n\tconst CELLS = 8;\n\tconst filled = Math.max(0, Math.min(CELLS, Math.round((percent / 100) * CELLS)));\n\tconst fill = \"▰\".repeat(filled);\n\tconst track = \"▱\".repeat(CELLS - filled);\n\tconst color = percent >= errorLevel ? \"error\" : percent >= warnLevel ? \"warning\" : \"accent\";\n\treturn { plain: fill + track, styled: theme.fg(color, fill) + theme.fg(\"dim\", track) };\n}\n\n/** Count subagent runs currently in flight, for the footer's live delegation cue. */\nfunction activeSubagentCount(): number {\n\treturn taskStore.list().filter((t) => t.source === \"subagent\" && t.status === \"in_progress\").length;\n}\n\n/**\n * Sanitize text for display in a single-line status.\n * Removes newlines, tabs, carriage returns, and other control characters.\n */\nfunction sanitizeStatusText(text: string): string {\n\t// Replace newlines, tabs, carriage returns with space, then collapse multiple spaces\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\n/** Cells in a startup-progress bar; compact so several tools fit the footer. */\nconst STARTUP_BAR_CELLS = 12;\n\nfunction formatMb(bytes: number): string {\n\treturn `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * One footer line for a transient startup-progress entry (tool download or\n * index build), styled like the voice download bar: a `·` fill over a dim\n * track with percent and a `received / total` (or `done/total`) detail. An\n * indeterminate download (no Content-Length) drops the bar for a running byte\n * count; an error entry renders as a dim message. Returns a styled string; the\n * caller width-clamps it.\n */\nfunction renderStartupLine(entry: StartupProgress): string {\n\tif (entry.kind === \"error\") {\n\t\treturn theme.fg(\"dim\", `${entry.label}: ${entry.message}`);\n\t}\n\tconst label = theme.fg(\"text\", entry.label);\n\tif (entry.kind === \"download\") {\n\t\tif (entry.totalBytes === null || entry.totalBytes <= 0) {\n\t\t\treturn `${label} ${theme.fg(\"dim\", `${formatMb(entry.receivedBytes)}…`)}`;\n\t\t}\n\t\tconst detail = `${formatMb(entry.receivedBytes)} / ${formatMb(entry.totalBytes)}`;\n\t\treturn `${label} ${determinateBar(entry.receivedBytes / entry.totalBytes, detail)}`;\n\t}\n\tconst detail = `${entry.done}/${entry.total} ${entry.unit}`;\n\tconst ratio = entry.total > 0 ? entry.done / entry.total : 0;\n\treturn `${label} ${determinateBar(ratio, detail)}`;\n}\n\n/** `·`-fill bar + percent + trailing detail, matching the voice download bar. */\nfunction determinateBar(ratio: number, detail: string): string {\n\tconst clamped = Math.max(0, Math.min(1, ratio));\n\tconst filled = Math.round(clamped * STARTUP_BAR_CELLS);\n\tconst bar = theme.fg(\"accent\", \"·\".repeat(filled)) + theme.fg(\"dim\", \"·\".repeat(STARTUP_BAR_CELLS - filled));\n\tconst pct = `${Math.round(clamped * 100)}%`;\n\treturn `${bar} ${theme.fg(\"muted\", pct)} ${theme.fg(\"dim\", `· ${detail}`)}`;\n}\n\n/**\n * Footer component that shows pwd, token stats, and context usage.\n * Computes token/context stats from session, gets git branch and extension statuses from provider.\n */\nexport class FooterComponent implements Component {\n\tprivate autoCompactEnabled = true;\n\n\tconstructor(\n\t\tprivate session: AgentSession,\n\t\tprivate footerData: ReadonlyFooterDataProvider,\n\t) {}\n\n\tsetSession(session: AgentSession): void {\n\t\tthis.session = session;\n\t}\n\n\tsetAutoCompactEnabled(enabled: boolean): void {\n\t\tthis.autoCompactEnabled = enabled;\n\t}\n\n\t/**\n\t * No-op: git branch caching now handled by provider.\n\t * Kept for compatibility with existing call sites in interactive-mode.\n\t */\n\tinvalidate(): void {\n\t\t// No-op: git branch is cached/invalidated by provider\n\t}\n\n\t/**\n\t * Clean up resources.\n\t * Git watcher cleanup now handled by provider.\n\t */\n\tdispose(): void {\n\t\t// Git watcher cleanup handled by provider\n\t}\n\n\trender(width: number): string[] {\n\t\tconst state = this.session.state;\n\n\t\t// Cumulative usage across ALL session entries (not just post-compaction\n\t\t// messages). Shares sumAssistantUsage with the per-request cost line the\n\t\t// transcript prints at agent_end, so the footer total and that line are always\n\t\t// derived from the same accounting.\n\t\tconst {\n\t\t\tinput: totalInput,\n\t\t\toutput: totalOutput,\n\t\t\tcacheRead: totalCacheRead,\n\t\t\tcacheWrite: totalCacheWrite,\n\t\t\tcost: totalCost,\n\t\t} = sumAssistantUsage(this.session.sessionManager.getEntries());\n\n\t\t// Calculate context usage from session (handles compaction correctly).\n\t\t// After compaction, tokens are unknown until the next LLM response.\n\t\tconst contextUsage = this.session.getContextUsage();\n\t\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\t\tconst contextPercentValue = contextUsage?.percent ?? 0;\n\t\tconst contextPercent = contextUsage?.percent !== null ? contextPercentValue.toFixed(1) : \"?\";\n\n\t\t// Replace home directory with ~\n\t\tlet pwd = this.session.sessionManager.getCwd();\n\t\tconst home = process.env.HOME || process.env.USERPROFILE;\n\t\tif (home && pwd.startsWith(home)) {\n\t\t\tpwd = `~${pwd.slice(home.length)}`;\n\t\t}\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\t\tconst modeLabel = this.footerData.getActiveMode();\n\n\t\t// ── Line 1 — identity & location ────────────────────────────────────────\n\t\t// Lead with the brand mark + MODE (the agent's guardrail: Ask/Plan/Build/\n\t\t// Debug) in bold accent so it is the first thing the eye lands on, then the\n\t\t// path, git branch, and session name in descending emphasis. The live\n\t\t// subagent count sits flush right — present only while work is delegated.\n\t\tconst modeUp = modeLabel.toUpperCase();\n\t\t// Themes that define the brandBg/brandText pair paint the mark as a filled\n\t\t// chip; the padding lives in the plain string too so width math and\n\t\t// truncation stay honest. Themes without the pair keep accent-coloured text.\n\t\tconst chip = theme.hasBg(\"brandBg\") && theme.has(\"brandText\");\n\t\tconst brand = chip ? ` ${BRAND_MARK} ${modeUp} ` : `${BRAND_MARK} ${modeUp}`;\n\t\tlet l1Plain = `${brand} ${pwd}`;\n\t\tconst brandStyled = chip\n\t\t\t? theme.bg(\"brandBg\", theme.bold(theme.fg(\"brandText\", brand)))\n\t\t\t: theme.bold(theme.fg(\"accent\", brand));\n\t\tlet l1Styled = `${brandStyled} ${theme.fg(\"muted\", pwd)}`;\n\t\tif (branch) {\n\t\t\tl1Plain += ` ${GIT_BRANCH_GLYPH} ${branch}`;\n\t\t\tl1Styled += ` ${theme.fg(\"dim\", GIT_BRANCH_GLYPH)} ${theme.fg(\"muted\", branch)}`;\n\t\t}\n\t\tif (sessionName) {\n\t\t\tl1Plain += ` • ${sessionName}`;\n\t\t\tl1Styled += theme.fg(\"dim\", ` • ${sessionName}`);\n\t\t}\n\t\tconst nSub = activeSubagentCount();\n\t\tconst l1RightPlain = nSub > 0 ? `◇${nSub} running` : \"\";\n\t\tconst l1RightStyled = nSub > 0 ? theme.fg(\"accent\", `◇${nSub}`) + theme.fg(\"dim\", \" running\") : \"\";\n\t\tconst line1 = assembleLine(width, l1Plain, l1Styled, l1RightPlain, l1RightStyled);\n\n\t\t// ── Line 2 — session vitals ─────────────────────────────────────────────\n\t\t// A context-fill gauge (coloured by proximity to the auto-compact trip\n\t\t// point) leads, then token/cost deltas, with the model + thinking level\n\t\t// flush right. Numbers read in muted, labels/arrows in dim — a legible\n\t\t// hierarchy in place of the old uniform grey.\n\t\tlet thresholdPercent: number | undefined;\n\t\tif (this.autoCompactEnabled && contextWindow > 0) {\n\t\t\tconst reserveTokens = this.session.settingsManager.getCompactionSettings().reserveTokens;\n\t\t\tconst effective = contextWindow - reserveTokens;\n\t\t\tif (effective > 0) thresholdPercent = (effective / contextWindow) * 100;\n\t\t}\n\t\tconst errorLevel = thresholdPercent !== undefined ? thresholdPercent - 3 : 90;\n\t\tconst warnLevel = thresholdPercent !== undefined ? thresholdPercent - 10 : 70;\n\t\tconst autoIndicator =\n\t\t\tthresholdPercent !== undefined\n\t\t\t\t? ` auto@${thresholdPercent.toFixed(0)}%`\n\t\t\t\t: this.autoCompactEnabled\n\t\t\t\t\t? \" auto\"\n\t\t\t\t\t: \"\";\n\n\t\tconst gauge = contextGauge(contextPercentValue, errorLevel, warnLevel);\n\t\tconst pctText = contextPercent === \"?\" ? \"?\" : `${contextPercent}%`;\n\t\tconst pctColor =\n\t\t\tcontextPercentValue >= errorLevel ? \"error\" : contextPercentValue >= warnLevel ? \"warning\" : \"muted\";\n\t\tconst winText = `${formatTokens(contextWindow)}${autoIndicator}`;\n\n\t\tconst segs: Array<{ plain: string; styled: string }> = [\n\t\t\t{\n\t\t\t\tplain: `${gauge.plain} ${pctText} ${winText}`,\n\t\t\t\tstyled: `${gauge.styled} ${theme.fg(pctColor, pctText)} ${theme.fg(\"dim\", winText)}`,\n\t\t\t},\n\t\t];\n\t\tconst arrow = (a: string, n: number) => ({\n\t\t\tplain: `${a}${formatTokens(n)}`,\n\t\t\tstyled: theme.fg(\"dim\", a) + theme.fg(\"muted\", formatTokens(n)),\n\t\t});\n\t\tif (totalInput) segs.push(arrow(\"↑\", totalInput));\n\t\tif (totalOutput) segs.push(arrow(\"↓\", totalOutput));\n\t\tif (totalCacheRead) segs.push(arrow(\"R\", totalCacheRead));\n\t\tif (totalCacheWrite) segs.push(arrow(\"W\", totalCacheWrite));\n\t\tconst usingSubscription = state.model ? this.session.modelRegistry.isUsingOAuth(state.model) : false;\n\t\tif (totalCost || usingSubscription) {\n\t\t\tconst costStr = `$${totalCost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`;\n\t\t\tsegs.push({ plain: costStr, styled: theme.fg(\"muted\", costStr) });\n\t\t}\n\t\tconst l2Plain = segs.map((s) => s.plain).join(\" \");\n\t\tconst l2Styled = segs.map((s) => s.styled).join(\" \");\n\n\t\t// Right: model, thinking level, and provider (when several are configured).\n\t\tconst modelName = state.model?.id || \"no-model\";\n\t\tlet r2Plain = modelName;\n\t\tlet r2Styled = theme.fg(\"muted\", modelName);\n\t\tif (state.model?.reasoning) {\n\t\t\tconst tl = state.thinkingLevel || \"off\";\n\t\t\tconst tstr = tl === \"off\" ? \"thinking off\" : tl;\n\t\t\tr2Plain += ` • ${tstr}`;\n\t\t\tr2Styled += theme.fg(\"dim\", ` • ${tstr}`);\n\t\t}\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\t// Prepend the provider only when the whole right cluster still fits.\n\t\t\tconst withProv = `(${state.model.provider}) ${r2Plain}`;\n\t\t\tif (visibleWidth(l2Plain) + 2 + visibleWidth(withProv) <= width) {\n\t\t\t\tr2Plain = withProv;\n\t\t\t\tr2Styled = theme.fg(\"dim\", `(${state.model.provider}) `) + r2Styled;\n\t\t\t}\n\t\t}\n\t\tconst line2 = assembleLine(width, l2Plain, l2Styled, r2Plain, r2Styled);\n\n\t\tconst lines = [line1, line2];\n\n\t\t// Add extension statuses on a single line, sorted by key alphabetically\n\t\tconst extensionStatuses = this.footerData.getExtensionStatuses();\n\t\tif (extensionStatuses.size > 0) {\n\t\t\tconst sortedStatuses = Array.from(extensionStatuses.entries())\n\t\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t\t.map(([, text]) => sanitizeStatusText(text));\n\t\t\tconst statusLine = sortedStatuses.join(\" \");\n\t\t\t// Truncate to terminal width with dim ellipsis for consistency with footer style\n\t\t\tlines.push(truncateToWidth(statusLine, width, theme.fg(\"dim\", \"...\")));\n\t\t}\n\n\t\t// Transient startup progress (first-run tool downloads, index build): one\n\t\t// determinate bar per entry, cleared as each settles. Width-clamped like the\n\t\t// status line so the footer never overflows.\n\t\tfor (const entry of startupProgress.list()) {\n\t\t\tlines.push(truncateToWidth(renderStartupLine(entry), width, theme.fg(\"dim\", \"…\")));\n\t\t}\n\n\t\treturn lines;\n\t}\n}\n"]}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/kolisachint/hoocode/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
3
3
|
"name": "colorsafe-light",
|
|
4
|
-
"description": "Low vision + color blindness:
|
|
4
|
+
"description": "Low vision + color blindness: blue/violet/magenta on white, no red/green pairs",
|
|
5
5
|
"vars": {
|
|
6
6
|
"ink": "#101010",
|
|
7
|
-
"inkSoft": "#
|
|
8
|
-
"gray": "#
|
|
9
|
-
"dimGray": "#
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"olive": "#
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"purple": "#73245a",
|
|
7
|
+
"inkSoft": "#171717",
|
|
8
|
+
"gray": "#232323",
|
|
9
|
+
"dimGray": "#4a4a4a",
|
|
10
|
+
"blue": "#0a0af0",
|
|
11
|
+
"violet": "#42057f",
|
|
12
|
+
"green": "#023621",
|
|
13
|
+
"olive": "#584704",
|
|
14
|
+
"plum": "#4e033f",
|
|
15
|
+
"magenta": "#871275",
|
|
17
16
|
"selectedBg": "#dfe6f2",
|
|
18
17
|
"userMsgBg": "#f2f3f5",
|
|
19
18
|
"customMsgBg": "#f5f0f4",
|
|
@@ -22,12 +21,12 @@
|
|
|
22
21
|
"toolErrorBg": "#f9f0ea"
|
|
23
22
|
},
|
|
24
23
|
"colors": {
|
|
25
|
-
"accent": "
|
|
26
|
-
"border": "
|
|
27
|
-
"borderAccent": "
|
|
24
|
+
"accent": "blue",
|
|
25
|
+
"border": "violet",
|
|
26
|
+
"borderAccent": "blue",
|
|
28
27
|
"borderMuted": "dimGray",
|
|
29
|
-
"success": "
|
|
30
|
-
"error": "
|
|
28
|
+
"success": "green",
|
|
29
|
+
"error": "magenta",
|
|
31
30
|
"warning": "olive",
|
|
32
31
|
"muted": "gray",
|
|
33
32
|
"dim": "dimGray",
|
|
@@ -39,7 +38,7 @@
|
|
|
39
38
|
"userMessageText": "ink",
|
|
40
39
|
"customMessageBg": "customMsgBg",
|
|
41
40
|
"customMessageText": "ink",
|
|
42
|
-
"customMessageLabel": "
|
|
41
|
+
"customMessageLabel": "plum",
|
|
43
42
|
"toolPendingBg": "toolPendingBg",
|
|
44
43
|
"toolSuccessBg": "toolSuccessBg",
|
|
45
44
|
"toolErrorBg": "toolErrorBg",
|
|
@@ -47,46 +46,46 @@
|
|
|
47
46
|
"toolOutput": "gray",
|
|
48
47
|
|
|
49
48
|
"mdHeading": "olive",
|
|
50
|
-
"mdLink": "
|
|
49
|
+
"mdLink": "violet",
|
|
51
50
|
"mdLinkUrl": "dimGray",
|
|
52
|
-
"mdCode": "
|
|
51
|
+
"mdCode": "blue",
|
|
53
52
|
"mdCodeBlock": "inkSoft",
|
|
54
53
|
"mdCodeBlockBorder": "dimGray",
|
|
55
54
|
"mdQuote": "gray",
|
|
56
|
-
"mdQuoteBorder": "
|
|
55
|
+
"mdQuoteBorder": "plum",
|
|
57
56
|
"mdHr": "dimGray",
|
|
58
|
-
"mdListBullet": "
|
|
57
|
+
"mdListBullet": "blue",
|
|
59
58
|
|
|
60
|
-
"toolDiffAdded": "
|
|
61
|
-
"toolDiffRemoved": "
|
|
59
|
+
"toolDiffAdded": "green",
|
|
60
|
+
"toolDiffRemoved": "magenta",
|
|
62
61
|
"toolDiffContext": "dimGray",
|
|
63
62
|
|
|
64
63
|
"syntaxComment": "dimGray",
|
|
65
64
|
"syntaxKeyword": "blue",
|
|
66
65
|
"syntaxFunction": "olive",
|
|
67
|
-
"syntaxVariable": "
|
|
68
|
-
"syntaxString": "
|
|
69
|
-
"syntaxNumber": "
|
|
70
|
-
"syntaxType": "
|
|
66
|
+
"syntaxVariable": "violet",
|
|
67
|
+
"syntaxString": "green",
|
|
68
|
+
"syntaxNumber": "magenta",
|
|
69
|
+
"syntaxType": "plum",
|
|
71
70
|
"syntaxOperator": "inkSoft",
|
|
72
71
|
"syntaxPunctuation": "inkSoft",
|
|
73
72
|
|
|
74
73
|
"thinkingOff": "dimGray",
|
|
75
74
|
"thinkingMinimal": "gray",
|
|
76
|
-
"thinkingLow": "
|
|
77
|
-
"thinkingMedium": "
|
|
78
|
-
"thinkingHigh": "
|
|
79
|
-
"thinkingXhigh": "
|
|
75
|
+
"thinkingLow": "violet",
|
|
76
|
+
"thinkingMedium": "blue",
|
|
77
|
+
"thinkingHigh": "olive",
|
|
78
|
+
"thinkingXhigh": "magenta",
|
|
80
79
|
|
|
81
|
-
"bashMode": "
|
|
80
|
+
"bashMode": "green",
|
|
82
81
|
|
|
83
|
-
"agent1": "
|
|
84
|
-
"agent2": "
|
|
85
|
-
"agent3": "
|
|
86
|
-
"agent4": "
|
|
87
|
-
"agent5": "
|
|
88
|
-
"agent6": "
|
|
89
|
-
"mcp": "
|
|
82
|
+
"agent1": "#00382d",
|
|
83
|
+
"agent2": "#830745",
|
|
84
|
+
"agent3": "#395200",
|
|
85
|
+
"agent4": "#0000f5",
|
|
86
|
+
"agent5": "#621197",
|
|
87
|
+
"agent6": "#262e05",
|
|
88
|
+
"mcp": "#570557"
|
|
90
89
|
},
|
|
91
90
|
"export": {
|
|
92
91
|
"pageBg": "#ffffff",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"syntaxComment": "lime",
|
|
69
69
|
"syntaxKeyword": "blue",
|
|
70
70
|
"syntaxFunction": "#ffe082",
|
|
71
|
-
"syntaxVariable": "#
|
|
71
|
+
"syntaxVariable": "#cfd8ff",
|
|
72
72
|
"syntaxString": "#ffab91",
|
|
73
73
|
"syntaxNumber": "lilac",
|
|
74
74
|
"syntaxType": "mint",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"syntaxPunctuation": "paleGray",
|
|
77
77
|
|
|
78
78
|
"thinkingOff": "dimGray",
|
|
79
|
-
"thinkingMinimal": "
|
|
79
|
+
"thinkingMinimal": "#d8e2ee",
|
|
80
80
|
"thinkingLow": "blue",
|
|
81
81
|
"thinkingMedium": "cyan",
|
|
82
82
|
"thinkingHigh": "orange",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"agent4": "pink",
|
|
91
91
|
"agent5": "green",
|
|
92
92
|
"agent6": "blue",
|
|
93
|
-
"mcp": "#
|
|
93
|
+
"mcp": "#e8dbff"
|
|
94
94
|
},
|
|
95
95
|
"export": {
|
|
96
96
|
"pageBg": "#000000",
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"vars": {
|
|
6
6
|
"ink": "#000000",
|
|
7
7
|
"inkSoft": "#1a1a1a",
|
|
8
|
-
"gray": "#
|
|
9
|
-
"dimGray": "#
|
|
8
|
+
"gray": "#262626",
|
|
9
|
+
"dimGray": "#4a4a4a",
|
|
10
10
|
"blue": "#0b3d91",
|
|
11
11
|
"teal": "#00474a",
|
|
12
12
|
"green": "#14521a",
|
|
@@ -81,13 +81,13 @@
|
|
|
81
81
|
|
|
82
82
|
"bashMode": "green",
|
|
83
83
|
|
|
84
|
-
"agent1": "
|
|
85
|
-
"agent2": "
|
|
86
|
-
"agent3": "
|
|
87
|
-
"agent4": "
|
|
88
|
-
"agent5": "
|
|
89
|
-
"agent6": "
|
|
90
|
-
"mcp": "
|
|
84
|
+
"agent1": "#003333",
|
|
85
|
+
"agent2": "#980606",
|
|
86
|
+
"agent3": "#573d00",
|
|
87
|
+
"agent4": "#57002b",
|
|
88
|
+
"agent5": "#084d00",
|
|
89
|
+
"agent6": "#004080",
|
|
90
|
+
"mcp": "#7707a6"
|
|
91
91
|
},
|
|
92
92
|
"export": {
|
|
93
93
|
"pageBg": "#ffffff",
|
|
@@ -3,20 +3,24 @@
|
|
|
3
3
|
"name": "light",
|
|
4
4
|
"description": "Default light theme",
|
|
5
5
|
"vars": {
|
|
6
|
-
"teal": "#
|
|
7
|
-
"blue": "#
|
|
8
|
-
"green": "#
|
|
9
|
-
"red": "#
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
6
|
+
"teal": "#036c66",
|
|
7
|
+
"blue": "#0b57d0",
|
|
8
|
+
"green": "#0a7028",
|
|
9
|
+
"red": "#c1121f",
|
|
10
|
+
"amber": "#7d5700",
|
|
11
|
+
"purple": "#6d28d9",
|
|
12
|
+
"orange": "#b5340e",
|
|
13
|
+
"magenta": "#9c1a9c",
|
|
14
|
+
"ink": "#2b2f36",
|
|
15
|
+
"mediumGray": "#5a5a5a",
|
|
16
|
+
"dimGray": "#626262",
|
|
17
|
+
"lightGray": "#828282",
|
|
18
|
+
"selectedBg": "#d6e4fa",
|
|
19
|
+
"userMsgBg": "#edeff3",
|
|
20
|
+
"toolPendingBg": "#eaeef8",
|
|
21
|
+
"toolSuccessBg": "#e6f4ea",
|
|
22
|
+
"toolErrorBg": "#fbeaea",
|
|
23
|
+
"customMsgBg": "#f1ebfb"
|
|
20
24
|
},
|
|
21
25
|
"colors": {
|
|
22
26
|
"accent": "teal",
|
|
@@ -25,7 +29,7 @@
|
|
|
25
29
|
"borderMuted": "lightGray",
|
|
26
30
|
"success": "green",
|
|
27
31
|
"error": "red",
|
|
28
|
-
"warning": "
|
|
32
|
+
"warning": "amber",
|
|
29
33
|
"muted": "mediumGray",
|
|
30
34
|
"dim": "dimGray",
|
|
31
35
|
"text": "",
|
|
@@ -36,58 +40,58 @@
|
|
|
36
40
|
"userMessageText": "",
|
|
37
41
|
"customMessageBg": "customMsgBg",
|
|
38
42
|
"customMessageText": "",
|
|
39
|
-
"customMessageLabel": "
|
|
43
|
+
"customMessageLabel": "purple",
|
|
40
44
|
"toolPendingBg": "toolPendingBg",
|
|
41
45
|
"toolSuccessBg": "toolSuccessBg",
|
|
42
46
|
"toolErrorBg": "toolErrorBg",
|
|
43
47
|
"toolTitle": "",
|
|
44
48
|
"toolOutput": "mediumGray",
|
|
45
49
|
|
|
46
|
-
"mdHeading": "
|
|
50
|
+
"mdHeading": "amber",
|
|
47
51
|
"mdLink": "blue",
|
|
48
52
|
"mdLinkUrl": "dimGray",
|
|
49
53
|
"mdCode": "teal",
|
|
50
|
-
"mdCodeBlock": "
|
|
54
|
+
"mdCodeBlock": "ink",
|
|
51
55
|
"mdCodeBlockBorder": "mediumGray",
|
|
52
56
|
"mdQuote": "mediumGray",
|
|
53
|
-
"mdQuoteBorder": "
|
|
54
|
-
"mdHr": "
|
|
55
|
-
"mdListBullet": "
|
|
57
|
+
"mdQuoteBorder": "amber",
|
|
58
|
+
"mdHr": "lightGray",
|
|
59
|
+
"mdListBullet": "teal",
|
|
56
60
|
|
|
57
61
|
"toolDiffAdded": "green",
|
|
58
62
|
"toolDiffRemoved": "red",
|
|
59
63
|
"toolDiffContext": "mediumGray",
|
|
60
64
|
|
|
61
|
-
"syntaxComment": "#
|
|
62
|
-
"syntaxKeyword": "#
|
|
63
|
-
"syntaxFunction": "#
|
|
64
|
-
"syntaxVariable": "#
|
|
65
|
-
"syntaxString": "#
|
|
66
|
-
"syntaxNumber": "#
|
|
67
|
-
"syntaxType": "#
|
|
68
|
-
"syntaxOperator": "#
|
|
69
|
-
"syntaxPunctuation": "#
|
|
65
|
+
"syntaxComment": "#2d6b28",
|
|
66
|
+
"syntaxKeyword": "#0b57d0",
|
|
67
|
+
"syntaxFunction": "#8c4a00",
|
|
68
|
+
"syntaxVariable": "#0d2f80",
|
|
69
|
+
"syntaxString": "#a31515",
|
|
70
|
+
"syntaxNumber": "#046b53",
|
|
71
|
+
"syntaxType": "#0b6e80",
|
|
72
|
+
"syntaxOperator": "#2b2f36",
|
|
73
|
+
"syntaxPunctuation": "#2b2f36",
|
|
70
74
|
|
|
71
75
|
"thinkingOff": "lightGray",
|
|
72
|
-
"thinkingMinimal": "
|
|
76
|
+
"thinkingMinimal": "dimGray",
|
|
73
77
|
"thinkingLow": "blue",
|
|
74
78
|
"thinkingMedium": "teal",
|
|
75
|
-
"thinkingHigh": "
|
|
76
|
-
"thinkingXhigh": "
|
|
79
|
+
"thinkingHigh": "orange",
|
|
80
|
+
"thinkingXhigh": "magenta",
|
|
77
81
|
|
|
78
82
|
"bashMode": "green",
|
|
79
83
|
|
|
80
|
-
"agent1": "#
|
|
81
|
-
"agent2": "#
|
|
82
|
-
"agent3": "#
|
|
83
|
-
"agent4": "#
|
|
84
|
-
"agent5": "#
|
|
85
|
-
"agent6": "#
|
|
86
|
-
"mcp": "#
|
|
84
|
+
"agent1": "#0b6e80",
|
|
85
|
+
"agent2": "#8e24aa",
|
|
86
|
+
"agent3": "#b5340e",
|
|
87
|
+
"agent4": "#b01e51",
|
|
88
|
+
"agent5": "#06694b",
|
|
89
|
+
"agent6": "#2544c9",
|
|
90
|
+
"mcp": "#300c6e"
|
|
87
91
|
},
|
|
88
92
|
"export": {
|
|
89
93
|
"pageBg": "#f8f8f8",
|
|
90
94
|
"cardBg": "#ffffff",
|
|
91
|
-
"infoBg": "#
|
|
95
|
+
"infoBg": "#fff4d6"
|
|
92
96
|
}
|
|
93
97
|
}
|