dskcode 0.1.24 → 0.1.25
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-I6HEIOSU.js → chunk-EF6NIFOH.js} +1 -1
- package/dist/chunk-EF6NIFOH.js.map +1 -0
- package/dist/deepseek-MG4NT5YC.js +7 -0
- package/dist/index.js +162 -148
- package/dist/index.js.map +1 -1
- package/package.json +5 -6
- package/dist/chunk-I6HEIOSU.js.map +0 -1
- package/dist/deepseek-YTT76XDE.js +0 -7
- /package/dist/{deepseek-YTT76XDE.js.map → deepseek-MG4NT5YC.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-EF6NIFOH.js";
|
|
11
11
|
|
|
12
12
|
// src/cli/index.tsx
|
|
13
13
|
import { Command } from "commander";
|
|
@@ -1335,7 +1335,7 @@ function AssistantMessage({
|
|
|
1335
1335
|
usage,
|
|
1336
1336
|
elapsed,
|
|
1337
1337
|
cost,
|
|
1338
|
-
model
|
|
1338
|
+
model: _model
|
|
1339
1339
|
}) {
|
|
1340
1340
|
if (!content && (!toolCalls || toolCalls.length === 0) && !isStreaming) {
|
|
1341
1341
|
return null;
|
|
@@ -1421,7 +1421,7 @@ function SkillSelector({ skills, input, selectedIndex }) {
|
|
|
1421
1421
|
const query = match[1].toLowerCase().trim();
|
|
1422
1422
|
if (skills.length === 0) return null;
|
|
1423
1423
|
const matched = !query && input.startsWith("/") ? skills.slice(0, 3) : skills.filter((s) => s.name.toLowerCase().includes(query)).slice(0, 3);
|
|
1424
|
-
if (query && matched.
|
|
1424
|
+
if (query && matched.some((s) => s.name.toLowerCase() === query)) return null;
|
|
1425
1425
|
if (matched.length === 0) return null;
|
|
1426
1426
|
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginLeft: 4, marginTop: 1, children: [
|
|
1427
1427
|
/* @__PURE__ */ jsx7(Text8, { color: "#808080", dimColor: true, children: "\u652F\u6301\u7684 Skill\uFF1A" }),
|
|
@@ -1499,6 +1499,7 @@ defaultRegistry.register("deepseek", (config) => {
|
|
|
1499
1499
|
return new DeepSeekProvider({
|
|
1500
1500
|
apiKey: config.apiKey,
|
|
1501
1501
|
baseUrl: config.baseUrl,
|
|
1502
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
1502
1503
|
model: config.model
|
|
1503
1504
|
});
|
|
1504
1505
|
});
|
|
@@ -1531,7 +1532,7 @@ function eraseTool(tool) {
|
|
|
1531
1532
|
return tool.execute(args, ctx);
|
|
1532
1533
|
},
|
|
1533
1534
|
initialTitle(args) {
|
|
1534
|
-
return tool.initialTitle?.(args) ??
|
|
1535
|
+
return tool.initialTitle?.(args) ?? tool.name;
|
|
1535
1536
|
}
|
|
1536
1537
|
};
|
|
1537
1538
|
}
|
|
@@ -1845,6 +1846,7 @@ var Session = class {
|
|
|
1845
1846
|
const [trimmed] = trimMessages(
|
|
1846
1847
|
[...this.#messages],
|
|
1847
1848
|
{
|
|
1849
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
1848
1850
|
model: this.#provider.model(),
|
|
1849
1851
|
reservedForOutput: this.#options.reservedForOutput,
|
|
1850
1852
|
systemPrompt,
|
|
@@ -1864,7 +1866,7 @@ var Session = class {
|
|
|
1864
1866
|
let accumulatedText = "";
|
|
1865
1867
|
let lastUsage;
|
|
1866
1868
|
let lastToolCalls;
|
|
1867
|
-
let
|
|
1869
|
+
let _lastFinishReason = null;
|
|
1868
1870
|
for await (const chunk of stream) {
|
|
1869
1871
|
if (chunk.content) {
|
|
1870
1872
|
accumulatedText += chunk.content;
|
|
@@ -1877,7 +1879,7 @@ var Session = class {
|
|
|
1877
1879
|
lastUsage = chunk.usage;
|
|
1878
1880
|
}
|
|
1879
1881
|
if (chunk.finishReason) {
|
|
1880
|
-
|
|
1882
|
+
_lastFinishReason = chunk.finishReason;
|
|
1881
1883
|
}
|
|
1882
1884
|
}
|
|
1883
1885
|
if (lastUsage) {
|
|
@@ -2083,6 +2085,7 @@ ${item.result.diff.patch}`;
|
|
|
2083
2085
|
const toolDescs = enabledTools.map((t) => ({
|
|
2084
2086
|
name: t.name,
|
|
2085
2087
|
description: t.description,
|
|
2088
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
2086
2089
|
parameters: t.parameters
|
|
2087
2090
|
}));
|
|
2088
2091
|
const opts = {
|
|
@@ -2108,6 +2111,7 @@ ${item.result.diff.patch}`;
|
|
|
2108
2111
|
function: {
|
|
2109
2112
|
name: t.name,
|
|
2110
2113
|
description: t.description,
|
|
2114
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
2111
2115
|
parameters: t.parameters
|
|
2112
2116
|
}
|
|
2113
2117
|
}));
|
|
@@ -2171,7 +2175,7 @@ function getDefaultTimeout() {
|
|
|
2171
2175
|
return DEFAULT_TIMEOUT_MS;
|
|
2172
2176
|
}
|
|
2173
2177
|
async function execCommand(command, args, cwd, timeoutMs = DEFAULT_TIMEOUT_MS, signal, isShellCommand) {
|
|
2174
|
-
return new Promise((
|
|
2178
|
+
return new Promise((_resolve) => {
|
|
2175
2179
|
let spawnCmd;
|
|
2176
2180
|
let spawnArgs;
|
|
2177
2181
|
let useShell;
|
|
@@ -2214,13 +2218,13 @@ async function execCommand(command, args, cwd, timeoutMs = DEFAULT_TIMEOUT_MS, s
|
|
|
2214
2218
|
}
|
|
2215
2219
|
child.on("close", (code) => {
|
|
2216
2220
|
clearTimeout(timeout);
|
|
2217
|
-
|
|
2221
|
+
_resolve({ stdout, stderr, exitCode: code });
|
|
2218
2222
|
});
|
|
2219
2223
|
child.on("error", (err) => {
|
|
2220
2224
|
clearTimeout(timeout);
|
|
2221
2225
|
stderr += `
|
|
2222
2226
|
\u8FDB\u7A0B\u542F\u52A8\u5931\u8D25\uFF1A${err.message}`;
|
|
2223
|
-
|
|
2227
|
+
_resolve({ stdout, stderr, exitCode: null });
|
|
2224
2228
|
});
|
|
2225
2229
|
});
|
|
2226
2230
|
}
|
|
@@ -2263,42 +2267,41 @@ function computeLineDiff(oldLines, newLines) {
|
|
|
2263
2267
|
const V = new Array(2 * maxD + 2).fill(-1);
|
|
2264
2268
|
const offset = maxD;
|
|
2265
2269
|
V[offset + 1] = 0;
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
return backtrack(trace, N, M, oldLines, newLines, offset);
|
|
2289
|
-
}
|
|
2270
|
+
for (let d = 0; d <= maxD; d++) {
|
|
2271
|
+
const snapshot = /* @__PURE__ */ new Map();
|
|
2272
|
+
const kStart = -d;
|
|
2273
|
+
const kEnd = d;
|
|
2274
|
+
for (let k = kStart; k <= kEnd; k += 2) {
|
|
2275
|
+
const ki = k + offset;
|
|
2276
|
+
let x;
|
|
2277
|
+
if (k === -d || k !== d && V[ki - 1] < V[ki + 1]) {
|
|
2278
|
+
x = V[ki + 1];
|
|
2279
|
+
} else {
|
|
2280
|
+
x = V[ki - 1] + 1;
|
|
2281
|
+
}
|
|
2282
|
+
let y = x - k;
|
|
2283
|
+
while (x < N && y < M && oldLines[x] === newLines[y]) {
|
|
2284
|
+
x++;
|
|
2285
|
+
y++;
|
|
2286
|
+
}
|
|
2287
|
+
V[ki] = x;
|
|
2288
|
+
snapshot.set(k, x);
|
|
2289
|
+
if (x >= N && y >= M) {
|
|
2290
|
+
trace.push(snapshot);
|
|
2291
|
+
return backtrack(trace, N, M, oldLines, newLines, offset);
|
|
2290
2292
|
}
|
|
2291
|
-
trace.push(snapshot);
|
|
2292
2293
|
}
|
|
2294
|
+
trace.push(snapshot);
|
|
2295
|
+
}
|
|
2293
2296
|
return oldLines.map((line) => ({ op: "remove", line })).concat(newLines.map((line) => ({ op: "add", line })));
|
|
2294
2297
|
}
|
|
2295
|
-
function backtrack(trace, N, M, oldLines, newLines,
|
|
2298
|
+
function backtrack(trace, N, M, oldLines, newLines, _offset) {
|
|
2296
2299
|
const result = [];
|
|
2297
2300
|
let x = N;
|
|
2298
2301
|
let y = M;
|
|
2299
2302
|
for (let d = trace.length - 1; d >= 1; d--) {
|
|
2300
2303
|
const k = x - y;
|
|
2301
|
-
const prevSnapshot =
|
|
2304
|
+
const prevSnapshot = trace[d - 1];
|
|
2302
2305
|
const prevKDown = prevSnapshot.get(k - 1);
|
|
2303
2306
|
const prevKUp = prevSnapshot.get(k + 1);
|
|
2304
2307
|
let prevK;
|
|
@@ -2687,7 +2690,7 @@ var writeFileTool = {
|
|
|
2687
2690
|
} catch {
|
|
2688
2691
|
}
|
|
2689
2692
|
await mkdir4(dirname(filePath), { recursive: true });
|
|
2690
|
-
const content =
|
|
2693
|
+
const content = args.content;
|
|
2691
2694
|
await writeFileWithEol(filePath, oldContent, content);
|
|
2692
2695
|
const diff = computeFileDiff(oldContent, content, filePath);
|
|
2693
2696
|
diff.existedBefore = existedBefore;
|
|
@@ -3206,7 +3209,7 @@ var globTool = {
|
|
|
3206
3209
|
// src/tool/builtins/grep.ts
|
|
3207
3210
|
import { readdir as readdir3, readFile as readFile9, stat as stat3 } from "fs/promises";
|
|
3208
3211
|
import { join as join5, relative as relative5, isAbsolute as isAbsolute3 } from "path";
|
|
3209
|
-
async function collectFiles(dir,
|
|
3212
|
+
async function collectFiles(dir, extension, maxFiles = 200) {
|
|
3210
3213
|
const results = [];
|
|
3211
3214
|
let entries;
|
|
3212
3215
|
try {
|
|
@@ -3221,7 +3224,7 @@ async function collectFiles(dir, baseDir, extension, maxFiles = 200) {
|
|
|
3221
3224
|
}
|
|
3222
3225
|
const fullPath = join5(dir, entry.name);
|
|
3223
3226
|
if (entry.isDirectory()) {
|
|
3224
|
-
results.push(...await collectFiles(fullPath,
|
|
3227
|
+
results.push(...await collectFiles(fullPath, extension, maxFiles - results.length));
|
|
3225
3228
|
} else {
|
|
3226
3229
|
if (extension && !entry.name.endsWith(`.${extension}`)) {
|
|
3227
3230
|
continue;
|
|
@@ -3275,7 +3278,7 @@ var grepTool = {
|
|
|
3275
3278
|
if (!dirStat.isDirectory()) {
|
|
3276
3279
|
return { success: false, data: `\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\uFF1A${searchDir}`, error: "NOT_DIRECTORY" };
|
|
3277
3280
|
}
|
|
3278
|
-
const files = await collectFiles(searchDir,
|
|
3281
|
+
const files = await collectFiles(searchDir, args.include, maxFiles);
|
|
3279
3282
|
const matches = [];
|
|
3280
3283
|
for (const filePath of files) {
|
|
3281
3284
|
try {
|
|
@@ -3283,7 +3286,7 @@ var grepTool = {
|
|
|
3283
3286
|
const lines = content.split("\n");
|
|
3284
3287
|
const relPath = relative5(searchDir, filePath);
|
|
3285
3288
|
for (let i = 0; i < lines.length; i++) {
|
|
3286
|
-
if (regex.test(lines[i])) {
|
|
3289
|
+
if (regex.test(lines[i] ?? "")) {
|
|
3287
3290
|
regex.lastIndex = 0;
|
|
3288
3291
|
matches.push({
|
|
3289
3292
|
file: relPath,
|
|
@@ -3352,7 +3355,7 @@ var lsTool = {
|
|
|
3352
3355
|
try {
|
|
3353
3356
|
const entries = await readdir4(dirPath, { withFileTypes: true });
|
|
3354
3357
|
const lines = [];
|
|
3355
|
-
const sorted = [...entries].
|
|
3358
|
+
const sorted = [...entries].toSorted((a, b) => {
|
|
3356
3359
|
if (a.isDirectory() !== b.isDirectory()) {
|
|
3357
3360
|
return a.isDirectory() ? -1 : 1;
|
|
3358
3361
|
}
|
|
@@ -3653,16 +3656,16 @@ function ChatSession({
|
|
|
3653
3656
|
const streamingPhaseRef = useRef2(0);
|
|
3654
3657
|
const [currentContent, setCurrentContent] = useState3("");
|
|
3655
3658
|
const [currentToolCalls, setCurrentToolCalls] = useState3([]);
|
|
3656
|
-
const [
|
|
3657
|
-
const [
|
|
3658
|
-
const [
|
|
3659
|
+
const [_currentUsage, setCurrentUsage] = useState3(void 0);
|
|
3660
|
+
const [_currentElapsed, setCurrentElapsed] = useState3(void 0);
|
|
3661
|
+
const [_currentCost, setCurrentCost] = useState3(void 0);
|
|
3659
3662
|
const [activeModel, setActiveModel] = useState3(model);
|
|
3660
|
-
const [
|
|
3663
|
+
const [_streamingModel, setStreamingModel] = useState3(void 0);
|
|
3661
3664
|
const [streamError, setStreamError] = useState3(void 0);
|
|
3662
3665
|
const [sessionMode, setSessionMode] = useState3("code");
|
|
3663
3666
|
const [thinkingEnabled, setThinkingEnabled] = useState3(true);
|
|
3664
3667
|
const [thinkingEffort, setThinkingEffort] = useState3("high");
|
|
3665
|
-
const [responseFormat
|
|
3668
|
+
const [responseFormat] = useState3("text");
|
|
3666
3669
|
const [toolChoice, setToolChoice] = useState3(void 0);
|
|
3667
3670
|
const sessionCost = useMemo(() => {
|
|
3668
3671
|
return displayMessages.reduce((sum, msg) => {
|
|
@@ -3892,7 +3895,7 @@ function ChatSession({
|
|
|
3892
3895
|
if (!apiKey || !baseUrl) return;
|
|
3893
3896
|
let cancelled = false;
|
|
3894
3897
|
setBalanceLoading(true);
|
|
3895
|
-
import("./deepseek-
|
|
3898
|
+
import("./deepseek-MG4NT5YC.js").then(({ DeepSeekProvider: DeepSeekProvider2 }) => {
|
|
3896
3899
|
const provider = new DeepSeekProvider2({
|
|
3897
3900
|
apiKey,
|
|
3898
3901
|
baseUrl,
|
|
@@ -4509,7 +4512,7 @@ function createBricks(level) {
|
|
|
4509
4512
|
function createInitialState(level) {
|
|
4510
4513
|
const def = getLevel(level);
|
|
4511
4514
|
const totalW = def.cols * def.bw + (def.cols - 1) * 2;
|
|
4512
|
-
const
|
|
4515
|
+
const _startX = Math.floor((GAME_WIDTH - totalW) / 2);
|
|
4513
4516
|
return {
|
|
4514
4517
|
level,
|
|
4515
4518
|
bricks: createBricks(level),
|
|
@@ -5636,7 +5639,7 @@ import chalk5 from "chalk";
|
|
|
5636
5639
|
|
|
5637
5640
|
// src/stock/StockList.tsx
|
|
5638
5641
|
import { Box as Box12, Text as Text14, useInput as useInput5 } from "ink";
|
|
5639
|
-
import { useState as useState7, useCallback as useCallback6, useEffect as useEffect6 } from "react";
|
|
5642
|
+
import { useState as useState7, useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo2 } from "react";
|
|
5640
5643
|
import asciichart from "asciichart";
|
|
5641
5644
|
import os from "os";
|
|
5642
5645
|
import { join as join7 } from "path";
|
|
@@ -5756,6 +5759,13 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
5756
5759
|
() => (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour12: false })
|
|
5757
5760
|
);
|
|
5758
5761
|
const [dimMode, setDimMode] = useState7(false);
|
|
5762
|
+
const [sortOrder, setSortOrder] = useState7("default");
|
|
5763
|
+
const sortedStocks = useMemo2(() => {
|
|
5764
|
+
if (sortOrder === "default") return stocks;
|
|
5765
|
+
return [...stocks].toSorted(
|
|
5766
|
+
(a, b) => sortOrder === "desc" ? b.changePercent - a.changePercent : a.changePercent - b.changePercent
|
|
5767
|
+
);
|
|
5768
|
+
}, [stocks, sortOrder]);
|
|
5759
5769
|
const { doubleCtrlC, handleCtrlC } = useDoubleCtrlC(onExit);
|
|
5760
5770
|
useEffect6(() => {
|
|
5761
5771
|
const timer = setInterval(() => {
|
|
@@ -5774,13 +5784,13 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
5774
5784
|
setLoading(false);
|
|
5775
5785
|
}, [codes]);
|
|
5776
5786
|
useEffect6(() => {
|
|
5777
|
-
loadData();
|
|
5787
|
+
void loadData();
|
|
5778
5788
|
}, [loadData]);
|
|
5779
5789
|
useEffect6(() => {
|
|
5780
5790
|
const interval = setInterval(() => {
|
|
5781
5791
|
setCountdown((prev) => {
|
|
5782
5792
|
if (prev <= 1) {
|
|
5783
|
-
loadData();
|
|
5793
|
+
void loadData();
|
|
5784
5794
|
return 5;
|
|
5785
5795
|
}
|
|
5786
5796
|
return prev - 1;
|
|
@@ -5789,24 +5799,23 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
5789
5799
|
return () => clearInterval(interval);
|
|
5790
5800
|
}, [loadData]);
|
|
5791
5801
|
useEffect6(() => {
|
|
5792
|
-
if (
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5802
|
+
if (detailView) {
|
|
5803
|
+
const loadDetail = () => {
|
|
5804
|
+
minuteCache.delete(detailView.code);
|
|
5805
|
+
void fetchStockMinute(detailView.code).then((data) => {
|
|
5806
|
+
if (data && data.prices.length > 0) {
|
|
5807
|
+
cacheMinute(detailView.code, data.prices);
|
|
5808
|
+
setDetailPrices(data.prices);
|
|
5809
|
+
}
|
|
5810
|
+
});
|
|
5811
|
+
};
|
|
5812
|
+
loadDetail();
|
|
5813
|
+
setDetailCountdown(10);
|
|
5814
|
+
const timer = setInterval(loadDetail, 1e4);
|
|
5815
|
+
return () => clearInterval(timer);
|
|
5796
5816
|
}
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
fetchStockMinute(detailView.code).then((data) => {
|
|
5800
|
-
if (data && data.prices.length > 0) {
|
|
5801
|
-
cacheMinute(detailView.code, data.prices);
|
|
5802
|
-
setDetailPrices(data.prices);
|
|
5803
|
-
}
|
|
5804
|
-
});
|
|
5805
|
-
};
|
|
5806
|
-
loadDetail();
|
|
5807
|
-
setDetailCountdown(10);
|
|
5808
|
-
const timer = setInterval(loadDetail, 1e4);
|
|
5809
|
-
return () => clearInterval(timer);
|
|
5817
|
+
setDetailPrices(null);
|
|
5818
|
+
setDetailLoading(false);
|
|
5810
5819
|
}, [detailView]);
|
|
5811
5820
|
useEffect6(() => {
|
|
5812
5821
|
if (!detailView) return;
|
|
@@ -5841,7 +5850,9 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
5841
5850
|
else onExit();
|
|
5842
5851
|
} else if (input === "r") {
|
|
5843
5852
|
setCountdown(5);
|
|
5844
|
-
loadData();
|
|
5853
|
+
void loadData();
|
|
5854
|
+
} else if (input === "o") {
|
|
5855
|
+
setSortOrder((prev) => prev === "default" ? "desc" : prev === "desc" ? "asc" : "default");
|
|
5845
5856
|
} else if (input === "h") {
|
|
5846
5857
|
setDimMode((v) => !v);
|
|
5847
5858
|
}
|
|
@@ -5870,14 +5881,17 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
5870
5881
|
/* @__PURE__ */ jsx13(Box12, { width: 9, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u4EE3\u7801" }) }),
|
|
5871
5882
|
/* @__PURE__ */ jsx13(Box12, { width: 16, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u540D\u79F0" }) }),
|
|
5872
5883
|
/* @__PURE__ */ jsx13(Box12, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6700\u65B0\u4EF7" }) }),
|
|
5873
|
-
/* @__PURE__ */ jsx13(Box12, { width: 12, children: /* @__PURE__ */
|
|
5884
|
+
/* @__PURE__ */ jsx13(Box12, { width: 12, children: /* @__PURE__ */ jsxs12(Text14, { dimColor: true, children: [
|
|
5885
|
+
"\u6DA8\u8DCC\u5E45",
|
|
5886
|
+
sortOrder === "desc" ? " \u25BC" : sortOrder === "asc" ? " \u25B2" : ""
|
|
5887
|
+
] }) }),
|
|
5874
5888
|
/* @__PURE__ */ jsx13(Box12, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6DA8\u8DCC\u989D" }) }),
|
|
5875
5889
|
/* @__PURE__ */ jsx13(Box12, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6700\u9AD8" }) }),
|
|
5876
5890
|
/* @__PURE__ */ jsx13(Box12, { width: 12, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6700\u4F4E" }) }),
|
|
5877
5891
|
/* @__PURE__ */ jsx13(Box12, { children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: "\u6210\u4EA4\u989D" }) })
|
|
5878
5892
|
] }),
|
|
5879
5893
|
/* @__PURE__ */ jsx13(Box12, { children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: " " + "\u2500".repeat(100) }) }),
|
|
5880
|
-
/* @__PURE__ */ jsx13(Box12, { flexDirection: "column", children:
|
|
5894
|
+
/* @__PURE__ */ jsx13(Box12, { flexDirection: "column", children: sortedStocks.map((stock, index) => {
|
|
5881
5895
|
const isSelected = index === selectedIndex;
|
|
5882
5896
|
const isUp = stock.changePercent >= 0;
|
|
5883
5897
|
const color = isUp ? "#ff1493" : "#00ff41";
|
|
@@ -5900,7 +5914,7 @@ function StockList({ codes, onExit, onBackToChat }) {
|
|
|
5900
5914
|
/* @__PURE__ */ jsx13(Box12, { children: /* @__PURE__ */ jsx13(Text14, { ...cp2("#888888"), children: formatAmount(stock.amount) }) })
|
|
5901
5915
|
] }, stock.code);
|
|
5902
5916
|
}) }),
|
|
5903
|
-
/* @__PURE__ */ jsx13(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text14, { dimColor: true, children: ` \u2191/\u2193 \u9009\u62E9 Enter \u8BE6\u60C5 r \u624B\u52A8\u5237\u65B0 h \u7F6E\u7070/\u6062\u590D q \u8FD4\u56DE` }) }),
|
|
5917
|
+
/* @__PURE__ */ jsx13(Box12, { 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` }) }),
|
|
5904
5918
|
/* @__PURE__ */ jsxs12(Box12, { children: [
|
|
5905
5919
|
/* @__PURE__ */ jsx13(Text14, { dimColor: true, children: ` \u6700\u540E\u66F4\u65B0: ${lastUpdate} \u7F16\u8F91\u81EA\u9009\u80A1: ` }),
|
|
5906
5920
|
/* @__PURE__ */ jsx13(Text14, { ...cp2("#c792ea"), children: osc8Link(toFileUrl(SETTINGS_PATH), SETTINGS_PATH) })
|
|
@@ -6075,81 +6089,8 @@ function createCli() {
|
|
|
6075
6089
|
budgetLimit: ctx?.config.budgetLimit ?? 0,
|
|
6076
6090
|
tokenBudgetLimit: ctx?.config.tokenBudgetLimit ?? 0
|
|
6077
6091
|
});
|
|
6078
|
-
startChat(ctx, costTracker);
|
|
6092
|
+
void startChat(ctx, costTracker);
|
|
6079
6093
|
});
|
|
6080
|
-
async function startChat(ctx, costTracker) {
|
|
6081
|
-
const [globalSkillCount, localSkillCount, skills, files] = await Promise.all([
|
|
6082
|
-
countDskcodeSkills(),
|
|
6083
|
-
countProjectLocalSkills(process.cwd()),
|
|
6084
|
-
getAllSkills(process.cwd()),
|
|
6085
|
-
scanProjectFiles(process.cwd())
|
|
6086
|
-
]);
|
|
6087
|
-
const skillCount = globalSkillCount + localSkillCount;
|
|
6088
|
-
const defaultProvider = ctx?.config.providers.find(
|
|
6089
|
-
(p) => p.name === (ctx?.config.defaultProvider ?? "deepseek")
|
|
6090
|
-
);
|
|
6091
|
-
const model = defaultProvider?.model ?? "deepseek-v4-flash";
|
|
6092
|
-
const chatApp = renderApp(
|
|
6093
|
-
/* @__PURE__ */ jsx14(
|
|
6094
|
-
ChatSession,
|
|
6095
|
-
{
|
|
6096
|
-
skillCount,
|
|
6097
|
-
skills,
|
|
6098
|
-
files,
|
|
6099
|
-
toolCount: ctx?.config.tools.length ?? 0,
|
|
6100
|
-
verbose: ctx?.verbose ?? false,
|
|
6101
|
-
apiKey: defaultProvider?.apiKey,
|
|
6102
|
-
baseUrl: defaultProvider?.baseUrl ?? "https://api.deepseek.com",
|
|
6103
|
-
costTracker,
|
|
6104
|
-
model,
|
|
6105
|
-
onLaunchGame: () => {
|
|
6106
|
-
chatApp.unmount();
|
|
6107
|
-
setImmediate(() => {
|
|
6108
|
-
initGames();
|
|
6109
|
-
const games = listGames();
|
|
6110
|
-
const { unmount } = render4(
|
|
6111
|
-
/* @__PURE__ */ jsx14(
|
|
6112
|
-
GamePicker,
|
|
6113
|
-
{
|
|
6114
|
-
games,
|
|
6115
|
-
onSelect: async (game) => {
|
|
6116
|
-
unmount();
|
|
6117
|
-
await game.play();
|
|
6118
|
-
startChat(ctx, costTracker);
|
|
6119
|
-
},
|
|
6120
|
-
onBackToChat: () => {
|
|
6121
|
-
unmount();
|
|
6122
|
-
setImmediate(() => startChat(ctx, costTracker));
|
|
6123
|
-
}
|
|
6124
|
-
}
|
|
6125
|
-
),
|
|
6126
|
-
{ exitOnCtrlC: false }
|
|
6127
|
-
);
|
|
6128
|
-
});
|
|
6129
|
-
},
|
|
6130
|
-
onLaunchStock: () => {
|
|
6131
|
-
chatApp.unmount();
|
|
6132
|
-
setImmediate(() => {
|
|
6133
|
-
const defaultStockCodes = ctx?.config.stock?.symbols?.map((s) => s.code) ?? ["sh000001", "sz399006", "sh601688"];
|
|
6134
|
-
const stockApp = renderApp(
|
|
6135
|
-
/* @__PURE__ */ jsx14(
|
|
6136
|
-
StockList,
|
|
6137
|
-
{
|
|
6138
|
-
codes: defaultStockCodes,
|
|
6139
|
-
onBackToChat: () => {
|
|
6140
|
-
stockApp.unmount();
|
|
6141
|
-
setImmediate(() => startChat(ctx, costTracker));
|
|
6142
|
-
},
|
|
6143
|
-
onExit: () => process.exit(0)
|
|
6144
|
-
}
|
|
6145
|
-
)
|
|
6146
|
-
);
|
|
6147
|
-
});
|
|
6148
|
-
}
|
|
6149
|
-
}
|
|
6150
|
-
)
|
|
6151
|
-
);
|
|
6152
|
-
}
|
|
6153
6094
|
program2.command("run").description("\u6267\u884C\u4E00\u6B21\u6027\u4EFB\u52A1").argument("[prompt...]", "\u4EFB\u52A1\u63CF\u8FF0").option("--model <name>", "\u6307\u5B9A\u4F7F\u7528\u7684\u6A21\u578B").action(async function(_prompt) {
|
|
6154
6095
|
console.log("dskcode run \u2014 \u5F85\u5B9E\u73B0\uFF08\u7B2C07\u7AE0\uFF09");
|
|
6155
6096
|
});
|
|
@@ -6194,7 +6135,7 @@ compdef _dskcode_completion dskcode`);
|
|
|
6194
6135
|
}
|
|
6195
6136
|
});
|
|
6196
6137
|
program2.command("stock").description("\u67E5\u770B\u81EA\u9009\u80A1\u5B9E\u65F6\u884C\u60C5").argument("[codes...]", "\u80A1\u7968\u4EE3\u7801\uFF08\u7A7A\u683C\u5206\u9694\uFF09\uFF0C\u5982 513090 600519").action(async function(codes) {
|
|
6197
|
-
const
|
|
6138
|
+
const _ctx = this.dskcodeCtx;
|
|
6198
6139
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "~";
|
|
6199
6140
|
const globalConfigPath = join9(home, ".dskcode", "settings.json");
|
|
6200
6141
|
let globalConfigHasStock = false;
|
|
@@ -6275,6 +6216,79 @@ compdef _dskcode_completion dskcode`);
|
|
|
6275
6216
|
});
|
|
6276
6217
|
return program2;
|
|
6277
6218
|
}
|
|
6219
|
+
async function startChat(ctx, costTracker) {
|
|
6220
|
+
const [globalSkillCount, localSkillCount, skills, files] = await Promise.all([
|
|
6221
|
+
countDskcodeSkills(),
|
|
6222
|
+
countProjectLocalSkills(process.cwd()),
|
|
6223
|
+
getAllSkills(process.cwd()),
|
|
6224
|
+
scanProjectFiles(process.cwd())
|
|
6225
|
+
]);
|
|
6226
|
+
const skillCount = globalSkillCount + localSkillCount;
|
|
6227
|
+
const defaultProvider = ctx?.config.providers.find(
|
|
6228
|
+
(p) => p.name === (ctx?.config.defaultProvider ?? "deepseek")
|
|
6229
|
+
);
|
|
6230
|
+
const model = defaultProvider?.model ?? "deepseek-v4-flash";
|
|
6231
|
+
const chatApp = renderApp(
|
|
6232
|
+
/* @__PURE__ */ jsx14(
|
|
6233
|
+
ChatSession,
|
|
6234
|
+
{
|
|
6235
|
+
skillCount,
|
|
6236
|
+
skills,
|
|
6237
|
+
files,
|
|
6238
|
+
toolCount: ctx?.config.tools.length ?? 0,
|
|
6239
|
+
verbose: ctx?.verbose ?? false,
|
|
6240
|
+
apiKey: defaultProvider?.apiKey,
|
|
6241
|
+
baseUrl: defaultProvider?.baseUrl ?? "https://api.deepseek.com",
|
|
6242
|
+
costTracker,
|
|
6243
|
+
model,
|
|
6244
|
+
onLaunchGame: () => {
|
|
6245
|
+
chatApp.unmount();
|
|
6246
|
+
setImmediate(() => {
|
|
6247
|
+
initGames();
|
|
6248
|
+
const games = listGames();
|
|
6249
|
+
const { unmount } = render4(
|
|
6250
|
+
/* @__PURE__ */ jsx14(
|
|
6251
|
+
GamePicker,
|
|
6252
|
+
{
|
|
6253
|
+
games,
|
|
6254
|
+
onSelect: async (game) => {
|
|
6255
|
+
unmount();
|
|
6256
|
+
await game.play();
|
|
6257
|
+
void startChat(ctx, costTracker);
|
|
6258
|
+
},
|
|
6259
|
+
onBackToChat: () => {
|
|
6260
|
+
unmount();
|
|
6261
|
+
setImmediate(() => startChat(ctx, costTracker));
|
|
6262
|
+
}
|
|
6263
|
+
}
|
|
6264
|
+
),
|
|
6265
|
+
{ exitOnCtrlC: false }
|
|
6266
|
+
);
|
|
6267
|
+
});
|
|
6268
|
+
},
|
|
6269
|
+
onLaunchStock: () => {
|
|
6270
|
+
chatApp.unmount();
|
|
6271
|
+
setImmediate(() => {
|
|
6272
|
+
const defaultStockCodes = ctx?.config.stock?.symbols?.map((s) => s.code) ?? ["sh000001", "sz399006", "sh601688"];
|
|
6273
|
+
const stockApp = renderApp(
|
|
6274
|
+
/* @__PURE__ */ jsx14(
|
|
6275
|
+
StockList,
|
|
6276
|
+
{
|
|
6277
|
+
codes: defaultStockCodes,
|
|
6278
|
+
onBackToChat: () => {
|
|
6279
|
+
stockApp.unmount();
|
|
6280
|
+
setImmediate(() => startChat(ctx, costTracker));
|
|
6281
|
+
},
|
|
6282
|
+
onExit: () => process.exit(0)
|
|
6283
|
+
}
|
|
6284
|
+
)
|
|
6285
|
+
);
|
|
6286
|
+
});
|
|
6287
|
+
}
|
|
6288
|
+
}
|
|
6289
|
+
)
|
|
6290
|
+
);
|
|
6291
|
+
}
|
|
6278
6292
|
|
|
6279
6293
|
// src/cli/exit-codes.ts
|
|
6280
6294
|
var ExitCode = {
|