@lesliechan721/aw 0.1.0-beta.7 → 0.1.0-beta.73

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