@lesliechan721/aw 0.1.0-beta.9 → 0.1.0-beta.91
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 +416 -1995
- 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,9 +1,44 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
|
+
import { resolveWorkContext } from '../intent/work-context.js';
|
|
3
|
+
import { observePreferences } from '../intent/deployment-preferences.js';
|
|
2
4
|
import * as nodeFs from 'node:fs/promises';
|
|
3
5
|
import path from 'node:path';
|
|
4
6
|
import fs from 'fs-extra';
|
|
5
|
-
import {
|
|
7
|
+
import { canonicalizePluginConfigValues, selectPluginConfigProfile, PLATFORM_TARGETS, formatPluginConfigIssue, getPluginConfigDependencyKeys, getPluginConfigDependencyFields, matchPluginConfigPreset, redactPluginConfigValue, resolvePluginConfigObjectProperties, stablePluginConfigStringify, validatePluginConfigCandidate, validatePluginConfigDocument, validatePluginConfigValue as validateCorePluginConfigValue, } from '@lesliechan721/aw-plugin-core/manifest';
|
|
6
8
|
import { canonicalizePathThroughExistingAncestor, resolveAwHome, resolveRepoRootSync, } from './paths.js';
|
|
9
|
+
import { assertRealFileParentWithinRoot, assertSafeFileMutationPath, atomicReplaceSafeFile, } from './safe-fs.js';
|
|
10
|
+
import { pluginConfigHasExternalReferences, resolvePluginConfigReferenceContext, } from './plugin-config-references.js';
|
|
11
|
+
import { assertConfigLayerWritable, resolveConfigurableLayers } from './config-platforms.js';
|
|
12
|
+
export { resolvePluginConfigReferenceContext } from './plugin-config-references.js';
|
|
13
|
+
function readPluginConfigBinding(value) {
|
|
14
|
+
return isRecord(value) && value.kind === 'source'
|
|
15
|
+
&& typeof value.sourceIdentity === 'string'
|
|
16
|
+
&& /^sha256:[0-9a-f]{64}$/u.test(value.sourceIdentity)
|
|
17
|
+
&& Object.keys(value).every((key) => ['kind', 'sourceIdentity'].includes(key))
|
|
18
|
+
? { kind: 'source', sourceIdentity: value.sourceIdentity } : null;
|
|
19
|
+
}
|
|
20
|
+
function readPluginConfigEnvelopeV6(value, _scope) {
|
|
21
|
+
if (!isRecord(value) || value.schemaVersion !== 6
|
|
22
|
+
|| typeof value.sourceId !== 'string' || typeof value.pluginName !== 'string'
|
|
23
|
+
|| !isRecord(value.common) || !isRecord(value.platforms)
|
|
24
|
+
|| Object.keys(value).some((key) => !['schemaVersion', 'sourceId', 'pluginName', 'binding', 'common', 'platforms'].includes(key))
|
|
25
|
+
|| Object.keys(value.platforms).some((key) => !PLATFORM_TARGETS.includes(key)))
|
|
26
|
+
return null;
|
|
27
|
+
const binding = readPluginConfigBinding(value.binding);
|
|
28
|
+
return binding ? { schemaVersion: 6, sourceId: value.sourceId, pluginName: value.pluginName,
|
|
29
|
+
binding, common: value.common,
|
|
30
|
+
platforms: value.platforms } : null;
|
|
31
|
+
}
|
|
32
|
+
export class PluginConfigResetError extends Error {
|
|
33
|
+
code;
|
|
34
|
+
osCode;
|
|
35
|
+
constructor(code, message, osCode) {
|
|
36
|
+
super(`${code}: ${message}`);
|
|
37
|
+
this.name = 'PluginConfigResetError';
|
|
38
|
+
this.code = code;
|
|
39
|
+
this.osCode = osCode;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
7
42
|
export class PluginConfigSchemaResolutionError extends Error {
|
|
8
43
|
code;
|
|
9
44
|
details;
|
|
@@ -97,28 +132,6 @@ async function inspectConfigInventoryStoreRoot(boundaryRoot, storeRoot) {
|
|
|
97
132
|
}
|
|
98
133
|
return true;
|
|
99
134
|
}
|
|
100
|
-
async function readConfigDirectoryIdentity(directoryPath) {
|
|
101
|
-
const stats = await fs.lstat(directoryPath);
|
|
102
|
-
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
103
|
-
throw new Error(`Config parent must be a real directory: ${directoryPath}`);
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
dev: stats.dev,
|
|
107
|
-
ino: stats.ino,
|
|
108
|
-
realPath: await fs.realpath(directoryPath),
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function assertConfigDirectoryStable(label, before, after) {
|
|
112
|
-
if (before.dev !== after.dev || before.ino !== after.ino || before.realPath !== after.realPath) {
|
|
113
|
-
throw new Error(`${label} identity changed before atomic config replacement.`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function assertRealConfigBoundary(root, parent) {
|
|
117
|
-
const relative = path.relative(root.realPath, parent.realPath);
|
|
118
|
-
if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
|
|
119
|
-
throw new Error('Config parent realpath escapes its allowed root.');
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
135
|
async function prepareConfigFileParent(filePath, allowedRoot) {
|
|
123
136
|
assertConfigPathBoundary(allowedRoot, filePath);
|
|
124
137
|
await assertNoConfigSymlink(allowedRoot, filePath);
|
|
@@ -131,66 +144,28 @@ export async function withConfigFileMutation(options) {
|
|
|
131
144
|
return options.action();
|
|
132
145
|
}
|
|
133
146
|
export async function atomicReplaceConfigFile(options) {
|
|
134
|
-
await
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
const temporaryPath = path.join(parentPath, `.${path.basename(options.filePath)}.tmp-${process.pid}-${crypto.randomUUID()}`);
|
|
145
|
-
assertConfigPathBoundary(options.allowedRoot, temporaryPath);
|
|
146
|
-
let handle;
|
|
147
|
-
try {
|
|
148
|
-
handle = await nodeFs.open(temporaryPath, 'wx', options.mode ?? (currentTarget ? currentTarget.mode & 0o777 : 0o600));
|
|
149
|
-
await handle.writeFile(options.content, 'utf8');
|
|
150
|
-
await handle.sync();
|
|
151
|
-
await handle.close();
|
|
152
|
-
handle = undefined;
|
|
153
|
-
await atomicConfigBeforeRenameHookForTests?.(options.filePath, temporaryPath);
|
|
154
|
-
await assertNoConfigSymlink(options.allowedRoot, options.filePath);
|
|
155
|
-
const currentRootIdentity = await readConfigDirectoryIdentity(rootPath);
|
|
156
|
-
const currentParentIdentity = await readConfigDirectoryIdentity(parentPath);
|
|
157
|
-
assertRealConfigBoundary(currentRootIdentity, currentParentIdentity);
|
|
158
|
-
assertConfigDirectoryStable('Config allowed root', rootIdentity, currentRootIdentity);
|
|
159
|
-
assertConfigDirectoryStable('Config parent', parentIdentity, currentParentIdentity);
|
|
160
|
-
const targetBeforeRename = await lstatIfExists(options.filePath);
|
|
161
|
-
if (targetBeforeRename && (!targetBeforeRename.isFile() || targetBeforeRename.isSymbolicLink())) {
|
|
162
|
-
throw new Error(`Config target must be a regular file: ${options.filePath}`);
|
|
163
|
-
}
|
|
164
|
-
await nodeFs.rename(temporaryPath, options.filePath);
|
|
165
|
-
// rename is the commit point. Diagnostics and durability work after it are best effort,
|
|
166
|
-
// because reporting failure here would leave the new generation on disk without giving
|
|
167
|
-
// the caller a safe way to restore the old generation.
|
|
168
|
-
await atomicConfigAfterRenameHookForTests?.(options.filePath).catch(() => undefined);
|
|
169
|
-
await (async () => {
|
|
170
|
-
const finalTarget = await fs.lstat(options.filePath);
|
|
171
|
-
if (!finalTarget.isFile() || finalTarget.isSymbolicLink()) {
|
|
172
|
-
throw new Error('Atomic config replacement produced an invalid target.');
|
|
173
|
-
}
|
|
174
|
-
if (await fs.readFile(options.filePath, 'utf8') !== options.content) {
|
|
175
|
-
throw new Error('Atomic config replacement content differs from the committed content.');
|
|
176
|
-
}
|
|
177
|
-
})().catch(() => undefined);
|
|
178
|
-
const directoryHandle = await nodeFs.open(parentPath, 'r').catch(() => null);
|
|
179
|
-
await directoryHandle?.sync().catch(() => undefined);
|
|
180
|
-
await directoryHandle?.close().catch(() => undefined);
|
|
181
|
-
}
|
|
182
|
-
finally {
|
|
183
|
-
await handle?.close().catch(() => undefined);
|
|
184
|
-
await nodeFs.rm(temporaryPath, { force: true }).catch(() => undefined);
|
|
185
|
-
}
|
|
147
|
+
await atomicReplaceSafeFile({
|
|
148
|
+
...options,
|
|
149
|
+
label: 'Config path',
|
|
150
|
+
temporaryTag: 'tmp',
|
|
151
|
+
beforeRename: atomicConfigBeforeRenameHookForTests,
|
|
152
|
+
afterRename: async (targetPath) => {
|
|
153
|
+
await atomicConfigAfterRenameHookForTests?.(targetPath).catch(() => undefined);
|
|
154
|
+
},
|
|
155
|
+
});
|
|
186
156
|
}
|
|
187
157
|
export async function atomicRemoveConfigFile(options) {
|
|
188
158
|
await prepareConfigFileParent(options.filePath, options.allowedRoot);
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
159
|
+
await assertSafeFileMutationPath({
|
|
160
|
+
filePath: options.filePath,
|
|
161
|
+
allowedRoot: options.allowedRoot,
|
|
162
|
+
label: 'Config path',
|
|
163
|
+
});
|
|
164
|
+
await assertRealFileParentWithinRoot({
|
|
165
|
+
filePath: options.filePath,
|
|
166
|
+
allowedRoot: options.allowedRoot,
|
|
167
|
+
label: 'Config path',
|
|
168
|
+
});
|
|
194
169
|
const currentTarget = await lstatIfExists(options.filePath);
|
|
195
170
|
if (!currentTarget)
|
|
196
171
|
return false;
|
|
@@ -198,12 +173,16 @@ export async function atomicRemoveConfigFile(options) {
|
|
|
198
173
|
throw new Error(`Config target must be a regular file: ${options.filePath}`);
|
|
199
174
|
}
|
|
200
175
|
await atomicConfigBeforeRenameHookForTests?.(options.filePath, options.filePath);
|
|
201
|
-
await
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
176
|
+
await assertSafeFileMutationPath({
|
|
177
|
+
filePath: options.filePath,
|
|
178
|
+
allowedRoot: options.allowedRoot,
|
|
179
|
+
label: 'Config path',
|
|
180
|
+
});
|
|
181
|
+
await assertRealFileParentWithinRoot({
|
|
182
|
+
filePath: options.filePath,
|
|
183
|
+
allowedRoot: options.allowedRoot,
|
|
184
|
+
label: 'Config path',
|
|
185
|
+
});
|
|
207
186
|
const targetBeforeRemove = await lstatIfExists(options.filePath);
|
|
208
187
|
if (!targetBeforeRemove)
|
|
209
188
|
return false;
|
|
@@ -212,16 +191,21 @@ export async function atomicRemoveConfigFile(options) {
|
|
|
212
191
|
}
|
|
213
192
|
await nodeFs.unlink(options.filePath);
|
|
214
193
|
await atomicConfigAfterRenameHookForTests?.(options.filePath).catch(() => undefined);
|
|
215
|
-
const directoryHandle = await nodeFs.open(parentPath, 'r').catch(() => null);
|
|
216
|
-
await directoryHandle?.sync().catch(() => undefined);
|
|
217
|
-
await directoryHandle?.close().catch(() => undefined);
|
|
218
194
|
return true;
|
|
219
195
|
}
|
|
220
196
|
function isRecord(value) {
|
|
221
197
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
222
198
|
}
|
|
223
199
|
function formatValue(value) {
|
|
224
|
-
|
|
200
|
+
if (typeof value === 'string')
|
|
201
|
+
return value;
|
|
202
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
203
|
+
return stablePluginConfigStringify(value);
|
|
204
|
+
}
|
|
205
|
+
if (isRecord(value) || Array.isArray(value)) {
|
|
206
|
+
return stablePluginConfigStringify(value);
|
|
207
|
+
}
|
|
208
|
+
return JSON.stringify(value);
|
|
225
209
|
}
|
|
226
210
|
async function calculateConfigManifestDigest(filePath) {
|
|
227
211
|
const hash = crypto.createHash('sha256');
|
|
@@ -236,16 +220,17 @@ async function calculateConfigSchemaManifestDigestForPlugin(plugin) {
|
|
|
236
220
|
hash.update(JSON.stringify(plugin.manifest));
|
|
237
221
|
return `sha256:${hash.digest('hex')}`;
|
|
238
222
|
}
|
|
239
|
-
function createConfigSchemaEvidenceFromCurrentCatalog(plugin, manifestDigest) {
|
|
223
|
+
function createConfigSchemaEvidenceFromCurrentCatalog(plugin, manifestDigest, platform) {
|
|
240
224
|
return {
|
|
241
225
|
source: 'currentCatalog',
|
|
242
|
-
identity: createPluginConfigSchemaIdentity(plugin.manifest),
|
|
226
|
+
identity: createPluginConfigSchemaIdentity(plugin.manifest, platform),
|
|
227
|
+
platform,
|
|
243
228
|
pluginVersion: plugin.manifest.version,
|
|
244
229
|
manifestDigest,
|
|
245
230
|
};
|
|
246
231
|
}
|
|
247
232
|
function getStoreEntries(values) {
|
|
248
|
-
return
|
|
233
|
+
return Object.fromEntries(Object.entries(values));
|
|
249
234
|
}
|
|
250
235
|
export function assertSafePluginConfigSegment(pluginName) {
|
|
251
236
|
if (typeof pluginName !== 'string' || pluginName.trim() === '') {
|
|
@@ -267,111 +252,178 @@ export function resolveAwProjectRoot(cwd) {
|
|
|
267
252
|
return path.resolve(resolveRepoRootSync(cwd));
|
|
268
253
|
}
|
|
269
254
|
function resolvePluginConfigAllowedRoot(options) {
|
|
270
|
-
return options.
|
|
271
|
-
? resolveAwHome(options.env)
|
|
272
|
-
: path.join(resolveAwProjectRoot(options.cwd), '.agent-workflows');
|
|
255
|
+
return resolveAwHome(options.env);
|
|
273
256
|
}
|
|
257
|
+
/** Scope selects source context. All config values belong to the user document. */
|
|
274
258
|
export function resolvePluginConfigStorePath(options) {
|
|
275
259
|
const pluginName = assertSafePluginConfigSegment(options.pluginName);
|
|
276
|
-
const sourceId = options.sourceId === undefined
|
|
277
|
-
|
|
278
|
-
: assertSafePluginConfigSegment(options.sourceId);
|
|
279
|
-
const root = options.scope === 'user'
|
|
280
|
-
? resolveAwHome(options.env)
|
|
281
|
-
: path.join(resolveAwProjectRoot(options.cwd), '.agent-workflows');
|
|
282
|
-
const configDir = options.scope === 'project' && options.projectLayer === 'local'
|
|
283
|
-
? 'plugin-config.local'
|
|
284
|
-
: CONFIG_DIR;
|
|
285
|
-
const filePath = path.join(root, configDir, ...(sourceId ? [sourceId] : []), pluginName, CONFIG_FILE);
|
|
286
|
-
if (options.scope !== 'project') {
|
|
287
|
-
return filePath;
|
|
288
|
-
}
|
|
289
|
-
if (options.access === 'read') {
|
|
290
|
-
return assertTestReadablePath(filePath, options.projectLayer === 'local'
|
|
291
|
-
? 'project local plugin config store (.agent-workflows/plugin-config.local)'
|
|
292
|
-
: 'project shared plugin config store (.agent-workflows/plugin-config)', '用 registerReadonlyFixtureRoot() 或 runWithRepositoryCwdAsReadOnly() 登记只读 project fixture 根;需要写入时改用 withSafeTestCwd() 或 registerWritableStateRoot()。');
|
|
293
|
-
}
|
|
294
|
-
if (options.access === 'write') {
|
|
295
|
-
return assertTestWritablePath(filePath, options.projectLayer === 'local'
|
|
296
|
-
? 'project local plugin config store (.agent-workflows/plugin-config.local)'
|
|
297
|
-
: 'project shared plugin config store (.agent-workflows/plugin-config)', '用 withSafeTestCwd() 切到测试可写 cwd,或通过 registerWritableStateRoot() 登记 project fixture 根。');
|
|
298
|
-
}
|
|
299
|
-
return filePath;
|
|
260
|
+
const sourceId = options.sourceId === undefined ? undefined : assertSafePluginConfigSegment(options.sourceId);
|
|
261
|
+
return path.join(resolveAwHome(options.env), CONFIG_DIR, ...(sourceId ? [sourceId] : []), pluginName, CONFIG_FILE);
|
|
300
262
|
}
|
|
301
263
|
export function resolvePluginConfigStoreTargets(options) {
|
|
302
|
-
|
|
303
|
-
return [{
|
|
304
|
-
storeKind: 'user',
|
|
305
|
-
path: resolvePluginConfigStorePath(options),
|
|
306
|
-
}];
|
|
307
|
-
}
|
|
308
|
-
return [
|
|
309
|
-
{
|
|
310
|
-
storeKind: 'projectShared',
|
|
311
|
-
path: resolvePluginConfigStorePath({
|
|
312
|
-
...options,
|
|
313
|
-
projectLayer: 'shared',
|
|
314
|
-
}),
|
|
315
|
-
projectLayer: 'shared',
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
storeKind: 'projectLocal',
|
|
319
|
-
path: resolvePluginConfigStorePath({
|
|
320
|
-
...options,
|
|
321
|
-
projectLayer: 'local',
|
|
322
|
-
}),
|
|
323
|
-
projectLayer: 'local',
|
|
324
|
-
},
|
|
325
|
-
];
|
|
264
|
+
return [{ storeKind: 'user', path: resolvePluginConfigStorePath(options) }];
|
|
326
265
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}
|
|
332
|
-
return value;
|
|
266
|
+
function isPluginConfigScalar(value) {
|
|
267
|
+
if (typeof value === 'string' || typeof value === 'boolean')
|
|
268
|
+
return true;
|
|
269
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
333
270
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
271
|
+
function isPluginConfigObject(value, objectArrayLevels) {
|
|
272
|
+
if (!isRecord(value))
|
|
273
|
+
return false;
|
|
274
|
+
return Object.values(value).every((property) => {
|
|
275
|
+
if (isPluginConfigScalar(property))
|
|
276
|
+
return true;
|
|
277
|
+
if (Array.isArray(property))
|
|
278
|
+
return isPluginConfigArray(property, objectArrayLevels);
|
|
279
|
+
return isRecord(property) && Object.values(property).every(isPluginConfigScalar);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function isPluginConfigArray(value, objectArrayLevels) {
|
|
283
|
+
if (Object.keys(value).length !== value.length)
|
|
284
|
+
return false;
|
|
285
|
+
const elementType = typeof value[0];
|
|
286
|
+
return value.every((item, index) => Object.hasOwn(value, index)
|
|
287
|
+
&& typeof item === elementType
|
|
288
|
+
&& (isPluginConfigScalar(item) || (objectArrayLevels > 0 && isPluginConfigObject(item, objectArrayLevels - 1))));
|
|
289
|
+
}
|
|
290
|
+
function isPluginConfigValue(value) {
|
|
291
|
+
return isPluginConfigScalar(value) || (Array.isArray(value)
|
|
292
|
+
? isPluginConfigArray(value, 2)
|
|
293
|
+
: isPluginConfigObject(value, 1));
|
|
294
|
+
}
|
|
295
|
+
function invalidStore(filePath, code, message, rawDigest) {
|
|
296
|
+
return {
|
|
297
|
+
path: filePath,
|
|
298
|
+
exists: true,
|
|
299
|
+
state: 'invalid',
|
|
300
|
+
values: {},
|
|
301
|
+
...(rawDigest ? { rawDigest } : {}),
|
|
302
|
+
invalidCode: code,
|
|
303
|
+
issues: [message],
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
function readyStore(filePath, values, rawDigest) {
|
|
307
|
+
return {
|
|
308
|
+
path: filePath,
|
|
309
|
+
exists: true,
|
|
310
|
+
state: 'ready',
|
|
311
|
+
values: canonicalizePluginConfigValues(values),
|
|
312
|
+
...(rawDigest ? { rawDigest } : {}),
|
|
313
|
+
issues: [],
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
export function assertReadyPluginConfigStore(store) {
|
|
317
|
+
if (store.state !== 'invalid')
|
|
318
|
+
return;
|
|
319
|
+
throw new Error(`${store.invalidCode}: Invalid plugin config store "${store.path}". ${store.issues.join(' ')}`);
|
|
320
|
+
}
|
|
321
|
+
async function parseStoreJson(filePath) {
|
|
322
|
+
const content = await fs.readFile(filePath);
|
|
323
|
+
const rawDigest = `sha256:${crypto.createHash('sha256').update(content).digest('hex')}`;
|
|
324
|
+
try {
|
|
325
|
+
return {
|
|
326
|
+
state: 'parsed',
|
|
327
|
+
value: JSON.parse(content.toString('utf8')),
|
|
328
|
+
rawDigest,
|
|
329
|
+
};
|
|
338
330
|
}
|
|
339
|
-
|
|
340
|
-
|
|
331
|
+
catch (error) {
|
|
332
|
+
if (error instanceof SyntaxError) {
|
|
333
|
+
return {
|
|
334
|
+
state: 'invalidJson',
|
|
335
|
+
store: invalidStore(filePath, 'invalidJson', 'The store is not valid JSON.', rawDigest),
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
throw error;
|
|
341
339
|
}
|
|
342
|
-
|
|
343
|
-
|
|
340
|
+
}
|
|
341
|
+
function validateStoreValues(options) {
|
|
342
|
+
if (!isRecord(options.values)) {
|
|
343
|
+
return invalidStore(options.filePath, 'invalidValues', 'The values field must be an object.', options.rawDigest);
|
|
344
344
|
}
|
|
345
|
-
|
|
345
|
+
const values = Object.create(null);
|
|
346
|
+
const issues = [];
|
|
347
|
+
for (const [key, value] of Object.entries(options.values)) {
|
|
348
|
+
if (!isPluginConfigValue(value)) {
|
|
349
|
+
issues.push(`Config "${key}" is not a supported config value.`);
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
values[key] = value;
|
|
353
|
+
}
|
|
354
|
+
return issues.length > 0
|
|
355
|
+
? invalidStore(options.filePath, 'invalidValues', issues.join(' '), options.rawDigest)
|
|
356
|
+
: readyStore(options.filePath, values, options.rawDigest);
|
|
357
|
+
}
|
|
358
|
+
function documentStore(options) {
|
|
359
|
+
const common = validateStoreValues({ filePath: options.filePath, values: options.common, rawDigest: options.rawDigest });
|
|
360
|
+
if (common.state === 'invalid')
|
|
361
|
+
return common;
|
|
362
|
+
if (!isRecord(options.platforms) || Object.keys(options.platforms).some((key) => !PLATFORM_TARGETS.includes(key))) {
|
|
363
|
+
return invalidStore(options.filePath, 'invalidValues', 'The platforms field must contain known platform objects.', options.rawDigest);
|
|
364
|
+
}
|
|
365
|
+
const platforms = {};
|
|
366
|
+
for (const [platform, values] of Object.entries(options.platforms)) {
|
|
367
|
+
const store = validateStoreValues({ filePath: options.filePath, values, rawDigest: options.rawDigest });
|
|
368
|
+
if (store.state === 'invalid')
|
|
369
|
+
return store;
|
|
370
|
+
platforms[platform] = store.values;
|
|
371
|
+
}
|
|
372
|
+
return { ...common, common: common.values, platforms, ...(options.platform ? { platform: options.platform } : {}),
|
|
373
|
+
values: options.platform ? platforms[options.platform] ?? {} : common.values };
|
|
374
|
+
}
|
|
375
|
+
export function pluginConfigStoreForProfile(store, platform) {
|
|
376
|
+
return { ...store, platform, values: platform ? store.platforms?.[platform] ?? {} : store.common ?? store.values };
|
|
377
|
+
}
|
|
378
|
+
/** Replace one layer in memory without changing any other profile. */
|
|
379
|
+
export function replacePluginConfigStoreLayer(store, values, platform) {
|
|
380
|
+
const common = platform ? store.common ?? store.values : canonicalizePluginConfigValues(values);
|
|
381
|
+
const platforms = { ...store.platforms };
|
|
382
|
+
if (platform) {
|
|
383
|
+
if (Object.keys(values).length)
|
|
384
|
+
platforms[platform] = canonicalizePluginConfigValues(values);
|
|
385
|
+
else
|
|
386
|
+
delete platforms[platform];
|
|
387
|
+
}
|
|
388
|
+
const exists = Object.keys(common).length > 0 || Object.keys(platforms).length > 0;
|
|
389
|
+
return { ...store, common, platforms, platform, values: platform ? platforms[platform] ?? {} : common,
|
|
390
|
+
exists, state: exists ? 'ready' : 'missing', issues: [], rawDigest: undefined };
|
|
391
|
+
}
|
|
392
|
+
async function readStoreFile(filePath, platform) {
|
|
393
|
+
const parsed = await parseStoreJson(filePath);
|
|
394
|
+
if (parsed.state === 'invalidJson')
|
|
395
|
+
return parsed.store;
|
|
396
|
+
const raw = parsed.value;
|
|
397
|
+
if (!isRecord(raw) || raw.schemaVersion !== 6
|
|
398
|
+
|| Object.keys(raw).some((key) => !['schemaVersion', 'common', 'platforms'].includes(key))) {
|
|
399
|
+
return invalidStore(filePath, 'schemaVersionUnsupported', 'Only plugin config store schemaVersion 6 is supported. Reset the old document, then save the required values.', parsed.rawDigest);
|
|
400
|
+
}
|
|
401
|
+
return documentStore({ filePath, common: raw.common, platforms: raw.platforms, rawDigest: parsed.rawDigest, platform });
|
|
402
|
+
}
|
|
403
|
+
async function readNamespacedStoreFile(options) {
|
|
404
|
+
const parsed = await parseStoreJson(options.filePath);
|
|
405
|
+
if (parsed.state === 'invalidJson')
|
|
406
|
+
return parsed.store;
|
|
407
|
+
const envelope = readPluginConfigEnvelopeV6(parsed.value);
|
|
408
|
+
if (!envelope)
|
|
409
|
+
return invalidStore(options.filePath, 'schemaVersionUnsupported', 'Only a valid plugin config store schemaVersion 6 is supported. Reset the old document, then save the required values.', parsed.rawDigest);
|
|
410
|
+
if (envelope.sourceId !== options.sourceId || envelope.pluginName !== options.pluginName
|
|
411
|
+
|| !options.sourceIdentity || envelope.binding.sourceIdentity !== options.sourceIdentity) {
|
|
412
|
+
return invalidStore(options.filePath, 'identityMismatch', 'The user store is not bound to the requested source and plugin identity.', parsed.rawDigest);
|
|
413
|
+
}
|
|
414
|
+
return documentStore({ filePath: options.filePath, common: envelope.common, platforms: envelope.platforms,
|
|
415
|
+
rawDigest: parsed.rawDigest, platform: options.platform });
|
|
346
416
|
}
|
|
347
417
|
function namespacedConfigContent(options) {
|
|
418
|
+
const document = { schemaVersion: 6, common: canonicalizePluginConfigValues(options.common),
|
|
419
|
+
platforms: Object.fromEntries(Object.entries(options.platforms).sort(([a], [b]) => a.localeCompare(b, 'en'))
|
|
420
|
+
.map(([platform, values]) => [platform, canonicalizePluginConfigValues(values)])) };
|
|
348
421
|
if (!options.sourceId)
|
|
349
|
-
return `${JSON.stringify(
|
|
422
|
+
return `${JSON.stringify(document, null, 2)}\n`;
|
|
350
423
|
if (!options.sourceIdentity)
|
|
351
|
-
throw new Error('
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
sourceId: options.sourceId,
|
|
355
|
-
sourceIdentity: options.sourceIdentity,
|
|
356
|
-
pluginName: options.pluginName,
|
|
357
|
-
values: options.values,
|
|
358
|
-
};
|
|
359
|
-
return `${JSON.stringify(envelope, null, 2)}\n`;
|
|
360
|
-
}
|
|
361
|
-
async function assertNoLegacyConfigCoexistence(options) {
|
|
362
|
-
if (!options.sourceId)
|
|
363
|
-
return;
|
|
364
|
-
const legacyPath = resolvePluginConfigStorePath({
|
|
365
|
-
pluginName: options.pluginName,
|
|
366
|
-
scope: options.scope,
|
|
367
|
-
cwd: options.cwd,
|
|
368
|
-
env: options.env,
|
|
369
|
-
projectLayer: options.projectLayer,
|
|
370
|
-
...(options.scope === 'project' ? { access: 'read' } : {}),
|
|
371
|
-
});
|
|
372
|
-
if (await lstatIfExists(legacyPath)) {
|
|
373
|
-
throw new Error('legacyStateUnsupported: legacy and namespaced plugin config stores cannot coexist.');
|
|
374
|
-
}
|
|
424
|
+
throw new Error('sourceChanged: user plugin config requires a source identity.');
|
|
425
|
+
return `${JSON.stringify({ ...document, sourceId: options.sourceId, pluginName: options.pluginName,
|
|
426
|
+
binding: { kind: 'source', sourceIdentity: options.sourceIdentity } }, null, 2)}\n`;
|
|
375
427
|
}
|
|
376
428
|
export async function readPluginConfigStore(options) {
|
|
377
429
|
const filePath = resolvePluginConfigStorePath({
|
|
@@ -380,14 +432,11 @@ export async function readPluginConfigStore(options) {
|
|
|
380
432
|
});
|
|
381
433
|
const allowedRoot = resolvePluginConfigAllowedRoot(options);
|
|
382
434
|
if (options.sourceId) {
|
|
383
|
-
if (!options.sourceIdentity)
|
|
384
|
-
throw new Error('sourceIdentity is required for namespaced plugin config.');
|
|
385
435
|
const legacyPath = resolvePluginConfigStorePath({
|
|
386
436
|
pluginName: options.pluginName,
|
|
387
437
|
scope: options.scope,
|
|
388
438
|
cwd: options.cwd,
|
|
389
439
|
env: options.env,
|
|
390
|
-
projectLayer: options.projectLayer,
|
|
391
440
|
...(options.scope === 'project' ? { access: 'read' } : {}),
|
|
392
441
|
});
|
|
393
442
|
if (await inspectConfigReadTarget(allowedRoot, legacyPath)) {
|
|
@@ -398,21 +447,22 @@ export async function readPluginConfigStore(options) {
|
|
|
398
447
|
return {
|
|
399
448
|
path: filePath,
|
|
400
449
|
exists: false,
|
|
450
|
+
state: 'missing',
|
|
401
451
|
values: {},
|
|
452
|
+
issues: [],
|
|
402
453
|
};
|
|
403
454
|
}
|
|
404
|
-
return
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
};
|
|
455
|
+
return options.sourceId
|
|
456
|
+
? readNamespacedStoreFile({
|
|
457
|
+
filePath,
|
|
458
|
+
sourceId: options.sourceId,
|
|
459
|
+
scope: options.scope,
|
|
460
|
+
sourceIdentity: options.sourceIdentity,
|
|
461
|
+
logicalIdentity: options.logicalIdentity,
|
|
462
|
+
pluginName: options.pluginName,
|
|
463
|
+
platform: options.platform,
|
|
464
|
+
})
|
|
465
|
+
: readStoreFile(filePath, options.platform);
|
|
416
466
|
}
|
|
417
467
|
export async function readNamespacedPluginConfigStoreIdentity(options) {
|
|
418
468
|
const filePath = resolvePluginConfigStorePath({
|
|
@@ -421,15 +471,21 @@ export async function readNamespacedPluginConfigStoreIdentity(options) {
|
|
|
421
471
|
});
|
|
422
472
|
if (!await inspectConfigReadTarget(resolvePluginConfigAllowedRoot(options), filePath))
|
|
423
473
|
return null;
|
|
424
|
-
const
|
|
425
|
-
if (
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
474
|
+
const parsed = await parseStoreJson(filePath);
|
|
475
|
+
if (parsed.state === 'invalidJson') {
|
|
476
|
+
throw new Error(`${parsed.store.invalidCode}: invalid namespaced plugin config store.`);
|
|
477
|
+
}
|
|
478
|
+
const envelope = readPluginConfigEnvelopeV6(parsed.value, options.scope);
|
|
479
|
+
if (!envelope
|
|
480
|
+
|| envelope.sourceId !== options.sourceId
|
|
481
|
+
|| envelope.pluginName !== options.pluginName) {
|
|
482
|
+
throw new Error('schemaVersionUnsupported: invalid namespaced plugin config store.');
|
|
483
|
+
}
|
|
484
|
+
const store = documentStore({ filePath, common: envelope.common, platforms: envelope.platforms, platform: options.platform });
|
|
485
|
+
assertReadyPluginConfigStore(store);
|
|
430
486
|
return {
|
|
431
|
-
|
|
432
|
-
store
|
|
487
|
+
binding: envelope.binding,
|
|
488
|
+
store,
|
|
433
489
|
};
|
|
434
490
|
}
|
|
435
491
|
async function listConfigStoreDirectoryPluginNames(storeRoot) {
|
|
@@ -456,32 +512,75 @@ async function listConfigStoreDirectoryPluginNames(storeRoot) {
|
|
|
456
512
|
return pluginNames;
|
|
457
513
|
}
|
|
458
514
|
export async function listPluginConfigStorePluginNames(options) {
|
|
459
|
-
const
|
|
460
|
-
const storeRoots = options.scope === 'user'
|
|
461
|
-
? [path.join(resolveAwHome(options.env), CONFIG_DIR)]
|
|
462
|
-
: options.scope === 'project'
|
|
463
|
-
? [path.join(projectRoot, '.agent-workflows', options.projectLayer === 'local' ? 'plugin-config.local' : CONFIG_DIR)]
|
|
464
|
-
: [
|
|
465
|
-
path.join(resolveAwHome(options.env), CONFIG_DIR),
|
|
466
|
-
path.join(projectRoot, '.agent-workflows', CONFIG_DIR),
|
|
467
|
-
path.join(projectRoot, '.agent-workflows', 'plugin-config.local'),
|
|
468
|
-
];
|
|
515
|
+
const storeRoots = [path.join(resolveAwHome(options.env), CONFIG_DIR)];
|
|
469
516
|
const pluginNames = (await Promise.all(storeRoots.map((storeRoot) => listConfigStoreDirectoryPluginNames(storeRoot)))).flat();
|
|
470
517
|
return [...new Set(pluginNames)].sort((left, right) => left.localeCompare(right));
|
|
471
518
|
}
|
|
519
|
+
export async function listNamespacedPluginConfigStoreIdentities(options) {
|
|
520
|
+
const boundaryRoot = resolveAwHome(options.env);
|
|
521
|
+
if (options.scope === 'user') {
|
|
522
|
+
await canonicalizePathThroughExistingAncestor(boundaryRoot);
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
await fs.realpath(boundaryRoot);
|
|
526
|
+
}
|
|
527
|
+
const storeRoot = path.join(boundaryRoot, CONFIG_DIR);
|
|
528
|
+
if (!await inspectConfigInventoryStoreRoot(boundaryRoot, storeRoot))
|
|
529
|
+
return [];
|
|
530
|
+
const output = [];
|
|
531
|
+
for (const sourceEntry of await fs.readdir(storeRoot, { withFileTypes: true })) {
|
|
532
|
+
if (!sourceEntry.isDirectory() || sourceEntry.isSymbolicLink())
|
|
533
|
+
continue;
|
|
534
|
+
let sourceId;
|
|
535
|
+
try {
|
|
536
|
+
sourceId = assertSafePluginConfigSegment(sourceEntry.name);
|
|
537
|
+
}
|
|
538
|
+
catch {
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
const sourceRoot = path.join(storeRoot, sourceId);
|
|
542
|
+
let pluginEntries;
|
|
543
|
+
try {
|
|
544
|
+
await assertNoConfigSymlink(boundaryRoot, sourceRoot);
|
|
545
|
+
pluginEntries = await fs.readdir(sourceRoot, { withFileTypes: true });
|
|
546
|
+
}
|
|
547
|
+
catch {
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
for (const pluginEntry of pluginEntries) {
|
|
551
|
+
if (!pluginEntry.isDirectory() || pluginEntry.isSymbolicLink())
|
|
552
|
+
continue;
|
|
553
|
+
let pluginName;
|
|
554
|
+
try {
|
|
555
|
+
pluginName = assertSafePluginConfigSegment(pluginEntry.name);
|
|
556
|
+
await assertNoConfigSymlink(boundaryRoot, path.join(sourceRoot, pluginName));
|
|
557
|
+
}
|
|
558
|
+
catch {
|
|
559
|
+
continue;
|
|
560
|
+
}
|
|
561
|
+
let target;
|
|
562
|
+
try {
|
|
563
|
+
target = await lstatIfExists(path.join(sourceRoot, pluginName, CONFIG_FILE));
|
|
564
|
+
}
|
|
565
|
+
catch {
|
|
566
|
+
continue;
|
|
567
|
+
}
|
|
568
|
+
if (!target)
|
|
569
|
+
continue;
|
|
570
|
+
output.push({ sourceId, pluginName, pluginId: `${sourceId}/${pluginName}` });
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return output.sort((left, right) => left.pluginId.localeCompare(right.pluginId));
|
|
574
|
+
}
|
|
472
575
|
export async function listNamespacedPluginConfigStores(options) {
|
|
473
|
-
const boundaryRoot = options.
|
|
474
|
-
? resolveAwHome(options.env)
|
|
475
|
-
: resolveAwProjectRoot(options.cwd);
|
|
576
|
+
const boundaryRoot = resolveAwHome(options.env);
|
|
476
577
|
if (options.scope === 'user') {
|
|
477
578
|
await canonicalizePathThroughExistingAncestor(boundaryRoot);
|
|
478
579
|
}
|
|
479
580
|
else {
|
|
480
581
|
await fs.realpath(boundaryRoot);
|
|
481
582
|
}
|
|
482
|
-
const storeRoot = path.join(boundaryRoot,
|
|
483
|
-
? 'plugin-config.local'
|
|
484
|
-
: CONFIG_DIR);
|
|
583
|
+
const storeRoot = path.join(boundaryRoot, CONFIG_DIR);
|
|
485
584
|
const output = [];
|
|
486
585
|
if (!await inspectConfigInventoryStoreRoot(boundaryRoot, storeRoot))
|
|
487
586
|
return output;
|
|
@@ -503,362 +602,362 @@ export async function listNamespacedPluginConfigStores(options) {
|
|
|
503
602
|
const filePath = path.join(storeRoot, sourceId, pluginName, CONFIG_FILE);
|
|
504
603
|
if (!await inspectConfigReadTarget(storeRoot, filePath))
|
|
505
604
|
continue;
|
|
506
|
-
const
|
|
507
|
-
if (
|
|
508
|
-
|
|
509
|
-
|| typeof raw.sourceIdentity !== 'string') {
|
|
510
|
-
throw new Error(`legacyStateUnsupported: invalid namespaced plugin config store "${filePath}".`);
|
|
605
|
+
const parsed = await parseStoreJson(filePath);
|
|
606
|
+
if (parsed.state === 'invalidJson') {
|
|
607
|
+
throw new Error(`${parsed.store.invalidCode}: invalid namespaced plugin config store "${filePath}".`);
|
|
511
608
|
}
|
|
609
|
+
const envelope = readPluginConfigEnvelopeV6(parsed.value, options.scope);
|
|
610
|
+
if (!envelope
|
|
611
|
+
|| envelope.sourceId !== sourceId
|
|
612
|
+
|| envelope.pluginName !== pluginName) {
|
|
613
|
+
throw new Error(`schemaVersionUnsupported: invalid namespaced plugin config store "${filePath}".`);
|
|
614
|
+
}
|
|
615
|
+
const store = documentStore({ filePath, common: envelope.common, platforms: envelope.platforms });
|
|
616
|
+
assertReadyPluginConfigStore(store);
|
|
512
617
|
output.push({
|
|
513
618
|
sourceId,
|
|
514
|
-
|
|
619
|
+
binding: envelope.binding,
|
|
515
620
|
pluginName,
|
|
516
621
|
pluginId: `${sourceId}/${pluginName}`,
|
|
517
|
-
values:
|
|
622
|
+
values: store.values,
|
|
518
623
|
});
|
|
519
624
|
}
|
|
520
625
|
}
|
|
521
626
|
return output.sort((left, right) => left.pluginId.localeCompare(right.pluginId));
|
|
522
627
|
}
|
|
523
628
|
export async function writePluginConfigStore(options) {
|
|
524
|
-
await
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
629
|
+
const current = await readPluginConfigStore(options);
|
|
630
|
+
assertReadyPluginConfigStore(current);
|
|
631
|
+
const validated = validateStoreValues({ filePath: current.path, values: options.values });
|
|
632
|
+
assertReadyPluginConfigStore(validated);
|
|
633
|
+
return commitPluginConfigLayer(options, current, validated.values);
|
|
634
|
+
}
|
|
635
|
+
async function commitPluginConfigLayer(options, current, values) {
|
|
636
|
+
const next = replacePluginConfigStoreLayer(current, values, options.platform);
|
|
529
637
|
const allowedRoot = resolvePluginConfigAllowedRoot(options);
|
|
530
|
-
await withConfigFileMutation({
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}),
|
|
539
|
-
});
|
|
540
|
-
return {
|
|
541
|
-
pluginName: options.pluginName,
|
|
542
|
-
scope: options.scope,
|
|
543
|
-
path: filePath,
|
|
544
|
-
};
|
|
638
|
+
await withConfigFileMutation({ filePath: current.path, allowedRoot, action: async () => {
|
|
639
|
+
if (!next.exists)
|
|
640
|
+
await atomicRemoveConfigFile({ filePath: current.path, allowedRoot });
|
|
641
|
+
else
|
|
642
|
+
await atomicReplaceConfigFile({ filePath: current.path, allowedRoot,
|
|
643
|
+
content: namespacedConfigContent({ ...options, common: next.common, platforms: next.platforms }), mode: 0o600 });
|
|
644
|
+
} });
|
|
645
|
+
return { pluginName: options.pluginName, scope: 'user', platform: options.platform, path: current.path, warnings: [] };
|
|
545
646
|
}
|
|
546
647
|
export async function patchPluginConfigStore(options) {
|
|
547
|
-
await
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
...(options.scope === 'project' ? { access: 'write' } : {}),
|
|
551
|
-
});
|
|
552
|
-
const allowedRoot = resolvePluginConfigAllowedRoot(options);
|
|
648
|
+
await options.reviewPreflight?.();
|
|
649
|
+
const current = await readPluginConfigStore(options);
|
|
650
|
+
assertReadyPluginConfigStore(current);
|
|
553
651
|
const removedKeys = options.removeKeys ?? [];
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
: await readStoreFile(filePath)
|
|
568
|
-
: {};
|
|
569
|
-
if (options.requireExistingRemoveKeys) {
|
|
570
|
-
const missingKey = removedKeys.find((key) => !Object.hasOwn(current, key));
|
|
571
|
-
if (missingKey)
|
|
572
|
-
throw new Error(`Unknown config key "${missingKey}".`);
|
|
573
|
-
}
|
|
574
|
-
const next = { ...current };
|
|
575
|
-
for (const key of removedKeys) {
|
|
576
|
-
delete next[key];
|
|
577
|
-
}
|
|
578
|
-
for (const [key, value] of Object.entries(options.updates)) {
|
|
579
|
-
next[key] = value;
|
|
580
|
-
}
|
|
581
|
-
await atomicReplaceConfigFile({
|
|
582
|
-
filePath,
|
|
583
|
-
allowedRoot,
|
|
584
|
-
content: namespacedConfigContent({ ...options, values: next }),
|
|
585
|
-
mode: 0o600,
|
|
586
|
-
});
|
|
587
|
-
},
|
|
588
|
-
});
|
|
589
|
-
return {
|
|
590
|
-
pluginName: options.pluginName,
|
|
591
|
-
scope: options.scope,
|
|
592
|
-
path: filePath,
|
|
593
|
-
updatedKeys: Object.keys(options.updates),
|
|
594
|
-
removedKeys,
|
|
595
|
-
};
|
|
652
|
+
if (options.requireExistingRemoveKeys) {
|
|
653
|
+
const missing = removedKeys.find((key) => !Object.hasOwn(current.values, key));
|
|
654
|
+
if (missing)
|
|
655
|
+
throw new Error(`Unknown config key "${missing}".`);
|
|
656
|
+
}
|
|
657
|
+
const next = Object.assign(Object.create(null), current.values);
|
|
658
|
+
for (const key of removedKeys)
|
|
659
|
+
delete next[key];
|
|
660
|
+
for (const [key, value] of Object.entries(options.updates))
|
|
661
|
+
next[key] = value;
|
|
662
|
+
const validated = validateStoreValues({ filePath: current.path, values: next });
|
|
663
|
+
assertReadyPluginConfigStore(validated);
|
|
664
|
+
return { ...await commitPluginConfigLayer(options, current, validated.values), updatedKeys: Object.keys(options.updates), removedKeys };
|
|
596
665
|
}
|
|
597
666
|
export async function resetPluginConfigStore(options) {
|
|
598
|
-
|
|
667
|
+
return resetPluginConfigStoreTarget(options, false);
|
|
668
|
+
}
|
|
669
|
+
/** Delete the plugin's complete user document, including every platform profile. */
|
|
670
|
+
export async function deletePluginConfigStore(options) {
|
|
671
|
+
return resetPluginConfigStoreTarget(options, true);
|
|
672
|
+
}
|
|
673
|
+
async function resetPluginConfigStoreTarget(options, wholeDocument) {
|
|
599
674
|
const filePath = resolvePluginConfigStorePath({
|
|
600
675
|
...options,
|
|
601
676
|
...(options.scope === 'project' ? { access: 'write' } : {}),
|
|
602
677
|
});
|
|
603
678
|
const allowedRoot = resolvePluginConfigAllowedRoot(options);
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
if (!options.sourceIdentity) {
|
|
617
|
-
throw new Error('sourceIdentity is required for namespaced plugin config.');
|
|
618
|
-
}
|
|
619
|
-
await readNamespacedStoreFile({
|
|
620
|
-
filePath,
|
|
621
|
-
sourceId: options.sourceId,
|
|
622
|
-
sourceIdentity: options.sourceIdentity,
|
|
679
|
+
const publicTarget = `${options.scope}/plugin-config/${[
|
|
680
|
+
options.sourceId,
|
|
681
|
+
options.pluginName,
|
|
682
|
+
CONFIG_FILE,
|
|
683
|
+
].filter(Boolean).join('/')}`;
|
|
684
|
+
const { root, candidate } = assertConfigPathBoundary(allowedRoot, filePath);
|
|
685
|
+
let current = root;
|
|
686
|
+
try {
|
|
687
|
+
for (const segment of path.relative(root, path.dirname(candidate)).split(path.sep).filter(Boolean)) {
|
|
688
|
+
const stats = await lstatIfExists(current);
|
|
689
|
+
if (!stats) {
|
|
690
|
+
return {
|
|
623
691
|
pluginName: options.pluginName,
|
|
624
|
-
|
|
692
|
+
scope: 'user',
|
|
693
|
+
storeKind: 'user',
|
|
694
|
+
path: filePath,
|
|
695
|
+
existed: false,
|
|
696
|
+
deleted: false,
|
|
697
|
+
resetDisposition: 'absent',
|
|
698
|
+
};
|
|
625
699
|
}
|
|
626
|
-
|
|
627
|
-
|
|
700
|
+
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
701
|
+
throw new PluginConfigResetError('configResetTargetUnsupported', `${publicTarget} has an unsafe ancestor. Repair it manually, then retry config reset.`);
|
|
628
702
|
}
|
|
629
|
-
|
|
630
|
-
},
|
|
631
|
-
});
|
|
632
|
-
return {
|
|
633
|
-
pluginName: options.pluginName,
|
|
634
|
-
scope: options.scope,
|
|
635
|
-
storeKind: options.scope === 'user'
|
|
636
|
-
? 'user'
|
|
637
|
-
: options.projectLayer === 'local'
|
|
638
|
-
? 'projectLocal'
|
|
639
|
-
: 'projectShared',
|
|
640
|
-
path: filePath,
|
|
641
|
-
existed,
|
|
642
|
-
deleted: existed,
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
export async function resetPluginConfigStores(options) {
|
|
646
|
-
await assertNoLegacyConfigCoexistence(options);
|
|
647
|
-
const targets = resolvePluginConfigStoreTargets({
|
|
648
|
-
...options,
|
|
649
|
-
...(options.scope === 'project' ? { access: 'write' } : {}),
|
|
650
|
-
});
|
|
651
|
-
const allowedRoot = resolvePluginConfigAllowedRoot(options);
|
|
652
|
-
const receipts = [];
|
|
653
|
-
const existing = [];
|
|
654
|
-
for (const target of targets) {
|
|
655
|
-
await prepareConfigFileParent(target.path, allowedRoot);
|
|
656
|
-
await assertNoConfigSymlink(allowedRoot, target.path);
|
|
657
|
-
const stats = await lstatIfExists(target.path);
|
|
658
|
-
existing.push(stats !== null);
|
|
659
|
-
if (!stats)
|
|
660
|
-
continue;
|
|
661
|
-
if (!stats.isFile() || stats.isSymbolicLink()) {
|
|
662
|
-
throw new Error(`Config target must be a regular file: ${target.path}`);
|
|
703
|
+
current = path.join(current, segment);
|
|
663
704
|
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
}
|
|
668
|
-
await readNamespacedStoreFile({
|
|
669
|
-
filePath: target.path,
|
|
670
|
-
sourceId: options.sourceId,
|
|
671
|
-
sourceIdentity: options.sourceIdentity,
|
|
705
|
+
const parentStats = await lstatIfExists(current);
|
|
706
|
+
if (!parentStats) {
|
|
707
|
+
return {
|
|
672
708
|
pluginName: options.pluginName,
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
709
|
+
scope: 'user',
|
|
710
|
+
storeKind: 'user',
|
|
711
|
+
path: filePath,
|
|
712
|
+
existed: false,
|
|
713
|
+
deleted: false,
|
|
714
|
+
resetDisposition: 'absent',
|
|
715
|
+
};
|
|
677
716
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
const deleted = await atomicRemoveConfigFile({
|
|
681
|
-
filePath: target.path,
|
|
682
|
-
allowedRoot,
|
|
683
|
-
});
|
|
684
|
-
receipts.push({
|
|
685
|
-
pluginName: options.pluginName,
|
|
686
|
-
scope: options.scope,
|
|
687
|
-
storeKind: target.storeKind,
|
|
688
|
-
path: target.path,
|
|
689
|
-
existed: existing[index],
|
|
690
|
-
deleted,
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
return receipts;
|
|
694
|
-
}
|
|
695
|
-
function coercePrimitiveValue(key, field, value) {
|
|
696
|
-
if (field.type === 'string') {
|
|
697
|
-
if (typeof value !== 'string') {
|
|
698
|
-
throw new Error(`Config "${key}" must be a string.`);
|
|
717
|
+
if (parentStats.isSymbolicLink() || !parentStats.isDirectory()) {
|
|
718
|
+
throw new PluginConfigResetError('configResetTargetUnsupported', `${publicTarget} has an unsafe ancestor. Repair it manually, then retry config reset.`);
|
|
699
719
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
:
|
|
708
|
-
|
|
709
|
-
|
|
720
|
+
await options.reviewPreflight?.();
|
|
721
|
+
const target = await lstatIfExists(filePath);
|
|
722
|
+
if (!target) {
|
|
723
|
+
return {
|
|
724
|
+
pluginName: options.pluginName,
|
|
725
|
+
scope: 'user',
|
|
726
|
+
storeKind: 'user',
|
|
727
|
+
path: filePath,
|
|
728
|
+
existed: false,
|
|
729
|
+
deleted: false,
|
|
730
|
+
resetDisposition: 'absent',
|
|
731
|
+
};
|
|
710
732
|
}
|
|
711
|
-
|
|
712
|
-
|
|
733
|
+
let store;
|
|
734
|
+
if (target.isFile()) {
|
|
735
|
+
try {
|
|
736
|
+
store = await readPluginConfigStore(options);
|
|
737
|
+
}
|
|
738
|
+
catch {
|
|
739
|
+
// A broken document still has the schema-independent reset recovery below.
|
|
740
|
+
}
|
|
713
741
|
}
|
|
714
|
-
if (
|
|
715
|
-
|
|
742
|
+
if (!wholeDocument && store && store.state !== 'invalid' && replacePluginConfigStoreLayer(store, {}, options.platform).exists) {
|
|
743
|
+
await commitPluginConfigLayer(options, store, {});
|
|
744
|
+
return { pluginName: options.pluginName, scope: 'user', platform: options.platform, storeKind: 'user',
|
|
745
|
+
path: filePath, existed: true, deleted: false, resetDisposition: 'clearedLayer' };
|
|
716
746
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
747
|
+
if (target.isFile() || target.isSymbolicLink()) {
|
|
748
|
+
await assertNoConfigSymlink(allowedRoot, path.dirname(filePath));
|
|
749
|
+
await nodeFs.unlink(filePath);
|
|
750
|
+
return {
|
|
751
|
+
pluginName: options.pluginName,
|
|
752
|
+
scope: 'user',
|
|
753
|
+
storeKind: 'user',
|
|
754
|
+
path: filePath,
|
|
755
|
+
existed: true,
|
|
756
|
+
deleted: true,
|
|
757
|
+
resetDisposition: target.isSymbolicLink() ? 'unlinkedSymlink' : 'deletedFile',
|
|
758
|
+
};
|
|
722
759
|
}
|
|
723
|
-
if (
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
760
|
+
if (target.isDirectory()) {
|
|
761
|
+
const timestamp = new Date().toISOString().replace(/[-:]/gu, '').replace(/\..*$/u, '');
|
|
762
|
+
const quarantineBasename = `config.broken-${timestamp}-${crypto.randomUUID()}.json`;
|
|
763
|
+
await assertNoConfigSymlink(allowedRoot, path.dirname(filePath));
|
|
764
|
+
await nodeFs.rename(filePath, path.join(path.dirname(filePath), quarantineBasename));
|
|
765
|
+
return {
|
|
766
|
+
pluginName: options.pluginName,
|
|
767
|
+
scope: 'user',
|
|
768
|
+
storeKind: 'user',
|
|
769
|
+
path: filePath,
|
|
770
|
+
existed: true,
|
|
771
|
+
deleted: true,
|
|
772
|
+
resetDisposition: 'quarantinedDirectory',
|
|
773
|
+
quarantineBasename,
|
|
774
|
+
};
|
|
731
775
|
}
|
|
732
|
-
throw new
|
|
776
|
+
throw new PluginConfigResetError('configResetTargetUnsupported', `${publicTarget} is a special filesystem node. Move it manually, then retry config reset.`);
|
|
733
777
|
}
|
|
734
|
-
|
|
735
|
-
if (
|
|
736
|
-
throw
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
778
|
+
catch (error) {
|
|
779
|
+
if (error instanceof PluginConfigResetError)
|
|
780
|
+
throw error;
|
|
781
|
+
const osCode = error.code;
|
|
782
|
+
throw new PluginConfigResetError('configResetFailed', `Cannot reset ${publicTarget}${osCode ? ` (${osCode})` : ''}. Fix filesystem access, then retry config reset.`, osCode);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
export async function inspectPluginConfigResetTarget(options) {
|
|
786
|
+
const filePath = resolvePluginConfigStorePath({
|
|
787
|
+
...options,
|
|
788
|
+
...(options.scope === 'project' ? { access: 'write' } : {}),
|
|
789
|
+
});
|
|
790
|
+
const allowedRoot = resolvePluginConfigAllowedRoot(options);
|
|
791
|
+
const publicTarget = `${options.scope}/plugin-config/${[
|
|
792
|
+
options.sourceId,
|
|
793
|
+
options.pluginName,
|
|
794
|
+
CONFIG_FILE,
|
|
795
|
+
].filter(Boolean).join('/')}`;
|
|
796
|
+
const { root, candidate } = assertConfigPathBoundary(allowedRoot, filePath);
|
|
797
|
+
let current = root;
|
|
798
|
+
for (const segment of path.relative(root, path.dirname(candidate)).split(path.sep).filter(Boolean)) {
|
|
799
|
+
const stats = await lstatIfExists(current);
|
|
800
|
+
if (!stats)
|
|
801
|
+
return resetTargetInspection('absent');
|
|
802
|
+
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
803
|
+
throw new PluginConfigResetError('configResetTargetUnsupported', `${publicTarget} has an unsafe ancestor. Repair it manually, then retry config reset.`);
|
|
740
804
|
}
|
|
741
|
-
|
|
805
|
+
current = path.join(current, segment);
|
|
742
806
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
807
|
+
const parentStats = await lstatIfExists(current);
|
|
808
|
+
if (!parentStats)
|
|
809
|
+
return resetTargetInspection('absent');
|
|
810
|
+
if (parentStats.isSymbolicLink() || !parentStats.isDirectory()) {
|
|
811
|
+
throw new PluginConfigResetError('configResetTargetUnsupported', `${publicTarget} has an unsafe ancestor. Repair it manually, then retry config reset.`);
|
|
812
|
+
}
|
|
813
|
+
const target = await lstatIfExists(filePath);
|
|
814
|
+
if (!target)
|
|
815
|
+
return resetTargetInspection('absent');
|
|
816
|
+
const kind = target.isSymbolicLink() ? 'symbolicLink'
|
|
817
|
+
: target.isFile() ? 'regularFile'
|
|
818
|
+
: target.isDirectory() ? 'directory'
|
|
819
|
+
: 'special';
|
|
820
|
+
return resetTargetInspection(kind, target);
|
|
821
|
+
}
|
|
822
|
+
function resetTargetInspection(kind, stats) {
|
|
823
|
+
const fingerprint = `sha256:${crypto.createHash('sha256').update(JSON.stringify({
|
|
824
|
+
kind,
|
|
825
|
+
...(stats ? {
|
|
826
|
+
dev: stats.dev,
|
|
827
|
+
ino: stats.ino,
|
|
828
|
+
mode: stats.mode,
|
|
829
|
+
size: stats.size,
|
|
830
|
+
mtimeMs: stats.mtimeMs,
|
|
831
|
+
ctimeMs: stats.ctimeMs,
|
|
832
|
+
} : {}),
|
|
833
|
+
})).digest('hex')}`;
|
|
834
|
+
return {
|
|
835
|
+
exists: kind !== 'absent',
|
|
836
|
+
kind,
|
|
837
|
+
resettable: kind !== 'special',
|
|
838
|
+
fingerprint,
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
export async function resetPluginConfigStores(options) {
|
|
842
|
+
return [await resetPluginConfigStore(options)];
|
|
843
|
+
}
|
|
844
|
+
export class PluginConfigValueValidationError extends Error {
|
|
845
|
+
publicMessage;
|
|
846
|
+
constructor(issue, publicMessage) {
|
|
847
|
+
super(formatPluginConfigIssue(issue));
|
|
848
|
+
this.publicMessage = publicMessage;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
function configValueIssuePublicMessage(initialField, input, issue) {
|
|
852
|
+
const segments = issue.path.segments;
|
|
853
|
+
if (segments === undefined || segments.length < 2 || initialField.sensitive === true)
|
|
854
|
+
return undefined;
|
|
855
|
+
let field = initialField;
|
|
856
|
+
let value = input;
|
|
857
|
+
// User-supplied object keys may contain private text. Only report declared properties and row positions.
|
|
858
|
+
for (const segment of segments.slice(1)) {
|
|
859
|
+
if (typeof segment === 'number' && field.type === 'array' && Array.isArray(value)) {
|
|
860
|
+
field = field.items;
|
|
861
|
+
value = value[segment];
|
|
746
862
|
}
|
|
747
|
-
|
|
863
|
+
else if (typeof segment === 'string' && field.type === 'object' && isRecord(value)) {
|
|
864
|
+
const { properties } = resolvePluginConfigObjectProperties(field, value);
|
|
865
|
+
if (!Object.hasOwn(properties, segment) || !/^[A-Za-z0-9_-]+$/u.test(segment))
|
|
866
|
+
return undefined;
|
|
867
|
+
field = properties[segment];
|
|
868
|
+
value = Object.hasOwn(value, segment) ? value[segment] : undefined;
|
|
869
|
+
}
|
|
870
|
+
else
|
|
871
|
+
return undefined;
|
|
748
872
|
}
|
|
749
|
-
|
|
873
|
+
return formatPluginConfigIssue(issue);
|
|
750
874
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
875
|
+
function coerceConfigValue(key, field, value) {
|
|
876
|
+
let coerced = value;
|
|
877
|
+
if (field.type === 'number' && typeof value === 'string' && value.trim() !== '') {
|
|
878
|
+
coerced = Number(value);
|
|
754
879
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
if (options.field.type === 'file' && !stats.isFile()) {
|
|
762
|
-
throw new Error(`Config "${options.key}" must point to an existing file.`);
|
|
880
|
+
else if (field.type === 'boolean' && typeof value === 'string') {
|
|
881
|
+
const normalized = value.trim().toLowerCase();
|
|
882
|
+
if (['true', '1', 'yes', 'y'].includes(normalized))
|
|
883
|
+
coerced = true;
|
|
884
|
+
if (['false', '0', 'no', 'n'].includes(normalized))
|
|
885
|
+
coerced = false;
|
|
763
886
|
}
|
|
764
|
-
|
|
765
|
-
|
|
887
|
+
const issues = validateCorePluginConfigValue(field, coerced, key);
|
|
888
|
+
if (issues.length > 0) {
|
|
889
|
+
const issue = issues[0];
|
|
890
|
+
throw new PluginConfigValueValidationError(issue, configValueIssuePublicMessage(field, coerced, issue));
|
|
766
891
|
}
|
|
767
|
-
return
|
|
892
|
+
return coerced;
|
|
768
893
|
}
|
|
769
894
|
export async function coercePluginConfigValue(options) {
|
|
770
|
-
|
|
771
|
-
if (options.field.type === 'file' || options.field.type === 'directory') {
|
|
772
|
-
return resolvePathConfigValue({
|
|
773
|
-
key: options.key,
|
|
774
|
-
field: options.field,
|
|
775
|
-
value: primitive,
|
|
776
|
-
projectRoot: options.projectRoot,
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
return primitive;
|
|
895
|
+
return coerceConfigValue(options.key, options.field, options.value);
|
|
780
896
|
}
|
|
781
897
|
function redactValue(field, value) {
|
|
782
|
-
return field
|
|
783
|
-
}
|
|
784
|
-
function sourceForStoreLayer(scope, projectLayer = 'shared') {
|
|
785
|
-
if (scope === 'user') {
|
|
786
|
-
return 'user';
|
|
787
|
-
}
|
|
788
|
-
return projectLayer === 'local' ? 'projectLocal' : 'project';
|
|
789
|
-
}
|
|
790
|
-
function isPathTypeField(field) {
|
|
791
|
-
return field.type === 'file' || field.type === 'directory';
|
|
898
|
+
return redactPluginConfigValue(field, value);
|
|
792
899
|
}
|
|
793
900
|
async function applyConfigLayer(options) {
|
|
794
901
|
for (const [key, field] of Object.entries(options.schema)) {
|
|
795
902
|
if (!Object.hasOwn(options.entries, key)) {
|
|
796
903
|
continue;
|
|
797
904
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
});
|
|
805
|
-
options.values[key] = coerced;
|
|
806
|
-
options.redactedValues[key] = redactValue(field, coerced);
|
|
905
|
+
const value = options.entries[key];
|
|
906
|
+
const validationIssues = validateCorePluginConfigValue(field, value, key);
|
|
907
|
+
if (validationIssues.length === 0) {
|
|
908
|
+
const redactedValue = redactValue(field, value);
|
|
909
|
+
options.values[key] = value;
|
|
910
|
+
options.redactedValues[key] = redactedValue;
|
|
807
911
|
options.sources[key] = options.source;
|
|
808
|
-
options.
|
|
912
|
+
options.fieldStates[key] = {
|
|
913
|
+
effective: { value, redactedValue, source: options.source },
|
|
914
|
+
};
|
|
809
915
|
}
|
|
810
|
-
|
|
916
|
+
else {
|
|
917
|
+
const fallback = options.fieldStates[key]?.effective;
|
|
811
918
|
delete options.values[key];
|
|
812
919
|
delete options.redactedValues[key];
|
|
813
920
|
options.sources[key] = options.source;
|
|
814
|
-
|
|
921
|
+
const issues = validationIssues.map((issue) => ({
|
|
815
922
|
type: 'invalid-config',
|
|
816
923
|
key,
|
|
817
924
|
source: options.source,
|
|
818
|
-
message:
|
|
819
|
-
});
|
|
925
|
+
message: formatPluginConfigIssue(issue),
|
|
926
|
+
}));
|
|
927
|
+
options.fieldStates[key] = {
|
|
928
|
+
invalidOverride: { source: options.source, issues },
|
|
929
|
+
...(fallback ? { fallback } : {}),
|
|
930
|
+
};
|
|
820
931
|
}
|
|
821
932
|
}
|
|
822
933
|
}
|
|
823
934
|
export async function resolveEffectivePluginConfig(options) {
|
|
935
|
+
const workContext = options.context ? await resolveWorkContext({ cwd: options.cwd, context: options.context }) : undefined;
|
|
824
936
|
const pluginName = assertSafePluginConfigSegment(options.pluginName ?? options.manifest.name);
|
|
825
|
-
const
|
|
937
|
+
const user = await readPluginConfigStore({ ...options, pluginName, scope: 'user' });
|
|
938
|
+
assertReadyPluginConfigStore(user);
|
|
939
|
+
const references = !options.referenceContext && pluginConfigHasExternalReferences(options.manifest)
|
|
940
|
+
? await resolvePluginConfigReferenceContext({ ...options, scope: options.context ?? options.targetScope ?? 'user', plugins: options.referencePlugins }) : undefined;
|
|
941
|
+
return resolveEffectivePluginConfigFromStores({ ...options, pluginName, projectRoot: workContext?.projectRoot ?? ((options.context ?? options.targetScope) === 'project' ? resolveAwProjectRoot(options.cwd) : ''),
|
|
942
|
+
referenceContext: options.referenceContext ?? references?.context, referenceEvidence: references?.evidence,
|
|
943
|
+
stores: { user } });
|
|
944
|
+
}
|
|
945
|
+
export async function resolveEffectivePluginConfigFromStores(options) {
|
|
946
|
+
const pluginName = assertSafePluginConfigSegment(options.pluginName ?? options.manifest.name);
|
|
947
|
+
const definition = options.manifest.config ? selectPluginConfigProfile(options.manifest.config, options.platform) : undefined;
|
|
948
|
+
const schema = definition?.fields;
|
|
826
949
|
if (!schema) {
|
|
827
|
-
throw new
|
|
950
|
+
throw new PluginConfigSchemaResolutionError('configSchemaUnavailable', `Plugin "${pluginName}" does not declare an AW config schema.`);
|
|
828
951
|
}
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
-
readPluginConfigStore({
|
|
832
|
-
sourceId: options.sourceId,
|
|
833
|
-
sourceIdentity: options.sourceIdentity,
|
|
834
|
-
pluginName,
|
|
835
|
-
scope: 'user',
|
|
836
|
-
cwd: options.cwd,
|
|
837
|
-
env: options.env,
|
|
838
|
-
}),
|
|
839
|
-
readPluginConfigStore({
|
|
840
|
-
sourceId: options.sourceId,
|
|
841
|
-
sourceIdentity: options.sourceIdentity,
|
|
842
|
-
pluginName,
|
|
843
|
-
scope: 'project',
|
|
844
|
-
cwd: options.cwd,
|
|
845
|
-
env: options.env,
|
|
846
|
-
}),
|
|
847
|
-
readPluginConfigStore({
|
|
848
|
-
sourceId: options.sourceId,
|
|
849
|
-
sourceIdentity: options.sourceIdentity,
|
|
850
|
-
pluginName,
|
|
851
|
-
scope: 'project',
|
|
852
|
-
cwd: options.cwd,
|
|
853
|
-
env: options.env,
|
|
854
|
-
projectLayer: 'local',
|
|
855
|
-
}),
|
|
856
|
-
]);
|
|
952
|
+
const userStore = options.stores.user;
|
|
953
|
+
assertReadyPluginConfigStore(userStore);
|
|
857
954
|
const values = {};
|
|
858
955
|
const redactedValues = {};
|
|
859
956
|
const sources = {};
|
|
860
|
-
const
|
|
957
|
+
const fieldStates = {};
|
|
861
958
|
const ignoredUnknownKeys = [];
|
|
959
|
+
const unsupportedLayerOverrides = [];
|
|
960
|
+
const dangerousKeyIssues = [];
|
|
862
961
|
const schemaKeys = new Set(Object.keys(schema));
|
|
863
962
|
for (const key of schemaKeys) {
|
|
864
963
|
sources[key] = 'missing';
|
|
@@ -871,43 +970,151 @@ export async function resolveEffectivePluginConfig(options) {
|
|
|
871
970
|
values,
|
|
872
971
|
redactedValues,
|
|
873
972
|
sources,
|
|
874
|
-
|
|
973
|
+
fieldStates,
|
|
875
974
|
schema: { [key]: field },
|
|
876
975
|
entries: { [key]: field.default },
|
|
877
976
|
source: 'default',
|
|
878
|
-
projectRoot,
|
|
879
977
|
});
|
|
880
978
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
979
|
+
const commonFields = selectPluginConfigProfile(options.manifest.config, undefined).fields;
|
|
980
|
+
const layers = [
|
|
981
|
+
{ entries: options.platform
|
|
982
|
+
? Object.fromEntries(Object.entries(userStore.common ?? (userStore.platform ? {} : userStore.values))
|
|
983
|
+
.filter(([key]) => {
|
|
984
|
+
// Unknown keys remain available to the existing dangerous-key check and
|
|
985
|
+
// unknown-key reporting; only declared, platform-specific values are isolated.
|
|
986
|
+
if (!Object.hasOwn(schema, key))
|
|
987
|
+
return true;
|
|
988
|
+
const field = schema[key];
|
|
989
|
+
return Object.hasOwn(commonFields, key) && !('platformOnly' in field && field.platformOnly);
|
|
990
|
+
}))
|
|
991
|
+
: userStore.common ?? userStore.values, source: 'common' },
|
|
992
|
+
...(options.platform ? [{ entries: userStore.platforms?.[options.platform] ?? {}, source: 'platform' }] : []),
|
|
993
|
+
];
|
|
994
|
+
for (const { entries, source } of layers) {
|
|
995
|
+
const plainEntries = getStoreEntries(entries);
|
|
996
|
+
const dangerousIssues = new Map(validatePluginConfigDocument(definition, plainEntries)
|
|
997
|
+
.filter((issue) => issue.code === 'dangerousKey').map((issue) => [issue.path.field, issue]));
|
|
887
998
|
for (const key of Object.keys(plainEntries)) {
|
|
888
|
-
if (
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
key,
|
|
894
|
-
|
|
895
|
-
|
|
999
|
+
if (schemaKeys.has(key))
|
|
1000
|
+
continue;
|
|
1001
|
+
const dangerousIssue = dangerousIssues.get(key);
|
|
1002
|
+
if (dangerousIssue)
|
|
1003
|
+
dangerousKeyIssues.push({ type: 'invalid-config', code: dangerousIssue.code,
|
|
1004
|
+
key, source, message: formatPluginConfigIssue(dangerousIssue) });
|
|
1005
|
+
else
|
|
1006
|
+
ignoredUnknownKeys.push({ scope: 'user', source, key });
|
|
896
1007
|
}
|
|
897
1008
|
await applyConfigLayer({
|
|
898
1009
|
values,
|
|
899
1010
|
redactedValues,
|
|
900
1011
|
sources,
|
|
901
|
-
|
|
1012
|
+
fieldStates,
|
|
902
1013
|
schema,
|
|
903
1014
|
entries: plainEntries,
|
|
904
|
-
source
|
|
905
|
-
projectRoot,
|
|
1015
|
+
source,
|
|
906
1016
|
});
|
|
907
1017
|
}
|
|
908
|
-
const
|
|
1018
|
+
const candidateValues = {};
|
|
909
1019
|
for (const [key, field] of Object.entries(schema)) {
|
|
910
|
-
|
|
1020
|
+
const source = sources[key];
|
|
1021
|
+
if (source === 'default')
|
|
1022
|
+
candidateValues[key] = field.default;
|
|
1023
|
+
if (source === 'common')
|
|
1024
|
+
candidateValues[key] = ownStoreValue(userStore.common ?? userStore.values, key);
|
|
1025
|
+
if (source === 'platform' && options.platform)
|
|
1026
|
+
candidateValues[key] = ownStoreValue(userStore.platforms?.[options.platform] ?? {}, key);
|
|
1027
|
+
}
|
|
1028
|
+
const candidateIssues = validatePluginConfigCandidate(definition, candidateValues, undefined, options.referenceContext);
|
|
1029
|
+
const referenceIssues = candidateIssues.filter((issue) => issue.code.startsWith('valueRef')
|
|
1030
|
+
&& (!issue.path.plugin || issue.path.plugin === pluginName));
|
|
1031
|
+
const missingReferenceIssues = [];
|
|
1032
|
+
for (const issue of referenceIssues) {
|
|
1033
|
+
const key = issue.path.field;
|
|
1034
|
+
const source = sources[key];
|
|
1035
|
+
const state = fieldStates[key];
|
|
1036
|
+
const configIssue = {
|
|
1037
|
+
type: 'invalid-config', code: issue.code, key, source,
|
|
1038
|
+
message: formatPluginConfigIssue(issue),
|
|
1039
|
+
};
|
|
1040
|
+
if (source === 'missing') {
|
|
1041
|
+
missingReferenceIssues.push(configIssue);
|
|
1042
|
+
continue;
|
|
1043
|
+
}
|
|
1044
|
+
delete values[key];
|
|
1045
|
+
delete redactedValues[key];
|
|
1046
|
+
fieldStates[key] = {
|
|
1047
|
+
invalidOverride: { source, issues: [...(state?.invalidOverride?.issues ?? []), configIssue] },
|
|
1048
|
+
...(state?.fallback ? { fallback: state.fallback } : {}),
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
// Provider errors stay private, while each field that reads them remains unusable.
|
|
1052
|
+
if (options.referenceContext) {
|
|
1053
|
+
for (const foreign of candidateIssues.filter((issue) => issue.code.startsWith('valueRef')
|
|
1054
|
+
&& issue.path.plugin && issue.path.plugin !== pluginName)) {
|
|
1055
|
+
for (const key of schemaKeys) {
|
|
1056
|
+
let dependencies;
|
|
1057
|
+
try {
|
|
1058
|
+
dependencies = getPluginConfigDependencyFields(definition, [key], options.referenceContext);
|
|
1059
|
+
}
|
|
1060
|
+
catch {
|
|
1061
|
+
continue; // The local association issue already reports the invalid schema.
|
|
1062
|
+
}
|
|
1063
|
+
if (!dependencies.some((entry) => entry.plugin === foreign.path.plugin && entry.field === foreign.path.field))
|
|
1064
|
+
continue;
|
|
1065
|
+
const source = sources[key];
|
|
1066
|
+
const state = fieldStates[key];
|
|
1067
|
+
const configIssue = { type: 'invalid-config', code: 'valueRefSource', key, source,
|
|
1068
|
+
message: `Config "${key}" depends on invalid config "${foreign.path.plugin}/${foreign.path.field}". Fix the dependency before using this field.` };
|
|
1069
|
+
if (state?.invalidOverride?.issues.some((issue) => issue.code === configIssue.code && issue.message === configIssue.message))
|
|
1070
|
+
continue;
|
|
1071
|
+
delete values[key];
|
|
1072
|
+
delete redactedValues[key];
|
|
1073
|
+
if (source === 'missing')
|
|
1074
|
+
missingReferenceIssues.push(configIssue);
|
|
1075
|
+
else
|
|
1076
|
+
fieldStates[key] = { invalidOverride: { source, issues: [...(state?.invalidOverride?.issues ?? []), configIssue] },
|
|
1077
|
+
...(state?.fallback ? { fallback: state.fallback } : {}) };
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
// Consumers must retain dependency failures after invalid source values are omitted.
|
|
1082
|
+
const invalidKeys = new Set([
|
|
1083
|
+
...Object.entries(fieldStates).filter(([, state]) => state.invalidOverride !== undefined).map(([key]) => key),
|
|
1084
|
+
...missingReferenceIssues.map((issue) => issue.key),
|
|
1085
|
+
]);
|
|
1086
|
+
for (const key of schemaKeys) {
|
|
1087
|
+
if (invalidKeys.has(key))
|
|
1088
|
+
continue;
|
|
1089
|
+
const dependency = getPluginConfigDependencyKeys(definition, [key])
|
|
1090
|
+
.find((dependencyKey) => dependencyKey !== key && invalidKeys.has(dependencyKey));
|
|
1091
|
+
if (dependency === undefined)
|
|
1092
|
+
continue;
|
|
1093
|
+
const source = sources[key];
|
|
1094
|
+
const configIssue = {
|
|
1095
|
+
type: 'invalid-config', code: 'valueRefSource', key, source,
|
|
1096
|
+
message: `Config "${key}" depends on invalid config "${dependency}". Fix the dependency before using this field.`,
|
|
1097
|
+
};
|
|
1098
|
+
delete values[key];
|
|
1099
|
+
delete redactedValues[key];
|
|
1100
|
+
if (source === 'missing') {
|
|
1101
|
+
missingReferenceIssues.push(configIssue);
|
|
1102
|
+
}
|
|
1103
|
+
else {
|
|
1104
|
+
const state = fieldStates[key];
|
|
1105
|
+
fieldStates[key] = {
|
|
1106
|
+
invalidOverride: { source, issues: [configIssue] },
|
|
1107
|
+
...(state?.fallback ? { fallback: state.fallback } : {}),
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
const issues = [
|
|
1112
|
+
...Object.values(fieldStates).flatMap((state) => state.invalidOverride?.issues ?? []),
|
|
1113
|
+
...dangerousKeyIssues,
|
|
1114
|
+
...missingReferenceIssues,
|
|
1115
|
+
];
|
|
1116
|
+
for (const [key, field] of Object.entries(schema)) {
|
|
1117
|
+
if (field.required && values[key] === undefined && !fieldStates[key]?.invalidOverride) {
|
|
911
1118
|
issues.push({
|
|
912
1119
|
type: 'missing-required',
|
|
913
1120
|
key,
|
|
@@ -918,650 +1125,216 @@ export async function resolveEffectivePluginConfig(options) {
|
|
|
918
1125
|
}
|
|
919
1126
|
return {
|
|
920
1127
|
pluginName,
|
|
921
|
-
|
|
1128
|
+
platform: options.platform,
|
|
1129
|
+
context: options.context ?? options.targetScope ?? 'user',
|
|
1130
|
+
definition: definition,
|
|
1131
|
+
projectRoot: options.projectRoot,
|
|
922
1132
|
values,
|
|
923
1133
|
redactedValues,
|
|
924
1134
|
sources,
|
|
1135
|
+
fieldStates,
|
|
925
1136
|
issues,
|
|
1137
|
+
unsupportedLayerOverrides,
|
|
926
1138
|
ignoredUnknownKeys,
|
|
927
1139
|
schema,
|
|
928
1140
|
stores: {
|
|
929
1141
|
user: userStore,
|
|
930
|
-
project: projectStore,
|
|
931
|
-
projectLocal: projectLocalStore,
|
|
932
1142
|
},
|
|
1143
|
+
...(options.referenceContext ? { referenceContext: options.referenceContext } : {}),
|
|
1144
|
+
...(options.referenceEvidence ? { referenceEvidence: options.referenceEvidence } : {}),
|
|
933
1145
|
};
|
|
934
1146
|
}
|
|
1147
|
+
function ownStoreValue(values, key) {
|
|
1148
|
+
return Object.hasOwn(values, key) ? values[key] : undefined;
|
|
1149
|
+
}
|
|
1150
|
+
/** Check cross-field relations before saving one complete layer candidate. */
|
|
1151
|
+
export async function assertPluginConfigMutationCandidate(options) {
|
|
1152
|
+
const pluginId = options.sourceId ? `${options.sourceId}/${options.pluginName}` : options.pluginName;
|
|
1153
|
+
const preferences = await observePreferences(options);
|
|
1154
|
+
if (Object.keys(options.updates).length) {
|
|
1155
|
+
assertConfigLayerWritable(pluginId, options.manifest, preferences, options.platform);
|
|
1156
|
+
}
|
|
1157
|
+
const user = await readPluginConfigStore({ ...options, scope: 'user' });
|
|
1158
|
+
assertReadyPluginConfigStore(user);
|
|
1159
|
+
// Unsetting an unknown (stale) key has no effective profile to validate.
|
|
1160
|
+
const selectedFields = options.manifest.config ? selectPluginConfigProfile(options.manifest.config, options.platform).fields : {};
|
|
1161
|
+
if (!Object.keys(options.updates).length && options.removeKeys.every((key) => !Object.hasOwn(selectedFields, key)))
|
|
1162
|
+
return;
|
|
1163
|
+
const layers = resolveConfigurableLayers(pluginId, options.manifest, preferences);
|
|
1164
|
+
if (!layers.includes(options.platform ?? 'common'))
|
|
1165
|
+
return;
|
|
1166
|
+
const values = { ...user.values };
|
|
1167
|
+
for (const key of options.removeKeys)
|
|
1168
|
+
delete values[key];
|
|
1169
|
+
for (const [key, value] of Object.entries(options.updates))
|
|
1170
|
+
values[key] = value;
|
|
1171
|
+
const candidate = replacePluginConfigStoreLayer(user, values, options.platform);
|
|
1172
|
+
const profiles = options.platform ? [options.platform] : layers.map((layer) => layer === 'common' ? undefined : layer);
|
|
1173
|
+
for (const platform of profiles) {
|
|
1174
|
+
const references = pluginConfigHasExternalReferences(options.manifest)
|
|
1175
|
+
? await resolvePluginConfigReferenceContext({ ...options, platform, plugins: options.referencePlugins }) : undefined;
|
|
1176
|
+
const resolve = (store) => resolveEffectivePluginConfigFromStores({ ...options, platform,
|
|
1177
|
+
targetScope: options.scope, projectRoot: options.scope === 'project' ? resolveAwProjectRoot(options.cwd) : '', stores: { user: store }, referenceContext: references?.context });
|
|
1178
|
+
const [before, after] = await Promise.all([resolve(user), resolve(candidate)]);
|
|
1179
|
+
const existing = new Set(before.issues.map((issue) => `${issue.key}\0${issue.code}\0${issue.message}`));
|
|
1180
|
+
const selectedSource = options.platform ? 'platform' : 'common';
|
|
1181
|
+
const issues = after.issues.filter((issue) => (Object.hasOwn(options.updates, issue.key) && after.sources[issue.key] === selectedSource)
|
|
1182
|
+
|| !existing.has(`${issue.key}\0${issue.code}\0${issue.message}`));
|
|
1183
|
+
if (issues.length)
|
|
1184
|
+
throw Object.assign(new Error(`configReferenceInvalid: ${platform ?? 'common'}: ${issues.map((issue) => issue.message).join(' ')}`), { code: 'configReferenceInvalid' });
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
935
1187
|
export async function coercePluginConfigUpdates(options) {
|
|
936
|
-
const projectRoot = resolveAwProjectRoot(options.cwd);
|
|
937
1188
|
const output = {};
|
|
938
1189
|
for (const [key, value] of Object.entries(options.updates)) {
|
|
939
1190
|
const field = options.schema[key];
|
|
940
1191
|
if (!field) {
|
|
941
1192
|
throw new Error(`Unknown config key "${key}".`);
|
|
942
1193
|
}
|
|
943
|
-
|
|
1194
|
+
const coerced = await coercePluginConfigValue({
|
|
944
1195
|
key,
|
|
945
1196
|
field,
|
|
946
1197
|
value,
|
|
947
|
-
projectRoot,
|
|
948
1198
|
});
|
|
1199
|
+
output[key] = coerced;
|
|
949
1200
|
}
|
|
950
1201
|
return output;
|
|
951
1202
|
}
|
|
952
|
-
function createProjectArtifactBoundaryIssue(options) {
|
|
953
|
-
if (options.reason === 'pathTypeDefault') {
|
|
954
|
-
return {
|
|
955
|
-
key: options.key,
|
|
956
|
-
source: options.source,
|
|
957
|
-
reason: options.reason,
|
|
958
|
-
message: `Config "${options.key}" uses file/directory default value, ` +
|
|
959
|
-
'which cannot participate in repo-visible project artifact truth.',
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
if (options.reason === 'pathTypeRequired') {
|
|
963
|
-
return {
|
|
964
|
-
key: options.key,
|
|
965
|
-
source: options.source,
|
|
966
|
-
reason: options.reason,
|
|
967
|
-
message: `Config "${options.key}" is a required file/directory key, ` +
|
|
968
|
-
'which is not portable enough for repo-visible project artifacts.',
|
|
969
|
-
};
|
|
970
|
-
}
|
|
971
|
-
if (options.reason === 'sharedPathValue') {
|
|
972
|
-
return {
|
|
973
|
-
key: options.key,
|
|
974
|
-
source: options.source,
|
|
975
|
-
reason: options.reason,
|
|
976
|
-
message: `Config "${options.key}" is stored in project shared config as a file/directory path. ` +
|
|
977
|
-
'Use user or project local config for machine-local paths.',
|
|
978
|
-
};
|
|
979
|
-
}
|
|
980
|
-
return {
|
|
981
|
-
key: options.key,
|
|
982
|
-
source: options.source,
|
|
983
|
-
reason: options.reason,
|
|
984
|
-
message: `Config "${options.key}" is declared as a refresh key for repo-visible project artifacts, ` +
|
|
985
|
-
'but file/directory config is machine-local and cannot drive shared artifact refresh.',
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
export function collectProjectArtifactConfigBoundaryIssues(options) {
|
|
989
|
-
const issues = [];
|
|
990
|
-
const refreshKeySet = new Set(options.refreshKeys ?? []);
|
|
991
|
-
for (const [key, field] of Object.entries(options.schema)) {
|
|
992
|
-
if (!isPathTypeField(field)) {
|
|
993
|
-
continue;
|
|
994
|
-
}
|
|
995
|
-
if (field.default !== undefined) {
|
|
996
|
-
issues.push(createProjectArtifactBoundaryIssue({
|
|
997
|
-
key,
|
|
998
|
-
source: 'default',
|
|
999
|
-
reason: 'pathTypeDefault',
|
|
1000
|
-
}));
|
|
1001
|
-
}
|
|
1002
|
-
if (field.required) {
|
|
1003
|
-
issues.push(createProjectArtifactBoundaryIssue({
|
|
1004
|
-
key,
|
|
1005
|
-
source: 'missing',
|
|
1006
|
-
reason: 'pathTypeRequired',
|
|
1007
|
-
}));
|
|
1008
|
-
}
|
|
1009
|
-
if (options.sharedEntries && Object.hasOwn(options.sharedEntries, key)) {
|
|
1010
|
-
issues.push(createProjectArtifactBoundaryIssue({
|
|
1011
|
-
key,
|
|
1012
|
-
source: 'project',
|
|
1013
|
-
reason: 'sharedPathValue',
|
|
1014
|
-
}));
|
|
1015
|
-
}
|
|
1016
|
-
if (refreshKeySet.has(key)) {
|
|
1017
|
-
issues.push(createProjectArtifactBoundaryIssue({
|
|
1018
|
-
key,
|
|
1019
|
-
source: 'project',
|
|
1020
|
-
reason: 'pathTypeRefreshKey',
|
|
1021
|
-
}));
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
return issues;
|
|
1025
|
-
}
|
|
1026
1203
|
export async function resolveProjectArtifactRenderConfig(options) {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
sourceIdentity: options.sourceIdentity,
|
|
1042
|
-
pluginName,
|
|
1043
|
-
scope: 'project',
|
|
1044
|
-
cwd: options.cwd,
|
|
1045
|
-
env: options.env,
|
|
1046
|
-
}),
|
|
1047
|
-
readPluginConfigStore({
|
|
1048
|
-
sourceId: options.sourceId,
|
|
1049
|
-
sourceIdentity: options.sourceIdentity,
|
|
1050
|
-
pluginName,
|
|
1051
|
-
scope: 'project',
|
|
1052
|
-
cwd: options.cwd,
|
|
1053
|
-
env: options.env,
|
|
1054
|
-
projectLayer: 'local',
|
|
1055
|
-
}),
|
|
1056
|
-
]);
|
|
1057
|
-
if (!schema) {
|
|
1204
|
+
if (!options.manifest.config?.fields) {
|
|
1205
|
+
const pluginName = assertSafePluginConfigSegment(options.pluginName ?? options.manifest.name);
|
|
1206
|
+
const [userStore] = await Promise.all([
|
|
1207
|
+
readPluginConfigStore({
|
|
1208
|
+
sourceId: options.sourceId,
|
|
1209
|
+
sourceIdentity: options.sourceIdentity,
|
|
1210
|
+
logicalIdentity: options.logicalIdentity,
|
|
1211
|
+
pluginName,
|
|
1212
|
+
scope: 'user',
|
|
1213
|
+
cwd: options.cwd,
|
|
1214
|
+
env: options.env,
|
|
1215
|
+
}),
|
|
1216
|
+
]);
|
|
1217
|
+
assertReadyPluginConfigStore(userStore);
|
|
1058
1218
|
return {
|
|
1059
1219
|
pluginName,
|
|
1060
|
-
projectRoot,
|
|
1220
|
+
projectRoot: resolveAwProjectRoot(options.cwd),
|
|
1061
1221
|
values: {},
|
|
1062
1222
|
sources: {},
|
|
1063
1223
|
issues: [],
|
|
1224
|
+
unsupportedLayerOverrides: [],
|
|
1064
1225
|
ignoredUnknownKeys: [],
|
|
1065
|
-
boundaryIssues: [],
|
|
1066
1226
|
schema: {},
|
|
1067
|
-
stores: {
|
|
1068
|
-
user: userStore,
|
|
1069
|
-
project: projectStore,
|
|
1070
|
-
projectLocal: projectLocalStore,
|
|
1071
|
-
},
|
|
1227
|
+
stores: { user: userStore },
|
|
1072
1228
|
};
|
|
1073
1229
|
}
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
const ignoredUnknownKeys = [];
|
|
1078
|
-
const schemaKeys = new Set(Object.keys(schema));
|
|
1079
|
-
const boundaryIssues = collectProjectArtifactConfigBoundaryIssues({
|
|
1080
|
-
schema,
|
|
1081
|
-
sharedEntries: projectStore.values,
|
|
1082
|
-
refreshKeys: options.refreshKeys,
|
|
1083
|
-
});
|
|
1084
|
-
for (const key of Object.keys(schema)) {
|
|
1085
|
-
sources[key] = 'missing';
|
|
1086
|
-
}
|
|
1087
|
-
const projectPlainEntries = getStoreEntries(projectStore.values);
|
|
1088
|
-
const userPlainEntries = getStoreEntries(userStore.values);
|
|
1089
|
-
const projectLocalPlainEntries = getStoreEntries(projectLocalStore.values);
|
|
1090
|
-
for (const key of Object.keys(projectPlainEntries)) {
|
|
1091
|
-
if (!schemaKeys.has(key)) {
|
|
1092
|
-
ignoredUnknownKeys.push({ scope: 'project', projectLayer: 'shared', source: 'project', key });
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
for (const key of Object.keys(userPlainEntries)) {
|
|
1096
|
-
if (!schemaKeys.has(key)) {
|
|
1097
|
-
ignoredUnknownKeys.push({ scope: 'user', projectLayer: 'shared', source: 'user', key });
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
for (const key of Object.keys(projectLocalPlainEntries)) {
|
|
1101
|
-
if (!schemaKeys.has(key)) {
|
|
1102
|
-
ignoredUnknownKeys.push({ scope: 'project', projectLayer: 'local', source: 'projectLocal', key });
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
for (const [key, field] of Object.entries(schema)) {
|
|
1106
|
-
if (!isPathTypeField(field) && field.default !== undefined) {
|
|
1107
|
-
await applyConfigLayer({
|
|
1108
|
-
values,
|
|
1109
|
-
redactedValues: {},
|
|
1110
|
-
sources,
|
|
1111
|
-
invalidIssues,
|
|
1112
|
-
schema: { [key]: field },
|
|
1113
|
-
entries: { [key]: field.default },
|
|
1114
|
-
source: 'default',
|
|
1115
|
-
projectRoot,
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
const sharedSchema = Object.fromEntries(Object.entries(schema).filter(([, field]) => !isPathTypeField(field)));
|
|
1120
|
-
await applyConfigLayer({
|
|
1121
|
-
values,
|
|
1122
|
-
redactedValues: {},
|
|
1123
|
-
sources,
|
|
1124
|
-
invalidIssues,
|
|
1125
|
-
schema: sharedSchema,
|
|
1126
|
-
entries: projectPlainEntries,
|
|
1127
|
-
source: 'project',
|
|
1128
|
-
projectRoot,
|
|
1230
|
+
const effective = await resolveEffectivePluginConfig({
|
|
1231
|
+
...options,
|
|
1232
|
+
targetScope: 'project',
|
|
1129
1233
|
});
|
|
1130
|
-
const issues = [
|
|
1131
|
-
...invalidIssues.values(),
|
|
1132
|
-
...boundaryIssues.map((issue) => ({
|
|
1133
|
-
type: 'invalid-config',
|
|
1134
|
-
key: issue.key,
|
|
1135
|
-
source: issue.source,
|
|
1136
|
-
message: issue.message,
|
|
1137
|
-
})),
|
|
1138
|
-
];
|
|
1139
|
-
for (const [key, field] of Object.entries(schema)) {
|
|
1140
|
-
if (isPathTypeField(field)) {
|
|
1141
|
-
continue;
|
|
1142
|
-
}
|
|
1143
|
-
if (field.required && values[key] === undefined) {
|
|
1144
|
-
issues.push({
|
|
1145
|
-
type: 'missing-required',
|
|
1146
|
-
key,
|
|
1147
|
-
source: sources[key],
|
|
1148
|
-
message: `Config "${key}" is required.`,
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
return {
|
|
1153
|
-
pluginName,
|
|
1154
|
-
projectRoot,
|
|
1155
|
-
values,
|
|
1156
|
-
sources,
|
|
1157
|
-
issues,
|
|
1158
|
-
ignoredUnknownKeys,
|
|
1159
|
-
boundaryIssues,
|
|
1160
|
-
schema,
|
|
1161
|
-
stores: {
|
|
1162
|
-
user: userStore,
|
|
1163
|
-
project: projectStore,
|
|
1164
|
-
projectLocal: projectLocalStore,
|
|
1165
|
-
},
|
|
1166
|
-
};
|
|
1167
|
-
}
|
|
1168
|
-
export async function resolveProjectLocalPluginConfigView(options) {
|
|
1169
|
-
const effective = await resolveEffectivePluginConfig(options);
|
|
1170
|
-
const artifactConfig = await resolveProjectArtifactRenderConfig(options);
|
|
1171
|
-
const values = {};
|
|
1172
|
-
const redactedValues = {};
|
|
1173
|
-
const sources = {};
|
|
1174
|
-
const issues = [];
|
|
1175
|
-
for (const [key, field] of Object.entries(effective.schema)) {
|
|
1176
|
-
sources[key] = 'missing';
|
|
1177
|
-
const localPlainEntries = getStoreEntries(effective.stores.projectLocal.values);
|
|
1178
|
-
if (!Object.hasOwn(localPlainEntries, key)) {
|
|
1179
|
-
continue;
|
|
1180
|
-
}
|
|
1181
|
-
sources[key] = 'projectLocal';
|
|
1182
|
-
try {
|
|
1183
|
-
const coerced = await coercePluginConfigValue({
|
|
1184
|
-
key,
|
|
1185
|
-
field,
|
|
1186
|
-
value: localPlainEntries[key],
|
|
1187
|
-
projectRoot: effective.projectRoot,
|
|
1188
|
-
});
|
|
1189
|
-
values[key] = coerced;
|
|
1190
|
-
redactedValues[key] = redactValue(field, coerced);
|
|
1191
|
-
}
|
|
1192
|
-
catch (error) {
|
|
1193
|
-
issues.push({
|
|
1194
|
-
type: 'invalid-config',
|
|
1195
|
-
key,
|
|
1196
|
-
source: 'projectLocal',
|
|
1197
|
-
message: error instanceof Error ? error.message : String(error),
|
|
1198
|
-
});
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
1234
|
return {
|
|
1202
1235
|
pluginName: effective.pluginName,
|
|
1203
1236
|
projectRoot: effective.projectRoot,
|
|
1204
|
-
|
|
1205
|
-
localStore: effective.stores.projectLocal,
|
|
1206
|
-
values,
|
|
1207
|
-
redactedValues,
|
|
1208
|
-
sources,
|
|
1209
|
-
issues,
|
|
1210
|
-
ignoredUnknownKeys: effective.ignoredUnknownKeys.filter((entry) => entry.source === 'projectLocal'),
|
|
1211
|
-
repoVisibleArtifactConfig: {
|
|
1212
|
-
values: artifactConfig.values,
|
|
1213
|
-
sources: artifactConfig.sources,
|
|
1214
|
-
issues: artifactConfig.issues,
|
|
1215
|
-
boundaryIssues: artifactConfig.boundaryIssues,
|
|
1216
|
-
},
|
|
1217
|
-
};
|
|
1218
|
-
}
|
|
1219
|
-
async function resolveRedactedLayerValue(options) {
|
|
1220
|
-
try {
|
|
1221
|
-
const coerced = await coercePluginConfigValue({
|
|
1222
|
-
key: options.key,
|
|
1223
|
-
field: options.field,
|
|
1224
|
-
value: options.value,
|
|
1225
|
-
projectRoot: options.projectRoot,
|
|
1226
|
-
});
|
|
1227
|
-
return {
|
|
1228
|
-
value: redactValue(options.field, coerced),
|
|
1229
|
-
};
|
|
1230
|
-
}
|
|
1231
|
-
catch (error) {
|
|
1232
|
-
return {
|
|
1233
|
-
issue: {
|
|
1234
|
-
type: 'invalid-config',
|
|
1235
|
-
key: options.key,
|
|
1236
|
-
source: options.source,
|
|
1237
|
-
message: error instanceof Error ? error.message : String(error),
|
|
1238
|
-
},
|
|
1239
|
-
};
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
export async function resolveProjectScopedPluginConfigView(options) {
|
|
1243
|
-
const effective = await resolveEffectivePluginConfig(options);
|
|
1244
|
-
const artifactConfig = await resolveProjectArtifactRenderConfig(options);
|
|
1245
|
-
const entries = {};
|
|
1246
|
-
for (const [key, field] of Object.entries(effective.schema)) {
|
|
1247
|
-
const entry = {
|
|
1248
|
-
key,
|
|
1249
|
-
effectiveValue: effective.redactedValues[key],
|
|
1250
|
-
effectiveSource: effective.sources[key] ?? 'missing',
|
|
1251
|
-
repoVisibleArtifactValue: artifactConfig.values[key] === undefined
|
|
1252
|
-
? undefined
|
|
1253
|
-
: redactValue(field, artifactConfig.values[key]),
|
|
1254
|
-
repoVisibleArtifactSource: artifactConfig.sources[key] ?? 'missing',
|
|
1255
|
-
repoVisibleArtifactUsesSharedTruth: true,
|
|
1256
|
-
};
|
|
1257
|
-
if (field.default !== undefined) {
|
|
1258
|
-
const resolvedDefault = await resolveRedactedLayerValue({
|
|
1259
|
-
key,
|
|
1260
|
-
field,
|
|
1261
|
-
projectRoot: effective.projectRoot,
|
|
1262
|
-
source: 'default',
|
|
1263
|
-
value: field.default,
|
|
1264
|
-
});
|
|
1265
|
-
if (resolvedDefault.value !== undefined) {
|
|
1266
|
-
entry.defaultValue = resolvedDefault.value;
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
const userPlainEntries = getStoreEntries(effective.stores.user.values);
|
|
1270
|
-
if (Object.hasOwn(userPlainEntries, key)) {
|
|
1271
|
-
const resolvedUser = await resolveRedactedLayerValue({
|
|
1272
|
-
key,
|
|
1273
|
-
field,
|
|
1274
|
-
projectRoot: effective.projectRoot,
|
|
1275
|
-
source: 'user',
|
|
1276
|
-
value: userPlainEntries[key],
|
|
1277
|
-
});
|
|
1278
|
-
if (resolvedUser.value !== undefined) {
|
|
1279
|
-
entry.userValue = resolvedUser.value;
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
const projectPlainEntries = getStoreEntries(effective.stores.project.values);
|
|
1283
|
-
if (Object.hasOwn(projectPlainEntries, key)) {
|
|
1284
|
-
const resolvedProject = await resolveRedactedLayerValue({
|
|
1285
|
-
key,
|
|
1286
|
-
field,
|
|
1287
|
-
projectRoot: effective.projectRoot,
|
|
1288
|
-
source: 'project',
|
|
1289
|
-
value: projectPlainEntries[key],
|
|
1290
|
-
});
|
|
1291
|
-
if (resolvedProject.value !== undefined) {
|
|
1292
|
-
entry.projectSharedValue = resolvedProject.value;
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
const localPlainEntries = getStoreEntries(effective.stores.projectLocal.values);
|
|
1296
|
-
if (Object.hasOwn(localPlainEntries, key)) {
|
|
1297
|
-
const resolvedLocal = await resolveRedactedLayerValue({
|
|
1298
|
-
key,
|
|
1299
|
-
field,
|
|
1300
|
-
projectRoot: effective.projectRoot,
|
|
1301
|
-
source: 'projectLocal',
|
|
1302
|
-
value: localPlainEntries[key],
|
|
1303
|
-
});
|
|
1304
|
-
if (resolvedLocal.value !== undefined) {
|
|
1305
|
-
entry.projectLocalValue = resolvedLocal.value;
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
entries[key] = entry;
|
|
1309
|
-
}
|
|
1310
|
-
return {
|
|
1311
|
-
pluginName: effective.pluginName,
|
|
1312
|
-
projectRoot: effective.projectRoot,
|
|
1313
|
-
schema: effective.schema,
|
|
1314
|
-
stores: effective.stores,
|
|
1315
|
-
redactedValues: effective.redactedValues,
|
|
1237
|
+
values: effective.values,
|
|
1316
1238
|
sources: effective.sources,
|
|
1317
|
-
entries,
|
|
1318
1239
|
issues: effective.issues,
|
|
1240
|
+
unsupportedLayerOverrides: effective.unsupportedLayerOverrides,
|
|
1319
1241
|
ignoredUnknownKeys: effective.ignoredUnknownKeys,
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
issues: artifactConfig.issues,
|
|
1324
|
-
boundaryIssues: artifactConfig.boundaryIssues,
|
|
1242
|
+
schema: effective.schema,
|
|
1243
|
+
stores: {
|
|
1244
|
+
user: effective.stores.user,
|
|
1325
1245
|
},
|
|
1326
1246
|
};
|
|
1327
1247
|
}
|
|
1328
1248
|
function toConfigSourceLayer(source) {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1249
|
+
return source === undefined || source === 'missing' ? null : source;
|
|
1250
|
+
}
|
|
1251
|
+
function configFieldProjection(options) {
|
|
1252
|
+
const source = options.source ?? 'missing';
|
|
1253
|
+
const issues = options.issues ?? [];
|
|
1254
|
+
const presetSensitive = options.field.sensitive === true
|
|
1255
|
+
|| (options.field.type === 'object'
|
|
1256
|
+
&& (Object.values(options.field.properties ?? {}).some((child) => child.sensitive === true)
|
|
1257
|
+
|| (options.field.additionalProperties !== false
|
|
1258
|
+
&& options.field.additionalProperties?.sensitive === true)));
|
|
1259
|
+
return {
|
|
1260
|
+
value: options.value === undefined ? null : redactValue(options.field, options.value),
|
|
1261
|
+
source,
|
|
1262
|
+
matchedPreset: options.value === undefined || presetSensitive
|
|
1263
|
+
? null
|
|
1264
|
+
: matchPluginConfigPreset(options.field, options.value)?.id ?? null,
|
|
1265
|
+
valid: issues.length === 0,
|
|
1266
|
+
issues,
|
|
1267
|
+
};
|
|
1342
1268
|
}
|
|
1343
1269
|
async function buildManifestFieldEntries(options) {
|
|
1344
|
-
const schema = options.plugin.manifest.config?.schema;
|
|
1345
|
-
if (!schema) {
|
|
1346
|
-
return [];
|
|
1347
|
-
}
|
|
1348
|
-
const projectRoot = resolveAwProjectRoot(options.cwd);
|
|
1349
|
-
const [userStore, projectStore, projectLocalStore] = await Promise.all([
|
|
1350
|
-
readPluginConfigStore({
|
|
1351
|
-
sourceId: options.plugin.sourceId,
|
|
1352
|
-
sourceIdentity: options.plugin.sourceIdentity,
|
|
1353
|
-
pluginName: options.plugin.manifest.name,
|
|
1354
|
-
scope: 'user',
|
|
1355
|
-
cwd: options.cwd,
|
|
1356
|
-
env: options.env,
|
|
1357
|
-
}),
|
|
1358
|
-
readPluginConfigStore({
|
|
1359
|
-
sourceId: options.plugin.sourceId,
|
|
1360
|
-
sourceIdentity: options.plugin.sourceIdentity,
|
|
1361
|
-
pluginName: options.plugin.manifest.name,
|
|
1362
|
-
scope: 'project',
|
|
1363
|
-
projectLayer: 'shared',
|
|
1364
|
-
cwd: options.cwd,
|
|
1365
|
-
env: options.env,
|
|
1366
|
-
}),
|
|
1367
|
-
readPluginConfigStore({
|
|
1368
|
-
sourceId: options.plugin.sourceId,
|
|
1369
|
-
sourceIdentity: options.plugin.sourceIdentity,
|
|
1370
|
-
pluginName: options.plugin.manifest.name,
|
|
1371
|
-
scope: 'project',
|
|
1372
|
-
projectLayer: 'local',
|
|
1373
|
-
cwd: options.cwd,
|
|
1374
|
-
env: options.env,
|
|
1375
|
-
}),
|
|
1376
|
-
]);
|
|
1377
|
-
const userPlainEntries = getStoreEntries(userStore.values);
|
|
1378
|
-
const projectPlainEntries = getStoreEntries(projectStore.values);
|
|
1379
|
-
const localPlainEntries = getStoreEntries(projectLocalStore.values);
|
|
1380
1270
|
const effective = await resolveEffectivePluginConfig({
|
|
1381
1271
|
sourceId: options.plugin.sourceId,
|
|
1382
1272
|
sourceIdentity: options.plugin.sourceIdentity,
|
|
1383
|
-
|
|
1273
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
1384
1274
|
manifest: options.plugin.manifest,
|
|
1275
|
+
platform: options.platform,
|
|
1276
|
+
targetScope: options.context ?? (options.scope === 'project' ? 'project' : 'user'),
|
|
1385
1277
|
cwd: options.cwd,
|
|
1386
1278
|
env: options.env,
|
|
1387
1279
|
});
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
const
|
|
1391
|
-
const
|
|
1392
|
-
|
|
1393
|
-
|
|
1280
|
+
const stored = pluginConfigStoreForProfile(effective.stores.user, options.platform).values;
|
|
1281
|
+
const fields = await Promise.all(Object.entries(effective.schema).map(async ([key, field]) => {
|
|
1282
|
+
const state = effective.fieldStates[key];
|
|
1283
|
+
const source = effective.sources[key] ?? 'missing';
|
|
1284
|
+
const issues = effective.issues.filter((issue) => issue.key === key);
|
|
1285
|
+
const hasStored = Object.hasOwn(stored, key);
|
|
1286
|
+
const storedSourceLayer = options.platform ? 'platform' : 'common';
|
|
1287
|
+
let fallback;
|
|
1288
|
+
if (hasStored) {
|
|
1289
|
+
const inherited = { ...stored };
|
|
1290
|
+
delete inherited[key];
|
|
1291
|
+
const withoutOverride = await resolveEffectivePluginConfigFromStores({
|
|
1292
|
+
manifest: options.plugin.manifest,
|
|
1293
|
+
platform: options.platform,
|
|
1294
|
+
projectRoot: effective.projectRoot,
|
|
1295
|
+
stores: { user: replacePluginConfigStoreLayer(effective.stores.user, inherited, options.platform) },
|
|
1296
|
+
referenceContext: effective.referenceContext,
|
|
1297
|
+
});
|
|
1298
|
+
const fallbackIssues = withoutOverride.issues.filter((issue) => issue.key === key);
|
|
1299
|
+
const fallbackSource = withoutOverride.sources[key];
|
|
1300
|
+
fallback = fallbackSource === 'missing' || fallbackSource === undefined
|
|
1301
|
+
? { state: 'missing' }
|
|
1302
|
+
: fallbackIssues.length
|
|
1303
|
+
? { state: 'invalid', sourceLayer: fallbackSource, issues: fallbackIssues }
|
|
1304
|
+
: { state: 'valid', sourceLayer: fallbackSource, effectiveValue: withoutOverride.redactedValues[key] };
|
|
1394
1305
|
}
|
|
1395
|
-
const issue = effective.issues.find((entry) => entry.key === key && entry.source === source);
|
|
1396
1306
|
return {
|
|
1397
|
-
valueState: issue ? 'invalid' : source === 'default' ? 'default' : 'configured',
|
|
1398
|
-
effectiveValue: issue
|
|
1399
|
-
? null
|
|
1400
|
-
: isPathTypeField(field) && effective.redactedValues[key] !== undefined
|
|
1401
|
-
? '[redacted]'
|
|
1402
|
-
: effective.redactedValues[key] ?? null,
|
|
1403
|
-
sourceLayer,
|
|
1404
|
-
};
|
|
1405
|
-
};
|
|
1406
|
-
const fields = [];
|
|
1407
|
-
for (const [key, field] of Object.entries(schema)) {
|
|
1408
|
-
const base = {
|
|
1409
1307
|
key,
|
|
1410
1308
|
title: field.title ?? key,
|
|
1411
1309
|
kind: 'manifest',
|
|
1412
1310
|
reserved: false,
|
|
1413
1311
|
writable: true,
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1312
|
+
canSet: true,
|
|
1313
|
+
canUnset: hasStored,
|
|
1314
|
+
valueState: issues.length ? 'invalid' : source === 'default' || source === 'missing' ? 'default' : 'configured',
|
|
1315
|
+
effectiveValue: effective.redactedValues[key] ?? null,
|
|
1316
|
+
sourceLayer: toConfigSourceLayer(source),
|
|
1317
|
+
...(hasStored ? { storedSourceLayer, ...(validateCorePluginConfigValue(field, stored[key], key).length
|
|
1318
|
+
? {} : { storedValue: redactValue(field, stored[key]) }) } : {}),
|
|
1319
|
+
...(state?.invalidOverride ? { invalidOverride: { sourceLayer: state.invalidOverride.source, issues: state.invalidOverride.issues } } : {}),
|
|
1320
|
+
...(fallback ? { fallback } : {}),
|
|
1321
|
+
...configFieldProjection({ field, value: effective.values[key], source, issues }),
|
|
1417
1322
|
};
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
value: userPlainEntries[key],
|
|
1425
|
-
projectRoot,
|
|
1426
|
-
});
|
|
1427
|
-
fields.push({
|
|
1428
|
-
...base,
|
|
1429
|
-
valueState: 'configured',
|
|
1430
|
-
effectiveValue: isPathTypeField(field) ? '[redacted]' : redactValue(field, value),
|
|
1431
|
-
sourceLayer: 'user',
|
|
1432
|
-
storedValue: isPathTypeField(field) ? '[redacted]' : redactValue(field, value),
|
|
1433
|
-
storedSourceLayer: 'user',
|
|
1434
|
-
});
|
|
1435
|
-
}
|
|
1436
|
-
catch {
|
|
1437
|
-
fields.push({
|
|
1438
|
-
...base,
|
|
1439
|
-
valueState: 'invalid',
|
|
1440
|
-
sourceLayer: 'user',
|
|
1441
|
-
storedSourceLayer: 'user',
|
|
1442
|
-
});
|
|
1443
|
-
}
|
|
1444
|
-
continue;
|
|
1445
|
-
}
|
|
1446
|
-
if (field.default !== undefined) {
|
|
1447
|
-
try {
|
|
1448
|
-
const value = await coercePluginConfigValue({
|
|
1449
|
-
key,
|
|
1450
|
-
field,
|
|
1451
|
-
value: field.default,
|
|
1452
|
-
projectRoot,
|
|
1453
|
-
});
|
|
1454
|
-
fields.push({
|
|
1455
|
-
...base,
|
|
1456
|
-
effectiveValue: isPathTypeField(field) ? '[redacted]' : redactValue(field, value),
|
|
1457
|
-
sourceLayer: 'default',
|
|
1458
|
-
});
|
|
1459
|
-
}
|
|
1460
|
-
catch {
|
|
1461
|
-
fields.push({
|
|
1462
|
-
...base,
|
|
1463
|
-
valueState: 'invalid',
|
|
1464
|
-
sourceLayer: 'default',
|
|
1465
|
-
});
|
|
1466
|
-
}
|
|
1467
|
-
continue;
|
|
1468
|
-
}
|
|
1469
|
-
fields.push(base);
|
|
1470
|
-
continue;
|
|
1471
|
-
}
|
|
1472
|
-
if (options.projectLayer === 'local') {
|
|
1473
|
-
if (Object.hasOwn(localPlainEntries, key)) {
|
|
1474
|
-
try {
|
|
1475
|
-
const value = await coercePluginConfigValue({
|
|
1476
|
-
key,
|
|
1477
|
-
field,
|
|
1478
|
-
value: localPlainEntries[key],
|
|
1479
|
-
projectRoot,
|
|
1480
|
-
});
|
|
1481
|
-
fields.push({
|
|
1482
|
-
...base,
|
|
1483
|
-
valueState: 'configured',
|
|
1484
|
-
effectiveValue: isPathTypeField(field) ? '[redacted]' : redactValue(field, value),
|
|
1485
|
-
sourceLayer: 'local',
|
|
1486
|
-
storedValue: isPathTypeField(field) ? '[redacted]' : redactValue(field, value),
|
|
1487
|
-
storedSourceLayer: 'local',
|
|
1488
|
-
});
|
|
1489
|
-
}
|
|
1490
|
-
catch {
|
|
1491
|
-
fields.push({
|
|
1492
|
-
...base,
|
|
1493
|
-
valueState: 'invalid',
|
|
1494
|
-
sourceLayer: 'local',
|
|
1495
|
-
storedSourceLayer: 'local',
|
|
1496
|
-
});
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
else {
|
|
1500
|
-
fields.push(base);
|
|
1501
|
-
}
|
|
1502
|
-
continue;
|
|
1503
|
-
}
|
|
1504
|
-
let storedProjectValue;
|
|
1505
|
-
if (options.scope === 'project' && Object.hasOwn(projectPlainEntries, key)) {
|
|
1506
|
-
try {
|
|
1507
|
-
const value = await coercePluginConfigValue({
|
|
1508
|
-
key,
|
|
1509
|
-
field,
|
|
1510
|
-
value: projectPlainEntries[key],
|
|
1511
|
-
projectRoot,
|
|
1512
|
-
});
|
|
1513
|
-
storedProjectValue = {
|
|
1514
|
-
storedValue: isPathTypeField(field) ? '[redacted]' : redactValue(field, value),
|
|
1515
|
-
storedSourceLayer: 'project',
|
|
1516
|
-
};
|
|
1517
|
-
}
|
|
1518
|
-
catch {
|
|
1519
|
-
storedProjectValue = { storedSourceLayer: 'project' };
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
fields.push({ ...base, ...effectiveFieldState(key), ...storedProjectValue });
|
|
1323
|
+
}));
|
|
1324
|
+
for (const key of Object.keys(stored).filter((key) => !Object.hasOwn(effective.schema, key)).sort()) {
|
|
1325
|
+
const source = options.platform ? 'platform' : 'common';
|
|
1326
|
+
fields.push({ key, title: key, kind: 'manifest', reserved: false, writable: false, canSet: false, canUnset: true,
|
|
1327
|
+
valueState: 'configured', effectiveValue: '[redacted]', sourceLayer: source, storedSourceLayer: source,
|
|
1328
|
+
value: '[redacted]', source, matchedPreset: null, valid: false, issues: [] });
|
|
1523
1329
|
}
|
|
1524
1330
|
return fields;
|
|
1525
1331
|
}
|
|
1526
1332
|
async function buildLegacyStoreFieldEntries(options) {
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
]
|
|
1533
|
-
: [{
|
|
1534
|
-
scope: options.scope,
|
|
1535
|
-
projectLayer: options.projectLayer,
|
|
1536
|
-
sourceLayer: options.scope === 'user'
|
|
1537
|
-
? 'user'
|
|
1538
|
-
: options.projectLayer === 'local' ? 'local' : 'project',
|
|
1539
|
-
}];
|
|
1540
|
-
const fields = new Map();
|
|
1541
|
-
for (const location of locations) {
|
|
1542
|
-
const store = await readPluginConfigStore({
|
|
1543
|
-
sourceId: options.sourceId,
|
|
1544
|
-
sourceIdentity: options.sourceIdentity,
|
|
1545
|
-
pluginName: options.pluginName,
|
|
1546
|
-
scope: location.scope,
|
|
1547
|
-
...(location.scope === 'project' ? { projectLayer: location.projectLayer } : {}),
|
|
1548
|
-
cwd: options.cwd,
|
|
1549
|
-
env: options.env,
|
|
1550
|
-
});
|
|
1551
|
-
for (const key of Object.keys(store.values)) {
|
|
1552
|
-
fields.set(key, {
|
|
1553
|
-
key,
|
|
1554
|
-
title: key,
|
|
1555
|
-
kind: 'manifest',
|
|
1556
|
-
reserved: false,
|
|
1557
|
-
writable: false,
|
|
1558
|
-
valueState: 'configured',
|
|
1559
|
-
effectiveValue: '[redacted]',
|
|
1560
|
-
sourceLayer: location.sourceLayer,
|
|
1561
|
-
});
|
|
1562
|
-
}
|
|
1563
|
-
}
|
|
1564
|
-
return [...fields.values()].sort((left, right) => left.key.localeCompare(right.key));
|
|
1333
|
+
const store = await readPluginConfigStore({ ...options, scope: 'user' });
|
|
1334
|
+
const source = options.platform ? 'platform' : 'common';
|
|
1335
|
+
return Object.keys(store.values).sort().map((key) => ({ key, title: key, kind: 'manifest', reserved: false,
|
|
1336
|
+
writable: false, canSet: false, canUnset: true, valueState: 'configured', effectiveValue: '[redacted]',
|
|
1337
|
+
sourceLayer: source, value: '[redacted]', source, matchedPreset: null, valid: true, issues: [] }));
|
|
1565
1338
|
}
|
|
1566
1339
|
export async function resolvePluginConfigSchemaAccess(options) {
|
|
1567
1340
|
const pluginName = assertSafePluginConfigSegment(options.pluginName);
|
|
@@ -1577,42 +1350,50 @@ export async function resolvePluginConfigSchemaAccess(options) {
|
|
|
1577
1350
|
return {
|
|
1578
1351
|
pluginName,
|
|
1579
1352
|
plugin: options.currentPlugin,
|
|
1580
|
-
schema: createConfigSchemaEvidenceFromCurrentCatalog(options.currentPlugin, await calculateConfigSchemaManifestDigestForPlugin(options.currentPlugin)),
|
|
1353
|
+
schema: createConfigSchemaEvidenceFromCurrentCatalog(options.currentPlugin, await calculateConfigSchemaManifestDigestForPlugin(options.currentPlugin), options.platform),
|
|
1581
1354
|
};
|
|
1582
1355
|
}
|
|
1583
1356
|
export async function resolveConfigRead(options) {
|
|
1357
|
+
if (options.context)
|
|
1358
|
+
await resolveWorkContext({ cwd: options.cwd, context: options.context });
|
|
1584
1359
|
const pluginName = assertSafePluginConfigSegment(options.pluginName);
|
|
1585
1360
|
const schemaAccess = await resolvePluginConfigSchemaAccess({
|
|
1586
1361
|
pluginName,
|
|
1587
1362
|
currentPlugin: options.plugin,
|
|
1588
1363
|
currentPluginError: options.pluginError,
|
|
1364
|
+
platform: options.platform,
|
|
1589
1365
|
scope: options.scope,
|
|
1590
|
-
projectLayer: options.projectLayer,
|
|
1591
1366
|
cwd: options.cwd,
|
|
1592
1367
|
env: options.env,
|
|
1593
1368
|
});
|
|
1594
|
-
const manifestFields = schemaAccess.plugin
|
|
1369
|
+
const manifestFields = options.schemaOnly ? [] : schemaAccess.plugin?.manifest.config
|
|
1595
1370
|
? await buildManifestFieldEntries({
|
|
1596
1371
|
plugin: schemaAccess.plugin,
|
|
1372
|
+
context: options.context,
|
|
1373
|
+
platform: options.platform,
|
|
1597
1374
|
scope: options.scope,
|
|
1598
|
-
projectLayer: options.projectLayer,
|
|
1599
1375
|
cwd: options.cwd,
|
|
1600
1376
|
env: options.env,
|
|
1601
1377
|
})
|
|
1602
1378
|
: await buildLegacyStoreFieldEntries({
|
|
1603
|
-
sourceId: options.sourceId,
|
|
1604
|
-
sourceIdentity: options.sourceIdentity,
|
|
1379
|
+
sourceId: schemaAccess.plugin?.sourceId ?? options.sourceId,
|
|
1380
|
+
sourceIdentity: schemaAccess.plugin?.sourceIdentity ?? options.sourceIdentity,
|
|
1381
|
+
logicalIdentity: schemaAccess.plugin?.catalogLogicalIdentity ?? options.logicalIdentity,
|
|
1605
1382
|
pluginName,
|
|
1606
1383
|
scope: options.scope,
|
|
1607
|
-
|
|
1384
|
+
platform: options.platform,
|
|
1608
1385
|
cwd: options.cwd,
|
|
1609
1386
|
env: options.env,
|
|
1610
1387
|
});
|
|
1611
1388
|
return {
|
|
1612
1389
|
pluginName,
|
|
1390
|
+
platform: options.platform,
|
|
1391
|
+
context: options.context ?? 'user',
|
|
1613
1392
|
scope: options.scope,
|
|
1614
|
-
projectLayer: options.projectLayer,
|
|
1615
1393
|
...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
|
|
1394
|
+
...(schemaAccess.plugin?.manifest.config?.fields
|
|
1395
|
+
? { fieldDefinitions: selectPluginConfigProfile(schemaAccess.plugin.manifest.config, options.platform).fields }
|
|
1396
|
+
: {}),
|
|
1616
1397
|
fields: manifestFields,
|
|
1617
1398
|
};
|
|
1618
1399
|
}
|
|
@@ -1626,67 +1407,100 @@ export function summarizeEffectivePluginConfig(config) {
|
|
|
1626
1407
|
return {
|
|
1627
1408
|
values: config.redactedValues,
|
|
1628
1409
|
sources: config.sources,
|
|
1410
|
+
fieldStates: Object.fromEntries(Object.entries(config.fieldStates).map(([key, state]) => [key, {
|
|
1411
|
+
...(state.effective ? {
|
|
1412
|
+
effective: { value: state.effective.redactedValue, source: state.effective.source },
|
|
1413
|
+
} : {}),
|
|
1414
|
+
...(state.invalidOverride ? { invalidOverride: state.invalidOverride } : {}),
|
|
1415
|
+
...(state.fallback ? {
|
|
1416
|
+
fallback: { value: state.fallback.redactedValue, source: state.fallback.source },
|
|
1417
|
+
} : {}),
|
|
1418
|
+
}])),
|
|
1629
1419
|
issues: config.issues,
|
|
1630
1420
|
ignoredUnknownKeys: config.ignoredUnknownKeys,
|
|
1631
1421
|
};
|
|
1632
1422
|
}
|
|
1633
|
-
export function createPluginConfigSchemaIdentity(manifest) {
|
|
1423
|
+
export function createPluginConfigSchemaIdentity(manifest, platform) {
|
|
1634
1424
|
const hash = crypto
|
|
1635
1425
|
.createHash('sha256')
|
|
1636
1426
|
.update(JSON.stringify({
|
|
1637
1427
|
name: manifest.name,
|
|
1638
1428
|
version: manifest.version,
|
|
1639
|
-
|
|
1429
|
+
platform: platform ?? null,
|
|
1430
|
+
config: manifest.config ? selectPluginConfigProfile(manifest.config, platform) : null,
|
|
1640
1431
|
}))
|
|
1641
1432
|
.digest('hex');
|
|
1642
1433
|
return `${manifest.name}:${hash}`;
|
|
1643
1434
|
}
|
|
1435
|
+
function cliConfigPromptEnumValues(field) {
|
|
1436
|
+
if (!field.choices)
|
|
1437
|
+
return undefined;
|
|
1438
|
+
const values = field.choices.presets
|
|
1439
|
+
.map((preset) => preset.value);
|
|
1440
|
+
if (field.type !== 'boolean') {
|
|
1441
|
+
return field.choices.allowCustom ? undefined : values;
|
|
1442
|
+
}
|
|
1443
|
+
if (field.choices.allowCustom) {
|
|
1444
|
+
for (const value of [true, false]) {
|
|
1445
|
+
if (!values.includes(value))
|
|
1446
|
+
values.push(value);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
return values;
|
|
1450
|
+
}
|
|
1644
1451
|
export function toCliConfigPromptSchema(schema) {
|
|
1645
1452
|
const promptSchema = {};
|
|
1646
1453
|
for (const [key, field] of Object.entries(schema)) {
|
|
1454
|
+
if (field.type === 'object' || field.type === 'array')
|
|
1455
|
+
continue;
|
|
1647
1456
|
promptSchema[key] = {
|
|
1648
|
-
type: field.type
|
|
1457
|
+
type: field.type,
|
|
1649
1458
|
label: field.title ?? key,
|
|
1650
1459
|
description: field.description,
|
|
1651
1460
|
required: field.required,
|
|
1652
1461
|
sensitive: field.sensitive,
|
|
1653
1462
|
default: field.default,
|
|
1654
|
-
enum: field
|
|
1655
|
-
min: field.
|
|
1656
|
-
max: field.
|
|
1463
|
+
enum: cliConfigPromptEnumValues(field),
|
|
1464
|
+
min: field.type === 'number' ? field.validation?.minimum : undefined,
|
|
1465
|
+
max: field.type === 'number' ? field.validation?.maximum : undefined,
|
|
1657
1466
|
};
|
|
1658
1467
|
}
|
|
1659
1468
|
return promptSchema;
|
|
1660
1469
|
}
|
|
1661
1470
|
export function createPluginConfigFormModel(options) {
|
|
1662
|
-
const schema = options.
|
|
1471
|
+
const schema = options.effective.schema;
|
|
1663
1472
|
if (!schema) {
|
|
1664
|
-
throw new
|
|
1473
|
+
throw new PluginConfigSchemaResolutionError('configSchemaUnavailable', `Plugin "${options.pluginName ?? options.manifest.name}" does not declare an AW config schema.`);
|
|
1665
1474
|
}
|
|
1666
1475
|
const requiredKeys = [...new Set(options.effective.issues
|
|
1667
1476
|
.filter((issue) => issue.type === 'missing-required' || issue.type === 'invalid-config')
|
|
1668
1477
|
.map((issue) => issue.key))];
|
|
1478
|
+
const fields = Object.entries(schema).flatMap(([key, field]) => {
|
|
1479
|
+
if (field.type === 'object' || field.type === 'array')
|
|
1480
|
+
return [];
|
|
1481
|
+
return [{
|
|
1482
|
+
key,
|
|
1483
|
+
type: field.type,
|
|
1484
|
+
label: field.title ?? key,
|
|
1485
|
+
description: field.description,
|
|
1486
|
+
required: field.required === true,
|
|
1487
|
+
sensitive: field.sensitive === true,
|
|
1488
|
+
defaultValue: field.default,
|
|
1489
|
+
enumValues: cliConfigPromptEnumValues(field),
|
|
1490
|
+
min: field.type === 'number' ? field.validation?.minimum : undefined,
|
|
1491
|
+
max: field.type === 'number' ? field.validation?.maximum : undefined,
|
|
1492
|
+
configured: options.effective.values[key] !== undefined,
|
|
1493
|
+
currentValue: field.sensitive
|
|
1494
|
+
? undefined
|
|
1495
|
+
: options.effective.values[key],
|
|
1496
|
+
}];
|
|
1497
|
+
});
|
|
1669
1498
|
return {
|
|
1670
1499
|
pluginName: options.pluginName ?? options.manifest.name,
|
|
1671
|
-
allowedScopes:
|
|
1672
|
-
initialScope:
|
|
1500
|
+
allowedScopes: ['user'],
|
|
1501
|
+
initialScope: 'user',
|
|
1673
1502
|
requiredKeys,
|
|
1674
|
-
fields
|
|
1675
|
-
key,
|
|
1676
|
-
type: field.type,
|
|
1677
|
-
label: field.title ?? key,
|
|
1678
|
-
description: field.description,
|
|
1679
|
-
required: field.required === true,
|
|
1680
|
-
sensitive: field.sensitive === true,
|
|
1681
|
-
defaultValue: field.default,
|
|
1682
|
-
enumValues: field.type === 'enum' ? field.values : undefined,
|
|
1683
|
-
min: field.min,
|
|
1684
|
-
max: field.max,
|
|
1685
|
-
configured: options.effective.values[key] !== undefined,
|
|
1686
|
-
currentValue: field.sensitive || isPathTypeField(field)
|
|
1687
|
-
? undefined
|
|
1688
|
-
: options.effective.values[key],
|
|
1689
|
-
})),
|
|
1503
|
+
fields,
|
|
1690
1504
|
};
|
|
1691
1505
|
}
|
|
1692
1506
|
export function toCliConfigPromptOptions(model) {
|
|
@@ -1705,7 +1519,7 @@ export function toCliConfigPromptOptions(model) {
|
|
|
1705
1519
|
schema: Object.fromEntries(model.fields.map((field) => [
|
|
1706
1520
|
field.key,
|
|
1707
1521
|
{
|
|
1708
|
-
type: field.type
|
|
1522
|
+
type: field.type,
|
|
1709
1523
|
label: field.label,
|
|
1710
1524
|
description: field.description,
|
|
1711
1525
|
required: field.required,
|
|
@@ -1723,13 +1537,17 @@ export function toCliConfigPromptOptions(model) {
|
|
|
1723
1537
|
requiredKeys: [...model.requiredKeys],
|
|
1724
1538
|
};
|
|
1725
1539
|
}
|
|
1726
|
-
function
|
|
1540
|
+
export function formatPluginConfigSetRecoveryCommand(pluginName, key, field, context, platform) {
|
|
1541
|
+
const command = `aw plugin config set ${pluginName} ${key} --context ${context}`
|
|
1542
|
+
+ (platform ? ` --platform ${platform}` : '');
|
|
1543
|
+
return field.sensitive === true ? `${command} --value-stdin` : `${command} --value-json '<json>'`;
|
|
1544
|
+
}
|
|
1545
|
+
function formatRequiredConfigSetCommands(pluginName, issues, context, schema, platform) {
|
|
1727
1546
|
const commands = new Set();
|
|
1728
1547
|
for (const issue of issues) {
|
|
1729
|
-
const
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
commands.add(`aw config set ${pluginName} ${issue.key} <value> -s ${scope}`);
|
|
1548
|
+
const field = schema[issue.key];
|
|
1549
|
+
if (field)
|
|
1550
|
+
commands.add(formatPluginConfigSetRecoveryCommand(pluginName, issue.key, field, context, platform));
|
|
1733
1551
|
}
|
|
1734
1552
|
return [...commands].map((command) => `\`${command}\``).join(' 或 ');
|
|
1735
1553
|
}
|
|
@@ -1742,21 +1560,23 @@ export async function preflightRequiredPluginConfigs(options) {
|
|
|
1742
1560
|
};
|
|
1743
1561
|
for (const target of options.targets) {
|
|
1744
1562
|
const pluginName = target.pluginName ?? target.manifest.name;
|
|
1745
|
-
const identity = target.schemaSourceIdentity ?? createPluginConfigSchemaIdentity(target.manifest);
|
|
1746
|
-
const dedupeKey = `${pluginName}\0${identity}`;
|
|
1563
|
+
const identity = target.schemaSourceIdentity ?? createPluginConfigSchemaIdentity(target.manifest, target.platform);
|
|
1564
|
+
const dedupeKey = `${pluginName}\0${target.platform ?? 'common'}\0${identity}`;
|
|
1747
1565
|
if (visited.has(dedupeKey)) {
|
|
1748
1566
|
continue;
|
|
1749
1567
|
}
|
|
1750
1568
|
visited.add(dedupeKey);
|
|
1751
1569
|
result.checked += 1;
|
|
1752
|
-
if (!target.manifest.config?.
|
|
1570
|
+
if (!target.manifest.config?.fields) {
|
|
1753
1571
|
continue;
|
|
1754
1572
|
}
|
|
1755
|
-
|
|
1573
|
+
const effective = await resolveEffectivePluginConfig({
|
|
1756
1574
|
sourceId: target.sourceId,
|
|
1757
1575
|
sourceIdentity: target.sourceIdentity,
|
|
1576
|
+
logicalIdentity: target.logicalIdentity,
|
|
1758
1577
|
pluginName,
|
|
1759
1578
|
manifest: target.manifest,
|
|
1579
|
+
platform: target.platform,
|
|
1760
1580
|
cwd: options.cwd,
|
|
1761
1581
|
env: options.context.env,
|
|
1762
1582
|
});
|
|
@@ -1765,7 +1585,7 @@ export async function preflightRequiredPluginConfigs(options) {
|
|
|
1765
1585
|
continue;
|
|
1766
1586
|
}
|
|
1767
1587
|
const details = blockingIssues.map((issue) => issue.key).join(', ');
|
|
1768
|
-
const setCommands = formatRequiredConfigSetCommands(pluginName, blockingIssues, options.defaultScope);
|
|
1588
|
+
const setCommands = formatRequiredConfigSetCommands(target.sourceId ? `${target.sourceId}/${pluginName}` : pluginName, blockingIssues, options.defaultScope, effective.schema, target.platform);
|
|
1769
1589
|
throw new Error(`${pluginName} requires valid AW config before install/upgrade: ${details}. ` +
|
|
1770
1590
|
`Run ${setCommands}, or open \`aw\` to complete setup.`);
|
|
1771
1591
|
}
|