@lesliechan721/aw 0.1.0-beta.5 → 0.1.0-beta.50

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