@lesliechan721/aw 0.1.0-beta.4 → 0.1.0-beta.40

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 (571) 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 +199 -0
  5. package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
  6. package/dist/authoring/scripts/add-skill.mjs +4 -4
  7. package/dist/authoring/scripts/add-skill.mjs.map +1 -1
  8. package/dist/authoring/scripts/init-plugin.mjs +67 -97
  9. package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
  10. package/dist/authoring/scripts/lib/plugin-version-check.d.mts +15 -0
  11. package/dist/authoring/scripts/lib/plugin-version-check.mjs +239 -232
  12. package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
  13. package/dist/authoring/scripts/lib/skill-scaffold.d.mts +77 -90
  14. package/dist/authoring/scripts/lib/skill-scaffold.mjs +99 -120
  15. package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
  16. package/dist/authoring/scripts/plugin-status.mjs +8 -11
  17. package/dist/authoring/scripts/plugin-status.mjs.map +1 -1
  18. package/dist/authoring/scripts/remove-plugin.mjs +367 -0
  19. package/dist/authoring/scripts/remove-plugin.mjs.map +1 -0
  20. package/dist/authoring/scripts/validate-plugin.mjs +353 -1175
  21. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  22. package/dist/scripts/aw-skill-eval-materializer.d.ts +26 -0
  23. package/dist/scripts/aw-skill-eval-materializer.js +306 -0
  24. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -0
  25. package/dist/scripts/bundle-plugins.d.ts +1 -2
  26. package/dist/scripts/bundle-plugins.js +24 -7
  27. package/dist/scripts/bundle-plugins.js.map +1 -1
  28. package/dist/scripts/plugin-staging.d.ts +7 -24
  29. package/dist/scripts/plugin-staging.js +22 -142
  30. package/dist/scripts/plugin-staging.js.map +1 -1
  31. package/dist/scripts/test-plugin-scripts.d.ts +2 -0
  32. package/dist/scripts/test-plugin-scripts.js +30 -75
  33. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  34. package/dist/src/adapters/helpers.js +2 -2
  35. package/dist/src/adapters/helpers.js.map +1 -1
  36. package/dist/src/authoring/workspace-commands.d.ts +26 -2
  37. package/dist/src/authoring/workspace-commands.js +44 -19
  38. package/dist/src/authoring/workspace-commands.js.map +1 -1
  39. package/dist/src/commands/aw-capabilities.d.ts +78 -0
  40. package/dist/src/commands/aw-capabilities.js +263 -0
  41. package/dist/src/commands/aw-capabilities.js.map +1 -0
  42. package/dist/src/commands/catalog-dev-source.d.ts +154 -0
  43. package/dist/src/commands/catalog-dev-source.js +655 -0
  44. package/dist/src/commands/catalog-dev-source.js.map +1 -0
  45. package/dist/src/commands/catalog-generation.d.ts +21 -0
  46. package/dist/src/commands/catalog-generation.js +9 -0
  47. package/dist/src/commands/catalog-generation.js.map +1 -0
  48. package/dist/src/commands/catalog-publication-inspection.d.ts +138 -0
  49. package/dist/src/commands/catalog-publication-inspection.js +757 -0
  50. package/dist/src/commands/catalog-publication-inspection.js.map +1 -0
  51. package/dist/src/commands/catalog-publication-journal.d.ts +68 -0
  52. package/dist/src/commands/catalog-publication-journal.js +292 -0
  53. package/dist/src/commands/catalog-publication-journal.js.map +1 -0
  54. package/dist/src/commands/catalog-publication-target.d.ts +18 -0
  55. package/dist/src/commands/catalog-publication-target.js +95 -0
  56. package/dist/src/commands/catalog-publication-target.js.map +1 -0
  57. package/dist/src/commands/catalog-publish.d.ts +77 -7
  58. package/dist/src/commands/catalog-publish.js +746 -316
  59. package/dist/src/commands/catalog-publish.js.map +1 -1
  60. package/dist/src/commands/catalog-source.d.ts +60 -22
  61. package/dist/src/commands/catalog-source.js +311 -91
  62. package/dist/src/commands/catalog-source.js.map +1 -1
  63. package/dist/src/commands/catalog-status.d.ts +56 -0
  64. package/dist/src/commands/catalog-status.js +217 -0
  65. package/dist/src/commands/catalog-status.js.map +1 -0
  66. package/dist/src/commands/catalog-store.d.ts +104 -0
  67. package/dist/src/commands/catalog-store.js +685 -0
  68. package/dist/src/commands/catalog-store.js.map +1 -0
  69. package/dist/src/commands/catalog-workspace-resolution.d.ts +13 -0
  70. package/dist/src/commands/catalog-workspace-resolution.js +42 -0
  71. package/dist/src/commands/catalog-workspace-resolution.js.map +1 -0
  72. package/dist/src/commands/console.js +28 -17
  73. package/dist/src/commands/console.js.map +1 -1
  74. package/dist/src/commands/dependency-operation-plan.d.ts +52 -15
  75. package/dist/src/commands/dependency-operation-plan.js +289 -7
  76. package/dist/src/commands/dependency-operation-plan.js.map +1 -1
  77. package/dist/src/commands/init.d.ts +5 -11
  78. package/dist/src/commands/init.js +30 -51
  79. package/dist/src/commands/init.js.map +1 -1
  80. package/dist/src/commands/offline-cleanup-evidence.d.ts +67 -0
  81. package/dist/src/commands/offline-cleanup-evidence.js +181 -0
  82. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -0
  83. package/dist/src/commands/operation-plan.d.ts +146 -0
  84. package/dist/src/commands/operation-plan.js +71 -0
  85. package/dist/src/commands/operation-plan.js.map +1 -0
  86. package/dist/src/commands/operation-planner.d.ts +46 -0
  87. package/dist/src/commands/operation-planner.js +141 -0
  88. package/dist/src/commands/operation-planner.js.map +1 -0
  89. package/dist/src/commands/options.d.ts +9 -7
  90. package/dist/src/commands/options.js +83 -21
  91. package/dist/src/commands/options.js.map +1 -1
  92. package/dist/src/commands/plugin-capabilities.d.ts +22 -0
  93. package/dist/src/commands/plugin-capabilities.js +163 -0
  94. package/dist/src/commands/plugin-capabilities.js.map +1 -0
  95. package/dist/src/commands/rebuild-command.d.ts +78 -30
  96. package/dist/src/commands/rebuild-command.js +4877 -713
  97. package/dist/src/commands/rebuild-command.js.map +1 -1
  98. package/dist/src/commands/rebuild-integration.d.ts +132 -21
  99. package/dist/src/commands/rebuild-integration.js +2853 -1327
  100. package/dist/src/commands/rebuild-integration.js.map +1 -1
  101. package/dist/src/commands/rebuild-operations.d.ts +58 -30
  102. package/dist/src/commands/rebuild-operations.js +260 -319
  103. package/dist/src/commands/rebuild-operations.js.map +1 -1
  104. package/dist/src/commands/reconcile-operation-plan.d.ts +28 -0
  105. package/dist/src/commands/reconcile-operation-plan.js +47 -0
  106. package/dist/src/commands/reconcile-operation-plan.js.map +1 -0
  107. package/dist/src/commands/review-inspection.d.ts +228 -0
  108. package/dist/src/commands/review-inspection.js +1341 -0
  109. package/dist/src/commands/review-inspection.js.map +1 -0
  110. package/dist/src/commands/review-preparation.d.ts +49 -0
  111. package/dist/src/commands/review-preparation.js +427 -0
  112. package/dist/src/commands/review-preparation.js.map +1 -0
  113. package/dist/src/commands/runtime.d.ts +1 -5
  114. package/dist/src/commands/runtime.js +24 -50
  115. package/dist/src/commands/runtime.js.map +1 -1
  116. package/dist/src/commands/skill-eval.d.ts +39 -0
  117. package/dist/src/commands/skill-eval.js +400 -0
  118. package/dist/src/commands/skill-eval.js.map +1 -0
  119. package/dist/src/commands/status-v6.d.ts +279 -0
  120. package/dist/src/commands/status-v6.js +2787 -0
  121. package/dist/src/commands/status-v6.js.map +1 -0
  122. package/dist/src/commands/sync-command.d.ts +40 -0
  123. package/dist/src/commands/sync-command.js +250 -0
  124. package/dist/src/commands/sync-command.js.map +1 -0
  125. package/dist/src/commands/wizard.d.ts +8 -5
  126. package/dist/src/commands/wizard.js +6 -4
  127. package/dist/src/commands/wizard.js.map +1 -1
  128. package/dist/src/commands/write-commands.d.ts +9 -3
  129. package/dist/src/commands/write-commands.js +127 -31
  130. package/dist/src/commands/write-commands.js.map +1 -1
  131. package/dist/src/constants.d.ts +7 -1
  132. package/dist/src/constants.js +7 -1
  133. package/dist/src/constants.js.map +1 -1
  134. package/dist/src/eval/manifest-v1.d.ts +71 -0
  135. package/dist/src/eval/manifest-v1.js +370 -0
  136. package/dist/src/eval/manifest-v1.js.map +1 -0
  137. package/dist/src/generators/local-plugin.d.ts +5 -1
  138. package/dist/src/generators/local-plugin.js +228 -104
  139. package/dist/src/generators/local-plugin.js.map +1 -1
  140. package/dist/src/index.d.ts +10 -4
  141. package/dist/src/index.js +1835 -469
  142. package/dist/src/index.js.map +1 -1
  143. package/dist/src/output/command-receipt.d.ts +43 -46
  144. package/dist/src/output/command-receipt.js +256 -80
  145. package/dist/src/output/command-receipt.js.map +1 -1
  146. package/dist/src/output/model.d.ts +3 -44
  147. package/dist/src/output/model.js +1 -144
  148. package/dist/src/output/model.js.map +1 -1
  149. package/dist/src/output/rebuild-progress.js +1 -13
  150. package/dist/src/output/rebuild-progress.js.map +1 -1
  151. package/dist/src/portable/commands.d.ts +46 -7
  152. package/dist/src/portable/commands.js +349 -37
  153. package/dist/src/portable/commands.js.map +1 -1
  154. package/dist/src/portable/materializer.d.ts +17 -4
  155. package/dist/src/portable/materializer.js +179 -41
  156. package/dist/src/portable/materializer.js.map +1 -1
  157. package/dist/src/portable/skills-cli.d.ts +15 -7
  158. package/dist/src/portable/skills-cli.js +66 -19
  159. package/dist/src/portable/skills-cli.js.map +1 -1
  160. package/dist/src/review/eval-source-input.d.ts +43 -0
  161. package/dist/src/review/eval-source-input.js +207 -0
  162. package/dist/src/review/eval-source-input.js.map +1 -0
  163. package/dist/src/review/review-profile.d.ts +17 -0
  164. package/dist/src/review/review-profile.js +234 -0
  165. package/dist/src/review/review-profile.js.map +1 -0
  166. package/dist/src/review/review-selection.d.ts +30 -0
  167. package/dist/src/review/review-selection.js +527 -0
  168. package/dist/src/review/review-selection.js.map +1 -0
  169. package/dist/src/review/review-types.d.ts +68 -0
  170. package/dist/src/review/review-types.js +16 -0
  171. package/dist/src/review/review-types.js.map +1 -0
  172. package/dist/src/review/skill-materialization.d.ts +13 -0
  173. package/dist/src/review/skill-materialization.js +75 -0
  174. package/dist/src/review/skill-materialization.js.map +1 -0
  175. package/dist/src/review/source-binding.d.ts +183 -0
  176. package/dist/src/review/source-binding.js +708 -0
  177. package/dist/src/review/source-binding.js.map +1 -0
  178. package/dist/src/tui/catalog-freshness.d.ts +1 -0
  179. package/dist/src/tui/catalog-freshness.js +2 -0
  180. package/dist/src/tui/catalog-freshness.js.map +1 -0
  181. package/dist/src/tui/catalog-generation.d.ts +21 -0
  182. package/dist/src/tui/catalog-generation.js +156 -0
  183. package/dist/src/tui/catalog-generation.js.map +1 -0
  184. package/dist/src/tui/catalog-sources/projection.d.ts +4 -0
  185. package/dist/src/tui/catalog-sources/projection.js +17 -0
  186. package/dist/src/tui/catalog-sources/projection.js.map +1 -0
  187. package/dist/src/tui/catalog-sources/review.d.ts +3 -0
  188. package/dist/src/tui/catalog-sources/review.js +13 -0
  189. package/dist/src/tui/catalog-sources/review.js.map +1 -0
  190. package/dist/src/tui/catalog-sources/screens.d.ts +12 -0
  191. package/dist/src/tui/catalog-sources/screens.js +40 -0
  192. package/dist/src/tui/catalog-sources/screens.js.map +1 -0
  193. package/dist/src/tui/catalog-sources/session.d.ts +32 -0
  194. package/dist/src/tui/catalog-sources/session.js +300 -0
  195. package/dist/src/tui/catalog-sources/session.js.map +1 -0
  196. package/dist/src/tui/catalog-sources/types.d.ts +54 -0
  197. package/dist/src/tui/catalog-sources/types.js +2 -0
  198. package/dist/src/tui/catalog-sources/types.js.map +1 -0
  199. package/dist/src/tui/catalog-store-task.d.ts +16 -0
  200. package/dist/src/tui/catalog-store-task.js +19 -0
  201. package/dist/src/tui/catalog-store-task.js.map +1 -0
  202. package/dist/src/tui/clipboard.d.ts +13 -0
  203. package/dist/src/tui/clipboard.js +95 -0
  204. package/dist/src/tui/clipboard.js.map +1 -0
  205. package/dist/src/tui/components.d.ts +177 -0
  206. package/dist/src/tui/components.js +297 -7
  207. package/dist/src/tui/components.js.map +1 -1
  208. package/dist/src/tui/config-array-draft.d.ts +29 -0
  209. package/dist/src/tui/config-array-draft.js +48 -0
  210. package/dist/src/tui/config-array-draft.js.map +1 -0
  211. package/dist/src/tui/config-leaf-editor.d.ts +16 -0
  212. package/dist/src/tui/config-leaf-editor.js +206 -0
  213. package/dist/src/tui/config-leaf-editor.js.map +1 -0
  214. package/dist/src/tui/config-value-presentation.d.ts +20 -0
  215. package/dist/src/tui/config-value-presentation.js +104 -0
  216. package/dist/src/tui/config-value-presentation.js.map +1 -0
  217. package/dist/src/tui/console-app-v4.d.ts +14 -4
  218. package/dist/src/tui/console-app-v4.js +9659 -1558
  219. package/dist/src/tui/console-app-v4.js.map +1 -1
  220. package/dist/src/tui/content-item-card.d.ts +13 -0
  221. package/dist/src/tui/content-item-card.js +51 -0
  222. package/dist/src/tui/content-item-card.js.map +1 -0
  223. package/dist/src/tui/controller-runtime.d.ts +13 -1
  224. package/dist/src/tui/controller-runtime.js +3323 -349
  225. package/dist/src/tui/controller-runtime.js.map +1 -1
  226. package/dist/src/tui/controller.d.ts +643 -40
  227. package/dist/src/tui/controller.js +3756 -705
  228. package/dist/src/tui/controller.js.map +1 -1
  229. package/dist/src/tui/dependency-graph-view.d.ts +39 -0
  230. package/dist/src/tui/dependency-graph-view.js +121 -0
  231. package/dist/src/tui/dependency-graph-view.js.map +1 -0
  232. package/dist/src/tui/dependency-graph.d.ts +81 -0
  233. package/dist/src/tui/dependency-graph.js +452 -0
  234. package/dist/src/tui/dependency-graph.js.map +1 -0
  235. package/dist/src/tui/diagnostic-projection.d.ts +23 -0
  236. package/dist/src/tui/diagnostic-projection.js +567 -0
  237. package/dist/src/tui/diagnostic-projection.js.map +1 -0
  238. package/dist/src/tui/diagnostics.d.ts +31 -0
  239. package/dist/src/tui/diagnostics.js +83 -0
  240. package/dist/src/tui/diagnostics.js.map +1 -0
  241. package/dist/src/tui/entity-cards.d.ts +55 -0
  242. package/dist/src/tui/entity-cards.js +220 -0
  243. package/dist/src/tui/entity-cards.js.map +1 -0
  244. package/dist/src/tui/glossary.d.ts +23 -0
  245. package/dist/src/tui/glossary.js +42 -0
  246. package/dist/src/tui/glossary.js.map +1 -0
  247. package/dist/src/tui/index.d.ts +11 -4
  248. package/dist/src/tui/index.js +8 -2
  249. package/dist/src/tui/index.js.map +1 -1
  250. package/dist/src/tui/input-display.d.ts +9 -0
  251. package/dist/src/tui/input-display.js +58 -0
  252. package/dist/src/tui/input-display.js.map +1 -0
  253. package/dist/src/tui/keys.d.ts +44 -0
  254. package/dist/src/tui/keys.js +43 -15
  255. package/dist/src/tui/keys.js.map +1 -1
  256. package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
  257. package/dist/src/tui/lifecycle-action-view.js +36 -0
  258. package/dist/src/tui/lifecycle-action-view.js.map +1 -0
  259. package/dist/src/tui/model.d.ts +248 -27
  260. package/dist/src/tui/model.js +1662 -314
  261. package/dist/src/tui/model.js.map +1 -1
  262. package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
  263. package/dist/src/tui/operation-diagnostic-screens.js +71 -0
  264. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
  265. package/dist/src/tui/operation-history.d.ts +81 -0
  266. package/dist/src/tui/operation-history.js +136 -0
  267. package/dist/src/tui/operation-history.js.map +1 -0
  268. package/dist/src/tui/operation-review-planner.d.ts +21 -0
  269. package/dist/src/tui/operation-review-planner.js +1295 -0
  270. package/dist/src/tui/operation-review-planner.js.map +1 -0
  271. package/dist/src/tui/plugin-content.d.ts +31 -0
  272. package/dist/src/tui/plugin-content.js +680 -0
  273. package/dist/src/tui/plugin-content.js.map +1 -0
  274. package/dist/src/tui/plugin-detail.d.ts +52 -0
  275. package/dist/src/tui/plugin-detail.js +165 -0
  276. package/dist/src/tui/plugin-detail.js.map +1 -0
  277. package/dist/src/tui/plugin-write-task.d.ts +69 -0
  278. package/dist/src/tui/plugin-write-task.js +286 -0
  279. package/dist/src/tui/plugin-write-task.js.map +1 -0
  280. package/dist/src/tui/project-inventory.d.ts +68 -0
  281. package/dist/src/tui/project-inventory.js +203 -0
  282. package/dist/src/tui/project-inventory.js.map +1 -0
  283. package/dist/src/tui/prompt.js +4 -15
  284. package/dist/src/tui/prompt.js.map +1 -1
  285. package/dist/src/tui/query-header.d.ts +30 -0
  286. package/dist/src/tui/query-header.js +40 -0
  287. package/dist/src/tui/query-header.js.map +1 -0
  288. package/dist/src/tui/reader.d.ts +37 -0
  289. package/dist/src/tui/reader.js +47 -0
  290. package/dist/src/tui/reader.js.map +1 -0
  291. package/dist/src/tui/router.d.ts +207 -14
  292. package/dist/src/tui/router.js +352 -29
  293. package/dist/src/tui/router.js.map +1 -1
  294. package/dist/src/tui/screen-registry.d.ts +701 -0
  295. package/dist/src/tui/screen-registry.js +230 -0
  296. package/dist/src/tui/screen-registry.js.map +1 -0
  297. package/dist/src/tui/session-console-app.d.ts +6 -0
  298. package/dist/src/tui/session-console-app.js +13 -0
  299. package/dist/src/tui/session-console-app.js.map +1 -0
  300. package/dist/src/tui/session-host.d.ts +45 -0
  301. package/dist/src/tui/session-host.js +209 -0
  302. package/dist/src/tui/session-host.js.map +1 -0
  303. package/dist/src/tui/source-detail-card.d.ts +29 -0
  304. package/dist/src/tui/source-detail-card.js +45 -0
  305. package/dist/src/tui/source-detail-card.js.map +1 -0
  306. package/dist/src/tui/source-ref-presets.d.ts +3 -0
  307. package/dist/src/tui/source-ref-presets.js +11 -0
  308. package/dist/src/tui/source-ref-presets.js.map +1 -0
  309. package/dist/src/tui/theme.d.ts +30 -10
  310. package/dist/src/tui/theme.js +30 -10
  311. package/dist/src/tui/theme.js.map +1 -1
  312. package/dist/src/tui/viewport.d.ts +21 -0
  313. package/dist/src/tui/viewport.js +52 -0
  314. package/dist/src/tui/viewport.js.map +1 -0
  315. package/dist/src/tui/views.js +31 -3
  316. package/dist/src/tui/views.js.map +1 -1
  317. package/dist/src/tui/wizard.js +37 -13
  318. package/dist/src/tui/wizard.js.map +1 -1
  319. package/dist/src/types.d.ts +244 -20
  320. package/dist/src/types.js +1 -0
  321. package/dist/src/types.js.map +1 -1
  322. package/dist/src/utils/agent-version.d.ts +7 -1
  323. package/dist/src/utils/agent-version.js +41 -8
  324. package/dist/src/utils/agent-version.js.map +1 -1
  325. package/dist/src/utils/artifact-plan.d.ts +5 -4
  326. package/dist/src/utils/artifact-plan.js +18 -7
  327. package/dist/src/utils/artifact-plan.js.map +1 -1
  328. package/dist/src/utils/artifact-renderer.d.ts +17 -7
  329. package/dist/src/utils/artifact-renderer.js +214 -216
  330. package/dist/src/utils/artifact-renderer.js.map +1 -1
  331. package/dist/src/utils/artifact-request.d.ts +21 -0
  332. package/dist/src/utils/artifact-request.js +78 -0
  333. package/dist/src/utils/artifact-request.js.map +1 -0
  334. package/dist/src/utils/aw-home-mutation-lock.d.ts +1 -0
  335. package/dist/src/utils/aw-home-mutation-lock.js +32 -4
  336. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  337. package/dist/src/utils/bundle-integrity.d.ts +0 -1
  338. package/dist/src/utils/bundle-integrity.js +0 -25
  339. package/dist/src/utils/bundle-integrity.js.map +1 -1
  340. package/dist/src/utils/bundle-layout.js +22 -29
  341. package/dist/src/utils/bundle-layout.js.map +1 -1
  342. package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
  343. package/dist/src/utils/catalog-capability-projection.js +14 -0
  344. package/dist/src/utils/catalog-capability-projection.js.map +1 -0
  345. package/dist/src/utils/catalog-digests.d.ts +10 -0
  346. package/dist/src/utils/catalog-digests.js +50 -2
  347. package/dist/src/utils/catalog-digests.js.map +1 -1
  348. package/dist/src/utils/catalog-generation-control-snapshot.d.ts +11 -0
  349. package/dist/src/utils/catalog-generation-control-snapshot.js +45 -0
  350. package/dist/src/utils/catalog-generation-control-snapshot.js.map +1 -0
  351. package/dist/src/utils/catalog-generation-error.d.ts +16 -0
  352. package/dist/src/utils/catalog-generation-error.js +30 -0
  353. package/dist/src/utils/catalog-generation-error.js.map +1 -0
  354. package/dist/src/utils/catalog-generation-resolver.d.ts +44 -0
  355. package/dist/src/utils/catalog-generation-resolver.js +273 -0
  356. package/dist/src/utils/catalog-generation-resolver.js.map +1 -0
  357. package/dist/src/utils/catalog-generation-service.d.ts +172 -0
  358. package/dist/src/utils/catalog-generation-service.js +1271 -0
  359. package/dist/src/utils/catalog-generation-service.js.map +1 -0
  360. package/dist/src/utils/catalog-generation-state.d.ts +22 -0
  361. package/dist/src/utils/catalog-generation-state.js +192 -0
  362. package/dist/src/utils/catalog-generation-state.js.map +1 -0
  363. package/dist/src/utils/catalog-generation-store.d.ts +58 -0
  364. package/dist/src/utils/catalog-generation-store.js +452 -0
  365. package/dist/src/utils/catalog-generation-store.js.map +1 -0
  366. package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
  367. package/dist/src/utils/{catalog-manifest-v4.js → catalog-manifest-v7.js} +35 -43
  368. package/dist/src/utils/catalog-manifest-v7.js.map +1 -0
  369. package/dist/src/utils/catalog-operation-context.d.ts +20 -0
  370. package/dist/src/utils/catalog-operation-context.js +142 -0
  371. package/dist/src/utils/catalog-operation-context.js.map +1 -0
  372. package/dist/src/utils/catalog-public-error.d.ts +7 -3
  373. package/dist/src/utils/catalog-public-error.js +28 -8
  374. package/dist/src/utils/catalog-public-error.js.map +1 -1
  375. package/dist/src/utils/catalog-runtime-projection.d.ts +4 -7
  376. package/dist/src/utils/catalog-runtime-projection.js +7 -102
  377. package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
  378. package/dist/src/utils/catalog-snapshot.d.ts +5 -3
  379. package/dist/src/utils/catalog-snapshot.js +11 -3
  380. package/dist/src/utils/catalog-snapshot.js.map +1 -1
  381. package/dist/src/utils/catalog-source-identity.d.ts +1 -0
  382. package/dist/src/utils/catalog-source-identity.js +21 -2
  383. package/dist/src/utils/catalog-source-identity.js.map +1 -1
  384. package/dist/src/utils/catalog-source-impact.d.ts +21 -0
  385. package/dist/src/utils/catalog-source-impact.js +344 -0
  386. package/dist/src/utils/catalog-source-impact.js.map +1 -0
  387. package/dist/src/utils/catalog-source-references.d.ts +3 -2
  388. package/dist/src/utils/catalog-source-references.js +195 -347
  389. package/dist/src/utils/catalog-source-references.js.map +1 -1
  390. package/dist/src/utils/catalog-sources.d.ts +15 -1
  391. package/dist/src/utils/catalog-sources.js +206 -27
  392. package/dist/src/utils/catalog-sources.js.map +1 -1
  393. package/dist/src/utils/codex-config.d.ts +2 -0
  394. package/dist/src/utils/codex-config.js +26 -5
  395. package/dist/src/utils/codex-config.js.map +1 -1
  396. package/dist/src/utils/codex-manager.d.ts +79 -0
  397. package/dist/src/utils/codex-manager.js +745 -0
  398. package/dist/src/utils/codex-manager.js.map +1 -0
  399. package/dist/src/utils/codex-marketplace-path.d.ts +5 -0
  400. package/dist/src/utils/codex-marketplace-path.js +45 -0
  401. package/dist/src/utils/codex-marketplace-path.js.map +1 -0
  402. package/dist/src/utils/codex-native-observation.d.ts +49 -0
  403. package/dist/src/utils/codex-native-observation.js +154 -0
  404. package/dist/src/utils/codex-native-observation.js.map +1 -0
  405. package/dist/src/utils/codex-native-render-receipt.d.ts +40 -0
  406. package/dist/src/utils/codex-native-render-receipt.js +205 -0
  407. package/dist/src/utils/codex-native-render-receipt.js.map +1 -0
  408. package/dist/src/utils/codex-reconciler.d.ts +126 -0
  409. package/dist/src/utils/codex-reconciler.js +298 -0
  410. package/dist/src/utils/codex-reconciler.js.map +1 -0
  411. package/dist/src/utils/codex-shared-native.d.ts +43 -0
  412. package/dist/src/utils/codex-shared-native.js +81 -0
  413. package/dist/src/utils/codex-shared-native.js.map +1 -0
  414. package/dist/src/utils/codex-skill-staging.d.ts +2 -0
  415. package/dist/src/utils/codex-skill-staging.js.map +1 -1
  416. package/dist/src/utils/codex-surface-analysis.d.ts +46 -0
  417. package/dist/src/utils/codex-surface-analysis.js +247 -0
  418. package/dist/src/utils/codex-surface-analysis.js.map +1 -0
  419. package/dist/src/utils/dynamic-skill-tree.d.ts +4 -0
  420. package/dist/src/utils/dynamic-skill-tree.js +36 -6
  421. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  422. package/dist/src/utils/git-catalog-provider.d.ts +16 -0
  423. package/dist/src/utils/git-catalog-provider.js +169 -144
  424. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  425. package/dist/src/utils/local-marketplace.d.ts +17 -1
  426. package/dist/src/utils/local-marketplace.js +301 -84
  427. package/dist/src/utils/local-marketplace.js.map +1 -1
  428. package/dist/src/utils/manifest.d.ts +1 -4
  429. package/dist/src/utils/manifest.js +1 -4
  430. package/dist/src/utils/manifest.js.map +1 -1
  431. package/dist/src/utils/multi-source-catalog.d.ts +3 -9
  432. package/dist/src/utils/multi-source-catalog.js +54 -110
  433. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  434. package/dist/src/utils/native-cli.d.ts +55 -7
  435. package/dist/src/utils/native-cli.js +386 -57
  436. package/dist/src/utils/native-cli.js.map +1 -1
  437. package/dist/src/utils/orphan-marketplace-cleanup.js +0 -4
  438. package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
  439. package/dist/src/utils/ownership.d.ts +84 -20
  440. package/dist/src/utils/ownership.js +179 -222
  441. package/dist/src/utils/ownership.js.map +1 -1
  442. package/dist/src/utils/path-catalog-provider.d.ts +1 -1
  443. package/dist/src/utils/path-catalog-provider.js +54 -65
  444. package/dist/src/utils/path-catalog-provider.js.map +1 -1
  445. package/dist/src/utils/paths.d.ts +0 -1
  446. package/dist/src/utils/paths.js +0 -1
  447. package/dist/src/utils/paths.js.map +1 -1
  448. package/dist/src/utils/plugin-config-impact.d.ts +33 -0
  449. package/dist/src/utils/plugin-config-impact.js +298 -0
  450. package/dist/src/utils/plugin-config-impact.js.map +1 -0
  451. package/dist/src/utils/plugin-config-write.d.ts +52 -27
  452. package/dist/src/utils/plugin-config-write.js +1000 -296
  453. package/dist/src/utils/plugin-config-write.js.map +1 -1
  454. package/dist/src/utils/plugin-config.d.ts +153 -93
  455. package/dist/src/utils/plugin-config.js +1163 -1017
  456. package/dist/src/utils/plugin-config.js.map +1 -1
  457. package/dist/src/utils/plugin-intent-state.d.ts +49 -0
  458. package/dist/src/utils/plugin-intent-state.js +320 -0
  459. package/dist/src/utils/plugin-intent-state.js.map +1 -0
  460. package/dist/src/utils/plugin-scripts.d.ts +65 -125
  461. package/dist/src/utils/plugin-scripts.js +482 -524
  462. package/dist/src/utils/plugin-scripts.js.map +1 -1
  463. package/dist/src/utils/process-tree.d.ts +2 -2
  464. package/dist/src/utils/process-tree.js +1 -1
  465. package/dist/src/utils/process-tree.js.map +1 -1
  466. package/dist/src/utils/project-boundary.d.ts +11 -13
  467. package/dist/src/utils/project-boundary.js +28 -34
  468. package/dist/src/utils/project-boundary.js.map +1 -1
  469. package/dist/src/utils/runtime-config.d.ts +20 -0
  470. package/dist/src/utils/runtime-config.js +75 -0
  471. package/dist/src/utils/runtime-config.js.map +1 -0
  472. package/dist/src/utils/safe-fs.d.ts +21 -0
  473. package/dist/src/utils/safe-fs.js +111 -0
  474. package/dist/src/utils/safe-fs.js.map +1 -0
  475. package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
  476. package/dist/src/utils/safe-operation-diagnostic.js +33 -0
  477. package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
  478. package/dist/src/utils/sensitive-content.d.ts +4 -0
  479. package/dist/src/utils/sensitive-content.js +36 -0
  480. package/dist/src/utils/sensitive-content.js.map +1 -0
  481. package/dist/src/utils/skill-validation.d.ts +1 -1
  482. package/dist/src/utils/skill-validation.js +1 -1
  483. package/dist/src/utils/skill-validation.js.map +1 -1
  484. package/dist/src/utils/state-paths.d.ts +1 -0
  485. package/dist/src/utils/state-paths.js +12 -2
  486. package/dist/src/utils/state-paths.js.map +1 -1
  487. package/dist/src/utils/target-eligibility.d.ts +8 -2
  488. package/dist/src/utils/target-eligibility.js +17 -8
  489. package/dist/src/utils/target-eligibility.js.map +1 -1
  490. package/dist/src/utils/windows-claude-shim.d.ts +9 -0
  491. package/dist/src/utils/windows-claude-shim.js +141 -0
  492. package/dist/src/utils/windows-claude-shim.js.map +1 -0
  493. package/dist/vitest.config.js +91 -10
  494. package/dist/vitest.config.js.map +1 -1
  495. package/package.json +22 -19
  496. package/dist/authoring/scripts/check-plugin-versions.mjs +0 -5
  497. package/dist/authoring/scripts/check-plugin-versions.mjs.map +0 -1
  498. package/dist/scripts/aw-skill-eval-engine.d.ts +0 -13
  499. package/dist/scripts/aw-skill-eval-engine.js +0 -31
  500. package/dist/scripts/aw-skill-eval-engine.js.map +0 -1
  501. package/dist/scripts/codex-eval-app-server.d.ts +0 -89
  502. package/dist/scripts/codex-eval-app-server.js +0 -1228
  503. package/dist/scripts/codex-eval-app-server.js.map +0 -1
  504. package/dist/scripts/codex-eval-isolation.d.ts +0 -61
  505. package/dist/scripts/codex-eval-isolation.js +0 -318
  506. package/dist/scripts/codex-eval-isolation.js.map +0 -1
  507. package/dist/scripts/codex-eval-process-management.d.ts +0 -8
  508. package/dist/scripts/codex-eval-process-management.js +0 -69
  509. package/dist/scripts/codex-eval-process-management.js.map +0 -1
  510. package/dist/scripts/codex-eval-process-tree.d.ts +0 -38
  511. package/dist/scripts/codex-eval-process-tree.js +0 -803
  512. package/dist/scripts/codex-eval-process-tree.js.map +0 -1
  513. package/dist/scripts/codex-eval-runtime-config.d.ts +0 -62
  514. package/dist/scripts/codex-eval-runtime-config.js +0 -843
  515. package/dist/scripts/codex-eval-runtime-config.js.map +0 -1
  516. package/dist/scripts/codex-trigger-eval.d.ts +0 -84
  517. package/dist/scripts/codex-trigger-eval.js +0 -968
  518. package/dist/scripts/codex-trigger-eval.js.map +0 -1
  519. package/dist/scripts/eval-plugin-skills-audited.d.ts +0 -6
  520. package/dist/scripts/eval-plugin-skills-audited.js +0 -261
  521. package/dist/scripts/eval-plugin-skills-audited.js.map +0 -1
  522. package/dist/scripts/eval-plugin-skills.d.ts +0 -45
  523. package/dist/scripts/eval-plugin-skills.js +0 -1586
  524. package/dist/scripts/eval-plugin-skills.js.map +0 -1
  525. package/dist/scripts/eval-run-layout.d.ts +0 -17
  526. package/dist/scripts/eval-run-layout.js +0 -26
  527. package/dist/scripts/eval-run-layout.js.map +0 -1
  528. package/dist/scripts/plugin-eval-contract.d.ts +0 -185
  529. package/dist/scripts/plugin-eval-contract.js +0 -695
  530. package/dist/scripts/plugin-eval-contract.js.map +0 -1
  531. package/dist/scripts/plugin-eval-materializer.d.ts +0 -13
  532. package/dist/scripts/plugin-eval-materializer.js +0 -421
  533. package/dist/scripts/plugin-eval-materializer.js.map +0 -1
  534. package/dist/scripts/skill-reporting.d.ts +0 -212
  535. package/dist/scripts/skill-reporting.js +0 -922
  536. package/dist/scripts/skill-reporting.js.map +0 -1
  537. package/dist/src/commands/status-v4.d.ts +0 -102
  538. package/dist/src/commands/status-v4.js +0 -844
  539. package/dist/src/commands/status-v4.js.map +0 -1
  540. package/dist/src/commands/status.d.ts +0 -93
  541. package/dist/src/commands/status.js +0 -442
  542. package/dist/src/commands/status.js.map +0 -1
  543. package/dist/src/utils/active-marketplace-runtime-lock.d.ts +0 -12
  544. package/dist/src/utils/active-marketplace-runtime-lock.js +0 -133
  545. package/dist/src/utils/active-marketplace-runtime-lock.js.map +0 -1
  546. package/dist/src/utils/catalog-manifest-v3.d.ts +0 -2
  547. package/dist/src/utils/catalog-manifest-v3.js +0 -3
  548. package/dist/src/utils/catalog-manifest-v3.js.map +0 -1
  549. package/dist/src/utils/catalog-manifest-v4.d.ts +0 -5
  550. package/dist/src/utils/catalog-manifest-v4.js.map +0 -1
  551. package/dist/src/utils/catalog-source-cache.d.ts +0 -61
  552. package/dist/src/utils/catalog-source-cache.js +0 -276
  553. package/dist/src/utils/catalog-source-cache.js.map +0 -1
  554. package/dist/src/utils/codex-project-surface.d.ts +0 -3
  555. package/dist/src/utils/codex-project-surface.js +0 -49
  556. package/dist/src/utils/codex-project-surface.js.map +0 -1
  557. package/dist/src/utils/lifecycle-active-store.d.ts +0 -175
  558. package/dist/src/utils/lifecycle-active-store.js +0 -1276
  559. package/dist/src/utils/lifecycle-active-store.js.map +0 -1
  560. package/dist/src/utils/plugin-authoring-capabilities.d.ts +0 -23
  561. package/dist/src/utils/plugin-authoring-capabilities.js +0 -37
  562. package/dist/src/utils/plugin-authoring-capabilities.js.map +0 -1
  563. package/dist/src/utils/plugin-authoring-capabilities.json +0 -92
  564. package/dist/src/utils/plugin-release.d.ts +0 -2
  565. package/dist/src/utils/plugin-release.js +0 -2
  566. package/dist/src/utils/plugin-release.js.map +0 -1
  567. package/dist/src/utils/skill-frontmatter-capabilities.d.ts +0 -201
  568. package/dist/src/utils/skill-frontmatter-capabilities.js +0 -5
  569. package/dist/src/utils/skill-frontmatter-capabilities.js.map +0 -1
  570. package/dist/src/utils/skill-frontmatter-capabilities.json +0 -200
  571. /package/dist/authoring/scripts/{check-plugin-versions.d.mts → remove-plugin.d.mts} +0 -0
@@ -1,20 +1,23 @@
1
- import { execFile } from 'node:child_process';
1
+ import { execFile, spawn } from 'node:child_process';
2
2
  import crypto from 'node:crypto';
3
3
  import * as fs from 'node:fs/promises';
4
4
  import * as os from 'node:os';
5
5
  import * as path from 'node:path';
6
+ import { Readable } from 'node:stream';
7
+ import { pipeline } from 'node:stream/promises';
6
8
  import { promisify } from 'node:util';
7
9
  import { fileURLToPath, pathToFileURL } from 'node:url';
8
10
  import { compareStrictSemVer, parseStrictSemVer } from './semver.mjs';
9
11
  import { assertAuthoringPluginPathFence, resolveAuthoringPluginRoot, } from './plugin-root.mjs';
10
12
  const execFileAsync = promisify(execFile);
11
- const EXPECTED_MANIFEST_CONTRACT_VERSION = 7;
12
- const CLI_PACKAGE_NAME = '@lesliechan721/aw';
13
+ const EXPECTED_MANIFEST_CONTRACT_VERSION = 16;
13
14
  const PLUGIN_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
14
- const CLI_REGISTRY_RELATIVE_PATHS = [
15
- 'src/utils/skill-frontmatter-capabilities.json',
16
- 'src/utils/plugin-authoring-capabilities.json',
17
- ];
15
+ const GIT_OBJECT_ID_PATTERN = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u;
16
+ const MAX_GIT_BLOB_BYTES = 50 * 1024 * 1024;
17
+ const MAX_GIT_BATCH_HEADER_BYTES = 1024;
18
+ const GIT_BATCH_OPERATION_TIMEOUT_MS = 30_000;
19
+ const GIT_BATCH_TERM_GRACE_MS = 250;
20
+ const GIT_BATCH_CLOSE_TIMEOUT_MS = 2_000;
18
21
  const CLI_PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..');
19
22
  export class PluginVersionCheckError extends Error {
20
23
  constructor(code, message) {
@@ -26,14 +29,14 @@ export class PluginVersionCheckError extends Error {
26
29
  function codedError(code, message) {
27
30
  return new PluginVersionCheckError(code, message);
28
31
  }
29
- function parseStablePluginVersion(version, fieldName) {
32
+ export function parseStablePluginVersion(version, fieldName) {
30
33
  const parsed = parseStrictSemVer(version, fieldName);
31
34
  if (parsed.prerelease.length > 0 || parsed.build.length > 0) {
32
35
  throw codedError('invalidPlugin', `${fieldName} must be a stable SemVer without prerelease or build metadata.`);
33
36
  }
34
37
  return parsed;
35
38
  }
36
- async function runGit(repoRoot, args, options = {}) {
39
+ export async function runGit(repoRoot, args, options = {}) {
37
40
  try {
38
41
  const result = await execFileAsync('git', args, {
39
42
  cwd: repoRoot,
@@ -49,7 +52,7 @@ async function runGit(repoRoot, args, options = {}) {
49
52
  throw codedError(options.code ?? 'gitFailed', `${options.label ?? `git ${args.join(' ')}`} failed${detail ? `: ${detail}` : '.'}`);
50
53
  }
51
54
  }
52
- async function resolveBaseCommit(repoRoot, base) {
55
+ export async function resolveBaseCommit(repoRoot, base) {
53
56
  await runGit(repoRoot, ['rev-parse', '--show-toplevel'], {
54
57
  code: 'gitUnavailable',
55
58
  label: 'Git repository discovery',
@@ -109,7 +112,16 @@ async function loadProductionBundler(cliPackageRoot) {
109
112
  }
110
113
  function parseTreeRecord(record) {
111
114
  const tabIndex = record.indexOf('\t');
115
+ if (tabIndex < 0) {
116
+ throw codedError('gitFailed', 'Git authoring source tree returned a malformed record.');
117
+ }
112
118
  const metadata = record.slice(0, tabIndex).split(' ');
119
+ if (metadata.length !== 3
120
+ || !metadata[0]
121
+ || !metadata[1]
122
+ || !GIT_OBJECT_ID_PATTERN.test(metadata[2] ?? '')) {
123
+ throw codedError('gitFailed', 'Git authoring source tree returned malformed metadata.');
124
+ }
113
125
  return {
114
126
  mode: metadata[0],
115
127
  type: metadata[1],
@@ -117,20 +129,221 @@ function parseTreeRecord(record) {
117
129
  filePath: record.slice(tabIndex + 1),
118
130
  };
119
131
  }
132
+ function createBatchReader(stream) {
133
+ const iterator = stream[Symbol.asyncIterator]();
134
+ let chunk = Buffer.alloc(0);
135
+ let offset = 0;
136
+ let ended = false;
137
+ async function nextChunk() {
138
+ if (offset < chunk.length)
139
+ return true;
140
+ const next = await iterator.next();
141
+ if (next.done) {
142
+ ended = true;
143
+ chunk = Buffer.alloc(0);
144
+ offset = 0;
145
+ return false;
146
+ }
147
+ chunk = Buffer.isBuffer(next.value) ? next.value : Buffer.from(next.value);
148
+ offset = 0;
149
+ return true;
150
+ }
151
+ return {
152
+ async readLine() {
153
+ const parts = [];
154
+ let size = 0;
155
+ while (await nextChunk()) {
156
+ const newline = chunk.indexOf(0x0a, offset);
157
+ const end = newline < 0 ? chunk.length : newline;
158
+ const part = chunk.subarray(offset, end);
159
+ parts.push(part);
160
+ size += part.length;
161
+ if (size > MAX_GIT_BATCH_HEADER_BYTES) {
162
+ throw codedError('gitFailed', 'Git cat-file batch returned an oversized header.');
163
+ }
164
+ offset = newline < 0 ? chunk.length : newline + 1;
165
+ if (newline >= 0)
166
+ return Buffer.concat(parts, size).toString('ascii');
167
+ }
168
+ if (size === 0 && ended)
169
+ return null;
170
+ throw codedError('gitFailed', 'Git cat-file batch stdout ended during a header.');
171
+ },
172
+ async readExact(size) {
173
+ const output = Buffer.allocUnsafe(size);
174
+ let written = 0;
175
+ while (written < size && await nextChunk()) {
176
+ const available = Math.min(size - written, chunk.length - offset);
177
+ chunk.copy(output, written, offset, offset + available);
178
+ offset += available;
179
+ written += available;
180
+ }
181
+ if (written !== size) {
182
+ throw codedError('gitFailed', 'Git cat-file batch stdout ended during a blob.');
183
+ }
184
+ return output;
185
+ },
186
+ };
187
+ }
188
+ export async function readGitBlobsBatch(repoRoot, objectIds, options = {}) {
189
+ const uniqueObjectIds = [...new Set(objectIds)];
190
+ for (const objectId of uniqueObjectIds) {
191
+ if (!GIT_OBJECT_ID_PATTERN.test(objectId)) {
192
+ throw codedError('gitFailed', `Git authoring source tree returned an invalid object ID.`);
193
+ }
194
+ }
195
+ if (uniqueObjectIds.length === 0)
196
+ return new Map();
197
+ const child = spawn('git', ['cat-file', '--batch'], {
198
+ cwd: repoRoot,
199
+ env: options.env ?? process.env,
200
+ stdio: ['pipe', 'pipe', 'pipe'],
201
+ });
202
+ let cleanupStarted = false;
203
+ let operationTimedOut = false;
204
+ let operationTimeoutTimer;
205
+ let forceKillTimer;
206
+ let closeTimeoutTimer;
207
+ let settleExit;
208
+ let onStderrData;
209
+ const exitTask = new Promise((resolve, reject) => {
210
+ const finish = (settle, value) => {
211
+ if (!settleExit)
212
+ return;
213
+ settleExit = null;
214
+ clearTimeout(operationTimeoutTimer);
215
+ clearTimeout(forceKillTimer);
216
+ clearTimeout(closeTimeoutTimer);
217
+ child.removeListener('error', onError);
218
+ child.removeListener('close', onClose);
219
+ if (onStderrData)
220
+ child.stderr.removeListener('data', onStderrData);
221
+ settle(value);
222
+ };
223
+ const onError = (error) => finish(reject, error);
224
+ const onClose = (code, signal) => finish(resolve, { code, signal });
225
+ settleExit = (error) => finish(reject, error);
226
+ child.once('error', onError);
227
+ child.once('close', onClose);
228
+ });
229
+ function requestCleanup() {
230
+ if (cleanupStarted || !settleExit)
231
+ return;
232
+ cleanupStarted = true;
233
+ child.stdin.destroy();
234
+ child.kill('SIGTERM');
235
+ forceKillTimer = setTimeout(() => child.kill('SIGKILL'), GIT_BATCH_TERM_GRACE_MS);
236
+ closeTimeoutTimer = setTimeout(() => {
237
+ child.kill('SIGKILL');
238
+ child.stdin.destroy();
239
+ child.stdout.destroy();
240
+ child.stderr.destroy();
241
+ child.unref();
242
+ settleExit(codedError('gitFailed', 'Git cat-file batch did not exit after forced termination.'));
243
+ }, GIT_BATCH_CLOSE_TIMEOUT_MS);
244
+ }
245
+ operationTimeoutTimer = setTimeout(() => {
246
+ operationTimedOut = true;
247
+ requestCleanup();
248
+ }, options.operationTimeoutMs ?? GIT_BATCH_OPERATION_TIMEOUT_MS);
249
+ const stderrChunks = [];
250
+ let stderrBytes = 0;
251
+ onStderrData = (value) => {
252
+ const valueBuffer = Buffer.isBuffer(value) ? value : Buffer.from(value);
253
+ stderrBytes += valueBuffer.length;
254
+ if (stderrBytes <= MAX_GIT_BLOB_BYTES)
255
+ stderrChunks.push(valueBuffer);
256
+ requestCleanup();
257
+ };
258
+ child.stderr.on('data', onStderrData);
259
+ const readTask = (async () => {
260
+ const reader = createBatchReader(child.stdout);
261
+ const contents = new Map();
262
+ for (const expectedObjectId of uniqueObjectIds) {
263
+ const header = await reader.readLine();
264
+ if (header === null) {
265
+ throw codedError('gitFailed', 'Git cat-file batch stdout ended before all blobs were returned.');
266
+ }
267
+ if (header === `${expectedObjectId} missing`) {
268
+ throw codedError('gitFailed', `Git blob ${expectedObjectId} is missing.`);
269
+ }
270
+ const match = /^(\S+) (\S+) (\S+)$/u.exec(header);
271
+ if (!match || match[1] !== expectedObjectId) {
272
+ throw codedError('gitFailed', 'Git cat-file batch returned a malformed header.');
273
+ }
274
+ if (match[2] !== 'blob') {
275
+ throw codedError('gitFailed', `Git object ${expectedObjectId} is not a blob.`);
276
+ }
277
+ if (!/^(?:0|[1-9][0-9]*)$/u.test(match[3])) {
278
+ throw codedError('gitFailed', `Git blob ${expectedObjectId} has an invalid size.`);
279
+ }
280
+ const size = Number(match[3]);
281
+ if (!Number.isSafeInteger(size) || size > MAX_GIT_BLOB_BYTES) {
282
+ throw codedError('gitFailed', `Git blob ${expectedObjectId} exceeds the size limit.`);
283
+ }
284
+ const content = await reader.readExact(size);
285
+ const separator = await reader.readExact(1);
286
+ if (separator[0] !== 0x0a) {
287
+ throw codedError('gitFailed', `Git blob ${expectedObjectId} has an invalid separator.`);
288
+ }
289
+ contents.set(expectedObjectId, content);
290
+ }
291
+ if (await reader.readLine() !== null) {
292
+ throw codedError('gitFailed', 'Git cat-file batch returned unexpected output.');
293
+ }
294
+ return contents;
295
+ })();
296
+ const writeTask = pipeline(Readable.from(uniqueObjectIds.map((objectId) => `${objectId}\n`)), child.stdin);
297
+ for (const task of [readTask, writeTask]) {
298
+ task.catch(requestCleanup);
299
+ }
300
+ const [readResult, writeResult, exitResult] = await Promise.allSettled([
301
+ readTask,
302
+ writeTask,
303
+ exitTask,
304
+ ]);
305
+ if (operationTimedOut) {
306
+ throw codedError('gitFailed', 'Git cat-file batch timed out.');
307
+ }
308
+ if (exitResult.status === 'rejected'
309
+ && exitResult.reason instanceof PluginVersionCheckError) {
310
+ throw exitResult.reason;
311
+ }
312
+ if (readResult.status === 'rejected')
313
+ throw readResult.reason;
314
+ if (writeResult.status === 'rejected') {
315
+ throw codedError('gitFailed', `Git cat-file batch input failed: ${writeResult.reason.message}`);
316
+ }
317
+ if (exitResult.status === 'rejected') {
318
+ throw codedError('gitFailed', `Git cat-file batch failed: ${exitResult.reason.message}`);
319
+ }
320
+ const stderr = Buffer.concat(stderrChunks).toString('utf8').trim();
321
+ if (stderrBytes > MAX_GIT_BLOB_BYTES) {
322
+ throw codedError('gitFailed', 'Git cat-file batch stderr exceeded the size limit.');
323
+ }
324
+ if (exitResult.value.signal) {
325
+ throw codedError('gitFailed', `Git cat-file batch ended from signal ${exitResult.value.signal}${stderr ? `: ${stderr}` : '.'}`);
326
+ }
327
+ if (exitResult.value.code !== 0 || stderr) {
328
+ throw codedError('gitFailed', `Git cat-file batch failed${stderr ? `: ${stderr}` : ` with exit code ${exitResult.value.code}.`}`);
329
+ }
330
+ return readResult.value;
331
+ }
120
332
  async function materializeBaseAuthoringSourceSet(repoRoot, baseCommit, outputRoot, pluginRootPath) {
121
333
  const sourcePaths = [
122
334
  'plugins',
123
- 'packages/cli/package.json',
124
- 'packages/cli/src/utils/skill-frontmatter-capabilities.json',
125
- 'packages/cli/src/utils/plugin-authoring-capabilities.json',
126
335
  ];
127
336
  if (pluginRootPath && !sourcePaths.includes(pluginRootPath))
128
337
  sourcePaths.push(pluginRootPath);
129
338
  const output = await runGit(repoRoot, ['ls-tree', '-r', '-z', baseCommit, '--', ...sourcePaths], { buffer: true, label: 'Git authoring source tree' });
130
339
  const records = output.toString('utf8').split('\0').filter(Boolean).map(parseTreeRecord);
131
340
  for (const record of records) {
132
- if (record.type !== 'blob')
133
- continue;
341
+ if (record.type !== 'blob') {
342
+ throw codedError('gitFailed', `Git authoring source object ${record.objectId} is not a blob.`);
343
+ }
344
+ }
345
+ const contentsByObjectId = await readGitBlobsBatch(repoRoot, records.map((record) => record.objectId));
346
+ for (const record of records) {
134
347
  const normalizedPath = path.posix.normalize(record.filePath);
135
348
  if (normalizedPath !== record.filePath
136
349
  || normalizedPath === '..'
@@ -140,10 +353,10 @@ async function materializeBaseAuthoringSourceSet(repoRoot, baseCommit, outputRoo
140
353
  }
141
354
  const targetPath = path.join(outputRoot, ...normalizedPath.split('/'));
142
355
  await fs.mkdir(path.dirname(targetPath), { recursive: true });
143
- const content = await runGit(repoRoot, ['cat-file', 'blob', record.objectId], {
144
- buffer: true,
145
- label: `Git blob ${record.objectId}`,
146
- });
356
+ const content = contentsByObjectId.get(record.objectId);
357
+ if (!content) {
358
+ throw codedError('gitFailed', `Git blob ${record.objectId} was not returned.`);
359
+ }
147
360
  if (record.mode === '120000') {
148
361
  await fs.symlink(content.toString('utf8'), targetPath);
149
362
  }
@@ -162,203 +375,7 @@ async function lstatOrNull(filePath) {
162
375
  throw error;
163
376
  });
164
377
  }
165
- async function assertRegularFilePath(rootDir, relativePath, label) {
166
- const rootStat = await lstatOrNull(rootDir);
167
- if (!rootStat || rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
168
- throw codedError('invalidPlugin', `${label} root must be a non-symbolic-link directory.`);
169
- }
170
- let currentPath = rootDir;
171
- const segments = relativePath.split('/');
172
- for (const [index, segment] of segments.entries()) {
173
- currentPath = path.join(currentPath, segment);
174
- const stat = await lstatOrNull(currentPath);
175
- if (!stat) {
176
- throw codedError('invalidPlugin', `${label} is missing ${JSON.stringify(relativePath)}.`);
177
- }
178
- if (stat.isSymbolicLink()) {
179
- throw codedError('invalidPlugin', `${label} contains a symbolic-link node: ${currentPath}`);
180
- }
181
- if (index < segments.length - 1 && !stat.isDirectory()) {
182
- throw codedError('invalidPlugin', `${label} contains a non-directory path node: ${currentPath}`);
183
- }
184
- if (index === segments.length - 1 && !stat.isFile()) {
185
- throw codedError('invalidPlugin', `${label} must use a regular file: ${currentPath}`);
186
- }
187
- }
188
- return currentPath;
189
- }
190
- async function assertDirectoryPathChain(boundaryRoot, targetRoot, label) {
191
- const relative = path.relative(boundaryRoot, targetRoot);
192
- if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
193
- throw codedError('invalidPlugin', `${label} source root must stay inside its workspace.`);
194
- }
195
- let currentPath = boundaryRoot;
196
- for (const segment of relative.split(path.sep).filter(Boolean)) {
197
- currentPath = path.join(currentPath, segment);
198
- const stat = await lstatOrNull(currentPath);
199
- if (!stat)
200
- return;
201
- if (stat.isSymbolicLink()) {
202
- throw codedError('invalidPlugin', `${label} contains a symbolic-link path node: ${currentPath}`);
203
- }
204
- if (!stat.isDirectory()) {
205
- throw codedError('invalidPlugin', `${label} contains a non-directory path node: ${currentPath}`);
206
- }
207
- }
208
- }
209
- function calculateCliSourceSetDigest(packageBytes, registryEntries) {
210
- const hash = crypto.createHash('sha256').update('package.json\0').update(packageBytes);
211
- for (const [relativePath, bytes] of registryEntries) {
212
- hash.update(`\0${relativePath}\0`).update(bytes);
213
- }
214
- return `sha256:${hash.digest('hex')}`;
215
- }
216
- async function inspectWorkspaceCliSourceSet(cliRoot, label, boundaryRoot) {
217
- if (boundaryRoot)
218
- await assertDirectoryPathChain(boundaryRoot, cliRoot, label);
219
- const packagePath = path.join(cliRoot, 'package.json');
220
- const registryPaths = CLI_REGISTRY_RELATIVE_PATHS.map((relativePath) => path.join(cliRoot, ...relativePath.split('/')));
221
- const [packageStat, ...registryStats] = await Promise.all([
222
- lstatOrNull(packagePath),
223
- ...registryPaths.map((registryPath) => lstatOrNull(registryPath)),
224
- ]);
225
- if (!packageStat && registryStats.every((stat) => !stat)) {
226
- const cliRootStat = await lstatOrNull(cliRoot);
227
- if (cliRootStat?.isSymbolicLink() || (cliRootStat && !cliRootStat.isDirectory())) {
228
- throw codedError('invalidPlugin', `${label} @aw/cli source root has an invalid node: ${cliRoot}`);
229
- }
230
- return { state: 'none', root: cliRoot };
231
- }
232
- if (!packageStat || !registryStats[0]) {
233
- return { state: 'partial', root: cliRoot };
234
- }
235
- const availableRegistryRelativePaths = CLI_REGISTRY_RELATIVE_PATHS
236
- .filter((_relativePath, index) => registryStats[index]);
237
- await Promise.all([
238
- assertRegularFilePath(cliRoot, 'package.json', `${label} @aw/cli source set`),
239
- ...availableRegistryRelativePaths.map((relativePath) => assertRegularFilePath(cliRoot, relativePath, `${label} @aw/cli source set`)),
240
- ]);
241
- const availableRegistryPaths = availableRegistryRelativePaths.map((relativePath) => path.join(cliRoot, ...relativePath.split('/')));
242
- const [packageBytes, ...registryBytes] = await Promise.all([
243
- fs.readFile(packagePath),
244
- ...availableRegistryPaths.map((registryPath) => fs.readFile(registryPath)),
245
- ]);
246
- let packageDocument;
247
- try {
248
- packageDocument = JSON.parse(packageBytes.toString('utf8'));
249
- for (const bytes of registryBytes)
250
- JSON.parse(bytes.toString('utf8'));
251
- }
252
- catch (error) {
253
- throw codedError('invalidPlugin', `${label} @aw/cli source set contains invalid JSON: ${error.message}`);
254
- }
255
- if (typeof packageDocument?.name !== 'string' || packageDocument.name.trim() === '') {
256
- throw codedError('invalidPlugin', `${label} @aw/cli package name is missing.`);
257
- }
258
- parseStrictSemVer(packageDocument.version, `${label} @aw/cli package version`);
259
- return {
260
- state: 'complete',
261
- root: cliRoot,
262
- packageName: packageDocument.name,
263
- providerVersion: packageDocument.version,
264
- digest: calculateCliSourceSetDigest(packageBytes, availableRegistryRelativePaths.map((relativePath, index) => [relativePath, registryBytes[index]])),
265
- registryRelativePaths: availableRegistryRelativePaths,
266
- };
267
- }
268
- async function materializeCliSourceSet(source, outputRoot, label) {
269
- await fs.mkdir(path.join(outputRoot, 'src', 'utils'), { recursive: true });
270
- await Promise.all([
271
- fs.copyFile(path.join(source.root, 'package.json'), path.join(outputRoot, 'package.json')),
272
- ...source.registryRelativePaths.map((relativePath) => fs.copyFile(path.join(source.root, ...relativePath.split('/')), path.join(outputRoot, ...relativePath.split('/')))),
273
- ]);
274
- const materialized = await inspectWorkspaceCliSourceSet(outputRoot, label);
275
- if (materialized.state !== 'complete'
276
- || materialized.packageName !== source.packageName
277
- || materialized.providerVersion !== source.providerVersion
278
- || materialized.digest !== source.digest) {
279
- throw codedError('invalidPlugin', `${label} @aw/cli source identity changed during materialization.`);
280
- }
281
- return materialized;
282
- }
283
- async function inspectExternalCliProvider(cliPackageRoot) {
284
- const canonicalRoot = await fs.realpath(cliPackageRoot).catch(() => null);
285
- if (!canonicalRoot) {
286
- throw codedError('bundlerUnavailable', 'Plugin version checking cannot resolve the installed CLI package root.');
287
- }
288
- const packagePath = await assertRegularFilePath(canonicalRoot, 'package.json', 'Installed CLI provider');
289
- const registryPaths = await Promise.all(CLI_REGISTRY_RELATIVE_PATHS.map((relativePath) => assertRegularFilePath(canonicalRoot, `dist/${relativePath}`, 'Installed CLI provider')));
290
- const [packageBytes, ...registryBytes] = await Promise.all([
291
- fs.readFile(packagePath),
292
- ...registryPaths.map((registryPath) => fs.readFile(registryPath)),
293
- ]);
294
- let packageDocument;
295
- try {
296
- packageDocument = JSON.parse(packageBytes.toString('utf8'));
297
- for (const bytes of registryBytes)
298
- JSON.parse(bytes.toString('utf8'));
299
- }
300
- catch (error) {
301
- throw codedError('bundlerUnavailable', `Installed CLI provider contains invalid JSON: ${error.message}`);
302
- }
303
- if (packageDocument?.name !== CLI_PACKAGE_NAME) {
304
- throw codedError('bundlerUnavailable', `Installed CLI provider package name must be ${JSON.stringify(CLI_PACKAGE_NAME)}.`);
305
- }
306
- parseStrictSemVer(packageDocument.version, 'installed CLI provider version');
307
- return {
308
- root: canonicalRoot,
309
- packagePath,
310
- registryPaths,
311
- packageName: packageDocument.name,
312
- providerVersion: packageDocument.version,
313
- digest: calculateCliSourceSetDigest(packageBytes, CLI_REGISTRY_RELATIVE_PATHS.map((relativePath, index) => [relativePath, registryBytes[index]])),
314
- };
315
- }
316
- async function materializeExternalCliProvider(provider, outputRoot, label) {
317
- await fs.mkdir(path.join(outputRoot, 'src', 'utils'), { recursive: true });
318
- await Promise.all([
319
- fs.copyFile(provider.packagePath, path.join(outputRoot, 'package.json')),
320
- ...CLI_REGISTRY_RELATIVE_PATHS.map((relativePath, index) => fs.copyFile(provider.registryPaths[index], path.join(outputRoot, ...relativePath.split('/')))),
321
- ]);
322
- return inspectWorkspaceCliSourceSet(outputRoot, label);
323
- }
324
- async function resolveCliVirtualSourceSets(options) {
325
- const baseSource = await inspectWorkspaceCliSourceSet(path.join(options.baseSourceRoot, 'packages', 'cli'), 'Git base', options.baseSourceRoot);
326
- const currentSource = await inspectWorkspaceCliSourceSet(path.join(options.repoRoot, 'packages', 'cli'), 'current workspace', options.repoRoot);
327
- if (baseSource.state === 'partial') {
328
- throw codedError('invalidPlugin', 'Git base contains an incomplete @aw/cli virtual authoring source set.');
329
- }
330
- if (currentSource.state === 'partial') {
331
- throw codedError('invalidPlugin', 'Found an incomplete current workspace @aw/cli source set.');
332
- }
333
- if (baseSource.state !== currentSource.state) {
334
- throw codedError('invalidPlugin', 'Git base and current workspace CLI source ownership differs; version checking cannot mix workspace and external providers.');
335
- }
336
- if (baseSource.state === 'complete') {
337
- const currentMaterialized = await materializeCliSourceSet(currentSource, path.join(options.tempRoot, 'current-cli-workspace'), 'current workspace materialization');
338
- return {
339
- base: baseSource,
340
- current: currentMaterialized,
341
- };
342
- }
343
- const externalProvider = await inspectExternalCliProvider(options.cliPackageRoot);
344
- const [baseExternal, currentExternal] = await Promise.all([
345
- materializeExternalCliProvider(externalProvider, path.join(options.tempRoot, 'base-cli-external'), 'base external CLI provider'),
346
- materializeExternalCliProvider(externalProvider, path.join(options.tempRoot, 'current-cli-external'), 'current external CLI provider'),
347
- ]);
348
- for (const materialized of [baseExternal, currentExternal]) {
349
- if (materialized.state !== 'complete'
350
- || materialized.packageName !== externalProvider.packageName
351
- || materialized.providerVersion !== externalProvider.providerVersion
352
- || materialized.digest !== externalProvider.digest) {
353
- throw codedError('invalidPlugin', 'External CLI provider identity changed during independent materialization.');
354
- }
355
- }
356
- if (baseExternal.root === currentExternal.root || baseExternal.digest !== currentExternal.digest) {
357
- throw codedError('invalidPlugin', 'External CLI provider materializations are not independent and identical.');
358
- }
359
- return { base: baseExternal, current: currentExternal };
360
- }
361
- async function readManifestDocument(pluginRoot) {
378
+ export async function readManifestDocument(pluginRoot) {
362
379
  const manifestPath = path.join(pluginRoot, '.agents-plugin', 'plugin.json');
363
380
  let manifest;
364
381
  try {
@@ -401,16 +418,13 @@ function compareBundleEntries(baseEntries, currentEntries) {
401
418
  .filter((filePath) => baseEntries.get(filePath) !== currentEntries.get(filePath))
402
419
  .sort();
403
420
  }
404
- async function bundlePlugin(bundler, sourceSetRoot, cliVirtualExportRoot, cliProviderVersion, pluginRoot, outputRoot, runtimeSkillClosureValidation = 'current') {
421
+ async function bundlePlugin(bundler, sourceSetRoot, pluginRoot, outputRoot, runtimeSkillClosureValidation = 'current') {
405
422
  const sourceSetPlugins = await bundler.discoverPlugins(sourceSetRoot);
406
423
  const plugin = await bundler.readPluginManifest(pluginRoot);
407
424
  if (!sourceSetPlugins.some((candidate) => candidate.manifest.name === plugin.manifest.name)) {
408
425
  sourceSetPlugins.push(plugin);
409
426
  }
410
- const runtimeResolver = bundler.createRuntimeResolver(sourceSetPlugins, {
411
- cliVirtualExportRoot,
412
- cliProviderVersion,
413
- });
427
+ const runtimeResolver = bundler.createRuntimeResolver(sourceSetPlugins);
414
428
  await bundler.bundleLocalPlugin(plugin, outputRoot, {
415
429
  buildMode: 'staging',
416
430
  runtimeResolver,
@@ -439,7 +453,7 @@ function createCheckResult(pluginName, values = {}) {
439
453
  };
440
454
  }
441
455
  async function checkOnePlugin(options) {
442
- const { repoRoot, pluginName, bundler, tempRoot, baseSourceRoot, cliVirtualSources, currentRoot, baseRoot, } = options;
456
+ const { repoRoot, pluginName, bundler, tempRoot, baseSourceRoot, currentRoot, baseRoot, } = options;
443
457
  if (!PLUGIN_NAME_PATTERN.test(pluginName)) {
444
458
  return createCheckResult(pluginName, {
445
459
  ok: false,
@@ -476,7 +490,7 @@ async function checkOnePlugin(options) {
476
490
  if (!baseRoot) {
477
491
  let currentBundle;
478
492
  try {
479
- currentBundle = await bundlePlugin(bundler, repoRoot, cliVirtualSources.current.root, cliVirtualSources.current.providerVersion, currentRoot, path.join(tempRoot, 'bundles', pluginName, 'current'));
493
+ currentBundle = await bundlePlugin(bundler, repoRoot, currentRoot, path.join(tempRoot, 'bundles', pluginName, 'current'));
480
494
  }
481
495
  catch (error) {
482
496
  return createCheckResult(pluginName, {
@@ -520,8 +534,8 @@ async function checkOnePlugin(options) {
520
534
  let bundleResults;
521
535
  try {
522
536
  bundleResults = await Promise.allSettled([
523
- bundlePlugin(bundler, baseSourceRoot, cliVirtualSources.base.root, cliVirtualSources.base.providerVersion, baseRoot, path.join(tempRoot, 'bundles', pluginName, 'base'), 'historical'),
524
- bundlePlugin(bundler, repoRoot, cliVirtualSources.current.root, cliVirtualSources.current.providerVersion, currentRoot, path.join(tempRoot, 'bundles', pluginName, 'current')),
537
+ bundlePlugin(bundler, baseSourceRoot, baseRoot, path.join(tempRoot, 'bundles', pluginName, 'base'), 'historical'),
538
+ bundlePlugin(bundler, repoRoot, currentRoot, path.join(tempRoot, 'bundles', pluginName, 'current')),
525
539
  ]);
526
540
  }
527
541
  finally {
@@ -702,12 +716,6 @@ export async function checkPluginVersions(options = {}) {
702
716
  }
703
717
  currentRoots.set(pluginName, currentRoot);
704
718
  }
705
- const cliVirtualSources = await resolveCliVirtualSourceSets({
706
- baseSourceRoot,
707
- repoRoot,
708
- cliPackageRoot,
709
- tempRoot,
710
- });
711
719
  const checks = [];
712
720
  for (const pluginName of pluginNames) {
713
721
  const currentRoot = currentRoots.get(pluginName);
@@ -730,7 +738,6 @@ export async function checkPluginVersions(options = {}) {
730
738
  bundler,
731
739
  tempRoot,
732
740
  baseSourceRoot,
733
- cliVirtualSources,
734
741
  currentRoot,
735
742
  baseRoot,
736
743
  }));