@carboncode/cli 0.1.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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSES/DeepSeek-Reasonix-MIT.txt +21 -0
  3. package/README.md +109 -0
  4. package/README.zh-CN.md +91 -0
  5. package/THIRD_PARTY_NOTICES.md +14 -0
  6. package/dashboard/app.css +3233 -0
  7. package/dashboard/dist/app.js +30444 -0
  8. package/dashboard/dist/app.js.map +1 -0
  9. package/dashboard/dist/vendor-hljs.css +10 -0
  10. package/dashboard/dist/vendor-uplot.css +1 -0
  11. package/dashboard/index.html +19 -0
  12. package/data/deepseek-tokenizer.json.gz +0 -0
  13. package/dist/cli/acp-35C4ME6Y.js +711 -0
  14. package/dist/cli/acp-35C4ME6Y.js.map +1 -0
  15. package/dist/cli/chat-A6UJDPGV.js +51 -0
  16. package/dist/cli/chat-A6UJDPGV.js.map +1 -0
  17. package/dist/cli/chunk-2425HK6U.js +54 -0
  18. package/dist/cli/chunk-2425HK6U.js.map +1 -0
  19. package/dist/cli/chunk-25T6CVUP.js +172 -0
  20. package/dist/cli/chunk-25T6CVUP.js.map +1 -0
  21. package/dist/cli/chunk-2UQP6H6T.js +31 -0
  22. package/dist/cli/chunk-2UQP6H6T.js.map +1 -0
  23. package/dist/cli/chunk-3OAR6NVL.js +96 -0
  24. package/dist/cli/chunk-3OAR6NVL.js.map +1 -0
  25. package/dist/cli/chunk-3T6VBZCL.js +54 -0
  26. package/dist/cli/chunk-3T6VBZCL.js.map +1 -0
  27. package/dist/cli/chunk-4IBIPQVB.js +153 -0
  28. package/dist/cli/chunk-4IBIPQVB.js.map +1 -0
  29. package/dist/cli/chunk-4MQ3VURH.js +3106 -0
  30. package/dist/cli/chunk-4MQ3VURH.js.map +1 -0
  31. package/dist/cli/chunk-4TVNJWMA.js +11619 -0
  32. package/dist/cli/chunk-4TVNJWMA.js.map +1 -0
  33. package/dist/cli/chunk-4VR6XF4P.js +341 -0
  34. package/dist/cli/chunk-4VR6XF4P.js.map +1 -0
  35. package/dist/cli/chunk-5QCB62C4.js +25319 -0
  36. package/dist/cli/chunk-5QCB62C4.js.map +1 -0
  37. package/dist/cli/chunk-6OWJV3YW.js +390 -0
  38. package/dist/cli/chunk-6OWJV3YW.js.map +1 -0
  39. package/dist/cli/chunk-7EO27TB3.js +130 -0
  40. package/dist/cli/chunk-7EO27TB3.js.map +1 -0
  41. package/dist/cli/chunk-7L2WTRNU.js +308 -0
  42. package/dist/cli/chunk-7L2WTRNU.js.map +1 -0
  43. package/dist/cli/chunk-BHTZFEYE.js +47 -0
  44. package/dist/cli/chunk-BHTZFEYE.js.map +1 -0
  45. package/dist/cli/chunk-BSGCXZQN.js +343 -0
  46. package/dist/cli/chunk-BSGCXZQN.js.map +1 -0
  47. package/dist/cli/chunk-BSINVTTL.js +464 -0
  48. package/dist/cli/chunk-BSINVTTL.js.map +1 -0
  49. package/dist/cli/chunk-CPKCNHRR.js +323 -0
  50. package/dist/cli/chunk-CPKCNHRR.js.map +1 -0
  51. package/dist/cli/chunk-CXVWUPA3.js +96 -0
  52. package/dist/cli/chunk-CXVWUPA3.js.map +1 -0
  53. package/dist/cli/chunk-D5NFKRGO.js +160 -0
  54. package/dist/cli/chunk-D5NFKRGO.js.map +1 -0
  55. package/dist/cli/chunk-ECHSFYOY.js +109 -0
  56. package/dist/cli/chunk-ECHSFYOY.js.map +1 -0
  57. package/dist/cli/chunk-FEZK652I.js +3644 -0
  58. package/dist/cli/chunk-FEZK652I.js.map +1 -0
  59. package/dist/cli/chunk-GALC45Q2.js +696 -0
  60. package/dist/cli/chunk-GALC45Q2.js.map +1 -0
  61. package/dist/cli/chunk-IAUOP25G.js +2984 -0
  62. package/dist/cli/chunk-IAUOP25G.js.map +1 -0
  63. package/dist/cli/chunk-ILJOIQ5W.js +163 -0
  64. package/dist/cli/chunk-ILJOIQ5W.js.map +1 -0
  65. package/dist/cli/chunk-IX6XI2RG.js +225 -0
  66. package/dist/cli/chunk-IX6XI2RG.js.map +1 -0
  67. package/dist/cli/chunk-J5BYPUB5.js +62795 -0
  68. package/dist/cli/chunk-J5BYPUB5.js.map +1 -0
  69. package/dist/cli/chunk-J5XJHLWM.js +55 -0
  70. package/dist/cli/chunk-J5XJHLWM.js.map +1 -0
  71. package/dist/cli/chunk-JKGYMRX5.js +101 -0
  72. package/dist/cli/chunk-JKGYMRX5.js.map +1 -0
  73. package/dist/cli/chunk-JMBMLOBP.js +26 -0
  74. package/dist/cli/chunk-JMBMLOBP.js.map +1 -0
  75. package/dist/cli/chunk-LN3B5PMX.js +128 -0
  76. package/dist/cli/chunk-LN3B5PMX.js.map +1 -0
  77. package/dist/cli/chunk-M2UFZUX3.js +635 -0
  78. package/dist/cli/chunk-M2UFZUX3.js.map +1 -0
  79. package/dist/cli/chunk-PJS34556.js +809 -0
  80. package/dist/cli/chunk-PJS34556.js.map +1 -0
  81. package/dist/cli/chunk-QJG7OF27.js +655 -0
  82. package/dist/cli/chunk-QJG7OF27.js.map +1 -0
  83. package/dist/cli/chunk-QVC75MR3.js +232 -0
  84. package/dist/cli/chunk-QVC75MR3.js.map +1 -0
  85. package/dist/cli/chunk-S2KIUQKQ.js +378 -0
  86. package/dist/cli/chunk-S2KIUQKQ.js.map +1 -0
  87. package/dist/cli/chunk-S4XVGLRW.js +499 -0
  88. package/dist/cli/chunk-S4XVGLRW.js.map +1 -0
  89. package/dist/cli/chunk-T5TQ4NDT.js +190 -0
  90. package/dist/cli/chunk-T5TQ4NDT.js.map +1 -0
  91. package/dist/cli/chunk-TH756VLN.js +1924 -0
  92. package/dist/cli/chunk-TH756VLN.js.map +1 -0
  93. package/dist/cli/chunk-TUK7OWJA.js +51 -0
  94. package/dist/cli/chunk-TUK7OWJA.js.map +1 -0
  95. package/dist/cli/chunk-U4IJVG32.js +363 -0
  96. package/dist/cli/chunk-U4IJVG32.js.map +1 -0
  97. package/dist/cli/chunk-UI66BH6D.js +624 -0
  98. package/dist/cli/chunk-UI66BH6D.js.map +1 -0
  99. package/dist/cli/chunk-VPMBGAND.js +53 -0
  100. package/dist/cli/chunk-VPMBGAND.js.map +1 -0
  101. package/dist/cli/chunk-WLHH3OSR.js +522 -0
  102. package/dist/cli/chunk-WLHH3OSR.js.map +1 -0
  103. package/dist/cli/chunk-WRN65TRD.js +908 -0
  104. package/dist/cli/chunk-WRN65TRD.js.map +1 -0
  105. package/dist/cli/chunk-X53B3JIX.js +34320 -0
  106. package/dist/cli/chunk-X53B3JIX.js.map +1 -0
  107. package/dist/cli/chunk-XJ5SRLKK.js +50 -0
  108. package/dist/cli/chunk-XJ5SRLKK.js.map +1 -0
  109. package/dist/cli/chunk-YZSXRGFH.js +54 -0
  110. package/dist/cli/chunk-YZSXRGFH.js.map +1 -0
  111. package/dist/cli/code-4TUTAGO5.js +163 -0
  112. package/dist/cli/code-4TUTAGO5.js.map +1 -0
  113. package/dist/cli/commands-KMOZEYCF.js +356 -0
  114. package/dist/cli/commands-KMOZEYCF.js.map +1 -0
  115. package/dist/cli/commit-DTFA56VQ.js +292 -0
  116. package/dist/cli/commit-DTFA56VQ.js.map +1 -0
  117. package/dist/cli/desktop-7N3MHNBD.js +1274 -0
  118. package/dist/cli/desktop-7N3MHNBD.js.map +1 -0
  119. package/dist/cli/devtools-HW3WDT3Q.js +91 -0
  120. package/dist/cli/devtools-HW3WDT3Q.js.map +1 -0
  121. package/dist/cli/diff-E5OWTF4C.js +165 -0
  122. package/dist/cli/diff-E5OWTF4C.js.map +1 -0
  123. package/dist/cli/doctor-IEJQRJMN.js +27 -0
  124. package/dist/cli/doctor-IEJQRJMN.js.map +1 -0
  125. package/dist/cli/events-4625EGXI.js +340 -0
  126. package/dist/cli/events-4625EGXI.js.map +1 -0
  127. package/dist/cli/index.js +3536 -0
  128. package/dist/cli/index.js.map +1 -0
  129. package/dist/cli/mcp-PDI2PDLG.js +277 -0
  130. package/dist/cli/mcp-PDI2PDLG.js.map +1 -0
  131. package/dist/cli/mcp-browse-OSPXOFPZ.js +178 -0
  132. package/dist/cli/mcp-browse-OSPXOFPZ.js.map +1 -0
  133. package/dist/cli/mcp-inspect-QRFVTHMF.js +148 -0
  134. package/dist/cli/mcp-inspect-QRFVTHMF.js.map +1 -0
  135. package/dist/cli/package.json +3 -0
  136. package/dist/cli/prompt-3CDII3UO.js +16 -0
  137. package/dist/cli/prompt-3CDII3UO.js.map +1 -0
  138. package/dist/cli/prune-sessions-KZX4SXKW.js +44 -0
  139. package/dist/cli/prune-sessions-KZX4SXKW.js.map +1 -0
  140. package/dist/cli/replay-HYOSRQIV.js +291 -0
  141. package/dist/cli/replay-HYOSRQIV.js.map +1 -0
  142. package/dist/cli/run-2ZHADOUP.js +220 -0
  143. package/dist/cli/run-2ZHADOUP.js.map +1 -0
  144. package/dist/cli/server-X75PAZG5.js +3572 -0
  145. package/dist/cli/server-X75PAZG5.js.map +1 -0
  146. package/dist/cli/sessions-POOZA5CQ.js +120 -0
  147. package/dist/cli/sessions-POOZA5CQ.js.map +1 -0
  148. package/dist/cli/setup-YLPFI3OH.js +618 -0
  149. package/dist/cli/setup-YLPFI3OH.js.map +1 -0
  150. package/dist/cli/stats-NXJ3TO2D.js +16 -0
  151. package/dist/cli/stats-NXJ3TO2D.js.map +1 -0
  152. package/dist/cli/update-ZUO5MKQ6.js +15 -0
  153. package/dist/cli/update-ZUO5MKQ6.js.map +1 -0
  154. package/dist/cli/version-NXXWE3WN.js +33 -0
  155. package/dist/cli/version-NXXWE3WN.js.map +1 -0
  156. package/dist/index.d.ts +2523 -0
  157. package/dist/index.js +15408 -0
  158. package/dist/index.js.map +1 -0
  159. package/package.json +112 -0
@@ -0,0 +1,148 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __cr } from 'node:module'; if (typeof globalThis.require === 'undefined') { globalThis.require = __cr(import.meta.url); }
3
+ import {
4
+ buildTransportFromSpec,
5
+ preflightStdioSpec
6
+ } from "./chunk-VPMBGAND.js";
7
+ import {
8
+ McpClient,
9
+ inspectMcpServer
10
+ } from "./chunk-GALC45Q2.js";
11
+ import "./chunk-25T6CVUP.js";
12
+ import {
13
+ normalizeMcpConfig,
14
+ overlayMatchedSpec,
15
+ parseMcpSpec,
16
+ readConfig
17
+ } from "./chunk-4MQ3VURH.js";
18
+ import "./chunk-LN3B5PMX.js";
19
+ import "./chunk-TUK7OWJA.js";
20
+
21
+ // src/cli/commands/mcp-inspect.ts
22
+ async function mcpInspectCommand(opts) {
23
+ const parsed = parseMcpSpec(opts.spec);
24
+ const cfg = readConfig();
25
+ const normalized = normalizeMcpConfig(cfg);
26
+ const matched = parsed.name ? normalized.find((s) => s.name === parsed.name) : void 0;
27
+ const spec = overlayMatchedSpec(parsed, matched);
28
+ if (spec.transport === "stdio") preflightStdioSpec(spec);
29
+ const transport = buildTransportFromSpec(spec);
30
+ const client = new McpClient({ transport });
31
+ try {
32
+ await client.initialize();
33
+ const report = await inspectMcpServer(client);
34
+ if (opts.json) {
35
+ console.log(JSON.stringify(report, null, 2));
36
+ } else {
37
+ console.log(formatReport(spec.name ?? "(anon)", report));
38
+ }
39
+ } finally {
40
+ await client.close();
41
+ }
42
+ }
43
+ function formatMcpInspectFailure(err) {
44
+ const error = err instanceof Error ? err : new Error(String(err));
45
+ const message = error.message;
46
+ const code = error.code;
47
+ if (code === "ENOENT") {
48
+ const command = message.match(/^spawn\s+([^\s]+)\s+ENOENT$/)?.[1] ?? "the command";
49
+ return `${message} \u2014 try: install or verify \`${command}\`, then check the MCP spec's command spelling`;
50
+ }
51
+ if (code === "ECONNREFUSED") {
52
+ const target = message.match(/\b(https?:\/\/\S+|\d+\.\d+\.\d+\.\d+:\d+|localhost:\d+)\b/i)?.[1];
53
+ return `${message} \u2014 try: confirm ${target ?? "the MCP server"} is running and the host/port match the spec`;
54
+ }
55
+ if (code === "ENOTFOUND" || code === "EAI_AGAIN") {
56
+ return `${message} \u2014 try: confirm the hostname is spelled correctly and DNS resolution is working (check your network/VPN)`;
57
+ }
58
+ if (code === "ECONNRESET") {
59
+ return `${message} \u2014 try: retry the request; if it keeps happening, check the server's logs for crashes or rate limits`;
60
+ }
61
+ if (code === "ETIMEDOUT") {
62
+ return `${message} \u2014 try: confirm the host is reachable and no firewall/proxy is blocking the port`;
63
+ }
64
+ if (code === "CERT_HAS_EXPIRED" || code === "DEPTH_ZERO_SELF_SIGNED_CERT" || code === "UNABLE_TO_VERIFY_LEAF_SIGNATURE" || code === "SELF_SIGNED_CERT_IN_CHAIN") {
65
+ return `${message} \u2014 try: renew or trust the server's TLS certificate, or point the spec at an endpoint with a valid cert`;
66
+ }
67
+ const httpStatus = matchTransportHttpStatus(message);
68
+ if (httpStatus !== null) {
69
+ return `${message}${hintForHttpStatus(httpStatus)}`;
70
+ }
71
+ if (/^MCP request initialize \(id=\d+\) timed out after \d+ms$/.test(message)) {
72
+ return `${message} \u2014 try: confirm the target speaks MCP and completes the handshake before the request timeout`;
73
+ }
74
+ if (/^(empty MCP spec|MCP spec ".*" has name but no command)/.test(message)) {
75
+ return `${message} \u2014 try: pass \`name=command args\` or an http(s):// URL`;
76
+ }
77
+ return message;
78
+ }
79
+ function matchTransportHttpStatus(message) {
80
+ const m = message.match(/^SSE handshake \S+ → (\d{3})\b/) ?? message.match(/^MCP SSE POST \S+ failed: (\d{3})\b/) ?? message.match(/^MCP Streamable HTTP POST \S+ → (\d{3})\b/);
81
+ return m ? Number(m[1]) : null;
82
+ }
83
+ function hintForHttpStatus(status) {
84
+ if (status === 401) {
85
+ return " \u2014 try: check the spec's auth header (e.g. `Authorization: Bearer \u2026`) or confirm the token isn't expired";
86
+ }
87
+ if (status === 403) {
88
+ return " \u2014 try: confirm the credentials have permission to reach this MCP endpoint";
89
+ }
90
+ if (status === 404) {
91
+ return " \u2014 try: confirm the endpoint path in the spec matches what the server actually exposes";
92
+ }
93
+ if (status >= 500 && status <= 599) {
94
+ return " \u2014 try: retry shortly; if the failure persists, check the MCP server's logs";
95
+ }
96
+ return "";
97
+ }
98
+ function formatReport(nsName, r) {
99
+ const lines = [];
100
+ lines.push(`MCP server [${nsName}]`);
101
+ lines.push(
102
+ ` server ${r.serverInfo.name || "(unknown)"}${r.serverInfo.version ? ` v${r.serverInfo.version}` : ""}`
103
+ );
104
+ lines.push(` protocol ${r.protocolVersion}`);
105
+ const capKeys = Object.keys(r.capabilities);
106
+ lines.push(` caps ${capKeys.length > 0 ? capKeys.join(", ") : "(none advertised)"}`);
107
+ if (r.instructions) {
108
+ lines.push(` notes ${r.instructions.trim().slice(0, 200)}`);
109
+ }
110
+ lines.push("");
111
+ lines.push(formatSection("Tools", r.tools, toolLine));
112
+ lines.push(formatSection("Resources", r.resources, resourceLine));
113
+ lines.push(formatSection("Prompts", r.prompts, promptLine));
114
+ return lines.join("\n");
115
+ }
116
+ function formatSection(title, section, render) {
117
+ if (!section.supported) {
118
+ return `${title}: (not supported \u2014 ${section.reason})`;
119
+ }
120
+ if (section.items.length === 0) {
121
+ return `${title}: (none)`;
122
+ }
123
+ const lines = [`${title} (${section.items.length}):`];
124
+ for (const item of section.items) lines.push(` ${render(item)}`);
125
+ return lines.join("\n");
126
+ }
127
+ function toolLine(t) {
128
+ const desc = t.description ? ` \u2014 ${oneLine(t.description, 80)}` : "";
129
+ return `\xB7 ${t.name}${desc}`;
130
+ }
131
+ function resourceLine(r) {
132
+ const mime = r.mimeType ? ` [${r.mimeType}]` : "";
133
+ return `\xB7 ${r.name}${mime} ${r.uri}`;
134
+ }
135
+ function promptLine(p) {
136
+ const argPart = p.arguments && p.arguments.length > 0 ? ` (${p.arguments.map((a) => a.required ? a.name : `${a.name}?`).join(", ")})` : "";
137
+ const desc = p.description ? ` \u2014 ${oneLine(p.description, 80)}` : "";
138
+ return `\xB7 ${p.name}${argPart}${desc}`;
139
+ }
140
+ function oneLine(s, max) {
141
+ const flat = s.replace(/\s+/g, " ").trim();
142
+ return flat.length <= max ? flat : `${flat.slice(0, max - 1)}\u2026`;
143
+ }
144
+ export {
145
+ formatMcpInspectFailure,
146
+ mcpInspectCommand
147
+ };
148
+ //# sourceMappingURL=mcp-inspect-QRFVTHMF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/commands/mcp-inspect.ts"],"sourcesContent":["import { normalizeMcpConfig, readConfig } from \"../../config.js\";\nimport { McpClient } from \"../../mcp/client.js\";\nimport { inspectMcpServer } from \"../../mcp/inspect.js\";\nimport type { InspectionReport } from \"../../mcp/inspect.js\";\nimport { preflightStdioSpec } from \"../../mcp/preflight.js\";\nimport { overlayMatchedSpec, parseMcpSpec } from \"../../mcp/spec.js\";\nimport { buildTransportFromSpec } from \"../../mcp/transport-from-spec.js\";\n\nexport interface McpInspectOptions {\n /** The raw --mcp spec string (e.g. `fs=npx -y @modelcontextprotocol/server-filesystem .`). */\n spec: string;\n /** Emit JSON on stdout instead of the human-readable table. */\n json?: boolean;\n}\n\nexport async function mcpInspectCommand(opts: McpInspectOptions): Promise<void> {\n const parsed = parseMcpSpec(opts.spec);\n const cfg = readConfig();\n const normalized = normalizeMcpConfig(cfg);\n const matched = parsed.name ? normalized.find((s) => s.name === parsed.name) : undefined;\n const spec = overlayMatchedSpec(parsed, matched);\n if (spec.transport === \"stdio\") preflightStdioSpec(spec);\n const transport = buildTransportFromSpec(spec);\n const client = new McpClient({ transport });\n try {\n await client.initialize();\n const report = await inspectMcpServer(client);\n if (opts.json) {\n console.log(JSON.stringify(report, null, 2));\n } else {\n console.log(formatReport(spec.name ?? \"(anon)\", report));\n }\n } finally {\n await client.close();\n }\n}\n\nexport function formatMcpInspectFailure(err: unknown): string {\n const error = err instanceof Error ? err : new Error(String(err));\n const message = error.message;\n const code = (error as NodeJS.ErrnoException).code;\n\n if (code === \"ENOENT\") {\n const command = message.match(/^spawn\\s+([^\\s]+)\\s+ENOENT$/)?.[1] ?? \"the command\";\n return `${message} — try: install or verify \\`${command}\\`, then check the MCP spec's command spelling`;\n }\n\n if (code === \"ECONNREFUSED\") {\n const target = message.match(/\\b(https?:\\/\\/\\S+|\\d+\\.\\d+\\.\\d+\\.\\d+:\\d+|localhost:\\d+)\\b/i)?.[1];\n return `${message} — try: confirm ${target ?? \"the MCP server\"} is running and the host/port match the spec`;\n }\n\n if (code === \"ENOTFOUND\" || code === \"EAI_AGAIN\") {\n return `${message} — try: confirm the hostname is spelled correctly and DNS resolution is working (check your network/VPN)`;\n }\n\n if (code === \"ECONNRESET\") {\n return `${message} — try: retry the request; if it keeps happening, check the server's logs for crashes or rate limits`;\n }\n\n if (code === \"ETIMEDOUT\") {\n return `${message} — try: confirm the host is reachable and no firewall/proxy is blocking the port`;\n }\n\n if (\n code === \"CERT_HAS_EXPIRED\" ||\n code === \"DEPTH_ZERO_SELF_SIGNED_CERT\" ||\n code === \"UNABLE_TO_VERIFY_LEAF_SIGNATURE\" ||\n code === \"SELF_SIGNED_CERT_IN_CHAIN\"\n ) {\n return `${message} — try: renew or trust the server's TLS certificate, or point the spec at an endpoint with a valid cert`;\n }\n\n // HTTP non-2xx from SSE / Streamable HTTP transports. Match the three\n // exact shapes those transports emit and surface an auth/endpoint hint.\n const httpStatus = matchTransportHttpStatus(message);\n if (httpStatus !== null) {\n return `${message}${hintForHttpStatus(httpStatus)}`;\n }\n\n if (/^MCP request initialize \\(id=\\d+\\) timed out after \\d+ms$/.test(message)) {\n return `${message} — try: confirm the target speaks MCP and completes the handshake before the request timeout`;\n }\n\n if (/^(empty MCP spec|MCP spec \".*\" has name but no command)/.test(message)) {\n return `${message} — try: pass \\`name=command args\\` or an http(s):// URL`;\n }\n\n return message;\n}\n\nfunction matchTransportHttpStatus(message: string): number | null {\n // src/mcp/sse.ts: `SSE handshake <url> → <status> <statusText>`\n // src/mcp/sse.ts: `MCP SSE POST <url> failed: <status> <statusText>`\n // src/mcp/streamable-http.ts: `MCP Streamable HTTP POST <url> → <status> <statusText>...`\n const m =\n message.match(/^SSE handshake \\S+ → (\\d{3})\\b/) ??\n message.match(/^MCP SSE POST \\S+ failed: (\\d{3})\\b/) ??\n message.match(/^MCP Streamable HTTP POST \\S+ → (\\d{3})\\b/);\n return m ? Number(m[1]) : null;\n}\n\nfunction hintForHttpStatus(status: number): string {\n if (status === 401) {\n return \" — try: check the spec's auth header (e.g. `Authorization: Bearer …`) or confirm the token isn't expired\";\n }\n if (status === 403) {\n return \" — try: confirm the credentials have permission to reach this MCP endpoint\";\n }\n if (status === 404) {\n return \" — try: confirm the endpoint path in the spec matches what the server actually exposes\";\n }\n if (status >= 500 && status <= 599) {\n return \" — try: retry shortly; if the failure persists, check the MCP server's logs\";\n }\n return \"\";\n}\n\nfunction formatReport(nsName: string, r: InspectionReport): string {\n const lines: string[] = [];\n lines.push(`MCP server [${nsName}]`);\n lines.push(\n ` server ${r.serverInfo.name || \"(unknown)\"}${r.serverInfo.version ? ` v${r.serverInfo.version}` : \"\"}`,\n );\n lines.push(` protocol ${r.protocolVersion}`);\n const capKeys = Object.keys(r.capabilities);\n lines.push(` caps ${capKeys.length > 0 ? capKeys.join(\", \") : \"(none advertised)\"}`);\n if (r.instructions) {\n lines.push(` notes ${r.instructions.trim().slice(0, 200)}`);\n }\n lines.push(\"\");\n lines.push(formatSection(\"Tools\", r.tools, toolLine));\n lines.push(formatSection(\"Resources\", r.resources, resourceLine));\n lines.push(formatSection(\"Prompts\", r.prompts, promptLine));\n return lines.join(\"\\n\");\n}\n\nfunction formatSection<T>(\n title: string,\n section: { supported: true; items: T[] } | { supported: false; reason: string },\n render: (item: T) => string,\n): string {\n if (!section.supported) {\n return `${title}: (not supported — ${section.reason})`;\n }\n if (section.items.length === 0) {\n return `${title}: (none)`;\n }\n const lines = [`${title} (${section.items.length}):`];\n for (const item of section.items) lines.push(` ${render(item)}`);\n return lines.join(\"\\n\");\n}\n\nfunction toolLine(t: { name: string; description?: string }): string {\n const desc = t.description ? ` — ${oneLine(t.description, 80)}` : \"\";\n return `· ${t.name}${desc}`;\n}\n\nfunction resourceLine(r: { uri: string; name: string; mimeType?: string }): string {\n const mime = r.mimeType ? ` [${r.mimeType}]` : \"\";\n return `· ${r.name}${mime} ${r.uri}`;\n}\n\nfunction promptLine(p: {\n name: string;\n description?: string;\n arguments?: Array<{ name: string; required?: boolean }>;\n}): string {\n const argPart =\n p.arguments && p.arguments.length > 0\n ? ` (${p.arguments.map((a) => (a.required ? a.name : `${a.name}?`)).join(\", \")})`\n : \"\";\n const desc = p.description ? ` — ${oneLine(p.description, 80)}` : \"\";\n return `· ${p.name}${argPart}${desc}`;\n}\n\nfunction oneLine(s: string, max: number): string {\n const flat = s.replace(/\\s+/g, \" \").trim();\n return flat.length <= max ? flat : `${flat.slice(0, max - 1)}…`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,eAAsB,kBAAkB,MAAwC;AAC9E,QAAM,SAAS,aAAa,KAAK,IAAI;AACrC,QAAM,MAAM,WAAW;AACvB,QAAM,aAAa,mBAAmB,GAAG;AACzC,QAAM,UAAU,OAAO,OAAO,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,OAAO,IAAI,IAAI;AAC/E,QAAM,OAAO,mBAAmB,QAAQ,OAAO;AAC/C,MAAI,KAAK,cAAc,QAAS,oBAAmB,IAAI;AACvD,QAAM,YAAY,uBAAuB,IAAI;AAC7C,QAAM,SAAS,IAAI,UAAU,EAAE,UAAU,CAAC;AAC1C,MAAI;AACF,UAAM,OAAO,WAAW;AACxB,UAAM,SAAS,MAAM,iBAAiB,MAAM;AAC5C,QAAI,KAAK,MAAM;AACb,cAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAAA,IAC7C,OAAO;AACL,cAAQ,IAAI,aAAa,KAAK,QAAQ,UAAU,MAAM,CAAC;AAAA,IACzD;AAAA,EACF,UAAE;AACA,UAAM,OAAO,MAAM;AAAA,EACrB;AACF;AAEO,SAAS,wBAAwB,KAAsB;AAC5D,QAAM,QAAQ,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;AAChE,QAAM,UAAU,MAAM;AACtB,QAAM,OAAQ,MAAgC;AAE9C,MAAI,S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AClE,SAAO,QAAK,EAAE,IAAI,GAAG,IAAI;AAC3B;AAEA,SAAS,aAAa,GAA6D;AACjF,QAAM,OAAO,EAAE,WAAW,KAAK,EAAE,QAAQ,MAAM;AAC/C,SAAO,QAAK,EAAE,IAAI,GAAG,IAAI,KAAK,EAAE,GAAG;AACrC;AAEA,SAAS,WAAW,GAIT;AACT,QAAM,UACJ,EAAE,aAAa,EAAE,UAAU,SAAS,IAChC,KAAK,EAAE,UAAU,IAAI,CAAC,MAAO,EAAE,WAAW,EAAE,OAAO,GAAG,EAAE,IAAI,GAAI,EAAE,KAAK,IAAI,CAAC,MAC5E;AACN,QAAM,OAAO,EAAE,cAAc,WAAM,QAAQ,EAAE,aAAa,EAAE,CAAC,KAAK;AAClE,SAAO,QAAK,EAAE,IAAI,GAAG,OAAO,GAAG,IAAI;AACrC;AAEA,SAAS,QAAQ,GAAW,KAAqB;AAC/C,QAAM,OAAO,EAAE,QAAQ,QAAQ,GAAG,EAAE,KAAK;AACzC,SAAO,KAAK,UAAU,MAAM,OAAO,GAAG,KAAK,MAAM,GAAG,MAAM,CAAC,CAAC;AAC9D;","names":[]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __cr } from 'node:module'; if (typeof globalThis.require === 'undefined') { globalThis.require = __cr(import.meta.url); }
3
+ import {
4
+ CODE_SYSTEM_PROMPT,
5
+ codeSystemBase,
6
+ codeSystemPrompt
7
+ } from "./chunk-QJG7OF27.js";
8
+ import "./chunk-M2UFZUX3.js";
9
+ import "./chunk-4MQ3VURH.js";
10
+ import "./chunk-TUK7OWJA.js";
11
+ export {
12
+ CODE_SYSTEM_PROMPT,
13
+ codeSystemBase,
14
+ codeSystemPrompt
15
+ };
16
+ //# sourceMappingURL=prompt-3CDII3UO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __cr } from 'node:module'; if (typeof globalThis.require === 'undefined') { globalThis.require = __cr(import.meta.url); }
3
+ import {
4
+ listSessions,
5
+ pruneStaleSessions
6
+ } from "./chunk-U4IJVG32.js";
7
+ import "./chunk-TUK7OWJA.js";
8
+
9
+ // src/cli/commands/prune-sessions.ts
10
+ function pruneSessionsCommand(opts) {
11
+ const days = opts.days ?? 90;
12
+ if (!Number.isFinite(days) || days < 1) {
13
+ console.error(`--days must be a positive integer (got ${days}).`);
14
+ process.exit(1);
15
+ }
16
+ if (opts.dryRun) {
17
+ const cutoff = Date.now() - days * 24 * 60 * 60 * 1e3;
18
+ const stale = listSessions().filter((s) => s.mtime.getTime() < cutoff);
19
+ if (stale.length === 0) {
20
+ console.log(`no sessions idle \u2265${days} days. Nothing would be pruned.`);
21
+ return;
22
+ }
23
+ console.log(`would prune ${stale.length} session(s) idle \u2265${days} days:`);
24
+ for (const s of stale) {
25
+ console.log(` ${s.name}`);
26
+ }
27
+ console.log("");
28
+ console.log("re-run without --dry-run to actually delete.");
29
+ return;
30
+ }
31
+ const removed = pruneStaleSessions(days);
32
+ if (removed.length === 0) {
33
+ console.log(`no sessions idle \u2265${days} days. Nothing pruned.`);
34
+ return;
35
+ }
36
+ console.log(`pruned ${removed.length} session(s) idle \u2265${days} days:`);
37
+ for (const name of removed) {
38
+ console.log(` ${name}`);
39
+ }
40
+ }
41
+ export {
42
+ pruneSessionsCommand
43
+ };
44
+ //# sourceMappingURL=prune-sessions-KZX4SXKW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/commands/prune-sessions.ts"],"sourcesContent":["import { listSessions, pruneStaleSessions } from \"../../memory/session.js\";\n\nexport interface PruneSessionsOptions {\n days?: number;\n dryRun?: boolean;\n}\n\nexport function pruneSessionsCommand(opts: PruneSessionsOptions): void {\n const days = opts.days ?? 90;\n if (!Number.isFinite(days) || days < 1) {\n console.error(`--days must be a positive integer (got ${days}).`);\n process.exit(1);\n }\n if (opts.dryRun) {\n const cutoff = Date.now() - days * 24 * 60 * 60 * 1000;\n const stale = listSessions().filter((s) => s.mtime.getTime() < cutoff);\n if (stale.length === 0) {\n console.log(`no sessions idle ≥${days} days. Nothing would be pruned.`);\n return;\n }\n console.log(`would prune ${stale.length} session(s) idle ≥${days} days:`);\n for (const s of stale) {\n console.log(` ${s.name}`);\n }\n console.log(\"\");\n console.log(\"re-run without --dry-run to actually delete.\");\n return;\n }\n const removed = pruneStaleSessions(days);\n if (removed.length === 0) {\n console.log(`no sessions idle ≥${days} days. Nothing pruned.`);\n return;\n }\n console.log(`pruned ${removed.length} session(s) idle ≥${days} days:`);\n for (const name of removed) {\n console.log(` ${name}`);\n }\n}\n"],"mappings":";;;;;;;;;AAOO,SAAS,qBAAqB,MAAkC;AACrE,QAAM,OAAO,KAAK,QAAQ;AAC1B,MAAI,CAAC,OAAO,SAAS,IAAI,KAAK,OAAO,GAAG;AACtC,YAAQ,MAAM,0CAA0C,IAAI,IAAI;AAChE,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,MAAI,KAAK,QAAQ;AACf,UAAM,SAAS,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,KAAK;AAClD,UAAM,QAAQ,aAAa,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,QAAQ,IAAI,MAAM;AACrE,QAAI,MAAM,WAAW,GAAG;AACtB,cAAQ,IAAI,0BAAqB,IAAI,iCAAiC;AACtE;AAAA,IACF;AACA,YAAQ,IAAI,eAAe,MAAM,MAAM,0BAAqB,IAAI,QAAQ;AACxE,eAAW,KAAK,OAAO;AACrB,cAAQ,IAAI,KAAK,EAAE,IAAI,EAAE;AAAA,IAC3B;AACA,YAAQ,IAAI,EAAE;AACd,YAAQ,IAAI,8CAA8C;AAC1D;AAAA,EACF;AACA,QAAM,UAAU,mBAAmB,IAAI;AACvC,MAAI,QAAQ,WAAW,GAAG;AACxB,YAAQ,IAAI,0BAAqB,IAAI,wBAAwB;AAC7D;AAAA,EACF;AACA,UAAQ,IAAI,UAAU,QAAQ,MAAM,0BAAqB,IAAI,QAAQ;AACrE,aAAW,QAAQ,SAAS;AAC1B,YAAQ,IAAI,KAAK,IAAI,EAAE;AAAA,EACzB;AACF;","names":[]}
@@ -0,0 +1,291 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __cr } from 'node:module'; if (typeof globalThis.require === 'undefined') { globalThis.require = __cr(import.meta.url); }
3
+ import {
4
+ RecordView
5
+ } from "./chunk-3T6VBZCL.js";
6
+ import {
7
+ Bar,
8
+ ChromeRule,
9
+ stringWidth
10
+ } from "./chunk-CXVWUPA3.js";
11
+ import {
12
+ computeCumulativeStats,
13
+ groupRecordsByTurn,
14
+ replayFromFile
15
+ } from "./chunk-T5TQ4NDT.js";
16
+ import {
17
+ COLOR,
18
+ GRADIENT
19
+ } from "./chunk-D5NFKRGO.js";
20
+ import {
21
+ Box_default,
22
+ Static,
23
+ Text,
24
+ render_default,
25
+ require_react,
26
+ use_app_default,
27
+ use_input_default,
28
+ use_stdout_default
29
+ } from "./chunk-X53B3JIX.js";
30
+ import "./chunk-BSGCXZQN.js";
31
+ import "./chunk-25T6CVUP.js";
32
+ import "./chunk-ILJOIQ5W.js";
33
+ import {
34
+ t
35
+ } from "./chunk-IAUOP25G.js";
36
+ import {
37
+ formatBalance,
38
+ formatCost
39
+ } from "./chunk-4MQ3VURH.js";
40
+ import {
41
+ __toESM
42
+ } from "./chunk-TUK7OWJA.js";
43
+
44
+ // src/cli/commands/replay.ts
45
+ var import_react3 = __toESM(require_react(), 1);
46
+
47
+ // src/cli/ui/ReplayApp.tsx
48
+ var import_react2 = __toESM(require_react(), 1);
49
+
50
+ // src/cli/ui/StatsPanel.tsx
51
+ import { basename } from "path";
52
+ var import_react = __toESM(require_react(), 1);
53
+ var COLD_START_TURNS = 3;
54
+ function StatsPanel({
55
+ summary,
56
+ planMode,
57
+ editMode,
58
+ balance,
59
+ updateAvailable,
60
+ proArmed,
61
+ escalated,
62
+ budgetUsd,
63
+ rootDir,
64
+ sessionName
65
+ }) {
66
+ const coldStart = summary.turns <= COLD_START_TURNS;
67
+ return /* @__PURE__ */ import_react.default.createElement(Box_default, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ import_react.default.createElement(
68
+ ChromeRow,
69
+ {
70
+ editMode,
71
+ planMode,
72
+ proArmed: proArmed ?? false,
73
+ escalated: escalated ?? false,
74
+ summary,
75
+ coldStart,
76
+ rootDir,
77
+ sessionName: sessionName ?? null,
78
+ updateAvailable,
79
+ balance: balance ?? null
80
+ }
81
+ ), /* @__PURE__ */ import_react.default.createElement(ChromeRule, null), budgetUsd !== null && budgetUsd !== void 0 ? /* @__PURE__ */ import_react.default.createElement(BudgetRow, { spent: summary.totalCostUsd, cap: budgetUsd }) : null);
82
+ }
83
+ function ChromeRow({
84
+ editMode,
85
+ planMode,
86
+ proArmed,
87
+ escalated,
88
+ summary,
89
+ coldStart,
90
+ rootDir,
91
+ sessionName,
92
+ updateAvailable,
93
+ balance
94
+ }) {
95
+ const modePill = pickModePill(planMode, editMode);
96
+ const proLabel = t("statsPanel.pro");
97
+ const proPill = escalated ? { label: proLabel, color: COLOR.err } : proArmed ? { label: proLabel, color: COLOR.warn } : null;
98
+ const projectName = rootDir ? basename(rootDir) : null;
99
+ const cachePct = (summary.cacheHitRatio * 100).toFixed(1);
100
+ const cacheColor = summary.cacheHitRatio >= 0.7 ? COLOR.ok : summary.cacheHitRatio >= 0.4 ? COLOR.warn : COLOR.err;
101
+ const balanceLabel = balance ? `[${formatBalance(balance.total, balance.currency, { label: true })}]` : "";
102
+ const costLabel = `[${formatCost(summary.totalCostUsd, balance?.currency)}]`;
103
+ const cacheLabel = "[c \u25B0\u25B0\u25B0\u25B0\u25B0\u25B0 100%]";
104
+ const updateLabel = updateAvailable ? `\u2191 ${updateAvailable}` : "";
105
+ const { stdout } = use_stdout_default();
106
+ const cols = (stdout?.columns ?? 80) - 2;
107
+ const SEP_DOT = stringWidth(" \xB7 ");
108
+ const SEP_ARROW = stringWidth(" \u203A ");
109
+ const GAP = 2;
110
+ const fixedLeft = stringWidth("\u25C8 carboncode") + (projectName ? SEP_DOT + stringWidth(projectName) : 0);
111
+ const modeW = modePill ? GAP + stringWidth(`[${modePill.label}]`) : 0;
112
+ const proW = proPill ? GAP + stringWidth(`[${proPill.label}]`) : 0;
113
+ const fixedRight = modeW + proW + stringWidth(costLabel);
114
+ let budget = cols - fixedLeft - fixedRight;
115
+ const balW = balance ? GAP + stringWidth(balanceLabel) : 0;
116
+ const cacheW = GAP + stringWidth(cacheLabel);
117
+ const sessionW = sessionName ? SEP_ARROW + stringWidth(sessionName) : 0;
118
+ const updateW = updateLabel ? GAP + stringWidth(updateLabel) : 0;
119
+ const showBalance = balW > 0 && budget >= balW;
120
+ if (showBalance) budget -= balW;
121
+ const showCache = budget >= cacheW;
122
+ if (showCache) budget -= cacheW;
123
+ const showSession = sessionW > 0 && budget >= sessionW;
124
+ if (showSession) budget -= sessionW;
125
+ const showUpdate = updateW > 0 && budget >= updateW;
126
+ if (showUpdate) budget -= updateW;
127
+ return /* @__PURE__ */ import_react.default.createElement(Box_default, null, /* @__PURE__ */ import_react.default.createElement(Text, { bold: true, color: GRADIENT[0] }, "\u25C8 "), /* @__PURE__ */ import_react.default.createElement(Text, { color: COLOR.brand, bold: true }, "carboncode"), projectName ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(Text, { color: COLOR.info, dimColor: true }, " \xB7 "), /* @__PURE__ */ import_react.default.createElement(Text, null, projectName), showSession && sessionName ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(Text, { color: COLOR.info, dimColor: true }, " \u203A "), /* @__PURE__ */ import_react.default.createElement(Text, { color: COLOR.info }, sessionName)) : null) : null, /* @__PURE__ */ import_react.default.createElement(Box_default, { flexGrow: 1 }), showUpdate ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(Text, { color: COLOR.warn, bold: true }, updateLabel), /* @__PURE__ */ import_react.default.createElement(Text, null, " ")) : null, modePill ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(Text, { color: modePill.color, bold: true }, `[${modePill.label}]`), /* @__PURE__ */ import_react.default.createElement(Text, null, " ")) : null, proPill ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(Text, { color: proPill.color, bold: true }, `[${proPill.label}]`), /* @__PURE__ */ import_react.default.createElement(Text, null, " ")) : null, /* @__PURE__ */ import_react.default.createElement(
128
+ Text,
129
+ {
130
+ color: summary.turns === 0 || coldStart ? COLOR.info : sessionCostColor(summary.totalCostUsd),
131
+ bold: summary.turns > 0 && !coldStart,
132
+ dimColor: summary.turns === 0 || coldStart
133
+ },
134
+ costLabel
135
+ ), showBalance && balance ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(Text, null, " "), /* @__PURE__ */ import_react.default.createElement(Text, { color: balance.total < 1 ? COLOR.err : balance.total < 5 ? COLOR.warn : COLOR.ok }, balanceLabel)) : null, showCache ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(Text, null, " "), /* @__PURE__ */ import_react.default.createElement(Text, { dimColor: true }, "["), /* @__PURE__ */ import_react.default.createElement(Text, { dimColor: true }, "c "), /* @__PURE__ */ import_react.default.createElement(
136
+ Bar,
137
+ {
138
+ ratio: summary.cacheHitRatio,
139
+ color: coldStart ? COLOR.info : cacheColor,
140
+ cells: 6,
141
+ dim: coldStart
142
+ }
143
+ ), /* @__PURE__ */ import_react.default.createElement(Text, null, " "), /* @__PURE__ */ import_react.default.createElement(Text, { color: coldStart ? void 0 : cacheColor, dimColor: coldStart }, coldStart && summary.turns === 0 ? "\u2014" : `${cachePct}%`), /* @__PURE__ */ import_react.default.createElement(Text, { dimColor: true }, "]")) : null);
144
+ }
145
+ function pickModePill(planMode, editMode) {
146
+ if (planMode) return { label: t("statsPanel.modePlan"), color: COLOR.err };
147
+ if (editMode === "yolo") return { label: t("statsPanel.modeYolo"), color: COLOR.err };
148
+ if (editMode === "auto") return { label: t("statsPanel.modeAuto"), color: COLOR.primary };
149
+ if (editMode === "review") return { label: t("statsPanel.modeReview"), color: COLOR.info };
150
+ return null;
151
+ }
152
+ function BudgetRow({ spent, cap }) {
153
+ const pct = Math.max(0, spent / cap * 100);
154
+ const color = pct >= 100 ? "#f87171" : pct >= 80 ? "#fbbf24" : "#94a3b8";
155
+ return /* @__PURE__ */ import_react.default.createElement(Box_default, null, /* @__PURE__ */ import_react.default.createElement(Text, { dimColor: true }, t("statsPanel.budget")), /* @__PURE__ */ import_react.default.createElement(Text, { color }, `$${spent.toFixed(4)} / $${cap.toFixed(2)}`, /* @__PURE__ */ import_react.default.createElement(Text, { dimColor: true }, ` (${pct.toFixed(0)}%)`)));
156
+ }
157
+ function sessionCostColor(cost) {
158
+ if (cost <= 0) return void 0;
159
+ if (cost >= 5) return COLOR.err;
160
+ if (cost >= 0.5) return COLOR.warn;
161
+ return COLOR.ok;
162
+ }
163
+
164
+ // src/cli/ui/ReplayApp.tsx
165
+ function ReplayApp({ meta, pages }) {
166
+ const { exit } = use_app_default();
167
+ const maxIdx = Math.max(0, pages.length - 1);
168
+ const [idx, setIdx] = (0, import_react2.useState)(maxIdx);
169
+ use_input_default((input, key) => {
170
+ if (input === "q" || key.ctrl && input === "c") {
171
+ exit();
172
+ return;
173
+ }
174
+ if (input === "j" || key.downArrow || input === " " || key.return) {
175
+ setIdx((i) => Math.min(maxIdx, i + 1));
176
+ } else if (input === "k" || key.upArrow) {
177
+ setIdx((i) => Math.max(0, i - 1));
178
+ } else if (input === "g") {
179
+ setIdx(0);
180
+ } else if (input === "G") {
181
+ setIdx(maxIdx);
182
+ } else if (input === "h" || key.leftArrow) {
183
+ setIdx(0);
184
+ } else if (input === "l" || key.rightArrow) {
185
+ setIdx(maxIdx);
186
+ }
187
+ });
188
+ const cumStats = (0, import_react2.useMemo)(() => computeCumulativeStats(pages, idx), [pages, idx]);
189
+ const summary = {
190
+ turns: cumStats.turns,
191
+ totalCostUsd: cumStats.totalCostUsd,
192
+ totalInputCostUsd: cumStats.totalInputCostUsd,
193
+ totalOutputCostUsd: cumStats.totalOutputCostUsd,
194
+ claudeEquivalentUsd: cumStats.claudeEquivalentUsd,
195
+ savingsVsClaudePct: cumStats.savingsVsClaudePct,
196
+ cacheHitRatio: cumStats.cacheHitRatio,
197
+ // Replay is read-only — no live last-turn prompt tokens to show.
198
+ lastPromptTokens: 0,
199
+ lastTurnCostUsd: 0
200
+ };
201
+ const prefixHash = cumStats.prefixHashes.length === 1 ? cumStats.prefixHashes[0].slice(0, 16) : cumStats.prefixHashes.length === 0 ? t("replayApp.untracked") : t("replayApp.churned", { count: cumStats.prefixHashes.length });
202
+ const currentPage = pages[idx];
203
+ const progressLabel = pages.length === 0 ? t("replayApp.emptyTranscript") : t("replayApp.turnProgress", { current: idx + 1, total: pages.length });
204
+ return /* @__PURE__ */ import_react2.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(StatsPanel, { summary }), /* @__PURE__ */ import_react2.default.createElement(Box_default, { flexDirection: "column", marginTop: 1, paddingX: 1 }, /* @__PURE__ */ import_react2.default.createElement(Box_default, { justifyContent: "space-between" }, /* @__PURE__ */ import_react2.default.createElement(Text, { color: "cyan", bold: true }, progressLabel), meta ? /* @__PURE__ */ import_react2.default.createElement(Text, { dimColor: true }, meta.source, meta.task ? ` \xB7 ${meta.task}` : "", meta.mode ? ` \xB7 ${meta.mode}` : "") : null), currentPage ? /* @__PURE__ */ import_react2.default.createElement(Static, { items: currentPage.records.map((rec, i) => ({ key: `${idx}-${i}`, rec })) }, ({ key, rec }) => /* @__PURE__ */ import_react2.default.createElement(RecordView, { key, rec })) : /* @__PURE__ */ import_react2.default.createElement(Text, { dimColor: true, italic: true }, t("replayApp.noRecords"))), /* @__PURE__ */ import_react2.default.createElement(Box_default, { marginTop: 1, paddingX: 1, borderStyle: "single", borderColor: "gray" }, /* @__PURE__ */ import_react2.default.createElement(Text, { dimColor: true }, /* @__PURE__ */ import_react2.default.createElement(Text, { bold: true }, "j"), "/", /* @__PURE__ */ import_react2.default.createElement(Text, { bold: true }, "\u2193"), "/", /* @__PURE__ */ import_react2.default.createElement(Text, { bold: true }, "space"), " next \xB7 ", /* @__PURE__ */ import_react2.default.createElement(Text, { bold: true }, "k"), "/", /* @__PURE__ */ import_react2.default.createElement(Text, { bold: true }, "\u2191"), " prev \xB7 ", /* @__PURE__ */ import_react2.default.createElement(Text, { bold: true }, "g"), " first \xB7 ", /* @__PURE__ */ import_react2.default.createElement(Text, { bold: true }, "G"), " last \xB7", " ", /* @__PURE__ */ import_react2.default.createElement(Text, { bold: true }, "q"), " quit")));
205
+ }
206
+
207
+ // src/cli/commands/replay.ts
208
+ async function replayCommand(opts) {
209
+ const wantPrint = opts.print || !process.stdout.isTTY || opts.head !== void 0 || opts.tail !== void 0;
210
+ if (wantPrint) {
211
+ printReplay(opts);
212
+ return;
213
+ }
214
+ const { parsed } = replayFromFile(opts.path);
215
+ const pages = groupRecordsByTurn(parsed.records);
216
+ const { waitUntilExit } = render_default(import_react3.default.createElement(ReplayApp, { meta: parsed.meta, pages }), {
217
+ exitOnCtrlC: true,
218
+ patchConsole: false
219
+ });
220
+ await waitUntilExit();
221
+ }
222
+ function printReplay(opts) {
223
+ const { parsed, stats } = replayFromFile(opts.path);
224
+ if (parsed.meta) {
225
+ const m = parsed.meta;
226
+ const bits = [`source=${m.source}`];
227
+ if (m.model) bits.push(`model=${m.model}`);
228
+ if (m.task) bits.push(`task=${m.task}`);
229
+ if (m.mode) bits.push(`mode=${m.mode}`);
230
+ if (m.repeat !== void 0) bits.push(`repeat=${m.repeat}`);
231
+ bits.push(`started=${m.startedAt}`);
232
+ console.log(`[meta] ${bits.join(" ")}`);
233
+ console.log("");
234
+ }
235
+ const records = sliceRecords(parsed.records, opts);
236
+ for (const rec of records) {
237
+ renderRecord(rec);
238
+ }
239
+ console.log("");
240
+ console.log("\u2500\u2500 summary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
241
+ console.log(`model calls: ${stats.turns}`);
242
+ console.log(`user turns: ${stats.userTurns}`);
243
+ console.log(`tool calls: ${stats.toolCalls}`);
244
+ console.log(`cache hit: ${(stats.cacheHitRatio * 100).toFixed(1)}%`);
245
+ console.log(`cost: $${stats.totalCostUsd.toFixed(6)}`);
246
+ console.log(`claude equivalent: $${stats.claudeEquivalentUsd.toFixed(6)}`);
247
+ console.log(`savings vs claude: ${stats.savingsVsClaudePct.toFixed(1)}%`);
248
+ console.log(`models: ${stats.models.join(", ") || "\u2014"}`);
249
+ console.log(`prefix hashes: ${stats.prefixHashes.length} distinct`);
250
+ if (stats.prefixHashes.length === 1) {
251
+ console.log(` (byte-stable prefix: ${stats.prefixHashes[0]?.slice(0, 16)}\u2026)`);
252
+ } else if (stats.prefixHashes.length > 1) {
253
+ console.log(" (prefix churned \u2014 cache-hostile session)");
254
+ }
255
+ }
256
+ function sliceRecords(records, opts) {
257
+ if (opts.head !== void 0 && opts.head > 0) return records.slice(0, opts.head);
258
+ if (opts.tail !== void 0 && opts.tail > 0) return records.slice(-opts.tail);
259
+ return records;
260
+ }
261
+ function renderRecord(rec) {
262
+ const turn = `[t${rec.turn}]`;
263
+ if (rec.role === "user") {
264
+ console.log(`${turn} USER: ${oneLine(rec.content)}`);
265
+ } else if (rec.role === "assistant_final") {
266
+ const cost = rec.cost !== void 0 ? ` $${rec.cost.toFixed(6)}` : "";
267
+ const cache = rec.usage && (rec.usage.prompt_cache_hit_tokens !== void 0 || rec.usage.prompt_cache_miss_tokens !== void 0) ? (() => {
268
+ const hit = rec.usage.prompt_cache_hit_tokens ?? 0;
269
+ const miss = rec.usage.prompt_cache_miss_tokens ?? 0;
270
+ const total = hit + miss;
271
+ return total > 0 ? ` cache=${(hit / total * 100).toFixed(1)}%` : "";
272
+ })() : "";
273
+ console.log(`${turn} AGENT:${cost}${cache} ${oneLine(rec.content)}`);
274
+ } else if (rec.role === "tool") {
275
+ const args = rec.args ? ` args=${oneLine(rec.args, 80)}` : "";
276
+ console.log(`${turn} TOOL ${rec.tool ?? "?"}:${args} \u2192 ${oneLine(rec.content, 120)}`);
277
+ } else if (rec.role === "error") {
278
+ console.log(`${turn} ERROR: ${rec.error ?? rec.content}`);
279
+ } else if (rec.role === "done") {
280
+ } else {
281
+ console.log(`${turn} ${rec.role}: ${oneLine(rec.content)}`);
282
+ }
283
+ }
284
+ function oneLine(s, max = 200) {
285
+ const collapsed = s.replace(/\s+/g, " ").trim();
286
+ return collapsed.length > max ? `${collapsed.slice(0, max)}\u2026` : collapsed;
287
+ }
288
+ export {
289
+ replayCommand
290
+ };
291
+ //# sourceMappingURL=replay-HYOSRQIV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/commands/replay.ts","../../src/cli/ui/ReplayApp.tsx","../../src/cli/ui/StatsPanel.tsx"],"sourcesContent":["import { render } from \"ink\";\nimport React from \"react\";\nimport type { TranscriptRecord } from \"../../transcript/log.js\";\nimport { groupRecordsByTurn, replayFromFile } from \"../../transcript/replay.js\";\nimport { ReplayApp } from \"../ui/ReplayApp.js\";\n\nexport interface ReplayOptions {\n path: string;\n head?: number;\n tail?: number;\n /** Force stdout pretty-print mode (no Ink TUI). Also auto-enabled when stdout is not a TTY. */\n print?: boolean;\n}\n\nexport async function replayCommand(opts: ReplayOptions): Promise<void> {\n const wantPrint =\n opts.print || !process.stdout.isTTY || opts.head !== undefined || opts.tail !== undefined;\n if (wantPrint) {\n printReplay(opts);\n return;\n }\n\n const { parsed } = replayFromFile(opts.path);\n const pages = groupRecordsByTurn(parsed.records);\n const { waitUntilExit } = render(React.createElement(ReplayApp, { meta: parsed.meta, pages }), {\n exitOnCtrlC: true,\n patchConsole: false,\n });\n await waitUntilExit();\n}\n\n// stdout pretty-print path (original behavior, preserved for piping / CI)\n\nfunction printReplay(opts: ReplayOptions): void {\n const { parsed, stats } = replayFromFile(opts.path);\n\n if (parsed.meta) {\n const m = parsed.meta;\n const bits: string[] = [`source=${m.source}`];\n if (m.model) bits.push(`model=${m.model}`);\n if (m.task) bits.push(`task=${m.task}`);\n if (m.mode) bits.push(`mode=${m.mode}`);\n if (m.repeat !== undefined) bits.push(`repeat=${m.repeat}`);\n bits.push(`started=${m.startedAt}`);\n console.log(`[meta] ${bits.join(\" \")}`);\n console.log(\"\");\n }\n\n const records = sliceRecords(parsed.records, opts);\n for (const rec of records) {\n renderRecord(rec);\n }\n\n console.log(\"\");\n console.log(\"── summary ─────────────────────────────────────────\");\n console.log(`model calls: ${stats.turns}`);\n console.log(`user turns: ${stats.userTurns}`);\n console.log(`tool calls: ${stats.toolCalls}`);\n console.log(`cache hit: ${(stats.cacheHitRatio * 100).toFixed(1)}%`);\n console.log(`cost: $${stats.totalCostUsd.toFixed(6)}`);\n console.log(`claude equivalent: $${stats.claudeEquivalentUsd.toFixed(6)}`);\n console.log(`savings vs claude: ${stats.savingsVsClaudePct.toFixed(1)}%`);\n console.log(`models: ${stats.models.join(\", \") || \"—\"}`);\n console.log(`prefix hashes: ${stats.prefixHashes.length} distinct`);\n if (stats.prefixHashes.length === 1) {\n console.log(` (byte-stable prefix: ${stats.prefixHashes[0]?.slice(0, 16)}…)`);\n } else if (stats.prefixHashes.length > 1) {\n console.log(\" (prefix churned — cache-hostile session)\");\n }\n}\n\nfunction sliceRecords(records: TranscriptRecord[], opts: ReplayOptions): TranscriptRecord[] {\n if (opts.head !== undefined && opts.head > 0) return records.slice(0, opts.head);\n if (opts.tail !== undefined && opts.tail > 0) return records.slice(-opts.tail);\n return records;\n}\n\nfunction renderRecord(rec: TranscriptRecord): void {\n const turn = `[t${rec.turn}]`;\n if (rec.role === \"user\") {\n console.log(`${turn} USER: ${oneLine(rec.content)}`);\n } else if (rec.role === \"assistant_final\") {\n const cost = rec.cost !== undefined ? ` $${rec.cost.toFixed(6)}` : \"\";\n const cache =\n rec.usage &&\n (rec.usage.prompt_cache_hit_tokens !== undefined ||\n rec.usage.prompt_cache_miss_tokens !== undefined)\n ? (() => {\n const hit = rec.usage!.prompt_cache_hit_tokens ?? 0;\n const miss = rec.usage!.prompt_cache_miss_tokens ?? 0;\n const total = hit + miss;\n return total > 0 ? ` cache=${((hit / total) * 100).toFixed(1)}%` : \"\";\n })()\n : \"\";\n console.log(`${turn} AGENT:${cost}${cache} ${oneLine(rec.content)}`);\n } else if (rec.role === \"tool\") {\n const args = rec.args ? ` args=${oneLine(rec.args, 80)}` : \"\";\n console.log(`${turn} TOOL ${rec.tool ?? \"?\"}:${args} → ${oneLine(rec.content, 120)}`);\n } else if (rec.role === \"error\") {\n console.log(`${turn} ERROR: ${rec.error ?? rec.content}`);\n } else if (rec.role === \"done\") {\n // Suppress — visually noisy, not informative in replay.\n } else {\n console.log(`${turn} ${rec.role}: ${oneLine(rec.content)}`);\n }\n}\n\nfunction oneLine(s: string, max = 200): string {\n const collapsed = s.replace(/\\s+/g, \" \").trim();\n return collapsed.length > max ? `${collapsed.slice(0, max)}…` : collapsed;\n}\n","/**\n * Ink TUI for `carboncode replay`. Read-only: no input box, no loop.\n * j/k navigation across turn-pages, cumulative stats sidebar updates\n * as you move through time.\n *\n * The navigation logic (grouping records into pages, computing cumulative\n * stats) lives in src/replay.ts as pure functions; this file is just\n * presentation + key bindings.\n */\n\nimport { Box, Static, Text, useApp, useInput } from \"ink\";\nimport React, { useMemo, useState } from \"react\";\nimport { t } from \"../../i18n/index.js\";\nimport type { TranscriptMeta } from \"../../transcript/log.js\";\nimport { type TurnPage, computeCumulativeStats } from \"../../transcript/replay.js\";\nimport { RecordView } from \"./RecordView.js\";\nimport { StatsPanel } from \"./StatsPanel.js\";\n\nexport interface ReplayAppProps {\n meta: TranscriptMeta | null;\n pages: TurnPage[];\n}\n\nexport function ReplayApp({ meta, pages }: ReplayAppProps) {\n const { exit } = useApp();\n const maxIdx = Math.max(0, pages.length - 1);\n // Start at the last page — more useful than \"start from the beginning\"\n // in practice: users mostly want to see the summary + last turn first.\n const [idx, setIdx] = useState(maxIdx);\n\n useInput((input, key) => {\n if (input === \"q\" || (key.ctrl && input === \"c\")) {\n exit();\n return;\n }\n if (input === \"j\" || key.downArrow || input === \" \" || key.return) {\n setIdx((i) => Math.min(maxIdx, i + 1));\n } else if (input === \"k\" || key.upArrow) {\n setIdx((i) => Math.max(0, i - 1));\n } else if (input === \"g\") {\n setIdx(0);\n } else if (input === \"G\") {\n setIdx(maxIdx);\n } else if (input === \"h\" || key.leftArrow) {\n setIdx(0);\n } else if (input === \"l\" || key.rightArrow) {\n setIdx(maxIdx);\n }\n });\n\n const cumStats = useMemo(() => computeCumulativeStats(pages, idx), [pages, idx]);\n\n const summary = {\n turns: cumStats.turns,\n totalCostUsd: cumStats.totalCostUsd,\n totalInputCostUsd: cumStats.totalInputCostUsd,\n totalOutputCostUsd: cumStats.totalOutputCostUsd,\n claudeEquivalentUsd: cumStats.claudeEquivalentUsd,\n savingsVsClaudePct: cumStats.savingsVsClaudePct,\n cacheHitRatio: cumStats.cacheHitRatio,\n // Replay is read-only — no live last-turn prompt tokens to show.\n lastPromptTokens: 0,\n lastTurnCostUsd: 0,\n };\n\n const prefixHash =\n cumStats.prefixHashes.length === 1\n ? cumStats.prefixHashes[0]!.slice(0, 16)\n : cumStats.prefixHashes.length === 0\n ? t(\"replayApp.untracked\")\n : t(\"replayApp.churned\", { count: cumStats.prefixHashes.length });\n\n const currentPage = pages[idx];\n const progressLabel =\n pages.length === 0\n ? t(\"replayApp.emptyTranscript\")\n : t(\"replayApp.turnProgress\", { current: idx + 1, total: pages.length });\n\n return (\n <Box flexDirection=\"column\">\n <StatsPanel summary={summary} />\n\n <Box flexDirection=\"column\" marginTop={1} paddingX={1}>\n <Box justifyContent=\"space-between\">\n <Text color=\"cyan\" bold>\n {progressLabel}\n </Text>\n {meta ? (\n <Text dimColor>\n {meta.source}\n {meta.task ? ` · ${meta.task}` : \"\"}\n {meta.mode ? ` · ${meta.mode}` : \"\"}\n </Text>\n ) : null}\n </Box>\n\n {currentPage ? (\n <Static items={currentPage.records.map((rec, i) => ({ key: `${idx}-${i}`, rec }))}>\n {({ key, rec }) => <RecordView key={key} rec={rec} />}\n </Static>\n ) : (\n <Text dimColor italic>\n {t(\"replayApp.noRecords\")}\n </Text>\n )}\n </Box>\n\n <Box marginTop={1} paddingX={1} borderStyle=\"single\" borderColor=\"gray\">\n <Text dimColor>\n <Text bold>j</Text>/<Text bold>↓</Text>/<Text bold>space</Text> next · <Text bold>k</Text>\n /<Text bold>↑</Text> prev · <Text bold>g</Text> first · <Text bold>G</Text> last ·{\" \"}\n <Text bold>q</Text> quit\n </Text>\n </Box>\n </Box>\n );\n}\n","import { basename } from \"node:path\";\nimport { Box, Text, useStdout } from \"ink\";\nimport React from \"react\";\nimport stringWidth from \"string-width\";\nimport type { EditMode } from \"../../config.js\";\nimport { t } from \"../../i18n/index.js\";\nimport type { SessionSummary } from \"../../telemetry/stats.js\";\nimport { Bar, ChromeRule } from \"./primitives.js\";\nimport { COLOR, GRADIENT } from \"./theme.js\";\nimport { formatBalance, formatCost } from \"./theme/tokens.js\";\n\nconst COLD_START_TURNS = 3;\n\nexport interface StatsPanelProps {\n summary: SessionSummary;\n planMode?: boolean;\n editMode?: EditMode;\n balance?: { currency: string; total: number } | null;\n updateAvailable?: string | null;\n proArmed?: boolean;\n escalated?: boolean;\n budgetUsd?: number | null;\n rootDir?: string;\n sessionName?: string | null;\n}\n\nexport function StatsPanel({\n summary,\n planMode,\n editMode,\n balance,\n updateAvailable,\n proArmed,\n escalated,\n budgetUsd,\n rootDir,\n sessionName,\n}: StatsPanelProps) {\n const coldStart = summary.turns <= COLD_START_TURNS;\n return (\n <Box flexDirection=\"column\" paddingX={1}>\n <ChromeRow\n editMode={editMode}\n planMode={planMode}\n proArmed={proArmed ?? false}\n escalated={escalated ?? false}\n summary={summary}\n coldStart={coldStart}\n rootDir={rootDir}\n sessionName={sessionName ?? null}\n updateAvailable={updateAvailable}\n balance={balance ?? null}\n />\n <ChromeRule />\n {budgetUsd !== null && budgetUsd !== undefined ? (\n <BudgetRow spent={summary.totalCostUsd} cap={budgetUsd} />\n ) : null}\n </Box>\n );\n}\n\nfunction ChromeRow({\n editMode,\n planMode,\n proArmed,\n escalated,\n summary,\n coldStart,\n rootDir,\n sessionName,\n updateAvailable,\n balance,\n}: {\n editMode?: EditMode;\n planMode?: boolean;\n proArmed: boolean;\n escalated: boolean;\n summary: SessionSummary;\n coldStart: boolean;\n rootDir?: string;\n sessionName?: string | null;\n updateAvailable?: string | null;\n balance?: { currency: string; total: number } | null;\n}) {\n const modePill = pickModePill(planMode, editMode);\n const proLabel = t(\"statsPanel.pro\");\n const proPill = escalated\n ? { label: proLabel, color: COLOR.err }\n : proArmed\n ? { label: proLabel, color: COLOR.warn }\n : null;\n const projectName = rootDir ? basename(rootDir) : null;\n const cachePct = (summary.cacheHitRatio * 100).toFixed(1);\n const cacheColor =\n summary.cacheHitRatio >= 0.7 ? COLOR.ok : summary.cacheHitRatio >= 0.4 ? COLOR.warn : COLOR.err;\n const balanceLabel = balance\n ? `[${formatBalance(balance.total, balance.currency, { label: true })}]`\n : \"\";\n const costLabel = `[${formatCost(summary.totalCostUsd, balance?.currency)}]`;\n const cacheLabel = \"[c ▰▰▰▰▰▰ 100%]\";\n const updateLabel = updateAvailable ? `↑ ${updateAvailable}` : \"\";\n\n // Greedy width-aware fit. Layout (every gap = 2 cells, applied as suffix\n // to update/mode/pro and as prefix to balance/cache):\n // [brand][·project][›session]<spacer>[update][mode][pro][cost][balance][cache]\n // Always shown: brand, project (if rootDir), mode (if set), pro (if armed),\n // cost. These carve fixedLeft / fixedRight first.\n // Optional, dropped greedy by priority: balance > cache > session > update.\n // The flexbox spacer can shrink to 0, so no minimum reserve.\n const { stdout } = useStdout();\n const cols = (stdout?.columns ?? 80) - 2; // subtract paddingX={1} on both sides\n const SEP_DOT = stringWidth(\" · \");\n const SEP_ARROW = stringWidth(\" › \");\n const GAP = 2;\n\n const fixedLeft =\n stringWidth(\"◈ carboncode\") + (projectName ? SEP_DOT + stringWidth(projectName) : 0);\n const modeW = modePill ? GAP + stringWidth(`[${modePill.label}]`) : 0;\n const proW = proPill ? GAP + stringWidth(`[${proPill.label}]`) : 0;\n const fixedRight = modeW + proW + stringWidth(costLabel);\n let budget = cols - fixedLeft - fixedRight;\n\n const balW = balance ? GAP + stringWidth(balanceLabel) : 0;\n const cacheW = GAP + stringWidth(cacheLabel);\n const sessionW = sessionName ? SEP_ARROW + stringWidth(sessionName) : 0;\n const updateW = updateLabel ? GAP + stringWidth(updateLabel) : 0;\n\n const showBalance = balW > 0 && budget >= balW;\n if (showBalance) budget -= balW;\n const showCache = budget >= cacheW;\n if (showCache) budget -= cacheW;\n const showSession = sessionW > 0 && budget >= sessionW;\n if (showSession) budget -= sessionW;\n const showUpdate = updateW > 0 && budget >= updateW;\n if (showUpdate) budget -= updateW;\n\n return (\n <Box>\n <Text bold color={GRADIENT[0]}>\n {\"◈ \"}\n </Text>\n <Text color={COLOR.brand} bold>\n carboncode\n </Text>\n {projectName ? (\n <>\n <Text color={COLOR.info} dimColor>\n {\" · \"}\n </Text>\n <Text>{projectName}</Text>\n {showSession && sessionName ? (\n <>\n <Text color={COLOR.info} dimColor>\n {\" › \"}\n </Text>\n <Text color={COLOR.info}>{sessionName}</Text>\n </>\n ) : null}\n </>\n ) : null}\n\n <Box flexGrow={1} />\n\n {showUpdate ? (\n <>\n <Text color={COLOR.warn} bold>\n {updateLabel}\n </Text>\n <Text>{\" \"}</Text>\n </>\n ) : null}\n {modePill ? (\n <>\n <Text color={modePill.color} bold>\n {`[${modePill.label}]`}\n </Text>\n <Text>{\" \"}</Text>\n </>\n ) : null}\n {proPill ? (\n <>\n <Text color={proPill.color} bold>\n {`[${proPill.label}]`}\n </Text>\n <Text>{\" \"}</Text>\n </>\n ) : null}\n <Text\n color={\n summary.turns === 0 || coldStart ? COLOR.info : sessionCostColor(summary.totalCostUsd)\n }\n bold={summary.turns > 0 && !coldStart}\n dimColor={summary.turns === 0 || coldStart}\n >\n {costLabel}\n </Text>\n {showBalance && balance ? (\n <>\n <Text>{\" \"}</Text>\n <Text color={balance.total < 1 ? COLOR.err : balance.total < 5 ? COLOR.warn : COLOR.ok}>\n {balanceLabel}\n </Text>\n </>\n ) : null}\n {showCache ? (\n <>\n <Text>{\" \"}</Text>\n <Text dimColor>{\"[\"}</Text>\n <Text dimColor>{\"c \"}</Text>\n <Bar\n ratio={summary.cacheHitRatio}\n color={coldStart ? COLOR.info : cacheColor}\n cells={6}\n dim={coldStart}\n />\n <Text> </Text>\n <Text color={coldStart ? undefined : cacheColor} dimColor={coldStart}>\n {coldStart && summary.turns === 0 ? \"—\" : `${cachePct}%`}\n </Text>\n <Text dimColor>{\"]\"}</Text>\n </>\n ) : null}\n </Box>\n );\n}\n\nfunction pickModePill(\n planMode: boolean | undefined,\n editMode: EditMode | undefined,\n): { label: string; color: string } | null {\n if (planMode) return { label: t(\"statsPanel.modePlan\"), color: COLOR.err };\n if (editMode === \"yolo\") return { label: t(\"statsPanel.modeYolo\"), color: COLOR.err };\n if (editMode === \"auto\") return { label: t(\"statsPanel.modeAuto\"), color: COLOR.primary };\n if (editMode === \"review\") return { label: t(\"statsPanel.modeReview\"), color: COLOR.info };\n return null;\n}\n\nfunction BudgetRow({ spent, cap }: { spent: number; cap: number }) {\n const pct = Math.max(0, (spent / cap) * 100);\n const color = pct >= 100 ? \"#f87171\" : pct >= 80 ? \"#fbbf24\" : \"#94a3b8\";\n return (\n <Box>\n <Text dimColor>{t(\"statsPanel.budget\")}</Text>\n <Text color={color}>\n {`$${spent.toFixed(4)} / $${cap.toFixed(2)}`}\n <Text dimColor>{` (${pct.toFixed(0)}%)`}</Text>\n </Text>\n </Box>\n );\n}\n\nfunction sessionCostColor(cost: number): string | undefined {\n if (cost <= 0) return undefined;\n if (cost >= 5) return COLOR.err;\n if (cost >= 0.5) return COLOR.warn;\n return COLOR.ok;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,gBAAkB;;;ACUlB,IAAAC,gBAAyC;;;ACXzC,SAAS,gBAAgB;AAEzB,mBAAkB;AASlB,IAAM,mBAAmB;AAelB,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAoB;AAClB,QAAM,YAAY,QAAQ,SAAS;AACnC,SACE,6BAAAC,QAAA,cAAC,eAAI,eAAc,UAAS,UAAU,KACpC,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,UAAU,YAAY;AAAA,MACtB,WAAW,aAAa;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,eAAe;AAAA,MAC5B;AAAA,MACA,SAAS,WAAW;AAAA;AAAA,EACtB,GACA,6BAAAA,QAAA,cAAC,gBAAW,GACX,cAAc,QAAQ,cAAc,SACnC,6BAAAA,QAAA,cAAC,aAAU,OAAO,QAAQ,cAAc,KAAK,WAAW,IACtD,IACN;AAEJ;AAEA,SAAS,UAAU;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAWG;AACD,QAAM,WAAW,aAAa,UAAU,QAAQ;AAChD,QAAM,WAAW,EAAE,gBAAgB;AACnC,QAAM,UAAU,Y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