@lesliechan721/aw 0.1.0-beta.9 → 0.1.0-beta.91

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 (829) hide show
  1. package/dist/authoring/assets/aw-config.mjs +100 -501
  2. package/dist/authoring/assets/aw-config.mjs.map +1 -1
  3. package/dist/authoring/assets/aw-runtime-config.d.mts +13 -0
  4. package/dist/authoring/assets/aw-runtime-config.mjs +221 -0
  5. package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
  6. package/dist/authoring/assets/command-runtime-config.d.mts +9 -0
  7. package/dist/authoring/assets/command-runtime-config.mjs +134 -0
  8. package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
  9. package/dist/authoring/scripts/add-skill.mjs +15 -38
  10. package/dist/authoring/scripts/add-skill.mjs.map +1 -1
  11. package/dist/authoring/scripts/init-plugin.mjs +72 -96
  12. package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
  13. package/dist/authoring/scripts/lib/plugin-root.mjs +4 -4
  14. package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
  15. package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
  16. package/dist/authoring/scripts/lib/plugin-version-check.mjs +230 -9
  17. package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
  18. package/dist/authoring/scripts/lib/skill-scaffold.d.mts +2 -2
  19. package/dist/authoring/scripts/lib/skill-scaffold.mjs +4 -7
  20. package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
  21. package/dist/authoring/scripts/remove-plugin.mjs +1 -1
  22. package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
  23. package/dist/authoring/scripts/validate-plugin.mjs +416 -1995
  24. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  25. package/dist/authoring/scripts/validate-skill.mjs +1 -1
  26. package/dist/index.js +2 -6
  27. package/dist/index.js.map +1 -1
  28. package/dist/native-runtime/reader-runtime.mjs +34 -0
  29. package/dist/native-runtime/reader.d.mts +6 -0
  30. package/dist/native-runtime/reader.mjs +11 -0
  31. package/dist/scripts/aw-skill-eval-materializer.d.ts +11 -1
  32. package/dist/scripts/aw-skill-eval-materializer.js +118 -115
  33. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
  34. package/dist/scripts/bundle-plugins.js +25 -7
  35. package/dist/scripts/bundle-plugins.js.map +1 -1
  36. package/dist/scripts/plugin-staging.d.ts +7 -7
  37. package/dist/scripts/plugin-staging.js +10 -8
  38. package/dist/scripts/plugin-staging.js.map +1 -1
  39. package/dist/scripts/plugin-test-reporter.d.mts +2 -0
  40. package/dist/scripts/plugin-test-reporter.mjs +21 -0
  41. package/dist/scripts/plugin-test-reporter.mjs.map +1 -0
  42. package/dist/scripts/test-plugin-scripts.d.ts +5 -0
  43. package/dist/scripts/test-plugin-scripts.js +284 -78
  44. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  45. package/dist/scripts/test-workers.d.mts +24 -0
  46. package/dist/scripts/test-workers.mjs +59 -0
  47. package/dist/scripts/test-workers.mjs.map +1 -0
  48. package/dist/src/adapters/helpers.d.ts +7 -0
  49. package/dist/src/adapters/helpers.js.map +1 -1
  50. package/dist/src/authoring/workspace-commands.d.ts +3 -0
  51. package/dist/src/authoring/workspace-commands.js +7 -2
  52. package/dist/src/authoring/workspace-commands.js.map +1 -1
  53. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  54. package/dist/src/commands/aw-capabilities.js +42 -21
  55. package/dist/src/commands/aw-capabilities.js.map +1 -1
  56. package/dist/src/commands/catalog-dev-source.d.ts +42 -3
  57. package/dist/src/commands/catalog-dev-source.js +351 -43
  58. package/dist/src/commands/catalog-dev-source.js.map +1 -1
  59. package/dist/src/commands/catalog-generation.d.ts +8 -0
  60. package/dist/src/commands/catalog-generation.js +1 -5
  61. package/dist/src/commands/catalog-generation.js.map +1 -1
  62. package/dist/src/commands/catalog-publication-inspection.d.ts +42 -3
  63. package/dist/src/commands/catalog-publication-inspection.js +379 -48
  64. package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
  65. package/dist/src/commands/catalog-publication-journal.d.ts +23 -4
  66. package/dist/src/commands/catalog-publication-journal.js +165 -20
  67. package/dist/src/commands/catalog-publication-journal.js.map +1 -1
  68. package/dist/src/commands/catalog-publish.d.ts +34 -3
  69. package/dist/src/commands/catalog-publish.js +311 -165
  70. package/dist/src/commands/catalog-publish.js.map +1 -1
  71. package/dist/src/commands/catalog-source.d.ts +54 -8
  72. package/dist/src/commands/catalog-source.js +277 -15
  73. package/dist/src/commands/catalog-source.js.map +1 -1
  74. package/dist/src/commands/catalog-status.js +2 -2
  75. package/dist/src/commands/catalog-status.js.map +1 -1
  76. package/dist/src/commands/catalog-store.d.ts +104 -0
  77. package/dist/src/commands/catalog-store.js +685 -0
  78. package/dist/src/commands/catalog-store.js.map +1 -0
  79. package/dist/src/commands/catalog-workspace-resolution.d.ts +4 -0
  80. package/dist/src/commands/catalog-workspace-resolution.js +18 -3
  81. package/dist/src/commands/catalog-workspace-resolution.js.map +1 -1
  82. package/dist/src/commands/console.js +33 -20
  83. package/dist/src/commands/console.js.map +1 -1
  84. package/dist/src/commands/dependency-operation-plan.d.ts +14 -56
  85. package/dist/src/commands/dependency-operation-plan.js +90 -133
  86. package/dist/src/commands/dependency-operation-plan.js.map +1 -1
  87. package/dist/src/commands/deployment-confirmation.d.ts +11 -0
  88. package/dist/src/commands/deployment-confirmation.js +88 -0
  89. package/dist/src/commands/deployment-confirmation.js.map +1 -0
  90. package/dist/src/commands/init.js +1 -1
  91. package/dist/src/commands/init.js.map +1 -1
  92. package/dist/src/commands/intent-command.d.ts +34 -0
  93. package/dist/src/commands/intent-command.js +174 -0
  94. package/dist/src/commands/intent-command.js.map +1 -0
  95. package/dist/src/commands/lifecycle-command-package.d.ts +45 -0
  96. package/dist/src/commands/lifecycle-command-package.js +199 -0
  97. package/dist/src/commands/lifecycle-command-package.js.map +1 -0
  98. package/dist/src/commands/managed-commands.d.ts +41 -0
  99. package/dist/src/commands/managed-commands.js +404 -0
  100. package/dist/src/commands/managed-commands.js.map +1 -0
  101. package/dist/src/commands/offline-cleanup-evidence.d.ts +29 -3
  102. package/dist/src/commands/offline-cleanup-evidence.js +80 -10
  103. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
  104. package/dist/src/commands/operation-plan.d.ts +191 -0
  105. package/dist/src/commands/operation-plan.js +96 -0
  106. package/dist/src/commands/operation-plan.js.map +1 -0
  107. package/dist/src/commands/operation-planner.d.ts +47 -0
  108. package/dist/src/commands/operation-planner.js +142 -0
  109. package/dist/src/commands/operation-planner.js.map +1 -0
  110. package/dist/src/commands/options.d.ts +11 -20
  111. package/dist/src/commands/options.js +31 -36
  112. package/dist/src/commands/options.js.map +1 -1
  113. package/dist/src/commands/permission-batch.d.ts +5 -0
  114. package/dist/src/commands/permission-batch.js +80 -0
  115. package/dist/src/commands/permission-batch.js.map +1 -0
  116. package/dist/src/commands/plugin-capabilities.js +96 -46
  117. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  118. package/dist/src/commands/public-config-confirmation.d.ts +14 -0
  119. package/dist/src/commands/public-config-confirmation.js +73 -0
  120. package/dist/src/commands/public-config-confirmation.js.map +1 -0
  121. package/dist/src/commands/public-interruption.d.ts +9 -0
  122. package/dist/src/commands/public-interruption.js +23 -0
  123. package/dist/src/commands/public-interruption.js.map +1 -0
  124. package/dist/src/commands/public-lifecycle-result.d.ts +106 -0
  125. package/dist/src/commands/public-lifecycle-result.js +518 -0
  126. package/dist/src/commands/public-lifecycle-result.js.map +1 -0
  127. package/dist/src/commands/public-lifecycle.d.ts +27 -0
  128. package/dist/src/commands/public-lifecycle.js +563 -0
  129. package/dist/src/commands/public-lifecycle.js.map +1 -0
  130. package/dist/src/commands/public-plugin-query.d.ts +16 -0
  131. package/dist/src/commands/public-plugin-query.js +230 -0
  132. package/dist/src/commands/public-plugin-query.js.map +1 -0
  133. package/dist/src/commands/rebuild-command.d.ts +176 -25
  134. package/dist/src/commands/rebuild-command.js +3989 -1392
  135. package/dist/src/commands/rebuild-command.js.map +1 -1
  136. package/dist/src/commands/rebuild-integration.d.ts +133 -52
  137. package/dist/src/commands/rebuild-integration.js +1097 -2692
  138. package/dist/src/commands/rebuild-integration.js.map +1 -1
  139. package/dist/src/commands/rebuild-operations.d.ts +74 -23
  140. package/dist/src/commands/rebuild-operations.js +334 -227
  141. package/dist/src/commands/rebuild-operations.js.map +1 -1
  142. package/dist/src/commands/rebuild-platform-integration.d.ts +81 -0
  143. package/dist/src/commands/rebuild-platform-integration.js +1992 -0
  144. package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
  145. package/dist/src/commands/reconcile-operation-plan.d.ts +31 -0
  146. package/dist/src/commands/reconcile-operation-plan.js +48 -0
  147. package/dist/src/commands/reconcile-operation-plan.js.map +1 -0
  148. package/dist/src/commands/review-inspection.d.ts +60 -0
  149. package/dist/src/commands/review-inspection.js +436 -0
  150. package/dist/src/commands/review-inspection.js.map +1 -0
  151. package/dist/src/commands/review-preparation.d.ts +51 -0
  152. package/dist/src/commands/review-preparation.js +400 -0
  153. package/dist/src/commands/review-preparation.js.map +1 -0
  154. package/dist/src/commands/runtime.d.ts +6 -6
  155. package/dist/src/commands/runtime.js +44 -24
  156. package/dist/src/commands/runtime.js.map +1 -1
  157. package/dist/src/commands/skill-eval.d.ts +8 -0
  158. package/dist/src/commands/skill-eval.js +126 -73
  159. package/dist/src/commands/skill-eval.js.map +1 -1
  160. package/dist/src/commands/status-v6.d.ts +185 -68
  161. package/dist/src/commands/status-v6.js +1592 -499
  162. package/dist/src/commands/status-v6.js.map +1 -1
  163. package/dist/src/commands/targets-command.d.ts +38 -0
  164. package/dist/src/commands/targets-command.js +182 -0
  165. package/dist/src/commands/targets-command.js.map +1 -0
  166. package/dist/src/commands/wizard.d.ts +8 -5
  167. package/dist/src/commands/wizard.js +7 -4
  168. package/dist/src/commands/wizard.js.map +1 -1
  169. package/dist/src/commands/write-commands.d.ts +9 -3
  170. package/dist/src/commands/write-commands.js +144 -44
  171. package/dist/src/commands/write-commands.js.map +1 -1
  172. package/dist/src/constants.d.ts +2 -3
  173. package/dist/src/constants.js +2 -3
  174. package/dist/src/constants.js.map +1 -1
  175. package/dist/src/eval/manifest-v1.d.ts +6 -2
  176. package/dist/src/eval/manifest-v1.js +58 -26
  177. package/dist/src/eval/manifest-v1.js.map +1 -1
  178. package/dist/src/generators/local-plugin.d.ts +4 -2
  179. package/dist/src/generators/local-plugin.js +207 -346
  180. package/dist/src/generators/local-plugin.js.map +1 -1
  181. package/dist/src/generators/permissions.d.ts +20 -2
  182. package/dist/src/generators/permissions.js +82 -15
  183. package/dist/src/generators/permissions.js.map +1 -1
  184. package/dist/src/index.d.ts +3 -33
  185. package/dist/src/index.js +1786 -1945
  186. package/dist/src/index.js.map +1 -1
  187. package/dist/src/intent/deployment-preferences.d.ts +63 -0
  188. package/dist/src/intent/deployment-preferences.js +170 -0
  189. package/dist/src/intent/deployment-preferences.js.map +1 -0
  190. package/dist/src/intent/diagnostics.d.ts +11 -0
  191. package/dist/src/intent/diagnostics.js +14 -0
  192. package/dist/src/intent/diagnostics.js.map +1 -0
  193. package/dist/src/intent/intent-codec.d.ts +19 -0
  194. package/dist/src/intent/intent-codec.js +117 -0
  195. package/dist/src/intent/intent-codec.js.map +1 -0
  196. package/dist/src/intent/intent-store.d.ts +43 -0
  197. package/dist/src/intent/intent-store.js +118 -0
  198. package/dist/src/intent/intent-store.js.map +1 -0
  199. package/dist/src/intent/scope-context.d.ts +35 -0
  200. package/dist/src/intent/scope-context.js +179 -0
  201. package/dist/src/intent/scope-context.js.map +1 -0
  202. package/dist/src/intent/work-context.d.ts +13 -0
  203. package/dist/src/intent/work-context.js +22 -0
  204. package/dist/src/intent/work-context.js.map +1 -0
  205. package/dist/src/output/command-receipt.d.ts +37 -86
  206. package/dist/src/output/command-receipt.js +257 -179
  207. package/dist/src/output/command-receipt.js.map +1 -1
  208. package/dist/src/output/component-delivery.d.ts +28 -0
  209. package/dist/src/output/component-delivery.js +138 -0
  210. package/dist/src/output/component-delivery.js.map +1 -0
  211. package/dist/src/output/public-result.d.ts +69 -0
  212. package/dist/src/output/public-result.js +403 -0
  213. package/dist/src/output/public-result.js.map +1 -0
  214. package/dist/src/output/rebuild-progress.d.ts +3 -0
  215. package/dist/src/output/rebuild-progress.js +34 -16
  216. package/dist/src/output/rebuild-progress.js.map +1 -1
  217. package/dist/src/output/receipt-projection.d.ts +7 -0
  218. package/dist/src/output/receipt-projection.js +664 -0
  219. package/dist/src/output/receipt-projection.js.map +1 -0
  220. package/dist/src/output/skill-invocation-notices.d.ts +18 -0
  221. package/dist/src/output/skill-invocation-notices.js +84 -0
  222. package/dist/src/output/skill-invocation-notices.js.map +1 -0
  223. package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
  224. package/dist/src/platforms/antigravity-permissions.js +388 -0
  225. package/dist/src/platforms/antigravity-permissions.js.map +1 -0
  226. package/dist/src/platforms/capabilities.d.ts +17 -0
  227. package/dist/src/platforms/capabilities.js +328 -0
  228. package/dist/src/platforms/capabilities.js.map +1 -0
  229. package/dist/src/platforms/contracts.d.ts +402 -0
  230. package/dist/src/platforms/contracts.js +2 -0
  231. package/dist/src/platforms/contracts.js.map +1 -0
  232. package/dist/src/platforms/cursor-workspace-hook.d.ts +28 -0
  233. package/dist/src/platforms/cursor-workspace-hook.js +198 -0
  234. package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
  235. package/dist/src/platforms/discovery.d.ts +98 -0
  236. package/dist/src/platforms/discovery.js +777 -0
  237. package/dist/src/platforms/discovery.js.map +1 -0
  238. package/dist/src/platforms/grok-permission-config.d.ts +23 -0
  239. package/dist/src/platforms/grok-permission-config.js +184 -0
  240. package/dist/src/platforms/grok-permission-config.js.map +1 -0
  241. package/dist/src/platforms/grok-permission-document.d.ts +4 -0
  242. package/dist/src/platforms/grok-permission-document.js +145 -0
  243. package/dist/src/platforms/grok-permission-document.js.map +1 -0
  244. package/dist/src/platforms/grok-permissions.d.ts +17 -0
  245. package/dist/src/platforms/grok-permissions.js +311 -0
  246. package/dist/src/platforms/grok-permissions.js.map +1 -0
  247. package/dist/src/platforms/host-permission-policy.d.ts +38 -0
  248. package/dist/src/platforms/host-permission-policy.js +86 -0
  249. package/dist/src/platforms/host-permission-policy.js.map +1 -0
  250. package/dist/src/platforms/identity.d.ts +4 -0
  251. package/dist/src/platforms/identity.js +22 -0
  252. package/dist/src/platforms/identity.js.map +1 -0
  253. package/dist/src/platforms/inspection-grok.d.ts +4 -0
  254. package/dist/src/platforms/inspection-grok.js +366 -0
  255. package/dist/src/platforms/inspection-grok.js.map +1 -0
  256. package/dist/src/platforms/inspection-native.d.ts +6 -0
  257. package/dist/src/platforms/inspection-native.js +373 -0
  258. package/dist/src/platforms/inspection-native.js.map +1 -0
  259. package/dist/src/platforms/inspection-opencode.d.ts +4 -0
  260. package/dist/src/platforms/inspection-opencode.js +98 -0
  261. package/dist/src/platforms/inspection-opencode.js.map +1 -0
  262. package/dist/src/platforms/inspection-pi.d.ts +9 -0
  263. package/dist/src/platforms/inspection-pi.js +482 -0
  264. package/dist/src/platforms/inspection-pi.js.map +1 -0
  265. package/dist/src/platforms/inspection-query.d.ts +24 -0
  266. package/dist/src/platforms/inspection-query.js +119 -0
  267. package/dist/src/platforms/inspection-query.js.map +1 -0
  268. package/dist/src/platforms/inspection.d.ts +20 -0
  269. package/dist/src/platforms/inspection.js +259 -0
  270. package/dist/src/platforms/inspection.js.map +1 -0
  271. package/dist/src/platforms/layout.d.ts +35 -0
  272. package/dist/src/platforms/layout.js +317 -0
  273. package/dist/src/platforms/layout.js.map +1 -0
  274. package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
  275. package/dist/src/platforms/lifecycle-native-services.js +147 -0
  276. package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
  277. package/dist/src/platforms/lifecycle-native.d.ts +14 -0
  278. package/dist/src/platforms/lifecycle-native.js +223 -0
  279. package/dist/src/platforms/lifecycle-native.js.map +1 -0
  280. package/dist/src/platforms/lifecycle.d.ts +27 -0
  281. package/dist/src/platforms/lifecycle.js +567 -0
  282. package/dist/src/platforms/lifecycle.js.map +1 -0
  283. package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
  284. package/dist/src/platforms/opencode-permission-config.js +253 -0
  285. package/dist/src/platforms/opencode-permission-config.js.map +1 -0
  286. package/dist/src/platforms/opencode-permissions.d.ts +39 -0
  287. package/dist/src/platforms/opencode-permissions.js +212 -0
  288. package/dist/src/platforms/opencode-permissions.js.map +1 -0
  289. package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
  290. package/dist/src/platforms/opencode-related-permissions.js +177 -0
  291. package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
  292. package/dist/src/platforms/permission-ownership.d.ts +89 -0
  293. package/dist/src/platforms/permission-ownership.js +543 -0
  294. package/dist/src/platforms/permission-ownership.js.map +1 -0
  295. package/dist/src/platforms/permission-sidecar.d.ts +70 -0
  296. package/dist/src/platforms/permission-sidecar.js +215 -0
  297. package/dist/src/platforms/permission-sidecar.js.map +1 -0
  298. package/dist/src/platforms/projection-code-extension.d.ts +8 -0
  299. package/dist/src/platforms/projection-code-extension.js +126 -0
  300. package/dist/src/platforms/projection-code-extension.js.map +1 -0
  301. package/dist/src/platforms/projection-command-resources.d.ts +7 -0
  302. package/dist/src/platforms/projection-command-resources.js +74 -0
  303. package/dist/src/platforms/projection-command-resources.js.map +1 -0
  304. package/dist/src/platforms/projection-files.d.ts +27 -0
  305. package/dist/src/platforms/projection-files.js +111 -0
  306. package/dist/src/platforms/projection-files.js.map +1 -0
  307. package/dist/src/platforms/projection-marketplace.d.ts +19 -0
  308. package/dist/src/platforms/projection-marketplace.js +42 -0
  309. package/dist/src/platforms/projection-marketplace.js.map +1 -0
  310. package/dist/src/platforms/projection.d.ts +13 -0
  311. package/dist/src/platforms/projection.js +576 -0
  312. package/dist/src/platforms/projection.js.map +1 -0
  313. package/dist/src/platforms/registry.d.ts +4 -0
  314. package/dist/src/platforms/registry.js +30 -0
  315. package/dist/src/platforms/registry.js.map +1 -0
  316. package/dist/src/platforms/supplement-layout.d.ts +20 -0
  317. package/dist/src/platforms/supplement-layout.js +53 -0
  318. package/dist/src/platforms/supplement-layout.js.map +1 -0
  319. package/dist/src/platforms/supplement-state.d.ts +13 -0
  320. package/dist/src/platforms/supplement-state.js +93 -0
  321. package/dist/src/platforms/supplement-state.js.map +1 -0
  322. package/dist/src/portable/commands.d.ts +58 -11
  323. package/dist/src/portable/commands.js +99 -345
  324. package/dist/src/portable/commands.js.map +1 -1
  325. package/dist/src/portable/historical-materialization.d.ts +22 -0
  326. package/dist/src/portable/historical-materialization.js +124 -0
  327. package/dist/src/portable/historical-materialization.js.map +1 -0
  328. package/dist/src/portable/materializer.d.ts +29 -1
  329. package/dist/src/portable/materializer.js +197 -258
  330. package/dist/src/portable/materializer.js.map +1 -1
  331. package/dist/src/portable/recovery-layout.d.ts +17 -0
  332. package/dist/src/portable/recovery-layout.js +42 -0
  333. package/dist/src/portable/recovery-layout.js.map +1 -0
  334. package/dist/src/portable/recovery.d.ts +176 -0
  335. package/dist/src/portable/recovery.js +556 -0
  336. package/dist/src/portable/recovery.js.map +1 -0
  337. package/dist/src/portable/writer.d.ts +67 -0
  338. package/dist/src/portable/writer.js +321 -0
  339. package/dist/src/portable/writer.js.map +1 -0
  340. package/dist/src/recovery/coordinator.d.ts +168 -0
  341. package/dist/src/recovery/coordinator.js +1558 -0
  342. package/dist/src/recovery/coordinator.js.map +1 -0
  343. package/dist/src/recovery/demand.d.ts +53 -0
  344. package/dist/src/recovery/demand.js +189 -0
  345. package/dist/src/recovery/demand.js.map +1 -0
  346. package/dist/src/recovery/install-concurrency.d.ts +48 -0
  347. package/dist/src/recovery/install-concurrency.js +196 -0
  348. package/dist/src/recovery/install-concurrency.js.map +1 -0
  349. package/dist/src/recovery/interruption.d.ts +19 -0
  350. package/dist/src/recovery/interruption.js +43 -0
  351. package/dist/src/recovery/interruption.js.map +1 -0
  352. package/dist/src/recovery/joint-coordinator.d.ts +46 -0
  353. package/dist/src/recovery/joint-coordinator.js +1641 -0
  354. package/dist/src/recovery/joint-coordinator.js.map +1 -0
  355. package/dist/src/recovery/joint-demand.d.ts +72 -0
  356. package/dist/src/recovery/joint-demand.js +332 -0
  357. package/dist/src/recovery/joint-demand.js.map +1 -0
  358. package/dist/src/recovery/joint-install-execution.d.ts +19 -0
  359. package/dist/src/recovery/joint-install-execution.js +308 -0
  360. package/dist/src/recovery/joint-install-execution.js.map +1 -0
  361. package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
  362. package/dist/src/recovery/joint-install-native-rebase.js +67 -0
  363. package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
  364. package/dist/src/recovery/performance.d.ts +4 -0
  365. package/dist/src/recovery/performance.js +26 -0
  366. package/dist/src/recovery/performance.js.map +1 -0
  367. package/dist/src/recovery/receipt.d.ts +129 -0
  368. package/dist/src/recovery/receipt.js +91 -0
  369. package/dist/src/recovery/receipt.js.map +1 -0
  370. package/dist/src/recovery/retirement.d.ts +47 -0
  371. package/dist/src/recovery/retirement.js +463 -0
  372. package/dist/src/recovery/retirement.js.map +1 -0
  373. package/dist/src/recovery/status.d.ts +143 -0
  374. package/dist/src/recovery/status.js +1517 -0
  375. package/dist/src/recovery/status.js.map +1 -0
  376. package/dist/src/recovery/types.d.ts +85 -0
  377. package/dist/src/recovery/types.js +2 -0
  378. package/dist/src/recovery/types.js.map +1 -0
  379. package/dist/src/review/eval-source-input.d.ts +44 -0
  380. package/dist/src/review/eval-source-input.js +213 -0
  381. package/dist/src/review/eval-source-input.js.map +1 -0
  382. package/dist/src/review/platform-profile.d.ts +6 -0
  383. package/dist/src/review/platform-profile.js +24 -0
  384. package/dist/src/review/platform-profile.js.map +1 -0
  385. package/dist/src/review/review-profile.d.ts +20 -0
  386. package/dist/src/review/review-profile.js +276 -0
  387. package/dist/src/review/review-profile.js.map +1 -0
  388. package/dist/src/review/review-selection.d.ts +20 -0
  389. package/dist/src/review/review-selection.js +502 -0
  390. package/dist/src/review/review-selection.js.map +1 -0
  391. package/dist/src/review/review-types.d.ts +71 -0
  392. package/dist/src/review/review-types.js +16 -0
  393. package/dist/src/review/review-types.js.map +1 -0
  394. package/dist/src/review/skill-materialization.d.ts +65 -0
  395. package/dist/src/review/skill-materialization.js +228 -0
  396. package/dist/src/review/skill-materialization.js.map +1 -0
  397. package/dist/src/review/source-binding.d.ts +201 -0
  398. package/dist/src/review/source-binding.js +782 -0
  399. package/dist/src/review/source-binding.js.map +1 -0
  400. package/dist/src/tui/agent-management.d.ts +23 -0
  401. package/dist/src/tui/agent-management.js +319 -0
  402. package/dist/src/tui/agent-management.js.map +1 -0
  403. package/dist/src/tui/agent-settings.d.ts +47 -0
  404. package/dist/src/tui/agent-settings.js +97 -0
  405. package/dist/src/tui/agent-settings.js.map +1 -0
  406. package/dist/src/tui/catalog-freshness.d.ts +1 -0
  407. package/dist/src/tui/catalog-freshness.js +2 -0
  408. package/dist/src/tui/catalog-freshness.js.map +1 -0
  409. package/dist/src/tui/catalog-generation.d.ts +8 -16
  410. package/dist/src/tui/catalog-generation.js +97 -10
  411. package/dist/src/tui/catalog-generation.js.map +1 -1
  412. package/dist/src/tui/catalog-sources/projection.d.ts +4 -0
  413. package/dist/src/tui/catalog-sources/projection.js +17 -0
  414. package/dist/src/tui/catalog-sources/projection.js.map +1 -0
  415. package/dist/src/tui/catalog-sources/review.d.ts +3 -0
  416. package/dist/src/tui/catalog-sources/review.js +13 -0
  417. package/dist/src/tui/catalog-sources/review.js.map +1 -0
  418. package/dist/src/tui/catalog-sources/screens.d.ts +12 -0
  419. package/dist/src/tui/catalog-sources/screens.js +40 -0
  420. package/dist/src/tui/catalog-sources/screens.js.map +1 -0
  421. package/dist/src/tui/catalog-sources/session.d.ts +32 -0
  422. package/dist/src/tui/catalog-sources/session.js +300 -0
  423. package/dist/src/tui/catalog-sources/session.js.map +1 -0
  424. package/dist/src/tui/catalog-sources/types.d.ts +54 -0
  425. package/dist/src/tui/catalog-sources/types.js +2 -0
  426. package/dist/src/tui/catalog-sources/types.js.map +1 -0
  427. package/dist/src/tui/catalog-store-task.d.ts +16 -0
  428. package/dist/src/tui/catalog-store-task.js +19 -0
  429. package/dist/src/tui/catalog-store-task.js.map +1 -0
  430. package/dist/src/tui/clipboard.d.ts +13 -0
  431. package/dist/src/tui/clipboard.js +95 -0
  432. package/dist/src/tui/clipboard.js.map +1 -0
  433. package/dist/src/tui/components.d.ts +113 -3
  434. package/dist/src/tui/components.js +201 -34
  435. package/dist/src/tui/components.js.map +1 -1
  436. package/dist/src/tui/config-array-draft.d.ts +30 -0
  437. package/dist/src/tui/config-array-draft.js +51 -0
  438. package/dist/src/tui/config-array-draft.js.map +1 -0
  439. package/dist/src/tui/config-leaf-editor.d.ts +44 -0
  440. package/dist/src/tui/config-leaf-editor.js +227 -0
  441. package/dist/src/tui/config-leaf-editor.js.map +1 -0
  442. package/dist/src/tui/config-object-suggestions.d.ts +15 -0
  443. package/dist/src/tui/config-object-suggestions.js +71 -0
  444. package/dist/src/tui/config-object-suggestions.js.map +1 -0
  445. package/dist/src/tui/config-references.d.ts +38 -0
  446. package/dist/src/tui/config-references.js +82 -0
  447. package/dist/src/tui/config-references.js.map +1 -0
  448. package/dist/src/tui/config-suggestions.d.ts +27 -0
  449. package/dist/src/tui/config-suggestions.js +62 -0
  450. package/dist/src/tui/config-suggestions.js.map +1 -0
  451. package/dist/src/tui/config-value-presentation.d.ts +21 -0
  452. package/dist/src/tui/config-value-presentation.js +129 -0
  453. package/dist/src/tui/config-value-presentation.js.map +1 -0
  454. package/dist/src/tui/console-app-v4.d.ts +14 -5
  455. package/dist/src/tui/console-app-v4.js +10344 -2133
  456. package/dist/src/tui/console-app-v4.js.map +1 -1
  457. package/dist/src/tui/content-item-card.d.ts +13 -0
  458. package/dist/src/tui/content-item-card.js +51 -0
  459. package/dist/src/tui/content-item-card.js.map +1 -0
  460. package/dist/src/tui/controller-runtime.d.ts +8 -3
  461. package/dist/src/tui/controller-runtime.js +2301 -842
  462. package/dist/src/tui/controller-runtime.js.map +1 -1
  463. package/dist/src/tui/controller.d.ts +664 -79
  464. package/dist/src/tui/controller.js +3670 -830
  465. package/dist/src/tui/controller.js.map +1 -1
  466. package/dist/src/tui/dependency-graph-view.d.ts +39 -0
  467. package/dist/src/tui/dependency-graph-view.js +121 -0
  468. package/dist/src/tui/dependency-graph-view.js.map +1 -0
  469. package/dist/src/tui/dependency-graph.d.ts +81 -0
  470. package/dist/src/tui/dependency-graph.js +452 -0
  471. package/dist/src/tui/dependency-graph.js.map +1 -0
  472. package/dist/src/tui/deployment-view.d.ts +13 -0
  473. package/dist/src/tui/deployment-view.js +155 -0
  474. package/dist/src/tui/deployment-view.js.map +1 -0
  475. package/dist/src/tui/diagnostic-projection.d.ts +31 -0
  476. package/dist/src/tui/diagnostic-projection.js +681 -0
  477. package/dist/src/tui/diagnostic-projection.js.map +1 -0
  478. package/dist/src/tui/diagnostics.d.ts +6 -2
  479. package/dist/src/tui/diagnostics.js +14 -2
  480. package/dist/src/tui/diagnostics.js.map +1 -1
  481. package/dist/src/tui/entity-cards.d.ts +56 -0
  482. package/dist/src/tui/entity-cards.js +321 -0
  483. package/dist/src/tui/entity-cards.js.map +1 -0
  484. package/dist/src/tui/glossary.d.ts +25 -0
  485. package/dist/src/tui/glossary.js +78 -0
  486. package/dist/src/tui/glossary.js.map +1 -0
  487. package/dist/src/tui/guided-setup.d.ts +25 -0
  488. package/dist/src/tui/guided-setup.js +101 -0
  489. package/dist/src/tui/guided-setup.js.map +1 -0
  490. package/dist/src/tui/index.d.ts +5 -1
  491. package/dist/src/tui/index.js +4 -1
  492. package/dist/src/tui/index.js.map +1 -1
  493. package/dist/src/tui/input-display.d.ts +1 -0
  494. package/dist/src/tui/input-display.js +23 -1
  495. package/dist/src/tui/input-display.js.map +1 -1
  496. package/dist/src/tui/keys.d.ts +44 -0
  497. package/dist/src/tui/keys.js +43 -15
  498. package/dist/src/tui/keys.js.map +1 -1
  499. package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
  500. package/dist/src/tui/lifecycle-action-view.js +36 -0
  501. package/dist/src/tui/lifecycle-action-view.js.map +1 -0
  502. package/dist/src/tui/model.d.ts +187 -52
  503. package/dist/src/tui/model.js +1202 -426
  504. package/dist/src/tui/model.js.map +1 -1
  505. package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
  506. package/dist/src/tui/operation-diagnostic-screens.js +76 -0
  507. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
  508. package/dist/src/tui/operation-history.d.ts +91 -0
  509. package/dist/src/tui/operation-history.js +167 -0
  510. package/dist/src/tui/operation-history.js.map +1 -0
  511. package/dist/src/tui/operation-review-planner.d.ts +28 -0
  512. package/dist/src/tui/operation-review-planner.js +1456 -0
  513. package/dist/src/tui/operation-review-planner.js.map +1 -0
  514. package/dist/src/tui/plugin-content.d.ts +33 -0
  515. package/dist/src/tui/plugin-content.js +245 -0
  516. package/dist/src/tui/plugin-content.js.map +1 -0
  517. package/dist/src/tui/plugin-detail.d.ts +75 -0
  518. package/dist/src/tui/plugin-detail.js +267 -0
  519. package/dist/src/tui/plugin-detail.js.map +1 -0
  520. package/dist/src/tui/plugin-write-task.d.ts +69 -0
  521. package/dist/src/tui/plugin-write-task.js +286 -0
  522. package/dist/src/tui/plugin-write-task.js.map +1 -0
  523. package/dist/src/tui/prompt.js +4 -15
  524. package/dist/src/tui/prompt.js.map +1 -1
  525. package/dist/src/tui/query-header.d.ts +30 -0
  526. package/dist/src/tui/query-header.js +40 -0
  527. package/dist/src/tui/query-header.js.map +1 -0
  528. package/dist/src/tui/reader.d.ts +38 -0
  529. package/dist/src/tui/reader.js +49 -0
  530. package/dist/src/tui/reader.js.map +1 -0
  531. package/dist/src/tui/router.d.ts +182 -39
  532. package/dist/src/tui/router.js +338 -50
  533. package/dist/src/tui/router.js.map +1 -1
  534. package/dist/src/tui/scoped-flow.d.ts +49 -0
  535. package/dist/src/tui/scoped-flow.js +212 -0
  536. package/dist/src/tui/scoped-flow.js.map +1 -0
  537. package/dist/src/tui/scoped-inventory.d.ts +131 -0
  538. package/dist/src/tui/scoped-inventory.js +280 -0
  539. package/dist/src/tui/scoped-inventory.js.map +1 -0
  540. package/dist/src/tui/screen-registry.d.ts +696 -0
  541. package/dist/src/tui/screen-registry.js +226 -0
  542. package/dist/src/tui/screen-registry.js.map +1 -0
  543. package/dist/src/tui/session-console-app.d.ts +8 -0
  544. package/dist/src/tui/session-console-app.js +24 -0
  545. package/dist/src/tui/session-console-app.js.map +1 -0
  546. package/dist/src/tui/session-host.d.ts +45 -0
  547. package/dist/src/tui/session-host.js +219 -0
  548. package/dist/src/tui/session-host.js.map +1 -0
  549. package/dist/src/tui/source-detail-card.d.ts +29 -0
  550. package/dist/src/tui/source-detail-card.js +45 -0
  551. package/dist/src/tui/source-detail-card.js.map +1 -0
  552. package/dist/src/tui/theme.d.ts +12 -0
  553. package/dist/src/tui/theme.js +12 -0
  554. package/dist/src/tui/theme.js.map +1 -1
  555. package/dist/src/tui/viewport.d.ts +1 -0
  556. package/dist/src/tui/viewport.js +23 -0
  557. package/dist/src/tui/viewport.js.map +1 -1
  558. package/dist/src/tui/wizard.js +37 -13
  559. package/dist/src/tui/wizard.js.map +1 -1
  560. package/dist/src/types.d.ts +177 -85
  561. package/dist/src/types.js +1 -0
  562. package/dist/src/types.js.map +1 -1
  563. package/dist/src/utils/agent-version.d.ts +10 -4
  564. package/dist/src/utils/agent-version.js +6 -8
  565. package/dist/src/utils/agent-version.js.map +1 -1
  566. package/dist/src/utils/artifact-plan.d.ts +17 -24
  567. package/dist/src/utils/artifact-plan.js +59 -436
  568. package/dist/src/utils/artifact-plan.js.map +1 -1
  569. package/dist/src/utils/artifact-renderer.d.ts +61 -89
  570. package/dist/src/utils/artifact-renderer.js +187 -364
  571. package/dist/src/utils/artifact-renderer.js.map +1 -1
  572. package/dist/src/utils/artifact-request.d.ts +21 -0
  573. package/dist/src/utils/artifact-request.js +57 -0
  574. package/dist/src/utils/artifact-request.js.map +1 -0
  575. package/dist/src/utils/artifact-sources.d.ts +4 -8
  576. package/dist/src/utils/artifact-sources.js +15 -6
  577. package/dist/src/utils/artifact-sources.js.map +1 -1
  578. package/dist/src/utils/aw-home-mutation-lock.js +2 -1
  579. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  580. package/dist/src/utils/bundle-layout.js +59 -173
  581. package/dist/src/utils/bundle-layout.js.map +1 -1
  582. package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
  583. package/dist/src/utils/catalog-capability-projection.js +14 -0
  584. package/dist/src/utils/catalog-capability-projection.js.map +1 -0
  585. package/dist/src/utils/catalog-digests.d.ts +2 -9
  586. package/dist/src/utils/catalog-digests.js +7 -45
  587. package/dist/src/utils/catalog-digests.js.map +1 -1
  588. package/dist/src/utils/catalog-generation-error.d.ts +4 -1
  589. package/dist/src/utils/catalog-generation-error.js +2 -0
  590. package/dist/src/utils/catalog-generation-error.js.map +1 -1
  591. package/dist/src/utils/catalog-generation-resolver.d.ts +32 -3
  592. package/dist/src/utils/catalog-generation-resolver.js +182 -40
  593. package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
  594. package/dist/src/utils/catalog-generation-service.d.ts +142 -2
  595. package/dist/src/utils/catalog-generation-service.js +1146 -171
  596. package/dist/src/utils/catalog-generation-service.js.map +1 -1
  597. package/dist/src/utils/catalog-generation-state.d.ts +5 -0
  598. package/dist/src/utils/catalog-generation-state.js +25 -1
  599. package/dist/src/utils/catalog-generation-state.js.map +1 -1
  600. package/dist/src/utils/catalog-generation-store.d.ts +29 -2
  601. package/dist/src/utils/catalog-generation-store.js +240 -36
  602. package/dist/src/utils/catalog-generation-store.js.map +1 -1
  603. package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
  604. package/dist/src/utils/{catalog-manifest-v6.js → catalog-manifest-v7.js} +23 -23
  605. package/dist/src/utils/{catalog-manifest-v6.js.map → catalog-manifest-v7.js.map} +1 -1
  606. package/dist/src/utils/catalog-operation-context.d.ts +27 -3
  607. package/dist/src/utils/catalog-operation-context.js +75 -4
  608. package/dist/src/utils/catalog-operation-context.js.map +1 -1
  609. package/dist/src/utils/catalog-public-error.js +7 -0
  610. package/dist/src/utils/catalog-public-error.js.map +1 -1
  611. package/dist/src/utils/catalog-runtime-projection.d.ts +4 -3
  612. package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
  613. package/dist/src/utils/catalog-snapshot.d.ts +5 -2
  614. package/dist/src/utils/catalog-snapshot.js +4 -1
  615. package/dist/src/utils/catalog-snapshot.js.map +1 -1
  616. package/dist/src/utils/catalog-source-impact.d.ts +21 -0
  617. package/dist/src/utils/catalog-source-impact.js +344 -0
  618. package/dist/src/utils/catalog-source-impact.js.map +1 -0
  619. package/dist/src/utils/catalog-source-references.d.ts +22 -8
  620. package/dist/src/utils/catalog-source-references.js +457 -365
  621. package/dist/src/utils/catalog-source-references.js.map +1 -1
  622. package/dist/src/utils/catalog-sources.d.ts +14 -1
  623. package/dist/src/utils/catalog-sources.js +155 -11
  624. package/dist/src/utils/catalog-sources.js.map +1 -1
  625. package/dist/src/utils/codex-executable-discovery.d.ts +28 -0
  626. package/dist/src/utils/codex-executable-discovery.js +431 -0
  627. package/dist/src/utils/codex-executable-discovery.js.map +1 -0
  628. package/dist/src/utils/codex-manager.d.ts +23 -42
  629. package/dist/src/utils/codex-manager.js +79 -767
  630. package/dist/src/utils/codex-manager.js.map +1 -1
  631. package/dist/src/utils/codex-marketplace-path.d.ts +5 -0
  632. package/dist/src/utils/codex-marketplace-path.js +45 -0
  633. package/dist/src/utils/codex-marketplace-path.js.map +1 -0
  634. package/dist/src/utils/codex-native-observation.d.ts +55 -0
  635. package/dist/src/utils/codex-native-observation.js +198 -0
  636. package/dist/src/utils/codex-native-observation.js.map +1 -0
  637. package/dist/src/utils/codex-reconciler.d.ts +6 -14
  638. package/dist/src/utils/codex-reconciler.js +45 -50
  639. package/dist/src/utils/codex-reconciler.js.map +1 -1
  640. package/dist/src/utils/codex-shared-native.d.ts +28 -39
  641. package/dist/src/utils/codex-shared-native.js +92 -57
  642. package/dist/src/utils/codex-shared-native.js.map +1 -1
  643. package/dist/src/utils/codex-skill-staging.d.ts +4 -3
  644. package/dist/src/utils/codex-skill-staging.js.map +1 -1
  645. package/dist/src/utils/codex-skills-root.d.ts +4 -0
  646. package/dist/src/utils/codex-skills-root.js +25 -0
  647. package/dist/src/utils/codex-skills-root.js.map +1 -0
  648. package/dist/src/utils/codex-surface-analysis.d.ts +8 -3
  649. package/dist/src/utils/codex-surface-analysis.js +35 -62
  650. package/dist/src/utils/codex-surface-analysis.js.map +1 -1
  651. package/dist/src/utils/component-command-preparation.d.ts +31 -0
  652. package/dist/src/utils/component-command-preparation.js +127 -0
  653. package/dist/src/utils/component-command-preparation.js.map +1 -0
  654. package/dist/src/utils/component-gap.d.ts +4 -0
  655. package/dist/src/utils/component-gap.js +20 -0
  656. package/dist/src/utils/component-gap.js.map +1 -0
  657. package/dist/src/utils/component-resources.d.ts +51 -0
  658. package/dist/src/utils/component-resources.js +320 -0
  659. package/dist/src/utils/component-resources.js.map +1 -0
  660. package/dist/src/utils/config-platforms.d.ts +21 -0
  661. package/dist/src/utils/config-platforms.js +51 -0
  662. package/dist/src/utils/config-platforms.js.map +1 -0
  663. package/dist/src/utils/dynamic-skill-tree.d.ts +18 -6
  664. package/dist/src/utils/dynamic-skill-tree.js +33 -40
  665. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  666. package/dist/src/utils/git-catalog-provider.d.ts +16 -0
  667. package/dist/src/utils/git-catalog-provider.js +112 -6
  668. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  669. package/dist/src/utils/inventory-recovery-diagnostic.d.ts +4 -0
  670. package/dist/src/utils/inventory-recovery-diagnostic.js +15 -0
  671. package/dist/src/utils/inventory-recovery-diagnostic.js.map +1 -0
  672. package/dist/src/utils/local-marketplace.d.ts +17 -12
  673. package/dist/src/utils/local-marketplace.js +85 -195
  674. package/dist/src/utils/local-marketplace.js.map +1 -1
  675. package/dist/src/utils/managed-command-cli-review.d.ts +53 -0
  676. package/dist/src/utils/managed-command-cli-review.js +431 -0
  677. package/dist/src/utils/managed-command-cli-review.js.map +1 -0
  678. package/dist/src/utils/managed-command-closure.d.ts +14 -0
  679. package/dist/src/utils/managed-command-closure.js +156 -0
  680. package/dist/src/utils/managed-command-closure.js.map +1 -0
  681. package/dist/src/utils/managed-command-errors.d.ts +5 -0
  682. package/dist/src/utils/managed-command-errors.js +10 -0
  683. package/dist/src/utils/managed-command-errors.js.map +1 -0
  684. package/dist/src/utils/managed-command-materialization.d.ts +90 -0
  685. package/dist/src/utils/managed-command-materialization.js +375 -0
  686. package/dist/src/utils/managed-command-materialization.js.map +1 -0
  687. package/dist/src/utils/managed-command-preparation.d.ts +30 -0
  688. package/dist/src/utils/managed-command-preparation.js +39 -0
  689. package/dist/src/utils/managed-command-preparation.js.map +1 -0
  690. package/dist/src/utils/managed-command-review.d.ts +33 -0
  691. package/dist/src/utils/managed-command-review.js +80 -0
  692. package/dist/src/utils/managed-command-review.js.map +1 -0
  693. package/dist/src/utils/managed-command-runtime.d.ts +36 -0
  694. package/dist/src/utils/managed-command-runtime.js +126 -0
  695. package/dist/src/utils/managed-command-runtime.js.map +1 -0
  696. package/dist/src/utils/managed-command-snapshots.d.ts +24 -0
  697. package/dist/src/utils/managed-command-snapshots.js +89 -0
  698. package/dist/src/utils/managed-command-snapshots.js.map +1 -0
  699. package/dist/src/utils/managed-command-store.d.ts +141 -0
  700. package/dist/src/utils/managed-command-store.js +839 -0
  701. package/dist/src/utils/managed-command-store.js.map +1 -0
  702. package/dist/src/utils/multi-source-catalog.d.ts +4 -0
  703. package/dist/src/utils/multi-source-catalog.js +7 -3
  704. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  705. package/dist/src/utils/native-cli-interruption.d.ts +8 -0
  706. package/dist/src/utils/native-cli-interruption.js +65 -0
  707. package/dist/src/utils/native-cli-interruption.js.map +1 -0
  708. package/dist/src/utils/native-cli.d.ts +37 -6
  709. package/dist/src/utils/native-cli.js +523 -60
  710. package/dist/src/utils/native-cli.js.map +1 -1
  711. package/dist/src/utils/native-demand.d.ts +29 -0
  712. package/dist/src/utils/native-demand.js +4 -0
  713. package/dist/src/utils/native-demand.js.map +1 -0
  714. package/dist/src/utils/native-tool-context.d.ts +17 -0
  715. package/dist/src/utils/native-tool-context.js +40 -0
  716. package/dist/src/utils/native-tool-context.js.map +1 -0
  717. package/dist/src/utils/native-tool-review.d.ts +8 -0
  718. package/dist/src/utils/native-tool-review.js +14 -0
  719. package/dist/src/utils/native-tool-review.js.map +1 -0
  720. package/dist/src/utils/orphan-marketplace-cleanup.js +0 -2
  721. package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
  722. package/dist/src/utils/ownership.d.ts +111 -11
  723. package/dist/src/utils/ownership.js +247 -126
  724. package/dist/src/utils/ownership.js.map +1 -1
  725. package/dist/src/utils/package-content.d.ts +7 -0
  726. package/dist/src/utils/package-content.js +70 -0
  727. package/dist/src/utils/package-content.js.map +1 -0
  728. package/dist/src/utils/path-catalog-provider.js +2 -0
  729. package/dist/src/utils/path-catalog-provider.js.map +1 -1
  730. package/dist/src/utils/paths.d.ts +1 -1
  731. package/dist/src/utils/paths.js +5 -2
  732. package/dist/src/utils/paths.js.map +1 -1
  733. package/dist/src/utils/platform-empty-state.d.ts +69 -0
  734. package/dist/src/utils/platform-empty-state.js +226 -0
  735. package/dist/src/utils/platform-empty-state.js.map +1 -0
  736. package/dist/src/utils/platform-support.d.ts +1 -1
  737. package/dist/src/utils/platform-support.js +1 -1
  738. package/dist/src/utils/platform-support.js.map +1 -1
  739. package/dist/src/utils/plugin-config-command-apply.d.ts +33 -0
  740. package/dist/src/utils/plugin-config-command-apply.js +142 -0
  741. package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
  742. package/dist/src/utils/plugin-config-diagnostics.d.ts +16 -0
  743. package/dist/src/utils/plugin-config-diagnostics.js +44 -0
  744. package/dist/src/utils/plugin-config-diagnostics.js.map +1 -0
  745. package/dist/src/utils/plugin-config-impact.d.ts +75 -0
  746. package/dist/src/utils/plugin-config-impact.js +355 -0
  747. package/dist/src/utils/plugin-config-impact.js.map +1 -0
  748. package/dist/src/utils/plugin-config-references.d.ts +96 -0
  749. package/dist/src/utils/plugin-config-references.js +357 -0
  750. package/dist/src/utils/plugin-config-references.js.map +1 -0
  751. package/dist/src/utils/plugin-config-suggestion-runner.d.ts +83 -0
  752. package/dist/src/utils/plugin-config-suggestion-runner.js +308 -0
  753. package/dist/src/utils/plugin-config-suggestion-runner.js.map +1 -0
  754. package/dist/src/utils/plugin-config-suggestions.d.ts +50 -0
  755. package/dist/src/utils/plugin-config-suggestions.js +302 -0
  756. package/dist/src/utils/plugin-config-suggestions.js.map +1 -0
  757. package/dist/src/utils/plugin-config-write.d.ts +123 -31
  758. package/dist/src/utils/plugin-config-write.js +828 -399
  759. package/dist/src/utils/plugin-config-write.js.map +1 -1
  760. package/dist/src/utils/plugin-config.d.ts +192 -109
  761. package/dist/src/utils/plugin-config.js +970 -1150
  762. package/dist/src/utils/plugin-config.js.map +1 -1
  763. package/dist/src/utils/plugin-dependencies.d.ts +1 -1
  764. package/dist/src/utils/plugin-dependencies.js.map +1 -1
  765. package/dist/src/utils/plugin-scripts.d.ts +80 -127
  766. package/dist/src/utils/plugin-scripts.js +655 -524
  767. package/dist/src/utils/plugin-scripts.js.map +1 -1
  768. package/dist/src/utils/process-lock.js +14 -5
  769. package/dist/src/utils/process-lock.js.map +1 -1
  770. package/dist/src/utils/process-tree.d.ts +2 -2
  771. package/dist/src/utils/process-tree.js +1 -1
  772. package/dist/src/utils/process-tree.js.map +1 -1
  773. package/dist/src/utils/project-boundary.d.ts +11 -13
  774. package/dist/src/utils/project-boundary.js +28 -34
  775. package/dist/src/utils/project-boundary.js.map +1 -1
  776. package/dist/src/utils/rendered-contract.js +24 -1
  777. package/dist/src/utils/rendered-contract.js.map +1 -1
  778. package/dist/src/utils/runtime-config.d.ts +18 -0
  779. package/dist/src/utils/runtime-config.js +64 -0
  780. package/dist/src/utils/runtime-config.js.map +1 -0
  781. package/dist/src/utils/runtime-skill-closure.d.ts +2 -2
  782. package/dist/src/utils/runtime-skill-closure.js +47 -6
  783. package/dist/src/utils/runtime-skill-closure.js.map +1 -1
  784. package/dist/src/utils/safe-fs.d.ts +21 -0
  785. package/dist/src/utils/safe-fs.js +111 -0
  786. package/dist/src/utils/safe-fs.js.map +1 -0
  787. package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
  788. package/dist/src/utils/safe-operation-diagnostic.js +33 -0
  789. package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
  790. package/dist/src/utils/sensitive-content.d.ts +4 -0
  791. package/dist/src/utils/sensitive-content.js +36 -0
  792. package/dist/src/utils/sensitive-content.js.map +1 -0
  793. package/dist/src/utils/skill-invocation-warning.d.ts +20 -0
  794. package/dist/src/utils/skill-invocation-warning.js +68 -0
  795. package/dist/src/utils/skill-invocation-warning.js.map +1 -0
  796. package/dist/src/utils/state-paths.d.ts +8 -3
  797. package/dist/src/utils/state-paths.js +53 -16
  798. package/dist/src/utils/state-paths.js.map +1 -1
  799. package/dist/src/utils/target-eligibility.d.ts +3 -3
  800. package/dist/src/utils/target-eligibility.js +11 -6
  801. package/dist/src/utils/target-eligibility.js.map +1 -1
  802. package/dist/src/utils/windows-claude-shim.d.ts +7 -0
  803. package/dist/src/utils/windows-claude-shim.js +10 -0
  804. package/dist/src/utils/windows-claude-shim.js.map +1 -0
  805. package/dist/src/utils/windows-npm-shim.d.ts +16 -0
  806. package/dist/src/utils/windows-npm-shim.js +155 -0
  807. package/dist/src/utils/windows-npm-shim.js.map +1 -0
  808. package/dist/vitest.config.js +106 -9
  809. package/dist/vitest.config.js.map +1 -1
  810. package/package.json +30 -21
  811. package/dist/src/commands/review-publication.d.ts +0 -99
  812. package/dist/src/commands/review-publication.js +0 -904
  813. package/dist/src/commands/review-publication.js.map +0 -1
  814. package/dist/src/commands/sync-command.d.ts +0 -21
  815. package/dist/src/commands/sync-command.js +0 -206
  816. package/dist/src/commands/sync-command.js.map +0 -1
  817. package/dist/src/portable/skills-cli.d.ts +0 -43
  818. package/dist/src/portable/skills-cli.js +0 -148
  819. package/dist/src/portable/skills-cli.js.map +0 -1
  820. package/dist/src/utils/catalog-manifest-v6.d.ts +0 -5
  821. package/dist/src/utils/lifecycle-active-store.d.ts +0 -147
  822. package/dist/src/utils/lifecycle-active-store.js +0 -1064
  823. package/dist/src/utils/lifecycle-active-store.js.map +0 -1
  824. package/dist/src/utils/plugin-intent-state.d.ts +0 -39
  825. package/dist/src/utils/plugin-intent-state.js +0 -325
  826. package/dist/src/utils/plugin-intent-state.js.map +0 -1
  827. package/dist/src/utils/slash-commands.d.ts +0 -1
  828. package/dist/src/utils/slash-commands.js +0 -2
  829. package/dist/src/utils/slash-commands.js.map +0 -1
@@ -1,35 +1,233 @@
1
+ import { isCanonicalCodexMarketplaceRegistration } from '../utils/codex-shared-native.js';
2
+ import { selectAgents } from '../intent/deployment-preferences.js';
3
+ import { resolveActiveConfigPlatforms } from '../utils/config-platforms.js';
4
+ import { configStatusDiagnostics } from '../utils/plugin-config-diagnostics.js';
5
+ import { createScopeContext } from '../intent/scope-context.js';
6
+ import { inspectPortableExtraInstalled } from '../portable/recovery.js';
7
+ import { readDemand, demandNativeProjection } from '../recovery/demand.js';
8
+ import { deriveJointDemand } from '../recovery/joint-demand.js';
1
9
  import fs from 'node:fs';
2
10
  import path from 'node:path';
3
11
  import { analyzeCodexSurface } from '../utils/codex-surface-analysis.js';
4
12
  import { catalogSourceErrorCode, sanitizeCatalogSourceError, } from '../utils/catalog-public-error.js';
5
13
  import { calculateCatalogSourceIdentity } from '../utils/catalog-source-identity.js';
6
14
  import { canonicalMarketplaceRegistrationNames, inventoryCatalogSourceReferences, inventoryLegacyOwnerReferences, } from '../utils/catalog-source-references.js';
15
+ import { readStrictNamespacedMarketplaceRoot } from '../utils/local-marketplace.js';
7
16
  import { readCatalogSourcesConfigSnapshot, resolveCatalogSourceRef } from '../utils/catalog-sources.js';
8
17
  import { formatPluginId, parsePluginId, planPluginSelectorSourceIds, withResolvedMultiSourceCatalog, } from '../utils/multi-source-catalog.js';
9
18
  import { assertStrictSemVer, checkAwCapabilitySupport, compareStrictSemVer, readPluginManifest, tryParseStrictSemVer, } from '../utils/manifest.js';
10
19
  import { resolveCliPackageRoot, resolveCodexPaths } from '../utils/paths.js';
11
- import { supportsPlatform } from '../utils/platform-support.js';
20
+ import { resolveSupportedPlatforms, supportsPlatform } from '../utils/platform-support.js';
12
21
  import { parsePlatformValue, parseScopeValue } from './options.js';
13
- import { inspectCodexNativeResidue, inspectCodexSharedNativeLive, inspectRebuildTarget, } from './rebuild-integration.js';
22
+ import { inspectCodexPluginRegistrationLive, inspectCodexSharedNativeLive, inspectRebuildTarget, } from './rebuild-integration.js';
14
23
  import { createNoopReporter } from '../output/reporter.js';
15
24
  import { createNoopDebugLogger } from '../output/debug-log.js';
16
- import { getDefaultNativeCliRunner } from '../utils/native-cli.js';
25
+ import { bindNativeCliRunnerSignal, getDefaultNativeCliRunner } from '../utils/native-cli.js';
26
+ import { createCodexNativeObservationSession, } from '../utils/codex-native-observation.js';
17
27
  import { resolveAwHome } from '../utils/paths.js';
18
- import { codexProjectConfigAliasesUserHome, createProjectLocationKey, getClaudeHome, getCodexHome, resolveCanonicalRepoProjectKey, } from '../utils/state-paths.js';
19
- import { resolveEffectivePluginConfig } from '../utils/plugin-config.js';
28
+ import { codexProjectConfigAliasesUserHome, createProjectLocationKey, getClaudeHome, getCodexHome, resolveRequiredCanonicalRepoRoot, } from '../utils/state-paths.js';
29
+ import { resolveEffectivePluginConfig, resolveProjectArtifactRenderConfig, } from '../utils/plugin-config.js';
20
30
  import { readCodexConfigFile } from '../utils/codex-config.js';
21
- import { readPluginIntentState, } from '../utils/plugin-intent-state.js';
31
+ import { createEmptyNativeDemandView } from '../utils/native-demand.js';
22
32
  import { IMPLEMENTED_AW_CAPABILITIES } from './aw-capabilities.js';
23
33
  import { createDependencyPlacementPlan } from './dependency-operation-plan.js';
24
- import { calculateCodexSharedNativePayloadDigest } from '../utils/catalog-digests.js';
25
34
  import { getCodexOperationRequirement } from '../utils/agent-version.js';
26
- import { inspectSystemCodexFilesystem, } from '../utils/codex-manager.js';
35
+ import { inspectSystemCodex, } from '../utils/codex-manager.js';
36
+ export function statusTargetPlacements(target) {
37
+ if (target.platform === 'claude')
38
+ return [target];
39
+ return target.placements.map((placement) => ({
40
+ pluginName: target.pluginName,
41
+ sourceId: target.sourceId,
42
+ sourceIdentity: target.sourceIdentity,
43
+ pluginId: target.pluginId,
44
+ ...(target.version ? { version: target.version } : {}),
45
+ platform: target.platform,
46
+ cwd: target.cwd,
47
+ ...placement,
48
+ sharedComponents: target.components.filter((component) => component.kind !== 'systemConsumer' || component.key === `codex:${placement.scope}`),
49
+ sharedReasons: target.reasons.filter((reason) => reason.code.startsWith('codexSharedNative') || reason.code === 'staleCacheObserved'
50
+ || reason.code === 'codexCandidateExcluded'),
51
+ }));
52
+ }
53
+ export function flattenStatusTargets(targets) {
54
+ return targets.flatMap(statusTargetPlacements);
55
+ }
56
+ /** Existing output evidence is required before config apply can refresh a target. */
57
+ export function statusTargetHasLiveConfigConsumer(target) {
58
+ return target.components.some((component) => component.kind === 'ownership'
59
+ && component.key !== 'native'
60
+ && component.key !== target.pluginName
61
+ && !component.key.startsWith('activation-') && !component.key.startsWith('marketplace-')
62
+ && ['present', 'partial'].includes(component.state))
63
+ || (target.platform === 'claude' && target.components.some((component) => component.kind === 'activation'
64
+ && component.key === target.scope && component.state === 'enabled'))
65
+ || (target.sharedComponents?.some((component) => component.kind === 'sharedNative' && ['usable', 'replaceable'].includes(component.state)) === true
66
+ && target.components.some((component) => component.kind === 'activation'
67
+ && component.key === target.scope && component.state === 'enabled'));
68
+ }
69
+ export function projectStatusSharedNativeReasons(sharedNative, existingReasonCodes = [], desiredEnabled = false) {
70
+ if (!sharedNative)
71
+ return [];
72
+ const warning = (code, message) => ({
73
+ code,
74
+ message: `${code}: ${message}`,
75
+ severity: 'warning',
76
+ });
77
+ const blocking = (code, message) => ({
78
+ code,
79
+ message: `${code}: ${message}`,
80
+ severity: 'blocking',
81
+ });
82
+ return [
83
+ ...(sharedNative.state === 'blocked' && sharedNative.reason === 'foreign'
84
+ && !existingReasonCodes.includes('codexSharedNativeForeign')
85
+ ? [blocking('codexSharedNativeForeign', `${sharedNative.pluginId} is foreign and was preserved.`)]
86
+ : []),
87
+ ...(sharedNative.state === 'blocked' && sharedNative.reason === 'unreadable'
88
+ && !existingReasonCodes.includes('codexSharedNativeCorrupt')
89
+ ? [blocking('codexSharedNativeCorrupt', `${sharedNative.pluginId} is unreadable.`)]
90
+ : []),
91
+ ...(sharedNative.state === 'replaceable' && sharedNative.reason === 'damaged'
92
+ ? [warning('codexSharedNativeCorrupt', `${sharedNative.pluginId} shared generated content is missing or damaged and can be replaced.`)]
93
+ : []),
94
+ ...(sharedNative.state === 'replaceable' && sharedNative.reason === 'outdated'
95
+ ? [warning('codexSharedNativeUpdateRequired', `${sharedNative.pluginId} requires a shared update.`)]
96
+ : []),
97
+ ...(sharedNative.state === 'replaceable' && sharedNative.reason === 'renderDrift'
98
+ ? [warning('codexSharedNativeRenderDrift', `${sharedNative.pluginId} shared generated content does not match the current render inputs and can be replaced.`)]
99
+ : []),
100
+ ...(sharedNative.staleCacheObserved
101
+ ? [warning('staleCacheObserved', `${sharedNative.pluginId} has non-blocking stale Codex cache residue.`)]
102
+ : []),
103
+ ...(sharedNative.state === 'unobserved' && desiredEnabled
104
+ ? [warning('codexSharedNativeUnobserved', `${sharedNative.pluginId} was not observed by a compatible Codex consumer.`)]
105
+ : []),
106
+ ];
107
+ }
108
+ function statusComponent(target, kind, key) {
109
+ return [...target.components, ...(target.sharedComponents ?? [])].find((component) => component.kind === kind && (key === undefined || component.key === key));
110
+ }
111
+ export function statusTargetIntent(target) {
112
+ const metadata = statusComponent(target, 'intent', 'desired')?.metadata;
113
+ return {
114
+ enabled: metadata?.enabled === true,
115
+ scopes: Array.isArray(metadata?.scopes)
116
+ ? metadata.scopes.filter((scope) => scope === 'user' || scope === 'project')
117
+ : [],
118
+ relation: metadata?.relation === 'root'
119
+ || metadata?.relation === 'dependency'
120
+ || metadata?.relation === 'managed'
121
+ ? metadata.relation
122
+ : 'none',
123
+ };
124
+ }
125
+ export function statusTargetOwnershipState(target) {
126
+ const components = target.components.filter((component) => component.kind === 'ownership');
127
+ if (components.some((component) => component.state === 'error'))
128
+ return 'error';
129
+ if (components.some((component) => component.state === 'partial'))
130
+ return 'partial';
131
+ if (components.some((component) => component.state === 'present'))
132
+ return 'present';
133
+ return 'absent';
134
+ }
135
+ export function statusTargetSharedNative(target) {
136
+ const component = statusComponent(target, 'sharedNative');
137
+ if (!component || (component.state !== 'missing'
138
+ && component.state !== 'usable'
139
+ && component.state !== 'replaceable'
140
+ && component.state !== 'blocked'
141
+ && component.state !== 'unobserved'))
142
+ return undefined;
143
+ const reason = component.metadata?.reason;
144
+ return {
145
+ pluginId: component.key,
146
+ state: component.state,
147
+ ...(reason === 'outdated' || reason === 'damaged' || reason === 'renderDrift'
148
+ || reason === 'foreign' || reason === 'unreadable'
149
+ ? { reason }
150
+ : {}),
151
+ ...(typeof component.metadata?.version === 'string'
152
+ ? { version: component.metadata.version }
153
+ : {}),
154
+ ...(typeof component.metadata?.desiredVersion === 'string'
155
+ ? { desiredVersion: component.metadata.desiredVersion }
156
+ : {}),
157
+ ...(typeof component.metadata?.diagnostic === 'string'
158
+ ? { diagnostic: component.metadata.diagnostic }
159
+ : {}),
160
+ ...(component.metadata?.staleCacheObserved === true ? { staleCacheObserved: true } : {}),
161
+ };
162
+ }
163
+ export function statusTargetActivation(target) {
164
+ const user = statusComponent(target, 'activation', 'user');
165
+ const project = statusComponent(target, 'activation', 'project');
166
+ const consumer = statusComponent(target, 'systemConsumer');
167
+ if (!user && !project && !consumer)
168
+ return undefined;
169
+ const activation = user ?? project ?? consumer;
170
+ const evidence = activation?.metadata?.evidence;
171
+ const requiredMinVersion = consumer?.metadata?.requiredMinVersion;
172
+ let systemConsumer;
173
+ if (consumer && typeof requiredMinVersion === 'string') {
174
+ const detectedVersion = consumer.metadata?.detectedVersion;
175
+ const code = consumer.metadata?.code;
176
+ const diagnostic = consumer.metadata?.diagnostic;
177
+ systemConsumer = consumer.state === 'missing' || consumer.state === 'unobserved'
178
+ ? { state: consumer.state, requiredMinVersion }
179
+ : consumer.state === 'compatible' && typeof detectedVersion === 'string'
180
+ ? { state: 'compatible', detectedVersion, requiredMinVersion }
181
+ : consumer.state === 'incompatible'
182
+ && code === 'codexSystemCliUnsupported'
183
+ && typeof detectedVersion === 'string'
184
+ && typeof diagnostic === 'string'
185
+ ? { state: 'incompatible', code, detectedVersion, diagnostic, requiredMinVersion }
186
+ : consumer.state === 'unresolved'
187
+ && code === 'codexSystemCliUnsupported'
188
+ && typeof diagnostic === 'string'
189
+ ? { state: 'unresolved', code, diagnostic, requiredMinVersion }
190
+ : undefined;
191
+ const diagnostics = consumer.metadata?.diagnostics;
192
+ if (systemConsumer && Array.isArray(diagnostics) && diagnostics.length > 0) {
193
+ systemConsumer = { ...systemConsumer, diagnostics: diagnostics.filter((value) => typeof value === 'string') };
194
+ }
195
+ }
196
+ return {
197
+ ...(user ? { user: user.state === 'enabled' } : {}),
198
+ ...(project ? { project: project.state === 'enabled' } : {}),
199
+ ...(typeof activation?.metadata?.effective === 'boolean'
200
+ ? { effective: activation.metadata.effective }
201
+ : {}),
202
+ evidence: evidence === 'observed' || evidence === 'unobserved' ? evidence : 'assumed',
203
+ ...(systemConsumer ? { systemConsumer } : {}),
204
+ };
205
+ }
206
+ export function statusTargetExtensions(target) {
207
+ const component = statusComponent(target, 'extension', 'aw');
208
+ if (!component || (component.state !== 'ready'
209
+ && component.state !== 'missing'
210
+ && component.state !== 'drifted'
211
+ && component.state !== 'conflict'))
212
+ return undefined;
213
+ const kinds = Array.isArray(component.metadata?.kinds)
214
+ ? component.metadata.kinds.filter((kind) => kind === 'skill'
215
+ || kind === 'instruction'
216
+ || kind === 'permission'
217
+ || kind === 'agent'
218
+ || kind === 'config')
219
+ : [];
220
+ return { state: component.state, kinds };
221
+ }
222
+ function resolveCatalogEntrySupportedPlatforms(policy) {
223
+ return resolveSupportedPlatforms({ marketplace: { policy } });
224
+ }
27
225
  let dependencyInspectionHookForTests;
28
226
  export function setStatusDependencyInspectionHookForTests(hook) {
29
227
  dependencyInspectionHookForTests = hook;
30
228
  }
31
229
  export async function loadConsoleItemsResult(options = {}, runtime = {}) {
32
- const result = await statusCommandV6({
230
+ const result = await statusCommandV8({
33
231
  cwd: options.cwd ?? process.cwd(),
34
232
  env: runtime.env,
35
233
  platform: options.platform,
@@ -51,7 +249,7 @@ export async function loadConsoleItemsResult(options = {}, runtime = {}) {
51
249
  ...(pluginSummary ? { pluginSummary } : {}),
52
250
  targets: [],
53
251
  };
54
- current.targets.push(target);
252
+ current.targets.push(...statusTargetPlacements(target));
55
253
  groups.set(target.pluginId, current);
56
254
  }
57
255
  const allSourcesFailed = result.payload.catalog.sources.length > 0
@@ -80,7 +278,8 @@ function inventoryErrorMatchesSelection(options) {
80
278
  if (relevance.global)
81
279
  return true;
82
280
  if (relevance.projectLocationKey
83
- && relevance.projectLocationKey !== options.currentProjectLocationKey)
281
+ && (!options.currentProjectLocationKey
282
+ || relevance.projectLocationKey !== options.currentProjectLocationKey))
84
283
  return false;
85
284
  if (options.platformExplicit && relevance.platform
86
285
  && !options.platforms.includes(relevance.platform))
@@ -99,8 +298,8 @@ function finalizeTargetError(error, targetState) {
99
298
  return {
100
299
  ...error,
101
300
  severity: error.code === 'artifactCollision'
301
+ || error.code === 'dependencyGraphInvalid'
102
302
  || (targetState === 'error'
103
- && error.code !== 'awCapabilityUnsupported'
104
303
  && error.dependencyPluginId === undefined)
105
304
  ? 'blocking'
106
305
  : 'warning',
@@ -119,20 +318,16 @@ function sourceRequestedRef(source, cliVersion) {
119
318
  }
120
319
  function selectedPlatforms(value) {
121
320
  const selection = value === undefined ? 'both' : parsePlatformValue(value);
122
- return selection === 'both' ? ['codex', 'claude'] : [selection];
321
+ if (selection === 'both')
322
+ return ['codex', 'claude'];
323
+ if (selection === 'codex' || selection === 'claude')
324
+ return [selection];
325
+ throw new Error('statusPlatformAdapterRequired: use recovery status for this platform.');
123
326
  }
124
327
  function selectedScopes(value) {
125
328
  return value === undefined ? ['user', 'project'] : [parseScopeValue(value)];
126
329
  }
127
- function emptyIntent() {
128
- return {
129
- schemaVersion: 1,
130
- kind: 'aw-plugin-intents',
131
- roots: [],
132
- dependencyScopeOverrides: [],
133
- managed: { codexPluginIds: [] },
134
- };
135
- }
330
+ const emptyIntent = createEmptyNativeDemandView;
136
331
  function desiredTargetKey(pluginId, platform) {
137
332
  return `${pluginId}\0${platform}`;
138
333
  }
@@ -193,6 +388,12 @@ function calculateDesiredTargetStates(options) {
193
388
  : 'dependency',
194
389
  depth: platformRoots.some((root) => root.pluginId === pluginId) ? 0 : 1,
195
390
  allowedScopes,
391
+ ...(scope === 'project'
392
+ && !platformRoots.some((root) => root.pluginId === pluginId)
393
+ && entry.states?.[platform]?.user?.state === 'present'
394
+ && !entry.states[platform]?.user?.errors.some((error) => error.severity === 'blocking')
395
+ ? { preferredScope: 'user', preferredScopeReason: 'existingWiderTarget' }
396
+ : {}),
196
397
  }];
197
398
  });
198
399
  const nodeIds = new Set(nodes.map((node) => node.pluginId));
@@ -218,7 +419,7 @@ function calculateDesiredTargetStates(options) {
218
419
  nodes,
219
420
  roots,
220
421
  dependencyEdges: edges,
221
- scopeOverrides: intent.dependencyScopeOverrides.filter((override) => nodeIds.has(override.pluginId)
422
+ scopeOverrides: (intent.dependencyScopeOverrides ?? []).filter((override) => nodeIds.has(override.pluginId)
222
423
  && (override.platform === undefined || override.platform === platform)),
223
424
  });
224
425
  for (const target of plan.targets) {
@@ -226,66 +427,135 @@ function calculateDesiredTargetStates(options) {
226
427
  }
227
428
  }
228
429
  }
229
- for (const intent of [options.userIntent, options.projectIntent]) {
230
- for (const codexPluginId of intent.managed.codexPluginIds) {
231
- for (const [pluginId, entry] of byId) {
232
- if (entry.codex?.pluginId !== codexPluginId)
233
- continue;
234
- const key = desiredTargetKey(pluginId, 'codex');
235
- if (!desired.has(key))
236
- desired.set(key, { scopes: new Set(), relation: 'managed' });
237
- }
238
- }
239
- }
240
430
  return new Map([...desired].map(([key, value]) => [key, {
241
431
  scopes: [...value.scopes].sort(),
242
432
  relation: value.relation,
243
433
  }]));
244
434
  }
245
- function statusRecovery(options) {
246
- if (options.errorCodes?.some((code) => code === 'codexProjectPluginVersionTooLow'
247
- || code === 'codexProjectPluginUnsupported'
248
- || code === 'codexSystemCliUnsupported')) {
435
+ function projectDependencyClosureForTarget(options) {
436
+ const platform = options.platform;
437
+ if (platform !== 'codex' && platform !== 'claude')
438
+ return new Set();
439
+ const byId = new Map(options.available.map((entry) => [
440
+ formatPluginId({ sourceId: entry.source.id, pluginName: entry.name }),
441
+ entry,
442
+ ]));
443
+ const closure = new Set();
444
+ const visit = (pluginId) => {
445
+ const entry = byId.get(pluginId);
446
+ if (!entry)
447
+ return;
448
+ for (const dependency of entry.dependencies) {
449
+ const dependencyId = formatPluginId({
450
+ sourceId: entry.source.id,
451
+ pluginName: dependency,
452
+ });
453
+ const dependencyEntry = byId.get(dependencyId);
454
+ if (!dependencyEntry
455
+ || (!dependencyEntry.targets[platform].user
456
+ && !dependencyEntry.targets[platform].project)
457
+ || closure.has(dependencyId)) {
458
+ continue;
459
+ }
460
+ closure.add(dependencyId);
461
+ visit(dependencyId);
462
+ }
463
+ };
464
+ visit(options.pluginId);
465
+ return closure;
466
+ }
467
+ export function statusRecovery(options) {
468
+ if (options.errorCodes?.includes('removedPluginCleanupRequired')) {
469
+ return [{
470
+ command: 'cleanup',
471
+ description: '整体清理已删除插件在两个平台、用户与当前项目中的安装、设置和遗留记录。',
472
+ }];
473
+ }
474
+ if (options.errorCodes?.some((code) => code === 'codexProjectPluginUnsupported' || code === 'codexSystemCliUnsupported')) {
249
475
  return [{
250
476
  command: 'manual',
251
477
  description: '升级或修复官方 system Codex CLI 后重试原操作。',
252
478
  }];
253
479
  }
254
- if (options.actual === 'ready' || options.actual === 'absent')
480
+ if (options.errorCodes?.includes('awCapabilityUnsupported')) {
481
+ return [{
482
+ command: 'manual',
483
+ description: '升级 AW CLI 到支持插件所需 capability 的版本后重试。',
484
+ }];
485
+ }
486
+ if (options.errorCodes?.includes('dependencyGraphInvalid')) {
487
+ return [{
488
+ command: 'manual',
489
+ description: '修复 Catalog 中的插件依赖循环后重试。',
490
+ }];
491
+ }
492
+ if (options.state === 'ready' || options.state === 'absent')
255
493
  return [];
256
- if (options.actual === 'orphaned') {
494
+ if (options.desired.scopes.length === 0
495
+ && options.sharedNative?.state === 'replaceable'
496
+ && options.sharedNative.reason === 'damaged') {
497
+ return [
498
+ ...(options.actualEnabled ? [{
499
+ command: 'cleanup',
500
+ ...(options.scope ? { scope: options.scope } : {}),
501
+ description: `仅清理 ${options.scope ?? '当前'} scope 的激活;不会修复或删除损坏的共享内容。`,
502
+ }] : []),
503
+ {
504
+ command: 'manual',
505
+ description: `共享内容已损坏。先确认本机 Agent 选择,明确 user 或 project 使用范围,再运行 aw plugin install ${options.pluginId} --scope <user|project> 重建。`,
506
+ },
507
+ ];
508
+ }
509
+ if (options.state === 'orphaned') {
257
510
  return [{ command: 'cleanup', description: '清理可证明属于 AW 的遗留输出。' }];
258
511
  }
259
- if (options.actual === 'unresolved') {
512
+ if (options.state === 'blocked' && options.errorCodes?.some((code) => code === 'sourceMissing'
513
+ || code === 'catalogSourceUnavailable'
514
+ || code === 'bundleUnavailable'
515
+ || code === 'codexIntentSourceUnavailable')) {
260
516
  return [
261
517
  { command: 'sync', description: '来源恢复后同步 desired intent。' },
262
518
  { command: 'cleanup', description: '来源无法恢复时清理可证明属于 AW 的输出。' },
263
519
  ];
264
520
  }
265
- if (options.actual === 'conflict') {
521
+ if (options.state === 'blocked') {
266
522
  if (options.desired.scopes.includes('user') && options.desired.scopes.includes('project')) {
267
- return ['user', 'project'].flatMap((scope) => (options.conflictRoots?.[scope] ?? []).map((rootPluginId) => ({
268
- command: 'uninstall',
269
- scope,
270
- description: `运行 aw uninstall ${rootPluginId} --platform ${options.platform} --scope ${scope},再运行 aw sync ${options.pluginId} --platform ${options.platform} --scope ${scope === 'user' ? 'project' : 'user'}。`,
271
- })));
523
+ return ['user', 'project'].flatMap((scope) => {
524
+ const retainedScope = scope === 'user' ? 'project' : 'user';
525
+ const retainedRoot = options.conflictRoots?.[retainedScope]?.[0];
526
+ if (!retainedRoot)
527
+ return [];
528
+ return (options.conflictRoots?.[scope] ?? []).map((rootPluginId) => ({
529
+ command: 'uninstall',
530
+ scope,
531
+ description: `运行 aw plugin remove ${rootPluginId} --only requirements --scope ${scope},再运行 aw plugin remove --only outputs ${rootPluginId} --target ${options.platform} --scope ${scope},最后运行 aw plugin sync ${retainedRoot} --target ${options.platform} --context ${retainedScope}。`,
532
+ }));
533
+ });
272
534
  }
273
- const collision = options.sharedNative?.state === 'foreign'
535
+ const collision = options.sharedNative?.state === 'blocked'
274
536
  ? `Codex shared native ${options.sharedNative.pluginId}`
275
537
  : `${options.pluginId} 的 foreign extension`;
276
538
  return [
277
539
  {
278
540
  command: 'sync',
279
- description: `先移除或重命名 ${collision},再运行 aw sync ${options.pluginId} --platform ${options.platform}。cleanup 会保留 foreign 内容,不会删除该冲突。`,
541
+ description: `先移除或重命名 ${collision},再运行 aw plugin sync ${options.pluginId} --target ${options.platform} --context ${options.scope ?? 'user'}。cleanup 会保留 foreign 内容,不会删除该冲突。`,
280
542
  },
281
543
  ];
282
544
  }
545
+ if (options.dependencyMoves?.length) {
546
+ const rootScope = options.desired.scopes[0] ?? 'project';
547
+ const removeDependencies = options.dependencyMoves.map((move) => `aw plugin remove --only outputs ${move.pluginId} --target ${options.platform} --scope ${move.fromScope}`);
548
+ return [{
549
+ command: 'manual',
550
+ description: `先按依赖保护提示依次移除 ${options.dependencyMoves.map((move) => move.pluginId).join('、')} 的所有直接和间接依赖者;若命令报告 dependencyStillRequired,继续处理提示的其他依赖者。再运行 ${removeDependencies.join(',再运行 ')} 移除依赖旧位置。最后确认本机 Agent 选择,逐个按原 scope 重新添加全部已移除 root,由联合需求重新确定提供位置;当前 root 的示例命令是 aw plugin install ${options.pluginId} --scope ${rootScope}。`,
551
+ }];
552
+ }
283
553
  return [{
284
- command: options.actual === 'drifted' ? 'reinstall' : 'sync',
554
+ command: options.errorCodes?.some((code) => code === 'codexSharedNativeCorrupt'
555
+ || code === 'codexActivationDrift'
556
+ || code === 'codexExtensionDrift') ? 'reinstall' : 'sync',
285
557
  ...(options.desired.scopes.length === 1 ? { scope: options.desired.scopes[0] } : {}),
286
- description: options.actual === 'drifted'
287
- ? '重新安装以修复手动修改或损坏的现场。'
288
- : '同步 desired intent 和当前现场。',
558
+ description: '同步 desired intent 和当前现场;现场损坏时使用重新安装修复。',
289
559
  }];
290
560
  }
291
561
  function rootIntentsForTarget(options) {
@@ -358,41 +628,59 @@ export function projectTargetRevision(availableVersion, installedVersion) {
358
628
  return { state: 'upgradeAvailable', availableVersion, installedVersion };
359
629
  return { state: 'unknown', availableVersion, installedVersion };
360
630
  }
361
- function renderStatusV6(payload, verbose) {
631
+ function renderStatusV8(payload, verbose) {
362
632
  const lines = [`Catalog sources: ${payload.catalog.sources.length}`];
363
633
  for (const source of payload.catalog.sources) {
364
634
  lines.push(`${source.primary ? '*' : '-'} ${source.id}: ${source.error ?? source.freshness ?? 'unavailable'}`);
365
635
  }
366
636
  for (const target of payload.targets) {
367
- const errors = target.errors.length > 0
368
- ? ` [${target.errors.map((error) => `${error.code}: ${error.message}`).join('; ')}]`
637
+ const reasons = target.reasons.length > 0
638
+ ? ` [${target.reasons.map((reason) => reason.message.startsWith(`${reason.code}:`)
639
+ ? reason.message : `${reason.code}: ${reason.message}`).join('; ')}]`
369
640
  : '';
370
- const desired = target.desired.enabled ? target.desired.scopes.join('+') : 'absent';
371
- lines.push(`${target.pluginId} ${target.platform}: desired=${desired} actual=${target.actual.state}${errors}`);
372
- if (target.sharedNative) {
373
- lines.push(` shared native ${target.sharedNative.pluginId}: ${target.sharedNative.state}`);
641
+ if (target.platform === 'claude') {
642
+ lines.push(`${target.pluginId} ${target.platform} (${target.scope}): ${target.state}${reasons}`);
374
643
  }
375
- if (target.activation) {
376
- lines.push(` activation user=${String(target.activation.user)} project=${String(target.activation.project)} (${target.activation.evidence})`);
377
- if (target.activation.systemConsumer) {
378
- const version = 'detectedVersion' in target.activation.systemConsumer
379
- ? ` ${target.activation.systemConsumer.detectedVersion}`
380
- : '';
381
- lines.push(` system Codex consumer: ${target.activation.systemConsumer.state}${version}`);
644
+ else {
645
+ lines.push(`${target.pluginId} ${target.platform}: ${target.state}${reasons}`);
646
+ const desiredScopes = target.placements.filter((placement) => placement.components.some((component) => component.kind === 'intent' && component.metadata?.enabled === true))
647
+ .map((placement) => placement.scope);
648
+ const actualScopes = target.placements.filter((placement) => placement.components.some((component) => component.kind === 'activation'
649
+ && component.key === placement.scope
650
+ && component.state === 'enabled'))
651
+ .map((placement) => placement.scope);
652
+ const usage = (scopes) => scopes.length === 0
653
+ ? 'disabled'
654
+ : scopes.length === 2 ? 'user+project' : scopes[0];
655
+ lines.push(` desired use: ${usage(desiredScopes)}`);
656
+ lines.push(` actual use: ${usage(actualScopes)}`);
657
+ const shared = target.components.find((component) => component.kind === 'sharedNative');
658
+ if (shared)
659
+ lines.push(` shared content: ${shared.state} (${shared.key})`);
660
+ for (const placement of target.placements) {
661
+ lines.push(` ${placement.scope}: ${placement.state}`);
382
662
  }
383
663
  }
384
- if (target.extensions) {
385
- lines.push(` extensions ${target.extensions.kinds.join(',')}: ${target.extensions.state}`);
386
- }
387
664
  if (verbose) {
388
665
  for (const component of target.components) {
389
- const error = component.error
390
- ? ` [${component.error.code}: ${component.error.message}]`
391
- : '';
392
- lines.push(` component ${component.key}: ${component.state}${error}`);
666
+ lines.push(` component ${component.kind}/${component.key}: ${component.state}`);
667
+ }
668
+ if (target.platform === 'codex') {
669
+ for (const placement of target.placements) {
670
+ lines.push(` placement ${placement.scope}: ${placement.state}`);
671
+ for (const component of placement.components) {
672
+ lines.push(` component ${component.kind}/${component.key}: ${component.state}`);
673
+ }
674
+ }
675
+ }
676
+ for (const action of target.recoveryActions) {
677
+ lines.push(` recovery ${action.command}: ${action.description}`);
393
678
  }
394
679
  }
395
680
  }
681
+ for (const issue of payload.configIssues ?? []) {
682
+ lines.push(`Warning: ${issue.pluginId} config ${issue.key} has an unsupported project override; user/default is effective. Unset the project value.`);
683
+ }
396
684
  for (const error of payload.errors)
397
685
  lines.push(`Error: ${error.message}`);
398
686
  return lines.join('\n');
@@ -415,29 +703,89 @@ function collisionRootIssueId(options) {
415
703
  options.collision.artifactKey,
416
704
  ].join(':');
417
705
  }
418
- export async function statusCommandV6(options) {
706
+ async function statusCommandV8InSession(options) {
707
+ const throwIfCancelled = (error) => {
708
+ if (error instanceof Error && error.name === 'AbortError')
709
+ throw error;
710
+ options.signal?.throwIfAborted();
711
+ };
712
+ throwIfCancelled();
419
713
  const env = options.env ?? process.env;
420
714
  const dependencyPluginCache = new Map();
421
715
  const dependencyInspectionCache = new Map();
422
716
  const cliVersion = options.cliVersion ?? assertStrictSemVer(JSON.parse(fs.readFileSync(path.join(resolveCliPackageRoot(), 'package.json'), 'utf8')).version, 'packages/cli/package.json version');
423
717
  const snapshot = await readCatalogSourcesConfigSnapshot(env);
424
- const intentErrors = [];
425
- const readIntent = async (scope) => {
718
+ throwIfCancelled();
719
+ const scope = options.scope === 'project' ? 'project' : 'user';
720
+ const demand = options.recoveryDemand ?? await readDemand({
721
+ scope, cwd: options.cwd, env, catalogOperationContext: options.catalogOperationContext, signal: options.signal,
722
+ });
723
+ throwIfCancelled();
724
+ const observedDemands = new Map([[scope, demand]]);
725
+ if (options.scope !== 'user') {
726
+ const otherScope = scope === 'user' ? 'project' : 'user';
426
727
  try {
427
- return await readPluginIntentState({ scope, cwd: options.cwd, env });
728
+ observedDemands.set(otherScope, await readDemand({ scope: otherScope, cwd: options.cwd,
729
+ env, catalogOperationContext: options.catalogOperationContext, signal: options.signal }));
730
+ }
731
+ catch (error) {
732
+ throwIfCancelled(error); /* The other scope remains unknown; current scope stays readable. */
733
+ }
734
+ }
735
+ const selectedPlatformsByScope = new Map();
736
+ for (const [demandScope, scopedDemand] of observedDemands) {
737
+ try {
738
+ selectedPlatformsByScope.set(demandScope, selectAgents({
739
+ preferences: scopedDemand.preferences,
740
+ ...(demandScope === scope ? options.recoverySelection : {}),
741
+ }).agents.flatMap((agent) => agent === 'codex' ? ['codex']
742
+ : agent === 'claude' ? ['claude'] : []));
428
743
  }
429
744
  catch {
745
+ selectedPlatformsByScope.set(demandScope, []);
746
+ }
747
+ }
748
+ const projectObservationPlatforms = selectedPlatformsByScope.get('project') ?? [];
749
+ const intentErrors = [];
750
+ const readIntent = async (scope) => {
751
+ let observation;
752
+ const scopedDemand = observedDemands.get(scope);
753
+ if (scopedDemand) {
754
+ try {
755
+ const protective = demandNativeProjection(scopedDemand);
756
+ // A protective execution view includes every supported Native platform. Status
757
+ // demand is limited to selected Agents; live residue is observed separately.
758
+ const value = { ...protective, roots: protective.roots.flatMap((root) => {
759
+ const platforms = root.platforms.filter((platform) => selectedPlatformsByScope.get(scope)?.includes(platform));
760
+ return platforms.length ? [{ ...root, platforms }] : [];
761
+ }) };
762
+ observation = scopedDemand.intent.state === 'absent' ? { state: 'absent' }
763
+ : { state: 'ready', value };
764
+ }
765
+ catch {
766
+ observation = { state: 'invalid', code: 'pluginIntentStateInvalid', message: '声明或偏好无效。' };
767
+ }
768
+ }
769
+ else
770
+ observation = options.scope === 'user' ? { state: 'absent' }
771
+ : { state: 'unavailable', code: 'pluginIntentStateUnavailable', message: '另一范围需求不可读。' };
772
+ if (observation.state === 'invalid') {
430
773
  intentErrors.push({
431
774
  code: 'pluginIntentStateInvalid',
432
775
  message: `pluginIntentStateInvalid: ${scope} plugin intent state is invalid.`,
433
776
  });
434
- return emptyIntent();
435
777
  }
778
+ return observation;
436
779
  };
437
- const [userIntent, projectIntent] = await Promise.all([
780
+ const [userIntentObservation, initialProjectIntentObservation] = await Promise.all([
438
781
  readIntent('user'),
439
782
  readIntent('project'),
440
783
  ]);
784
+ const userIntent = userIntentObservation.state === 'ready'
785
+ ? userIntentObservation.value : emptyIntent();
786
+ let projectIntentObservation = initialProjectIntentObservation;
787
+ let projectIntent = projectIntentObservation.state === 'ready'
788
+ ? projectIntentObservation.value : emptyIntent();
441
789
  const codexConfigErrors = [];
442
790
  const readActivationConfig = async (scope) => {
443
791
  try {
@@ -452,23 +800,48 @@ export async function statusCommandV6(options) {
452
800
  return undefined;
453
801
  }
454
802
  };
803
+ const codexScopePathsAlias = codexProjectConfigAliasesUserHome(options.cwd, env);
455
804
  const [userCodexConfig, projectCodexConfig] = await Promise.all([
456
805
  readActivationConfig('user'),
457
- readActivationConfig('project'),
806
+ options.scope === 'user' || codexScopePathsAlias ? undefined : readActivationConfig('project'),
458
807
  ]);
459
- const currentProjectKey = await resolveCanonicalRepoProjectKey(options.cwd);
460
- const currentProjectLocationKey = createProjectLocationKey(currentProjectKey);
461
- const codexScopePathsAlias = codexProjectConfigAliasesUserHome(options.cwd, env);
808
+ let projectRoot;
809
+ try {
810
+ projectRoot = await resolveRequiredCanonicalRepoRoot(options.cwd);
811
+ }
812
+ catch (error) {
813
+ if (error instanceof Error && error.name === 'AbortError')
814
+ throw error;
815
+ if (options.scope === 'project') {
816
+ projectIntentObservation = {
817
+ state: 'unavailable', code: 'pluginIntentStateUnavailable',
818
+ message: '无法确定当前项目位置,不能读取插件声明。',
819
+ };
820
+ projectIntent = emptyIntent();
821
+ if (!intentErrors.some((error) => error.message.includes('project plugin intent'))) {
822
+ intentErrors.push({ code: 'pluginIntentStateInvalid',
823
+ message: 'pluginIntentStateInvalid: project plugin intent state is unavailable.' });
824
+ }
825
+ }
826
+ }
827
+ const currentProjectKey = projectRoot;
828
+ const currentProjectLocationKey = currentProjectKey
829
+ ? createProjectLocationKey(currentProjectKey) : undefined;
462
830
  const inventoryErrors = [];
463
831
  const readInventory = options.inventoryCatalogSourceReferences
464
832
  ?? inventoryCatalogSourceReferences;
465
- const ownerInventory = await readInventory({ cwd: options.cwd, env }).catch(async (error) => {
833
+ const ownerInventory = await readInventory({ cwd: options.cwd, env,
834
+ ...(options.scope === 'user' ? { scope: 'user' } : { includeProjectAgentSkills: true }) }).catch(async (error) => {
835
+ throwIfCancelled(error);
466
836
  inventoryErrors.push(projectStateInventoryError(error, env, options.cwd));
467
- return inventoryLegacyOwnerReferences({ cwd: options.cwd, env }).catch((fallbackError) => {
837
+ return inventoryLegacyOwnerReferences({ cwd: options.cwd, env,
838
+ ...(options.scope === 'user' ? { scope: 'user' } : { includeProjectAgentSkills: true }) }).catch((fallbackError) => {
839
+ throwIfCancelled(fallbackError);
468
840
  inventoryErrors.push(projectStateInventoryError(fallbackError, env, options.cwd));
469
841
  return { inventorySchemaVersion: 1, references: [], errors: [] };
470
842
  });
471
843
  });
844
+ throwIfCancelled();
472
845
  for (const error of ownerInventory.errors ?? []) {
473
846
  const code = error.kind === 'nativeStateRead' ? 'nativeStateUnreadable' : 'stateInventoryFailed';
474
847
  inventoryErrors.push({
@@ -477,6 +850,55 @@ export async function statusCommandV6(options) {
477
850
  relevance: error.relevance,
478
851
  });
479
852
  }
853
+ const nativeCliRunner = options.nativeCliRunner ?? getDefaultNativeCliRunner();
854
+ let codexSystemConsumerInspection;
855
+ const inspectCodexSystemConsumer = (scope) => {
856
+ throwIfCancelled();
857
+ let inspection = codexSystemConsumerInspection;
858
+ if (!inspection) {
859
+ inspection = inspectSystemCodex({
860
+ runner: nativeCliRunner,
861
+ cwd: options.cwd,
862
+ env,
863
+ signal: options.signal,
864
+ operationRequirement: getCodexOperationRequirement(scope),
865
+ }).then((result) => {
866
+ throwIfCancelled();
867
+ if (result.state === 'compatible') {
868
+ options.codexObservationSession.setManager(result.manager);
869
+ }
870
+ return result;
871
+ });
872
+ codexSystemConsumerInspection = inspection;
873
+ }
874
+ return inspection;
875
+ };
876
+ const codexRegistrationCache = new Map();
877
+ const inspectCodexRegistration = async (pluginId, scope) => {
878
+ const consumer = await inspectCodexSystemConsumer(scope);
879
+ throwIfCancelled();
880
+ if (consumer.state !== 'compatible') {
881
+ return {
882
+ observation: { state: 'unobserved' },
883
+ observations: { user: false, project: false },
884
+ activations: {},
885
+ };
886
+ }
887
+ let inspection = codexRegistrationCache.get(pluginId);
888
+ if (!inspection) {
889
+ inspection = inspectCodexPluginRegistrationLive({
890
+ pluginId,
891
+ cwd: options.cwd,
892
+ env,
893
+ nativeCliRunner,
894
+ manager: consumer.manager,
895
+ scope: options.scope === 'user' ? 'user' : 'both',
896
+ observationSession: options.codexObservationSession,
897
+ });
898
+ codexRegistrationCache.set(pluginId, inspection);
899
+ }
900
+ return inspection;
901
+ };
480
902
  const nativeProbeCache = new Map();
481
903
  const codexDesiredUserActivationIds = new Set();
482
904
  const readOnlyNativeProbe = (probe) => async () => {
@@ -486,17 +908,34 @@ export async function statusCommandV6(options) {
486
908
  probe.platform,
487
909
  probe.scope,
488
910
  probe.marketplaceName,
911
+ String(probe.desired),
489
912
  ].join('\0');
490
913
  let value = nativeProbeCache.get(key);
491
914
  if (!value) {
915
+ const hasLocalResidue = ownerInventory.references.some((reference) => (reference.kind === 'namespacedOwner' || reference.kind === 'namespacedMarketplace')
916
+ && reference.sourceId === probe.sourceId
917
+ && reference.pluginName === probe.pluginName
918
+ && reference.platform === probe.platform);
492
919
  value = probe.platform === 'codex'
493
- ? inspectCodexNativeResidue({
494
- pluginName: probe.pluginName,
495
- cwd: options.cwd,
496
- env,
497
- marketplaceName: probe.marketplaceName,
498
- marketplaceRoot: probe.marketplaceRoot,
499
- }).then((residue) => residue.state)
920
+ ? inspectCodexRegistration(`${probe.pluginName}@${probe.marketplaceName}`, options.scope === undefined ? probe.scope : scopes[0]).then((registration) => {
921
+ if (registration.observation.state === 'failed') {
922
+ throw new Error('codexNativeObservationFailed: status requires Codex plugin list evidence.');
923
+ }
924
+ if (registration.observation.state === 'unobserved') {
925
+ return probe.desired || hasLocalResidue ? 'partial' : 'absent';
926
+ }
927
+ if (registration.observation.value === 'absent')
928
+ return 'absent';
929
+ if (!userCodexConfig || (probe.scope === 'project' && !projectCodexConfig)) {
930
+ return 'partial';
931
+ }
932
+ const configEnabled = (probe.scope === 'user'
933
+ ? userCodexConfig
934
+ : projectCodexConfig)?.snapshot.plugins[`${probe.pluginName}@${probe.marketplaceName}`]?.enabled === true;
935
+ return configEnabled
936
+ ? 'present'
937
+ : 'partial';
938
+ })
500
939
  : Promise.resolve(ownerInventory.references.some((reference) => (reference.kind === 'namespacedOwner' || reference.kind === 'namespacedMarketplace')
501
940
  && reference.sourceId === probe.sourceId
502
941
  && reference.sourceIdentity === probe.sourceIdentity
@@ -519,20 +958,36 @@ export async function statusCommandV6(options) {
519
958
  const configured = new Map(snapshot.config.sources.map((source) => [source.id, source]));
520
959
  const requested = options.plugins ?? [];
521
960
  const platforms = selectedPlatforms(options.platform);
961
+ const coversPlatform = (value) => (value === 'codex' || value === 'claude') && platforms.includes(value);
522
962
  const scopes = selectedScopes(options.scope);
523
- const codexSystemConsumerInspections = new Map();
524
- const inspectCodexSystemConsumer = (scope) => {
525
- let inspection = codexSystemConsumerInspections.get(scope);
526
- if (!inspection) {
527
- inspection = inspectSystemCodexFilesystem({
528
- cwd: options.cwd,
529
- env,
530
- operationRequirement: getCodexOperationRequirement(scope),
531
- });
532
- codexSystemConsumerInspections.set(scope, inspection);
963
+ const installedPortableByScope = new Map();
964
+ for (const scope of scopes) {
965
+ const preferences = observedDemands.get(scope)?.preferences;
966
+ if (preferences?.state !== 'valid' || !preferences.value.targets.includes('generic'))
967
+ continue;
968
+ try {
969
+ const context = await createScopeContext({ scope, cwd: options.cwd, env, readOnly: true });
970
+ try {
971
+ const installed = await inspectPortableExtraInstalled({ scope, context, env: context.env, signal: options.signal });
972
+ installedPortableByScope.set(scope, installed.targets);
973
+ }
974
+ finally {
975
+ await context.dispose();
976
+ }
533
977
  }
534
- return inspection;
535
- };
978
+ catch (error) {
979
+ throwIfCancelled(error);
980
+ }
981
+ }
982
+ const userDemand = observedDemands.get('user');
983
+ const projectDemand = observedDemands.get('project');
984
+ const configRequirementKey = (pluginId, scope, target) => `${pluginId}\0${scope}\0${target}`;
985
+ const requiredConfigTargets = new Set(userDemand ? deriveJointDemand({
986
+ context: { context: projectDemand ? 'project' : 'user', cwd: options.cwd,
987
+ scopes: projectDemand ? ['user', 'project'] : ['user'], ...(projectDemand && projectRoot ? { projectRoot } : {}) },
988
+ user: userDemand, project: projectDemand,
989
+ preferences: userDemand.preferences.state === 'valid' ? userDemand.preferences.value : null,
990
+ }).placements.flatMap((placement) => placement.contributions.map((contribution) => configRequirementKey(placement.pluginId, contribution.scope, placement.target))) : []);
536
991
  const selectorErrors = [];
537
992
  const parsedSelectors = [];
538
993
  const plannedSelectors = [];
@@ -554,7 +1009,7 @@ export async function statusCommandV6(options) {
554
1009
  const hasLiveReference = ownerInventory.references.some((reference) => (reference.kind === 'namespacedOwner' || reference.kind === 'namespacedMarketplace')
555
1010
  && reference.sourceId === parsed.sourceId
556
1011
  && reference.pluginName === parsed.pluginName
557
- && platforms.includes(reference.platform)
1012
+ && coversPlatform(reference.platform)
558
1013
  && scopes.includes(reference.scope)
559
1014
  && (reference.scope !== 'project' || reference.projectKey === currentProjectKey));
560
1015
  if (hasLiveReference) {
@@ -587,9 +1042,14 @@ export async function statusCommandV6(options) {
587
1042
  scopes,
588
1043
  currentProjectLocationKey,
589
1044
  }));
590
- const plannedSourceIds = requested.length === 0
1045
+ const selectorSourceIds = requested.length === 0
591
1046
  ? undefined
592
1047
  : planPluginSelectorSourceIds(plannedSelectors.map((selector) => selector.parsed));
1048
+ const plannedSourceIds = selectorSourceIds === undefined ? undefined : [...new Set([
1049
+ ...selectorSourceIds,
1050
+ ...(options.catalogOperationContext ? [] : [...observedDemands.values()].flatMap((entry) => entry.roots ?? []))
1051
+ .map((root) => root.sourceId).filter((id) => configured.has(id)),
1052
+ ])];
593
1053
  const selectedConfiguredSources = plannedSourceIds === undefined
594
1054
  ? snapshot.config.sources
595
1055
  : plannedSourceIds.map((sourceId) => configured.get(sourceId));
@@ -613,11 +1073,13 @@ export async function statusCommandV6(options) {
613
1073
  ? { operationContext: options.catalogOperationContext }
614
1074
  : {}),
615
1075
  env,
1076
+ signal: options.signal,
616
1077
  consume: async (resolution) => ({
617
1078
  primarySourceId: resolution.primarySourceId,
618
1079
  configDigest: resolution.configDigest,
619
1080
  compositeDigest: resolution.compositeDigest,
620
1081
  sources: await Promise.all(resolution.sources.map(async (item) => {
1082
+ throwIfCancelled();
621
1083
  const source = configured.get(item.sourceId);
622
1084
  const identity = identities.get(item.sourceId);
623
1085
  const base = {
@@ -636,17 +1098,50 @@ export async function statusCommandV6(options) {
636
1098
  };
637
1099
  }
638
1100
  try {
1101
+ const catalogEntriesByName = new Map(item.resolution.manifest.entries.map((entry) => [
1102
+ entry.name,
1103
+ entry,
1104
+ ]));
1105
+ const cyclicDependencyPluginNames = new Set();
1106
+ const dependencyVisitState = new Map();
1107
+ const dependencyVisitStack = [];
1108
+ const visitDependencyGraph = (pluginName) => {
1109
+ const state = dependencyVisitState.get(pluginName);
1110
+ if (state === 'visited')
1111
+ return;
1112
+ if (state === 'visiting') {
1113
+ const cycleStart = dependencyVisitStack.lastIndexOf(pluginName);
1114
+ for (const name of dependencyVisitStack.slice(cycleStart)) {
1115
+ cyclicDependencyPluginNames.add(name);
1116
+ }
1117
+ return;
1118
+ }
1119
+ dependencyVisitState.set(pluginName, 'visiting');
1120
+ dependencyVisitStack.push(pluginName);
1121
+ for (const dependencyName of catalogEntriesByName.get(pluginName)?.dependencies ?? []) {
1122
+ if (catalogEntriesByName.has(dependencyName))
1123
+ visitDependencyGraph(dependencyName);
1124
+ }
1125
+ dependencyVisitStack.pop();
1126
+ dependencyVisitState.set(pluginName, 'visited');
1127
+ };
1128
+ for (const pluginName of catalogEntriesByName.keys())
1129
+ visitDependencyGraph(pluginName);
639
1130
  const placementEntries = item.resolution.manifest.entries.map((entry) => {
640
- const products = entry.policy.products;
641
- const supports = (platform) => products === undefined
642
- || products.includes(platform === 'codex' ? 'CODEX' : 'CLAUDE');
1131
+ const supportedPlatforms = resolveCatalogEntrySupportedPlatforms(entry.policy);
643
1132
  return {
644
1133
  name: entry.name,
645
1134
  dependencies: entry.dependencies,
646
1135
  source: { id: item.resolution.sourceId },
647
1136
  targets: {
648
- codex: { user: supports('codex'), project: supports('codex') },
649
- claude: { user: supports('claude'), project: supports('claude') },
1137
+ codex: {
1138
+ user: supportedPlatforms.has('codex'),
1139
+ project: supportedPlatforms.has('codex'),
1140
+ },
1141
+ claude: {
1142
+ user: supportedPlatforms.has('claude'),
1143
+ project: supportedPlatforms.has('claude'),
1144
+ },
650
1145
  },
651
1146
  };
652
1147
  });
@@ -669,20 +1164,21 @@ export async function statusCommandV6(options) {
669
1164
  sourceId: item.resolution.sourceId,
670
1165
  pluginName: entry.name,
671
1166
  });
672
- if (sourceDesired.get(desiredTargetKey(pluginId, 'codex'))?.scopes.includes('user')) {
1167
+ if (options.scope === 'project'
1168
+ ? userCodexConfig?.snapshot.plugins[`${entry.name}@${desiredMarketplaceName}`]?.enabled === true
1169
+ : sourceDesired.get(desiredTargetKey(pluginId, 'codex'))?.scopes.includes('user')) {
673
1170
  codexDesiredUserActivationIds.add(`${entry.name}@${desiredMarketplaceName}`);
674
1171
  }
675
1172
  }
676
1173
  const plugins = await Promise.all(item.resolution.manifest.entries.map(async (entry) => {
1174
+ throwIfCancelled();
677
1175
  const capabilitySupport = checkAwCapabilitySupport(entry.requires.aw.capabilities ?? [], IMPLEMENTED_AW_CAPABILITIES);
678
1176
  if (!capabilitySupport.supported) {
679
- const products = entry.policy.products;
680
- const supports = (platform) => products === undefined
681
- || products.includes(platform === 'codex' ? 'CODEX' : 'CLAUDE');
1177
+ const supportedPlatforms = resolveCatalogEntrySupportedPlatforms(entry.policy);
682
1178
  const states = {};
683
1179
  const message = `awCapabilityUnsupported: ${item.resolution.sourceId}/${entry.name} requires unsupported AW capabilities: ${capabilitySupport.missing.join(', ')}.`;
684
1180
  for (const platform of ['codex', 'claude']) {
685
- if (!supports(platform))
1181
+ if (!supportedPlatforms.has(platform))
686
1182
  continue;
687
1183
  states[platform] = {};
688
1184
  for (const scope of ['user', 'project']) {
@@ -696,13 +1192,18 @@ export async function statusCommandV6(options) {
696
1192
  return {
697
1193
  name: entry.name,
698
1194
  version: entry.version,
699
- sharedNativePayloadDigest: entry.contentDigest,
700
1195
  displayName: entry.interface?.displayName ?? entry.name,
701
1196
  shortDescription: entry.interface?.shortDescription ?? entry.description,
702
1197
  description: entry.description,
703
1198
  targets: {
704
- claude: { user: supports('claude'), project: supports('claude') },
705
- codex: { user: supports('codex'), project: supports('codex') },
1199
+ claude: {
1200
+ user: supportedPlatforms.has('claude'),
1201
+ project: supportedPlatforms.has('claude'),
1202
+ },
1203
+ codex: {
1204
+ user: supportedPlatforms.has('codex'),
1205
+ project: supportedPlatforms.has('codex'),
1206
+ },
706
1207
  },
707
1208
  states,
708
1209
  dependencies: entry.dependencies,
@@ -713,31 +1214,91 @@ export async function statusCommandV6(options) {
713
1214
  const claude = supportsPlatform(plugin.manifest, 'claude');
714
1215
  const codex = supportsPlatform(plugin.manifest, 'codex');
715
1216
  const codexSurface = analyzeCodexSurface(plugin.manifest);
716
- const sharedNativePayloadDigest = codexSurface.nativeKinds.length > 0
717
- ? await calculateCodexSharedNativePayloadDigest(plugin.rootDir)
718
- : entry.contentDigest;
719
1217
  plugin.sourceId = item.resolution.sourceId;
720
1218
  plugin.sourceIdentity = item.resolution.sourceIdentity;
1219
+ plugin.catalogLogicalIdentity = item.resolution.logicalIdentity;
721
1220
  plugin.pluginId = formatPluginId({ sourceId: item.resolution.sourceId, pluginName: entry.name });
722
- let effectiveConfig;
1221
+ let configIssues;
723
1222
  let configDiagnostic;
724
- if (plugin.manifest.config?.schema) {
725
- try {
726
- effectiveConfig = await resolveEffectivePluginConfig({
727
- sourceId: plugin.sourceId,
728
- sourceIdentity: plugin.sourceIdentity,
729
- pluginName: plugin.manifest.name,
730
- manifest: plugin.manifest,
731
- cwd: options.cwd,
732
- env,
733
- });
734
- }
735
- catch {
736
- configDiagnostic = {
737
- code: 'configReadFailed',
738
- message: '插件设置当前不可读。未读取或显示设置值。',
739
- };
1223
+ if (plugin.manifest.config) {
1224
+ const issues = new Map();
1225
+ for (const scope of scopes) {
1226
+ const scopedDemand = observedDemands.get(scope);
1227
+ if (!scopedDemand)
1228
+ continue;
1229
+ // Strong preference errors are already reported through demand; never fall back to every platform.
1230
+ if (scopedDemand.preferences.state !== 'valid')
1231
+ continue;
1232
+ const active = resolveActiveConfigPlatforms(plugin.pluginId, plugin.manifest, scopedDemand.preferences);
1233
+ for (const platform of active) {
1234
+ const installed = platform === 'generic'
1235
+ ? installedPortableByScope.get(scope)?.some((target) => target.agent === platform && target.pluginId === plugin.pluginId
1236
+ && target.logicalIdentity === plugin.catalogLogicalIdentity)
1237
+ : ownerInventory.references.some((reference) => reference.platform === platform
1238
+ && reference.sourceId === plugin.sourceId && reference.pluginName === plugin.manifest.name
1239
+ && (reference.kind === 'namespacedOwner' || reference.kind === 'namespacedMarketplace')
1240
+ && (!reference.sourceIdentity || reference.sourceIdentity === plugin.sourceIdentity)
1241
+ && reference.scope === scope && (scope === 'user' || reference.projectKey === currentProjectKey));
1242
+ if (!installed && !requiredConfigTargets.has(configRequirementKey(plugin.pluginId, scope, platform)))
1243
+ continue;
1244
+ try {
1245
+ const resolved = scope === 'project'
1246
+ ? await resolveProjectArtifactRenderConfig({
1247
+ sourceId: plugin.sourceId,
1248
+ sourceIdentity: plugin.sourceIdentity,
1249
+ logicalIdentity: plugin.catalogLogicalIdentity,
1250
+ pluginName: plugin.manifest.name,
1251
+ manifest: plugin.manifest,
1252
+ platform,
1253
+ cwd: options.cwd,
1254
+ env,
1255
+ })
1256
+ : await resolveEffectivePluginConfig({
1257
+ sourceId: plugin.sourceId,
1258
+ sourceIdentity: plugin.sourceIdentity,
1259
+ logicalIdentity: plugin.catalogLogicalIdentity,
1260
+ pluginName: plugin.manifest.name,
1261
+ manifest: plugin.manifest,
1262
+ platform,
1263
+ targetScope: 'user',
1264
+ cwd: options.cwd,
1265
+ env,
1266
+ });
1267
+ for (const issue of resolved.issues) {
1268
+ const source = issue.source ?? 'missing';
1269
+ const configIssue = {
1270
+ scope,
1271
+ platform,
1272
+ type: issue.type,
1273
+ key: issue.key,
1274
+ title: resolved.schema[issue.key]?.title ?? issue.key,
1275
+ source,
1276
+ };
1277
+ issues.set(`${platform}\0${scope}\0${configIssue.type}\0${configIssue.key}\0${configIssue.source}`, configIssue);
1278
+ }
1279
+ for (const override of resolved.unsupportedLayerOverrides) {
1280
+ const configIssue = {
1281
+ scope,
1282
+ platform,
1283
+ type: override.type,
1284
+ key: override.key,
1285
+ title: resolved.schema[override.key]?.title ?? override.key,
1286
+ source: override.source,
1287
+ };
1288
+ issues.set(`${platform}\0${scope}\0${configIssue.type}\0${configIssue.key}\0${configIssue.source}`, configIssue);
1289
+ }
1290
+ }
1291
+ catch (error) {
1292
+ throwIfCancelled(error);
1293
+ configDiagnostic ??= {
1294
+ scope,
1295
+ code: 'configReadFailed',
1296
+ message: '插件设置当前不可读。未读取或显示设置值。',
1297
+ };
1298
+ }
1299
+ }
740
1300
  }
1301
+ configIssues = [...issues.values()];
741
1302
  }
742
1303
  const states = {};
743
1304
  const defaultMarketplaceName = item.resolution.sourceId === resolution.primarySourceId
@@ -764,6 +1325,7 @@ export async function statusCommandV6(options) {
764
1325
  for (const platform of ['codex', 'claude']) {
765
1326
  states[platform] = {};
766
1327
  for (const scope of ['user', 'project']) {
1328
+ throwIfCancelled();
767
1329
  if (platform === 'codex'
768
1330
  && scope === 'project'
769
1331
  && codexScopePathsAlias
@@ -811,9 +1373,10 @@ export async function statusCommandV6(options) {
811
1373
  },
812
1374
  context: {
813
1375
  env,
814
- nativeCliRunner: getDefaultNativeCliRunner(),
1376
+ nativeCliRunner,
815
1377
  reporter: createNoopReporter(),
816
1378
  debugLogger: createNoopDebugLogger(),
1379
+ codexObservationSession: options.codexObservationSession,
817
1380
  },
818
1381
  userActivationDesired: codexDesiredUserActivationIds,
819
1382
  nativeProbe: readOnlyNativeProbe({
@@ -824,7 +1387,10 @@ export async function statusCommandV6(options) {
824
1387
  scope,
825
1388
  marketplaceName,
826
1389
  marketplaceRoot,
1390
+ desired: sourceDesired.get(desiredTargetKey(plugin.pluginId, platform))
1391
+ ?.scopes.includes(scope) === true,
827
1392
  }),
1393
+ shallow: true,
828
1394
  });
829
1395
  const liveState = projectedLiveState({
830
1396
  inspection: inspected.inspection,
@@ -849,8 +1415,244 @@ export async function statusCommandV6(options) {
849
1415
  const dependencyErrors = [];
850
1416
  const dependencyReadiness = [];
851
1417
  const directDependencies = plugin.manifest.dependencies ?? [];
852
- if (directDependencies.length > 0
853
- && (liveState === 'present' || liveState === 'partial')) {
1418
+ const desiredInScope = sourceDesired.get(desiredTargetKey(plugin.pluginId, platform))?.scopes.includes(scope) === true;
1419
+ const codexPluginId = `${entry.name}@${marketplaceName}`;
1420
+ const actualCodexActivation = platform === 'codex'
1421
+ && (scope === 'user' ? userCodexConfig : projectCodexConfig)
1422
+ ?.snapshot.plugins[codexPluginId]?.enabled === true;
1423
+ const hasScopedExtensionResidue = platform === 'codex'
1424
+ && inspected.inspection.components.some((component) => component.component.kind !== 'native-plugin'
1425
+ && !component.component.identity.artifactKey.startsWith('activation-')
1426
+ && !component.component.identity.artifactKey.startsWith('marketplace-')
1427
+ && (component.state !== 'absent' || component.collision !== undefined));
1428
+ const dependencyPriority = {
1429
+ ready: 5,
1430
+ blockedByCollision: 4,
1431
+ incomplete: 3,
1432
+ error: 2,
1433
+ absent: 1,
1434
+ };
1435
+ function dependencyPlacementsFor(dependencyId, consumerScope) {
1436
+ const dependencyOverride = (consumerScope === 'project'
1437
+ ? projectIntent
1438
+ : userIntent).dependencyScopeOverrides.find((override) => override.pluginId === dependencyId
1439
+ && (override.platform === undefined || override.platform === platform));
1440
+ return dependencyOverride
1441
+ ? [dependencyOverride.scope]
1442
+ : consumerScope === 'project' ? ['project', 'user'] : ['user'];
1443
+ }
1444
+ async function inspectDependencyAtScope(dependencyName, dependencyScope) {
1445
+ const dependencyId = formatPluginId({
1446
+ sourceId: item.resolution.sourceId,
1447
+ pluginName: dependencyName,
1448
+ });
1449
+ const inspectionCacheKey = [
1450
+ item.resolution.sourceIdentity,
1451
+ dependencyId,
1452
+ platform,
1453
+ dependencyScope,
1454
+ dependencyScope === 'project' ? currentProjectKey : '',
1455
+ ].join('\0');
1456
+ if (cyclicDependencyPluginNames.has(dependencyName)) {
1457
+ return {
1458
+ state: 'error',
1459
+ dependencyScope,
1460
+ rootIssueId: `dependencyGraphInvalid:${dependencyId}`,
1461
+ rootIssueCode: 'dependencyGraphInvalid',
1462
+ issuePluginId: dependencyId,
1463
+ issueScope: dependencyScope,
1464
+ };
1465
+ }
1466
+ const cached = dependencyInspectionCache.get(inspectionCacheKey);
1467
+ if (cached)
1468
+ return cached;
1469
+ const inspection = (async () => {
1470
+ const dependencyEntry = item.resolution.manifest.entries.find((candidate) => candidate.name === dependencyName);
1471
+ if (!dependencyEntry) {
1472
+ return {
1473
+ state: 'absent',
1474
+ dependencyScope,
1475
+ rootIssueId: `dependencyMissing:${dependencyId}:${platform}:${dependencyScope}`,
1476
+ rootIssueCode: 'dependencyMissing',
1477
+ issuePluginId: dependencyId,
1478
+ issueScope: dependencyScope,
1479
+ };
1480
+ }
1481
+ const dependencySupport = checkAwCapabilitySupport(dependencyEntry.requires.aw.capabilities ?? [], IMPLEMENTED_AW_CAPABILITIES);
1482
+ if (!dependencySupport.supported) {
1483
+ return {
1484
+ state: 'error',
1485
+ dependencyScope,
1486
+ rootIssueId: `awCapabilityUnsupported:${dependencyId}`,
1487
+ rootIssueCode: 'awCapabilityUnsupported',
1488
+ issuePluginId: dependencyId,
1489
+ issueScope: dependencyScope,
1490
+ missingCapabilities: dependencySupport.missing,
1491
+ };
1492
+ }
1493
+ const pluginCacheKey = [item.resolution.sourceIdentity, dependencyId].join('\0');
1494
+ let dependencyPluginPromise = dependencyPluginCache.get(pluginCacheKey);
1495
+ if (!dependencyPluginPromise) {
1496
+ dependencyPluginPromise = readPluginManifest(path.join(item.resolution.rootDir, 'plugins', dependencyName), { mode: 'bundle' }).then((dependencyPlugin) => {
1497
+ dependencyPlugin.sourceId = item.resolution.sourceId;
1498
+ dependencyPlugin.sourceIdentity = item.resolution.sourceIdentity;
1499
+ dependencyPlugin.catalogLogicalIdentity = item.resolution.logicalIdentity;
1500
+ dependencyPlugin.pluginId = dependencyId;
1501
+ return dependencyPlugin;
1502
+ });
1503
+ dependencyPluginCache.set(pluginCacheKey, dependencyPluginPromise);
1504
+ }
1505
+ const dependencyPlugin = await dependencyPluginPromise;
1506
+ dependencyInspectionHookForTests?.();
1507
+ const dependencyMarketplaceName = marketplaceNameFor(dependencyName, platform, dependencyScope);
1508
+ const dependencyInspected = await inspectRebuildTarget({
1509
+ sourceId: item.resolution.sourceId,
1510
+ sourceIdentity: item.resolution.sourceIdentity,
1511
+ pluginId: dependencyId,
1512
+ marketplaceName: dependencyMarketplaceName,
1513
+ marketplaceRoot,
1514
+ plugin: dependencyPlugin,
1515
+ platform,
1516
+ scope: dependencyScope,
1517
+ cwd: options.cwd,
1518
+ catalog: { rootDir: item.resolution.rootDir, source: 'local' },
1519
+ context: {
1520
+ env,
1521
+ nativeCliRunner,
1522
+ reporter: createNoopReporter(),
1523
+ debugLogger: createNoopDebugLogger(),
1524
+ codexObservationSession: options.codexObservationSession,
1525
+ },
1526
+ userActivationDesired: codexDesiredUserActivationIds,
1527
+ nativeProbe: readOnlyNativeProbe({
1528
+ pluginName: dependencyName,
1529
+ sourceId: item.resolution.sourceId,
1530
+ sourceIdentity: item.resolution.sourceIdentity,
1531
+ platform,
1532
+ scope: dependencyScope,
1533
+ marketplaceName: dependencyMarketplaceName,
1534
+ marketplaceRoot,
1535
+ desired: sourceDesired.get(desiredTargetKey(dependencyId, platform))
1536
+ ?.scopes.includes(dependencyScope) === true,
1537
+ }),
1538
+ shallow: true,
1539
+ });
1540
+ const dependencyLiveState = projectedLiveState({
1541
+ inspection: dependencyInspected.inspection,
1542
+ required: dependencyInspected.target.desiredOwnedComponents
1543
+ ?? dependencyInspected.target.ownedComponents,
1544
+ optional: dependencyInspected.target.optionalOwnedComponents ?? [],
1545
+ });
1546
+ const collision = dependencyInspected.inspection.components.find((component) => component.collision)?.collision;
1547
+ if (collision) {
1548
+ return {
1549
+ state: 'blockedByCollision',
1550
+ dependencyScope,
1551
+ rootIssueId: collisionRootIssueId({
1552
+ pluginId: dependencyId,
1553
+ platform,
1554
+ scope: dependencyScope,
1555
+ collision,
1556
+ }),
1557
+ rootIssueCode: 'artifactCollision',
1558
+ issuePluginId: dependencyId,
1559
+ issueScope: dependencyScope,
1560
+ };
1561
+ }
1562
+ const requiredDependencyComponents = dependencyInspected.target
1563
+ .desiredOwnedComponents ?? dependencyInspected.target.ownedComponents;
1564
+ const desiredDependency = sourceDesired.get(desiredTargetKey(dependencyId, platform));
1565
+ const projectMigrationPending = dependencyScope === 'project'
1566
+ && projectIntent.dependencyScopeOverrides.some((override) => override.pluginId === dependencyId
1567
+ && override.scope === 'project'
1568
+ && (override.platform === undefined || override.platform === platform))
1569
+ && desiredDependency?.scopes.includes('project') === true
1570
+ && desiredDependency.scopes.includes('user') === false
1571
+ && ownerInventory.references.some((reference) => reference.kind === 'namespacedOwner'
1572
+ && reference.sourceId === item.resolution.sourceId
1573
+ && reference.pluginName === dependencyName
1574
+ && reference.platform === platform
1575
+ && reference.scope === 'user');
1576
+ const migrationOnlyPartial = dependencyLiveState === 'partial'
1577
+ && projectMigrationPending
1578
+ && dependencyInspected.inspection.components.every((component) => component.state === 'present' || component.state === 'absent')
1579
+ && requiredDependencyComponents.every((required) => dependencyInspected.inspection.components.some((component) => component.component === required
1580
+ && (component.state === 'present'
1581
+ || component.state === 'absent'
1582
+ && component.component.kind !== 'native-plugin'
1583
+ && 'locator' in component.component
1584
+ && component.component.locator.kind === 'codex-activation'
1585
+ && component.component.locator.desired === false)));
1586
+ const effectiveDependencyLiveState = migrationOnlyPartial
1587
+ ? 'present'
1588
+ : dependencyLiveState;
1589
+ if (effectiveDependencyLiveState !== 'present') {
1590
+ const state = effectiveDependencyLiveState === 'absent' ? 'absent'
1591
+ : effectiveDependencyLiveState === 'partial' ? 'incomplete'
1592
+ : 'error';
1593
+ return {
1594
+ state,
1595
+ dependencyScope,
1596
+ rootIssueId: state === 'absent'
1597
+ ? `dependencyMissing:${dependencyId}:${platform}:${dependencyScope}`
1598
+ : state === 'incomplete'
1599
+ ? `incompleteInstallation:${dependencyId}:${platform}:${dependencyScope}`
1600
+ : `diagnostic:${dependencyId}:${platform}:${dependencyScope}`,
1601
+ rootIssueCode: state === 'absent' ? 'dependencyMissing'
1602
+ : state === 'incomplete' ? 'incompleteInstallation' : 'diagnostic',
1603
+ issuePluginId: dependencyId,
1604
+ issueScope: dependencyScope,
1605
+ };
1606
+ }
1607
+ for (const childName of dependencyPlugin.manifest.dependencies ?? []) {
1608
+ const childId = formatPluginId({
1609
+ sourceId: item.resolution.sourceId,
1610
+ pluginName: childName,
1611
+ });
1612
+ let childResult;
1613
+ for (const childScope of dependencyPlacementsFor(childId, dependencyScope)) {
1614
+ const candidate = await inspectDependencyAtScope(childName, childScope);
1615
+ if (candidate.state === 'ready') {
1616
+ childResult = candidate;
1617
+ break;
1618
+ }
1619
+ if (!childResult
1620
+ || dependencyPriority[candidate.state]
1621
+ > dependencyPriority[childResult.state]) {
1622
+ childResult = candidate;
1623
+ }
1624
+ }
1625
+ if (childResult?.state !== 'ready') {
1626
+ return {
1627
+ ...childResult,
1628
+ dependencyScope,
1629
+ };
1630
+ }
1631
+ }
1632
+ return { state: 'ready', dependencyScope };
1633
+ })().catch((error) => {
1634
+ throwIfCancelled(error);
1635
+ return {
1636
+ state: 'error',
1637
+ dependencyScope,
1638
+ rootIssueId: `diagnostic:${dependencyId}:${platform}:${dependencyScope}`,
1639
+ rootIssueCode: 'diagnostic',
1640
+ issuePluginId: dependencyId,
1641
+ issueScope: dependencyScope,
1642
+ };
1643
+ });
1644
+ dependencyInspectionCache.set(inspectionCacheKey, inspection);
1645
+ return inspection;
1646
+ }
1647
+ // Inspect dependencies for returned live placements and selected project Agents.
1648
+ const dependencyObservationRequested = platforms.includes(platform) && scopes.includes(scope)
1649
+ || scope === 'project' && projectObservationPlatforms.includes(platform);
1650
+ if (dependencyObservationRequested && directDependencies.length > 0
1651
+ && (desiredInScope
1652
+ || actualCodexActivation
1653
+ || hasScopedExtensionResidue
1654
+ || (platform !== 'codex'
1655
+ && (liveState === 'present' || liveState === 'partial')))) {
854
1656
  for (const dependencyName of directDependencies) {
855
1657
  const dependencyId = formatPluginId({
856
1658
  sourceId: item.resolution.sourceId,
@@ -861,6 +1663,9 @@ export async function statusCommandV6(options) {
861
1663
  const rootIssueId = `dependencyMissing:${dependencyId}:${platform}:${scope}`;
862
1664
  dependencyReadiness.push({
863
1665
  dependencyPluginId: dependencyId,
1666
+ dependencyPlatform: platform,
1667
+ dependencyScope: scope,
1668
+ dependencyProject: scope === 'project' ? 'current' : null,
864
1669
  state: 'absent',
865
1670
  rootIssueId,
866
1671
  rootIssueCode: 'dependencyMissing',
@@ -869,6 +1674,9 @@ export async function statusCommandV6(options) {
869
1674
  code: 'dependencyMissing',
870
1675
  message: `dependencyMissing: ${dependencyId} is not available in the current source snapshot.`,
871
1676
  dependencyPluginId: dependencyId,
1677
+ dependencyPlatform: platform,
1678
+ dependencyScope: scope,
1679
+ dependencyProject: scope === 'project' ? 'current' : null,
872
1680
  rootIssueId,
873
1681
  rootIssueCode: 'dependencyMissing',
874
1682
  }, 'partial'));
@@ -879,6 +1687,9 @@ export async function statusCommandV6(options) {
879
1687
  const rootIssueId = `awCapabilityUnsupported:${dependencyId}`;
880
1688
  dependencyReadiness.push({
881
1689
  dependencyPluginId: dependencyId,
1690
+ dependencyPlatform: platform,
1691
+ dependencyScope: scope,
1692
+ dependencyProject: scope === 'project' ? 'current' : null,
882
1693
  state: 'error',
883
1694
  rootIssueId,
884
1695
  rootIssueCode: 'awCapabilityUnsupported',
@@ -887,111 +1698,20 @@ export async function statusCommandV6(options) {
887
1698
  code: 'awCapabilityUnsupported',
888
1699
  message: `awCapabilityUnsupported: ${dependencyId} requires unsupported AW capabilities: ${dependencySupport.missing.join(', ')}.`,
889
1700
  dependencyPluginId: dependencyId,
1701
+ dependencyPlatform: platform,
1702
+ dependencyScope: scope,
1703
+ dependencyProject: scope === 'project' ? 'current' : null,
890
1704
  rootIssueId,
891
1705
  rootIssueCode: 'awCapabilityUnsupported',
892
1706
  }, 'partial'));
893
1707
  continue;
894
1708
  }
895
- const pluginCacheKey = [item.resolution.sourceIdentity, dependencyId].join('\0');
896
- let dependencyPluginPromise = dependencyPluginCache.get(pluginCacheKey);
897
- if (!dependencyPluginPromise) {
898
- dependencyPluginPromise = readPluginManifest(path.join(item.resolution.rootDir, 'plugins', dependencyName), { mode: 'bundle' }).then((dependencyPlugin) => {
899
- dependencyPlugin.sourceId = item.resolution.sourceId;
900
- dependencyPlugin.sourceIdentity = item.resolution.sourceIdentity;
901
- dependencyPlugin.pluginId = dependencyId;
902
- return dependencyPlugin;
903
- });
904
- dependencyPluginCache.set(pluginCacheKey, dependencyPluginPromise);
905
- }
906
- const placements = scope === 'project' ? ['project', 'user'] : ['user'];
1709
+ const placements = dependencyPlacementsFor(dependencyId, scope);
907
1710
  let dependencyResult = {
908
1711
  state: 'absent',
909
1712
  };
910
1713
  for (const dependencyScope of placements) {
911
- const inspectionCacheKey = [
912
- item.resolution.sourceIdentity,
913
- dependencyId,
914
- platform,
915
- dependencyScope,
916
- dependencyScope === 'project' ? currentProjectKey : '',
917
- ].join('\0');
918
- let dependencyInspection = dependencyInspectionCache.get(inspectionCacheKey);
919
- if (!dependencyInspection) {
920
- dependencyInspection = dependencyPluginPromise.then(async (dependencyPlugin) => {
921
- dependencyInspectionHookForTests?.();
922
- const dependencyMarketplaceName = marketplaceNameFor(dependencyName, platform, dependencyScope);
923
- const dependencyInspected = await inspectRebuildTarget({
924
- sourceId: item.resolution.sourceId,
925
- sourceIdentity: item.resolution.sourceIdentity,
926
- pluginId: dependencyId,
927
- marketplaceName: dependencyMarketplaceName,
928
- marketplaceRoot,
929
- plugin: dependencyPlugin,
930
- platform,
931
- scope: dependencyScope,
932
- cwd: options.cwd,
933
- catalog: { rootDir: item.resolution.rootDir, source: 'local' },
934
- context: {
935
- env,
936
- nativeCliRunner: getDefaultNativeCliRunner(),
937
- reporter: createNoopReporter(),
938
- debugLogger: createNoopDebugLogger(),
939
- },
940
- userActivationDesired: codexDesiredUserActivationIds,
941
- nativeProbe: readOnlyNativeProbe({
942
- pluginName: dependencyName,
943
- sourceId: item.resolution.sourceId,
944
- sourceIdentity: item.resolution.sourceIdentity,
945
- platform,
946
- scope: dependencyScope,
947
- marketplaceName: dependencyMarketplaceName,
948
- marketplaceRoot,
949
- }),
950
- });
951
- const dependencyLiveState = projectedLiveState({
952
- inspection: dependencyInspected.inspection,
953
- required: dependencyInspected.target.desiredOwnedComponents
954
- ?? dependencyInspected.target.ownedComponents,
955
- optional: dependencyInspected.target.optionalOwnedComponents ?? [],
956
- });
957
- const collision = dependencyInspected.inspection.components.find((component) => component.collision)?.collision;
958
- if (collision) {
959
- return {
960
- state: 'blockedByCollision',
961
- rootIssueId: collisionRootIssueId({
962
- pluginId: dependencyId,
963
- platform,
964
- scope: dependencyScope,
965
- collision,
966
- }),
967
- rootIssueCode: 'artifactCollision',
968
- };
969
- }
970
- return {
971
- state: dependencyLiveState === 'present' ? 'ready'
972
- : dependencyLiveState === 'absent' ? 'absent'
973
- : dependencyLiveState === 'partial' ? 'incomplete'
974
- : 'error',
975
- ...(dependencyLiveState === 'partial'
976
- ? {
977
- rootIssueId: `incompleteInstallation:${dependencyId}:${platform}:${dependencyScope}`,
978
- rootIssueCode: 'incompleteInstallation',
979
- }
980
- : dependencyLiveState === 'error'
981
- ? {
982
- rootIssueId: `diagnostic:${dependencyId}:${platform}:${dependencyScope}`,
983
- rootIssueCode: 'diagnostic',
984
- }
985
- : {}),
986
- };
987
- }).catch(() => ({
988
- state: 'error',
989
- rootIssueId: `diagnostic:${dependencyId}:${platform}:${dependencyScope}`,
990
- rootIssueCode: 'diagnostic',
991
- }));
992
- dependencyInspectionCache.set(inspectionCacheKey, dependencyInspection);
993
- }
994
- const candidate = await dependencyInspection;
1714
+ const candidate = await inspectDependencyAtScope(dependencyName, dependencyScope);
995
1715
  if (candidate.state === 'ready') {
996
1716
  dependencyResult = candidate;
997
1717
  break;
@@ -1007,31 +1727,61 @@ export async function statusCommandV6(options) {
1007
1727
  dependencyResult = candidate;
1008
1728
  }
1009
1729
  }
1010
- if (dependencyResult.state === 'absent') {
1730
+ if (dependencyResult.state === 'absent' && !dependencyResult.rootIssueId) {
1731
+ const dependencyScope = dependencyResult.dependencyScope ?? placements[0];
1011
1732
  dependencyResult = {
1012
1733
  state: 'absent',
1013
- rootIssueId: `dependencyMissing:${dependencyId}:${platform}:${scope}`,
1734
+ dependencyScope,
1735
+ rootIssueId: `dependencyMissing:${dependencyId}:${platform}:${dependencyScope}`,
1014
1736
  rootIssueCode: 'dependencyMissing',
1015
1737
  };
1016
1738
  }
1739
+ const dependencyScope = dependencyResult.dependencyScope ?? placements[0];
1017
1740
  dependencyReadiness.push({
1018
1741
  dependencyPluginId: dependencyId,
1019
- ...dependencyResult,
1742
+ dependencyPlatform: platform,
1743
+ dependencyScope,
1744
+ dependencyProject: dependencyScope === 'project' ? 'current' : null,
1745
+ state: dependencyResult.state,
1746
+ ...(dependencyResult.rootIssueId
1747
+ ? { rootIssueId: dependencyResult.rootIssueId }
1748
+ : {}),
1749
+ ...(dependencyResult.rootIssueCode
1750
+ ? { rootIssueCode: dependencyResult.rootIssueCode }
1751
+ : {}),
1020
1752
  });
1753
+ const issuePluginId = dependencyResult.issuePluginId ?? dependencyId;
1754
+ const issueScope = dependencyResult.issueScope ?? dependencyScope;
1021
1755
  if (dependencyResult.state === 'absent') {
1022
1756
  dependencyErrors.push(finalizeTargetError({
1023
1757
  code: 'dependencyMissing',
1024
- message: `dependencyMissing: ${dependencyId} is absent from its required live placement.`,
1025
- dependencyPluginId: dependencyId,
1758
+ message: `dependencyMissing: ${issuePluginId} is absent from its required live placement.`,
1759
+ dependencyPluginId: issuePluginId,
1760
+ dependencyPlatform: platform,
1761
+ dependencyScope: issueScope,
1762
+ dependencyProject: issueScope === 'project' ? 'current' : null,
1026
1763
  rootIssueId: dependencyResult.rootIssueId,
1027
1764
  rootIssueCode: dependencyResult.rootIssueCode,
1028
1765
  }, 'partial'));
1029
1766
  }
1030
1767
  else if (dependencyResult.state !== 'ready') {
1768
+ const code = dependencyResult.rootIssueCode === 'awCapabilityUnsupported'
1769
+ ? 'awCapabilityUnsupported'
1770
+ : dependencyResult.rootIssueCode === 'dependencyGraphInvalid'
1771
+ ? 'dependencyGraphInvalid'
1772
+ : 'dependencyNotReady';
1773
+ const message = code === 'awCapabilityUnsupported'
1774
+ ? `${code}: ${issuePluginId} requires unsupported AW capabilities: ${(dependencyResult.missingCapabilities ?? []).join(', ')}.`
1775
+ : code === 'dependencyGraphInvalid'
1776
+ ? `${code}: dependency cycle includes ${issuePluginId}.`
1777
+ : `${code}: ${issuePluginId} is not ready at its required live placement.`;
1031
1778
  dependencyErrors.push(finalizeTargetError({
1032
- code: 'dependencyNotReady',
1033
- message: `dependencyNotReady: ${dependencyId} is not ready at its required live placement.`,
1034
- dependencyPluginId: dependencyId,
1779
+ code,
1780
+ message,
1781
+ dependencyPluginId: issuePluginId,
1782
+ dependencyPlatform: platform,
1783
+ dependencyScope: issueScope,
1784
+ dependencyProject: issueScope === 'project' ? 'current' : null,
1035
1785
  ...(dependencyResult.rootIssueId
1036
1786
  ? { rootIssueId: dependencyResult.rootIssueId }
1037
1787
  : {}),
@@ -1044,10 +1794,10 @@ export async function statusCommandV6(options) {
1044
1794
  }
1045
1795
  states[platform][scope] = {
1046
1796
  state: liveState,
1047
- errors: [...inspected.inspection.errors.map((error) => finalizeTargetError({
1797
+ errors: [...inspected.inspection.errors.map((error) => projectTargetError({
1048
1798
  code: 'componentInspectionFailed',
1049
1799
  message: `${error.label}: ${error.message}`,
1050
- }, liveState)), ...collisionErrors, ...dependencyErrors],
1800
+ }, env, options.cwd, liveState)), ...collisionErrors, ...dependencyErrors],
1051
1801
  ...(dependencyReadiness.length > 0 ? { dependencyReadiness } : {}),
1052
1802
  components: inspected.inspection.components.map((component) => {
1053
1803
  const projectedError = component.collision
@@ -1074,6 +1824,7 @@ export async function statusCommandV6(options) {
1074
1824
  };
1075
1825
  }
1076
1826
  catch (error) {
1827
+ throwIfCancelled(error);
1077
1828
  const message = error instanceof Error ? error.message : String(error);
1078
1829
  const configErrorCode = platform === 'codex' && codexConfigErrors.length > 0
1079
1830
  ? codexSurface.nativeKinds.length > 0
@@ -1081,17 +1832,17 @@ export async function statusCommandV6(options) {
1081
1832
  : 'codexActivationDrift'
1082
1833
  : undefined;
1083
1834
  const code = configErrorCode
1084
- ?? message.split(':', 1)[0]
1835
+ ?? /^([A-Za-z][A-Za-z0-9]*):/u.exec(message)?.[1]
1085
1836
  ?? 'targetInspectionFailed';
1086
1837
  states[platform][scope] = {
1087
1838
  state: 'error',
1088
1839
  components: [],
1089
- errors: [finalizeTargetError({
1840
+ errors: [projectTargetError({
1090
1841
  code,
1091
1842
  message: configErrorCode
1092
1843
  ? `${configErrorCode}: Codex activation state is unreadable.`
1093
1844
  : message,
1094
- }, 'error')],
1845
+ }, env, options.cwd, 'error')],
1095
1846
  };
1096
1847
  }
1097
1848
  }
@@ -1100,52 +1851,89 @@ export async function statusCommandV6(options) {
1100
1851
  if (codex && codexSurface.ok) {
1101
1852
  const marketplaceName = marketplaceNameFor(entry.name, 'codex', 'user');
1102
1853
  const codexPluginId = `${entry.name}@${marketplaceName}`;
1854
+ const desiredCodexScopes = sourceDesired.get(desiredTargetKey(formatPluginId({ sourceId: item.resolution.sourceId, pluginName: entry.name }), 'codex'))?.scopes ?? [];
1855
+ const registrationScope = options.scope !== undefined
1856
+ ? scopes[0]
1857
+ : desiredCodexScopes.includes('project')
1858
+ ? 'project'
1859
+ : desiredCodexScopes.includes('user') ? 'user' : 'project';
1860
+ const pluginRegistration = codexSurface.nativeKinds.length > 0
1861
+ ? await inspectCodexRegistration(codexPluginId, registrationScope)
1862
+ : {
1863
+ observation: { state: 'unobserved' },
1864
+ observations: { user: false, project: false },
1865
+ activations: {},
1866
+ };
1103
1867
  let residueFailed = false;
1104
- const managedByCurrentIntent = userIntent.managed.codexPluginIds.includes(codexPluginId)
1105
- || projectIntent.managed.codexPluginIds.includes(codexPluginId);
1868
+ const hasNativeRenderTargets = plugin.manifest.artifacts !== undefined;
1106
1869
  const sharedInspection = codexSurface.nativeKinds.length > 0
1107
1870
  ? await inspectCodexSharedNativeLive({
1108
1871
  pluginName: entry.name,
1872
+ sourceId: item.resolution.sourceId,
1109
1873
  desiredVersion: entry.version,
1110
- expectedPayloadDigest: sharedNativePayloadDigest,
1874
+ inspectionMode: hasNativeRenderTargets ? 'payload' : 'shallow',
1111
1875
  cwd: options.cwd,
1112
1876
  env,
1113
- managedByCurrentIntent,
1114
1877
  marketplaceName,
1115
1878
  marketplaceRoot,
1116
- }).catch(() => {
1879
+ nativeCliRunner,
1880
+ pluginRegistration,
1881
+ ...(hasNativeRenderTargets ? { nativeRenderPlugin: plugin } : {}),
1882
+ }).catch((error) => {
1883
+ throwIfCancelled(error);
1117
1884
  residueFailed = true;
1118
1885
  return undefined;
1119
1886
  })
1120
1887
  : undefined;
1121
1888
  const nativeState = sharedInspection?.sharedNative;
1122
1889
  const sharedNative = residueFailed
1123
- ? { pluginId: codexPluginId, state: 'corrupt', shared: true }
1890
+ ? { pluginId: codexPluginId, state: 'blocked', reason: 'unreadable' }
1124
1891
  : !nativeState
1125
1892
  ? undefined
1126
- : nativeState.state === 'foreign'
1127
- ? { pluginId: codexPluginId, state: 'foreign', shared: true }
1128
- : nativeState.state === 'absent'
1129
- ? { pluginId: codexPluginId, state: 'missing', shared: true }
1130
- : nativeState.state === 'corrupt'
1131
- ? { pluginId: codexPluginId, state: 'corrupt', shared: true }
1132
- : nativeState.state === 'outdated'
1893
+ : nativeState.state === 'unobserved'
1894
+ ? {
1895
+ pluginId: codexPluginId,
1896
+ state: 'unobserved',
1897
+ ...(nativeState.staleCacheObserved ? { staleCacheObserved: true } : {}),
1898
+ }
1899
+ : nativeState.state === 'missing'
1900
+ ? {
1901
+ pluginId: codexPluginId,
1902
+ state: 'missing',
1903
+ ...(nativeState.staleCacheObserved ? { staleCacheObserved: true } : {}),
1904
+ }
1905
+ : nativeState.state === 'usable'
1906
+ ? {
1907
+ pluginId: codexPluginId,
1908
+ state: 'usable',
1909
+ version: nativeState.version,
1910
+ }
1911
+ : nativeState.state === 'replaceable'
1133
1912
  ? {
1134
1913
  pluginId: codexPluginId,
1135
- state: 'outdated',
1136
- version: nativeState.version,
1137
- shared: true,
1914
+ state: 'replaceable',
1915
+ reason: nativeState.reason,
1916
+ ...(nativeState.version ? { version: nativeState.version } : {}),
1917
+ ...(nativeState.desiredVersion
1918
+ ? { desiredVersion: nativeState.desiredVersion }
1919
+ : {}),
1920
+ ...(nativeState.diagnostic ? { diagnostic: nativeState.diagnostic } : {}),
1138
1921
  }
1139
- : nativeState.state === 'present' || nativeState.state === 'claimable'
1140
- ? {
1141
- pluginId: codexPluginId,
1142
- state: 'present',
1143
- version: nativeState.version,
1144
- shared: true,
1145
- }
1146
- : undefined;
1147
- const userActivation = userCodexConfig?.snapshot.plugins[codexPluginId]?.enabled;
1148
- const projectActivation = projectCodexConfig?.snapshot.plugins[codexPluginId]?.enabled;
1922
+ : {
1923
+ pluginId: codexPluginId,
1924
+ state: 'blocked',
1925
+ reason: nativeState.reason,
1926
+ diagnostic: nativeState.diagnostic,
1927
+ };
1928
+ const configuredUserActivation = userCodexConfig
1929
+ ?.snapshot.plugins[codexPluginId]?.enabled;
1930
+ const configuredProjectActivation = projectCodexConfig
1931
+ ?.snapshot.plugins[codexPluginId]?.enabled;
1932
+ const userActivation = configuredUserActivation;
1933
+ const projectActivation = configuredProjectActivation;
1934
+ const activationObserved = registrationScope === 'project'
1935
+ ? userCodexConfig !== undefined && projectCodexConfig !== undefined
1936
+ : userCodexConfig !== undefined;
1149
1937
  codexStatus = {
1150
1938
  pluginId: codexPluginId,
1151
1939
  nativeKinds: codexSurface.nativeKinds,
@@ -1155,33 +1943,24 @@ export async function statusCommandV6(options) {
1155
1943
  ...(userActivation !== undefined ? { user: userActivation } : {}),
1156
1944
  ...(projectActivation !== undefined ? { project: projectActivation } : {}),
1157
1945
  ...((userActivation !== undefined || projectActivation !== undefined)
1158
- ? { effective: projectActivation === true || userActivation === true }
1946
+ ? { effective: (projectActivation ?? userActivation) === true }
1159
1947
  : {}),
1160
- evidence: 'assumed',
1948
+ evidence: activationObserved ? 'observed' : 'assumed',
1161
1949
  },
1162
1950
  };
1163
1951
  }
1164
1952
  return {
1165
1953
  name: entry.name,
1166
1954
  version: entry.version,
1167
- sharedNativePayloadDigest,
1168
1955
  displayName: plugin.manifest.interface?.displayName ?? entry.name,
1169
1956
  shortDescription: plugin.manifest.interface?.shortDescription
1170
1957
  ?? plugin.manifest.description,
1171
1958
  description: plugin.manifest.description,
1172
- ...(plugin.manifest.config?.schema
1173
- ? { configSchema: plugin.manifest.config.schema }
1174
- : {}),
1175
- ...(effectiveConfig?.issues.length
1176
- ? {
1177
- configIssues: effectiveConfig.issues.map((issue) => ({
1178
- type: issue.type,
1179
- key: issue.key,
1180
- title: plugin.manifest.config.schema[issue.key]?.title ?? issue.key,
1181
- source: issue.source ?? 'missing',
1182
- })),
1183
- }
1959
+ platforms: [...resolveSupportedPlatforms(plugin.manifest)],
1960
+ ...(plugin.manifest.config?.fields
1961
+ ? { configSchema: plugin.manifest.config.fields }
1184
1962
  : {}),
1963
+ ...(configIssues?.length ? { configIssues } : {}),
1185
1964
  ...(configDiagnostic ? { configDiagnostic } : {}),
1186
1965
  targets: {
1187
1966
  claude: { user: claude, project: claude },
@@ -1207,6 +1986,7 @@ export async function statusCommandV6(options) {
1207
1986
  };
1208
1987
  }
1209
1988
  catch (error) {
1989
+ throwIfCancelled(error);
1210
1990
  const sanitized = sanitizeCatalogSourceError(error, env);
1211
1991
  return {
1212
1992
  ...base,
@@ -1220,6 +2000,86 @@ export async function statusCommandV6(options) {
1220
2000
  const available = catalog.sources.flatMap((source) => 'plugins' in source
1221
2001
  ? source.plugins.map((plugin) => ({ ...plugin, source }))
1222
2002
  : []);
2003
+ const removedProjectionReferences = [];
2004
+ for (const source of catalog.sources) {
2005
+ throwIfCancelled();
2006
+ if (!('plugins' in source))
2007
+ continue;
2008
+ const marketplaceRoot = path.join(resolveAwHome(env), 'marketplaces', source.id);
2009
+ try {
2010
+ const root = await readStrictNamespacedMarketplaceRoot({
2011
+ rootDir: marketplaceRoot, sourceId: source.id, sourceIdentity: source.identity,
2012
+ });
2013
+ if (!root)
2014
+ continue;
2015
+ const currentNames = new Set(source.plugins.map((plugin) => plugin.name));
2016
+ const candidates = new Map();
2017
+ const add = (name, platform) => {
2018
+ if (typeof name !== 'string' || currentNames.has(name))
2019
+ return;
2020
+ try {
2021
+ if (parsePluginId(name).sourceId !== undefined)
2022
+ return;
2023
+ }
2024
+ catch {
2025
+ return;
2026
+ }
2027
+ const supported = candidates.get(name) ?? new Set();
2028
+ supported.add(platform);
2029
+ candidates.set(name, supported);
2030
+ };
2031
+ for (const [platform, manifest] of [
2032
+ ['codex', root.agentsManifest], ['claude', root.claudeManifest],
2033
+ ]) {
2034
+ if (!Array.isArray(manifest?.plugins))
2035
+ continue;
2036
+ for (const plugin of manifest.plugins) {
2037
+ if (plugin && typeof plugin === 'object')
2038
+ add(plugin.name, platform);
2039
+ }
2040
+ }
2041
+ const pluginsRoot = path.join(root.rootDir, 'plugins');
2042
+ const pluginsStats = await fs.promises.lstat(pluginsRoot).catch((error) => {
2043
+ if (error.code === 'ENOENT')
2044
+ return undefined;
2045
+ throw error;
2046
+ });
2047
+ if (pluginsStats && (!pluginsStats.isDirectory() || pluginsStats.isSymbolicLink())) {
2048
+ throw new Error('marketplaceRootInvalid: plugin projection directory is unsafe.');
2049
+ }
2050
+ if (pluginsStats) {
2051
+ for (const entry of await fs.promises.readdir(pluginsRoot, { withFileTypes: true })) {
2052
+ if (!candidates.has(entry.name))
2053
+ add(entry.name, 'codex');
2054
+ }
2055
+ }
2056
+ const registration = userCodexConfig?.snapshot.marketplaces[root.config.marketplaceName];
2057
+ if (platforms.includes('codex')
2058
+ && isCanonicalCodexMarketplaceRegistration(registration, root.rootDir)
2059
+ && (await inspectCodexSystemConsumer(options.scope === 'project' ? 'project' : 'user')).state === 'compatible') {
2060
+ const observed = await options.codexObservationSession.snapshot(root.config.marketplaceName, options.scope === 'user' ? 'user' : 'both');
2061
+ const suffix = `@${root.config.marketplaceName}`;
2062
+ for (const pluginId of [...(observed.exact?.keys() ?? []), ...(observed.neutral?.keys() ?? [])]) {
2063
+ if (pluginId.endsWith(suffix))
2064
+ add(pluginId.slice(0, -suffix.length), 'codex');
2065
+ }
2066
+ }
2067
+ for (const [pluginName, supported] of candidates) {
2068
+ for (const platform of supported)
2069
+ removedProjectionReferences.push({
2070
+ kind: 'namespacedMarketplace', location: path.join(root.rootDir, 'config.json'),
2071
+ sourceId: source.id, sourceIdentity: source.identity,
2072
+ marketplaceName: root.config.marketplaceName, pluginName, platform, scope: 'user',
2073
+ });
2074
+ }
2075
+ }
2076
+ catch (error) {
2077
+ throwIfCancelled(error);
2078
+ const projected = projectStateInventoryError(error, env, options.cwd);
2079
+ selectedInventoryErrors.push({ ...projected, relevance: { sourceId: source.id, global: false } });
2080
+ }
2081
+ }
2082
+ const statusReferences = [...ownerInventory.references, ...removedProjectionReferences];
1223
2083
  const desiredTargetStates = calculateDesiredTargetStates({
1224
2084
  userIntent,
1225
2085
  projectIntent,
@@ -1261,7 +2121,21 @@ export async function statusCommandV6(options) {
1261
2121
  scopes,
1262
2122
  currentProjectLocationKey,
1263
2123
  }));
1264
- if (!selectorHasInventoryError) {
2124
+ const selectorHasLiveOrIntent = statusReferences.some((reference) => (reference.kind === 'namespacedOwner' || reference.kind === 'namespacedMarketplace')
2125
+ && reference.pluginName === selector.parsed.pluginName
2126
+ && reference.sourceId !== undefined
2127
+ && (selector.parsed.sourceId === undefined || reference.sourceId === selector.parsed.sourceId)
2128
+ && platforms.some((platform) => platform === reference.platform)
2129
+ && scopes.some((scope) => scope === reference.scope)
2130
+ && (reference.scope !== 'project' || reference.projectKey === currentProjectKey))
2131
+ || [userIntent, projectIntent].some((intent, index) => scopes.includes(index === 0 ? 'user' : 'project')
2132
+ && intent.roots.some((root) => {
2133
+ const parsed = parsePluginId(root.pluginId);
2134
+ return parsed.pluginName === selector.parsed.pluginName
2135
+ && (selector.parsed.sourceId === undefined || parsed.sourceId === selector.parsed.sourceId)
2136
+ && root.platforms.some(coversPlatform);
2137
+ }));
2138
+ if (!selectorHasInventoryError && !selectorHasLiveOrIntent) {
1265
2139
  selectorErrors.push({
1266
2140
  code: 'pluginNotFound',
1267
2141
  message: `Plugin "${selector.raw}" was not found in the selected catalog source set.`,
@@ -1374,7 +2248,7 @@ export async function statusCommandV6(options) {
1374
2248
  const referenceSelected = (reference) => (reference.pluginName !== undefined
1375
2249
  && reference.platform !== undefined
1376
2250
  && reference.scope !== undefined
1377
- && platforms.includes(reference.platform)
2251
+ && coversPlatform(reference.platform)
1378
2252
  && scopes.includes(reference.scope)
1379
2253
  && (reference.scope !== 'project' || reference.projectKey === currentProjectKey)
1380
2254
  && (requested.length === 0 || referenceSelectors.some((selector) => selector.parsed.pluginName === reference.pluginName
@@ -1383,7 +2257,7 @@ export async function statusCommandV6(options) {
1383
2257
  && reference.pluginName !== undefined
1384
2258
  && reference.platform !== undefined
1385
2259
  && reference.scope !== undefined
1386
- && platforms.includes(reference.platform)
2260
+ && coversPlatform(reference.platform)
1387
2261
  && scopes.includes(reference.scope)
1388
2262
  && (requested.length === 0 || plannedSelectors.some((selector) => selector.parsed.pluginName === reference.pluginName)));
1389
2263
  const missingSourceOwners = ownerInventory.references.filter((reference) => (reference.kind === 'namespacedOwner' || reference.kind === 'namespacedMarketplace')
@@ -1445,7 +2319,7 @@ export async function statusCommandV6(options) {
1445
2319
  targets.push(...unavailableSourceTargets);
1446
2320
  const availablePluginIds = new Set(available.map((entry) => formatPluginId({ sourceId: entry.source.id, pluginName: entry.name })));
1447
2321
  const resolvedSourceIds = new Set(catalog.sources.flatMap((source) => 'plugins' in source ? [source.id] : []));
1448
- const unavailableBundleReferences = ownerInventory.references.filter((reference) => (reference.kind === 'namespacedOwner' || reference.kind === 'namespacedMarketplace')
2322
+ const unavailableBundleReferences = statusReferences.filter((reference) => (reference.kind === 'namespacedOwner' || reference.kind === 'namespacedMarketplace')
1449
2323
  && reference.sourceId
1450
2324
  && configured.has(reference.sourceId)
1451
2325
  && resolvedSourceIds.has(reference.sourceId)
@@ -1455,7 +2329,7 @@ export async function statusCommandV6(options) {
1455
2329
  sourceId: reference.sourceId,
1456
2330
  pluginName: reference.pluginName,
1457
2331
  })));
1458
- const unavailableBundleTargets = [...new Map(unavailableBundleReferences.flatMap((reference) => {
2332
+ const unavailableBundleTargets = [...new Map((await Promise.all(unavailableBundleReferences.map(async (reference) => {
1459
2333
  if (!reference.sourceId || !reference.pluginName
1460
2334
  || (reference.platform !== 'codex' && reference.platform !== 'claude')
1461
2335
  || (reference.scope !== 'user' && reference.scope !== 'project'))
@@ -1464,6 +2338,10 @@ export async function statusCommandV6(options) {
1464
2338
  if (requested.length > 0 && !plannedSelectors.some((selector) => selector.parsed.pluginName === reference.pluginName
1465
2339
  && (selector.parsed.sourceId === undefined || selector.parsed.sourceId === reference.sourceId)))
1466
2340
  return [];
2341
+ const registration = reference.platform === 'codex' && reference.marketplaceName
2342
+ ? await inspectCodexRegistration(`${reference.pluginName}@${reference.marketplaceName}`, reference.scope)
2343
+ : undefined;
2344
+ const nativeUnknown = registration && registration.observation.state !== 'observed';
1467
2345
  const target = {
1468
2346
  pluginName: reference.pluginName,
1469
2347
  sourceId: reference.sourceId,
@@ -1473,14 +2351,24 @@ export async function statusCommandV6(options) {
1473
2351
  scope: reference.scope,
1474
2352
  cwd: path.resolve(options.cwd),
1475
2353
  state: 'error',
1476
- components: [],
2354
+ components: registration ? [{
2355
+ key: 'native',
2356
+ state: registration.observation.state !== 'observed' ? 'error'
2357
+ : registration.observation.value === 'installed' ? 'present' : 'absent',
2358
+ }] : [],
1477
2359
  errors: [finalizeTargetError({
1478
2360
  code: 'bundleUnavailable',
1479
2361
  message: `bundleUnavailable: ${pluginId} has live state but is not present in the current source snapshot.`,
1480
- }, 'error')],
2362
+ }, 'error'), finalizeTargetError({
2363
+ code: 'removedPluginCleanupRequired',
2364
+ message: `removedPluginCleanupRequired: ${pluginId} was removed from the current Catalog and has remaining local state.`,
2365
+ }, 'error'), ...(nativeUnknown ? [finalizeTargetError({
2366
+ code: 'codexNativeObservationFailed',
2367
+ message: 'codexNativeObservationFailed: the remaining native installation could not be observed.',
2368
+ }, 'error')] : [])],
1481
2369
  };
1482
2370
  return [[`${pluginId}\0${reference.platform}\0${reference.scope}`, target]];
1483
- })).values()];
2371
+ }))).flat()).values()];
1484
2372
  targets.push(...unavailableBundleTargets);
1485
2373
  const targetKeys = new Set(targets.map((target) => `${target.pluginId}\0${target.platform}\0${target.scope}`));
1486
2374
  for (const [scope, intent] of [
@@ -1495,7 +2383,7 @@ export async function statusCommandV6(options) {
1495
2383
  && (selector.parsed.sourceId === undefined || selector.parsed.sourceId === parsed.sourceId))) {
1496
2384
  continue;
1497
2385
  }
1498
- for (const platform of root.platforms.filter((candidate) => platforms.includes(candidate))) {
2386
+ for (const platform of root.platforms.filter(coversPlatform)) {
1499
2387
  if (!scopes.includes(scope))
1500
2388
  continue;
1501
2389
  const key = `${root.pluginId}\0${platform}\0${scope}`;
@@ -1520,96 +2408,6 @@ export async function statusCommandV6(options) {
1520
2408
  }
1521
2409
  }
1522
2410
  }
1523
- if (platforms.includes('codex')) {
1524
- for (const [scope, intent] of [
1525
- ['user', userIntent],
1526
- ['project', projectIntent],
1527
- ]) {
1528
- if (!scopes.includes(scope))
1529
- continue;
1530
- for (const codexPluginId of intent.managed.codexPluginIds) {
1531
- const separator = codexPluginId.lastIndexOf('@');
1532
- if (separator <= 0 || separator === codexPluginId.length - 1)
1533
- continue;
1534
- const pluginName = codexPluginId.slice(0, separator);
1535
- const marketplaceName = codexPluginId.slice(separator + 1);
1536
- const registration = ownerInventory.references.find((reference) => reference.kind === 'namespacedMarketplace'
1537
- && reference.marketplaceName === marketplaceName
1538
- && reference.sourceId);
1539
- const inferredSourceId = registration?.sourceId
1540
- ?? (marketplaceName.startsWith('aw-') ? marketplaceName.slice(3) : undefined)
1541
- ?? (snapshot.config.sources.length === 1
1542
- ? snapshot.config.sources[0].id
1543
- : undefined);
1544
- const sourceId = inferredSourceId || 'unavailable';
1545
- const pluginId = formatPluginId({ sourceId, pluginName });
1546
- if (requested.length > 0 && !parsedSelectors.some((selector) => selector.parsed.pluginName === pluginName
1547
- && (selector.parsed.sourceId === undefined || selector.parsed.sourceId === sourceId))) {
1548
- continue;
1549
- }
1550
- const key = `${pluginId}\0codex\0${scope}`;
1551
- if (targetKeys.has(key))
1552
- continue;
1553
- const marketplaceRoot = path.join(resolveAwHome(env), 'marketplaces', sourceId);
1554
- const residue = await inspectCodexNativeResidue({
1555
- pluginName,
1556
- cwd: options.cwd,
1557
- env,
1558
- marketplaceName,
1559
- marketplaceRoot,
1560
- }).catch(() => undefined);
1561
- const versions = [...new Set(residue?.versions ?? [])];
1562
- const sharedNative = residue?.state === 'foreign'
1563
- ? { pluginId: codexPluginId, state: 'foreign', shared: true }
1564
- : residue?.state === 'present' && versions.length === 0
1565
- ? { pluginId: codexPluginId, state: 'corrupt', shared: true }
1566
- : residue?.state === 'present'
1567
- ? {
1568
- pluginId: codexPluginId,
1569
- state: 'present',
1570
- version: versions[0],
1571
- shared: true,
1572
- }
1573
- : { pluginId: codexPluginId, state: 'missing', shared: true };
1574
- const sourceErrorCode = configured.has(sourceId)
1575
- ? 'catalogSourceUnavailable'
1576
- : 'sourceMissing';
1577
- const userActivation = userCodexConfig?.snapshot.plugins[codexPluginId]?.enabled;
1578
- const projectActivation = projectCodexConfig?.snapshot.plugins[codexPluginId]?.enabled;
1579
- targets.push({
1580
- pluginName,
1581
- sourceId,
1582
- sourceIdentity: registration?.sourceIdentity
1583
- ?? identities.get(sourceId)?.identity
1584
- ?? 'unavailable',
1585
- pluginId,
1586
- platform: 'codex',
1587
- scope,
1588
- cwd: path.resolve(options.cwd),
1589
- state: residue?.state === 'absent' || residue === undefined ? 'absent' : 'present',
1590
- components: [],
1591
- errors: [finalizeTargetError({
1592
- code: sourceErrorCode,
1593
- message: `${sourceErrorCode}: managed Codex inventory for ${codexPluginId} cannot be resolved from the current Catalog.`,
1594
- }, 'partial')],
1595
- sharedNative,
1596
- activation: {
1597
- ...(userActivation !== undefined
1598
- ? { user: userActivation }
1599
- : {}),
1600
- ...(projectActivation !== undefined
1601
- ? { project: projectActivation }
1602
- : {}),
1603
- ...((userActivation !== undefined || projectActivation !== undefined)
1604
- ? { effective: projectActivation === true || userActivation === true }
1605
- : {}),
1606
- evidence: 'assumed',
1607
- },
1608
- });
1609
- targetKeys.add(key);
1610
- }
1611
- }
1612
- }
1613
2411
  const projectedInventoryErrors = [...new Map(selectedInventoryErrors.map((error) => [
1614
2412
  `${error.code}\0${error.message}`,
1615
2413
  { code: error.code, message: error.message },
@@ -1637,22 +2435,20 @@ export async function statusCommandV6(options) {
1637
2435
  message: `${code}: ${message}`,
1638
2436
  severity: 'warning',
1639
2437
  });
2438
+ const blocking = (code, message) => ({
2439
+ code,
2440
+ message: `${code}: ${message}`,
2441
+ severity: 'blocking',
2442
+ });
1640
2443
  const decorateTarget = async (target, groupedScopes, groupedTargets) => {
1641
2444
  const entry = selectedByPluginId.get(target.pluginId);
1642
- const codex = entry?.codex;
1643
- const managedCodexPluginId = codex?.pluginId ?? target.sharedNative?.pluginId;
1644
- const managedFallback = target.platform === 'codex'
1645
- && managedCodexPluginId !== undefined
1646
- && [...userIntent.managed.codexPluginIds, ...projectIntent.managed.codexPluginIds]
1647
- .includes(managedCodexPluginId);
2445
+ const codex = target.platform === 'codex' ? entry?.codex : undefined;
1648
2446
  const desiredAll = desiredTargetStates.get(desiredTargetKey(target.pluginId, target.platform))
1649
- ?? { scopes: [], relation: managedFallback ? 'managed' : 'none' };
1650
- const desired = target.platform === 'codex'
1651
- ? desiredAll
1652
- : {
1653
- scopes: desiredAll.scopes.includes(target.scope) ? [target.scope] : [],
1654
- relation: desiredAll.relation,
1655
- };
2447
+ ?? { scopes: [], relation: 'none' };
2448
+ const desired = {
2449
+ scopes: desiredAll.scopes.includes(target.scope) ? [target.scope] : [],
2450
+ relation: desiredAll.relation,
2451
+ };
1656
2452
  const sharedNative = codex?.sharedNative ?? target.sharedNative;
1657
2453
  const baseActivation = codex?.activation ?? target.activation;
1658
2454
  const consumerScope = desired.scopes.includes('project')
@@ -1669,13 +2465,13 @@ export async function statusCommandV6(options) {
1669
2465
  const activation = baseActivation && systemConsumer
1670
2466
  ? {
1671
2467
  ...baseActivation,
1672
- evidence: systemConsumer.state === 'missing' ? 'assumed' : 'unobserved',
2468
+ evidence: systemConsumer.state === 'compatible'
2469
+ ? 'observed'
2470
+ : systemConsumer.state === 'missing' ? 'assumed' : 'unobserved',
1673
2471
  systemConsumer,
1674
2472
  }
1675
2473
  : baseActivation;
1676
- const observationScopes = explicitScope
1677
- ? [explicitScope]
1678
- : desired.scopes.length > 0 ? desired.scopes : groupedScopes;
2474
+ const observationScopes = [target.scope];
1679
2475
  const scopedTargets = groupedTargets.filter((candidate) => observationScopes.includes(candidate.scope));
1680
2476
  const observedTargets = scopedTargets.length > 0 ? scopedTargets : groupedTargets;
1681
2477
  const ownershipState = observedTargets.some((candidate) => candidate.state === 'error')
@@ -1684,7 +2480,11 @@ export async function statusCommandV6(options) {
1684
2480
  ? 'partial'
1685
2481
  : observedTargets.some((candidate) => candidate.state === 'present')
1686
2482
  ? 'present'
1687
- : 'absent';
2483
+ : sharedNative?.staleCacheObserved
2484
+ ? 'partial'
2485
+ : 'absent';
2486
+ const actualScopeEnabled = target.platform === 'codex'
2487
+ && baseActivation?.[target.scope] === true;
1688
2488
  const hasSourceError = observedTargets.some((candidate) => candidate.errors.some((error) => error.code === 'sourceMissing'
1689
2489
  || error.code === 'catalogSourceUnavailable'
1690
2490
  || error.code === 'bundleUnavailable'
@@ -1693,18 +2493,26 @@ export async function statusCommandV6(options) {
1693
2493
  && (codex?.extensionKinds.length ?? 0) > 0
1694
2494
  && desired.scopes.includes('user')
1695
2495
  && desired.scopes.includes('project');
1696
- const expectedUser = desired.scopes.includes('user');
1697
- const expectedProject = desired.scopes.includes('project');
2496
+ const expectedEnabled = desired.scopes.includes(target.scope);
2497
+ const inheritedUserActivation = target.platform === 'codex'
2498
+ && target.scope === 'project'
2499
+ && !expectedEnabled
2500
+ && desiredAll.scopes.includes('user')
2501
+ && activation?.user === true
2502
+ && (codex?.nativeKinds.length ?? 0) > 0;
2503
+ const projectDisablesUserActivation = inheritedUserActivation && activation?.project === false;
2504
+ const redundantProjectActivation = inheritedUserActivation && activation?.project === true
2505
+ && (codex?.extensionKinds.length ?? 0) === 0;
1698
2506
  const activationDrift = target.platform === 'codex'
1699
2507
  && (codexConfigErrors.some((error) => error.scope === 'user' || observationScopes.includes(error.scope))
1700
2508
  || ((codex?.nativeKinds.length ?? 0) > 0
1701
- && ((expectedUser && activation?.user !== true)
1702
- || (!expectedUser && activation?.user === true)
1703
- || (expectedProject && activation?.project !== true)
1704
- || (!expectedProject && activation?.project === true))));
2509
+ && (expectedEnabled && activation?.[target.scope] !== true
2510
+ || !expectedEnabled && activation?.[target.scope] === true && !redundantProjectActivation
2511
+ || projectDisablesUserActivation)));
1705
2512
  const extensionComponents = observedTargets.flatMap((candidate) => candidate.components).filter((component) => component.key !== 'native'
1706
2513
  && !component.key.startsWith('activation-')
1707
2514
  && !component.key.startsWith('marketplace-'));
2515
+ const hasScopedExtensionResidue = extensionComponents.some((component) => component.state !== 'absent' || component.error !== undefined);
1708
2516
  const extensions = target.platform !== 'codex'
1709
2517
  || (codex?.extensionKinds.length ?? 0) === 0
1710
2518
  ? undefined
@@ -1713,112 +2521,228 @@ export async function statusCommandV6(options) {
1713
2521
  ? 'conflict'
1714
2522
  : extensionComponents.some((component) => component.error?.code === 'artifactCollision')
1715
2523
  ? 'conflict'
1716
- : observedTargets.some((candidate) => candidate.state === 'partial' || candidate.state === 'error')
2524
+ : extensionComponents.some((component) => component.state === 'partial' || component.state === 'error')
1717
2525
  ? 'drifted'
1718
- : extensionComponents.some((component) => component.state === 'partial' || component.state === 'error')
1719
- ? 'drifted'
1720
- : desired.scopes.length > 0 && (extensionComponents.length === 0
1721
- || extensionComponents.every((component) => component.state === 'absent'))
1722
- ? 'missing'
1723
- : 'ready',
2526
+ : desired.scopes.length > 0 && (extensionComponents.length === 0
2527
+ || extensionComponents.every((component) => component.state === 'absent'))
2528
+ ? 'missing'
2529
+ : 'ready',
1724
2530
  kinds: codex.extensionKinds,
1725
2531
  };
1726
2532
  const desiredEnabled = desired.scopes.length > 0;
2533
+ const projectDependencyIds = projectIntent.roots.some((root) => root.pluginId === target.pluginId && root.platforms.includes(target.platform))
2534
+ ? projectDependencyClosureForTarget({
2535
+ pluginId: target.pluginId,
2536
+ platform: target.platform,
2537
+ available,
2538
+ })
2539
+ : new Set();
2540
+ const dependencyMoves = projectIntent.dependencyScopeOverrides.flatMap((override) => {
2541
+ if (override.scope !== 'project'
2542
+ || (override.platform !== undefined && override.platform !== target.platform)
2543
+ || !projectDependencyIds.has(override.pluginId)) {
2544
+ return [];
2545
+ }
2546
+ const dependencyDesired = desiredTargetStates.get(desiredTargetKey(override.pluginId, target.platform));
2547
+ if (!dependencyDesired?.scopes.includes('project')
2548
+ || dependencyDesired.scopes.includes('user')) {
2549
+ return [];
2550
+ }
2551
+ const parsed = parsePluginId(override.pluginId);
2552
+ const hasPreservedUserActual = ownerInventory.references.some((reference) => reference.kind === 'namespacedOwner'
2553
+ && reference.sourceId === parsed.sourceId
2554
+ && reference.pluginName === parsed.pluginName
2555
+ && reference.platform === target.platform
2556
+ && reference.scope === 'user');
2557
+ return hasPreservedUserActual
2558
+ ? [{ pluginId: override.pluginId, fromScope: 'user', toScope: 'project' }]
2559
+ : [];
2560
+ }).sort((left, right) => left.pluginId.localeCompare(right.pluginId, 'en'));
1727
2561
  const consumerIssue = activation?.systemConsumer?.state === 'incompatible'
1728
2562
  || activation?.systemConsumer?.state === 'unresolved'
1729
2563
  ? activation.systemConsumer
1730
2564
  : undefined;
1731
2565
  const consumerBlocking = consumerIssue !== undefined;
1732
- const managedCodexIds = [
1733
- ...(desired.scopes.includes('user') ? userIntent.managed.codexPluginIds : []),
1734
- ...(desired.scopes.includes('project') ? projectIntent.managed.codexPluginIds : []),
1735
- ];
1736
- const claimMissing = target.platform === 'codex'
1737
- && sharedNative?.state === 'present'
1738
- && desiredEnabled
1739
- && !managedCodexIds.includes(sharedNative.pluginId);
1740
- const actual = hasSourceError && desiredEnabled
1741
- ? 'unresolved'
2566
+ const baseTargetErrors = observedTargets.flatMap((candidate) => candidate.errors);
2567
+ const hasBlockingBaseReason = baseTargetErrors.some((reason) => reason.severity === 'blocking');
2568
+ const capabilityUnsupported = baseTargetErrors.some((reason) => reason.code === 'awCapabilityUnsupported');
2569
+ const dependencyNotReady = (target.dependencyReadiness ?? []).some((dependency) => dependency.state !== 'ready');
2570
+ const state = hasSourceError && desiredEnabled
2571
+ ? 'blocked'
1742
2572
  : consumerBlocking && desiredEnabled
1743
- ? 'unresolved'
2573
+ ? 'blocked'
1744
2574
  : desiredOverlapConflict
1745
- ? 'conflict'
1746
- : !desiredEnabled
1747
- ? ownershipState !== 'absent' || desired.relation === 'managed'
1748
- ? 'orphaned'
1749
- : 'absent'
1750
- : sharedNative?.state === 'foreign'
1751
- ? 'conflict'
1752
- : sharedNative?.state === 'corrupt'
1753
- ? 'drifted'
1754
- : sharedNative?.state === 'missing' || sharedNative?.state === 'outdated' || claimMissing
1755
- ? 'needsSync'
1756
- : activationDrift || extensions?.state === 'drifted'
1757
- ? 'drifted'
1758
- : extensions?.state === 'missing' || ownershipState === 'absent'
2575
+ ? 'blocked'
2576
+ : sharedNative?.state === 'blocked' || hasBlockingBaseReason || capabilityUnsupported
2577
+ ? 'blocked'
2578
+ : sharedNative?.state === 'replaceable' && sharedNative.reason === 'damaged'
2579
+ ? 'needsSync'
2580
+ : projectDisablesUserActivation
2581
+ ? 'needsSync'
2582
+ : redundantProjectActivation && sharedNative?.state === 'usable' && !hasScopedExtensionResidue
2583
+ ? 'ready'
2584
+ : !desiredEnabled
2585
+ ? (target.platform === 'codex'
2586
+ ? actualScopeEnabled || hasScopedExtensionResidue
2587
+ : ownershipState !== 'absent')
2588
+ || desired.relation === 'managed'
2589
+ ? 'orphaned'
2590
+ : 'absent'
2591
+ : dependencyMoves.length > 0
1759
2592
  ? 'needsSync'
1760
- : ownershipState === 'partial' || ownershipState === 'error'
1761
- ? 'drifted'
1762
- : 'ready';
1763
- const baseTargetErrors = observedTargets.flatMap((candidate) => candidate.errors);
2593
+ : dependencyNotReady
2594
+ ? 'needsSync'
2595
+ : sharedNative?.state === 'missing'
2596
+ || sharedNative?.state === 'replaceable'
2597
+ || sharedNative?.state === 'unobserved'
2598
+ ? 'needsSync'
2599
+ : activationDrift || extensions?.state === 'drifted'
2600
+ ? 'needsSync'
2601
+ : extensions?.state === 'missing'
2602
+ || (target.platform !== 'codex' && ownershipState === 'absent')
2603
+ ? 'needsSync'
2604
+ : ownershipState === 'partial' || ownershipState === 'error'
2605
+ ? 'needsSync'
2606
+ : 'ready';
1764
2607
  const stableErrors = [
1765
- ...(sharedNative?.state === 'foreign'
1766
- && !baseTargetErrors.some((error) => error.code === 'codexSharedNativeForeign')
1767
- ? [warning('codexSharedNativeForeign', `${sharedNative.pluginId} is foreign and was preserved.`)]
1768
- : []),
1769
- ...(sharedNative?.state === 'corrupt'
1770
- && !baseTargetErrors.some((error) => error.code === 'codexSharedNativeCorrupt')
1771
- ? [warning('codexSharedNativeCorrupt', `${sharedNative.pluginId} is corrupt.`)]
1772
- : []),
1773
- ...(sharedNative?.state === 'outdated'
1774
- ? [warning('codexSharedNativeUpdateRequired', `${sharedNative.pluginId} requires a shared update.`)]
1775
- : []),
2608
+ ...projectStatusSharedNativeReasons(sharedNative, baseTargetErrors.map((error) => error.code), desiredEnabled),
1776
2609
  ...(desiredOverlapConflict
1777
- ? [warning('codexExtensionScopeConflict', `${target.pluginId} has AW extensions desired at user and project scope.`)]
2610
+ ? [blocking('codexExtensionScopeConflict', `${target.pluginId} has AW extensions desired at user and project scope.`)]
1778
2611
  : []),
1779
- ...(activationDrift && sharedNative?.state !== 'missing'
1780
- ? [warning('codexActivationDrift', `${target.pluginId} activation differs from desired intent.`)]
2612
+ ...(activationDrift && sharedNative?.state !== 'missing' && sharedNative?.state !== 'unobserved'
2613
+ ? [warning('codexActivationDrift', projectDisablesUserActivation
2614
+ ? `${target.pluginId} is enabled for the user but disabled by the current project.`
2615
+ : `${target.pluginId} activation differs from desired intent: `
2616
+ + `${target.scope} expected=${expectedEnabled}, `
2617
+ + `actual=${activation?.[target.scope] ?? 'unset'}.`)]
1781
2618
  : []),
1782
2619
  ...(extensions?.state === 'drifted'
1783
2620
  ? [warning('codexExtensionDrift', `${target.pluginId} extension projection has drifted.`)]
1784
2621
  : []),
2622
+ ...dependencyMoves.map((move) => ({
2623
+ ...warning('dependencyScopeMigrationCleanupRequired', `${move.pluginId} has preserved user-scope output after moving to project scope.`),
2624
+ dependencyPluginId: move.pluginId,
2625
+ dependencyPlatform: target.platform,
2626
+ dependencyScope: move.toScope,
2627
+ dependencyProject: 'current',
2628
+ })),
1785
2629
  ...(target.platform === 'codex' && hasSourceError && desiredEnabled
1786
2630
  ? [warning('codexIntentSourceUnavailable', `${target.pluginId} desired intent cannot be resolved from the current Catalog.`)]
1787
2631
  : []),
1788
2632
  ...(target.platform === 'codex' && consumerBlocking && desiredEnabled
1789
- ? [warning(consumerIssue.code, consumerIssue.diagnostic)]
2633
+ ? [blocking(consumerIssue.code, consumerIssue.diagnostic)]
1790
2634
  : []),
2635
+ ...(activation?.systemConsumer?.diagnostics ?? []).map((diagnostic) => warning('codexCandidateExcluded', diagnostic)),
1791
2636
  ];
1792
2637
  const targetErrors = [...baseTargetErrors, ...stableErrors];
1793
2638
  const dedupedErrors = [...new Map(targetErrors.map((error) => [
1794
2639
  `${error.code}\0${error.message}`,
1795
2640
  error,
1796
2641
  ])).values()];
1797
- const components = [...new Map(observedTargets.flatMap((candidate) => candidate.components)
2642
+ const ownershipComponents = [...new Map(observedTargets.flatMap((candidate) => candidate.components)
1798
2643
  .map((component) => [component.key, component])).values()];
1799
- const representativeScope = explicitScope
1800
- ?? (desired.scopes.length === 1
1801
- ? desired.scopes[0]
1802
- : observedTargets.find((candidate) => candidate.state !== 'absent')?.scope
1803
- ?? (groupedScopes.includes('user') ? 'user' : groupedScopes[0] ?? target.scope));
2644
+ const representativeScope = target.scope;
2645
+ const representativeTarget = observedTargets.find((candidate) => candidate.scope === representativeScope) ?? target;
2646
+ const components = [
2647
+ {
2648
+ kind: 'intent',
2649
+ key: 'desired',
2650
+ state: desiredEnabled ? 'desired' : 'absent',
2651
+ metadata: {
2652
+ enabled: desiredEnabled,
2653
+ scopes: desired.scopes,
2654
+ relation: desired.relation,
2655
+ },
2656
+ },
2657
+ ...ownershipComponents.map((component) => ({
2658
+ kind: 'ownership',
2659
+ key: component.key,
2660
+ state: component.key === 'native'
2661
+ && component.state === 'absent'
2662
+ && sharedNative?.staleCacheObserved
2663
+ ? 'partial'
2664
+ : component.state,
2665
+ ...(component.error ? { metadata: { errorCode: component.error.code } } : {}),
2666
+ })),
2667
+ ...(sharedNative ? [{
2668
+ kind: 'sharedNative',
2669
+ key: sharedNative.pluginId,
2670
+ state: sharedNative.state,
2671
+ metadata: {
2672
+ shared: true,
2673
+ ...(sharedNative.reason ? { reason: sharedNative.reason } : {}),
2674
+ ...(sharedNative.version ? { version: sharedNative.version } : {}),
2675
+ ...(sharedNative.desiredVersion ? { desiredVersion: sharedNative.desiredVersion } : {}),
2676
+ ...(sharedNative.diagnostic ? { diagnostic: sharedNative.diagnostic } : {}),
2677
+ ...(sharedNative.staleCacheObserved ? { staleCacheObserved: true } : {}),
2678
+ },
2679
+ }] : []),
2680
+ ...['user', 'project'].flatMap((scope) => activation?.[scope] === undefined ? [] : [{
2681
+ kind: 'activation',
2682
+ key: scope,
2683
+ state: activation[scope] ? 'enabled' : 'disabled',
2684
+ metadata: {
2685
+ evidence: activation.evidence,
2686
+ ...(activation.effective !== undefined ? { effective: activation.effective } : {}),
2687
+ },
2688
+ }]),
2689
+ ...(activation?.systemConsumer ? [{
2690
+ kind: 'systemConsumer',
2691
+ key: `codex:${representativeScope}`,
2692
+ state: activation.systemConsumer.state,
2693
+ metadata: {
2694
+ evidence: activation.evidence,
2695
+ requiredMinVersion: activation.systemConsumer.requiredMinVersion,
2696
+ ...('detectedVersion' in activation.systemConsumer
2697
+ ? { detectedVersion: activation.systemConsumer.detectedVersion }
2698
+ : {}),
2699
+ ...('code' in activation.systemConsumer ? { code: activation.systemConsumer.code } : {}),
2700
+ ...('diagnostic' in activation.systemConsumer
2701
+ ? { diagnostic: activation.systemConsumer.diagnostic }
2702
+ : {}),
2703
+ ...(activation.systemConsumer.diagnostics?.length
2704
+ ? { diagnostics: activation.systemConsumer.diagnostics }
2705
+ : {}),
2706
+ },
2707
+ }] : []),
2708
+ ...(extensions ? [{
2709
+ kind: 'extension',
2710
+ key: 'aw',
2711
+ state: extensions.state,
2712
+ metadata: { kinds: extensions.kinds },
2713
+ }] : []),
2714
+ ...(representativeTarget.dependencyReadiness ?? []).map((dependency) => ({
2715
+ kind: 'dependency',
2716
+ key: dependency.dependencyPluginId,
2717
+ state: dependency.state,
2718
+ metadata: {
2719
+ platform: dependency.dependencyPlatform,
2720
+ scope: dependency.dependencyScope,
2721
+ project: dependency.dependencyProject ?? 'none',
2722
+ ...(dependency.rootIssueId ? { rootIssueId: dependency.rootIssueId } : {}),
2723
+ ...(dependency.rootIssueCode ? { rootIssueCode: dependency.rootIssueCode } : {}),
2724
+ },
2725
+ })),
2726
+ ];
2727
+ const { state: _ownershipState, components: _ownershipComponents, errors: _errors, sharedNative: _sharedNative, activation: _activation, extensions: _extensions, dependency: _dependency, dependencyReadiness: _dependencyReadiness, ...identity } = target;
1804
2728
  return {
1805
- ...target,
2729
+ ...identity,
1806
2730
  scope: representativeScope,
1807
- state: ownershipState,
2731
+ state,
1808
2732
  components,
1809
- errors: dedupedErrors,
1810
- desired: {
1811
- enabled: desiredEnabled,
1812
- scopes: desired.scopes,
1813
- relation: desired.relation,
1814
- },
1815
- actual: { state: actual },
1816
- recovery: statusRecovery({
1817
- actual,
2733
+ reasons: dedupedErrors,
2734
+ recoveryActions: projectDisablesUserActivation && state === 'needsSync' ? [{
2735
+ command: 'sync', scope: 'user',
2736
+ description: '移除当前项目的关闭设置,恢复使用所有项目已启用的插件。',
2737
+ }] : statusRecovery({
2738
+ state,
1818
2739
  desired,
1819
2740
  platform: target.platform,
1820
2741
  pluginId: target.pluginId,
2742
+ ...(dependencyMoves.length > 0 ? { dependencyMoves } : {}),
1821
2743
  ...(sharedNative ? { sharedNative } : {}),
2744
+ scope: target.scope,
2745
+ actualEnabled: actualScopeEnabled,
1822
2746
  conflictRoots: rootIntentsForTarget({
1823
2747
  pluginId: target.pluginId,
1824
2748
  platform: target.platform,
@@ -1827,10 +2751,9 @@ export async function statusCommandV6(options) {
1827
2751
  available,
1828
2752
  }),
1829
2753
  errorCodes: dedupedErrors.map((error) => error.code),
1830
- }),
1831
- ...(sharedNative ? { sharedNative } : {}),
1832
- ...(activation ? { activation } : {}),
1833
- ...(extensions ? { extensions } : {}),
2754
+ }).map((action) => action.command === 'manual' || action.scope
2755
+ ? action
2756
+ : { ...action, scope: representativeScope }),
1834
2757
  };
1835
2758
  };
1836
2759
  const codexGroups = new Map();
@@ -1845,21 +2768,153 @@ export async function statusCommandV6(options) {
1845
2768
  codexGroups.set(target.pluginId, group);
1846
2769
  }
1847
2770
  for (const group of codexGroups.values()) {
1848
- const scopes = [...new Set(group.map((target) => target.scope))].sort();
1849
- projectedTargets.push(await decorateTarget(group[0], scopes, group));
2771
+ const decorated = await Promise.all(group.map((target) => decorateTarget(target, [target.scope], [target])));
2772
+ const first = decorated[0];
2773
+ const entry = selectedByPluginId.get(first.pluginId);
2774
+ const desired = desiredTargetStates.get(desiredTargetKey(first.pluginId, 'codex'))
2775
+ ?? { scopes: [], relation: 'none' };
2776
+ const returnedScopes = new Set(decorated.map((target) => target.scope));
2777
+ const desiredOverlapConflict = (entry?.codex?.extensionKinds.length ?? 0) > 0
2778
+ && desired.scopes.includes('user')
2779
+ && desired.scopes.includes('project')
2780
+ && returnedScopes.has('user')
2781
+ && returnedScopes.has('project');
2782
+ const sharedComponents = [...new Map(decorated.flatMap((target) => target.components)
2783
+ .filter((component) => component.kind === 'sharedNative' || component.kind === 'systemConsumer')
2784
+ .map((component) => [`${component.kind}\0${component.key}`, component])).values()];
2785
+ const sharedReason = (reason) => reason.code.startsWith('codexSharedNative') || reason.code === 'staleCacheObserved'
2786
+ || reason.code === 'codexCandidateExcluded';
2787
+ const sharedReasons = decorated.flatMap((target) => target.reasons.filter(sharedReason));
2788
+ const placements = decorated.map((target) => ({
2789
+ scope: target.scope,
2790
+ state: target.state,
2791
+ components: target.components.filter((component) => component.kind !== 'sharedNative' && component.kind !== 'systemConsumer'),
2792
+ reasons: target.reasons.filter((reason) => !sharedReason(reason)),
2793
+ recoveryActions: target.recoveryActions,
2794
+ })).sort((left, right) => left.scope.localeCompare(right.scope, 'en'));
2795
+ const reasons = [...new Map([
2796
+ ...placements.flatMap((placement) => placement.reasons),
2797
+ ...sharedReasons,
2798
+ ...(desiredOverlapConflict ? [blocking('codexExtensionScopeConflict', `${first.pluginId} has AW extensions desired at user and project scope.`)] : []),
2799
+ ]
2800
+ .map((reason) => [`${reason.code}\0${reason.message}`, reason])).values()];
2801
+ const conflictRecovery = desiredOverlapConflict ? statusRecovery({
2802
+ state: 'blocked',
2803
+ desired,
2804
+ platform: 'codex',
2805
+ pluginId: first.pluginId,
2806
+ conflictRoots: rootIntentsForTarget({
2807
+ pluginId: first.pluginId,
2808
+ platform: 'codex',
2809
+ userIntent,
2810
+ projectIntent,
2811
+ available,
2812
+ }),
2813
+ errorCodes: ['codexExtensionScopeConflict'],
2814
+ }) : [];
2815
+ const recoveryActions = [...new Map((desiredOverlapConflict
2816
+ ? conflictRecovery
2817
+ : placements.flatMap((placement) => placement.recoveryActions))
2818
+ .map((action) => [
2819
+ `${action.command}\0${action.scope ?? ''}\0${action.description}`,
2820
+ action,
2821
+ ])).values()];
2822
+ const state = desiredOverlapConflict ? 'blocked'
2823
+ : ['blocked', 'needsSync', 'orphaned', 'ready', 'absent']
2824
+ .find((candidate) => placements.some((placement) => placement.state === candidate));
2825
+ projectedTargets.push({
2826
+ pluginName: first.pluginName,
2827
+ sourceId: first.sourceId,
2828
+ sourceIdentity: first.sourceIdentity,
2829
+ pluginId: first.pluginId,
2830
+ ...(first.version ? { version: first.version } : {}),
2831
+ platform: 'codex',
2832
+ cwd: first.cwd,
2833
+ state,
2834
+ components: sharedComponents,
2835
+ reasons,
2836
+ recoveryActions,
2837
+ placements,
2838
+ });
1850
2839
  }
1851
- projectedTargets.sort((left, right) => `${left.pluginId}\0${left.platform}\0${left.scope}`.localeCompare(`${right.pluginId}\0${right.platform}\0${right.scope}`, 'en'));
1852
- const targetRevisions = projectedTargets.map((target) => {
2840
+ projectedTargets.sort((left, right) => `${left.pluginId}\0${left.platform}`.localeCompare(`${right.pluginId}\0${right.platform}`, 'en'));
2841
+ const targetRevisions = projectedTargets.flatMap((target) => {
1853
2842
  const entry = selectedByPluginId.get(target.pluginId);
1854
- return {
2843
+ const placements = target.platform === 'codex' ? target.placements : [target];
2844
+ return placements.map((placement) => ({
1855
2845
  pluginId: target.pluginId,
1856
2846
  platform: target.platform,
1857
- scope: target.scope,
1858
- revision: projectTargetRevision(entry?.version, entry?.states[target.platform]?.[target.scope]?.installedVersion),
1859
- };
2847
+ scope: placement.scope,
2848
+ revision: projectTargetRevision(entry?.version, entry?.states[target.platform]?.[placement.scope]?.installedVersion),
2849
+ }));
1860
2850
  });
2851
+ const publicConfigIssues = available.flatMap((entry) => (entry.configIssues ?? [])
2852
+ .filter((issue) => issue.type === 'configLayerUnsupported')
2853
+ .map((issue) => ({
2854
+ pluginId: formatPluginId({ sourceId: entry.source.id, pluginName: entry.name }),
2855
+ pluginName: entry.name,
2856
+ ...issue,
2857
+ })));
2858
+ const nativeObservations = available.flatMap((entry) => ['codex', 'claude'].map((platform) => {
2859
+ const observed = entry.states[platform]?.[scope];
2860
+ const blockers = (observed?.errors ?? []).map((error) => ({
2861
+ code: error.code, message: `${error.code}: 项目 Native 目标尚未满足。`,
2862
+ }));
2863
+ const nativeInventoryErrors = inventoryErrors.filter((error) => inventoryErrorMatchesSelection({
2864
+ error,
2865
+ selectors: [{ raw: `${entry.source.id}/${entry.name}`, parsed: {
2866
+ sourceId: entry.source.id, pluginName: entry.name,
2867
+ } }],
2868
+ platformExplicit: true, scopeExplicit: true, platforms: [platform], scopes: [scope],
2869
+ currentProjectLocationKey,
2870
+ }));
2871
+ blockers.push(...nativeInventoryErrors.map((error) => ({
2872
+ code: error.code, message: `${error.code}: 无法读取项目 Native 现场。`,
2873
+ })));
2874
+ if (platform === 'codex' && codexConfigErrors.some((error) => error.scope === scope
2875
+ || scope === 'project' && error.scope === 'user')) {
2876
+ blockers.push({ code: 'nativeStateUnreadable', message: '无法读取 Codex 激活配置。' });
2877
+ }
2878
+ const scopedPreferences = observedDemands.get(scope)?.preferences;
2879
+ if (entry.configDiagnostic?.scope === scope && scopedPreferences?.state === 'valid'
2880
+ && resolveActiveConfigPlatforms(`${entry.source.id}/${entry.name}`, { platforms: entry.platforms }, scopedPreferences).includes(platform)) {
2881
+ blockers.push({ code: 'configInvalid', message: 'Plugin configuration could not be read.', detail: { reasonCode: 'configReadFailed' } });
2882
+ }
2883
+ const configBlockers = configStatusDiagnostics((entry.configIssues ?? []).flatMap((issue) => issue.scope === scope && issue.platform === platform && (issue.type === 'missing-required' || issue.type === 'invalid-config')
2884
+ ? [{ type: issue.type, key: issue.key, message: '' }] : []));
2885
+ blockers.push(...configBlockers);
2886
+ if (observed?.state === 'error' && !blockers.some((error) => /Unsupported$|collision|conflict|foreign/iu.test(error.code))) {
2887
+ blockers.push({ code: 'nativeObservationFailed', message: '无法完成项目 Native 现场观察。' });
2888
+ }
2889
+ let content = !observed ? 'unknown'
2890
+ : observed.state === 'absent' ? 'absent'
2891
+ : observed.state === 'present' ? 'satisfied'
2892
+ : observed.state === 'partial' ? 'drifted' : 'unknown';
2893
+ if (blockers.some((blocker) => /collision|conflict|foreign/iu.test(blocker.code)))
2894
+ content = 'conflict';
2895
+ if (platform === 'codex' && entry.codex?.nativeKinds.length) {
2896
+ const shared = entry.codex.sharedNative;
2897
+ if (shared?.state === 'missing')
2898
+ content = 'absent';
2899
+ else if (shared?.state === 'replaceable')
2900
+ content = 'drifted';
2901
+ else if (shared?.state === 'blocked')
2902
+ content = shared.reason === 'foreign' ? 'conflict' : 'unknown';
2903
+ else if (!shared || shared.state === 'unobserved')
2904
+ content = 'unknown';
2905
+ if (content === 'satisfied' && entry.codex.activation.effective !== true)
2906
+ content = 'absent';
2907
+ }
2908
+ return {
2909
+ pluginId: `${entry.source.id}/${entry.name}`, platform, content, blockers,
2910
+ backend: flattenStatusTargets(projectedTargets).find((target) => target.pluginId === `${entry.source.id}/${entry.name}`
2911
+ && target.platform === platform && target.scope === scope),
2912
+ ...(platform === 'codex' && entry.codex?.activation.evidence === 'assumed'
2913
+ ? { assumedActivation: true } : {}),
2914
+ };
2915
+ }));
1861
2916
  const payload = {
1862
- schemaVersion: 6,
2917
+ schemaVersion: 8,
1863
2918
  catalog: {
1864
2919
  primarySourceId: catalog.primarySourceId,
1865
2920
  configDigest: catalog.configDigest,
@@ -1881,16 +2936,28 @@ export async function statusCommandV6(options) {
1881
2936
  cwd: path.resolve(options.cwd),
1882
2937
  },
1883
2938
  targets: projectedTargets,
2939
+ ...(publicConfigIssues.length > 0 ? { configIssues: publicConfigIssues } : {}),
1884
2940
  errors,
1885
2941
  };
1886
2942
  const hasErrors = payload.catalog.sources.some((source) => source.error !== undefined)
1887
2943
  || payload.errors.length > 0
1888
- || payload.targets.some((target) => target.errors.some((error) => error.severity === 'blocking'));
2944
+ || payload.targets.some((target) => target.reasons.some((reason) => reason.severity === 'blocking'));
1889
2945
  return {
1890
2946
  payload,
1891
- output: options.json ? JSON.stringify(payload) : renderStatusV6(payload, options.verbose === true),
2947
+ output: options.json ? JSON.stringify(payload) : renderStatusV8(payload, options.verbose === true),
1892
2948
  hasErrors,
1893
2949
  targetRevisions,
2950
+ nativeObservations,
2951
+ nativeExtraObserved: ownerInventory.references.flatMap((reference) => {
2952
+ if (!reference.sourceId || !reference.pluginName || reference.scope !== scope
2953
+ || !['namespacedOwner', 'namespacedConfig', 'namespacedMarketplace'].includes(reference.kind))
2954
+ return [];
2955
+ return [{ pluginId: `${reference.sourceId}/${reference.pluginName}`,
2956
+ ...(reference.platform === 'codex' || reference.platform === 'claude'
2957
+ ? { platform: reference.platform } : {}), scope, reference }];
2958
+ }),
2959
+ ...(projectRoot ? { projectRoot } : {}),
2960
+ projectIntentObservation,
1894
2961
  pluginSummaries: available.map((entry) => {
1895
2962
  const sourceEntries = available.filter((candidate) => candidate.source.id === entry.source.id);
1896
2963
  const byName = new Map(sourceEntries.map((candidate) => [candidate.name, candidate]));
@@ -1921,6 +2988,7 @@ export async function statusCommandV6(options) {
1921
2988
  codex: ['user', 'project'].filter((scope) => entry.targets.codex[scope]),
1922
2989
  claude: ['user', 'project'].filter((scope) => entry.targets.claude[scope]),
1923
2990
  },
2991
+ ...(entry.platforms ? { platforms: entry.platforms } : {}),
1924
2992
  configFieldCount: Object.keys(entry.configSchema ?? {}).length,
1925
2993
  ...(entry.configSchema ? { configSchema: entry.configSchema } : {}),
1926
2994
  ...(entry.configIssues ? { configIssues: entry.configIssues } : {}),
@@ -1935,4 +3003,29 @@ export async function statusCommandV6(options) {
1935
3003
  }),
1936
3004
  };
1937
3005
  }
3006
+ export async function statusCommandV8(options) {
3007
+ options.signal?.throwIfAborted();
3008
+ options = { ...options, nativeCliRunner: bindNativeCliRunnerSignal(options.nativeCliRunner ?? getDefaultNativeCliRunner(), options.signal) };
3009
+ if (options.codexObservationSession) {
3010
+ return statusCommandV8InSession({
3011
+ ...options,
3012
+ codexObservationSession: options.codexObservationSession,
3013
+ });
3014
+ }
3015
+ const env = options.env ?? process.env;
3016
+ const session = await createCodexNativeObservationSession({
3017
+ exactCwd: options.cwd,
3018
+ env,
3019
+ runner: options.nativeCliRunner ?? getDefaultNativeCliRunner(),
3020
+ });
3021
+ try {
3022
+ options.signal?.throwIfAborted();
3023
+ const result = await statusCommandV8InSession({ ...options, codexObservationSession: session });
3024
+ options.signal?.throwIfAborted();
3025
+ return result;
3026
+ }
3027
+ finally {
3028
+ await session.dispose();
3029
+ }
3030
+ }
1938
3031
  //# sourceMappingURL=status-v6.js.map