@lesliechan721/aw 0.1.0-beta.7 → 0.1.0-beta.72
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.
- package/dist/authoring/assets/aw-config.mjs +100 -501
- package/dist/authoring/assets/aw-config.mjs.map +1 -1
- package/dist/authoring/assets/aw-runtime-config.d.mts +13 -0
- package/dist/authoring/assets/aw-runtime-config.mjs +199 -0
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
- package/dist/authoring/scripts/add-skill.mjs +13 -27
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +74 -103
- package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-root.mjs +4 -4
- package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
- package/dist/authoring/scripts/lib/plugin-version-check.mjs +229 -8
- package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.d.mts +79 -92
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +103 -126
- package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
- package/dist/authoring/scripts/plugin-status.mjs +8 -11
- package/dist/authoring/scripts/plugin-status.mjs.map +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs +3 -2
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +527 -1673
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-skill.mjs +1 -1
- package/dist/native-runtime/reader-runtime.mjs +34 -0
- package/dist/native-runtime/reader.d.mts +6 -0
- package/dist/native-runtime/reader.mjs +11 -0
- package/dist/scripts/aw-skill-eval-materializer.d.ts +28 -0
- package/dist/scripts/aw-skill-eval-materializer.js +339 -0
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -0
- package/dist/scripts/bundle-plugins.d.ts +1 -0
- package/dist/scripts/bundle-plugins.js +27 -8
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.d.ts +8 -10
- package/dist/scripts/plugin-staging.js +19 -30
- package/dist/scripts/plugin-staging.js.map +1 -1
- package/dist/scripts/plugin-test-reporter.d.mts +2 -0
- package/dist/scripts/plugin-test-reporter.mjs +21 -0
- package/dist/scripts/plugin-test-reporter.mjs.map +1 -0
- package/dist/scripts/test-plugin-scripts.d.ts +5 -0
- package/dist/scripts/test-plugin-scripts.js +246 -108
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/scripts/test-workers.d.mts +24 -0
- package/dist/scripts/test-workers.mjs +59 -0
- package/dist/scripts/test-workers.mjs.map +1 -0
- package/dist/src/adapters/helpers.d.ts +7 -0
- package/dist/src/adapters/helpers.js +2 -2
- package/dist/src/adapters/helpers.js.map +1 -1
- package/dist/src/authoring/workspace-commands.d.ts +20 -1
- package/dist/src/authoring/workspace-commands.js +28 -6
- package/dist/src/authoring/workspace-commands.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +78 -0
- package/dist/src/commands/aw-capabilities.js +270 -0
- package/dist/src/commands/aw-capabilities.js.map +1 -0
- package/dist/src/commands/catalog-dev-source.d.ts +157 -0
- package/dist/src/commands/catalog-dev-source.js +725 -0
- package/dist/src/commands/catalog-dev-source.js.map +1 -0
- package/dist/src/commands/catalog-generation.d.ts +21 -0
- package/dist/src/commands/catalog-generation.js +9 -0
- package/dist/src/commands/catalog-generation.js.map +1 -0
- package/dist/src/commands/catalog-publication-inspection.d.ts +71 -30
- package/dist/src/commands/catalog-publication-inspection.js +475 -63
- package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
- package/dist/src/commands/catalog-publication-journal.d.ts +68 -0
- package/dist/src/commands/catalog-publication-journal.js +292 -0
- package/dist/src/commands/catalog-publication-journal.js.map +1 -0
- package/dist/src/commands/catalog-publication-target.d.ts +18 -0
- package/dist/src/commands/catalog-publication-target.js +95 -0
- package/dist/src/commands/catalog-publication-target.js.map +1 -0
- package/dist/src/commands/catalog-publish.d.ts +89 -15
- package/dist/src/commands/catalog-publish.js +736 -210
- package/dist/src/commands/catalog-publish.js.map +1 -1
- package/dist/src/commands/catalog-source.d.ts +64 -22
- package/dist/src/commands/catalog-source.js +327 -91
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/catalog-status.d.ts +18 -22
- package/dist/src/commands/catalog-status.js +82 -116
- package/dist/src/commands/catalog-status.js.map +1 -1
- package/dist/src/commands/catalog-store.d.ts +104 -0
- package/dist/src/commands/catalog-store.js +685 -0
- package/dist/src/commands/catalog-store.js.map +1 -0
- package/dist/src/commands/catalog-workspace-resolution.d.ts +17 -0
- package/dist/src/commands/catalog-workspace-resolution.js +57 -0
- package/dist/src/commands/catalog-workspace-resolution.js.map +1 -0
- package/dist/src/commands/console.js +32 -20
- package/dist/src/commands/console.js.map +1 -1
- package/dist/src/commands/dependency-operation-plan.d.ts +52 -15
- package/dist/src/commands/dependency-operation-plan.js +289 -7
- package/dist/src/commands/dependency-operation-plan.js.map +1 -1
- package/dist/src/commands/init.d.ts +5 -11
- package/dist/src/commands/init.js +30 -51
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/intent-command.d.ts +32 -0
- package/dist/src/commands/intent-command.js +171 -0
- package/dist/src/commands/intent-command.js.map +1 -0
- package/dist/src/commands/managed-commands.d.ts +35 -0
- package/dist/src/commands/managed-commands.js +359 -0
- package/dist/src/commands/managed-commands.js.map +1 -0
- package/dist/src/commands/offline-cleanup-evidence.d.ts +67 -0
- package/dist/src/commands/offline-cleanup-evidence.js +181 -0
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -0
- package/dist/src/commands/operation-plan.d.ts +184 -0
- package/dist/src/commands/operation-plan.js +72 -0
- package/dist/src/commands/operation-plan.js.map +1 -0
- package/dist/src/commands/operation-planner.d.ts +47 -0
- package/dist/src/commands/operation-planner.js +142 -0
- package/dist/src/commands/operation-planner.js.map +1 -0
- package/dist/src/commands/options.d.ts +10 -17
- package/dist/src/commands/options.js +91 -38
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +85 -30
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-config-confirmation.d.ts +8 -0
- package/dist/src/commands/public-config-confirmation.js +56 -0
- package/dist/src/commands/public-config-confirmation.js.map +1 -0
- package/dist/src/commands/public-interruption.d.ts +9 -0
- package/dist/src/commands/public-interruption.js +23 -0
- package/dist/src/commands/public-interruption.js.map +1 -0
- package/dist/src/commands/public-lifecycle-result.d.ts +53 -0
- package/dist/src/commands/public-lifecycle-result.js +102 -0
- package/dist/src/commands/public-lifecycle-result.js.map +1 -0
- package/dist/src/commands/public-lifecycle.d.ts +26 -0
- package/dist/src/commands/public-lifecycle.js +469 -0
- package/dist/src/commands/public-lifecycle.js.map +1 -0
- package/dist/src/commands/public-plugin-query.d.ts +15 -0
- package/dist/src/commands/public-plugin-query.js +154 -0
- package/dist/src/commands/public-plugin-query.js.map +1 -0
- package/dist/src/commands/rebuild-command.d.ts +177 -29
- package/dist/src/commands/rebuild-command.js +4113 -745
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +163 -22
- package/dist/src/commands/rebuild-integration.js +3553 -1456
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +60 -30
- package/dist/src/commands/rebuild-operations.js +266 -320
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/reconcile-operation-plan.d.ts +28 -0
- package/dist/src/commands/reconcile-operation-plan.js +47 -0
- package/dist/src/commands/reconcile-operation-plan.js.map +1 -0
- package/dist/src/commands/review-inspection.d.ts +60 -0
- package/dist/src/commands/review-inspection.js +399 -0
- package/dist/src/commands/review-inspection.js.map +1 -0
- package/dist/src/commands/review-preparation.d.ts +49 -0
- package/dist/src/commands/review-preparation.js +437 -0
- package/dist/src/commands/review-preparation.js.map +1 -0
- package/dist/src/commands/runtime.d.ts +5 -5
- package/dist/src/commands/runtime.js +42 -54
- package/dist/src/commands/runtime.js.map +1 -1
- package/dist/src/commands/skill-eval.d.ts +41 -0
- package/dist/src/commands/skill-eval.js +406 -0
- package/dist/src/commands/skill-eval.js.map +1 -0
- package/dist/src/commands/status-v6.d.ts +317 -0
- package/dist/src/commands/status-v6.js +2970 -0
- package/dist/src/commands/status-v6.js.map +1 -0
- package/dist/src/commands/targets-command.d.ts +29 -0
- package/dist/src/commands/targets-command.js +131 -0
- package/dist/src/commands/targets-command.js.map +1 -0
- package/dist/src/commands/wizard.d.ts +8 -5
- package/dist/src/commands/wizard.js +6 -4
- package/dist/src/commands/wizard.js.map +1 -1
- package/dist/src/commands/write-commands.d.ts +9 -3
- package/dist/src/commands/write-commands.js +129 -30
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/constants.d.ts +7 -2
- package/dist/src/constants.js +7 -2
- package/dist/src/constants.js.map +1 -1
- package/dist/src/eval/manifest-v1.d.ts +70 -0
- package/dist/src/eval/manifest-v1.js +358 -0
- package/dist/src/eval/manifest-v1.js.map +1 -0
- package/dist/src/generators/local-plugin.d.ts +7 -2
- package/dist/src/generators/local-plugin.js +377 -210
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/generators/permissions.d.ts +5 -2
- package/dist/src/generators/permissions.js +28 -15
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.d.ts +1 -27
- package/dist/src/index.js +1877 -1592
- package/dist/src/index.js.map +1 -1
- package/dist/src/intent/deployment-preferences.d.ts +63 -0
- package/dist/src/intent/deployment-preferences.js +170 -0
- package/dist/src/intent/deployment-preferences.js.map +1 -0
- package/dist/src/intent/diagnostics.d.ts +11 -0
- package/dist/src/intent/diagnostics.js +14 -0
- package/dist/src/intent/diagnostics.js.map +1 -0
- package/dist/src/intent/intent-codec.d.ts +19 -0
- package/dist/src/intent/intent-codec.js +117 -0
- package/dist/src/intent/intent-codec.js.map +1 -0
- package/dist/src/intent/intent-store.d.ts +43 -0
- package/dist/src/intent/intent-store.js +118 -0
- package/dist/src/intent/intent-store.js.map +1 -0
- package/dist/src/intent/scope-context.d.ts +33 -0
- package/dist/src/intent/scope-context.js +145 -0
- package/dist/src/intent/scope-context.js.map +1 -0
- package/dist/src/intent/work-context.d.ts +13 -0
- package/dist/src/intent/work-context.js +22 -0
- package/dist/src/intent/work-context.js.map +1 -0
- package/dist/src/output/command-receipt.d.ts +47 -46
- package/dist/src/output/command-receipt.js +284 -79
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/model.d.ts +3 -44
- package/dist/src/output/model.js +1 -144
- package/dist/src/output/model.js.map +1 -1
- package/dist/src/output/public-result.d.ts +43 -0
- package/dist/src/output/public-result.js +139 -0
- package/dist/src/output/public-result.js.map +1 -0
- package/dist/src/output/rebuild-progress.js +15 -13
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/output/receipt-projection.d.ts +7 -0
- package/dist/src/output/receipt-projection.js +575 -0
- package/dist/src/output/receipt-projection.js.map +1 -0
- package/dist/src/portable/commands.d.ts +59 -10
- package/dist/src/portable/commands.js +98 -302
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/historical-materialization.d.ts +22 -0
- package/dist/src/portable/historical-materialization.js +124 -0
- package/dist/src/portable/historical-materialization.js.map +1 -0
- package/dist/src/portable/materializer.d.ts +25 -4
- package/dist/src/portable/materializer.js +247 -68
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery-layout.d.ts +17 -0
- package/dist/src/portable/recovery-layout.js +55 -0
- package/dist/src/portable/recovery-layout.js.map +1 -0
- package/dist/src/portable/recovery.d.ts +143 -0
- package/dist/src/portable/recovery.js +339 -0
- package/dist/src/portable/recovery.js.map +1 -0
- package/dist/src/portable/writer.d.ts +64 -0
- package/dist/src/portable/writer.js +316 -0
- package/dist/src/portable/writer.js.map +1 -0
- package/dist/src/recovery/coordinator.d.ts +140 -0
- package/dist/src/recovery/coordinator.js +1200 -0
- package/dist/src/recovery/coordinator.js.map +1 -0
- package/dist/src/recovery/demand.d.ts +44 -0
- package/dist/src/recovery/demand.js +178 -0
- package/dist/src/recovery/demand.js.map +1 -0
- package/dist/src/recovery/joint-coordinator.d.ts +24 -0
- package/dist/src/recovery/joint-coordinator.js +797 -0
- package/dist/src/recovery/joint-coordinator.js.map +1 -0
- package/dist/src/recovery/joint-demand.d.ts +68 -0
- package/dist/src/recovery/joint-demand.js +166 -0
- package/dist/src/recovery/joint-demand.js.map +1 -0
- package/dist/src/recovery/performance.d.ts +4 -0
- package/dist/src/recovery/performance.js +26 -0
- package/dist/src/recovery/performance.js.map +1 -0
- package/dist/src/recovery/receipt.d.ts +81 -0
- package/dist/src/recovery/receipt.js +2 -0
- package/dist/src/recovery/receipt.js.map +1 -0
- package/dist/src/recovery/retirement.d.ts +47 -0
- package/dist/src/recovery/retirement.js +367 -0
- package/dist/src/recovery/retirement.js.map +1 -0
- package/dist/src/recovery/status.d.ts +108 -0
- package/dist/src/recovery/status.js +418 -0
- package/dist/src/recovery/status.js.map +1 -0
- package/dist/src/recovery/types.d.ts +86 -0
- package/dist/src/recovery/types.js +2 -0
- package/dist/src/recovery/types.js.map +1 -0
- package/dist/src/review/eval-source-input.d.ts +43 -0
- package/dist/src/review/eval-source-input.js +207 -0
- package/dist/src/review/eval-source-input.js.map +1 -0
- package/dist/src/review/review-profile.d.ts +19 -0
- package/dist/src/review/review-profile.js +270 -0
- package/dist/src/review/review-profile.js.map +1 -0
- package/dist/src/review/review-selection.d.ts +29 -0
- package/dist/src/review/review-selection.js +469 -0
- package/dist/src/review/review-selection.js.map +1 -0
- package/dist/src/review/review-types.d.ts +68 -0
- package/dist/src/review/review-types.js +16 -0
- package/dist/src/review/review-types.js.map +1 -0
- package/dist/src/review/skill-materialization.d.ts +27 -0
- package/dist/src/review/skill-materialization.js +228 -0
- package/dist/src/review/skill-materialization.js.map +1 -0
- package/dist/src/review/source-binding.d.ts +198 -0
- package/dist/src/review/source-binding.js +714 -0
- package/dist/src/review/source-binding.js.map +1 -0
- package/dist/src/tui/agent-management.d.ts +23 -0
- package/dist/src/tui/agent-management.js +217 -0
- package/dist/src/tui/agent-management.js.map +1 -0
- package/dist/src/tui/agent-settings.d.ts +44 -0
- package/dist/src/tui/agent-settings.js +98 -0
- package/dist/src/tui/agent-settings.js.map +1 -0
- package/dist/src/tui/catalog-freshness.d.ts +1 -0
- package/dist/src/tui/catalog-freshness.js +2 -0
- package/dist/src/tui/catalog-freshness.js.map +1 -0
- package/dist/src/tui/catalog-generation.d.ts +21 -0
- package/dist/src/tui/catalog-generation.js +156 -0
- package/dist/src/tui/catalog-generation.js.map +1 -0
- package/dist/src/tui/catalog-sources/projection.d.ts +4 -0
- package/dist/src/tui/catalog-sources/projection.js +17 -0
- package/dist/src/tui/catalog-sources/projection.js.map +1 -0
- package/dist/src/tui/catalog-sources/review.d.ts +3 -0
- package/dist/src/tui/catalog-sources/review.js +13 -0
- package/dist/src/tui/catalog-sources/review.js.map +1 -0
- package/dist/src/tui/catalog-sources/screens.d.ts +12 -0
- package/dist/src/tui/catalog-sources/screens.js +40 -0
- package/dist/src/tui/catalog-sources/screens.js.map +1 -0
- package/dist/src/tui/catalog-sources/session.d.ts +32 -0
- package/dist/src/tui/catalog-sources/session.js +300 -0
- package/dist/src/tui/catalog-sources/session.js.map +1 -0
- package/dist/src/tui/catalog-sources/types.d.ts +54 -0
- package/dist/src/tui/catalog-sources/types.js +2 -0
- package/dist/src/tui/catalog-sources/types.js.map +1 -0
- package/dist/src/tui/catalog-store-task.d.ts +16 -0
- package/dist/src/tui/catalog-store-task.js +19 -0
- package/dist/src/tui/catalog-store-task.js.map +1 -0
- package/dist/src/tui/clipboard.d.ts +13 -0
- package/dist/src/tui/clipboard.js +95 -0
- package/dist/src/tui/clipboard.js.map +1 -0
- package/dist/src/tui/components.d.ts +113 -3
- package/dist/src/tui/components.js +192 -36
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/config-array-draft.d.ts +29 -0
- package/dist/src/tui/config-array-draft.js +48 -0
- package/dist/src/tui/config-array-draft.js.map +1 -0
- package/dist/src/tui/config-leaf-editor.d.ts +43 -0
- package/dist/src/tui/config-leaf-editor.js +224 -0
- package/dist/src/tui/config-leaf-editor.js.map +1 -0
- package/dist/src/tui/config-references.d.ts +38 -0
- package/dist/src/tui/config-references.js +82 -0
- package/dist/src/tui/config-references.js.map +1 -0
- package/dist/src/tui/config-value-presentation.d.ts +20 -0
- package/dist/src/tui/config-value-presentation.js +104 -0
- package/dist/src/tui/config-value-presentation.js.map +1 -0
- package/dist/src/tui/console-app-v4.d.ts +13 -4
- package/dist/src/tui/console-app-v4.js +9764 -1955
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/content-item-card.d.ts +13 -0
- package/dist/src/tui/content-item-card.js +51 -0
- package/dist/src/tui/content-item-card.js.map +1 -0
- package/dist/src/tui/controller-runtime.d.ts +11 -2
- package/dist/src/tui/controller-runtime.js +2223 -471
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +697 -66
- package/dist/src/tui/controller.js +3695 -778
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/dependency-graph-view.d.ts +39 -0
- package/dist/src/tui/dependency-graph-view.js +121 -0
- package/dist/src/tui/dependency-graph-view.js.map +1 -0
- package/dist/src/tui/dependency-graph.d.ts +81 -0
- package/dist/src/tui/dependency-graph.js +452 -0
- package/dist/src/tui/dependency-graph.js.map +1 -0
- package/dist/src/tui/diagnostic-projection.d.ts +23 -0
- package/dist/src/tui/diagnostic-projection.js +595 -0
- package/dist/src/tui/diagnostic-projection.js.map +1 -0
- package/dist/src/tui/diagnostics.d.ts +3 -3
- package/dist/src/tui/diagnostics.js +14 -2
- package/dist/src/tui/diagnostics.js.map +1 -1
- package/dist/src/tui/entity-cards.d.ts +55 -0
- package/dist/src/tui/entity-cards.js +298 -0
- package/dist/src/tui/entity-cards.js.map +1 -0
- package/dist/src/tui/glossary.d.ts +25 -0
- package/dist/src/tui/glossary.js +62 -0
- package/dist/src/tui/glossary.js.map +1 -0
- package/dist/src/tui/index.d.ts +6 -1
- package/dist/src/tui/index.js +5 -1
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/input-display.d.ts +9 -0
- package/dist/src/tui/input-display.js +58 -0
- package/dist/src/tui/input-display.js.map +1 -0
- package/dist/src/tui/keys.d.ts +44 -0
- package/dist/src/tui/keys.js +43 -15
- package/dist/src/tui/keys.js.map +1 -1
- package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
- package/dist/src/tui/lifecycle-action-view.js +36 -0
- package/dist/src/tui/lifecycle-action-view.js.map +1 -0
- package/dist/src/tui/model.d.ts +246 -35
- package/dist/src/tui/model.js +1514 -401
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
- package/dist/src/tui/operation-diagnostic-screens.js +71 -0
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
- package/dist/src/tui/operation-history.d.ts +81 -0
- package/dist/src/tui/operation-history.js +136 -0
- package/dist/src/tui/operation-history.js.map +1 -0
- package/dist/src/tui/operation-review-planner.d.ts +23 -0
- package/dist/src/tui/operation-review-planner.js +1341 -0
- package/dist/src/tui/operation-review-planner.js.map +1 -0
- package/dist/src/tui/plugin-content.d.ts +31 -0
- package/dist/src/tui/plugin-content.js +683 -0
- package/dist/src/tui/plugin-content.js.map +1 -0
- package/dist/src/tui/plugin-detail.d.ts +71 -0
- package/dist/src/tui/plugin-detail.js +252 -0
- package/dist/src/tui/plugin-detail.js.map +1 -0
- package/dist/src/tui/plugin-write-task.d.ts +69 -0
- package/dist/src/tui/plugin-write-task.js +286 -0
- package/dist/src/tui/plugin-write-task.js.map +1 -0
- package/dist/src/tui/prompt.js +4 -15
- package/dist/src/tui/prompt.js.map +1 -1
- package/dist/src/tui/query-header.d.ts +30 -0
- package/dist/src/tui/query-header.js +40 -0
- package/dist/src/tui/query-header.js.map +1 -0
- package/dist/src/tui/reader.d.ts +38 -0
- package/dist/src/tui/reader.js +49 -0
- package/dist/src/tui/reader.js.map +1 -0
- package/dist/src/tui/router.d.ts +194 -17
- package/dist/src/tui/router.js +338 -50
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/tui/scoped-flow.d.ts +45 -0
- package/dist/src/tui/scoped-flow.js +96 -0
- package/dist/src/tui/scoped-flow.js.map +1 -0
- package/dist/src/tui/scoped-inventory.d.ts +122 -0
- package/dist/src/tui/scoped-inventory.js +225 -0
- package/dist/src/tui/scoped-inventory.js.map +1 -0
- package/dist/src/tui/screen-registry.d.ts +701 -0
- package/dist/src/tui/screen-registry.js +226 -0
- package/dist/src/tui/screen-registry.js.map +1 -0
- package/dist/src/tui/session-console-app.d.ts +6 -0
- package/dist/src/tui/session-console-app.js +13 -0
- package/dist/src/tui/session-console-app.js.map +1 -0
- package/dist/src/tui/session-host.d.ts +45 -0
- package/dist/src/tui/session-host.js +219 -0
- package/dist/src/tui/session-host.js.map +1 -0
- package/dist/src/tui/source-detail-card.d.ts +29 -0
- package/dist/src/tui/source-detail-card.js +45 -0
- package/dist/src/tui/source-detail-card.js.map +1 -0
- package/dist/src/tui/source-ref-presets.d.ts +3 -0
- package/dist/src/tui/source-ref-presets.js +11 -0
- package/dist/src/tui/source-ref-presets.js.map +1 -0
- package/dist/src/tui/theme.d.ts +12 -0
- package/dist/src/tui/theme.js +12 -0
- package/dist/src/tui/theme.js.map +1 -1
- package/dist/src/tui/viewport.d.ts +1 -0
- package/dist/src/tui/viewport.js +23 -0
- package/dist/src/tui/viewport.js.map +1 -1
- package/dist/src/tui/views.js +31 -3
- package/dist/src/tui/views.js.map +1 -1
- package/dist/src/tui/wizard.js +37 -13
- package/dist/src/tui/wizard.js.map +1 -1
- package/dist/src/types.d.ts +268 -23
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/agent-version.d.ts +7 -1
- package/dist/src/utils/agent-version.js +38 -7
- package/dist/src/utils/agent-version.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +8 -6
- package/dist/src/utils/artifact-plan.js +80 -19
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +35 -11
- package/dist/src/utils/artifact-renderer.js +250 -227
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +33 -0
- package/dist/src/utils/artifact-request.js +100 -0
- package/dist/src/utils/artifact-request.js.map +1 -0
- package/dist/src/utils/artifact-sources.d.ts +6 -2
- package/dist/src/utils/artifact-sources.js +17 -0
- package/dist/src/utils/artifact-sources.js.map +1 -1
- package/dist/src/utils/aw-home-mutation-lock.d.ts +1 -0
- package/dist/src/utils/aw-home-mutation-lock.js +32 -4
- package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
- package/dist/src/utils/bundle-integrity.d.ts +0 -1
- package/dist/src/utils/bundle-integrity.js +0 -25
- package/dist/src/utils/bundle-integrity.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +47 -45
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
- package/dist/src/utils/catalog-capability-projection.js +14 -0
- package/dist/src/utils/catalog-capability-projection.js.map +1 -0
- package/dist/src/utils/catalog-digests.d.ts +10 -0
- package/dist/src/utils/catalog-digests.js +59 -20
- package/dist/src/utils/catalog-digests.js.map +1 -1
- package/dist/src/utils/catalog-generation-control-snapshot.d.ts +11 -0
- package/dist/src/utils/catalog-generation-control-snapshot.js +45 -0
- package/dist/src/utils/catalog-generation-control-snapshot.js.map +1 -0
- package/dist/src/utils/catalog-generation-error.d.ts +16 -0
- package/dist/src/utils/catalog-generation-error.js +30 -0
- package/dist/src/utils/catalog-generation-error.js.map +1 -0
- package/dist/src/utils/catalog-generation-resolver.d.ts +44 -0
- package/dist/src/utils/catalog-generation-resolver.js +273 -0
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -0
- package/dist/src/utils/catalog-generation-service.d.ts +183 -0
- package/dist/src/utils/catalog-generation-service.js +1281 -0
- package/dist/src/utils/catalog-generation-service.js.map +1 -0
- package/dist/src/utils/catalog-generation-state.d.ts +22 -0
- package/dist/src/utils/catalog-generation-state.js +192 -0
- package/dist/src/utils/catalog-generation-state.js.map +1 -0
- package/dist/src/utils/catalog-generation-store.d.ts +58 -0
- package/dist/src/utils/catalog-generation-store.js +452 -0
- package/dist/src/utils/catalog-generation-store.js.map +1 -0
- package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
- package/dist/src/utils/{catalog-manifest-v4.js → catalog-manifest-v7.js} +35 -43
- package/dist/src/utils/catalog-manifest-v7.js.map +1 -0
- package/dist/src/utils/catalog-operation-context.d.ts +20 -0
- package/dist/src/utils/catalog-operation-context.js +142 -0
- package/dist/src/utils/catalog-operation-context.js.map +1 -0
- package/dist/src/utils/catalog-public-error.d.ts +7 -3
- package/dist/src/utils/catalog-public-error.js +28 -8
- package/dist/src/utils/catalog-public-error.js.map +1 -1
- package/dist/src/utils/catalog-runtime-projection.d.ts +7 -3
- package/dist/src/utils/catalog-runtime-projection.js +5 -40
- package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
- package/dist/src/utils/catalog-snapshot.d.ts +5 -3
- package/dist/src/utils/catalog-snapshot.js +11 -3
- package/dist/src/utils/catalog-snapshot.js.map +1 -1
- package/dist/src/utils/catalog-source-identity.d.ts +1 -0
- package/dist/src/utils/catalog-source-identity.js +21 -2
- package/dist/src/utils/catalog-source-identity.js.map +1 -1
- package/dist/src/utils/catalog-source-impact.d.ts +21 -0
- package/dist/src/utils/catalog-source-impact.js +344 -0
- package/dist/src/utils/catalog-source-impact.js.map +1 -0
- package/dist/src/utils/catalog-source-references.d.ts +8 -2
- package/dist/src/utils/catalog-source-references.js +200 -367
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/catalog-sources.d.ts +15 -1
- package/dist/src/utils/catalog-sources.js +206 -27
- package/dist/src/utils/catalog-sources.js.map +1 -1
- package/dist/src/utils/claude-native-render-receipt.d.ts +14 -0
- package/dist/src/utils/claude-native-render-receipt.js +26 -0
- package/dist/src/utils/claude-native-render-receipt.js.map +1 -0
- package/dist/src/utils/claude-skills-root.d.ts +8 -0
- package/dist/src/utils/claude-skills-root.js +87 -0
- package/dist/src/utils/claude-skills-root.js.map +1 -0
- package/dist/src/utils/codex-config.d.ts +2 -0
- package/dist/src/utils/codex-config.js +26 -5
- package/dist/src/utils/codex-config.js.map +1 -1
- package/dist/src/utils/codex-executable-discovery.d.ts +26 -0
- package/dist/src/utils/codex-executable-discovery.js +397 -0
- package/dist/src/utils/codex-executable-discovery.js.map +1 -0
- package/dist/src/utils/codex-manager.d.ts +62 -0
- package/dist/src/utils/codex-manager.js +122 -0
- package/dist/src/utils/codex-manager.js.map +1 -0
- package/dist/src/utils/codex-marketplace-path.d.ts +5 -0
- package/dist/src/utils/codex-marketplace-path.js +45 -0
- package/dist/src/utils/codex-marketplace-path.js.map +1 -0
- package/dist/src/utils/codex-native-observation.d.ts +49 -0
- package/dist/src/utils/codex-native-observation.js +169 -0
- package/dist/src/utils/codex-native-observation.js.map +1 -0
- package/dist/src/utils/codex-native-render-receipt.d.ts +40 -0
- package/dist/src/utils/codex-native-render-receipt.js +205 -0
- package/dist/src/utils/codex-native-render-receipt.js.map +1 -0
- package/dist/src/utils/codex-reconciler.d.ts +123 -0
- package/dist/src/utils/codex-reconciler.js +322 -0
- package/dist/src/utils/codex-reconciler.js.map +1 -0
- package/dist/src/utils/codex-shared-native.d.ts +43 -0
- package/dist/src/utils/codex-shared-native.js +81 -0
- package/dist/src/utils/codex-shared-native.js.map +1 -0
- package/dist/src/utils/codex-skill-staging.d.ts +2 -0
- package/dist/src/utils/codex-skill-staging.js.map +1 -1
- package/dist/src/utils/codex-skills-root.d.ts +4 -0
- package/dist/src/utils/codex-skills-root.js +25 -0
- package/dist/src/utils/codex-skills-root.js.map +1 -0
- package/dist/src/utils/codex-surface-analysis.d.ts +46 -0
- package/dist/src/utils/codex-surface-analysis.js +249 -0
- package/dist/src/utils/codex-surface-analysis.js.map +1 -0
- package/dist/src/utils/dynamic-skill-tree.d.ts +5 -0
- package/dist/src/utils/dynamic-skill-tree.js +56 -7
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/git-catalog-provider.d.ts +16 -0
- package/dist/src/utils/git-catalog-provider.js +177 -145
- package/dist/src/utils/git-catalog-provider.js.map +1 -1
- package/dist/src/utils/local-marketplace.d.ts +39 -1
- package/dist/src/utils/local-marketplace.js +601 -84
- package/dist/src/utils/local-marketplace.js.map +1 -1
- package/dist/src/utils/managed-command-closure.d.ts +3 -0
- package/dist/src/utils/managed-command-closure.js +35 -0
- package/dist/src/utils/managed-command-closure.js.map +1 -0
- package/dist/src/utils/managed-command-evidence.d.ts +7 -0
- package/dist/src/utils/managed-command-evidence.js +86 -0
- package/dist/src/utils/managed-command-evidence.js.map +1 -0
- package/dist/src/utils/managed-command-materialization.d.ts +121 -0
- package/dist/src/utils/managed-command-materialization.js +369 -0
- package/dist/src/utils/managed-command-materialization.js.map +1 -0
- package/dist/src/utils/managed-command-runtime.d.ts +33 -0
- package/dist/src/utils/managed-command-runtime.js +121 -0
- package/dist/src/utils/managed-command-runtime.js.map +1 -0
- package/dist/src/utils/managed-command-store.d.ts +143 -0
- package/dist/src/utils/managed-command-store.js +654 -0
- package/dist/src/utils/managed-command-store.js.map +1 -0
- package/dist/src/utils/manifest.d.ts +1 -3
- package/dist/src/utils/manifest.js +1 -3
- package/dist/src/utils/manifest.js.map +1 -1
- package/dist/src/utils/multi-source-catalog.d.ts +3 -9
- package/dist/src/utils/multi-source-catalog.js +54 -110
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +62 -7
- package/dist/src/utils/native-cli.js +449 -58
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/native-demand.d.ts +10 -0
- package/dist/src/utils/native-demand.js +4 -0
- package/dist/src/utils/native-demand.js.map +1 -0
- package/dist/src/utils/native-tool-context.d.ts +14 -0
- package/dist/src/utils/native-tool-context.js +38 -0
- package/dist/src/utils/native-tool-context.js.map +1 -0
- package/dist/src/utils/native-tool-review.d.ts +21 -0
- package/dist/src/utils/native-tool-review.js +102 -0
- package/dist/src/utils/native-tool-review.js.map +1 -0
- package/dist/src/utils/orphan-marketplace-cleanup.js +0 -4
- package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +88 -20
- package/dist/src/utils/ownership.js +187 -223
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/path-catalog-provider.d.ts +1 -1
- package/dist/src/utils/path-catalog-provider.js +54 -65
- package/dist/src/utils/path-catalog-provider.js.map +1 -1
- package/dist/src/utils/paths.d.ts +0 -1
- package/dist/src/utils/paths.js +1 -2
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/platform-support.d.ts +1 -1
- package/dist/src/utils/platform-support.js +1 -1
- package/dist/src/utils/platform-support.js.map +1 -1
- package/dist/src/utils/plugin-config-impact.d.ts +58 -0
- package/dist/src/utils/plugin-config-impact.js +323 -0
- package/dist/src/utils/plugin-config-impact.js.map +1 -0
- package/dist/src/utils/plugin-config-references.d.ts +89 -0
- package/dist/src/utils/plugin-config-references.js +335 -0
- package/dist/src/utils/plugin-config-references.js.map +1 -0
- package/dist/src/utils/plugin-config-write.d.ts +109 -27
- package/dist/src/utils/plugin-config-write.js +1246 -368
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +189 -120
- package/dist/src/utils/plugin-config.js +926 -1270
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-scripts.d.ts +75 -128
- package/dist/src/utils/plugin-scripts.js +556 -525
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/process-lock.js +14 -5
- package/dist/src/utils/process-lock.js.map +1 -1
- package/dist/src/utils/process-tree.d.ts +2 -2
- package/dist/src/utils/process-tree.js +1 -1
- package/dist/src/utils/process-tree.js.map +1 -1
- package/dist/src/utils/project-boundary.d.ts +11 -13
- package/dist/src/utils/project-boundary.js +28 -34
- package/dist/src/utils/project-boundary.js.map +1 -1
- package/dist/src/utils/rendered-contract.js +18 -1
- package/dist/src/utils/rendered-contract.js.map +1 -1
- package/dist/src/utils/runtime-config.d.ts +20 -0
- package/dist/src/utils/runtime-config.js +77 -0
- package/dist/src/utils/runtime-config.js.map +1 -0
- package/dist/src/utils/runtime-skill-closure.d.ts +2 -2
- package/dist/src/utils/runtime-skill-closure.js +47 -6
- package/dist/src/utils/runtime-skill-closure.js.map +1 -1
- package/dist/src/utils/safe-fs.d.ts +21 -0
- package/dist/src/utils/safe-fs.js +111 -0
- package/dist/src/utils/safe-fs.js.map +1 -0
- package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
- package/dist/src/utils/safe-operation-diagnostic.js +33 -0
- package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
- package/dist/src/utils/sensitive-content.d.ts +4 -0
- package/dist/src/utils/sensitive-content.js +36 -0
- package/dist/src/utils/sensitive-content.js.map +1 -0
- package/dist/src/utils/state-paths.d.ts +8 -3
- package/dist/src/utils/state-paths.js +51 -9
- package/dist/src/utils/state-paths.js.map +1 -1
- package/dist/src/utils/target-eligibility.d.ts +8 -2
- package/dist/src/utils/target-eligibility.js +17 -8
- package/dist/src/utils/target-eligibility.js.map +1 -1
- package/dist/src/utils/windows-claude-shim.d.ts +7 -0
- package/dist/src/utils/windows-claude-shim.js +10 -0
- package/dist/src/utils/windows-claude-shim.js.map +1 -0
- package/dist/src/utils/windows-npm-shim.d.ts +16 -0
- package/dist/src/utils/windows-npm-shim.js +138 -0
- package/dist/src/utils/windows-npm-shim.js.map +1 -0
- package/dist/vitest.config.js +101 -9
- package/dist/vitest.config.js.map +1 -1
- package/package.json +31 -21
- package/dist/authoring/scripts/check-plugin-versions.d.mts +0 -2
- package/dist/authoring/scripts/check-plugin-versions.mjs +0 -5
- package/dist/authoring/scripts/check-plugin-versions.mjs.map +0 -1
- package/dist/scripts/aw-skill-eval-engine.d.ts +0 -13
- package/dist/scripts/aw-skill-eval-engine.js +0 -31
- package/dist/scripts/aw-skill-eval-engine.js.map +0 -1
- package/dist/scripts/codex-eval-app-server.d.ts +0 -89
- package/dist/scripts/codex-eval-app-server.js +0 -1228
- package/dist/scripts/codex-eval-app-server.js.map +0 -1
- package/dist/scripts/codex-eval-isolation.d.ts +0 -61
- package/dist/scripts/codex-eval-isolation.js +0 -318
- package/dist/scripts/codex-eval-isolation.js.map +0 -1
- package/dist/scripts/codex-eval-process-management.d.ts +0 -8
- package/dist/scripts/codex-eval-process-management.js +0 -69
- package/dist/scripts/codex-eval-process-management.js.map +0 -1
- package/dist/scripts/codex-eval-process-tree.d.ts +0 -38
- package/dist/scripts/codex-eval-process-tree.js +0 -803
- package/dist/scripts/codex-eval-process-tree.js.map +0 -1
- package/dist/scripts/codex-eval-runtime-config.d.ts +0 -62
- package/dist/scripts/codex-eval-runtime-config.js +0 -843
- package/dist/scripts/codex-eval-runtime-config.js.map +0 -1
- package/dist/scripts/codex-trigger-eval.d.ts +0 -84
- package/dist/scripts/codex-trigger-eval.js +0 -968
- package/dist/scripts/codex-trigger-eval.js.map +0 -1
- package/dist/scripts/eval-plugin-skills-audited.d.ts +0 -6
- package/dist/scripts/eval-plugin-skills-audited.js +0 -261
- package/dist/scripts/eval-plugin-skills-audited.js.map +0 -1
- package/dist/scripts/eval-plugin-skills.d.ts +0 -45
- package/dist/scripts/eval-plugin-skills.js +0 -1586
- package/dist/scripts/eval-plugin-skills.js.map +0 -1
- package/dist/scripts/eval-run-layout.d.ts +0 -17
- package/dist/scripts/eval-run-layout.js +0 -26
- package/dist/scripts/eval-run-layout.js.map +0 -1
- package/dist/scripts/plugin-eval-contract.d.ts +0 -185
- package/dist/scripts/plugin-eval-contract.js +0 -695
- package/dist/scripts/plugin-eval-contract.js.map +0 -1
- package/dist/scripts/plugin-eval-materializer.d.ts +0 -13
- package/dist/scripts/plugin-eval-materializer.js +0 -421
- package/dist/scripts/plugin-eval-materializer.js.map +0 -1
- package/dist/scripts/skill-reporting.d.ts +0 -212
- package/dist/scripts/skill-reporting.js +0 -922
- package/dist/scripts/skill-reporting.js.map +0 -1
- package/dist/src/commands/review-publication.d.ts +0 -99
- package/dist/src/commands/review-publication.js +0 -904
- package/dist/src/commands/review-publication.js.map +0 -1
- package/dist/src/commands/status-v4.d.ts +0 -123
- package/dist/src/commands/status-v4.js +0 -905
- package/dist/src/commands/status-v4.js.map +0 -1
- package/dist/src/commands/status.d.ts +0 -93
- package/dist/src/commands/status.js +0 -442
- package/dist/src/commands/status.js.map +0 -1
- package/dist/src/portable/skills-cli.d.ts +0 -43
- package/dist/src/portable/skills-cli.js +0 -148
- package/dist/src/portable/skills-cli.js.map +0 -1
- package/dist/src/utils/active-marketplace-runtime-lock.d.ts +0 -12
- package/dist/src/utils/active-marketplace-runtime-lock.js +0 -133
- package/dist/src/utils/active-marketplace-runtime-lock.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v3.d.ts +0 -2
- package/dist/src/utils/catalog-manifest-v3.js +0 -3
- package/dist/src/utils/catalog-manifest-v3.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v4.d.ts +0 -5
- package/dist/src/utils/catalog-manifest-v4.js.map +0 -1
- package/dist/src/utils/catalog-source-cache.d.ts +0 -62
- package/dist/src/utils/catalog-source-cache.js +0 -296
- package/dist/src/utils/catalog-source-cache.js.map +0 -1
- package/dist/src/utils/codex-project-surface.d.ts +0 -3
- package/dist/src/utils/codex-project-surface.js +0 -49
- package/dist/src/utils/codex-project-surface.js.map +0 -1
- package/dist/src/utils/lifecycle-active-store.d.ts +0 -175
- package/dist/src/utils/lifecycle-active-store.js +0 -1276
- package/dist/src/utils/lifecycle-active-store.js.map +0 -1
- package/dist/src/utils/plugin-release.d.ts +0 -2
- package/dist/src/utils/plugin-release.js +0 -2
- package/dist/src/utils/plugin-release.js.map +0 -1
|
@@ -6,7 +6,8 @@ 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 { getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, } from '@lesliechan721/aw-plugin-core/manifest';
|
|
9
|
+
import { assertPluginConfigReferenceSchemas, AW_RUNTIME_CONFIG_READER_PATH, createNativeToolReaderSource, createRuntimeConfigSnapshot, getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, getManagedCommandArtifactTargets, normalizePluginConfigDefinition, compilePluginConfigDefinition, resolveSupportedPlatforms, PLATFORM_TARGETS, isPortablePlatformTarget, SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION, parseManagedCommandPlaceholders, replaceManagedCommandPlaceholders, validateCommandEntryFiles, validatePluginConfigCandidate, formatPluginConfigIssue, } from '@lesliechan721/aw-plugin-core/manifest';
|
|
10
|
+
import { readCatalogWorkspace } from '@lesliechan721/aw-plugin-core';
|
|
10
11
|
import { checkPluginVersions } from './lib/plugin-version-check.mjs';
|
|
11
12
|
import { scanJavaScriptImportSpecifiers } from './lib/javascript-import-scanner.mjs';
|
|
12
13
|
import { assertAuthoringPluginPathFence, assertCanonicalAuthoringPluginRoot, } from './lib/plugin-root.mjs';
|
|
@@ -18,7 +19,7 @@ const CLI_PACKAGE_ROOT = path.basename(authoringRuntimeRoot) === 'dist'
|
|
|
18
19
|
: authoringRuntimeRoot;
|
|
19
20
|
const errors = [];
|
|
20
21
|
const warnings = [];
|
|
21
|
-
|
|
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,7 +51,7 @@ const CODEX_POLICY_PRODUCTS = new Set([
|
|
|
50
51
|
'codex',
|
|
51
52
|
'CODEX',
|
|
52
53
|
]);
|
|
53
|
-
const
|
|
54
|
+
const MANIFEST_PLATFORMS = new Set(getPluginAuthoringAcceptedValues('manifest', 'platforms'));
|
|
54
55
|
const MARKETPLACE_AUTHENTICATION_POLICIES = new Set(getPluginAuthoringAcceptedValues('manifest', 'marketplace.policy.authentication'));
|
|
55
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']);
|
|
@@ -124,47 +125,12 @@ 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 =
|
|
133
|
-
const CONFIG_FIELD_TYPES = new Set(getPluginAuthoringAcceptedValues('config', 'config.schema.<key>.type'));
|
|
134
|
-
const ARTIFACT_TARGETS = new Set(getPluginAuthoringAcceptedValues('artifacts', 'artifacts.targets[].target'));
|
|
135
|
-
const ARTIFACT_STATES = new Set(getPluginAuthoringAcceptedValues('artifacts', 'artifacts.targets[].states'));
|
|
136
|
-
const ARTIFACT_SCOPES = new Set(['user', 'project']);
|
|
137
|
-
const ARTIFACT_KINDS = new Set(['instruction', 'codexRole', 'skill']);
|
|
138
|
-
const ARTIFACT_PROJECT_MANAGED_KINDS = new Set(['instruction', 'agent', 'skill']);
|
|
139
|
-
const ARTIFACT_KIND_BY_TARGET = {
|
|
140
|
-
'codex.developerInstructionsBlock': 'instruction',
|
|
141
|
-
'codex.agentRole': 'codexRole',
|
|
142
|
-
'codex.skill': 'skill',
|
|
143
|
-
'claude.skill': 'skill',
|
|
144
|
-
'agent-skills.skill': 'skill',
|
|
145
|
-
};
|
|
146
|
-
const ARTIFACT_PROJECT_MANAGED_KIND_BY_TARGET = {
|
|
147
|
-
'codex.developerInstructionsBlock': 'instruction',
|
|
148
|
-
'codex.agentRole': 'agent',
|
|
149
|
-
'codex.skill': 'skill',
|
|
150
|
-
};
|
|
129
|
+
const SCRIPT_TIMEOUT_MAX_MS = 1800000;
|
|
151
130
|
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
131
|
let yamlParser = null;
|
|
167
132
|
let pluginVersionCheckResult = null;
|
|
133
|
+
let skillEvalManifestTools = null;
|
|
168
134
|
function error(msg) {
|
|
169
135
|
errors.push(msg);
|
|
170
136
|
}
|
|
@@ -331,23 +297,42 @@ function loadSkillFrontmatterCapabilityRegistry() {
|
|
|
331
297
|
async function tryLoadCliManifestTools() {
|
|
332
298
|
const manifestModulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'manifest.js');
|
|
333
299
|
const runtimeProjectionModulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'catalog-runtime-projection.js');
|
|
334
|
-
|
|
300
|
+
const capabilityModulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'commands', 'aw-capabilities.js');
|
|
301
|
+
const artifactPlanPath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'artifact-plan.js');
|
|
302
|
+
const artifactRequestPath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'artifact-request.js');
|
|
303
|
+
const commandMaterializationPath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'managed-command-materialization.js');
|
|
304
|
+
if (!fs.existsSync(manifestModulePath)
|
|
305
|
+
|| !fs.existsSync(runtimeProjectionModulePath)
|
|
306
|
+
|| !fs.existsSync(capabilityModulePath))
|
|
335
307
|
return null;
|
|
336
308
|
try {
|
|
337
|
-
const [manifestModule, runtimeProjectionModule] = await Promise.all([
|
|
309
|
+
const [manifestModule, runtimeProjectionModule, capabilityModule, artifactPlanModule, artifactRequestModule, commandModule] = await Promise.all([
|
|
338
310
|
import(pathToFileURL(manifestModulePath).href),
|
|
339
311
|
import(pathToFileURL(runtimeProjectionModulePath).href),
|
|
312
|
+
import(pathToFileURL(capabilityModulePath).href),
|
|
313
|
+
import(pathToFileURL(artifactPlanPath).href),
|
|
314
|
+
import(pathToFileURL(artifactRequestPath).href),
|
|
315
|
+
import(pathToFileURL(commandMaterializationPath).href),
|
|
340
316
|
]);
|
|
341
317
|
if (manifestModule.SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION
|
|
342
|
-
!== SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION
|
|
318
|
+
!== SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION
|
|
319
|
+
|| typeof artifactRequestModule.requiresNonSensitiveArtifactInput !== 'function') {
|
|
343
320
|
return null;
|
|
344
321
|
}
|
|
345
322
|
return {
|
|
346
323
|
assertPluginInputTree: manifestModule.assertPluginInputTree ?? null,
|
|
347
324
|
validateSourcePluginManifest: manifestModule.validateSourcePluginManifest ?? null,
|
|
325
|
+
reservedImports: manifestModule.CLI_RESERVED_IMPORTS,
|
|
348
326
|
readPluginManifest: manifestModule.readPluginManifest ?? null,
|
|
349
327
|
discoverPlugins: manifestModule.discoverPlugins ?? null,
|
|
328
|
+
resolvePluginRequirements: manifestModule.resolvePluginRequirements ?? null,
|
|
329
|
+
implementedCapabilities: capabilityModule.IMPLEMENTED_AW_CAPABILITIES ?? null,
|
|
350
330
|
createRuntimeResolver: runtimeProjectionModule.createCatalogRuntimeImportResolver ?? null,
|
|
331
|
+
validateArtifactPlan: artifactPlanModule.validateArtifactPlan,
|
|
332
|
+
requiresNonSensitiveArtifactInput: artifactRequestModule.requiresNonSensitiveArtifactInput,
|
|
333
|
+
prepareManagedCommandPackageFiles: commandModule.prepareManagedCommandPackageFiles,
|
|
334
|
+
managedCommandProducerIdentity: commandModule.managedCommandProducerIdentity,
|
|
335
|
+
createManagedCommandReferenceResolver: commandModule.createManagedCommandReferenceResolver,
|
|
351
336
|
};
|
|
352
337
|
}
|
|
353
338
|
catch {
|
|
@@ -490,165 +475,11 @@ function validateStrictSemVerString(value, fieldName) {
|
|
|
490
475
|
}
|
|
491
476
|
return value;
|
|
492
477
|
}
|
|
493
|
-
function validateManifestLightweight(manifest) {
|
|
494
|
-
const input = expectRecord(manifest, 'plugin manifest');
|
|
495
|
-
if (!input)
|
|
496
|
-
return;
|
|
497
|
-
if (Object.prototype.hasOwnProperty.call(input, 'commands')) {
|
|
498
|
-
error('top-level "commands" has been removed; use "slashCommands" instead');
|
|
499
|
-
}
|
|
500
|
-
validateAllowedKeys(input, 'plugin manifest', [
|
|
501
|
-
'name',
|
|
502
|
-
'version',
|
|
503
|
-
'description',
|
|
504
|
-
'dependencies',
|
|
505
|
-
'compatibility',
|
|
506
|
-
'skills',
|
|
507
|
-
'slashCommands',
|
|
508
|
-
'mcpServers',
|
|
509
|
-
'apps',
|
|
510
|
-
'distributions',
|
|
511
|
-
'marketplace',
|
|
512
|
-
'interface',
|
|
513
|
-
'extensions',
|
|
514
|
-
'buildConfig',
|
|
515
|
-
'scripts',
|
|
516
|
-
'config',
|
|
517
|
-
'artifacts',
|
|
518
|
-
]);
|
|
519
|
-
if (manifest.dependencies !== undefined) {
|
|
520
|
-
if (!Array.isArray(manifest.dependencies)) {
|
|
521
|
-
error('dependencies must be an array');
|
|
522
|
-
}
|
|
523
|
-
else if (manifest.dependencies.length > 64) {
|
|
524
|
-
error('dependencies must contain at most 64 direct plugin dependencies');
|
|
525
|
-
}
|
|
526
|
-
else {
|
|
527
|
-
const seen = new Set();
|
|
528
|
-
for (const [index, dependency] of manifest.dependencies.entries()) {
|
|
529
|
-
if (typeof dependency !== 'string' || !PLUGIN_NAME_PATTERN.test(dependency)) {
|
|
530
|
-
error(`dependencies[${index}] must be an ASCII lowercase hyphen-case plugin name`);
|
|
531
|
-
continue;
|
|
532
|
-
}
|
|
533
|
-
if (dependency === manifest.name) {
|
|
534
|
-
error(`plugin "${manifest.name}" cannot depend on itself`);
|
|
535
|
-
}
|
|
536
|
-
if (seen.has(dependency)) {
|
|
537
|
-
error(`dependencies contains duplicate plugin "${dependency}"`);
|
|
538
|
-
}
|
|
539
|
-
seen.add(dependency);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
for (const field of ['name', 'version', 'description', 'marketplace']) {
|
|
544
|
-
if (!manifest[field]) {
|
|
545
|
-
error(`Missing required field: ${field}`);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
if (manifest.name && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(manifest.name)) {
|
|
549
|
-
error(`manifest name "${manifest.name}" is not lowercase-hyphen-case`);
|
|
550
|
-
}
|
|
551
|
-
if (manifest.version) {
|
|
552
|
-
const pluginVersion = parseStrictSemVer(manifest.version);
|
|
553
|
-
if (!pluginVersion) {
|
|
554
|
-
error(`manifest.version must be a strict SemVer 2.0.0 string, got "${manifest.version}"`);
|
|
555
|
-
}
|
|
556
|
-
else if (pluginVersion.prerelease.length > 0 || pluginVersion.build.length > 0) {
|
|
557
|
-
error('manifest.version must be a stable SemVer without prerelease or build metadata');
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
if (manifest.marketplace) {
|
|
561
|
-
const mp = manifest.marketplace;
|
|
562
|
-
if (!mp.category)
|
|
563
|
-
error('marketplace.category is required');
|
|
564
|
-
if (typeof mp.strict !== 'boolean')
|
|
565
|
-
error('marketplace.strict must be a boolean');
|
|
566
|
-
if (!mp.policy || !mp.policy.installation)
|
|
567
|
-
error('marketplace.policy.installation is required');
|
|
568
|
-
else if (!MARKETPLACE_INSTALLATION_POLICIES.has(mp.policy.installation))
|
|
569
|
-
error(`marketplace.policy.installation must be one of ${[...MARKETPLACE_INSTALLATION_POLICIES].map((value) => JSON.stringify(value)).join(', ')}`);
|
|
570
|
-
if (!mp.policy || !mp.policy.authentication)
|
|
571
|
-
error('marketplace.policy.authentication is required');
|
|
572
|
-
else if (!MARKETPLACE_AUTHENTICATION_POLICIES.has(mp.policy.authentication))
|
|
573
|
-
error('marketplace.policy.authentication must be "ON_INSTALL" or "ON_USE"');
|
|
574
|
-
validateManifestPolicyProducts(mp.policy?.products);
|
|
575
|
-
}
|
|
576
|
-
for (const field of ['skills', 'slashCommands', 'mcpServers', 'apps']) {
|
|
577
|
-
if (manifest[field] && !manifest[field].startsWith('./')) {
|
|
578
|
-
error(`${field} path must start with "./", got "${manifest[field]}"`);
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
const claudeCommands = manifest.buildConfig?.manifestOverrides?.claude?.commands;
|
|
582
|
-
if (claudeCommands !== undefined) {
|
|
583
|
-
error('buildConfig.manifestOverrides.claude.commands has been removed; use "slashCommands" instead');
|
|
584
|
-
}
|
|
585
|
-
for (const platform of ['claude', 'codex']) {
|
|
586
|
-
const rules = manifest.buildConfig?.fileRules?.[platform];
|
|
587
|
-
if (!rules)
|
|
588
|
-
continue;
|
|
589
|
-
for (const pattern of [...(rules.include ?? []), ...(rules.exclude ?? [])]) {
|
|
590
|
-
const normalized = String(pattern).replace(/\\/g, '/').replace(/^\.\//, '');
|
|
591
|
-
if (normalized === 'commands' || normalized.startsWith('commands/')) {
|
|
592
|
-
error(`buildConfig.fileRules.${platform} no longer accepts legacy "commands/**" source rules; use "slashCommands" instead`);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
validateExtensionsLightweight(manifest.extensions);
|
|
597
|
-
validatePlatformFieldSupport(manifest);
|
|
598
|
-
}
|
|
599
|
-
function validatePortableNativeArtifactCapabilityLightweight(manifest) {
|
|
600
|
-
if (manifest.distributions?.agentSkills === undefined)
|
|
601
|
-
return;
|
|
602
|
-
const hasOtherNativeDeclaration = Boolean(manifest.skills
|
|
603
|
-
|| manifest.slashCommands
|
|
604
|
-
|| manifest.mcpServers
|
|
605
|
-
|| manifest.apps
|
|
606
|
-
|| (manifest.extensions?.instructions?.length ?? 0) > 0
|
|
607
|
-
|| (manifest.extensions?.permissions?.length ?? 0) > 0
|
|
608
|
-
|| (manifest.extensions?.hooks?.length ?? 0) > 0
|
|
609
|
-
|| (manifest.extensions?.nativeHooks?.claude?.length ?? 0) > 0
|
|
610
|
-
|| (manifest.extensions?.nativeHooks?.codex?.length ?? 0) > 0
|
|
611
|
-
|| (manifest.extensions?.agents?.length ?? 0) > 0);
|
|
612
|
-
const hasPresentNativeArtifact = (manifest.artifacts?.targets ?? []).some((target) => (target?.platform === 'claude' || target?.platform === 'codex')
|
|
613
|
-
&& Array.isArray(target.states)
|
|
614
|
-
&& target.states.includes('present'));
|
|
615
|
-
if (!hasOtherNativeDeclaration && !hasPresentNativeArtifact) {
|
|
616
|
-
const message = 'Invalid plugin manifest: portable-only plugins are not supported in V1. Declare at least one non-empty native capability.';
|
|
617
|
-
if (!errors.includes(message))
|
|
618
|
-
error(message);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
function normalizeManifestProductToken(value) {
|
|
622
|
-
return String(value).trim().toUpperCase().replace(/[\s-]+/g, '_');
|
|
623
|
-
}
|
|
624
|
-
function resolveSupportedPlatforms(manifest) {
|
|
625
|
-
const products = manifest.marketplace?.policy?.products;
|
|
626
|
-
if (!Array.isArray(products) || products.length === 0) {
|
|
627
|
-
return new Set(['claude', 'codex']);
|
|
628
|
-
}
|
|
629
|
-
const supported = new Set();
|
|
630
|
-
for (const product of products) {
|
|
631
|
-
const normalized = normalizeManifestProductToken(product);
|
|
632
|
-
if (normalized === 'CLAUDE')
|
|
633
|
-
supported.add('claude');
|
|
634
|
-
if (normalized === 'CODEX')
|
|
635
|
-
supported.add('codex');
|
|
636
|
-
}
|
|
637
|
-
return supported;
|
|
638
|
-
}
|
|
639
478
|
function supportsManifestPlatform(manifest, platform) {
|
|
640
479
|
return resolveSupportedPlatforms(manifest).has(platform);
|
|
641
480
|
}
|
|
642
|
-
function
|
|
643
|
-
|
|
644
|
-
if (!Array.isArray(products) || products.length === 0) {
|
|
645
|
-
return 'marketplace.policy.products=[]';
|
|
646
|
-
}
|
|
647
|
-
const normalized = [...new Set(products.map(normalizeManifestProductToken))];
|
|
648
|
-
return `marketplace.policy.products=[${normalized.join(', ')}]`;
|
|
649
|
-
}
|
|
650
|
-
function platformProductName(platform) {
|
|
651
|
-
return platform === 'claude' ? 'CLAUDE' : 'CODEX';
|
|
481
|
+
function formatManifestPlatformsForError(manifest) {
|
|
482
|
+
return `platforms=[${[...resolveSupportedPlatforms(manifest)].join(', ')}]`;
|
|
652
483
|
}
|
|
653
484
|
function pluginNameForError(manifest) {
|
|
654
485
|
return typeof manifest.name === 'string' && manifest.name.trim()
|
|
@@ -658,30 +489,11 @@ function pluginNameForError(manifest) {
|
|
|
658
489
|
function assertPlatformFieldSupported(manifest, fieldPath, requiredPlatform) {
|
|
659
490
|
if (supportsManifestPlatform(manifest, requiredPlatform))
|
|
660
491
|
return;
|
|
661
|
-
error(`Invalid plugin "${pluginNameForError(manifest)}": ${fieldPath} requires ${
|
|
492
|
+
error(`Invalid plugin "${pluginNameForError(manifest)}": ${fieldPath} requires ${requiredPlatform} support, but ${formatManifestPlatformsForError(manifest)}.`);
|
|
662
493
|
}
|
|
663
494
|
function hasNonEmptyOverride(value) {
|
|
664
495
|
return isRecord(value) && Object.keys(value).length > 0;
|
|
665
496
|
}
|
|
666
|
-
function validateManifestPolicyProducts(products) {
|
|
667
|
-
if (products === undefined)
|
|
668
|
-
return;
|
|
669
|
-
if (!Array.isArray(products)) {
|
|
670
|
-
error('marketplace.policy.products must be an array');
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
for (const [index, product] of products.entries()) {
|
|
674
|
-
const fieldName = `marketplace.policy.products[${index}]`;
|
|
675
|
-
if (typeof product !== 'string' || product.trim() === '') {
|
|
676
|
-
error(`${fieldName} must be a non-empty string`);
|
|
677
|
-
continue;
|
|
678
|
-
}
|
|
679
|
-
const normalized = normalizeManifestProductToken(product);
|
|
680
|
-
if (!MANIFEST_POLICY_PRODUCTS.has(normalized)) {
|
|
681
|
-
error(`${fieldName} must be one of "CODEX" or "CLAUDE"`);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
497
|
function validatePlatformFieldSupport(manifest) {
|
|
686
498
|
if (manifest.buildConfig?.fileRules?.claude !== undefined) {
|
|
687
499
|
assertPlatformFieldSupported(manifest, 'buildConfig.fileRules.claude', 'claude');
|
|
@@ -950,703 +762,19 @@ function validateNonEmptyString(value, fieldName, maxLength) {
|
|
|
950
762
|
}
|
|
951
763
|
return trimmed;
|
|
952
764
|
}
|
|
953
|
-
function
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
!path.isAbsolute(relative));
|
|
958
|
-
}
|
|
959
|
-
function validateRealPathBoundary(boundary, candidate, fieldName, boundaryName) {
|
|
960
|
-
const canonicalBoundary = fs.realpathSync(boundary);
|
|
961
|
-
const canonicalCandidate = fs.realpathSync(candidate);
|
|
962
|
-
if (!isPathInsideOrEqual(canonicalBoundary, canonicalCandidate)) {
|
|
963
|
-
error(`${fieldName} must stay inside the ${boundaryName}`);
|
|
964
|
-
return false;
|
|
965
|
-
}
|
|
966
|
-
return true;
|
|
967
|
-
}
|
|
968
|
-
function validateEvalRelativeFile(evalDir, value, fieldName) {
|
|
969
|
-
const relativePath = validateNonEmptyString(value, fieldName);
|
|
970
|
-
if (!relativePath)
|
|
971
|
-
return null;
|
|
972
|
-
const normalized = stripDotSlash(relativePath).split('\\').join('/');
|
|
973
|
-
if (path.isAbsolute(normalized) || normalized.split('/').includes('..')) {
|
|
974
|
-
error(`${fieldName} must stay inside the Skill eval directory`);
|
|
975
|
-
return null;
|
|
976
|
-
}
|
|
977
|
-
const absolutePath = path.resolve(evalDir, normalized);
|
|
978
|
-
const relativeToRoot = path.relative(evalDir, absolutePath);
|
|
979
|
-
if (relativeToRoot.startsWith('..') || path.isAbsolute(relativeToRoot)) {
|
|
980
|
-
error(`${fieldName} must stay inside the Skill eval directory`);
|
|
981
|
-
return null;
|
|
982
|
-
}
|
|
983
|
-
if (!fs.existsSync(absolutePath) || !fs.statSync(absolutePath).isFile()) {
|
|
984
|
-
error(`${fieldName} does not exist: ${normalized}`);
|
|
985
|
-
return null;
|
|
986
|
-
}
|
|
987
|
-
if (!validateRealPathBoundary(evalDir, absolutePath, fieldName, 'Skill eval directory')) {
|
|
988
|
-
return null;
|
|
989
|
-
}
|
|
990
|
-
return absolutePath;
|
|
991
|
-
}
|
|
992
|
-
function validateEvalWorkspacePath(value, fieldName, options = {}) {
|
|
993
|
-
const raw = validateNonEmptyString(value, fieldName);
|
|
994
|
-
if (!raw)
|
|
995
|
-
return null;
|
|
996
|
-
const treePattern = options.allowTreePattern === true && raw.endsWith('/**');
|
|
997
|
-
const candidate = treePattern ? raw.slice(0, -3) : raw;
|
|
998
|
-
if (candidate === '' ||
|
|
999
|
-
candidate.includes('\0') ||
|
|
1000
|
-
candidate.includes('\\') ||
|
|
1001
|
-
candidate.includes('*') ||
|
|
1002
|
-
candidate.includes('?') ||
|
|
1003
|
-
candidate.includes('[') ||
|
|
1004
|
-
candidate.includes(']') ||
|
|
1005
|
-
path.isAbsolute(candidate) ||
|
|
1006
|
-
path.posix.normalize(candidate) !== candidate ||
|
|
1007
|
-
candidate.split('/').includes('..')) {
|
|
1008
|
-
error(`${fieldName} must be a normalized POSIX path inside the eval workspace`);
|
|
1009
|
-
return null;
|
|
1010
|
-
}
|
|
1011
|
-
const firstSegment = candidate.split('/')[0];
|
|
1012
|
-
if (firstSegment === '.git' || firstSegment === '.agents' || firstSegment === '.codex') {
|
|
1013
|
-
error(`${fieldName} must not target an eval control directory`);
|
|
1014
|
-
return null;
|
|
1015
|
-
}
|
|
1016
|
-
return raw;
|
|
1017
|
-
}
|
|
1018
|
-
function evalWorkspacePathMatchesPattern(relativePath, pattern) {
|
|
1019
|
-
if (pattern.endsWith('/**')) {
|
|
1020
|
-
const prefix = pattern.slice(0, -3);
|
|
1021
|
-
return relativePath === prefix || relativePath.startsWith(`${prefix}/`);
|
|
1022
|
-
}
|
|
1023
|
-
return relativePath === pattern;
|
|
1024
|
-
}
|
|
1025
|
-
function validateConversationCaseCorpus(evalDir, suite, fieldName) {
|
|
1026
|
-
const casesPath = validateEvalRelativeFile(evalDir, suite.cases, `${fieldName}.cases`);
|
|
1027
|
-
if (!casesPath)
|
|
1028
|
-
return;
|
|
1029
|
-
let document;
|
|
765
|
+
async function loadSkillEvalManifestTools() {
|
|
766
|
+
if (skillEvalManifestTools)
|
|
767
|
+
return skillEvalManifestTools;
|
|
768
|
+
const modulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'eval', 'manifest-v1.js');
|
|
1030
769
|
try {
|
|
1031
|
-
|
|
770
|
+
skillEvalManifestTools = await import(pathToFileURL(modulePath).href);
|
|
771
|
+
return skillEvalManifestTools;
|
|
1032
772
|
}
|
|
1033
|
-
catch
|
|
1034
|
-
error(`${fieldName}.cases is not valid JSON: ${e.message}`);
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
const corpus = expectRecord(document, `${fieldName}.cases document`);
|
|
1038
|
-
if (!corpus)
|
|
1039
|
-
return;
|
|
1040
|
-
const skillName = validateNonEmptyString(corpus.skill_name, `${fieldName}.cases.skill_name`);
|
|
1041
|
-
if (skillName && skillName !== suite.skill) {
|
|
1042
|
-
error(`${fieldName}.cases.skill_name must match ${JSON.stringify(suite.skill)}`);
|
|
1043
|
-
}
|
|
1044
|
-
if (!Array.isArray(corpus.evals) || corpus.evals.length === 0) {
|
|
1045
|
-
error(`${fieldName}.cases.evals must be a non-empty array`);
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
|
-
const ids = new Set();
|
|
1049
|
-
corpus.evals.forEach((value, caseIndex) => {
|
|
1050
|
-
const caseField = `${fieldName}.cases.evals[${caseIndex}]`;
|
|
1051
|
-
const entry = expectRecord(value, caseField);
|
|
1052
|
-
if (!entry)
|
|
1053
|
-
return;
|
|
1054
|
-
const id = validateNonEmptyString(entry.id, `${caseField}.id`);
|
|
1055
|
-
if (id && ids.has(id)) {
|
|
1056
|
-
error(`${fieldName}.cases has duplicate case id ${JSON.stringify(id)}`);
|
|
1057
|
-
}
|
|
1058
|
-
else if (id) {
|
|
1059
|
-
ids.add(id);
|
|
1060
|
-
}
|
|
1061
|
-
validateNonEmptyString(entry.prompt, `${caseField}.prompt`);
|
|
1062
|
-
const sandbox = entry.sandbox === undefined
|
|
1063
|
-
? 'read-only'
|
|
1064
|
-
: validateNonEmptyString(entry.sandbox, `${caseField}.sandbox`);
|
|
1065
|
-
if (sandbox && sandbox !== 'read-only' && sandbox !== 'workspace-write') {
|
|
1066
|
-
error(`${caseField}.sandbox must be "read-only" or "workspace-write"`);
|
|
1067
|
-
}
|
|
1068
|
-
if (!Array.isArray(entry.scripted_replies)) {
|
|
1069
|
-
error(`${caseField}.scripted_replies must be an array`);
|
|
1070
|
-
}
|
|
1071
|
-
else {
|
|
1072
|
-
entry.scripted_replies.forEach((reply, replyIndex) => {
|
|
1073
|
-
const replyField = `${caseField}.scripted_replies[${replyIndex}]`;
|
|
1074
|
-
if (typeof reply === 'string')
|
|
1075
|
-
return;
|
|
1076
|
-
const replyEntry = expectRecord(reply, replyField);
|
|
1077
|
-
if (!replyEntry)
|
|
1078
|
-
return;
|
|
1079
|
-
if (!Array.isArray(replyEntry.answers_by_index) || replyEntry.answers_by_index.some((answer) => typeof answer !== 'string')) {
|
|
1080
|
-
error(`${replyField}.answers_by_index must be an array of strings`);
|
|
1081
|
-
}
|
|
1082
|
-
if (replyEntry.expected_question_count !== undefined &&
|
|
1083
|
-
(!Number.isInteger(replyEntry.expected_question_count) ||
|
|
1084
|
-
replyEntry.expected_question_count < 0)) {
|
|
1085
|
-
error(`${replyField}.expected_question_count must be a non-negative integer`);
|
|
1086
|
-
}
|
|
1087
|
-
validateNonEmptyString(replyEntry.unexpected_question_answer, `${replyField}.unexpected_question_answer`);
|
|
1088
|
-
});
|
|
1089
|
-
}
|
|
1090
|
-
validateNonEmptyString(entry.expected_output, `${caseField}.expected_output`);
|
|
1091
|
-
if (entry.workspace_files !== undefined) {
|
|
1092
|
-
const workspaceFiles = expectRecord(entry.workspace_files, `${caseField}.workspace_files`);
|
|
1093
|
-
if (workspaceFiles) {
|
|
1094
|
-
const workspaceFileEntries = Object.entries(workspaceFiles);
|
|
1095
|
-
if (workspaceFileEntries.length === 0) {
|
|
1096
|
-
error(`${caseField}.workspace_files must contain at least one file`);
|
|
1097
|
-
}
|
|
1098
|
-
workspaceFileEntries.forEach(([relativePath, content]) => {
|
|
1099
|
-
validateEvalWorkspacePath(relativePath, `${caseField}.workspace_files.${relativePath}`, { allowTreePattern: false });
|
|
1100
|
-
validateNonEmptyString(content, `${caseField}.workspace_files.${relativePath}`);
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
const review = expectRecord(entry.review, `${caseField}.review`);
|
|
1105
|
-
if (review) {
|
|
1106
|
-
if (!Array.isArray(review.checks) || review.checks.length === 0 || review.checks.some((check) => typeof check !== 'string' || check.trim() === '')) {
|
|
1107
|
-
error(`${caseField}.review.checks must be a non-empty array of strings`);
|
|
1108
|
-
}
|
|
1109
|
-
if (review.workspace_unchanged !== undefined &&
|
|
1110
|
-
typeof review.workspace_unchanged !== 'boolean') {
|
|
1111
|
-
error(`${caseField}.review.workspace_unchanged must be boolean`);
|
|
1112
|
-
}
|
|
1113
|
-
const allowedWorkspaceChanges = [];
|
|
1114
|
-
if (review.allowed_workspace_changes !== undefined) {
|
|
1115
|
-
if (!Array.isArray(review.allowed_workspace_changes) ||
|
|
1116
|
-
review.allowed_workspace_changes.length === 0) {
|
|
1117
|
-
error(`${caseField}.review.allowed_workspace_changes must be a non-empty array`);
|
|
1118
|
-
}
|
|
1119
|
-
else {
|
|
1120
|
-
review.allowed_workspace_changes.forEach((pathValue, pathIndex) => {
|
|
1121
|
-
const normalized = validateEvalWorkspacePath(pathValue, `${caseField}.review.allowed_workspace_changes[${pathIndex}]`, { allowTreePattern: true });
|
|
1122
|
-
if (normalized)
|
|
1123
|
-
allowedWorkspaceChanges.push(normalized);
|
|
1124
|
-
});
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
const artifactPaths = [];
|
|
1128
|
-
if (review.artifacts !== undefined) {
|
|
1129
|
-
if (!Array.isArray(review.artifacts) || review.artifacts.length === 0) {
|
|
1130
|
-
error(`${caseField}.review.artifacts must be a non-empty array`);
|
|
1131
|
-
}
|
|
1132
|
-
else {
|
|
1133
|
-
review.artifacts.forEach((artifactValue, artifactIndex) => {
|
|
1134
|
-
const artifactField = `${caseField}.review.artifacts[${artifactIndex}]`;
|
|
1135
|
-
const artifact = expectRecord(artifactValue, artifactField);
|
|
1136
|
-
if (!artifact)
|
|
1137
|
-
return;
|
|
1138
|
-
validateAllowedKeys(artifact, artifactField, ['path', 'exists', 'contains', 'not_contains', 'json']);
|
|
1139
|
-
const artifactPath = validateEvalWorkspacePath(artifact.path, `${artifactField}.path`);
|
|
1140
|
-
if (artifactPath)
|
|
1141
|
-
artifactPaths.push(artifactPath);
|
|
1142
|
-
if (artifact.exists !== undefined && typeof artifact.exists !== 'boolean') {
|
|
1143
|
-
error(`${artifactField}.exists must be boolean`);
|
|
1144
|
-
}
|
|
1145
|
-
for (const key of ['contains', 'not_contains']) {
|
|
1146
|
-
if (artifact[key] !== undefined &&
|
|
1147
|
-
(!Array.isArray(artifact[key]) || artifact[key].length === 0 || artifact[key].some((fragment) => typeof fragment !== 'string' || fragment.length === 0))) {
|
|
1148
|
-
error(`${artifactField}.${key} must be a non-empty array of strings`);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
if (artifact.json !== undefined && !isRecord(artifact.json)) {
|
|
1152
|
-
error(`${artifactField}.json must be an object`);
|
|
1153
|
-
}
|
|
1154
|
-
});
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
if (new Set(artifactPaths).size !== artifactPaths.length) {
|
|
1158
|
-
error(`${caseField}.review.artifacts contains duplicate paths`);
|
|
1159
|
-
}
|
|
1160
|
-
if (sandbox === 'workspace-write') {
|
|
1161
|
-
if (review.workspace_unchanged !== false) {
|
|
1162
|
-
error(`${caseField} workspace-write requires review.workspace_unchanged=false`);
|
|
1163
|
-
}
|
|
1164
|
-
if (allowedWorkspaceChanges.length === 0 || artifactPaths.length === 0) {
|
|
1165
|
-
error(`${caseField} workspace-write requires allowed changes and artifacts`);
|
|
1166
|
-
}
|
|
1167
|
-
const unmatchedArtifact = artifactPaths.find((artifactPath) => !allowedWorkspaceChanges.some((pattern) => evalWorkspacePathMatchesPattern(artifactPath, pattern)));
|
|
1168
|
-
if (unmatchedArtifact) {
|
|
1169
|
-
error(`${caseField} artifact ${JSON.stringify(unmatchedArtifact)} is outside allowed changes`);
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
});
|
|
1174
|
-
}
|
|
1175
|
-
function validateTriggerCaseCorpus(evalDir, suite, fieldName) {
|
|
1176
|
-
const casesPath = validateEvalRelativeFile(evalDir, suite.cases, `${fieldName}.cases`);
|
|
1177
|
-
if (!casesPath)
|
|
1178
|
-
return;
|
|
1179
|
-
let document;
|
|
1180
|
-
try {
|
|
1181
|
-
document = JSON.parse(fs.readFileSync(casesPath, 'utf8'));
|
|
1182
|
-
}
|
|
1183
|
-
catch (e) {
|
|
1184
|
-
error(`${fieldName}.cases is not valid JSON: ${e.message}`);
|
|
1185
|
-
return;
|
|
1186
|
-
}
|
|
1187
|
-
const corpus = expectRecord(document, `${fieldName}.cases document`);
|
|
1188
|
-
if (!corpus)
|
|
1189
|
-
return;
|
|
1190
|
-
if (corpus.schemaVersion !== PLUGIN_EVAL_CASE_SCHEMA_VERSION) {
|
|
1191
|
-
error(`${fieldName}.cases.schemaVersion must be ${PLUGIN_EVAL_CASE_SCHEMA_VERSION}`);
|
|
1192
|
-
}
|
|
1193
|
-
if (corpus.skill !== suite.skill) {
|
|
1194
|
-
error(`${fieldName}.cases.skill must match ${JSON.stringify(suite.skill)}`);
|
|
1195
|
-
}
|
|
1196
|
-
if (!Array.isArray(corpus.cases) || corpus.cases.length === 0) {
|
|
1197
|
-
error(`${fieldName}.cases.cases must be a non-empty array`);
|
|
1198
|
-
return;
|
|
1199
|
-
}
|
|
1200
|
-
const ids = new Set();
|
|
1201
|
-
const seenSplits = new Set();
|
|
1202
|
-
let hasWorkspaceFixture = false;
|
|
1203
|
-
corpus.cases.forEach((value, caseIndex) => {
|
|
1204
|
-
const caseField = `${fieldName}.cases.cases[${caseIndex}]`;
|
|
1205
|
-
const entry = expectRecord(value, caseField);
|
|
1206
|
-
if (!entry)
|
|
1207
|
-
return;
|
|
1208
|
-
const id = validateNonEmptyString(entry.id, `${caseField}.id`);
|
|
1209
|
-
if (id && !/^[a-z0-9][a-z0-9_]*$/.test(id)) {
|
|
1210
|
-
error(`${caseField}.id must use lowercase snake_case`);
|
|
1211
|
-
}
|
|
1212
|
-
else if (id && ids.has(id)) {
|
|
1213
|
-
error(`${fieldName}.cases has duplicate case id ${JSON.stringify(id)}`);
|
|
1214
|
-
}
|
|
1215
|
-
else if (id) {
|
|
1216
|
-
ids.add(id);
|
|
1217
|
-
}
|
|
1218
|
-
if (!PLUGIN_EVAL_TRIGGER_CASE_SPLITS.has(entry.split)) {
|
|
1219
|
-
error(`${caseField}.split must be train, validation, or sanity`);
|
|
1220
|
-
}
|
|
1221
|
-
else {
|
|
1222
|
-
seenSplits.add(entry.split);
|
|
1223
|
-
}
|
|
1224
|
-
validateNonEmptyString(entry.query, `${caseField}.query`);
|
|
1225
|
-
const usesLegacyExpectation = entry.should_load_skill !== undefined;
|
|
1226
|
-
const usesRouteExpectation = entry.expected_loaded_skills !== undefined;
|
|
1227
|
-
if (usesLegacyExpectation === usesRouteExpectation) {
|
|
1228
|
-
error(`${caseField} must declare exactly one of should_load_skill or expected_loaded_skills`);
|
|
1229
|
-
}
|
|
1230
|
-
else if (usesLegacyExpectation && typeof entry.should_load_skill !== 'boolean') {
|
|
1231
|
-
error(`${caseField}.should_load_skill must be boolean`);
|
|
1232
|
-
}
|
|
1233
|
-
else if (usesRouteExpectation) {
|
|
1234
|
-
if (!Array.isArray(entry.expected_loaded_skills)) {
|
|
1235
|
-
error(`${caseField}.expected_loaded_skills must be an array`);
|
|
1236
|
-
}
|
|
1237
|
-
else {
|
|
1238
|
-
const expectedSkills = entry.expected_loaded_skills;
|
|
1239
|
-
expectedSkills.forEach((skillName, skillIndex) => {
|
|
1240
|
-
if (typeof skillName !== 'string' || skillName.trim() === '') {
|
|
1241
|
-
error(`${caseField}.expected_loaded_skills[${skillIndex}] must be a non-empty string`);
|
|
1242
|
-
}
|
|
1243
|
-
else if (!suite.skills.includes(skillName)) {
|
|
1244
|
-
error(`${caseField}.expected_loaded_skills[${skillIndex}] must name a participant Skill`);
|
|
1245
|
-
}
|
|
1246
|
-
});
|
|
1247
|
-
if (new Set(expectedSkills).size !== expectedSkills.length) {
|
|
1248
|
-
error(`${caseField}.expected_loaded_skills must not contain duplicates`);
|
|
1249
|
-
}
|
|
1250
|
-
if (suite.forbidMultipleSkillLoads === true && expectedSkills.length > 1) {
|
|
1251
|
-
error(`${caseField} expects multiple Skills but the suite forbids multiple Skill loads`);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
if (suite.observeSpawnAgent === true) {
|
|
1256
|
-
if (typeof entry.should_spawn_agent !== 'boolean') {
|
|
1257
|
-
error(`${caseField}.should_spawn_agent is required when observeSpawnAgent=true`);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
else if (entry.should_spawn_agent !== undefined) {
|
|
1261
|
-
error(`${caseField}.should_spawn_agent requires observeSpawnAgent=true`);
|
|
1262
|
-
}
|
|
1263
|
-
if (entry.workspace_fixture !== undefined) {
|
|
1264
|
-
hasWorkspaceFixture = true;
|
|
1265
|
-
validateNonEmptyString(entry.workspace_fixture, `${caseField}.workspace_fixture`);
|
|
1266
|
-
}
|
|
1267
|
-
if (entry.use_project_rules !== undefined &&
|
|
1268
|
-
typeof entry.use_project_rules !== 'boolean') {
|
|
1269
|
-
error(`${caseField}.use_project_rules must be boolean`);
|
|
1270
|
-
}
|
|
1271
|
-
if (entry.tags !== undefined) {
|
|
1272
|
-
if (!Array.isArray(entry.tags) || entry.tags.length === 0) {
|
|
1273
|
-
error(`${caseField}.tags must be a non-empty array`);
|
|
1274
|
-
}
|
|
1275
|
-
else {
|
|
1276
|
-
entry.tags.forEach((tag, tagIndex) => {
|
|
1277
|
-
validateNonEmptyString(tag, `${caseField}.tags[${tagIndex}]`);
|
|
1278
|
-
});
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
});
|
|
1282
|
-
if (hasWorkspaceFixture && suite.fixtureModule === undefined) {
|
|
1283
|
-
error(`${fieldName}.fixtureModule is required when cases declare workspace_fixture`);
|
|
1284
|
-
}
|
|
1285
|
-
if (Array.isArray(suite.releaseSplits)) {
|
|
1286
|
-
suite.releaseSplits.forEach((split) => {
|
|
1287
|
-
if (split !== 'all' && !seenSplits.has(split)) {
|
|
1288
|
-
error(`${fieldName}.cases has no cases for release split ${JSON.stringify(split)}`);
|
|
1289
|
-
}
|
|
1290
|
-
});
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
function resolveEvalProfilePlugin(pluginDir, ownerManifest, pluginName, fieldName) {
|
|
1294
|
-
if (pluginName === ownerManifest.name) {
|
|
1295
|
-
return { pluginDir, manifest: ownerManifest };
|
|
1296
|
-
}
|
|
1297
|
-
const companionDir = path.join(path.dirname(pluginDir), pluginName);
|
|
1298
|
-
const manifestPath = path.join(companionDir, '.agents-plugin', 'plugin.json');
|
|
1299
|
-
if (!fs.existsSync(manifestPath)) {
|
|
1300
|
-
error(`${fieldName} must reference repo-local plugin "${pluginName}"`);
|
|
1301
|
-
return null;
|
|
1302
|
-
}
|
|
1303
|
-
let manifest;
|
|
1304
|
-
try {
|
|
1305
|
-
manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
1306
|
-
}
|
|
1307
|
-
catch (e) {
|
|
1308
|
-
error(`${fieldName} companion manifest is not valid JSON: ${e.message}`);
|
|
1309
|
-
return null;
|
|
1310
|
-
}
|
|
1311
|
-
if (!isRecord(manifest) || manifest.name !== pluginName) {
|
|
1312
|
-
error(`${fieldName} companion source must declare plugin name "${pluginName}"`);
|
|
773
|
+
catch {
|
|
1313
774
|
return null;
|
|
1314
775
|
}
|
|
1315
|
-
return { pluginDir: companionDir, manifest };
|
|
1316
|
-
}
|
|
1317
|
-
function validateOnePluginEvalManifest(pluginDir, pluginManifest, evalDir, expectedSkill) {
|
|
1318
|
-
const evalManifestPath = path.join(evalDir, 'manifest.json');
|
|
1319
|
-
const manifestField = path.relative(pluginDir, evalManifestPath).split(path.sep).join('/');
|
|
1320
|
-
let document;
|
|
1321
|
-
try {
|
|
1322
|
-
document = JSON.parse(fs.readFileSync(evalManifestPath, 'utf8'));
|
|
1323
|
-
}
|
|
1324
|
-
catch (e) {
|
|
1325
|
-
error(`${manifestField} is not valid JSON: ${e.message}`);
|
|
1326
|
-
return;
|
|
1327
|
-
}
|
|
1328
|
-
const manifest = expectRecord(document, manifestField);
|
|
1329
|
-
if (!manifest)
|
|
1330
|
-
return;
|
|
1331
|
-
validateAllowedKeys(manifest, manifestField, ['schemaVersion', 'plugin', 'skill', 'profiles', 'suites']);
|
|
1332
|
-
if (manifest.schemaVersion !== PLUGIN_EVAL_SCHEMA_VERSION) {
|
|
1333
|
-
error(`${manifestField}.schemaVersion must be ${PLUGIN_EVAL_SCHEMA_VERSION}`);
|
|
1334
|
-
}
|
|
1335
|
-
if (manifest.plugin !== pluginManifest.name) {
|
|
1336
|
-
error(`${manifestField}.plugin must match plugin name ${JSON.stringify(pluginManifest.name)}`);
|
|
1337
|
-
}
|
|
1338
|
-
const skill = validateNonEmptyString(manifest.skill, `${manifestField}.skill`);
|
|
1339
|
-
if (skill && skill !== expectedSkill) {
|
|
1340
|
-
error(`${manifestField}.skill must match owning Skill ${JSON.stringify(expectedSkill)}`);
|
|
1341
|
-
}
|
|
1342
|
-
if (skill && !collectDeclaredSkillNames(pluginDir, pluginManifest).all.has(skill)) {
|
|
1343
|
-
error(`${manifestField}.skill must reference a declared static or dynamic skill`);
|
|
1344
|
-
}
|
|
1345
|
-
if (!Array.isArray(manifest.profiles) || manifest.profiles.length === 0) {
|
|
1346
|
-
error(`${manifestField}.profiles must be a non-empty array`);
|
|
1347
|
-
return;
|
|
1348
|
-
}
|
|
1349
|
-
const profilesById = new Map();
|
|
1350
|
-
manifest.profiles.forEach((value, index) => {
|
|
1351
|
-
const fieldName = `${manifestField}.profiles[${index}]`;
|
|
1352
|
-
const profile = expectRecord(value, fieldName);
|
|
1353
|
-
if (!profile)
|
|
1354
|
-
return;
|
|
1355
|
-
validateAllowedKeys(profile, fieldName, ['id', 'scope', 'plugins', 'runModel', 'requiredForRelease']);
|
|
1356
|
-
const id = validateNonEmptyString(profile.id, `${fieldName}.id`);
|
|
1357
|
-
if (id && !PLUGIN_NAME_PATTERN.test(id)) {
|
|
1358
|
-
error(`${fieldName}.id must use lowercase kebab-case`);
|
|
1359
|
-
}
|
|
1360
|
-
else if (id && profilesById.has(id)) {
|
|
1361
|
-
error(`${manifestField} has duplicate profile id ${JSON.stringify(id)}`);
|
|
1362
|
-
}
|
|
1363
|
-
if (!PLUGIN_EVAL_SCOPES.has(profile.scope)) {
|
|
1364
|
-
error(`${fieldName}.scope must be user or project`);
|
|
1365
|
-
}
|
|
1366
|
-
const skillOwners = new Map();
|
|
1367
|
-
const installedPlugins = new Set();
|
|
1368
|
-
if (!Array.isArray(profile.plugins) || profile.plugins.length === 0) {
|
|
1369
|
-
error(`${fieldName}.plugins must be a non-empty array`);
|
|
1370
|
-
}
|
|
1371
|
-
else {
|
|
1372
|
-
profile.plugins.forEach((value, pluginIndex) => {
|
|
1373
|
-
const pluginField = `${fieldName}.plugins[${pluginIndex}]`;
|
|
1374
|
-
const installation = expectRecord(value, pluginField);
|
|
1375
|
-
if (!installation)
|
|
1376
|
-
return;
|
|
1377
|
-
validateAllowedKeys(installation, pluginField, ['name', 'config']);
|
|
1378
|
-
const pluginName = validateNonEmptyString(installation.name, `${pluginField}.name`);
|
|
1379
|
-
if (!pluginName)
|
|
1380
|
-
return;
|
|
1381
|
-
if (!PLUGIN_NAME_PATTERN.test(pluginName)) {
|
|
1382
|
-
error(`${pluginField}.name must use lowercase kebab-case`);
|
|
1383
|
-
}
|
|
1384
|
-
if (installedPlugins.has(pluginName)) {
|
|
1385
|
-
error(`${fieldName}.plugins has duplicate plugin ${JSON.stringify(pluginName)}`);
|
|
1386
|
-
return;
|
|
1387
|
-
}
|
|
1388
|
-
installedPlugins.add(pluginName);
|
|
1389
|
-
if (installation.config !== undefined && !isRecord(installation.config)) {
|
|
1390
|
-
error(`${pluginField}.config must be an object`);
|
|
1391
|
-
}
|
|
1392
|
-
const source = resolveEvalProfilePlugin(pluginDir, pluginManifest, pluginName, `${pluginField}.name`);
|
|
1393
|
-
if (!source)
|
|
1394
|
-
return;
|
|
1395
|
-
for (const skillName of collectDeclaredSkillNames(source.pluginDir, source.manifest).all) {
|
|
1396
|
-
const existing = skillOwners.get(skillName);
|
|
1397
|
-
if (existing && existing !== pluginName) {
|
|
1398
|
-
error(`${fieldName} installs duplicate Skill key ${JSON.stringify(skillName)} ` +
|
|
1399
|
-
`from plugins ${JSON.stringify(existing)} and ${JSON.stringify(pluginName)}`);
|
|
1400
|
-
}
|
|
1401
|
-
else {
|
|
1402
|
-
skillOwners.set(skillName, pluginName);
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
});
|
|
1406
|
-
}
|
|
1407
|
-
if (!installedPlugins.has(pluginManifest.name)) {
|
|
1408
|
-
error(`${fieldName}.plugins must include owner plugin ${JSON.stringify(pluginManifest.name)}`);
|
|
1409
|
-
}
|
|
1410
|
-
if (typeof profile.runModel !== 'boolean') {
|
|
1411
|
-
error(`${fieldName}.runModel must be boolean`);
|
|
1412
|
-
}
|
|
1413
|
-
if (typeof profile.requiredForRelease !== 'boolean') {
|
|
1414
|
-
error(`${fieldName}.requiredForRelease must be boolean`);
|
|
1415
|
-
}
|
|
1416
|
-
if (profile.scope === 'user' && profile.runModel === true) {
|
|
1417
|
-
error(`${fieldName}: eval schema v2 does not allow real model execution for user scope`);
|
|
1418
|
-
}
|
|
1419
|
-
if (id && PLUGIN_NAME_PATTERN.test(id) && !profilesById.has(id)) {
|
|
1420
|
-
profilesById.set(id, { ...profile, skillOwners });
|
|
1421
|
-
}
|
|
1422
|
-
});
|
|
1423
|
-
if (!manifest.profiles.some((profile) => isRecord(profile) && profile.scope === 'project' && profile.runModel === true)) {
|
|
1424
|
-
error(`${manifestField} must define at least one project profile with runModel=true`);
|
|
1425
|
-
}
|
|
1426
|
-
if (!Array.isArray(manifest.suites) || manifest.suites.length === 0) {
|
|
1427
|
-
error(`${manifestField}.suites must be a non-empty array`);
|
|
1428
|
-
return;
|
|
1429
|
-
}
|
|
1430
|
-
const suiteIds = new Set();
|
|
1431
|
-
manifest.suites.forEach((value, index) => {
|
|
1432
|
-
const fieldName = `${manifestField}.suites[${index}]`;
|
|
1433
|
-
const suite = expectRecord(value, fieldName);
|
|
1434
|
-
if (!suite)
|
|
1435
|
-
return;
|
|
1436
|
-
const id = validateNonEmptyString(suite.id, `${fieldName}.id`);
|
|
1437
|
-
if (id && !PLUGIN_NAME_PATTERN.test(id)) {
|
|
1438
|
-
error(`${fieldName}.id must use lowercase kebab-case`);
|
|
1439
|
-
}
|
|
1440
|
-
else if (id && suiteIds.has(id)) {
|
|
1441
|
-
error(`${manifestField} has duplicate suite id ${JSON.stringify(id)}`);
|
|
1442
|
-
}
|
|
1443
|
-
else if (id) {
|
|
1444
|
-
suiteIds.add(id);
|
|
1445
|
-
}
|
|
1446
|
-
if (suite.kind !== 'command' && suite.kind !== 'conversation' && suite.kind !== 'trigger') {
|
|
1447
|
-
error(`${fieldName}.kind must be command, conversation, or trigger`);
|
|
1448
|
-
}
|
|
1449
|
-
const suiteSkills = new Set();
|
|
1450
|
-
if (!Array.isArray(suite.skills) || suite.skills.length === 0) {
|
|
1451
|
-
error(`${fieldName}.skills must be a non-empty array`);
|
|
1452
|
-
}
|
|
1453
|
-
else {
|
|
1454
|
-
suite.skills.forEach((skillName, skillIndex) => {
|
|
1455
|
-
const skillField = `${fieldName}.skills[${skillIndex}]`;
|
|
1456
|
-
const normalized = validateNonEmptyString(skillName, skillField);
|
|
1457
|
-
if (!normalized)
|
|
1458
|
-
return;
|
|
1459
|
-
if (!PLUGIN_NAME_PATTERN.test(normalized)) {
|
|
1460
|
-
error(`${skillField} must use lowercase kebab-case`);
|
|
1461
|
-
}
|
|
1462
|
-
else if (suiteSkills.has(normalized)) {
|
|
1463
|
-
error(`${fieldName}.skills has duplicate Skill ${JSON.stringify(normalized)}`);
|
|
1464
|
-
}
|
|
1465
|
-
else {
|
|
1466
|
-
suiteSkills.add(normalized);
|
|
1467
|
-
}
|
|
1468
|
-
});
|
|
1469
|
-
}
|
|
1470
|
-
if (skill && !suiteSkills.has(skill)) {
|
|
1471
|
-
error(`${fieldName}.skills must include owner Skill ${JSON.stringify(skill)}`);
|
|
1472
|
-
}
|
|
1473
|
-
if (!Array.isArray(suite.profiles) || suite.profiles.length === 0) {
|
|
1474
|
-
error(`${fieldName}.profiles must be a non-empty array`);
|
|
1475
|
-
}
|
|
1476
|
-
else {
|
|
1477
|
-
suite.profiles.forEach((profileId, profileIndex) => {
|
|
1478
|
-
const profileField = `${fieldName}.profiles[${profileIndex}]`;
|
|
1479
|
-
if (typeof profileId !== 'string' || profileId.trim() === '') {
|
|
1480
|
-
error(`${profileField} must be a non-empty string`);
|
|
1481
|
-
return;
|
|
1482
|
-
}
|
|
1483
|
-
const profile = profilesById.get(profileId);
|
|
1484
|
-
if (!profile) {
|
|
1485
|
-
error(`${fieldName} references unknown profile ${JSON.stringify(profileId)}`);
|
|
1486
|
-
}
|
|
1487
|
-
else if (profile.runModel !== true) {
|
|
1488
|
-
error(`${fieldName} cannot execute materialize-only profile ${JSON.stringify(profileId)}`);
|
|
1489
|
-
}
|
|
1490
|
-
if (profile) {
|
|
1491
|
-
for (const skillName of suiteSkills) {
|
|
1492
|
-
if (!profile.skillOwners.has(skillName)) {
|
|
1493
|
-
error(`${fieldName} requires Skill ${JSON.stringify(skillName)}, but profile ` +
|
|
1494
|
-
`${JSON.stringify(profileId)} does not install a plugin that declares it`);
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
});
|
|
1499
|
-
}
|
|
1500
|
-
if (!Number.isInteger(suite.defaultRuns) || suite.defaultRuns <= 0) {
|
|
1501
|
-
error(`${fieldName}.defaultRuns must be a positive integer`);
|
|
1502
|
-
}
|
|
1503
|
-
if (!Number.isInteger(suite.perRunTimeoutMs) || suite.perRunTimeoutMs <= 0) {
|
|
1504
|
-
error(`${fieldName}.perRunTimeoutMs must be a positive integer`);
|
|
1505
|
-
}
|
|
1506
|
-
if (typeof suite.requiredForRelease !== 'boolean') {
|
|
1507
|
-
error(`${fieldName}.requiredForRelease must be boolean`);
|
|
1508
|
-
}
|
|
1509
|
-
if (!Array.isArray(suite.releaseSplits)) {
|
|
1510
|
-
error(`${fieldName}.releaseSplits must be an array`);
|
|
1511
|
-
}
|
|
1512
|
-
else {
|
|
1513
|
-
suite.releaseSplits.forEach((split, splitIndex) => {
|
|
1514
|
-
if (!PLUGIN_EVAL_SPLITS.has(split)) {
|
|
1515
|
-
error(`${fieldName}.releaseSplits[${splitIndex}] is unsupported`);
|
|
1516
|
-
}
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
if (suite.kind === 'command') {
|
|
1520
|
-
validateAllowedKeys(suite, fieldName, [
|
|
1521
|
-
'id', 'kind', 'skills', 'entry', 'cases', 'profiles', 'defaultRuns', 'releaseSplits',
|
|
1522
|
-
'requiredForRelease', 'perRunTimeoutMs', 'suiteTimeoutMs', 'supports',
|
|
1523
|
-
]);
|
|
1524
|
-
validateEvalRelativeFile(evalDir, suite.entry, `${fieldName}.entry`);
|
|
1525
|
-
if (!Number.isInteger(suite.suiteTimeoutMs) || suite.suiteTimeoutMs <= 0) {
|
|
1526
|
-
error(`${fieldName}.suiteTimeoutMs must be a positive integer`);
|
|
1527
|
-
}
|
|
1528
|
-
else if (suite.suiteTimeoutMs < suite.perRunTimeoutMs) {
|
|
1529
|
-
error(`${fieldName}.suiteTimeoutMs must be greater than or equal to perRunTimeoutMs`);
|
|
1530
|
-
}
|
|
1531
|
-
if (!Array.isArray(suite.supports)) {
|
|
1532
|
-
error(`${fieldName}.supports must be an array`);
|
|
1533
|
-
}
|
|
1534
|
-
else {
|
|
1535
|
-
suite.supports.forEach((support, supportIndex) => {
|
|
1536
|
-
if (!PLUGIN_EVAL_COMMAND_SUPPORTS.has(support)) {
|
|
1537
|
-
error(`${fieldName}.supports[${supportIndex}] is unsupported`);
|
|
1538
|
-
}
|
|
1539
|
-
});
|
|
1540
|
-
if (Array.isArray(suite.releaseSplits) &&
|
|
1541
|
-
suite.releaseSplits.length > 0 &&
|
|
1542
|
-
!suite.supports.includes('split')) {
|
|
1543
|
-
error(`${fieldName} declares releaseSplits but does not support split`);
|
|
1544
|
-
}
|
|
1545
|
-
const supportsCase = suite.supports.includes('case');
|
|
1546
|
-
if (supportsCase && suite.cases === undefined) {
|
|
1547
|
-
error(`${fieldName}.cases is required when supports includes case`);
|
|
1548
|
-
}
|
|
1549
|
-
else if (!supportsCase && suite.cases !== undefined) {
|
|
1550
|
-
error(`${fieldName}.cases requires supports to include case`);
|
|
1551
|
-
}
|
|
1552
|
-
if (supportsCase && suite.cases !== undefined) {
|
|
1553
|
-
const casesPath = validateEvalRelativeFile(evalDir, suite.cases, `${fieldName}.cases`);
|
|
1554
|
-
if (casesPath) {
|
|
1555
|
-
try {
|
|
1556
|
-
const casesDocument = JSON.parse(fs.readFileSync(casesPath, 'utf8'));
|
|
1557
|
-
if (!isRecord(casesDocument) || casesDocument.skill_name !== skill) {
|
|
1558
|
-
error(`${fieldName}.cases.skill_name must match ${JSON.stringify(skill)}`);
|
|
1559
|
-
}
|
|
1560
|
-
else if (!Array.isArray(casesDocument.evals) || casesDocument.evals.length === 0) {
|
|
1561
|
-
error(`${fieldName}.cases.evals must be a non-empty array`);
|
|
1562
|
-
}
|
|
1563
|
-
else {
|
|
1564
|
-
const caseIds = new Set();
|
|
1565
|
-
casesDocument.evals.forEach((entry, caseIndex) => {
|
|
1566
|
-
const caseField = `${fieldName}.cases.evals[${caseIndex}]`;
|
|
1567
|
-
if (!isRecord(entry) || typeof entry.id !== 'string' || !/^[a-z0-9_]+$/.test(entry.id)) {
|
|
1568
|
-
error(`${caseField}.id must use lowercase snake_case`);
|
|
1569
|
-
}
|
|
1570
|
-
else if (caseIds.has(entry.id)) {
|
|
1571
|
-
error(`${fieldName}.cases has duplicate case id ${JSON.stringify(entry.id)}`);
|
|
1572
|
-
}
|
|
1573
|
-
else {
|
|
1574
|
-
caseIds.add(entry.id);
|
|
1575
|
-
}
|
|
1576
|
-
});
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
catch (cause) {
|
|
1580
|
-
error(`${fieldName}.cases is not valid JSON: ${cause.message}`);
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
else if (suite.kind === 'conversation' || suite.kind === 'trigger') {
|
|
1587
|
-
const normalizedSuite = { ...suite, skill };
|
|
1588
|
-
const isolation = suite.isolation ?? 'standard';
|
|
1589
|
-
if (isolation !== 'standard' && isolation !== 'strict') {
|
|
1590
|
-
error(`${fieldName}.isolation must be standard or strict`);
|
|
1591
|
-
}
|
|
1592
|
-
if (suite.kind === 'conversation') {
|
|
1593
|
-
validateAllowedKeys(suite, fieldName, [
|
|
1594
|
-
'id', 'kind', 'skills', 'cases', 'profiles', 'defaultRuns', 'releaseSplits',
|
|
1595
|
-
'requiredForRelease', 'perRunTimeoutMs', 'isolation',
|
|
1596
|
-
]);
|
|
1597
|
-
if (Array.isArray(suite.releaseSplits) && suite.releaseSplits.length > 0) {
|
|
1598
|
-
error(`${fieldName} cannot declare releaseSplits because conversation cases do not support split filtering`);
|
|
1599
|
-
}
|
|
1600
|
-
validateConversationCaseCorpus(evalDir, normalizedSuite, fieldName);
|
|
1601
|
-
}
|
|
1602
|
-
else {
|
|
1603
|
-
validateAllowedKeys(suite, fieldName, [
|
|
1604
|
-
'id', 'kind', 'skills', 'cases', 'fixtureModule', 'observeSpawnAgent', 'isolation',
|
|
1605
|
-
'strictNegativeSplits', 'minimumPassRate', 'forbidMultipleSkillLoads',
|
|
1606
|
-
'profiles', 'defaultRuns', 'releaseSplits',
|
|
1607
|
-
'requiredForRelease', 'perRunTimeoutMs',
|
|
1608
|
-
]);
|
|
1609
|
-
if (typeof suite.observeSpawnAgent !== 'boolean') {
|
|
1610
|
-
error(`${fieldName}.observeSpawnAgent must be boolean`);
|
|
1611
|
-
}
|
|
1612
|
-
if (!Array.isArray(suite.strictNegativeSplits)) {
|
|
1613
|
-
error(`${fieldName}.strictNegativeSplits must be an array`);
|
|
1614
|
-
}
|
|
1615
|
-
else {
|
|
1616
|
-
suite.strictNegativeSplits.forEach((split, splitIndex) => {
|
|
1617
|
-
if (!PLUGIN_EVAL_TRIGGER_CASE_SPLITS.has(split)) {
|
|
1618
|
-
error(`${fieldName}.strictNegativeSplits[${splitIndex}] is unsupported`);
|
|
1619
|
-
}
|
|
1620
|
-
});
|
|
1621
|
-
}
|
|
1622
|
-
if (suite.minimumPassRate !== undefined &&
|
|
1623
|
-
(typeof suite.minimumPassRate !== 'number' ||
|
|
1624
|
-
!Number.isFinite(suite.minimumPassRate) ||
|
|
1625
|
-
suite.minimumPassRate <= 0 ||
|
|
1626
|
-
suite.minimumPassRate > 1)) {
|
|
1627
|
-
error(`${fieldName}.minimumPassRate must be greater than 0 and at most 1`);
|
|
1628
|
-
}
|
|
1629
|
-
if (suite.forbidMultipleSkillLoads !== undefined &&
|
|
1630
|
-
typeof suite.forbidMultipleSkillLoads !== 'boolean') {
|
|
1631
|
-
error(`${fieldName}.forbidMultipleSkillLoads must be boolean`);
|
|
1632
|
-
}
|
|
1633
|
-
if (suite.fixtureModule !== undefined) {
|
|
1634
|
-
const fixturePath = validateEvalRelativeFile(evalDir, suite.fixtureModule, `${fieldName}.fixtureModule`);
|
|
1635
|
-
if (fixturePath && path.extname(fixturePath) !== '.mjs') {
|
|
1636
|
-
error(`${fieldName}.fixtureModule must reference an .mjs file`);
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
validateTriggerCaseCorpus(evalDir, normalizedSuite, fieldName);
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
});
|
|
1643
|
-
if (skill
|
|
1644
|
-
&& collectDeclaredSkillNames(pluginDir, pluginManifest).dynamic.has(skill)
|
|
1645
|
-
&& !manifest.suites.some((suite) => isRecord(suite) && suite.requiredForRelease === true)) {
|
|
1646
|
-
error(`${manifestField}.suites must include at least one release-required suite for dynamic Skill ${JSON.stringify(skill)}`);
|
|
1647
|
-
}
|
|
1648
776
|
}
|
|
1649
|
-
function validatePluginEvalManifest(pluginDir, pluginManifest) {
|
|
777
|
+
async function validatePluginEvalManifest(pluginDir, pluginManifest) {
|
|
1650
778
|
const legacyRoot = path.join(pluginDir, 'evals');
|
|
1651
779
|
if (fs.existsSync(legacyRoot)) {
|
|
1652
780
|
error('Plugin-root evals/ is legacy; put evals/ inside its owning static or dynamic Skill directory.');
|
|
@@ -1655,17 +783,33 @@ function validatePluginEvalManifest(pluginDir, pluginManifest) {
|
|
|
1655
783
|
.sort()
|
|
1656
784
|
.map((skill) => ({ skill, root: path.join(pluginDir, 'skills', skill) }));
|
|
1657
785
|
const seenSkills = new Set();
|
|
786
|
+
let manifestTools = null;
|
|
1658
787
|
for (const owner of skillRoots) {
|
|
1659
788
|
const evalDir = path.join(owner.root, 'evals');
|
|
1660
789
|
const manifestPath = path.join(evalDir, 'manifest.json');
|
|
1661
790
|
if (!fs.existsSync(manifestPath))
|
|
1662
791
|
continue;
|
|
792
|
+
const manifestField = path.relative(pluginDir, manifestPath).split(path.sep).join('/');
|
|
1663
793
|
if (seenSkills.has(owner.skill)) {
|
|
1664
794
|
error(`Skill ${JSON.stringify(owner.skill)} has more than one evals/manifest.json owner`);
|
|
1665
795
|
continue;
|
|
1666
796
|
}
|
|
1667
797
|
seenSkills.add(owner.skill);
|
|
1668
|
-
|
|
798
|
+
manifestTools ??= await loadSkillEvalManifestTools();
|
|
799
|
+
if (typeof manifestTools?.validateAwSkillEvalManifest !== 'function') {
|
|
800
|
+
error('Canonical AwSkillEvalManifest v1 validator is unavailable; run the current built aw CLI.');
|
|
801
|
+
continue;
|
|
802
|
+
}
|
|
803
|
+
const validation = await manifestTools.validateAwSkillEvalManifest({
|
|
804
|
+
plugin: {
|
|
805
|
+
rootDir: pluginDir,
|
|
806
|
+
manifestPath: path.join(pluginDir, '.agents-plugin', 'plugin.json'),
|
|
807
|
+
manifest: pluginManifest,
|
|
808
|
+
},
|
|
809
|
+
skill: owner.skill,
|
|
810
|
+
});
|
|
811
|
+
for (const message of validation.errors)
|
|
812
|
+
error(`${manifestField}: ${message}`);
|
|
1669
813
|
}
|
|
1670
814
|
}
|
|
1671
815
|
function countCharacters(value) {
|
|
@@ -1941,7 +1085,7 @@ function targetedPlatforms(manifest) {
|
|
|
1941
1085
|
platforms.push('claude');
|
|
1942
1086
|
if (isCodexTargeted(manifest))
|
|
1943
1087
|
platforms.push('codex');
|
|
1944
|
-
return platforms
|
|
1088
|
+
return platforms;
|
|
1945
1089
|
}
|
|
1946
1090
|
// ---------------------------------------------------------------------------
|
|
1947
1091
|
// Supplemental checks (always run — not covered by CLI validator)
|
|
@@ -1989,7 +1133,7 @@ function validateCanonicalSkillLayout(pluginDir, manifest) {
|
|
|
1989
1133
|
: [])
|
|
1990
1134
|
.filter((target) => target &&
|
|
1991
1135
|
typeof target === 'object' &&
|
|
1992
|
-
(target.target === 'codex.skill' || target.target === 'claude.skill') &&
|
|
1136
|
+
(target.target === 'codex.skill' || target.target === 'claude.skill' || target.target === 'agent-skills.skill') &&
|
|
1993
1137
|
typeof target.skillKey === 'string' &&
|
|
1994
1138
|
Array.isArray(target.sourceDirs) &&
|
|
1995
1139
|
target.sourceDirs.length > 0)
|
|
@@ -2010,18 +1154,6 @@ function validateCanonicalSkillLayout(pluginDir, manifest) {
|
|
|
2010
1154
|
error(`skills/${skill}/README.md must not be empty`);
|
|
2011
1155
|
}
|
|
2012
1156
|
}
|
|
2013
|
-
const portableRoot = manifest.distributions?.agentSkills?.skills;
|
|
2014
|
-
for (const skill of declared.portable) {
|
|
2015
|
-
const skillRoot = path.join(pluginDir, portableRoot, skill);
|
|
2016
|
-
const skillReadme = path.join(skillRoot, 'README.md');
|
|
2017
|
-
if (!fs.statSync(skillReadme, { throwIfNoEntry: false })?.isFile()) {
|
|
2018
|
-
error(`${normalizeRelativePath(path.join(portableRoot, skill, 'README.md'))} is required`);
|
|
2019
|
-
continue;
|
|
2020
|
-
}
|
|
2021
|
-
if (fs.readFileSync(skillReadme, 'utf8').trim() === '') {
|
|
2022
|
-
error(`${normalizeRelativePath(path.join(portableRoot, skill, 'README.md'))} must not be empty`);
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
1157
|
}
|
|
2026
1158
|
function validateDeclaredNativeAssets(pluginDir, manifest) {
|
|
2027
1159
|
const defaults = [
|
|
@@ -2050,39 +1182,12 @@ function validateDeclaredNativeAssets(pluginDir, manifest) {
|
|
|
2050
1182
|
.map((target) => target.skillKey));
|
|
2051
1183
|
const entries = fs.readdirSync(fullPath, { withFileTypes: true });
|
|
2052
1184
|
if (entries.length > 0 &&
|
|
2053
|
-
entries.every((entry) => entry.isDirectory() && dynamicSkills.has(entry.name))) {
|
|
2054
|
-
continue;
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
error(`"${filename}" exists but manifest does not declare "${field}" — declare it or remove the file`);
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
function validatePluginVersionContracts(manifest, options) {
|
|
2062
|
-
if (manifest.compatibility === undefined) {
|
|
2063
|
-
error('Invalid compatibility.aw.minVersion: expected a strict SemVer 2.0.0 string. Received undefined.');
|
|
2064
|
-
return;
|
|
2065
|
-
}
|
|
2066
|
-
const compatibility = expectRecord(manifest.compatibility, 'compatibility');
|
|
2067
|
-
if (!compatibility) {
|
|
2068
|
-
return;
|
|
2069
|
-
}
|
|
2070
|
-
validateAllowedKeys(compatibility, 'compatibility', ['aw']);
|
|
2071
|
-
if (compatibility.aw === undefined) {
|
|
2072
|
-
error('Invalid compatibility.aw.minVersion: expected a strict SemVer 2.0.0 string. Received undefined.');
|
|
2073
|
-
return;
|
|
2074
|
-
}
|
|
2075
|
-
const aw = expectRecord(compatibility.aw, 'compatibility.aw');
|
|
2076
|
-
if (!aw) {
|
|
2077
|
-
return;
|
|
2078
|
-
}
|
|
2079
|
-
validateAllowedKeys(aw, 'compatibility.aw', ['minVersion']);
|
|
2080
|
-
const pluginMinVersion = validateStrictSemVerString(aw.minVersion, 'compatibility.aw.minVersion');
|
|
2081
|
-
if (!pluginMinVersion || !options.catalogMinVersion) {
|
|
2082
|
-
return;
|
|
2083
|
-
}
|
|
2084
|
-
if (compareStrictSemVer(pluginMinVersion, options.catalogMinVersion) > 0) {
|
|
2085
|
-
error(`Invalid compatibility.aw.minVersion for plugin "${pluginNameForError(manifest)}": received ${JSON.stringify(pluginMinVersion)}, which is higher than target catalog minimum ${JSON.stringify(options.catalogMinVersion)}.`);
|
|
1185
|
+
entries.every((entry) => entry.isDirectory() && dynamicSkills.has(entry.name))) {
|
|
1186
|
+
continue;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
error(`"${filename}" exists but manifest does not declare "${field}" — declare it or remove the file`);
|
|
1190
|
+
}
|
|
2086
1191
|
}
|
|
2087
1192
|
}
|
|
2088
1193
|
function collectDeclaredSkillNames(pluginDir, manifest) {
|
|
@@ -2108,30 +1213,15 @@ function collectDeclaredSkillNames(pluginDir, manifest) {
|
|
|
2108
1213
|
.map((target) => target.skillKey.trim())
|
|
2109
1214
|
.sort();
|
|
2110
1215
|
const dynamicSkillNameSet = new Set(dynamicSkillNames);
|
|
2111
|
-
const portableRoot = typeof manifest.distributions?.agentSkills?.skills === 'string'
|
|
2112
|
-
? path.join(pluginDir, manifest.distributions.agentSkills.skills)
|
|
2113
|
-
: null;
|
|
2114
|
-
const portableRootStats = portableRoot
|
|
2115
|
-
? fs.lstatSync(portableRoot, { throwIfNoEntry: false })
|
|
2116
|
-
: null;
|
|
2117
|
-
const portableSkillNameSet = new Set(portableRootStats?.isDirectory() && !portableRootStats.isSymbolicLink()
|
|
2118
|
-
? fs.readdirSync(portableRoot, { withFileTypes: true })
|
|
2119
|
-
.filter((entry) => entry.isDirectory())
|
|
2120
|
-
.map((entry) => entry.name)
|
|
2121
|
-
: []);
|
|
2122
1216
|
return {
|
|
2123
1217
|
static: staticSkillNameSet,
|
|
2124
1218
|
dynamic: dynamicSkillNameSet,
|
|
2125
|
-
portable: portableSkillNameSet,
|
|
2126
1219
|
all: new Set([...staticSkillNames, ...dynamicSkillNames]),
|
|
2127
1220
|
};
|
|
2128
1221
|
}
|
|
2129
1222
|
function isNodeRunnablePath(relativePath) {
|
|
2130
1223
|
return SCRIPT_NODE_EXTENSIONS.has(path.posix.extname(normalizeRelativePath(relativePath)));
|
|
2131
1224
|
}
|
|
2132
|
-
function isAutoRunnablePath(relativePath) {
|
|
2133
|
-
return SCRIPT_AUTO_EXTENSIONS.has(path.posix.extname(normalizeRelativePath(relativePath)).toLowerCase());
|
|
2134
|
-
}
|
|
2135
1225
|
function normalizePluginScriptPath(pluginDir, value, fieldName) {
|
|
2136
1226
|
if (typeof value !== 'string' || value.trim() === '') {
|
|
2137
1227
|
error(`${fieldName} must be a non-empty string`);
|
|
@@ -2180,17 +1270,11 @@ function validateScriptEntry(pluginDir, value, fieldName, options = {}) {
|
|
|
2180
1270
|
}
|
|
2181
1271
|
validateAllowedKeys(entry, fieldName, ['runner', 'path', 'args']);
|
|
2182
1272
|
const runner = validateManifestString(entry.runner, `${fieldName}.runner`);
|
|
2183
|
-
if (runner
|
|
2184
|
-
error(`${fieldName}.runner has unsupported runner "${runner}"`);
|
|
2185
|
-
}
|
|
2186
|
-
if (options.requireNodeRunner && runner !== 'node') {
|
|
1273
|
+
if (runner !== 'node') {
|
|
2187
1274
|
error(`${fieldName}.runner must be "node"`);
|
|
2188
1275
|
}
|
|
2189
1276
|
const relativePath = normalizePluginScriptPath(pluginDir, entry.path, `${fieldName}.path`);
|
|
2190
1277
|
validateDeclaredScriptFile(pluginDir, relativePath, `${fieldName}.path`);
|
|
2191
|
-
if (runner === 'auto' && relativePath && !isAutoRunnablePath(relativePath)) {
|
|
2192
|
-
error(`${fieldName}.path uses runner "auto" but has no supported extension (${[...SCRIPT_AUTO_EXTENSIONS].join(', ')})`);
|
|
2193
|
-
}
|
|
2194
1278
|
if (options.requireNodePath && relativePath && !isNodeRunnablePath(relativePath)) {
|
|
2195
1279
|
error(`${fieldName}.path must use a Node runnable extension (.js, .mjs, or .cjs)`);
|
|
2196
1280
|
}
|
|
@@ -2208,51 +1292,6 @@ function validateScriptEntry(pluginDir, value, fieldName, options = {}) {
|
|
|
2208
1292
|
}
|
|
2209
1293
|
return runner && relativePath ? { runner, path: relativePath } : null;
|
|
2210
1294
|
}
|
|
2211
|
-
function validateLifecycleDefinition(pluginDir, value, fieldName, runtimeEntries) {
|
|
2212
|
-
if (typeof value === 'string') {
|
|
2213
|
-
const relativePath = normalizePluginScriptPath(pluginDir, value, fieldName);
|
|
2214
|
-
validateDeclaredScriptFile(pluginDir, relativePath, fieldName);
|
|
2215
|
-
if (relativePath && !isAutoRunnablePath(relativePath)) {
|
|
2216
|
-
error(`${fieldName} uses runner "auto" but has no supported extension (${[...SCRIPT_AUTO_EXTENSIONS].join(', ')})`);
|
|
2217
|
-
}
|
|
2218
|
-
if (relativePath && isNodeRunnablePath(relativePath)) {
|
|
2219
|
-
runtimeEntries.push({ path: relativePath, fieldName });
|
|
2220
|
-
}
|
|
2221
|
-
return { default: relativePath ? { runner: 'auto', path: relativePath } : null };
|
|
2222
|
-
}
|
|
2223
|
-
const selector = expectRecord(value, fieldName);
|
|
2224
|
-
if (!selector)
|
|
2225
|
-
return {};
|
|
2226
|
-
if ('runner' in selector || 'path' in selector || 'command' in selector) {
|
|
2227
|
-
error(`${fieldName} must declare lifecycle scripts under OS selectors`);
|
|
2228
|
-
}
|
|
2229
|
-
for (const selectorName of Object.keys(selector)) {
|
|
2230
|
-
if (!SCRIPT_OS_SELECTORS.has(selectorName)) {
|
|
2231
|
-
error(`${fieldName} has unknown OS selector "${selectorName}"`);
|
|
2232
|
-
}
|
|
2233
|
-
}
|
|
2234
|
-
const normalized = {};
|
|
2235
|
-
for (const [selectorName, entryValue] of Object.entries(selector)) {
|
|
2236
|
-
const entry = validateScriptEntry(pluginDir, entryValue, `${fieldName}.${selectorName}`);
|
|
2237
|
-
if (entry) {
|
|
2238
|
-
normalized[selectorName] = entry;
|
|
2239
|
-
if (entry.runner === 'node' || (entry.runner === 'auto' && isNodeRunnablePath(entry.path))) {
|
|
2240
|
-
runtimeEntries.push({ path: entry.path, fieldName: `${fieldName}.${selectorName}.path` });
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
const orders = {
|
|
2245
|
-
linux: ['linux', 'unix', 'default'],
|
|
2246
|
-
darwin: ['darwin', 'unix', 'default'],
|
|
2247
|
-
win32: ['win32', 'windows', 'default'],
|
|
2248
|
-
};
|
|
2249
|
-
for (const [osName, order] of Object.entries(orders)) {
|
|
2250
|
-
if (!order.some((selectorName) => normalized[selectorName])) {
|
|
2251
|
-
error(`${fieldName} must include an entry that resolves on ${osName}`);
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
return normalized;
|
|
2255
|
-
}
|
|
2256
1295
|
function isNonRegistryDependencySpecifier(specifier) {
|
|
2257
1296
|
const trimmed = String(specifier).trim();
|
|
2258
1297
|
return (/^(?:workspace|file|link|portal):/i.test(trimmed) ||
|
|
@@ -2390,6 +1429,12 @@ function scanNodeImportContract(pluginDir, entryPaths, options) {
|
|
|
2390
1429
|
continue;
|
|
2391
1430
|
}
|
|
2392
1431
|
if (!resolved.path) {
|
|
1432
|
+
const requested = path.posix.normalize(path.posix.join(path.posix.dirname(relativePath), specifier));
|
|
1433
|
+
if (options.nativeToolReader && requested === options.nativeToolReader)
|
|
1434
|
+
continue;
|
|
1435
|
+
if ((options.runtimeConfigSkillRoots ?? []).some((root) => (relativePath.startsWith(`${root}/`)
|
|
1436
|
+
&& requested === path.posix.join(root, AW_RUNTIME_CONFIG_READER_PATH))))
|
|
1437
|
+
continue;
|
|
2393
1438
|
error(`${options.label}: unable to resolve relative import "${specifier}" from "${relativePath}"`);
|
|
2394
1439
|
continue;
|
|
2395
1440
|
}
|
|
@@ -2439,271 +1484,50 @@ function listFilesRecursive(rootDir) {
|
|
|
2439
1484
|
walk(rootDir);
|
|
2440
1485
|
return output;
|
|
2441
1486
|
}
|
|
2442
|
-
function
|
|
2443
|
-
if (!isRecord(field) || !CONFIG_FIELD_TYPES.has(field.type))
|
|
2444
|
-
return;
|
|
2445
|
-
if (field.type === 'string' || field.type === 'file' || field.type === 'directory') {
|
|
2446
|
-
validateManifestString(value, fieldName);
|
|
2447
|
-
return;
|
|
2448
|
-
}
|
|
2449
|
-
if (field.type === 'boolean') {
|
|
2450
|
-
if (typeof value !== 'boolean') {
|
|
2451
|
-
error(`${fieldName} must be a boolean`);
|
|
2452
|
-
}
|
|
2453
|
-
return;
|
|
2454
|
-
}
|
|
2455
|
-
if (field.type === 'number') {
|
|
2456
|
-
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
2457
|
-
error(`${fieldName} must be a finite number`);
|
|
2458
|
-
return;
|
|
2459
|
-
}
|
|
2460
|
-
if (typeof field.min === 'number' && value < field.min) {
|
|
2461
|
-
error(`${fieldName} must be greater than or equal to ${field.min}`);
|
|
2462
|
-
}
|
|
2463
|
-
if (typeof field.max === 'number' && value > field.max) {
|
|
2464
|
-
error(`${fieldName} must be less than or equal to ${field.max}`);
|
|
2465
|
-
}
|
|
2466
|
-
return;
|
|
2467
|
-
}
|
|
2468
|
-
if (field.type === 'enum') {
|
|
2469
|
-
if (typeof value !== 'string' || !Array.isArray(field.values) || !field.values.includes(value)) {
|
|
2470
|
-
error(`${fieldName} must be one of config schema values`);
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
}
|
|
2474
|
-
function validateConfigPresentationLightweight(presentation, schema) {
|
|
2475
|
-
if (presentation === undefined)
|
|
2476
|
-
return;
|
|
2477
|
-
const root = expectRecord(presentation, 'config.presentation');
|
|
2478
|
-
if (!root)
|
|
2479
|
-
return;
|
|
2480
|
-
validateAllowedKeys(root, 'config.presentation', ['groups', 'fields', 'presets']);
|
|
2481
|
-
const schemaKeys = new Set(Object.keys(schema));
|
|
2482
|
-
if (root.groups !== undefined) {
|
|
2483
|
-
if (!Array.isArray(root.groups)) {
|
|
2484
|
-
error('config.presentation.groups must be an array');
|
|
2485
|
-
}
|
|
2486
|
-
else {
|
|
2487
|
-
const groupIds = new Set();
|
|
2488
|
-
const groupedFields = new Set();
|
|
2489
|
-
root.groups.forEach((rawGroup, index) => {
|
|
2490
|
-
const fieldName = `config.presentation.groups[${index}]`;
|
|
2491
|
-
const group = expectRecord(rawGroup, fieldName);
|
|
2492
|
-
if (!group)
|
|
2493
|
-
return;
|
|
2494
|
-
validateAllowedKeys(group, fieldName, ['id', 'title', 'description', 'fields', 'advanced']);
|
|
2495
|
-
const validId = validateManifestString(group.id, `${fieldName}.id`);
|
|
2496
|
-
const id = validId ? group.id : null;
|
|
2497
|
-
if (id && groupIds.has(id)) {
|
|
2498
|
-
error(`${fieldName}.id has duplicate group id "${id}"`);
|
|
2499
|
-
}
|
|
2500
|
-
else if (id) {
|
|
2501
|
-
groupIds.add(id);
|
|
2502
|
-
}
|
|
2503
|
-
validateManifestString(group.title, `${fieldName}.title`);
|
|
2504
|
-
if (group.description !== undefined) {
|
|
2505
|
-
validateManifestString(group.description, `${fieldName}.description`);
|
|
2506
|
-
}
|
|
2507
|
-
if (group.advanced !== undefined && typeof group.advanced !== 'boolean') {
|
|
2508
|
-
error(`${fieldName}.advanced must be a boolean`);
|
|
2509
|
-
}
|
|
2510
|
-
if (!Array.isArray(group.fields)) {
|
|
2511
|
-
error(`${fieldName}.fields must be an array`);
|
|
2512
|
-
return;
|
|
2513
|
-
}
|
|
2514
|
-
group.fields.forEach((key, fieldIndex) => {
|
|
2515
|
-
const keyFieldName = `${fieldName}.fields[${fieldIndex}]`;
|
|
2516
|
-
const validKey = validateManifestString(key, keyFieldName);
|
|
2517
|
-
if (!validKey)
|
|
2518
|
-
return;
|
|
2519
|
-
if (!schemaKeys.has(key)) {
|
|
2520
|
-
error(`${keyFieldName} references unknown config key "${key}"`);
|
|
2521
|
-
}
|
|
2522
|
-
if (groupedFields.has(key)) {
|
|
2523
|
-
error(`${keyFieldName} assigns config key "${key}" to more than one group`);
|
|
2524
|
-
}
|
|
2525
|
-
else {
|
|
2526
|
-
groupedFields.add(key);
|
|
2527
|
-
}
|
|
2528
|
-
});
|
|
2529
|
-
});
|
|
2530
|
-
}
|
|
2531
|
-
}
|
|
2532
|
-
if (root.fields !== undefined) {
|
|
2533
|
-
const fields = expectRecord(root.fields, 'config.presentation.fields');
|
|
2534
|
-
if (fields) {
|
|
2535
|
-
for (const [key, rawField] of Object.entries(fields)) {
|
|
2536
|
-
const fieldName = `config.presentation.fields.${key}`;
|
|
2537
|
-
const schemaField = schema[key];
|
|
2538
|
-
if (!schemaKeys.has(key)) {
|
|
2539
|
-
error(`config.presentation.fields references unknown config key "${key}"`);
|
|
2540
|
-
}
|
|
2541
|
-
const field = expectRecord(rawField, fieldName);
|
|
2542
|
-
if (!field)
|
|
2543
|
-
continue;
|
|
2544
|
-
validateAllowedKeys(field, fieldName, [
|
|
2545
|
-
'valueLabels',
|
|
2546
|
-
'recommendedValue',
|
|
2547
|
-
'placeholder',
|
|
2548
|
-
'unit',
|
|
2549
|
-
'advanced',
|
|
2550
|
-
]);
|
|
2551
|
-
if (field.placeholder !== undefined) {
|
|
2552
|
-
validateManifestString(field.placeholder, `${fieldName}.placeholder`);
|
|
2553
|
-
}
|
|
2554
|
-
if (field.unit !== undefined) {
|
|
2555
|
-
validateManifestString(field.unit, `${fieldName}.unit`);
|
|
2556
|
-
}
|
|
2557
|
-
if (field.advanced !== undefined && typeof field.advanced !== 'boolean') {
|
|
2558
|
-
error(`${fieldName}.advanced must be a boolean`);
|
|
2559
|
-
}
|
|
2560
|
-
if (field.valueLabels !== undefined) {
|
|
2561
|
-
const labels = expectRecord(field.valueLabels, `${fieldName}.valueLabels`);
|
|
2562
|
-
if (isRecord(schemaField) && schemaField.type !== 'enum') {
|
|
2563
|
-
error(`${fieldName}.valueLabels is only supported for enum config`);
|
|
2564
|
-
}
|
|
2565
|
-
if (labels) {
|
|
2566
|
-
for (const [token, label] of Object.entries(labels)) {
|
|
2567
|
-
if (!isRecord(schemaField) || !Array.isArray(schemaField.values) || !schemaField.values.includes(token)) {
|
|
2568
|
-
error(`${fieldName}.valueLabels references unknown enum token "${token}"`);
|
|
2569
|
-
}
|
|
2570
|
-
validateManifestString(label, `${fieldName}.valueLabels.${token}`);
|
|
2571
|
-
}
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
if (field.recommendedValue !== undefined) {
|
|
2575
|
-
validateConfigValueLightweight(schemaField, field.recommendedValue, `${fieldName}.recommendedValue`);
|
|
2576
|
-
}
|
|
2577
|
-
}
|
|
2578
|
-
}
|
|
2579
|
-
}
|
|
2580
|
-
if (root.presets !== undefined) {
|
|
2581
|
-
if (!Array.isArray(root.presets)) {
|
|
2582
|
-
error('config.presentation.presets must be an array');
|
|
2583
|
-
}
|
|
2584
|
-
else {
|
|
2585
|
-
const presetIds = new Set();
|
|
2586
|
-
root.presets.forEach((rawPreset, index) => {
|
|
2587
|
-
const fieldName = `config.presentation.presets[${index}]`;
|
|
2588
|
-
const preset = expectRecord(rawPreset, fieldName);
|
|
2589
|
-
if (!preset)
|
|
2590
|
-
return;
|
|
2591
|
-
validateAllowedKeys(preset, fieldName, ['id', 'title', 'description', 'values']);
|
|
2592
|
-
const validId = validateManifestString(preset.id, `${fieldName}.id`);
|
|
2593
|
-
const id = validId ? preset.id : null;
|
|
2594
|
-
if (id && presetIds.has(id)) {
|
|
2595
|
-
error(`${fieldName}.id has duplicate preset id "${id}"`);
|
|
2596
|
-
}
|
|
2597
|
-
else if (id) {
|
|
2598
|
-
presetIds.add(id);
|
|
2599
|
-
}
|
|
2600
|
-
validateManifestString(preset.title, `${fieldName}.title`);
|
|
2601
|
-
if (preset.description !== undefined) {
|
|
2602
|
-
validateManifestString(preset.description, `${fieldName}.description`);
|
|
2603
|
-
}
|
|
2604
|
-
const values = expectRecord(preset.values, `${fieldName}.values`);
|
|
2605
|
-
if (!values)
|
|
2606
|
-
return;
|
|
2607
|
-
for (const [key, value] of Object.entries(values)) {
|
|
2608
|
-
if (!schemaKeys.has(key)) {
|
|
2609
|
-
error(`${fieldName}.values references unknown config key "${key}"`);
|
|
2610
|
-
continue;
|
|
2611
|
-
}
|
|
2612
|
-
const schemaField = schema[key];
|
|
2613
|
-
if (isRecord(schemaField)
|
|
2614
|
-
&& (schemaField.sensitive === true
|
|
2615
|
-
|| schemaField.type === 'file'
|
|
2616
|
-
|| schemaField.type === 'directory')) {
|
|
2617
|
-
error(`${fieldName}.values.${key} cannot contain sensitive, file, or directory config values`);
|
|
2618
|
-
continue;
|
|
2619
|
-
}
|
|
2620
|
-
validateConfigValueLightweight(schemaField, value, `${fieldName}.values.${key}`);
|
|
2621
|
-
}
|
|
2622
|
-
});
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
}
|
|
2626
|
-
function validateConfigSchemaLightweight(config) {
|
|
1487
|
+
function validateConfigSchemaLightweight(config, manifest) {
|
|
2627
1488
|
if (config === undefined)
|
|
2628
1489
|
return;
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
for (const [key, rawField] of Object.entries(schema)) {
|
|
2637
|
-
if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(key)) {
|
|
2638
|
-
error(`config.schema has invalid key "${key}"`);
|
|
2639
|
-
}
|
|
2640
|
-
const fieldName = `config.schema.${key}`;
|
|
2641
|
-
const field = expectRecord(rawField, fieldName);
|
|
2642
|
-
if (!field)
|
|
2643
|
-
continue;
|
|
2644
|
-
validateAllowedKeys(field, fieldName, [
|
|
2645
|
-
'type',
|
|
2646
|
-
'title',
|
|
2647
|
-
'description',
|
|
2648
|
-
'default',
|
|
2649
|
-
'required',
|
|
2650
|
-
'sensitive',
|
|
2651
|
-
'values',
|
|
2652
|
-
'min',
|
|
2653
|
-
'max',
|
|
2654
|
-
]);
|
|
2655
|
-
if (typeof field.type !== 'string' || !CONFIG_FIELD_TYPES.has(field.type)) {
|
|
2656
|
-
error(`${fieldName}.type must be string, number, boolean, enum, file, or directory`);
|
|
2657
|
-
}
|
|
2658
|
-
if (field.required !== undefined && typeof field.required !== 'boolean') {
|
|
2659
|
-
error(`${fieldName}.required must be a boolean`);
|
|
2660
|
-
}
|
|
2661
|
-
if (field.sensitive !== undefined && typeof field.sensitive !== 'boolean') {
|
|
2662
|
-
error(`${fieldName}.sensitive must be a boolean`);
|
|
2663
|
-
}
|
|
2664
|
-
if (field.values !== undefined) {
|
|
2665
|
-
if (field.type !== 'enum' || !Array.isArray(field.values) || field.values.length === 0) {
|
|
2666
|
-
error(`${fieldName}.values is only supported for enum config and must be non-empty`);
|
|
2667
|
-
}
|
|
2668
|
-
}
|
|
2669
|
-
else if (field.type === 'enum') {
|
|
2670
|
-
error(`${fieldName}.values is required for enum config`);
|
|
2671
|
-
}
|
|
2672
|
-
if (field.type !== 'number' && (field.min !== undefined || field.max !== undefined)) {
|
|
2673
|
-
error(`${fieldName}.min/max are only supported for number config`);
|
|
2674
|
-
}
|
|
2675
|
-
if (field.min !== undefined && typeof field.min !== 'number') {
|
|
2676
|
-
error(`${fieldName}.min must be a number`);
|
|
2677
|
-
}
|
|
2678
|
-
if (field.max !== undefined && typeof field.max !== 'number') {
|
|
2679
|
-
error(`${fieldName}.max must be a number`);
|
|
2680
|
-
}
|
|
2681
|
-
if (typeof field.min === 'number' && typeof field.max === 'number' && field.min > field.max) {
|
|
2682
|
-
error(`${fieldName}.min must be less than or equal to max`);
|
|
2683
|
-
}
|
|
1490
|
+
try {
|
|
1491
|
+
normalizePluginConfigDefinition(config, 'config', {
|
|
1492
|
+
plugin: manifest.name, dependencies: manifest.dependencies ?? [],
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
catch (validationError) {
|
|
1496
|
+
error(validationError instanceof Error ? validationError.message : String(validationError));
|
|
2684
1497
|
}
|
|
2685
|
-
validateConfigPresentationLightweight(configRoot.presentation, schema);
|
|
2686
|
-
}
|
|
2687
|
-
function configSchemaKeys(manifest) {
|
|
2688
|
-
const schema = manifest.config?.schema;
|
|
2689
|
-
return isRecord(schema) ? new Set(Object.keys(schema)) : new Set();
|
|
2690
|
-
}
|
|
2691
|
-
function configSchemaField(manifest, key) {
|
|
2692
|
-
const field = manifest.config?.schema?.[key];
|
|
2693
|
-
return isRecord(field) ? field : null;
|
|
2694
1498
|
}
|
|
2695
|
-
function defaultConfigValues(manifest) {
|
|
2696
|
-
const schema = manifest.config
|
|
1499
|
+
function defaultConfigValues(manifest, platform) {
|
|
1500
|
+
const schema = compilePluginConfigDefinition(manifest.config ?? { fields: {} }, platform).fields;
|
|
2697
1501
|
const values = {};
|
|
2698
1502
|
if (!isRecord(schema))
|
|
2699
1503
|
return values;
|
|
2700
1504
|
for (const [key, field] of Object.entries(schema)) {
|
|
2701
|
-
if (isRecord(field) &&
|
|
1505
|
+
if (isRecord(field) && field.default !== undefined) {
|
|
2702
1506
|
values[key] = field.default;
|
|
2703
1507
|
}
|
|
2704
1508
|
}
|
|
2705
1509
|
return values;
|
|
2706
1510
|
}
|
|
1511
|
+
function hasCrossPluginValueRef(value) {
|
|
1512
|
+
if (!isRecord(value))
|
|
1513
|
+
return false;
|
|
1514
|
+
if (isRecord(value.valueRef) && value.valueRef.plugin !== undefined)
|
|
1515
|
+
return true;
|
|
1516
|
+
return Object.values(value).some((child) => Array.isArray(child)
|
|
1517
|
+
? child.some(hasCrossPluginValueRef) : hasCrossPluginValueRef(child));
|
|
1518
|
+
}
|
|
1519
|
+
function configFieldContainsSensitiveValue(field) {
|
|
1520
|
+
if (!isRecord(field))
|
|
1521
|
+
return false;
|
|
1522
|
+
if (field.sensitive === true)
|
|
1523
|
+
return true;
|
|
1524
|
+
if (field.type !== 'object')
|
|
1525
|
+
return false;
|
|
1526
|
+
return ((isRecord(field.properties)
|
|
1527
|
+
&& Object.values(field.properties).some((child) => isRecord(child) && child.sensitive === true))
|
|
1528
|
+
|| (isRecord(field.additionalProperties)
|
|
1529
|
+
&& field.additionalProperties.sensitive === true));
|
|
1530
|
+
}
|
|
2707
1531
|
function validateArtifactId(value, fieldName) {
|
|
2708
1532
|
const id = validateManifestString(value, fieldName);
|
|
2709
1533
|
if (!id)
|
|
@@ -2713,33 +1537,6 @@ function validateArtifactId(value, fieldName) {
|
|
|
2713
1537
|
}
|
|
2714
1538
|
return id;
|
|
2715
1539
|
}
|
|
2716
|
-
function validateCodexRoleKey(value, fieldName) {
|
|
2717
|
-
const roleKey = validateManifestString(value, fieldName);
|
|
2718
|
-
if (!roleKey)
|
|
2719
|
-
return null;
|
|
2720
|
-
if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(roleKey)) {
|
|
2721
|
-
error(`${fieldName}: expected a valid Codex role key`);
|
|
2722
|
-
}
|
|
2723
|
-
return roleKey;
|
|
2724
|
-
}
|
|
2725
|
-
function validateCodexSkillKey(value, fieldName) {
|
|
2726
|
-
const skillKey = validateManifestString(value, fieldName);
|
|
2727
|
-
if (!skillKey)
|
|
2728
|
-
return null;
|
|
2729
|
-
if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(skillKey)) {
|
|
2730
|
-
error(`${fieldName}: expected a valid Codex skill key`);
|
|
2731
|
-
}
|
|
2732
|
-
return skillKey;
|
|
2733
|
-
}
|
|
2734
|
-
function validatePortableSkillKey(value, fieldName) {
|
|
2735
|
-
const skillKey = validateManifestString(value, fieldName);
|
|
2736
|
-
if (!skillKey)
|
|
2737
|
-
return null;
|
|
2738
|
-
if (skillKey.length > MAX_SKILL_NAME_LEN || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(skillKey)) {
|
|
2739
|
-
error(`${fieldName}: expected at most 64 ASCII lowercase hyphen-case characters`);
|
|
2740
|
-
}
|
|
2741
|
-
return skillKey;
|
|
2742
|
-
}
|
|
2743
1540
|
function validateStringArray(value, fieldName, options = {}) {
|
|
2744
1541
|
if (!Array.isArray(value)) {
|
|
2745
1542
|
error(`${fieldName} must be an array`);
|
|
@@ -2764,238 +1561,8 @@ function validateStringArray(value, fieldName, options = {}) {
|
|
|
2764
1561
|
}
|
|
2765
1562
|
return output;
|
|
2766
1563
|
}
|
|
2767
|
-
function
|
|
2768
|
-
|
|
2769
|
-
const target = expectRecord(entry, fieldName);
|
|
2770
|
-
if (!target)
|
|
2771
|
-
return null;
|
|
2772
|
-
validateAllowedKeys(target, fieldName, [
|
|
2773
|
-
'id',
|
|
2774
|
-
'platform',
|
|
2775
|
-
'distribution',
|
|
2776
|
-
'scopes',
|
|
2777
|
-
'target',
|
|
2778
|
-
'kind',
|
|
2779
|
-
'projectManagedKind',
|
|
2780
|
-
'states',
|
|
2781
|
-
'refreshKeys',
|
|
2782
|
-
'requiresCodexProjectConfig',
|
|
2783
|
-
'roleKey',
|
|
2784
|
-
'skillKey',
|
|
2785
|
-
'sourceDirs',
|
|
2786
|
-
'runtimeImports',
|
|
2787
|
-
]);
|
|
2788
|
-
const id = validateArtifactId(target.id, `${fieldName}.id`);
|
|
2789
|
-
const artifactTarget = validateManifestString(target.target, `${fieldName}.target`);
|
|
2790
|
-
if (artifactTarget && !ARTIFACT_TARGETS.has(artifactTarget)) {
|
|
2791
|
-
error(`${fieldName}.target: unsupported artifact target "${artifactTarget}"`);
|
|
2792
|
-
}
|
|
2793
|
-
const portable = artifactTarget === 'agent-skills.skill';
|
|
2794
|
-
const platform = portable || target.platform === undefined
|
|
2795
|
-
? undefined
|
|
2796
|
-
: validateManifestString(target.platform, `${fieldName}.platform`);
|
|
2797
|
-
const distribution = portable || target.distribution !== undefined
|
|
2798
|
-
? validateManifestString(target.distribution, `${fieldName}.distribution`)
|
|
2799
|
-
: undefined;
|
|
2800
|
-
if (portable) {
|
|
2801
|
-
if (distribution !== 'agent-skills') {
|
|
2802
|
-
error(`${fieldName}.distribution: expected "agent-skills"`);
|
|
2803
|
-
}
|
|
2804
|
-
if (target.platform !== undefined) {
|
|
2805
|
-
error(`${fieldName}.platform: distribution targets do not support platform`);
|
|
2806
|
-
}
|
|
2807
|
-
}
|
|
2808
|
-
else {
|
|
2809
|
-
const expectedPlatform = artifactTarget === 'claude.skill' ? 'claude' : 'codex';
|
|
2810
|
-
if (platform && artifactTarget && platform !== expectedPlatform) {
|
|
2811
|
-
error(`${fieldName}.platform: target "${artifactTarget}" must use "${expectedPlatform}"`);
|
|
2812
|
-
}
|
|
2813
|
-
if (target.distribution !== undefined) {
|
|
2814
|
-
error(`${fieldName}.distribution: platform targets do not support distribution`);
|
|
2815
|
-
}
|
|
2816
|
-
}
|
|
2817
|
-
const key = id && artifactTarget ? `${id}:${artifactTarget}` : null;
|
|
2818
|
-
if (key) {
|
|
2819
|
-
if (seen.has(key)) {
|
|
2820
|
-
error(`${fieldName}: duplicate artifact id + target "${key}"`);
|
|
2821
|
-
}
|
|
2822
|
-
seen.add(key);
|
|
2823
|
-
}
|
|
2824
|
-
const expectedKind = ARTIFACT_KIND_BY_TARGET[artifactTarget];
|
|
2825
|
-
const kind = target.kind === undefined
|
|
2826
|
-
? expectedKind
|
|
2827
|
-
: validateManifestString(target.kind, `${fieldName}.kind`);
|
|
2828
|
-
if (kind && !ARTIFACT_KINDS.has(kind)) {
|
|
2829
|
-
error(`${fieldName}.kind: unsupported artifact kind "${kind}"`);
|
|
2830
|
-
}
|
|
2831
|
-
if (expectedKind && kind && kind !== expectedKind) {
|
|
2832
|
-
error(`${fieldName}.kind: target "${artifactTarget}" requires kind "${expectedKind}"`);
|
|
2833
|
-
}
|
|
2834
|
-
const expectedProjectManagedKind = ARTIFACT_PROJECT_MANAGED_KIND_BY_TARGET[artifactTarget];
|
|
2835
|
-
const projectManagedKind = target.projectManagedKind === undefined
|
|
2836
|
-
? expectedProjectManagedKind
|
|
2837
|
-
: validateManifestString(target.projectManagedKind, `${fieldName}.projectManagedKind`);
|
|
2838
|
-
if (projectManagedKind && !ARTIFACT_PROJECT_MANAGED_KINDS.has(projectManagedKind)) {
|
|
2839
|
-
error(`${fieldName}.projectManagedKind: unsupported Codex project managed kind "${projectManagedKind}"`);
|
|
2840
|
-
}
|
|
2841
|
-
if (expectedProjectManagedKind &&
|
|
2842
|
-
projectManagedKind &&
|
|
2843
|
-
projectManagedKind !== expectedProjectManagedKind) {
|
|
2844
|
-
error(`${fieldName}.projectManagedKind: target "${artifactTarget}" must map to "${expectedProjectManagedKind}"`);
|
|
2845
|
-
}
|
|
2846
|
-
if (!expectedProjectManagedKind && projectManagedKind) {
|
|
2847
|
-
error(`${fieldName}.projectManagedKind: target "${artifactTarget}" does not support projectManagedKind`);
|
|
2848
|
-
}
|
|
2849
|
-
const scopes = validateStringArray(target.scopes, `${fieldName}.scopes`, {
|
|
2850
|
-
allowed: ARTIFACT_SCOPES,
|
|
2851
|
-
label: 'artifact scope',
|
|
2852
|
-
requireNonEmpty: true,
|
|
2853
|
-
});
|
|
2854
|
-
const states = validateStringArray(target.states, `${fieldName}.states`, {
|
|
2855
|
-
allowed: ARTIFACT_STATES,
|
|
2856
|
-
label: 'artifact state',
|
|
2857
|
-
requireNonEmpty: true,
|
|
2858
|
-
});
|
|
2859
|
-
const refreshKeys = validateStringArray(target.refreshKeys, `${fieldName}.refreshKeys`);
|
|
2860
|
-
const schemaKeys = configSchemaKeys(manifest);
|
|
2861
|
-
for (const [refreshIndex, refreshKey] of refreshKeys.entries()) {
|
|
2862
|
-
if (!schemaKeys.has(refreshKey)) {
|
|
2863
|
-
error(`${fieldName}.refreshKeys[${refreshIndex}]: unknown config key "${refreshKey}"`);
|
|
2864
|
-
continue;
|
|
2865
|
-
}
|
|
2866
|
-
const field = configSchemaField(manifest, refreshKey);
|
|
2867
|
-
if (scopes.includes('project') &&
|
|
2868
|
-
(field?.type === 'file' || field?.type === 'directory')) {
|
|
2869
|
-
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.`);
|
|
2870
|
-
}
|
|
2871
|
-
}
|
|
2872
|
-
if (target.requiresCodexProjectConfig !== undefined &&
|
|
2873
|
-
typeof target.requiresCodexProjectConfig !== 'boolean') {
|
|
2874
|
-
error(`${fieldName}.requiresCodexProjectConfig must be a boolean`);
|
|
2875
|
-
}
|
|
2876
|
-
if (artifactTarget === 'codex.skill' && target.requiresCodexProjectConfig === true) {
|
|
2877
|
-
error(`${fieldName}.requiresCodexProjectConfig: codex.skill writes the skill runtime and must not require Codex project config preflight`);
|
|
2878
|
-
}
|
|
2879
|
-
if ((platform === 'claude' || portable) && target.requiresCodexProjectConfig !== undefined) {
|
|
2880
|
-
error(`${fieldName}.requiresCodexProjectConfig: this target does not support the field`);
|
|
2881
|
-
}
|
|
2882
|
-
let roleKey;
|
|
2883
|
-
let skillKey;
|
|
2884
|
-
if (artifactTarget === 'codex.agentRole') {
|
|
2885
|
-
roleKey = validateCodexRoleKey(target.roleKey, `${fieldName}.roleKey`);
|
|
2886
|
-
if (!roleKey) {
|
|
2887
|
-
error(`${fieldName}.roleKey: codex.agentRole targets must declare a static roleKey`);
|
|
2888
|
-
}
|
|
2889
|
-
}
|
|
2890
|
-
else if (target.roleKey !== undefined) {
|
|
2891
|
-
error(`${fieldName}.roleKey: roleKey is only supported for codex.agentRole targets`);
|
|
2892
|
-
}
|
|
2893
|
-
if (artifactTarget === 'codex.skill' || artifactTarget === 'claude.skill' || portable) {
|
|
2894
|
-
skillKey = portable
|
|
2895
|
-
? validatePortableSkillKey(target.skillKey, `${fieldName}.skillKey`)
|
|
2896
|
-
: validateCodexSkillKey(target.skillKey, `${fieldName}.skillKey`);
|
|
2897
|
-
if (!skillKey) {
|
|
2898
|
-
error(`${fieldName}.skillKey: ${artifactTarget} targets must declare a static skillKey`);
|
|
2899
|
-
}
|
|
2900
|
-
}
|
|
2901
|
-
else if (target.skillKey !== undefined) {
|
|
2902
|
-
error(`${fieldName}.skillKey: skillKey is only supported for skill targets`);
|
|
2903
|
-
}
|
|
2904
|
-
const normalizedSourceDirs = Array.isArray(target.sourceDirs)
|
|
2905
|
-
? target.sourceDirs
|
|
2906
|
-
.filter((sourceDir) => typeof sourceDir === 'string' && sourceDir.trim() !== '')
|
|
2907
|
-
.map((sourceDir) => path.posix.normalize(sourceDir))
|
|
2908
|
-
: [];
|
|
2909
|
-
if (new Set(normalizedSourceDirs).size !== normalizedSourceDirs.length) {
|
|
2910
|
-
error(`${fieldName}.sourceDirs must not contain duplicate directories`);
|
|
2911
|
-
}
|
|
2912
|
-
const sourceDirs = target.sourceDirs === undefined
|
|
2913
|
-
? []
|
|
2914
|
-
: validateStringArray(target.sourceDirs, `${fieldName}.sourceDirs`);
|
|
2915
|
-
if (sourceDirs.length > 0 && artifactTarget !== 'codex.skill' && artifactTarget !== 'claude.skill' && !portable) {
|
|
2916
|
-
error(`${fieldName}.sourceDirs: sourceDirs are only supported for skill targets`);
|
|
2917
|
-
}
|
|
2918
|
-
for (const [sourceIndex, sourceDir] of sourceDirs.entries()) {
|
|
2919
|
-
const sourceField = `${fieldName}.sourceDirs[${sourceIndex}]`;
|
|
2920
|
-
if (!sourceDir.startsWith('./') || path.posix.isAbsolute(sourceDir)) {
|
|
2921
|
-
error(`${sourceField} must start with "./" and stay inside the plugin root`);
|
|
2922
|
-
continue;
|
|
2923
|
-
}
|
|
2924
|
-
const normalized = path.posix.normalize(sourceDir);
|
|
2925
|
-
if (normalized === '.' || normalized === '..' || normalized.startsWith('../')) {
|
|
2926
|
-
error(`${sourceField} must stay inside the plugin root`);
|
|
2927
|
-
continue;
|
|
2928
|
-
}
|
|
2929
|
-
const stats = fs.lstatSync(path.join(pluginDir, normalized), { throwIfNoEntry: false });
|
|
2930
|
-
if (!stats?.isDirectory() || stats.isSymbolicLink()) {
|
|
2931
|
-
error(`${sourceField} must point to an existing directory`);
|
|
2932
|
-
}
|
|
2933
|
-
if (skillKey && !portable &&
|
|
2934
|
-
normalized !== `skills/${skillKey}` &&
|
|
2935
|
-
!normalized.startsWith(`skills/${skillKey}/`)) {
|
|
2936
|
-
error(`${sourceField} must stay inside "./skills/${skillKey}"`);
|
|
2937
|
-
}
|
|
2938
|
-
if (skillKey && !portable &&
|
|
2939
|
-
isSkillAuthorOnlyPath(path.posix.relative(`skills/${skillKey}`, normalized))) {
|
|
2940
|
-
error(`${sourceField} must not point inside an author-only Skill directory`);
|
|
2941
|
-
}
|
|
2942
|
-
}
|
|
2943
|
-
if (skillKey && !portable &&
|
|
2944
|
-
sourceDirs.length > 0 &&
|
|
2945
|
-
!normalizedSourceDirs.includes(`skills/${skillKey}`)) {
|
|
2946
|
-
error(`${fieldName}.sourceDirs must include "./skills/${skillKey}" so README.md is published`);
|
|
2947
|
-
}
|
|
2948
|
-
return {
|
|
2949
|
-
id,
|
|
2950
|
-
platform,
|
|
2951
|
-
distribution,
|
|
2952
|
-
scopes,
|
|
2953
|
-
target: artifactTarget,
|
|
2954
|
-
kind,
|
|
2955
|
-
projectManagedKind,
|
|
2956
|
-
states,
|
|
2957
|
-
refreshKeys,
|
|
2958
|
-
roleKey,
|
|
2959
|
-
skillKey,
|
|
2960
|
-
sourceDirs,
|
|
2961
|
-
runtimeImports: Array.isArray(target.runtimeImports) ? target.runtimeImports : [],
|
|
2962
|
-
};
|
|
2963
|
-
}
|
|
2964
|
-
function validateArtifactsConfigLightweight(pluginDir, manifest) {
|
|
2965
|
-
if (manifest.artifacts === undefined)
|
|
2966
|
-
return [];
|
|
2967
|
-
const artifacts = expectRecord(manifest.artifacts, 'artifacts');
|
|
2968
|
-
if (!artifacts)
|
|
2969
|
-
return [];
|
|
2970
|
-
validateAllowedKeys(artifacts, 'artifacts', ['targets']);
|
|
2971
|
-
if (artifacts.targets === undefined)
|
|
2972
|
-
return [];
|
|
2973
|
-
if (!Array.isArray(artifacts.targets)) {
|
|
2974
|
-
error('artifacts.targets must be an array');
|
|
2975
|
-
return [];
|
|
2976
|
-
}
|
|
2977
|
-
const seen = new Set();
|
|
2978
|
-
const declarations = artifacts.targets
|
|
2979
|
-
.map((entry, index) => validateArtifactTargetEntry(entry, index, manifest, seen, pluginDir))
|
|
2980
|
-
.filter(Boolean);
|
|
2981
|
-
const owners = new Map();
|
|
2982
|
-
for (const declaration of declarations) {
|
|
2983
|
-
if ((declaration.target !== 'codex.skill' && declaration.target !== 'claude.skill' && declaration.target !== 'agent-skills.skill') ||
|
|
2984
|
-
!declaration.skillKey) {
|
|
2985
|
-
continue;
|
|
2986
|
-
}
|
|
2987
|
-
for (const scope of declaration.scopes) {
|
|
2988
|
-
const ownerKey = `${declaration.platform ?? declaration.distribution}:${scope}:${declaration.skillKey}`;
|
|
2989
|
-
const existing = owners.get(ownerKey);
|
|
2990
|
-
if (existing) {
|
|
2991
|
-
error(`artifacts.targets has duplicate skill ownership "${ownerKey}" in artifacts "${existing}" and "${declaration.id}"`);
|
|
2992
|
-
}
|
|
2993
|
-
else {
|
|
2994
|
-
owners.set(ownerKey, declaration.id);
|
|
2995
|
-
}
|
|
2996
|
-
}
|
|
2997
|
-
}
|
|
2998
|
-
return declarations;
|
|
1564
|
+
function validateArtifactsConfigLightweight(_pluginDir, manifest) {
|
|
1565
|
+
return (manifest.artifacts?.targets ?? []).map((target) => ({ ...target, sourceDirs: target.sourceDirs ?? [] }));
|
|
2999
1566
|
}
|
|
3000
1567
|
function validateArtifactPlanRefreshKeys(refreshKeys, declaration, fieldName) {
|
|
3001
1568
|
const keys = validateStringArray(refreshKeys, `${fieldName}.refreshKeys`);
|
|
@@ -3021,7 +1588,7 @@ function isSkillAuthorOnlyPath(relativePath) {
|
|
|
3021
1588
|
const [topLevel] = relativePath.split('/').filter(Boolean);
|
|
3022
1589
|
return topLevel === 'evals' || topLevel === 'reports';
|
|
3023
1590
|
}
|
|
3024
|
-
function collectArtifactSourceFiles(rootDir, fieldName, files) {
|
|
1591
|
+
function collectArtifactSourceFiles(rootDir, fieldName, files, transform = (_relative, bytes) => bytes) {
|
|
3025
1592
|
const rootStats = fs.lstatSync(rootDir, { throwIfNoEntry: false });
|
|
3026
1593
|
if (!rootStats?.isDirectory() || rootStats.isSymbolicLink())
|
|
3027
1594
|
return;
|
|
@@ -3045,7 +1612,7 @@ function collectArtifactSourceFiles(rootDir, fieldName, files) {
|
|
|
3045
1612
|
error(`${fieldName} contains unsupported non-regular file "${relativePath}"`);
|
|
3046
1613
|
continue;
|
|
3047
1614
|
}
|
|
3048
|
-
files.set(relativePath, fs.readFileSync(absolutePath));
|
|
1615
|
+
files.set(relativePath, transform(relativePath, fs.readFileSync(absolutePath)));
|
|
3049
1616
|
}
|
|
3050
1617
|
};
|
|
3051
1618
|
visit(rootDir, '');
|
|
@@ -3059,25 +1626,21 @@ function findArtifactFilePrefixConflict(files) {
|
|
|
3059
1626
|
}
|
|
3060
1627
|
return null;
|
|
3061
1628
|
}
|
|
3062
|
-
function authorRuntimeImportKey(artifactId, importIndex) {
|
|
3063
|
-
return `${artifactId}\0${importIndex}`;
|
|
1629
|
+
function authorRuntimeImportKey(artifactId, importIndex, platform) {
|
|
1630
|
+
return `${platform ?? "common"}\0${artifactId}\0${importIndex}`;
|
|
3064
1631
|
}
|
|
3065
1632
|
async function resolveAuthorRuntimeImports(options) {
|
|
3066
1633
|
const artifactImports = (options.manifest.artifacts?.targets ?? []).flatMap((target) => (target.runtimeImports ?? []).map((reference, importIndex) => ({
|
|
3067
|
-
key: authorRuntimeImportKey(target.id, importIndex),
|
|
1634
|
+
key: authorRuntimeImportKey(target.id, importIndex, target.platform),
|
|
3068
1635
|
label: `artifacts target ${JSON.stringify(target.id)} runtime import ${JSON.stringify(reference.name)}`,
|
|
3069
1636
|
purpose: 'artifact-runtime',
|
|
1637
|
+
platforms: target.platform ? [target.platform] : [undefined],
|
|
3070
1638
|
reference,
|
|
3071
1639
|
})));
|
|
3072
1640
|
const skillRuntimeImports = (options.manifest.buildConfig?.skillRuntimeFiles ?? []).flatMap((entry, importIndex) => {
|
|
3073
1641
|
if (!isRecord(entry.import))
|
|
3074
1642
|
return [];
|
|
3075
|
-
const platforms = [
|
|
3076
|
-
...(entry.platforms !== undefined || entry.distributions === undefined
|
|
3077
|
-
? (entry.platforms ?? [...resolveSupportedPlatforms(options.manifest)])
|
|
3078
|
-
: []),
|
|
3079
|
-
...(entry.distributions?.includes('agent-skills') ? [undefined] : []),
|
|
3080
|
-
];
|
|
1643
|
+
const platforms = entry.platforms?.length ? entry.platforms : [...resolveSupportedPlatforms(options.manifest)];
|
|
3081
1644
|
return platforms.length > 0 ? [{
|
|
3082
1645
|
key: importIndex,
|
|
3083
1646
|
label: `buildConfig.skillRuntimeFiles[${importIndex}].import`,
|
|
@@ -3165,10 +1728,10 @@ async function resolveAuthorRuntimeImports(options) {
|
|
|
3165
1728
|
skillRuntimeImports: resolvedSkillRuntimeFiles,
|
|
3166
1729
|
};
|
|
3167
1730
|
}
|
|
3168
|
-
function overlayPortableRuntimeFiles(files, manifest, pluginDir, skillKey, runtimeImports) {
|
|
1731
|
+
function overlayPortableRuntimeFiles(files, manifest, pluginDir, skillKey, runtimeImports, platform) {
|
|
3169
1732
|
for (const [runtimeIndex, runtimeFile] of (manifest.buildConfig?.skillRuntimeFiles ?? []).entries()) {
|
|
3170
1733
|
if (runtimeFile.skill !== skillKey
|
|
3171
|
-
|| !runtimeFile.
|
|
1734
|
+
|| (runtimeFile.platforms?.length && !runtimeFile.platforms.includes(platform)))
|
|
3172
1735
|
continue;
|
|
3173
1736
|
if (typeof runtimeFile.source === 'string') {
|
|
3174
1737
|
const sourcePath = path.join(pluginDir, normalizeRelativePath(runtimeFile.source));
|
|
@@ -3197,10 +1760,12 @@ function validateRenderedSkillTree(options) {
|
|
|
3197
1760
|
}
|
|
3198
1761
|
const files = new Map();
|
|
3199
1762
|
declaration.sourceDirs.forEach((sourceDir, index) => {
|
|
3200
|
-
collectArtifactSourceFiles(path.join(pluginDir, normalizeRelativePath(sourceDir)), `artifacts.targets sourceDirs[${index}] for artifact "${declaration.id}"`, files)
|
|
1763
|
+
collectArtifactSourceFiles(path.join(pluginDir, normalizeRelativePath(sourceDir)), `artifacts.targets sourceDirs[${index}] for artifact "${declaration.id}"`, files, (relative, bytes) => isTemplateTextFile(relative)
|
|
1764
|
+
? Buffer.from(renderTemplateForPlatform(manifest, `${normalizeRelativePath(sourceDir)}/${relative}`, bytes.toString('utf8'), declaration.platform))
|
|
1765
|
+
: bytes);
|
|
3201
1766
|
});
|
|
3202
1767
|
if (declaration.target === 'agent-skills.skill') {
|
|
3203
|
-
overlayPortableRuntimeFiles(files, manifest, pluginDir, declaration.skillKey, options.runtimeImports);
|
|
1768
|
+
overlayPortableRuntimeFiles(files, manifest, pluginDir, declaration.skillKey, options.runtimeImports, declaration.platform);
|
|
3204
1769
|
}
|
|
3205
1770
|
for (const [relativePath, content] of Object.entries(entry.content.files)) {
|
|
3206
1771
|
if (isSkillAuthorOnlyPath(relativePath)) {
|
|
@@ -3244,19 +1809,28 @@ function validateRenderedSkillTree(options) {
|
|
|
3244
1809
|
if (!readme || readme.toString('utf8').trim() === '') {
|
|
3245
1810
|
error(`${fieldName} final file tree must contain a non-empty README.md`);
|
|
3246
1811
|
}
|
|
3247
|
-
const sensitiveValues = Object.entries(manifest.config?.schema ?? {})
|
|
3248
|
-
.filter(([, field]) => isRecord(field) && field.sensitive === true)
|
|
3249
|
-
.map(([key, field]) => Object.prototype.hasOwnProperty.call(field, 'default')
|
|
3250
|
-
? String(field.default)
|
|
3251
|
-
: String(defaultConfigValues(manifest)[key] ?? ''))
|
|
3252
|
-
.filter(Boolean);
|
|
3253
1812
|
for (const [relativePath, content] of files) {
|
|
3254
1813
|
const text = content.toString('utf8');
|
|
3255
|
-
|
|
3256
|
-
|
|
1814
|
+
let remaining = text;
|
|
1815
|
+
if (relativePath.endsWith('.md')) {
|
|
1816
|
+
try {
|
|
1817
|
+
const placeholders = parseManagedCommandPlaceholders(text);
|
|
1818
|
+
if (placeholders.length > 0 && !(manifest.requires?.aw?.capabilities ?? []).includes('aw.managed-commands.v1')) {
|
|
1819
|
+
error(`${fieldName} managed command references require aw.managed-commands.v1`);
|
|
1820
|
+
}
|
|
1821
|
+
if (declaration.target === 'agent-skills.skill' && placeholders.length > 0) {
|
|
1822
|
+
error(`${fieldName} managedCommandPortableUnsupported: Portable Skills cannot contain managed command references`);
|
|
1823
|
+
}
|
|
1824
|
+
else if (options.managedTrees) {
|
|
1825
|
+
remaining = replaceManagedCommandPlaceholders(text, () => `cmdp_${'0'.repeat(16)}`);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
catch (cause) {
|
|
1829
|
+
error(`${fieldName} ${cause.message}`);
|
|
1830
|
+
}
|
|
3257
1831
|
}
|
|
3258
|
-
if (
|
|
3259
|
-
error(`${fieldName} final file tree
|
|
1832
|
+
if (/\{\{[^{}]+\}\}/u.test(remaining)) {
|
|
1833
|
+
error(`${fieldName} final file tree contains an unresolved template in "${relativePath}"`);
|
|
3260
1834
|
}
|
|
3261
1835
|
}
|
|
3262
1836
|
if (declaration.target === 'codex.skill') {
|
|
@@ -3274,39 +1848,34 @@ function validateRenderedSkillTree(options) {
|
|
|
3274
1848
|
if (declaration.target === 'codex.skill' && files.has('agents/openai.yaml')) {
|
|
3275
1849
|
validateOpenAiYaml(path.join(materializedRoot, 'agents', 'openai.yaml'), declaration.skillKey, true, manifest, materializedRoot, skillValidationTools);
|
|
3276
1850
|
}
|
|
1851
|
+
options.managedTrees?.push({ declaration, files, scope: options.managedScope });
|
|
3277
1852
|
}
|
|
3278
1853
|
function validateStaticPortableFinalTrees(pluginDir, manifest, runtimeImports, skillValidationTools) {
|
|
3279
|
-
|
|
3280
|
-
if (typeof portableRoot !== 'string')
|
|
1854
|
+
if (!manifest.skills)
|
|
3281
1855
|
return;
|
|
3282
|
-
const rootDir = path.join(pluginDir, normalizeRelativePath(
|
|
1856
|
+
const rootDir = path.join(pluginDir, normalizeRelativePath(manifest.skills));
|
|
3283
1857
|
const rootStats = fs.lstatSync(rootDir, { throwIfNoEntry: false });
|
|
3284
1858
|
if (!rootStats?.isDirectory() || rootStats.isSymbolicLink())
|
|
3285
1859
|
return;
|
|
3286
|
-
const dynamicKeys = new Set((manifest.artifacts?.targets ?? [])
|
|
3287
|
-
.filter((target) => target.target === 'agent-skills.skill' && typeof target.skillKey === 'string')
|
|
3288
|
-
.map((target) => target.skillKey));
|
|
3289
1860
|
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'aw-static-portable-final-'));
|
|
3290
1861
|
try {
|
|
3291
|
-
for (const
|
|
3292
|
-
if (!
|
|
1862
|
+
for (const platform of resolveSupportedPlatforms(manifest)) {
|
|
1863
|
+
if (!isPortablePlatformTarget(platform))
|
|
3293
1864
|
continue;
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
skillValidationTools,
|
|
3309
|
-
});
|
|
1865
|
+
const dynamicKeys = new Set((manifest.artifacts?.targets ?? [])
|
|
1866
|
+
.filter((target) => target.platform === platform && target.target === 'agent-skills.skill')
|
|
1867
|
+
.map((target) => target.skillKey));
|
|
1868
|
+
for (const entry of fs.readdirSync(rootDir, { withFileTypes: true })) {
|
|
1869
|
+
if (!entry.isDirectory() || dynamicKeys.has(entry.name))
|
|
1870
|
+
continue;
|
|
1871
|
+
validateRenderedSkillTree({
|
|
1872
|
+
entry: { state: 'present', content: { files: {} } },
|
|
1873
|
+
declaration: { id: `static:${entry.name}`, platform, distribution: 'agent-skills',
|
|
1874
|
+
target: 'agent-skills.skill', skillKey: entry.name, sourceDirs: [`${manifest.skills}/${entry.name}`] },
|
|
1875
|
+
fieldName: `static Portable Skill "${entry.name}" (${platform})`, pluginDir, manifest, runtimeImports,
|
|
1876
|
+
materializedRoot: path.join(tempRoot, platform, entry.name), skillValidationTools,
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
3310
1879
|
}
|
|
3311
1880
|
}
|
|
3312
1881
|
finally {
|
|
@@ -3333,6 +1902,12 @@ function validateRenderedArtifactPlan(plan, declarations, scopeLabel, options) {
|
|
|
3333
1902
|
const entry = expectRecord(artifact, fieldName);
|
|
3334
1903
|
if (!entry)
|
|
3335
1904
|
return;
|
|
1905
|
+
if (entry.target === 'aw.command-set' || entry.target === 'aw.command-package') {
|
|
1906
|
+
const declaration = byKey.get(`${entry.id}:${entry.target}`);
|
|
1907
|
+
if (declaration)
|
|
1908
|
+
returned.add(`${entry.id}:${entry.target}`);
|
|
1909
|
+
return; // Shared ArtifactPlan validation owns command response fields.
|
|
1910
|
+
}
|
|
3336
1911
|
validateAllowedKeys(entry, fieldName, [
|
|
3337
1912
|
'id',
|
|
3338
1913
|
'platform',
|
|
@@ -3362,11 +1937,8 @@ function validateRenderedArtifactPlan(plan, declarations, scopeLabel, options) {
|
|
|
3362
1937
|
if (entry.distribution !== declaration.distribution) {
|
|
3363
1938
|
error(`${fieldName}.distribution: expected "${declaration.distribution}"`);
|
|
3364
1939
|
}
|
|
3365
|
-
if (entry.platform !== undefined) {
|
|
3366
|
-
error(`${fieldName}.platform: distribution artifacts do not support platform`);
|
|
3367
|
-
}
|
|
3368
1940
|
}
|
|
3369
|
-
|
|
1941
|
+
if (entry.platform !== declaration.platform) {
|
|
3370
1942
|
error(`${fieldName}.platform: expected "${declaration.platform}"`);
|
|
3371
1943
|
}
|
|
3372
1944
|
if (entry.kind !== declaration.kind) {
|
|
@@ -3439,6 +2011,8 @@ function validateRenderedArtifactPlan(plan, declarations, scopeLabel, options) {
|
|
|
3439
2011
|
runtimeImports: options.runtimeImports,
|
|
3440
2012
|
materializedRoot: path.join(options.tempRoot, `${declaration.platform ?? declaration.distribution}-${scopeLabel.split('/')[1]}-${index}`),
|
|
3441
2013
|
skillValidationTools: options.skillValidationTools,
|
|
2014
|
+
managedTrees: options.managedTrees,
|
|
2015
|
+
managedScope: scopeLabel.split('/')[1],
|
|
3442
2016
|
});
|
|
3443
2017
|
}
|
|
3444
2018
|
}
|
|
@@ -3453,26 +2027,66 @@ function validateRenderedArtifactPlan(plan, declarations, scopeLabel, options) {
|
|
|
3453
2027
|
}
|
|
3454
2028
|
}
|
|
3455
2029
|
}
|
|
3456
|
-
function
|
|
2030
|
+
function resolveArtifactRendererFixtureRequests(declarations, manifest, requiresNonSensitiveArtifactInput) {
|
|
2031
|
+
const requests = new Map();
|
|
2032
|
+
for (const declaration of declarations) {
|
|
2033
|
+
const nativeSkill = declaration.target === 'codex.skill' || declaration.target === 'claude.skill';
|
|
2034
|
+
const surface = declaration.surface?.kind === 'aw' ? declaration.surface.name : declaration.platform;
|
|
2035
|
+
if (!surface)
|
|
2036
|
+
continue;
|
|
2037
|
+
for (const scope of nativeSkill ? ['user'] : declaration.scopes) {
|
|
2038
|
+
const key = `${nativeSkill ? 'native' : 'ordinary'}:${surface}:${scope}`;
|
|
2039
|
+
const request = requests.get(key) ?? { kind: nativeSkill ? 'native' : 'ordinary', surface, scope,
|
|
2040
|
+
configScope: nativeSkill ? 'user' : scope, declarations: [] };
|
|
2041
|
+
request.declarations.push(declaration);
|
|
2042
|
+
requests.set(key, request);
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
return [...requests.values()].flatMap((request) => {
|
|
2046
|
+
const definition = compilePluginConfigDefinition(manifest.config ?? { fields: {} }, MANIFEST_PLATFORMS.has(request.surface) ? request.surface : undefined);
|
|
2047
|
+
const hasNonSensitiveTarget = request.declarations.some(requiresNonSensitiveArtifactInput);
|
|
2048
|
+
const hasSensitiveOtherTarget = request.declarations.some((declaration) => !requiresNonSensitiveArtifactInput(declaration)
|
|
2049
|
+
&& declaration.refreshKeys.some((key) => configFieldContainsSensitiveValue(definition.fields[key])));
|
|
2050
|
+
if (!hasNonSensitiveTarget || !hasSensitiveOtherTarget)
|
|
2051
|
+
return [request];
|
|
2052
|
+
return [
|
|
2053
|
+
{ ...request, declarations: request.declarations.filter(requiresNonSensitiveArtifactInput) },
|
|
2054
|
+
{ ...request, declarations: request.declarations.filter((declaration) => !requiresNonSensitiveArtifactInput(declaration)) },
|
|
2055
|
+
];
|
|
2056
|
+
});
|
|
2057
|
+
}
|
|
2058
|
+
async function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, resolvedRuntimeImports, skillValidationTools, managedContext, requiresNonSensitiveArtifactInput, referenceContext) {
|
|
3457
2059
|
if (!renderEntry || declarations.length === 0)
|
|
3458
|
-
return;
|
|
3459
|
-
const
|
|
3460
|
-
const values = defaultConfigValues(manifest);
|
|
2060
|
+
return [];
|
|
2061
|
+
const requests = resolveArtifactRendererFixtureRequests(declarations, manifest, requiresNonSensitiveArtifactInput);
|
|
3461
2062
|
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'aw-artifact-render-'));
|
|
2063
|
+
const returnedArtifacts = [];
|
|
3462
2064
|
try {
|
|
3463
|
-
for (const
|
|
3464
|
-
const
|
|
3465
|
-
const distribution = surface
|
|
3466
|
-
const
|
|
2065
|
+
for (const [requestIndex, request] of requests.entries()) {
|
|
2066
|
+
const { kind, surface, scope, configScope, declarations: scopedDeclarations, } = request;
|
|
2067
|
+
const distribution = isPortablePlatformTarget(surface) ? 'agent-skills' : undefined;
|
|
2068
|
+
const awSurface = surface === 'managed-commands';
|
|
2069
|
+
const platform = awSurface ? undefined : surface;
|
|
2070
|
+
const definition = compilePluginConfigDefinition(manifest.config ?? { fields: {} }, platform);
|
|
2071
|
+
const values = defaultConfigValues(manifest, platform);
|
|
2072
|
+
const platformReferences = referenceContext ? { ...referenceContext, platform,
|
|
2073
|
+
plugins: Object.fromEntries(Object.entries(referenceContext.plugins).map(([name, entry]) => {
|
|
2074
|
+
const compiled = compilePluginConfigDefinition(entry.definition, platform);
|
|
2075
|
+
return [name, { ...entry, definition: compiled, values: defaultConfigValues({ config: compiled }) }];
|
|
2076
|
+
})),
|
|
2077
|
+
} : undefined;
|
|
3467
2078
|
const event = distribution ? 'materialize' : 'install';
|
|
3468
|
-
const
|
|
3469
|
-
|
|
3470
|
-
const
|
|
3471
|
-
const
|
|
3472
|
-
|
|
2079
|
+
const requestRoot = path.join(tempRoot, `${requestIndex}-${kind}-${surface}-${scope}`);
|
|
2080
|
+
const rendererAwHome = path.join(requestRoot, 'aw-home');
|
|
2081
|
+
const rendererCodexHome = path.join(requestRoot, 'codex-home');
|
|
2082
|
+
const rendererClaudeHome = path.join(requestRoot, 'claude-home');
|
|
2083
|
+
fs.mkdirSync(requestRoot, { recursive: true });
|
|
2084
|
+
const contextPath = path.join(requestRoot, 'context.json');
|
|
2085
|
+
const runtimeImports = scopedDeclarations.flatMap((target) => (target.runtimeImports ?? []).map((runtimeImport, importIndex) => {
|
|
2086
|
+
const resolved = resolvedRuntimeImports?.artifactImports.get(authorRuntimeImportKey(target.id, importIndex, target.platform));
|
|
3473
2087
|
if (!resolved)
|
|
3474
2088
|
return null;
|
|
3475
|
-
const importPath = path.join(
|
|
2089
|
+
const importPath = path.join(requestRoot, `runtime-${target.id}-${importIndex}`);
|
|
3476
2090
|
fs.writeFileSync(importPath, resolved.bytes);
|
|
3477
2091
|
return {
|
|
3478
2092
|
artifactId: target.id,
|
|
@@ -3483,9 +2097,43 @@ function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declaratio
|
|
|
3483
2097
|
digest: resolved.digest,
|
|
3484
2098
|
};
|
|
3485
2099
|
}).filter(Boolean));
|
|
2100
|
+
const refreshKeys = [...new Set(scopedDeclarations.flatMap((target) => target.refreshKeys))];
|
|
2101
|
+
const scopedSchema = Object.fromEntries(refreshKeys.flatMap((key) => definition.fields[key] === undefined ? [] : [[key, definition.fields[key]]]));
|
|
2102
|
+
const scopedValues = Object.fromEntries(refreshKeys.flatMap((key) => Object.prototype.hasOwnProperty.call(values, key) ? [[key, values[key]]] : []));
|
|
2103
|
+
try {
|
|
2104
|
+
if (manifest.config) {
|
|
2105
|
+
const issues = validatePluginConfigCandidate(definition, values, refreshKeys, platformReferences);
|
|
2106
|
+
if (issues.length > 0)
|
|
2107
|
+
throw new Error(formatPluginConfigIssue(issues[0]));
|
|
2108
|
+
}
|
|
2109
|
+
for (const target of scopedDeclarations.filter((declaration) => declaration.runtimeConfig)) {
|
|
2110
|
+
createRuntimeConfigSnapshot({
|
|
2111
|
+
installedIdentity: {
|
|
2112
|
+
sourceId: 'authoring',
|
|
2113
|
+
sourceIdentity: 'authoring',
|
|
2114
|
+
pluginId: `authoring/${manifest.name}`,
|
|
2115
|
+
pluginName: manifest.name,
|
|
2116
|
+
pluginVersion: manifest.version,
|
|
2117
|
+
platform: target.platform,
|
|
2118
|
+
scope: target.target === 'codex.skill' || target.target === 'claude.skill' ? 'user' : scope,
|
|
2119
|
+
configScope,
|
|
2120
|
+
artifactId: target.id,
|
|
2121
|
+
skillKey: target.skillKey,
|
|
2122
|
+
},
|
|
2123
|
+
declaration: target.runtimeConfig,
|
|
2124
|
+
definition,
|
|
2125
|
+
values,
|
|
2126
|
+
referenceContext: platformReferences,
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
catch (runtimeConfigError) {
|
|
2131
|
+
error(`scripts.artifacts.render fixture (${surface}/${scope}) runtime config failed: ${runtimeConfigError.message}`);
|
|
2132
|
+
continue;
|
|
2133
|
+
}
|
|
3486
2134
|
fs.writeFileSync(contextPath, JSON.stringify({
|
|
3487
2135
|
event,
|
|
3488
|
-
surface: distribution
|
|
2136
|
+
surface: awSurface ? { kind: 'aw', name: 'managed-commands' } : distribution
|
|
3489
2137
|
? { kind: 'distribution', name: distribution }
|
|
3490
2138
|
: { kind: 'platform', name: platform },
|
|
3491
2139
|
...(platform ? { platform } : {}),
|
|
@@ -3498,29 +2146,31 @@ function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declaratio
|
|
|
3498
2146
|
},
|
|
3499
2147
|
config: {
|
|
3500
2148
|
mode: 'artifact-render',
|
|
3501
|
-
targetScope:
|
|
3502
|
-
|
|
3503
|
-
values,
|
|
3504
|
-
sources: Object.fromEntries(Object.keys(
|
|
2149
|
+
targetScope: configScope,
|
|
2150
|
+
...(manifest.config?.fields === undefined ? {} : { schema: scopedSchema }),
|
|
2151
|
+
values: scopedValues,
|
|
2152
|
+
sources: Object.fromEntries(Object.keys(scopedValues).map((key) => [key, 'default'])),
|
|
3505
2153
|
issues: [],
|
|
3506
2154
|
},
|
|
3507
2155
|
changedConfigKeys: [],
|
|
2156
|
+
requestedArtifactIds: scopedDeclarations.map((target) => target.id),
|
|
3508
2157
|
previousArtifacts: [],
|
|
3509
|
-
artifactSources:
|
|
2158
|
+
artifactSources: declarations.filter((target) => (target.target === 'codex.skill' || target.target === 'claude.skill' || target.target === 'agent-skills.skill')
|
|
2159
|
+
&& target.platform === platform
|
|
2160
|
+
&& target.scopes.includes(scope)).map((target) => ({
|
|
3510
2161
|
id: target.id,
|
|
3511
2162
|
target: target.target,
|
|
3512
|
-
sourceDirs: target.sourceDirs.map((sourceDir) => path.join(pluginDir, normalizeRelativePath(sourceDir))),
|
|
2163
|
+
sourceDirs: (target.sourceDirs ?? []).map((sourceDir) => path.join(pluginDir, normalizeRelativePath(sourceDir))),
|
|
3513
2164
|
})),
|
|
2165
|
+
commandSources: (managedContext?.manifest.managedCommands?.packages ?? [])
|
|
2166
|
+
.filter((entry) => scopedDeclarations.some((target) => target.packageKey === entry.key))
|
|
2167
|
+
.map((entry) => ({ packageKey: entry.key, sourceDir: path.join(pluginDir, normalizeRelativePath(entry.sourceDir)) })),
|
|
3514
2168
|
runtimeImports,
|
|
3515
2169
|
paths: {
|
|
3516
|
-
awHome:
|
|
3517
|
-
codexHome:
|
|
3518
|
-
claudeHome:
|
|
2170
|
+
awHome: rendererAwHome,
|
|
2171
|
+
codexHome: rendererCodexHome,
|
|
2172
|
+
claudeHome: rendererClaudeHome,
|
|
3519
2173
|
manifestPath: path.join(pluginDir, '.agents-plugin', 'plugin.json'),
|
|
3520
|
-
configStores: {
|
|
3521
|
-
user: path.join(tempRoot, 'config-user.json'),
|
|
3522
|
-
project: path.join(tempRoot, 'config-project.json'),
|
|
3523
|
-
},
|
|
3524
2174
|
},
|
|
3525
2175
|
renderer: {
|
|
3526
2176
|
runner: renderEntry.runner,
|
|
@@ -3530,14 +2180,24 @@ function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declaratio
|
|
|
3530
2180
|
rendererDigest: 'author-validator-fixture',
|
|
3531
2181
|
},
|
|
3532
2182
|
}), 'utf8');
|
|
3533
|
-
const rendererHome = path.join(
|
|
3534
|
-
const rendererTemp = path.join(
|
|
2183
|
+
const rendererHome = path.join(requestRoot, 'home');
|
|
2184
|
+
const rendererTemp = path.join(requestRoot, 'tmp');
|
|
2185
|
+
for (const rendererStateHome of [rendererAwHome, rendererCodexHome, rendererClaudeHome]) {
|
|
2186
|
+
fs.mkdirSync(rendererStateHome, { recursive: true });
|
|
2187
|
+
}
|
|
3535
2188
|
fs.mkdirSync(rendererHome, { recursive: true });
|
|
3536
2189
|
fs.mkdirSync(rendererTemp, { recursive: true });
|
|
3537
2190
|
const rendererEnv = {
|
|
3538
|
-
AW_HOME:
|
|
3539
|
-
|
|
3540
|
-
|
|
2191
|
+
AW_HOME: rendererAwHome,
|
|
2192
|
+
CODEX_HOME: rendererCodexHome,
|
|
2193
|
+
CLAUDE_CONFIG_DIR: rendererClaudeHome,
|
|
2194
|
+
HOME: rendererHome,
|
|
2195
|
+
USERPROFILE: rendererHome,
|
|
2196
|
+
XDG_CONFIG_HOME: path.join(requestRoot, 'xdg-config'),
|
|
2197
|
+
XDG_CACHE_HOME: path.join(requestRoot, 'xdg-cache'),
|
|
2198
|
+
XDG_STATE_HOME: path.join(requestRoot, 'xdg-state'),
|
|
2199
|
+
XDG_DATA_HOME: path.join(requestRoot, 'xdg-data'),
|
|
2200
|
+
XDG_RUNTIME_DIR: path.join(requestRoot, 'xdg-runtime'),
|
|
3541
2201
|
PATH: process.env.PATH ?? process.env.Path ?? '',
|
|
3542
2202
|
AW_PLUGIN_CONTEXT: contextPath,
|
|
3543
2203
|
AW_PLUGIN_ROOT: pluginDir,
|
|
@@ -3546,10 +2206,10 @@ function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declaratio
|
|
|
3546
2206
|
AW_PLUGIN_EVENT: event,
|
|
3547
2207
|
...(platform ? { AW_PLUGIN_PLATFORM: platform } : {}),
|
|
3548
2208
|
...(distribution ? { AW_PLUGIN_DISTRIBUTION: distribution } : {}),
|
|
2209
|
+
...(awSurface ? { AW_PLUGIN_SURFACE: 'managed-commands' } : {}),
|
|
3549
2210
|
AW_PLUGIN_SCOPE: scope,
|
|
3550
2211
|
};
|
|
3551
2212
|
if (process.platform === 'win32') {
|
|
3552
|
-
rendererEnv.USERPROFILE = rendererHome;
|
|
3553
2213
|
rendererEnv.TEMP = rendererTemp;
|
|
3554
2214
|
rendererEnv.TMP = rendererTemp;
|
|
3555
2215
|
if (process.env.SystemRoot)
|
|
@@ -3558,7 +2218,6 @@ function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declaratio
|
|
|
3558
2218
|
rendererEnv.ComSpec = process.env.ComSpec;
|
|
3559
2219
|
}
|
|
3560
2220
|
else {
|
|
3561
|
-
rendererEnv.HOME = rendererHome;
|
|
3562
2221
|
rendererEnv.TMPDIR = rendererTemp;
|
|
3563
2222
|
}
|
|
3564
2223
|
const result = spawnSync(process.execPath, [path.join(pluginDir, renderEntry.path), ...(renderEntry.args ?? [])], {
|
|
@@ -3592,42 +2251,182 @@ function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declaratio
|
|
|
3592
2251
|
runtimeImports: resolvedRuntimeImports,
|
|
3593
2252
|
tempRoot,
|
|
3594
2253
|
skillValidationTools,
|
|
2254
|
+
managedTrees: managedContext?.trees,
|
|
3595
2255
|
});
|
|
2256
|
+
if (managedContext) {
|
|
2257
|
+
try {
|
|
2258
|
+
const validated = managedContext.tools.validateArtifactPlan({
|
|
2259
|
+
manifest: managedContext.manifest,
|
|
2260
|
+
plan,
|
|
2261
|
+
platform: surface,
|
|
2262
|
+
scope,
|
|
2263
|
+
requestedArtifactIds: scopedDeclarations.map((target) => target.id),
|
|
2264
|
+
renderConfig: { values: scopedValues, sources: Object.fromEntries(Object.keys(scopedValues).map((key) => [key, 'default'])), issues: [] },
|
|
2265
|
+
});
|
|
2266
|
+
returnedArtifacts.push(...validated.artifacts.map((artifact) => ({ artifact, scope, surface })));
|
|
2267
|
+
}
|
|
2268
|
+
catch (cause) {
|
|
2269
|
+
error(`${fieldName}: ${cause.message}`);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
3596
2272
|
}
|
|
3597
2273
|
}
|
|
3598
2274
|
finally {
|
|
3599
2275
|
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
3600
2276
|
}
|
|
2277
|
+
return returnedArtifacts;
|
|
3601
2278
|
}
|
|
3602
|
-
function validateDynamicArtifactsLightweight(pluginDir, manifest, renderEntry, runtimeImports, skillValidationTools) {
|
|
2279
|
+
async function validateDynamicArtifactsLightweight(pluginDir, manifest, renderEntry, runtimeImports, skillValidationTools, managedContext, requiresNonSensitiveArtifactInput, referenceContext) {
|
|
3603
2280
|
const declarations = validateArtifactsConfigLightweight(pluginDir, manifest);
|
|
2281
|
+
if (managedContext)
|
|
2282
|
+
declarations.push(...getManagedCommandArtifactTargets(managedContext.manifest));
|
|
3604
2283
|
const hasTargets = declarations.length > 0;
|
|
3605
2284
|
const hasRenderer = Boolean(manifest.scripts?.artifacts?.render);
|
|
3606
2285
|
if (hasTargets && !hasRenderer) {
|
|
3607
2286
|
error('artifacts.targets requires scripts.artifacts.render');
|
|
3608
2287
|
}
|
|
3609
2288
|
if (hasRenderer && !hasTargets) {
|
|
3610
|
-
error('scripts.artifacts.render requires artifacts.targets');
|
|
2289
|
+
error('scripts.artifacts.render requires artifacts.targets or dynamic managedCommands targets');
|
|
2290
|
+
}
|
|
2291
|
+
return runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, runtimeImports, skillValidationTools, managedContext, requiresNonSensitiveArtifactInput, referenceContext);
|
|
2292
|
+
}
|
|
2293
|
+
async function validateAuthorManagedCommands(pluginDir, manifest, rendered, context) {
|
|
2294
|
+
const { tools, trees } = context;
|
|
2295
|
+
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'aw-author-commands-'));
|
|
2296
|
+
const env = { AW_HOME: path.join(tempRoot, 'aw-home'), AW_CODEX_HOME: path.join(tempRoot, 'codex-home'), AW_CLAUDE_HOME: path.join(tempRoot, 'claude-home') };
|
|
2297
|
+
const plugin = { manifest, rootDir: pluginDir, sourceId: 'authoring', sourceIdentity: `sha256:${'0'.repeat(64)}` };
|
|
2298
|
+
const candidates = [];
|
|
2299
|
+
const cleanups = [];
|
|
2300
|
+
try {
|
|
2301
|
+
const root = manifest.skills && path.join(pluginDir, normalizeRelativePath(manifest.skills));
|
|
2302
|
+
if (root && fs.existsSync(root)) {
|
|
2303
|
+
for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
|
|
2304
|
+
if (!entry.isDirectory())
|
|
2305
|
+
continue;
|
|
2306
|
+
for (const platform of targetedPlatforms(manifest)) {
|
|
2307
|
+
if ((manifest.artifacts?.targets ?? []).some((target) => target.platform === platform && target.kind === 'skill' && target.skillKey === entry.name))
|
|
2308
|
+
continue;
|
|
2309
|
+
const files = new Map();
|
|
2310
|
+
collectArtifactSourceFiles(path.join(root, entry.name), `static Skill ${entry.name}`, files);
|
|
2311
|
+
for (const [relative, bytes] of files) {
|
|
2312
|
+
if (isTemplateTextFile(relative))
|
|
2313
|
+
files.set(relative, Buffer.from(renderTemplateForPlatform(manifest, `${normalizeRelativePath(manifest.skills)}/${entry.name}/${relative}`, bytes.toString('utf8'), platform)));
|
|
2314
|
+
}
|
|
2315
|
+
const producer = await tools.managedCommandProducerIdentity({
|
|
2316
|
+
plugin,
|
|
2317
|
+
producer: { kind: 'static-skill', platform, skillKey: entry.name },
|
|
2318
|
+
scope: 'user',
|
|
2319
|
+
cwd: pluginDir,
|
|
2320
|
+
});
|
|
2321
|
+
trees.push({ declaration: { target: `${platform}.skill`, platform, skillKey: entry.name, staticSkill: true }, files, scope: producer.scope });
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
const setOutputs = (set, platform, scope) => {
|
|
2326
|
+
if (set.mode === 'static')
|
|
2327
|
+
return { set: set.set, state: 'present', entries: set.entries };
|
|
2328
|
+
const output = rendered.find((entry) => entry.artifact.id === `command-set.${set.set}` && entry.scope === scope && entry.surface === platform)?.artifact;
|
|
2329
|
+
if (!output)
|
|
2330
|
+
throw new Error(`commandReferenceInvalid: dynamic command set ${set.set} was not returned`);
|
|
2331
|
+
return { set: set.set, state: output.state, entries: output.entries };
|
|
2332
|
+
};
|
|
2333
|
+
for (const commandPackage of manifest.managedCommands?.packages ?? []) {
|
|
2334
|
+
const sets = (manifest.managedCommands?.sets ?? [])
|
|
2335
|
+
.filter((set) => set.producer.kind === 'package' && set.producer.packageKey === commandPackage.key)
|
|
2336
|
+
.map((set) => setOutputs(set, 'managed-commands', commandPackage.scope));
|
|
2337
|
+
const sourceRoot = path.join(pluginDir, normalizeRelativePath(commandPackage.sourceDir));
|
|
2338
|
+
const files = { ...(rendered.find((entry) => entry.artifact.id === `command-package.${commandPackage.key}`)?.artifact.files ?? {}) };
|
|
2339
|
+
if (manifest.nativeTools) {
|
|
2340
|
+
const readerPath = path.join(pluginDir, normalizeRelativePath(manifest.nativeTools.reader));
|
|
2341
|
+
const relativeReader = path.relative(sourceRoot, readerPath);
|
|
2342
|
+
if (relativeReader && relativeReader !== '..' && !relativeReader.startsWith(`..${path.sep}`) && !path.isAbsolute(relativeReader) && !fs.existsSync(readerPath)) {
|
|
2343
|
+
const readerFile = relativeReader.split(path.sep).join('/');
|
|
2344
|
+
const readerSource = createNativeToolReaderSource();
|
|
2345
|
+
if (Object.hasOwn(files, readerFile) && files[readerFile] !== readerSource)
|
|
2346
|
+
throw new Error('nativeToolReaderMismatch');
|
|
2347
|
+
files[readerFile] = readerSource;
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
const prepared = await tools.prepareManagedCommandPackageFiles({ sourceRoot, files, entries: sets.flatMap((set) => set.entries) });
|
|
2351
|
+
cleanups.push(prepared.cleanup);
|
|
2352
|
+
candidates.push({ producer: await tools.managedCommandProducerIdentity({ plugin, producer: { kind: 'package', packageKey: commandPackage.key }, scope: commandPackage.scope, cwd: pluginDir }), sets });
|
|
2353
|
+
}
|
|
2354
|
+
for (const [index, tree] of trees.entries()) {
|
|
2355
|
+
const { declaration } = tree;
|
|
2356
|
+
const scope = declaration.target === 'codex.skill' || declaration.target === 'claude.skill' ? 'user' : tree.scope;
|
|
2357
|
+
if (declaration.platform !== 'codex' && declaration.platform !== 'claude')
|
|
2358
|
+
continue;
|
|
2359
|
+
const producer = declaration.staticSkill
|
|
2360
|
+
? { kind: 'static-skill', platform: declaration.platform, skillKey: declaration.skillKey }
|
|
2361
|
+
: { kind: 'artifact', artifactId: declaration.id };
|
|
2362
|
+
const sets = (manifest.managedCommands?.sets ?? []).filter((set) => JSON.stringify(set.producer) === JSON.stringify(producer))
|
|
2363
|
+
.map((set) => setOutputs(set, declaration.platform, scope));
|
|
2364
|
+
const resourceRoot = path.join(tempRoot, `skill-${index}`);
|
|
2365
|
+
for (const [relative, bytes] of tree.files) {
|
|
2366
|
+
const target = path.join(resourceRoot, ...relative.split('/'));
|
|
2367
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
2368
|
+
fs.writeFileSync(target, bytes);
|
|
2369
|
+
}
|
|
2370
|
+
await validateCommandEntryFiles(resourceRoot, sets.flatMap((set) => set.entries));
|
|
2371
|
+
candidates.push({ producer: await tools.managedCommandProducerIdentity({ plugin, producer, scope, cwd: pluginDir }), sets });
|
|
2372
|
+
}
|
|
2373
|
+
for (const tree of trees) {
|
|
2374
|
+
if (tree.declaration.platform !== 'codex' && tree.declaration.platform !== 'claude')
|
|
2375
|
+
continue;
|
|
2376
|
+
const scope = tree.declaration.target === 'codex.skill' || tree.declaration.target === 'claude.skill' ? 'user' : tree.scope;
|
|
2377
|
+
const resolve = await tools.createManagedCommandReferenceResolver({ plugin, platform: tree.declaration.platform, scope, cwd: pluginDir, env, candidates });
|
|
2378
|
+
for (const [relative, bytes] of tree.files) {
|
|
2379
|
+
if (!relative.endsWith('.md'))
|
|
2380
|
+
continue;
|
|
2381
|
+
const text = bytes.toString('utf8');
|
|
2382
|
+
if (parseManagedCommandPlaceholders(text).length > 0 && !(manifest.requires?.aw?.capabilities ?? []).includes('aw.managed-commands.v1'))
|
|
2383
|
+
throw new Error('managed command references require aw.managed-commands.v1');
|
|
2384
|
+
replaceManagedCommandPlaceholders(text, resolve);
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
for (const permission of manifest.extensions?.permissions ?? []) {
|
|
2388
|
+
for (const platform of targetedPlatforms(manifest)) {
|
|
2389
|
+
for (const scope of platform === 'codex' ? ['user'] : ['user', 'project']) {
|
|
2390
|
+
const resolve = await tools.createManagedCommandReferenceResolver({ plugin, platform, scope, cwd: pluginDir, env, candidates });
|
|
2391
|
+
const override = permission.agentOverrides?.[platform];
|
|
2392
|
+
if (override === null)
|
|
2393
|
+
continue;
|
|
2394
|
+
for (const decision of ['allow', 'ask', 'deny'])
|
|
2395
|
+
for (const rule of override?.[decision] ?? permission[decision] ?? [])
|
|
2396
|
+
if (typeof rule !== 'string')
|
|
2397
|
+
resolve(rule.command);
|
|
2398
|
+
if (platform === 'claude')
|
|
2399
|
+
for (const rule of override?.sandbox?.excludedCommands ?? [])
|
|
2400
|
+
resolve(rule.command);
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
catch (cause) {
|
|
2406
|
+
error(`managed command authoring candidate: ${cause.message}`);
|
|
2407
|
+
}
|
|
2408
|
+
finally {
|
|
2409
|
+
for (const cleanup of cleanups)
|
|
2410
|
+
await cleanup();
|
|
2411
|
+
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
3611
2412
|
}
|
|
3612
|
-
runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, runtimeImports, skillValidationTools);
|
|
3613
2413
|
}
|
|
3614
2414
|
function validateScriptsLightweight(pluginDir, manifest) {
|
|
3615
|
-
validateConfigSchemaLightweight(manifest.config);
|
|
2415
|
+
validateConfigSchemaLightweight(manifest.config, manifest);
|
|
3616
2416
|
if (manifest.scripts === undefined)
|
|
3617
2417
|
return null;
|
|
3618
2418
|
const scripts = expectRecord(manifest.scripts, 'scripts');
|
|
3619
2419
|
if (!scripts)
|
|
3620
2420
|
return null;
|
|
3621
|
-
validateAllowedKeys(scripts, 'scripts', ['
|
|
3622
|
-
if (scripts.timeoutMs !== undefined &&
|
|
3623
|
-
(!Number.isInteger(scripts.timeoutMs) ||
|
|
3624
|
-
scripts.timeoutMs < SCRIPT_TIMEOUT_MIN_MS ||
|
|
3625
|
-
scripts.timeoutMs > SCRIPT_TIMEOUT_MAX_MS)) {
|
|
3626
|
-
error(`scripts.timeoutMs must be an integer between ${SCRIPT_TIMEOUT_MIN_MS} and ${SCRIPT_TIMEOUT_MAX_MS}`);
|
|
3627
|
-
}
|
|
2421
|
+
validateAllowedKeys(scripts, 'scripts', ['preApply', 'helpers', 'node', 'artifacts', 'tests']);
|
|
3628
2422
|
const runtimeNodeEntries = [];
|
|
3629
2423
|
let artifactRenderEntry = null;
|
|
3630
2424
|
let packageMeta = null;
|
|
2425
|
+
const nativeToolReader = manifest.nativeTools ? normalizeRelativePath(manifest.nativeTools.reader ?? './.aw/native-tool-reader.mjs') : undefined;
|
|
2426
|
+
const runtimeConfigSkillRoots = (manifest.artifacts?.targets ?? [])
|
|
2427
|
+
.filter((target) => target.runtimeConfig !== undefined)
|
|
2428
|
+
.flatMap((target) => target.sourceDirs ?? [])
|
|
2429
|
+
.map(normalizeRelativePath);
|
|
3631
2430
|
if (scripts.helpers !== undefined) {
|
|
3632
2431
|
const helpers = expectRecord(scripts.helpers, 'scripts.helpers');
|
|
3633
2432
|
if (helpers) {
|
|
@@ -3641,17 +2440,21 @@ function validateScriptsLightweight(pluginDir, manifest) {
|
|
|
3641
2440
|
runtimeNodeEntries.push({ path: helperPath, fieldName: 'scripts.helpers.config' });
|
|
3642
2441
|
}
|
|
3643
2442
|
}
|
|
3644
|
-
if (scripts.
|
|
3645
|
-
const
|
|
3646
|
-
if (
|
|
3647
|
-
validateAllowedKeys(
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
}
|
|
3653
|
-
validateLifecycleDefinition(pluginDir, definition, `scripts.lifecycle.${eventName}`, runtimeNodeEntries);
|
|
2443
|
+
if (scripts.preApply !== undefined) {
|
|
2444
|
+
const preApply = expectRecord(scripts.preApply, 'scripts.preApply');
|
|
2445
|
+
if (preApply) {
|
|
2446
|
+
validateAllowedKeys(preApply, 'scripts.preApply', ['path', 'timeoutMs']);
|
|
2447
|
+
const preApplyPath = normalizePluginScriptPath(pluginDir, preApply.path, 'scripts.preApply.path');
|
|
2448
|
+
validateDeclaredScriptFile(pluginDir, preApplyPath, 'scripts.preApply.path');
|
|
2449
|
+
if (preApplyPath && !isNodeRunnablePath(preApplyPath)) {
|
|
2450
|
+
error('scripts.preApply.path must use a Node runnable extension (.js, .mjs, or .cjs)');
|
|
3654
2451
|
}
|
|
2452
|
+
if (preApply.timeoutMs !== undefined && (!Number.isInteger(preApply.timeoutMs)
|
|
2453
|
+
|| preApply.timeoutMs < SCRIPT_TIMEOUT_MIN_MS || preApply.timeoutMs > SCRIPT_TIMEOUT_MAX_MS)) {
|
|
2454
|
+
error(`scripts.preApply.timeoutMs must be an integer between ${SCRIPT_TIMEOUT_MIN_MS} and ${SCRIPT_TIMEOUT_MAX_MS}`);
|
|
2455
|
+
}
|
|
2456
|
+
if (preApplyPath)
|
|
2457
|
+
runtimeNodeEntries.push({ path: preApplyPath, fieldName: 'scripts.preApply.path' });
|
|
3655
2458
|
}
|
|
3656
2459
|
}
|
|
3657
2460
|
if (scripts.node !== undefined) {
|
|
@@ -3671,6 +2474,8 @@ function validateScriptsLightweight(pluginDir, manifest) {
|
|
|
3671
2474
|
label: 'scripts.node.build import contract',
|
|
3672
2475
|
packageMeta,
|
|
3673
2476
|
allowDevDependencies: true,
|
|
2477
|
+
runtimeConfigSkillRoots,
|
|
2478
|
+
nativeToolReader,
|
|
3674
2479
|
});
|
|
3675
2480
|
}
|
|
3676
2481
|
}
|
|
@@ -3720,6 +2525,8 @@ function validateScriptsLightweight(pluginDir, manifest) {
|
|
|
3720
2525
|
label: 'scripts.tests.node import contract',
|
|
3721
2526
|
packageMeta,
|
|
3722
2527
|
allowDevDependencies: true,
|
|
2528
|
+
runtimeConfigSkillRoots,
|
|
2529
|
+
nativeToolReader,
|
|
3723
2530
|
});
|
|
3724
2531
|
}
|
|
3725
2532
|
}
|
|
@@ -3729,6 +2536,8 @@ function validateScriptsLightweight(pluginDir, manifest) {
|
|
|
3729
2536
|
label: 'runtime Node import contract',
|
|
3730
2537
|
packageMeta,
|
|
3731
2538
|
allowDevDependencies: false,
|
|
2539
|
+
runtimeConfigSkillRoots,
|
|
2540
|
+
nativeToolReader,
|
|
3732
2541
|
});
|
|
3733
2542
|
return artifactRenderEntry;
|
|
3734
2543
|
}
|
|
@@ -3793,7 +2602,7 @@ function warnCodexProjectScopeLimitations(manifest) {
|
|
|
3793
2602
|
return;
|
|
3794
2603
|
}
|
|
3795
2604
|
if (manifest.apps) {
|
|
3796
|
-
warn('Codex project scope does not support apps; users must install this app surface with `aw install <plugin>
|
|
2605
|
+
warn('Codex project scope does not support apps; users must install this app surface with `aw plugin install <plugin> --target codex --scope user` or split the plugin.');
|
|
3797
2606
|
}
|
|
3798
2607
|
if (!hasCodexRepoManagedSurface(manifest)) {
|
|
3799
2608
|
warn('This Codex-targeted plugin has no repo-managed project surface; Codex project scope will fail fast and only Codex user native install is applicable.');
|
|
@@ -3858,8 +2667,6 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
|
|
|
3858
2667
|
const skillsDir = path.join(pluginDir, manifest.skills);
|
|
3859
2668
|
if (!fs.existsSync(skillsDir))
|
|
3860
2669
|
return;
|
|
3861
|
-
const requiresCodexMetadata = isCodexTargeted(manifest);
|
|
3862
|
-
const targetsClaude = isClaudeTargeted(manifest);
|
|
3863
2670
|
const skillDirs = fs
|
|
3864
2671
|
.readdirSync(skillsDir, { withFileTypes: true })
|
|
3865
2672
|
.filter((d) => d.isDirectory());
|
|
@@ -3867,6 +2674,11 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
|
|
|
3867
2674
|
error('skills directory exists but contains no skill subdirectories');
|
|
3868
2675
|
}
|
|
3869
2676
|
for (const dir of skillDirs) {
|
|
2677
|
+
const staticPlatforms = [...resolveSupportedPlatforms(manifest)].filter((platform) => !(manifest.artifacts?.targets ?? []).some((target) => target.platform === platform && target.skillKey === dir.name));
|
|
2678
|
+
if (staticPlatforms.length === 0)
|
|
2679
|
+
continue;
|
|
2680
|
+
const requiresCodexMetadata = staticPlatforms.includes('codex');
|
|
2681
|
+
const targetsClaude = staticPlatforms.includes('claude');
|
|
3870
2682
|
const skillPath = path.join(skillsDir, dir.name);
|
|
3871
2683
|
const skillMdPath = path.join(skillPath, 'SKILL.md');
|
|
3872
2684
|
const openaiYamlPath = path.join(skillPath, 'agents', 'openai.yaml');
|
|
@@ -3880,7 +2692,7 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
|
|
|
3880
2692
|
if (lineCount >= MAX_SKILL_LINES) {
|
|
3881
2693
|
warn(`skills/${dir.name}/SKILL.md has ${lineCount} lines; Agent Skills recommends keeping SKILL.md under ${MAX_SKILL_LINES} lines`);
|
|
3882
2694
|
}
|
|
3883
|
-
const variants = renderedContentVariants(manifest, skillMdRelativePath, content,
|
|
2695
|
+
const variants = renderedContentVariants(manifest, skillMdRelativePath, content, staticPlatforms);
|
|
3884
2696
|
for (const variant of variants) {
|
|
3885
2697
|
const sourceName = variant.platform
|
|
3886
2698
|
? `skills/${dir.name}/SKILL.md (${variant.platform} render)`
|
|
@@ -3894,7 +2706,7 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
|
|
|
3894
2706
|
error(`${entry.path} [${entry.code}] ${entry.message}`);
|
|
3895
2707
|
}
|
|
3896
2708
|
if (parsed.frontmatter) {
|
|
3897
|
-
const profile = options.strictAgentSkills || !targetsClaude
|
|
2709
|
+
const profile = options.strictAgentSkills || !targetsClaude || isPortablePlatformTarget(variant.platform)
|
|
3898
2710
|
? 'portable-agent-skills'
|
|
3899
2711
|
: options.claudeSkillProfile === 'current'
|
|
3900
2712
|
? 'claude-current'
|
|
@@ -4127,11 +2939,9 @@ function validateSlashCommands(pluginDir, manifest) {
|
|
|
4127
2939
|
// ---------------------------------------------------------------------------
|
|
4128
2940
|
function printUsage() {
|
|
4129
2941
|
console.log(`Usage:
|
|
4130
|
-
aw plugin validate <plugin-directory> [options]
|
|
2942
|
+
aw dev plugin validate <plugin-directory> [options]
|
|
4131
2943
|
|
|
4132
2944
|
Options:
|
|
4133
|
-
--catalog-min-version <semver>
|
|
4134
|
-
Validate compatibility.aw.minVersion against a target catalog.
|
|
4135
2945
|
--strict-agent-skills Allow only Agent Skills portable core frontmatter.
|
|
4136
2946
|
--claude-skill-profile <minimum|current>
|
|
4137
2947
|
Validate Claude fields at AW minimum 2.1.88 (default) or current docs.
|
|
@@ -4200,20 +3010,70 @@ async function validatePluginDir(pluginDir, options) {
|
|
|
4200
3010
|
}
|
|
4201
3011
|
}
|
|
4202
3012
|
const skillValidationTools = await tryLoadCliSkillValidationTools();
|
|
3013
|
+
const sourceConfig = manifest.config;
|
|
3014
|
+
let normalizedManifest;
|
|
3015
|
+
let referenceContext;
|
|
4203
3016
|
try {
|
|
4204
|
-
await cliManifestTools.validateSourcePluginManifest(pluginDir, manifest);
|
|
3017
|
+
normalizedManifest = await cliManifestTools.validateSourcePluginManifest(pluginDir, manifest);
|
|
3018
|
+
manifest = normalizedManifest;
|
|
3019
|
+
// The Workspace is the sole source of dependency definitions and defaults.
|
|
3020
|
+
// No installed plugin or user config can complete an author fixture.
|
|
3021
|
+
if (manifest.config) {
|
|
3022
|
+
let plugins = [{ manifest, rootDir: pluginDir }];
|
|
3023
|
+
if (hasCrossPluginValueRef(sourceConfig)) {
|
|
3024
|
+
if (!options.repoRoot)
|
|
3025
|
+
throw new Error('Cross-plugin config validation requires the canonical same-source Workspace.');
|
|
3026
|
+
const workspace = await readCatalogWorkspace(options.repoRoot, {
|
|
3027
|
+
reservedImports: cliManifestTools.reservedImports,
|
|
3028
|
+
});
|
|
3029
|
+
if (!workspace.plugins.some((plugin) => plugin.manifest.name === manifest.name
|
|
3030
|
+
&& plugin.rootDir === fs.realpathSync(pluginDir))) {
|
|
3031
|
+
throw new Error('Cross-plugin config validation requires the canonical same-source Workspace plugin.');
|
|
3032
|
+
}
|
|
3033
|
+
plugins = workspace.plugins;
|
|
3034
|
+
}
|
|
3035
|
+
referenceContext = {
|
|
3036
|
+
plugin: manifest.name,
|
|
3037
|
+
dependencies: manifest.dependencies ?? [],
|
|
3038
|
+
plugins: Object.fromEntries(plugins.map((plugin) => [plugin.manifest.name, {
|
|
3039
|
+
definition: plugin.manifest.config ?? { fields: {} },
|
|
3040
|
+
dependencies: plugin.manifest.dependencies ?? [],
|
|
3041
|
+
values: defaultConfigValues(plugin.manifest),
|
|
3042
|
+
}])),
|
|
3043
|
+
};
|
|
3044
|
+
assertPluginConfigReferenceSchemas(manifest.config, referenceContext, sourceConfig);
|
|
3045
|
+
}
|
|
3046
|
+
const requirements = await cliManifestTools.resolvePluginRequirements({
|
|
3047
|
+
pluginRoot: pluginDir,
|
|
3048
|
+
manifest: normalizedManifest,
|
|
3049
|
+
implementedCapabilities: cliManifestTools.implementedCapabilities,
|
|
3050
|
+
});
|
|
3051
|
+
if (requirements.unsupportedByCurrentAw.length > 0) {
|
|
3052
|
+
capabilityDiagnostic = {
|
|
3053
|
+
errorCode: 'awCapabilityUnsupported',
|
|
3054
|
+
missingCapabilities: requirements.unsupportedByCurrentAw,
|
|
3055
|
+
availableCapabilities: [...cliManifestTools.implementedCapabilities].sort(),
|
|
3056
|
+
};
|
|
3057
|
+
error(`[awCapabilityUnsupported] missingCapabilities=${JSON.stringify(requirements.unsupportedByCurrentAw)}`);
|
|
3058
|
+
}
|
|
3059
|
+
const satisfiedCapabilities = new Set([...requirements.declared, ...requirements.derived]);
|
|
3060
|
+
const advisoryObservations = requirements.observations.filter((observation) => (observation.code !== 'aw-command-detected'
|
|
3061
|
+
|| observation.capability === undefined
|
|
3062
|
+
|| !satisfiedCapabilities.has(observation.capability)));
|
|
3063
|
+
for (const observation of advisoryObservations) {
|
|
3064
|
+
warn(`[awCapabilityObservation] ${observation.path}: ${observation.message}`);
|
|
3065
|
+
}
|
|
4205
3066
|
}
|
|
4206
3067
|
catch (e) {
|
|
4207
3068
|
error(e.message);
|
|
3069
|
+
return;
|
|
4208
3070
|
}
|
|
4209
3071
|
validatePlatformFieldSupport(manifest);
|
|
4210
|
-
validatePortableNativeArtifactCapabilityLightweight(manifest);
|
|
4211
3072
|
validateNameMatchesDirectory(pluginDir, manifest);
|
|
4212
3073
|
validateNoBuildOutputDirs(pluginDir);
|
|
4213
3074
|
validateDeclaredNativeAssets(pluginDir, manifest);
|
|
4214
3075
|
validateCanonicalSkillLayout(pluginDir, manifest);
|
|
4215
|
-
|
|
4216
|
-
validatePluginEvalManifest(pluginDir, manifest);
|
|
3076
|
+
await validatePluginEvalManifest(pluginDir, manifest);
|
|
4217
3077
|
const artifactRenderEntry = validateScriptsLightweight(pluginDir, manifest);
|
|
4218
3078
|
const runtimeImports = await resolveAuthorRuntimeImports({
|
|
4219
3079
|
pluginDir,
|
|
@@ -4222,7 +3082,12 @@ async function validatePluginDir(pluginDir, options) {
|
|
|
4222
3082
|
cliManifestTools,
|
|
4223
3083
|
});
|
|
4224
3084
|
validateStaticPortableFinalTrees(pluginDir, manifest, runtimeImports, skillValidationTools);
|
|
4225
|
-
|
|
3085
|
+
const managedContext = normalizedManifest
|
|
3086
|
+
? { manifest: normalizedManifest, tools: cliManifestTools, trees: [] }
|
|
3087
|
+
: undefined;
|
|
3088
|
+
const rendered = await validateDynamicArtifactsLightweight(pluginDir, manifest, artifactRenderEntry, runtimeImports, skillValidationTools, managedContext, cliManifestTools.requiresNonSensitiveArtifactInput, referenceContext);
|
|
3089
|
+
if (managedContext)
|
|
3090
|
+
await validateAuthorManagedCommands(pluginDir, normalizedManifest, rendered ?? [], managedContext);
|
|
4226
3091
|
validateMcpContent(pluginDir, manifest);
|
|
4227
3092
|
validateAppsContent(pluginDir, manifest);
|
|
4228
3093
|
warnCodexProjectScopeLimitations(manifest);
|
|
@@ -4263,7 +3128,6 @@ function parseArgs(argv) {
|
|
|
4263
3128
|
const args = argv.slice(2);
|
|
4264
3129
|
const options = {
|
|
4265
3130
|
pluginDir: null,
|
|
4266
|
-
catalogMinVersion: null,
|
|
4267
3131
|
strictAgentSkills: false,
|
|
4268
3132
|
claudeSkillProfile: 'minimum',
|
|
4269
3133
|
versionBase: 'HEAD',
|
|
@@ -4320,18 +3184,6 @@ function parseArgs(argv) {
|
|
|
4320
3184
|
}
|
|
4321
3185
|
exitCliError(`Unknown argument: ${arg}`, options.json);
|
|
4322
3186
|
}
|
|
4323
|
-
if (arg === '--catalog-min-version') {
|
|
4324
|
-
const value = args[index + 1];
|
|
4325
|
-
if (!value || value.startsWith('--')) {
|
|
4326
|
-
exitCliError('--catalog-min-version requires a value.', options.json);
|
|
4327
|
-
}
|
|
4328
|
-
index += 1;
|
|
4329
|
-
if (!STRICT_SEMVER_PATTERN.test(value)) {
|
|
4330
|
-
exitCliError(`Invalid --catalog-min-version: expected a strict SemVer 2.0.0 string. Received ${JSON.stringify(value)}.`, options.json);
|
|
4331
|
-
}
|
|
4332
|
-
options.catalogMinVersion = value;
|
|
4333
|
-
continue;
|
|
4334
|
-
}
|
|
4335
3187
|
exitCliError(`Unknown option: ${arg}`, options.json);
|
|
4336
3188
|
}
|
|
4337
3189
|
return options;
|
|
@@ -4363,7 +3215,6 @@ async function main() {
|
|
|
4363
3215
|
const repoRoot = requestedWorkspaceRoot ?? discoverCanonicalRepoRoot(repoRootCandidate);
|
|
4364
3216
|
const gitRoot = discoverCanonicalRepoRoot(findRepoRootCandidate(resolved));
|
|
4365
3217
|
await validatePluginDir(resolved, {
|
|
4366
|
-
catalogMinVersion: args.catalogMinVersion,
|
|
4367
3218
|
strictAgentSkills: args.strictAgentSkills,
|
|
4368
3219
|
claudeSkillProfile: args.claudeSkillProfile,
|
|
4369
3220
|
versionBase: args.versionBase,
|
|
@@ -4377,9 +3228,12 @@ async function main() {
|
|
|
4377
3228
|
profile: args.strictAgentSkills ? 'agent-skills-portable-core' : 'aw-source',
|
|
4378
3229
|
claudeSkillProfile: args.claudeSkillProfile,
|
|
4379
3230
|
pluginDirectory: resolved,
|
|
3231
|
+
workspaceRoot: process.env.AW_AUTHORING_WORKSPACE_ROOT ?? repoRoot,
|
|
3232
|
+
workspaceRootResolvedFrom: process.env.AW_AUTHORING_WORKSPACE_ROOT_RESOLVED_FROM ?? 'explicit',
|
|
4380
3233
|
versionCheck: pluginVersionCheckResult,
|
|
4381
3234
|
warnings,
|
|
4382
3235
|
errors,
|
|
3236
|
+
...(capabilityDiagnostic ?? {}),
|
|
4383
3237
|
}, null, 2));
|
|
4384
3238
|
if (errors.length > 0) {
|
|
4385
3239
|
process.exit(1);
|