@fantasticit/sumi 0.13.0 → 0.14.1

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 (458) hide show
  1. package/README.md +7 -7
  2. package/dist/adapters.d.ts +3 -27
  3. package/dist/adapters.js +75 -134
  4. package/dist/adapters.js.map +1 -1
  5. package/dist/agent-hooks.d.ts +32 -11
  6. package/dist/agent-hooks.js +546 -194
  7. package/dist/agent-hooks.js.map +1 -1
  8. package/dist/agents.d.ts +1 -3
  9. package/dist/agents.js +12 -15
  10. package/dist/agents.js.map +1 -1
  11. package/dist/bin.js +14 -10
  12. package/dist/bin.js.map +1 -1
  13. package/dist/cli.d.ts +1 -1
  14. package/dist/cli.js +135 -7
  15. package/dist/cli.js.map +1 -1
  16. package/dist/compaction-marker.d.ts +4 -0
  17. package/dist/compaction-marker.js +37 -0
  18. package/dist/compaction-marker.js.map +1 -0
  19. package/dist/config-text.d.ts +1 -1
  20. package/dist/config-text.js +21 -13
  21. package/dist/config-text.js.map +1 -1
  22. package/dist/constraint-list.js +1 -1
  23. package/dist/constraint-list.js.map +1 -1
  24. package/dist/context-providers.js +12 -0
  25. package/dist/context-providers.js.map +1 -0
  26. package/dist/context.js +49 -51
  27. package/dist/context.js.map +1 -1
  28. package/dist/declared-hooks.d.ts +29 -0
  29. package/dist/declared-hooks.js +99 -0
  30. package/dist/declared-hooks.js.map +1 -0
  31. package/dist/hook-output.d.ts +3 -0
  32. package/dist/hook-output.js +5 -0
  33. package/dist/hook-output.js.map +1 -0
  34. package/dist/hook-routing.d.ts +29 -1
  35. package/dist/hook-routing.js +106 -15
  36. package/dist/hook-routing.js.map +1 -1
  37. package/dist/host-adapters.d.ts +32 -0
  38. package/dist/host-adapters.js +97 -0
  39. package/dist/host-adapters.js.map +1 -0
  40. package/dist/instructions.js +7 -5
  41. package/dist/instructions.js.map +1 -1
  42. package/dist/launcher.cjs +350 -158
  43. package/dist/launcher.js +13 -2
  44. package/dist/launcher.js.map +1 -1
  45. package/dist/run-stats.d.ts +6 -0
  46. package/dist/run-stats.js +44 -3
  47. package/dist/run-stats.js.map +1 -1
  48. package/dist/scaffold-commands.js +18 -7
  49. package/dist/scaffold-commands.js.map +1 -1
  50. package/dist/stop-hint.d.ts +4 -0
  51. package/dist/stop-hint.js +29 -0
  52. package/dist/stop-hint.js.map +1 -0
  53. package/dist/subagent-history.d.ts +2 -0
  54. package/dist/subagent-history.js +35 -0
  55. package/dist/subagent-history.js.map +1 -0
  56. package/dist/task.js +45 -37
  57. package/dist/task.js.map +1 -1
  58. package/dist/vendor.js +10 -4
  59. package/dist/vendor.js.map +1 -1
  60. package/dist/visualize-page.js +2 -25
  61. package/dist/visualize-page.js.map +1 -1
  62. package/node_modules/@sumi/create/dist/scaffold.js +5 -4
  63. package/node_modules/@sumi/create/dist/scaffold.js.map +1 -1
  64. package/node_modules/@sumi/create/package.json +2 -2
  65. package/node_modules/@sumi/create/template/AGENTS.md +1 -1
  66. package/node_modules/@sumi/create/template/control/config.yaml +3 -0
  67. package/node_modules/@sumi/create/template/control/flows/change.flow.yaml +8 -5
  68. package/node_modules/@sumi/create/template/control/flows/check.flow.yaml +7 -21
  69. package/node_modules/@sumi/create/template/control/rubrics/behavior.yaml +14 -1
  70. package/node_modules/@sumi/create/template/control/rubrics/omission.yaml +1 -1
  71. package/node_modules/@sumi/create/template/control/rubrics/{clean-code.yaml → quality.yaml} +12 -4
  72. package/node_modules/@sumi/create/template/control/rules/boundaries.md +25 -0
  73. package/node_modules/@sumi/create/template/control/rules/codecheck.md +1 -1
  74. package/node_modules/@sumi/create/template/control/rules/development.md +7 -2
  75. package/node_modules/@sumi/create/template/init/AGENTS.md +1 -1
  76. package/node_modules/@sumi/create/template/init/control/flows/change.flow.yaml +7 -4
  77. package/node_modules/@sumi/create/template/init/control/flows/check.flow.yaml +3 -0
  78. package/node_modules/@sumi/create/template/init/control/rubrics/behavior.yaml +30 -0
  79. package/node_modules/@sumi/create/template/init/control/rubrics/omission.yaml +13 -0
  80. package/node_modules/@sumi/create/template/init/control/rubrics/quality.yaml +22 -0
  81. package/node_modules/@sumi/create/template/init/control/rubrics/security.yaml +20 -0
  82. package/node_modules/@sumi/create/template/init/openspec/config.yaml +6 -0
  83. package/node_modules/@sumi/create/template/openspec/config.yaml +6 -0
  84. package/node_modules/@sumi/kernel/dist/config.d.ts +19 -0
  85. package/node_modules/@sumi/kernel/dist/config.js +72 -17
  86. package/node_modules/@sumi/kernel/dist/config.js.map +1 -1
  87. package/node_modules/@sumi/kernel/dist/context-providers.d.ts +17 -0
  88. package/node_modules/@sumi/kernel/dist/context-providers.js +74 -0
  89. package/node_modules/@sumi/kernel/dist/context-providers.js.map +1 -0
  90. package/node_modules/@sumi/kernel/dist/engine.js +119 -71
  91. package/node_modules/@sumi/kernel/dist/engine.js.map +1 -1
  92. package/node_modules/@sumi/kernel/dist/flow.d.ts +7 -0
  93. package/node_modules/@sumi/kernel/dist/flow.js +16 -0
  94. package/node_modules/@sumi/kernel/dist/flow.js.map +1 -1
  95. package/node_modules/@sumi/kernel/dist/index.d.ts +3 -0
  96. package/node_modules/@sumi/kernel/dist/index.js +3 -0
  97. package/node_modules/@sumi/kernel/dist/index.js.map +1 -1
  98. package/node_modules/@sumi/kernel/dist/plan.d.ts +12 -0
  99. package/node_modules/@sumi/kernel/dist/plan.js.map +1 -1
  100. package/node_modules/@sumi/kernel/dist/record.d.ts +10 -1
  101. package/node_modules/@sumi/kernel/dist/record.js +133 -3
  102. package/node_modules/@sumi/kernel/dist/record.js.map +1 -1
  103. package/node_modules/@sumi/kernel/dist/resume.d.ts +3 -1
  104. package/node_modules/@sumi/kernel/dist/resume.js +35 -27
  105. package/node_modules/@sumi/kernel/dist/resume.js.map +1 -1
  106. package/node_modules/@sumi/kernel/dist/runtime.d.ts +2 -0
  107. package/node_modules/@sumi/kernel/dist/runtime.js +30 -0
  108. package/node_modules/@sumi/kernel/dist/runtime.js.map +1 -0
  109. package/node_modules/@sumi/kernel/dist/scope.d.ts +2 -1
  110. package/node_modules/@sumi/kernel/dist/scope.js +2 -2
  111. package/node_modules/@sumi/kernel/dist/scope.js.map +1 -1
  112. package/node_modules/@sumi/kernel/dist/source-monitor.d.ts +20 -0
  113. package/node_modules/@sumi/kernel/dist/source-monitor.js +105 -0
  114. package/node_modules/@sumi/kernel/dist/source-monitor.js.map +1 -0
  115. package/node_modules/@sumi/kernel/dist/step-cache.d.ts +1 -1
  116. package/node_modules/@sumi/kernel/dist/step-cache.js +62 -51
  117. package/node_modules/@sumi/kernel/dist/step-cache.js.map +1 -1
  118. package/node_modules/@sumi/kernel/dist/step.d.ts +61 -0
  119. package/node_modules/@sumi/kernel/dist/step.js +55 -0
  120. package/node_modules/@sumi/kernel/dist/step.js.map +1 -0
  121. package/node_modules/@sumi/kernel/package.json +6 -2
  122. package/node_modules/@sumi/plugin-sdk/README.md +3 -3
  123. package/node_modules/@sumi/plugin-sdk/dist/context-delivery.d.ts +15 -0
  124. package/node_modules/@sumi/plugin-sdk/dist/context-delivery.js +28 -0
  125. package/node_modules/@sumi/plugin-sdk/dist/context-delivery.js.map +1 -0
  126. package/node_modules/@sumi/plugin-sdk/dist/context-scope.d.ts +2 -0
  127. package/node_modules/@sumi/plugin-sdk/dist/context-scope.js +49 -0
  128. package/node_modules/@sumi/plugin-sdk/dist/context-scope.js.map +1 -0
  129. package/node_modules/@sumi/plugin-sdk/dist/edit-paths.d.ts +2 -0
  130. package/node_modules/@sumi/plugin-sdk/dist/edit-paths.js +54 -0
  131. package/node_modules/@sumi/plugin-sdk/dist/edit-paths.js.map +1 -0
  132. package/node_modules/@sumi/plugin-sdk/dist/files.d.ts +1 -1
  133. package/node_modules/@sumi/plugin-sdk/dist/files.js +64 -13
  134. package/node_modules/@sumi/plugin-sdk/dist/files.js.map +1 -1
  135. package/node_modules/@sumi/plugin-sdk/dist/host-event.d.ts +9 -2
  136. package/node_modules/@sumi/plugin-sdk/dist/host-event.js +41 -16
  137. package/node_modules/@sumi/plugin-sdk/dist/host-event.js.map +1 -1
  138. package/node_modules/@sumi/plugin-sdk/dist/html-page.d.ts +5 -0
  139. package/node_modules/@sumi/plugin-sdk/dist/html-page.js +93 -0
  140. package/node_modules/@sumi/plugin-sdk/dist/html-page.js.map +1 -0
  141. package/node_modules/@sumi/plugin-sdk/dist/html-style.d.ts +1 -0
  142. package/node_modules/@sumi/plugin-sdk/dist/html-style.js +27 -0
  143. package/node_modules/@sumi/plugin-sdk/dist/html-style.js.map +1 -0
  144. package/node_modules/@sumi/plugin-sdk/dist/index.d.ts +7 -0
  145. package/node_modules/@sumi/plugin-sdk/dist/index.js +7 -0
  146. package/node_modules/@sumi/plugin-sdk/dist/index.js.map +1 -1
  147. package/node_modules/@sumi/plugin-sdk/dist/permissions.d.ts +7 -0
  148. package/node_modules/@sumi/plugin-sdk/dist/permissions.js +41 -0
  149. package/node_modules/@sumi/plugin-sdk/dist/permissions.js.map +1 -0
  150. package/node_modules/@sumi/plugin-sdk/dist/project.d.ts +2 -0
  151. package/node_modules/@sumi/plugin-sdk/dist/project.js +2 -0
  152. package/node_modules/@sumi/plugin-sdk/dist/project.js.map +1 -1
  153. package/node_modules/@sumi/plugin-sdk/dist/protocol.d.ts +39 -4
  154. package/node_modules/@sumi/plugin-sdk/dist/protocol.js +12 -4
  155. package/node_modules/@sumi/plugin-sdk/dist/protocol.js.map +1 -1
  156. package/node_modules/@sumi/plugin-sdk/dist/sdk.js +3 -1
  157. package/node_modules/@sumi/plugin-sdk/dist/sdk.js.map +1 -1
  158. package/node_modules/@sumi/plugin-sdk/dist/session-context.d.ts +26 -1
  159. package/node_modules/@sumi/plugin-sdk/dist/session-context.js +98 -17
  160. package/node_modules/@sumi/plugin-sdk/dist/session-context.js.map +1 -1
  161. package/node_modules/@sumi/plugin-sdk/dist/shell.js +2 -1
  162. package/node_modules/@sumi/plugin-sdk/dist/shell.js.map +1 -1
  163. package/node_modules/@sumi/plugin-sdk/dist/snapshot.d.ts +12 -0
  164. package/node_modules/@sumi/plugin-sdk/dist/snapshot.js +29 -5
  165. package/node_modules/@sumi/plugin-sdk/dist/snapshot.js.map +1 -1
  166. package/node_modules/@sumi/plugin-sdk/dist/trace.d.ts +7 -2
  167. package/node_modules/@sumi/plugin-sdk/dist/trace.js +21 -1
  168. package/node_modules/@sumi/plugin-sdk/dist/trace.js.map +1 -1
  169. package/node_modules/@sumi/plugin-sdk/dist/validate.js +25 -1
  170. package/node_modules/@sumi/plugin-sdk/dist/validate.js.map +1 -1
  171. package/node_modules/@sumi/plugin-sdk/dist/yaml-text.d.ts +7 -0
  172. package/node_modules/@sumi/plugin-sdk/dist/yaml-text.js +116 -0
  173. package/node_modules/@sumi/plugin-sdk/dist/yaml-text.js.map +1 -0
  174. package/node_modules/@sumi/plugin-sdk/package.json +3 -2
  175. package/node_modules/@sumi/plugins-core/dist/agent-rules.js +2 -2
  176. package/node_modules/@sumi/plugins-core/dist/agent-rules.js.map +1 -1
  177. package/node_modules/@sumi/plugins-core/dist/commands/adopt.js +7 -5
  178. package/node_modules/@sumi/plugins-core/dist/commands/adopt.js.map +1 -1
  179. package/node_modules/@sumi/plugins-core/dist/commands/context-impact.js +9 -21
  180. package/node_modules/@sumi/plugins-core/dist/commands/context-impact.js.map +1 -1
  181. package/node_modules/@sumi/plugins-core/dist/context-provider.d.ts +3 -0
  182. package/node_modules/@sumi/plugins-core/dist/context-provider.js +45 -0
  183. package/node_modules/@sumi/plugins-core/dist/context-provider.js.map +1 -0
  184. package/node_modules/@sumi/plugins-core/dist/plugins/coverage.js +110 -15
  185. package/node_modules/@sumi/plugins-core/dist/plugins/coverage.js.map +1 -1
  186. package/node_modules/@sumi/plugins-core/dist/plugins/test-affected.js +32 -5
  187. package/node_modules/@sumi/plugins-core/dist/plugins/test-affected.js.map +1 -1
  188. package/node_modules/@sumi/plugins-core/dist/vitest-runner.js +1 -0
  189. package/node_modules/@sumi/plugins-core/dist/vitest-runner.js.map +1 -1
  190. package/node_modules/@sumi/plugins-core/instructions/bugfix.md +4 -0
  191. package/node_modules/@sumi/plugins-core/instructions/feature.md +2 -0
  192. package/node_modules/@sumi/plugins-core/package.json +2 -2
  193. package/node_modules/@sumi/plugins-core/sumi-plugins.yaml +1 -0
  194. package/node_modules/@sumi/plugins-governance/assets/hook-bootstrap.cjs +195 -0
  195. package/node_modules/@sumi/plugins-governance/dist/boundary-hooks.d.ts +12 -0
  196. package/node_modules/@sumi/plugins-governance/dist/boundary-hooks.js +76 -0
  197. package/node_modules/@sumi/plugins-governance/dist/boundary-hooks.js.map +1 -0
  198. package/node_modules/@sumi/plugins-governance/dist/boundary.d.ts +42 -0
  199. package/node_modules/@sumi/plugins-governance/dist/boundary.js +206 -0
  200. package/node_modules/@sumi/plugins-governance/dist/boundary.js.map +1 -0
  201. package/node_modules/@sumi/plugins-governance/dist/checkout.d.ts +1 -0
  202. package/node_modules/@sumi/plugins-governance/dist/checkout.js +16 -6
  203. package/node_modules/@sumi/plugins-governance/dist/checkout.js.map +1 -1
  204. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-after-edit.js +14 -0
  205. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-after-edit.js.map +1 -0
  206. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-before-edit.js +22 -0
  207. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-before-edit.js.map +1 -0
  208. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-prompt.js +12 -0
  209. package/node_modules/@sumi/plugins-governance/dist/commands/boundary-prompt.js.map +1 -0
  210. package/node_modules/@sumi/plugins-governance/dist/commands/boundary.d.ts +1 -0
  211. package/node_modules/@sumi/plugins-governance/dist/commands/boundary.js +48 -0
  212. package/node_modules/@sumi/plugins-governance/dist/commands/boundary.js.map +1 -0
  213. package/node_modules/@sumi/plugins-governance/dist/commands/context-state.d.ts +1 -0
  214. package/node_modules/@sumi/plugins-governance/dist/commands/context-state.js +4 -0
  215. package/node_modules/@sumi/plugins-governance/dist/commands/context-state.js.map +1 -0
  216. package/node_modules/@sumi/plugins-governance/dist/commands/gate.js +168 -24
  217. package/node_modules/@sumi/plugins-governance/dist/commands/gate.js.map +1 -1
  218. package/node_modules/@sumi/plugins-governance/dist/commands/pr-report-check.js +5 -2
  219. package/node_modules/@sumi/plugins-governance/dist/commands/pr-report-check.js.map +1 -1
  220. package/node_modules/@sumi/plugins-governance/dist/commands/pr-report.js +5 -1
  221. package/node_modules/@sumi/plugins-governance/dist/commands/pr-report.js.map +1 -1
  222. package/node_modules/@sumi/plugins-governance/dist/commands/resume-work.d.ts +1 -0
  223. package/node_modules/@sumi/plugins-governance/dist/commands/resume-work.js +6 -0
  224. package/node_modules/@sumi/plugins-governance/dist/commands/resume-work.js.map +1 -0
  225. package/node_modules/@sumi/plugins-governance/dist/commands/run-policy.d.ts +1 -0
  226. package/node_modules/@sumi/plugins-governance/dist/commands/run-policy.js +19 -0
  227. package/node_modules/@sumi/plugins-governance/dist/commands/run-policy.js.map +1 -0
  228. package/node_modules/@sumi/plugins-governance/dist/commands/stop-work.d.ts +1 -0
  229. package/node_modules/@sumi/plugins-governance/dist/commands/stop-work.js +12 -0
  230. package/node_modules/@sumi/plugins-governance/dist/commands/stop-work.js.map +1 -0
  231. package/node_modules/@sumi/plugins-governance/dist/commands/view.d.ts +1 -0
  232. package/node_modules/@sumi/plugins-governance/dist/commands/view.js +45 -0
  233. package/node_modules/@sumi/plugins-governance/dist/commands/view.js.map +1 -0
  234. package/node_modules/@sumi/plugins-governance/dist/config-recovery.d.ts +2 -0
  235. package/node_modules/@sumi/plugins-governance/dist/config-recovery.js +15 -0
  236. package/node_modules/@sumi/plugins-governance/dist/config-recovery.js.map +1 -0
  237. package/node_modules/@sumi/plugins-governance/dist/context-provider.d.ts +2 -0
  238. package/node_modules/@sumi/plugins-governance/dist/context-provider.js +22 -0
  239. package/node_modules/@sumi/plugins-governance/dist/context-provider.js.map +1 -0
  240. package/node_modules/@sumi/plugins-governance/dist/gate-cache.js +10 -2
  241. package/node_modules/@sumi/plugins-governance/dist/gate-cache.js.map +1 -1
  242. package/node_modules/@sumi/plugins-governance/dist/guard.js +4 -4
  243. package/node_modules/@sumi/plugins-governance/dist/guard.js.map +1 -1
  244. package/node_modules/@sumi/plugins-governance/dist/human-stop.d.ts +4 -0
  245. package/node_modules/@sumi/plugins-governance/dist/human-stop.js +39 -0
  246. package/node_modules/@sumi/plugins-governance/dist/human-stop.js.map +1 -0
  247. package/node_modules/@sumi/plugins-governance/dist/index.d.ts +5 -1
  248. package/node_modules/@sumi/plugins-governance/dist/index.js +5 -1
  249. package/node_modules/@sumi/plugins-governance/dist/index.js.map +1 -1
  250. package/node_modules/@sumi/plugins-governance/dist/plugins/state-writable.d.ts +1 -0
  251. package/node_modules/@sumi/plugins-governance/dist/plugins/state-writable.js +4 -0
  252. package/node_modules/@sumi/plugins-governance/dist/plugins/state-writable.js.map +1 -0
  253. package/node_modules/@sumi/plugins-governance/dist/pr-report-compose.d.ts +1 -1
  254. package/node_modules/@sumi/plugins-governance/dist/pr-report-compose.js +2 -1
  255. package/node_modules/@sumi/plugins-governance/dist/pr-report-compose.js.map +1 -1
  256. package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.d.ts +1 -0
  257. package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.js +1 -0
  258. package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.js.map +1 -1
  259. package/node_modules/@sumi/plugins-governance/dist/pr-report-sections.js +4 -1
  260. package/node_modules/@sumi/plugins-governance/dist/pr-report-sections.js.map +1 -1
  261. package/node_modules/@sumi/plugins-governance/dist/pr-report-status.d.ts +1 -1
  262. package/node_modules/@sumi/plugins-governance/dist/pr-report-status.js +22 -3
  263. package/node_modules/@sumi/plugins-governance/dist/pr-report-status.js.map +1 -1
  264. package/node_modules/@sumi/plugins-governance/dist/preflight.d.ts +18 -0
  265. package/node_modules/@sumi/plugins-governance/dist/preflight.js +120 -0
  266. package/node_modules/@sumi/plugins-governance/dist/preflight.js.map +1 -0
  267. package/node_modules/@sumi/plugins-governance/dist/protected.d.ts +1 -0
  268. package/node_modules/@sumi/plugins-governance/dist/protected.js +1 -0
  269. package/node_modules/@sumi/plugins-governance/dist/protected.js.map +1 -1
  270. package/node_modules/@sumi/plugins-governance/dist/report-view.d.ts +12 -0
  271. package/node_modules/@sumi/plugins-governance/dist/report-view.js +59 -0
  272. package/node_modules/@sumi/plugins-governance/dist/report-view.js.map +1 -0
  273. package/node_modules/@sumi/plugins-governance/dist/state-access.d.ts +3 -0
  274. package/node_modules/@sumi/plugins-governance/dist/state-access.js +35 -0
  275. package/node_modules/@sumi/plugins-governance/dist/state-access.js.map +1 -0
  276. package/node_modules/@sumi/plugins-governance/dist/state.js +1 -4
  277. package/node_modules/@sumi/plugins-governance/dist/state.js.map +1 -1
  278. package/node_modules/@sumi/plugins-governance/dist/upgrade-command.d.ts +1 -0
  279. package/node_modules/@sumi/plugins-governance/dist/upgrade-command.js +30 -0
  280. package/node_modules/@sumi/plugins-governance/dist/upgrade-command.js.map +1 -0
  281. package/node_modules/@sumi/plugins-governance/dist/view-page.d.ts +4 -0
  282. package/node_modules/@sumi/plugins-governance/dist/view-page.js +51 -0
  283. package/node_modules/@sumi/plugins-governance/dist/view-page.js.map +1 -0
  284. package/node_modules/@sumi/plugins-governance/instructions/boundary.md +35 -0
  285. package/node_modules/@sumi/plugins-governance/instructions/push.md +11 -8
  286. package/node_modules/@sumi/plugins-governance/package.json +6 -3
  287. package/node_modules/@sumi/plugins-governance/sumi-plugins.yaml +30 -1
  288. package/node_modules/@sumi/plugins-openspec/package.json +4 -4
  289. package/node_modules/@sumi/plugins-precedent/README.md +6 -4
  290. package/node_modules/@sumi/plugins-precedent/dist/after-edit-context.d.ts +6 -23
  291. package/node_modules/@sumi/plugins-precedent/dist/after-edit-context.js +48 -156
  292. package/node_modules/@sumi/plugins-precedent/dist/after-edit-context.js.map +1 -1
  293. package/node_modules/@sumi/plugins-precedent/dist/commands/before-edit-context.js +16 -13
  294. package/node_modules/@sumi/plugins-precedent/dist/commands/before-edit-context.js.map +1 -1
  295. package/node_modules/@sumi/plugins-precedent/dist/commands/context.js +3 -44
  296. package/node_modules/@sumi/plugins-precedent/dist/commands/context.js.map +1 -1
  297. package/node_modules/@sumi/plugins-precedent/dist/commands/impact-submit.js +2 -1
  298. package/node_modules/@sumi/plugins-precedent/dist/commands/impact-submit.js.map +1 -1
  299. package/node_modules/@sumi/plugins-precedent/dist/context-output.d.ts +65 -0
  300. package/node_modules/@sumi/plugins-precedent/dist/context-output.js +186 -0
  301. package/node_modules/@sumi/plugins-precedent/dist/context-output.js.map +1 -0
  302. package/node_modules/@sumi/plugins-precedent/dist/context-provider.d.ts +3 -0
  303. package/node_modules/@sumi/plugins-precedent/dist/context-provider.js +48 -0
  304. package/node_modules/@sumi/plugins-precedent/dist/context-provider.js.map +1 -0
  305. package/node_modules/@sumi/plugins-precedent/dist/impact-state.js +4 -6
  306. package/node_modules/@sumi/plugins-precedent/dist/impact-state.js.map +1 -1
  307. package/node_modules/@sumi/plugins-precedent/dist/impact.js +1 -2
  308. package/node_modules/@sumi/plugins-precedent/dist/impact.js.map +1 -1
  309. package/node_modules/@sumi/plugins-precedent/dist/index.d.ts +1 -0
  310. package/node_modules/@sumi/plugins-precedent/dist/index.js +1 -0
  311. package/node_modules/@sumi/plugins-precedent/dist/index.js.map +1 -1
  312. package/node_modules/@sumi/plugins-precedent/dist/model.d.ts +1 -0
  313. package/node_modules/@sumi/plugins-precedent/dist/model.js.map +1 -1
  314. package/node_modules/@sumi/plugins-precedent/dist/plugins/context-read.js +2 -1
  315. package/node_modules/@sumi/plugins-precedent/dist/plugins/context-read.js.map +1 -1
  316. package/node_modules/@sumi/plugins-precedent/package.json +3 -3
  317. package/node_modules/@sumi/plugins-precedent/sumi-plugins.yaml +3 -2
  318. package/node_modules/@sumi/plugins-review/README.md +17 -4
  319. package/node_modules/@sumi/plugins-review/dist/batch-request.d.ts +22 -0
  320. package/node_modules/@sumi/plugins-review/dist/batch-request.js +30 -0
  321. package/node_modules/@sumi/plugins-review/dist/batch-request.js.map +1 -0
  322. package/node_modules/@sumi/plugins-review/dist/claude-review-agent.d.ts +8 -0
  323. package/node_modules/@sumi/plugins-review/dist/claude-review-agent.js +51 -0
  324. package/node_modules/@sumi/plugins-review/dist/claude-review-agent.js.map +1 -0
  325. package/node_modules/@sumi/plugins-review/dist/command-hint.d.ts +7 -0
  326. package/node_modules/@sumi/plugins-review/dist/command-hint.js +21 -0
  327. package/node_modules/@sumi/plugins-review/dist/command-hint.js.map +1 -1
  328. package/node_modules/@sumi/plugins-review/dist/command-input.d.ts +3 -0
  329. package/node_modules/@sumi/plugins-review/dist/command-input.js +32 -0
  330. package/node_modules/@sumi/plugins-review/dist/command-input.js.map +1 -0
  331. package/node_modules/@sumi/plugins-review/dist/commands/context.js +3 -69
  332. package/node_modules/@sumi/plugins-review/dist/commands/context.js.map +1 -1
  333. package/node_modules/@sumi/plugins-review/dist/commands/host-model-hook.js +4 -3
  334. package/node_modules/@sumi/plugins-review/dist/commands/host-model-hook.js.map +1 -1
  335. package/node_modules/@sumi/plugins-review/dist/commands/model-recheck.js +37 -25
  336. package/node_modules/@sumi/plugins-review/dist/commands/model-recheck.js.map +1 -1
  337. package/node_modules/@sumi/plugins-review/dist/commands/preflight.d.ts +1 -0
  338. package/node_modules/@sumi/plugins-review/dist/commands/preflight.js +13 -0
  339. package/node_modules/@sumi/plugins-review/dist/commands/preflight.js.map +1 -0
  340. package/node_modules/@sumi/plugins-review/dist/commands/request-read.d.ts +1 -0
  341. package/node_modules/@sumi/plugins-review/dist/commands/request-read.js +6 -0
  342. package/node_modules/@sumi/plugins-review/dist/commands/request-read.js.map +1 -0
  343. package/node_modules/@sumi/plugins-review/dist/commands/review-batch.d.ts +1 -0
  344. package/node_modules/@sumi/plugins-review/dist/commands/review-batch.js +8 -0
  345. package/node_modules/@sumi/plugins-review/dist/commands/review-batch.js.map +1 -0
  346. package/node_modules/@sumi/plugins-review/dist/commands/startup-context.d.ts +1 -0
  347. package/node_modules/@sumi/plugins-review/dist/commands/startup-context.js +6 -0
  348. package/node_modules/@sumi/plugins-review/dist/commands/startup-context.js.map +1 -0
  349. package/node_modules/@sumi/plugins-review/dist/commands/stats.d.ts +1 -0
  350. package/node_modules/@sumi/plugins-review/dist/commands/stats.js +10 -0
  351. package/node_modules/@sumi/plugins-review/dist/commands/stats.js.map +1 -0
  352. package/node_modules/@sumi/plugins-review/dist/commands/submit.js +79 -32
  353. package/node_modules/@sumi/plugins-review/dist/commands/submit.js.map +1 -1
  354. package/node_modules/@sumi/plugins-review/dist/context-provider.d.ts +3 -0
  355. package/node_modules/@sumi/plugins-review/dist/context-provider.js +84 -0
  356. package/node_modules/@sumi/plugins-review/dist/context-provider.js.map +1 -0
  357. package/node_modules/@sumi/plugins-review/dist/convergence.d.ts +17 -0
  358. package/node_modules/@sumi/plugins-review/dist/convergence.js +114 -0
  359. package/node_modules/@sumi/plugins-review/dist/convergence.js.map +1 -0
  360. package/node_modules/@sumi/plugins-review/dist/cost-advice.d.ts +2 -0
  361. package/node_modules/@sumi/plugins-review/dist/cost-advice.js +35 -0
  362. package/node_modules/@sumi/plugins-review/dist/cost-advice.js.map +1 -0
  363. package/node_modules/@sumi/plugins-review/dist/dispatch.d.ts +38 -0
  364. package/node_modules/@sumi/plugins-review/dist/dispatch.js +235 -0
  365. package/node_modules/@sumi/plugins-review/dist/dispatch.js.map +1 -0
  366. package/node_modules/@sumi/plugins-review/dist/dispute.d.ts +4 -0
  367. package/node_modules/@sumi/plugins-review/dist/dispute.js +38 -4
  368. package/node_modules/@sumi/plugins-review/dist/dispute.js.map +1 -1
  369. package/node_modules/@sumi/plugins-review/dist/instructions.d.ts +1 -0
  370. package/node_modules/@sumi/plugins-review/dist/instructions.js +2 -0
  371. package/node_modules/@sumi/plugins-review/dist/instructions.js.map +1 -0
  372. package/node_modules/@sumi/plugins-review/dist/model-execution.d.ts +1 -0
  373. package/node_modules/@sumi/plugins-review/dist/model-execution.js +51 -46
  374. package/node_modules/@sumi/plugins-review/dist/model-execution.js.map +1 -1
  375. package/node_modules/@sumi/plugins-review/dist/plugins/dispatch.d.ts +1 -0
  376. package/node_modules/@sumi/plugins-review/dist/plugins/dispatch.js +41 -0
  377. package/node_modules/@sumi/plugins-review/dist/plugins/dispatch.js.map +1 -0
  378. package/node_modules/@sumi/plugins-review/dist/plugins/independent-recheck.js +62 -39
  379. package/node_modules/@sumi/plugins-review/dist/plugins/independent-recheck.js.map +1 -1
  380. package/node_modules/@sumi/plugins-review/dist/plugins/rubric.js +3 -337
  381. package/node_modules/@sumi/plugins-review/dist/plugins/rubric.js.map +1 -1
  382. package/node_modules/@sumi/plugins-review/dist/preflight.d.ts +31 -0
  383. package/node_modules/@sumi/plugins-review/dist/preflight.js +172 -0
  384. package/node_modules/@sumi/plugins-review/dist/preflight.js.map +1 -0
  385. package/node_modules/@sumi/plugins-review/dist/recheck-tickets.d.ts +26 -0
  386. package/node_modules/@sumi/plugins-review/dist/recheck-tickets.js +48 -0
  387. package/node_modules/@sumi/plugins-review/dist/recheck-tickets.js.map +1 -0
  388. package/node_modules/@sumi/plugins-review/dist/recheck.d.ts +15 -0
  389. package/node_modules/@sumi/plugins-review/dist/recheck.js +33 -16
  390. package/node_modules/@sumi/plugins-review/dist/recheck.js.map +1 -1
  391. package/node_modules/@sumi/plugins-review/dist/report.d.ts +5 -1
  392. package/node_modules/@sumi/plugins-review/dist/report.js +25 -5
  393. package/node_modules/@sumi/plugins-review/dist/report.js.map +1 -1
  394. package/node_modules/@sumi/plugins-review/dist/review-evidence.js +2 -2
  395. package/node_modules/@sumi/plugins-review/dist/review-evidence.js.map +1 -1
  396. package/node_modules/@sumi/plugins-review/dist/review.d.ts +53 -7
  397. package/node_modules/@sumi/plugins-review/dist/review.js +100 -38
  398. package/node_modules/@sumi/plugins-review/dist/review.js.map +1 -1
  399. package/node_modules/@sumi/plugins-review/dist/rubric-check.d.ts +4 -0
  400. package/node_modules/@sumi/plugins-review/dist/rubric-check.js +382 -0
  401. package/node_modules/@sumi/plugins-review/dist/rubric-check.js.map +1 -0
  402. package/node_modules/@sumi/plugins-review/dist/startup-context.d.ts +21 -0
  403. package/node_modules/@sumi/plugins-review/dist/startup-context.js +94 -0
  404. package/node_modules/@sumi/plugins-review/dist/startup-context.js.map +1 -0
  405. package/node_modules/@sumi/plugins-review/dist/stats.d.ts +19 -0
  406. package/node_modules/@sumi/plugins-review/dist/stats.js +99 -0
  407. package/node_modules/@sumi/plugins-review/dist/stats.js.map +1 -0
  408. package/node_modules/@sumi/plugins-review/dist/submission.js +34 -18
  409. package/node_modules/@sumi/plugins-review/dist/submission.js.map +1 -1
  410. package/node_modules/@sumi/plugins-review/dist/support-scope.d.ts +4 -0
  411. package/node_modules/@sumi/plugins-review/dist/support-scope.js +9 -0
  412. package/node_modules/@sumi/plugins-review/dist/support-scope.js.map +1 -0
  413. package/node_modules/@sumi/plugins-review/dist/tickets.d.ts +12 -0
  414. package/node_modules/@sumi/plugins-review/dist/tickets.js +98 -0
  415. package/node_modules/@sumi/plugins-review/dist/tickets.js.map +1 -0
  416. package/node_modules/@sumi/plugins-review/dist/upgrade-flow-plan.js +34 -9
  417. package/node_modules/@sumi/plugins-review/dist/upgrade-flow-plan.js.map +1 -1
  418. package/node_modules/@sumi/plugins-review/dist/upgrade-flow-render.js +2 -3
  419. package/node_modules/@sumi/plugins-review/dist/upgrade-flow-render.js.map +1 -1
  420. package/node_modules/@sumi/plugins-review/dist/upgrade.d.ts +2 -0
  421. package/node_modules/@sumi/plugins-review/dist/upgrade.js +12 -83
  422. package/node_modules/@sumi/plugins-review/dist/upgrade.js.map +1 -1
  423. package/node_modules/@sumi/plugins-review/package.json +6 -5
  424. package/node_modules/@sumi/plugins-review/sumi-plugins.yaml +22 -1
  425. package/package.json +10 -10
  426. package/dist/trace.d.ts +0 -16
  427. package/dist/trace.js +0 -30
  428. package/dist/trace.js.map +0 -1
  429. package/node_modules/@sumi/create/dist/bin.d.ts +0 -2
  430. package/node_modules/@sumi/create/dist/bin.js +0 -52
  431. package/node_modules/@sumi/create/dist/bin.js.map +0 -1
  432. package/node_modules/@sumi/create/template/control/rubrics/architecture.yaml +0 -15
  433. package/node_modules/@sumi/create/template/control/rubrics/business-impact.yaml +0 -6
  434. package/node_modules/@sumi/create/template/control/rubrics/device-acceptance.yaml +0 -10
  435. package/node_modules/@sumi/create/template/control/rubrics/domain.yaml +0 -9
  436. package/node_modules/@sumi/create/template/init/control/rubrics/architecture.yaml +0 -15
  437. package/node_modules/@sumi/create/template/init/control/rubrics/business-impact.yaml +0 -6
  438. package/node_modules/@sumi/plugins-core/dist/tool-batches.d.ts +0 -11
  439. package/node_modules/@sumi/plugins-core/dist/tool-batches.js +0 -41
  440. package/node_modules/@sumi/plugins-core/dist/tool-batches.js.map +0 -1
  441. package/node_modules/@sumi/plugins-governance/dist/commands/approve.js +0 -29
  442. package/node_modules/@sumi/plugins-governance/dist/commands/approve.js.map +0 -1
  443. package/node_modules/@sumi/plugins-governance/dist/commands/protected-after-shell.js +0 -20
  444. package/node_modules/@sumi/plugins-governance/dist/commands/protected-after-shell.js.map +0 -1
  445. package/node_modules/@sumi/plugins-governance/dist/commands/unlock.js +0 -23
  446. package/node_modules/@sumi/plugins-governance/dist/commands/unlock.js.map +0 -1
  447. package/node_modules/@sumi/plugins-governance/dist/hooks.d.ts +0 -2
  448. package/node_modules/@sumi/plugins-governance/dist/hooks.js +0 -4
  449. package/node_modules/@sumi/plugins-governance/dist/hooks.js.map +0 -1
  450. package/node_modules/@sumi/plugins-governance/dist/protected-shell.d.ts +0 -12
  451. package/node_modules/@sumi/plugins-governance/dist/protected-shell.js +0 -152
  452. package/node_modules/@sumi/plugins-governance/dist/protected-shell.js.map +0 -1
  453. package/node_modules/@sumi/plugins-precedent/dist/commands/session-start-context.js +0 -6
  454. package/node_modules/@sumi/plugins-precedent/dist/commands/session-start-context.js.map +0 -1
  455. /package/{node_modules/@sumi/plugins-governance/dist/commands/approve.d.ts → dist/context-providers.d.ts} +0 -0
  456. /package/node_modules/@sumi/plugins-governance/dist/commands/{protected-after-shell.d.ts → boundary-after-edit.d.ts} +0 -0
  457. /package/node_modules/@sumi/plugins-governance/dist/commands/{unlock.d.ts → boundary-before-edit.d.ts} +0 -0
  458. /package/node_modules/@sumi/{plugins-precedent/dist/commands/session-start-context.d.ts → plugins-governance/dist/commands/boundary-prompt.d.ts} +0 -0
@@ -0,0 +1,37 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { mkdirSync, unlinkSync, writeFileSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { gitCommonDir, reportPermissionFailure } from '@sumi/plugin-sdk';
5
+ function marker(root, session, agentId) {
6
+ const key = createHash('sha256')
7
+ .update(JSON.stringify([session, agentId]))
8
+ .digest('hex');
9
+ const dir = gitCommonDir(root) ?? join(root, '.sumi');
10
+ return join(dir, 'sumi', 'codex-compaction-pending', key);
11
+ }
12
+ export function markCompaction(root, session, agentId) {
13
+ try {
14
+ const file = marker(root, session, agentId);
15
+ mkdirSync(join(file, '..'), { recursive: true, mode: 0o700 });
16
+ writeFileSync(file, '1', { mode: 0o600 });
17
+ }
18
+ catch (error) {
19
+ reportPermissionFailure(error);
20
+ // 标记只是重注入提示;不可写时不影响宿主事件。
21
+ }
22
+ }
23
+ /** `unlink` 是原子领取;无法读写时返回 false,防止卡住的标记重复注入。 */
24
+ export function takeCompaction(root, session, agentId) {
25
+ try {
26
+ unlinkSync(marker(root, session, agentId));
27
+ return true;
28
+ }
29
+ catch (error) {
30
+ reportPermissionFailure(error);
31
+ return false;
32
+ }
33
+ }
34
+ export function clearCompaction(root, session, agentId) {
35
+ takeCompaction(root, session, agentId);
36
+ }
37
+ //# sourceMappingURL=compaction-marker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compaction-marker.js","sourceRoot":"","sources":["../src/compaction-marker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,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;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,uBAAuB,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,OAAe,EAAE,OAAsB;IACnF,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC"}
@@ -2,6 +2,6 @@ import { type Document } from 'yaml';
2
2
  /**
3
3
  * 把 doc 中这些顶层键的值写回 text,其他行原样保留。
4
4
  * yaml 库整文件序列化无法同时保持 `{ a: b }` 与 `[a, b]` 两种 flow 写法,会让项目的格式检查失败,所以先按行改写;
5
- * 改写结果解析出错或与 doc 的内容不一致时(如整文件写成 flow 映射),退回整文件序列化:格式可能变化,但语义正确。
5
+ * 改写结果解析出错或与 doc 的内容不一致时(如整文件写成 flow 映射),交给通用 YAML 节点保真渲染,写回前核对语义。
6
6
  */
7
7
  export declare function withTopLevelKeys(text: string, doc: Document, keys: readonly string[]): string;
@@ -1,3 +1,4 @@
1
+ import { withYamlChanges } from '@sumi/plugin-sdk';
1
2
  import { isDeepStrictEqual } from 'node:util';
2
3
  import { isScalar, parseDocument, stringify } from 'yaml';
3
4
  const escape = (key) => key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
@@ -8,21 +9,27 @@ function renderValue(node) {
8
9
  }
9
10
  /** 按行改写:已有键(可带引号)连同缩进的续行替换为单行;doc 中没有的键删除;缺少的键追加到文档末尾(`...` 之前)。 */
10
11
  function editLines(text, doc, keys) {
11
- const eol = text.includes('\r\n') ? '\r\n' : '\n';
12
- const lines = text.split(/\r?\n/);
13
- if (lines.at(-1) === '')
14
- lines.pop();
12
+ const eol = text.match(/\r?\n/)?.[0] ?? '\n';
13
+ const lines = text.split(/(?<=\n)/).filter(Boolean);
14
+ const body = (line) => line.replace(/\r?\n$/, '');
15
+ const previous = (parseDocument(text).toJS() ?? {});
16
+ const desired = doc.toJS();
15
17
  for (const key of keys) {
18
+ if (Object.hasOwn(previous, key) === doc.has(key) && isDeepStrictEqual(previous[key], desired[key]))
19
+ continue;
16
20
  const node = doc.get(key, true);
17
21
  const rendered = node === undefined ? null : `${key}: ${renderValue(node)}`;
18
22
  // 键可写成 key、"key" 或 'key'
19
23
  const keyLine = new RegExp(`^(?:${escape(key)}|"${escape(key)}"|'${escape(key)}')\\s*:`);
20
- const start = lines.findIndex((line) => keyLine.test(line));
24
+ const start = lines.findIndex((line) => keyLine.test(body(line)));
21
25
  if (start < 0) {
22
26
  if (rendered === null)
23
27
  continue;
24
- const documentEnd = lines.findIndex((line) => /^\.\.\.\s*$/.test(line));
25
- lines.splice(documentEnd < 0 ? lines.length : documentEnd, 0, rendered);
28
+ const documentEnd = lines.findIndex((line) => /^\.\.\.\s*$/.test(body(line)));
29
+ const appendWithoutEol = documentEnd < 0 && lines.length > 0 && !lines.at(-1).endsWith('\n');
30
+ if (appendWithoutEol)
31
+ lines[lines.length - 1] += eol;
32
+ lines.splice(documentEnd < 0 ? lines.length : documentEnd, 0, rendered + (appendWithoutEol ? '' : eol));
26
33
  continue;
27
34
  }
28
35
  let end = start + 1;
@@ -30,25 +37,26 @@ function editLines(text, doc, keys) {
30
37
  const continuation = (line) => /^(\s+\S|-(\s|$))/.test(line);
31
38
  const filler = (line) => /^\s*(#.*)?$/.test(line);
32
39
  for (let next = end; next < lines.length; next++) {
33
- if (continuation(lines[next]))
40
+ if (continuation(body(lines[next])))
34
41
  end = next + 1;
35
- else if (!filler(lines[next]))
42
+ else if (!filler(body(lines[next])))
36
43
  break;
37
44
  }
38
- lines.splice(start, end - start, ...(rendered === null ? [] : [rendered]));
45
+ const ending = lines[end - 1].match(/\r?\n$/)?.[0] ?? '';
46
+ lines.splice(start, end - start, ...(rendered === null ? [] : [rendered + ending]));
39
47
  }
40
- return lines.join(eol) + eol;
48
+ return lines.join('');
41
49
  }
42
50
  /**
43
51
  * 把 doc 中这些顶层键的值写回 text,其他行原样保留。
44
52
  * yaml 库整文件序列化无法同时保持 `{ a: b }` 与 `[a, b]` 两种 flow 写法,会让项目的格式检查失败,所以先按行改写;
45
- * 改写结果解析出错或与 doc 的内容不一致时(如整文件写成 flow 映射),退回整文件序列化:格式可能变化,但语义正确。
53
+ * 改写结果解析出错或与 doc 的内容不一致时(如整文件写成 flow 映射),交给通用 YAML 节点保真渲染,写回前核对语义。
46
54
  */
47
55
  export function withTopLevelKeys(text, doc, keys) {
48
56
  const edited = editLines(text, doc, keys);
49
57
  const parsed = parseDocument(edited);
50
58
  if (parsed.errors.length === 0 && isDeepStrictEqual(parsed.toJS(), doc.toJS()))
51
59
  return edited;
52
- return doc.toString({ flowCollectionPadding: false });
60
+ return withYamlChanges(text, doc);
53
61
  }
54
62
  //# sourceMappingURL=config-text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-text.js","sourceRoot":"","sources":["../src/config-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAiB,MAAM,MAAM,CAAC;AAEzE,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAE3E,6DAA6D;AAC7D,SAAS,WAAW,CAAC,IAAa;IAChC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACpH,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;AACtD,CAAC;AAED,oEAAoE;AACpE,SAAS,SAAS,CA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QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,GAAa,EAAE,IAAuB;IACnF,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;QAAE,OAAO,MAAM,CAAC;IAC9F,OAAO,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC"}
@@ -20,7 +20,7 @@ export function constraintList(root) {
20
20
  if (!items.length)
21
21
  return { list: null };
22
22
  const list = [
23
- `以下条目适用于所有改动(由 \`${projectSumi()} update\` 维护)。开发前用 \`${projectSumi()} task --select <ID>\` 读取原文,推送前按原文自查:`,
23
+ `以下条目适用于所有改动(由 \`${projectSumi()} update\` 维护)。开发前用 \`${projectSumi()} task --full --select <ID>\` 读取原文,推送前按原文自查:`,
24
24
  '',
25
25
  ...items.map((item) => `- [${item.ref}] ${item.text.replace(/\s+/g, ' ').trim()}`),
26
26
  ].join('\n');
@@ -1 +1 @@
1
- {"version":3,"file":"constraint-list.js","sourceRoot":"","sources":["../src/constraint-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AACrC,MAAM,KAAK,GAAG,iCAAiC,CAAC;AAChD,MAAM,GAAG,GAAG,+BAA+B,C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AAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,KAAK,IAAI,CAAC,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7G,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { collectProviderResultsAsync, initializeRuntime } from '@sumi/kernel';
2
+ import { readContextInput } from '@sumi/plugin-sdk';
3
+ if (process.env.SUMI_BIN)
4
+ initializeRuntime(process.env.SUMI_BIN);
5
+ try {
6
+ process.stdout.write(JSON.stringify(await collectProviderResultsAsync(await readContextInput())));
7
+ }
8
+ catch (error) {
9
+ process.stderr.write(error.message);
10
+ process.exitCode = 3;
11
+ }
12
+ //# sourceMappingURL=context-providers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-providers.js","sourceRoot":"","sources":["../src/context-providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ;IAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAClE,IAAI,CAAC;IACH,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,2BAA2B,CAAC,MAAM,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC;AACpG,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC"}
package/dist/context.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import { existsSync, readFileSync, statSync } from 'node:fs';
2
2
  import { join, relative, resolve } from 'node:path';
3
- import { KernelError, listFiles, loadConfig, loadFlow, loadRegistry, matches, resolveArgv } from '@sumi/kernel';
4
- import { cleanEnv, ruleRefs, recordTrace, saveContextSession, envSession, markContextRead, spawnCommandSync, } from '@sumi/plugin-sdk';
5
- import { emit, registerCommand, requireRoot } from './cli.js';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { KernelError, listFiles, loadConfig, loadFlow, loadRegistry, matches, collectProviderResults, } from '@sumi/kernel';
5
+ import { cleanEnv, ruleRefs, recordTrace, saveContextSession, envSession, MAX_CONTEXT_SESSION_LENGTH, markContextRead, spawnCommandSync, } from '@sumi/plugin-sdk';
6
+ import { renderContextOutput } from '@sumi/plugins-precedent';
7
+ import { registerCommand, requireRoot } from './cli.js';
6
8
  const GLOB = /[*?{[]/;
7
9
  /** 把输入(文件、目录、glob,可以尚不存在)展开为仓库相对路径,去掉排除路径。 */
8
10
  export function expand(root, cwd, inputs, exclude) {
@@ -71,27 +73,33 @@ export function collectContext(repo, input) {
71
73
  const items = [];
72
74
  const catalog = [];
73
75
  const diagnostics = [];
74
- for (const { decl } of registry.plugins.values()) {
75
- if (!decl.context)
76
- continue;
77
- const command = registry.commands.get(decl.context);
78
- const [cmd, ...rest] = resolveArgv(command.argv, command.dir);
79
- const r = spawnCommandSync(cmd, rest, {
76
+ let results;
77
+ try {
78
+ results = collectProviderResults({ ...input, repoRoot: repo, paths }, { registry, exclude: config.exclude });
79
+ }
80
+ catch (error) {
81
+ const code = error.code;
82
+ if (code !== 'ERR_REQUIRE_ESM' && code !== 'ERR_REQUIRE_ASYNC_MODULE')
83
+ throw error;
84
+ const response = spawnCommandSync(process.execPath, [fileURLToPath(new URL('../dist/context-providers.js', import.meta.url))], {
80
85
  cwd: repo,
81
86
  input: JSON.stringify({ ...input, repoRoot: repo, paths }),
82
87
  encoding: 'utf8',
83
- env: { ...cleanEnv(), SUMI_ROOT: repo },
88
+ maxBuffer: 32 * 1024 * 1024,
89
+ env: { ...cleanEnv(), SUMI_ROOT: repo, SUMI_BIN: process.env.SUMI_BIN ?? process.argv[1] ?? '' },
84
90
  windowsHide: true,
85
91
  });
86
- if (r.status !== 0)
87
- throw new KernelError(`约束查询命令 ${decl.context}(${decl.id})失败:${(r.stderr || '').trim()}`);
88
- const result = JSON.parse(r.stdout);
92
+ if (response.status !== 0)
93
+ throw new KernelError(`约束查询失败:${(response.stderr || '').trim()}`);
94
+ results = JSON.parse(response.stdout);
95
+ }
96
+ for (const result of results) {
89
97
  for (const item of result.items)
90
- items.push({ ...item, plugin: decl.id });
98
+ items.push({ ...item, plugin: result.plugin });
91
99
  for (const entry of result.catalog ?? [])
92
100
  catalog.push(entry);
93
101
  for (const entry of result.diagnostics ?? [])
94
- diagnostics.push({ ...entry, plugin: decl.id });
102
+ diagnostics.push({ ...entry, plugin: result.plugin });
95
103
  }
96
104
  // 3. 引用了上述执行者的规则语句:路径 → 执行者 → 引用它的规则。针对这些路径的执行者与全局执行者分开。
97
105
  const plugins = [...active.values()];
@@ -109,49 +117,39 @@ export function collectContext(repo, input) {
109
117
  const generalRules = lines.filter((l) => !l.refs.some(specific) && l.refs.some(general));
110
118
  return { paths, plugins, rules, generalRules, items, catalog, diagnostics };
111
119
  }
112
- registerCommand('context', '写代码前查约束:sumi context <路径...>,列出生效的检查、规则原文与插件提供的约束条目', async (args, io, root) => {
120
+ registerCommand('context', '写代码前查约束:sumi context <路径...>,输出有界摘要与规则位置,--full 读取完整原文', { flags: ['session', 'related-only', 'full'], booleanFlags: ['related-only', 'full'] }, async (args, io, root) => {
113
121
  const repo = requireRoot(root);
114
122
  if (args.positionals.length === 0)
115
123
  throw new KernelError('用法:sumi context <路径...>(文件、目录或 glob,可以尚不存在)');
116
124
  const config = loadConfig(repo);
117
125
  const paths = expand(repo, io.cwd, args.positionals, config.exclude);
118
- const { plugins, rules, generalRules, items } = collectContext(repo, { repoRoot: repo, paths });
119
- const section = (title, rows) => (rows.length ? [title, ...rows.map((l) => ` ${l}`)] : []);
120
- const brief = (t) => (t.length > 80 ? `${t.slice(0, 80)}…` : t);
121
- // 先给全部约束条目的清单(含通用条目):输出很长,代理常只读开头,不能让结尾的通用条目被截掉
122
- const grouped = new Map();
123
- for (const item of items) {
124
- const group = item.aliases?.[0] ?? item.ref;
125
- grouped.set(group, [...(grouped.get(group) ?? []), item.ref.startsWith(`${group}#`) ? item.ref.slice(group.length + 1) : item.ref]);
126
- }
127
- const text = [
128
- `路径:${paths.join('、') || '(无)'}`,
129
- '',
130
- '## 摘要(下文为原文;--json 输出结构化结果)',
131
- `约束条目 ${items.length} 条:${[...grouped].map(([group, refs]) => `${group}(${refs.join('、')})`).join(';') || '无'}`,
132
- `检查 ${plugins.length} 项;针对这些路径的规则 ${rules.length} 条,通用规则 ${generalRules.length} 条`,
133
- '',
134
- '## 针对这些路径(实现前必须读完)',
135
- ...section('检查:', plugins.filter((p) => !p.global).map((p) => `${p.id}${p.description ? ` — ${p.description}` : ''}`)),
136
- ...section('插件提供的约束:', items.filter((i) => !i.global).map((i) => `[${i.ref}] ${i.text}${i.source ? `(来源:${i.source})` : ''}`)),
137
- ...section('规则原文:', rules.map((r) => `${r.file}:${r.line} ${r.text}`)),
138
- '',
139
- '## 通用(所有改动都适用,需要时打开对应位置)',
140
- `检查:${plugins
141
- .filter((p) => p.global)
142
- .map((p) => p.id)
143
- .join('、') || '无'}`,
144
- ...section('条目:', items.filter((i) => i.global).map((i) => `[${i.ref}] ${brief(i.text)}`)),
145
- ...section('规则:', generalRules.map((r) => `${r.file}:${r.line} ${brief(r.text)}`)),
146
- ].join('\n');
147
- emit(io, args, { paths, plugins, rules, generalRules, items }, text);
126
+ const relatedOnly = args.flags['related-only'] === true;
127
+ const data = collectContext(repo, {
128
+ repoRoot: repo,
129
+ session: typeof args.flags.session === 'string' ? args.flags.session : envSession(),
130
+ paths,
131
+ ...(relatedOnly ? { relatedOnly } : {}),
132
+ });
133
+ const { plugins, rules, generalRules, items } = data;
148
134
  const session = typeof args.flags.session === 'string' ? args.flags.session : envSession();
135
+ if (session && session.length > MAX_CONTEXT_SESSION_LENGTH)
136
+ throw new KernelError('--session 过长');
137
+ let result;
138
+ try {
139
+ result = renderContextOutput(repo, data, {
140
+ header: `## 摘要\n约束条目 ${items.length} 条,检查 ${plugins.length} 项,关联规则 ${rules.length + generalRules.length} 条。\n路径:${paths.join('、') || '(无)'}`,
141
+ session,
142
+ full: args.flags.full === true,
143
+ json: args.flags.json === true,
144
+ });
145
+ }
146
+ catch (error) {
147
+ throw new KernelError(error.message);
148
+ }
149
+ const text = result.text;
150
+ await io.out(args.flags.json ? JSON.stringify(data, null, 2) : text);
149
151
  if (session)
150
- saveContextSession(repo, session, [
151
- ...plugins.filter((p) => !p.global).map((p) => `plugin:${p.id}`),
152
- ...items.filter((i) => !i.global).map((i) => `item:${i.ref}`),
153
- ...rules.map((r) => `rule:${r.file}:${r.line}`),
154
- ]);
152
+ saveContextSession(repo, session, result.deliveryKeys, undefined, false, result.deliveryRecords);
155
153
  if (session)
156
154
  markContextRead(repo, session);
157
155
  if (session)
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChH,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,kBAA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C;IAC9G,IAAI,OAAO;QAAE,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5C,IAAI,OAAO;QAAE,WAAW,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACrI,OAAO,CAAC,CAAC;AACX,CAAC,CACF,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { type Registry, type SumiConfig } from '@sumi/kernel';
2
+ import type { AgentSetting, AfterReadHook } from '@sumi/plugin-sdk';
3
+ /** 收集插件声明的 hook:git hook 名称 → 命令,以及 AI 工具前置、编辑后与停止检查命令。 */
4
+ interface DeclaredHooks {
5
+ bootstrap?: string;
6
+ git: Map<string, string[]>;
7
+ beforeTool: {
8
+ command: string;
9
+ tools: 'all' | 'edit';
10
+ failure: 'closed' | 'open';
11
+ }[];
12
+ afterEdit: string[];
13
+ afterRead: AfterReadHook[];
14
+ /** 有插件的编辑后命令处理 shell 写入。 */
15
+ afterEditShell: boolean;
16
+ onPrompt: string[];
17
+ sessionStart: string[];
18
+ subagentContext: string[];
19
+ modelSwitch: string[];
20
+ stop: string[];
21
+ }
22
+ /** 只解释插件声明的配置模式,不在 CLI 内定义任何插件专属模式。 */
23
+ export declare function declaredAgentSettings(registry: Registry, config: SumiConfig): {
24
+ setting: AgentSetting;
25
+ value: string;
26
+ configured: boolean;
27
+ }[];
28
+ export declare function declaredHooks(registry: Registry, config?: SumiConfig): DeclaredHooks;
29
+ export {};
@@ -0,0 +1,99 @@
1
+ import { resolve } from 'node:path';
2
+ import { KernelError } from '@sumi/kernel';
3
+ function settingValue(config, path) {
4
+ let value = config;
5
+ let parent = '';
6
+ for (const key of path.split('.')) {
7
+ if (value === undefined)
8
+ return undefined;
9
+ if (!value || typeof value !== 'object' || Array.isArray(value))
10
+ throw new KernelError(`${parent} 必须是对象`);
11
+ value = value[key];
12
+ parent = parent ? `${parent}.${key}` : key;
13
+ }
14
+ return value;
15
+ }
16
+ /** 只解释插件声明的配置模式,不在 CLI 内定义任何插件专属模式。 */
17
+ export function declaredAgentSettings(registry, config) {
18
+ const paths = new Set();
19
+ return [...registry.plugins.values()].flatMap(({ decl }) => (decl.agentSettings ?? []).map((setting) => {
20
+ if (paths.has(setting.path))
21
+ throw new KernelError(`代理配置模式 ${setting.path} 被重复声明`);
22
+ paths.add(setting.path);
23
+ const configured = settingValue(config, setting.path);
24
+ if (configured !== undefined && !setting.values.includes(configured))
25
+ throw new KernelError(`${setting.path} 必须是 ${setting.values.join(' 或 ')}`);
26
+ return { setting, value: configured ?? setting.default, configured: configured !== undefined };
27
+ }));
28
+ }
29
+ export function declaredHooks(registry, config) {
30
+ if (config)
31
+ declaredAgentSettings(registry, config);
32
+ const git = new Map([['pre-commit', ['run', 'check', '--pre-commit']]]);
33
+ const owner = new Map([['pre-commit', '内核']]);
34
+ const beforeTool = [];
35
+ const afterEdit = [];
36
+ const afterRead = [];
37
+ let afterEditShell = false;
38
+ const onPrompt = [];
39
+ const sessionStart = [];
40
+ const subagentContext = [];
41
+ const modelSwitch = [];
42
+ const stop = [];
43
+ let bootstrap;
44
+ for (const { decl, dir } of registry.plugins.values()) {
45
+ if (decl.hooks?.agent?.bootstrap) {
46
+ if (bootstrap)
47
+ throw new KernelError('前置 hook bootstrap 被重复声明');
48
+ bootstrap = resolve(dir, decl.hooks.agent.bootstrap);
49
+ }
50
+ for (const [hook, command] of Object.entries(decl.hooks?.git ?? {})) {
51
+ if (owner.has(hook))
52
+ throw new KernelError(`git hook ${hook} 被重复声明(${owner.get(hook)} 与 ${decl.id})`);
53
+ owner.set(hook, decl.id);
54
+ git.set(hook, [command]);
55
+ }
56
+ const before = decl.hooks?.agent?.beforeTool;
57
+ if (before) {
58
+ const hook = typeof before === 'string' ? { command: before } : before;
59
+ const condition = hook.when;
60
+ const value = condition?.path.split('.').reduce((value, key) => {
61
+ return value && typeof value === 'object' ? value[key] : undefined;
62
+ }, config);
63
+ const enabled = !condition || (condition.equals !== undefined ? value === condition.equals : value !== condition.notEquals);
64
+ if (enabled)
65
+ beforeTool.push({
66
+ command: hook.command,
67
+ tools: hook.tools ?? 'all',
68
+ failure: hook.failure ?? 'closed',
69
+ });
70
+ }
71
+ const prompt = decl.hooks?.agent?.onPrompt;
72
+ if (prompt) {
73
+ const hook = typeof prompt === 'string' ? { command: prompt } : prompt;
74
+ const condition = hook.when;
75
+ const value = condition?.path
76
+ .split('.')
77
+ .reduce((current, key) => (current && typeof current === 'object' ? current[key] : undefined), config);
78
+ if (!condition || (condition.equals !== undefined ? value === condition.equals : value !== condition.notEquals))
79
+ onPrompt.push(hook.command);
80
+ }
81
+ const read = decl.hooks?.agent?.afterRead;
82
+ if (read)
83
+ afterRead.push(typeof read === 'string' ? { command: read } : read);
84
+ if (decl.hooks?.agent?.afterEdit)
85
+ afterEdit.push(decl.hooks.agent.afterEdit);
86
+ if (decl.hooks?.agent?.afterEdit && decl.hooks.agent.afterEditShell)
87
+ afterEditShell = true;
88
+ if (decl.hooks?.agent?.subagentContext)
89
+ subagentContext.push(decl.hooks.agent.subagentContext);
90
+ if (decl.hooks?.agent?.sessionStart)
91
+ sessionStart.push(decl.hooks.agent.sessionStart);
92
+ if (decl.hooks?.agent?.modelSwitch)
93
+ modelSwitch.push(decl.hooks.agent.modelSwitch);
94
+ if (decl.hooks?.agent?.stop)
95
+ stop.push(decl.hooks.agent.stop);
96
+ }
97
+ return { bootstrap, git, beforeTool, afterEdit, afterRead, afterEditShell, onPrompt, sessionStart, subagentContext, modelSwitch, stop };
98
+ }
99
+ //# sourceMappingURL=declared-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-hooks.js","sourceRoot":"","sources":["../src/declared-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAkC,MAAM,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
1
+ import type { Io } from './cli.js';
2
+ /** hook 的唯一 stdout 出口;调用者在退出前等待宿主响应写入。 */
3
+ export declare function writeHookOutput(io: Pick<Io, 'out'>, output: string): Promise<void>;
@@ -0,0 +1,5 @@
1
+ /** hook 的唯一 stdout 出口;调用者在退出前等待宿主响应写入。 */
2
+ export async function writeHookOutput(io, output) {
3
+ await io.out(output);
4
+ }
5
+ //# sourceMappingURL=hook-output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook-output.js","sourceRoot":"","sources":["../src/hook-output.ts"],"names":[],"mappings":"AAEA,0CAA0C;AAC1C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAmB,EAAE,MAAc;IACvE,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACvB,CAAC"}
@@ -1,13 +1,41 @@
1
- import type { Registry } from '@sumi/kernel';
1
+ import { type Registry } from '@sumi/kernel';
2
+ import { type AfterEditResult, type ContextDelivery } from '@sumi/plugin-sdk';
2
3
  /** 转交给其他项目的 hook 进程带此标记,不再继续转交,避免多个仓库之间来回调用。 */
3
4
  export declare const ROUTED_ENV = "SUMI_HOOK_ROUTED";
5
+ /** 目标项目本次发出的内容:父进程把输出写给宿主之后,才让目标项目记账并回执。 */
6
+ export interface DeliveryReceipt {
7
+ kind: 'before' | 'after';
8
+ channel: string;
9
+ contexts: string[];
10
+ deliveries: {
11
+ argv: string[];
12
+ dir: string;
13
+ keys: string[];
14
+ scopes?: string[];
15
+ records?: ContextDelivery[];
16
+ }[];
17
+ evidence?: Pick<AfterEditResult, 'items' | 'skipped' | 'paths'>;
18
+ }
19
+ export interface RoutedReceipt {
20
+ owner: string;
21
+ entry: string;
22
+ host: string;
23
+ input: string;
24
+ receipt: DeliveryReceipt;
25
+ }
4
26
  export interface RoutedResult {
5
27
  /** 任一目标项目拒绝写入(退出码 2)。 */
6
28
  denied: boolean;
7
29
  stderr: string[];
8
30
  /** 各目标项目 hook 的标准输出(编辑后 hook 的补充上下文)。 */
9
31
  stdout: string[];
32
+ receipts: RoutedReceipt[];
10
33
  }
34
+ export declare function editTool(name: string | null): boolean;
35
+ /** 被转交的进程把回执附在输出里带回父进程。 */
36
+ export declare function withReceipt(output: string, receipt: DeliveryReceipt): string;
37
+ /** 输出已写给宿主:让目标项目记账并标记已送达。失败只影响去重,不影响本次结果。 */
38
+ export declare function acknowledgeRouted(receipts: RoutedReceipt[]): void;
11
39
  /** 宿主直接调用的全部插件命令。 */
12
40
  export declare function agentHookCommands(registry: Registry): Set<string>;
13
41
  /** 插件声明的写入前与编辑后 hook 命令名。 */