fix: defensive CDP config init (makedirs+try/except); tweak autonomous sop wording

This commit is contained in:
Jiaqing Liang
2026-03-12 12:59:05 +08:00
parent 03069dbd89
commit 9f10e55d5e
2 changed files with 5 additions and 2 deletions

View File

@@ -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 '') 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') cdp_cfg = os.path.join(script_dir, 'assets/tmwd_cdp_bridge/config.js')
if not os.path.exists(cdp_cfg): if not os.path.exists(cdp_cfg):
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]}';") 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(): def get_system_prompt():
with open(os.path.join(script_dir, 'assets/sys_prompt.txt'), 'r', encoding='utf-8') as f: prompt = f.read() with open(os.path.join(script_dir, 'assets/sys_prompt.txt'), 'r', encoding='utf-8') as f: prompt = f.read()

View File

@@ -53,7 +53,7 @@
0.`TODO.txt` 取一条作为当前任务 0.`TODO.txt` 取一条作为当前任务
1. update_working_checkpoint: `{选定的当前任务}\n自主行动时长期保留subagent任务完成后需重读自主行动sop确定验收流程` 1. update_working_checkpoint: `{选定的当前任务}\n自主行动时长期保留subagent任务完成后需重读自主行动sop确定验收流程`
2. 按 subagent_sop 召唤 subagentinput 需要包含以下全部内容: 2. 按 subagent_sop 召唤 subagentinput 需要包含以下全部内容:
- **任务**:详细介绍和要求当前任务 + 验收标准 + 一句话预期收益 - **任务**:详细介绍和要求深入执行当前任务 + 验收标准 + 一句话预期收益
- **权限边界**:可执行只读和实验性操作;严禁修改核心记忆/系统设置严禁读取敏感数据可检测存在性控制在30回合内 - **权限边界**:可执行只读和实验性操作;严禁修改核心记忆/系统设置严禁读取敏感数据可检测存在性控制在30回合内
- 无需批准只读探测、cwd 内写操作/脚本实验 - 无需批准只读探测、cwd 内写操作/脚本实验
- 需要报告:修改 global_mem.txt / memory/ 下 SOP、安装软件、外部 API 调用、删除非临时文件 - 需要报告:修改 global_mem.txt / memory/ 下 SOP、安装软件、外部 API 调用、删除非临时文件