dskcode 0.1.36 → 0.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -805,9 +805,9 @@ var LOGO_LINES = [
805
805
  ];
806
806
 
807
807
  // src/ui/ChatSession.tsx
808
- import { Box as Box10, Text as Text11, useInput, Static } from "ink";
808
+ import { Box as Box11, Text as Text12, useInput, Static } from "ink";
809
809
  import TextInput from "ink-text-input";
810
- import { useEffect as useEffect4, useState as useState4, useCallback as useCallback2, useMemo, useRef as useRef3 } from "react";
810
+ import { useEffect as useEffect5, useState as useState5, useCallback as useCallback2, useMemo, useRef as useRef4 } from "react";
811
811
 
812
812
  // src/ui/useDoubleCtrlC.ts
813
813
  import { useState as useState2, useCallback, useEffect as useEffect2, useRef } from "react";
@@ -1192,89 +1192,6 @@ function ToolCallBlock({ call }) {
1192
1192
  ] });
1193
1193
  }
1194
1194
 
1195
- // src/agent/message-builder.ts
1196
- function estimateMessageTokens(msg) {
1197
- let text = msg.content;
1198
- if (msg.toolCalls) {
1199
- for (const tc of msg.toolCalls) {
1200
- text += tc.name + tc.arguments;
1201
- }
1202
- }
1203
- return estimateTokens(text) + 10;
1204
- }
1205
- function groupIntoTurns(messages) {
1206
- const turns = [];
1207
- let current = null;
1208
- for (const msg of messages) {
1209
- if (msg.role === "user") {
1210
- if (current) turns.push(current);
1211
- current = [msg];
1212
- } else {
1213
- if (!current) current = [];
1214
- current.push(msg);
1215
- }
1216
- }
1217
- if (current && current.length > 0) turns.push(current);
1218
- return turns;
1219
- }
1220
- function estimateTurnTokens(turn) {
1221
- let sum = 0;
1222
- for (const msg of turn) sum += estimateMessageTokens(msg);
1223
- return sum;
1224
- }
1225
- function trimMessages(messages, opts) {
1226
- const meta = getModelMeta(opts.model);
1227
- const maxInputTokens = meta.contextWindow - opts.reservedForOutput;
1228
- const systemTokens = estimateTokens(opts.systemPrompt);
1229
- let remaining = maxInputTokens - systemTokens;
1230
- const turns = groupIntoTurns(messages);
1231
- const preservedTurns = [];
1232
- let roundsPreserved = 0;
1233
- for (let i = turns.length - 1; i >= 0 && roundsPreserved < opts.preserveRecentRounds; i--) {
1234
- preservedTurns.unshift(turns[i]);
1235
- roundsPreserved++;
1236
- }
1237
- const preserved = preservedTurns.flat();
1238
- for (const msg of preserved) {
1239
- remaining -= estimateMessageTokens(msg);
1240
- }
1241
- if (remaining < 0) {
1242
- while (preservedTurns.length > 1 && remaining < 0) {
1243
- const dropped = preservedTurns.shift();
1244
- remaining += estimateTurnTokens(dropped);
1245
- }
1246
- return [preservedTurns.flat(), true];
1247
- }
1248
- const olderTurns = turns.slice(0, turns.length - preservedTurns.length);
1249
- const keptTurns = [];
1250
- for (let i = olderTurns.length - 1; i >= 0; i--) {
1251
- const cost = estimateTurnTokens(olderTurns[i]);
1252
- if (remaining - cost < 0) break;
1253
- remaining -= cost;
1254
- keptTurns.unshift(olderTurns[i]);
1255
- }
1256
- const result = [...keptTurns, ...preservedTurns].flat();
1257
- const trimmed = result.length < messages.length;
1258
- return [result, trimmed];
1259
- }
1260
- function buildApiMessages(systemPrompt, history) {
1261
- return [
1262
- { role: "system", content: systemPrompt },
1263
- ...history
1264
- ];
1265
- }
1266
- function formatUsageSummary(usage) {
1267
- const prompt = usage.promptTokens.toLocaleString();
1268
- const completion = usage.completionTokens.toLocaleString();
1269
- const total = (usage.promptTokens + usage.completionTokens).toLocaleString();
1270
- let summary = `\u{1F4E5} ${prompt} + \u{1F4E4} ${completion} = \u{1F4E6} ${total} tokens`;
1271
- if (usage.cachedPromptTokens && usage.cachedPromptTokens > 0) {
1272
- const cacheRate = (usage.cachedPromptTokens / usage.promptTokens * 100).toFixed(1);
1273
- summary += ` \u2502 \u{1F5C4}\uFE0F \u7F13\u5B58\u547D\u4E2D ${cacheRate}%`;
1274
- }
1275
- return summary;
1276
- }
1277
-
1278
1195
  // src/ui/HighlightedText.tsx
1279
1196
  import { Box as Box4, Text as Text5 } from "ink";
1280
1197
 
@@ -1801,23 +1718,6 @@ function HighlightedText({ children: text }) {
1801
1718
  return /* @__PURE__ */ jsx4(Box4, { flexDirection: "column", children: rendered });
1802
1719
  }
1803
1720
 
1804
- // src/ui/reasoning-utils.ts
1805
- var DEFAULT_REASONING_MAX_LINES = 8;
1806
- function joinReasoningSegments(segments) {
1807
- return segments.map((s) => s.trim()).filter((s) => s.length > 0).join("\n");
1808
- }
1809
- function truncateReasoningLines(text, maxLines) {
1810
- const lines = text.split("\n");
1811
- if (lines.length <= maxLines) {
1812
- return { visible: text, hiddenLines: 0, totalLines: lines.length };
1813
- }
1814
- return {
1815
- visible: lines.slice(-maxLines).join("\n"),
1816
- hiddenLines: lines.length - maxLines,
1817
- totalLines: lines.length
1818
- };
1819
- }
1820
-
1821
1721
  // src/ui/AssistantMessage.tsx
1822
1722
  import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1823
1723
  function formatElapsed(ms) {
@@ -1902,7 +1802,6 @@ function AnimatedUsage({ usage, cost }) {
1902
1802
  }
1903
1803
  function AssistantMessage({
1904
1804
  content,
1905
- reasoning,
1906
1805
  toolCalls,
1907
1806
  isStreaming = false,
1908
1807
  usage,
@@ -1910,57 +1809,41 @@ function AssistantMessage({
1910
1809
  cost,
1911
1810
  model: _model
1912
1811
  }) {
1913
- if (!content && (!toolCalls || toolCalls.length === 0) && (!reasoning || reasoning.length === 0) && !isStreaming) {
1812
+ if (!content && (!toolCalls || toolCalls.length === 0) && !isStreaming) {
1914
1813
  return null;
1915
1814
  }
1916
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginTop: 1, children: [
1917
- reasoning && reasoning.length > 0 && (() => {
1918
- const merged = joinReasoningSegments(reasoning);
1919
- if (!merged) return null;
1920
- const { visible } = truncateReasoningLines(
1921
- merged,
1922
- DEFAULT_REASONING_MAX_LINES
1923
- );
1924
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", marginBottom: 1, children: [
1925
- /* @__PURE__ */ jsx5(Box5, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx5(Text6, { dimColor: true, children: "\u{1F9E0}" }) }),
1926
- /* @__PURE__ */ jsx5(
1927
- Box5,
1928
- {
1929
- flexGrow: 1,
1930
- flexDirection: "column",
1931
- borderStyle: "single",
1932
- borderColor: "#444444",
1933
- paddingLeft: 1,
1934
- paddingRight: 1,
1935
- children: /* @__PURE__ */ jsx5(Text6, { dimColor: true, wrap: "wrap", children: visible })
1936
- }
1937
- )
1938
- ] });
1939
- })(),
1940
- /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", children: [
1941
- /* @__PURE__ */ jsx5(Box5, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx5(Text6, { bold: true, color: "#ff00ff", children: "\u{1F916}" }) }),
1942
- /* @__PURE__ */ jsxs5(Box5, { flexGrow: 1, flexDirection: "column", children: [
1943
- content && /* @__PURE__ */ jsx5(HighlightedText, { children: content }),
1944
- isStreaming && !content && (!reasoning || reasoning.length === 0) && /* @__PURE__ */ jsx5(Text6, { color: "#888888", children: "..." })
1945
- ] })
1946
- ] }),
1947
- toolCalls && toolCalls.length > 0 && /* @__PURE__ */ jsx5(Box5, { flexDirection: "column", children: toolCalls.map((tc, i) => /* @__PURE__ */ jsx5(ToolCallBlock, { call: tc }, tc.id ?? i)) }),
1948
- isStreaming && (usage || cost !== void 0) && /* @__PURE__ */ jsx5(Box5, { flexDirection: "row", marginTop: 1, marginLeft: 3, children: /* @__PURE__ */ jsxs5(Text6, { color: "#666666", dimColor: true, children: [
1949
- "\u23F3 \u5DF2\u6D88\u8017 ",
1950
- /* @__PURE__ */ jsx5(AnimatedUsage, { usage, cost })
1951
- ] }) }),
1952
- !isStreaming && (usage || elapsed !== void 0) && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginTop: 1, marginLeft: 3, children: [
1953
- /* @__PURE__ */ jsx5(Text6, { color: "#555555", children: "\u2500".repeat(36) }),
1954
- /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 2, children: [
1955
- cost !== void 0 && cost > 0 && /* @__PURE__ */ jsxs5(Text6, { color: "yellow", children: [
1956
- "\u{1F4B0} \u672C\u6B21 ",
1957
- formatMoney(cost)
1958
- ] }),
1959
- elapsed !== void 0 && /* @__PURE__ */ jsxs5(Text6, { color: "cyan", children: [
1960
- "\u{1F550} ",
1961
- formatElapsed(elapsed)
1962
- ] }),
1963
- usage && /* @__PURE__ */ jsx5(Text6, { color: "#888888", children: formatUsageSummary(usage) })
1815
+ return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", marginTop: 1, children: [
1816
+ /* @__PURE__ */ jsx5(Box5, { width: 1, backgroundColor: "#E040FB", flexShrink: 0 }),
1817
+ /* @__PURE__ */ jsxs5(Box5, { flexGrow: 1, paddingLeft: 1, flexDirection: "column", children: [
1818
+ /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", children: [
1819
+ /* @__PURE__ */ jsx5(Box5, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx5(Text6, { bold: true, color: "#ff00ff", children: "\u{1F916}" }) }),
1820
+ /* @__PURE__ */ jsxs5(Box5, { flexGrow: 1, flexDirection: "column", children: [
1821
+ content && /* @__PURE__ */ jsx5(HighlightedText, { children: content }),
1822
+ isStreaming && !content && /* @__PURE__ */ jsx5(Text6, { color: "#888888", children: "..." })
1823
+ ] })
1824
+ ] }),
1825
+ toolCalls && toolCalls.length > 0 && /* @__PURE__ */ jsx5(Box5, { flexDirection: "column", children: toolCalls.map((tc, i) => /* @__PURE__ */ jsx5(ToolCallBlock, { call: tc }, tc.id ?? i)) }),
1826
+ isStreaming && (usage || cost !== void 0) && /* @__PURE__ */ jsx5(Box5, { flexDirection: "row", marginTop: 1, marginLeft: 3, children: /* @__PURE__ */ jsxs5(Text6, { color: "#666666", dimColor: true, children: [
1827
+ "\u23F3 \u5DF2\u6D88\u8017 ",
1828
+ /* @__PURE__ */ jsx5(AnimatedUsage, { usage, cost })
1829
+ ] }) }),
1830
+ !isStreaming && (usage || elapsed !== void 0) && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginTop: 1, marginLeft: 3, children: [
1831
+ /* @__PURE__ */ jsx5(Text6, { color: "#555555", children: "\u2500".repeat(36) }),
1832
+ /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 2, children: [
1833
+ cost !== void 0 && cost > 0 && /* @__PURE__ */ jsxs5(Text6, { color: "yellow", children: [
1834
+ "\u{1F4B0} \u672C\u6B21 ",
1835
+ formatMoney(cost)
1836
+ ] }),
1837
+ elapsed !== void 0 && /* @__PURE__ */ jsxs5(Text6, { color: "cyan", children: [
1838
+ "\u{1F550} ",
1839
+ formatElapsed(elapsed)
1840
+ ] }),
1841
+ usage && /* @__PURE__ */ jsxs5(Text6, { color: "#888888", children: [
1842
+ "\u{1F4E6} ",
1843
+ (usage.promptTokens + usage.completionTokens).toLocaleString(),
1844
+ " tokens"
1845
+ ] })
1846
+ ] })
1964
1847
  ] })
1965
1848
  ] })
1966
1849
  ] });
@@ -2101,7 +1984,7 @@ function TodoListPanel({ items }) {
2101
1984
  // package.json
2102
1985
  var package_default = {
2103
1986
  name: "dskcode",
2104
- version: "0.1.36",
1987
+ version: "0.1.38",
2105
1988
  repository: {
2106
1989
  type: "git",
2107
1990
  url: "git+https://github.com/Awu12277/deepseek-agent-cli/tree/main"
@@ -2312,6 +2195,78 @@ function buildPlanSystemPrompt(opts) {
2312
2195
  return compiledPlanTemplate(buildTemplateVars(opts));
2313
2196
  }
2314
2197
 
2198
+ // src/agent/message-builder.ts
2199
+ function estimateMessageTokens(msg) {
2200
+ let text = msg.content;
2201
+ if (msg.toolCalls) {
2202
+ for (const tc of msg.toolCalls) {
2203
+ text += tc.name + tc.arguments;
2204
+ }
2205
+ }
2206
+ return estimateTokens(text) + 10;
2207
+ }
2208
+ function groupIntoTurns(messages) {
2209
+ const turns = [];
2210
+ let current = null;
2211
+ for (const msg of messages) {
2212
+ if (msg.role === "user") {
2213
+ if (current) turns.push(current);
2214
+ current = [msg];
2215
+ } else {
2216
+ if (!current) current = [];
2217
+ current.push(msg);
2218
+ }
2219
+ }
2220
+ if (current && current.length > 0) turns.push(current);
2221
+ return turns;
2222
+ }
2223
+ function estimateTurnTokens(turn) {
2224
+ let sum = 0;
2225
+ for (const msg of turn) sum += estimateMessageTokens(msg);
2226
+ return sum;
2227
+ }
2228
+ function trimMessages(messages, opts) {
2229
+ const meta = getModelMeta(opts.model);
2230
+ const maxInputTokens = meta.contextWindow - opts.reservedForOutput;
2231
+ const systemTokens = estimateTokens(opts.systemPrompt);
2232
+ let remaining = maxInputTokens - systemTokens;
2233
+ const turns = groupIntoTurns(messages);
2234
+ const preservedTurns = [];
2235
+ let roundsPreserved = 0;
2236
+ for (let i = turns.length - 1; i >= 0 && roundsPreserved < opts.preserveRecentRounds; i--) {
2237
+ preservedTurns.unshift(turns[i]);
2238
+ roundsPreserved++;
2239
+ }
2240
+ const preserved = preservedTurns.flat();
2241
+ for (const msg of preserved) {
2242
+ remaining -= estimateMessageTokens(msg);
2243
+ }
2244
+ if (remaining < 0) {
2245
+ while (preservedTurns.length > 1 && remaining < 0) {
2246
+ const dropped = preservedTurns.shift();
2247
+ remaining += estimateTurnTokens(dropped);
2248
+ }
2249
+ return [preservedTurns.flat(), true];
2250
+ }
2251
+ const olderTurns = turns.slice(0, turns.length - preservedTurns.length);
2252
+ const keptTurns = [];
2253
+ for (let i = olderTurns.length - 1; i >= 0; i--) {
2254
+ const cost = estimateTurnTokens(olderTurns[i]);
2255
+ if (remaining - cost < 0) break;
2256
+ remaining -= cost;
2257
+ keptTurns.unshift(olderTurns[i]);
2258
+ }
2259
+ const result = [...keptTurns, ...preservedTurns].flat();
2260
+ const trimmed = result.length < messages.length;
2261
+ return [result, trimmed];
2262
+ }
2263
+ function buildApiMessages(systemPrompt, history) {
2264
+ return [
2265
+ { role: "system", content: systemPrompt },
2266
+ ...history
2267
+ ];
2268
+ }
2269
+
2315
2270
  // src/tool/registry.ts
2316
2271
  var ToolRegistry = class {
2317
2272
  #tools = /* @__PURE__ */ new Map();
@@ -5952,10 +5907,53 @@ function getGradientColors(text, phase, stops) {
5952
5907
  });
5953
5908
  }
5954
5909
 
5910
+ // src/ui/reasoning-utils.ts
5911
+ function joinReasoningSegments(segments) {
5912
+ return segments.map((s) => s.trim()).filter((s) => s.length > 0).join("\n");
5913
+ }
5914
+
5915
+ // src/ui/AnimatedLogo.tsx
5916
+ import { Box as Box10, Text as Text11 } from "ink";
5917
+ import { useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
5918
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
5919
+ var LOGO_LINES2 = [
5920
+ " \u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584 \u2584\u2584",
5921
+ " \u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584\u2584\u2580\u2588\u2588\u2588\u2580\u2580",
5922
+ "\u2580\u2588 \u2580\u2580\u2588\u2588\u2588\u2584 \u2588\u2588\u2588\u2588",
5923
+ " \u2580\u2588\u2584 \u2584 \u2580\u2588\u2588\u2588\u2588\u2588\u2580",
5924
+ " \u2580\u2580\u2580\u2588\u2588\u2588\u2588\u2588\u2584\u2580\u2580\u2580\u2580\u2580"
5925
+ ];
5926
+ var LOGO_WIDTH = 22;
5927
+ var MOVE_INTERVAL_MS = 120;
5928
+ var LOGO_COLOR = "#6185f6";
5929
+ function AnimatedLogo({ panelWidth }) {
5930
+ const posRef = useRef3(panelWidth);
5931
+ const [renderTick, setRenderTick] = useState4(0);
5932
+ useEffect4(() => {
5933
+ const timer = setInterval(() => {
5934
+ posRef.current -= 1;
5935
+ if (posRef.current <= -LOGO_WIDTH) {
5936
+ posRef.current = panelWidth;
5937
+ }
5938
+ setRenderTick((t) => t + 1);
5939
+ }, MOVE_INTERVAL_MS);
5940
+ return () => clearInterval(timer);
5941
+ }, [panelWidth]);
5942
+ const pos = posRef.current;
5943
+ if (pos >= panelWidth) return null;
5944
+ const leftClip = Math.max(0, -pos);
5945
+ const rightClip = Math.max(0, pos + LOGO_WIDTH - panelWidth);
5946
+ const padding = Math.max(0, pos);
5947
+ return /* @__PURE__ */ jsx10(Box10, { flexDirection: "column", alignItems: "flex-start", children: LOGO_LINES2.map((line, i) => /* @__PURE__ */ jsxs10(Text11, { color: LOGO_COLOR, bold: true, children: [
5948
+ " ".repeat(padding),
5949
+ line.slice(leftClip, LOGO_WIDTH - rightClip)
5950
+ ] }, i)) });
5951
+ }
5952
+
5955
5953
  // src/ui/ChatSession.tsx
5956
- import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
5954
+ import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
5957
5955
  var PHASE_CONFIG = {
5958
- thinking: { icon: "\u{1F9E0}", label: "\u6DF1\u5EA6\u601D\u8003\u4E2D", color: "#ff9800" },
5956
+ thinking: { icon: "\u{1F9E0}", label: "\u601D\u8003\u4E2D", color: "#ff9800" },
5959
5957
  generating: { icon: "\u2728", label: "\u751F\u6210\u4E2D", color: "#00ff41" },
5960
5958
  calling_tools: { icon: "\u{1F6E0}", label: "\u8C03\u7528\u5DE5\u5177", color: "#f59e0b" },
5961
5959
  executing_tools: { icon: "\u26A1", label: "\u6267\u884C\u5DE5\u5177", color: "#00ffff" }
@@ -6061,42 +6059,44 @@ function ChatSession({
6061
6059
  onLaunchStock
6062
6060
  }) {
6063
6061
  const termWidth = typeof process.stdout.columns === "number" ? process.stdout.columns : 80;
6064
- const dividerWidth = Math.max(termWidth - 2, 1);
6065
- const [offset, setOffset] = useState4(0);
6066
- const [displayMessages, setDisplayMessages] = useState4([]);
6067
- const [staticKey, setStaticKey] = useState4(0);
6068
- const [input, setInput] = useState4("");
6069
- const [balance, setBalance] = useState4(null);
6070
- const [balanceLoading, setBalanceLoading] = useState4(false);
6071
- const [todayCost, setTodayCost] = useState4(null);
6072
- const [isStreaming, setIsStreaming] = useState4(false);
6073
- const [streamingPhase, setStreamingPhase] = useState4(null);
6074
- const [streamingPlaceholder, setStreamingPlaceholder] = useState4("");
6075
- const [idlePlaceholder, setIdlePlaceholder] = useState4(
6062
+ const contentAreaWidth = termWidth - 2;
6063
+ const leftPanelWidth = Math.max(Math.floor(contentAreaWidth / 3), 30);
6064
+ const rightContentWidth = contentAreaWidth - leftPanelWidth - 1;
6065
+ const [offset, setOffset] = useState5(0);
6066
+ const [displayMessages, setDisplayMessages] = useState5([]);
6067
+ const [staticKey, setStaticKey] = useState5(0);
6068
+ const [input, setInput] = useState5("");
6069
+ const [balance, setBalance] = useState5(null);
6070
+ const [balanceLoading, setBalanceLoading] = useState5(false);
6071
+ const [todayCost, setTodayCost] = useState5(null);
6072
+ const [isStreaming, setIsStreaming] = useState5(false);
6073
+ const [streamingPhase, setStreamingPhase] = useState5(null);
6074
+ const [streamingPlaceholder, setStreamingPlaceholder] = useState5("");
6075
+ const [idlePlaceholder, setIdlePlaceholder] = useState5(
6076
6076
  () => pickRandom(IDLE_PLACEHOLDERS)
6077
6077
  );
6078
- const [gradientColors, setGradientColors] = useState4([]);
6079
- const gradientPhaseRef = useRef3(0);
6080
- const [streamingGradientColors, setStreamingGradientColors] = useState4([]);
6081
- const streamingPhaseRef = useRef3(0);
6082
- const [currentContent, setCurrentContent] = useState4("");
6083
- const [currentReasoning, setCurrentReasoning] = useState4([]);
6084
- const [currentToolCalls, setCurrentToolCalls] = useState4([]);
6085
- const [_currentUsage, setCurrentUsage] = useState4(void 0);
6086
- const [_currentElapsed, setCurrentElapsed] = useState4(void 0);
6087
- const [_currentCost, setCurrentCost] = useState4(void 0);
6088
- const [activeModel, setActiveModel] = useState4(model);
6089
- const [_streamingModel, setStreamingModel] = useState4(void 0);
6090
- const [streamError, setStreamError] = useState4(void 0);
6091
- const [todoSnapshot, setTodoSnapshot] = useState4([]);
6092
- const [todoPanelVisible, setTodoPanelVisible] = useState4(true);
6093
- const todoHideTimerRef = useRef3(null);
6094
- const lastDoneBatchMaxIdRef = useRef3(-1);
6095
- const [sessionMode, setSessionMode] = useState4("code");
6096
- const [thinkingEnabled, setThinkingEnabled] = useState4(true);
6097
- const [thinkingEffort, setThinkingEffort] = useState4("high");
6098
- const [responseFormat] = useState4("text");
6099
- const [toolChoice, setToolChoice] = useState4(
6078
+ const [gradientColors, setGradientColors] = useState5([]);
6079
+ const gradientPhaseRef = useRef4(0);
6080
+ const [streamingGradientColors, setStreamingGradientColors] = useState5([]);
6081
+ const streamingPhaseRef = useRef4(0);
6082
+ const [currentContent, setCurrentContent] = useState5("");
6083
+ const [currentReasoning, setCurrentReasoning] = useState5([]);
6084
+ const [currentToolCalls, setCurrentToolCalls] = useState5([]);
6085
+ const [_currentUsage, setCurrentUsage] = useState5(void 0);
6086
+ const [_currentElapsed, setCurrentElapsed] = useState5(void 0);
6087
+ const [_currentCost, setCurrentCost] = useState5(void 0);
6088
+ const [activeModel, setActiveModel] = useState5(model);
6089
+ const [_streamingModel, setStreamingModel] = useState5(void 0);
6090
+ const [streamError, setStreamError] = useState5(void 0);
6091
+ const [todoSnapshot, setTodoSnapshot] = useState5([]);
6092
+ const [todoPanelVisible, setTodoPanelVisible] = useState5(true);
6093
+ const todoHideTimerRef = useRef4(null);
6094
+ const lastDoneBatchMaxIdRef = useRef4(-1);
6095
+ const [sessionMode, setSessionMode] = useState5("code");
6096
+ const [thinkingEnabled, setThinkingEnabled] = useState5(true);
6097
+ const [thinkingEffort, setThinkingEffort] = useState5("high");
6098
+ const [responseFormat] = useState5("text");
6099
+ const [toolChoice, setToolChoice] = useState5(
6100
6100
  void 0
6101
6101
  );
6102
6102
  const sessionCost = useMemo(() => {
@@ -6108,40 +6108,41 @@ function ChatSession({
6108
6108
  }, 0);
6109
6109
  }, [displayMessages]);
6110
6110
  const hasConversationStarted = displayMessages.length > 0;
6111
+ const hasReasoningPanel = isStreaming && currentReasoning.length > 0;
6111
6112
  const cmdTips = Array.from(getRegisteredCommands()).filter(([name]) => name !== "/exit" && name !== "/quit").map(([name, cmd]) => ({ name, desc: cmd.desc }));
6112
- const [cmdTipIndex, setCmdTipIndex] = useState4(0);
6113
- const [cmdTipGradientColors, setCmdTipGradientColors] = useState4([]);
6114
- const cmdTipPhaseRef = useRef3(0);
6115
- const [skillSelectIndex, setSkillSelectIndex] = useState4(0);
6116
- const [fileSelectIndex, setFileSelectIndex] = useState4(0);
6117
- const [inputKey, setInputKey] = useState4(0);
6118
- const [rewindSelecting, setRewindSelecting] = useState4(false);
6119
- const [rewindSelectIndex, setRewindSelectIndex] = useState4(0);
6120
- const [rewindList, setRewindList] = useState4([]);
6121
- const [rewinding, setRewinding] = useState4(false);
6122
- const [rewindHintPhase, setRewindHintPhase] = useState4(
6113
+ const [cmdTipIndex, setCmdTipIndex] = useState5(0);
6114
+ const [cmdTipGradientColors, setCmdTipGradientColors] = useState5([]);
6115
+ const cmdTipPhaseRef = useRef4(0);
6116
+ const [skillSelectIndex, setSkillSelectIndex] = useState5(0);
6117
+ const [fileSelectIndex, setFileSelectIndex] = useState5(0);
6118
+ const [inputKey, setInputKey] = useState5(0);
6119
+ const [rewindSelecting, setRewindSelecting] = useState5(false);
6120
+ const [rewindSelectIndex, setRewindSelectIndex] = useState5(0);
6121
+ const [rewindList, setRewindList] = useState5([]);
6122
+ const [rewinding, setRewinding] = useState5(false);
6123
+ const [rewindHintPhase, setRewindHintPhase] = useState5(
6123
6124
  "idle"
6124
6125
  );
6125
- const currentRoundModifiedRef = useRef3(false);
6126
- const rewindHintTimerRef = useRef3(null);
6127
- const [selectingModel, setSelectingModel] = useState4(false);
6128
- const [modelSelectIndex, setModelSelectIndex] = useState4(0);
6126
+ const currentRoundModifiedRef = useRef4(false);
6127
+ const rewindHintTimerRef = useRef4(null);
6128
+ const [selectingModel, setSelectingModel] = useState5(false);
6129
+ const [modelSelectIndex, setModelSelectIndex] = useState5(0);
6129
6130
  const modelOptions = ["deepseek-v4-flash", "deepseek-v4-pro"];
6130
- const sessionRef = useRef3(null);
6131
- const abortRef = useRef3(null);
6132
- const currentContentRef = useRef3("");
6133
- const currentReasoningRef = useRef3([]);
6134
- const currentToolCallsRef = useRef3([]);
6135
- const currentUsageRef = useRef3(void 0);
6136
- const currentElapsedRef = useRef3(void 0);
6137
- const currentCostRef = useRef3(void 0);
6138
- const currentModelRef = useRef3(void 0);
6139
- const streamErrorRef = useRef3(void 0);
6140
- useEffect4(() => {
6131
+ const sessionRef = useRef4(null);
6132
+ const abortRef = useRef4(null);
6133
+ const currentContentRef = useRef4("");
6134
+ const currentReasoningRef = useRef4([]);
6135
+ const currentToolCallsRef = useRef4([]);
6136
+ const currentUsageRef = useRef4(void 0);
6137
+ const currentElapsedRef = useRef4(void 0);
6138
+ const currentCostRef = useRef4(void 0);
6139
+ const currentModelRef = useRef4(void 0);
6140
+ const streamErrorRef = useRef4(void 0);
6141
+ useEffect5(() => {
6141
6142
  setSkillSelectIndex(0);
6142
6143
  setFileSelectIndex(0);
6143
6144
  }, [input]);
6144
- useEffect4(() => {
6145
+ useEffect5(() => {
6145
6146
  return () => {
6146
6147
  if (rewindHintTimerRef.current) {
6147
6148
  clearTimeout(rewindHintTimerRef.current);
@@ -6149,7 +6150,7 @@ function ChatSession({
6149
6150
  }
6150
6151
  };
6151
6152
  }, []);
6152
- useEffect4(() => {
6153
+ useEffect5(() => {
6153
6154
  if (todoHideTimerRef.current) {
6154
6155
  clearTimeout(todoHideTimerRef.current);
6155
6156
  todoHideTimerRef.current = null;
@@ -6435,14 +6436,14 @@ function ChatSession({
6435
6436
  ]
6436
6437
  )
6437
6438
  );
6438
- useEffect4(() => {
6439
+ useEffect5(() => {
6439
6440
  if (cmdTips.length <= 1) return;
6440
6441
  const timer = setInterval(() => {
6441
6442
  setCmdTipIndex((prev) => (prev + 1) % cmdTips.length);
6442
6443
  }, 2e3);
6443
6444
  return () => clearInterval(timer);
6444
6445
  }, [cmdTips.length]);
6445
- useEffect4(() => {
6446
+ useEffect5(() => {
6446
6447
  const tip = cmdTips[cmdTipIndex % cmdTips.length];
6447
6448
  if (!tip) {
6448
6449
  setCmdTipGradientColors([]);
@@ -6459,13 +6460,13 @@ function ChatSession({
6459
6460
  }, GRADIENT_ANIMATION.cmdTipInterval);
6460
6461
  return () => clearInterval(interval);
6461
6462
  }, [cmdTipIndex, cmdTips.length]);
6462
- useEffect4(() => {
6463
+ useEffect5(() => {
6463
6464
  const timer = setInterval(() => {
6464
6465
  setOffset((prev) => (prev + 1) % CYBER_PALETTE.length);
6465
6466
  }, 500);
6466
6467
  return () => clearInterval(timer);
6467
6468
  }, []);
6468
- useEffect4(() => {
6469
+ useEffect5(() => {
6469
6470
  if (!apiKey || !baseUrl) return;
6470
6471
  const provider = createProvider({
6471
6472
  name: "deepseek",
@@ -6484,7 +6485,7 @@ function ChatSession({
6484
6485
  sessionRef.current = null;
6485
6486
  };
6486
6487
  }, [apiKey, baseUrl, activeModel, externalCostTracker]);
6487
- useEffect4(() => {
6488
+ useEffect5(() => {
6488
6489
  if (!apiKey || !baseUrl) return;
6489
6490
  let cancelled = false;
6490
6491
  setBalanceLoading(true);
@@ -6509,7 +6510,7 @@ function ChatSession({
6509
6510
  cancelled = true;
6510
6511
  };
6511
6512
  }, [apiKey, baseUrl]);
6512
- useEffect4(() => {
6513
+ useEffect5(() => {
6513
6514
  if (!externalCostTracker) return;
6514
6515
  let cancelled = false;
6515
6516
  let timer;
@@ -6527,7 +6528,7 @@ function ChatSession({
6527
6528
  if (timer) clearInterval(timer);
6528
6529
  };
6529
6530
  }, [externalCostTracker]);
6530
- useEffect4(() => {
6531
+ useEffect5(() => {
6531
6532
  if (isStreaming || !idlePlaceholder) {
6532
6533
  setGradientColors([]);
6533
6534
  return;
@@ -6546,7 +6547,7 @@ function ChatSession({
6546
6547
  }, GRADIENT_ANIMATION.idleInterval);
6547
6548
  return () => clearInterval(interval);
6548
6549
  }, [isStreaming, idlePlaceholder]);
6549
- useEffect4(() => {
6550
+ useEffect5(() => {
6550
6551
  if (!isStreaming || !streamingPlaceholder) {
6551
6552
  setStreamingGradientColors([]);
6552
6553
  return;
@@ -6996,251 +6997,327 @@ function ChatSession({
6996
6997
  rewinding
6997
6998
  ]
6998
6999
  );
6999
- useEffect4(() => {
7000
+ useEffect5(() => {
7000
7001
  if (!isStreaming && externalCostTracker) {
7001
7002
  setTodayCost(externalCostTracker.todayTotalCost);
7002
7003
  }
7003
7004
  }, [isStreaming, externalCostTracker]);
7004
- return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, children: [
7005
- !hasConversationStarted && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "row", marginBottom: 1, children: [
7006
- /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginRight: 4, children: [
7007
- LOGO_LINES.map((line, i) => {
7008
- const colorIndex = (i + offset) % CYBER_PALETTE.length;
7009
- return /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsx10(Text11, { bold: true, color: CYBER_PALETTE[colorIndex], children: line }) }, i);
7010
- }),
7011
- /* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text11, { color: "#808080", children: [
7012
- " \u{1F4E6} v",
7013
- VERSION
7014
- ] }) })
7015
- ] }),
7016
- /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", justifyContent: "center", children: [
7017
- /* @__PURE__ */ jsxs10(Text11, { color: "#00ff41", children: [
7018
- " \u2714 ",
7019
- "\u5DF2\u5C31\u7EEA ",
7020
- skillCount,
7021
- " \u4E2A Skill"
7022
- ] }),
7023
- /* @__PURE__ */ jsxs10(Text11, { color: "#00ffff", children: [
7024
- " \u2139 ",
7025
- "\u5DF2\u5C31\u7EEA ",
7026
- toolCount,
7027
- " \u4E2A\u5DE5\u5177"
7028
- ] }),
7029
- /* @__PURE__ */ jsxs10(Text11, { color: "#00ffff", children: [
7030
- " \u{1F527} \u6A21\u578B ",
7031
- SUPPORTED_MODELS[activeModel]?.displayName ?? activeModel
7032
- ] }),
7033
- thinkingEnabled && /* @__PURE__ */ jsxs10(Text11, { color: "#ff9800", children: [
7034
- " \u{1F9E0} \u6DF1\u5EA6\u601D\u8003 ",
7035
- thinkingEffort === "max" ? "Max" : "High"
7036
- ] }),
7037
- sessionMode === "plan" && /* @__PURE__ */ jsx10(Text11, { color: "#ff69b4", bold: true, children: " \u{1F4CB} \u8BA1\u5212\u6A21\u5F0F" }),
7038
- responseFormat === "json_object" && /* @__PURE__ */ jsx10(Text11, { color: "#4caf50", children: " \u{1F4C4} JSON" }),
7039
- toolChoice !== void 0 && /* @__PURE__ */ jsxs10(Text11, { color: "#e91e63", children: [
7040
- " \u{1F6E0} ",
7041
- toolChoice === "none" ? "\u7981\u6B62\u5DE5\u5177" : toolChoice === "required" ? "\u5F3A\u5236\u5DE5\u5177" : ""
7042
- ] }),
7043
- cmdTips.length > 0 && (() => {
7044
- const tip = cmdTips[cmdTipIndex % cmdTips.length];
7045
- if (!tip) return null;
7046
- const text = `${tip.name} ${tip.desc}`;
7047
- return /* @__PURE__ */ jsxs10(Text11, { children: [
7048
- /* @__PURE__ */ jsx10(Text11, { color: "#808080", children: " \u{1F4A1} " }),
7049
- cmdTipGradientColors.length > 0 ? text.split("").map((ch, i) => /* @__PURE__ */ jsx10(Text11, { color: cmdTipGradientColors[i] || void 0, children: ch }, i)) : /* @__PURE__ */ jsx10(Text11, { color: "#808080", children: text })
7050
- ] });
7051
- })(),
7052
- verbose ? /* @__PURE__ */ jsx10(Text11, { color: "#ff1493", children: " \u26A1 Verbose" }) : null
7053
- ] }),
7054
- /* @__PURE__ */ jsxs10(
7055
- Box10,
7005
+ return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, children: [
7006
+ /* @__PURE__ */ jsxs11(Box11, { flexDirection: "row", flexGrow: 1, children: [
7007
+ /* @__PURE__ */ jsx11(
7008
+ Box11,
7056
7009
  {
7057
- flexGrow: 1,
7010
+ width: leftPanelWidth,
7011
+ flexShrink: 0,
7058
7012
  flexDirection: "column",
7059
- justifyContent: "center",
7060
- alignItems: "flex-end",
7061
- children: [
7062
- balanceLoading && balance === null ? /* @__PURE__ */ jsx10(Text11, { color: "yellow", children: " \u23F3 \u67E5\u8BE2\u4F59\u989D..." }) : balance !== null ? /* @__PURE__ */ jsxs10(Box10, { flexDirection: "row", children: [
7063
- /* @__PURE__ */ jsx10(Text11, { color: "yellow", children: "\u{1F4B0} " }),
7064
- /* @__PURE__ */ jsxs10(Text11, { color: "yellow", children: [
7065
- "\u4F59\u989D \xA5",
7066
- balance.toFixed(2)
7067
- ] })
7068
- ] }) : null,
7069
- todayCost !== null ? /* @__PURE__ */ jsxs10(Box10, { flexDirection: "row", children: [
7070
- /* @__PURE__ */ jsx10(Text11, { color: "cyan", children: "\u{1F4CA} " }),
7071
- /* @__PURE__ */ jsxs10(Text11, { color: "cyan", children: [
7072
- "\u4ECA\u65E5 \xA5",
7073
- todayCost.toFixed(2)
7074
- ] })
7075
- ] }) : null
7076
- ]
7077
- }
7078
- )
7079
- ] }),
7080
- /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginTop: 1, children: [
7081
- /* @__PURE__ */ jsx10(Static, { items: displayMessages, children: (msg, i) => {
7082
- if (msg.role === "user") {
7083
- return /* @__PURE__ */ jsxs10(Box10, { marginTop: 1, children: [
7084
- /* @__PURE__ */ jsx10(Box10, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx10(Text11, { bold: true, color: "#00ff41", children: "\u{1F464}" }) }),
7085
- /* @__PURE__ */ jsx10(Box10, { flexGrow: 1, children: /* @__PURE__ */ jsx10(Text11, { wrap: "wrap", children: msg.content }) })
7086
- ] }, i);
7087
- }
7088
- if (msg.role === "tool") {
7089
- return /* @__PURE__ */ jsxs10(Box10, { marginTop: 1, flexDirection: "column", children: [
7090
- /* @__PURE__ */ jsxs10(Box10, { flexDirection: "row", children: [
7091
- /* @__PURE__ */ jsx10(Box10, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx10(Text11, { dimColor: true, children: "\u{1F527}" }) }),
7092
- /* @__PURE__ */ jsx10(Box10, { flexGrow: 1, children: /* @__PURE__ */ jsx10(Text11, { dimColor: true, wrap: "wrap", children: msg.content }) })
7093
- ] }),
7094
- msg.diff && /* @__PURE__ */ jsx10(DiffPreview, { diff: msg.diff })
7095
- ] }, i);
7096
- }
7097
- const detail = msg.assistantDetail;
7098
- return /* @__PURE__ */ jsx10(
7099
- AssistantMessage,
7100
- {
7101
- content: msg.content,
7102
- reasoning: detail?.reasoning,
7103
- toolCalls: detail?.toolCalls,
7104
- isStreaming: false,
7105
- usage: detail?.usage,
7106
- elapsed: detail?.elapsed,
7107
- cost: detail?.cost,
7108
- model: detail?.model
7109
- },
7110
- i
7111
- );
7112
- } }, staticKey),
7113
- isStreaming && /* @__PURE__ */ jsx10(
7114
- AssistantMessage,
7115
- {
7116
- content: currentContent,
7117
- reasoning: currentReasoning,
7118
- toolCalls: currentToolCalls.length > 0 ? currentToolCalls : void 0,
7119
- isStreaming: true,
7120
- usage: _currentUsage,
7121
- cost: _currentCost,
7122
- model: _streamingModel
7013
+ children: /* @__PURE__ */ jsx11(
7014
+ Box11,
7015
+ {
7016
+ borderStyle: "single",
7017
+ borderColor: "#333333",
7018
+ paddingX: 1,
7019
+ flexDirection: "column",
7020
+ flexGrow: 1,
7021
+ justifyContent: !hasConversationStarted ? "center" : "flex-end",
7022
+ children: !hasConversationStarted ? (
7023
+ /* ===== 首页:Logo + 状态概况 ===== */
7024
+ /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", alignItems: "center", children: [
7025
+ LOGO_LINES.map((line, i) => {
7026
+ const colorIndex = (i + offset) % CYBER_PALETTE.length;
7027
+ return /* @__PURE__ */ jsx11(Text12, { bold: true, color: CYBER_PALETTE[colorIndex], children: line }, i);
7028
+ }),
7029
+ /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsxs11(Text12, { color: "#808080", children: [
7030
+ "\u{1F4E6} v",
7031
+ VERSION
7032
+ ] }) }),
7033
+ /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", alignItems: "center", children: [
7034
+ /* @__PURE__ */ jsxs11(Text12, { color: "#00ff41", children: [
7035
+ "\u2714 ",
7036
+ skillCount,
7037
+ " Skills"
7038
+ ] }),
7039
+ /* @__PURE__ */ jsxs11(Text12, { color: "#00ffff", children: [
7040
+ "\u2139 ",
7041
+ toolCount,
7042
+ " \u5DE5\u5177"
7043
+ ] }),
7044
+ /* @__PURE__ */ jsxs11(Text12, { color: "#00ffff", children: [
7045
+ "\u{1F527} ",
7046
+ SUPPORTED_MODELS[activeModel]?.displayName ?? activeModel
7047
+ ] }),
7048
+ thinkingEnabled && /* @__PURE__ */ jsxs11(Text12, { color: "#ff9800", children: [
7049
+ "\u{1F9E0} \u6DF1\u5EA6\u601D\u8003 ",
7050
+ thinkingEffort === "max" ? "Max" : "High"
7051
+ ] }),
7052
+ sessionMode === "plan" && /* @__PURE__ */ jsx11(Text12, { color: "#ff69b4", bold: true, children: "\u{1F4CB} \u8BA1\u5212\u6A21\u5F0F" })
7053
+ ] }),
7054
+ /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", alignItems: "center", children: [
7055
+ balance !== null ? /* @__PURE__ */ jsxs11(Text12, { color: "yellow", children: [
7056
+ "\u{1F4B0} \u4F59\u989D \xA5",
7057
+ balance.toFixed(2)
7058
+ ] }) : balanceLoading ? /* @__PURE__ */ jsx11(Text12, { color: "yellow", children: "\u23F3 \u67E5\u8BE2\u4F59\u989D..." }) : null,
7059
+ todayCost !== null && /* @__PURE__ */ jsxs11(Text12, { color: "cyan", children: [
7060
+ "\u{1F4CA} \u4ECA\u65E5 \xA5",
7061
+ todayCost.toFixed(2)
7062
+ ] })
7063
+ ] }),
7064
+ verbose && /* @__PURE__ */ jsx11(Text12, { color: "#ff1493", children: "\u26A1 Verbose" })
7065
+ ] })
7066
+ ) : hasReasoningPanel ? (
7067
+ /* ===== 流式思考中:截断至最新12行,空行填充维持固定高度 ===== */
7068
+ /* @__PURE__ */ jsxs11(Fragment2, { children: [
7069
+ /* @__PURE__ */ jsx11(Text12, { bold: true, color: "#ff9800", children: "\u{1F9E0} \u6DF1\u5EA6\u601D\u8003ing" }),
7070
+ /* @__PURE__ */ jsx11(Text12, { dimColor: true, wrap: "wrap", children: (() => {
7071
+ const full = joinReasoningSegments(currentReasoning);
7072
+ const maxContentLines = 11;
7073
+ const lines = full.split("\n");
7074
+ const kept = lines.slice(-maxContentLines);
7075
+ while (kept.length < maxContentLines) {
7076
+ kept.unshift("");
7077
+ }
7078
+ return kept.join("\n");
7079
+ })() })
7080
+ ] })
7081
+ ) : (
7082
+ /* ===== 对话中(无思考):会话状态面板 ===== */
7083
+ /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", alignItems: "center", children: [
7084
+ /* @__PURE__ */ jsx11(Text12, { color: "#00ffff", bold: true, children: "\u{1F4AC} \u5BF9\u8BDD\u8FDB\u884C\u4E2D" }),
7085
+ /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", alignItems: "center", children: [
7086
+ /* @__PURE__ */ jsxs11(Text12, { color: "#00ff41", children: [
7087
+ "\u{1F4DD} \u6D88\u606F ",
7088
+ displayMessages.length,
7089
+ " \u6761"
7090
+ ] }),
7091
+ sessionCost > 0 && /* @__PURE__ */ jsxs11(Text12, { color: "cyan", children: [
7092
+ "\u{1F4B0} \u4F1A\u8BDD \xA5",
7093
+ sessionCost.toFixed(4)
7094
+ ] })
7095
+ ] }),
7096
+ /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", alignItems: "center", children: [
7097
+ /* @__PURE__ */ jsxs11(Text12, { color: "#808080", children: [
7098
+ "\u{1F527} ",
7099
+ SUPPORTED_MODELS[activeModel]?.displayName ?? activeModel
7100
+ ] }),
7101
+ thinkingEnabled && /* @__PURE__ */ jsxs11(Text12, { color: "#ff9800", children: [
7102
+ "\u{1F9E0} ",
7103
+ thinkingEffort === "max" ? "Max" : "High"
7104
+ ] })
7105
+ ] }),
7106
+ balance !== null && /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsxs11(Text12, { color: "yellow", children: [
7107
+ "\u{1F4B0} \xA5",
7108
+ balance.toFixed(2)
7109
+ ] }) })
7110
+ ] })
7111
+ )
7112
+ }
7113
+ )
7123
7114
  }
7124
7115
  ),
7125
- !isStreaming && streamError && /* @__PURE__ */ jsx10(Box10, { marginTop: 1, marginLeft: 3, children: /* @__PURE__ */ jsxs10(Text11, { color: "red", children: [
7126
- "\u26A0 ",
7127
- streamError
7128
- ] }) })
7129
- ] }),
7130
- todoPanelVisible && todoSnapshot.length > 0 && /* @__PURE__ */ jsx10(TodoListPanel, { items: todoSnapshot }),
7131
- selectingModel ? /* @__PURE__ */ jsxs10(Box10, { marginTop: 1, flexDirection: "column", children: [
7132
- /* @__PURE__ */ jsx10(Text11, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) }),
7133
- /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginTop: 1, children: [
7134
- /* @__PURE__ */ jsx10(Text11, { bold: true, color: "#00ffff", children: "\u9009\u62E9\u6A21\u578B\uFF1A" }),
7135
- modelOptions.map((id, i) => {
7136
- const meta = SUPPORTED_MODELS[id];
7137
- const isCurrent = id === activeModel;
7138
- const isSelected = i === modelSelectIndex;
7139
- const marker = isSelected ? " > " : " ";
7140
- const suffix = isCurrent ? " (\u5F53\u524D)" : "";
7141
- return /* @__PURE__ */ jsxs10(Box10, { children: [
7142
- /* @__PURE__ */ jsxs10(Text11, { color: isSelected ? "#00ff41" : void 0, bold: isSelected, children: [
7143
- marker,
7144
- meta.displayName,
7145
- suffix
7146
- ] }),
7147
- isSelected && /* @__PURE__ */ jsxs10(Text11, { color: "#808080", children: [
7148
- " \u2014 ",
7149
- id
7150
- ] })
7151
- ] }, id);
7152
- }),
7153
- /* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text11, { color: "#808080", dimColor: true, children: "\u2191\u2193 \u9009\u62E9 \xB7 Enter \u786E\u8BA4 \xB7 Esc \u53D6\u6D88" }) })
7154
- ] }),
7155
- /* @__PURE__ */ jsx10(Text11, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) })
7156
- ] }) : rewindSelecting ? /* @__PURE__ */ jsxs10(Box10, { marginTop: 1, flexDirection: "column", children: [
7157
- /* @__PURE__ */ jsx10(Text11, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) }),
7158
- /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginTop: 1, children: [
7159
- /* @__PURE__ */ jsx10(Text11, { bold: true, color: "#ff9800", children: "\u9009\u62E9\u8981\u56DE\u9000\u7684\u68C0\u67E5\u70B9\uFF1A" }),
7160
- rewindList.map((cp2, i) => {
7161
- const isSelected = i === rewindSelectIndex;
7162
- const marker = isSelected ? " > " : " ";
7163
- const time = new Date(cp2.timestamp).toLocaleTimeString();
7164
- const preview = cp2.preview || "(\u7A7A)";
7165
- const tag = cp2.isGitRepo ? "" : " [\u975E git\uFF0C\u4EC5\u5BF9\u8BDD]";
7166
- return /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsxs10(Text11, { color: isSelected ? "#ff9800" : void 0, bold: isSelected, children: [
7167
- marker,
7168
- "#",
7169
- i + 1,
7116
+ /* @__PURE__ */ jsx11(Box11, { width: 1, flexShrink: 0, children: /* @__PURE__ */ jsx11(Text12, { color: "#444", children: "\u2502" }) }),
7117
+ useMemo(() => /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", flexGrow: 1, children: [
7118
+ /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", flexGrow: 1, children: [
7119
+ !hasConversationStarted && /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", alignItems: "flex-start", flexGrow: 1, paddingBottom: 1, children: [
7120
+ cmdTips.length > 0 && (() => {
7121
+ const tip = cmdTips[cmdTipIndex % cmdTips.length];
7122
+ if (!tip) return null;
7123
+ const text = `${tip.name} ${tip.desc}`;
7124
+ return /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, alignSelf: "center", children: [
7125
+ /* @__PURE__ */ jsx11(Text12, { color: "#808080", children: "\u{1F4A1} " }),
7126
+ cmdTipGradientColors.length > 0 ? text.split("").map((ch, i) => /* @__PURE__ */ jsx11(Text12, { color: cmdTipGradientColors[i] || void 0, children: ch }, i)) : /* @__PURE__ */ jsx11(Text12, { color: "#808080", children: text })
7127
+ ] });
7128
+ })(),
7129
+ /* @__PURE__ */ jsx11(Box11, { flexGrow: 1 }),
7130
+ /* @__PURE__ */ jsx11(AnimatedLogo, { panelWidth: rightContentWidth })
7131
+ ] }),
7132
+ /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginTop: 1, children: [
7133
+ /* @__PURE__ */ jsx11(Static, { items: displayMessages, children: (msg, i) => {
7134
+ if (msg.role === "user") {
7135
+ return /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "row", children: [
7136
+ /* @__PURE__ */ jsx11(Box11, { width: 1, backgroundColor: "#FF8C00", flexShrink: 0 }),
7137
+ /* @__PURE__ */ jsx11(Box11, { flexGrow: 1, paddingLeft: 1, children: /* @__PURE__ */ jsxs11(Box11, { flexDirection: "row", children: [
7138
+ /* @__PURE__ */ jsx11(Box11, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx11(Text12, { bold: true, color: "#FF8C00", children: "\u{1F4AC}" }) }),
7139
+ /* @__PURE__ */ jsx11(Box11, { flexGrow: 1, children: /* @__PURE__ */ jsx11(Text12, { wrap: "wrap", children: msg.content }) })
7140
+ ] }) })
7141
+ ] }, i);
7142
+ }
7143
+ if (msg.role === "tool") {
7144
+ return /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "row", children: [
7145
+ /* @__PURE__ */ jsx11(Box11, { width: 1, backgroundColor: "#666666", flexShrink: 0 }),
7146
+ /* @__PURE__ */ jsxs11(Box11, { flexGrow: 1, paddingLeft: 1, flexDirection: "column", children: [
7147
+ /* @__PURE__ */ jsxs11(Box11, { flexDirection: "row", children: [
7148
+ /* @__PURE__ */ jsx11(Box11, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx11(Text12, { dimColor: true, children: "\u{1F527}" }) }),
7149
+ /* @__PURE__ */ jsx11(Box11, { flexGrow: 1, children: /* @__PURE__ */ jsx11(Text12, { dimColor: true, wrap: "wrap", children: msg.content }) })
7150
+ ] }),
7151
+ msg.diff && /* @__PURE__ */ jsx11(DiffPreview, { diff: msg.diff })
7152
+ ] })
7153
+ ] }, i);
7154
+ }
7155
+ const detail = msg.assistantDetail;
7156
+ return /* @__PURE__ */ jsx11(
7157
+ AssistantMessage,
7158
+ {
7159
+ content: msg.content,
7160
+ toolCalls: detail?.toolCalls,
7161
+ isStreaming: false,
7162
+ usage: detail?.usage,
7163
+ elapsed: detail?.elapsed,
7164
+ cost: detail?.cost,
7165
+ model: detail?.model
7166
+ },
7167
+ i
7168
+ );
7169
+ } }, staticKey),
7170
+ isStreaming && /* @__PURE__ */ jsx11(
7171
+ AssistantMessage,
7172
+ {
7173
+ content: currentContent,
7174
+ toolCalls: currentToolCalls.length > 0 ? currentToolCalls : void 0,
7175
+ isStreaming: true,
7176
+ usage: _currentUsage,
7177
+ cost: _currentCost,
7178
+ model: _streamingModel
7179
+ }
7180
+ ),
7181
+ !isStreaming && streamError && /* @__PURE__ */ jsx11(Box11, { marginTop: 1, marginLeft: 3, children: /* @__PURE__ */ jsxs11(Text12, { color: "red", children: [
7182
+ "\u26A0 ",
7183
+ streamError
7184
+ ] }) })
7185
+ ] }),
7186
+ todoPanelVisible && todoSnapshot.length > 0 && /* @__PURE__ */ jsx11(TodoListPanel, { items: todoSnapshot })
7187
+ ] }),
7188
+ selectingModel ? /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", children: [
7189
+ /* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) }),
7190
+ /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginTop: 1, children: [
7191
+ /* @__PURE__ */ jsx11(Text12, { bold: true, color: "#00ffff", children: "\u9009\u62E9\u6A21\u578B\uFF1A" }),
7192
+ modelOptions.map((id, i) => {
7193
+ const meta = SUPPORTED_MODELS[id];
7194
+ const isCurrent = id === activeModel;
7195
+ const isSelected = i === modelSelectIndex;
7196
+ const marker = isSelected ? " > " : " ";
7197
+ const suffix = isCurrent ? " (\u5F53\u524D)" : "";
7198
+ return /* @__PURE__ */ jsxs11(Box11, { children: [
7199
+ /* @__PURE__ */ jsxs11(Text12, { color: isSelected ? "#00ff41" : void 0, bold: isSelected, children: [
7200
+ marker,
7201
+ meta.displayName,
7202
+ suffix
7203
+ ] }),
7204
+ isSelected && /* @__PURE__ */ jsxs11(Text12, { color: "#808080", children: [
7205
+ " \u2014 ",
7206
+ id
7207
+ ] })
7208
+ ] }, id);
7209
+ }),
7210
+ /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text12, { color: "#808080", dimColor: true, children: "\u2191\u2193 \u9009\u62E9 \xB7 Enter \u786E\u8BA4 \xB7 Esc \u53D6\u6D88" }) })
7211
+ ] }),
7212
+ /* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) })
7213
+ ] }) : rewindSelecting ? /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", children: [
7214
+ /* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) }),
7215
+ /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginTop: 1, children: [
7216
+ /* @__PURE__ */ jsx11(Text12, { bold: true, color: "#ff9800", children: "\u9009\u62E9\u8981\u56DE\u9000\u7684\u68C0\u67E5\u70B9\uFF1A" }),
7217
+ rewindList.map((cp2, i) => {
7218
+ const isSelected = i === rewindSelectIndex;
7219
+ const marker = isSelected ? " > " : " ";
7220
+ const time = new Date(cp2.timestamp).toLocaleTimeString();
7221
+ const preview = cp2.preview || "(\u7A7A)";
7222
+ const tag = cp2.isGitRepo ? "" : " [\u975E git\uFF0C\u4EC5\u5BF9\u8BDD]";
7223
+ return /* @__PURE__ */ jsx11(Box11, { children: /* @__PURE__ */ jsxs11(Text12, { color: isSelected ? "#ff9800" : void 0, bold: isSelected, children: [
7224
+ marker,
7225
+ "#",
7226
+ i + 1,
7227
+ " ",
7228
+ time,
7229
+ " `",
7230
+ preview,
7231
+ tag,
7232
+ "`"
7233
+ ] }) }, cp2.index);
7234
+ }),
7235
+ /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text12, { color: "#808080", dimColor: true, children: "\u2191\u2193 \u9009\u62E9 \xB7 Enter \u786E\u8BA4 \xB7 Esc \u53D6\u6D88" }) })
7236
+ ] }),
7237
+ /* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) })
7238
+ ] }) : /* @__PURE__ */ jsxs11(Fragment2, { children: [
7239
+ (hasConversationStarted || sessionMode === "plan") && isStreaming && streamingPhase ? /* @__PURE__ */ jsx11(Box11, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsxs11(Text12, { bold: true, color: PHASE_CONFIG[streamingPhase].color, children: [
7240
+ PHASE_CONFIG[streamingPhase].icon,
7170
7241
  " ",
7171
- time,
7172
- " `",
7173
- preview,
7174
- tag,
7175
- "`"
7176
- ] }) }, cp2.index);
7177
- }),
7178
- /* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text11, { color: "#808080", dimColor: true, children: "\u2191\u2193 \u9009\u62E9 \xB7 Enter \u786E\u8BA4 \xB7 Esc \u53D6\u6D88" }) })
7179
- ] }),
7180
- /* @__PURE__ */ jsx10(Text11, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) })
7181
- ] }) : /* @__PURE__ */ jsxs10(Fragment2, { children: [
7182
- (hasConversationStarted || sessionMode === "plan") && isStreaming && streamingPhase ? /* @__PURE__ */ jsx10(Box10, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsxs10(Text11, { bold: true, color: PHASE_CONFIG[streamingPhase].color, children: [
7183
- PHASE_CONFIG[streamingPhase].icon,
7184
- " ",
7185
- PHASE_CONFIG[streamingPhase].label,
7186
- " ",
7187
- /* @__PURE__ */ jsx10(InkSpinner3, { type: "dots" })
7188
- ] }) }) : rewindHintPhase === "visible" ? (
7189
- // 本轮修改了文件时,流式结束后 2s 在原位置展示 /rewind 提示
7190
- // 一直保留到下次对话开始,与 /rewind 1(最新检查点)配套
7191
- /* @__PURE__ */ jsx10(Box10, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx10(Text11, { color: "#808080", children: "\u21A9 /rewind 1 \u53EF\u64A4\u56DE\u672C\u6B21\u4FEE\u6539" }) })
7192
- ) : null,
7193
- /* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: hasConversationStarted || sessionMode === "plan" ? /* @__PURE__ */ jsxs10(
7194
- Text11,
7195
- {
7196
- color: sessionMode === "plan" ? "#ff69b4" : "#00ffff",
7197
- dimColor: sessionMode !== "plan",
7198
- children: [
7199
- /* @__PURE__ */ jsx10(Text11, { children: sessionMode === "plan" ? "\u2500".repeat(Math.max(dividerWidth - 48, 1)) : "\u2500".repeat(Math.max(dividerWidth - 35, 10)) }),
7200
- balance !== null && /* @__PURE__ */ jsxs10(Text11, { color: "yellow", children: [
7201
- " \u{1F4B0} \u4F59\u989D \xA5",
7202
- balance.toFixed(2)
7203
- ] }),
7204
- isStreaming ? /* @__PURE__ */ jsxs10(Text11, { color: "cyan", children: [
7205
- " \u{1F4CA} \u672C\u6B21 \xA5",
7206
- sessionCost > 0 ? sessionCost.toFixed(4) + " " : "",
7207
- /* @__PURE__ */ jsx10(InkSpinner3, { type: "dots" })
7208
- ] }) : sessionCost > 0 ? /* @__PURE__ */ jsxs10(Text11, { color: "cyan", children: [
7209
- " \u{1F4CA} \u672C\u6B21 \xA5",
7210
- sessionCost.toFixed(4)
7211
- ] }) : null,
7212
- sessionMode === "plan" && /* @__PURE__ */ jsx10(Text11, { color: "#ff69b4", bold: true, children: " \u{1F4CB} \u8BA1\u5212\u6A21\u5F0F" })
7213
- ]
7214
- }
7215
- ) : /* @__PURE__ */ jsx10(Text11, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) }) }),
7216
- /* @__PURE__ */ jsxs10(Box10, { children: [
7217
- /* @__PURE__ */ jsx10(Box10, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx10(Text11, { bold: true, color: "#00ff41", children: "\u26A1" }) }),
7218
- /* @__PURE__ */ jsx10(Box10, { flexGrow: 1, children: !input && !isStreaming && idlePlaceholder && gradientColors.length > 0 ? /* @__PURE__ */ jsx10(Text11, { children: idlePlaceholder.split("").map((ch, i) => /* @__PURE__ */ jsx10(Text11, { color: gradientColors[i] ?? void 0, children: ch }, i)) }) : !input && isStreaming && streamingPlaceholder && streamingGradientColors.length > 0 ? /* @__PURE__ */ jsx10(Text11, { children: streamingPlaceholder.split("").map((ch, i) => /* @__PURE__ */ jsx10(Text11, { color: streamingGradientColors[i] ?? void 0, children: ch }, i)) }) : /* @__PURE__ */ jsx10(
7219
- TextInput,
7220
- {
7221
- value: input,
7222
- onChange: setInput,
7223
- onSubmit: handleSubmit,
7224
- placeholder: ""
7225
- },
7226
- inputKey
7227
- ) })
7228
- ] }),
7229
- /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsx10(Text11, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) }) }),
7230
- /* @__PURE__ */ jsx10(SkillSelector, { skills, input, selectedIndex: skillSelectIndex }),
7231
- /* @__PURE__ */ jsx10(FileSelector, { files, input, selectedIndex: fileSelectIndex })
7242
+ PHASE_CONFIG[streamingPhase].label,
7243
+ " ",
7244
+ /* @__PURE__ */ jsx11(InkSpinner3, { type: "dots" })
7245
+ ] }) }) : rewindHintPhase === "visible" ? /* @__PURE__ */ jsx11(Box11, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx11(Text12, { color: "#808080", children: "\u21A9 /rewind 1 \u53EF\u64A4\u56DE\u672C\u6B21\u4FEE\u6539" }) }) : null,
7246
+ /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) }) }),
7247
+ /* @__PURE__ */ jsxs11(Box11, { children: [
7248
+ /* @__PURE__ */ jsx11(Box11, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx11(Text12, { bold: true, color: "#00ff41", children: "\u26A1" }) }),
7249
+ /* @__PURE__ */ jsx11(Box11, { flexGrow: 1, children: !input && !isStreaming && idlePlaceholder && gradientColors.length > 0 ? /* @__PURE__ */ jsx11(Text12, { children: idlePlaceholder.split("").map((ch, i) => /* @__PURE__ */ jsx11(Text12, { color: gradientColors[i] ?? void 0, children: ch }, i)) }) : !input && isStreaming && streamingPlaceholder && streamingGradientColors.length > 0 ? /* @__PURE__ */ jsx11(Text12, { children: streamingPlaceholder.split("").map((ch, i) => /* @__PURE__ */ jsx11(Text12, { color: streamingGradientColors[i] ?? void 0, children: ch }, i)) }) : /* @__PURE__ */ jsx11(
7250
+ TextInput,
7251
+ {
7252
+ value: input,
7253
+ onChange: setInput,
7254
+ onSubmit: handleSubmit,
7255
+ placeholder: ""
7256
+ },
7257
+ inputKey
7258
+ ) })
7259
+ ] }),
7260
+ /* @__PURE__ */ jsx11(Box11, { children: /* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) }) }),
7261
+ /* @__PURE__ */ jsx11(SkillSelector, { skills, input, selectedIndex: skillSelectIndex }),
7262
+ /* @__PURE__ */ jsx11(FileSelector, { files, input, selectedIndex: fileSelectIndex })
7263
+ ] })
7264
+ ] }), [
7265
+ displayMessages,
7266
+ staticKey,
7267
+ isStreaming,
7268
+ currentContent,
7269
+ currentToolCalls,
7270
+ _currentUsage,
7271
+ _currentCost,
7272
+ _streamingModel,
7273
+ streamError,
7274
+ todoSnapshot,
7275
+ todoPanelVisible,
7276
+ selectingModel,
7277
+ modelOptions,
7278
+ activeModel,
7279
+ modelSelectIndex,
7280
+ setActiveModel,
7281
+ setModelSelectIndex,
7282
+ rewindSelecting,
7283
+ rewindList,
7284
+ rewindSelectIndex,
7285
+ setRewindSelecting,
7286
+ setRewindSelectIndex,
7287
+ rewindHintPhase,
7288
+ hasConversationStarted,
7289
+ sessionMode,
7290
+ streamingPhase,
7291
+ idlePlaceholder,
7292
+ gradientColors,
7293
+ streamingPlaceholder,
7294
+ streamingGradientColors,
7295
+ input,
7296
+ setInput,
7297
+ rightContentWidth,
7298
+ handleSubmit,
7299
+ skills,
7300
+ skillSelectIndex,
7301
+ files,
7302
+ fileSelectIndex,
7303
+ inputKey,
7304
+ cmdTips,
7305
+ cmdTipIndex,
7306
+ cmdTipGradientColors,
7307
+ doubleCtrlC
7308
+ ])
7232
7309
  ] }),
7233
- doubleCtrlC && !isStreaming && /* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text11, { color: "#ff1493", bold: true, children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) }),
7234
- isStreaming && /* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text11, { color: "yellow", dimColor: true, children: " \u63D0\u793A\uFF1A\u6309 Ctrl+C \u53D6\u6D88\u5F53\u524D\u8BF7\u6C42" }) })
7310
+ doubleCtrlC && !isStreaming && /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text12, { color: "#ff1493", bold: true, children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) }),
7311
+ isStreaming && /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text12, { color: "yellow", dimColor: true, children: " \u63D0\u793A\uFF1A\u6309 Ctrl+C \u53D6\u6D88\u5F53\u524D\u8BF7\u6C42" }) })
7235
7312
  ] });
7236
7313
  }
7237
7314
 
7238
7315
  // src/ui/GamePicker.tsx
7239
- import { Box as Box11, Text as Text12, useInput as useInput2 } from "ink";
7240
- import { useState as useState5, useCallback as useCallback3 } from "react";
7241
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
7316
+ import { Box as Box12, Text as Text13, useInput as useInput2 } from "ink";
7317
+ import { useState as useState6, useCallback as useCallback3 } from "react";
7318
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
7242
7319
  function GamePicker({ games, onSelect, onExit, onBackToChat }) {
7243
- const [selectedIndex, setSelectedIndex] = useState5(0);
7320
+ const [selectedIndex, setSelectedIndex] = useState6(0);
7244
7321
  const exitAction = onBackToChat ?? onExit ?? (() => process.exit(0));
7245
7322
  const { doubleCtrlC, handleCtrlC } = useDoubleCtrlC(exitAction);
7246
7323
  useInput2(
@@ -7266,18 +7343,18 @@ function GamePicker({ games, onSelect, onExit, onBackToChat }) {
7266
7343
  [games, selectedIndex, onSelect, onExit, onBackToChat, handleCtrlC]
7267
7344
  )
7268
7345
  );
7269
- return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
7270
- /* @__PURE__ */ jsx11(Box11, { marginBottom: 1, children: /* @__PURE__ */ jsx11(Text12, { bold: true, color: "#00ffff", children: "\u{1F3AE} \u6E38\u620F\u5217\u8868" }) }),
7271
- /* @__PURE__ */ jsx11(Box11, { flexDirection: "column", children: games.map((game, index) => {
7346
+ return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
7347
+ /* @__PURE__ */ jsx12(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsx12(Text13, { bold: true, color: "#00ffff", children: "\u{1F3AE} \u6E38\u620F\u5217\u8868" }) }),
7348
+ /* @__PURE__ */ jsx12(Box12, { flexDirection: "column", children: games.map((game, index) => {
7272
7349
  const isSelected = index === selectedIndex;
7273
- return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "row", children: [
7274
- /* @__PURE__ */ jsx11(Box11, { width: 3, flexShrink: 0, children: isSelected ? /* @__PURE__ */ jsx11(Text12, { bold: true, color: "#00ff41", children: "\u25B8 " }) : /* @__PURE__ */ jsx11(Text12, { children: " " }) }),
7275
- /* @__PURE__ */ jsx11(Box11, { width: 20, flexShrink: 0, children: /* @__PURE__ */ jsx11(Text12, { bold: true, color: isSelected ? "#00ff41" : "#ffffff", children: game.name }) }),
7276
- /* @__PURE__ */ jsx11(Box11, { children: /* @__PURE__ */ jsx11(Text12, { color: "#888888", children: game.description }) })
7350
+ return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "row", children: [
7351
+ /* @__PURE__ */ jsx12(Box12, { width: 3, flexShrink: 0, children: isSelected ? /* @__PURE__ */ jsx12(Text13, { bold: true, color: "#00ff41", children: "\u25B8 " }) : /* @__PURE__ */ jsx12(Text13, { children: " " }) }),
7352
+ /* @__PURE__ */ jsx12(Box12, { width: 20, flexShrink: 0, children: /* @__PURE__ */ jsx12(Text13, { bold: true, color: isSelected ? "#00ff41" : "#ffffff", children: game.name }) }),
7353
+ /* @__PURE__ */ jsx12(Box12, { children: /* @__PURE__ */ jsx12(Text13, { color: "#888888", children: game.description }) })
7277
7354
  ] }, game.id);
7278
7355
  }) }),
7279
- /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text12, { dimColor: true, children: " \u2191/\u2193 \u9009\u62E9 Enter \u542F\u52A8 q \u8FD4\u56DE" }) }),
7280
- doubleCtrlC && /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text12, { color: "#ff1493", bold: true, children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) })
7356
+ /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: " \u2191/\u2193 \u9009\u62E9 Enter \u542F\u52A8 q \u8FD4\u56DE" }) }),
7357
+ doubleCtrlC && /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { color: "#ff1493", bold: true, children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) })
7281
7358
  ] });
7282
7359
  }
7283
7360
 
@@ -7294,9 +7371,9 @@ function listGames() {
7294
7371
  }
7295
7372
 
7296
7373
  // src/game/brick-breaker/index.tsx
7297
- import { Box as Box12, Text as Text13, useInput as useInput3, render as render2 } from "ink";
7298
- import { useState as useState6, useEffect as useEffect5, useRef as useRef4, useCallback as useCallback4 } from "react";
7299
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
7374
+ import { Box as Box13, Text as Text14, useInput as useInput3, render as render2 } from "ink";
7375
+ import { useState as useState7, useEffect as useEffect6, useRef as useRef5, useCallback as useCallback4 } from "react";
7376
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
7300
7377
  var GAME_WIDTH = 40;
7301
7378
  var GAME_HEIGHT = 18;
7302
7379
  var PADDLE_WIDTH = 9;
@@ -7427,13 +7504,13 @@ function buildBoard(state) {
7427
7504
  return lines.map((l) => `\u2502${l}\u2502`).join("\n");
7428
7505
  }
7429
7506
  function BrickBreakerGame({ onExit: _onExit }) {
7430
- const [initialLevel, setInitialLevel] = useState6(1);
7431
- const [selectingLevel, setSelectingLevel] = useState6(true);
7432
- const stateRef = useRef4(createInitialState(initialLevel));
7433
- const [tick2, setTick] = useState6(0);
7434
- const onExitRef = useRef4(_onExit);
7507
+ const [initialLevel, setInitialLevel] = useState7(1);
7508
+ const [selectingLevel, setSelectingLevel] = useState7(true);
7509
+ const stateRef = useRef5(createInitialState(initialLevel));
7510
+ const [tick2, setTick] = useState7(0);
7511
+ const onExitRef = useRef5(_onExit);
7435
7512
  onExitRef.current = _onExit;
7436
- useEffect5(() => {
7513
+ useEffect6(() => {
7437
7514
  if (selectingLevel) return;
7438
7515
  const interval = setInterval(() => {
7439
7516
  update(stateRef.current);
@@ -7486,49 +7563,49 @@ function BrickBreakerGame({ onExit: _onExit }) {
7486
7563
  const board = buildBoard(s);
7487
7564
  const def = getLevel(s.level);
7488
7565
  void tick2;
7489
- return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
7490
- /* @__PURE__ */ jsxs12(Box12, { flexDirection: "row", children: [
7491
- /* @__PURE__ */ jsx12(Box12, { width: 20, children: /* @__PURE__ */ jsxs12(Text13, { children: [
7566
+ return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", children: [
7567
+ /* @__PURE__ */ jsxs13(Box13, { flexDirection: "row", children: [
7568
+ /* @__PURE__ */ jsx13(Box13, { width: 20, children: /* @__PURE__ */ jsxs13(Text14, { children: [
7492
7569
  "\u5173\u5361 ",
7493
7570
  s.level,
7494
7571
  ": ",
7495
- /* @__PURE__ */ jsx12(Text13, { color: "cyan", children: def.desc })
7572
+ /* @__PURE__ */ jsx13(Text14, { color: "cyan", children: def.desc })
7496
7573
  ] }) }),
7497
- /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsxs12(Text13, { children: [
7574
+ /* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsxs13(Text14, { children: [
7498
7575
  "\u5206\u6570: ",
7499
- /* @__PURE__ */ jsx12(Text13, { color: "yellow", children: String(s.score).padStart(3, "0") })
7576
+ /* @__PURE__ */ jsx13(Text14, { color: "yellow", children: String(s.score).padStart(3, "0") })
7500
7577
  ] }) }),
7501
- /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsxs12(Text13, { children: [
7578
+ /* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsxs13(Text14, { children: [
7502
7579
  "\u751F\u547D: ",
7503
- /* @__PURE__ */ jsx12(Text13, { color: "red", children: "\u2665".repeat(Math.max(0, s.lives)) })
7580
+ /* @__PURE__ */ jsx13(Text14, { color: "red", children: "\u2665".repeat(Math.max(0, s.lives)) })
7504
7581
  ] }) }),
7505
- /* @__PURE__ */ jsx12(Box12, { width: 10, children: /* @__PURE__ */ jsxs12(Text13, { children: [
7582
+ /* @__PURE__ */ jsx13(Box13, { width: 10, children: /* @__PURE__ */ jsxs13(Text14, { children: [
7506
7583
  "\u7816\u5757: ",
7507
- /* @__PURE__ */ jsx12(Text13, { color: "cyan", children: aliveCount })
7584
+ /* @__PURE__ */ jsx13(Text14, { color: "cyan", children: aliveCount })
7508
7585
  ] }) }),
7509
- /* @__PURE__ */ jsx12(Box12, { children: /* @__PURE__ */ jsxs12(Text13, { color: s.paused ? "gray" : "green", children: [
7586
+ /* @__PURE__ */ jsx13(Box13, { children: /* @__PURE__ */ jsxs13(Text14, { color: s.paused ? "gray" : "green", children: [
7510
7587
  "[",
7511
7588
  s.paused ? "\u6682\u505C" : "\u8FD0\u884C\u4E2D",
7512
7589
  "]"
7513
7590
  ] }) })
7514
7591
  ] }),
7515
- /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
7516
- /* @__PURE__ */ jsxs12(Text13, { children: [
7592
+ /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", children: [
7593
+ /* @__PURE__ */ jsxs13(Text14, { children: [
7517
7594
  "\u250C",
7518
7595
  "\u2500".repeat(GAME_WIDTH),
7519
7596
  "\u2510"
7520
7597
  ] }),
7521
- /* @__PURE__ */ jsx12(Text13, { children: selectingLevel ? " \x1B[90m\u9009\u62E9\u5173\u5361\u540E\u5F00\u59CB...\x1B[0m" : board }),
7522
- /* @__PURE__ */ jsxs12(Text13, { children: [
7598
+ /* @__PURE__ */ jsx13(Text14, { children: selectingLevel ? " \x1B[90m\u9009\u62E9\u5173\u5361\u540E\u5F00\u59CB...\x1B[0m" : board }),
7599
+ /* @__PURE__ */ jsxs13(Text14, { children: [
7523
7600
  "\u2514",
7524
7601
  "\u2500".repeat(GAME_WIDTH),
7525
7602
  "\u2518"
7526
7603
  ] })
7527
7604
  ] }),
7528
- selectingLevel && /* @__PURE__ */ jsxs12(Box12, { marginTop: 1, flexDirection: "column", children: [
7529
- /* @__PURE__ */ jsx12(Text13, { bold: true, color: "yellow", children: "\u9009\u62E9\u5173\u5361" }),
7530
- /* @__PURE__ */ jsx12(Box12, { flexDirection: "row", flexWrap: "wrap", children: LEVELS.map((lv, i) => /* @__PURE__ */ jsx12(Box12, { width: 22, children: /* @__PURE__ */ jsxs12(Text13, { children: [
7531
- /* @__PURE__ */ jsx12(Text13, { color: initialLevel === i + 1 ? "green" : "white", children: i + 1 === 10 ? "0" : String(i + 1) }),
7605
+ selectingLevel && /* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
7606
+ /* @__PURE__ */ jsx13(Text14, { bold: true, color: "yellow", children: "\u9009\u62E9\u5173\u5361" }),
7607
+ /* @__PURE__ */ jsx13(Box13, { flexDirection: "row", flexWrap: "wrap", children: LEVELS.map((lv, i) => /* @__PURE__ */ jsx13(Box13, { width: 22, children: /* @__PURE__ */ jsxs13(Text14, { children: [
7608
+ /* @__PURE__ */ jsx13(Text14, { color: initialLevel === i + 1 ? "green" : "white", children: i + 1 === 10 ? "0" : String(i + 1) }),
7532
7609
  ". ",
7533
7610
  lv.desc,
7534
7611
  " (",
@@ -7537,16 +7614,16 @@ function BrickBreakerGame({ onExit: _onExit }) {
7537
7614
  lv.cols,
7538
7615
  ")"
7539
7616
  ] }) }, i)) }),
7540
- /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: "\u6309\u6570\u5B57\u9009\u5173 q \u9000\u51FA" }) })
7617
+ /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6309\u6570\u5B57\u9009\u5173 q \u9000\u51FA" }) })
7541
7618
  ] }),
7542
- !selectingLevel && (s.gameOver || s.win) && /* @__PURE__ */ jsxs12(Box12, { marginTop: 1, children: [
7543
- /* @__PURE__ */ jsx12(Text13, { bold: true, color: s.gameOver ? "red" : "green", children: s.gameOver ? "\u6E38\u620F\u7ED3\u675F\uFF01" : "\u606D\u559C\u901A\u5173\uFF01" }),
7544
- /* @__PURE__ */ jsxs12(Text13, { children: [
7619
+ !selectingLevel && (s.gameOver || s.win) && /* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
7620
+ /* @__PURE__ */ jsx13(Text14, { bold: true, color: s.gameOver ? "red" : "green", children: s.gameOver ? "\u6E38\u620F\u7ED3\u675F\uFF01" : "\u606D\u559C\u901A\u5173\uFF01" }),
7621
+ /* @__PURE__ */ jsxs13(Text14, { children: [
7545
7622
  " \u5206\u6570: ",
7546
- /* @__PURE__ */ jsx12(Text13, { color: "yellow", children: s.score })
7623
+ /* @__PURE__ */ jsx13(Text14, { color: "yellow", children: s.score })
7547
7624
  ] })
7548
7625
  ] }),
7549
- !selectingLevel && /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: s.gameOver || s.win ? /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: "\u2190 \u2192 \u79FB\u52A8 r \u91CD\u5F00 l \u9009\u5173 q \u9000\u51FA" }) : /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: "\u2190 \u2192 \u79FB\u52A8 p \u6682\u505C q \u9000\u51FA" }) })
7626
+ !selectingLevel && /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: s.gameOver || s.win ? /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u2190 \u2192 \u79FB\u52A8 r \u91CD\u5F00 l \u9009\u5173 q \u9000\u51FA" }) : /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u2190 \u2192 \u79FB\u52A8 p \u6682\u505C q \u9000\u51FA" }) })
7550
7627
  ] });
7551
7628
  }
7552
7629
  var brick_breaker_default = {
@@ -7556,7 +7633,7 @@ var brick_breaker_default = {
7556
7633
  play: async () => {
7557
7634
  await new Promise((resolve2) => {
7558
7635
  const { unmount } = render2(
7559
- /* @__PURE__ */ jsx12(BrickBreakerGame, { onExit: () => {
7636
+ /* @__PURE__ */ jsx13(BrickBreakerGame, { onExit: () => {
7560
7637
  unmount();
7561
7638
  resolve2();
7562
7639
  } })
@@ -7566,9 +7643,9 @@ var brick_breaker_default = {
7566
7643
  };
7567
7644
 
7568
7645
  // src/game/coder-check/index.tsx
7569
- import { Box as Box13, Text as Text14, useInput as useInput4, render as render3 } from "ink";
7570
- import { useState as useState7, useEffect as useEffect6, useRef as useRef5, useCallback as useCallback5 } from "react";
7571
- import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
7646
+ import { Box as Box14, Text as Text15, useInput as useInput4, render as render3 } from "ink";
7647
+ import { useState as useState8, useEffect as useEffect7, useRef as useRef6, useCallback as useCallback5 } from "react";
7648
+ import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
7572
7649
  var GAME_W = 66;
7573
7650
  var GAME_H = 20;
7574
7651
  var SCORE_H = 6;
@@ -7959,18 +8036,18 @@ function buildGameView(s, scoreLines, scoreColor, message) {
7959
8036
  return rows;
7960
8037
  }
7961
8038
  function CoderCheck({ onExit: _onExit }) {
7962
- const stateRef = useRef5(createInitialState2());
7963
- const [tick2, setTick] = useState7(0);
7964
- const [colorOffset, setColorOffset] = useState7(0);
7965
- const onExitRef = useRef5(_onExit);
8039
+ const stateRef = useRef6(createInitialState2());
8040
+ const [tick2, setTick] = useState8(0);
8041
+ const [colorOffset, setColorOffset] = useState8(0);
8042
+ const onExitRef = useRef6(_onExit);
7966
8043
  onExitRef.current = _onExit;
7967
- useEffect6(() => {
8044
+ useEffect7(() => {
7968
8045
  const timer = setInterval(() => {
7969
8046
  setColorOffset((prev) => (prev + 1) % CYBER_PALETTE2.length);
7970
8047
  }, 400);
7971
8048
  return () => clearInterval(timer);
7972
8049
  }, []);
7973
- useEffect6(() => {
8050
+ useEffect7(() => {
7974
8051
  const interval = setInterval(() => {
7975
8052
  update2(stateRef.current);
7976
8053
  setTick((t) => t + 1);
@@ -8039,44 +8116,44 @@ function CoderCheck({ onExit: _onExit }) {
8039
8116
  const scoreLines = buildScoreLines(scoreStr);
8040
8117
  const view = buildGameView(s, scoreLines, scoreColor, s.message);
8041
8118
  void tick2;
8042
- return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingX: 1, children: [
8043
- /* @__PURE__ */ jsx13(Box13, { flexDirection: "row", children: /* @__PURE__ */ jsxs13(Text14, { children: [
8119
+ return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 1, children: [
8120
+ /* @__PURE__ */ jsx14(Box14, { flexDirection: "row", children: /* @__PURE__ */ jsxs14(Text15, { children: [
8044
8121
  "\u751F\u547D ",
8045
- /* @__PURE__ */ jsx13(Text14, { color: "red", children: "\u2665".repeat(Math.max(0, s.lives)) }),
8122
+ /* @__PURE__ */ jsx14(Text15, { color: "red", children: "\u2665".repeat(Math.max(0, s.lives)) }),
8046
8123
  " ",
8047
8124
  "\u901F\u5EA6 ",
8048
- /* @__PURE__ */ jsxs13(Text14, { color: "cyan", children: [
8125
+ /* @__PURE__ */ jsxs14(Text15, { color: "cyan", children: [
8049
8126
  "Lv.",
8050
8127
  Math.floor(s.speed * 10)
8051
8128
  ] })
8052
8129
  ] }) }),
8053
- !s.gameOver && s.target && /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsxs13(Text14, { children: [
8130
+ !s.gameOver && s.target && /* @__PURE__ */ jsx14(Box14, { marginTop: 1, children: /* @__PURE__ */ jsxs14(Text15, { children: [
8054
8131
  "\u6253\u5B57: ",
8055
- /* @__PURE__ */ jsx13(Text14, { color: "green", children: s.typed }),
8056
- /* @__PURE__ */ jsx13(Text14, { color: "white", children: s.target.slice(s.typed.length) })
8132
+ /* @__PURE__ */ jsx14(Text15, { color: "green", children: s.typed }),
8133
+ /* @__PURE__ */ jsx14(Text15, { color: "white", children: s.target.slice(s.typed.length) })
8057
8134
  ] }) }),
8058
- /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", marginTop: 1, children: [
8059
- /* @__PURE__ */ jsxs13(Text14, { children: [
8135
+ /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", marginTop: 1, children: [
8136
+ /* @__PURE__ */ jsxs14(Text15, { children: [
8060
8137
  "\u250C",
8061
8138
  "\u2500".repeat(GAME_W),
8062
8139
  "\u2510"
8063
8140
  ] }),
8064
- view.map((row, i) => /* @__PURE__ */ jsx13(Text14, { children: `\u2502${row}\u2502` }, i)),
8065
- /* @__PURE__ */ jsxs13(Text14, { children: [
8141
+ view.map((row, i) => /* @__PURE__ */ jsx14(Text15, { children: `\u2502${row}\u2502` }, i)),
8142
+ /* @__PURE__ */ jsxs14(Text15, { children: [
8066
8143
  "\u2514",
8067
8144
  "\u2500".repeat(GAME_W),
8068
8145
  "\u2518"
8069
8146
  ] })
8070
8147
  ] }),
8071
- s.gameOver && /* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
8072
- /* @__PURE__ */ jsx13(Text14, { bold: true, color: "red", children: "\u6E38\u620F\u7ED3\u675F\uFF01" }),
8073
- /* @__PURE__ */ jsxs13(Text14, { children: [
8148
+ s.gameOver && /* @__PURE__ */ jsxs14(Box14, { marginTop: 1, children: [
8149
+ /* @__PURE__ */ jsx14(Text15, { bold: true, color: "red", children: "\u6E38\u620F\u7ED3\u675F\uFF01" }),
8150
+ /* @__PURE__ */ jsxs14(Text15, { children: [
8074
8151
  " \u5F97\u5206: ",
8075
- /* @__PURE__ */ jsx13(Text14, { color: "yellow", children: s.score }),
8152
+ /* @__PURE__ */ jsx14(Text15, { color: "yellow", children: s.score }),
8076
8153
  " r \u91CD\u5F00 q \u9000\u51FA"
8077
8154
  ] })
8078
8155
  ] }),
8079
- /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6253\u5B57\u6D88\u9664\u5355\u8BCD \u7A7A\u683C/Ctrl+P\u6682\u505C Ctrl+Q\u9000\u51FA" }) })
8156
+ /* @__PURE__ */ jsx14(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: "\u6253\u5B57\u6D88\u9664\u5355\u8BCD \u7A7A\u683C/Ctrl+P\u6682\u505C Ctrl+Q\u9000\u51FA" }) })
8080
8157
  ] });
8081
8158
  }
8082
8159
  var coder_check_default = {
@@ -8086,7 +8163,7 @@ var coder_check_default = {
8086
8163
  play: async () => {
8087
8164
  await new Promise((resolve2) => {
8088
8165
  const { unmount } = render3(
8089
- /* @__PURE__ */ jsx13(CoderCheck, { onExit: () => {
8166
+ /* @__PURE__ */ jsx14(CoderCheck, { onExit: () => {
8090
8167
  unmount();
8091
8168
  resolve2();
8092
8169
  } })
@@ -8466,12 +8543,12 @@ import { render as render4 } from "ink";
8466
8543
  import chalk5 from "chalk";
8467
8544
 
8468
8545
  // src/stock/StockList.tsx
8469
- import { Box as Box14, Text as Text15, useInput as useInput5 } from "ink";
8470
- import { useState as useState8, useCallback as useCallback6, useEffect as useEffect7, useMemo as useMemo2 } from "react";
8546
+ import { Box as Box15, Text as Text16, useInput as useInput5 } from "ink";
8547
+ import { useState as useState9, useCallback as useCallback6, useEffect as useEffect8, useMemo as useMemo2 } from "react";
8471
8548
  import asciichart from "asciichart";
8472
8549
  import os from "os";
8473
8550
  import { join as join10 } from "path";
8474
- import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
8551
+ import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
8475
8552
  var SETTINGS_PATH = join10(os.homedir(), ".dskcode", "settings.json");
8476
8553
  function toFileUrl(p) {
8477
8554
  const norm = p.replace(/\\/g, "/");
@@ -8574,20 +8651,20 @@ function latestPoints(data, maxPoints = 60) {
8574
8651
  return data.slice(data.length - maxPoints);
8575
8652
  }
8576
8653
  function StockList({ codes, onExit, onBackToChat }) {
8577
- const [stocks, setStocks] = useState8([]);
8578
- const [selectedIndex, setSelectedIndex] = useState8(0);
8579
- const [loading, setLoading] = useState8(true);
8580
- const [lastUpdate, setLastUpdate] = useState8("");
8581
- const [detailView, setDetailView] = useState8(null);
8582
- const [detailPrices, setDetailPrices] = useState8(null);
8583
- const [detailLoading, setDetailLoading] = useState8(false);
8584
- const [detailCountdown, setDetailCountdown] = useState8(10);
8585
- const [countdown, setCountdown] = useState8(5);
8586
- const [currentTime, setCurrentTime] = useState8(
8654
+ const [stocks, setStocks] = useState9([]);
8655
+ const [selectedIndex, setSelectedIndex] = useState9(0);
8656
+ const [loading, setLoading] = useState9(true);
8657
+ const [lastUpdate, setLastUpdate] = useState9("");
8658
+ const [detailView, setDetailView] = useState9(null);
8659
+ const [detailPrices, setDetailPrices] = useState9(null);
8660
+ const [detailLoading, setDetailLoading] = useState9(false);
8661
+ const [detailCountdown, setDetailCountdown] = useState9(10);
8662
+ const [countdown, setCountdown] = useState9(5);
8663
+ const [currentTime, setCurrentTime] = useState9(
8587
8664
  () => (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour12: false })
8588
8665
  );
8589
- const [dimMode, setDimMode] = useState8(false);
8590
- const [sortOrder, setSortOrder] = useState8("default");
8666
+ const [dimMode, setDimMode] = useState9(false);
8667
+ const [sortOrder, setSortOrder] = useState9("default");
8591
8668
  const sortedStocks = useMemo2(() => {
8592
8669
  if (sortOrder === "default") return stocks;
8593
8670
  return [...stocks].toSorted(
@@ -8595,7 +8672,7 @@ function StockList({ codes, onExit, onBackToChat }) {
8595
8672
  );
8596
8673
  }, [stocks, sortOrder]);
8597
8674
  const { doubleCtrlC, handleCtrlC } = useDoubleCtrlC(onExit);
8598
- useEffect7(() => {
8675
+ useEffect8(() => {
8599
8676
  const timer = setInterval(() => {
8600
8677
  setCurrentTime((/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour12: false }));
8601
8678
  }, 1e3);
@@ -8611,10 +8688,10 @@ function StockList({ codes, onExit, onBackToChat }) {
8611
8688
  }
8612
8689
  setLoading(false);
8613
8690
  }, [codes]);
8614
- useEffect7(() => {
8691
+ useEffect8(() => {
8615
8692
  void loadData();
8616
8693
  }, [loadData]);
8617
- useEffect7(() => {
8694
+ useEffect8(() => {
8618
8695
  const interval = setInterval(() => {
8619
8696
  setCountdown((prev) => {
8620
8697
  if (prev <= 1) {
@@ -8626,7 +8703,7 @@ function StockList({ codes, onExit, onBackToChat }) {
8626
8703
  }, 1e3);
8627
8704
  return () => clearInterval(interval);
8628
8705
  }, [loadData]);
8629
- useEffect7(() => {
8706
+ useEffect8(() => {
8630
8707
  if (detailView) {
8631
8708
  const loadDetail = () => {
8632
8709
  minuteCache.delete(detailView.code);
@@ -8645,7 +8722,7 @@ function StockList({ codes, onExit, onBackToChat }) {
8645
8722
  setDetailPrices(null);
8646
8723
  setDetailLoading(false);
8647
8724
  }, [detailView]);
8648
- useEffect7(() => {
8725
+ useEffect8(() => {
8649
8726
  if (!detailView) return;
8650
8727
  const timer = setInterval(() => {
8651
8728
  setDetailCountdown((prev) => prev > 0 ? prev - 1 : 10);
@@ -8690,64 +8767,64 @@ function StockList({ codes, onExit, onBackToChat }) {
8690
8767
  );
8691
8768
  if (detailView) {
8692
8769
  if (detailLoading) {
8693
- return /* @__PURE__ */ jsx14(Box14, { paddingLeft: 1, children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: " \u27F3 \u52A0\u8F7D\u5206\u65F6\u6570\u636E..." }) });
8770
+ return /* @__PURE__ */ jsx15(Box15, { paddingLeft: 1, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: " \u27F3 \u52A0\u8F7D\u5206\u65F6\u6570\u636E..." }) });
8694
8771
  }
8695
8772
  return renderDetail(detailView, () => setDetailView(null), detailPrices ?? void 0, detailCountdown, currentTime);
8696
8773
  }
8697
8774
  const cp2 = (c) => dimMode ? { dimColor: true } : { color: c };
8698
- return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
8699
- /* @__PURE__ */ jsxs14(Box14, { marginBottom: 1, justifyContent: "space-between", children: [
8700
- /* @__PURE__ */ jsx14(Text15, { bold: true, ...cp2("#00ffff"), children: " \u{1F4C8} \u81EA\u9009\u80A1\u76D1\u63A7" }),
8701
- /* @__PURE__ */ jsxs14(Text15, { dimColor: true, children: [
8775
+ return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", children: [
8776
+ /* @__PURE__ */ jsxs15(Box15, { marginBottom: 1, justifyContent: "space-between", children: [
8777
+ /* @__PURE__ */ jsx15(Text16, { bold: true, ...cp2("#00ffff"), children: " \u{1F4C8} \u81EA\u9009\u80A1\u76D1\u63A7" }),
8778
+ /* @__PURE__ */ jsxs15(Text16, { dimColor: true, children: [
8702
8779
  " \u{1F550} ",
8703
8780
  currentTime
8704
8781
  ] }),
8705
- /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: loading ? " \u27F3 \u5237\u65B0\u4E2D..." : ` ${countdown}s \u540E\u81EA\u52A8\u5237\u65B0` })
8782
+ /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: loading ? " \u27F3 \u5237\u65B0\u4E2D..." : ` ${countdown}s \u540E\u81EA\u52A8\u5237\u65B0` })
8706
8783
  ] }),
8707
- /* @__PURE__ */ jsxs14(Box14, { children: [
8708
- /* @__PURE__ */ jsx14(Box14, { width: 3 }),
8709
- /* @__PURE__ */ jsx14(Box14, { width: 9, children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: "\u4EE3\u7801" }) }),
8710
- /* @__PURE__ */ jsx14(Box14, { width: 16, children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: "\u540D\u79F0" }) }),
8711
- /* @__PURE__ */ jsx14(Box14, { width: 12, children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: "\u6700\u65B0\u4EF7" }) }),
8712
- /* @__PURE__ */ jsx14(Box14, { width: 12, children: /* @__PURE__ */ jsxs14(Text15, { dimColor: true, children: [
8784
+ /* @__PURE__ */ jsxs15(Box15, { children: [
8785
+ /* @__PURE__ */ jsx15(Box15, { width: 3 }),
8786
+ /* @__PURE__ */ jsx15(Box15, { width: 9, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u4EE3\u7801" }) }),
8787
+ /* @__PURE__ */ jsx15(Box15, { width: 16, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u540D\u79F0" }) }),
8788
+ /* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u6700\u65B0\u4EF7" }) }),
8789
+ /* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsxs15(Text16, { dimColor: true, children: [
8713
8790
  "\u6DA8\u8DCC\u5E45",
8714
8791
  sortOrder === "desc" ? " \u25BC" : sortOrder === "asc" ? " \u25B2" : ""
8715
8792
  ] }) }),
8716
- /* @__PURE__ */ jsx14(Box14, { width: 12, children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: "\u6DA8\u8DCC\u989D" }) }),
8717
- /* @__PURE__ */ jsx14(Box14, { width: 12, children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: "\u6700\u9AD8" }) }),
8718
- /* @__PURE__ */ jsx14(Box14, { width: 12, children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: "\u6700\u4F4E" }) }),
8719
- /* @__PURE__ */ jsx14(Box14, { children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: "\u6210\u4EA4\u989D" }) })
8793
+ /* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u6DA8\u8DCC\u989D" }) }),
8794
+ /* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u6700\u9AD8" }) }),
8795
+ /* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u6700\u4F4E" }) }),
8796
+ /* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u6210\u4EA4\u989D" }) })
8720
8797
  ] }),
8721
- /* @__PURE__ */ jsx14(Box14, { children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: " " + "\u2500".repeat(100) }) }),
8722
- /* @__PURE__ */ jsx14(Box14, { flexDirection: "column", children: sortedStocks.map((stock, index) => {
8798
+ /* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: " " + "\u2500".repeat(100) }) }),
8799
+ /* @__PURE__ */ jsx15(Box15, { flexDirection: "column", children: sortedStocks.map((stock, index) => {
8723
8800
  const isSelected = index === selectedIndex;
8724
8801
  const isUp = stock.changePercent >= 0;
8725
8802
  const color = isUp ? "#ff1493" : "#00ff41";
8726
- return /* @__PURE__ */ jsxs14(Box14, { children: [
8727
- /* @__PURE__ */ jsx14(Box14, { width: 3, flexShrink: 0, children: isSelected ? /* @__PURE__ */ jsx14(Text15, { bold: true, ...cp2("#00ffff"), children: "\u25B8 " }) : /* @__PURE__ */ jsx14(Text15, { children: " " }) }),
8728
- /* @__PURE__ */ jsx14(Box14, { width: 9, children: /* @__PURE__ */ jsx14(Text15, { bold: true, ...cp2(isSelected ? "#00ffff" : "#ffffff"), children: stock.code }) }),
8729
- /* @__PURE__ */ jsx14(Box14, { width: 16, children: /* @__PURE__ */ jsx14(Text15, { ...cp2(isSelected ? "#ffffff" : "#cccccc"), children: stock.name }) }),
8730
- /* @__PURE__ */ jsx14(Box14, { width: 12, children: /* @__PURE__ */ jsx14(Text15, { bold: true, ...cp2(color), children: formatPrice(stock.price) }) }),
8731
- /* @__PURE__ */ jsx14(Box14, { width: 12, children: /* @__PURE__ */ jsxs14(Text15, { ...cp2(color), children: [
8803
+ return /* @__PURE__ */ jsxs15(Box15, { children: [
8804
+ /* @__PURE__ */ jsx15(Box15, { width: 3, flexShrink: 0, children: isSelected ? /* @__PURE__ */ jsx15(Text16, { bold: true, ...cp2("#00ffff"), children: "\u25B8 " }) : /* @__PURE__ */ jsx15(Text16, { children: " " }) }),
8805
+ /* @__PURE__ */ jsx15(Box15, { width: 9, children: /* @__PURE__ */ jsx15(Text16, { bold: true, ...cp2(isSelected ? "#00ffff" : "#ffffff"), children: stock.code }) }),
8806
+ /* @__PURE__ */ jsx15(Box15, { width: 16, children: /* @__PURE__ */ jsx15(Text16, { ...cp2(isSelected ? "#ffffff" : "#cccccc"), children: stock.name }) }),
8807
+ /* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { bold: true, ...cp2(color), children: formatPrice(stock.price) }) }),
8808
+ /* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsxs15(Text16, { ...cp2(color), children: [
8732
8809
  isUp ? "+" : "",
8733
8810
  stock.changePercent.toFixed(2),
8734
8811
  "%"
8735
8812
  ] }) }),
8736
- /* @__PURE__ */ jsx14(Box14, { width: 12, children: /* @__PURE__ */ jsxs14(Text15, { ...cp2(color), children: [
8813
+ /* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsxs15(Text16, { ...cp2(color), children: [
8737
8814
  isUp ? "+" : "",
8738
8815
  stock.changeAmount.toFixed(3)
8739
8816
  ] }) }),
8740
- /* @__PURE__ */ jsx14(Box14, { width: 12, children: /* @__PURE__ */ jsx14(Text15, { ...cp2("#cccccc"), children: formatPrice(stock.high) }) }),
8741
- /* @__PURE__ */ jsx14(Box14, { width: 12, children: /* @__PURE__ */ jsx14(Text15, { ...cp2("#888888"), children: formatPrice(stock.low) }) }),
8742
- /* @__PURE__ */ jsx14(Box14, { children: /* @__PURE__ */ jsx14(Text15, { ...cp2("#888888"), children: formatAmount(stock.amount) }) })
8817
+ /* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { ...cp2("#cccccc"), children: formatPrice(stock.high) }) }),
8818
+ /* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { ...cp2("#888888"), children: formatPrice(stock.low) }) }),
8819
+ /* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsx15(Text16, { ...cp2("#888888"), children: formatAmount(stock.amount) }) })
8743
8820
  ] }, stock.code);
8744
8821
  }) }),
8745
- /* @__PURE__ */ jsx14(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: ` \u2191/\u2193 \u9009\u62E9 Enter \u8BE6\u60C5 r \u624B\u52A8\u5237\u65B0 o \u6392\u5E8F h \u7F6E\u7070/\u6062\u590D q \u8FD4\u56DE` }) }),
8746
- /* @__PURE__ */ jsxs14(Box14, { children: [
8747
- /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: ` \u6700\u540E\u66F4\u65B0: ${lastUpdate} \u7F16\u8F91\u81EA\u9009\u80A1: ` }),
8748
- /* @__PURE__ */ jsx14(Text15, { ...cp2("#c792ea"), children: osc8Link(toFileUrl(SETTINGS_PATH), SETTINGS_PATH) })
8822
+ /* @__PURE__ */ jsx15(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: ` \u2191/\u2193 \u9009\u62E9 Enter \u8BE6\u60C5 r \u624B\u52A8\u5237\u65B0 o \u6392\u5E8F h \u7F6E\u7070/\u6062\u590D q \u8FD4\u56DE` }) }),
8823
+ /* @__PURE__ */ jsxs15(Box15, { children: [
8824
+ /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: ` \u6700\u540E\u66F4\u65B0: ${lastUpdate} \u7F16\u8F91\u81EA\u9009\u80A1: ` }),
8825
+ /* @__PURE__ */ jsx15(Text16, { ...cp2("#c792ea"), children: osc8Link(toFileUrl(SETTINGS_PATH), SETTINGS_PATH) })
8749
8826
  ] }),
8750
- doubleCtrlC && /* @__PURE__ */ jsx14(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text15, { bold: true, ...cp2("#ff1493"), children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) })
8827
+ doubleCtrlC && /* @__PURE__ */ jsx15(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx15(Text16, { bold: true, ...cp2("#ff1493"), children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) })
8751
8828
  ] });
8752
8829
  }
8753
8830
  function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {
@@ -8765,33 +8842,33 @@ function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {
8765
8842
  raw = raw.replaceAll("\u256D", "\u250C").replaceAll("\u256E", "\u2510").replaceAll("\u2570", "\u2514").replaceAll("\u256F", "\u2518");
8766
8843
  chartLines = raw.split("\n");
8767
8844
  }
8768
- return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingLeft: 1, children: [
8769
- /* @__PURE__ */ jsxs14(Box14, { marginBottom: 1, justifyContent: "space-between", children: [
8770
- /* @__PURE__ */ jsxs14(Box14, { children: [
8771
- /* @__PURE__ */ jsxs14(Text15, { bold: true, color: "#00ffff", children: [
8845
+ return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", paddingLeft: 1, children: [
8846
+ /* @__PURE__ */ jsxs15(Box15, { marginBottom: 1, justifyContent: "space-between", children: [
8847
+ /* @__PURE__ */ jsxs15(Box15, { children: [
8848
+ /* @__PURE__ */ jsxs15(Text16, { bold: true, color: "#00ffff", children: [
8772
8849
  " \u{1F4CA} ",
8773
8850
  stock.name,
8774
8851
  " "
8775
8852
  ] }),
8776
- /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: stock.code }),
8777
- currentTime && /* @__PURE__ */ jsxs14(Text15, { dimColor: true, children: [
8853
+ /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: stock.code }),
8854
+ currentTime && /* @__PURE__ */ jsxs15(Text16, { dimColor: true, children: [
8778
8855
  " \u{1F550} ",
8779
8856
  currentTime
8780
8857
  ] })
8781
8858
  ] }),
8782
- /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: `${countdown}s \u540E\u5237\u65B0` })
8859
+ /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: `${countdown}s \u540E\u5237\u65B0` })
8783
8860
  ] }),
8784
- /* @__PURE__ */ jsxs14(Box14, { children: [
8785
- /* @__PURE__ */ jsx14(Box14, { width: 16, children: /* @__PURE__ */ jsx14(Text15, { bold: true, color: "#888888", children: "\u5F53\u524D\u4EF7" }) }),
8786
- /* @__PURE__ */ jsx14(Box14, { children: /* @__PURE__ */ jsxs14(Text15, { bold: true, color: colorCode, children: [
8861
+ /* @__PURE__ */ jsxs15(Box15, { children: [
8862
+ /* @__PURE__ */ jsx15(Box15, { width: 16, children: /* @__PURE__ */ jsx15(Text16, { bold: true, color: "#888888", children: "\u5F53\u524D\u4EF7" }) }),
8863
+ /* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsxs15(Text16, { bold: true, color: colorCode, children: [
8787
8864
  arrow,
8788
8865
  " ",
8789
8866
  formatPrice(stock.price)
8790
8867
  ] }) })
8791
8868
  ] }),
8792
- /* @__PURE__ */ jsxs14(Box14, { children: [
8793
- /* @__PURE__ */ jsx14(Box14, { width: 16, children: /* @__PURE__ */ jsx14(Text15, { color: "#888888", children: "\u6DA8\u8DCC\u5E45" }) }),
8794
- /* @__PURE__ */ jsx14(Box14, { children: /* @__PURE__ */ jsxs14(Text15, { color: colorCode, children: [
8869
+ /* @__PURE__ */ jsxs15(Box15, { children: [
8870
+ /* @__PURE__ */ jsx15(Box15, { width: 16, children: /* @__PURE__ */ jsx15(Text16, { color: "#888888", children: "\u6DA8\u8DCC\u5E45" }) }),
8871
+ /* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsxs15(Text16, { color: colorCode, children: [
8795
8872
  isUp ? "+" : "",
8796
8873
  stock.changePercent.toFixed(2),
8797
8874
  "%",
@@ -8800,8 +8877,8 @@ function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {
8800
8877
  stock.changeAmount.toFixed(3)
8801
8878
  ] }) })
8802
8879
  ] }),
8803
- chartLines.length > 0 && /* @__PURE__ */ jsx14(Box14, { marginTop: 1, flexDirection: "column", children: chartLines.map((line, i) => /* @__PURE__ */ jsx14(Box14, { children: /* @__PURE__ */ jsx14(Text15, { color: colorCode, children: line || " " }) }, i)) }),
8804
- /* @__PURE__ */ jsx14(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text15, { dimColor: true, children: " Space/q \u8FD4\u56DE\u5217\u8868" }) })
8880
+ chartLines.length > 0 && /* @__PURE__ */ jsx15(Box15, { marginTop: 1, flexDirection: "column", children: chartLines.map((line, i) => /* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsx15(Text16, { color: colorCode, children: line || " " }) }, i)) }),
8881
+ /* @__PURE__ */ jsx15(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: " Space/q \u8FD4\u56DE\u5217\u8868" }) })
8805
8882
  ] });
8806
8883
  }
8807
8884
 
@@ -8886,7 +8963,7 @@ async function scanProjectFiles(baseDir, dir) {
8886
8963
  }
8887
8964
 
8888
8965
  // src/cli/index.tsx
8889
- import { jsx as jsx15 } from "react/jsx-runtime";
8966
+ import { jsx as jsx16 } from "react/jsx-runtime";
8890
8967
  var SUBCOMMANDS = ["chat", "run", "setup", "init", "completion", "game", "stock"];
8891
8968
  function createCli() {
8892
8969
  const program2 = new Command();
@@ -8988,7 +9065,7 @@ compdef _dskcode_completion dskcode`);
8988
9065
  const freshResult = await loadAndValidate();
8989
9066
  const codeList = codes && codes.length > 0 ? codes : freshResult.config.stock?.symbols?.map((s) => s.code) ?? ["sh000001", "sz399006", "sh601688"];
8990
9067
  const app = renderApp(
8991
- /* @__PURE__ */ jsx15(
9068
+ /* @__PURE__ */ jsx16(
8992
9069
  StockList,
8993
9070
  {
8994
9071
  codes: codeList,
@@ -9017,7 +9094,7 @@ compdef _dskcode_completion dskcode`);
9017
9094
  }
9018
9095
  const selectedGame = await new Promise((resolve2) => {
9019
9096
  const { unmount } = render4(
9020
- /* @__PURE__ */ jsx15(
9097
+ /* @__PURE__ */ jsx16(
9021
9098
  GamePicker,
9022
9099
  {
9023
9100
  games,
@@ -9057,7 +9134,7 @@ async function startChat(ctx, costTracker) {
9057
9134
  );
9058
9135
  const model = defaultProvider?.model ?? "deepseek-v4-flash";
9059
9136
  const chatApp = renderApp(
9060
- /* @__PURE__ */ jsx15(
9137
+ /* @__PURE__ */ jsx16(
9061
9138
  ChatSession,
9062
9139
  {
9063
9140
  skillCount,
@@ -9075,7 +9152,7 @@ async function startChat(ctx, costTracker) {
9075
9152
  initGames();
9076
9153
  const games = listGames();
9077
9154
  const { unmount } = render4(
9078
- /* @__PURE__ */ jsx15(
9155
+ /* @__PURE__ */ jsx16(
9079
9156
  GamePicker,
9080
9157
  {
9081
9158
  games,
@@ -9099,7 +9176,7 @@ async function startChat(ctx, costTracker) {
9099
9176
  setImmediate(() => {
9100
9177
  const defaultStockCodes = ctx?.config.stock?.symbols?.map((s) => s.code) ?? ["sh000001", "sz399006", "sh601688"];
9101
9178
  const stockApp = renderApp(
9102
- /* @__PURE__ */ jsx15(
9179
+ /* @__PURE__ */ jsx16(
9103
9180
  StockList,
9104
9181
  {
9105
9182
  codes: defaultStockCodes,