From 9f10e55d5e254de38e1da5fec5954e56f04e773e Mon Sep 17 00:00:00 2001 From: Jiaqing Liang Date: Thu, 12 Mar 2026 12:59:05 +0800 Subject: [PATCH] fix: defensive CDP config init (makedirs+try/except); tweak autonomous sop wording --- agentmain.py | 5 ++++- memory/autonomous_operation_sop.md | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/agentmain.py b/agentmain.py index c9cb40c..2f3c8bd 100644 --- a/agentmain.py +++ b/agentmain.py @@ -24,7 +24,10 @@ if not os.path.exists(mem_insight): open(mem_insight, 'w', encoding='utf-8').write(open(t, encoding='utf-8').read() if os.path.exists(t) else '') cdp_cfg = os.path.join(script_dir, 'assets/tmwd_cdp_bridge/config.js') if not os.path.exists(cdp_cfg): - open(cdp_cfg, 'w', encoding='utf-8').write(f"const TID = '__ljq_{hex(random.randint(0, 99999999))[2:8]}';") + try: + os.makedirs(os.path.dirname(cdp_cfg), exist_ok=True) + open(cdp_cfg, 'w', encoding='utf-8').write(f"const TID = '__ljq_{hex(random.randint(0, 99999999))[2:8]}';") + except Exception as e: print(f'[WARN] CDP config init failed: {e} — advanced web features (tmwebdriver) will be unavailable.') def get_system_prompt(): with open(os.path.join(script_dir, 'assets/sys_prompt.txt'), 'r', encoding='utf-8') as f: prompt = f.read() diff --git a/memory/autonomous_operation_sop.md b/memory/autonomous_operation_sop.md index 50089b6..975f3e0 100644 --- a/memory/autonomous_operation_sop.md +++ b/memory/autonomous_operation_sop.md @@ -53,7 +53,7 @@ 0. 从 `TODO.txt` 取一条作为当前任务 1. update_working_checkpoint: `{选定的当前任务}\n(自主行动时长期保留)subagent任务完成后需重读自主行动sop确定验收流程` 2. 按 subagent_sop 召唤 subagent,input 需要包含以下全部内容: - - **任务**:详细介绍和要求当前任务 + 验收标准 + 一句话预期收益 + - **任务**:详细介绍和要求深入执行当前任务 + 验收标准 + 一句话预期收益 - **权限边界**:可执行只读和实验性操作;严禁修改核心记忆/系统设置;严禁读取敏感数据(可检测存在性);控制在30回合内 - 无需批准:只读探测、cwd 内写操作/脚本实验 - 需要报告:修改 global_mem.txt / memory/ 下 SOP、安装软件、外部 API 调用、删除非临时文件