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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (829) hide show
  1. package/dist/authoring/assets/aw-config.mjs +100 -501
  2. package/dist/authoring/assets/aw-config.mjs.map +1 -1
  3. package/dist/authoring/assets/aw-runtime-config.d.mts +13 -0
  4. package/dist/authoring/assets/aw-runtime-config.mjs +221 -0
  5. package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
  6. package/dist/authoring/assets/command-runtime-config.d.mts +9 -0
  7. package/dist/authoring/assets/command-runtime-config.mjs +134 -0
  8. package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
  9. package/dist/authoring/scripts/add-skill.mjs +15 -38
  10. package/dist/authoring/scripts/add-skill.mjs.map +1 -1
  11. package/dist/authoring/scripts/init-plugin.mjs +72 -96
  12. package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
  13. package/dist/authoring/scripts/lib/plugin-root.mjs +4 -4
  14. package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
  15. package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
  16. package/dist/authoring/scripts/lib/plugin-version-check.mjs +230 -9
  17. package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
  18. package/dist/authoring/scripts/lib/skill-scaffold.d.mts +2 -2
  19. package/dist/authoring/scripts/lib/skill-scaffold.mjs +4 -7
  20. package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
  21. package/dist/authoring/scripts/remove-plugin.mjs +1 -1
  22. package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
  23. package/dist/authoring/scripts/validate-plugin.mjs +416 -1995
  24. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  25. package/dist/authoring/scripts/validate-skill.mjs +1 -1
  26. package/dist/index.js +2 -6
  27. package/dist/index.js.map +1 -1
  28. package/dist/native-runtime/reader-runtime.mjs +34 -0
  29. package/dist/native-runtime/reader.d.mts +6 -0
  30. package/dist/native-runtime/reader.mjs +11 -0
  31. package/dist/scripts/aw-skill-eval-materializer.d.ts +11 -1
  32. package/dist/scripts/aw-skill-eval-materializer.js +118 -115
  33. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
  34. package/dist/scripts/bundle-plugins.js +25 -7
  35. package/dist/scripts/bundle-plugins.js.map +1 -1
  36. package/dist/scripts/plugin-staging.d.ts +7 -7
  37. package/dist/scripts/plugin-staging.js +10 -8
  38. package/dist/scripts/plugin-staging.js.map +1 -1
  39. package/dist/scripts/plugin-test-reporter.d.mts +2 -0
  40. package/dist/scripts/plugin-test-reporter.mjs +21 -0
  41. package/dist/scripts/plugin-test-reporter.mjs.map +1 -0
  42. package/dist/scripts/test-plugin-scripts.d.ts +5 -0
  43. package/dist/scripts/test-plugin-scripts.js +284 -78
  44. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  45. package/dist/scripts/test-workers.d.mts +24 -0
  46. package/dist/scripts/test-workers.mjs +59 -0
  47. package/dist/scripts/test-workers.mjs.map +1 -0
  48. package/dist/src/adapters/helpers.d.ts +7 -0
  49. package/dist/src/adapters/helpers.js.map +1 -1
  50. package/dist/src/authoring/workspace-commands.d.ts +3 -0
  51. package/dist/src/authoring/workspace-commands.js +7 -2
  52. package/dist/src/authoring/workspace-commands.js.map +1 -1
  53. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  54. package/dist/src/commands/aw-capabilities.js +42 -21
  55. package/dist/src/commands/aw-capabilities.js.map +1 -1
  56. package/dist/src/commands/catalog-dev-source.d.ts +42 -3
  57. package/dist/src/commands/catalog-dev-source.js +351 -43
  58. package/dist/src/commands/catalog-dev-source.js.map +1 -1
  59. package/dist/src/commands/catalog-generation.d.ts +8 -0
  60. package/dist/src/commands/catalog-generation.js +1 -5
  61. package/dist/src/commands/catalog-generation.js.map +1 -1
  62. package/dist/src/commands/catalog-publication-inspection.d.ts +42 -3
  63. package/dist/src/commands/catalog-publication-inspection.js +379 -48
  64. package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
  65. package/dist/src/commands/catalog-publication-journal.d.ts +23 -4
  66. package/dist/src/commands/catalog-publication-journal.js +165 -20
  67. package/dist/src/commands/catalog-publication-journal.js.map +1 -1
  68. package/dist/src/commands/catalog-publish.d.ts +34 -3
  69. package/dist/src/commands/catalog-publish.js +311 -165
  70. package/dist/src/commands/catalog-publish.js.map +1 -1
  71. package/dist/src/commands/catalog-source.d.ts +54 -8
  72. package/dist/src/commands/catalog-source.js +277 -15
  73. package/dist/src/commands/catalog-source.js.map +1 -1
  74. package/dist/src/commands/catalog-status.js +2 -2
  75. package/dist/src/commands/catalog-status.js.map +1 -1
  76. package/dist/src/commands/catalog-store.d.ts +104 -0
  77. package/dist/src/commands/catalog-store.js +685 -0
  78. package/dist/src/commands/catalog-store.js.map +1 -0
  79. package/dist/src/commands/catalog-workspace-resolution.d.ts +4 -0
  80. package/dist/src/commands/catalog-workspace-resolution.js +18 -3
  81. package/dist/src/commands/catalog-workspace-resolution.js.map +1 -1
  82. package/dist/src/commands/console.js +33 -20
  83. package/dist/src/commands/console.js.map +1 -1
  84. package/dist/src/commands/dependency-operation-plan.d.ts +14 -56
  85. package/dist/src/commands/dependency-operation-plan.js +90 -133
  86. package/dist/src/commands/dependency-operation-plan.js.map +1 -1
  87. package/dist/src/commands/deployment-confirmation.d.ts +11 -0
  88. package/dist/src/commands/deployment-confirmation.js +88 -0
  89. package/dist/src/commands/deployment-confirmation.js.map +1 -0
  90. package/dist/src/commands/init.js +1 -1
  91. package/dist/src/commands/init.js.map +1 -1
  92. package/dist/src/commands/intent-command.d.ts +34 -0
  93. package/dist/src/commands/intent-command.js +174 -0
  94. package/dist/src/commands/intent-command.js.map +1 -0
  95. package/dist/src/commands/lifecycle-command-package.d.ts +45 -0
  96. package/dist/src/commands/lifecycle-command-package.js +199 -0
  97. package/dist/src/commands/lifecycle-command-package.js.map +1 -0
  98. package/dist/src/commands/managed-commands.d.ts +41 -0
  99. package/dist/src/commands/managed-commands.js +404 -0
  100. package/dist/src/commands/managed-commands.js.map +1 -0
  101. package/dist/src/commands/offline-cleanup-evidence.d.ts +29 -3
  102. package/dist/src/commands/offline-cleanup-evidence.js +80 -10
  103. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
  104. package/dist/src/commands/operation-plan.d.ts +191 -0
  105. package/dist/src/commands/operation-plan.js +96 -0
  106. package/dist/src/commands/operation-plan.js.map +1 -0
  107. package/dist/src/commands/operation-planner.d.ts +47 -0
  108. package/dist/src/commands/operation-planner.js +142 -0
  109. package/dist/src/commands/operation-planner.js.map +1 -0
  110. package/dist/src/commands/options.d.ts +11 -20
  111. package/dist/src/commands/options.js +31 -36
  112. package/dist/src/commands/options.js.map +1 -1
  113. package/dist/src/commands/permission-batch.d.ts +5 -0
  114. package/dist/src/commands/permission-batch.js +80 -0
  115. package/dist/src/commands/permission-batch.js.map +1 -0
  116. package/dist/src/commands/plugin-capabilities.js +96 -46
  117. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  118. package/dist/src/commands/public-config-confirmation.d.ts +14 -0
  119. package/dist/src/commands/public-config-confirmation.js +73 -0
  120. package/dist/src/commands/public-config-confirmation.js.map +1 -0
  121. package/dist/src/commands/public-interruption.d.ts +9 -0
  122. package/dist/src/commands/public-interruption.js +23 -0
  123. package/dist/src/commands/public-interruption.js.map +1 -0
  124. package/dist/src/commands/public-lifecycle-result.d.ts +106 -0
  125. package/dist/src/commands/public-lifecycle-result.js +518 -0
  126. package/dist/src/commands/public-lifecycle-result.js.map +1 -0
  127. package/dist/src/commands/public-lifecycle.d.ts +27 -0
  128. package/dist/src/commands/public-lifecycle.js +563 -0
  129. package/dist/src/commands/public-lifecycle.js.map +1 -0
  130. package/dist/src/commands/public-plugin-query.d.ts +16 -0
  131. package/dist/src/commands/public-plugin-query.js +230 -0
  132. package/dist/src/commands/public-plugin-query.js.map +1 -0
  133. package/dist/src/commands/rebuild-command.d.ts +176 -25
  134. package/dist/src/commands/rebuild-command.js +3989 -1392
  135. package/dist/src/commands/rebuild-command.js.map +1 -1
  136. package/dist/src/commands/rebuild-integration.d.ts +133 -52
  137. package/dist/src/commands/rebuild-integration.js +1097 -2692
  138. package/dist/src/commands/rebuild-integration.js.map +1 -1
  139. package/dist/src/commands/rebuild-operations.d.ts +74 -23
  140. package/dist/src/commands/rebuild-operations.js +334 -227
  141. package/dist/src/commands/rebuild-operations.js.map +1 -1
  142. package/dist/src/commands/rebuild-platform-integration.d.ts +81 -0
  143. package/dist/src/commands/rebuild-platform-integration.js +1992 -0
  144. package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
  145. package/dist/src/commands/reconcile-operation-plan.d.ts +31 -0
  146. package/dist/src/commands/reconcile-operation-plan.js +48 -0
  147. package/dist/src/commands/reconcile-operation-plan.js.map +1 -0
  148. package/dist/src/commands/review-inspection.d.ts +60 -0
  149. package/dist/src/commands/review-inspection.js +436 -0
  150. package/dist/src/commands/review-inspection.js.map +1 -0
  151. package/dist/src/commands/review-preparation.d.ts +51 -0
  152. package/dist/src/commands/review-preparation.js +400 -0
  153. package/dist/src/commands/review-preparation.js.map +1 -0
  154. package/dist/src/commands/runtime.d.ts +6 -6
  155. package/dist/src/commands/runtime.js +44 -24
  156. package/dist/src/commands/runtime.js.map +1 -1
  157. package/dist/src/commands/skill-eval.d.ts +8 -0
  158. package/dist/src/commands/skill-eval.js +126 -73
  159. package/dist/src/commands/skill-eval.js.map +1 -1
  160. package/dist/src/commands/status-v6.d.ts +185 -68
  161. package/dist/src/commands/status-v6.js +1592 -499
  162. package/dist/src/commands/status-v6.js.map +1 -1
  163. package/dist/src/commands/targets-command.d.ts +38 -0
  164. package/dist/src/commands/targets-command.js +182 -0
  165. package/dist/src/commands/targets-command.js.map +1 -0
  166. package/dist/src/commands/wizard.d.ts +8 -5
  167. package/dist/src/commands/wizard.js +7 -4
  168. package/dist/src/commands/wizard.js.map +1 -1
  169. package/dist/src/commands/write-commands.d.ts +9 -3
  170. package/dist/src/commands/write-commands.js +144 -44
  171. package/dist/src/commands/write-commands.js.map +1 -1
  172. package/dist/src/constants.d.ts +2 -3
  173. package/dist/src/constants.js +2 -3
  174. package/dist/src/constants.js.map +1 -1
  175. package/dist/src/eval/manifest-v1.d.ts +6 -2
  176. package/dist/src/eval/manifest-v1.js +58 -26
  177. package/dist/src/eval/manifest-v1.js.map +1 -1
  178. package/dist/src/generators/local-plugin.d.ts +4 -2
  179. package/dist/src/generators/local-plugin.js +207 -346
  180. package/dist/src/generators/local-plugin.js.map +1 -1
  181. package/dist/src/generators/permissions.d.ts +20 -2
  182. package/dist/src/generators/permissions.js +82 -15
  183. package/dist/src/generators/permissions.js.map +1 -1
  184. package/dist/src/index.d.ts +3 -33
  185. package/dist/src/index.js +1786 -1945
  186. package/dist/src/index.js.map +1 -1
  187. package/dist/src/intent/deployment-preferences.d.ts +63 -0
  188. package/dist/src/intent/deployment-preferences.js +170 -0
  189. package/dist/src/intent/deployment-preferences.js.map +1 -0
  190. package/dist/src/intent/diagnostics.d.ts +11 -0
  191. package/dist/src/intent/diagnostics.js +14 -0
  192. package/dist/src/intent/diagnostics.js.map +1 -0
  193. package/dist/src/intent/intent-codec.d.ts +19 -0
  194. package/dist/src/intent/intent-codec.js +117 -0
  195. package/dist/src/intent/intent-codec.js.map +1 -0
  196. package/dist/src/intent/intent-store.d.ts +43 -0
  197. package/dist/src/intent/intent-store.js +118 -0
  198. package/dist/src/intent/intent-store.js.map +1 -0
  199. package/dist/src/intent/scope-context.d.ts +35 -0
  200. package/dist/src/intent/scope-context.js +179 -0
  201. package/dist/src/intent/scope-context.js.map +1 -0
  202. package/dist/src/intent/work-context.d.ts +13 -0
  203. package/dist/src/intent/work-context.js +22 -0
  204. package/dist/src/intent/work-context.js.map +1 -0
  205. package/dist/src/output/command-receipt.d.ts +37 -86
  206. package/dist/src/output/command-receipt.js +257 -179
  207. package/dist/src/output/command-receipt.js.map +1 -1
  208. package/dist/src/output/component-delivery.d.ts +28 -0
  209. package/dist/src/output/component-delivery.js +138 -0
  210. package/dist/src/output/component-delivery.js.map +1 -0
  211. package/dist/src/output/public-result.d.ts +69 -0
  212. package/dist/src/output/public-result.js +403 -0
  213. package/dist/src/output/public-result.js.map +1 -0
  214. package/dist/src/output/rebuild-progress.d.ts +3 -0
  215. package/dist/src/output/rebuild-progress.js +34 -16
  216. package/dist/src/output/rebuild-progress.js.map +1 -1
  217. package/dist/src/output/receipt-projection.d.ts +7 -0
  218. package/dist/src/output/receipt-projection.js +664 -0
  219. package/dist/src/output/receipt-projection.js.map +1 -0
  220. package/dist/src/output/skill-invocation-notices.d.ts +18 -0
  221. package/dist/src/output/skill-invocation-notices.js +84 -0
  222. package/dist/src/output/skill-invocation-notices.js.map +1 -0
  223. package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
  224. package/dist/src/platforms/antigravity-permissions.js +388 -0
  225. package/dist/src/platforms/antigravity-permissions.js.map +1 -0
  226. package/dist/src/platforms/capabilities.d.ts +17 -0
  227. package/dist/src/platforms/capabilities.js +328 -0
  228. package/dist/src/platforms/capabilities.js.map +1 -0
  229. package/dist/src/platforms/contracts.d.ts +402 -0
  230. package/dist/src/platforms/contracts.js +2 -0
  231. package/dist/src/platforms/contracts.js.map +1 -0
  232. package/dist/src/platforms/cursor-workspace-hook.d.ts +28 -0
  233. package/dist/src/platforms/cursor-workspace-hook.js +198 -0
  234. package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
  235. package/dist/src/platforms/discovery.d.ts +98 -0
  236. package/dist/src/platforms/discovery.js +777 -0
  237. package/dist/src/platforms/discovery.js.map +1 -0
  238. package/dist/src/platforms/grok-permission-config.d.ts +23 -0
  239. package/dist/src/platforms/grok-permission-config.js +184 -0
  240. package/dist/src/platforms/grok-permission-config.js.map +1 -0
  241. package/dist/src/platforms/grok-permission-document.d.ts +4 -0
  242. package/dist/src/platforms/grok-permission-document.js +145 -0
  243. package/dist/src/platforms/grok-permission-document.js.map +1 -0
  244. package/dist/src/platforms/grok-permissions.d.ts +17 -0
  245. package/dist/src/platforms/grok-permissions.js +311 -0
  246. package/dist/src/platforms/grok-permissions.js.map +1 -0
  247. package/dist/src/platforms/host-permission-policy.d.ts +38 -0
  248. package/dist/src/platforms/host-permission-policy.js +86 -0
  249. package/dist/src/platforms/host-permission-policy.js.map +1 -0
  250. package/dist/src/platforms/identity.d.ts +4 -0
  251. package/dist/src/platforms/identity.js +22 -0
  252. package/dist/src/platforms/identity.js.map +1 -0
  253. package/dist/src/platforms/inspection-grok.d.ts +4 -0
  254. package/dist/src/platforms/inspection-grok.js +366 -0
  255. package/dist/src/platforms/inspection-grok.js.map +1 -0
  256. package/dist/src/platforms/inspection-native.d.ts +6 -0
  257. package/dist/src/platforms/inspection-native.js +373 -0
  258. package/dist/src/platforms/inspection-native.js.map +1 -0
  259. package/dist/src/platforms/inspection-opencode.d.ts +4 -0
  260. package/dist/src/platforms/inspection-opencode.js +98 -0
  261. package/dist/src/platforms/inspection-opencode.js.map +1 -0
  262. package/dist/src/platforms/inspection-pi.d.ts +9 -0
  263. package/dist/src/platforms/inspection-pi.js +482 -0
  264. package/dist/src/platforms/inspection-pi.js.map +1 -0
  265. package/dist/src/platforms/inspection-query.d.ts +24 -0
  266. package/dist/src/platforms/inspection-query.js +119 -0
  267. package/dist/src/platforms/inspection-query.js.map +1 -0
  268. package/dist/src/platforms/inspection.d.ts +20 -0
  269. package/dist/src/platforms/inspection.js +259 -0
  270. package/dist/src/platforms/inspection.js.map +1 -0
  271. package/dist/src/platforms/layout.d.ts +35 -0
  272. package/dist/src/platforms/layout.js +317 -0
  273. package/dist/src/platforms/layout.js.map +1 -0
  274. package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
  275. package/dist/src/platforms/lifecycle-native-services.js +147 -0
  276. package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
  277. package/dist/src/platforms/lifecycle-native.d.ts +14 -0
  278. package/dist/src/platforms/lifecycle-native.js +223 -0
  279. package/dist/src/platforms/lifecycle-native.js.map +1 -0
  280. package/dist/src/platforms/lifecycle.d.ts +27 -0
  281. package/dist/src/platforms/lifecycle.js +567 -0
  282. package/dist/src/platforms/lifecycle.js.map +1 -0
  283. package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
  284. package/dist/src/platforms/opencode-permission-config.js +253 -0
  285. package/dist/src/platforms/opencode-permission-config.js.map +1 -0
  286. package/dist/src/platforms/opencode-permissions.d.ts +39 -0
  287. package/dist/src/platforms/opencode-permissions.js +212 -0
  288. package/dist/src/platforms/opencode-permissions.js.map +1 -0
  289. package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
  290. package/dist/src/platforms/opencode-related-permissions.js +177 -0
  291. package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
  292. package/dist/src/platforms/permission-ownership.d.ts +89 -0
  293. package/dist/src/platforms/permission-ownership.js +543 -0
  294. package/dist/src/platforms/permission-ownership.js.map +1 -0
  295. package/dist/src/platforms/permission-sidecar.d.ts +70 -0
  296. package/dist/src/platforms/permission-sidecar.js +215 -0
  297. package/dist/src/platforms/permission-sidecar.js.map +1 -0
  298. package/dist/src/platforms/projection-code-extension.d.ts +8 -0
  299. package/dist/src/platforms/projection-code-extension.js +126 -0
  300. package/dist/src/platforms/projection-code-extension.js.map +1 -0
  301. package/dist/src/platforms/projection-command-resources.d.ts +7 -0
  302. package/dist/src/platforms/projection-command-resources.js +74 -0
  303. package/dist/src/platforms/projection-command-resources.js.map +1 -0
  304. package/dist/src/platforms/projection-files.d.ts +27 -0
  305. package/dist/src/platforms/projection-files.js +111 -0
  306. package/dist/src/platforms/projection-files.js.map +1 -0
  307. package/dist/src/platforms/projection-marketplace.d.ts +19 -0
  308. package/dist/src/platforms/projection-marketplace.js +42 -0
  309. package/dist/src/platforms/projection-marketplace.js.map +1 -0
  310. package/dist/src/platforms/projection.d.ts +13 -0
  311. package/dist/src/platforms/projection.js +576 -0
  312. package/dist/src/platforms/projection.js.map +1 -0
  313. package/dist/src/platforms/registry.d.ts +4 -0
  314. package/dist/src/platforms/registry.js +30 -0
  315. package/dist/src/platforms/registry.js.map +1 -0
  316. package/dist/src/platforms/supplement-layout.d.ts +20 -0
  317. package/dist/src/platforms/supplement-layout.js +53 -0
  318. package/dist/src/platforms/supplement-layout.js.map +1 -0
  319. package/dist/src/platforms/supplement-state.d.ts +13 -0
  320. package/dist/src/platforms/supplement-state.js +93 -0
  321. package/dist/src/platforms/supplement-state.js.map +1 -0
  322. package/dist/src/portable/commands.d.ts +58 -11
  323. package/dist/src/portable/commands.js +99 -345
  324. package/dist/src/portable/commands.js.map +1 -1
  325. package/dist/src/portable/historical-materialization.d.ts +22 -0
  326. package/dist/src/portable/historical-materialization.js +124 -0
  327. package/dist/src/portable/historical-materialization.js.map +1 -0
  328. package/dist/src/portable/materializer.d.ts +29 -1
  329. package/dist/src/portable/materializer.js +197 -258
  330. package/dist/src/portable/materializer.js.map +1 -1
  331. package/dist/src/portable/recovery-layout.d.ts +17 -0
  332. package/dist/src/portable/recovery-layout.js +42 -0
  333. package/dist/src/portable/recovery-layout.js.map +1 -0
  334. package/dist/src/portable/recovery.d.ts +176 -0
  335. package/dist/src/portable/recovery.js +556 -0
  336. package/dist/src/portable/recovery.js.map +1 -0
  337. package/dist/src/portable/writer.d.ts +67 -0
  338. package/dist/src/portable/writer.js +321 -0
  339. package/dist/src/portable/writer.js.map +1 -0
  340. package/dist/src/recovery/coordinator.d.ts +168 -0
  341. package/dist/src/recovery/coordinator.js +1558 -0
  342. package/dist/src/recovery/coordinator.js.map +1 -0
  343. package/dist/src/recovery/demand.d.ts +53 -0
  344. package/dist/src/recovery/demand.js +189 -0
  345. package/dist/src/recovery/demand.js.map +1 -0
  346. package/dist/src/recovery/install-concurrency.d.ts +48 -0
  347. package/dist/src/recovery/install-concurrency.js +196 -0
  348. package/dist/src/recovery/install-concurrency.js.map +1 -0
  349. package/dist/src/recovery/interruption.d.ts +19 -0
  350. package/dist/src/recovery/interruption.js +43 -0
  351. package/dist/src/recovery/interruption.js.map +1 -0
  352. package/dist/src/recovery/joint-coordinator.d.ts +46 -0
  353. package/dist/src/recovery/joint-coordinator.js +1641 -0
  354. package/dist/src/recovery/joint-coordinator.js.map +1 -0
  355. package/dist/src/recovery/joint-demand.d.ts +72 -0
  356. package/dist/src/recovery/joint-demand.js +332 -0
  357. package/dist/src/recovery/joint-demand.js.map +1 -0
  358. package/dist/src/recovery/joint-install-execution.d.ts +19 -0
  359. package/dist/src/recovery/joint-install-execution.js +308 -0
  360. package/dist/src/recovery/joint-install-execution.js.map +1 -0
  361. package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
  362. package/dist/src/recovery/joint-install-native-rebase.js +67 -0
  363. package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
  364. package/dist/src/recovery/performance.d.ts +4 -0
  365. package/dist/src/recovery/performance.js +26 -0
  366. package/dist/src/recovery/performance.js.map +1 -0
  367. package/dist/src/recovery/receipt.d.ts +129 -0
  368. package/dist/src/recovery/receipt.js +91 -0
  369. package/dist/src/recovery/receipt.js.map +1 -0
  370. package/dist/src/recovery/retirement.d.ts +47 -0
  371. package/dist/src/recovery/retirement.js +463 -0
  372. package/dist/src/recovery/retirement.js.map +1 -0
  373. package/dist/src/recovery/status.d.ts +143 -0
  374. package/dist/src/recovery/status.js +1517 -0
  375. package/dist/src/recovery/status.js.map +1 -0
  376. package/dist/src/recovery/types.d.ts +85 -0
  377. package/dist/src/recovery/types.js +2 -0
  378. package/dist/src/recovery/types.js.map +1 -0
  379. package/dist/src/review/eval-source-input.d.ts +44 -0
  380. package/dist/src/review/eval-source-input.js +213 -0
  381. package/dist/src/review/eval-source-input.js.map +1 -0
  382. package/dist/src/review/platform-profile.d.ts +6 -0
  383. package/dist/src/review/platform-profile.js +24 -0
  384. package/dist/src/review/platform-profile.js.map +1 -0
  385. package/dist/src/review/review-profile.d.ts +20 -0
  386. package/dist/src/review/review-profile.js +276 -0
  387. package/dist/src/review/review-profile.js.map +1 -0
  388. package/dist/src/review/review-selection.d.ts +20 -0
  389. package/dist/src/review/review-selection.js +502 -0
  390. package/dist/src/review/review-selection.js.map +1 -0
  391. package/dist/src/review/review-types.d.ts +71 -0
  392. package/dist/src/review/review-types.js +16 -0
  393. package/dist/src/review/review-types.js.map +1 -0
  394. package/dist/src/review/skill-materialization.d.ts +65 -0
  395. package/dist/src/review/skill-materialization.js +228 -0
  396. package/dist/src/review/skill-materialization.js.map +1 -0
  397. package/dist/src/review/source-binding.d.ts +201 -0
  398. package/dist/src/review/source-binding.js +782 -0
  399. package/dist/src/review/source-binding.js.map +1 -0
  400. package/dist/src/tui/agent-management.d.ts +23 -0
  401. package/dist/src/tui/agent-management.js +319 -0
  402. package/dist/src/tui/agent-management.js.map +1 -0
  403. package/dist/src/tui/agent-settings.d.ts +47 -0
  404. package/dist/src/tui/agent-settings.js +97 -0
  405. package/dist/src/tui/agent-settings.js.map +1 -0
  406. package/dist/src/tui/catalog-freshness.d.ts +1 -0
  407. package/dist/src/tui/catalog-freshness.js +2 -0
  408. package/dist/src/tui/catalog-freshness.js.map +1 -0
  409. package/dist/src/tui/catalog-generation.d.ts +8 -16
  410. package/dist/src/tui/catalog-generation.js +97 -10
  411. package/dist/src/tui/catalog-generation.js.map +1 -1
  412. package/dist/src/tui/catalog-sources/projection.d.ts +4 -0
  413. package/dist/src/tui/catalog-sources/projection.js +17 -0
  414. package/dist/src/tui/catalog-sources/projection.js.map +1 -0
  415. package/dist/src/tui/catalog-sources/review.d.ts +3 -0
  416. package/dist/src/tui/catalog-sources/review.js +13 -0
  417. package/dist/src/tui/catalog-sources/review.js.map +1 -0
  418. package/dist/src/tui/catalog-sources/screens.d.ts +12 -0
  419. package/dist/src/tui/catalog-sources/screens.js +40 -0
  420. package/dist/src/tui/catalog-sources/screens.js.map +1 -0
  421. package/dist/src/tui/catalog-sources/session.d.ts +32 -0
  422. package/dist/src/tui/catalog-sources/session.js +300 -0
  423. package/dist/src/tui/catalog-sources/session.js.map +1 -0
  424. package/dist/src/tui/catalog-sources/types.d.ts +54 -0
  425. package/dist/src/tui/catalog-sources/types.js +2 -0
  426. package/dist/src/tui/catalog-sources/types.js.map +1 -0
  427. package/dist/src/tui/catalog-store-task.d.ts +16 -0
  428. package/dist/src/tui/catalog-store-task.js +19 -0
  429. package/dist/src/tui/catalog-store-task.js.map +1 -0
  430. package/dist/src/tui/clipboard.d.ts +13 -0
  431. package/dist/src/tui/clipboard.js +95 -0
  432. package/dist/src/tui/clipboard.js.map +1 -0
  433. package/dist/src/tui/components.d.ts +113 -3
  434. package/dist/src/tui/components.js +201 -34
  435. package/dist/src/tui/components.js.map +1 -1
  436. package/dist/src/tui/config-array-draft.d.ts +30 -0
  437. package/dist/src/tui/config-array-draft.js +51 -0
  438. package/dist/src/tui/config-array-draft.js.map +1 -0
  439. package/dist/src/tui/config-leaf-editor.d.ts +44 -0
  440. package/dist/src/tui/config-leaf-editor.js +227 -0
  441. package/dist/src/tui/config-leaf-editor.js.map +1 -0
  442. package/dist/src/tui/config-object-suggestions.d.ts +15 -0
  443. package/dist/src/tui/config-object-suggestions.js +71 -0
  444. package/dist/src/tui/config-object-suggestions.js.map +1 -0
  445. package/dist/src/tui/config-references.d.ts +38 -0
  446. package/dist/src/tui/config-references.js +82 -0
  447. package/dist/src/tui/config-references.js.map +1 -0
  448. package/dist/src/tui/config-suggestions.d.ts +27 -0
  449. package/dist/src/tui/config-suggestions.js +62 -0
  450. package/dist/src/tui/config-suggestions.js.map +1 -0
  451. package/dist/src/tui/config-value-presentation.d.ts +21 -0
  452. package/dist/src/tui/config-value-presentation.js +129 -0
  453. package/dist/src/tui/config-value-presentation.js.map +1 -0
  454. package/dist/src/tui/console-app-v4.d.ts +14 -5
  455. package/dist/src/tui/console-app-v4.js +10344 -2133
  456. package/dist/src/tui/console-app-v4.js.map +1 -1
  457. package/dist/src/tui/content-item-card.d.ts +13 -0
  458. package/dist/src/tui/content-item-card.js +51 -0
  459. package/dist/src/tui/content-item-card.js.map +1 -0
  460. package/dist/src/tui/controller-runtime.d.ts +8 -3
  461. package/dist/src/tui/controller-runtime.js +2301 -842
  462. package/dist/src/tui/controller-runtime.js.map +1 -1
  463. package/dist/src/tui/controller.d.ts +664 -79
  464. package/dist/src/tui/controller.js +3670 -830
  465. package/dist/src/tui/controller.js.map +1 -1
  466. package/dist/src/tui/dependency-graph-view.d.ts +39 -0
  467. package/dist/src/tui/dependency-graph-view.js +121 -0
  468. package/dist/src/tui/dependency-graph-view.js.map +1 -0
  469. package/dist/src/tui/dependency-graph.d.ts +81 -0
  470. package/dist/src/tui/dependency-graph.js +452 -0
  471. package/dist/src/tui/dependency-graph.js.map +1 -0
  472. package/dist/src/tui/deployment-view.d.ts +13 -0
  473. package/dist/src/tui/deployment-view.js +155 -0
  474. package/dist/src/tui/deployment-view.js.map +1 -0
  475. package/dist/src/tui/diagnostic-projection.d.ts +31 -0
  476. package/dist/src/tui/diagnostic-projection.js +681 -0
  477. package/dist/src/tui/diagnostic-projection.js.map +1 -0
  478. package/dist/src/tui/diagnostics.d.ts +6 -2
  479. package/dist/src/tui/diagnostics.js +14 -2
  480. package/dist/src/tui/diagnostics.js.map +1 -1
  481. package/dist/src/tui/entity-cards.d.ts +56 -0
  482. package/dist/src/tui/entity-cards.js +321 -0
  483. package/dist/src/tui/entity-cards.js.map +1 -0
  484. package/dist/src/tui/glossary.d.ts +25 -0
  485. package/dist/src/tui/glossary.js +78 -0
  486. package/dist/src/tui/glossary.js.map +1 -0
  487. package/dist/src/tui/guided-setup.d.ts +25 -0
  488. package/dist/src/tui/guided-setup.js +101 -0
  489. package/dist/src/tui/guided-setup.js.map +1 -0
  490. package/dist/src/tui/index.d.ts +5 -1
  491. package/dist/src/tui/index.js +4 -1
  492. package/dist/src/tui/index.js.map +1 -1
  493. package/dist/src/tui/input-display.d.ts +1 -0
  494. package/dist/src/tui/input-display.js +23 -1
  495. package/dist/src/tui/input-display.js.map +1 -1
  496. package/dist/src/tui/keys.d.ts +44 -0
  497. package/dist/src/tui/keys.js +43 -15
  498. package/dist/src/tui/keys.js.map +1 -1
  499. package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
  500. package/dist/src/tui/lifecycle-action-view.js +36 -0
  501. package/dist/src/tui/lifecycle-action-view.js.map +1 -0
  502. package/dist/src/tui/model.d.ts +187 -52
  503. package/dist/src/tui/model.js +1202 -426
  504. package/dist/src/tui/model.js.map +1 -1
  505. package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
  506. package/dist/src/tui/operation-diagnostic-screens.js +76 -0
  507. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
  508. package/dist/src/tui/operation-history.d.ts +91 -0
  509. package/dist/src/tui/operation-history.js +167 -0
  510. package/dist/src/tui/operation-history.js.map +1 -0
  511. package/dist/src/tui/operation-review-planner.d.ts +28 -0
  512. package/dist/src/tui/operation-review-planner.js +1456 -0
  513. package/dist/src/tui/operation-review-planner.js.map +1 -0
  514. package/dist/src/tui/plugin-content.d.ts +33 -0
  515. package/dist/src/tui/plugin-content.js +245 -0
  516. package/dist/src/tui/plugin-content.js.map +1 -0
  517. package/dist/src/tui/plugin-detail.d.ts +75 -0
  518. package/dist/src/tui/plugin-detail.js +267 -0
  519. package/dist/src/tui/plugin-detail.js.map +1 -0
  520. package/dist/src/tui/plugin-write-task.d.ts +69 -0
  521. package/dist/src/tui/plugin-write-task.js +286 -0
  522. package/dist/src/tui/plugin-write-task.js.map +1 -0
  523. package/dist/src/tui/prompt.js +4 -15
  524. package/dist/src/tui/prompt.js.map +1 -1
  525. package/dist/src/tui/query-header.d.ts +30 -0
  526. package/dist/src/tui/query-header.js +40 -0
  527. package/dist/src/tui/query-header.js.map +1 -0
  528. package/dist/src/tui/reader.d.ts +38 -0
  529. package/dist/src/tui/reader.js +49 -0
  530. package/dist/src/tui/reader.js.map +1 -0
  531. package/dist/src/tui/router.d.ts +182 -39
  532. package/dist/src/tui/router.js +338 -50
  533. package/dist/src/tui/router.js.map +1 -1
  534. package/dist/src/tui/scoped-flow.d.ts +49 -0
  535. package/dist/src/tui/scoped-flow.js +212 -0
  536. package/dist/src/tui/scoped-flow.js.map +1 -0
  537. package/dist/src/tui/scoped-inventory.d.ts +131 -0
  538. package/dist/src/tui/scoped-inventory.js +280 -0
  539. package/dist/src/tui/scoped-inventory.js.map +1 -0
  540. package/dist/src/tui/screen-registry.d.ts +696 -0
  541. package/dist/src/tui/screen-registry.js +226 -0
  542. package/dist/src/tui/screen-registry.js.map +1 -0
  543. package/dist/src/tui/session-console-app.d.ts +8 -0
  544. package/dist/src/tui/session-console-app.js +24 -0
  545. package/dist/src/tui/session-console-app.js.map +1 -0
  546. package/dist/src/tui/session-host.d.ts +45 -0
  547. package/dist/src/tui/session-host.js +219 -0
  548. package/dist/src/tui/session-host.js.map +1 -0
  549. package/dist/src/tui/source-detail-card.d.ts +29 -0
  550. package/dist/src/tui/source-detail-card.js +45 -0
  551. package/dist/src/tui/source-detail-card.js.map +1 -0
  552. package/dist/src/tui/theme.d.ts +12 -0
  553. package/dist/src/tui/theme.js +12 -0
  554. package/dist/src/tui/theme.js.map +1 -1
  555. package/dist/src/tui/viewport.d.ts +1 -0
  556. package/dist/src/tui/viewport.js +23 -0
  557. package/dist/src/tui/viewport.js.map +1 -1
  558. package/dist/src/tui/wizard.js +37 -13
  559. package/dist/src/tui/wizard.js.map +1 -1
  560. package/dist/src/types.d.ts +177 -85
  561. package/dist/src/types.js +1 -0
  562. package/dist/src/types.js.map +1 -1
  563. package/dist/src/utils/agent-version.d.ts +10 -4
  564. package/dist/src/utils/agent-version.js +6 -8
  565. package/dist/src/utils/agent-version.js.map +1 -1
  566. package/dist/src/utils/artifact-plan.d.ts +17 -24
  567. package/dist/src/utils/artifact-plan.js +59 -436
  568. package/dist/src/utils/artifact-plan.js.map +1 -1
  569. package/dist/src/utils/artifact-renderer.d.ts +61 -89
  570. package/dist/src/utils/artifact-renderer.js +187 -364
  571. package/dist/src/utils/artifact-renderer.js.map +1 -1
  572. package/dist/src/utils/artifact-request.d.ts +21 -0
  573. package/dist/src/utils/artifact-request.js +57 -0
  574. package/dist/src/utils/artifact-request.js.map +1 -0
  575. package/dist/src/utils/artifact-sources.d.ts +4 -8
  576. package/dist/src/utils/artifact-sources.js +15 -6
  577. package/dist/src/utils/artifact-sources.js.map +1 -1
  578. package/dist/src/utils/aw-home-mutation-lock.js +2 -1
  579. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  580. package/dist/src/utils/bundle-layout.js +59 -173
  581. package/dist/src/utils/bundle-layout.js.map +1 -1
  582. package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
  583. package/dist/src/utils/catalog-capability-projection.js +14 -0
  584. package/dist/src/utils/catalog-capability-projection.js.map +1 -0
  585. package/dist/src/utils/catalog-digests.d.ts +2 -9
  586. package/dist/src/utils/catalog-digests.js +7 -45
  587. package/dist/src/utils/catalog-digests.js.map +1 -1
  588. package/dist/src/utils/catalog-generation-error.d.ts +4 -1
  589. package/dist/src/utils/catalog-generation-error.js +2 -0
  590. package/dist/src/utils/catalog-generation-error.js.map +1 -1
  591. package/dist/src/utils/catalog-generation-resolver.d.ts +32 -3
  592. package/dist/src/utils/catalog-generation-resolver.js +182 -40
  593. package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
  594. package/dist/src/utils/catalog-generation-service.d.ts +142 -2
  595. package/dist/src/utils/catalog-generation-service.js +1146 -171
  596. package/dist/src/utils/catalog-generation-service.js.map +1 -1
  597. package/dist/src/utils/catalog-generation-state.d.ts +5 -0
  598. package/dist/src/utils/catalog-generation-state.js +25 -1
  599. package/dist/src/utils/catalog-generation-state.js.map +1 -1
  600. package/dist/src/utils/catalog-generation-store.d.ts +29 -2
  601. package/dist/src/utils/catalog-generation-store.js +240 -36
  602. package/dist/src/utils/catalog-generation-store.js.map +1 -1
  603. package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
  604. package/dist/src/utils/{catalog-manifest-v6.js → catalog-manifest-v7.js} +23 -23
  605. package/dist/src/utils/{catalog-manifest-v6.js.map → catalog-manifest-v7.js.map} +1 -1
  606. package/dist/src/utils/catalog-operation-context.d.ts +27 -3
  607. package/dist/src/utils/catalog-operation-context.js +75 -4
  608. package/dist/src/utils/catalog-operation-context.js.map +1 -1
  609. package/dist/src/utils/catalog-public-error.js +7 -0
  610. package/dist/src/utils/catalog-public-error.js.map +1 -1
  611. package/dist/src/utils/catalog-runtime-projection.d.ts +4 -3
  612. package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
  613. package/dist/src/utils/catalog-snapshot.d.ts +5 -2
  614. package/dist/src/utils/catalog-snapshot.js +4 -1
  615. package/dist/src/utils/catalog-snapshot.js.map +1 -1
  616. package/dist/src/utils/catalog-source-impact.d.ts +21 -0
  617. package/dist/src/utils/catalog-source-impact.js +344 -0
  618. package/dist/src/utils/catalog-source-impact.js.map +1 -0
  619. package/dist/src/utils/catalog-source-references.d.ts +22 -8
  620. package/dist/src/utils/catalog-source-references.js +457 -365
  621. package/dist/src/utils/catalog-source-references.js.map +1 -1
  622. package/dist/src/utils/catalog-sources.d.ts +14 -1
  623. package/dist/src/utils/catalog-sources.js +155 -11
  624. package/dist/src/utils/catalog-sources.js.map +1 -1
  625. package/dist/src/utils/codex-executable-discovery.d.ts +28 -0
  626. package/dist/src/utils/codex-executable-discovery.js +431 -0
  627. package/dist/src/utils/codex-executable-discovery.js.map +1 -0
  628. package/dist/src/utils/codex-manager.d.ts +23 -42
  629. package/dist/src/utils/codex-manager.js +79 -767
  630. package/dist/src/utils/codex-manager.js.map +1 -1
  631. package/dist/src/utils/codex-marketplace-path.d.ts +5 -0
  632. package/dist/src/utils/codex-marketplace-path.js +45 -0
  633. package/dist/src/utils/codex-marketplace-path.js.map +1 -0
  634. package/dist/src/utils/codex-native-observation.d.ts +55 -0
  635. package/dist/src/utils/codex-native-observation.js +198 -0
  636. package/dist/src/utils/codex-native-observation.js.map +1 -0
  637. package/dist/src/utils/codex-reconciler.d.ts +6 -14
  638. package/dist/src/utils/codex-reconciler.js +45 -50
  639. package/dist/src/utils/codex-reconciler.js.map +1 -1
  640. package/dist/src/utils/codex-shared-native.d.ts +28 -39
  641. package/dist/src/utils/codex-shared-native.js +92 -57
  642. package/dist/src/utils/codex-shared-native.js.map +1 -1
  643. package/dist/src/utils/codex-skill-staging.d.ts +4 -3
  644. package/dist/src/utils/codex-skill-staging.js.map +1 -1
  645. package/dist/src/utils/codex-skills-root.d.ts +4 -0
  646. package/dist/src/utils/codex-skills-root.js +25 -0
  647. package/dist/src/utils/codex-skills-root.js.map +1 -0
  648. package/dist/src/utils/codex-surface-analysis.d.ts +8 -3
  649. package/dist/src/utils/codex-surface-analysis.js +35 -62
  650. package/dist/src/utils/codex-surface-analysis.js.map +1 -1
  651. package/dist/src/utils/component-command-preparation.d.ts +31 -0
  652. package/dist/src/utils/component-command-preparation.js +127 -0
  653. package/dist/src/utils/component-command-preparation.js.map +1 -0
  654. package/dist/src/utils/component-gap.d.ts +4 -0
  655. package/dist/src/utils/component-gap.js +20 -0
  656. package/dist/src/utils/component-gap.js.map +1 -0
  657. package/dist/src/utils/component-resources.d.ts +51 -0
  658. package/dist/src/utils/component-resources.js +320 -0
  659. package/dist/src/utils/component-resources.js.map +1 -0
  660. package/dist/src/utils/config-platforms.d.ts +21 -0
  661. package/dist/src/utils/config-platforms.js +51 -0
  662. package/dist/src/utils/config-platforms.js.map +1 -0
  663. package/dist/src/utils/dynamic-skill-tree.d.ts +18 -6
  664. package/dist/src/utils/dynamic-skill-tree.js +33 -40
  665. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  666. package/dist/src/utils/git-catalog-provider.d.ts +16 -0
  667. package/dist/src/utils/git-catalog-provider.js +112 -6
  668. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  669. package/dist/src/utils/inventory-recovery-diagnostic.d.ts +4 -0
  670. package/dist/src/utils/inventory-recovery-diagnostic.js +15 -0
  671. package/dist/src/utils/inventory-recovery-diagnostic.js.map +1 -0
  672. package/dist/src/utils/local-marketplace.d.ts +17 -12
  673. package/dist/src/utils/local-marketplace.js +85 -195
  674. package/dist/src/utils/local-marketplace.js.map +1 -1
  675. package/dist/src/utils/managed-command-cli-review.d.ts +53 -0
  676. package/dist/src/utils/managed-command-cli-review.js +431 -0
  677. package/dist/src/utils/managed-command-cli-review.js.map +1 -0
  678. package/dist/src/utils/managed-command-closure.d.ts +14 -0
  679. package/dist/src/utils/managed-command-closure.js +156 -0
  680. package/dist/src/utils/managed-command-closure.js.map +1 -0
  681. package/dist/src/utils/managed-command-errors.d.ts +5 -0
  682. package/dist/src/utils/managed-command-errors.js +10 -0
  683. package/dist/src/utils/managed-command-errors.js.map +1 -0
  684. package/dist/src/utils/managed-command-materialization.d.ts +90 -0
  685. package/dist/src/utils/managed-command-materialization.js +375 -0
  686. package/dist/src/utils/managed-command-materialization.js.map +1 -0
  687. package/dist/src/utils/managed-command-preparation.d.ts +30 -0
  688. package/dist/src/utils/managed-command-preparation.js +39 -0
  689. package/dist/src/utils/managed-command-preparation.js.map +1 -0
  690. package/dist/src/utils/managed-command-review.d.ts +33 -0
  691. package/dist/src/utils/managed-command-review.js +80 -0
  692. package/dist/src/utils/managed-command-review.js.map +1 -0
  693. package/dist/src/utils/managed-command-runtime.d.ts +36 -0
  694. package/dist/src/utils/managed-command-runtime.js +126 -0
  695. package/dist/src/utils/managed-command-runtime.js.map +1 -0
  696. package/dist/src/utils/managed-command-snapshots.d.ts +24 -0
  697. package/dist/src/utils/managed-command-snapshots.js +89 -0
  698. package/dist/src/utils/managed-command-snapshots.js.map +1 -0
  699. package/dist/src/utils/managed-command-store.d.ts +141 -0
  700. package/dist/src/utils/managed-command-store.js +839 -0
  701. package/dist/src/utils/managed-command-store.js.map +1 -0
  702. package/dist/src/utils/multi-source-catalog.d.ts +4 -0
  703. package/dist/src/utils/multi-source-catalog.js +7 -3
  704. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  705. package/dist/src/utils/native-cli-interruption.d.ts +8 -0
  706. package/dist/src/utils/native-cli-interruption.js +65 -0
  707. package/dist/src/utils/native-cli-interruption.js.map +1 -0
  708. package/dist/src/utils/native-cli.d.ts +37 -6
  709. package/dist/src/utils/native-cli.js +523 -60
  710. package/dist/src/utils/native-cli.js.map +1 -1
  711. package/dist/src/utils/native-demand.d.ts +29 -0
  712. package/dist/src/utils/native-demand.js +4 -0
  713. package/dist/src/utils/native-demand.js.map +1 -0
  714. package/dist/src/utils/native-tool-context.d.ts +17 -0
  715. package/dist/src/utils/native-tool-context.js +40 -0
  716. package/dist/src/utils/native-tool-context.js.map +1 -0
  717. package/dist/src/utils/native-tool-review.d.ts +8 -0
  718. package/dist/src/utils/native-tool-review.js +14 -0
  719. package/dist/src/utils/native-tool-review.js.map +1 -0
  720. package/dist/src/utils/orphan-marketplace-cleanup.js +0 -2
  721. package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
  722. package/dist/src/utils/ownership.d.ts +111 -11
  723. package/dist/src/utils/ownership.js +247 -126
  724. package/dist/src/utils/ownership.js.map +1 -1
  725. package/dist/src/utils/package-content.d.ts +7 -0
  726. package/dist/src/utils/package-content.js +70 -0
  727. package/dist/src/utils/package-content.js.map +1 -0
  728. package/dist/src/utils/path-catalog-provider.js +2 -0
  729. package/dist/src/utils/path-catalog-provider.js.map +1 -1
  730. package/dist/src/utils/paths.d.ts +1 -1
  731. package/dist/src/utils/paths.js +5 -2
  732. package/dist/src/utils/paths.js.map +1 -1
  733. package/dist/src/utils/platform-empty-state.d.ts +69 -0
  734. package/dist/src/utils/platform-empty-state.js +226 -0
  735. package/dist/src/utils/platform-empty-state.js.map +1 -0
  736. package/dist/src/utils/platform-support.d.ts +1 -1
  737. package/dist/src/utils/platform-support.js +1 -1
  738. package/dist/src/utils/platform-support.js.map +1 -1
  739. package/dist/src/utils/plugin-config-command-apply.d.ts +33 -0
  740. package/dist/src/utils/plugin-config-command-apply.js +142 -0
  741. package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
  742. package/dist/src/utils/plugin-config-diagnostics.d.ts +16 -0
  743. package/dist/src/utils/plugin-config-diagnostics.js +44 -0
  744. package/dist/src/utils/plugin-config-diagnostics.js.map +1 -0
  745. package/dist/src/utils/plugin-config-impact.d.ts +75 -0
  746. package/dist/src/utils/plugin-config-impact.js +355 -0
  747. package/dist/src/utils/plugin-config-impact.js.map +1 -0
  748. package/dist/src/utils/plugin-config-references.d.ts +96 -0
  749. package/dist/src/utils/plugin-config-references.js +357 -0
  750. package/dist/src/utils/plugin-config-references.js.map +1 -0
  751. package/dist/src/utils/plugin-config-suggestion-runner.d.ts +83 -0
  752. package/dist/src/utils/plugin-config-suggestion-runner.js +308 -0
  753. package/dist/src/utils/plugin-config-suggestion-runner.js.map +1 -0
  754. package/dist/src/utils/plugin-config-suggestions.d.ts +50 -0
  755. package/dist/src/utils/plugin-config-suggestions.js +302 -0
  756. package/dist/src/utils/plugin-config-suggestions.js.map +1 -0
  757. package/dist/src/utils/plugin-config-write.d.ts +123 -31
  758. package/dist/src/utils/plugin-config-write.js +828 -399
  759. package/dist/src/utils/plugin-config-write.js.map +1 -1
  760. package/dist/src/utils/plugin-config.d.ts +192 -109
  761. package/dist/src/utils/plugin-config.js +970 -1150
  762. package/dist/src/utils/plugin-config.js.map +1 -1
  763. package/dist/src/utils/plugin-dependencies.d.ts +1 -1
  764. package/dist/src/utils/plugin-dependencies.js.map +1 -1
  765. package/dist/src/utils/plugin-scripts.d.ts +80 -127
  766. package/dist/src/utils/plugin-scripts.js +655 -524
  767. package/dist/src/utils/plugin-scripts.js.map +1 -1
  768. package/dist/src/utils/process-lock.js +14 -5
  769. package/dist/src/utils/process-lock.js.map +1 -1
  770. package/dist/src/utils/process-tree.d.ts +2 -2
  771. package/dist/src/utils/process-tree.js +1 -1
  772. package/dist/src/utils/process-tree.js.map +1 -1
  773. package/dist/src/utils/project-boundary.d.ts +11 -13
  774. package/dist/src/utils/project-boundary.js +28 -34
  775. package/dist/src/utils/project-boundary.js.map +1 -1
  776. package/dist/src/utils/rendered-contract.js +24 -1
  777. package/dist/src/utils/rendered-contract.js.map +1 -1
  778. package/dist/src/utils/runtime-config.d.ts +18 -0
  779. package/dist/src/utils/runtime-config.js +64 -0
  780. package/dist/src/utils/runtime-config.js.map +1 -0
  781. package/dist/src/utils/runtime-skill-closure.d.ts +2 -2
  782. package/dist/src/utils/runtime-skill-closure.js +47 -6
  783. package/dist/src/utils/runtime-skill-closure.js.map +1 -1
  784. package/dist/src/utils/safe-fs.d.ts +21 -0
  785. package/dist/src/utils/safe-fs.js +111 -0
  786. package/dist/src/utils/safe-fs.js.map +1 -0
  787. package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
  788. package/dist/src/utils/safe-operation-diagnostic.js +33 -0
  789. package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
  790. package/dist/src/utils/sensitive-content.d.ts +4 -0
  791. package/dist/src/utils/sensitive-content.js +36 -0
  792. package/dist/src/utils/sensitive-content.js.map +1 -0
  793. package/dist/src/utils/skill-invocation-warning.d.ts +20 -0
  794. package/dist/src/utils/skill-invocation-warning.js +68 -0
  795. package/dist/src/utils/skill-invocation-warning.js.map +1 -0
  796. package/dist/src/utils/state-paths.d.ts +8 -3
  797. package/dist/src/utils/state-paths.js +53 -16
  798. package/dist/src/utils/state-paths.js.map +1 -1
  799. package/dist/src/utils/target-eligibility.d.ts +3 -3
  800. package/dist/src/utils/target-eligibility.js +11 -6
  801. package/dist/src/utils/target-eligibility.js.map +1 -1
  802. package/dist/src/utils/windows-claude-shim.d.ts +7 -0
  803. package/dist/src/utils/windows-claude-shim.js +10 -0
  804. package/dist/src/utils/windows-claude-shim.js.map +1 -0
  805. package/dist/src/utils/windows-npm-shim.d.ts +16 -0
  806. package/dist/src/utils/windows-npm-shim.js +155 -0
  807. package/dist/src/utils/windows-npm-shim.js.map +1 -0
  808. package/dist/vitest.config.js +106 -9
  809. package/dist/vitest.config.js.map +1 -1
  810. package/package.json +30 -21
  811. package/dist/src/commands/review-publication.d.ts +0 -99
  812. package/dist/src/commands/review-publication.js +0 -904
  813. package/dist/src/commands/review-publication.js.map +0 -1
  814. package/dist/src/commands/sync-command.d.ts +0 -21
  815. package/dist/src/commands/sync-command.js +0 -206
  816. package/dist/src/commands/sync-command.js.map +0 -1
  817. package/dist/src/portable/skills-cli.d.ts +0 -43
  818. package/dist/src/portable/skills-cli.js +0 -148
  819. package/dist/src/portable/skills-cli.js.map +0 -1
  820. package/dist/src/utils/catalog-manifest-v6.d.ts +0 -5
  821. package/dist/src/utils/lifecycle-active-store.d.ts +0 -147
  822. package/dist/src/utils/lifecycle-active-store.js +0 -1064
  823. package/dist/src/utils/lifecycle-active-store.js.map +0 -1
  824. package/dist/src/utils/plugin-intent-state.d.ts +0 -39
  825. package/dist/src/utils/plugin-intent-state.js +0 -325
  826. package/dist/src/utils/plugin-intent-state.js.map +0 -1
  827. package/dist/src/utils/slash-commands.d.ts +0 -1
  828. package/dist/src/utils/slash-commands.js +0 -2
  829. package/dist/src/utils/slash-commands.js.map +0 -1
@@ -0,0 +1,431 @@
1
+ import { createHash } from 'node:crypto';
2
+ import * as fs from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { canonicalizeIdentityValue } from '@lesliechan721/aw-plugin-core/manifest';
5
+ import { managedCommandRouteIsReachable } from '../generators/permissions.js';
6
+ import { antigravityCommandTokens, readAntigravityGlobalPermissions } from '../platforms/antigravity-permissions.js';
7
+ import { grokPermissionMayApply, inspectGrokPermissionConfig } from '../platforms/grok-permission-config.js';
8
+ import { getOpenCodePermissionRoot } from '../platforms/layout.js';
9
+ import { openCodePermissionMayMatch, readOpenCodePermissionChain } from '../platforms/opencode-permissions.js';
10
+ import { readInstalledCommandProducer } from './managed-command-store.js';
11
+ import { getClaudeHome, getCodexHome, resolveRepoRoot } from './state-paths.js';
12
+ function selectLaunch(routes, word) {
13
+ const subcommand = routes?.subcommands.find(({ name }) => name === word);
14
+ if (!subcommand)
15
+ return routes?.fallback ? { route: 'fallback', launch: routes.fallback } : null;
16
+ const { name: _name, ...launch } = subcommand;
17
+ return { route: 'subcommand', launch };
18
+ }
19
+ function showLaunch(match) {
20
+ if (!match)
21
+ return null;
22
+ const { runner, entry, args, cwd } = match.launch;
23
+ return { route: match.route, runner, entry, args, cwd };
24
+ }
25
+ const codexDecisions = { allow: 'allow', prompt: 'ask', forbidden: 'deny' };
26
+ const codexRuleFields = ['pattern', 'decision', 'match', 'not_match', 'justification', 'canonical_matching'];
27
+ const codexStringEscapes = { a: '\x07', b: '\b', f: '\f', n: '\n', r: '\r', t: '\t', v: '\v' };
28
+ const codexToken = /"""(?:\\[\s\S]|(?!""")[^\\])*"""|'''(?:\\[\s\S]|(?!''')[^\\])*'''|"(?!"")(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?!'')(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'|#[^\r\n]*|\\(?:\r\n?|\n)|\r\n?|\n|[ \t]+|[A-Za-z_]\w*|[=!<>]=|(?:\/\/|<<|>>|[-+*/%&|^])=|[\s\S]/gu;
29
+ const codexSuiteHeaders = new Set(['def', 'for', 'if', 'elif', 'else']);
30
+ const codexClosingDelimiter = new Map([['(', ')'], ['[', ']'], ['{', '}']]);
31
+ // A newline inside a delimiter, string, or explicit continuation cannot begin a new statement.
32
+ function* codexStatements(contents) {
33
+ const closing = [];
34
+ let tokens = [];
35
+ let indent = 0;
36
+ let lineStart = true;
37
+ let inlineSuite = false;
38
+ let bindsRuleName = false;
39
+ function finishStatement() {
40
+ const statement = { tokens, indent, inlineSuite, bindsRuleName };
41
+ tokens = [];
42
+ bindsRuleName = false;
43
+ return statement;
44
+ }
45
+ for (const [token] of contents.matchAll(codexToken)) {
46
+ if (token.startsWith('#'))
47
+ continue;
48
+ if (/^[ \t]+$/u.test(token)) {
49
+ if (lineStart)
50
+ indent += token.length;
51
+ continue;
52
+ }
53
+ if (token === '\\\n' || token === '\\\r\n' || token === '\\\r') {
54
+ lineStart = false;
55
+ continue;
56
+ }
57
+ if (token === '\n' || token === '\r\n' || token === '\r') {
58
+ if (closing.length)
59
+ continue;
60
+ if (tokens.length)
61
+ yield finishStatement();
62
+ indent = 0;
63
+ lineStart = true;
64
+ inlineSuite = false;
65
+ continue;
66
+ }
67
+ lineStart = false;
68
+ if (token === '"' || token === "'") {
69
+ yield null;
70
+ return;
71
+ }
72
+ const first = tokens[0];
73
+ if (!closing.length) {
74
+ if (token === ':' && first !== undefined && codexSuiteHeaders.has(first) && !inlineSuite) {
75
+ bindsRuleName ||= first === 'def' && tokens[1] === 'prefix_rule';
76
+ yield finishStatement();
77
+ inlineSuite = true;
78
+ continue;
79
+ }
80
+ if (token === ';') {
81
+ if (tokens.length)
82
+ yield finishStatement();
83
+ continue;
84
+ }
85
+ if (/^(?:=|(?:\/\/|<<|>>|[-+*/%&|^])=)$/u.test(token) || (first === 'for' && token === 'in')) {
86
+ bindsRuleName ||= tokens.includes('prefix_rule');
87
+ }
88
+ }
89
+ const expected = codexClosingDelimiter.get(token);
90
+ if (expected)
91
+ closing.push(expected);
92
+ else if ((token === ')' || token === ']' || token === '}') && closing.pop() !== token) {
93
+ yield null;
94
+ return;
95
+ }
96
+ tokens.push(token);
97
+ }
98
+ if (closing.length)
99
+ yield null;
100
+ else if (tokens.length)
101
+ yield finishStatement();
102
+ }
103
+ function readCodexPrefixRule(tokens) {
104
+ let cursor = 0;
105
+ const unsupported = () => { throw new SyntaxError('Unsupported Codex rule syntax.'); };
106
+ const peek = () => tokens[cursor];
107
+ const expect = (token) => { if (peek() !== token)
108
+ unsupported(); cursor++; };
109
+ function readLiteral(depth = 0) {
110
+ const token = peek();
111
+ cursor++;
112
+ if (token === '[' && depth < 2) {
113
+ const values = [];
114
+ while (peek() !== ']') {
115
+ values.push(readLiteral(depth + 1));
116
+ if (peek() === ']')
117
+ break;
118
+ expect(',');
119
+ }
120
+ expect(']');
121
+ return values;
122
+ }
123
+ if (token === 'True' || token === 'False')
124
+ return token === 'True';
125
+ if (token && token.length >= 2 && (token[0] === '"' || token[0] === "'")) {
126
+ const quoteSize = token.startsWith(token[0].repeat(3)) ? 3 : 1;
127
+ return token.slice(quoteSize, -quoteSize).replace(/\\([\s\S])/gu, (_escape, character) => {
128
+ if (Object.hasOwn(codexStringEscapes, character))
129
+ return codexStringEscapes[character];
130
+ return '"\'\\'.includes(character) ? character : unsupported();
131
+ });
132
+ }
133
+ return unsupported();
134
+ }
135
+ try {
136
+ expect('prefix_rule');
137
+ expect('(');
138
+ const fields = new Map();
139
+ let positionalIndex = 0;
140
+ let named = false;
141
+ while (peek() !== ')') {
142
+ let field = codexRuleFields[positionalIndex++];
143
+ if (tokens[cursor + 1] === '=') {
144
+ field = tokens[cursor];
145
+ cursor += 2;
146
+ named = true;
147
+ }
148
+ else if (named)
149
+ unsupported();
150
+ if (!field || !codexRuleFields.includes(field) || fields.has(field))
151
+ unsupported();
152
+ fields.set(field, readLiteral());
153
+ if (peek() === ')')
154
+ break;
155
+ expect(',');
156
+ }
157
+ expect(')');
158
+ if (peek() !== undefined)
159
+ return undefined;
160
+ const pattern = fields.get('pattern');
161
+ const decision = fields.get('decision') ?? 'allow';
162
+ const isPatternToken = (value) => typeof value === 'string'
163
+ || (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === 'string'));
164
+ if (!Array.isArray(pattern) || !pattern.length || !pattern.every(isPatternToken)
165
+ || typeof decision !== 'string' || !Object.hasOwn(codexDecisions, decision)
166
+ || (fields.has('canonical_matching') && fields.get('canonical_matching') !== false))
167
+ return undefined;
168
+ return { action: codexDecisions[decision], pattern };
169
+ }
170
+ catch (error) {
171
+ if (!(error instanceof SyntaxError))
172
+ throw error;
173
+ return undefined;
174
+ }
175
+ }
176
+ // Inspect independent declarative calls. Other Starlark leaves the file partially unverified.
177
+ function readCodexPrefixRules(contents) {
178
+ const rules = [];
179
+ let incomplete = false;
180
+ let functionIndent;
181
+ for (const statement of codexStatements(contents)) {
182
+ if (!statement)
183
+ return { rules, incomplete: true };
184
+ const { tokens, indent, inlineSuite, bindsRuleName } = statement;
185
+ if (functionIndent !== undefined && (indent > functionIndent || (indent === functionIndent && inlineSuite)))
186
+ continue;
187
+ functionIndent = tokens[0] === 'def' ? indent : undefined;
188
+ // A module binding shadows the builtin throughout the file.
189
+ if (bindsRuleName)
190
+ return { rules: [], incomplete: true };
191
+ const rule = indent === 0 && !inlineSuite && tokens[0] === 'prefix_rule' ? readCodexPrefixRule(tokens) : undefined;
192
+ if (rule)
193
+ rules.push(rule);
194
+ else
195
+ incomplete = true;
196
+ }
197
+ return { rules, incomplete };
198
+ }
199
+ export function reviewInvocationPlatforms(record) {
200
+ return record && (record.requiresPlatformContext || record.runtimeConfigKeys?.length)
201
+ ? record.runtimeConfigPlatforms : undefined;
202
+ }
203
+ /** A broken snapshot hides public availability but leaves its verified producer routes reviewable. */
204
+ export async function reviewInstalledInvocationPlatforms(view) {
205
+ if (view?.requiresPlatformContext === null && view.routes && view.resourceRoot) {
206
+ return reviewInvocationPlatforms(await readInstalledCommandProducer(view.resourceRoot));
207
+ }
208
+ return reviewInvocationPlatforms(view);
209
+ }
210
+ export async function inspectManagedCommandRouteChanges(options) {
211
+ const { selector, before, after, cwd, env } = options;
212
+ const selectors = (platforms) => platforms
213
+ ? platforms.map((platform) => `${selector}/${platform}`) : [selector];
214
+ const oldSelectors = new Set(before && selectors(options.beforePlatforms));
215
+ const newSelectors = new Set(after && selectors(options.afterPlatforms));
216
+ const names = [...new Set([...before?.subcommands ?? [], ...after?.subcommands ?? []].map(({ name }) => name))].sort();
217
+ const invocations = [...new Set([...oldSelectors, ...newSelectors])].map((invocation) => {
218
+ const oldRoutes = oldSelectors.has(invocation) ? before : undefined;
219
+ const newRoutes = newSelectors.has(invocation) ? after : undefined;
220
+ const argv = ['aw', 'command', 'run', invocation, '--'];
221
+ const changed = (word) => canonicalizeIdentityValue(selectLaunch(oldRoutes, word)) !== canonicalizeIdentityValue(selectLaunch(newRoutes, word));
222
+ const changes = [...names, undefined].filter(changed).map((word) => ({
223
+ argv: word === undefined ? argv : [...argv, word],
224
+ before: showLaunch(selectLaunch(oldRoutes, word)),
225
+ after: showLaunch(selectLaunch(newRoutes, word)),
226
+ }));
227
+ return { argv, changed, changes, newRoutes };
228
+ });
229
+ const routeChanges = invocations.flatMap(({ changes }) => changes);
230
+ const review = {
231
+ routeChanges,
232
+ affectedPermissions: [],
233
+ permissionReadFailures: [],
234
+ otherProjects: 'unobserved',
235
+ ...(options.userOnly ? { userOnly: true } : {}),
236
+ existingApprovalsMayMatch: before === undefined && after !== undefined && routeChanges.length > 0,
237
+ };
238
+ if (routeChanges.length === 0 && !options.inspectInactiveRestrictions)
239
+ return review;
240
+ function add(platform, file, action, tokens, resourcePattern) {
241
+ if (!Array.isArray(tokens))
242
+ return;
243
+ for (const { argv, newRoutes, changes, changed } of invocations) {
244
+ if (!argv.slice(0, tokens.length).every((token, index) => token === tokens[index]))
245
+ continue;
246
+ const argsPrefix = tokens.slice(argv.length);
247
+ if (argsPrefix.some((token) => typeof token !== 'string' || (platform !== 'codex' && !/^[A-Za-z0-9_./:@%+=,-]+$/u.test(token))))
248
+ continue;
249
+ const inactive = options.inspectInactiveRestrictions && tokens.length >= argv.length
250
+ && (action === 'ask' || action === 'deny') && !managedCommandRouteIsReachable(newRoutes ?? null, argsPrefix);
251
+ if (inactive || (changes.length > 0 && (argsPrefix.length === 0 || changed(argsPrefix[0])))) {
252
+ review.affectedPermissions.push({ platform, path: file, action, argvPrefix: tokens,
253
+ ...(inactive ? { handlerUnavailable: true } : {}), ...(resourcePattern === undefined ? {} : { resourcePattern }) });
254
+ return;
255
+ }
256
+ }
257
+ }
258
+ function readFailure(error, file) {
259
+ if (error.code !== 'ENOENT')
260
+ review.permissionReadFailures.push(file);
261
+ }
262
+ const projectRoot = options.userOnly ? undefined : await resolveRepoRoot(cwd);
263
+ const claudeFiles = [path.join(getClaudeHome(env), 'settings.json')];
264
+ if (projectRoot)
265
+ claudeFiles.push(path.join(projectRoot, '.claude', 'settings.json'), path.join(projectRoot, '.claude', 'settings.local.json'));
266
+ for (const file of new Set(claudeFiles)) {
267
+ try {
268
+ const settings = JSON.parse(await fs.readFile(file, 'utf8'));
269
+ for (const action of ['allow', 'ask', 'deny', 'sandbox']) {
270
+ const entries = action === 'sandbox' ? settings.sandbox?.excludedCommands : settings.permissions?.[action];
271
+ if (!Array.isArray(entries))
272
+ continue;
273
+ for (const entry of entries) {
274
+ if (typeof entry !== 'string')
275
+ continue;
276
+ const body = action === 'sandbox' ? entry : /^Bash\((.*)\)$/u.exec(entry)?.[1];
277
+ if (body === undefined)
278
+ continue;
279
+ add('claude', file, action, body === '*' ? [] : body.replace(/(?: |:)\*$/u, '').split(' '));
280
+ }
281
+ }
282
+ }
283
+ catch (error) {
284
+ readFailure(error, file);
285
+ }
286
+ }
287
+ const codexDirectories = [path.join(getCodexHome(env), 'rules')];
288
+ if (projectRoot)
289
+ codexDirectories.push(path.join(projectRoot, '.codex', 'rules'));
290
+ const codexEvidence = createHash('sha256');
291
+ let hasCodexEvidence = false;
292
+ for (const directory of new Set(codexDirectories)) {
293
+ const files = await fs.readdir(directory, { withFileTypes: true }).catch((error) => { readFailure(error, directory); return []; });
294
+ for (const entry of files.sort((left, right) => left.name.localeCompare(right.name))) {
295
+ if (!entry.name.endsWith('.rules'))
296
+ continue;
297
+ const file = path.join(directory, entry.name);
298
+ if (entry.isSymbolicLink()) {
299
+ const target = await fs.readlink(file, { encoding: 'buffer' }).catch(() => undefined);
300
+ codexEvidence.update(JSON.stringify([file, 'symlink', target?.length ?? null]));
301
+ if (target)
302
+ codexEvidence.update(target);
303
+ hasCodexEvidence = true;
304
+ review.permissionReadFailures.push(file);
305
+ continue;
306
+ }
307
+ if (!entry.isFile())
308
+ continue;
309
+ try {
310
+ const bytes = await fs.readFile(file);
311
+ codexEvidence.update(JSON.stringify([file, bytes.length])).update(bytes);
312
+ hasCodexEvidence = true;
313
+ const { rules, incomplete } = readCodexPrefixRules(new TextDecoder('utf-8', { fatal: true }).decode(bytes));
314
+ if (incomplete)
315
+ review.permissionReadFailures.push(file);
316
+ for (const { action, pattern } of rules) {
317
+ const matchingPrefixes = new Map();
318
+ for (const { argv } of invocations) {
319
+ const fixed = argv.slice(0, pattern.length);
320
+ if (fixed.every((word, index) => typeof pattern[index] === 'string'
321
+ ? pattern[index] === word : pattern[index]?.includes(word)))
322
+ matchingPrefixes.set(fixed.join(' '), fixed);
323
+ }
324
+ for (const fixed of matchingPrefixes.values()) {
325
+ const [first, ...rest] = pattern.slice(fixed.length);
326
+ const resourcePattern = pattern.some(Array.isArray) ? JSON.stringify(pattern) : undefined;
327
+ if (first === undefined)
328
+ add('codex', file, action, fixed, resourcePattern);
329
+ else {
330
+ const tail = rest.map((token) => typeof token === 'string' ? token : token[0]);
331
+ for (const word of typeof first === 'string' ? [first] : new Set(first)) {
332
+ add('codex', file, action, [...fixed, word, ...tail], resourcePattern);
333
+ }
334
+ }
335
+ }
336
+ }
337
+ }
338
+ catch (error) {
339
+ readFailure(error, file);
340
+ }
341
+ }
342
+ }
343
+ if (hasCodexEvidence)
344
+ review.codexRulesDigest = codexEvidence.digest('hex');
345
+ const preferredArgv = (platform) => (invocations.find(({ argv }) => argv[3] === `${selector}/${platform}`) ?? invocations[0]).argv;
346
+ if (!invocations.length)
347
+ return review;
348
+ const ctx = { cwd, env };
349
+ const antigravity = await readAntigravityGlobalPermissions(ctx);
350
+ if (antigravity) {
351
+ if (antigravity.unreadable)
352
+ review.permissionReadFailures.push(antigravity.path);
353
+ for (const { effect, resource } of antigravity.rules) {
354
+ const literal = antigravityCommandTokens(resource);
355
+ if (literal)
356
+ add('antigravity', antigravity.path, effect, literal);
357
+ else if (resource.startsWith('command(') && routeChanges.length) {
358
+ const resourcePattern = resource === 'command(*)' ? resource : 'configured command pattern';
359
+ review.affectedPermissions.push({ platform: 'antigravity', path: antigravity.path, action: effect, argvPrefix: preferredArgv('antigravity'), resourcePattern });
360
+ }
361
+ }
362
+ }
363
+ const changedArgv = invocations.filter(({ changes }) => changes.length > 0).map(({ argv }) => argv);
364
+ if (changedArgv.length) {
365
+ const grok = await inspectGrokPermissionConfig(ctx, changedArgv, projectRoot);
366
+ const grokArgv = changedArgv.find((argv) => argv[3] === `${selector}/grok`);
367
+ for (const rule of grok.rules) {
368
+ const matches = (argv) => grokPermissionMayApply(rule.pattern, argv.join(' '));
369
+ const argvPrefix = grokArgv && matches(grokArgv) ? grokArgv : changedArgv.find(matches);
370
+ if (argvPrefix)
371
+ review.affectedPermissions.push({ platform: 'grok', action: rule.action, path: rule.path, argvPrefix, resourcePattern: rule.pattern });
372
+ }
373
+ review.permissionReadFailures.push(...grok.readFailures);
374
+ if (grok.unverifiedProjectPath)
375
+ review.unverifiedGrokProjectPath = grok.unverifiedProjectPath;
376
+ }
377
+ const hostConfigRoot = getOpenCodePermissionRoot(ctx);
378
+ const destinationRoot = projectRoot ?? hostConfigRoot;
379
+ if (!destinationRoot) {
380
+ review.permissionReadFailures.push('OPENCODE_CONFIG_DIR');
381
+ return review;
382
+ }
383
+ const destination = path.join(destinationRoot, 'opencode.json');
384
+ try {
385
+ const layers = await readOpenCodePermissionChain(ctx, destination, hostConfigRoot, projectRoot);
386
+ for (const { path: file, rule } of layers) {
387
+ if (!rule || typeof rule !== 'object') {
388
+ if (!review.permissionReadFailures.includes(file))
389
+ review.permissionReadFailures.push(file);
390
+ continue;
391
+ }
392
+ const { action, effect, resource = '*' } = rule;
393
+ if (effect !== 'allow' && effect !== 'ask' && effect !== 'deny' || typeof resource !== 'string')
394
+ continue;
395
+ if (!invocations.some(({ argv }) => openCodePermissionMayMatch(rule, argv)))
396
+ continue;
397
+ const literal = resource.replace(/ \*$/u, '').split(' ');
398
+ if ((action === 'shell' || action === '*') && literal.every((word) => /^[A-Za-z0-9_./:@%+=,-]+$/u.test(word))) {
399
+ add('opencode', file, effect, literal);
400
+ }
401
+ else if (routeChanges.some((change) => openCodePermissionMayMatch(rule, change.argv))) {
402
+ review.affectedPermissions.push({ platform: 'opencode', path: file, action: effect, argvPrefix: preferredArgv('opencode'), resourcePattern: resource });
403
+ }
404
+ }
405
+ }
406
+ catch (error) {
407
+ readFailure(error, destination);
408
+ }
409
+ return review;
410
+ }
411
+ export function describeManagedCommandRouteReview(review) {
412
+ const entry = (launch) => launch ? `${launch.route}: ${launch.runner} ${JSON.stringify([launch.entry, ...launch.args])} (cwd=${launch.cwd})` : 'unavailable';
413
+ return [
414
+ ...review.routeChanges.map(({ argv, before, after }) => `${argv.join(' ')} ${entry(before)} → ${entry(after)}`),
415
+ ...review.affectedPermissions.map(({ platform, path: file, action, argvPrefix, handlerUnavailable, resourcePattern }) => platform === 'antigravity'
416
+ ? `Antigravity CLI Global has ${action} ${JSON.stringify(resourcePattern ?? argvPrefix)} configured in ${file}.${handlerUnavailable ? ' This prefix has no executable handler.' : ''} The live approval decision remains unverified.`
417
+ : platform === 'grok' ? `Grok Build has a configured ${action} rule ${JSON.stringify(resourcePattern)} in ${file}. Its effective decision is unverified.`
418
+ : platform === 'codex' && resourcePattern
419
+ ? `codex ${action} ${JSON.stringify(argvPrefix)} from pattern ${resourcePattern} in ${file}.${handlerUnavailable ? ' This prefix has no executable handler.' : ' The rule may apply to a changed route.'}`
420
+ : `${platform} ${action} ${JSON.stringify(resourcePattern ?? argvPrefix)} in ${file}${handlerUnavailable ? ' remains enforced for this prefix, which has no executable handler.' : ' may apply to a changed route.'}`),
421
+ ...(review.unverifiedGrokProjectPath ? [`Grok project permissions in ${review.unverifiedGrokProjectPath} were left unread because project trust could not be verified.`] : []),
422
+ ...review.permissionReadFailures.map((file) => `Could not inspect permissions in ${file}.`),
423
+ ...(review.existingApprovalsMayMatch ? ['Existing approvals match the invocation text and can apply to this package after a source rebind.'] : []),
424
+ ...(review.routeChanges.length ? [review.userOnly ? 'Permission review covers user settings. Projects may carry matching approvals.'
425
+ : 'Permission review covers user settings and the current project. Other projects may carry matching approvals.'] : []),
426
+ ];
427
+ }
428
+ export function describeManagedCommandRuntimeConfigChanges(changes) {
429
+ return changes.map(({ platform, before, after }) => `Runtime configuration for ${platform}: ${JSON.stringify(before ?? null)} → ${JSON.stringify(after ?? null)}`);
430
+ }
431
+ //# sourceMappingURL=managed-command-cli-review.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"managed-command-cli-review.js","sourceRoot":"","sources":["../../../src/utils/managed-command-cli-review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAA6D,MAAM,wCAAwC,CAAC;AAE9I,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AACrH,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAC7G,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAC/G,OAAO,EAAE,4BAA4B,EAAkC,MAAM,4BAA4B,CAAC;AAC1G,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAwBhF,SAAS,YAAY,CAAC,MAAiC,EAAE,IAAwB;IAC/E,MAAM,UAAU,GAAG,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACzE,IAAI,CAAC,UAAU;QAAE,OAAO,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACjG,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,GAAG,UAAU,CAAC;IAC9C,OAAO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BAC1M,CAAC,CAAC,GAAG,QAAQ,IAAI,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,eAAe,IAAI,UAAU,CAAC,OAAO,IAAI,GAAG,kBAAkB,CAAC,CAAC,CAAC,qEAAqE,CAAC,CAAC,CAAC,gCAAgC,EAAE,CAAC;QAC5N,GAAG,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,+BAA+B,MAAM,CAAC,yBAAyB,gEAAgE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9K,GAAG,MAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,oCAAoC,IAAI,GAAG,CAAC;QAC3F,GAAG,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,mGAAmG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClJ,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,gFAAgF;gBAClI,CAAC,CAAC,8GAA8G,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1H,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0CAA0C,CAAC,OAA2E;IACpI,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CACjD,6BAA6B,QAAQ,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC;AACnH,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type CommandLaunch, type CommandRoutes, type NormalizedPluginManifest } from '@lesliechan721/aw-plugin-core/manifest';
2
+ import type { PluginMeta } from '../types.js';
3
+ export declare function commandRouteEntries(routes: CommandRoutes): CommandLaunch[];
4
+ /** Validate against the copied command package itself, without searching its plugin's dependencies. */
5
+ export declare function validateManagedCommandPackageClosure(resourceRoot: string, entries: readonly CommandLaunch[], injectedReaders?: readonly string[]): Promise<void>;
6
+ export declare function validateManagedCommandSourceClosure(pluginRoot: string, manifest: NormalizedPluginManifest): Promise<void>;
7
+ export declare function commandInputDigest(value: unknown): string;
8
+ export interface ManagedCommandSource {
9
+ sourceRoot: string;
10
+ sourceTreeDigest: string;
11
+ sourceContentDigest: string;
12
+ }
13
+ export declare function calculateManagedCommandResourceDigest(resourceRoot: string): Promise<string>;
14
+ export declare function readManagedCommandSource(plugin: PluginMeta): Promise<ManagedCommandSource>;
@@ -0,0 +1,156 @@
1
+ import { createHash } from 'node:crypto';
2
+ import path from 'node:path';
3
+ import fs from 'fs-extra';
4
+ import { canonicalizeIdentityValue, getCommandPackageInjectedReaders, validateCommandEntryFiles, validateManagedCommandSources, } from '@lesliechan721/aw-plugin-core/manifest';
5
+ import { listCatalogBundleFiles } from '@lesliechan721/aw-plugin-core';
6
+ import { resolveCommandSourceDirectory } from './artifact-sources.js';
7
+ import { calculateFileDigest } from './bundle-integrity.js';
8
+ import { ManagedCommandError } from './managed-command-errors.js';
9
+ import { scanNodeImportContract } from './plugin-script-contract.js';
10
+ const NODE_FILE = /\.[cm]?js$/iu;
11
+ export function commandRouteEntries(routes) {
12
+ return routes.fallback === undefined ? routes.subcommands : [...routes.subcommands, routes.fallback];
13
+ }
14
+ async function readCommandTree(root) {
15
+ const entries = [];
16
+ async function visit(relative) {
17
+ const location = path.join(root, relative);
18
+ const stat = await fs.lstat(location);
19
+ if (stat.isSymbolicLink() || (!stat.isDirectory() && !stat.isFile())) {
20
+ throw new ManagedCommandError('commandResourceInvalid', 'Command package resources must be ordinary files and directories.');
21
+ }
22
+ if (stat.isDirectory()) {
23
+ if (relative)
24
+ entries.push({ path: relative, mode: 0 });
25
+ for (const name of (await fs.readdir(location)).sort())
26
+ await visit(path.posix.join(relative, name));
27
+ }
28
+ else {
29
+ entries.push({ path: relative, mode: stat.mode & 0o111, digest: await calculateFileDigest(location) });
30
+ }
31
+ }
32
+ await visit('');
33
+ return entries;
34
+ }
35
+ /** Validate against the copied command package itself, without searching its plugin's dependencies. */
36
+ export async function validateManagedCommandPackageClosure(resourceRoot, entries, injectedReaders = []) {
37
+ await validateCommandEntryFiles(resourceRoot, entries);
38
+ const entryFiles = entries.filter((entry) => entry.runner === 'node').map((entry) => entry.entry);
39
+ if (entryFiles.length === 0)
40
+ return;
41
+ const filePaths = await listCatalogBundleFiles(resourceRoot);
42
+ const files = Object.fromEntries(injectedReaders.map((file) => [file, '']));
43
+ for (const relative of filePaths) {
44
+ const location = path.join(resourceRoot, relative);
45
+ if (!(await fs.lstat(location)).isFile())
46
+ throw new ManagedCommandError('commandResourceInvalid', 'Invalid command resource file.');
47
+ if (entryFiles.includes(relative) || NODE_FILE.test(relative) || path.posix.basename(relative) === 'package.json') {
48
+ files[relative] = await fs.readFile(location, 'utf8');
49
+ }
50
+ }
51
+ const scan = scanNodeImportContract({ files, filePaths, entryFiles });
52
+ if (scan.errors.length > 0)
53
+ throw new ManagedCommandError('commandResourceInvalid', `Invalid command package runtime imports:\n${scan.errors.join('\n')}`);
54
+ }
55
+ async function commandSourceRoot(pluginRoot, manifest) {
56
+ try {
57
+ await validateManagedCommandSources(pluginRoot, manifest);
58
+ return await resolveCommandSourceDirectory({ bundleRoot: pluginRoot, pluginRelativePath: manifest.command.sourceDir });
59
+ }
60
+ catch (error) {
61
+ throw new ManagedCommandError('commandResourceInvalid', error.message);
62
+ }
63
+ }
64
+ export async function validateManagedCommandSourceClosure(pluginRoot, manifest) {
65
+ const command = manifest.command;
66
+ if (!command)
67
+ return;
68
+ const resourceRoot = await commandSourceRoot(pluginRoot, manifest);
69
+ if (command.mode !== 'static')
70
+ return;
71
+ const readers = getCommandPackageInjectedReaders(manifest);
72
+ await validateManagedCommandPackageClosure(resourceRoot, commandRouteEntries(command.routes), readers?.paths);
73
+ }
74
+ function dependencyNames(value) {
75
+ return value && typeof value === 'object' && !Array.isArray(value) ? Object.keys(value) : [];
76
+ }
77
+ /** Use the same import contract as bundle generation to identify the renderer's transitive imports. */
78
+ async function rendererClosureDigest(plugin) {
79
+ const renderer = plugin.manifest.scripts?.artifacts?.render;
80
+ if (!renderer)
81
+ return undefined;
82
+ const bundleRoot = await fs.realpath(plugin.rootDir);
83
+ const entry = renderer.path.replace(/^\.\//u, '');
84
+ const allFiles = await listCatalogBundleFiles(bundleRoot);
85
+ const runtimeFiles = allFiles.filter((file) => !file.split('/').includes('node_modules'));
86
+ const runtimeFileSet = new Set(runtimeFiles);
87
+ const files = {};
88
+ for (const file of runtimeFiles) {
89
+ if (file !== entry && !NODE_FILE.test(file) && path.posix.basename(file) !== 'package.json')
90
+ continue;
91
+ const location = path.join(bundleRoot, file);
92
+ if ((await fs.lstat(location)).isFile())
93
+ files[file] = await fs.readFile(location, 'utf8');
94
+ }
95
+ const packageRoot = plugin.manifest.scripts?.node?.packageRoot?.replace(/^\.\//u, '');
96
+ const packageJson = packageRoot === undefined ? undefined : path.posix.join(packageRoot, 'package.json');
97
+ const packageInfo = packageJson === undefined ? {} : JSON.parse(files[packageJson] ?? '{}');
98
+ const scan = scanNodeImportContract({ files, filePaths: runtimeFiles, entryFiles: [entry],
99
+ dependencies: dependencyNames(packageInfo.dependencies), devDependencies: dependencyNames(packageInfo.devDependencies),
100
+ runtimeConfigSkillRoots: plugin.manifest.artifacts?.sourceDirs });
101
+ if (scan.errors.length)
102
+ throw new ManagedCommandError('commandResourceInvalid', `Invalid command renderer imports:\n${scan.errors.join('\n')}`);
103
+ const closure = new Set(scan.files);
104
+ for (const file of scan.files) {
105
+ let directory = path.posix.dirname(file);
106
+ while (true) {
107
+ const metadata = path.posix.join(directory, 'package.json');
108
+ if (runtimeFileSet.has(metadata))
109
+ closure.add(metadata);
110
+ if (directory === '.')
111
+ break;
112
+ directory = path.posix.dirname(directory);
113
+ }
114
+ }
115
+ if (packageRoot !== undefined && packageJson !== undefined && scan.bareSpecifiers.length) {
116
+ closure.add(packageJson);
117
+ const dependencyRoot = path.posix.join(packageRoot, 'node_modules');
118
+ for (const file of allFiles)
119
+ if (file.startsWith(`${dependencyRoot}/`))
120
+ closure.add(file);
121
+ }
122
+ const digests = [];
123
+ for (const file of [...closure].sort()) {
124
+ const location = path.join(bundleRoot, file);
125
+ const stat = await fs.lstat(location);
126
+ if (stat.isFile())
127
+ digests.push({ path: file, digest: await calculateFileDigest(location) });
128
+ else if (stat.isSymbolicLink() && file.split('/').includes('node_modules')) {
129
+ digests.push({ path: file, link: await fs.readlink(location) });
130
+ }
131
+ else
132
+ throw new ManagedCommandError('commandResourceInvalid', 'The command renderer closure contains an unsafe file.');
133
+ }
134
+ return commandInputDigest(digests);
135
+ }
136
+ export function commandInputDigest(value) {
137
+ return `sha256:${createHash('sha256').update(canonicalizeIdentityValue(value)).digest('hex')}`;
138
+ }
139
+ export async function calculateManagedCommandResourceDigest(resourceRoot) {
140
+ const root = await fs.lstat(resourceRoot);
141
+ if (!root.isDirectory())
142
+ throw new ManagedCommandError('commandResourceInvalid', 'The command source must be a regular directory.');
143
+ return commandInputDigest(await readCommandTree(resourceRoot));
144
+ }
145
+ export async function readManagedCommandSource(plugin) {
146
+ const declaration = plugin.manifest.command;
147
+ if (!declaration)
148
+ throw new ManagedCommandError('commandPackageDeclarationMissing', 'The active plugin does not declare a command package.');
149
+ const sourceRoot = await commandSourceRoot(plugin.rootDir, plugin.manifest);
150
+ const [sourceTreeDigest, manifestDigest, rendererDigest] = await Promise.all([
151
+ calculateManagedCommandResourceDigest(sourceRoot), calculateFileDigest(plugin.manifestPath), rendererClosureDigest(plugin),
152
+ ]);
153
+ return { sourceRoot, sourceTreeDigest,
154
+ sourceContentDigest: commandInputDigest({ sourceDir: declaration.sourceDir, sourceTreeDigest, manifestDigest, rendererDigest: rendererDigest ?? null }) };
155
+ }
156
+ //# sourceMappingURL=managed-command-closure.js.map