pi-web-ui 0.118.0 → 0.120.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/CHANGELOG.md +143 -1
- package/bin/hub-upgrade.mjs +33 -15
- package/bin/lib/atomic-file.mjs +90 -0
- package/dist/server/agent-service-daemon.js +44 -10
- package/dist/server/agent-service.js +930 -166
- package/dist/server/approval-default-rules.js +4 -4
- package/dist/server/ask-user-question-tool.js +3 -40
- package/dist/server/atomic-file.js +130 -5
- package/dist/server/background-executors.js +235 -0
- package/dist/server/bash-timeout.js +47 -0
- package/dist/server/bash-tool.js +72 -5
- package/dist/server/bg-servers.js +19 -13
- package/dist/server/browser-page-tool.js +38 -29
- package/dist/server/browser-script-tool.js +119 -0
- package/dist/server/canvas/canvas-agent-tool.js +46 -35
- package/dist/server/canvas/canvas-dispatch.js +12 -1
- package/dist/server/claim-files-tool.js +6 -7
- package/dist/server/client-state.js +457 -41
- package/dist/server/communicate-tool.js +59 -77
- package/dist/server/compact-context-tool.js +4 -13
- package/dist/server/conversation-communication.js +23 -1
- package/dist/server/conversation-read-tool.js +14 -23
- package/dist/server/conversation-rows.js +17 -0
- package/dist/server/conversation-tool-names.js +2 -2
- package/dist/server/conversation-tool.js +23 -15
- package/dist/server/conversation-touches.js +1 -1
- package/dist/server/delegate-mode.js +0 -1
- package/dist/server/delegate-task.js +18 -39
- package/dist/server/device-center/approval-summary.js +0 -1
- package/dist/server/device-center/bot-execution.js +0 -1
- package/dist/server/device-center/group-router-runtime.js +2 -0
- package/dist/server/device-center/hub-upgrade.js +5 -10
- package/dist/server/device-center/task-progress.js +2 -2
- package/dist/server/dispatch-domain-handlers.js +97 -24
- package/dist/server/dispatch-plugin-handlers.js +10 -0
- package/dist/server/dsh/dsh-agent-service.js +21 -19
- package/dist/server/durable/durable-agent-service.js +1 -1
- package/dist/server/edit-tool.js +293 -0
- package/dist/server/engine-catalog.js +8 -2
- package/dist/server/engine-cli.js +29 -7
- package/dist/server/engine-probe.js +11 -6
- package/dist/server/eval-tool.js +5 -19
- package/dist/server/files-service.js +41 -19
- package/dist/server/fs-copy.js +93 -0
- package/dist/server/goal-review-gate.js +2 -3
- package/dist/server/index.js +92 -3
- package/dist/server/job-runner.js +345 -0
- package/dist/server/lsp-tool.js +10 -28
- package/dist/server/marker-service.js +42 -30
- package/dist/server/mcp-agent-tool.js +22 -47
- package/dist/server/model-session.js +16 -0
- package/dist/server/native-cli-session-hooks.js +3 -2
- package/dist/server/native-cli-session.js +27 -2
- package/dist/server/patch-tool.js +2 -8
- package/dist/server/phone-tool.js +167 -0
- package/dist/server/plan-mode.js +7 -4
- package/dist/server/plan-update-tool.js +5 -8
- package/dist/server/plugin-api-catalog.js +13 -1
- package/dist/server/plugin-bundled.js +35 -28
- package/dist/server/plugin-catalog.js +6 -0
- package/dist/server/plugin-delivery.js +358 -0
- package/dist/server/plugin-inbox.js +152 -0
- package/dist/server/plugin-installer.js +15 -0
- package/dist/server/plugin-ledger.js +183 -0
- package/dist/server/plugin-manifest-validate.js +19 -0
- package/dist/server/plugin-materialize.js +161 -0
- package/dist/server/plugin-paths.js +60 -0
- package/dist/server/plugin-removal.js +16 -3
- package/dist/server/plugin-schedule.js +8 -7
- package/dist/server/plugin-secrets.js +7 -3
- package/dist/server/plugin-updater.js +2 -4
- package/dist/server/plugins.js +205 -48
- package/dist/server/present-files-tool.js +7 -13
- package/dist/server/preset-fields.js +23 -12
- package/dist/server/preset-share.js +1 -1
- package/dist/server/process-utils.js +11 -0
- package/dist/server/project-scripts.js +38 -0
- package/dist/server/prompt-composer.js +40 -21
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/question-params.js +98 -0
- package/dist/server/quick-ask-settings.js +0 -1
- package/dist/server/quick-ask.js +3 -0
- package/dist/server/read-tool.js +10 -17
- package/dist/server/remote-ssh-service.js +40 -1
- package/dist/server/sandbox-runtime-gate.js +1 -1
- package/dist/server/sandbox-service.js +0 -1
- package/dist/server/sandbox-tool.js +25 -34
- package/dist/server/schedule-agent-tool.js +9 -19
- package/dist/server/scm-commitmsg.js +2 -1
- package/dist/server/serialize.js +8 -0
- package/dist/server/session-list-index.js +246 -0
- package/dist/server/session-list-scan.js +5 -0
- package/dist/server/session-parser.js +16 -0
- package/dist/server/settings-service.js +49 -19
- package/dist/server/skill-tool.js +4 -6
- package/dist/server/subagent-budget.js +68 -0
- package/dist/server/subagent-evidence.js +297 -0
- package/dist/server/subagent-helpers.js +12 -0
- package/dist/server/subagent-ledger.js +401 -0
- package/dist/server/subagent-notify.js +6 -2
- package/dist/server/subagent-security-gate.js +2 -3
- package/dist/server/subagent-settle.js +71 -0
- package/dist/server/subagents.js +566 -211
- package/dist/server/tabs.js +8 -1
- package/dist/server/terminals.js +34 -28
- package/dist/server/tool-approval.js +15 -1
- package/dist/server/tool-guards.js +0 -91
- package/dist/server/tool-manager.js +127 -47
- package/dist/server/tool-overrides.js +8 -1
- package/dist/server/tool-prompt-overrides.js +3 -6
- package/dist/server/tool-prompts.js +60 -17
- package/dist/server/universal/driver-base.js +2 -0
- package/dist/server/universal/drivers/claude-code.js +210 -211
- package/dist/server/universal/drivers/codex.js +29 -24
- package/dist/server/universal/engine-mcp.js +107 -0
- package/dist/server/universal/universal-attachments.js +77 -1
- package/dist/server/universal/universal-service.js +1 -1
- package/dist/server/universal/universal-session.js +106 -69
- package/dist/server/vision-bridge.js +2 -0
- package/dist/server/workspace-handle.js +119 -17
- package/dist/server/workspace-queue.js +37 -0
- package/dist/server/worktree-tool.js +13 -20
- package/docs/README.md +40 -36
- package/docs/architecture-plugins.md +64 -35
- package/docs/device-center.md +1 -1
- package/package.json +16 -4
- package/plugin-sdk/index.d.ts +102 -0
- package/plugins/catalog.json +23 -51
- package/themes/bases/flow-base.css +8 -17
- package/themes/dark-teal.css +0 -3
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/BgTasksModal-BdOJ19Hj.js +1 -0
- package/web/dist/assets/BgTasksModal-SAH2XCkY.js +1 -0
- package/web/dist/assets/{CanvasStudio-CAWcs9tm.js → CanvasStudio-BB_Iq7pl.js} +3 -3
- package/web/dist/assets/CanvasStudio-DU6O3N4u.js +1579 -0
- package/web/dist/assets/DeviceCenter-By1zVTSY.js +3 -0
- package/web/dist/assets/DeviceCenter-Cnm0Tjrx.js +3 -0
- package/web/dist/assets/DeviceExecutionSettings-qJzbI0Cf.js +1 -0
- package/web/dist/assets/{DeviceGroups-C_fZMNeK.js → DeviceGroups-DPrQxW6B.js} +1 -1
- package/web/dist/assets/DeviceGroups-DoucyUjI.js +1 -0
- package/web/dist/assets/{Dropdown-CTgVLUbp.js → Dropdown-kj_NIj6e.js} +1 -1
- package/web/dist/assets/FilePreview-Bub8Y9uq.js +2 -0
- package/web/dist/assets/FilePreview-CC76Z6an.js +2 -0
- package/web/dist/assets/GlobalSearchModal-01nkgw4X.js +1 -0
- package/web/dist/assets/GlobalSearchModal-CiT6wBmR.js +1 -0
- package/web/dist/assets/GroupConversation-1-lsPO1f.js +61 -0
- package/web/dist/assets/GroupConversation-HeiyW_O_.js +61 -0
- package/web/dist/assets/{GroupWorkItems-BIvZtr10.js → GroupWorkItems-BYJv2XFj.js} +1 -1
- package/web/dist/assets/{HintTip-Da6qc566.js → HintTip-DFhoclDw.js} +1 -1
- package/web/dist/assets/ModelConfigModal-D2Ro-jUZ.js +2 -0
- package/web/dist/assets/ModelConfigModal-DPc9R1pq.js +2 -0
- package/web/dist/assets/{NativeCliPanel-CU1rZmyu.js → NativeCliPanel-B108d697.js} +3 -3
- package/web/dist/assets/NativeCliPanel-DupvGwQM.js +5 -0
- package/web/dist/assets/{PiSetupModal-DZKY5Wiw.js → PiSetupModal-D0HitBfd.js} +1 -1
- package/web/dist/assets/ProviderOAuthControls-BLKUEDde.js +1 -0
- package/web/dist/assets/SCMPanel-DDbWrUHR.js +2 -0
- package/web/dist/assets/SCMPanel-DluNcd2-.js +2 -0
- package/web/dist/assets/SettingsModal-Cy5lRC97.css +1 -0
- package/web/dist/assets/SettingsModal-DQu18366.js +33 -0
- package/web/dist/assets/SettingsModal-Dm_haPme.js +33 -0
- package/web/dist/assets/{TermXterm-Bt5WKAxP.js → TermXterm-SYc-MUk2.js} +2 -2
- package/web/dist/assets/TerminalPanel-CgA_lhVT.js +1 -0
- package/web/dist/assets/TerminalPanel-vdSIOPjD.js +1 -0
- package/web/dist/assets/TuiOverlayModal-Cy1jYYIw.js +1 -0
- package/web/dist/assets/TuiOverlayModal-kXY_4hV8.js +1 -0
- package/web/dist/assets/app-globals-CBEscsYP.js +129 -0
- package/web/dist/assets/{canvas-client-WkhM55mR.js → canvas-client-Clsypfs6.js} +1 -1
- package/web/dist/assets/{desktop-B8NZ3KW-.js → desktop-C6D9a8HZ.js} +1 -1
- package/web/dist/assets/index-BD29OL9L.js +404 -0
- package/web/dist/assets/index-BlCxbqqr.js +404 -0
- package/web/dist/assets/index-DB55rbKC.css +1 -0
- package/web/dist/assets/plugin-host-VWBcq-LQ.js +1 -0
- package/web/dist/assets/remote-ssh-client-C2eab5Kw.js +1 -0
- package/web/dist/assets/theme-CpQk_Agp.js +1 -0
- package/web/dist/index.html +10 -10
- package/web/dist/sw.js +1 -1
- package/dist/server/edit-soft-tool.js +0 -297
- package/web/dist/assets/BgTasksModal-D-x7kA63.js +0 -1
- package/web/dist/assets/DeviceCenter-Dc0whRcu.js +0 -3
- package/web/dist/assets/DeviceExecutionSettings-BoX7-0h7.js +0 -1
- package/web/dist/assets/FilePreview-C6W0PvaK.js +0 -2
- package/web/dist/assets/GlobalSearchModal-HR9LSspC.js +0 -1
- package/web/dist/assets/GroupConversation-C81YjF2C.js +0 -61
- package/web/dist/assets/ModelConfigModal-DhSyuIuV.js +0 -2
- package/web/dist/assets/ProviderOAuthControls-CIL85nA7.js +0 -1
- package/web/dist/assets/SCMPanel-CuEgzAlO.js +0 -2
- package/web/dist/assets/SettingsModal-Cdu5h29p.js +0 -33
- package/web/dist/assets/TerminalPanel-BCIBV8se.js +0 -1
- package/web/dist/assets/TuiOverlayModal-3NDd9T97.js +0 -1
- package/web/dist/assets/app-globals-CZjFtI4F.js +0 -129
- package/web/dist/assets/index-CQc3VrWa.css +0 -1
- package/web/dist/assets/index-D_AGu4Zv.js +0 -404
- package/web/dist/assets/plugin-host-uqZGpvCs.js +0 -1
- package/web/dist/assets/remote-ssh-client-Cdf-cTUe.js +0 -1
- package/web/dist/assets/theme-DGL7hLUs.js +0 -1
|
@@ -3,6 +3,7 @@ import { getGlobalRemoteSshService, isRemoteWorkspaceUri } from "./remote-ssh-se
|
|
|
3
3
|
import { prepareRemoteNativeCliPaste } from "./native-cli-remote-files.js";
|
|
4
4
|
import { remoteNativeCliCleanupQueue } from "./native-cli-remote-cleanup.js";
|
|
5
5
|
import { normalizePathKey } from "./client-state.js";
|
|
6
|
+
import { runWorkspaceCommand } from "./workspace-queue.js";
|
|
6
7
|
import { prepareNativeCliPaste } from "./native-cli.js";
|
|
7
8
|
export function handleFileMessage(msg, cs) {
|
|
8
9
|
switch (msg.type) {
|
|
@@ -10,7 +11,7 @@ export function handleFileMessage(msg, cs) {
|
|
|
10
11
|
void cs.listFiles(msg.path);
|
|
11
12
|
return true;
|
|
12
13
|
case "search_files":
|
|
13
|
-
void cs.searchFiles(msg.query, msg.reqId);
|
|
14
|
+
void cs.searchFiles(msg.query, msg.reqId, msg.scope);
|
|
14
15
|
return true;
|
|
15
16
|
case "read_file":
|
|
16
17
|
void cs.readFile(msg.path);
|
|
@@ -43,17 +44,30 @@ export function handleFileMessage(msg, cs) {
|
|
|
43
44
|
void cs.completePath(msg.path);
|
|
44
45
|
return true;
|
|
45
46
|
case "make_dir":
|
|
46
|
-
|
|
47
|
+
// 新建目录并设为工作区 = 一次工作区绑定,入队保持与后续建会话/切会话的先后顺序。
|
|
48
|
+
if (msg.setAsCwd === true) {
|
|
49
|
+
void runWorkspaceCommand(cs, async () => {
|
|
50
|
+
try {
|
|
51
|
+
await cs.makeDir(msg.path, true);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
cs.emitNotice("error", `创建目录失败:${err.message}`, `Failed to create directory: ${err.message}`);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
else
|
|
59
|
+
void cs.makeDir(msg.path, false);
|
|
47
60
|
return true;
|
|
48
61
|
case "set_cwd":
|
|
49
|
-
|
|
62
|
+
// 入队(见 workspace-queue):后续工作区命令(建会话 / 切会话)会等它落定,不会拿旧 cwd 开工。
|
|
63
|
+
void runWorkspaceCommand(cs, async () => {
|
|
50
64
|
try {
|
|
51
65
|
await cs.setCwd(msg.path);
|
|
52
66
|
}
|
|
53
67
|
catch (err) {
|
|
54
68
|
cs.emitNotice("error", `切换工作目录失败:${err.message}`, `Failed to switch workspace: ${err.message}`);
|
|
55
69
|
}
|
|
56
|
-
})
|
|
70
|
+
});
|
|
57
71
|
return true;
|
|
58
72
|
case "set_workspace_roots":
|
|
59
73
|
void (async () => {
|
|
@@ -66,7 +80,8 @@ export function handleFileMessage(msg, cs) {
|
|
|
66
80
|
})();
|
|
67
81
|
return true;
|
|
68
82
|
case "create_sandbox":
|
|
69
|
-
|
|
83
|
+
// 沙盒创建末尾会 setCwd(工作区换到沙盒里),所以它在队列里占位,后续建会话排在它之后。
|
|
84
|
+
void runWorkspaceCommand(cs, async () => {
|
|
70
85
|
try {
|
|
71
86
|
await cs.createSandbox?.({
|
|
72
87
|
name: msg.name,
|
|
@@ -77,16 +92,16 @@ export function handleFileMessage(msg, cs) {
|
|
|
77
92
|
catch (err) {
|
|
78
93
|
cs.emitNotice("error", `创建沙盒失败:${err.message}`, `Failed to create sandbox: ${err.message}`);
|
|
79
94
|
}
|
|
80
|
-
})
|
|
95
|
+
});
|
|
81
96
|
return true;
|
|
82
97
|
case "reset_sandbox":
|
|
83
|
-
void cs.resetSandbox?.(msg.path);
|
|
98
|
+
void runWorkspaceCommand(cs, () => cs.resetSandbox?.(msg.path));
|
|
84
99
|
return true;
|
|
85
100
|
case "persist_sandbox":
|
|
86
|
-
void cs.persistSandbox?.(msg.path);
|
|
101
|
+
void runWorkspaceCommand(cs, () => cs.persistSandbox?.(msg.path));
|
|
87
102
|
return true;
|
|
88
103
|
case "promote_sandbox":
|
|
89
|
-
void cs.promoteSandbox?.(msg.targetPath, msg.path, msg.switchToTarget);
|
|
104
|
+
void runWorkspaceCommand(cs, () => cs.promoteSandbox?.(msg.targetPath, msg.path, msg.switchToTarget));
|
|
90
105
|
return true;
|
|
91
106
|
case "diff_sandbox":
|
|
92
107
|
void cs.diffSandbox?.(msg.path, msg.requestId);
|
|
@@ -153,6 +168,15 @@ export function handleBgServerMessage(msg, cs) {
|
|
|
153
168
|
case "list_bg_servers":
|
|
154
169
|
void cs.listBgServers();
|
|
155
170
|
return true;
|
|
171
|
+
case "project_scripts":
|
|
172
|
+
cs.listProjectScripts?.(msg.cwd);
|
|
173
|
+
return true;
|
|
174
|
+
case "start_bg_script":
|
|
175
|
+
cs.startBgScript?.(msg.script, msg.cwd);
|
|
176
|
+
return true;
|
|
177
|
+
case "restart_bg_job":
|
|
178
|
+
cs.restartBgJob?.(msg.taskId);
|
|
179
|
+
return true;
|
|
156
180
|
case "set_bg_keep":
|
|
157
181
|
cs.setBackgroundKeep(msg.port, msg.keep);
|
|
158
182
|
return true;
|
|
@@ -583,12 +607,34 @@ export function handleSessionLifecycleMessage(msg, cs, send, daemon, clientId) {
|
|
|
583
607
|
acknowledge();
|
|
584
608
|
return true;
|
|
585
609
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
610
|
+
// 工作区绑定一律入队(顺序 = 到达顺序):先切目录再建会话、或 client 直接声明 cwd,
|
|
611
|
+
// 都保证 newChat() 读到的是目标工作区。声明了 cwd 却切不过去就不建会话(#872)。
|
|
612
|
+
void runWorkspaceCommand(cs, async () => {
|
|
613
|
+
if (msg.type === "new_chat") {
|
|
614
|
+
const target = (msg.cwd ?? "").trim();
|
|
615
|
+
if (target && normalizePathKey(target) !== normalizePathKey(cs.cwd)) {
|
|
616
|
+
try {
|
|
617
|
+
await cs.setCwd(target);
|
|
618
|
+
}
|
|
619
|
+
catch {
|
|
620
|
+
// 失败由下面的核验统一报:能切就是好,切不过去就不建会话、给出回执
|
|
621
|
+
}
|
|
622
|
+
if (normalizePathKey(target) !== normalizePathKey(cs.cwd)) {
|
|
623
|
+
send?.({
|
|
624
|
+
type: "notice",
|
|
625
|
+
level: "error",
|
|
626
|
+
text: `新建对话失败:没能切换到工作目录 ${target}`,
|
|
627
|
+
textEn: `Failed to create chat: could not switch the workspace to ${target}`,
|
|
628
|
+
});
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
const pending = msg.type === "new_cli_chat"
|
|
634
|
+
? cs.newCliChat?.(msg.config, msg.cwd, acknowledge)
|
|
635
|
+
: cs.newChat(msg.preset, msg.ephemeral, acknowledge, msg.independent);
|
|
636
|
+
await Promise.resolve(pending);
|
|
637
|
+
}).then(() => acknowledge(), () => acknowledge());
|
|
592
638
|
return true;
|
|
593
639
|
}
|
|
594
640
|
case "delete_message":
|
|
@@ -606,10 +652,10 @@ export function handleSessionLifecycleMessage(msg, cs, send, daemon, clientId) {
|
|
|
606
652
|
void cs.editMessage(msg.messageId, msg.text, msg.attachments);
|
|
607
653
|
return true;
|
|
608
654
|
case "fork_session":
|
|
609
|
-
void cs.forkSession?.(msg.messageId, msg.position, msg.conversationId);
|
|
655
|
+
void runWorkspaceCommand(cs, () => cs.forkSession?.(msg.messageId, msg.position, msg.conversationId));
|
|
610
656
|
return true;
|
|
611
657
|
case "rollback_session":
|
|
612
|
-
void cs.rollbackSession?.(msg.messageId, msg.conversationId, msg.restoreWorkspace);
|
|
658
|
+
void runWorkspaceCommand(cs, () => cs.rollbackSession?.(msg.messageId, msg.conversationId, msg.restoreWorkspace));
|
|
613
659
|
return true;
|
|
614
660
|
case "list_sessions":
|
|
615
661
|
if (typeof msg.limit === "number")
|
|
@@ -657,10 +703,10 @@ export function handleSessionLifecycleMessage(msg, cs, send, daemon, clientId) {
|
|
|
657
703
|
void cs.dismissFinishedSubagents(msg.parentId);
|
|
658
704
|
return true;
|
|
659
705
|
case "switch_session":
|
|
660
|
-
void cs.switchSession(msg.path, msg.sessionId, msg.independent);
|
|
706
|
+
void runWorkspaceCommand(cs, () => cs.switchSession(msg.path, msg.sessionId, msg.independent));
|
|
661
707
|
return true;
|
|
662
708
|
case "switch_conversation":
|
|
663
|
-
void cs.switchConversation(msg.id);
|
|
709
|
+
void runWorkspaceCommand(cs, () => cs.switchConversation(msg.id));
|
|
664
710
|
return true;
|
|
665
711
|
case "search_sessions":
|
|
666
712
|
void cs.searchSessions(msg.query, msg.reqId);
|
|
@@ -807,8 +853,9 @@ export function handleSettingsMessage(msg, cs, send) {
|
|
|
807
853
|
case "get_settings":
|
|
808
854
|
cs.refreshSettings();
|
|
809
855
|
return true;
|
|
810
|
-
case "set_settings":
|
|
811
|
-
|
|
856
|
+
case "set_settings": {
|
|
857
|
+
// 同步抛错与 Promise 拒绝都要回告前端;实现可能是同步 mock(返回 undefined)
|
|
858
|
+
const saving = cs.setSettings({
|
|
812
859
|
promptMode: msg.promptMode,
|
|
813
860
|
customSystemPrompt: msg.customSystemPrompt,
|
|
814
861
|
promptTemplate: msg.promptTemplate,
|
|
@@ -818,6 +865,7 @@ export function handleSettingsMessage(msg, cs, send) {
|
|
|
818
865
|
disabledSkills: msg.disabledSkills,
|
|
819
866
|
disabledExtensions: msg.disabledExtensions,
|
|
820
867
|
disabledAgentTools: msg.disabledAgentTools,
|
|
868
|
+
toolOnDemandTools: msg.toolOnDemandTools,
|
|
821
869
|
disabledPluginTools: msg.disabledPluginTools,
|
|
822
870
|
disabledPlugins: msg.disabledPlugins,
|
|
823
871
|
terminalToolsEnabled: msg.terminalToolsEnabled,
|
|
@@ -830,7 +878,6 @@ export function handleSettingsMessage(msg, cs, send) {
|
|
|
830
878
|
bgAutoCleanupMin: msg.bgAutoCleanupMin,
|
|
831
879
|
toolLazyLoading: msg.toolLazyLoading,
|
|
832
880
|
toolApprovalEnabled: msg.toolApprovalEnabled,
|
|
833
|
-
editSoftEnabled: msg.editSoftEnabled,
|
|
834
881
|
questionnaireEnabled: msg.questionnaireEnabled,
|
|
835
882
|
questionPresentation: msg.questionPresentation,
|
|
836
883
|
toolApprovalPresentation: msg.toolApprovalPresentation,
|
|
@@ -868,7 +915,6 @@ export function handleSettingsMessage(msg, cs, send) {
|
|
|
868
915
|
quickAskTranslateTarget: msg.quickAskTranslateTarget,
|
|
869
916
|
quickAskTranslateStyle: msg.quickAskTranslateStyle,
|
|
870
917
|
quickAskTranslatePrompt: msg.quickAskTranslatePrompt,
|
|
871
|
-
quickAskShowOriginal: msg.quickAskShowOriginal,
|
|
872
918
|
quickAskReferenceMenus: msg.quickAskReferenceMenus,
|
|
873
919
|
quickAskConversationScope: msg.quickAskConversationScope,
|
|
874
920
|
quickAskFolderScope: msg.quickAskFolderScope,
|
|
@@ -881,7 +927,6 @@ export function handleSettingsMessage(msg, cs, send) {
|
|
|
881
927
|
autoCompactionInstructions: msg.autoCompactionInstructions,
|
|
882
928
|
reviewPrompt: msg.reviewPrompt,
|
|
883
929
|
reviewDisabledSkills: msg.reviewDisabledSkills,
|
|
884
|
-
markersEnabled: msg.markersEnabled,
|
|
885
930
|
disabledMarkers: msg.disabledMarkers,
|
|
886
931
|
quickPhrases: msg.quickPhrases,
|
|
887
932
|
quickPhrasesEnabled: msg.quickPhrasesEnabled,
|
|
@@ -891,7 +936,17 @@ export function handleSettingsMessage(msg, cs, send) {
|
|
|
891
936
|
quickPhrasesSeeded: msg.quickPhrasesSeeded,
|
|
892
937
|
uiLayout: msg.uiLayout,
|
|
893
938
|
});
|
|
939
|
+
void Promise.resolve(saving).catch((error) => {
|
|
940
|
+
// 保存失败必须回告前端:否则面板只能靠超时猜,用户永远不知道改没生效
|
|
941
|
+
send?.({
|
|
942
|
+
type: "notice",
|
|
943
|
+
level: "error",
|
|
944
|
+
text: `设置保存失败,修改未生效:${error instanceof Error ? error.message : String(error)}`,
|
|
945
|
+
textEn: `Settings were not saved: ${error instanceof Error ? error.message : String(error)}`,
|
|
946
|
+
});
|
|
947
|
+
});
|
|
894
948
|
return true;
|
|
949
|
+
}
|
|
895
950
|
case "extensions_reload":
|
|
896
951
|
void cs.reloadExtensions();
|
|
897
952
|
return true;
|
|
@@ -994,6 +1049,9 @@ export function handleInteractiveResponseMessage(msg, cs, service, clientId, sen
|
|
|
994
1049
|
case "page_response":
|
|
995
1050
|
cs.resolvePageCall?.(msg.id, msg.ok, msg.result, msg.error);
|
|
996
1051
|
return true;
|
|
1052
|
+
case "phone_response":
|
|
1053
|
+
cs.resolvePhoneCall?.(msg.id, msg.ok, msg.result, msg.error);
|
|
1054
|
+
return true;
|
|
997
1055
|
default:
|
|
998
1056
|
return false;
|
|
999
1057
|
}
|
|
@@ -1010,6 +1068,21 @@ export function handleRemoteSshMessage(msg, remoteSshSvc, send) {
|
|
|
1010
1068
|
});
|
|
1011
1069
|
})();
|
|
1012
1070
|
return true;
|
|
1071
|
+
case "remote_ssh_trust_host":
|
|
1072
|
+
void (async () => {
|
|
1073
|
+
const res = await remoteSshSvc.trustHostKey({
|
|
1074
|
+
host: msg.host,
|
|
1075
|
+
port: msg.port,
|
|
1076
|
+
fingerprint: msg.fingerprint,
|
|
1077
|
+
replace: msg.replace,
|
|
1078
|
+
});
|
|
1079
|
+
send({
|
|
1080
|
+
type: "remote_ssh_trust_host_result",
|
|
1081
|
+
reqId: msg.reqId,
|
|
1082
|
+
...res,
|
|
1083
|
+
});
|
|
1084
|
+
})();
|
|
1085
|
+
return true;
|
|
1013
1086
|
case "remote_ssh_list_dir":
|
|
1014
1087
|
void (async () => {
|
|
1015
1088
|
const res = await remoteSshSvc.listDir(msg.connectionId, msg.path);
|
|
@@ -111,6 +111,16 @@ export function handlePluginMessage(msg, ctx) {
|
|
|
111
111
|
emit: (m) => send(m),
|
|
112
112
|
done: async (ok, info) => {
|
|
113
113
|
if (ok) {
|
|
114
|
+
// 安装即启用:出厂默认把一批插件放在 disabledPlugins 里,不摘掉会变成「装了却找不到」
|
|
115
|
+
if (jobAction === "install") {
|
|
116
|
+
try {
|
|
117
|
+
await cs?.enableInstalledPlugin?.(pluginId);
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
// 设置落盘失败时 commitSettings 已发过错误 notice,这里不阻断后面的重载与成功回执
|
|
121
|
+
console.warn(`[plugins] enable after install failed (${pluginId}):`, err);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
114
124
|
await reloadPluginsAndPush(jobLang);
|
|
115
125
|
if (typeof cs?.checkPluginUpdates === "function") {
|
|
116
126
|
void cs.checkPluginUpdates(false);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { startTurnTiming, finishTurnTiming } from "../turn-timing.js";
|
|
2
2
|
import { DEFAULT_DSH_CAPABILITIES } from "../engine-capabilities.js";
|
|
3
|
+
import { conversationRowKind } from "../conversation-rows.js";
|
|
3
4
|
import { mergeQuickAskSettings, normalizeQuickAskSettings } from "../quick-ask-settings.js";
|
|
4
5
|
import { captureQuickAskConversation } from "../quick-ask-context.js";
|
|
5
6
|
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -110,7 +111,6 @@ const DEFAULT_SETTINGS = {
|
|
|
110
111
|
terminalBashMaxForegroundMs: 60_000,
|
|
111
112
|
toolWatchdogTimeoutMs: 20 * 60_000,
|
|
112
113
|
bgAutoCleanupMin: 0,
|
|
113
|
-
editSoftEnabled: false,
|
|
114
114
|
questionnaireEnabled: true,
|
|
115
115
|
toolApprovalEnabled: true,
|
|
116
116
|
goalModeEnabled: true,
|
|
@@ -300,7 +300,6 @@ export class DshClientSession {
|
|
|
300
300
|
terminalBashMaxForegroundMs: savedSettings.terminalBashMaxForegroundMs ?? 60_000,
|
|
301
301
|
toolWatchdogTimeoutMs: savedSettings.toolWatchdogTimeoutMs ?? 20 * 60_000,
|
|
302
302
|
bgAutoCleanupMin: Number(savedSettings.bgAutoCleanupMin ?? 0),
|
|
303
|
-
editSoftEnabled: savedSettings.editSoftEnabled,
|
|
304
303
|
questionnaireEnabled: savedSettings.questionnaireEnabled ?? true,
|
|
305
304
|
toolApprovalEnabled: savedSettings.toolApprovalEnabled ?? true,
|
|
306
305
|
goalModeEnabled: savedSettings.goalModeEnabled ?? true,
|
|
@@ -1468,6 +1467,12 @@ export class DshClientSession {
|
|
|
1468
1467
|
id: conv.id,
|
|
1469
1468
|
sessionId: conv.sessionId,
|
|
1470
1469
|
...(sf ? { sessionFile: sf } : {}),
|
|
1470
|
+
rowKind: conversationRowKind({
|
|
1471
|
+
isStreaming: conv.isStreaming,
|
|
1472
|
+
pinned: isPinned,
|
|
1473
|
+
// pushSessions 只列有消息的会话日志,空对话没有历史行可代表
|
|
1474
|
+
hasHistoryRow: Boolean(sf) && conv.messages.length > 0,
|
|
1475
|
+
}),
|
|
1471
1476
|
title: conv.title,
|
|
1472
1477
|
cwd: conv.cwd,
|
|
1473
1478
|
messageCount: conv.messages.length,
|
|
@@ -1614,6 +1619,9 @@ export class DshClientSession {
|
|
|
1614
1619
|
}
|
|
1615
1620
|
if (this.conv !== conv || this.switchingWorkspace)
|
|
1616
1621
|
return;
|
|
1622
|
+
// 真的发消息才算「项目最近对话」:左栏项目排序只认这个,浏览/切换不刷新
|
|
1623
|
+
this.stateStore.remember(this.clientId, conv.cwd);
|
|
1624
|
+
void this.pushProjects().catch(() => { });
|
|
1617
1625
|
this.markerSvc.clearActions(conv.id);
|
|
1618
1626
|
const fileOwner = this.findSessionOwnerById?.(conv.sessionId);
|
|
1619
1627
|
if (fileOwner && fileOwner.isStreaming) {
|
|
@@ -2198,10 +2206,10 @@ export class DshClientSession {
|
|
|
2198
2206
|
}
|
|
2199
2207
|
catch { }
|
|
2200
2208
|
}
|
|
2201
|
-
this.emit({ type: "sessions", sessions: summaries });
|
|
2209
|
+
this.emit({ type: "sessions", sessions: summaries, cwd: this.cwd });
|
|
2202
2210
|
}
|
|
2203
2211
|
catch {
|
|
2204
|
-
this.emit({ type: "sessions", sessions: [] });
|
|
2212
|
+
this.emit({ type: "sessions", sessions: [], cwd: this.cwd });
|
|
2205
2213
|
}
|
|
2206
2214
|
}
|
|
2207
2215
|
resolveSessionDisplayName(sessionId, explicitTitle, firstMsg) {
|
|
@@ -2956,8 +2964,8 @@ export class DshClientSession {
|
|
|
2956
2964
|
async listFiles(relPath) {
|
|
2957
2965
|
await this.files.listFiles(relPath);
|
|
2958
2966
|
}
|
|
2959
|
-
async searchFiles(query, reqId) {
|
|
2960
|
-
await this.files.searchFiles(query, reqId);
|
|
2967
|
+
async searchFiles(query, reqId, scope) {
|
|
2968
|
+
await this.files.searchFiles(query, reqId, scope);
|
|
2961
2969
|
}
|
|
2962
2970
|
async searchSessions(query, reqId) {
|
|
2963
2971
|
const q = query.trim().toLowerCase();
|
|
@@ -3395,6 +3403,7 @@ export class DshClientSession {
|
|
|
3395
3403
|
disabledSkills: this.settings.disabledSkills,
|
|
3396
3404
|
disabledExtensions: this.settings.disabledExtensions,
|
|
3397
3405
|
disabledAgentTools: [],
|
|
3406
|
+
toolOnDemandTools: [],
|
|
3398
3407
|
disabledPluginTools: [],
|
|
3399
3408
|
terminalToolsEnabled: this.settings.terminalToolsEnabled,
|
|
3400
3409
|
terminalBash: this.settings.terminalBash,
|
|
@@ -3406,7 +3415,6 @@ export class DshClientSession {
|
|
|
3406
3415
|
toolLazyLoading: false,
|
|
3407
3416
|
codemodeMode: "on",
|
|
3408
3417
|
codemodeInlineBudget: 3000,
|
|
3409
|
-
editSoftEnabled: this.settings.editSoftEnabled,
|
|
3410
3418
|
retryMaxAttempts: DEFAULT_RETRY_MAX_ATTEMPTS,
|
|
3411
3419
|
softCapTokens: 0,
|
|
3412
3420
|
softCapByModel: {},
|
|
@@ -3461,7 +3469,6 @@ export class DshClientSession {
|
|
|
3461
3469
|
reviewSkills: [],
|
|
3462
3470
|
extensions: [],
|
|
3463
3471
|
presets: this.stateStore.getPresets(this.clientId).map(settingsPresetToUi),
|
|
3464
|
-
markersEnabled: this.markerSvc.current.markersEnabled,
|
|
3465
3472
|
disabledMarkers: [...this.markerSvc.current.disabledMarkers],
|
|
3466
3473
|
markers: this.markerSvc.listForUi(),
|
|
3467
3474
|
subagentTemplates: [],
|
|
@@ -3505,8 +3512,6 @@ export class DshClientSession {
|
|
|
3505
3512
|
this.settings.toolWatchdogTimeoutMs = normalizeToolWatchdogTimeoutMs(partial.toolWatchdogTimeoutMs);
|
|
3506
3513
|
if (partial.bgAutoCleanupMin !== undefined)
|
|
3507
3514
|
this.settings.bgAutoCleanupMin = normalizeBgCleanupMinutes(partial.bgAutoCleanupMin);
|
|
3508
|
-
if (partial.editSoftEnabled !== undefined)
|
|
3509
|
-
this.settings.editSoftEnabled = partial.editSoftEnabled;
|
|
3510
3515
|
if (partial.questionnaireEnabled !== undefined)
|
|
3511
3516
|
this.settings.questionnaireEnabled = partial.questionnaireEnabled;
|
|
3512
3517
|
if (partial.toolApprovalEnabled !== undefined)
|
|
@@ -3549,10 +3554,8 @@ export class DshClientSession {
|
|
|
3549
3554
|
if (partial.preserveDraftAcrossConversations !== undefined)
|
|
3550
3555
|
this.settings.preserveDraftAcrossConversations = partial.preserveDraftAcrossConversations;
|
|
3551
3556
|
const prevMarkerGuidance = this.markerSvc.buildGuidance();
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
disabledMarkers: partial.disabledMarkers,
|
|
3555
|
-
});
|
|
3557
|
+
if (partial.disabledMarkers !== undefined)
|
|
3558
|
+
this.markerSvc.setDisabledMarkers(partial.disabledMarkers);
|
|
3556
3559
|
const markerGuidanceChanged = this.markerSvc.buildGuidance() !== prevMarkerGuidance;
|
|
3557
3560
|
this.stateStore.saveSettings(this.clientId, {
|
|
3558
3561
|
nativeCliInheritModel: partial.nativeCliInheritModel,
|
|
@@ -3568,7 +3571,6 @@ export class DshClientSession {
|
|
|
3568
3571
|
terminalBash: this.settings.terminalBash,
|
|
3569
3572
|
terminalBashIdleMs: this.settings.terminalBashIdleMs,
|
|
3570
3573
|
terminalBashMaxForegroundMs: this.settings.terminalBashMaxForegroundMs,
|
|
3571
|
-
editSoftEnabled: this.settings.editSoftEnabled,
|
|
3572
3574
|
retryMaxAttempts: DEFAULT_RETRY_MAX_ATTEMPTS,
|
|
3573
3575
|
softCapTokens: 0,
|
|
3574
3576
|
softCapByModel: {},
|
|
@@ -3911,11 +3913,11 @@ export class DshClientSession {
|
|
|
3911
3913
|
disabledSkills: this.settings.disabledSkills,
|
|
3912
3914
|
disabledExtensions: this.settings.disabledExtensions,
|
|
3913
3915
|
disabledAgentTools: [],
|
|
3916
|
+
toolOnDemandTools: [],
|
|
3914
3917
|
terminalToolsEnabled: this.settings.terminalToolsEnabled,
|
|
3915
3918
|
terminalBash: this.settings.terminalBash,
|
|
3916
3919
|
terminalBashIdleMs: this.settings.terminalBashIdleMs,
|
|
3917
3920
|
terminalBashMaxForegroundMs: this.settings.terminalBashMaxForegroundMs,
|
|
3918
|
-
editSoftEnabled: this.settings.editSoftEnabled,
|
|
3919
3921
|
skillsFullText: [],
|
|
3920
3922
|
retryMaxAttempts: DEFAULT_RETRY_MAX_ATTEMPTS,
|
|
3921
3923
|
softCapTokens: 0,
|
|
@@ -3974,12 +3976,12 @@ export class DshClientSession {
|
|
|
3974
3976
|
disabledSkills: [...(s.disabledSkills ?? [])],
|
|
3975
3977
|
disabledExtensions: [...(s.disabledExtensions ?? [])],
|
|
3976
3978
|
disabledAgentTools: [],
|
|
3979
|
+
toolOnDemandTools: [],
|
|
3977
3980
|
disabledPluginTools: [],
|
|
3978
3981
|
terminalToolsEnabled: s.terminalToolsEnabled,
|
|
3979
3982
|
terminalBash: s.terminalBash,
|
|
3980
3983
|
terminalBashIdleMs: s.terminalBashIdleMs,
|
|
3981
3984
|
terminalBashMaxForegroundMs: s.terminalBashMaxForegroundMs,
|
|
3982
|
-
editSoftEnabled: s.editSoftEnabled,
|
|
3983
3985
|
skillsFullText: [],
|
|
3984
3986
|
reviewPrompt: s.reviewPrompt ?? "",
|
|
3985
3987
|
reviewDisabledSkills: [],
|
|
@@ -4898,7 +4900,7 @@ export class DshClientSession {
|
|
|
4898
4900
|
}
|
|
4899
4901
|
this.cwd = abs;
|
|
4900
4902
|
this.roots = this.stateStore.getWorkspaceRoots(this.clientId, abs);
|
|
4901
|
-
this.stateStore.remember(this.clientId, abs);
|
|
4903
|
+
this.stateStore.remember(this.clientId, abs, { promote: false });
|
|
4902
4904
|
const prev = this.conv;
|
|
4903
4905
|
prev.listed = this.shouldRetainDshConversation(prev) || prev.messages.length > 0;
|
|
4904
4906
|
const openRecent = this.settings.openRecentSessionOnProjectSwitch ?? true;
|
|
@@ -5310,7 +5312,7 @@ export class DshAgentService {
|
|
|
5310
5312
|
}
|
|
5311
5313
|
cs = DshClientSession.create(clientId, cwd, this.stateStore, this.dataDir, this.agentDir);
|
|
5312
5314
|
this.clients.set(clientId, cs);
|
|
5313
|
-
this.stateStore.remember(clientId, cwd);
|
|
5315
|
+
this.stateStore.remember(clientId, cwd, { promote: false });
|
|
5314
5316
|
if (cwd !== this.cwd) {
|
|
5315
5317
|
send({
|
|
5316
5318
|
type: "notice",
|
|
@@ -36,7 +36,7 @@ export class DurableAgentService {
|
|
|
36
36
|
catch { }
|
|
37
37
|
}
|
|
38
38
|
if (typeof this.stateStore?.remember === "function") {
|
|
39
|
-
this.stateStore.remember(clientId, effectiveCwd);
|
|
39
|
+
this.stateStore.remember(clientId, effectiveCwd, { promote: false });
|
|
40
40
|
}
|
|
41
41
|
const driver = new DurableAgentDriver(effectiveCwd, { dataDir: this.dataDir, agentDir: this.agentDir });
|
|
42
42
|
session = new UniversalSession({
|