@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
|
@@ -1,15 +1,88 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { catalogGenerationErrorCode } from './catalog-generation-error.js';
|
|
2
|
+
import { CatalogPluginNotFoundError } from './multi-source-catalog.js';
|
|
3
|
+
import { resolveWorkContext } from '../intent/work-context.js';
|
|
4
|
+
import { observePreferences } from '../intent/deployment-preferences.js';
|
|
5
|
+
import { assertConfigLayerWritable, ConfigLayerError, resolveActiveConfigPlatforms } from './config-platforms.js';
|
|
6
|
+
import { RecoveryInterruptedError, recoveryInterruptionCode } from '../recovery/interruption.js';
|
|
7
|
+
import { readDemand, demandNativeProjection } from '../recovery/demand.js';
|
|
8
|
+
import { createScopeContext } from '../intent/scope-context.js';
|
|
9
|
+
import { nativeDeploymentHasVerifiedComponentWrite } from '../commands/rebuild-platform-integration.js';
|
|
10
|
+
import { projectDeploymentNotices, projectRelatedProjectPermissionFailures } from '../commands/public-lifecycle-result.js';
|
|
11
|
+
import { recoveryHostPermissionEffects } from '../commands/deployment-confirmation.js';
|
|
12
|
+
import { projectComponentDelivery } from '../output/component-delivery.js';
|
|
13
|
+
import { canonicalizeIdentityValue, selectPluginConfigProfile } from '@lesliechan721/aw-plugin-core/manifest';
|
|
14
|
+
import { syncWriteCommand } from '../commands/write-commands.js';
|
|
15
|
+
import { skillInvocationDiagnostics } from '../output/skill-invocation-notices.js';
|
|
16
|
+
import { CONFIG_MUTATION_RECEIPT_SCHEMA_VERSION, } from '../types.js';
|
|
17
|
+
import { assertPluginConfigMutationCandidate, assertSafePluginConfigSegment, coercePluginConfigUpdates, patchPluginConfigStore, PluginConfigSchemaResolutionError, readPluginConfigStore, readNamespacedPluginConfigStoreIdentity, resetPluginConfigStore, resolveConfigRead, resolveEffectivePluginConfig, resolvePluginConfigStorePath, resolvePluginConfigSchemaAccess, summarizeEffectivePluginConfig, } from './plugin-config.js';
|
|
18
|
+
import { analyzePluginConfigMutationImpact, discoverPluginConfigManagedCommandPackages, pluginSharedNativeConfigRenderUnits } from './plugin-config-impact.js';
|
|
19
|
+
import { collectPluginConfigReferenceEvidence, resolvePluginConfigReferencePlugins, resolvePluginConfigReferenceConsumers } from './plugin-config-references.js';
|
|
20
|
+
import { resolvePluginMetaDependencyClosure } from './plugin-dependencies.js';
|
|
21
|
+
import { publishPreparedManagedCommandPackage } from './managed-command-materialization.js';
|
|
22
|
+
import { ManagedCommandError, managedCommandDiagnostic } from './managed-command-store.js';
|
|
23
|
+
import { configPackageResult, inspectConfigCommandPackageReview, prepareConfigCommandPackages } from './plugin-config-command-apply.js';
|
|
24
|
+
import { collectSensitivePluginConfigValues, redactPluginScriptOutput, } from './plugin-scripts.js';
|
|
25
|
+
import { resolveCliPackageRoot } from './paths.js';
|
|
26
|
+
import { readSafeOperationError } from './safe-operation-diagnostic.js';
|
|
12
27
|
import { withAwHomeMutationLock, } from './aw-home-mutation-lock.js';
|
|
28
|
+
import fs from 'fs-extra';
|
|
29
|
+
import path from 'node:path';
|
|
30
|
+
export function buildConfigMutationReceipt(command, receipt) {
|
|
31
|
+
return {
|
|
32
|
+
...receipt,
|
|
33
|
+
receiptSchemaVersion: CONFIG_MUTATION_RECEIPT_SCHEMA_VERSION,
|
|
34
|
+
command,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function configWriteStateForError(error) {
|
|
38
|
+
return error?.configWrite === 'failed'
|
|
39
|
+
? 'failed'
|
|
40
|
+
: 'notStarted';
|
|
41
|
+
}
|
|
42
|
+
function markConfigWriteFailed(error) {
|
|
43
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
44
|
+
return Object.assign(failure, { configWrite: 'failed' });
|
|
45
|
+
}
|
|
46
|
+
function skippedApply(reason) {
|
|
47
|
+
return { state: 'skipped', reason, targetResults: [] };
|
|
48
|
+
}
|
|
49
|
+
async function observeConfigLayerError(options) {
|
|
50
|
+
const { plugin } = options;
|
|
51
|
+
try {
|
|
52
|
+
assertConfigLayerWritable(plugin.pluginId ?? (plugin.sourceId ? `${plugin.sourceId}/${plugin.manifest.name}` : plugin.manifest.name), plugin.manifest, await observePreferences(options), options.platform);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (!(error instanceof ConfigLayerError))
|
|
56
|
+
throw error;
|
|
57
|
+
return error;
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
export function configApplyLayerFailure(error) {
|
|
62
|
+
return { state: 'unavailable', reason: 'targetDiscoveryFailed', targetResults: [],
|
|
63
|
+
error: { stage: 'targetValidation', code: error.code, message: error.message } };
|
|
64
|
+
}
|
|
65
|
+
export function configActiveAvailabilityError(error) {
|
|
66
|
+
if (error instanceof CatalogPluginNotFoundError)
|
|
67
|
+
return { code: 'pluginUnavailable',
|
|
68
|
+
message: 'The plugin is absent from the active catalog. Run aw source sync and check the selector.' };
|
|
69
|
+
if (['catalogGenerationUnavailable', 'catalogGenerationSourceMissing', 'catalogGenerationIdentityMismatch',
|
|
70
|
+
'catalogGenerationStateInvalid', 'catalogGenerationMetadataInvalid'].includes(catalogGenerationErrorCode(error))) {
|
|
71
|
+
return { code: 'sourceActiveUnavailable',
|
|
72
|
+
message: 'The active catalog is unavailable. Run aw source sync, then retry configuration apply.' };
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
function unavailableApply(reason, stage) {
|
|
77
|
+
const messages = {
|
|
78
|
+
invalidConfig: 'The effective config is invalid for every visible target.',
|
|
79
|
+
schemaUnavailable: 'The config schema is unavailable after the config commit.',
|
|
80
|
+
sourceUnavailable: 'The plugin source is unavailable after the config commit.',
|
|
81
|
+
effectiveConfigUnavailable: 'The effective config cannot be read after the config commit.',
|
|
82
|
+
targetDiscoveryFailed: 'Visible config apply targets cannot be discovered after the config commit.',
|
|
83
|
+
};
|
|
84
|
+
return { state: 'unavailable', reason, targetResults: [], error: { stage, code: reason, message: messages[reason] } };
|
|
85
|
+
}
|
|
13
86
|
function uniqueInOrder(values) {
|
|
14
87
|
return [...new Set(values)];
|
|
15
88
|
}
|
|
@@ -17,7 +90,7 @@ function collectRemovedConfigKeys(values) {
|
|
|
17
90
|
return uniqueInOrder(Object.keys(values));
|
|
18
91
|
}
|
|
19
92
|
function targetKey(target) {
|
|
20
|
-
return `${target.platform}:${target.scope}:${target.projectKey ?? '-'}`;
|
|
93
|
+
return `${target.pluginName}:${target.platform}:${target.scope}:${target.projectKey ?? '-'}`;
|
|
21
94
|
}
|
|
22
95
|
function dedupeTargets(targets) {
|
|
23
96
|
const deduped = new Map();
|
|
@@ -25,168 +98,158 @@ function dedupeTargets(targets) {
|
|
|
25
98
|
deduped.set(targetKey(target), target);
|
|
26
99
|
return [...deduped.values()];
|
|
27
100
|
}
|
|
28
|
-
async function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
pluginName: options.pluginName,
|
|
36
|
-
platform: options.platform,
|
|
37
|
-
scope: options.scope,
|
|
38
|
-
...(options.scope === 'project'
|
|
39
|
-
? { projectKey: await resolveProjectKey(options.platform, options.cwd) }
|
|
40
|
-
: {}),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
async function discoverVisibleTargets(options) {
|
|
44
|
-
const targets = [];
|
|
45
|
-
const failures = [];
|
|
46
|
-
const namedTargets = [];
|
|
47
|
-
const scopes = options.scope === 'user' ? ['user', 'project'] : ['project'];
|
|
48
|
-
for (const platform of ['codex', 'claude']) {
|
|
49
|
-
for (const scope of scopes) {
|
|
50
|
-
if (!supportsPlatform(options.plugin.manifest, platform))
|
|
101
|
+
async function configApplyHasValidSharedNativeTarget(options) {
|
|
102
|
+
const plugins = await resolvePluginConfigReferenceConsumers({ plugin: options.plugin, env: options.env, plugins: options.plugins });
|
|
103
|
+
for (const plugin of plugins) {
|
|
104
|
+
for (const target of options.targets.filter((target) => target.pluginName === plugin.manifest.name)) {
|
|
105
|
+
const shared = pluginSharedNativeConfigRenderUnits(plugin);
|
|
106
|
+
if (!shared.some((entry) => entry.platform === target.platform))
|
|
51
107
|
continue;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
platform,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
try {
|
|
59
|
-
const names = await discoverRebuildTargetNames({
|
|
60
|
-
cwd: options.cwd,
|
|
61
|
-
env: options.env,
|
|
62
|
-
platform,
|
|
63
|
-
scope,
|
|
64
|
-
nativeCliRunner: options.nativeCliRunner,
|
|
65
|
-
nativeFailureMode: 'ignore',
|
|
66
|
-
marketplaceName: options.plugin.marketplaceName,
|
|
67
|
-
marketplaceRoot: options.plugin.sourceId
|
|
68
|
-
? path.join(resolveAwHome(options.env), 'marketplaces', options.plugin.sourceId)
|
|
69
|
-
: undefined,
|
|
70
|
-
});
|
|
71
|
-
if (!names.includes(options.pluginName))
|
|
72
|
-
continue;
|
|
73
|
-
namedTargets.push(target);
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
failures.push({
|
|
77
|
-
target,
|
|
78
|
-
action: 'reinstall',
|
|
79
|
-
state: 'failed',
|
|
80
|
-
message: error instanceof Error ? error.message : String(error),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
108
|
+
const effective = await resolveEffectivePluginConfig({ sourceId: plugin.sourceId,
|
|
109
|
+
sourceIdentity: plugin.sourceIdentity, logicalIdentity: plugin.catalogLogicalIdentity,
|
|
110
|
+
manifest: plugin.manifest, platform: target.platform, targetScope: 'user',
|
|
111
|
+
cwd: options.cwd, env: options.env, referencePlugins: options.plugins });
|
|
112
|
+
if (!effective.issues.length)
|
|
113
|
+
return true;
|
|
83
114
|
}
|
|
84
115
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
context: {
|
|
109
|
-
env: options.env,
|
|
110
|
-
nativeCliRunner: options.nativeCliRunner,
|
|
111
|
-
reporter: options.rebuildRuntime?.reporter ?? createNoopReporter(),
|
|
112
|
-
debugLogger: options.rebuildRuntime?.debugLogger ?? createNoopDebugLogger(),
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
if (inspected.inspection.state === 'present' || inspected.inspection.state === 'partial') {
|
|
116
|
-
targets.push(target);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
failures.push({
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
export async function resolveConfigPreApplyAuthorization(options) {
|
|
119
|
+
const applyTargets = dedupeTargets(options.applyTargets).filter((target) => !options.rebuildRuntime?.configApplyPackages?.targets.some((entry) => entry.blocker
|
|
120
|
+
&& entry.pluginId === (target.pluginId ?? options.plugin.pluginId) && entry.platforms.includes(target.platform)));
|
|
121
|
+
if (applyTargets.some((target) => target.pluginName !== options.plugin.manifest.name)) {
|
|
122
|
+
const plugins = await resolvePluginConfigReferencePlugins({ sourceId: options.plugin.sourceId,
|
|
123
|
+
sourceIdentity: options.plugin.sourceIdentity, logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
124
|
+
env: options.env, plugins: options.rebuildRuntime?.referencePlugins });
|
|
125
|
+
const results = await Promise.all(plugins.map((plugin) => resolveConfigPreApplyAuthorization({ ...options, plugin,
|
|
126
|
+
applyTargets: applyTargets.filter((target) => target.pluginName === plugin.manifest.name) })));
|
|
127
|
+
return { targets: results.flatMap((result) => result.targets),
|
|
128
|
+
availableApplyTargets: results.flatMap((result) => result.availableApplyTargets),
|
|
129
|
+
unavailableTargetResults: results.flatMap((result) => result.unavailableTargetResults) };
|
|
130
|
+
}
|
|
131
|
+
if (applyTargets.length === 0 || !pluginMayRunPreApply(options.plugin)) {
|
|
132
|
+
return { targets: [], availableApplyTargets: applyTargets, unavailableTargetResults: [] };
|
|
133
|
+
}
|
|
134
|
+
if (options.plugin.sourceId && !options.plugin.pluginId) {
|
|
135
|
+
return {
|
|
136
|
+
targets: [],
|
|
137
|
+
availableApplyTargets: [],
|
|
138
|
+
unavailableTargetResults: applyTargets.map((target) => ({
|
|
121
139
|
target,
|
|
122
140
|
action: 'reinstall',
|
|
123
141
|
state: 'failed',
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return { targets: dedupeTargets(targets), failures };
|
|
129
|
-
}
|
|
130
|
-
async function reinstallVisibleTargets(options) {
|
|
131
|
-
const nativeCliRunner = options.nativeCliRunner ?? getDefaultNativeCliRunner();
|
|
132
|
-
const discovered = options.applyTargets === undefined
|
|
133
|
-
? await discoverVisibleTargets({
|
|
134
|
-
pluginName: options.plugin.manifest.name,
|
|
135
|
-
plugin: options.plugin,
|
|
136
|
-
scope: options.scope,
|
|
137
|
-
cwd: options.cwd,
|
|
138
|
-
env: options.env,
|
|
139
|
-
nativeCliRunner,
|
|
140
|
-
rebuildRuntime: options.rebuildRuntime,
|
|
141
|
-
})
|
|
142
|
-
: { targets: dedupeTargets(options.applyTargets), failures: [] };
|
|
143
|
-
const targetResults = [...discovered.failures];
|
|
144
|
-
let runtimeFailed = discovered.failures.length > 0;
|
|
145
|
-
const reinstall = options.reinstallCommandImpl ?? reinstallWriteCommand;
|
|
146
|
-
if (options.plugin.sourceId && !options.plugin.pluginId) {
|
|
147
|
-
throw new Error(`Plugin "${options.plugin.manifest.name}" is missing its namespaced plugin ID.`);
|
|
142
|
+
errorCode: 'sourceUnavailable',
|
|
143
|
+
message: 'The preApply authorization scope cannot be resolved for this target.',
|
|
144
|
+
})),
|
|
145
|
+
};
|
|
148
146
|
}
|
|
149
147
|
const selector = options.plugin.sourceId
|
|
150
148
|
? options.plugin.pluginId
|
|
151
149
|
: options.plugin.manifest.name;
|
|
152
|
-
|
|
150
|
+
const groups = new Map();
|
|
151
|
+
for (const target of applyTargets) {
|
|
152
|
+
const key = `${target.scope}\0${target.platform}`;
|
|
153
|
+
const targets = groups.get(key) ?? [];
|
|
154
|
+
targets.push(target);
|
|
155
|
+
groups.set(key, targets);
|
|
156
|
+
}
|
|
157
|
+
const authorization = [];
|
|
158
|
+
const availableApplyTargets = [];
|
|
159
|
+
const unavailableTargetResults = [];
|
|
160
|
+
const resolveGroup = async (targets) => {
|
|
161
|
+
const platform = targets[0].platform;
|
|
162
|
+
let context;
|
|
153
163
|
try {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
164
|
+
context = await createScopeContext({ scope: targets[0].scope, cwd: options.cwd, env: options.env });
|
|
165
|
+
const demand = await readDemand({ scope: targets[0].scope,
|
|
166
|
+
cwd: context.executionCwd, env: context.env });
|
|
167
|
+
const preview = await (options.reinstallCommandImpl ?? syncWriteCommand)([selector], {
|
|
168
|
+
cwd: context.executionCwd,
|
|
169
|
+
platform,
|
|
170
|
+
scope: targets[0].scope,
|
|
158
171
|
}, {
|
|
159
172
|
...options.rebuildRuntime,
|
|
160
|
-
env:
|
|
161
|
-
nativeCliRunner,
|
|
173
|
+
env: context.env,
|
|
174
|
+
nativeCliRunner: options.nativeCliRunner ?? options.rebuildRuntime?.nativeCliRunner,
|
|
175
|
+
previewOperationPlan: true,
|
|
176
|
+
resolvePreApplyAuthorization: true,
|
|
177
|
+
executionInput: {
|
|
178
|
+
context, requirements: demandNativeProjection(demand),
|
|
179
|
+
selectedTargets: targets.map((target) => ({ pluginId: selector,
|
|
180
|
+
platform: target.platform, scope: target.scope })),
|
|
181
|
+
preserveOtherObservedTargets: true,
|
|
182
|
+
},
|
|
162
183
|
});
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
184
|
+
if (preview.overallState !== 'succeeded' || !preview.preApplyAuthorization)
|
|
185
|
+
return false;
|
|
186
|
+
authorization.push(...preview.preApplyAuthorization);
|
|
187
|
+
availableApplyTargets.push(...targets);
|
|
188
|
+
return true;
|
|
166
189
|
}
|
|
167
|
-
catch
|
|
168
|
-
|
|
169
|
-
|
|
190
|
+
catch {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
await context?.dispose();
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
for (const targets of groups.values()) {
|
|
198
|
+
if (await resolveGroup(targets))
|
|
199
|
+
continue;
|
|
200
|
+
for (const target of targets) {
|
|
201
|
+
if (targets.length > 1 && await resolveGroup([target]))
|
|
202
|
+
continue;
|
|
203
|
+
unavailableTargetResults.push({
|
|
170
204
|
target,
|
|
171
205
|
action: 'reinstall',
|
|
172
206
|
state: 'failed',
|
|
173
|
-
|
|
207
|
+
errorCode: 'sourceUnavailable',
|
|
208
|
+
message: 'The preApply authorization scope cannot be resolved for this target.',
|
|
174
209
|
});
|
|
175
210
|
}
|
|
176
211
|
}
|
|
177
|
-
const overallState = runtimeFailed || targetResults.some((entry) => entry.state === 'failed')
|
|
178
|
-
? 'failed' : 'succeeded';
|
|
179
212
|
return {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
213
|
+
targets: [...new Map(authorization.map((target) => [[
|
|
214
|
+
target.pluginId,
|
|
215
|
+
target.platform,
|
|
216
|
+
target.scope,
|
|
217
|
+
].join('\0'), target])).values()],
|
|
218
|
+
availableApplyTargets: dedupeTargets(availableApplyTargets),
|
|
219
|
+
unavailableTargetResults,
|
|
185
220
|
};
|
|
186
221
|
}
|
|
222
|
+
function pluginMayRunPreApply(plugin) {
|
|
223
|
+
return plugin.manifest.scripts?.preApply !== undefined
|
|
224
|
+
|| (plugin.manifest.dependencies?.length ?? 0) > 0;
|
|
225
|
+
}
|
|
226
|
+
function throwPreApplyAuthorizationRequired(targets) {
|
|
227
|
+
const plugins = [...new Set(targets.map((target) => target.pluginId))].join(', ');
|
|
228
|
+
const error = new Error(`preApplyAuthorizationRequired: Applying this config runs plugin preApply for ${plugins}. Re-run with --yes.`);
|
|
229
|
+
error.code = 'preApplyAuthorizationRequired';
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
function preApplyAuthorizationIsConfirmed(options) {
|
|
233
|
+
if (options.confirmed !== true)
|
|
234
|
+
return false;
|
|
235
|
+
if (options.authorizedTargets === undefined)
|
|
236
|
+
return true;
|
|
237
|
+
const authorized = new Set(options.authorizedTargets.map((target) => [
|
|
238
|
+
target.pluginId,
|
|
239
|
+
target.sourceIdentity,
|
|
240
|
+
target.platform,
|
|
241
|
+
target.scope,
|
|
242
|
+
].join('\0')));
|
|
243
|
+
return options.required.every((target) => authorized.has([
|
|
244
|
+
target.pluginId,
|
|
245
|
+
target.sourceIdentity,
|
|
246
|
+
target.platform,
|
|
247
|
+
target.scope,
|
|
248
|
+
].join('\0')));
|
|
249
|
+
}
|
|
187
250
|
function otherProjectsWarning(scope) {
|
|
188
251
|
return scope === 'user'
|
|
189
|
-
? ['
|
|
252
|
+
? ['其它项目不会由本次命令扫描或更新,可能需要在对应项目目录中运行 aw plugin sync --context project。']
|
|
190
253
|
: [];
|
|
191
254
|
}
|
|
192
255
|
function buildReceiptFieldEntry(options) {
|
|
@@ -197,167 +260,464 @@ function buildReceiptFieldEntry(options) {
|
|
|
197
260
|
reserved: options.reserved,
|
|
198
261
|
action: options.action,
|
|
199
262
|
scope: options.scope,
|
|
200
|
-
...(options.scope === 'project' ? { projectLayer: options.projectLayer } : {}),
|
|
201
263
|
...(options.valueState ? { valueState: options.valueState } : {}),
|
|
202
264
|
};
|
|
203
265
|
}
|
|
204
266
|
export async function replayConfigRuntimeWrites(options) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
267
|
+
if (options.scope === 'user' && options.sharedNativeApplyConfirmed !== true && await configApplyHasValidSharedNativeTarget({
|
|
268
|
+
...options, plugins: options.rebuildRuntime?.referencePlugins, targets: options.applyTargets ?? [],
|
|
269
|
+
}))
|
|
270
|
+
throwSharedNativeApplyConfirmationRequired();
|
|
271
|
+
const result = await applyPluginConfig(options);
|
|
272
|
+
return { ...result, configWrite: 'succeeded', otherProjectsMayRequireSync: false };
|
|
273
|
+
}
|
|
274
|
+
const commandCandidateCleanup = new WeakMap();
|
|
275
|
+
function configApplyRequestedTargets(plan) {
|
|
276
|
+
const targets = plan.joint
|
|
277
|
+
? plan.joint.children.filter((child) => child.command !== 'cleanup' && child.command !== 'uninstall')
|
|
278
|
+
.flatMap((child) => configApplyRequestedTargets(child))
|
|
279
|
+
: plan.receipt.requestedTargets;
|
|
280
|
+
return targets.filter((target) => !plan.receipt.targetResults.some((result) => result.pluginId === target.pluginId && result.agent === target.agent && result.scope === target.scope
|
|
281
|
+
&& (result.satisfaction === 'unsupported' || result.satisfaction === 'excluded')));
|
|
282
|
+
}
|
|
283
|
+
function configApplyPackageHook(options, entries, referencePlugins) {
|
|
284
|
+
const env = options.env ?? process.env;
|
|
285
|
+
const targets = entries.map(({ target, plugin, evidence }) => ({
|
|
286
|
+
pluginId: plugin.pluginId ?? plugin.manifest.name,
|
|
287
|
+
scope: 'user',
|
|
288
|
+
packageId: target.packageId,
|
|
289
|
+
platforms: evidence.review?.routeChanges.length || evidence.blocker
|
|
290
|
+
? [...plugin.manifest.command?.platforms ?? target.runtimeConfigPlatforms] : [],
|
|
291
|
+
...(evidence.blocker && ['nativeToolSyncRequired', 'configApplyVersionMismatch'].includes(evidence.blocker.code)
|
|
292
|
+
? { blocker: evidence.blocker } : {}),
|
|
293
|
+
dependencies: resolvePluginMetaDependencyClosure(referencePlugins, [plugin.manifest.name])
|
|
294
|
+
.filter((entry) => entry.manifest.name !== plugin.manifest.name).map((entry) => entry.pluginId ?? entry.manifest.name),
|
|
295
|
+
}));
|
|
296
|
+
const selected = (pluginId, packageId) => entries.filter(({ target, plugin }) => (plugin.pluginId ?? plugin.manifest.name) === pluginId && (!packageId || target.packageId === packageId));
|
|
297
|
+
return { targets, evidence: entries.map(({ evidence }) => evidence),
|
|
298
|
+
blocked: (pluginId, _scope, code, packageId) => selected(pluginId, packageId).map(({ target, candidate, evidence }) => configPackageResult(target, [evidence.blocker ?? { code, message: 'The command package refresh did not complete.' }], candidate)),
|
|
299
|
+
execute: async (pluginId, _scope, _token, packageId) => {
|
|
300
|
+
const results = [];
|
|
301
|
+
for (const { target, plugin, candidate, evidence } of selected(pluginId, packageId)) {
|
|
302
|
+
if (evidence.blocker || !candidate) {
|
|
303
|
+
results.push(configPackageResult(target, [evidence.blocker ?? {
|
|
304
|
+
code: 'commandPackageApplyFailed', message: 'The command package could not be prepared.',
|
|
305
|
+
}]));
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
try {
|
|
309
|
+
options.rebuildRuntime?.signal?.throwIfAborted();
|
|
310
|
+
if (canonicalizeIdentityValue(evidence.review) !== canonicalizeIdentityValue(await inspectConfigCommandPackageReview(options, target, candidate))) {
|
|
311
|
+
throw new ManagedCommandError('operationReviewStale', 'Permissions affecting the reviewed routes changed. Prepare a new Review.');
|
|
312
|
+
}
|
|
313
|
+
const published = await publishPreparedManagedCommandPackage({ plugin, candidate, cwd: options.cwd, env, referencePlugins });
|
|
314
|
+
results.push(configPackageResult(target, [], candidate, published));
|
|
315
|
+
}
|
|
316
|
+
catch (error) {
|
|
317
|
+
if (recoveryInterruptionCode(error, options.rebuildRuntime?.signal) || readSafeOperationError(error))
|
|
318
|
+
throw error;
|
|
319
|
+
results.push(configPackageResult(target, [managedCommandDiagnostic(error)], candidate));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return results;
|
|
226
323
|
},
|
|
227
|
-
}
|
|
324
|
+
};
|
|
228
325
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const requestedRemoveKeys = uniqueInOrder(options.request.removeKeys ?? []);
|
|
241
|
-
const duplicateKeys = requestedRemoveKeys.filter((key) => Object.hasOwn(requestedUpdates, key));
|
|
242
|
-
if (duplicateKeys.length > 0) {
|
|
243
|
-
throw new Error(`Config write cannot update and remove the same key: ${duplicateKeys.join(', ')}.`);
|
|
244
|
-
}
|
|
245
|
-
const schemaAccess = await resolvePluginConfigSchemaAccess({
|
|
246
|
-
pluginName,
|
|
247
|
-
currentPlugin: options.plugin,
|
|
248
|
-
currentPluginError: options.pluginError,
|
|
249
|
-
scope: options.scope,
|
|
250
|
-
projectLayer,
|
|
251
|
-
cwd: options.cwd,
|
|
252
|
-
env: options.env,
|
|
326
|
+
/** Prepare the same existing-output plan used by apply, without saving config or output. */
|
|
327
|
+
export async function preparePluginConfigApply(options, { inspectOnly = false } = {}) {
|
|
328
|
+
const { prepareRecovery, describeRecoveryPlan } = await import('../recovery/coordinator.js');
|
|
329
|
+
const context = options.context ?? options.scope;
|
|
330
|
+
const referencePlugins = await resolvePluginConfigReferencePlugins({ sourceId: options.plugin.sourceId,
|
|
331
|
+
sourceIdentity: options.plugin.sourceIdentity, logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
332
|
+
env: options.env, plugins: options.rebuildRuntime?.referencePlugins,
|
|
333
|
+
operationContext: options.rebuildRuntime?.catalogOperationContext }).catch((error) => {
|
|
334
|
+
if (recoveryInterruptionCode(error, options.rebuildRuntime?.signal))
|
|
335
|
+
throw error;
|
|
336
|
+
throw Object.assign(new Error('The selected source has no usable Active Catalog.'), { code: 'sourceActiveUnavailable' });
|
|
253
337
|
});
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (!schema[key])
|
|
261
|
-
throw new Error(`Unknown config key "${key}".`);
|
|
262
|
-
}
|
|
263
|
-
const updates = await coercePluginConfigUpdates({ schema, updates: requestedUpdates, cwd: options.cwd });
|
|
264
|
-
if (options.scope === 'project' && projectLayer === 'shared') {
|
|
265
|
-
for (const key of Object.keys(updates)) {
|
|
266
|
-
const field = schema[key];
|
|
267
|
-
if (field.type === 'file' || field.type === 'directory') {
|
|
268
|
-
throw new Error(`Config "${key}" is a ${field.type} value and cannot be written into project shared config. `
|
|
269
|
-
+ 'Use `--scope project --local` or user config instead.');
|
|
270
|
-
}
|
|
338
|
+
if (options.plugin.sourceId) {
|
|
339
|
+
const activePlugin = referencePlugins.find((entry) => entry.manifest.name === options.plugin.manifest.name);
|
|
340
|
+
if (activePlugin)
|
|
341
|
+
options = { ...options, plugin: activePlugin };
|
|
342
|
+
else if (options.plugin.manifest.command) {
|
|
343
|
+
throw Object.assign(new Error('The plugin is unavailable in Active Catalog.'), { code: 'pluginUnavailable' });
|
|
271
344
|
}
|
|
272
345
|
}
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
346
|
+
const pluginId = options.plugin.pluginId ?? (options.plugin.sourceId
|
|
347
|
+
? `${options.plugin.sourceId}/${options.plugin.manifest.name}` : options.plugin.manifest.name);
|
|
348
|
+
const preferences = await observePreferences(options);
|
|
349
|
+
resolveActiveConfigPlatforms(pluginId, options.plugin.manifest, preferences);
|
|
350
|
+
for (const selected of [...(options.platform ? [options.platform] : []), ...(options.targets ?? [])]) {
|
|
351
|
+
assertConfigLayerWritable(pluginId, options.plugin.manifest, preferences, selected);
|
|
352
|
+
}
|
|
353
|
+
const plugins = await resolvePluginConfigReferenceConsumers({ plugin: options.plugin, env: options.env,
|
|
354
|
+
plugins: referencePlugins });
|
|
355
|
+
const selectors = plugins.map((plugin) => plugin.pluginId ?? plugin.manifest.name);
|
|
356
|
+
const version = options.cliVersion
|
|
357
|
+
?? (await fs.readJson(path.join(resolveCliPackageRoot(), 'package.json'))).version;
|
|
358
|
+
let exactTargets = options.applyTargets?.map((target) => ({
|
|
359
|
+
pluginId: target.pluginId ?? plugins.find((plugin) => plugin.manifest.name === target.pluginName)?.pluginId ?? target.pluginName,
|
|
360
|
+
agent: target.platform,
|
|
361
|
+
scope: target.scope,
|
|
362
|
+
}));
|
|
363
|
+
const retainedLegacyTargets = [];
|
|
364
|
+
if (exactTargets?.length) {
|
|
365
|
+
const { readRecoveryStatus } = await import('../recovery/status.js');
|
|
366
|
+
const observed = await readRecoveryStatus({ context, cwd: options.cwd, env: options.env, cliVersion: version,
|
|
367
|
+
nativeCliRunner: options.nativeCliRunner ?? options.rebuildRuntime?.nativeCliRunner,
|
|
368
|
+
codexObservationSession: options.rebuildRuntime?.codexObservationSession });
|
|
369
|
+
const key = (target) => `${target.pluginId}\0${target.agent}\0${target.scope}`;
|
|
370
|
+
const live = new Set(observed.existingTargets?.map(key));
|
|
371
|
+
const owned = new Set(observed.ownedTargets?.map(key));
|
|
372
|
+
exactTargets = exactTargets.filter((target, index) => {
|
|
373
|
+
if (owned.has(key(target)) && !live.has(key(target))) {
|
|
374
|
+
retainedLegacyTargets.push(options.applyTargets[index]);
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
return true;
|
|
300
378
|
});
|
|
301
|
-
if (boundaryIssues.length > 0) {
|
|
302
|
-
throw new Error([...new Set(boundaryIssues.map((issue) => issue.message))].join(' '));
|
|
303
|
-
}
|
|
304
379
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
380
|
+
const env = options.env ?? process.env;
|
|
381
|
+
const commands = await discoverPluginConfigManagedCommandPackages({ plugin: options.plugin, scope: context,
|
|
382
|
+
cwd: options.cwd, env, referencePlugins });
|
|
383
|
+
let selectedPackages = commands.packages.filter((target) => {
|
|
384
|
+
if (options.applyCommandPackages && !options.applyCommandPackages.includes(target.packageId))
|
|
385
|
+
return false;
|
|
386
|
+
const plugin = plugins.find((entry) => entry.manifest.name === target.producer.pluginName);
|
|
387
|
+
const platforms = plugin?.manifest.command?.platforms ?? target.runtimeConfigPlatforms;
|
|
388
|
+
if (options.platform)
|
|
389
|
+
return options.platform !== 'generic' && platforms.includes(options.platform) && target.runtimeConfigKeys.length > 0;
|
|
390
|
+
return (target.refreshKeys.length > 0 || target.runtimeConfigKeys.length > 0)
|
|
391
|
+
&& (!options.targets || platforms.some((platform) => options.targets.includes(platform)));
|
|
392
|
+
});
|
|
393
|
+
if (options.mutation) {
|
|
394
|
+
const impact = await analyzePluginConfigMutationImpact({ ...options, scope: context, visibleTargets: [],
|
|
395
|
+
mutation: options.mutation, commandDiscovery: { ...commands, packages: selectedPackages }, referencePlugins });
|
|
396
|
+
selectedPackages = impact.affectedCommandPackages;
|
|
397
|
+
}
|
|
398
|
+
const entries = await prepareConfigCommandPackages(options, selectedPackages, plugins, referencePlugins, { inspectOnly });
|
|
399
|
+
const cleanup = () => Promise.all(entries.map(({ candidate }) => candidate?.cleanup()));
|
|
400
|
+
const packagePreparationCache = new Map();
|
|
401
|
+
for (const { target, candidate } of entries) {
|
|
402
|
+
if (candidate)
|
|
403
|
+
packagePreparationCache.set(target.packageId, Promise.resolve(candidate));
|
|
404
|
+
}
|
|
405
|
+
let plan;
|
|
406
|
+
try {
|
|
407
|
+
plan = await prepareRecovery('sync', selectors, {
|
|
408
|
+
scope: context,
|
|
409
|
+
context,
|
|
311
410
|
cwd: options.cwd,
|
|
312
411
|
env: options.env,
|
|
313
|
-
|
|
314
|
-
|
|
412
|
+
signal: options.rebuildRuntime?.signal,
|
|
413
|
+
cliVersion: version,
|
|
414
|
+
existingOnly: true,
|
|
415
|
+
...(exactTargets ? { exactTargets } : {}),
|
|
416
|
+
...(options.platform ? { targets: [options.platform] } : options.targets ? { targets: options.targets } : {}),
|
|
417
|
+
}, {
|
|
418
|
+
...options.rebuildRuntime,
|
|
419
|
+
configApply: true,
|
|
420
|
+
packagePreparationCache,
|
|
421
|
+
configApplyPackages: configApplyPackageHook(options, entries, referencePlugins),
|
|
422
|
+
referencePlugins,
|
|
423
|
+
nativeCliRunner: options.nativeCliRunner ?? options.rebuildRuntime?.nativeCliRunner,
|
|
424
|
+
awHomeMutationToken: options.awHomeMutationToken,
|
|
425
|
+
preApplyConfirmed: options.preApplyConfirmed,
|
|
315
426
|
});
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
targetResults: [],
|
|
328
|
-
applySkippedReason: 'noConfigChange',
|
|
427
|
+
commandCandidateCleanup.set(plan, cleanup);
|
|
428
|
+
plan.warnings.push(...retainedLegacyTargets.map((target) => `${target.pluginId ?? target.pluginName}/${target.platform}/${target.scope}:保留已停用的历史输出;配置 apply 不创建激活。`));
|
|
429
|
+
const profiles = configApplyRequestedTargets(plan).map((target) => ({
|
|
430
|
+
pluginName: target.pluginId.split('/').at(-1), scope: target.scope, platform: target.agent,
|
|
431
|
+
}));
|
|
432
|
+
for (const { target, candidate } of entries) {
|
|
433
|
+
for (const platform of candidate?.runtimeConfigEvidence.keys() ?? []) {
|
|
434
|
+
profiles.push({ pluginName: target.producer.pluginName, scope: 'user', platform });
|
|
435
|
+
}
|
|
436
|
+
if (candidate?.routeConfigEvidence)
|
|
437
|
+
profiles.push({ pluginName: target.producer.pluginName, scope: 'user' });
|
|
329
438
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
cwd: options.cwd,
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
nativeCliRunner: options.nativeCliRunner,
|
|
337
|
-
|
|
338
|
-
rebuildRuntime: options.rebuildRuntime,
|
|
439
|
+
const references = await collectPluginConfigReferenceEvidence({ plugin: options.plugin, plugins: referencePlugins,
|
|
440
|
+
profiles, cwd: options.cwd, env: options.env });
|
|
441
|
+
const authorization = await resolveConfigPreApplyAuthorization({
|
|
442
|
+
plugin: options.plugin, scope: context, cwd: options.cwd, env: options.env,
|
|
443
|
+
applyTargets: configApplyRequestedTargets(plan).flatMap((target) => target.agent !== 'generic'
|
|
444
|
+
? [{ pluginName: target.pluginId.split('/').at(-1), pluginId: target.pluginId, platform: target.agent, scope: target.scope }] : []),
|
|
445
|
+
nativeCliRunner: options.nativeCliRunner ?? options.rebuildRuntime?.nativeCliRunner,
|
|
446
|
+
rebuildRuntime: { ...plan.runtime, referencePlugins },
|
|
339
447
|
});
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
448
|
+
const portableAuthorization = (current) => [
|
|
449
|
+
...current.preApplyAuthorization ?? [],
|
|
450
|
+
...(current.joint?.children ?? []).flatMap(portableAuthorization),
|
|
451
|
+
];
|
|
452
|
+
const preApplyAuthorization = [...new Map([...authorization.targets, ...portableAuthorization(plan)]
|
|
453
|
+
.map((target) => [[target.pluginId, target.platform, target.scope].join('\0'), target])).values()];
|
|
454
|
+
const commandPackageEvidence = entries.map(({ evidence }) => evidence);
|
|
455
|
+
return { plan, retainedLegacyTargets, commandPackages: commands.packages, commandDiscoveryErrors: commands.errors,
|
|
456
|
+
commandPackageEvidence, commandPackageReviews: commandPackageEvidence.flatMap(({ review }) => review ? [review] : []),
|
|
457
|
+
preApplyAuthorization,
|
|
458
|
+
evidence: { recovery: describeRecoveryPlan(plan), references, commandPackageEvidence,
|
|
459
|
+
preApplyAuthorization, retainedLegacyTargets } };
|
|
460
|
+
}
|
|
461
|
+
catch (error) {
|
|
462
|
+
if (plan)
|
|
463
|
+
await disposePluginConfigApply(plan);
|
|
464
|
+
else
|
|
465
|
+
await cleanup();
|
|
466
|
+
throw error;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
export async function disposePluginConfigApply(plan) {
|
|
470
|
+
const cleanup = commandCandidateCleanup.get(plan);
|
|
471
|
+
commandCandidateCleanup.delete(plan);
|
|
472
|
+
await cleanup?.();
|
|
473
|
+
for (const child of plan.joint?.children ?? [])
|
|
474
|
+
await disposePluginConfigApply(child);
|
|
475
|
+
await plan.context.dispose();
|
|
476
|
+
}
|
|
477
|
+
export class ConfigApplyInterruptedError extends Error {
|
|
478
|
+
apply;
|
|
479
|
+
code;
|
|
480
|
+
operationDiagnostic;
|
|
481
|
+
configWrite = 'notStarted';
|
|
482
|
+
constructor(error, apply, signal) {
|
|
483
|
+
super(error.code === 'operationInterrupted' && signal?.reason instanceof Error ? signal.reason.message : error.message);
|
|
484
|
+
this.apply = apply;
|
|
485
|
+
this.code = error.code;
|
|
486
|
+
this.operationDiagnostic = readSafeOperationError(error.cause) ?? error.operationDiagnostic;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
function configApplyHasPartialDelivery(target) {
|
|
490
|
+
if (target.execution !== 'partial')
|
|
491
|
+
return false;
|
|
492
|
+
if (skillInvocationDiagnostics([target]).some(({ subject }) => subject?.pluginId === target.pluginId
|
|
493
|
+
&& subject.target === target.agent && subject.scope === target.scope))
|
|
494
|
+
return true;
|
|
495
|
+
if (target.delivery?.kind === 'native') {
|
|
496
|
+
return target.deploymentReceipts?.some((receipt) => {
|
|
497
|
+
const plan = target.deploymentPlans?.find(({ binding }) => binding.id === receipt.bindingId);
|
|
498
|
+
return plan && nativeDeploymentHasVerifiedComponentWrite(plan, receipt);
|
|
499
|
+
}) ?? false;
|
|
500
|
+
}
|
|
501
|
+
if (target.delivery?.kind !== 'agent-skills' || !Array.isArray(target.backend))
|
|
502
|
+
return false;
|
|
503
|
+
return target.backend.some((entry) => {
|
|
504
|
+
if (!entry || typeof entry !== 'object')
|
|
505
|
+
return false;
|
|
506
|
+
const outcome = entry;
|
|
507
|
+
return typeof outcome.skill === 'string' && outcome.observation === 'satisfied'
|
|
508
|
+
&& (outcome.execution === 'applied' || outcome.execution === 'no-op')
|
|
509
|
+
&& Array.isArray(outcome.blockers) && outcome.blockers.length === 0;
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
export async function applyPluginConfig(options) {
|
|
513
|
+
return withAwHomeMutationLock({ env: options.env, token: options.awHomeMutationToken, action: async (token) => {
|
|
514
|
+
await options.reviewPreflight?.();
|
|
515
|
+
let prepared;
|
|
516
|
+
try {
|
|
517
|
+
const { executeRecovery } = await import('../recovery/coordinator.js');
|
|
518
|
+
const expectedCommands = options.expectedCommandPackageEvidence
|
|
519
|
+
?? options.expectedEvidence?.commandPackageEvidence;
|
|
520
|
+
prepared = await preparePluginConfigApply({ ...options, awHomeMutationToken: token,
|
|
521
|
+
expectedCommandPackageEvidence: expectedCommands });
|
|
522
|
+
if (options.expectedEvidence !== undefined
|
|
523
|
+
&& JSON.stringify(options.expectedEvidence) !== JSON.stringify(prepared.evidence)) {
|
|
524
|
+
throw Object.assign(new Error('Configuration apply inputs changed. Prepare a new Review.'), { code: 'operationReviewStale' });
|
|
525
|
+
}
|
|
526
|
+
const authorizedEffects = new Set(options.expectedHostPermissionEffects?.map((effect) => JSON.stringify(effect)));
|
|
527
|
+
if (recoveryHostPermissionEffects(prepared.plan).some((effect) => !authorizedEffects.has(JSON.stringify(effect)))) {
|
|
528
|
+
throw Object.assign(new Error('Host permission effects changed after Review. Prepare a new Review.'), { code: 'operationReviewStale' });
|
|
529
|
+
}
|
|
530
|
+
const authorization = prepared.preApplyAuthorization;
|
|
531
|
+
if (authorization.length && !preApplyAuthorizationIsConfirmed({ required: authorization,
|
|
532
|
+
confirmed: options.preApplyConfirmed, authorizedTargets: options.preApplyAuthorizedTargets })) {
|
|
533
|
+
throwPreApplyAuthorizationRequired(authorization);
|
|
534
|
+
}
|
|
535
|
+
if (options.sharedNativeApplyConfirmed !== true && await configApplyHasValidSharedNativeTarget({
|
|
536
|
+
plugin: options.plugin, cwd: options.cwd, env: options.env, plugins: options.rebuildRuntime?.referencePlugins,
|
|
537
|
+
targets: configApplyRequestedTargets(prepared.plan).flatMap((target) => target.agent !== 'generic'
|
|
538
|
+
? [{ pluginName: target.pluginId.split('/').at(-1), pluginId: target.pluginId, platform: target.agent, scope: target.scope }] : []),
|
|
539
|
+
}))
|
|
540
|
+
throwSharedNativeApplyConfirmationRequired();
|
|
541
|
+
const discoveryErrors = prepared.commandDiscoveryErrors.map((error) => ({
|
|
542
|
+
stage: 'targetDiscovery', code: error.code, message: error.message,
|
|
543
|
+
}));
|
|
544
|
+
let interruption;
|
|
545
|
+
const receipt = await executeRecovery(prepared.plan, {
|
|
546
|
+
yes: options.sharedNativeApplyConfirmed === true || options.preApplyConfirmed === true,
|
|
547
|
+
runtime: { ...options.rebuildRuntime, awHomeMutationToken: token, preApplyConfirmed: options.preApplyConfirmed },
|
|
548
|
+
}).catch((error) => {
|
|
549
|
+
if (!(error instanceof RecoveryInterruptedError))
|
|
550
|
+
throw error;
|
|
551
|
+
interruption = error;
|
|
552
|
+
return error.receipt;
|
|
553
|
+
});
|
|
554
|
+
const retainedLegacyTargets = prepared.retainedLegacyTargets.filter((target) => !receipt.targetResults.some((result) => (target.pluginId ? result.pluginId === target.pluginId : result.pluginId.split('/').at(-1) === target.pluginName)
|
|
555
|
+
&& result.agent === target.platform && result.scope === target.scope));
|
|
556
|
+
const ok = receipt.ok && discoveryErrors.length === 0;
|
|
557
|
+
const errors = [...discoveryErrors, ...receipt.blockers, ...receipt.errors].map((error) => ({
|
|
558
|
+
stage: 'stage' in error ? error.stage : 'apply', code: error.code, message: error.message,
|
|
559
|
+
}));
|
|
560
|
+
const diagnostics = [...projectDeploymentNotices(receipt.targetResults), ...projectRelatedProjectPermissionFailures(receipt.targetResults)];
|
|
561
|
+
const apply = {
|
|
562
|
+
state: ok ? 'succeeded' : 'partial',
|
|
563
|
+
targetResults: [...receipt.targetResults.filter((target) => target.satisfaction !== 'unsupported' && target.satisfaction !== 'excluded').map((target) => ({
|
|
564
|
+
target: { pluginName: target.pluginId.split('/').at(-1), pluginId: target.pluginId,
|
|
565
|
+
platform: target.agent, scope: target.scope },
|
|
566
|
+
action: 'refresh',
|
|
567
|
+
state: target.execution === 'applied' || target.execution === 'no-op' ? 'completed'
|
|
568
|
+
: target.execution === 'not-run' ? 'skipped' : 'failed',
|
|
569
|
+
...projectComponentDelivery(target),
|
|
570
|
+
...(target.relation === 'root' ? { relation: 'requested' } : target.relation === 'dependency' ? { relation: 'dependency' } : {}),
|
|
571
|
+
...(target.requiredBy.length ? { requiredBy: target.requiredBy } : {}),
|
|
572
|
+
...(configApplyHasPartialDelivery(target) ? { partialDelivery: true } : {}),
|
|
573
|
+
...(target.blockers.length ? { errorCode: target.blockers[0].code,
|
|
574
|
+
message: target.blockers.map((item) => item.message).join(' ') } : {}),
|
|
575
|
+
})), ...retainedLegacyTargets.map((target) => ({
|
|
576
|
+
target, action: 'refresh', state: 'skipped',
|
|
577
|
+
message: 'The inactive legacy output was preserved. Configuration apply does not create an activation.',
|
|
578
|
+
}))],
|
|
579
|
+
commandResults: receipt.commandResults,
|
|
580
|
+
...(receipt.reviewedUserRoots !== undefined ? { reviewedUserRoots: receipt.reviewedUserRoots } : {}),
|
|
581
|
+
...(errors.length ? { errors } : {}),
|
|
582
|
+
...(diagnostics.length ? { diagnostics } : {}),
|
|
583
|
+
};
|
|
584
|
+
if (interruption)
|
|
585
|
+
throw new ConfigApplyInterruptedError(interruption, apply, options.rebuildRuntime?.signal);
|
|
586
|
+
return { configWrite: 'notStarted', overallState: ok ? 'succeeded' : 'partial', apply,
|
|
587
|
+
otherProjectsMayRequireSync: true };
|
|
588
|
+
}
|
|
589
|
+
catch (error) {
|
|
590
|
+
if (recoveryInterruptionCode(error, options.rebuildRuntime?.signal)
|
|
591
|
+
|| readSafeOperationError(error))
|
|
592
|
+
throw error;
|
|
593
|
+
if (error instanceof ConfigLayerError)
|
|
594
|
+
return { configWrite: 'notStarted', overallState: 'failed',
|
|
595
|
+
apply: configApplyLayerFailure(error), otherProjectsMayRequireSync: false };
|
|
596
|
+
const apply = unavailableApply('targetDiscoveryFailed', 'targetDiscovery');
|
|
597
|
+
const code = error?.code;
|
|
598
|
+
if (code === 'sourceActiveUnavailable' || code === 'pluginUnavailable') {
|
|
599
|
+
return { configWrite: 'notStarted', overallState: 'partial', apply: {
|
|
600
|
+
...unavailableApply('sourceUnavailable', 'source'),
|
|
601
|
+
error: { stage: 'source', code, message: error instanceof Error ? error.message : 'The Active Catalog plugin is unavailable.' },
|
|
602
|
+
}, otherProjectsMayRequireSync: true };
|
|
603
|
+
}
|
|
604
|
+
if (typeof code === 'string')
|
|
605
|
+
apply.error = { stage: 'apply', code,
|
|
606
|
+
message: code === 'operationReviewStale' ? 'Configuration apply inputs changed. Prepare a new Review.'
|
|
607
|
+
: 'The existing outputs cannot be refreshed with the current authorization.' };
|
|
608
|
+
return { configWrite: 'notStarted', overallState: 'partial', apply, otherProjectsMayRequireSync: true };
|
|
609
|
+
}
|
|
610
|
+
finally {
|
|
611
|
+
if (prepared)
|
|
612
|
+
await disposePluginConfigApply(prepared.plan);
|
|
613
|
+
}
|
|
614
|
+
} });
|
|
615
|
+
}
|
|
616
|
+
function throwSharedNativeApplyConfirmationRequired() {
|
|
617
|
+
const error = new Error('sharedNativeConfigApplyConfirmationRequired: Applying this user config changes a shared native artifact. Re-run with --yes.');
|
|
618
|
+
error.code = 'sharedNativeConfigApplyConfirmationRequired';
|
|
619
|
+
throw error;
|
|
620
|
+
}
|
|
621
|
+
async function applyPluginConfigWriteUnlocked(options) {
|
|
622
|
+
const pluginName = assertSafePluginConfigSegment(options.pluginName ?? options.plugin?.manifest.name ?? '');
|
|
623
|
+
const identity = options.plugin?.sourceId ? { sourceId: options.plugin.sourceId,
|
|
624
|
+
sourceIdentity: options.plugin.sourceIdentity, logicalIdentity: options.plugin.catalogLogicalIdentity } : {};
|
|
625
|
+
const requestedUpdates = options.request.updates ?? {};
|
|
626
|
+
const removeKeys = uniqueInOrder(options.request.removeKeys ?? []);
|
|
627
|
+
const duplicateKeys = removeKeys.filter((key) => Object.hasOwn(requestedUpdates, key));
|
|
628
|
+
if (duplicateKeys.length)
|
|
629
|
+
throw new Error(`Config write cannot update and remove the same key: ${duplicateKeys.join(', ')}.`);
|
|
630
|
+
const schemaAccess = await resolvePluginConfigSchemaAccess({ pluginName, currentPlugin: options.plugin,
|
|
631
|
+
currentPluginError: options.pluginError, scope: options.scope, platform: options.platform, cwd: options.cwd, env: options.env });
|
|
632
|
+
const plugin = schemaAccess.plugin;
|
|
633
|
+
const definition = plugin?.manifest.config ? selectPluginConfigProfile(plugin.manifest.config, options.platform) : undefined;
|
|
634
|
+
if (!plugin || !definition && (Object.keys(requestedUpdates).length > 0 || removeKeys.length === 0)) {
|
|
635
|
+
throw new PluginConfigSchemaResolutionError('configSchemaUnavailable', `Plugin "${pluginName}" does not declare an AW config schema.`);
|
|
636
|
+
}
|
|
637
|
+
const updates = await coercePluginConfigUpdates({ schema: definition?.fields ?? {}, updates: requestedUpdates, cwd: options.cwd });
|
|
638
|
+
const impact = await analyzePluginConfigMutationImpact({ plugin, scope: options.scope, platform: options.platform,
|
|
639
|
+
cwd: options.cwd, env: options.env, visibleTargets: [], commandDiscovery: { packages: [], errors: [] },
|
|
640
|
+
referencePlugins: options.rebuildRuntime?.referencePlugins, mutation: { kind: 'patch', updates, removeKeys } });
|
|
641
|
+
await assertPluginConfigMutationCandidate({ ...identity, pluginName, manifest: plugin.manifest,
|
|
642
|
+
scope: options.scope, platform: options.platform, cwd: options.cwd, env: options.env, updates, removeKeys,
|
|
643
|
+
referencePlugins: options.rebuildRuntime?.referencePlugins });
|
|
644
|
+
if (impact.referenceBlockers?.length)
|
|
645
|
+
throw Object.assign(new Error(`configReferenceInUse: ${impact.referenceBlockers.join(' ')}`), { code: 'configReferenceInUse' });
|
|
646
|
+
if (impact.storeChanged) {
|
|
647
|
+
try {
|
|
648
|
+
await patchPluginConfigStore({ ...identity, pluginName, scope: 'user', platform: options.platform,
|
|
649
|
+
cwd: options.cwd, env: options.env, updates: Object.fromEntries(impact.updatedKeys.map((key) => [key, updates[key]])), removeKeys });
|
|
650
|
+
}
|
|
651
|
+
catch (error) {
|
|
652
|
+
throw markConfigWriteFailed(error);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
const warnings = [...impact.referenceWarnings ?? []];
|
|
656
|
+
let effective;
|
|
657
|
+
try {
|
|
658
|
+
effective = summarizeEffectivePluginConfig(await resolveEffectivePluginConfig({ ...identity, pluginName,
|
|
659
|
+
manifest: plugin.manifest, platform: options.platform, targetScope: options.scope, cwd: options.cwd, env: options.env,
|
|
660
|
+
referencePlugins: options.rebuildRuntime?.referencePlugins }));
|
|
661
|
+
}
|
|
662
|
+
catch {
|
|
663
|
+
warnings.push('The saved configuration cannot be previewed. Check its schema and reference sources before applying it.');
|
|
664
|
+
}
|
|
665
|
+
if (impact.storeChanged)
|
|
666
|
+
warnings.push(...otherProjectsWarning('user'));
|
|
667
|
+
return { plugin: pluginName, scope: 'user', context: options.scope, platform: options.platform,
|
|
668
|
+
...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}), updatedKeys: impact.updatedKeys,
|
|
669
|
+
removedKeys: impact.removedKeys, staleRemovedKeys: impact.staleRemovedKeys, effective,
|
|
670
|
+
configWrite: 'succeeded', overallState: 'succeeded',
|
|
671
|
+
apply: skippedApply(impact.storeChanged ? 'notRequested' : 'noConfigChange'),
|
|
672
|
+
otherProjectsMayRequireSync: impact.storeChanged, warnings };
|
|
673
|
+
}
|
|
674
|
+
async function prepareConfigMutationApplySelection(options) {
|
|
675
|
+
if (options.apply !== true || !options.plugin)
|
|
676
|
+
return undefined;
|
|
677
|
+
let prepared;
|
|
678
|
+
try {
|
|
679
|
+
prepared = await preparePluginConfigApply({ ...options, plugin: options.plugin }, { inspectOnly: true });
|
|
680
|
+
const requestedTargets = configApplyRequestedTargets(prepared.plan);
|
|
681
|
+
const hasGeneric = requestedTargets.some((target) => target.agent === 'generic');
|
|
682
|
+
const visibleTargets = requestedTargets.flatMap((target) => target.agent === 'generic' ? [] : [{
|
|
683
|
+
pluginName: target.pluginId.split('/').at(-1), pluginId: target.pluginId,
|
|
684
|
+
platform: target.agent, scope: target.scope,
|
|
685
|
+
}]);
|
|
686
|
+
const impact = await analyzePluginConfigMutationImpact({ plugin: options.plugin, scope: options.context ?? options.scope,
|
|
687
|
+
platform: options.platform, cwd: options.cwd, env: options.env, visibleTargets,
|
|
688
|
+
commandDiscovery: { packages: prepared.commandPackages, errors: prepared.commandDiscoveryErrors },
|
|
689
|
+
referencePlugins: options.rebuildRuntime?.referencePlugins,
|
|
690
|
+
mutation: 'request' in options ? { kind: 'patch', ...options.request } : { kind: 'reset' } });
|
|
691
|
+
if (options.expectedCommandPackageEvidence) {
|
|
692
|
+
const referencePlugins = prepared.plan.runtime.referencePlugins ?? [];
|
|
693
|
+
const plugins = await resolvePluginConfigReferenceConsumers({ plugin: options.plugin, env: options.env, plugins: referencePlugins });
|
|
694
|
+
const entries = await prepareConfigCommandPackages({ ...options, plugin: options.plugin,
|
|
695
|
+
mutation: 'request' in options ? { kind: 'patch', ...options.request } : { kind: 'reset' } }, impact.affectedCommandPackages, plugins, referencePlugins);
|
|
696
|
+
await Promise.all(entries.map(({ candidate }) => candidate?.cleanup()));
|
|
697
|
+
}
|
|
698
|
+
if (!hasGeneric && !visibleTargets.length && !prepared.commandPackages.length && !prepared.commandDiscoveryErrors.length) {
|
|
699
|
+
if (prepared.plan.blockExecution || prepared.plan.receipt.blockers.length || prepared.plan.receipt.errors.length)
|
|
700
|
+
return undefined;
|
|
701
|
+
return { skipReason: 'noVisibleTarget' };
|
|
702
|
+
}
|
|
703
|
+
return { applyTargets: hasGeneric ? undefined : impact.affectedTargets,
|
|
704
|
+
applyCommandPackages: impact.affectedCommandPackages.map((target) => target.packageId),
|
|
705
|
+
...(!hasGeneric && impact.noEffectiveChange ? { skipReason: 'noEffectiveConfigChange' } : {}) };
|
|
706
|
+
}
|
|
707
|
+
catch (error) {
|
|
708
|
+
if (error?.code === 'operationReviewStale' || recoveryInterruptionCode(error, options.rebuildRuntime?.signal))
|
|
709
|
+
throw error;
|
|
710
|
+
// A failed output discovery must not prevent a valid configuration save.
|
|
711
|
+
return undefined;
|
|
712
|
+
}
|
|
713
|
+
finally {
|
|
714
|
+
if (prepared)
|
|
715
|
+
await disposePluginConfigApply(prepared.plan);
|
|
716
|
+
}
|
|
359
717
|
}
|
|
360
718
|
export async function applyPluginConfigWrite(options) {
|
|
719
|
+
if (options.context)
|
|
720
|
+
await resolveWorkContext({ cwd: options.cwd, context: options.context });
|
|
361
721
|
const requestedPluginName = options.pluginName ?? options.plugin?.manifest.name;
|
|
362
722
|
if (!requestedPluginName)
|
|
363
723
|
throw new Error('Plugin name is required for config write.');
|
|
@@ -367,139 +727,206 @@ export async function applyPluginConfigWrite(options) {
|
|
|
367
727
|
token: options.awHomeMutationToken,
|
|
368
728
|
action: async (awHomeMutationToken) => {
|
|
369
729
|
await options.reviewPreflight?.();
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
730
|
+
const hasUpdates = Object.keys(options.request.updates ?? {}).length > 0;
|
|
731
|
+
const layerError = options.plugin && (hasUpdates || options.apply)
|
|
732
|
+
? await observeConfigLayerError({ ...options, plugin: options.plugin }) : undefined;
|
|
733
|
+
if (layerError && hasUpdates)
|
|
734
|
+
throw layerError;
|
|
735
|
+
let configCommitted = false;
|
|
736
|
+
try {
|
|
737
|
+
const selection = layerError ? undefined : await prepareConfigMutationApplySelection({ ...options, awHomeMutationToken });
|
|
738
|
+
const saved = await applyPluginConfigWriteUnlocked({ ...options, scope: options.context ?? options.scope,
|
|
739
|
+
apply: false, awHomeMutationToken, rebuildRuntime: { ...options.rebuildRuntime, awHomeMutationToken } });
|
|
740
|
+
configCommitted = true;
|
|
741
|
+
if (options.apply !== true || !options.plugin)
|
|
742
|
+
return saved;
|
|
743
|
+
if (layerError)
|
|
744
|
+
return { ...saved, overallState: 'partial', apply: configApplyLayerFailure(layerError) };
|
|
745
|
+
if (saved.apply.state === 'skipped' && saved.apply.reason === 'noConfigChange')
|
|
746
|
+
return saved;
|
|
747
|
+
if (selection?.skipReason)
|
|
748
|
+
return { ...saved, apply: skippedApply(selection.skipReason) };
|
|
749
|
+
const applied = await applyPluginConfig({ ...options, ...selection, plugin: options.plugin, awHomeMutationToken });
|
|
750
|
+
return { ...saved, overallState: applied.overallState, apply: applied.apply };
|
|
751
|
+
}
|
|
752
|
+
catch (error) {
|
|
753
|
+
let sensitiveValues = options.plugin
|
|
754
|
+
? collectSensitivePluginConfigValues(options.plugin.manifest, (options.request.updates ?? {}), options.platform)
|
|
755
|
+
: [];
|
|
756
|
+
if (options.plugin) {
|
|
757
|
+
try {
|
|
758
|
+
const effective = await resolveEffectivePluginConfig({
|
|
759
|
+
...(options.plugin.sourceId ? {
|
|
760
|
+
sourceId: options.plugin.sourceId,
|
|
761
|
+
sourceIdentity: options.plugin.sourceIdentity,
|
|
762
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
763
|
+
} : {}),
|
|
764
|
+
pluginName: options.plugin.manifest.name,
|
|
765
|
+
manifest: options.plugin.manifest,
|
|
766
|
+
referencePlugins: options.rebuildRuntime?.referencePlugins,
|
|
767
|
+
targetScope: options.scope,
|
|
768
|
+
platform: options.platform,
|
|
769
|
+
cwd: options.cwd,
|
|
770
|
+
env: options.env,
|
|
771
|
+
});
|
|
772
|
+
sensitiveValues = [
|
|
773
|
+
...sensitiveValues,
|
|
774
|
+
...collectSensitivePluginConfigValues(options.plugin.manifest, effective.values, options.platform),
|
|
775
|
+
];
|
|
776
|
+
}
|
|
777
|
+
catch {
|
|
778
|
+
// Requested sensitive values and generic credential redaction remain available.
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
let message = redactPluginScriptOutput(error instanceof Error ? error.message : String(error), sensitiveValues);
|
|
782
|
+
message = message.split(options.cwd).join('<project>');
|
|
783
|
+
for (const scope of ['user', 'project']) {
|
|
784
|
+
const configPath = resolvePluginConfigStorePath({
|
|
785
|
+
sourceId: options.plugin?.sourceId,
|
|
786
|
+
pluginName: requestedPluginName,
|
|
787
|
+
scope,
|
|
788
|
+
cwd: options.cwd,
|
|
789
|
+
env: options.env,
|
|
790
|
+
});
|
|
791
|
+
message = message.split(configPath).join(`${scope}/plugin-config/${[
|
|
792
|
+
options.plugin?.sourceId,
|
|
793
|
+
requestedPluginName,
|
|
794
|
+
'config.json',
|
|
795
|
+
].filter(Boolean).join('/')}`);
|
|
796
|
+
}
|
|
797
|
+
if (error instanceof ConfigApplyInterruptedError) {
|
|
798
|
+
error.message = message;
|
|
799
|
+
if (configCommitted)
|
|
800
|
+
error.configWrite = 'succeeded';
|
|
801
|
+
throw error;
|
|
802
|
+
}
|
|
803
|
+
const safeError = new Error(message);
|
|
804
|
+
const code = error.code;
|
|
805
|
+
safeError.code = typeof code === 'string' ? code
|
|
806
|
+
: message.startsWith('schemaVersionUnsupported:') ? 'schemaVersionUnsupported'
|
|
807
|
+
: 'configApplyFailed';
|
|
808
|
+
const configWrite = error.configWrite;
|
|
809
|
+
if (configCommitted || configWrite === 'succeeded' || configWriteStateForError(error) === 'failed') {
|
|
810
|
+
safeError.configWrite = configCommitted || configWrite === 'succeeded' ? 'succeeded' : 'failed';
|
|
811
|
+
}
|
|
812
|
+
if (error && typeof error === 'object' && 'operationDiagnostic' in error) {
|
|
813
|
+
safeError.operationDiagnostic = error.operationDiagnostic;
|
|
814
|
+
}
|
|
815
|
+
throw safeError;
|
|
816
|
+
}
|
|
375
817
|
},
|
|
376
818
|
});
|
|
377
819
|
}
|
|
378
820
|
async function resetPluginConfigWithHelperUnlocked(options) {
|
|
379
821
|
const pluginName = assertSafePluginConfigSegment(options.pluginName);
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
822
|
+
let identity = options.plugin?.sourceId ? { sourceId: options.plugin.sourceId,
|
|
823
|
+
sourceIdentity: options.plugin.sourceIdentity, logicalIdentity: options.plugin.catalogLogicalIdentity }
|
|
824
|
+
: { sourceId: options.sourceId, sourceIdentity: options.sourceIdentity, logicalIdentity: options.logicalIdentity };
|
|
825
|
+
if (identity.sourceId && !identity.sourceIdentity) {
|
|
826
|
+
try {
|
|
827
|
+
const stored = await readNamespacedPluginConfigStoreIdentity({ sourceId: identity.sourceId, pluginName,
|
|
828
|
+
scope: 'user', platform: options.platform, cwd: options.cwd, env: options.env });
|
|
829
|
+
if (stored)
|
|
830
|
+
identity = { ...identity, sourceIdentity: stored.binding.sourceIdentity };
|
|
831
|
+
}
|
|
832
|
+
catch { /* Reset remains available for unreadable identity metadata. */ }
|
|
383
833
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
});
|
|
392
|
-
if (!schemaAccess.plugin?.manifest.config?.schema) {
|
|
393
|
-
throw new Error(`configSchemaUnavailable: Plugin "${pluginName}" does not declare an AW config schema.`);
|
|
394
|
-
}
|
|
395
|
-
const configIdentity = options.plugin.sourceId ? {
|
|
396
|
-
sourceId: options.plugin.sourceId,
|
|
397
|
-
sourceIdentity: options.plugin.sourceIdentity,
|
|
398
|
-
} : {};
|
|
399
|
-
const store = await readPluginConfigStore({
|
|
400
|
-
...configIdentity,
|
|
401
|
-
pluginName,
|
|
402
|
-
scope: options.scope,
|
|
403
|
-
projectLayer,
|
|
404
|
-
cwd: options.cwd,
|
|
405
|
-
env: options.env,
|
|
406
|
-
});
|
|
407
|
-
const removedKeys = collectRemovedConfigKeys(store.values);
|
|
834
|
+
let removedKeys = [];
|
|
835
|
+
try {
|
|
836
|
+
const store = await readPluginConfigStore({ ...identity, pluginName, scope: 'user', platform: options.platform,
|
|
837
|
+
cwd: options.cwd, env: options.env });
|
|
838
|
+
removedKeys = collectRemovedConfigKeys(store.values);
|
|
839
|
+
}
|
|
840
|
+
catch { /* Broken stores still have the path-based reset boundary. */ }
|
|
408
841
|
const warnings = [];
|
|
409
|
-
if (options.
|
|
410
|
-
|
|
842
|
+
if (options.plugin) {
|
|
843
|
+
try {
|
|
844
|
+
const impact = await analyzePluginConfigMutationImpact({ plugin: options.plugin, scope: options.scope,
|
|
845
|
+
platform: options.platform, cwd: options.cwd, env: options.env, visibleTargets: [],
|
|
846
|
+
commandDiscovery: { packages: [], errors: [] }, referencePlugins: options.rebuildRuntime?.referencePlugins,
|
|
847
|
+
mutation: { kind: 'reset' } });
|
|
848
|
+
warnings.push(...impact.referenceWarnings ?? [], ...impact.referenceBlockers ?? []);
|
|
849
|
+
}
|
|
850
|
+
catch {
|
|
851
|
+
warnings.push('Configuration references could not be checked. Reset will still clear the selected layer.');
|
|
852
|
+
}
|
|
411
853
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
854
|
+
let reset;
|
|
855
|
+
try {
|
|
856
|
+
reset = await resetPluginConfigStore({ ...identity, pluginName, scope: 'user', platform: options.platform,
|
|
857
|
+
cwd: options.cwd, env: options.env });
|
|
858
|
+
}
|
|
859
|
+
catch (error) {
|
|
860
|
+
throw markConfigWriteFailed(error);
|
|
416
861
|
}
|
|
417
|
-
const reset = await resetPluginConfigStore({
|
|
418
|
-
...configIdentity,
|
|
419
|
-
pluginName,
|
|
420
|
-
scope: options.scope,
|
|
421
|
-
projectLayer,
|
|
422
|
-
cwd: options.cwd,
|
|
423
|
-
env: options.env,
|
|
424
|
-
});
|
|
425
|
-
let applied = {
|
|
426
|
-
overallState: 'succeeded',
|
|
427
|
-
targetResults: [],
|
|
428
|
-
applySkippedReason: 'noConfigChange',
|
|
429
|
-
};
|
|
430
862
|
let effective;
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
cwd: options.cwd,
|
|
438
|
-
env: options.env,
|
|
439
|
-
}));
|
|
863
|
+
let schema;
|
|
864
|
+
if (options.plugin) {
|
|
865
|
+
try {
|
|
866
|
+
schema = (await resolvePluginConfigSchemaAccess({ pluginName, currentPlugin: options.plugin,
|
|
867
|
+
scope: options.scope, platform: options.platform, cwd: options.cwd, env: options.env })).schema;
|
|
868
|
+
effective = summarizeEffectivePluginConfig(await resolveEffectivePluginConfig({ ...identity, pluginName,
|
|
869
|
+
manifest: options.plugin.manifest, platform: options.platform, targetScope: options.scope, cwd: options.cwd,
|
|
870
|
+
env: options.env, referencePlugins: options.rebuildRuntime?.referencePlugins }));
|
|
440
871
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
plugin: schemaAccess.plugin,
|
|
444
|
-
scope: options.scope,
|
|
445
|
-
cwd: options.cwd,
|
|
446
|
-
env: options.env ?? process.env,
|
|
447
|
-
applyTargets: options.applyTargets,
|
|
448
|
-
nativeCliRunner: options.nativeCliRunner,
|
|
449
|
-
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
450
|
-
rebuildRuntime: options.rebuildRuntime,
|
|
451
|
-
});
|
|
872
|
+
catch {
|
|
873
|
+
warnings.push('The cleared configuration cannot be previewed. Check its schema and references before applying it.');
|
|
452
874
|
}
|
|
453
875
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
scope: options.scope,
|
|
462
|
-
projectLayer,
|
|
463
|
-
...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
|
|
464
|
-
existed: reset.existed,
|
|
465
|
-
deleted: reset.deleted,
|
|
466
|
-
removedKeys,
|
|
467
|
-
...(effective ? { effective } : {}),
|
|
468
|
-
configWrite: 'succeeded',
|
|
469
|
-
overallState: applied.overallState,
|
|
470
|
-
targetResults: applied.targetResults,
|
|
471
|
-
...(applied.applySkippedReason ? { applySkippedReason: applied.applySkippedReason } : {}),
|
|
472
|
-
otherProjectsRequireReinstall,
|
|
473
|
-
warnings,
|
|
474
|
-
};
|
|
876
|
+
if (reset.existed)
|
|
877
|
+
warnings.push(...otherProjectsWarning('user'));
|
|
878
|
+
return { plugin: pluginName, scope: 'user', context: options.scope, platform: options.platform, schema,
|
|
879
|
+
existed: reset.existed, deleted: reset.deleted, resetDisposition: reset.resetDisposition,
|
|
880
|
+
...(reset.quarantineBasename ? { quarantineBasename: reset.quarantineBasename } : {}), removedKeys, effective,
|
|
881
|
+
configWrite: 'succeeded', overallState: 'succeeded', apply: skippedApply(reset.existed ? 'notRequested' : 'noConfigChange'),
|
|
882
|
+
otherProjectsMayRequireSync: reset.existed, warnings };
|
|
475
883
|
}
|
|
476
884
|
export async function resetPluginConfigWithHelper(options) {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}
|
|
885
|
+
if (options.context)
|
|
886
|
+
await resolveWorkContext({ cwd: options.cwd, context: options.context });
|
|
887
|
+
assertSafePluginConfigSegment(options.pluginName);
|
|
481
888
|
return withAwHomeMutationLock({
|
|
482
889
|
env: options.env,
|
|
483
890
|
token: options.awHomeMutationToken,
|
|
484
891
|
action: async (awHomeMutationToken) => {
|
|
485
892
|
await options.reviewPreflight?.();
|
|
486
|
-
|
|
487
|
-
...options,
|
|
488
|
-
|
|
489
|
-
|
|
893
|
+
const layerError = options.plugin && options.apply
|
|
894
|
+
? await observeConfigLayerError({ ...options, plugin: options.plugin }) : undefined;
|
|
895
|
+
const selection = layerError ? undefined : await prepareConfigMutationApplySelection({ ...options, awHomeMutationToken });
|
|
896
|
+
const saved = await resetPluginConfigWithHelperUnlocked({ ...options, scope: options.context ?? options.scope,
|
|
897
|
+
apply: false, awHomeMutationToken, rebuildRuntime: { ...options.rebuildRuntime, awHomeMutationToken } });
|
|
898
|
+
if (options.apply !== true)
|
|
899
|
+
return saved;
|
|
900
|
+
if (layerError)
|
|
901
|
+
return { ...saved, overallState: 'partial', apply: configApplyLayerFailure(layerError) };
|
|
902
|
+
if (!options.plugin) {
|
|
903
|
+
const apply = unavailableApply('sourceUnavailable', 'source');
|
|
904
|
+
const cause = configActiveAvailabilityError(options.pluginError);
|
|
905
|
+
return { ...saved, overallState: 'partial', apply: cause ? { ...apply, error: { stage: 'source', ...cause } } : apply };
|
|
906
|
+
}
|
|
907
|
+
if (saved.apply.state === 'skipped' && saved.apply.reason === 'noConfigChange')
|
|
908
|
+
return saved;
|
|
909
|
+
if (selection?.skipReason)
|
|
910
|
+
return { ...saved, apply: skippedApply(selection.skipReason) };
|
|
911
|
+
const applied = await applyPluginConfig({ ...options, ...selection, plugin: options.plugin, awHomeMutationToken })
|
|
912
|
+
.catch((error) => {
|
|
913
|
+
if (error instanceof ConfigApplyInterruptedError)
|
|
914
|
+
error.configWrite = 'succeeded';
|
|
915
|
+
throw error;
|
|
490
916
|
});
|
|
917
|
+
return { ...saved, overallState: applied.overallState, apply: applied.apply };
|
|
491
918
|
},
|
|
492
919
|
});
|
|
493
920
|
}
|
|
494
921
|
export async function describeResetAffectedFields(options) {
|
|
495
|
-
const projectLayer = options.scope === 'project' ? (options.projectLayer ?? 'shared') : 'shared';
|
|
496
922
|
try {
|
|
497
923
|
const resolved = await resolveConfigRead({
|
|
498
924
|
pluginName: options.pluginName,
|
|
499
925
|
plugin: options.plugin,
|
|
500
926
|
...(options.pluginError ? { pluginError: options.pluginError } : {}),
|
|
501
927
|
scope: options.scope,
|
|
502
|
-
|
|
928
|
+
context: options.context,
|
|
929
|
+
platform: options.platform,
|
|
503
930
|
cwd: options.cwd,
|
|
504
931
|
env: options.env,
|
|
505
932
|
});
|
|
@@ -509,8 +936,8 @@ export async function describeResetAffectedFields(options) {
|
|
|
509
936
|
kind: field.kind,
|
|
510
937
|
reserved: field.reserved,
|
|
511
938
|
action: 'reset',
|
|
512
|
-
scope:
|
|
513
|
-
|
|
939
|
+
scope: 'user',
|
|
940
|
+
platform: options.platform,
|
|
514
941
|
valueState: field.valueState,
|
|
515
942
|
}));
|
|
516
943
|
}
|
|
@@ -519,13 +946,15 @@ export async function describeResetAffectedFields(options) {
|
|
|
519
946
|
...(options.plugin?.sourceId ? {
|
|
520
947
|
sourceId: options.plugin.sourceId,
|
|
521
948
|
sourceIdentity: options.plugin.sourceIdentity,
|
|
949
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
522
950
|
} : options.sourceId ? {
|
|
523
951
|
sourceId: options.sourceId,
|
|
524
952
|
sourceIdentity: options.sourceIdentity,
|
|
953
|
+
logicalIdentity: options.logicalIdentity,
|
|
525
954
|
} : {}),
|
|
526
955
|
pluginName: options.pluginName,
|
|
527
|
-
scope:
|
|
528
|
-
|
|
956
|
+
scope: 'user',
|
|
957
|
+
platform: options.platform,
|
|
529
958
|
cwd: options.cwd,
|
|
530
959
|
env: options.env,
|
|
531
960
|
});
|
|
@@ -535,8 +964,8 @@ export async function describeResetAffectedFields(options) {
|
|
|
535
964
|
kind: 'manifest',
|
|
536
965
|
reserved: false,
|
|
537
966
|
action: 'reset',
|
|
538
|
-
scope:
|
|
539
|
-
|
|
967
|
+
scope: 'user',
|
|
968
|
+
platform: options.platform,
|
|
540
969
|
}));
|
|
541
970
|
}
|
|
542
971
|
}
|