@lesliechan721/aw 0.1.0-beta.84 → 0.1.0-beta.86

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 (339) hide show
  1. package/dist/authoring/assets/command-runtime-config.d.mts +9 -0
  2. package/dist/authoring/assets/command-runtime-config.mjs +106 -0
  3. package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
  4. package/dist/authoring/scripts/validate-plugin.mjs +17 -22
  5. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  6. package/dist/index.js +2 -6
  7. package/dist/index.js.map +1 -1
  8. package/dist/scripts/aw-skill-eval-materializer.d.ts +4 -0
  9. package/dist/scripts/aw-skill-eval-materializer.js +27 -0
  10. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
  11. package/dist/scripts/bundle-plugins.js +1 -1
  12. package/dist/scripts/bundle-plugins.js.map +1 -1
  13. package/dist/scripts/test-plugin-scripts.js +13 -2
  14. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  15. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  16. package/dist/src/commands/aw-capabilities.js +2 -2
  17. package/dist/src/commands/catalog-source.d.ts +2 -1
  18. package/dist/src/commands/catalog-source.js +8 -7
  19. package/dist/src/commands/catalog-source.js.map +1 -1
  20. package/dist/src/commands/deployment-confirmation.d.ts +8 -1
  21. package/dist/src/commands/deployment-confirmation.js +79 -11
  22. package/dist/src/commands/deployment-confirmation.js.map +1 -1
  23. package/dist/src/commands/lifecycle-command-package.d.ts +44 -0
  24. package/dist/src/commands/lifecycle-command-package.js +195 -0
  25. package/dist/src/commands/lifecycle-command-package.js.map +1 -0
  26. package/dist/src/commands/managed-commands.d.ts +6 -0
  27. package/dist/src/commands/managed-commands.js +203 -152
  28. package/dist/src/commands/managed-commands.js.map +1 -1
  29. package/dist/src/commands/operation-plan.d.ts +22 -21
  30. package/dist/src/commands/operation-plan.js +2 -5
  31. package/dist/src/commands/operation-plan.js.map +1 -1
  32. package/dist/src/commands/permission-batch.d.ts +5 -0
  33. package/dist/src/commands/permission-batch.js +80 -0
  34. package/dist/src/commands/permission-batch.js.map +1 -0
  35. package/dist/src/commands/plugin-capabilities.js +17 -13
  36. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  37. package/dist/src/commands/public-config-confirmation.d.ts +8 -2
  38. package/dist/src/commands/public-config-confirmation.js +22 -5
  39. package/dist/src/commands/public-config-confirmation.js.map +1 -1
  40. package/dist/src/commands/public-lifecycle-result.d.ts +7 -12
  41. package/dist/src/commands/public-lifecycle-result.js +136 -40
  42. package/dist/src/commands/public-lifecycle-result.js.map +1 -1
  43. package/dist/src/commands/public-lifecycle.js +49 -8
  44. package/dist/src/commands/public-lifecycle.js.map +1 -1
  45. package/dist/src/commands/public-plugin-query.js +21 -5
  46. package/dist/src/commands/public-plugin-query.js.map +1 -1
  47. package/dist/src/commands/rebuild-command.d.ts +4 -0
  48. package/dist/src/commands/rebuild-command.js +150 -48
  49. package/dist/src/commands/rebuild-command.js.map +1 -1
  50. package/dist/src/commands/rebuild-integration.d.ts +12 -3
  51. package/dist/src/commands/rebuild-integration.js +52 -164
  52. package/dist/src/commands/rebuild-integration.js.map +1 -1
  53. package/dist/src/commands/rebuild-operations.d.ts +2 -1
  54. package/dist/src/commands/rebuild-operations.js +7 -2
  55. package/dist/src/commands/rebuild-operations.js.map +1 -1
  56. package/dist/src/commands/rebuild-platform-integration.d.ts +12 -5
  57. package/dist/src/commands/rebuild-platform-integration.js +691 -186
  58. package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
  59. package/dist/src/commands/skill-eval.js +10 -1
  60. package/dist/src/commands/skill-eval.js.map +1 -1
  61. package/dist/src/generators/local-plugin.js +14 -15
  62. package/dist/src/generators/local-plugin.js.map +1 -1
  63. package/dist/src/generators/permissions.d.ts +18 -4
  64. package/dist/src/generators/permissions.js +76 -22
  65. package/dist/src/generators/permissions.js.map +1 -1
  66. package/dist/src/index.d.ts +1 -0
  67. package/dist/src/index.js +84 -44
  68. package/dist/src/index.js.map +1 -1
  69. package/dist/src/intent/scope-context.d.ts +4 -2
  70. package/dist/src/intent/scope-context.js +37 -7
  71. package/dist/src/intent/scope-context.js.map +1 -1
  72. package/dist/src/output/command-receipt.js +7 -8
  73. package/dist/src/output/command-receipt.js.map +1 -1
  74. package/dist/src/output/component-delivery.d.ts +28 -0
  75. package/dist/src/output/component-delivery.js +138 -0
  76. package/dist/src/output/component-delivery.js.map +1 -0
  77. package/dist/src/output/public-result.d.ts +17 -0
  78. package/dist/src/output/public-result.js +121 -25
  79. package/dist/src/output/public-result.js.map +1 -1
  80. package/dist/src/output/rebuild-progress.js +7 -4
  81. package/dist/src/output/rebuild-progress.js.map +1 -1
  82. package/dist/src/output/receipt-projection.js +51 -31
  83. package/dist/src/output/receipt-projection.js.map +1 -1
  84. package/dist/src/output/skill-invocation-notices.d.ts +2 -0
  85. package/dist/src/output/skill-invocation-notices.js +40 -4
  86. package/dist/src/output/skill-invocation-notices.js.map +1 -1
  87. package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
  88. package/dist/src/platforms/antigravity-permissions.js +388 -0
  89. package/dist/src/platforms/antigravity-permissions.js.map +1 -0
  90. package/dist/src/platforms/capabilities.d.ts +4 -1
  91. package/dist/src/platforms/capabilities.js +93 -9
  92. package/dist/src/platforms/capabilities.js.map +1 -1
  93. package/dist/src/platforms/contracts.d.ts +46 -2
  94. package/dist/src/platforms/discovery.d.ts +13 -0
  95. package/dist/src/platforms/discovery.js +170 -30
  96. package/dist/src/platforms/discovery.js.map +1 -1
  97. package/dist/src/platforms/grok-permission-config.d.ts +22 -0
  98. package/dist/src/platforms/grok-permission-config.js +184 -0
  99. package/dist/src/platforms/grok-permission-config.js.map +1 -0
  100. package/dist/src/platforms/grok-permission-document.d.ts +4 -0
  101. package/dist/src/platforms/grok-permission-document.js +145 -0
  102. package/dist/src/platforms/grok-permission-document.js.map +1 -0
  103. package/dist/src/platforms/grok-permissions.d.ts +17 -0
  104. package/dist/src/platforms/grok-permissions.js +311 -0
  105. package/dist/src/platforms/grok-permissions.js.map +1 -0
  106. package/dist/src/platforms/host-permission-policy.d.ts +38 -0
  107. package/dist/src/platforms/host-permission-policy.js +86 -0
  108. package/dist/src/platforms/host-permission-policy.js.map +1 -0
  109. package/dist/src/platforms/inspection-grok.js +165 -11
  110. package/dist/src/platforms/inspection-grok.js.map +1 -1
  111. package/dist/src/platforms/inspection-native.js +53 -18
  112. package/dist/src/platforms/inspection-native.js.map +1 -1
  113. package/dist/src/platforms/inspection-pi.d.ts +7 -1
  114. package/dist/src/platforms/inspection-pi.js +295 -95
  115. package/dist/src/platforms/inspection-pi.js.map +1 -1
  116. package/dist/src/platforms/inspection-query.d.ts +4 -2
  117. package/dist/src/platforms/inspection-query.js +24 -8
  118. package/dist/src/platforms/inspection-query.js.map +1 -1
  119. package/dist/src/platforms/inspection.d.ts +4 -1
  120. package/dist/src/platforms/inspection.js +36 -4
  121. package/dist/src/platforms/inspection.js.map +1 -1
  122. package/dist/src/platforms/layout.d.ts +13 -0
  123. package/dist/src/platforms/layout.js +90 -12
  124. package/dist/src/platforms/layout.js.map +1 -1
  125. package/dist/src/platforms/lifecycle-native.d.ts +1 -0
  126. package/dist/src/platforms/lifecycle-native.js +25 -1
  127. package/dist/src/platforms/lifecycle-native.js.map +1 -1
  128. package/dist/src/platforms/lifecycle.d.ts +2 -0
  129. package/dist/src/platforms/lifecycle.js +98 -25
  130. package/dist/src/platforms/lifecycle.js.map +1 -1
  131. package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
  132. package/dist/src/platforms/opencode-permission-config.js +253 -0
  133. package/dist/src/platforms/opencode-permission-config.js.map +1 -0
  134. package/dist/src/platforms/opencode-permissions.d.ts +39 -0
  135. package/dist/src/platforms/opencode-permissions.js +212 -0
  136. package/dist/src/platforms/opencode-permissions.js.map +1 -0
  137. package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
  138. package/dist/src/platforms/opencode-related-permissions.js +177 -0
  139. package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
  140. package/dist/src/platforms/permission-ownership.d.ts +89 -0
  141. package/dist/src/platforms/permission-ownership.js +543 -0
  142. package/dist/src/platforms/permission-ownership.js.map +1 -0
  143. package/dist/src/platforms/permission-sidecar.d.ts +70 -0
  144. package/dist/src/platforms/permission-sidecar.js +215 -0
  145. package/dist/src/platforms/permission-sidecar.js.map +1 -0
  146. package/dist/src/platforms/projection-code-extension.js +2 -1
  147. package/dist/src/platforms/projection-code-extension.js.map +1 -1
  148. package/dist/src/platforms/projection.js +127 -29
  149. package/dist/src/platforms/projection.js.map +1 -1
  150. package/dist/src/platforms/supplement-layout.d.ts +5 -1
  151. package/dist/src/platforms/supplement-layout.js +23 -1
  152. package/dist/src/platforms/supplement-layout.js.map +1 -1
  153. package/dist/src/platforms/supplement-state.d.ts +1 -1
  154. package/dist/src/platforms/supplement-state.js +18 -7
  155. package/dist/src/platforms/supplement-state.js.map +1 -1
  156. package/dist/src/portable/commands.js +1 -1
  157. package/dist/src/portable/commands.js.map +1 -1
  158. package/dist/src/portable/materializer.d.ts +4 -0
  159. package/dist/src/portable/materializer.js +8 -1
  160. package/dist/src/portable/materializer.js.map +1 -1
  161. package/dist/src/portable/recovery.d.ts +2 -0
  162. package/dist/src/portable/recovery.js +45 -8
  163. package/dist/src/portable/recovery.js.map +1 -1
  164. package/dist/src/recovery/coordinator.d.ts +3 -1
  165. package/dist/src/recovery/coordinator.js +101 -37
  166. package/dist/src/recovery/coordinator.js.map +1 -1
  167. package/dist/src/recovery/install-concurrency.js +3 -2
  168. package/dist/src/recovery/install-concurrency.js.map +1 -1
  169. package/dist/src/recovery/joint-coordinator.d.ts +7 -0
  170. package/dist/src/recovery/joint-coordinator.js +270 -64
  171. package/dist/src/recovery/joint-coordinator.js.map +1 -1
  172. package/dist/src/recovery/joint-demand.d.ts +14 -2
  173. package/dist/src/recovery/joint-demand.js +54 -7
  174. package/dist/src/recovery/joint-demand.js.map +1 -1
  175. package/dist/src/recovery/joint-install-execution.js +2 -1
  176. package/dist/src/recovery/joint-install-execution.js.map +1 -1
  177. package/dist/src/recovery/receipt.d.ts +15 -4
  178. package/dist/src/recovery/receipt.js +23 -0
  179. package/dist/src/recovery/receipt.js.map +1 -1
  180. package/dist/src/recovery/retirement.js +11 -17
  181. package/dist/src/recovery/retirement.js.map +1 -1
  182. package/dist/src/recovery/status.d.ts +20 -8
  183. package/dist/src/recovery/status.js +411 -91
  184. package/dist/src/recovery/status.js.map +1 -1
  185. package/dist/src/review/eval-source-input.d.ts +1 -0
  186. package/dist/src/review/eval-source-input.js +7 -1
  187. package/dist/src/review/eval-source-input.js.map +1 -1
  188. package/dist/src/review/platform-profile.js +2 -1
  189. package/dist/src/review/platform-profile.js.map +1 -1
  190. package/dist/src/review/review-selection.js +12 -5
  191. package/dist/src/review/review-selection.js.map +1 -1
  192. package/dist/src/review/skill-materialization.d.ts +2 -1
  193. package/dist/src/review/skill-materialization.js +45 -43
  194. package/dist/src/review/skill-materialization.js.map +1 -1
  195. package/dist/src/review/source-binding.js +5 -1
  196. package/dist/src/review/source-binding.js.map +1 -1
  197. package/dist/src/tui/console-app-v4.js +101 -57
  198. package/dist/src/tui/console-app-v4.js.map +1 -1
  199. package/dist/src/tui/controller-runtime.js +72 -7
  200. package/dist/src/tui/controller-runtime.js.map +1 -1
  201. package/dist/src/tui/controller.d.ts +6 -2
  202. package/dist/src/tui/controller.js +17 -4
  203. package/dist/src/tui/controller.js.map +1 -1
  204. package/dist/src/tui/deployment-view.d.ts +6 -3
  205. package/dist/src/tui/deployment-view.js +52 -10
  206. package/dist/src/tui/deployment-view.js.map +1 -1
  207. package/dist/src/tui/diagnostic-projection.d.ts +7 -1
  208. package/dist/src/tui/diagnostic-projection.js +55 -5
  209. package/dist/src/tui/diagnostic-projection.js.map +1 -1
  210. package/dist/src/tui/entity-cards.d.ts +2 -1
  211. package/dist/src/tui/entity-cards.js +34 -11
  212. package/dist/src/tui/entity-cards.js.map +1 -1
  213. package/dist/src/tui/glossary.js +5 -0
  214. package/dist/src/tui/glossary.js.map +1 -1
  215. package/dist/src/tui/model.js +2 -1
  216. package/dist/src/tui/model.js.map +1 -1
  217. package/dist/src/tui/operation-diagnostic-screens.js +3 -1
  218. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
  219. package/dist/src/tui/operation-history.d.ts +6 -0
  220. package/dist/src/tui/operation-history.js +20 -2
  221. package/dist/src/tui/operation-history.js.map +1 -1
  222. package/dist/src/tui/operation-review-planner.js +130 -70
  223. package/dist/src/tui/operation-review-planner.js.map +1 -1
  224. package/dist/src/tui/plugin-detail.d.ts +4 -1
  225. package/dist/src/tui/plugin-detail.js +9 -2
  226. package/dist/src/tui/plugin-detail.js.map +1 -1
  227. package/dist/src/tui/scoped-flow.js +34 -16
  228. package/dist/src/tui/scoped-flow.js.map +1 -1
  229. package/dist/src/tui/scoped-inventory.d.ts +6 -2
  230. package/dist/src/tui/scoped-inventory.js +29 -7
  231. package/dist/src/tui/scoped-inventory.js.map +1 -1
  232. package/dist/src/types.d.ts +10 -21
  233. package/dist/src/types.js.map +1 -1
  234. package/dist/src/utils/artifact-plan.d.ts +3 -36
  235. package/dist/src/utils/artifact-plan.js +16 -78
  236. package/dist/src/utils/artifact-plan.js.map +1 -1
  237. package/dist/src/utils/artifact-renderer.d.ts +1 -60
  238. package/dist/src/utils/artifact-renderer.js +31 -57
  239. package/dist/src/utils/artifact-renderer.js.map +1 -1
  240. package/dist/src/utils/artifact-request.d.ts +3 -26
  241. package/dist/src/utils/artifact-request.js +13 -36
  242. package/dist/src/utils/artifact-request.js.map +1 -1
  243. package/dist/src/utils/artifact-sources.d.ts +0 -8
  244. package/dist/src/utils/artifact-sources.js +0 -8
  245. package/dist/src/utils/artifact-sources.js.map +1 -1
  246. package/dist/src/utils/bundle-layout.js +2 -7
  247. package/dist/src/utils/bundle-layout.js.map +1 -1
  248. package/dist/src/utils/catalog-source-references.js +22 -3
  249. package/dist/src/utils/catalog-source-references.js.map +1 -1
  250. package/dist/src/utils/codex-native-observation.d.ts +6 -0
  251. package/dist/src/utils/codex-native-observation.js +32 -3
  252. package/dist/src/utils/codex-native-observation.js.map +1 -1
  253. package/dist/src/utils/component-command-preparation.d.ts +8 -11
  254. package/dist/src/utils/component-command-preparation.js +110 -210
  255. package/dist/src/utils/component-command-preparation.js.map +1 -1
  256. package/dist/src/utils/component-gap.d.ts +4 -0
  257. package/dist/src/utils/component-gap.js +20 -0
  258. package/dist/src/utils/component-gap.js.map +1 -0
  259. package/dist/src/utils/component-resources.js +2 -4
  260. package/dist/src/utils/component-resources.js.map +1 -1
  261. package/dist/src/utils/dynamic-skill-tree.js +2 -32
  262. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  263. package/dist/src/utils/managed-command-cli-review.d.ts +43 -0
  264. package/dist/src/utils/managed-command-cli-review.js +389 -0
  265. package/dist/src/utils/managed-command-cli-review.js.map +1 -0
  266. package/dist/src/utils/managed-command-closure.d.ts +14 -3
  267. package/dist/src/utils/managed-command-closure.js +144 -23
  268. package/dist/src/utils/managed-command-closure.js.map +1 -1
  269. package/dist/src/utils/managed-command-errors.d.ts +5 -0
  270. package/dist/src/utils/managed-command-errors.js +10 -0
  271. package/dist/src/utils/managed-command-errors.js.map +1 -0
  272. package/dist/src/utils/managed-command-materialization.d.ts +77 -113
  273. package/dist/src/utils/managed-command-materialization.js +324 -323
  274. package/dist/src/utils/managed-command-materialization.js.map +1 -1
  275. package/dist/src/utils/managed-command-preparation.d.ts +28 -65
  276. package/dist/src/utils/managed-command-preparation.js +33 -140
  277. package/dist/src/utils/managed-command-preparation.js.map +1 -1
  278. package/dist/src/utils/managed-command-review.d.ts +11 -4
  279. package/dist/src/utils/managed-command-review.js +33 -21
  280. package/dist/src/utils/managed-command-review.js.map +1 -1
  281. package/dist/src/utils/managed-command-runtime.d.ts +1 -0
  282. package/dist/src/utils/managed-command-runtime.js +6 -3
  283. package/dist/src/utils/managed-command-runtime.js.map +1 -1
  284. package/dist/src/utils/managed-command-snapshots.d.ts +17 -0
  285. package/dist/src/utils/managed-command-snapshots.js +84 -0
  286. package/dist/src/utils/managed-command-snapshots.js.map +1 -0
  287. package/dist/src/utils/managed-command-store.d.ts +65 -78
  288. package/dist/src/utils/managed-command-store.js +446 -383
  289. package/dist/src/utils/managed-command-store.js.map +1 -1
  290. package/dist/src/utils/multi-source-catalog.d.ts +2 -0
  291. package/dist/src/utils/multi-source-catalog.js +3 -1
  292. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  293. package/dist/src/utils/native-cli-interruption.d.ts +8 -0
  294. package/dist/src/utils/native-cli-interruption.js +65 -0
  295. package/dist/src/utils/native-cli-interruption.js.map +1 -0
  296. package/dist/src/utils/native-cli.d.ts +5 -0
  297. package/dist/src/utils/native-cli.js +166 -53
  298. package/dist/src/utils/native-cli.js.map +1 -1
  299. package/dist/src/utils/native-tool-context.d.ts +6 -3
  300. package/dist/src/utils/native-tool-context.js +3 -1
  301. package/dist/src/utils/native-tool-context.js.map +1 -1
  302. package/dist/src/utils/native-tool-review.d.ts +2 -12
  303. package/dist/src/utils/native-tool-review.js +6 -108
  304. package/dist/src/utils/native-tool-review.js.map +1 -1
  305. package/dist/src/utils/ownership.d.ts +8 -0
  306. package/dist/src/utils/ownership.js +17 -3
  307. package/dist/src/utils/ownership.js.map +1 -1
  308. package/dist/src/utils/package-content.d.ts +7 -0
  309. package/dist/src/utils/package-content.js +70 -0
  310. package/dist/src/utils/package-content.js.map +1 -0
  311. package/dist/src/utils/platform-empty-state.d.ts +32 -6
  312. package/dist/src/utils/platform-empty-state.js +146 -75
  313. package/dist/src/utils/platform-empty-state.js.map +1 -1
  314. package/dist/src/utils/plugin-config-command-apply.d.ts +33 -0
  315. package/dist/src/utils/plugin-config-command-apply.js +134 -0
  316. package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
  317. package/dist/src/utils/plugin-config-impact.d.ts +19 -9
  318. package/dist/src/utils/plugin-config-impact.js +56 -37
  319. package/dist/src/utils/plugin-config-impact.js.map +1 -1
  320. package/dist/src/utils/plugin-config-write.d.ts +19 -19
  321. package/dist/src/utils/plugin-config-write.js +196 -770
  322. package/dist/src/utils/plugin-config-write.js.map +1 -1
  323. package/dist/src/utils/plugin-scripts.js +19 -8
  324. package/dist/src/utils/plugin-scripts.js.map +1 -1
  325. package/dist/src/utils/process-tree.d.ts +1 -1
  326. package/dist/src/utils/process-tree.js +1 -1
  327. package/dist/src/utils/process-tree.js.map +1 -1
  328. package/dist/src/utils/rendered-contract.js +12 -6
  329. package/dist/src/utils/rendered-contract.js.map +1 -1
  330. package/dist/src/utils/skill-invocation-warning.d.ts +8 -3
  331. package/dist/src/utils/skill-invocation-warning.js +27 -1
  332. package/dist/src/utils/skill-invocation-warning.js.map +1 -1
  333. package/package.json +4 -3
  334. package/dist/src/platforms/managed-command-placement.d.ts +0 -8
  335. package/dist/src/platforms/managed-command-placement.js +0 -79
  336. package/dist/src/platforms/managed-command-placement.js.map +0 -1
  337. package/dist/src/utils/managed-command-evidence.d.ts +0 -7
  338. package/dist/src/utils/managed-command-evidence.js +0 -10
  339. package/dist/src/utils/managed-command-evidence.js.map +0 -1
@@ -4,12 +4,14 @@ import { mapInstallReads, runInstallTasks } from '../recovery/install-concurrenc
4
4
  import { withNativeObservationBatch } from '../platforms/inspection-query.js';
5
5
  import { RebuildInterruptedError, recoveryInterruptionCode } from '../recovery/interruption.js';
6
6
  import { inventoryRecoveryDiagnostic } from '../utils/inventory-recovery-diagnostic.js';
7
- import { withNativeToolRemovalImpact } from '../utils/native-tool-review.js';
8
7
  import fs from 'fs-extra';
9
8
  import { NATIVE_PLATFORM_TARGETS } from '@lesliechan721/aw-plugin-core/manifest';
10
9
  import { nativeInstallResources } from './rebuild-platform-integration.js';
10
+ import { isPermissionHost } from '../platforms/host-permission-policy.js';
11
+ import { missingPermissionOwnershipWarning, pendingRelatedProjectNotices, relatedProjectPermissionNotices, reviewPermissionRemovals, updateHostPermissions } from '../platforms/permission-ownership.js';
12
+ import { permissionConflict, permissionFailureNotice } from '../platforms/permission-sidecar.js';
11
13
  import { resolvePlatformConfigRoot } from '../platforms/discovery.js';
12
- import { getDeploymentLayout } from '../platforms/layout.js';
14
+ import { getDeploymentLayout, scopedPermissionPath } from '../platforms/layout.js';
13
15
  import { createNoopDebugLogger } from '../output/debug-log.js';
14
16
  import { createNoopReporter } from '../output/reporter.js';
15
17
  import { getCodexOperationRequirement, probeAgentVersion } from '../utils/agent-version.js';
@@ -27,11 +29,11 @@ import { createCodexNativeObservationSession } from '../utils/codex-native-obser
27
29
  import { isCanonicalCodexMarketplaceRegistration } from '../utils/codex-shared-native.js';
28
30
  import { analyzeCodexSurface } from '../utils/codex-surface-analysis.js';
29
31
  import { getNamespacedMarketplaceName, } from '../utils/local-marketplace.js';
30
- import { discoverRetainedManagedCommandPackages, retainedManagedCommandPackageResult } from '../utils/managed-command-materialization.js';
32
+ import { commandPackageProviderSatisfied, discoverRetainedManagedCommandPackages, retainedManagedCommandPackageResult } from './lifecycle-command-package.js';
31
33
  import { assertStrictSemVer, checkAwCapabilitySupport, readPluginManifest } from '../utils/manifest.js';
32
34
  import { formatPluginId, parsePluginId, planPluginSelectorSourceIds, preflightDesiredArtifactCollisions, withResolvedMultiSourceCatalog, } from '../utils/multi-source-catalog.js';
33
35
  import { getDefaultNativeCliRunner, } from '../utils/native-cli.js';
34
- import { inspectOwnedComponents, parseOwnedTextHeader, readSkillOwnerMarker, SKILL_OWNER_MARKER, } from '../utils/ownership.js';
36
+ import { inspectOwnedComponents, parseOwnedTextHeader, parseSharedOwnerToken, readSkillOwnerMarker, SKILL_OWNER_MARKER, } from '../utils/ownership.js';
35
37
  import { resolveAwHome, resolveCliPackageRoot, resolveCodexPaths } from '../utils/paths.js';
36
38
  import { supportsPlatform } from '../utils/platform-support.js';
37
39
  import { pluginConfigTargetRenderScopes } from '../utils/plugin-config-impact.js';
@@ -312,6 +314,7 @@ async function assertClaudeVersion(options) {
312
314
  return;
313
315
  const failures = [];
314
316
  const result = await probeAgentVersion('claude', {
317
+ cache: false,
315
318
  cwd: options.cwd,
316
319
  env: options.env,
317
320
  runner: options.runtime.nativeCliRunner,
@@ -333,10 +336,14 @@ async function resolveRequestedNames(options) {
333
336
  }
334
337
  async function runSingleSourceRebuildCommand(options) {
335
338
  const runtime = {
339
+ invocationCwd: options.runtime?.invocationCwd,
336
340
  referencePlugins: options.runtime?.referencePlugins,
337
341
  recoveryCandidates: options.runtime?.recoveryCandidates,
338
342
  sharedReferenceView: options.runtime?.executionInput?.requirements.sharedReferenceView ?? options.runtime?.sharedReferenceView,
339
343
  platformRebuildSession: options.runtime?.platformRebuildSession,
344
+ commandPackagePlatforms: options.runtime?.commandPackagePlatforms,
345
+ retainCommandPackages: options.runtime?.retainCommandPackages,
346
+ configApply: options.runtime?.configApply ?? !!options.runtime?.configApplyPackages,
340
347
  packagePreparationCache: options.runtime?.packagePreparationCache,
341
348
  preparedArtifactRenderResults: options.runtime?.preparedArtifactRenderResults,
342
349
  interruption: options.runtime?.interruption,
@@ -610,6 +617,7 @@ function mergeRebuildCommandResults(results) {
610
617
  }
611
618
  function hasRebuildMutation(result) {
612
619
  return result.removed.length > 0 || result.quarantined.length > 0
620
+ || result.cleanupMutation !== undefined
613
621
  || (result.deploymentReceipts ?? []).some((receipt) => receipt.effects.some((effect) => effect.mutation === 'confirmed' || effect.status === 'unknown' && effect.mutation === 'possible'))
614
622
  || result.actions.some((action) => action.status === 'succeeded'
615
623
  && (action.name === 'native.write' || action.name === 'artifacts.write'));
@@ -664,7 +672,6 @@ function createRebuildOperationPlan(options) {
664
672
  ];
665
673
  return createOperationPlan({
666
674
  deploymentExclusions: options.deploymentExclusions,
667
- nativeToolChanges: options.nativeToolChanges,
668
675
  ...(options.deploymentPlans ? { deploymentPlans: options.deploymentPlans } : {}),
669
676
  intentChanges: [],
670
677
  actions,
@@ -857,6 +864,7 @@ function cleanupLocatorPaths(component) {
857
864
  const locator = component.locator;
858
865
  switch (locator.kind) {
859
866
  case 'cursor-workspace-hook': return [locator.hooksPath];
867
+ case 'host-permissions':
860
868
  case 'claude-permissions': return [locator.settingsPath];
861
869
  case 'codex-instruction': return [locator.configPath];
862
870
  case 'codex-activation': return [locator.configPath];
@@ -1020,14 +1028,43 @@ async function prepareOfflineNativeCleanup(options) {
1020
1028
  }
1021
1029
  }
1022
1030
  await integration.sealMarketplaceGenerations([...targets.values()]);
1023
- return { integration, targets, warnings, deploymentExclusions };
1031
+ const locators = options.evidence.flatMap((target) => target.plan.actions.flatMap(({ action, component }) => action === 'removeOwnedOutput' && component?.kind === 'shared-config' && component.locator.kind === 'host-permissions'
1032
+ ? [component.locator] : []));
1033
+ const invocationCwd = options.runtime?.invocationCwd ?? options.cwd;
1034
+ const permissionRemovals = await reviewPermissionRemovals({ cwd: options.cwd, env: options.env, invocationCwd }, locators);
1035
+ return { integration, targets, warnings, deploymentExclusions, permissionRemovals, invocationCwd };
1024
1036
  }
1025
1037
  async function cleanupOfflineOwnedComponents(options) {
1026
1038
  const results = [];
1027
1039
  const warnings = [...options.nativePreparation?.warnings ?? []];
1028
1040
  const nativeCliRunner = options.nativeCliRunner ?? getDefaultNativeCliRunner();
1029
1041
  const codexManager = options.codexManager;
1042
+ const advanced = new Map();
1043
+ const relatedProjectBatch = { writes: new Map(), pending: new Map() };
1044
+ const permissionNotices = [];
1045
+ let cleanupMutation;
1030
1046
  const context = {
1047
+ removeHostPermissions: async (locator) => {
1048
+ const review = options.nativePreparation?.permissionRemovals.get(locator.ownerKey);
1049
+ if (!review?.batch)
1050
+ throw permissionConflict();
1051
+ const expected = advanced.get(locator.settingsPath) ?? review.fingerprint;
1052
+ try {
1053
+ await updateHostPermissions({ env: options.env, cwd: options.cwd, invocationCwd: options.nativePreparation?.invocationCwd }, locator, undefined, (_previous, current, target = locator.settingsPath) => advanced.set(target, current), review.batch, (notices) => permissionNotices.push(...notices), expected, locator.platform === 'opencode' && !locator.projectRoot ? relatedProjectBatch : undefined);
1054
+ }
1055
+ catch (error) {
1056
+ const notices = relatedProjectPermissionNotices(error, {
1057
+ pluginId: parseSharedOwnerToken(locator.ownerKey)?.pluginId, target: locator.platform,
1058
+ scope: locator.projectRoot ? 'project' : 'user',
1059
+ });
1060
+ permissionNotices.push(...notices);
1061
+ if (notices.length && error && typeof error === 'object' && 'mutation' in error) {
1062
+ if (error.mutation === 'confirmed' || error.mutation === 'possible' && cleanupMutation !== 'confirmed')
1063
+ cleanupMutation = error.mutation;
1064
+ }
1065
+ throw error;
1066
+ }
1067
+ },
1031
1068
  env: options.env,
1032
1069
  nativeCliRunner,
1033
1070
  ...(codexManager ? { codexManager } : {}),
@@ -1037,6 +1074,8 @@ async function cleanupOfflineOwnedComponents(options) {
1037
1074
  };
1038
1075
  const integration = createRebuildIntegration({ context });
1039
1076
  for (const target of options.targets) {
1077
+ permissionNotices.length = 0;
1078
+ cleanupMutation = undefined;
1040
1079
  try {
1041
1080
  const inventoryErrors = (options.inventoryErrors ?? []).filter((error) => error.relevance.global || ((error.relevance.sourceId === undefined || error.relevance.sourceId === target.sourceId)
1042
1081
  && (error.relevance.pluginName === undefined || error.relevance.pluginName === target.pluginName)
@@ -1047,6 +1086,10 @@ async function cleanupOfflineOwnedComponents(options) {
1047
1086
  && candidate.platform === target.platform
1048
1087
  && candidate.scope === target.scope);
1049
1088
  const nativeTarget = options.nativePreparation?.targets.get(offlineCleanupKey(target));
1089
+ const cleanupContext = { cwd: options.cwd, env: options.env };
1090
+ const permissionNotice = !nativeTarget && isPermissionHost(target.platform) && (target.platform !== 'antigravity' || target.scope === 'user')
1091
+ ? await missingPermissionOwnershipWarning(cleanupContext, target.pluginId, target.scope, await scopedPermissionPath(cleanupContext, target.platform, target.scope === 'project' ? { kind: 'project', projectRoot: resolveRepoRootSync(options.cwd) } : { kind: 'user' }), target.platform)
1092
+ : undefined;
1050
1093
  const nativeComponents = nativeTarget?.ownedComponents ?? [];
1051
1094
  const nativeOwns = (component) => nativeComponents.some((item) => 'path' in component && 'path' in item ? component.path === item.path
1052
1095
  : component.kind === 'shared-config' && item.kind === 'shared-config'
@@ -1252,10 +1295,23 @@ async function cleanupOfflineOwnedComponents(options) {
1252
1295
  }
1253
1296
  if (!finalResult.deploymentExclusions?.length)
1254
1297
  finalResult.deploymentExclusions = options.nativePreparation?.deploymentExclusions.filter((entry) => entry.pluginId === target.pluginId && entry.platform === target.platform && entry.scope.kind === target.scope);
1298
+ const cleanupNotices = finalResult.failures.flatMap((failure) => {
1299
+ if (!failure.label)
1300
+ return [];
1301
+ const notice = permissionFailureNotice(failure.operationDiagnostic?.code, failure.label, { pluginId: target.pluginId, target: target.platform, scope: target.scope });
1302
+ return notice ? [notice] : [];
1303
+ });
1304
+ if (permissionNotice)
1305
+ cleanupNotices.push(permissionNotice);
1306
+ cleanupNotices.push(...permissionNotices);
1307
+ if (cleanupNotices.length)
1308
+ finalResult.cleanupNotices = [...finalResult.cleanupNotices ?? [], ...cleanupNotices];
1309
+ if (cleanupMutation)
1310
+ finalResult.cleanupMutation = cleanupMutation;
1255
1311
  results.push(finalResult);
1256
1312
  }
1257
1313
  catch (error) {
1258
- results.push(failedResult('cleanup', {
1314
+ const failed = failedResult('cleanup', {
1259
1315
  pluginId: target.pluginId,
1260
1316
  pluginName: target.pluginName,
1261
1317
  sourceId: target.sourceId,
@@ -1264,9 +1320,20 @@ async function cleanupOfflineOwnedComponents(options) {
1264
1320
  platform: target.platform,
1265
1321
  scope: target.scope,
1266
1322
  cwd: options.cwd,
1267
- }, error instanceof Error ? error.message : String(error), 'cleanup.owned'));
1323
+ }, error instanceof Error ? error.message : String(error), 'cleanup.owned');
1324
+ if (permissionNotices.length)
1325
+ failed.cleanupNotices = [...permissionNotices];
1326
+ if (cleanupMutation)
1327
+ failed.cleanupMutation = cleanupMutation;
1328
+ results.push(failed);
1268
1329
  }
1269
1330
  }
1331
+ for (const notice of pendingRelatedProjectNotices(relatedProjectBatch, false)) {
1332
+ const result = results.find((entry) => entry.target.platform === 'opencode' && entry.target.scope === 'user'
1333
+ && entry.target.pluginId === notice.subject?.pluginId);
1334
+ if (result)
1335
+ (result.cleanupNotices ??= []).push(notice);
1336
+ }
1270
1337
  const obsoleteContracts = path.join(resolveAwHome(options.env), 'installation-contracts');
1271
1338
  try {
1272
1339
  await (options.removeObsoleteInstallationContracts ?? fs.remove)(obsoleteContracts);
@@ -1301,7 +1368,7 @@ async function previewOfflineOwnedComponents(options) {
1301
1368
  : []));
1302
1369
  if (options.evidence) {
1303
1370
  preview.offlineCleanupPlans = options.evidence;
1304
- preview.operationPlan = await withNativeToolRemovalImpact(createOfflineCleanupOperationPlan(options.evidence), options.env);
1371
+ preview.operationPlan = createOfflineCleanupOperationPlan(options.evidence);
1305
1372
  }
1306
1373
  await options.onPreviewStage?.('dependencyPlan');
1307
1374
  return preview;
@@ -1320,7 +1387,6 @@ function createOfflineCleanupOperationPlan(evidence, requirements, warnings = []
1320
1387
  });
1321
1388
  return createOperationPlan({
1322
1389
  deploymentExclusions: nativePreparation?.deploymentExclusions ?? [],
1323
- nativeToolChanges: nativePreparation ? [...nativePreparation.targets.values()].flatMap((target) => target.nativeToolChanges ?? []) : [],
1324
1390
  ...(nativePreparation ? { deploymentPlans: [...nativePreparation.targets.values()].flatMap((target) => target.platformDeployment?.plans ?? []) } : {}),
1325
1391
  intentChanges: [],
1326
1392
  actions: [...retainedPackages, ...evidence.flatMap((target) => reviewedActions(target).flatMap((action) => action.action === 'removeOwnedOutput'
@@ -1332,6 +1398,8 @@ function createOfflineCleanupOperationPlan(evidence, requirements, warnings = []
1332
1398
  path: action.kind === 'namespacedOwner' && path.basename(action.target) === SKILL_OWNER_MARKER
1333
1399
  ? path.dirname(action.target) : action.target,
1334
1400
  ownerFingerprint: target.targetFingerprint,
1401
+ ...(action.component?.kind === 'shared-config' && action.component.locator.kind === 'host-permissions'
1402
+ ? { permissionRemoval: nativePreparation?.permissionRemovals.get(action.component.locator.ownerKey) } : {}),
1335
1403
  }]
1336
1404
  : action.activationScope === target.scope
1337
1405
  ? [{
@@ -1714,13 +1782,11 @@ export async function executeRemovedPluginOutputCleanup(options) {
1714
1782
  const selected = options.selectedTargets.filter((target) => target.pluginId === options.target.pluginId && target.scope === options.context.scope);
1715
1783
  const retainedPackages = await discoverRetainedManagedCommandPackages({
1716
1784
  selectors: [{ sourceId: options.target.sourceId, pluginName: options.target.pluginName }],
1717
- scope: options.context.scope,
1718
- cwd: options.context.executionCwd,
1719
1785
  env: options.context.env,
1720
1786
  });
1721
1787
  const retainedActions = retainedPackages.map((entry) => ({
1722
1788
  ...entry, kind: 'retainManagedCommandPackage', pluginId: options.target.pluginId,
1723
- scope: entry.producer.scope,
1789
+ scope: 'user',
1724
1790
  }));
1725
1791
  const withRetainedPackages = (result, operationPlan = createOfflineCleanupOperationPlan([], undefined, [], retainedActions)) => {
1726
1792
  result.operationPlan = operationPlan;
@@ -1777,7 +1843,7 @@ export async function executeRemovedPluginOutputCleanup(options) {
1777
1843
  }));
1778
1844
  const nativePreparation = await prepareOfflineNativeCleanup({ evidence, cwd: options.context.executionCwd,
1779
1845
  env: options.context.env, runtime: options.runtime });
1780
- const operationPlan = await withNativeToolRemovalImpact(createOfflineCleanupOperationPlan(evidence, undefined, [], retainedActions, nativePreparation), options.context.env);
1846
+ const operationPlan = createOfflineCleanupOperationPlan(evidence, undefined, [], retainedActions, nativePreparation);
1781
1847
  if (options.runtime?.expectedPlanFingerprint) {
1782
1848
  assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
1783
1849
  }
@@ -1841,9 +1907,9 @@ async function runRebuildCommandInSession(options) {
1841
1907
  .catch(() => undefined)
1842
1908
  : undefined;
1843
1909
  const retainedPackages = options.command === 'cleanup'
1844
- ? await discoverRetainedManagedCommandPackages({ selectors: retainSelectors.map((selector) => ({ ...selector, sourceId: selector.sourceId ?? primarySourceId })), all: options.all, scope: options.commandOptions.scope, cwd: options.commandOptions.cwd, env: runtimeEnv })
1910
+ ? await discoverRetainedManagedCommandPackages({ selectors: retainSelectors.map((selector) => ({ ...selector, sourceId: selector.sourceId ?? primarySourceId })), all: options.all, env: runtimeEnv })
1845
1911
  : [];
1846
- const retainedPackageActions = retainedPackages.map((entry) => ({ ...entry, kind: 'retainManagedCommandPackage', pluginId: `${entry.producer.sourceId}/${entry.producer.pluginName}`, scope: entry.producer.scope }));
1912
+ const retainedPackageActions = retainedPackages.map((entry) => ({ ...entry, kind: 'retainManagedCommandPackage', pluginId: `${entry.producer.sourceId}/${entry.producer.pluginName}`, scope: 'user' }));
1847
1913
  const readInventory = options.runtime?.inventoryCatalogSourceReferences
1848
1914
  ?? inventoryCatalogSourceReferences;
1849
1915
  const inventoryRequest = { cwd: options.commandOptions.cwd, env: runtimeEnv, scope: options.commandOptions.scope };
@@ -2036,7 +2102,7 @@ async function runRebuildCommandInSession(options) {
2036
2102
  && cleanupSelectionErrors.length === 0
2037
2103
  && legacyLiveTargets.length === 0) {
2038
2104
  const result = mergeRebuildCommandResults([]);
2039
- const operationPlan = await withNativeToolRemovalImpact(createOfflineCleanupOperationPlan([], { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, []), ...cleanupUnavailableWarnings], retainedPackageActions), runtimeEnv);
2105
+ const operationPlan = createOfflineCleanupOperationPlan([], { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, []), ...cleanupUnavailableWarnings], retainedPackageActions);
2040
2106
  if (options.runtime?.expectedPlanFingerprint) {
2041
2107
  assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
2042
2108
  }
@@ -2128,7 +2194,7 @@ async function runRebuildCommandInSession(options) {
2128
2194
  && candidate.platform === target.platform
2129
2195
  && candidate.scope === target.scope)
2130
2196
  ?? intentOnlyOfflineCleanupEvidence(target));
2131
- const operationPlan = await withNativeToolRemovalImpact(createOfflineCleanupOperationPlan(forceEvidence, { scope: options.commandOptions.scope, view: cleanupRequirements }, cleanupInventoryWarnings(cleanupInventory, forceCleanupTargets), retainedPackageActions), runtimeEnv);
2197
+ const operationPlan = createOfflineCleanupOperationPlan(forceEvidence, { scope: options.commandOptions.scope, view: cleanupRequirements }, cleanupInventoryWarnings(cleanupInventory, forceCleanupTargets), retainedPackageActions);
2132
2198
  if (options.runtime?.expectedPlanFingerprint) {
2133
2199
  assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
2134
2200
  }
@@ -2229,7 +2295,7 @@ async function runRebuildCommandInSession(options) {
2229
2295
  }
2230
2296
  if (cleanupTargets.length === 0) {
2231
2297
  const result = mergeRebuildCommandResults([]);
2232
- const operationPlan = await withNativeToolRemovalImpact(createOfflineCleanupOperationPlan([], { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, []), ...cleanupUnavailableWarnings], retainedPackageActions), runtimeEnv);
2298
+ const operationPlan = createOfflineCleanupOperationPlan([], { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, []), ...cleanupUnavailableWarnings], retainedPackageActions);
2233
2299
  if (options.runtime?.expectedPlanFingerprint) {
2234
2300
  assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
2235
2301
  }
@@ -2271,7 +2337,7 @@ async function runRebuildCommandInSession(options) {
2271
2337
  ?? intentOnlyOfflineCleanupEvidence(target));
2272
2338
  const nativePreparation = await prepareOfflineNativeCleanup({ evidence, cwd: options.commandOptions.cwd,
2273
2339
  env: runtimeEnv, runtime: options.runtime });
2274
- const operationPlan = await withNativeToolRemovalImpact(createOfflineCleanupOperationPlan(evidence, { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, cleanupTargets), ...cleanupUnavailableWarnings], retainedPackageActions, nativePreparation), runtimeEnv);
2340
+ const operationPlan = createOfflineCleanupOperationPlan(evidence, { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, cleanupTargets), ...cleanupUnavailableWarnings], retainedPackageActions, nativePreparation);
2275
2341
  if (options.runtime?.expectedPlanFingerprint) {
2276
2342
  assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
2277
2343
  }
@@ -2751,10 +2817,14 @@ async function runRebuildCommandInSession(options) {
2751
2817
  }
2752
2818
  }
2753
2819
  const executionContext = {
2820
+ invocationCwd: options.runtime?.invocationCwd,
2754
2821
  recoveryCandidates: options.runtime?.recoveryCandidates,
2755
2822
  sharedReferenceView: options.runtime?.executionInput?.requirements.sharedReferenceView ?? options.runtime?.sharedReferenceView,
2756
2823
  platformRebuildSession: options.runtime?.platformRebuildSession,
2757
2824
  batchInstallPlatform: options.runtime?.batchInstallPlatform,
2825
+ commandPackagePlatforms: options.runtime?.commandPackagePlatforms,
2826
+ retainCommandPackages: options.runtime?.retainCommandPackages,
2827
+ configApply: options.runtime?.configApply ?? !!options.runtime?.configApplyPackages,
2758
2828
  packagePreparationCache: options.runtime?.packagePreparationCache,
2759
2829
  preparedArtifactRenderResults: options.runtime?.preparedArtifactRenderResults,
2760
2830
  interruption: options.runtime?.interruption,
@@ -3006,6 +3076,15 @@ async function runRebuildCommandInSession(options) {
3006
3076
  : requestedMethod === 'reinstall' ? 'reinstall' : 'install'
3007
3077
  : requestedMethod === 'reinstall' ? 'reinstall' : 'install';
3008
3078
  let errorCode;
3079
+ // Grok rules can be complete with an empty native package slot. Let
3080
+ // component preparation determine whether the current source needs a package.
3081
+ const grokRulesWithoutPackage = platform === 'grok' && requestedMethod === 'sync'
3082
+ && requestedInspection.platformObservations.length > 0
3083
+ && requestedInspection.platformObservations.every(({ observation }) => observation.package === 'absent'
3084
+ && ['absent', 'not-applicable'].includes(observation.registration))
3085
+ && requestedInspection.components.some(({ component, state }) => component.kind === 'owned-text-file' && state === 'present')
3086
+ && requestedInspection.components.every(({ component, state }) => state === 'present'
3087
+ || component.kind === 'owned-directory' && state === 'absent');
3009
3088
  if (!dependencyEnabled && platform === 'codex'
3010
3089
  && relation === 'requested'
3011
3090
  && !uninstallForce
@@ -3029,6 +3108,7 @@ async function runRebuildCommandInSession(options) {
3029
3108
  && (requestedInspection.state === 'error'
3030
3109
  || (requestedInspection.state === 'partial'
3031
3110
  && !activationOnly
3111
+ && !grokRulesWithoutPackage
3032
3112
  && platform !== 'codex'
3033
3113
  && requestedMethod !== 'reinstall'
3034
3114
  && options.command !== 'cleanup'))) {
@@ -3093,7 +3173,9 @@ async function runRebuildCommandInSession(options) {
3093
3173
  state = resolvedInspection.state;
3094
3174
  errorCode ??= 'dependencyNotReady';
3095
3175
  }
3096
- if (!planOptions?.skipConfigValidation
3176
+ const configPackageBlocker = options.runtime?.configApplyPackages?.targets.find((target) => target.pluginId === entry.pluginId && target.platforms.includes(platform))?.blocker;
3177
+ if (!configPackageBlocker
3178
+ && !planOptions?.skipConfigValidation
3097
3179
  && entry.plugin.manifest.config?.fields
3098
3180
  && (action === 'install' || action === 'reinstall')) {
3099
3181
  const configs = await Promise.all(pluginConfigTargetRenderScopes(entry.plugin, {
@@ -3126,6 +3208,10 @@ async function runRebuildCommandInSession(options) {
3126
3208
  action = 'block';
3127
3209
  errorCode = surface?.errorCode ?? 'codexNativeKindUnsupported';
3128
3210
  }
3211
+ if (configPackageBlocker) {
3212
+ action = 'block';
3213
+ errorCode = configPackageBlocker.code;
3214
+ }
3129
3215
  if (errorCode)
3130
3216
  blockingTargets.set(`${entry.pluginId}\0${platform}\0${requestedScope}`, errorCode);
3131
3217
  targets.push({
@@ -3159,7 +3245,7 @@ async function runRebuildCommandInSession(options) {
3159
3245
  sourceId: entry.source.sourceId,
3160
3246
  pluginName: dependency,
3161
3247
  });
3162
- return ['codex', 'claude'].flatMap((platform) => placementNodes.some((node) => node.pluginId === entry.pluginId && node.platform === platform)
3248
+ return [...closureEntriesByPlatform.keys()].flatMap((platform) => placementNodes.some((node) => node.pluginId === entry.pluginId && node.platform === platform)
3163
3249
  && placementNodes.some((node) => node.pluginId === dependencyId && node.platform === platform)
3164
3250
  ? [{ from: entry.pluginId, to: dependencyId, platform }]
3165
3251
  : []);
@@ -3443,8 +3529,8 @@ async function runRebuildCommandInSession(options) {
3443
3529
  ? `native:${component.pluginId}`
3444
3530
  : component.locator.kind === 'cursor-workspace-hook'
3445
3531
  ? `shared:cursor:${path.resolve(component.locator.hooksPath)}:${component.locator.ownerKey}`
3446
- : component.locator.kind === 'claude-permissions'
3447
- ? `shared:claude:${path.resolve(component.locator.settingsPath)}:${component.locator.ownerKey}`
3532
+ : component.locator.kind === 'claude-permissions' || component.locator.kind === 'host-permissions'
3533
+ ? `shared:${platform}:${path.resolve(component.locator.settingsPath)}:${component.locator.ownerKey}`
3448
3534
  : `shared:${component.label}`),
3449
3535
  };
3450
3536
  return { key, target, collision };
@@ -3582,18 +3668,17 @@ async function runRebuildCommandInSession(options) {
3582
3668
  }));
3583
3669
  }
3584
3670
  preview.nativeFootprints = preparedNativeFootprints([...previewPreparation.preparedTargets.values()].map((entry) => entry.target));
3585
- preview.operationPlan = await withNativeToolRemovalImpact(createRebuildOperationPlan({
3671
+ preview.operationPlan = createRebuildOperationPlan({
3586
3672
  dependencyPlan: initialPlan,
3587
3673
  codexPlans: initialCodexPlans,
3588
3674
  targetActions: previewPreparation.targetActions,
3589
3675
  deploymentPlans: previewPreparation.deploymentPlans,
3590
3676
  deploymentExclusions: previewPreparation.deploymentExclusions,
3591
- nativeToolChanges: [...previewPreparation.preparedTargets.values()].flatMap((entry) => entry.target.nativeToolChanges ?? []),
3592
3677
  catalogSources: catalog.sources.flatMap((source) => source.resolution ? [source.resolution] : []),
3593
3678
  requirements,
3594
3679
  scope: options.commandOptions.scope,
3595
3680
  configDigests: previewPreparation.configDigests,
3596
- }), runtimeEnv);
3681
+ });
3597
3682
  if (initialCodexPlans.length > 0)
3598
3683
  preview.codexReconcilePlans = initialCodexPlans;
3599
3684
  if (initialCodexPlans.some((plan) => plan.sharedNativeActions.some((action) => action.action === 'install' || action.action === 'replace' || action.action === 'repair')
@@ -3642,18 +3727,17 @@ async function runRebuildCommandInSession(options) {
3642
3727
  || action.action === 'repair'));
3643
3728
  let lockedCodexPlans = provisionalLockedCodexPlans;
3644
3729
  let lockedPreparation = await prepareRenderedTargets(lockedPlan, lockedCodexPlans, true);
3645
- let lockedOperationPlan = await withNativeToolRemovalImpact(createRebuildOperationPlan({
3730
+ let lockedOperationPlan = createRebuildOperationPlan({
3646
3731
  dependencyPlan: lockedPlan,
3647
3732
  codexPlans: lockedCodexPlans,
3648
3733
  targetActions: lockedPreparation.targetActions,
3649
3734
  deploymentPlans: lockedPreparation.deploymentPlans,
3650
3735
  deploymentExclusions: lockedPreparation.deploymentExclusions,
3651
- nativeToolChanges: [...lockedPreparation.preparedTargets.values()].flatMap((entry) => entry.target.nativeToolChanges ?? []),
3652
3736
  catalogSources: catalog.sources.flatMap((source) => source.resolution ? [source.resolution] : []),
3653
3737
  requirements,
3654
3738
  scope: options.commandOptions.scope,
3655
3739
  configDigests: lockedPreparation.configDigests,
3656
- }), runtimeEnv);
3740
+ });
3657
3741
  if (options.runtime?.expectedPlanFingerprint) {
3658
3742
  try {
3659
3743
  assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, lockedOperationPlan);
@@ -3941,18 +4025,17 @@ async function runRebuildCommandInSession(options) {
3941
4025
  });
3942
4026
  lockedPreparation.integration.setNativeMarketplaceEligibleTargets(eligibleTargets);
3943
4027
  }
3944
- lockedOperationPlan = await withNativeToolRemovalImpact(createRebuildOperationPlan({
4028
+ lockedOperationPlan = createRebuildOperationPlan({
3945
4029
  dependencyPlan: lockedPlan,
3946
4030
  codexPlans: lockedCodexPlans,
3947
4031
  targetActions: lockedPreparation.targetActions,
3948
4032
  deploymentPlans: lockedPreparation.deploymentPlans,
3949
4033
  deploymentExclusions: lockedPreparation.deploymentExclusions,
3950
- nativeToolChanges: [...lockedPreparation.preparedTargets.values()].flatMap((entry) => entry.target.nativeToolChanges ?? []),
3951
4034
  catalogSources: catalog.sources.flatMap((source) => source.resolution ? [source.resolution] : []),
3952
4035
  requirements,
3953
4036
  scope: options.commandOptions.scope,
3954
4037
  configDigests: lockedPreparation.configDigests,
3955
- }), runtimeEnv);
4038
+ });
3956
4039
  if (options.runtime?.expectedPlanFingerprint) {
3957
4040
  assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, lockedOperationPlan);
3958
4041
  }
@@ -4089,9 +4172,14 @@ async function runRebuildCommandInSession(options) {
4089
4172
  const preparedTargets = lockedPreparation.preparedTargets;
4090
4173
  const preparedTargetErrors = lockedPreparation.preparedTargetErrors;
4091
4174
  const removalRequiredConsumers = new Map();
4175
+ // A wider dependency that execution keeps cannot withdraw consumer output.
4176
+ const consumerCheckSelections = options.command === 'sync' ? executionSelections.filter((selection) => {
4177
+ const planned = planTargetFor(lockedPlan, selection);
4178
+ return !planned || !isHealthyWiderDependency(planned);
4179
+ }) : executionSelections;
4092
4180
  // Sync checks live references for Codex/Claude providers. Without a possible
4093
4181
  // consumer the second inventory cannot add a dependency to this plan.
4094
- const syncNeedsConsumerCheck = options.command === 'sync' && executionSelections.some(({ platform, entry }) => (platform === 'codex' || platform === 'claude') && availableEntries.some((candidate) => candidate.source.sourceId === entry.source.sourceId && candidate.entry.dependencies.includes(entry.plugin.manifest.name)));
4182
+ const syncNeedsConsumerCheck = options.command === 'sync' && consumerCheckSelections.some(({ platform, entry }) => (platform === 'codex' || platform === 'claude') && availableEntries.some((candidate) => candidate.source.sourceId === entry.source.sourceId && candidate.entry.dependencies.includes(entry.plugin.manifest.name)));
4095
4183
  if ((options.command === 'cleanup' && !cleanupForce)
4096
4184
  || (options.command === 'uninstall' && !uninstallForce)
4097
4185
  || syncNeedsConsumerCheck) {
@@ -4174,7 +4262,7 @@ async function runRebuildCommandInSession(options) {
4174
4262
  projectKey: reference.projectKey ?? null,
4175
4263
  }]];
4176
4264
  })).values()];
4177
- for (const dependencyTarget of executionSelections) {
4265
+ for (const dependencyTarget of consumerCheckSelections) {
4178
4266
  const dependencyPluginName = dependencyTarget.entry.plugin.manifest.name;
4179
4267
  for (const consumer of currentConsumerCandidates) {
4180
4268
  if (consumer.entry.source.sourceId
@@ -4448,7 +4536,7 @@ async function runRebuildCommandInSession(options) {
4448
4536
  try {
4449
4537
  const commands = await nativeTargetExecution.beforeApply(identity);
4450
4538
  recordTargetCommands(commands);
4451
- if (commands.some((result) => result.state !== 'completed')) {
4539
+ if (!commands.every(commandPackageProviderSatisfied)) {
4452
4540
  packageFailure = 'commandPackageProviderNotSatisfied';
4453
4541
  }
4454
4542
  }
@@ -4459,7 +4547,7 @@ async function runRebuildCommandInSession(options) {
4459
4547
  recordTargetCommands(nativeTargetExecution.blocked?.(identity, packageFailure) ?? []);
4460
4548
  }
4461
4549
  if (packageFailure) {
4462
- const result = failedResult(requestedMethod, identity, `${packageFailure}: ${entry.pluginId} requires a completed command package provider.`);
4550
+ const result = failedResult(requestedMethod, identity, `${packageFailure}: ${entry.pluginId} requires a published command package.`);
4463
4551
  record({
4464
4552
  platforms: [platform], plugins: [], warnings: [], rebuildResults: [result],
4465
4553
  targetResults: [{ ...toTargetResult(result), action: planned.action }],
@@ -4932,6 +5020,13 @@ async function runRebuildCommandInSession(options) {
4932
5020
  }
4933
5021
  };
4934
5022
  const privatePackages = [];
5023
+ const reportPendingOpenCodeProjects = (interrupted) => {
5024
+ for (const notice of lockedPreparation.integration.pendingOpenCodeProjectNotices(interrupted)) {
5025
+ const rebuild = results.flatMap((result) => result.rebuildResults).find((entry) => entry.target.platform === 'opencode'
5026
+ && entry.target.scope === 'user' && entry.target.pluginId === notice.subject?.pluginId);
5027
+ rebuild?.deploymentReceipts?.[0]?.diagnostics.push(notice);
5028
+ }
5029
+ };
4935
5030
  try {
4936
5031
  if (admission && options.runtime?.batchInstallPlatform) {
4937
5032
  const selectedKeys = new Set(executionSelections.map((selection) => executionKey(selection, lockedPlan)));
@@ -4943,8 +5038,7 @@ async function runRebuildCommandInSession(options) {
4943
5038
  const resources = nativeInstallResources(deployment?.plans ?? []);
4944
5039
  const producesCommands = target && nativeTargetExecution
4945
5040
  && (nativeTargetExecution.produces?.(target.identity) ?? true);
4946
- if (deployment?.writesManagedCommands || producesCommands
4947
- || target?.operationActions?.some((action) => action.kind === 'syncManagedCommandPackage')) {
5041
+ if (producesCommands || target?.operationActions?.some((action) => action.kind === 'syncManagedCommandPackage' || action.kind === 'removeManagedCommandPackage')) {
4948
5042
  resources.push({ kind: 'path', value: path.join(resolveAwHome(runtimeEnv), 'commands') });
4949
5043
  }
4950
5044
  const leaves = [];
@@ -5028,11 +5122,13 @@ async function runRebuildCommandInSession(options) {
5028
5122
  failCompletedCodexTarget({ identity: targetIdentity(selection, planTargetFor(lockedPlan, selection).resolvedScope),
5029
5123
  message: `${code}: Codex postcheck did not complete.` });
5030
5124
  }
5125
+ reportPendingOpenCodeProjects(true);
5031
5126
  throw new RebuildInterruptedError(mergeRebuildCommandResults(results.filter(Boolean)), error);
5032
5127
  }
5033
5128
  finally {
5034
5129
  await Promise.all(privatePackages.map((staging) => staging.dispose()));
5035
5130
  }
5131
+ reportPendingOpenCodeProjects(false);
5036
5132
  const merged = mergeRebuildCommandResults(results);
5037
5133
  if (malformedSelectedConfigPreserved) {
5038
5134
  merged.warnings.push(MALFORMED_CONFIG_PRESERVED_WARNING);
@@ -5104,18 +5200,24 @@ export async function runRebuildCommand(options) {
5104
5200
  ?? result.rebuildResults.flatMap((entry) => entry.deploymentExclusions ?? []);
5105
5201
  if (exclusions.length)
5106
5202
  result = { ...result, deploymentExclusions: exclusions };
5107
- const byProducer = new Map();
5108
5203
  const retained = (result.operationPlan?.actions ?? []).flatMap((action) => action.kind === 'retainManagedCommandPackage' ? [retainedManagedCommandPackageResult(action)] : []);
5109
- for (const entry of [...(result.commandResults ?? []), ...commandResults, ...retained]) {
5110
- const key = JSON.stringify(entry.producer);
5111
- const previous = byProducer.get(key);
5112
- byProducer.set(key, { ...entry, removedCommandIds: [...new Set([...(previous?.removedCommandIds ?? []), ...entry.removedCommandIds])].filter((id) => !entry.commandIds.includes(id)), errors: [...(previous?.errors ?? []), ...entry.errors], recoveryActions: [...new Set([...(previous?.recoveryActions ?? []), ...entry.recoveryActions])] });
5204
+ const byPackage = new Map();
5205
+ for (const entry of [...retained, ...(result.commandResults ?? []), ...commandResults]) {
5206
+ byPackage.set(entry.packageId, entry);
5113
5207
  }
5114
- const commands = [...byProducer.values()];
5115
- if (commands.length === 0)
5208
+ const commands = [...byPackage.values()];
5209
+ if (!commands.length)
5116
5210
  return result;
5117
- const failed = commands.some((entry) => entry.state !== 'completed');
5118
- return { ...result, commandResults: commands, overallState: failed ? result.targetResults.some((entry) => entry.state === 'completed') || commands.some((entry) => entry.state === 'completed') ? 'partial' : 'failed' : result.overallState };
5211
+ let overallState = result.overallState;
5212
+ if (commands.some((entry) => entry.state !== 'completed')) {
5213
+ const completedWork = result.targetResults.some((entry) => entry.state === 'completed')
5214
+ || commands.some((entry) => entry.state !== 'failed');
5215
+ overallState = completedWork ? 'partial' : 'failed';
5216
+ }
5217
+ else if (overallState === 'failed' && commands.some((entry) => entry.action !== 'unchanged')) {
5218
+ overallState = 'partial';
5219
+ }
5220
+ return { ...result, commandResults: commands, overallState };
5119
5221
  };
5120
5222
  const scopedOptions = {
5121
5223
  ...options,