From 94c90dd7c98edbe57bb1d8e627cdc9f18c447bce Mon Sep 17 00:00:00 2001 From: bingshuo Date: Sun, 31 May 2026 00:42:55 +0800 Subject: [PATCH] =?UTF-8?q?v5.3:=20=E5=AE=8C=E6=95=B4=E7=89=88=E5=90=AB?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E8=A7=A3=E6=9E=90=E5=99=A8(=E7=BA=AFASCII)?= =?UTF-8?q?=20+=20recordExperience=20+=20modal=E5=AE=A1=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agents/zhuyuan-dev-agent/server.js | 32 ++++++++++++------------------ 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/agents/zhuyuan-dev-agent/server.js b/agents/zhuyuan-dev-agent/server.js index 9e842b9..653cd91 100644 --- a/agents/zhuyuan-dev-agent/server.js +++ b/agents/zhuyuan-dev-agent/server.js @@ -26,30 +26,24 @@ const PLANS_DIR = path.join(__dirname, "plans"); if (!fs.existsSync(PLANS_DIR)) fs.mkdirSync(PLANS_DIR, { recursive: true }); const START_TIME = new Date().toISOString(); -// ═══ 步骤解析器 v5.3 — 将 Notion steps 文本转为 task 对象 ═══ +// v5.3: step parser - ASCII-only, no regex on Chinese chars function parsePlanSteps(stepsText, planId) { if (!stepsText) return []; - const lines = stepsText.split("\n").filter(l => l.trim()); - const tasks = []; - let idx = 0; - for (const line of lines) { - const m = line.match(/^\s*(\d+)\.?\s+(.+)/); + var lines = stepsText.split("\n").filter(function(l) { return l.trim(); }); + var tasks = []; + var idx = 0; + for (var i = 0; i < lines.length; i++) { + var m = lines[i].match(/^\s*(\d+)\.?\s+(.+)/); if (m) { idx++; - const desc = m[2].trim(); - let action = "write_file"; - if (/安装|执行|运行|启动|重启|构建|编译/.test(desc)) action = "run_cmd"; - if (/API|接口|对接|请求|调用/.test(desc)) action = "call_api"; - if (/验证|测试|检查|确认|审核/.test(desc)) action = "check"; - tasks.push({ - id: planId + "-t" + idx, - action, - target: "", - description: desc, - context: "从Notion工单提取: " + (stepsText.slice(0, 200)) - }); + var desc = m[2].trim(); + var action = "write_file"; + var d = desc; + if (d.indexOf("API") !== -1 || d.indexOf("Notion") !== -1) action = "call_api"; + if (d.indexOf("curl") !== -1 || d.indexOf("npm") !== -1 || d.indexOf("git") !== -1) action = "run_cmd"; + tasks.push({ id: planId + "-t" + idx, action: action, target: "", description: desc, context: "Notion:" + stepsText.slice(0, 200) }); } } - console.log("[StepParser] " + planId + " → " + tasks.length + " tasks"); + console.log("[StepParser] " + planId + " -> " + tasks.length + " tasks"); return tasks; } \ No newline at end of file