@lesliechan721/aw 0.1.0-beta.8 → 0.1.0-beta.80

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 (802) hide show
  1. package/dist/authoring/assets/aw-config.mjs +100 -501
  2. package/dist/authoring/assets/aw-config.mjs.map +1 -1
  3. package/dist/authoring/assets/aw-runtime-config.d.mts +13 -0
  4. package/dist/authoring/assets/aw-runtime-config.mjs +221 -0
  5. package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
  6. package/dist/authoring/scripts/add-skill.mjs +17 -40
  7. package/dist/authoring/scripts/add-skill.mjs.map +1 -1
  8. package/dist/authoring/scripts/init-plugin.mjs +74 -98
  9. package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
  10. package/dist/authoring/scripts/lib/plugin-root.mjs +4 -4
  11. package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
  12. package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
  13. package/dist/authoring/scripts/lib/plugin-version-check.mjs +230 -9
  14. package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
  15. package/dist/authoring/scripts/lib/skill-scaffold.d.mts +79 -92
  16. package/dist/authoring/scripts/lib/skill-scaffold.mjs +103 -127
  17. package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
  18. package/dist/authoring/scripts/remove-plugin.mjs +2 -2
  19. package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
  20. package/dist/authoring/scripts/validate-plugin.mjs +459 -2843
  21. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  22. package/dist/authoring/scripts/validate-skill.mjs +1 -1
  23. package/dist/native-runtime/reader-runtime.mjs +34 -0
  24. package/dist/native-runtime/reader.d.mts +6 -0
  25. package/dist/native-runtime/reader.mjs +11 -0
  26. package/dist/scripts/aw-skill-eval-materializer.d.ts +30 -0
  27. package/dist/scripts/aw-skill-eval-materializer.js +278 -0
  28. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -0
  29. package/dist/scripts/bundle-plugins.d.ts +1 -0
  30. package/dist/scripts/bundle-plugins.js +27 -8
  31. package/dist/scripts/bundle-plugins.js.map +1 -1
  32. package/dist/scripts/plugin-staging.d.ts +7 -8
  33. package/dist/scripts/plugin-staging.js +16 -15
  34. package/dist/scripts/plugin-staging.js.map +1 -1
  35. package/dist/scripts/plugin-test-reporter.d.mts +2 -0
  36. package/dist/scripts/plugin-test-reporter.mjs +21 -0
  37. package/dist/scripts/plugin-test-reporter.mjs.map +1 -0
  38. package/dist/scripts/test-plugin-scripts.d.ts +5 -0
  39. package/dist/scripts/test-plugin-scripts.js +273 -78
  40. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  41. package/dist/scripts/test-workers.d.mts +24 -0
  42. package/dist/scripts/test-workers.mjs +59 -0
  43. package/dist/scripts/test-workers.mjs.map +1 -0
  44. package/dist/src/adapters/helpers.d.ts +7 -0
  45. package/dist/src/adapters/helpers.js.map +1 -1
  46. package/dist/src/authoring/workspace-commands.d.ts +5 -1
  47. package/dist/src/authoring/workspace-commands.js +7 -2
  48. package/dist/src/authoring/workspace-commands.js.map +1 -1
  49. package/dist/src/commands/aw-capabilities.d.ts +2 -2
  50. package/dist/src/commands/aw-capabilities.js +41 -29
  51. package/dist/src/commands/aw-capabilities.js.map +1 -1
  52. package/dist/src/commands/catalog-dev-source.d.ts +58 -13
  53. package/dist/src/commands/catalog-dev-source.js +549 -305
  54. package/dist/src/commands/catalog-dev-source.js.map +1 -1
  55. package/dist/src/commands/catalog-generation.d.ts +14 -19
  56. package/dist/src/commands/catalog-generation.js +5 -10
  57. package/dist/src/commands/catalog-generation.js.map +1 -1
  58. package/dist/src/commands/catalog-publication-inspection.d.ts +70 -29
  59. package/dist/src/commands/catalog-publication-inspection.js +475 -62
  60. package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
  61. package/dist/src/commands/catalog-publication-journal.d.ts +68 -0
  62. package/dist/src/commands/catalog-publication-journal.js +292 -0
  63. package/dist/src/commands/catalog-publication-journal.js.map +1 -0
  64. package/dist/src/commands/catalog-publication-target.d.ts +2 -1
  65. package/dist/src/commands/catalog-publication-target.js +37 -2
  66. package/dist/src/commands/catalog-publication-target.js.map +1 -1
  67. package/dist/src/commands/catalog-publish.d.ts +82 -15
  68. package/dist/src/commands/catalog-publish.js +722 -219
  69. package/dist/src/commands/catalog-publish.js.map +1 -1
  70. package/dist/src/commands/catalog-source.d.ts +55 -35
  71. package/dist/src/commands/catalog-source.js +298 -148
  72. package/dist/src/commands/catalog-source.js.map +1 -1
  73. package/dist/src/commands/catalog-status.d.ts +6 -26
  74. package/dist/src/commands/catalog-status.js +9 -147
  75. package/dist/src/commands/catalog-status.js.map +1 -1
  76. package/dist/src/commands/catalog-store.d.ts +104 -0
  77. package/dist/src/commands/catalog-store.js +685 -0
  78. package/dist/src/commands/catalog-store.js.map +1 -0
  79. package/dist/src/commands/catalog-workspace-resolution.d.ts +17 -0
  80. package/dist/src/commands/catalog-workspace-resolution.js +57 -0
  81. package/dist/src/commands/catalog-workspace-resolution.js.map +1 -0
  82. package/dist/src/commands/console.js +32 -20
  83. package/dist/src/commands/console.js.map +1 -1
  84. package/dist/src/commands/dependency-operation-plan.d.ts +52 -15
  85. package/dist/src/commands/dependency-operation-plan.js +289 -7
  86. package/dist/src/commands/dependency-operation-plan.js.map +1 -1
  87. package/dist/src/commands/deployment-confirmation.d.ts +4 -0
  88. package/dist/src/commands/deployment-confirmation.js +20 -0
  89. package/dist/src/commands/deployment-confirmation.js.map +1 -0
  90. package/dist/src/commands/init.d.ts +5 -11
  91. package/dist/src/commands/init.js +30 -51
  92. package/dist/src/commands/init.js.map +1 -1
  93. package/dist/src/commands/intent-command.d.ts +32 -0
  94. package/dist/src/commands/intent-command.js +171 -0
  95. package/dist/src/commands/intent-command.js.map +1 -0
  96. package/dist/src/commands/managed-commands.d.ts +35 -0
  97. package/dist/src/commands/managed-commands.js +361 -0
  98. package/dist/src/commands/managed-commands.js.map +1 -0
  99. package/dist/src/commands/offline-cleanup-evidence.d.ts +46 -0
  100. package/dist/src/commands/offline-cleanup-evidence.js +158 -10
  101. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
  102. package/dist/src/commands/operation-plan.d.ts +190 -0
  103. package/dist/src/commands/operation-plan.js +99 -0
  104. package/dist/src/commands/operation-plan.js.map +1 -0
  105. package/dist/src/commands/operation-planner.d.ts +47 -0
  106. package/dist/src/commands/operation-planner.js +142 -0
  107. package/dist/src/commands/operation-planner.js.map +1 -0
  108. package/dist/src/commands/options.d.ts +16 -20
  109. package/dist/src/commands/options.js +94 -41
  110. package/dist/src/commands/options.js.map +1 -1
  111. package/dist/src/commands/plugin-capabilities.js +88 -45
  112. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  113. package/dist/src/commands/public-config-confirmation.d.ts +8 -0
  114. package/dist/src/commands/public-config-confirmation.js +56 -0
  115. package/dist/src/commands/public-config-confirmation.js.map +1 -0
  116. package/dist/src/commands/public-interruption.d.ts +9 -0
  117. package/dist/src/commands/public-interruption.js +23 -0
  118. package/dist/src/commands/public-interruption.js.map +1 -0
  119. package/dist/src/commands/public-lifecycle-result.d.ts +102 -0
  120. package/dist/src/commands/public-lifecycle-result.js +307 -0
  121. package/dist/src/commands/public-lifecycle-result.js.map +1 -0
  122. package/dist/src/commands/public-lifecycle.d.ts +28 -0
  123. package/dist/src/commands/public-lifecycle.js +492 -0
  124. package/dist/src/commands/public-lifecycle.js.map +1 -0
  125. package/dist/src/commands/public-plugin-query.d.ts +16 -0
  126. package/dist/src/commands/public-plugin-query.js +193 -0
  127. package/dist/src/commands/public-plugin-query.js.map +1 -0
  128. package/dist/src/commands/rebuild-command.d.ts +166 -28
  129. package/dist/src/commands/rebuild-command.js +3745 -813
  130. package/dist/src/commands/rebuild-command.js.map +1 -1
  131. package/dist/src/commands/rebuild-integration.d.ts +137 -25
  132. package/dist/src/commands/rebuild-integration.js +1343 -2535
  133. package/dist/src/commands/rebuild-integration.js.map +1 -1
  134. package/dist/src/commands/rebuild-operations.d.ts +73 -22
  135. package/dist/src/commands/rebuild-operations.js +313 -216
  136. package/dist/src/commands/rebuild-operations.js.map +1 -1
  137. package/dist/src/commands/rebuild-platform-integration.d.ts +62 -0
  138. package/dist/src/commands/rebuild-platform-integration.js +1317 -0
  139. package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
  140. package/dist/src/commands/reconcile-operation-plan.d.ts +28 -0
  141. package/dist/src/commands/reconcile-operation-plan.js +47 -0
  142. package/dist/src/commands/reconcile-operation-plan.js.map +1 -0
  143. package/dist/src/commands/review-inspection.d.ts +60 -0
  144. package/dist/src/commands/review-inspection.js +436 -0
  145. package/dist/src/commands/review-inspection.js.map +1 -0
  146. package/dist/src/commands/review-preparation.d.ts +51 -0
  147. package/dist/src/commands/review-preparation.js +400 -0
  148. package/dist/src/commands/review-preparation.js.map +1 -0
  149. package/dist/src/commands/runtime.d.ts +6 -6
  150. package/dist/src/commands/runtime.js +44 -24
  151. package/dist/src/commands/runtime.js.map +1 -1
  152. package/dist/src/commands/skill-eval.d.ts +41 -0
  153. package/dist/src/commands/skill-eval.js +407 -0
  154. package/dist/src/commands/skill-eval.js.map +1 -0
  155. package/dist/src/commands/status-v6.d.ts +319 -0
  156. package/dist/src/commands/status-v6.js +2979 -0
  157. package/dist/src/commands/status-v6.js.map +1 -0
  158. package/dist/src/commands/targets-command.d.ts +38 -0
  159. package/dist/src/commands/targets-command.js +182 -0
  160. package/dist/src/commands/targets-command.js.map +1 -0
  161. package/dist/src/commands/wizard.d.ts +8 -5
  162. package/dist/src/commands/wizard.js +7 -4
  163. package/dist/src/commands/wizard.js.map +1 -1
  164. package/dist/src/commands/write-commands.d.ts +9 -3
  165. package/dist/src/commands/write-commands.js +143 -85
  166. package/dist/src/commands/write-commands.js.map +1 -1
  167. package/dist/src/constants.d.ts +6 -6
  168. package/dist/src/constants.js +6 -6
  169. package/dist/src/constants.js.map +1 -1
  170. package/dist/src/eval/manifest-v1.d.ts +70 -0
  171. package/dist/src/eval/manifest-v1.js +358 -0
  172. package/dist/src/eval/manifest-v1.js.map +1 -0
  173. package/dist/src/generators/local-plugin.d.ts +7 -2
  174. package/dist/src/generators/local-plugin.js +313 -389
  175. package/dist/src/generators/local-plugin.js.map +1 -1
  176. package/dist/src/generators/permissions.d.ts +5 -2
  177. package/dist/src/generators/permissions.js +28 -15
  178. package/dist/src/generators/permissions.js.map +1 -1
  179. package/dist/src/index.d.ts +2 -31
  180. package/dist/src/index.js +1666 -1827
  181. package/dist/src/index.js.map +1 -1
  182. package/dist/src/intent/deployment-preferences.d.ts +63 -0
  183. package/dist/src/intent/deployment-preferences.js +170 -0
  184. package/dist/src/intent/deployment-preferences.js.map +1 -0
  185. package/dist/src/intent/diagnostics.d.ts +11 -0
  186. package/dist/src/intent/diagnostics.js +14 -0
  187. package/dist/src/intent/diagnostics.js.map +1 -0
  188. package/dist/src/intent/intent-codec.d.ts +19 -0
  189. package/dist/src/intent/intent-codec.js +117 -0
  190. package/dist/src/intent/intent-codec.js.map +1 -0
  191. package/dist/src/intent/intent-store.d.ts +43 -0
  192. package/dist/src/intent/intent-store.js +118 -0
  193. package/dist/src/intent/intent-store.js.map +1 -0
  194. package/dist/src/intent/scope-context.d.ts +33 -0
  195. package/dist/src/intent/scope-context.js +149 -0
  196. package/dist/src/intent/scope-context.js.map +1 -0
  197. package/dist/src/intent/work-context.d.ts +13 -0
  198. package/dist/src/intent/work-context.js +22 -0
  199. package/dist/src/intent/work-context.js.map +1 -0
  200. package/dist/src/output/command-receipt.d.ts +47 -46
  201. package/dist/src/output/command-receipt.js +286 -79
  202. package/dist/src/output/command-receipt.js.map +1 -1
  203. package/dist/src/output/model.d.ts +3 -11
  204. package/dist/src/output/native-consent.d.ts +2 -0
  205. package/dist/src/output/native-consent.js +5 -0
  206. package/dist/src/output/native-consent.js.map +1 -0
  207. package/dist/src/output/public-result.d.ts +49 -0
  208. package/dist/src/output/public-result.js +240 -0
  209. package/dist/src/output/public-result.js.map +1 -0
  210. package/dist/src/output/rebuild-progress.js +20 -15
  211. package/dist/src/output/rebuild-progress.js.map +1 -1
  212. package/dist/src/output/receipt-projection.d.ts +7 -0
  213. package/dist/src/output/receipt-projection.js +592 -0
  214. package/dist/src/output/receipt-projection.js.map +1 -0
  215. package/dist/src/platforms/capabilities.d.ts +12 -0
  216. package/dist/src/platforms/capabilities.js +205 -0
  217. package/dist/src/platforms/capabilities.js.map +1 -0
  218. package/dist/src/platforms/contracts.d.ts +358 -0
  219. package/dist/src/platforms/contracts.js +2 -0
  220. package/dist/src/platforms/contracts.js.map +1 -0
  221. package/dist/src/platforms/cursor-workspace-hook.d.ts +28 -0
  222. package/dist/src/platforms/cursor-workspace-hook.js +198 -0
  223. package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
  224. package/dist/src/platforms/discovery.d.ts +91 -0
  225. package/dist/src/platforms/discovery.js +653 -0
  226. package/dist/src/platforms/discovery.js.map +1 -0
  227. package/dist/src/platforms/gemini-activation.d.ts +36 -0
  228. package/dist/src/platforms/gemini-activation.js +331 -0
  229. package/dist/src/platforms/gemini-activation.js.map +1 -0
  230. package/dist/src/platforms/gemini-consent.d.ts +8 -0
  231. package/dist/src/platforms/gemini-consent.js +81 -0
  232. package/dist/src/platforms/gemini-consent.js.map +1 -0
  233. package/dist/src/platforms/identity.d.ts +4 -0
  234. package/dist/src/platforms/identity.js +22 -0
  235. package/dist/src/platforms/identity.js.map +1 -0
  236. package/dist/src/platforms/inspection-grok.d.ts +4 -0
  237. package/dist/src/platforms/inspection-grok.js +212 -0
  238. package/dist/src/platforms/inspection-grok.js.map +1 -0
  239. package/dist/src/platforms/inspection-native.d.ts +6 -0
  240. package/dist/src/platforms/inspection-native.js +406 -0
  241. package/dist/src/platforms/inspection-native.js.map +1 -0
  242. package/dist/src/platforms/inspection-opencode.d.ts +4 -0
  243. package/dist/src/platforms/inspection-opencode.js +98 -0
  244. package/dist/src/platforms/inspection-opencode.js.map +1 -0
  245. package/dist/src/platforms/inspection-pi.d.ts +3 -0
  246. package/dist/src/platforms/inspection-pi.js +282 -0
  247. package/dist/src/platforms/inspection-pi.js.map +1 -0
  248. package/dist/src/platforms/inspection-query.d.ts +12 -0
  249. package/dist/src/platforms/inspection-query.js +96 -0
  250. package/dist/src/platforms/inspection-query.js.map +1 -0
  251. package/dist/src/platforms/inspection.d.ts +17 -0
  252. package/dist/src/platforms/inspection.js +227 -0
  253. package/dist/src/platforms/inspection.js.map +1 -0
  254. package/dist/src/platforms/layout.d.ts +21 -0
  255. package/dist/src/platforms/layout.js +239 -0
  256. package/dist/src/platforms/layout.js.map +1 -0
  257. package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
  258. package/dist/src/platforms/lifecycle-native-services.js +147 -0
  259. package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
  260. package/dist/src/platforms/lifecycle-native.d.ts +13 -0
  261. package/dist/src/platforms/lifecycle-native.js +283 -0
  262. package/dist/src/platforms/lifecycle-native.js.map +1 -0
  263. package/dist/src/platforms/lifecycle.d.ts +25 -0
  264. package/dist/src/platforms/lifecycle.js +494 -0
  265. package/dist/src/platforms/lifecycle.js.map +1 -0
  266. package/dist/src/platforms/managed-command-placement.d.ts +8 -0
  267. package/dist/src/platforms/managed-command-placement.js +79 -0
  268. package/dist/src/platforms/managed-command-placement.js.map +1 -0
  269. package/dist/src/platforms/projection-code-extension.d.ts +8 -0
  270. package/dist/src/platforms/projection-code-extension.js +121 -0
  271. package/dist/src/platforms/projection-code-extension.js.map +1 -0
  272. package/dist/src/platforms/projection-command-resources.d.ts +7 -0
  273. package/dist/src/platforms/projection-command-resources.js +74 -0
  274. package/dist/src/platforms/projection-command-resources.js.map +1 -0
  275. package/dist/src/platforms/projection-files.d.ts +27 -0
  276. package/dist/src/platforms/projection-files.js +111 -0
  277. package/dist/src/platforms/projection-files.js.map +1 -0
  278. package/dist/src/platforms/projection-marketplace.d.ts +19 -0
  279. package/dist/src/platforms/projection-marketplace.js +42 -0
  280. package/dist/src/platforms/projection-marketplace.js.map +1 -0
  281. package/dist/src/platforms/projection.d.ts +10 -0
  282. package/dist/src/platforms/projection.js +446 -0
  283. package/dist/src/platforms/projection.js.map +1 -0
  284. package/dist/src/platforms/registry.d.ts +4 -0
  285. package/dist/src/platforms/registry.js +30 -0
  286. package/dist/src/platforms/registry.js.map +1 -0
  287. package/dist/src/platforms/supplement-layout.d.ts +16 -0
  288. package/dist/src/platforms/supplement-layout.js +31 -0
  289. package/dist/src/platforms/supplement-layout.js.map +1 -0
  290. package/dist/src/platforms/supplement-state.d.ts +13 -0
  291. package/dist/src/platforms/supplement-state.js +82 -0
  292. package/dist/src/platforms/supplement-state.js.map +1 -0
  293. package/dist/src/portable/commands.d.ts +58 -11
  294. package/dist/src/portable/commands.js +94 -350
  295. package/dist/src/portable/commands.js.map +1 -1
  296. package/dist/src/portable/historical-materialization.d.ts +22 -0
  297. package/dist/src/portable/historical-materialization.js +124 -0
  298. package/dist/src/portable/historical-materialization.js.map +1 -0
  299. package/dist/src/portable/materializer.d.ts +24 -4
  300. package/dist/src/portable/materializer.js +189 -259
  301. package/dist/src/portable/materializer.js.map +1 -1
  302. package/dist/src/portable/recovery-layout.d.ts +17 -0
  303. package/dist/src/portable/recovery-layout.js +42 -0
  304. package/dist/src/portable/recovery-layout.js.map +1 -0
  305. package/dist/src/portable/recovery.d.ts +153 -0
  306. package/dist/src/portable/recovery.js +367 -0
  307. package/dist/src/portable/recovery.js.map +1 -0
  308. package/dist/src/portable/writer.d.ts +67 -0
  309. package/dist/src/portable/writer.js +321 -0
  310. package/dist/src/portable/writer.js.map +1 -0
  311. package/dist/src/recovery/coordinator.d.ts +141 -0
  312. package/dist/src/recovery/coordinator.js +1254 -0
  313. package/dist/src/recovery/coordinator.js.map +1 -0
  314. package/dist/src/recovery/demand.d.ts +51 -0
  315. package/dist/src/recovery/demand.js +159 -0
  316. package/dist/src/recovery/demand.js.map +1 -0
  317. package/dist/src/recovery/joint-coordinator.d.ts +25 -0
  318. package/dist/src/recovery/joint-coordinator.js +991 -0
  319. package/dist/src/recovery/joint-coordinator.js.map +1 -0
  320. package/dist/src/recovery/joint-demand.d.ts +50 -0
  321. package/dist/src/recovery/joint-demand.js +197 -0
  322. package/dist/src/recovery/joint-demand.js.map +1 -0
  323. package/dist/src/recovery/performance.d.ts +4 -0
  324. package/dist/src/recovery/performance.js +26 -0
  325. package/dist/src/recovery/performance.js.map +1 -0
  326. package/dist/src/recovery/receipt.d.ts +98 -0
  327. package/dist/src/recovery/receipt.js +2 -0
  328. package/dist/src/recovery/receipt.js.map +1 -0
  329. package/dist/src/recovery/retirement.d.ts +47 -0
  330. package/dist/src/recovery/retirement.js +469 -0
  331. package/dist/src/recovery/retirement.js.map +1 -0
  332. package/dist/src/recovery/status.d.ts +126 -0
  333. package/dist/src/recovery/status.js +1073 -0
  334. package/dist/src/recovery/status.js.map +1 -0
  335. package/dist/src/recovery/types.d.ts +85 -0
  336. package/dist/src/recovery/types.js +2 -0
  337. package/dist/src/recovery/types.js.map +1 -0
  338. package/dist/src/review/eval-source-input.d.ts +43 -0
  339. package/dist/src/review/eval-source-input.js +207 -0
  340. package/dist/src/review/eval-source-input.js.map +1 -0
  341. package/dist/src/review/platform-profile.d.ts +3 -0
  342. package/dist/src/review/platform-profile.js +14 -0
  343. package/dist/src/review/platform-profile.js.map +1 -0
  344. package/dist/src/review/review-profile.d.ts +20 -0
  345. package/dist/src/review/review-profile.js +276 -0
  346. package/dist/src/review/review-profile.js.map +1 -0
  347. package/dist/src/review/review-selection.d.ts +20 -0
  348. package/dist/src/review/review-selection.js +495 -0
  349. package/dist/src/review/review-selection.js.map +1 -0
  350. package/dist/src/review/review-types.d.ts +71 -0
  351. package/dist/src/review/review-types.js +16 -0
  352. package/dist/src/review/review-types.js.map +1 -0
  353. package/dist/src/review/skill-materialization.d.ts +62 -0
  354. package/dist/src/review/skill-materialization.js +205 -0
  355. package/dist/src/review/skill-materialization.js.map +1 -0
  356. package/dist/src/review/source-binding.d.ts +201 -0
  357. package/dist/src/review/source-binding.js +773 -0
  358. package/dist/src/review/source-binding.js.map +1 -0
  359. package/dist/src/tui/agent-management.d.ts +23 -0
  360. package/dist/src/tui/agent-management.js +319 -0
  361. package/dist/src/tui/agent-management.js.map +1 -0
  362. package/dist/src/tui/agent-settings.d.ts +47 -0
  363. package/dist/src/tui/agent-settings.js +97 -0
  364. package/dist/src/tui/agent-settings.js.map +1 -0
  365. package/dist/src/tui/catalog-freshness.d.ts +1 -0
  366. package/dist/src/tui/catalog-freshness.js +2 -0
  367. package/dist/src/tui/catalog-freshness.js.map +1 -0
  368. package/dist/src/tui/catalog-generation.d.ts +18 -53
  369. package/dist/src/tui/catalog-generation.js +136 -224
  370. package/dist/src/tui/catalog-generation.js.map +1 -1
  371. package/dist/src/tui/catalog-sources/projection.d.ts +4 -0
  372. package/dist/src/tui/catalog-sources/projection.js +17 -0
  373. package/dist/src/tui/catalog-sources/projection.js.map +1 -0
  374. package/dist/src/tui/catalog-sources/review.d.ts +3 -0
  375. package/dist/src/tui/catalog-sources/review.js +13 -0
  376. package/dist/src/tui/catalog-sources/review.js.map +1 -0
  377. package/dist/src/tui/catalog-sources/screens.d.ts +12 -0
  378. package/dist/src/tui/catalog-sources/screens.js +40 -0
  379. package/dist/src/tui/catalog-sources/screens.js.map +1 -0
  380. package/dist/src/tui/catalog-sources/session.d.ts +32 -0
  381. package/dist/src/tui/catalog-sources/session.js +300 -0
  382. package/dist/src/tui/catalog-sources/session.js.map +1 -0
  383. package/dist/src/tui/catalog-sources/types.d.ts +54 -0
  384. package/dist/src/tui/catalog-sources/types.js +2 -0
  385. package/dist/src/tui/catalog-sources/types.js.map +1 -0
  386. package/dist/src/tui/catalog-store-task.d.ts +16 -0
  387. package/dist/src/tui/catalog-store-task.js +19 -0
  388. package/dist/src/tui/catalog-store-task.js.map +1 -0
  389. package/dist/src/tui/clipboard.d.ts +13 -0
  390. package/dist/src/tui/clipboard.js +95 -0
  391. package/dist/src/tui/clipboard.js.map +1 -0
  392. package/dist/src/tui/components.d.ts +113 -3
  393. package/dist/src/tui/components.js +201 -36
  394. package/dist/src/tui/components.js.map +1 -1
  395. package/dist/src/tui/config-array-draft.d.ts +29 -0
  396. package/dist/src/tui/config-array-draft.js +48 -0
  397. package/dist/src/tui/config-array-draft.js.map +1 -0
  398. package/dist/src/tui/config-leaf-editor.d.ts +43 -0
  399. package/dist/src/tui/config-leaf-editor.js +224 -0
  400. package/dist/src/tui/config-leaf-editor.js.map +1 -0
  401. package/dist/src/tui/config-references.d.ts +38 -0
  402. package/dist/src/tui/config-references.js +82 -0
  403. package/dist/src/tui/config-references.js.map +1 -0
  404. package/dist/src/tui/config-value-presentation.d.ts +20 -0
  405. package/dist/src/tui/config-value-presentation.js +104 -0
  406. package/dist/src/tui/config-value-presentation.js.map +1 -0
  407. package/dist/src/tui/console-app-v4.d.ts +13 -4
  408. package/dist/src/tui/console-app-v4.js +9764 -2210
  409. package/dist/src/tui/console-app-v4.js.map +1 -1
  410. package/dist/src/tui/content-item-card.d.ts +13 -0
  411. package/dist/src/tui/content-item-card.js +51 -0
  412. package/dist/src/tui/content-item-card.js.map +1 -0
  413. package/dist/src/tui/controller-runtime.d.ts +7 -4
  414. package/dist/src/tui/controller-runtime.js +2064 -779
  415. package/dist/src/tui/controller-runtime.js.map +1 -1
  416. package/dist/src/tui/controller.d.ts +669 -106
  417. package/dist/src/tui/controller.js +3617 -971
  418. package/dist/src/tui/controller.js.map +1 -1
  419. package/dist/src/tui/dependency-graph-view.d.ts +39 -0
  420. package/dist/src/tui/dependency-graph-view.js +121 -0
  421. package/dist/src/tui/dependency-graph-view.js.map +1 -0
  422. package/dist/src/tui/dependency-graph.d.ts +81 -0
  423. package/dist/src/tui/dependency-graph.js +452 -0
  424. package/dist/src/tui/dependency-graph.js.map +1 -0
  425. package/dist/src/tui/deployment-view.d.ts +10 -0
  426. package/dist/src/tui/deployment-view.js +108 -0
  427. package/dist/src/tui/deployment-view.js.map +1 -0
  428. package/dist/src/tui/diagnostic-projection.d.ts +23 -0
  429. package/dist/src/tui/diagnostic-projection.js +595 -0
  430. package/dist/src/tui/diagnostic-projection.js.map +1 -0
  431. package/dist/src/tui/diagnostics.d.ts +6 -3
  432. package/dist/src/tui/diagnostics.js +14 -2
  433. package/dist/src/tui/diagnostics.js.map +1 -1
  434. package/dist/src/tui/entity-cards.d.ts +55 -0
  435. package/dist/src/tui/entity-cards.js +298 -0
  436. package/dist/src/tui/entity-cards.js.map +1 -0
  437. package/dist/src/tui/glossary.d.ts +25 -0
  438. package/dist/src/tui/glossary.js +72 -0
  439. package/dist/src/tui/glossary.js.map +1 -0
  440. package/dist/src/tui/index.d.ts +6 -2
  441. package/dist/src/tui/index.js +5 -2
  442. package/dist/src/tui/index.js.map +1 -1
  443. package/dist/src/tui/input-display.d.ts +1 -0
  444. package/dist/src/tui/input-display.js +23 -1
  445. package/dist/src/tui/input-display.js.map +1 -1
  446. package/dist/src/tui/keys.d.ts +44 -0
  447. package/dist/src/tui/keys.js +43 -15
  448. package/dist/src/tui/keys.js.map +1 -1
  449. package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
  450. package/dist/src/tui/lifecycle-action-view.js +36 -0
  451. package/dist/src/tui/lifecycle-action-view.js.map +1 -0
  452. package/dist/src/tui/model.d.ts +243 -45
  453. package/dist/src/tui/model.js +1402 -415
  454. package/dist/src/tui/model.js.map +1 -1
  455. package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
  456. package/dist/src/tui/operation-diagnostic-screens.js +72 -0
  457. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
  458. package/dist/src/tui/operation-history.d.ts +82 -0
  459. package/dist/src/tui/operation-history.js +136 -0
  460. package/dist/src/tui/operation-history.js.map +1 -0
  461. package/dist/src/tui/operation-review-planner.d.ts +28 -0
  462. package/dist/src/tui/operation-review-planner.js +1396 -0
  463. package/dist/src/tui/operation-review-planner.js.map +1 -0
  464. package/dist/src/tui/plugin-content.d.ts +33 -0
  465. package/dist/src/tui/plugin-content.js +245 -0
  466. package/dist/src/tui/plugin-content.js.map +1 -0
  467. package/dist/src/tui/plugin-detail.d.ts +72 -0
  468. package/dist/src/tui/plugin-detail.js +260 -0
  469. package/dist/src/tui/plugin-detail.js.map +1 -0
  470. package/dist/src/tui/plugin-write-task.d.ts +69 -0
  471. package/dist/src/tui/plugin-write-task.js +286 -0
  472. package/dist/src/tui/plugin-write-task.js.map +1 -0
  473. package/dist/src/tui/prompt.js +4 -15
  474. package/dist/src/tui/prompt.js.map +1 -1
  475. package/dist/src/tui/query-header.d.ts +30 -0
  476. package/dist/src/tui/query-header.js +40 -0
  477. package/dist/src/tui/query-header.js.map +1 -0
  478. package/dist/src/tui/reader.d.ts +38 -0
  479. package/dist/src/tui/reader.js +49 -0
  480. package/dist/src/tui/reader.js.map +1 -0
  481. package/dist/src/tui/router.d.ts +186 -35
  482. package/dist/src/tui/router.js +338 -50
  483. package/dist/src/tui/router.js.map +1 -1
  484. package/dist/src/tui/scoped-flow.d.ts +45 -0
  485. package/dist/src/tui/scoped-flow.js +96 -0
  486. package/dist/src/tui/scoped-flow.js.map +1 -0
  487. package/dist/src/tui/scoped-inventory.d.ts +126 -0
  488. package/dist/src/tui/scoped-inventory.js +258 -0
  489. package/dist/src/tui/scoped-inventory.js.map +1 -0
  490. package/dist/src/tui/screen-registry.d.ts +701 -0
  491. package/dist/src/tui/screen-registry.js +226 -0
  492. package/dist/src/tui/screen-registry.js.map +1 -0
  493. package/dist/src/tui/session-console-app.d.ts +6 -0
  494. package/dist/src/tui/session-console-app.js +13 -0
  495. package/dist/src/tui/session-console-app.js.map +1 -0
  496. package/dist/src/tui/session-host.d.ts +45 -0
  497. package/dist/src/tui/session-host.js +219 -0
  498. package/dist/src/tui/session-host.js.map +1 -0
  499. package/dist/src/tui/source-detail-card.d.ts +29 -0
  500. package/dist/src/tui/source-detail-card.js +45 -0
  501. package/dist/src/tui/source-detail-card.js.map +1 -0
  502. package/dist/src/tui/theme.d.ts +12 -0
  503. package/dist/src/tui/theme.js +12 -0
  504. package/dist/src/tui/theme.js.map +1 -1
  505. package/dist/src/tui/viewport.d.ts +1 -0
  506. package/dist/src/tui/viewport.js +23 -0
  507. package/dist/src/tui/viewport.js.map +1 -1
  508. package/dist/src/tui/wizard.js +37 -13
  509. package/dist/src/tui/wizard.js.map +1 -1
  510. package/dist/src/types.d.ts +220 -118
  511. package/dist/src/types.js +1 -0
  512. package/dist/src/types.js.map +1 -1
  513. package/dist/src/utils/agent-version.d.ts +13 -4
  514. package/dist/src/utils/agent-version.js +27 -4
  515. package/dist/src/utils/agent-version.js.map +1 -1
  516. package/dist/src/utils/artifact-plan.d.ts +33 -7
  517. package/dist/src/utils/artifact-plan.js +115 -430
  518. package/dist/src/utils/artifact-plan.js.map +1 -1
  519. package/dist/src/utils/artifact-renderer.d.ts +114 -83
  520. package/dist/src/utils/artifact-renderer.js +213 -364
  521. package/dist/src/utils/artifact-renderer.js.map +1 -1
  522. package/dist/src/utils/artifact-request.d.ts +44 -0
  523. package/dist/src/utils/artifact-request.js +80 -0
  524. package/dist/src/utils/artifact-request.js.map +1 -0
  525. package/dist/src/utils/artifact-sources.d.ts +6 -2
  526. package/dist/src/utils/artifact-sources.js +17 -0
  527. package/dist/src/utils/artifact-sources.js.map +1 -1
  528. package/dist/src/utils/bundle-layout.js +57 -173
  529. package/dist/src/utils/bundle-layout.js.map +1 -1
  530. package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
  531. package/dist/src/utils/catalog-capability-projection.js +14 -0
  532. package/dist/src/utils/catalog-capability-projection.js.map +1 -0
  533. package/dist/src/utils/catalog-digests.d.ts +2 -2
  534. package/dist/src/utils/catalog-digests.js +7 -18
  535. package/dist/src/utils/catalog-digests.js.map +1 -1
  536. package/dist/src/utils/catalog-generation-control-snapshot.d.ts +11 -0
  537. package/dist/src/utils/catalog-generation-control-snapshot.js +45 -0
  538. package/dist/src/utils/catalog-generation-control-snapshot.js.map +1 -0
  539. package/dist/src/utils/catalog-generation-error.d.ts +5 -1
  540. package/dist/src/utils/catalog-generation-error.js +14 -0
  541. package/dist/src/utils/catalog-generation-error.js.map +1 -1
  542. package/dist/src/utils/catalog-generation-resolver.d.ts +36 -5
  543. package/dist/src/utils/catalog-generation-resolver.js +221 -77
  544. package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
  545. package/dist/src/utils/catalog-generation-service.d.ts +159 -28
  546. package/dist/src/utils/catalog-generation-service.js +1186 -525
  547. package/dist/src/utils/catalog-generation-service.js.map +1 -1
  548. package/dist/src/utils/catalog-generation-state.d.ts +9 -0
  549. package/dist/src/utils/catalog-generation-state.js +97 -106
  550. package/dist/src/utils/catalog-generation-state.js.map +1 -1
  551. package/dist/src/utils/catalog-generation-store.d.ts +38 -24
  552. package/dist/src/utils/catalog-generation-store.js +337 -272
  553. package/dist/src/utils/catalog-generation-store.js.map +1 -1
  554. package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
  555. package/dist/src/utils/{catalog-manifest-v5.js → catalog-manifest-v7.js} +23 -35
  556. package/dist/src/utils/catalog-manifest-v7.js.map +1 -0
  557. package/dist/src/utils/catalog-operation-context.d.ts +6 -14
  558. package/dist/src/utils/catalog-operation-context.js +69 -169
  559. package/dist/src/utils/catalog-operation-context.js.map +1 -1
  560. package/dist/src/utils/catalog-public-error.js +8 -4
  561. package/dist/src/utils/catalog-public-error.js.map +1 -1
  562. package/dist/src/utils/catalog-runtime-projection.d.ts +7 -3
  563. package/dist/src/utils/catalog-runtime-projection.js +5 -40
  564. package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
  565. package/dist/src/utils/catalog-snapshot.d.ts +2 -2
  566. package/dist/src/utils/catalog-source-impact.d.ts +21 -0
  567. package/dist/src/utils/catalog-source-impact.js +344 -0
  568. package/dist/src/utils/catalog-source-impact.js.map +1 -0
  569. package/dist/src/utils/catalog-source-references.d.ts +23 -2
  570. package/dist/src/utils/catalog-source-references.js +456 -382
  571. package/dist/src/utils/catalog-source-references.js.map +1 -1
  572. package/dist/src/utils/catalog-sources.d.ts +14 -1
  573. package/dist/src/utils/catalog-sources.js +178 -18
  574. package/dist/src/utils/catalog-sources.js.map +1 -1
  575. package/dist/src/utils/codex-config.d.ts +2 -0
  576. package/dist/src/utils/codex-config.js +22 -1
  577. package/dist/src/utils/codex-config.js.map +1 -1
  578. package/dist/src/utils/codex-executable-discovery.d.ts +28 -0
  579. package/dist/src/utils/codex-executable-discovery.js +431 -0
  580. package/dist/src/utils/codex-executable-discovery.js.map +1 -0
  581. package/dist/src/utils/codex-manager.d.ts +47 -18
  582. package/dist/src/utils/codex-manager.js +88 -622
  583. package/dist/src/utils/codex-manager.js.map +1 -1
  584. package/dist/src/utils/codex-marketplace-path.d.ts +5 -0
  585. package/dist/src/utils/codex-marketplace-path.js +45 -0
  586. package/dist/src/utils/codex-marketplace-path.js.map +1 -0
  587. package/dist/src/utils/codex-native-observation.d.ts +49 -0
  588. package/dist/src/utils/codex-native-observation.js +169 -0
  589. package/dist/src/utils/codex-native-observation.js.map +1 -0
  590. package/dist/src/utils/codex-reconciler.d.ts +123 -0
  591. package/dist/src/utils/codex-reconciler.js +322 -0
  592. package/dist/src/utils/codex-reconciler.js.map +1 -0
  593. package/dist/src/utils/codex-shared-native.d.ts +45 -0
  594. package/dist/src/utils/codex-shared-native.js +122 -0
  595. package/dist/src/utils/codex-shared-native.js.map +1 -0
  596. package/dist/src/utils/codex-skill-staging.d.ts +4 -3
  597. package/dist/src/utils/codex-skill-staging.js.map +1 -1
  598. package/dist/src/utils/codex-skills-root.d.ts +4 -0
  599. package/dist/src/utils/codex-skills-root.js +25 -0
  600. package/dist/src/utils/codex-skills-root.js.map +1 -0
  601. package/dist/src/utils/codex-surface-analysis.d.ts +49 -0
  602. package/dist/src/utils/codex-surface-analysis.js +220 -0
  603. package/dist/src/utils/codex-surface-analysis.js.map +1 -0
  604. package/dist/src/utils/component-command-preparation.d.ts +34 -0
  605. package/dist/src/utils/component-command-preparation.js +228 -0
  606. package/dist/src/utils/component-command-preparation.js.map +1 -0
  607. package/dist/src/utils/component-resources.d.ts +51 -0
  608. package/dist/src/utils/component-resources.js +322 -0
  609. package/dist/src/utils/component-resources.js.map +1 -0
  610. package/dist/src/utils/dynamic-skill-tree.d.ts +18 -6
  611. package/dist/src/utils/dynamic-skill-tree.js +32 -9
  612. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  613. package/dist/src/utils/git-catalog-provider.d.ts +16 -0
  614. package/dist/src/utils/git-catalog-provider.js +167 -120
  615. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  616. package/dist/src/utils/inventory-recovery-diagnostic.d.ts +4 -0
  617. package/dist/src/utils/inventory-recovery-diagnostic.js +15 -0
  618. package/dist/src/utils/inventory-recovery-diagnostic.js.map +1 -0
  619. package/dist/src/utils/local-marketplace.d.ts +17 -12
  620. package/dist/src/utils/local-marketplace.js +85 -195
  621. package/dist/src/utils/local-marketplace.js.map +1 -1
  622. package/dist/src/utils/managed-command-closure.d.ts +3 -0
  623. package/dist/src/utils/managed-command-closure.js +35 -0
  624. package/dist/src/utils/managed-command-closure.js.map +1 -0
  625. package/dist/src/utils/managed-command-evidence.d.ts +7 -0
  626. package/dist/src/utils/managed-command-evidence.js +10 -0
  627. package/dist/src/utils/managed-command-evidence.js.map +1 -0
  628. package/dist/src/utils/managed-command-materialization.d.ts +124 -0
  629. package/dist/src/utils/managed-command-materialization.js +369 -0
  630. package/dist/src/utils/managed-command-materialization.js.map +1 -0
  631. package/dist/src/utils/managed-command-preparation.d.ts +67 -0
  632. package/dist/src/utils/managed-command-preparation.js +146 -0
  633. package/dist/src/utils/managed-command-preparation.js.map +1 -0
  634. package/dist/src/utils/managed-command-review.d.ts +26 -0
  635. package/dist/src/utils/managed-command-review.js +68 -0
  636. package/dist/src/utils/managed-command-review.js.map +1 -0
  637. package/dist/src/utils/managed-command-runtime.d.ts +33 -0
  638. package/dist/src/utils/managed-command-runtime.js +121 -0
  639. package/dist/src/utils/managed-command-runtime.js.map +1 -0
  640. package/dist/src/utils/managed-command-store.d.ts +143 -0
  641. package/dist/src/utils/managed-command-store.js +665 -0
  642. package/dist/src/utils/managed-command-store.js.map +1 -0
  643. package/dist/src/utils/manifest.d.ts +1 -3
  644. package/dist/src/utils/manifest.js +1 -3
  645. package/dist/src/utils/manifest.js.map +1 -1
  646. package/dist/src/utils/multi-source-catalog.d.ts +1 -10
  647. package/dist/src/utils/multi-source-catalog.js +9 -175
  648. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  649. package/dist/src/utils/native-cli.d.ts +74 -5
  650. package/dist/src/utils/native-cli.js +479 -31
  651. package/dist/src/utils/native-cli.js.map +1 -1
  652. package/dist/src/utils/native-demand.d.ts +29 -0
  653. package/dist/src/utils/native-demand.js +4 -0
  654. package/dist/src/utils/native-demand.js.map +1 -0
  655. package/dist/src/utils/native-tool-context.d.ts +14 -0
  656. package/dist/src/utils/native-tool-context.js +38 -0
  657. package/dist/src/utils/native-tool-context.js.map +1 -0
  658. package/dist/src/utils/native-tool-review.d.ts +18 -0
  659. package/dist/src/utils/native-tool-review.js +116 -0
  660. package/dist/src/utils/native-tool-review.js.map +1 -0
  661. package/dist/src/utils/orphan-marketplace-cleanup.js +0 -1
  662. package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
  663. package/dist/src/utils/ownership.d.ts +103 -21
  664. package/dist/src/utils/ownership.js +232 -210
  665. package/dist/src/utils/ownership.js.map +1 -1
  666. package/dist/src/utils/path-catalog-provider.d.ts +1 -1
  667. package/dist/src/utils/path-catalog-provider.js +47 -62
  668. package/dist/src/utils/path-catalog-provider.js.map +1 -1
  669. package/dist/src/utils/paths.d.ts +1 -2
  670. package/dist/src/utils/paths.js +5 -3
  671. package/dist/src/utils/paths.js.map +1 -1
  672. package/dist/src/utils/platform-empty-state.d.ts +45 -0
  673. package/dist/src/utils/platform-empty-state.js +159 -0
  674. package/dist/src/utils/platform-empty-state.js.map +1 -0
  675. package/dist/src/utils/platform-support.d.ts +1 -1
  676. package/dist/src/utils/platform-support.js +1 -1
  677. package/dist/src/utils/platform-support.js.map +1 -1
  678. package/dist/src/utils/plugin-config-impact.d.ts +64 -0
  679. package/dist/src/utils/plugin-config-impact.js +307 -0
  680. package/dist/src/utils/plugin-config-impact.js.map +1 -0
  681. package/dist/src/utils/plugin-config-references.d.ts +89 -0
  682. package/dist/src/utils/plugin-config-references.js +335 -0
  683. package/dist/src/utils/plugin-config-references.js.map +1 -0
  684. package/dist/src/utils/plugin-config-write.d.ts +109 -27
  685. package/dist/src/utils/plugin-config-write.js +1242 -348
  686. package/dist/src/utils/plugin-config-write.js.map +1 -1
  687. package/dist/src/utils/plugin-config.d.ts +187 -109
  688. package/dist/src/utils/plugin-config.js +916 -1147
  689. package/dist/src/utils/plugin-config.js.map +1 -1
  690. package/dist/src/utils/plugin-dependencies.d.ts +1 -1
  691. package/dist/src/utils/plugin-dependencies.js.map +1 -1
  692. package/dist/src/utils/plugin-scripts.d.ts +78 -127
  693. package/dist/src/utils/plugin-scripts.js +566 -524
  694. package/dist/src/utils/plugin-scripts.js.map +1 -1
  695. package/dist/src/utils/process-lock.js +14 -5
  696. package/dist/src/utils/process-lock.js.map +1 -1
  697. package/dist/src/utils/process-tree.d.ts +2 -2
  698. package/dist/src/utils/process-tree.js +1 -1
  699. package/dist/src/utils/process-tree.js.map +1 -1
  700. package/dist/src/utils/project-boundary.d.ts +11 -13
  701. package/dist/src/utils/project-boundary.js +28 -34
  702. package/dist/src/utils/project-boundary.js.map +1 -1
  703. package/dist/src/utils/rendered-contract.js +18 -1
  704. package/dist/src/utils/rendered-contract.js.map +1 -1
  705. package/dist/src/utils/runtime-config.d.ts +18 -0
  706. package/dist/src/utils/runtime-config.js +64 -0
  707. package/dist/src/utils/runtime-config.js.map +1 -0
  708. package/dist/src/utils/runtime-skill-closure.d.ts +2 -2
  709. package/dist/src/utils/runtime-skill-closure.js +47 -6
  710. package/dist/src/utils/runtime-skill-closure.js.map +1 -1
  711. package/dist/src/utils/safe-fs.d.ts +21 -0
  712. package/dist/src/utils/safe-fs.js +111 -0
  713. package/dist/src/utils/safe-fs.js.map +1 -0
  714. package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
  715. package/dist/src/utils/safe-operation-diagnostic.js +33 -0
  716. package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
  717. package/dist/src/utils/sensitive-content.d.ts +4 -0
  718. package/dist/src/utils/sensitive-content.js +36 -0
  719. package/dist/src/utils/sensitive-content.js.map +1 -0
  720. package/dist/src/utils/state-paths.d.ts +8 -3
  721. package/dist/src/utils/state-paths.js +53 -16
  722. package/dist/src/utils/state-paths.js.map +1 -1
  723. package/dist/src/utils/target-eligibility.d.ts +4 -3
  724. package/dist/src/utils/target-eligibility.js +12 -6
  725. package/dist/src/utils/target-eligibility.js.map +1 -1
  726. package/dist/src/utils/windows-claude-shim.d.ts +7 -0
  727. package/dist/src/utils/windows-claude-shim.js +10 -0
  728. package/dist/src/utils/windows-claude-shim.js.map +1 -0
  729. package/dist/src/utils/windows-npm-shim.d.ts +16 -0
  730. package/dist/src/utils/windows-npm-shim.js +155 -0
  731. package/dist/src/utils/windows-npm-shim.js.map +1 -0
  732. package/dist/vitest.config.js +105 -9
  733. package/dist/vitest.config.js.map +1 -1
  734. package/package.json +30 -21
  735. package/dist/scripts/aw-skill-eval-engine.d.ts +0 -13
  736. package/dist/scripts/aw-skill-eval-engine.js +0 -31
  737. package/dist/scripts/aw-skill-eval-engine.js.map +0 -1
  738. package/dist/scripts/codex-eval-app-server.d.ts +0 -91
  739. package/dist/scripts/codex-eval-app-server.js +0 -1334
  740. package/dist/scripts/codex-eval-app-server.js.map +0 -1
  741. package/dist/scripts/codex-eval-isolation.d.ts +0 -61
  742. package/dist/scripts/codex-eval-isolation.js +0 -318
  743. package/dist/scripts/codex-eval-isolation.js.map +0 -1
  744. package/dist/scripts/codex-eval-process-management.d.ts +0 -8
  745. package/dist/scripts/codex-eval-process-management.js +0 -69
  746. package/dist/scripts/codex-eval-process-management.js.map +0 -1
  747. package/dist/scripts/codex-eval-process-tree.d.ts +0 -38
  748. package/dist/scripts/codex-eval-process-tree.js +0 -803
  749. package/dist/scripts/codex-eval-process-tree.js.map +0 -1
  750. package/dist/scripts/codex-eval-runtime-config.d.ts +0 -62
  751. package/dist/scripts/codex-eval-runtime-config.js +0 -843
  752. package/dist/scripts/codex-eval-runtime-config.js.map +0 -1
  753. package/dist/scripts/codex-trigger-eval.d.ts +0 -84
  754. package/dist/scripts/codex-trigger-eval.js +0 -968
  755. package/dist/scripts/codex-trigger-eval.js.map +0 -1
  756. package/dist/scripts/eval-plugin-skills-audited.d.ts +0 -6
  757. package/dist/scripts/eval-plugin-skills-audited.js +0 -261
  758. package/dist/scripts/eval-plugin-skills-audited.js.map +0 -1
  759. package/dist/scripts/eval-plugin-skills.d.ts +0 -45
  760. package/dist/scripts/eval-plugin-skills.js +0 -1589
  761. package/dist/scripts/eval-plugin-skills.js.map +0 -1
  762. package/dist/scripts/eval-run-layout.d.ts +0 -17
  763. package/dist/scripts/eval-run-layout.js +0 -26
  764. package/dist/scripts/eval-run-layout.js.map +0 -1
  765. package/dist/scripts/plugin-eval-contract.d.ts +0 -189
  766. package/dist/scripts/plugin-eval-contract.js +0 -745
  767. package/dist/scripts/plugin-eval-contract.js.map +0 -1
  768. package/dist/scripts/plugin-eval-materializer.d.ts +0 -13
  769. package/dist/scripts/plugin-eval-materializer.js +0 -421
  770. package/dist/scripts/plugin-eval-materializer.js.map +0 -1
  771. package/dist/scripts/skill-reporting.d.ts +0 -212
  772. package/dist/scripts/skill-reporting.js +0 -922
  773. package/dist/scripts/skill-reporting.js.map +0 -1
  774. package/dist/src/commands/catalog-context.d.ts +0 -52
  775. package/dist/src/commands/catalog-context.js +0 -156
  776. package/dist/src/commands/catalog-context.js.map +0 -1
  777. package/dist/src/commands/review-publication.d.ts +0 -99
  778. package/dist/src/commands/review-publication.js +0 -904
  779. package/dist/src/commands/review-publication.js.map +0 -1
  780. package/dist/src/commands/status-v5.d.ts +0 -169
  781. package/dist/src/commands/status-v5.js +0 -1135
  782. package/dist/src/commands/status-v5.js.map +0 -1
  783. package/dist/src/portable/skills-cli.d.ts +0 -43
  784. package/dist/src/portable/skills-cli.js +0 -148
  785. package/dist/src/portable/skills-cli.js.map +0 -1
  786. package/dist/src/utils/catalog-manifest-v5.d.ts +0 -5
  787. package/dist/src/utils/catalog-manifest-v5.js.map +0 -1
  788. package/dist/src/utils/catalog-source-cache.d.ts +0 -62
  789. package/dist/src/utils/catalog-source-cache.js +0 -321
  790. package/dist/src/utils/catalog-source-cache.js.map +0 -1
  791. package/dist/src/utils/codex-project-surface.d.ts +0 -3
  792. package/dist/src/utils/codex-project-surface.js +0 -49
  793. package/dist/src/utils/codex-project-surface.js.map +0 -1
  794. package/dist/src/utils/lifecycle-active-store.d.ts +0 -147
  795. package/dist/src/utils/lifecycle-active-store.js +0 -1064
  796. package/dist/src/utils/lifecycle-active-store.js.map +0 -1
  797. package/dist/src/utils/plugin-release.d.ts +0 -2
  798. package/dist/src/utils/plugin-release.js +0 -2
  799. package/dist/src/utils/plugin-release.js.map +0 -1
  800. package/dist/src/utils/slash-commands.d.ts +0 -1
  801. package/dist/src/utils/slash-commands.js +0 -2
  802. package/dist/src/utils/slash-commands.js.map +0 -1
@@ -0,0 +1,1396 @@
1
+ import path from 'node:path';
2
+ import { describeNativeToolClosure } from '../utils/native-tool-review.js';
3
+ import { requestedIntentAction } from '../output/command-receipt.js';
4
+ import { operationPlanNativeToolChanges } from '../commands/operation-plan.js';
5
+ import { catalogSourceAutoCheckOnlyValue } from './catalog-sources/review.js';
6
+ import { parseScriptTimeoutMs, SCRIPT_TIMEOUT_DEFAULT_MS, } from '../commands/options.js';
7
+ import { agentLabel, platformLabel, scopeLabel } from './glossary.js';
8
+ import { canonicalizeIdentityValue, getCommandPackageId } from '@lesliechan721/aw-plugin-core/manifest';
9
+ import { normalizeInstalledCommandProducer } from '../utils/managed-command-store.js';
10
+ import { sanitizeDiagnosticText } from './diagnostics.js';
11
+ import { deploymentExclusionLines, deploymentPlanLines } from './deployment-view.js';
12
+ function codexManagerEvidence(preview) {
13
+ return preview?.state === 'system' ? {
14
+ state: 'system',
15
+ source: preview.manager.kind,
16
+ version: preview.manager.version,
17
+ ...(preview.diagnostics?.length ? { diagnostics: preview.diagnostics } : {}),
18
+ } : undefined;
19
+ }
20
+ function plannerError(code, message) {
21
+ return new Error(`${code}: ${message}`);
22
+ }
23
+ function pluginNameFromId(pluginId) {
24
+ const separator = pluginId.indexOf('/');
25
+ return separator < 0 ? pluginId : pluginId.slice(separator + 1);
26
+ }
27
+ function sharedUnitMatchesTarget(shared, target, pluginId) {
28
+ return shared.pluginName === (target.pluginName ?? pluginNameFromId(pluginId)) && shared.platform === target.platform;
29
+ }
30
+ function configCommandPackageChanges(evidence, apply) {
31
+ return (evidence?.config?.commandPackages ?? []).map((target) => ({
32
+ kind: target.declared && apply ? 'change' : 'warning',
33
+ group: 'configImpact',
34
+ pluginId: `${target.producer.sourceId}/${target.producer.pluginName}`,
35
+ title: `${target.declared ? apply ? '刷新' : '需同步' : '保留残留'}命令包 ${target.packageKey}`,
36
+ description: `${target.producer.sourceId}/${target.producer.pluginName} · ${scopeLabel(target.producer.scope)} · ${target.producer.platform
37
+ ? `${agentLabel(target.producer.platform)} 平台配置` : '公共配置'}${target.declared ? ''
38
+ : ` · 声明已删除;aw command package remove ${target.packageId} --yes`}`,
39
+ }));
40
+ }
41
+ export function managedCommandPlanChanges(actions, nativeToolChanges = [], deploymentPlans = []) {
42
+ const changes = [];
43
+ const producers = new Map();
44
+ const permissions = new Map();
45
+ const retained = new Set();
46
+ const addProducer = (record) => {
47
+ const key = getCommandPackageId(record.producer);
48
+ const previous = producers.get(key);
49
+ if (previous && canonicalizeIdentityValue(previous) !== canonicalizeIdentityValue(record))
50
+ throw plannerError('commandReviewConflict', '同一命令生产者有不同的冻结命令。');
51
+ producers.set(key, record);
52
+ };
53
+ const addPermission = (permission) => {
54
+ const key = `${permission.kind}\0${permission.pluginId}\0${permission.path}`;
55
+ const previous = permissions.get(key);
56
+ if (previous && canonicalizeIdentityValue(previous) !== canonicalizeIdentityValue(permission))
57
+ throw plannerError('commandReviewConflict', '同一权限位置有不同的冻结规则。');
58
+ permissions.set(key, permission);
59
+ };
60
+ for (const plan of deploymentPlans) {
61
+ const evidence = plan.evidence.managedCommandReview;
62
+ if (!evidence || plan.evidence.retainPackage)
63
+ continue;
64
+ const publishes = plan.effects.some((effect) => effect.kind === 'publish-package' && effect.destination === plan.evidence.layout.packageRoot);
65
+ if (publishes)
66
+ for (const record of evidence.producers)
67
+ addProducer(record);
68
+ for (const permission of evidence.permissions) {
69
+ if (publishes || plan.effects.some((effect) => effect.kind === 'write-supplement' && effect.destination === permission.path))
70
+ addPermission(permission);
71
+ }
72
+ }
73
+ for (const change of operationPlanNativeToolChanges({ actions: [...actions], nativeToolChanges })) {
74
+ const pluginId = `${change.producer.sourceId}/${change.producer.pluginName}`;
75
+ for (const [kind, closure] of [['remove', change.before], ['add', change.after]]) {
76
+ if (!closure)
77
+ continue;
78
+ for (const description of describeNativeToolClosure(closure))
79
+ changes.push({ kind, group: 'runtime', pluginId,
80
+ title: `${kind === 'remove' ? '撤销' : '使用'}原生工具 · ${pluginId} · ${change.producer.key}`, description });
81
+ }
82
+ }
83
+ for (const action of actions) {
84
+ if (action.kind === 'retainManagedCommandPackage') {
85
+ if (retained.has(action.packageId))
86
+ continue;
87
+ retained.add(action.packageId);
88
+ changes.push({ kind: 'keep', group: 'preserved', pluginId: action.pluginId,
89
+ title: `保留命令包 ${action.producer.key}`,
90
+ description: `${action.producer.sourceId}/${action.producer.pluginName} · ${action.packageId} · ${scopeLabel(action.producer.scope)} · ${action.producer.scope === 'user' ? '所有项目共用' : '当前项目内共用'} · ${action.commandIds.length} 个命令 · ${action.availability} · ${action.recoveryAction}` });
91
+ }
92
+ else if (action.kind === 'syncManagedCommandPackage') {
93
+ addProducer({ schemaVersion: 1, producer: action.producer, sets: action.sets, ...(action.nativeTools ? { nativeTools: action.nativeTools } : {}) });
94
+ }
95
+ else if (action.kind === 'writeOwnedArtifact' || action.kind === 'materializeNativeSkill') {
96
+ for (const file of action.files ?? []) {
97
+ if (file.relativePath !== '.aw-command-producer.json')
98
+ continue;
99
+ const record = normalizeInstalledCommandProducer(JSON.parse(Buffer.from(file.contentBase64, 'base64').toString('utf8')));
100
+ addProducer(record);
101
+ }
102
+ if (action.kind === 'writeOwnedArtifact' && action.platform === 'codex'
103
+ && action.artifactKind === 'owned-text-file' && path.extname(action.path) === '.rules') {
104
+ const rules = action.sourceContent ?? action.content;
105
+ if (rules)
106
+ addPermission({ kind: 'codex-rules', pluginId: action.pluginId, path: action.path, content: rules });
107
+ }
108
+ }
109
+ else if (action.kind === 'updateSharedConfig' && action.mutation.kind === 'claude-permissions' && action.locator.kind === 'claude-permissions') {
110
+ addPermission({ kind: 'claude-permissions', pluginId: action.pluginId, path: action.locator.settingsPath,
111
+ permissions: action.mutation.permissions });
112
+ }
113
+ }
114
+ for (const permission of permissions.values()) {
115
+ if (permission.kind === 'codex-rules') {
116
+ changes.push({ kind: 'change', group: 'runtime', pluginId: permission.pluginId,
117
+ title: `Codex 权限规则 ${path.basename(permission.path)}`, description: permission.content.trim() });
118
+ }
119
+ else
120
+ for (const kind of ['allow', 'ask', 'deny', 'excludedCommands']) {
121
+ const rules = permission.permissions[kind];
122
+ if (!rules?.length)
123
+ continue;
124
+ changes.push({ kind: 'change', group: 'runtime', pluginId: permission.pluginId,
125
+ title: kind === 'excludedCommands' ? 'Claude sandbox.excludedCommands' : `Claude permissions.${kind}`, description: rules.join(';') });
126
+ }
127
+ }
128
+ for (const { producer, sets } of producers.values()) {
129
+ const pluginId = `${producer.sourceId}/${producer.pluginName}`;
130
+ changes.push({ kind: 'change', group: 'runtime', pluginId,
131
+ title: `命令${producer.kind === 'package' ? '包' : '生产者'} ${producer.key}`,
132
+ description: `${pluginId} · ${scopeLabel(producer.scope)}${producer.platform ? ` · ${platformLabel(producer.platform)}`
133
+ : ' · 平台共用同一份生效配置'}${producer.scope === 'user' ? ' · 更新会影响全部引用者' : ''}` });
134
+ for (const set of sets) {
135
+ if (set.entries.length === 0)
136
+ changes.push({ kind: 'change', group: 'runtime', pluginId,
137
+ title: `命令集合 ${set.set}`, description: set.state === 'disabled' ? '已禁用;本集合命令失效' : '空集合;本集合没有可用命令' });
138
+ for (const entry of set.entries)
139
+ changes.push({ kind: 'change', group: 'runtime', pluginId,
140
+ title: `${set.set}/${entry.key}/${entry.variant}`,
141
+ description: `${entry.runner} · ${entry.entry} · 固定参数 ${JSON.stringify(entry.args)} · cwd=${entry.cwd}` });
142
+ }
143
+ }
144
+ return changes;
145
+ }
146
+ /** Config and scoped recovery consume the same prepared plans, including both joint scopes. */
147
+ export function managedCommandRecoveryPlanChanges(plan) {
148
+ const plans = new Map();
149
+ const visit = (current) => {
150
+ for (const group of current.nativeGroups) {
151
+ const prepared = group.preview.operationPlan;
152
+ if (prepared)
153
+ plans.set(prepared.planFingerprint, prepared);
154
+ }
155
+ for (const child of current.joint?.children ?? [])
156
+ visit(child);
157
+ };
158
+ visit(plan);
159
+ return managedCommandPlanChanges([...plans.values()].flatMap((prepared) => prepared.actions), [...plans.values()].flatMap((prepared) => prepared.nativeToolChanges ?? []), [...plans.values()].flatMap((prepared) => prepared.deploymentPlans ?? []));
160
+ }
161
+ function scriptTimeoutChanges(intent) {
162
+ let configuredTimeoutMs;
163
+ if (intent.kind === 'pluginWriteTask') {
164
+ configuredTimeoutMs = intent.scriptTimeoutMs;
165
+ }
166
+ else if ((intent.kind === 'pluginWrite' || intent.kind === 'pluginWriteBatch')
167
+ && (intent.action === 'install' || intent.action === 'refreshAndSync'
168
+ || intent.action === 'reinstall' || intent.action === 'sync')) {
169
+ configuredTimeoutMs = intent.scriptTimeoutMs;
170
+ }
171
+ else if ((intent.kind === 'configSave' || intent.kind === 'configSaveBatch') && intent.apply) {
172
+ configuredTimeoutMs = intent.scriptTimeoutMs;
173
+ }
174
+ else {
175
+ return [];
176
+ }
177
+ const timeoutMs = parseScriptTimeoutMs(configuredTimeoutMs ?? SCRIPT_TIMEOUT_DEFAULT_MS);
178
+ return [{
179
+ kind: 'keep',
180
+ group: 'runtime',
181
+ title: 'preApply 脚本超时',
182
+ description: `${timeoutMs} ms`,
183
+ }];
184
+ }
185
+ function preApplyScopeChanges(targets) {
186
+ return [...new Map(targets.map((target) => [[
187
+ target.pluginId,
188
+ target.platform,
189
+ target.scope,
190
+ ].join('\0'), target])).values()].map((target) => ({
191
+ kind: 'change',
192
+ group: 'runtime',
193
+ pluginId: target.pluginId,
194
+ ...(target.relation ? { relation: target.relation } : {}),
195
+ title: `运行 ${target.pluginId} preApply`,
196
+ description: `${agentLabel(target.platform)} · ${scopeLabel(target.scope)}`,
197
+ }));
198
+ }
199
+ function operationPreApplyTargets(evidence) {
200
+ return (evidence?.operationPlan?.actions ?? []).flatMap((action) => action.kind === 'runPreApply'
201
+ ? [{
202
+ ...action,
203
+ ...(evidence?.dependencyPlan
204
+ ? { relation: dependencyRelation(evidence.dependencyPlan, action.pluginId) }
205
+ : {}),
206
+ }]
207
+ : []);
208
+ }
209
+ function offlineCleanupPlans(evidence) {
210
+ if (!evidence)
211
+ return [];
212
+ return evidence.offlineCleanupPlans
213
+ ?? (evidence.offlineCleanup ? [evidence.offlineCleanup] : []);
214
+ }
215
+ function offlineCleanupReviewChanges(evidence) {
216
+ const plans = offlineCleanupPlans(evidence);
217
+ return plans.flatMap((target) => {
218
+ const targetDescription = `${platformLabel(target.platform)} · ${scopeLabel(target.scope)}`;
219
+ const actions = target.plan.actions.length;
220
+ return [
221
+ {
222
+ kind: 'change',
223
+ group: 'requested',
224
+ pluginId: target.pluginId,
225
+ relation: 'requested',
226
+ title: '核验当前 AW 管理现场',
227
+ description: targetDescription,
228
+ },
229
+ actions > 0 ? {
230
+ kind: 'remove',
231
+ group: 'requested',
232
+ pluginId: target.pluginId,
233
+ relation: 'requested',
234
+ title: '移除可验证的 AW 输出',
235
+ description: `${targetDescription} · ${actions} 项`,
236
+ } : {
237
+ kind: 'keep',
238
+ group: 'preserved',
239
+ pluginId: target.pluginId,
240
+ relation: 'requested',
241
+ title: '没有可验证的 AW 输出',
242
+ description: `${targetDescription} · 不会删除现场内容`,
243
+ },
244
+ ];
245
+ });
246
+ }
247
+ function offlineCleanupPreservedChanges(evidence) {
248
+ const plans = offlineCleanupPlans(evidence);
249
+ if (plans.length === 0)
250
+ return [];
251
+ const warnings = evidence.operationPlan?.warnings ?? [];
252
+ return [
253
+ ...(warnings.length > 0 ? [{
254
+ kind: 'warning',
255
+ group: 'preserved',
256
+ title: '部分现场残留无法完整核验',
257
+ description: '这些残留会保留;可在之后重新清理。',
258
+ }] : []),
259
+ {
260
+ kind: 'keep',
261
+ group: 'preserved',
262
+ title: '保留不属于插件或被共用的内容、插件设置、依赖使用范围和其他平台或位置',
263
+ },
264
+ {
265
+ kind: 'keep',
266
+ group: 'preserved',
267
+ title: '其他根插件仍可按自己的设置使用或安装此依赖',
268
+ },
269
+ ];
270
+ }
271
+ function sourceMutationReviewChanges(mutation) {
272
+ if (mutation.action === 'add') {
273
+ const source = mutation.source;
274
+ return [
275
+ { kind: 'add', title: '保存来源配置' },
276
+ { kind: 'add', title: source.type === 'git' ? 'Git URL' : '本地目录', description: '已设置' },
277
+ ...(source.type === 'git' ? [{
278
+ kind: 'add',
279
+ title: 'Git ref policy',
280
+ description: source.refPolicy.type === 'cliChannel'
281
+ ? '跟随 CLI channel'
282
+ : `固定 ref · ${source.refPolicy.ref}`,
283
+ }, {
284
+ kind: 'add',
285
+ title: '插件目录子目录',
286
+ description: source.subdir ?? '根目录',
287
+ }] : []),
288
+ {
289
+ kind: 'add',
290
+ title: '自动检查',
291
+ description: source.autoCheck === false ? '关闭' : '开启',
292
+ },
293
+ ];
294
+ }
295
+ const update = mutation.update;
296
+ const changes = [];
297
+ if ('url' in update && update.url !== undefined) {
298
+ changes.push({ kind: 'change', title: 'Git URL', description: '将更新' });
299
+ }
300
+ if ('path' in update && update.path !== undefined) {
301
+ changes.push({ kind: 'change', title: '本地目录', description: '将更新' });
302
+ }
303
+ if ('refPolicy' in update && update.refPolicy)
304
+ changes.push({
305
+ kind: 'change',
306
+ title: 'Git ref policy',
307
+ description: update.refPolicy.type === 'cliChannel'
308
+ ? '跟随 CLI channel'
309
+ : `固定 ref · ${update.refPolicy.ref}`,
310
+ });
311
+ if ('subdir' in update && update.subdir !== undefined)
312
+ changes.push({
313
+ kind: 'change',
314
+ title: '插件目录子目录',
315
+ description: update.subdir ?? '根目录',
316
+ });
317
+ if ('autoCheck' in update && update.autoCheck !== undefined)
318
+ changes.push({
319
+ kind: 'change',
320
+ title: '自动检查',
321
+ description: update.autoCheck ? '开启' : '关闭',
322
+ });
323
+ return changes.length > 0 ? changes : [{ kind: 'change', title: '更新来源配置' }];
324
+ }
325
+ function operationLabels(intent, evidence) {
326
+ if (intent.kind === 'catalogStorePrune') {
327
+ const count = evidence?.catalogStore?.authorizedItems.length ?? 0;
328
+ return {
329
+ title: '清理 Catalog 本地存储',
330
+ description: `只删除本次预览确认的 ${count} 个可回收项。`,
331
+ primaryLabel: `清理 ${count} 个项目`,
332
+ destructive: true,
333
+ };
334
+ }
335
+ if (intent.kind === 'catalogSourcesRecovery') {
336
+ return {
337
+ title: '恢复插件目录来源配置',
338
+ description: '备份损坏配置,并恢复唯一的主来源 official。',
339
+ primaryLabel: '备份并恢复官方默认来源',
340
+ destructive: false,
341
+ };
342
+ }
343
+ if (intent.kind === 'portableInstall') {
344
+ return {
345
+ title: '确认安装通用 Skills',
346
+ description: '只安装已选择的 Skills;不会修改原生插件安装。',
347
+ primaryLabel: `开始安装 ${intent.selectedSkills.length} 个 Skills`,
348
+ destructive: false,
349
+ };
350
+ }
351
+ if (intent.kind === 'pluginWriteBatch') {
352
+ const labels = {
353
+ install: ['批量添加插件', '添加所选插件及其必需依赖。'],
354
+ sync: ['批量同步插件', '按已保存的设置同步所选插件。'],
355
+ reinstall: ['批量重新安装插件', '清理 AW 管理的内容后完整重建所选插件。'],
356
+ uninstall: ['批量移除插件', '移除所选插件的 AW 管理安装内容。配置保持不变。'],
357
+ cleanup: ['批量清理插件', '先核验所选位置,再取消其使用设置,并尽力清理可验证的 AW 输出。'],
358
+ };
359
+ const [title, description] = labels[intent.action];
360
+ return {
361
+ title,
362
+ description,
363
+ primaryLabel: title,
364
+ destructive: intent.action === 'reinstall' || intent.action === 'uninstall'
365
+ || intent.action === 'cleanup',
366
+ };
367
+ }
368
+ if (intent.kind === 'pluginWriteTask') {
369
+ const targetVersions = [...new Set(intent.targets.flatMap((target) => target.expectedUpdate ? [target.expectedUpdate.activeVersion] : []))];
370
+ const updateVersion = targetVersions.length === 1 ? `到 ${targetVersions[0]}` : '';
371
+ return {
372
+ title: intent.goal === 'update' ? `确认更新${updateVersion}` : '确认恢复所选插件',
373
+ description: intent.goal === 'update'
374
+ ? '使用当前已启用目录中的已确认版本更新所选安装位置。'
375
+ : '按已确认根因恢复所选安装位置,并保持已安装版本。',
376
+ primaryLabel: intent.goal === 'update' ? '开始更新' : '开始恢复',
377
+ destructive: false,
378
+ };
379
+ }
380
+ if (intent.kind === 'pluginWrite') {
381
+ if (intent.originIssue) {
382
+ if (intent.action === 'cleanup') {
383
+ return {
384
+ title: '清理已安装内容',
385
+ description: '先核验所选位置,再取消其使用设置,并尽力清理可验证的 AW 输出。',
386
+ primaryLabel: '开始清理',
387
+ destructive: true,
388
+ };
389
+ }
390
+ return {
391
+ title: '处理问题',
392
+ description: '只执行所选问题处理动作;插件设置保持不变。',
393
+ primaryLabel: '开始处理',
394
+ destructive: intent.action !== 'reinstall',
395
+ };
396
+ }
397
+ if (intent.action === 'cleanup' && intent.force === true) {
398
+ return {
399
+ title: '强制清理插件',
400
+ description: '先核验专属 AW 输出,再取消所选位置的使用设置并尽力清理;插件设置保持不变,依赖者会变为不完整。',
401
+ primaryLabel: '确认强制清理',
402
+ destructive: true,
403
+ };
404
+ }
405
+ const labels = {
406
+ install: ['添加插件', '添加所选平台和使用位置。', false],
407
+ refreshAndSync: ['刷新并同步', '刷新相关来源后,使用新的当前启用版本同步所选安装。', false],
408
+ reinstall: ['重新安装插件', '清理 AW 管理的内容后完整重建。', true],
409
+ uninstall: ['移除插件', '移除 AW 管理的安装内容。配置保持不变。', true],
410
+ cleanup: ['清理插件', '先核验所选位置,再取消其使用设置,并尽力清理可验证的 AW 输出。', true],
411
+ sync: ['同步插件', '按已保存使用设置修复当前使用位置。', false],
412
+ };
413
+ if (intent.expectedUpdate)
414
+ return {
415
+ title: `更新到 ${intent.expectedUpdate.activeVersion}`,
416
+ description: `使用当前启用目录中已确认的 ${intent.expectedUpdate.activeVersion} 同步所选安装。`,
417
+ primaryLabel: `更新到 ${intent.expectedUpdate.activeVersion}`,
418
+ destructive: false,
419
+ };
420
+ const [title, description, destructive] = labels[intent.action];
421
+ return { title, description, primaryLabel: title, destructive };
422
+ }
423
+ if (intent.kind === 'configSave') {
424
+ if (intent.retryApply) {
425
+ return {
426
+ title: '更新已有插件内容',
427
+ description: `使用已保存的用户配置,刷新${intent.context === 'project' ? '用户和当前项目' : '用户'}范围内已有的插件内容。`,
428
+ primaryLabel: '更新插件',
429
+ destructive: false,
430
+ };
431
+ }
432
+ return {
433
+ title: intent.apply ? '保存并应用插件设置' : '保存插件设置',
434
+ description: intent.apply
435
+ ? '保存所选用户配置,并更新已有插件内容。'
436
+ : '保存所选用户配置。',
437
+ primaryLabel: intent.apply ? '保存并应用' : '保存',
438
+ destructive: false,
439
+ };
440
+ }
441
+ if (intent.kind === 'configSaveBatch') {
442
+ return {
443
+ title: '确认保存设置',
444
+ description: intent.apply
445
+ ? '保存所选公共和平台配置,并更新已有插件内容。'
446
+ : '保存所选公共和平台配置。',
447
+ primaryLabel: intent.apply ? '保存并应用设置' : '保存设置',
448
+ destructive: false,
449
+ };
450
+ }
451
+ if (intent.kind === 'configReset') {
452
+ return {
453
+ title: '重置插件设置',
454
+ description: '删除所选设置层的值,恢复继承。',
455
+ primaryLabel: '重置设置',
456
+ destructive: true,
457
+ };
458
+ }
459
+ if (intent.kind === 'sourceMutation') {
460
+ const autoCheck = intent.action === 'update'
461
+ ? catalogSourceAutoCheckOnlyValue(intent.update) : undefined;
462
+ if (autoCheck !== undefined) {
463
+ return {
464
+ title: '保存自动检查设置',
465
+ description: '只保存自动检查设置;当前启用版本和本地目录副本保持不变。',
466
+ primaryLabel: '保存设置',
467
+ destructive: false,
468
+ };
469
+ }
470
+ const labels = {
471
+ add: ['添加来源', '只保存来源配置。保存后请在终端运行 source sync。', '保存来源', false],
472
+ update: ['修改来源', '只保存来源配置。保存后请在终端运行 source sync。', '保存来源', false],
473
+ setPrimary: ['设为主来源', '只改变默认 marketplace,不迁移安装。', '设为主来源', false],
474
+ remove: ['移除来源', '移除来源配置;不会删除其它来源。', '移除来源', true],
475
+ };
476
+ const [title, description, primaryLabel, destructive] = labels[intent.action];
477
+ return { title, description, primaryLabel, destructive };
478
+ }
479
+ if (intent.kind === 'catalogGeneration') {
480
+ if (intent.action === 'update' && evidence?.catalogGeneration?.exactRepair) {
481
+ return {
482
+ title: '验证并精确修复插件目录',
483
+ description: '待检查版本与当前启用版本的技术标识相同。精确替换损坏内容,并保留当前启用版本。',
484
+ primaryLabel: '验证并精确修复',
485
+ destructive: false,
486
+ };
487
+ }
488
+ const labels = {
489
+ activate: ['获取并启用插件目录', '检查待检查版本后启用。不会升级已安装插件,也不会修改其他来源。', '获取并启用'],
490
+ update: ['检查并切换插件目录', '检查待检查版本后切换当前启用版本。失败时保留原当前启用版本。', '检查并切换'],
491
+ repair: ['重新下载并修复插件目录', '只修复这个来源的当前启用版本,不删除其他目录版本副本。', '重新下载并修复'],
492
+ replaceDamaged: ['替换损坏的当前启用版本', '使用待检查版本替换无法精确修复的当前启用版本。失败时保留原版本。', '确认并替换'],
493
+ recoverState: ['恢复插件目录状态并启用', '重建无效的目录版本状态,并只启用已确认的目标来源。来源配置和本地目录副本保持不变。', '恢复状态并启用'],
494
+ };
495
+ const [title, description, primaryLabel] = labels[intent.action];
496
+ return { title, description, primaryLabel, destructive: false };
497
+ }
498
+ throw plannerError('operationNotImplemented', '问题修复操作尚未接入。');
499
+ }
500
+ function dependencyRelation(plan, pluginId) {
501
+ if (plan.requestedPluginIds.includes(pluginId))
502
+ return 'requested';
503
+ return plan.dependencyEdges.some((edge) => plan.requestedPluginIds.includes(edge.from) && edge.to === pluginId)
504
+ ? 'direct'
505
+ : 'transitive';
506
+ }
507
+ function reviewChanges(intent, evidence, dependencyOverview) {
508
+ if (intent.kind === 'catalogStorePrune') {
509
+ const store = evidence?.catalogStore;
510
+ if (!store)
511
+ throw plannerError('catalogStorePrepareFailed', '缺少 Catalog 本地存储预览证据。');
512
+ const bytes = store.reclaimableBytes === null
513
+ ? '大小未知'
514
+ : `${store.reclaimableBytes} bytes`;
515
+ return [
516
+ {
517
+ kind: 'remove',
518
+ title: `删除 ${store.authorizedItems.length} 个已确认的可回收项`,
519
+ description: bytes,
520
+ },
521
+ { kind: 'keep', title: '保留 Active Catalog、foreign 内容和无法证明安全的项目' },
522
+ { kind: 'keep', title: '保留预览以后出现的新项目' },
523
+ ];
524
+ }
525
+ if (intent.kind === 'catalogSourcesRecovery') {
526
+ return [
527
+ { kind: 'add', title: '备份损坏的 catalog-sources.json' },
528
+ { kind: 'change', title: '恢复唯一的主来源 official' },
529
+ { kind: 'keep', title: '保留 catalog-state.json 和 catalog-store' },
530
+ {
531
+ kind: 'warning',
532
+ title: '自定义来源需要之后重新添加',
533
+ description: '无法从损坏配置中安全恢复自定义来源。',
534
+ },
535
+ ];
536
+ }
537
+ if (intent.kind === 'portableInstall') {
538
+ const review = evidence?.portable;
539
+ if (!review)
540
+ throw plannerError('portablePrepareFailed', '缺少通用 Skills Review 证据。');
541
+ const retry = 'targetGroups' in review ? review : undefined;
542
+ return [
543
+ ...review.selected.map((skill) => ({
544
+ kind: 'add',
545
+ group: skill.relation === 'requested' ? 'requested' : 'dependencies',
546
+ pluginId: skill.providerPluginId,
547
+ relation: skill.relation,
548
+ title: skill.name,
549
+ description: `${skill.description} · ${skill.providerDisplayName}${skill.dynamic ? ' · 按设置生成' : ''}`,
550
+ })),
551
+ ...(retry ? retry.targetGroups.map((group) => ({
552
+ kind: 'change',
553
+ group: 'portableTarget',
554
+ title: `精确重试 · ${group.agent}`,
555
+ description: group.skills.join('、'),
556
+ })) : [{ kind: 'change', group: 'portableTarget', title: 'Agent', description: review.agentMode === 'automatic'
557
+ ? '自动选择检测到的 Agent;实际目标由 Skills CLI 决定,不表示安装到所有 Agent'
558
+ : review.requestedAgents.join('、') }]),
559
+ { kind: 'change', group: 'portableTarget', title: '范围', description: review.scope === 'project' ? '当前项目' : '所有项目' },
560
+ { kind: review.dependencies.length > 0 ? 'keep' : 'change', group: 'portableInputs', title: '插件依赖', description: review.dependencies.length > 0
561
+ ? `${review.dependencies.length} 个依赖用于生成,不能取消` : '无需插件依赖' },
562
+ ...(review.collisions.length > 0 ? [{ kind: 'warning', group: 'portableWarnings', title: '同名覆盖',
563
+ description: review.collisions.map((collision) => collision.name).join('、') }] : []),
564
+ ];
565
+ }
566
+ if (intent.kind === 'pluginWrite') {
567
+ const desiredIntentKind = requestedIntentAction(intent.action === 'refreshAndSync' ? 'sync' : intent.action);
568
+ const runtimeChanges = [
569
+ ...scriptTimeoutChanges(intent),
570
+ ...deploymentPlanLines(evidence?.operationPlan?.deploymentPlans ?? []).map((description) => ({ kind: 'change',
571
+ group: 'runtime', title: '原生部署', description })),
572
+ ...deploymentExclusionLines(evidence?.operationPlan?.deploymentExclusions ?? []).map((description) => ({ kind: 'warning',
573
+ group: 'runtime', title: '未执行的产品面', description })),
574
+ ...managedCommandPlanChanges(evidence?.operationPlan?.actions ?? [], evidence?.operationPlan?.nativeToolChanges, evidence?.operationPlan?.deploymentPlans),
575
+ ...preApplyScopeChanges(operationPreApplyTargets(evidence)),
576
+ ...(evidence?.codexManager
577
+ ? [{
578
+ kind: 'keep',
579
+ group: 'runtime',
580
+ title: '本机 Codex CLI',
581
+ description: `${evidence.codexManager.source === 'app' ? 'Codex App' : 'PATH'} · ${evidence.codexManager.version}`,
582
+ }]
583
+ : []),
584
+ ...(evidence?.codexManager?.diagnostics ?? []).map((diagnostic) => ({
585
+ kind: 'warning', group: 'runtime', title: 'Codex 候选诊断',
586
+ description: sanitizeDiagnosticText(diagnostic),
587
+ })),
588
+ ];
589
+ const codexChanges = (evidence?.codexReconcilePlans ?? []).flatMap((codexPlan) => [
590
+ ...codexPlan.sharedNativeActions.map((action) => ({
591
+ kind: action.action === 'reuse' || action.action === 'none' ? 'keep'
592
+ : action.action === 'install' ? 'add' : 'change',
593
+ group: 'sharedCodexNative',
594
+ pluginId: action.pluginId,
595
+ title: action.codexPluginId,
596
+ description: action.action === 'reuse'
597
+ ? '复用完全相同的由平台共用内容'
598
+ : `${{
599
+ install: '添加',
600
+ update: '更新',
601
+ repair: '修复',
602
+ replace: '替换',
603
+ remove: '移除',
604
+ none: '保持不变',
605
+ }[action.action]}由平台共用的内容${action.affectsOtherScopes ? ' · 可能影响其他项目' : ''}`,
606
+ })),
607
+ ...codexPlan.activationActions.user.map((action) => ({
608
+ kind: action.action === 'none' ? 'keep' : action.desired ? 'change' : 'remove',
609
+ group: 'userActivation',
610
+ pluginId: action.pluginId,
611
+ title: action.codexPluginId,
612
+ description: `${action.desired ? '启用' : '停用'}所有项目位置 · ${action.action === 'none' ? '保持不变' : '将更新'}`,
613
+ })),
614
+ ...codexPlan.activationActions.project.map((action) => ({
615
+ kind: action.action === 'none' ? 'keep' : action.desired ? 'change' : 'remove',
616
+ group: 'projectActivation',
617
+ pluginId: action.pluginId,
618
+ title: action.codexPluginId,
619
+ description: `${action.desired ? '启用' : '停用'}当前项目位置 · ${action.action === 'none' ? '保持不变' : '将更新'}`,
620
+ })),
621
+ ...[...codexPlan.extensionWrites, ...codexPlan.extensionRemovals]
622
+ .map((action) => ({
623
+ kind: action.action === 'write' ? 'change' : 'remove',
624
+ group: 'awExtensions',
625
+ pluginId: action.pluginId,
626
+ title: action.componentKey,
627
+ description: `${scopeLabel(action.scope)} · ${action.action === 'write' ? '写入' : '移除'}`,
628
+ })),
629
+ ]);
630
+ const plan = evidence?.dependencyPlan;
631
+ if (plan && (intent.action === 'install' || intent.action === 'refreshAndSync'
632
+ || intent.action === 'reinstall' || intent.action === 'sync')) {
633
+ const changes = plan.targets.map((target) => {
634
+ const relation = dependencyRelation(plan, target.pluginId);
635
+ return {
636
+ kind: desiredIntentKind,
637
+ group: relation === 'requested' ? 'requested' : 'dependencies',
638
+ pluginId: target.pluginId,
639
+ relation,
640
+ title: pluginNameFromId(target.pluginId),
641
+ description: `${platformLabel(target.platform)} · ${scopeLabel(target.resolvedScope)}${target.action === 'keep' ? ' · 已可用' : ''}${target.assignmentSource === 'existingWiderTarget' ? ' · 复用健康的所有项目安装' : target.assignmentSource === 'consumerPromotion' ? ' · 根据依赖自动扩大范围' : ''}`,
642
+ };
643
+ });
644
+ changes.push({
645
+ kind: 'keep',
646
+ group: 'preserved',
647
+ title: '插件设置和已有依赖保持不变',
648
+ description: '移除根插件时不会自动清理依赖。',
649
+ });
650
+ return [...changes, ...codexChanges, ...runtimeChanges];
651
+ }
652
+ if (intent.action === 'cleanup' && evidence) {
653
+ const cleanupChanges = offlineCleanupReviewChanges(evidence);
654
+ if (cleanupChanges.length > 0) {
655
+ const changes = [
656
+ ...cleanupChanges,
657
+ ...offlineCleanupPreservedChanges(evidence),
658
+ ];
659
+ if (intent.force === true)
660
+ changes.push({
661
+ kind: 'warning',
662
+ title: '跳过依赖保护',
663
+ description: '依赖此插件的插件会变为不完整,需重新安装后恢复。',
664
+ });
665
+ return [...changes, ...codexChanges, ...runtimeChanges];
666
+ }
667
+ }
668
+ const platforms = intent.platform === 'both'
669
+ ? ['codex', 'claude']
670
+ : [intent.platform];
671
+ const changes = platforms.map((platform) => ({
672
+ kind: intent.action === 'uninstall' || intent.action === 'cleanup' ? 'remove' : intent.action === 'install' ? 'add' : 'change',
673
+ group: 'requested',
674
+ pluginId: intent.pluginId,
675
+ relation: 'requested',
676
+ title: `${platformLabel(platform)} · ${scopeLabel(intent.scope)}`,
677
+ description: intent.action === 'uninstall' || intent.action === 'cleanup'
678
+ ? '插件设置不会删除。'
679
+ : '执行前会再次检查当前安装状态。',
680
+ }));
681
+ if (intent.action === 'uninstall' || intent.action === 'cleanup') {
682
+ changes.push(...(dependencyOverview?.dependencies ?? []).map((dependency) => ({
683
+ kind: 'keep',
684
+ group: 'preserved',
685
+ pluginId: dependency.pluginId,
686
+ relation: dependency.relation === 'direct' ? 'direct' : 'transitive',
687
+ title: dependency.displayName,
688
+ description: '依赖保持安装。',
689
+ })));
690
+ }
691
+ if (intent.action === 'cleanup' && intent.force === true) {
692
+ changes.push({
693
+ kind: 'warning',
694
+ title: '跳过依赖保护',
695
+ description: '依赖此插件的插件会变为不完整,需重新安装后恢复。',
696
+ });
697
+ }
698
+ if (intent.originIssue) {
699
+ changes.push({ kind: 'keep', title: '插件设置保持不变' }, { kind: 'warning', title: '执行前重新检查完整目标和来源证据' });
700
+ }
701
+ if (intent.recoveryDescription) {
702
+ changes.push({
703
+ kind: 'warning',
704
+ group: 'preserved',
705
+ title: `后续:同步${intent.scope === 'user' ? '当前项目' : '所有项目'}位置`,
706
+ description: '完成此操作后,同步要保留的使用位置。',
707
+ });
708
+ }
709
+ return [...changes, ...codexChanges, ...runtimeChanges];
710
+ }
711
+ if (intent.kind === 'configReset') {
712
+ const layerLabel = intent.expectedStoreState === 'invalid' ? '无效用户配置文档'
713
+ : intent.platform ? `${agentLabel(intent.platform)} 平台配置` : '公共配置';
714
+ const impact = evidence?.config;
715
+ const impactChanges = impact?.impactState === 'unknown'
716
+ ? [{
717
+ kind: 'warning', group: 'configImpact', title: '设置重置后的应用影响未知',
718
+ description: '当前无法解析来源或设置;重置仍会删除所选设置层。',
719
+ }]
720
+ : impact?.noEffectiveChange
721
+ ? [{ kind: 'keep', group: 'configImpact', title: '有效设置输入不变;无需同步当前安装' }]
722
+ : (impact?.affectedTargets ?? []).length > 0
723
+ ? impact.affectedTargets.map((target) => ({
724
+ kind: 'warning', group: 'configImpact',
725
+ title: `重置后需同步 ${agentLabel(target.platform)} · ${scopeLabel(target.scope)}`,
726
+ }))
727
+ : [{ kind: 'keep', group: 'configImpact', title: '只删除设置层;当前安装保持不变' }];
728
+ return [
729
+ ...(intent.changes?.map((change) => ({
730
+ kind: 'remove', group: 'configChanges', title: `${layerLabel} · ${change.title}`,
731
+ description: change.children && change.children.length > 0
732
+ ? `${change.before} → ${change.after};${change.children.length} 个子项变化;${change.children.map((child) => `${child.property}: ${child.private ? '已设置 → 将更新' : `${child.before} → ${child.after}`}`).join(';')}`
733
+ : `${change.before} → ${change.after}`,
734
+ })) ?? [{ kind: 'remove', group: 'configChanges', title: `删除${layerLabel}中的已存值`, description: '删除整个设置层且不创建备份;有效值将恢复为继承值或默认值。' }]),
735
+ ...impactChanges,
736
+ ...configCommandPackageChanges(evidence, false),
737
+ ...(intent.expectedStoreState === 'invalid' ? []
738
+ : [{ kind: 'keep', group: 'preserved', title: '其他公共和平台配置保持不变' }]),
739
+ ];
740
+ }
741
+ if (intent.kind === 'sourceMutation') {
742
+ const changes = (intent.changes ?? []).map((change) => ({
743
+ kind: intent.action === 'remove' ? 'remove' : intent.action === 'add' ? 'add' : 'change',
744
+ title: change.title,
745
+ ...(change.private
746
+ ? { description: change.before ? '已设置 → 将更新' : '已选择' }
747
+ : change.before || change.after
748
+ ? { description: `${change.before ?? '未设置'} → ${change.after ?? '未设置'}` }
749
+ : {}),
750
+ }));
751
+ if (intent.action === 'add')
752
+ changes.push({ kind: 'keep', title: '保留现有主来源' });
753
+ if (intent.action === 'setPrimary')
754
+ changes.push({ kind: 'keep', title: '同名插件选择保持不变' }, { kind: 'keep', title: '现有安装和设置不会迁移' });
755
+ if (intent.action === 'remove')
756
+ changes.push({ kind: 'keep', title: '保留其他来源' });
757
+ const impact = evidence?.sourceWrite?.impact;
758
+ if (impact) {
759
+ for (const category of ['installation', 'config', 'lifecycle', 'marketplace']) {
760
+ const count = impact.affectedReferences.filter((reference) => reference.category === category).length;
761
+ if (count > 0)
762
+ changes.push({
763
+ kind: 'warning',
764
+ title: `${category === 'installation' ? '安装' : category === 'config' ? '设置' : category === 'lifecycle' ? '生命周期意图' : 'Marketplace'}引用受影响`,
765
+ description: `${count} 项`,
766
+ });
767
+ }
768
+ if (!impact.inventoryComplete)
769
+ changes.push({
770
+ kind: 'warning',
771
+ title: '来源影响未知',
772
+ description: '部分状态无法读取;不能把影响视为零。',
773
+ });
774
+ }
775
+ return changes;
776
+ }
777
+ if (intent.kind === 'catalogGeneration') {
778
+ const generation = evidence?.catalogGeneration;
779
+ if (!generation) {
780
+ throw plannerError('catalogGenerationUnavailable', '缺少插件目录待检查版本证据。');
781
+ }
782
+ return [
783
+ ...(generation.previousActive ? [{
784
+ kind: 'keep',
785
+ title: generation.previousActiveVersion
786
+ ? `当前启用版本 ${generation.previousActiveVersion}` : '当前启用版本',
787
+ description: `${generation.previousActive.resolvedCommit.slice(0, 8)} · ${generation.previousActive.snapshotDigest.slice(0, 15)}`,
788
+ }] : []),
789
+ {
790
+ kind: intent.action === 'activate' ? 'add' : 'change',
791
+ title: generation.exactRepair
792
+ ? `精确修复待检查版本 ${generation.candidate.catalogVersion}`
793
+ : `待检查版本 ${generation.candidate.catalogVersion}`,
794
+ description: `${generation.candidate.resolvedCommit.slice(0, 8)} · ${generation.candidate.snapshotDigest.slice(0, 15)}`,
795
+ },
796
+ ...(generation.exactRepair ? [{
797
+ kind: 'change',
798
+ title: '精确替换损坏的当前启用版本',
799
+ description: '版本和内容的技术标识保持不变。',
800
+ }] : []),
801
+ ...(intent.action === 'replaceDamaged' ? [{
802
+ kind: 'warning',
803
+ title: '使用待检查版本替换损坏的当前启用版本',
804
+ description: '旧版本无法安全比较;确认后只切换到本次已检查的版本。',
805
+ }] : []),
806
+ ...(generation.sourceMutation ? sourceMutationReviewChanges(generation.sourceMutation) : []),
807
+ ...(generation.explicitSourceChange && generation.candidateRelation === 'rollbackDetected' ? [{
808
+ kind: 'warning',
809
+ title: '来源切换将降低插件目录版本',
810
+ description: `${generation.previousActiveVersion ?? '当前版本'} → ${generation.candidate.catalogVersion}`,
811
+ }] : generation.explicitSourceChange && generation.candidateRelation === 'versionConflict' ? [{
812
+ kind: 'warning',
813
+ title: '来源切换包含同版本不同内容',
814
+ description: `${generation.candidate.catalogVersion} · ${generation.candidate.snapshotDigest.slice(0, 15)}`,
815
+ }] : generation.explicitSourceChange && generation.candidateRelation === 'incompatible' ? [{
816
+ kind: 'warning',
817
+ title: '来源切换将改变插件目录身份',
818
+ description: '确认前请核对新来源身份和待检查版本摘要。',
819
+ }] : []),
820
+ ...((generation.impact?.affectedReferences ?? []).length > 0 ? [{
821
+ kind: 'warning',
822
+ title: '现有引用受待检查版本影响',
823
+ description: `${generation.impact.affectedReferences.length} 项;已安装插件不会自动修改。`,
824
+ }] : []),
825
+ ...(generation.impact && !generation.impact.inventoryComplete ? [{
826
+ kind: 'warning',
827
+ title: '待检查版本的影响未知',
828
+ description: '部分状态或旧插件定义无法读取;不能把影响视为零。',
829
+ }] : []),
830
+ ...((generation.primaryImpact?.affectedReferences ?? []).length > 0 ? [{
831
+ kind: 'warning',
832
+ title: '切换主来源会影响现有引用',
833
+ description: `${generation.primaryImpact.affectedReferences.length} 项;切换将在插件目录启用后执行。`,
834
+ }] : []),
835
+ ...(generation.primaryImpact && !generation.primaryImpact.inventoryComplete ? [{
836
+ kind: 'warning',
837
+ title: '主来源切换影响未知',
838
+ description: '部分状态无法读取;不能把影响视为零。',
839
+ }] : []),
840
+ { kind: 'keep', title: '不会升级已安装插件' },
841
+ { kind: 'keep', title: intent.action === 'recoverState'
842
+ ? '不会修改其他来源配置或本地目录副本' : '不会修改其他来源' },
843
+ { kind: 'keep', title: '失败时保留原当前启用版本' },
844
+ ...(intent.action === 'recoverState' ? [{
845
+ kind: 'warning',
846
+ title: '无效状态中的其他当前启用版本记录不会保留',
847
+ description: '其他来源配置和本地目录副本不会删除;可分别重新启用。',
848
+ }] : []),
849
+ ];
850
+ }
851
+ if (intent.kind === 'configSaveBatch') {
852
+ if (!evidence?.configBatch
853
+ || evidence.configBatch.groups.length !== intent.groups.length) {
854
+ throw plannerError('configBatchPrepareFailed', '缺少多层设置 Review 证据。');
855
+ }
856
+ return [
857
+ ...scriptTimeoutChanges(intent),
858
+ ...intent.groups.flatMap((group) => {
859
+ const groupEvidence = evidence.configBatch.groups.find((item) => item.platform === group.platform);
860
+ if (!groupEvidence) {
861
+ throw plannerError('configBatchPrepareFailed', '设置层 Review 证据不完整。');
862
+ }
863
+ return reviewChanges({
864
+ kind: 'configSave',
865
+ pluginId: intent.pluginId,
866
+ scope: 'user', platform: group.platform, context: intent.context ?? 'user',
867
+ apply: intent.apply,
868
+ ...(group.updates ? { updates: group.updates } : {}),
869
+ ...(group.removeKeys ? { removeKeys: group.removeKeys } : {}),
870
+ ...(group.sensitiveKeys ? { sensitiveKeys: group.sensitiveKeys } : {}),
871
+ ...(group.privateKeys ? { privateKeys: group.privateKeys } : {}),
872
+ ...(group.changes ? { changes: group.changes } : {}),
873
+ }, {
874
+ catalog: evidence.catalog,
875
+ ...(evidence.source ? { source: evidence.source } : {}),
876
+ targetFingerprint: groupEvidence.targetFingerprint,
877
+ config: groupEvidence.config,
878
+ }, dependencyOverview);
879
+ }),
880
+ ];
881
+ }
882
+ if (intent.kind !== 'configSave') {
883
+ throw plannerError('operationNotImplemented', '这个写操作尚未接入新 Controller。');
884
+ }
885
+ const privateKeys = new Set([...(intent.sensitiveKeys ?? []), ...(intent.privateKeys ?? [])]);
886
+ const removeKeys = new Set(intent.removeKeys ?? []);
887
+ const layerLabel = intent.platform ? `${agentLabel(intent.platform)} 平台配置` : '公共配置';
888
+ if (intent.retryApply) {
889
+ return [
890
+ ...scriptTimeoutChanges(intent),
891
+ ...(evidence?.config?.commandReviewChanges ?? []),
892
+ ...preApplyScopeChanges(evidence?.config?.preApplyAuthorization ?? []),
893
+ ...configCommandPackageChanges(evidence, true),
894
+ ...(evidence?.config?.applyChanges ?? []).map((title) => ({ kind: 'change', group: 'configImpact', title })),
895
+ ...(evidence?.config?.applyWarnings ?? []).map((title) => ({ kind: 'warning', group: 'configImpact', title })),
896
+ ...(evidence?.config?.applyBlockers ?? []).map((item) => ({
897
+ kind: 'warning', group: 'configImpact', title: item.code, description: item.message,
898
+ })),
899
+ ...(evidence?.config?.sharedNativeRenderUnits ?? []).filter((shared) => evidence?.config?.affectedTargets
900
+ .some((target) => sharedUnitMatchesTarget(shared, target, intent.pluginId))).map((shared) => ({
901
+ kind: 'change', group: 'configImpact', title: `重新生成 ${shared.pluginName} · ${platformLabel(shared.platform)} 共享组件集合`,
902
+ description: `配置来源为用户配置;影响所有启用项目。${shared.dynamicComponents ? '动态组件名称和数量需在准备后确认。' : ''}${shared.commandSets.length ? `命令集合:${shared.commandSets.map((set) => set.set).join('、')}。` : ''}`,
903
+ })),
904
+ ...(evidence?.config?.affectedTargets.map((target) => ({
905
+ kind: 'change',
906
+ group: 'configImpact',
907
+ title: `重新应用 ${target.pluginName ? `${target.pluginName} · ` : ''}${agentLabel(target.platform)} · ${scopeLabel(target.scope)}`,
908
+ })) ?? []),
909
+ { kind: 'keep', group: 'preserved', title: `${layerLabel}中的当前值保持不变` },
910
+ { kind: 'keep', group: 'preserved', title: '不会恢复历史设置值' },
911
+ ];
912
+ }
913
+ if (intent.changes) {
914
+ const noEffectiveChange = evidence?.config?.noEffectiveChange === true;
915
+ const sharedNativeTargets = (evidence?.config?.sharedNativeRenderUnits ?? []).filter((shared) => evidence?.config?.affectedTargets.some((target) => sharedUnitMatchesTarget(shared, target, intent.pluginId)));
916
+ const sharedPlatforms = [...new Set(sharedNativeTargets.map((target) => target.platform))];
917
+ const sharedPlatformLabel = sharedPlatforms.map(platformLabel).join('、');
918
+ const sharedSetLabel = sharedNativeTargets.some((unit) => unit.dynamicComponents) ? '共享组件集合(动态名称和数量待准备)' : '共享组件集合';
919
+ const sharedNativeImpact = noEffectiveChange || sharedNativeTargets.length === 0
920
+ ? []
921
+ : intent.apply
922
+ ? [
923
+ {
924
+ kind: 'change', group: 'configImpact',
925
+ title: `重新生成 ${sharedNativeTargets.map((target) => target.pluginName).filter((name, index, names) => names.indexOf(name) === index).join('、')} ${sharedSetLabel}`,
926
+ description: `配置来源为用户配置;更新 ${sharedPlatformLabel} 由平台共用的内容会影响所有启用项目。`,
927
+ },
928
+ { kind: 'keep', group: 'preserved', title: '保留所有项目和当前项目的启用位置' },
929
+ ]
930
+ : [
931
+ {
932
+ kind: 'warning', group: 'configImpact',
933
+ title: `${sharedPlatformLabel} 由平台共用的内容待同步`,
934
+ description: `用户配置已保存;${sharedSetLabel} 尚未重新生成。`,
935
+ },
936
+ { kind: 'keep', group: 'preserved', title: '当前由平台共用的内容和启用位置保持不变' },
937
+ ];
938
+ return [
939
+ ...scriptTimeoutChanges(intent),
940
+ ...preApplyScopeChanges(evidence?.config?.preApplyAuthorization ?? []),
941
+ ...intent.changes.map((change) => ({
942
+ kind: removeKeys.has(change.key) ? 'remove' : 'change',
943
+ group: 'configChanges',
944
+ title: removeKeys.has(change.key)
945
+ ? `${layerLabel} · 删除 ${change.title} 中的值`
946
+ : `${layerLabel} · ${change.title}`,
947
+ description: change.children && change.children.length > 0
948
+ ? `${change.before} → ${change.after};${change.children.length} 个子项变化;${change.children.map((child) => `${child.property}: ${child.private ? '已设置 → 将更新' : `${child.before} → ${child.after}`}`).join(';')}`
949
+ : removeKeys.has(change.key)
950
+ ? privateKeys.has(change.key) ? `已设置 → ${change.after}` : `${change.before} → ${change.after}`
951
+ : privateKeys.has(change.key) ? '已设置 → 将更新'
952
+ : `${change.before} → ${change.after}`,
953
+ })),
954
+ ...(evidence?.config?.impactState === 'unknown' ? [{
955
+ kind: 'warning', group: 'configImpact',
956
+ title: '设置的应用影响未知',
957
+ description: '当前无法比较保存前后的有效设置输入。',
958
+ }] : noEffectiveChange ? [{
959
+ kind: 'keep', group: 'configImpact',
960
+ title: '有效设置输入不变;无需重新应用',
961
+ }] : []),
962
+ ...sharedNativeImpact,
963
+ ...configCommandPackageChanges(evidence, intent.apply),
964
+ ...(evidence?.config?.impactState === 'unknown' || noEffectiveChange || sharedNativeTargets.length > 0
965
+ ? []
966
+ : intent.apply && (evidence?.config?.affectedTargets.length ?? 0) > 0
967
+ ? evidence.config.affectedTargets.map((target) => ({
968
+ kind: 'change', group: 'configImpact', title: `重新应用 ${target.pluginName ? `${target.pluginName} · ` : ''}${agentLabel(target.platform)} · ${scopeLabel(target.scope)}`,
969
+ }))
970
+ : !intent.apply && (evidence?.config?.affectedTargets.length ?? 0) > 0
971
+ ? evidence.config.affectedTargets.map((target) => ({
972
+ kind: 'warning', group: 'configImpact', title: `保存后需同步 ${target.pluginName ? `${target.pluginName} · ` : ''}${agentLabel(target.platform)} · ${scopeLabel(target.scope)}`,
973
+ }))
974
+ : (evidence?.config?.commandPackages?.length ?? 0) > 0 ? []
975
+ : [{ kind: 'keep', group: 'configImpact', title: '当前没有可见安装;只保存设置' }]),
976
+ { kind: 'keep', group: 'preserved', title: '其他项目不会被自动扫描' },
977
+ ];
978
+ }
979
+ const updateKeys = Object.keys(intent.updates ?? {});
980
+ return [
981
+ ...scriptTimeoutChanges(intent),
982
+ ...preApplyScopeChanges(evidence?.config?.preApplyAuthorization ?? []),
983
+ ...updateKeys.map((key) => ({
984
+ kind: 'change',
985
+ title: key,
986
+ description: privateKeys.has(key) ? '已设置 → 将更新' : '将更新',
987
+ })),
988
+ ...(intent.removeKeys ?? []).map((key) => ({
989
+ kind: 'remove',
990
+ title: key,
991
+ description: privateKeys.has(key) ? '已设置 → 未设置' : '恢复继承',
992
+ })),
993
+ ];
994
+ }
995
+ function batchGroupEvidence(evidence, group) {
996
+ const manager = codexManagerEvidence(group.preview.codexManagerPreview);
997
+ return {
998
+ catalog: evidence.catalog,
999
+ ...(group.preview.offlineCleanupPlans
1000
+ ? { offlineCleanupPlans: group.preview.offlineCleanupPlans }
1001
+ : {}),
1002
+ ...(group.preview.dependencyPlan ? { dependencyPlan: group.preview.dependencyPlan } : {}),
1003
+ ...(group.preview.codexReconcilePlans ? { codexReconcilePlans: group.preview.codexReconcilePlans } : {}),
1004
+ ...(group.preview.operationPlan ? { operationPlan: group.preview.operationPlan } : {}),
1005
+ ...(manager ? { codexManager: manager } : {}),
1006
+ };
1007
+ }
1008
+ function taskSourceEvidence(evidence, source) {
1009
+ const manager = codexManagerEvidence(source.preview.codexManagerPreview);
1010
+ return {
1011
+ catalog: evidence.catalog,
1012
+ ...(source.preview.dependencyPlan ? { dependencyPlan: source.preview.dependencyPlan } : {}),
1013
+ ...(source.preview.codexReconcilePlans
1014
+ ? { codexReconcilePlans: source.preview.codexReconcilePlans } : {}),
1015
+ ...(source.preview.operationPlan ? { operationPlan: source.preview.operationPlan } : {}),
1016
+ ...(manager ? { codexManager: manager } : {}),
1017
+ };
1018
+ }
1019
+ function taskReviewChanges(intent, evidence) {
1020
+ const requested = evidence.taskPlan.executableTargets.map((target) => ({
1021
+ kind: 'change',
1022
+ group: 'requested',
1023
+ pluginId: target.pluginId,
1024
+ sourceId: target.pluginId.slice(0, target.pluginId.indexOf('/')),
1025
+ relation: 'requested',
1026
+ title: pluginNameFromId(target.pluginId),
1027
+ description: `${platformLabel(target.platform)} · ${scopeLabel(target.scope)}`
1028
+ + (target.expectedUpdate
1029
+ ? ` · ${target.expectedUpdate.installedVersion} → ${target.expectedUpdate.activeVersion}`
1030
+ : ' · 保持已安装版本'),
1031
+ }));
1032
+ const causes = evidence.taskPlan.causes.map((cause) => ({
1033
+ kind: 'change',
1034
+ group: 'dependencies',
1035
+ pluginId: cause.repairTarget.pluginId,
1036
+ sourceId: cause.sourceId,
1037
+ relation: cause.consumers.some((consumer) => consumer.pluginId === cause.repairTarget.pluginId
1038
+ && consumer.platform === cause.repairTarget.platform
1039
+ && consumer.scope === cause.repairTarget.scope) ? 'requested' : 'direct',
1040
+ title: pluginNameFromId(cause.repairTarget.pluginId),
1041
+ description: `${cause.method === 'reinstall' ? '重新安装' : '同步'} · `
1042
+ + `${platformLabel(cause.repairTarget.platform)} · ${scopeLabel(cause.repairTarget.scope)}`
1043
+ + (cause.restoreVersionEvidence?.state === 'preserved'
1044
+ ? ` · 保持 ${cause.restoreVersionEvidence.installedVersion}`
1045
+ : cause.restoreVersionEvidence?.state === 'absent'
1046
+ ? ` · 补齐 ${cause.restoreVersionEvidence.activeVersion}` : '')
1047
+ + ` · 影响 ${cause.consumers.length} 个所选安装位置`,
1048
+ }));
1049
+ const runtime = evidence.taskPlan.sources.flatMap((source) => preApplyScopeChanges(operationPreApplyTargets(taskSourceEvidence(evidence, source))));
1050
+ const blocked = evidence.taskPlan.blockedTargets.map((target) => ({
1051
+ kind: 'warning',
1052
+ group: 'portableWarnings',
1053
+ pluginId: target.target.pluginId,
1054
+ relation: 'requested',
1055
+ title: `${pluginNameFromId(target.target.pluginId)} 不在本次执行中`,
1056
+ description: `${platformLabel(target.target.platform)} · ${scopeLabel(target.target.scope)}`
1057
+ + (target.errorCodes?.length ? ` · ${target.errorCodes.join('、')}` : ''),
1058
+ }));
1059
+ return [
1060
+ ...scriptTimeoutChanges(intent),
1061
+ ...requested,
1062
+ ...causes,
1063
+ ...runtime,
1064
+ ...blocked,
1065
+ ...(evidence.taskPlan.blockedTargets.length > 0 ? [{
1066
+ kind: 'warning',
1067
+ group: 'portableWarnings',
1068
+ title: `${evidence.taskPlan.blockedTargets.length} 个目标不在本次执行中`,
1069
+ description: '用户已明确选择先处理可执行子集;阻止项保持不变。',
1070
+ }] : []),
1071
+ ...(evidence.taskPlan.executableTargets.some((target) => target.scope === 'user') ? [{
1072
+ kind: 'warning',
1073
+ group: 'requested',
1074
+ title: '包含所有项目安装位置',
1075
+ description: '这些写入可能影响当前项目之外的使用位置。',
1076
+ }] : []),
1077
+ { kind: 'keep', group: 'preserved', title: '插件设置保持不变' },
1078
+ ];
1079
+ }
1080
+ function batchReviewChanges(intent, evidence) {
1081
+ const changes = evidence.groups.flatMap((group) => {
1082
+ const representative = group.requestedPluginIds[0];
1083
+ const groupEvidence = batchGroupEvidence(evidence, group);
1084
+ const projected = reviewChanges({
1085
+ kind: 'pluginWrite',
1086
+ action: intent.action,
1087
+ pluginId: representative,
1088
+ platform: group.platform,
1089
+ scope: group.scope,
1090
+ ...(intent.scriptTimeoutMs === undefined ? {} : { scriptTimeoutMs: intent.scriptTimeoutMs }),
1091
+ }, groupEvidence);
1092
+ const targetChanges = group.preview.targetResults.map((target) => {
1093
+ const pluginId = target.target.pluginId ?? `${group.sourceId}/${target.target.pluginName}`;
1094
+ const requested = group.requestedPluginIds.includes(pluginId);
1095
+ return {
1096
+ kind: intent.action === 'uninstall' || intent.action === 'cleanup' ? 'remove'
1097
+ : intent.action === 'install' ? 'add' : 'change',
1098
+ group: requested ? 'requested' : 'dependencies',
1099
+ pluginId,
1100
+ relation: requested ? 'requested'
1101
+ : (target.requiredBy ?? []).some((plugin) => group.requestedPluginIds.includes(plugin))
1102
+ ? 'direct' : 'transitive',
1103
+ title: pluginNameFromId(pluginId),
1104
+ description: `${group.sourceId} · ${target.target.platform === 'codex' ? 'Codex' : 'Claude Code'} · ${target.target.scope === 'user' ? '所有项目' : '当前项目'}${target.state === 'failed' || target.action === 'skipped' ? ` · 无法执行${target.errorCode ? ` (${target.errorCode})` : ''}` : ''}`,
1105
+ };
1106
+ });
1107
+ const selectedTargetChanges = group.preview.targetResults.length === 0
1108
+ && intent.selection.kind === 'targets'
1109
+ ? intent.selection.targets.filter((target) => target.pluginId.startsWith(`${group.sourceId}/`)
1110
+ && target.platform === group.platform
1111
+ && target.scope === group.scope).map((target) => ({
1112
+ kind: intent.action === 'uninstall' || intent.action === 'cleanup' ? 'remove'
1113
+ : intent.action === 'install' ? 'add' : 'change',
1114
+ group: 'requested',
1115
+ pluginId: target.pluginId,
1116
+ relation: 'requested',
1117
+ title: pluginNameFromId(target.pluginId),
1118
+ description: `${group.sourceId} · ${platformLabel(target.platform)} · ${scopeLabel(target.scope)}`,
1119
+ }))
1120
+ : [];
1121
+ const effective = intent.action === 'cleanup' || group.preview.dependencyPlan
1122
+ ? projected
1123
+ : [
1124
+ ...targetChanges,
1125
+ ...selectedTargetChanges,
1126
+ ...projected.filter((change) => change.group !== 'requested'
1127
+ && change.group !== 'dependencies'),
1128
+ ];
1129
+ const withVersionEvidence = effective.map((change) => {
1130
+ if (change.group !== 'requested' || !change.pluginId)
1131
+ return change;
1132
+ const version = evidence.targetVersions?.find((target) => target.pluginId === change.pluginId && target.platform === group.platform
1133
+ && target.scope === group.scope);
1134
+ if (!version)
1135
+ return change;
1136
+ const summary = version.presence === 'installed'
1137
+ ? version.installedVersion
1138
+ ? `已有安装 ${version.installedVersion}`
1139
+ : '已有安装,版本待确认'
1140
+ : version.presence === 'new'
1141
+ ? `新增${version.scope === 'user' ? '所有项目' : '当前项目'}安装`
1142
+ : '现场状态待确认';
1143
+ const available = version.availableVersion
1144
+ ? ` · 目录版本 ${version.availableVersion}` : '';
1145
+ return {
1146
+ ...change,
1147
+ description: `${change.description ? `${change.description} · ` : ''}${summary}${available}`,
1148
+ };
1149
+ });
1150
+ return [
1151
+ ...withVersionEvidence.filter((change) => change.title !== 'preApply 脚本超时')
1152
+ .map((change) => ({
1153
+ ...change,
1154
+ batchGroupId: group.groupId,
1155
+ sourceId: group.sourceId,
1156
+ })),
1157
+ ...(!group.executable ? [{
1158
+ kind: 'warning',
1159
+ group: 'portableWarnings',
1160
+ batchGroupId: group.groupId,
1161
+ sourceId: group.sourceId,
1162
+ title: `${group.sourceId} 组无法执行`,
1163
+ description: '确认后保留本次预览失败;不会重新求值或开始写入。',
1164
+ }] : []),
1165
+ ];
1166
+ });
1167
+ return [
1168
+ ...scriptTimeoutChanges(intent),
1169
+ ...changes,
1170
+ { kind: 'keep', group: 'preserved', title: '插件设置保持不变' },
1171
+ ];
1172
+ }
1173
+ function technicalDetails(evidence) {
1174
+ const short = (value) => {
1175
+ const normalized = value.startsWith('sha256:') ? value.slice(7) : value;
1176
+ return normalized.slice(0, 8);
1177
+ };
1178
+ const details = [
1179
+ `Catalog 配置:${short(evidence.catalog.configDigest)}`,
1180
+ `Catalog 组合:${short(evidence.catalog.compositeDigest)}`,
1181
+ ];
1182
+ if ('groups' in evidence && Array.isArray(evidence.groups)) {
1183
+ const batch = evidence;
1184
+ details.push(`批量根插件:${batch.requestedPluginIds.length} 个`);
1185
+ for (const group of batch.groups) {
1186
+ details.push(`批量分组:${group.sourceId} · ${group.platform} · ${group.requestedPluginIds.length} 个根插件 · ${group.executable ? `计划 ${short(group.preview.operationPlan.planFingerprint)}` : '预览失败'}`);
1187
+ }
1188
+ }
1189
+ if ('taskPlan' in evidence) {
1190
+ const task = evidence;
1191
+ details.push(`任务目标:${task.taskPlan.requestedTargets.length} 个`);
1192
+ details.push(`可执行目标:${task.taskPlan.executableTargets.length} 个`);
1193
+ details.push(`共同原因:${task.taskPlan.causes.length} 个`);
1194
+ for (const source of task.taskPlan.sources) {
1195
+ details.push(`任务来源:${source.sourceId} · ${source.requestedTargets.length} 个目标 · 计划 ${short(source.preview.operationPlan.planFingerprint)}`);
1196
+ }
1197
+ }
1198
+ if (evidence.catalog.generationSetDigest) {
1199
+ details.push(`Catalog generation:${short(evidence.catalog.generationSetDigest)}`);
1200
+ }
1201
+ if (evidence.source) {
1202
+ details.push(`来源:${evidence.source.sourceId}`);
1203
+ if (evidence.source.sourceIdentity)
1204
+ details.push(`来源身份:${short(evidence.source.sourceIdentity)}`);
1205
+ if (evidence.source.resolvedCommit)
1206
+ details.push(`Snapshot commit:${short(evidence.source.resolvedCommit)}`);
1207
+ if (evidence.source.snapshotDigest)
1208
+ details.push(`Snapshot digest:${short(evidence.source.snapshotDigest)}`);
1209
+ if (evidence.source.contentDigest)
1210
+ details.push(`Content digest:${short(evidence.source.contentDigest)}`);
1211
+ }
1212
+ if (evidence.targetFingerprint)
1213
+ details.push(`目标状态:${short(evidence.targetFingerprint)}`);
1214
+ details.push(...(evidence.preparationWarnings ?? []).map((warning) => `刷新警告:${warning}`));
1215
+ const codexDiagnostics = [
1216
+ ...(evidence.codexManager?.diagnostics ?? []),
1217
+ ...('groups' in evidence ? evidence.groups
1218
+ .flatMap((group) => group.preview.codexManagerPreview?.diagnostics ?? []) : []),
1219
+ ...('taskPlan' in evidence ? evidence.taskPlan.sources
1220
+ .flatMap((source) => source.preview.codexManagerPreview?.diagnostics ?? []) : []),
1221
+ ];
1222
+ details.push(...[...new Set(codexDiagnostics)].map((diagnostic) => `Codex 候选诊断:${sanitizeDiagnosticText(diagnostic)}`));
1223
+ for (const target of offlineCleanupPlans(evidence)) {
1224
+ details.push(`离线清理目标:${target.pluginId} · ${target.platform}/${target.scope}`);
1225
+ details.push(`离线清理计划:${target.plan.actions.length} 个动作 · ${short(target.planDigest)}`);
1226
+ }
1227
+ if (evidence.dependencyPlan)
1228
+ details.push(`安装计划:${evidence.dependencyPlan.resolvedPluginIds.length} 个插件`);
1229
+ if (evidence.config)
1230
+ details.push(`用户配置:${evidence.config.platform ?? 'common'} · context=${evidence.config.context ?? 'user'} · ${short(evidence.config.storeDigest)}`);
1231
+ for (const group of evidence.configBatch?.groups ?? []) {
1232
+ details.push(`用户配置:${group.platform ?? 'common'} · context=${group.config.context ?? 'user'} · ${short(group.config.storeDigest)}`);
1233
+ }
1234
+ if (evidence.sourceWrite) {
1235
+ details.push(`新配置:${short(evidence.sourceWrite.proposedConfigDigest)}`);
1236
+ details.push(`引用清单:${short(evidence.sourceWrite.inventoryDigest)} · ${evidence.sourceWrite.referenceCount} 项`);
1237
+ }
1238
+ if (evidence.catalogGeneration) {
1239
+ const generation = evidence.catalogGeneration;
1240
+ details.push(`候选版本:${generation.candidate.catalogVersion}`);
1241
+ details.push(`候选 commit:${short(generation.candidate.resolvedCommit)}`);
1242
+ details.push(`候选 digest:${short(generation.candidate.snapshotDigest)}`);
1243
+ const impact = generation.impact;
1244
+ if (impact) {
1245
+ const referenceKey = (reference) => [
1246
+ reference.category,
1247
+ reference.sourceId,
1248
+ reference.pluginId ?? '',
1249
+ reference.platform ?? '',
1250
+ reference.scope ?? '',
1251
+ reference.projectRecord ?? '',
1252
+ reference.marketplaceName ?? '',
1253
+ ].join('\0');
1254
+ const affected = new Set(impact.affectedReferences.map(referenceKey));
1255
+ const categoryLabel = {
1256
+ installation: '安装',
1257
+ config: '设置',
1258
+ lifecycle: '生命周期',
1259
+ marketplace: 'Marketplace',
1260
+ };
1261
+ for (const reference of impact.references) {
1262
+ const location = [
1263
+ reference.platform ? platformLabel(reference.platform) : undefined,
1264
+ reference.scope ? scopeLabel(reference.scope) : undefined,
1265
+ reference.projectRecord === 'current' ? '当前项目'
1266
+ : reference.projectRecord === 'historical' ? '历史项目'
1267
+ : reference.projectRecord === 'unknown' ? '项目未知' : undefined,
1268
+ ].filter((value) => Boolean(value)).join(' · ');
1269
+ details.push([
1270
+ `引用影响:${affected.has(referenceKey(reference)) ? '受影响' : '未受本次变化影响'}`,
1271
+ categoryLabel[reference.category],
1272
+ reference.pluginId ?? reference.marketplaceName ?? reference.sourceId,
1273
+ location || undefined,
1274
+ ].filter((value) => Boolean(value)).join(' · '));
1275
+ }
1276
+ }
1277
+ }
1278
+ if (evidence.catalogStore) {
1279
+ details.push(`已授权清理:${evidence.catalogStore.authorizedItems.length} 项`);
1280
+ details.push(`检查结果:${evidence.catalogStore.entries.length} 项`);
1281
+ }
1282
+ if (evidence.portable) {
1283
+ details.push(`Portable 候选:${evidence.portable.selected.length} 个`);
1284
+ details.push(`Materialization:${short(evidence.portable.materializationDigest)}`);
1285
+ details.push(`Skills CLI:${evidence.portable.skillsCliVersion}`);
1286
+ }
1287
+ return details;
1288
+ }
1289
+ export function buildOperationReviewProjection(options) {
1290
+ const { intent, evidence } = options;
1291
+ const batchEvidence = intent.kind === 'pluginWriteBatch'
1292
+ ? evidence
1293
+ : undefined;
1294
+ const taskEvidence = intent.kind === 'pluginWriteTask'
1295
+ ? evidence
1296
+ : undefined;
1297
+ const labels = operationLabels(intent, evidence);
1298
+ const hasPreApply = intent.kind === 'pluginWriteBatch'
1299
+ ? Boolean(batchEvidence?.groups.some((group) => operationPreApplyTargets(batchGroupEvidence(batchEvidence, group)).length > 0))
1300
+ : intent.kind === 'pluginWriteTask'
1301
+ ? Boolean(taskEvidence?.taskPlan.sources.some((source) => operationPreApplyTargets(taskSourceEvidence(taskEvidence, source)).length > 0))
1302
+ : intent.kind === 'configSaveBatch'
1303
+ ? evidence.configBatch?.groups.some((group) => (group.config.preApplyAuthorization?.length ?? 0) > 0) === true
1304
+ : operationPreApplyTargets(evidence).length > 0
1305
+ || (evidence.config?.preApplyAuthorization?.length ?? 0) > 0;
1306
+ const sharedNativeConfigApply = (intent.kind === 'configSave'
1307
+ && intent.apply
1308
+ && (evidence.config?.sharedNativeRenderUnits?.some((shared) => evidence.config?.affectedTargets
1309
+ .some((target) => sharedUnitMatchesTarget(shared, target, intent.pluginId))) ?? false))
1310
+ || (intent.kind === 'configSaveBatch'
1311
+ && intent.apply
1312
+ && (evidence.configBatch?.groups.some((group) => group.config.sharedNativeRenderUnits?.some((shared) => group.config.affectedTargets
1313
+ .some((target) => sharedUnitMatchesTarget(shared, target, intent.pluginId)))) ?? false));
1314
+ const requiresConfirmation = sharedNativeConfigApply
1315
+ || intent.kind === 'catalogStorePrune'
1316
+ || Boolean(batchEvidence?.groups.some((group) => (group.preview.codexReconcilePlans ?? []).some((plan) => plan.review.requiresConfirmation)))
1317
+ || Boolean(taskEvidence?.taskPlan.sources.some((source) => (source.preview.codexReconcilePlans ?? []).some((plan) => plan.review.requiresConfirmation)))
1318
+ || (evidence.codexReconcilePlans ?? []).some((plan) => plan.review.requiresConfirmation)
1319
+ || Boolean(evidence.sourceWrite
1320
+ && (!evidence.sourceWrite.inventoryComplete || evidence.sourceWrite.referenceCount > 0))
1321
+ || Boolean(evidence.catalogGeneration?.impact
1322
+ && (!evidence.catalogGeneration.impact.inventoryComplete
1323
+ || evidence.catalogGeneration.impact.affectedReferences.length > 0))
1324
+ || Boolean(evidence.catalogGeneration?.primaryImpact
1325
+ && (!evidence.catalogGeneration.primaryImpact.inventoryComplete
1326
+ || evidence.catalogGeneration.primaryImpact.affectedReferences.length > 0));
1327
+ const warning = (evidence.codexReconcilePlans ?? []).find((plan) => plan.review.sharedImpact.warning)?.review.sharedImpact.warning
1328
+ ?? batchEvidence?.groups.flatMap((group) => group.preview.codexReconcilePlans ?? [])
1329
+ .find((plan) => plan.review.sharedImpact.warning)?.review.sharedImpact.warning
1330
+ ?? taskEvidence?.taskPlan.sources.flatMap((source) => source.preview.codexReconcilePlans ?? [])
1331
+ .find((plan) => plan.review.sharedImpact.warning)?.review.sharedImpact.warning;
1332
+ const preparationWarnings = (evidence.preparationWarnings ?? []).map(() => ({
1333
+ kind: 'warning',
1334
+ group: 'portableWarnings',
1335
+ title: '来源刷新失败;本次使用旧 Active',
1336
+ description: '同步可以继续。再次刷新并同步时会重试来源刷新。',
1337
+ }));
1338
+ let equivalentCommand;
1339
+ if (intent.kind === 'pluginWrite') {
1340
+ const sync = intent.action === 'sync' || intent.action === 'refreshAndSync' || intent.action === 'reinstall';
1341
+ const action = sync ? 'sync' : intent.action === 'uninstall' || intent.action === 'cleanup' ? 'remove' : intent.action;
1342
+ const agents = intent.platform === 'both' ? ['codex', 'claude'] : [intent.platform];
1343
+ const targets = intent.action === 'cleanup' ? agents.map((agent) => ` --target ${agent}`)
1344
+ : [sync ? agents.map((agent) => ` --target ${agent}`).join('') : ''];
1345
+ equivalentCommand = targets.map((target) => `aw plugin ${action} ${intent.pluginId} --${sync ? 'context' : 'scope'} ${intent.scope}${target}`
1346
+ + (intent.action === 'cleanup' ? ' --only outputs' : '')
1347
+ + (intent.action === 'reinstall' ? ' --rebuild' : '')
1348
+ + (intent.action === 'refreshAndSync' ? ' --refresh' : '')
1349
+ + (scriptTimeoutChanges(intent).length > 0 ? ` --script-timeout ${parseScriptTimeoutMs(intent.scriptTimeoutMs ?? SCRIPT_TIMEOUT_DEFAULT_MS)}` : '')
1350
+ + (intent.action === 'cleanup' && intent.force === true ? ' --force' : '')
1351
+ + (requiresConfirmation || hasPreApply || intent.action === 'cleanup' || intent.action === 'uninstall' ? ' --yes' : '')).join(' && ');
1352
+ }
1353
+ return {
1354
+ title: labels.title,
1355
+ description: labels.description,
1356
+ changes: [
1357
+ ...preparationWarnings,
1358
+ ...(intent.kind === 'pluginWriteBatch'
1359
+ ? batchReviewChanges(intent, batchEvidence)
1360
+ : intent.kind === 'pluginWriteTask'
1361
+ ? taskReviewChanges(intent, taskEvidence)
1362
+ : reviewChanges(intent, evidence, options.dependencyOverview)),
1363
+ ],
1364
+ technicalDetails: technicalDetails(evidence),
1365
+ ...(equivalentCommand ? { equivalentCommand } : {}),
1366
+ primaryLabel: intent.kind === 'pluginWriteBatch'
1367
+ ? `${labels.primaryLabel} ${batchEvidence.requestedPluginIds.length} 个插件`
1368
+ : intent.kind === 'pluginWriteTask'
1369
+ ? `${labels.primaryLabel} ${taskEvidence.taskPlan.executableTargets.length} 个安装位置`
1370
+ : intent.kind === 'pluginWrite' && evidence.dependencyPlan
1371
+ ? `${labels.primaryLabel} ${evidence.dependencyPlan.resolvedPluginIds.length} 个插件`
1372
+ : labels.primaryLabel,
1373
+ ...(labels.destructive ? { destructive: true } : {}),
1374
+ requiresConfirmation,
1375
+ sharedImpact: {
1376
+ pluginIds: [...new Set([
1377
+ ...(evidence.codexReconcilePlans ?? []).flatMap((plan) => plan.review.sharedImpact.pluginIds),
1378
+ ...(batchEvidence?.groups.flatMap((group) => (group.preview.codexReconcilePlans ?? []).flatMap((plan) => plan.review.sharedImpact.pluginIds)) ?? []),
1379
+ ...(taskEvidence?.taskPlan.sources.flatMap((source) => (source.preview.codexReconcilePlans ?? []).flatMap((plan) => plan.review.sharedImpact.pluginIds)) ?? []),
1380
+ ...(evidence.sourceWrite?.impact?.affectedReferences ?? []).flatMap((reference) => reference.pluginId ? [reference.pluginId] : []),
1381
+ ...(evidence.catalogGeneration?.impact?.affectedReferences ?? []).flatMap((reference) => reference.pluginId ? [reference.pluginId] : []),
1382
+ ...(evidence.catalogGeneration?.primaryImpact?.affectedReferences ?? []).flatMap((reference) => reference.pluginId ? [reference.pluginId] : []),
1383
+ ...(sharedNativeConfigApply && 'pluginId' in intent ? [intent.pluginId] : []),
1384
+ ])],
1385
+ ...(warning ? { warning }
1386
+ : sharedNativeConfigApply
1387
+ ? { warning: '更新被共用的原生 Skill 会影响所有启用项目。' }
1388
+ : requiresConfirmation && (evidence.sourceWrite
1389
+ || evidence.catalogGeneration?.impact
1390
+ || evidence.catalogGeneration?.primaryImpact)
1391
+ ? { warning: '确认来源影响后才会继续。未知影响不会按零处理。' }
1392
+ : {}),
1393
+ },
1394
+ };
1395
+ }
1396
+ //# sourceMappingURL=operation-review-planner.js.map