@fantasticit/sumi 0.14.4 → 0.14.6

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 (398) hide show
  1. package/dist/agent-hooks.js +15 -2
  2. package/dist/agent-hooks.js.map +1 -1
  3. package/dist/agents.js +14 -9
  4. package/dist/agents.js.map +1 -1
  5. package/dist/cli.js +20 -3
  6. package/dist/cli.js.map +1 -1
  7. package/dist/codex-trust.d.ts +8 -0
  8. package/dist/codex-trust.js +27 -0
  9. package/dist/codex-trust.js.map +1 -0
  10. package/dist/codex-user-hook-entry.d.ts +1 -0
  11. package/dist/codex-user-hook-entry.js +134 -0
  12. package/dist/codex-user-hook-entry.js.map +1 -0
  13. package/dist/codex-user-hook.cjs +137 -0
  14. package/dist/codex-user-hook.d.ts +2 -0
  15. package/dist/codex-user-hook.js +85 -0
  16. package/dist/codex-user-hook.js.map +1 -0
  17. package/dist/context-providers.js +1 -3
  18. package/dist/context-providers.js.map +1 -1
  19. package/dist/context.d.ts +3 -1
  20. package/dist/context.js +16 -16
  21. package/dist/context.js.map +1 -1
  22. package/dist/doctor-wiring.d.ts +1 -6
  23. package/dist/doctor-wiring.js +4 -25
  24. package/dist/doctor-wiring.js.map +1 -1
  25. package/dist/hub/board.d.ts +85 -0
  26. package/dist/hub/board.js +261 -0
  27. package/dist/hub/board.js.map +1 -0
  28. package/dist/hub/commands.d.ts +13 -0
  29. package/dist/hub/commands.js +86 -0
  30. package/dist/hub/commands.js.map +1 -0
  31. package/dist/hub/pages.d.ts +2 -0
  32. package/dist/hub/pages.js +136 -0
  33. package/dist/hub/pages.js.map +1 -0
  34. package/dist/hub/server.d.ts +23 -0
  35. package/dist/hub/server.js +128 -0
  36. package/dist/hub/server.js.map +1 -0
  37. package/dist/hub/snapshot.d.ts +48 -0
  38. package/dist/hub/snapshot.js +132 -0
  39. package/dist/hub/snapshot.js.map +1 -0
  40. package/dist/hub/start.d.ts +13 -0
  41. package/dist/hub/start.js +59 -0
  42. package/dist/hub/start.js.map +1 -0
  43. package/dist/hub/state.d.ts +49 -0
  44. package/dist/hub/state.js +144 -0
  45. package/dist/hub/state.js.map +1 -0
  46. package/dist/index.d.ts +2 -0
  47. package/dist/index.js +2 -0
  48. package/dist/index.js.map +1 -1
  49. package/dist/instructions.js +1 -1
  50. package/dist/launcher.cjs +209 -155
  51. package/dist/run-stats.d.ts +20 -0
  52. package/dist/run-stats.js +58 -6
  53. package/dist/run-stats.js.map +1 -1
  54. package/dist/task.js +8 -2
  55. package/dist/task.js.map +1 -1
  56. package/node_modules/@sumi/create/package.json +2 -2
  57. package/node_modules/@sumi/create/template/control/flows/change.flow.yaml +1 -1
  58. package/node_modules/@sumi/create/template/control/flows/check.flow.yaml +8 -0
  59. package/node_modules/@sumi/create/template/control/flows/checkpoint.flow.yaml +8 -0
  60. package/node_modules/@sumi/create/template/control/rubrics/slice.yaml +14 -0
  61. package/node_modules/@sumi/create/template/control/rules/development.md +1 -1
  62. package/node_modules/@sumi/create/template/init/control/flows/change.flow.yaml +1 -1
  63. package/node_modules/@sumi/create/template/init/control/flows/check.flow.yaml +21 -0
  64. package/node_modules/@sumi/kernel/dist/brief.d.ts +2 -0
  65. package/node_modules/@sumi/kernel/dist/brief.js.map +1 -1
  66. package/node_modules/@sumi/kernel/dist/config.d.ts +1 -6
  67. package/node_modules/@sumi/kernel/dist/config.js +5 -16
  68. package/node_modules/@sumi/kernel/dist/config.js.map +1 -1
  69. package/node_modules/@sumi/kernel/dist/engine.js +6 -1
  70. package/node_modules/@sumi/kernel/dist/engine.js.map +1 -1
  71. package/node_modules/@sumi/kernel/dist/flow.d.ts +1 -0
  72. package/node_modules/@sumi/kernel/dist/flow.js +9 -1
  73. package/node_modules/@sumi/kernel/dist/flow.js.map +1 -1
  74. package/node_modules/@sumi/kernel/dist/plan.d.ts +2 -0
  75. package/node_modules/@sumi/kernel/dist/plan.js +8 -1
  76. package/node_modules/@sumi/kernel/dist/plan.js.map +1 -1
  77. package/node_modules/@sumi/kernel/dist/registry.d.ts +2 -3
  78. package/node_modules/@sumi/kernel/dist/registry.js +5 -6
  79. package/node_modules/@sumi/kernel/dist/registry.js.map +1 -1
  80. package/node_modules/@sumi/kernel/dist/runner.js +1 -1
  81. package/node_modules/@sumi/kernel/dist/runner.js.map +1 -1
  82. package/node_modules/@sumi/kernel/dist/runtime.d.ts +11 -0
  83. package/node_modules/@sumi/kernel/dist/runtime.js +34 -2
  84. package/node_modules/@sumi/kernel/dist/runtime.js.map +1 -1
  85. package/node_modules/@sumi/kernel/dist/step-cache.js +1 -0
  86. package/node_modules/@sumi/kernel/dist/step-cache.js.map +1 -1
  87. package/node_modules/@sumi/kernel/dist/step.d.ts +1 -0
  88. package/node_modules/@sumi/kernel/dist/step.js +1 -0
  89. package/node_modules/@sumi/kernel/dist/step.js.map +1 -1
  90. package/node_modules/@sumi/kernel/package.json +2 -2
  91. package/node_modules/@sumi/plugin-sdk/README.md +8 -0
  92. package/node_modules/@sumi/plugin-sdk/dist/context-delivery.d.ts +11 -6
  93. package/node_modules/@sumi/plugin-sdk/dist/context-delivery.js +35 -3
  94. package/node_modules/@sumi/plugin-sdk/dist/context-delivery.js.map +1 -1
  95. package/node_modules/@sumi/plugin-sdk/dist/edit-paths.d.ts +2 -0
  96. package/node_modules/@sumi/plugin-sdk/dist/edit-paths.js +29 -23
  97. package/node_modules/@sumi/plugin-sdk/dist/edit-paths.js.map +1 -1
  98. package/node_modules/@sumi/plugin-sdk/dist/env.d.ts +2 -0
  99. package/node_modules/@sumi/plugin-sdk/dist/env.js +7 -0
  100. package/node_modules/@sumi/plugin-sdk/dist/env.js.map +1 -1
  101. package/node_modules/@sumi/plugin-sdk/dist/git.d.ts +8 -0
  102. package/node_modules/@sumi/plugin-sdk/dist/git.js +38 -0
  103. package/node_modules/@sumi/plugin-sdk/dist/git.js.map +1 -1
  104. package/node_modules/@sumi/plugin-sdk/dist/html-page.d.ts +10 -2
  105. package/node_modules/@sumi/plugin-sdk/dist/html-page.js +14 -5
  106. package/node_modules/@sumi/plugin-sdk/dist/html-page.js.map +1 -1
  107. package/node_modules/@sumi/plugin-sdk/dist/hub.d.ts +31 -0
  108. package/node_modules/@sumi/plugin-sdk/dist/hub.js +32 -0
  109. package/node_modules/@sumi/plugin-sdk/dist/hub.js.map +1 -0
  110. package/node_modules/@sumi/plugin-sdk/dist/import-graph.d.ts +22 -0
  111. package/node_modules/@sumi/plugin-sdk/dist/import-graph.js +118 -0
  112. package/node_modules/@sumi/plugin-sdk/dist/import-graph.js.map +1 -0
  113. package/node_modules/@sumi/plugin-sdk/dist/index.d.ts +3 -0
  114. package/node_modules/@sumi/plugin-sdk/dist/index.js +3 -0
  115. package/node_modules/@sumi/plugin-sdk/dist/index.js.map +1 -1
  116. package/node_modules/@sumi/plugin-sdk/dist/permissions.d.ts +2 -0
  117. package/node_modules/@sumi/plugin-sdk/dist/permissions.js +12 -1
  118. package/node_modules/@sumi/plugin-sdk/dist/permissions.js.map +1 -1
  119. package/node_modules/@sumi/plugin-sdk/dist/protocol.d.ts +4 -0
  120. package/node_modules/@sumi/plugin-sdk/dist/protocol.js.map +1 -1
  121. package/node_modules/@sumi/plugin-sdk/dist/scenario-selection.d.ts +20 -0
  122. package/node_modules/@sumi/plugin-sdk/dist/scenario-selection.js +18 -0
  123. package/node_modules/@sumi/plugin-sdk/dist/scenario-selection.js.map +1 -0
  124. package/node_modules/@sumi/plugin-sdk/dist/session-context.d.ts +2 -2
  125. package/node_modules/@sumi/plugin-sdk/dist/session-context.js +10 -7
  126. package/node_modules/@sumi/plugin-sdk/dist/session-context.js.map +1 -1
  127. package/node_modules/@sumi/plugin-sdk/dist/session-env.d.ts +2 -0
  128. package/node_modules/@sumi/plugin-sdk/dist/session-env.js +3 -0
  129. package/node_modules/@sumi/plugin-sdk/dist/session-env.js.map +1 -0
  130. package/node_modules/@sumi/plugin-sdk/dist/shell.d.ts +11 -5
  131. package/node_modules/@sumi/plugin-sdk/dist/shell.js +132 -23
  132. package/node_modules/@sumi/plugin-sdk/dist/shell.js.map +1 -1
  133. package/node_modules/@sumi/plugin-sdk/dist/validate.js +5 -0
  134. package/node_modules/@sumi/plugin-sdk/dist/validate.js.map +1 -1
  135. package/node_modules/@sumi/plugin-sdk/package.json +1 -1
  136. package/node_modules/@sumi/plugins-core/dist/agent-rules.js +20 -5
  137. package/node_modules/@sumi/plugins-core/dist/agent-rules.js.map +1 -1
  138. package/node_modules/@sumi/plugins-core/dist/change-impact.js +1 -13
  139. package/node_modules/@sumi/plugins-core/dist/change-impact.js.map +1 -1
  140. package/node_modules/@sumi/plugins-core/dist/commands/agent-rules-subagent-context.d.ts +1 -0
  141. package/node_modules/@sumi/plugins-core/dist/commands/agent-rules-subagent-context.js +10 -0
  142. package/node_modules/@sumi/plugins-core/dist/commands/agent-rules-subagent-context.js.map +1 -0
  143. package/node_modules/@sumi/plugins-core/dist/commands/context-impact.js +1 -3
  144. package/node_modules/@sumi/plugins-core/dist/commands/context-impact.js.map +1 -1
  145. package/node_modules/@sumi/plugins-core/dist/plugins/test-affected.js +26 -7
  146. package/node_modules/@sumi/plugins-core/dist/plugins/test-affected.js.map +1 -1
  147. package/node_modules/@sumi/plugins-core/dist/test-scope.d.ts +3 -1
  148. package/node_modules/@sumi/plugins-core/dist/test-scope.js +14 -3
  149. package/node_modules/@sumi/plugins-core/dist/test-scope.js.map +1 -1
  150. package/node_modules/@sumi/plugins-core/dist/vitest-runner.js +16 -0
  151. package/node_modules/@sumi/plugins-core/dist/vitest-runner.js.map +1 -1
  152. package/node_modules/@sumi/plugins-core/instructions/bugfix.md +1 -1
  153. package/node_modules/@sumi/plugins-core/instructions/feature.md +1 -1
  154. package/node_modules/@sumi/plugins-core/package.json +2 -2
  155. package/node_modules/@sumi/plugins-core/sumi-plugins.yaml +6 -0
  156. package/node_modules/@sumi/plugins-governance/README.md +16 -1
  157. package/node_modules/@sumi/plugins-governance/dist/boundary-answer-page.d.ts +3 -0
  158. package/node_modules/@sumi/plugins-governance/dist/boundary-answer-page.js +76 -0
  159. package/node_modules/@sumi/plugins-governance/dist/boundary-answer-page.js.map +1 -0
  160. package/node_modules/@sumi/plugins-governance/dist/boundary-browser.d.ts +6 -0
  161. package/node_modules/@sumi/plugins-governance/dist/boundary-browser.js +121 -0
  162. package/node_modules/@sumi/plugins-governance/dist/boundary-browser.js.map +1 -0
  163. package/node_modules/@sumi/plugins-governance/dist/boundary-form.d.ts +18 -0
  164. package/node_modules/@sumi/plugins-governance/dist/boundary-form.js +97 -0
  165. package/node_modules/@sumi/plugins-governance/dist/boundary-form.js.map +1 -0
  166. package/node_modules/@sumi/plugins-governance/dist/boundary-mcp.d.ts +1 -0
  167. package/node_modules/@sumi/plugins-governance/dist/boundary-mcp.js +179 -0
  168. package/node_modules/@sumi/plugins-governance/dist/boundary-mcp.js.map +1 -0
  169. package/node_modules/@sumi/plugins-governance/dist/boundary.d.ts +10 -0
  170. package/node_modules/@sumi/plugins-governance/dist/boundary.js +136 -30
  171. package/node_modules/@sumi/plugins-governance/dist/boundary.js.map +1 -1
  172. package/node_modules/@sumi/plugins-governance/dist/branch-scope.d.ts +9 -0
  173. package/node_modules/@sumi/plugins-governance/dist/branch-scope.js +64 -0
  174. package/node_modules/@sumi/plugins-governance/dist/branch-scope.js.map +1 -0
  175. package/node_modules/@sumi/plugins-governance/dist/checkout.d.ts +2 -0
  176. package/node_modules/@sumi/plugins-governance/dist/checkout.js +13 -3
  177. package/node_modules/@sumi/plugins-governance/dist/checkout.js.map +1 -1
  178. package/node_modules/@sumi/plugins-governance/dist/commands/boundary.js +59 -9
  179. package/node_modules/@sumi/plugins-governance/dist/commands/boundary.js.map +1 -1
  180. package/node_modules/@sumi/plugins-governance/dist/commands/gate.js +16 -14
  181. package/node_modules/@sumi/plugins-governance/dist/commands/gate.js.map +1 -1
  182. package/node_modules/@sumi/plugins-governance/dist/commands/hub-snapshot.d.ts +1 -0
  183. package/node_modules/@sumi/plugins-governance/dist/commands/hub-snapshot.js +4 -0
  184. package/node_modules/@sumi/plugins-governance/dist/commands/hub-snapshot.js.map +1 -0
  185. package/node_modules/@sumi/plugins-governance/dist/commands/pr-report.js +7 -1
  186. package/node_modules/@sumi/plugins-governance/dist/commands/pr-report.js.map +1 -1
  187. package/node_modules/@sumi/plugins-governance/dist/commands/run-policy.js +1 -3
  188. package/node_modules/@sumi/plugins-governance/dist/commands/run-policy.js.map +1 -1
  189. package/node_modules/@sumi/plugins-governance/dist/extensions.d.ts +2 -0
  190. package/node_modules/@sumi/plugins-governance/dist/extensions.js +32 -0
  191. package/node_modules/@sumi/plugins-governance/dist/extensions.js.map +1 -0
  192. package/node_modules/@sumi/plugins-governance/dist/gate-cache.d.ts +2 -1
  193. package/node_modules/@sumi/plugins-governance/dist/gate-cache.js +11 -2
  194. package/node_modules/@sumi/plugins-governance/dist/gate-cache.js.map +1 -1
  195. package/node_modules/@sumi/plugins-governance/dist/guard.js +147 -19
  196. package/node_modules/@sumi/plugins-governance/dist/guard.js.map +1 -1
  197. package/node_modules/@sumi/plugins-governance/dist/hub-snapshot.d.ts +3 -0
  198. package/node_modules/@sumi/plugins-governance/dist/hub-snapshot.js +40 -0
  199. package/node_modules/@sumi/plugins-governance/dist/hub-snapshot.js.map +1 -0
  200. package/node_modules/@sumi/plugins-governance/dist/index.d.ts +3 -1
  201. package/node_modules/@sumi/plugins-governance/dist/index.js +3 -1
  202. package/node_modules/@sumi/plugins-governance/dist/index.js.map +1 -1
  203. package/node_modules/@sumi/plugins-governance/dist/plugins/size-budget.d.ts +1 -0
  204. package/node_modules/@sumi/plugins-governance/dist/plugins/size-budget.js +4 -0
  205. package/node_modules/@sumi/plugins-governance/dist/plugins/size-budget.js.map +1 -0
  206. package/node_modules/@sumi/plugins-governance/dist/pr-base.js +21 -1
  207. package/node_modules/@sumi/plugins-governance/dist/pr-base.js.map +1 -1
  208. package/node_modules/@sumi/plugins-governance/dist/pr-report-compose.js +25 -12
  209. package/node_modules/@sumi/plugins-governance/dist/pr-report-compose.js.map +1 -1
  210. package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.d.ts +2 -0
  211. package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.js +2 -0
  212. package/node_modules/@sumi/plugins-governance/dist/pr-report-markers.js.map +1 -1
  213. package/node_modules/@sumi/plugins-governance/dist/pr-report-sections.js +34 -4
  214. package/node_modules/@sumi/plugins-governance/dist/pr-report-sections.js.map +1 -1
  215. package/node_modules/@sumi/plugins-governance/dist/preflight.d.ts +1 -0
  216. package/node_modules/@sumi/plugins-governance/dist/preflight.js +2 -2
  217. package/node_modules/@sumi/plugins-governance/dist/preflight.js.map +1 -1
  218. package/node_modules/@sumi/plugins-governance/dist/protected.d.ts +2 -0
  219. package/node_modules/@sumi/plugins-governance/dist/protected.js +4 -0
  220. package/node_modules/@sumi/plugins-governance/dist/protected.js.map +1 -1
  221. package/node_modules/@sumi/plugins-governance/dist/size-budget.d.ts +2 -0
  222. package/node_modules/@sumi/plugins-governance/dist/size-budget.js +73 -0
  223. package/node_modules/@sumi/plugins-governance/dist/size-budget.js.map +1 -0
  224. package/node_modules/@sumi/plugins-governance/dist/upgrade-command.js +12 -5
  225. package/node_modules/@sumi/plugins-governance/dist/upgrade-command.js.map +1 -1
  226. package/node_modules/@sumi/plugins-governance/dist/view-page.d.ts +1 -0
  227. package/node_modules/@sumi/plugins-governance/dist/view-page.js +19 -18
  228. package/node_modules/@sumi/plugins-governance/dist/view-page.js.map +1 -1
  229. package/node_modules/@sumi/plugins-governance/instructions/boundary.md +18 -2
  230. package/node_modules/@sumi/plugins-governance/package.json +4 -4
  231. package/node_modules/@sumi/plugins-governance/sumi-plugins.yaml +12 -0
  232. package/node_modules/@sumi/plugins-openspec/README.md +36 -12
  233. package/node_modules/@sumi/plugins-openspec/dist/checkpoint-hook.d.ts +4 -0
  234. package/node_modules/@sumi/plugins-openspec/dist/checkpoint-hook.js +34 -0
  235. package/node_modules/@sumi/plugins-openspec/dist/checkpoint-hook.js.map +1 -0
  236. package/node_modules/@sumi/plugins-openspec/dist/commands/checkpoint-after-edit.d.ts +1 -0
  237. package/node_modules/@sumi/plugins-openspec/dist/commands/checkpoint-after-edit.js +9 -0
  238. package/node_modules/@sumi/plugins-openspec/dist/commands/checkpoint-after-edit.js.map +1 -0
  239. package/node_modules/@sumi/plugins-openspec/dist/commands/hub-snapshot.d.ts +1 -0
  240. package/node_modules/@sumi/plugins-openspec/dist/commands/hub-snapshot.js +4 -0
  241. package/node_modules/@sumi/plugins-openspec/dist/commands/hub-snapshot.js.map +1 -0
  242. package/node_modules/@sumi/plugins-openspec/dist/commands/pr-dependencies.d.ts +1 -0
  243. package/node_modules/@sumi/plugins-openspec/dist/commands/pr-dependencies.js +10 -0
  244. package/node_modules/@sumi/plugins-openspec/dist/commands/pr-dependencies.js.map +1 -0
  245. package/node_modules/@sumi/plugins-openspec/dist/commands/size-groups.d.ts +1 -0
  246. package/node_modules/@sumi/plugins-openspec/dist/commands/size-groups.js +12 -0
  247. package/node_modules/@sumi/plugins-openspec/dist/commands/size-groups.js.map +1 -0
  248. package/node_modules/@sumi/plugins-openspec/dist/commands/slice-record.d.ts +1 -0
  249. package/node_modules/@sumi/plugins-openspec/dist/commands/slice-record.js +28 -0
  250. package/node_modules/@sumi/plugins-openspec/dist/commands/slice-record.js.map +1 -0
  251. package/node_modules/@sumi/plugins-openspec/dist/hub-snapshot.d.ts +4 -0
  252. package/node_modules/@sumi/plugins-openspec/dist/hub-snapshot.js +34 -0
  253. package/node_modules/@sumi/plugins-openspec/dist/hub-snapshot.js.map +1 -0
  254. package/node_modules/@sumi/plugins-openspec/dist/index.d.ts +4 -0
  255. package/node_modules/@sumi/plugins-openspec/dist/index.js +4 -0
  256. package/node_modules/@sumi/plugins-openspec/dist/index.js.map +1 -1
  257. package/node_modules/@sumi/plugins-openspec/dist/plugins/change-tasks.js +7 -2
  258. package/node_modules/@sumi/plugins-openspec/dist/plugins/change-tasks.js.map +1 -1
  259. package/node_modules/@sumi/plugins-openspec/dist/plugins/impact-consistency.js +2 -0
  260. package/node_modules/@sumi/plugins-openspec/dist/plugins/impact-consistency.js.map +1 -1
  261. package/node_modules/@sumi/plugins-openspec/dist/plugins/planner.js +35 -0
  262. package/node_modules/@sumi/plugins-openspec/dist/plugins/planner.js.map +1 -1
  263. package/node_modules/@sumi/plugins-openspec/dist/slice-check.d.ts +3 -0
  264. package/node_modules/@sumi/plugins-openspec/dist/slice-check.js +13 -0
  265. package/node_modules/@sumi/plugins-openspec/dist/slice-check.js.map +1 -0
  266. package/node_modules/@sumi/plugins-openspec/dist/slice-ledger.d.ts +19 -0
  267. package/node_modules/@sumi/plugins-openspec/dist/slice-ledger.js +179 -0
  268. package/node_modules/@sumi/plugins-openspec/dist/slice-ledger.js.map +1 -0
  269. package/node_modules/@sumi/plugins-openspec/dist/slice.d.ts +2 -0
  270. package/node_modules/@sumi/plugins-openspec/dist/slice.js +134 -0
  271. package/node_modules/@sumi/plugins-openspec/dist/slice.js.map +1 -0
  272. package/node_modules/@sumi/plugins-openspec/dist/task-groups.d.ts +12 -0
  273. package/node_modules/@sumi/plugins-openspec/dist/task-groups.js +21 -0
  274. package/node_modules/@sumi/plugins-openspec/dist/task-groups.js.map +1 -0
  275. package/node_modules/@sumi/plugins-openspec/dist/upgrade-command.d.ts +1 -0
  276. package/node_modules/@sumi/plugins-openspec/dist/upgrade-command.js +7 -0
  277. package/node_modules/@sumi/plugins-openspec/dist/upgrade-command.js.map +1 -0
  278. package/node_modules/@sumi/plugins-openspec/package.json +8 -4
  279. package/node_modules/@sumi/plugins-openspec/sumi-plugins.yaml +30 -0
  280. package/node_modules/@sumi/plugins-precedent/dist/after-edit-context.js +10 -11
  281. package/node_modules/@sumi/plugins-precedent/dist/after-edit-context.js.map +1 -1
  282. package/node_modules/@sumi/plugins-precedent/dist/candidates.d.ts +9 -3
  283. package/node_modules/@sumi/plugins-precedent/dist/candidates.js +12 -6
  284. package/node_modules/@sumi/plugins-precedent/dist/candidates.js.map +1 -1
  285. package/node_modules/@sumi/plugins-precedent/dist/commands/promote.js +20 -5
  286. package/node_modules/@sumi/plugins-precedent/dist/commands/promote.js.map +1 -1
  287. package/node_modules/@sumi/plugins-precedent/dist/context-output.d.ts +15 -8
  288. package/node_modules/@sumi/plugins-precedent/dist/context-output.js +93 -34
  289. package/node_modules/@sumi/plugins-precedent/dist/context-output.js.map +1 -1
  290. package/node_modules/@sumi/plugins-precedent/dist/context-provider.js +7 -3
  291. package/node_modules/@sumi/plugins-precedent/dist/context-provider.js.map +1 -1
  292. package/node_modules/@sumi/plugins-precedent/dist/impact-state.d.ts +2 -1
  293. package/node_modules/@sumi/plugins-precedent/dist/impact-state.js +5 -4
  294. package/node_modules/@sumi/plugins-precedent/dist/impact-state.js.map +1 -1
  295. package/node_modules/@sumi/plugins-precedent/dist/impact.d.ts +7 -6
  296. package/node_modules/@sumi/plugins-precedent/dist/impact.js +33 -29
  297. package/node_modules/@sumi/plugins-precedent/dist/impact.js.map +1 -1
  298. package/node_modules/@sumi/plugins-precedent/dist/matching.d.ts +12 -0
  299. package/node_modules/@sumi/plugins-precedent/dist/matching.js +90 -0
  300. package/node_modules/@sumi/plugins-precedent/dist/matching.js.map +1 -0
  301. package/node_modules/@sumi/plugins-precedent/dist/plugins/harvest.js +44 -13
  302. package/node_modules/@sumi/plugins-precedent/dist/plugins/harvest.js.map +1 -1
  303. package/node_modules/@sumi/plugins-precedent/dist/plugins/impact.js +15 -10
  304. package/node_modules/@sumi/plugins-precedent/dist/plugins/impact.js.map +1 -1
  305. package/node_modules/@sumi/plugins-precedent/dist/plugins/planner.js +47 -6
  306. package/node_modules/@sumi/plugins-precedent/dist/plugins/planner.js.map +1 -1
  307. package/node_modules/@sumi/plugins-precedent/dist/review-candidates.d.ts +3 -0
  308. package/node_modules/@sumi/plugins-precedent/dist/review-candidates.js +40 -0
  309. package/node_modules/@sumi/plugins-precedent/dist/review-candidates.js.map +1 -0
  310. package/node_modules/@sumi/plugins-precedent/package.json +3 -3
  311. package/node_modules/@sumi/plugins-review/README.md +8 -0
  312. package/node_modules/@sumi/plugins-review/dist/batch-request.d.ts +4 -0
  313. package/node_modules/@sumi/plugins-review/dist/batch-request.js.map +1 -1
  314. package/node_modules/@sumi/plugins-review/dist/checkpoint.d.ts +6 -0
  315. package/node_modules/@sumi/plugins-review/dist/checkpoint.js +76 -0
  316. package/node_modules/@sumi/plugins-review/dist/checkpoint.js.map +1 -0
  317. package/node_modules/@sumi/plugins-review/dist/command-input.d.ts +1 -1
  318. package/node_modules/@sumi/plugins-review/dist/command-input.js +4 -4
  319. package/node_modules/@sumi/plugins-review/dist/command-input.js.map +1 -1
  320. package/node_modules/@sumi/plugins-review/dist/commands/preflight.js +0 -2
  321. package/node_modules/@sumi/plugins-review/dist/commands/preflight.js.map +1 -1
  322. package/node_modules/@sumi/plugins-review/dist/commands/stats.js +3 -3
  323. package/node_modules/@sumi/plugins-review/dist/commands/stats.js.map +1 -1
  324. package/node_modules/@sumi/plugins-review/dist/commands/submit.js +20 -6
  325. package/node_modules/@sumi/plugins-review/dist/commands/submit.js.map +1 -1
  326. package/node_modules/@sumi/plugins-review/dist/convergence.d.ts +7 -2
  327. package/node_modules/@sumi/plugins-review/dist/convergence.js +43 -5
  328. package/node_modules/@sumi/plugins-review/dist/convergence.js.map +1 -1
  329. package/node_modules/@sumi/plugins-review/dist/dispatch.d.ts +1 -0
  330. package/node_modules/@sumi/plugins-review/dist/dispatch.js +21 -12
  331. package/node_modules/@sumi/plugins-review/dist/dispatch.js.map +1 -1
  332. package/node_modules/@sumi/plugins-review/dist/plugins/checkpoint-save.d.ts +1 -0
  333. package/node_modules/@sumi/plugins-review/dist/plugins/checkpoint-save.js +4 -0
  334. package/node_modules/@sumi/plugins-review/dist/plugins/checkpoint-save.js.map +1 -0
  335. package/node_modules/@sumi/plugins-review/dist/plugins/checkpoint.d.ts +1 -0
  336. package/node_modules/@sumi/plugins-review/dist/plugins/checkpoint.js +4 -0
  337. package/node_modules/@sumi/plugins-review/dist/plugins/checkpoint.js.map +1 -0
  338. package/node_modules/@sumi/plugins-review/dist/plugins/dispatch.js +15 -3
  339. package/node_modules/@sumi/plugins-review/dist/plugins/dispatch.js.map +1 -1
  340. package/node_modules/@sumi/plugins-review/dist/plugins/independent-recheck.js +1 -1
  341. package/node_modules/@sumi/plugins-review/dist/plugins/independent-recheck.js.map +1 -1
  342. package/node_modules/@sumi/plugins-review/dist/plugins/validation.js +2 -1
  343. package/node_modules/@sumi/plugins-review/dist/plugins/validation.js.map +1 -1
  344. package/node_modules/@sumi/plugins-review/dist/precedent-context.d.ts +7 -0
  345. package/node_modules/@sumi/plugins-review/dist/precedent-context.js +28 -0
  346. package/node_modules/@sumi/plugins-review/dist/precedent-context.js.map +1 -0
  347. package/node_modules/@sumi/plugins-review/dist/preflight.d.ts +1 -0
  348. package/node_modules/@sumi/plugins-review/dist/preflight.js +32 -24
  349. package/node_modules/@sumi/plugins-review/dist/preflight.js.map +1 -1
  350. package/node_modules/@sumi/plugins-review/dist/report.d.ts +9 -0
  351. package/node_modules/@sumi/plugins-review/dist/report.js +28 -7
  352. package/node_modules/@sumi/plugins-review/dist/report.js.map +1 -1
  353. package/node_modules/@sumi/plugins-review/dist/resolved-blockers.d.ts +9 -0
  354. package/node_modules/@sumi/plugins-review/dist/resolved-blockers.js +50 -0
  355. package/node_modules/@sumi/plugins-review/dist/resolved-blockers.js.map +1 -0
  356. package/node_modules/@sumi/plugins-review/dist/review-evidence.d.ts +2 -2
  357. package/node_modules/@sumi/plugins-review/dist/review-evidence.js +24 -12
  358. package/node_modules/@sumi/plugins-review/dist/review-evidence.js.map +1 -1
  359. package/node_modules/@sumi/plugins-review/dist/review-scope.d.ts +1 -0
  360. package/node_modules/@sumi/plugins-review/dist/review-scope.js +2 -0
  361. package/node_modules/@sumi/plugins-review/dist/review-scope.js.map +1 -0
  362. package/node_modules/@sumi/plugins-review/dist/review-slices.d.ts +13 -0
  363. package/node_modules/@sumi/plugins-review/dist/review-slices.js +60 -0
  364. package/node_modules/@sumi/plugins-review/dist/review-slices.js.map +1 -0
  365. package/node_modules/@sumi/plugins-review/dist/review.d.ts +103 -24
  366. package/node_modules/@sumi/plugins-review/dist/review.js +439 -84
  367. package/node_modules/@sumi/plugins-review/dist/review.js.map +1 -1
  368. package/node_modules/@sumi/plugins-review/dist/rubric-check.d.ts +3 -1
  369. package/node_modules/@sumi/plugins-review/dist/rubric-check.js +232 -72
  370. package/node_modules/@sumi/plugins-review/dist/rubric-check.js.map +1 -1
  371. package/node_modules/@sumi/plugins-review/dist/startup-context.js +3 -2
  372. package/node_modules/@sumi/plugins-review/dist/startup-context.js.map +1 -1
  373. package/node_modules/@sumi/plugins-review/dist/stats.d.ts +1 -0
  374. package/node_modules/@sumi/plugins-review/dist/stats.js +11 -15
  375. package/node_modules/@sumi/plugins-review/dist/stats.js.map +1 -1
  376. package/node_modules/@sumi/plugins-review/dist/submission.js +92 -42
  377. package/node_modules/@sumi/plugins-review/dist/submission.js.map +1 -1
  378. package/node_modules/@sumi/plugins-review/dist/submit-continuation.d.ts +2 -0
  379. package/node_modules/@sumi/plugins-review/dist/submit-continuation.js +143 -0
  380. package/node_modules/@sumi/plugins-review/dist/submit-continuation.js.map +1 -0
  381. package/node_modules/@sumi/plugins-review/dist/submit-files.d.ts +3 -0
  382. package/node_modules/@sumi/plugins-review/dist/submit-files.js +55 -0
  383. package/node_modules/@sumi/plugins-review/dist/submit-files.js.map +1 -0
  384. package/node_modules/@sumi/plugins-review/dist/support-scope.d.ts +2 -0
  385. package/node_modules/@sumi/plugins-review/dist/support-scope.js +15 -0
  386. package/node_modules/@sumi/plugins-review/dist/support-scope.js.map +1 -1
  387. package/node_modules/@sumi/plugins-review/dist/tickets.d.ts +2 -0
  388. package/node_modules/@sumi/plugins-review/dist/tickets.js +41 -3
  389. package/node_modules/@sumi/plugins-review/dist/tickets.js.map +1 -1
  390. package/node_modules/@sumi/plugins-review/dist/upgrade-flow-plan.js +27 -0
  391. package/node_modules/@sumi/plugins-review/dist/upgrade-flow-plan.js.map +1 -1
  392. package/node_modules/@sumi/plugins-review/dist/upgrade.js +10 -1
  393. package/node_modules/@sumi/plugins-review/dist/upgrade.js.map +1 -1
  394. package/node_modules/@sumi/plugins-review/dist/validation-receipt.js +4 -2
  395. package/node_modules/@sumi/plugins-review/dist/validation-receipt.js.map +1 -1
  396. package/node_modules/@sumi/plugins-review/package.json +6 -6
  397. package/node_modules/@sumi/plugins-review/sumi-plugins.yaml +12 -0
  398. package/package.json +10 -10
@@ -0,0 +1,261 @@
1
+ import { existsSync, readFileSync, statSync } from 'node:fs';
2
+ import { execFileSync, spawn } from 'node:child_process';
3
+ import { join } from 'node:path';
4
+ import { configFile, projectEntryPath, cleanEnv, withoutSessionEnv } from '@sumi/plugin-sdk';
5
+ import { parse } from 'yaml';
6
+ import { SNAPSHOT_SCHEMA } from './snapshot.js';
7
+ const isComplete = (progress) => !progress?.length || progress.every((item) => item.done >= item.total);
8
+ /**
9
+ * 检出的看板归属,规则见本机 hub 的规格:默认分支不上看板;已合并进最右列;有等待原因进第一列;
10
+ * 没有完整运行进开发中;最近完整运行通过且任务做完进最右列,否则回开发中;其余进检查与评审,
11
+ * 最近一次受阻或最近两次完整运行连续失败归“需要你”。部分运行(提交前检查)不代表完整检查,不参与判断。
12
+ */
13
+ export function classifyCheckout(checkout) {
14
+ if (checkout.isDefault)
15
+ return null;
16
+ if (checkout.merged)
17
+ return { column: 'done', reason: '已合并' };
18
+ if (checkout.contribution.awaiting)
19
+ return { column: 'awaiting', reason: checkout.contribution.awaiting };
20
+ const full = checkout.runs.filter((run) => !run.partial);
21
+ const latest = full[0];
22
+ if (!latest)
23
+ return { column: 'dev', reason: '还没有完整的检查记录' };
24
+ if (latest.conclusion === 'pass')
25
+ return isComplete(checkout.contribution.progress)
26
+ ? { column: 'done', reason: '检查通过,可以合并' }
27
+ : { column: 'dev', reason: '检查通过,任务还没做完' };
28
+ if (latest.conclusion === 'blocked')
29
+ return { column: 'review', lane: 'needs-you', reason: '最近一次检查受阻' };
30
+ if (latest.conclusion === 'fail' && full[1]?.conclusion === 'fail')
31
+ return { column: 'review', lane: 'needs-you', reason: '连续两次检查失败' };
32
+ return { column: 'review', lane: 'auto', reason: latest.conclusion === 'fail' ? '检查失败,正在修复' : '检查进行中' };
33
+ }
34
+ /** 读取失败的真实原因:message 是固定短句(可含退出码),不含命令输出。其他异常一律视为“需要升级 sumi”。 */
35
+ export class SnapshotFailure extends Error {
36
+ }
37
+ const UPGRADE_MESSAGE = '需要升级 sumi';
38
+ const RUN_TIMEOUT_MS = 10_000;
39
+ const MAX_OUTPUT = 32 * 1024 * 1024;
40
+ const CLI_REJECTED = 3;
41
+ /** 项目锁定的 Sumi 入口(相对项目根),与 hook 定位项目运行时的方式一致。 */
42
+ export function projectEntry(root) {
43
+ try {
44
+ const path = configFile(root);
45
+ const config = parse(readFileSync(join(root, path ?? 'control/config.yaml'), 'utf8'));
46
+ return join(root, projectEntryPath(typeof config?.sumiPackage === 'string' ? config.sumiPackage : null));
47
+ }
48
+ catch {
49
+ return join(root, projectEntryPath(null));
50
+ }
51
+ }
52
+ /** 用该项目自己的 CLI 取快照;命令不存在、超时、非零退出或输出不是 JSON 都抛错。 */
53
+ export const runProjectCli = (projectPath, args) => new Promise((resolve, reject) => {
54
+ const entry = projectEntry(projectPath);
55
+ if (!existsSync(entry))
56
+ return reject(new SnapshotFailure('项目没有可用的 Sumi 入口(缺少依赖)'));
57
+ const child = spawn(process.execPath, [entry, 'hub', 'snapshot', ...args, '--json'], {
58
+ cwd: projectPath,
59
+ env: { ...cleanEnv(withoutSessionEnv()), SUMI_HUB: 'off' },
60
+ stdio: ['ignore', 'pipe', 'ignore'],
61
+ windowsHide: true,
62
+ });
63
+ const chunks = [];
64
+ let size = 0;
65
+ const timer = setTimeout(() => child.kill(), RUN_TIMEOUT_MS);
66
+ child.stdout.on('data', (chunk) => {
67
+ size += chunk.length;
68
+ if (size > MAX_OUTPUT)
69
+ child.kill();
70
+ else
71
+ chunks.push(chunk);
72
+ });
73
+ child.on('error', (error) => {
74
+ clearTimeout(timer);
75
+ reject(error);
76
+ });
77
+ child.on('close', (code) => {
78
+ clearTimeout(timer);
79
+ // CLI 对未知命令与版本、构建不符都以 3 退出:该检出装的 sumi 不能产出快照。
80
+ if (code === CLI_REJECTED)
81
+ return reject(new Error('项目 CLI 拒绝快照命令'));
82
+ if (code !== 0 || size > MAX_OUTPUT)
83
+ return reject(new SnapshotFailure(`快照命令退出码 ${code}`));
84
+ try {
85
+ resolve(JSON.parse(Buffer.concat(chunks).toString('utf8')));
86
+ }
87
+ catch {
88
+ reject(new SnapshotFailure('快照命令输出不是 JSON'));
89
+ }
90
+ });
91
+ });
92
+ /** 解析 `git worktree list --porcelain`:跳过裸仓库与可清理项。 */
93
+ export function parseWorktreeList(text) {
94
+ const paths = [];
95
+ for (const block of text.split(/\r?\n\r?\n/)) {
96
+ const lines = block.split(/\r?\n/).filter(Boolean);
97
+ const head = lines.find((line) => line.startsWith('worktree '));
98
+ if (!head || lines.some((line) => line === 'bare' || line.startsWith('prunable')))
99
+ continue;
100
+ paths.push(head.slice('worktree '.length));
101
+ }
102
+ return paths;
103
+ }
104
+ /** 项目的候选检出:登记路径在前,其余存在的 worktree 在后;git 不可用时只有登记路径。 */
105
+ export function listCheckouts(projectPath) {
106
+ try {
107
+ const output = execFileSync('git', ['worktree', 'list', '--porcelain'], {
108
+ cwd: projectPath,
109
+ env: cleanEnv(withoutSessionEnv()),
110
+ timeout: 3000,
111
+ encoding: 'utf8',
112
+ stdio: ['ignore', 'pipe', 'ignore'],
113
+ windowsHide: true,
114
+ });
115
+ const others = parseWorktreeList(output).filter((path) => path !== projectPath && existsSync(path));
116
+ return Promise.resolve([projectPath, ...others]);
117
+ }
118
+ catch {
119
+ return Promise.resolve([projectPath]);
120
+ }
121
+ }
122
+ const isSnapshot = (value) => {
123
+ const snapshot = value;
124
+ return (!!snapshot &&
125
+ typeof snapshot === 'object' &&
126
+ snapshot.schemaVersion === SNAPSHOT_SCHEMA &&
127
+ Array.isArray(snapshot.checkouts) &&
128
+ Array.isArray(snapshot.sessions));
129
+ };
130
+ /** 带超时之外的汇总保护:短时缓存、同项目并发共用一次执行、同时运行的子进程数量上限。 */
131
+ export function createCollector(options) {
132
+ const run = options.run ?? runProjectCli;
133
+ const listFor = options.checkouts ?? listCheckouts;
134
+ const ttl = options.ttlMs ?? 15_000;
135
+ const limit = options.concurrency ?? 4;
136
+ const now = options.now ?? Date.now;
137
+ /** checkout 是上次成功读出快照的检出;详情与下次读取优先用它。 */
138
+ const cache = new Map();
139
+ const inflight = new Map();
140
+ const waiting = [];
141
+ let active = 0;
142
+ const slot = async (work) => {
143
+ while (active >= limit)
144
+ await new Promise((resolve) => waiting.push(resolve));
145
+ active += 1;
146
+ try {
147
+ return await work();
148
+ }
149
+ finally {
150
+ active -= 1;
151
+ waiting.shift()?.();
152
+ }
153
+ };
154
+ return {
155
+ /** 项目快照;读不出来时 snapshot 为 null(failure 给出原因)。读取时间是最近一次成功读取。 */
156
+ project(path) {
157
+ const cached = cache.get(path);
158
+ if (cached && now() - cached.at < ttl)
159
+ return Promise.resolve(cached.value);
160
+ const pending = inflight.get(path) ??
161
+ slot(async () => {
162
+ const started = now();
163
+ const preferred = cache.get(path)?.checkout;
164
+ const all = await listFor(path);
165
+ const order = preferred && all.includes(preferred) ? [preferred, ...all.filter((one) => one !== preferred)] : all;
166
+ let failure = UPGRADE_MESSAGE;
167
+ let found = null;
168
+ for (const checkout of order) {
169
+ // 逐个尝试共用一个单项目时限,避免 worktree 很多时拖住并发名额。
170
+ if (found || (checkout !== order[0] && now() - started >= RUN_TIMEOUT_MS))
171
+ break;
172
+ try {
173
+ const raw = await run(checkout, []);
174
+ if (isSnapshot(raw))
175
+ found = { checkout, snapshot: raw };
176
+ else
177
+ failure = UPGRADE_MESSAGE;
178
+ }
179
+ catch (error) {
180
+ failure = error instanceof SnapshotFailure ? error.message : UPGRADE_MESSAGE;
181
+ }
182
+ }
183
+ const value = found
184
+ ? { readAt: now(), snapshot: found.snapshot }
185
+ : { readAt: cache.get(path)?.value.readAt ?? 0, snapshot: null, failure };
186
+ cache.set(path, { at: now(), value, checkout: found?.checkout });
187
+ return value;
188
+ }).finally(() => inflight.delete(path));
189
+ inflight.set(path, pending);
190
+ return pending;
191
+ },
192
+ /** 会话明细不缓存:事件追加靠偏移续读。 */
193
+ detail: (path, args) => slot(() => run(cache.get(path)?.checkout ?? path, args)),
194
+ };
195
+ }
196
+ export const projectId = (path) => Buffer.from(path).toString('base64url');
197
+ function sessionCard(project, session) {
198
+ return {
199
+ id: `${project.id}:${session.id}`,
200
+ kind: 'session',
201
+ projectId: project.id,
202
+ project: project.name,
203
+ column: 'awaiting',
204
+ reason: session.awaiting ?? '',
205
+ title: session.title ?? session.session ?? session.id,
206
+ host: session.host,
207
+ updatedAt: session.updatedAt,
208
+ };
209
+ }
210
+ export async function buildBoard(projects, collector) {
211
+ const views = await Promise.all(projects.map(async (entry) => {
212
+ const base = { id: projectId(entry.path), name: entry.path.split(/[\\/]/).filter(Boolean).at(-1) ?? entry.path, path: entry.path };
213
+ if (!existsSync(entry.path) || !statSync(entry.path).isDirectory())
214
+ return { project: { ...base, status: 'stale', message: '已失效', readAt: null }, snapshot: null };
215
+ const { readAt, snapshot, failure } = await collector.project(entry.path);
216
+ return snapshot
217
+ ? { project: { ...base, name: snapshot.name, status: 'ok', readAt }, snapshot }
218
+ : {
219
+ project: {
220
+ ...base,
221
+ status: failure && failure !== UPGRADE_MESSAGE ? 'error' : 'upgrade',
222
+ message: failure ?? UPGRADE_MESSAGE,
223
+ readAt: readAt || null,
224
+ },
225
+ snapshot: null,
226
+ };
227
+ }));
228
+ const cards = [];
229
+ const sessions = [];
230
+ for (const { project, snapshot } of views) {
231
+ for (const session of snapshot?.sessions ?? [])
232
+ sessions.push({ ...session, projectId: project.id, project: project.name });
233
+ for (const checkout of snapshot?.checkouts ?? []) {
234
+ const placed = classifyCheckout(checkout);
235
+ if (!placed)
236
+ continue;
237
+ cards.push({
238
+ id: `${project.id}:${checkout.path}`,
239
+ kind: 'branch',
240
+ projectId: project.id,
241
+ project: project.name,
242
+ ...placed,
243
+ title: checkout.branch ?? '(分离的提交)',
244
+ branch: checkout.branch ?? undefined,
245
+ progress: checkout.contribution.progress,
246
+ runs: checkout.runs,
247
+ });
248
+ }
249
+ for (const session of snapshot?.sessions ?? [])
250
+ if (session.awaiting)
251
+ cards.push(sessionCard(project, session));
252
+ }
253
+ return {
254
+ generatedAt: Date.now(),
255
+ projects: views.map((view) => view.project),
256
+ cards,
257
+ sessions: sessions.sort((left, right) => (right.updatedAt ?? '').localeCompare(left.updatedAt ?? '')),
258
+ needsYou: cards.filter((card) => card.lane === 'needs-you' || (card.kind === 'session' && card.column === 'awaiting')).length,
259
+ };
260
+ }
261
+ //# sourceMappingURL=board.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board.js","sourceRoot":"","sources":["../../src/hub/board.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAqE,MAAM,eAAe,CAAC;AAKnH,MAAM,UAAU,GAAG,CAAC,QAA+E,EAAE,EAAE,CACrG,CAAC,QAAQ,EAAE,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAA0B;IACzD,IAA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CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;QAC3C,KAAK;QACL,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QACrG,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM;KAC9H,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface HubStatus {
2
+ running: boolean;
3
+ url: string | null;
4
+ pid: number | null;
5
+ startedAt: number | null;
6
+ projects: number;
7
+ stale: number;
8
+ diagnostic: string | null;
9
+ }
10
+ /** hub 的当前状态;状态文件、进程存活与健康检查都通过才算运行。 */
11
+ export declare function hubStatus(timeoutMs?: number): Promise<HubStatus>;
12
+ /** 一行摘要,供 `sumi hub status` 与 `sumi doctor` 共用。 */
13
+ export declare function describeHub(status: HubStatus): string;
@@ -0,0 +1,86 @@
1
+ import { existsSync, readFileSync, statSync } from 'node:fs';
2
+ import { KernelError } from '@sumi/kernel';
3
+ import { registerCommand, requireRoot } from '../cli.js';
4
+ import { HubRunningError, startHub } from './server.js';
5
+ import { hubFiles, pidAlive, probeHub, readHubState, readProjects, releaseHubFiles } from './state.js';
6
+ import { buildSnapshot, sessionDetail } from './snapshot.js';
7
+ /** hub 的当前状态;状态文件、进程存活与健康检查都通过才算运行。 */
8
+ export async function hubStatus(timeoutMs = 1000) {
9
+ const running = await probeHub(timeoutMs);
10
+ const projects = readProjects();
11
+ const { diagnostic } = hubFiles();
12
+ return {
13
+ running: running !== null,
14
+ url: running?.url ?? null,
15
+ pid: running?.state.pid ?? null,
16
+ startedAt: running?.state.startedAt ?? null,
17
+ projects: projects.length,
18
+ stale: projects.filter((entry) => !existsSync(entry.path) || !statSync(entry.path).isDirectory()).length,
19
+ diagnostic: existsSync(diagnostic) ? readFileSync(diagnostic, 'utf8').trim() : null,
20
+ };
21
+ }
22
+ /** 一行摘要,供 `sumi hub status` 与 `sumi doctor` 共用。 */
23
+ export function describeHub(status) {
24
+ const projects = `已登记 ${status.projects} 个项目${status.stale ? `,${status.stale} 个已失效` : ''}`;
25
+ return status.running ? `hub 运行中:${status.url},${projects}` : `hub 未运行(下次会话开始时自动拉起),${projects}`;
26
+ }
27
+ const SESSION_ID = /^[0-9a-f]{32}$/;
28
+ registerCommand('hub', '本机常驻 hub:sumi hub <serve|status|stop|snapshot>(snapshot 为只读:[--session <id> [--after <偏移>] [--confirmations]])', { flags: ['session', 'after', 'confirmations'], booleanFlags: ['confirmations'] }, async (args, io, root) => {
29
+ const action = args.positionals[0];
30
+ if (action === 'snapshot') {
31
+ const session = args.flags.session;
32
+ if (session !== undefined && (typeof session !== 'string' || !SESSION_ID.test(session)))
33
+ throw new KernelError('--session 必须是 32 位十六进制会话标识');
34
+ const after = Number(args.flags.after ?? 0);
35
+ if (!Number.isSafeInteger(after) || after < 0)
36
+ throw new KernelError('--after 必须是非负整数');
37
+ const project = requireRoot(root);
38
+ const value = session
39
+ ? sessionDetail(project, session, { confirmations: args.flags.confirmations === true, after })
40
+ : buildSnapshot(project);
41
+ io.out(JSON.stringify(value));
42
+ return 0;
43
+ }
44
+ if (action === 'serve') {
45
+ const hub = await startHub().catch((error) => {
46
+ if (error instanceof HubRunningError)
47
+ return null;
48
+ throw error;
49
+ });
50
+ if (!hub) {
51
+ io.out(describeHub(await hubStatus()));
52
+ return 0;
53
+ }
54
+ io.out(`Sumi hub:${hub.url}`);
55
+ const stop = () => void hub.close();
56
+ process.once('SIGINT', stop);
57
+ process.once('SIGTERM', stop);
58
+ await hub.closed;
59
+ return 0;
60
+ }
61
+ if (action === 'status') {
62
+ const status = await hubStatus();
63
+ io.out([
64
+ describeHub(status),
65
+ ...(status.pid ? [`进程号 ${status.pid},启动于 ${new Date(status.startedAt).toLocaleString('zh-CN', { hour12: false })}`] : []),
66
+ ...(status.diagnostic ? [`最近一次诊断:${status.diagnostic}`] : []),
67
+ ].join('\n'));
68
+ return 0;
69
+ }
70
+ if (action === 'stop') {
71
+ const state = readHubState();
72
+ if (state && pidAlive(state.pid) && (await probeHub(1000))) {
73
+ process.kill(state.pid, 'SIGTERM');
74
+ for (let waited = 0; waited < 3000 && pidAlive(state.pid); waited += 100)
75
+ await new Promise((resolve) => setTimeout(resolve, 100));
76
+ io.out(pidAlive(state.pid) ? `已发送停止信号,进程 ${state.pid} 仍在退出` : 'hub 已停止');
77
+ }
78
+ else
79
+ io.out('hub 没有运行');
80
+ // 进程已结束或进程号被其他程序复用时,兜底清理状态与锁
81
+ releaseHubFiles();
82
+ return 0;
83
+ }
84
+ throw new KernelError('用法:sumi hub <serve|status|stop|snapshot>');
85
+ });
86
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/hub/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACvG,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAY7D,uCAAuC;AACvC,MAAM,CAAC,KAAK,UAAU,S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MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;QAC7B,IAAI,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YACnC,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,GAAG;gBAAE,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;YACnI,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC3E,CAAC;;YAAM,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1B,6BAA6B;QAC7B,eAAe,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,IAAI,WAAW,CAAC,0CAA0C,CAAC,CAAC;AACpE,CAAC,CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const BOARD_PAGE: string;
2
+ export declare const SESSIONS_PAGE: string;
@@ -0,0 +1,136 @@
1
+ // hub 的两个自包含只读页面:无外部字体与脚本,数据来自同源的 JSON 接口,动态内容一律用 textContent。
2
+ // 版式与配色来自设计稿;所有按钮只用于导航、筛选与展开,没有提交类控件。
3
+ const STYLE = `:root{--bg:#F6F6F4;--surface:#fff;--soft:#EFEFEC;--line:#E4E4E0;--ink:#1F1F1C;--ink2:#3A3A36;--muted:#6B6B66;--faint:#8A8A84;--blue:#1D4ED8;--blue-soft:#EEF2FF;--blue-ink:#3730A3;--dev-bg:#F2F6FE;--dev-line:#C9D8F8;--orange:#C2410C;--auto-bg:#FFF8F1;--auto-line:#F1D9C2;--red:#B42318;--red-bg:#FDF1F0;--red-line:#F0C4BF;--green:#15803D;--green-soft:#E7F5EC;--green-ink:#166534;color-scheme:light;font-family:Inter,"PingFang SC","Microsoft YaHei","Noto Sans SC",system-ui,sans-serif}
4
+ @media (prefers-color-scheme:dark){:root{--bg:#161614;--surface:#20201D;--soft:#2A2A26;--line:#34342F;--ink:#ECECE8;--ink2:#D2D2CC;--muted:#A2A29A;--faint:#85857D;--blue:#7BA0FF;--blue-soft:#232A45;--blue-ink:#B6C6FF;--dev-bg:#1C2338;--dev-line:#2F3C63;--orange:#F0985F;--auto-bg:#2D241C;--auto-line:#4A3926;--red:#FF8E84;--red-bg:#3A2321;--red-line:#5F3531;--green:#6FCF8D;--green-soft:#1F3427;--green-ink:#8FE0A9;color-scheme:dark}}
5
+ *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-size:14px}
6
+ .mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
7
+ a{color:var(--blue)}button,select{font:inherit;color:inherit}
8
+ header.top{display:flex;flex-wrap:wrap;align-items:center;gap:16px;padding:12px 24px;background:var(--surface);border-bottom:1px solid var(--line)}
9
+ .brand{display:flex;align-items:center;gap:10px;flex:1 1 200px}.brand strong{font-size:18px}.brand span{font-size:13px;color:var(--muted)}
10
+ nav.tabs{display:flex;gap:2px;padding:3px;background:var(--soft);border-radius:10px}
11
+ nav.tabs a{padding:7px 18px;border-radius:8px;font-size:14px;font-weight:500;color:var(--muted);text-decoration:none}
12
+ nav.tabs a[aria-current="page"]{background:var(--surface);color:var(--ink);box-shadow:0 1px 2px rgba(0,0,0,.12)}
13
+ nav.tabs a:focus-visible,.card:focus-visible,.pill:focus-visible,.sess:focus-visible,.row:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
14
+ .right{flex:1 1 200px;display:flex;justify-content:flex-end;gap:8px}
15
+ #need{display:inline-flex;gap:6px;align-items:center;padding:6px 12px;border-radius:8px;background:var(--red-bg);color:var(--red);font-weight:600;font-size:13px}#need[hidden]{display:none}
16
+ .filters{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:10px 24px;background:var(--surface);border-bottom:1px solid var(--line);font-size:13px}
17
+ .filters label{color:var(--muted)}.filters select{padding:5px 8px;border-radius:8px;border:1px solid var(--line);background:var(--surface)}
18
+ .projects{display:flex;gap:8px;overflow-x:auto;flex:1 1 400px;min-width:0;padding:2px 0}
19
+ .proj{display:flex;gap:8px;align-items:center;padding:5px 10px;border-radius:8px;border:1px solid var(--line);background:var(--bg);white-space:nowrap;font-size:13px}.proj .mono{color:var(--blue);font-weight:500}.proj em{font-style:normal;color:var(--muted)}.proj.warn em{color:var(--orange)}
20
+ .body{display:flex;flex-wrap:wrap;align-items:stretch}
21
+ .board{flex:999 1 760px;min-width:0;display:grid;grid-template-columns:repeat(4,minmax(220px,1fr));gap:16px;padding:18px 24px;overflow-x:auto;align-content:start}
22
+ .col{display:flex;flex-direction:column;gap:10px}
23
+ .col h2{margin:0;font-size:14px;font-weight:600;display:flex;align-items:center;gap:8px}.col h2 i{width:8px;height:8px;border-radius:4px;display:inline-block}.col h2 span{color:var(--faint);font-weight:500}
24
+ .col p.hint{margin:0;font-size:12px;color:var(--muted)}
25
+ .lane{display:flex;flex-direction:column;gap:2px;margin-top:6px}.lane strong{font-size:13px}.lane span{font-size:12px;color:var(--muted)}.lane.urgent strong{color:var(--red)}
26
+ .empty{font-size:12px;color:var(--faint);padding:8px 2px}
27
+ .card{all:unset;box-sizing:border-box;display:flex;flex-direction:column;gap:6px;width:100%;padding:12px 14px;border-radius:10px;background:var(--surface);border:1px solid var(--line);cursor:pointer;text-align:left}
28
+ .card:hover{border-color:var(--faint)}.card[aria-pressed="true"]{box-shadow:0 0 0 2px var(--blue)}
29
+ .card.dev{background:var(--dev-bg);border-color:var(--dev-line)}.card.auto{background:var(--auto-bg);border-color:var(--auto-line)}.card.need{background:var(--red-bg);border-color:var(--red-line)}
30
+ .card .t{display:flex;justify-content:space-between;gap:8px;align-items:flex-start}.card .t strong{font-size:15px;line-height:21px;overflow-wrap:anywhere}
31
+ .chip{display:inline-flex;align-items:center;gap:4px;padding:2px 7px;border-radius:6px;font-size:12px;font-weight:500;line-height:18px;background:var(--soft);color:var(--ink2)}
32
+ .card .m{font-size:12px;color:var(--muted);overflow-wrap:anywhere}.card.need .m{color:var(--red);font-weight:600}
33
+ .bar{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted)}.bar .track{flex:1 1 auto;height:4px;border-radius:2px;background:var(--line);overflow:hidden}.bar .track b{display:block;height:4px;background:var(--orange)}
34
+ aside.detail{flex:1 1 400px;max-width:100%;background:var(--surface);border-left:1px solid var(--line);padding:22px 24px;display:flex;flex-direction:column;gap:18px}
35
+ aside.detail h1{margin:0;font-size:22px;line-height:30px;overflow-wrap:anywhere}aside.detail h2{margin:0;font-size:15px}
36
+ .chips{display:flex;flex-wrap:wrap;gap:6px}.status{font-size:13px;font-weight:600}
37
+ .runs{display:flex;flex-direction:column;gap:8px}.run{display:flex;align-items:center;gap:10px;font-size:13px}.run .mono{flex:1 1 auto;overflow-wrap:anywhere}.run span.st{min-width:44px;justify-content:center}
38
+ .st.pass{background:var(--green-soft);color:var(--green-ink)}.st.fail,.st.blocked{background:var(--red-bg);color:var(--red)}.st.pending{background:var(--soft);color:var(--muted)}
39
+ .note{margin:0;color:var(--muted);font-size:12px;line-height:1.7}
40
+ .layout{display:flex;flex-wrap:wrap;align-items:stretch}
41
+ nav.list{flex:1 1 280px;max-width:100%;padding:16px 12px;background:var(--surface);border-right:1px solid var(--line);display:flex;flex-direction:column;gap:4px;max-height:calc(100vh - 56px);overflow:auto}
42
+ .sess{all:unset;box-sizing:border-box;display:flex;flex-direction:column;gap:3px;width:100%;padding:10px 12px;border-radius:8px;cursor:pointer;min-height:44px}.sess:hover{background:var(--soft)}.sess[aria-current="true"]{background:var(--blue-soft)}
43
+ .sess .t{display:flex;justify-content:space-between;gap:8px}.sess strong{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sess .m{font-size:12px;color:var(--muted)}
44
+ main.sessions{flex:999 1 640px;min-width:0;padding:22px 28px;display:flex;flex-direction:column;gap:18px}
45
+ main.sessions h1{margin:0;font-size:24px;overflow-wrap:anywhere}.meta{font-size:13px;color:var(--muted);overflow-wrap:anywhere}
46
+ .stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}.stat{padding:14px;border-radius:10px;background:var(--surface);border:1px solid var(--line);display:flex;flex-direction:column;gap:4px}.stat span{font-size:12px;color:var(--muted)}.stat strong{font-size:24px}
47
+ .pills{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.pill{all:unset;box-sizing:border-box;display:inline-flex;gap:6px;align-items:center;padding:6px 12px;border-radius:999px;font-size:13px;cursor:pointer;border:1px solid var(--line);min-height:32px}.pill[aria-pressed="true"]{background:var(--blue);border-color:var(--blue);color:var(--surface)}
48
+ ol.events{margin:0;padding:0;list-style:none;background:var(--surface);border:1px solid var(--line);border-radius:10px;overflow:hidden}
49
+ ol.events li{border-bottom:1px solid var(--line);padding:12px 14px}ol.events li:last-child{border-bottom:0}
50
+ ol.events[data-view="deliveries"] li.hidden-by-view{display:none}
51
+ .row{display:flex;gap:12px;align-items:flex-start;flex-wrap:wrap}.row time{font-size:12px;color:var(--muted);width:56px;flex:none;padding-top:2px}
52
+ .kind{flex:none;background:var(--blue-soft);color:var(--blue-ink)}.kind.read{background:var(--green-soft);color:var(--green-ink)}.kind.prompt{background:#FFF1E3;color:#9A3412}.kind.plain{background:var(--soft);color:var(--ink2)}
53
+ .what{display:flex;flex-direction:column;gap:3px;flex:1 1 200px;min-width:0}.what b{font-weight:500;overflow-wrap:anywhere}.what small{font-size:12px;color:var(--muted)}
54
+ .tag{font-size:11px;font-weight:650;padding:2px 7px;border-radius:5px;background:var(--soft);color:var(--ink2)}.tag.ok{background:var(--green-soft);color:var(--green-ink)}.tag.bad{background:var(--red-bg);color:var(--red)}
55
+ details{margin:8px 0 0 68px}summary{cursor:pointer;font-size:12px;color:var(--blue);font-weight:600}
56
+ pre{white-space:pre-wrap;overflow-wrap:anywhere;font:12px/1.6 ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--bg);border-radius:8px;padding:11px;max-height:480px;overflow:auto;margin:8px 0 0}
57
+ @media(max-width:820px){.board{padding:14px 16px}header.top,.filters{padding:10px 16px}aside.detail{border-left:0;border-top:1px solid var(--line)}nav.list{border-right:0;border-bottom:1px solid var(--line);max-height:300px}details{margin-left:0}}`;
58
+ const shell = (title, active, content, script) => `<!doctype html>
59
+ <html lang="zh-CN">
60
+ <head>
61
+ <meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
62
+ <title>${title}</title>
63
+ <style>${STYLE}</style>
64
+ </head><body>
65
+ <header class="top">
66
+ <div class="brand"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M4 6h16M4 12h10M4 18h6"/></svg><strong>Sumi</strong><span id="summary">读取中</span></div>
67
+ <nav class="tabs" aria-label="视图"><a href="/"${active === 'board' ? ' aria-current="page"' : ''}>看板</a><a href="/sessions"${active === 'sessions' ? ' aria-current="page"' : ''}>会话</a></nav>
68
+ <div class="right"><span id="need" hidden></span></div>
69
+ </header>
70
+ ${content}
71
+ <script>
72
+ const byId=(id)=>document.getElementById(id);
73
+ const make=(tag,className,value)=>{const node=document.createElement(tag);if(className)node.className=className;if(value!==undefined)node.textContent=String(value);return node};
74
+ const clock=(value)=>{const date=new Date(value);return Number.isNaN(date.getTime())?'时间未知':date.toLocaleTimeString('zh-CN',{hour12:false})};
75
+ const stamp=(value)=>{const date=new Date(value);return Number.isNaN(date.getTime())?'':date.toLocaleString('zh-CN',{hour12:false,month:'numeric',day:'numeric',hour:'2-digit',minute:'2-digit'})};
76
+ const getJson=async(url)=>{const response=await fetch(url,{cache:'no-store'});if(!response.ok)throw new Error(String(response.status));return response.json()};
77
+ ${script}
78
+ </script></body></html>`;
79
+ const BOARD_SCRIPT = `
80
+ const COLUMNS=[['awaiting','待确认','var(--faint)','代理在等你确认后才继续'],['dev','开发中','var(--blue)','还没有完整的检查,或任务没做完'],['review','检查与评审','var(--orange)',''],['done','可合并与已合并','var(--green)','检查通过且任务完成,或已合并进默认分支']];
81
+ const RUN={pass:'通过',fail:'失败',blocked:'受阻',pending:'进行中'};
82
+ let board=null;let project='';let selected='';
83
+ const visible=()=>board.cards.filter((card)=>!project||card.projectId===project);
84
+ function pct(card){const items=card.progress||[];const total=items.reduce((sum,item)=>sum+item.total,0);return total?Math.round(items.reduce((sum,item)=>sum+item.done,0)/total*100):0}
85
+ function renderCard(card){const button=make('button','card '+(card.lane==='needs-you'?'need':card.lane==='auto'?'auto':card.column==='dev'?'dev':''));button.type='button';button.setAttribute('aria-pressed',String(card.id===selected));const top=make('span','t');top.append(make('strong','',card.title),make('span','chip mono',card.project));button.append(top);if(card.kind==='branch'&&card.progress&&card.progress.length){const bar=make('span','bar');const track=make('span','track');const fill=make('b');fill.style.width=pct(card)+'%';track.append(fill);bar.append(track,document.createTextNode(card.progress.map((item)=>item.label+' '+item.done+'/'+item.total).join('、')));button.append(bar)}button.append(make('span','m',(card.kind==='session'?'会话 · ':'')+card.reason));button.addEventListener('click',()=>{selected=card.id;render()});return button}
86
+ function column(def,cards){const section=make('section','col');const heading=make('h2');const dot=make('i');dot.style.background=def[2];heading.append(dot,document.createTextNode(def[1]+' '),make('span','',cards.length));section.append(heading);if(def[3])section.append(make('p','hint',def[3]));return section}
87
+ function render(){if(!board)return;const cards=visible();const root=byId('board');root.replaceChildren();for(const def of COLUMNS){const mine=cards.filter((card)=>card.column===def[0]);const section=column(def,mine);if(def[0]==='review'){const need=mine.filter((card)=>card.lane==='needs-you');const auto=mine.filter((card)=>card.lane!=='needs-you');const a=make('div','lane urgent');a.append(make('strong','','需要你 '+need.length),make('span','','代理处理不了:检查受阻或连续两次失败'));section.append(a,...need.map(renderCard));const b=make('div','lane');b.append(make('strong','','自动处理中 '+auto.length),make('span','','检查在跑或刚失败一次,先不用看'));section.append(b,...auto.map(renderCard))}else{section.append(...mine.map(renderCard));if(!mine.length)section.append(make('div','empty','暂无'))}root.append(section)}
88
+ const branches=board.cards.filter((card)=>card.kind==='branch').length;byId('summary').textContent='本机 '+board.projects.length+' 个项目 · '+branches+' 个分支';const need=byId('need');need.hidden=!board.needsYou;need.textContent='需要你 '+board.needsYou;
89
+ const picker=byId('project');if(picker.options.length!==board.projects.length+1){picker.replaceChildren(new Option('全部项目',''),...board.projects.map((entry)=>new Option(entry.name,entry.id)));picker.value=project}
90
+ byId('projects').replaceChildren(...board.projects.map((entry)=>{const box=make('div','proj'+(entry.status==='ok'?'':' warn'));box.append(make('span','mono',entry.name),make('em','',entry.status==='ok'?'读取于 '+clock(entry.readAt):(entry.message||'')+(entry.readAt?' · 上次读取 '+clock(entry.readAt):'')));return box}));
91
+ renderDetail(cards.find((card)=>card.id===selected))}
92
+ function renderDetail(card){const box=byId('detail');box.replaceChildren();if(!card){box.append(make('p','note','选择一张卡片查看详情。看板只读:要回答问题或做决定,请回到对应的 AI 会话。'));return}
93
+ const chips=make('div','chips');chips.append(make('span','chip mono',card.branch||card.title),make('span','chip',card.project));if(card.host)chips.append(make('span','chip',card.host));box.append(chips);
94
+ const head=make('div');head.style.cssText='display:flex;flex-direction:column;gap:6px';const status=make('span','status',COLUMNS.find((def)=>def[0]===card.column)[1]+(card.lane==='needs-you'?' · 需要你':card.lane==='auto'?' · 自动处理中':''));status.style.color=card.lane==='needs-you'?'var(--red)':'var(--ink)';head.append(status,make('h1','',card.title),make('p','note',card.reason));box.append(head);
95
+ if(card.progress&&card.progress.length){const section=make('section','runs');section.append(make('h2','','任务进度'));for(const item of card.progress){const bar=make('div','bar');const track=make('span','track');const fill=make('b');fill.style.width=(item.total?Math.round(item.done/item.total*100):0)+'%';track.append(fill);bar.append(track,document.createTextNode(item.label+' '+item.done+'/'+item.total));section.append(bar)}box.append(section)}
96
+ if(card.runs&&card.runs.length){const section=make('section','runs');section.append(make('h2','','最近检查'));for(const run of card.runs){const row=make('div','run');row.append(make('span','chip st '+run.conclusion,RUN[run.conclusion]||run.conclusion),make('span','mono',run.runId+(run.partial?'(部分运行)':'')),make('span','note',stamp(run.finishedAt||run.startedAt)));section.append(row)}box.append(section)}
97
+ if(card.kind==='session'){const link=make('a','','在会话页查看');link.href='/sessions#'+card.id;box.append(link)}}
98
+ byId('project').addEventListener('change',(event)=>{project=event.target.value;render()});
99
+ async function refresh(){try{board=await getJson('/api/board');render()}catch{byId('summary').textContent='无法读取 hub 数据'}}
100
+ refresh();setInterval(refresh,5000);`;
101
+ export const BOARD_PAGE = shell('Sumi 看板', 'board', `<div class="filters"><label for="project">项目</label><select id="project"><option value="">全部项目</option></select><div id="projects" class="projects" aria-label="项目读取状态"></div></div>
102
+ <div class="body"><main id="board" class="board" aria-label="看板"></main><aside id="detail" class="detail" aria-label="详情"></aside></div>`, BOARD_SCRIPT);
103
+ const SESSIONS_SCRIPT = `
104
+ const CHANNELS={prompt:'提示词',startup:'会话开始','session-start':'会话开始',clear:'清空后',compact:'压缩后','subagent-start':'子代理启动','before-edit':'编辑前','after-edit':'编辑后','rules-fallback':'规则兜底','read-gate':'读取门槛','task-select':'任务选择','context-read':'路径查询'};
105
+ const METHODS={'additional-context':['上下文注入',''],denial:['拒绝工具调用','bad'],'tool-output':['AI 主动读取','']};
106
+ const CONFIRM={confirmed:['已进入会话记录','ok'],missing:['未找到','bad'],unknown:['无法核对','']};
107
+ const KINDS={prompt:['你的提示','prompt'],injection:['Sumi 送达',''],'agent-read':['AI 读取','read'],document:['Sumi 读取','plain'],command:['Sumi 命令','plain']};
108
+ const FILTERS=[['deliveries','送达与读取'],['all','全部事件']];
109
+ let sessions=[];let selected=decodeURIComponent(location.hash.slice(1));let events=[];let next=0;let confirmations={};let host='';let project='';let view='deliveries';
110
+ const keyOf=(item)=>item.projectId+':'+item.id;const chars=(value)=>value>=10000?(value/10000).toFixed(1)+' 万':String(value);
111
+ const current=()=>sessions.find((item)=>keyOf(item)===selected);
112
+ function filtered(){return sessions.filter((item)=>(!host||item.host===host)&&(!project||item.projectId===project))}
113
+ function renderList(){const list=byId('list');const items=filtered();list.replaceChildren(...items.map((item)=>{const button=make('button','sess');button.type='button';button.setAttribute('aria-current',String(keyOf(item)===selected));const top=make('span','t');top.append(make('strong','',item.title||item.session||item.id),make('span','mono m',stamp(item.updatedAt)));button.append(top,make('span','m',[item.project,item.host||'宿主未知','送达 '+item.deliveries+' 次',item.awaiting||''].filter(Boolean).join(' · ')));button.addEventListener('click',()=>select(keyOf(item)));return button}));if(!items.length)list.append(make('div','empty','没有会话。接线 hook 后,新的会话会出现在这里。'))}
114
+ function renderFilters(board){const hosts=[...new Set(sessions.map((item)=>item.host).filter(Boolean))];const projectBox=byId('project');if(projectBox.options.length!==board.projects.length+1){projectBox.replaceChildren(new Option('全部项目',''),...board.projects.map((entry)=>new Option(entry.name,entry.id)));projectBox.value=project}const hostBox=byId('host');if(hostBox.options.length!==hosts.length+1){hostBox.replaceChildren(new Option('全部',''),...hosts.map((name)=>new Option(name,name)));hostBox.value=host}}
115
+ function renderHeader(){const item=current();byId('title').textContent=item?item.title||'未记录提示词的会话':'选择一个会话';byId('meta').textContent=item?[item.project,item.host,item.session,item.checkouts.join('、'),item.agents.length?'子代理 '+item.agents.length+' 个':''].filter(Boolean).join(' · '):'';const stats=byId('stats');if(!item){stats.replaceChildren();return}const count=(state)=>Object.values(confirmations).filter((value)=>value===state).length;stats.replaceChildren(...[[chars(item.chars),'送达字符'],[item.deliveries,'送达次数'],[item.prompts,'你的提示'],[count('confirmed'),'已进入会话记录'],[count('missing'),'未找到'],[item.reads,'AI 主动读取'],[item.denials,'拒绝式送达']].map(([value,label])=>{const box=make('div','stat');box.append(make('span','',label),make('strong','',value));return box}))}
116
+ function groups(items){const map=new Map();for(const entry of items){if(entry.key==='catalog:complete')continue;const prefix=entry.key.split(':')[0];map.set(prefix,[...(map.get(prefix)||[]),entry])}return map}
117
+ function title(event){if(event.kind==='injection')return (CHANNELS[event.channel]||event.channel||'上下文')+(event.agent?' · 子代理':'');if(event.kind==='command')return 'sumi '+(event.command||'')+(Array.isArray(event.args)&&event.args.length?' '+event.args.join(' ').slice(0,80):'');if(event.kind==='prompt')return (event.content||'').split('\\n')[0].slice(0,160);return event.source||''}
118
+ function renderEvent(event){const row=make('li',event.kind==='injection'||event.kind==='prompt'||event.kind==='agent-read'?'':'hidden-by-view');row.dataset.at=event.at||'';const head=make('div','row');const time=make('time','',clock(event.at));if(event.at)time.dateTime=event.at;const kind=KINDS[event.kind]||[event.kind,'plain'];const what=make('span','what');what.append(make('b','',title(event)));const notes=[];if(event.kind==='injection'){const method=METHODS[event.method]||[event.method||'方式未知',''];notes.push(method[0]);if(event.checkout)notes.push('检出 '+event.checkout)}if(event.paths&&event.paths.length)notes.push('触发路径 '+event.paths.slice(0,4).join('、')+(event.paths.length>4?' 等 '+event.paths.length+' 个':''));if(event.selected&&event.selected.length)notes.push('选中 '+event.selected.join('、'));if(notes.length)what.append(make('small','',notes.join(' · ')));head.append(time,make('span','chip kind '+kind[1],kind[0]),what);if(event.kind==='injection'){const state=make('span','tag','核对中');state.dataset.confirm=event.id;head.append(state)}const text=event.kind==='command'?event.output||'':event.content||'';if(text)head.append(make('span','mono note',text.length+' 字'));row.append(head);const lines=[];for(const [prefix,group] of groups(event.items||[]))lines.push('送达 '+group.length+' 条:'+group.slice(0,6).map((entry)=>entry.key).join('、')+(group.length>6?' 等':''));const skipped=event.skipped||[];if(skipped.length)lines.push('跳过 '+skipped.length+' 条:'+skipped.slice(0,4).map((entry)=>entry.key+'('+entry.reason+')').join('、'));if(lines.length){const box=make('div','note');box.style.margin='6px 0 0 68px';box.textContent=lines.join(';');row.append(box)}if(text){const details=make('details');details.append(make('summary','','查看全文'),make('pre','',text));row.append(details)}return row}
119
+ function insert(event){const target=byId('timeline');const row=renderEvent(event);let before=null;for(let node=target.lastElementChild;node;node=node.previousElementSibling){if((node.dataset.at||'')<=(event.at||''))break;before=node}target.insertBefore(row,before)}
120
+ function applyConfirmations(){for(const [id,state] of Object.entries(confirmations)){const node=document.querySelector('[data-confirm="'+id+'"]');if(!node)continue;const def=CONFIRM[state];node.textContent=def[0];node.className='tag '+def[1]}}
121
+ async function loadEvents(key){const item=current();if(!item)return;for(let more=true;more&&key===selected;){const page=await getJson('/api/projects/'+item.projectId+'/sessions/'+item.id+'/events?after='+next);if(key!==selected)return;for(const event of page.events){events.push(event);insert(event)}more=page.more&&page.next>next;next=page.next}byId('count').textContent='共 '+events.length+' 条事件'}
122
+ async function loadConfirmations(key){const item=current();if(!item)return;try{const value=await getJson('/api/projects/'+item.projectId+'/sessions/'+item.id+'/confirmations');if(key!==selected)return;confirmations=value;applyConfirmations();renderHeader()}catch{}}
123
+ async function select(key){if(selected===key)return;selected=key;history.replaceState(null,'','#'+encodeURIComponent(key));events=[];next=0;confirmations={};byId('timeline').replaceChildren();renderList();renderHeader();try{await loadEvents(key);await loadConfirmations(key)}catch{byId('count').textContent='无法读取该会话'}}
124
+ async function refresh(){try{const board=await getJson('/api/board');sessions=board.sessions;byId('summary').textContent='本机 '+board.projects.length+' 个项目 · '+sessions.length+' 个会话';const need=byId('need');need.hidden=!board.needsYou;need.textContent='需要你 '+board.needsYou;renderFilters(board);if(!current()&&sessions[0]){selected='';await select(keyOf(sessions[0]));return}renderList();renderHeader();if(current()){history.replaceState(null,'','#'+encodeURIComponent(selected));await loadEvents(selected)}}catch{byId('summary').textContent='无法读取 hub 数据'}}
125
+ byId('project').addEventListener('change',(event)=>{project=event.target.value;renderList()});byId('host').addEventListener('change',(event)=>{host=event.target.value;renderList()});
126
+ byId('pills').replaceChildren(...FILTERS.map(([id,label])=>{const button=make('button','pill',label);button.type='button';button.setAttribute('aria-pressed',String(id===view));button.addEventListener('click',()=>{view=id;byId('timeline').dataset.view=id;for(const option of byId('pills').children)option.setAttribute('aria-pressed',String(option===button))});return button}));
127
+ addEventListener('hashchange',()=>{const key=decodeURIComponent(location.hash.slice(1));selected='';select(key)});
128
+ refresh();setInterval(refresh,3000);setInterval(()=>{if(selected)loadConfirmations(selected)},8000);`;
129
+ export const SESSIONS_PAGE = shell('Sumi 会话', 'sessions', `<div class="filters"><label for="project">项目</label><select id="project"><option value="">全部项目</option></select><label for="host">代理</label><select id="host"><option value="">全部</option></select></div>
130
+ <div class="layout"><nav id="list" class="list" aria-label="会话列表"></nav>
131
+ <main class="sessions"><div><div id="meta" class="meta"></div><h1 id="title">选择一个会话</h1></div>
132
+ <section id="stats" class="stats" aria-label="送达总量"></section>
133
+ <div id="pills" class="pills" role="group" aria-label="筛选事件"></div><span id="count" class="meta"></span>
134
+ <ol id="timeline" class="events" data-view="deliveries" aria-label="事件时间线"></ol>
135
+ <p class="note"><strong>证据范围</strong>:“已进入会话记录”表示这段正文出现在宿主的会话记录文件里,不表示 AI 理解或遵循了它。“无法核对”表示宿主没有提供会话记录。“AI 读取”来自宿主 Read 工具;Shell、MCP 和宿主自动加载的读取不在观测范围内。“Sumi 读取”只表示 Sumi 打开了文档。事件保存在各项目 git 公共目录的 sumi/sessions 下,hub 只读取,可能包含提示词和开发上下文。</p></main></div>`, SESSIONS_SCRIPT);
136
+ //# sourceMappingURL=pages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pages.js","sourceRoot":"","sources":["../../src/hub/pages.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,sCAAsC;AAEtC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wPAsD0O,CAAC;AAEzP,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,MAA4B,EAAE,OAAe,EAAE,MAAc,EAAE,EAAE,CAAC;;;;SAIvF,KAAK;SACL,KAAK;;;;+CAIiC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,6BAA6B,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE;;;EAG7K,OAAO;;;;;;;EAOP,MAAM;wBACgB,CAAC;AAEzB,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;qCAqBgB,CAAC;AAEtC,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAC7B,SAAS,EACT,OAAO,EACP;yIACuI,EACvI,YAAY,CACb,CAAC;AAEF,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;qGAyB6E,CAAC;AAEtG,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAChC,SAAS,EACT,UAAU,EACV;;;;;;wPAMsP,EACtP,eAAe,CAChB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { KernelError } from '@sumi/kernel';
2
+ import { type Collector } from './board.js';
3
+ export interface HubOptions {
4
+ /** 首选端口;被占用时顺延。0 表示由系统分配(测试用)。 */
5
+ port?: number;
6
+ idleMs?: number;
7
+ checkEveryMs?: number;
8
+ now?: () => number;
9
+ collector?: Collector;
10
+ }
11
+ /** 同一用户已有 hub 在运行。 */
12
+ export declare class HubRunningError extends KernelError {
13
+ }
14
+ export declare const IDLE_MS: number;
15
+ export interface RunningHub {
16
+ url: string;
17
+ port: number;
18
+ close: () => Promise<void>;
19
+ /** 服务关闭(主动关闭或空闲退出)后完成。 */
20
+ closed: Promise<void>;
21
+ }
22
+ /** 启动 hub:单实例、只绑定回环地址、只读。进程号锁与状态文件由本函数持有并在关闭时清理。 */
23
+ export declare function startHub(options?: HubOptions): Promise<RunningHub>;