reasonix 0.40.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -16
- package/README.zh-CN.md +19 -13
- package/dashboard/app.css +8 -4
- package/dashboard/dist/app.js +377 -227
- package/dashboard/dist/app.js.map +1 -1
- package/dist/cli/acp-DAGPCVFZ.js +713 -0
- package/dist/cli/acp-DAGPCVFZ.js.map +1 -0
- package/dist/cli/chat-7ES4IBNH.js +50 -0
- package/dist/cli/{chunk-E46ECXJD.js → chunk-2425HK6U.js} +2 -1
- package/dist/cli/{chunk-E46ECXJD.js.map → chunk-2425HK6U.js.map} +1 -1
- package/dist/cli/chunk-25T6CVUP.js +172 -0
- package/dist/cli/chunk-25T6CVUP.js.map +1 -0
- package/dist/cli/{chunk-7DLHHBGN.js → chunk-2K65GZBT.js} +16 -5
- package/dist/cli/chunk-2K65GZBT.js.map +1 -0
- package/dist/cli/{chunk-KMWKGPFZ.js → chunk-2KDUS647.js} +14 -4
- package/dist/cli/chunk-2KDUS647.js.map +1 -0
- package/dist/cli/chunk-2R4QCDOZ.js +11392 -0
- package/dist/cli/chunk-2R4QCDOZ.js.map +1 -0
- package/dist/cli/{chunk-3Q3C4W66.js → chunk-2UQP6H6T.js} +2 -1
- package/dist/cli/{chunk-3Q3C4W66.js.map → chunk-2UQP6H6T.js.map} +1 -1
- package/dist/cli/chunk-2Z35JOA4.js +96 -0
- package/dist/cli/chunk-2Z35JOA4.js.map +1 -0
- package/dist/cli/chunk-32TIKD5U.js +54 -0
- package/dist/cli/{chunk-JWCTX5S4.js.map → chunk-32TIKD5U.js.map} +1 -1
- package/dist/cli/{chunk-UVRXTSK3.js → chunk-3BXRZFWS.js} +65 -3
- package/dist/cli/chunk-3BXRZFWS.js.map +1 -0
- package/dist/cli/chunk-3Z6IBU3D.js +249 -0
- package/dist/cli/chunk-3Z6IBU3D.js.map +1 -0
- package/dist/cli/{chunk-VLNRQMCI.js → chunk-45U62RI3.js} +12 -5
- package/dist/cli/chunk-45U62RI3.js.map +1 -0
- package/dist/cli/{chunk-5GKJLNP2.js → chunk-4QUNBQQ2.js} +3 -2
- package/dist/cli/{chunk-5GKJLNP2.js.map → chunk-4QUNBQQ2.js.map} +1 -1
- package/dist/cli/{chunk-R4YTW7PR.js → chunk-5JJRUIPA.js} +57 -12
- package/dist/cli/chunk-5JJRUIPA.js.map +1 -0
- package/dist/cli/{chunk-HCC42PEI.js → chunk-6AK4EY3D.js} +12 -6
- package/dist/cli/chunk-6AK4EY3D.js.map +1 -0
- package/dist/cli/chunk-6G3CUUFG.js +34320 -0
- package/dist/cli/chunk-6G3CUUFG.js.map +1 -0
- package/dist/cli/{chunk-XST7BSZJ.js → chunk-6PBZN4VI.js} +21 -3
- package/dist/cli/chunk-6PBZN4VI.js.map +1 -0
- package/dist/cli/{chunk-A5LSGEEK.js → chunk-6PZ3CXBP.js} +88 -66
- package/dist/cli/chunk-6PZ3CXBP.js.map +1 -0
- package/dist/cli/chunk-74EX7SUH.js +25293 -0
- package/dist/cli/chunk-74EX7SUH.js.map +1 -0
- package/dist/cli/{chunk-FFNOMR32.js → chunk-7O5ALB4C.js} +3 -2
- package/dist/cli/{chunk-FFNOMR32.js.map → chunk-7O5ALB4C.js.map} +1 -1
- package/dist/cli/{chunk-UCMTWZKU.js → chunk-DOYHN4KB.js} +3 -2
- package/dist/cli/{chunk-UCMTWZKU.js.map → chunk-DOYHN4KB.js.map} +1 -1
- package/dist/cli/{chunk-XJLZ4HKU.js → chunk-F3PXYSNN.js} +3 -2
- package/dist/cli/{chunk-XJLZ4HKU.js.map → chunk-F3PXYSNN.js.map} +1 -1
- package/dist/cli/{chunk-XHQIK7B6.js → chunk-FHOGSSCH.js} +4 -3
- package/dist/cli/{chunk-XHQIK7B6.js.map → chunk-FHOGSSCH.js.map} +1 -1
- package/dist/cli/{chunk-IYF36OCJ.js → chunk-H6PS7IUE.js} +3 -2
- package/dist/cli/{chunk-IYF36OCJ.js.map → chunk-H6PS7IUE.js.map} +1 -1
- package/dist/cli/{chunk-ZTLZO42A.js → chunk-HFEAY5DT.js} +3 -2
- package/dist/cli/{chunk-ZTLZO42A.js.map → chunk-HFEAY5DT.js.map} +1 -1
- package/dist/cli/{chunk-FWGEHRB7.js → chunk-J5XJHLWM.js} +2 -1
- package/dist/cli/{chunk-FWGEHRB7.js.map → chunk-J5XJHLWM.js.map} +1 -1
- package/dist/cli/chunk-JMBMLOBP.js +26 -0
- package/dist/cli/chunk-JMBMLOBP.js.map +1 -0
- package/dist/cli/{chunk-SZH34P45.js → chunk-O52OLQL3.js} +52 -18
- package/dist/cli/chunk-O52OLQL3.js.map +1 -0
- package/dist/cli/{chunk-4DCHFFEY.js → chunk-OSZC7C6F.js} +3 -2
- package/dist/cli/{chunk-4DCHFFEY.js.map → chunk-OSZC7C6F.js.map} +1 -1
- package/dist/cli/chunk-P7EKE5ZQ.js +60641 -0
- package/dist/cli/chunk-P7EKE5ZQ.js.map +1 -0
- package/dist/cli/{chunk-FM57FNPJ.js → chunk-PLHAZOLZ.js} +2 -1
- package/dist/cli/{chunk-FM57FNPJ.js.map → chunk-PLHAZOLZ.js.map} +1 -1
- package/dist/cli/{chunk-RFX7TYVV.js → chunk-PQXPXJBJ.js} +16 -2
- package/dist/cli/chunk-PQXPXJBJ.js.map +1 -0
- package/dist/cli/{chunk-DAEAAVDF.js → chunk-PV55UMTO.js} +2 -1
- package/dist/cli/{chunk-DAEAAVDF.js.map → chunk-PV55UMTO.js.map} +1 -1
- package/dist/cli/{chunk-H7PHYVPM.js → chunk-RE4RAVFF.js} +85 -14
- package/dist/cli/chunk-RE4RAVFF.js.map +1 -0
- package/dist/cli/chunk-S4XVGLRW.js +499 -0
- package/dist/cli/chunk-S4XVGLRW.js.map +1 -0
- package/dist/cli/{chunk-WJ3YX4PZ.js → chunk-SZ5XES2N.js} +3 -2
- package/dist/cli/{chunk-WJ3YX4PZ.js.map → chunk-SZ5XES2N.js.map} +1 -1
- package/dist/cli/{chunk-4X3NY5ZM.js → chunk-TJX6BFZZ.js} +16 -9
- package/dist/cli/{chunk-4X3NY5ZM.js.map → chunk-TJX6BFZZ.js.map} +1 -1
- package/dist/cli/chunk-TUK7OWJA.js +51 -0
- package/dist/cli/{chunk-WKOMCPXP.js → chunk-VK5HG73G.js} +26 -17
- package/dist/cli/chunk-VK5HG73G.js.map +1 -0
- package/dist/cli/{chunk-CLAN6PVH.js → chunk-XCGGEJTI.js} +21 -8
- package/dist/cli/chunk-XCGGEJTI.js.map +1 -0
- package/dist/cli/{chunk-SOZE7V7V.js → chunk-XJXDHAES.js} +3 -2
- package/dist/cli/{chunk-SOZE7V7V.js.map → chunk-XJXDHAES.js.map} +1 -1
- package/dist/cli/chunk-XPDVG52A.js +2648 -0
- package/dist/cli/chunk-XPDVG52A.js.map +1 -0
- package/dist/cli/{chunk-CRPQUBP6.js → chunk-XXC2BYTV.js} +2 -1
- package/dist/cli/{chunk-CRPQUBP6.js.map → chunk-XXC2BYTV.js.map} +1 -1
- package/dist/cli/{chunk-AVB3WZWU.js → chunk-YFGF5NKA.js} +17 -14
- package/dist/cli/{chunk-AVB3WZWU.js.map → chunk-YFGF5NKA.js.map} +1 -1
- package/dist/cli/{chunk-ORM6PK57.js → chunk-YQ6NTIIE.js} +2 -1
- package/dist/cli/{chunk-ORM6PK57.js.map → chunk-YQ6NTIIE.js.map} +1 -1
- package/dist/cli/{chunk-ULBW7DYL.js → chunk-YYQAUTTN.js} +3 -2
- package/dist/cli/{chunk-ULBW7DYL.js.map → chunk-YYQAUTTN.js.map} +1 -1
- package/dist/cli/chunk-ZZM6QJ4W.js +109 -0
- package/dist/cli/chunk-ZZM6QJ4W.js.map +1 -0
- package/dist/cli/code-SMKEW6CD.js +154 -0
- package/dist/cli/code-SMKEW6CD.js.map +1 -0
- package/dist/cli/{commands-FQZOBLLZ.js → commands-FVVB5FZF.js} +7 -5
- package/dist/cli/{commands-FQZOBLLZ.js.map → commands-FVVB5FZF.js.map} +1 -1
- package/dist/cli/{commit-ZS24SHPG.js → commit-HE4VSPZ7.js} +7 -4
- package/dist/cli/{commit-ZS24SHPG.js.map → commit-HE4VSPZ7.js.map} +1 -1
- package/dist/cli/{desktop-6OLENOOO.js → desktop-Q7NDXCON.js} +379 -72
- package/dist/cli/desktop-Q7NDXCON.js.map +1 -0
- package/dist/cli/devtools-YECO25QO.js +3719 -0
- package/dist/cli/devtools-YECO25QO.js.map +1 -0
- package/dist/cli/diff-435UTPC5.js +165 -0
- package/dist/cli/{diff-2VUKNGEI.js.map → diff-435UTPC5.js.map} +1 -1
- package/dist/cli/doctor-OT7KH75K.js +27 -0
- package/dist/cli/{events-APSVNROZ.js → events-XEFAD5VX.js} +6 -4
- package/dist/cli/{events-APSVNROZ.js.map → events-XEFAD5VX.js.map} +1 -1
- package/dist/cli/index.js +3233 -123
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/{mcp-DCKOE5RF.js → mcp-WUL2WO75.js} +6 -4
- package/dist/cli/{mcp-DCKOE5RF.js.map → mcp-WUL2WO75.js.map} +1 -1
- package/dist/cli/{mcp-browse-D6GBP5RQ.js → mcp-browse-RR7R4XET.js} +34 -19
- package/dist/cli/mcp-browse-RR7R4XET.js.map +1 -0
- package/dist/cli/{mcp-inspect-KFGFPJ3E.js → mcp-inspect-REGLYBWT.js} +9 -8
- package/dist/cli/{mcp-inspect-KFGFPJ3E.js.map → mcp-inspect-REGLYBWT.js.map} +1 -1
- package/dist/cli/package.json +3 -0
- package/dist/cli/prompt-UW6EFLVR.js +16 -0
- package/dist/cli/{prune-sessions-LV33R47N.js → prune-sessions-3RWUBYRS.js} +4 -2
- package/dist/cli/{prune-sessions-LV33R47N.js.map → prune-sessions-3RWUBYRS.js.map} +1 -1
- package/dist/cli/{replay-WFCYX7XF.js → replay-YOURXV4C.js} +42 -30
- package/dist/cli/{replay-WFCYX7XF.js.map → replay-YOURXV4C.js.map} +1 -1
- package/dist/cli/{run-IUJYEPMT.js → run-Q6BUXV66.js} +28 -27
- package/dist/cli/{run-IUJYEPMT.js.map → run-Q6BUXV66.js.map} +1 -1
- package/dist/cli/{server-CN4QPPVJ.js → server-XGDBRWMB.js} +44 -43
- package/dist/cli/server-XGDBRWMB.js.map +1 -0
- package/dist/cli/{sessions-F5GPGTJN.js → sessions-FH7QVYSY.js} +22 -19
- package/dist/cli/{sessions-F5GPGTJN.js.map → sessions-FH7QVYSY.js.map} +1 -1
- package/dist/cli/setup-VDS6SVEP.js +618 -0
- package/dist/cli/setup-VDS6SVEP.js.map +1 -0
- package/dist/cli/stats-MQVI2XQH.js +14 -0
- package/dist/cli/update-6ITLPRDV.js +15 -0
- package/dist/cli/update-6ITLPRDV.js.map +1 -0
- package/dist/cli/version-DAHGZY5N.js +33 -0
- package/dist/cli/{version-KQUPV6T5.js.map → version-DAHGZY5N.js.map} +1 -1
- package/dist/index.d.ts +157 -103
- package/dist/index.js +597 -178
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/cli/chat-G7CUW4ZI.js +0 -45
- package/dist/cli/chunk-26UDIXLD.js +0 -16481
- package/dist/cli/chunk-26UDIXLD.js.map +0 -1
- package/dist/cli/chunk-4YV2GBYG.js +0 -5237
- package/dist/cli/chunk-4YV2GBYG.js.map +0 -1
- package/dist/cli/chunk-5X7LZJDE.js +0 -36
- package/dist/cli/chunk-5X7LZJDE.js.map +0 -1
- package/dist/cli/chunk-7DLHHBGN.js.map +0 -1
- package/dist/cli/chunk-A5LSGEEK.js.map +0 -1
- package/dist/cli/chunk-AFFZF3MW.js +0 -36
- package/dist/cli/chunk-AFFZF3MW.js.map +0 -1
- package/dist/cli/chunk-CLAN6PVH.js.map +0 -1
- package/dist/cli/chunk-CPOV2O73.js +0 -39
- package/dist/cli/chunk-CPOV2O73.js.map +0 -1
- package/dist/cli/chunk-CPTZ5OHX.js +0 -18
- package/dist/cli/chunk-CPTZ5OHX.js.map +0 -1
- package/dist/cli/chunk-CZSJILQP.js +0 -854
- package/dist/cli/chunk-CZSJILQP.js.map +0 -1
- package/dist/cli/chunk-H7PHYVPM.js.map +0 -1
- package/dist/cli/chunk-HCC42PEI.js.map +0 -1
- package/dist/cli/chunk-JWCTX5S4.js +0 -46
- package/dist/cli/chunk-KMWKGPFZ.js.map +0 -1
- package/dist/cli/chunk-MRLXEMZ7.js +0 -26
- package/dist/cli/chunk-MRLXEMZ7.js.map +0 -1
- package/dist/cli/chunk-R4YTW7PR.js.map +0 -1
- package/dist/cli/chunk-RFX7TYVV.js.map +0 -1
- package/dist/cli/chunk-SZH34P45.js.map +0 -1
- package/dist/cli/chunk-UVRXTSK3.js.map +0 -1
- package/dist/cli/chunk-VLNRQMCI.js.map +0 -1
- package/dist/cli/chunk-WKOMCPXP.js.map +0 -1
- package/dist/cli/chunk-XST7BSZJ.js.map +0 -1
- package/dist/cli/code-YQGVLIT2.js +0 -147
- package/dist/cli/code-YQGVLIT2.js.map +0 -1
- package/dist/cli/desktop-6OLENOOO.js.map +0 -1
- package/dist/cli/diff-2VUKNGEI.js +0 -153
- package/dist/cli/doctor-JO2WNN6C.js +0 -24
- package/dist/cli/mcp-browse-D6GBP5RQ.js.map +0 -1
- package/dist/cli/prompt-PKCCLLAD.js +0 -13
- package/dist/cli/server-CN4QPPVJ.js.map +0 -1
- package/dist/cli/setup-WWMDBPSB.js +0 -516
- package/dist/cli/setup-WWMDBPSB.js.map +0 -1
- package/dist/cli/stats-5RJCATCE.js +0 -12
- package/dist/cli/update-GUCWB4UN.js +0 -13
- package/dist/cli/version-KQUPV6T5.js +0 -30
- /package/dist/cli/{chat-G7CUW4ZI.js.map → chat-7ES4IBNH.js.map} +0 -0
- /package/dist/cli/{doctor-JO2WNN6C.js.map → chunk-TUK7OWJA.js.map} +0 -0
- /package/dist/cli/{prompt-PKCCLLAD.js.map → doctor-OT7KH75K.js.map} +0 -0
- /package/dist/cli/{stats-5RJCATCE.js.map → prompt-UW6EFLVR.js.map} +0 -0
- /package/dist/cli/{update-GUCWB4UN.js.map → stats-MQVI2XQH.js.map} +0 -0
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cr } from 'node:module'; if (typeof globalThis.require === 'undefined') { globalThis.require = __cr(import.meta.url); }
|
|
3
|
+
import {
|
|
4
|
+
createMcpRuntime
|
|
5
|
+
} from "./chunk-3Z6IBU3D.js";
|
|
2
6
|
import {
|
|
3
7
|
buildCodeToolset
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-ULBW7DYL.js";
|
|
8
|
+
} from "./chunk-YFGF5NKA.js";
|
|
6
9
|
import {
|
|
7
10
|
Eventizer,
|
|
8
11
|
autoResolveVerdict
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-45U62RI3.js";
|
|
13
|
+
import "./chunk-H6PS7IUE.js";
|
|
14
|
+
import "./chunk-PQXPXJBJ.js";
|
|
11
15
|
import {
|
|
12
16
|
CacheFirstLoop,
|
|
13
17
|
ImmutablePrefix,
|
|
@@ -15,32 +19,42 @@ import {
|
|
|
15
19
|
listFilesWithStatsAsync,
|
|
16
20
|
parseAtQuery,
|
|
17
21
|
rankPickerCandidates
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import
|
|
22
|
+
} from "./chunk-2R4QCDOZ.js";
|
|
23
|
+
import "./chunk-F3PXYSNN.js";
|
|
24
|
+
import "./chunk-FHOGSSCH.js";
|
|
25
|
+
import {
|
|
26
|
+
parseMcpSpec
|
|
27
|
+
} from "./chunk-6AK4EY3D.js";
|
|
22
28
|
import {
|
|
29
|
+
MemoryStore,
|
|
23
30
|
codeSystemPrompt
|
|
24
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-5JJRUIPA.js";
|
|
25
32
|
import {
|
|
26
33
|
canonicalPresetName,
|
|
27
34
|
resolvePreset
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-DAEAAVDF.js";
|
|
35
|
+
} from "./chunk-2425HK6U.js";
|
|
30
36
|
import {
|
|
31
|
-
|
|
32
|
-
} from "./chunk-
|
|
37
|
+
countTokens
|
|
38
|
+
} from "./chunk-PV55UMTO.js";
|
|
39
|
+
import {
|
|
40
|
+
DeepSeekClient,
|
|
41
|
+
pickPrimaryBalance
|
|
42
|
+
} from "./chunk-2KDUS647.js";
|
|
43
|
+
import "./chunk-25T6CVUP.js";
|
|
33
44
|
import {
|
|
34
45
|
loadDotenv
|
|
35
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-2UQP6H6T.js";
|
|
47
|
+
import "./chunk-YYQAUTTN.js";
|
|
36
48
|
import {
|
|
37
49
|
pauseGate
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
50
|
+
} from "./chunk-O52OLQL3.js";
|
|
51
|
+
import {
|
|
52
|
+
SkillStore
|
|
53
|
+
} from "./chunk-2K65GZBT.js";
|
|
54
|
+
import "./chunk-PLHAZOLZ.js";
|
|
55
|
+
import "./chunk-XCGGEJTI.js";
|
|
56
|
+
import "./chunk-7O5ALB4C.js";
|
|
57
|
+
import "./chunk-S4XVGLRW.js";
|
|
44
58
|
import {
|
|
45
59
|
deleteSession,
|
|
46
60
|
listSessionsForWorkspace,
|
|
@@ -48,8 +62,8 @@ import {
|
|
|
48
62
|
loadSessionMeta,
|
|
49
63
|
patchSessionMeta,
|
|
50
64
|
timestampSuffix
|
|
51
|
-
} from "./chunk-
|
|
52
|
-
import "./chunk-
|
|
65
|
+
} from "./chunk-6PBZN4VI.js";
|
|
66
|
+
import "./chunk-RE4RAVFF.js";
|
|
53
67
|
import {
|
|
54
68
|
isPlausibleKey,
|
|
55
69
|
loadApiKey,
|
|
@@ -61,19 +75,22 @@ import {
|
|
|
61
75
|
loadRecentWorkspaces,
|
|
62
76
|
loadWorkspaceDir,
|
|
63
77
|
pushRecentWorkspace,
|
|
78
|
+
readConfig,
|
|
64
79
|
saveApiKey,
|
|
65
80
|
saveBaseUrl,
|
|
66
81
|
saveEditMode,
|
|
67
82
|
saveEditor,
|
|
68
83
|
savePreset,
|
|
69
84
|
saveReasoningEffort,
|
|
70
|
-
saveWorkspaceDir
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
import "./chunk-
|
|
85
|
+
saveWorkspaceDir,
|
|
86
|
+
writeConfig
|
|
87
|
+
} from "./chunk-XPDVG52A.js";
|
|
88
|
+
import "./chunk-HFEAY5DT.js";
|
|
89
|
+
import "./chunk-YQ6NTIIE.js";
|
|
74
90
|
import {
|
|
75
91
|
VERSION
|
|
76
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-XXC2BYTV.js";
|
|
93
|
+
import "./chunk-TUK7OWJA.js";
|
|
77
94
|
|
|
78
95
|
// src/cli/commands/desktop.ts
|
|
79
96
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -158,8 +175,9 @@ function emitSettings(tab) {
|
|
|
158
175
|
async function emitBalance(tab) {
|
|
159
176
|
if (!tab.runtime) return;
|
|
160
177
|
const bal = await tab.runtime.loop.client.getBalance().catch(() => null);
|
|
161
|
-
if (!bal
|
|
162
|
-
const primary = bal.balance_infos
|
|
178
|
+
if (!bal) return;
|
|
179
|
+
const primary = pickPrimaryBalance(bal.balance_infos);
|
|
180
|
+
if (!primary) return;
|
|
163
181
|
emit(
|
|
164
182
|
{
|
|
165
183
|
type: "$balance",
|
|
@@ -175,13 +193,95 @@ function emitSessions(tab) {
|
|
|
175
193
|
const items = listSessionsForWorkspace(tab.rootDir).map((s) => ({
|
|
176
194
|
name: s.name,
|
|
177
195
|
messageCount: s.messageCount,
|
|
178
|
-
mtime: s.mtime.toISOString()
|
|
196
|
+
mtime: s.mtime.toISOString(),
|
|
197
|
+
summary: s.meta.summary
|
|
179
198
|
}));
|
|
180
199
|
emit({ type: "$sessions", items }, tab.id);
|
|
181
200
|
} catch (err) {
|
|
182
201
|
emit({ type: "$error", message: `session_list failed: ${err.message}` }, tab.id);
|
|
183
202
|
}
|
|
184
203
|
}
|
|
204
|
+
function summarizeMcpSpec(raw) {
|
|
205
|
+
try {
|
|
206
|
+
const parsed = parseMcpSpec(raw);
|
|
207
|
+
if (parsed.transport === "stdio") {
|
|
208
|
+
const argv = [parsed.command, ...parsed.args].join(" ");
|
|
209
|
+
return {
|
|
210
|
+
raw,
|
|
211
|
+
name: parsed.name,
|
|
212
|
+
transport: "stdio",
|
|
213
|
+
summary: `stdio \xB7 ${argv}`,
|
|
214
|
+
status: "configured"
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
raw,
|
|
219
|
+
name: parsed.name,
|
|
220
|
+
transport: parsed.transport,
|
|
221
|
+
summary: `${parsed.transport} \xB7 ${parsed.url}`,
|
|
222
|
+
status: "configured"
|
|
223
|
+
};
|
|
224
|
+
} catch (err) {
|
|
225
|
+
return {
|
|
226
|
+
raw,
|
|
227
|
+
name: null,
|
|
228
|
+
transport: "stdio",
|
|
229
|
+
summary: raw,
|
|
230
|
+
parseError: err.message,
|
|
231
|
+
status: "failed",
|
|
232
|
+
statusReason: err.message
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function emitMcpSpecs(tab) {
|
|
237
|
+
const cfg = readConfig();
|
|
238
|
+
const specs = (cfg.mcp ?? []).map((raw) => {
|
|
239
|
+
const base = summarizeMcpSpec(raw);
|
|
240
|
+
const live = tab.mcpStatuses.get(raw);
|
|
241
|
+
if (!live) return base;
|
|
242
|
+
return { ...base, status: live.kind, statusReason: live.reason, toolCount: live.toolCount };
|
|
243
|
+
});
|
|
244
|
+
const bridged = specs.length > 0 && specs.every((s) => s.status === "connected");
|
|
245
|
+
emit({ type: "$mcp_specs", specs, bridged }, tab.id);
|
|
246
|
+
}
|
|
247
|
+
function emitMemory(tab) {
|
|
248
|
+
try {
|
|
249
|
+
const store = new MemoryStore({ projectRoot: tab.rootDir });
|
|
250
|
+
const entries = store.list().map((e) => ({
|
|
251
|
+
name: e.name,
|
|
252
|
+
scope: e.scope,
|
|
253
|
+
description: e.description
|
|
254
|
+
}));
|
|
255
|
+
emit({ type: "$memory", entries }, tab.id);
|
|
256
|
+
} catch (err) {
|
|
257
|
+
emit({ type: "$error", message: `memory_get failed: ${err.message}` }, tab.id);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function emitCtxBreakdown(tab) {
|
|
261
|
+
if (!tab.runtime) return;
|
|
262
|
+
try {
|
|
263
|
+
const sys = countTokens(tab.runtime.loop.prefix.system);
|
|
264
|
+
const tools = countTokens(JSON.stringify(tab.runtime.loop.prefix.toolSpecs));
|
|
265
|
+
emit({ type: "$ctx_breakdown", reservedTokens: sys + tools }, tab.id);
|
|
266
|
+
} catch {
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function emitSkills(tab) {
|
|
270
|
+
try {
|
|
271
|
+
const store = new SkillStore({ projectRoot: tab.rootDir });
|
|
272
|
+
const items = store.list().map((s) => ({
|
|
273
|
+
name: s.name,
|
|
274
|
+
description: s.description,
|
|
275
|
+
scope: s.scope,
|
|
276
|
+
path: s.path,
|
|
277
|
+
runAs: s.runAs,
|
|
278
|
+
model: s.model
|
|
279
|
+
}));
|
|
280
|
+
emit({ type: "$skills", items }, tab.id);
|
|
281
|
+
} catch (err) {
|
|
282
|
+
emit({ type: "$error", message: `skills_get failed: ${err.message}` }, tab.id);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
185
285
|
var tabCounter = 0;
|
|
186
286
|
function nextTabId() {
|
|
187
287
|
tabCounter++;
|
|
@@ -196,27 +296,35 @@ function mintSessionFor(rootDir) {
|
|
|
196
296
|
return name;
|
|
197
297
|
}
|
|
198
298
|
function buildRuntimeFor(tab) {
|
|
299
|
+
if (!tab.toolset) throw new Error("buildRuntimeFor called before initTabToolset finished");
|
|
300
|
+
const toolset = tab.toolset;
|
|
199
301
|
const client = new DeepSeekClient({ baseUrl: loadBaseUrl() });
|
|
200
|
-
const prefix = new ImmutablePrefix({ system: tab.system, toolSpecs:
|
|
302
|
+
const prefix = new ImmutablePrefix({ system: tab.system, toolSpecs: toolset.tools.specs() });
|
|
303
|
+
const reasoningEffort = loadReasoningEffort();
|
|
304
|
+
const { autoEscalate } = resolvePreset(tab.currentPreset);
|
|
201
305
|
const loop = new CacheFirstLoop({
|
|
202
306
|
client,
|
|
203
307
|
prefix,
|
|
204
|
-
tools:
|
|
308
|
+
tools: toolset.tools,
|
|
205
309
|
model: tab.currentModel,
|
|
206
310
|
budgetUsd: tab.budgetUsd,
|
|
207
|
-
session: tab.currentSession
|
|
311
|
+
session: tab.currentSession,
|
|
312
|
+
reasoningEffort,
|
|
313
|
+
autoEscalate
|
|
208
314
|
});
|
|
209
|
-
const reasoningEffort = loadReasoningEffort();
|
|
210
315
|
const eventizer = new Eventizer();
|
|
211
316
|
const ctx = { model: tab.currentModel, prefixHash: prefix.fingerprint, reasoningEffort };
|
|
212
317
|
return { loop, eventizer, ctx };
|
|
213
318
|
}
|
|
214
319
|
var TS_EXPORT_RE = /^export\s+(?:default\s+)?(?:async\s+)?(function|class|const|let|var|interface|type|enum)\s+\*?\s*(\w+)/;
|
|
320
|
+
var FILE_INDEX_TTL_MS = 1e4;
|
|
215
321
|
async function getFileIndexFor(tab) {
|
|
216
|
-
|
|
322
|
+
const fresh = tab.fileIndex && Date.now() - tab.fileIndexBuiltAt < FILE_INDEX_TTL_MS;
|
|
323
|
+
if (fresh) return tab.fileIndex;
|
|
217
324
|
if (tab.fileIndexBuilding) return tab.fileIndexBuilding;
|
|
218
325
|
tab.fileIndexBuilding = listFilesWithStatsAsync(tab.rootDir, { maxResults: 5e3 }).then((res) => {
|
|
219
326
|
tab.fileIndex = res;
|
|
327
|
+
tab.fileIndexBuiltAt = Date.now();
|
|
220
328
|
tab.fileIndexBuilding = null;
|
|
221
329
|
return res;
|
|
222
330
|
}).catch((err) => {
|
|
@@ -292,17 +400,12 @@ async function desktopCommand(opts) {
|
|
|
292
400
|
const id = tabContext.getStore();
|
|
293
401
|
return id ? tabs.get(id) : void 0;
|
|
294
402
|
}
|
|
295
|
-
|
|
403
|
+
function createTabSkeleton(initialDir) {
|
|
296
404
|
const dir = resolve(initialDir ?? opts.dir ?? loadWorkspaceDir() ?? process.cwd());
|
|
297
405
|
pushRecentWorkspace(dir);
|
|
298
406
|
const preset = canonicalPresetName(loadPreset());
|
|
299
407
|
const resolved = resolvePreset(preset);
|
|
300
408
|
const model = opts.model || resolved.model;
|
|
301
|
-
const toolset = await buildCodeToolset({ rootDir: dir });
|
|
302
|
-
const system = codeSystemPrompt(dir, {
|
|
303
|
-
hasSemanticSearch: toolset.semantic.enabled,
|
|
304
|
-
modelId: model
|
|
305
|
-
});
|
|
306
409
|
const tab = {
|
|
307
410
|
id: nextTabId(),
|
|
308
411
|
rootDir: dir,
|
|
@@ -310,33 +413,96 @@ async function desktopCommand(opts) {
|
|
|
310
413
|
currentPreset: preset,
|
|
311
414
|
currentModel: model,
|
|
312
415
|
budgetUsd: opts.budgetUsd,
|
|
313
|
-
toolset,
|
|
314
|
-
system,
|
|
416
|
+
toolset: null,
|
|
417
|
+
system: "",
|
|
315
418
|
runtime: null,
|
|
316
419
|
aborter: null,
|
|
317
420
|
fileIndex: null,
|
|
318
421
|
fileIndexBuilding: null,
|
|
422
|
+
fileIndexBuiltAt: 0,
|
|
319
423
|
symbolIndex: null,
|
|
320
424
|
symbolBuilding: null,
|
|
321
425
|
recentMentions: [],
|
|
322
426
|
pendingGateIds: /* @__PURE__ */ new Set(),
|
|
323
427
|
completedStepIds: /* @__PURE__ */ new Set(),
|
|
324
|
-
planTotalSteps: 0
|
|
428
|
+
planTotalSteps: 0,
|
|
429
|
+
mcpRuntime: null,
|
|
430
|
+
mcpStatuses: /* @__PURE__ */ new Map()
|
|
325
431
|
};
|
|
326
432
|
tab.currentSession = mintSessionFor(dir);
|
|
433
|
+
tabs.set(tab.id, tab);
|
|
434
|
+
return tab;
|
|
435
|
+
}
|
|
436
|
+
async function initTabToolset(tab) {
|
|
437
|
+
const toolset = await buildCodeToolset({ rootDir: tab.rootDir });
|
|
438
|
+
tab.toolset = toolset;
|
|
439
|
+
tab.system = codeSystemPrompt(tab.rootDir, {
|
|
440
|
+
hasSemanticSearch: toolset.semantic.enabled,
|
|
441
|
+
modelId: tab.currentModel
|
|
442
|
+
});
|
|
327
443
|
if (loadApiKey()) {
|
|
328
444
|
process.env.DEEPSEEK_API_KEY = loadApiKey();
|
|
329
445
|
tab.runtime = buildRuntimeFor(tab);
|
|
446
|
+
void bridgeTabMcp(tab);
|
|
330
447
|
}
|
|
331
|
-
|
|
332
|
-
|
|
448
|
+
}
|
|
449
|
+
function bridgeTabMcp(tab) {
|
|
450
|
+
if (!tab.runtime || !tab.toolset) return Promise.resolve();
|
|
451
|
+
if (tab.mcpRuntime) {
|
|
452
|
+
return tab.mcpRuntime.reloadFromConfig(tab.runtime.loop).then(() => emitMcpSpecs(tab)).catch((err) => {
|
|
453
|
+
emit({ type: "$error", message: `mcp reload failed: ${err.message}` }, tab.id);
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
const requested = (readConfig().mcp ?? []).length;
|
|
457
|
+
if (requested === 0) return Promise.resolve();
|
|
458
|
+
const runtime = createMcpRuntime({
|
|
459
|
+
getTools: () => {
|
|
460
|
+
if (!tab.toolset) throw new Error("toolset gone");
|
|
461
|
+
return tab.toolset.tools;
|
|
462
|
+
},
|
|
463
|
+
getMcpPrefix: () => void 0,
|
|
464
|
+
getRequestedCount: () => requested,
|
|
465
|
+
progressSink: { current: null }
|
|
466
|
+
});
|
|
467
|
+
tab.mcpRuntime = runtime;
|
|
468
|
+
runtime.setLifecycleSink((notice) => {
|
|
469
|
+
if (notice.kind === "slow") return;
|
|
470
|
+
const cfg = readConfig().mcp ?? [];
|
|
471
|
+
const target = cfg.find((raw) => {
|
|
472
|
+
try {
|
|
473
|
+
return parseMcpSpec(raw).name === notice.name;
|
|
474
|
+
} catch {
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
if (!target) return;
|
|
479
|
+
if (notice.kind === "handshake") {
|
|
480
|
+
tab.mcpStatuses.set(target, { kind: "handshake" });
|
|
481
|
+
} else if (notice.kind === "connected") {
|
|
482
|
+
tab.mcpStatuses.set(target, { kind: "connected", toolCount: notice.tools });
|
|
483
|
+
} else if (notice.kind === "failed") {
|
|
484
|
+
tab.mcpStatuses.set(target, { kind: "failed", reason: notice.reason });
|
|
485
|
+
} else if (notice.kind === "disabled") {
|
|
486
|
+
tab.mcpStatuses.set(target, { kind: "disabled" });
|
|
487
|
+
}
|
|
488
|
+
emitMcpSpecs(tab);
|
|
489
|
+
});
|
|
490
|
+
return runtime.reloadFromConfig(tab.runtime.loop).then(() => void 0).catch((err) => {
|
|
491
|
+
emit({ type: "$error", message: `mcp bridge failed: ${err.message}` }, tab.id);
|
|
492
|
+
});
|
|
333
493
|
}
|
|
334
494
|
async function closeTab(tab) {
|
|
335
495
|
tab.aborter?.abort();
|
|
336
496
|
try {
|
|
337
|
-
await tab.toolset
|
|
497
|
+
await tab.toolset?.jobs.shutdown();
|
|
338
498
|
} catch {
|
|
339
499
|
}
|
|
500
|
+
if (tab.mcpRuntime) {
|
|
501
|
+
try {
|
|
502
|
+
await tab.mcpRuntime.closeAll();
|
|
503
|
+
} catch {
|
|
504
|
+
}
|
|
505
|
+
}
|
|
340
506
|
tabs.delete(tab.id);
|
|
341
507
|
emit({ type: "$tab_closed" }, tab.id);
|
|
342
508
|
}
|
|
@@ -344,10 +510,25 @@ async function desktopCommand(opts) {
|
|
|
344
510
|
if (!tab.runtime) return;
|
|
345
511
|
const rt = tab.runtime;
|
|
346
512
|
tab.aborter = new AbortController();
|
|
513
|
+
if (tab.currentSession) {
|
|
514
|
+
const existing = loadSessionMeta(tab.currentSession).summary;
|
|
515
|
+
if (!existing || !existing.trim()) {
|
|
516
|
+
const summary = text.replace(/\s+/g, " ").trim().slice(0, 60);
|
|
517
|
+
if (summary) {
|
|
518
|
+
try {
|
|
519
|
+
patchSessionMeta(tab.currentSession, { summary });
|
|
520
|
+
} catch {
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
347
525
|
await tabContext.run(tab.id, async () => {
|
|
348
526
|
try {
|
|
349
527
|
for await (const ev of rt.loop.step(text)) {
|
|
350
528
|
for (const kev of rt.eventizer.consume(ev, rt.ctx)) emit(kev, tab.id);
|
|
529
|
+
if (ev.role === "tool" && (ev.toolName === "remember" || ev.toolName === "forget")) {
|
|
530
|
+
emitMemory(tab);
|
|
531
|
+
}
|
|
351
532
|
if (tab.aborter?.signal.aborted) break;
|
|
352
533
|
}
|
|
353
534
|
} catch (err) {
|
|
@@ -378,7 +559,7 @@ async function desktopCommand(opts) {
|
|
|
378
559
|
}
|
|
379
560
|
tab.aborter?.abort();
|
|
380
561
|
try {
|
|
381
|
-
await tab.toolset
|
|
562
|
+
await tab.toolset?.jobs.shutdown();
|
|
382
563
|
} catch {
|
|
383
564
|
}
|
|
384
565
|
tab.rootDir = target;
|
|
@@ -386,6 +567,7 @@ async function desktopCommand(opts) {
|
|
|
386
567
|
pushRecentWorkspace(target);
|
|
387
568
|
tab.fileIndex = null;
|
|
388
569
|
tab.fileIndexBuilding = null;
|
|
570
|
+
tab.fileIndexBuiltAt = 0;
|
|
389
571
|
tab.symbolIndex = null;
|
|
390
572
|
tab.symbolBuilding = null;
|
|
391
573
|
tab.recentMentions.length = 0;
|
|
@@ -398,6 +580,7 @@ async function desktopCommand(opts) {
|
|
|
398
580
|
if (tab.runtime) tab.runtime = buildRuntimeFor(tab);
|
|
399
581
|
emitSessions(tab);
|
|
400
582
|
emitSettings(tab);
|
|
583
|
+
emitSkills(tab);
|
|
401
584
|
}
|
|
402
585
|
function forgetGate(id) {
|
|
403
586
|
for (const t of tabs.values()) {
|
|
@@ -416,9 +599,9 @@ async function desktopCommand(opts) {
|
|
|
416
599
|
emit({ type: "$plan_cleared" }, tab.id);
|
|
417
600
|
}
|
|
418
601
|
}
|
|
419
|
-
const first =
|
|
602
|
+
const first = createTabSkeleton();
|
|
420
603
|
process.once("exit", () => {
|
|
421
|
-
for (const t of tabs.values()) void t.toolset
|
|
604
|
+
for (const t of tabs.values()) void t.toolset?.jobs.shutdown();
|
|
422
605
|
});
|
|
423
606
|
pauseGate.on((req) => {
|
|
424
607
|
const tab = activeRunningTab();
|
|
@@ -452,6 +635,22 @@ async function desktopCommand(opts) {
|
|
|
452
635
|
);
|
|
453
636
|
return;
|
|
454
637
|
}
|
|
638
|
+
if (req.kind === "path_access") {
|
|
639
|
+
const payload = req.payload;
|
|
640
|
+
emit(
|
|
641
|
+
{
|
|
642
|
+
type: "$path_access_required",
|
|
643
|
+
id: req.id,
|
|
644
|
+
path: payload.path,
|
|
645
|
+
intent: payload.intent,
|
|
646
|
+
toolName: payload.toolName,
|
|
647
|
+
sandboxRoot: payload.sandboxRoot,
|
|
648
|
+
allowPrefix: payload.allowPrefix
|
|
649
|
+
},
|
|
650
|
+
tabId
|
|
651
|
+
);
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
455
654
|
if (req.kind === "choice") {
|
|
456
655
|
const payload = req.payload;
|
|
457
656
|
emit(
|
|
@@ -526,13 +725,28 @@ async function desktopCommand(opts) {
|
|
|
526
725
|
);
|
|
527
726
|
return;
|
|
528
727
|
}
|
|
728
|
+
const exhaustive = req.kind;
|
|
729
|
+
process.stderr.write(
|
|
730
|
+
`[desktop] no handler for pause kind "${String(exhaustive)}" \u2014 auto-cancelling gate id=${req.id}
|
|
731
|
+
`
|
|
732
|
+
);
|
|
733
|
+
if (tab) tab.pendingGateIds.delete(req.id);
|
|
734
|
+
pauseGate.cancel(req.id);
|
|
529
735
|
});
|
|
530
736
|
emit({ type: "$tab_opened", workspaceDir: first.rootDir }, first.id);
|
|
531
|
-
if (loadApiKey()) emit({ type: "$ready" }, first.id);
|
|
532
|
-
else emit({ type: "$needs_setup", reason: "no_api_key" }, first.id);
|
|
533
737
|
emitSessions(first);
|
|
534
738
|
emitSettings(first);
|
|
739
|
+
emitMcpSpecs(first);
|
|
740
|
+
emitSkills(first);
|
|
741
|
+
emitMemory(first);
|
|
742
|
+
if (!loadApiKey()) emit({ type: "$needs_setup", reason: "no_api_key" }, first.id);
|
|
535
743
|
void emitBalance(first);
|
|
744
|
+
void initTabToolset(first).then(() => {
|
|
745
|
+
if (loadApiKey()) emit({ type: "$ready" }, first.id);
|
|
746
|
+
emitCtxBreakdown(first);
|
|
747
|
+
}).catch((err) => {
|
|
748
|
+
emit({ type: "$error", message: `init failed: ${err.message}` }, first.id);
|
|
749
|
+
});
|
|
536
750
|
const rl = createInterface({ input: stdin });
|
|
537
751
|
rl.on("line", (line) => {
|
|
538
752
|
const trimmed = line.trim();
|
|
@@ -545,19 +759,25 @@ async function desktopCommand(opts) {
|
|
|
545
759
|
return;
|
|
546
760
|
}
|
|
547
761
|
if (msg.cmd === "tab_open") {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
762
|
+
try {
|
|
763
|
+
const tab2 = createTabSkeleton(msg.workspaceDir);
|
|
764
|
+
emit({ type: "$tab_opened", workspaceDir: tab2.rootDir }, tab2.id);
|
|
765
|
+
emitSessions(tab2);
|
|
766
|
+
emitSettings(tab2);
|
|
767
|
+
emitMcpSpecs(tab2);
|
|
768
|
+
emitSkills(tab2);
|
|
769
|
+
emitMemory(tab2);
|
|
770
|
+
if (!loadApiKey()) emit({ type: "$needs_setup", reason: "no_api_key" }, tab2.id);
|
|
771
|
+
void emitBalance(tab2);
|
|
772
|
+
void initTabToolset(tab2).then(() => {
|
|
552
773
|
if (loadApiKey()) emit({ type: "$ready" }, tab2.id);
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
})();
|
|
774
|
+
emitCtxBreakdown(tab2);
|
|
775
|
+
}).catch((err) => {
|
|
776
|
+
emit({ type: "$error", message: `init failed: ${err.message}` }, tab2.id);
|
|
777
|
+
});
|
|
778
|
+
} catch (err) {
|
|
779
|
+
emit({ type: "$error", message: `tab_open failed: ${err.message}` });
|
|
780
|
+
}
|
|
561
781
|
return;
|
|
562
782
|
}
|
|
563
783
|
if (msg.cmd === "confirm_response") {
|
|
@@ -608,6 +828,11 @@ async function desktopCommand(opts) {
|
|
|
608
828
|
saveApiKey(key);
|
|
609
829
|
process.env.DEEPSEEK_API_KEY = key;
|
|
610
830
|
for (const tab2 of tabs.values()) {
|
|
831
|
+
if (!tab2.toolset) {
|
|
832
|
+
emitSettings(tab2);
|
|
833
|
+
void emitBalance(tab2);
|
|
834
|
+
continue;
|
|
835
|
+
}
|
|
611
836
|
tab2.runtime = buildRuntimeFor(tab2);
|
|
612
837
|
emit({ type: "$ready" }, tab2.id);
|
|
613
838
|
emitSettings(tab2);
|
|
@@ -632,6 +857,86 @@ async function desktopCommand(opts) {
|
|
|
632
857
|
void closeTab(tab);
|
|
633
858
|
return;
|
|
634
859
|
}
|
|
860
|
+
if (msg.cmd === "mcp_specs_get") {
|
|
861
|
+
emitMcpSpecs(tab);
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
if (msg.cmd === "mcp_specs_add") {
|
|
865
|
+
const spec = msg.spec.trim();
|
|
866
|
+
if (!spec) {
|
|
867
|
+
emit({ type: "$error", message: "mcp_specs_add: spec is empty" }, tab.id);
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
try {
|
|
871
|
+
parseMcpSpec(spec);
|
|
872
|
+
} catch (err) {
|
|
873
|
+
emit({ type: "$error", message: `mcp_specs_add: ${err.message}` }, tab.id);
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
try {
|
|
877
|
+
const cfg = readConfig();
|
|
878
|
+
const list = cfg.mcp ?? [];
|
|
879
|
+
if (!list.includes(spec)) {
|
|
880
|
+
cfg.mcp = [...list, spec];
|
|
881
|
+
writeConfig(cfg);
|
|
882
|
+
}
|
|
883
|
+
emitMcpSpecs(tab);
|
|
884
|
+
void bridgeTabMcp(tab);
|
|
885
|
+
} catch (err) {
|
|
886
|
+
emit({ type: "$error", message: `mcp_specs_add: ${err.message}` }, tab.id);
|
|
887
|
+
}
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
if (msg.cmd === "mcp_specs_remove") {
|
|
891
|
+
try {
|
|
892
|
+
const cfg = readConfig();
|
|
893
|
+
const list = cfg.mcp ?? [];
|
|
894
|
+
if (list.includes(msg.spec)) {
|
|
895
|
+
cfg.mcp = list.filter((s) => s !== msg.spec);
|
|
896
|
+
writeConfig(cfg);
|
|
897
|
+
}
|
|
898
|
+
tab.mcpStatuses.delete(msg.spec);
|
|
899
|
+
emitMcpSpecs(tab);
|
|
900
|
+
void bridgeTabMcp(tab);
|
|
901
|
+
} catch (err) {
|
|
902
|
+
emit({ type: "$error", message: `mcp_specs_remove: ${err.message}` }, tab.id);
|
|
903
|
+
}
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
906
|
+
if (msg.cmd === "skills_get") {
|
|
907
|
+
emitSkills(tab);
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
if (msg.cmd === "skill_run") {
|
|
911
|
+
if (!tab.runtime) {
|
|
912
|
+
emit(
|
|
913
|
+
{ type: "$error", message: "Not configured yet \u2014 paste your DeepSeek API key first." },
|
|
914
|
+
tab.id
|
|
915
|
+
);
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
try {
|
|
919
|
+
const store = new SkillStore({ projectRoot: tab.rootDir });
|
|
920
|
+
const found = store.read(msg.name);
|
|
921
|
+
if (!found) {
|
|
922
|
+
emit({ type: "$error", message: `skill not found: ${msg.name}` }, tab.id);
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
const extra = msg.args?.trim() ?? "";
|
|
926
|
+
const header = `# Skill: ${found.name}${found.description ? `
|
|
927
|
+
> ${found.description}` : ""}`;
|
|
928
|
+
const argsLine = extra ? `
|
|
929
|
+
|
|
930
|
+
Arguments: ${extra}` : "";
|
|
931
|
+
const payload = `${header}
|
|
932
|
+
|
|
933
|
+
${found.body}${argsLine}`;
|
|
934
|
+
void runTurn(tab, payload);
|
|
935
|
+
} catch (err) {
|
|
936
|
+
emit({ type: "$error", message: `skill_run: ${err.message}` }, tab.id);
|
|
937
|
+
}
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
635
940
|
if (msg.cmd === "session_list") {
|
|
636
941
|
emitSessions(tab);
|
|
637
942
|
return;
|
|
@@ -701,12 +1006,13 @@ async function desktopCommand(opts) {
|
|
|
701
1006
|
const resolved = resolvePreset(tab.currentPreset);
|
|
702
1007
|
tab.currentModel = resolved.model;
|
|
703
1008
|
savePreset(tab.currentPreset);
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
1009
|
+
if (tab.toolset) {
|
|
1010
|
+
tab.system = codeSystemPrompt(tab.rootDir, {
|
|
1011
|
+
hasSemanticSearch: tab.toolset.semantic.enabled,
|
|
1012
|
+
modelId: tab.currentModel
|
|
1013
|
+
});
|
|
1014
|
+
if (tab.runtime) tab.runtime = buildRuntimeFor(tab);
|
|
1015
|
+
}
|
|
710
1016
|
}
|
|
711
1017
|
emitSettings(tab);
|
|
712
1018
|
} catch (err) {
|
|
@@ -721,7 +1027,8 @@ async function desktopCommand(opts) {
|
|
|
721
1027
|
const nonce = msg.nonce;
|
|
722
1028
|
const query = msg.query;
|
|
723
1029
|
const parsed = parseAtQuery(query);
|
|
724
|
-
|
|
1030
|
+
const treeWalk = parsed.trailingSlash || query.length === 0;
|
|
1031
|
+
if (treeWalk) {
|
|
725
1032
|
void listDirectory(tab.rootDir, parsed.dir).then((entries) => {
|
|
726
1033
|
const results = entries.map((e) => e.isDir ? `${e.path}/` : e.path);
|
|
727
1034
|
emit({ type: "$mention_results", nonce, query, results }, tab.id);
|
|
@@ -804,4 +1111,4 @@ async function desktopCommand(opts) {
|
|
|
804
1111
|
export {
|
|
805
1112
|
desktopCommand
|
|
806
1113
|
};
|
|
807
|
-
//# sourceMappingURL=desktop-
|
|
1114
|
+
//# sourceMappingURL=desktop-Q7NDXCON.js.map
|