@yiyi_zhang/laoshi 0.2.0-beta.1 → 0.2.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/adapters/cli/adapter.ts +53 -0
- package/adapters/cli/cli-runtime.ts +402 -0
- package/adapters/cli/drivers.ts +146 -0
- package/adapters/cli/install.mjs +28 -0
- package/adapters/cli/skill/setup.md +8 -0
- package/adapters/dsh/plugin/index.mjs +1 -1
- package/adapters/dsh/plugin/package.json +1 -1
- package/adapters/mogao/adapter.ts +1 -0
- package/adapters/mogao/install.mjs +1 -1
- package/adapters/mogao/make-expert.mjs +1 -0
- package/adapters/mogao/mogao-runtime.ts +57 -8
- package/adapters/paseo/adapter.ts +1 -1
- package/adapters/paseo/install.mjs +17 -5
- package/adapters/paseo/migrate.ts +267 -0
- package/adapters/paseo/plugin/OVERVIEW.md +9 -0
- package/adapters/paseo/plugin/client/config.tsx +216 -0
- package/adapters/paseo/plugin/client/data.ts +85 -0
- package/adapters/paseo/plugin/client/detail.tsx +342 -0
- package/adapters/paseo/plugin/client/format.ts +173 -0
- package/adapters/paseo/plugin/client/inbox.tsx +190 -0
- package/adapters/paseo/plugin/client/live.ts +161 -0
- package/adapters/paseo/plugin/client/markdown.tsx +220 -0
- package/adapters/paseo/plugin/client/models.tsx +117 -0
- package/adapters/paseo/plugin/client/nav.ts +22 -0
- package/adapters/paseo/plugin/client/overview.tsx +103 -0
- package/adapters/paseo/plugin/client/panel.tsx +56 -0
- package/adapters/paseo/plugin/client/review.tsx +80 -0
- package/adapters/paseo/plugin/client/row.tsx +63 -0
- package/adapters/paseo/plugin/client/settings.tsx +92 -0
- package/adapters/paseo/plugin/client/sidebar.tsx +27 -0
- package/adapters/paseo/plugin/client/stats.tsx +138 -0
- package/adapters/paseo/plugin/client/ui.tsx +278 -0
- package/adapters/paseo/plugin/client/web.ts +34 -0
- package/adapters/paseo/plugin/index.client.tsx +66 -0
- package/adapters/paseo/plugin/index.server.ts +61 -0
- package/adapters/paseo/plugin/package.json +22 -0
- package/adapters/paseo/plugin/paseo-plugin.json +6 -0
- package/adapters/paseo/plugin/server/handlers.ts +69 -0
- package/adapters/paseo/plugin/server/req.ts +105 -0
- package/adapters/paseo/plugin/shared/contracts.ts +286 -0
- package/adapters/paseo/plugin/shared/rk-colors.ts +35 -0
- package/adapters/paseo/plugin/tsconfig.json +16 -0
- package/adapters/paseo/plugin-cmd.mjs +233 -0
- package/bin/install.mjs +8 -7
- package/bin/req.mjs +10 -2
- package/contracts/README.md +1 -1
- package/contracts/agent-runtime.md +2 -2
- package/contracts/cli-json.md +4 -3
- package/contracts/notifier-event.md +2 -2
- package/contracts/state.md +2 -0
- package/contracts/usage-record.md +3 -3
- package/docs/design/adapter-guide.md +2 -1
- package/docs/design/cli-adapter.md +75 -0
- package/docs/design/compat-migration.md +2 -0
- package/docs/design/mogao-expert.md +3 -1
- package/docs/guide//345/234/250/346/221/270/351/253/230/344/270/212/344/275/277/347/224/250.md +132 -0
- package/docs/guide//345/256/211/350/243/205/344/270/216/345/215/207/347/272/247.md +32 -3
- package/docs/guide//347/273/264/346/212/244/350/200/205/346/214/207/345/215/227.md +4 -2
- package/docs/guide//351/241/271/347/233/256/345/256/232/345/210/266/344/270/216/350/277/220/350/241/214/350/247/204/345/210/231.md +1 -1
- package/engine/src/api.ts +4 -0
- package/engine/src/doctor.ts +3 -2
- package/engine/src/identity.ts +16 -1
- package/engine/src/main.ts +3 -1
- package/engine/src/messages.ts +1 -1
- package/engine/src/platform.ts +2 -0
- package/engine/src/runtime-loader.ts +14 -0
- package/engine/src/state.ts +2 -0
- package/engine/src/words.ts +1 -1
- package/package.json +2 -1
- package/site-dist/404.html +2 -2
- package/site-dist/assets/{app.DMAHANCl.js → app.D2ywvSfZ.js} +1 -1
- package/site-dist/assets/changelog.md.EDul9PkX.js +1 -0
- package/site-dist/assets/changelog.md.EDul9PkX.lean.js +1 -0
- package/site-dist/assets/chunks/@localSearchIndexroot.Dr_jsw66.js +1 -0
- package/site-dist/assets/chunks/{VPLocalSearchBox.COsLwqWS.js → VPLocalSearchBox.ClWffKqN.js} +1 -1
- package/site-dist/assets/chunks/{theme.CeR3HD86.js → theme.tbt16E5a.js} +2 -2
- package/site-dist/assets/guide_cli.md.BrXllHw9.js +2 -0
- package/site-dist/assets/guide_cli.md.BrXllHw9.lean.js +2 -0
- package/site-dist/assets/{guide_getting-started.md.Bytaz3L8.js → guide_getting-started.md.qAp5hWCl.js} +1 -1
- package/site-dist/assets/guide_install.md.By4WxsJG.js +24 -0
- package/site-dist/assets/guide_install.md.By4WxsJG.lean.js +24 -0
- package/site-dist/assets/guide_maintainer.md.Da1ffqxm.js +1 -0
- package/site-dist/assets/guide_maintainer.md.Da1ffqxm.lean.js +1 -0
- package/site-dist/assets/guide_mogao.md.S0eln1Pr.js +10 -0
- package/site-dist/assets/guide_mogao.md.S0eln1Pr.lean.js +10 -0
- package/site-dist/assets/{guide_project.md.BIcaDhdS.js → guide_project.md.B2cmf8YF.js} +1 -1
- package/site-dist/assets/{guide_project.md.BIcaDhdS.lean.js → guide_project.md.B2cmf8YF.lean.js} +1 -1
- package/site-dist/assets/reference_contracts_agent-runtime.md.DPE2FJFc.js +1 -0
- package/site-dist/assets/{reference_contracts_agent-runtime.md.TK7Lhwdf.lean.js → reference_contracts_agent-runtime.md.DPE2FJFc.lean.js} +1 -1
- package/site-dist/assets/reference_contracts_cli-json.md.D6vfWOD9.js +1 -0
- package/site-dist/assets/reference_contracts_cli-json.md.D6vfWOD9.lean.js +1 -0
- package/site-dist/assets/{reference_contracts_index.md.dqNwNs6U.js → reference_contracts_index.md.B5P4FjRk.js} +1 -1
- package/site-dist/assets/{reference_contracts_index.md.dqNwNs6U.lean.js → reference_contracts_index.md.B5P4FjRk.lean.js} +1 -1
- package/site-dist/assets/{reference_contracts_notifier-event.md.D6we9wWS.js → reference_contracts_notifier-event.md.BeR8iODP.js} +1 -1
- package/site-dist/assets/{reference_contracts_notifier-event.md.D6we9wWS.lean.js → reference_contracts_notifier-event.md.BeR8iODP.lean.js} +1 -1
- package/site-dist/assets/reference_contracts_state.md.DLygjkfs.js +1 -0
- package/site-dist/assets/reference_contracts_usage-record.md.CgfMoYp0.js +10 -0
- package/site-dist/assets/reference_contracts_usage-record.md.CgfMoYp0.lean.js +10 -0
- package/site-dist/assets/{reference_design_adapter-guide.md.BSziZJSM.js → reference_design_adapter-guide.md.B_P-spS5.js} +2 -2
- package/site-dist/assets/{reference_design_adapter-guide.md.BSziZJSM.lean.js → reference_design_adapter-guide.md.B_P-spS5.lean.js} +2 -2
- package/site-dist/assets/reference_design_cli-adapter.md.pJy3x6Un.js +13 -0
- package/site-dist/assets/reference_design_cli-adapter.md.pJy3x6Un.lean.js +13 -0
- package/site-dist/changelog.html +5 -5
- package/site-dist/guide/cli.html +31 -0
- package/site-dist/guide/dsh.html +5 -5
- package/site-dist/guide/getting-started.html +5 -5
- package/site-dist/guide/how-it-works.html +4 -4
- package/site-dist/guide/index.html +4 -4
- package/site-dist/guide/install.html +13 -8
- package/site-dist/guide/intranet.html +5 -5
- package/site-dist/guide/maintainer.html +5 -5
- package/site-dist/guide/mogao.html +39 -0
- package/site-dist/guide/phases.html +4 -4
- package/site-dist/guide/project.html +6 -6
- package/site-dist/guide/user.html +4 -4
- package/site-dist/hashmap.json +1 -1
- package/site-dist/index.html +4 -4
- package/site-dist/reference/adr/0001-new-repo-core-and-adapters.html +4 -4
- package/site-dist/reference/adr/0002-two-orchestration-modes.html +4 -4
- package/site-dist/reference/adr/0003-generate-once-then-lock.html +4 -4
- package/site-dist/reference/adr/0004-external-contracts-stay-stable.html +4 -4
- package/site-dist/reference/adr/0005-skill-names.html +4 -4
- package/site-dist/reference/adr/0006-deterministic-engine-platform-capabilities.html +4 -4
- package/site-dist/reference/adr/0007-one-install-many-repos.html +4 -4
- package/site-dist/reference/adr/0008-capability-sources-and-platform-plugin.html +4 -4
- package/site-dist/reference/adr/index.html +4 -4
- package/site-dist/reference/commands.html +4 -4
- package/site-dist/reference/config.html +4 -4
- package/site-dist/reference/contracts/agent-runtime.html +5 -5
- package/site-dist/reference/contracts/cli-json.html +5 -5
- package/site-dist/reference/contracts/feature-files.html +4 -4
- package/site-dist/reference/contracts/index.html +5 -5
- package/site-dist/reference/contracts/notifier-event.html +6 -6
- package/site-dist/reference/contracts/result-file.html +4 -4
- package/site-dist/reference/contracts/spec.html +4 -4
- package/site-dist/reference/contracts/state.html +5 -5
- package/site-dist/reference/contracts/usage-record.html +6 -6
- package/site-dist/reference/contracts/verify.html +4 -4
- package/site-dist/reference/design/adapter-guide.html +6 -6
- package/site-dist/reference/design/architecture.html +4 -4
- package/site-dist/reference/design/builtin-capabilities.html +4 -4
- package/site-dist/reference/design/cli-adapter.html +42 -0
- package/site-dist/reference/design/platform-vocabulary.html +4 -4
- package/site-dist/reference/scope.html +4 -4
- package/site-dist/assets/changelog.md.Q8QGpuBY.js +0 -1
- package/site-dist/assets/changelog.md.Q8QGpuBY.lean.js +0 -1
- package/site-dist/assets/chunks/@localSearchIndexroot.CQdjFK3w.js +0 -1
- package/site-dist/assets/guide_install.md.D7NiiOPu.js +0 -19
- package/site-dist/assets/guide_install.md.D7NiiOPu.lean.js +0 -19
- package/site-dist/assets/guide_maintainer.md.C-Vt-DdK.js +0 -1
- package/site-dist/assets/guide_maintainer.md.C-Vt-DdK.lean.js +0 -1
- package/site-dist/assets/reference_contracts_agent-runtime.md.TK7Lhwdf.js +0 -1
- package/site-dist/assets/reference_contracts_cli-json.md.Bonk0m6-.js +0 -1
- package/site-dist/assets/reference_contracts_cli-json.md.Bonk0m6-.lean.js +0 -1
- package/site-dist/assets/reference_contracts_state.md.DVHC4opX.js +0 -1
- package/site-dist/assets/reference_contracts_usage-record.md.CQI2chqh.js +0 -10
- package/site-dist/assets/reference_contracts_usage-record.md.CQI2chqh.lean.js +0 -10
- /package/site-dist/assets/{guide_getting-started.md.Bytaz3L8.lean.js → guide_getting-started.md.qAp5hWCl.lean.js} +0 -0
- /package/site-dist/assets/{reference_contracts_state.md.DVHC4opX.lean.js → reference_contracts_state.md.DLygjkfs.lean.js} +0 -0
|
@@ -31,7 +31,7 @@ import{_ as e,o as a,c as n,j as l,a as i}from"./chunks/framework.BetZR81g.js";c
|
|
|
31
31
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "test"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"command"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"npm test"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," },")]),i(`
|
|
32
32
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "web"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"type"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"service"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"command"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"node scripts/paseo/with-port.mjs npm run dev -- --port {PORT}"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," }")]),i(`
|
|
33
33
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," }")]),i(`
|
|
34
|
-
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),l("p",null,[l("code",null,"paseo.json"),i(" 是团队共用的,而 Paseo 在各系统上用不同的 shell 执行它的命令(macOS/Linux:bash 和 sh;Windows:准备命令用 PowerShell,带 "),l("code",null,"-ExecutionPolicy Bypass"),i(",不受执行策略限制;脚本和服务用 cmd.exe)。所以 "),l("code",null,"/laoshi-setup"),i(" 只写各系统一样的命令,用到环境变量的地方交给它写进项目的两个小脚本:"),l("code",null,"scripts/paseo/copy-local-files.mjs"),i("(从来源目录复制不提交的本地文件,没有就跳过)和 "),l("code",null,"scripts/paseo/with-port.mjs"),i("(把 "),l("code",null,"{PORT}"),i(" 换成 Paseo 分配的端口,并设置 "),l("code",null,"PORT"),i(")。手写 "),l("code",null,"$PASEO_PORT"),i("、"),l("code",null,"%PASEO_PORT%"),i("、"),l("code",null,"cp"),i("、"),l("code",null,"Copy-Item"),i(" 这类只在某个系统上能用的命令时,"),l("code",null,"/laoshi-doctor"),i(" 会指出:在本机上会失败的标为⚠,只是换系统会失败的给出提示。")]),l("ul",null,[l("li",null,[l("code",null,"worktree.setup"),i(":Paseo 新建 worktree 工作区时自动执行,新需求的工作区一建好就装好了依赖、带上了本地配置。")]),l("li",null,[l("code",null,'"type": "service"'),i(" 的脚本:流水线在服务启动验证、功能验证、缺陷修复和复验之前,通过 Paseo 带着当前代码重启它们,把地址("),l("code",null,"http://web--<分支>--<项目>.localhost:6767"),i(" 这样的代理地址)交给步骤 agent,验证结束后停止。Paseo 为每个工作区分配独立端口,几个需求同时验证不会冲突,服务必须监听 Paseo 分配的端口(环境变量 "),l("code",null,"PASEO_PORT"),i(",用 "),l("code",null,"with-port.mjs"),i(" 传给程序)。")]),l("li",null,[i("服务没有启动成功时,最后的输出写到功能目录的 "),l("code",null,".pipeline/services/<服务名>.log"),i(",交给步骤 agent 查原因。")]),l("li",null,[i("只有从 Paseo 对话启动的流水线才会这样做(需要知道是哪个工作区)。不想用时在配置中设 "),l("code",null,'"platformServices": "off"'),i(",步骤 agent 会像以前一样自己启动服务。"),l("code",null,"serviceReadySeconds"),i("(默认 120)是等待服务就绪的时间。")]),l("li",null,[i("在 Paseo 设置中打开 "),l("strong",null,"Enable Paseo tools"),i(" 后,步骤 agent 改完代码还可以自己重启这些服务。")]),l("li",null,"写错时服务起不来,流水线会改由步骤 agent 自己启动服务,不会中断。"),l("li",null,[i("PowerShell 被完全禁用(不只是执行策略)的 Windows 机器上,"),l("code",null,"worktree.setup"),i(" 无法执行;新工作区不会自动装依赖,步骤 agent 会按验证方法自己准备。")])]),l("h2",{id:"额度提醒",tabindex:"-1"},[i("额度提醒 "),l("a",{class:"header-anchor",href:"#额度提醒","aria-label":'Permalink to "额度提醒"'},"")]),l("p",null,[i("开始前,流水线读取 Paseo 的用量信息(需要 Paseo 能读到对应 agent 的订阅用量)。所用 agent 的某个额度窗口用到 "),l("code",null,"quotaWarnPercent"),i("(默认 85)以上时,在对话里提醒一次,流水线照常进行;用完时遇到限流会自动等待重试。设为 0 关闭提醒。")]),l("h2",{id:"token-预算和用时估算",tabindex:"-1"},[i("token 预算和用时估算 "),l("a",{class:"header-anchor",href:"#token-预算和用时估算","aria-label":'Permalink to "token 预算和用时估算"'},"")]),l("p",null,"内网模型通常不报金额,所以按 token(输入 + 输出)计:"),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"说明")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"budget.tokens")]),l("td",null,[l("code",null,"null"),i("(不限)")]),l("td",null,[i("一个需求所有步骤、所有尝试合计最多用多少 tokens,例如 "),l("code",null,"3000000"),i('。每个新步骤开始前检查:用完时,已完成的步骤都保留,流水线在下一步开始前停下(状态"已中断",停下原因 '),l("code",null,"budget"),i("),请对话问需求方是否继续;继续("),l("code",null,"laoshi resume"),i(' 或在对话里说"继续开发")会再给一份同样多的预算')])]),l("tr",null,[l("td",null,[l("code",null,"budget.warnPercent")]),l("td",null,"80"),l("td",null,[i("用到预算的这个比例时在对话里告知一次(不停),同时发 "),l("code",null,"milestone"),i(" 外部通知")])])])]),l("p",null,[i("写在本机、团队或项目配置中都可以,例如 "),l("code",null,'"budget": { "tokens": 3000000 }'),i("。还没有数据时,先不设预算跑几个需求,用 "),l("code",null,"laoshi stats"),i(' 的"token 花在哪"看每个需求的中位数,再按它的两三倍设。')]),l("p",null,[i("agent 不报告 token 用量时(有些模型或接入方式不报告),预算不会起作用:设了预算的需求在第一个步骤结束后会在对话里说明一次,流水线照常继续;"),l("code",null,"laoshi doctor"),i(" 也会检查本机最近的需求有没有用量数据。")]),l("p",null,[i('用时估算不用配置:本机已完成的同档位需求有 3 个以上时,开始开发的回复里写出"agent 合计用时和 token 的中位数"作为参考;'),l("code",null,"laoshi status"),i(' 和插件的需求页面显示"预计还要约多久"(按中位数减去已用的 agent 时间,不含等人的时间),超过中位数时如实说"已超过通常的用时"。')]),l("h2",{id:"并行编排-确认前审阅、方案提案、浏览器验证",tabindex:"-1"},[i("并行编排:确认前审阅、方案提案、浏览器验证 "),l("a",{class:"header-anchor",href:"#并行编排-确认前审阅、方案提案、浏览器验证","aria-label":'Permalink to "并行编排:确认前审阅、方案提案、浏览器验证"'},"")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"作用")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"specReview")]),l("td",null,[l("code",null,'"standard"')]),l("td",null,[i("请需求方确认之前,由 reviewer 在后台独立审阅需求说明草稿,问题写进 "),l("code",null,"spec-review.md"),i("。"),l("code",null,'"always"'),i(" 快速档也做,"),l("code",null,'"off"'),i(" 关闭")])]),l("tr",null,[l("td",null,[l("code",null,"designProposals")]),l("td",null,"关闭"),l("td",null,[l("code",null,'{"enabled": true}'),i(" 后,标准档的方案设计之前由几个 agent 并行各提一份方案("),l("code",null,"design-proposals/"),i("),方案设计比较后决定。"),l("code",null,"members"),i(" 不写时用 builder 和 reviewer,也可以像评审小组一样列出成员(可用 "),l("code",null,"platformProfile"),i(")。需求变更后的增量继续不做")])]),l("tr",null,[l("td",null,[l("code",null,"browserVerify")]),l("td",null,[l("code",null,'"auto"')]),l("td",null,[i("功能验证、缺陷修复、复验检查网页界面的方式。总是附上界面检查命令 "),l("code",null,"laoshi ui-check"),i(":用本机的 Edge 或 Chrome(无界面)打开页面,按电脑和手机宽度用文字报告显示不全、遮挡、超出屏幕、图片没加载、文字太淡、控件没有名字、控制台报错和请求失败,并和确认过的原型逐项对文字;不需要模型看图,也不需要 Paseo 桌面端。第一次使用时从 npm 源安装 "),l("code",null,"playwright-core"),i(" 到 "),l("code",null,"~/.laoshi/tools"),i("(不下载浏览器)。步骤 agent 还有 Paseo 浏览器工具(桌面端在线)时,另外按验收标准在浏览器中实际操作。"),l("code",null,'"off"'),i(" 都不用")])])])]),l("p",null,[i("Paseo 自带的 "),l("code",null,"/paseo-advisor"),i("、"),l("code",null,"/paseo-committee"),i(" 等编排 skill 也可以单独使用,例如对一个疑难问题请两个模型分别分析;它们不参与流水线(见 ADR 0019)。")]),l("h2",{id:"自动新建工作区-可选",tabindex:"-1"},[i("自动新建工作区(可选) "),l("a",{class:"header-anchor",href:"#自动新建工作区-可选","aria-label":'Permalink to "自动新建工作区(可选)"'},"")]),l("p",null,[i("在项目主目录、主分支上发起的需求,可以用 "),l("code",null,"--worktree"),i(" 启动("),l("code",null,"/laoshi"),i(' 中的"启动(自动新建工作区)"):流水线从当前分支切出 '),l("code",null,"feature/<功能目录名>"),i(",在 Paseo 中新建 worktree 工作区,把需求说明移过去并提交,之后的步骤都在那个工作区中运行,仍然挂在发起的对话下。对话的工作目录不变,查看进度、暂停、继续都在原对话中进行;读写需求文件用通知中给出的完整路径。只能在第一次启动时选择。见 ADR 0018。")]),l("ul",null,[l("li",null,[l("strong",null,"启动没成功也能接着做。"),i(" 工作区一建好就记下来("),l("code",null,"~/.laoshi/worktrees/"),i(')。之后不管哪一步失败(建工作区慢、启动前的检查没通过),再次执行启动命令都会在这个工作区里接着开始,不会报"分支已存在",也不会留下只有需求说明的分支。新建工作区最多等 15 分钟(以前是 2 分钟,大仓库在 Windows 上常常不够)。以前版本留下的"分支和工作区都在、开发没开始"的,也会由 Paseo 接手那个目录接着做。')]),l("li",null,[l("strong",null,[i("访谈改过的 "),l("code",null,"GLOSSARY.md"),i("、"),l("code",null,"docs/adr/"),i(" 一起带过去")]),i(",和需求说明在需求自己的分支上一起提交;主目录里的这些未提交改动保留不动(可能和别的改动在一起),确认后可以撤销。")]),l("li",null,[l("strong",null,"如实提示起点的问题"),i(":需求说明已经提交在主分支上、本地主分支比远端落后、主目录里还有别的未提交改动时,启动结果里会写明。流水线不改动主分支。")])]),l("h2",{id:"调度-预约、提醒、自动继续、排队",tabindex:"-1"},[i("调度:预约、提醒、自动继续、排队 "),l("a",{class:"header-anchor",href:"#调度-预约、提醒、自动继续、排队","aria-label":'Permalink to "调度:预约、提醒、自动继续、排队"'},"")]),l("p",null,'需要"以后再做"的事,流水线用 Paseo 的定时任务把一条写明步骤的消息发回发起的对话,由对话 agent 执行(机器或 daemon 重启后仍然有效,在 Paseo 的 Schedules 中可以看到)。暂停命令会取消这些预约。'),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"作用")])]),l("tbody",null,[l("tr",null,[l("td",null,[i("(启动参数 "),l("code",null,"--at"),i(")")]),l("td",null,"—"),l("td",null,[i("预约开始时间:"),l("code",null,"22:00"),i("、"),l("code",null,"明天 8:30"),i("、"),l("code",null,"2026-10-14 08:30"),i("、"),l("code",null,"+2h")])]),l("tr",null,[l("td",null,[l("code",null,"waitingReminderHours")]),l("td",null,"24"),l("td",null,"等待需求方回答、或研发完成后等待测试验证超过这么久,在对话里提醒一次;0 关闭")]),l("tr",null,[l("td",null,[i("(启动参数 "),l("code",null,"--verify-at"),i(")")]),l("td",null,"—"),l("td",null,[i("分阶段时,研发完成后在这个时间自动开始测试验证(写法同 "),l("code",null,"--at"),i(";隐含分阶段)。研发完成时时间已过就直接继续")])]),l("tr",null,[l("td",null,[l("code",null,"autoResumeMinutes"),i(" / "),l("code",null,"autoResumeMax")]),l("td",null,"30 / 2"),l("td",null,"临时错误(重试用完)中断后,这么久之后在对话里自动继续;每次尝试最多几次;0 关闭")]),l("tr",null,[l("td",null,[l("code",null,"watchdogMinutes")]),l("td",null,"60"),l("td",null,[i('运行期间对话定时检查,后台进程意外退出时自动继续。每次检查对话 agent 会运行一个回合;0 关闭。装了 req-kit 插件时,插件每 5 分钟在 daemon 里直接检查本机所有需求,发现"运行中但后台进程已不在"的就执行 '),l("code",null,"laoshi resume"),i("(不经过模型,每个进程只继续一次,每个需求 24 小时内最多 3 次),这时不再预约对话的定时检查;插件设为只读时不做。接单器("),l("code",null,"laoshi factory"),i(")每次检查也同样直接继续")])]),l("tr",null,[l("td",null,[l("code",null,"maxConcurrentPipelines")]),l("td",null,"0(不限)"),l("td",null,"本机同时运行的流水线上限,满了排队。只能写在本机配置中才有意义")])])]),l("h2",{id:"需求总览",tabindex:"-1"},[i("需求总览 "),l("a",{class:"header-anchor",href:"#需求总览","aria-label":'Permalink to "需求总览"'},"")]),l("p",null,[l("code",null,"laoshi digest"),i(' 在项目目录中列出所有工作区里的需求,按"需要处理、待验收、开发中、对齐中、已验收(最近 7 天)"分组,附用时与用量。'),l("code",null,"--notify"),i(" 同时发给外部通知(事件类型 "),l("code",null,"digest"),i(");"),l("code",null,'--schedule "<cron>"'),i(" 让 Paseo 按时间表(本机时区)启动一个短暂的 agent 执行 "),l("code",null,"laoshi digest --notify"),i(",例如每周一 9 点:"),l("code",null,'laoshi digest --schedule "0 9 * * 1"'),i(";取消:"),l("code",null,"laoshi digest --cancel <定时任务 ID>"),i("。")]),l("h2",{id:"使用统计",tabindex:"-1"},[i("使用统计 "),l("a",{class:"header-anchor",href:"#使用统计","aria-label":'Permalink to "使用统计"'},"")]),l("p",null,[i("每次流水线运行结束时,引擎在本机的 "),l("code",null,"~/.laoshi/usage/runs.jsonl"),i(" 追加一条记录:各步骤的用时和用量、质量门、评审和缺陷轮数、结束时的状态(格式见 "),l("a",{href:"./../reference/contracts/usage-record"},"使用记录"),i(")。只记在本机,不记需求内容和代码,也不会自动发往任何地方。")]),l("ul",null,[l("li",null,[l("code",null,"laoshi stats"),i(":最近 30 天的统计("),l("code",null,"--since 2w"),i("、"),l("code",null,"--since 2026-10-01"),i("、"),l("code",null,"--month 2026-10"),i('):有进展和完成的需求数、交付周期、返工(评审轮数、需要缺陷修复的占比、质量门失败)、各种等待的时长、各步骤用时、用量,以及不同 builder 的比较。有"token 花在哪"一节:按步骤和按模型的 token 及占比、返工(方案修订、评审问题修复、缺陷修复、复验,以及第 2 轮起的审核和评审)的占比、输入中来自提示缓存的比例、每个完成需求的中位数;插件的"使用统计"页用条形图显示同样的内容。'),l("code",null,"--json"),i("、"),l("code",null,"--csv"),i(" 输出机器可读的格式。")]),l("li",null,[l("code",null,"laoshi stats --report --month 2026-10 [--out 目录]"),i(":生成给管理方汇报用的两份文件:"),l("code",null,"laoshi-usage-2026-10.md"),i("(汇总)和 "),l("code",null,".csv"),i("(每个需求一行,可以用表格软件打开)。")]),l("li",null,[i("几台机器一起汇报:每台机器运行 "),l("code",null,"laoshi stats --month 2026-10 --export"),i(",得到 "),l("code",null,"laoshi-usage-<主机名>-<日期>.jsonl"),i(";把这些文件放到一起,运行 "),l("code",null,"laoshi stats --merge <文件…> --month 2026-10 --report"),i("。")])]),l("p",null,[i("本机的需求索引 "),l("code",null,"~/.laoshi/index/"),i(" 记录每个运行过的需求在哪个目录,Paseo 插件据此在一个页面列出本机所有项目的需求。从 paseo-req-kit 迁来的或索引缺失的需求,在项目目录运行一次 "),l("code",null,"laoshi index --rebuild"),i(" 补登;目录删掉后用 "),l("code",null,"laoshi index --prune"),i(" 清理。")]),l("h2",{id:"外部系统对接-需求管理等",tabindex:"-1"},[i("外部系统对接(需求管理等) "),l("a",{class:"header-anchor",href:"#外部系统对接-需求管理等","aria-label":'Permalink to "外部系统对接(需求管理等)"'},"")]),l("p",null,"流水线可以把需求同步到团队的需求管理系统:需求开始时建一张卡片,之后每到一个阶段改卡片的状态,卡片编号和链接写回需求,显示在进度、完成报告和 Paseo 插件里。对接的是本机已有的命令行工具(例如需求管理系统的 CLI),写在本机或团队配置中(它会运行命令,项目配置中的会被忽略):"),l("div",{class:"language-json vp-adaptive-theme"},[l("button",{title:"Copy Code",class:"copy"}),l("span",{class:"lang"},"json"),l("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[l("code",null,[l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"integrations"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": [")]),i(`
|
|
34
|
+
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),l("p",null,[l("code",null,"paseo.json"),i(" 是团队共用的,而 Paseo 在各系统上用不同的 shell 执行它的命令(macOS/Linux:bash 和 sh;Windows:准备命令用 PowerShell,带 "),l("code",null,"-ExecutionPolicy Bypass"),i(",不受执行策略限制;脚本和服务用 cmd.exe)。所以 "),l("code",null,"/laoshi-setup"),i(" 只写各系统一样的命令,用到环境变量的地方交给它写进项目的两个小脚本:"),l("code",null,"scripts/paseo/copy-local-files.mjs"),i("(从来源目录复制不提交的本地文件,没有就跳过)和 "),l("code",null,"scripts/paseo/with-port.mjs"),i("(把 "),l("code",null,"{PORT}"),i(" 换成 Paseo 分配的端口,并设置 "),l("code",null,"PORT"),i(")。手写 "),l("code",null,"$PASEO_PORT"),i("、"),l("code",null,"%PASEO_PORT%"),i("、"),l("code",null,"cp"),i("、"),l("code",null,"Copy-Item"),i(" 这类只在某个系统上能用的命令时,"),l("code",null,"/laoshi-doctor"),i(" 会指出:在本机上会失败的标为⚠,只是换系统会失败的给出提示。")]),l("ul",null,[l("li",null,[l("code",null,"worktree.setup"),i(":Paseo 新建 worktree 工作区时自动执行,新需求的工作区一建好就装好了依赖、带上了本地配置。")]),l("li",null,[l("code",null,'"type": "service"'),i(" 的脚本:流水线在服务启动验证、功能验证、缺陷修复和复验之前,通过 Paseo 带着当前代码重启它们,把地址("),l("code",null,"http://web--<分支>--<项目>.localhost:6767"),i(" 这样的代理地址)交给步骤 agent,验证结束后停止。Paseo 为每个工作区分配独立端口,几个需求同时验证不会冲突,服务必须监听 Paseo 分配的端口(环境变量 "),l("code",null,"PASEO_PORT"),i(",用 "),l("code",null,"with-port.mjs"),i(" 传给程序)。")]),l("li",null,[i("服务没有启动成功时,最后的输出写到功能目录的 "),l("code",null,".pipeline/services/<服务名>.log"),i(",交给步骤 agent 查原因。")]),l("li",null,[i("只有从 Paseo 对话启动的流水线才会这样做(需要知道是哪个工作区)。不想用时在配置中设 "),l("code",null,'"platformServices": "off"'),i(",步骤 agent 会像以前一样自己启动服务。"),l("code",null,"serviceReadySeconds"),i("(默认 120)是等待服务就绪的时间。")]),l("li",null,[i("在 Paseo 设置中打开 "),l("strong",null,"Enable Paseo tools"),i(" 后,步骤 agent 改完代码还可以自己重启这些服务。")]),l("li",null,"写错时服务起不来,流水线会改由步骤 agent 自己启动服务,不会中断。"),l("li",null,[i("PowerShell 被完全禁用(不只是执行策略)的 Windows 机器上,"),l("code",null,"worktree.setup"),i(" 无法执行;新工作区不会自动装依赖,步骤 agent 会按验证方法自己准备。")])]),l("h2",{id:"额度提醒",tabindex:"-1"},[i("额度提醒 "),l("a",{class:"header-anchor",href:"#额度提醒","aria-label":'Permalink to "额度提醒"'},"")]),l("p",null,[i("开始前,流水线读取 Paseo 的用量信息(需要 Paseo 能读到对应 agent 的订阅用量)。所用 agent 的某个额度窗口用到 "),l("code",null,"quotaWarnPercent"),i("(默认 85)以上时,在对话里提醒一次,流水线照常进行;用完时遇到限流会自动等待重试。设为 0 关闭提醒。")]),l("h2",{id:"token-预算和用时估算",tabindex:"-1"},[i("token 预算和用时估算 "),l("a",{class:"header-anchor",href:"#token-预算和用时估算","aria-label":'Permalink to "token 预算和用时估算"'},"")]),l("p",null,"内网模型通常不报金额,所以按 token(输入 + 输出)计:"),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"说明")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"budget.tokens")]),l("td",null,[l("code",null,"null"),i("(不限)")]),l("td",null,[i("一个需求所有步骤、所有尝试合计最多用多少 tokens,例如 "),l("code",null,"3000000"),i('。每个新步骤开始前检查:用完时,已完成的步骤都保留,流水线在下一步开始前停下(状态"已中断",停下原因 '),l("code",null,"budget"),i("),请对话问需求方是否继续;继续("),l("code",null,"laoshi resume"),i(' 或在对话里说"继续开发")会再给一份同样多的预算')])]),l("tr",null,[l("td",null,[l("code",null,"budget.warnPercent")]),l("td",null,"80"),l("td",null,[i("用到预算的这个比例时在对话里告知一次(不停),同时发 "),l("code",null,"milestone"),i(" 外部通知")])])])]),l("p",null,[i("写在本机、团队或项目配置中都可以,例如 "),l("code",null,'"budget": { "tokens": 3000000 }'),i("。还没有数据时,先不设预算跑几个需求,用 "),l("code",null,"laoshi stats"),i(' 的"token 花在哪"看每个需求的中位数,再按它的两三倍设。')]),l("p",null,[i("agent 不报告 token 用量时(有些模型或接入方式不报告),预算不会起作用:设了预算的需求在第一个步骤结束后会在对话里说明一次,流水线照常继续;"),l("code",null,"laoshi doctor"),i(" 也会检查本机最近的需求有没有用量数据。")]),l("p",null,[i('用时估算不用配置:本机已完成的同档位需求有 3 个以上时,开始开发的回复里写出"agent 合计用时和 token 的中位数"作为参考;'),l("code",null,"laoshi status"),i(' 和插件的需求页面显示"预计还要约多久"(按中位数减去已用的 agent 时间,不含等人的时间),超过中位数时如实说"已超过通常的用时"。')]),l("h2",{id:"并行编排-确认前审阅、方案提案、浏览器验证",tabindex:"-1"},[i("并行编排:确认前审阅、方案提案、浏览器验证 "),l("a",{class:"header-anchor",href:"#并行编排-确认前审阅、方案提案、浏览器验证","aria-label":'Permalink to "并行编排:确认前审阅、方案提案、浏览器验证"'},"")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"作用")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"specReview")]),l("td",null,[l("code",null,'"standard"')]),l("td",null,[i("请需求方确认之前,由 reviewer 在后台独立审阅需求说明草稿,问题写进 "),l("code",null,"spec-review.md"),i("。"),l("code",null,'"always"'),i(" 快速档也做,"),l("code",null,'"off"'),i(" 关闭")])]),l("tr",null,[l("td",null,[l("code",null,"designProposals")]),l("td",null,"关闭"),l("td",null,[l("code",null,'{"enabled": true}'),i(" 后,标准档的方案设计之前由几个 agent 并行各提一份方案("),l("code",null,"design-proposals/"),i("),方案设计比较后决定。"),l("code",null,"members"),i(" 不写时用 builder 和 reviewer,也可以像评审小组一样列出成员(可用 "),l("code",null,"platformProfile"),i(")。需求变更后的增量继续不做")])]),l("tr",null,[l("td",null,[l("code",null,"browserVerify")]),l("td",null,[l("code",null,'"auto"')]),l("td",null,[i("功能验证、缺陷修复、复验检查网页界面的方式。总是附上界面检查命令 "),l("code",null,"laoshi ui-check"),i(":用本机的 Edge 或 Chrome(无界面)打开页面,按电脑和手机宽度用文字报告显示不全、遮挡、超出屏幕、图片没加载、文字太淡、控件没有名字、控制台报错和请求失败,并和确认过的原型逐项对文字;不需要模型看图,也不需要 Paseo 桌面端。第一次使用时从 npm 源安装 "),l("code",null,"playwright-core"),i(" 到 "),l("code",null,"~/.laoshi/tools"),i("(不下载浏览器)。步骤 agent 还有 Paseo 浏览器工具(桌面端在线)时,另外按验收标准在浏览器中实际操作。"),l("code",null,'"off"'),i(" 都不用")])])])]),l("p",null,[i("Paseo 自带的 "),l("code",null,"/paseo-advisor"),i("、"),l("code",null,"/paseo-committee"),i(" 等编排 skill 也可以单独使用,例如对一个疑难问题请两个模型分别分析;它们不参与流水线(见 ADR 0019)。")]),l("h2",{id:"自动新建工作区-可选",tabindex:"-1"},[i("自动新建工作区(可选) "),l("a",{class:"header-anchor",href:"#自动新建工作区-可选","aria-label":'Permalink to "自动新建工作区(可选)"'},"")]),l("p",null,[i("在项目主目录、主分支上发起的需求,可以用 "),l("code",null,"--worktree"),i(" 启动("),l("code",null,"/laoshi"),i(' 中的"启动(自动新建工作区)"):流水线从当前分支切出 '),l("code",null,"feature/<功能目录名>"),i(",在 Paseo 中新建 worktree 工作区,把需求说明移过去并提交,之后的步骤都在那个工作区中运行,仍然挂在发起的对话下。对话的工作目录不变,查看进度、暂停、继续都在原对话中进行;读写需求文件用通知中给出的完整路径。只能在第一次启动时选择。见 ADR 0018。")]),l("ul",null,[l("li",null,[l("strong",null,"启动没成功也能接着做。"),i(" 工作区一建好就记下来("),l("code",null,"~/.laoshi/worktrees/"),i(')。之后不管哪一步失败(建工作区慢、启动前的检查没通过),再次执行启动命令都会在这个工作区里接着开始,不会报"分支已存在",也不会留下只有需求说明的分支。新建工作区最多等 15 分钟(以前是 2 分钟,大仓库在 Windows 上常常不够)。以前版本留下的"分支和工作区都在、开发没开始"的,也会由 Paseo 接手那个目录接着做。')]),l("li",null,[l("strong",null,[i("访谈改过的 "),l("code",null,"GLOSSARY.md"),i("、"),l("code",null,"docs/adr/"),i(" 一起带过去")]),i(",和需求说明在需求自己的分支上一起提交;主目录里的这些未提交改动保留不动(可能和别的改动在一起),确认后可以撤销。")]),l("li",null,[l("strong",null,"如实提示起点的问题"),i(":需求说明已经提交在主分支上、本地主分支比远端落后、主目录里还有别的未提交改动时,启动结果里会写明。流水线不改动主分支。")])]),l("h2",{id:"调度-预约、提醒、自动继续、排队",tabindex:"-1"},[i("调度:预约、提醒、自动继续、排队 "),l("a",{class:"header-anchor",href:"#调度-预约、提醒、自动继续、排队","aria-label":'Permalink to "调度:预约、提醒、自动继续、排队"'},"")]),l("p",null,'需要"以后再做"的事,流水线用 Paseo 的定时任务把一条写明步骤的消息发回发起的对话,由对话 agent 执行(机器或 daemon 重启后仍然有效,在 Paseo 的 Schedules 中可以看到)。暂停命令会取消这些预约。'),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"作用")])]),l("tbody",null,[l("tr",null,[l("td",null,[i("(启动参数 "),l("code",null,"--at"),i(")")]),l("td",null,"—"),l("td",null,[i("预约开始时间:"),l("code",null,"22:00"),i("、"),l("code",null,"明天 8:30"),i("、"),l("code",null,"2026-10-14 08:30"),i("、"),l("code",null,"+2h")])]),l("tr",null,[l("td",null,[l("code",null,"waitingReminderHours")]),l("td",null,"24"),l("td",null,"等待需求方回答、或研发完成后等待测试验证超过这么久,在对话里提醒一次;0 关闭")]),l("tr",null,[l("td",null,[i("(启动参数 "),l("code",null,"--verify-at"),i(")")]),l("td",null,"—"),l("td",null,[i("分阶段时,研发完成后在这个时间自动开始测试验证(写法同 "),l("code",null,"--at"),i(";隐含分阶段)。研发完成时时间已过就直接继续")])]),l("tr",null,[l("td",null,[l("code",null,"autoResumeMinutes"),i(" / "),l("code",null,"autoResumeMax")]),l("td",null,"30 / 2"),l("td",null,"临时错误(重试用完)中断后,这么久之后在对话里自动继续;每次尝试最多几次;0 关闭")]),l("tr",null,[l("td",null,[l("code",null,"watchdogMinutes")]),l("td",null,"60"),l("td",null,[i("运行期间对话定时检查,后台进程意外退出时自动继续。每次检查对话 agent 会运行一个回合;0 关闭。装了 Paseo 的需求插件("),l("code",null,"laoshi plugin install"),i(')时,插件每 5 分钟在 daemon 里直接检查本机所有需求,发现"运行中但后台进程已不在"的就执行 '),l("code",null,"laoshi resume"),i("(不经过模型,每个进程只继续一次,每个需求 24 小时内最多 3 次),这时不再预约对话的定时检查;插件设为只读时不做。接单器("),l("code",null,"laoshi factory"),i(")每次检查也同样直接继续")])]),l("tr",null,[l("td",null,[l("code",null,"maxConcurrentPipelines")]),l("td",null,"0(不限)"),l("td",null,"本机同时运行的流水线上限,满了排队。只能写在本机配置中才有意义")])])]),l("h2",{id:"需求总览",tabindex:"-1"},[i("需求总览 "),l("a",{class:"header-anchor",href:"#需求总览","aria-label":'Permalink to "需求总览"'},"")]),l("p",null,[l("code",null,"laoshi digest"),i(' 在项目目录中列出所有工作区里的需求,按"需要处理、待验收、开发中、对齐中、已验收(最近 7 天)"分组,附用时与用量。'),l("code",null,"--notify"),i(" 同时发给外部通知(事件类型 "),l("code",null,"digest"),i(");"),l("code",null,'--schedule "<cron>"'),i(" 让 Paseo 按时间表(本机时区)启动一个短暂的 agent 执行 "),l("code",null,"laoshi digest --notify"),i(",例如每周一 9 点:"),l("code",null,'laoshi digest --schedule "0 9 * * 1"'),i(";取消:"),l("code",null,"laoshi digest --cancel <定时任务 ID>"),i("。")]),l("h2",{id:"使用统计",tabindex:"-1"},[i("使用统计 "),l("a",{class:"header-anchor",href:"#使用统计","aria-label":'Permalink to "使用统计"'},"")]),l("p",null,[i("每次流水线运行结束时,引擎在本机的 "),l("code",null,"~/.laoshi/usage/runs.jsonl"),i(" 追加一条记录:各步骤的用时和用量、质量门、评审和缺陷轮数、结束时的状态(格式见 "),l("a",{href:"./../reference/contracts/usage-record"},"使用记录"),i(")。只记在本机,不记需求内容和代码,也不会自动发往任何地方。")]),l("ul",null,[l("li",null,[l("code",null,"laoshi stats"),i(":最近 30 天的统计("),l("code",null,"--since 2w"),i("、"),l("code",null,"--since 2026-10-01"),i("、"),l("code",null,"--month 2026-10"),i('):有进展和完成的需求数、交付周期、返工(评审轮数、需要缺陷修复的占比、质量门失败)、各种等待的时长、各步骤用时、用量,以及不同 builder 的比较。有"token 花在哪"一节:按步骤和按模型的 token 及占比、返工(方案修订、评审问题修复、缺陷修复、复验,以及第 2 轮起的审核和评审)的占比、输入中来自提示缓存的比例、每个完成需求的中位数;插件的"使用统计"页用条形图显示同样的内容。'),l("code",null,"--json"),i("、"),l("code",null,"--csv"),i(" 输出机器可读的格式。")]),l("li",null,[l("code",null,"laoshi stats --report --month 2026-10 [--out 目录]"),i(":生成给管理方汇报用的两份文件:"),l("code",null,"laoshi-usage-2026-10.md"),i("(汇总)和 "),l("code",null,".csv"),i("(每个需求一行,可以用表格软件打开)。")]),l("li",null,[i("几台机器一起汇报:每台机器运行 "),l("code",null,"laoshi stats --month 2026-10 --export"),i(",得到 "),l("code",null,"laoshi-usage-<主机名>-<日期>.jsonl"),i(";把这些文件放到一起,运行 "),l("code",null,"laoshi stats --merge <文件…> --month 2026-10 --report"),i("。")])]),l("p",null,[i("本机的需求索引 "),l("code",null,"~/.laoshi/index/"),i(" 记录每个运行过的需求在哪个目录,Paseo 插件据此在一个页面列出本机所有项目的需求。从 paseo-req-kit 迁来的或索引缺失的需求,在项目目录运行一次 "),l("code",null,"laoshi index --rebuild"),i(" 补登;目录删掉后用 "),l("code",null,"laoshi index --prune"),i(" 清理。")]),l("h2",{id:"外部系统对接-需求管理等",tabindex:"-1"},[i("外部系统对接(需求管理等) "),l("a",{class:"header-anchor",href:"#外部系统对接-需求管理等","aria-label":'Permalink to "外部系统对接(需求管理等)"'},"")]),l("p",null,"流水线可以把需求同步到团队的需求管理系统:需求开始时建一张卡片,之后每到一个阶段改卡片的状态,卡片编号和链接写回需求,显示在进度、完成报告和 Paseo 插件里。对接的是本机已有的命令行工具(例如需求管理系统的 CLI),写在本机或团队配置中(它会运行命令,项目配置中的会被忽略):"),l("div",{class:"language-json vp-adaptive-theme"},[l("button",{title:"Copy Code",class:"copy"}),l("span",{class:"lang"},"json"),l("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[l("code",null,[l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"integrations"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": [")]),i(`
|
|
35
35
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," {")]),i(`
|
|
36
36
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "name"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"ALM"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),i(`
|
|
37
37
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "command"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"alm"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),i(`
|
package/site-dist/assets/{guide_project.md.BIcaDhdS.lean.js → guide_project.md.B2cmf8YF.lean.js}
RENAMED
|
@@ -31,7 +31,7 @@ import{_ as e,o as a,c as n,j as l,a as i}from"./chunks/framework.BetZR81g.js";c
|
|
|
31
31
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "test"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"command"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"npm test"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," },")]),i(`
|
|
32
32
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "web"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"type"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"service"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"command"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"node scripts/paseo/with-port.mjs npm run dev -- --port {PORT}"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," }")]),i(`
|
|
33
33
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," }")]),i(`
|
|
34
|
-
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),l("p",null,[l("code",null,"paseo.json"),i(" 是团队共用的,而 Paseo 在各系统上用不同的 shell 执行它的命令(macOS/Linux:bash 和 sh;Windows:准备命令用 PowerShell,带 "),l("code",null,"-ExecutionPolicy Bypass"),i(",不受执行策略限制;脚本和服务用 cmd.exe)。所以 "),l("code",null,"/laoshi-setup"),i(" 只写各系统一样的命令,用到环境变量的地方交给它写进项目的两个小脚本:"),l("code",null,"scripts/paseo/copy-local-files.mjs"),i("(从来源目录复制不提交的本地文件,没有就跳过)和 "),l("code",null,"scripts/paseo/with-port.mjs"),i("(把 "),l("code",null,"{PORT}"),i(" 换成 Paseo 分配的端口,并设置 "),l("code",null,"PORT"),i(")。手写 "),l("code",null,"$PASEO_PORT"),i("、"),l("code",null,"%PASEO_PORT%"),i("、"),l("code",null,"cp"),i("、"),l("code",null,"Copy-Item"),i(" 这类只在某个系统上能用的命令时,"),l("code",null,"/laoshi-doctor"),i(" 会指出:在本机上会失败的标为⚠,只是换系统会失败的给出提示。")]),l("ul",null,[l("li",null,[l("code",null,"worktree.setup"),i(":Paseo 新建 worktree 工作区时自动执行,新需求的工作区一建好就装好了依赖、带上了本地配置。")]),l("li",null,[l("code",null,'"type": "service"'),i(" 的脚本:流水线在服务启动验证、功能验证、缺陷修复和复验之前,通过 Paseo 带着当前代码重启它们,把地址("),l("code",null,"http://web--<分支>--<项目>.localhost:6767"),i(" 这样的代理地址)交给步骤 agent,验证结束后停止。Paseo 为每个工作区分配独立端口,几个需求同时验证不会冲突,服务必须监听 Paseo 分配的端口(环境变量 "),l("code",null,"PASEO_PORT"),i(",用 "),l("code",null,"with-port.mjs"),i(" 传给程序)。")]),l("li",null,[i("服务没有启动成功时,最后的输出写到功能目录的 "),l("code",null,".pipeline/services/<服务名>.log"),i(",交给步骤 agent 查原因。")]),l("li",null,[i("只有从 Paseo 对话启动的流水线才会这样做(需要知道是哪个工作区)。不想用时在配置中设 "),l("code",null,'"platformServices": "off"'),i(",步骤 agent 会像以前一样自己启动服务。"),l("code",null,"serviceReadySeconds"),i("(默认 120)是等待服务就绪的时间。")]),l("li",null,[i("在 Paseo 设置中打开 "),l("strong",null,"Enable Paseo tools"),i(" 后,步骤 agent 改完代码还可以自己重启这些服务。")]),l("li",null,"写错时服务起不来,流水线会改由步骤 agent 自己启动服务,不会中断。"),l("li",null,[i("PowerShell 被完全禁用(不只是执行策略)的 Windows 机器上,"),l("code",null,"worktree.setup"),i(" 无法执行;新工作区不会自动装依赖,步骤 agent 会按验证方法自己准备。")])]),l("h2",{id:"额度提醒",tabindex:"-1"},[i("额度提醒 "),l("a",{class:"header-anchor",href:"#额度提醒","aria-label":'Permalink to "额度提醒"'},"")]),l("p",null,[i("开始前,流水线读取 Paseo 的用量信息(需要 Paseo 能读到对应 agent 的订阅用量)。所用 agent 的某个额度窗口用到 "),l("code",null,"quotaWarnPercent"),i("(默认 85)以上时,在对话里提醒一次,流水线照常进行;用完时遇到限流会自动等待重试。设为 0 关闭提醒。")]),l("h2",{id:"token-预算和用时估算",tabindex:"-1"},[i("token 预算和用时估算 "),l("a",{class:"header-anchor",href:"#token-预算和用时估算","aria-label":'Permalink to "token 预算和用时估算"'},"")]),l("p",null,"内网模型通常不报金额,所以按 token(输入 + 输出)计:"),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"说明")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"budget.tokens")]),l("td",null,[l("code",null,"null"),i("(不限)")]),l("td",null,[i("一个需求所有步骤、所有尝试合计最多用多少 tokens,例如 "),l("code",null,"3000000"),i('。每个新步骤开始前检查:用完时,已完成的步骤都保留,流水线在下一步开始前停下(状态"已中断",停下原因 '),l("code",null,"budget"),i("),请对话问需求方是否继续;继续("),l("code",null,"laoshi resume"),i(' 或在对话里说"继续开发")会再给一份同样多的预算')])]),l("tr",null,[l("td",null,[l("code",null,"budget.warnPercent")]),l("td",null,"80"),l("td",null,[i("用到预算的这个比例时在对话里告知一次(不停),同时发 "),l("code",null,"milestone"),i(" 外部通知")])])])]),l("p",null,[i("写在本机、团队或项目配置中都可以,例如 "),l("code",null,'"budget": { "tokens": 3000000 }'),i("。还没有数据时,先不设预算跑几个需求,用 "),l("code",null,"laoshi stats"),i(' 的"token 花在哪"看每个需求的中位数,再按它的两三倍设。')]),l("p",null,[i("agent 不报告 token 用量时(有些模型或接入方式不报告),预算不会起作用:设了预算的需求在第一个步骤结束后会在对话里说明一次,流水线照常继续;"),l("code",null,"laoshi doctor"),i(" 也会检查本机最近的需求有没有用量数据。")]),l("p",null,[i('用时估算不用配置:本机已完成的同档位需求有 3 个以上时,开始开发的回复里写出"agent 合计用时和 token 的中位数"作为参考;'),l("code",null,"laoshi status"),i(' 和插件的需求页面显示"预计还要约多久"(按中位数减去已用的 agent 时间,不含等人的时间),超过中位数时如实说"已超过通常的用时"。')]),l("h2",{id:"并行编排-确认前审阅、方案提案、浏览器验证",tabindex:"-1"},[i("并行编排:确认前审阅、方案提案、浏览器验证 "),l("a",{class:"header-anchor",href:"#并行编排-确认前审阅、方案提案、浏览器验证","aria-label":'Permalink to "并行编排:确认前审阅、方案提案、浏览器验证"'},"")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"作用")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"specReview")]),l("td",null,[l("code",null,'"standard"')]),l("td",null,[i("请需求方确认之前,由 reviewer 在后台独立审阅需求说明草稿,问题写进 "),l("code",null,"spec-review.md"),i("。"),l("code",null,'"always"'),i(" 快速档也做,"),l("code",null,'"off"'),i(" 关闭")])]),l("tr",null,[l("td",null,[l("code",null,"designProposals")]),l("td",null,"关闭"),l("td",null,[l("code",null,'{"enabled": true}'),i(" 后,标准档的方案设计之前由几个 agent 并行各提一份方案("),l("code",null,"design-proposals/"),i("),方案设计比较后决定。"),l("code",null,"members"),i(" 不写时用 builder 和 reviewer,也可以像评审小组一样列出成员(可用 "),l("code",null,"platformProfile"),i(")。需求变更后的增量继续不做")])]),l("tr",null,[l("td",null,[l("code",null,"browserVerify")]),l("td",null,[l("code",null,'"auto"')]),l("td",null,[i("功能验证、缺陷修复、复验检查网页界面的方式。总是附上界面检查命令 "),l("code",null,"laoshi ui-check"),i(":用本机的 Edge 或 Chrome(无界面)打开页面,按电脑和手机宽度用文字报告显示不全、遮挡、超出屏幕、图片没加载、文字太淡、控件没有名字、控制台报错和请求失败,并和确认过的原型逐项对文字;不需要模型看图,也不需要 Paseo 桌面端。第一次使用时从 npm 源安装 "),l("code",null,"playwright-core"),i(" 到 "),l("code",null,"~/.laoshi/tools"),i("(不下载浏览器)。步骤 agent 还有 Paseo 浏览器工具(桌面端在线)时,另外按验收标准在浏览器中实际操作。"),l("code",null,'"off"'),i(" 都不用")])])])]),l("p",null,[i("Paseo 自带的 "),l("code",null,"/paseo-advisor"),i("、"),l("code",null,"/paseo-committee"),i(" 等编排 skill 也可以单独使用,例如对一个疑难问题请两个模型分别分析;它们不参与流水线(见 ADR 0019)。")]),l("h2",{id:"自动新建工作区-可选",tabindex:"-1"},[i("自动新建工作区(可选) "),l("a",{class:"header-anchor",href:"#自动新建工作区-可选","aria-label":'Permalink to "自动新建工作区(可选)"'},"")]),l("p",null,[i("在项目主目录、主分支上发起的需求,可以用 "),l("code",null,"--worktree"),i(" 启动("),l("code",null,"/laoshi"),i(' 中的"启动(自动新建工作区)"):流水线从当前分支切出 '),l("code",null,"feature/<功能目录名>"),i(",在 Paseo 中新建 worktree 工作区,把需求说明移过去并提交,之后的步骤都在那个工作区中运行,仍然挂在发起的对话下。对话的工作目录不变,查看进度、暂停、继续都在原对话中进行;读写需求文件用通知中给出的完整路径。只能在第一次启动时选择。见 ADR 0018。")]),l("ul",null,[l("li",null,[l("strong",null,"启动没成功也能接着做。"),i(" 工作区一建好就记下来("),l("code",null,"~/.laoshi/worktrees/"),i(')。之后不管哪一步失败(建工作区慢、启动前的检查没通过),再次执行启动命令都会在这个工作区里接着开始,不会报"分支已存在",也不会留下只有需求说明的分支。新建工作区最多等 15 分钟(以前是 2 分钟,大仓库在 Windows 上常常不够)。以前版本留下的"分支和工作区都在、开发没开始"的,也会由 Paseo 接手那个目录接着做。')]),l("li",null,[l("strong",null,[i("访谈改过的 "),l("code",null,"GLOSSARY.md"),i("、"),l("code",null,"docs/adr/"),i(" 一起带过去")]),i(",和需求说明在需求自己的分支上一起提交;主目录里的这些未提交改动保留不动(可能和别的改动在一起),确认后可以撤销。")]),l("li",null,[l("strong",null,"如实提示起点的问题"),i(":需求说明已经提交在主分支上、本地主分支比远端落后、主目录里还有别的未提交改动时,启动结果里会写明。流水线不改动主分支。")])]),l("h2",{id:"调度-预约、提醒、自动继续、排队",tabindex:"-1"},[i("调度:预约、提醒、自动继续、排队 "),l("a",{class:"header-anchor",href:"#调度-预约、提醒、自动继续、排队","aria-label":'Permalink to "调度:预约、提醒、自动继续、排队"'},"")]),l("p",null,'需要"以后再做"的事,流水线用 Paseo 的定时任务把一条写明步骤的消息发回发起的对话,由对话 agent 执行(机器或 daemon 重启后仍然有效,在 Paseo 的 Schedules 中可以看到)。暂停命令会取消这些预约。'),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"作用")])]),l("tbody",null,[l("tr",null,[l("td",null,[i("(启动参数 "),l("code",null,"--at"),i(")")]),l("td",null,"—"),l("td",null,[i("预约开始时间:"),l("code",null,"22:00"),i("、"),l("code",null,"明天 8:30"),i("、"),l("code",null,"2026-10-14 08:30"),i("、"),l("code",null,"+2h")])]),l("tr",null,[l("td",null,[l("code",null,"waitingReminderHours")]),l("td",null,"24"),l("td",null,"等待需求方回答、或研发完成后等待测试验证超过这么久,在对话里提醒一次;0 关闭")]),l("tr",null,[l("td",null,[i("(启动参数 "),l("code",null,"--verify-at"),i(")")]),l("td",null,"—"),l("td",null,[i("分阶段时,研发完成后在这个时间自动开始测试验证(写法同 "),l("code",null,"--at"),i(";隐含分阶段)。研发完成时时间已过就直接继续")])]),l("tr",null,[l("td",null,[l("code",null,"autoResumeMinutes"),i(" / "),l("code",null,"autoResumeMax")]),l("td",null,"30 / 2"),l("td",null,"临时错误(重试用完)中断后,这么久之后在对话里自动继续;每次尝试最多几次;0 关闭")]),l("tr",null,[l("td",null,[l("code",null,"watchdogMinutes")]),l("td",null,"60"),l("td",null,[i('运行期间对话定时检查,后台进程意外退出时自动继续。每次检查对话 agent 会运行一个回合;0 关闭。装了 req-kit 插件时,插件每 5 分钟在 daemon 里直接检查本机所有需求,发现"运行中但后台进程已不在"的就执行 '),l("code",null,"laoshi resume"),i("(不经过模型,每个进程只继续一次,每个需求 24 小时内最多 3 次),这时不再预约对话的定时检查;插件设为只读时不做。接单器("),l("code",null,"laoshi factory"),i(")每次检查也同样直接继续")])]),l("tr",null,[l("td",null,[l("code",null,"maxConcurrentPipelines")]),l("td",null,"0(不限)"),l("td",null,"本机同时运行的流水线上限,满了排队。只能写在本机配置中才有意义")])])]),l("h2",{id:"需求总览",tabindex:"-1"},[i("需求总览 "),l("a",{class:"header-anchor",href:"#需求总览","aria-label":'Permalink to "需求总览"'},"")]),l("p",null,[l("code",null,"laoshi digest"),i(' 在项目目录中列出所有工作区里的需求,按"需要处理、待验收、开发中、对齐中、已验收(最近 7 天)"分组,附用时与用量。'),l("code",null,"--notify"),i(" 同时发给外部通知(事件类型 "),l("code",null,"digest"),i(");"),l("code",null,'--schedule "<cron>"'),i(" 让 Paseo 按时间表(本机时区)启动一个短暂的 agent 执行 "),l("code",null,"laoshi digest --notify"),i(",例如每周一 9 点:"),l("code",null,'laoshi digest --schedule "0 9 * * 1"'),i(";取消:"),l("code",null,"laoshi digest --cancel <定时任务 ID>"),i("。")]),l("h2",{id:"使用统计",tabindex:"-1"},[i("使用统计 "),l("a",{class:"header-anchor",href:"#使用统计","aria-label":'Permalink to "使用统计"'},"")]),l("p",null,[i("每次流水线运行结束时,引擎在本机的 "),l("code",null,"~/.laoshi/usage/runs.jsonl"),i(" 追加一条记录:各步骤的用时和用量、质量门、评审和缺陷轮数、结束时的状态(格式见 "),l("a",{href:"./../reference/contracts/usage-record"},"使用记录"),i(")。只记在本机,不记需求内容和代码,也不会自动发往任何地方。")]),l("ul",null,[l("li",null,[l("code",null,"laoshi stats"),i(":最近 30 天的统计("),l("code",null,"--since 2w"),i("、"),l("code",null,"--since 2026-10-01"),i("、"),l("code",null,"--month 2026-10"),i('):有进展和完成的需求数、交付周期、返工(评审轮数、需要缺陷修复的占比、质量门失败)、各种等待的时长、各步骤用时、用量,以及不同 builder 的比较。有"token 花在哪"一节:按步骤和按模型的 token 及占比、返工(方案修订、评审问题修复、缺陷修复、复验,以及第 2 轮起的审核和评审)的占比、输入中来自提示缓存的比例、每个完成需求的中位数;插件的"使用统计"页用条形图显示同样的内容。'),l("code",null,"--json"),i("、"),l("code",null,"--csv"),i(" 输出机器可读的格式。")]),l("li",null,[l("code",null,"laoshi stats --report --month 2026-10 [--out 目录]"),i(":生成给管理方汇报用的两份文件:"),l("code",null,"laoshi-usage-2026-10.md"),i("(汇总)和 "),l("code",null,".csv"),i("(每个需求一行,可以用表格软件打开)。")]),l("li",null,[i("几台机器一起汇报:每台机器运行 "),l("code",null,"laoshi stats --month 2026-10 --export"),i(",得到 "),l("code",null,"laoshi-usage-<主机名>-<日期>.jsonl"),i(";把这些文件放到一起,运行 "),l("code",null,"laoshi stats --merge <文件…> --month 2026-10 --report"),i("。")])]),l("p",null,[i("本机的需求索引 "),l("code",null,"~/.laoshi/index/"),i(" 记录每个运行过的需求在哪个目录,Paseo 插件据此在一个页面列出本机所有项目的需求。从 paseo-req-kit 迁来的或索引缺失的需求,在项目目录运行一次 "),l("code",null,"laoshi index --rebuild"),i(" 补登;目录删掉后用 "),l("code",null,"laoshi index --prune"),i(" 清理。")]),l("h2",{id:"外部系统对接-需求管理等",tabindex:"-1"},[i("外部系统对接(需求管理等) "),l("a",{class:"header-anchor",href:"#外部系统对接-需求管理等","aria-label":'Permalink to "外部系统对接(需求管理等)"'},"")]),l("p",null,"流水线可以把需求同步到团队的需求管理系统:需求开始时建一张卡片,之后每到一个阶段改卡片的状态,卡片编号和链接写回需求,显示在进度、完成报告和 Paseo 插件里。对接的是本机已有的命令行工具(例如需求管理系统的 CLI),写在本机或团队配置中(它会运行命令,项目配置中的会被忽略):"),l("div",{class:"language-json vp-adaptive-theme"},[l("button",{title:"Copy Code",class:"copy"}),l("span",{class:"lang"},"json"),l("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[l("code",null,[l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"integrations"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": [")]),i(`
|
|
34
|
+
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),l("p",null,[l("code",null,"paseo.json"),i(" 是团队共用的,而 Paseo 在各系统上用不同的 shell 执行它的命令(macOS/Linux:bash 和 sh;Windows:准备命令用 PowerShell,带 "),l("code",null,"-ExecutionPolicy Bypass"),i(",不受执行策略限制;脚本和服务用 cmd.exe)。所以 "),l("code",null,"/laoshi-setup"),i(" 只写各系统一样的命令,用到环境变量的地方交给它写进项目的两个小脚本:"),l("code",null,"scripts/paseo/copy-local-files.mjs"),i("(从来源目录复制不提交的本地文件,没有就跳过)和 "),l("code",null,"scripts/paseo/with-port.mjs"),i("(把 "),l("code",null,"{PORT}"),i(" 换成 Paseo 分配的端口,并设置 "),l("code",null,"PORT"),i(")。手写 "),l("code",null,"$PASEO_PORT"),i("、"),l("code",null,"%PASEO_PORT%"),i("、"),l("code",null,"cp"),i("、"),l("code",null,"Copy-Item"),i(" 这类只在某个系统上能用的命令时,"),l("code",null,"/laoshi-doctor"),i(" 会指出:在本机上会失败的标为⚠,只是换系统会失败的给出提示。")]),l("ul",null,[l("li",null,[l("code",null,"worktree.setup"),i(":Paseo 新建 worktree 工作区时自动执行,新需求的工作区一建好就装好了依赖、带上了本地配置。")]),l("li",null,[l("code",null,'"type": "service"'),i(" 的脚本:流水线在服务启动验证、功能验证、缺陷修复和复验之前,通过 Paseo 带着当前代码重启它们,把地址("),l("code",null,"http://web--<分支>--<项目>.localhost:6767"),i(" 这样的代理地址)交给步骤 agent,验证结束后停止。Paseo 为每个工作区分配独立端口,几个需求同时验证不会冲突,服务必须监听 Paseo 分配的端口(环境变量 "),l("code",null,"PASEO_PORT"),i(",用 "),l("code",null,"with-port.mjs"),i(" 传给程序)。")]),l("li",null,[i("服务没有启动成功时,最后的输出写到功能目录的 "),l("code",null,".pipeline/services/<服务名>.log"),i(",交给步骤 agent 查原因。")]),l("li",null,[i("只有从 Paseo 对话启动的流水线才会这样做(需要知道是哪个工作区)。不想用时在配置中设 "),l("code",null,'"platformServices": "off"'),i(",步骤 agent 会像以前一样自己启动服务。"),l("code",null,"serviceReadySeconds"),i("(默认 120)是等待服务就绪的时间。")]),l("li",null,[i("在 Paseo 设置中打开 "),l("strong",null,"Enable Paseo tools"),i(" 后,步骤 agent 改完代码还可以自己重启这些服务。")]),l("li",null,"写错时服务起不来,流水线会改由步骤 agent 自己启动服务,不会中断。"),l("li",null,[i("PowerShell 被完全禁用(不只是执行策略)的 Windows 机器上,"),l("code",null,"worktree.setup"),i(" 无法执行;新工作区不会自动装依赖,步骤 agent 会按验证方法自己准备。")])]),l("h2",{id:"额度提醒",tabindex:"-1"},[i("额度提醒 "),l("a",{class:"header-anchor",href:"#额度提醒","aria-label":'Permalink to "额度提醒"'},"")]),l("p",null,[i("开始前,流水线读取 Paseo 的用量信息(需要 Paseo 能读到对应 agent 的订阅用量)。所用 agent 的某个额度窗口用到 "),l("code",null,"quotaWarnPercent"),i("(默认 85)以上时,在对话里提醒一次,流水线照常进行;用完时遇到限流会自动等待重试。设为 0 关闭提醒。")]),l("h2",{id:"token-预算和用时估算",tabindex:"-1"},[i("token 预算和用时估算 "),l("a",{class:"header-anchor",href:"#token-预算和用时估算","aria-label":'Permalink to "token 预算和用时估算"'},"")]),l("p",null,"内网模型通常不报金额,所以按 token(输入 + 输出)计:"),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"说明")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"budget.tokens")]),l("td",null,[l("code",null,"null"),i("(不限)")]),l("td",null,[i("一个需求所有步骤、所有尝试合计最多用多少 tokens,例如 "),l("code",null,"3000000"),i('。每个新步骤开始前检查:用完时,已完成的步骤都保留,流水线在下一步开始前停下(状态"已中断",停下原因 '),l("code",null,"budget"),i("),请对话问需求方是否继续;继续("),l("code",null,"laoshi resume"),i(' 或在对话里说"继续开发")会再给一份同样多的预算')])]),l("tr",null,[l("td",null,[l("code",null,"budget.warnPercent")]),l("td",null,"80"),l("td",null,[i("用到预算的这个比例时在对话里告知一次(不停),同时发 "),l("code",null,"milestone"),i(" 外部通知")])])])]),l("p",null,[i("写在本机、团队或项目配置中都可以,例如 "),l("code",null,'"budget": { "tokens": 3000000 }'),i("。还没有数据时,先不设预算跑几个需求,用 "),l("code",null,"laoshi stats"),i(' 的"token 花在哪"看每个需求的中位数,再按它的两三倍设。')]),l("p",null,[i("agent 不报告 token 用量时(有些模型或接入方式不报告),预算不会起作用:设了预算的需求在第一个步骤结束后会在对话里说明一次,流水线照常继续;"),l("code",null,"laoshi doctor"),i(" 也会检查本机最近的需求有没有用量数据。")]),l("p",null,[i('用时估算不用配置:本机已完成的同档位需求有 3 个以上时,开始开发的回复里写出"agent 合计用时和 token 的中位数"作为参考;'),l("code",null,"laoshi status"),i(' 和插件的需求页面显示"预计还要约多久"(按中位数减去已用的 agent 时间,不含等人的时间),超过中位数时如实说"已超过通常的用时"。')]),l("h2",{id:"并行编排-确认前审阅、方案提案、浏览器验证",tabindex:"-1"},[i("并行编排:确认前审阅、方案提案、浏览器验证 "),l("a",{class:"header-anchor",href:"#并行编排-确认前审阅、方案提案、浏览器验证","aria-label":'Permalink to "并行编排:确认前审阅、方案提案、浏览器验证"'},"")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"作用")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"specReview")]),l("td",null,[l("code",null,'"standard"')]),l("td",null,[i("请需求方确认之前,由 reviewer 在后台独立审阅需求说明草稿,问题写进 "),l("code",null,"spec-review.md"),i("。"),l("code",null,'"always"'),i(" 快速档也做,"),l("code",null,'"off"'),i(" 关闭")])]),l("tr",null,[l("td",null,[l("code",null,"designProposals")]),l("td",null,"关闭"),l("td",null,[l("code",null,'{"enabled": true}'),i(" 后,标准档的方案设计之前由几个 agent 并行各提一份方案("),l("code",null,"design-proposals/"),i("),方案设计比较后决定。"),l("code",null,"members"),i(" 不写时用 builder 和 reviewer,也可以像评审小组一样列出成员(可用 "),l("code",null,"platformProfile"),i(")。需求变更后的增量继续不做")])]),l("tr",null,[l("td",null,[l("code",null,"browserVerify")]),l("td",null,[l("code",null,'"auto"')]),l("td",null,[i("功能验证、缺陷修复、复验检查网页界面的方式。总是附上界面检查命令 "),l("code",null,"laoshi ui-check"),i(":用本机的 Edge 或 Chrome(无界面)打开页面,按电脑和手机宽度用文字报告显示不全、遮挡、超出屏幕、图片没加载、文字太淡、控件没有名字、控制台报错和请求失败,并和确认过的原型逐项对文字;不需要模型看图,也不需要 Paseo 桌面端。第一次使用时从 npm 源安装 "),l("code",null,"playwright-core"),i(" 到 "),l("code",null,"~/.laoshi/tools"),i("(不下载浏览器)。步骤 agent 还有 Paseo 浏览器工具(桌面端在线)时,另外按验收标准在浏览器中实际操作。"),l("code",null,'"off"'),i(" 都不用")])])])]),l("p",null,[i("Paseo 自带的 "),l("code",null,"/paseo-advisor"),i("、"),l("code",null,"/paseo-committee"),i(" 等编排 skill 也可以单独使用,例如对一个疑难问题请两个模型分别分析;它们不参与流水线(见 ADR 0019)。")]),l("h2",{id:"自动新建工作区-可选",tabindex:"-1"},[i("自动新建工作区(可选) "),l("a",{class:"header-anchor",href:"#自动新建工作区-可选","aria-label":'Permalink to "自动新建工作区(可选)"'},"")]),l("p",null,[i("在项目主目录、主分支上发起的需求,可以用 "),l("code",null,"--worktree"),i(" 启动("),l("code",null,"/laoshi"),i(' 中的"启动(自动新建工作区)"):流水线从当前分支切出 '),l("code",null,"feature/<功能目录名>"),i(",在 Paseo 中新建 worktree 工作区,把需求说明移过去并提交,之后的步骤都在那个工作区中运行,仍然挂在发起的对话下。对话的工作目录不变,查看进度、暂停、继续都在原对话中进行;读写需求文件用通知中给出的完整路径。只能在第一次启动时选择。见 ADR 0018。")]),l("ul",null,[l("li",null,[l("strong",null,"启动没成功也能接着做。"),i(" 工作区一建好就记下来("),l("code",null,"~/.laoshi/worktrees/"),i(')。之后不管哪一步失败(建工作区慢、启动前的检查没通过),再次执行启动命令都会在这个工作区里接着开始,不会报"分支已存在",也不会留下只有需求说明的分支。新建工作区最多等 15 分钟(以前是 2 分钟,大仓库在 Windows 上常常不够)。以前版本留下的"分支和工作区都在、开发没开始"的,也会由 Paseo 接手那个目录接着做。')]),l("li",null,[l("strong",null,[i("访谈改过的 "),l("code",null,"GLOSSARY.md"),i("、"),l("code",null,"docs/adr/"),i(" 一起带过去")]),i(",和需求说明在需求自己的分支上一起提交;主目录里的这些未提交改动保留不动(可能和别的改动在一起),确认后可以撤销。")]),l("li",null,[l("strong",null,"如实提示起点的问题"),i(":需求说明已经提交在主分支上、本地主分支比远端落后、主目录里还有别的未提交改动时,启动结果里会写明。流水线不改动主分支。")])]),l("h2",{id:"调度-预约、提醒、自动继续、排队",tabindex:"-1"},[i("调度:预约、提醒、自动继续、排队 "),l("a",{class:"header-anchor",href:"#调度-预约、提醒、自动继续、排队","aria-label":'Permalink to "调度:预约、提醒、自动继续、排队"'},"")]),l("p",null,'需要"以后再做"的事,流水线用 Paseo 的定时任务把一条写明步骤的消息发回发起的对话,由对话 agent 执行(机器或 daemon 重启后仍然有效,在 Paseo 的 Schedules 中可以看到)。暂停命令会取消这些预约。'),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"配置"),l("th",null,"默认"),l("th",null,"作用")])]),l("tbody",null,[l("tr",null,[l("td",null,[i("(启动参数 "),l("code",null,"--at"),i(")")]),l("td",null,"—"),l("td",null,[i("预约开始时间:"),l("code",null,"22:00"),i("、"),l("code",null,"明天 8:30"),i("、"),l("code",null,"2026-10-14 08:30"),i("、"),l("code",null,"+2h")])]),l("tr",null,[l("td",null,[l("code",null,"waitingReminderHours")]),l("td",null,"24"),l("td",null,"等待需求方回答、或研发完成后等待测试验证超过这么久,在对话里提醒一次;0 关闭")]),l("tr",null,[l("td",null,[i("(启动参数 "),l("code",null,"--verify-at"),i(")")]),l("td",null,"—"),l("td",null,[i("分阶段时,研发完成后在这个时间自动开始测试验证(写法同 "),l("code",null,"--at"),i(";隐含分阶段)。研发完成时时间已过就直接继续")])]),l("tr",null,[l("td",null,[l("code",null,"autoResumeMinutes"),i(" / "),l("code",null,"autoResumeMax")]),l("td",null,"30 / 2"),l("td",null,"临时错误(重试用完)中断后,这么久之后在对话里自动继续;每次尝试最多几次;0 关闭")]),l("tr",null,[l("td",null,[l("code",null,"watchdogMinutes")]),l("td",null,"60"),l("td",null,[i("运行期间对话定时检查,后台进程意外退出时自动继续。每次检查对话 agent 会运行一个回合;0 关闭。装了 Paseo 的需求插件("),l("code",null,"laoshi plugin install"),i(')时,插件每 5 分钟在 daemon 里直接检查本机所有需求,发现"运行中但后台进程已不在"的就执行 '),l("code",null,"laoshi resume"),i("(不经过模型,每个进程只继续一次,每个需求 24 小时内最多 3 次),这时不再预约对话的定时检查;插件设为只读时不做。接单器("),l("code",null,"laoshi factory"),i(")每次检查也同样直接继续")])]),l("tr",null,[l("td",null,[l("code",null,"maxConcurrentPipelines")]),l("td",null,"0(不限)"),l("td",null,"本机同时运行的流水线上限,满了排队。只能写在本机配置中才有意义")])])]),l("h2",{id:"需求总览",tabindex:"-1"},[i("需求总览 "),l("a",{class:"header-anchor",href:"#需求总览","aria-label":'Permalink to "需求总览"'},"")]),l("p",null,[l("code",null,"laoshi digest"),i(' 在项目目录中列出所有工作区里的需求,按"需要处理、待验收、开发中、对齐中、已验收(最近 7 天)"分组,附用时与用量。'),l("code",null,"--notify"),i(" 同时发给外部通知(事件类型 "),l("code",null,"digest"),i(");"),l("code",null,'--schedule "<cron>"'),i(" 让 Paseo 按时间表(本机时区)启动一个短暂的 agent 执行 "),l("code",null,"laoshi digest --notify"),i(",例如每周一 9 点:"),l("code",null,'laoshi digest --schedule "0 9 * * 1"'),i(";取消:"),l("code",null,"laoshi digest --cancel <定时任务 ID>"),i("。")]),l("h2",{id:"使用统计",tabindex:"-1"},[i("使用统计 "),l("a",{class:"header-anchor",href:"#使用统计","aria-label":'Permalink to "使用统计"'},"")]),l("p",null,[i("每次流水线运行结束时,引擎在本机的 "),l("code",null,"~/.laoshi/usage/runs.jsonl"),i(" 追加一条记录:各步骤的用时和用量、质量门、评审和缺陷轮数、结束时的状态(格式见 "),l("a",{href:"./../reference/contracts/usage-record"},"使用记录"),i(")。只记在本机,不记需求内容和代码,也不会自动发往任何地方。")]),l("ul",null,[l("li",null,[l("code",null,"laoshi stats"),i(":最近 30 天的统计("),l("code",null,"--since 2w"),i("、"),l("code",null,"--since 2026-10-01"),i("、"),l("code",null,"--month 2026-10"),i('):有进展和完成的需求数、交付周期、返工(评审轮数、需要缺陷修复的占比、质量门失败)、各种等待的时长、各步骤用时、用量,以及不同 builder 的比较。有"token 花在哪"一节:按步骤和按模型的 token 及占比、返工(方案修订、评审问题修复、缺陷修复、复验,以及第 2 轮起的审核和评审)的占比、输入中来自提示缓存的比例、每个完成需求的中位数;插件的"使用统计"页用条形图显示同样的内容。'),l("code",null,"--json"),i("、"),l("code",null,"--csv"),i(" 输出机器可读的格式。")]),l("li",null,[l("code",null,"laoshi stats --report --month 2026-10 [--out 目录]"),i(":生成给管理方汇报用的两份文件:"),l("code",null,"laoshi-usage-2026-10.md"),i("(汇总)和 "),l("code",null,".csv"),i("(每个需求一行,可以用表格软件打开)。")]),l("li",null,[i("几台机器一起汇报:每台机器运行 "),l("code",null,"laoshi stats --month 2026-10 --export"),i(",得到 "),l("code",null,"laoshi-usage-<主机名>-<日期>.jsonl"),i(";把这些文件放到一起,运行 "),l("code",null,"laoshi stats --merge <文件…> --month 2026-10 --report"),i("。")])]),l("p",null,[i("本机的需求索引 "),l("code",null,"~/.laoshi/index/"),i(" 记录每个运行过的需求在哪个目录,Paseo 插件据此在一个页面列出本机所有项目的需求。从 paseo-req-kit 迁来的或索引缺失的需求,在项目目录运行一次 "),l("code",null,"laoshi index --rebuild"),i(" 补登;目录删掉后用 "),l("code",null,"laoshi index --prune"),i(" 清理。")]),l("h2",{id:"外部系统对接-需求管理等",tabindex:"-1"},[i("外部系统对接(需求管理等) "),l("a",{class:"header-anchor",href:"#外部系统对接-需求管理等","aria-label":'Permalink to "外部系统对接(需求管理等)"'},"")]),l("p",null,"流水线可以把需求同步到团队的需求管理系统:需求开始时建一张卡片,之后每到一个阶段改卡片的状态,卡片编号和链接写回需求,显示在进度、完成报告和 Paseo 插件里。对接的是本机已有的命令行工具(例如需求管理系统的 CLI),写在本机或团队配置中(它会运行命令,项目配置中的会被忽略):"),l("div",{class:"language-json vp-adaptive-theme"},[l("button",{title:"Copy Code",class:"copy"}),l("span",{class:"lang"},"json"),l("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[l("code",null,[l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"integrations"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": [")]),i(`
|
|
35
35
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," {")]),i(`
|
|
36
36
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "name"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"ALM"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),i(`
|
|
37
37
|
`),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "command"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"alm"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),i(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as t,o as d,c as o,a2 as c}from"./chunks/framework.BetZR81g.js";const p=JSON.parse('{"title":"AgentRuntime:引擎对 agent 平台的要求","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/agent-runtime.md","filePath":"reference/contracts/agent-runtime.md","lastUpdated":null}'),a={name:"reference/contracts/agent-runtime.md"};function r(i,e,n,l,s,u){return d(),o("div",null,[...e[0]||(e[0]=[c('<div><h1 id="agentruntime-引擎对-agent-平台的要求" tabindex="-1">AgentRuntime:引擎对 agent 平台的要求 <a class="header-anchor" href="#agentruntime-引擎对-agent-平台的要求" aria-label="Permalink to "AgentRuntime:引擎对 agent 平台的要求""></a></h1><p>引擎(<code>engine/src</code>)只通过 <code>AgentRuntime</code>(<code>engine/src/runtime.ts</code>)与 agent 平台打交道。现有的实现在各平台的适配器里:Paseo(<code>adapters/paseo/paseo-runtime.ts</code>)、DeepSeek Harness(<code>adapters/dsh/dsh-runtime.ts</code>)、摸高(<code>adapters/mogao/mogao-runtime.ts</code>);测试用 <code>REQ_PIPELINE_FAKE_RUNTIME</code> 指向的假实现(<code>engine/test/fake-runtime.ts</code>)。要让 laoshi 运行在别的 agent 平台上,就是为那个平台写一个适配器和它的 <code>AgentRuntime</code>(见 <a href="./../design/adapter-guide">adapter-guide</a>)。</p><p>本文说明:每个方法属于哪一级、没有它时现在的行为、以及适配器应该怎么做。<code>runtime.ts</code> 里的类型和注释是字段定义的准确来源,本文不重复。</p><h2 id="级别" tabindex="-1">级别 <a class="header-anchor" href="#级别" aria-label="Permalink to "级别""></a></h2><ul><li><strong>必需</strong>:没有就不能运行流水线。适配器必须实现。</li><li><strong>可选</strong>:平台没有时返回 <code>null</code>(或抛出),引擎按"现状"一栏处理。</li><li><strong>按需</strong>:只有对应功能被使用时才会调用(卡片接单、需求总览、联合需求、<code>--worktree</code>)。</li></ul><p>"现状"一栏记录的是引擎今天的真实行为,不是理想行为。标了 ⚠ 的是降级不够平滑、适配器作者需要特别注意的地方。</p><h2 id="必需" tabindex="-1">必需 <a class="header-anchor" href="#必需" aria-label="Permalink to "必需""></a></h2><table tabindex="0"><thead><tr><th>方法</th><th>要求</th><th>备注</th></tr></thead><tbody><tr><td><code>verifyOrigin(agentId, cwd)</code></td><td>确认发起流水线的会话存在,且工作目录是 <code>cwd</code>;不满足时抛出面向用户的原因</td><td>步骤 agent 要挂在发起会话下,平台给子 agent 的工作目录必须与会话一致(见 ADR 0001)。没有"会话"概念的平台,应在适配器里自行定义"发起者"并让此方法恒通过</td></tr><tr><td><code>startAgent(input)</code></td><td>按 <code>role</code>、<code>prompt</code>、<code>cwd</code>、<code>labels</code>、<code>profile</code> 创建一个步骤 agent;<code>parentAgentId</code> 非空时挂在该会话下;<code>workspaceId</code> 非空时放进该工作区</td><td>返回 <code>StepAgent</code></td></tr><tr><td><code>StepAgent.wait(timeoutMs)</code></td><td>等待当前回合结束,最多 <code>timeoutMs</code>;遇到权限请求时提前返回</td><td>返回值的 <code>status</code> 为 <code>idle</code> / <code>error</code> / <code>permission</code> / <code>timeout</code>;<code>usage</code> 平台不报告时为 <code>null</code></td></tr><tr><td><code>StepAgent.followUp(text)</code></td><td>在同一会话里开始新回合</td><td>用于"结果文件缺失,请补写"</td></tr><tr><td><code>StepAgent.archive()</code></td><td>归档该 agent</td><td></td></tr><tr><td><code>attachAgent(agentId)</code></td><td>接上一个之前(可能由另一个流水线进程)启动的 agent</td><td>续跑、重新接着等用</td></tr><tr><td><code>notifyAgent(agentId, text)</code></td><td>向已有会话投递一条消息,不打断它</td><td>进展、需要决定的问题、结论都靠它发回会话。⚠ 没有等价能力的平台,至少要写通知文件让使用者看到</td></tr><tr><td><code>interruptAgent(agentId, text)</code></td><td>打断当前回合,改为处理 <code>text</code></td><td>用于停止一个步骤</td></tr><tr><td><code>close()</code></td><td>释放连接</td><td></td></tr></tbody></table><h2 id="可选" tabindex="-1">可选 <a class="header-anchor" href="#可选" aria-label="Permalink to "可选""></a></h2><table tabindex="0"><thead><tr><th>方法</th><th>平台没有时</th><th>现状</th></tr></thead><tbody><tr><td><code>listProfiles()</code>(req-kit 1.x 叫 <code>listPaseoProfiles</code>)</td><td>返回 <code>null</code></td><td>只影响用 <code>platformProfile</code>(旧名 <code>paseoProfile</code>)引用平台档案的配置:解析不了就拒绝启动并说明。只用 <code>provider/model</code> 直配时不调用</td></tr><tr><td><code>listServices(target)</code></td><td>返回 <code>null</code></td><td>流水线调用时都带 <code>.catch(() => null)</code>,<code>null</code> 表示"不由平台管理服务",改用 <code>verify.md</code> 里的手工启动命令</td></tr><tr><td><code>startServices(target, names, timeoutMs)</code>、<code>stopServices(...)</code></td><td>—</td><td>只在 <code>listServices</code> 返回名字后才调用;失败时按启动失败报告给步骤</td></tr><tr><td><code>providerQuota(providers)</code></td><td>返回 <code>null</code></td><td>额度提醒关闭,不影响运行(<code>.catch(() => null)</code>)</td></tr><tr><td><code>recentActivity(agentId, limit)</code></td><td>返回 <code>null</code></td><td>查看进度时不附"最近动作"(<code>.catch(() => null)</code>)</td></tr><tr><td><code>runningTool(agentId)</code></td><td>返回 <code>null</code></td><td>关闭"打断搜索大目录命令"(1.13)(<code>.catch(() => null)</code>)</td></tr><tr><td><code>capabilities()</code></td><td>返回 <code>null</code></td><td>当作"未知",不做依赖这些工具的假设(<code>.catch(() => null)</code>)</td></tr><tr><td><code>providerStatus()</code></td><td>返回 <code>null</code></td><td>只在接单器体检时用;<code>null</code> 不报问题</td></tr><tr><td><code>scheduleMessage(input)</code></td><td>返回 <code>null</code></td><td>⚠ 流水线内部(等待提醒、自动继续、定时检查、预约验证)拿到 <code>null</code> 就不预约;但 <code>launch.ts</code> 的"预约开始"在拿到 <code>null</code> 时<strong>直接失败</strong>并提示"到时再启动"。其他平台需要本机定时器或让使用者手动继续(见下文"调度")</td></tr><tr><td><code>cancelSchedule(id)</code></td><td>—</td><td>下一次运行和暂停命令会调用它取消状态文件里记录的预约</td></tr></tbody></table><h2 id="按需" tabindex="-1">按需 <a class="header-anchor" href="#按需" aria-label="Permalink to "按需""></a></h2><table tabindex="0"><thead><tr><th>方法</th><th>用在哪里</th><th>备注</th></tr></thead><tbody><tr><td><code>createWorktree(request)</code>、<code>waitForWorkspaceSetup(id, timeoutMs)</code></td><td><code>--worktree</code>(<code>worktree.ts</code>)和联合需求(<code>joint.ts</code>)</td><td>⚠ 创建失败是硬错误。没有平台工作区的适配器,可以在适配器内用 <code>git worktree</code> 实现并返回 <code>{ workspaceId, directory }</code>;<code>waitForWorkspaceSetup</code> 可恒返回 <code>{ status: "none" }</code></td></tr><tr><td><code>startSessionAgent(input)</code></td><td>从卡片接单(<code>card-cmd.ts</code>):为需求新开一个顶层会话</td><td>没有则不能用接单器</td></tr><tr><td><code>scheduleNewAgent(input)</code></td><td>需求总览的定时发送(<code>digest.ts --schedule</code>)</td><td>返回 <code>null</code> 时该功能关闭</td></tr><tr><td><code>answerPermission(agentId, requestId, approve, reason)</code></td><td><code>laoshi permission <需求> approve|deny</code>(<code>permission-cmd.ts</code>):平台的审批不能在它自己的界面里回答、由对话问人时,laoshi 转达人的决定;<code>requestId</code> 为 <code>null</code> 表示现在等待的那一个</td><td>没有时,审批按平台自己的方式处理(如 Paseo、dsh 的界面)</td></tr></tbody></table><p>适配器还可以声明 <code>runsInChat</code>(<code>PlatformAdapter</code>):平台只在对话的一个轮次内保留对话的机器时,引擎不能在后台运行,<code>launch.ts</code> 让它在对话的命令里运行,给对话的消息(<code>notifyAgent</code>)写进 <code>chat.log</code> 并显示在命令输出里。状态文件记下运行引擎的机器(<code>host</code>),另一台机器上记录的进程不算还在运行。</p><h2 id="调度" tabindex="-1">调度 <a class="header-anchor" href="#调度" aria-label="Permalink to "调度""></a></h2><p>引擎里所有"以后再做"(预约开始、等待提醒、限流后自动继续、定时检查、预约验证)都表达为:<strong>在某个时间,向发起会话投递一条写明步骤的消息</strong>(ADR 0020)。适配器实现 <code>scheduleMessage</code> 时有三种选择:</p><ol><li>平台有等价的定时任务 → 直接映射(Paseo 的做法)。</li><li>平台没有 → 适配器自己保存计划,由一个常驻的本机进程到点调用 <code>notifyAgent</code>。</li><li>都做不到 → 返回 <code>null</code>,让引擎按上表"现状"处理。</li></ol><h2 id="一致性要求" tabindex="-1">一致性要求 <a class="header-anchor" href="#一致性要求" aria-label="Permalink to "一致性要求""></a></h2><p>新适配器至少应满足:</p><ul><li>通过 <code>engine/test</code> 中使用 <code>fake-runtime.ts</code> 的编排测试所覆盖的行为约定(步骤顺序、续跑、重新接着等、结果文件追问、打断)。读 <code>fake-runtime.ts</code> 可以看到引擎对每个方法的真实期望。</li><li><code>StepAgent.wait</code> 返回 <code>permission</code> 时,<code>pendingPermissions</code> 非空且有可读的 <code>title</code>。</li><li>步骤 agent 的创建要保证产物写在 <code>cwd</code> 下(ADR 0001 的问题:有的平台在传了 parent 时会改用 parent 的目录)。</li><li>不要让某个可选方法抛出未捕获的异常来表示"不支持",除非上表标了 ⚠;用 <code>null</code>。</li></ul><h2 id="计划中的修订-adr-0008-提议" tabindex="-1">计划中的修订(ADR 0008,提议) <a class="header-anchor" href="#计划中的修订-adr-0008-提议" aria-label="Permalink to "计划中的修订(ADR 0008,提议)""></a></h2><p><a href="./../adr/0008-capability-sources-and-platform-plugin">ADR 0008</a> 定下了以下修订的方向,将与实现一起提交,本文暂不改动:能力标明来源(平台 / 插件 / 内置 / 降级);新增"回答待处理的请求"与审批策略;<code>listPaseoProfiles</code> 改名为 <code>listProfiles</code>;<code>attachAgent</code> 改为"恢复步骤会话";引入 agent 事件模型,由核心推导 <code>wait</code>、活动和用量;把对话相关的能力拆为"对话通道"。</p><h2 id="中性化-laoshi-m2a–m2e-已处理" tabindex="-1">中性化(laoshi M2a–M2e 已处理) <a class="header-anchor" href="#中性化-laoshi-m2a–m2e-已处理" aria-label="Permalink to "中性化(laoshi M2a–M2e 已处理)""></a></h2><p>req-kit 1.x 里带 Paseo 字样的地方,laoshi 中已改为中性的名称:</p><ul><li>方法与字段:<code>listPaseoProfiles</code> → <code>listProfiles</code>(M2a),<code>capabilities().paseoTools</code> → <code>platformTools</code>(M2e)。<code>ServiceTarget</code>、<code>ManagedService</code> 本来就是中性的名字,只改了注释。</li><li>状态文件字段:<code>originAgentId</code>、<code>worktree.workspaceId</code>、<code>schedules[]</code> 在第 2 版中改名(M2d,见 <code>state.md</code>);对外契约不变。</li><li>面向使用者的文案和提示词:改用适配器的词汇表(M2e,<code>engine/src/words.ts</code>,见 <a href="./../design/platform-vocabulary">platform-vocabulary</a>);<code>engine/prompts/paseo-services.md</code> 改名为 <code>managed-services.md</code>。</li><li>会话识别:由适配器声明环境变量(<code>originEnv</code>,M2a);使用者识别同样由适配器声明(<code>userEnv</code>,如摸高的 <code>AIMAX_USER_NAME</code>,ADR 0007)。</li><li>配置:<code>AgentProfile.paseoProfile</code> → <code>platformProfile</code>,<code>paseoServices</code> → <code>platformServices</code>,旧名继续读取(M2e);daemon 地址可写在 <code>platform.paseo</code> 中(M2c)。</li></ul><p><code>engine/test/platform.test.ts</code> 检查核心代码和提示词里不出现平台名(有意保留的旧字段名、对外契约字段,在那一行或上一行写明 <code>platform-name:</code> 和原因)。</p></div><p class="source-note">本页由仓库中的 <a href="https://github.com/yiyisf/laoshi/blob/main/contracts/agent-runtime.md">contracts/agent-runtime.md</a> 生成。<a href="https://github.com/yiyisf/laoshi/edit/main/contracts/agent-runtime.md">在 GitHub 上编辑</a></p>',2)])])}const g=t(a,[["render",r]]);export{p as __pageData,g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,o as d,c as o,a2 as c}from"./chunks/framework.BetZR81g.js";const
|
|
1
|
+
import{_ as t,o as d,c as o,a2 as c}from"./chunks/framework.BetZR81g.js";const p=JSON.parse('{"title":"AgentRuntime:引擎对 agent 平台的要求","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/agent-runtime.md","filePath":"reference/contracts/agent-runtime.md","lastUpdated":null}'),a={name:"reference/contracts/agent-runtime.md"};function r(i,e,n,l,s,u){return d(),o("div",null,[...e[0]||(e[0]=[c("",2)])])}const g=t(a,[["render",r]]);export{p as __pageData,g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as t,o as d,c as u,j as l,a as e}from"./chunks/framework.BetZR81g.js";const k=JSON.parse('{"title":"给程序用的 JSON 输出:req api","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/cli-json.md","filePath":"reference/contracts/cli-json.md","lastUpdated":null}'),s={name:"reference/contracts/cli-json.md"};function i(o,n,a,r,c,p){return d(),u("div",null,[...n[0]||(n[0]=[l("div",null,[l("h1",{id:"给程序用的-json-输出-req-api",tabindex:"-1"},[e("给程序用的 JSON 输出:"),l("code",null,"req api"),e(),l("a",{class:"header-anchor",href:"#给程序用的-json-输出-req-api","aria-label":'Permalink to "给程序用的 JSON 输出:`req api`"'},"")]),l("p",null,[e("1.9.0 起。平台插件(如 Paseo 插件)和其他程序通过 "),l("code",null,"req api"),e(" 读取需求、执行管理操作,不直接读写状态文件。每个命令输出一行 JSON:")]),l("div",{class:"language-json vp-adaptive-theme"},[l("button",{title:"Copy Code",class:"copy"}),l("span",{class:"lang"},"json"),l("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[l("code",null,[l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"{ "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"schema"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},"1"),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"kitVersion"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"1.9.0"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"data"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#B31D28","--shiki-light-font-style":"italic","--shiki-dark":"#FDAEB7","--shiki-dark-font-style":"italic"}},"…"),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," }")])])])]),l("p",null,"出错时退出码为 1:"),l("div",{class:"language-json vp-adaptive-theme"},[l("button",{title:"Copy Code",class:"copy"}),l("span",{class:"lang"},"json"),l("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[l("code",null,[l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"{ "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"schema"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},"1"),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"kitVersion"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"1.9.0"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"error"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"code"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"not_found"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"message"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"没有找到需求……"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," } }")])])])]),l("p",null,[l("code",null,"code"),e(":"),l("code",null,"bad_arguments"),e("(参数不对)、"),l("code",null,"not_found"),e("(目录或需求不存在)、"),l("code",null,"not_allowed"),e("(不允许的文件或命令)、"),l("code",null,"failed"),e("(其他错误)。")]),l("p",null,[l("code",null,"schema"),e(" 只在不兼容的修改时增加;新增字段不改变 "),l("code",null,"schema"),e(",读取方应忽略不认识的字段。")]),l("h2",{id:"命令",tabindex:"-1"},[e("命令 "),l("a",{class:"header-anchor",href:"#命令","aria-label":'Permalink to "命令"'},"")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"命令"),l("th",null,[l("code",null,"data")])])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"req api version")]),l("td",null,[l("code",null,"{ kitVersion, kitRoot, apiSchema, paseo, featuresDir }"),e(":"),l("code",null,"paseo"),e(" 是这个版本支持的 Paseo 范围(字段名沿用 1.x,只对 Paseo 有意义,其他平台为 null 或忽略)")])]),l("tr",null,[l("td",null,[l("code",null,"req api list [--repo <目录>]")]),l("td",null,'这个仓库所有工作区中的需求,数组,每项见下面的"需求"')]),l("tr",null,[l("td",null,[l("code",null,"req api list --all")]),l("td",null,[e("本机记录过的所有需求("),l("a",{href:"./usage-record"},"需求索引"),e("),同上;目录已不在的 "),l("code",null,"present: false"),e("。1.14 起还包括:用 "),l("code",null,"--track"),e(" 登记、还在对齐中的需求("),l("code",null,"stage"),e(' 为"对齐中",没有 '),l("code",null,"spec.md"),e(" 时 "),l("code",null,"title"),e(" 取自 "),l("code",null,"alignment.md"),e("),以及索引里出现过的项目中没登记的需求")])]),l("tr",null,[l("td",null,[l("code",null,"req api status <需求> [--repo <目录>]")]),l("td",null,'一个需求的详情,见下面的"详情"')]),l("tr",null,[l("td",null,[l("code",null,"req api file <需求> <文件> [--repo <目录>]")]),l("td",null,[l("code",null,"{ featureDir, file, size, truncated, content }"),e(";只能读取功能目录中的文档(见下),最多 512 KB")])]),l("tr",null,[l("td",null,[l("code",null,"req api stats [--since 30d] [--month 2026-10]")]),l("td",null,[l("code",null,"req stats --json"),e(" 的内容,见 "),l("a",{href:"./usage-record"},"使用记录")])]),l("tr",null,[l("td",null,[l("code",null,"req api index [--rebuild <目录>…] [--prune]")]),l("td",null,[e("不带选项:索引的全部条目;"),l("code",null,"--rebuild"),e(":"),l("code",null,"{ scanned, registered, pruned, total }")])]),l("tr",null,[l("td",null,[l("code",null,"req api run <approve|stop|resume|verify|sync|reply|start> <需求> [--repo <目录>] [选项]")]),l("td",null,[l("code",null,"{ command, featureDir, ok, exitCode, message }"),e("。在 "),l("code",null,"--repo"),e("(默认当前目录)中执行与 "),l("code",null,"req <命令> <需求>"),e(" 完全相同的操作;"),l("code",null,"ok"),e(" 为 false 时退出码为 1。"),l("code",null,"start"),e("(1.14):在项目主目录中自动加 "),l("code",null,"--worktree"),e("(上次已建好工作区的接着用),并把进展发回登记时的对话")])]),l("tr",null,[l("td",null,[l("code",null,"req api models")]),l("td",null,[e("1.12 起。"),l("code",null,"{ current, choices, recommended }"),e(":本机配置中现在的 "),l("code",null,"agents"),e(";daemon 上能无人值守运行的选择("),l("code",null,"{ id, label, provider, profile }"),e(",Paseo profile 在前);按推荐的 "),l("code",null,"agents"),e("。连不上 daemon 时报错")])]),l("tr",null,[l("td",null,[l("code",null,"req api config [--repo <目录>] [--machine]")]),l("td",null,[e("1.12 起。"),l("code",null,"{ sources, ignored, error, repo, groups }"),e(":"),l("code",null,"sources"),e(" 是生效的配置文件("),l("code",null,"layer"),e(" 为 "),l("code",null,"machine"),e(" / "),l("code",null,"team"),e(" / "),l("code",null,"project"),e(",按叠加顺序);"),l("code",null,"groups"),e(" 按主题分组,每项 "),l("code",null,"{ key, label, description, display, value, setBy, scope, changed }"),e(":"),l("code",null,"display"),e(" 是用大白话写的值,"),l("code",null,"value"),e(" 中看起来像密钥的值和个人账号替换为 "),l("code",null,"••••"),e(","),l("code",null,"setBy"),e(" 是写了它的文件,"),l("code",null,"changed"),e(" 表示与默认值不同。配置有错误时 "),l("code",null,"error"),e(" 写明原因,值按各文件所写。"),l("code",null,"--machine"),e(" 不看项目配置")])]),l("tr",null,[l("td",null,[l("code",null,"req api set-agents --json <设置>")]),l("td",null,[e("1.12 起。"),l("code",null,"{ ok, message }"),e("。"),l("code",null,"<设置>"),e(" 是 "),l("code",null,"{ builder, reviewer, fallback }"),e("("),l("code",null,"fallback"),e(" 可以为 null),检查后写入本机配置的 "),l("code",null,"agents"),e(",原文件备份")])]),l("tr",null,[l("td",null,[l("code",null,"req api watchdog [--by plugin|factory] [--dry-run]")]),l("td",null,[e("1.13 起。"),l("code",null,"{ checked, resumed, failed, skipped }"),e(':把本机"运行中但后台进程已不在"的需求直接继续('),l("code",null,"req resume"),e(")。每个进程只继续一次,每个需求 24 小时内最多 3 次;"),l("code",null,"--by plugin"),e(" 同时记下插件在检查(流水线据此不再预约对话的定时检查)")])]),l("tr",null,[l("td",null,[l("code",null,"req api review-url <需求> [--repo <目录>] [--read-only] [--page check]")]),l("td",null,[e("1.13 起;"),l("code",null,"--page check"),e("(1.14)给出同一服务上的验收清单页地址(需要 "),l("code",null,"spec.md"),e("),"),l("code",null,"--page code"),e("(1.14)给出代码审查页地址(需要已经写过代码)。"),l("code",null,"{ url, readOnly }"),e(":这个需求的原型审查页地址(需要时在后台启动审查页的服务)。"),l("code",null,"--read-only"),e(" 的地址只能看,不能提交意见或确认方案。需求不在本机的需求索引中或还没有 "),l("code",null,"prototype/"),e(" 时报 "),l("code",null,"not_found")])])])]),l("p",null,[l("code",null,"<需求>"),e(" 的写法与 "),l("code",null,"req status"),e(" 相同:功能目录、目录名或名称中能唯一确定的一部分。需求在为它新建的工作区中开发时,"),l("code",null,"--repo"),e(" 写对话所在的目录或那个工作区都可以。")]),l("p",null,[l("code",null,"req api file"),e(" 能读取的文件:"),l("code",null,"spec.md"),e("、"),l("code",null,"alignment.md"),e("、"),l("code",null,"spec-review.md"),e("、"),l("code",null,"changes.md"),e("、"),l("code",null,"decisions.tsv"),e("、"),l("code",null,"design.md"),e("、"),l("code",null,"design-review.md"),e("、"),l("code",null,"preview.md"),e("、"),l("code",null,"contract.md"),e("、"),l("code",null,"diagnosis.md"),e("、"),l("code",null,"assessment.md"),e("、"),l("code",null,"implementation.md"),e("、"),l("code",null,"progress.md"),e("、"),l("code",null,"code-review.md"),e("、"),l("code",null,"handoff.md"),e("、"),l("code",null,"service-start.md"),e("、"),l("code",null,"verification.md"),e("、"),l("code",null,"report.md"),e("、"),l("code",null,"acceptance.md"),e("、"),l("code",null,"lessons.tsv"),e("。")]),l("h2",{id:"需求-list-的每一项",tabindex:"-1"},[e("需求("),l("code",null,"list"),e(" 的每一项) "),l("a",{class:"header-anchor",href:"#需求-list-的每一项","aria-label":'Permalink to "需求(`list` 的每一项)"'},"")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"字段"),l("th",null,"含义")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"key")]),l("td",null,"需求在本机的标识(对话所在目录 + 功能目录)")]),l("tr",null,[l("td",null,[l("code",null,"project")]),l("td",null,"项目名:对话所在目录的目录名")]),l("tr",null,[l("td",null,[l("code",null,"codebase")]),l("td",null,[e("laoshi M2c 起。需求所属的代码库:"),l("code",null,"{ root, remote }"),e(","),l("code",null,"root"),e(" 是主检出目录(需求自己的 worktree 归属它的原仓库),"),l("code",null,"remote"),e(" 是 origin 的地址(去掉凭据),没有时为 null(ADR 0007)")])]),l("tr",null,[l("td",null,[l("code",null,"startedBy")]),l("td",null,[e("laoshi 起。发起人:状态文件的 "),l("code",null,"startedBy"),e(";还没运行过、或状态文件是更早的版本时为 null")])]),l("tr",null,[l("td",null,[l("code",null,"repo")]),l("td",null,"需求所在的目录(有自己的工作区时是那个工作区)")]),l("tr",null,[l("td",null,[l("code",null,"sourceRepo"),e(" / "),l("code",null,"workspaceId")]),l("td",null,"有自己的工作区时:对话所在的目录、平台对这个工作区的引用(Paseo 上是工作区 ID);否则 null")]),l("tr",null,[l("td",null,[l("code",null,"featureDir"),e(" / "),l("code",null,"name"),e(" / "),l("code",null,"title")]),l("td",null,"功能目录、目录名、需求标题")]),l("tr",null,[l("td",null,[l("code",null,"type"),e(" / "),l("code",null,"profile"),e(" / "),l("code",null,"branch")]),l("td",null,[e("需求类型("),l("code",null,"defect"),e("、"),l("code",null,"refactor"),e("、"),l("code",null,"assessment"),e(" 或 null)、档位、分支")])]),l("tr",null,[l("td",null,[l("code",null,"stage")]),l("td",null,[e("与 "),l("code",null,"req list"),e(' 相同的阶段说明,如"开发中""等待确认方案""待验收"')])]),l("tr",null,[l("td",null,[l("code",null,"status")]),l("td",null,[e("状态文件的 "),l("code",null,"status"),e(";还没运行过为 null")])]),l("tr",null,[l("td",null,[l("code",null,"running")]),l("td",null,"后台进程是否在运行")]),l("tr",null,[l("td",null,[l("code",null,"phase")]),l("td",null,[l("code",null,"develop"),e(" / "),l("code",null,"verify")])]),l("tr",null,[l("td",null,[l("code",null,"attention")]),l("td",null,[e("需要人处理的事:"),l("code",null,"approval"),e("(确认方案)、"),l("code",null,"business"),e("(需求方决定)、"),l("code",null,"permission"),e("(1.13,步骤在等权限批准;"),l("code",null,"waiting.questions"),e(" 是要批准的操作,"),l("code",null,"waiting.agentId"),e(" 是那个 agent)、"),l("code",null,"interrupted"),e("(中断,可以继续)、"),l("code",null,"not_completed"),e("(结束但未完成)、"),l("code",null,"not_started"),e("(1.14,需求说明已确认超过 30 分钟、或已为它建好工作区,但流水线没有运行过);没有为 null")])]),l("tr",null,[l("td",null,[l("code",null,"waiting")]),l("td",null,[e("1.12 起。"),l("code",null,"attention"),e(" 不为 null 时:"),l("code",null,"since"),e("(从什么时候开始等)、"),l("code",null,"questions"),e("(需求方要回答的问题)、"),l("code",null,"reason"),e("(停止原因)、"),l("code",null,"card"),e("("),l("code",null,"{ system, id, url, requester }"),e(",从卡片开始的需求)、"),l("code",null,"canReply"),e("(能否用 "),l("code",null,"req api run reply <需求> <回复>"),e(" 把回复转给需求的对话)、"),l("code",null,"canStart"),e("(1.14,"),l("code",null,"not_started"),e(" 时为 true:可以用 "),l("code",null,"req api run start <需求>"),e(" 开始开发);否则为 null")])]),l("tr",null,[l("td",null,[l("code",null,"current")]),l("td",null,[e("正在运行的步骤 "),l("code",null,"[{ key, title, agentId }]")])]),l("tr",null,[l("td",null,[l("code",null,"updatedAt")]),l("td",null,"最近一次变化的时间")]),l("tr",null,[l("td",null,[l("code",null,"usage")]),l("td",null,[l("code",null,"{ steps, agentMinutes, inputTokens, outputTokens, costUsd }"),e(";没运行过为 null")])]),l("tr",null,[l("td",null,[l("code",null,"present")]),l("td",null,"目录是否还在")]),l("tr",null,[l("td",null,[l("code",null,"hasPrototype")]),l("td",null,[e("1.13 起。功能目录中有界面原型("),l("code",null,"prototype/"),e("),可以用原型审查页查看")])])])]),l("h2",{id:"详情-status",tabindex:"-1"},[e("详情("),l("code",null,"status"),e(") "),l("a",{class:"header-anchor",href:"#详情-status","aria-label":'Permalink to "详情(`status`)"'},"")]),l("p",null,'"需求"的全部字段,另加:'),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"字段"),l("th",null,"含义")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"files")]),l("td",null,[e("功能目录中存在的、可以用 "),l("code",null,"req api file"),e(" 读取的文件")])]),l("tr",null,[l("td",null,[l("code",null,"run")]),l("td",null,[l("code",null,"{ attempt, startedAt, updatedAt, pid, phaseMode, stopReason, outcome, queuedSince, verifyAt, approval, originAgentId }"),e(";没运行过为 null")])]),l("tr",null,[l("td",null,[l("code",null,"steps")]),l("td",null,[e("每个步骤一项:"),l("code",null,"{ key, stepId, title, phase, attempt, round, agentId, startedAt, endedAt, minutes, outcome, result, error, usage }"),e(";"),l("code",null,"title"),e(' 是给人看的名称(如"代码评审(第 2 轮)"),'),l("code",null,"result"),e(' 是结论的文字(如"需要修改")')])]),l("tr",null,[l("td",null,[l("code",null,"gate")]),l("td",null,[e("质量门:状态文件中的 "),l("code",null,"gate")])]),l("tr",null,[l("td",null,[l("code",null,"estimate")]),l("td",null,[e("1.13 起。"),l("code",null,"{ basis, profile, typicalAgentMinutes, typicalTokens, usedAgentMinutes, usedTokens, leftMinutes, over }"),e(":按本机已完成的同档位需求(至少 3 个)的中位数估算;数据不够或已完成时为 null")])]),l("tr",null,[l("td",null,[l("code",null,"joint")]),l("td",null,[e("联合需求的其他仓库:"),l("code",null,"[{ name, slug, repo, sourceRepo, branch, workspaceId, gate }]")])]),l("tr",null,[l("td",null,[l("code",null,"external")]),l("td",null,[e("外部系统中的卡片(1.9.0 起):"),l("code",null,"[{ name, id, url, status, syncedAt, pending, lastError }]"),e(";"),l("code",null,"pending"),e(" 是等待补发的调用数")])])])])],-1),l("p",{class:"source-note"},[e("本页由仓库中的 "),l("a",{href:"https://github.com/yiyisf/laoshi/blob/main/contracts/cli-json.md"},"contracts/cli-json.md"),e(" 生成。"),l("a",{href:"https://github.com/yiyisf/laoshi/edit/main/contracts/cli-json.md"},"在 GitHub 上编辑")],-1)])])}const g=t(s,[["render",i]]);export{k as __pageData,g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as t,o as d,c as u,j as l,a as e}from"./chunks/framework.BetZR81g.js";const k=JSON.parse('{"title":"给程序用的 JSON 输出:req api","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/cli-json.md","filePath":"reference/contracts/cli-json.md","lastUpdated":null}'),s={name:"reference/contracts/cli-json.md"};function i(o,n,a,r,c,p){return d(),u("div",null,[...n[0]||(n[0]=[l("div",null,[l("h1",{id:"给程序用的-json-输出-req-api",tabindex:"-1"},[e("给程序用的 JSON 输出:"),l("code",null,"req api"),e(),l("a",{class:"header-anchor",href:"#给程序用的-json-输出-req-api","aria-label":'Permalink to "给程序用的 JSON 输出:`req api`"'},"")]),l("p",null,[e("1.9.0 起。平台插件(如 Paseo 插件)和其他程序通过 "),l("code",null,"req api"),e(" 读取需求、执行管理操作,不直接读写状态文件。每个命令输出一行 JSON:")]),l("div",{class:"language-json vp-adaptive-theme"},[l("button",{title:"Copy Code",class:"copy"}),l("span",{class:"lang"},"json"),l("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[l("code",null,[l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"{ "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"schema"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},"1"),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"kitVersion"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"1.9.0"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"data"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#B31D28","--shiki-light-font-style":"italic","--shiki-dark":"#FDAEB7","--shiki-dark-font-style":"italic"}},"…"),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," }")])])])]),l("p",null,"出错时退出码为 1:"),l("div",{class:"language-json vp-adaptive-theme"},[l("button",{title:"Copy Code",class:"copy"}),l("span",{class:"lang"},"json"),l("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[l("code",null,[l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"{ "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"schema"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},"1"),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"kitVersion"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"1.9.0"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"error"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"code"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"not_found"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"message"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"没有找到需求……"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," } }")])])])]),l("p",null,[l("code",null,"code"),e(":"),l("code",null,"bad_arguments"),e("(参数不对)、"),l("code",null,"not_found"),e("(目录或需求不存在)、"),l("code",null,"not_allowed"),e("(不允许的文件或命令)、"),l("code",null,"failed"),e("(其他错误)。")]),l("p",null,[l("code",null,"schema"),e(" 只在不兼容的修改时增加;新增字段不改变 "),l("code",null,"schema"),e(",读取方应忽略不认识的字段。")]),l("h2",{id:"命令",tabindex:"-1"},[e("命令 "),l("a",{class:"header-anchor",href:"#命令","aria-label":'Permalink to "命令"'},"")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"命令"),l("th",null,[l("code",null,"data")])])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"req api version")]),l("td",null,[l("code",null,"{ kitVersion, kitRoot, apiSchema, paseo, featuresDir }"),e(":"),l("code",null,"paseo"),e(" 是这个版本支持的 Paseo 范围(字段名沿用 1.x,只对 Paseo 有意义,其他平台为 null 或忽略)")])]),l("tr",null,[l("td",null,[l("code",null,"req api list [--repo <目录>]")]),l("td",null,'这个仓库所有工作区中的需求,数组,每项见下面的"需求"')]),l("tr",null,[l("td",null,[l("code",null,"req api list --all")]),l("td",null,[e("本机记录过的所有需求("),l("a",{href:"./usage-record"},"需求索引"),e("),同上;目录已不在的 "),l("code",null,"present: false"),e("。1.14 起还包括:用 "),l("code",null,"--track"),e(" 登记、还在对齐中的需求("),l("code",null,"stage"),e(' 为"对齐中",没有 '),l("code",null,"spec.md"),e(" 时 "),l("code",null,"title"),e(" 取自 "),l("code",null,"alignment.md"),e("),以及索引里出现过的项目中没登记的需求")])]),l("tr",null,[l("td",null,[l("code",null,"req api status <需求> [--repo <目录>]")]),l("td",null,'一个需求的详情,见下面的"详情"')]),l("tr",null,[l("td",null,[l("code",null,"req api file <需求> <文件> [--repo <目录>]")]),l("td",null,[l("code",null,"{ featureDir, file, size, truncated, content }"),e(";只能读取功能目录中的文档(见下),最多 512 KB")])]),l("tr",null,[l("td",null,[l("code",null,"req api stats [--since 30d] [--month 2026-10]")]),l("td",null,[l("code",null,"req stats --json"),e(" 的内容,见 "),l("a",{href:"./usage-record"},"使用记录")])]),l("tr",null,[l("td",null,[l("code",null,"req api index [--rebuild <目录>…] [--prune]")]),l("td",null,[e("不带选项:索引的全部条目;"),l("code",null,"--rebuild"),e(":"),l("code",null,"{ scanned, registered, pruned, total }")])]),l("tr",null,[l("td",null,[l("code",null,"req api run <approve|stop|resume|verify|sync|reply|start> <需求> [--repo <目录>] [选项]")]),l("td",null,[l("code",null,"{ command, featureDir, ok, exitCode, message }"),e("。在 "),l("code",null,"--repo"),e("(默认当前目录)中执行与 "),l("code",null,"req <命令> <需求>"),e(" 完全相同的操作;"),l("code",null,"ok"),e(" 为 false 时退出码为 1。"),l("code",null,"start"),e("(1.14):在项目主目录中自动加 "),l("code",null,"--worktree"),e("(上次已建好工作区的接着用),并把进展发回登记时的对话")])]),l("tr",null,[l("td",null,[l("code",null,"req api models")]),l("td",null,[e("1.12 起。"),l("code",null,"{ current, choices, recommended }"),e(":本机配置中现在的 "),l("code",null,"agents"),e(";daemon 上能无人值守运行的选择("),l("code",null,"{ id, label, provider, profile }"),e(",Paseo profile 在前);按推荐的 "),l("code",null,"agents"),e("。连不上 daemon 时报错")])]),l("tr",null,[l("td",null,[l("code",null,"req api config [--repo <目录>] [--machine]")]),l("td",null,[e("1.12 起。"),l("code",null,"{ sources, ignored, error, repo, groups }"),e(":"),l("code",null,"sources"),e(" 是生效的配置文件("),l("code",null,"layer"),e(" 为 "),l("code",null,"machine"),e(" / "),l("code",null,"team"),e(" / "),l("code",null,"project"),e(",按叠加顺序);"),l("code",null,"groups"),e(" 按主题分组,每项 "),l("code",null,"{ key, label, description, display, value, setBy, scope, changed }"),e(":"),l("code",null,"display"),e(" 是用大白话写的值,"),l("code",null,"value"),e(" 中看起来像密钥的值和个人账号替换为 "),l("code",null,"••••"),e(","),l("code",null,"setBy"),e(" 是写了它的文件,"),l("code",null,"changed"),e(" 表示与默认值不同。配置有错误时 "),l("code",null,"error"),e(" 写明原因,值按各文件所写。"),l("code",null,"--machine"),e(" 不看项目配置")])]),l("tr",null,[l("td",null,[l("code",null,"req api set-agents --json <设置>")]),l("td",null,[e("1.12 起。"),l("code",null,"{ ok, message }"),e("。"),l("code",null,"<设置>"),e(" 是 "),l("code",null,"{ builder, reviewer, fallback }"),e("("),l("code",null,"fallback"),e(" 可以为 null),检查后写入本机配置的 "),l("code",null,"agents"),e(",原文件备份")])]),l("tr",null,[l("td",null,[l("code",null,"req api watchdog [--by plugin|factory] [--dry-run]")]),l("td",null,[e("1.13 起。"),l("code",null,"{ checked, resumed, failed, skipped }"),e(':把本机"运行中但后台进程已不在"的需求直接继续('),l("code",null,"req resume"),e(")。每个进程只继续一次,每个需求 24 小时内最多 3 次;"),l("code",null,"--by plugin"),e(" 同时记下插件在检查(流水线据此不再预约对话的定时检查)")])]),l("tr",null,[l("td",null,[l("code",null,"req api review-url <需求> [--repo <目录>] [--read-only] [--page check]")]),l("td",null,[e("1.13 起;"),l("code",null,"--page check"),e("(1.14)给出同一服务上的验收清单页地址(需要 "),l("code",null,"spec.md"),e("),"),l("code",null,"--page code"),e("(1.14)给出代码审查页地址(需要已经写过代码)。"),l("code",null,"{ url, readOnly }"),e(":这个需求的原型审查页地址(需要时在后台启动审查页的服务)。"),l("code",null,"--read-only"),e(" 的地址只能看,不能提交意见或确认方案。需求不在本机的需求索引中或还没有 "),l("code",null,"prototype/"),e(" 时报 "),l("code",null,"not_found")])])])]),l("p",null,[l("code",null,"<需求>"),e(" 的写法与 "),l("code",null,"req status"),e(" 相同:功能目录、目录名或名称中能唯一确定的一部分。需求在为它新建的工作区中开发时,"),l("code",null,"--repo"),e(" 写对话所在的目录或那个工作区都可以。")]),l("p",null,[l("code",null,"req api file"),e(" 能读取的文件:"),l("code",null,"spec.md"),e("、"),l("code",null,"alignment.md"),e("、"),l("code",null,"spec-review.md"),e("、"),l("code",null,"changes.md"),e("、"),l("code",null,"decisions.tsv"),e("、"),l("code",null,"design.md"),e("、"),l("code",null,"design-review.md"),e("、"),l("code",null,"preview.md"),e("、"),l("code",null,"contract.md"),e("、"),l("code",null,"diagnosis.md"),e("、"),l("code",null,"assessment.md"),e("、"),l("code",null,"implementation.md"),e("、"),l("code",null,"progress.md"),e("、"),l("code",null,"code-review.md"),e("、"),l("code",null,"handoff.md"),e("、"),l("code",null,"service-start.md"),e("、"),l("code",null,"verification.md"),e("、"),l("code",null,"report.md"),e("、"),l("code",null,"acceptance.md"),e("、"),l("code",null,"lessons.tsv"),e("。")]),l("h2",{id:"需求-list-的每一项",tabindex:"-1"},[e("需求("),l("code",null,"list"),e(" 的每一项) "),l("a",{class:"header-anchor",href:"#需求-list-的每一项","aria-label":'Permalink to "需求(`list` 的每一项)"'},"")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"字段"),l("th",null,"含义")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"key")]),l("td",null,"需求在本机的标识(对话所在目录 + 功能目录)")]),l("tr",null,[l("td",null,[l("code",null,"project")]),l("td",null,"项目名:对话所在目录的目录名")]),l("tr",null,[l("td",null,[l("code",null,"codebase")]),l("td",null,[e("laoshi M2c 起。需求所属的代码库:"),l("code",null,"{ root, remote }"),e(","),l("code",null,"root"),e(" 是主检出目录(需求自己的 worktree 归属它的原仓库),"),l("code",null,"remote"),e(" 是 origin 的地址(去掉凭据),没有时为 null(ADR 0007)")])]),l("tr",null,[l("td",null,[l("code",null,"startedBy")]),l("td",null,[e("laoshi 起。发起人:状态文件的 "),l("code",null,"startedBy"),e(";还没运行过、或状态文件是更早的版本时为 null")])]),l("tr",null,[l("td",null,[l("code",null,"repo")]),l("td",null,"需求所在的目录(有自己的工作区时是那个工作区)")]),l("tr",null,[l("td",null,[l("code",null,"sourceRepo"),e(" / "),l("code",null,"workspaceId")]),l("td",null,"有自己的工作区时:对话所在的目录、平台对这个工作区的引用(Paseo 上是工作区 ID);否则 null")]),l("tr",null,[l("td",null,[l("code",null,"featureDir"),e(" / "),l("code",null,"name"),e(" / "),l("code",null,"title")]),l("td",null,"功能目录、目录名、需求标题")]),l("tr",null,[l("td",null,[l("code",null,"type"),e(" / "),l("code",null,"profile"),e(" / "),l("code",null,"branch")]),l("td",null,[e("需求类型("),l("code",null,"defect"),e("、"),l("code",null,"refactor"),e("、"),l("code",null,"assessment"),e(" 或 null)、档位、分支")])]),l("tr",null,[l("td",null,[l("code",null,"stage")]),l("td",null,[e("与 "),l("code",null,"req list"),e(' 相同的阶段说明,如"开发中""等待确认方案""待验收"')])]),l("tr",null,[l("td",null,[l("code",null,"status")]),l("td",null,[e("状态文件的 "),l("code",null,"status"),e(";还没运行过为 null")])]),l("tr",null,[l("td",null,[l("code",null,"running")]),l("td",null,"后台进程是否在运行")]),l("tr",null,[l("td",null,[l("code",null,"phase")]),l("td",null,[l("code",null,"develop"),e(" / "),l("code",null,"verify")])]),l("tr",null,[l("td",null,[l("code",null,"attention")]),l("td",null,[e("需要人处理的事:"),l("code",null,"approval"),e("(确认方案)、"),l("code",null,"business"),e("(需求方决定)、"),l("code",null,"permission"),e("(1.13,步骤在等权限批准;"),l("code",null,"waiting.questions"),e(" 是要批准的操作,"),l("code",null,"waiting.agentId"),e(" 是那个 agent)、"),l("code",null,"interrupted"),e("(中断,可以继续)、"),l("code",null,"not_completed"),e("(结束但未完成)、"),l("code",null,"not_started"),e("(1.14,需求说明已确认超过 30 分钟、或已为它建好工作区,但流水线没有运行过);没有为 null")])]),l("tr",null,[l("td",null,[l("code",null,"waiting")]),l("td",null,[e("1.12 起。"),l("code",null,"attention"),e(" 不为 null 时:"),l("code",null,"since"),e("(从什么时候开始等)、"),l("code",null,"questions"),e("(需求方要回答的问题)、"),l("code",null,"reason"),e("(停止原因)、"),l("code",null,"card"),e("("),l("code",null,"{ system, id, url, requester }"),e(",从卡片开始的需求)、"),l("code",null,"canReply"),e("(能否用 "),l("code",null,"req api run reply <需求> <回复>"),e(" 把回复转给需求的对话)、"),l("code",null,"canStart"),e("(1.14,"),l("code",null,"not_started"),e(" 时为 true:可以用 "),l("code",null,"req api run start <需求>"),e(" 开始开发);否则为 null")])]),l("tr",null,[l("td",null,[l("code",null,"current")]),l("td",null,[e("正在运行的步骤 "),l("code",null,"[{ key, title, agentId }]")])]),l("tr",null,[l("td",null,[l("code",null,"updatedAt")]),l("td",null,"最近一次变化的时间")]),l("tr",null,[l("td",null,[l("code",null,"usage")]),l("td",null,[l("code",null,"{ steps, agentMinutes, inputTokens, outputTokens, costUsd }"),e(";没运行过为 null")])]),l("tr",null,[l("td",null,[l("code",null,"present")]),l("td",null,"目录是否还在")]),l("tr",null,[l("td",null,[l("code",null,"hasPrototype")]),l("td",null,[e("1.13 起。功能目录中有界面原型("),l("code",null,"prototype/"),e("),可以用原型审查页查看")])])])]),l("h2",{id:"详情-status",tabindex:"-1"},[e("详情("),l("code",null,"status"),e(") "),l("a",{class:"header-anchor",href:"#详情-status","aria-label":'Permalink to "详情(`status`)"'},"")]),l("p",null,'"需求"的全部字段,另加:'),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"字段"),l("th",null,"含义")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"files")]),l("td",null,[e("功能目录中存在的、可以用 "),l("code",null,"req api file"),e(" 读取的文件")])]),l("tr",null,[l("td",null,[l("code",null,"run")]),l("td",null,[l("code",null,"{ attempt, startedAt, updatedAt, pid, phaseMode, stopReason, outcome, queuedSince, verifyAt, approval, originAgentId }"),e(";没运行过为 null")])]),l("tr",null,[l("td",null,[l("code",null,"steps")]),l("td",null,[e("每个步骤一项:"),l("code",null,"{ key, stepId, title, phase, attempt, round, agentId, startedAt, endedAt, minutes, outcome, result, error, usage }"),e(";"),l("code",null,"title"),e(' 是给人看的名称(如"代码评审(第 2 轮)"),'),l("code",null,"result"),e(' 是结论的文字(如"需要修改")')])]),l("tr",null,[l("td",null,[l("code",null,"gate")]),l("td",null,[e("质量门:状态文件中的 "),l("code",null,"gate")])]),l("tr",null,[l("td",null,[l("code",null,"estimate")]),l("td",null,[e("1.13 起。"),l("code",null,"{ basis, profile, typicalAgentMinutes, typicalTokens, usedAgentMinutes, usedTokens, leftMinutes, over }"),e(":按本机已完成的同档位需求(至少 3 个)的中位数估算;数据不够或已完成时为 null")])]),l("tr",null,[l("td",null,[l("code",null,"joint")]),l("td",null,[e("联合需求的其他仓库:"),l("code",null,"[{ name, slug, repo, sourceRepo, branch, workspaceId, gate }]")])]),l("tr",null,[l("td",null,[l("code",null,"external")]),l("td",null,[e("外部系统中的卡片(1.9.0 起):"),l("code",null,"[{ name, id, url, status, syncedAt, pending, lastError }]"),e(";"),l("code",null,"pending"),e(" 是等待补发的调用数")])])])])],-1),l("p",{class:"source-note"},[e("本页由仓库中的 "),l("a",{href:"https://github.com/yiyisf/laoshi/blob/main/contracts/cli-json.md"},"contracts/cli-json.md"),e(" 生成。"),l("a",{href:"https://github.com/yiyisf/laoshi/edit/main/contracts/cli-json.md"},"在 GitHub 上编辑")],-1)])])}const g=t(s,[["render",i]]);export{k as __pageData,g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,o as d,c as r,a2 as a}from"./chunks/framework.BetZR81g.js";const h=JSON.parse('{"title":"文件格式约定","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/index.md","filePath":"reference/contracts/index.md","lastUpdated":null}'),
|
|
1
|
+
import{_ as e,o as d,c as r,a2 as a}from"./chunks/framework.BetZR81g.js";const h=JSON.parse('{"title":"文件格式约定","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/index.md","filePath":"reference/contracts/index.md","lastUpdated":null}'),c={name:"reference/contracts/index.md"};function o(i,t,s,n,l,f){return d(),r("div",null,[...t[0]||(t[0]=[a('<div><h1 id="文件格式约定" tabindex="-1">文件格式约定 <a class="header-anchor" href="#文件格式约定" aria-label="Permalink to "文件格式约定""></a></h1><p>这些文件同时被聊天中的 skill、流水线引擎和步骤 agent 读写。改动格式时,同时更新这里、相关代码和测试,并在 <code>CHANGELOG.md</code> 的"升级须知"中说明。</p><table tabindex="0"><thead><tr><th>文件</th><th>约定</th><th>格式版本</th></tr></thead><tbody><tr><td><code>docs/features/<目录>/spec.md</code></td><td><a href="./spec">spec.md</a></td><td><code>req-kit/spec@1</code></td></tr><tr><td><code>docs/features/<目录>/.pipeline/state.json</code></td><td><a href="./state">state.md</a></td><td><code>version: 1</code></td></tr><tr><td><code>docs/features/<目录>/.pipeline/results/<步骤>.json</code></td><td><a href="./result-file">result-file.md</a></td><td>按步骤固定字段</td></tr><tr><td><code>decisions.tsv</code>、<code>changes.md</code>、<code>acceptance.md</code> 与需求总览</td><td><a href="./feature-files">feature-files.md</a></td><td>见各文件说明</td></tr><tr><td><code>.requirement-pipeline/verify.md</code></td><td><a href="./verify">verify.md</a></td><td>自由格式,建议结构见文件</td></tr><tr><td>外部通知(企业 IM 等)收到的事件</td><td><a href="./notifier-event">notifier-event.md</a></td><td><code>schema: 1</code></td></tr><tr><td><code>req api</code> 的输出(平台插件等程序读取)</td><td><a href="./cli-json">cli-json.md</a></td><td><code>schema: 1</code></td></tr><tr><td><code>~/.req-kit/index/</code>、<code>~/.req-kit/usage/runs.jsonl</code></td><td><a href="./usage-record">usage-record.md</a></td><td><code>schema: 1</code></td></tr><tr><td>引擎对 agent 平台的要求(<code>AgentRuntime</code>,<code>engine/src/runtime.ts</code>)</td><td><a href="./agent-runtime">agent-runtime.md</a></td><td>以 <code>runtime.ts</code> 的类型为准</td></tr></tbody></table><p>格式版本的规则:</p><ul><li>同一主版本内只做可以自动迁移的变更。</li><li>引擎读到旧版本的状态文件时自动迁移,原文件保留为 <code>state.json.bak-v<旧版本></code>。</li><li>读到比自己新的版本时拒绝运行,提示升级 req-kit 或恢复备份。</li></ul></div><p class="source-note">本页由仓库中的 <a href="https://github.com/yiyisf/laoshi/blob/main/contracts/README.md">contracts/README.md</a> 生成。<a href="https://github.com/yiyisf/laoshi/edit/main/contracts/README.md">在 GitHub 上编辑</a></p>',2)])])}const u=e(c,[["render",o]]);export{h as __pageData,u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,o as d,c as r,a2 as a}from"./chunks/framework.BetZR81g.js";const h=JSON.parse('{"title":"文件格式约定","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/index.md","filePath":"reference/contracts/index.md","lastUpdated":null}'),
|
|
1
|
+
import{_ as e,o as d,c as r,a2 as a}from"./chunks/framework.BetZR81g.js";const h=JSON.parse('{"title":"文件格式约定","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/index.md","filePath":"reference/contracts/index.md","lastUpdated":null}'),c={name:"reference/contracts/index.md"};function o(i,t,s,n,l,f){return d(),r("div",null,[...t[0]||(t[0]=[a("",2)])])}const u=e(c,[["render",o]]);export{h as __pageData,u as default};
|
|
@@ -21,4 +21,4 @@ import{_ as e,o as t,c as n,j as i,a as l}from"./chunks/framework.BetZR81g.js";c
|
|
|
21
21
|
`),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "requester"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),i("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"张广祥"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),l(`
|
|
22
22
|
`),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "card"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"system"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),i("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"ALM"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"id"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),i("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"CMASTER-BUSINESS#9902"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"url"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},"null"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," },")]),l(`
|
|
23
23
|
`),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "recipients"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": [{ "),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"name"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),i("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"张广祥"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"accounts"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"um"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),i("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"ZHANGGX001"'),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," } }]")]),l(`
|
|
24
|
-
`),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),i("ul",null,[i("li",null,[i("code",null,"audience"),l(":"),i("code",null,"requester"),l(" 表示这件事要需求方处理或是给他的结果("),i("code",null,"blocked"),l("、"),i("code",null,"approval"),l("、"),i("code",null,"phase_done"),l("、"),i("code",null,"completed"),l(",而且需求从卡片开始、知道提出人);其余为 "),i("code",null,"team"),l(",发到群里即可。")]),i("li",null,[i("code",null,"requester"),l("、"),i("code",null,"card"),l(":从卡片开始的需求的提出人和卡片;其他需求为 null。")]),i("li",null,[i("code",null,"recipients"),l(":"),i("code",null,"audience"),l(" 为 "),i("code",null,"requester"),l(" 时是需求方本人;"),i("code",null,"accounts"),l(" 来自本机或团队配置的 "),i("code",null,"people"),l("(姓名 → 各种账号),没有写时为 "),i("code",null,"{}"),l(",模块可以改发到群。")])]),i("table",{tabindex:"0"},[i("thead",null,[i("tr",null,[i("th",null,"type"),i("th",null,"什么时候"),i("th",null,"details")])]),i("tbody",null,[i("tr",null,[i("td",null,[i("code",null,"milestone")]),i("td",null,[l("方案确定、开始验证、开始修复缺陷(配置 "),i("code",null,"notifyMilestones"),l(" 为 true 时,每次尝试各一次)")]),i("td",null,[i("code",null,"milestone"),l(":"),i("code",null,"design-settled"),l("、"),i("code",null,"code-reviewed"),l("、"),i("code",null,"fixing-defects"),l("、"),i("code",null,"handback-<n>"),l("(1.7.0 起,测试验证第 n 次把缺陷退回研发)")])]),i("tr",null,[i("td",null,[i("code",null,"blocked")]),i("td",null,"方案审核发现需要需求方决定的问题,流水线已暂停"),i("td",null,[i("code",null,"questions"),l("(字符串数组)、"),i("code",null,"resumeCommand")])]),i("tr",null,[i("td",null,[i("code",null,"permission")]),i("td",null,"步骤 agent 在等待权限批准"),i("td",null,[i("code",null,"stepTitle"),l("、"),i("code",null,"agentTitle"),l("、"),i("code",null,"requests"),l("(字符串数组)")])]),i("tr",null,[i("td",null,[i("code",null,"failed")]),i("td",null,"流水线因错误中断(已自动重试过的临时错误除外)"),i("td",null,[i("code",null,"stepTitle"),l("、"),i("code",null,"reason"),l("、"),i("code",null,"logPath"),l("、"),i("code",null,"resumeCommand")])]),i("tr",null,[i("td",null,[i("code",null,"completed")]),i("td",null,"流水线结束,报告已生成"),i("td",null,[i("code",null,"outcome"),l("("),i("code",null,"completed"),l("、"),i("code",null,"completed_with_issues"),l("、"),i("code",null,"not_completed"),l(")、"),i("code",null,"summary"),l("、"),i("code",null,"reportPath"),l('。"只做研发"时另有 '),i("code",null,"mode"),l("("),i("code",null,"develop-only"),l(")和 "),i("code",null,"handoffPath"),l(",报告是研发报告,需要人工测试")])]),i("tr",null,[i("td",null,[i("code",null,"approval")]),i("td",null,[l("1.8.0 起。方案确认点("),i("code",null,"designApproval"),l('):方案已通过审核,等待需求方确认"做完后会看到什么",还没有开始写代码')]),i("td",null,[i("code",null,"previewPath"),l("(要确认的内容)、"),i("code",null,"approveCommand"),l("(确认后继续的命令)、"),i("code",null,"resumeCommand"),l("(修改需求后继续的命令),都在发起的对话中执行")])]),i("tr",null,[i("td",null,[i("code",null,"phase_done")]),i("td",null,"1.7.0 起。分阶段执行时研发阶段已完成(代码已通过评审、提测说明已写好),流水线停在闸口等待测试验证。测试退回后再次修完也会发"),i("td",null,[i("code",null,"handoffPath"),l("(提测说明)、"),i("code",null,"mode"),l("("),i("code",null,"gated"),l(")、"),i("code",null,"verifyCommand"),l("(开始测试验证的命令,在发起的对话中执行)、"),i("code",null,"verifyAt"),l("(预约的开始时间,ISO 格式,没有为 null)、"),i("code",null,"handbacks"),l("(已退回的次数)")])]),i("tr",null,[i("td",null,[i("code",null,"alert")]),i("td",null,[l("1.12 起。接单器("),i("code",null,"req factory"),l("
|
|
24
|
+
`),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),i("ul",null,[i("li",null,[i("code",null,"audience"),l(":"),i("code",null,"requester"),l(" 表示这件事要需求方处理或是给他的结果("),i("code",null,"blocked"),l("、"),i("code",null,"approval"),l("、"),i("code",null,"phase_done"),l("、"),i("code",null,"completed"),l(",而且需求从卡片开始、知道提出人);其余为 "),i("code",null,"team"),l(",发到群里即可。")]),i("li",null,[i("code",null,"requester"),l("、"),i("code",null,"card"),l(":从卡片开始的需求的提出人和卡片;其他需求为 null。")]),i("li",null,[i("code",null,"recipients"),l(":"),i("code",null,"audience"),l(" 为 "),i("code",null,"requester"),l(" 时是需求方本人;"),i("code",null,"accounts"),l(" 来自本机或团队配置的 "),i("code",null,"people"),l("(姓名 → 各种账号),没有写时为 "),i("code",null,"{}"),l(",模块可以改发到群。")])]),i("table",{tabindex:"0"},[i("thead",null,[i("tr",null,[i("th",null,"type"),i("th",null,"什么时候"),i("th",null,"details")])]),i("tbody",null,[i("tr",null,[i("td",null,[i("code",null,"milestone")]),i("td",null,[l("方案确定、开始验证、开始修复缺陷(配置 "),i("code",null,"notifyMilestones"),l(" 为 true 时,每次尝试各一次)")]),i("td",null,[i("code",null,"milestone"),l(":"),i("code",null,"design-settled"),l("、"),i("code",null,"code-reviewed"),l("、"),i("code",null,"fixing-defects"),l("、"),i("code",null,"handback-<n>"),l("(1.7.0 起,测试验证第 n 次把缺陷退回研发)")])]),i("tr",null,[i("td",null,[i("code",null,"blocked")]),i("td",null,"方案审核发现需要需求方决定的问题,流水线已暂停"),i("td",null,[i("code",null,"questions"),l("(字符串数组)、"),i("code",null,"resumeCommand")])]),i("tr",null,[i("td",null,[i("code",null,"permission")]),i("td",null,"步骤 agent 在等待权限批准"),i("td",null,[i("code",null,"stepTitle"),l("、"),i("code",null,"agentTitle"),l("、"),i("code",null,"requests"),l("(字符串数组)")])]),i("tr",null,[i("td",null,[i("code",null,"failed")]),i("td",null,"流水线因错误中断(已自动重试过的临时错误除外)"),i("td",null,[i("code",null,"stepTitle"),l("、"),i("code",null,"reason"),l("、"),i("code",null,"logPath"),l("、"),i("code",null,"resumeCommand")])]),i("tr",null,[i("td",null,[i("code",null,"completed")]),i("td",null,"流水线结束,报告已生成"),i("td",null,[i("code",null,"outcome"),l("("),i("code",null,"completed"),l("、"),i("code",null,"completed_with_issues"),l("、"),i("code",null,"not_completed"),l(")、"),i("code",null,"summary"),l("、"),i("code",null,"reportPath"),l('。"只做研发"时另有 '),i("code",null,"mode"),l("("),i("code",null,"develop-only"),l(")和 "),i("code",null,"handoffPath"),l(",报告是研发报告,需要人工测试")])]),i("tr",null,[i("td",null,[i("code",null,"approval")]),i("td",null,[l("1.8.0 起。方案确认点("),i("code",null,"designApproval"),l('):方案已通过审核,等待需求方确认"做完后会看到什么",还没有开始写代码')]),i("td",null,[i("code",null,"previewPath"),l("(要确认的内容)、"),i("code",null,"approveCommand"),l("(确认后继续的命令)、"),i("code",null,"resumeCommand"),l("(修改需求后继续的命令),都在发起的对话中执行")])]),i("tr",null,[i("td",null,[i("code",null,"phase_done")]),i("td",null,"1.7.0 起。分阶段执行时研发阶段已完成(代码已通过评审、提测说明已写好),流水线停在闸口等待测试验证。测试退回后再次修完也会发"),i("td",null,[i("code",null,"handoffPath"),l("(提测说明)、"),i("code",null,"mode"),l("("),i("code",null,"gated"),l(")、"),i("code",null,"verifyCommand"),l("(开始测试验证的命令,在发起的对话中执行)、"),i("code",null,"verifyAt"),l("(预约的开始时间,ISO 格式,没有为 null)、"),i("code",null,"handbacks"),l("(已退回的次数)")])]),i("tr",null,[i("td",null,[i("code",null,"alert")]),i("td",null,[l("1.12 起。接单器("),i("code",null,"req factory"),l(")自检没有通过(平台连不上、agent 没有登录、额度用完、需求管理系统的命令不可用),暂停接新卡片;或者恢复正常。同样的问题只发一次。"),i("code",null,"feature.title"),l(' 为"接单器",'),i("code",null,"feature.dir"),l("、"),i("code",null,"repo"),l(" 为空")]),i("td",null,[i("code",null,"source"),l("("),i("code",null,"factory"),l(")、"),i("code",null,"machine"),l("、"),i("code",null,"problems"),l("(字符串数组,恢复时为空)、"),i("code",null,"recovered"),l("。1.14 起,步骤 agent 运行或开始运行危险命令("),i("code",null,"dangerGuard"),l(")时也发:"),i("code",null,"details.kind"),l(" 为 "),i("code",null,"danger"),l(",另有 "),i("code",null,"stepTitle"),l("、"),i("code",null,"command"),l("、"),i("code",null,"label"),l("、"),i("code",null,"ran"),l(";这时 "),i("code",null,"feature"),l("、"),i("code",null,"repo"),l(" 是那个需求的")])]),i("tr",null,[i("td",null,[i("code",null,"digest")]),i("td",null,[i("code",null,"req digest --notify"),l("(或由 "),i("code",null,"req digest --schedule"),l(" 创建的平台定时任务)发送项目的需求总览,1.6.0 起。"),i("code",null,"feature.title"),l(' 为"<项目> 需求总览",'),i("code",null,"text"),l(" 是完整的多行总览")]),i("td",null,[i("code",null,"features"),l(":每个需求的 "),i("code",null,"name"),l("、"),i("code",null,"title"),l("、"),i("code",null,"stage"),l("、"),i("code",null,"branch"),l("、"),i("code",null,"updatedAt"),l("、"),i("code",null,"usage"),l(";"),i("code",null,"recurringLessons"),l("(1.8.0 起):在两个以上需求的 "),i("code",null,"lessons.tsv"),l(" 中出现的问题类别,每项 "),i("code",null,"category"),l("、"),i("code",null,"features"),l("、"),i("code",null,"rules")])])])]),i("h2",{id:"兼容性",tabindex:"-1"},[l("兼容性 "),i("a",{class:"header-anchor",href:"#兼容性","aria-label":'Permalink to "兼容性"'},"")]),i("ul",null,[i("li",null,[l("同一 "),i("code",null,"schema"),l(" 内只增加字段,不删除、不改含义;模块应忽略不认识的字段和事件类型。")]),i("li",null,[l("不兼容的变化会提升 "),i("code",null,"schema"),l(",并在 "),i("code",null,"CHANGELOG.md"),l(' 的"升级须知"中说明。')])])],-1),i("p",{class:"source-note"},[l("本页由仓库中的 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/contracts/notifier-event.md"},"contracts/notifier-event.md"),l(" 生成。"),i("a",{href:"https://github.com/yiyisf/laoshi/edit/main/contracts/notifier-event.md"},"在 GitHub 上编辑")],-1)])])}const c=e(a,[["render",h]]);export{u as __pageData,c as default};
|