(command, normalized)
| 3928 | } |
| 3929 | |
| 3930 | async function executeRemoteExecutionCommand(command, normalized) { |
| 3931 | if (/^(远程执行|远程执行模式|开启远程执行|打开远程执行|启动远程执行)$/.test(normalized)) { |
| 3932 | if (state.remoteExecution.enabled) { |
| 3933 | touchRemoteExecutionActivity(); |
| 3934 | return { ok: true, summary: "Remote execution already enabled", reply: formatRemoteExecutionStatus("远程执行模式已经开启。") }; |
| 3935 | } |
| 3936 | state.remoteExecution.pendingAction = { |
| 3937 | action: "enable", |
| 3938 | createdAt: Date.now() |
| 3939 | }; |
| 3940 | return { |
| 3941 | ok: true, |
| 3942 | summary: "Remote execution confirmation required", |
| 3943 | reply: [ |
| 3944 | "准备开启远程执行模式。", |
| 3945 | "确认后会启用完整 Codex CLI 通道,并使用独立远程执行记忆。", |
| 3946 | "3 分钟内发送 /确认 开启,或 /取消。" |
| 3947 | ].join("\n") |
| 3948 | }; |
| 3949 | } |
| 3950 | |
| 3951 | if (!state.remoteExecution.enabled) { |
| 3952 | if (/^(模型|智能等级|skill|skill列表|skill无|退出|续时)$/.test(normalized)) { |
| 3953 | return { ok: false, summary: "Remote execution command outside mode", reply: "这个命令只在远程执行模式下可用。发送 /远程执行 后再用就行。" }; |
| 3954 | } |
| 3955 | if (/^(确认远程执行|执行远程执行)$/.test(normalized)) return executePendingRemoteExecutionAction(); |
| 3956 | return null; |
| 3957 | } |
| 3958 | |
| 3959 | touchRemoteExecutionActivity(); |
| 3960 | |
| 3961 | if (/^(帮助|help|指令)$/.test(normalized)) { |
| 3962 | return { ok: true, summary: "Remote execution help sent", reply: formatRemoteExecutionHelp() }; |
| 3963 | } |
| 3964 | if (/^(状态|status|远程执行状态)$/.test(normalized)) { |
| 3965 | return { ok: true, summary: "Remote execution status sent", reply: formatRemoteExecutionStatus("远程执行模式状态:") }; |
| 3966 | } |
| 3967 | if (/^(退出|关闭远程执行|退出远程执行|关闭远程执行模式|退出远程执行模式)$/.test(normalized)) { |
| 3968 | state.remoteExecution.enabled = false; |
| 3969 | state.remoteExecution.pendingAction = null; |
| 3970 | stopRemoteExecutionIdleTimer(); |
| 3971 | return { ok: true, summary: "Remote execution disabled", reply: "远程执行模式已关闭。" }; |
| 3972 | } |
| 3973 | if (/^(续时|续期|刷新倒计时)$/.test(normalized)) { |
| 3974 | touchRemoteExecutionActivity(); |
| 3975 | return { ok: true, summary: "Remote execution timer refreshed", reply: "远程执行模式倒计时已刷新。" }; |
| 3976 | } |
| 3977 | if (/^(清空记忆|清除记忆|清理记忆|重置记忆)$/.test(normalized)) { |
| 3978 | state.remoteExecution.memory.entries = []; |
| 3979 | await saveRemoteExecutionMemory(); |
| 3980 | return { ok: true, summary: "Remote execution memory cleared", reply: "远程执行模式记忆已清空。" }; |
| 3981 | } |
| 3982 | if (/^skill\s*列表$/i.test(command.trim())) { |
| 3983 | return { |
| 3984 | ok: true, |
| 3985 | summary: "Remote execution skill list sent", |
| 3986 | reply: [ |
| 3987 | "可用 skill:", |
no test coverage detected