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

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
@@ -6,6 +6,7 @@ import { createRequire } from 'node:module';
6
6
  import * as os from 'node:os';
7
7
  import * as path from 'node:path';
8
8
  import { fileURLToPath, pathToFileURL } from 'node:url';
9
+ import { AW_RUNTIME_CONFIG_READER_PATH, createRuntimeConfigSnapshot, getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, normalizePluginConfigDefinition, } from '@lesliechan721/aw-plugin-core/manifest';
9
10
  import { checkPluginVersions } from './lib/plugin-version-check.mjs';
10
11
  import { scanJavaScriptImportSpecifiers } from './lib/javascript-import-scanner.mjs';
11
12
  import { assertAuthoringPluginPathFence, assertCanonicalAuthoringPluginRoot, } from './lib/plugin-root.mjs';
@@ -17,8 +18,8 @@ const CLI_PACKAGE_ROOT = path.basename(authoringRuntimeRoot) === 'dist'
17
18
  : authoringRuntimeRoot;
18
19
  const errors = [];
19
20
  const warnings = [];
20
- let pluginAuthoringCapabilityRegistry = null;
21
- const SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION = 7;
21
+ const SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION = 16;
22
+ let capabilityDiagnostic = null;
22
23
  const MAX_SKILL_NAME_LEN = 64;
23
24
  const MAX_SKILL_DESCRIPTION_LEN = 1024;
24
25
  const MAX_SKILL_COMPATIBILITY_LEN = 500;
@@ -50,9 +51,9 @@ const CODEX_POLICY_PRODUCTS = new Set([
50
51
  'codex',
51
52
  'CODEX',
52
53
  ]);
53
- const MANIFEST_POLICY_PRODUCTS = new Set(getPluginAuthoringAcceptedValues('plugin-manifest', 'marketplace.policy.products'));
54
- const MARKETPLACE_AUTHENTICATION_POLICIES = new Set(getPluginAuthoringAcceptedValues('plugin-manifest', 'marketplace.policy.authentication'));
55
- const MARKETPLACE_INSTALLATION_POLICIES = new Set(getPluginAuthoringAcceptedValues('plugin-manifest', 'marketplace.policy.installation'));
54
+ const MANIFEST_POLICY_PRODUCTS = new Set(getPluginAuthoringAcceptedValues('manifest', 'marketplace.policy.products'));
55
+ const MARKETPLACE_AUTHENTICATION_POLICIES = new Set(getPluginAuthoringAcceptedValues('manifest', 'marketplace.policy.authentication'));
56
+ const MARKETPLACE_INSTALLATION_POLICIES = new Set(getPluginAuthoringAcceptedValues('manifest', 'marketplace.policy.installation'));
56
57
  const PUBLIC_HOOK_EVENTS = new Set(['before_tool', 'after_tool', 'session_start']);
57
58
  const PUBLIC_SESSION_START_SOURCES = new Set(['startup', 'resume', 'clear']);
58
59
  const PUBLIC_SESSION_START_DEFAULT_MATCHER = 'startup|resume|clear';
@@ -124,15 +125,10 @@ const TEMPLATE_TEXT_FILE_EXTENSIONS = /\.(md|markdown|txt|json|yaml|yml|toml|rul
124
125
  const SLASH_COMMAND_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
125
126
  const DEFAULT_SLASH_COMMANDS_DIR = 'slash-commands';
126
127
  const SCRIPT_NODE_EXTENSIONS = new Set(['.js', '.mjs', '.cjs']);
127
- const SCRIPT_AUTO_EXTENSIONS = new Set(['.js', '.mjs', '.cjs', '.sh', '.ps1', '.cmd', '.bat']);
128
- const SCRIPT_RUNNERS = new Set(['node', 'sh', 'bash', 'pwsh', 'powershell', 'cmd', 'auto']);
129
- const SCRIPT_OS_SELECTORS = new Set(['default', 'unix', 'windows', 'linux', 'darwin', 'win32']);
130
- const SCRIPT_LIFECYCLE_EVENTS = new Set(['install', 'upgrade', 'uninstall']);
131
128
  const SCRIPT_TIMEOUT_MIN_MS = 1000;
132
- const SCRIPT_TIMEOUT_MAX_MS = 300000;
133
- const CONFIG_FIELD_TYPES = new Set(getPluginAuthoringAcceptedValues('config-lifecycle-artifact', 'config.schema.<key>.type'));
134
- const ARTIFACT_TARGETS = new Set(getPluginAuthoringAcceptedValues('config-lifecycle-artifact', 'artifacts.targets[].target'));
135
- const ARTIFACT_STATES = new Set(getPluginAuthoringAcceptedValues('config-lifecycle-artifact', 'ArtifactPlan.artifacts[].state'));
129
+ const SCRIPT_TIMEOUT_MAX_MS = 1800000;
130
+ const ARTIFACT_TARGETS = new Set(getPluginAuthoringAcceptedValues('artifacts', 'artifacts.targets[].target'));
131
+ const ARTIFACT_STATES = new Set(getPluginAuthoringAcceptedValues('artifacts', 'artifacts.targets[].states'));
136
132
  const ARTIFACT_SCOPES = new Set(['user', 'project']);
137
133
  const ARTIFACT_KINDS = new Set(['instruction', 'codexRole', 'skill']);
138
134
  const ARTIFACT_PROJECT_MANAGED_KINDS = new Set(['instruction', 'agent', 'skill']);
@@ -149,23 +145,9 @@ const ARTIFACT_PROJECT_MANAGED_KIND_BY_TARGET = {
149
145
  'codex.skill': 'skill',
150
146
  };
151
147
  const PLUGIN_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
152
- const PLUGIN_EVAL_SCHEMA_VERSION = 2;
153
- const PLUGIN_EVAL_CASE_SCHEMA_VERSION = 1;
154
- const PLUGIN_EVAL_SCOPES = new Set(['user', 'project']);
155
- const PLUGIN_EVAL_SPLITS = new Set(['train', 'validation', 'sanity', 'all']);
156
- const PLUGIN_EVAL_TRIGGER_CASE_SPLITS = new Set(['train', 'validation', 'sanity']);
157
- const PLUGIN_EVAL_COMMAND_SUPPORTS = new Set([
158
- 'split',
159
- 'runs',
160
- 'case',
161
- 'model',
162
- 'codexBin',
163
- 'timeout',
164
- 'allowEnvironmentSkips',
165
- ]);
166
148
  let yamlParser = null;
167
- let skillFrontmatterCapabilityRegistry = null;
168
149
  let pluginVersionCheckResult = null;
150
+ let skillEvalManifestTools = null;
169
151
  function error(msg) {
170
152
  errors.push(msg);
171
153
  }
@@ -323,57 +305,25 @@ function parseFrontmatter(content, sourceName) {
323
305
  return null;
324
306
  return parseYaml(match[1], sourceName);
325
307
  }
326
- function loadPluginAuthoringCapabilityRegistry() {
327
- if (pluginAuthoringCapabilityRegistry)
328
- return pluginAuthoringCapabilityRegistry;
329
- const registryPath = [
330
- path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'plugin-authoring-capabilities.json'),
331
- path.resolve(__dirname, '..', '..', 'dist', 'src', 'utils', 'plugin-authoring-capabilities.json'),
332
- ].find((candidate) => fs.existsSync(candidate));
333
- if (!registryPath) {
334
- throw new Error('Plugin authoring capability registry not found in the built CLI.');
335
- }
336
- const registry = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
337
- if (!registry || registry.schemaVersion !== 1 || !registry.surfaces) {
338
- throw new Error(`Invalid plugin authoring capability registry: ${registryPath}`);
339
- }
340
- pluginAuthoringCapabilityRegistry = registry;
341
- return registry;
342
- }
343
308
  function getPluginAuthoringAcceptedValues(surface, field) {
344
- const entry = loadPluginAuthoringCapabilityRegistry().surfaces[surface]?.entries
345
- ?.find((candidate) => candidate.field === field);
346
- if (!entry || !Array.isArray(entry.acceptedValues)) {
347
- throw new Error(`Plugin authoring capability ${surface}.${field} has no accepted values.`);
348
- }
349
- return entry.acceptedValues;
309
+ return getCorePluginAuthoringAcceptedValues(surface, field);
350
310
  }
351
311
  function loadSkillFrontmatterCapabilityRegistry() {
352
- if (skillFrontmatterCapabilityRegistry)
353
- return skillFrontmatterCapabilityRegistry;
354
- const registryPath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'skill-frontmatter-capabilities.json');
355
- if (!fs.existsSync(registryPath)) {
356
- throw new Error(`Skill frontmatter capability registry not found: ${registryPath}`);
357
- }
358
- const registry = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
359
- if (!registry ||
360
- registry.schemaVersion !== 1 ||
361
- !registry.profiles ||
362
- !registry.fields) {
363
- throw new Error(`Invalid Skill frontmatter capability registry: ${registryPath}`);
364
- }
365
- skillFrontmatterCapabilityRegistry = registry;
366
- return registry;
312
+ return getSkillFrontmatterCapabilityRegistry();
367
313
  }
368
314
  async function tryLoadCliManifestTools() {
369
315
  const manifestModulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'manifest.js');
370
316
  const runtimeProjectionModulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'catalog-runtime-projection.js');
371
- if (!fs.existsSync(manifestModulePath) || !fs.existsSync(runtimeProjectionModulePath))
317
+ const capabilityModulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'commands', 'aw-capabilities.js');
318
+ if (!fs.existsSync(manifestModulePath)
319
+ || !fs.existsSync(runtimeProjectionModulePath)
320
+ || !fs.existsSync(capabilityModulePath))
372
321
  return null;
373
322
  try {
374
- const [manifestModule, runtimeProjectionModule] = await Promise.all([
323
+ const [manifestModule, runtimeProjectionModule, capabilityModule] = await Promise.all([
375
324
  import(pathToFileURL(manifestModulePath).href),
376
325
  import(pathToFileURL(runtimeProjectionModulePath).href),
326
+ import(pathToFileURL(capabilityModulePath).href),
377
327
  ]);
378
328
  if (manifestModule.SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION
379
329
  !== SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION) {
@@ -384,6 +334,8 @@ async function tryLoadCliManifestTools() {
384
334
  validateSourcePluginManifest: manifestModule.validateSourcePluginManifest ?? null,
385
335
  readPluginManifest: manifestModule.readPluginManifest ?? null,
386
336
  discoverPlugins: manifestModule.discoverPlugins ?? null,
337
+ resolvePluginRequirements: manifestModule.resolvePluginRequirements ?? null,
338
+ implementedCapabilities: capabilityModule.IMPLEMENTED_AW_CAPABILITIES ?? null,
387
339
  createRuntimeResolver: runtimeProjectionModule.createCatalogRuntimeImportResolver ?? null,
388
340
  };
389
341
  }
@@ -535,11 +487,12 @@ function validateManifestLightweight(manifest) {
535
487
  error('top-level "commands" has been removed; use "slashCommands" instead');
536
488
  }
537
489
  validateAllowedKeys(input, 'plugin manifest', [
490
+ 'schemaVersion',
538
491
  'name',
539
492
  'version',
540
493
  'description',
541
494
  'dependencies',
542
- 'compatibility',
495
+ 'requires',
543
496
  'skills',
544
497
  'slashCommands',
545
498
  'mcpServers',
@@ -650,7 +603,7 @@ function validatePortableNativeArtifactCapabilityLightweight(manifest) {
650
603
  && Array.isArray(target.states)
651
604
  && target.states.includes('present'));
652
605
  if (!hasOtherNativeDeclaration && !hasPresentNativeArtifact) {
653
- const message = 'Invalid plugin manifest: portable-only plugins are not supported in V1. Declare at least one non-empty native capability.';
606
+ const message = 'Invalid plugin manifest: portable-only plugins are not supported. Declare at least one non-empty native capability.';
654
607
  if (!errors.includes(message))
655
608
  error(message);
656
609
  }
@@ -987,703 +940,19 @@ function validateNonEmptyString(value, fieldName, maxLength) {
987
940
  }
988
941
  return trimmed;
989
942
  }
990
- function isPathInsideOrEqual(root, candidate) {
991
- const relative = path.relative(root, candidate);
992
- return relative === '' || (relative !== '..' &&
993
- !relative.startsWith(`..${path.sep}`) &&
994
- !path.isAbsolute(relative));
995
- }
996
- function validateRealPathBoundary(boundary, candidate, fieldName, boundaryName) {
997
- const canonicalBoundary = fs.realpathSync(boundary);
998
- const canonicalCandidate = fs.realpathSync(candidate);
999
- if (!isPathInsideOrEqual(canonicalBoundary, canonicalCandidate)) {
1000
- error(`${fieldName} must stay inside the ${boundaryName}`);
1001
- return false;
1002
- }
1003
- return true;
1004
- }
1005
- function validateEvalRelativeFile(evalDir, value, fieldName) {
1006
- const relativePath = validateNonEmptyString(value, fieldName);
1007
- if (!relativePath)
1008
- return null;
1009
- const normalized = stripDotSlash(relativePath).split('\\').join('/');
1010
- if (path.isAbsolute(normalized) || normalized.split('/').includes('..')) {
1011
- error(`${fieldName} must stay inside the Skill eval directory`);
1012
- return null;
1013
- }
1014
- const absolutePath = path.resolve(evalDir, normalized);
1015
- const relativeToRoot = path.relative(evalDir, absolutePath);
1016
- if (relativeToRoot.startsWith('..') || path.isAbsolute(relativeToRoot)) {
1017
- error(`${fieldName} must stay inside the Skill eval directory`);
1018
- return null;
1019
- }
1020
- if (!fs.existsSync(absolutePath) || !fs.statSync(absolutePath).isFile()) {
1021
- error(`${fieldName} does not exist: ${normalized}`);
1022
- return null;
1023
- }
1024
- if (!validateRealPathBoundary(evalDir, absolutePath, fieldName, 'Skill eval directory')) {
1025
- return null;
1026
- }
1027
- return absolutePath;
1028
- }
1029
- function validateEvalWorkspacePath(value, fieldName, options = {}) {
1030
- const raw = validateNonEmptyString(value, fieldName);
1031
- if (!raw)
1032
- return null;
1033
- const treePattern = options.allowTreePattern === true && raw.endsWith('/**');
1034
- const candidate = treePattern ? raw.slice(0, -3) : raw;
1035
- if (candidate === '' ||
1036
- candidate.includes('\0') ||
1037
- candidate.includes('\\') ||
1038
- candidate.includes('*') ||
1039
- candidate.includes('?') ||
1040
- candidate.includes('[') ||
1041
- candidate.includes(']') ||
1042
- path.isAbsolute(candidate) ||
1043
- path.posix.normalize(candidate) !== candidate ||
1044
- candidate.split('/').includes('..')) {
1045
- error(`${fieldName} must be a normalized POSIX path inside the eval workspace`);
1046
- return null;
1047
- }
1048
- const firstSegment = candidate.split('/')[0];
1049
- if (firstSegment === '.git' || firstSegment === '.agents' || firstSegment === '.codex') {
1050
- error(`${fieldName} must not target an eval control directory`);
1051
- return null;
1052
- }
1053
- return raw;
1054
- }
1055
- function evalWorkspacePathMatchesPattern(relativePath, pattern) {
1056
- if (pattern.endsWith('/**')) {
1057
- const prefix = pattern.slice(0, -3);
1058
- return relativePath === prefix || relativePath.startsWith(`${prefix}/`);
1059
- }
1060
- return relativePath === pattern;
1061
- }
1062
- function validateConversationCaseCorpus(evalDir, suite, fieldName) {
1063
- const casesPath = validateEvalRelativeFile(evalDir, suite.cases, `${fieldName}.cases`);
1064
- if (!casesPath)
1065
- return;
1066
- let document;
943
+ async function loadSkillEvalManifestTools() {
944
+ if (skillEvalManifestTools)
945
+ return skillEvalManifestTools;
946
+ const modulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'eval', 'manifest-v1.js');
1067
947
  try {
1068
- document = JSON.parse(fs.readFileSync(casesPath, 'utf8'));
1069
- }
1070
- catch (e) {
1071
- error(`${fieldName}.cases is not valid JSON: ${e.message}`);
1072
- return;
1073
- }
1074
- const corpus = expectRecord(document, `${fieldName}.cases document`);
1075
- if (!corpus)
1076
- return;
1077
- const skillName = validateNonEmptyString(corpus.skill_name, `${fieldName}.cases.skill_name`);
1078
- if (skillName && skillName !== suite.skill) {
1079
- error(`${fieldName}.cases.skill_name must match ${JSON.stringify(suite.skill)}`);
948
+ skillEvalManifestTools = await import(pathToFileURL(modulePath).href);
949
+ return skillEvalManifestTools;
1080
950
  }
1081
- if (!Array.isArray(corpus.evals) || corpus.evals.length === 0) {
1082
- error(`${fieldName}.cases.evals must be a non-empty array`);
1083
- return;
1084
- }
1085
- const ids = new Set();
1086
- corpus.evals.forEach((value, caseIndex) => {
1087
- const caseField = `${fieldName}.cases.evals[${caseIndex}]`;
1088
- const entry = expectRecord(value, caseField);
1089
- if (!entry)
1090
- return;
1091
- const id = validateNonEmptyString(entry.id, `${caseField}.id`);
1092
- if (id && ids.has(id)) {
1093
- error(`${fieldName}.cases has duplicate case id ${JSON.stringify(id)}`);
1094
- }
1095
- else if (id) {
1096
- ids.add(id);
1097
- }
1098
- validateNonEmptyString(entry.prompt, `${caseField}.prompt`);
1099
- const sandbox = entry.sandbox === undefined
1100
- ? 'read-only'
1101
- : validateNonEmptyString(entry.sandbox, `${caseField}.sandbox`);
1102
- if (sandbox && sandbox !== 'read-only' && sandbox !== 'workspace-write') {
1103
- error(`${caseField}.sandbox must be "read-only" or "workspace-write"`);
1104
- }
1105
- if (!Array.isArray(entry.scripted_replies)) {
1106
- error(`${caseField}.scripted_replies must be an array`);
1107
- }
1108
- else {
1109
- entry.scripted_replies.forEach((reply, replyIndex) => {
1110
- const replyField = `${caseField}.scripted_replies[${replyIndex}]`;
1111
- if (typeof reply === 'string')
1112
- return;
1113
- const replyEntry = expectRecord(reply, replyField);
1114
- if (!replyEntry)
1115
- return;
1116
- if (!Array.isArray(replyEntry.answers_by_index) || replyEntry.answers_by_index.some((answer) => typeof answer !== 'string')) {
1117
- error(`${replyField}.answers_by_index must be an array of strings`);
1118
- }
1119
- if (replyEntry.expected_question_count !== undefined &&
1120
- (!Number.isInteger(replyEntry.expected_question_count) ||
1121
- replyEntry.expected_question_count < 0)) {
1122
- error(`${replyField}.expected_question_count must be a non-negative integer`);
1123
- }
1124
- validateNonEmptyString(replyEntry.unexpected_question_answer, `${replyField}.unexpected_question_answer`);
1125
- });
1126
- }
1127
- validateNonEmptyString(entry.expected_output, `${caseField}.expected_output`);
1128
- if (entry.workspace_files !== undefined) {
1129
- const workspaceFiles = expectRecord(entry.workspace_files, `${caseField}.workspace_files`);
1130
- if (workspaceFiles) {
1131
- const workspaceFileEntries = Object.entries(workspaceFiles);
1132
- if (workspaceFileEntries.length === 0) {
1133
- error(`${caseField}.workspace_files must contain at least one file`);
1134
- }
1135
- workspaceFileEntries.forEach(([relativePath, content]) => {
1136
- validateEvalWorkspacePath(relativePath, `${caseField}.workspace_files.${relativePath}`, { allowTreePattern: false });
1137
- validateNonEmptyString(content, `${caseField}.workspace_files.${relativePath}`);
1138
- });
1139
- }
1140
- }
1141
- const review = expectRecord(entry.review, `${caseField}.review`);
1142
- if (review) {
1143
- if (!Array.isArray(review.checks) || review.checks.length === 0 || review.checks.some((check) => typeof check !== 'string' || check.trim() === '')) {
1144
- error(`${caseField}.review.checks must be a non-empty array of strings`);
1145
- }
1146
- if (review.workspace_unchanged !== undefined &&
1147
- typeof review.workspace_unchanged !== 'boolean') {
1148
- error(`${caseField}.review.workspace_unchanged must be boolean`);
1149
- }
1150
- const allowedWorkspaceChanges = [];
1151
- if (review.allowed_workspace_changes !== undefined) {
1152
- if (!Array.isArray(review.allowed_workspace_changes) ||
1153
- review.allowed_workspace_changes.length === 0) {
1154
- error(`${caseField}.review.allowed_workspace_changes must be a non-empty array`);
1155
- }
1156
- else {
1157
- review.allowed_workspace_changes.forEach((pathValue, pathIndex) => {
1158
- const normalized = validateEvalWorkspacePath(pathValue, `${caseField}.review.allowed_workspace_changes[${pathIndex}]`, { allowTreePattern: true });
1159
- if (normalized)
1160
- allowedWorkspaceChanges.push(normalized);
1161
- });
1162
- }
1163
- }
1164
- const artifactPaths = [];
1165
- if (review.artifacts !== undefined) {
1166
- if (!Array.isArray(review.artifacts) || review.artifacts.length === 0) {
1167
- error(`${caseField}.review.artifacts must be a non-empty array`);
1168
- }
1169
- else {
1170
- review.artifacts.forEach((artifactValue, artifactIndex) => {
1171
- const artifactField = `${caseField}.review.artifacts[${artifactIndex}]`;
1172
- const artifact = expectRecord(artifactValue, artifactField);
1173
- if (!artifact)
1174
- return;
1175
- validateAllowedKeys(artifact, artifactField, ['path', 'exists', 'contains', 'not_contains', 'json']);
1176
- const artifactPath = validateEvalWorkspacePath(artifact.path, `${artifactField}.path`);
1177
- if (artifactPath)
1178
- artifactPaths.push(artifactPath);
1179
- if (artifact.exists !== undefined && typeof artifact.exists !== 'boolean') {
1180
- error(`${artifactField}.exists must be boolean`);
1181
- }
1182
- for (const key of ['contains', 'not_contains']) {
1183
- if (artifact[key] !== undefined &&
1184
- (!Array.isArray(artifact[key]) || artifact[key].length === 0 || artifact[key].some((fragment) => typeof fragment !== 'string' || fragment.length === 0))) {
1185
- error(`${artifactField}.${key} must be a non-empty array of strings`);
1186
- }
1187
- }
1188
- if (artifact.json !== undefined && !isRecord(artifact.json)) {
1189
- error(`${artifactField}.json must be an object`);
1190
- }
1191
- });
1192
- }
1193
- }
1194
- if (new Set(artifactPaths).size !== artifactPaths.length) {
1195
- error(`${caseField}.review.artifacts contains duplicate paths`);
1196
- }
1197
- if (sandbox === 'workspace-write') {
1198
- if (review.workspace_unchanged !== false) {
1199
- error(`${caseField} workspace-write requires review.workspace_unchanged=false`);
1200
- }
1201
- if (allowedWorkspaceChanges.length === 0 || artifactPaths.length === 0) {
1202
- error(`${caseField} workspace-write requires allowed changes and artifacts`);
1203
- }
1204
- const unmatchedArtifact = artifactPaths.find((artifactPath) => !allowedWorkspaceChanges.some((pattern) => evalWorkspacePathMatchesPattern(artifactPath, pattern)));
1205
- if (unmatchedArtifact) {
1206
- error(`${caseField} artifact ${JSON.stringify(unmatchedArtifact)} is outside allowed changes`);
1207
- }
1208
- }
1209
- }
1210
- });
1211
- }
1212
- function validateTriggerCaseCorpus(evalDir, suite, fieldName) {
1213
- const casesPath = validateEvalRelativeFile(evalDir, suite.cases, `${fieldName}.cases`);
1214
- if (!casesPath)
1215
- return;
1216
- let document;
1217
- try {
1218
- document = JSON.parse(fs.readFileSync(casesPath, 'utf8'));
1219
- }
1220
- catch (e) {
1221
- error(`${fieldName}.cases is not valid JSON: ${e.message}`);
1222
- return;
1223
- }
1224
- const corpus = expectRecord(document, `${fieldName}.cases document`);
1225
- if (!corpus)
1226
- return;
1227
- if (corpus.schemaVersion !== PLUGIN_EVAL_CASE_SCHEMA_VERSION) {
1228
- error(`${fieldName}.cases.schemaVersion must be ${PLUGIN_EVAL_CASE_SCHEMA_VERSION}`);
1229
- }
1230
- if (corpus.skill !== suite.skill) {
1231
- error(`${fieldName}.cases.skill must match ${JSON.stringify(suite.skill)}`);
1232
- }
1233
- if (!Array.isArray(corpus.cases) || corpus.cases.length === 0) {
1234
- error(`${fieldName}.cases.cases must be a non-empty array`);
1235
- return;
1236
- }
1237
- const ids = new Set();
1238
- const seenSplits = new Set();
1239
- let hasWorkspaceFixture = false;
1240
- corpus.cases.forEach((value, caseIndex) => {
1241
- const caseField = `${fieldName}.cases.cases[${caseIndex}]`;
1242
- const entry = expectRecord(value, caseField);
1243
- if (!entry)
1244
- return;
1245
- const id = validateNonEmptyString(entry.id, `${caseField}.id`);
1246
- if (id && !/^[a-z0-9][a-z0-9_]*$/.test(id)) {
1247
- error(`${caseField}.id must use lowercase snake_case`);
1248
- }
1249
- else if (id && ids.has(id)) {
1250
- error(`${fieldName}.cases has duplicate case id ${JSON.stringify(id)}`);
1251
- }
1252
- else if (id) {
1253
- ids.add(id);
1254
- }
1255
- if (!PLUGIN_EVAL_TRIGGER_CASE_SPLITS.has(entry.split)) {
1256
- error(`${caseField}.split must be train, validation, or sanity`);
1257
- }
1258
- else {
1259
- seenSplits.add(entry.split);
1260
- }
1261
- validateNonEmptyString(entry.query, `${caseField}.query`);
1262
- const usesLegacyExpectation = entry.should_load_skill !== undefined;
1263
- const usesRouteExpectation = entry.expected_loaded_skills !== undefined;
1264
- if (usesLegacyExpectation === usesRouteExpectation) {
1265
- error(`${caseField} must declare exactly one of should_load_skill or expected_loaded_skills`);
1266
- }
1267
- else if (usesLegacyExpectation && typeof entry.should_load_skill !== 'boolean') {
1268
- error(`${caseField}.should_load_skill must be boolean`);
1269
- }
1270
- else if (usesRouteExpectation) {
1271
- if (!Array.isArray(entry.expected_loaded_skills)) {
1272
- error(`${caseField}.expected_loaded_skills must be an array`);
1273
- }
1274
- else {
1275
- const expectedSkills = entry.expected_loaded_skills;
1276
- expectedSkills.forEach((skillName, skillIndex) => {
1277
- if (typeof skillName !== 'string' || skillName.trim() === '') {
1278
- error(`${caseField}.expected_loaded_skills[${skillIndex}] must be a non-empty string`);
1279
- }
1280
- else if (!suite.skills.includes(skillName)) {
1281
- error(`${caseField}.expected_loaded_skills[${skillIndex}] must name a participant Skill`);
1282
- }
1283
- });
1284
- if (new Set(expectedSkills).size !== expectedSkills.length) {
1285
- error(`${caseField}.expected_loaded_skills must not contain duplicates`);
1286
- }
1287
- if (suite.forbidMultipleSkillLoads === true && expectedSkills.length > 1) {
1288
- error(`${caseField} expects multiple Skills but the suite forbids multiple Skill loads`);
1289
- }
1290
- }
1291
- }
1292
- if (suite.observeSpawnAgent === true) {
1293
- if (typeof entry.should_spawn_agent !== 'boolean') {
1294
- error(`${caseField}.should_spawn_agent is required when observeSpawnAgent=true`);
1295
- }
1296
- }
1297
- else if (entry.should_spawn_agent !== undefined) {
1298
- error(`${caseField}.should_spawn_agent requires observeSpawnAgent=true`);
1299
- }
1300
- if (entry.workspace_fixture !== undefined) {
1301
- hasWorkspaceFixture = true;
1302
- validateNonEmptyString(entry.workspace_fixture, `${caseField}.workspace_fixture`);
1303
- }
1304
- if (entry.use_project_rules !== undefined &&
1305
- typeof entry.use_project_rules !== 'boolean') {
1306
- error(`${caseField}.use_project_rules must be boolean`);
1307
- }
1308
- if (entry.tags !== undefined) {
1309
- if (!Array.isArray(entry.tags) || entry.tags.length === 0) {
1310
- error(`${caseField}.tags must be a non-empty array`);
1311
- }
1312
- else {
1313
- entry.tags.forEach((tag, tagIndex) => {
1314
- validateNonEmptyString(tag, `${caseField}.tags[${tagIndex}]`);
1315
- });
1316
- }
1317
- }
1318
- });
1319
- if (hasWorkspaceFixture && suite.fixtureModule === undefined) {
1320
- error(`${fieldName}.fixtureModule is required when cases declare workspace_fixture`);
1321
- }
1322
- if (Array.isArray(suite.releaseSplits)) {
1323
- suite.releaseSplits.forEach((split) => {
1324
- if (split !== 'all' && !seenSplits.has(split)) {
1325
- error(`${fieldName}.cases has no cases for release split ${JSON.stringify(split)}`);
1326
- }
1327
- });
1328
- }
1329
- }
1330
- function resolveEvalProfilePlugin(pluginDir, ownerManifest, pluginName, fieldName) {
1331
- if (pluginName === ownerManifest.name) {
1332
- return { pluginDir, manifest: ownerManifest };
1333
- }
1334
- const companionDir = path.join(path.dirname(pluginDir), pluginName);
1335
- const manifestPath = path.join(companionDir, '.agents-plugin', 'plugin.json');
1336
- if (!fs.existsSync(manifestPath)) {
1337
- error(`${fieldName} must reference repo-local plugin "${pluginName}"`);
1338
- return null;
1339
- }
1340
- let manifest;
1341
- try {
1342
- manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
1343
- }
1344
- catch (e) {
1345
- error(`${fieldName} companion manifest is not valid JSON: ${e.message}`);
1346
- return null;
1347
- }
1348
- if (!isRecord(manifest) || manifest.name !== pluginName) {
1349
- error(`${fieldName} companion source must declare plugin name "${pluginName}"`);
951
+ catch {
1350
952
  return null;
1351
953
  }
1352
- return { pluginDir: companionDir, manifest };
1353
- }
1354
- function validateOnePluginEvalManifest(pluginDir, pluginManifest, evalDir, expectedSkill) {
1355
- const evalManifestPath = path.join(evalDir, 'manifest.json');
1356
- const manifestField = path.relative(pluginDir, evalManifestPath).split(path.sep).join('/');
1357
- let document;
1358
- try {
1359
- document = JSON.parse(fs.readFileSync(evalManifestPath, 'utf8'));
1360
- }
1361
- catch (e) {
1362
- error(`${manifestField} is not valid JSON: ${e.message}`);
1363
- return;
1364
- }
1365
- const manifest = expectRecord(document, manifestField);
1366
- if (!manifest)
1367
- return;
1368
- validateAllowedKeys(manifest, manifestField, ['schemaVersion', 'plugin', 'skill', 'profiles', 'suites']);
1369
- if (manifest.schemaVersion !== PLUGIN_EVAL_SCHEMA_VERSION) {
1370
- error(`${manifestField}.schemaVersion must be ${PLUGIN_EVAL_SCHEMA_VERSION}`);
1371
- }
1372
- if (manifest.plugin !== pluginManifest.name) {
1373
- error(`${manifestField}.plugin must match plugin name ${JSON.stringify(pluginManifest.name)}`);
1374
- }
1375
- const skill = validateNonEmptyString(manifest.skill, `${manifestField}.skill`);
1376
- if (skill && skill !== expectedSkill) {
1377
- error(`${manifestField}.skill must match owning Skill ${JSON.stringify(expectedSkill)}`);
1378
- }
1379
- if (skill && !collectDeclaredSkillNames(pluginDir, pluginManifest).all.has(skill)) {
1380
- error(`${manifestField}.skill must reference a declared static or dynamic skill`);
1381
- }
1382
- if (!Array.isArray(manifest.profiles) || manifest.profiles.length === 0) {
1383
- error(`${manifestField}.profiles must be a non-empty array`);
1384
- return;
1385
- }
1386
- const profilesById = new Map();
1387
- manifest.profiles.forEach((value, index) => {
1388
- const fieldName = `${manifestField}.profiles[${index}]`;
1389
- const profile = expectRecord(value, fieldName);
1390
- if (!profile)
1391
- return;
1392
- validateAllowedKeys(profile, fieldName, ['id', 'scope', 'plugins', 'runModel', 'requiredForRelease']);
1393
- const id = validateNonEmptyString(profile.id, `${fieldName}.id`);
1394
- if (id && !PLUGIN_NAME_PATTERN.test(id)) {
1395
- error(`${fieldName}.id must use lowercase kebab-case`);
1396
- }
1397
- else if (id && profilesById.has(id)) {
1398
- error(`${manifestField} has duplicate profile id ${JSON.stringify(id)}`);
1399
- }
1400
- if (!PLUGIN_EVAL_SCOPES.has(profile.scope)) {
1401
- error(`${fieldName}.scope must be user or project`);
1402
- }
1403
- const skillOwners = new Map();
1404
- const installedPlugins = new Set();
1405
- if (!Array.isArray(profile.plugins) || profile.plugins.length === 0) {
1406
- error(`${fieldName}.plugins must be a non-empty array`);
1407
- }
1408
- else {
1409
- profile.plugins.forEach((value, pluginIndex) => {
1410
- const pluginField = `${fieldName}.plugins[${pluginIndex}]`;
1411
- const installation = expectRecord(value, pluginField);
1412
- if (!installation)
1413
- return;
1414
- validateAllowedKeys(installation, pluginField, ['name', 'config']);
1415
- const pluginName = validateNonEmptyString(installation.name, `${pluginField}.name`);
1416
- if (!pluginName)
1417
- return;
1418
- if (!PLUGIN_NAME_PATTERN.test(pluginName)) {
1419
- error(`${pluginField}.name must use lowercase kebab-case`);
1420
- }
1421
- if (installedPlugins.has(pluginName)) {
1422
- error(`${fieldName}.plugins has duplicate plugin ${JSON.stringify(pluginName)}`);
1423
- return;
1424
- }
1425
- installedPlugins.add(pluginName);
1426
- if (installation.config !== undefined && !isRecord(installation.config)) {
1427
- error(`${pluginField}.config must be an object`);
1428
- }
1429
- const source = resolveEvalProfilePlugin(pluginDir, pluginManifest, pluginName, `${pluginField}.name`);
1430
- if (!source)
1431
- return;
1432
- for (const skillName of collectDeclaredSkillNames(source.pluginDir, source.manifest).all) {
1433
- const existing = skillOwners.get(skillName);
1434
- if (existing && existing !== pluginName) {
1435
- error(`${fieldName} installs duplicate Skill key ${JSON.stringify(skillName)} ` +
1436
- `from plugins ${JSON.stringify(existing)} and ${JSON.stringify(pluginName)}`);
1437
- }
1438
- else {
1439
- skillOwners.set(skillName, pluginName);
1440
- }
1441
- }
1442
- });
1443
- }
1444
- if (!installedPlugins.has(pluginManifest.name)) {
1445
- error(`${fieldName}.plugins must include owner plugin ${JSON.stringify(pluginManifest.name)}`);
1446
- }
1447
- if (typeof profile.runModel !== 'boolean') {
1448
- error(`${fieldName}.runModel must be boolean`);
1449
- }
1450
- if (typeof profile.requiredForRelease !== 'boolean') {
1451
- error(`${fieldName}.requiredForRelease must be boolean`);
1452
- }
1453
- if (profile.scope === 'user' && profile.runModel === true) {
1454
- error(`${fieldName}: eval schema v2 does not allow real model execution for user scope`);
1455
- }
1456
- if (id && PLUGIN_NAME_PATTERN.test(id) && !profilesById.has(id)) {
1457
- profilesById.set(id, { ...profile, skillOwners });
1458
- }
1459
- });
1460
- if (!manifest.profiles.some((profile) => isRecord(profile) && profile.scope === 'project' && profile.runModel === true)) {
1461
- error(`${manifestField} must define at least one project profile with runModel=true`);
1462
- }
1463
- if (!Array.isArray(manifest.suites) || manifest.suites.length === 0) {
1464
- error(`${manifestField}.suites must be a non-empty array`);
1465
- return;
1466
- }
1467
- const suiteIds = new Set();
1468
- manifest.suites.forEach((value, index) => {
1469
- const fieldName = `${manifestField}.suites[${index}]`;
1470
- const suite = expectRecord(value, fieldName);
1471
- if (!suite)
1472
- return;
1473
- const id = validateNonEmptyString(suite.id, `${fieldName}.id`);
1474
- if (id && !PLUGIN_NAME_PATTERN.test(id)) {
1475
- error(`${fieldName}.id must use lowercase kebab-case`);
1476
- }
1477
- else if (id && suiteIds.has(id)) {
1478
- error(`${manifestField} has duplicate suite id ${JSON.stringify(id)}`);
1479
- }
1480
- else if (id) {
1481
- suiteIds.add(id);
1482
- }
1483
- if (suite.kind !== 'command' && suite.kind !== 'conversation' && suite.kind !== 'trigger') {
1484
- error(`${fieldName}.kind must be command, conversation, or trigger`);
1485
- }
1486
- const suiteSkills = new Set();
1487
- if (!Array.isArray(suite.skills) || suite.skills.length === 0) {
1488
- error(`${fieldName}.skills must be a non-empty array`);
1489
- }
1490
- else {
1491
- suite.skills.forEach((skillName, skillIndex) => {
1492
- const skillField = `${fieldName}.skills[${skillIndex}]`;
1493
- const normalized = validateNonEmptyString(skillName, skillField);
1494
- if (!normalized)
1495
- return;
1496
- if (!PLUGIN_NAME_PATTERN.test(normalized)) {
1497
- error(`${skillField} must use lowercase kebab-case`);
1498
- }
1499
- else if (suiteSkills.has(normalized)) {
1500
- error(`${fieldName}.skills has duplicate Skill ${JSON.stringify(normalized)}`);
1501
- }
1502
- else {
1503
- suiteSkills.add(normalized);
1504
- }
1505
- });
1506
- }
1507
- if (skill && !suiteSkills.has(skill)) {
1508
- error(`${fieldName}.skills must include owner Skill ${JSON.stringify(skill)}`);
1509
- }
1510
- if (!Array.isArray(suite.profiles) || suite.profiles.length === 0) {
1511
- error(`${fieldName}.profiles must be a non-empty array`);
1512
- }
1513
- else {
1514
- suite.profiles.forEach((profileId, profileIndex) => {
1515
- const profileField = `${fieldName}.profiles[${profileIndex}]`;
1516
- if (typeof profileId !== 'string' || profileId.trim() === '') {
1517
- error(`${profileField} must be a non-empty string`);
1518
- return;
1519
- }
1520
- const profile = profilesById.get(profileId);
1521
- if (!profile) {
1522
- error(`${fieldName} references unknown profile ${JSON.stringify(profileId)}`);
1523
- }
1524
- else if (profile.runModel !== true) {
1525
- error(`${fieldName} cannot execute materialize-only profile ${JSON.stringify(profileId)}`);
1526
- }
1527
- if (profile) {
1528
- for (const skillName of suiteSkills) {
1529
- if (!profile.skillOwners.has(skillName)) {
1530
- error(`${fieldName} requires Skill ${JSON.stringify(skillName)}, but profile ` +
1531
- `${JSON.stringify(profileId)} does not install a plugin that declares it`);
1532
- }
1533
- }
1534
- }
1535
- });
1536
- }
1537
- if (!Number.isInteger(suite.defaultRuns) || suite.defaultRuns <= 0) {
1538
- error(`${fieldName}.defaultRuns must be a positive integer`);
1539
- }
1540
- if (!Number.isInteger(suite.perRunTimeoutMs) || suite.perRunTimeoutMs <= 0) {
1541
- error(`${fieldName}.perRunTimeoutMs must be a positive integer`);
1542
- }
1543
- if (typeof suite.requiredForRelease !== 'boolean') {
1544
- error(`${fieldName}.requiredForRelease must be boolean`);
1545
- }
1546
- if (!Array.isArray(suite.releaseSplits)) {
1547
- error(`${fieldName}.releaseSplits must be an array`);
1548
- }
1549
- else {
1550
- suite.releaseSplits.forEach((split, splitIndex) => {
1551
- if (!PLUGIN_EVAL_SPLITS.has(split)) {
1552
- error(`${fieldName}.releaseSplits[${splitIndex}] is unsupported`);
1553
- }
1554
- });
1555
- }
1556
- if (suite.kind === 'command') {
1557
- validateAllowedKeys(suite, fieldName, [
1558
- 'id', 'kind', 'skills', 'entry', 'cases', 'profiles', 'defaultRuns', 'releaseSplits',
1559
- 'requiredForRelease', 'perRunTimeoutMs', 'suiteTimeoutMs', 'supports',
1560
- ]);
1561
- validateEvalRelativeFile(evalDir, suite.entry, `${fieldName}.entry`);
1562
- if (!Number.isInteger(suite.suiteTimeoutMs) || suite.suiteTimeoutMs <= 0) {
1563
- error(`${fieldName}.suiteTimeoutMs must be a positive integer`);
1564
- }
1565
- else if (suite.suiteTimeoutMs < suite.perRunTimeoutMs) {
1566
- error(`${fieldName}.suiteTimeoutMs must be greater than or equal to perRunTimeoutMs`);
1567
- }
1568
- if (!Array.isArray(suite.supports)) {
1569
- error(`${fieldName}.supports must be an array`);
1570
- }
1571
- else {
1572
- suite.supports.forEach((support, supportIndex) => {
1573
- if (!PLUGIN_EVAL_COMMAND_SUPPORTS.has(support)) {
1574
- error(`${fieldName}.supports[${supportIndex}] is unsupported`);
1575
- }
1576
- });
1577
- if (Array.isArray(suite.releaseSplits) &&
1578
- suite.releaseSplits.length > 0 &&
1579
- !suite.supports.includes('split')) {
1580
- error(`${fieldName} declares releaseSplits but does not support split`);
1581
- }
1582
- const supportsCase = suite.supports.includes('case');
1583
- if (supportsCase && suite.cases === undefined) {
1584
- error(`${fieldName}.cases is required when supports includes case`);
1585
- }
1586
- else if (!supportsCase && suite.cases !== undefined) {
1587
- error(`${fieldName}.cases requires supports to include case`);
1588
- }
1589
- if (supportsCase && suite.cases !== undefined) {
1590
- const casesPath = validateEvalRelativeFile(evalDir, suite.cases, `${fieldName}.cases`);
1591
- if (casesPath) {
1592
- try {
1593
- const casesDocument = JSON.parse(fs.readFileSync(casesPath, 'utf8'));
1594
- if (!isRecord(casesDocument) || casesDocument.skill_name !== skill) {
1595
- error(`${fieldName}.cases.skill_name must match ${JSON.stringify(skill)}`);
1596
- }
1597
- else if (!Array.isArray(casesDocument.evals) || casesDocument.evals.length === 0) {
1598
- error(`${fieldName}.cases.evals must be a non-empty array`);
1599
- }
1600
- else {
1601
- const caseIds = new Set();
1602
- casesDocument.evals.forEach((entry, caseIndex) => {
1603
- const caseField = `${fieldName}.cases.evals[${caseIndex}]`;
1604
- if (!isRecord(entry) || typeof entry.id !== 'string' || !/^[a-z0-9_]+$/.test(entry.id)) {
1605
- error(`${caseField}.id must use lowercase snake_case`);
1606
- }
1607
- else if (caseIds.has(entry.id)) {
1608
- error(`${fieldName}.cases has duplicate case id ${JSON.stringify(entry.id)}`);
1609
- }
1610
- else {
1611
- caseIds.add(entry.id);
1612
- }
1613
- });
1614
- }
1615
- }
1616
- catch (cause) {
1617
- error(`${fieldName}.cases is not valid JSON: ${cause.message}`);
1618
- }
1619
- }
1620
- }
1621
- }
1622
- }
1623
- else if (suite.kind === 'conversation' || suite.kind === 'trigger') {
1624
- const normalizedSuite = { ...suite, skill };
1625
- const isolation = suite.isolation ?? 'standard';
1626
- if (isolation !== 'standard' && isolation !== 'strict') {
1627
- error(`${fieldName}.isolation must be standard or strict`);
1628
- }
1629
- if (suite.kind === 'conversation') {
1630
- validateAllowedKeys(suite, fieldName, [
1631
- 'id', 'kind', 'skills', 'cases', 'profiles', 'defaultRuns', 'releaseSplits',
1632
- 'requiredForRelease', 'perRunTimeoutMs', 'isolation',
1633
- ]);
1634
- if (Array.isArray(suite.releaseSplits) && suite.releaseSplits.length > 0) {
1635
- error(`${fieldName} cannot declare releaseSplits because conversation cases do not support split filtering`);
1636
- }
1637
- validateConversationCaseCorpus(evalDir, normalizedSuite, fieldName);
1638
- }
1639
- else {
1640
- validateAllowedKeys(suite, fieldName, [
1641
- 'id', 'kind', 'skills', 'cases', 'fixtureModule', 'observeSpawnAgent', 'isolation',
1642
- 'strictNegativeSplits', 'minimumPassRate', 'forbidMultipleSkillLoads',
1643
- 'profiles', 'defaultRuns', 'releaseSplits',
1644
- 'requiredForRelease', 'perRunTimeoutMs',
1645
- ]);
1646
- if (typeof suite.observeSpawnAgent !== 'boolean') {
1647
- error(`${fieldName}.observeSpawnAgent must be boolean`);
1648
- }
1649
- if (!Array.isArray(suite.strictNegativeSplits)) {
1650
- error(`${fieldName}.strictNegativeSplits must be an array`);
1651
- }
1652
- else {
1653
- suite.strictNegativeSplits.forEach((split, splitIndex) => {
1654
- if (!PLUGIN_EVAL_TRIGGER_CASE_SPLITS.has(split)) {
1655
- error(`${fieldName}.strictNegativeSplits[${splitIndex}] is unsupported`);
1656
- }
1657
- });
1658
- }
1659
- if (suite.minimumPassRate !== undefined &&
1660
- (typeof suite.minimumPassRate !== 'number' ||
1661
- !Number.isFinite(suite.minimumPassRate) ||
1662
- suite.minimumPassRate <= 0 ||
1663
- suite.minimumPassRate > 1)) {
1664
- error(`${fieldName}.minimumPassRate must be greater than 0 and at most 1`);
1665
- }
1666
- if (suite.forbidMultipleSkillLoads !== undefined &&
1667
- typeof suite.forbidMultipleSkillLoads !== 'boolean') {
1668
- error(`${fieldName}.forbidMultipleSkillLoads must be boolean`);
1669
- }
1670
- if (suite.fixtureModule !== undefined) {
1671
- const fixturePath = validateEvalRelativeFile(evalDir, suite.fixtureModule, `${fieldName}.fixtureModule`);
1672
- if (fixturePath && path.extname(fixturePath) !== '.mjs') {
1673
- error(`${fieldName}.fixtureModule must reference an .mjs file`);
1674
- }
1675
- }
1676
- validateTriggerCaseCorpus(evalDir, normalizedSuite, fieldName);
1677
- }
1678
- }
1679
- });
1680
- if (skill
1681
- && collectDeclaredSkillNames(pluginDir, pluginManifest).dynamic.has(skill)
1682
- && !manifest.suites.some((suite) => isRecord(suite) && suite.requiredForRelease === true)) {
1683
- error(`${manifestField}.suites must include at least one release-required suite for dynamic Skill ${JSON.stringify(skill)}`);
1684
- }
1685
954
  }
1686
- function validatePluginEvalManifest(pluginDir, pluginManifest) {
955
+ async function validatePluginEvalManifest(pluginDir, pluginManifest) {
1687
956
  const legacyRoot = path.join(pluginDir, 'evals');
1688
957
  if (fs.existsSync(legacyRoot)) {
1689
958
  error('Plugin-root evals/ is legacy; put evals/ inside its owning static or dynamic Skill directory.');
@@ -1692,17 +961,33 @@ function validatePluginEvalManifest(pluginDir, pluginManifest) {
1692
961
  .sort()
1693
962
  .map((skill) => ({ skill, root: path.join(pluginDir, 'skills', skill) }));
1694
963
  const seenSkills = new Set();
964
+ let manifestTools = null;
1695
965
  for (const owner of skillRoots) {
1696
966
  const evalDir = path.join(owner.root, 'evals');
1697
967
  const manifestPath = path.join(evalDir, 'manifest.json');
1698
968
  if (!fs.existsSync(manifestPath))
1699
969
  continue;
970
+ const manifestField = path.relative(pluginDir, manifestPath).split(path.sep).join('/');
1700
971
  if (seenSkills.has(owner.skill)) {
1701
972
  error(`Skill ${JSON.stringify(owner.skill)} has more than one evals/manifest.json owner`);
1702
973
  continue;
1703
974
  }
1704
975
  seenSkills.add(owner.skill);
1705
- validateOnePluginEvalManifest(pluginDir, pluginManifest, evalDir, owner.skill);
976
+ manifestTools ??= await loadSkillEvalManifestTools();
977
+ if (typeof manifestTools?.validateAwSkillEvalManifest !== 'function') {
978
+ error('Canonical AwSkillEvalManifest v1 validator is unavailable; run the current built aw CLI.');
979
+ continue;
980
+ }
981
+ const validation = await manifestTools.validateAwSkillEvalManifest({
982
+ plugin: {
983
+ rootDir: pluginDir,
984
+ manifestPath: path.join(pluginDir, '.agents-plugin', 'plugin.json'),
985
+ manifest: pluginManifest,
986
+ },
987
+ skill: owner.skill,
988
+ });
989
+ for (const message of validation.errors)
990
+ error(`${manifestField}: ${message}`);
1706
991
  }
1707
992
  }
1708
993
  function countCharacters(value) {
@@ -2095,33 +1380,6 @@ function validateDeclaredNativeAssets(pluginDir, manifest) {
2095
1380
  }
2096
1381
  }
2097
1382
  }
2098
- function validatePluginVersionContracts(manifest, options) {
2099
- if (manifest.compatibility === undefined) {
2100
- error('Invalid compatibility.aw.minVersion: expected a strict SemVer 2.0.0 string. Received undefined.');
2101
- return;
2102
- }
2103
- const compatibility = expectRecord(manifest.compatibility, 'compatibility');
2104
- if (!compatibility) {
2105
- return;
2106
- }
2107
- validateAllowedKeys(compatibility, 'compatibility', ['aw']);
2108
- if (compatibility.aw === undefined) {
2109
- error('Invalid compatibility.aw.minVersion: expected a strict SemVer 2.0.0 string. Received undefined.');
2110
- return;
2111
- }
2112
- const aw = expectRecord(compatibility.aw, 'compatibility.aw');
2113
- if (!aw) {
2114
- return;
2115
- }
2116
- validateAllowedKeys(aw, 'compatibility.aw', ['minVersion']);
2117
- const pluginMinVersion = validateStrictSemVerString(aw.minVersion, 'compatibility.aw.minVersion');
2118
- if (!pluginMinVersion || !options.catalogMinVersion) {
2119
- return;
2120
- }
2121
- if (compareStrictSemVer(pluginMinVersion, options.catalogMinVersion) > 0) {
2122
- error(`Invalid compatibility.aw.minVersion for plugin "${pluginNameForError(manifest)}": received ${JSON.stringify(pluginMinVersion)}, which is higher than target catalog minimum ${JSON.stringify(options.catalogMinVersion)}.`);
2123
- }
2124
- }
2125
1383
  function collectDeclaredSkillNames(pluginDir, manifest) {
2126
1384
  const skillsRoot = typeof manifest.skills === 'string'
2127
1385
  ? path.join(pluginDir, manifest.skills)
@@ -2166,9 +1424,6 @@ function collectDeclaredSkillNames(pluginDir, manifest) {
2166
1424
  function isNodeRunnablePath(relativePath) {
2167
1425
  return SCRIPT_NODE_EXTENSIONS.has(path.posix.extname(normalizeRelativePath(relativePath)));
2168
1426
  }
2169
- function isAutoRunnablePath(relativePath) {
2170
- return SCRIPT_AUTO_EXTENSIONS.has(path.posix.extname(normalizeRelativePath(relativePath)).toLowerCase());
2171
- }
2172
1427
  function normalizePluginScriptPath(pluginDir, value, fieldName) {
2173
1428
  if (typeof value !== 'string' || value.trim() === '') {
2174
1429
  error(`${fieldName} must be a non-empty string`);
@@ -2217,17 +1472,11 @@ function validateScriptEntry(pluginDir, value, fieldName, options = {}) {
2217
1472
  }
2218
1473
  validateAllowedKeys(entry, fieldName, ['runner', 'path', 'args']);
2219
1474
  const runner = validateManifestString(entry.runner, `${fieldName}.runner`);
2220
- if (runner && !SCRIPT_RUNNERS.has(runner)) {
2221
- error(`${fieldName}.runner has unsupported runner "${runner}"`);
2222
- }
2223
- if (options.requireNodeRunner && runner !== 'node') {
1475
+ if (runner !== 'node') {
2224
1476
  error(`${fieldName}.runner must be "node"`);
2225
1477
  }
2226
1478
  const relativePath = normalizePluginScriptPath(pluginDir, entry.path, `${fieldName}.path`);
2227
1479
  validateDeclaredScriptFile(pluginDir, relativePath, `${fieldName}.path`);
2228
- if (runner === 'auto' && relativePath && !isAutoRunnablePath(relativePath)) {
2229
- error(`${fieldName}.path uses runner "auto" but has no supported extension (${[...SCRIPT_AUTO_EXTENSIONS].join(', ')})`);
2230
- }
2231
1480
  if (options.requireNodePath && relativePath && !isNodeRunnablePath(relativePath)) {
2232
1481
  error(`${fieldName}.path must use a Node runnable extension (.js, .mjs, or .cjs)`);
2233
1482
  }
@@ -2245,51 +1494,6 @@ function validateScriptEntry(pluginDir, value, fieldName, options = {}) {
2245
1494
  }
2246
1495
  return runner && relativePath ? { runner, path: relativePath } : null;
2247
1496
  }
2248
- function validateLifecycleDefinition(pluginDir, value, fieldName, runtimeEntries) {
2249
- if (typeof value === 'string') {
2250
- const relativePath = normalizePluginScriptPath(pluginDir, value, fieldName);
2251
- validateDeclaredScriptFile(pluginDir, relativePath, fieldName);
2252
- if (relativePath && !isAutoRunnablePath(relativePath)) {
2253
- error(`${fieldName} uses runner "auto" but has no supported extension (${[...SCRIPT_AUTO_EXTENSIONS].join(', ')})`);
2254
- }
2255
- if (relativePath && isNodeRunnablePath(relativePath)) {
2256
- runtimeEntries.push({ path: relativePath, fieldName });
2257
- }
2258
- return { default: relativePath ? { runner: 'auto', path: relativePath } : null };
2259
- }
2260
- const selector = expectRecord(value, fieldName);
2261
- if (!selector)
2262
- return {};
2263
- if ('runner' in selector || 'path' in selector || 'command' in selector) {
2264
- error(`${fieldName} must declare lifecycle scripts under OS selectors`);
2265
- }
2266
- for (const selectorName of Object.keys(selector)) {
2267
- if (!SCRIPT_OS_SELECTORS.has(selectorName)) {
2268
- error(`${fieldName} has unknown OS selector "${selectorName}"`);
2269
- }
2270
- }
2271
- const normalized = {};
2272
- for (const [selectorName, entryValue] of Object.entries(selector)) {
2273
- const entry = validateScriptEntry(pluginDir, entryValue, `${fieldName}.${selectorName}`);
2274
- if (entry) {
2275
- normalized[selectorName] = entry;
2276
- if (entry.runner === 'node' || (entry.runner === 'auto' && isNodeRunnablePath(entry.path))) {
2277
- runtimeEntries.push({ path: entry.path, fieldName: `${fieldName}.${selectorName}.path` });
2278
- }
2279
- }
2280
- }
2281
- const orders = {
2282
- linux: ['linux', 'unix', 'default'],
2283
- darwin: ['darwin', 'unix', 'default'],
2284
- win32: ['win32', 'windows', 'default'],
2285
- };
2286
- for (const [osName, order] of Object.entries(orders)) {
2287
- if (!order.some((selectorName) => normalized[selectorName])) {
2288
- error(`${fieldName} must include an entry that resolves on ${osName}`);
2289
- }
2290
- }
2291
- return normalized;
2292
- }
2293
1497
  function isNonRegistryDependencySpecifier(specifier) {
2294
1498
  const trimmed = String(specifier).trim();
2295
1499
  return (/^(?:workspace|file|link|portal):/i.test(trimmed) ||
@@ -2427,6 +1631,10 @@ function scanNodeImportContract(pluginDir, entryPaths, options) {
2427
1631
  continue;
2428
1632
  }
2429
1633
  if (!resolved.path) {
1634
+ const requested = path.posix.normalize(path.posix.join(path.posix.dirname(relativePath), specifier));
1635
+ if ((options.runtimeConfigSkillRoots ?? []).some((root) => (relativePath.startsWith(`${root}/`)
1636
+ && requested === path.posix.join(root, AW_RUNTIME_CONFIG_READER_PATH))))
1637
+ continue;
2430
1638
  error(`${options.label}: unable to resolve relative import "${specifier}" from "${relativePath}"`);
2431
1639
  continue;
2432
1640
  }
@@ -2476,271 +1684,61 @@ function listFilesRecursive(rootDir) {
2476
1684
  walk(rootDir);
2477
1685
  return output;
2478
1686
  }
2479
- function validateConfigValueLightweight(field, value, fieldName) {
2480
- if (!isRecord(field) || !CONFIG_FIELD_TYPES.has(field.type))
2481
- return;
2482
- if (field.type === 'string' || field.type === 'file' || field.type === 'directory') {
2483
- validateManifestString(value, fieldName);
2484
- return;
2485
- }
2486
- if (field.type === 'boolean') {
2487
- if (typeof value !== 'boolean') {
2488
- error(`${fieldName} must be a boolean`);
2489
- }
2490
- return;
2491
- }
2492
- if (field.type === 'number') {
2493
- if (typeof value !== 'number' || !Number.isFinite(value)) {
2494
- error(`${fieldName} must be a finite number`);
2495
- return;
2496
- }
2497
- if (typeof field.min === 'number' && value < field.min) {
2498
- error(`${fieldName} must be greater than or equal to ${field.min}`);
2499
- }
2500
- if (typeof field.max === 'number' && value > field.max) {
2501
- error(`${fieldName} must be less than or equal to ${field.max}`);
2502
- }
2503
- return;
2504
- }
2505
- if (field.type === 'enum') {
2506
- if (typeof value !== 'string' || !Array.isArray(field.values) || !field.values.includes(value)) {
2507
- error(`${fieldName} must be one of config schema values`);
2508
- }
2509
- }
2510
- }
2511
- function validateConfigPresentationLightweight(presentation, schema) {
2512
- if (presentation === undefined)
2513
- return;
2514
- const root = expectRecord(presentation, 'config.presentation');
2515
- if (!root)
2516
- return;
2517
- validateAllowedKeys(root, 'config.presentation', ['groups', 'fields', 'presets']);
2518
- const schemaKeys = new Set(Object.keys(schema));
2519
- if (root.groups !== undefined) {
2520
- if (!Array.isArray(root.groups)) {
2521
- error('config.presentation.groups must be an array');
2522
- }
2523
- else {
2524
- const groupIds = new Set();
2525
- const groupedFields = new Set();
2526
- root.groups.forEach((rawGroup, index) => {
2527
- const fieldName = `config.presentation.groups[${index}]`;
2528
- const group = expectRecord(rawGroup, fieldName);
2529
- if (!group)
2530
- return;
2531
- validateAllowedKeys(group, fieldName, ['id', 'title', 'description', 'fields', 'advanced']);
2532
- const validId = validateManifestString(group.id, `${fieldName}.id`);
2533
- const id = validId ? group.id : null;
2534
- if (id && groupIds.has(id)) {
2535
- error(`${fieldName}.id has duplicate group id "${id}"`);
2536
- }
2537
- else if (id) {
2538
- groupIds.add(id);
2539
- }
2540
- validateManifestString(group.title, `${fieldName}.title`);
2541
- if (group.description !== undefined) {
2542
- validateManifestString(group.description, `${fieldName}.description`);
2543
- }
2544
- if (group.advanced !== undefined && typeof group.advanced !== 'boolean') {
2545
- error(`${fieldName}.advanced must be a boolean`);
2546
- }
2547
- if (!Array.isArray(group.fields)) {
2548
- error(`${fieldName}.fields must be an array`);
2549
- return;
2550
- }
2551
- group.fields.forEach((key, fieldIndex) => {
2552
- const keyFieldName = `${fieldName}.fields[${fieldIndex}]`;
2553
- const validKey = validateManifestString(key, keyFieldName);
2554
- if (!validKey)
2555
- return;
2556
- if (!schemaKeys.has(key)) {
2557
- error(`${keyFieldName} references unknown config key "${key}"`);
2558
- }
2559
- if (groupedFields.has(key)) {
2560
- error(`${keyFieldName} assigns config key "${key}" to more than one group`);
2561
- }
2562
- else {
2563
- groupedFields.add(key);
2564
- }
2565
- });
2566
- });
2567
- }
2568
- }
2569
- if (root.fields !== undefined) {
2570
- const fields = expectRecord(root.fields, 'config.presentation.fields');
2571
- if (fields) {
2572
- for (const [key, rawField] of Object.entries(fields)) {
2573
- const fieldName = `config.presentation.fields.${key}`;
2574
- const schemaField = schema[key];
2575
- if (!schemaKeys.has(key)) {
2576
- error(`config.presentation.fields references unknown config key "${key}"`);
2577
- }
2578
- const field = expectRecord(rawField, fieldName);
2579
- if (!field)
2580
- continue;
2581
- validateAllowedKeys(field, fieldName, [
2582
- 'valueLabels',
2583
- 'recommendedValue',
2584
- 'placeholder',
2585
- 'unit',
2586
- 'advanced',
2587
- ]);
2588
- if (field.placeholder !== undefined) {
2589
- validateManifestString(field.placeholder, `${fieldName}.placeholder`);
2590
- }
2591
- if (field.unit !== undefined) {
2592
- validateManifestString(field.unit, `${fieldName}.unit`);
2593
- }
2594
- if (field.advanced !== undefined && typeof field.advanced !== 'boolean') {
2595
- error(`${fieldName}.advanced must be a boolean`);
2596
- }
2597
- if (field.valueLabels !== undefined) {
2598
- const labels = expectRecord(field.valueLabels, `${fieldName}.valueLabels`);
2599
- if (isRecord(schemaField) && schemaField.type !== 'enum') {
2600
- error(`${fieldName}.valueLabels is only supported for enum config`);
2601
- }
2602
- if (labels) {
2603
- for (const [token, label] of Object.entries(labels)) {
2604
- if (!isRecord(schemaField) || !Array.isArray(schemaField.values) || !schemaField.values.includes(token)) {
2605
- error(`${fieldName}.valueLabels references unknown enum token "${token}"`);
2606
- }
2607
- validateManifestString(label, `${fieldName}.valueLabels.${token}`);
2608
- }
2609
- }
2610
- }
2611
- if (field.recommendedValue !== undefined) {
2612
- validateConfigValueLightweight(schemaField, field.recommendedValue, `${fieldName}.recommendedValue`);
2613
- }
2614
- }
2615
- }
2616
- }
2617
- if (root.presets !== undefined) {
2618
- if (!Array.isArray(root.presets)) {
2619
- error('config.presentation.presets must be an array');
2620
- }
2621
- else {
2622
- const presetIds = new Set();
2623
- root.presets.forEach((rawPreset, index) => {
2624
- const fieldName = `config.presentation.presets[${index}]`;
2625
- const preset = expectRecord(rawPreset, fieldName);
2626
- if (!preset)
2627
- return;
2628
- validateAllowedKeys(preset, fieldName, ['id', 'title', 'description', 'values']);
2629
- const validId = validateManifestString(preset.id, `${fieldName}.id`);
2630
- const id = validId ? preset.id : null;
2631
- if (id && presetIds.has(id)) {
2632
- error(`${fieldName}.id has duplicate preset id "${id}"`);
2633
- }
2634
- else if (id) {
2635
- presetIds.add(id);
2636
- }
2637
- validateManifestString(preset.title, `${fieldName}.title`);
2638
- if (preset.description !== undefined) {
2639
- validateManifestString(preset.description, `${fieldName}.description`);
2640
- }
2641
- const values = expectRecord(preset.values, `${fieldName}.values`);
2642
- if (!values)
2643
- return;
2644
- for (const [key, value] of Object.entries(values)) {
2645
- if (!schemaKeys.has(key)) {
2646
- error(`${fieldName}.values references unknown config key "${key}"`);
2647
- continue;
2648
- }
2649
- const schemaField = schema[key];
2650
- if (isRecord(schemaField)
2651
- && (schemaField.sensitive === true
2652
- || schemaField.type === 'file'
2653
- || schemaField.type === 'directory')) {
2654
- error(`${fieldName}.values.${key} cannot contain sensitive, file, or directory config values`);
2655
- continue;
2656
- }
2657
- validateConfigValueLightweight(schemaField, value, `${fieldName}.values.${key}`);
2658
- }
2659
- });
2660
- }
2661
- }
2662
- }
2663
1687
  function validateConfigSchemaLightweight(config) {
2664
1688
  if (config === undefined)
2665
1689
  return;
2666
- const configRoot = expectRecord(config, 'config');
2667
- if (!configRoot)
2668
- return;
2669
- validateAllowedKeys(configRoot, 'config', ['schema', 'presentation']);
2670
- const schema = expectRecord(configRoot.schema, 'config.schema');
2671
- if (!schema)
2672
- return;
2673
- for (const [key, rawField] of Object.entries(schema)) {
2674
- if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(key)) {
2675
- error(`config.schema has invalid key "${key}"`);
2676
- }
2677
- const fieldName = `config.schema.${key}`;
2678
- const field = expectRecord(rawField, fieldName);
2679
- if (!field)
2680
- continue;
2681
- validateAllowedKeys(field, fieldName, [
2682
- 'type',
2683
- 'title',
2684
- 'description',
2685
- 'default',
2686
- 'required',
2687
- 'sensitive',
2688
- 'values',
2689
- 'min',
2690
- 'max',
2691
- ]);
2692
- if (typeof field.type !== 'string' || !CONFIG_FIELD_TYPES.has(field.type)) {
2693
- error(`${fieldName}.type must be string, number, boolean, enum, file, or directory`);
2694
- }
2695
- if (field.required !== undefined && typeof field.required !== 'boolean') {
2696
- error(`${fieldName}.required must be a boolean`);
2697
- }
2698
- if (field.sensitive !== undefined && typeof field.sensitive !== 'boolean') {
2699
- error(`${fieldName}.sensitive must be a boolean`);
2700
- }
2701
- if (field.values !== undefined) {
2702
- if (field.type !== 'enum' || !Array.isArray(field.values) || field.values.length === 0) {
2703
- error(`${fieldName}.values is only supported for enum config and must be non-empty`);
2704
- }
2705
- }
2706
- else if (field.type === 'enum') {
2707
- error(`${fieldName}.values is required for enum config`);
2708
- }
2709
- if (field.type !== 'number' && (field.min !== undefined || field.max !== undefined)) {
2710
- error(`${fieldName}.min/max are only supported for number config`);
2711
- }
2712
- if (field.min !== undefined && typeof field.min !== 'number') {
2713
- error(`${fieldName}.min must be a number`);
2714
- }
2715
- if (field.max !== undefined && typeof field.max !== 'number') {
2716
- error(`${fieldName}.max must be a number`);
2717
- }
2718
- if (typeof field.min === 'number' && typeof field.max === 'number' && field.min > field.max) {
2719
- error(`${fieldName}.min must be less than or equal to max`);
2720
- }
1690
+ try {
1691
+ normalizePluginConfigDefinition(config);
1692
+ }
1693
+ catch (validationError) {
1694
+ error(validationError instanceof Error ? validationError.message : String(validationError));
2721
1695
  }
2722
- validateConfigPresentationLightweight(configRoot.presentation, schema);
2723
1696
  }
2724
1697
  function configSchemaKeys(manifest) {
2725
- const schema = manifest.config?.schema;
1698
+ const schema = manifest.config?.fields;
2726
1699
  return isRecord(schema) ? new Set(Object.keys(schema)) : new Set();
2727
1700
  }
2728
- function configSchemaField(manifest, key) {
2729
- const field = manifest.config?.schema?.[key];
2730
- return isRecord(field) ? field : null;
2731
- }
2732
1701
  function defaultConfigValues(manifest) {
2733
- const schema = manifest.config?.schema;
1702
+ const schema = manifest.config?.fields;
2734
1703
  const values = {};
2735
1704
  if (!isRecord(schema))
2736
1705
  return values;
2737
1706
  for (const [key, field] of Object.entries(schema)) {
2738
- if (isRecord(field) && Object.prototype.hasOwnProperty.call(field, 'default')) {
1707
+ if (isRecord(field) && field.default !== undefined) {
2739
1708
  values[key] = field.default;
2740
1709
  }
2741
1710
  }
2742
1711
  return values;
2743
1712
  }
1713
+ function configFieldContainsSensitiveValue(field) {
1714
+ if (!isRecord(field))
1715
+ return false;
1716
+ if (field.sensitive === true)
1717
+ return true;
1718
+ if (field.type !== 'object')
1719
+ return false;
1720
+ return ((isRecord(field.properties)
1721
+ && Object.values(field.properties).some((child) => isRecord(child) && child.sensitive === true))
1722
+ || (isRecord(field.additionalProperties)
1723
+ && field.additionalProperties.sensitive === true));
1724
+ }
1725
+ function codexStaticNativeComponentKeys(manifest) {
1726
+ if (!isCodexTargeted(manifest))
1727
+ return [];
1728
+ const keys = [];
1729
+ if (manifest.skills)
1730
+ keys.push('skills');
1731
+ if (manifest.mcpServers)
1732
+ keys.push('mcpServers');
1733
+ if ((Array.isArray(manifest.extensions?.hooks)
1734
+ && manifest.extensions.hooks.some((hook) => hook?.agentOverrides?.codex !== null))
1735
+ || (Array.isArray(manifest.extensions?.nativeHooks?.codex)
1736
+ && manifest.extensions.nativeHooks.codex.length > 0))
1737
+ keys.push('hooks');
1738
+ if (manifest.apps)
1739
+ keys.push('apps');
1740
+ return keys;
1741
+ }
2744
1742
  function validateArtifactId(value, fieldName) {
2745
1743
  const id = validateManifestString(value, fieldName);
2746
1744
  if (!id)
@@ -2801,7 +1799,7 @@ function validateStringArray(value, fieldName, options = {}) {
2801
1799
  }
2802
1800
  return output;
2803
1801
  }
2804
- function validateArtifactTargetEntry(entry, index, manifest, seen, pluginDir) {
1802
+ function validateArtifactTargetEntry(entry, index, manifest, pluginDir) {
2805
1803
  const fieldName = `artifacts.targets[${index}]`;
2806
1804
  const target = expectRecord(entry, fieldName);
2807
1805
  if (!target)
@@ -2816,11 +1814,13 @@ function validateArtifactTargetEntry(entry, index, manifest, seen, pluginDir) {
2816
1814
  'projectManagedKind',
2817
1815
  'states',
2818
1816
  'refreshKeys',
1817
+ 'delivery',
2819
1818
  'requiresCodexProjectConfig',
2820
1819
  'roleKey',
2821
1820
  'skillKey',
2822
1821
  'sourceDirs',
2823
1822
  'runtimeImports',
1823
+ 'runtimeConfig',
2824
1824
  ]);
2825
1825
  const id = validateArtifactId(target.id, `${fieldName}.id`);
2826
1826
  const artifactTarget = validateManifestString(target.target, `${fieldName}.target`);
@@ -2828,6 +1828,30 @@ function validateArtifactTargetEntry(entry, index, manifest, seen, pluginDir) {
2828
1828
  error(`${fieldName}.target: unsupported artifact target "${artifactTarget}"`);
2829
1829
  }
2830
1830
  const portable = artifactTarget === 'agent-skills.skill';
1831
+ let delivery;
1832
+ if (artifactTarget === 'codex.skill') {
1833
+ delivery = expectRecord(target.delivery, `${fieldName}.delivery`);
1834
+ if (delivery) {
1835
+ if (delivery.mode === 'aw-extension') {
1836
+ validateAllowedKeys(delivery, `${fieldName}.delivery`, ['mode']);
1837
+ }
1838
+ else if (delivery.mode === 'codex-native') {
1839
+ validateAllowedKeys(delivery, `${fieldName}.delivery`, ['mode', 'identity', 'renderProfile']);
1840
+ if (delivery.identity !== 'shared') {
1841
+ error(`${fieldName}.delivery.identity: expected "shared"`);
1842
+ }
1843
+ if (delivery.renderProfile !== 'user') {
1844
+ error(`${fieldName}.delivery.renderProfile: expected "user"`);
1845
+ }
1846
+ }
1847
+ else {
1848
+ error(`${fieldName}.delivery.mode: expected "codex-native" or "aw-extension"`);
1849
+ }
1850
+ }
1851
+ }
1852
+ else if (target.delivery !== undefined) {
1853
+ error(`${fieldName}.delivery: delivery is only supported for codex.skill targets`);
1854
+ }
2831
1855
  const platform = portable || target.platform === undefined
2832
1856
  ? undefined
2833
1857
  : validateManifestString(target.platform, `${fieldName}.platform`);
@@ -2851,13 +1875,6 @@ function validateArtifactTargetEntry(entry, index, manifest, seen, pluginDir) {
2851
1875
  error(`${fieldName}.distribution: platform targets do not support distribution`);
2852
1876
  }
2853
1877
  }
2854
- const key = id && artifactTarget ? `${id}:${artifactTarget}` : null;
2855
- if (key) {
2856
- if (seen.has(key)) {
2857
- error(`${fieldName}: duplicate artifact id + target "${key}"`);
2858
- }
2859
- seen.add(key);
2860
- }
2861
1878
  const expectedKind = ARTIFACT_KIND_BY_TARGET[artifactTarget];
2862
1879
  const kind = target.kind === undefined
2863
1880
  ? expectedKind
@@ -2900,10 +1917,15 @@ function validateArtifactTargetEntry(entry, index, manifest, seen, pluginDir) {
2900
1917
  error(`${fieldName}.refreshKeys[${refreshIndex}]: unknown config key "${refreshKey}"`);
2901
1918
  continue;
2902
1919
  }
2903
- const field = configSchemaField(manifest, refreshKey);
2904
- if (scopes.includes('project') &&
2905
- (field?.type === 'file' || field?.type === 'directory')) {
2906
- error(`${fieldName}.refreshKeys[${refreshIndex}]: project-scope repo-visible artifacts cannot depend on "${field.type}" config key "${refreshKey}"; use a portable string key or keep the path in user/project local config for lifecycle/helper code.`);
1920
+ const sensitiveRefreshKey = configFieldContainsSensitiveValue(manifest.config?.fields?.[refreshKey]);
1921
+ const skillTarget = artifactTarget === 'codex.skill'
1922
+ || artifactTarget === 'claude.skill'
1923
+ || artifactTarget === 'agent-skills.skill';
1924
+ if (skillTarget && sensitiveRefreshKey) {
1925
+ const native = delivery?.mode === 'codex-native';
1926
+ error(`${native ? 'codexNativeRenderSensitiveRefreshKey' : 'skillRenderSensitiveRefreshKey'}: ` +
1927
+ `${fieldName}.refreshKeys[${refreshIndex}]: ` +
1928
+ `${native ? 'codex-native renderers' : 'Skill renderers'} cannot read sensitive config field "${refreshKey}"`);
2907
1929
  }
2908
1930
  }
2909
1931
  if (target.requiresCodexProjectConfig !== undefined &&
@@ -2992,9 +2014,11 @@ function validateArtifactTargetEntry(entry, index, manifest, seen, pluginDir) {
2992
2014
  projectManagedKind,
2993
2015
  states,
2994
2016
  refreshKeys,
2017
+ delivery,
2995
2018
  roleKey,
2996
2019
  skillKey,
2997
2020
  sourceDirs,
2021
+ runtimeConfig: target.runtimeConfig,
2998
2022
  runtimeImports: Array.isArray(target.runtimeImports) ? target.runtimeImports : [],
2999
2023
  };
3000
2024
  }
@@ -3011,10 +2035,69 @@ function validateArtifactsConfigLightweight(pluginDir, manifest) {
3011
2035
  error('artifacts.targets must be an array');
3012
2036
  return [];
3013
2037
  }
3014
- const seen = new Set();
3015
2038
  const declarations = artifacts.targets
3016
- .map((entry, index) => validateArtifactTargetEntry(entry, index, manifest, seen, pluginDir))
2039
+ .map((entry, index) => validateArtifactTargetEntry(entry, index, manifest, pluginDir))
3017
2040
  .filter(Boolean);
2041
+ const idsBySurfaceScope = new Map();
2042
+ const nativeIds = new Map();
2043
+ const nativeSkillKeys = new Map();
2044
+ for (const [declarationIndex, declaration] of declarations.entries()) {
2045
+ for (const scope of declaration.scopes) {
2046
+ const surface = declaration.platform ?? declaration.distribution;
2047
+ const key = `${surface}:${scope}:${declaration.id}`;
2048
+ const existing = idsBySurfaceScope.get(key);
2049
+ if (existing !== undefined) {
2050
+ error(`artifacts.targets has duplicate artifact id "${declaration.id}" for surface/scope "${surface}:${scope}" in targets[${existing}] and targets[${declarationIndex}]`);
2051
+ }
2052
+ else {
2053
+ idsBySurfaceScope.set(key, declarationIndex);
2054
+ }
2055
+ }
2056
+ if (declaration.delivery?.mode === 'codex-native') {
2057
+ const existingId = nativeIds.get(declaration.id);
2058
+ if (existingId !== undefined) {
2059
+ error(`artifacts.targets has duplicate codex-native artifact id "${declaration.id}" in the shared projection at targets[${existingId}] and targets[${declarationIndex}]`);
2060
+ }
2061
+ else {
2062
+ nativeIds.set(declaration.id, declarationIndex);
2063
+ }
2064
+ const existingSkillKey = nativeSkillKeys.get(declaration.skillKey);
2065
+ if (existingSkillKey !== undefined) {
2066
+ error(`artifacts.targets has duplicate codex-native skillKey "${declaration.skillKey}" in the shared projection at targets[${existingSkillKey}] and targets[${declarationIndex}]`);
2067
+ }
2068
+ else {
2069
+ nativeSkillKeys.set(declaration.skillKey, declarationIndex);
2070
+ }
2071
+ }
2072
+ }
2073
+ const nativeComponents = codexStaticNativeComponentKeys(manifest).map((key) => ({
2074
+ key,
2075
+ scopes: ['project', 'user'],
2076
+ }));
2077
+ declarations.forEach((declaration, index) => {
2078
+ if (declaration.delivery?.mode === 'codex-native') {
2079
+ nativeComponents.push({ key: `artifacts.targets[${index}]`, scopes: declaration.scopes });
2080
+ }
2081
+ });
2082
+ const expectedNativeComponent = nativeComponents[0];
2083
+ if (expectedNativeComponent) {
2084
+ const canonicalScopes = (component) => [...component.scopes].sort().join(',');
2085
+ const expectedScopes = canonicalScopes(expectedNativeComponent);
2086
+ const mismatch = nativeComponents.find((component) => canonicalScopes(component) !== expectedScopes);
2087
+ if (mismatch) {
2088
+ error(`codexSharedNativeScopeMismatch: Codex native component scope sets must match exactly; ` +
2089
+ `${expectedNativeComponent.key} has {${expectedScopes}} but ${mismatch.key} has ` +
2090
+ `{${canonicalScopes(mismatch)}}`);
2091
+ }
2092
+ }
2093
+ const staticSkillNames = new Set(collectDeclaredSkillNames(pluginDir, manifest).static);
2094
+ for (const [index, declaration] of declarations.entries()) {
2095
+ if (declaration.target === 'codex.skill'
2096
+ && declaration.delivery?.mode === 'codex-native'
2097
+ && staticSkillNames.has(declaration.skillKey)) {
2098
+ error(`artifacts.targets[${index}].skillKey: native dynamic Skill "${declaration.skillKey}" conflicts with a static Skill of the same name`);
2099
+ }
2100
+ }
3018
2101
  const owners = new Map();
3019
2102
  for (const declaration of declarations) {
3020
2103
  if ((declaration.target !== 'codex.skill' && declaration.target !== 'claude.skill' && declaration.target !== 'agent-skills.skill') ||
@@ -3281,20 +2364,11 @@ function validateRenderedSkillTree(options) {
3281
2364
  if (!readme || readme.toString('utf8').trim() === '') {
3282
2365
  error(`${fieldName} final file tree must contain a non-empty README.md`);
3283
2366
  }
3284
- const sensitiveValues = Object.entries(manifest.config?.schema ?? {})
3285
- .filter(([, field]) => isRecord(field) && field.sensitive === true)
3286
- .map(([key, field]) => Object.prototype.hasOwnProperty.call(field, 'default')
3287
- ? String(field.default)
3288
- : String(defaultConfigValues(manifest)[key] ?? ''))
3289
- .filter(Boolean);
3290
2367
  for (const [relativePath, content] of files) {
3291
2368
  const text = content.toString('utf8');
3292
2369
  if (/\{\{[^{}]+\}\}/u.test(text)) {
3293
2370
  error(`${fieldName} final file tree contains an unresolved template in "${relativePath}"`);
3294
2371
  }
3295
- if (sensitiveValues.some((value) => text.includes(value))) {
3296
- error(`${fieldName} final file tree exposes sensitive config in "${relativePath}"`);
3297
- }
3298
2372
  }
3299
2373
  if (declaration.target === 'codex.skill') {
3300
2374
  const openAiYaml = files.get('agents/openai.yaml');
@@ -3490,26 +2564,83 @@ function validateRenderedArtifactPlan(plan, declarations, scopeLabel, options) {
3490
2564
  }
3491
2565
  }
3492
2566
  }
2567
+ function resolveArtifactRendererFixtureRequests(declarations, manifest) {
2568
+ const awOwned = new Map();
2569
+ const codexNative = new Map();
2570
+ for (const declaration of declarations) {
2571
+ if (declaration.delivery?.mode === 'codex-native') {
2572
+ const scope = declaration.scopes.includes('user') ? 'user' : 'project';
2573
+ const request = codexNative.get(scope) ?? {
2574
+ kind: 'codex-native',
2575
+ surface: 'codex',
2576
+ scope,
2577
+ configScope: 'user',
2578
+ declarations: [],
2579
+ };
2580
+ request.declarations.push(declaration);
2581
+ codexNative.set(scope, request);
2582
+ continue;
2583
+ }
2584
+ const surface = declaration.platform ?? declaration.distribution;
2585
+ if (!surface)
2586
+ continue;
2587
+ for (const scope of declaration.scopes) {
2588
+ const key = `${surface}:${scope}`;
2589
+ const request = awOwned.get(key) ?? {
2590
+ kind: 'aw-owned',
2591
+ surface,
2592
+ scope,
2593
+ configScope: scope,
2594
+ declarations: [],
2595
+ };
2596
+ request.declarations.push(declaration);
2597
+ awOwned.set(key, request);
2598
+ }
2599
+ }
2600
+ const partitionedAwOwned = [...awOwned.values()].flatMap((request) => {
2601
+ const hasSkill = request.declarations.some((declaration) => declaration.target === 'codex.skill'
2602
+ || declaration.target === 'claude.skill'
2603
+ || declaration.target === 'agent-skills.skill');
2604
+ const hasSensitiveNonSkill = request.declarations.some((declaration) => declaration.target !== 'codex.skill'
2605
+ && declaration.target !== 'claude.skill'
2606
+ && declaration.target !== 'agent-skills.skill'
2607
+ && declaration.refreshKeys.some((key) => configFieldContainsSensitiveValue(manifest.config?.fields?.[key])));
2608
+ if (!hasSkill || !hasSensitiveNonSkill)
2609
+ return [request];
2610
+ const skillDeclarations = request.declarations.filter((declaration) => declaration.target === 'codex.skill'
2611
+ || declaration.target === 'claude.skill'
2612
+ || declaration.target === 'agent-skills.skill');
2613
+ const nonSkillDeclarations = request.declarations.filter((declaration) => !skillDeclarations.includes(declaration));
2614
+ return [
2615
+ { ...request, declarations: skillDeclarations },
2616
+ { ...request, declarations: nonSkillDeclarations },
2617
+ ];
2618
+ });
2619
+ return [...partitionedAwOwned, ...codexNative.values()];
2620
+ }
3493
2621
  function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, resolvedRuntimeImports, skillValidationTools) {
3494
2622
  if (!renderEntry || declarations.length === 0)
3495
2623
  return;
3496
- const surfaceScopes = [...new Set(declarations.flatMap((target) => target.scopes.map((scope) => `${target.platform ?? target.distribution}:${scope}`)))];
2624
+ const requests = resolveArtifactRendererFixtureRequests(declarations, manifest);
3497
2625
  const values = defaultConfigValues(manifest);
3498
2626
  const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'aw-artifact-render-'));
3499
2627
  try {
3500
- for (const surfaceScope of surfaceScopes) {
3501
- const [surface, scope] = surfaceScope.split(':');
2628
+ for (const [requestIndex, request] of requests.entries()) {
2629
+ const { kind, surface, scope, configScope, declarations: scopedDeclarations, } = request;
3502
2630
  const distribution = surface === 'agent-skills' ? surface : undefined;
3503
2631
  const platform = distribution ? undefined : surface;
3504
2632
  const event = distribution ? 'materialize' : 'install';
3505
- const scopedDeclarations = declarations.filter((target) => (distribution ? target.distribution === distribution : target.platform === platform)
3506
- && target.scopes.includes(scope));
3507
- const contextPath = path.join(tempRoot, `context-${surface}-${scope}.json`);
2633
+ const requestRoot = path.join(tempRoot, `${requestIndex}-${kind}-${surface}-${scope}`);
2634
+ const rendererAwHome = path.join(requestRoot, 'aw-home');
2635
+ const rendererCodexHome = path.join(requestRoot, 'codex-home');
2636
+ const rendererClaudeHome = path.join(requestRoot, 'claude-home');
2637
+ fs.mkdirSync(requestRoot, { recursive: true });
2638
+ const contextPath = path.join(requestRoot, 'context.json');
3508
2639
  const runtimeImports = scopedDeclarations.flatMap((target) => target.runtimeImports.map((runtimeImport, importIndex) => {
3509
2640
  const resolved = resolvedRuntimeImports?.artifactImports.get(authorRuntimeImportKey(target.id, importIndex));
3510
2641
  if (!resolved)
3511
2642
  return null;
3512
- const importPath = path.join(tempRoot, `runtime-${target.id}-${importIndex}`);
2643
+ const importPath = path.join(requestRoot, `runtime-${target.id}-${importIndex}`);
3513
2644
  fs.writeFileSync(importPath, resolved.bytes);
3514
2645
  return {
3515
2646
  artifactId: target.id,
@@ -3520,6 +2651,37 @@ function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declaratio
3520
2651
  digest: resolved.digest,
3521
2652
  };
3522
2653
  }).filter(Boolean));
2654
+ const refreshKeys = [...new Set(scopedDeclarations.flatMap((target) => target.refreshKeys))];
2655
+ const scopedSchema = Object.fromEntries(refreshKeys.flatMap((key) => manifest.config?.fields?.[key] === undefined
2656
+ ? []
2657
+ : [[key, manifest.config.fields[key]]]));
2658
+ const scopedValues = Object.fromEntries(refreshKeys.flatMap((key) => Object.prototype.hasOwnProperty.call(values, key) ? [[key, values[key]]] : []));
2659
+ try {
2660
+ for (const target of scopedDeclarations.filter((declaration) => declaration.runtimeConfig)) {
2661
+ const definition = normalizePluginConfigDefinition(manifest.config);
2662
+ createRuntimeConfigSnapshot({
2663
+ installedIdentity: {
2664
+ sourceId: 'authoring',
2665
+ sourceIdentity: 'authoring',
2666
+ pluginId: `authoring/${manifest.name}`,
2667
+ pluginName: manifest.name,
2668
+ pluginVersion: manifest.version,
2669
+ platform: target.platform,
2670
+ scope: target.delivery?.mode === 'codex-native' ? 'user' : scope,
2671
+ configScope,
2672
+ artifactId: target.id,
2673
+ skillKey: target.skillKey,
2674
+ },
2675
+ declaration: target.runtimeConfig,
2676
+ definition,
2677
+ values,
2678
+ });
2679
+ }
2680
+ }
2681
+ catch (runtimeConfigError) {
2682
+ error(`scripts.artifacts.render fixture (${surface}/${scope}) runtime config failed: ${runtimeConfigError.message}`);
2683
+ continue;
2684
+ }
3523
2685
  fs.writeFileSync(contextPath, JSON.stringify({
3524
2686
  event,
3525
2687
  surface: distribution
@@ -3535,29 +2697,28 @@ function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declaratio
3535
2697
  },
3536
2698
  config: {
3537
2699
  mode: 'artifact-render',
3538
- targetScope: scope,
3539
- schema: manifest.config?.schema ?? {},
3540
- values,
3541
- sources: Object.fromEntries(Object.keys(values).map((key) => [key, 'default'])),
2700
+ targetScope: configScope,
2701
+ ...(manifest.config?.fields === undefined ? {} : { schema: scopedSchema }),
2702
+ values: scopedValues,
2703
+ sources: Object.fromEntries(Object.keys(scopedValues).map((key) => [key, 'default'])),
3542
2704
  issues: [],
3543
2705
  },
3544
2706
  changedConfigKeys: [],
2707
+ requestedArtifactIds: scopedDeclarations.map((target) => target.id),
3545
2708
  previousArtifacts: [],
3546
- artifactSources: scopedDeclarations.map((target) => ({
2709
+ artifactSources: declarations.filter((target) => (target.target === 'codex.skill' || target.target === 'claude.skill' || target.target === 'agent-skills.skill')
2710
+ && (distribution ? target.distribution === distribution : target.platform === platform)
2711
+ && target.scopes.includes(scope)).map((target) => ({
3547
2712
  id: target.id,
3548
2713
  target: target.target,
3549
2714
  sourceDirs: target.sourceDirs.map((sourceDir) => path.join(pluginDir, normalizeRelativePath(sourceDir))),
3550
2715
  })),
3551
2716
  runtimeImports,
3552
2717
  paths: {
3553
- awHome: path.join(tempRoot, 'aw-home'),
3554
- codexHome: path.join(tempRoot, 'codex-home'),
3555
- claudeHome: path.join(tempRoot, 'claude-home'),
2718
+ awHome: rendererAwHome,
2719
+ codexHome: rendererCodexHome,
2720
+ claudeHome: rendererClaudeHome,
3556
2721
  manifestPath: path.join(pluginDir, '.agents-plugin', 'plugin.json'),
3557
- configStores: {
3558
- user: path.join(tempRoot, 'config-user.json'),
3559
- project: path.join(tempRoot, 'config-project.json'),
3560
- },
3561
2722
  },
3562
2723
  renderer: {
3563
2724
  runner: renderEntry.runner,
@@ -3567,14 +2728,17 @@ function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declaratio
3567
2728
  rendererDigest: 'author-validator-fixture',
3568
2729
  },
3569
2730
  }), 'utf8');
3570
- const rendererHome = path.join(tempRoot, 'home');
3571
- const rendererTemp = path.join(tempRoot, 'tmp');
2731
+ const rendererHome = path.join(requestRoot, 'home');
2732
+ const rendererTemp = path.join(requestRoot, 'tmp');
2733
+ for (const rendererStateHome of [rendererAwHome, rendererCodexHome, rendererClaudeHome]) {
2734
+ fs.mkdirSync(rendererStateHome, { recursive: true });
2735
+ }
3572
2736
  fs.mkdirSync(rendererHome, { recursive: true });
3573
2737
  fs.mkdirSync(rendererTemp, { recursive: true });
3574
2738
  const rendererEnv = {
3575
- AW_HOME: path.join(tempRoot, 'aw-home'),
3576
- AW_CODEX_HOME: path.join(tempRoot, 'codex-home'),
3577
- AW_CLAUDE_HOME: path.join(tempRoot, 'claude-home'),
2739
+ AW_HOME: rendererAwHome,
2740
+ AW_CODEX_HOME: rendererCodexHome,
2741
+ AW_CLAUDE_HOME: rendererClaudeHome,
3578
2742
  PATH: process.env.PATH ?? process.env.Path ?? '',
3579
2743
  AW_PLUGIN_CONTEXT: contextPath,
3580
2744
  AW_PLUGIN_ROOT: pluginDir,
@@ -3655,16 +2819,14 @@ function validateScriptsLightweight(pluginDir, manifest) {
3655
2819
  const scripts = expectRecord(manifest.scripts, 'scripts');
3656
2820
  if (!scripts)
3657
2821
  return null;
3658
- validateAllowedKeys(scripts, 'scripts', ['timeoutMs', 'lifecycle', 'helpers', 'node', 'artifacts', 'tests']);
3659
- if (scripts.timeoutMs !== undefined &&
3660
- (!Number.isInteger(scripts.timeoutMs) ||
3661
- scripts.timeoutMs < SCRIPT_TIMEOUT_MIN_MS ||
3662
- scripts.timeoutMs > SCRIPT_TIMEOUT_MAX_MS)) {
3663
- error(`scripts.timeoutMs must be an integer between ${SCRIPT_TIMEOUT_MIN_MS} and ${SCRIPT_TIMEOUT_MAX_MS}`);
3664
- }
2822
+ validateAllowedKeys(scripts, 'scripts', ['preApply', 'helpers', 'node', 'artifacts', 'tests']);
3665
2823
  const runtimeNodeEntries = [];
3666
2824
  let artifactRenderEntry = null;
3667
2825
  let packageMeta = null;
2826
+ const runtimeConfigSkillRoots = (manifest.artifacts?.targets ?? [])
2827
+ .filter((target) => target.runtimeConfig !== undefined)
2828
+ .flatMap((target) => target.sourceDirs ?? [])
2829
+ .map(normalizeRelativePath);
3668
2830
  if (scripts.helpers !== undefined) {
3669
2831
  const helpers = expectRecord(scripts.helpers, 'scripts.helpers');
3670
2832
  if (helpers) {
@@ -3678,17 +2840,21 @@ function validateScriptsLightweight(pluginDir, manifest) {
3678
2840
  runtimeNodeEntries.push({ path: helperPath, fieldName: 'scripts.helpers.config' });
3679
2841
  }
3680
2842
  }
3681
- if (scripts.lifecycle !== undefined) {
3682
- const lifecycle = expectRecord(scripts.lifecycle, 'scripts.lifecycle');
3683
- if (lifecycle) {
3684
- validateAllowedKeys(lifecycle, 'scripts.lifecycle', [...SCRIPT_LIFECYCLE_EVENTS]);
3685
- for (const [eventName, definition] of Object.entries(lifecycle)) {
3686
- if (!SCRIPT_LIFECYCLE_EVENTS.has(eventName)) {
3687
- error(`scripts.lifecycle has unsupported event "${eventName}"`);
3688
- continue;
3689
- }
3690
- validateLifecycleDefinition(pluginDir, definition, `scripts.lifecycle.${eventName}`, runtimeNodeEntries);
2843
+ if (scripts.preApply !== undefined) {
2844
+ const preApply = expectRecord(scripts.preApply, 'scripts.preApply');
2845
+ if (preApply) {
2846
+ validateAllowedKeys(preApply, 'scripts.preApply', ['path', 'timeoutMs']);
2847
+ const preApplyPath = normalizePluginScriptPath(pluginDir, preApply.path, 'scripts.preApply.path');
2848
+ validateDeclaredScriptFile(pluginDir, preApplyPath, 'scripts.preApply.path');
2849
+ if (preApplyPath && !isNodeRunnablePath(preApplyPath)) {
2850
+ error('scripts.preApply.path must use a Node runnable extension (.js, .mjs, or .cjs)');
2851
+ }
2852
+ if (preApply.timeoutMs !== undefined && (!Number.isInteger(preApply.timeoutMs)
2853
+ || preApply.timeoutMs < SCRIPT_TIMEOUT_MIN_MS || preApply.timeoutMs > SCRIPT_TIMEOUT_MAX_MS)) {
2854
+ error(`scripts.preApply.timeoutMs must be an integer between ${SCRIPT_TIMEOUT_MIN_MS} and ${SCRIPT_TIMEOUT_MAX_MS}`);
3691
2855
  }
2856
+ if (preApplyPath)
2857
+ runtimeNodeEntries.push({ path: preApplyPath, fieldName: 'scripts.preApply.path' });
3692
2858
  }
3693
2859
  }
3694
2860
  if (scripts.node !== undefined) {
@@ -3708,6 +2874,7 @@ function validateScriptsLightweight(pluginDir, manifest) {
3708
2874
  label: 'scripts.node.build import contract',
3709
2875
  packageMeta,
3710
2876
  allowDevDependencies: true,
2877
+ runtimeConfigSkillRoots,
3711
2878
  });
3712
2879
  }
3713
2880
  }
@@ -3757,6 +2924,7 @@ function validateScriptsLightweight(pluginDir, manifest) {
3757
2924
  label: 'scripts.tests.node import contract',
3758
2925
  packageMeta,
3759
2926
  allowDevDependencies: true,
2927
+ runtimeConfigSkillRoots,
3760
2928
  });
3761
2929
  }
3762
2930
  }
@@ -3766,6 +2934,7 @@ function validateScriptsLightweight(pluginDir, manifest) {
3766
2934
  label: 'runtime Node import contract',
3767
2935
  packageMeta,
3768
2936
  allowDevDependencies: false,
2937
+ runtimeConfigSkillRoots,
3769
2938
  });
3770
2939
  return artifactRenderEntry;
3771
2940
  }
@@ -4167,8 +3336,6 @@ function printUsage() {
4167
3336
  aw plugin validate <plugin-directory> [options]
4168
3337
 
4169
3338
  Options:
4170
- --catalog-min-version <semver>
4171
- Validate compatibility.aw.minVersion against a target catalog.
4172
3339
  --strict-agent-skills Allow only Agent Skills portable core frontmatter.
4173
3340
  --claude-skill-profile <minimum|current>
4174
3341
  Validate Claude fields at AW minimum 2.1.88 (default) or current docs.
@@ -4238,7 +3405,30 @@ async function validatePluginDir(pluginDir, options) {
4238
3405
  }
4239
3406
  const skillValidationTools = await tryLoadCliSkillValidationTools();
4240
3407
  try {
4241
- await cliManifestTools.validateSourcePluginManifest(pluginDir, manifest);
3408
+ const normalizedManifest = await cliManifestTools.validateSourcePluginManifest(pluginDir, manifest);
3409
+ // Renderer fixtures consume the same compiled config as installed runtime consumers.
3410
+ if (normalizedManifest.config)
3411
+ manifest.config = normalizedManifest.config;
3412
+ const requirements = await cliManifestTools.resolvePluginRequirements({
3413
+ pluginRoot: pluginDir,
3414
+ manifest: normalizedManifest,
3415
+ implementedCapabilities: cliManifestTools.implementedCapabilities,
3416
+ });
3417
+ if (requirements.unsupportedByCurrentAw.length > 0) {
3418
+ capabilityDiagnostic = {
3419
+ errorCode: 'awCapabilityUnsupported',
3420
+ missingCapabilities: requirements.unsupportedByCurrentAw,
3421
+ availableCapabilities: [...cliManifestTools.implementedCapabilities].sort(),
3422
+ };
3423
+ error(`[awCapabilityUnsupported] missingCapabilities=${JSON.stringify(requirements.unsupportedByCurrentAw)}`);
3424
+ }
3425
+ const satisfiedCapabilities = new Set([...requirements.declared, ...requirements.derived]);
3426
+ const advisoryObservations = requirements.observations.filter((observation) => (observation.code !== 'aw-command-detected'
3427
+ || observation.capability === undefined
3428
+ || !satisfiedCapabilities.has(observation.capability)));
3429
+ for (const observation of advisoryObservations) {
3430
+ warn(`[awCapabilityObservation] ${observation.path}: ${observation.message}`);
3431
+ }
4242
3432
  }
4243
3433
  catch (e) {
4244
3434
  error(e.message);
@@ -4249,8 +3439,7 @@ async function validatePluginDir(pluginDir, options) {
4249
3439
  validateNoBuildOutputDirs(pluginDir);
4250
3440
  validateDeclaredNativeAssets(pluginDir, manifest);
4251
3441
  validateCanonicalSkillLayout(pluginDir, manifest);
4252
- validatePluginVersionContracts(manifest, options);
4253
- validatePluginEvalManifest(pluginDir, manifest);
3442
+ await validatePluginEvalManifest(pluginDir, manifest);
4254
3443
  const artifactRenderEntry = validateScriptsLightweight(pluginDir, manifest);
4255
3444
  const runtimeImports = await resolveAuthorRuntimeImports({
4256
3445
  pluginDir,
@@ -4300,7 +3489,6 @@ function parseArgs(argv) {
4300
3489
  const args = argv.slice(2);
4301
3490
  const options = {
4302
3491
  pluginDir: null,
4303
- catalogMinVersion: null,
4304
3492
  strictAgentSkills: false,
4305
3493
  claudeSkillProfile: 'minimum',
4306
3494
  versionBase: 'HEAD',
@@ -4357,18 +3545,6 @@ function parseArgs(argv) {
4357
3545
  }
4358
3546
  exitCliError(`Unknown argument: ${arg}`, options.json);
4359
3547
  }
4360
- if (arg === '--catalog-min-version') {
4361
- const value = args[index + 1];
4362
- if (!value || value.startsWith('--')) {
4363
- exitCliError('--catalog-min-version requires a value.', options.json);
4364
- }
4365
- index += 1;
4366
- if (!STRICT_SEMVER_PATTERN.test(value)) {
4367
- exitCliError(`Invalid --catalog-min-version: expected a strict SemVer 2.0.0 string. Received ${JSON.stringify(value)}.`, options.json);
4368
- }
4369
- options.catalogMinVersion = value;
4370
- continue;
4371
- }
4372
3548
  exitCliError(`Unknown option: ${arg}`, options.json);
4373
3549
  }
4374
3550
  return options;
@@ -4400,7 +3576,6 @@ async function main() {
4400
3576
  const repoRoot = requestedWorkspaceRoot ?? discoverCanonicalRepoRoot(repoRootCandidate);
4401
3577
  const gitRoot = discoverCanonicalRepoRoot(findRepoRootCandidate(resolved));
4402
3578
  await validatePluginDir(resolved, {
4403
- catalogMinVersion: args.catalogMinVersion,
4404
3579
  strictAgentSkills: args.strictAgentSkills,
4405
3580
  claudeSkillProfile: args.claudeSkillProfile,
4406
3581
  versionBase: args.versionBase,
@@ -4414,9 +3589,12 @@ async function main() {
4414
3589
  profile: args.strictAgentSkills ? 'agent-skills-portable-core' : 'aw-source',
4415
3590
  claudeSkillProfile: args.claudeSkillProfile,
4416
3591
  pluginDirectory: resolved,
3592
+ workspaceRoot: process.env.AW_AUTHORING_WORKSPACE_ROOT ?? repoRoot,
3593
+ workspaceRootResolvedFrom: process.env.AW_AUTHORING_WORKSPACE_ROOT_RESOLVED_FROM ?? 'explicit',
4417
3594
  versionCheck: pluginVersionCheckResult,
4418
3595
  warnings,
4419
3596
  errors,
3597
+ ...(capabilityDiagnostic ?? {}),
4420
3598
  }, null, 2));
4421
3599
  if (errors.length > 0) {
4422
3600
  process.exit(1);