lili 675a8e688b feat(cheap-worker): 便宜档 Node→Python 重写进 AgentScope spike — 范式可移植坐实
WU-A 迁移面 spike:便宜档生成核心(多轮 ReAct + 五工具沙箱 + done 门)用 Python 在新建 cheap-worker/
重写成 AgentScope agent,import 复用 tier2 框架层(model client/四道熔断/历史压缩/observability),
check/build/九门 shell-out 现有 node/cjs(不重写 esbuild/CDP/形状门)。

- U1 地基:跨包 sys.path import tier2 worker + 代理旁路 + key 从内网文档注入 env + M3 装配
- U2 五工具:read/list/write Python 实现 + check/build shell-out(形状门三态与 Node 一致)
- U3 LittleJS system prompt:prompt.mjs Python 化(两条 footgun 正反例 + 输入契约)
- U4 scaffold/stage/play 薄壳 + ensure_play_spec(据 state 形态产 play-spec 治链路假绿)
- U5 ReAct 主编排:内置 Agent+ReActConfig+外层有界 resume + done 门 + 收口 stage/smoke/九门
- U6 对照 Node:产物形态 + 九门逐门 + 过门率对比

验收:同 brief Python 新路 vs Node 旧路,产物都真 src/ 6 文件、九门都 9/9 全 PASS、过门率 1.0=1.0
→ spikePass=True。端到端单局 attempt 1 一次收敛、148s。落点 cheap-worker/ 对 tier2/amodel-gen
零改动(结构性零回归)。测试 38/38 全绿。

origin: docs/plans/2026-06-26-001-feat-cheap-worker-python-spike-plan.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 02:42:14 -07:00

70 lines
3.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

node_modules/
.pnpm-store/
dist/
build/
coverage/
.next/
.turbo/
.vite/
.env
.env.*
!.env.example
.idea/
*.log
.DS_Store
.gstack/
# ── 例外 1:源码树(src/)下名为 build 的目录是合法源码,绝非构建产物 ──
# 第 5 行笼统的 build/(为构建产物设计)会误吞 Java/前端源码中名为 build 的包/目录,例如:
# 后端 com.wanxiang.huijing.game.module.runtime.{dal.dataobject,dal.mysql,service}.build(编译任务域,4 文件)、
# 前端 game-admin/src/views/infra/build。
# 构建产物绝不落在 src/ 下,故一律豁免 src/ 下的 build/,避免克隆/CI 缺源码而编译失败。
!**/src/**/build/
!**/src/**/build/**
# ── 例外 2:game-admin(huijing 前端 fork)模块根级例外 ──
# huijing 约定将「模块根」build/(vite 插件配置源码,不在 src 下,故需单独豁免)与 .env*(前端构建配置,非密钥)纳入版本库。
!game-admin/build/
!game-admin/build/**
!game-admin/.env
!game-admin/.env.dev
!game-admin/.env.local
!game-admin/.env.prod
!game-admin/.env.stage
!game-admin/.env.test
# ── 例外 3:game-studio 联调 env(staging 后端地址 + studio token,非密钥,须入库供 mini-desktop 克隆联调)──
# 同 gitignore-swallows-frontend-source 记忆:根 .env.* 笼统忽略会吞掉 game-studio/.env.staging,
# 致 mini-desktop 匿名克隆后拿不到联调配置、vite --mode staging 起不来。故显式豁免。
!game-studio/.env.staging
# ── Python 字节码缓存:QA 编排器/评估脚本运行即生成,纯缓存可重建;目录名固定,无误吞源码风险(不同于上面 build/ 的教训)──
__pycache__/
.pytest_cache/
# ── 存储分层 H3(2026-06-16 agent-specs 目录治理,配套 .agents/rules/engineering-conventions.md §10.3)──
# docs/agent-specs/ 只放文档(*.md);spike 代码/批跑证据(hash 目录/jsonl/截图)/模型原始输出等可重生成产物不入文档树。
# __pycache__/ 与 node_modules/ 已由上方全局规则拦截;新 spike 原始 json/png 默认 untracked、勿 git add 批量产物。
# 注意(遵 gitignore-swallows-frontend-source 教训):此处不设 *.json/*.png 笼统忽略,以免误吞 contracts/ 等业务目录下的合法同类文件——分层靠规范 + 收口第 8 步执行,不靠笼统 glob。
# ── AI 生成 / e2e 批跑游戏产物:可重生成、本地跑出、不入库(2026-06-25)──
# game-runtime/games/_wg1-gen/ 下「精选参考游戏」(angrybirds/breakout/... 无前缀,含 _shared/_goldenpath-*)已跟踪、须保留;
# 下列是 agent 生成线与 e2e 批跑的输出(每次跑批产生上百个时间戳目录),纯产物、可重生成,长期污染 git diff,故忽略。
# 仍遵「专一不笼统」:只忽略已知的生成/批跑前缀,绝不忽略整个 _wg1-gen(会吞掉已跟踪的参考游戏)。
game-runtime/games/_wg1-gen/saa-saa-e2e-*/
game-runtime/games/_wg1-gen/gd-*/
game-runtime/games/_spike-local-verify/
game-runtime/games/_amodel-spike/
# ── cheap-worker 便宜档 Python spike:venv 与生成/对照产物(可重生成、不入库,2026-06-26)──
# 遵「专一不笼统」:只忽略 cheap-worker 自己的 venv 与本 spike 的 cheap-*/node-* 产物前缀,不碰已跟踪的参考游戏。
cheap-worker/.venv/
cheap-worker/results/
game-runtime/games/amgen-cheap-*/
game-runtime/games/amgen-node-*/
game-runtime/games/_wg1-gen/cheap-*/
game-runtime/games/_wg1-gen/node-*/