pi-web-ui 0.114.0 → 0.114.1
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 +28 -0
- package/README.md +187 -187
- package/README.zh-CN.md +227 -227
- package/README.zh-TW.md +227 -227
- package/bin/device-hub-cli.mjs +577 -577
- package/bin/frp-manager.mjs +1573 -1573
- package/bin/pi-device-hub.mjs +9 -9
- package/bin/pi-web-ui.mjs +4081 -4073
- package/deploy/nginx-subpath.conf +100 -100
- package/deploy/pi-web-ui.service +36 -36
- package/dist/server/agent-service.js +131 -55
- package/dist/server/attachments.js +51 -5
- package/dist/server/canvas/canvas-agent-tool.js +3 -3
- package/dist/server/canvas/canvas-cards.js +1 -1
- package/dist/server/canvas/canvas-orchestrator.js +3 -3
- package/dist/server/canvas/canvas-scheduled-task.js +45 -0
- package/dist/server/canvas/canvas-validation.js +1 -1
- package/dist/server/client-state.js +6 -2
- package/dist/server/compaction-instructions.js +8 -8
- package/dist/server/device-center/connector.js +33 -14
- package/dist/server/device-center/desktop-page.js +228 -228
- package/dist/server/device-center/hub-page.js +64 -64
- package/dist/server/device-center/hub.js +2 -1
- package/dist/server/device-center/local-hub.js +92 -0
- package/dist/server/device-center/local.js +60 -7
- package/dist/server/device-center/native-desktop/macos.js +190 -190
- package/dist/server/device-center/native-desktop/windows.js +116 -116
- package/dist/server/device-center/path-portal.js +1 -1
- package/dist/server/device-center/relay.js +45 -8
- package/dist/server/dispatch-domain-handlers.js +1 -0
- package/dist/server/dsh/dsh-agent-service.js +5 -1
- package/dist/server/dsh/runtime/cordis.yml +1 -1
- package/dist/server/dsh/runtime/custom-prompt.mjs +33 -33
- package/dist/server/dsh/runtime/goal-rpc.mjs +1309 -1309
- package/dist/server/dsh/runtime/launcher.mjs +235 -235
- package/dist/server/dsh/runtime/override.patch.yml +89 -89
- package/dist/server/dsh/runtime/runtime-root.mjs +405 -405
- package/dist/server/engine-probe.js +36 -6
- package/dist/server/eval-tool.js +135 -135
- package/dist/server/global-loader.js +40 -2
- package/dist/server/index.js +56 -32
- package/dist/server/patch-bash-process.js +125 -0
- package/dist/server/patch-tool.js +9 -9
- package/dist/server/patch-turn-end-boundary.js +3 -3
- package/dist/server/persona-chain.js +8 -8
- package/dist/server/plugins.js +26 -2
- package/dist/server/preset-fields.js +7 -0
- package/dist/server/preset-share.js +1 -0
- package/dist/server/prompt-templates.js +106 -0
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/remote-ssh-service.js +39 -39
- package/dist/server/resolve-global-sdk.js +2 -0
- package/dist/server/schedule-agent-tool.js +39 -21
- package/dist/server/scheduler-tasks.js +45 -9
- package/dist/server/scm-commitmsg.js +10 -10
- package/dist/server/settings-service.js +6 -0
- package/dist/server/setup-page.js +620 -620
- package/dist/server/text-quote.js +9 -0
- package/dist/server/tool-manager.js +2 -1
- package/dist/server/universal/drivers/claude-code.js +5 -0
- package/dist/server/universal/drivers/codex.js +336 -0
- package/dist/server/universal/index.js +1 -0
- package/dist/server/universal/universal-attachments.js +24 -1
- package/dist/server/universal/universal-session.js +23 -0
- package/dist/server/vision-bridge.js +18 -18
- package/docs/device-center.md +148 -142
- package/docs/device-desktop.md +48 -48
- package/docs/dsh-engine.md +493 -493
- package/extensions/webui.ts +335 -335
- package/package.json +2 -2
- package/plugin-sdk/README.md +174 -174
- package/plugin-sdk/client-utils.mjs +279 -279
- package/plugin-sdk/import-check.mjs +210 -210
- package/plugin-sdk/index.d.ts +698 -698
- package/plugin-sdk/index.mjs +696 -696
- package/plugin-sdk/package.json +13 -13
- package/plugin-sdk/ssh-host-trust.mjs +225 -225
- package/plugins/catalog.json +10 -0
- package/themes/aetheris.css +501 -501
- package/themes/ayu-light.css +116 -116
- package/themes/bases/flow-base.css +1357 -1357
- package/themes/bases/obsidian-base.css +895 -895
- package/themes/bases/statusbar-flat-base.css +112 -112
- package/themes/bases/zhujian-base.css +688 -688
- package/themes/bases/zhupi-base.css +660 -660
- package/themes/catppuccin-latte.css +119 -119
- package/themes/catppuccin.css +116 -116
- package/themes/claude-code-dark.css +147 -147
- package/themes/codex.css +114 -114
- package/themes/cyberpunk.css +50 -50
- package/themes/dark-teal.css +264 -264
- package/themes/dazzle.css +38 -38
- package/themes/everforest-light.css +115 -115
- package/themes/flow-light.css +164 -164
- package/themes/flow.css +161 -161
- package/themes/geist.css +114 -114
- package/themes/gruvbox-light.css +115 -115
- package/themes/kanagawa-lotus.css +115 -115
- package/themes/md-preview.css +24 -24
- package/themes/mist.css +166 -166
- package/themes/nord.css +107 -107
- package/themes/one-dark.css +106 -106
- package/themes/paper.css +174 -174
- package/themes/rose-pine-dawn.css +114 -114
- package/themes/sakura.css +166 -166
- package/themes/solarized-light.css +114 -114
- package/themes/tokyo-night.css +115 -115
- package/themes/translucent.css +85 -85
- package/themes/transparent.css +116 -116
- package/themes/vs-code-dark.css +147 -147
- package/themes/wallpaper-flow.css +382 -382
- package/themes/wallpaper-obsidian.css +74 -74
- package/themes/white.css +164 -164
- package/themes/zhujian-dark.css +115 -115
- package/themes/zhujian.css +114 -114
- package/themes/zhupi-dark.css +115 -115
- package/themes/zhupi.css +114 -114
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/BgTasksModal-BcXJ20RO.js +1 -0
- package/web/dist/assets/BgTasksModal-DjQmiKnE.js +1 -0
- package/web/dist/assets/{CanvasStudio-BEJZE5BI.js → CanvasStudio-PI9pid0Y.js} +3 -3
- package/web/dist/assets/{CanvasStudio-CgUNHqos.js → CanvasStudio-nf5-HxLM.js} +3 -3
- package/web/dist/assets/DeviceCenter-CYttJw2a.js +3 -0
- package/web/dist/assets/DeviceCenter-DPe4sz74.js +3 -0
- package/web/dist/assets/DeviceGroups-D2rogxEN.js +1 -0
- package/web/dist/assets/Dropdown-ZLS04O8p.js +1 -0
- package/web/dist/assets/FilePreview-C9Ut4Lq6.js +2 -0
- package/web/dist/assets/FilePreview-CvK3ZzX5.js +2 -0
- package/web/dist/assets/GlobalSearchModal-C5e-OCw2.js +1 -0
- package/web/dist/assets/GlobalSearchModal-H7pFK2UC.js +1 -0
- package/web/dist/assets/GroupConversation-C2wNM0dQ.js +1 -0
- package/web/dist/assets/GroupConversation-ChN3TWQK.js +1 -0
- package/web/dist/assets/ModelConfigModal-DDZccDYt.js +2 -0
- package/web/dist/assets/PiSetupModal-DHbqfx8T.js +1 -0
- package/web/dist/assets/ProviderOAuthControls-C-MK36Dk.js +1 -0
- package/web/dist/assets/SCMPanel-buTGziDB.js +2 -0
- package/web/dist/assets/SCMPanel-kx-SCL2s.js +2 -0
- package/web/dist/assets/SettingsModal-BsUF8jqr.js +20 -0
- package/web/dist/assets/SettingsModal-D357Ky7P.js +20 -0
- package/web/dist/assets/{TerminalPanel-DL20uKgU.js → TerminalPanel-BBuM_Sez.js} +2 -2
- package/web/dist/assets/{TerminalPanel-D6cPRFei.js → TerminalPanel-D6x6xz8Q.js} +2 -2
- package/web/dist/assets/TuiOverlayModal-CdbGV3Za.js +1 -0
- package/web/dist/assets/TuiOverlayModal-d6x9u25n.js +1 -0
- package/web/dist/assets/app-globals-DcyO0UPi.js +1 -0
- package/web/dist/assets/{desktop-DPyTy4M3.js → desktop-YguLbrX1.js} +1 -1
- package/web/dist/assets/fi-DaSO0Q-m.js +325 -0
- package/web/dist/assets/index-BPvpea8t.js +85 -0
- package/web/dist/assets/index-D6u8xH0o.js +85 -0
- package/web/dist/assets/index-DDZMv6LO.css +1 -0
- package/web/dist/assets/{plugin-host-CqA4yW6w.js → plugin-host-BRBg6zmQ.js} +1 -1
- package/web/dist/assets/theme-DDl-Oy1b.js +1 -0
- package/web/dist/index.html +37 -36
- package/web/dist/sw.js +179 -179
- package/web/public/sw.js +179 -179
- package/dist/gh-comment-781.md +0 -5
- package/dist/server/device-center/local-page.js +0 -17
- package/dist/server/device-center/smoke-preview.js +0 -3
- package/dist/server/durable/durable-capabilities.js +0 -11
- package/dist/server/markers/builtins/services.js +0 -123
- package/dist/server/markers/builtins/todo.js +0 -189
- package/dist/server/markers-list-tool.js +0 -34
- package/dist/server/orchestrator.js +0 -109
- package/dist/server/system-prompt-soul.js +0 -41
- package/dist/server/univer-service.js +0 -448
- package/dist/server/universal/drivers/dsh-driver.js +0 -379
- package/dist/test-artifact.md +0 -9
- package/dist/test-preview-modal.md +0 -11
- package/dist/test-report.html +0 -20
- package/web/dist/assets/BgTasksModal-CS7UNzcw.js +0 -1
- package/web/dist/assets/BgTasksModal-Dk-tp78W.js +0 -1
- package/web/dist/assets/DeviceCenter-C8_CbxQ3.js +0 -3
- package/web/dist/assets/DeviceCenter-CVblvhNX.js +0 -3
- package/web/dist/assets/Dropdown-Oug0DDte.js +0 -1
- package/web/dist/assets/FilePreview-CvdX6nr6.js +0 -2
- package/web/dist/assets/FilePreview-kCZhfBAF.js +0 -2
- package/web/dist/assets/GlobalSearchModal-BLH63yYP.js +0 -1
- package/web/dist/assets/GlobalSearchModal-DAkvlvp6.js +0 -1
- package/web/dist/assets/GroupConversation-Cgo4xbpa.js +0 -1
- package/web/dist/assets/GroupConversation-DZ71jEi8.js +0 -1
- package/web/dist/assets/ModelConfigModal-BpWdFdQC.js +0 -2
- package/web/dist/assets/PiSetupModal-mkWPSxMj.js +0 -1
- package/web/dist/assets/ProviderOAuthControls-VK_jqXYS.js +0 -1
- package/web/dist/assets/SCMPanel-BP1TUT-V.js +0 -2
- package/web/dist/assets/SCMPanel-BscPm9kf.js +0 -2
- package/web/dist/assets/SettingsModal-C8UgMjVM.js +0 -20
- package/web/dist/assets/SettingsModal-VynB7jNb.js +0 -20
- package/web/dist/assets/TuiOverlayModal-Dst3BmT8.js +0 -1
- package/web/dist/assets/TuiOverlayModal-NCkpNtTp.js +0 -1
- package/web/dist/assets/UniversalPathPicker-CfQFc_c3.js +0 -1
- package/web/dist/assets/UniversalPathPicker-DwxwNcFw.js +0 -1
- package/web/dist/assets/app-globals-CnO6KlEM.js +0 -325
- package/web/dist/assets/index-CPgAH5q7.js +0 -83
- package/web/dist/assets/index-Cje8iugL.js +0 -83
- package/web/dist/assets/index-DnKeiDbj.css +0 -1
- package/web/dist/assets/theme-BqdAjEjF.js +0 -1
|
@@ -5,6 +5,7 @@ import { VERSION } from "@earendil-works/pi-coding-agent";
|
|
|
5
5
|
import { runtimeBaseCandidates } from "./dsh/preset-clones.js";
|
|
6
6
|
import { killPidTree } from "./process-utils.js";
|
|
7
7
|
import { probeClaudeCode } from "./universal/drivers/claude-code.js";
|
|
8
|
+
import { probeCodex } from "./universal/drivers/codex.js";
|
|
8
9
|
import { compareVersions, defaultFetcher, fetchLatest, NPM_DEFAULT_REGISTRY, } from "./update-check.js";
|
|
9
10
|
import { probeGlobalPackage } from "./global-loader.js";
|
|
10
11
|
export const ENGINE_PACKAGES = {
|
|
@@ -23,6 +24,11 @@ export const ENGINE_PACKAGES = {
|
|
|
23
24
|
packageName: "@anthropic-ai/claude-code",
|
|
24
25
|
installCommand: "npm i -g @anthropic-ai/claude-code",
|
|
25
26
|
},
|
|
27
|
+
codex: {
|
|
28
|
+
id: "codex",
|
|
29
|
+
packageName: "@openai/codex",
|
|
30
|
+
installCommand: "npm i -g @openai/codex",
|
|
31
|
+
},
|
|
26
32
|
durable: {
|
|
27
33
|
id: "durable",
|
|
28
34
|
packageName: "@earendil-works/pi-durable",
|
|
@@ -60,6 +66,14 @@ const engineRegistry = new Map([
|
|
|
60
66
|
updating: false,
|
|
61
67
|
},
|
|
62
68
|
],
|
|
69
|
+
[
|
|
70
|
+
"codex",
|
|
71
|
+
{
|
|
72
|
+
status: { id: "codex", installed: false, packageName: ENGINE_PACKAGES.codex.packageName },
|
|
73
|
+
probedAt: 0,
|
|
74
|
+
updating: false,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
63
77
|
[
|
|
64
78
|
"durable",
|
|
65
79
|
{
|
|
@@ -128,11 +142,11 @@ export function probePi() {
|
|
|
128
142
|
* 1. 优先检查常见全局 node_modules / 候选路径中的 @deepseek-ai/dsh package.json 与 dsh-base;
|
|
129
143
|
* 2. 回退通过命令行探针执行 `dsh --version`。
|
|
130
144
|
*/
|
|
131
|
-
export async function probeDsh() {
|
|
145
|
+
export async function probeDsh(force = false) {
|
|
132
146
|
const pkgName = ENGINE_PACKAGES.dsh.packageName;
|
|
133
147
|
// 0. 通用全局包探测器(覆盖 fnm / nvm / pnpm / 全局 prefix 等)
|
|
134
148
|
try {
|
|
135
|
-
const globalProbe = probeGlobalPackage(pkgName);
|
|
149
|
+
const globalProbe = probeGlobalPackage(pkgName, { refresh: force });
|
|
136
150
|
if (globalProbe.installed) {
|
|
137
151
|
return { id: "dsh", installed: true, packageName: pkgName, version: globalProbe.version };
|
|
138
152
|
}
|
|
@@ -274,11 +288,20 @@ export async function probeEngine(id, force = false) {
|
|
|
274
288
|
}
|
|
275
289
|
let result;
|
|
276
290
|
if (id === "dsh") {
|
|
277
|
-
result = await probeDsh();
|
|
291
|
+
result = await probeDsh(force);
|
|
278
292
|
}
|
|
279
293
|
else if (id === "claude") {
|
|
280
294
|
result = await probeClaude(force);
|
|
281
295
|
}
|
|
296
|
+
else if (id === "codex") {
|
|
297
|
+
const probe = await probeCodex();
|
|
298
|
+
result = {
|
|
299
|
+
id: "codex",
|
|
300
|
+
installed: probe.available,
|
|
301
|
+
version: probe.version,
|
|
302
|
+
packageName: ENGINE_PACKAGES.codex.packageName,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
282
305
|
else if (id === "durable") {
|
|
283
306
|
result = await probeDurable(force);
|
|
284
307
|
}
|
|
@@ -304,20 +327,27 @@ export async function probeAllEngines(force = false) {
|
|
|
304
327
|
if (!force && allFresh && entries.length > 0) {
|
|
305
328
|
return entries.map(toPublicStatus);
|
|
306
329
|
}
|
|
307
|
-
const [pi, dsh, claude, durable] = await Promise.all([
|
|
330
|
+
const [pi, dsh, claude, durable, codex] = await Promise.all([
|
|
308
331
|
probePi(),
|
|
309
|
-
probeDsh(),
|
|
332
|
+
probeDsh(force),
|
|
310
333
|
probeClaude(force),
|
|
311
334
|
probeDurable(force),
|
|
335
|
+
probeCodex().then((probe) => ({
|
|
336
|
+
id: "codex",
|
|
337
|
+
installed: probe.available,
|
|
338
|
+
version: probe.version,
|
|
339
|
+
packageName: ENGINE_PACKAGES.codex.packageName,
|
|
340
|
+
})),
|
|
312
341
|
]);
|
|
313
342
|
await Promise.all([
|
|
314
343
|
enrichWithUpdateInfo(pi, force),
|
|
315
344
|
enrichWithUpdateInfo(dsh, force),
|
|
316
345
|
enrichWithUpdateInfo(claude, force),
|
|
317
346
|
enrichWithUpdateInfo(durable, force),
|
|
347
|
+
enrichWithUpdateInfo(codex, force),
|
|
318
348
|
]);
|
|
319
349
|
const timestamp = Date.now();
|
|
320
|
-
const results = [pi, dsh, claude, durable];
|
|
350
|
+
const results = [pi, dsh, claude, durable, codex];
|
|
321
351
|
for (const res of results) {
|
|
322
352
|
const existing = engineRegistry.get(res.id);
|
|
323
353
|
engineRegistry.set(res.id, {
|
package/dist/server/eval-tool.js
CHANGED
|
@@ -67,142 +67,142 @@ function resolvePythonCmd() {
|
|
|
67
67
|
}
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
|
-
const PYTHON_DRIVER_SCRIPT = `
|
|
71
|
-
import sys, io, ast, json, traceback, os
|
|
72
|
-
|
|
73
|
-
# 跨平台编码对齐:Windows 默认代码页(如 CP936/GBK)读取 UTF-8 管道会导致多字节截断、
|
|
74
|
-
# 反斜杠被吞噬破坏 JSON 结构(报 Expecting ',' delimiter)或触发 UnicodeDecodeError。
|
|
75
|
-
# 强制标准流一律按 UTF-8 重配并附带容错替换策略,避免解码死锁。
|
|
76
|
-
if hasattr(sys.stdin, "reconfigure"):
|
|
77
|
-
sys.stdin.reconfigure(encoding="utf-8", errors="replace")
|
|
78
|
-
if hasattr(sys.stdout, "reconfigure"):
|
|
79
|
-
sys.stdout.reconfigure(encoding="utf-8", errors="backslashreplace")
|
|
80
|
-
if hasattr(sys.stderr, "reconfigure"):
|
|
81
|
-
sys.stderr.reconfigure(encoding="utf-8", errors="backslashreplace")
|
|
82
|
-
|
|
83
|
-
WORKDIR = os.environ.get('PI_EVAL_WORKDIR', '')
|
|
84
|
-
PROJECT_DIR = os.environ.get('PI_EVAL_PROJECT_DIR', '')
|
|
85
|
-
|
|
86
|
-
_scope = {'__name__': '__main__', 'WORKDIR': WORKDIR, 'PROJECT_DIR': PROJECT_DIR}
|
|
87
|
-
|
|
88
|
-
def run_cell(code):
|
|
89
|
-
out = io.StringIO()
|
|
90
|
-
err = io.StringIO()
|
|
91
|
-
old_out, old_err = sys.stdout, sys.stderr
|
|
92
|
-
sys.stdout, sys.stderr = out, err
|
|
93
|
-
res = None
|
|
94
|
-
exc = None
|
|
95
|
-
try:
|
|
96
|
-
parsed = ast.parse(code)
|
|
97
|
-
if parsed.body and isinstance(parsed.body[-1], ast.Expr):
|
|
98
|
-
last = parsed.body.pop()
|
|
99
|
-
if parsed.body:
|
|
100
|
-
exec(compile(parsed, '<eval>', 'exec'), _scope)
|
|
101
|
-
res = eval(compile(ast.Expression(last.value), '<eval>', 'eval'), _scope)
|
|
102
|
-
else:
|
|
103
|
-
exec(compile(code, '<eval>', 'exec'), _scope)
|
|
104
|
-
except Exception:
|
|
105
|
-
exc = traceback.format_exc()
|
|
106
|
-
finally:
|
|
107
|
-
sys.stdout, sys.stderr = old_out, old_err
|
|
108
|
-
return {
|
|
109
|
-
'stdout': out.getvalue(),
|
|
110
|
-
'stderr': err.getvalue(),
|
|
111
|
-
'result': repr(res) if res is not None else None,
|
|
112
|
-
'error': exc
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
for line in sys.stdin:
|
|
116
|
-
if not line.strip():
|
|
117
|
-
continue
|
|
118
|
-
try:
|
|
119
|
-
req = json.loads(line)
|
|
120
|
-
if req.get('action') == 'reset':
|
|
121
|
-
_scope.clear()
|
|
122
|
-
_scope['__name__'] = '__main__'
|
|
123
|
-
_scope['WORKDIR'] = WORKDIR
|
|
124
|
-
_scope['PROJECT_DIR'] = PROJECT_DIR
|
|
125
|
-
resp = {'ok': True, 'stdout': '', 'stderr': '', 'result': None, 'error': None}
|
|
126
|
-
else:
|
|
127
|
-
resp = run_cell(req.get('code', ''))
|
|
128
|
-
resp['ok'] = resp['error'] is None
|
|
129
|
-
except Exception as e:
|
|
130
|
-
resp = {'ok': False, 'stdout': '', 'stderr': '', 'result': None, 'error': traceback.format_exc()}
|
|
131
|
-
|
|
132
|
-
sys.stdout.write('__PI_EVAL_RES__' + json.dumps(resp, ensure_ascii=True) + '\\n')
|
|
133
|
-
sys.stdout.flush()
|
|
70
|
+
const PYTHON_DRIVER_SCRIPT = `
|
|
71
|
+
import sys, io, ast, json, traceback, os
|
|
72
|
+
|
|
73
|
+
# 跨平台编码对齐:Windows 默认代码页(如 CP936/GBK)读取 UTF-8 管道会导致多字节截断、
|
|
74
|
+
# 反斜杠被吞噬破坏 JSON 结构(报 Expecting ',' delimiter)或触发 UnicodeDecodeError。
|
|
75
|
+
# 强制标准流一律按 UTF-8 重配并附带容错替换策略,避免解码死锁。
|
|
76
|
+
if hasattr(sys.stdin, "reconfigure"):
|
|
77
|
+
sys.stdin.reconfigure(encoding="utf-8", errors="replace")
|
|
78
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
79
|
+
sys.stdout.reconfigure(encoding="utf-8", errors="backslashreplace")
|
|
80
|
+
if hasattr(sys.stderr, "reconfigure"):
|
|
81
|
+
sys.stderr.reconfigure(encoding="utf-8", errors="backslashreplace")
|
|
82
|
+
|
|
83
|
+
WORKDIR = os.environ.get('PI_EVAL_WORKDIR', '')
|
|
84
|
+
PROJECT_DIR = os.environ.get('PI_EVAL_PROJECT_DIR', '')
|
|
85
|
+
|
|
86
|
+
_scope = {'__name__': '__main__', 'WORKDIR': WORKDIR, 'PROJECT_DIR': PROJECT_DIR}
|
|
87
|
+
|
|
88
|
+
def run_cell(code):
|
|
89
|
+
out = io.StringIO()
|
|
90
|
+
err = io.StringIO()
|
|
91
|
+
old_out, old_err = sys.stdout, sys.stderr
|
|
92
|
+
sys.stdout, sys.stderr = out, err
|
|
93
|
+
res = None
|
|
94
|
+
exc = None
|
|
95
|
+
try:
|
|
96
|
+
parsed = ast.parse(code)
|
|
97
|
+
if parsed.body and isinstance(parsed.body[-1], ast.Expr):
|
|
98
|
+
last = parsed.body.pop()
|
|
99
|
+
if parsed.body:
|
|
100
|
+
exec(compile(parsed, '<eval>', 'exec'), _scope)
|
|
101
|
+
res = eval(compile(ast.Expression(last.value), '<eval>', 'eval'), _scope)
|
|
102
|
+
else:
|
|
103
|
+
exec(compile(code, '<eval>', 'exec'), _scope)
|
|
104
|
+
except Exception:
|
|
105
|
+
exc = traceback.format_exc()
|
|
106
|
+
finally:
|
|
107
|
+
sys.stdout, sys.stderr = old_out, old_err
|
|
108
|
+
return {
|
|
109
|
+
'stdout': out.getvalue(),
|
|
110
|
+
'stderr': err.getvalue(),
|
|
111
|
+
'result': repr(res) if res is not None else None,
|
|
112
|
+
'error': exc
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
for line in sys.stdin:
|
|
116
|
+
if not line.strip():
|
|
117
|
+
continue
|
|
118
|
+
try:
|
|
119
|
+
req = json.loads(line)
|
|
120
|
+
if req.get('action') == 'reset':
|
|
121
|
+
_scope.clear()
|
|
122
|
+
_scope['__name__'] = '__main__'
|
|
123
|
+
_scope['WORKDIR'] = WORKDIR
|
|
124
|
+
_scope['PROJECT_DIR'] = PROJECT_DIR
|
|
125
|
+
resp = {'ok': True, 'stdout': '', 'stderr': '', 'result': None, 'error': None}
|
|
126
|
+
else:
|
|
127
|
+
resp = run_cell(req.get('code', ''))
|
|
128
|
+
resp['ok'] = resp['error'] is None
|
|
129
|
+
except Exception as e:
|
|
130
|
+
resp = {'ok': False, 'stdout': '', 'stderr': '', 'result': None, 'error': traceback.format_exc()}
|
|
131
|
+
|
|
132
|
+
sys.stdout.write('__PI_EVAL_RES__' + json.dumps(resp, ensure_ascii=True) + '\\n')
|
|
133
|
+
sys.stdout.flush()
|
|
134
134
|
`;
|
|
135
|
-
const NODE_DRIVER_SCRIPT = `
|
|
136
|
-
import repl from "node:repl";
|
|
137
|
-
import { PassThrough } from "node:stream";
|
|
138
|
-
import readline from "node:readline";
|
|
139
|
-
|
|
140
|
-
let server;
|
|
141
|
-
function createRepl() {
|
|
142
|
-
const inStream = new PassThrough();
|
|
143
|
-
const outStream = new PassThrough();
|
|
144
|
-
server = repl.start({
|
|
145
|
-
input: inStream,
|
|
146
|
-
output: outStream,
|
|
147
|
-
terminal: false,
|
|
148
|
-
useColors: false,
|
|
149
|
-
preview: false
|
|
150
|
-
});
|
|
151
|
-
server.context.console = console;
|
|
152
|
-
server.context.setTimeout = setTimeout;
|
|
153
|
-
server.context.clearTimeout = clearTimeout;
|
|
154
|
-
server.context.setInterval = setInterval;
|
|
155
|
-
server.context.clearInterval = clearInterval;
|
|
156
|
-
server.context.Buffer = Buffer;
|
|
157
|
-
server.context.URL = URL;
|
|
158
|
-
server.context.WORKDIR = process.env.PI_EVAL_WORKDIR || "";
|
|
159
|
-
server.context.PROJECT_DIR = process.env.PI_EVAL_PROJECT_DIR || "";
|
|
160
|
-
}
|
|
161
|
-
createRepl();
|
|
162
|
-
|
|
163
|
-
const rl = readline.createInterface({ input: process.stdin });
|
|
164
|
-
rl.on("line", (line) => {
|
|
165
|
-
if (!line.trim()) return;
|
|
166
|
-
try {
|
|
167
|
-
const req = JSON.parse(line);
|
|
168
|
-
if (req.action === "reset") {
|
|
169
|
-
createRepl();
|
|
170
|
-
process.stdout.write("__PI_EVAL_RES__" + JSON.stringify({ ok: true, stdout: "", stderr: "", result: null, error: null }) + "\\n");
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
let capturedOut = "";
|
|
174
|
-
let capturedErr = "";
|
|
175
|
-
const origLog = server.context.console.log;
|
|
176
|
-
const origErr = server.context.console.error;
|
|
177
|
-
const origWarn = server.context.console.warn;
|
|
178
|
-
server.context.console.log = (...args) => {
|
|
179
|
-
capturedOut += args.map(a => typeof a === "string" ? a : JSON.stringify(a)).join(" ") + "\\n";
|
|
180
|
-
};
|
|
181
|
-
server.context.console.error = (...args) => {
|
|
182
|
-
capturedErr += args.map(a => typeof a === "string" ? a : JSON.stringify(a)).join(" ") + "\\n";
|
|
183
|
-
};
|
|
184
|
-
server.context.console.warn = (...args) => {
|
|
185
|
-
capturedErr += args.map(a => typeof a === "string" ? a : JSON.stringify(a)).join(" ") + "\\n";
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
server.eval(req.code, server.context, "eval", (err, result) => {
|
|
189
|
-
server.context.console.log = origLog;
|
|
190
|
-
server.context.console.error = origErr;
|
|
191
|
-
server.context.console.warn = origWarn;
|
|
192
|
-
const resp = {
|
|
193
|
-
ok: !err,
|
|
194
|
-
stdout: capturedOut,
|
|
195
|
-
stderr: capturedErr,
|
|
196
|
-
result: result !== undefined ? (typeof result === "string" ? result : JSON.stringify(result, null, 2)) : null,
|
|
197
|
-
error: err ? (err.stack || String(err)) : null
|
|
198
|
-
};
|
|
199
|
-
process.stdout.write("__PI_EVAL_RES__" + JSON.stringify(resp) + "\\n");
|
|
200
|
-
});
|
|
201
|
-
} catch (e) {
|
|
202
|
-
const resp = { ok: false, stdout: "", stderr: "", result: null, error: e.stack || String(e) };
|
|
203
|
-
process.stdout.write("__PI_EVAL_RES__" + JSON.stringify(resp) + "\\n");
|
|
204
|
-
}
|
|
205
|
-
});
|
|
135
|
+
const NODE_DRIVER_SCRIPT = `
|
|
136
|
+
import repl from "node:repl";
|
|
137
|
+
import { PassThrough } from "node:stream";
|
|
138
|
+
import readline from "node:readline";
|
|
139
|
+
|
|
140
|
+
let server;
|
|
141
|
+
function createRepl() {
|
|
142
|
+
const inStream = new PassThrough();
|
|
143
|
+
const outStream = new PassThrough();
|
|
144
|
+
server = repl.start({
|
|
145
|
+
input: inStream,
|
|
146
|
+
output: outStream,
|
|
147
|
+
terminal: false,
|
|
148
|
+
useColors: false,
|
|
149
|
+
preview: false
|
|
150
|
+
});
|
|
151
|
+
server.context.console = console;
|
|
152
|
+
server.context.setTimeout = setTimeout;
|
|
153
|
+
server.context.clearTimeout = clearTimeout;
|
|
154
|
+
server.context.setInterval = setInterval;
|
|
155
|
+
server.context.clearInterval = clearInterval;
|
|
156
|
+
server.context.Buffer = Buffer;
|
|
157
|
+
server.context.URL = URL;
|
|
158
|
+
server.context.WORKDIR = process.env.PI_EVAL_WORKDIR || "";
|
|
159
|
+
server.context.PROJECT_DIR = process.env.PI_EVAL_PROJECT_DIR || "";
|
|
160
|
+
}
|
|
161
|
+
createRepl();
|
|
162
|
+
|
|
163
|
+
const rl = readline.createInterface({ input: process.stdin });
|
|
164
|
+
rl.on("line", (line) => {
|
|
165
|
+
if (!line.trim()) return;
|
|
166
|
+
try {
|
|
167
|
+
const req = JSON.parse(line);
|
|
168
|
+
if (req.action === "reset") {
|
|
169
|
+
createRepl();
|
|
170
|
+
process.stdout.write("__PI_EVAL_RES__" + JSON.stringify({ ok: true, stdout: "", stderr: "", result: null, error: null }) + "\\n");
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
let capturedOut = "";
|
|
174
|
+
let capturedErr = "";
|
|
175
|
+
const origLog = server.context.console.log;
|
|
176
|
+
const origErr = server.context.console.error;
|
|
177
|
+
const origWarn = server.context.console.warn;
|
|
178
|
+
server.context.console.log = (...args) => {
|
|
179
|
+
capturedOut += args.map(a => typeof a === "string" ? a : JSON.stringify(a)).join(" ") + "\\n";
|
|
180
|
+
};
|
|
181
|
+
server.context.console.error = (...args) => {
|
|
182
|
+
capturedErr += args.map(a => typeof a === "string" ? a : JSON.stringify(a)).join(" ") + "\\n";
|
|
183
|
+
};
|
|
184
|
+
server.context.console.warn = (...args) => {
|
|
185
|
+
capturedErr += args.map(a => typeof a === "string" ? a : JSON.stringify(a)).join(" ") + "\\n";
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
server.eval(req.code, server.context, "eval", (err, result) => {
|
|
189
|
+
server.context.console.log = origLog;
|
|
190
|
+
server.context.console.error = origErr;
|
|
191
|
+
server.context.console.warn = origWarn;
|
|
192
|
+
const resp = {
|
|
193
|
+
ok: !err,
|
|
194
|
+
stdout: capturedOut,
|
|
195
|
+
stderr: capturedErr,
|
|
196
|
+
result: result !== undefined ? (typeof result === "string" ? result : JSON.stringify(result, null, 2)) : null,
|
|
197
|
+
error: err ? (err.stack || String(err)) : null
|
|
198
|
+
};
|
|
199
|
+
process.stdout.write("__PI_EVAL_RES__" + JSON.stringify(resp) + "\\n");
|
|
200
|
+
});
|
|
201
|
+
} catch (e) {
|
|
202
|
+
const resp = { ok: false, stdout: "", stderr: "", result: null, error: e.stack || String(e) };
|
|
203
|
+
process.stdout.write("__PI_EVAL_RES__" + JSON.stringify(resp) + "\\n");
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
206
|
`;
|
|
207
207
|
/**
|
|
208
208
|
* 净化 Eval 子进程环境变量:仅保留操作系统基础变量,剥离所有包含 key/token/secret/auth/cred 等敏感环境变量,
|
|
@@ -19,6 +19,8 @@ import { delimiter, dirname, isAbsolute, join, resolve } from "node:path";
|
|
|
19
19
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
20
20
|
let cachedNpmRootG = null;
|
|
21
21
|
let cachedCandidateRoots = null;
|
|
22
|
+
let candidateRootsCachedAt = 0;
|
|
23
|
+
const CANDIDATE_CACHE_TTL_MS = 5000;
|
|
22
24
|
const packageRootCache = new Map();
|
|
23
25
|
/**
|
|
24
26
|
* 安全且带缓存地获取系统 npm 全局 root 目录。
|
|
@@ -50,9 +52,13 @@ export function getSystemNpmRootG() {
|
|
|
50
52
|
* 覆盖:本地项目链、Node 邻近目录、fnm、nvm、pnpm、volta、yarn、bun、npm 全局 prefix 等。
|
|
51
53
|
*/
|
|
52
54
|
export function getCandidateNodeModulesRoots(options) {
|
|
53
|
-
if (!options?.refresh &&
|
|
55
|
+
if (!options?.refresh &&
|
|
56
|
+
cachedCandidateRoots !== null &&
|
|
57
|
+
Date.now() - candidateRootsCachedAt < CANDIDATE_CACHE_TTL_MS) {
|
|
54
58
|
return cachedCandidateRoots;
|
|
55
59
|
}
|
|
60
|
+
// A refreshed discovery must also re-query npm when its prefix changed.
|
|
61
|
+
cachedNpmRootG = null;
|
|
56
62
|
const candidates = new Set();
|
|
57
63
|
// 1. 本包内部与向上的祖先链路 node_modules
|
|
58
64
|
let cur = dirname(fileURLToPath(import.meta.url));
|
|
@@ -100,7 +106,38 @@ export function getCandidateNodeModulesRoots(options) {
|
|
|
100
106
|
candidates.add(npmGlobal);
|
|
101
107
|
const env = process.env;
|
|
102
108
|
const home = env.HOME || env.USERPROFILE || homedir();
|
|
103
|
-
// 6.
|
|
109
|
+
// 6. fnm 的 multishell 是临时链接;桌面/服务启动时可能完全不存在。
|
|
110
|
+
// 持久安装位于 FNM_DIR/node-versions/<version>/installation。
|
|
111
|
+
if (env.FNM_MULTISHELL_PATH) {
|
|
112
|
+
for (const suffix of ["node_modules", join("lib", "node_modules")]) {
|
|
113
|
+
const nm = join(env.FNM_MULTISHELL_PATH, suffix);
|
|
114
|
+
if (existsSync(nm))
|
|
115
|
+
candidates.add(resolve(nm));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const fnmDirs = new Set([
|
|
119
|
+
env.FNM_DIR,
|
|
120
|
+
env.APPDATA && join(env.APPDATA, "fnm"),
|
|
121
|
+
env.LOCALAPPDATA && join(env.LOCALAPPDATA, "fnm"),
|
|
122
|
+
join(env.XDG_DATA_HOME || join(home, ".local", "share"), "fnm"),
|
|
123
|
+
join(home, ".fnm"),
|
|
124
|
+
].filter((dir) => !!dir));
|
|
125
|
+
for (const fnmDir of fnmDirs) {
|
|
126
|
+
try {
|
|
127
|
+
const versionsDir = join(fnmDir, "node-versions");
|
|
128
|
+
const versions = readdirSync(versionsDir).sort((a, b) => b.localeCompare(a, undefined, { numeric: true }));
|
|
129
|
+
for (const version of versions) {
|
|
130
|
+
for (const suffix of ["node_modules", join("lib", "node_modules")]) {
|
|
131
|
+
const nm = join(versionsDir, version, "installation", suffix);
|
|
132
|
+
if (existsSync(nm))
|
|
133
|
+
candidates.add(resolve(nm));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
/* Missing or unreadable version store; continue with other managers. */
|
|
139
|
+
}
|
|
140
|
+
}
|
|
104
141
|
if (process.platform === "win32") {
|
|
105
142
|
const localAppData = env.LOCALAPPDATA;
|
|
106
143
|
if (localAppData) {
|
|
@@ -202,6 +239,7 @@ export function getCandidateNodeModulesRoots(options) {
|
|
|
202
239
|
candidates.add(resolve("/usr/lib/node_modules"));
|
|
203
240
|
}
|
|
204
241
|
cachedCandidateRoots = Array.from(candidates);
|
|
242
|
+
candidateRootsCachedAt = Date.now();
|
|
205
243
|
return cachedCandidateRoots;
|
|
206
244
|
}
|
|
207
245
|
/**
|
package/dist/server/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { botExecutionMessageAllowed } from "./device-center/bot-execution.js";
|
|
|
21
21
|
import "./patch-remote-catalog.js";
|
|
22
22
|
import "./patch-turn-end-boundary.js";
|
|
23
23
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
24
|
+
import { registerPromptTemplateRoutes } from "./prompt-templates.js";
|
|
24
25
|
import { readFile, stat } from "node:fs/promises";
|
|
25
26
|
import { createServer } from "node:http";
|
|
26
27
|
import { proxyHttp } from "./http-proxy.js";
|
|
@@ -77,6 +78,7 @@ import { handleFileMessage, handleScmMessage, handleBgServerMessage, handlePrese
|
|
|
77
78
|
import { RemoteSshService, isRemoteWorkspaceUri, serveRemoteWorkspaceFile, setGlobalRemoteSshService, } from "./remote-ssh-service.js";
|
|
78
79
|
import { handlePluginMessage } from "./dispatch-plugin-handlers.js";
|
|
79
80
|
import { CanvasOrchestrator } from "./canvas/canvas-orchestrator.js";
|
|
81
|
+
import { executeScheduledCanvas, validateScheduledCanvas } from "./canvas/canvas-scheduled-task.js";
|
|
80
82
|
import { setCanvasBroadcaster, setCanvasRuntime } from "./canvas/canvas-agent-tool.js";
|
|
81
83
|
import { handleCanvasMessage } from "./canvas/canvas-dispatch.js";
|
|
82
84
|
/** Strip npm-injected env (`npm start` exports `npm_config_*` / `npm_package_*` /
|
|
@@ -525,17 +527,20 @@ app.use((req, res, next) => {
|
|
|
525
527
|
});
|
|
526
528
|
/** 共享客户端持久化存储:双引擎(pi + dsh)共用同一份内存缓存与落盘通道,避免互相覆盖。 */
|
|
527
529
|
const sharedStateStore = new ClientStateStore(join(DATA_DIR, "client-state.json"));
|
|
528
|
-
|
|
530
|
+
registerPromptTemplateRoutes(app, DATA_DIR);
|
|
531
|
+
/** 启动参数显式指定的引擎(--engine pi|dsh|codex|claude|durable 或 PI_WEB_ENGINE)。未显式传则优先读持久化默认引擎。 */
|
|
529
532
|
const EXPLICIT_ENGINE_ARG = cliFlag("--engine") ?? process.env.PI_WEB_ENGINE;
|
|
530
|
-
let currentDefaultEngine = EXPLICIT_ENGINE_ARG === "
|
|
531
|
-
? "
|
|
532
|
-
: EXPLICIT_ENGINE_ARG === "
|
|
533
|
-
? "
|
|
534
|
-
: EXPLICIT_ENGINE_ARG === "
|
|
535
|
-
? "
|
|
536
|
-
: EXPLICIT_ENGINE_ARG === "
|
|
537
|
-
? "
|
|
538
|
-
:
|
|
533
|
+
let currentDefaultEngine = EXPLICIT_ENGINE_ARG === "codex"
|
|
534
|
+
? "codex"
|
|
535
|
+
: EXPLICIT_ENGINE_ARG === "durable"
|
|
536
|
+
? "durable"
|
|
537
|
+
: EXPLICIT_ENGINE_ARG === "claude"
|
|
538
|
+
? "claude"
|
|
539
|
+
: EXPLICIT_ENGINE_ARG === "dsh"
|
|
540
|
+
? "dsh"
|
|
541
|
+
: EXPLICIT_ENGINE_ARG === "pi"
|
|
542
|
+
? "pi"
|
|
543
|
+
: (sharedStateStore.getDefaultEngine() ?? "pi");
|
|
539
544
|
/** 默认引擎标识(兼容 /api/health 等读取)。 */
|
|
540
545
|
/** 每个客户端(浏览器标签页 clientId)当前激活的引擎。支持多标签页同时跑不同引擎 + 零重启热切。 */
|
|
541
546
|
const clientEngines = new Map();
|
|
@@ -1353,12 +1358,13 @@ heartbeatTimer.unref?.();
|
|
|
1353
1358
|
// PI_WEB_ENGINE=durable 时使用 Pi Durable 引擎(server/durable/),
|
|
1354
1359
|
// 默认 pi 引擎。同一 wire 协议,前端无感知(ready/health 携带 engine 字段)。
|
|
1355
1360
|
import { DshAgentService } from "./dsh/dsh-agent-service.js";
|
|
1356
|
-
import { UniversalAgentService, ClaudeCodeDriver, probeClaudeCode } from "./universal/index.js";
|
|
1361
|
+
import { UniversalAgentService, ClaudeCodeDriver, probeClaudeCode, CodexDriver } from "./universal/index.js";
|
|
1357
1362
|
import { DurableAgentService } from "./durable/index.js";
|
|
1358
1363
|
import { probeAllEngines, probeEngine, getCachedEngineStatuses, updateEngineBackground, isEngineUpdating, ENGINE_PACKAGES, } from "./engine-probe.js";
|
|
1359
1364
|
let piServiceInstance = null;
|
|
1360
1365
|
let dshServiceInstance = null;
|
|
1361
1366
|
let claudeServiceInstance = null;
|
|
1367
|
+
let codexServiceInstance = null;
|
|
1362
1368
|
let durableServiceInstance = null;
|
|
1363
1369
|
let wireEngineHooks = null;
|
|
1364
1370
|
let sharedSocketCount = 0;
|
|
@@ -1371,11 +1377,31 @@ function activeEngines() {
|
|
|
1371
1377
|
list.push(dshServiceInstance);
|
|
1372
1378
|
if (claudeServiceInstance)
|
|
1373
1379
|
list.push(claudeServiceInstance);
|
|
1380
|
+
if (codexServiceInstance)
|
|
1381
|
+
list.push(codexServiceInstance);
|
|
1374
1382
|
if (durableServiceInstance)
|
|
1375
1383
|
list.push(durableServiceInstance);
|
|
1376
1384
|
return list;
|
|
1377
1385
|
}
|
|
1378
1386
|
function ensureEngine(engine) {
|
|
1387
|
+
if (engine === "codex") {
|
|
1388
|
+
if (!codexServiceInstance) {
|
|
1389
|
+
codexServiceInstance = new UniversalAgentService({
|
|
1390
|
+
cwd: CWD,
|
|
1391
|
+
dataDir: DATA_DIR,
|
|
1392
|
+
agentDir: getAgentDir(),
|
|
1393
|
+
stateStore: sharedStateStore,
|
|
1394
|
+
engine: "codex",
|
|
1395
|
+
driverFactory: (cwd) => new CodexDriver(cwd),
|
|
1396
|
+
});
|
|
1397
|
+
for (let i = 0; i < sharedSocketCount; i++)
|
|
1398
|
+
codexServiceInstance.noteSocketOpen();
|
|
1399
|
+
if (sharedQuiesced)
|
|
1400
|
+
codexServiceInstance.quiesce();
|
|
1401
|
+
wireEngineHooks?.(codexServiceInstance);
|
|
1402
|
+
}
|
|
1403
|
+
return codexServiceInstance;
|
|
1404
|
+
}
|
|
1379
1405
|
if (engine === "durable") {
|
|
1380
1406
|
if (!durableServiceInstance) {
|
|
1381
1407
|
durableServiceInstance = new DurableAgentService({
|
|
@@ -1763,7 +1789,11 @@ canvasOrchestrator.setBroadcaster((msg) => {
|
|
|
1763
1789
|
// 客户端(chatFromScheduler);单次任务触发后自动删除。DSH 引擎无这俩方法时
|
|
1764
1790
|
// executor 回 not-supported(历史里记失败,不炸进程)。
|
|
1765
1791
|
const scheduler = new SchedulerStore(DATA_DIR, {
|
|
1792
|
+
validateTask: (task) => validateScheduledCanvas(DATA_DIR, task),
|
|
1766
1793
|
executor: async (task) => {
|
|
1794
|
+
if (task.target === "canvas") {
|
|
1795
|
+
return executeScheduledCanvas(DATA_DIR, canvasOrchestrator, task);
|
|
1796
|
+
}
|
|
1767
1797
|
let result;
|
|
1768
1798
|
try {
|
|
1769
1799
|
const svc = ensureEngine("pi");
|
|
@@ -1854,15 +1884,6 @@ const scheduler = new SchedulerStore(DATA_DIR, {
|
|
|
1854
1884
|
catch (err) {
|
|
1855
1885
|
result = { ok: false, error: err.message };
|
|
1856
1886
|
}
|
|
1857
|
-
// 单次任务:触发一次后自动删除(历史随任务一起走,成败已由上面的 notify 播报)。
|
|
1858
|
-
if (task.oneShot) {
|
|
1859
|
-
try {
|
|
1860
|
-
scheduler.remove(task.id);
|
|
1861
|
-
}
|
|
1862
|
-
catch {
|
|
1863
|
-
// 删除失败不影响已记录的执行结果
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
1887
|
return result;
|
|
1867
1888
|
},
|
|
1868
1889
|
onChange: () => pushSchedulerTasks(),
|
|
@@ -2282,21 +2303,23 @@ wss.on("connection", (ws) => {
|
|
|
2282
2303
|
.catch(() => { });
|
|
2283
2304
|
};
|
|
2284
2305
|
const handleSwitchEngine = async (msg) => {
|
|
2285
|
-
const targetEngine = msg.engine === "
|
|
2286
|
-
? "
|
|
2287
|
-
: msg.engine === "
|
|
2288
|
-
? "
|
|
2289
|
-
: msg.engine === "
|
|
2290
|
-
? "
|
|
2291
|
-
: msg.engine === "
|
|
2292
|
-
? "
|
|
2293
|
-
:
|
|
2306
|
+
const targetEngine = msg.engine === "codex"
|
|
2307
|
+
? "codex"
|
|
2308
|
+
: msg.engine === "durable"
|
|
2309
|
+
? "durable"
|
|
2310
|
+
: msg.engine === "claude"
|
|
2311
|
+
? "claude"
|
|
2312
|
+
: msg.engine === "dsh"
|
|
2313
|
+
? "dsh"
|
|
2314
|
+
: msg.engine === "pi"
|
|
2315
|
+
? "pi"
|
|
2316
|
+
: null;
|
|
2294
2317
|
if (!targetEngine) {
|
|
2295
2318
|
send({
|
|
2296
2319
|
type: "notice",
|
|
2297
2320
|
level: "error",
|
|
2298
|
-
text: `无效的引擎类型:${String(msg.engine)}(仅支持 pi / dsh / claude / durable)`,
|
|
2299
|
-
textEn: `Invalid engine "${String(msg.engine)}" (supported: pi, dsh, claude, durable)`,
|
|
2321
|
+
text: `无效的引擎类型:${String(msg.engine)}(仅支持 pi / dsh / codex / claude / durable)`,
|
|
2322
|
+
textEn: `Invalid engine "${String(msg.engine)}" (supported: pi, dsh, codex, claude, durable)`,
|
|
2300
2323
|
});
|
|
2301
2324
|
return;
|
|
2302
2325
|
}
|
|
@@ -2440,6 +2463,7 @@ wss.on("connection", (ws) => {
|
|
|
2440
2463
|
pi: { zh: "Pi", en: "Pi" },
|
|
2441
2464
|
dsh: { zh: "DSH", en: "DSH" },
|
|
2442
2465
|
claude: { zh: "Claude Code", en: "Claude Code" },
|
|
2466
|
+
codex: { zh: "Codex", en: "Codex" },
|
|
2443
2467
|
durable: { zh: "Pi Durable", en: "Pi Durable" },
|
|
2444
2468
|
};
|
|
2445
2469
|
const displayName = engineDisplayNames[targetEngine] ?? {
|
|
@@ -2646,7 +2670,7 @@ wss.on("connection", (ws) => {
|
|
|
2646
2670
|
void cs.abort();
|
|
2647
2671
|
break;
|
|
2648
2672
|
case "abort_bash":
|
|
2649
|
-
void cs.abortBash();
|
|
2673
|
+
void cs.abortBash(msg.conversationId);
|
|
2650
2674
|
break;
|
|
2651
2675
|
case "retry_last":
|
|
2652
2676
|
void cs.retryLast();
|