dskcode 0.1.25 → 0.1.26
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/{chunk-EF6NIFOH.js → chunk-UV4IWYHZ.js} +1 -1
- package/dist/{chunk-EF6NIFOH.js.map → chunk-UV4IWYHZ.js.map} +1 -1
- package/dist/deepseek-PGX76BK5.js +7 -0
- package/dist/index.js +516 -192
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/deepseek-MG4NT5YC.js +0 -7
- /package/dist/{deepseek-MG4NT5YC.js.map → deepseek-PGX76BK5.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
estimateTokens,
|
|
8
8
|
getModelMeta,
|
|
9
9
|
isSupportedModel
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UV4IWYHZ.js";
|
|
11
11
|
|
|
12
12
|
// src/cli/index.tsx
|
|
13
13
|
import { Command } from "commander";
|
|
@@ -805,7 +805,7 @@ var LOGO_LINES = [
|
|
|
805
805
|
];
|
|
806
806
|
|
|
807
807
|
// src/ui/ChatSession.tsx
|
|
808
|
-
import { Box as
|
|
808
|
+
import { Box as Box9, Text as Text10, useInput, Static } from "ink";
|
|
809
809
|
import TextInput from "ink-text-input";
|
|
810
810
|
import { useEffect as useEffect3, useState as useState3, useCallback as useCallback2, useMemo, useRef as useRef2 } from "react";
|
|
811
811
|
|
|
@@ -841,7 +841,7 @@ function useDoubleCtrlC(onExit) {
|
|
|
841
841
|
import InkSpinner2 from "ink-spinner";
|
|
842
842
|
|
|
843
843
|
// src/ui/AssistantMessage.tsx
|
|
844
|
-
import { Box as
|
|
844
|
+
import { Box as Box5, Text as Text6 } from "ink";
|
|
845
845
|
|
|
846
846
|
// src/provider/cost-tracker.ts
|
|
847
847
|
import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile2 } from "fs/promises";
|
|
@@ -1248,8 +1248,69 @@ function formatUsageSummary(usage) {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
|
|
1250
1250
|
// src/ui/HighlightedText.tsx
|
|
1251
|
-
import { Text as Text5 } from "ink";
|
|
1252
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1251
|
+
import { Box as Box4, Text as Text5 } from "ink";
|
|
1252
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1253
|
+
function parseCodeBlocks(text) {
|
|
1254
|
+
const segments = [];
|
|
1255
|
+
let current = 0;
|
|
1256
|
+
while (current < text.length) {
|
|
1257
|
+
const openIdx = text.indexOf("```", current);
|
|
1258
|
+
if (openIdx === -1) {
|
|
1259
|
+
segments.push({ text: text.slice(current), type: "plain" });
|
|
1260
|
+
break;
|
|
1261
|
+
}
|
|
1262
|
+
if (openIdx > current) {
|
|
1263
|
+
segments.push({ text: text.slice(current, openIdx), type: "plain" });
|
|
1264
|
+
}
|
|
1265
|
+
const closeIdx = text.indexOf("```", openIdx + 3);
|
|
1266
|
+
if (closeIdx === -1) {
|
|
1267
|
+
segments.push({ text: text.slice(openIdx), type: "plain" });
|
|
1268
|
+
break;
|
|
1269
|
+
}
|
|
1270
|
+
const codeContent = text.slice(openIdx + 3, closeIdx);
|
|
1271
|
+
segments.push({ text: codeContent, type: "code_block" });
|
|
1272
|
+
current = closeIdx + 3;
|
|
1273
|
+
}
|
|
1274
|
+
return segments;
|
|
1275
|
+
}
|
|
1276
|
+
function isTableRow(line) {
|
|
1277
|
+
const t = line.trim();
|
|
1278
|
+
return /^\|.+\|$/.test(t);
|
|
1279
|
+
}
|
|
1280
|
+
function isTableSepRow(line) {
|
|
1281
|
+
const t = line.trim();
|
|
1282
|
+
return /^\|[-: |]+\|$/.test(t) && t.includes("-");
|
|
1283
|
+
}
|
|
1284
|
+
function parseTables(text) {
|
|
1285
|
+
const lines = text.split("\n");
|
|
1286
|
+
const result = [];
|
|
1287
|
+
let plainBuf = "";
|
|
1288
|
+
function flushPlain() {
|
|
1289
|
+
if (plainBuf) {
|
|
1290
|
+
result.push({ text: plainBuf, type: "plain" });
|
|
1291
|
+
plainBuf = "";
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1295
|
+
const line = lines[i] ?? "";
|
|
1296
|
+
if (isTableRow(line) && i + 1 < lines.length && isTableSepRow(lines[i + 1] ?? "") && i + 2 < lines.length && isTableRow(lines[i + 2] ?? "")) {
|
|
1297
|
+
flushPlain();
|
|
1298
|
+
const tableLineList = [];
|
|
1299
|
+
let j = i;
|
|
1300
|
+
while (j < lines.length && isTableRow(lines[j] ?? "")) {
|
|
1301
|
+
tableLineList.push(lines[j]);
|
|
1302
|
+
j++;
|
|
1303
|
+
}
|
|
1304
|
+
result.push({ text: tableLineList.join("\n"), type: "table" });
|
|
1305
|
+
i = j - 1;
|
|
1306
|
+
} else {
|
|
1307
|
+
if (plainBuf) plainBuf += "\n" + line;
|
|
1308
|
+
else plainBuf = line;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
flushPlain();
|
|
1312
|
+
return result;
|
|
1313
|
+
}
|
|
1253
1314
|
function parseBoldPairs(text) {
|
|
1254
1315
|
const segments = [];
|
|
1255
1316
|
let current = 0;
|
|
@@ -1272,24 +1333,23 @@ function parseBoldPairs(text) {
|
|
|
1272
1333
|
}
|
|
1273
1334
|
return segments;
|
|
1274
1335
|
}
|
|
1275
|
-
function
|
|
1336
|
+
function parseInlineCode(text) {
|
|
1276
1337
|
const result = [];
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1338
|
+
let current = 0;
|
|
1339
|
+
while (current < text.length) {
|
|
1340
|
+
const openIdx = text.indexOf("`", current);
|
|
1341
|
+
if (openIdx === -1) {
|
|
1342
|
+
result.push({ text: text.slice(current), type: "plain" });
|
|
1343
|
+
break;
|
|
1281
1344
|
}
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
if (openIdx > current) {
|
|
1291
|
-
result.push({ text: text.slice(current, openIdx), type: "plain" });
|
|
1292
|
-
}
|
|
1345
|
+
if (openIdx > current) {
|
|
1346
|
+
result.push({ text: text.slice(current, openIdx), type: "plain" });
|
|
1347
|
+
}
|
|
1348
|
+
let runLength = 1;
|
|
1349
|
+
while (openIdx + runLength < text.length && text[openIdx + runLength] === "`") {
|
|
1350
|
+
runLength++;
|
|
1351
|
+
}
|
|
1352
|
+
if (runLength === 1) {
|
|
1293
1353
|
const closeIdx = text.indexOf("`", openIdx + 1);
|
|
1294
1354
|
if (closeIdx === -1) {
|
|
1295
1355
|
result.push({ text: text.slice(openIdx), type: "plain" });
|
|
@@ -1297,32 +1357,296 @@ function parseCodePairs(segments) {
|
|
|
1297
1357
|
}
|
|
1298
1358
|
result.push({ text: text.slice(openIdx + 1, closeIdx), type: "code" });
|
|
1299
1359
|
current = closeIdx + 1;
|
|
1360
|
+
} else {
|
|
1361
|
+
result.push({
|
|
1362
|
+
text: text.slice(openIdx, openIdx + runLength),
|
|
1363
|
+
type: "plain"
|
|
1364
|
+
});
|
|
1365
|
+
current = openIdx + runLength;
|
|
1300
1366
|
}
|
|
1301
1367
|
}
|
|
1302
1368
|
return result;
|
|
1303
1369
|
}
|
|
1370
|
+
function parseCodePairs(segments) {
|
|
1371
|
+
const result = [];
|
|
1372
|
+
for (const seg of segments) {
|
|
1373
|
+
if (seg.type === "code_block" || seg.type === "table") {
|
|
1374
|
+
result.push(seg);
|
|
1375
|
+
continue;
|
|
1376
|
+
}
|
|
1377
|
+
const parts = parseInlineCode(seg.text);
|
|
1378
|
+
for (const part of parts) {
|
|
1379
|
+
if (part.type === "code") {
|
|
1380
|
+
result.push(part);
|
|
1381
|
+
} else if (seg.type === "bold") {
|
|
1382
|
+
result.push({ text: part.text, type: "bold" });
|
|
1383
|
+
} else {
|
|
1384
|
+
result.push(part);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
return result;
|
|
1389
|
+
}
|
|
1390
|
+
var DIFF_ADD_COLOR = "#22c55e";
|
|
1391
|
+
var DIFF_DEL_COLOR = "#ef4444";
|
|
1392
|
+
var DIFF_HUNK_COLOR = "#00cccc";
|
|
1393
|
+
function CodeBlockRenderer({ code }) {
|
|
1394
|
+
const lines = code.split("\n");
|
|
1395
|
+
const firstLine = lines[0] ?? "";
|
|
1396
|
+
const hasLangLine = firstLine.trim().length > 0 && !firstLine.startsWith("+") && !firstLine.startsWith("-") && !firstLine.startsWith("@@") && !firstLine.startsWith(" ");
|
|
1397
|
+
const lang = hasLangLine ? firstLine : void 0;
|
|
1398
|
+
const codeLines = hasLangLine ? lines.slice(1) : lines;
|
|
1399
|
+
if (codeLines.length === 0) {
|
|
1400
|
+
return hasLangLine ? /* @__PURE__ */ jsx4(Box4, { marginLeft: 2, children: /* @__PURE__ */ jsxs4(Text5, { color: "#888888", children: [
|
|
1401
|
+
"\u250C ",
|
|
1402
|
+
lang
|
|
1403
|
+
] }) }) : null;
|
|
1404
|
+
}
|
|
1405
|
+
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginLeft: 2, marginTop: 1, children: [
|
|
1406
|
+
lang && /* @__PURE__ */ jsxs4(Text5, { color: "#888888", children: [
|
|
1407
|
+
"\u250C ",
|
|
1408
|
+
lang
|
|
1409
|
+
] }),
|
|
1410
|
+
codeLines.map((line, i) => {
|
|
1411
|
+
if (line.startsWith("+")) {
|
|
1412
|
+
return /* @__PURE__ */ jsx4(Text5, { color: DIFF_ADD_COLOR, children: line }, i);
|
|
1413
|
+
}
|
|
1414
|
+
if (line.startsWith("-")) {
|
|
1415
|
+
return /* @__PURE__ */ jsx4(Text5, { color: DIFF_DEL_COLOR, children: line }, i);
|
|
1416
|
+
}
|
|
1417
|
+
if (line.startsWith("@@")) {
|
|
1418
|
+
return /* @__PURE__ */ jsx4(Text5, { color: DIFF_HUNK_COLOR, children: line }, i);
|
|
1419
|
+
}
|
|
1420
|
+
return /* @__PURE__ */ jsx4(Text5, { children: line }, i);
|
|
1421
|
+
})
|
|
1422
|
+
] });
|
|
1423
|
+
}
|
|
1424
|
+
var TABLE_MAX_WIDTH = 90;
|
|
1425
|
+
var TABLE_MIN_COL_WIDTH = 3;
|
|
1426
|
+
function charWidth(ch) {
|
|
1427
|
+
const cp2 = ch.codePointAt(0);
|
|
1428
|
+
if (cp2 === void 0) return 0;
|
|
1429
|
+
if (cp2 >= 4352 && cp2 <= 4447 || // Hangul Jamo
|
|
1430
|
+
cp2 === 9001 || cp2 === 9002 || cp2 >= 11904 && cp2 <= 42191 || // CJK Radicals ~ Yi
|
|
1431
|
+
cp2 >= 43360 && cp2 <= 43391 || // Hangul Extended
|
|
1432
|
+
cp2 >= 44032 && cp2 <= 55215 || // Hangul Syllables
|
|
1433
|
+
cp2 >= 63744 && cp2 <= 64255 || // CJK Compat
|
|
1434
|
+
cp2 >= 65040 && cp2 <= 65055 || // Vertical forms
|
|
1435
|
+
cp2 >= 65281 && cp2 <= 65376 || // Fullwidth
|
|
1436
|
+
cp2 >= 65504 && cp2 <= 65510 || cp2 >= 126976 && cp2 <= 131071) {
|
|
1437
|
+
return 2;
|
|
1438
|
+
}
|
|
1439
|
+
return 1;
|
|
1440
|
+
}
|
|
1441
|
+
function visualWidth(text) {
|
|
1442
|
+
let w = 0;
|
|
1443
|
+
for (const ch of text) {
|
|
1444
|
+
w += charWidth(ch);
|
|
1445
|
+
}
|
|
1446
|
+
return w;
|
|
1447
|
+
}
|
|
1448
|
+
function padToWidth(text, targetWidth, align) {
|
|
1449
|
+
const vw = visualWidth(text);
|
|
1450
|
+
const delta = targetWidth - vw;
|
|
1451
|
+
if (delta <= 0) return text;
|
|
1452
|
+
const leftPad = align === "right" ? delta : align === "center" ? Math.floor(delta / 2) : 0;
|
|
1453
|
+
const rightPad = delta - leftPad;
|
|
1454
|
+
return " ".repeat(leftPad) + text + " ".repeat(rightPad);
|
|
1455
|
+
}
|
|
1456
|
+
function parseTableCells(line) {
|
|
1457
|
+
const t = line.trim();
|
|
1458
|
+
const inner = t.slice(1, t.length - 1);
|
|
1459
|
+
return inner.split("|").map((c) => c.trim());
|
|
1460
|
+
}
|
|
1461
|
+
function parseAlignments(sepLine) {
|
|
1462
|
+
const cells = parseTableCells(sepLine);
|
|
1463
|
+
return cells.map((c) => {
|
|
1464
|
+
const l = c.startsWith(":");
|
|
1465
|
+
const r = c.endsWith(":");
|
|
1466
|
+
if (l && r) return "center";
|
|
1467
|
+
if (r) return "right";
|
|
1468
|
+
return "left";
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
function TableRenderer({ text }) {
|
|
1472
|
+
const rawLines = text.split("\n").filter((l) => l.trim().length > 0);
|
|
1473
|
+
if (rawLines.length < 2) return /* @__PURE__ */ jsx4(Text5, { children: text });
|
|
1474
|
+
let sepIdx = -1;
|
|
1475
|
+
for (let k = 0; k < rawLines.length; k++) {
|
|
1476
|
+
if (isTableSepRow(rawLines[k])) {
|
|
1477
|
+
sepIdx = k;
|
|
1478
|
+
break;
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
if (sepIdx === -1) return /* @__PURE__ */ jsx4(Text5, { children: text });
|
|
1482
|
+
const headerText = rawLines.slice(0, sepIdx).join("");
|
|
1483
|
+
const headerCells = parseTableCells(headerText);
|
|
1484
|
+
const alignments = parseAlignments(rawLines[sepIdx]);
|
|
1485
|
+
const dataRows = rawLines.slice(sepIdx + 1).map(parseTableCells);
|
|
1486
|
+
const colCount = headerCells.length;
|
|
1487
|
+
const colMaxWidths = headerCells.map((_, ci) => {
|
|
1488
|
+
let max = visualWidth(headerCells[ci] ?? "");
|
|
1489
|
+
for (const row of dataRows) {
|
|
1490
|
+
const w = visualWidth(row[ci] ?? "");
|
|
1491
|
+
if (w > max) max = w;
|
|
1492
|
+
}
|
|
1493
|
+
return Math.max(max, TABLE_MIN_COL_WIDTH);
|
|
1494
|
+
});
|
|
1495
|
+
const margin = 2;
|
|
1496
|
+
const totalMinWidth = colMaxWidths.reduce((s, w) => s + w + margin, 1);
|
|
1497
|
+
let colWidths;
|
|
1498
|
+
if (totalMinWidth <= TABLE_MAX_WIDTH) {
|
|
1499
|
+
colWidths = colMaxWidths;
|
|
1500
|
+
} else {
|
|
1501
|
+
const available = TABLE_MAX_WIDTH - 1 - margin * colCount;
|
|
1502
|
+
const sum = colMaxWidths.reduce((s, w) => s + w, 0);
|
|
1503
|
+
colWidths = colMaxWidths.map((w) => Math.max(TABLE_MIN_COL_WIDTH, Math.floor(w / sum * available)));
|
|
1504
|
+
}
|
|
1505
|
+
const H = "\u2500";
|
|
1506
|
+
const makeSep = (l, m, r) => l + colWidths.map((w) => H.repeat(w + margin)).join(m) + r;
|
|
1507
|
+
const topBorder = makeSep("\u250C", "\u252C", "\u2510");
|
|
1508
|
+
const midBorder = makeSep("\u251C", "\u253C", "\u2524");
|
|
1509
|
+
const botBorder = makeSep("\u2514", "\u2534", "\u2518");
|
|
1510
|
+
function rowLine(cells, keyBase) {
|
|
1511
|
+
return /* @__PURE__ */ jsxs4(Text5, { children: [
|
|
1512
|
+
"\u2502",
|
|
1513
|
+
cells.map((cell, ci) => /* @__PURE__ */ jsxs4(Text5, { children: [
|
|
1514
|
+
" ",
|
|
1515
|
+
padToWidth(cell.slice(0, colWidths[ci] ?? TABLE_MIN_COL_WIDTH), colWidths[ci] ?? TABLE_MIN_COL_WIDTH, alignments[ci] ?? "left"),
|
|
1516
|
+
" ",
|
|
1517
|
+
"\u2502"
|
|
1518
|
+
] }, ci))
|
|
1519
|
+
] }, keyBase);
|
|
1520
|
+
}
|
|
1521
|
+
const rows = [
|
|
1522
|
+
/* @__PURE__ */ jsx4(Text5, { color: "#888888", children: topBorder }, "top"),
|
|
1523
|
+
rowLine(headerCells, "hdr"),
|
|
1524
|
+
/* @__PURE__ */ jsx4(Text5, { color: "#888888", children: midBorder }, "mid"),
|
|
1525
|
+
...dataRows.map((cells, ri) => rowLine(cells, `d${ri}`)),
|
|
1526
|
+
/* @__PURE__ */ jsx4(Text5, { color: "#888888", children: botBorder }, "bot")
|
|
1527
|
+
];
|
|
1528
|
+
return /* @__PURE__ */ jsx4(Box4, { flexDirection: "column", marginTop: 1, children: rows });
|
|
1529
|
+
}
|
|
1530
|
+
var EMOJI_CP_RE = /[\u{1F000}-\u{1FFFF}\u{FE00}-\u{FE0F}\u{200D}\u{20E3}\u{2600}-\u{27BF}\u{231A}-\u{23FF}\u{2934}\u{2935}\u{25AA}-\u{25FE}\u{2B50}\u{2B55}\u{00A9}\u{00AE}\u{2122}\u{3030}\u{303D}\u{3297}\u{3299}]/u;
|
|
1531
|
+
function isEmojiCluster(text) {
|
|
1532
|
+
return EMOJI_CP_RE.test(text);
|
|
1533
|
+
}
|
|
1534
|
+
function splitEmojiClusters(text) {
|
|
1535
|
+
try {
|
|
1536
|
+
const segmenter = new Intl.Segmenter("en", {
|
|
1537
|
+
granularity: "grapheme"
|
|
1538
|
+
});
|
|
1539
|
+
const segments = [...segmenter.segment(text)];
|
|
1540
|
+
return segments.map((s) => ({
|
|
1541
|
+
text: s.segment,
|
|
1542
|
+
isEmoji: isEmojiCluster(s.segment)
|
|
1543
|
+
}));
|
|
1544
|
+
} catch {
|
|
1545
|
+
return [{ text, isEmoji: false }];
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
function renderBoldText(text, key) {
|
|
1549
|
+
const clusters = splitEmojiClusters(text);
|
|
1550
|
+
if (clusters.length === 1 && !clusters[0].isEmoji) {
|
|
1551
|
+
return /* @__PURE__ */ jsx4(Text5, { color: BOLD_COLOR, children: text }, key);
|
|
1552
|
+
}
|
|
1553
|
+
const groups = [];
|
|
1554
|
+
for (const c of clusters) {
|
|
1555
|
+
const last = groups[groups.length - 1];
|
|
1556
|
+
if (last && last.isEmoji === c.isEmoji) {
|
|
1557
|
+
last.text += c.text;
|
|
1558
|
+
} else {
|
|
1559
|
+
groups.push({ text: c.text, isEmoji: c.isEmoji });
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
return /* @__PURE__ */ jsx4(Text5, { children: groups.map(
|
|
1563
|
+
(g, i) => g.isEmoji ? g.text : /* @__PURE__ */ jsx4(Text5, { color: BOLD_COLOR, children: g.text }, i)
|
|
1564
|
+
) }, key);
|
|
1565
|
+
}
|
|
1304
1566
|
var CODE_COLOR = "#00BFFF";
|
|
1305
1567
|
var BOLD_COLOR = "#A855F7";
|
|
1306
1568
|
function HighlightedText({ children: text }) {
|
|
1307
|
-
const
|
|
1308
|
-
const
|
|
1309
|
-
const
|
|
1310
|
-
|
|
1311
|
-
|
|
1569
|
+
const codeBlockSegments = parseCodeBlocks(text);
|
|
1570
|
+
const tableSegments = [];
|
|
1571
|
+
for (const seg of codeBlockSegments) {
|
|
1572
|
+
if (seg.type === "code_block") {
|
|
1573
|
+
tableSegments.push(seg);
|
|
1574
|
+
} else {
|
|
1575
|
+
tableSegments.push(...parseTables(seg.text));
|
|
1576
|
+
}
|
|
1312
1577
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1578
|
+
const boldSegments = [];
|
|
1579
|
+
for (const seg of tableSegments) {
|
|
1580
|
+
if (seg.type === "code_block" || seg.type === "table") {
|
|
1581
|
+
boldSegments.push(seg);
|
|
1582
|
+
} else {
|
|
1583
|
+
boldSegments.push(...parseBoldPairs(seg.text));
|
|
1316
1584
|
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1585
|
+
}
|
|
1586
|
+
const segments = parseCodePairs(boldSegments);
|
|
1587
|
+
const hasBlock = segments.some(
|
|
1588
|
+
(s) => s.type === "code_block" || s.type === "table"
|
|
1589
|
+
);
|
|
1590
|
+
if (!hasBlock) {
|
|
1591
|
+
const isSimple = segments.length === 1 && segments[0].type === "plain";
|
|
1592
|
+
if (isSimple) {
|
|
1593
|
+
return /* @__PURE__ */ jsx4(Text5, { wrap: "wrap", children: text });
|
|
1594
|
+
}
|
|
1595
|
+
return /* @__PURE__ */ jsx4(Text5, { wrap: "wrap", children: segments.map((seg, i) => {
|
|
1596
|
+
if (seg.type === "code") {
|
|
1597
|
+
return /* @__PURE__ */ jsx4(Text5, { color: CODE_COLOR, children: seg.text }, i);
|
|
1598
|
+
}
|
|
1599
|
+
if (seg.type === "bold") {
|
|
1600
|
+
return renderBoldText(seg.text, i);
|
|
1601
|
+
}
|
|
1602
|
+
return seg.text;
|
|
1603
|
+
}) });
|
|
1604
|
+
}
|
|
1605
|
+
const rendered = [];
|
|
1606
|
+
let inlineGroup = [];
|
|
1607
|
+
function flushInline(groupIdx) {
|
|
1608
|
+
if (inlineGroup.length === 0) return;
|
|
1609
|
+
const isSimpleInline = inlineGroup.length === 1 && inlineGroup[0].type === "plain";
|
|
1610
|
+
if (isSimpleInline) {
|
|
1611
|
+
rendered.push(
|
|
1612
|
+
/* @__PURE__ */ jsx4(Text5, { wrap: "wrap", children: inlineGroup[0].text }, groupIdx)
|
|
1613
|
+
);
|
|
1614
|
+
} else {
|
|
1615
|
+
rendered.push(
|
|
1616
|
+
/* @__PURE__ */ jsx4(Text5, { wrap: "wrap", children: inlineGroup.map((seg, j) => {
|
|
1617
|
+
if (seg.type === "code") {
|
|
1618
|
+
return /* @__PURE__ */ jsx4(Text5, { color: CODE_COLOR, children: seg.text }, j);
|
|
1619
|
+
}
|
|
1620
|
+
if (seg.type === "bold") {
|
|
1621
|
+
return renderBoldText(seg.text, j);
|
|
1622
|
+
}
|
|
1623
|
+
return seg.text;
|
|
1624
|
+
}) }, groupIdx)
|
|
1625
|
+
);
|
|
1626
|
+
}
|
|
1627
|
+
inlineGroup = [];
|
|
1628
|
+
}
|
|
1629
|
+
for (const seg of segments) {
|
|
1630
|
+
if (seg.type === "code_block") {
|
|
1631
|
+
flushInline(rendered.length);
|
|
1632
|
+
rendered.push(
|
|
1633
|
+
/* @__PURE__ */ jsx4(CodeBlockRenderer, { code: seg.text }, `b${rendered.length}`)
|
|
1634
|
+
);
|
|
1635
|
+
} else if (seg.type === "table") {
|
|
1636
|
+
flushInline(rendered.length);
|
|
1637
|
+
rendered.push(
|
|
1638
|
+
/* @__PURE__ */ jsx4(TableRenderer, { text: seg.text }, `t${rendered.length}`)
|
|
1639
|
+
);
|
|
1640
|
+
} else {
|
|
1641
|
+
inlineGroup.push(seg);
|
|
1319
1642
|
}
|
|
1320
|
-
|
|
1321
|
-
|
|
1643
|
+
}
|
|
1644
|
+
flushInline(rendered.length);
|
|
1645
|
+
return /* @__PURE__ */ jsx4(Box4, { flexDirection: "column", children: rendered });
|
|
1322
1646
|
}
|
|
1323
1647
|
|
|
1324
1648
|
// src/ui/AssistantMessage.tsx
|
|
1325
|
-
import { jsx as jsx5, jsxs as
|
|
1649
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1326
1650
|
function formatElapsed(ms) {
|
|
1327
1651
|
if (ms < 1e3) return `${ms}ms`;
|
|
1328
1652
|
const seconds = (ms / 1e3).toFixed(1);
|
|
@@ -1340,23 +1664,23 @@ function AssistantMessage({
|
|
|
1340
1664
|
if (!content && (!toolCalls || toolCalls.length === 0) && !isStreaming) {
|
|
1341
1665
|
return null;
|
|
1342
1666
|
}
|
|
1343
|
-
return /* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */ jsx5(
|
|
1346
|
-
/* @__PURE__ */
|
|
1667
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginTop: 1, children: [
|
|
1668
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", children: [
|
|
1669
|
+
/* @__PURE__ */ jsx5(Box5, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx5(Text6, { bold: true, color: "#ff00ff", children: "\u{1F916}" }) }),
|
|
1670
|
+
/* @__PURE__ */ jsxs5(Box5, { flexGrow: 1, flexDirection: "column", children: [
|
|
1347
1671
|
content && /* @__PURE__ */ jsx5(HighlightedText, { children: content }),
|
|
1348
1672
|
isStreaming && !content && /* @__PURE__ */ jsx5(Text6, { color: "#888888", children: "..." })
|
|
1349
1673
|
] })
|
|
1350
1674
|
] }),
|
|
1351
|
-
toolCalls && toolCalls.length > 0 && /* @__PURE__ */ jsx5(
|
|
1352
|
-
!isStreaming && (usage || elapsed !== void 0) && /* @__PURE__ */
|
|
1675
|
+
toolCalls && toolCalls.length > 0 && /* @__PURE__ */ jsx5(Box5, { flexDirection: "column", children: toolCalls.map((tc, i) => /* @__PURE__ */ jsx5(ToolCallBlock, { call: tc }, tc.id ?? i)) }),
|
|
1676
|
+
!isStreaming && (usage || elapsed !== void 0) && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginTop: 1, marginLeft: 3, children: [
|
|
1353
1677
|
/* @__PURE__ */ jsx5(Text6, { color: "#555555", children: "\u2500".repeat(36) }),
|
|
1354
|
-
/* @__PURE__ */
|
|
1355
|
-
cost !== void 0 && cost > 0 && /* @__PURE__ */
|
|
1678
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 2, children: [
|
|
1679
|
+
cost !== void 0 && cost > 0 && /* @__PURE__ */ jsxs5(Text6, { color: "yellow", children: [
|
|
1356
1680
|
"\u{1F4B0} \u672C\u6B21 ",
|
|
1357
1681
|
formatMoney(cost)
|
|
1358
1682
|
] }),
|
|
1359
|
-
elapsed !== void 0 && /* @__PURE__ */
|
|
1683
|
+
elapsed !== void 0 && /* @__PURE__ */ jsxs5(Text6, { color: "cyan", children: [
|
|
1360
1684
|
"\u{1F550} ",
|
|
1361
1685
|
formatElapsed(elapsed)
|
|
1362
1686
|
] }),
|
|
@@ -1367,8 +1691,8 @@ function AssistantMessage({
|
|
|
1367
1691
|
}
|
|
1368
1692
|
|
|
1369
1693
|
// src/ui/DiffPreview.tsx
|
|
1370
|
-
import { Box as
|
|
1371
|
-
import { jsx as jsx6, jsxs as
|
|
1694
|
+
import { Box as Box6, Text as Text7 } from "ink";
|
|
1695
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1372
1696
|
function DiffPreview({ diff }) {
|
|
1373
1697
|
const { patch, additions, deletions, existedBefore, filePath } = diff;
|
|
1374
1698
|
if (!patch || patch.length === 0) {
|
|
@@ -1376,15 +1700,15 @@ function DiffPreview({ diff }) {
|
|
|
1376
1700
|
}
|
|
1377
1701
|
const lines = patch.split("\n");
|
|
1378
1702
|
const fileName = filePath.replace(/\\/g, "/").split("/").pop() ?? filePath;
|
|
1379
|
-
return /* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
1381
|
-
/* @__PURE__ */
|
|
1703
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginTop: 1, children: [
|
|
1704
|
+
/* @__PURE__ */ jsxs6(Box6, { flexDirection: "row", gap: 1, children: [
|
|
1705
|
+
/* @__PURE__ */ jsxs6(Text7, { bold: true, color: "#00ffff", children: [
|
|
1382
1706
|
"\u{1F4DD} ",
|
|
1383
1707
|
existedBefore ? "\u4FEE\u6539" : "\u65B0\u5EFA",
|
|
1384
1708
|
":"
|
|
1385
1709
|
] }),
|
|
1386
1710
|
/* @__PURE__ */ jsx6(Text7, { bold: true, children: fileName }),
|
|
1387
|
-
/* @__PURE__ */
|
|
1711
|
+
/* @__PURE__ */ jsxs6(Text7, { color: "#555555", children: [
|
|
1388
1712
|
"(+",
|
|
1389
1713
|
additions,
|
|
1390
1714
|
" -",
|
|
@@ -1392,7 +1716,7 @@ function DiffPreview({ diff }) {
|
|
|
1392
1716
|
")"
|
|
1393
1717
|
] })
|
|
1394
1718
|
] }),
|
|
1395
|
-
/* @__PURE__ */ jsx6(
|
|
1719
|
+
/* @__PURE__ */ jsx6(Box6, { flexDirection: "column", marginLeft: 2, children: lines.filter((line) => !line.startsWith("---") && !line.startsWith("+++")).map((line, i) => /* @__PURE__ */ jsx6(DiffLine, { line }, i)) })
|
|
1396
1720
|
] });
|
|
1397
1721
|
}
|
|
1398
1722
|
function DiffLine({ line }) {
|
|
@@ -1412,8 +1736,8 @@ function DiffLine({ line }) {
|
|
|
1412
1736
|
}
|
|
1413
1737
|
|
|
1414
1738
|
// src/ui/SkillSelector.tsx
|
|
1415
|
-
import { Box as
|
|
1416
|
-
import { jsx as jsx7, jsxs as
|
|
1739
|
+
import { Box as Box7, Text as Text8 } from "ink";
|
|
1740
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1417
1741
|
var HIGHLIGHT_COLOR = "#00bfff";
|
|
1418
1742
|
function SkillSelector({ skills, input, selectedIndex }) {
|
|
1419
1743
|
const match = input.match(/(?:^|\s)\/([^/]*)$/);
|
|
@@ -1423,19 +1747,19 @@ function SkillSelector({ skills, input, selectedIndex }) {
|
|
|
1423
1747
|
const matched = !query && input.startsWith("/") ? skills.slice(0, 3) : skills.filter((s) => s.name.toLowerCase().includes(query)).slice(0, 3);
|
|
1424
1748
|
if (query && matched.some((s) => s.name.toLowerCase() === query)) return null;
|
|
1425
1749
|
if (matched.length === 0) return null;
|
|
1426
|
-
return /* @__PURE__ */
|
|
1750
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginLeft: 4, marginTop: 1, children: [
|
|
1427
1751
|
/* @__PURE__ */ jsx7(Text8, { color: "#808080", dimColor: true, children: "\u652F\u6301\u7684 Skill\uFF1A" }),
|
|
1428
|
-
matched.map((skill, i) => /* @__PURE__ */ jsx7(
|
|
1752
|
+
matched.map((skill, i) => /* @__PURE__ */ jsx7(Box7, { children: /* @__PURE__ */ jsxs7(Text8, { color: i === selectedIndex ? HIGHLIGHT_COLOR : "#808080", children: [
|
|
1429
1753
|
i === selectedIndex ? " \u203A " : " ",
|
|
1430
1754
|
skill.name
|
|
1431
1755
|
] }) }, skill.name)),
|
|
1432
|
-
/* @__PURE__ */ jsx7(
|
|
1756
|
+
/* @__PURE__ */ jsx7(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx7(Text8, { color: "#808080", dimColor: true, children: "\u2191\u2193 \u9009\u62E9 \xB7 Tab \u8865\u5168" }) })
|
|
1433
1757
|
] });
|
|
1434
1758
|
}
|
|
1435
1759
|
|
|
1436
1760
|
// src/ui/FileSelector.tsx
|
|
1437
|
-
import { Box as
|
|
1438
|
-
import { jsx as jsx8, jsxs as
|
|
1761
|
+
import { Box as Box8, Text as Text9 } from "ink";
|
|
1762
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1439
1763
|
var HIGHLIGHT_COLOR2 = "#00ff41";
|
|
1440
1764
|
function FileSelector({ files, input, selectedIndex }) {
|
|
1441
1765
|
const match = input.match(/(?:^|\s)@([^@]*)$/);
|
|
@@ -1445,13 +1769,13 @@ function FileSelector({ files, input, selectedIndex }) {
|
|
|
1445
1769
|
const matched = !query && input.startsWith("@") ? files.slice(0, 5) : files.filter((f) => f.toLowerCase().includes(query)).slice(0, 5);
|
|
1446
1770
|
if (query && matched.some((f) => f.toLowerCase() === query)) return null;
|
|
1447
1771
|
if (matched.length === 0) return null;
|
|
1448
|
-
return /* @__PURE__ */
|
|
1772
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginLeft: 4, marginTop: 1, children: [
|
|
1449
1773
|
/* @__PURE__ */ jsx8(Text9, { color: "#808080", dimColor: true, children: "\u9879\u76EE\u6587\u4EF6\uFF1A" }),
|
|
1450
|
-
matched.map((file, i) => /* @__PURE__ */ jsx8(
|
|
1774
|
+
matched.map((file, i) => /* @__PURE__ */ jsx8(Box8, { children: /* @__PURE__ */ jsxs8(Text9, { color: i === selectedIndex ? HIGHLIGHT_COLOR2 : "#808080", children: [
|
|
1451
1775
|
i === selectedIndex ? " \u203A " : " ",
|
|
1452
1776
|
file
|
|
1453
1777
|
] }) }, file)),
|
|
1454
|
-
/* @__PURE__ */ jsx8(
|
|
1778
|
+
/* @__PURE__ */ jsx8(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx8(Text9, { color: "#808080", dimColor: true, children: "\u2191\u2193 \u9009\u62E9 \xB7 Tab \u8865\u5168" }) })
|
|
1455
1779
|
] });
|
|
1456
1780
|
}
|
|
1457
1781
|
|
|
@@ -1549,10 +1873,10 @@ var AlwaysAllowGate = class {
|
|
|
1549
1873
|
import Handlebars from "handlebars";
|
|
1550
1874
|
|
|
1551
1875
|
// src/agent/prompts/system-prompt.hbs
|
|
1552
|
-
var system_prompt_default = '\u4F60\u662F dskcode\uFF0C\u4E00\u4E2A\u57FA\u4E8E DeepSeek \u7684 AI \u7F16\u7A0B\u52A9\u624B\uFF0C\u8FD0\u884C\u5728\u7528\u6237\u7EC8\u7AEF\u4E2D\u3002\u4F60\u7684\u804C\u8D23\u662F\u5E2E\u52A9\u5F00\u53D1\u8005\u7F16\u5199\u3001\u7406\u89E3\u3001\u8C03\u8BD5\u548C\u91CD\u6784\u4EE3\u7801\u3002\r\n\r\n## \u6838\u5FC3\u539F\u5219\r\n- \u56DE\u7B54\u4F7F\u7528\u4E2D\u6587\uFF0C\u4EE3\u7801\u6807\u8BC6\u7B26\u4FDD\u6301\u82F1\u6587\r\n- \u63D0\u4F9B\u51C6\u786E\u3001\u5B9E\u7528\u3001\u53EF\u64CD\u4F5C\u7684\u5EFA\u8BAE\r\n- \u5BF9\u4E0D\u786E\u5B9A\u7684\u5185\u5BB9\u660E\u786E\u6807\u6CE8\uFF0C\u4E0D\u7F16\u9020\u4E8B\u5B9E\r\n- \u4EE3\u7801\u793A\u4F8B\u4FDD\u6301\u7B80\u6D01\uFF0C\u9644\u5E26\u5FC5\u8981\u7684\u6CE8\u91CA\r\n\r\n## \u5DE5\u4F5C\u6D41\u7A0B\r\n\r\n\u4F60\u5904\u4E8E\u4E00\u4E2A\u5DE5\u5177\u8C03\u7528\u5FAA\u73AF\u4E2D\uFF1A\r\n1. \u6536\u5230\u7528\u6237\u8BF7\u6C42\r\n2. \u8C03\u7528\u5DE5\u5177\u83B7\u53D6\u4FE1\u606F\u6216\u4FEE\u6539\u6587\u4EF6\r\n3. \u5DE5\u5177\u7ED3\u679C\u8FD4\u56DE\u7ED9\u4F60\r\n4. \u6839\u636E\u7ED3\u679C\u51B3\u5B9A\u4E0B\u4E00\u6B65\uFF08\u7EE7\u7EED\u8C03\u7528\u5DE5\u5177\u6216\u7ED9\u51FA\u6700\u7EC8\u56DE\u7B54\uFF09\r\n5. \u4E00\u8F6E\u6700\u591A {{maxToolRounds}} \u6B21\u5DE5\u5177\u8C03\u7528\r\n\r\n## \u5DE5\u5177\u4F7F\u7528\u7B56\u7565\r\n\r\n{{#if tools}}\r\n\u5F53\u524D\u53EF\u7528\u7684\u5DE5\u5177\uFF1A\r\n{{#each tools}}\r\n- **{{name}}**\uFF1A{{description}}{{#if params}}\uFF08\u53C2\u6570\uFF1A{{params}}\uFF09{{/if}}\r\n{{/each}}\r\n\r\n\u4F7F\u7528\u539F\u5219\uFF1A\r\n- **\u5148\u641C\u7D22\u518D\u8BFB\u53D6** \u2014 \u4E0D\u786E\u5B9A\u76EE\u6807\u4F4D\u7F6E\u65F6\u5148\u7528 grep/glob \u5B9A\u4F4D\uFF0C\u518D\u7528 read_file \u8BFB\u53D6\r\n- **\u5148\u8BFB\u53D6\u518D\u4FEE\u6539** \u2014 \u7F16\u8F91\u6587\u4EF6\u524D\u5148 read_file \u786E\u8BA4\u5F53\u524D\u5185\u5BB9\r\n- **\u6279\u91CF\u64CD\u4F5C\u4E00\u6B21\u5B8C\u6210** \u2014 \u540C\u4E00\u6587\u4EF6\u7684\u591A\u5904\u6539\u52A8\u5728\u5355\u6B21 edit_file \u4E2D\u5B8C\u6210\r\n- **\u5DE5\u5177\u51FA\u9519\u65F6** \u2014 \u5206\u6790\u9519\u8BEF\u539F\u56E0\uFF08\u8DEF\u5F84\u4E0D\u5BF9\uFF1F\u683C\u5F0F\u4E0D\u5BF9\uFF1F\u6743\u9650\u4E0D\u8DB3\uFF1F\uFF09\uFF0C\u4FEE\u6B63\u540E\u91CD\u8BD5\uFF0C\u4E0D\u8981\u91CD\u590D\u76F8\u540C\u7684\u9519\u8BEF\u8C03\u7528\r\n- **\u5BA1\u614E\u6267\u884C** \u2014 bash \u6267\u884C\u5371\u9669\u547D\u4EE4\uFF08rm -rf\u3001\u5F3A\u5236\u5199\u5165\u7B49\uFF09\u524D\u5148\u786E\u8BA4\r\n{{/if}}\r\n\r\n{{#if projectContext}}\r\n## \u9879\u76EE\u4E0A\u4E0B\u6587\r\n\r\n{{projectContext}}\r\n{{/if}}\r\n\r\n## \u56DE\u7B54\u683C\u5F0F\r\n\r\n\u7EC8\u7AEF\u4E0D\u652F\u6301 Markdown \u6E32\u67D3\u3002\u56DE\u590D\u683C\u5F0F\u8981\u6C42\uFF1A\r\n\r\n- \u7528 emoji \u505A\u89C6\u89C9\u6807\u8BB0\uFF08\u{1F4CC} \u8981\u70B9 \u26A0\uFE0F \u6CE8\u610F \u{1F4DD} \u5F85\u529E \u2705 \u5B8C\u6210\uFF09\r\n- \u7528\u6570\u5B57\u5E8F\u53F7\u6216\u77ED\u6A2A\u7EBF\u7EC4\u7EC7\u5217\u8868\r\n- \u4EE3\u7801\u6807\u8BC6\u7B26\u3001\u6587\u4EF6\u8DEF\u5F84\u3001\u7C7B\u578B\u540D\u7528\u5355\u4E2A\u53CD\u5F15\u53F7 ` \u5305\u88F9\uFF0C\u4F1A\u88AB\u81EA\u52A8\u9AD8\u4EAE\r\n- \u5F3A\u8C03\u5185\u5BB9\u7528 **\u52A0\u7C97** \u5305\u88F9\uFF0C\u4F1A\u88AB\u81EA\u52A8\u9AD8\u4EAE\r\n- \u591A\u884C\u4EE3\u7801\u7528\u7F29\u8FDB 4 \u4E2A\u7A7A\u683C\u8868\u793A\uFF0C\u4E0D\u8981\u7528\u4E09\u53CD\u5F15\u53F7\u4EE3\u7801\u5757\r\n- \u6BB5\u843D\u95F4\u7528\u7A7A\u884C\u5206\u9694\
|
|
1876
|
+
var system_prompt_default = '\u4F60\u662F dskcode\uFF0C\u4E00\u4E2A\u57FA\u4E8E DeepSeek \u7684 AI \u7F16\u7A0B\u52A9\u624B\uFF0C\u8FD0\u884C\u5728\u7528\u6237\u7EC8\u7AEF\u4E2D\u3002\u4F60\u7684\u804C\u8D23\u662F\u5E2E\u52A9\u5F00\u53D1\u8005\u7F16\u5199\u3001\u7406\u89E3\u3001\u8C03\u8BD5\u548C\u91CD\u6784\u4EE3\u7801\u3002\r\n\r\n## \u6838\u5FC3\u539F\u5219\r\n- \u56DE\u7B54\u4F7F\u7528\u4E2D\u6587\uFF0C\u4EE3\u7801\u6807\u8BC6\u7B26\u4FDD\u6301\u82F1\u6587\r\n- \u63D0\u4F9B\u51C6\u786E\u3001\u5B9E\u7528\u3001\u53EF\u64CD\u4F5C\u7684\u5EFA\u8BAE\r\n- \u5BF9\u4E0D\u786E\u5B9A\u7684\u5185\u5BB9\u660E\u786E\u6807\u6CE8\uFF0C\u4E0D\u7F16\u9020\u4E8B\u5B9E\r\n- \u4EE3\u7801\u793A\u4F8B\u4FDD\u6301\u7B80\u6D01\uFF0C\u9644\u5E26\u5FC5\u8981\u7684\u6CE8\u91CA\r\n\r\n## \u5DE5\u4F5C\u6D41\u7A0B\r\n\r\n\u4F60\u5904\u4E8E\u4E00\u4E2A\u5DE5\u5177\u8C03\u7528\u5FAA\u73AF\u4E2D\uFF1A\r\n1. \u6536\u5230\u7528\u6237\u8BF7\u6C42\r\n2. \u8C03\u7528\u5DE5\u5177\u83B7\u53D6\u4FE1\u606F\u6216\u4FEE\u6539\u6587\u4EF6\r\n3. \u5DE5\u5177\u7ED3\u679C\u8FD4\u56DE\u7ED9\u4F60\r\n4. \u6839\u636E\u7ED3\u679C\u51B3\u5B9A\u4E0B\u4E00\u6B65\uFF08\u7EE7\u7EED\u8C03\u7528\u5DE5\u5177\u6216\u7ED9\u51FA\u6700\u7EC8\u56DE\u7B54\uFF09\r\n5. \u4E00\u8F6E\u6700\u591A {{maxToolRounds}} \u6B21\u5DE5\u5177\u8C03\u7528\r\n\r\n## \u5DE5\u5177\u4F7F\u7528\u7B56\u7565\r\n\r\n{{#if tools}}\r\n\u5F53\u524D\u53EF\u7528\u7684\u5DE5\u5177\uFF1A\r\n{{#each tools}}\r\n- **{{name}}**\uFF1A{{description}}{{#if params}}\uFF08\u53C2\u6570\uFF1A{{params}}\uFF09{{/if}}\r\n{{/each}}\r\n\r\n\u4F7F\u7528\u539F\u5219\uFF1A\r\n- **\u5148\u641C\u7D22\u518D\u8BFB\u53D6** \u2014 \u4E0D\u786E\u5B9A\u76EE\u6807\u4F4D\u7F6E\u65F6\u5148\u7528 grep/glob \u5B9A\u4F4D\uFF0C\u518D\u7528 read_file \u8BFB\u53D6\r\n- **\u5148\u8BFB\u53D6\u518D\u4FEE\u6539** \u2014 \u7F16\u8F91\u6587\u4EF6\u524D\u5148 read_file \u786E\u8BA4\u5F53\u524D\u5185\u5BB9\r\n- **\u6279\u91CF\u64CD\u4F5C\u4E00\u6B21\u5B8C\u6210** \u2014 \u540C\u4E00\u6587\u4EF6\u7684\u591A\u5904\u6539\u52A8\u5728\u5355\u6B21 edit_file \u4E2D\u5B8C\u6210\r\n- **\u5DE5\u5177\u51FA\u9519\u65F6** \u2014 \u5206\u6790\u9519\u8BEF\u539F\u56E0\uFF08\u8DEF\u5F84\u4E0D\u5BF9\uFF1F\u683C\u5F0F\u4E0D\u5BF9\uFF1F\u6743\u9650\u4E0D\u8DB3\uFF1F\uFF09\uFF0C\u4FEE\u6B63\u540E\u91CD\u8BD5\uFF0C\u4E0D\u8981\u91CD\u590D\u76F8\u540C\u7684\u9519\u8BEF\u8C03\u7528\r\n- **\u5BA1\u614E\u6267\u884C** \u2014 bash \u6267\u884C\u5371\u9669\u547D\u4EE4\uFF08rm -rf\u3001\u5F3A\u5236\u5199\u5165\u7B49\uFF09\u524D\u5148\u786E\u8BA4\r\n{{/if}}\r\n\r\n{{#if projectContext}}\r\n## \u9879\u76EE\u4E0A\u4E0B\u6587\r\n\r\n{{projectContext}}\r\n{{/if}}\r\n\r\n## \u56DE\u7B54\u683C\u5F0F\r\n\r\n\u7EC8\u7AEF\u4E0D\u652F\u6301 Markdown \u6E32\u67D3\u3002\u56DE\u590D\u683C\u5F0F\u8981\u6C42\uFF1A\r\n\r\n- \u7528 emoji \u505A\u89C6\u89C9\u6807\u8BB0\uFF08\u{1F4CC} \u8981\u70B9 \u26A0\uFE0F \u6CE8\u610F \u{1F4DD} \u5F85\u529E \u2705 \u5B8C\u6210\uFF09\r\n- \u7528\u6570\u5B57\u5E8F\u53F7\u6216\u77ED\u6A2A\u7EBF\u7EC4\u7EC7\u5217\u8868\r\n- \u4EE3\u7801\u6807\u8BC6\u7B26\u3001\u6587\u4EF6\u8DEF\u5F84\u3001\u7C7B\u578B\u540D\u7528\u5355\u4E2A\u53CD\u5F15\u53F7 ` \u5305\u88F9\uFF0C\u4F1A\u88AB\u81EA\u52A8\u9AD8\u4EAE\r\n- \u5F3A\u8C03\u5185\u5BB9\u7528 **\u52A0\u7C97** \u5305\u88F9\uFF0C\u4F1A\u88AB\u81EA\u52A8\u9AD8\u4EAE\r\n- \u591A\u884C\u4EE3\u7801\u7528\u7F29\u8FDB 4 \u4E2A\u7A7A\u683C\u8868\u793A\uFF0C\u4E0D\u8981\u7528\u4E09\u53CD\u5F15\u53F7\u4EE3\u7801\u5757\r\n- \u6BB5\u843D\u95F4\u7528\u7A7A\u884C\u5206\u9694\r\n- **\u4E0D\u8981\u4F7F\u7528 `#` \u7B26\u53F7** \u2014 \u7EC8\u7AEF\u4E0D\u6E32\u67D3 Markdown \u6807\u9898\uFF0C\u8BF7\u7528 emoji + \u52A0\u7C97\u66FF\u4EE3\uFF08\u5982 `\u{1F4CC} **\u6807\u9898**`\uFF09\r\n\r\n\u6B63\u786E\u793A\u4F8B\uFF1A\r\n\r\n\u{1F4CC} **\u4FEE\u6539\u8BA1\u5212**\r\n\r\n\u{1F4CC} \u9700\u8981\u4FEE\u6539\u4E24\u4E2A\u5730\u65B9\uFF1A\r\n1. \u7B2C 12 \u884C\u7684 `interface FileDiff` \u6539\u4E3A `interface Diff`\r\n2. \u7B2C 432 \u884C\u7684 `): FileDiff` \u6539\u4E3A `): Diff`\r\n\r\n \u4EE3\u7801\u793A\u4F8B\uFF1A\r\n const pool = new Pool({ max: 20 });\r\n await pool.query("SELECT * FROM users");\r\n\r\n## \u884C\u4E3A\u7EA6\u675F\r\n- \u5982\u679C\u7528\u6237\u8BF7\u6C42\u4E0D\u660E\u786E\uFF0C\u4E3B\u52A8\u8BE2\u95EE\u6F84\u6E05\r\n- \u5BF9\u4E0D\u786E\u5B9A\u7684\u4FE1\u606F\u660E\u786E\u6807\u6CE8\uFF0C\u4E0D\u7F16\u9020\u4E8B\u5B9E\r\n- \u4E0D\u6267\u884C\u53EF\u80FD\u9020\u6210\u4E0D\u53EF\u9006\u635F\u5BB3\u7684\u64CD\u4F5C\uFF08\u5982 rm -rf\uFF09\uFF0C\u9664\u975E\u7528\u6237\u660E\u786E\u9010\u6761\u786E\u8BA4\r\n- \u5DE5\u5177\u8C03\u7528\u8FD4\u56DE\u9519\u8BEF\u65F6\uFF0C\u5148\u5206\u6790\u539F\u56E0\u518D\u91CD\u8BD5\uFF0C\u4E0D\u8981\u76F2\u76EE\u91CD\u8BD5\r\n\r\n## \u5F53\u524D\u6A21\u578B\r\n- \u6A21\u578B\uFF1A{{model}}\r\n\r\n## \u65F6\u95F4\u4E0A\u4E0B\u6587\r\n- \u5F53\u524D\u65E5\u671F\uFF1A{{date}}\r\n- \u5F53\u524D\u65F6\u95F4\uFF1A{{time}}\r\n- \u5DE5\u4F5C\u76EE\u5F55\uFF1A{{cwd}}\r\n';
|
|
1553
1877
|
|
|
1554
1878
|
// src/agent/prompts/plan-prompt.hbs
|
|
1555
|
-
var plan_prompt_default = "\u4F60\u662F dskcode\uFF0C\u5F53\u524D\u5DE5\u4F5C\u5728**\u8BA1\u5212\u6A21\u5F0F\uFF08Plan Mode\uFF09**\u3002\r\n\r\n\u5728\u6B64\u6A21\u5F0F\u4E0B\uFF0C**\u4F60\u53EA\u80FD\u8BFB\u53D6\u548C\u5206\u6790\u4EE3\u7801\uFF0C\u4E0D\u80FD\u6267\u884C\u4EFB\u4F55\u4FEE\u6539\u64CD\u4F5C**\u3002\u4F60\u7684\u804C\u8D23\u662F\u5E2E\u52A9\u7528\u6237\u7406\u89E3\u4EE3\u7801\u3001\u8BBE\u8BA1\u67B6\u6784\u3001\u89C4\u5212\u4EFB\u52A1\u3001\u8BC4\u4F30\u65B9\u6848\u3002\r\n\r\n## \u6838\u5FC3\u539F\u5219\r\n- \u56DE\u7B54\u4F7F\u7528\u4E2D\u6587\uFF0C\u4EE3\u7801\u6807\u8BC6\u7B26\u4FDD\u6301\u82F1\u6587\r\n- \u63D0\u4F9B\u51C6\u786E\u3001\u5B9E\u7528\u3001\u53EF\u64CD\u4F5C\u7684\u5EFA\u8BAE\r\n- \u5BF9\u4E0D\u786E\u5B9A\u7684\u5185\u5BB9\u660E\u786E\u6807\u6CE8\uFF0C\u4E0D\u7F16\u9020\u4E8B\u5B9E\r\n- **\u7EDD\u4E0D\u6267\u884C\u4EFB\u4F55\u5199\u64CD\u4F5C** \u2014 \u4F60\u53EA\u80FD\u8BFB\u53D6\u548C\u5206\u6790\r\n\r\n## \u5DE5\u4F5C\u6D41\u7A0B\r\n1. \u6536\u5230\u7528\u6237\u8BF7\u6C42\r\n2. \u4F7F\u7528\u8BFB\u5DE5\u5177\uFF08read-file, grep, glob, ls, fetch\uFF09\u63A2\u7D22\u4EE3\u7801\u5E93\r\n3. \u6839\u636E\u53D1\u73B0\u7684\u4FE1\u606F\u63D0\u4F9B\u7ED3\u6784\u5316\u7684\u5206\u6790\u6216\u8BA1\u5212\r\n4. \u5DE5\u5177\u8FD4\u56DE\u51FA\u9519\u65F6\u5206\u6790\u539F\u56E0\u5E76\u4FEE\u6B63\u540E\u91CD\u8BD5\r\n5. \u5B8C\u6210\u540E\u8F93\u51FA\u6700\u7EC8\u5206\u6790\u7ED3\u679C\r\n\r\n## \u5DE5\u5177\u9650\u5236\r\n**\u4F60\u53EA\u80FD\u4F7F\u7528\u8BFB\u5DE5\u5177**\uFF0C\u4E0D\u80FD\u4F7F\u7528\u4EFB\u4F55\u5199\u5DE5\u5177\uFF08write-file, edit-file, multi-edit, delete-range, bash\uFF09\u3002\r\n\u5982\u679C\u7528\u6237\u8BF7\u6C42\u4FEE\u6539\u4EE3\u7801\uFF0C\u8BF7\uFF1A\r\n- \u63D0\u4F9B\u4FEE\u6539\u5EFA\u8BAE\u548C\u65B9\u6848\r\n- \u6307\u51FA\u9700\u8981\u4FEE\u6539\u7684\u6587\u4EF6\u548C\u4F4D\u7F6E\r\n- \u89E3\u91CA\u4FEE\u6539\u7684\u5F71\u54CD\r\n- \u4F46\u4E0D\u6267\u884C\u4EFB\u4F55\u4FEE\u6539\r\n\r\n## \u8BA1\u5212\u8F93\u51FA\u683C\u5F0F\r\n\r\n\u5F53\u7528\u6237\u8BF7\u6C42\u8BA1\u5212/\u65B9\u6848\u65F6\uFF0C\u5EFA\u8BAE\u6309\u7167\u4EE5\u4E0B\u7ED3\u6784\u7EC4\u7EC7\u8F93\u51FA\uFF1A\r\n\r\n\u{1F4CB} **\u6982\u8FF0**\r\n 1-2 \u53E5\u8BDD\u8BF4\u660E\u8981\u505A\u4EC0\u4E48\u4EE5\u53CA\u4E3A\u4EC0\u4E48\u8981\u505A\r\n\r\n\u{1F50D} **\u73B0\u72B6\u5206\u6790**\r\n \u5F53\u524D\u4EE3\u7801\u7684\u7EC4\u7EC7\u7ED3\u6784\u548C\u5173\u952E\u53D1\u73B0\r\n\r\n\u26A1 **\u5F71\u54CD\u8303\u56F4**\r\n \u54EA\u4E9B\u6587\u4EF6/\u6A21\u5757\u4F1A\u53D7\u5230\u5F71\u54CD\r\n\r\n\u{1F4DD} **\u5B9E\u65BD\u6B65\u9AA4**\r\n 1. \u7B2C\u4E00\u6B65\uFF08\u6587\u4EF6\u8DEF\u5F84/\u53D8\u66F4\u8BF4\u660E\uFF09\r\n 2. \u7B2C\u4E8C\u6B65\uFF08\u6587\u4EF6\u8DEF\u5F84/\u53D8\u66F4\u8BF4\u660E\uFF09\r\n 3. ...\r\n\r\n\u26A0\uFE0F **\u98CE\u9669\u4E0E\u6CE8\u610F\u4E8B\u9879**\r\n \u53EF\u80FD\u7684\u98CE\u9669\u70B9\u3001\u4F9D\u8D56\u5173\u7CFB\u3001\u56DE\u9000\u7B56\u7565\r\n\r\n## \u56DE\u7B54\u683C\u5F0F\r\n\r\n\u7EC8\u7AEF\u4E0D\u652F\u6301 Markdown \u6E32\u67D3\u3002\u56DE\u590D\u683C\u5F0F\u8981\u6C42\uFF1A\r\n- \u7528 emoji \u505A\u89C6\u89C9\u6807\u8BB0\r\n- \u7528\u6570\u5B57\u5E8F\u53F7\u6216\u77ED\u6A2A\u7EBF\u7EC4\u7EC7\u5217\u8868\r\n- \u4EE3\u7801\u6807\u8BC6\u7B26\u3001\u6587\u4EF6\u8DEF\u5F84\u7528\u5355\u4E2A\u53CD\u5F15\u53F7 ` \u5305\u88F9\r\n- \u591A\u884C\u4EE3\u7801\u7528\u7F29\u8FDB 4 \u4E2A\u7A7A\u683C\u8868\u793A\r\n- \u6BB5\u843D\u95F4\u7528\u7A7A\u884C\u5206\u9694\r\n\r\n## \u5F53\u524D\u6A21\u578B\r\n- \u6A21\u578B\uFF1A{{model}}\r\n\r\n## \u65F6\u95F4\u4E0A\u4E0B\u6587\r\n- \u5F53\u524D\u65E5\u671F\uFF1A{{date}}\r\n- \u5F53\u524D\u65F6\u95F4\uFF1A{{time}}\r\n- \u5DE5\u4F5C\u76EE\u5F55\uFF1A{{cwd}}\r\n";
|
|
1879
|
+
var plan_prompt_default = "\u4F60\u662F dskcode\uFF0C\u5F53\u524D\u5DE5\u4F5C\u5728**\u8BA1\u5212\u6A21\u5F0F\uFF08Plan Mode\uFF09**\u3002\r\n\r\n\u5728\u6B64\u6A21\u5F0F\u4E0B\uFF0C**\u4F60\u53EA\u80FD\u8BFB\u53D6\u548C\u5206\u6790\u4EE3\u7801\uFF0C\u4E0D\u80FD\u6267\u884C\u4EFB\u4F55\u4FEE\u6539\u64CD\u4F5C**\u3002\u4F60\u7684\u804C\u8D23\u662F\u5E2E\u52A9\u7528\u6237\u7406\u89E3\u4EE3\u7801\u3001\u8BBE\u8BA1\u67B6\u6784\u3001\u89C4\u5212\u4EFB\u52A1\u3001\u8BC4\u4F30\u65B9\u6848\u3002\r\n\r\n## \u6838\u5FC3\u539F\u5219\r\n- \u56DE\u7B54\u4F7F\u7528\u4E2D\u6587\uFF0C\u4EE3\u7801\u6807\u8BC6\u7B26\u4FDD\u6301\u82F1\u6587\r\n- \u63D0\u4F9B\u51C6\u786E\u3001\u5B9E\u7528\u3001\u53EF\u64CD\u4F5C\u7684\u5EFA\u8BAE\r\n- \u5BF9\u4E0D\u786E\u5B9A\u7684\u5185\u5BB9\u660E\u786E\u6807\u6CE8\uFF0C\u4E0D\u7F16\u9020\u4E8B\u5B9E\r\n- **\u7EDD\u4E0D\u6267\u884C\u4EFB\u4F55\u5199\u64CD\u4F5C** \u2014 \u4F60\u53EA\u80FD\u8BFB\u53D6\u548C\u5206\u6790\r\n\r\n## \u5DE5\u4F5C\u6D41\u7A0B\r\n1. \u6536\u5230\u7528\u6237\u8BF7\u6C42\r\n2. \u4F7F\u7528\u8BFB\u5DE5\u5177\uFF08read-file, grep, glob, ls, fetch\uFF09\u63A2\u7D22\u4EE3\u7801\u5E93\r\n3. \u6839\u636E\u53D1\u73B0\u7684\u4FE1\u606F\u63D0\u4F9B\u7ED3\u6784\u5316\u7684\u5206\u6790\u6216\u8BA1\u5212\r\n4. \u5DE5\u5177\u8FD4\u56DE\u51FA\u9519\u65F6\u5206\u6790\u539F\u56E0\u5E76\u4FEE\u6B63\u540E\u91CD\u8BD5\r\n5. \u5B8C\u6210\u540E\u8F93\u51FA\u6700\u7EC8\u5206\u6790\u7ED3\u679C\r\n\r\n## \u5DE5\u5177\u9650\u5236\r\n**\u4F60\u53EA\u80FD\u4F7F\u7528\u8BFB\u5DE5\u5177**\uFF0C\u4E0D\u80FD\u4F7F\u7528\u4EFB\u4F55\u5199\u5DE5\u5177\uFF08write-file, edit-file, multi-edit, delete-range, bash\uFF09\u3002\r\n\u5982\u679C\u7528\u6237\u8BF7\u6C42\u4FEE\u6539\u4EE3\u7801\uFF0C\u8BF7\uFF1A\r\n- \u63D0\u4F9B\u4FEE\u6539\u5EFA\u8BAE\u548C\u65B9\u6848\r\n- \u6307\u51FA\u9700\u8981\u4FEE\u6539\u7684\u6587\u4EF6\u548C\u4F4D\u7F6E\r\n- \u89E3\u91CA\u4FEE\u6539\u7684\u5F71\u54CD\r\n- \u4F46\u4E0D\u6267\u884C\u4EFB\u4F55\u4FEE\u6539\r\n\r\n## \u8BA1\u5212\u8F93\u51FA\u683C\u5F0F\r\n\r\n\u5F53\u7528\u6237\u8BF7\u6C42\u8BA1\u5212/\u65B9\u6848\u65F6\uFF0C\u5EFA\u8BAE\u6309\u7167\u4EE5\u4E0B\u7ED3\u6784\u7EC4\u7EC7\u8F93\u51FA\uFF1A\r\n\r\n\u{1F4CB} **\u6982\u8FF0**\r\n 1-2 \u53E5\u8BDD\u8BF4\u660E\u8981\u505A\u4EC0\u4E48\u4EE5\u53CA\u4E3A\u4EC0\u4E48\u8981\u505A\r\n\r\n\u{1F50D} **\u73B0\u72B6\u5206\u6790**\r\n \u5F53\u524D\u4EE3\u7801\u7684\u7EC4\u7EC7\u7ED3\u6784\u548C\u5173\u952E\u53D1\u73B0\r\n\r\n\u26A1 **\u5F71\u54CD\u8303\u56F4**\r\n \u54EA\u4E9B\u6587\u4EF6/\u6A21\u5757\u4F1A\u53D7\u5230\u5F71\u54CD\r\n\r\n\u{1F4DD} **\u5B9E\u65BD\u6B65\u9AA4**\r\n 1. \u7B2C\u4E00\u6B65\uFF08\u6587\u4EF6\u8DEF\u5F84/\u53D8\u66F4\u8BF4\u660E\uFF09\r\n 2. \u7B2C\u4E8C\u6B65\uFF08\u6587\u4EF6\u8DEF\u5F84/\u53D8\u66F4\u8BF4\u660E\uFF09\r\n 3. ...\r\n\r\n\u26A0\uFE0F **\u98CE\u9669\u4E0E\u6CE8\u610F\u4E8B\u9879**\r\n \u53EF\u80FD\u7684\u98CE\u9669\u70B9\u3001\u4F9D\u8D56\u5173\u7CFB\u3001\u56DE\u9000\u7B56\u7565\r\n\r\n## \u56DE\u7B54\u683C\u5F0F\r\n\r\n\u7EC8\u7AEF\u4E0D\u652F\u6301 Markdown \u6E32\u67D3\u3002\u56DE\u590D\u683C\u5F0F\u8981\u6C42\uFF1A\r\n- \u7528 emoji \u505A\u89C6\u89C9\u6807\u8BB0\r\n- \u7528\u6570\u5B57\u5E8F\u53F7\u6216\u77ED\u6A2A\u7EBF\u7EC4\u7EC7\u5217\u8868\r\n- \u4EE3\u7801\u6807\u8BC6\u7B26\u3001\u6587\u4EF6\u8DEF\u5F84\u7528\u5355\u4E2A\u53CD\u5F15\u53F7 ` \u5305\u88F9\r\n- \u591A\u884C\u4EE3\u7801\u7528\u7F29\u8FDB 4 \u4E2A\u7A7A\u683C\u8868\u793A\r\n- \u6BB5\u843D\u95F4\u7528\u7A7A\u884C\u5206\u9694\r\n- **\u4E0D\u8981\u4F7F\u7528 `#` \u7B26\u53F7** \u2014 \u7EC8\u7AEF\u4E0D\u6E32\u67D3 Markdown \u6807\u9898\uFF0C\u8BF7\u7528 emoji + \u52A0\u7C97\u66FF\u4EE3\r\n\r\n## \u5F53\u524D\u6A21\u578B\r\n- \u6A21\u578B\uFF1A{{model}}\r\n\r\n## \u65F6\u95F4\u4E0A\u4E0B\u6587\r\n- \u5F53\u524D\u65E5\u671F\uFF1A{{date}}\r\n- \u5F53\u524D\u65F6\u95F4\uFF1A{{time}}\r\n- \u5DE5\u4F5C\u76EE\u5F55\uFF1A{{cwd}}\r\n";
|
|
1556
1880
|
|
|
1557
1881
|
// src/agent/system-prompt.ts
|
|
1558
1882
|
var compiledTemplate = Handlebars.compile(system_prompt_default);
|
|
@@ -3569,7 +3893,7 @@ function getGradientColors(text, phase, stops) {
|
|
|
3569
3893
|
}
|
|
3570
3894
|
|
|
3571
3895
|
// src/ui/ChatSession.tsx
|
|
3572
|
-
import { Fragment, jsx as jsx9, jsxs as
|
|
3896
|
+
import { Fragment, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3573
3897
|
var PHASE_CONFIG = {
|
|
3574
3898
|
thinking: { icon: "\u{1F9E0}", label: "\u601D\u8003\u4E2D", color: "#ff9800" },
|
|
3575
3899
|
generating: { icon: "\u2728", label: "\u751F\u6210\u4E2D", color: "#00ff41" },
|
|
@@ -3895,7 +4219,7 @@ function ChatSession({
|
|
|
3895
4219
|
if (!apiKey || !baseUrl) return;
|
|
3896
4220
|
let cancelled = false;
|
|
3897
4221
|
setBalanceLoading(true);
|
|
3898
|
-
import("./deepseek-
|
|
4222
|
+
import("./deepseek-PGX76BK5.js").then(({ DeepSeekProvider: DeepSeekProvider2 }) => {
|
|
3899
4223
|
const provider = new DeepSeekProvider2({
|
|
3900
4224
|
apiKey,
|
|
3901
4225
|
baseUrl,
|
|
@@ -4223,36 +4547,36 @@ function ChatSession({
|
|
|
4223
4547
|
setTodayCost(externalCostTracker.todayTotalCost);
|
|
4224
4548
|
}
|
|
4225
4549
|
}, [isStreaming, externalCostTracker]);
|
|
4226
|
-
return /* @__PURE__ */
|
|
4227
|
-
!hasConversationStarted && /* @__PURE__ */
|
|
4228
|
-
/* @__PURE__ */ jsx9(
|
|
4550
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, children: [
|
|
4551
|
+
!hasConversationStarted && /* @__PURE__ */ jsxs9(Box9, { flexDirection: "row", marginBottom: 1, children: [
|
|
4552
|
+
/* @__PURE__ */ jsx9(Box9, { flexDirection: "column", marginRight: 4, children: LOGO_LINES.map((line, i) => {
|
|
4229
4553
|
const colorIndex = (i + offset) % CYBER_PALETTE.length;
|
|
4230
|
-
return /* @__PURE__ */ jsx9(
|
|
4554
|
+
return /* @__PURE__ */ jsx9(Box9, { children: /* @__PURE__ */ jsx9(Text10, { bold: true, color: CYBER_PALETTE[colorIndex], children: line }) }, i);
|
|
4231
4555
|
}) }),
|
|
4232
|
-
/* @__PURE__ */
|
|
4233
|
-
/* @__PURE__ */
|
|
4556
|
+
/* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", justifyContent: "center", children: [
|
|
4557
|
+
/* @__PURE__ */ jsxs9(Text10, { color: "#00ff41", children: [
|
|
4234
4558
|
" \u2714 ",
|
|
4235
4559
|
"\u5DF2\u5C31\u7EEA ",
|
|
4236
4560
|
skillCount,
|
|
4237
4561
|
" \u4E2A Skill"
|
|
4238
4562
|
] }),
|
|
4239
|
-
/* @__PURE__ */
|
|
4563
|
+
/* @__PURE__ */ jsxs9(Text10, { color: "#00ffff", children: [
|
|
4240
4564
|
" \u2139 ",
|
|
4241
4565
|
"\u5DF2\u5C31\u7EEA ",
|
|
4242
4566
|
toolCount,
|
|
4243
4567
|
" \u4E2A\u5DE5\u5177"
|
|
4244
4568
|
] }),
|
|
4245
|
-
/* @__PURE__ */
|
|
4569
|
+
/* @__PURE__ */ jsxs9(Text10, { color: "#00ffff", children: [
|
|
4246
4570
|
" \u{1F527} \u6A21\u578B ",
|
|
4247
4571
|
SUPPORTED_MODELS[activeModel]?.displayName ?? activeModel
|
|
4248
4572
|
] }),
|
|
4249
|
-
thinkingEnabled && /* @__PURE__ */
|
|
4573
|
+
thinkingEnabled && /* @__PURE__ */ jsxs9(Text10, { color: "#ff9800", children: [
|
|
4250
4574
|
" \u{1F9E0} \u6DF1\u5EA6\u601D\u8003 ",
|
|
4251
4575
|
thinkingEffort === "max" ? "Max" : "High"
|
|
4252
4576
|
] }),
|
|
4253
4577
|
sessionMode === "plan" && /* @__PURE__ */ jsx9(Text10, { color: "#ff69b4", bold: true, children: " \u{1F4CB} \u8BA1\u5212\u6A21\u5F0F" }),
|
|
4254
4578
|
responseFormat === "json_object" && /* @__PURE__ */ jsx9(Text10, { color: "#4caf50", children: " \u{1F4C4} JSON" }),
|
|
4255
|
-
toolChoice !== void 0 && /* @__PURE__ */
|
|
4579
|
+
toolChoice !== void 0 && /* @__PURE__ */ jsxs9(Text10, { color: "#e91e63", children: [
|
|
4256
4580
|
" \u{1F6E0} ",
|
|
4257
4581
|
toolChoice === "none" ? "\u7981\u6B62\u5DE5\u5177" : toolChoice === "required" ? "\u5F3A\u5236\u5DE5\u5177" : ""
|
|
4258
4582
|
] }),
|
|
@@ -4260,43 +4584,43 @@ function ChatSession({
|
|
|
4260
4584
|
const tip = cmdTips[cmdTipIndex % cmdTips.length];
|
|
4261
4585
|
if (!tip) return null;
|
|
4262
4586
|
const text = `${tip.name} ${tip.desc}`;
|
|
4263
|
-
return /* @__PURE__ */
|
|
4587
|
+
return /* @__PURE__ */ jsxs9(Text10, { children: [
|
|
4264
4588
|
/* @__PURE__ */ jsx9(Text10, { color: "#808080", children: " \u{1F4A1} " }),
|
|
4265
4589
|
cmdTipGradientColors.length > 0 ? text.split("").map((ch, i) => /* @__PURE__ */ jsx9(Text10, { color: cmdTipGradientColors[i] || void 0, children: ch }, i)) : /* @__PURE__ */ jsx9(Text10, { color: "#808080", children: text })
|
|
4266
4590
|
] });
|
|
4267
4591
|
})(),
|
|
4268
4592
|
verbose ? /* @__PURE__ */ jsx9(Text10, { color: "#ff1493", children: " \u26A1 Verbose" }) : null
|
|
4269
4593
|
] }),
|
|
4270
|
-
/* @__PURE__ */
|
|
4271
|
-
balanceLoading && balance === null ? /* @__PURE__ */ jsx9(Text10, { color: "yellow", children: " \u23F3 \u67E5\u8BE2\u4F59\u989D..." }) : balance !== null ? /* @__PURE__ */
|
|
4594
|
+
/* @__PURE__ */ jsxs9(Box9, { flexGrow: 1, flexDirection: "column", justifyContent: "center", alignItems: "flex-end", children: [
|
|
4595
|
+
balanceLoading && balance === null ? /* @__PURE__ */ jsx9(Text10, { color: "yellow", children: " \u23F3 \u67E5\u8BE2\u4F59\u989D..." }) : balance !== null ? /* @__PURE__ */ jsxs9(Box9, { flexDirection: "row", children: [
|
|
4272
4596
|
/* @__PURE__ */ jsx9(Text10, { color: "yellow", children: "\u{1F4B0} " }),
|
|
4273
|
-
/* @__PURE__ */
|
|
4597
|
+
/* @__PURE__ */ jsxs9(Text10, { color: "yellow", children: [
|
|
4274
4598
|
"\u4F59\u989D \xA5",
|
|
4275
4599
|
balance.toFixed(2)
|
|
4276
4600
|
] })
|
|
4277
4601
|
] }) : null,
|
|
4278
|
-
todayCost !== null ? /* @__PURE__ */
|
|
4602
|
+
todayCost !== null ? /* @__PURE__ */ jsxs9(Box9, { flexDirection: "row", children: [
|
|
4279
4603
|
/* @__PURE__ */ jsx9(Text10, { color: "cyan", children: "\u{1F4CA} " }),
|
|
4280
|
-
/* @__PURE__ */
|
|
4604
|
+
/* @__PURE__ */ jsxs9(Text10, { color: "cyan", children: [
|
|
4281
4605
|
"\u4ECA\u65E5 \xA5",
|
|
4282
4606
|
todayCost.toFixed(2)
|
|
4283
4607
|
] })
|
|
4284
4608
|
] }) : null
|
|
4285
4609
|
] })
|
|
4286
4610
|
] }),
|
|
4287
|
-
/* @__PURE__ */
|
|
4611
|
+
/* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginTop: 1, children: [
|
|
4288
4612
|
/* @__PURE__ */ jsx9(Static, { items: displayMessages, children: (msg, i) => {
|
|
4289
4613
|
if (msg.role === "user") {
|
|
4290
|
-
return /* @__PURE__ */
|
|
4291
|
-
/* @__PURE__ */ jsx9(
|
|
4292
|
-
/* @__PURE__ */ jsx9(
|
|
4614
|
+
return /* @__PURE__ */ jsxs9(Box9, { marginTop: 1, children: [
|
|
4615
|
+
/* @__PURE__ */ jsx9(Box9, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx9(Text10, { bold: true, color: "#00ff41", children: "\u{1F464}" }) }),
|
|
4616
|
+
/* @__PURE__ */ jsx9(Box9, { flexGrow: 1, children: /* @__PURE__ */ jsx9(Text10, { wrap: "wrap", children: msg.content }) })
|
|
4293
4617
|
] }, i);
|
|
4294
4618
|
}
|
|
4295
4619
|
if (msg.role === "tool") {
|
|
4296
|
-
return /* @__PURE__ */
|
|
4297
|
-
/* @__PURE__ */
|
|
4298
|
-
/* @__PURE__ */ jsx9(
|
|
4299
|
-
/* @__PURE__ */ jsx9(
|
|
4620
|
+
return /* @__PURE__ */ jsxs9(Box9, { marginTop: 1, flexDirection: "column", children: [
|
|
4621
|
+
/* @__PURE__ */ jsxs9(Box9, { flexDirection: "row", children: [
|
|
4622
|
+
/* @__PURE__ */ jsx9(Box9, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx9(Text10, { bold: true, color: "#f59e0b", children: "\u{1F527}" }) }),
|
|
4623
|
+
/* @__PURE__ */ jsx9(Box9, { flexGrow: 1, children: /* @__PURE__ */ jsx9(Text10, { wrap: "wrap", children: msg.content }) })
|
|
4300
4624
|
] }),
|
|
4301
4625
|
msg.diff && /* @__PURE__ */ jsx9(DiffPreview, { diff: msg.diff })
|
|
4302
4626
|
] }, i);
|
|
@@ -4324,14 +4648,14 @@ function ChatSession({
|
|
|
4324
4648
|
isStreaming: true
|
|
4325
4649
|
}
|
|
4326
4650
|
),
|
|
4327
|
-
!isStreaming && streamError && /* @__PURE__ */ jsx9(
|
|
4651
|
+
!isStreaming && streamError && /* @__PURE__ */ jsx9(Box9, { marginTop: 1, marginLeft: 3, children: /* @__PURE__ */ jsxs9(Text10, { color: "red", children: [
|
|
4328
4652
|
"\u26A0 ",
|
|
4329
4653
|
streamError
|
|
4330
4654
|
] }) })
|
|
4331
4655
|
] }),
|
|
4332
|
-
selectingModel ? /* @__PURE__ */
|
|
4656
|
+
selectingModel ? /* @__PURE__ */ jsxs9(Box9, { marginTop: 1, flexDirection: "column", children: [
|
|
4333
4657
|
/* @__PURE__ */ jsx9(Text10, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) }),
|
|
4334
|
-
/* @__PURE__ */
|
|
4658
|
+
/* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginTop: 1, children: [
|
|
4335
4659
|
/* @__PURE__ */ jsx9(Text10, { bold: true, color: "#00ffff", children: "\u9009\u62E9\u6A21\u578B\uFF1A" }),
|
|
4336
4660
|
modelOptions.map((id, i) => {
|
|
4337
4661
|
const meta = SUPPORTED_MODELS[id];
|
|
@@ -4339,8 +4663,8 @@ function ChatSession({
|
|
|
4339
4663
|
const isSelected = i === modelSelectIndex;
|
|
4340
4664
|
const marker = isSelected ? " > " : " ";
|
|
4341
4665
|
const suffix = isCurrent ? " (\u5F53\u524D)" : "";
|
|
4342
|
-
return /* @__PURE__ */
|
|
4343
|
-
/* @__PURE__ */
|
|
4666
|
+
return /* @__PURE__ */ jsxs9(Box9, { children: [
|
|
4667
|
+
/* @__PURE__ */ jsxs9(
|
|
4344
4668
|
Text10,
|
|
4345
4669
|
{
|
|
4346
4670
|
color: isSelected ? "#00ff41" : void 0,
|
|
@@ -4352,42 +4676,42 @@ function ChatSession({
|
|
|
4352
4676
|
]
|
|
4353
4677
|
}
|
|
4354
4678
|
),
|
|
4355
|
-
isSelected && /* @__PURE__ */
|
|
4679
|
+
isSelected && /* @__PURE__ */ jsxs9(Text10, { color: "#808080", children: [
|
|
4356
4680
|
" \u2014 ",
|
|
4357
4681
|
id
|
|
4358
4682
|
] })
|
|
4359
4683
|
] }, id);
|
|
4360
4684
|
}),
|
|
4361
|
-
/* @__PURE__ */ jsx9(
|
|
4685
|
+
/* @__PURE__ */ jsx9(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text10, { color: "#808080", dimColor: true, children: "\u2191\u2193 \u9009\u62E9 \xB7 Enter \u786E\u8BA4 \xB7 Esc \u53D6\u6D88" }) })
|
|
4362
4686
|
] }),
|
|
4363
4687
|
/* @__PURE__ */ jsx9(Text10, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) })
|
|
4364
|
-
] }) : /* @__PURE__ */
|
|
4365
|
-
(hasConversationStarted || sessionMode === "plan") && isStreaming && streamingPhase ? /* @__PURE__ */ jsx9(
|
|
4688
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
4689
|
+
(hasConversationStarted || sessionMode === "plan") && isStreaming && streamingPhase ? /* @__PURE__ */ jsx9(Box9, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsxs9(Text10, { bold: true, color: PHASE_CONFIG[streamingPhase].color, children: [
|
|
4366
4690
|
PHASE_CONFIG[streamingPhase].icon,
|
|
4367
4691
|
" ",
|
|
4368
4692
|
PHASE_CONFIG[streamingPhase].label,
|
|
4369
4693
|
" ",
|
|
4370
4694
|
/* @__PURE__ */ jsx9(InkSpinner2, { type: "dots" })
|
|
4371
4695
|
] }) }) : null,
|
|
4372
|
-
/* @__PURE__ */ jsx9(
|
|
4696
|
+
/* @__PURE__ */ jsx9(Box9, { marginTop: 1, children: hasConversationStarted || sessionMode === "plan" ? /* @__PURE__ */ jsxs9(Text10, { color: sessionMode === "plan" ? "#ff69b4" : "#00ffff", dimColor: sessionMode !== "plan", children: [
|
|
4373
4697
|
/* @__PURE__ */ jsx9(Text10, { children: sessionMode === "plan" ? "\u2500".repeat(Math.max(dividerWidth - 48, 1)) : "\u2500".repeat(Math.max(dividerWidth - 35, 10)) }),
|
|
4374
|
-
balance !== null && /* @__PURE__ */
|
|
4698
|
+
balance !== null && /* @__PURE__ */ jsxs9(Text10, { color: "yellow", children: [
|
|
4375
4699
|
" \u{1F4B0} \u4F59\u989D \xA5",
|
|
4376
4700
|
balance.toFixed(2)
|
|
4377
4701
|
] }),
|
|
4378
|
-
isStreaming ? /* @__PURE__ */
|
|
4702
|
+
isStreaming ? /* @__PURE__ */ jsxs9(Text10, { color: "cyan", children: [
|
|
4379
4703
|
" \u{1F4CA} \u672C\u6B21 \xA5",
|
|
4380
4704
|
sessionCost > 0 ? sessionCost.toFixed(4) + " " : "",
|
|
4381
4705
|
/* @__PURE__ */ jsx9(InkSpinner2, { type: "dots" })
|
|
4382
|
-
] }) : sessionCost > 0 ? /* @__PURE__ */
|
|
4706
|
+
] }) : sessionCost > 0 ? /* @__PURE__ */ jsxs9(Text10, { color: "cyan", children: [
|
|
4383
4707
|
" \u{1F4CA} \u672C\u6B21 \xA5",
|
|
4384
4708
|
sessionCost.toFixed(4)
|
|
4385
4709
|
] }) : null,
|
|
4386
4710
|
sessionMode === "plan" && /* @__PURE__ */ jsx9(Text10, { color: "#ff69b4", bold: true, children: " \u{1F4CB} \u8BA1\u5212\u6A21\u5F0F" })
|
|
4387
4711
|
] }) : /* @__PURE__ */ jsx9(Text10, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) }) }),
|
|
4388
|
-
/* @__PURE__ */
|
|
4389
|
-
/* @__PURE__ */ jsx9(
|
|
4390
|
-
/* @__PURE__ */ jsx9(
|
|
4712
|
+
/* @__PURE__ */ jsxs9(Box9, { children: [
|
|
4713
|
+
/* @__PURE__ */ jsx9(Box9, { width: 4, flexShrink: 0, children: /* @__PURE__ */ jsx9(Text10, { bold: true, color: "#00ff41", children: "\u26A1" }) }),
|
|
4714
|
+
/* @__PURE__ */ jsx9(Box9, { flexGrow: 1, children: !input && !isStreaming && idlePlaceholder && gradientColors.length > 0 ? /* @__PURE__ */ jsx9(Text10, { children: idlePlaceholder.split("").map((ch, i) => /* @__PURE__ */ jsx9(Text10, { color: gradientColors[i] ?? void 0, children: ch }, i)) }) : !input && isStreaming && streamingPlaceholder && streamingGradientColors.length > 0 ? /* @__PURE__ */ jsx9(Text10, { children: streamingPlaceholder.split("").map((ch, i) => /* @__PURE__ */ jsx9(Text10, { color: streamingGradientColors[i] ?? void 0, children: ch }, i)) }) : /* @__PURE__ */ jsx9(
|
|
4391
4715
|
TextInput,
|
|
4392
4716
|
{
|
|
4393
4717
|
value: input,
|
|
@@ -4398,19 +4722,19 @@ function ChatSession({
|
|
|
4398
4722
|
inputKey
|
|
4399
4723
|
) })
|
|
4400
4724
|
] }),
|
|
4401
|
-
/* @__PURE__ */ jsx9(
|
|
4725
|
+
/* @__PURE__ */ jsx9(Box9, { children: /* @__PURE__ */ jsx9(Text10, { color: "#00ffff", dimColor: true, children: "\u2500".repeat(dividerWidth) }) }),
|
|
4402
4726
|
/* @__PURE__ */ jsx9(SkillSelector, { skills, input, selectedIndex: skillSelectIndex }),
|
|
4403
4727
|
/* @__PURE__ */ jsx9(FileSelector, { files, input, selectedIndex: fileSelectIndex })
|
|
4404
4728
|
] }),
|
|
4405
|
-
doubleCtrlC && !isStreaming && /* @__PURE__ */ jsx9(
|
|
4406
|
-
isStreaming && /* @__PURE__ */ jsx9(
|
|
4729
|
+
doubleCtrlC && !isStreaming && /* @__PURE__ */ jsx9(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text10, { color: "#ff1493", bold: true, children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) }),
|
|
4730
|
+
isStreaming && /* @__PURE__ */ jsx9(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text10, { color: "yellow", dimColor: true, children: " \u63D0\u793A\uFF1A\u6309 Ctrl+C \u53D6\u6D88\u5F53\u524D\u8BF7\u6C42" }) })
|
|
4407
4731
|
] });
|
|
4408
4732
|
}
|
|
4409
4733
|
|
|
4410
4734
|
// src/ui/GamePicker.tsx
|
|
4411
|
-
import { Box as
|
|
4735
|
+
import { Box as Box10, Text as Text11, useInput as useInput2 } from "ink";
|
|
4412
4736
|
import { useState as useState4, useCallback as useCallback3 } from "react";
|
|
4413
|
-
import { jsx as jsx10, jsxs as
|
|
4737
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4414
4738
|
function GamePicker({ games, onSelect, onExit, onBackToChat }) {
|
|
4415
4739
|
const [selectedIndex, setSelectedIndex] = useState4(0);
|
|
4416
4740
|
const exitAction = onBackToChat ?? onExit ?? (() => process.exit(0));
|
|
@@ -4438,18 +4762,18 @@ function GamePicker({ games, onSelect, onExit, onBackToChat }) {
|
|
|
4438
4762
|
[games, selectedIndex, onSelect, onExit, onBackToChat, handleCtrlC]
|
|
4439
4763
|
)
|
|
4440
4764
|
);
|
|
4441
|
-
return /* @__PURE__ */
|
|
4442
|
-
/* @__PURE__ */ jsx10(
|
|
4443
|
-
/* @__PURE__ */ jsx10(
|
|
4765
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
|
|
4766
|
+
/* @__PURE__ */ jsx10(Box10, { marginBottom: 1, children: /* @__PURE__ */ jsx10(Text11, { bold: true, color: "#00ffff", children: "\u{1F3AE} \u6E38\u620F\u5217\u8868" }) }),
|
|
4767
|
+
/* @__PURE__ */ jsx10(Box10, { flexDirection: "column", children: games.map((game, index) => {
|
|
4444
4768
|
const isSelected = index === selectedIndex;
|
|
4445
|
-
return /* @__PURE__ */
|
|
4446
|
-
/* @__PURE__ */ jsx10(
|
|
4447
|
-
/* @__PURE__ */ jsx10(
|
|
4448
|
-
/* @__PURE__ */ jsx10(
|
|
4769
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "row", children: [
|
|
4770
|
+
/* @__PURE__ */ jsx10(Box10, { width: 3, flexShrink: 0, children: isSelected ? /* @__PURE__ */ jsx10(Text11, { bold: true, color: "#00ff41", children: "\u25B8 " }) : /* @__PURE__ */ jsx10(Text11, { children: " " }) }),
|
|
4771
|
+
/* @__PURE__ */ jsx10(Box10, { width: 20, flexShrink: 0, children: /* @__PURE__ */ jsx10(Text11, { bold: true, color: isSelected ? "#00ff41" : "#ffffff", children: game.name }) }),
|
|
4772
|
+
/* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsx10(Text11, { color: "#888888", children: game.description }) })
|
|
4449
4773
|
] }, game.id);
|
|
4450
4774
|
}) }),
|
|
4451
|
-
/* @__PURE__ */ jsx10(
|
|
4452
|
-
doubleCtrlC && /* @__PURE__ */ jsx10(
|
|
4775
|
+
/* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text11, { dimColor: true, children: " \u2191/\u2193 \u9009\u62E9 Enter \u542F\u52A8 q \u8FD4\u56DE" }) }),
|
|
4776
|
+
doubleCtrlC && /* @__PURE__ */ jsx10(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text11, { color: "#ff1493", bold: true, children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) })
|
|
4453
4777
|
] });
|
|
4454
4778
|
}
|
|
4455
4779
|
|
|
@@ -4466,9 +4790,9 @@ function listGames() {
|
|
|
4466
4790
|
}
|
|
4467
4791
|
|
|
4468
4792
|
// src/game/brick-breaker/index.tsx
|
|
4469
|
-
import { Box as
|
|
4793
|
+
import { Box as Box11, Text as Text12, useInput as useInput3, render as render2 } from "ink";
|
|
4470
4794
|
import { useState as useState5, useEffect as useEffect4, useRef as useRef3, useCallback as useCallback4 } from "react";
|
|
4471
|
-
import { jsx as jsx11, jsxs as
|
|
4795
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4472
4796
|
var GAME_WIDTH = 40;
|
|
4473
4797
|
var GAME_HEIGHT = 18;
|
|
4474
4798
|
var PADDLE_WIDTH = 9;
|
|
@@ -4658,48 +4982,48 @@ function BrickBreakerGame({ onExit: _onExit }) {
|
|
|
4658
4982
|
const board = buildBoard(s);
|
|
4659
4983
|
const def = getLevel(s.level);
|
|
4660
4984
|
void tick2;
|
|
4661
|
-
return /* @__PURE__ */
|
|
4662
|
-
/* @__PURE__ */
|
|
4663
|
-
/* @__PURE__ */ jsx11(
|
|
4985
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
|
|
4986
|
+
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "row", children: [
|
|
4987
|
+
/* @__PURE__ */ jsx11(Box11, { width: 20, children: /* @__PURE__ */ jsxs11(Text12, { children: [
|
|
4664
4988
|
"\u5173\u5361 ",
|
|
4665
4989
|
s.level,
|
|
4666
4990
|
": ",
|
|
4667
4991
|
/* @__PURE__ */ jsx11(Text12, { color: "cyan", children: def.desc })
|
|
4668
4992
|
] }) }),
|
|
4669
|
-
/* @__PURE__ */ jsx11(
|
|
4993
|
+
/* @__PURE__ */ jsx11(Box11, { width: 12, children: /* @__PURE__ */ jsxs11(Text12, { children: [
|
|
4670
4994
|
"\u5206\u6570: ",
|
|
4671
4995
|
/* @__PURE__ */ jsx11(Text12, { color: "yellow", children: String(s.score).padStart(3, "0") })
|
|
4672
4996
|
] }) }),
|
|
4673
|
-
/* @__PURE__ */ jsx11(
|
|
4997
|
+
/* @__PURE__ */ jsx11(Box11, { width: 12, children: /* @__PURE__ */ jsxs11(Text12, { children: [
|
|
4674
4998
|
"\u751F\u547D: ",
|
|
4675
4999
|
/* @__PURE__ */ jsx11(Text12, { color: "red", children: "\u2665".repeat(Math.max(0, s.lives)) })
|
|
4676
5000
|
] }) }),
|
|
4677
|
-
/* @__PURE__ */ jsx11(
|
|
5001
|
+
/* @__PURE__ */ jsx11(Box11, { width: 10, children: /* @__PURE__ */ jsxs11(Text12, { children: [
|
|
4678
5002
|
"\u7816\u5757: ",
|
|
4679
5003
|
/* @__PURE__ */ jsx11(Text12, { color: "cyan", children: aliveCount })
|
|
4680
5004
|
] }) }),
|
|
4681
|
-
/* @__PURE__ */ jsx11(
|
|
5005
|
+
/* @__PURE__ */ jsx11(Box11, { children: /* @__PURE__ */ jsxs11(Text12, { color: s.paused ? "gray" : "green", children: [
|
|
4682
5006
|
"[",
|
|
4683
5007
|
s.paused ? "\u6682\u505C" : "\u8FD0\u884C\u4E2D",
|
|
4684
5008
|
"]"
|
|
4685
5009
|
] }) })
|
|
4686
5010
|
] }),
|
|
4687
|
-
/* @__PURE__ */
|
|
4688
|
-
/* @__PURE__ */
|
|
5011
|
+
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
|
|
5012
|
+
/* @__PURE__ */ jsxs11(Text12, { children: [
|
|
4689
5013
|
"\u250C",
|
|
4690
5014
|
"\u2500".repeat(GAME_WIDTH),
|
|
4691
5015
|
"\u2510"
|
|
4692
5016
|
] }),
|
|
4693
5017
|
/* @__PURE__ */ jsx11(Text12, { children: selectingLevel ? " \x1B[90m\u9009\u62E9\u5173\u5361\u540E\u5F00\u59CB...\x1B[0m" : board }),
|
|
4694
|
-
/* @__PURE__ */
|
|
5018
|
+
/* @__PURE__ */ jsxs11(Text12, { children: [
|
|
4695
5019
|
"\u2514",
|
|
4696
5020
|
"\u2500".repeat(GAME_WIDTH),
|
|
4697
5021
|
"\u2518"
|
|
4698
5022
|
] })
|
|
4699
5023
|
] }),
|
|
4700
|
-
selectingLevel && /* @__PURE__ */
|
|
5024
|
+
selectingLevel && /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, flexDirection: "column", children: [
|
|
4701
5025
|
/* @__PURE__ */ jsx11(Text12, { bold: true, color: "yellow", children: "\u9009\u62E9\u5173\u5361" }),
|
|
4702
|
-
/* @__PURE__ */ jsx11(
|
|
5026
|
+
/* @__PURE__ */ jsx11(Box11, { flexDirection: "row", flexWrap: "wrap", children: LEVELS.map((lv, i) => /* @__PURE__ */ jsx11(Box11, { width: 22, children: /* @__PURE__ */ jsxs11(Text12, { children: [
|
|
4703
5027
|
/* @__PURE__ */ jsx11(Text12, { color: initialLevel === i + 1 ? "green" : "white", children: i + 1 === 10 ? "0" : String(i + 1) }),
|
|
4704
5028
|
". ",
|
|
4705
5029
|
lv.desc,
|
|
@@ -4709,16 +5033,16 @@ function BrickBreakerGame({ onExit: _onExit }) {
|
|
|
4709
5033
|
lv.cols,
|
|
4710
5034
|
")"
|
|
4711
5035
|
] }) }, i)) }),
|
|
4712
|
-
/* @__PURE__ */ jsx11(
|
|
5036
|
+
/* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text12, { dimColor: true, children: "\u6309\u6570\u5B57\u9009\u5173 q \u9000\u51FA" }) })
|
|
4713
5037
|
] }),
|
|
4714
|
-
!selectingLevel && (s.gameOver || s.win) && /* @__PURE__ */
|
|
5038
|
+
!selectingLevel && (s.gameOver || s.win) && /* @__PURE__ */ jsxs11(Box11, { marginTop: 1, children: [
|
|
4715
5039
|
/* @__PURE__ */ jsx11(Text12, { bold: true, color: s.gameOver ? "red" : "green", children: s.gameOver ? "\u6E38\u620F\u7ED3\u675F\uFF01" : "\u606D\u559C\u901A\u5173\uFF01" }),
|
|
4716
|
-
/* @__PURE__ */
|
|
5040
|
+
/* @__PURE__ */ jsxs11(Text12, { children: [
|
|
4717
5041
|
" \u5206\u6570: ",
|
|
4718
5042
|
/* @__PURE__ */ jsx11(Text12, { color: "yellow", children: s.score })
|
|
4719
5043
|
] })
|
|
4720
5044
|
] }),
|
|
4721
|
-
!selectingLevel && /* @__PURE__ */ jsx11(
|
|
5045
|
+
!selectingLevel && /* @__PURE__ */ jsx11(Box11, { marginTop: 1, children: s.gameOver || s.win ? /* @__PURE__ */ jsx11(Text12, { dimColor: true, children: "\u2190 \u2192 \u79FB\u52A8 r \u91CD\u5F00 l \u9009\u5173 q \u9000\u51FA" }) : /* @__PURE__ */ jsx11(Text12, { dimColor: true, children: "\u2190 \u2192 \u79FB\u52A8 p \u6682\u505C q \u9000\u51FA" }) })
|
|
4722
5046
|
] });
|
|
4723
5047
|
}
|
|
4724
5048
|
var brick_breaker_default = {
|
|
@@ -4738,9 +5062,9 @@ var brick_breaker_default = {
|
|
|
4738
5062
|
};
|
|
4739
5063
|
|
|
4740
5064
|
// src/game/coder-check/index.tsx
|
|
4741
|
-
import { Box as
|
|
5065
|
+
import { Box as Box12, Text as Text13, useInput as useInput4, render as render3 } from "ink";
|
|
4742
5066
|
import { useState as useState6, useEffect as useEffect5, useRef as useRef4, useCallback as useCallback5 } from "react";
|
|
4743
|
-
import { jsx as jsx12, jsxs as
|
|
5067
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4744
5068
|
var GAME_W = 66;
|
|
4745
5069
|
var GAME_H = 20;
|
|
4746
5070
|
var SCORE_H = 6;
|
|
@@ -5211,44 +5535,44 @@ function CoderCheck({ onExit: _onExit }) {
|
|
|
5211
5535
|
const scoreLines = buildScoreLines(scoreStr);
|
|
5212
5536
|
const view = buildGameView(s, scoreLines, scoreColor, s.message);
|
|
5213
5537
|
void tick2;
|
|
5214
|
-
return /* @__PURE__ */
|
|
5215
|
-
/* @__PURE__ */ jsx12(
|
|
5538
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 1, children: [
|
|
5539
|
+
/* @__PURE__ */ jsx12(Box12, { flexDirection: "row", children: /* @__PURE__ */ jsxs12(Text13, { children: [
|
|
5216
5540
|
"\u751F\u547D ",
|
|
5217
5541
|
/* @__PURE__ */ jsx12(Text13, { color: "red", children: "\u2665".repeat(Math.max(0, s.lives)) }),
|
|
5218
5542
|
" ",
|
|
5219
5543
|
"\u901F\u5EA6 ",
|
|
5220
|
-
/* @__PURE__ */
|
|
5544
|
+
/* @__PURE__ */ jsxs12(Text13, { color: "cyan", children: [
|
|
5221
5545
|
"Lv.",
|
|
5222
5546
|
Math.floor(s.speed * 10)
|
|
5223
5547
|
] })
|
|
5224
5548
|
] }) }),
|
|
5225
|
-
!s.gameOver && s.target && /* @__PURE__ */ jsx12(
|
|
5549
|
+
!s.gameOver && s.target && /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsxs12(Text13, { children: [
|
|
5226
5550
|
"\u6253\u5B57: ",
|
|
5227
5551
|
/* @__PURE__ */ jsx12(Text13, { color: "green", children: s.typed }),
|
|
5228
5552
|
/* @__PURE__ */ jsx12(Text13, { color: "white", children: s.target.slice(s.typed.length) })
|
|
5229
5553
|
] }) }),
|
|
5230
|
-
/* @__PURE__ */
|
|
5231
|
-
/* @__PURE__ */
|
|
5554
|
+
/* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", marginTop: 1, children: [
|
|
5555
|
+
/* @__PURE__ */ jsxs12(Text13, { children: [
|
|
5232
5556
|
"\u250C",
|
|
5233
5557
|
"\u2500".repeat(GAME_W),
|
|
5234
5558
|
"\u2510"
|
|
5235
5559
|
] }),
|
|
5236
5560
|
view.map((row, i) => /* @__PURE__ */ jsx12(Text13, { children: `\u2502${row}\u2502` }, i)),
|
|
5237
|
-
/* @__PURE__ */
|
|
5561
|
+
/* @__PURE__ */ jsxs12(Text13, { children: [
|
|
5238
5562
|
"\u2514",
|
|
5239
5563
|
"\u2500".repeat(GAME_W),
|
|
5240
5564
|
"\u2518"
|
|
5241
5565
|
] })
|
|
5242
5566
|
] }),
|
|
5243
|
-
s.gameOver && /* @__PURE__ */
|
|
5567
|
+
s.gameOver && /* @__PURE__ */ jsxs12(Box12, { marginTop: 1, children: [
|
|
5244
5568
|
/* @__PURE__ */ jsx12(Text13, { bold: true, color: "red", children: "\u6E38\u620F\u7ED3\u675F\uFF01" }),
|
|
5245
|
-
/* @__PURE__ */
|
|
5569
|
+
/* @__PURE__ */ jsxs12(Text13, { children: [
|
|
5246
5570
|
" \u5F97\u5206: ",
|
|
5247
5571
|
/* @__PURE__ */ jsx12(Text13, { color: "yellow", children: s.score }),
|
|
5248
5572
|
" r \u91CD\u5F00 q \u9000\u51FA"
|
|
5249
5573
|
] })
|
|
5250
5574
|
] }),
|
|
5251
|
-
/* @__PURE__ */ jsx12(
|
|
5575
|
+
/* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: "\u6253\u5B57\u6D88\u9664\u5355\u8BCD \u7A7A\u683C/Ctrl+P\u6682\u505C Ctrl+Q\u9000\u51FA" }) })
|
|
5252
5576
|
] });
|
|
5253
5577
|
}
|
|
5254
5578
|
var coder_check_default = {
|
|
@@ -5638,12 +5962,12 @@ import { render as render4 } from "ink";
|
|
|
5638
5962
|
import chalk5 from "chalk";
|
|
5639
5963
|
|
|
5640
5964
|
// src/stock/StockList.tsx
|
|
5641
|
-
import { Box as
|
|
5965
|
+
import { Box as Box13, Text as Text14, useInput as useInput5 } from "ink";
|
|
5642
5966
|
import { useState as useState7, useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo2 } from "react";
|
|
5643
5967
|
import asciichart from "asciichart";
|
|
5644
5968
|
import os from "os";
|
|
5645
5969
|
import { join as join7 } from "path";
|
|
5646
|
-
import { jsx as jsx13, jsxs as
|
|
5970
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5647
5971
|
var SETTINGS_PATH = join7(os.homedir(), ".dskcode", "settings.json");
|
|
5648
5972
|
function toFileUrl(p) {
|
|
5649
5973
|
const norm = p.replace(/\\/g, "/");
|
|
@@ -5862,64 +6186,64 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
5862
6186
|
);
|
|
5863
6187
|
if (detailView) {
|
|
5864
6188
|
if (detailLoading) {
|
|
5865
|
-
return /* @__PURE__ */ jsx13(
|
|
6189
|
+
return /* @__PURE__ */ jsx13(Box13, { paddingLeft: 1, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: " \u27F3 \u52A0\u8F7D\u5206\u65F6\u6570\u636E..." }) });
|
|
5866
6190
|
}
|
|
5867
6191
|
return renderDetail(detailView, () => setDetailView(null), detailPrices ?? void 0, detailCountdown, currentTime);
|
|
5868
6192
|
}
|
|
5869
6193
|
const cp2 = (c) => dimMode ? { dimColor: true } : { color: c };
|
|
5870
|
-
return /* @__PURE__ */
|
|
5871
|
-
/* @__PURE__ */
|
|
6194
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", children: [
|
|
6195
|
+
/* @__PURE__ */ jsxs13(Box13, { marginBottom: 1, justifyContent: "space-between", children: [
|
|
5872
6196
|
/* @__PURE__ */ jsx13(Text14, { bold: true, ...cp2("#00ffff"), children: " \u{1F4C8} \u81EA\u9009\u80A1\u76D1\u63A7" }),
|
|
5873
|
-
/* @__PURE__ */
|
|
6197
|
+
/* @__PURE__ */ jsxs13(Text14, { dimColor: true, children: [
|
|
5874
6198
|
" \u{1F550} ",
|
|
5875
6199
|
currentTime
|
|
5876
6200
|
] }),
|
|
5877
6201
|
/* @__PURE__ */ jsx13(Text14, { dimColor: true, children: loading ? " \u27F3 \u5237\u65B0\u4E2D..." : ` ${countdown}s \u540E\u81EA\u52A8\u5237\u65B0` })
|
|
5878
6202
|
] }),
|
|
5879
|
-
/* @__PURE__ */
|
|
5880
|
-
/* @__PURE__ */ jsx13(
|
|
5881
|
-
/* @__PURE__ */ jsx13(
|
|
5882
|
-
/* @__PURE__ */ jsx13(
|
|
5883
|
-
/* @__PURE__ */ jsx13(
|
|
5884
|
-
/* @__PURE__ */ jsx13(
|
|
6203
|
+
/* @__PURE__ */ jsxs13(Box13, { children: [
|
|
6204
|
+
/* @__PURE__ */ jsx13(Box13, { width: 3 }),
|
|
6205
|
+
/* @__PURE__ */ jsx13(Box13, { width: 9, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u4EE3\u7801" }) }),
|
|
6206
|
+
/* @__PURE__ */ jsx13(Box13, { width: 16, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u540D\u79F0" }) }),
|
|
6207
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6700\u65B0\u4EF7" }) }),
|
|
6208
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsxs13(Text14, { dimColor: true, children: [
|
|
5885
6209
|
"\u6DA8\u8DCC\u5E45",
|
|
5886
6210
|
sortOrder === "desc" ? " \u25BC" : sortOrder === "asc" ? " \u25B2" : ""
|
|
5887
6211
|
] }) }),
|
|
5888
|
-
/* @__PURE__ */ jsx13(
|
|
5889
|
-
/* @__PURE__ */ jsx13(
|
|
5890
|
-
/* @__PURE__ */ jsx13(
|
|
5891
|
-
/* @__PURE__ */ jsx13(
|
|
6212
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6DA8\u8DCC\u989D" }) }),
|
|
6213
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6700\u9AD8" }) }),
|
|
6214
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6700\u4F4E" }) }),
|
|
6215
|
+
/* @__PURE__ */ jsx13(Box13, { children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6210\u4EA4\u989D" }) })
|
|
5892
6216
|
] }),
|
|
5893
|
-
/* @__PURE__ */ jsx13(
|
|
5894
|
-
/* @__PURE__ */ jsx13(
|
|
6217
|
+
/* @__PURE__ */ jsx13(Box13, { children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: " " + "\u2500".repeat(100) }) }),
|
|
6218
|
+
/* @__PURE__ */ jsx13(Box13, { flexDirection: "column", children: sortedStocks.map((stock, index) => {
|
|
5895
6219
|
const isSelected = index === selectedIndex;
|
|
5896
6220
|
const isUp = stock.changePercent >= 0;
|
|
5897
6221
|
const color = isUp ? "#ff1493" : "#00ff41";
|
|
5898
|
-
return /* @__PURE__ */
|
|
5899
|
-
/* @__PURE__ */ jsx13(
|
|
5900
|
-
/* @__PURE__ */ jsx13(
|
|
5901
|
-
/* @__PURE__ */ jsx13(
|
|
5902
|
-
/* @__PURE__ */ jsx13(
|
|
5903
|
-
/* @__PURE__ */ jsx13(
|
|
6222
|
+
return /* @__PURE__ */ jsxs13(Box13, { children: [
|
|
6223
|
+
/* @__PURE__ */ jsx13(Box13, { width: 3, flexShrink: 0, children: isSelected ? /* @__PURE__ */ jsx13(Text14, { bold: true, ...cp2("#00ffff"), children: "\u25B8 " }) : /* @__PURE__ */ jsx13(Text14, { children: " " }) }),
|
|
6224
|
+
/* @__PURE__ */ jsx13(Box13, { width: 9, children: /* @__PURE__ */ jsx13(Text14, { bold: true, ...cp2(isSelected ? "#00ffff" : "#ffffff"), children: stock.code }) }),
|
|
6225
|
+
/* @__PURE__ */ jsx13(Box13, { width: 16, children: /* @__PURE__ */ jsx13(Text14, { ...cp2(isSelected ? "#ffffff" : "#cccccc"), children: stock.name }) }),
|
|
6226
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { bold: true, ...cp2(color), children: formatPrice(stock.price) }) }),
|
|
6227
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsxs13(Text14, { ...cp2(color), children: [
|
|
5904
6228
|
isUp ? "+" : "",
|
|
5905
6229
|
stock.changePercent.toFixed(2),
|
|
5906
6230
|
"%"
|
|
5907
6231
|
] }) }),
|
|
5908
|
-
/* @__PURE__ */ jsx13(
|
|
6232
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsxs13(Text14, { ...cp2(color), children: [
|
|
5909
6233
|
isUp ? "+" : "",
|
|
5910
6234
|
stock.changeAmount.toFixed(3)
|
|
5911
6235
|
] }) }),
|
|
5912
|
-
/* @__PURE__ */ jsx13(
|
|
5913
|
-
/* @__PURE__ */ jsx13(
|
|
5914
|
-
/* @__PURE__ */ jsx13(
|
|
6236
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { ...cp2("#cccccc"), children: formatPrice(stock.high) }) }),
|
|
6237
|
+
/* @__PURE__ */ jsx13(Box13, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { ...cp2("#888888"), children: formatPrice(stock.low) }) }),
|
|
6238
|
+
/* @__PURE__ */ jsx13(Box13, { children: /* @__PURE__ */ jsx13(Text14, { ...cp2("#888888"), children: formatAmount(stock.amount) }) })
|
|
5915
6239
|
] }, stock.code);
|
|
5916
6240
|
}) }),
|
|
5917
|
-
/* @__PURE__ */ jsx13(
|
|
5918
|
-
/* @__PURE__ */
|
|
6241
|
+
/* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text14, { 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` }) }),
|
|
6242
|
+
/* @__PURE__ */ jsxs13(Box13, { children: [
|
|
5919
6243
|
/* @__PURE__ */ jsx13(Text14, { dimColor: true, children: ` \u6700\u540E\u66F4\u65B0: ${lastUpdate} \u7F16\u8F91\u81EA\u9009\u80A1: ` }),
|
|
5920
6244
|
/* @__PURE__ */ jsx13(Text14, { ...cp2("#c792ea"), children: osc8Link(toFileUrl(SETTINGS_PATH), SETTINGS_PATH) })
|
|
5921
6245
|
] }),
|
|
5922
|
-
doubleCtrlC && /* @__PURE__ */ jsx13(
|
|
6246
|
+
doubleCtrlC && /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text14, { bold: true, ...cp2("#ff1493"), children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) })
|
|
5923
6247
|
] });
|
|
5924
6248
|
}
|
|
5925
6249
|
function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {
|
|
@@ -5937,33 +6261,33 @@ function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {
|
|
|
5937
6261
|
raw = raw.replaceAll("\u256D", "\u250C").replaceAll("\u256E", "\u2510").replaceAll("\u2570", "\u2514").replaceAll("\u256F", "\u2518");
|
|
5938
6262
|
chartLines = raw.split("\n");
|
|
5939
6263
|
}
|
|
5940
|
-
return /* @__PURE__ */
|
|
5941
|
-
/* @__PURE__ */
|
|
5942
|
-
/* @__PURE__ */
|
|
5943
|
-
/* @__PURE__ */
|
|
6264
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingLeft: 1, children: [
|
|
6265
|
+
/* @__PURE__ */ jsxs13(Box13, { marginBottom: 1, justifyContent: "space-between", children: [
|
|
6266
|
+
/* @__PURE__ */ jsxs13(Box13, { children: [
|
|
6267
|
+
/* @__PURE__ */ jsxs13(Text14, { bold: true, color: "#00ffff", children: [
|
|
5944
6268
|
" \u{1F4CA} ",
|
|
5945
6269
|
stock.name,
|
|
5946
6270
|
" "
|
|
5947
6271
|
] }),
|
|
5948
6272
|
/* @__PURE__ */ jsx13(Text14, { dimColor: true, children: stock.code }),
|
|
5949
|
-
currentTime && /* @__PURE__ */
|
|
6273
|
+
currentTime && /* @__PURE__ */ jsxs13(Text14, { dimColor: true, children: [
|
|
5950
6274
|
" \u{1F550} ",
|
|
5951
6275
|
currentTime
|
|
5952
6276
|
] })
|
|
5953
6277
|
] }),
|
|
5954
6278
|
/* @__PURE__ */ jsx13(Text14, { dimColor: true, children: `${countdown}s \u540E\u5237\u65B0` })
|
|
5955
6279
|
] }),
|
|
5956
|
-
/* @__PURE__ */
|
|
5957
|
-
/* @__PURE__ */ jsx13(
|
|
5958
|
-
/* @__PURE__ */ jsx13(
|
|
6280
|
+
/* @__PURE__ */ jsxs13(Box13, { children: [
|
|
6281
|
+
/* @__PURE__ */ jsx13(Box13, { width: 16, children: /* @__PURE__ */ jsx13(Text14, { bold: true, color: "#888888", children: "\u5F53\u524D\u4EF7" }) }),
|
|
6282
|
+
/* @__PURE__ */ jsx13(Box13, { children: /* @__PURE__ */ jsxs13(Text14, { bold: true, color: colorCode, children: [
|
|
5959
6283
|
arrow,
|
|
5960
6284
|
" ",
|
|
5961
6285
|
formatPrice(stock.price)
|
|
5962
6286
|
] }) })
|
|
5963
6287
|
] }),
|
|
5964
|
-
/* @__PURE__ */
|
|
5965
|
-
/* @__PURE__ */ jsx13(
|
|
5966
|
-
/* @__PURE__ */ jsx13(
|
|
6288
|
+
/* @__PURE__ */ jsxs13(Box13, { children: [
|
|
6289
|
+
/* @__PURE__ */ jsx13(Box13, { width: 16, children: /* @__PURE__ */ jsx13(Text14, { color: "#888888", children: "\u6DA8\u8DCC\u5E45" }) }),
|
|
6290
|
+
/* @__PURE__ */ jsx13(Box13, { children: /* @__PURE__ */ jsxs13(Text14, { color: colorCode, children: [
|
|
5967
6291
|
isUp ? "+" : "",
|
|
5968
6292
|
stock.changePercent.toFixed(2),
|
|
5969
6293
|
"%",
|
|
@@ -5972,8 +6296,8 @@ function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {
|
|
|
5972
6296
|
stock.changeAmount.toFixed(3)
|
|
5973
6297
|
] }) })
|
|
5974
6298
|
] }),
|
|
5975
|
-
chartLines.length > 0 && /* @__PURE__ */ jsx13(
|
|
5976
|
-
/* @__PURE__ */ jsx13(
|
|
6299
|
+
chartLines.length > 0 && /* @__PURE__ */ jsx13(Box13, { marginTop: 1, flexDirection: "column", children: chartLines.map((line, i) => /* @__PURE__ */ jsx13(Box13, { children: /* @__PURE__ */ jsx13(Text14, { color: colorCode, children: line || " " }) }, i)) }),
|
|
6300
|
+
/* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: " Space/q \u8FD4\u56DE\u5217\u8868" }) })
|
|
5977
6301
|
] });
|
|
5978
6302
|
}
|
|
5979
6303
|
|