@lesliechan721/aw 0.1.0-beta.10 → 0.1.0-beta.101

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 (864) hide show
  1. package/dist/authoring/assets/aw-config.d.mts +1 -50
  2. package/dist/authoring/assets/aw-config.mjs +58 -928
  3. package/dist/authoring/assets/aw-config.mjs.map +1 -1
  4. package/dist/authoring/assets/aw-runtime-config.d.mts +13 -0
  5. package/dist/authoring/assets/aw-runtime-config.mjs +221 -0
  6. package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
  7. package/dist/authoring/assets/command-runtime-config.d.mts +9 -0
  8. package/dist/authoring/assets/command-runtime-config.mjs +134 -0
  9. package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
  10. package/dist/authoring/scripts/add-skill.mjs +16 -39
  11. package/dist/authoring/scripts/add-skill.mjs.map +1 -1
  12. package/dist/authoring/scripts/init-plugin.mjs +43 -71
  13. package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
  14. package/dist/authoring/scripts/lib/plugin-root.mjs +4 -4
  15. package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
  16. package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
  17. package/dist/authoring/scripts/lib/plugin-version-check.mjs +230 -9
  18. package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
  19. package/dist/authoring/scripts/lib/skill-scaffold.d.mts +3 -3
  20. package/dist/authoring/scripts/lib/skill-scaffold.mjs +5 -8
  21. package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
  22. package/dist/authoring/scripts/remove-plugin.mjs +1 -1
  23. package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
  24. package/dist/authoring/scripts/validate-plugin.mjs +408 -1748
  25. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  26. package/dist/authoring/scripts/validate-skill.mjs +1 -1
  27. package/dist/index.js +2 -6
  28. package/dist/index.js.map +1 -1
  29. package/dist/native-runtime/reader-runtime.mjs +34 -0
  30. package/dist/native-runtime/reader.d.mts +6 -0
  31. package/dist/native-runtime/reader.mjs +11 -0
  32. package/dist/scripts/aw-skill-eval-materializer.d.ts +11 -1
  33. package/dist/scripts/aw-skill-eval-materializer.js +119 -114
  34. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
  35. package/dist/scripts/bundle-plugins.js +32 -7
  36. package/dist/scripts/bundle-plugins.js.map +1 -1
  37. package/dist/scripts/plugin-staging.d.ts +1 -1
  38. package/dist/scripts/plugin-staging.js +5 -2
  39. package/dist/scripts/plugin-staging.js.map +1 -1
  40. package/dist/scripts/plugin-test-context-guard.d.mts +1 -0
  41. package/dist/scripts/plugin-test-context-guard.mjs +59 -0
  42. package/dist/scripts/plugin-test-context-guard.mjs.map +1 -0
  43. package/dist/scripts/plugin-test-reporter.d.mts +2 -0
  44. package/dist/scripts/plugin-test-reporter.mjs +21 -0
  45. package/dist/scripts/plugin-test-reporter.mjs.map +1 -0
  46. package/dist/scripts/test-plugin-scripts.d.ts +5 -0
  47. package/dist/scripts/test-plugin-scripts.js +343 -58
  48. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  49. package/dist/scripts/test-workers.d.mts +24 -0
  50. package/dist/scripts/test-workers.mjs +59 -0
  51. package/dist/scripts/test-workers.mjs.map +1 -0
  52. package/dist/src/adapters/helpers.d.ts +7 -0
  53. package/dist/src/adapters/helpers.js.map +1 -1
  54. package/dist/src/authoring/workspace-commands.d.ts +3 -0
  55. package/dist/src/authoring/workspace-commands.js +7 -2
  56. package/dist/src/authoring/workspace-commands.js.map +1 -1
  57. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  58. package/dist/src/commands/aw-capabilities.js +48 -19
  59. package/dist/src/commands/aw-capabilities.js.map +1 -1
  60. package/dist/src/commands/catalog-dev-source.d.ts +40 -3
  61. package/dist/src/commands/catalog-dev-source.js +333 -42
  62. package/dist/src/commands/catalog-dev-source.js.map +1 -1
  63. package/dist/src/commands/catalog-generation.d.ts +5 -0
  64. package/dist/src/commands/catalog-generation.js.map +1 -1
  65. package/dist/src/commands/catalog-publication-inspection.d.ts +11 -3
  66. package/dist/src/commands/catalog-publication-inspection.js +211 -59
  67. package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
  68. package/dist/src/commands/catalog-publication-journal.d.ts +12 -0
  69. package/dist/src/commands/catalog-publication-journal.js +78 -1
  70. package/dist/src/commands/catalog-publication-journal.js.map +1 -1
  71. package/dist/src/commands/catalog-publish.d.ts +21 -1
  72. package/dist/src/commands/catalog-publish.js +133 -92
  73. package/dist/src/commands/catalog-publish.js.map +1 -1
  74. package/dist/src/commands/catalog-source.d.ts +26 -5
  75. package/dist/src/commands/catalog-source.js +154 -27
  76. package/dist/src/commands/catalog-source.js.map +1 -1
  77. package/dist/src/commands/catalog-status.js +2 -2
  78. package/dist/src/commands/catalog-status.js.map +1 -1
  79. package/dist/src/commands/catalog-store.d.ts +35 -7
  80. package/dist/src/commands/catalog-store.js +469 -79
  81. package/dist/src/commands/catalog-store.js.map +1 -1
  82. package/dist/src/commands/catalog-workspace-resolution.d.ts +4 -0
  83. package/dist/src/commands/catalog-workspace-resolution.js +18 -3
  84. package/dist/src/commands/catalog-workspace-resolution.js.map +1 -1
  85. package/dist/src/commands/console.js +33 -20
  86. package/dist/src/commands/console.js.map +1 -1
  87. package/dist/src/commands/dependency-operation-plan.d.ts +7 -0
  88. package/dist/src/commands/dependency-operation-plan.js +66 -30
  89. package/dist/src/commands/dependency-operation-plan.js.map +1 -1
  90. package/dist/src/commands/deployment-confirmation.d.ts +11 -0
  91. package/dist/src/commands/deployment-confirmation.js +101 -0
  92. package/dist/src/commands/deployment-confirmation.js.map +1 -0
  93. package/dist/src/commands/init.js +1 -1
  94. package/dist/src/commands/init.js.map +1 -1
  95. package/dist/src/commands/intent-command.d.ts +35 -0
  96. package/dist/src/commands/intent-command.js +174 -0
  97. package/dist/src/commands/intent-command.js.map +1 -0
  98. package/dist/src/commands/lifecycle-command-package.d.ts +45 -0
  99. package/dist/src/commands/lifecycle-command-package.js +199 -0
  100. package/dist/src/commands/lifecycle-command-package.js.map +1 -0
  101. package/dist/src/commands/managed-commands.d.ts +41 -0
  102. package/dist/src/commands/managed-commands.js +408 -0
  103. package/dist/src/commands/managed-commands.js.map +1 -0
  104. package/dist/src/commands/offline-cleanup-evidence.d.ts +12 -2
  105. package/dist/src/commands/offline-cleanup-evidence.js +57 -35
  106. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
  107. package/dist/src/commands/operation-plan.d.ts +72 -2
  108. package/dist/src/commands/operation-plan.js +54 -3
  109. package/dist/src/commands/operation-plan.js.map +1 -1
  110. package/dist/src/commands/operation-planner.d.ts +6 -5
  111. package/dist/src/commands/operation-planner.js +23 -20
  112. package/dist/src/commands/operation-planner.js.map +1 -1
  113. package/dist/src/commands/options.d.ts +11 -16
  114. package/dist/src/commands/options.js +31 -25
  115. package/dist/src/commands/options.js.map +1 -1
  116. package/dist/src/commands/permission-batch.d.ts +5 -0
  117. package/dist/src/commands/permission-batch.js +83 -0
  118. package/dist/src/commands/permission-batch.js.map +1 -0
  119. package/dist/src/commands/plugin-capabilities.js +128 -58
  120. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  121. package/dist/src/commands/public-config-confirmation.d.ts +14 -0
  122. package/dist/src/commands/public-config-confirmation.js +73 -0
  123. package/dist/src/commands/public-config-confirmation.js.map +1 -0
  124. package/dist/src/commands/public-interruption.d.ts +9 -0
  125. package/dist/src/commands/public-interruption.js +23 -0
  126. package/dist/src/commands/public-interruption.js.map +1 -0
  127. package/dist/src/commands/public-lifecycle-result.d.ts +107 -0
  128. package/dist/src/commands/public-lifecycle-result.js +536 -0
  129. package/dist/src/commands/public-lifecycle-result.js.map +1 -0
  130. package/dist/src/commands/public-lifecycle.d.ts +28 -0
  131. package/dist/src/commands/public-lifecycle.js +633 -0
  132. package/dist/src/commands/public-lifecycle.js.map +1 -0
  133. package/dist/src/commands/public-plugin-query.d.ts +16 -0
  134. package/dist/src/commands/public-plugin-query.js +235 -0
  135. package/dist/src/commands/public-plugin-query.js.map +1 -0
  136. package/dist/src/commands/rebuild-command.d.ts +177 -16
  137. package/dist/src/commands/rebuild-command.js +3374 -1558
  138. package/dist/src/commands/rebuild-command.js.map +1 -1
  139. package/dist/src/commands/rebuild-integration.d.ts +100 -55
  140. package/dist/src/commands/rebuild-integration.js +866 -3275
  141. package/dist/src/commands/rebuild-integration.js.map +1 -1
  142. package/dist/src/commands/rebuild-operations.d.ts +68 -13
  143. package/dist/src/commands/rebuild-operations.js +309 -120
  144. package/dist/src/commands/rebuild-operations.js.map +1 -1
  145. package/dist/src/commands/rebuild-platform-integration.d.ts +99 -0
  146. package/dist/src/commands/rebuild-platform-integration.js +2329 -0
  147. package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
  148. package/dist/src/commands/reconcile-operation-plan.d.ts +14 -9
  149. package/dist/src/commands/reconcile-operation-plan.js +26 -6
  150. package/dist/src/commands/reconcile-operation-plan.js.map +1 -1
  151. package/dist/src/commands/review-inspection.d.ts +60 -0
  152. package/dist/src/commands/review-inspection.js +437 -0
  153. package/dist/src/commands/review-inspection.js.map +1 -0
  154. package/dist/src/commands/review-preparation.d.ts +51 -0
  155. package/dist/src/commands/review-preparation.js +400 -0
  156. package/dist/src/commands/review-preparation.js.map +1 -0
  157. package/dist/src/commands/runtime.d.ts +7 -1
  158. package/dist/src/commands/runtime.js +41 -8
  159. package/dist/src/commands/runtime.js.map +1 -1
  160. package/dist/src/commands/skill-eval.d.ts +8 -0
  161. package/dist/src/commands/skill-eval.js +126 -73
  162. package/dist/src/commands/skill-eval.js.map +1 -1
  163. package/dist/src/commands/status-v6.d.ts +148 -35
  164. package/dist/src/commands/status-v6.js +1166 -307
  165. package/dist/src/commands/status-v6.js.map +1 -1
  166. package/dist/src/commands/targets-command.d.ts +38 -0
  167. package/dist/src/commands/targets-command.js +210 -0
  168. package/dist/src/commands/targets-command.js.map +1 -0
  169. package/dist/src/commands/wizard.d.ts +7 -3
  170. package/dist/src/commands/wizard.js +7 -4
  171. package/dist/src/commands/wizard.js.map +1 -1
  172. package/dist/src/commands/write-commands.d.ts +7 -1
  173. package/dist/src/commands/write-commands.js +129 -38
  174. package/dist/src/commands/write-commands.js.map +1 -1
  175. package/dist/src/constants.d.ts +2 -3
  176. package/dist/src/constants.js +2 -3
  177. package/dist/src/constants.js.map +1 -1
  178. package/dist/src/eval/manifest-v1.d.ts +6 -3
  179. package/dist/src/eval/manifest-v1.js +44 -33
  180. package/dist/src/eval/manifest-v1.js.map +1 -1
  181. package/dist/src/generators/local-plugin.d.ts +4 -2
  182. package/dist/src/generators/local-plugin.js +319 -353
  183. package/dist/src/generators/local-plugin.js.map +1 -1
  184. package/dist/src/generators/permissions.d.ts +20 -2
  185. package/dist/src/generators/permissions.js +82 -15
  186. package/dist/src/generators/permissions.js.map +1 -1
  187. package/dist/src/index.d.ts +3 -34
  188. package/dist/src/index.js +1711 -1935
  189. package/dist/src/index.js.map +1 -1
  190. package/dist/src/intent/deployment-preferences.d.ts +63 -0
  191. package/dist/src/intent/deployment-preferences.js +170 -0
  192. package/dist/src/intent/deployment-preferences.js.map +1 -0
  193. package/dist/src/intent/diagnostics.d.ts +11 -0
  194. package/dist/src/intent/diagnostics.js +14 -0
  195. package/dist/src/intent/diagnostics.js.map +1 -0
  196. package/dist/src/intent/intent-codec.d.ts +19 -0
  197. package/dist/src/intent/intent-codec.js +117 -0
  198. package/dist/src/intent/intent-codec.js.map +1 -0
  199. package/dist/src/intent/intent-store.d.ts +43 -0
  200. package/dist/src/intent/intent-store.js +118 -0
  201. package/dist/src/intent/intent-store.js.map +1 -0
  202. package/dist/src/intent/scope-context.d.ts +35 -0
  203. package/dist/src/intent/scope-context.js +179 -0
  204. package/dist/src/intent/scope-context.js.map +1 -0
  205. package/dist/src/intent/work-context.d.ts +13 -0
  206. package/dist/src/intent/work-context.js +22 -0
  207. package/dist/src/intent/work-context.js.map +1 -0
  208. package/dist/src/output/cli-progress.d.ts +30 -0
  209. package/dist/src/output/cli-progress.js +424 -0
  210. package/dist/src/output/cli-progress.js.map +1 -0
  211. package/dist/src/output/command-receipt.d.ts +6 -2
  212. package/dist/src/output/command-receipt.js +67 -32
  213. package/dist/src/output/command-receipt.js.map +1 -1
  214. package/dist/src/output/component-delivery.d.ts +28 -0
  215. package/dist/src/output/component-delivery.js +141 -0
  216. package/dist/src/output/component-delivery.js.map +1 -0
  217. package/dist/src/output/model.d.ts +123 -1
  218. package/dist/src/output/model.js +45 -1
  219. package/dist/src/output/model.js.map +1 -1
  220. package/dist/src/output/public-command-ids.d.ts +8 -0
  221. package/dist/src/output/public-command-ids.js +38 -0
  222. package/dist/src/output/public-command-ids.js.map +1 -0
  223. package/dist/src/output/public-result.d.ts +71 -0
  224. package/dist/src/output/public-result.js +40 -0
  225. package/dist/src/output/public-result.js.map +1 -0
  226. package/dist/src/output/rebuild-progress.d.ts +3 -0
  227. package/dist/src/output/rebuild-progress.js +34 -9
  228. package/dist/src/output/rebuild-progress.js.map +1 -1
  229. package/dist/src/output/receipt-projection.d.ts +7 -0
  230. package/dist/src/output/receipt-projection.js +670 -0
  231. package/dist/src/output/receipt-projection.js.map +1 -0
  232. package/dist/src/output/render/document.d.ts +55 -0
  233. package/dist/src/output/render/document.js +176 -0
  234. package/dist/src/output/render/document.js.map +1 -0
  235. package/dist/src/output/render/shared.d.ts +18 -0
  236. package/dist/src/output/render/shared.js +245 -0
  237. package/dist/src/output/render/shared.js.map +1 -0
  238. package/dist/src/output/render/style.d.ts +45 -0
  239. package/dist/src/output/render/style.js +155 -0
  240. package/dist/src/output/render/style.js.map +1 -0
  241. package/dist/src/output/render/views/commands-self.d.ts +6 -0
  242. package/dist/src/output/render/views/commands-self.js +210 -0
  243. package/dist/src/output/render/views/commands-self.js.map +1 -0
  244. package/dist/src/output/render/views/config.d.ts +2 -0
  245. package/dist/src/output/render/views/config.js +203 -0
  246. package/dist/src/output/render/views/config.js.map +1 -0
  247. package/dist/src/output/render/views/dev.d.ts +2 -0
  248. package/dist/src/output/render/views/dev.js +278 -0
  249. package/dist/src/output/render/views/dev.js.map +1 -0
  250. package/dist/src/output/render/views/fallback.d.ts +2 -0
  251. package/dist/src/output/render/views/fallback.js +6 -0
  252. package/dist/src/output/render/views/fallback.js.map +1 -0
  253. package/dist/src/output/render/views/index.d.ts +3 -0
  254. package/dist/src/output/render/views/index.js +79 -0
  255. package/dist/src/output/render/views/index.js.map +1 -0
  256. package/dist/src/output/render/views/lifecycle.d.ts +5 -0
  257. package/dist/src/output/render/views/lifecycle.js +170 -0
  258. package/dist/src/output/render/views/lifecycle.js.map +1 -0
  259. package/dist/src/output/render/views/sources-cache.d.ts +3 -0
  260. package/dist/src/output/render/views/sources-cache.js +322 -0
  261. package/dist/src/output/render/views/sources-cache.js.map +1 -0
  262. package/dist/src/output/render/views/targets.d.ts +2 -0
  263. package/dist/src/output/render/views/targets.js +82 -0
  264. package/dist/src/output/render/views/targets.js.map +1 -0
  265. package/dist/src/output/skill-invocation-notices.d.ts +18 -0
  266. package/dist/src/output/skill-invocation-notices.js +84 -0
  267. package/dist/src/output/skill-invocation-notices.js.map +1 -0
  268. package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
  269. package/dist/src/platforms/antigravity-permissions.js +388 -0
  270. package/dist/src/platforms/antigravity-permissions.js.map +1 -0
  271. package/dist/src/platforms/capabilities.d.ts +9 -0
  272. package/dist/src/platforms/capabilities.js +125 -0
  273. package/dist/src/platforms/capabilities.js.map +1 -0
  274. package/dist/src/platforms/contracts.d.ts +394 -0
  275. package/dist/src/platforms/contracts.js +2 -0
  276. package/dist/src/platforms/contracts.js.map +1 -0
  277. package/dist/src/platforms/cursor-workspace-hook.d.ts +28 -0
  278. package/dist/src/platforms/cursor-workspace-hook.js +198 -0
  279. package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
  280. package/dist/src/platforms/discovery.d.ts +100 -0
  281. package/dist/src/platforms/discovery.js +796 -0
  282. package/dist/src/platforms/discovery.js.map +1 -0
  283. package/dist/src/platforms/grok-permission-config.d.ts +23 -0
  284. package/dist/src/platforms/grok-permission-config.js +184 -0
  285. package/dist/src/platforms/grok-permission-config.js.map +1 -0
  286. package/dist/src/platforms/grok-permission-document.d.ts +4 -0
  287. package/dist/src/platforms/grok-permission-document.js +145 -0
  288. package/dist/src/platforms/grok-permission-document.js.map +1 -0
  289. package/dist/src/platforms/grok-permissions.d.ts +17 -0
  290. package/dist/src/platforms/grok-permissions.js +311 -0
  291. package/dist/src/platforms/grok-permissions.js.map +1 -0
  292. package/dist/src/platforms/host-permission-policy.d.ts +38 -0
  293. package/dist/src/platforms/host-permission-policy.js +86 -0
  294. package/dist/src/platforms/host-permission-policy.js.map +1 -0
  295. package/dist/src/platforms/identity.d.ts +4 -0
  296. package/dist/src/platforms/identity.js +22 -0
  297. package/dist/src/platforms/identity.js.map +1 -0
  298. package/dist/src/platforms/inspection-grok.d.ts +4 -0
  299. package/dist/src/platforms/inspection-grok.js +380 -0
  300. package/dist/src/platforms/inspection-grok.js.map +1 -0
  301. package/dist/src/platforms/inspection-native.d.ts +8 -0
  302. package/dist/src/platforms/inspection-native.js +584 -0
  303. package/dist/src/platforms/inspection-native.js.map +1 -0
  304. package/dist/src/platforms/inspection-opencode.d.ts +4 -0
  305. package/dist/src/platforms/inspection-opencode.js +98 -0
  306. package/dist/src/platforms/inspection-opencode.js.map +1 -0
  307. package/dist/src/platforms/inspection-pi.d.ts +9 -0
  308. package/dist/src/platforms/inspection-pi.js +490 -0
  309. package/dist/src/platforms/inspection-pi.js.map +1 -0
  310. package/dist/src/platforms/inspection-query.d.ts +26 -0
  311. package/dist/src/platforms/inspection-query.js +118 -0
  312. package/dist/src/platforms/inspection-query.js.map +1 -0
  313. package/dist/src/platforms/inspection.d.ts +20 -0
  314. package/dist/src/platforms/inspection.js +259 -0
  315. package/dist/src/platforms/inspection.js.map +1 -0
  316. package/dist/src/platforms/layout.d.ts +35 -0
  317. package/dist/src/platforms/layout.js +332 -0
  318. package/dist/src/platforms/layout.js.map +1 -0
  319. package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
  320. package/dist/src/platforms/lifecycle-native-services.js +213 -0
  321. package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
  322. package/dist/src/platforms/lifecycle-native.d.ts +14 -0
  323. package/dist/src/platforms/lifecycle-native.js +234 -0
  324. package/dist/src/platforms/lifecycle-native.js.map +1 -0
  325. package/dist/src/platforms/lifecycle.d.ts +29 -0
  326. package/dist/src/platforms/lifecycle.js +688 -0
  327. package/dist/src/platforms/lifecycle.js.map +1 -0
  328. package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
  329. package/dist/src/platforms/opencode-permission-config.js +253 -0
  330. package/dist/src/platforms/opencode-permission-config.js.map +1 -0
  331. package/dist/src/platforms/opencode-permissions.d.ts +39 -0
  332. package/dist/src/platforms/opencode-permissions.js +212 -0
  333. package/dist/src/platforms/opencode-permissions.js.map +1 -0
  334. package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
  335. package/dist/src/platforms/opencode-related-permissions.js +177 -0
  336. package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
  337. package/dist/src/platforms/permission-ownership.d.ts +89 -0
  338. package/dist/src/platforms/permission-ownership.js +543 -0
  339. package/dist/src/platforms/permission-ownership.js.map +1 -0
  340. package/dist/src/platforms/permission-sidecar.d.ts +70 -0
  341. package/dist/src/platforms/permission-sidecar.js +215 -0
  342. package/dist/src/platforms/permission-sidecar.js.map +1 -0
  343. package/dist/src/platforms/projection-code-extension.d.ts +8 -0
  344. package/dist/src/platforms/projection-code-extension.js +126 -0
  345. package/dist/src/platforms/projection-code-extension.js.map +1 -0
  346. package/dist/src/platforms/projection-command-resources.d.ts +7 -0
  347. package/dist/src/platforms/projection-command-resources.js +74 -0
  348. package/dist/src/platforms/projection-command-resources.js.map +1 -0
  349. package/dist/src/platforms/projection-files.d.ts +28 -0
  350. package/dist/src/platforms/projection-files.js +113 -0
  351. package/dist/src/platforms/projection-files.js.map +1 -0
  352. package/dist/src/platforms/projection-marketplace.d.ts +19 -0
  353. package/dist/src/platforms/projection-marketplace.js +42 -0
  354. package/dist/src/platforms/projection-marketplace.js.map +1 -0
  355. package/dist/src/platforms/projection.d.ts +13 -0
  356. package/dist/src/platforms/projection.js +578 -0
  357. package/dist/src/platforms/projection.js.map +1 -0
  358. package/dist/src/platforms/read-only-retry-policy.d.ts +34 -0
  359. package/dist/src/platforms/read-only-retry-policy.js +70 -0
  360. package/dist/src/platforms/read-only-retry-policy.js.map +1 -0
  361. package/dist/src/platforms/registry.d.ts +4 -0
  362. package/dist/src/platforms/registry.js +30 -0
  363. package/dist/src/platforms/registry.js.map +1 -0
  364. package/dist/src/platforms/retirement-native.d.ts +6 -0
  365. package/dist/src/platforms/retirement-native.js +95 -0
  366. package/dist/src/platforms/retirement-native.js.map +1 -0
  367. package/dist/src/platforms/supplement-layout.d.ts +20 -0
  368. package/dist/src/platforms/supplement-layout.js +54 -0
  369. package/dist/src/platforms/supplement-layout.js.map +1 -0
  370. package/dist/src/platforms/supplement-state.d.ts +13 -0
  371. package/dist/src/platforms/supplement-state.js +93 -0
  372. package/dist/src/platforms/supplement-state.js.map +1 -0
  373. package/dist/src/portable/commands.d.ts +60 -11
  374. package/dist/src/portable/commands.js +88 -346
  375. package/dist/src/portable/commands.js.map +1 -1
  376. package/dist/src/portable/historical-materialization.d.ts +25 -0
  377. package/dist/src/portable/historical-materialization.js +148 -0
  378. package/dist/src/portable/historical-materialization.js.map +1 -0
  379. package/dist/src/portable/materializer.d.ts +46 -2
  380. package/dist/src/portable/materializer.js +262 -259
  381. package/dist/src/portable/materializer.js.map +1 -1
  382. package/dist/src/portable/recovery-layout.d.ts +17 -0
  383. package/dist/src/portable/recovery-layout.js +42 -0
  384. package/dist/src/portable/recovery-layout.js.map +1 -0
  385. package/dist/src/portable/recovery.d.ts +177 -0
  386. package/dist/src/portable/recovery.js +597 -0
  387. package/dist/src/portable/recovery.js.map +1 -0
  388. package/dist/src/portable/writer.d.ts +67 -0
  389. package/dist/src/portable/writer.js +321 -0
  390. package/dist/src/portable/writer.js.map +1 -0
  391. package/dist/src/recovery/coordinator.d.ts +175 -0
  392. package/dist/src/recovery/coordinator.js +1629 -0
  393. package/dist/src/recovery/coordinator.js.map +1 -0
  394. package/dist/src/recovery/demand.d.ts +53 -0
  395. package/dist/src/recovery/demand.js +189 -0
  396. package/dist/src/recovery/demand.js.map +1 -0
  397. package/dist/src/recovery/install-concurrency.d.ts +48 -0
  398. package/dist/src/recovery/install-concurrency.js +196 -0
  399. package/dist/src/recovery/install-concurrency.js.map +1 -0
  400. package/dist/src/recovery/interruption.d.ts +19 -0
  401. package/dist/src/recovery/interruption.js +43 -0
  402. package/dist/src/recovery/interruption.js.map +1 -0
  403. package/dist/src/recovery/joint-coordinator.d.ts +46 -0
  404. package/dist/src/recovery/joint-coordinator.js +1728 -0
  405. package/dist/src/recovery/joint-coordinator.js.map +1 -0
  406. package/dist/src/recovery/joint-demand.d.ts +72 -0
  407. package/dist/src/recovery/joint-demand.js +332 -0
  408. package/dist/src/recovery/joint-demand.js.map +1 -0
  409. package/dist/src/recovery/joint-install-execution.d.ts +19 -0
  410. package/dist/src/recovery/joint-install-execution.js +312 -0
  411. package/dist/src/recovery/joint-install-execution.js.map +1 -0
  412. package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
  413. package/dist/src/recovery/joint-install-native-rebase.js +67 -0
  414. package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
  415. package/dist/src/recovery/performance.d.ts +4 -0
  416. package/dist/src/recovery/performance.js +26 -0
  417. package/dist/src/recovery/performance.js.map +1 -0
  418. package/dist/src/recovery/receipt.d.ts +131 -0
  419. package/dist/src/recovery/receipt.js +91 -0
  420. package/dist/src/recovery/receipt.js.map +1 -0
  421. package/dist/src/recovery/retirement.d.ts +47 -0
  422. package/dist/src/recovery/retirement.js +504 -0
  423. package/dist/src/recovery/retirement.js.map +1 -0
  424. package/dist/src/recovery/status.d.ts +143 -0
  425. package/dist/src/recovery/status.js +1528 -0
  426. package/dist/src/recovery/status.js.map +1 -0
  427. package/dist/src/recovery/types.d.ts +85 -0
  428. package/dist/src/recovery/types.js +2 -0
  429. package/dist/src/recovery/types.js.map +1 -0
  430. package/dist/src/review/eval-source-input.d.ts +44 -0
  431. package/dist/src/review/eval-source-input.js +213 -0
  432. package/dist/src/review/eval-source-input.js.map +1 -0
  433. package/dist/src/review/platform-profile.d.ts +5 -0
  434. package/dist/src/review/platform-profile.js +13 -0
  435. package/dist/src/review/platform-profile.js.map +1 -0
  436. package/dist/src/review/review-profile.d.ts +20 -0
  437. package/dist/src/review/review-profile.js +286 -0
  438. package/dist/src/review/review-profile.js.map +1 -0
  439. package/dist/src/review/review-selection.d.ts +20 -0
  440. package/dist/src/review/review-selection.js +502 -0
  441. package/dist/src/review/review-selection.js.map +1 -0
  442. package/dist/src/review/review-types.d.ts +71 -0
  443. package/dist/src/review/review-types.js +16 -0
  444. package/dist/src/review/review-types.js.map +1 -0
  445. package/dist/src/review/skill-materialization.d.ts +67 -0
  446. package/dist/src/review/skill-materialization.js +235 -0
  447. package/dist/src/review/skill-materialization.js.map +1 -0
  448. package/dist/src/review/source-binding.d.ts +203 -0
  449. package/dist/src/review/source-binding.js +791 -0
  450. package/dist/src/review/source-binding.js.map +1 -0
  451. package/dist/src/tui/agent-management.d.ts +23 -0
  452. package/dist/src/tui/agent-management.js +319 -0
  453. package/dist/src/tui/agent-management.js.map +1 -0
  454. package/dist/src/tui/agent-settings.d.ts +47 -0
  455. package/dist/src/tui/agent-settings.js +97 -0
  456. package/dist/src/tui/agent-settings.js.map +1 -0
  457. package/dist/src/tui/catalog-generation.d.ts +9 -0
  458. package/dist/src/tui/catalog-generation.js +96 -6
  459. package/dist/src/tui/catalog-generation.js.map +1 -1
  460. package/dist/src/tui/catalog-sources/projection.d.ts +2 -2
  461. package/dist/src/tui/catalog-sources/screens.js +19 -12
  462. package/dist/src/tui/catalog-sources/screens.js.map +1 -1
  463. package/dist/src/tui/catalog-sources/session.d.ts +11 -1
  464. package/dist/src/tui/catalog-sources/session.js +80 -5
  465. package/dist/src/tui/catalog-sources/session.js.map +1 -1
  466. package/dist/src/tui/catalog-sources/types.d.ts +15 -2
  467. package/dist/src/tui/catalog-store-task.d.ts +16 -0
  468. package/dist/src/tui/catalog-store-task.js +19 -0
  469. package/dist/src/tui/catalog-store-task.js.map +1 -0
  470. package/dist/src/tui/clipboard.d.ts +13 -0
  471. package/dist/src/tui/clipboard.js +95 -0
  472. package/dist/src/tui/clipboard.js.map +1 -0
  473. package/dist/src/tui/components.d.ts +113 -3
  474. package/dist/src/tui/components.js +201 -34
  475. package/dist/src/tui/components.js.map +1 -1
  476. package/dist/src/tui/config-array-draft.d.ts +30 -0
  477. package/dist/src/tui/config-array-draft.js +51 -0
  478. package/dist/src/tui/config-array-draft.js.map +1 -0
  479. package/dist/src/tui/config-leaf-editor.d.ts +44 -0
  480. package/dist/src/tui/config-leaf-editor.js +227 -0
  481. package/dist/src/tui/config-leaf-editor.js.map +1 -0
  482. package/dist/src/tui/config-object-suggestions.d.ts +15 -0
  483. package/dist/src/tui/config-object-suggestions.js +71 -0
  484. package/dist/src/tui/config-object-suggestions.js.map +1 -0
  485. package/dist/src/tui/config-references.d.ts +38 -0
  486. package/dist/src/tui/config-references.js +82 -0
  487. package/dist/src/tui/config-references.js.map +1 -0
  488. package/dist/src/tui/config-suggestions.d.ts +27 -0
  489. package/dist/src/tui/config-suggestions.js +62 -0
  490. package/dist/src/tui/config-suggestions.js.map +1 -0
  491. package/dist/src/tui/config-value-presentation.d.ts +23 -0
  492. package/dist/src/tui/config-value-presentation.js +151 -0
  493. package/dist/src/tui/config-value-presentation.js.map +1 -0
  494. package/dist/src/tui/console-app-v4.d.ts +14 -5
  495. package/dist/src/tui/console-app-v4.js +9779 -2488
  496. package/dist/src/tui/console-app-v4.js.map +1 -1
  497. package/dist/src/tui/content-item-card.d.ts +13 -0
  498. package/dist/src/tui/content-item-card.js +51 -0
  499. package/dist/src/tui/content-item-card.js.map +1 -0
  500. package/dist/src/tui/controller-runtime.d.ts +4 -3
  501. package/dist/src/tui/controller-runtime.js +1610 -590
  502. package/dist/src/tui/controller-runtime.js.map +1 -1
  503. package/dist/src/tui/controller.d.ts +583 -80
  504. package/dist/src/tui/controller.js +3362 -263
  505. package/dist/src/tui/controller.js.map +1 -1
  506. package/dist/src/tui/dependency-graph-view.d.ts +39 -0
  507. package/dist/src/tui/dependency-graph-view.js +121 -0
  508. package/dist/src/tui/dependency-graph-view.js.map +1 -0
  509. package/dist/src/tui/dependency-graph.d.ts +81 -0
  510. package/dist/src/tui/dependency-graph.js +452 -0
  511. package/dist/src/tui/dependency-graph.js.map +1 -0
  512. package/dist/src/tui/deployment-view.d.ts +14 -0
  513. package/dist/src/tui/deployment-view.js +175 -0
  514. package/dist/src/tui/deployment-view.js.map +1 -0
  515. package/dist/src/tui/diagnostic-projection.d.ts +31 -0
  516. package/dist/src/tui/diagnostic-projection.js +681 -0
  517. package/dist/src/tui/diagnostic-projection.js.map +1 -0
  518. package/dist/src/tui/diagnostics.d.ts +6 -2
  519. package/dist/src/tui/diagnostics.js +14 -2
  520. package/dist/src/tui/diagnostics.js.map +1 -1
  521. package/dist/src/tui/entity-cards.d.ts +56 -0
  522. package/dist/src/tui/entity-cards.js +327 -0
  523. package/dist/src/tui/entity-cards.js.map +1 -0
  524. package/dist/src/tui/glossary.d.ts +25 -0
  525. package/dist/src/tui/glossary.js +78 -0
  526. package/dist/src/tui/glossary.js.map +1 -0
  527. package/dist/src/tui/guided-setup.d.ts +25 -0
  528. package/dist/src/tui/guided-setup.js +101 -0
  529. package/dist/src/tui/guided-setup.js.map +1 -0
  530. package/dist/src/tui/index.d.ts +4 -1
  531. package/dist/src/tui/index.js +4 -1
  532. package/dist/src/tui/index.js.map +1 -1
  533. package/dist/src/tui/input-display.d.ts +1 -0
  534. package/dist/src/tui/input-display.js +23 -1
  535. package/dist/src/tui/input-display.js.map +1 -1
  536. package/dist/src/tui/keys.d.ts +44 -0
  537. package/dist/src/tui/keys.js +43 -15
  538. package/dist/src/tui/keys.js.map +1 -1
  539. package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
  540. package/dist/src/tui/lifecycle-action-view.js +36 -0
  541. package/dist/src/tui/lifecycle-action-view.js.map +1 -0
  542. package/dist/src/tui/model.d.ts +141 -28
  543. package/dist/src/tui/model.js +968 -285
  544. package/dist/src/tui/model.js.map +1 -1
  545. package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
  546. package/dist/src/tui/operation-diagnostic-screens.js +76 -0
  547. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
  548. package/dist/src/tui/operation-history.d.ts +91 -0
  549. package/dist/src/tui/operation-history.js +167 -0
  550. package/dist/src/tui/operation-history.js.map +1 -0
  551. package/dist/src/tui/operation-review-planner.d.ts +7 -0
  552. package/dist/src/tui/operation-review-planner.js +980 -146
  553. package/dist/src/tui/operation-review-planner.js.map +1 -1
  554. package/dist/src/tui/plugin-content.d.ts +33 -0
  555. package/dist/src/tui/plugin-content.js +245 -0
  556. package/dist/src/tui/plugin-content.js.map +1 -0
  557. package/dist/src/tui/plugin-detail.d.ts +75 -0
  558. package/dist/src/tui/plugin-detail.js +267 -0
  559. package/dist/src/tui/plugin-detail.js.map +1 -0
  560. package/dist/src/tui/plugin-write-task.d.ts +69 -0
  561. package/dist/src/tui/plugin-write-task.js +286 -0
  562. package/dist/src/tui/plugin-write-task.js.map +1 -0
  563. package/dist/src/tui/query-header.d.ts +30 -0
  564. package/dist/src/tui/query-header.js +40 -0
  565. package/dist/src/tui/query-header.js.map +1 -0
  566. package/dist/src/tui/reader.d.ts +38 -0
  567. package/dist/src/tui/reader.js +49 -0
  568. package/dist/src/tui/reader.js.map +1 -0
  569. package/dist/src/tui/router.d.ts +170 -39
  570. package/dist/src/tui/router.js +338 -50
  571. package/dist/src/tui/router.js.map +1 -1
  572. package/dist/src/tui/scoped-flow.d.ts +49 -0
  573. package/dist/src/tui/scoped-flow.js +212 -0
  574. package/dist/src/tui/scoped-flow.js.map +1 -0
  575. package/dist/src/tui/scoped-inventory.d.ts +139 -0
  576. package/dist/src/tui/scoped-inventory.js +295 -0
  577. package/dist/src/tui/scoped-inventory.js.map +1 -0
  578. package/dist/src/tui/screen-registry.d.ts +696 -0
  579. package/dist/src/tui/screen-registry.js +226 -0
  580. package/dist/src/tui/screen-registry.js.map +1 -0
  581. package/dist/src/tui/session-console-app.d.ts +8 -0
  582. package/dist/src/tui/session-console-app.js +24 -0
  583. package/dist/src/tui/session-console-app.js.map +1 -0
  584. package/dist/src/tui/session-host.d.ts +45 -0
  585. package/dist/src/tui/session-host.js +219 -0
  586. package/dist/src/tui/session-host.js.map +1 -0
  587. package/dist/src/tui/source-detail-card.d.ts +29 -0
  588. package/dist/src/tui/source-detail-card.js +45 -0
  589. package/dist/src/tui/source-detail-card.js.map +1 -0
  590. package/dist/src/tui/theme.d.ts +12 -0
  591. package/dist/src/tui/theme.js +12 -0
  592. package/dist/src/tui/theme.js.map +1 -1
  593. package/dist/src/tui/viewport.d.ts +1 -0
  594. package/dist/src/tui/viewport.js +23 -0
  595. package/dist/src/tui/viewport.js.map +1 -1
  596. package/dist/src/tui/wizard.js +26 -4
  597. package/dist/src/tui/wizard.js.map +1 -1
  598. package/dist/src/types.d.ts +105 -83
  599. package/dist/src/types.js +1 -1
  600. package/dist/src/types.js.map +1 -1
  601. package/dist/src/utils/agent-version.d.ts +10 -4
  602. package/dist/src/utils/agent-version.js +6 -8
  603. package/dist/src/utils/agent-version.js.map +1 -1
  604. package/dist/src/utils/artifact-plan.d.ts +18 -25
  605. package/dist/src/utils/artifact-plan.js +59 -445
  606. package/dist/src/utils/artifact-plan.js.map +1 -1
  607. package/dist/src/utils/artifact-renderer.d.ts +64 -90
  608. package/dist/src/utils/artifact-renderer.js +202 -303
  609. package/dist/src/utils/artifact-renderer.js.map +1 -1
  610. package/dist/src/utils/artifact-request.d.ts +19 -14
  611. package/dist/src/utils/artifact-request.js +51 -36
  612. package/dist/src/utils/artifact-request.js.map +1 -1
  613. package/dist/src/utils/artifact-sources.d.ts +4 -8
  614. package/dist/src/utils/artifact-sources.js +15 -6
  615. package/dist/src/utils/artifact-sources.js.map +1 -1
  616. package/dist/src/utils/aw-home-mutation-lock.d.ts +1 -0
  617. package/dist/src/utils/aw-home-mutation-lock.js +28 -6
  618. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  619. package/dist/src/utils/bundle-layout.d.ts +2 -0
  620. package/dist/src/utils/bundle-layout.js +88 -158
  621. package/dist/src/utils/bundle-layout.js.map +1 -1
  622. package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
  623. package/dist/src/utils/catalog-capability-projection.js +14 -0
  624. package/dist/src/utils/catalog-capability-projection.js.map +1 -0
  625. package/dist/src/utils/catalog-digests.d.ts +2 -12
  626. package/dist/src/utils/catalog-digests.js +7 -55
  627. package/dist/src/utils/catalog-digests.js.map +1 -1
  628. package/dist/src/utils/catalog-generation-resolver.d.ts +28 -4
  629. package/dist/src/utils/catalog-generation-resolver.js +146 -40
  630. package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
  631. package/dist/src/utils/catalog-generation-service.d.ts +25 -2
  632. package/dist/src/utils/catalog-generation-service.js +99 -48
  633. package/dist/src/utils/catalog-generation-service.js.map +1 -1
  634. package/dist/src/utils/catalog-generation-state.js +1 -1
  635. package/dist/src/utils/catalog-generation-state.js.map +1 -1
  636. package/dist/src/utils/catalog-generation-store.d.ts +5 -0
  637. package/dist/src/utils/catalog-generation-store.js +69 -10
  638. package/dist/src/utils/catalog-generation-store.js.map +1 -1
  639. package/dist/src/utils/catalog-operation-context.d.ts +61 -4
  640. package/dist/src/utils/catalog-operation-context.js +225 -4
  641. package/dist/src/utils/catalog-operation-context.js.map +1 -1
  642. package/dist/src/utils/catalog-public-error.js +4 -0
  643. package/dist/src/utils/catalog-public-error.js.map +1 -1
  644. package/dist/src/utils/catalog-runtime-projection.d.ts +4 -3
  645. package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
  646. package/dist/src/utils/catalog-snapshot.d.ts +3 -0
  647. package/dist/src/utils/catalog-snapshot.js +4 -1
  648. package/dist/src/utils/catalog-snapshot.js.map +1 -1
  649. package/dist/src/utils/catalog-source-impact.d.ts +3 -2
  650. package/dist/src/utils/catalog-source-impact.js +142 -20
  651. package/dist/src/utils/catalog-source-impact.js.map +1 -1
  652. package/dist/src/utils/catalog-source-references.d.ts +57 -1
  653. package/dist/src/utils/catalog-source-references.js +755 -162
  654. package/dist/src/utils/catalog-source-references.js.map +1 -1
  655. package/dist/src/utils/catalog-sources.d.ts +1 -1
  656. package/dist/src/utils/catalog-sources.js +21 -5
  657. package/dist/src/utils/catalog-sources.js.map +1 -1
  658. package/dist/src/utils/codex-config.d.ts +3 -0
  659. package/dist/src/utils/codex-config.js +7 -0
  660. package/dist/src/utils/codex-config.js.map +1 -1
  661. package/dist/src/utils/codex-executable-discovery.d.ts +28 -0
  662. package/dist/src/utils/codex-executable-discovery.js +431 -0
  663. package/dist/src/utils/codex-executable-discovery.js.map +1 -0
  664. package/dist/src/utils/codex-manager.d.ts +23 -42
  665. package/dist/src/utils/codex-manager.js +79 -767
  666. package/dist/src/utils/codex-manager.js.map +1 -1
  667. package/dist/src/utils/codex-native-observation.d.ts +40 -1
  668. package/dist/src/utils/codex-native-observation.js +172 -0
  669. package/dist/src/utils/codex-native-observation.js.map +1 -1
  670. package/dist/src/utils/codex-reconciler.d.ts +2 -7
  671. package/dist/src/utils/codex-reconciler.js +33 -5
  672. package/dist/src/utils/codex-reconciler.js.map +1 -1
  673. package/dist/src/utils/codex-shared-native.d.ts +8 -26
  674. package/dist/src/utils/codex-shared-native.js +63 -83
  675. package/dist/src/utils/codex-shared-native.js.map +1 -1
  676. package/dist/src/utils/codex-skill-staging.d.ts +4 -3
  677. package/dist/src/utils/codex-skill-staging.js.map +1 -1
  678. package/dist/src/utils/codex-skills-root.d.ts +4 -0
  679. package/dist/src/utils/codex-skills-root.js +29 -0
  680. package/dist/src/utils/codex-skills-root.js.map +1 -0
  681. package/dist/src/utils/codex-surface-analysis.d.ts +6 -2
  682. package/dist/src/utils/codex-surface-analysis.js +31 -56
  683. package/dist/src/utils/codex-surface-analysis.js.map +1 -1
  684. package/dist/src/utils/component-agent-binding.d.ts +17 -0
  685. package/dist/src/utils/component-agent-binding.js +119 -0
  686. package/dist/src/utils/component-agent-binding.js.map +1 -0
  687. package/dist/src/utils/component-command-preparation.d.ts +33 -0
  688. package/dist/src/utils/component-command-preparation.js +129 -0
  689. package/dist/src/utils/component-command-preparation.js.map +1 -0
  690. package/dist/src/utils/component-gap.d.ts +4 -0
  691. package/dist/src/utils/component-gap.js +16 -0
  692. package/dist/src/utils/component-gap.js.map +1 -0
  693. package/dist/src/utils/component-resources.d.ts +53 -0
  694. package/dist/src/utils/component-resources.js +340 -0
  695. package/dist/src/utils/component-resources.js.map +1 -0
  696. package/dist/src/utils/config-platforms.d.ts +21 -0
  697. package/dist/src/utils/config-platforms.js +51 -0
  698. package/dist/src/utils/config-platforms.js.map +1 -0
  699. package/dist/src/utils/dynamic-skill-tree.d.ts +18 -6
  700. package/dist/src/utils/dynamic-skill-tree.js +33 -40
  701. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  702. package/dist/src/utils/git-catalog-provider.d.ts +3 -0
  703. package/dist/src/utils/git-catalog-provider.js +49 -3
  704. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  705. package/dist/src/utils/inventory-recovery-diagnostic.d.ts +4 -0
  706. package/dist/src/utils/inventory-recovery-diagnostic.js +15 -0
  707. package/dist/src/utils/inventory-recovery-diagnostic.js.map +1 -0
  708. package/dist/src/utils/local-marketplace.d.ts +19 -12
  709. package/dist/src/utils/local-marketplace.js +97 -194
  710. package/dist/src/utils/local-marketplace.js.map +1 -1
  711. package/dist/src/utils/managed-command-cli-review.d.ts +53 -0
  712. package/dist/src/utils/managed-command-cli-review.js +431 -0
  713. package/dist/src/utils/managed-command-cli-review.js.map +1 -0
  714. package/dist/src/utils/managed-command-closure.d.ts +14 -0
  715. package/dist/src/utils/managed-command-closure.js +156 -0
  716. package/dist/src/utils/managed-command-closure.js.map +1 -0
  717. package/dist/src/utils/managed-command-errors.d.ts +5 -0
  718. package/dist/src/utils/managed-command-errors.js +10 -0
  719. package/dist/src/utils/managed-command-errors.js.map +1 -0
  720. package/dist/src/utils/managed-command-materialization.d.ts +90 -0
  721. package/dist/src/utils/managed-command-materialization.js +375 -0
  722. package/dist/src/utils/managed-command-materialization.js.map +1 -0
  723. package/dist/src/utils/managed-command-preparation.d.ts +30 -0
  724. package/dist/src/utils/managed-command-preparation.js +39 -0
  725. package/dist/src/utils/managed-command-preparation.js.map +1 -0
  726. package/dist/src/utils/managed-command-review.d.ts +33 -0
  727. package/dist/src/utils/managed-command-review.js +80 -0
  728. package/dist/src/utils/managed-command-review.js.map +1 -0
  729. package/dist/src/utils/managed-command-runtime.d.ts +36 -0
  730. package/dist/src/utils/managed-command-runtime.js +126 -0
  731. package/dist/src/utils/managed-command-runtime.js.map +1 -0
  732. package/dist/src/utils/managed-command-snapshots.d.ts +24 -0
  733. package/dist/src/utils/managed-command-snapshots.js +89 -0
  734. package/dist/src/utils/managed-command-snapshots.js.map +1 -0
  735. package/dist/src/utils/managed-command-store.d.ts +141 -0
  736. package/dist/src/utils/managed-command-store.js +839 -0
  737. package/dist/src/utils/managed-command-store.js.map +1 -0
  738. package/dist/src/utils/multi-source-catalog.d.ts +6 -1
  739. package/dist/src/utils/multi-source-catalog.js +9 -4
  740. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  741. package/dist/src/utils/native-cli-interruption.d.ts +11 -0
  742. package/dist/src/utils/native-cli-interruption.js +106 -0
  743. package/dist/src/utils/native-cli-interruption.js.map +1 -0
  744. package/dist/src/utils/native-cli.d.ts +37 -6
  745. package/dist/src/utils/native-cli.js +523 -60
  746. package/dist/src/utils/native-cli.js.map +1 -1
  747. package/dist/src/utils/native-demand.d.ts +29 -0
  748. package/dist/src/utils/native-demand.js +4 -0
  749. package/dist/src/utils/native-demand.js.map +1 -0
  750. package/dist/src/utils/native-tool-context.d.ts +17 -0
  751. package/dist/src/utils/native-tool-context.js +40 -0
  752. package/dist/src/utils/native-tool-context.js.map +1 -0
  753. package/dist/src/utils/native-tool-review.d.ts +8 -0
  754. package/dist/src/utils/native-tool-review.js +14 -0
  755. package/dist/src/utils/native-tool-review.js.map +1 -0
  756. package/dist/src/utils/ownership.d.ts +38 -3
  757. package/dist/src/utils/ownership.js +118 -11
  758. package/dist/src/utils/ownership.js.map +1 -1
  759. package/dist/src/utils/package-content.d.ts +7 -0
  760. package/dist/src/utils/package-content.js +70 -0
  761. package/dist/src/utils/package-content.js.map +1 -0
  762. package/dist/src/utils/path-catalog-provider.js +2 -0
  763. package/dist/src/utils/path-catalog-provider.js.map +1 -1
  764. package/dist/src/utils/paths.d.ts +1 -1
  765. package/dist/src/utils/paths.js +5 -2
  766. package/dist/src/utils/paths.js.map +1 -1
  767. package/dist/src/utils/platform-empty-state.d.ts +69 -0
  768. package/dist/src/utils/platform-empty-state.js +249 -0
  769. package/dist/src/utils/platform-empty-state.js.map +1 -0
  770. package/dist/src/utils/platform-support.d.ts +1 -1
  771. package/dist/src/utils/platform-support.js +1 -1
  772. package/dist/src/utils/platform-support.js.map +1 -1
  773. package/dist/src/utils/plugin-config-command-apply.d.ts +33 -0
  774. package/dist/src/utils/plugin-config-command-apply.js +142 -0
  775. package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
  776. package/dist/src/utils/plugin-config-diagnostics.d.ts +16 -0
  777. package/dist/src/utils/plugin-config-diagnostics.js +44 -0
  778. package/dist/src/utils/plugin-config-diagnostics.js.map +1 -0
  779. package/dist/src/utils/plugin-config-impact.d.ts +76 -0
  780. package/dist/src/utils/plugin-config-impact.js +359 -0
  781. package/dist/src/utils/plugin-config-impact.js.map +1 -0
  782. package/dist/src/utils/plugin-config-references.d.ts +116 -0
  783. package/dist/src/utils/plugin-config-references.js +379 -0
  784. package/dist/src/utils/plugin-config-references.js.map +1 -0
  785. package/dist/src/utils/plugin-config-suggestion-runner.d.ts +83 -0
  786. package/dist/src/utils/plugin-config-suggestion-runner.js +308 -0
  787. package/dist/src/utils/plugin-config-suggestion-runner.js.map +1 -0
  788. package/dist/src/utils/plugin-config-suggestions.d.ts +50 -0
  789. package/dist/src/utils/plugin-config-suggestions.js +322 -0
  790. package/dist/src/utils/plugin-config-suggestions.js.map +1 -0
  791. package/dist/src/utils/plugin-config-write.d.ts +108 -19
  792. package/dist/src/utils/plugin-config-write.js +781 -568
  793. package/dist/src/utils/plugin-config-write.js.map +1 -1
  794. package/dist/src/utils/plugin-config.d.ts +122 -43
  795. package/dist/src/utils/plugin-config.js +574 -610
  796. package/dist/src/utils/plugin-config.js.map +1 -1
  797. package/dist/src/utils/plugin-dependencies.d.ts +1 -1
  798. package/dist/src/utils/plugin-dependencies.js.map +1 -1
  799. package/dist/src/utils/plugin-scripts.d.ts +41 -17
  800. package/dist/src/utils/plugin-scripts.js +586 -123
  801. package/dist/src/utils/plugin-scripts.js.map +1 -1
  802. package/dist/src/utils/process-lock.d.ts +1 -0
  803. package/dist/src/utils/process-lock.js +22 -5
  804. package/dist/src/utils/process-lock.js.map +1 -1
  805. package/dist/src/utils/process-tree.d.ts +2 -2
  806. package/dist/src/utils/process-tree.js +1 -1
  807. package/dist/src/utils/process-tree.js.map +1 -1
  808. package/dist/src/utils/project-boundary.d.ts +11 -1
  809. package/dist/src/utils/project-boundary.js +33 -11
  810. package/dist/src/utils/project-boundary.js.map +1 -1
  811. package/dist/src/utils/rendered-contract.js +24 -1
  812. package/dist/src/utils/rendered-contract.js.map +1 -1
  813. package/dist/src/utils/runtime-config.d.ts +18 -0
  814. package/dist/src/utils/runtime-config.js +64 -0
  815. package/dist/src/utils/runtime-config.js.map +1 -0
  816. package/dist/src/utils/runtime-skill-closure.d.ts +2 -2
  817. package/dist/src/utils/runtime-skill-closure.js +50 -7
  818. package/dist/src/utils/runtime-skill-closure.js.map +1 -1
  819. package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
  820. package/dist/src/utils/safe-operation-diagnostic.js +33 -0
  821. package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
  822. package/dist/src/utils/sensitive-content.d.ts +4 -0
  823. package/dist/src/utils/sensitive-content.js +36 -0
  824. package/dist/src/utils/sensitive-content.js.map +1 -0
  825. package/dist/src/utils/skill-invocation-warning.d.ts +19 -0
  826. package/dist/src/utils/skill-invocation-warning.js +43 -0
  827. package/dist/src/utils/skill-invocation-warning.js.map +1 -0
  828. package/dist/src/utils/skill-validation.js +0 -5
  829. package/dist/src/utils/skill-validation.js.map +1 -1
  830. package/dist/src/utils/state-paths.d.ts +8 -3
  831. package/dist/src/utils/state-paths.js +53 -16
  832. package/dist/src/utils/state-paths.js.map +1 -1
  833. package/dist/src/utils/target-eligibility.d.ts +2 -2
  834. package/dist/src/utils/target-eligibility.js.map +1 -1
  835. package/dist/src/utils/windows-claude-shim.d.ts +7 -0
  836. package/dist/src/utils/windows-claude-shim.js +10 -0
  837. package/dist/src/utils/windows-claude-shim.js.map +1 -0
  838. package/dist/src/utils/windows-npm-shim.d.ts +16 -0
  839. package/dist/src/utils/windows-npm-shim.js +155 -0
  840. package/dist/src/utils/windows-npm-shim.js.map +1 -0
  841. package/dist/vitest.config.js +109 -9
  842. package/dist/vitest.config.js.map +1 -1
  843. package/package.json +20 -12
  844. package/dist/authoring/templates/aw-config-runtime.d.mts +0 -2
  845. package/dist/authoring/templates/aw-config-runtime.mjs +0 -407
  846. package/dist/authoring/templates/aw-config-runtime.mjs.map +0 -1
  847. package/dist/src/commands/review-publication.d.ts +0 -99
  848. package/dist/src/commands/review-publication.js +0 -904
  849. package/dist/src/commands/review-publication.js.map +0 -1
  850. package/dist/src/commands/sync-command.d.ts +0 -23
  851. package/dist/src/commands/sync-command.js +0 -242
  852. package/dist/src/commands/sync-command.js.map +0 -1
  853. package/dist/src/portable/skills-cli.d.ts +0 -43
  854. package/dist/src/portable/skills-cli.js +0 -148
  855. package/dist/src/portable/skills-cli.js.map +0 -1
  856. package/dist/src/utils/codex-native-render-receipt.d.ts +0 -40
  857. package/dist/src/utils/codex-native-render-receipt.js +0 -205
  858. package/dist/src/utils/codex-native-render-receipt.js.map +0 -1
  859. package/dist/src/utils/plugin-intent-state.d.ts +0 -34
  860. package/dist/src/utils/plugin-intent-state.js +0 -289
  861. package/dist/src/utils/plugin-intent-state.js.map +0 -1
  862. package/dist/src/utils/slash-commands.d.ts +0 -1
  863. package/dist/src/utils/slash-commands.js +0 -2
  864. package/dist/src/utils/slash-commands.js.map +0 -1
@@ -1,21 +1,143 @@
1
+ import crypto from 'node:crypto';
2
+ import { isCanonicalCodexMarketplaceRegistration } from './codex-shared-native.js';
3
+ import { readIntentReferences } from '../recovery/demand.js';
4
+ import { resolveIntentPath } from '../intent/intent-store.js';
1
5
  import path from 'node:path';
2
6
  import fs from 'fs-extra';
7
+ import { computeCanonicalDirectoryDigest } from '@lesliechan721/agent-skill-eval';
8
+ import { NATIVE_PLATFORM_TARGETS, isPlatformTarget, resolveBundlePlatformRoot } from '@lesliechan721/aw-plugin-core/manifest';
3
9
  import { readClaudeSettings } from '../adapters/helpers.js';
4
10
  import { readCodexConfigFile } from './codex-config.js';
5
11
  import { readJsonFileIfExists } from './json.js';
6
12
  import { getClaudeHome, getCodexHome, canonicalizePathThroughExistingAncestorSync, resolveAwHome, resolveAwHomeCanonical, resolveRepoRootSync, } from './state-paths.js';
7
- import { OWNED_TEXT_HEADER_PREFIX, SHARED_OWNER_TOKEN_PREFIX, parseSharedOwnerToken, parseOwnedTextHeader, readSkillOwnerMarker, SKILL_OWNER_MARKER, } from './ownership.js';
13
+ import { OWNED_TEXT_HEADER_PREFIX, SHARED_OWNER_TOKEN_PREFIX, inspectOwnedComponents, parseSharedOwnerToken, parseOwnedTextHeader, readSkillOwnerMarker, SKILL_OWNER_MARKER, } from './ownership.js';
8
14
  import { sanitizeCatalogSourceErrorMessage } from './catalog-public-error.js';
9
- import { readStrictNamespacedMarketplaceRoot } from './local-marketplace.js';
10
- import { readPluginIntentState, resolvePluginIntentStatePath, } from './plugin-intent-state.js';
11
- export function canonicalMarketplaceRegistrationNames(references, sourceId) {
15
+ import { canonicalMarketplaceRegistrationPath, readStrictNamespacedMarketplaceRoot } from './local-marketplace.js';
16
+ import { getDeploymentLayout, getManagedPlatformRoot, getInvocationPolicyPhysicalKey, isAntigravityProjectDirectory } from '../platforms/layout.js';
17
+ import { deploymentPackageComponent } from '../platforms/inspection.js';
18
+ import { canonicalNamespaceRoot, getPhysicalKey, identityDigest } from '../platforms/identity.js';
19
+ import { offlinePermissionComponents } from '../platforms/permission-ownership.js';
20
+ import { resolvePlatformConfigRoot } from '../platforms/discovery.js';
21
+ import { readPlatformPackageContentDigest } from './platform-empty-state.js';
22
+ export function legacyCanonicalMarketplaceRegistrationNames(references, sourceId) {
12
23
  return [...new Set(references.flatMap((reference) => reference.kind === 'namespacedMarketplace'
13
24
  && reference.sourceId === sourceId
14
25
  && reference.pluginName === undefined
26
+ && reference.platform === undefined
27
+ && reference.marketplaceRoot
15
28
  && reference.marketplaceName
16
29
  ? [reference.marketplaceName]
17
30
  : []))];
18
31
  }
32
+ function isNativeMarketplaceConsumer(reference) {
33
+ return !reference.disabledNativeActivation && !reference.marketplaceManifestEntry;
34
+ }
35
+ /** Raw host consumers and their canonical inventory copies can describe the
36
+ * same registration. Ignore that duplicate only when its binding is resolved. */
37
+ export function scopedCleanupMarketplaceEvidence(options) {
38
+ const { references, pluginName, platform, scope } = options;
39
+ const registrations = references.filter((reference) => reference.kind === 'namespacedMarketplace'
40
+ && reference.platform === platform && reference.pluginName === undefined
41
+ && reference.marketplaceRegistrationPath !== undefined
42
+ && (reference.scope === undefined || reference.scope === 'user' || reference.scope === scope));
43
+ const consumers = references.filter((reference) => reference.kind === 'namespacedMarketplace'
44
+ && reference.pluginName === pluginName && reference.platform === platform
45
+ && reference.scope === scope && reference.marketplaceName);
46
+ const nativeConsumers = consumers.filter(isNativeMarketplaceConsumer);
47
+ const unboundConsumers = nativeConsumers.filter((consumer) => {
48
+ if (consumer.sourceId !== undefined)
49
+ return false;
50
+ const boundRoots = new Set(nativeConsumers.flatMap((bound) => bound.sourceId && bound.sourceIdentity && bound.marketplaceRoot
51
+ && bound.marketplaceName === consumer.marketplaceName && bound.projectKey === consumer.projectKey
52
+ ? [bound.marketplaceRoot] : []));
53
+ const observedPaths = new Set(registrations.filter((entry) => entry.marketplaceName === consumer.marketplaceName)
54
+ .map((entry) => entry.marketplaceRegistrationPath));
55
+ return observedPaths.size === 0 ? boundRoots.size !== 1
56
+ : observedPaths.size !== 1 || [...observedPaths].some((location) => !location || !boundRoots.has(location));
57
+ });
58
+ return { registrations, consumers, unboundConsumers };
59
+ }
60
+ /** Resolve the same scope-local identity for offline preview and execution. A root
61
+ * identifies a marketplace, not a package or permission to remove that package. */
62
+ export function resolveCleanupMarketplaceIdentity(options) {
63
+ const { references, sourceId, sourceIdentity, pluginName, platform, scope } = options;
64
+ if (platform !== 'codex' && platform !== 'claude' && platform !== 'copilot')
65
+ return {};
66
+ const { registrations, consumers, unboundConsumers } = scopedCleanupMarketplaceEvidence(options);
67
+ const roots = references.filter((reference) => reference.kind === 'namespacedMarketplace'
68
+ && reference.pluginName === undefined && reference.marketplaceRoot && reference.marketplaceName
69
+ && (reference.platform === platform || platform !== 'copilot' && reference.platform === undefined));
70
+ const matchedConsumers = consumers.filter((reference) => reference.sourceId === sourceId);
71
+ const candidates = references.filter((reference) => reference.sourceId === sourceId
72
+ && reference.sourceIdentity === sourceIdentity && reference.pluginName === pluginName
73
+ && reference.platform === platform && reference.scope === scope
74
+ && reference.recoveryCandidate?.evidence === 'verified' && reference.marketplaceRoot);
75
+ const liveNames = new Set(matchedConsumers.map((reference) => reference.marketplaceName));
76
+ const provenNames = new Map();
77
+ const addName = (name, root) => {
78
+ const paths = provenNames.get(name) ?? new Set();
79
+ paths.add(root);
80
+ provenNames.set(name, paths);
81
+ };
82
+ for (const reference of candidates) {
83
+ const candidate = reference.recoveryCandidate;
84
+ const id = candidate.nativeIdentity?.registrationId;
85
+ const separator = id?.lastIndexOf('@') ?? -1;
86
+ if (id && separator > 0 && candidate.binding.platform === platform && candidate.binding.scope.kind === scope
87
+ && candidate.binding.plugin.sourceId === sourceId && candidate.binding.plugin.sourceIdentity === sourceIdentity
88
+ && id.slice(0, separator) === pluginName && id.slice(separator + 1)
89
+ && candidate.nativeIdentity?.sourceLocation === path.join(reference.marketplaceRoot, 'plugins', pluginName)) {
90
+ const name = id.slice(separator + 1);
91
+ liveNames.add(name);
92
+ addName(name, reference.marketplaceRoot);
93
+ }
94
+ }
95
+ const hasVerifiedCandidate = provenNames.size > 0;
96
+ for (const root of roots) {
97
+ if (root.sourceId !== sourceId || root.sourceIdentity !== sourceIdentity)
98
+ continue;
99
+ if (liveNames.size === 0 || liveNames.has(root.marketplaceName))
100
+ addName(root.marketplaceName, root.marketplaceRoot);
101
+ }
102
+ const unresolved = () => ({ marketplaceIdentityUnresolved: true });
103
+ if (liveNames.size > 1 || provenNames.size > 1)
104
+ return unresolved();
105
+ if (provenNames.size === 0)
106
+ return unboundConsumers.length > 0 || matchedConsumers.some(isNativeMarketplaceConsumer)
107
+ || references.some((reference) => reference.sourceId === sourceId
108
+ && reference.sourceIdentity === sourceIdentity && reference.pluginName === pluginName
109
+ && reference.platform === platform && reference.scope === scope && reference.recoveryCandidate?.evidence === 'verified')
110
+ ? unresolved() : {};
111
+ const [marketplaceName, paths] = [...provenNames][0];
112
+ if (liveNames.size === 1 && !liveNames.has(marketplaceName))
113
+ return unresolved();
114
+ const observed = registrations.filter((registration) => registration.marketplaceName === marketplaceName);
115
+ // An empty canonical root alone does not resolve some other, unbound
116
+ // marketplace's same-name activation. Preserve it and report the ambiguity.
117
+ if (!observed.length && !hasVerifiedCandidate && unboundConsumers.some((consumer) => consumer.marketplaceName !== marketplaceName))
118
+ return unresolved();
119
+ // Multiple physical markets sharing a name cannot be disambiguated by the name alone.
120
+ // An actual host registration can conclusively select one of those roots.
121
+ if (observed.some((registration) => !registration.marketplaceRegistrationPath
122
+ || !paths.has(registration.marketplaceRegistrationPath)))
123
+ return unresolved();
124
+ const selectedPaths = observed.length ? new Set(observed.map((registration) => registration.marketplaceRegistrationPath)) : paths;
125
+ if (selectedPaths.size !== 1)
126
+ return unresolved();
127
+ const selectedRoot = [...selectedPaths][0];
128
+ if (candidates.some((candidate) => candidate.marketplaceRoot !== selectedRoot))
129
+ return unresolved();
130
+ if (!observed.length && roots.some((root) => root.marketplaceName === marketplaceName
131
+ && root.marketplaceRoot !== selectedRoot))
132
+ return unresolved();
133
+ if (roots.some((root) => root.marketplaceRoot === selectedRoot
134
+ && (root.sourceId !== sourceId || root.sourceIdentity !== sourceIdentity || root.marketplaceName !== marketplaceName)))
135
+ return unresolved();
136
+ const matchingActivation = consumers.some((consumer) => isNativeMarketplaceConsumer(consumer) && !consumer.managedNativeRegistration
137
+ && consumer.marketplaceName === marketplaceName
138
+ && (consumer.sourceId === undefined || consumer.sourceId === sourceId && consumer.sourceIdentity === sourceIdentity));
139
+ return { marketplaceName, ...(matchingActivation ? { nativeRegistration: true } : {}) };
140
+ }
19
141
  function pluginNameFromMarketplaceId(pluginId, marketplaceName) {
20
142
  const suffix = `@${marketplaceName}`;
21
143
  return pluginId.endsWith(suffix) && pluginId.length > suffix.length
@@ -26,10 +148,11 @@ function claudeConsumersFromSettings(value, marketplaceName, scope) {
26
148
  if (!value)
27
149
  return [];
28
150
  const output = [];
29
- for (const pluginId of Object.keys(isRecord(value.enabledPlugins) ? value.enabledPlugins : {})) {
151
+ for (const [pluginId, enabled] of Object.entries(isRecord(value.enabledPlugins) ? value.enabledPlugins : {})) {
30
152
  const pluginName = pluginNameFromMarketplaceId(pluginId, marketplaceName);
31
153
  if (pluginName)
32
- output.push({ pluginName, platform: 'claude', scope });
154
+ output.push({ pluginName, platform: 'claude', scope,
155
+ ...(enabled === false ? { disabledNativeActivation: true } : {}) });
33
156
  }
34
157
  const plugins = isRecord(value.plugins) && isRecord(value.plugins.installed)
35
158
  ? value.plugins.installed
@@ -44,7 +167,7 @@ function claudeConsumersFromSettings(value, marketplaceName, scope) {
44
167
  }
45
168
  return output;
46
169
  }
47
- function claudeConsumersFromInstalled(value, marketplaceName, currentProject, includeHistoricalProjects = false) {
170
+ function claudeConsumersFromInstalled(value, marketplaceName, currentProject, includeHistoricalProjects = false, includeManaged = false) {
48
171
  const output = [];
49
172
  if (value !== null && !isRecord(value)) {
50
173
  throw new Error('Claude installed_plugins must be a JSON object.');
@@ -68,12 +191,17 @@ function claudeConsumersFromInstalled(value, marketplaceName, currentProject, in
68
191
  if (item.scope !== undefined
69
192
  && item.scope !== 'user'
70
193
  && item.scope !== 'project'
71
- && item.scope !== 'local') {
194
+ && item.scope !== 'local'
195
+ && item.scope !== 'managed') {
72
196
  throw new Error(`Claude installed_plugins record ${key} has an invalid scope.`);
73
197
  }
74
198
  if (item.projectPath !== undefined && typeof item.projectPath !== 'string') {
75
199
  throw new Error(`Claude installed_plugins record ${key} has an invalid projectPath.`);
76
200
  }
201
+ // Managed policy is a host-global residual clue, but is never an AW
202
+ // user registration or an independent project reference.
203
+ if (item.scope === 'managed' && !includeManaged)
204
+ continue;
77
205
  const itemMarketplace = typeof item.marketplace === 'string'
78
206
  ? item.marketplace
79
207
  : pluginNameFromMarketplaceId(key, marketplaceName) ? marketplaceName : undefined;
@@ -92,7 +220,8 @@ function claudeConsumersFromInstalled(value, marketplaceName, currentProject, in
92
220
  const pluginName = typeof item.name === 'string'
93
221
  ? item.name
94
222
  : pluginNameFromMarketplaceId(key, marketplaceName) ?? key;
95
- output.push({ pluginName, platform: 'claude', scope, ...(scope === 'project' ? { projectKey } : {}) });
223
+ output.push({ pluginName, platform: 'claude', scope, ...(scope === 'project' ? { projectKey } : {}),
224
+ ...(item.scope === 'managed' ? { managedNativeRegistration: true } : {}) });
96
225
  }
97
226
  }
98
227
  return output;
@@ -127,6 +256,7 @@ function inventoryErrorRelevance(location, env, cwd) {
127
256
  [path.join(repoRoot, '.codex'), 'codex'],
128
257
  [path.join(repoRoot, '.agents'), 'codex'],
129
258
  [path.join(repoRoot, '.claude'), 'claude'],
259
+ [path.join(repoRoot, '.github', 'copilot'), 'copilot'],
130
260
  ];
131
261
  for (const [root, platform] of projectRoots) {
132
262
  if (pathSegmentsWithin(root, location) !== null) {
@@ -144,7 +274,16 @@ function inventoryErrorRelevance(location, env, cwd) {
144
274
  if (pathSegmentsWithin(getClaudeHome(env), location) !== null) {
145
275
  return { global: false, platform: 'claude', scope: 'user' };
146
276
  }
277
+ const copilotRoot = resolvePlatformConfigRoot('copilot', { env, cwd });
278
+ if (pathSegmentsWithin(copilotRoot, location) !== null) {
279
+ return { global: false, platform: 'copilot', scope: 'user' };
280
+ }
147
281
  for (const root of new Set([awHome, canonicalAwHome])) {
282
+ const platformPath = pathSegmentsWithin(path.join(root, 'platforms'), location);
283
+ if (platformPath && (platformPath.length <= 2 || platformPath[2] === 'marketplaces')
284
+ && (platformPath[0] === 'codex' || platformPath[0] === 'claude' || platformPath[0] === 'copilot')) {
285
+ return { global: false, platform: platformPath[0], ...(platformPath[3] ? { sourceId: platformPath[3] } : {}) };
286
+ }
148
287
  const marketplace = pathSegmentsWithin(path.join(root, 'marketplaces'), location);
149
288
  if (marketplace?.[0])
150
289
  return { global: false, sourceId: marketplace[0] };
@@ -178,11 +317,12 @@ function isAbsentState(error) {
178
317
  }
179
318
  function inventoryError(error, location, kind, env, cwd, relevance) {
180
319
  const message = error instanceof Error ? error.message : String(error);
181
- const sensitiveRoots = [getCodexHome(env), getClaudeHome(env), resolveRepoRootSync(cwd)];
320
+ const sensitiveRoots = [getCodexHome(env), getClaudeHome(env), resolvePlatformConfigRoot('copilot', { env, cwd }), resolveRepoRootSync(cwd)];
182
321
  return {
183
322
  code: 'stateInventoryFailed',
184
323
  kind,
185
324
  location: sanitizeCatalogSourceErrorMessage(location, env, sensitiveRoots),
325
+ recoveryPath: path.resolve(location),
186
326
  message: sanitizeCatalogSourceErrorMessage(message, env, sensitiveRoots),
187
327
  relevance: relevance ?? inventoryErrorRelevance(location, env, cwd),
188
328
  };
@@ -274,35 +414,6 @@ async function inventoryPluginConfigRoots(options) {
274
414
  if (userRoot)
275
415
  roots.push({ root: userRoot, scope: 'user' });
276
416
  }
277
- const rawRepoRoot = resolveRepoRootSync(options.cwd);
278
- const repoRoot = await inventoryRead({
279
- operation: () => fs.realpath(rawRepoRoot),
280
- absent: null,
281
- reportAbsent: true,
282
- errors: options.errors,
283
- location: rawRepoRoot,
284
- kind: 'projectRootRead',
285
- env: options.env,
286
- cwd: options.cwd,
287
- });
288
- if (repoRoot && await inventoryCanonicalDirectory({
289
- errors: options.errors,
290
- location: repoRoot,
291
- kind: 'projectRootRead',
292
- env: options.env,
293
- cwd: options.cwd,
294
- })) {
295
- const projectRoot = await inventoryCanonicalDescendantDirectory({
296
- root: rawRepoRoot,
297
- segments: ['.agent-workflows', 'plugin-config'],
298
- errors: options.errors,
299
- kind: 'configDirectoryRead',
300
- env: options.env,
301
- cwd: options.cwd,
302
- });
303
- if (projectRoot)
304
- roots.push({ root: projectRoot, scope: 'project', projectKey: repoRoot });
305
- }
306
417
  return roots;
307
418
  }
308
419
  export async function inventoryLegacyOwnerReferences(options) {
@@ -314,7 +425,11 @@ export async function inventoryLegacyOwnerReferences(options) {
314
425
  const skillRoots = new Set([
315
426
  path.join(getCodexHome(env), 'skills'),
316
427
  path.join(getClaudeHome(env), 'skills'),
317
- path.join(repoRoot, '.claude', 'skills'),
428
+ ...(options.scope !== 'user' && (options.includeProjectAgentSkills ?? options.scope === undefined)
429
+ ? [path.join(repoRoot, '.agents', 'skills')] : []),
430
+ ...(options.scope === 'user' ? [] : [
431
+ path.join(repoRoot, '.claude', 'skills'),
432
+ ]),
318
433
  ]);
319
434
  const legacyPluginsRoot = path.join(awHome, 'plugins');
320
435
  const legacyPlugins = await inventoryRead({
@@ -365,7 +480,8 @@ export async function inventoryLegacyConfigReferences(options) {
365
480
  const env = options.env ?? process.env;
366
481
  const references = [];
367
482
  const errors = [];
368
- for (const configRoot of await inventoryPluginConfigRoots({ errors, env, cwd: options.cwd })) {
483
+ for (const configRoot of await inventoryPluginConfigRoots({ errors, env, cwd: options.cwd,
484
+ scope: options.scope })) {
369
485
  const directory = configRoot.root;
370
486
  const entries = await inventoryRead({
371
487
  operation: () => fs.readdir(directory, { withFileTypes: true }),
@@ -397,6 +513,15 @@ export async function inventoryLegacyConfigReferences(options) {
397
513
  return { inventorySchemaVersion: 1, references, errors };
398
514
  }
399
515
  function ownerReferenceFromRaw(entryPath, raw) {
516
+ if (raw?.schemaVersion === 1 && raw.owner === 'agent-workflows') {
517
+ return {
518
+ kind: 'legacyOwner',
519
+ location: entryPath,
520
+ ...(typeof raw.plugin === 'string' ? { pluginName: raw.plugin } : {}),
521
+ ...(typeof raw.platform === 'string' ? { platform: raw.platform } : {}),
522
+ ...(typeof raw.scope === 'string' ? { scope: raw.scope } : {}),
523
+ };
524
+ }
400
525
  if (raw?.schemaVersion === 3 && raw.owner === 'agent-workflows'
401
526
  && typeof raw.sourceId === 'string'
402
527
  && raw.pluginId === `${raw.sourceId}/${raw.plugin}`) {
@@ -404,6 +529,7 @@ function ownerReferenceFromRaw(entryPath, raw) {
404
529
  kind: 'namespacedOwner',
405
530
  location: entryPath,
406
531
  sourceId: raw.sourceId,
532
+ ...(typeof raw.sourceIdentity === 'string' ? { sourceIdentity: raw.sourceIdentity } : {}),
407
533
  ...(typeof raw.plugin === 'string' ? { pluginName: raw.plugin } : {}),
408
534
  ...(typeof raw.platform === 'string' ? { platform: raw.platform } : {}),
409
535
  ...(typeof raw.scope === 'string' ? { scope: raw.scope } : {}),
@@ -411,6 +537,27 @@ function ownerReferenceFromRaw(entryPath, raw) {
411
537
  }
412
538
  return null;
413
539
  }
540
+ function legacyOwnedHeaderReference(filePath, content) {
541
+ const normalized = content.replace(/\r\n/gu, '\n');
542
+ const frontmatterEnd = normalized.startsWith('---\n')
543
+ ? normalized.indexOf('\n---\n', 4)
544
+ : -1;
545
+ const headerIndex = frontmatterEnd === -1 ? 0 : frontmatterEnd + '\n---\n'.length;
546
+ const lineEnd = normalized.indexOf('\n', headerIndex);
547
+ const line = normalized.slice(headerIndex, lineEnd === -1 ? normalized.length : lineEnd);
548
+ if (!line.startsWith(OWNED_TEXT_HEADER_PREFIX))
549
+ return null;
550
+ const raw = (() => {
551
+ try {
552
+ return JSON.parse(line.slice(OWNED_TEXT_HEADER_PREFIX.length));
553
+ }
554
+ catch {
555
+ return null;
556
+ }
557
+ })();
558
+ const reference = ownerReferenceFromRaw(filePath, raw);
559
+ return reference?.kind === 'legacyOwner' ? reference : null;
560
+ }
414
561
  async function readOwnedHeaderReference(filePath, requireGeneratedName, errors, env, cwd) {
415
562
  const stats = await inventoryRead({
416
563
  operation: () => fs.stat(filePath),
@@ -436,6 +583,16 @@ async function readOwnedHeaderReference(filePath, requireGeneratedName, errors,
436
583
  return null;
437
584
  if (!content.includes(OWNED_TEXT_HEADER_PREFIX))
438
585
  return null;
586
+ const legacyReference = legacyOwnedHeaderReference(filePath, content);
587
+ if (legacyReference) {
588
+ if (requireGeneratedName
589
+ && legacyReference.pluginName
590
+ && !path.basename(filePath).startsWith(`aw-${legacyReference.pluginName}-`)) {
591
+ errors.push(inventoryError(new Error('Owned text header path does not match its plugin identity.'), filePath, 'ownerHeaderPathValidation', env, cwd));
592
+ return null;
593
+ }
594
+ return legacyReference;
595
+ }
439
596
  let parsed;
440
597
  try {
441
598
  parsed = parseOwnedTextHeader(content);
@@ -447,20 +604,35 @@ async function readOwnedHeaderReference(filePath, requireGeneratedName, errors,
447
604
  if (!parsed)
448
605
  return null;
449
606
  if (requireGeneratedName
450
- && !path.basename(filePath).startsWith(`aw-${parsed.identity.plugin}-`)) {
451
- errors.push(inventoryError(new Error('Owned text header path does not match its plugin identity.'), filePath, 'ownerHeaderPathValidation', env, cwd, {
452
- global: false,
453
- ...(parsed.identity.sourceId ? { sourceId: parsed.identity.sourceId } : {}),
454
- pluginName: parsed.identity.plugin,
455
- platform: parsed.identity.platform,
456
- scope: parsed.identity.scope,
457
- }));
607
+ && !path.basename(filePath).startsWith(parsed.identity.sourceId
608
+ ? `aw-${parsed.identity.sourceId}-${parsed.identity.plugin}-` : `aw-${parsed.identity.plugin}-`)) {
609
+ const physical = inventoryErrorRelevance(filePath, env, cwd);
610
+ let configKey;
611
+ if (!physical.global && physical.platform === 'codex' && path.extname(filePath) === '.toml') {
612
+ try {
613
+ const configPath = physical.scope === 'project' ? path.join(resolveRepoRootSync(cwd), '.codex/config.toml') : path.join(getCodexHome(env), 'config.toml');
614
+ const config = await readCodexConfigFile(configPath);
615
+ const keys = [];
616
+ for (const [name, value] of Object.entries(config.snapshot.agents)) {
617
+ if (typeof value.configFile === 'string'
618
+ && path.resolve(path.dirname(configPath), value.configFile) === path.resolve(filePath))
619
+ keys.push(`agents.${name}.config_file`);
620
+ }
621
+ configKey = keys.length === 1 ? keys[0] : keys.length > 1 ? 'agents' : undefined;
622
+ }
623
+ catch { /* Unknown references require manual inspection. */ }
624
+ }
625
+ const issue = inventoryError(new Error('Owned text header path does not match its plugin identity.'), filePath, 'ownerHeaderPathValidation', env, cwd, !physical.global && configKey && configKey !== 'agents' ? { ...physical,
626
+ componentName: configKey.slice('agents.'.length, -'.config_file'.length) } : physical);
627
+ if (configKey)
628
+ issue.configKey = configKey;
629
+ errors.push(issue);
458
630
  return null;
459
631
  }
460
- return ownerReferenceFromRaw(filePath, {
461
- schemaVersion: 3,
462
- ...parsed.identity,
463
- });
632
+ const reference = ownerReferenceFromRaw(filePath, { schemaVersion: 3, ...parsed.identity });
633
+ return reference ? { ...reference, ownedComponent: { kind: 'owned-text-file', path: filePath,
634
+ allowedRoot: path.dirname(filePath), identity: parsed.identity },
635
+ pathEvidence: await offlineOwnedPathEvidence(filePath) } : null;
464
636
  }
465
637
  async function findOwnedHeadersInDirectory(directory, extensions, requireGeneratedName, errors, env, cwd) {
466
638
  const output = [];
@@ -511,10 +683,17 @@ async function resolveCanonicalPluginSkillRoots(pluginRoot, includeLegacyFallbac
511
683
  cwd,
512
684
  }),
513
685
  ]);
514
- const declared = safeRelativeSkillRoot(platformManifest?.skills ?? sourceManifest?.skills)
515
- ?? 'codex/skills';
686
+ const safePlatformSkills = safeRelativeSkillRoot(platformManifest?.skills);
687
+ const safeSourceSkills = safeRelativeSkillRoot(sourceManifest?.skills);
688
+ const declaredPath = safePlatformSkills
689
+ ? path.join(pluginRoot, ...safePlatformSkills.split('/'))
690
+ : await resolveBundlePlatformRoot(pluginRoot, 'codex', {
691
+ skills: './skills',
692
+ }).then((resolved) => (safeSourceSkills
693
+ ? path.join(resolved.resourceRoot, ...safeSourceSkills.split('/'))
694
+ : resolved.skillsRoot)).catch(() => path.join(pluginRoot, ...(safeSourceSkills ?? 'skills').split('/')));
516
695
  return [...new Set([
517
- path.join(pluginRoot, ...declared.split('/')),
696
+ declaredPath,
518
697
  ...(includeLegacyFallbacks ? [
519
698
  path.join(pluginRoot, 'skills'),
520
699
  path.join(pluginRoot, 'codex', 'skills'),
@@ -553,6 +732,12 @@ async function findDirectSkillOwnerMarkers(root, errors, env, cwd) {
553
732
  marker = await readSkillOwnerMarker({ skillRoot, allowedRoot: root });
554
733
  }
555
734
  catch (error) {
735
+ const legacy = await fs.readJson(markerPath).catch(() => null);
736
+ const legacyReference = ownerReferenceFromRaw(markerPath, legacy);
737
+ if (legacyReference?.kind === 'legacyOwner') {
738
+ output.push(legacyReference);
739
+ continue;
740
+ }
556
741
  if (!isAbsentState(error)) {
557
742
  const code = error.code;
558
743
  const message = error instanceof Error ? error.message : String(error);
@@ -585,14 +770,17 @@ function sharedOwnerTokenReferences(filePath, tokens, errors, env, cwd) {
585
770
  kind: 'namespacedOwner',
586
771
  location: filePath,
587
772
  sourceId: identity.sourceId,
773
+ ...(identity.sourceIdentity ? { sourceIdentity: identity.sourceIdentity } : {}),
588
774
  pluginName: identity.plugin,
589
775
  platform: identity.platform,
590
776
  scope: identity.scope,
777
+ ...(identity.platform === 'claude' ? { ownedComponent: { kind: 'shared-config', identity, label: filePath,
778
+ locator: { kind: 'claude-permissions', settingsPath: filePath, ownerKey: token } } } : {}),
591
779
  });
592
780
  }
593
781
  return output;
594
782
  }
595
- async function codexSharedOwnerReferences(filePath, _scope, errors, env, cwd) {
783
+ async function codexSharedOwnerReferences(filePath, scope, errors, env, cwd) {
596
784
  const config = await readCodexConfigFile(filePath);
597
785
  const ownerValues = [
598
786
  ...Object.keys(config.snapshot.developerInstructions.managedBlocks).map((value) => ({
@@ -601,14 +789,42 @@ async function codexSharedOwnerReferences(filePath, _scope, errors, env, cwd) {
601
789
  })),
602
790
  ];
603
791
  const references = sharedOwnerTokenReferences(filePath, ownerValues.map((entry) => entry.value).filter((value) => value.startsWith(SHARED_OWNER_TOKEN_PREFIX)), errors, env, cwd);
792
+ if (scope === 'user') {
793
+ for (const { value, location } of ownerValues) {
794
+ if (value.startsWith(SHARED_OWNER_TOKEN_PREFIX)
795
+ || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(value))
796
+ continue;
797
+ references.push({
798
+ kind: 'legacyOwner',
799
+ location,
800
+ pluginName: value,
801
+ platform: 'codex',
802
+ scope,
803
+ });
804
+ }
805
+ }
604
806
  return references;
605
807
  }
606
- async function claudeSharedOwnerReferences(filePath, _scope, errors, env, cwd) {
808
+ async function claudeSharedOwnerReferences(filePath, scope, errors, env, cwd) {
607
809
  const settings = await readJsonFileIfExists(filePath);
608
810
  const generated = settings && isRecord(settings.awGenerated) ? settings.awGenerated : null;
609
811
  const permissions = generated && isRecord(generated.permissions) ? generated.permissions : {};
610
812
  const keys = Object.keys(permissions);
611
813
  const references = sharedOwnerTokenReferences(filePath, keys.filter((token) => token.startsWith(SHARED_OWNER_TOKEN_PREFIX)), errors, env, cwd);
814
+ if (scope === 'user') {
815
+ for (const key of keys) {
816
+ if (key.startsWith(SHARED_OWNER_TOKEN_PREFIX)
817
+ || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(key))
818
+ continue;
819
+ references.push({
820
+ kind: 'legacyOwner',
821
+ location: filePath,
822
+ pluginName: key,
823
+ platform: 'claude',
824
+ scope,
825
+ });
826
+ }
827
+ }
612
828
  return references;
613
829
  }
614
830
  function isRecord(value) {
@@ -616,16 +832,25 @@ function isRecord(value) {
616
832
  }
617
833
  function assertNamespacedConfigEnvelope(value, sourceId, pluginName) {
618
834
  if (!isRecord(value)
619
- || value.schemaVersion !== 3
835
+ || value.schemaVersion !== 6
620
836
  || typeof value.sourceId !== 'string'
621
- || typeof value.sourceIdentity !== 'string'
622
- || !/^sha256:[0-9a-f]{64}$/u.test(value.sourceIdentity)
623
837
  || typeof value.pluginName !== 'string'
624
- || !isRecord(value.values)
838
+ || !isRecord(value.binding)
839
+ || !isRecord(value.common)
840
+ || !isRecord(value.platforms)
841
+ || Object.entries(value.platforms).some(([platform, values]) => !isPlatformTarget(platform) || !isRecord(values))
625
842
  || Object.keys(value).some((key) => ![
626
- 'schemaVersion', 'sourceId', 'sourceIdentity', 'pluginName', 'values',
843
+ 'schemaVersion', 'sourceId', 'pluginName', 'binding', 'common', 'platforms',
627
844
  ].includes(key))) {
628
- throw new Error('Namespaced plugin config is not a valid schema 3 envelope.');
845
+ throw new Error('Namespaced plugin config is not a valid schema 6 envelope.');
846
+ }
847
+ const binding = value.binding;
848
+ const validBinding = binding.kind === 'source'
849
+ && typeof binding.sourceIdentity === 'string'
850
+ && /^sha256:[0-9a-f]{64}$/u.test(binding.sourceIdentity)
851
+ && Object.keys(binding).every((key) => ['kind', 'sourceIdentity'].includes(key));
852
+ if (!validBinding) {
853
+ throw new Error('Namespaced user plugin config has an invalid binding.');
629
854
  }
630
855
  if (value.sourceId !== sourceId || value.pluginName !== pluginName) {
631
856
  throw new Error('Namespaced plugin config identity does not match its directory path.');
@@ -653,6 +878,7 @@ async function oldMarketplaceReferences(env, cwd, errors, includePlatformHistori
653
878
  const claudeInstalledPath = path.join(getClaudeHome(env), 'plugins', 'installed_plugins.json');
654
879
  const output = [];
655
880
  const marketplacesRoot = path.join(resolveAwHome(env), 'marketplaces');
881
+ const canonicalLegacyRoot = path.join(await canonicalNamespaceRoot(resolveAwHome(env)), 'marketplaces');
656
882
  const namespacedPrimaryRoots = new Set();
657
883
  const marketplaceEntries = await inventoryCanonicalDirectoryEntries({
658
884
  errors, location: marketplacesRoot, kind: 'marketplaceDirectoryRead', env, cwd,
@@ -675,6 +901,7 @@ async function oldMarketplaceReferences(env, cwd, errors, includePlatformHistori
675
901
  });
676
902
  if (manifest?.name === 'aw' && config?.schemaVersion === 2 && config.sourceId === entry.name) {
677
903
  namespacedPrimaryRoots.add(path.normalize(path.join(marketplacesRoot, entry.name)));
904
+ namespacedPrimaryRoots.add(path.join(canonicalLegacyRoot, entry.name));
678
905
  }
679
906
  }
680
907
  const codex = await inventoryRead({
@@ -682,9 +909,7 @@ async function oldMarketplaceReferences(env, cwd, errors, includePlatformHistori
682
909
  location: codexPath, kind: 'nativeStateRead', env, cwd,
683
910
  });
684
911
  const codexAw = codex?.snapshot.marketplaces.aw;
685
- const codexAwIsNamespaced = codexAw?.sourceType === 'local'
686
- && !codexAw.sourcePointsToManifest
687
- && namespacedPrimaryRoots.has(path.normalize(codexAw.source ?? ''));
912
+ const codexAwIsNamespaced = [...namespacedPrimaryRoots].some((root) => isCanonicalCodexMarketplaceRegistration(codexAw, root));
688
913
  if (codex && (Object.hasOwn(codex.snapshot.marketplaces, 'aw') || Object.keys(codex.snapshot.plugins).some(isAwPluginConsumerKey))
689
914
  && !codexAwIsNamespaced) {
690
915
  output.push({ kind: 'legacyMarketplace', location: codexPath });
@@ -716,11 +941,13 @@ async function oldMarketplaceReferences(env, cwd, errors, includePlatformHistori
716
941
  const claudeAwIsNamespaced = declarationPaths.length > 0
717
942
  && declarationPaths.every((entry) => namespacedPrimaryRoots.has(path.normalize(entry)));
718
943
  if ((settings && (Object.hasOwn(settings.extraKnownMarketplaces ?? {}, 'aw')
719
- || hasAwPluginConsumerKeys(settings.enabledPlugins)
944
+ || Object.entries(settings.enabledPlugins ?? {}).some(([key, enabled]) => isAwPluginConsumerKey(key) && enabled !== false)
720
945
  || hasAwPluginConsumerKeys(settings.plugins?.installed)
721
946
  || hasClaudeMarketplaceConsumer(settings.plugins?.installed))) && !claudeAwIsNamespaced) {
722
947
  output.push({ kind: 'legacyMarketplace', location: claudeSettingsPath });
723
948
  for (const consumer of claudeConsumersFromSettings(settings, 'aw', 'user')) {
949
+ if (consumer.disabledNativeActivation)
950
+ continue;
724
951
  output.push({ kind: 'legacyMarketplace', location: claudeSettingsPath, ...consumer });
725
952
  }
726
953
  }
@@ -757,6 +984,8 @@ async function oldMarketplaceReferences(env, cwd, errors, includePlatformHistori
757
984
  });
758
985
  if (!claudeAwIsNamespaced) {
759
986
  for (const consumer of claudeConsumersFromSettings(projectSettings, 'aw', 'project')) {
987
+ if (consumer.disabledNativeActivation)
988
+ continue;
760
989
  output.push({ kind: 'legacyMarketplace', location: projectSettingsPath, ...consumer });
761
990
  }
762
991
  }
@@ -796,13 +1025,258 @@ function sourceIdFromCanonicalMarketplacePath(candidate, marketplacesRoot) {
796
1025
  const sourceId = path.basename(resolved);
797
1026
  return sourceId !== '' && sourceId !== '.' && sourceId !== '..' ? sourceId : null;
798
1027
  }
799
- function registeredMarketplaceRoots(value, marketplacesRoot) {
800
- if (!isRecord(value))
801
- return [];
802
- return Object.entries(value).flatMap(([marketplaceName, declaration]) => collectMarketplaceDeclarationPaths(declaration).flatMap((candidate) => {
803
- const sourceId = sourceIdFromCanonicalMarketplacePath(candidate, marketplacesRoot);
804
- return sourceId ? [{ marketplaceName, sourceId }] : [];
805
- }));
1028
+ const MARKETPLACE_PLATFORMS = ['codex', 'claude', 'copilot'];
1029
+ async function managedMarketplaceDirectories(awRoot, cwd, env) {
1030
+ const directories = new Map();
1031
+ for (const platform of MARKETPLACE_PLATFORMS) {
1032
+ const configRoot = await canonicalNamespaceRoot(resolvePlatformConfigRoot(platform, { cwd, env }));
1033
+ directories.set(platform, path.join(getManagedPlatformRoot(awRoot, platform, `${platform}-marketplace`, configRoot), 'marketplaces'));
1034
+ }
1035
+ return directories;
1036
+ }
1037
+ function pluginMarketplaceName(pluginId) {
1038
+ const separator = pluginId.lastIndexOf('@');
1039
+ return separator > 0 && separator < pluginId.length - 1 ? pluginId.slice(separator + 1) : undefined;
1040
+ }
1041
+ /** A missing package container is valid after removal; a foreign container is not. */
1042
+ async function assertMarketplacePluginsContainer(root) {
1043
+ const pluginsRoot = path.join(root, 'plugins');
1044
+ const stat = await fs.lstat(pluginsRoot).catch((error) => {
1045
+ if (isAbsentState(error))
1046
+ return null;
1047
+ throw error;
1048
+ });
1049
+ if (stat && (!stat.isDirectory() || stat.isSymbolicLink()))
1050
+ throw new Error('Marketplace plugins container must be a canonical directory.');
1051
+ }
1052
+ async function readEnabledPluginsInventory(location) {
1053
+ const value = await readJsonFileIfExists(location);
1054
+ if (value === null || value === undefined)
1055
+ return {};
1056
+ if (!isRecord(value) || value.enabledPlugins !== undefined && !isRecord(value.enabledPlugins)) {
1057
+ throw new Error('Native settings enabledPlugins must be a JSON object.');
1058
+ }
1059
+ if (isRecord(value.enabledPlugins) && Object.values(value.enabledPlugins).some((enabled) => typeof enabled !== 'boolean')) {
1060
+ throw new Error('Native settings enabledPlugins entries must be boolean.');
1061
+ }
1062
+ return isRecord(value.enabledPlugins) ? value.enabledPlugins : {};
1063
+ }
1064
+ /** Operation-local fingerprints bind reviewed output bytes; they do not confer ownership. */
1065
+ export async function offlineOwnedPathEvidence(location) {
1066
+ const stat = await fs.lstat(location);
1067
+ if (stat.isSymbolicLink())
1068
+ throw new Error('offlineCleanupPathUnsafe');
1069
+ if (stat.isDirectory())
1070
+ return computeCanonicalDirectoryDigest(location);
1071
+ if (!stat.isFile())
1072
+ throw new Error('offlineCleanupPathUnsafe');
1073
+ return `sha256:${crypto.createHash('sha256').update(await fs.readFile(location)).digest('hex')}`;
1074
+ }
1075
+ async function observedProjectReference(options) {
1076
+ const { binding, layout, errors, env, cwd } = options;
1077
+ if (binding.scope.kind !== 'project')
1078
+ return false;
1079
+ const projectRoot = binding.scope.projectRoot;
1080
+ const nativeId = layout.nativeIdentity.registrationId ?? layout.nativeIdentity.packageId;
1081
+ const settingsPath = binding.platform === 'codex' ? path.join(projectRoot, '.codex/config.toml')
1082
+ : binding.platform === 'claude' ? path.join(projectRoot, '.claude/settings.local.json')
1083
+ : binding.platform === 'copilot' ? path.join(projectRoot, '.github/copilot/settings.local.json') : undefined;
1084
+ if (settingsPath) {
1085
+ const recorded = await inventoryRead({ errors, env, cwd, location: settingsPath, kind: 'nativeProjectActivationRead', absent: false,
1086
+ operation: async () => {
1087
+ if (binding.platform === 'codex')
1088
+ return Object.hasOwn((await readCodexConfigFile(settingsPath)).snapshot.plugins, nativeId);
1089
+ const value = await readJsonFileIfExists(settingsPath);
1090
+ if (value == null)
1091
+ return false;
1092
+ if (!isRecord(value) || value.enabledPlugins !== undefined && !isRecord(value.enabledPlugins))
1093
+ throw new Error('nativeProjectActivationInvalid');
1094
+ return isRecord(value.enabledPlugins) && Object.hasOwn(value.enabledPlugins, nativeId);
1095
+ } });
1096
+ if (recorded)
1097
+ return true;
1098
+ }
1099
+ if (binding.platform !== 'codex' && binding.platform !== 'claude')
1100
+ return false;
1101
+ const policyKey = await getInvocationPolicyPhysicalKey({ cwd, env }, binding);
1102
+ const supplementKeys = new Set([policyKey, ...layout.renderUnits.filter((unit) => unit.output === 'supplement').map((unit) => unit.physicalKey)]);
1103
+ const references = binding.platform === 'codex'
1104
+ ? [...await findOwnedHeadersInDirectory(path.join(projectRoot, '.codex/agents'), new Set(['.toml']), false, errors, env, cwd),
1105
+ ...await findOwnedHeadersInDirectory(path.join(projectRoot, '.codex/rules'), new Set(['.rules']), false, errors, env, cwd)]
1106
+ : await claudeSharedOwnerReferences(path.join(projectRoot, '.claude/settings.local.json'), 'project', errors, env, cwd);
1107
+ if (references.some((reference) => {
1108
+ const identity = reference.ownedComponent?.identity;
1109
+ return identity?.pluginId === binding.plugin.pluginId && identity.sourceIdentity === binding.plugin.sourceIdentity
1110
+ && identity.platform === binding.platform && identity.scope === 'project' && identity.physicalKey !== undefined
1111
+ && supplementKeys.has(identity.physicalKey);
1112
+ }))
1113
+ return true;
1114
+ if (binding.platform !== 'claude' || !layout.marketplaceName)
1115
+ return false;
1116
+ const installedPath = path.join(resolvePlatformConfigRoot('claude', { cwd, env }), 'plugins/installed_plugins.json');
1117
+ return inventoryRead({ errors, env, cwd, location: installedPath, kind: 'nativeProjectRegistrationRead', absent: false,
1118
+ operation: async () => {
1119
+ const value = await readJsonFileIfExists(installedPath) ?? null;
1120
+ return claudeConsumersFromInstalled(value, layout.marketplaceName, projectRoot).some((consumer) => consumer.scope === 'project' && consumer.pluginName === binding.plugin.pluginId.split('/').at(-1));
1121
+ } });
1122
+ }
1123
+ async function nativeOwnedReferences(options, errors) {
1124
+ const references = [];
1125
+ const ctx = { cwd: options.cwd, env: options.env };
1126
+ const projectRoot = canonicalizePathThroughExistingAncestorSync(resolveRepoRootSync(options.cwd));
1127
+ const roots = new Map();
1128
+ const add = (root, platform, scope, route, hostRoot, managed = false, sourceId) => roots.set(root, { platform, scope, route, hostRoot, managed, sourceId });
1129
+ for (const platform of NATIVE_PLATFORM_TARGETS) {
1130
+ const hostRoot = resolvePlatformConfigRoot(platform, ctx);
1131
+ if (platform === 'cursor')
1132
+ add(path.join(hostRoot, 'aw-plugins'), platform, 'user', 'cursor-workspace-hook', hostRoot);
1133
+ if (platform === 'opencode' || platform === 'antigravity')
1134
+ add(path.join(hostRoot, 'plugins'), platform, 'user', `${platform}-directory`, hostRoot);
1135
+ if (platform === 'pi')
1136
+ add(path.join(hostRoot, 'aw-packages'), platform, 'user', 'pi-package', hostRoot);
1137
+ if (options.scope !== 'user') {
1138
+ if (platform === 'cursor')
1139
+ add(path.join(projectRoot, '.cursor/aw-plugins'), platform, 'project', 'cursor-workspace-hook', hostRoot);
1140
+ if (platform === 'opencode')
1141
+ add(path.join(projectRoot, '.opencode/plugins'), platform, 'project', 'opencode-directory', hostRoot);
1142
+ if (platform === 'antigravity')
1143
+ add(path.join(projectRoot, '.agents/plugins'), platform, 'project', 'antigravity-directory', hostRoot);
1144
+ if (platform === 'pi')
1145
+ add(path.join(projectRoot, '.pi/aw-packages'), platform, 'project', 'pi-package', hostRoot);
1146
+ if (platform === 'grok')
1147
+ add(path.join(projectRoot, '.grok/plugins'), platform, 'project', 'grok-directory', hostRoot);
1148
+ }
1149
+ }
1150
+ const awRoot = await canonicalNamespaceRoot(resolveAwHome(options.env));
1151
+ const managed = path.join(awRoot, 'platforms');
1152
+ for (const platform of NATIVE_PLATFORM_TARGETS) {
1153
+ const namespaces = await inventoryCanonicalDirectoryEntries({ location: path.join(managed, platform),
1154
+ kind: 'nativeNamespaceRead', errors, env: options.env, cwd: options.cwd });
1155
+ const route = { codex: 'codex-marketplace', claude: 'claude-marketplace',
1156
+ copilot: 'copilot-marketplace', antigravity: 'antigravity-cli', grok: 'grok-cli' };
1157
+ if (!route[platform])
1158
+ continue;
1159
+ for (const namespace of namespaces) {
1160
+ if (!namespace.isDirectory() || namespace.isSymbolicLink())
1161
+ continue;
1162
+ const base = path.join(managed, platform, namespace.name);
1163
+ const sourcesRoot = path.join(base, ['codex', 'claude', 'copilot'].includes(platform) ? 'marketplaces' : 'packages');
1164
+ const sources = await inventoryCanonicalDirectoryEntries({ location: sourcesRoot, kind: 'nativeSourceRead', errors, env: options.env, cwd: options.cwd });
1165
+ for (const source of sources)
1166
+ if (source.isDirectory() && !source.isSymbolicLink()) {
1167
+ add(path.join(sourcesRoot, source.name, ...(['codex', 'claude', 'copilot'].includes(platform) ? ['plugins'] : [])), platform, 'user', route[platform], resolvePlatformConfigRoot(platform, ctx), true, source.name);
1168
+ }
1169
+ }
1170
+ }
1171
+ for (const [root, descriptor] of roots) {
1172
+ if (canonicalizePathThroughExistingAncestorSync(root) !== path.resolve(root)) {
1173
+ errors.push(inventoryError(new Error('Native namespace path contains a symbolic link.'), root, 'nativeNamespaceUnsafe', options.env, options.cwd, { global: false, platform: descriptor.platform, scope: descriptor.scope,
1174
+ ...(descriptor.sourceId ? { sourceId: descriptor.sourceId } : {}) }));
1175
+ continue;
1176
+ }
1177
+ const entries = await inventoryCanonicalDirectoryEntries({ location: root, kind: 'nativePackageRead', errors, env: options.env, cwd: options.cwd });
1178
+ for (const entry of entries) {
1179
+ if (!entry.isDirectory() || entry.isSymbolicLink())
1180
+ continue;
1181
+ const packageRoot = path.join(root, entry.name);
1182
+ const markerPath = path.join(packageRoot, SKILL_OWNER_MARKER);
1183
+ try {
1184
+ const marker = await readSkillOwnerMarker({ skillRoot: packageRoot, allowedRoot: root });
1185
+ if (!marker)
1186
+ continue;
1187
+ if (!marker.sourceId || !marker.sourceIdentity || !marker.physicalKey || !marker.pluginId
1188
+ || marker.platform !== descriptor.platform || marker.scope !== descriptor.scope)
1189
+ continue;
1190
+ const { schemaVersion: _schema, nativeProjection: projection, ...identity } = marker;
1191
+ let configRoot = descriptor.hostRoot;
1192
+ const physical = projection?.physicalIdentity;
1193
+ const antigravityCopy = !descriptor.managed && descriptor.platform === 'antigravity' && descriptor.scope === 'user'
1194
+ && physical?.route === 'antigravity-cli';
1195
+ const route = antigravityCopy ? 'antigravity-cli' : descriptor.route;
1196
+ if (descriptor.managed && physical && physical.platform === descriptor.platform && physical.route === descriptor.route
1197
+ && physical.sourceIdentity === marker.sourceIdentity && physical.pluginId === marker.pluginId
1198
+ && getPhysicalKey(physical) === marker.physicalKey)
1199
+ configRoot = physical.namespaceRoot;
1200
+ const binding = { id: '', plugin: { sourceId: marker.sourceId, sourceIdentity: marker.sourceIdentity,
1201
+ pluginId: marker.pluginId, version: '0.0.0' }, platform: descriptor.platform,
1202
+ scope: descriptor.scope === 'user' ? { kind: 'user' } : { kind: 'project', projectRoot }, route,
1203
+ consumers: [{ id: identityDigest({ platform: descriptor.platform, route, configRoot }),
1204
+ product: 'cli', version: null, availability: 'missing', reasonCodes: ['client-missing'],
1205
+ entry: { kind: 'directory', configRoot } }], physicalKey: marker.physicalKey,
1206
+ activationKey: '', renderUnitIds: [] };
1207
+ const layout = await getDeploymentLayout(ctx, binding);
1208
+ const expectedPackageRoot = antigravityCopy
1209
+ ? path.join(layout.physicalIdentity.namespaceRoot, 'plugins', layout.nativeIdentity.packageId) : layout.packageRoot;
1210
+ if (canonicalizePathThroughExistingAncestorSync(expectedPackageRoot) !== canonicalizePathThroughExistingAncestorSync(packageRoot)
1211
+ || getPhysicalKey(layout.physicalIdentity) !== marker.physicalKey)
1212
+ throw new Error('nativeOwnerPlacementMismatch');
1213
+ const projectComponent = isAntigravityProjectDirectory(binding) ? deploymentPackageComponent(binding, layout) : undefined;
1214
+ if (projectComponent) {
1215
+ const owned = await inspectOwnedComponents({ components: [projectComponent] });
1216
+ if (owned.components[0]?.state !== 'present') {
1217
+ errors.push(inventoryError(new Error('The Antigravity project package has unconfirmed content.'), packageRoot, 'nativeOwnerContentUnconfirmed', options.env, options.cwd, { global: false, platform: descriptor.platform,
1218
+ scope: descriptor.scope, sourceId: marker.sourceId, pluginName: marker.plugin }));
1219
+ continue;
1220
+ }
1221
+ }
1222
+ const inspectCopy = !options.observationPlugins || options.observationPlugins.has(marker.pluginId)
1223
+ || options.observationPlugins.has(marker.pluginId.slice(marker.pluginId.indexOf('/') + 1));
1224
+ if (antigravityCopy && inspectCopy) {
1225
+ await readSkillOwnerMarker({ skillRoot: packageRoot, allowedRoot: root,
1226
+ expectedIdentity: deploymentPackageComponent(binding, layout).identity });
1227
+ if (!projection || getPhysicalKey(projection.physicalIdentity) !== marker.physicalKey
1228
+ || await readPlatformPackageContentDigest(packageRoot) !== projection.contentDigest)
1229
+ throw new Error('nativeCopyContentUnconfirmed');
1230
+ }
1231
+ const component = projectComponent ?? { kind: 'owned-directory', path: packageRoot, allowedRoot: root, identity };
1232
+ const scopes = descriptor.scope === 'user' && options.scope !== 'user'
1233
+ && ['codex', 'claude', 'copilot'].includes(descriptor.platform) ? ['user', 'project'] : [descriptor.scope];
1234
+ const pathEvidence = options.collectPathEvidence === false ? undefined : await offlineOwnedPathEvidence(packageRoot);
1235
+ for (const scope of scopes) {
1236
+ const scopedBinding = { ...binding, scope: scope === 'user' ? { kind: 'user' }
1237
+ : { kind: 'project', projectRoot }, consumers: binding.consumers.map((consumer) => ({ ...consumer })) };
1238
+ const scopedLayout = await getDeploymentLayout(ctx, scopedBinding);
1239
+ if (scope === 'project' && descriptor.scope === 'user'
1240
+ && !await observedProjectReference({ binding: scopedBinding, layout: scopedLayout, cwd: options.cwd, env: options.env, errors }))
1241
+ continue;
1242
+ scopedBinding.activationKey = identityDigest({ physicalKey: scopedBinding.physicalKey, scope: scopedBinding.scope,
1243
+ activationPath: scopedLayout.activationPath });
1244
+ scopedBinding.id = identityDigest({ sourceIdentity: marker.sourceIdentity, pluginId: marker.pluginId,
1245
+ platform: scopedBinding.platform, scope: scopedBinding.scope, route: scopedBinding.route, physicalKey: scopedBinding.physicalKey });
1246
+ scopedBinding.renderUnitIds = scopedLayout.renderUnits.map((unit) => unit.id);
1247
+ const recoveryCandidate = { binding: scopedBinding, physicalIdentity: scopedLayout.physicalIdentity,
1248
+ nativeIdentity: scopedLayout.nativeIdentity, evidence: antigravityCopy && !inspectCopy ? 'unknown' : 'verified' };
1249
+ // A copied marker is a native recovery clue, never direct filesystem
1250
+ // removal authority for the cache or ownership of the AW source path.
1251
+ const currentMarketplaceRoot = scopedLayout.marketplaceRoot && descriptor.managed
1252
+ ? path.join(getManagedPlatformRoot(awRoot, descriptor.platform, descriptor.route, await canonicalNamespaceRoot(descriptor.hostRoot)), 'marketplaces', marker.sourceId) : null;
1253
+ references.push({ kind: antigravityCopy ? 'namespacedMarketplace' : 'namespacedOwner', location: markerPath, sourceId: marker.sourceId,
1254
+ sourceIdentity: marker.sourceIdentity, pluginName: marker.plugin, platform: descriptor.platform, scope,
1255
+ ...(!antigravityCopy ? { ownedComponent: component } : {}), recoveryCandidate, pathEvidence,
1256
+ ...(currentMarketplaceRoot && scopedLayout.marketplaceRoot === currentMarketplaceRoot
1257
+ ? { marketplaceRoot: currentMarketplaceRoot } : {}) });
1258
+ }
1259
+ }
1260
+ catch (error) {
1261
+ errors.push(inventoryError(error, markerPath, 'nativeOwnerRead', options.env, options.cwd, { global: false, platform: descriptor.platform, scope: descriptor.scope }));
1262
+ }
1263
+ }
1264
+ }
1265
+ // Grok rules are scope-local supplements. Codex supplements and Claude permission tokens use their existing exact readers.
1266
+ for (const scope of options.scope === 'user' ? ['user'] : ['user', 'project']) {
1267
+ for (const platform of ['opencode', 'antigravity', 'grok']) {
1268
+ const permissions = await inventoryRead({ operation: () => offlinePermissionComponents(ctx, scope === 'project' ? projectRoot : undefined, platform),
1269
+ absent: [], errors, cwd: options.cwd, env: options.env, location: path.join(resolveAwHome(options.env), 'platforms', platform, 'permission-ownership'),
1270
+ kind: 'permissionOwnershipRead' });
1271
+ for (const component of permissions)
1272
+ references.push({ kind: 'namespacedOwner', location: component.locator.settingsPath,
1273
+ sourceId: component.identity.sourceId, sourceIdentity: component.identity.sourceIdentity, pluginName: component.identity.plugin,
1274
+ platform, scope, ownedComponent: component });
1275
+ }
1276
+ const root = scope === 'user' ? path.join(resolvePlatformConfigRoot('grok', ctx), 'rules') : path.join(projectRoot, '.grok/rules');
1277
+ references.push(...await findOwnedHeadersInDirectory(root, new Set(['.md', '.rules']), false, errors, options.env, options.cwd));
1278
+ }
1279
+ return references;
806
1280
  }
807
1281
  export async function inventoryCatalogSourceReferences(options) {
808
1282
  const env = options.env ?? process.env;
@@ -821,10 +1295,21 @@ export async function inventoryCatalogSourceReferences(options) {
821
1295
  const legacyConfig = await inventoryLegacyConfigReferences(options);
822
1296
  references.push(...legacyConfig.references);
823
1297
  errors.push(...legacyConfig.errors);
824
- for (const scope of ['user', 'project']) {
825
- const location = resolvePluginIntentStatePath({ scope, cwd: options.cwd, env });
1298
+ for (const scope of options.scope === 'user' ? ['user'] : ['user', 'project']) {
1299
+ let location;
1300
+ try {
1301
+ location = await resolveIntentPath({ scope, cwd: options.cwd, env });
1302
+ }
1303
+ catch (error) {
1304
+ if (scope === 'project' && error instanceof Error && error.message.startsWith('projectRootUnavailable'))
1305
+ continue;
1306
+ throw error;
1307
+ }
826
1308
  const state = await inventoryRead({
827
- operation: () => readPluginIntentState({ scope, cwd: options.cwd, env }),
1309
+ operation: async () => {
1310
+ const ids = await readIntentReferences({ scope, cwd: options.cwd, env });
1311
+ return { roots: ids.map((pluginId) => ({ pluginId })) };
1312
+ },
828
1313
  absent: null,
829
1314
  errors,
830
1315
  location,
@@ -834,10 +1319,7 @@ export async function inventoryCatalogSourceReferences(options) {
834
1319
  });
835
1320
  if (!state)
836
1321
  continue;
837
- for (const pluginId of new Set([
838
- ...state.roots.map((root) => root.pluginId),
839
- ...state.dependencyScopeOverrides.map((override) => override.pluginId),
840
- ])) {
1322
+ for (const pluginId of new Set(state.roots.map((root) => root.pluginId))) {
841
1323
  const separator = pluginId.indexOf('/');
842
1324
  if (separator <= 0 || separator === pluginId.length - 1)
843
1325
  continue;
@@ -850,7 +1332,8 @@ export async function inventoryCatalogSourceReferences(options) {
850
1332
  });
851
1333
  }
852
1334
  }
853
- for (const configInventory of await inventoryPluginConfigRoots({ errors, env, cwd: options.cwd })) {
1335
+ for (const configInventory of await inventoryPluginConfigRoots({ errors, env, cwd: options.cwd,
1336
+ scope: options.scope })) {
854
1337
  const configRoot = configInventory.root;
855
1338
  const sourceEntries = await inventoryRead({
856
1339
  operation: () => fs.readdir(configRoot, { withFileTypes: true }),
@@ -908,6 +1391,7 @@ export async function inventoryCatalogSourceReferences(options) {
908
1391
  }
909
1392
  }
910
1393
  }
1394
+ references.push(...await nativeOwnedReferences({ ...options, env }, errors));
911
1395
  const ownerInventory = await inventoryLegacyOwnerReferences(options);
912
1396
  references.push(...ownerInventory.references);
913
1397
  errors.push(...ownerInventory.errors);
@@ -915,7 +1399,7 @@ export async function inventoryCatalogSourceReferences(options) {
915
1399
  [path.join(getCodexHome(env), 'config.toml'), 'nativeStateRead', () => codexSharedOwnerReferences(path.join(getCodexHome(env), 'config.toml'), 'user', errors, env, options.cwd)],
916
1400
  [path.join(getClaudeHome(env), 'settings.json'), 'nativeStateRead', () => claudeSharedOwnerReferences(path.join(getClaudeHome(env), 'settings.json'), 'user', errors, env, options.cwd)],
917
1401
  [path.join(resolveRepoRootSync(options.cwd), '.codex', 'config.toml'), 'nativeStateRead', () => codexSharedOwnerReferences(path.join(resolveRepoRootSync(options.cwd), '.codex', 'config.toml'), 'project', errors, env, options.cwd)],
918
- [path.join(resolveRepoRootSync(options.cwd), '.claude', 'settings.json'), 'nativeStateRead', () => claudeSharedOwnerReferences(path.join(resolveRepoRootSync(options.cwd), '.claude', 'settings.json'), 'project', errors, env, options.cwd)],
1402
+ [path.join(resolveRepoRootSync(options.cwd), '.claude', 'settings.local.json'), 'nativeStateRead', () => claudeSharedOwnerReferences(path.join(resolveRepoRootSync(options.cwd), '.claude', 'settings.local.json'), 'project', errors, env, options.cwd)],
919
1403
  ]) {
920
1404
  references.push(...await inventoryRead({
921
1405
  operation, absent: [], errors, location, kind, env, cwd: options.cwd,
@@ -956,54 +1440,162 @@ export async function inventoryCatalogSourceReferences(options) {
956
1440
  const marketplaceEntries = await inventoryCanonicalDirectoryEntries({
957
1441
  errors, location: marketplacesRoot, kind: 'marketplaceDirectoryRead', env, cwd: options.cwd,
958
1442
  });
959
- for (const pluginId of Object.keys(codexConfig?.snapshot.plugins ?? {})) {
960
- const separator = pluginId.lastIndexOf('@');
961
- if (separator <= 0 || separator === pluginId.length - 1)
962
- continue;
963
- references.push({
964
- kind: 'namespacedMarketplace',
965
- location: codexConfigPath,
966
- pluginName: pluginId.slice(0, separator),
967
- marketplaceName: pluginId.slice(separator + 1),
968
- platform: 'codex',
969
- scope: 'user',
970
- });
1443
+ const canonicalAwRoot = await canonicalNamespaceRoot(awHome);
1444
+ const managedDirectories = await managedMarketplaceDirectories(canonicalAwRoot, options.cwd, env);
1445
+ const canonicalLegacyRoot = path.join(canonicalAwRoot, 'marketplaces');
1446
+ const projectClaudeLocalSettingsPath = path.join(resolveRepoRootSync(options.cwd), '.claude', 'settings.local.json');
1447
+ const projectClaudeLocalSettings = await inventoryRead({
1448
+ operation: () => readJsonFileIfExists(projectClaudeLocalSettingsPath), absent: null, errors,
1449
+ location: projectClaudeLocalSettingsPath, kind: 'nativeStateRead', env, cwd: options.cwd,
1450
+ });
1451
+ const nativeConsumers = [];
1452
+ const addConsumer = (location, marketplaceName, consumer) => {
1453
+ nativeConsumers.push({ kind: 'namespacedMarketplace', location, marketplaceName, ...consumer });
1454
+ };
1455
+ for (const [location, plugins, platform, scope] of [
1456
+ [codexConfigPath, codexConfig?.snapshot.plugins ?? {}, 'codex', 'user'],
1457
+ [projectCodexConfigPath, projectCodexConfig?.snapshot.plugins ?? {}, 'codex', 'project'],
1458
+ ...await Promise.all(['user', 'project'].map(async (scope) => {
1459
+ const location = scope === 'user'
1460
+ ? path.join(resolvePlatformConfigRoot('copilot', { cwd: options.cwd, env }), 'settings.json')
1461
+ : path.join(resolveRepoRootSync(options.cwd), '.github', 'copilot', 'settings.local.json');
1462
+ const plugins = await inventoryRead({ operation: () => readEnabledPluginsInventory(location), absent: {}, errors,
1463
+ location, kind: 'nativeStateRead', env, cwd: options.cwd });
1464
+ return [location, plugins, 'copilot', scope];
1465
+ })),
1466
+ ]) {
1467
+ for (const pluginId of Object.keys(plugins)) {
1468
+ const marketplaceName = pluginMarketplaceName(pluginId);
1469
+ if (marketplaceName)
1470
+ addConsumer(location, marketplaceName, {
1471
+ pluginName: pluginNameFromMarketplaceId(pluginId, marketplaceName), platform, scope,
1472
+ });
1473
+ }
971
1474
  }
972
- for (const pluginId of Object.keys(projectCodexConfig?.snapshot.plugins ?? {})) {
973
- const separator = pluginId.lastIndexOf('@');
974
- if (separator <= 0 || separator === pluginId.length - 1)
1475
+ for (const [location, settings, scope] of [
1476
+ [userClaudeSettingsPath, userClaudeSettings, 'user'],
1477
+ [projectClaudeSettingsPath, projectClaudeSettings, 'project'],
1478
+ [projectClaudeLocalSettingsPath, projectClaudeLocalSettings, 'project'],
1479
+ ]) {
1480
+ if (!settings)
975
1481
  continue;
976
- references.push({
977
- kind: 'namespacedMarketplace',
978
- location: projectCodexConfigPath,
979
- pluginName: pluginId.slice(0, separator),
980
- marketplaceName: pluginId.slice(separator + 1),
981
- platform: 'codex',
982
- scope: 'project',
983
- });
1482
+ const installed = isRecord(settings.plugins) && isRecord(settings.plugins.installed) ? settings.plugins.installed : {};
1483
+ const names = new Set([
1484
+ ...Object.keys(isRecord(settings.enabledPlugins) ? settings.enabledPlugins : {}).map(pluginMarketplaceName),
1485
+ ...Object.values(installed).flatMap((entry) => isRecord(entry) && typeof entry.marketplace === 'string' ? [entry.marketplace] : []),
1486
+ ].filter((name) => !!name));
1487
+ for (const name of names)
1488
+ for (const consumer of claudeConsumersFromSettings(settings, name, scope))
1489
+ addConsumer(location, name, consumer);
984
1490
  }
985
- for (const [location, registrations] of [
986
- [codexConfigPath, Object.entries(codexConfig?.snapshot.marketplaces ?? {}).flatMap(([marketplaceName, marketplace]) => {
987
- const sourceId = marketplace.sourceType === 'local' && !marketplace.sourcePointsToManifest
988
- && marketplace.source
989
- ? sourceIdFromCanonicalMarketplacePath(marketplace.source, marketplacesRoot)
990
- : null;
991
- return sourceId ? [{ marketplaceName, sourceId }] : [];
992
- })],
993
- [userClaudeSettingsPath, registeredMarketplaceRoots(userClaudeSettings?.extraKnownMarketplaces, marketplacesRoot)],
994
- [projectClaudeSettingsPath, registeredMarketplaceRoots(projectClaudeSettings?.extraKnownMarketplaces, marketplacesRoot)],
995
- [claudeKnownPath, [
996
- ...registeredMarketplaceRoots(claudeKnown, marketplacesRoot),
997
- ...registeredMarketplaceRoots(claudeKnown?.marketplaces, marketplacesRoot),
998
- ]],
1491
+ const installedClaudeNames = new Set();
1492
+ if (isRecord(claudeInstalled?.plugins))
1493
+ for (const [id, raw] of Object.entries(claudeInstalled.plugins)) {
1494
+ const name = pluginMarketplaceName(id);
1495
+ if (name)
1496
+ installedClaudeNames.add(name);
1497
+ for (const entry of Array.isArray(raw) ? raw : [raw]) {
1498
+ if (isRecord(entry) && typeof entry.marketplace === 'string')
1499
+ installedClaudeNames.add(entry.marketplace);
1500
+ }
1501
+ }
1502
+ try {
1503
+ if (installedClaudeNames.size === 0)
1504
+ claudeConsumersFromInstalled(claudeInstalled, '', path.normalize(canonicalProjectRoot));
1505
+ for (const name of installedClaudeNames)
1506
+ for (const consumer of claudeConsumersFromInstalled(claudeInstalled, name, path.normalize(canonicalProjectRoot), options.includePlatformHistoricalProjects === true, true))
1507
+ addConsumer(claudeInstalledPath, name, consumer);
1508
+ }
1509
+ catch (error) {
1510
+ errors.push(inventoryError(error, claudeInstalledPath, 'nativeStateRead', env, options.cwd));
1511
+ }
1512
+ references.push(...nativeConsumers);
1513
+ // Host paths are matched lexically against only the legacy root and the current
1514
+ // platform/route namespace. Never adopt a host's foreign directory or another namespace.
1515
+ const registrations = [];
1516
+ const appendRegistration = (platform, location, marketplaceName, registrationPath, scope) => {
1517
+ const sourceId = registrationPath
1518
+ ? (sourceIdFromCanonicalMarketplacePath(registrationPath, canonicalLegacyRoot)
1519
+ ?? sourceIdFromCanonicalMarketplacePath(registrationPath, managedDirectories.get(platform)))
1520
+ : null;
1521
+ registrations.push({ kind: 'namespacedMarketplace', location, platform, marketplaceName,
1522
+ ...(sourceId ? { sourceId } : {}), ...(scope ? { scope } : {}), marketplaceRegistrationPath: registrationPath });
1523
+ };
1524
+ for (const [location, config, scope] of [
1525
+ [codexConfigPath, codexConfig, 'user'], [projectCodexConfigPath, projectCodexConfig, 'project'],
999
1526
  ]) {
1000
- for (const registration of registrations)
1001
- references.push({
1002
- kind: 'namespacedMarketplace',
1003
- location,
1004
- sourceId: registration.sourceId,
1005
- marketplaceName: registration.marketplaceName,
1006
- });
1527
+ for (const [name, marketplace] of Object.entries(config?.snapshot.marketplaces ?? {})) {
1528
+ const source = marketplace.sourceType === 'local' && !marketplace.sourcePointsToManifest ? marketplace.source : undefined;
1529
+ appendRegistration('codex', location, name, canonicalMarketplaceRegistrationPath(source, awHome, canonicalAwRoot), scope);
1530
+ }
1531
+ }
1532
+ for (const [location, declarations, scope] of [
1533
+ [userClaudeSettingsPath, userClaudeSettings?.extraKnownMarketplaces, 'user'],
1534
+ [projectClaudeSettingsPath, projectClaudeSettings?.extraKnownMarketplaces, 'project'],
1535
+ [projectClaudeLocalSettingsPath, projectClaudeLocalSettings?.extraKnownMarketplaces, 'project'],
1536
+ [claudeKnownPath, claudeKnown, undefined], [claudeKnownPath, claudeKnown?.marketplaces, undefined],
1537
+ ]) {
1538
+ if (!isRecord(declarations))
1539
+ continue;
1540
+ for (const [name, declaration] of Object.entries(declarations)) {
1541
+ if (name === 'marketplaces' && location === claudeKnownPath)
1542
+ continue;
1543
+ const declaredSource = isRecord(declaration) ? declaration.source : undefined;
1544
+ const foreignSource = typeof declaredSource === 'string' && declaredSource !== 'directory' && !path.isAbsolute(declaredSource)
1545
+ || isRecord(declaredSource) && declaredSource.source !== undefined && declaredSource.source !== 'directory';
1546
+ const paths = [...new Set(collectMarketplaceDeclarationPaths(declaration)
1547
+ .map((candidate) => canonicalMarketplaceRegistrationPath(candidate, awHome, canonicalAwRoot)))];
1548
+ appendRegistration('claude', location, name, !foreignSource && paths.length === 1 ? paths[0] ?? null : null, scope);
1549
+ }
1550
+ }
1551
+ references.push(...registrations);
1552
+ for (const [platform, directory] of managedDirectories) {
1553
+ const root = await inventoryCanonicalDescendantDirectory({ root: canonicalAwRoot,
1554
+ segments: path.relative(canonicalAwRoot, directory).split(path.sep), errors,
1555
+ kind: 'marketplaceDirectoryRead', env, cwd: options.cwd });
1556
+ const entries = root ? await inventoryCanonicalDirectoryEntries({ errors, location: root,
1557
+ kind: 'marketplaceDirectoryRead', env, cwd: options.cwd }) : [];
1558
+ const registeredIds = registrations.filter((registration) => registration.platform === platform && registration.marketplaceRegistrationPath
1559
+ && sourceIdFromCanonicalMarketplacePath(registration.marketplaceRegistrationPath, directory) !== null)
1560
+ .flatMap((registration) => registration.sourceId ? [registration.sourceId] : []);
1561
+ for (const sourceId of new Set([...entries.map((entry) => entry.name), ...registeredIds])) {
1562
+ const marketplaceRoot = path.join(directory, sourceId);
1563
+ const configPath = path.join(marketplaceRoot, 'config.json');
1564
+ const strictRoot = root ? await inventoryRead({ operation: async () => {
1565
+ if (!await inventoryCanonicalDirectory({ errors, location: marketplaceRoot, kind: 'marketplaceRootValidation', env, cwd: options.cwd }))
1566
+ return null;
1567
+ await assertMarketplacePluginsContainer(marketplaceRoot);
1568
+ const manifestPath = path.join(marketplaceRoot, platform === 'codex' ? '.agents/plugins/marketplace.json'
1569
+ : platform === 'claude' ? '.claude-plugin/marketplace.json' : '.github/plugin/marketplace.json');
1570
+ for (const location of [configPath, manifestPath]) {
1571
+ if (await canonicalNamespaceRoot(location) !== location)
1572
+ throw new Error('Marketplace path contains a symbolic link.');
1573
+ }
1574
+ return readStrictNamespacedMarketplaceRoot({ rootDir: marketplaceRoot, sourceId, platform, trustedMarketplaceRoot: directory });
1575
+ }, absent: null, reportAbsent: true, errors, location: marketplaceRoot, kind: 'marketplaceRootValidation', env, cwd: options.cwd }) : null;
1576
+ const names = new Set(registrations.filter((registration) => registration.platform === platform
1577
+ && registration.marketplaceRegistrationPath === marketplaceRoot).flatMap((registration) => registration.marketplaceName ? [registration.marketplaceName] : []));
1578
+ if (strictRoot) {
1579
+ const { marketplaceName, sourceIdentity } = strictRoot.config;
1580
+ names.add(marketplaceName);
1581
+ references.push({ kind: 'namespacedMarketplace', sourceId, sourceIdentity, marketplaceName, marketplaceRoot, platform, location: configPath });
1582
+ for (const entry of strictRoot.manifest.plugins) {
1583
+ if (!isRecord(entry) || typeof entry.name !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(entry.name)
1584
+ || entry.source !== `./plugins/${entry.name}`)
1585
+ continue;
1586
+ references.push({ kind: 'namespacedMarketplace', sourceId, sourceIdentity, marketplaceName, marketplaceRoot, platform,
1587
+ location: configPath, pluginName: entry.name, scope: 'user', marketplaceManifestEntry: true });
1588
+ }
1589
+ }
1590
+ for (const consumer of nativeConsumers) {
1591
+ if (consumer.platform !== platform || consumer.disabledNativeActivation
1592
+ || !consumer.marketplaceName || !names.has(consumer.marketplaceName))
1593
+ continue;
1594
+ const exact = strictRoot?.config.marketplaceName === consumer.marketplaceName;
1595
+ references.push({ ...consumer, location: configPath, sourceId,
1596
+ ...(exact ? { sourceIdentity: strictRoot.config.sourceIdentity, marketplaceRoot } : {}) });
1597
+ }
1598
+ }
1007
1599
  }
1008
1600
  for (const sourceEntry of marketplaceEntries) {
1009
1601
  const marketplaceRoot = path.join(marketplacesRoot, sourceEntry.name);
@@ -1018,10 +1610,16 @@ export async function inventoryCatalogSourceReferences(options) {
1018
1610
  });
1019
1611
  const strictRoot = canonicalRoot
1020
1612
  ? await inventoryRead({
1021
- operation: () => readStrictNamespacedMarketplaceRoot({
1022
- rootDir: marketplaceRoot,
1023
- sourceId: sourceEntry.name,
1024
- }),
1613
+ operation: async () => {
1614
+ await assertMarketplacePluginsContainer(marketplaceRoot);
1615
+ const expectedRoot = path.join(canonicalLegacyRoot, sourceEntry.name);
1616
+ for (const location of [marketplaceRoot, configPath, agentsManifestPath, path.join(marketplaceRoot, '.claude-plugin/marketplace.json')]) {
1617
+ const expected = path.join(expectedRoot, path.relative(marketplaceRoot, location));
1618
+ if (await canonicalNamespaceRoot(location) !== expected)
1619
+ throw new Error('Marketplace path contains a symbolic link.');
1620
+ }
1621
+ return readStrictNamespacedMarketplaceRoot({ rootDir: marketplaceRoot, sourceId: sourceEntry.name });
1622
+ },
1025
1623
  absent: null,
1026
1624
  reportAbsent: true,
1027
1625
  errors,
@@ -1050,9 +1648,7 @@ export async function inventoryCatalogSourceReferences(options) {
1050
1648
  }
1051
1649
  }
1052
1650
  for (const [name, marketplace] of Object.entries(codexConfig?.snapshot.marketplaces ?? {})) {
1053
- if (marketplace.sourceType === 'local'
1054
- && !marketplace.sourcePointsToManifest
1055
- && path.normalize(marketplace.source ?? '') === path.normalize(marketplaceRoot)) {
1651
+ if (isCanonicalCodexMarketplaceRegistration(marketplace, marketplaceRoot)) {
1056
1652
  candidateMarketplaceNames.add(name);
1057
1653
  }
1058
1654
  }
@@ -1072,31 +1668,11 @@ export async function inventoryCatalogSourceReferences(options) {
1072
1668
  const codexMarketplace = marketplaceName
1073
1669
  ? codexConfig?.snapshot.marketplaces[marketplaceName]
1074
1670
  : undefined;
1075
- const codexMarketplaceIsCanonical = codexMarketplace?.sourceType === 'local'
1076
- && !codexMarketplace.sourcePointsToManifest
1077
- && path.normalize(codexMarketplace.source ?? '') === path.normalize(marketplaceRoot);
1078
- const consumers = [];
1079
- if (marketplaceName !== null && (strictRoot !== null || codexMarketplaceIsCanonical)) {
1080
- for (const pluginId of Object.keys(codexConfig?.snapshot.plugins ?? {})) {
1081
- const pluginName = pluginNameFromMarketplaceId(pluginId, marketplaceName);
1082
- if (pluginName)
1083
- consumers.push({ pluginName, platform: 'codex', scope: 'user' });
1084
- }
1085
- for (const pluginId of Object.keys(projectCodexConfig?.snapshot.plugins ?? {})) {
1086
- const pluginName = pluginNameFromMarketplaceId(pluginId, marketplaceName);
1087
- if (pluginName)
1088
- consumers.push({ pluginName, platform: 'codex', scope: 'project' });
1089
- }
1090
- }
1091
- if (marketplaceName !== null) {
1092
- consumers.push(...claudeConsumersFromSettings(userClaudeSettings, marketplaceName, 'user'), ...claudeConsumersFromSettings(projectClaudeSettings, marketplaceName, 'project'));
1093
- try {
1094
- consumers.push(...claudeConsumersFromInstalled(claudeInstalled, marketplaceName, path.normalize(canonicalProjectRoot), options.includePlatformHistoricalProjects === true));
1095
- }
1096
- catch (error) {
1097
- errors.push(inventoryError(error, claudeInstalledPath, 'nativeStateRead', env, options.cwd));
1098
- }
1099
- }
1671
+ const codexMarketplaceIsCanonical = isCanonicalCodexMarketplaceRegistration(codexMarketplace, marketplaceRoot);
1672
+ const consumers = nativeConsumers.filter((consumer) => consumer.platform !== 'copilot'
1673
+ && !consumer.disabledNativeActivation
1674
+ && consumer.marketplaceName === marketplaceName
1675
+ && (consumer.platform !== 'codex' || strictRoot !== null || codexMarketplaceIsCanonical));
1100
1676
  if (marketplaceName !== null && strictRoot !== null) {
1101
1677
  references.push({
1102
1678
  kind: 'namespacedMarketplace',
@@ -1104,17 +1680,19 @@ export async function inventoryCatalogSourceReferences(options) {
1104
1680
  sourceId: sourceEntry.name,
1105
1681
  ...(sourceIdentity ? { sourceIdentity } : {}),
1106
1682
  marketplaceName,
1683
+ marketplaceRoot: path.join(canonicalLegacyRoot, sourceEntry.name),
1107
1684
  });
1108
1685
  }
1109
1686
  if (marketplaceName !== null) {
1110
1687
  for (const consumer of consumers)
1111
1688
  references.push({
1689
+ ...consumer,
1112
1690
  kind: 'namespacedMarketplace',
1113
1691
  location: configPath,
1114
1692
  sourceId: sourceEntry.name,
1115
1693
  ...(sourceIdentity ? { sourceIdentity } : {}),
1116
1694
  marketplaceName,
1117
- ...consumer,
1695
+ ...(strictRoot ? { marketplaceRoot: path.join(canonicalLegacyRoot, sourceEntry.name) } : {}),
1118
1696
  });
1119
1697
  }
1120
1698
  }
@@ -1133,9 +1711,24 @@ export async function inventoryCatalogSourceReferences(options) {
1133
1711
  reference.scope ?? '',
1134
1712
  reference.marketplaceName ?? '',
1135
1713
  reference.projectKey ?? '',
1714
+ reference.marketplaceRoot ?? '',
1715
+ reference.marketplaceRegistrationPath ?? '',
1716
+ reference.marketplaceManifestEntry ? 'manifest' : '',
1717
+ reference.managedNativeRegistration ? 'managed' : '',
1718
+ reference.disabledNativeActivation ? 'disabled' : '',
1136
1719
  ].join('\0'), reference])).values()];
1137
1720
  unique.sort((left, right) => left.location.localeCompare(right.location));
1138
- return { inventorySchemaVersion: 1, references: unique, errors };
1721
+ const knownNames = [...new Set([...(options.knownPluginNames ?? []), ...unique.flatMap((reference) => reference.kind.startsWith('namespaced') && reference.pluginName ? [reference.pluginName] : [])])];
1722
+ for (const error of errors) {
1723
+ if (error.kind !== 'ownerHeaderPathValidation' || error.relevance.global || !error.recoveryPath || error.configKey === 'agents')
1724
+ continue;
1725
+ const basename = path.basename(error.recoveryPath);
1726
+ const candidates = knownNames.filter((name) => basename.startsWith(`aw-${name}-`));
1727
+ if (candidates.length === 1)
1728
+ error.relevance = { ...error.relevance, pluginName: candidates[0] };
1729
+ }
1730
+ return { inventorySchemaVersion: 1, references: options.scope === 'user'
1731
+ ? unique.filter((reference) => reference.scope !== 'project') : unique, errors };
1139
1732
  }
1140
1733
  export class LegacyCatalogStateUnsupportedError extends Error {
1141
1734
  code = 'legacyStateUnsupported';