@lesliechan721/aw 0.1.0-beta.9 → 0.1.0-beta.90
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 +221 -0
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
- package/dist/authoring/assets/command-runtime-config.d.mts +9 -0
- package/dist/authoring/assets/command-runtime-config.mjs +134 -0
- package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
- package/dist/authoring/scripts/add-skill.mjs +15 -38
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +72 -96
- 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 +230 -9
- package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.d.mts +2 -2
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +4 -7
- package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +396 -1997
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-skill.mjs +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +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 +11 -1
- package/dist/scripts/aw-skill-eval-materializer.js +118 -115
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/scripts/bundle-plugins.js +25 -7
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.d.ts +7 -7
- package/dist/scripts/plugin-staging.js +10 -8
- 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 +284 -78
- 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.map +1 -1
- package/dist/src/authoring/workspace-commands.d.ts +3 -0
- package/dist/src/authoring/workspace-commands.js +7 -2
- package/dist/src/authoring/workspace-commands.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +42 -21
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/catalog-dev-source.d.ts +42 -3
- package/dist/src/commands/catalog-dev-source.js +351 -43
- package/dist/src/commands/catalog-dev-source.js.map +1 -1
- package/dist/src/commands/catalog-generation.d.ts +8 -0
- package/dist/src/commands/catalog-generation.js +1 -5
- package/dist/src/commands/catalog-generation.js.map +1 -1
- package/dist/src/commands/catalog-publication-inspection.d.ts +42 -3
- package/dist/src/commands/catalog-publication-inspection.js +379 -48
- package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
- package/dist/src/commands/catalog-publication-journal.d.ts +23 -4
- package/dist/src/commands/catalog-publication-journal.js +165 -20
- package/dist/src/commands/catalog-publication-journal.js.map +1 -1
- package/dist/src/commands/catalog-publish.d.ts +34 -3
- package/dist/src/commands/catalog-publish.js +311 -165
- package/dist/src/commands/catalog-publish.js.map +1 -1
- package/dist/src/commands/catalog-source.d.ts +54 -8
- package/dist/src/commands/catalog-source.js +277 -15
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/catalog-status.js +2 -2
- 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 +4 -0
- package/dist/src/commands/catalog-workspace-resolution.js +18 -3
- package/dist/src/commands/catalog-workspace-resolution.js.map +1 -1
- package/dist/src/commands/console.js +33 -20
- package/dist/src/commands/console.js.map +1 -1
- package/dist/src/commands/dependency-operation-plan.d.ts +14 -56
- package/dist/src/commands/dependency-operation-plan.js +90 -133
- package/dist/src/commands/dependency-operation-plan.js.map +1 -1
- package/dist/src/commands/deployment-confirmation.d.ts +11 -0
- package/dist/src/commands/deployment-confirmation.js +88 -0
- package/dist/src/commands/deployment-confirmation.js.map +1 -0
- package/dist/src/commands/init.js +1 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/intent-command.d.ts +34 -0
- package/dist/src/commands/intent-command.js +174 -0
- package/dist/src/commands/intent-command.js.map +1 -0
- package/dist/src/commands/lifecycle-command-package.d.ts +45 -0
- package/dist/src/commands/lifecycle-command-package.js +199 -0
- package/dist/src/commands/lifecycle-command-package.js.map +1 -0
- package/dist/src/commands/managed-commands.d.ts +41 -0
- package/dist/src/commands/managed-commands.js +404 -0
- package/dist/src/commands/managed-commands.js.map +1 -0
- package/dist/src/commands/offline-cleanup-evidence.d.ts +29 -3
- package/dist/src/commands/offline-cleanup-evidence.js +80 -10
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
- package/dist/src/commands/operation-plan.d.ts +191 -0
- package/dist/src/commands/operation-plan.js +96 -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 +11 -20
- package/dist/src/commands/options.js +31 -36
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/permission-batch.d.ts +5 -0
- package/dist/src/commands/permission-batch.js +80 -0
- package/dist/src/commands/permission-batch.js.map +1 -0
- package/dist/src/commands/plugin-capabilities.js +96 -46
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-config-confirmation.d.ts +14 -0
- package/dist/src/commands/public-config-confirmation.js +73 -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 +106 -0
- package/dist/src/commands/public-lifecycle-result.js +518 -0
- package/dist/src/commands/public-lifecycle-result.js.map +1 -0
- package/dist/src/commands/public-lifecycle.d.ts +27 -0
- package/dist/src/commands/public-lifecycle.js +563 -0
- package/dist/src/commands/public-lifecycle.js.map +1 -0
- package/dist/src/commands/public-plugin-query.d.ts +16 -0
- package/dist/src/commands/public-plugin-query.js +230 -0
- package/dist/src/commands/public-plugin-query.js.map +1 -0
- package/dist/src/commands/rebuild-command.d.ts +176 -25
- package/dist/src/commands/rebuild-command.js +3989 -1392
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +133 -52
- package/dist/src/commands/rebuild-integration.js +1097 -2692
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +74 -23
- package/dist/src/commands/rebuild-operations.js +334 -227
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +81 -0
- package/dist/src/commands/rebuild-platform-integration.js +1992 -0
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
- package/dist/src/commands/reconcile-operation-plan.d.ts +31 -0
- package/dist/src/commands/reconcile-operation-plan.js +48 -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 +436 -0
- package/dist/src/commands/review-inspection.js.map +1 -0
- package/dist/src/commands/review-preparation.d.ts +51 -0
- package/dist/src/commands/review-preparation.js +400 -0
- package/dist/src/commands/review-preparation.js.map +1 -0
- package/dist/src/commands/runtime.d.ts +6 -6
- package/dist/src/commands/runtime.js +44 -24
- package/dist/src/commands/runtime.js.map +1 -1
- package/dist/src/commands/skill-eval.d.ts +8 -0
- package/dist/src/commands/skill-eval.js +126 -73
- package/dist/src/commands/skill-eval.js.map +1 -1
- package/dist/src/commands/status-v6.d.ts +185 -68
- package/dist/src/commands/status-v6.js +1592 -499
- package/dist/src/commands/status-v6.js.map +1 -1
- package/dist/src/commands/targets-command.d.ts +38 -0
- package/dist/src/commands/targets-command.js +182 -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 +7 -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 +144 -44
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/constants.d.ts +2 -3
- package/dist/src/constants.js +2 -3
- package/dist/src/constants.js.map +1 -1
- package/dist/src/eval/manifest-v1.d.ts +6 -2
- package/dist/src/eval/manifest-v1.js +58 -26
- package/dist/src/eval/manifest-v1.js.map +1 -1
- package/dist/src/generators/local-plugin.d.ts +4 -2
- package/dist/src/generators/local-plugin.js +207 -346
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/generators/permissions.d.ts +20 -2
- package/dist/src/generators/permissions.js +82 -15
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.d.ts +3 -33
- package/dist/src/index.js +1786 -1945
- 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 +35 -0
- package/dist/src/intent/scope-context.js +179 -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 +37 -86
- package/dist/src/output/command-receipt.js +257 -179
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/component-delivery.d.ts +28 -0
- package/dist/src/output/component-delivery.js +138 -0
- package/dist/src/output/component-delivery.js.map +1 -0
- package/dist/src/output/public-result.d.ts +69 -0
- package/dist/src/output/public-result.js +403 -0
- package/dist/src/output/public-result.js.map +1 -0
- package/dist/src/output/rebuild-progress.d.ts +3 -0
- package/dist/src/output/rebuild-progress.js +34 -16
- 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 +664 -0
- package/dist/src/output/receipt-projection.js.map +1 -0
- package/dist/src/output/skill-invocation-notices.d.ts +18 -0
- package/dist/src/output/skill-invocation-notices.js +84 -0
- package/dist/src/output/skill-invocation-notices.js.map +1 -0
- package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
- package/dist/src/platforms/antigravity-permissions.js +388 -0
- package/dist/src/platforms/antigravity-permissions.js.map +1 -0
- package/dist/src/platforms/capabilities.d.ts +17 -0
- package/dist/src/platforms/capabilities.js +328 -0
- package/dist/src/platforms/capabilities.js.map +1 -0
- package/dist/src/platforms/contracts.d.ts +402 -0
- package/dist/src/platforms/contracts.js +2 -0
- package/dist/src/platforms/contracts.js.map +1 -0
- package/dist/src/platforms/cursor-workspace-hook.d.ts +28 -0
- package/dist/src/platforms/cursor-workspace-hook.js +198 -0
- package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
- package/dist/src/platforms/discovery.d.ts +98 -0
- package/dist/src/platforms/discovery.js +777 -0
- package/dist/src/platforms/discovery.js.map +1 -0
- package/dist/src/platforms/grok-permission-config.d.ts +23 -0
- package/dist/src/platforms/grok-permission-config.js +184 -0
- package/dist/src/platforms/grok-permission-config.js.map +1 -0
- package/dist/src/platforms/grok-permission-document.d.ts +4 -0
- package/dist/src/platforms/grok-permission-document.js +145 -0
- package/dist/src/platforms/grok-permission-document.js.map +1 -0
- package/dist/src/platforms/grok-permissions.d.ts +17 -0
- package/dist/src/platforms/grok-permissions.js +311 -0
- package/dist/src/platforms/grok-permissions.js.map +1 -0
- package/dist/src/platforms/host-permission-policy.d.ts +38 -0
- package/dist/src/platforms/host-permission-policy.js +86 -0
- package/dist/src/platforms/host-permission-policy.js.map +1 -0
- package/dist/src/platforms/identity.d.ts +4 -0
- package/dist/src/platforms/identity.js +22 -0
- package/dist/src/platforms/identity.js.map +1 -0
- package/dist/src/platforms/inspection-grok.d.ts +4 -0
- package/dist/src/platforms/inspection-grok.js +366 -0
- package/dist/src/platforms/inspection-grok.js.map +1 -0
- package/dist/src/platforms/inspection-native.d.ts +6 -0
- package/dist/src/platforms/inspection-native.js +373 -0
- package/dist/src/platforms/inspection-native.js.map +1 -0
- package/dist/src/platforms/inspection-opencode.d.ts +4 -0
- package/dist/src/platforms/inspection-opencode.js +98 -0
- package/dist/src/platforms/inspection-opencode.js.map +1 -0
- package/dist/src/platforms/inspection-pi.d.ts +9 -0
- package/dist/src/platforms/inspection-pi.js +482 -0
- package/dist/src/platforms/inspection-pi.js.map +1 -0
- package/dist/src/platforms/inspection-query.d.ts +24 -0
- package/dist/src/platforms/inspection-query.js +119 -0
- package/dist/src/platforms/inspection-query.js.map +1 -0
- package/dist/src/platforms/inspection.d.ts +20 -0
- package/dist/src/platforms/inspection.js +259 -0
- package/dist/src/platforms/inspection.js.map +1 -0
- package/dist/src/platforms/layout.d.ts +35 -0
- package/dist/src/platforms/layout.js +317 -0
- package/dist/src/platforms/layout.js.map +1 -0
- package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
- package/dist/src/platforms/lifecycle-native-services.js +147 -0
- package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
- package/dist/src/platforms/lifecycle-native.d.ts +14 -0
- package/dist/src/platforms/lifecycle-native.js +223 -0
- package/dist/src/platforms/lifecycle-native.js.map +1 -0
- package/dist/src/platforms/lifecycle.d.ts +27 -0
- package/dist/src/platforms/lifecycle.js +567 -0
- package/dist/src/platforms/lifecycle.js.map +1 -0
- package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
- package/dist/src/platforms/opencode-permission-config.js +253 -0
- package/dist/src/platforms/opencode-permission-config.js.map +1 -0
- package/dist/src/platforms/opencode-permissions.d.ts +39 -0
- package/dist/src/platforms/opencode-permissions.js +212 -0
- package/dist/src/platforms/opencode-permissions.js.map +1 -0
- package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
- package/dist/src/platforms/opencode-related-permissions.js +177 -0
- package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
- package/dist/src/platforms/permission-ownership.d.ts +89 -0
- package/dist/src/platforms/permission-ownership.js +543 -0
- package/dist/src/platforms/permission-ownership.js.map +1 -0
- package/dist/src/platforms/permission-sidecar.d.ts +70 -0
- package/dist/src/platforms/permission-sidecar.js +215 -0
- package/dist/src/platforms/permission-sidecar.js.map +1 -0
- package/dist/src/platforms/projection-code-extension.d.ts +8 -0
- package/dist/src/platforms/projection-code-extension.js +126 -0
- package/dist/src/platforms/projection-code-extension.js.map +1 -0
- package/dist/src/platforms/projection-command-resources.d.ts +7 -0
- package/dist/src/platforms/projection-command-resources.js +74 -0
- package/dist/src/platforms/projection-command-resources.js.map +1 -0
- package/dist/src/platforms/projection-files.d.ts +27 -0
- package/dist/src/platforms/projection-files.js +111 -0
- package/dist/src/platforms/projection-files.js.map +1 -0
- package/dist/src/platforms/projection-marketplace.d.ts +19 -0
- package/dist/src/platforms/projection-marketplace.js +42 -0
- package/dist/src/platforms/projection-marketplace.js.map +1 -0
- package/dist/src/platforms/projection.d.ts +13 -0
- package/dist/src/platforms/projection.js +576 -0
- package/dist/src/platforms/projection.js.map +1 -0
- package/dist/src/platforms/registry.d.ts +4 -0
- package/dist/src/platforms/registry.js +30 -0
- package/dist/src/platforms/registry.js.map +1 -0
- package/dist/src/platforms/supplement-layout.d.ts +20 -0
- package/dist/src/platforms/supplement-layout.js +53 -0
- package/dist/src/platforms/supplement-layout.js.map +1 -0
- package/dist/src/platforms/supplement-state.d.ts +13 -0
- package/dist/src/platforms/supplement-state.js +93 -0
- package/dist/src/platforms/supplement-state.js.map +1 -0
- package/dist/src/portable/commands.d.ts +58 -11
- package/dist/src/portable/commands.js +99 -345
- 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 +29 -1
- package/dist/src/portable/materializer.js +197 -258
- 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 +42 -0
- package/dist/src/portable/recovery-layout.js.map +1 -0
- package/dist/src/portable/recovery.d.ts +176 -0
- package/dist/src/portable/recovery.js +556 -0
- package/dist/src/portable/recovery.js.map +1 -0
- package/dist/src/portable/writer.d.ts +67 -0
- package/dist/src/portable/writer.js +321 -0
- package/dist/src/portable/writer.js.map +1 -0
- package/dist/src/recovery/coordinator.d.ts +168 -0
- package/dist/src/recovery/coordinator.js +1558 -0
- package/dist/src/recovery/coordinator.js.map +1 -0
- package/dist/src/recovery/demand.d.ts +53 -0
- package/dist/src/recovery/demand.js +189 -0
- package/dist/src/recovery/demand.js.map +1 -0
- package/dist/src/recovery/install-concurrency.d.ts +48 -0
- package/dist/src/recovery/install-concurrency.js +196 -0
- package/dist/src/recovery/install-concurrency.js.map +1 -0
- package/dist/src/recovery/interruption.d.ts +19 -0
- package/dist/src/recovery/interruption.js +43 -0
- package/dist/src/recovery/interruption.js.map +1 -0
- package/dist/src/recovery/joint-coordinator.d.ts +46 -0
- package/dist/src/recovery/joint-coordinator.js +1641 -0
- package/dist/src/recovery/joint-coordinator.js.map +1 -0
- package/dist/src/recovery/joint-demand.d.ts +72 -0
- package/dist/src/recovery/joint-demand.js +332 -0
- package/dist/src/recovery/joint-demand.js.map +1 -0
- package/dist/src/recovery/joint-install-execution.d.ts +19 -0
- package/dist/src/recovery/joint-install-execution.js +308 -0
- package/dist/src/recovery/joint-install-execution.js.map +1 -0
- package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
- package/dist/src/recovery/joint-install-native-rebase.js +67 -0
- package/dist/src/recovery/joint-install-native-rebase.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 +129 -0
- package/dist/src/recovery/receipt.js +91 -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 +463 -0
- package/dist/src/recovery/retirement.js.map +1 -0
- package/dist/src/recovery/status.d.ts +143 -0
- package/dist/src/recovery/status.js +1517 -0
- package/dist/src/recovery/status.js.map +1 -0
- package/dist/src/recovery/types.d.ts +85 -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 +44 -0
- package/dist/src/review/eval-source-input.js +213 -0
- package/dist/src/review/eval-source-input.js.map +1 -0
- package/dist/src/review/platform-profile.d.ts +6 -0
- package/dist/src/review/platform-profile.js +24 -0
- package/dist/src/review/platform-profile.js.map +1 -0
- package/dist/src/review/review-profile.d.ts +20 -0
- package/dist/src/review/review-profile.js +276 -0
- package/dist/src/review/review-profile.js.map +1 -0
- package/dist/src/review/review-selection.d.ts +20 -0
- package/dist/src/review/review-selection.js +502 -0
- package/dist/src/review/review-selection.js.map +1 -0
- package/dist/src/review/review-types.d.ts +71 -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 +65 -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 +201 -0
- package/dist/src/review/source-binding.js +782 -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 +319 -0
- package/dist/src/tui/agent-management.js.map +1 -0
- package/dist/src/tui/agent-settings.d.ts +47 -0
- package/dist/src/tui/agent-settings.js +97 -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 +8 -16
- package/dist/src/tui/catalog-generation.js +97 -10
- package/dist/src/tui/catalog-generation.js.map +1 -1
- 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 +201 -34
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/config-array-draft.d.ts +30 -0
- package/dist/src/tui/config-array-draft.js +51 -0
- package/dist/src/tui/config-array-draft.js.map +1 -0
- package/dist/src/tui/config-leaf-editor.d.ts +44 -0
- package/dist/src/tui/config-leaf-editor.js +227 -0
- package/dist/src/tui/config-leaf-editor.js.map +1 -0
- package/dist/src/tui/config-object-suggestions.d.ts +15 -0
- package/dist/src/tui/config-object-suggestions.js +71 -0
- package/dist/src/tui/config-object-suggestions.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-suggestions.d.ts +27 -0
- package/dist/src/tui/config-suggestions.js +62 -0
- package/dist/src/tui/config-suggestions.js.map +1 -0
- package/dist/src/tui/config-value-presentation.d.ts +21 -0
- package/dist/src/tui/config-value-presentation.js +129 -0
- package/dist/src/tui/config-value-presentation.js.map +1 -0
- package/dist/src/tui/console-app-v4.d.ts +14 -5
- package/dist/src/tui/console-app-v4.js +10344 -2133
- 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 +8 -3
- package/dist/src/tui/controller-runtime.js +2301 -842
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +664 -79
- package/dist/src/tui/controller.js +3670 -830
- 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/deployment-view.d.ts +13 -0
- package/dist/src/tui/deployment-view.js +155 -0
- package/dist/src/tui/deployment-view.js.map +1 -0
- package/dist/src/tui/diagnostic-projection.d.ts +31 -0
- package/dist/src/tui/diagnostic-projection.js +681 -0
- package/dist/src/tui/diagnostic-projection.js.map +1 -0
- package/dist/src/tui/diagnostics.d.ts +6 -2
- 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 +56 -0
- package/dist/src/tui/entity-cards.js +321 -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 +78 -0
- package/dist/src/tui/glossary.js.map +1 -0
- package/dist/src/tui/guided-setup.d.ts +25 -0
- package/dist/src/tui/guided-setup.js +101 -0
- package/dist/src/tui/guided-setup.js.map +1 -0
- package/dist/src/tui/index.d.ts +5 -1
- package/dist/src/tui/index.js +4 -1
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/input-display.d.ts +1 -0
- package/dist/src/tui/input-display.js +23 -1
- package/dist/src/tui/input-display.js.map +1 -1
- 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 +187 -52
- package/dist/src/tui/model.js +1202 -426
- 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 +76 -0
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
- package/dist/src/tui/operation-history.d.ts +91 -0
- package/dist/src/tui/operation-history.js +167 -0
- package/dist/src/tui/operation-history.js.map +1 -0
- package/dist/src/tui/operation-review-planner.d.ts +28 -0
- package/dist/src/tui/operation-review-planner.js +1456 -0
- package/dist/src/tui/operation-review-planner.js.map +1 -0
- package/dist/src/tui/plugin-content.d.ts +33 -0
- package/dist/src/tui/plugin-content.js +245 -0
- package/dist/src/tui/plugin-content.js.map +1 -0
- package/dist/src/tui/plugin-detail.d.ts +75 -0
- package/dist/src/tui/plugin-detail.js +267 -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 +182 -39
- 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 +49 -0
- package/dist/src/tui/scoped-flow.js +212 -0
- package/dist/src/tui/scoped-flow.js.map +1 -0
- package/dist/src/tui/scoped-inventory.d.ts +131 -0
- package/dist/src/tui/scoped-inventory.js +280 -0
- package/dist/src/tui/scoped-inventory.js.map +1 -0
- package/dist/src/tui/screen-registry.d.ts +696 -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 +8 -0
- package/dist/src/tui/session-console-app.js +24 -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/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/wizard.js +37 -13
- package/dist/src/tui/wizard.js.map +1 -1
- package/dist/src/types.d.ts +177 -85
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/agent-version.d.ts +10 -4
- package/dist/src/utils/agent-version.js +6 -8
- package/dist/src/utils/agent-version.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +17 -24
- package/dist/src/utils/artifact-plan.js +59 -436
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +61 -89
- package/dist/src/utils/artifact-renderer.js +187 -364
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +21 -0
- package/dist/src/utils/artifact-request.js +57 -0
- package/dist/src/utils/artifact-request.js.map +1 -0
- package/dist/src/utils/artifact-sources.d.ts +4 -8
- package/dist/src/utils/artifact-sources.js +15 -6
- package/dist/src/utils/artifact-sources.js.map +1 -1
- package/dist/src/utils/aw-home-mutation-lock.js +2 -1
- package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +59 -173
- 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 +2 -9
- package/dist/src/utils/catalog-digests.js +7 -45
- package/dist/src/utils/catalog-digests.js.map +1 -1
- package/dist/src/utils/catalog-generation-error.d.ts +4 -1
- package/dist/src/utils/catalog-generation-error.js +2 -0
- package/dist/src/utils/catalog-generation-error.js.map +1 -1
- package/dist/src/utils/catalog-generation-resolver.d.ts +32 -3
- package/dist/src/utils/catalog-generation-resolver.js +182 -40
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
- package/dist/src/utils/catalog-generation-service.d.ts +142 -2
- package/dist/src/utils/catalog-generation-service.js +1146 -171
- package/dist/src/utils/catalog-generation-service.js.map +1 -1
- package/dist/src/utils/catalog-generation-state.d.ts +5 -0
- package/dist/src/utils/catalog-generation-state.js +25 -1
- package/dist/src/utils/catalog-generation-state.js.map +1 -1
- package/dist/src/utils/catalog-generation-store.d.ts +29 -2
- package/dist/src/utils/catalog-generation-store.js +240 -36
- package/dist/src/utils/catalog-generation-store.js.map +1 -1
- package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
- package/dist/src/utils/{catalog-manifest-v6.js → catalog-manifest-v7.js} +23 -23
- package/dist/src/utils/{catalog-manifest-v6.js.map → catalog-manifest-v7.js.map} +1 -1
- package/dist/src/utils/catalog-operation-context.d.ts +27 -3
- package/dist/src/utils/catalog-operation-context.js +75 -4
- package/dist/src/utils/catalog-operation-context.js.map +1 -1
- package/dist/src/utils/catalog-public-error.js +7 -0
- package/dist/src/utils/catalog-public-error.js.map +1 -1
- package/dist/src/utils/catalog-runtime-projection.d.ts +4 -3
- package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
- package/dist/src/utils/catalog-snapshot.d.ts +5 -2
- package/dist/src/utils/catalog-snapshot.js +4 -1
- package/dist/src/utils/catalog-snapshot.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 +22 -8
- package/dist/src/utils/catalog-source-references.js +457 -365
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/catalog-sources.d.ts +14 -1
- package/dist/src/utils/catalog-sources.js +155 -11
- package/dist/src/utils/catalog-sources.js.map +1 -1
- package/dist/src/utils/codex-executable-discovery.d.ts +28 -0
- package/dist/src/utils/codex-executable-discovery.js +431 -0
- package/dist/src/utils/codex-executable-discovery.js.map +1 -0
- package/dist/src/utils/codex-manager.d.ts +23 -42
- package/dist/src/utils/codex-manager.js +79 -767
- package/dist/src/utils/codex-manager.js.map +1 -1
- 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 +55 -0
- package/dist/src/utils/codex-native-observation.js +198 -0
- package/dist/src/utils/codex-native-observation.js.map +1 -0
- package/dist/src/utils/codex-reconciler.d.ts +6 -14
- package/dist/src/utils/codex-reconciler.js +45 -50
- package/dist/src/utils/codex-reconciler.js.map +1 -1
- package/dist/src/utils/codex-shared-native.d.ts +28 -39
- package/dist/src/utils/codex-shared-native.js +92 -57
- package/dist/src/utils/codex-shared-native.js.map +1 -1
- package/dist/src/utils/codex-skill-staging.d.ts +4 -3
- 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 +8 -3
- package/dist/src/utils/codex-surface-analysis.js +35 -62
- package/dist/src/utils/codex-surface-analysis.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +31 -0
- package/dist/src/utils/component-command-preparation.js +127 -0
- package/dist/src/utils/component-command-preparation.js.map +1 -0
- package/dist/src/utils/component-gap.d.ts +4 -0
- package/dist/src/utils/component-gap.js +20 -0
- package/dist/src/utils/component-gap.js.map +1 -0
- package/dist/src/utils/component-resources.d.ts +51 -0
- package/dist/src/utils/component-resources.js +320 -0
- package/dist/src/utils/component-resources.js.map +1 -0
- package/dist/src/utils/config-platforms.d.ts +21 -0
- package/dist/src/utils/config-platforms.js +51 -0
- package/dist/src/utils/config-platforms.js.map +1 -0
- package/dist/src/utils/dynamic-skill-tree.d.ts +18 -6
- package/dist/src/utils/dynamic-skill-tree.js +33 -40
- 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 +112 -6
- package/dist/src/utils/git-catalog-provider.js.map +1 -1
- package/dist/src/utils/inventory-recovery-diagnostic.d.ts +4 -0
- package/dist/src/utils/inventory-recovery-diagnostic.js +15 -0
- package/dist/src/utils/inventory-recovery-diagnostic.js.map +1 -0
- package/dist/src/utils/local-marketplace.d.ts +17 -12
- package/dist/src/utils/local-marketplace.js +85 -195
- package/dist/src/utils/local-marketplace.js.map +1 -1
- package/dist/src/utils/managed-command-cli-review.d.ts +53 -0
- package/dist/src/utils/managed-command-cli-review.js +431 -0
- package/dist/src/utils/managed-command-cli-review.js.map +1 -0
- package/dist/src/utils/managed-command-closure.d.ts +14 -0
- package/dist/src/utils/managed-command-closure.js +156 -0
- package/dist/src/utils/managed-command-closure.js.map +1 -0
- package/dist/src/utils/managed-command-errors.d.ts +5 -0
- package/dist/src/utils/managed-command-errors.js +10 -0
- package/dist/src/utils/managed-command-errors.js.map +1 -0
- package/dist/src/utils/managed-command-materialization.d.ts +90 -0
- package/dist/src/utils/managed-command-materialization.js +375 -0
- package/dist/src/utils/managed-command-materialization.js.map +1 -0
- package/dist/src/utils/managed-command-preparation.d.ts +30 -0
- package/dist/src/utils/managed-command-preparation.js +39 -0
- package/dist/src/utils/managed-command-preparation.js.map +1 -0
- package/dist/src/utils/managed-command-review.d.ts +33 -0
- package/dist/src/utils/managed-command-review.js +80 -0
- package/dist/src/utils/managed-command-review.js.map +1 -0
- package/dist/src/utils/managed-command-runtime.d.ts +36 -0
- package/dist/src/utils/managed-command-runtime.js +126 -0
- package/dist/src/utils/managed-command-runtime.js.map +1 -0
- package/dist/src/utils/managed-command-snapshots.d.ts +24 -0
- package/dist/src/utils/managed-command-snapshots.js +89 -0
- package/dist/src/utils/managed-command-snapshots.js.map +1 -0
- package/dist/src/utils/managed-command-store.d.ts +141 -0
- package/dist/src/utils/managed-command-store.js +839 -0
- package/dist/src/utils/managed-command-store.js.map +1 -0
- package/dist/src/utils/multi-source-catalog.d.ts +4 -0
- package/dist/src/utils/multi-source-catalog.js +7 -3
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli-interruption.d.ts +8 -0
- package/dist/src/utils/native-cli-interruption.js +65 -0
- package/dist/src/utils/native-cli-interruption.js.map +1 -0
- package/dist/src/utils/native-cli.d.ts +37 -6
- package/dist/src/utils/native-cli.js +523 -60
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/native-demand.d.ts +29 -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 +17 -0
- package/dist/src/utils/native-tool-context.js +40 -0
- package/dist/src/utils/native-tool-context.js.map +1 -0
- package/dist/src/utils/native-tool-review.d.ts +8 -0
- package/dist/src/utils/native-tool-review.js +14 -0
- package/dist/src/utils/native-tool-review.js.map +1 -0
- package/dist/src/utils/orphan-marketplace-cleanup.js +0 -2
- package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +111 -11
- package/dist/src/utils/ownership.js +247 -126
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/package-content.d.ts +7 -0
- package/dist/src/utils/package-content.js +70 -0
- package/dist/src/utils/package-content.js.map +1 -0
- package/dist/src/utils/path-catalog-provider.js +2 -0
- package/dist/src/utils/path-catalog-provider.js.map +1 -1
- package/dist/src/utils/paths.d.ts +1 -1
- package/dist/src/utils/paths.js +5 -2
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +69 -0
- package/dist/src/utils/platform-empty-state.js +226 -0
- package/dist/src/utils/platform-empty-state.js.map +1 -0
- 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-command-apply.d.ts +33 -0
- package/dist/src/utils/plugin-config-command-apply.js +142 -0
- package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
- package/dist/src/utils/plugin-config-diagnostics.d.ts +16 -0
- package/dist/src/utils/plugin-config-diagnostics.js +44 -0
- package/dist/src/utils/plugin-config-diagnostics.js.map +1 -0
- package/dist/src/utils/plugin-config-impact.d.ts +75 -0
- package/dist/src/utils/plugin-config-impact.js +355 -0
- package/dist/src/utils/plugin-config-impact.js.map +1 -0
- package/dist/src/utils/plugin-config-references.d.ts +96 -0
- package/dist/src/utils/plugin-config-references.js +357 -0
- package/dist/src/utils/plugin-config-references.js.map +1 -0
- package/dist/src/utils/plugin-config-suggestion-runner.d.ts +83 -0
- package/dist/src/utils/plugin-config-suggestion-runner.js +308 -0
- package/dist/src/utils/plugin-config-suggestion-runner.js.map +1 -0
- package/dist/src/utils/plugin-config-suggestions.d.ts +50 -0
- package/dist/src/utils/plugin-config-suggestions.js +302 -0
- package/dist/src/utils/plugin-config-suggestions.js.map +1 -0
- package/dist/src/utils/plugin-config-write.d.ts +123 -31
- package/dist/src/utils/plugin-config-write.js +828 -399
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +192 -109
- package/dist/src/utils/plugin-config.js +970 -1150
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-dependencies.d.ts +1 -1
- package/dist/src/utils/plugin-dependencies.js.map +1 -1
- package/dist/src/utils/plugin-scripts.d.ts +80 -127
- package/dist/src/utils/plugin-scripts.js +655 -524
- 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 +24 -1
- package/dist/src/utils/rendered-contract.js.map +1 -1
- package/dist/src/utils/runtime-config.d.ts +18 -0
- package/dist/src/utils/runtime-config.js +64 -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/skill-invocation-warning.d.ts +20 -0
- package/dist/src/utils/skill-invocation-warning.js +68 -0
- package/dist/src/utils/skill-invocation-warning.js.map +1 -0
- package/dist/src/utils/state-paths.d.ts +8 -3
- package/dist/src/utils/state-paths.js +53 -16
- package/dist/src/utils/state-paths.js.map +1 -1
- package/dist/src/utils/target-eligibility.d.ts +3 -3
- package/dist/src/utils/target-eligibility.js +11 -6
- 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 +155 -0
- package/dist/src/utils/windows-npm-shim.js.map +1 -0
- package/dist/vitest.config.js +106 -9
- package/dist/vitest.config.js.map +1 -1
- package/package.json +30 -21
- 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/sync-command.d.ts +0 -21
- package/dist/src/commands/sync-command.js +0 -206
- package/dist/src/commands/sync-command.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/catalog-manifest-v6.d.ts +0 -5
- package/dist/src/utils/lifecycle-active-store.d.ts +0 -147
- package/dist/src/utils/lifecycle-active-store.js +0 -1064
- package/dist/src/utils/lifecycle-active-store.js.map +0 -1
- package/dist/src/utils/plugin-intent-state.d.ts +0 -39
- package/dist/src/utils/plugin-intent-state.js +0 -325
- package/dist/src/utils/plugin-intent-state.js.map +0 -1
- package/dist/src/utils/slash-commands.d.ts +0 -1
- package/dist/src/utils/slash-commands.js +0 -2
- package/dist/src/utils/slash-commands.js.map +0 -1
|
@@ -0,0 +1,839 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import * as fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { getCommandPackageId, isCommandPackageId as isCoreCommandPackageId, isUserCommandId as isCoreUserCommandId, normalizeCommandSelector, parseCommandInvocationSelector, normalizeCommandLaunch, normalizeInstalledCommandProducer as normalizeCoreProducer, normalizeUserCommandDefinition, normalizeProducerIdentity, COMMAND_PRODUCER_RECORD_FILE, validateNativeToolClosureFiles, } from '@lesliechan721/aw-plugin-core/manifest';
|
|
5
|
+
import { calculateFileDigest } from './bundle-integrity.js';
|
|
6
|
+
import { calculateCatalogSourceIdentity } from './catalog-source-identity.js';
|
|
7
|
+
import { readCatalogSourcesConfig, resolveCatalogSourcesConfigPath } from './catalog-sources.js';
|
|
8
|
+
import { CatalogGenerationError } from './catalog-generation-error.js';
|
|
9
|
+
import { calculateManagedCommandResourceDigest } from './managed-command-closure.js';
|
|
10
|
+
import { ManagedCommandError } from './managed-command-errors.js';
|
|
11
|
+
import { COMMAND_RUNTIME_CONFIG_DIRECTORY, validateManagedCommandRuntimeConfigFiles, } from './managed-command-snapshots.js';
|
|
12
|
+
import { atomicReplaceSafeFile } from './safe-fs.js';
|
|
13
|
+
import { canonicalizePathThroughExistingAncestor, ensureRegularDirectoryPath, resolveAwHome, } from './state-paths.js';
|
|
14
|
+
export const COMMAND_PRODUCER_RECORD = COMMAND_PRODUCER_RECORD_FILE;
|
|
15
|
+
export { ManagedCommandError };
|
|
16
|
+
const REVISION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u;
|
|
17
|
+
function fail(code, message) { throw new ManagedCommandError(code, message); }
|
|
18
|
+
function object(value, keys, code) {
|
|
19
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)
|
|
20
|
+
|| Object.keys(value).some((key) => !keys.includes(key))
|
|
21
|
+
|| keys.some((key) => !Object.hasOwn(value, key)))
|
|
22
|
+
fail(code, 'The managed command record has an invalid shape.');
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
function equal(left, right) {
|
|
26
|
+
if (left === right)
|
|
27
|
+
return true;
|
|
28
|
+
if (!left || !right || typeof left !== 'object' || typeof right !== 'object')
|
|
29
|
+
return false;
|
|
30
|
+
const a = Object.keys(left).sort();
|
|
31
|
+
const b = Object.keys(right).sort();
|
|
32
|
+
return a.length === b.length && a.every((key, index) => key === b[index]
|
|
33
|
+
&& equal(left[key], right[key]));
|
|
34
|
+
}
|
|
35
|
+
export function managedCommandDiagnostic(error, subject) {
|
|
36
|
+
return {
|
|
37
|
+
code: error instanceof ManagedCommandError ? error.code : 'commandResourceInvalid',
|
|
38
|
+
message: error instanceof ManagedCommandError ? error.message : 'The managed command resource could not be read or written.',
|
|
39
|
+
...(subject ? { subject } : {}),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export async function managedCommandRoot(env = process.env) {
|
|
43
|
+
return path.join(await canonicalizePathThroughExistingAncestor(resolveAwHome(env)), 'commands');
|
|
44
|
+
}
|
|
45
|
+
async function safePath(root, target) {
|
|
46
|
+
const relative = path.relative(path.resolve(root), path.resolve(target));
|
|
47
|
+
if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
|
|
48
|
+
fail('commandResourceInvalid', 'The managed command path escapes its allowed root.');
|
|
49
|
+
let current = path.resolve(root);
|
|
50
|
+
for (const segment of ['', ...relative.split(path.sep).filter(Boolean)]) {
|
|
51
|
+
if (segment)
|
|
52
|
+
current = path.join(current, segment);
|
|
53
|
+
const stat = await fs.lstat(current).catch((error) => {
|
|
54
|
+
if (error.code === 'ENOENT')
|
|
55
|
+
return null;
|
|
56
|
+
throw error;
|
|
57
|
+
});
|
|
58
|
+
if (stat?.isSymbolicLink() || (current !== path.resolve(target) && stat && !stat.isDirectory()))
|
|
59
|
+
fail('commandResourceInvalid', 'The managed command path is not a regular owned path.');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function readJson(root, target, code) {
|
|
63
|
+
await safePath(root, target);
|
|
64
|
+
try {
|
|
65
|
+
if (!(await fs.lstat(target)).isFile())
|
|
66
|
+
fail(code, 'The managed command record must be a regular file.');
|
|
67
|
+
return JSON.parse(await fs.readFile(target, 'utf8'));
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (error instanceof ManagedCommandError)
|
|
71
|
+
throw error;
|
|
72
|
+
fail(code, 'The managed command record is missing or invalid.');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function writeJson(root, target, value) {
|
|
76
|
+
await ensureRegularDirectoryPath(root, 'Managed commands root');
|
|
77
|
+
await atomicReplaceSafeFile({ allowedRoot: root, filePath: target, content: `${JSON.stringify(value, null, 2)}\n`, label: 'Managed command record' });
|
|
78
|
+
}
|
|
79
|
+
export function isUserCommandId(selector) { return isCoreUserCommandId(selector); }
|
|
80
|
+
export function isManagedCommandPackageId(selector) { return isCoreCommandPackageId(selector); }
|
|
81
|
+
export function parsePluginCommandSelector(selector) {
|
|
82
|
+
try {
|
|
83
|
+
return normalizeCommandSelector(selector);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
throw new ManagedCommandError('invalidArguments', 'A canonical source/plugin selector is required.', true);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export function assertUserCommandId(id) {
|
|
90
|
+
if (id.includes('/')) {
|
|
91
|
+
parsePluginCommandSelector(id);
|
|
92
|
+
fail('commandOwnerMismatch', 'Plugin commands must be maintained with plugin sync or command package sync/remove.');
|
|
93
|
+
}
|
|
94
|
+
if (!isUserCommandId(id))
|
|
95
|
+
throw new ManagedCommandError('invalidArguments', 'A canonical user command ID is required.', true);
|
|
96
|
+
}
|
|
97
|
+
export function validateManagedCommandName(value) {
|
|
98
|
+
if (typeof value !== 'string' || !value.trim() || [...value].length > 128
|
|
99
|
+
|| /[\u0000-\u001f\u007f-\u009f]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(value)) {
|
|
100
|
+
throw new ManagedCommandError('invalidArguments', 'The command name must contain 1–128 characters and no control characters.', true);
|
|
101
|
+
}
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
export function parseManagedCommandLaunch(value) {
|
|
105
|
+
try {
|
|
106
|
+
return normalizeCommandLaunch(value);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
fail('commandDefinitionInvalid', 'The managed command launch definition is invalid.');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function assertUserOwner(root, id) {
|
|
113
|
+
assertUserCommandId(id);
|
|
114
|
+
const userRoot = path.join(root, 'users', id);
|
|
115
|
+
await safePath(root, userRoot);
|
|
116
|
+
if (!(await fs.lstat(userRoot).catch((error) => {
|
|
117
|
+
if (error.code === 'ENOENT')
|
|
118
|
+
return null;
|
|
119
|
+
throw error;
|
|
120
|
+
})))
|
|
121
|
+
fail('commandNotFound', 'The user command ID is not installed.');
|
|
122
|
+
const owner = object(await readJson(root, path.join(userRoot, 'owner.json'), 'commandOwnerMismatch'), ['schemaVersion', 'owner', 'kind', 'id'], 'commandOwnerMismatch');
|
|
123
|
+
if (owner.schemaVersion !== 1 || owner.owner !== 'agent-workflows' || owner.kind !== 'user-command' || owner.id !== id) {
|
|
124
|
+
fail('commandOwnerMismatch', 'The user command owner marker does not match this directory.');
|
|
125
|
+
}
|
|
126
|
+
return userRoot;
|
|
127
|
+
}
|
|
128
|
+
export async function readUserCommandDefinition(id, env = process.env) {
|
|
129
|
+
const root = await managedCommandRoot(env);
|
|
130
|
+
const userRoot = await assertUserOwner(root, id);
|
|
131
|
+
const value = await readJson(root, path.join(userRoot, 'definition.json'), 'commandDefinitionInvalid');
|
|
132
|
+
try {
|
|
133
|
+
const definition = normalizeUserCommandDefinition(value);
|
|
134
|
+
if (definition.id !== id || !equal(value, definition))
|
|
135
|
+
fail('commandDefinitionInvalid', 'The stored user command definition is not complete or does not match its directory.');
|
|
136
|
+
return definition;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
fail('commandDefinitionInvalid', 'The stored user command definition is invalid.');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function contains(root, target) {
|
|
143
|
+
const relative = path.relative(root, target);
|
|
144
|
+
return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
|
|
145
|
+
}
|
|
146
|
+
export async function validateManagedCommandResource(resourceRoot, launch, options = {}) {
|
|
147
|
+
const root = path.resolve(resourceRoot);
|
|
148
|
+
const runtimeConfigDirectory = path.join(root, COMMAND_RUNTIME_CONFIG_DIRECTORY);
|
|
149
|
+
await safePath(path.dirname(root), root);
|
|
150
|
+
async function visit(directory) {
|
|
151
|
+
const stat = await fs.lstat(directory).catch(() => null);
|
|
152
|
+
if (!stat?.isDirectory() || stat.isSymbolicLink())
|
|
153
|
+
fail('commandResourceInvalid', 'The command resource root must be a regular directory.');
|
|
154
|
+
const entries = await fs.readdir(directory, { withFileTypes: true }).catch((error) => {
|
|
155
|
+
if (error.code === 'ENOENT')
|
|
156
|
+
fail('commandResourceInvalid', 'The command resource changed before it could be read.');
|
|
157
|
+
throw error;
|
|
158
|
+
});
|
|
159
|
+
for (const entry of entries) {
|
|
160
|
+
const location = path.join(directory, entry.name);
|
|
161
|
+
// Run verifies the selected snapshot separately. Damage to another platform cannot stop it.
|
|
162
|
+
if (options.skipRuntimeConfigSnapshots && location === runtimeConfigDirectory)
|
|
163
|
+
continue;
|
|
164
|
+
if (entry.name === '.git' || entry.isSymbolicLink() || (!entry.isDirectory() && !entry.isFile())) {
|
|
165
|
+
fail('commandResourceInvalid', 'Command resources cannot contain links, special nodes, or .git directories.');
|
|
166
|
+
}
|
|
167
|
+
if (entry.isDirectory())
|
|
168
|
+
await visit(location);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
await visit(root);
|
|
172
|
+
if (launch)
|
|
173
|
+
await validateCommandLaunchFile(root, launch);
|
|
174
|
+
}
|
|
175
|
+
async function validateCommandLaunchFile(root, launch) {
|
|
176
|
+
const entry = path.resolve(root, launch.entry);
|
|
177
|
+
if (!contains(root, entry) || entry === root)
|
|
178
|
+
fail('commandResourceInvalid', 'The command entry escapes its resource root.');
|
|
179
|
+
await safePath(root, entry);
|
|
180
|
+
const stat = await fs.lstat(entry).catch(() => null);
|
|
181
|
+
if (!stat?.isFile())
|
|
182
|
+
fail('commandResourceInvalid', 'The command entry is missing or is not a regular file.');
|
|
183
|
+
try {
|
|
184
|
+
await fs.access(entry, fs.constants.R_OK);
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
fail('commandResourceInvalid', 'The command entry cannot be read.');
|
|
188
|
+
}
|
|
189
|
+
if (launch.runner === 'executable') {
|
|
190
|
+
if (process.platform === 'win32') {
|
|
191
|
+
if (path.extname(entry).toLowerCase() !== '.exe')
|
|
192
|
+
fail('commandRunnerUnsupported', 'Windows commands require a directly runnable native .exe entry.');
|
|
193
|
+
const handle = await fs.open(entry, 'r');
|
|
194
|
+
try {
|
|
195
|
+
const magic = Buffer.alloc(2);
|
|
196
|
+
await handle.read(magic, 0, 2, 0);
|
|
197
|
+
if (magic.toString('ascii') !== 'MZ')
|
|
198
|
+
fail('commandRunnerUnsupported', 'The command entry is not a native Windows executable.');
|
|
199
|
+
}
|
|
200
|
+
finally {
|
|
201
|
+
await handle.close();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else if ((stat.mode & 0o111) === 0)
|
|
205
|
+
fail('commandRunnerUnsupported', 'The command executable has no execute permission.');
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export async function copyManagedCommandDirectory(sourceDirectory, destination, env = process.env, options = {}) {
|
|
209
|
+
const source = path.resolve(sourceDirectory);
|
|
210
|
+
const stat = await fs.lstat(source).catch(() => null);
|
|
211
|
+
if (!stat?.isDirectory() || stat.isSymbolicLink())
|
|
212
|
+
fail('commandResourceInvalid', 'The command source must be a regular directory.');
|
|
213
|
+
const canonicalSource = await fs.realpath(source);
|
|
214
|
+
const awHome = await canonicalizePathThroughExistingAncestor(resolveAwHome(env));
|
|
215
|
+
const canonicalDestination = await canonicalizePathThroughExistingAncestor(destination);
|
|
216
|
+
if (contains(canonicalSource, awHome) || (!options.trustedPluginSource && contains(awHome, canonicalSource))
|
|
217
|
+
|| contains(canonicalSource, canonicalDestination) || contains(canonicalDestination, canonicalSource)) {
|
|
218
|
+
fail('commandResourceInvalid', 'The command source overlaps AW_HOME or the installation target.');
|
|
219
|
+
}
|
|
220
|
+
await validateManagedCommandResource(canonicalSource);
|
|
221
|
+
await fs.mkdir(destination, { recursive: true });
|
|
222
|
+
async function copy(sourceRoot, targetRoot) {
|
|
223
|
+
for (const entry of await fs.readdir(sourceRoot, { withFileTypes: true })) {
|
|
224
|
+
const sourcePath = path.join(sourceRoot, entry.name);
|
|
225
|
+
const targetPath = path.join(targetRoot, entry.name);
|
|
226
|
+
const sourceStat = await fs.lstat(sourcePath);
|
|
227
|
+
if (entry.name === '.git' || entry.name === COMMAND_PRODUCER_RECORD || entry.name === '.agent-workflows-owner.json' || sourceStat.isSymbolicLink())
|
|
228
|
+
fail('commandResourceInvalid', 'The command source contains a reserved path or a link.');
|
|
229
|
+
if (sourceStat.isDirectory()) {
|
|
230
|
+
await fs.mkdir(targetPath);
|
|
231
|
+
await copy(sourcePath, targetPath);
|
|
232
|
+
}
|
|
233
|
+
else if (sourceStat.isFile()) {
|
|
234
|
+
await fs.copyFile(sourcePath, targetPath, fs.constants.COPYFILE_EXCL);
|
|
235
|
+
await fs.chmod(targetPath, sourceStat.mode & 0o777);
|
|
236
|
+
}
|
|
237
|
+
else
|
|
238
|
+
fail('commandResourceInvalid', 'The command source contains a special node.');
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
await copy(canonicalSource, destination);
|
|
242
|
+
await validateManagedCommandResource(destination);
|
|
243
|
+
}
|
|
244
|
+
export async function installUserCommand(options) {
|
|
245
|
+
const root = await managedCommandRoot(options.env);
|
|
246
|
+
const id = `cmdu_${crypto.randomUUID()}`;
|
|
247
|
+
const userRoot = path.join(root, 'users', id);
|
|
248
|
+
const revision = crypto.randomUUID();
|
|
249
|
+
const name = validateManagedCommandName(options.name);
|
|
250
|
+
const launch = parseManagedCommandLaunch(options.launch);
|
|
251
|
+
await ensureRegularDirectoryPath(userRoot, 'User command root');
|
|
252
|
+
await writeJson(root, path.join(userRoot, 'owner.json'), { schemaVersion: 1, owner: 'agent-workflows', kind: 'user-command', id });
|
|
253
|
+
try {
|
|
254
|
+
const resourceRoot = path.join(userRoot, 'packages', revision);
|
|
255
|
+
await copyManagedCommandDirectory(options.sourceDirectory, resourceRoot, options.env);
|
|
256
|
+
await validateManagedCommandResource(resourceRoot, launch);
|
|
257
|
+
await writeJson(root, path.join(userRoot, 'definition.json'), { schemaVersion: 1, id, name, packageRevision: revision, launch });
|
|
258
|
+
return id;
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
await safePath(root, userRoot);
|
|
262
|
+
await fs.rm(userRoot, { recursive: true, force: true });
|
|
263
|
+
throw error;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
export async function updateUserCommand(options) {
|
|
267
|
+
const old = await readUserCommandDefinition(options.id, options.env);
|
|
268
|
+
const root = await managedCommandRoot(options.env);
|
|
269
|
+
const userRoot = await assertUserOwner(root, options.id);
|
|
270
|
+
const revision = crypto.randomUUID();
|
|
271
|
+
const resourceRoot = path.join(userRoot, 'packages', revision);
|
|
272
|
+
const launch = parseManagedCommandLaunch({ ...old.launch, ...options.launch });
|
|
273
|
+
const name = options.name === undefined ? old.name : validateManagedCommandName(options.name);
|
|
274
|
+
try {
|
|
275
|
+
await copyManagedCommandDirectory(options.sourceDirectory, resourceRoot, options.env);
|
|
276
|
+
await validateManagedCommandResource(resourceRoot, launch);
|
|
277
|
+
await writeJson(root, path.join(userRoot, 'definition.json'), { ...old, name, launch, packageRevision: revision });
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
await safePath(root, resourceRoot);
|
|
281
|
+
await fs.rm(resourceRoot, { recursive: true, force: true });
|
|
282
|
+
throw error;
|
|
283
|
+
}
|
|
284
|
+
const oldRoot = path.join(userRoot, 'packages', old.packageRevision);
|
|
285
|
+
try {
|
|
286
|
+
await safePath(root, oldRoot);
|
|
287
|
+
await fs.rm(oldRoot, { recursive: true, force: true });
|
|
288
|
+
return { errors: [], recoveryActions: [] };
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
return {
|
|
292
|
+
errors: [{ code: 'commandResourceInvalid', message: 'The new command revision is active, but the old revision could not be removed.' }],
|
|
293
|
+
recoveryActions: [`aw command remove ${options.id} --force --yes`],
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
export async function removeUserCommand(id, env = process.env) {
|
|
298
|
+
const root = await managedCommandRoot(env);
|
|
299
|
+
const userRoot = await assertUserOwner(root, id);
|
|
300
|
+
await fs.rm(userRoot, { recursive: true, force: true });
|
|
301
|
+
}
|
|
302
|
+
async function lstatIfExists(target) {
|
|
303
|
+
try {
|
|
304
|
+
return await fs.lstat(target);
|
|
305
|
+
}
|
|
306
|
+
catch (error) {
|
|
307
|
+
if (error.code === 'ENOENT')
|
|
308
|
+
return null;
|
|
309
|
+
throw error;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
async function entriesAt(directory) {
|
|
313
|
+
try {
|
|
314
|
+
return await fs.readdir(directory);
|
|
315
|
+
}
|
|
316
|
+
catch (error) {
|
|
317
|
+
if (error.code === 'ENOENT')
|
|
318
|
+
return [];
|
|
319
|
+
throw error;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
async function readConfiguredSources(env) {
|
|
323
|
+
try {
|
|
324
|
+
const sourceFile = resolveCatalogSourcesConfigPath(env);
|
|
325
|
+
const stat = await lstatIfExists(sourceFile);
|
|
326
|
+
if (stat && !stat.isFile())
|
|
327
|
+
fail('catalogSourcesConfigInvalid', 'Catalog sources config must be a regular file.');
|
|
328
|
+
const { sources } = await readCatalogSourcesConfig(env);
|
|
329
|
+
const identities = await Promise.all(sources.map(async (source) => [source.id, await calculateCatalogSourceIdentity(source)]));
|
|
330
|
+
return new Map(identities);
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
if (error instanceof CatalogGenerationError)
|
|
334
|
+
fail(error.code, error.message);
|
|
335
|
+
fail('catalogSourcesConfigInvalid', 'Catalog sources config is unreadable or invalid. Repair catalog-sources.json, then run aw source sync.');
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
async function resolvePluginCommandProducer(selector, env) {
|
|
339
|
+
const { sourceId, pluginName } = parsePluginCommandSelector(selector);
|
|
340
|
+
const sourceIdentity = (await readConfiguredSources(env)).get(sourceId);
|
|
341
|
+
if (sourceIdentity === undefined)
|
|
342
|
+
fail('commandNotFound', 'The command source is no longer configured. Run aw command list to find packages by ID.');
|
|
343
|
+
return { sourceId, sourceIdentity, pluginName };
|
|
344
|
+
}
|
|
345
|
+
export async function resolveManagedCommandPackageId(selector, env = process.env) {
|
|
346
|
+
const producer = await resolvePluginCommandProducer(selector, env);
|
|
347
|
+
const id = getCommandPackageId(producer);
|
|
348
|
+
await assertExpectedPackage(await managedCommandRoot(env), id, producer);
|
|
349
|
+
return id;
|
|
350
|
+
}
|
|
351
|
+
export function normalizeInstalledCommandProducer(value) {
|
|
352
|
+
try {
|
|
353
|
+
const record = normalizeCoreProducer(value);
|
|
354
|
+
if (!equal(value, record))
|
|
355
|
+
fail('commandBindingInvalid', 'The installed producer must contain all normalized fields.');
|
|
356
|
+
return record;
|
|
357
|
+
}
|
|
358
|
+
catch {
|
|
359
|
+
fail('commandBindingInvalid', 'The installed command producer record is invalid. Run aw command package sync.');
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
export async function readInstalledCommandProducer(resourceRoot) {
|
|
363
|
+
return normalizeInstalledCommandProducer(await readJson(resourceRoot, path.join(resourceRoot, COMMAND_PRODUCER_RECORD), 'commandBindingInvalid'));
|
|
364
|
+
}
|
|
365
|
+
async function readPackageOwner(root, id) {
|
|
366
|
+
if (!isManagedCommandPackageId(id))
|
|
367
|
+
throw new ManagedCommandError('invalidArguments', 'A canonical package ID is required.', true);
|
|
368
|
+
const packageRoot = path.join(root, 'packages', id);
|
|
369
|
+
await safePath(root, packageRoot);
|
|
370
|
+
const stat = await lstatIfExists(packageRoot);
|
|
371
|
+
if (!stat)
|
|
372
|
+
fail('commandNotFound', 'The command package is not installed. Run aw command package sync.');
|
|
373
|
+
if (!stat.isDirectory())
|
|
374
|
+
fail('commandOwnerMismatch', 'The command package root must be a regular directory.');
|
|
375
|
+
const owner = object(await readJson(root, path.join(packageRoot, 'owner.json'), 'commandOwnerMismatch'), ['schemaVersion', 'owner', 'kind', 'producer'], 'commandOwnerMismatch');
|
|
376
|
+
let producer;
|
|
377
|
+
try {
|
|
378
|
+
producer = normalizeProducerIdentity(owner.producer);
|
|
379
|
+
}
|
|
380
|
+
catch {
|
|
381
|
+
fail('commandOwnerMismatch', 'The package owner identity is invalid.');
|
|
382
|
+
}
|
|
383
|
+
if (owner.schemaVersion !== 2 || owner.owner !== 'agent-workflows' || owner.kind !== 'plugin-command-package'
|
|
384
|
+
|| !equal(owner.producer, producer) || getCommandPackageId(producer) !== id) {
|
|
385
|
+
fail('commandOwnerMismatch', 'The command package owner marker does not match its directory.');
|
|
386
|
+
}
|
|
387
|
+
return { producer, packageRoot };
|
|
388
|
+
}
|
|
389
|
+
export async function readManagedCommandPackageOwner(id, env = process.env) {
|
|
390
|
+
return readPackageOwner(await managedCommandRoot(env), id);
|
|
391
|
+
}
|
|
392
|
+
async function readCurrentRevision(packageRoot) {
|
|
393
|
+
const current = object(await readJson(packageRoot, path.join(packageRoot, 'current.json'), 'commandBindingInvalid'), ['schemaVersion', 'revision'], 'commandBindingInvalid');
|
|
394
|
+
if (current.schemaVersion !== 2 || typeof current.revision !== 'string' || !REVISION_ID.test(current.revision)) {
|
|
395
|
+
fail('commandBindingInvalid', 'The current command package revision is invalid. Run aw command package sync.');
|
|
396
|
+
}
|
|
397
|
+
return current.revision;
|
|
398
|
+
}
|
|
399
|
+
async function currentResourceRoot(owner) {
|
|
400
|
+
const revision = await readCurrentRevision(owner.packageRoot);
|
|
401
|
+
return path.join(owner.packageRoot, 'revisions', revision);
|
|
402
|
+
}
|
|
403
|
+
async function readPinnedPackage(owner, resourceRoot) {
|
|
404
|
+
await safePath(owner.packageRoot, resourceRoot);
|
|
405
|
+
const record = await readInstalledCommandProducer(resourceRoot);
|
|
406
|
+
if (!equal(owner.producer, record.producer))
|
|
407
|
+
fail('commandIdentityConflict', 'The command package revision does not match its owner.');
|
|
408
|
+
return { resourceRoot, record };
|
|
409
|
+
}
|
|
410
|
+
async function validateInstalledNativeTools({ resourceRoot, record }) {
|
|
411
|
+
if (record.nativeTools) {
|
|
412
|
+
try {
|
|
413
|
+
await validateNativeToolClosureFiles(resourceRoot, record.nativeTools);
|
|
414
|
+
}
|
|
415
|
+
catch {
|
|
416
|
+
fail('commandBindingInvalid', 'The installed native tool closure does not match its files. Run aw command package sync.');
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
async function validatePackageResources({ resourceRoot, record }) {
|
|
421
|
+
await validateManagedCommandResource(resourceRoot);
|
|
422
|
+
for (const launch of record.routes.subcommands)
|
|
423
|
+
await validateCommandLaunchFile(resourceRoot, launch);
|
|
424
|
+
if (record.routes.fallback)
|
|
425
|
+
await validateCommandLaunchFile(resourceRoot, record.routes.fallback);
|
|
426
|
+
await validateInstalledNativeTools({ resourceRoot, record });
|
|
427
|
+
await validateManagedCommandRuntimeConfigFiles(resourceRoot, record);
|
|
428
|
+
}
|
|
429
|
+
function assertExpectedProducer(expected, actual) {
|
|
430
|
+
if (!equal(expected, actual))
|
|
431
|
+
fail('commandIdentityConflict', 'The command package belongs to a different source or plugin.');
|
|
432
|
+
}
|
|
433
|
+
export async function readManagedCommandPackage(producer, env = process.env, options = {}) {
|
|
434
|
+
const id = getCommandPackageId(producer);
|
|
435
|
+
let owner;
|
|
436
|
+
try {
|
|
437
|
+
owner = await readManagedCommandPackageOwner(id, env);
|
|
438
|
+
}
|
|
439
|
+
catch (error) {
|
|
440
|
+
if (error instanceof ManagedCommandError && error.code === 'commandNotFound')
|
|
441
|
+
return undefined;
|
|
442
|
+
throw error;
|
|
443
|
+
}
|
|
444
|
+
assertExpectedProducer(producer, owner.producer);
|
|
445
|
+
const pinned = await readPinnedPackage(owner, await currentResourceRoot(owner));
|
|
446
|
+
if (options.validateFiles !== false)
|
|
447
|
+
await validatePackageResources(pinned);
|
|
448
|
+
return pinned;
|
|
449
|
+
}
|
|
450
|
+
function packageView(owner, packageId, record, resourceRoot = null) {
|
|
451
|
+
const selector = `${owner.producer.sourceId}/${owner.producer.pluginName}`;
|
|
452
|
+
const routes = record?.routes ?? null;
|
|
453
|
+
return {
|
|
454
|
+
selector, packageId, owner: { kind: 'plugin', producer: owner.producer },
|
|
455
|
+
pluginVersion: record?.pluginVersion ?? null,
|
|
456
|
+
sourceContentDigest: record?.sourceContentDigest ?? null,
|
|
457
|
+
availability: routes ? (routes.subcommands.length || routes.fallback ? 'ready' : 'empty') : 'unavailable',
|
|
458
|
+
resourceRoot,
|
|
459
|
+
routes,
|
|
460
|
+
subcommands: routes?.subcommands.map((entry) => entry.name) ?? [],
|
|
461
|
+
hasFallback: routes?.fallback !== undefined,
|
|
462
|
+
runtimeConfigPlatforms: record?.runtimeConfigPlatforms ?? [],
|
|
463
|
+
requiresPlatformContext: record ? Boolean(record.runtimeConfigKeys?.length) : null,
|
|
464
|
+
nativeTools: record?.nativeTools ?? null,
|
|
465
|
+
errors: [],
|
|
466
|
+
recoveryActions: [],
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
async function inspectOwnedPackage(owner, id) {
|
|
470
|
+
let pinned;
|
|
471
|
+
let resourceRoot = null;
|
|
472
|
+
try {
|
|
473
|
+
resourceRoot = await currentResourceRoot(owner);
|
|
474
|
+
pinned = await readPinnedPackage(owner, resourceRoot);
|
|
475
|
+
await validatePackageResources(pinned);
|
|
476
|
+
return packageView(owner, id, pinned.record, resourceRoot);
|
|
477
|
+
}
|
|
478
|
+
catch (error) {
|
|
479
|
+
const view = packageView(owner, id, pinned?.record, resourceRoot);
|
|
480
|
+
view.availability = 'unavailable';
|
|
481
|
+
view.requiresPlatformContext = null;
|
|
482
|
+
view.errors.push(managedCommandDiagnostic(error));
|
|
483
|
+
view.recoveryActions.push(`aw command package sync ${view.selector}`, `aw command package remove ${id} --force --yes`);
|
|
484
|
+
return view;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
export async function readManagedCommandPackageView(id, env = process.env) {
|
|
488
|
+
return inspectOwnedPackage(await readManagedCommandPackageOwner(id, env), id);
|
|
489
|
+
}
|
|
490
|
+
// Hash only the live pointer and its revision. Unreachable staging and old revisions are not publication evidence.
|
|
491
|
+
export async function captureManagedCommandPackageEvidence(view, env = process.env, options = {}) {
|
|
492
|
+
const owner = await readManagedCommandPackageOwner(view.packageId, env);
|
|
493
|
+
assertExpectedProducer(view.owner.producer, owner.producer);
|
|
494
|
+
return capturePackageEvidence(owner, { reviewedRoot: view.resourceRoot, force: options.force });
|
|
495
|
+
}
|
|
496
|
+
async function capturePackageEvidence(owner, options = {}) {
|
|
497
|
+
const { packageRoot } = owner;
|
|
498
|
+
async function observedResourceRoot() {
|
|
499
|
+
try {
|
|
500
|
+
return await currentResourceRoot(owner);
|
|
501
|
+
}
|
|
502
|
+
catch (error) {
|
|
503
|
+
if (error instanceof ManagedCommandError)
|
|
504
|
+
return null;
|
|
505
|
+
throw error;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
const resourceRoot = await observedResourceRoot();
|
|
509
|
+
if (options.reviewedRoot !== undefined && resourceRoot !== options.reviewedRoot)
|
|
510
|
+
fail('operationReviewStale', 'The reviewed command package revision changed. Run the operation again.');
|
|
511
|
+
const hash = crypto.createHash('sha256');
|
|
512
|
+
const add = (fields) => hash.update(JSON.stringify(fields)).update('\n');
|
|
513
|
+
const modeMask = process.platform === 'win32' ? 0o200 : 0o777;
|
|
514
|
+
async function visit(file, descend) {
|
|
515
|
+
const relative = path.relative(packageRoot, file).split(path.sep).join('/');
|
|
516
|
+
const stat = await lstatIfExists(file);
|
|
517
|
+
if (!stat)
|
|
518
|
+
add(['missing', relative]);
|
|
519
|
+
else if (stat.isSymbolicLink())
|
|
520
|
+
add(['symlink', relative, await fs.readlink(file)]);
|
|
521
|
+
else if (stat.isDirectory()) {
|
|
522
|
+
add(['directory', relative, stat.mode & modeMask, ...(descend ? [] : [stat.dev, stat.ino])]);
|
|
523
|
+
if (descend)
|
|
524
|
+
for (const name of (await fs.readdir(file)).sort())
|
|
525
|
+
await visit(path.join(file, name), true);
|
|
526
|
+
}
|
|
527
|
+
else if (stat.isFile()) {
|
|
528
|
+
try {
|
|
529
|
+
add(['file', relative, stat.mode & modeMask, await calculateFileDigest(file)]);
|
|
530
|
+
}
|
|
531
|
+
catch (error) {
|
|
532
|
+
if (!options.force || relative !== 'current.json')
|
|
533
|
+
throw error;
|
|
534
|
+
// The owner still authorizes deletion if the weak pointer itself is unreadable.
|
|
535
|
+
add(['unreadable', relative, stat.mode, stat.dev, stat.ino, stat.size, stat.mtimeMs, stat.ctimeMs]);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
else
|
|
539
|
+
add(['special', relative, stat.mode, stat.ino]);
|
|
540
|
+
}
|
|
541
|
+
add([options.force ? 'owner-and-pointer' : 'revision']);
|
|
542
|
+
await visit(packageRoot, false);
|
|
543
|
+
await visit(path.join(packageRoot, 'owner.json'), false);
|
|
544
|
+
await visit(path.join(packageRoot, 'current.json'), false);
|
|
545
|
+
if (resourceRoot && !options.force) {
|
|
546
|
+
const revisions = path.dirname(resourceRoot);
|
|
547
|
+
const stat = await lstatIfExists(revisions);
|
|
548
|
+
await visit(stat?.isDirectory() ? resourceRoot : revisions, true);
|
|
549
|
+
}
|
|
550
|
+
if (await observedResourceRoot() !== resourceRoot)
|
|
551
|
+
fail('operationReviewStale', 'The reviewed command package revision changed. Run the operation again.');
|
|
552
|
+
return { packageDigest: `sha256:${hash.digest('hex')}` };
|
|
553
|
+
}
|
|
554
|
+
async function assertExpectedPackage(root, id, producer, expected, force = false) {
|
|
555
|
+
let owner;
|
|
556
|
+
try {
|
|
557
|
+
owner = await readPackageOwner(root, id);
|
|
558
|
+
}
|
|
559
|
+
catch (error) {
|
|
560
|
+
if (!(error instanceof ManagedCommandError) || error.code !== 'commandNotFound')
|
|
561
|
+
throw error;
|
|
562
|
+
}
|
|
563
|
+
if (owner)
|
|
564
|
+
assertExpectedProducer(producer, owner.producer);
|
|
565
|
+
if (expected === undefined)
|
|
566
|
+
return owner;
|
|
567
|
+
const current = owner ? await capturePackageEvidence(owner, { force }) : null;
|
|
568
|
+
if (!equal(current, expected))
|
|
569
|
+
fail('operationReviewStale', 'The reviewed command package changed before publication or removal.');
|
|
570
|
+
return owner;
|
|
571
|
+
}
|
|
572
|
+
/** Called with the AW_HOME mutation lock held. */
|
|
573
|
+
export async function removeManagedCommandPackage(id, env = process.env, options = {}) {
|
|
574
|
+
const root = await managedCommandRoot(env);
|
|
575
|
+
const owner = await readPackageOwner(root, id);
|
|
576
|
+
const verified = await assertExpectedPackage(root, id, owner.producer, options.expectedPackage, options.force);
|
|
577
|
+
if (!verified)
|
|
578
|
+
fail('commandNotFound', 'The command package is no longer installed.');
|
|
579
|
+
if (!options.force && (await inspectOwnedPackage(verified, id)).availability === 'unavailable') {
|
|
580
|
+
fail('commandPackageUnavailable', 'The command package is damaged. Review and repeat package remove with --force.');
|
|
581
|
+
}
|
|
582
|
+
// Keep independent ownership evidence until all potentially busy revisions are gone.
|
|
583
|
+
try {
|
|
584
|
+
for (const name of await fs.readdir(verified.packageRoot)) {
|
|
585
|
+
if (name !== 'owner.json')
|
|
586
|
+
await fs.rm(path.join(verified.packageRoot, name), { recursive: true, force: true });
|
|
587
|
+
}
|
|
588
|
+
await fs.unlink(path.join(verified.packageRoot, 'owner.json'));
|
|
589
|
+
await fs.rmdir(verified.packageRoot);
|
|
590
|
+
}
|
|
591
|
+
catch {
|
|
592
|
+
fail('commandPackageRemovalFailed', `Could not finish removing the command package. Release its files and retry aw command package remove ${id} --force --yes.`);
|
|
593
|
+
}
|
|
594
|
+
return { producer: verified.producer };
|
|
595
|
+
}
|
|
596
|
+
/** Called with the AW_HOME mutation lock held. */
|
|
597
|
+
export async function syncManagedCommandPackage(options) {
|
|
598
|
+
const env = options.env ?? process.env;
|
|
599
|
+
const root = await managedCommandRoot(env);
|
|
600
|
+
const producer = normalizeProducerIdentity(options.producer);
|
|
601
|
+
const record = normalizeInstalledCommandProducer(options.record);
|
|
602
|
+
assertExpectedProducer(producer, record.producer);
|
|
603
|
+
const id = getCommandPackageId(producer);
|
|
604
|
+
const packageRoot = path.join(root, 'packages', id);
|
|
605
|
+
await ensureRegularDirectoryPath(path.dirname(packageRoot), 'Managed command packages');
|
|
606
|
+
const revision = crypto.randomUUID();
|
|
607
|
+
const staging = await fs.mkdtemp(path.join(path.dirname(packageRoot), `.${id}.`));
|
|
608
|
+
const stagedRevision = path.join(staging, 'revisions', revision);
|
|
609
|
+
const resourceRoot = path.join(packageRoot, 'revisions', revision);
|
|
610
|
+
let unpublishedRevision;
|
|
611
|
+
try {
|
|
612
|
+
await copyManagedCommandDirectory(options.sourceDirectory, stagedRevision, env, { trustedPluginSource: true });
|
|
613
|
+
if (options.expectedResourceDigest !== undefined
|
|
614
|
+
&& await calculateManagedCommandResourceDigest(stagedRevision) !== options.expectedResourceDigest) {
|
|
615
|
+
fail('operationReviewStale', 'The prepared command package files changed after review. Run the operation again.');
|
|
616
|
+
}
|
|
617
|
+
await writeJson(stagedRevision, path.join(stagedRevision, COMMAND_PRODUCER_RECORD), record);
|
|
618
|
+
await validatePackageResources({ resourceRoot: stagedRevision, record });
|
|
619
|
+
const pointer = { schemaVersion: 2, revision };
|
|
620
|
+
const owner = await assertExpectedPackage(root, id, producer, options.expectedPackage);
|
|
621
|
+
if (owner) {
|
|
622
|
+
await ensureRegularDirectoryPath(path.dirname(resourceRoot), 'Managed command revisions');
|
|
623
|
+
await fs.rename(stagedRevision, resourceRoot);
|
|
624
|
+
unpublishedRevision = resourceRoot;
|
|
625
|
+
// Readers pin this pointer once. Earlier revisions can be removed only after the switch.
|
|
626
|
+
await writeJson(packageRoot, path.join(packageRoot, 'current.json'), pointer);
|
|
627
|
+
unpublishedRevision = undefined;
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
await writeJson(staging, path.join(staging, 'owner.json'), { schemaVersion: 2, owner: 'agent-workflows', kind: 'plugin-command-package', producer });
|
|
631
|
+
await writeJson(staging, path.join(staging, 'current.json'), pointer);
|
|
632
|
+
if (await lstatIfExists(packageRoot))
|
|
633
|
+
fail('operationReviewStale', 'The command package directory appeared before publication. Run the operation again.');
|
|
634
|
+
await fs.rename(staging, packageRoot);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
finally {
|
|
638
|
+
for (const directory of [staging, ...(unpublishedRevision ? [unpublishedRevision] : [])]) {
|
|
639
|
+
try {
|
|
640
|
+
await safePath(root, directory);
|
|
641
|
+
await fs.rm(directory, { recursive: true, force: true });
|
|
642
|
+
}
|
|
643
|
+
catch { /* Best effort for a private, unpublished directory. */ }
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
const errors = [];
|
|
647
|
+
try {
|
|
648
|
+
for (const name of await entriesAt(path.dirname(resourceRoot))) {
|
|
649
|
+
if (name === revision || !REVISION_ID.test(name))
|
|
650
|
+
continue;
|
|
651
|
+
const oldRoot = path.join(path.dirname(resourceRoot), name);
|
|
652
|
+
try {
|
|
653
|
+
await safePath(root, oldRoot);
|
|
654
|
+
if ((await lstatIfExists(oldRoot))?.isDirectory())
|
|
655
|
+
await fs.rm(oldRoot, { recursive: true, force: true });
|
|
656
|
+
}
|
|
657
|
+
catch (error) {
|
|
658
|
+
errors.push(managedCommandDiagnostic(error, name));
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
catch (error) {
|
|
663
|
+
errors.push(managedCommandDiagnostic(error));
|
|
664
|
+
}
|
|
665
|
+
return { id, resourceRoot, errors, recoveryActions: errors.length ? [`aw command package sync ${producer.sourceId}/${producer.pluginName}`] : [] };
|
|
666
|
+
}
|
|
667
|
+
async function resolveUserCommand(id, env) {
|
|
668
|
+
const root = await managedCommandRoot(env);
|
|
669
|
+
const definition = await readUserCommandDefinition(id, env);
|
|
670
|
+
const resourceRoot = path.join(root, 'users', id, 'packages', definition.packageRevision);
|
|
671
|
+
await safePath(root, resourceRoot);
|
|
672
|
+
await validateManagedCommandResource(resourceRoot, definition.launch);
|
|
673
|
+
return { resourceRoot, launch: definition.launch, view: { id, name: definition.name, owner: { kind: 'user' }, availability: 'ready', resourceRoot, launch: definition.launch, errors: [], recoveryActions: [] } };
|
|
674
|
+
}
|
|
675
|
+
async function inspectUserCommand(id, env) {
|
|
676
|
+
try {
|
|
677
|
+
return (await resolveUserCommand(id, env)).view;
|
|
678
|
+
}
|
|
679
|
+
catch (error) {
|
|
680
|
+
if (error instanceof ManagedCommandError && (error.code === 'commandNotFound' || error.argumentError))
|
|
681
|
+
throw error;
|
|
682
|
+
const root = await managedCommandRoot(env);
|
|
683
|
+
const userRoot = await assertUserOwner(root, id);
|
|
684
|
+
let name = id;
|
|
685
|
+
let resourceRoot = null;
|
|
686
|
+
let launch = null;
|
|
687
|
+
try {
|
|
688
|
+
const definition = await readUserCommandDefinition(id, env);
|
|
689
|
+
name = definition.name;
|
|
690
|
+
launch = definition.launch;
|
|
691
|
+
resourceRoot = path.join(userRoot, 'packages', definition.packageRevision);
|
|
692
|
+
}
|
|
693
|
+
catch { /* Owner evidence still permits a diagnostic view and safe removal. */ }
|
|
694
|
+
return { id, name, owner: { kind: 'user' }, availability: 'unavailable', resourceRoot, launch, errors: [managedCommandDiagnostic(error)], recoveryActions: [`aw command remove ${id} --force --yes`] };
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
async function lookupNamedPackage(selector, env) {
|
|
698
|
+
const producer = await resolvePluginCommandProducer(selector, env);
|
|
699
|
+
const packageId = getCommandPackageId(producer);
|
|
700
|
+
const owner = await readManagedCommandPackageOwner(packageId, env);
|
|
701
|
+
assertExpectedProducer(producer, owner.producer);
|
|
702
|
+
return { packageId, owner };
|
|
703
|
+
}
|
|
704
|
+
export async function resolveManagedCommand(selector, env = process.env, options = { args: [] }) {
|
|
705
|
+
if (isUserCommandId(selector)) {
|
|
706
|
+
if (options.noFallback)
|
|
707
|
+
throw new ManagedCommandError('invalidArguments', '--no-fallback requires a plugin command and a subcommand argument.', true);
|
|
708
|
+
return { ...await resolveUserCommand(selector, env), args: options.args };
|
|
709
|
+
}
|
|
710
|
+
if (options.noFallback && options.args.length === 0) {
|
|
711
|
+
throw new ManagedCommandError('invalidArguments', '--no-fallback requires a subcommand argument.', true);
|
|
712
|
+
}
|
|
713
|
+
let invocation;
|
|
714
|
+
try {
|
|
715
|
+
invocation = parseCommandInvocationSelector(selector);
|
|
716
|
+
}
|
|
717
|
+
catch {
|
|
718
|
+
throw new ManagedCommandError('invalidArguments', 'A canonical source/plugin or source/plugin/platform selector is required.', true);
|
|
719
|
+
}
|
|
720
|
+
const { packageSelector, platform } = invocation;
|
|
721
|
+
const { packageId, owner } = await lookupNamedPackage(packageSelector, env);
|
|
722
|
+
let pinned;
|
|
723
|
+
try {
|
|
724
|
+
pinned = await readPinnedPackage(owner, await currentResourceRoot(owner));
|
|
725
|
+
}
|
|
726
|
+
catch (error) {
|
|
727
|
+
if (error instanceof ManagedCommandError && error.code === 'commandIdentityConflict')
|
|
728
|
+
throw error;
|
|
729
|
+
fail('commandUnavailable', 'The installed command package revision is missing or invalid. Run aw command package sync or aw plugin sync.');
|
|
730
|
+
}
|
|
731
|
+
const { resourceRoot, record } = pinned;
|
|
732
|
+
if (record.runtimeConfigKeys?.length) {
|
|
733
|
+
if (!platform) {
|
|
734
|
+
const published = record.runtimeConfigPlatforms.join(', ') || '(none)';
|
|
735
|
+
throw new ManagedCommandError('commandPlatformRequired', `The command requires a source/plugin/platform selector. Published runtime config platforms: ${published}.`, true);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
else if (platform) {
|
|
739
|
+
throw new ManagedCommandError('commandPlatformUnexpected', 'This command does not accept a platform in its selector.', true);
|
|
740
|
+
}
|
|
741
|
+
const subcommand = record.routes.subcommands.find((entry) => entry.name === options.args[0]);
|
|
742
|
+
const fallback = options.noFallback ? undefined : record.routes.fallback;
|
|
743
|
+
let launch;
|
|
744
|
+
if (subcommand) {
|
|
745
|
+
const { name: _name, ...selected } = subcommand;
|
|
746
|
+
launch = selected;
|
|
747
|
+
}
|
|
748
|
+
else if (fallback) {
|
|
749
|
+
launch = fallback;
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
const names = record.routes.subcommands.map((entry) => entry.name);
|
|
753
|
+
const hint = names.length ? `Available subcommands: ${names.join(', ')}.` : 'There are no enabled subcommands.';
|
|
754
|
+
throw new ManagedCommandError('commandRouteNotFound', `No command route matched ${selector}. ${hint}`, true);
|
|
755
|
+
}
|
|
756
|
+
if (platform)
|
|
757
|
+
await validateManagedCommandRuntimeConfigFiles(resourceRoot, record, platform);
|
|
758
|
+
await validateManagedCommandResource(resourceRoot, launch, { skipRuntimeConfigSnapshots: platform !== undefined });
|
|
759
|
+
await validateInstalledNativeTools(pinned);
|
|
760
|
+
return {
|
|
761
|
+
view: packageView(owner, packageId, record, resourceRoot), launch, resourceRoot, producer: record,
|
|
762
|
+
...(platform ? { runtimeConfigContext: { schemaVersion: 1, platform, packageId, revision: path.basename(resourceRoot) } } : {}),
|
|
763
|
+
args: subcommand ? options.args.slice(1) : options.args,
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
export async function inspectManagedCommand(selector, env = process.env) {
|
|
767
|
+
if (isUserCommandId(selector))
|
|
768
|
+
return inspectUserCommand(selector, env);
|
|
769
|
+
const { packageId, owner } = await lookupNamedPackage(selector, env);
|
|
770
|
+
return inspectOwnedPackage(owner, packageId);
|
|
771
|
+
}
|
|
772
|
+
export async function listManagedCommandPackages(env = process.env) {
|
|
773
|
+
const root = await managedCommandRoot(env);
|
|
774
|
+
const packages = [];
|
|
775
|
+
const orphanedPackages = [];
|
|
776
|
+
const errors = [];
|
|
777
|
+
const directory = path.join(root, 'packages');
|
|
778
|
+
await safePath(root, directory);
|
|
779
|
+
const ids = (await entriesAt(directory)).sort();
|
|
780
|
+
let sources;
|
|
781
|
+
let sourceError;
|
|
782
|
+
if (ids.some(isManagedCommandPackageId)) {
|
|
783
|
+
try {
|
|
784
|
+
sources = await readConfiguredSources(env);
|
|
785
|
+
}
|
|
786
|
+
catch (error) {
|
|
787
|
+
sourceError = managedCommandDiagnostic(error);
|
|
788
|
+
errors.push(sourceError);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
for (const id of ids) {
|
|
792
|
+
if (!isManagedCommandPackageId(id)) {
|
|
793
|
+
if (!id.startsWith('.'))
|
|
794
|
+
errors.push({ code: 'commandOwnerMismatch', message: 'An unrecognized command package was retained.', subject: `commands/packages/${id}` });
|
|
795
|
+
continue;
|
|
796
|
+
}
|
|
797
|
+
try {
|
|
798
|
+
const owner = await readPackageOwner(root, id);
|
|
799
|
+
const view = await inspectOwnedPackage(owner, id);
|
|
800
|
+
if (sources?.get(owner.producer.sourceId) === owner.producer.sourceIdentity) {
|
|
801
|
+
packages.push(view);
|
|
802
|
+
}
|
|
803
|
+
else {
|
|
804
|
+
const wasDamaged = view.availability === 'unavailable';
|
|
805
|
+
view.availability = 'unavailable';
|
|
806
|
+
view.requiresPlatformContext = null;
|
|
807
|
+
view.errors.push(sourceError ?? { code: 'commandNotFound', message: 'This command package belongs to a source that was removed or changed.' });
|
|
808
|
+
view.recoveryActions = [`aw command package remove ${id}${wasDamaged ? ' --force' : ''} --yes`];
|
|
809
|
+
orphanedPackages.push(view);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
catch (error) {
|
|
813
|
+
errors.push(managedCommandDiagnostic(error, `commands/packages/${id}`));
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
return { packages, orphanedPackages, errors };
|
|
817
|
+
}
|
|
818
|
+
export async function listManagedCommands(env = process.env) {
|
|
819
|
+
const root = await managedCommandRoot(env);
|
|
820
|
+
const commands = [];
|
|
821
|
+
const errors = [];
|
|
822
|
+
const usersRoot = path.join(root, 'users');
|
|
823
|
+
await safePath(root, usersRoot);
|
|
824
|
+
for (const id of (await entriesAt(usersRoot)).sort()) {
|
|
825
|
+
if (!isUserCommandId(id)) {
|
|
826
|
+
errors.push({ code: 'commandBindingInvalid', message: 'An unrecognized command record was retained.', subject: `commands/users/${id}` });
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
try {
|
|
830
|
+
commands.push(await inspectUserCommand(id, env));
|
|
831
|
+
}
|
|
832
|
+
catch (error) {
|
|
833
|
+
errors.push(managedCommandDiagnostic(error, `commands/users/${id}`));
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
const packages = await listManagedCommandPackages(env);
|
|
837
|
+
return { ...packages, commands, errors: [...errors, ...packages.errors] };
|
|
838
|
+
}
|
|
839
|
+
//# sourceMappingURL=managed-command-store.js.map
|