@lesliechan721/aw 0.1.0-beta.73 → 0.1.0-beta.74

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 (361) hide show
  1. package/dist/authoring/assets/aw-runtime-config.mjs +65 -43
  2. package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -1
  3. package/dist/authoring/scripts/add-skill.mjs +5 -14
  4. package/dist/authoring/scripts/add-skill.mjs.map +1 -1
  5. package/dist/authoring/scripts/init-plugin.mjs +4 -28
  6. package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
  7. package/dist/authoring/scripts/lib/plugin-version-check.mjs +2 -2
  8. package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
  9. package/dist/authoring/scripts/lib/skill-scaffold.mjs +0 -1
  10. package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
  11. package/dist/authoring/scripts/validate-plugin.mjs +234 -1422
  12. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  13. package/dist/scripts/aw-skill-eval-materializer.d.ts +2 -0
  14. package/dist/scripts/aw-skill-eval-materializer.js +19 -80
  15. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
  16. package/dist/scripts/bundle-plugins.js.map +1 -1
  17. package/dist/scripts/test-plugin-scripts.js +6 -8
  18. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  19. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  20. package/dist/src/commands/aw-capabilities.js +2 -2
  21. package/dist/src/commands/aw-capabilities.js.map +1 -1
  22. package/dist/src/commands/dependency-operation-plan.js +3 -3
  23. package/dist/src/commands/dependency-operation-plan.js.map +1 -1
  24. package/dist/src/commands/deployment-confirmation.d.ts +4 -0
  25. package/dist/src/commands/deployment-confirmation.js +20 -0
  26. package/dist/src/commands/deployment-confirmation.js.map +1 -0
  27. package/dist/src/commands/managed-commands.js +4 -2
  28. package/dist/src/commands/managed-commands.js.map +1 -1
  29. package/dist/src/commands/offline-cleanup-evidence.d.ts +3 -1
  30. package/dist/src/commands/offline-cleanup-evidence.js +9 -4
  31. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
  32. package/dist/src/commands/operation-plan.d.ts +6 -0
  33. package/dist/src/commands/operation-plan.js +29 -2
  34. package/dist/src/commands/operation-plan.js.map +1 -1
  35. package/dist/src/commands/options.d.ts +6 -2
  36. package/dist/src/commands/options.js +5 -4
  37. package/dist/src/commands/options.js.map +1 -1
  38. package/dist/src/commands/plugin-capabilities.js +29 -41
  39. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  40. package/dist/src/commands/public-config-confirmation.js +5 -5
  41. package/dist/src/commands/public-config-confirmation.js.map +1 -1
  42. package/dist/src/commands/public-lifecycle-result.d.ts +47 -0
  43. package/dist/src/commands/public-lifecycle-result.js +119 -4
  44. package/dist/src/commands/public-lifecycle-result.js.map +1 -1
  45. package/dist/src/commands/public-lifecycle.d.ts +1 -0
  46. package/dist/src/commands/public-lifecycle.js +15 -2
  47. package/dist/src/commands/public-lifecycle.js.map +1 -1
  48. package/dist/src/commands/public-plugin-query.d.ts +1 -0
  49. package/dist/src/commands/public-plugin-query.js +28 -8
  50. package/dist/src/commands/public-plugin-query.js.map +1 -1
  51. package/dist/src/commands/rebuild-command.d.ts +12 -11
  52. package/dist/src/commands/rebuild-command.js +529 -769
  53. package/dist/src/commands/rebuild-command.js.map +1 -1
  54. package/dist/src/commands/rebuild-integration.d.ts +21 -43
  55. package/dist/src/commands/rebuild-integration.js +306 -3600
  56. package/dist/src/commands/rebuild-integration.js.map +1 -1
  57. package/dist/src/commands/rebuild-operations.d.ts +13 -0
  58. package/dist/src/commands/rebuild-operations.js +60 -15
  59. package/dist/src/commands/rebuild-operations.js.map +1 -1
  60. package/dist/src/commands/rebuild-platform-integration.d.ts +59 -0
  61. package/dist/src/commands/rebuild-platform-integration.js +1200 -0
  62. package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
  63. package/dist/src/commands/review-inspection.js +41 -4
  64. package/dist/src/commands/review-inspection.js.map +1 -1
  65. package/dist/src/commands/review-preparation.d.ts +2 -0
  66. package/dist/src/commands/review-preparation.js +23 -60
  67. package/dist/src/commands/review-preparation.js.map +1 -1
  68. package/dist/src/commands/skill-eval.js +1 -0
  69. package/dist/src/commands/skill-eval.js.map +1 -1
  70. package/dist/src/commands/status-v6.d.ts +3 -1
  71. package/dist/src/commands/status-v6.js +24 -15
  72. package/dist/src/commands/status-v6.js.map +1 -1
  73. package/dist/src/commands/targets-command.d.ts +9 -0
  74. package/dist/src/commands/targets-command.js +57 -6
  75. package/dist/src/commands/targets-command.js.map +1 -1
  76. package/dist/src/commands/write-commands.js +43 -28
  77. package/dist/src/commands/write-commands.js.map +1 -1
  78. package/dist/src/constants.d.ts +2 -2
  79. package/dist/src/constants.js +2 -2
  80. package/dist/src/constants.js.map +1 -1
  81. package/dist/src/generators/local-plugin.js +59 -248
  82. package/dist/src/generators/local-plugin.js.map +1 -1
  83. package/dist/src/index.js +40 -14
  84. package/dist/src/index.js.map +1 -1
  85. package/dist/src/output/command-receipt.d.ts +1 -1
  86. package/dist/src/output/command-receipt.js +3 -1
  87. package/dist/src/output/command-receipt.js.map +1 -1
  88. package/dist/src/output/native-consent.d.ts +2 -0
  89. package/dist/src/output/native-consent.js +5 -0
  90. package/dist/src/output/native-consent.js.map +1 -0
  91. package/dist/src/output/public-result.js +60 -0
  92. package/dist/src/output/public-result.js.map +1 -1
  93. package/dist/src/output/rebuild-progress.js +5 -5
  94. package/dist/src/output/rebuild-progress.js.map +1 -1
  95. package/dist/src/output/receipt-projection.js +19 -2
  96. package/dist/src/output/receipt-projection.js.map +1 -1
  97. package/dist/src/platforms/capabilities.d.ts +10 -0
  98. package/dist/src/platforms/capabilities.js +158 -0
  99. package/dist/src/platforms/capabilities.js.map +1 -0
  100. package/dist/src/platforms/contracts.d.ts +338 -0
  101. package/dist/src/platforms/contracts.js +2 -0
  102. package/dist/src/platforms/contracts.js.map +1 -0
  103. package/dist/src/platforms/cursor-workspace-hook.d.ts +22 -0
  104. package/dist/src/platforms/cursor-workspace-hook.js +185 -0
  105. package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
  106. package/dist/src/platforms/discovery.d.ts +74 -0
  107. package/dist/src/platforms/discovery.js +582 -0
  108. package/dist/src/platforms/discovery.js.map +1 -0
  109. package/dist/src/platforms/gemini-activation.d.ts +36 -0
  110. package/dist/src/platforms/gemini-activation.js +331 -0
  111. package/dist/src/platforms/gemini-activation.js.map +1 -0
  112. package/dist/src/platforms/gemini-consent.d.ts +8 -0
  113. package/dist/src/platforms/gemini-consent.js +79 -0
  114. package/dist/src/platforms/gemini-consent.js.map +1 -0
  115. package/dist/src/platforms/identity.d.ts +4 -0
  116. package/dist/src/platforms/identity.js +22 -0
  117. package/dist/src/platforms/identity.js.map +1 -0
  118. package/dist/src/platforms/inspection-grok.d.ts +4 -0
  119. package/dist/src/platforms/inspection-grok.js +173 -0
  120. package/dist/src/platforms/inspection-grok.js.map +1 -0
  121. package/dist/src/platforms/inspection-native.d.ts +6 -0
  122. package/dist/src/platforms/inspection-native.js +379 -0
  123. package/dist/src/platforms/inspection-native.js.map +1 -0
  124. package/dist/src/platforms/inspection-pi.d.ts +4 -0
  125. package/dist/src/platforms/inspection-pi.js +212 -0
  126. package/dist/src/platforms/inspection-pi.js.map +1 -0
  127. package/dist/src/platforms/inspection.d.ts +13 -0
  128. package/dist/src/platforms/inspection.js +189 -0
  129. package/dist/src/platforms/inspection.js.map +1 -0
  130. package/dist/src/platforms/layout.d.ts +21 -0
  131. package/dist/src/platforms/layout.js +239 -0
  132. package/dist/src/platforms/layout.js.map +1 -0
  133. package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
  134. package/dist/src/platforms/lifecycle-native-services.js +147 -0
  135. package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
  136. package/dist/src/platforms/lifecycle-native.d.ts +9 -0
  137. package/dist/src/platforms/lifecycle-native.js +252 -0
  138. package/dist/src/platforms/lifecycle-native.js.map +1 -0
  139. package/dist/src/platforms/lifecycle.d.ts +25 -0
  140. package/dist/src/platforms/lifecycle.js +452 -0
  141. package/dist/src/platforms/lifecycle.js.map +1 -0
  142. package/dist/src/platforms/managed-command-placement.d.ts +8 -0
  143. package/dist/src/platforms/managed-command-placement.js +79 -0
  144. package/dist/src/platforms/managed-command-placement.js.map +1 -0
  145. package/dist/src/platforms/projection-code-extension.d.ts +8 -0
  146. package/dist/src/platforms/projection-code-extension.js +121 -0
  147. package/dist/src/platforms/projection-code-extension.js.map +1 -0
  148. package/dist/src/platforms/projection-command-resources.d.ts +7 -0
  149. package/dist/src/platforms/projection-command-resources.js +74 -0
  150. package/dist/src/platforms/projection-command-resources.js.map +1 -0
  151. package/dist/src/platforms/projection-files.d.ts +27 -0
  152. package/dist/src/platforms/projection-files.js +111 -0
  153. package/dist/src/platforms/projection-files.js.map +1 -0
  154. package/dist/src/platforms/projection-marketplace.d.ts +19 -0
  155. package/dist/src/platforms/projection-marketplace.js +42 -0
  156. package/dist/src/platforms/projection-marketplace.js.map +1 -0
  157. package/dist/src/platforms/projection.d.ts +10 -0
  158. package/dist/src/platforms/projection.js +446 -0
  159. package/dist/src/platforms/projection.js.map +1 -0
  160. package/dist/src/platforms/registry.d.ts +4 -0
  161. package/dist/src/platforms/registry.js +30 -0
  162. package/dist/src/platforms/registry.js.map +1 -0
  163. package/dist/src/platforms/supplement-layout.d.ts +16 -0
  164. package/dist/src/platforms/supplement-layout.js +31 -0
  165. package/dist/src/platforms/supplement-layout.js.map +1 -0
  166. package/dist/src/portable/commands.d.ts +7 -5
  167. package/dist/src/portable/commands.js +6 -1
  168. package/dist/src/portable/commands.js.map +1 -1
  169. package/dist/src/portable/materializer.d.ts +8 -6
  170. package/dist/src/portable/materializer.js +47 -245
  171. package/dist/src/portable/materializer.js.map +1 -1
  172. package/dist/src/portable/recovery-layout.js +2 -15
  173. package/dist/src/portable/recovery-layout.js.map +1 -1
  174. package/dist/src/portable/recovery.d.ts +10 -1
  175. package/dist/src/portable/recovery.js +34 -8
  176. package/dist/src/portable/recovery.js.map +1 -1
  177. package/dist/src/recovery/coordinator.d.ts +4 -7
  178. package/dist/src/recovery/coordinator.js +151 -119
  179. package/dist/src/recovery/coordinator.js.map +1 -1
  180. package/dist/src/recovery/demand.d.ts +1 -1
  181. package/dist/src/recovery/demand.js +10 -42
  182. package/dist/src/recovery/demand.js.map +1 -1
  183. package/dist/src/recovery/joint-coordinator.js +112 -52
  184. package/dist/src/recovery/joint-coordinator.js.map +1 -1
  185. package/dist/src/recovery/joint-demand.d.ts +4 -22
  186. package/dist/src/recovery/joint-demand.js +43 -40
  187. package/dist/src/recovery/joint-demand.js.map +1 -1
  188. package/dist/src/recovery/receipt.d.ts +23 -8
  189. package/dist/src/recovery/retirement.d.ts +1 -1
  190. package/dist/src/recovery/retirement.js +122 -29
  191. package/dist/src/recovery/retirement.js.map +1 -1
  192. package/dist/src/recovery/status.d.ts +13 -6
  193. package/dist/src/recovery/status.js +479 -79
  194. package/dist/src/recovery/status.js.map +1 -1
  195. package/dist/src/recovery/types.d.ts +3 -3
  196. package/dist/src/review/platform-profile.d.ts +3 -0
  197. package/dist/src/review/platform-profile.js +16 -0
  198. package/dist/src/review/platform-profile.js.map +1 -0
  199. package/dist/src/review/review-profile.d.ts +1 -0
  200. package/dist/src/review/review-profile.js +8 -2
  201. package/dist/src/review/review-profile.js.map +1 -1
  202. package/dist/src/review/review-selection.d.ts +2 -11
  203. package/dist/src/review/review-selection.js +97 -71
  204. package/dist/src/review/review-selection.js.map +1 -1
  205. package/dist/src/review/review-types.d.ts +3 -0
  206. package/dist/src/review/review-types.js.map +1 -1
  207. package/dist/src/review/skill-materialization.d.ts +44 -9
  208. package/dist/src/review/skill-materialization.js +112 -136
  209. package/dist/src/review/skill-materialization.js.map +1 -1
  210. package/dist/src/review/source-binding.d.ts +8 -5
  211. package/dist/src/review/source-binding.js +99 -41
  212. package/dist/src/review/source-binding.js.map +1 -1
  213. package/dist/src/tui/agent-management.js +112 -10
  214. package/dist/src/tui/agent-management.js.map +1 -1
  215. package/dist/src/tui/agent-settings.d.ts +3 -0
  216. package/dist/src/tui/agent-settings.js +10 -11
  217. package/dist/src/tui/agent-settings.js.map +1 -1
  218. package/dist/src/tui/console-app-v4.js +58 -20
  219. package/dist/src/tui/console-app-v4.js.map +1 -1
  220. package/dist/src/tui/content-item-card.js +2 -2
  221. package/dist/src/tui/content-item-card.js.map +1 -1
  222. package/dist/src/tui/controller-runtime.js +198 -152
  223. package/dist/src/tui/controller-runtime.js.map +1 -1
  224. package/dist/src/tui/controller.d.ts +5 -9
  225. package/dist/src/tui/controller.js +40 -18
  226. package/dist/src/tui/controller.js.map +1 -1
  227. package/dist/src/tui/deployment-view.d.ts +10 -0
  228. package/dist/src/tui/deployment-view.js +91 -0
  229. package/dist/src/tui/deployment-view.js.map +1 -0
  230. package/dist/src/tui/glossary.js +4 -4
  231. package/dist/src/tui/glossary.js.map +1 -1
  232. package/dist/src/tui/model.d.ts +5 -0
  233. package/dist/src/tui/model.js +73 -12
  234. package/dist/src/tui/model.js.map +1 -1
  235. package/dist/src/tui/operation-diagnostic-screens.js +2 -1
  236. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
  237. package/dist/src/tui/operation-history.d.ts +5 -4
  238. package/dist/src/tui/operation-history.js.map +1 -1
  239. package/dist/src/tui/operation-review-planner.d.ts +7 -2
  240. package/dist/src/tui/operation-review-planner.js +97 -42
  241. package/dist/src/tui/operation-review-planner.js.map +1 -1
  242. package/dist/src/tui/plugin-content.d.ts +5 -3
  243. package/dist/src/tui/plugin-content.js +70 -508
  244. package/dist/src/tui/plugin-content.js.map +1 -1
  245. package/dist/src/tui/plugin-detail.d.ts +3 -2
  246. package/dist/src/tui/plugin-detail.js +33 -25
  247. package/dist/src/tui/plugin-detail.js.map +1 -1
  248. package/dist/src/tui/scoped-inventory.d.ts +10 -6
  249. package/dist/src/tui/scoped-inventory.js +34 -1
  250. package/dist/src/tui/scoped-inventory.js.map +1 -1
  251. package/dist/src/types.d.ts +4 -63
  252. package/dist/src/types.js.map +1 -1
  253. package/dist/src/utils/agent-version.d.ts +10 -4
  254. package/dist/src/utils/agent-version.js.map +1 -1
  255. package/dist/src/utils/artifact-plan.d.ts +26 -2
  256. package/dist/src/utils/artifact-plan.js +113 -489
  257. package/dist/src/utils/artifact-plan.js.map +1 -1
  258. package/dist/src/utils/artifact-renderer.d.ts +100 -93
  259. package/dist/src/utils/artifact-renderer.js +173 -346
  260. package/dist/src/utils/artifact-renderer.js.map +1 -1
  261. package/dist/src/utils/artifact-request.d.ts +21 -11
  262. package/dist/src/utils/artifact-request.js +56 -80
  263. package/dist/src/utils/artifact-request.js.map +1 -1
  264. package/dist/src/utils/bundle-layout.js +30 -146
  265. package/dist/src/utils/bundle-layout.js.map +1 -1
  266. package/dist/src/utils/catalog-digests.d.ts +2 -12
  267. package/dist/src/utils/catalog-digests.js +0 -39
  268. package/dist/src/utils/catalog-digests.js.map +1 -1
  269. package/dist/src/utils/catalog-source-references.d.ts +7 -0
  270. package/dist/src/utils/catalog-source-references.js +234 -19
  271. package/dist/src/utils/catalog-source-references.js.map +1 -1
  272. package/dist/src/utils/codex-config-observation.d.ts +19 -0
  273. package/dist/src/utils/codex-config-observation.js +145 -0
  274. package/dist/src/utils/codex-config-observation.js.map +1 -0
  275. package/dist/src/utils/codex-executable-discovery.d.ts +2 -0
  276. package/dist/src/utils/codex-executable-discovery.js +47 -13
  277. package/dist/src/utils/codex-executable-discovery.js.map +1 -1
  278. package/dist/src/utils/codex-manager.js +1 -1
  279. package/dist/src/utils/codex-manager.js.map +1 -1
  280. package/dist/src/utils/codex-native-observation.d.ts +3 -0
  281. package/dist/src/utils/codex-native-observation.js +53 -0
  282. package/dist/src/utils/codex-native-observation.js.map +1 -1
  283. package/dist/src/utils/codex-shared-native.d.ts +3 -1
  284. package/dist/src/utils/codex-shared-native.js +46 -5
  285. package/dist/src/utils/codex-shared-native.js.map +1 -1
  286. package/dist/src/utils/codex-skill-staging.d.ts +4 -3
  287. package/dist/src/utils/codex-skill-staging.js.map +1 -1
  288. package/dist/src/utils/codex-surface-analysis.d.ts +5 -2
  289. package/dist/src/utils/codex-surface-analysis.js +28 -57
  290. package/dist/src/utils/codex-surface-analysis.js.map +1 -1
  291. package/dist/src/utils/component-command-preparation.d.ts +34 -0
  292. package/dist/src/utils/component-command-preparation.js +228 -0
  293. package/dist/src/utils/component-command-preparation.js.map +1 -0
  294. package/dist/src/utils/component-resources.d.ts +43 -0
  295. package/dist/src/utils/component-resources.js +304 -0
  296. package/dist/src/utils/component-resources.js.map +1 -0
  297. package/dist/src/utils/dynamic-skill-tree.d.ts +17 -6
  298. package/dist/src/utils/dynamic-skill-tree.js +7 -3
  299. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  300. package/dist/src/utils/local-marketplace.d.ts +11 -44
  301. package/dist/src/utils/local-marketplace.js +11 -638
  302. package/dist/src/utils/local-marketplace.js.map +1 -1
  303. package/dist/src/utils/managed-command-evidence.d.ts +2 -2
  304. package/dist/src/utils/managed-command-evidence.js +5 -81
  305. package/dist/src/utils/managed-command-evidence.js.map +1 -1
  306. package/dist/src/utils/managed-command-materialization.d.ts +5 -2
  307. package/dist/src/utils/managed-command-materialization.js +35 -35
  308. package/dist/src/utils/managed-command-materialization.js.map +1 -1
  309. package/dist/src/utils/managed-command-preparation.d.ts +67 -0
  310. package/dist/src/utils/managed-command-preparation.js +146 -0
  311. package/dist/src/utils/managed-command-preparation.js.map +1 -0
  312. package/dist/src/utils/managed-command-review.d.ts +26 -0
  313. package/dist/src/utils/managed-command-review.js +68 -0
  314. package/dist/src/utils/managed-command-review.js.map +1 -0
  315. package/dist/src/utils/managed-command-store.js +26 -15
  316. package/dist/src/utils/managed-command-store.js.map +1 -1
  317. package/dist/src/utils/native-cli.d.ts +19 -0
  318. package/dist/src/utils/native-cli.js +45 -2
  319. package/dist/src/utils/native-cli.js.map +1 -1
  320. package/dist/src/utils/native-demand.d.ts +20 -1
  321. package/dist/src/utils/native-demand.js.map +1 -1
  322. package/dist/src/utils/native-tool-review.d.ts +3 -6
  323. package/dist/src/utils/native-tool-review.js +25 -11
  324. package/dist/src/utils/native-tool-review.js.map +1 -1
  325. package/dist/src/utils/ownership.d.ts +26 -3
  326. package/dist/src/utils/ownership.js +95 -9
  327. package/dist/src/utils/ownership.js.map +1 -1
  328. package/dist/src/utils/paths.d.ts +1 -1
  329. package/dist/src/utils/paths.js +2 -0
  330. package/dist/src/utils/paths.js.map +1 -1
  331. package/dist/src/utils/platform-empty-state.d.ts +46 -0
  332. package/dist/src/utils/platform-empty-state.js +123 -0
  333. package/dist/src/utils/platform-empty-state.js.map +1 -0
  334. package/dist/src/utils/plugin-config-impact.d.ts +17 -11
  335. package/dist/src/utils/plugin-config-impact.js +46 -62
  336. package/dist/src/utils/plugin-config-impact.js.map +1 -1
  337. package/dist/src/utils/plugin-config-write.js +52 -53
  338. package/dist/src/utils/plugin-config-write.js.map +1 -1
  339. package/dist/src/utils/plugin-config.d.ts +0 -2
  340. package/dist/src/utils/plugin-config.js +0 -6
  341. package/dist/src/utils/plugin-config.js.map +1 -1
  342. package/dist/src/utils/plugin-dependencies.d.ts +1 -1
  343. package/dist/src/utils/plugin-dependencies.js.map +1 -1
  344. package/dist/src/utils/runtime-config.d.ts +5 -7
  345. package/dist/src/utils/runtime-config.js +12 -25
  346. package/dist/src/utils/runtime-config.js.map +1 -1
  347. package/dist/src/utils/windows-npm-shim.js +19 -2
  348. package/dist/src/utils/windows-npm-shim.js.map +1 -1
  349. package/package.json +3 -3
  350. package/dist/src/utils/claude-native-render-receipt.d.ts +0 -14
  351. package/dist/src/utils/claude-native-render-receipt.js +0 -26
  352. package/dist/src/utils/claude-native-render-receipt.js.map +0 -1
  353. package/dist/src/utils/claude-skills-root.d.ts +0 -8
  354. package/dist/src/utils/claude-skills-root.js +0 -87
  355. package/dist/src/utils/claude-skills-root.js.map +0 -1
  356. package/dist/src/utils/codex-native-render-receipt.d.ts +0 -40
  357. package/dist/src/utils/codex-native-render-receipt.js +0 -205
  358. package/dist/src/utils/codex-native-render-receipt.js.map +0 -1
  359. package/dist/src/utils/slash-commands.d.ts +0 -1
  360. package/dist/src/utils/slash-commands.js +0 -2
  361. package/dist/src/utils/slash-commands.js.map +0 -1
@@ -0,0 +1,452 @@
1
+ import path from 'node:path';
2
+ import { inspectDeployment } from './inspection.js';
3
+ import { executeNativeLifecycle, grokRegistrationOwned, nativeLifecycleEffectKey, nativeRoute, routeReload } from './lifecycle-native.js';
4
+ import { geminiConsentMessages } from './gemini-consent.js';
5
+ import { geminiReplacementMessages } from './gemini-activation.js';
6
+ export function lifecycleDiagnostic(binding, code, message) {
7
+ return { code, severity: 'error', message,
8
+ subject: { target: binding.platform, pluginId: binding.plugin.pluginId, scope: binding.scope.kind } };
9
+ }
10
+ function componentPath(component) {
11
+ return 'path' in component ? component.path : null;
12
+ }
13
+ function contributionDestination(component) {
14
+ if ('path' in component)
15
+ return component.path;
16
+ if (!('locator' in component))
17
+ return null;
18
+ if (component.locator.kind === 'claude-permissions')
19
+ return component.locator.settingsPath;
20
+ if (component.locator.kind === 'cursor-workspace-hook')
21
+ return component.locator.hooksPath;
22
+ return null;
23
+ }
24
+ function matchesContribution(component, contribution) {
25
+ if ('path' in component)
26
+ return component.path === contribution.destination
27
+ && (contribution.kind === 'owned-file' && component.kind === 'owned-text-file'
28
+ || contribution.kind === 'owned-directory' && (component.kind === 'owned-directory' || component.kind === 'skill-directory'));
29
+ if (!('locator' in component) || contribution.kind !== 'config-entry')
30
+ return false;
31
+ if (component.locator.kind === 'claude-permissions')
32
+ return component.locator.settingsPath === contribution.destination;
33
+ if (component.locator.kind === 'cursor-workspace-hook')
34
+ return component.locator.hooksPath === contribution.destination
35
+ && component.locator.ownerKey === contribution.mergeKey;
36
+ return false;
37
+ }
38
+ function belowRoot(root, destination) {
39
+ if (!root)
40
+ return false;
41
+ const relative = path.relative(root, destination);
42
+ return relative !== '' && relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
43
+ }
44
+ function sameOwner(binding, component) {
45
+ return component.identity.sourceId === binding.plugin.sourceId
46
+ && component.identity.pluginId === binding.plugin.pluginId
47
+ && component.identity.platform === binding.platform;
48
+ }
49
+ function freeze(value) {
50
+ if (value && typeof value === 'object' && !Object.isFrozen(value)) {
51
+ for (const child of Object.values(value))
52
+ freeze(child);
53
+ Object.freeze(value);
54
+ }
55
+ return value;
56
+ }
57
+ function exactScope(binding, component) {
58
+ return component.identity.scope === binding.scope.kind;
59
+ }
60
+ /** Selects fixed route operations from observed facts. It performs no I/O. */
61
+ export function preparePlatformLifecycle(input) {
62
+ const { binding, observation, evidence, expected, operation } = input;
63
+ const removing = operation === 'remove' || operation === 'cleanup';
64
+ const retainPackage = !removing && evidence.retainPackage === true;
65
+ const blocked = (code, message) => ({
66
+ status: 'blocked', diagnostics: [lifecycleDiagnostic(binding, code, message)],
67
+ });
68
+ if (observation.physicalKey !== binding.physicalKey) {
69
+ return blocked('deploymentEvidenceMismatch', 'The observation does not belong to this deployment. Prepare the operation again.');
70
+ }
71
+ if (!removing && !expected.components.length && expected.unmet.length) {
72
+ return blocked('noSupportedComponents', 'No requested component can be installed. Existing output was kept.');
73
+ }
74
+ const bundles = input.projections.flatMap((projection) => projection.bundle ? [projection.bundle] : []);
75
+ if (bundles.length > 1)
76
+ return blocked('shared-projection-conflict', 'This deployment has conflicting package projections. Existing output was kept.');
77
+ const allContributions = input.projections.flatMap((projection) => projection.supplements);
78
+ if (!removing && !retainPackage && bundles.length && (observation.ownership === 'foreign' || observation.ownership === 'unknown')) {
79
+ return blocked('deploymentOwnershipUnconfirmed', 'The deployment ownership is not safe for replacement. Check the output and prepare again.');
80
+ }
81
+ if (!removing && expected.components.length && !bundles.length && !allContributions.length) {
82
+ return blocked('platformProjectionEmpty', 'The requested components have no prepared output. Existing output was kept.');
83
+ }
84
+ if (allContributions.length && binding.renderUnitIds.length > 1
85
+ && input.projections.some((projection) => projection.supplements.length > 0 && !evidence.renderUnits?.some((unit) => unit.id === projection.renderUnitId))) {
86
+ return blocked('supplementPhysicalIdentityUnconfirmed', 'A host contribution has no verified physical render unit. Prepare the operation again.');
87
+ }
88
+ if (input.projections.some((projection) => projection.diagnostics.some((item) => item.severity === 'error'))) {
89
+ return blocked('platformProjectionFailed', 'A required projection failed. Existing output was kept.');
90
+ }
91
+ const slots = evidence.ownership;
92
+ if (slots.some((slot) => !sameOwner(binding, slot.component))) {
93
+ return blocked('deploymentOwnerIdentityMismatch', 'An ownership candidate belongs to a different deployment. Prepare the operation again.');
94
+ }
95
+ const packageSlot = slots.find((slot) => componentPath(slot.component) === evidence.layout.packageRoot);
96
+ if (retainPackage && (!packageSlot || !['present', 'partial'].includes(packageSlot.state) || !expected.unmet.length)) {
97
+ return blocked('packageRetentionEvidenceInvalid', 'The package retention evidence is incomplete. Prepare the operation again.');
98
+ }
99
+ if (binding.renderUnitIds.length > 1 && slots.some((slot) => slot !== packageSlot
100
+ && ['present', 'partial'].includes(slot.state) && !slot.physicalKey)) {
101
+ return blocked('supplementPhysicalIdentityUnconfirmed', 'An existing host contribution has no verified physical identity. Prepare the operation again.');
102
+ }
103
+ const identity = evidence.nativeIdentity ?? observation.nativeIdentity;
104
+ if (identity && identity.route !== binding.route)
105
+ return blocked('nativeIdentityMismatch', 'The native identity belongs to a different installation route.');
106
+ const product = binding.consumers.find((consumer) => consumer.entry?.kind === 'cli' && consumer.availability === 'available') ?? null;
107
+ if (!removing && !retainPackage && bundles.length && nativeRoute(binding.route) && !product)
108
+ return blocked('clientInstallEntryUnavailable', 'The required native client entry is unavailable. Install or repair the client and retry.');
109
+ if (!removing && !retainPackage && bundles.length && nativeRoute(binding.route) && !identity)
110
+ return blocked('nativeIdentityUnconfirmed', 'The precise native package identity is unavailable. Prepare the operation again.');
111
+ if (!removing && !retainPackage && bundles.length && binding.scope.kind === 'project' && ['codex-marketplace', 'copilot-marketplace'].includes(binding.route)
112
+ && typeof evidence.userActivationEnabled !== 'boolean') {
113
+ return blocked('nativeActivationEvidenceUnknown', 'The user activation could not be confirmed. Prepare again before changing a project activation.');
114
+ }
115
+ if (binding.route === 'gemini-extension' && (bundles.length || observation.registration !== 'absent')
116
+ && typeof evidence.userActivationEnabled !== 'boolean') {
117
+ return blocked('nativeActivationEvidenceUnknown', 'The global user activation could not be confirmed. Check the extension rules and prepare again.');
118
+ }
119
+ const effects = [];
120
+ const add = (kind, destination, componentIds, destructive = false, slot = '', physicalKey = binding.physicalKey) => {
121
+ const id = `${binding.id}:${kind}:${slot || destination}`;
122
+ effects.push({ id, kind, physicalKey, activationKey: binding.activationKey,
123
+ componentIds, destination, destructive });
124
+ return id;
125
+ };
126
+ const state = { before: observation, identity, product,
127
+ packageComponent: packageSlot?.component ?? null, bundle: bundles[0] ?? null, contributions: [], removals: [] };
128
+ const retainedGaps = [];
129
+ const ids = input.projections.filter((projection) => projection.bundle).flatMap((projection) => projection.components.map((component) => component.id));
130
+ const independentContribution = (contribution) => binding.platform === 'codex'
131
+ && contribution.kind !== 'config-entry' && belowRoot(evidence.layout.supplementRoot, contribution.destination)
132
+ && contribution.componentIds.length > 0 && contribution.componentIds.every((id) => expected.components.some((component) => component.id === id && component.kind === 'agent')
133
+ && !expected.unmet.some((gap) => gap.componentId === id || gap.id === id));
134
+ if (retainPackage) {
135
+ const skippedIds = new Set([...ids, ...allContributions.filter((contribution) => !independentContribution(contribution)).flatMap((contribution) => contribution.componentIds)]);
136
+ retainedGaps.push(...expected.components.filter((component) => skippedIds.has(component.id)).map((component) => ({
137
+ id: `package-retained:${binding.id}:${component.id}`, componentId: component.id, kind: component.kind,
138
+ reasonCode: 'packageUpdateBlockedByUnmet', requiredFeatures: [],
139
+ })));
140
+ }
141
+ // Gemini can retain an explicit rule that is currently disabled by a parent.
142
+ const revokeActivation = binding.route === 'gemini-extension'
143
+ || observation.consumers.some((consumer) => consumer.activation === 'enabled' || consumer.activation === 'unknown');
144
+ const hasReferences = evidence.sharedReferences !== 'none';
145
+ const empty = !expected.components.length && !expected.unmet.length;
146
+ if (removing || empty) {
147
+ // Scope-local entries are revoked before any package or native registration.
148
+ if (nativeRoute(binding.route) && identity && observation.registration !== 'absent'
149
+ && (observation.ownership === 'aw' || observation.ownership === 'shared') && revokeActivation) {
150
+ add('deactivate', evidence.layout.activationPath, [], true);
151
+ }
152
+ const removable = slots.filter((slot) => (slot.state === 'present' || slot.state === 'partial')
153
+ && exactScope(binding, slot.component) && slot !== packageSlot);
154
+ for (const slot of removable.filter((item) => !('path' in item.component))) {
155
+ state.removals.push({ effectId: add('remove-owned', contributionDestination(slot.component) ?? evidence.layout.activationPath, [], true, slot.component.identity.artifactKey, slot.physicalKey), component: slot.component });
156
+ }
157
+ if (nativeRoute(binding.route) && identity && !hasReferences && observation.ownership === 'aw'
158
+ && observation.registration === 'present')
159
+ add('unregister', identity.sourceLocation, [], true);
160
+ for (const slot of removable.filter((item) => 'path' in item.component)) {
161
+ state.removals.push({ effectId: add('remove-owned', componentPath(slot.component), [], true, '', slot.physicalKey), component: slot.component });
162
+ }
163
+ if (!hasReferences && packageSlot && (packageSlot.state === 'present' || packageSlot.state === 'partial')
164
+ && observation.ownership === 'aw') {
165
+ state.removals.push({ effectId: add('remove-owned', evidence.layout.packageRoot, [], true), component: packageSlot.component });
166
+ }
167
+ }
168
+ else {
169
+ const packageChanged = operation === 'reinstall' || !evidence.contentMatches || observation.package !== 'present';
170
+ const nativeCopyChanged = ['gemini-extension', 'grok-cli', 'antigravity-cli'].includes(binding.route) && !!state.bundle
171
+ && (observation.nativePackageContentDigest !== state.bundle.contentDigest || binding.route === 'grok-cli'
172
+ && ids.some((id) => !observation.components.some((component) => component.id === id && component.presence === 'present' && !component.reasonCodes.length)));
173
+ if (!retainPackage && state.bundle && (packageChanged || nativeCopyChanged) && binding.route === 'grok-cli'
174
+ && observation.registration === 'present' && !grokRegistrationOwned(binding, evidence, observation, identity)) {
175
+ return blocked('nativeIdentityUnconfirmed', 'The Grok registration is not an exclusive installation from this AW source. Check its identity and shared references before replacement.');
176
+ }
177
+ if (!retainPackage && state.bundle && binding.route === 'antigravity-cli' && observation.registration === 'present'
178
+ && (observation.ownership !== 'aw' || evidence.sharedReferences !== 'none' || !observation.nativePackageContentDigest)) {
179
+ return blocked('nativeIdentityUnconfirmed', 'The Antigravity copy is not a confirmed exclusive AW package. Keep local data and check its ownership before replacement.');
180
+ }
181
+ if (!retainPackage && state.bundle && packageChanged) {
182
+ if (!packageSlot || !['present', 'partial', 'absent'].includes(packageSlot.state)) {
183
+ return blocked('exclusiveOwnerEvidenceInvalid', 'The package slot cannot be safely written. Check ownership and retry.');
184
+ }
185
+ add('publish-package', evidence.layout.packageRoot, ids);
186
+ }
187
+ if (!retainPackage && nativeRoute(binding.route) && state.bundle) {
188
+ if (observation.registration === 'unknown')
189
+ return blocked('nativeObservationUnknown', 'The native registration could not be observed. Check the client and retry.');
190
+ if (observation.registration === 'absent')
191
+ add('register', identity.sourceLocation, ids);
192
+ else if ((packageChanged || nativeCopyChanged) && binding.route !== 'pi-package' && binding.route !== 'copilot-marketplace') {
193
+ add('refresh', identity.sourceLocation, ids, ['codex-marketplace', 'antigravity-cli', 'grok-cli'].includes(binding.route));
194
+ }
195
+ if (binding.route !== 'pi-package' && (operation === 'reinstall' || packageChanged || nativeCopyChanged || observation.consumers.some((consumer) => consumer.activation !== 'enabled'))) {
196
+ add('activate', evidence.layout.activationPath, ids);
197
+ }
198
+ }
199
+ else if (!retainPackage && nativeRoute(binding.route) && identity && observation.registration === 'present'
200
+ && (observation.ownership === 'aw' || observation.ownership === 'shared')) {
201
+ // A valid supplement-only set withdraws this binding's previous package.
202
+ // It does not install or register an empty native source.
203
+ if (revokeActivation)
204
+ add('deactivate', evidence.layout.activationPath, [], true);
205
+ if (!hasReferences && observation.ownership === 'aw')
206
+ add('unregister', identity.sourceLocation, [], true);
207
+ }
208
+ for (const contribution of allContributions) {
209
+ if (retainPackage && !independentContribution(contribution))
210
+ continue;
211
+ const slot = slots.find((candidate) => matchesContribution(candidate.component, contribution));
212
+ if (!slot || !['present', 'partial', 'absent'].includes(slot.state) || !exactScope(binding, slot.component)) {
213
+ return blocked('supplementOwnershipUnconfirmed', 'A host contribution cannot be safely written. Check ownership and retry.');
214
+ }
215
+ if (operation !== 'reinstall' && slot.contentDigest === contribution.contentDigest && slot.state === 'present')
216
+ continue;
217
+ const projection = input.projections.find((item) => item.supplements.includes(contribution));
218
+ const unit = evidence.renderUnits?.find((item) => item.id === projection.renderUnitId);
219
+ state.contributions.push({ effectId: add('write-supplement', contribution.destination, contribution.componentIds, false, contribution.id, slot.physicalKey ?? unit?.physicalKey), contribution, component: slot.component });
220
+ }
221
+ // A complete new set may revoke only precisely owned output in this scope.
222
+ for (const slot of slots) {
223
+ if (slot === packageSlot || !['present', 'partial'].includes(slot.state) || !exactScope(binding, slot.component))
224
+ continue;
225
+ // Missing contributions in an unmet set can still be required. Preserve
226
+ // them even when this deployment has no native package to retain.
227
+ if (retainPackage || expected.unmet.length)
228
+ continue;
229
+ const destination = contributionDestination(slot.component);
230
+ if (!destination || allContributions.some((item) => matchesContribution(slot.component, item)))
231
+ continue;
232
+ state.removals.push({ effectId: add('remove-owned', destination, [], true, slot.component.identity.artifactKey, slot.physicalKey), component: slot.component });
233
+ }
234
+ if (!retainPackage && !state.bundle && !hasReferences && packageSlot && ['present', 'partial'].includes(packageSlot.state)
235
+ && observation.ownership === 'aw') {
236
+ state.removals.push({ effectId: add('remove-owned', evidence.layout.packageRoot, [], true), component: packageSlot.component });
237
+ }
238
+ }
239
+ const frozenExpected = retainedGaps.length ? { ...expected, unmet: [...expected.unmet, ...retainedGaps] } : expected;
240
+ const plan = { binding, operation, expected: frozenExpected, projections: input.projections, effects, evidence };
241
+ // Clone before freezing so prepare cannot freeze or mutate a caller's inputs.
242
+ return { status: 'ready', prepared: freeze(structuredClone({ plan, driverState: state })) };
243
+ }
244
+ /** The caller supplies these services only while it holds the existing AW_HOME lock. */
245
+ export async function executePlatformLifecycle(ctx, prepared) {
246
+ const { plan, driverState: state } = prepared;
247
+ const { binding } = plan;
248
+ const receipt = { bindingId: binding.id, effects: [], after: state.before,
249
+ unmet: plan.expected.unmet.map((gap) => ({ ...gap, productIds: binding.consumers.map((item) => item.id) })),
250
+ reload: 'none', diagnostics: [] };
251
+ const observe = async () => {
252
+ try {
253
+ return await (ctx.inspect ? ctx.inspect(binding) : inspectDeployment(ctx, binding));
254
+ }
255
+ catch {
256
+ return { ...state.before, package: 'unknown', registration: 'unknown', consumers: state.before.consumers.map((item) => ({ ...item, activation: 'unknown', load: 'unknown' })),
257
+ diagnostics: [lifecycleDiagnostic(binding, 'deploymentPostcheckFailed', 'The final deployment state could not be observed. Check status before retrying.')] };
258
+ }
259
+ };
260
+ let evidenceValid = false;
261
+ try {
262
+ evidenceValid = await ctx.services.verifyEvidence(plan);
263
+ }
264
+ catch { /* Unreadable evidence is stale. */ }
265
+ if (!evidenceValid) {
266
+ const diagnostic = lifecycleDiagnostic(binding, 'operationPlanStale', 'The deployment evidence changed. Prepare and confirm a new operation.');
267
+ receipt.diagnostics.push(diagnostic);
268
+ receipt.effects = plan.effects.map((effect) => ({ id: effect.id, status: 'blocked', mutation: 'none', diagnostics: [diagnostic] }));
269
+ receipt.after = await observe();
270
+ return receipt;
271
+ }
272
+ let packageReady = true;
273
+ let nativeReady = true;
274
+ let nativeRemoved = !nativeRoute(binding.route) || state.before.registration === 'absent';
275
+ let activationRemoved = true;
276
+ for (const effect of plan.effects) {
277
+ const result = { id: effect.id, status: 'skipped', mutation: 'none', diagnostics: [] };
278
+ receipt.effects.push(result);
279
+ const removal = state.removals.find((item) => item.effectId === effect.id);
280
+ const contribution = state.contributions.find((item) => item.effectId === effect.id);
281
+ const packageRemoval = removal && componentPath(removal.component) === plan.evidence.layout.packageRoot;
282
+ const dependencyFailed = !packageReady && ['register', 'refresh', 'activate'].includes(effect.kind)
283
+ || !nativeReady && effect.kind === 'activate'
284
+ || !packageReady && contribution?.contribution.kind === 'config-entry'
285
+ || removal && (plan.operation === 'ensure' || plan.operation === 'reinstall') && (!packageReady || !nativeReady)
286
+ || packageRemoval && (!nativeRemoved || !activationRemoved);
287
+ if (ctx.signal?.aborted || dependencyFailed) {
288
+ result.diagnostics.push(lifecycleDiagnostic(binding, ctx.signal?.aborted ? 'operationInterrupted' : 'deploymentDependencyFailed', ctx.signal?.aborted ? 'The operation was interrupted. Check status before retrying.' : 'A required deployment action failed. The dependent action was skipped.'));
289
+ for (const componentId of effect.componentIds) {
290
+ const component = plan.expected.components.find((item) => item.id === componentId);
291
+ if (component)
292
+ receipt.unmet.push({ id: `execution:${effect.id}:${componentId}`, componentId, kind: component.kind,
293
+ reasonCode: ctx.signal?.aborted ? 'operationInterrupted' : 'deploymentDependencyFailed', requiredFeatures: [],
294
+ productIds: binding.consumers.map((item) => item.id) });
295
+ }
296
+ continue;
297
+ }
298
+ let started = false;
299
+ try {
300
+ started = true;
301
+ let outcome;
302
+ if (effect.kind === 'publish-package') {
303
+ outcome = await ctx.services.publishPackage(binding, state.bundle, effect.destination, state.packageComponent);
304
+ }
305
+ else if (contribution) {
306
+ outcome = await ctx.services.writeContribution(binding, contribution.contribution, contribution.component);
307
+ }
308
+ else if (removal) {
309
+ outcome = await ctx.services.removeOwned(binding, removal.component);
310
+ }
311
+ else {
312
+ outcome = await executeNativeLifecycle(ctx, prepared, effect);
313
+ }
314
+ result.mutation = outcome.mutation;
315
+ result.status = outcome.mutation === 'possible' ? 'unknown' : outcome.changed ? 'applied' : 'unchanged';
316
+ if (outcome.mutation === 'possible')
317
+ throw Object.assign(new Error('nativeMutationUnknown'), { mutation: 'possible' });
318
+ if (['grok-cli', 'antigravity-cli'].includes(binding.route) && (effect.kind === 'register' || effect.kind === 'refresh')) {
319
+ const checked = await observe();
320
+ if (checked.physicalKey !== binding.physicalKey || checked.registration !== 'present' || checked.ownership !== 'aw'
321
+ || !state.bundle || checked.nativePackageContentDigest !== state.bundle.contentDigest) {
322
+ throw Object.assign(new Error('nativeInstallContentPostcheckFailed'), { mutation: 'possible' });
323
+ }
324
+ }
325
+ if (effect.kind === 'unregister') {
326
+ if (binding.platform === 'codex')
327
+ ctx.codexObservationSession?.invalidate(plan.evidence.layout.marketplaceName ?? undefined);
328
+ const checked = await observe();
329
+ if (checked.physicalKey !== binding.physicalKey || checked.registration !== 'absent') {
330
+ throw Object.assign(new Error('nativeUnregisterPostcheckFailed'), { mutation: 'possible' });
331
+ }
332
+ nativeRemoved = true;
333
+ }
334
+ if (effect.kind === 'deactivate')
335
+ activationRemoved = true;
336
+ }
337
+ catch (error) {
338
+ const code = error && typeof error === 'object' && 'code' in error ? String(error.code) : '';
339
+ const mutation = error && typeof error === 'object' && 'mutation' in error ? error.mutation : undefined;
340
+ const consentCode = binding.route === 'gemini-extension' && Object.hasOwn(geminiConsentMessages, code)
341
+ ? code : undefined;
342
+ const replacementCode = binding.route === 'gemini-extension' && Object.hasOwn(geminiReplacementMessages, code)
343
+ ? code : undefined;
344
+ const geminiCode = consentCode ?? replacementCode;
345
+ const definite = !(binding.route === 'gemini-extension' && mutation === 'confirmed')
346
+ && (code === 'clientInstallEntryUnavailable' || code === 'nativeIdentityUnconfirmed' || code === 'nativeTrustRequired');
347
+ result.mutation = mutation === 'none' || definite ? 'none' : mutation === 'confirmed' ? 'confirmed' : started ? 'possible' : 'none';
348
+ result.status = definite || (geminiCode !== undefined && result.mutation === 'none') ? 'blocked' : result.mutation === 'possible' ? 'unknown' : 'failed';
349
+ const geminiMessage = consentCode ? geminiConsentMessages[consentCode] : replacementCode ? geminiReplacementMessages[replacementCode] : undefined;
350
+ const failureDiagnostic = lifecycleDiagnostic(binding, geminiCode ?? (code === 'operationPlanStale' ? code : definite ? code : 'platformMutationFailed'), geminiMessage ? `${geminiMessage} In the same workspace, review and run aw plugin sync ${binding.plugin.pluginId} --context ${binding.scope.kind} --target gemini --native-consent.`
351
+ : definite ? 'A required native identity, client entry, or host trust is unavailable. Complete it in the host and retry.' : 'A platform action did not complete. Check status and retry the remaining actions.');
352
+ result.diagnostics.push(failureDiagnostic);
353
+ if (geminiCode)
354
+ receipt.diagnostics.push(failureDiagnostic);
355
+ if (binding.route === 'grok-cli' && (effect.kind === 'register' || effect.kind === 'refresh')
356
+ && (!definite || code === 'nativeTrustRequired')) {
357
+ result.diagnostics.push(lifecycleDiagnostic(binding, 'grokNativeInstallRecovery', `The Grok installation may be missing or stale. The AW source package is kept. With the same Grok client and configuration root, use arguments ${JSON.stringify(['plugin', 'install', plan.evidence.layout.packageRoot, '--trust'])}; --trust grants Grok plugin trust. Then run aw plugin sync ${binding.plugin.pluginId} --context user --target grok.`));
358
+ }
359
+ if (effect.kind === 'publish-package')
360
+ packageReady = false;
361
+ if (effect.kind === 'register' || effect.kind === 'refresh')
362
+ nativeReady = false;
363
+ if (effect.kind === 'deactivate')
364
+ activationRemoved = false;
365
+ if (removal && !('path' in removal.component))
366
+ activationRemoved = false;
367
+ for (const componentId of effect.componentIds) {
368
+ const component = plan.expected.components.find((item) => item.id === componentId);
369
+ if (component)
370
+ receipt.unmet.push({ id: `execution:${effect.id}:${componentId}`, componentId, kind: component.kind,
371
+ reasonCode: geminiCode ?? (result.status === 'unknown' ? 'platformMutationUnknown' : 'platformMutationFailed'), requiredFeatures: [], productIds: binding.consumers.map((item) => item.id) });
372
+ }
373
+ }
374
+ }
375
+ if (binding.platform === 'codex' && receipt.effects.some((effect) => effect.mutation !== 'none')) {
376
+ ctx.codexObservationSession?.invalidate(plan.evidence.layout.marketplaceName ?? undefined);
377
+ }
378
+ receipt.after = await observe();
379
+ const grokContentReady = binding.route !== 'grok-cli' || receipt.after.ownership === 'aw'
380
+ && !!state.bundle && receipt.after.nativePackageContentDigest === state.bundle.contentDigest
381
+ && plan.projections.filter((projection) => projection.bundle).flatMap((projection) => projection.components).every((component) => receipt.after.components.some((observed) => observed.id === component.id && observed.presence === 'present' && !observed.reasonCodes.length));
382
+ const nativeContentReady = grokContentReady && (!['gemini-extension', 'antigravity-cli'].includes(binding.route)
383
+ || receipt.after.ownership === 'aw' && !!state.bundle && receipt.after.nativePackageContentDigest === state.bundle.contentDigest);
384
+ for (const result of receipt.effects) {
385
+ if (result.status !== 'applied')
386
+ continue;
387
+ const effect = plan.effects.find((item) => item.id === result.id);
388
+ const incomplete = (effect.kind === 'register' || effect.kind === 'refresh') && (receipt.after.registration !== 'present' || !nativeContentReady)
389
+ || effect.kind === 'activate' && receipt.after.consumers.some((item) => item.activation !== 'enabled');
390
+ if (incomplete) {
391
+ result.status = receipt.after.registration === 'unknown' || receipt.after.consumers.some((item) => item.activation === 'unknown')
392
+ || binding.route === 'grok-cli' && receipt.after.components.some((component) => component.presence === 'unknown') ? 'unknown' : 'failed';
393
+ const code = binding.route === 'gemini-extension' && !nativeContentReady ? 'nativeInstallContentPostcheckFailed' : 'nativeMutationPostcheckFailed';
394
+ const diagnostic = lifecycleDiagnostic(binding, code, code === 'nativeInstallContentPostcheckFailed'
395
+ ? `${geminiReplacementMessages.nativeInstallContentPostcheckFailed} In the same workspace, review and run aw plugin sync ${binding.plugin.pluginId} --context ${binding.scope.kind} --target gemini --native-consent.`
396
+ : 'The native command completed, but the final state does not confirm the requested result. Check status before retrying.');
397
+ result.diagnostics.push(diagnostic);
398
+ if (code === 'nativeInstallContentPostcheckFailed')
399
+ receipt.diagnostics.push(diagnostic);
400
+ for (const componentId of effect.componentIds) {
401
+ const component = plan.expected.components.find((item) => item.id === componentId);
402
+ if (component)
403
+ receipt.unmet.push({ id: `execution:${effect.id}:${componentId}`, componentId, kind: component.kind,
404
+ reasonCode: code, requiredFeatures: [], productIds: binding.consumers.map((item) => item.id) });
405
+ }
406
+ }
407
+ }
408
+ // A bounded postcheck can resolve uncertain native effects. File publication
409
+ // still requires byte evidence; mere existence cannot confirm those effects.
410
+ for (const result of receipt.effects) {
411
+ if (result.status !== 'unknown' || receipt.after.ownership !== 'aw')
412
+ continue;
413
+ const effect = plan.effects.find((item) => item.id === result.id);
414
+ const exactIdentity = state.identity && receipt.after.nativeIdentity
415
+ && state.identity.packageId === receipt.after.nativeIdentity.packageId
416
+ && (state.identity.registrationId === receipt.after.nativeIdentity.registrationId || binding.route === 'grok-cli')
417
+ && state.identity.sourceLocation === receipt.after.nativeIdentity.sourceLocation;
418
+ const verified = exactIdentity && (effect.kind === 'register' && state.before.registration === 'absent' && receipt.after.registration === 'present' && nativeContentReady
419
+ || effect.kind === 'unregister' && state.before.registration === 'present' && receipt.after.registration === 'absent'
420
+ || effect.kind === 'activate' && state.before.consumers.some((item) => item.activation === 'disabled')
421
+ && receipt.after.consumers.length > 0 && receipt.after.consumers.every((item) => item.activation === 'enabled')
422
+ || effect.kind === 'deactivate' && state.before.consumers.some((item) => item.activation === 'enabled')
423
+ && receipt.after.consumers.length > 0 && receipt.after.consumers.every((item) => item.activation === 'disabled'));
424
+ if (verified) {
425
+ result.status = 'applied';
426
+ result.mutation = 'confirmed';
427
+ result.diagnostics = [{ ...lifecycleDiagnostic(binding, 'nativeMutationConfirmedByPostcheck', 'The native command did not complete normally. The final state confirms this action.'), severity: 'warning' }];
428
+ const gapPrefix = `execution:${effect.id}:`;
429
+ receipt.unmet = receipt.unmet.filter((gap) => !gap.id.startsWith(gapPrefix));
430
+ const sharedKey = nativeLifecycleEffectKey(binding, effect);
431
+ if (sharedKey)
432
+ ctx.nativeEffects?.set(sharedKey, Promise.resolve({ mutation: 'confirmed', changed: true }));
433
+ }
434
+ }
435
+ if ((plan.operation === 'ensure' || plan.operation === 'reinstall') && plan.expected.components.length) {
436
+ const untrusted = receipt.after.consumers.filter((consumer) => consumer.trust === 'required' || consumer.trust === 'blocked');
437
+ if (untrusted.length) {
438
+ receipt.diagnostics.push(lifecycleDiagnostic(binding, 'nativeTrustRequired', 'The package was prepared, but the host has not trusted this deployment. Complete trust in the host and retry.'));
439
+ const productIds = untrusted.map((consumer) => consumer.productId);
440
+ for (const component of plan.expected.components)
441
+ receipt.unmet.push({
442
+ id: `trust:${binding.id}:${component.id}`, componentId: component.id, kind: component.kind,
443
+ requiredFeatures: [], reasonCode: 'nativeTrustRequired', productIds,
444
+ });
445
+ }
446
+ }
447
+ if (receipt.effects.some((effect) => effect.mutation !== 'none'))
448
+ receipt.reload = routeReload(binding.route);
449
+ receipt.diagnostics.push(...receipt.after.diagnostics);
450
+ return receipt;
451
+ }
452
+ //# sourceMappingURL=lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../src/platforms/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAQ7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1I,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAiBnE,MAAM,UAAU,mBAAmB,CAAC,OAA0B,EAAE,IAAY,EAAE,OAAe;IAC3F,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO;QACvC,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;AAC1G,CAAC;AACD,SAAS,aAAa,CAAC,SAAyB;IAC9C,OAAO,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC;AACD,SAAS,uBAAuB,CAAC,SAAyB;IACxD,IAAI,MAAM,IAAI,SAAS;QAAE,OAAO,SAAS,CAAC,IAAI,CAAC;IAC/C,IAAI,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC;QAAE,OAAO,IAAI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AAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACvD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type ProducerIdentity } from '@lesliechan721/aw-plugin-core/manifest';
2
+ import type { PhysicalIdentity } from './contracts.js';
3
+ /** Verify the frozen physical identity against the fixed final layout, not the caller's current client home. */
4
+ export declare function verifyManagedCommandPlacement(options: {
5
+ producer: ProducerIdentity;
6
+ resourceRoot: string;
7
+ env?: NodeJS.ProcessEnv;
8
+ }): Promise<PhysicalIdentity>;
@@ -0,0 +1,79 @@
1
+ import path from 'node:path';
2
+ import fs from 'fs-extra';
3
+ import { normalizeProducerIdentity } from '@lesliechan721/aw-plugin-core/manifest';
4
+ import { readSkillOwnerMarker } from '../utils/ownership.js';
5
+ import { readStrictNamespacedMarketplaceRoot } from '../utils/local-marketplace.js';
6
+ import { getDeploymentLayout, getInstallRoute } from './layout.js';
7
+ import { getPhysicalKey } from './identity.js';
8
+ function invalid() { throw new Error('commandOwnerMismatch: The native Skill does not match its verified deployment placement.'); }
9
+ /** Verify the frozen physical identity against the fixed final layout, not the caller's current client home. */
10
+ export async function verifyManagedCommandPlacement(options) {
11
+ const producer = normalizeProducerIdentity(options.producer);
12
+ if (producer.kind === 'package' || !producer.platform || !producer.placementKey)
13
+ invalid();
14
+ const resourceRoot = path.resolve(options.resourceRoot);
15
+ if (await fs.realpath(resourceRoot) !== resourceRoot)
16
+ invalid();
17
+ let ancestor = path.parse(resourceRoot).root;
18
+ for (const segment of path.relative(ancestor, resourceRoot).split(path.sep)) {
19
+ ancestor = path.join(ancestor, segment);
20
+ const stat = await fs.lstat(ancestor);
21
+ if (!stat.isDirectory() || stat.isSymbolicLink())
22
+ invalid();
23
+ }
24
+ if (path.basename(path.dirname(resourceRoot)) !== 'skills')
25
+ invalid();
26
+ const packageRoot = path.dirname(path.dirname(resourceRoot));
27
+ const marker = await readSkillOwnerMarker({ skillRoot: packageRoot, allowedRoot: path.dirname(packageRoot) });
28
+ if (!marker || marker.sourceIdentity !== producer.sourceIdentity || marker.physicalKey !== producer.placementKey
29
+ || marker.sourceId !== producer.sourceId || marker.pluginId !== `${producer.sourceId}/${producer.pluginName}` || marker.plugin !== producer.pluginName
30
+ || marker.platform !== producer.platform || marker.scope !== producer.scope || marker.artifactKey !== path.basename(packageRoot))
31
+ invalid();
32
+ const physical = marker.nativeProjection?.physicalIdentity;
33
+ if (!physical || physical.sourceIdentity !== producer.sourceIdentity || physical.pluginId !== marker.pluginId
34
+ || physical.platform !== producer.platform || getPhysicalKey(physical) !== producer.placementKey)
35
+ invalid();
36
+ const directoryRoute = ['antigravity-directory', 'opencode-directory', 'grok-directory'].includes(physical.route);
37
+ if (directoryRoute && path.basename(physical.namespaceRoot) !== 'plugins')
38
+ invalid();
39
+ const configRoot = directoryRoute ? path.dirname(physical.namespaceRoot) : physical.namespaceRoot;
40
+ const scope = producer.scope === 'user' ? { kind: 'user' } : { kind: 'project', projectRoot: producer.projectRoot };
41
+ // This entry only reconstructs a previously verified layout. It claims no current client availability.
42
+ const product = { id: 'frozen-placement', product: directoryRoute ? 'app' : 'cli', version: null,
43
+ availability: 'unknown', reasonCodes: [], entry: directoryRoute ? { kind: 'directory', configRoot } : { kind: 'cli', executable: '', configRoot } };
44
+ if (getInstallRoute(producer.platform, scope, product) !== physical.route)
45
+ invalid();
46
+ const binding = { id: '', plugin: { sourceId: producer.sourceId, sourceIdentity: producer.sourceIdentity,
47
+ pluginId: marker.pluginId, version: '0.0.0' }, platform: producer.platform, scope, route: physical.route,
48
+ consumers: [product], physicalKey: producer.placementKey, activationKey: '', renderUnitIds: [] };
49
+ const ctx = { cwd: producer.projectRoot ?? configRoot, env: options.env };
50
+ const layout = await getDeploymentLayout(ctx, binding);
51
+ if (layout.packageRoot !== packageRoot || getPhysicalKey(layout.physicalIdentity) !== producer.placementKey)
52
+ invalid();
53
+ if (layout.marketplaceRoot) {
54
+ if (binding.platform !== 'codex' && binding.platform !== 'claude' && binding.platform !== 'copilot')
55
+ invalid();
56
+ const source = await readStrictNamespacedMarketplaceRoot({ rootDir: layout.marketplaceRoot,
57
+ trustedMarketplaceRoot: path.dirname(layout.marketplaceRoot), platform: binding.platform,
58
+ sourceId: producer.sourceId, sourceIdentity: producer.sourceIdentity, marketplaceName: layout.marketplaceName });
59
+ if (!source)
60
+ invalid();
61
+ const entries = source.manifest.plugins.filter((entry) => entry && typeof entry === 'object'
62
+ && 'name' in entry && entry.name === producer.pluginName);
63
+ if (entries.length !== 1 || !('source' in entries[0])
64
+ || entries[0].source !== `./plugins/${producer.pluginName}`)
65
+ invalid();
66
+ }
67
+ const componentId = producer.kind === 'static-skill' ? `skill:${producer.key}` : producer.key;
68
+ const components = marker.nativeProjection.components.filter((component) => component.id === componentId);
69
+ if (components.length !== 1)
70
+ invalid();
71
+ const component = components[0];
72
+ if (path.basename(resourceRoot) !== component.nativeName || !component.relativeOutputs.includes(`skills/${component.nativeName}/SKILL.md`))
73
+ invalid();
74
+ const skill = await fs.lstat(path.join(resourceRoot, 'SKILL.md'));
75
+ if (!skill.isFile() || skill.isSymbolicLink())
76
+ invalid();
77
+ return layout.physicalIdentity;
78
+ }
79
+ //# sourceMappingURL=managed-command-placement.js.map