dskcode 0.1.35 → 0.1.37
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 +639 -599
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
808
|
+
import { Box as Box11, Text as Text12, useInput, Static } from "ink";
|
|
809
809
|
import TextInput from "ink-text-input";
|
|
810
|
-
import { useEffect as
|
|
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) &&
|
|
1812
|
+
if (!content && (!toolCalls || toolCalls.length === 0) && !isStreaming) {
|
|
1914
1813
|
return null;
|
|
1915
1814
|
}
|
|
1916
|
-
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
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.
|
|
1987
|
+
version: "0.1.37",
|
|
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
|
|
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: "\
|
|
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,41 +6059,44 @@ function ChatSession({
|
|
|
6061
6059
|
onLaunchStock
|
|
6062
6060
|
}) {
|
|
6063
6061
|
const termWidth = typeof process.stdout.columns === "number" ? process.stdout.columns : 80;
|
|
6064
|
-
const
|
|
6065
|
-
const
|
|
6066
|
-
const
|
|
6067
|
-
const [
|
|
6068
|
-
const [
|
|
6069
|
-
const [
|
|
6070
|
-
const [
|
|
6071
|
-
const [
|
|
6072
|
-
const [
|
|
6073
|
-
const [
|
|
6074
|
-
const [
|
|
6075
|
-
const [
|
|
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] =
|
|
6079
|
-
const gradientPhaseRef =
|
|
6080
|
-
const [streamingGradientColors, setStreamingGradientColors] =
|
|
6081
|
-
const streamingPhaseRef =
|
|
6082
|
-
const [currentContent, setCurrentContent] =
|
|
6083
|
-
const [currentReasoning, setCurrentReasoning] =
|
|
6084
|
-
const [currentToolCalls, setCurrentToolCalls] =
|
|
6085
|
-
const [_currentUsage, setCurrentUsage] =
|
|
6086
|
-
const [_currentElapsed, setCurrentElapsed] =
|
|
6087
|
-
const [_currentCost, setCurrentCost] =
|
|
6088
|
-
const [activeModel, setActiveModel] =
|
|
6089
|
-
const [_streamingModel, setStreamingModel] =
|
|
6090
|
-
const [streamError, setStreamError] =
|
|
6091
|
-
const [todoSnapshot, setTodoSnapshot] =
|
|
6092
|
-
const [todoPanelVisible, setTodoPanelVisible] =
|
|
6093
|
-
const todoHideTimerRef =
|
|
6094
|
-
const
|
|
6095
|
-
const [
|
|
6096
|
-
const [
|
|
6097
|
-
const [
|
|
6098
|
-
const [
|
|
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(
|
|
6099
6100
|
void 0
|
|
6100
6101
|
);
|
|
6101
6102
|
const sessionCost = useMemo(() => {
|
|
@@ -6107,40 +6108,41 @@ function ChatSession({
|
|
|
6107
6108
|
}, 0);
|
|
6108
6109
|
}, [displayMessages]);
|
|
6109
6110
|
const hasConversationStarted = displayMessages.length > 0;
|
|
6111
|
+
const hasReasoningPanel = isStreaming && currentReasoning.length > 0;
|
|
6110
6112
|
const cmdTips = Array.from(getRegisteredCommands()).filter(([name]) => name !== "/exit" && name !== "/quit").map(([name, cmd]) => ({ name, desc: cmd.desc }));
|
|
6111
|
-
const [cmdTipIndex, setCmdTipIndex] =
|
|
6112
|
-
const [cmdTipGradientColors, setCmdTipGradientColors] =
|
|
6113
|
-
const cmdTipPhaseRef =
|
|
6114
|
-
const [skillSelectIndex, setSkillSelectIndex] =
|
|
6115
|
-
const [fileSelectIndex, setFileSelectIndex] =
|
|
6116
|
-
const [inputKey, setInputKey] =
|
|
6117
|
-
const [rewindSelecting, setRewindSelecting] =
|
|
6118
|
-
const [rewindSelectIndex, setRewindSelectIndex] =
|
|
6119
|
-
const [rewindList, setRewindList] =
|
|
6120
|
-
const [rewinding, setRewinding] =
|
|
6121
|
-
const [rewindHintPhase, setRewindHintPhase] =
|
|
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(
|
|
6122
6124
|
"idle"
|
|
6123
6125
|
);
|
|
6124
|
-
const currentRoundModifiedRef =
|
|
6125
|
-
const rewindHintTimerRef =
|
|
6126
|
-
const [selectingModel, setSelectingModel] =
|
|
6127
|
-
const [modelSelectIndex, setModelSelectIndex] =
|
|
6126
|
+
const currentRoundModifiedRef = useRef4(false);
|
|
6127
|
+
const rewindHintTimerRef = useRef4(null);
|
|
6128
|
+
const [selectingModel, setSelectingModel] = useState5(false);
|
|
6129
|
+
const [modelSelectIndex, setModelSelectIndex] = useState5(0);
|
|
6128
6130
|
const modelOptions = ["deepseek-v4-flash", "deepseek-v4-pro"];
|
|
6129
|
-
const sessionRef =
|
|
6130
|
-
const abortRef =
|
|
6131
|
-
const currentContentRef =
|
|
6132
|
-
const currentReasoningRef =
|
|
6133
|
-
const currentToolCallsRef =
|
|
6134
|
-
const currentUsageRef =
|
|
6135
|
-
const currentElapsedRef =
|
|
6136
|
-
const currentCostRef =
|
|
6137
|
-
const currentModelRef =
|
|
6138
|
-
const streamErrorRef =
|
|
6139
|
-
|
|
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(() => {
|
|
6140
6142
|
setSkillSelectIndex(0);
|
|
6141
6143
|
setFileSelectIndex(0);
|
|
6142
6144
|
}, [input]);
|
|
6143
|
-
|
|
6145
|
+
useEffect5(() => {
|
|
6144
6146
|
return () => {
|
|
6145
6147
|
if (rewindHintTimerRef.current) {
|
|
6146
6148
|
clearTimeout(rewindHintTimerRef.current);
|
|
@@ -6148,7 +6150,7 @@ function ChatSession({
|
|
|
6148
6150
|
}
|
|
6149
6151
|
};
|
|
6150
6152
|
}, []);
|
|
6151
|
-
|
|
6153
|
+
useEffect5(() => {
|
|
6152
6154
|
if (todoHideTimerRef.current) {
|
|
6153
6155
|
clearTimeout(todoHideTimerRef.current);
|
|
6154
6156
|
todoHideTimerRef.current = null;
|
|
@@ -6163,6 +6165,7 @@ function ChatSession({
|
|
|
6163
6165
|
if (hasUnfinished) {
|
|
6164
6166
|
setTodoPanelVisible(true);
|
|
6165
6167
|
} else {
|
|
6168
|
+
lastDoneBatchMaxIdRef.current = Math.max(...todoSnapshot.map((it) => it.id));
|
|
6166
6169
|
todoHideTimerRef.current = setTimeout(() => {
|
|
6167
6170
|
setTodoPanelVisible(false);
|
|
6168
6171
|
todoHideTimerRef.current = null;
|
|
@@ -6433,14 +6436,14 @@ function ChatSession({
|
|
|
6433
6436
|
]
|
|
6434
6437
|
)
|
|
6435
6438
|
);
|
|
6436
|
-
|
|
6439
|
+
useEffect5(() => {
|
|
6437
6440
|
if (cmdTips.length <= 1) return;
|
|
6438
6441
|
const timer = setInterval(() => {
|
|
6439
6442
|
setCmdTipIndex((prev) => (prev + 1) % cmdTips.length);
|
|
6440
6443
|
}, 2e3);
|
|
6441
6444
|
return () => clearInterval(timer);
|
|
6442
6445
|
}, [cmdTips.length]);
|
|
6443
|
-
|
|
6446
|
+
useEffect5(() => {
|
|
6444
6447
|
const tip = cmdTips[cmdTipIndex % cmdTips.length];
|
|
6445
6448
|
if (!tip) {
|
|
6446
6449
|
setCmdTipGradientColors([]);
|
|
@@ -6457,13 +6460,13 @@ function ChatSession({
|
|
|
6457
6460
|
}, GRADIENT_ANIMATION.cmdTipInterval);
|
|
6458
6461
|
return () => clearInterval(interval);
|
|
6459
6462
|
}, [cmdTipIndex, cmdTips.length]);
|
|
6460
|
-
|
|
6463
|
+
useEffect5(() => {
|
|
6461
6464
|
const timer = setInterval(() => {
|
|
6462
6465
|
setOffset((prev) => (prev + 1) % CYBER_PALETTE.length);
|
|
6463
6466
|
}, 500);
|
|
6464
6467
|
return () => clearInterval(timer);
|
|
6465
6468
|
}, []);
|
|
6466
|
-
|
|
6469
|
+
useEffect5(() => {
|
|
6467
6470
|
if (!apiKey || !baseUrl) return;
|
|
6468
6471
|
const provider = createProvider({
|
|
6469
6472
|
name: "deepseek",
|
|
@@ -6482,7 +6485,7 @@ function ChatSession({
|
|
|
6482
6485
|
sessionRef.current = null;
|
|
6483
6486
|
};
|
|
6484
6487
|
}, [apiKey, baseUrl, activeModel, externalCostTracker]);
|
|
6485
|
-
|
|
6488
|
+
useEffect5(() => {
|
|
6486
6489
|
if (!apiKey || !baseUrl) return;
|
|
6487
6490
|
let cancelled = false;
|
|
6488
6491
|
setBalanceLoading(true);
|
|
@@ -6507,7 +6510,7 @@ function ChatSession({
|
|
|
6507
6510
|
cancelled = true;
|
|
6508
6511
|
};
|
|
6509
6512
|
}, [apiKey, baseUrl]);
|
|
6510
|
-
|
|
6513
|
+
useEffect5(() => {
|
|
6511
6514
|
if (!externalCostTracker) return;
|
|
6512
6515
|
let cancelled = false;
|
|
6513
6516
|
let timer;
|
|
@@ -6525,7 +6528,7 @@ function ChatSession({
|
|
|
6525
6528
|
if (timer) clearInterval(timer);
|
|
6526
6529
|
};
|
|
6527
6530
|
}, [externalCostTracker]);
|
|
6528
|
-
|
|
6531
|
+
useEffect5(() => {
|
|
6529
6532
|
if (isStreaming || !idlePlaceholder) {
|
|
6530
6533
|
setGradientColors([]);
|
|
6531
6534
|
return;
|
|
@@ -6544,7 +6547,7 @@ function ChatSession({
|
|
|
6544
6547
|
}, GRADIENT_ANIMATION.idleInterval);
|
|
6545
6548
|
return () => clearInterval(interval);
|
|
6546
6549
|
}, [isStreaming, idlePlaceholder]);
|
|
6547
|
-
|
|
6550
|
+
useEffect5(() => {
|
|
6548
6551
|
if (!isStreaming || !streamingPlaceholder) {
|
|
6549
6552
|
setStreamingGradientColors([]);
|
|
6550
6553
|
return;
|
|
@@ -6753,6 +6756,7 @@ function ChatSession({
|
|
|
6753
6756
|
setStreamError(void 0);
|
|
6754
6757
|
process.stdout.write("\x1B[2J\x1B[H\x1B[3J");
|
|
6755
6758
|
sessionRef.current?.reset();
|
|
6759
|
+
lastDoneBatchMaxIdRef.current = -1;
|
|
6756
6760
|
return;
|
|
6757
6761
|
case "navigate":
|
|
6758
6762
|
setInput("");
|
|
@@ -6882,7 +6886,20 @@ function ChatSession({
|
|
|
6882
6886
|
currentToolCallsRef.current = [];
|
|
6883
6887
|
const r = event.result;
|
|
6884
6888
|
if (event.name.startsWith("todo_") && event.todoSnapshot) {
|
|
6885
|
-
|
|
6889
|
+
const snapshot = [...event.todoSnapshot];
|
|
6890
|
+
const allTerminated = snapshot.length > 0 && snapshot.every(
|
|
6891
|
+
(it) => it.status === "done" || it.status === "failed" || it.status === "skipped"
|
|
6892
|
+
);
|
|
6893
|
+
if (allTerminated) {
|
|
6894
|
+
lastDoneBatchMaxIdRef.current = Math.max(...snapshot.map((it) => it.id));
|
|
6895
|
+
setTodoSnapshot(snapshot);
|
|
6896
|
+
} else if (lastDoneBatchMaxIdRef.current >= 0) {
|
|
6897
|
+
setTodoSnapshot(
|
|
6898
|
+
snapshot.filter((it) => it.id > lastDoneBatchMaxIdRef.current)
|
|
6899
|
+
);
|
|
6900
|
+
} else {
|
|
6901
|
+
setTodoSnapshot(snapshot);
|
|
6902
|
+
}
|
|
6886
6903
|
} else {
|
|
6887
6904
|
const line = r.success ? r.summary ?? `\u2705 ${event.name}: ${r.data.slice(0, 500)}${r.data.length > 500 ? "..." : ""}` : `\u274C ${event.name}: ${r.error ?? "\u6267\u884C\u5931\u8D25"}`;
|
|
6888
6905
|
setDisplayMessages((prev) => [
|
|
@@ -6980,251 +6997,274 @@ function ChatSession({
|
|
|
6980
6997
|
rewinding
|
|
6981
6998
|
]
|
|
6982
6999
|
);
|
|
6983
|
-
|
|
7000
|
+
useEffect5(() => {
|
|
6984
7001
|
if (!isStreaming && externalCostTracker) {
|
|
6985
7002
|
setTodayCost(externalCostTracker.todayTotalCost);
|
|
6986
7003
|
}
|
|
6987
7004
|
}, [isStreaming, externalCostTracker]);
|
|
6988
|
-
return /* @__PURE__ */
|
|
6989
|
-
|
|
6990
|
-
/* @__PURE__ */
|
|
6991
|
-
|
|
6992
|
-
const colorIndex = (i + offset) % CYBER_PALETTE.length;
|
|
6993
|
-
return /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsx10(Text11, { bold: true, color: CYBER_PALETTE[colorIndex], children: line }) }, i);
|
|
6994
|
-
}),
|
|
6995
|
-
/* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text11, { color: "#808080", children: [
|
|
6996
|
-
" \u{1F4E6} v",
|
|
6997
|
-
VERSION
|
|
6998
|
-
] }) })
|
|
6999
|
-
] }),
|
|
7000
|
-
/* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", justifyContent: "center", children: [
|
|
7001
|
-
/* @__PURE__ */ jsxs10(Text11, { color: "#00ff41", children: [
|
|
7002
|
-
" \u2714 ",
|
|
7003
|
-
"\u5DF2\u5C31\u7EEA ",
|
|
7004
|
-
skillCount,
|
|
7005
|
-
" \u4E2A Skill"
|
|
7006
|
-
] }),
|
|
7007
|
-
/* @__PURE__ */ jsxs10(Text11, { color: "#00ffff", children: [
|
|
7008
|
-
" \u2139 ",
|
|
7009
|
-
"\u5DF2\u5C31\u7EEA ",
|
|
7010
|
-
toolCount,
|
|
7011
|
-
" \u4E2A\u5DE5\u5177"
|
|
7012
|
-
] }),
|
|
7013
|
-
/* @__PURE__ */ jsxs10(Text11, { color: "#00ffff", children: [
|
|
7014
|
-
" \u{1F527} \u6A21\u578B ",
|
|
7015
|
-
SUPPORTED_MODELS[activeModel]?.displayName ?? activeModel
|
|
7016
|
-
] }),
|
|
7017
|
-
thinkingEnabled && /* @__PURE__ */ jsxs10(Text11, { color: "#ff9800", children: [
|
|
7018
|
-
" \u{1F9E0} \u6DF1\u5EA6\u601D\u8003 ",
|
|
7019
|
-
thinkingEffort === "max" ? "Max" : "High"
|
|
7020
|
-
] }),
|
|
7021
|
-
sessionMode === "plan" && /* @__PURE__ */ jsx10(Text11, { color: "#ff69b4", bold: true, children: " \u{1F4CB} \u8BA1\u5212\u6A21\u5F0F" }),
|
|
7022
|
-
responseFormat === "json_object" && /* @__PURE__ */ jsx10(Text11, { color: "#4caf50", children: " \u{1F4C4} JSON" }),
|
|
7023
|
-
toolChoice !== void 0 && /* @__PURE__ */ jsxs10(Text11, { color: "#e91e63", children: [
|
|
7024
|
-
" \u{1F6E0} ",
|
|
7025
|
-
toolChoice === "none" ? "\u7981\u6B62\u5DE5\u5177" : toolChoice === "required" ? "\u5F3A\u5236\u5DE5\u5177" : ""
|
|
7026
|
-
] }),
|
|
7027
|
-
cmdTips.length > 0 && (() => {
|
|
7028
|
-
const tip = cmdTips[cmdTipIndex % cmdTips.length];
|
|
7029
|
-
if (!tip) return null;
|
|
7030
|
-
const text = `${tip.name} ${tip.desc}`;
|
|
7031
|
-
return /* @__PURE__ */ jsxs10(Text11, { children: [
|
|
7032
|
-
/* @__PURE__ */ jsx10(Text11, { color: "#808080", children: " \u{1F4A1} " }),
|
|
7033
|
-
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 })
|
|
7034
|
-
] });
|
|
7035
|
-
})(),
|
|
7036
|
-
verbose ? /* @__PURE__ */ jsx10(Text11, { color: "#ff1493", children: " \u26A1 Verbose" }) : null
|
|
7037
|
-
] }),
|
|
7038
|
-
/* @__PURE__ */ jsxs10(
|
|
7039
|
-
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,
|
|
7040
7009
|
{
|
|
7041
|
-
|
|
7010
|
+
width: leftPanelWidth,
|
|
7011
|
+
flexShrink: 0,
|
|
7042
7012
|
flexDirection: "column",
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
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
|
+
/* ===== 流式思考中:思考链 ===== */
|
|
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: joinReasoningSegments(currentReasoning) })
|
|
7071
|
+
] })
|
|
7072
|
+
) : (
|
|
7073
|
+
/* ===== 对话中(无思考):会话状态面板 ===== */
|
|
7074
|
+
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", alignItems: "center", children: [
|
|
7075
|
+
/* @__PURE__ */ jsx11(Text12, { color: "#00ffff", bold: true, children: "\u{1F4AC} \u5BF9\u8BDD\u8FDB\u884C\u4E2D" }),
|
|
7076
|
+
/* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", alignItems: "center", children: [
|
|
7077
|
+
/* @__PURE__ */ jsxs11(Text12, { color: "#00ff41", children: [
|
|
7078
|
+
"\u{1F4DD} \u6D88\u606F ",
|
|
7079
|
+
displayMessages.length,
|
|
7080
|
+
" \u6761"
|
|
7081
|
+
] }),
|
|
7082
|
+
sessionCost > 0 && /* @__PURE__ */ jsxs11(Text12, { color: "cyan", children: [
|
|
7083
|
+
"\u{1F4B0} \u4F1A\u8BDD \xA5",
|
|
7084
|
+
sessionCost.toFixed(4)
|
|
7085
|
+
] })
|
|
7086
|
+
] }),
|
|
7087
|
+
/* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", alignItems: "center", children: [
|
|
7088
|
+
/* @__PURE__ */ jsxs11(Text12, { color: "#808080", children: [
|
|
7089
|
+
"\u{1F527} ",
|
|
7090
|
+
SUPPORTED_MODELS[activeModel]?.displayName ?? activeModel
|
|
7091
|
+
] }),
|
|
7092
|
+
thinkingEnabled && /* @__PURE__ */ jsxs11(Text12, { color: "#ff9800", children: [
|
|
7093
|
+
"\u{1F9E0} ",
|
|
7094
|
+
thinkingEffort === "max" ? "Max" : "High"
|
|
7095
|
+
] })
|
|
7096
|
+
] }),
|
|
7097
|
+
balance !== null && /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsxs11(Text12, { color: "yellow", children: [
|
|
7098
|
+
"\u{1F4B0} \xA5",
|
|
7099
|
+
balance.toFixed(2)
|
|
7100
|
+
] }) })
|
|
7101
|
+
] })
|
|
7102
|
+
)
|
|
7103
|
+
}
|
|
7104
|
+
)
|
|
7107
7105
|
}
|
|
7108
7106
|
),
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
/* @__PURE__ */
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7107
|
+
/* @__PURE__ */ jsx11(Box11, { width: 1, flexShrink: 0, children: /* @__PURE__ */ jsx11(Text12, { color: "#444", children: "\u2502" }) }),
|
|
7108
|
+
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", flexGrow: 1, children: [
|
|
7109
|
+
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", flexGrow: 1, children: [
|
|
7110
|
+
!hasConversationStarted && /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", alignItems: "flex-start", flexGrow: 1, paddingBottom: 1, children: [
|
|
7111
|
+
cmdTips.length > 0 && (() => {
|
|
7112
|
+
const tip = cmdTips[cmdTipIndex % cmdTips.length];
|
|
7113
|
+
if (!tip) return null;
|
|
7114
|
+
const text = `${tip.name} ${tip.desc}`;
|
|
7115
|
+
return /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, alignSelf: "center", children: [
|
|
7116
|
+
/* @__PURE__ */ jsx11(Text12, { color: "#808080", children: "\u{1F4A1} " }),
|
|
7117
|
+
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 })
|
|
7118
|
+
] });
|
|
7119
|
+
})(),
|
|
7120
|
+
/* @__PURE__ */ jsx11(Box11, { flexGrow: 1 }),
|
|
7121
|
+
/* @__PURE__ */ jsx11(AnimatedLogo, { panelWidth: rightContentWidth })
|
|
7122
|
+
] }),
|
|
7123
|
+
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginTop: 1, children: [
|
|
7124
|
+
/* @__PURE__ */ jsx11(Static, { items: displayMessages, children: (msg, i) => {
|
|
7125
|
+
if (msg.role === "user") {
|
|
7126
|
+
return /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "row", children: [
|
|
7127
|
+
/* @__PURE__ */ jsx11(Box11, { width: 1, backgroundColor: "#FF8C00", flexShrink: 0 }),
|
|
7128
|
+
/* @__PURE__ */ jsx11(Box11, { flexGrow: 1, paddingLeft: 1, children: /* @__PURE__ */ jsxs11(Box11, { flexDirection: "row", children: [
|
|
7129
|
+
/* @__PURE__ */ jsx11(Box11, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx11(Text12, { bold: true, color: "#FF8C00", children: "\u{1F4AC}" }) }),
|
|
7130
|
+
/* @__PURE__ */ jsx11(Box11, { flexGrow: 1, children: /* @__PURE__ */ jsx11(Text12, { wrap: "wrap", children: msg.content }) })
|
|
7131
|
+
] }) })
|
|
7132
|
+
] }, i);
|
|
7133
|
+
}
|
|
7134
|
+
if (msg.role === "tool") {
|
|
7135
|
+
return /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "row", children: [
|
|
7136
|
+
/* @__PURE__ */ jsx11(Box11, { width: 1, backgroundColor: "#666666", flexShrink: 0 }),
|
|
7137
|
+
/* @__PURE__ */ jsxs11(Box11, { flexGrow: 1, paddingLeft: 1, flexDirection: "column", children: [
|
|
7138
|
+
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "row", children: [
|
|
7139
|
+
/* @__PURE__ */ jsx11(Box11, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx11(Text12, { dimColor: true, children: "\u{1F527}" }) }),
|
|
7140
|
+
/* @__PURE__ */ jsx11(Box11, { flexGrow: 1, children: /* @__PURE__ */ jsx11(Text12, { dimColor: true, wrap: "wrap", children: msg.content }) })
|
|
7141
|
+
] }),
|
|
7142
|
+
msg.diff && /* @__PURE__ */ jsx11(DiffPreview, { diff: msg.diff })
|
|
7143
|
+
] })
|
|
7144
|
+
] }, i);
|
|
7145
|
+
}
|
|
7146
|
+
const detail = msg.assistantDetail;
|
|
7147
|
+
return /* @__PURE__ */ jsx11(
|
|
7148
|
+
AssistantMessage,
|
|
7149
|
+
{
|
|
7150
|
+
content: msg.content,
|
|
7151
|
+
toolCalls: detail?.toolCalls,
|
|
7152
|
+
isStreaming: false,
|
|
7153
|
+
usage: detail?.usage,
|
|
7154
|
+
elapsed: detail?.elapsed,
|
|
7155
|
+
cost: detail?.cost,
|
|
7156
|
+
model: detail?.model
|
|
7157
|
+
},
|
|
7158
|
+
i
|
|
7159
|
+
);
|
|
7160
|
+
} }, staticKey),
|
|
7161
|
+
isStreaming && /* @__PURE__ */ jsx11(
|
|
7162
|
+
AssistantMessage,
|
|
7163
|
+
{
|
|
7164
|
+
content: currentContent,
|
|
7165
|
+
toolCalls: currentToolCalls.length > 0 ? currentToolCalls : void 0,
|
|
7166
|
+
isStreaming: true,
|
|
7167
|
+
usage: _currentUsage,
|
|
7168
|
+
cost: _currentCost,
|
|
7169
|
+
model: _streamingModel
|
|
7170
|
+
}
|
|
7171
|
+
),
|
|
7172
|
+
!isStreaming && streamError && /* @__PURE__ */ jsx11(Box11, { marginTop: 1, marginLeft: 3, children: /* @__PURE__ */ jsxs11(Text12, { color: "red", children: [
|
|
7173
|
+
"\u26A0 ",
|
|
7174
|
+
streamError
|
|
7175
|
+
] }) })
|
|
7176
|
+
] }),
|
|
7177
|
+
todoPanelVisible && todoSnapshot.length > 0 && /* @__PURE__ */ jsx11(TodoListPanel, { items: todoSnapshot })
|
|
7178
|
+
] }),
|
|
7179
|
+
selectingModel ? /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", children: [
|
|
7180
|
+
/* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) }),
|
|
7181
|
+
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginTop: 1, children: [
|
|
7182
|
+
/* @__PURE__ */ jsx11(Text12, { bold: true, color: "#00ffff", children: "\u9009\u62E9\u6A21\u578B\uFF1A" }),
|
|
7183
|
+
modelOptions.map((id, i) => {
|
|
7184
|
+
const meta = SUPPORTED_MODELS[id];
|
|
7185
|
+
const isCurrent = id === activeModel;
|
|
7186
|
+
const isSelected = i === modelSelectIndex;
|
|
7187
|
+
const marker = isSelected ? " > " : " ";
|
|
7188
|
+
const suffix = isCurrent ? " (\u5F53\u524D)" : "";
|
|
7189
|
+
return /* @__PURE__ */ jsxs11(Box11, { children: [
|
|
7190
|
+
/* @__PURE__ */ jsxs11(Text12, { color: isSelected ? "#00ff41" : void 0, bold: isSelected, children: [
|
|
7191
|
+
marker,
|
|
7192
|
+
meta.displayName,
|
|
7193
|
+
suffix
|
|
7194
|
+
] }),
|
|
7195
|
+
isSelected && /* @__PURE__ */ jsxs11(Text12, { color: "#808080", children: [
|
|
7196
|
+
" \u2014 ",
|
|
7197
|
+
id
|
|
7198
|
+
] })
|
|
7199
|
+
] }, id);
|
|
7200
|
+
}),
|
|
7201
|
+
/* @__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" }) })
|
|
7202
|
+
] }),
|
|
7203
|
+
/* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) })
|
|
7204
|
+
] }) : rewindSelecting ? /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", children: [
|
|
7205
|
+
/* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) }),
|
|
7206
|
+
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginTop: 1, children: [
|
|
7207
|
+
/* @__PURE__ */ jsx11(Text12, { bold: true, color: "#ff9800", children: "\u9009\u62E9\u8981\u56DE\u9000\u7684\u68C0\u67E5\u70B9\uFF1A" }),
|
|
7208
|
+
rewindList.map((cp2, i) => {
|
|
7209
|
+
const isSelected = i === rewindSelectIndex;
|
|
7210
|
+
const marker = isSelected ? " > " : " ";
|
|
7211
|
+
const time = new Date(cp2.timestamp).toLocaleTimeString();
|
|
7212
|
+
const preview = cp2.preview || "(\u7A7A)";
|
|
7213
|
+
const tag = cp2.isGitRepo ? "" : " [\u975E git\uFF0C\u4EC5\u5BF9\u8BDD]";
|
|
7214
|
+
return /* @__PURE__ */ jsx11(Box11, { children: /* @__PURE__ */ jsxs11(Text12, { color: isSelected ? "#ff9800" : void 0, bold: isSelected, children: [
|
|
7215
|
+
marker,
|
|
7216
|
+
"#",
|
|
7217
|
+
i + 1,
|
|
7218
|
+
" ",
|
|
7219
|
+
time,
|
|
7220
|
+
" `",
|
|
7221
|
+
preview,
|
|
7222
|
+
tag,
|
|
7223
|
+
"`"
|
|
7224
|
+
] }) }, cp2.index);
|
|
7225
|
+
}),
|
|
7226
|
+
/* @__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" }) })
|
|
7227
|
+
] }),
|
|
7228
|
+
/* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) })
|
|
7229
|
+
] }) : /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
7230
|
+
(hasConversationStarted || sessionMode === "plan") && isStreaming && streamingPhase ? /* @__PURE__ */ jsx11(Box11, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsxs11(Text12, { bold: true, color: PHASE_CONFIG[streamingPhase].color, children: [
|
|
7231
|
+
PHASE_CONFIG[streamingPhase].icon,
|
|
7154
7232
|
" ",
|
|
7155
|
-
|
|
7156
|
-
"
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
Text11,
|
|
7179
|
-
{
|
|
7180
|
-
color: sessionMode === "plan" ? "#ff69b4" : "#00ffff",
|
|
7181
|
-
dimColor: sessionMode !== "plan",
|
|
7182
|
-
children: [
|
|
7183
|
-
/* @__PURE__ */ jsx10(Text11, { children: sessionMode === "plan" ? "\u2500".repeat(Math.max(dividerWidth - 48, 1)) : "\u2500".repeat(Math.max(dividerWidth - 35, 10)) }),
|
|
7184
|
-
balance !== null && /* @__PURE__ */ jsxs10(Text11, { color: "yellow", children: [
|
|
7185
|
-
" \u{1F4B0} \u4F59\u989D \xA5",
|
|
7186
|
-
balance.toFixed(2)
|
|
7187
|
-
] }),
|
|
7188
|
-
isStreaming ? /* @__PURE__ */ jsxs10(Text11, { color: "cyan", children: [
|
|
7189
|
-
" \u{1F4CA} \u672C\u6B21 \xA5",
|
|
7190
|
-
sessionCost > 0 ? sessionCost.toFixed(4) + " " : "",
|
|
7191
|
-
/* @__PURE__ */ jsx10(InkSpinner3, { type: "dots" })
|
|
7192
|
-
] }) : sessionCost > 0 ? /* @__PURE__ */ jsxs10(Text11, { color: "cyan", children: [
|
|
7193
|
-
" \u{1F4CA} \u672C\u6B21 \xA5",
|
|
7194
|
-
sessionCost.toFixed(4)
|
|
7195
|
-
] }) : null,
|
|
7196
|
-
sessionMode === "plan" && /* @__PURE__ */ jsx10(Text11, { color: "#ff69b4", bold: true, children: " \u{1F4CB} \u8BA1\u5212\u6A21\u5F0F" })
|
|
7197
|
-
]
|
|
7198
|
-
}
|
|
7199
|
-
) : /* @__PURE__ */ jsx10(Text11, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) }) }),
|
|
7200
|
-
/* @__PURE__ */ jsxs10(Box10, { children: [
|
|
7201
|
-
/* @__PURE__ */ jsx10(Box10, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx10(Text11, { bold: true, color: "#00ff41", children: "\u26A1" }) }),
|
|
7202
|
-
/* @__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(
|
|
7203
|
-
TextInput,
|
|
7204
|
-
{
|
|
7205
|
-
value: input,
|
|
7206
|
-
onChange: setInput,
|
|
7207
|
-
onSubmit: handleSubmit,
|
|
7208
|
-
placeholder: ""
|
|
7209
|
-
},
|
|
7210
|
-
inputKey
|
|
7211
|
-
) })
|
|
7212
|
-
] }),
|
|
7213
|
-
/* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsx10(Text11, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) }) }),
|
|
7214
|
-
/* @__PURE__ */ jsx10(SkillSelector, { skills, input, selectedIndex: skillSelectIndex }),
|
|
7215
|
-
/* @__PURE__ */ jsx10(FileSelector, { files, input, selectedIndex: fileSelectIndex })
|
|
7233
|
+
PHASE_CONFIG[streamingPhase].label,
|
|
7234
|
+
" ",
|
|
7235
|
+
/* @__PURE__ */ jsx11(InkSpinner3, { type: "dots" })
|
|
7236
|
+
] }) }) : 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,
|
|
7237
|
+
/* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) }) }),
|
|
7238
|
+
/* @__PURE__ */ jsxs11(Box11, { children: [
|
|
7239
|
+
/* @__PURE__ */ jsx11(Box11, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx11(Text12, { bold: true, color: "#00ff41", children: "\u26A1" }) }),
|
|
7240
|
+
/* @__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(
|
|
7241
|
+
TextInput,
|
|
7242
|
+
{
|
|
7243
|
+
value: input,
|
|
7244
|
+
onChange: setInput,
|
|
7245
|
+
onSubmit: handleSubmit,
|
|
7246
|
+
placeholder: ""
|
|
7247
|
+
},
|
|
7248
|
+
inputKey
|
|
7249
|
+
) })
|
|
7250
|
+
] }),
|
|
7251
|
+
/* @__PURE__ */ jsx11(Box11, { children: /* @__PURE__ */ jsx11(Text12, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(rightContentWidth) }) }),
|
|
7252
|
+
/* @__PURE__ */ jsx11(SkillSelector, { skills, input, selectedIndex: skillSelectIndex }),
|
|
7253
|
+
/* @__PURE__ */ jsx11(FileSelector, { files, input, selectedIndex: fileSelectIndex })
|
|
7254
|
+
] })
|
|
7255
|
+
] })
|
|
7216
7256
|
] }),
|
|
7217
|
-
doubleCtrlC && !isStreaming && /* @__PURE__ */
|
|
7218
|
-
isStreaming && /* @__PURE__ */
|
|
7257
|
+
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" }) }),
|
|
7258
|
+
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" }) })
|
|
7219
7259
|
] });
|
|
7220
7260
|
}
|
|
7221
7261
|
|
|
7222
7262
|
// src/ui/GamePicker.tsx
|
|
7223
|
-
import { Box as
|
|
7224
|
-
import { useState as
|
|
7225
|
-
import { jsx as
|
|
7263
|
+
import { Box as Box12, Text as Text13, useInput as useInput2 } from "ink";
|
|
7264
|
+
import { useState as useState6, useCallback as useCallback3 } from "react";
|
|
7265
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
7226
7266
|
function GamePicker({ games, onSelect, onExit, onBackToChat }) {
|
|
7227
|
-
const [selectedIndex, setSelectedIndex] =
|
|
7267
|
+
const [selectedIndex, setSelectedIndex] = useState6(0);
|
|
7228
7268
|
const exitAction = onBackToChat ?? onExit ?? (() => process.exit(0));
|
|
7229
7269
|
const { doubleCtrlC, handleCtrlC } = useDoubleCtrlC(exitAction);
|
|
7230
7270
|
useInput2(
|
|
@@ -7250,18 +7290,18 @@ function GamePicker({ games, onSelect, onExit, onBackToChat }) {
|
|
|
7250
7290
|
[games, selectedIndex, onSelect, onExit, onBackToChat, handleCtrlC]
|
|
7251
7291
|
)
|
|
7252
7292
|
);
|
|
7253
|
-
return /* @__PURE__ */
|
|
7254
|
-
/* @__PURE__ */
|
|
7255
|
-
/* @__PURE__ */
|
|
7293
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
7294
|
+
/* @__PURE__ */ jsx12(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsx12(Text13, { bold: true, color: "#00ffff", children: "\u{1F3AE} \u6E38\u620F\u5217\u8868" }) }),
|
|
7295
|
+
/* @__PURE__ */ jsx12(Box12, { flexDirection: "column", children: games.map((game, index) => {
|
|
7256
7296
|
const isSelected = index === selectedIndex;
|
|
7257
|
-
return /* @__PURE__ */
|
|
7258
|
-
/* @__PURE__ */
|
|
7259
|
-
/* @__PURE__ */
|
|
7260
|
-
/* @__PURE__ */
|
|
7297
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "row", children: [
|
|
7298
|
+
/* @__PURE__ */ jsx12(Box12, { width: 3, flexShrink: 0, children: isSelected ? /* @__PURE__ */ jsx12(Text13, { bold: true, color: "#00ff41", children: "\u25B8 " }) : /* @__PURE__ */ jsx12(Text13, { children: " " }) }),
|
|
7299
|
+
/* @__PURE__ */ jsx12(Box12, { width: 20, flexShrink: 0, children: /* @__PURE__ */ jsx12(Text13, { bold: true, color: isSelected ? "#00ff41" : "#ffffff", children: game.name }) }),
|
|
7300
|
+
/* @__PURE__ */ jsx12(Box12, { children: /* @__PURE__ */ jsx12(Text13, { color: "#888888", children: game.description }) })
|
|
7261
7301
|
] }, game.id);
|
|
7262
7302
|
}) }),
|
|
7263
|
-
/* @__PURE__ */
|
|
7264
|
-
doubleCtrlC && /* @__PURE__ */
|
|
7303
|
+
/* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: " \u2191/\u2193 \u9009\u62E9 Enter \u542F\u52A8 q \u8FD4\u56DE" }) }),
|
|
7304
|
+
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" }) })
|
|
7265
7305
|
] });
|
|
7266
7306
|
}
|
|
7267
7307
|
|
|
@@ -7278,9 +7318,9 @@ function listGames() {
|
|
|
7278
7318
|
}
|
|
7279
7319
|
|
|
7280
7320
|
// src/game/brick-breaker/index.tsx
|
|
7281
|
-
import { Box as
|
|
7282
|
-
import { useState as
|
|
7283
|
-
import { jsx as
|
|
7321
|
+
import { Box as Box13, Text as Text14, useInput as useInput3, render as render2 } from "ink";
|
|
7322
|
+
import { useState as useState7, useEffect as useEffect6, useRef as useRef5, useCallback as useCallback4 } from "react";
|
|
7323
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
7284
7324
|
var GAME_WIDTH = 40;
|
|
7285
7325
|
var GAME_HEIGHT = 18;
|
|
7286
7326
|
var PADDLE_WIDTH = 9;
|
|
@@ -7411,13 +7451,13 @@ function buildBoard(state) {
|
|
|
7411
7451
|
return lines.map((l) => `\u2502${l}\u2502`).join("\n");
|
|
7412
7452
|
}
|
|
7413
7453
|
function BrickBreakerGame({ onExit: _onExit }) {
|
|
7414
|
-
const [initialLevel, setInitialLevel] =
|
|
7415
|
-
const [selectingLevel, setSelectingLevel] =
|
|
7416
|
-
const stateRef =
|
|
7417
|
-
const [tick2, setTick] =
|
|
7418
|
-
const onExitRef =
|
|
7454
|
+
const [initialLevel, setInitialLevel] = useState7(1);
|
|
7455
|
+
const [selectingLevel, setSelectingLevel] = useState7(true);
|
|
7456
|
+
const stateRef = useRef5(createInitialState(initialLevel));
|
|
7457
|
+
const [tick2, setTick] = useState7(0);
|
|
7458
|
+
const onExitRef = useRef5(_onExit);
|
|
7419
7459
|
onExitRef.current = _onExit;
|
|
7420
|
-
|
|
7460
|
+
useEffect6(() => {
|
|
7421
7461
|
if (selectingLevel) return;
|
|
7422
7462
|
const interval = setInterval(() => {
|
|
7423
7463
|
update(stateRef.current);
|
|
@@ -7470,49 +7510,49 @@ function BrickBreakerGame({ onExit: _onExit }) {
|
|
|
7470
7510
|
const board = buildBoard(s);
|
|
7471
7511
|
const def = getLevel(s.level);
|
|
7472
7512
|
void tick2;
|
|
7473
|
-
return /* @__PURE__ */
|
|
7474
|
-
/* @__PURE__ */
|
|
7475
|
-
/* @__PURE__ */
|
|
7513
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", children: [
|
|
7514
|
+
/* @__PURE__ */ jsxs13(Box13, { flexDirection: "row", children: [
|
|
7515
|
+
/* @__PURE__ */ jsx13(Box13, { width: 20, children: /* @__PURE__ */ jsxs13(Text14, { children: [
|
|
7476
7516
|
"\u5173\u5361 ",
|
|
7477
7517
|
s.level,
|
|
7478
7518
|
": ",
|
|
7479
|
-
/* @__PURE__ */
|
|
7519
|
+
/* @__PURE__ */ jsx13(Text14, { color: "cyan", children: def.desc })
|
|
7480
7520
|
] }) }),
|
|
7481
|
-
/* @__PURE__ */
|
|
7521
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsxs13(Text14, { children: [
|
|
7482
7522
|
"\u5206\u6570: ",
|
|
7483
|
-
/* @__PURE__ */
|
|
7523
|
+
/* @__PURE__ */ jsx13(Text14, { color: "yellow", children: String(s.score).padStart(3, "0") })
|
|
7484
7524
|
] }) }),
|
|
7485
|
-
/* @__PURE__ */
|
|
7525
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsxs13(Text14, { children: [
|
|
7486
7526
|
"\u751F\u547D: ",
|
|
7487
|
-
/* @__PURE__ */
|
|
7527
|
+
/* @__PURE__ */ jsx13(Text14, { color: "red", children: "\u2665".repeat(Math.max(0, s.lives)) })
|
|
7488
7528
|
] }) }),
|
|
7489
|
-
/* @__PURE__ */
|
|
7529
|
+
/* @__PURE__ */ jsx13(Box13, { width: 10, children: /* @__PURE__ */ jsxs13(Text14, { children: [
|
|
7490
7530
|
"\u7816\u5757: ",
|
|
7491
|
-
/* @__PURE__ */
|
|
7531
|
+
/* @__PURE__ */ jsx13(Text14, { color: "cyan", children: aliveCount })
|
|
7492
7532
|
] }) }),
|
|
7493
|
-
/* @__PURE__ */
|
|
7533
|
+
/* @__PURE__ */ jsx13(Box13, { children: /* @__PURE__ */ jsxs13(Text14, { color: s.paused ? "gray" : "green", children: [
|
|
7494
7534
|
"[",
|
|
7495
7535
|
s.paused ? "\u6682\u505C" : "\u8FD0\u884C\u4E2D",
|
|
7496
7536
|
"]"
|
|
7497
7537
|
] }) })
|
|
7498
7538
|
] }),
|
|
7499
|
-
/* @__PURE__ */
|
|
7500
|
-
/* @__PURE__ */
|
|
7539
|
+
/* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", children: [
|
|
7540
|
+
/* @__PURE__ */ jsxs13(Text14, { children: [
|
|
7501
7541
|
"\u250C",
|
|
7502
7542
|
"\u2500".repeat(GAME_WIDTH),
|
|
7503
7543
|
"\u2510"
|
|
7504
7544
|
] }),
|
|
7505
|
-
/* @__PURE__ */
|
|
7506
|
-
/* @__PURE__ */
|
|
7545
|
+
/* @__PURE__ */ jsx13(Text14, { children: selectingLevel ? " \x1B[90m\u9009\u62E9\u5173\u5361\u540E\u5F00\u59CB...\x1B[0m" : board }),
|
|
7546
|
+
/* @__PURE__ */ jsxs13(Text14, { children: [
|
|
7507
7547
|
"\u2514",
|
|
7508
7548
|
"\u2500".repeat(GAME_WIDTH),
|
|
7509
7549
|
"\u2518"
|
|
7510
7550
|
] })
|
|
7511
7551
|
] }),
|
|
7512
|
-
selectingLevel && /* @__PURE__ */
|
|
7513
|
-
/* @__PURE__ */
|
|
7514
|
-
/* @__PURE__ */
|
|
7515
|
-
/* @__PURE__ */
|
|
7552
|
+
selectingLevel && /* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
7553
|
+
/* @__PURE__ */ jsx13(Text14, { bold: true, color: "yellow", children: "\u9009\u62E9\u5173\u5361" }),
|
|
7554
|
+
/* @__PURE__ */ jsx13(Box13, { flexDirection: "row", flexWrap: "wrap", children: LEVELS.map((lv, i) => /* @__PURE__ */ jsx13(Box13, { width: 22, children: /* @__PURE__ */ jsxs13(Text14, { children: [
|
|
7555
|
+
/* @__PURE__ */ jsx13(Text14, { color: initialLevel === i + 1 ? "green" : "white", children: i + 1 === 10 ? "0" : String(i + 1) }),
|
|
7516
7556
|
". ",
|
|
7517
7557
|
lv.desc,
|
|
7518
7558
|
" (",
|
|
@@ -7521,16 +7561,16 @@ function BrickBreakerGame({ onExit: _onExit }) {
|
|
|
7521
7561
|
lv.cols,
|
|
7522
7562
|
")"
|
|
7523
7563
|
] }) }, i)) }),
|
|
7524
|
-
/* @__PURE__ */
|
|
7564
|
+
/* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6309\u6570\u5B57\u9009\u5173 q \u9000\u51FA" }) })
|
|
7525
7565
|
] }),
|
|
7526
|
-
!selectingLevel && (s.gameOver || s.win) && /* @__PURE__ */
|
|
7527
|
-
/* @__PURE__ */
|
|
7528
|
-
/* @__PURE__ */
|
|
7566
|
+
!selectingLevel && (s.gameOver || s.win) && /* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
7567
|
+
/* @__PURE__ */ jsx13(Text14, { bold: true, color: s.gameOver ? "red" : "green", children: s.gameOver ? "\u6E38\u620F\u7ED3\u675F\uFF01" : "\u606D\u559C\u901A\u5173\uFF01" }),
|
|
7568
|
+
/* @__PURE__ */ jsxs13(Text14, { children: [
|
|
7529
7569
|
" \u5206\u6570: ",
|
|
7530
|
-
/* @__PURE__ */
|
|
7570
|
+
/* @__PURE__ */ jsx13(Text14, { color: "yellow", children: s.score })
|
|
7531
7571
|
] })
|
|
7532
7572
|
] }),
|
|
7533
|
-
!selectingLevel && /* @__PURE__ */
|
|
7573
|
+
!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" }) })
|
|
7534
7574
|
] });
|
|
7535
7575
|
}
|
|
7536
7576
|
var brick_breaker_default = {
|
|
@@ -7540,7 +7580,7 @@ var brick_breaker_default = {
|
|
|
7540
7580
|
play: async () => {
|
|
7541
7581
|
await new Promise((resolve2) => {
|
|
7542
7582
|
const { unmount } = render2(
|
|
7543
|
-
/* @__PURE__ */
|
|
7583
|
+
/* @__PURE__ */ jsx13(BrickBreakerGame, { onExit: () => {
|
|
7544
7584
|
unmount();
|
|
7545
7585
|
resolve2();
|
|
7546
7586
|
} })
|
|
@@ -7550,9 +7590,9 @@ var brick_breaker_default = {
|
|
|
7550
7590
|
};
|
|
7551
7591
|
|
|
7552
7592
|
// src/game/coder-check/index.tsx
|
|
7553
|
-
import { Box as
|
|
7554
|
-
import { useState as
|
|
7555
|
-
import { jsx as
|
|
7593
|
+
import { Box as Box14, Text as Text15, useInput as useInput4, render as render3 } from "ink";
|
|
7594
|
+
import { useState as useState8, useEffect as useEffect7, useRef as useRef6, useCallback as useCallback5 } from "react";
|
|
7595
|
+
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
7556
7596
|
var GAME_W = 66;
|
|
7557
7597
|
var GAME_H = 20;
|
|
7558
7598
|
var SCORE_H = 6;
|
|
@@ -7943,18 +7983,18 @@ function buildGameView(s, scoreLines, scoreColor, message) {
|
|
|
7943
7983
|
return rows;
|
|
7944
7984
|
}
|
|
7945
7985
|
function CoderCheck({ onExit: _onExit }) {
|
|
7946
|
-
const stateRef =
|
|
7947
|
-
const [tick2, setTick] =
|
|
7948
|
-
const [colorOffset, setColorOffset] =
|
|
7949
|
-
const onExitRef =
|
|
7986
|
+
const stateRef = useRef6(createInitialState2());
|
|
7987
|
+
const [tick2, setTick] = useState8(0);
|
|
7988
|
+
const [colorOffset, setColorOffset] = useState8(0);
|
|
7989
|
+
const onExitRef = useRef6(_onExit);
|
|
7950
7990
|
onExitRef.current = _onExit;
|
|
7951
|
-
|
|
7991
|
+
useEffect7(() => {
|
|
7952
7992
|
const timer = setInterval(() => {
|
|
7953
7993
|
setColorOffset((prev) => (prev + 1) % CYBER_PALETTE2.length);
|
|
7954
7994
|
}, 400);
|
|
7955
7995
|
return () => clearInterval(timer);
|
|
7956
7996
|
}, []);
|
|
7957
|
-
|
|
7997
|
+
useEffect7(() => {
|
|
7958
7998
|
const interval = setInterval(() => {
|
|
7959
7999
|
update2(stateRef.current);
|
|
7960
8000
|
setTick((t) => t + 1);
|
|
@@ -8023,44 +8063,44 @@ function CoderCheck({ onExit: _onExit }) {
|
|
|
8023
8063
|
const scoreLines = buildScoreLines(scoreStr);
|
|
8024
8064
|
const view = buildGameView(s, scoreLines, scoreColor, s.message);
|
|
8025
8065
|
void tick2;
|
|
8026
|
-
return /* @__PURE__ */
|
|
8027
|
-
/* @__PURE__ */
|
|
8066
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 1, children: [
|
|
8067
|
+
/* @__PURE__ */ jsx14(Box14, { flexDirection: "row", children: /* @__PURE__ */ jsxs14(Text15, { children: [
|
|
8028
8068
|
"\u751F\u547D ",
|
|
8029
|
-
/* @__PURE__ */
|
|
8069
|
+
/* @__PURE__ */ jsx14(Text15, { color: "red", children: "\u2665".repeat(Math.max(0, s.lives)) }),
|
|
8030
8070
|
" ",
|
|
8031
8071
|
"\u901F\u5EA6 ",
|
|
8032
|
-
/* @__PURE__ */
|
|
8072
|
+
/* @__PURE__ */ jsxs14(Text15, { color: "cyan", children: [
|
|
8033
8073
|
"Lv.",
|
|
8034
8074
|
Math.floor(s.speed * 10)
|
|
8035
8075
|
] })
|
|
8036
8076
|
] }) }),
|
|
8037
|
-
!s.gameOver && s.target && /* @__PURE__ */
|
|
8077
|
+
!s.gameOver && s.target && /* @__PURE__ */ jsx14(Box14, { marginTop: 1, children: /* @__PURE__ */ jsxs14(Text15, { children: [
|
|
8038
8078
|
"\u6253\u5B57: ",
|
|
8039
|
-
/* @__PURE__ */
|
|
8040
|
-
/* @__PURE__ */
|
|
8079
|
+
/* @__PURE__ */ jsx14(Text15, { color: "green", children: s.typed }),
|
|
8080
|
+
/* @__PURE__ */ jsx14(Text15, { color: "white", children: s.target.slice(s.typed.length) })
|
|
8041
8081
|
] }) }),
|
|
8042
|
-
/* @__PURE__ */
|
|
8043
|
-
/* @__PURE__ */
|
|
8082
|
+
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", marginTop: 1, children: [
|
|
8083
|
+
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
8044
8084
|
"\u250C",
|
|
8045
8085
|
"\u2500".repeat(GAME_W),
|
|
8046
8086
|
"\u2510"
|
|
8047
8087
|
] }),
|
|
8048
|
-
view.map((row, i) => /* @__PURE__ */
|
|
8049
|
-
/* @__PURE__ */
|
|
8088
|
+
view.map((row, i) => /* @__PURE__ */ jsx14(Text15, { children: `\u2502${row}\u2502` }, i)),
|
|
8089
|
+
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
8050
8090
|
"\u2514",
|
|
8051
8091
|
"\u2500".repeat(GAME_W),
|
|
8052
8092
|
"\u2518"
|
|
8053
8093
|
] })
|
|
8054
8094
|
] }),
|
|
8055
|
-
s.gameOver && /* @__PURE__ */
|
|
8056
|
-
/* @__PURE__ */
|
|
8057
|
-
/* @__PURE__ */
|
|
8095
|
+
s.gameOver && /* @__PURE__ */ jsxs14(Box14, { marginTop: 1, children: [
|
|
8096
|
+
/* @__PURE__ */ jsx14(Text15, { bold: true, color: "red", children: "\u6E38\u620F\u7ED3\u675F\uFF01" }),
|
|
8097
|
+
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
8058
8098
|
" \u5F97\u5206: ",
|
|
8059
|
-
/* @__PURE__ */
|
|
8099
|
+
/* @__PURE__ */ jsx14(Text15, { color: "yellow", children: s.score }),
|
|
8060
8100
|
" r \u91CD\u5F00 q \u9000\u51FA"
|
|
8061
8101
|
] })
|
|
8062
8102
|
] }),
|
|
8063
|
-
/* @__PURE__ */
|
|
8103
|
+
/* @__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" }) })
|
|
8064
8104
|
] });
|
|
8065
8105
|
}
|
|
8066
8106
|
var coder_check_default = {
|
|
@@ -8070,7 +8110,7 @@ var coder_check_default = {
|
|
|
8070
8110
|
play: async () => {
|
|
8071
8111
|
await new Promise((resolve2) => {
|
|
8072
8112
|
const { unmount } = render3(
|
|
8073
|
-
/* @__PURE__ */
|
|
8113
|
+
/* @__PURE__ */ jsx14(CoderCheck, { onExit: () => {
|
|
8074
8114
|
unmount();
|
|
8075
8115
|
resolve2();
|
|
8076
8116
|
} })
|
|
@@ -8450,12 +8490,12 @@ import { render as render4 } from "ink";
|
|
|
8450
8490
|
import chalk5 from "chalk";
|
|
8451
8491
|
|
|
8452
8492
|
// src/stock/StockList.tsx
|
|
8453
|
-
import { Box as
|
|
8454
|
-
import { useState as
|
|
8493
|
+
import { Box as Box15, Text as Text16, useInput as useInput5 } from "ink";
|
|
8494
|
+
import { useState as useState9, useCallback as useCallback6, useEffect as useEffect8, useMemo as useMemo2 } from "react";
|
|
8455
8495
|
import asciichart from "asciichart";
|
|
8456
8496
|
import os from "os";
|
|
8457
8497
|
import { join as join10 } from "path";
|
|
8458
|
-
import { jsx as
|
|
8498
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
8459
8499
|
var SETTINGS_PATH = join10(os.homedir(), ".dskcode", "settings.json");
|
|
8460
8500
|
function toFileUrl(p) {
|
|
8461
8501
|
const norm = p.replace(/\\/g, "/");
|
|
@@ -8558,20 +8598,20 @@ function latestPoints(data, maxPoints = 60) {
|
|
|
8558
8598
|
return data.slice(data.length - maxPoints);
|
|
8559
8599
|
}
|
|
8560
8600
|
function StockList({ codes, onExit, onBackToChat }) {
|
|
8561
|
-
const [stocks, setStocks] =
|
|
8562
|
-
const [selectedIndex, setSelectedIndex] =
|
|
8563
|
-
const [loading, setLoading] =
|
|
8564
|
-
const [lastUpdate, setLastUpdate] =
|
|
8565
|
-
const [detailView, setDetailView] =
|
|
8566
|
-
const [detailPrices, setDetailPrices] =
|
|
8567
|
-
const [detailLoading, setDetailLoading] =
|
|
8568
|
-
const [detailCountdown, setDetailCountdown] =
|
|
8569
|
-
const [countdown, setCountdown] =
|
|
8570
|
-
const [currentTime, setCurrentTime] =
|
|
8601
|
+
const [stocks, setStocks] = useState9([]);
|
|
8602
|
+
const [selectedIndex, setSelectedIndex] = useState9(0);
|
|
8603
|
+
const [loading, setLoading] = useState9(true);
|
|
8604
|
+
const [lastUpdate, setLastUpdate] = useState9("");
|
|
8605
|
+
const [detailView, setDetailView] = useState9(null);
|
|
8606
|
+
const [detailPrices, setDetailPrices] = useState9(null);
|
|
8607
|
+
const [detailLoading, setDetailLoading] = useState9(false);
|
|
8608
|
+
const [detailCountdown, setDetailCountdown] = useState9(10);
|
|
8609
|
+
const [countdown, setCountdown] = useState9(5);
|
|
8610
|
+
const [currentTime, setCurrentTime] = useState9(
|
|
8571
8611
|
() => (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour12: false })
|
|
8572
8612
|
);
|
|
8573
|
-
const [dimMode, setDimMode] =
|
|
8574
|
-
const [sortOrder, setSortOrder] =
|
|
8613
|
+
const [dimMode, setDimMode] = useState9(false);
|
|
8614
|
+
const [sortOrder, setSortOrder] = useState9("default");
|
|
8575
8615
|
const sortedStocks = useMemo2(() => {
|
|
8576
8616
|
if (sortOrder === "default") return stocks;
|
|
8577
8617
|
return [...stocks].toSorted(
|
|
@@ -8579,7 +8619,7 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
8579
8619
|
);
|
|
8580
8620
|
}, [stocks, sortOrder]);
|
|
8581
8621
|
const { doubleCtrlC, handleCtrlC } = useDoubleCtrlC(onExit);
|
|
8582
|
-
|
|
8622
|
+
useEffect8(() => {
|
|
8583
8623
|
const timer = setInterval(() => {
|
|
8584
8624
|
setCurrentTime((/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour12: false }));
|
|
8585
8625
|
}, 1e3);
|
|
@@ -8595,10 +8635,10 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
8595
8635
|
}
|
|
8596
8636
|
setLoading(false);
|
|
8597
8637
|
}, [codes]);
|
|
8598
|
-
|
|
8638
|
+
useEffect8(() => {
|
|
8599
8639
|
void loadData();
|
|
8600
8640
|
}, [loadData]);
|
|
8601
|
-
|
|
8641
|
+
useEffect8(() => {
|
|
8602
8642
|
const interval = setInterval(() => {
|
|
8603
8643
|
setCountdown((prev) => {
|
|
8604
8644
|
if (prev <= 1) {
|
|
@@ -8610,7 +8650,7 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
8610
8650
|
}, 1e3);
|
|
8611
8651
|
return () => clearInterval(interval);
|
|
8612
8652
|
}, [loadData]);
|
|
8613
|
-
|
|
8653
|
+
useEffect8(() => {
|
|
8614
8654
|
if (detailView) {
|
|
8615
8655
|
const loadDetail = () => {
|
|
8616
8656
|
minuteCache.delete(detailView.code);
|
|
@@ -8629,7 +8669,7 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
8629
8669
|
setDetailPrices(null);
|
|
8630
8670
|
setDetailLoading(false);
|
|
8631
8671
|
}, [detailView]);
|
|
8632
|
-
|
|
8672
|
+
useEffect8(() => {
|
|
8633
8673
|
if (!detailView) return;
|
|
8634
8674
|
const timer = setInterval(() => {
|
|
8635
8675
|
setDetailCountdown((prev) => prev > 0 ? prev - 1 : 10);
|
|
@@ -8674,64 +8714,64 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
8674
8714
|
);
|
|
8675
8715
|
if (detailView) {
|
|
8676
8716
|
if (detailLoading) {
|
|
8677
|
-
return /* @__PURE__ */
|
|
8717
|
+
return /* @__PURE__ */ jsx15(Box15, { paddingLeft: 1, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: " \u27F3 \u52A0\u8F7D\u5206\u65F6\u6570\u636E..." }) });
|
|
8678
8718
|
}
|
|
8679
8719
|
return renderDetail(detailView, () => setDetailView(null), detailPrices ?? void 0, detailCountdown, currentTime);
|
|
8680
8720
|
}
|
|
8681
8721
|
const cp2 = (c) => dimMode ? { dimColor: true } : { color: c };
|
|
8682
|
-
return /* @__PURE__ */
|
|
8683
|
-
/* @__PURE__ */
|
|
8684
|
-
/* @__PURE__ */
|
|
8685
|
-
/* @__PURE__ */
|
|
8722
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", children: [
|
|
8723
|
+
/* @__PURE__ */ jsxs15(Box15, { marginBottom: 1, justifyContent: "space-between", children: [
|
|
8724
|
+
/* @__PURE__ */ jsx15(Text16, { bold: true, ...cp2("#00ffff"), children: " \u{1F4C8} \u81EA\u9009\u80A1\u76D1\u63A7" }),
|
|
8725
|
+
/* @__PURE__ */ jsxs15(Text16, { dimColor: true, children: [
|
|
8686
8726
|
" \u{1F550} ",
|
|
8687
8727
|
currentTime
|
|
8688
8728
|
] }),
|
|
8689
|
-
/* @__PURE__ */
|
|
8729
|
+
/* @__PURE__ */ jsx15(Text16, { dimColor: true, children: loading ? " \u27F3 \u5237\u65B0\u4E2D..." : ` ${countdown}s \u540E\u81EA\u52A8\u5237\u65B0` })
|
|
8690
8730
|
] }),
|
|
8691
|
-
/* @__PURE__ */
|
|
8692
|
-
/* @__PURE__ */
|
|
8693
|
-
/* @__PURE__ */
|
|
8694
|
-
/* @__PURE__ */
|
|
8695
|
-
/* @__PURE__ */
|
|
8696
|
-
/* @__PURE__ */
|
|
8731
|
+
/* @__PURE__ */ jsxs15(Box15, { children: [
|
|
8732
|
+
/* @__PURE__ */ jsx15(Box15, { width: 3 }),
|
|
8733
|
+
/* @__PURE__ */ jsx15(Box15, { width: 9, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u4EE3\u7801" }) }),
|
|
8734
|
+
/* @__PURE__ */ jsx15(Box15, { width: 16, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u540D\u79F0" }) }),
|
|
8735
|
+
/* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u6700\u65B0\u4EF7" }) }),
|
|
8736
|
+
/* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsxs15(Text16, { dimColor: true, children: [
|
|
8697
8737
|
"\u6DA8\u8DCC\u5E45",
|
|
8698
8738
|
sortOrder === "desc" ? " \u25BC" : sortOrder === "asc" ? " \u25B2" : ""
|
|
8699
8739
|
] }) }),
|
|
8700
|
-
/* @__PURE__ */
|
|
8701
|
-
/* @__PURE__ */
|
|
8702
|
-
/* @__PURE__ */
|
|
8703
|
-
/* @__PURE__ */
|
|
8740
|
+
/* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u6DA8\u8DCC\u989D" }) }),
|
|
8741
|
+
/* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u6700\u9AD8" }) }),
|
|
8742
|
+
/* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u6700\u4F4E" }) }),
|
|
8743
|
+
/* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: "\u6210\u4EA4\u989D" }) })
|
|
8704
8744
|
] }),
|
|
8705
|
-
/* @__PURE__ */
|
|
8706
|
-
/* @__PURE__ */
|
|
8745
|
+
/* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: " " + "\u2500".repeat(100) }) }),
|
|
8746
|
+
/* @__PURE__ */ jsx15(Box15, { flexDirection: "column", children: sortedStocks.map((stock, index) => {
|
|
8707
8747
|
const isSelected = index === selectedIndex;
|
|
8708
8748
|
const isUp = stock.changePercent >= 0;
|
|
8709
8749
|
const color = isUp ? "#ff1493" : "#00ff41";
|
|
8710
|
-
return /* @__PURE__ */
|
|
8711
|
-
/* @__PURE__ */
|
|
8712
|
-
/* @__PURE__ */
|
|
8713
|
-
/* @__PURE__ */
|
|
8714
|
-
/* @__PURE__ */
|
|
8715
|
-
/* @__PURE__ */
|
|
8750
|
+
return /* @__PURE__ */ jsxs15(Box15, { children: [
|
|
8751
|
+
/* @__PURE__ */ jsx15(Box15, { width: 3, flexShrink: 0, children: isSelected ? /* @__PURE__ */ jsx15(Text16, { bold: true, ...cp2("#00ffff"), children: "\u25B8 " }) : /* @__PURE__ */ jsx15(Text16, { children: " " }) }),
|
|
8752
|
+
/* @__PURE__ */ jsx15(Box15, { width: 9, children: /* @__PURE__ */ jsx15(Text16, { bold: true, ...cp2(isSelected ? "#00ffff" : "#ffffff"), children: stock.code }) }),
|
|
8753
|
+
/* @__PURE__ */ jsx15(Box15, { width: 16, children: /* @__PURE__ */ jsx15(Text16, { ...cp2(isSelected ? "#ffffff" : "#cccccc"), children: stock.name }) }),
|
|
8754
|
+
/* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { bold: true, ...cp2(color), children: formatPrice(stock.price) }) }),
|
|
8755
|
+
/* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsxs15(Text16, { ...cp2(color), children: [
|
|
8716
8756
|
isUp ? "+" : "",
|
|
8717
8757
|
stock.changePercent.toFixed(2),
|
|
8718
8758
|
"%"
|
|
8719
8759
|
] }) }),
|
|
8720
|
-
/* @__PURE__ */
|
|
8760
|
+
/* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsxs15(Text16, { ...cp2(color), children: [
|
|
8721
8761
|
isUp ? "+" : "",
|
|
8722
8762
|
stock.changeAmount.toFixed(3)
|
|
8723
8763
|
] }) }),
|
|
8724
|
-
/* @__PURE__ */
|
|
8725
|
-
/* @__PURE__ */
|
|
8726
|
-
/* @__PURE__ */
|
|
8764
|
+
/* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { ...cp2("#cccccc"), children: formatPrice(stock.high) }) }),
|
|
8765
|
+
/* @__PURE__ */ jsx15(Box15, { width: 12, children: /* @__PURE__ */ jsx15(Text16, { ...cp2("#888888"), children: formatPrice(stock.low) }) }),
|
|
8766
|
+
/* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsx15(Text16, { ...cp2("#888888"), children: formatAmount(stock.amount) }) })
|
|
8727
8767
|
] }, stock.code);
|
|
8728
8768
|
}) }),
|
|
8729
|
-
/* @__PURE__ */
|
|
8730
|
-
/* @__PURE__ */
|
|
8731
|
-
/* @__PURE__ */
|
|
8732
|
-
/* @__PURE__ */
|
|
8769
|
+
/* @__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` }) }),
|
|
8770
|
+
/* @__PURE__ */ jsxs15(Box15, { children: [
|
|
8771
|
+
/* @__PURE__ */ jsx15(Text16, { dimColor: true, children: ` \u6700\u540E\u66F4\u65B0: ${lastUpdate} \u7F16\u8F91\u81EA\u9009\u80A1: ` }),
|
|
8772
|
+
/* @__PURE__ */ jsx15(Text16, { ...cp2("#c792ea"), children: osc8Link(toFileUrl(SETTINGS_PATH), SETTINGS_PATH) })
|
|
8733
8773
|
] }),
|
|
8734
|
-
doubleCtrlC && /* @__PURE__ */
|
|
8774
|
+
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" }) })
|
|
8735
8775
|
] });
|
|
8736
8776
|
}
|
|
8737
8777
|
function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {
|
|
@@ -8749,33 +8789,33 @@ function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {
|
|
|
8749
8789
|
raw = raw.replaceAll("\u256D", "\u250C").replaceAll("\u256E", "\u2510").replaceAll("\u2570", "\u2514").replaceAll("\u256F", "\u2518");
|
|
8750
8790
|
chartLines = raw.split("\n");
|
|
8751
8791
|
}
|
|
8752
|
-
return /* @__PURE__ */
|
|
8753
|
-
/* @__PURE__ */
|
|
8754
|
-
/* @__PURE__ */
|
|
8755
|
-
/* @__PURE__ */
|
|
8792
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", paddingLeft: 1, children: [
|
|
8793
|
+
/* @__PURE__ */ jsxs15(Box15, { marginBottom: 1, justifyContent: "space-between", children: [
|
|
8794
|
+
/* @__PURE__ */ jsxs15(Box15, { children: [
|
|
8795
|
+
/* @__PURE__ */ jsxs15(Text16, { bold: true, color: "#00ffff", children: [
|
|
8756
8796
|
" \u{1F4CA} ",
|
|
8757
8797
|
stock.name,
|
|
8758
8798
|
" "
|
|
8759
8799
|
] }),
|
|
8760
|
-
/* @__PURE__ */
|
|
8761
|
-
currentTime && /* @__PURE__ */
|
|
8800
|
+
/* @__PURE__ */ jsx15(Text16, { dimColor: true, children: stock.code }),
|
|
8801
|
+
currentTime && /* @__PURE__ */ jsxs15(Text16, { dimColor: true, children: [
|
|
8762
8802
|
" \u{1F550} ",
|
|
8763
8803
|
currentTime
|
|
8764
8804
|
] })
|
|
8765
8805
|
] }),
|
|
8766
|
-
/* @__PURE__ */
|
|
8806
|
+
/* @__PURE__ */ jsx15(Text16, { dimColor: true, children: `${countdown}s \u540E\u5237\u65B0` })
|
|
8767
8807
|
] }),
|
|
8768
|
-
/* @__PURE__ */
|
|
8769
|
-
/* @__PURE__ */
|
|
8770
|
-
/* @__PURE__ */
|
|
8808
|
+
/* @__PURE__ */ jsxs15(Box15, { children: [
|
|
8809
|
+
/* @__PURE__ */ jsx15(Box15, { width: 16, children: /* @__PURE__ */ jsx15(Text16, { bold: true, color: "#888888", children: "\u5F53\u524D\u4EF7" }) }),
|
|
8810
|
+
/* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsxs15(Text16, { bold: true, color: colorCode, children: [
|
|
8771
8811
|
arrow,
|
|
8772
8812
|
" ",
|
|
8773
8813
|
formatPrice(stock.price)
|
|
8774
8814
|
] }) })
|
|
8775
8815
|
] }),
|
|
8776
|
-
/* @__PURE__ */
|
|
8777
|
-
/* @__PURE__ */
|
|
8778
|
-
/* @__PURE__ */
|
|
8816
|
+
/* @__PURE__ */ jsxs15(Box15, { children: [
|
|
8817
|
+
/* @__PURE__ */ jsx15(Box15, { width: 16, children: /* @__PURE__ */ jsx15(Text16, { color: "#888888", children: "\u6DA8\u8DCC\u5E45" }) }),
|
|
8818
|
+
/* @__PURE__ */ jsx15(Box15, { children: /* @__PURE__ */ jsxs15(Text16, { color: colorCode, children: [
|
|
8779
8819
|
isUp ? "+" : "",
|
|
8780
8820
|
stock.changePercent.toFixed(2),
|
|
8781
8821
|
"%",
|
|
@@ -8784,8 +8824,8 @@ function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {
|
|
|
8784
8824
|
stock.changeAmount.toFixed(3)
|
|
8785
8825
|
] }) })
|
|
8786
8826
|
] }),
|
|
8787
|
-
chartLines.length > 0 && /* @__PURE__ */
|
|
8788
|
-
/* @__PURE__ */
|
|
8827
|
+
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)) }),
|
|
8828
|
+
/* @__PURE__ */ jsx15(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx15(Text16, { dimColor: true, children: " Space/q \u8FD4\u56DE\u5217\u8868" }) })
|
|
8789
8829
|
] });
|
|
8790
8830
|
}
|
|
8791
8831
|
|
|
@@ -8870,7 +8910,7 @@ async function scanProjectFiles(baseDir, dir) {
|
|
|
8870
8910
|
}
|
|
8871
8911
|
|
|
8872
8912
|
// src/cli/index.tsx
|
|
8873
|
-
import { jsx as
|
|
8913
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
8874
8914
|
var SUBCOMMANDS = ["chat", "run", "setup", "init", "completion", "game", "stock"];
|
|
8875
8915
|
function createCli() {
|
|
8876
8916
|
const program2 = new Command();
|
|
@@ -8972,7 +9012,7 @@ compdef _dskcode_completion dskcode`);
|
|
|
8972
9012
|
const freshResult = await loadAndValidate();
|
|
8973
9013
|
const codeList = codes && codes.length > 0 ? codes : freshResult.config.stock?.symbols?.map((s) => s.code) ?? ["sh000001", "sz399006", "sh601688"];
|
|
8974
9014
|
const app = renderApp(
|
|
8975
|
-
/* @__PURE__ */
|
|
9015
|
+
/* @__PURE__ */ jsx16(
|
|
8976
9016
|
StockList,
|
|
8977
9017
|
{
|
|
8978
9018
|
codes: codeList,
|
|
@@ -9001,7 +9041,7 @@ compdef _dskcode_completion dskcode`);
|
|
|
9001
9041
|
}
|
|
9002
9042
|
const selectedGame = await new Promise((resolve2) => {
|
|
9003
9043
|
const { unmount } = render4(
|
|
9004
|
-
/* @__PURE__ */
|
|
9044
|
+
/* @__PURE__ */ jsx16(
|
|
9005
9045
|
GamePicker,
|
|
9006
9046
|
{
|
|
9007
9047
|
games,
|
|
@@ -9041,7 +9081,7 @@ async function startChat(ctx, costTracker) {
|
|
|
9041
9081
|
);
|
|
9042
9082
|
const model = defaultProvider?.model ?? "deepseek-v4-flash";
|
|
9043
9083
|
const chatApp = renderApp(
|
|
9044
|
-
/* @__PURE__ */
|
|
9084
|
+
/* @__PURE__ */ jsx16(
|
|
9045
9085
|
ChatSession,
|
|
9046
9086
|
{
|
|
9047
9087
|
skillCount,
|
|
@@ -9059,7 +9099,7 @@ async function startChat(ctx, costTracker) {
|
|
|
9059
9099
|
initGames();
|
|
9060
9100
|
const games = listGames();
|
|
9061
9101
|
const { unmount } = render4(
|
|
9062
|
-
/* @__PURE__ */
|
|
9102
|
+
/* @__PURE__ */ jsx16(
|
|
9063
9103
|
GamePicker,
|
|
9064
9104
|
{
|
|
9065
9105
|
games,
|
|
@@ -9083,7 +9123,7 @@ async function startChat(ctx, costTracker) {
|
|
|
9083
9123
|
setImmediate(() => {
|
|
9084
9124
|
const defaultStockCodes = ctx?.config.stock?.symbols?.map((s) => s.code) ?? ["sh000001", "sz399006", "sh601688"];
|
|
9085
9125
|
const stockApp = renderApp(
|
|
9086
|
-
/* @__PURE__ */
|
|
9126
|
+
/* @__PURE__ */ jsx16(
|
|
9087
9127
|
StockList,
|
|
9088
9128
|
{
|
|
9089
9129
|
codes: defaultStockCodes,
|