@yiyi_zhang/laoshi 0.1.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.
Files changed (176) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/adapters/cli/adapter.ts +53 -0
  3. package/adapters/cli/cli-runtime.ts +402 -0
  4. package/adapters/cli/drivers.ts +146 -0
  5. package/adapters/cli/install.mjs +28 -0
  6. package/adapters/cli/skill/setup.md +8 -0
  7. package/adapters/dsh/plugin/index.mjs +1 -1
  8. package/adapters/dsh/plugin/package.json +1 -1
  9. package/adapters/mogao/adapter.ts +47 -0
  10. package/adapters/mogao/install.mjs +31 -0
  11. package/adapters/mogao/make-expert.mjs +64 -0
  12. package/adapters/mogao/mogao-runtime.ts +506 -0
  13. package/adapters/mogao/skill/setup.md +21 -0
  14. package/adapters/paseo/adapter.ts +1 -1
  15. package/adapters/paseo/install.mjs +17 -5
  16. package/adapters/paseo/migrate.ts +267 -0
  17. package/adapters/paseo/plugin/OVERVIEW.md +9 -0
  18. package/adapters/paseo/plugin/client/config.tsx +216 -0
  19. package/adapters/paseo/plugin/client/data.ts +85 -0
  20. package/adapters/paseo/plugin/client/detail.tsx +342 -0
  21. package/adapters/paseo/plugin/client/format.ts +173 -0
  22. package/adapters/paseo/plugin/client/inbox.tsx +190 -0
  23. package/adapters/paseo/plugin/client/live.ts +161 -0
  24. package/adapters/paseo/plugin/client/markdown.tsx +220 -0
  25. package/adapters/paseo/plugin/client/models.tsx +117 -0
  26. package/adapters/paseo/plugin/client/nav.ts +22 -0
  27. package/adapters/paseo/plugin/client/overview.tsx +103 -0
  28. package/adapters/paseo/plugin/client/panel.tsx +56 -0
  29. package/adapters/paseo/plugin/client/review.tsx +80 -0
  30. package/adapters/paseo/plugin/client/row.tsx +63 -0
  31. package/adapters/paseo/plugin/client/settings.tsx +92 -0
  32. package/adapters/paseo/plugin/client/sidebar.tsx +27 -0
  33. package/adapters/paseo/plugin/client/stats.tsx +138 -0
  34. package/adapters/paseo/plugin/client/ui.tsx +278 -0
  35. package/adapters/paseo/plugin/client/web.ts +34 -0
  36. package/adapters/paseo/plugin/index.client.tsx +66 -0
  37. package/adapters/paseo/plugin/index.server.ts +61 -0
  38. package/adapters/paseo/plugin/package.json +22 -0
  39. package/adapters/paseo/plugin/paseo-plugin.json +6 -0
  40. package/adapters/paseo/plugin/server/handlers.ts +69 -0
  41. package/adapters/paseo/plugin/server/req.ts +105 -0
  42. package/adapters/paseo/plugin/shared/contracts.ts +286 -0
  43. package/adapters/paseo/plugin/shared/rk-colors.ts +35 -0
  44. package/adapters/paseo/plugin/tsconfig.json +16 -0
  45. package/adapters/paseo/plugin-cmd.mjs +233 -0
  46. package/bin/install.mjs +12 -5
  47. package/bin/req.mjs +18 -2
  48. package/contracts/README.md +1 -1
  49. package/contracts/agent-runtime.md +5 -2
  50. package/contracts/cli-json.md +4 -3
  51. package/contracts/notifier-event.md +2 -2
  52. package/contracts/state.md +2 -0
  53. package/contracts/usage-record.md +3 -3
  54. package/docs/design/adapter-guide.md +2 -1
  55. package/docs/design/cli-adapter.md +75 -0
  56. package/docs/design/compat-migration.md +2 -0
  57. package/docs/design/mogao-expert.md +103 -0
  58. package/docs/guide//345/234/250/346/221/270/351/253/230/344/270/212/344/275/277/347/224/250.md +132 -0
  59. package/docs/guide//345/256/211/350/243/205/344/270/216/345/215/207/347/272/247.md +32 -3
  60. package/docs/guide//347/273/264/346/212/244/350/200/205/346/214/207/345/215/227.md +4 -2
  61. 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
  62. package/engine/src/api.ts +9 -5
  63. package/engine/src/code-review.ts +2 -2
  64. package/engine/src/control.ts +6 -6
  65. package/engine/src/danger-guard.ts +7 -0
  66. package/engine/src/doctor.ts +4 -3
  67. package/engine/src/features.ts +2 -2
  68. package/engine/src/identity.ts +16 -1
  69. package/engine/src/integration-cmd.ts +2 -2
  70. package/engine/src/launch.ts +44 -6
  71. package/engine/src/locations.ts +15 -1
  72. package/engine/src/main.ts +6 -1
  73. package/engine/src/messages.ts +1 -1
  74. package/engine/src/permission-cmd.ts +56 -0
  75. package/engine/src/platform.ts +7 -0
  76. package/engine/src/preflight.ts +2 -2
  77. package/engine/src/runtime-loader.ts +16 -0
  78. package/engine/src/runtime.ts +5 -0
  79. package/engine/src/skills-render.ts +10 -6
  80. package/engine/src/state.ts +25 -1
  81. package/engine/src/words.ts +1 -1
  82. package/package.json +2 -1
  83. package/site-dist/404.html +2 -2
  84. package/site-dist/assets/{app.Df99UgrJ.js → app.D2ywvSfZ.js} +1 -1
  85. package/site-dist/assets/changelog.md.EDul9PkX.js +1 -0
  86. package/site-dist/assets/changelog.md.EDul9PkX.lean.js +1 -0
  87. package/site-dist/assets/chunks/@localSearchIndexroot.Dr_jsw66.js +1 -0
  88. package/site-dist/assets/chunks/{VPLocalSearchBox.IEhP6Gw5.js → VPLocalSearchBox.ClWffKqN.js} +1 -1
  89. package/site-dist/assets/chunks/{theme.DHubfO7g.js → theme.tbt16E5a.js} +2 -2
  90. package/site-dist/assets/guide_cli.md.BrXllHw9.js +2 -0
  91. package/site-dist/assets/guide_cli.md.BrXllHw9.lean.js +2 -0
  92. package/site-dist/assets/{guide_getting-started.md.BZTWiHhH.js → guide_getting-started.md.qAp5hWCl.js} +1 -1
  93. package/site-dist/assets/{guide_getting-started.md.BZTWiHhH.lean.js → guide_getting-started.md.qAp5hWCl.lean.js} +1 -1
  94. package/site-dist/assets/guide_install.md.By4WxsJG.js +24 -0
  95. package/site-dist/assets/guide_install.md.By4WxsJG.lean.js +24 -0
  96. package/site-dist/assets/guide_maintainer.md.Da1ffqxm.js +1 -0
  97. package/site-dist/assets/guide_maintainer.md.Da1ffqxm.lean.js +1 -0
  98. package/site-dist/assets/guide_mogao.md.S0eln1Pr.js +10 -0
  99. package/site-dist/assets/guide_mogao.md.S0eln1Pr.lean.js +10 -0
  100. package/site-dist/assets/{guide_project.md.BIcaDhdS.js → guide_project.md.B2cmf8YF.js} +1 -1
  101. package/site-dist/assets/{guide_project.md.BIcaDhdS.lean.js → guide_project.md.B2cmf8YF.lean.js} +1 -1
  102. package/site-dist/assets/reference_contracts_agent-runtime.md.DPE2FJFc.js +1 -0
  103. package/site-dist/assets/{reference_contracts_agent-runtime.md.Bu8q-uGl.lean.js → reference_contracts_agent-runtime.md.DPE2FJFc.lean.js} +1 -1
  104. package/site-dist/assets/reference_contracts_cli-json.md.D6vfWOD9.js +1 -0
  105. package/site-dist/assets/reference_contracts_cli-json.md.D6vfWOD9.lean.js +1 -0
  106. package/site-dist/assets/{reference_contracts_index.md.dqNwNs6U.js → reference_contracts_index.md.B5P4FjRk.js} +1 -1
  107. package/site-dist/assets/{reference_contracts_index.md.dqNwNs6U.lean.js → reference_contracts_index.md.B5P4FjRk.lean.js} +1 -1
  108. package/site-dist/assets/{reference_contracts_notifier-event.md.D6we9wWS.js → reference_contracts_notifier-event.md.BeR8iODP.js} +1 -1
  109. package/site-dist/assets/{reference_contracts_notifier-event.md.D6we9wWS.lean.js → reference_contracts_notifier-event.md.BeR8iODP.lean.js} +1 -1
  110. package/site-dist/assets/reference_contracts_state.md.DLygjkfs.js +1 -0
  111. package/site-dist/assets/reference_contracts_usage-record.md.CgfMoYp0.js +10 -0
  112. package/site-dist/assets/reference_contracts_usage-record.md.CgfMoYp0.lean.js +10 -0
  113. package/site-dist/assets/{reference_design_adapter-guide.md.BSziZJSM.js → reference_design_adapter-guide.md.B_P-spS5.js} +2 -2
  114. package/site-dist/assets/{reference_design_adapter-guide.md.BSziZJSM.lean.js → reference_design_adapter-guide.md.B_P-spS5.lean.js} +2 -2
  115. package/site-dist/assets/reference_design_cli-adapter.md.pJy3x6Un.js +13 -0
  116. package/site-dist/assets/reference_design_cli-adapter.md.pJy3x6Un.lean.js +13 -0
  117. package/site-dist/changelog.html +5 -5
  118. package/site-dist/guide/cli.html +31 -0
  119. package/site-dist/guide/dsh.html +5 -5
  120. package/site-dist/guide/getting-started.html +5 -5
  121. package/site-dist/guide/how-it-works.html +4 -4
  122. package/site-dist/guide/index.html +4 -4
  123. package/site-dist/guide/install.html +13 -8
  124. package/site-dist/guide/intranet.html +5 -5
  125. package/site-dist/guide/maintainer.html +5 -5
  126. package/site-dist/guide/mogao.html +39 -0
  127. package/site-dist/guide/phases.html +4 -4
  128. package/site-dist/guide/project.html +6 -6
  129. package/site-dist/guide/user.html +4 -4
  130. package/site-dist/hashmap.json +1 -1
  131. package/site-dist/index.html +4 -4
  132. package/site-dist/reference/adr/0001-new-repo-core-and-adapters.html +4 -4
  133. package/site-dist/reference/adr/0002-two-orchestration-modes.html +4 -4
  134. package/site-dist/reference/adr/0003-generate-once-then-lock.html +4 -4
  135. package/site-dist/reference/adr/0004-external-contracts-stay-stable.html +4 -4
  136. package/site-dist/reference/adr/0005-skill-names.html +4 -4
  137. package/site-dist/reference/adr/0006-deterministic-engine-platform-capabilities.html +4 -4
  138. package/site-dist/reference/adr/0007-one-install-many-repos.html +4 -4
  139. package/site-dist/reference/adr/0008-capability-sources-and-platform-plugin.html +4 -4
  140. package/site-dist/reference/adr/index.html +4 -4
  141. package/site-dist/reference/commands.html +4 -4
  142. package/site-dist/reference/config.html +4 -4
  143. package/site-dist/reference/contracts/agent-runtime.html +5 -5
  144. package/site-dist/reference/contracts/cli-json.html +5 -5
  145. package/site-dist/reference/contracts/feature-files.html +4 -4
  146. package/site-dist/reference/contracts/index.html +5 -5
  147. package/site-dist/reference/contracts/notifier-event.html +6 -6
  148. package/site-dist/reference/contracts/result-file.html +4 -4
  149. package/site-dist/reference/contracts/spec.html +4 -4
  150. package/site-dist/reference/contracts/state.html +5 -5
  151. package/site-dist/reference/contracts/usage-record.html +6 -6
  152. package/site-dist/reference/contracts/verify.html +4 -4
  153. package/site-dist/reference/design/adapter-guide.html +6 -6
  154. package/site-dist/reference/design/architecture.html +4 -4
  155. package/site-dist/reference/design/builtin-capabilities.html +4 -4
  156. package/site-dist/reference/design/cli-adapter.html +42 -0
  157. package/site-dist/reference/design/platform-vocabulary.html +4 -4
  158. package/site-dist/reference/scope.html +4 -4
  159. package/skills/laoshi/SKILL.md +3 -0
  160. package/skills/laoshi-doctor/SKILL.md +2 -0
  161. package/skills/laoshi-retro/SKILL.md +2 -0
  162. package/skills/laoshi-setup/SKILL.md +3 -0
  163. package/site-dist/assets/changelog.md.Df8vFhjK.js +0 -1
  164. package/site-dist/assets/changelog.md.Df8vFhjK.lean.js +0 -1
  165. package/site-dist/assets/chunks/@localSearchIndexroot.n-0kN-N0.js +0 -1
  166. package/site-dist/assets/guide_install.md.D7NiiOPu.js +0 -19
  167. package/site-dist/assets/guide_install.md.D7NiiOPu.lean.js +0 -19
  168. package/site-dist/assets/guide_maintainer.md.C-Vt-DdK.js +0 -1
  169. package/site-dist/assets/guide_maintainer.md.C-Vt-DdK.lean.js +0 -1
  170. package/site-dist/assets/reference_contracts_agent-runtime.md.Bu8q-uGl.js +0 -1
  171. package/site-dist/assets/reference_contracts_cli-json.md.Bonk0m6-.js +0 -1
  172. package/site-dist/assets/reference_contracts_cli-json.md.Bonk0m6-.lean.js +0 -1
  173. package/site-dist/assets/reference_contracts_state.md.DVHC4opX.js +0 -1
  174. package/site-dist/assets/reference_contracts_usage-record.md.CQI2chqh.js +0 -10
  175. package/site-dist/assets/reference_contracts_usage-record.md.CQI2chqh.lean.js +0 -10
  176. /package/site-dist/assets/{reference_contracts_state.md.DVHC4opX.lean.js → reference_contracts_state.md.DLygjkfs.lean.js} +0 -0
@@ -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(")自检没有通过(Paseo 连不上、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(" 创建的 Paseo 定时任务)发送项目的需求总览,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};
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};
@@ -0,0 +1 @@
1
+ import{_ as d,o,c as t,a2 as c}from"./chunks/framework.BetZR81g.js";const h=JSON.parse('{"title":"state.json","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/state.md","filePath":"reference/contracts/state.md","lastUpdated":null}'),r={name:"reference/contracts/state.md"};function a(s,e,n,i,l,u){return o(),t("div",null,[...e[0]||(e[0]=[c('<div><h1 id="state-json" tabindex="-1">state.json <a class="header-anchor" href="#state-json" aria-label="Permalink to &quot;state.json&quot;">​</a></h1><p>流水线的运行状态,位于 <code>docs/features/&lt;目录&gt;/.pipeline/state.json</code>,只由引擎写入,不提交。</p><h2 id="当前格式-version-2-laoshi-m2d-起-req-kit-1-x-为-version-1-见文末-第-1-版到第-2-版" tabindex="-1">当前格式:version 2(laoshi M2d 起;req-kit 1.x 为 version 1,见文末&quot;第 1 版到第 2 版&quot;) <a class="header-anchor" href="#当前格式-version-2-laoshi-m2d-起-req-kit-1-x-为-version-1-见文末-第-1-版到第-2-版" aria-label="Permalink to &quot;当前格式:version 2(laoshi M2d 起;req-kit 1.x 为 version 1,见文末&quot;第 1 版到第 2 版&quot;)&quot;">​</a></h2><table tabindex="0"><thead><tr><th>字段</th><th>类型</th><th>含义</th></tr></thead><tbody><tr><td><code>version</code></td><td>number</td><td>格式版本。没有这个字段的文件按 1 处理</td></tr><tr><td><code>repo</code></td><td>string</td><td>仓库目录(绝对路径)</td></tr><tr><td><code>featureDir</code></td><td>string</td><td>功能目录(相对路径,<code>/</code> 分隔)</td></tr><tr><td><code>status</code></td><td><code>running</code> | <code>waiting_for_business</code> | <code>failed</code> | <code>completed</code> | <code>phase_done</code> | <code>waiting_for_approval</code></td><td>当前状态。<code>waiting_for_business</code> 表示等待需求方决定;<code>phase_done</code>(1.7.0 起)表示研发阶段已完成、停在闸口等待测试验证;<code>waiting_for_approval</code>(1.8.0 起)表示方案已通过审核、等待需求方确认 <code>preview.md</code>,<code>--approve</code> 继续。旧引擎把不认识的状态当作可以继续的中断:<code>phase_done</code> 继续时直接做验证,<code>waiting_for_approval</code> 继续时不经确认直接写代码</td></tr><tr><td><code>attempt</code></td><td>number</td><td>第几次从方案设计开始</td></tr><tr><td><code>specHash</code></td><td>string</td><td>启动时 spec.md 的 sha256</td></tr><tr><td><code>originSessionId</code></td><td>string | null</td><td>发起流水线的对话(会话),通知发往这里。第 1 版叫 <code>originAgentId</code></td></tr><tr><td><code>pid</code></td><td>number</td><td>流水线进程</td></tr><tr><td><code>host</code></td><td>string</td><td>可选,laoshi 起。运行流水线进程的机器名:每个对话轮次换一台机器的平台(如摸高)上,用它判断 <code>pid</code> 是不是本机的进程</td></tr><tr><td><code>startedBy</code></td><td>string</td><td>可选,laoshi 起(ADR 0007)。发起人:第一次运行流水线时为谁运行(取法同使用记录的 <code>user</code>,见 <a href="./usage-record">usage-record.md</a>),之后的运行不改。更早的状态文件没有</td></tr><tr><td><code>startedAt</code> / <code>updatedAt</code></td><td>ISO 时间</td><td></td></tr><tr><td><code>results</code></td><td>object</td><td>已完成步骤的结果,键为步骤键(如 <code>code_review-r2</code>)</td></tr><tr><td><code>history</code></td><td>array</td><td>每次步骤执行的记录:agent、起止时间、结果、错误;<code>usage</code>(可选,1.3.0 起)为 agent 报告的用量:<code>inputTokens</code>、<code>cachedInputTokens</code>、<code>outputTokens</code>、<code>totalCostUsd</code>,agent 没有报告时为 null 或缺少;<code>leftRunning</code>(可选,1.11 起)为 true 表示失败时 agent 可能还在运行,下一次运行这一步时先看它;<code>reattached</code>(可选,1.11 起)为接着等上一次 agent 的次数</td></tr><tr><td><code>stopReason</code> / <code>outcome</code></td><td>string | null</td><td>停止原因;最终结论</td></tr><tr><td><code>stopKind</code></td><td>string | null</td><td>可选,1.12 起。停下等人的原因代码:必要的决定 <code>approval</code>(确认方案)、<code>phase_gate</code>(研发完成,等待测试)、<code>business</code>(需求方决定)、<code>reproduce</code>(缺陷复现不了);中断 <code>timeout</code>、<code>agent_error</code>、<code>invalid_result</code>、<code>transient</code>、<code>stopped</code>、<code>process_exit</code>、<code>budget</code>(1.13,用完 token 预算)、<code>other</code>。运行中或完成时为 null</td></tr><tr><td><code>budget</code></td><td>object</td><td>可选,1.13 起,配置了 <code>budget.tokens</code> 时。<code>{ allowance, warnedAt }</code>:停下前允许用到的 tokens(预算,每次用完后继续再加一份);已经提醒过的那一档</td></tr><tr><td><code>waitingPermission</code></td><td>object | null</td><td>可选,1.13 起。步骤 agent 在等权限批准时:<code>{ agentId, stepTitle, requests, since }</code>;没有在等时为 null</td></tr><tr><td><code>recoveries</code></td><td>array</td><td>可选,1.12 起。流水线自己处理掉的问题(最多保留 200 条):<code>at</code>、<code>key</code>(步骤键)、<code>kind</code>(<code>retry</code> 重试 / <code>reattach</code> 接着等上一次的 agent / <code>reuse_result</code> 沿用上一次 agent 的结果 / <code>extend_timeout</code> 超时后多等一轮 / <code>redo</code> 新开 agent 重做 / <code>fallback</code> 换备用模型 / <code>auto_resume</code> 预约自动继续 / <code>quota_wait</code> 预约在额度恢复后继续 / <code>self_answer</code> 方案审核的问题由 builder 自答 / <code>stop_scan</code> 打断了搜索大目录的命令,1.13 起)、<code>detail</code></td></tr><tr><td><code>dangers</code></td><td>array</td><td>可选,1.14 起。步骤 agent 运行(或开始运行)的危险命令(<code>dangerGuard</code>,最多保留 50 条):<code>at</code>、<code>key</code>(步骤键)、<code>stepTitle</code>、<code>command</code>、<code>label</code>(如&quot;推送到远程仓库&quot;)、<code>ran</code>(发现时已经运行完为 true,正在运行、已打断为 false)、<code>agentId</code>、<code>callId</code>(同一个调用只处理一次)</td></tr><tr><td><code>secretScans</code></td><td>array</td><td>可选,1.14 起。改代码的步骤之后的密钥扫描(<code>secretScan</code>),每个步骤、每次尝试保留最新一次:<code>key</code>、<code>attempt</code>、<code>at</code>、<code>findings</code>(<code>{ file, line, commit, kind, preview }</code>,<code>preview</code> 里的值已遮住)、<code>fixRounds</code>、<code>passed</code></td></tr><tr><td><code>profile</code></td><td><code>quick</code> | <code>standard</code></td><td>档位</td></tr><tr><td><code>branch</code></td><td>string | null</td><td>工作分支,启动时确定</td></tr><tr><td><code>milestones</code></td><td>string[]</td><td>已发送的进展通知,续跑时不重复发送</td></tr><tr><td><code>incremental</code></td><td>object | null</td><td>可选,1.3.0 起。需求变更或回答问题后的继续:<code>fromAttempt</code>(接着哪一次)、<code>reason</code>、<code>baseCommit</code>(本次开始时的提交,评审看这之后的改动)、<code>hadImplementation</code>(上一次是否已写过代码)。第一次运行和 <code>--restart</code> 为 null</td></tr><tr><td><code>worktree</code></td><td>object | null</td><td>可选,1.5.0 起。用 <code>--worktree</code> 启动、在为需求新建的工作区中开发时:<code>workspaceRef</code>(平台对这个工作区的引用,由适配器解释;Paseo 为工作区 ID,laoshi 内置 worktree 为 <code>dir:&lt;目录&gt;</code>。第 1 版叫 <code>workspaceId</code>)、<code>sourceRepo</code>(对话所在的目录)。此时 <code>repo</code> 是新工作区的目录</td></tr><tr><td><code>wakeups</code></td><td>array</td><td>可选。这次运行在平台上预约的唤醒(定时任务):<code>ref</code>(平台的定时任务 ID)、<code>kind</code>(<code>reminder</code> 提醒 / <code>auto-resume</code> 自动继续 / <code>watchdog</code> 定时检查)、<code>at</code>。下一次运行或暂停命令会取消它们。第 1 版叫 <code>schedules</code>,其中 <code>ref</code> 叫 <code>id</code></td></tr><tr><td><code>adapter</code></td><td>object | null</td><td>可选,第 2 版起。这次运行用的平台适配器:<code>id</code>(如 <code>paseo</code>、<code>dsh</code>),便于排查</td></tr><tr><td><code>mode</code></td><td><code>engine</code> | <code>chat</code></td><td>可选,第 2 版起。谁编排步骤:引擎(缺省)或对话(模式 B,见 docs/design/in-chat-orchestration.md)</td></tr><tr><td><code>stepRequest</code></td><td>object | null</td><td>可选,第 2 版起,只用于模式 B:<code>{ key, since }</code>,等待对话中的 agent 执行的步骤</td></tr><tr><td><code>autoResumes</code></td><td>object | null</td><td>可选,1.6.0 起。<code>attempt</code>、<code>count</code>:这次尝试已经预约过几次自动继续</td></tr><tr><td><code>queuedSince</code></td><td>string | null</td><td>可选,1.6.0 起。正在排队(<code>maxConcurrentPipelines</code>)时为开始排队的时间</td></tr><tr><td><code>phases</code></td><td>object | null</td><td>可选,1.7.0 起。这次运行的执行方式:<code>mode</code>(<code>continuous</code> / <code>gated</code> / <code>develop-only</code>)、<code>environment</code>(<code>local</code> / <code>deployed</code>)、<code>defects</code>(<code>fix</code> / <code>handback</code> / <code>report</code>)。没有时按 <code>continuous</code>、<code>local</code>、<code>fix</code> 处理</td></tr><tr><td><code>phase</code></td><td><code>develop</code> | <code>verify</code></td><td>可选,1.7.0 起。当前阶段。用字符串而不是编号,以后增加阶段不用改格式</td></tr><tr><td><code>verifyAt</code></td><td>string | null</td><td>可选,1.7.0 起。<code>--verify-at</code>:研发完成后在这个时间开始测试验证</td></tr><tr><td><code>handbacks</code></td><td>number</td><td>可选,1.7.0 起。测试验证把缺陷退回研发阶段的次数(<code>defects</code> 为 <code>handback</code>),上限为档位的 <code>defectFix</code> 轮数</td></tr><tr><td><code>type</code></td><td><code>defect</code> | <code>refactor</code> | <code>assessment</code> | null</td><td>可选,1.8.0 起。spec 中&quot;类型&quot;对应的做法;新需求、小改动和配置关掉的类型为 null</td></tr><tr><td><code>codeBase</code></td><td>object | null</td><td>可选,1.8.0 起。<code>attempt</code>、<code>commit</code>:这次尝试在改动任何代码之前的提交,质量门的基线和范围检查从这里比较。尝试开始时就已经写过代码的旧记录为 <code>commit: null</code></td></tr><tr><td><code>joint</code></td><td>array | null</td><td>可选,1.8.0 起。联合需求(spec 的 <code>- 联合开发:</code>)中其他仓库的工作区:<code>name</code>(<code>relatedRepos</code> 中的名称)、<code>slug</code>(步骤键的后缀,如 <code>implement@backend</code>)、<code>sourceRepo</code>(切出工作区的那份检出)、<code>repo</code>(工作区目录)、<code>workspaceRef</code>(第 1 版叫 <code>workspaceId</code>)、<code>branch</code>、<code>specHash</code>(最近一次同步过去的 spec),以及这个仓库自己的 <code>codeBase</code> 和 <code>gate</code>(格式同顶层)。见 ADR 0025</td></tr><tr><td><code>approval</code></td><td>object | null</td><td>可选,1.8.0 起。方案确认点:<code>attempt</code>(哪一次尝试的方案)、<code>status</code>(<code>waiting</code> / <code>approved</code>)、<code>at</code>。需求变更后的新尝试需要重新确认</td></tr><tr><td><code>external</code></td><td>object | null</td><td>可选,1.9.0 起。外部系统中的卡片,按集成名称:<code>id</code>(卡片编号)、<code>url</code>、<code>status</code>(最近设置的状态)、<code>syncedAt</code>、<code>pending</code>(没有成功、等待补发的调用:<code>action</code> 为 <code>create</code> / <code>status</code>、<code>event</code>、<code>status</code>、<code>at</code>、<code>attempts</code>、<code>error</code>)。见 ADR 0028</td></tr><tr><td><code>pushed</code></td><td>array | null</td><td>可选,1.10 起。从卡片开始、配置了 <code>push</code> 的需求推送过的分支,每个仓库一条(主仓库在前):<code>repo</code>、<code>remote</code>、<code>branch</code>、<code>at</code>、<code>error</code>(成功时为 null;1.14 起,发现疑似密钥时不推送,<code>error</code> 写明原因)。见 ADR 0029</td></tr><tr><td><code>gate</code></td><td>object | null</td><td>可选,1.8.0 起。质量门:<code>baseline</code>(<code>attempt</code>、<code>commit</code>、<code>at</code>、<code>results</code>:每项检查改动前 <code>pass</code> / <code>fail</code>),<code>runs</code>(每次运行:<code>key</code> 步骤键、<code>attempt</code>、<code>at</code>、<code>checks</code>(<code>name</code>、<code>result</code>:<code>pass</code> / <code>fail</code> / <code>skipped</code>、<code>failedBefore</code>)、<code>newFailures</code>、<code>fixRounds</code>、<code>passed</code>)。各次运行的完整输出在 <code>.pipeline/checks/&lt;步骤键&gt;/</code></td></tr></tbody></table><p><code>wakeups[].kind</code> 在 1.7.0 起还可能是 <code>verify-start</code>(<code>--verify-at</code> 预约的测试验证开始),1.8.0 起还可能是 <code>approval-continue</code>(方案确认超时后按方案继续,<code>designApproval.autoContinueHours</code>)。<code>history</code> 中每条步骤记录在 1.7.0 起有可选的 <code>phase</code>(<code>develop</code> / <code>verify</code>),用于按阶段统计用时与用量;没有时按研发阶段统计。</p><h2 id="迁移" tabindex="-1">迁移 <a class="header-anchor" href="#迁移" aria-label="Permalink to &quot;迁移&quot;">​</a></h2><p>只增加可选字段(缺少时按默认值处理,旧版本引擎读到也不出错)时不提升版本,以便回滚到旧版本后仍能继续已有的流水线;在上表中注明&quot;可选&quot;和起始版本即可。</p><p>引擎(<code>engine/src/state.ts</code>)中 <code>STATE_VERSION</code> 是当前版本,<code>STATE_MIGRATIONS[n]</code> 把第 n 版升级到第 n+1 版。增加必需字段或改变已有字段的含义时:</p><ol><li><code>STATE_VERSION</code> 加 1。</li><li>在 <code>STATE_MIGRATIONS</code> 中加一个从旧版本到新版本的函数,为旧文件补上默认值。</li><li>在 <code>engine/test/state.test.ts</code> 中加一条迁移测试,更新本文件。</li></ol><h2 id="第-1-版到第-2-版-laoshi-m2d" tabindex="-1">第 1 版到第 2 版(laoshi M2d) <a class="header-anchor" href="#第-1-版到第-2-版-laoshi-m2d" aria-label="Permalink to &quot;第 1 版到第 2 版(laoshi M2d)&quot;">​</a></h2><p>只改名,值不变,流程语义不变(<a href="https://github.com/yiyisf/laoshi/blob/main/docs/design/state-v2.md" target="_blank" rel="noreferrer">state-v2</a>):<code>originAgentId</code> → <code>originSessionId</code>,<code>worktree.workspaceId</code> → <code>worktree.workspaceRef</code>,<code>joint[].workspaceId</code> → <code>joint[].workspaceRef</code>,<code>schedules[]</code> → <code>wakeups[]</code>(<code>id</code> → <code>ref</code>);另加可选的 <code>adapter</code>、<code>mode</code>、<code>stepRequest</code>。</p><ul><li>读到第 1 版时自动迁移并写回,原文件保留为 <code>state.json.bak-v1</code>。</li><li>文件属于一条<strong>还在运行</strong>的流水线(<code>status</code> 为 <code>running</code>,进程仍在,且不是当前进程)时,只在内存中迁移,不改写它的文件:那个进程(可能是 req-kit 1.x)还在按自己的格式写。它结束后,下一次读取时再迁移。</li><li>迁移是单向的:req-kit 1.x 读到第 2 版会拒绝运行。回滚时把 <code>state.json.bak-v1</code> 恢复为 <code>state.json</code>,再改用 1.x。</li><li>对外契约不随之改名(ADR 0004):<code>req api</code>(<a href="./cli-json">cli-json.md</a>)、通知事件(<a href="./notifier-event">notifier-event.md</a>)、使用记录与需求索引(<a href="./usage-record">usage-record.md</a>)仍为 <code>schema: 1</code>,仍输出 <code>originAgentId</code>、<code>workspaceId</code>,值取自 <code>originSessionId</code>、<code>workspaceRef</code>。</li></ul></div><p class="source-note">本页由仓库中的 <a href="https://github.com/yiyisf/laoshi/blob/main/contracts/state.md">contracts/state.md</a> 生成。<a href="https://github.com/yiyisf/laoshi/edit/main/contracts/state.md">在 GitHub 上编辑</a></p>',2)])])}const m=d(r,[["render",a]]);export{h as __pageData,m as default};
@@ -0,0 +1,10 @@
1
+ import{_ as s,o as i,c as t,j as l,a as e}from"./chunks/framework.BetZR81g.js";const p=JSON.parse('{"title":"本机的需求索引与使用记录","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/usage-record.md","filePath":"reference/contracts/usage-record.md","lastUpdated":null}'),d={name:"reference/contracts/usage-record.md"};function a(o,n,u,c,r,h){return i(),t("div",null,[...n[0]||(n[0]=[l("div",null,[l("h1",{id:"本机的需求索引与使用记录",tabindex:"-1"},[e("本机的需求索引与使用记录 "),l("a",{class:"header-anchor",href:"#本机的需求索引与使用记录","aria-label":'Permalink to "本机的需求索引与使用记录"'},"​")]),l("p",null,[e("1.9.0 起,引擎在本机配置目录下记两样东西。laoshi M2c 起这个目录是安装根(ADR 0007):"),l("code",null,"LAOSHI_HOME"),e(" 指定,其次 "),l("code",null,"REQ_KIT_HOME"),e(";都没有时为 "),l("code",null,"~/.laoshi"),e(",只有 req-kit 的 "),l("code",null,"~/.req-kit"),e(" 时沿用它。它们只在这台机器上,不提交进任何仓库,也不会自动发往任何地方。环境变量 "),l("code",null,"REQ_KIT_NO_RECORD=1"),e(" 时两样都不记(评估运行就是这样)。")]),l("h2",{id:"需求索引-index-key-json",tabindex:"-1"},[e("需求索引 "),l("code",null,"index/<key>.json"),e(),l("a",{class:"header-anchor",href:"#需求索引-index-key-json","aria-label":'Permalink to "需求索引 `index/<key>.json`"'},"​")]),l("p",null,[e("每个在本机运行过的需求一个文件,记录它在哪里,供 "),l("code",null,"req api list --all"),e(" 和平台插件(如 Paseo 插件)找到本机所有的需求。需求的阶段、进度仍然现场从功能目录读取(ADR 0010)。")]),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"}},"{")]),e(`
2
+ `),l("span",{class:"line"},[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"}},",")]),e(`
3
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "key"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"3f2a9c1e5b7d4e8a"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
4
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "repo"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"/home/me/work/shop-sms-login"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
5
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "featureDir"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"docs/features/20261012-sms-login"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
6
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "sourceRepo"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"/home/me/work/shop"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
7
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "workspaceId"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"ws_123"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
8
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "project"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"shop"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
9
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "registeredAt"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"2026-10-12T09:00:00.000Z"')]),e(`
10
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),l("p",null,[l("code",null,"key"),e(" 由对话所在的目录(没有自己的工作区时即 "),l("code",null,"repo"),e(")和功能目录算出。1.14 起:开始谈需求时("),l("code",null,"start-pipeline --feature <功能目录> --track"),e(")就登记,此时多一个可选字段 "),l("code",null,"chatAgentId"),e("(谈需求的对话),之后的登记保留它;新建需求自己的工作区时,条目改为指向那个工作区。目录里有 "),l("code",null,"spec.md"),e("、"),l("code",null,"alignment.md"),e(" 或 "),l("code",null,".pipeline/"),e(" 下的状态或登记标记时算作存在。")]),l("h2",{id:"新建工作区的记录-worktrees-key-json-1-14",tabindex:"-1"},[e("新建工作区的记录 "),l("code",null,"worktrees/<key>.json"),e("(1.14) "),l("a",{class:"header-anchor",href:"#新建工作区的记录-worktrees-key-json-1-14","aria-label":'Permalink to "新建工作区的记录 `worktrees/<key>.json`(1.14)"'},"​")]),l("p",null,[e("用 "),l("code",null,"--worktree"),e(" 启动时,工作区一建好就写下:"),l("code",null,"{ schema, sourceRepo, featureDir, repo, workspaceId, branch, baseRef, createdAt, originAgentId }"),e('。之后的启动失败了,再次启动时在这个工作区里接着做,不再新建;插件据此把"工作区已建、开发没开始"的需求列进"等你处理"。'),l("code",null,"req index --rebuild"),e(" 为 1.9 之前运行过的需求补登,"),l("code",null,"req index --prune"),e(" 移除目录已不在的。")]),l("h2",{id:"使用记录-usage-runs-jsonl",tabindex:"-1"},[e("使用记录 "),l("code",null,"usage/runs.jsonl"),e(),l("a",{class:"header-anchor",href:"#使用记录-usage-runs-jsonl","aria-label":'Permalink to "使用记录 `usage/runs.jsonl`"'},"​")]),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,"schema"),e(" / "),l("code",null,"kind")]),l("td",null,[l("code",null,"1"),e(" / "),l("code",null,'"run"')])]),l("tr",null,[l("td",null,[l("code",null,"machine"),e(" / "),l("code",null,"kitVersion")]),l("td",null,"主机名、req-kit 版本")]),l("tr",null,[l("td",null,[l("code",null,"user")]),l("td",null,[e("laoshi M2c 起。这次运行是为谁:环境变量 "),l("code",null,"LAOSHI_USER"),e(",其次平台提供的使用者(适配器声明的环境变量,如摸高的 "),l("code",null,"AIMAX_USER_NAME"),e("),再次安装级配置的 "),l("code",null,"user"),e(",最后系统用户名。更早的记录没有")])]),l("tr",null,[l("td",null,[l("code",null,"requirement")]),l("td",null,[l("code",null,"{ key, project, name, title, type, profile }"),e(";laoshi M2c 起另有 "),l("code",null,"codebase"),e("("),l("code",null,"{ root, remote }"),e(",见 "),l("a",{href:"./cli-json"},"cli-json.md"),e(" 的同名字段);从卡片开始的需求(1.10 起)另有 "),l("code",null,"requester"),e("(卡片的提出人)和 "),l("code",null,"source"),e("("),l("code",null,"{ system, id }"),e(")")])]),l("tr",null,[l("td",null,[l("code",null,"steps[].cachedInputTokens"),e(" / "),l("code",null,"steps[].agent")]),l("td",null,'1.13 起。输入中来自提示缓存的 tokens(agent 报告时);这一步用的 agent(平台档案名,如 Paseo 的 profile 名,或 "provider/model")。更早的记录没有')]),l("tr",null,[l("td",null,[l("code",null,"run")]),l("td",null,[l("code",null,"{ startedAt, endedAt, attempt, phase, phaseMode, status, outcome, stopReason, stopKind, recoveries }"),e(";"),l("code",null,"status"),e(" 是运行结束时的状态,"),l("code",null,"outcome"),e(" 是完成时报告的结论;"),l("code",null,"stopKind"),e("(1.12 起)是停下等人的原因代码(见 "),l("a",{href:"./state"},"state.md"),e("),"),l("code",null,"recoveries"),e("(1.12 起)是这次运行中自动处理的次数,按种类,如 "),l("code",null,'{ "retry": 2 }'),e("。更早的记录没有这两项")])]),l("tr",null,[l("td",null,[l("code",null,"agents")]),l("td",null,[l("code",null,"{ builder, reviewer }"),e(":当时配置的 agent(如 "),l("code",null,"claude/opus(bypassPermissions)"),e(")")])]),l("tr",null,[l("td",null,[l("code",null,"steps")]),l("td",null,[e("这次运行中开始的步骤:"),l("code",null,"{ key, stepId, phase, attempt, round, startedAt, endedAt, minutes, outcome, inputTokens, outputTokens, costUsd }"),e(";agent 没有报告的用量为 null")])]),l("tr",null,[l("td",null,[l("code",null,"gate")]),l("td",null,[l("code",null,"{ runs, failed }"),e(":这次运行中质量门运行的次数、发现新失败的次数")])])])]),l("p",null,"不记录需求内容、代码和对话。"),l("h3",{id:"运行之后的事-1-14-起",tabindex:"-1"},[e("运行之后的事(1.14 起) "),l("a",{class:"header-anchor",href:"#运行之后的事-1-14-起","aria-label":'Permalink to "运行之后的事(1.14 起)"'},"​")]),l("p",null,[e("同一个文件里还有几种记录,都有 "),l("code",null,"schema"),e("(1)、"),l("code",null,"kind"),e("、"),l("code",null,"machine"),e("、"),l("code",null,"kitVersion"),e("、"),l("code",null,"at"),e(" 和 "),l("code",null,"requirement"),e("("),l("code",null,"{ key, project, name, title }"),e(","),l("code",null,"key"),e(" 与运行记录相同)。laoshi M2c 起另有 "),l("code",null,"user"),e(","),l("code",null,"requirement"),e(" 中另有 "),l("code",null,"codebase"),e(",含义同运行记录。读运行记录的旧版本会跳过它们。")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,[l("code",null,"kind")]),l("th",null,"何时写"),l("th",null,"字段")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"review")]),l("td",null,'插件代码审查页提交"退回修改"或"评审通过"'),l("td",null,[l("code",null,'review: { verdict: "approved" | "changes_requested", reviewer, items, head }'),e(":评审人、意见条数、评审的提交")])]),l("tr",null,[l("td",null,[l("code",null,"acceptance")]),l("td",null,"验收清单页提交"),l("td",null,[l("code",null,'acceptance: { verdict: "通过" | "不通过", reviewer, total, passed, failed, unchecked }')])]),l("tr",null,[l("td",null,[l("code",null,"merge")]),l("td",null,[l("code",null,"req stats"),e("、"),l("code",null,"req api stats"),e("、"),l("code",null,"req outcome"),e(" 发现需求的流水线文件("),l("code",null,"implementation.md"),e("、"),l("code",null,"report.md"),e(" 等)已经在主干("),l("code",null,"origin/HEAD"),e(",没有时 "),l("code",null,"origin/main"),e("、"),l("code",null,"main"),e(" 等)里;或者 "),l("code",null,"req outcome <需求> --merged")]),l("td",null,[l("code",null,'merge: { into, commit, mergedAt, how: "files" | "manual" }'),e(":"),l("code",null,"commit"),e("、"),l("code",null,"mergedAt"),e(" 是把它带进主干的那次提交(合并提交或压缩合并的提交);只看本机已有的分支,不 fetch")])]),l("tr",null,[l("td",null,[l("code",null,"issue")]),l("td",null,[e("缺陷需求的 spec 写了 "),l("code",null,"- 引入问题的需求:<目录名>"),e("(扫描时发现),或者 "),l("code",null,'req outcome <需求> --issue "<问题>"')]),l("td",null,[l("code",null,"issue: { text, by, id }"),e(":"),l("code",null,"by"),e(" 是那个缺陷需求的目录名,手动记的为 null;同一个 "),l("code",null,"id"),e(" 只算一次")])])])]),l("p",null,[e("每个需求的 "),l("code",null,"merge"),e(" 只记一次。评审和验收的全文在需求目录的 "),l("code",null,"code-review.md"),e("、"),l("code",null,"acceptance.md"),e(" 里,随需求分支提交;这里只记结论和数量,用于统计。")]),l("h2",{id:"统计口径-req-stats",tabindex:"-1"},[e("统计口径("),l("code",null,"req stats"),e(") "),l("a",{class:"header-anchor",href:"#统计口径-req-stats","aria-label":'Permalink to "统计口径(`req stats`)"'},"​")]),l("ul",null,[l("li",null,"一段时间的用量、步骤用时:结束时间在这段时间内的运行。"),l("li",null,'交付周期:需求第一次开始到完成(最后一次运行以"已完成"结束)的小时数,用这个需求的全部运行,算在完成的那段时间。'),l("li",null,"代码评审轮数、缺陷修复轮数:不同的(尝试、轮次、仓库)个数;评审分方向或评审小组的几个成员算一轮。"),l("li",null,"等待:相邻两次运行之间的间隔,按前一次结束时的状态归类:等待确认方案、等待需求方决定、研发完成到开始测试验证、中断到继续。"),l("li",null,[e("token 花在哪(1.13 起,"),l("code",null,"tokens"),e("):这段时间的步骤按 "),l("code",null,"stepId"),e("、按 "),l("code",null,"agent"),e(" 合计 token(输入 + 输出)和占比;返工("),l("code",null,"design_revise"),e("、"),l("code",null,"review_fix"),e("、"),l("code",null,"defect_fix"),e("、"),l("code",null,"reverify"),e(",以及 "),l("code",null,"design_review"),e("、"),l("code",null,"code_review"),e(" 第 2 轮起)的合计和占比;报告了 "),l("code",null,"cachedInputTokens"),e(" 的,算出输入中来自提示缓存的比例;已完成需求的 token 中位数(按档位)。")]),l("li",null,[e("停下等人的原因(1.12 起):这段时间结束的运行按 "),l("code",null,"stopKind"),e(" 计数;更早的记录按结束时的状态推断。确认方案、研发完成等待测试是必要的决定。")]),l("li",null,"无人工到提测的比例(1.12 起):这段时间有进展、已经研发完成或完成的需求中,所有运行都只停在必要决定处的比例。"),l("li",null,"自动处理的比例(1.12 起):自动处理的次数 ÷(自动处理的次数 + 以中断结束的运行数);需求方决定、缺陷复现不了不算中断。"),l("li",null,[e("人工把关和合并后(1.14 起,"),l("code",null,"oversight"),e('):这段时间里的人工代码评审次数、退回修改次数、意见条数,验收次数和不通过次数;"第一次就通过"看每个需求最早的那次评审(验收),它在这段时间里并且是通过;合并进主干的需求数和"完成到合并"的小时数中位数;合并后发现的问题数和涉及的需求数。每个需求一项里的 '),l("code",null,"afterRun"),e(" 汇总它全部的这类记录("),l("code",null,"humanReviews"),e("、"),l("code",null,"sentBack"),e("、"),l("code",null,"lastReview"),e("、"),l("code",null,"acceptance"),e("、"),l("code",null,"acceptanceFailed"),e("、"),l("code",null,"mergedAt"),e("、"),l("code",null,"issues"),e(")。")]),l("li",null,[e("合并多台机器的导出时,同一机器、同一需求、同一开始时间的运行只算一次;同一个需求、同一种、同一时间的事件(问题按 "),l("code",null,"id"),e(")只算一次。"),l("code",null,"req stats --export"),e(" 同时导出这些需求的事件。")])]),l("p",null,[l("code",null,"req stats --json"),e(" 和 "),l("code",null,"req api stats"),e(" 输出同样的对象("),l("code",null,"schema: 1"),e("):"),l("code",null,"period"),e("、"),l("code",null,"machines"),e("、"),l("code",null,"active"),e("、"),l("code",null,"completed"),e("、"),l("code",null,"byType"),e("、"),l("code",null,"cycleHours"),e("、"),l("code",null,"steps"),e("、"),l("code",null,"rework"),e("、"),l("code",null,"waits"),e("、"),l("code",null,"usage"),e("、"),l("code",null,"tokens"),e("、"),l("code",null,"oversight"),e("、"),l("code",null,"byBuilder"),e("、"),l("code",null,"requirements"),e("(每个需求一项,字段与 "),l("code",null,"req stats --csv"),e(" 的列对应)。")])],-1),l("p",{class:"source-note"},[e("本页由仓库中的 "),l("a",{href:"https://github.com/yiyisf/laoshi/blob/main/contracts/usage-record.md"},"contracts/usage-record.md"),e(" 生成。"),l("a",{href:"https://github.com/yiyisf/laoshi/edit/main/contracts/usage-record.md"},"在 GitHub 上编辑")],-1)])])}const m=s(d,[["render",a]]);export{p as __pageData,m as default};
@@ -0,0 +1,10 @@
1
+ import{_ as s,o as i,c as t,j as l,a as e}from"./chunks/framework.BetZR81g.js";const p=JSON.parse('{"title":"本机的需求索引与使用记录","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/contracts/usage-record.md","filePath":"reference/contracts/usage-record.md","lastUpdated":null}'),d={name:"reference/contracts/usage-record.md"};function a(o,n,u,c,r,h){return i(),t("div",null,[...n[0]||(n[0]=[l("div",null,[l("h1",{id:"本机的需求索引与使用记录",tabindex:"-1"},[e("本机的需求索引与使用记录 "),l("a",{class:"header-anchor",href:"#本机的需求索引与使用记录","aria-label":'Permalink to "本机的需求索引与使用记录"'},"​")]),l("p",null,[e("1.9.0 起,引擎在本机配置目录下记两样东西。laoshi M2c 起这个目录是安装根(ADR 0007):"),l("code",null,"LAOSHI_HOME"),e(" 指定,其次 "),l("code",null,"REQ_KIT_HOME"),e(";都没有时为 "),l("code",null,"~/.laoshi"),e(",只有 req-kit 的 "),l("code",null,"~/.req-kit"),e(" 时沿用它。它们只在这台机器上,不提交进任何仓库,也不会自动发往任何地方。环境变量 "),l("code",null,"REQ_KIT_NO_RECORD=1"),e(" 时两样都不记(评估运行就是这样)。")]),l("h2",{id:"需求索引-index-key-json",tabindex:"-1"},[e("需求索引 "),l("code",null,"index/<key>.json"),e(),l("a",{class:"header-anchor",href:"#需求索引-index-key-json","aria-label":'Permalink to "需求索引 `index/<key>.json`"'},"​")]),l("p",null,[e("每个在本机运行过的需求一个文件,记录它在哪里,供 "),l("code",null,"req api list --all"),e(" 和平台插件(如 Paseo 插件)找到本机所有的需求。需求的阶段、进度仍然现场从功能目录读取(ADR 0010)。")]),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"}},"{")]),e(`
2
+ `),l("span",{class:"line"},[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"}},",")]),e(`
3
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "key"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"3f2a9c1e5b7d4e8a"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
4
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "repo"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"/home/me/work/shop-sms-login"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
5
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "featureDir"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"docs/features/20261012-sms-login"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
6
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "sourceRepo"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"/home/me/work/shop"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
7
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "workspaceId"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"ws_123"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
8
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "project"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"shop"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},",")]),e(`
9
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "registeredAt"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"2026-10-12T09:00:00.000Z"')]),e(`
10
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),l("p",null,[l("code",null,"key"),e(" 由对话所在的目录(没有自己的工作区时即 "),l("code",null,"repo"),e(")和功能目录算出。1.14 起:开始谈需求时("),l("code",null,"start-pipeline --feature <功能目录> --track"),e(")就登记,此时多一个可选字段 "),l("code",null,"chatAgentId"),e("(谈需求的对话),之后的登记保留它;新建需求自己的工作区时,条目改为指向那个工作区。目录里有 "),l("code",null,"spec.md"),e("、"),l("code",null,"alignment.md"),e(" 或 "),l("code",null,".pipeline/"),e(" 下的状态或登记标记时算作存在。")]),l("h2",{id:"新建工作区的记录-worktrees-key-json-1-14",tabindex:"-1"},[e("新建工作区的记录 "),l("code",null,"worktrees/<key>.json"),e("(1.14) "),l("a",{class:"header-anchor",href:"#新建工作区的记录-worktrees-key-json-1-14","aria-label":'Permalink to "新建工作区的记录 `worktrees/<key>.json`(1.14)"'},"​")]),l("p",null,[e("用 "),l("code",null,"--worktree"),e(" 启动时,工作区一建好就写下:"),l("code",null,"{ schema, sourceRepo, featureDir, repo, workspaceId, branch, baseRef, createdAt, originAgentId }"),e('。之后的启动失败了,再次启动时在这个工作区里接着做,不再新建;插件据此把"工作区已建、开发没开始"的需求列进"等你处理"。'),l("code",null,"req index --rebuild"),e(" 为 1.9 之前运行过的需求补登,"),l("code",null,"req index --prune"),e(" 移除目录已不在的。")]),l("h2",{id:"使用记录-usage-runs-jsonl",tabindex:"-1"},[e("使用记录 "),l("code",null,"usage/runs.jsonl"),e(),l("a",{class:"header-anchor",href:"#使用记录-usage-runs-jsonl","aria-label":'Permalink to "使用记录 `usage/runs.jsonl`"'},"​")]),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,"schema"),e(" / "),l("code",null,"kind")]),l("td",null,[l("code",null,"1"),e(" / "),l("code",null,'"run"')])]),l("tr",null,[l("td",null,[l("code",null,"machine"),e(" / "),l("code",null,"kitVersion")]),l("td",null,"主机名、req-kit 版本")]),l("tr",null,[l("td",null,[l("code",null,"user")]),l("td",null,[e("laoshi M2c 起。这次运行是为谁:环境变量 "),l("code",null,"LAOSHI_USER"),e(",其次平台提供的使用者(适配器声明的环境变量,如摸高的 "),l("code",null,"AIMAX_USER_NAME"),e("),再次安装级配置的 "),l("code",null,"user"),e(",最后系统用户名。更早的记录没有")])]),l("tr",null,[l("td",null,[l("code",null,"requirement")]),l("td",null,[l("code",null,"{ key, project, name, title, type, profile }"),e(";laoshi M2c 起另有 "),l("code",null,"codebase"),e("("),l("code",null,"{ root, remote }"),e(",见 "),l("a",{href:"./cli-json"},"cli-json.md"),e(" 的同名字段);从卡片开始的需求(1.10 起)另有 "),l("code",null,"requester"),e("(卡片的提出人)和 "),l("code",null,"source"),e("("),l("code",null,"{ system, id }"),e(")")])]),l("tr",null,[l("td",null,[l("code",null,"steps[].cachedInputTokens"),e(" / "),l("code",null,"steps[].agent")]),l("td",null,'1.13 起。输入中来自提示缓存的 tokens(agent 报告时);这一步用的 agent(平台档案名,如 Paseo 的 profile 名,或 "provider/model")。更早的记录没有')]),l("tr",null,[l("td",null,[l("code",null,"run")]),l("td",null,[l("code",null,"{ startedAt, endedAt, attempt, phase, phaseMode, status, outcome, stopReason, stopKind, recoveries }"),e(";"),l("code",null,"status"),e(" 是运行结束时的状态,"),l("code",null,"outcome"),e(" 是完成时报告的结论;"),l("code",null,"stopKind"),e("(1.12 起)是停下等人的原因代码(见 "),l("a",{href:"./state"},"state.md"),e("),"),l("code",null,"recoveries"),e("(1.12 起)是这次运行中自动处理的次数,按种类,如 "),l("code",null,'{ "retry": 2 }'),e("。更早的记录没有这两项")])]),l("tr",null,[l("td",null,[l("code",null,"agents")]),l("td",null,[l("code",null,"{ builder, reviewer }"),e(":当时配置的 agent(如 "),l("code",null,"claude/opus(bypassPermissions)"),e(")")])]),l("tr",null,[l("td",null,[l("code",null,"steps")]),l("td",null,[e("这次运行中开始的步骤:"),l("code",null,"{ key, stepId, phase, attempt, round, startedAt, endedAt, minutes, outcome, inputTokens, outputTokens, costUsd }"),e(";agent 没有报告的用量为 null")])]),l("tr",null,[l("td",null,[l("code",null,"gate")]),l("td",null,[l("code",null,"{ runs, failed }"),e(":这次运行中质量门运行的次数、发现新失败的次数")])])])]),l("p",null,"不记录需求内容、代码和对话。"),l("h3",{id:"运行之后的事-1-14-起",tabindex:"-1"},[e("运行之后的事(1.14 起) "),l("a",{class:"header-anchor",href:"#运行之后的事-1-14-起","aria-label":'Permalink to "运行之后的事(1.14 起)"'},"​")]),l("p",null,[e("同一个文件里还有几种记录,都有 "),l("code",null,"schema"),e("(1)、"),l("code",null,"kind"),e("、"),l("code",null,"machine"),e("、"),l("code",null,"kitVersion"),e("、"),l("code",null,"at"),e(" 和 "),l("code",null,"requirement"),e("("),l("code",null,"{ key, project, name, title }"),e(","),l("code",null,"key"),e(" 与运行记录相同)。laoshi M2c 起另有 "),l("code",null,"user"),e(","),l("code",null,"requirement"),e(" 中另有 "),l("code",null,"codebase"),e(",含义同运行记录。读运行记录的旧版本会跳过它们。")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,[l("code",null,"kind")]),l("th",null,"何时写"),l("th",null,"字段")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"review")]),l("td",null,'插件代码审查页提交"退回修改"或"评审通过"'),l("td",null,[l("code",null,'review: { verdict: "approved" | "changes_requested", reviewer, items, head }'),e(":评审人、意见条数、评审的提交")])]),l("tr",null,[l("td",null,[l("code",null,"acceptance")]),l("td",null,"验收清单页提交"),l("td",null,[l("code",null,'acceptance: { verdict: "通过" | "不通过", reviewer, total, passed, failed, unchecked }')])]),l("tr",null,[l("td",null,[l("code",null,"merge")]),l("td",null,[l("code",null,"req stats"),e("、"),l("code",null,"req api stats"),e("、"),l("code",null,"req outcome"),e(" 发现需求的流水线文件("),l("code",null,"implementation.md"),e("、"),l("code",null,"report.md"),e(" 等)已经在主干("),l("code",null,"origin/HEAD"),e(",没有时 "),l("code",null,"origin/main"),e("、"),l("code",null,"main"),e(" 等)里;或者 "),l("code",null,"req outcome <需求> --merged")]),l("td",null,[l("code",null,'merge: { into, commit, mergedAt, how: "files" | "manual" }'),e(":"),l("code",null,"commit"),e("、"),l("code",null,"mergedAt"),e(" 是把它带进主干的那次提交(合并提交或压缩合并的提交);只看本机已有的分支,不 fetch")])]),l("tr",null,[l("td",null,[l("code",null,"issue")]),l("td",null,[e("缺陷需求的 spec 写了 "),l("code",null,"- 引入问题的需求:<目录名>"),e("(扫描时发现),或者 "),l("code",null,'req outcome <需求> --issue "<问题>"')]),l("td",null,[l("code",null,"issue: { text, by, id }"),e(":"),l("code",null,"by"),e(" 是那个缺陷需求的目录名,手动记的为 null;同一个 "),l("code",null,"id"),e(" 只算一次")])])])]),l("p",null,[e("每个需求的 "),l("code",null,"merge"),e(" 只记一次。评审和验收的全文在需求目录的 "),l("code",null,"code-review.md"),e("、"),l("code",null,"acceptance.md"),e(" 里,随需求分支提交;这里只记结论和数量,用于统计。")]),l("h2",{id:"统计口径-req-stats",tabindex:"-1"},[e("统计口径("),l("code",null,"req stats"),e(") "),l("a",{class:"header-anchor",href:"#统计口径-req-stats","aria-label":'Permalink to "统计口径(`req stats`)"'},"​")]),l("ul",null,[l("li",null,"一段时间的用量、步骤用时:结束时间在这段时间内的运行。"),l("li",null,'交付周期:需求第一次开始到完成(最后一次运行以"已完成"结束)的小时数,用这个需求的全部运行,算在完成的那段时间。'),l("li",null,"代码评审轮数、缺陷修复轮数:不同的(尝试、轮次、仓库)个数;评审分方向或评审小组的几个成员算一轮。"),l("li",null,"等待:相邻两次运行之间的间隔,按前一次结束时的状态归类:等待确认方案、等待需求方决定、研发完成到开始测试验证、中断到继续。"),l("li",null,[e("token 花在哪(1.13 起,"),l("code",null,"tokens"),e("):这段时间的步骤按 "),l("code",null,"stepId"),e("、按 "),l("code",null,"agent"),e(" 合计 token(输入 + 输出)和占比;返工("),l("code",null,"design_revise"),e("、"),l("code",null,"review_fix"),e("、"),l("code",null,"defect_fix"),e("、"),l("code",null,"reverify"),e(",以及 "),l("code",null,"design_review"),e("、"),l("code",null,"code_review"),e(" 第 2 轮起)的合计和占比;报告了 "),l("code",null,"cachedInputTokens"),e(" 的,算出输入中来自提示缓存的比例;已完成需求的 token 中位数(按档位)。")]),l("li",null,[e("停下等人的原因(1.12 起):这段时间结束的运行按 "),l("code",null,"stopKind"),e(" 计数;更早的记录按结束时的状态推断。确认方案、研发完成等待测试是必要的决定。")]),l("li",null,"无人工到提测的比例(1.12 起):这段时间有进展、已经研发完成或完成的需求中,所有运行都只停在必要决定处的比例。"),l("li",null,"自动处理的比例(1.12 起):自动处理的次数 ÷(自动处理的次数 + 以中断结束的运行数);需求方决定、缺陷复现不了不算中断。"),l("li",null,[e("人工把关和合并后(1.14 起,"),l("code",null,"oversight"),e('):这段时间里的人工代码评审次数、退回修改次数、意见条数,验收次数和不通过次数;"第一次就通过"看每个需求最早的那次评审(验收),它在这段时间里并且是通过;合并进主干的需求数和"完成到合并"的小时数中位数;合并后发现的问题数和涉及的需求数。每个需求一项里的 '),l("code",null,"afterRun"),e(" 汇总它全部的这类记录("),l("code",null,"humanReviews"),e("、"),l("code",null,"sentBack"),e("、"),l("code",null,"lastReview"),e("、"),l("code",null,"acceptance"),e("、"),l("code",null,"acceptanceFailed"),e("、"),l("code",null,"mergedAt"),e("、"),l("code",null,"issues"),e(")。")]),l("li",null,[e("合并多台机器的导出时,同一机器、同一需求、同一开始时间的运行只算一次;同一个需求、同一种、同一时间的事件(问题按 "),l("code",null,"id"),e(")只算一次。"),l("code",null,"req stats --export"),e(" 同时导出这些需求的事件。")])]),l("p",null,[l("code",null,"req stats --json"),e(" 和 "),l("code",null,"req api stats"),e(" 输出同样的对象("),l("code",null,"schema: 1"),e("):"),l("code",null,"period"),e("、"),l("code",null,"machines"),e("、"),l("code",null,"active"),e("、"),l("code",null,"completed"),e("、"),l("code",null,"byType"),e("、"),l("code",null,"cycleHours"),e("、"),l("code",null,"steps"),e("、"),l("code",null,"rework"),e("、"),l("code",null,"waits"),e("、"),l("code",null,"usage"),e("、"),l("code",null,"tokens"),e("、"),l("code",null,"oversight"),e("、"),l("code",null,"byBuilder"),e("、"),l("code",null,"requirements"),e("(每个需求一项,字段与 "),l("code",null,"req stats --csv"),e(" 的列对应)。")])],-1),l("p",{class:"source-note"},[e("本页由仓库中的 "),l("a",{href:"https://github.com/yiyisf/laoshi/blob/main/contracts/usage-record.md"},"contracts/usage-record.md"),e(" 生成。"),l("a",{href:"https://github.com/yiyisf/laoshi/edit/main/contracts/usage-record.md"},"在 GitHub 上编辑")],-1)])])}const m=s(d,[["render",a]]);export{p as __pageData,m as default};
@@ -1,4 +1,4 @@
1
- import{_ as e,o as t,c as a,j as i,a as l}from"./chunks/framework.BetZR81g.js";const c=JSON.parse('{"title":"适配器指南","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/design/adapter-guide.md","filePath":"reference/design/adapter-guide.md","lastUpdated":null}'),n={name:"reference/design/adapter-guide.md"};function h(k,s,r,d,o,u){return t(),a("div",null,[...s[0]||(s[0]=[i("div",null,[i("h1",{id:"适配器指南",tabindex:"-1"},[l("适配器指南 "),i("a",{class:"header-anchor",href:"#适配器指南","aria-label":'Permalink to "适配器指南"'},"​")]),i("ul",null,[i("li",null,"状态:提议"),i("li",null,[l("前置阅读:"),i("a",{href:"./../contracts/agent-runtime"},"agent-runtime.md"),l("(能力契约)、"),i("a",{href:"./architecture"},"architecture.md")])]),i("p",null,[l("为一个新的 agent 平台写适配器,需要交付五样东西:"),i("strong",null,"运行时、能力声明、会话识别、体检、词汇表"),l("。")]),i("h2",{id:"_1-适配器的形状",tabindex:"-1"},[l("1. 适配器的形状 "),i("a",{class:"header-anchor",href:"#_1-适配器的形状","aria-label":'Permalink to "1. 适配器的形状"'},"​")]),i("p",null,[l("M2a 起已实现,类型在 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/engine/src/platform.ts",target:"_blank",rel:"noreferrer"},[i("code",null,"engine/src/platform.ts")]),l(",以代码为准:")]),i("div",{class:"language-ts vp-adaptive-theme"},[i("button",{title:"Copy Code",class:"copy"}),i("span",{class:"lang"},"ts"),i("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[i("code",null,[i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},"interface"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," PlatformAdapter"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," {")]),l(`
1
+ import{_ as e,o as t,c as n,j as i,a as l}from"./chunks/framework.BetZR81g.js";const p=JSON.parse('{"title":"适配器指南","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/design/adapter-guide.md","filePath":"reference/design/adapter-guide.md","lastUpdated":null}'),a={name:"reference/design/adapter-guide.md"};function h(d,s,r,k,o,u){return t(),n("div",null,[...s[0]||(s[0]=[i("div",null,[i("h1",{id:"适配器指南",tabindex:"-1"},[l("适配器指南 "),i("a",{class:"header-anchor",href:"#适配器指南","aria-label":'Permalink to "适配器指南"'},"​")]),i("ul",null,[i("li",null,"状态:提议"),i("li",null,[l("前置阅读:"),i("a",{href:"./../contracts/agent-runtime"},"agent-runtime.md"),l("(能力契约)、"),i("a",{href:"./architecture"},"architecture.md")])]),i("p",null,[l("为一个新的 agent 平台写适配器,需要交付五样东西:"),i("strong",null,"运行时、能力声明、会话识别、体检、词汇表"),l("。")]),i("h2",{id:"_1-适配器的形状",tabindex:"-1"},[l("1. 适配器的形状 "),i("a",{class:"header-anchor",href:"#_1-适配器的形状","aria-label":'Permalink to "1. 适配器的形状"'},"​")]),i("p",null,[l("M2a 起已实现,类型在 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/engine/src/platform.ts",target:"_blank",rel:"noreferrer"},[i("code",null,"engine/src/platform.ts")]),l(",以代码为准:")]),i("div",{class:"language-ts vp-adaptive-theme"},[i("button",{title:"Copy Code",class:"copy"}),i("span",{class:"lang"},"ts"),i("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[i("code",null,[i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},"interface"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," PlatformAdapter"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," {")]),l(`
2
2
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}}," id"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},":"),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}}," string"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"; "),i("span",{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}},'// 配置中 platform.adapter 的值,例如 "paseo"')]),l(`
3
3
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}}," displayName"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},":"),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}}," string"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"; "),i("span",{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}},'// 面向使用者,例如 "Paseo"')]),l(`
4
4
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}}," createRuntime"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},":"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," RuntimeFactory"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},";")]),l(`
@@ -13,4 +13,4 @@ import{_ as e,o as t,c as a,j as i,a as l}from"./chunks/framework.BetZR81g.js";c
13
13
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," doctorProject"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},"?"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"({ "),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"repo"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"isRepo"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"tools"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," })"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},":"),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}}," void"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"; "),i("span",{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}},"// 项目里平台自己的文件")]),l(`
14
14
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," agentCatalog"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},"?"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"("),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"settings"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"progress"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},")"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},":"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," Promise"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"<{ "),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"catalog"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"; "),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}},"close"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"() }>; "),i("span",{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}},"// 配置向导可选的 agent")]),l(`
15
15
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}}," words"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},"?:"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," Partial"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"<"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}},"PlatformWords"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},">; "),i("span",{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}},"// 平台的说法(M2e,engine/src/words.ts)")]),l(`
16
- `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),i("p",null,[l("能力来源写 "),i("code",null,"builtin"),l(" 时,运行时层用 laoshi 的内置实现替换对应方法("),i("code",null,"engine/src/builtin/"),l(",见 "),i("a",{href:"./builtin-capabilities"},"builtin-capabilities"),l(";目前有 "),i("code",null,"services"),l("、"),i("code",null,"worktree"),l(")。内置服务要知道对话的工作目录时,调用运行时可选的 "),i("code",null,"agentDirectory(agentId)"),l("。")]),i("p",null,[l("适配器放在 "),i("code",null,"adapters/<id>/"),l(",由 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/engine/src/runtime-loader.ts",target:"_blank",rel:"noreferrer"},[i("code",null,"runtime-loader.ts")]),l(" 登记,这是核心中唯一引用适配器的文件("),i("code",null,"engine/test/platform.test.ts"),l(" 检查)。草案中的 "),i("code",null,"vocabulary"),l(" 已在 M2e 实现为 "),i("code",null,"words"),l(";"),i("code",null,"skillTargets"),l("、"),i("code",null,"configSchema"),l("、"),i("code",null,"compatibleWith"),l(" 以后补上。")]),i("h2",{id:"_2-能力声明",tabindex:"-1"},[l("2. 能力声明 "),i("a",{class:"header-anchor",href:"#_2-能力声明","aria-label":'Permalink to "2. 能力声明"'},"​")]),i("blockquote",null,[i("p",null,[i("a",{href:"./../adr/0008-capability-sources-and-platform-plugin"},"ADR 0008"),l("(提议)对本节有两处补充:每项能力要标明来源("),i("code",null,"platform"),l(" / "),i("code",null,"plugin"),l(" / "),i("code",null,"builtin"),l(" / "),i("code",null,"none"),l("),运行时层按这个顺序选择;适配器可以带一个运行在平台进程内的插件,用来补上外部 API 调不到的能力。dsh 的实例见 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/dsh-adapter.md",target:"_blank",rel:"noreferrer"},"dsh-adapter"),l("。")])]),i("p",null,[l("必需能力("),i("code",null,"verifyOrigin"),l("、"),i("code",null,"startAgent"),l("、"),i("code",null,"StepAgent.*"),l("、"),i("code",null,"attachAgent"),l("、"),i("code",null,"notifyAgent"),l("、"),i("code",null,"interruptAgent"),l("、"),i("code",null,"close"),l(")必须全部实现,不需要声明。可选和按需能力用名称声明:")]),i("table",{tabindex:"0"},[i("thead",null,[i("tr",null,[i("th",null,"名称"),i("th",null,"对应方法")])]),i("tbody",null,[i("tr",null,[i("td",null,[i("code",null,"profiles")]),i("td",null,[i("code",null,"listProfiles")])]),i("tr",null,[i("td",null,[i("code",null,"services")]),i("td",null,[i("code",null,"listServices"),l("、"),i("code",null,"startServices"),l("、"),i("code",null,"stopServices")])]),i("tr",null,[i("td",null,[i("code",null,"worktree")]),i("td",null,[i("code",null,"createWorktree"),l("、"),i("code",null,"openWorkspace"),l("、"),i("code",null,"waitForWorkspaceSetup")])]),i("tr",null,[i("td",null,[i("code",null,"scheduling")]),i("td",null,[i("code",null,"scheduleMessage"),l("、"),i("code",null,"cancelSchedule")])]),i("tr",null,[i("td",null,[i("code",null,"scheduleAgent")]),i("td",null,[i("code",null,"scheduleNewAgent")])]),i("tr",null,[i("td",null,[i("code",null,"sessionAgent")]),i("td",null,[i("code",null,"startSessionAgent")])]),i("tr",null,[i("td",null,[i("code",null,"quota")]),i("td",null,[i("code",null,"providerQuota")])]),i("tr",null,[i("td",null,[i("code",null,"activity")]),i("td",null,[i("code",null,"recentActivity")])]),i("tr",null,[i("td",null,[i("code",null,"runningTool")]),i("td",null,[i("code",null,"runningTool")])]),i("tr",null,[i("td",null,[i("code",null,"toolCalls")]),i("td",null,[i("code",null,"toolCalls")])]),i("tr",null,[i("td",null,[i("code",null,"toolInfo")]),i("td",null,[i("code",null,"capabilities")])]),i("tr",null,[i("td",null,[i("code",null,"providerStatus")]),i("td",null,[i("code",null,"providerStatus")])])])]),i("p",null,[l("运行时层按声明包装适配器("),i("code",null,"withCapabilities"),l(",M2a 已实现):"),i("strong",null,[l("未声明的能力,可选读取统一返回 "),i("code",null,"null"),l(',定时返回"没有安排",按需操作报"<平台> 不支持……"')]),l("。调用点里已有的 "),i("code",null,".catch(() => null)"),l(" 在 M2e 收敛词汇时逐步去掉。")]),i("h2",{id:"_3-会话识别",tabindex:"-1"},[l("3. 会话识别 "),i("a",{class:"header-anchor",href:"#_3-会话识别","aria-label":'Permalink to "3. 会话识别"'},"​")]),i("p",null,[l("req-kit 靠环境变量 "),i("code",null,"PASEO_AGENT_ID"),l("、"),i("code",null,"PASEO_AGENT_CWD"),l(' 识别"当前对话"。适配器用 '),i("code",null,"originEnv"),l(" 声明自己的变量名(dsh 是 "),i("code",null,"DSH_SESSION_ID"),l(");核心用 "),i("code",null,"originFromEnv"),l(" 识别,为不属于对话的子进程用 "),i("code",null,"scrubOriginEnv"),l(' 去掉所有平台的变量。没有"会话"概念的平台:返回 '),i("code",null,"null"),l(',引擎仍可运行,只是进展写日志而不发回会话;或者由适配器自行定义一个"发起者"。')]),i("h2",{id:"_4-体检",tabindex:"-1"},[l("4. 体检 "),i("a",{class:"header-anchor",href:"#_4-体检","aria-label":'Permalink to "4. 体检"'},"​")]),i("p",null,[i("code",null,"laoshi doctor"),l(" 分两部分:")]),i("ul",null,[i("li",null,[i("strong",null,"通用体检"),l(":安装、本机配置、项目配置、进行中的流水线、状态文件版本、集成(这些来自现在 "),i("code",null,"doctor.ts"),l(" 中与平台无关的部分)。")]),i("li",null,[i("strong",null,"适配器体检"),l(":"),i("code",null,"doctorPlatform"),l(" 写平台一节(Paseo:SDK 与 daemon 版本、连接、provider、profile、额度、各 agent;dsh:插件连接),"),i("code",null,"doctorProject"),l(" 写项目一节中平台的文件(Paseo:"),i("code",null,"paseo.json"),l(")。M2a 已从 "),i("code",null,"doctor.ts"),l(" 拆到 "),i("code",null,"adapters/paseo/doctor.ts"),l("。")]),i("li",null,[i("strong",null,"能力表"),l(":通用体检列出每项可选能力的来源(平台 / laoshi 插件 / laoshi 内置 / 无)。")])]),i("p",null,"体检项的输出格式沿用 ✓ / ⚠ / ✗ 加修复建议。"),i("h2",{id:"_5-一致性测试",tabindex:"-1"},[l("5. 一致性测试 "),i("a",{class:"header-anchor",href:"#_5-一致性测试","aria-label":'Permalink to "5. 一致性测试"'},"​")]),i("p",null,"新适配器必须通过:"),i("ol",null,[i("li",null,[i("strong",null,"编排测试"),l("("),i("code",null,"engine/test"),l(" 中基于 "),i("code",null,"fake-runtime.ts"),l(" 的用例)。注意它测的是核心对运行时的期望,适配器作者应当用同一套期望检查自己的实现(计划抽成可复用的 "),i("code",null,"runConformance(adapter)"),l(")。")]),i("li",null,[i("strong",null,"探针测试"),l("(真实平台上运行,需要一个临时目录和少量用量): "),i("ul",null,[i("li",null,[l("创建一个子 agent,要求它写一个文件,"),i("code",null,"wait"),l(" 到 idle,检查文件落在 "),i("code",null,"cwd"),l(" 下;")]),i("li",null,[i("code",null,"followUp"),l(" 一次;"),i("code",null,"notifyAgent"),l(" 一次且不打断;"),i("code",null,"interruptAgent"),l(" 一次;")]),i("li",null,[l("声明了 "),i("code",null,"scheduling"),l(" 的,预约一条 1 分钟后的消息并取消;")]),i("li",null,[l("声明了 "),i("code",null,"worktree"),l(" / "),i("code",null,"services"),l(" 的,各创建并清理一次。")])])]),i("li",null,[i("strong",null,"端到端评估"),l("("),i("code",null,"evals/"),l('):至少跑一个用例,要求"夸大"指标为零。')])]),i("p",null,[l("通过结果写入 "),i("code",null,"laoshi doctor"),l(" 的能力矩阵(实现了什么、探针是否通过),并作为 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/init-bootstrap.md",target:"_blank",rel:"noreferrer"},"init-bootstrap.md"),l(" 中锁定文件的一部分。")]),i("h2",{id:"_6-版本与兼容",tabindex:"-1"},[l("6. 版本与兼容 "),i("a",{class:"header-anchor",href:"#_6-版本与兼容","aria-label":'Permalink to "6. 版本与兼容"'},"​")]),i("ul",null,[i("li",null,[l("适配器声明 "),i("code",null,"compatibleWith"),l("(平台版本范围)。req-kit 对 Paseo 是 "),i("code",null,">=0.11.0 <0.12.0"),l(",只检查、不强制。")]),i("li",null,[l("使用平台非公开接口的地方(req-kit 中 Paseo 的工作区脚本与定时任务经 "),i("code",null,"internal/daemon-client"),l(")必须隔离在适配器内,并在不可用时返回 "),i("code",null,"null"),l(",不得让核心知道。")]),i("li",null,[l("适配器自带的界面插件(例如 Paseo 插件)读取 "),i("code",null,"laoshi api"),l(" 的 JSON 输出("),i("code",null,"contracts/cli-json.md"),l("),不直接读状态文件。")])])],-1),i("p",{class:"source-note"},[l("本页由仓库中的 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/adapter-guide.md"},"docs/design/adapter-guide.md"),l(" 生成。"),i("a",{href:"https://github.com/yiyisf/laoshi/edit/main/docs/design/adapter-guide.md"},"在 GitHub 上编辑")],-1)])])}const g=e(n,[["render",h]]);export{c as __pageData,g as default};
16
+ `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),i("p",null,[l("能力来源写 "),i("code",null,"builtin"),l(" 时,运行时层用 laoshi 的内置实现替换对应方法("),i("code",null,"engine/src/builtin/"),l(",见 "),i("a",{href:"./builtin-capabilities"},"builtin-capabilities"),l(";目前有 "),i("code",null,"services"),l("、"),i("code",null,"worktree"),l(")。内置服务要知道对话的工作目录时,调用运行时可选的 "),i("code",null,"agentDirectory(agentId)"),l("。")]),i("p",null,[l("适配器放在 "),i("code",null,"adapters/<id>/"),l(",由 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/engine/src/runtime-loader.ts",target:"_blank",rel:"noreferrer"},[i("code",null,"runtime-loader.ts")]),l(" 登记,这是核心中唯一引用适配器的文件("),i("code",null,"engine/test/platform.test.ts"),l(" 检查)。草案中的 "),i("code",null,"vocabulary"),l(" 已在 M2e 实现为 "),i("code",null,"words"),l(";"),i("code",null,"skillTargets"),l("、"),i("code",null,"configSchema"),l("、"),i("code",null,"compatibleWith"),l(" 以后补上。")]),i("h2",{id:"_2-能力声明",tabindex:"-1"},[l("2. 能力声明 "),i("a",{class:"header-anchor",href:"#_2-能力声明","aria-label":'Permalink to "2. 能力声明"'},"​")]),i("blockquote",null,[i("p",null,[i("a",{href:"./../adr/0008-capability-sources-and-platform-plugin"},"ADR 0008"),l("(提议)对本节有两处补充:每项能力要标明来源("),i("code",null,"platform"),l(" / "),i("code",null,"plugin"),l(" / "),i("code",null,"builtin"),l(" / "),i("code",null,"none"),l("),运行时层按这个顺序选择;适配器可以带一个运行在平台进程内的插件,用来补上外部 API 调不到的能力。dsh 的实例见 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/dsh-adapter.md",target:"_blank",rel:"noreferrer"},"dsh-adapter"),l("。")])]),i("p",null,[l("必需能力("),i("code",null,"verifyOrigin"),l("、"),i("code",null,"startAgent"),l("、"),i("code",null,"StepAgent.*"),l("、"),i("code",null,"attachAgent"),l("、"),i("code",null,"notifyAgent"),l("、"),i("code",null,"interruptAgent"),l("、"),i("code",null,"close"),l(")必须全部实现,不需要声明。可选和按需能力用名称声明:")]),i("table",{tabindex:"0"},[i("thead",null,[i("tr",null,[i("th",null,"名称"),i("th",null,"对应方法")])]),i("tbody",null,[i("tr",null,[i("td",null,[i("code",null,"profiles")]),i("td",null,[i("code",null,"listProfiles")])]),i("tr",null,[i("td",null,[i("code",null,"services")]),i("td",null,[i("code",null,"listServices"),l("、"),i("code",null,"startServices"),l("、"),i("code",null,"stopServices")])]),i("tr",null,[i("td",null,[i("code",null,"worktree")]),i("td",null,[i("code",null,"createWorktree"),l("、"),i("code",null,"openWorkspace"),l("、"),i("code",null,"waitForWorkspaceSetup")])]),i("tr",null,[i("td",null,[i("code",null,"scheduling")]),i("td",null,[i("code",null,"scheduleMessage"),l("、"),i("code",null,"cancelSchedule")])]),i("tr",null,[i("td",null,[i("code",null,"scheduleAgent")]),i("td",null,[i("code",null,"scheduleNewAgent")])]),i("tr",null,[i("td",null,[i("code",null,"sessionAgent")]),i("td",null,[i("code",null,"startSessionAgent")])]),i("tr",null,[i("td",null,[i("code",null,"quota")]),i("td",null,[i("code",null,"providerQuota")])]),i("tr",null,[i("td",null,[i("code",null,"activity")]),i("td",null,[i("code",null,"recentActivity")])]),i("tr",null,[i("td",null,[i("code",null,"runningTool")]),i("td",null,[i("code",null,"runningTool")])]),i("tr",null,[i("td",null,[i("code",null,"toolCalls")]),i("td",null,[i("code",null,"toolCalls")])]),i("tr",null,[i("td",null,[i("code",null,"toolInfo")]),i("td",null,[i("code",null,"capabilities")])]),i("tr",null,[i("td",null,[i("code",null,"providerStatus")]),i("td",null,[i("code",null,"providerStatus")])])])]),i("p",null,[l("运行时层按声明包装适配器("),i("code",null,"withCapabilities"),l(",M2a 已实现):"),i("strong",null,[l("未声明的能力,可选读取统一返回 "),i("code",null,"null"),l(',定时返回"没有安排",按需操作报"<平台> 不支持……"')]),l("。调用点里已有的 "),i("code",null,".catch(() => null)"),l(" 在 M2e 收敛词汇时逐步去掉。")]),i("h2",{id:"_3-会话识别",tabindex:"-1"},[l("3. 会话识别 "),i("a",{class:"header-anchor",href:"#_3-会话识别","aria-label":'Permalink to "3. 会话识别"'},"​")]),i("p",null,[l("req-kit 靠环境变量 "),i("code",null,"PASEO_AGENT_ID"),l("、"),i("code",null,"PASEO_AGENT_CWD"),l(' 识别"当前对话"。适配器用 '),i("code",null,"originEnv"),l(" 声明自己的变量名(dsh 是 "),i("code",null,"DSH_SESSION_ID"),l(");核心用 "),i("code",null,"originFromEnv"),l(" 识别,为不属于对话的子进程用 "),i("code",null,"scrubOriginEnv"),l(' 去掉所有平台的变量。没有"会话"概念的平台:返回 '),i("code",null,"null"),l(',引擎仍可运行,只是进展写日志而不发回会话;或者由适配器自行定义一个"发起者"。')]),i("h2",{id:"_4-体检",tabindex:"-1"},[l("4. 体检 "),i("a",{class:"header-anchor",href:"#_4-体检","aria-label":'Permalink to "4. 体检"'},"​")]),i("p",null,[i("code",null,"laoshi doctor"),l(" 分两部分:")]),i("ul",null,[i("li",null,[i("strong",null,"通用体检"),l(":安装、本机配置、项目配置、进行中的流水线、状态文件版本、集成(这些来自现在 "),i("code",null,"doctor.ts"),l(" 中与平台无关的部分)。")]),i("li",null,[i("strong",null,"适配器体检"),l(":"),i("code",null,"doctorPlatform"),l(" 写平台一节(Paseo:SDK 与 daemon 版本、连接、provider、profile、额度、各 agent;dsh:插件连接),"),i("code",null,"doctorProject"),l(" 写项目一节中平台的文件(Paseo:"),i("code",null,"paseo.json"),l(")。M2a 已从 "),i("code",null,"doctor.ts"),l(" 拆到 "),i("code",null,"adapters/paseo/doctor.ts"),l("。")]),i("li",null,[i("strong",null,"能力表"),l(":通用体检列出每项可选能力的来源(平台 / laoshi 插件 / laoshi 内置 / 无)。")])]),i("p",null,"体检项的输出格式沿用 ✓ / ⚠ / ✗ 加修复建议。"),i("h2",{id:"_5-一致性测试",tabindex:"-1"},[l("5. 一致性测试 "),i("a",{class:"header-anchor",href:"#_5-一致性测试","aria-label":'Permalink to "5. 一致性测试"'},"​")]),i("p",null,"新适配器必须通过:"),i("ol",null,[i("li",null,[i("strong",null,"运行时一致性测试"),l("("),i("code",null,"engine/test/conformance.ts"),l(" 的 "),i("code",null,"runConformance"),l(",M3 起):在适配器的测试目录里写一个 "),i("code",null,"conformance.test.ts"),l(',给出"用假的平台后端建一个运行时"的方法('),i("code",null,"setup"),l(")和适配器的能力声明,就会跑同一组用例:"),i("code",null,"startAgent"),l(" → "),i("code",null,"wait"),l(" 为 idle 且文件写在 "),i("code",null,"cwd"),l(" 下;"),i("code",null,"followUp"),l(" 开始新回合;出错时为 error 且有原因;没等到时为 timeout、之后能等到结束;另一个进程的运行时用 "),i("code",null,"attachAgent"),l(" 接上;"),i("code",null,"interruptAgent"),l(" 改做新指令;声明了工具调用的看得到命令;可选方法不抛出、不支持的返回 "),i("code",null,"null"),l("。假后端要认识三种提示词:"),i("code",null,"WRITE:<文件>:<内容>"),l("、"),i("code",null,"SLEEP:<毫秒>"),l("、"),i("code",null,"FAIL"),l("。现在四个适配器都已接入("),i("code",null,"adapters/*/test/conformance.test.ts"),l("):Paseo(假的 SDK 客户端)、dsh(真实的 laoshi dsh 插件配假的 dsh 服务)、摸高(假的 "),i("code",null,"aimax"),l(")、命令行(假的 "),i("code",null,"claude"),l("、"),i("code",null,"codex"),l(")。平台自己的假后端可以用 "),i("code",null,"engine/test/scripted-session.ts"),l(':它按这三种提示词在工作目录里"做事",记下工具调用和回复,由假后端换成平台的格式(Paseo 的时间线、dsh 的会话记录等)。 编排测试('),i("code",null,"engine/test"),l(" 中基于 "),i("code",null,"fake-runtime.ts"),l(" 的用例)测的是核心本身,适配器不需要再跑。")]),i("li",null,[i("strong",null,"探针测试"),l("(真实平台上运行,需要一个临时目录和少量用量): "),i("ul",null,[i("li",null,[l("创建一个子 agent,要求它写一个文件,"),i("code",null,"wait"),l(" 到 idle,检查文件落在 "),i("code",null,"cwd"),l(" 下;")]),i("li",null,[i("code",null,"followUp"),l(" 一次;"),i("code",null,"notifyAgent"),l(" 一次且不打断;"),i("code",null,"interruptAgent"),l(" 一次;")]),i("li",null,[l("声明了 "),i("code",null,"scheduling"),l(" 的,预约一条 1 分钟后的消息并取消;")]),i("li",null,[l("声明了 "),i("code",null,"worktree"),l(" / "),i("code",null,"services"),l(" 的,各创建并清理一次。")])])]),i("li",null,[i("strong",null,"端到端评估"),l("("),i("code",null,"evals/"),l('):至少跑一个用例,要求"夸大"指标为零。')])]),i("p",null,[l("通过结果写入 "),i("code",null,"laoshi doctor"),l(" 的能力矩阵(实现了什么、探针是否通过),并作为 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/init-bootstrap.md",target:"_blank",rel:"noreferrer"},"init-bootstrap.md"),l(" 中锁定文件的一部分。")]),i("h2",{id:"_6-版本与兼容",tabindex:"-1"},[l("6. 版本与兼容 "),i("a",{class:"header-anchor",href:"#_6-版本与兼容","aria-label":'Permalink to "6. 版本与兼容"'},"​")]),i("ul",null,[i("li",null,[l("适配器声明 "),i("code",null,"compatibleWith"),l("(平台版本范围)。req-kit 对 Paseo 是 "),i("code",null,">=0.11.0 <0.12.0"),l(",只检查、不强制。")]),i("li",null,[l("使用平台非公开接口的地方(req-kit 中 Paseo 的工作区脚本与定时任务经 "),i("code",null,"internal/daemon-client"),l(")必须隔离在适配器内,并在不可用时返回 "),i("code",null,"null"),l(",不得让核心知道。")]),i("li",null,[l("适配器自带的界面插件(例如 Paseo 插件)读取 "),i("code",null,"laoshi api"),l(" 的 JSON 输出("),i("code",null,"contracts/cli-json.md"),l("),不直接读状态文件。")])])],-1),i("p",{class:"source-note"},[l("本页由仓库中的 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/adapter-guide.md"},"docs/design/adapter-guide.md"),l(" 生成。"),i("a",{href:"https://github.com/yiyisf/laoshi/edit/main/docs/design/adapter-guide.md"},"在 GitHub 上编辑")],-1)])])}const g=e(a,[["render",h]]);export{p as __pageData,g as default};
@@ -1,4 +1,4 @@
1
- import{_ as e,o as t,c as a,j as i,a as l}from"./chunks/framework.BetZR81g.js";const c=JSON.parse('{"title":"适配器指南","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/design/adapter-guide.md","filePath":"reference/design/adapter-guide.md","lastUpdated":null}'),n={name:"reference/design/adapter-guide.md"};function h(k,s,r,d,o,u){return t(),a("div",null,[...s[0]||(s[0]=[i("div",null,[i("h1",{id:"适配器指南",tabindex:"-1"},[l("适配器指南 "),i("a",{class:"header-anchor",href:"#适配器指南","aria-label":'Permalink to "适配器指南"'},"​")]),i("ul",null,[i("li",null,"状态:提议"),i("li",null,[l("前置阅读:"),i("a",{href:"./../contracts/agent-runtime"},"agent-runtime.md"),l("(能力契约)、"),i("a",{href:"./architecture"},"architecture.md")])]),i("p",null,[l("为一个新的 agent 平台写适配器,需要交付五样东西:"),i("strong",null,"运行时、能力声明、会话识别、体检、词汇表"),l("。")]),i("h2",{id:"_1-适配器的形状",tabindex:"-1"},[l("1. 适配器的形状 "),i("a",{class:"header-anchor",href:"#_1-适配器的形状","aria-label":'Permalink to "1. 适配器的形状"'},"​")]),i("p",null,[l("M2a 起已实现,类型在 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/engine/src/platform.ts",target:"_blank",rel:"noreferrer"},[i("code",null,"engine/src/platform.ts")]),l(",以代码为准:")]),i("div",{class:"language-ts vp-adaptive-theme"},[i("button",{title:"Copy Code",class:"copy"}),i("span",{class:"lang"},"ts"),i("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[i("code",null,[i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},"interface"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," PlatformAdapter"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," {")]),l(`
1
+ import{_ as e,o as t,c as n,j as i,a as l}from"./chunks/framework.BetZR81g.js";const p=JSON.parse('{"title":"适配器指南","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/design/adapter-guide.md","filePath":"reference/design/adapter-guide.md","lastUpdated":null}'),a={name:"reference/design/adapter-guide.md"};function h(d,s,r,k,o,u){return t(),n("div",null,[...s[0]||(s[0]=[i("div",null,[i("h1",{id:"适配器指南",tabindex:"-1"},[l("适配器指南 "),i("a",{class:"header-anchor",href:"#适配器指南","aria-label":'Permalink to "适配器指南"'},"​")]),i("ul",null,[i("li",null,"状态:提议"),i("li",null,[l("前置阅读:"),i("a",{href:"./../contracts/agent-runtime"},"agent-runtime.md"),l("(能力契约)、"),i("a",{href:"./architecture"},"architecture.md")])]),i("p",null,[l("为一个新的 agent 平台写适配器,需要交付五样东西:"),i("strong",null,"运行时、能力声明、会话识别、体检、词汇表"),l("。")]),i("h2",{id:"_1-适配器的形状",tabindex:"-1"},[l("1. 适配器的形状 "),i("a",{class:"header-anchor",href:"#_1-适配器的形状","aria-label":'Permalink to "1. 适配器的形状"'},"​")]),i("p",null,[l("M2a 起已实现,类型在 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/engine/src/platform.ts",target:"_blank",rel:"noreferrer"},[i("code",null,"engine/src/platform.ts")]),l(",以代码为准:")]),i("div",{class:"language-ts vp-adaptive-theme"},[i("button",{title:"Copy Code",class:"copy"}),i("span",{class:"lang"},"ts"),i("pre",{class:"shiki shiki-themes github-light github-dark vp-code",tabindex:"0","v-pre":""},[i("code",null,[i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},"interface"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," PlatformAdapter"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," {")]),l(`
2
2
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}}," id"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},":"),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}}," string"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"; "),i("span",{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}},'// 配置中 platform.adapter 的值,例如 "paseo"')]),l(`
3
3
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}}," displayName"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},":"),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}}," string"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"; "),i("span",{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}},'// 面向使用者,例如 "Paseo"')]),l(`
4
4
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}}," createRuntime"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},":"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," RuntimeFactory"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},";")]),l(`
@@ -13,4 +13,4 @@ import{_ as e,o as t,c as a,j as i,a as l}from"./chunks/framework.BetZR81g.js";c
13
13
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," doctorProject"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},"?"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"({ "),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"repo"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"isRepo"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"tools"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," })"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},":"),i("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}}," void"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"; "),i("span",{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}},"// 项目里平台自己的文件")]),l(`
14
14
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," agentCatalog"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},"?"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"("),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"settings"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"progress"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},")"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},":"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," Promise"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"<{ "),i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}},"catalog"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"; "),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}},"close"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"() }>; "),i("span",{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}},"// 配置向导可选的 agent")]),l(`
15
15
  `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#E36209","--shiki-dark":"#FFAB70"}}," words"),i("span",{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"}},"?:"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}}," Partial"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"<"),i("span",{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"}},"PlatformWords"),i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},">; "),i("span",{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}},"// 平台的说法(M2e,engine/src/words.ts)")]),l(`
16
- `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),i("p",null,[l("能力来源写 "),i("code",null,"builtin"),l(" 时,运行时层用 laoshi 的内置实现替换对应方法("),i("code",null,"engine/src/builtin/"),l(",见 "),i("a",{href:"./builtin-capabilities"},"builtin-capabilities"),l(";目前有 "),i("code",null,"services"),l("、"),i("code",null,"worktree"),l(")。内置服务要知道对话的工作目录时,调用运行时可选的 "),i("code",null,"agentDirectory(agentId)"),l("。")]),i("p",null,[l("适配器放在 "),i("code",null,"adapters/<id>/"),l(",由 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/engine/src/runtime-loader.ts",target:"_blank",rel:"noreferrer"},[i("code",null,"runtime-loader.ts")]),l(" 登记,这是核心中唯一引用适配器的文件("),i("code",null,"engine/test/platform.test.ts"),l(" 检查)。草案中的 "),i("code",null,"vocabulary"),l(" 已在 M2e 实现为 "),i("code",null,"words"),l(";"),i("code",null,"skillTargets"),l("、"),i("code",null,"configSchema"),l("、"),i("code",null,"compatibleWith"),l(" 以后补上。")]),i("h2",{id:"_2-能力声明",tabindex:"-1"},[l("2. 能力声明 "),i("a",{class:"header-anchor",href:"#_2-能力声明","aria-label":'Permalink to "2. 能力声明"'},"​")]),i("blockquote",null,[i("p",null,[i("a",{href:"./../adr/0008-capability-sources-and-platform-plugin"},"ADR 0008"),l("(提议)对本节有两处补充:每项能力要标明来源("),i("code",null,"platform"),l(" / "),i("code",null,"plugin"),l(" / "),i("code",null,"builtin"),l(" / "),i("code",null,"none"),l("),运行时层按这个顺序选择;适配器可以带一个运行在平台进程内的插件,用来补上外部 API 调不到的能力。dsh 的实例见 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/dsh-adapter.md",target:"_blank",rel:"noreferrer"},"dsh-adapter"),l("。")])]),i("p",null,[l("必需能力("),i("code",null,"verifyOrigin"),l("、"),i("code",null,"startAgent"),l("、"),i("code",null,"StepAgent.*"),l("、"),i("code",null,"attachAgent"),l("、"),i("code",null,"notifyAgent"),l("、"),i("code",null,"interruptAgent"),l("、"),i("code",null,"close"),l(")必须全部实现,不需要声明。可选和按需能力用名称声明:")]),i("table",{tabindex:"0"},[i("thead",null,[i("tr",null,[i("th",null,"名称"),i("th",null,"对应方法")])]),i("tbody",null,[i("tr",null,[i("td",null,[i("code",null,"profiles")]),i("td",null,[i("code",null,"listProfiles")])]),i("tr",null,[i("td",null,[i("code",null,"services")]),i("td",null,[i("code",null,"listServices"),l("、"),i("code",null,"startServices"),l("、"),i("code",null,"stopServices")])]),i("tr",null,[i("td",null,[i("code",null,"worktree")]),i("td",null,[i("code",null,"createWorktree"),l("、"),i("code",null,"openWorkspace"),l("、"),i("code",null,"waitForWorkspaceSetup")])]),i("tr",null,[i("td",null,[i("code",null,"scheduling")]),i("td",null,[i("code",null,"scheduleMessage"),l("、"),i("code",null,"cancelSchedule")])]),i("tr",null,[i("td",null,[i("code",null,"scheduleAgent")]),i("td",null,[i("code",null,"scheduleNewAgent")])]),i("tr",null,[i("td",null,[i("code",null,"sessionAgent")]),i("td",null,[i("code",null,"startSessionAgent")])]),i("tr",null,[i("td",null,[i("code",null,"quota")]),i("td",null,[i("code",null,"providerQuota")])]),i("tr",null,[i("td",null,[i("code",null,"activity")]),i("td",null,[i("code",null,"recentActivity")])]),i("tr",null,[i("td",null,[i("code",null,"runningTool")]),i("td",null,[i("code",null,"runningTool")])]),i("tr",null,[i("td",null,[i("code",null,"toolCalls")]),i("td",null,[i("code",null,"toolCalls")])]),i("tr",null,[i("td",null,[i("code",null,"toolInfo")]),i("td",null,[i("code",null,"capabilities")])]),i("tr",null,[i("td",null,[i("code",null,"providerStatus")]),i("td",null,[i("code",null,"providerStatus")])])])]),i("p",null,[l("运行时层按声明包装适配器("),i("code",null,"withCapabilities"),l(",M2a 已实现):"),i("strong",null,[l("未声明的能力,可选读取统一返回 "),i("code",null,"null"),l(',定时返回"没有安排",按需操作报"<平台> 不支持……"')]),l("。调用点里已有的 "),i("code",null,".catch(() => null)"),l(" 在 M2e 收敛词汇时逐步去掉。")]),i("h2",{id:"_3-会话识别",tabindex:"-1"},[l("3. 会话识别 "),i("a",{class:"header-anchor",href:"#_3-会话识别","aria-label":'Permalink to "3. 会话识别"'},"​")]),i("p",null,[l("req-kit 靠环境变量 "),i("code",null,"PASEO_AGENT_ID"),l("、"),i("code",null,"PASEO_AGENT_CWD"),l(' 识别"当前对话"。适配器用 '),i("code",null,"originEnv"),l(" 声明自己的变量名(dsh 是 "),i("code",null,"DSH_SESSION_ID"),l(");核心用 "),i("code",null,"originFromEnv"),l(" 识别,为不属于对话的子进程用 "),i("code",null,"scrubOriginEnv"),l(' 去掉所有平台的变量。没有"会话"概念的平台:返回 '),i("code",null,"null"),l(',引擎仍可运行,只是进展写日志而不发回会话;或者由适配器自行定义一个"发起者"。')]),i("h2",{id:"_4-体检",tabindex:"-1"},[l("4. 体检 "),i("a",{class:"header-anchor",href:"#_4-体检","aria-label":'Permalink to "4. 体检"'},"​")]),i("p",null,[i("code",null,"laoshi doctor"),l(" 分两部分:")]),i("ul",null,[i("li",null,[i("strong",null,"通用体检"),l(":安装、本机配置、项目配置、进行中的流水线、状态文件版本、集成(这些来自现在 "),i("code",null,"doctor.ts"),l(" 中与平台无关的部分)。")]),i("li",null,[i("strong",null,"适配器体检"),l(":"),i("code",null,"doctorPlatform"),l(" 写平台一节(Paseo:SDK 与 daemon 版本、连接、provider、profile、额度、各 agent;dsh:插件连接),"),i("code",null,"doctorProject"),l(" 写项目一节中平台的文件(Paseo:"),i("code",null,"paseo.json"),l(")。M2a 已从 "),i("code",null,"doctor.ts"),l(" 拆到 "),i("code",null,"adapters/paseo/doctor.ts"),l("。")]),i("li",null,[i("strong",null,"能力表"),l(":通用体检列出每项可选能力的来源(平台 / laoshi 插件 / laoshi 内置 / 无)。")])]),i("p",null,"体检项的输出格式沿用 ✓ / ⚠ / ✗ 加修复建议。"),i("h2",{id:"_5-一致性测试",tabindex:"-1"},[l("5. 一致性测试 "),i("a",{class:"header-anchor",href:"#_5-一致性测试","aria-label":'Permalink to "5. 一致性测试"'},"​")]),i("p",null,"新适配器必须通过:"),i("ol",null,[i("li",null,[i("strong",null,"编排测试"),l("("),i("code",null,"engine/test"),l(" 中基于 "),i("code",null,"fake-runtime.ts"),l(" 的用例)。注意它测的是核心对运行时的期望,适配器作者应当用同一套期望检查自己的实现(计划抽成可复用的 "),i("code",null,"runConformance(adapter)"),l(")。")]),i("li",null,[i("strong",null,"探针测试"),l("(真实平台上运行,需要一个临时目录和少量用量): "),i("ul",null,[i("li",null,[l("创建一个子 agent,要求它写一个文件,"),i("code",null,"wait"),l(" 到 idle,检查文件落在 "),i("code",null,"cwd"),l(" 下;")]),i("li",null,[i("code",null,"followUp"),l(" 一次;"),i("code",null,"notifyAgent"),l(" 一次且不打断;"),i("code",null,"interruptAgent"),l(" 一次;")]),i("li",null,[l("声明了 "),i("code",null,"scheduling"),l(" 的,预约一条 1 分钟后的消息并取消;")]),i("li",null,[l("声明了 "),i("code",null,"worktree"),l(" / "),i("code",null,"services"),l(" 的,各创建并清理一次。")])])]),i("li",null,[i("strong",null,"端到端评估"),l("("),i("code",null,"evals/"),l('):至少跑一个用例,要求"夸大"指标为零。')])]),i("p",null,[l("通过结果写入 "),i("code",null,"laoshi doctor"),l(" 的能力矩阵(实现了什么、探针是否通过),并作为 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/init-bootstrap.md",target:"_blank",rel:"noreferrer"},"init-bootstrap.md"),l(" 中锁定文件的一部分。")]),i("h2",{id:"_6-版本与兼容",tabindex:"-1"},[l("6. 版本与兼容 "),i("a",{class:"header-anchor",href:"#_6-版本与兼容","aria-label":'Permalink to "6. 版本与兼容"'},"​")]),i("ul",null,[i("li",null,[l("适配器声明 "),i("code",null,"compatibleWith"),l("(平台版本范围)。req-kit 对 Paseo 是 "),i("code",null,">=0.11.0 <0.12.0"),l(",只检查、不强制。")]),i("li",null,[l("使用平台非公开接口的地方(req-kit 中 Paseo 的工作区脚本与定时任务经 "),i("code",null,"internal/daemon-client"),l(")必须隔离在适配器内,并在不可用时返回 "),i("code",null,"null"),l(",不得让核心知道。")]),i("li",null,[l("适配器自带的界面插件(例如 Paseo 插件)读取 "),i("code",null,"laoshi api"),l(" 的 JSON 输出("),i("code",null,"contracts/cli-json.md"),l("),不直接读状态文件。")])])],-1),i("p",{class:"source-note"},[l("本页由仓库中的 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/adapter-guide.md"},"docs/design/adapter-guide.md"),l(" 生成。"),i("a",{href:"https://github.com/yiyisf/laoshi/edit/main/docs/design/adapter-guide.md"},"在 GitHub 上编辑")],-1)])])}const g=e(n,[["render",h]]);export{c as __pageData,g as default};
16
+ `),i("span",{class:"line"},[i("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),i("p",null,[l("能力来源写 "),i("code",null,"builtin"),l(" 时,运行时层用 laoshi 的内置实现替换对应方法("),i("code",null,"engine/src/builtin/"),l(",见 "),i("a",{href:"./builtin-capabilities"},"builtin-capabilities"),l(";目前有 "),i("code",null,"services"),l("、"),i("code",null,"worktree"),l(")。内置服务要知道对话的工作目录时,调用运行时可选的 "),i("code",null,"agentDirectory(agentId)"),l("。")]),i("p",null,[l("适配器放在 "),i("code",null,"adapters/<id>/"),l(",由 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/engine/src/runtime-loader.ts",target:"_blank",rel:"noreferrer"},[i("code",null,"runtime-loader.ts")]),l(" 登记,这是核心中唯一引用适配器的文件("),i("code",null,"engine/test/platform.test.ts"),l(" 检查)。草案中的 "),i("code",null,"vocabulary"),l(" 已在 M2e 实现为 "),i("code",null,"words"),l(";"),i("code",null,"skillTargets"),l("、"),i("code",null,"configSchema"),l("、"),i("code",null,"compatibleWith"),l(" 以后补上。")]),i("h2",{id:"_2-能力声明",tabindex:"-1"},[l("2. 能力声明 "),i("a",{class:"header-anchor",href:"#_2-能力声明","aria-label":'Permalink to "2. 能力声明"'},"​")]),i("blockquote",null,[i("p",null,[i("a",{href:"./../adr/0008-capability-sources-and-platform-plugin"},"ADR 0008"),l("(提议)对本节有两处补充:每项能力要标明来源("),i("code",null,"platform"),l(" / "),i("code",null,"plugin"),l(" / "),i("code",null,"builtin"),l(" / "),i("code",null,"none"),l("),运行时层按这个顺序选择;适配器可以带一个运行在平台进程内的插件,用来补上外部 API 调不到的能力。dsh 的实例见 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/dsh-adapter.md",target:"_blank",rel:"noreferrer"},"dsh-adapter"),l("。")])]),i("p",null,[l("必需能力("),i("code",null,"verifyOrigin"),l("、"),i("code",null,"startAgent"),l("、"),i("code",null,"StepAgent.*"),l("、"),i("code",null,"attachAgent"),l("、"),i("code",null,"notifyAgent"),l("、"),i("code",null,"interruptAgent"),l("、"),i("code",null,"close"),l(")必须全部实现,不需要声明。可选和按需能力用名称声明:")]),i("table",{tabindex:"0"},[i("thead",null,[i("tr",null,[i("th",null,"名称"),i("th",null,"对应方法")])]),i("tbody",null,[i("tr",null,[i("td",null,[i("code",null,"profiles")]),i("td",null,[i("code",null,"listProfiles")])]),i("tr",null,[i("td",null,[i("code",null,"services")]),i("td",null,[i("code",null,"listServices"),l("、"),i("code",null,"startServices"),l("、"),i("code",null,"stopServices")])]),i("tr",null,[i("td",null,[i("code",null,"worktree")]),i("td",null,[i("code",null,"createWorktree"),l("、"),i("code",null,"openWorkspace"),l("、"),i("code",null,"waitForWorkspaceSetup")])]),i("tr",null,[i("td",null,[i("code",null,"scheduling")]),i("td",null,[i("code",null,"scheduleMessage"),l("、"),i("code",null,"cancelSchedule")])]),i("tr",null,[i("td",null,[i("code",null,"scheduleAgent")]),i("td",null,[i("code",null,"scheduleNewAgent")])]),i("tr",null,[i("td",null,[i("code",null,"sessionAgent")]),i("td",null,[i("code",null,"startSessionAgent")])]),i("tr",null,[i("td",null,[i("code",null,"quota")]),i("td",null,[i("code",null,"providerQuota")])]),i("tr",null,[i("td",null,[i("code",null,"activity")]),i("td",null,[i("code",null,"recentActivity")])]),i("tr",null,[i("td",null,[i("code",null,"runningTool")]),i("td",null,[i("code",null,"runningTool")])]),i("tr",null,[i("td",null,[i("code",null,"toolCalls")]),i("td",null,[i("code",null,"toolCalls")])]),i("tr",null,[i("td",null,[i("code",null,"toolInfo")]),i("td",null,[i("code",null,"capabilities")])]),i("tr",null,[i("td",null,[i("code",null,"providerStatus")]),i("td",null,[i("code",null,"providerStatus")])])])]),i("p",null,[l("运行时层按声明包装适配器("),i("code",null,"withCapabilities"),l(",M2a 已实现):"),i("strong",null,[l("未声明的能力,可选读取统一返回 "),i("code",null,"null"),l(',定时返回"没有安排",按需操作报"<平台> 不支持……"')]),l("。调用点里已有的 "),i("code",null,".catch(() => null)"),l(" 在 M2e 收敛词汇时逐步去掉。")]),i("h2",{id:"_3-会话识别",tabindex:"-1"},[l("3. 会话识别 "),i("a",{class:"header-anchor",href:"#_3-会话识别","aria-label":'Permalink to "3. 会话识别"'},"​")]),i("p",null,[l("req-kit 靠环境变量 "),i("code",null,"PASEO_AGENT_ID"),l("、"),i("code",null,"PASEO_AGENT_CWD"),l(' 识别"当前对话"。适配器用 '),i("code",null,"originEnv"),l(" 声明自己的变量名(dsh 是 "),i("code",null,"DSH_SESSION_ID"),l(");核心用 "),i("code",null,"originFromEnv"),l(" 识别,为不属于对话的子进程用 "),i("code",null,"scrubOriginEnv"),l(' 去掉所有平台的变量。没有"会话"概念的平台:返回 '),i("code",null,"null"),l(',引擎仍可运行,只是进展写日志而不发回会话;或者由适配器自行定义一个"发起者"。')]),i("h2",{id:"_4-体检",tabindex:"-1"},[l("4. 体检 "),i("a",{class:"header-anchor",href:"#_4-体检","aria-label":'Permalink to "4. 体检"'},"​")]),i("p",null,[i("code",null,"laoshi doctor"),l(" 分两部分:")]),i("ul",null,[i("li",null,[i("strong",null,"通用体检"),l(":安装、本机配置、项目配置、进行中的流水线、状态文件版本、集成(这些来自现在 "),i("code",null,"doctor.ts"),l(" 中与平台无关的部分)。")]),i("li",null,[i("strong",null,"适配器体检"),l(":"),i("code",null,"doctorPlatform"),l(" 写平台一节(Paseo:SDK 与 daemon 版本、连接、provider、profile、额度、各 agent;dsh:插件连接),"),i("code",null,"doctorProject"),l(" 写项目一节中平台的文件(Paseo:"),i("code",null,"paseo.json"),l(")。M2a 已从 "),i("code",null,"doctor.ts"),l(" 拆到 "),i("code",null,"adapters/paseo/doctor.ts"),l("。")]),i("li",null,[i("strong",null,"能力表"),l(":通用体检列出每项可选能力的来源(平台 / laoshi 插件 / laoshi 内置 / 无)。")])]),i("p",null,"体检项的输出格式沿用 ✓ / ⚠ / ✗ 加修复建议。"),i("h2",{id:"_5-一致性测试",tabindex:"-1"},[l("5. 一致性测试 "),i("a",{class:"header-anchor",href:"#_5-一致性测试","aria-label":'Permalink to "5. 一致性测试"'},"​")]),i("p",null,"新适配器必须通过:"),i("ol",null,[i("li",null,[i("strong",null,"运行时一致性测试"),l("("),i("code",null,"engine/test/conformance.ts"),l(" 的 "),i("code",null,"runConformance"),l(",M3 起):在适配器的测试目录里写一个 "),i("code",null,"conformance.test.ts"),l(',给出"用假的平台后端建一个运行时"的方法('),i("code",null,"setup"),l(")和适配器的能力声明,就会跑同一组用例:"),i("code",null,"startAgent"),l(" → "),i("code",null,"wait"),l(" 为 idle 且文件写在 "),i("code",null,"cwd"),l(" 下;"),i("code",null,"followUp"),l(" 开始新回合;出错时为 error 且有原因;没等到时为 timeout、之后能等到结束;另一个进程的运行时用 "),i("code",null,"attachAgent"),l(" 接上;"),i("code",null,"interruptAgent"),l(" 改做新指令;声明了工具调用的看得到命令;可选方法不抛出、不支持的返回 "),i("code",null,"null"),l("。假后端要认识三种提示词:"),i("code",null,"WRITE:<文件>:<内容>"),l("、"),i("code",null,"SLEEP:<毫秒>"),l("、"),i("code",null,"FAIL"),l("。现在四个适配器都已接入("),i("code",null,"adapters/*/test/conformance.test.ts"),l("):Paseo(假的 SDK 客户端)、dsh(真实的 laoshi dsh 插件配假的 dsh 服务)、摸高(假的 "),i("code",null,"aimax"),l(")、命令行(假的 "),i("code",null,"claude"),l("、"),i("code",null,"codex"),l(")。平台自己的假后端可以用 "),i("code",null,"engine/test/scripted-session.ts"),l(':它按这三种提示词在工作目录里"做事",记下工具调用和回复,由假后端换成平台的格式(Paseo 的时间线、dsh 的会话记录等)。 编排测试('),i("code",null,"engine/test"),l(" 中基于 "),i("code",null,"fake-runtime.ts"),l(" 的用例)测的是核心本身,适配器不需要再跑。")]),i("li",null,[i("strong",null,"探针测试"),l("(真实平台上运行,需要一个临时目录和少量用量): "),i("ul",null,[i("li",null,[l("创建一个子 agent,要求它写一个文件,"),i("code",null,"wait"),l(" 到 idle,检查文件落在 "),i("code",null,"cwd"),l(" 下;")]),i("li",null,[i("code",null,"followUp"),l(" 一次;"),i("code",null,"notifyAgent"),l(" 一次且不打断;"),i("code",null,"interruptAgent"),l(" 一次;")]),i("li",null,[l("声明了 "),i("code",null,"scheduling"),l(" 的,预约一条 1 分钟后的消息并取消;")]),i("li",null,[l("声明了 "),i("code",null,"worktree"),l(" / "),i("code",null,"services"),l(" 的,各创建并清理一次。")])])]),i("li",null,[i("strong",null,"端到端评估"),l("("),i("code",null,"evals/"),l('):至少跑一个用例,要求"夸大"指标为零。')])]),i("p",null,[l("通过结果写入 "),i("code",null,"laoshi doctor"),l(" 的能力矩阵(实现了什么、探针是否通过),并作为 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/init-bootstrap.md",target:"_blank",rel:"noreferrer"},"init-bootstrap.md"),l(" 中锁定文件的一部分。")]),i("h2",{id:"_6-版本与兼容",tabindex:"-1"},[l("6. 版本与兼容 "),i("a",{class:"header-anchor",href:"#_6-版本与兼容","aria-label":'Permalink to "6. 版本与兼容"'},"​")]),i("ul",null,[i("li",null,[l("适配器声明 "),i("code",null,"compatibleWith"),l("(平台版本范围)。req-kit 对 Paseo 是 "),i("code",null,">=0.11.0 <0.12.0"),l(",只检查、不强制。")]),i("li",null,[l("使用平台非公开接口的地方(req-kit 中 Paseo 的工作区脚本与定时任务经 "),i("code",null,"internal/daemon-client"),l(")必须隔离在适配器内,并在不可用时返回 "),i("code",null,"null"),l(",不得让核心知道。")]),i("li",null,[l("适配器自带的界面插件(例如 Paseo 插件)读取 "),i("code",null,"laoshi api"),l(" 的 JSON 输出("),i("code",null,"contracts/cli-json.md"),l("),不直接读状态文件。")])])],-1),i("p",{class:"source-note"},[l("本页由仓库中的 "),i("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/adapter-guide.md"},"docs/design/adapter-guide.md"),l(" 生成。"),i("a",{href:"https://github.com/yiyisf/laoshi/edit/main/docs/design/adapter-guide.md"},"在 GitHub 上编辑")],-1)])])}const g=e(a,[["render",h]]);export{p as __pageData,g as default};
@@ -0,0 +1,13 @@
1
+ import{_ as s,o as a,c as n,j as l,a as e}from"./chunks/framework.BetZR81g.js";const p=JSON.parse('{"title":"命令行 agent 适配器(M3)","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"reference/design/cli-adapter.md","filePath":"reference/design/cli-adapter.md","lastUpdated":null}'),t={name:"reference/design/cli-adapter.md"};function d(o,i,u,h,r,c){return a(),n("div",null,[...i[0]||(i[0]=[l("div",null,[l("h1",{id:"命令行-agent-适配器-m3",tabindex:"-1"},[e("命令行 agent 适配器(M3) "),l("a",{class:"header-anchor",href:"#命令行-agent-适配器-m3","aria-label":'Permalink to "命令行 agent 适配器(M3)"'},"​")]),l("ul",null,[l("li",null,[e("状态:第一版已实现("),l("a",{href:"./../../guide/cli"},"adapters/cli"),e("),用假的命令行测试;真实的 Claude Code、Codex 上的运行待验证。")]),l("li",null,[e("目标:不依赖任何 agent 平台,在一台只装了编码 agent 命令行(Claude Code 的 "),l("code",null,"claude"),e("、OpenAI Codex 的 "),l("code",null,"codex"),e(")的机器上跑完整的流水线("),l("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/extraction/plan.md",target:"_blank",rel:"noreferrer"},"抽取计划 M3"),e(')。这是第一个"非平台"的适配器,也是 '),l("a",{href:"./../adr/0002-two-orchestration-modes"},"ADR 0002"),e(" 里模式 A 的最小形态。")])]),l("h2",{id:"_1-形态",tabindex:"-1"},[e("1. 形态 "),l("a",{class:"header-anchor",href:"#_1-形态","aria-label":'Permalink to "1. 形态"'},"​")]),l("div",{class:"language-text vp-adaptive-theme"},[l("button",{title:"Copy Code",class:"copy"}),l("span",{class:"lang"},"text"),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",null,"使用者 ──► 交互式的 Claude Code / Codex(加载 /laoshi skill)")]),e(`
2
+ `),l("span",{class:"line"},[l("span",null," │ laoshi start <需求>(引擎在后台运行,和 Paseo 上一样)")]),e(`
3
+ `),l("span",{class:"line"},[l("span",null," ▼")]),e(`
4
+ `),l("span",{class:"line"},[l("span",null," laoshi 引擎 ── 每一步 ──► claude -p … / codex exec …(一个子进程,带完整工具)")]),e(`
5
+ `),l("span",{class:"line"},[l("span",null," │ │ 标准输出是事件流(JSONL):会话 ID、工具调用、用量、结果")]),e(`
6
+ `),l("span",{class:"line"},[l("span",null," ▼ ▼")]),e(`
7
+ `),l("span",{class:"line"},[l("span",null," 结果文件、质量门、写回状态 → 下一步 …… → 需要人决定或做完:通知(日志、外部通知模块)")])])])]),l("p",null,'和摸高适配器一样,"步骤 agent"是一次命令行运行,追问、续接用同一个会话;不同的是这里没有平台:没有对话可以发消息,没有审批界面,没有定时任务。'),l("h2",{id:"_2-映射",tabindex:"-1"},[e("2. 映射 "),l("a",{class:"header-anchor",href:"#_2-映射","aria-label":'Permalink to "2. 映射"'},"​")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"laoshi 需要"),l("th",null,"命令行上怎么做")])]),l("tbody",null,[l("tr",null,[l("td",null,[l("code",null,"startAgent")]),l("td",null,[e("按角色的 "),l("code",null,"provider"),e("("),l("code",null,"claude/<模型>"),e("、"),l("code",null,"codex/<模型>"),e(")选命令行,在步骤目录起一个子进程;提示词从标准输入传入(不受命令行参数长度限制)")])]),l("tr",null,[l("td",null,[l("code",null,"wait")]),l("td",null,[e("等子进程结束,读它的事件流:正常结束 → "),l("code",null,"idle"),e("(带最后一条回复和用量);出错 → "),l("code",null,"error"),e(";超过单次运行上限 → 结束进程,"),l("code",null,"error")])]),l("tr",null,[l("td",null,[l("code",null,"followUp"),e(" / "),l("code",null,"interruptAgent")]),l("td",null,[e("用会话 ID 续接:"),l("code",null,"claude -p --resume <id>"),e("、"),l("code",null,"codex exec resume <id>"),e(";打断时先结束正在运行的进程")])]),l("tr",null,[l("td",null,[l("code",null,"attachAgent")]),l("td",null,[e("每个 agent 的记录在 "),l("code",null,"<安装根>/cli/agents/<id>/"),e("("),l("code",null,"agent.json"),e("、提示词、每次运行的输出),另一个引擎进程也能接上")])]),l("tr",null,[l("td",null,"运行被意外打断(机器重启、进程被杀)"),l("td",null,"进程不在了又没有结果:用会话续接,让它接着做(最多两次),不重做整步")]),l("tr",null,[l("td",null,[l("code",null,"recentActivity"),e("、"),l("code",null,"runningTool"),e("、"),l("code",null,"toolCalls")]),l("td",null,[e("事件流里的工具调用(Claude 的 "),l("code",null,"tool_use"),e(" / "),l("code",null,"tool_result"),e(",Codex 的 "),l("code",null,"command_execution"),e("),写日志前脱敏;危险命令拦截照常工作")])]),l("tr",null,[l("td",null,"用量"),l("td",null,"事件流最后的用量(输入、缓存命中、输出 token,Claude 另有费用)")]),l("tr",null,[l("td",null,[l("code",null,"providerStatus"),e("、体检")]),l("td",null,[l("code",null,"<命令> --version"),e(" 能运行即为可用")])]),l("tr",null,[l("td",null,"审批"),l("td",null,[e("命令行的非交互模式不会停下来问人:由角色的 "),l("code",null,"modeId"),e(" 决定权限(见第 3 节),laoshi 的危险命令拦截兜底")])]),l("tr",null,[l("td",null,[l("code",null,"notifyAgent"),e("(进展发回对话)")]),l("td",null,[e("没有对话:通知写进流水线日志,并照常发给外部通知模块("),l("a",{href:"./../contracts/notifier-event"},"notifier-event"),e(");使用者用 "),l("code",null,"laoshi status"),e(" 看进展。设置了 "),l("code",null,"LAOSHI_CLI_ORIGIN"),e(" 时,通知还写进 "),l("code",null,"<安装根>/cli/messages.log")])]),l("tr",null,[l("td",null,[e("定时("),l("code",null,"scheduleMessage"),e(" 等)")]),l("td",null,[e("none("),l("a",{href:"./builtin-capabilities"},"内置调度"),e("已设计未实现,实现后由它提供)")])]),l("tr",null,[l("td",null,"工作区、服务"),l("td",null,[e("builtin("),l("code",null,"git worktree"),e("、"),l("code",null,".laoshi/services.json"),e("),和 dsh、摸高一样")])]),l("tr",null,[l("td",null,"发起的对话"),l("td",null,[e("没有:命令行不提供会话 ID;"),l("code",null,"LAOSHI_CLI_ORIGIN"),e('(任意值)可以当作"对话",让通知写进 '),l("code",null,"messages.log")])])])]),l("h2",{id:"_3-权限",tabindex:"-1"},[e("3. 权限 "),l("a",{class:"header-anchor",href:"#_3-权限","aria-label":'Permalink to "3. 权限"'},"​")]),l("p",null,[e("非交互模式下,命令行遇到没有许可的操作只会拒绝,不会等人。所以每个角色要在配置里写一个不会卡住的权限模式,和 Paseo 上的写法相同("),l("code",null,"modeId"),e("):")]),l("table",{tabindex:"0"},[l("thead",null,[l("tr",null,[l("th",null,"命令行"),l("th",null,[l("code",null,"modeId")]),l("th",null,"传给命令行")])]),l("tbody",null,[l("tr",null,[l("td",null,"Claude Code"),l("td",null,[e("默认 "),l("code",null,"bypassPermissions"),e(";也可以写 "),l("code",null,"acceptEdits"),e("、"),l("code",null,"default"),e("、"),l("code",null,"plan")]),l("td",null,[l("code",null,"--permission-mode <modeId>")])]),l("tr",null,[l("td",null,"Codex"),l("td",null,[e("默认 "),l("code",null,"full-access")]),l("td",null,[l("code",null,"full-access"),e(" → "),l("code",null,"--dangerously-bypass-approvals-and-sandbox"),e(";"),l("code",null,"auto"),e(" → "),l("code",null,"--full-auto"),e(";"),l("code",null,"read-only"),e(" → "),l("code",null,"--sandbox read-only")])])])]),l("p",null,'用"不问人"的模式时,安全靠三层:步骤提示词的约束、laoshi 的危险命令拦截(读事件流里的工具调用,命中就打断这一步)、git 工作区(改动都在分支上,可以丢弃)。在共享或含机密的机器上,应该改用更严格的模式,并接受某些步骤因为权限不够而失败。'),l("h2",{id:"_4-配置",tabindex:"-1"},[e("4. 配置 "),l("a",{class:"header-anchor",href:"#_4-配置","aria-label":'Permalink to "4. 配置"'},"​")]),l("p",null,"安装级配置:"),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"}},"{")]),e(`
8
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "platform"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"adapter"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"cli"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"cli"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"claude"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"claude"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"codex"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"codex"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"runTimeoutMinutes"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},"120"),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," } },")]),e(`
9
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "agents"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": {")]),e(`
10
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "builder"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"provider"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"claude/default"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"modeId"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"bypassPermissions"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," },")]),e(`
11
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},' "reviewer"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": { "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"provider"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"codex/default"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},", "),l("span",{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"}},'"modeId"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},": "),l("span",{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}},'"full-access"'),l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," }")]),e(`
12
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}}," }")]),e(`
13
+ `),l("span",{class:"line"},[l("span",{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"}},"}")])])])]),l("ul",null,[l("li",null,[e("模型写 "),l("code",null,"default"),e(" 时不传模型参数,用命令行自己的默认模型。")]),l("li",null,'只装了一种命令行时,两个角色都用它;评审的独立性靠"新会话、不带实现上下文"保证。'),l("li",null,[l("code",null,"platform.cli.<命令行>"),e(" 写命令的路径(不在 "),l("code",null,"PATH"),e(" 中时);测试用环境变量 "),l("code",null,"LAOSHI_CLI_CLAUDE"),e("、"),l("code",null,"LAOSHI_CLI_CODEX"),e(" 覆盖。")])]),l("h2",{id:"_5-安装",tabindex:"-1"},[e("5. 安装 "),l("a",{class:"header-anchor",href:"#_5-安装","aria-label":'Permalink to "5. 安装"'},"​")]),l("p",null,[l("code",null,"laoshi install --platform cli"),e(":写安装级配置;skill 装到 "),l("code",null,"~/.agents/skills"),e("(Codex 等读取),有 "),l("code",null,"~/.claude"),e(" 时还有 "),l("code",null,"~/.claude/skills"),e(",和 Paseo 相同。之后在交互式的 Claude Code 或 Codex 里用 "),l("code",null,"/laoshi"),e("。入口 skill 里命令行特有的一节("),l("code",null,"adapters/cli/skill/setup.md"),e(")告诉对话:步骤不在子 agent 列表里、不会收到通知,用户问进展时运行状态命令。")]),l("h2",{id:"_6-还没有做",tabindex:"-1"},[e("6. 还没有做 "),l("a",{class:"header-anchor",href:"#_6-还没有做","aria-label":'Permalink to "6. 还没有做"'},"​")]),l("ul",null,[l("li",null,[l("strong",null,"真实命令行上的验证"),e(":事件流的字段按两个命令行公开的 JSON 输出格式解析,测试用假的命令行("),l("code",null,"adapters/cli/test/fake-agent.mjs"),e(')。M3 的完成标准是"在只有编码 agent 命令行的机器上跑通一个 '),l("code",null,"evals/"),e(' 用例,夸大为零",要在有账号的机器上跑。')]),l("li",null,[l("strong",null,"OpenCode、Pi"),e(":先做 Claude Code 和 Codex;其他命令行按同样的方式加一个驱动。")]),l("li",null,[l("strong",null,"定时"),e(":等内置调度实现。")])])],-1),l("p",{class:"source-note"},[e("本页由仓库中的 "),l("a",{href:"https://github.com/yiyisf/laoshi/blob/main/docs/design/cli-adapter.md"},"docs/design/cli-adapter.md"),e(" 生成。"),l("a",{href:"https://github.com/yiyisf/laoshi/edit/main/docs/design/cli-adapter.md"},"在 GitHub 上编辑")],-1)])])}const E=s(t,[["render",d]]);export{p as __pageData,E as default};