tianshu-harness 3.23.0

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 (255) hide show
  1. package/LICENSE +189 -0
  2. package/README.en.md +1066 -0
  3. package/README.ja.md +1214 -0
  4. package/README.ko.md +1216 -0
  5. package/README.md +309 -0
  6. package/completions/rivet.bash +118 -0
  7. package/completions/rivet.fish +110 -0
  8. package/completions/rivet.ps1 +230 -0
  9. package/completions/rivet.zsh +187 -0
  10. package/dist/account-OAEKORZE.js +47 -0
  11. package/dist/account-login-V6FOLHJR.js +65 -0
  12. package/dist/account-status-KHNPPAFL.js +23 -0
  13. package/dist/agent/worker-process/child.js +407 -0
  14. package/dist/browser-cli-FLNY5ZHI.js +19 -0
  15. package/dist/browser-readiness-LWVGSBD5.js +12 -0
  16. package/dist/build-backends-5KXKR2S4.js +13 -0
  17. package/dist/build-options-66Y4ZE7C.js +9 -0
  18. package/dist/bundled-skills/brainstorming/SKILL.md +139 -0
  19. package/dist/bundled-skills/visual-acceptance/SKILL.md +64 -0
  20. package/dist/chain-7MAMFXZ3.js +10 -0
  21. package/dist/checkpoint-MND4DUIX.js +33 -0
  22. package/dist/chunk-2E6CK2RC.js +392 -0
  23. package/dist/chunk-2EBWGAXD.js +51 -0
  24. package/dist/chunk-2HDP7RMR.js +119 -0
  25. package/dist/chunk-2HKD2UFM.js +1000 -0
  26. package/dist/chunk-2VYRLULP.js +51 -0
  27. package/dist/chunk-2XN7PM4N.js +125 -0
  28. package/dist/chunk-35H7GVNR.js +66 -0
  29. package/dist/chunk-3C3R7JXY.js +77 -0
  30. package/dist/chunk-3VGD2FXB.js +118 -0
  31. package/dist/chunk-424AP7FM.js +534 -0
  32. package/dist/chunk-4J5TZGOE.js +3707 -0
  33. package/dist/chunk-4QJ3Y5JM.js +898 -0
  34. package/dist/chunk-4U2ET7ZY.js +1326 -0
  35. package/dist/chunk-4XPFLICE.js +876 -0
  36. package/dist/chunk-5B2OCU5P.js +31707 -0
  37. package/dist/chunk-5GGOGLSN.js +73 -0
  38. package/dist/chunk-5JRZPLI6.js +251 -0
  39. package/dist/chunk-5TQ3JYBU.js +397 -0
  40. package/dist/chunk-66JPZSGX.js +55 -0
  41. package/dist/chunk-6HSVXHCZ.js +764 -0
  42. package/dist/chunk-6S5FPUS7.js +21 -0
  43. package/dist/chunk-722LQO64.js +131 -0
  44. package/dist/chunk-73NJ7IT7.js +354 -0
  45. package/dist/chunk-7FW3I7WC.js +95 -0
  46. package/dist/chunk-7KUCBNLB.js +173 -0
  47. package/dist/chunk-7RDOV3DF.js +201 -0
  48. package/dist/chunk-A5MNH4ER.js +79 -0
  49. package/dist/chunk-ADIVZ2D5.js +15 -0
  50. package/dist/chunk-AE3P3F6W.js +366 -0
  51. package/dist/chunk-AERM3VGP.js +280 -0
  52. package/dist/chunk-AEWHC4WM.js +246 -0
  53. package/dist/chunk-AOVQ7VIF.js +169 -0
  54. package/dist/chunk-AOYHP3WI.js +12411 -0
  55. package/dist/chunk-B3YEBABJ.js +7160 -0
  56. package/dist/chunk-BCQXEZPJ.js +154 -0
  57. package/dist/chunk-BKTQAYO2.js +418 -0
  58. package/dist/chunk-BSECIPAQ.js +80 -0
  59. package/dist/chunk-BUIMGNDD.js +52 -0
  60. package/dist/chunk-BXHV3GSB.js +10320 -0
  61. package/dist/chunk-C6ZVZCPP.js +139 -0
  62. package/dist/chunk-CEZNQVWM.js +82 -0
  63. package/dist/chunk-CGFZGR7G.js +1492 -0
  64. package/dist/chunk-CGOADM2X.js +337 -0
  65. package/dist/chunk-CI4R6P2B.js +24 -0
  66. package/dist/chunk-D2TCGRSX.js +73 -0
  67. package/dist/chunk-D4PTYFOG.js +154 -0
  68. package/dist/chunk-D54ZWG4T.js +717 -0
  69. package/dist/chunk-DEBI37QB.js +145 -0
  70. package/dist/chunk-DWROHPXP.js +1051 -0
  71. package/dist/chunk-DZ6UOJ5D.js +92 -0
  72. package/dist/chunk-EBJTVRQN.js +81 -0
  73. package/dist/chunk-EGEI2RQA.js +1167 -0
  74. package/dist/chunk-EHHUASO5.js +1305 -0
  75. package/dist/chunk-EPKTIOED.js +41 -0
  76. package/dist/chunk-ER5JW2QZ.js +5681 -0
  77. package/dist/chunk-ETHFACAB.js +315 -0
  78. package/dist/chunk-EXUE5W2F.js +112 -0
  79. package/dist/chunk-EXXICUIW.js +73 -0
  80. package/dist/chunk-FFQSZJOO.js +169 -0
  81. package/dist/chunk-FHFKPGDO.js +85 -0
  82. package/dist/chunk-FW3QKMFX.js +158 -0
  83. package/dist/chunk-GD4ZNZ7W.js +30 -0
  84. package/dist/chunk-GHVMWF2I.js +581 -0
  85. package/dist/chunk-GMKAXSYQ.js +297 -0
  86. package/dist/chunk-HBVF6BWO.js +325 -0
  87. package/dist/chunk-HV4YGVMS.js +379 -0
  88. package/dist/chunk-ILBCKAV6.js +89 -0
  89. package/dist/chunk-J4U4AW46.js +440 -0
  90. package/dist/chunk-J6ESSM47.js +1791 -0
  91. package/dist/chunk-JBZHIC6T.js +2309 -0
  92. package/dist/chunk-JCFWOULR.js +245 -0
  93. package/dist/chunk-JRF5L6OD.js +131 -0
  94. package/dist/chunk-JSS75KCG.js +2014 -0
  95. package/dist/chunk-JSXWIWWJ.js +225 -0
  96. package/dist/chunk-JYV7I2QH.js +98 -0
  97. package/dist/chunk-KIOXTQQL.js +1596 -0
  98. package/dist/chunk-KWVTXT5B.js +89 -0
  99. package/dist/chunk-KX22RD6R.js +33 -0
  100. package/dist/chunk-LA6IPTGH.js +709 -0
  101. package/dist/chunk-LH5VCGLB.js +1796 -0
  102. package/dist/chunk-LQQ6XJ2Y.js +269 -0
  103. package/dist/chunk-MJQ55WZZ.js +65 -0
  104. package/dist/chunk-ML3UKMH3.js +40 -0
  105. package/dist/chunk-MOZPLHSU.js +5526 -0
  106. package/dist/chunk-NGEWJ4DF.js +89 -0
  107. package/dist/chunk-NH6VIOAR.js +211 -0
  108. package/dist/chunk-O5VZQKCB.js +26106 -0
  109. package/dist/chunk-OHSV42QB.js +748 -0
  110. package/dist/chunk-OO3TAHO5.js +4070 -0
  111. package/dist/chunk-OTNHSAGN.js +38282 -0
  112. package/dist/chunk-OUWAC7AQ.js +442 -0
  113. package/dist/chunk-OXMIV4WE.js +270 -0
  114. package/dist/chunk-P5KJURUR.js +229 -0
  115. package/dist/chunk-P6GJOVO6.js +307 -0
  116. package/dist/chunk-QARAGUXX.js +23 -0
  117. package/dist/chunk-R43HJCDX.js +2711 -0
  118. package/dist/chunk-RAXBAWRN.js +210 -0
  119. package/dist/chunk-RK3JHWPT.js +39 -0
  120. package/dist/chunk-RWA23GMM.js +24 -0
  121. package/dist/chunk-S4K4L6IM.js +179 -0
  122. package/dist/chunk-SAXK6LVF.js +124 -0
  123. package/dist/chunk-SEPGEJNK.js +1607 -0
  124. package/dist/chunk-SUJERP5I.js +285 -0
  125. package/dist/chunk-T3ED6BY2.js +913 -0
  126. package/dist/chunk-THKDVSEC.js +90 -0
  127. package/dist/chunk-TI4GSEL5.js +52 -0
  128. package/dist/chunk-TPI73L57.js +164 -0
  129. package/dist/chunk-TVHW77C7.js +338 -0
  130. package/dist/chunk-TWNHOSDT.js +1073 -0
  131. package/dist/chunk-UFMN76QD.js +347 -0
  132. package/dist/chunk-UHGLFRZE.js +205 -0
  133. package/dist/chunk-UTZYPKBF.js +15231 -0
  134. package/dist/chunk-UXNLELW6.js +25 -0
  135. package/dist/chunk-UXXS53EA.js +166 -0
  136. package/dist/chunk-V5DHFGI7.js +171 -0
  137. package/dist/chunk-V5YIPMHV.js +2353 -0
  138. package/dist/chunk-WMUWEO2C.js +754 -0
  139. package/dist/chunk-WOE3D7JM.js +945 -0
  140. package/dist/chunk-X2IK5LVR.js +2592 -0
  141. package/dist/chunk-XU2YXCDL.js +459 -0
  142. package/dist/chunk-YJG5HIX5.js +203 -0
  143. package/dist/chunk-Z3QE7TZM.js +72 -0
  144. package/dist/chunk-Z5Z3JHJY.js +64 -0
  145. package/dist/chunk-ZDIFBJFT.js +168 -0
  146. package/dist/chunk-ZGGCEXDC.js +176 -0
  147. package/dist/chunk-ZMZCZNKU.js +263 -0
  148. package/dist/chunk-ZNC5T65N.js +17 -0
  149. package/dist/chunk-ZO3I3A7O.js +308 -0
  150. package/dist/chunk-ZQKXBUB7.js +217 -0
  151. package/dist/chunk-ZTRINFM2.js +78 -0
  152. package/dist/chunk-ZU7JZCVP.js +193 -0
  153. package/dist/chunk-ZZAWNALS.js +350 -0
  154. package/dist/cli/entry.js +54 -0
  155. package/dist/connector-L5QQTR6Y.js +26 -0
  156. package/dist/context-62DC6EC3.js +31 -0
  157. package/dist/council-convene-NJWPNBDU.js +46 -0
  158. package/dist/create-agent-config-ODSQWNVC.js +55 -0
  159. package/dist/default-registry-2PU3BTAU.js +68 -0
  160. package/dist/deliver-task-KONV4C4M.js +57 -0
  161. package/dist/delivery-gate-v2-F2YVMVGK.js +27 -0
  162. package/dist/domain-knowledge-store-DDZ3F4J7.js +11 -0
  163. package/dist/fetch-core-ZPPYDSZH.js +14 -0
  164. package/dist/galaxy-K72BBDQN.js +91 -0
  165. package/dist/goal-criteria-SCALAU2D.js +141 -0
  166. package/dist/goal-persist-XWY2GDQX.js +19 -0
  167. package/dist/goal-tracker-FXMJ2GVK.js +11 -0
  168. package/dist/headless-LSB6I7PT.js +162 -0
  169. package/dist/headless-coordinator-VDPDMVUT.js +90 -0
  170. package/dist/inject-U55SMB6A.js +39 -0
  171. package/dist/login-flow-CD4ZGXOC.js +59 -0
  172. package/dist/logs-cli-SQVYFMMN.js +283 -0
  173. package/dist/loop-ULZYBDA3.js +76 -0
  174. package/dist/main.js +4064 -0
  175. package/dist/manager-ROZBCWPA.js +171 -0
  176. package/dist/manager-Z7XFFUOM.js +10670 -0
  177. package/dist/meridian-indexer-ZIW363L7.js +21 -0
  178. package/dist/native-resolver-PN34UIVV.js +13 -0
  179. package/dist/node_modules/better-sqlite3/lib/database.js +90 -0
  180. package/dist/node_modules/better-sqlite3/lib/index.js +3 -0
  181. package/dist/node_modules/better-sqlite3/lib/methods/aggregate.js +43 -0
  182. package/dist/node_modules/better-sqlite3/lib/methods/backup.js +67 -0
  183. package/dist/node_modules/better-sqlite3/lib/methods/function.js +31 -0
  184. package/dist/node_modules/better-sqlite3/lib/methods/inspect.js +7 -0
  185. package/dist/node_modules/better-sqlite3/lib/methods/pragma.js +12 -0
  186. package/dist/node_modules/better-sqlite3/lib/methods/serialize.js +16 -0
  187. package/dist/node_modules/better-sqlite3/lib/methods/table.js +189 -0
  188. package/dist/node_modules/better-sqlite3/lib/methods/transaction.js +78 -0
  189. package/dist/node_modules/better-sqlite3/lib/methods/wrappers.js +54 -0
  190. package/dist/node_modules/better-sqlite3/lib/sqlite-error.js +20 -0
  191. package/dist/node_modules/better-sqlite3/lib/util.js +12 -0
  192. package/dist/node_modules/better-sqlite3/package.json +59 -0
  193. package/dist/ownership-ledger-E3WIEKPL.js +9 -0
  194. package/dist/package.json +3 -0
  195. package/dist/path-grants-XRRXHXG7.js +40 -0
  196. package/dist/paths-LVV5IMQN.js +49 -0
  197. package/dist/plan-fact-anchors-LMVQZCW5.js +13 -0
  198. package/dist/plan-store-ODLTTPFB.js +17 -0
  199. package/dist/plan-templates-5FPFBOL6.js +109 -0
  200. package/dist/plugin-loader-ZZKX7ZE6.js +22 -0
  201. package/dist/prefix-budget-62OV5HQC.js +13 -0
  202. package/dist/project-trust-5WS5MOMU.js +31 -0
  203. package/dist/provider-cli-ALDQXIT7.js +37 -0
  204. package/dist/providers-XQYTAVPK.js +11 -0
  205. package/dist/proxy-resolver-V2Y6534D.js +15 -0
  206. package/dist/recovery-cli-KPGY6FY3.js +106 -0
  207. package/dist/review-discipline-MNSYCST5.js +55 -0
  208. package/dist/review-router-BVQZW3MX.js +18 -0
  209. package/dist/seed-capsules/seed-capsule-attack-methodology.md +62 -0
  210. package/dist/seed-capsules/seed-capsule-changgeng.md +31 -0
  211. package/dist/seed-capsules/seed-capsule-design-aesthetics.md +38 -0
  212. package/dist/seed-capsules/seed-capsule-diagnostic-ladder.md +54 -0
  213. package/dist/seed-capsules/seed-capsule-fu.md +39 -0
  214. package/dist/seed-capsules/seed-capsule-huagai.md +73 -0
  215. package/dist/seed-capsules/seed-capsule-kaiyang.md +65 -0
  216. package/dist/seed-capsules/seed-capsule-knowledge-work.md +40 -0
  217. package/dist/seed-capsules/seed-capsule-tanlang.md +47 -0
  218. package/dist/seed-capsules/seed-capsule-tianfu.md +23 -0
  219. package/dist/seed-capsules/seed-capsule-tianliang.md +63 -0
  220. package/dist/seed-capsules/seed-capsule-tianquan.md +32 -0
  221. package/dist/seed-capsules/seed-capsule-tianxuan-ccr.md +22 -0
  222. package/dist/seed-capsules/seed-capsule-tianxuan.md +64 -0
  223. package/dist/seed-capsules/seed-capsule-yaoguang.md +87 -0
  224. package/dist/serve-X2R2UTLF.js +170 -0
  225. package/dist/serve-agent-KHSU6RVV.js +965 -0
  226. package/dist/session-persist-HUUC772H.js +37 -0
  227. package/dist/session-registry-6XUD5C4Y.js +15 -0
  228. package/dist/skill-loader-CK3RMO47.js +48 -0
  229. package/dist/skills/cli-harness-sop.md +207 -0
  230. package/dist/spawn-git-4HFU65AH.js +29 -0
  231. package/dist/sse-EYUTBWUK.js +512 -0
  232. package/dist/starflow-NOFBMPFU.js +30 -0
  233. package/dist/streamableHttp-V67CNJMO.js +447 -0
  234. package/dist/task-contract-6XHBNJQK.js +32 -0
  235. package/dist/task-ledger-3K4TJIER.js +9 -0
  236. package/dist/team-orchestrate-S6NHZP7X.js +64 -0
  237. package/dist/title-extract-QX4XGCYN.js +50 -0
  238. package/dist/todo-QDXGRZZP.js +31 -0
  239. package/dist/todo-store-V3TTO5AH.js +12 -0
  240. package/dist/tool-preset-LU5BYEDZ.js +23 -0
  241. package/dist/tool-tiers-GD742YBN.js +23 -0
  242. package/dist/turndown.es-OI55K6C3.js +17373 -0
  243. package/dist/verification-attribution-EKG4CNUV.js +13 -0
  244. package/dist/volatile-git-MBTST7RA.js +15 -0
  245. package/dist/wave-checkpoint-XLIIHXQA.js +30 -0
  246. package/dist/web-cli-DUG4I35O.js +233 -0
  247. package/dist/web-search-3IK542AA.js +34 -0
  248. package/dist/workers/cpu-worker.js +45 -0
  249. package/dist/workflow-runner-HX7UBAYG.js +297 -0
  250. package/dist/worktree-baseline-O5NCU6M2.js +9 -0
  251. package/package.json +122 -0
  252. package/scripts/check-mobile-env.mjs +76 -0
  253. package/scripts/fetch-native-sqlite.js +392 -0
  254. package/scripts/prune-installed-wasms.js +45 -0
  255. package/scripts/tree-sitter-wasm-keep.js +40 -0
@@ -0,0 +1,407 @@
1
+ #!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
2
+ import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
3
+ import {
4
+ buildModelCards
5
+ } from "../../chunk-JYV7I2QH.js";
6
+ import {
7
+ CHILD_TICK_INTERVAL_MS,
8
+ buildReviewOverrideState,
9
+ buildWorkerRuntime,
10
+ createFrameDecoder,
11
+ createInteractiveToolRegistry,
12
+ encodeFrame
13
+ } from "../../chunk-AOYHP3WI.js";
14
+ import "../../chunk-4U2ET7ZY.js";
15
+ import "../../chunk-JBZHIC6T.js";
16
+ import "../../chunk-KWVTXT5B.js";
17
+ import "../../chunk-2XN7PM4N.js";
18
+ import "../../chunk-SAXK6LVF.js";
19
+ import "../../chunk-D2TCGRSX.js";
20
+ import "../../chunk-73NJ7IT7.js";
21
+ import {
22
+ DomainKnowledgeStore
23
+ } from "../../chunk-5TQ3JYBU.js";
24
+ import "../../chunk-KX22RD6R.js";
25
+ import "../../chunk-BXHV3GSB.js";
26
+ import "../../chunk-FW3QKMFX.js";
27
+ import "../../chunk-WOE3D7JM.js";
28
+ import {
29
+ DelegationCoordinator,
30
+ runWorkerSession
31
+ } from "../../chunk-B3YEBABJ.js";
32
+ import {
33
+ filterToolRegistry
34
+ } from "../../chunk-UXXS53EA.js";
35
+ import "../../chunk-DWROHPXP.js";
36
+ import "../../chunk-ZDIFBJFT.js";
37
+ import "../../chunk-D54ZWG4T.js";
38
+ import "../../chunk-R43HJCDX.js";
39
+ import "../../chunk-D4PTYFOG.js";
40
+ import "../../chunk-AERM3VGP.js";
41
+ import "../../chunk-RK3JHWPT.js";
42
+ import "../../chunk-NH6VIOAR.js";
43
+ import "../../chunk-S4K4L6IM.js";
44
+ import "../../chunk-3VGD2FXB.js";
45
+ import "../../chunk-UXNLELW6.js";
46
+ import "../../chunk-TVHW77C7.js";
47
+ import "../../chunk-424AP7FM.js";
48
+ import "../../chunk-JCFWOULR.js";
49
+ import "../../chunk-2HKD2UFM.js";
50
+ import "../../chunk-5JRZPLI6.js";
51
+ import "../../chunk-JRF5L6OD.js";
52
+ import "../../chunk-EBJTVRQN.js";
53
+ import "../../chunk-J4U4AW46.js";
54
+ import "../../chunk-2HDP7RMR.js";
55
+ import "../../chunk-OTNHSAGN.js";
56
+ import "../../chunk-DZ6UOJ5D.js";
57
+ import "../../chunk-T3ED6BY2.js";
58
+ import "../../chunk-RAXBAWRN.js";
59
+ import "../../chunk-4J5TZGOE.js";
60
+ import "../../chunk-BUIMGNDD.js";
61
+ import "../../chunk-ZU7JZCVP.js";
62
+ import "../../chunk-JSS75KCG.js";
63
+ import "../../chunk-EHHUASO5.js";
64
+ import "../../chunk-LA6IPTGH.js";
65
+ import "../../chunk-HBVF6BWO.js";
66
+ import "../../chunk-UHGLFRZE.js";
67
+ import {
68
+ deriveWorkerSessionId
69
+ } from "../../chunk-4QJ3Y5JM.js";
70
+ import "../../chunk-CGOADM2X.js";
71
+ import "../../chunk-ZGGCEXDC.js";
72
+ import "../../chunk-ZMZCZNKU.js";
73
+ import "../../chunk-Z3QE7TZM.js";
74
+ import "../../chunk-GHVMWF2I.js";
75
+ import "../../chunk-J6ESSM47.js";
76
+ import "../../chunk-3C3R7JXY.js";
77
+ import "../../chunk-TI4GSEL5.js";
78
+ import "../../chunk-OXMIV4WE.js";
79
+ import "../../chunk-4XPFLICE.js";
80
+ import {
81
+ PromptEngine
82
+ } from "../../chunk-V5YIPMHV.js";
83
+ import "../../chunk-ILBCKAV6.js";
84
+ import {
85
+ createProviderClient,
86
+ resolveApiKey,
87
+ resolveCapabilities
88
+ } from "../../chunk-X2IK5LVR.js";
89
+ import "../../chunk-CEZNQVWM.js";
90
+ import "../../chunk-O5VZQKCB.js";
91
+ import "../../chunk-SEPGEJNK.js";
92
+ import "../../chunk-7RDOV3DF.js";
93
+ import {
94
+ profileRegistry
95
+ } from "../../chunk-6HSVXHCZ.js";
96
+ import "../../chunk-RWA23GMM.js";
97
+ import "../../chunk-OHSV42QB.js";
98
+ import "../../chunk-ADIVZ2D5.js";
99
+ import "../../chunk-7FW3I7WC.js";
100
+ import "../../chunk-GD4ZNZ7W.js";
101
+ import "../../chunk-ZQKXBUB7.js";
102
+ import "../../chunk-Z5Z3JHJY.js";
103
+ import "../../chunk-KIOXTQQL.js";
104
+ import "../../chunk-35H7GVNR.js";
105
+ import "../../chunk-AE3P3F6W.js";
106
+ import {
107
+ applyDescriptionMode
108
+ } from "../../chunk-JSXWIWWJ.js";
109
+ import "../../chunk-BSECIPAQ.js";
110
+ import "../../chunk-2E6CK2RC.js";
111
+ import "../../chunk-ZO3I3A7O.js";
112
+ import "../../chunk-P6GJOVO6.js";
113
+ import "../../chunk-TPI73L57.js";
114
+ import "../../chunk-HV4YGVMS.js";
115
+ import "../../chunk-722LQO64.js";
116
+ import {
117
+ createAuthProvider
118
+ } from "../../chunk-GMKAXSYQ.js";
119
+ import "../../chunk-EPKTIOED.js";
120
+ import "../../chunk-2VYRLULP.js";
121
+ import "../../chunk-SUJERP5I.js";
122
+ import "../../chunk-CI4R6P2B.js";
123
+ import "../../chunk-XU2YXCDL.js";
124
+ import "../../chunk-ETHFACAB.js";
125
+ import "../../chunk-THKDVSEC.js";
126
+ import "../../chunk-UFMN76QD.js";
127
+ import "../../chunk-EXUE5W2F.js";
128
+ import "../../chunk-LH5VCGLB.js";
129
+ import "../../chunk-6S5FPUS7.js";
130
+ import "../../chunk-EXXICUIW.js";
131
+ import "../../chunk-QARAGUXX.js";
132
+ import {
133
+ TodoStore
134
+ } from "../../chunk-DEBI37QB.js";
135
+ import "../../chunk-YJG5HIX5.js";
136
+ import {
137
+ loadConfig,
138
+ subagentPromptBlocks
139
+ } from "../../chunk-ER5JW2QZ.js";
140
+ import "../../chunk-CGFZGR7G.js";
141
+ import "../../chunk-P5KJURUR.js";
142
+ import "../../chunk-WMUWEO2C.js";
143
+ import "../../chunk-BKTQAYO2.js";
144
+ import "../../chunk-OO3TAHO5.js";
145
+ import "../../chunk-EGEI2RQA.js";
146
+ import "../../chunk-ZTRINFM2.js";
147
+ import "../../chunk-ZNC5T65N.js";
148
+ import "../../chunk-7KUCBNLB.js";
149
+ import "../../chunk-A5MNH4ER.js";
150
+ import "../../chunk-BCQXEZPJ.js";
151
+ import {
152
+ init_esm_shims
153
+ } from "../../chunk-5GGOGLSN.js";
154
+
155
+ // src/agent/worker-process/child.ts
156
+ init_esm_shims();
157
+ import { createInterface } from "readline";
158
+ import { join } from "path";
159
+ function writeFrame(msg) {
160
+ process.stdout.write(encodeFrame(msg));
161
+ }
162
+ function childLog(line) {
163
+ writeFrame({ t: "log", line });
164
+ }
165
+ function createBridgedMailbox() {
166
+ return {
167
+ send: (msg) => writeFrame({ t: "mailbox", msg }),
168
+ receive: () => [],
169
+ broadcast: () => {
170
+ },
171
+ all: () => [],
172
+ byType: () => [],
173
+ clear: () => {
174
+ },
175
+ size: () => 0
176
+ };
177
+ }
178
+ function buildChildCoordinator(deps, registry, config, parentApprovalMode) {
179
+ return new DelegationCoordinator({
180
+ baseToolRegistry: registry,
181
+ modelCards: buildModelCards(deps.provider),
182
+ maxWorkers: resolveMaxWorkers(config),
183
+ providers: config.provider.providers,
184
+ runtimeFactory: (order, card, workerRegistry) => buildWorkerRuntime(deps, order, card, workerRegistry),
185
+ routing: deps.workerRouting,
186
+ sharedWorktree: true,
187
+ patcherTier: config.workers.patcherTier,
188
+ escalationCap: config.workers.escalationCap,
189
+ parentApprovalMode,
190
+ maxDelegationDepth: config.agent.maxDelegationDepth
191
+ });
192
+ }
193
+ function resolveMaxWorkers(config) {
194
+ const raw = config.agent.maxWorkers;
195
+ if (typeof raw === "number" && Number.isInteger(raw) && raw >= 1) return raw;
196
+ const envN = Number(process.env["RIVET_MAX_WORKERS"]);
197
+ if (Number.isInteger(envN) && envN >= 1) return envN;
198
+ return 3;
199
+ }
200
+ async function runChild() {
201
+ const decoder = createFrameDecoder();
202
+ let initPayload;
203
+ const steerQueue = [];
204
+ const abortController = new AbortController();
205
+ const stdin = createInterface({ input: process.stdin });
206
+ stdin.on("line", (line) => {
207
+ for (const msg of decoder.feed(`${line}
208
+ `)) {
209
+ if (msg.t === "init") {
210
+ initPayload = msg.payload;
211
+ if (msg.payload.steerSeed) steerQueue.push(msg.payload.steerSeed);
212
+ void bootAndRun(msg.payload, steerQueue, abortController);
213
+ } else if (msg.t === "steer") {
214
+ steerQueue.push(msg.text);
215
+ } else if (msg.t === "abort") {
216
+ abortController.abort(msg.reason);
217
+ }
218
+ }
219
+ });
220
+ stdin.on("close", () => {
221
+ if (!initPayload) process.exit(0);
222
+ });
223
+ const ticker = setInterval(() => writeFrame({ t: "tick", at: Date.now() }), CHILD_TICK_INTERVAL_MS);
224
+ ticker.unref?.();
225
+ }
226
+ async function bootAndRun(init, steerQueue, abortController) {
227
+ try {
228
+ const cfg = init.config;
229
+ const cwd = cfg.cwd;
230
+ const config = loadConfig({ cwd });
231
+ const providerName = cfg.providerName ?? config.provider.default;
232
+ const provider = config.provider.providers[providerName] ?? config.provider.providers[config.provider.default];
233
+ let apiKey = "";
234
+ try {
235
+ apiKey = resolveApiKey(provider);
236
+ } catch {
237
+ apiKey = "";
238
+ }
239
+ const auth = provider.auth ? createAuthProvider(provider.auth, process.env) : void 0;
240
+ const overrideState = config.agent.review?.profiles ? buildReviewOverrideState(config.agent.review.profiles, config.provider.providers) : { cards: /* @__PURE__ */ new Map(), overrides: /* @__PURE__ */ new Map() };
241
+ const reviewOverrides = overrideState.overrides;
242
+ const reviewOverrideApiKeys = /* @__PURE__ */ new Map();
243
+ for (const [profileName, resolved] of reviewOverrides) {
244
+ try {
245
+ reviewOverrideApiKeys.set(profileName, resolveApiKey(resolved.providerConfig));
246
+ } catch {
247
+ reviewOverrides.delete(profileName);
248
+ }
249
+ }
250
+ const workerRouting = config.workers?.profiles && Object.keys(config.workers.profiles).length > 0 ? { profiles: config.workers.profiles, routing: config.workers.routing, providers: config.provider.providers } : void 0;
251
+ const domainKnowledgeStore = new DomainKnowledgeStore(join(cwd, ".rivet", "knowledge"));
252
+ const deps = {
253
+ config,
254
+ cwd,
255
+ provider,
256
+ apiKey,
257
+ auth,
258
+ currentModelId: config.provider.default,
259
+ listActiveClaims: () => init.activeClaims,
260
+ sessionMemoryBlock: () => init.memoryBlock,
261
+ domainKnowledgeStore,
262
+ reviewOverrides,
263
+ reviewOverrideApiKeys,
264
+ workerRouting,
265
+ writeProfiles: profileRegistry.listWriteProfiles()
266
+ };
267
+ const refs = {
268
+ coordinator: null,
269
+ fileHistory: null,
270
+ claimStore: null,
271
+ sessionId: null,
272
+ sessionRegistry: null,
273
+ taskLedger: null,
274
+ ownershipLedger: null,
275
+ verificationSnapshotManager: null,
276
+ deliveryGate: null,
277
+ meridianIndexer: null,
278
+ mcpManager: null,
279
+ lspManager: null,
280
+ banditState: null,
281
+ promptEngine: null,
282
+ goalTrackerRef: { current: null },
283
+ reviewGateRef: { current: "auto" },
284
+ pluginHooks: [],
285
+ pluginCommands: [],
286
+ todoStore: new TodoStore()
287
+ };
288
+ const { registry } = createInteractiveToolRegistry(refs, config, cwd);
289
+ refs.coordinator = buildChildCoordinator(deps, registry, config, cfg.parentApprovalMode);
290
+ const decision = cfg.runtimeDecision;
291
+ if (!decision) throw new Error("init \u7F3A runtimeDecision\u2014\u2014\u7236\u8FDB\u7A0B buildWorkerRuntime \u672A\u76D6\u6233\uFF08\u7248\u672C\u4E0D\u5339\u914D\uFF1F\uFF09");
292
+ const presentTools = cfg.order.allowedTools.filter((name) => registry.has(name));
293
+ const missing = cfg.order.allowedTools.filter((name) => !registry.has(name));
294
+ if (missing.length > 0) childLog(`[worker-child] dropping ${missing.length} unregistered tool(s): ${missing.join(",")}`);
295
+ const workerRegistry = filterToolRegistry(registry, presentTools);
296
+ const providerForDecision = config.provider.providers[decision.providerName] ?? provider;
297
+ const modelSpec = providerForDecision.models.find((m) => m.id === decision.model);
298
+ const capabilities = resolveCapabilities(decision.providerName, providerForDecision.capabilities, modelSpec?.capabilities);
299
+ const blocks = subagentPromptBlocks();
300
+ const client = createProviderClient(providerForDecision, capabilities, {
301
+ apiKey,
302
+ model: decision.model,
303
+ reasoningEffort: void 0,
304
+ maxTokens: decision.maxTokens,
305
+ thinkingBudget: decision.thinkingBudget,
306
+ auth,
307
+ // 与父进程 buildWorkerRuntime 用同一公式(只取 order.id,不带 nonce):
308
+ // 子进程重建 client 时若落回 factory 的进程兜底,同一 work order 会在父子
309
+ // 进程各拿一个 ID,上游会当成两段对话。
310
+ sessionId: deriveWorkerSessionId(cfg.order.id)
311
+ });
312
+ const promptEngine = new PromptEngine({
313
+ model: decision.model,
314
+ maxTokens: decision.maxTokens,
315
+ staticCtx: { tools: applyDescriptionMode(workerRegistry.getDefinitions(), blocks.toolDescriptions), audience: "subagent" },
316
+ volatileCtx: { cwd, sessionMemoryBlock: init.memoryBlock, blockCaps: blocks.caps },
317
+ // 续跑/复核/重试继承上一轮冻结快照——历史 user 消息恢复原始字节,
318
+ // 前缀缓存只在新 user 边界断尾(缺省/坏数据引擎内降级为冷启动)。
319
+ inheritFrozenFrom: cfg.priorFrozenSnapshot
320
+ });
321
+ const workerConfig = {
322
+ order: cfg.order,
323
+ client,
324
+ promptEngine,
325
+ toolRegistry: workerRegistry,
326
+ cwd,
327
+ maxTurns: cfg.maxTurns,
328
+ contextWindow: cfg.contextWindow,
329
+ compact: cfg.compact,
330
+ runtimeDecision: decision,
331
+ providerName: cfg.providerName,
332
+ baseUrl: cfg.baseUrl,
333
+ slowThinking: cfg.slowThinking,
334
+ forceJsonRepair: cfg.forceJsonRepair,
335
+ finalizeReport: cfg.finalizeReport,
336
+ reviewDepth: cfg.reviewDepth,
337
+ parentApprovalMode: cfg.parentApprovalMode,
338
+ activeClaims: init.activeClaims,
339
+ domainKnowledgeStore,
340
+ onActivity: (kind, detail) => writeFrame({ t: "activity", kind, detail }),
341
+ onSteerDrain: () => steerQueue.shift() ?? null,
342
+ onSessionReady: void 0,
343
+ onNestedDelegation: (activity) => writeFrame({ t: "nested", activity }),
344
+ checkpoint: cfg.checkpoint,
345
+ priorMessages: cfg.priorMessages,
346
+ priorUsage: cfg.priorUsage,
347
+ sessionNonce: cfg.sessionNonce,
348
+ mailbox: createBridgedMailbox(),
349
+ abortSignal: abortController.signal
350
+ };
351
+ const run = await runWorkerSession(workerConfig);
352
+ const messages = (() => {
353
+ try {
354
+ return run.session?.getMessages() ?? [];
355
+ } catch {
356
+ return [];
357
+ }
358
+ })();
359
+ writeFrame({
360
+ t: "result",
361
+ run: {
362
+ result: run.result,
363
+ transcript: run.transcript,
364
+ usage: run.usage,
365
+ checkpoint: run.checkpoint,
366
+ messages,
367
+ // 冻结快照随结果上行——导出失败不毁结果(下一轮退化为冷启动,与旧行为一致)。
368
+ frozenSnapshot: (() => {
369
+ try {
370
+ return promptEngine.exportFrozenSnapshot();
371
+ } catch {
372
+ return void 0;
373
+ }
374
+ })(),
375
+ turnCount: messages.length
376
+ }
377
+ });
378
+ process.stdout.end(() => process.exit(0));
379
+ } catch (err) {
380
+ childLog(`[worker-child] boot/run failed: ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
381
+ writeFrame({
382
+ t: "result",
383
+ run: {
384
+ result: {
385
+ workOrderId: init.config.order.id,
386
+ status: "failed",
387
+ summary: `worker child crashed: ${err instanceof Error ? err.message : String(err)}`,
388
+ findings: [],
389
+ artifacts: [],
390
+ changedFiles: [],
391
+ risks: [],
392
+ nextActions: [],
393
+ evidenceStatus: "skipped",
394
+ failureReason: "worker_crash"
395
+ },
396
+ transcript: { text: "", thinking: "", toolUses: [], toolResults: [], repairAttempts: 0, errors: [String(err)] },
397
+ usage: { input_tokens: 0, output_tokens: 0, cache_read_input_tokens: 0, cache_creation_input_tokens: 0 },
398
+ messages: [],
399
+ turnCount: 0
400
+ }
401
+ });
402
+ process.exit(1);
403
+ }
404
+ }
405
+ if (process.argv.includes("--worker-child")) {
406
+ void runChild();
407
+ }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
2
+ import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
3
+ import {
4
+ PLAYWRIGHT_MIRROR_HOST,
5
+ buildInstallPlan,
6
+ runBrowserCLI,
7
+ runBrowserInstall,
8
+ runBrowserStatus
9
+ } from "./chunk-NGEWJ4DF.js";
10
+ import "./chunk-MJQ55WZZ.js";
11
+ import "./chunk-Z3QE7TZM.js";
12
+ import "./chunk-5GGOGLSN.js";
13
+ export {
14
+ PLAYWRIGHT_MIRROR_HOST,
15
+ buildInstallPlan,
16
+ runBrowserCLI,
17
+ runBrowserInstall,
18
+ runBrowserStatus
19
+ };
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
2
+ import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
3
+ import {
4
+ formatBrowserMissingBanner,
5
+ probeChromium
6
+ } from "./chunk-MJQ55WZZ.js";
7
+ import "./chunk-Z3QE7TZM.js";
8
+ import "./chunk-5GGOGLSN.js";
9
+ export {
10
+ formatBrowserMissingBanner,
11
+ probeChromium
12
+ };
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
2
+ import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
3
+ import {
4
+ buildSearchBackends,
5
+ resolveSearchKey
6
+ } from "./chunk-J4U4AW46.js";
7
+ import "./chunk-2HDP7RMR.js";
8
+ import "./chunk-O5VZQKCB.js";
9
+ import "./chunk-5GGOGLSN.js";
10
+ export {
11
+ buildSearchBackends,
12
+ resolveSearchKey
13
+ };
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
2
+ import { createRequire as __rivetCreateRequire } from 'node:module'; const require = __rivetCreateRequire(import.meta.url);
3
+ import {
4
+ buildFetchOptions
5
+ } from "./chunk-KX22RD6R.js";
6
+ import "./chunk-5GGOGLSN.js";
7
+ export {
8
+ buildFetchOptions
9
+ };
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: brainstorming
3
+ description: "You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation."
4
+ triggers: ["(create|build|design) (a |an |the |a new |an entirely )?(new )?(feature|component|tool|module|app|screen|page|ui|skill|project)", "from scratch", "greenfield", "设计", "新功能", "新特性", "新建(功能|模块|组件)", "头脑风暴", "brainstorm(ing)?"]
5
+ ---
6
+ # Brainstorming Ideas Into Designs
7
+
8
+ Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
9
+
10
+ Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
11
+
12
+ Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
13
+
14
+ ## Anti-Pattern: "This Is Too Simple To Need A Design"
15
+
16
+ Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.
17
+
18
+ ## Checklist
19
+
20
+ You MUST create a task for each of these items and complete them in order:
21
+
22
+ 1. **Explore project context** — check files, docs, recent commits
23
+ 2. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
24
+ 3. **Propose 2-3 approaches** — with trade-offs and your recommendation
25
+ 4. **Present design** — in sections scaled to their complexity, get user approval after each section
26
+ 5. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD--design.md` and commit
27
+ 6. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
28
+ 7. **User reviews written spec** — ask user to review the spec file before proceeding
29
+ 8. **Transition to planning** — create the implementation plan with the built-in `plan` tool (`plan action=enter_mode` → write plan → `plan action=submit`) and get it approved
30
+
31
+ ## Process Flow
32
+
33
+ ```dot
34
+ digraph brainstorming {
35
+ "Explore project context" [shape=box];
36
+ "Ask clarifying questions" [shape=box];
37
+ "Propose 2-3 approaches" [shape=box];
38
+ "Present design sections" [shape=box];
39
+ "User approves design?" [shape=diamond];
40
+ "Write design doc" [shape=box];
41
+ "Spec self-review\n(fix inline)" [shape=box];
42
+ "User reviews spec?" [shape=diamond];
43
+ "Create implementation plan\n(plan tool submit)" [shape=doublecircle];
44
+
45
+ "Explore project context" -> "Ask clarifying questions";
46
+ "Ask clarifying questions" -> "Propose 2-3 approaches";
47
+ "Propose 2-3 approaches" -> "Present design sections";
48
+ "Present design sections" -> "User approves design?";
49
+ "User approves design?" -> "Present design sections" [label="no, revise"];
50
+ "User approves design?" -> "Write design doc" [label="yes"];
51
+ "Write design doc" -> "Spec self-review\n(fix inline)";
52
+ "Spec self-review\n(fix inline)" -> "User reviews spec?";
53
+ "User reviews spec?" -> "Write design doc" [label="changes requested"];
54
+ "User reviews spec?" -> "Create implementation plan\n(plan tool submit)" [label="approved"];
55
+ }
56
+ ```
57
+
58
+ **The terminal state is an approved implementation plan.** Do NOT jump into code after the spec is approved. Use the built-in `plan` tool to write the implementation plan (with TDD steps and per-wave verification commands) and submit it with `plan action=submit` for user approval. Code only after the plan is approved.
59
+
60
+ ## The Process
61
+
62
+ **Understanding the idea:**
63
+
64
+ - Check out the current project state first (files, docs, recent commits)
65
+ - Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first.
66
+ - If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle.
67
+ - For appropriately-scoped projects, ask questions one at a time to refine the idea
68
+ - Prefer multiple choice questions when possible, but open-ended is fine too
69
+ - Only one question per message - if a topic needs more exploration, break it into multiple questions
70
+ - Focus on understanding: purpose, constraints, success criteria
71
+
72
+ **Exploring approaches:**
73
+
74
+ - Propose 2-3 different approaches with trade-offs
75
+ - Present options conversationally with your recommendation and reasoning
76
+ - Lead with your recommended option and explain why
77
+
78
+ **Presenting the design:**
79
+
80
+ - Once you believe you understand what you're building, present the design
81
+ - Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
82
+ - Ask after each section whether it looks right so far
83
+ - Cover: architecture, components, data flow, error handling, testing
84
+ - Be ready to go back and clarify if something doesn't make sense
85
+
86
+ **Design for isolation and clarity:**
87
+
88
+ - Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
89
+ - For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
90
+ - Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work.
91
+ - Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much.
92
+
93
+ **Working in existing codebases:**
94
+
95
+ - Explore the current structure before proposing changes. Follow existing patterns.
96
+ - Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in.
97
+ - Don't propose unrelated refactoring. Stay focused on what serves the current goal.
98
+
99
+ ## After the Design
100
+
101
+ **Documentation:**
102
+
103
+ - Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD--design.md`
104
+ - (User preferences for spec location override this default)
105
+ - Use a style/concise-writing skill if one is available
106
+ - Commit the design document to git
107
+
108
+ **Spec Self-Review:**
109
+
110
+ After writing the spec document, look at it with fresh eyes:
111
+
112
+ 1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
113
+ 2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions?
114
+ 3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition?
115
+ 4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit.
116
+
117
+ Fix any issues inline. No need to re-review — just fix and move on.
118
+
119
+ **User Review Gate:**
120
+
121
+ After the spec review loop passes, ask the user to review the written spec before proceeding:
122
+
123
+ > "Spec written and committed to `<path>`. Please review it and let me know if you want to make any changes before we start writing out the implementation plan."
124
+
125
+ Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user approves.
126
+
127
+ **Planning:**
128
+
129
+ - Create the implementation plan with the built-in `plan` tool: `plan action=enter_mode` opens planning mode (writes are locked), write the plan document, then `plan action=submit` hands it to the user for approval. Include TDD steps and concrete verification commands per wave (this is the native successor of the retired writing-plans skill).
130
+ - Do NOT skip this step and do NOT invoke any other skill here — an approved design without an approved plan is not ready to implement.
131
+
132
+ ## Key Principles
133
+
134
+ - **One question at a time** - Don't overwhelm with multiple questions
135
+ - **Multiple choice preferred** - Easier to answer than open-ended when possible
136
+ - **YAGNI ruthlessly** - Remove unnecessary features from all designs
137
+ - **Explore alternatives** - Always propose 2-3 approaches before settling
138
+ - **Incremental validation** - Present design, get approval before moving on
139
+ - **Be flexible** - Go back and clarify when something doesn't make sense
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: visual-acceptance
3
+ description: "UI/视觉改动交付前的终验方法论——多主题截图矩阵复现、像素真值判据链、CSS 层叠陷阱、布局漂移审查、before/after 存证。当视觉改动需要验收(而非实现)时使用:交付前最后一环,回答「看得见的部分真的对吗」。"
4
+ triggers: ['视觉验证|视觉回归|视觉终验|视觉验收|截图对比|截图存证|三主题|收灯验收|visual.?regression|visual.?acceptance|screenshot.?diff|pixel.?check']
5
+ ---
6
+
7
+ # Visual Acceptance — 视觉终验方法论
8
+
9
+ 你在任意项目中对 UI/视觉改动做交付前的最后一道审视。你可能没写这些代码,项目的主题系统、构建管道你也未必熟——但你必须给出「看得见的部分是对的」这个结论,且结论要有证据形状:截图矩阵、像素值、before/after 对照,而不是「应该没问题」。
10
+
11
+ > 分工界线:这是**验收**技能,不是实现技能。界面怎么做出来是实现者的事;
12
+ > 这里管的是做出来之后,交付前有没有人真的看过、看的方法对不对、证据留没留。
13
+
14
+ ---
15
+
16
+ ## Stage 1: 复现术——不起整个 app 的截图矩阵
17
+
18
+ 完整跑起应用再人肉点到目标界面,慢且不可复跑。正确姿势是搭一个最小 harness:
19
+
20
+ 1. **用生产构建的编译 CSS,不用源码 CSS。** 找到构建产物里的样式文件(`dist/`、`build/`、`.next/` 等),复制进 harness。源码 CSS 验的是近似,编译产物才是产品——预处理器、压缩、autoprefixer 都可能改变最终层叠。
21
+ 2. **harness HTML 用真实类名复刻目标场景。** 从产品 DOM 里抄结构和 class,不要手写近似样式。before/after 同页并排——一张截图直接回答「改动好在哪」。
22
+ 3. **主题 token 注入。** 读项目的主题定义(CSS variables JSON / theme 文件),用 playwright 的 `page.evaluate`(或等价手段)把变量批量设到根元素上,与产品的 theme-loader 同语义。
23
+ 4. **多主题矩阵一个不能少。** 至少 light/dark 各截一张;若产品有半透明/玻璃/壁纸类主题,它是**可读性的极限测试**(半透明底 + 任意背景),必须在列。每主题 fullPage 截图。
24
+ 5. **动画冻结成静帧。** shimmer/pulse 类动画用 `animation-play-state: paused` 加负值 `animation-delay` 钉在特征帧上,静态截图才可检。
25
+ 6. **截图归档为交付资产。** 命名带日期与场景,放进项目的文档资产目录——它们是验收证据,不是临时文件。
26
+
27
+ ## Stage 2: 像素真值判据链
28
+
29
+ 目视会骗人,且两个方向都骗:真浅色的图能被显示管道渲成深色(读图工具伪影),真白的底能让人以为「没截到」(实为 CSS 层叠 bug)。判据链逐级下钻,**任何一级与上一级矛盾时,信下一级**:
30
+
31
+ ```
32
+ 目视 → PNG 像素值 → computed style → CSS 层叠来源
33
+ ```
34
+
35
+ 读像素(三点采样:角落/中部/目标区域):
36
+
37
+ ```bash
38
+ python3 -c "from PIL import Image; im=Image.open('shot.png').convert('RGB'); print(im.getpixel((10,10)), im.getpixel((640,400)), im.getpixel((640,780)))"
39
+ ```
40
+
41
+ - 像素与目视矛盾 → 显示管道伪影,截图本身没问题,别为不存在的 bug 改代码。
42
+ - 像素证实异常但 computed style 正确 → 问题在渲染层之下,查层叠来源与合成(Stage 3)。
43
+
44
+ ## Stage 3: CSS 层叠陷阱
45
+
46
+ - **`!important` 只向 `!important` 低头。** 产品 CSS 里的 `!important` 规则会静默压掉 harness/宿主环境的普通规则;对抗它需要同 specificity 的 `!important` 且源序更靠后。debug 时单独设 class 一切正常、组合路径才踩中——层叠问题的典型形状。
47
+ - **宿主底色假设要显式补齐。** 产品若假设「外壳提供背景」(透明窗体、iframe 宿主、系统壁纸垫底),harness 必须显式补一层底,否则截图里的白/黑是**环境缺失**,会被误判成产品缺陷(或掩盖真缺陷)。
48
+
49
+ ## Stage 4: 布局漂移审查
50
+
51
+ typecheck 与单元测试都不报的布局问题,静态截图审查一眼现形。逐行扫截图里每个小元素的**归属感**——它看起来属于谁:
52
+
53
+ - flex 容器里 `flex: 1` 的元素会把后续兄弟推到行尾。语义上「紧跟」主元素的小标识(序号、徽记、计数)必须**嵌进主元素内部**,不能做兄弟节点。
54
+ - 同一 DOM 模式在不同 flex 上下文中行为不同——一处对不代表处处对,每个使用场景各截一张。
55
+
56
+ ## 收灯清单
57
+
58
+ 全部满足才算验收通过:
59
+
60
+ - [ ] 多主题矩阵截齐,半透明主题下所有新元素可辨、可读
61
+ - [ ] before/after 同页对照存在,能一图回答「好在哪」
62
+ - [ ] 目视存疑处有像素值证据(不是「看着像对的」)
63
+ - [ ] 截图归档进项目文档资产目录,命名可溯源
64
+ - [ ] 布局归属感逐行扫过(没有被 flex 推走的孤儿元素)