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

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 +26 -0
  123. package/dist/src/commands/public-lifecycle.js +469 -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 +1877 -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 +145 -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 +140 -0
  230. package/dist/src/recovery/coordinator.js +1200 -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 +24 -0
  236. package/dist/src/recovery/joint-coordinator.js +797 -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 +108 -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 +9764 -1955
  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 +2223 -471
  330. package/dist/src/tui/controller-runtime.js.map +1 -1
  331. package/dist/src/tui/controller.d.ts +697 -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
@@ -1,20 +1,322 @@
1
+ import { configObjectHasSensitiveChild, presentConfigValue, safeConfigText } from './config-value-presentation.js';
2
+ export { configObjectHasSensitiveChild } from './config-value-presentation.js';
3
+ import { matchPluginConfigPreset, resolvePluginConfigObjectProperties, stablePluginConfigStringify, } from '@lesliechan721/aw-plugin-core/manifest';
4
+ import { flattenStatusTargets, statusTargetActivation, statusTargetExtensions, statusTargetIntent, statusTargetOwnershipState, statusTargetSharedNative, } from '../commands/status-v6.js';
5
+ import { buildAllowedLifecycleActions } from '../commands/operation-planner.js';
1
6
  import { safeDiagnosticCode, } from './diagnostics.js';
7
+ import { projectCatalogSourceState } from './catalog-sources/projection.js';
8
+ import { projectLifecycleActionView } from './lifecycle-action-view.js';
9
+ import { compareStrictSemVer, tryParseStrictSemVer } from '../utils/manifest.js';
10
+ import { formatPluginId } from '../utils/multi-source-catalog.js';
11
+ import { createCatalogStoreKey } from '../utils/catalog-generation-store.js';
12
+ function candidateForPlugin(pluginId, sourceId, freshness) {
13
+ return freshness?.candidatePlugins?.find((entry) => formatPluginId({
14
+ sourceId,
15
+ pluginName: entry.name,
16
+ }) === pluginId);
17
+ }
18
+ export function buildPluginUpdateSummary(options) {
19
+ const candidate = candidateForPlugin(options.pluginId, options.sourceId, options.freshness);
20
+ let sameVersionCandidateChange = false;
21
+ let blockedCandidate = Boolean(options.freshness?.candidate
22
+ && options.freshness.candidatePlugins && !candidate);
23
+ const targets = options.targetRevisions
24
+ .filter((entry) => entry.pluginId === options.pluginId)
25
+ .map((entry) => {
26
+ const installedVersion = entry.revision.installedVersion;
27
+ const activeVersion = entry.revision.availableVersion;
28
+ const liveTarget = options.targets.find((target) => target.pluginId === entry.pluginId
29
+ && target.platform === entry.platform && target.scope === entry.scope);
30
+ const needsRepair = liveTarget !== undefined && liveTarget.state !== 'ready'
31
+ && !isDirectCodexVersionUpgrade(liveTarget, entry.revision);
32
+ const installedValid = installedVersion !== undefined && tryParseStrictSemVer(installedVersion) !== null;
33
+ const activeValid = activeVersion !== undefined && tryParseStrictSemVer(activeVersion) !== null;
34
+ const candidateValid = candidate !== undefined && tryParseStrictSemVer(candidate.version) !== null;
35
+ const candidateCompatible = (candidate?.missingCapabilities.length ?? 0) === 0;
36
+ let targetCandidateBlocked = false;
37
+ const candidateEvidence = candidate && options.freshness?.candidate
38
+ ? createCatalogStoreKey(options.freshness.candidate.logicalIdentity, options.freshness.candidate.snapshotDigest)
39
+ : undefined;
40
+ if (!installedValid) {
41
+ return {
42
+ platform: entry.platform,
43
+ scope: entry.scope,
44
+ ...(installedVersion ? { installedVersion } : {}),
45
+ ...(activeVersion ? { activeVersion } : {}),
46
+ ...(candidate ? { candidateVersion: candidate.version } : {}),
47
+ ...(candidateEvidence ? { candidateEvidence } : {}),
48
+ eligibility: 'unverified',
49
+ };
50
+ }
51
+ if (entry.revision.state === 'upgradeAvailable' && activeValid) {
52
+ return {
53
+ platform: entry.platform,
54
+ scope: entry.scope,
55
+ installedVersion,
56
+ activeVersion,
57
+ ...(candidate ? { candidateVersion: candidate.version } : {}),
58
+ availableVersion: activeVersion,
59
+ ...(candidateEvidence ? { candidateEvidence } : {}),
60
+ eligibility: needsRepair ? 'needsRepair' : 'allowed',
61
+ };
62
+ }
63
+ if (candidateValid) {
64
+ const candidateRelation = compareStrictSemVer(installedVersion, candidate.version);
65
+ const candidateUsable = candidateCompatible
66
+ && options.freshness?.state !== 'incompatible'
67
+ && options.freshness?.state !== 'rollbackDetected'
68
+ && options.freshness?.state !== 'versionConflict';
69
+ if (candidateRelation < 0 && candidateUsable) {
70
+ return {
71
+ platform: entry.platform,
72
+ scope: entry.scope,
73
+ installedVersion,
74
+ ...(activeVersion ? { activeVersion } : {}),
75
+ candidateVersion: candidate.version,
76
+ availableVersion: candidate.version,
77
+ ...(candidateEvidence ? { candidateEvidence } : {}),
78
+ ...(candidate.missingCapabilities.length > 0
79
+ ? { missingCapabilities: [...candidate.missingCapabilities] }
80
+ : {}),
81
+ eligibility: needsRepair ? 'needsRepair' : 'allowed',
82
+ requiresCatalogActivation: true,
83
+ };
84
+ }
85
+ if (candidateRelation < 0 || candidateRelation > 0) {
86
+ blockedCandidate = true;
87
+ targetCandidateBlocked = true;
88
+ }
89
+ if (candidateRelation === 0 && activeVersion === candidate.version
90
+ && options.freshness?.state !== 'current')
91
+ sameVersionCandidateChange = true;
92
+ }
93
+ const activeDowngrade = activeValid
94
+ && compareStrictSemVer(installedVersion, activeVersion) > 0;
95
+ return {
96
+ platform: entry.platform,
97
+ scope: entry.scope,
98
+ installedVersion,
99
+ ...(activeVersion ? { activeVersion } : {}),
100
+ ...(candidate ? { candidateVersion: candidate.version } : {}),
101
+ ...(candidateEvidence ? { candidateEvidence } : {}),
102
+ ...(candidate && candidate.missingCapabilities.length > 0
103
+ ? { missingCapabilities: [...candidate.missingCapabilities] }
104
+ : {}),
105
+ eligibility: activeDowngrade || targetCandidateBlocked ? 'incompatible'
106
+ : needsRepair ? 'needsRepair' : activeValid ? 'allowed' : 'unverified',
107
+ };
108
+ })
109
+ .sort((left, right) => `${left.platform}\0${left.scope}`.localeCompare(`${right.platform}\0${right.scope}`, 'en'));
110
+ const hasAvailable = targets.some((target) => target.availableVersion !== undefined);
111
+ const hasInstalledVersion = targets.some((target) => target.installedVersion !== undefined);
112
+ const allCurrent = targets.length > 0 && targets.every((target) => target.activeVersion !== undefined
113
+ && target.installedVersion !== undefined
114
+ && tryParseStrictSemVer(target.activeVersion) !== null
115
+ && tryParseStrictSemVer(target.installedVersion) !== null
116
+ && compareStrictSemVer(target.installedVersion, target.activeVersion) === 0);
117
+ return {
118
+ pluginId: options.pluginId,
119
+ state: hasAvailable ? 'available'
120
+ : sameVersionCandidateChange ? 'sourceChangedUnverified'
121
+ : blockedCandidate || targets.some((target) => target.eligibility === 'incompatible') ? 'blocked'
122
+ : allCurrent ? 'currentAgainstCatalog'
123
+ : hasInstalledVersion ? 'unknown' : 'notChecked',
124
+ ...(options.freshness?.checkedAt ? { checkedAt: options.freshness.checkedAt } : {}),
125
+ ...(options.freshness?.lastSuccessful ? { lastSuccessful: true } : {}),
126
+ ...(options.sourceIdentity ? { sourceIdentity: options.sourceIdentity } : {}),
127
+ ...(options.generationKey ? { generationKey: options.generationKey } : {}),
128
+ targets,
129
+ };
130
+ }
2
131
  function compareText(left, right) {
3
132
  return left.localeCompare(right, 'en');
4
133
  }
5
134
  function targetHealth(target) {
6
- if (target.state === 'present')
135
+ if (target.state === 'ready')
7
136
  return 'ready';
8
- if (target.state === 'partial')
137
+ if (target.state === 'needsSync' || target.state === 'orphaned')
9
138
  return 'incomplete';
10
- return 'error';
139
+ return target.state === 'blocked' ? 'error' : 'incomplete';
140
+ }
141
+ export function isDirectCodexVersionUpgrade(target, revision) {
142
+ const sharedNative = statusTargetSharedNative(target);
143
+ const reasons = [...target.reasons, ...(target.sharedReasons ?? [])];
144
+ return target.platform === 'codex'
145
+ && target.state === 'needsSync'
146
+ && revision.state === 'upgradeAvailable'
147
+ && sharedNative?.reason === 'outdated'
148
+ && typeof sharedNative.version === 'string'
149
+ && typeof sharedNative.desiredVersion === 'string'
150
+ && sharedNative.version === revision.installedVersion
151
+ && sharedNative.desiredVersion === revision.availableVersion
152
+ && compareStrictSemVer(sharedNative.version, sharedNative.desiredVersion) < 0
153
+ && reasons.length > 0
154
+ && reasons.every((reason) => reason.code === 'codexSharedNativeUpdateRequired');
155
+ }
156
+ export function isPureNativeCodexTarget(target) {
157
+ const sharedNative = statusTargetSharedNative(target);
158
+ const extensions = statusTargetExtensions(target);
159
+ return target.platform === 'codex'
160
+ && sharedNative !== undefined
161
+ && (extensions?.kinds.length ?? 0) === 0;
162
+ }
163
+ function isPureNativeCodexPlacement(placement) {
164
+ return placement.platform === 'codex'
165
+ && placement.state === 'installed'
166
+ && placement.sharedNative !== undefined
167
+ && (placement.extensions?.kinds.length ?? 0) === 0;
168
+ }
169
+ function parsedScopedUninstallRecovery(recovery, expectedPlatform) {
170
+ if (recovery.command !== 'uninstall' || !recovery.scope)
171
+ return undefined;
172
+ const match = /(?:^|\s)aw plugin remove --only outputs ([^\s]+) --target (codex|claude) --scope (user|project)(?:,|,|\s|$)/u
173
+ .exec(recovery.description);
174
+ if (!match || match[2] !== expectedPlatform
175
+ || match[3] !== recovery.scope)
176
+ return undefined;
177
+ return { pluginId: match[1], scope: recovery.scope, description: recovery.description };
178
+ }
179
+ function scopeConflictRecoveryMenuActions(placement) {
180
+ if (placement.actualState !== 'blocked')
181
+ return [];
182
+ return (placement.recovery ?? []).flatMap((recovery) => {
183
+ const parsed = parsedScopedUninstallRecovery(recovery, placement.platform);
184
+ return parsed ? [{
185
+ id: 'resolveScopeConflict',
186
+ pluginId: parsed.pluginId,
187
+ platform: placement.platform,
188
+ scope: parsed.scope,
189
+ keepScope: parsed.scope === 'user' ? 'project' : 'user',
190
+ description: parsed.description,
191
+ }] : [];
192
+ });
193
+ }
194
+ function missingPureNativeScopes(plugin, placement) {
195
+ if (!isPureNativeCodexPlacement(placement) || placement.actualState !== 'ready')
196
+ return [];
197
+ const supported = plugin.supportedScopes?.codex ?? ['user', 'project'];
198
+ return supported.filter((scope) => !placement.desiredScopes?.includes(scope) && placement.activation?.[scope] !== true);
199
+ }
200
+ export function hasScopedExtensionOwnership(target) {
201
+ return target.components.some((component) => component.kind === 'ownership'
202
+ && component.key !== 'native'
203
+ && !component.key.startsWith('activation-')
204
+ && !component.key.startsWith('marketplace-')
205
+ && (component.state === 'present' || component.state === 'partial'));
11
206
  }
12
207
  function isInstalledScopeEvidence(target) {
13
- return target.state === 'present' || target.state === 'partial';
208
+ if (target.state === 'absent')
209
+ return false;
210
+ const activation = statusTargetActivation(target);
211
+ const extensions = statusTargetExtensions(target);
212
+ return statusTargetIntent(target).enabled
213
+ || target.state === 'needsSync' && target.reasons.some((reason) => reason.code === 'codexActivationDrift')
214
+ || target.platform === 'claude' && (statusTargetOwnershipState(target) === 'present'
215
+ || statusTargetOwnershipState(target) === 'partial')
216
+ || target.platform === 'codex' && hasScopedExtensionOwnership(target)
217
+ || activation?.[target.scope] === true
218
+ || extensions?.state === 'ready'
219
+ || extensions?.state === 'drifted'
220
+ || extensions?.state === 'conflict';
221
+ }
222
+ export function hasActualScopeEvidence(target) {
223
+ if (target.state === 'absent')
224
+ return false;
225
+ const activation = statusTargetActivation(target);
226
+ const extensions = statusTargetExtensions(target);
227
+ return target.platform === 'claude' && (statusTargetOwnershipState(target) === 'present'
228
+ || statusTargetOwnershipState(target) === 'partial')
229
+ || target.platform === 'codex' && hasScopedExtensionOwnership(target)
230
+ || activation?.[target.scope] === true
231
+ || extensions?.state === 'ready'
232
+ || extensions?.state === 'drifted'
233
+ || extensions?.state === 'conflict';
234
+ }
235
+ function dependencyAssignmentExplanation(assignmentSource, requiredBy) {
236
+ const consumer = requiredBy[0];
237
+ return {
238
+ root: '当前插件位置',
239
+ default: '推荐使用当前项目',
240
+ existingWiderTarget: '复用健康的所有项目安装',
241
+ userOverride: '你选择的位置',
242
+ consumerPromotion: consumer
243
+ ? `因 ${consumer} 的位置而一并调整`
244
+ : '因上游依赖位置而一并调整',
245
+ platformRequirement: '平台只支持这个位置',
246
+ }[assignmentSource];
247
+ }
248
+ export function dependencyPlacementTargets(plan) {
249
+ return plan.targets.filter((target) => target.relation === 'dependency').map((target) => ({
250
+ key: `${target.pluginId}\0${target.platform}`,
251
+ pluginId: target.pluginId,
252
+ displayName: target.pluginName,
253
+ platform: target.platform,
254
+ relation: target.depth === 1 ? 'direct' : 'transitive',
255
+ scope: target.resolvedScope,
256
+ minimumScope: target.minimumScope,
257
+ allowedScopes: [...target.allowedScopes],
258
+ locked: target.locked && target.lockReason !== 'dependencyScopeOverride',
259
+ requiredBy: [...target.requiredBy],
260
+ assignmentSource: target.assignmentSource,
261
+ explanation: dependencyAssignmentExplanation(target.assignmentSource, target.requiredBy),
262
+ affectsOtherProjects: target.affectsOtherProjects,
263
+ action: target.action,
264
+ }));
14
265
  }
15
266
  function dependencyPluginIdFromMessage(message) {
16
267
  return message.match(/(?:[a-z0-9]+(?:-[a-z0-9]+)*)\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)/u)?.[0];
17
268
  }
269
+ function rootPlacementFromIssueId(issueId, fallback) {
270
+ if (issueId) {
271
+ for (const platform of ['claude', 'codex']) {
272
+ for (const scope of ['project', 'user']) {
273
+ if (issueId.includes(`:${platform}:${scope}:`)
274
+ || issueId.endsWith(`:${platform}:${scope}`))
275
+ return { platform, scope };
276
+ }
277
+ }
278
+ }
279
+ return fallback;
280
+ }
281
+ function rootPluginIdFromIssueId(issueId, rootIssueCode) {
282
+ if (!issueId || !rootIssueCode || !issueId.startsWith(`${rootIssueCode}:`))
283
+ return undefined;
284
+ for (const platform of ['claude', 'codex']) {
285
+ for (const scope of ['project', 'user']) {
286
+ const marker = `:${platform}:${scope}`;
287
+ const markerIndex = issueId.indexOf(marker, rootIssueCode.length + 1);
288
+ if (markerIndex > rootIssueCode.length + 1) {
289
+ return issueId.slice(rootIssueCode.length + 1, markerIndex);
290
+ }
291
+ }
292
+ }
293
+ return undefined;
294
+ }
295
+ function targetIssueRelationship(options) {
296
+ const consumer = options.error?.rootIssueId !== undefined
297
+ && options.error.rootIssueCode !== undefined
298
+ && (options.error.code !== options.error.rootIssueCode
299
+ || options.dependencyPluginId !== undefined
300
+ && options.dependencyPluginId !== options.target.pluginId);
301
+ if (!consumer) {
302
+ return {
303
+ relationship: 'direct',
304
+ rootEntity: {
305
+ pluginId: options.target.pluginId,
306
+ platform: options.target.platform,
307
+ scope: options.target.scope,
308
+ },
309
+ };
310
+ }
311
+ const placement = rootPlacementFromIssueId(options.error?.rootIssueId, options.target);
312
+ return {
313
+ relationship: 'consumer',
314
+ rootEntity: {
315
+ pluginId: rootPluginIdFromIssueId(options.error?.rootIssueId, options.error?.rootIssueCode) ?? options.dependencyPluginId ?? options.target.pluginId,
316
+ ...placement,
317
+ },
318
+ };
319
+ }
18
320
  export function projectPlatformPlacement(platform, targets, revisions = []) {
19
321
  const revisionFor = (target) => revisions.find((entry) => entry.pluginId === target.pluginId
20
322
  && entry.platform === target.platform
@@ -23,7 +325,10 @@ export function projectPlatformPlacement(platform, targets, revisions = []) {
23
325
  const supportedScopes = [...new Set(targets.map((target) => target.scope))];
24
326
  const installed = targets.filter(isInstalledScopeEvidence);
25
327
  if (installed.length === 0) {
26
- const errorTarget = targets.find((target) => target.state === 'error');
328
+ if (targets.some((target) => target.reasons.some((reason) => reason.code === 'artifactCollision' && reason.severity === 'blocking'))) {
329
+ return { platform, state: 'blocked', supportedScopes, reason: 'artifactCollision' };
330
+ }
331
+ const errorTarget = targets.find((target) => target.state === 'blocked');
27
332
  if (!errorTarget)
28
333
  return { platform, state: 'notInstalled', supportedScopes };
29
334
  return {
@@ -34,165 +339,499 @@ export function projectPlatformPlacement(platform, targets, revisions = []) {
34
339
  revision: revisionFor(errorTarget),
35
340
  };
36
341
  }
37
- if (installed.length === 1) {
38
- const target = installed[0];
342
+ if (installed.length > 1) {
343
+ const projected = installed.map((target) => projectPlatformPlacement(platform, [target], revisions));
39
344
  return {
40
- platform,
41
- state: 'installed',
42
- scope: target.scope,
43
- health: targetHealth(target),
44
- revision: revisionFor(target),
345
+ ...(projected.find((placement) => placement.health === 'error')
346
+ ?? projected.find((placement) => placement.health === 'incomplete')
347
+ ?? projected[0]),
348
+ scopedPlacements: projected.map((placement) => ({
349
+ scope: placement.scope,
350
+ health: placement.health,
351
+ revision: placement.revision,
352
+ ...(placement.actualState ? { actualState: placement.actualState } : {}),
353
+ ...(placement.recovery ? { recovery: placement.recovery } : {}),
354
+ ...(placement.blockingReason ? { blockingReason: placement.blockingReason } : {}),
355
+ })),
356
+ desiredScopes: [...new Set(projected.flatMap((placement) => placement.desiredScopes ?? []))].sort(compareText),
357
+ actualScopes: [...new Set(installed.filter(hasActualScopeEvidence)
358
+ .map((target) => target.scope))].sort(compareText),
45
359
  };
46
360
  }
361
+ const target = installed.find((candidate) => candidate.state === 'blocked')
362
+ ?? installed.find((candidate) => candidate.state === 'needsSync')
363
+ ?? installed.find((candidate) => candidate.state === 'orphaned')
364
+ ?? installed[0];
365
+ const intent = statusTargetIntent(target);
366
+ const activation = statusTargetActivation(target);
367
+ const sharedNative = statusTargetSharedNative(target);
368
+ const extensions = statusTargetExtensions(target);
369
+ const blockingReason = target.reasons.some((reason) => reason.code === 'artifactCollision' && reason.severity === 'blocking')
370
+ ? 'artifactCollision'
371
+ : undefined;
47
372
  return {
48
373
  platform,
49
- state: 'scopeConflict',
50
- placements: installed.map((target) => ({
51
- scope: target.scope,
52
- health: targetHealth(target),
53
- revision: revisionFor(target),
54
- })).sort((left, right) => compareText(left.scope, right.scope)),
374
+ state: 'installed',
375
+ scope: target.scope,
376
+ health: targetHealth(target),
377
+ revision: revisionFor(target),
378
+ desiredScopes: [...intent.scopes],
379
+ actualScopes: hasActualScopeEvidence(target) ? [target.scope] : [],
380
+ relation: intent.relation,
381
+ actualState: target.state,
382
+ ...(activation ? { activation } : {}),
383
+ ...(sharedNative ? { sharedNative } : {}),
384
+ ...(extensions ? { extensions } : {}),
385
+ recovery: [...target.recoveryActions],
386
+ ...(blockingReason ? { blockingReason } : {}),
55
387
  };
56
388
  }
57
389
  function hasIncompletePlacement(plugin) {
58
390
  return plugin.installedPlacements.some((placement) => placement.state === 'scopeConflict'
59
- || placement.state === 'installed' && placement.health !== 'ready');
391
+ || placement.state === 'installed'
392
+ && placement.scopedPlacements?.some((entry) => entry.health !== 'ready'
393
+ || entry.blockingReason !== undefined)
394
+ || placement.state === 'installed'
395
+ && (placement.health !== 'ready' || placement.blockingReason !== undefined));
60
396
  }
61
397
  function hasMissingPlatform(plugin) {
62
398
  return plugin.supportedPlatforms.some((platform) => plugin.installedPlacements.find((placement) => placement.platform === platform)?.state === 'notInstalled');
63
399
  }
400
+ function allSupportedPlatformsBlocked(plugin) {
401
+ return plugin.supportedPlatforms.length > 0 && plugin.supportedPlatforms.every((platform) => plugin.installedPlacements.some((placement) => placement.platform === platform
402
+ && (placement.state === 'blocked'
403
+ || placement.state === 'installed' && placement.blockingReason === 'artifactCollision')));
404
+ }
64
405
  function capabilityActions(plugin) {
65
406
  return [
66
- ...(plugin.portableSkills ? [{ id: 'portableSkills' }] : []),
67
407
  ...((plugin.dependencySummary?.totalCount ?? 0) > 0 ? [{ id: 'dependencies' }] : []),
68
408
  ...(plugin.configFieldCount > 0 ? [{ id: 'settings' }] : []),
69
409
  ];
70
410
  }
411
+ function capabilityUnavailableActions() {
412
+ return [{ id: 'upgradeAwCli' }, { id: 'capabilityTechnical' }];
413
+ }
414
+ function isCapabilityUnavailable(plugin) {
415
+ return plugin.capabilityUnsupported === true && plugin.sourceUnavailable !== true;
416
+ }
71
417
  export function buildPluginPreviewActions(plugin) {
72
418
  const installed = hasInstalledPlacement(plugin);
73
419
  if (plugin.aggregateStatus === 'unavailable') {
420
+ if (isCapabilityUnavailable(plugin)) {
421
+ return [...capabilityUnavailableActions(), ...(installed ? [{ id: 'manage' }] : [])];
422
+ }
74
423
  return [{ id: 'sourceProblem' }, ...(installed ? [{ id: 'manage' }] : [])];
75
424
  }
76
- const primary = hasIncompletePlacement(plugin)
77
- || (plugin.dependencySummary?.issueCount ?? 0) > 0
78
- ? { id: 'repair' }
79
- : installed && !hasMissingPlatform(plugin)
80
- ? { id: 'manage' }
81
- : { id: 'add' };
425
+ if (allSupportedPlatformsBlocked(plugin)) {
426
+ return [
427
+ { id: 'outputCollision' },
428
+ ...(hasInstalledPlacement(plugin) ? [{ id: 'manage' }] : []),
429
+ { id: 'source' },
430
+ { id: 'about' },
431
+ ];
432
+ }
433
+ const collisionWithInstallablePlatform = hasMissingPlatform(plugin)
434
+ && plugin.installedPlacements.some((placement) => placement.state === 'blocked'
435
+ || placement.state === 'installed' && placement.blockingReason === 'artifactCollision');
436
+ const primary = collisionWithInstallablePlatform
437
+ ? { id: 'add' }
438
+ : hasIncompletePlacement(plugin) || (plugin.dependencySummary?.issueCount ?? 0) > 0
439
+ ? { id: 'repair' }
440
+ : installed && !hasMissingPlatform(plugin) ? { id: 'manage' } : { id: 'add' };
82
441
  return [primary, ...capabilityActions(plugin), { id: 'source' }];
83
442
  }
84
443
  export function buildPluginDetailActions(plugin) {
85
444
  if (plugin.aggregateStatus === 'unavailable') {
445
+ if (isCapabilityUnavailable(plugin)) {
446
+ return [
447
+ ...plugin.installedPlacements.flatMap((placement) => placement.state === 'notInstalled'
448
+ ? []
449
+ : [{ id: 'platform', platform: placement.platform }]),
450
+ ...capabilityUnavailableActions(),
451
+ { id: 'about' },
452
+ ];
453
+ }
86
454
  return [
87
455
  ...plugin.installedPlacements.flatMap((placement) => placement.state === 'notInstalled'
88
456
  ? []
89
457
  : [{ id: 'platform', platform: placement.platform }]),
458
+ ...(plugin.savedConfigScopes.length > 0 ? [{ id: 'settings' }] : []),
90
459
  { id: 'sourceProblem' },
91
460
  { id: 'about' },
92
461
  ];
93
462
  }
94
463
  return [
95
- ...plugin.installedPlacements.map((placement) => placement.state === 'scopeConflict'
96
- ? { id: 'scopeConflict', platform: placement.platform }
97
- : { id: 'platform', platform: placement.platform }),
464
+ ...(plugin.update?.targets ?? []).flatMap((target) => target.availableVersion !== undefined && target.installedVersion !== undefined
465
+ && plugin.update.sourceIdentity !== undefined && plugin.update.generationKey !== undefined
466
+ && target.requiresCatalogActivation !== true
467
+ && target.eligibility === 'allowed'
468
+ ? [{
469
+ id: 'refreshAndSync',
470
+ platform: target.platform,
471
+ scope: target.scope,
472
+ availableVersion: target.availableVersion,
473
+ installedVersion: target.installedVersion,
474
+ sourceIdentity: plugin.update.sourceIdentity,
475
+ generationKey: plugin.update.generationKey,
476
+ }]
477
+ : []),
478
+ ...plugin.installedPlacements.flatMap((placement) => [
479
+ ...(placement.state === 'installed' ? scopeConflictRecoveryMenuActions(placement) : []),
480
+ placement.state === 'scopeConflict'
481
+ ? { id: 'scopeConflict', platform: placement.platform }
482
+ : { id: 'platform', platform: placement.platform },
483
+ ]),
98
484
  ...((plugin.dependencySummary?.totalCount ?? 0) > 0 ? [{ id: 'dependencies' }] : []),
99
- ...(plugin.portableSkills ? [{ id: 'portableSkills' }] : []),
100
485
  ...(plugin.configFieldCount > 0 ? [{ id: 'settings' }] : []),
101
486
  { id: 'about' },
102
487
  ];
103
488
  }
104
489
  export function buildPlatformActions(plugin, platform) {
105
490
  if (plugin.aggregateStatus === 'unavailable') {
491
+ if (isCapabilityUnavailable(plugin))
492
+ return capabilityUnavailableActions();
106
493
  return [{ id: 'sourceProblem' }, { id: 'refreshSource' }];
107
494
  }
108
495
  const placement = plugin.installedPlacements.find((entry) => entry.platform === platform);
496
+ if (placement?.state === 'blocked') {
497
+ return [{ id: 'outputCollision' }, { id: 'source' }, { id: 'about' }];
498
+ }
109
499
  if (!placement || placement.state === 'notInstalled')
110
500
  return [{ id: 'add' }, { id: 'about' }];
111
501
  if (placement.state === 'scopeConflict')
112
502
  return [{ id: 'scopeConflict', platform }];
113
- if (placement.health === 'error')
114
- return [{ id: 'technical' }, { id: 'back' }];
115
- if (placement.health === 'incomplete') {
503
+ if (placement.scopedPlacements) {
504
+ const actions = placement.scopedPlacements.flatMap((entry) => buildPlatformActions({
505
+ ...plugin,
506
+ installedPlacements: [{
507
+ ...placement,
508
+ ...entry,
509
+ scopedPlacements: undefined,
510
+ }],
511
+ }, platform));
512
+ return [...new Map(actions.map((action) => [JSON.stringify(action), action])).values()];
513
+ }
514
+ const scopedRecovery = scopeConflictRecoveryMenuActions(placement);
515
+ if (scopedRecovery.length > 0)
516
+ return [...scopedRecovery, { id: 'technical' }];
517
+ if (placement.blockingReason === 'artifactCollision') {
116
518
  return [
117
- { id: 'reinstall', platform, scope: placement.scope },
118
- { id: 'technical' },
519
+ { id: 'outputCollision' },
119
520
  { id: 'remove', platform, scope: placement.scope },
521
+ { id: 'technical' },
120
522
  ];
121
523
  }
524
+ const lifecycleActions = buildAllowedLifecycleActions({
525
+ pluginId: plugin.pluginId,
526
+ platform,
527
+ scope: placement.scope,
528
+ state: placement.actualState ?? (placement.health === 'ready'
529
+ ? 'ready' : placement.health === 'incomplete' ? 'needsSync' : 'blocked'),
530
+ recoveryActions: placement.recovery ?? [],
531
+ revision: placement.revision,
532
+ }).flatMap((action) => {
533
+ if (action.id === 'install')
534
+ return [{ id: 'add' }];
535
+ if (action.id === 'refreshAndSync') {
536
+ const updateTarget = plugin.update?.targets.find((target) => target.platform === action.platform && target.scope === action.scope
537
+ && target.availableVersion === action.availableVersion);
538
+ return updateTarget?.installedVersion && plugin.update.sourceIdentity && plugin.update.generationKey
539
+ ? [{
540
+ id: 'refreshAndSync',
541
+ platform: action.platform,
542
+ scope: action.scope,
543
+ availableVersion: action.availableVersion,
544
+ installedVersion: updateTarget.installedVersion,
545
+ sourceIdentity: plugin.update.sourceIdentity,
546
+ generationKey: plugin.update.generationKey,
547
+ }]
548
+ : [];
549
+ }
550
+ if (action.id === 'sync')
551
+ return [{
552
+ id: 'sync', platform: action.platform, scope: action.scope,
553
+ }];
554
+ if (action.id === 'reinstall')
555
+ return [{ id: 'reinstall', platform: action.platform, scope: action.scope }];
556
+ if (action.id === 'uninstall')
557
+ return [{ id: 'remove', platform: action.platform, scope: action.scope }];
558
+ return [{ id: 'cleanup', platform: action.platform, scope: action.scope }];
559
+ });
560
+ if (placement.health !== 'ready') {
561
+ return [...lifecycleActions, { id: 'technical' }, ...(lifecycleActions.length === 0 ? [{ id: 'back' }] : [])];
562
+ }
122
563
  return [
123
- ...(placement.revision.state === 'upgradeAvailable'
124
- ? [{
125
- id: 'upgrade',
126
- platform,
127
- scope: placement.scope,
128
- availableVersion: placement.revision.availableVersion,
129
- }]
130
- : []),
131
- { id: 'reinstall', platform, scope: placement.scope },
132
- { id: 'remove', platform, scope: placement.scope },
564
+ ...missingPureNativeScopes(plugin, placement).map((scope) => ({
565
+ id: 'addScope', platform, scope,
566
+ })),
567
+ ...lifecycleActions,
133
568
  { id: 'technical' },
134
569
  ];
135
570
  }
136
571
  export function hasInstalledPlacement(plugin) {
137
- return plugin.installedPlacements.some((placement) => placement.state !== 'notInstalled');
572
+ return plugin.installedPlacements.some((placement) => placement.state === 'installed' || placement.state === 'scopeConflict');
138
573
  }
139
- function sourceState(source, health) {
140
- if (health?.state === 'ready')
141
- return 'ready';
142
- if (health?.state === 'path')
143
- return 'path';
144
- if (health?.state === 'degraded')
145
- return 'cache';
146
- if (health?.state === 'unavailable')
147
- return 'error';
148
- if (source.error)
149
- return 'error';
150
- if (source.type === 'path' || source.freshness === 'path')
151
- return 'path';
152
- return source.freshness === 'cache' ? 'cache' : 'ready';
153
- }
154
- function sourceIssue(health, impactedTargets = 0) {
155
- if (health.state !== 'degraded' && health.state !== 'unavailable')
574
+ function sourceIssue(health, targetIssues = []) {
575
+ if (health.state !== 'unavailable')
156
576
  return undefined;
157
- const cached = health.state === 'degraded';
158
- const issueId = health.issueId ?? `source:${health.sourceId}:${cached ? 'cache' : 'unavailable'}`;
577
+ const issueId = health.issueId ?? `source:${health.sourceId}:unavailable`;
578
+ const affectedTargets = [...new Map(targetIssues.flatMap((issue) => issue.affectedTargets ?? [])
579
+ .map((target) => [`${target.pluginId}\0${target.platform}\0${target.scope}`, target])).values()]
580
+ .sort((left, right) => compareText(left.pluginId, right.pluginId)
581
+ || compareText(left.platform, right.platform)
582
+ || compareText(left.scope, right.scope));
583
+ const cleanupActions = targetIssues.flatMap((issue) => issue.actions)
584
+ .filter((action) => action.id === 'cleanup');
159
585
  return {
160
586
  issueId,
161
- category: cached ? 'sourceDegraded' : 'sourceUnavailable',
162
- title: `${health.sourceId} · ${cached ? '来源使用缓存' : '来源不可用'}`,
163
- explanation: cached
164
- ? '远端检查失败。当前仍使用已验证的缓存数据。'
165
- : '来源检查失败,并且没有可用缓存数据。',
166
- impact: [cached ? '插件仍可浏览,但数据可能不是最新。' : '当前不能浏览或安装这个来源的插件。',
167
- ...(impactedTargets > 0 ? [`${impactedTargets} 个安装位置受此来源根问题影响。`] : [])],
587
+ category: 'sourceUnavailable',
588
+ title: `${health.sourceId} · 来源不可用`,
589
+ explanation: '来源检查失败。',
590
+ impact: ['当前不能浏览或安装这个来源的插件。',
591
+ ...(affectedTargets.length > 0 ? [`${affectedTargets.length} 个安装位置受此来源根问题影响。`] : [])],
168
592
  entity: { kind: 'source', id: health.sourceId },
169
593
  sourceId: health.sourceId,
170
- actions: cached
171
- ? [
172
- { id: 'refreshSource', label: '重新检查来源', description: '不会修改已安装内容' },
173
- { id: 'continueWithCache', label: '继续使用缓存', description: '当前缓存仍可安全读取' },
174
- { id: 'viewTechnical', label: '技术详情' },
175
- ]
176
- : [
177
- { id: 'editSource', label: '编辑来源', description: '检查 URL、路径或 ref' },
178
- { id: 'refreshSource', label: '稍后重试', description: '只重新检查来源' },
179
- { id: 'viewTechnical', label: '技术详情' },
180
- ],
594
+ ...(affectedTargets.length > 0 ? { affectedTargets } : {}),
595
+ actions: dedupeIssueActions([
596
+ ...cleanupActions,
597
+ { id: 'editSource', label: '编辑来源', description: '检查 URL、路径或 ref' },
598
+ { id: 'refreshSource', label: '稍后重试', description: '只重新检查来源' },
599
+ { id: 'viewTechnical', label: '技术详情' },
600
+ ]),
181
601
  technicalDetails: [{
182
- code: cached ? 'catalogSourceDegraded' : 'catalogSourceUnavailable',
183
- message: cached ? '远端检查失败;已验证缓存仍可用。' : '来源检查失败;没有可用缓存。',
602
+ code: 'catalogSourceUnavailable',
603
+ message: '来源检查失败。',
184
604
  }],
185
605
  };
186
606
  }
187
- function targetIssues(payload) {
607
+ function lifecycleIssueActions(target, options = {}) {
608
+ return buildAllowedLifecycleActions(target).flatMap((action) => {
609
+ const view = projectLifecycleActionView(action);
610
+ if (options.dependency) {
611
+ if (action.id === 'install')
612
+ return [{
613
+ id: 'installDependency',
614
+ label: '补齐依赖插件',
615
+ pluginId: action.pluginId,
616
+ platform: action.platform,
617
+ scope: action.scope,
618
+ project: options.project,
619
+ writeAction: 'install',
620
+ }];
621
+ if (action.id === 'sync' || action.id === 'reinstall')
622
+ return [{
623
+ id: 'reinstallDependency',
624
+ label: view.label,
625
+ description: view.description,
626
+ pluginId: action.pluginId,
627
+ platform: action.platform,
628
+ scope: action.scope,
629
+ project: options.project,
630
+ writeAction: action.id,
631
+ }];
632
+ return [];
633
+ }
634
+ const projection = {
635
+ install: { id: 'install', writeAction: 'install' },
636
+ sync: { id: 'sync', writeAction: 'sync' },
637
+ refreshAndSync: { id: 'refreshAndSync', writeAction: 'refreshAndSync' },
638
+ reinstall: { id: 'reinstall', writeAction: 'reinstall' },
639
+ uninstall: { id: 'remove', writeAction: 'uninstall' },
640
+ cleanup: { id: 'cleanup', writeAction: 'cleanup' },
641
+ }[action.id];
642
+ return [{
643
+ ...projection,
644
+ label: view.label,
645
+ description: view.description,
646
+ pluginId: action.pluginId,
647
+ platform: action.platform,
648
+ scope: action.scope,
649
+ }];
650
+ });
651
+ }
652
+ function targetIssues(payload, targetRevisions = []) {
188
653
  const issues = [];
189
- const byPlacement = new Map();
654
+ const statusTargets = flattenStatusTargets(payload.targets);
655
+ const canonicalRootsByEntity = new Map();
656
+ for (const target of statusTargets) {
657
+ for (const error of target.reasons) {
658
+ if (!error.rootIssueId || !error.rootIssueCode)
659
+ continue;
660
+ const dependencyPluginId = error.dependencyPluginId
661
+ ?? dependencyPluginIdFromMessage(error.message);
662
+ const relationship = targetIssueRelationship({ target, error, dependencyPluginId });
663
+ if (relationship.relationship !== 'consumer')
664
+ continue;
665
+ const key = [
666
+ error.rootIssueCode,
667
+ relationship.rootEntity.pluginId,
668
+ relationship.rootEntity.platform,
669
+ relationship.rootEntity.scope,
670
+ ].join('\0');
671
+ const current = canonicalRootsByEntity.get(key);
672
+ if (!current || compareText(error.rootIssueId, current) < 0) {
673
+ canonicalRootsByEntity.set(key, error.rootIssueId);
674
+ }
675
+ }
676
+ }
677
+ for (const target of payload.targets) {
678
+ if (target.platform !== 'codex' || !target.reasons.some((reason) => reason.code === 'codexExtensionScopeConflict'))
679
+ continue;
680
+ const recoveries = target.recoveryActions.flatMap((recovery) => {
681
+ const parsed = parsedScopedUninstallRecovery(recovery, target.platform);
682
+ return parsed ? [{ ...parsed, keepScope: parsed.scope === 'user'
683
+ ? 'project' : 'user' }] : [];
684
+ });
685
+ issues.push({
686
+ issueId: `scope:${target.pluginId}:${target.platform}`,
687
+ category: 'scopeConflict',
688
+ title: `${target.pluginId} · Codex · 扩展位置冲突`,
689
+ explanation: 'AW 管理附加能力不能同时使用所有项目和当前项目位置。',
690
+ impact: ['选择要保留的使用位置。系统将移除另一位置,再同步保留的位置。'],
691
+ entity: { kind: 'plugin', id: target.pluginId },
692
+ pluginId: target.pluginId,
693
+ platform: target.platform,
694
+ sourceId: target.sourceId,
695
+ sourceIdentity: target.sourceIdentity,
696
+ placements: target.placements.map((placement) => placement.scope).sort(compareText),
697
+ actions: [
698
+ ...recoveries.map((recovery) => ({
699
+ id: recovery.keepScope === 'user' ? 'keepUserScope' : 'keepProjectScope',
700
+ label: `保留${recovery.keepScope === 'user' ? '所有项目' : '当前项目'}`,
701
+ description: recovery.description,
702
+ pluginId: recovery.pluginId,
703
+ platform: target.platform,
704
+ scope: recovery.scope,
705
+ writeAction: 'uninstall',
706
+ })),
707
+ { id: 'viewTechnical', label: '查看冲突详情' },
708
+ ],
709
+ technicalDetails: [{
710
+ code: 'codexExtensionScopeConflict',
711
+ message: '扩展同时使用 user 和 project scope。',
712
+ }],
713
+ });
714
+ }
190
715
  for (const target of payload.targets) {
191
- const key = `${target.pluginId}\0${target.platform}`;
192
- byPlacement.set(key, [...(byPlacement.get(key) ?? []), target]);
193
- if (target.state !== 'partial' && target.state !== 'error')
716
+ if (target.platform !== 'codex')
717
+ continue;
718
+ const sharedReasons = target.reasons.filter((reason) => reason.code.startsWith('codexSharedNative') || reason.code === 'staleCacheObserved');
719
+ if (sharedReasons.length === 0 || target.state === 'ready' || target.state === 'absent')
720
+ continue;
721
+ const installedTargets = statusTargets.filter((candidate) => candidate.pluginId === target.pluginId
722
+ && candidate.platform === 'codex' && candidate.state !== 'absent');
723
+ const directUpgrade = installedTargets.length > 0 && installedTargets.every((candidate) => {
724
+ const revision = targetRevisions.find((entry) => entry.pluginId === candidate.pluginId
725
+ && entry.platform === candidate.platform && entry.scope === candidate.scope);
726
+ return revision !== undefined && isDirectCodexVersionUpgrade(candidate, revision.revision);
727
+ });
728
+ if (directUpgrade)
194
729
  continue;
195
- const codes = new Set(target.errors.map((error) => error.code));
730
+ const codes = new Set(sharedReasons.map((reason) => reason.code));
731
+ const sharedNative = statusTargetSharedNative(target);
732
+ const statusIssue = codes.has('codexSharedNativeForeign')
733
+ ? { title: '平台由多个项目共用的内容被占用', explanation: 'Codex 平台位置含有不属于插件的内容。' }
734
+ : codes.has('codexSharedNativeUpdateRequired')
735
+ ? { title: '版本待同步', explanation: 'Codex 由平台共用的内容版本与当前插件版本不一致。' }
736
+ : codes.has('codexSharedNativeUnobserved')
737
+ ? { title: '状态未确认', explanation: '未取得有效的 Codex 被共用内容的状态证据。' }
738
+ : { title: '由平台共用的内容待同步', explanation: 'Codex 由平台共用的内容缺失、损坏或与当前渲染输入不一致。' };
739
+ const recoveryActions = target.recoveryActions.flatMap((recovery) => {
740
+ if (!recovery.scope)
741
+ return [];
742
+ const scopedTarget = statusTargets.find((candidate) => candidate.pluginId === target.pluginId
743
+ && candidate.platform === target.platform && candidate.scope === recovery.scope);
744
+ return scopedTarget && isInstalledScopeEvidence(scopedTarget)
745
+ ? lifecycleIssueActions({ ...scopedTarget, recoveryActions: [recovery] })
746
+ : [];
747
+ });
748
+ issues.push({
749
+ issueId: `sharedNative:${target.pluginId}`,
750
+ category: target.state === 'blocked' ? 'diagnostic' : 'incompleteInstallation',
751
+ title: `${target.pluginId} · Codex · ${statusIssue.title}`,
752
+ explanation: statusIssue.explanation,
753
+ impact: [sharedNative?.state === 'blocked'
754
+ ? '被共用的内容恢复前,当前插件不能安全同步。'
755
+ : '被共用的内容恢复前,相关 Codex 使用位置可能不可用。'],
756
+ entity: { kind: 'plugin', id: target.pluginId },
757
+ pluginId: target.pluginId,
758
+ platform: target.platform,
759
+ sourceId: target.sourceId,
760
+ sourceIdentity: target.sourceIdentity,
761
+ placements: target.placements.map((placement) => placement.scope).sort(compareText),
762
+ actions: [
763
+ ...new Map(recoveryActions.map((action) => [
764
+ `${action.id}\0${action.scope ?? ''}`,
765
+ action,
766
+ ])).values(),
767
+ { id: 'viewTechnical', label: '技术详情' },
768
+ ],
769
+ technicalDetails: sharedReasons.map((reason) => ({
770
+ code: reason.code,
771
+ message: reason.message,
772
+ })),
773
+ });
774
+ }
775
+ for (const target of statusTargets) {
776
+ const revision = targetRevisions.find((entry) => entry.pluginId === target.pluginId
777
+ && entry.platform === target.platform && entry.scope === target.scope);
778
+ if (revision && isDirectCodexVersionUpgrade(target, revision.revision))
779
+ continue;
780
+ if (target.reasons.length === 0 && (target.sharedReasons?.length ?? 0) > 0
781
+ && isPureNativeCodexTarget(target))
782
+ continue;
783
+ const incomplete = target.state === 'needsSync' || target.state === 'orphaned';
784
+ if (!incomplete && target.state !== 'blocked'
785
+ && !target.reasons.some((error) => error.code === 'artifactCollision'
786
+ || error.dependencyPluginId !== undefined && error.rootIssueId !== undefined))
787
+ continue;
788
+ const codes = new Set(target.reasons.map((error) => error.code));
789
+ const orphanedActivation = target.state === 'orphaned'
790
+ && codes.has('codexActivationDrift') && isPureNativeCodexTarget(target);
791
+ const locationLabel = target.scope === 'project' ? '当前项目' : '所有项目';
792
+ const projectDisablesUserActivation = target.platform === 'codex'
793
+ && target.scope === 'project' && codes.has('codexActivationDrift')
794
+ && statusTargetActivation(target)?.user === true
795
+ && statusTargetActivation(target)?.project === false;
796
+ const sharedNativeRenderDrift = target.state === 'needsSync'
797
+ && codes.has('codexSharedNativeRenderDrift');
798
+ const sharedNativeDamaged = target.state === 'needsSync'
799
+ && codes.has('codexSharedNativeCorrupt');
800
+ const sharedNativeProjectionIssue = sharedNativeRenderDrift || sharedNativeDamaged;
801
+ const sharedNative = statusTargetSharedNative(target);
802
+ const systemConsumer = statusTargetActivation(target)?.systemConsumer;
803
+ const statusUnconfirmed = systemConsumer?.state === 'unresolved'
804
+ || codes.has('codexSharedNativeUnobserved')
805
+ || codes.has('codexNativeObservationFailed')
806
+ || (sharedNative?.state === 'blocked' && sharedNative.reason === 'unreadable');
807
+ const contentMissing = codes.has('missingContent')
808
+ || sharedNative?.state === 'missing'
809
+ || statusTargetExtensions(target)?.state === 'missing'
810
+ || target.components.some((component) => component.kind === 'ownership'
811
+ && component.state === 'absent');
812
+ const statusIssue = systemConsumer?.state === 'incompatible'
813
+ ? { title: 'Codex 版本不兼容', explanation: '当前 Codex 版本低于要求,请升级后重试。' }
814
+ : statusUnconfirmed
815
+ ? { title: '状态未确认', explanation: '未取得有效的 Codex 状态证据,暂时无法确认插件是否可用。' }
816
+ : projectDisablesUserActivation
817
+ ? {
818
+ title: '插件在当前项目被关闭',
819
+ explanation: '这个插件已为所有项目启用,但当前项目的设置将它关闭了,因此在这里无法使用。',
820
+ }
821
+ : orphanedActivation
822
+ ? {
823
+ title: `${locationLabel}有多余的启用记录`,
824
+ explanation: `按当前使用设置,不需要在${locationLabel}单独启用这个插件,但 Codex 仍保留着这条启用记录。`,
825
+ }
826
+ : codes.has('codexActivationDrift')
827
+ ? { title: '激活范围不一致', explanation: 'Codex 激活配置与期望的使用范围不一致。' }
828
+ : target.state === 'orphaned'
829
+ ? { title: '有多余的插件内容', explanation: '按当前使用设置,这个位置不再需要安装此插件,但仍留有插件配置或文件。' }
830
+ : codes.has('codexSharedNativeUpdateRequired')
831
+ ? { title: '版本待同步', explanation: '已安装的 Codex 由平台共用的内容版本与当前插件版本不一致。' }
832
+ : sharedNativeDamaged || contentMissing
833
+ ? { title: '安装不完整', explanation: '必要内容缺失或损坏,需要运行同步。' }
834
+ : { title: '状态待同步', explanation: '现场状态与期望状态不一致,需要重新检查并同步。' };
196
835
  const dependencyCodes = [
197
836
  'dependencyMissing',
198
837
  'dependencyNotReady',
@@ -200,165 +839,256 @@ function targetIssues(payload) {
200
839
  'dependencyStillRequired',
201
840
  'dependencyGraphInvalid',
202
841
  ];
203
- const dependencyRoots = [...new Map(target.errors.flatMap((error) => {
204
- if (!dependencyCodes.includes(error.code))
205
- return [];
206
- const code = error.code;
207
- const dependencyPluginId = dependencyPluginIdFromMessage(error.message);
208
- return [[`${code}\0${dependencyPluginId ?? ''}`, {
209
- code,
210
- category: code,
211
- mergeEligible: false,
212
- error,
213
- dependencyPluginId,
214
- }]];
215
- })).values()];
216
- const roots = dependencyRoots.length > 0
217
- ? dependencyRoots
218
- : target.state === 'partial'
219
- ? [{ code: 'partial', category: 'incompleteInstallation', mergeEligible: false }]
220
- : codes.has('sourceMissing')
221
- ? [{ code: 'sourceMissing', category: 'sourceMissing', mergeEligible: false }]
222
- : codes.has('sourceChanged')
223
- ? [{ code: 'sourceChanged', category: 'sourceIdentityChanged', mergeEligible: false }]
224
- : [
842
+ const dependencyRootMap = new Map();
843
+ for (const error of target.reasons) {
844
+ if (!dependencyCodes.includes(error.code))
845
+ continue;
846
+ if (error.rootIssueCode === 'artifactCollision') {
847
+ dependencyRootMap.set(error.rootIssueId ?? `artifactCollision\0${error.dependencyPluginId ?? ''}`, {
848
+ code: 'artifactCollision',
849
+ category: 'artifactCollision',
850
+ mergeEligible: false,
851
+ error,
852
+ dependencyPluginId: error.dependencyPluginId,
853
+ });
854
+ continue;
855
+ }
856
+ const code = error.code;
857
+ const dependencyPluginId = error.dependencyPluginId ?? dependencyPluginIdFromMessage(error.message);
858
+ dependencyRootMap.set(`${code}\0${dependencyPluginId ?? ''}`, {
859
+ code,
860
+ category: code,
861
+ mergeEligible: false,
862
+ error,
863
+ dependencyPluginId,
864
+ });
865
+ }
866
+ const dependencyRoots = [...dependencyRootMap.values()];
867
+ const directCollision = target.reasons.find((error) => error.code === 'artifactCollision');
868
+ const projectedCollisionRoots = dependencyRoots.filter((root) => root.code === 'artifactCollision');
869
+ const ordinaryDependencyRoots = dependencyRoots.filter((root) => root.code !== 'artifactCollision');
870
+ const roots = codes.has('sourceMissing')
871
+ ? [{ code: 'sourceMissing', category: 'sourceMissing', mergeEligible: false }]
872
+ : directCollision || projectedCollisionRoots.length > 0
873
+ ? [{
874
+ code: 'artifactCollision',
875
+ category: 'artifactCollision',
876
+ mergeEligible: false,
877
+ error: directCollision ?? projectedCollisionRoots[0].error,
878
+ dependencyPluginId: projectedCollisionRoots[0]?.dependencyPluginId,
879
+ }]
880
+ : codes.has('sourceChanged')
881
+ ? [{ code: 'sourceChanged', category: 'sourceIdentityChanged', mergeEligible: false }]
882
+ : codes.has('catalogSourceUnavailable') || codes.has('bundleUnavailable')
883
+ || codes.has('codexIntentSourceUnavailable')
884
+ ? [
225
885
  ...(codes.has('catalogSourceUnavailable')
226
886
  ? [{ code: 'catalogSourceUnavailable', category: 'sourceUnavailable', mergeEligible: true }]
227
887
  : []),
228
888
  ...(codes.has('bundleUnavailable')
229
889
  ? [{ code: 'bundleUnavailable', category: 'sourceUnavailable', mergeEligible: false }]
230
890
  : []),
231
- ...(!codes.has('catalogSourceUnavailable') && !codes.has('bundleUnavailable')
232
- ? [{ code: 'targetDiagnostic', category: 'diagnostic', mergeEligible: false }]
891
+ ...(codes.has('codexIntentSourceUnavailable')
892
+ ? [{ code: 'codexIntentSourceUnavailable', category: 'sourceUnavailable', mergeEligible: false }]
233
893
  : []),
234
- ];
894
+ ]
895
+ : ordinaryDependencyRoots.length > 0
896
+ ? ordinaryDependencyRoots
897
+ : incomplete
898
+ ? [{ code: 'partial', category: 'incompleteInstallation', mergeEligible: false }]
899
+ : [
900
+ { code: 'targetDiagnostic', category: 'diagnostic', mergeEligible: false },
901
+ ];
235
902
  for (const root of roots) {
236
- const rootError = root.error ?? target.errors.find((error) => error.code === root.code);
903
+ const rootError = root.error ?? target.reasons.find((error) => error.code === root.code);
237
904
  const dependencyPluginId = root.dependencyPluginId
905
+ ?? rootError?.dependencyPluginId
238
906
  ?? (rootError ? dependencyPluginIdFromMessage(rootError.message) : undefined);
907
+ const dependencyPlatform = rootError?.dependencyPlatform;
908
+ const dependencyScope = rootError?.dependencyScope;
909
+ const dependencyProject = rootError?.dependencyProject;
239
910
  const dependencyCategory = root.category.startsWith('dependency');
911
+ const directLifecycleActions = lifecycleIssueActions(target).map((action) => projectDisablesUserActivation && action.id === 'sync' ? {
912
+ ...action,
913
+ label: '恢复在当前项目使用',
914
+ description: '移除当前项目的关闭设置,沿用所有项目的启用设置。',
915
+ } : orphanedActivation && action.id === 'cleanup' ? {
916
+ ...action,
917
+ label: '清理多余的启用记录',
918
+ description: `清理${locationLabel}的多余记录;保留其他位置的使用设置和插件文件。`,
919
+ } : action);
920
+ const desiredConsumer = statusTargetIntent(target).enabled
921
+ && statusTargetIntent(target).scopes.includes(target.scope);
922
+ const consumerRecoveryActions = dependencyCategory
923
+ ? directLifecycleActions.filter((action) => desiredConsumer
924
+ ? action.id === 'sync' || action.id === 'reinstall' || action.id === 'refreshAndSync'
925
+ : action.id === 'cleanup')
926
+ : directLifecycleActions;
240
927
  const actions = root.category === 'dependencyMissing'
241
928
  ? [
242
- ...(dependencyPluginId ? [{ id: 'installDependency', label: '补齐依赖插件',
243
- pluginId: dependencyPluginId, writeAction: 'install' }] : []),
929
+ ...consumerRecoveryActions,
930
+ ...(dependencyPluginId ? [
931
+ { id: 'viewDependencyIssue', label: '查看依赖插件问题', pluginId: dependencyPluginId },
932
+ ] : []),
244
933
  { id: 'viewDependencies', label: '查看依赖关系' },
245
934
  { id: 'viewTechnical', label: '技术详情' },
246
935
  ]
247
936
  : root.category === 'dependencyNotReady'
248
937
  ? [
938
+ ...consumerRecoveryActions,
249
939
  ...(dependencyPluginId ? [
250
940
  { id: 'viewDependencyIssue', label: '查看依赖插件问题', pluginId: dependencyPluginId },
251
- { id: 'reinstallDependency', label: '重新安装依赖插件',
252
- pluginId: dependencyPluginId, writeAction: 'reinstall' },
253
941
  ] : []),
254
942
  { id: 'viewDependencies', label: '查看依赖关系' },
255
943
  { id: 'viewTechnical', label: '技术详情' },
256
944
  ]
257
945
  : dependencyCategory
258
946
  ? [
947
+ ...consumerRecoveryActions,
259
948
  { id: 'viewDependencies', label: '查看依赖关系' },
260
949
  { id: 'viewTechnical', label: '技术详情' },
261
950
  ]
262
- : root.category === 'incompleteInstallation'
951
+ : root.category === 'artifactCollision'
263
952
  ? [
264
- { id: 'reinstall', label: '重新安装', description: '保留插件设置,重新生成缺失内容' },
265
- { id: 'remove', label: '移除安装', description: '保留插件设置' },
266
- { id: 'viewTechnical', label: '技术详情' },
953
+ { id: 'viewTechnical', label: '查看冲突原因' },
954
+ { id: 'retryLater', label: '处理冲突后重试' },
267
955
  ]
268
- : root.category === 'sourceMissing'
956
+ : root.category === 'incompleteInstallation'
269
957
  ? [
270
- { id: 'reAddSource', label: '重新添加同一来源', description: '保留来源 ID;来源类型和位置由你选择' },
958
+ ...consumerRecoveryActions,
271
959
  { id: 'viewTechnical', label: '技术详情' },
272
960
  ]
273
- : root.category === 'sourceIdentityChanged'
961
+ : root.category === 'sourceMissing'
274
962
  ? [
275
- { id: 'viewSourceChange', label: '查看来源变更', description: '不会自动覆盖现场状态' },
963
+ ...consumerRecoveryActions,
964
+ { id: 'reAddSource', label: '重新添加同一来源', description: '保留来源 ID;来源类型和位置由你选择' },
276
965
  { id: 'viewTechnical', label: '技术详情' },
277
966
  ]
278
- : root.category === 'sourceUnavailable'
967
+ : root.category === 'sourceIdentityChanged'
279
968
  ? [
280
- ...(root.code === 'bundleUnavailable' ? [{
281
- id: 'cleanup',
282
- label: '清理已安装内容',
283
- description: '只清理 AW 管理的现场内容;保留插件设置',
284
- writeAction: 'cleanup',
285
- }] : []),
286
- { id: 'editSource', label: '查看来源', description: root.code === 'bundleUnavailable' ? '检查当前 Catalog 或稍后重试' : '修复来源配置或稍后重试' },
969
+ { id: 'viewSourceChange', label: '查看来源变更', description: '不会自动覆盖现场状态' },
287
970
  { id: 'viewTechnical', label: '技术详情' },
288
971
  ]
289
- : [{ id: 'viewTechnical', label: '技术详情' }, { id: 'retryLater', label: '稍后重试' }];
290
- const issueId = `target:${target.pluginId}:${target.platform}:${target.scope}:${target.state}${roots.length > 1 ? `:${root.code}` : ''}${dependencyPluginId ? `:${dependencyPluginId}` : ''}`;
972
+ : root.category === 'sourceUnavailable'
973
+ ? [
974
+ ...consumerRecoveryActions.filter((action) => action.id === 'cleanup'),
975
+ { id: 'editSource', label: '查看来源', description: root.code === 'bundleUnavailable'
976
+ ? '检查当前插件目录或稍后重试'
977
+ : root.code === 'codexIntentSourceUnavailable'
978
+ ? '恢复来源后可重新同步已保存的使用设置'
979
+ : '修复来源配置或稍后重试' },
980
+ { id: 'viewTechnical', label: '技术详情' },
981
+ ]
982
+ : [...consumerRecoveryActions,
983
+ { id: 'viewTechnical', label: '技术详情' },
984
+ { id: 'retryLater', label: '稍后重试' }];
291
985
  const bundleUnavailable = root.code === 'bundleUnavailable';
986
+ const codexIntentSourceUnavailable = root.code === 'codexIntentSourceUnavailable';
987
+ const relationship = targetIssueRelationship({
988
+ target,
989
+ error: rootError,
990
+ dependencyPluginId,
991
+ });
992
+ const directRootCode = root.code === 'partial' ? 'incompleteInstallation'
993
+ : root.code === 'targetDiagnostic' ? 'diagnostic'
994
+ : undefined;
995
+ const canonicalRoot = relationship.relationship === 'direct' && directRootCode
996
+ ? canonicalRootsByEntity.get([
997
+ directRootCode,
998
+ relationship.rootEntity.pluginId,
999
+ relationship.rootEntity.platform,
1000
+ relationship.rootEntity.scope,
1001
+ ].join('\0'))
1002
+ : undefined;
1003
+ const issueId = rootError?.rootIssueId
1004
+ ?? canonicalRoot
1005
+ ?? (directRootCode
1006
+ ? `${directRootCode}:${target.pluginId}:${target.platform}:${target.scope}`
1007
+ : `target:${target.pluginId}:${target.platform}:${target.scope}:${target.state}${roots.length > 1 ? `:${root.code}` : ''}${dependencyPluginId ? `:${dependencyPluginId}` : ''}`);
292
1008
  issues.push({
293
1009
  issueId,
294
1010
  category: root.category,
295
1011
  rootCode: root.code,
296
1012
  mergeEligible: root.mergeEligible,
297
- title: `${target.pluginId} · ${target.platform === 'codex' ? 'Codex' : 'Claude Code'} · ${dependencyCategory ? {
1013
+ relationship: relationship.relationship,
1014
+ rootEntity: relationship.rootEntity,
1015
+ affectedTargets: [{
1016
+ pluginId: target.pluginId,
1017
+ platform: target.platform,
1018
+ scope: target.scope,
1019
+ relationship: relationship.relationship,
1020
+ }],
1021
+ title: `${target.pluginId} · ${target.platform === 'codex' ? 'Codex' : 'Claude Code'} · ${dependencyCategory ? `${target.scope === 'user' ? '所有项目' : '当前项目'} · ` : ''}${sharedNativeProjectionIssue ? '由平台共用的内容待同步' : root.category === 'artifactCollision' ? '输出冲突' : dependencyCategory ? {
298
1022
  dependencyMissing: '缺少依赖',
299
1023
  dependencyNotReady: '依赖安装不完整',
300
1024
  dependencyTargetUnsupported: '依赖目标不兼容',
301
1025
  dependencyStillRequired: '依赖仍被使用',
302
1026
  dependencyGraphInvalid: '依赖关系无效',
303
- }[root.category] : target.state === 'partial' ? '安装不完整' : bundleUnavailable ? '当前 Catalog 不再包含此插件' : '检查失败'}`,
304
- explanation: dependencyCategory
305
- ? dependencyPluginId
306
- ? `${dependencyPluginId} 导致当前依赖检查不能通过。`
307
- : '当前依赖检查不能安全通过。'
308
- : target.state === 'partial'
309
- ? '必要内容缺失,插件可能不能稳定运行。'
310
- : bundleUnavailable
311
- ? '当前 Catalog 不再包含此插件,但仍发现 AW 管理的已安装内容。'
312
- : '当前目标不能安全分类为正常安装。',
313
- impact: [bundleUnavailable
314
- ? '可以清理可信的 AW 现场;这不表示来源缓存整体不可用。'
315
- : '写操作前需要重新检查这个目标。'],
1027
+ }[root.category] : incomplete || statusUnconfirmed || systemConsumer?.state === 'incompatible' ? statusIssue.title : bundleUnavailable ? '当前插件目录不再包含此插件' : codexIntentSourceUnavailable ? '已保存使用设置不能解析' : '检查失败'}`,
1028
+ explanation: root.category === 'artifactCollision'
1029
+ ? '目标位置已有不属于当前插件的内容。AW 不会覆盖或删除这些内容。'
1030
+ : dependencyCategory
1031
+ ? dependencyPluginId
1032
+ ? `依赖 ${dependencyPluginId}${dependencyPlatform && dependencyScope
1033
+ ? `(${dependencyPlatform === 'codex' ? 'Codex' : 'Claude Code'} · ${dependencyScope === 'user' ? '所有项目' : '当前项目'})`
1034
+ : ''}未就绪;影响 ${target.pluginId}(${target.platform === 'codex' ? 'Codex' : 'Claude Code'} · ${target.scope === 'user' ? '所有项目' : '当前项目'})。`
1035
+ : `依赖检查未通过;影响 ${target.pluginId}(${target.platform === 'codex' ? 'Codex' : 'Claude Code'} · ${target.scope === 'user' ? '所有项目' : '当前项目'})。`
1036
+ : sharedNativeDamaged
1037
+ ? 'Codex 平台由多个项目共用的生成内容缺失或损坏。'
1038
+ : sharedNativeRenderDrift
1039
+ ? 'Codex 平台由多个项目共用的生成内容与当前渲染输入不一致。'
1040
+ : incomplete || statusUnconfirmed || systemConsumer?.state === 'incompatible'
1041
+ ? statusIssue.explanation
1042
+ : bundleUnavailable
1043
+ ? '当前插件目录不再包含此插件,但仍发现 AW 管理的已安装内容。'
1044
+ : codexIntentSourceUnavailable
1045
+ ? '当前插件目录不能解析这个已保存的使用设置。'
1046
+ : '当前目标不能安全分类为正常安装。',
1047
+ impact: [sharedNativeProjectionIssue
1048
+ ? '运行同步可重新生成由平台共用的 Skill。'
1049
+ : projectDisablesUserActivation
1050
+ ? '恢复后,当前项目可以继续使用已经安装的插件。'
1051
+ : orphanedActivation
1052
+ ? '清理只移除多余的启用记录,不会删除其他位置正在使用的插件。'
1053
+ : root.category === 'artifactCollision'
1054
+ ? '请先移除或迁移冲突内容,然后重试安装或重新安装。'
1055
+ : bundleUnavailable || codexIntentSourceUnavailable || root.code === 'catalogSourceUnavailable'
1056
+ ? '可以核验后取消这个位置的使用设置,并清理可信的 AW 现场。'
1057
+ : '写操作前需要重新检查这个目标。'],
316
1058
  entity: { kind: 'plugin', id: target.pluginId },
317
1059
  pluginId: target.pluginId,
318
1060
  ...(dependencyPluginId ? { dependencyPluginId } : {}),
1061
+ ...(dependencyPlatform ? { dependencyPlatform } : {}),
1062
+ ...(dependencyScope ? { dependencyScope } : {}),
1063
+ ...(dependencyProject !== undefined ? { dependencyProject } : {}),
319
1064
  platform: target.platform,
320
1065
  scope: target.scope,
321
1066
  sourceId: target.sourceId,
322
1067
  sourceIdentity: target.sourceIdentity,
323
1068
  actions,
324
- technicalDetails: target.errors.length > 0
325
- ? target.errors.filter((error) => root.code === 'targetDiagnostic'
1069
+ technicalDetails: target.reasons.length > 0
1070
+ ? target.reasons.filter((error) => root.code === 'targetDiagnostic'
326
1071
  || root.code === 'partial'
327
- || error.code === root.code)
328
- .map((error) => ({ code: error.code, message: '状态检查报告了这个安全错误代码。' }))
1072
+ || error.code === root.code
1073
+ || error.rootIssueId === issueId)
1074
+ .map((error) => ({
1075
+ code: error.code,
1076
+ message: error.collision
1077
+ ? ({
1078
+ ownerMismatch: '目标由其他 owner 占用。',
1079
+ unownedContent: '目标包含没有 AW owner 标记的内容。',
1080
+ typeMismatch: '目标节点类型不符合预期。',
1081
+ })[error.collision.reason]
1082
+ : '状态检查报告了这个安全错误代码。',
1083
+ }))
329
1084
  : [{ code: 'targetStateError', message: '目标状态异常。' }],
330
1085
  });
331
1086
  }
332
1087
  }
333
- for (const targets of byPlacement.values()) {
334
- const installed = targets.filter(isInstalledScopeEvidence);
335
- if (new Set(installed.map((target) => target.scope)).size < 2)
336
- continue;
337
- const sample = installed[0];
338
- issues.push({
339
- issueId: `scope:${sample.pluginId}:${sample.platform}`,
340
- category: 'scopeConflict',
341
- title: `${sample.pluginId} · ${sample.platform === 'codex' ? 'Codex' : 'Claude Code'} · 安装位置冲突`,
342
- explanation: '所有项目和当前项目同时发现了这个插件。',
343
- impact: ['正常状态只能保留一个位置。'],
344
- entity: { kind: 'plugin', id: sample.pluginId },
345
- pluginId: sample.pluginId,
346
- platform: sample.platform,
347
- sourceId: sample.sourceId,
348
- sourceIdentity: sample.sourceIdentity,
349
- placements: installed.map((target) => target.scope).sort(compareText),
350
- actions: [
351
- { id: 'keepUserScope', label: '保留所有项目', description: '移除当前项目中的安装;设置保留' },
352
- { id: 'keepProjectScope', label: '保留当前项目', description: '移除所有项目中的安装;设置保留' },
353
- { id: 'viewTechnical', label: '查看两个位置的详情' },
354
- ],
355
- technicalDetails: [{ code: 'scopeConflict', message: '同一插件和平台存在两个安装位置。' }],
356
- });
357
- }
358
1088
  return issues;
359
1089
  }
360
1090
  function statusIssues(payload) {
361
- const targetCodes = new Set(payload.targets.flatMap((target) => target.errors.map((error) => error.code)));
1091
+ const targetCodes = new Set(payload.targets.flatMap((target) => target.reasons.map((error) => error.code)));
362
1092
  const issues = new Map();
363
1093
  for (const error of payload.errors) {
364
1094
  if (targetCodes.has(error.code) || issues.has(error.code))
@@ -402,154 +1132,165 @@ function statusIssues(payload) {
402
1132
  function configIssues(pluginSummaries) {
403
1133
  return pluginSummaries.flatMap((summary) => {
404
1134
  const sourceId = summary.pluginId.slice(0, summary.pluginId.indexOf('/'));
1135
+ const issues = [];
405
1136
  if (summary.configDiagnostic) {
406
- return [{
407
- issueId: `config:${summary.pluginId}:read`,
408
- category: 'diagnostic',
409
- title: `${summary.displayName ?? summary.pluginName} · 设置状态不可读`,
410
- explanation: '当前不能安全读取这个插件的设置状态。',
411
- impact: ['其他插件仍可检查;当前插件的设置值不会显示。'],
412
- entity: { kind: 'plugin', id: summary.pluginId },
413
- pluginId: summary.pluginId,
414
- sourceId,
415
- actions: [
416
- { id: 'retryLater', label: '稍后重新检查' },
417
- { id: 'viewTechnical', label: '查看技术详情' },
418
- ],
419
- technicalDetails: [{
420
- code: summary.configDiagnostic.code,
421
- message: '设置读取报告了这个安全错误代码。',
422
- }],
423
- }];
1137
+ issues.push({
1138
+ issueId: `config:${summary.pluginId}:read`,
1139
+ category: 'diagnostic',
1140
+ title: `${summary.displayName ?? summary.pluginName} · 设置状态不可读`,
1141
+ explanation: '当前不能安全读取这个插件的设置状态。',
1142
+ impact: ['其他插件仍可检查;当前插件的设置值不会显示。'],
1143
+ entity: { kind: 'plugin', id: summary.pluginId },
1144
+ pluginId: summary.pluginId,
1145
+ sourceId,
1146
+ actions: [
1147
+ { id: 'retryLater', label: '稍后重新检查' },
1148
+ { id: 'viewTechnical', label: '查看技术详情' },
1149
+ ],
1150
+ technicalDetails: [{
1151
+ code: summary.configDiagnostic.code,
1152
+ message: '设置读取报告了这个安全错误代码。',
1153
+ }],
1154
+ });
424
1155
  }
425
1156
  if (!summary.configIssues?.length)
426
- return [];
427
- const types = new Set(summary.configIssues.map((issue) => issue.type));
428
- const invalid = types.has('invalid-config');
429
- const sources = new Set(summary.configIssues.map((issue) => issue.source));
430
- const onlySource = sources.size === 1 ? [...sources][0] : undefined;
431
- const configLayer = onlySource === 'user'
432
- ? { scope: 'user', projectLayer: 'shared' }
433
- : onlySource === 'project'
434
- ? { scope: 'project', projectLayer: 'shared' }
435
- : onlySource === 'projectLocal'
436
- ? { scope: 'project', projectLayer: 'local' }
437
- : undefined;
438
- return [{
439
- issueId: `config:${summary.pluginId}:${invalid ? 'invalid' : 'required'}`,
440
- category: 'requiredConfigMissing',
441
- title: `${summary.displayName ?? summary.pluginName} · ${invalid ? '设置值无效' : '缺少必填设置'}`,
442
- explanation: invalid
443
- ? '已有设置值不符合当前字段规则。'
444
- : '插件缺少必填设置,写操作会在预检时被阻止。',
445
- impact: [invalid ? '修正所列字段后才能稳定生成插件内容。' : '完成所列字段后才能稳定生成插件内容。'],
1157
+ return issues;
1158
+ const unsupported = summary.configIssues.filter((issue) => issue.type === 'configLayerUnsupported');
1159
+ if (unsupported.length > 0) {
1160
+ issues.push({
1161
+ issueId: `config:${summary.pluginId}:unsupported-project-layer`,
1162
+ category: 'configLayerUnsupported',
1163
+ title: `${summary.displayName ?? summary.pluginName} · 项目设置包含旧值`,
1164
+ explanation: '项目配置值不再受支持。请使用用户公共或平台配置。',
1165
+ impact: ['旧项目值不会参与生成。请在用户配置中重新设置所需值。'],
446
1166
  entity: { kind: 'plugin', id: summary.pluginId },
447
1167
  pluginId: summary.pluginId,
448
1168
  sourceId,
449
- requiredFields: summary.configIssues.map(({ key, title, type, source }) => ({ key, title, type, source })),
450
- ...(configLayer ? { configLayer } : {}),
1169
+ configLayer: { profile: 'common', context: 'project' },
451
1170
  actions: [
452
- { id: 'openConfig', label: invalid ? '修正设置' : '完成设置', description: configLayer ? '进入建议的设置层' : '选择个人或项目设置层' },
1171
+ { id: 'openConfig', label: '打开用户配置', description: '在当前项目上下文中设置用户配置' },
453
1172
  { id: 'viewTechnical', label: '查看字段详情' },
454
1173
  ],
455
- technicalDetails: summary.configIssues.map((entry) => ({
1174
+ technicalDetails: unsupported.map((entry) => ({
456
1175
  code: entry.type,
457
- message: `${entry.title} · ${entry.source}`,
1176
+ message: `${entry.title} · 旧项目配置层不再读取`,
458
1177
  })),
459
- }];
460
- });
461
- }
462
- function enrichDependencyIssuePlacements(issues, overviews) {
463
- const overviewById = new Map(overviews.map((overview) => [overview.pluginId, overview]));
464
- return issues.map((issue) => {
465
- if ((issue.category !== 'dependencyMissing' && issue.category !== 'dependencyNotReady')
466
- || !issue.pluginId || !issue.dependencyPluginId || !issue.platform || !issue.scope)
467
- return issue;
468
- const dependency = overviewById.get(issue.pluginId)?.dependencies.find((candidate) => candidate.pluginId === issue.dependencyPluginId);
469
- const references = (dependency?.placementReferences ?? []).filter((reference) => reference.consumer.pluginId === issue.pluginId
470
- && reference.consumer.platform === issue.platform
471
- && reference.consumer.scope === issue.scope
472
- && (issue.scope === 'user' || reference.consumer.project === 'current'))
473
- .sort((left, right) => [
474
- left.dependency.pluginId,
475
- left.dependency.platform,
476
- left.dependency.scope,
477
- left.dependency.project ?? '',
478
- ].join('\0').localeCompare([
479
- right.dependency.pluginId,
480
- right.dependency.platform,
481
- right.dependency.scope,
482
- right.dependency.project ?? '',
483
- ].join('\0'), 'en'));
484
- const target = references[0]?.dependency;
485
- if (!target) {
486
- return {
487
- ...issue,
488
- actions: issue.actions.filter((action) => action.id !== 'installDependency' && action.id !== 'reinstallDependency'),
489
- };
1178
+ });
490
1179
  }
491
- return {
492
- ...issue,
493
- dependencyPlatform: target.platform,
494
- dependencyScope: target.scope,
495
- dependencyProject: target.project,
496
- actions: issue.actions.map((action) => action.id === 'installDependency' || action.id === 'reinstallDependency'
497
- ? {
498
- ...action,
499
- platform: target.platform,
500
- scope: target.scope,
501
- project: target.project,
502
- }
503
- : action),
504
- };
1180
+ const blockingIssues = summary.configIssues.filter((issue) => issue.type !== 'configLayerUnsupported');
1181
+ if (blockingIssues.length === 0)
1182
+ return issues;
1183
+ const types = new Set(blockingIssues.map((issue) => issue.type));
1184
+ const invalid = types.has('invalid-config') || types.has('sharedCompositeContainsLocalPath');
1185
+ const sources = new Set(blockingIssues.map((issue) => issue.source));
1186
+ const onlySource = sources.size === 1 ? [...sources][0] : undefined;
1187
+ const context = blockingIssues.some((issue) => issue.scope === 'project') ? 'project' : 'user';
1188
+ const platforms = new Set(blockingIssues.flatMap((issue) => issue.platform ? [issue.platform] : []));
1189
+ const onlyPlatform = platforms.size === 1 ? [...platforms][0] : undefined;
1190
+ const configLayer = onlySource === 'common' ? { profile: 'common', context }
1191
+ : onlyPlatform ? { profile: onlyPlatform, context } : undefined;
1192
+ issues.push({
1193
+ issueId: `config:${summary.pluginId}:${invalid ? 'invalid' : 'required'}`,
1194
+ category: 'requiredConfigMissing',
1195
+ title: `${summary.displayName ?? summary.pluginName} · ${invalid ? '设置值无效' : '缺少必填设置'}`,
1196
+ explanation: invalid
1197
+ ? '已有设置值不符合当前字段规则。'
1198
+ : '插件缺少必填设置,写操作会在预检时被阻止。',
1199
+ impact: [invalid ? '修正所列字段后才能稳定生成插件内容。' : '完成所列字段后才能稳定生成插件内容。'],
1200
+ entity: { kind: 'plugin', id: summary.pluginId },
1201
+ pluginId: summary.pluginId,
1202
+ sourceId,
1203
+ requiredFields: blockingIssues.map(({ key, title, type, source, scope, platform }) => ({
1204
+ key, title, type, source, scope, platform,
1205
+ })),
1206
+ ...(configLayer ? { configLayer } : {}),
1207
+ actions: [
1208
+ { id: 'openConfig', label: invalid ? '修正设置' : '完成设置', description: configLayer ? '进入相关用户配置' : '选择公共或平台配置' },
1209
+ { id: 'viewTechnical', label: '查看字段详情' },
1210
+ ],
1211
+ technicalDetails: blockingIssues.map((entry) => ({
1212
+ code: entry.type,
1213
+ message: `${entry.title} · ${entry.scope} · ${entry.source}`,
1214
+ })),
1215
+ });
1216
+ return issues;
505
1217
  });
506
1218
  }
1219
+ function dependencyOverviewIssues(overviews, pluginSummaries, status) {
1220
+ const summaryById = new Map(pluginSummaries.map((summary) => [summary.pluginId, summary]));
1221
+ return overviews.flatMap((overview) => overview.blockers.flatMap((blocker) => {
1222
+ if (blocker.code !== 'dependencyGraphInvalid'
1223
+ && blocker.code !== 'dependencyTargetUnsupported')
1224
+ return [];
1225
+ if (status.targets.some((target) => target.pluginId === overview.pluginId
1226
+ && target.reasons.some((error) => error.code === blocker.code)))
1227
+ return [];
1228
+ const summary = summaryById.get(overview.pluginId);
1229
+ const sourceId = overview.pluginId.slice(0, overview.pluginId.indexOf('/'));
1230
+ const category = blocker.code;
1231
+ return [{
1232
+ issueId: `dependency:${overview.pluginId}:${blocker.code}`,
1233
+ category,
1234
+ rootCode: category,
1235
+ mergeEligible: false,
1236
+ title: `${summary?.displayName ?? summary?.pluginName ?? overview.pluginId} · ${blocker.title}`,
1237
+ explanation: blocker.explanation,
1238
+ impact: [category === 'dependencyGraphInvalid'
1239
+ ? '修复依赖关系后才能安全计算安装顺序。'
1240
+ : '当前不能在所有声明的平台上安全安装这个插件。'],
1241
+ entity: { kind: 'plugin', id: overview.pluginId },
1242
+ pluginId: overview.pluginId,
1243
+ sourceId,
1244
+ actions: [
1245
+ { id: 'viewDependencies', label: '查看依赖关系' },
1246
+ { id: 'viewTechnical', label: '技术详情' },
1247
+ ],
1248
+ technicalDetails: [{ code: blocker.code, message: blocker.explanation }],
1249
+ }];
1250
+ }));
1251
+ }
507
1252
  function issueDiagnostic(issue, sourceDetails) {
508
1253
  const source = issue.sourceId ? sourceDetails.get(issue.sourceId) : undefined;
509
- const sourceDegraded = issue.category === 'sourceDegraded';
510
1254
  const sourceUnavailable = issue.category === 'sourceUnavailable' && issue.entity.kind === 'source';
1255
+ const configLayerUnsupported = issue.category === 'configLayerUnsupported';
511
1256
  const configUnavailable = issue.category === 'diagnostic' && issue.issueId.startsWith('config:');
512
1257
  const configInvalid = issue.category === 'requiredConfigMissing';
513
1258
  const dependency = issue.category.startsWith('dependency');
514
1259
  const platformState = issue.issueId.startsWith('status:') || issue.rootCode === 'targetDiagnostic';
515
- const preserved = sourceDegraded || sourceUnavailable
1260
+ const preserved = sourceUnavailable
516
1261
  ? '已安装插件和已保存设置不会被删除。'
517
1262
  : configUnavailable
518
1263
  ? '已保存的设置保持不变。'
519
1264
  : '现有安装和已保存设置不会因本页自动改变。';
520
- const impact = sourceDegraded
1265
+ const impact = sourceUnavailable
521
1266
  ? [
522
- { state: 'degraded', message: '远端数据可能不是最新;匹配的已验证缓存仍可浏览和安装。' },
1267
+ { state: 'blocked', message: '当前不能浏览或安装这个来源中的插件。' },
523
1268
  { state: 'preserved', message: preserved },
524
1269
  ]
525
- : sourceUnavailable
526
- ? [
527
- { state: 'blocked', message: '没有可用缓存;当前不能浏览或安装这个来源中的插件。' },
528
- { state: 'preserved', message: preserved },
529
- ]
530
- : [
531
- ...issue.impact.map((message) => ({
532
- state: dependency || configUnavailable || configInvalid || platformState ? 'blocked' : 'degraded',
533
- message,
534
- })),
535
- { state: 'preserved', message: preserved },
536
- ];
537
- const primaryAction = issue.actions.find((action) => action.id !== 'viewTechnical');
1270
+ : [
1271
+ ...issue.impact.map((message) => ({
1272
+ state: dependency || configUnavailable || configInvalid || platformState ? 'blocked' : 'degraded',
1273
+ message,
1274
+ })),
1275
+ { state: 'preserved', message: preserved },
1276
+ ];
1277
+ const primaryAction = issue.actions.find((action) => action.id !== 'viewTechnical'
1278
+ && action.id !== 'keepProjectScope' && action.id !== 'keepUserScope');
538
1279
  const nextStep = primaryAction
539
1280
  ? `${primaryAction.label},然后重新检查当前状态。`
540
1281
  : '打开技术详情,记录安全错误代码后重新检查。';
541
- const sourceDiagnostic = sourceDegraded || sourceUnavailable;
1282
+ const sourceDiagnostic = sourceUnavailable;
542
1283
  const rawCode = sourceDiagnostic
543
1284
  ? source?.errorCode ?? issue.technicalDetails[0]?.code
544
1285
  : issue.technicalDetails[0]?.code;
545
- const code = safeDiagnosticCode(rawCode, sourceDegraded
546
- ? 'catalogSourceDegraded'
547
- : sourceUnavailable ? 'catalogSourceUnavailable' : 'diagnosticUnavailable');
548
- const stage = sourceDegraded || sourceUnavailable ? 'resolve-source'
549
- : configUnavailable ? 'read-config'
550
- : configInvalid ? 'validate-config'
551
- : dependency ? 'resolve-dependencies'
552
- : platformState ? 'read-platform-state' : 'inspect-target';
1286
+ const code = safeDiagnosticCode(rawCode, sourceUnavailable
1287
+ ? 'catalogSourceUnavailable' : 'diagnosticUnavailable');
1288
+ const stage = sourceUnavailable ? 'resolve-source'
1289
+ : configLayerUnsupported ? 'read-config'
1290
+ : configUnavailable ? 'read-config'
1291
+ : configInvalid ? 'validate-config'
1292
+ : dependency ? 'resolve-dependencies'
1293
+ : platformState ? 'read-platform-state' : 'inspect-target';
553
1294
  const context = [
554
1295
  ...(issue.pluginId ? [{ key: 'pluginId', value: issue.pluginId }] : []),
555
1296
  ...(issue.dependencyPluginId
@@ -557,9 +1298,6 @@ function issueDiagnostic(issue, sourceDetails) {
557
1298
  : []),
558
1299
  ...(issue.platform ? [{ key: 'platform', value: issue.platform }] : []),
559
1300
  ...(issue.scope ? [{ key: 'scope', value: issue.scope }] : []),
560
- ...(sourceDiagnostic && source?.freshness
561
- ? [{ key: 'freshness', value: source.freshness }]
562
- : []),
563
1301
  ...(issue.requiredFields?.slice(0, 1).map((field) => ({
564
1302
  key: 'field',
565
1303
  value: field.title,
@@ -568,22 +1306,24 @@ function issueDiagnostic(issue, sourceDetails) {
568
1306
  const checks = issue.category === 'legacyState'
569
1307
  ? [
570
1308
  '不自动迁移旧版状态。',
571
- '运行 aw status --json,记录公开错误 code。',
1309
+ '运行 aw plugin status --json,记录公开错误 code。',
572
1310
  '备份相关 AW 配置。',
573
1311
  '按技术详情使用受支持命令或人工处理。',
574
1312
  '再次运行状态检查。',
575
1313
  ]
576
- : sourceDegraded || sourceUnavailable
577
- ? ['检查 Git URL、ref 或本地目录。', '确认当前终端具备来源授权。', '运行“重新检查来源”验证修复。']
578
- : dependency
579
- ? ['检查依赖关系和依赖插件状态。', '完成恢复动作后重新检查根插件。']
580
- : configUnavailable
581
- ? ['恢复插件来源和可信字段定义。', '重新检查来源后再次打开设置。']
582
- : configInvalid
583
- ? ['完成或修正列出的设置字段。', '重新检查插件设置。']
584
- : ['检查目标平台配置和访问权限。', '完成恢复动作后重新运行状态检查。'];
1314
+ : configLayerUnsupported
1315
+ ? ['打开项目设置。', '删除本项目旧值。', '重新检查插件设置。']
1316
+ : sourceUnavailable
1317
+ ? ['检查 Git URL、ref 或本地目录。', '确认当前终端具备来源授权。', '运行“重新检查来源”验证修复。']
1318
+ : dependency
1319
+ ? ['检查依赖关系和依赖插件状态。', '完成恢复动作后重新检查根插件。']
1320
+ : configUnavailable
1321
+ ? ['恢复插件来源和可信字段定义。', '重新检查来源后再次打开设置。']
1322
+ : configInvalid
1323
+ ? ['完成或修正列出的设置字段。', '重新检查插件设置。']
1324
+ : ['检查目标平台配置和访问权限。', '完成恢复动作后重新运行状态检查。'];
585
1325
  return {
586
- severity: sourceDegraded ? 'warning' : 'error',
1326
+ severity: configLayerUnsupported ? 'warning' : 'error',
587
1327
  title: issue.title,
588
1328
  userMessage: issue.explanation,
589
1329
  impact,
@@ -594,37 +1334,197 @@ function issueDiagnostic(issue, sourceDetails) {
594
1334
  ...(sourceDiagnostic && issue.sourceId ? { sourceId: issue.sourceId } : {}),
595
1335
  ...(sourceDiagnostic && source?.requestedRef ? { requestedRef: source.requestedRef } : {}),
596
1336
  ...(sourceDiagnostic && source?.resolvedCommit ? { resolvedCommit: source.resolvedCommit } : {}),
597
- ...(sourceDegraded || sourceUnavailable
598
- ? { lastGood: sourceDegraded ? 'available' : 'unavailable' }
599
- : {}),
600
1337
  ...(context.length > 0 ? { context } : {}),
601
1338
  checks,
602
1339
  },
603
1340
  };
604
1341
  }
1342
+ const issueGroupOrder = {
1343
+ sourceRemoved: 0,
1344
+ artifactCollision: 1,
1345
+ sourceUnavailable: 2,
1346
+ dependency: 3,
1347
+ scope: 4,
1348
+ config: 5,
1349
+ installation: 6,
1350
+ diagnostic: 7,
1351
+ };
1352
+ function issueGroup(issue) {
1353
+ if (issue.category === 'sourceMissing')
1354
+ return 'sourceRemoved';
1355
+ if (issue.category === 'artifactCollision')
1356
+ return 'artifactCollision';
1357
+ if (issue.category === 'sourceUnavailable'
1358
+ || issue.category === 'sourceIdentityChanged')
1359
+ return 'sourceUnavailable';
1360
+ if (issue.category.startsWith('dependency'))
1361
+ return 'dependency';
1362
+ if (issue.category === 'scopeConflict')
1363
+ return 'scope';
1364
+ if (issue.category === 'requiredConfigMissing' || issue.category === 'configLayerUnsupported')
1365
+ return 'config';
1366
+ if (issue.category === 'incompleteInstallation')
1367
+ return 'installation';
1368
+ return 'diagnostic';
1369
+ }
1370
+ function primaryAttentionCode(issue) {
1371
+ if (issue.category === 'requiredConfigMissing') {
1372
+ return issue.requiredFields?.some((field) => field.type === 'invalid-config')
1373
+ ? 'invalidConfig'
1374
+ : 'requiredConfigMissing';
1375
+ }
1376
+ if (issue.category === 'configLayerUnsupported')
1377
+ return 'configLayerUnsupported';
1378
+ if (issue.category === 'incompleteInstallation')
1379
+ return 'incompleteInstallation';
1380
+ if (issue.category === 'sourceIdentityChanged')
1381
+ return 'sourceUnavailable';
1382
+ return issue.rootCode ?? issue.category;
1383
+ }
1384
+ function issueReasonPriority(issue) {
1385
+ const code = primaryAttentionCode(issue);
1386
+ return {
1387
+ sourceMissing: 0,
1388
+ artifactCollision: 1,
1389
+ sourceUnavailable: 2,
1390
+ catalogSourceUnavailable: 2,
1391
+ bundleUnavailable: 2,
1392
+ codexIntentSourceUnavailable: 2,
1393
+ dependencyGraphInvalid: 3,
1394
+ dependencyTargetUnsupported: 4,
1395
+ dependencyNotReady: 5,
1396
+ dependencyMissing: 5,
1397
+ scopeConflict: 6,
1398
+ requiredConfigMissing: 7,
1399
+ invalidConfig: 7,
1400
+ incompleteInstallation: 8,
1401
+ diagnostic: 9,
1402
+ }[code] ?? 9;
1403
+ }
1404
+ function dedupeIssueActions(actions) {
1405
+ return [...new Map(actions.map((action) => [[
1406
+ action.id,
1407
+ action.pluginId ?? '',
1408
+ action.platform ?? '',
1409
+ action.scope ?? '',
1410
+ ].join('\0'), action])).values()];
1411
+ }
1412
+ function collapseRootIssues(issues) {
1413
+ const byId = new Map();
1414
+ for (const issue of issues)
1415
+ byId.set(issue.issueId, [...(byId.get(issue.issueId) ?? []), issue]);
1416
+ return [...byId.values()].map((group) => {
1417
+ const ordered = [...group].sort((left, right) => Number(right.relationship === 'direct') - Number(left.relationship === 'direct')
1418
+ || compareText(left.pluginId ?? '', right.pluginId ?? '')
1419
+ || compareText(left.platform ?? '', right.platform ?? '')
1420
+ || compareText(left.scope ?? '', right.scope ?? ''));
1421
+ const primary = ordered[0];
1422
+ const direct = ordered.find((issue) => issue.relationship === 'direct');
1423
+ const rootEntity = direct?.rootEntity ?? ordered.map((issue) => issue.rootEntity)
1424
+ .filter((entity) => entity !== undefined)
1425
+ .sort((left, right) => compareText(left.pluginId, right.pluginId)
1426
+ || compareText(left.platform, right.platform)
1427
+ || compareText(left.scope, right.scope))[0];
1428
+ const affectedTargets = [...new Map(ordered.flatMap((issue) => issue.affectedTargets ?? [])
1429
+ .map((target) => [`${target.pluginId}\0${target.platform}\0${target.scope}`, target])).values()]
1430
+ .sort((left, right) => compareText(left.pluginId, right.pluginId)
1431
+ || compareText(left.platform, right.platform)
1432
+ || compareText(left.scope, right.scope));
1433
+ const projected = rootEntity && !direct ? {
1434
+ ...primary,
1435
+ title: `${rootEntity.pluginId} · ${rootEntity.platform === 'codex' ? 'Codex' : 'Claude Code'} · ${primary.category === 'artifactCollision' ? '输出冲突' : primary.title.split(' · ').at(-1) ?? primary.title}`,
1436
+ entity: { kind: 'plugin', id: rootEntity.pluginId },
1437
+ pluginId: rootEntity.pluginId,
1438
+ platform: rootEntity.platform,
1439
+ scope: rootEntity.scope,
1440
+ sourceId: rootEntity.pluginId.split('/', 1)[0],
1441
+ } : primary;
1442
+ return {
1443
+ ...projected,
1444
+ ...(rootEntity ? { rootEntity } : {}),
1445
+ ...(affectedTargets.length > 0 ? { affectedTargets } : {}),
1446
+ impact: [...new Set(ordered.flatMap((issue) => issue.impact))],
1447
+ technicalDetails: [...new Map(ordered.flatMap((issue) => issue.technicalDetails)
1448
+ .map((detail) => [`${detail.code}\0${detail.message}`, detail])).values()],
1449
+ actions: dedupeIssueActions(ordered.flatMap((issue) => issue.actions)),
1450
+ };
1451
+ });
1452
+ }
605
1453
  export function buildTuiViewModel(options) {
606
1454
  const dependencyById = new Map((options.dependencyOverviews ?? [])
607
1455
  .map((overview) => [overview.pluginId, overview]));
608
1456
  const summaryById = new Map(options.pluginSummaries.map((summary) => [summary.pluginId, summary]));
1457
+ const sourceById = new Map(options.status.catalog.sources.map((source) => [source.id, source]));
609
1458
  const targetsByPlugin = new Map();
610
- for (const target of options.status.targets) {
1459
+ for (const target of flattenStatusTargets(options.status.targets)) {
611
1460
  targetsByPlugin.set(target.pluginId, [...(targetsByPlugin.get(target.pluginId) ?? []), target]);
612
1461
  }
613
- const pluginIds = new Set([...summaryById.keys(), ...targetsByPlugin.keys()]);
1462
+ const configScopesByPlugin = new Map();
1463
+ for (const store of options.configStoreInventory ?? []) {
1464
+ const scopes = configScopesByPlugin.get(store.pluginId) ?? new Set();
1465
+ scopes.add(store.scope);
1466
+ configScopesByPlugin.set(store.pluginId, scopes);
1467
+ }
1468
+ const retainedStatusIds = new Set([...targetsByPlugin].flatMap(([pluginId, targets]) => targets.some((target) => target.state !== 'absent'
1469
+ || statusTargetIntent(target).enabled
1470
+ || target.reasons.length > 0)
1471
+ ? [pluginId] : []));
1472
+ const pluginIds = new Set([
1473
+ ...summaryById.keys(),
1474
+ ...retainedStatusIds,
1475
+ ...configScopesByPlugin.keys(),
1476
+ ]);
614
1477
  const plugins = [...pluginIds].map((pluginId) => {
615
1478
  const summary = summaryById.get(pluginId);
616
- const targets = targetsByPlugin.get(pluginId) ?? [];
1479
+ const targets = summary || retainedStatusIds.has(pluginId)
1480
+ ? targetsByPlugin.get(pluginId) ?? [] : [];
617
1481
  const sourceId = targets[0]?.sourceId ?? pluginId.slice(0, pluginId.indexOf('/'));
1482
+ const savedConfigScopes = [...(configScopesByPlugin.get(pluginId) ?? [])]
1483
+ .sort((left, right) => (left === 'user' ? 0 : 1) - (right === 'user' ? 0 : 1));
1484
+ const configOnly = summary === undefined && targets.length === 0 && savedConfigScopes.length > 0;
1485
+ const removedPluginCleanupRequired = targets.some((target) => target.reasons.some((reason) => reason.code === 'removedPluginCleanupRequired'));
618
1486
  const placements = ['codex', 'claude'].flatMap((platform) => {
619
1487
  const platformTargets = targets.filter((target) => target.platform === platform);
1488
+ const aggregateConflict = platform === 'codex' && options.status.targets.some((target) => target.pluginId === pluginId
1489
+ && target.platform === platform
1490
+ && target.state === 'blocked'
1491
+ && target.reasons.some((reason) => reason.code === 'codexExtensionScopeConflict'));
1492
+ if (aggregateConflict) {
1493
+ const scoped = platformTargets.flatMap((target) => {
1494
+ const projected = projectPlatformPlacement(platform, [target], options.targetRevisions);
1495
+ return projected.state === 'installed' ? [{
1496
+ scope: projected.scope,
1497
+ health: projected.health,
1498
+ revision: projected.revision,
1499
+ }] : [];
1500
+ });
1501
+ return [{ platform, state: 'scopeConflict', placements: scoped }];
1502
+ }
620
1503
  return platformTargets.length > 0
621
1504
  ? [projectPlatformPlacement(platform, platformTargets, options.targetRevisions)]
622
1505
  : [];
623
1506
  });
624
1507
  const attention = placements.some((placement) => placement.state === 'scopeConflict'
625
- || (placement.state === 'installed' && placement.health !== 'ready'));
626
- const installed = placements.some((placement) => placement.state !== 'notInstalled');
627
- const unavailable = options.sourceHealth?.get(sourceId)?.state === 'unavailable';
1508
+ || (placement.state === 'installed'
1509
+ && (placement.health !== 'ready' || placement.blockingReason !== undefined)));
1510
+ const installed = placements.some((placement) => placement.state === 'installed' || placement.state === 'scopeConflict');
1511
+ const sourceUnavailable = options.sourceHealth?.get(sourceId)?.state === 'unavailable'
1512
+ || sourceById.get(sourceId)?.error !== undefined;
1513
+ const capabilityTargets = targets.filter((target) => target.reasons.some((reason) => reason.code === 'awCapabilityUnsupported'));
1514
+ const capabilityUnsupported = (summary?.missingCapabilities?.length ?? 0) > 0
1515
+ || capabilityTargets.length > 0;
1516
+ const capabilityRecovery = capabilityTargets.flatMap((target) => target.recoveryActions)
1517
+ .find((action) => action.command === 'manual')?.description;
1518
+ const unavailable = sourceUnavailable || capabilityUnsupported || configOnly;
1519
+ const update = buildPluginUpdateSummary({
1520
+ pluginId,
1521
+ sourceId,
1522
+ targetRevisions: options.targetRevisions ?? [],
1523
+ targets,
1524
+ freshness: options.catalogFreshness?.get(sourceId),
1525
+ sourceIdentity: sourceById.get(sourceId)?.identity,
1526
+ generationKey: options.catalogGenerations?.get(sourceId)?.active?.storeKey,
1527
+ });
628
1528
  return {
629
1529
  pluginId,
630
1530
  sourceId,
@@ -639,9 +1539,23 @@ export function buildTuiViewModel(options) {
639
1539
  supportedPlatforms: summary?.supportedTargets
640
1540
  ? ['codex', 'claude'].filter((platform) => summary.supportedTargets[platform].length > 0)
641
1541
  : placements.map((placement) => placement.platform),
1542
+ ...(summary?.supportedTargets ? { supportedScopes: {
1543
+ codex: [...summary.supportedTargets.codex],
1544
+ claude: [...summary.supportedTargets.claude],
1545
+ } } : {}),
642
1546
  installedPlacements: placements,
643
1547
  aggregateStatus: unavailable ? 'unavailable' : attention ? 'needsAttention' : installed ? 'installed' : 'available',
644
1548
  portableSkills: options.portablePluginIds?.includes(pluginId) ?? false,
1549
+ ...(summary?.missingCapabilities
1550
+ ? { missingCapabilities: summary.missingCapabilities }
1551
+ : {}),
1552
+ ...(capabilityUnsupported ? { capabilityUnsupported: true } : {}),
1553
+ ...(capabilityRecovery ? { capabilityRecovery } : {}),
1554
+ ...(sourceUnavailable ? { sourceUnavailable: true } : {}),
1555
+ savedConfigScopes,
1556
+ ...(configOnly ? { configOnly: true } : {}),
1557
+ ...(summary === undefined ? { catalogEntryMissing: true } : {}),
1558
+ ...(removedPluginCleanupRequired ? { removedPluginCleanupRequired: true } : {}),
645
1559
  ...(dependencyById.get(pluginId)
646
1560
  ? { dependencySummary: dependencyById.get(pluginId).summary }
647
1561
  : summary && (summary.dependencyTotalCount ?? 0) > 0
@@ -654,94 +1568,197 @@ export function buildTuiViewModel(options) {
654
1568
  issueCount: summary.dependencyIssueCount ?? 0,
655
1569
  } }
656
1570
  : {}),
657
- technicalComponents: targets.flatMap((target) => target.components.map((component) => ({
658
- platform: target.platform,
659
- scope: target.scope,
660
- key: component.key,
661
- state: component.state,
662
- ...(component.error ? { errorCode: component.error.code } : {}),
663
- }))),
1571
+ technicalComponents: [
1572
+ ...targets.flatMap((target) => [
1573
+ ...target.components,
1574
+ ...(target.sharedComponents ?? []).filter((component) => component.kind === 'systemConsumer'),
1575
+ ].map((component) => ({
1576
+ platform: target.platform,
1577
+ scope: target.scope,
1578
+ key: component.key,
1579
+ state: component.state,
1580
+ ...(typeof component.metadata?.errorCode === 'string'
1581
+ ? { errorCode: component.metadata.errorCode }
1582
+ : {}),
1583
+ }))),
1584
+ ...new Map(targets.flatMap((target) => (target.sharedComponents ?? [])
1585
+ .filter((component) => component.kind === 'sharedNative')
1586
+ .map((component) => [`${target.platform}\0${component.key}`, {
1587
+ platform: target.platform,
1588
+ shared: true,
1589
+ key: component.key,
1590
+ state: component.state,
1591
+ ...(typeof component.metadata?.errorCode === 'string'
1592
+ ? { errorCode: component.metadata.errorCode }
1593
+ : {}),
1594
+ }]))).values(),
1595
+ ],
1596
+ update,
664
1597
  };
665
1598
  }).sort((left, right) => compareText(left.displayName, right.displayName)
666
1599
  || compareText(left.sourceId, right.sourceId));
667
- const sourceTabs = options.status.catalog.sources.map((source) => ({
668
- id: source.id,
669
- label: source.id,
670
- count: plugins.filter((plugin) => plugin.sourceId === source.id).length,
671
- primary: source.primary,
672
- state: sourceState(source, options.sourceHealth?.get(source.id)),
673
- }));
1600
+ const sourceTabs = options.status.catalog.sources.map((source) => {
1601
+ const generation = options.catalogGenerations?.get(source.id);
1602
+ const countKnown = generation
1603
+ ? generation.state === 'ready' || generation.state === undefined && generation.active !== undefined
1604
+ : source.error === undefined;
1605
+ return {
1606
+ id: source.id,
1607
+ label: source.id,
1608
+ ...(countKnown ? { count: plugins.filter((plugin) => plugin.sourceId === source.id).length } : {}),
1609
+ primary: source.primary,
1610
+ state: projectCatalogSourceState(source, options.sourceHealth?.get(source.id), options.catalogFreshness?.get(source.id), generation),
1611
+ };
1612
+ });
674
1613
  const sourceRootIds = new Set([...(options.sourceHealth?.values() ?? [])]
675
- .filter((health) => health.state === 'degraded' || health.state === 'unavailable')
1614
+ .filter((health) => health.state === 'unavailable')
676
1615
  .map((health) => health.sourceId));
677
- const allTargetIssues = targetIssues(options.status);
678
- const targetImpactCounts = new Map();
1616
+ const allTargetIssues = targetIssues(options.status, options.targetRevisions);
1617
+ const mergedTargetIssues = new Map();
679
1618
  for (const issue of allTargetIssues) {
680
1619
  if (!issue.mergeEligible || !issue.sourceId || !sourceRootIds.has(issue.sourceId))
681
1620
  continue;
682
- targetImpactCounts.set(issue.sourceId, (targetImpactCounts.get(issue.sourceId) ?? 0) + 1);
1621
+ mergedTargetIssues.set(issue.sourceId, [...(mergedTargetIssues.get(issue.sourceId) ?? []), issue]);
683
1622
  }
684
1623
  const sourceDetails = new Map((options.sourceDetails ?? []).map((detail) => [detail.id, detail]));
685
- const issueDrafts = enrichDependencyIssuePlacements([
1624
+ const issueDrafts = [
686
1625
  ...allTargetIssues.filter((issue) => !issue.mergeEligible
687
1626
  || !issue.sourceId || !sourceRootIds.has(issue.sourceId)),
688
1627
  ...statusIssues(options.status),
689
1628
  ...configIssues(options.pluginSummaries),
690
- ...[...(options.sourceHealth?.values() ?? [])].flatMap((health) => sourceIssue(health, targetImpactCounts.get(health.sourceId) ?? 0) ?? []),
691
- ], options.dependencyOverviews ?? []);
692
- const issues = issueDrafts.map((issue) => ({
1629
+ ...dependencyOverviewIssues(options.dependencyOverviews ?? [], options.pluginSummaries, options.status),
1630
+ ...[...(options.sourceHealth?.values() ?? [])].flatMap((health) => sourceIssue(health, mergedTargetIssues.get(health.sourceId) ?? []) ?? []),
1631
+ ];
1632
+ const stableIssueDrafts = collapseRootIssues(issueDrafts).sort((left, right) => issueGroupOrder[issueGroup(left)] - issueGroupOrder[issueGroup(right)]
1633
+ || issueReasonPriority(left) - issueReasonPriority(right)
1634
+ || compareText(primaryAttentionCode(left), primaryAttentionCode(right))
1635
+ || compareText(left.issueId, right.issueId));
1636
+ const issues = stableIssueDrafts.map((issue) => ({
693
1637
  ...issue,
1638
+ group: issueGroup(issue),
694
1639
  diagnostic: issueDiagnostic(issue, sourceDetails),
695
1640
  }));
1641
+ const pluginsWithAttention = plugins.map((plugin) => {
1642
+ const primary = stableIssueDrafts.filter((issue) => issue.pluginId === plugin.pluginId
1643
+ || issue.dependencyPluginId === plugin.pluginId
1644
+ || issue.affectedTargets?.some((target) => target.pluginId === plugin.pluginId)
1645
+ || issue.entity.kind === 'source' && issue.sourceId === plugin.sourceId)
1646
+ .sort((left, right) => issueReasonPriority(left) - issueReasonPriority(right)
1647
+ || compareText(primaryAttentionCode(left), primaryAttentionCode(right))
1648
+ || compareText(left.issueId, right.issueId))[0];
1649
+ if (!primary)
1650
+ return plugin;
1651
+ return {
1652
+ ...plugin,
1653
+ primaryAttention: {
1654
+ severity: primary.category === 'configLayerUnsupported' ? 'warning' : 'error',
1655
+ code: primaryAttentionCode(primary),
1656
+ message: primary.explanation,
1657
+ },
1658
+ };
1659
+ });
696
1660
  return {
697
- plugins,
1661
+ plugins: pluginsWithAttention,
698
1662
  sourceTabs,
699
- sourceDetails: (options.sourceDetails ?? []).map((detail) => ({
700
- ...detail,
701
- pluginCount: plugins.filter((plugin) => plugin.sourceId === detail.id).length,
702
- })),
1663
+ sourceDetails: (options.sourceDetails ?? []).map((detail) => {
1664
+ const count = sourceTabs.find((source) => source.id === detail.id)?.count;
1665
+ return { ...detail, ...(count === undefined ? {} : { pluginCount: count }) };
1666
+ }),
703
1667
  issues,
704
1668
  dependencyOverviews: options.dependencyOverviews ?? [],
1669
+ contentOverviews: options.contentOverviews ?? {},
705
1670
  home: {
706
- availablePlugins: plugins.filter((plugin) => plugin.aggregateStatus === 'available').length,
707
- installedPlugins: plugins.filter(hasInstalledPlacement).length,
1671
+ availablePlugins: pluginsWithAttention.filter((plugin) => plugin.aggregateStatus === 'available').length,
1672
+ installedPlugins: new Set(pluginsWithAttention
1673
+ .filter(hasInstalledPlacement)
1674
+ .map((plugin) => plugin.pluginId)).size,
708
1675
  issueCount: issues.length,
709
1676
  sourceCount: sourceTabs.length,
710
- cachedSourceCount: sourceTabs.filter((source) => source.state === 'cache').length,
711
- unavailableSourceCount: sourceTabs.filter((source) => source.state === 'error').length,
1677
+ unavailableSourceCount: options.status.catalog.sources.filter((source) => source.error
1678
+ || options.sourceHealth?.get(source.id)?.state === 'unavailable').length,
1679
+ catalogUpdateCount: sourceTabs.filter((source) => source.state === 'update').length,
1680
+ catalogRecoveryCount: sourceTabs.filter((source) => source.state === 'recovery'
1681
+ || source.state === 'error').length,
1682
+ catalogCheckingCount: sourceTabs.filter((source) => source.state === 'checking').length,
1683
+ pluginUpdateCount: pluginsWithAttention.filter((plugin) => plugin.update.state === 'available').length,
1684
+ directPluginUpdateCount: pluginsWithAttention.filter((plugin) => plugin.update.targets.some((target) => target.availableVersion !== undefined && target.requiresCatalogActivation !== true
1685
+ && target.eligibility === 'allowed')).length,
712
1686
  },
713
1687
  };
714
1688
  }
715
1689
  function displayConfigValue(options) {
716
- if (!options.configured)
717
- return options.inherited ? '继承' : '未设置';
718
- if (options.privateValue)
719
- return '已设置';
720
- if (typeof options.value === 'string')
721
- return options.value;
722
- if (options.value === undefined || options.value === null)
723
- return '已设置';
724
- return String(options.value);
1690
+ return presentConfigValue({
1691
+ definition: options.field,
1692
+ summary: options.summary,
1693
+ itemSummary: options.itemSummary,
1694
+ value: options.value,
1695
+ configured: options.configured,
1696
+ privateValue: options.privateValue,
1697
+ }).text;
725
1698
  }
726
1699
  function configSourceLabel(source) {
727
1700
  if (!source)
728
1701
  return '未设置';
729
1702
  return {
730
1703
  default: '默认值',
731
- user: '个人默认',
732
- project: '当前项目',
733
- local: '当前项目(仅本机)',
1704
+ common: '公共配置',
1705
+ platform: '平台配置',
734
1706
  }[source];
735
1707
  }
1708
+ function configEditorDefinition(field) {
1709
+ const definition = structuredClone(field);
1710
+ delete definition.default;
1711
+ if (definition.sensitive === true)
1712
+ delete definition.choices;
1713
+ return definition;
1714
+ }
1715
+ function configObjectChildChanges(field, before, after) {
1716
+ const properties = { ...resolvePluginConfigObjectProperties(field, before).properties,
1717
+ ...resolvePluginConfigObjectProperties(field, after ?? {}).properties };
1718
+ const fixed = Object.keys(properties);
1719
+ const summary = (property, value, object) => {
1720
+ if (value === undefined)
1721
+ return '未设置';
1722
+ const definition = resolvePluginConfigObjectProperties(field, object).properties[property]
1723
+ ?? (field.additionalProperties === false ? undefined : field.additionalProperties);
1724
+ if (field.sensitive || definition?.sensitive)
1725
+ return '已设置';
1726
+ return definition ? presentConfigValue({ definition, value, full: true }).text : safeConfigText(JSON.stringify(value));
1727
+ };
1728
+ return [...new Set([...Object.keys(before), ...Object.keys(after ?? {})])]
1729
+ .sort((left, right) => {
1730
+ const leftIndex = fixed.indexOf(left);
1731
+ const rightIndex = fixed.indexOf(right);
1732
+ if (leftIndex >= 0 || rightIndex >= 0) {
1733
+ if (leftIndex < 0)
1734
+ return 1;
1735
+ if (rightIndex < 0)
1736
+ return -1;
1737
+ return leftIndex - rightIndex;
1738
+ }
1739
+ return left.localeCompare(right, 'en');
1740
+ })
1741
+ .filter((property) => !configValuesEqual(before[property], after?.[property]))
1742
+ .map((property) => {
1743
+ const definition = properties[property]
1744
+ ?? (field.additionalProperties === false ? undefined : field.additionalProperties);
1745
+ return {
1746
+ property,
1747
+ before: summary(property, before[property], before),
1748
+ after: summary(property, after?.[property], after ?? {}),
1749
+ ...(field.sensitive || definition?.sensitive ? { private: true } : {}),
1750
+ };
1751
+ });
1752
+ }
736
1753
  export function buildConfigGroups(options) {
737
1754
  const entryByKey = new Map(options.read.fields.map((field) => [field.key, field]));
738
1755
  const effectiveEntryByKey = new Map((options.effectiveRead ?? options.read).fields.map((field) => [field.key, field]));
739
1756
  const effectivePage = options.read.scope === 'effective';
1757
+ const selectedSource = options.read.platform ? 'platform' : 'common';
740
1758
  const fieldModel = (key) => {
741
- const schema = options.schema.schema[key];
1759
+ const schema = options.schema.fields[key];
742
1760
  const entry = entryByKey.get(key);
743
1761
  const effectiveEntry = effectiveEntryByKey.get(key);
744
- const presentation = options.schema.presentation?.fields?.[key];
745
1762
  const inherited = effectivePage
746
1763
  ? false
747
1764
  : entry?.storedSourceLayer === undefined;
@@ -752,59 +1769,162 @@ export function buildConfigGroups(options) {
752
1769
  && entry.effectiveValue !== null
753
1770
  && (entry.valueState === 'configured' || entry.valueState === 'default')
754
1771
  : entry?.storedSourceLayer !== undefined;
755
- const privateValue = schema.sensitive === true || schema.type === 'file' || schema.type === 'directory';
1772
+ const presentation = options.schema.presentation;
1773
+ const fieldView = presentation && 'fieldViews' in presentation ? presentation.fieldViews?.[key] : undefined;
1774
+ const summaries = presentation && 'summaries' in presentation ? presentation.summaries : undefined;
1775
+ const summary = fieldView?.summary ? summaries?.[fieldView.summary] : undefined;
1776
+ const itemSummary = fieldView?.itemSummary ? summaries?.[fieldView.itemSummary] : undefined;
1777
+ const privateValue = schema.sensitive === true || configObjectHasSensitiveChild(schema);
1778
+ const choices = schema.choices;
756
1779
  const selectedValue = effectivePage ? entry?.effectiveValue : entry?.storedValue;
1780
+ const selectedRawValue = effectivePage
1781
+ ? options.effectiveRawValues?.[key]
1782
+ : options.rawValues?.[key];
757
1783
  const selectedStoredInvalid = !effectivePage
758
1784
  && entry?.storedSourceLayer !== undefined
759
1785
  && entry.storedValue === undefined;
1786
+ const invalidOverrideSourceCandidate = selectedStoredInvalid
1787
+ ? selectedSource
1788
+ : entry?.invalidOverride?.sourceLayer;
1789
+ const invalidOverrideSource = invalidOverrideSourceCandidate === 'common'
1790
+ || invalidOverrideSourceCandidate === 'platform'
1791
+ ? invalidOverrideSourceCandidate
1792
+ : undefined;
1793
+ const invalidOverride = invalidOverrideSource !== undefined;
1794
+ const invalidOverrideOwnedByLayer = !effectivePage
1795
+ && invalidOverrideSource === selectedSource;
760
1796
  const effectiveConfigured = effectiveEntry?.sourceLayer !== undefined
761
1797
  && effectiveEntry.sourceLayer !== null
762
1798
  && effectiveEntry.effectiveValue !== undefined
763
1799
  && effectiveEntry.effectiveValue !== null
764
1800
  && (effectiveEntry.valueState === 'configured' || effectiveEntry.valueState === 'default');
1801
+ const commonEntry = options.read.platform
1802
+ ? options.layerReads?.common?.fields.find((field) => field.key === key)
1803
+ : undefined;
1804
+ const fallback = commonEntry?.storedSourceLayer !== undefined
1805
+ ? { layer: 'common', entry: commonEntry }
1806
+ : undefined;
1807
+ const projectedFallback = entry?.fallback;
1808
+ const fallbackInvalid = projectedFallback?.state === 'invalid';
1809
+ const fallbackValue = projectedFallback?.state === 'valid'
1810
+ ? projectedFallback.effectiveValue
1811
+ : projectedFallback
1812
+ ? undefined
1813
+ : fallback?.entry?.storedValue ?? schema.default;
1814
+ const fallbackRawValue = projectedFallback?.state === 'valid'
1815
+ ? projectedFallback.sourceLayer === 'common'
1816
+ ? options.rawLayerValues?.common?.[key] ?? fallbackValue
1817
+ : fallbackValue
1818
+ : projectedFallback
1819
+ ? undefined
1820
+ : fallback
1821
+ ? options.rawLayerValues?.[fallback.layer]?.[key] ?? fallbackValue
1822
+ : schema.default;
1823
+ const fallbackConfigured = projectedFallback
1824
+ ? projectedFallback.state !== 'missing'
1825
+ : fallback !== undefined || schema.default !== undefined;
1826
+ const fallbackSource = projectedFallback?.state === 'valid'
1827
+ || projectedFallback?.state === 'invalid'
1828
+ ? projectedFallback.sourceLayer
1829
+ : projectedFallback
1830
+ ? undefined
1831
+ : fallback?.layer ?? (schema.default !== undefined ? 'default' : undefined);
765
1832
  return {
766
1833
  key,
767
1834
  title: schema.title ?? key,
768
1835
  ...(schema.description ? { description: schema.description } : {}),
769
1836
  type: schema.type,
770
- displayValue: selectedStoredInvalid ? '值无效' : displayConfigValue({
1837
+ definition: configEditorDefinition(schema),
1838
+ ...(summary ? { summary } : {}),
1839
+ ...(itemSummary ? { itemSummary } : {}),
1840
+ displayValue: selectedStoredInvalid ? '需修正' : displayConfigValue({
1841
+ field: schema,
1842
+ summary,
1843
+ itemSummary,
771
1844
  privateValue,
772
1845
  inherited,
773
1846
  configured,
774
- value: selectedValue,
1847
+ value: schema.type === 'object' ? selectedRawValue ?? selectedValue : selectedValue,
775
1848
  }),
776
1849
  required: schema.required === true,
777
1850
  sensitive: schema.sensitive === true,
1851
+ writable: entry?.writable ?? effectivePage,
1852
+ canSet: entry?.canSet ?? effectivePage,
1853
+ canUnset: entry?.canUnset ?? false,
778
1854
  dirty: options.dirtyKeys?.has(key) === true,
779
1855
  inherited,
780
1856
  configured,
781
1857
  sourceLabel: effectivePage
782
1858
  ? configSourceLabel(entry?.sourceLayer ?? null)
783
1859
  : configured ? '本层已设置' : '继承',
784
- effectiveDisplayValue: displayConfigValue({
1860
+ effectiveDisplayValue: effectiveEntry?.invalidOverride ? '需修正' : displayConfigValue({
1861
+ field: schema,
1862
+ summary,
1863
+ itemSummary,
785
1864
  privateValue,
786
1865
  inherited: false,
787
1866
  configured: effectiveConfigured,
788
- value: effectiveEntry?.effectiveValue,
1867
+ value: schema.type === 'object'
1868
+ ? options.effectiveRawValues?.[key] ?? effectiveEntry?.effectiveValue
1869
+ : effectiveEntry?.effectiveValue,
789
1870
  }),
790
1871
  effectiveSourceLabel: configSourceLabel(effectiveEntry?.sourceLayer ?? null),
1872
+ ...(invalidOverride ? {
1873
+ invalidOverrideOwnedByLayer,
1874
+ invalidOverrideIssue: invalidOverrideOwnedByLayer
1875
+ ? schema.type === 'object'
1876
+ ? `字段“${schema.title ?? key}”在本层的对象值无效。请修改或删除此字段。`
1877
+ : `字段“${schema.title ?? key}”在本层的值无效。请修改或删除此字段。`
1878
+ : `字段“${schema.title ?? key}”在${configSourceLabel(invalidOverrideSource ?? null)}中的值无效。请切换到该设置层修改或删除此字段。`,
1879
+ } : {}),
1880
+ ...(!effectivePage && configured ? {
1881
+ fallbackDisplayValue: fallbackInvalid
1882
+ ? '值无效;保存可成功,但应用会被阻止'
1883
+ : displayConfigValue({
1884
+ field: schema,
1885
+ summary,
1886
+ itemSummary,
1887
+ privateValue,
1888
+ inherited: false,
1889
+ configured: fallbackConfigured,
1890
+ value: schema.type === 'object' ? fallbackRawValue : fallbackValue,
1891
+ }),
1892
+ fallbackSourceLabel: fallbackSource ? configSourceLabel(fallbackSource) : '未设置',
1893
+ ...(!fallbackInvalid && schema.type === 'object'
1894
+ && typeof (selectedRawValue ?? selectedValue) === 'object'
1895
+ && (selectedRawValue ?? selectedValue) !== null
1896
+ ? { fallbackObjectChanges: configObjectChildChanges(schema, (selectedRawValue ?? selectedValue), typeof fallbackRawValue === 'object' && fallbackRawValue !== null
1897
+ ? fallbackRawValue
1898
+ : undefined) }
1899
+ : {}),
1900
+ } : {}),
791
1901
  ...(!privateValue && selectedValue !== undefined
792
1902
  ? { value: selectedValue }
793
1903
  : {}),
794
1904
  ...(!privateValue && effectiveEntry?.effectiveValue !== undefined && effectiveEntry.effectiveValue !== null
795
1905
  ? { effectiveValue: effectiveEntry.effectiveValue }
796
1906
  : {}),
1907
+ ...(!privateValue && (effectivePage
1908
+ ? options.effectiveRawValues?.[key]
1909
+ : selectedRawValue ?? ((schema.type === 'object' || schema.type === 'array') && !configured
1910
+ ? options.effectiveRawValues?.[key]
1911
+ : undefined)) !== undefined
1912
+ ? { draftValue: (effectivePage
1913
+ ? options.effectiveRawValues?.[key]
1914
+ : selectedRawValue ?? options.effectiveRawValues?.[key]) }
1915
+ : {}),
797
1916
  ...(!privateValue && schema.default !== undefined ? { defaultValue: schema.default } : {}),
798
- ...(schema.values ? { enumValues: [...schema.values] } : {}),
799
- ...(presentation?.valueLabels ? { valueLabels: { ...presentation.valueLabels } } : {}),
800
- ...(presentation?.recommendedValue !== undefined
801
- ? { recommendedValue: presentation.recommendedValue }
1917
+ ...(!privateValue && choices ? { choices: choices.presets } : {}),
1918
+ allowCustom: choices?.allowCustom ?? true,
1919
+ ...(!privateValue && !configObjectHasSensitiveChild(schema)
1920
+ && (selectedRawValue ?? selectedValue) !== undefined && (selectedRawValue ?? selectedValue) !== null
1921
+ && matchPluginConfigPreset(schema, (selectedRawValue ?? selectedValue))
1922
+ ? { matchedPresetId: matchPluginConfigPreset(schema, (selectedRawValue ?? selectedValue)).id }
802
1923
  : {}),
803
- ...(presentation?.placeholder ? { placeholder: presentation.placeholder } : {}),
804
- ...(presentation?.unit ? { unit: presentation.unit } : {}),
805
- ...(schema.min !== undefined ? { min: schema.min } : {}),
806
- ...(schema.max !== undefined ? { max: schema.max } : {}),
807
- advanced: presentation?.advanced === true,
1924
+ ...(schema.type === 'number' && schema.validation?.minimum !== undefined ? { min: schema.validation.minimum } : {}),
1925
+ ...(schema.type === 'number' && schema.validation?.maximum !== undefined ? { max: schema.validation.maximum } : {}),
1926
+ advanced: false,
1927
+ sharedNativeRender: options.sharedNativeRefreshKeys?.has(key) === true,
808
1928
  };
809
1929
  };
810
1930
  const assigned = new Set();
@@ -828,18 +1948,20 @@ export function buildConfigGroups(options) {
828
1948
  }
829
1949
  return id;
830
1950
  };
831
- const remaining = Object.keys(options.schema.schema).filter((key) => !assigned.has(key));
1951
+ const remaining = Object.keys(options.schema.fields)
1952
+ .filter((key) => !assigned.has(key));
832
1953
  if (!options.schema.presentation) {
833
1954
  groups.push({
834
1955
  id: 'general',
835
1956
  title: '插件设置',
836
1957
  advanced: false,
837
- fields: Object.keys(options.schema.schema).map(fieldModel),
1958
+ fields: Object.keys(options.schema.fields)
1959
+ .map(fieldModel),
838
1960
  });
839
1961
  }
840
1962
  else {
841
- const ordinary = remaining.filter((key) => options.schema.presentation?.fields?.[key]?.advanced !== true);
842
- const advanced = remaining.filter((key) => options.schema.presentation?.fields?.[key]?.advanced === true);
1963
+ const ordinary = remaining;
1964
+ const advanced = [];
843
1965
  if (ordinary.length > 0) {
844
1966
  groups.push({
845
1967
  id: syntheticGroupId('general'),
@@ -860,28 +1982,19 @@ export function buildConfigGroups(options) {
860
1982
  return groups;
861
1983
  }
862
1984
  export function buildConfigPage(options) {
863
- const privateFields = new Set(Object.entries(options.schema.schema)
864
- .filter(([, field]) => field.sensitive === true || field.type === 'file' || field.type === 'directory')
865
- .map(([key]) => key));
866
- const presets = (options.schema.presentation?.presets ?? []).map((preset) => {
867
- const privateFieldTitles = Object.keys(preset.values)
868
- .filter((key) => privateFields.has(key))
869
- .map((key) => options.schema.schema[key]?.title ?? key);
870
- return {
871
- id: preset.id,
872
- title: preset.title,
873
- ...(preset.description ? { description: preset.description } : {}),
874
- values: Object.fromEntries(Object.entries(preset.values)
875
- .filter(([key]) => !privateFields.has(key))),
876
- ...(privateFieldTitles.length > 0 ? { privateFieldTitles } : {}),
877
- };
878
- });
879
1985
  return {
880
1986
  pluginId: options.pluginId,
881
- layer: { scope: options.read.scope, projectLayer: options.read.projectLayer },
1987
+ profile: options.read.platform ?? 'common',
1988
+ context: options.context ?? 'user',
1989
+ layer: { profile: options.read.platform ?? 'common', context: options.context ?? 'user',
1990
+ view: options.read.scope === 'effective' ? 'effective' : 'stored' },
882
1991
  groups: buildConfigGroups(options),
883
- presets,
1992
+ presets: [],
884
1993
  storedCount: options.read.fields.filter((field) => field.storedSourceLayer !== undefined).length,
885
1994
  };
886
1995
  }
1996
+ export function configValuesEqual(left, right) {
1997
+ return left !== undefined && right !== undefined
1998
+ && stablePluginConfigStringify(left) === stablePluginConfigStringify(right);
1999
+ }
887
2000
  //# sourceMappingURL=model.js.map