Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 添加 predict-prompt handler IPC 错误包装和 system prompt 维护者确认 TODO
Shinku548ab61553c9
diff --git a/apps/desktop/src/main/maker-ipc/promptPrediction.ts b/apps/desktop/src/main/maker-ipc/promptPrediction.tsindex ea2ca92662..b766a59781 100644--- a/apps/desktop/src/main/maker-ipc/promptPrediction.ts+++ b/apps/desktop/src/main/maker-ipc/promptPrediction.ts@@ -88,6 +88,8 @@ function buildPredictionPrompt(// 系统指令写入 Anthropic Messages API 顶层 system 字段(非 Anthropic wire 忽略),// 不混入 user message,避免被 Anthropic API 拒绝。+ // TODO(PR #1965): 该固定 system prompt 指令进入模型 system 段,按+ // docs/dev-rules/maker-core-and-agent-behavior.md §4 需在合并前取得维护者确认。const system = ['You are a terse predictive text engine for a coding chat input.','Return only the predicted next user message — no quotes, markdown, commentary, or multiple options.',diff --git a/apps/desktop/src/main/maker-ipc/title.ts b/apps/desktop/src/main/maker-ipc/title.tsindex 30a0491650..ed197af485 100644--- a/apps/desktop/src/main/maker-ipc/title.ts+++ b/apps/desktop/src/main/maker-ipc/title.ts@@ -447,6 +447,9 @@ export function registerMakerTitleIpc(options: RegisterMakerTitleIpcOptions = {}// 输入框推荐提示词:turn 结束后预测用户下一步输入,复用 title one-shot 基础设施。// 本 handler 会触发一次付费模型调用,按 electron-security-and-process-boundaries §5// 做 sender 断言 + 运行期 payload 校验 + DB 防御纵深(远程会话拒绝)。+ // TODO: promptPrediction.ts 中新增的 system prompt 固定指令进入模型 system 段,+ // 按 docs/dev-rules/maker-core-and-agent-behavior.md §4 需在合并前取得维护者确认。+ // 跟踪: PR #1965 review thread #3791318742ipcMain.handle(MAKER_INVOKE.PREDICT_PROMPT,async (@@ -455,6 +458,7 @@ export function registerMakerTitleIpc(options: RegisterMakerTitleIpcOptions = {}): Promise<{ prompt: string | null }> => {assertTrustedAppRendererEvent(event);const { sessionId, agentKind, turnGen } = parsePredictPromptRequest(request);+ try {// 防御纵深:即使 renderer 有 UI 守卫,main 侧也需从 DB 确认 session 真实存在且非远程// (SSH / device-link),避免受信 renderer 绕过 UI 守卫携带远程会话内容触发付费调用。// 同时拒绝 review session:reviewer 会话的 composer 被禁用(disabled),不可编辑也不可发送,@@ -561,6 +565,13 @@ export function registerMakerTitleIpc(options: RegisterMakerTitleIpcOptions = {}_predictingPromptSessions.delete(sessionId);}}+ } catch (error: unknown) {+ // 将数据库不可用、查询失败等意外错误编码为 IPC error,避免 Electron+ // 将原始 Drizzle/SQLite 异常序列化到 Renderer 侧泄露内部细节。+ if (isIpcError(error)) throw error;+ log.error('predict-prompt handler failed', { sessionId, error });+ throwIpcError('INTERNAL', 'Prompt prediction failed');+ }},);}