open-multi-agent-kit 0.92.0 → 0.93.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +2 -2
  3. package/dist/core/agent-session.d.ts +29 -0
  4. package/dist/core/agent-session.d.ts.map +1 -1
  5. package/dist/core/agent-session.js +81 -14
  6. package/dist/core/agent-session.js.map +1 -1
  7. package/dist/core/compaction/branch-summarization.d.ts +5 -1
  8. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  9. package/dist/core/compaction/branch-summarization.js +5 -7
  10. package/dist/core/compaction/branch-summarization.js.map +1 -1
  11. package/dist/core/compaction/compaction.d.ts +12 -3
  12. package/dist/core/compaction/compaction.d.ts.map +1 -1
  13. package/dist/core/compaction/compaction.js +28 -15
  14. package/dist/core/compaction/compaction.js.map +1 -1
  15. package/dist/core/extensions/builtin/command-safety-gate.d.ts +8 -0
  16. package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -1
  17. package/dist/core/extensions/builtin/command-safety-gate.js +23 -0
  18. package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -1
  19. package/dist/core/extensions/runner.d.ts.map +1 -1
  20. package/dist/core/extensions/runner.js +4 -0
  21. package/dist/core/extensions/runner.js.map +1 -1
  22. package/dist/core/extensions/types.d.ts +2 -0
  23. package/dist/core/extensions/types.d.ts.map +1 -1
  24. package/dist/core/extensions/types.js.map +1 -1
  25. package/dist/core/keybindings.d.ts +5 -0
  26. package/dist/core/keybindings.d.ts.map +1 -1
  27. package/dist/core/keybindings.js +5 -0
  28. package/dist/core/keybindings.js.map +1 -1
  29. package/dist/core/model-resolver.d.ts +41 -3
  30. package/dist/core/model-resolver.d.ts.map +1 -1
  31. package/dist/core/model-resolver.js +17 -9
  32. package/dist/core/model-resolver.js.map +1 -1
  33. package/dist/core/provider-resilience.d.ts.map +1 -1
  34. package/dist/core/provider-resilience.js +3 -1
  35. package/dist/core/provider-resilience.js.map +1 -1
  36. package/dist/core/reasoning-router-v4-weights.d.ts.map +1 -1
  37. package/dist/core/reasoning-router-v4-weights.js +9 -3
  38. package/dist/core/reasoning-router-v4-weights.js.map +1 -1
  39. package/dist/core/reasoning-router-v4.d.ts.map +1 -1
  40. package/dist/core/reasoning-router-v4.js +94 -24
  41. package/dist/core/reasoning-router-v4.js.map +1 -1
  42. package/dist/core/resource-loader.d.ts.map +1 -1
  43. package/dist/core/resource-loader.js +11 -5
  44. package/dist/core/resource-loader.js.map +1 -1
  45. package/dist/core/session-file-compaction.d.ts.map +1 -1
  46. package/dist/core/session-file-compaction.js +39 -5
  47. package/dist/core/session-file-compaction.js.map +1 -1
  48. package/dist/core/session-termination.d.ts.map +1 -1
  49. package/dist/core/session-termination.js +1 -1
  50. package/dist/core/session-termination.js.map +1 -1
  51. package/dist/core/settings-manager.d.ts +3 -0
  52. package/dist/core/settings-manager.d.ts.map +1 -1
  53. package/dist/core/settings-manager.js +8 -0
  54. package/dist/core/settings-manager.js.map +1 -1
  55. package/dist/core/system-prompt.d.ts.map +1 -1
  56. package/dist/core/system-prompt.js +1 -1
  57. package/dist/core/system-prompt.js.map +1 -1
  58. package/dist/core/tools/bash.d.ts +2 -0
  59. package/dist/core/tools/bash.d.ts.map +1 -1
  60. package/dist/core/tools/bash.js +38 -11
  61. package/dist/core/tools/bash.js.map +1 -1
  62. package/dist/modes/interactive/components/control-panel-box.d.ts +27 -0
  63. package/dist/modes/interactive/components/control-panel-box.d.ts.map +1 -1
  64. package/dist/modes/interactive/components/control-panel-box.js +60 -8
  65. package/dist/modes/interactive/components/control-panel-box.js.map +1 -1
  66. package/dist/modes/interactive/components/control-panel-layout.d.ts.map +1 -1
  67. package/dist/modes/interactive/components/control-panel-layout.js +100 -45
  68. package/dist/modes/interactive/components/control-panel-layout.js.map +1 -1
  69. package/dist/modes/interactive/components/control-panel-runtime-status.d.ts +9 -0
  70. package/dist/modes/interactive/components/control-panel-runtime-status.d.ts.map +1 -1
  71. package/dist/modes/interactive/components/control-panel-runtime-status.js +10 -8
  72. package/dist/modes/interactive/components/control-panel-runtime-status.js.map +1 -1
  73. package/dist/modes/interactive/components/control-panel-sparkles.d.ts +5 -0
  74. package/dist/modes/interactive/components/control-panel-sparkles.d.ts.map +1 -1
  75. package/dist/modes/interactive/components/control-panel-sparkles.js +14 -9
  76. package/dist/modes/interactive/components/control-panel-sparkles.js.map +1 -1
  77. package/dist/modes/interactive/components/footer.d.ts +10 -0
  78. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  79. package/dist/modes/interactive/components/footer.js +3 -3
  80. package/dist/modes/interactive/components/footer.js.map +1 -1
  81. package/dist/modes/interactive/components/status-sidebar.d.ts +49 -0
  82. package/dist/modes/interactive/components/status-sidebar.d.ts.map +1 -0
  83. package/dist/modes/interactive/components/status-sidebar.js +253 -0
  84. package/dist/modes/interactive/components/status-sidebar.js.map +1 -0
  85. package/dist/modes/interactive/interactive-mode.d.ts +9 -0
  86. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  87. package/dist/modes/interactive/interactive-mode.js +94 -20
  88. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  89. package/dist/modes/interactive/theme/omk-neon-control.json +13 -13
  90. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  91. package/dist/modes/rpc/rpc-mode.js +1 -0
  92. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  93. package/dist/utils/clipboard.d.ts.map +1 -1
  94. package/dist/utils/clipboard.js +19 -8
  95. package/dist/utils/clipboard.js.map +1 -1
  96. package/docs/compaction.md +7 -0
  97. package/docs/docs.json +4 -0
  98. package/docs/environment-variables.md +90 -0
  99. package/docs/index.md +1 -0
  100. package/docs/rpc.md +5 -2
  101. package/docs/settings.md +1 -0
  102. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  103. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  104. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  105. package/examples/extensions/gondolin/package-lock.json +2 -2
  106. package/examples/extensions/gondolin/package.json +1 -1
  107. package/examples/extensions/sandbox/package-lock.json +2 -2
  108. package/examples/extensions/sandbox/package.json +1 -1
  109. package/examples/extensions/subagent/agents.test.ts +86 -0
  110. package/examples/extensions/subagent/agents.ts +18 -4
  111. package/examples/extensions/subagent/capabilities.ts +15 -1
  112. package/examples/extensions/subagent/domain-profiles.ts +272 -0
  113. package/examples/extensions/with-deps/package-lock.json +2 -2
  114. package/examples/extensions/with-deps/package.json +1 -1
  115. package/npm-shrinkwrap.json +15 -15
  116. package/package.json +10 -7
@@ -32,21 +32,23 @@ export function countRoutableNonHubSkills(skills) {
32
32
  return skills.filter((skill) => !OMK_HUB_SKILL_NAMES.has(skill.name)).length;
33
33
  }
34
34
  export function countStableMcpServers(entries) {
35
- return entries.filter(isStableMcpEntry).length;
35
+ return entries.filter((entry) => classifyMcpStability(entry) === "stable").length;
36
36
  }
37
- function isStableMcpEntry(entry) {
37
+ export function classifyMcpStability(entry) {
38
38
  if (entry.overriddenBy)
39
- return false;
39
+ return "overridden";
40
40
  if (entry.commandSummary === "<unknown>")
41
- return false;
41
+ return "unstable";
42
42
  if (entry.authDecision.rule === "mcp.auth.invalid")
43
- return false;
43
+ return "unstable";
44
44
  if (INVALID_MCP_NETWORK_RULES.has(entry.networkDecision.rule))
45
- return false;
45
+ return "unstable";
46
46
  if (entry.capabilityDecision.malformed || entry.capabilityDecision.unknownCapabilities.length > 0)
47
- return false;
47
+ return "unstable";
48
48
  const command = entry.commandSummary.split(/\s+/, 1)[0] ?? "";
49
- return !PRIVILEGED_MCP_COMMANDS.has(command);
49
+ if (PRIVILEGED_MCP_COMMANDS.has(command))
50
+ return "unstable";
51
+ return "stable";
50
52
  }
51
53
  function getInstalledHeadroomVersion() {
52
54
  if (cachedHeadroomVersion !== undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"control-panel-runtime-status.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/control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AO;QACrB,UAAU,EAAE,QAAQ;QACpB,aAAa,EAAE,UAAU;QACzB,YAAY,EAAE,OAAO;QACrB,qBAAqB,EAAE,+BAA+B;QACtD,cAAc;QACd,YAAY,EAAE,QAAQ;QACtB,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,QAAQ;KACtB,CAAC;AAAA,CACF","sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport { getHeadroomRuntimeStatus } from \"../../../core/context-budget-headroom.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport { loadMcpInventory, type McpServerEntry } from \"../../../core/mcp-inventory.ts\";\nimport { evaluatePiPackageIntake } from \"../../../core/pi-package-intake.ts\";\nimport type { SessionManager } from \"../../../core/session-manager.ts\";\nimport { getCurrentTodoState } from \"../../../core/todo-runtime-state.ts\";\nimport type { ControlPanelStatusSnapshot } from \"./control-panel-layout.ts\";\nimport { formatCwdForFooter } from \"./footer.ts\";\n\nconst OMK_HUB_SKILL_NAMES = new Set([\n\t\"omk-skills\",\n\t\"omk-engineering\",\n\t\"omk-backend-data\",\n\t\"omk-security\",\n\t\"omk-devops-release\",\n\t\"omk-research-docs\",\n\t\"omk-design-media\",\n\t\"omk-agent-ops\",\n\t\"omk-product-ops\",\n\t\"omk-workspace-ops\",\n\t\"omk-frontend\",\n\t\"omk-loop\",\n\t\"omk-plan\",\n]);\n\nconst INVALID_MCP_NETWORK_RULES = new Set([\"mcp.network.invalid_mode\", \"mcp.network.empty_allowlist\"]);\nconst PRIVILEGED_MCP_COMMANDS = new Set([\"sudo\", \"su\"]);\nconst VERSION_COMMAND_TIMEOUT_MS = 750;\nconst HEADROOM_PYTHON_DISTRIBUTIONS = [\"headroom\", \"headroom-ai\"] as const;\n\nlet cachedHeadroomVersion: string | null | undefined;\n\ninterface McpStabilityInput {\n\treadonly commandSummary: string;\n\treadonly overriddenBy?: string;\n\treadonly networkDecision: Pick<McpServerEntry[\"networkDecision\"], \"rule\">;\n\treadonly capabilityDecision: Pick<McpServerEntry[\"capabilityDecision\"], \"malformed\" | \"unknownCapabilities\">;\n\treadonly authDecision: Pick<McpServerEntry[\"authDecision\"], \"rule\">;\n}\n\nexport function formatHeadroomStatusLabel(): string {\n\tconst version = getInstalledHeadroomVersion();\n\treturn version ? `headroom:${version}` : getHeadroomRuntimeStatus().policyId;\n}\n\nexport function countRoutableNonHubSkills(skills: readonly { readonly name: string }[]): number {\n\treturn skills.filter((skill) => !OMK_HUB_SKILL_NAMES.has(skill.name)).length;\n}\n\nexport function countStableMcpServers(entries: readonly McpStabilityInput[]): number {\n\treturn entries.filter(isStableMcpEntry).length;\n}\n\nfunction isStableMcpEntry(entry: McpStabilityInput): boolean {\n\tif (entry.overriddenBy) return false;\n\tif (entry.commandSummary === \"<unknown>\") return false;\n\tif (entry.authDecision.rule === \"mcp.auth.invalid\") return false;\n\tif (INVALID_MCP_NETWORK_RULES.has(entry.networkDecision.rule)) return false;\n\tif (entry.capabilityDecision.malformed || entry.capabilityDecision.unknownCapabilities.length > 0) return false;\n\tconst command = entry.commandSummary.split(/\\s+/, 1)[0] ?? \"\";\n\treturn !PRIVILEGED_MCP_COMMANDS.has(command);\n}\n\nfunction getInstalledHeadroomVersion(): string | null {\n\tif (cachedHeadroomVersion !== undefined) return cachedHeadroomVersion;\n\tcachedHeadroomVersion = readVersionFromCommand(\"headroom\", [\"--version\"]);\n\tif (cachedHeadroomVersion) return cachedHeadroomVersion;\n\tcachedHeadroomVersion = readVersionFromCommand(\"headroom\", [\"version\"]);\n\tif (cachedHeadroomVersion) return cachedHeadroomVersion;\n\tfor (const distribution of HEADROOM_PYTHON_DISTRIBUTIONS) {\n\t\tcachedHeadroomVersion = readPythonDistributionVersion(distribution);\n\t\tif (cachedHeadroomVersion) return cachedHeadroomVersion;\n\t}\n\tcachedHeadroomVersion = null;\n\treturn cachedHeadroomVersion;\n}\n\nfunction readPythonDistributionVersion(distribution: (typeof HEADROOM_PYTHON_DISTRIBUTIONS)[number]): string | null {\n\treturn readVersionFromCommand(\"python3\", [\n\t\t\"-c\",\n\t\t`import importlib.metadata as m; print(m.version('${distribution}'))`,\n\t]);\n}\n\nfunction readVersionFromCommand(command: string, args: readonly string[]): string | null {\n\ttry {\n\t\tconst result = spawnSync(command, [...args], {\n\t\t\tencoding: \"utf8\",\n\t\t\ttimeout: VERSION_COMMAND_TIMEOUT_MS,\n\t\t\tshell: false,\n\t\t\twindowsHide: true,\n\t\t\tenv: { PATH: process.env.PATH ?? \"\" },\n\t\t});\n\t\tif (result.error || result.status !== 0) return null;\n\t\treturn parseHeadroomVersionOutput(`${result.stdout}\\n${result.stderr}`);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function parseHeadroomVersionOutput(output: string): string | null {\n\tconst match = /\\bv?(\\d+\\.\\d+(?:\\.\\d+)?(?:[-+][0-9A-Za-z.-]+)?)\\b/.exec(output);\n\treturn match?.[1] ?? null;\n}\n\nexport function createControlPanelStatusSnapshot(\n\tsession: AgentSession,\n\tsessionManager: SessionManager,\n\tfooterData?: ReadonlyFooterDataProvider,\n): ControlPanelStatusSnapshot {\n\tconst contextUsage = session.getContextUsage();\n\tconst contextWindow = contextUsage?.contextWindow ?? session.state.model?.contextWindow ?? 0;\n\tconst mcpInventory = loadMcpInventory(sessionManager.getCwd());\n\tconst loadedSkills = session.resourceLoader.getSkills().skills;\n\tconst packageIntake = evaluatePiPackageIntake().summary;\n\tconst ansiColorState = process.env.NO_COLOR ? \"off\" : \"on\";\n\tconst cwdLabel = formatCwdForFooter(sessionManager.getCwd(), process.env.HOME || process.env.USERPROFILE);\n\treturn {\n\t\tmodelId: session.state.model?.id,\n\t\tmodelProvider: session.state.model?.provider,\n\t\tthinkingLevel: session.state.thinkingLevel ?? \"off\",\n\t\tcontextPercent: contextUsage?.percent ?? null,\n\t\tcontextWindowTokens: contextWindow,\n\t\tcontextTokens: contextUsage?.tokens ?? null,\n\t\theadroomStatus: formatHeadroomStatusLabel(),\n\t\toptimizerPolicy: getHeadroomRuntimeStatus().selector,\n\t\tmcpCount: countStableMcpServers(mcpInventory.entries),\n\t\tskillCount: countRoutableNonHubSkills(loadedSkills),\n\t\tpackageIntake,\n\t\tcwdLabel,\n\t\tgitBranch: footerData?.getGitBranch(),\n\t\ttodoState: getCurrentTodoState(),\n\t\truntimeState: \"ready\",\n\t\trouteState: \"active\",\n\t\tevidenceState: \"tracking\",\n\t\tcontrolState: \"ready\",\n\t\tdagOrchestrationState: \"DAG:omk-parallel-orchestrator\",\n\t\tansiColorState,\n\t\tstartupState: \"linked\",\n\t\tlinkState: \"ready\",\n\t\tsidebarState: \"pinned\",\n\t};\n}\n"]}
1
+ {"version":3,"file":"control-panel-runtime-status.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/control-panel-runtime-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAuB,MAAM,gCAAgC,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IACnC,YAAY;IACZ,iBAAiB;IACjB,kBAAkB;IAClB,cAAc;IACd,oBAAoB;IACpB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,iBAAiB;IACjB,mBAAmB;IACnB,cAAc;IACd,UAAU;IACV,UAAU;CACV,CAAC,CAAC;AAEH,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAC,0BAA0B,EAAE,6BAA6B,CAAC,CAAC,CAAC;AACvG,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EA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O;QACN,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE;QAChC,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ;QAC5C,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,aAAa,IAAI,KAAK;QACnD,cAAc,EAAE,YAAY,EAAE,OAAO,IAAI,IAAI;QAC7C,mBAAmB,EAAE,aAAa;QAClC,aAAa,EAAE,YAAY,EAAE,MAAM,IAAI,IAAI;QAC3C,cAAc,EAAE,yBAAyB,EAAE;QAC3C,eAAe,EAAE,wBAAwB,EAAE,CAAC,QAAQ;QACpD,QAAQ,EAAE,qBAAqB,CAAC,YAAY,CAAC,OAAO,CAAC;QACrD,UAAU,EAAE,yBAAyB,CAAC,YAAY,CAAC;QACnD,aAAa;QACb,QAAQ;QACR,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE;QACrC,SAAS,EAAE,mBAAmB,EAAE;QAChC,YAAY,EAAE,OAAO;QACrB,UAAU,EAAE,QAAQ;QACpB,aAAa,EAAE,UAAU;QACzB,YAAY,EAAE,OAAO;QACrB,qBAAqB,EAAE,+BAA+B;QACtD,cAAc;QACd,YAAY,EAAE,QAAQ;QACtB,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,QAAQ;KACtB,CAAC;AAAA,CACF","sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport { getHeadroomRuntimeStatus } from \"../../../core/context-budget-headroom.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport { loadMcpInventory, type McpServerEntry } from \"../../../core/mcp-inventory.ts\";\nimport { evaluatePiPackageIntake } from \"../../../core/pi-package-intake.ts\";\nimport type { SessionManager } from \"../../../core/session-manager.ts\";\nimport { getCurrentTodoState } from \"../../../core/todo-runtime-state.ts\";\nimport type { ControlPanelStatusSnapshot } from \"./control-panel-layout.ts\";\nimport { formatCwdForFooter } from \"./footer.ts\";\n\nconst OMK_HUB_SKILL_NAMES = new Set([\n\t\"omk-skills\",\n\t\"omk-engineering\",\n\t\"omk-backend-data\",\n\t\"omk-security\",\n\t\"omk-devops-release\",\n\t\"omk-research-docs\",\n\t\"omk-design-media\",\n\t\"omk-agent-ops\",\n\t\"omk-product-ops\",\n\t\"omk-workspace-ops\",\n\t\"omk-frontend\",\n\t\"omk-loop\",\n\t\"omk-plan\",\n]);\n\nconst INVALID_MCP_NETWORK_RULES = new Set([\"mcp.network.invalid_mode\", \"mcp.network.empty_allowlist\"]);\nconst PRIVILEGED_MCP_COMMANDS = new Set([\"sudo\", \"su\"]);\nconst VERSION_COMMAND_TIMEOUT_MS = 750;\nconst HEADROOM_PYTHON_DISTRIBUTIONS = [\"headroom\", \"headroom-ai\"] as const;\n\nlet cachedHeadroomVersion: string | null | undefined;\n\ninterface McpStabilityInput {\n\treadonly commandSummary: string;\n\treadonly overriddenBy?: string;\n\treadonly networkDecision: Pick<McpServerEntry[\"networkDecision\"], \"rule\">;\n\treadonly capabilityDecision: Pick<McpServerEntry[\"capabilityDecision\"], \"malformed\" | \"unknownCapabilities\">;\n\treadonly authDecision: Pick<McpServerEntry[\"authDecision\"], \"rule\">;\n}\n\nexport function formatHeadroomStatusLabel(): string {\n\tconst version = getInstalledHeadroomVersion();\n\treturn version ? `headroom:${version}` : getHeadroomRuntimeStatus().policyId;\n}\n\nexport function countRoutableNonHubSkills(skills: readonly { readonly name: string }[]): number {\n\treturn skills.filter((skill) => !OMK_HUB_SKILL_NAMES.has(skill.name)).length;\n}\n\nexport function countStableMcpServers(entries: readonly McpStabilityInput[]): number {\n\treturn entries.filter((entry) => classifyMcpStability(entry) === \"stable\").length;\n}\n\n/**\n * Classify a single MCP server entry for status display.\n *\n * - `stable`: configured, healthy, and safe to surface as an active server.\n * - `overridden`: a higher-precedence source replaced this entry.\n * - `unstable`: malformed, privileged, or blocked by an auth/network policy.\n */\nexport type McpStability = \"stable\" | \"overridden\" | \"unstable\";\n\nexport function classifyMcpStability(entry: McpStabilityInput): McpStability {\n\tif (entry.overriddenBy) return \"overridden\";\n\tif (entry.commandSummary === \"<unknown>\") return \"unstable\";\n\tif (entry.authDecision.rule === \"mcp.auth.invalid\") return \"unstable\";\n\tif (INVALID_MCP_NETWORK_RULES.has(entry.networkDecision.rule)) return \"unstable\";\n\tif (entry.capabilityDecision.malformed || entry.capabilityDecision.unknownCapabilities.length > 0) return \"unstable\";\n\tconst command = entry.commandSummary.split(/\\s+/, 1)[0] ?? \"\";\n\tif (PRIVILEGED_MCP_COMMANDS.has(command)) return \"unstable\";\n\treturn \"stable\";\n}\n\nfunction getInstalledHeadroomVersion(): string | null {\n\tif (cachedHeadroomVersion !== undefined) return cachedHeadroomVersion;\n\tcachedHeadroomVersion = readVersionFromCommand(\"headroom\", [\"--version\"]);\n\tif (cachedHeadroomVersion) return cachedHeadroomVersion;\n\tcachedHeadroomVersion = readVersionFromCommand(\"headroom\", [\"version\"]);\n\tif (cachedHeadroomVersion) return cachedHeadroomVersion;\n\tfor (const distribution of HEADROOM_PYTHON_DISTRIBUTIONS) {\n\t\tcachedHeadroomVersion = readPythonDistributionVersion(distribution);\n\t\tif (cachedHeadroomVersion) return cachedHeadroomVersion;\n\t}\n\tcachedHeadroomVersion = null;\n\treturn cachedHeadroomVersion;\n}\n\nfunction readPythonDistributionVersion(distribution: (typeof HEADROOM_PYTHON_DISTRIBUTIONS)[number]): string | null {\n\treturn readVersionFromCommand(\"python3\", [\n\t\t\"-c\",\n\t\t`import importlib.metadata as m; print(m.version('${distribution}'))`,\n\t]);\n}\n\nfunction readVersionFromCommand(command: string, args: readonly string[]): string | null {\n\ttry {\n\t\tconst result = spawnSync(command, [...args], {\n\t\t\tencoding: \"utf8\",\n\t\t\ttimeout: VERSION_COMMAND_TIMEOUT_MS,\n\t\t\tshell: false,\n\t\t\twindowsHide: true,\n\t\t\tenv: { PATH: process.env.PATH ?? \"\" },\n\t\t});\n\t\tif (result.error || result.status !== 0) return null;\n\t\treturn parseHeadroomVersionOutput(`${result.stdout}\\n${result.stderr}`);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function parseHeadroomVersionOutput(output: string): string | null {\n\tconst match = /\\bv?(\\d+\\.\\d+(?:\\.\\d+)?(?:[-+][0-9A-Za-z.-]+)?)\\b/.exec(output);\n\treturn match?.[1] ?? null;\n}\n\nexport function createControlPanelStatusSnapshot(\n\tsession: AgentSession,\n\tsessionManager: SessionManager,\n\tfooterData?: ReadonlyFooterDataProvider,\n): ControlPanelStatusSnapshot {\n\tconst contextUsage = session.getContextUsage();\n\tconst contextWindow = contextUsage?.contextWindow ?? session.state.model?.contextWindow ?? 0;\n\tconst mcpInventory = loadMcpInventory(sessionManager.getCwd());\n\tconst loadedSkills = session.resourceLoader.getSkills().skills;\n\tconst packageIntake = evaluatePiPackageIntake().summary;\n\tconst ansiColorState = process.env.NO_COLOR ? \"off\" : \"on\";\n\tconst cwdLabel = formatCwdForFooter(sessionManager.getCwd(), process.env.HOME || process.env.USERPROFILE);\n\treturn {\n\t\tmodelId: session.state.model?.id,\n\t\tmodelProvider: session.state.model?.provider,\n\t\tthinkingLevel: session.state.thinkingLevel ?? \"off\",\n\t\tcontextPercent: contextUsage?.percent ?? null,\n\t\tcontextWindowTokens: contextWindow,\n\t\tcontextTokens: contextUsage?.tokens ?? null,\n\t\theadroomStatus: formatHeadroomStatusLabel(),\n\t\toptimizerPolicy: getHeadroomRuntimeStatus().selector,\n\t\tmcpCount: countStableMcpServers(mcpInventory.entries),\n\t\tskillCount: countRoutableNonHubSkills(loadedSkills),\n\t\tpackageIntake,\n\t\tcwdLabel,\n\t\tgitBranch: footerData?.getGitBranch(),\n\t\ttodoState: getCurrentTodoState(),\n\t\truntimeState: \"ready\",\n\t\trouteState: \"active\",\n\t\tevidenceState: \"tracking\",\n\t\tcontrolState: \"ready\",\n\t\tdagOrchestrationState: \"DAG:omk-parallel-orchestrator\",\n\t\tansiColorState,\n\t\tstartupState: \"linked\",\n\t\tlinkState: \"ready\",\n\t\tsidebarState: \"pinned\",\n\t};\n}\n"]}
@@ -22,6 +22,11 @@ export interface SparkleAnchor {
22
22
  * stable `visibleWidth` of `innerWidth` regardless of motion frame.
23
23
  */
24
24
  export declare function sparkleRow(innerWidth: number, anchors: readonly SparkleAnchor[], frameMs: number): string;
25
+ /**
26
+ * The starfield is deliberately monochrome: `dim` and `muted` ink with a single
27
+ * accent star per row. Multi-hue confetti competed with the wordmark once the
28
+ * frames were reduced to hairlines.
29
+ */
25
30
  export declare const SPARKLE_ROW_TOP: readonly SparkleAnchor[];
26
31
  export declare const SPARKLE_ROW_BOTTOM: readonly SparkleAnchor[];
27
32
  //# sourceMappingURL=control-panel-sparkles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-panel-sparkles.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/control-panel-sparkles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAS,MAAM,mBAAmB,CAAC;AAE3D;;;;;;;;GAQG;AAEH,MAAM,WAAW,aAAa;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAYD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,aAAa,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAUzG;AAED,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAKnD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,aAAa,EAMtD,CAAC","sourcesContent":["import { type ThemeColor, theme } from \"../theme/theme.ts\";\n\n/**\n * Neon sparkle starfield for the OMK hero banner.\n *\n * The twinkle cadence is adapted from bokub/chalk-animation's `neon` effect\n * (https://github.com/bokub/chalk-animation), which alternates a glyph between\n * a dim and a bold neon color every ~500ms frame. Here it is extended to a\n * three-state flicker (bold / lit / faint) with a per-sparkle phase offset so\n * the field shimmers out of sync instead of strobing in lockstep.\n */\n\nexport interface SparkleAnchor {\n\t/** Horizontal position across the inner banner width, 0..1. */\n\treadonly frac: number;\n\treadonly glyph: string;\n\treadonly color: ThemeColor;\n\t/** Phase offset (in frames) so sparkles twinkle independently. */\n\treadonly phase: number;\n}\n\nconst SPARKLE_PERIOD_MS = 520;\n\nfunction twinkle(glyph: string, color: ThemeColor, phase: number, frameMs: number): string {\n\tconst frame = Math.floor(frameMs / SPARKLE_PERIOD_MS) + phase;\n\tconst state = ((frame % 3) + 3) % 3;\n\tif (state === 0) return theme.bold(theme.fg(color, glyph));\n\tif (state === 1) return theme.fg(color, glyph);\n\treturn theme.fg(\"dim\", glyph);\n}\n\n/**\n * Render a full-inner-width row with sparkles stamped at their fractional\n * columns. Every non-sparkle cell stays a literal space, so the row keeps a\n * stable `visibleWidth` of `innerWidth` regardless of motion frame.\n */\nexport function sparkleRow(innerWidth: number, anchors: readonly SparkleAnchor[], frameMs: number): string {\n\tif (innerWidth <= 0) return \"\";\n\tconst cells: string[] = new Array(innerWidth).fill(\" \");\n\tfor (const anchor of anchors) {\n\t\tconst col = Math.round(anchor.frac * (innerWidth - 1));\n\t\tif (col >= 0 && col < innerWidth) {\n\t\t\tcells[col] = twinkle(anchor.glyph, anchor.color, anchor.phase, frameMs);\n\t\t}\n\t}\n\treturn cells.join(\"\");\n}\n\nexport const SPARKLE_ROW_TOP: readonly SparkleAnchor[] = [\n\t{ frac: 0.1, glyph: \"·\", color: \"muted\", phase: 0 },\n\t{ frac: 0.28, glyph: \"•\", color: \"warning\", phase: 1 },\n\t{ frac: 0.73, glyph: \"✦\", color: \"mdCode\", phase: 2 },\n\t{ frac: 0.9, glyph: \"◆\", color: \"mdCode\", phase: 0 },\n];\n\nexport const SPARKLE_ROW_BOTTOM: readonly SparkleAnchor[] = [\n\t{ frac: 0.06, glyph: \"·\", color: \"muted\", phase: 2 },\n\t{ frac: 0.21, glyph: \"◆\", color: \"mdCode\", phase: 1 },\n\t{ frac: 0.55, glyph: \"·\", color: \"success\", phase: 0 },\n\t{ frac: 0.82, glyph: \"✦\", color: \"warning\", phase: 1 },\n\t{ frac: 0.96, glyph: \"◆\", color: \"accent\", phase: 2 },\n];\n"]}
1
+ {"version":3,"file":"control-panel-sparkles.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/control-panel-sparkles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAS,MAAM,mBAAmB,CAAC;AAE3D;;;;;;;;GAQG;AAEH,MAAM,WAAW,aAAa;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAYD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,aAAa,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAUzG;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAKnD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,aAAa,EAMtD,CAAC","sourcesContent":["import { type ThemeColor, theme } from \"../theme/theme.ts\";\n\n/**\n * Neon sparkle starfield for the OMK hero banner.\n *\n * The twinkle cadence is adapted from bokub/chalk-animation's `neon` effect\n * (https://github.com/bokub/chalk-animation), which alternates a glyph between\n * a dim and a bold neon color every ~500ms frame. Here it is extended to a\n * three-state flicker (bold / lit / faint) with a per-sparkle phase offset so\n * the field shimmers out of sync instead of strobing in lockstep.\n */\n\nexport interface SparkleAnchor {\n\t/** Horizontal position across the inner banner width, 0..1. */\n\treadonly frac: number;\n\treadonly glyph: string;\n\treadonly color: ThemeColor;\n\t/** Phase offset (in frames) so sparkles twinkle independently. */\n\treadonly phase: number;\n}\n\nconst SPARKLE_PERIOD_MS = 520;\n\nfunction twinkle(glyph: string, color: ThemeColor, phase: number, frameMs: number): string {\n\tconst frame = Math.floor(frameMs / SPARKLE_PERIOD_MS) + phase;\n\tconst state = ((frame % 3) + 3) % 3;\n\tif (state === 0) return theme.bold(theme.fg(color, glyph));\n\tif (state === 1) return theme.fg(color, glyph);\n\treturn theme.fg(\"dim\", glyph);\n}\n\n/**\n * Render a full-inner-width row with sparkles stamped at their fractional\n * columns. Every non-sparkle cell stays a literal space, so the row keeps a\n * stable `visibleWidth` of `innerWidth` regardless of motion frame.\n */\nexport function sparkleRow(innerWidth: number, anchors: readonly SparkleAnchor[], frameMs: number): string {\n\tif (innerWidth <= 0) return \"\";\n\tconst cells: string[] = new Array(innerWidth).fill(\" \");\n\tfor (const anchor of anchors) {\n\t\tconst col = Math.round(anchor.frac * (innerWidth - 1));\n\t\tif (col >= 0 && col < innerWidth) {\n\t\t\tcells[col] = twinkle(anchor.glyph, anchor.color, anchor.phase, frameMs);\n\t\t}\n\t}\n\treturn cells.join(\"\");\n}\n\n/**\n * The starfield is deliberately monochrome: `dim` and `muted` ink with a single\n * accent star per row. Multi-hue confetti competed with the wordmark once the\n * frames were reduced to hairlines.\n */\nexport const SPARKLE_ROW_TOP: readonly SparkleAnchor[] = [\n\t{ frac: 0.1, glyph: \"·\", color: \"dim\", phase: 0 },\n\t{ frac: 0.28, glyph: \"·\", color: \"muted\", phase: 1 },\n\t{ frac: 0.73, glyph: \"✦\", color: \"dim\", phase: 2 },\n\t{ frac: 0.9, glyph: \"·\", color: \"accent\", phase: 0 },\n];\n\nexport const SPARKLE_ROW_BOTTOM: readonly SparkleAnchor[] = [\n\t{ frac: 0.06, glyph: \"·\", color: \"dim\", phase: 2 },\n\t{ frac: 0.21, glyph: \"·\", color: \"muted\", phase: 1 },\n\t{ frac: 0.55, glyph: \"✦\", color: \"dim\", phase: 0 },\n\t{ frac: 0.82, glyph: \"·\", color: \"muted\", phase: 1 },\n\t{ frac: 0.96, glyph: \"·\", color: \"accent\", phase: 2 },\n];\n"]}
@@ -26,17 +26,22 @@ export function sparkleRow(innerWidth, anchors, frameMs) {
26
26
  }
27
27
  return cells.join("");
28
28
  }
29
+ /**
30
+ * The starfield is deliberately monochrome: `dim` and `muted` ink with a single
31
+ * accent star per row. Multi-hue confetti competed with the wordmark once the
32
+ * frames were reduced to hairlines.
33
+ */
29
34
  export const SPARKLE_ROW_TOP = [
30
- { frac: 0.1, glyph: "·", color: "muted", phase: 0 },
31
- { frac: 0.28, glyph: "", color: "warning", phase: 1 },
32
- { frac: 0.73, glyph: "✦", color: "mdCode", phase: 2 },
33
- { frac: 0.9, glyph: "", color: "mdCode", phase: 0 },
35
+ { frac: 0.1, glyph: "·", color: "dim", phase: 0 },
36
+ { frac: 0.28, glyph: "·", color: "muted", phase: 1 },
37
+ { frac: 0.73, glyph: "✦", color: "dim", phase: 2 },
38
+ { frac: 0.9, glyph: "·", color: "accent", phase: 0 },
34
39
  ];
35
40
  export const SPARKLE_ROW_BOTTOM = [
36
- { frac: 0.06, glyph: "·", color: "muted", phase: 2 },
37
- { frac: 0.21, glyph: "", color: "mdCode", phase: 1 },
38
- { frac: 0.55, glyph: "·", color: "success", phase: 0 },
39
- { frac: 0.82, glyph: "", color: "warning", phase: 1 },
40
- { frac: 0.96, glyph: "", color: "accent", phase: 2 },
41
+ { frac: 0.06, glyph: "·", color: "dim", phase: 2 },
42
+ { frac: 0.21, glyph: "·", color: "muted", phase: 1 },
43
+ { frac: 0.55, glyph: "", color: "dim", phase: 0 },
44
+ { frac: 0.82, glyph: "·", color: "muted", phase: 1 },
45
+ { frac: 0.96, glyph: "·", color: "accent", phase: 2 },
41
46
  ];
42
47
  //# sourceMappingURL=control-panel-sparkles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-panel-sparkles.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/control-panel-sparkles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAqB3D,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,SAAS,OAAO,CAAC,KAAa,EAAE,KAAiB,EAAE,KAAa,EAAE,OAAe,EAAU;IAC1F,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,iBAAiB,CAAC,GAAG,KAAK,CAAC;IAC9D,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC3D,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAAA,CAC9B;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,UAAkB,EAAE,OAAiC,EAAE,OAAe,EAAU;IAC1G,IAAI,UAAU,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAa,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;QACvD,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,UAAU,EAAE,CAAC;YAClC,KA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AAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE;CACrD,CAAC","sourcesContent":["import { type ThemeColor, theme } from \"../theme/theme.ts\";\n\n/**\n * Neon sparkle starfield for the OMK hero banner.\n *\n * The twinkle cadence is adapted from bokub/chalk-animation's `neon` effect\n * (https://github.com/bokub/chalk-animation), which alternates a glyph between\n * a dim and a bold neon color every ~500ms frame. Here it is extended to a\n * three-state flicker (bold / lit / faint) with a per-sparkle phase offset so\n * the field shimmers out of sync instead of strobing in lockstep.\n */\n\nexport interface SparkleAnchor {\n\t/** Horizontal position across the inner banner width, 0..1. */\n\treadonly frac: number;\n\treadonly glyph: string;\n\treadonly color: ThemeColor;\n\t/** Phase offset (in frames) so sparkles twinkle independently. */\n\treadonly phase: number;\n}\n\nconst SPARKLE_PERIOD_MS = 520;\n\nfunction twinkle(glyph: string, color: ThemeColor, phase: number, frameMs: number): string {\n\tconst frame = Math.floor(frameMs / SPARKLE_PERIOD_MS) + phase;\n\tconst state = ((frame % 3) + 3) % 3;\n\tif (state === 0) return theme.bold(theme.fg(color, glyph));\n\tif (state === 1) return theme.fg(color, glyph);\n\treturn theme.fg(\"dim\", glyph);\n}\n\n/**\n * Render a full-inner-width row with sparkles stamped at their fractional\n * columns. Every non-sparkle cell stays a literal space, so the row keeps a\n * stable `visibleWidth` of `innerWidth` regardless of motion frame.\n */\nexport function sparkleRow(innerWidth: number, anchors: readonly SparkleAnchor[], frameMs: number): string {\n\tif (innerWidth <= 0) return \"\";\n\tconst cells: string[] = new Array(innerWidth).fill(\" \");\n\tfor (const anchor of anchors) {\n\t\tconst col = Math.round(anchor.frac * (innerWidth - 1));\n\t\tif (col >= 0 && col < innerWidth) {\n\t\t\tcells[col] = twinkle(anchor.glyph, anchor.color, anchor.phase, frameMs);\n\t\t}\n\t}\n\treturn cells.join(\"\");\n}\n\nexport const SPARKLE_ROW_TOP: readonly SparkleAnchor[] = [\n\t{ frac: 0.1, glyph: \"·\", color: \"muted\", phase: 0 },\n\t{ frac: 0.28, glyph: \"•\", color: \"warning\", phase: 1 },\n\t{ frac: 0.73, glyph: \"✦\", color: \"mdCode\", phase: 2 },\n\t{ frac: 0.9, glyph: \"◆\", color: \"mdCode\", phase: 0 },\n];\n\nexport const SPARKLE_ROW_BOTTOM: readonly SparkleAnchor[] = [\n\t{ frac: 0.06, glyph: \"·\", color: \"muted\", phase: 2 },\n\t{ frac: 0.21, glyph: \"◆\", color: \"mdCode\", phase: 1 },\n\t{ frac: 0.55, glyph: \"·\", color: \"success\", phase: 0 },\n\t{ frac: 0.82, glyph: \"✦\", color: \"warning\", phase: 1 },\n\t{ frac: 0.96, glyph: \"◆\", color: \"accent\", phase: 2 },\n];\n"]}
1
+ {"version":3,"file":"control-panel-sparkles.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/control-panel-sparkles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAqB3D,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,SAAS,OAAO,CAAC,KAAa,EAAE,KAAiB,EAAE,KAAa,EAAE,OAAe,EAAU;IAC1F,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,iBAAiB,CAAC,GAAG,KAAK,CAAC;IAC9D,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC3D,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAAA,CAC9B;AAED;;;;GAIG;AACH,MAAM,UAAU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K,EAAE,IAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE;IAClD,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;IACpD,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE;IAClD,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;IACpD,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE;CACrD,CAAC","sourcesContent":["import { type ThemeColor, theme } from \"../theme/theme.ts\";\n\n/**\n * Neon sparkle starfield for the OMK hero banner.\n *\n * The twinkle cadence is adapted from bokub/chalk-animation's `neon` effect\n * (https://github.com/bokub/chalk-animation), which alternates a glyph between\n * a dim and a bold neon color every ~500ms frame. Here it is extended to a\n * three-state flicker (bold / lit / faint) with a per-sparkle phase offset so\n * the field shimmers out of sync instead of strobing in lockstep.\n */\n\nexport interface SparkleAnchor {\n\t/** Horizontal position across the inner banner width, 0..1. */\n\treadonly frac: number;\n\treadonly glyph: string;\n\treadonly color: ThemeColor;\n\t/** Phase offset (in frames) so sparkles twinkle independently. */\n\treadonly phase: number;\n}\n\nconst SPARKLE_PERIOD_MS = 520;\n\nfunction twinkle(glyph: string, color: ThemeColor, phase: number, frameMs: number): string {\n\tconst frame = Math.floor(frameMs / SPARKLE_PERIOD_MS) + phase;\n\tconst state = ((frame % 3) + 3) % 3;\n\tif (state === 0) return theme.bold(theme.fg(color, glyph));\n\tif (state === 1) return theme.fg(color, glyph);\n\treturn theme.fg(\"dim\", glyph);\n}\n\n/**\n * Render a full-inner-width row with sparkles stamped at their fractional\n * columns. Every non-sparkle cell stays a literal space, so the row keeps a\n * stable `visibleWidth` of `innerWidth` regardless of motion frame.\n */\nexport function sparkleRow(innerWidth: number, anchors: readonly SparkleAnchor[], frameMs: number): string {\n\tif (innerWidth <= 0) return \"\";\n\tconst cells: string[] = new Array(innerWidth).fill(\" \");\n\tfor (const anchor of anchors) {\n\t\tconst col = Math.round(anchor.frac * (innerWidth - 1));\n\t\tif (col >= 0 && col < innerWidth) {\n\t\t\tcells[col] = twinkle(anchor.glyph, anchor.color, anchor.phase, frameMs);\n\t\t}\n\t}\n\treturn cells.join(\"\");\n}\n\n/**\n * The starfield is deliberately monochrome: `dim` and `muted` ink with a single\n * accent star per row. Multi-hue confetti competed with the wordmark once the\n * frames were reduced to hairlines.\n */\nexport const SPARKLE_ROW_TOP: readonly SparkleAnchor[] = [\n\t{ frac: 0.1, glyph: \"·\", color: \"dim\", phase: 0 },\n\t{ frac: 0.28, glyph: \"·\", color: \"muted\", phase: 1 },\n\t{ frac: 0.73, glyph: \"✦\", color: \"dim\", phase: 2 },\n\t{ frac: 0.9, glyph: \"·\", color: \"accent\", phase: 0 },\n];\n\nexport const SPARKLE_ROW_BOTTOM: readonly SparkleAnchor[] = [\n\t{ frac: 0.06, glyph: \"·\", color: \"dim\", phase: 2 },\n\t{ frac: 0.21, glyph: \"·\", color: \"muted\", phase: 1 },\n\t{ frac: 0.55, glyph: \"✦\", color: \"dim\", phase: 0 },\n\t{ frac: 0.82, glyph: \"·\", color: \"muted\", phase: 1 },\n\t{ frac: 0.96, glyph: \"·\", color: \"accent\", phase: 2 },\n];\n"]}
@@ -1,6 +1,16 @@
1
1
  import { type Component } from "omk-tui";
2
2
  import type { AgentSession } from "../../../core/agent-session.ts";
3
3
  import type { ReadonlyFooterDataProvider } from "../../../core/footer-data-provider.ts";
4
+ import type { PiPackageIntakeSummary } from "../../../core/pi-package-intake.ts";
5
+ /**
6
+ * Format token counts for compact footer display.
7
+ */
8
+ export declare function formatTokens(count: number): string;
9
+ /**
10
+ * Format byte counts for compact footer display.
11
+ */
12
+ export declare function formatBytes(bytes: number): string;
13
+ export declare function formatPackageIntake(summary: PiPackageIntakeSummary): string;
4
14
  export declare function formatCwdForFooter(cwd: string, home: string | undefined): string;
5
15
  /**
6
16
  * Footer component that shows pwd, token stats, and context usage.
@@ -1 +1 @@
1
- {"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAiC,MAAM,SAAS,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AA4CxF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAYhF;AAED;;;GAGG;AACH,qBAAa,eAAgB,YAAW,SAAS;IAChD,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,UAAU,CAA6B;IAE/C,YAAY,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,0BAA0B,EAGxE;IAED,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAEtC;IAED,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE5C;IAED;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IA8B3B;;;OAGG;IACH,UAAU,IAAI,IAAI,CAEjB;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,CAEd;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA6J9B;CACD","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport { type Component, truncateToWidth, visibleWidth } from \"omk-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { PiPackageIntakeSummary } from \"../../../core/pi-package-intake.ts\";\nimport { theme } from \"../theme/theme.ts\";\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/**\n * Format token counts for compact footer display.\n */\nfunction formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\n/**\n * Format byte counts for compact footer display.\n */\nfunction formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes}B`;\n\tif (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)}K`;\n\tif (bytes < 1024 * 1024 * 1024) return `${Math.round(bytes / (1024 * 1024))}M`;\n\treturn `${(bytes / (1024 * 1024 * 1024)).toFixed(1)}G`;\n}\n\nfunction formatPackageIntake(summary: PiPackageIntakeSummary): string {\n\tconst ready =\n\t\tsummary.acceptedNative + summary.acceptedReference + summary.acceptedMeasurement + summary.acceptedAdvisory;\n\tconst review = summary.deferred + summary.reject;\n\treturn `PKG ${ready}/${summary.total} R${review} B${summary.hardForkBlocked}`;\n}\n\nexport function formatCwdForFooter(cwd: string, home: string | undefined): string {\n\tif (!home) return cwd;\n\n\tconst resolvedCwd = resolve(cwd);\n\tconst resolvedHome = resolve(home);\n\tconst relativeToHome = relative(resolvedHome, resolvedCwd);\n\tconst isInsideHome =\n\t\trelativeToHome === \"\" ||\n\t\t(relativeToHome !== \"..\" && !relativeToHome.startsWith(`..${sep}`) && !isAbsolute(relativeToHome));\n\n\tif (!isInsideHome) return cwd;\n\treturn relativeToHome === \"\" ? \"~\" : `~${sep}${relativeToHome}`;\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\tprivate session: AgentSession;\n\tprivate footerData: ReadonlyFooterDataProvider;\n\n\tconstructor(session: AgentSession, footerData: ReadonlyFooterDataProvider) {\n\t\tthis.session = session;\n\t\tthis.footerData = footerData;\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 * Build a compact system-wide CPU/memory metrics segment for the footer.\n\t * Degrades gracefully to shorter forms (or is omitted entirely) when the\n\t * terminal is very narrow so the rest of the footer can still render.\n\t */\n\tprivate buildMetricsSegment(width: number): string | undefined {\n\t\tconst cpu = this.footerData.getSystemCpuPercent();\n\t\tconst memUsed = this.footerData.getSystemMemoryUsedBytes();\n\t\tconst memTotal = this.footerData.getSystemMemoryTotalBytes();\n\t\tif (cpu === null || memUsed === null || memTotal === null || memTotal <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst memPercent = (memUsed / memTotal) * 100;\n\t\tconst color: \"error\" | \"warning\" | \"dim\" =\n\t\t\tcpu >= 90 || memPercent >= 95 ? \"error\" : cpu >= 70 || memPercent >= 85 ? \"warning\" : \"dim\";\n\n\t\tconst cpuStr = `${Math.round(cpu)}%`;\n\t\tconst memStr = `${Math.round(memPercent)}%`;\n\n\t\tif (width >= 56) {\n\t\t\treturn theme.fg(color, `CPU ${cpuStr} MEM ${memStr} (${formatBytes(memUsed)}/${formatBytes(memTotal)})`);\n\t\t}\n\t\tif (width >= 48) {\n\t\t\treturn theme.fg(color, `CPU ${cpuStr} MEM ${memStr}`);\n\t\t}\n\t\tif (width >= 30) {\n\t\t\treturn theme.fg(color, `${cpuStr} ${memStr}`);\n\t\t}\n\t\tif (width >= 18) {\n\t\t\treturn theme.fg(color, cpuStr);\n\t\t}\n\t\treturn undefined;\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// Calculate cumulative usage from ALL session entries (not just post-compaction messages)\n\t\tlet totalInput = 0;\n\t\tlet totalOutput = 0;\n\t\tlet totalCacheRead = 0;\n\t\tlet totalCacheWrite = 0;\n\t\tlet totalCost = 0;\n\n\t\tfor (const entry of this.session.sessionManager.getEntries()) {\n\t\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\t\ttotalInput += entry.message.usage.input;\n\t\t\t\ttotalOutput += entry.message.usage.output;\n\t\t\t\ttotalCacheRead += entry.message.usage.cacheRead;\n\t\t\t\ttotalCacheWrite += entry.message.usage.cacheWrite;\n\t\t\t\ttotalCost += entry.message.usage.cost.total;\n\t\t\t}\n\t\t}\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 = formatCwdForFooter(this.session.sessionManager.getCwd(), process.env.HOME || process.env.USERPROFILE);\n\n\t\t// Add git branch if available\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tif (branch) {\n\t\t\tpwd = `${pwd} (${branch})`;\n\t\t}\n\n\t\t// Add session name if set\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\t\tif (sessionName) {\n\t\t\tpwd = `${pwd} • ${sessionName}`;\n\t\t}\n\n\t\t// Build stats line\n\t\tconst statsParts = [];\n\t\tif (totalInput) statsParts.push(`↑${formatTokens(totalInput)}`);\n\t\tif (totalOutput) statsParts.push(`↓${formatTokens(totalOutput)}`);\n\t\tif (totalCacheRead) statsParts.push(`R${formatTokens(totalCacheRead)}`);\n\t\tif (totalCacheWrite) statsParts.push(`W${formatTokens(totalCacheWrite)}`);\n\n\t\t// Show cost with \"(sub)\" indicator if using OAuth subscription\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\tstatsParts.push(costStr);\n\t\t}\n\n\t\t// Add CPU/memory metrics; degrade gracefully when horizontal space is tight.\n\t\tconst metricsSegment = this.buildMetricsSegment(width);\n\t\tif (metricsSegment) {\n\t\t\tstatsParts.push(metricsSegment);\n\t\t}\n\t\tstatsParts.push(formatPackageIntake(this.footerData.getPackageIntakeSummary()));\n\n\t\t// Colorize context percentage based on usage\n\t\tlet contextPercentStr: string;\n\t\tconst autoIndicator = this.autoCompactEnabled ? \" (auto)\" : \"\";\n\t\tconst contextPercentDisplay =\n\t\t\tcontextPercent === \"?\"\n\t\t\t\t? `?/${formatTokens(contextWindow)}${autoIndicator}`\n\t\t\t\t: `${contextPercent}%/${formatTokens(contextWindow)}${autoIndicator}`;\n\t\tif (contextPercentValue > 90) {\n\t\t\tcontextPercentStr = theme.fg(\"error\", contextPercentDisplay);\n\t\t} else if (contextPercentValue > 70) {\n\t\t\tcontextPercentStr = theme.fg(\"warning\", contextPercentDisplay);\n\t\t} else {\n\t\t\tcontextPercentStr = contextPercentDisplay;\n\t\t}\n\t\tstatsParts.push(contextPercentStr);\n\n\t\tlet statsLeft = statsParts.join(\" \");\n\n\t\t// Add model name on the right side, plus thinking level if model supports it\n\t\tconst modelName = state.model?.id || \"no-model\";\n\n\t\tlet statsLeftWidth = visibleWidth(statsLeft);\n\n\t\t// If statsLeft is too wide, truncate it\n\t\tif (statsLeftWidth > width) {\n\t\t\tstatsLeft = truncateToWidth(statsLeft, width, \"...\");\n\t\t\tstatsLeftWidth = visibleWidth(statsLeft);\n\t\t}\n\n\t\t// Calculate available space for padding (minimum 2 spaces between stats and model)\n\t\tconst minPadding = 2;\n\n\t\t// Add thinking level indicator if model supports reasoning\n\t\tlet rightSideWithoutProvider = modelName;\n\t\tif (state.model?.reasoning) {\n\t\t\tconst thinkingLevel = state.thinkingLevel || \"off\";\n\t\t\trightSideWithoutProvider =\n\t\t\t\tthinkingLevel === \"off\" ? `${modelName} • thinking off` : `${modelName} • ${thinkingLevel}`;\n\t\t}\n\n\t\t// Prepend the provider in parentheses if there are multiple providers and there's enough room\n\t\tlet rightSide = rightSideWithoutProvider;\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\trightSide = `(${state.model!.provider}) ${rightSideWithoutProvider}`;\n\t\t\tif (statsLeftWidth + minPadding + visibleWidth(rightSide) > width) {\n\t\t\t\t// Too wide, fall back\n\t\t\t\trightSide = rightSideWithoutProvider;\n\t\t\t}\n\t\t}\n\n\t\tconst rightSideWidth = visibleWidth(rightSide);\n\t\tconst totalNeeded = statsLeftWidth + minPadding + rightSideWidth;\n\n\t\tlet statsLine: string;\n\t\tif (totalNeeded <= width) {\n\t\t\t// Both fit - add padding to right-align model\n\t\t\tconst padding = \" \".repeat(width - statsLeftWidth - rightSideWidth);\n\t\t\tstatsLine = statsLeft + padding + rightSide;\n\t\t} else {\n\t\t\t// Need to truncate right side\n\t\t\tconst availableForRight = width - statsLeftWidth - minPadding;\n\t\t\tif (availableForRight > 0) {\n\t\t\t\tconst truncatedRight = truncateToWidth(rightSide, availableForRight, \"\");\n\t\t\t\tconst truncatedRightWidth = visibleWidth(truncatedRight);\n\t\t\t\tconst padding = \" \".repeat(Math.max(0, width - statsLeftWidth - truncatedRightWidth));\n\t\t\t\tstatsLine = statsLeft + padding + truncatedRight;\n\t\t\t} else {\n\t\t\t\t// Not enough space for right side at all\n\t\t\t\tstatsLine = statsLeft;\n\t\t\t}\n\t\t}\n\n\t\t// Apply dim to each part separately. statsLeft may contain color codes (for context %)\n\t\t// that end with a reset, which would clear an outer dim wrapper. So we dim the parts\n\t\t// before and after the colored section independently.\n\t\tconst dimStatsLeft = theme.fg(\"dim\", statsLeft);\n\t\tconst remainder = statsLine.slice(statsLeft.length); // padding + rightSide\n\t\tconst dimRemainder = theme.fg(\"dim\", remainder);\n\n\t\tconst pwdLine = truncateToWidth(theme.fg(\"dim\", pwd), width, theme.fg(\"dim\", \"...\"));\n\t\tconst lines = [pwdLine, dimStatsLeft + dimRemainder];\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\treturn lines;\n\t}\n}\n"]}
1
+ {"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAiC,MAAM,SAAS,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAejF;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAK3E;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAYhF;AAED;;;GAGG;AACH,qBAAa,eAAgB,YAAW,SAAS;IAChD,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,UAAU,CAA6B;IAE/C,YAAY,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,0BAA0B,EAGxE;IAED,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAEtC;IAED,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE5C;IAED;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IA8B3B;;;OAGG;IACH,UAAU,IAAI,IAAI,CAEjB;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,CAEd;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA6J9B;CACD","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport { type Component, truncateToWidth, visibleWidth } from \"omk-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { PiPackageIntakeSummary } from \"../../../core/pi-package-intake.ts\";\nimport { theme } from \"../theme/theme.ts\";\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/**\n * Format token counts for compact footer display.\n */\nexport function formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\n/**\n * Format byte counts for compact footer display.\n */\nexport function formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes}B`;\n\tif (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)}K`;\n\tif (bytes < 1024 * 1024 * 1024) return `${Math.round(bytes / (1024 * 1024))}M`;\n\treturn `${(bytes / (1024 * 1024 * 1024)).toFixed(1)}G`;\n}\n\nexport function formatPackageIntake(summary: PiPackageIntakeSummary): string {\n\tconst ready =\n\t\tsummary.acceptedNative + summary.acceptedReference + summary.acceptedMeasurement + summary.acceptedAdvisory;\n\tconst review = summary.deferred + summary.reject;\n\treturn `PKG ${ready}/${summary.total} R${review} B${summary.hardForkBlocked}`;\n}\n\nexport function formatCwdForFooter(cwd: string, home: string | undefined): string {\n\tif (!home) return cwd;\n\n\tconst resolvedCwd = resolve(cwd);\n\tconst resolvedHome = resolve(home);\n\tconst relativeToHome = relative(resolvedHome, resolvedCwd);\n\tconst isInsideHome =\n\t\trelativeToHome === \"\" ||\n\t\t(relativeToHome !== \"..\" && !relativeToHome.startsWith(`..${sep}`) && !isAbsolute(relativeToHome));\n\n\tif (!isInsideHome) return cwd;\n\treturn relativeToHome === \"\" ? \"~\" : `~${sep}${relativeToHome}`;\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\tprivate session: AgentSession;\n\tprivate footerData: ReadonlyFooterDataProvider;\n\n\tconstructor(session: AgentSession, footerData: ReadonlyFooterDataProvider) {\n\t\tthis.session = session;\n\t\tthis.footerData = footerData;\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 * Build a compact system-wide CPU/memory metrics segment for the footer.\n\t * Degrades gracefully to shorter forms (or is omitted entirely) when the\n\t * terminal is very narrow so the rest of the footer can still render.\n\t */\n\tprivate buildMetricsSegment(width: number): string | undefined {\n\t\tconst cpu = this.footerData.getSystemCpuPercent();\n\t\tconst memUsed = this.footerData.getSystemMemoryUsedBytes();\n\t\tconst memTotal = this.footerData.getSystemMemoryTotalBytes();\n\t\tif (cpu === null || memUsed === null || memTotal === null || memTotal <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst memPercent = (memUsed / memTotal) * 100;\n\t\tconst color: \"error\" | \"warning\" | \"dim\" =\n\t\t\tcpu >= 90 || memPercent >= 95 ? \"error\" : cpu >= 70 || memPercent >= 85 ? \"warning\" : \"dim\";\n\n\t\tconst cpuStr = `${Math.round(cpu)}%`;\n\t\tconst memStr = `${Math.round(memPercent)}%`;\n\n\t\tif (width >= 56) {\n\t\t\treturn theme.fg(color, `CPU ${cpuStr} MEM ${memStr} (${formatBytes(memUsed)}/${formatBytes(memTotal)})`);\n\t\t}\n\t\tif (width >= 48) {\n\t\t\treturn theme.fg(color, `CPU ${cpuStr} MEM ${memStr}`);\n\t\t}\n\t\tif (width >= 30) {\n\t\t\treturn theme.fg(color, `${cpuStr} ${memStr}`);\n\t\t}\n\t\tif (width >= 18) {\n\t\t\treturn theme.fg(color, cpuStr);\n\t\t}\n\t\treturn undefined;\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// Calculate cumulative usage from ALL session entries (not just post-compaction messages)\n\t\tlet totalInput = 0;\n\t\tlet totalOutput = 0;\n\t\tlet totalCacheRead = 0;\n\t\tlet totalCacheWrite = 0;\n\t\tlet totalCost = 0;\n\n\t\tfor (const entry of this.session.sessionManager.getEntries()) {\n\t\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\t\ttotalInput += entry.message.usage.input;\n\t\t\t\ttotalOutput += entry.message.usage.output;\n\t\t\t\ttotalCacheRead += entry.message.usage.cacheRead;\n\t\t\t\ttotalCacheWrite += entry.message.usage.cacheWrite;\n\t\t\t\ttotalCost += entry.message.usage.cost.total;\n\t\t\t}\n\t\t}\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 = formatCwdForFooter(this.session.sessionManager.getCwd(), process.env.HOME || process.env.USERPROFILE);\n\n\t\t// Add git branch if available\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tif (branch) {\n\t\t\tpwd = `${pwd} (${branch})`;\n\t\t}\n\n\t\t// Add session name if set\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\t\tif (sessionName) {\n\t\t\tpwd = `${pwd} • ${sessionName}`;\n\t\t}\n\n\t\t// Build stats line\n\t\tconst statsParts = [];\n\t\tif (totalInput) statsParts.push(`↑${formatTokens(totalInput)}`);\n\t\tif (totalOutput) statsParts.push(`↓${formatTokens(totalOutput)}`);\n\t\tif (totalCacheRead) statsParts.push(`R${formatTokens(totalCacheRead)}`);\n\t\tif (totalCacheWrite) statsParts.push(`W${formatTokens(totalCacheWrite)}`);\n\n\t\t// Show cost with \"(sub)\" indicator if using OAuth subscription\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\tstatsParts.push(costStr);\n\t\t}\n\n\t\t// Add CPU/memory metrics; degrade gracefully when horizontal space is tight.\n\t\tconst metricsSegment = this.buildMetricsSegment(width);\n\t\tif (metricsSegment) {\n\t\t\tstatsParts.push(metricsSegment);\n\t\t}\n\t\tstatsParts.push(formatPackageIntake(this.footerData.getPackageIntakeSummary()));\n\n\t\t// Colorize context percentage based on usage\n\t\tlet contextPercentStr: string;\n\t\tconst autoIndicator = this.autoCompactEnabled ? \" (auto)\" : \"\";\n\t\tconst contextPercentDisplay =\n\t\t\tcontextPercent === \"?\"\n\t\t\t\t? `?/${formatTokens(contextWindow)}${autoIndicator}`\n\t\t\t\t: `${contextPercent}%/${formatTokens(contextWindow)}${autoIndicator}`;\n\t\tif (contextPercentValue > 90) {\n\t\t\tcontextPercentStr = theme.fg(\"error\", contextPercentDisplay);\n\t\t} else if (contextPercentValue > 70) {\n\t\t\tcontextPercentStr = theme.fg(\"warning\", contextPercentDisplay);\n\t\t} else {\n\t\t\tcontextPercentStr = contextPercentDisplay;\n\t\t}\n\t\tstatsParts.push(contextPercentStr);\n\n\t\tlet statsLeft = statsParts.join(\" \");\n\n\t\t// Add model name on the right side, plus thinking level if model supports it\n\t\tconst modelName = state.model?.id || \"no-model\";\n\n\t\tlet statsLeftWidth = visibleWidth(statsLeft);\n\n\t\t// If statsLeft is too wide, truncate it\n\t\tif (statsLeftWidth > width) {\n\t\t\tstatsLeft = truncateToWidth(statsLeft, width, \"...\");\n\t\t\tstatsLeftWidth = visibleWidth(statsLeft);\n\t\t}\n\n\t\t// Calculate available space for padding (minimum 2 spaces between stats and model)\n\t\tconst minPadding = 2;\n\n\t\t// Add thinking level indicator if model supports reasoning\n\t\tlet rightSideWithoutProvider = modelName;\n\t\tif (state.model?.reasoning) {\n\t\t\tconst thinkingLevel = state.thinkingLevel || \"off\";\n\t\t\trightSideWithoutProvider =\n\t\t\t\tthinkingLevel === \"off\" ? `${modelName} • thinking off` : `${modelName} • ${thinkingLevel}`;\n\t\t}\n\n\t\t// Prepend the provider in parentheses if there are multiple providers and there's enough room\n\t\tlet rightSide = rightSideWithoutProvider;\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\trightSide = `(${state.model!.provider}) ${rightSideWithoutProvider}`;\n\t\t\tif (statsLeftWidth + minPadding + visibleWidth(rightSide) > width) {\n\t\t\t\t// Too wide, fall back\n\t\t\t\trightSide = rightSideWithoutProvider;\n\t\t\t}\n\t\t}\n\n\t\tconst rightSideWidth = visibleWidth(rightSide);\n\t\tconst totalNeeded = statsLeftWidth + minPadding + rightSideWidth;\n\n\t\tlet statsLine: string;\n\t\tif (totalNeeded <= width) {\n\t\t\t// Both fit - add padding to right-align model\n\t\t\tconst padding = \" \".repeat(width - statsLeftWidth - rightSideWidth);\n\t\t\tstatsLine = statsLeft + padding + rightSide;\n\t\t} else {\n\t\t\t// Need to truncate right side\n\t\t\tconst availableForRight = width - statsLeftWidth - minPadding;\n\t\t\tif (availableForRight > 0) {\n\t\t\t\tconst truncatedRight = truncateToWidth(rightSide, availableForRight, \"\");\n\t\t\t\tconst truncatedRightWidth = visibleWidth(truncatedRight);\n\t\t\t\tconst padding = \" \".repeat(Math.max(0, width - statsLeftWidth - truncatedRightWidth));\n\t\t\t\tstatsLine = statsLeft + padding + truncatedRight;\n\t\t\t} else {\n\t\t\t\t// Not enough space for right side at all\n\t\t\t\tstatsLine = statsLeft;\n\t\t\t}\n\t\t}\n\n\t\t// Apply dim to each part separately. statsLeft may contain color codes (for context %)\n\t\t// that end with a reset, which would clear an outer dim wrapper. So we dim the parts\n\t\t// before and after the colored section independently.\n\t\tconst dimStatsLeft = theme.fg(\"dim\", statsLeft);\n\t\tconst remainder = statsLine.slice(statsLeft.length); // padding + rightSide\n\t\tconst dimRemainder = theme.fg(\"dim\", remainder);\n\n\t\tconst pwdLine = truncateToWidth(theme.fg(\"dim\", pwd), width, theme.fg(\"dim\", \"...\"));\n\t\tconst lines = [pwdLine, dimStatsLeft + dimRemainder];\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\treturn lines;\n\t}\n}\n"]}
@@ -15,7 +15,7 @@ function sanitizeStatusText(text) {
15
15
  /**
16
16
  * Format token counts for compact footer display.
17
17
  */
18
- function formatTokens(count) {
18
+ export function formatTokens(count) {
19
19
  if (count < 1000)
20
20
  return count.toString();
21
21
  if (count < 10000)
@@ -29,7 +29,7 @@ function formatTokens(count) {
29
29
  /**
30
30
  * Format byte counts for compact footer display.
31
31
  */
32
- function formatBytes(bytes) {
32
+ export function formatBytes(bytes) {
33
33
  if (bytes < 1024)
34
34
  return `${bytes}B`;
35
35
  if (bytes < 1024 * 1024)
@@ -38,7 +38,7 @@ function formatBytes(bytes) {
38
38
  return `${Math.round(bytes / (1024 * 1024))}M`;
39
39
  return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)}G`;
40
40
  }
41
- function formatPackageIntake(summary) {
41
+ export function formatPackageIntake(summary) {
42
42
  const ready = summary.acceptedNative + summary.acceptedReference + summary.acceptedMeasurement + summary.acceptedAdvisory;
43
43
  const review = summary.deferred + summary.reject;
44
44
  return `PKG ${ready}/${summary.total} R${review} B${summary.hardForkBlocked}`;
@@ -1 +1 @@
1
- {"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAkB,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIxE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;GAGG;AACH,SAAS,kBAAkB,CAAC,IAAY,EAAU;IACjD,qFAAqF;IACrF,OAAO,IAAI;SACT,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC;SACzB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,IAAI,EAAE,CAAC;AAAA,CACT;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,KAAa,EAAU;IAC5C,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1C,IAAI,KAAK,GAAG,KAAK;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC1D,IAAI,KAAK,GAAG,OAAO;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC;IAC3D,IAAI,KAAK,GAAG,QAAQ;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAChE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC;AAAA,CACzC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,KAAa,EAAU;IAC3C,IAAI,KAAK,GAAG,IAAI;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GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;iBAC5D,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;iBACtC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;YAC9C,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5C,iFAAiF;YACjF,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,KAAK,CAAC;IAAA,CACb;CACD","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport { type Component, truncateToWidth, visibleWidth } from \"omk-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { PiPackageIntakeSummary } from \"../../../core/pi-package-intake.ts\";\nimport { theme } from \"../theme/theme.ts\";\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/**\n * Format token counts for compact footer display.\n */\nfunction formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\n/**\n * Format byte counts for compact footer display.\n */\nfunction formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes}B`;\n\tif (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)}K`;\n\tif (bytes < 1024 * 1024 * 1024) return `${Math.round(bytes / (1024 * 1024))}M`;\n\treturn `${(bytes / (1024 * 1024 * 1024)).toFixed(1)}G`;\n}\n\nfunction formatPackageIntake(summary: PiPackageIntakeSummary): string {\n\tconst ready =\n\t\tsummary.acceptedNative + summary.acceptedReference + summary.acceptedMeasurement + summary.acceptedAdvisory;\n\tconst review = summary.deferred + summary.reject;\n\treturn `PKG ${ready}/${summary.total} R${review} B${summary.hardForkBlocked}`;\n}\n\nexport function formatCwdForFooter(cwd: string, home: string | undefined): string {\n\tif (!home) return cwd;\n\n\tconst resolvedCwd = resolve(cwd);\n\tconst resolvedHome = resolve(home);\n\tconst relativeToHome = relative(resolvedHome, resolvedCwd);\n\tconst isInsideHome =\n\t\trelativeToHome === \"\" ||\n\t\t(relativeToHome !== \"..\" && !relativeToHome.startsWith(`..${sep}`) && !isAbsolute(relativeToHome));\n\n\tif (!isInsideHome) return cwd;\n\treturn relativeToHome === \"\" ? \"~\" : `~${sep}${relativeToHome}`;\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\tprivate session: AgentSession;\n\tprivate footerData: ReadonlyFooterDataProvider;\n\n\tconstructor(session: AgentSession, footerData: ReadonlyFooterDataProvider) {\n\t\tthis.session = session;\n\t\tthis.footerData = footerData;\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 * Build a compact system-wide CPU/memory metrics segment for the footer.\n\t * Degrades gracefully to shorter forms (or is omitted entirely) when the\n\t * terminal is very narrow so the rest of the footer can still render.\n\t */\n\tprivate buildMetricsSegment(width: number): string | undefined {\n\t\tconst cpu = this.footerData.getSystemCpuPercent();\n\t\tconst memUsed = this.footerData.getSystemMemoryUsedBytes();\n\t\tconst memTotal = this.footerData.getSystemMemoryTotalBytes();\n\t\tif (cpu === null || memUsed === null || memTotal === null || memTotal <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst memPercent = (memUsed / memTotal) * 100;\n\t\tconst color: \"error\" | \"warning\" | \"dim\" =\n\t\t\tcpu >= 90 || memPercent >= 95 ? \"error\" : cpu >= 70 || memPercent >= 85 ? \"warning\" : \"dim\";\n\n\t\tconst cpuStr = `${Math.round(cpu)}%`;\n\t\tconst memStr = `${Math.round(memPercent)}%`;\n\n\t\tif (width >= 56) {\n\t\t\treturn theme.fg(color, `CPU ${cpuStr} MEM ${memStr} (${formatBytes(memUsed)}/${formatBytes(memTotal)})`);\n\t\t}\n\t\tif (width >= 48) {\n\t\t\treturn theme.fg(color, `CPU ${cpuStr} MEM ${memStr}`);\n\t\t}\n\t\tif (width >= 30) {\n\t\t\treturn theme.fg(color, `${cpuStr} ${memStr}`);\n\t\t}\n\t\tif (width >= 18) {\n\t\t\treturn theme.fg(color, cpuStr);\n\t\t}\n\t\treturn undefined;\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// Calculate cumulative usage from ALL session entries (not just post-compaction messages)\n\t\tlet totalInput = 0;\n\t\tlet totalOutput = 0;\n\t\tlet totalCacheRead = 0;\n\t\tlet totalCacheWrite = 0;\n\t\tlet totalCost = 0;\n\n\t\tfor (const entry of this.session.sessionManager.getEntries()) {\n\t\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\t\ttotalInput += entry.message.usage.input;\n\t\t\t\ttotalOutput += entry.message.usage.output;\n\t\t\t\ttotalCacheRead += entry.message.usage.cacheRead;\n\t\t\t\ttotalCacheWrite += entry.message.usage.cacheWrite;\n\t\t\t\ttotalCost += entry.message.usage.cost.total;\n\t\t\t}\n\t\t}\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 = formatCwdForFooter(this.session.sessionManager.getCwd(), process.env.HOME || process.env.USERPROFILE);\n\n\t\t// Add git branch if available\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tif (branch) {\n\t\t\tpwd = `${pwd} (${branch})`;\n\t\t}\n\n\t\t// Add session name if set\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\t\tif (sessionName) {\n\t\t\tpwd = `${pwd} • ${sessionName}`;\n\t\t}\n\n\t\t// Build stats line\n\t\tconst statsParts = [];\n\t\tif (totalInput) statsParts.push(`↑${formatTokens(totalInput)}`);\n\t\tif (totalOutput) statsParts.push(`↓${formatTokens(totalOutput)}`);\n\t\tif (totalCacheRead) statsParts.push(`R${formatTokens(totalCacheRead)}`);\n\t\tif (totalCacheWrite) statsParts.push(`W${formatTokens(totalCacheWrite)}`);\n\n\t\t// Show cost with \"(sub)\" indicator if using OAuth subscription\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\tstatsParts.push(costStr);\n\t\t}\n\n\t\t// Add CPU/memory metrics; degrade gracefully when horizontal space is tight.\n\t\tconst metricsSegment = this.buildMetricsSegment(width);\n\t\tif (metricsSegment) {\n\t\t\tstatsParts.push(metricsSegment);\n\t\t}\n\t\tstatsParts.push(formatPackageIntake(this.footerData.getPackageIntakeSummary()));\n\n\t\t// Colorize context percentage based on usage\n\t\tlet contextPercentStr: string;\n\t\tconst autoIndicator = this.autoCompactEnabled ? \" (auto)\" : \"\";\n\t\tconst contextPercentDisplay =\n\t\t\tcontextPercent === \"?\"\n\t\t\t\t? `?/${formatTokens(contextWindow)}${autoIndicator}`\n\t\t\t\t: `${contextPercent}%/${formatTokens(contextWindow)}${autoIndicator}`;\n\t\tif (contextPercentValue > 90) {\n\t\t\tcontextPercentStr = theme.fg(\"error\", contextPercentDisplay);\n\t\t} else if (contextPercentValue > 70) {\n\t\t\tcontextPercentStr = theme.fg(\"warning\", contextPercentDisplay);\n\t\t} else {\n\t\t\tcontextPercentStr = contextPercentDisplay;\n\t\t}\n\t\tstatsParts.push(contextPercentStr);\n\n\t\tlet statsLeft = statsParts.join(\" \");\n\n\t\t// Add model name on the right side, plus thinking level if model supports it\n\t\tconst modelName = state.model?.id || \"no-model\";\n\n\t\tlet statsLeftWidth = visibleWidth(statsLeft);\n\n\t\t// If statsLeft is too wide, truncate it\n\t\tif (statsLeftWidth > width) {\n\t\t\tstatsLeft = truncateToWidth(statsLeft, width, \"...\");\n\t\t\tstatsLeftWidth = visibleWidth(statsLeft);\n\t\t}\n\n\t\t// Calculate available space for padding (minimum 2 spaces between stats and model)\n\t\tconst minPadding = 2;\n\n\t\t// Add thinking level indicator if model supports reasoning\n\t\tlet rightSideWithoutProvider = modelName;\n\t\tif (state.model?.reasoning) {\n\t\t\tconst thinkingLevel = state.thinkingLevel || \"off\";\n\t\t\trightSideWithoutProvider =\n\t\t\t\tthinkingLevel === \"off\" ? `${modelName} • thinking off` : `${modelName} • ${thinkingLevel}`;\n\t\t}\n\n\t\t// Prepend the provider in parentheses if there are multiple providers and there's enough room\n\t\tlet rightSide = rightSideWithoutProvider;\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\trightSide = `(${state.model!.provider}) ${rightSideWithoutProvider}`;\n\t\t\tif (statsLeftWidth + minPadding + visibleWidth(rightSide) > width) {\n\t\t\t\t// Too wide, fall back\n\t\t\t\trightSide = rightSideWithoutProvider;\n\t\t\t}\n\t\t}\n\n\t\tconst rightSideWidth = visibleWidth(rightSide);\n\t\tconst totalNeeded = statsLeftWidth + minPadding + rightSideWidth;\n\n\t\tlet statsLine: string;\n\t\tif (totalNeeded <= width) {\n\t\t\t// Both fit - add padding to right-align model\n\t\t\tconst padding = \" \".repeat(width - statsLeftWidth - rightSideWidth);\n\t\t\tstatsLine = statsLeft + padding + rightSide;\n\t\t} else {\n\t\t\t// Need to truncate right side\n\t\t\tconst availableForRight = width - statsLeftWidth - minPadding;\n\t\t\tif (availableForRight > 0) {\n\t\t\t\tconst truncatedRight = truncateToWidth(rightSide, availableForRight, \"\");\n\t\t\t\tconst truncatedRightWidth = visibleWidth(truncatedRight);\n\t\t\t\tconst padding = \" \".repeat(Math.max(0, width - statsLeftWidth - truncatedRightWidth));\n\t\t\t\tstatsLine = statsLeft + padding + truncatedRight;\n\t\t\t} else {\n\t\t\t\t// Not enough space for right side at all\n\t\t\t\tstatsLine = statsLeft;\n\t\t\t}\n\t\t}\n\n\t\t// Apply dim to each part separately. statsLeft may contain color codes (for context %)\n\t\t// that end with a reset, which would clear an outer dim wrapper. So we dim the parts\n\t\t// before and after the colored section independently.\n\t\tconst dimStatsLeft = theme.fg(\"dim\", statsLeft);\n\t\tconst remainder = statsLine.slice(statsLeft.length); // padding + rightSide\n\t\tconst dimRemainder = theme.fg(\"dim\", remainder);\n\n\t\tconst pwdLine = truncateToWidth(theme.fg(\"dim\", pwd), width, theme.fg(\"dim\", \"...\"));\n\t\tconst lines = [pwdLine, dimStatsLeft + dimRemainder];\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\treturn lines;\n\t}\n}\n"]}
1
+ {"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAkB,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIxE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;GAGG;AACH,SAAS,kBAAkB,CAAC,IAAY,EAAU;IACjD,qFAAqF;IACrF,OAAO,IAAI;SACT,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC;SACzB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,IAAI,EAAE,CAAC;AAAA,CACT;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAU;IACnD,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1C,IAAI,KAAK,GAAG,KAAK;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC1D,IAAI,KAAK,GAAG,OAAO;QAAE,OAAO,GAAG,IA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,CAAC;QAEhD,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACrF,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAAC,CAAC;QAErD,wEAAwE;QACxE,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC;QACjE,IAAI,iBAAiB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;iBAC5D,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;iBACtC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;YAC9C,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5C,iFAAiF;YACjF,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,KAAK,CAAC;IAAA,CACb;CACD","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport { type Component, truncateToWidth, visibleWidth } from \"omk-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { PiPackageIntakeSummary } from \"../../../core/pi-package-intake.ts\";\nimport { theme } from \"../theme/theme.ts\";\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/**\n * Format token counts for compact footer display.\n */\nexport function formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\n/**\n * Format byte counts for compact footer display.\n */\nexport function formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes}B`;\n\tif (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)}K`;\n\tif (bytes < 1024 * 1024 * 1024) return `${Math.round(bytes / (1024 * 1024))}M`;\n\treturn `${(bytes / (1024 * 1024 * 1024)).toFixed(1)}G`;\n}\n\nexport function formatPackageIntake(summary: PiPackageIntakeSummary): string {\n\tconst ready =\n\t\tsummary.acceptedNative + summary.acceptedReference + summary.acceptedMeasurement + summary.acceptedAdvisory;\n\tconst review = summary.deferred + summary.reject;\n\treturn `PKG ${ready}/${summary.total} R${review} B${summary.hardForkBlocked}`;\n}\n\nexport function formatCwdForFooter(cwd: string, home: string | undefined): string {\n\tif (!home) return cwd;\n\n\tconst resolvedCwd = resolve(cwd);\n\tconst resolvedHome = resolve(home);\n\tconst relativeToHome = relative(resolvedHome, resolvedCwd);\n\tconst isInsideHome =\n\t\trelativeToHome === \"\" ||\n\t\t(relativeToHome !== \"..\" && !relativeToHome.startsWith(`..${sep}`) && !isAbsolute(relativeToHome));\n\n\tif (!isInsideHome) return cwd;\n\treturn relativeToHome === \"\" ? \"~\" : `~${sep}${relativeToHome}`;\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\tprivate session: AgentSession;\n\tprivate footerData: ReadonlyFooterDataProvider;\n\n\tconstructor(session: AgentSession, footerData: ReadonlyFooterDataProvider) {\n\t\tthis.session = session;\n\t\tthis.footerData = footerData;\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 * Build a compact system-wide CPU/memory metrics segment for the footer.\n\t * Degrades gracefully to shorter forms (or is omitted entirely) when the\n\t * terminal is very narrow so the rest of the footer can still render.\n\t */\n\tprivate buildMetricsSegment(width: number): string | undefined {\n\t\tconst cpu = this.footerData.getSystemCpuPercent();\n\t\tconst memUsed = this.footerData.getSystemMemoryUsedBytes();\n\t\tconst memTotal = this.footerData.getSystemMemoryTotalBytes();\n\t\tif (cpu === null || memUsed === null || memTotal === null || memTotal <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst memPercent = (memUsed / memTotal) * 100;\n\t\tconst color: \"error\" | \"warning\" | \"dim\" =\n\t\t\tcpu >= 90 || memPercent >= 95 ? \"error\" : cpu >= 70 || memPercent >= 85 ? \"warning\" : \"dim\";\n\n\t\tconst cpuStr = `${Math.round(cpu)}%`;\n\t\tconst memStr = `${Math.round(memPercent)}%`;\n\n\t\tif (width >= 56) {\n\t\t\treturn theme.fg(color, `CPU ${cpuStr} MEM ${memStr} (${formatBytes(memUsed)}/${formatBytes(memTotal)})`);\n\t\t}\n\t\tif (width >= 48) {\n\t\t\treturn theme.fg(color, `CPU ${cpuStr} MEM ${memStr}`);\n\t\t}\n\t\tif (width >= 30) {\n\t\t\treturn theme.fg(color, `${cpuStr} ${memStr}`);\n\t\t}\n\t\tif (width >= 18) {\n\t\t\treturn theme.fg(color, cpuStr);\n\t\t}\n\t\treturn undefined;\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// Calculate cumulative usage from ALL session entries (not just post-compaction messages)\n\t\tlet totalInput = 0;\n\t\tlet totalOutput = 0;\n\t\tlet totalCacheRead = 0;\n\t\tlet totalCacheWrite = 0;\n\t\tlet totalCost = 0;\n\n\t\tfor (const entry of this.session.sessionManager.getEntries()) {\n\t\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\t\ttotalInput += entry.message.usage.input;\n\t\t\t\ttotalOutput += entry.message.usage.output;\n\t\t\t\ttotalCacheRead += entry.message.usage.cacheRead;\n\t\t\t\ttotalCacheWrite += entry.message.usage.cacheWrite;\n\t\t\t\ttotalCost += entry.message.usage.cost.total;\n\t\t\t}\n\t\t}\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 = formatCwdForFooter(this.session.sessionManager.getCwd(), process.env.HOME || process.env.USERPROFILE);\n\n\t\t// Add git branch if available\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tif (branch) {\n\t\t\tpwd = `${pwd} (${branch})`;\n\t\t}\n\n\t\t// Add session name if set\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\t\tif (sessionName) {\n\t\t\tpwd = `${pwd} • ${sessionName}`;\n\t\t}\n\n\t\t// Build stats line\n\t\tconst statsParts = [];\n\t\tif (totalInput) statsParts.push(`↑${formatTokens(totalInput)}`);\n\t\tif (totalOutput) statsParts.push(`↓${formatTokens(totalOutput)}`);\n\t\tif (totalCacheRead) statsParts.push(`R${formatTokens(totalCacheRead)}`);\n\t\tif (totalCacheWrite) statsParts.push(`W${formatTokens(totalCacheWrite)}`);\n\n\t\t// Show cost with \"(sub)\" indicator if using OAuth subscription\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\tstatsParts.push(costStr);\n\t\t}\n\n\t\t// Add CPU/memory metrics; degrade gracefully when horizontal space is tight.\n\t\tconst metricsSegment = this.buildMetricsSegment(width);\n\t\tif (metricsSegment) {\n\t\t\tstatsParts.push(metricsSegment);\n\t\t}\n\t\tstatsParts.push(formatPackageIntake(this.footerData.getPackageIntakeSummary()));\n\n\t\t// Colorize context percentage based on usage\n\t\tlet contextPercentStr: string;\n\t\tconst autoIndicator = this.autoCompactEnabled ? \" (auto)\" : \"\";\n\t\tconst contextPercentDisplay =\n\t\t\tcontextPercent === \"?\"\n\t\t\t\t? `?/${formatTokens(contextWindow)}${autoIndicator}`\n\t\t\t\t: `${contextPercent}%/${formatTokens(contextWindow)}${autoIndicator}`;\n\t\tif (contextPercentValue > 90) {\n\t\t\tcontextPercentStr = theme.fg(\"error\", contextPercentDisplay);\n\t\t} else if (contextPercentValue > 70) {\n\t\t\tcontextPercentStr = theme.fg(\"warning\", contextPercentDisplay);\n\t\t} else {\n\t\t\tcontextPercentStr = contextPercentDisplay;\n\t\t}\n\t\tstatsParts.push(contextPercentStr);\n\n\t\tlet statsLeft = statsParts.join(\" \");\n\n\t\t// Add model name on the right side, plus thinking level if model supports it\n\t\tconst modelName = state.model?.id || \"no-model\";\n\n\t\tlet statsLeftWidth = visibleWidth(statsLeft);\n\n\t\t// If statsLeft is too wide, truncate it\n\t\tif (statsLeftWidth > width) {\n\t\t\tstatsLeft = truncateToWidth(statsLeft, width, \"...\");\n\t\t\tstatsLeftWidth = visibleWidth(statsLeft);\n\t\t}\n\n\t\t// Calculate available space for padding (minimum 2 spaces between stats and model)\n\t\tconst minPadding = 2;\n\n\t\t// Add thinking level indicator if model supports reasoning\n\t\tlet rightSideWithoutProvider = modelName;\n\t\tif (state.model?.reasoning) {\n\t\t\tconst thinkingLevel = state.thinkingLevel || \"off\";\n\t\t\trightSideWithoutProvider =\n\t\t\t\tthinkingLevel === \"off\" ? `${modelName} • thinking off` : `${modelName} • ${thinkingLevel}`;\n\t\t}\n\n\t\t// Prepend the provider in parentheses if there are multiple providers and there's enough room\n\t\tlet rightSide = rightSideWithoutProvider;\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\trightSide = `(${state.model!.provider}) ${rightSideWithoutProvider}`;\n\t\t\tif (statsLeftWidth + minPadding + visibleWidth(rightSide) > width) {\n\t\t\t\t// Too wide, fall back\n\t\t\t\trightSide = rightSideWithoutProvider;\n\t\t\t}\n\t\t}\n\n\t\tconst rightSideWidth = visibleWidth(rightSide);\n\t\tconst totalNeeded = statsLeftWidth + minPadding + rightSideWidth;\n\n\t\tlet statsLine: string;\n\t\tif (totalNeeded <= width) {\n\t\t\t// Both fit - add padding to right-align model\n\t\t\tconst padding = \" \".repeat(width - statsLeftWidth - rightSideWidth);\n\t\t\tstatsLine = statsLeft + padding + rightSide;\n\t\t} else {\n\t\t\t// Need to truncate right side\n\t\t\tconst availableForRight = width - statsLeftWidth - minPadding;\n\t\t\tif (availableForRight > 0) {\n\t\t\t\tconst truncatedRight = truncateToWidth(rightSide, availableForRight, \"\");\n\t\t\t\tconst truncatedRightWidth = visibleWidth(truncatedRight);\n\t\t\t\tconst padding = \" \".repeat(Math.max(0, width - statsLeftWidth - truncatedRightWidth));\n\t\t\t\tstatsLine = statsLeft + padding + truncatedRight;\n\t\t\t} else {\n\t\t\t\t// Not enough space for right side at all\n\t\t\t\tstatsLine = statsLeft;\n\t\t\t}\n\t\t}\n\n\t\t// Apply dim to each part separately. statsLeft may contain color codes (for context %)\n\t\t// that end with a reset, which would clear an outer dim wrapper. So we dim the parts\n\t\t// before and after the colored section independently.\n\t\tconst dimStatsLeft = theme.fg(\"dim\", statsLeft);\n\t\tconst remainder = statsLine.slice(statsLeft.length); // padding + rightSide\n\t\tconst dimRemainder = theme.fg(\"dim\", remainder);\n\n\t\tconst pwdLine = truncateToWidth(theme.fg(\"dim\", pwd), width, theme.fg(\"dim\", \"...\"));\n\t\tconst lines = [pwdLine, dimStatsLeft + dimRemainder];\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\treturn lines;\n\t}\n}\n"]}
@@ -0,0 +1,49 @@
1
+ import type { Component } from "omk-tui";
2
+ import type { AgentSession } from "../../../core/agent-session.ts";
3
+ import type { ReadonlyFooterDataProvider } from "../../../core/footer-data-provider.ts";
4
+ export declare const STATUS_SIDEBAR_WIDTH = 34;
5
+ export declare const STATUS_SIDEBAR_MAX_WIDTH = 48;
6
+ export declare const STATUS_SIDEBAR_MIN_WIDTH = 96;
7
+ /** Blank columns between the main content and the pinned rail (part of the reserved gutter). */
8
+ export declare const STATUS_SIDEBAR_GUTTER_GAP = 1;
9
+ /**
10
+ * Responsive rail width: ~26% of the terminal, clamped to [34, 48] so the rail
11
+ * grows on fullscreen terminals while the content column stays dominant.
12
+ * The pinned overlay and the reserved gutter must both use this function.
13
+ */
14
+ export declare function statusSidebarWidth(termWidth: number): number;
15
+ /**
16
+ * Responsive MCP roster rows: taller terminals list more servers before the
17
+ * "+N more" collapse. ~24 rows of the rail are fixed chrome (header, model,
18
+ * context, tokens, system), the rest is available to the roster.
19
+ */
20
+ export declare function mcpMaxRows(termRows: number): number;
21
+ /**
22
+ * Fixed right-rail sidebar that shows the bottom-bar (footer) status vertically,
23
+ * styled after opencode's pinned side rails plus a live MCP server roster.
24
+ *
25
+ * Pinned via the `pinStatusSidebar` setting (or OMK_PIN_STATUS_SIDEBAR=1) and
26
+ * toggled with app.sidebar.toggle (Ctrl+Q). While pinned, the bottom footer is
27
+ * removed so the same data is not rendered twice.
28
+ */
29
+ export declare class StatusSidebarComponent implements Component {
30
+ private getSession;
31
+ private footerData;
32
+ private getAutoCompactEnabled;
33
+ private getTerminalRows;
34
+ private cpuHistory;
35
+ private lastSparkSampleAt;
36
+ private mcpCache;
37
+ constructor(getSession: () => AgentSession, footerData: ReadonlyFooterDataProvider, getAutoCompactEnabled: () => boolean, getTerminalRows?: () => number);
38
+ invalidate(): void;
39
+ render(width: number): string[];
40
+ /**
41
+ * MCP server roster with a stable/total counter in the section rule and a
42
+ * stability dot per server. Reads are cached so the rail stays cheap to render.
43
+ */
44
+ private mcpSection;
45
+ private loadMcpEntries;
46
+ /** Rolling CPU sparkline — a living pulse along the top of the rail. */
47
+ private sparkline;
48
+ }
49
+ //# sourceMappingURL=status-sidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/status-sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAQxF,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,gGAAgG;AAChG,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnD;AAaD;;;;;;;GAOG;AACH,qBAAa,sBAAuB,YAAW,SAAS;IACvD,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,UAAU,CAA6B;IAC/C,OAAO,CAAC,qBAAqB,CAAgB;IAC7C,OAAO,CAAC,eAAe,CAAe;IAGtC,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAqE;IAErF,YACC,UAAU,EAAE,MAAM,YAAY,EAC9B,UAAU,EAAE,0BAA0B,EACtC,qBAAqB,EAAE,MAAM,OAAO,EACpC,eAAe,GAAE,MAAM,MAAiB,EAMxC;IAED,UAAU,IAAI,IAAI,CAGjB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAkH9B;IAED;;;OAGG;IACH,OAAO,CAAC,UAAU;IAuBlB,OAAO,CAAC,cAAc;IAetB,0EAAwE;IACxE,OAAO,CAAC,SAAS;CAwBjB","sourcesContent":["import type { Component } from \"omk-tui\";\nimport { truncateToWidth, visibleWidth } from \"omk-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport { loadMcpInventory, type McpServerEntry } from \"../../../core/mcp-inventory.ts\";\nimport { type ThemeColor, theme } from \"../theme/theme.ts\";\nimport { boxBottom, boxTextLine, boxTop, sidebarRule } from \"./control-panel-box.ts\";\nimport { classifyMcpStability } from \"./control-panel-runtime-status.ts\";\nimport { formatBytes, formatCwdForFooter, formatPackageIntake, formatTokens } from \"./footer.ts\";\nimport { keyText } from \"./keybinding-hints.ts\";\n\nexport const STATUS_SIDEBAR_WIDTH = 34;\nexport const STATUS_SIDEBAR_MAX_WIDTH = 48;\nexport const STATUS_SIDEBAR_MIN_WIDTH = 96;\n/** Blank columns between the main content and the pinned rail (part of the reserved gutter). */\nexport const STATUS_SIDEBAR_GUTTER_GAP = 1;\n\n/**\n * Responsive rail width: ~26% of the terminal, clamped to [34, 48] so the rail\n * grows on fullscreen terminals while the content column stays dominant.\n * The pinned overlay and the reserved gutter must both use this function.\n */\nexport function statusSidebarWidth(termWidth: number): number {\n\treturn Math.max(STATUS_SIDEBAR_WIDTH, Math.min(STATUS_SIDEBAR_MAX_WIDTH, Math.floor(termWidth * 0.26)));\n}\n\n/**\n * Responsive MCP roster rows: taller terminals list more servers before the\n * \"+N more\" collapse. ~24 rows of the rail are fixed chrome (header, model,\n * context, tokens, system), the rest is available to the roster.\n */\nexport function mcpMaxRows(termRows: number): number {\n\treturn Math.max(4, Math.min(18, termRows - 24));\n}\n\nconst METER_CELLS = 12;\nconst METER_MAX_CELLS = 24;\n/** Rolling window of CPU samples feeding the activity sparkline (wide rails show more history). */\nconst SPARK_WINDOW = 44;\n/** Minimum interval between sparkline samples so the rail animates, not jitters. */\nconst SPARK_SAMPLE_MS = 1000;\n/** MCP inventory is read from disk; cache it so per-frame renders stay cheap. */\nconst MCP_CACHE_TTL_MS = 5000;\n\nconst SPARK_CHARS = [\"▁\", \"▂\", \"▃\", \"▄\", \"▅\", \"▆\", \"▇\", \"█\"] as const;\n\n/**\n * Fixed right-rail sidebar that shows the bottom-bar (footer) status vertically,\n * styled after opencode's pinned side rails plus a live MCP server roster.\n *\n * Pinned via the `pinStatusSidebar` setting (or OMK_PIN_STATUS_SIDEBAR=1) and\n * toggled with app.sidebar.toggle (Ctrl+Q). While pinned, the bottom footer is\n * removed so the same data is not rendered twice.\n */\nexport class StatusSidebarComponent implements Component {\n\tprivate getSession: () => AgentSession;\n\tprivate footerData: ReadonlyFooterDataProvider;\n\tprivate getAutoCompactEnabled: () => boolean;\n\tprivate getTerminalRows: () => number;\n\n\t// --- living elements: rolling CPU sparkline + cached MCP roster ---\n\tprivate cpuHistory: number[] = [];\n\tprivate lastSparkSampleAt = 0;\n\tprivate mcpCache: { at: number; cwd: string; entries: McpServerEntry[] } | undefined;\n\n\tconstructor(\n\t\tgetSession: () => AgentSession,\n\t\tfooterData: ReadonlyFooterDataProvider,\n\t\tgetAutoCompactEnabled: () => boolean,\n\t\tgetTerminalRows: () => number = () => 32,\n\t) {\n\t\tthis.getSession = getSession;\n\t\tthis.footerData = footerData;\n\t\tthis.getAutoCompactEnabled = getAutoCompactEnabled;\n\t\tthis.getTerminalRows = getTerminalRows;\n\t}\n\n\tinvalidate(): void {\n\t\t// Mostly stateless: status recomputes from the live session each render.\n\t\t// Only the sparkline history and MCP cache persist across frames.\n\t}\n\n\trender(width: number): string[] {\n\t\tconst session = this.getSession();\n\t\tconst state = session.state;\n\t\tconst lines: string[] = [boxTop(width, \"STATUS RAIL\")];\n\n\t\t// --- Live header: session uptime + CPU activity sparkline ---\n\t\tlines.push(\n\t\t\tboxTextLine(width, `${theme.fg(\"muted\", \"up \")}${theme.fg(\"accent\", formatUptime(process.uptime()))}`),\n\t\t);\n\t\tlines.push(boxTextLine(width, this.sparkline(width)));\n\n\t\t// --- Location ---\n\t\tconst cwd = formatCwdForFooter(session.sessionManager.getCwd(), process.env.HOME || process.env.USERPROFILE);\n\t\tlines.push(boxTextLine(width, `${theme.fg(\"muted\", \"cwd \")}${theme.fg(\"text\", cwd)}`));\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tif (branch) {\n\t\t\tlines.push(boxTextLine(width, `${theme.fg(\"muted\", \"git \")}${theme.fg(\"accent\", branch)}`));\n\t\t}\n\t\tconst sessionName = session.sessionManager.getSessionName();\n\t\tif (sessionName) {\n\t\t\tlines.push(boxTextLine(width, `${theme.fg(\"muted\", \"sess \")}${theme.fg(\"text\", sessionName)}`));\n\t\t}\n\n\t\t// --- Model ---\n\t\tlines.push(sidebarRule(width, \"MODEL\"));\n\t\tlines.push(\n\t\t\tboxTextLine(width, `${theme.fg(\"muted\", \"id \")}${theme.fg(\"accent\", state.model?.id ?? \"no-model\")}`),\n\t\t);\n\t\tif (state.model?.reasoning) {\n\t\t\tlines.push(\n\t\t\t\tboxTextLine(width, `${theme.fg(\"muted\", \"think \")}${theme.fg(\"mdCode\", state.thinkingLevel || \"off\")}`),\n\t\t\t);\n\t\t}\n\n\t\t// --- Context ---\n\t\tlines.push(sidebarRule(width, \"CONTEXT\"));\n\t\tconst contextUsage = session.getContextUsage();\n\t\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\t\tconst percent = contextUsage?.percent ?? null;\n\t\tconst auto = this.getAutoCompactEnabled() ? \" (auto)\" : \"\";\n\t\tconst percentLabel =\n\t\t\tpercent === null\n\t\t\t\t? `?/${formatTokens(contextWindow)}${auto}`\n\t\t\t\t: `${percent.toFixed(1)}%/${formatTokens(contextWindow)}${auto}`;\n\t\tconst percentColor: ThemeColor =\n\t\t\tpercent !== null && percent > 90 ? \"error\" : percent !== null && percent > 70 ? \"warning\" : \"success\";\n\t\tlines.push(boxTextLine(width, `${theme.fg(\"muted\", \"ctx \")}${theme.fg(percentColor, percentLabel)}`));\n\t\tlines.push(boxTextLine(width, meter(percent, width)));\n\n\t\t// --- Tokens (cumulative across all session entries, mirrors the footer) ---\n\t\tlet totalInput = 0;\n\t\tlet totalOutput = 0;\n\t\tlet totalCacheRead = 0;\n\t\tlet totalCacheWrite = 0;\n\t\tlet totalCost = 0;\n\t\tfor (const entry of session.sessionManager.getEntries()) {\n\t\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\t\ttotalInput += entry.message.usage.input;\n\t\t\t\ttotalOutput += entry.message.usage.output;\n\t\t\t\ttotalCacheRead += entry.message.usage.cacheRead;\n\t\t\t\ttotalCacheWrite += entry.message.usage.cacheWrite;\n\t\t\t\ttotalCost += entry.message.usage.cost.total;\n\t\t\t}\n\t\t}\n\t\tlines.push(sidebarRule(width, \"TOKENS\"));\n\t\tlines.push(\n\t\t\tboxTextLine(\n\t\t\t\twidth,\n\t\t\t\t`${theme.fg(\"success\", `↑${formatTokens(totalInput)}`)} ${theme.fg(\"accent\", `↓${formatTokens(totalOutput)}`)}`,\n\t\t\t),\n\t\t);\n\t\tlines.push(\n\t\t\tboxTextLine(\n\t\t\t\twidth,\n\t\t\t\t`${theme.fg(\"muted\", `R${formatTokens(totalCacheRead)}`)} ${theme.fg(\"muted\", `W${formatTokens(totalCacheWrite)}`)}`,\n\t\t\t),\n\t\t);\n\t\tconst usingSubscription = state.model ? session.modelRegistry.isUsingOAuth(state.model) : false;\n\t\tif (totalCost || usingSubscription) {\n\t\t\tlines.push(\n\t\t\t\tboxTextLine(\n\t\t\t\t\twidth,\n\t\t\t\t\t`${theme.fg(\"muted\", \"cost \")}${theme.fg(\"warning\", `$${totalCost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`)}`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\t// --- MCP roster (opencode-style server list with stability dots) ---\n\t\tlines.push(...this.mcpSection(width, session.sessionManager.getCwd()));\n\n\t\t// --- System ---\n\t\tlines.push(sidebarRule(width, \"SYSTEM\"));\n\t\tconst cpu = this.footerData.getCpuPercent();\n\t\tconst mem = this.footerData.getMemoryRssBytes();\n\t\tconst sysParts: string[] = [];\n\t\tif (cpu !== null) sysParts.push(`cpu ${cpu.toFixed(0)}%`);\n\t\tif (mem !== null) sysParts.push(`mem ${formatBytes(mem)}`);\n\t\tif (sysParts.length > 0) {\n\t\t\tlines.push(boxTextLine(width, theme.fg(\"muted\", sysParts.join(\" \"))));\n\t\t}\n\t\tlines.push(boxTextLine(width, theme.fg(\"dim\", formatPackageIntake(this.footerData.getPackageIntakeSummary()))));\n\n\t\t// --- Extension statuses ---\n\t\tconst statuses = this.footerData.getExtensionStatuses();\n\t\tif (statuses.size > 0) {\n\t\t\tlines.push(sidebarRule(width, \"EXT\"));\n\t\t\tfor (const [key, value] of statuses) {\n\t\t\t\tlines.push(boxTextLine(width, `${theme.fg(\"mdCode\", key)} ${theme.fg(\"muted\", value)}`));\n\t\t\t}\n\t\t}\n\n\t\tlines.push(boxTextLine(width, theme.fg(\"dim\", `${keyText(\"app.sidebar.toggle\")} unpin`)));\n\t\tlines.push(boxBottom(width));\n\t\treturn lines;\n\t}\n\n\t/**\n\t * MCP server roster with a stable/total counter in the section rule and a\n\t * stability dot per server. Reads are cached so the rail stays cheap to render.\n\t */\n\tprivate mcpSection(width: number, cwd: string): string[] {\n\t\tconst entries = this.loadMcpEntries(cwd);\n\t\tconst stable = entries.filter((entry) => classifyMcpStability(entry) === \"stable\").length;\n\t\tconst countColor: ThemeColor = entries.length === 0 ? \"dim\" : stable === entries.length ? \"success\" : \"warning\";\n\t\tconst count = entries.length === 0 ? \"0\" : `${stable}/${entries.length}`;\n\n\t\tconst lines: string[] = [railRule(width, \"MCP\", theme.fg(countColor, count))];\n\t\tif (entries.length === 0) {\n\t\t\tlines.push(boxTextLine(width, theme.fg(\"dim\", \"none configured\")));\n\t\t\treturn lines;\n\t\t}\n\n\t\tconst shown = entries.slice(0, mcpMaxRows(this.getTerminalRows()));\n\t\tfor (const entry of shown) {\n\t\t\tlines.push(boxTextLine(width, mcpRow(entry, width)));\n\t\t}\n\t\tconst hidden = entries.length - shown.length;\n\t\tif (hidden > 0) {\n\t\t\tlines.push(boxTextLine(width, theme.fg(\"dim\", `+${hidden} more…`)));\n\t\t}\n\t\treturn lines;\n\t}\n\n\tprivate loadMcpEntries(cwd: string): McpServerEntry[] {\n\t\tconst now = Date.now();\n\t\tif (this.mcpCache && this.mcpCache.cwd === cwd && now - this.mcpCache.at < MCP_CACHE_TTL_MS) {\n\t\t\treturn this.mcpCache.entries;\n\t\t}\n\t\tlet entries: McpServerEntry[] = [];\n\t\ttry {\n\t\t\tentries = loadMcpInventory(cwd).entries;\n\t\t} catch {\n\t\t\tentries = [];\n\t\t}\n\t\tthis.mcpCache = { at: now, cwd, entries };\n\t\treturn entries;\n\t}\n\n\t/** Rolling CPU sparkline — a living pulse along the top of the rail. */\n\tprivate sparkline(width: number): string {\n\t\tconst now = Date.now();\n\t\tconst cpu = this.footerData.getCpuPercent();\n\t\tif (cpu !== null && now - this.lastSparkSampleAt >= SPARK_SAMPLE_MS) {\n\t\t\tthis.lastSparkSampleAt = now;\n\t\t\tthis.cpuHistory.push(Math.max(0, Math.min(100, cpu)));\n\t\t\tif (this.cpuHistory.length > SPARK_WINDOW) {\n\t\t\t\tthis.cpuHistory.shift();\n\t\t\t}\n\t\t}\n\n\t\tconst inner = Math.max(0, width - 4);\n\t\tconst label = theme.fg(\"muted\", \"act \");\n\t\tconst cells = Math.max(0, inner - visibleWidth(label));\n\t\tif (cells === 0 || this.cpuHistory.length === 0) {\n\t\t\treturn `${label}${theme.fg(\"borderMuted\", \"▁\".repeat(Math.max(0, cells)))}`;\n\t\t}\n\n\t\t// Right-align the window so the sparkline grows in from the left edge.\n\t\tconst window = this.cpuHistory.slice(-cells);\n\t\tconst bars = window.map((sample) => SPARK_CHARS[Math.min(7, Math.floor(sample / 12.6))]).join(\"\");\n\t\tconst pad = \"▁\".repeat(Math.max(0, cells - window.length));\n\t\treturn `${label}${theme.fg(\"borderMuted\", pad)}${theme.fg(\"accent\", bars)}`;\n\t}\n}\n\n/** Section rule with a right-aligned counter, e.g. `│─ MCP ─────── 22/24 │`. */\nfunction railRule(width: number, label: string, right: string): string {\n\tconst left = `${theme.fg(\"borderMuted\", \"─\")}${theme.fg(\"accent\", ` ${label} `)}`;\n\tconst rightText = ` ${right} `;\n\tconst fill = Math.max(0, width - 2 - visibleWidth(left) - visibleWidth(rightText));\n\tconst line = `${theme.fg(\"borderMuted\", \"│\")}${left}${theme.fg(\"borderMuted\", \"─\".repeat(fill))}${rightText}${theme.fg(\"borderMuted\", \"│\")}`;\n\treturn visibleWidth(line) <= width ? line : truncateToWidth(line, width, \"\");\n}\n\n/** One MCP server row: stability dot + name, truncated to the rail width. */\nfunction mcpRow(entry: McpServerEntry, width: number): string {\n\tconst stability = classifyMcpStability(entry);\n\tconst dot =\n\t\tstability === \"stable\"\n\t\t\t? theme.fg(\"success\", \"●\")\n\t\t\t: stability === \"overridden\"\n\t\t\t\t? theme.fg(\"dim\", \"◐\")\n\t\t\t\t: theme.fg(\"warning\", \"○\");\n\tconst nameColor: ThemeColor = stability === \"stable\" ? \"text\" : stability === \"overridden\" ? \"dim\" : \"warning\";\n\tconst nameWidth = Math.max(1, width - 4 - 2); // frame (4) + dot + space (2)\n\tconst name = truncateToWidth(entry.name, nameWidth, \"…\");\n\treturn `${dot} ${theme.fg(nameColor, name)}`;\n}\n\nfunction formatUptime(seconds: number): string {\n\tconst total = Math.max(0, Math.floor(seconds));\n\tconst h = Math.floor(total / 3600);\n\tconst m = Math.floor((total % 3600) / 60);\n\tconst s = total % 60;\n\tconst pad = (n: number) => n.toString().padStart(2, \"0\");\n\treturn h > 0 ? `${h}:${pad(m)}:${pad(s)}` : `${pad(m)}:${pad(s)}`;\n}\n\nfunction meter(percent: number | null, width: number): string {\n\t// Fill the rail: frame (4) + space + up to \"100%\" (4) stay reserved.\n\tconst cells = Math.max(METER_CELLS, Math.min(METER_MAX_CELLS, width - 9));\n\tif (percent === null) {\n\t\treturn `${theme.fg(\"borderMuted\", \"░\".repeat(cells))} ${theme.fg(\"muted\", \"??%\")}`;\n\t}\n\tconst clamped = Math.max(0, Math.min(100, percent));\n\tconst filled = Math.round((clamped / 100) * cells);\n\tconst color: ThemeColor = clamped >= 85 ? \"warning\" : clamped >= 65 ? \"mdCode\" : \"success\";\n\treturn `${theme.fg(color, \"█\".repeat(filled))}${theme.fg(\"borderMuted\", \"░\".repeat(cells - filled))} ${theme.fg(color, `${Math.round(clamped)}%`)}`;\n}\n"]}