@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
|
@@ -0,0 +1,1558 @@
|
|
|
1
|
+
import { describeNativeToolClosure } from '../utils/native-tool-review.js';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { isDeliveryCapabilityGap } from '../utils/component-gap.js';
|
|
4
|
+
import { CatalogSourceInventoryIncompleteError } from '../utils/catalog-source-references.js';
|
|
5
|
+
import { inventoryRecoveryDiagnostic } from '../utils/inventory-recovery-diagnostic.js';
|
|
6
|
+
import { commandPackageProviderSatisfied } from '../commands/lifecycle-command-package.js';
|
|
7
|
+
import { runRebuildCommand } from '../commands/rebuild-command.js';
|
|
8
|
+
import { buildRebuildReceiptJson } from '../output/command-receipt.js';
|
|
9
|
+
import { withAwHomeMutationLock } from '../utils/aw-home-mutation-lock.js';
|
|
10
|
+
import { createCodexNativeObservationSession } from '../utils/codex-native-observation.js';
|
|
11
|
+
import { bindNativeCliRunnerSignal, getDefaultNativeCliRunner, prepareNativeCliExecution } from '../utils/native-cli.js';
|
|
12
|
+
import { portableRecoveryLayout } from '../portable/recovery-layout.js';
|
|
13
|
+
import { canonicalizePathThroughExistingAncestor, resolveClaudeProjectKey, resolveCodexProjectKey } from '../utils/state-paths.js';
|
|
14
|
+
import { parsePluginId } from '../utils/multi-source-catalog.js';
|
|
15
|
+
import { CatalogPreparationReadScope, selectCatalogOperationContext } from '../utils/catalog-operation-context.js';
|
|
16
|
+
import { CatalogGenerationError } from '../utils/catalog-generation-error.js';
|
|
17
|
+
import { createCatalogPreparationStoreKey } from '../utils/catalog-generation-resolver.js';
|
|
18
|
+
import { activateCatalogSourceGeneration, probeCatalogSourceGeneration, } from '../utils/catalog-generation-service.js';
|
|
19
|
+
import { readCatalogGenerationState } from '../utils/catalog-generation-state.js';
|
|
20
|
+
import { readCatalogSourcesConfigSnapshot } from '../utils/catalog-sources.js';
|
|
21
|
+
import { calculateCatalogSourceImpactDigest, inspectCatalogSourceImpact, } from '../utils/catalog-source-impact.js';
|
|
22
|
+
import { preparePortableRecovery, portablePreparationDiagnostic, portableReviewMatches, unobservedPortableTarget, preparePortableCleanup, inspectPortableRecovery, inspectPortableResidue, executePortableRecovery, PortableInterruptedError, } from '../portable/recovery.js';
|
|
23
|
+
import { addRequirements } from '../commands/intent-command.js';
|
|
24
|
+
import { readDemand, demandNativeProjection, resolveDelivery } from './demand.js';
|
|
25
|
+
import { selectAgents, writePreferences } from '../intent/deployment-preferences.js';
|
|
26
|
+
import { calculateIntentDigest } from '../intent/intent-codec.js';
|
|
27
|
+
import { observeIntent } from '../intent/intent-store.js';
|
|
28
|
+
import { assertNeutralAncestorChain, createScopeContext } from '../intent/scope-context.js';
|
|
29
|
+
import { retainedOutputDiagnostic, scopeNativeComponentGaps, uniqueRecoveryComponentGaps } from './receipt.js';
|
|
30
|
+
import { prepareJointRecovery, executeJointRecovery } from './joint-coordinator.js';
|
|
31
|
+
import { createEmptyNativeDemandView } from '../utils/native-demand.js';
|
|
32
|
+
import { resolvePluginMetaDependencyClosure } from '../utils/plugin-dependencies.js';
|
|
33
|
+
import { runPreApplyScript } from '../utils/plugin-scripts.js';
|
|
34
|
+
import { readSafeOperationError } from '../utils/safe-operation-diagnostic.js';
|
|
35
|
+
import { RebuildInterruptedError, RecoveryInterruptedError, recoveryInterruptionCode } from './interruption.js';
|
|
36
|
+
import { mapInstallReads } from './install-concurrency.js';
|
|
37
|
+
import { measureRecoveryPerformanceStage } from './performance.js';
|
|
38
|
+
import { disposePreparedPlatformRebuildSession } from '../commands/rebuild-integration.js';
|
|
39
|
+
import { operationPlanNativeToolChanges } from '../commands/operation-plan.js';
|
|
40
|
+
function isPortableAgent(agent) {
|
|
41
|
+
return agent === 'generic';
|
|
42
|
+
}
|
|
43
|
+
function diagnostic(code) {
|
|
44
|
+
const messages = {
|
|
45
|
+
nativeToolAuthorizationRequired: '原生工具声明有变化,请使用 --yes 或确认当前 Review 后执行。',
|
|
46
|
+
localTargetsRequired: '已有需求,请先设置本机 Agent。',
|
|
47
|
+
deliveryUnsupported: '此插件没有适用于所选 Agent 的交付。',
|
|
48
|
+
operationReviewStale: '确认依据已改变,请重新检查并确认。',
|
|
49
|
+
syncPluginNotDesired: '所选插件尚未声明,请先运行 aw plugin install --only requirements。',
|
|
50
|
+
syncSelectionRequired: '请指定插件或使用 --all。',
|
|
51
|
+
invalidExactTargets: '精确重试目标不属于当前请求,请重新检查并选择。',
|
|
52
|
+
sourceRefreshFailed: '来源刷新失败,此来源的插件未恢复。',
|
|
53
|
+
sourceRefreshConfirmationRequired: '来源更新必须先单独确认,再重新准备插件恢复。',
|
|
54
|
+
artifactCollision: '多个交付占用相同输出位置,请先处理冲突。',
|
|
55
|
+
deliverySwitchCleanupRequired: '此目标仍有旧 Native 输出;请先清理旧交付,再恢复 Portable。',
|
|
56
|
+
deliverySwitchObservationFailed: '无法确认此目标是否仍有旧 Native 输出;请先恢复 Native 观察能力或人工核验。',
|
|
57
|
+
deliverySwitchPortableCleanupRequired: '此目标仍有旧 Portable 输出;请先核验并移开旧交付,再恢复 Native。',
|
|
58
|
+
deliverySwitchPortableObservationFailed: '无法确认此目标是否仍有旧 Portable 输出;请先核验 Portable 现场。',
|
|
59
|
+
'backend-action-unsupported': '此后端尚不支持安全移除,请检查精确的 Portable 输出。',
|
|
60
|
+
};
|
|
61
|
+
return { code, message: messages[code] ?? `操作受阻:${code}。` };
|
|
62
|
+
}
|
|
63
|
+
export function errorCode(error, fallback) {
|
|
64
|
+
const code = error?.code;
|
|
65
|
+
if (typeof code === 'string' && /^[A-Za-z][A-Za-z0-9-]*$/u.test(code))
|
|
66
|
+
return code;
|
|
67
|
+
const prefix = error instanceof Error ? error.message.split(':')[0] : '';
|
|
68
|
+
return /^[A-Za-z][A-Za-z0-9-]*$/u.test(prefix ?? '') ? prefix : fallback;
|
|
69
|
+
}
|
|
70
|
+
function intentEvidence(intent) {
|
|
71
|
+
return 'rawDigest' in intent ? `${intent.state}:${intent.rawDigest}` : intent.state;
|
|
72
|
+
}
|
|
73
|
+
function preferenceEvidence(demand) {
|
|
74
|
+
return 'rawDigest' in demand.preferences
|
|
75
|
+
? `${demand.preferences.state}:${demand.preferences.rawDigest}` : demand.preferences.state;
|
|
76
|
+
}
|
|
77
|
+
function agentForPlatform(platform) {
|
|
78
|
+
return platform;
|
|
79
|
+
}
|
|
80
|
+
function pair(plan, pluginId, agent) {
|
|
81
|
+
return plan.receipt.targetResults.find((target) => target.pluginId === pluginId && target.agent === agent);
|
|
82
|
+
}
|
|
83
|
+
function block(target, code, detail = diagnostic(code)) {
|
|
84
|
+
if (!target.blockers.some((entry) => entry.code === code))
|
|
85
|
+
target.blockers.push(detail);
|
|
86
|
+
}
|
|
87
|
+
function completeReceipt(receipt) {
|
|
88
|
+
receipt.requestedTargets = receipt.targetResults.map(({ pluginId, agent, scope, delivery }) => ({ pluginId, agent, scope, delivery }));
|
|
89
|
+
receipt.remainingTargets = receipt.targetResults.filter((target) => target.blockers.length > 0
|
|
90
|
+
|| !['applied', 'no-op'].includes(target.execution))
|
|
91
|
+
.map(({ pluginId, agent, scope, delivery }) => ({ pluginId, agent, scope, delivery }));
|
|
92
|
+
receipt.ok = receipt.blockers.length === 0 && receipt.remainingTargets.length === 0
|
|
93
|
+
&& (receipt.commandResults ?? []).every((result) => result.state === 'completed');
|
|
94
|
+
receipt.errors = [...receipt.blockers];
|
|
95
|
+
receipt.recoveryActions = [...new Set([
|
|
96
|
+
...(receipt.commandResults ?? []).flatMap((result) => result.recoveryActions),
|
|
97
|
+
...receipt.blockers.map((entry) => entry.code === 'localTargetsRequired'
|
|
98
|
+
? `aw target set <target...>` : `aw plugin status --context ${receipt.scope} --json`),
|
|
99
|
+
...receipt.remainingTargets.flatMap((target) => {
|
|
100
|
+
const result = receipt.targetResults.find((entry) => entry.pluginId === target.pluginId && entry.agent === target.agent);
|
|
101
|
+
if (result?.recoveryActions?.length)
|
|
102
|
+
return result.recoveryActions;
|
|
103
|
+
return result?.blockers.some((entry) => entry.code === 'backend-action-unsupported' || entry.code === 'portableObservationFailed')
|
|
104
|
+
? `检查 ${target.pluginId} 的 Portable 输出及 provider 关联;AW 不支持安全自动删除。`
|
|
105
|
+
: `aw plugin sync ${target.pluginId} --context ${receipt.scope} --target ${target.agent}`;
|
|
106
|
+
}),
|
|
107
|
+
])];
|
|
108
|
+
return receipt;
|
|
109
|
+
}
|
|
110
|
+
function displayPortablePath(plan, physicalPath) {
|
|
111
|
+
if (plan.options.scope === 'user' || !plan.context.projectRoot)
|
|
112
|
+
return physicalPath;
|
|
113
|
+
const relative = path.relative(plan.context.projectRoot, physicalPath);
|
|
114
|
+
return relative && relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative)
|
|
115
|
+
? `项目根目录/${relative.split(path.sep).join('/')}` : physicalPath;
|
|
116
|
+
}
|
|
117
|
+
function portableRecoveryActions(plan, pluginId, targets) {
|
|
118
|
+
return [...new Set(targets.map((target) => {
|
|
119
|
+
const directory = displayPortablePath(plan, target.physicalPath);
|
|
120
|
+
const shared = target.agent === 'generic' || target.agent === 'antigravity'
|
|
121
|
+
? '该目录可能同时被 Codex 和 Cursor 读取;移开前请确认对两者的影响。' : `该目录供 ${target.agent} 使用。`;
|
|
122
|
+
return `${pluginId}:请检查并备份目录 ${directory};确认归属后可自行移开。${shared}`
|
|
123
|
+
+ (plan.command === 'cleanup' || plan.command === 'uninstall'
|
|
124
|
+
? '无法证实该目录的安全删除边界;处理后重新检查状态。'
|
|
125
|
+
: `然后重试 aw plugin sync ${pluginId} --context ${plan.options.scope} --target ${target.agent}。`);
|
|
126
|
+
}))];
|
|
127
|
+
}
|
|
128
|
+
function selectRoots(demand, selectors, all) {
|
|
129
|
+
const roots = demand.roots?.map((root) => root.pluginId) ?? [];
|
|
130
|
+
if (all && selectors.length)
|
|
131
|
+
throw new Error('syncSelectorConflict');
|
|
132
|
+
if (all)
|
|
133
|
+
return roots;
|
|
134
|
+
if (!selectors.length)
|
|
135
|
+
return roots;
|
|
136
|
+
return [...new Set(selectors.map((selector) => {
|
|
137
|
+
const parsed = parsePluginId(selector);
|
|
138
|
+
const matches = roots.filter((id) => parsed.sourceId ? id === selector
|
|
139
|
+
: parsePluginId(id).pluginName === parsed.pluginName);
|
|
140
|
+
if (matches.length !== 1)
|
|
141
|
+
throw new Error('syncPluginNotDesired');
|
|
142
|
+
return matches[0];
|
|
143
|
+
}))];
|
|
144
|
+
}
|
|
145
|
+
function nativeGroupTargets(group) {
|
|
146
|
+
return group.targets ?? group.pluginIds.flatMap((pluginId) => (group.platform === 'both' ? ['codex', 'claude'] : [group.platform])
|
|
147
|
+
.map((platform) => ({ pluginId, platform })));
|
|
148
|
+
}
|
|
149
|
+
function nativeTargetSelection(targets) {
|
|
150
|
+
const platforms = new Set(targets.map((target) => target.platform));
|
|
151
|
+
return { pluginIds: [...new Set(targets.map((target) => target.pluginId))],
|
|
152
|
+
platform: platforms.size === 1 ? targets[0].platform : 'both', targets: [...targets] };
|
|
153
|
+
}
|
|
154
|
+
// Rebuild accumulates one marketplace generation per platform across sources and scopes.
|
|
155
|
+
async function readNativeGroups(groups, read, signal) {
|
|
156
|
+
const lanes = new Map();
|
|
157
|
+
for (const group of groups) {
|
|
158
|
+
const key = group.command === 'install' || group.command === 'sync' ? group.platform : 'serial';
|
|
159
|
+
const lane = lanes.get(key) ?? [];
|
|
160
|
+
lane.push(group);
|
|
161
|
+
lanes.set(key, lane);
|
|
162
|
+
}
|
|
163
|
+
const results = new Map();
|
|
164
|
+
await mapInstallReads([...lanes.values()], async (lane) => {
|
|
165
|
+
for (const group of lane) {
|
|
166
|
+
signal?.throwIfAborted();
|
|
167
|
+
results.set(group, await read(group));
|
|
168
|
+
}
|
|
169
|
+
}, { signal });
|
|
170
|
+
return groups.map((group) => results.get(group));
|
|
171
|
+
}
|
|
172
|
+
async function nativeOperation(plan, pluginIds, platform, preview, runtime = plan.runtime, command = plan.command, selectedTargets, catalogReadScope) {
|
|
173
|
+
if (!runtime.awHomeMutationToken) {
|
|
174
|
+
await prepareNativeCliExecution({ env: plan.context.env, runner: runtime.nativeCliRunner });
|
|
175
|
+
}
|
|
176
|
+
const rebuildCommand = command === 'install' ? 'sync' : command;
|
|
177
|
+
const requirements = command === 'cleanup' && (plan.demand.intent.state !== 'valid'
|
|
178
|
+
|| plan.demand.preferences.state === 'invalid' || plan.demand.preferences.state === 'unreadable')
|
|
179
|
+
? createEmptyNativeDemandView() : demandNativeProjection(plan.demand);
|
|
180
|
+
if (plan.options.sharedReferenceView)
|
|
181
|
+
requirements.sharedReferenceView = plan.options.sharedReferenceView;
|
|
182
|
+
const result = await runRebuildCommand({
|
|
183
|
+
command: rebuildCommand,
|
|
184
|
+
pluginNames: pluginIds,
|
|
185
|
+
commandOptions: {
|
|
186
|
+
cwd: plan.context.executionCwd, scope: plan.options.scope, platform,
|
|
187
|
+
yes: plan.options.yes,
|
|
188
|
+
scriptTimeoutMs: plan.options.scriptTimeoutMs,
|
|
189
|
+
...(plan.options.dependencyScopeOverrides ? { dependencyScopeOverrides: plan.options.dependencyScopeOverrides } : {}),
|
|
190
|
+
...(command === 'cleanup' || command === 'uninstall' ? { force: plan.options.force } : {}),
|
|
191
|
+
},
|
|
192
|
+
runtime: {
|
|
193
|
+
...runtime,
|
|
194
|
+
preserveLegacyNativeSkills: plan.options.existingOnly === true,
|
|
195
|
+
nativeActivationOnlyTargets: plan.options.nativeActivationOnlyTargets,
|
|
196
|
+
nativePlannedRetirements: plan.options.nativePlannedRetirements,
|
|
197
|
+
...(preview ? { nativeCliRunner: bindNativeCliRunnerSignal(runtime.nativeCliRunner ?? getDefaultNativeCliRunner(), runtime.signal) } : {}),
|
|
198
|
+
env: plan.options.env,
|
|
199
|
+
catalogOperationContext: plan.demand.catalogOperationContext,
|
|
200
|
+
catalogReadScope,
|
|
201
|
+
previewOperationPlan: preview,
|
|
202
|
+
executionInput: {
|
|
203
|
+
context: plan.context,
|
|
204
|
+
requirements,
|
|
205
|
+
selectedTargets: (selectedTargets ?? nativeGroupTargets({ pluginIds, platform }))
|
|
206
|
+
.map((target) => ({ ...target, scope: plan.options.scope })),
|
|
207
|
+
preserveOtherObservedTargets: true,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
if (preview)
|
|
212
|
+
runtime.signal?.throwIfAborted();
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
function nativeResults(plan, group, result, executed) {
|
|
216
|
+
for (const diagnostic of result.recoveryDiagnostics ?? []) {
|
|
217
|
+
if (!plan.receipt.blockers.some((entry) => JSON.stringify(entry) === JSON.stringify(diagnostic)))
|
|
218
|
+
plan.receipt.blockers.push(diagnostic);
|
|
219
|
+
}
|
|
220
|
+
if (executed && result.commandResults?.length) {
|
|
221
|
+
plan.receipt.commandResults = [...new Map([
|
|
222
|
+
...(plan.receipt.commandResults ?? []), ...result.commandResults,
|
|
223
|
+
].map((entry) => [entry.packageId, entry])).values()];
|
|
224
|
+
}
|
|
225
|
+
const backend = buildRebuildReceiptJson(group.command === 'install' ? 'sync' : group.command, result);
|
|
226
|
+
for (const { pluginId, platform } of nativeGroupTargets(group)) {
|
|
227
|
+
const agent = agentForPlatform(platform);
|
|
228
|
+
const target = pair(plan, pluginId, agent);
|
|
229
|
+
if (!target)
|
|
230
|
+
continue;
|
|
231
|
+
target.backend = backend;
|
|
232
|
+
const matchesTarget = (entry) => entry.target.pluginId === pluginId
|
|
233
|
+
&& entry.target.platform === platform && entry.target.scope === plan.options.scope;
|
|
234
|
+
const backendTargets = result.targetResults.filter(matchesTarget);
|
|
235
|
+
const rebuildTargets = result.rebuildResults.filter((entry) => entry.target.pluginId === pluginId
|
|
236
|
+
&& entry.target.platform === platform && entry.target.scope === plan.options.scope);
|
|
237
|
+
const deploymentPlans = new Map([
|
|
238
|
+
...(group.preview.operationPlan?.deploymentPlans ?? []),
|
|
239
|
+
...(result.operationPlan?.deploymentPlans ?? []),
|
|
240
|
+
].filter((deployment) => deployment.binding.plugin.pluginId === pluginId
|
|
241
|
+
&& deployment.binding.platform === platform && deployment.binding.scope.kind === plan.options.scope)
|
|
242
|
+
.map((deployment) => [deployment.binding.id, deployment]));
|
|
243
|
+
if (deploymentPlans.size) {
|
|
244
|
+
target.deploymentPlans = [...deploymentPlans.values()];
|
|
245
|
+
const gaps = target.deploymentPlans.flatMap(({ expected, evidence }) => scopeNativeComponentGaps(expected.unmet, target, evidence.renderUnits));
|
|
246
|
+
if (gaps.length)
|
|
247
|
+
target.componentGaps = uniqueRecoveryComponentGaps(gaps);
|
|
248
|
+
}
|
|
249
|
+
const exclusions = [
|
|
250
|
+
...(group.preview.deploymentExclusions ?? []),
|
|
251
|
+
...(result.deploymentExclusions ?? []),
|
|
252
|
+
...(group.preview.operationPlan?.deploymentExclusions ?? []),
|
|
253
|
+
...(result.operationPlan?.deploymentExclusions ?? []),
|
|
254
|
+
...result.rebuildResults.flatMap((entry) => entry.deploymentExclusions ?? []),
|
|
255
|
+
].filter((entry) => entry.pluginId === pluginId && entry.platform === platform && entry.scope.kind === plan.options.scope);
|
|
256
|
+
if (exclusions.length)
|
|
257
|
+
target.deploymentExclusions = [...new Map(exclusions.map((entry) => [JSON.stringify([entry.pluginId, entry.platform, entry.scope, entry.productId, entry.reasonCode]), entry])).values()];
|
|
258
|
+
const dependencies = result.dependencyPlan?.targets.filter((entry) => entry.platform === platform && (entry.pluginId === pluginId || entry.requiredBy?.includes(pluginId))) ?? [];
|
|
259
|
+
const producers = (result.commandResults ?? []).filter((entry) => {
|
|
260
|
+
const producerPluginId = entry.selector;
|
|
261
|
+
const plugin = plan.demand.plugins.find((plugin) => plugin.pluginId === producerPluginId);
|
|
262
|
+
if (plugin && plugin.sourceIdentity !== entry.producer.sourceIdentity)
|
|
263
|
+
return false;
|
|
264
|
+
const declaration = plugin?.manifest.command;
|
|
265
|
+
if (!declaration?.platforms.includes(platform))
|
|
266
|
+
return false;
|
|
267
|
+
return producerPluginId === pluginId
|
|
268
|
+
|| dependencies.some((dependency) => dependency.pluginId === producerPluginId)
|
|
269
|
+
|| result.targetResults.some((target) => target.target.pluginId === producerPluginId
|
|
270
|
+
&& target.target.platform === platform && target.requiredBy?.includes(pluginId)
|
|
271
|
+
&& target.target.scope === (result.dependencyPlan?.targets.find((dependency) => dependency.pluginId === producerPluginId && dependency.platform === platform)?.resolvedScope
|
|
272
|
+
?? plan.options.scope));
|
|
273
|
+
});
|
|
274
|
+
target.recoveryActions = backend.targetResults.length || backend.commandResults?.length
|
|
275
|
+
? [...new Set([
|
|
276
|
+
...backend.targetResults.filter(matchesTarget).flatMap((entry) => entry.recoveryActions),
|
|
277
|
+
...producers.flatMap((producer) => producer.recoveryActions),
|
|
278
|
+
])]
|
|
279
|
+
: backend.recoveryActions;
|
|
280
|
+
for (const dependency of dependencies.filter((entry) => entry.action === 'block' && entry.configDiagnostic)) {
|
|
281
|
+
const blocker = dependency.configDiagnostic;
|
|
282
|
+
if (!target.blockers.some((entry) => JSON.stringify(entry) === JSON.stringify(blocker)))
|
|
283
|
+
target.blockers.push(blocker);
|
|
284
|
+
}
|
|
285
|
+
for (const failure of backendTargets.filter((entry) => entry.state === 'failed')) {
|
|
286
|
+
block(target, failure.errorCode ?? 'nativeRecoveryFailed');
|
|
287
|
+
}
|
|
288
|
+
// Keep checked recovery locations even when preparation stops before execution.
|
|
289
|
+
const nativeDiagnostics = rebuildTargets
|
|
290
|
+
.flatMap((entry) => [...(entry.cleanupNotices ?? []), ...(entry.deploymentReceipts ?? []).flatMap((deployment) => [...deployment.diagnostics, ...deployment.effects.flatMap((effect) => effect.diagnostics)])])
|
|
291
|
+
.filter((entry) => entry.detail);
|
|
292
|
+
for (const entry of nativeDiagnostics) {
|
|
293
|
+
const destination = entry.severity === 'error' ? target.blockers : (target.reasons ??= []);
|
|
294
|
+
const detail = { code: entry.code, message: entry.message, subject: entry.subject, detail: entry.detail };
|
|
295
|
+
if (!destination.some((previous) => JSON.stringify(previous) === JSON.stringify(detail)))
|
|
296
|
+
destination.push(detail);
|
|
297
|
+
}
|
|
298
|
+
for (const dependency of dependencies.filter((entry) => entry.action === 'block')) {
|
|
299
|
+
block(target, dependency.errorCode ?? 'dependencyNotReady');
|
|
300
|
+
}
|
|
301
|
+
for (const dependency of dependencies.filter((entry) => entry.pluginId !== pluginId)) {
|
|
302
|
+
for (const failure of result.targetResults.filter((entry) => entry.target.pluginId === dependency.pluginId
|
|
303
|
+
&& entry.target.platform === dependency.platform && entry.target.scope === dependency.resolvedScope && entry.state === 'failed')) {
|
|
304
|
+
const code = failure.errorCode ?? 'dependencyNotReady';
|
|
305
|
+
block(target, code, { ...diagnostic(code), pluginId: dependency.pluginId });
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (executed) {
|
|
309
|
+
const deployments = rebuildTargets.flatMap((entry) => entry.deploymentReceipts ?? []);
|
|
310
|
+
if (deployments.length)
|
|
311
|
+
target.deploymentReceipts = deployments.map((entry) => ({ ...entry,
|
|
312
|
+
products: deploymentPlans.get(entry.bindingId)?.binding.consumers ?? [],
|
|
313
|
+
}));
|
|
314
|
+
const commandFailures = producers.filter((entry) => !commandPackageProviderSatisfied(entry));
|
|
315
|
+
for (const producer of commandFailures) {
|
|
316
|
+
for (const error of producer.errors)
|
|
317
|
+
block(target, error.code);
|
|
318
|
+
if (producer.errors.length === 0)
|
|
319
|
+
block(target, 'managedCommandRecoveryFailed');
|
|
320
|
+
}
|
|
321
|
+
const succeeded = commandFailures.length === 0 && backendTargets.length > 0
|
|
322
|
+
&& backendTargets.every((entry) => entry.state === 'completed');
|
|
323
|
+
const effects = deployments.flatMap((entry) => entry.effects);
|
|
324
|
+
const changed = effects.some((effect) => effect.mutation !== 'none')
|
|
325
|
+
|| rebuildTargets.some((entry) => entry.cleanupMutation !== undefined);
|
|
326
|
+
if (succeeded) {
|
|
327
|
+
const unchanged = deployments.length > 0 ? effects.every((effect) => effect.status === 'unchanged')
|
|
328
|
+
: backendTargets.every((entry) => entry.action === 'skipped');
|
|
329
|
+
target.execution = unchanged ? 'no-op' : 'applied';
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
const blockedByDependency = !changed && backendTargets.length > 0
|
|
333
|
+
&& backendTargets.every((entry) => entry.errorCode === 'dependencyInstallFailed')
|
|
334
|
+
&& result.rebuildResults.filter((entry) => entry.target.pluginId === pluginId && entry.target.platform === platform
|
|
335
|
+
&& entry.target.scope === plan.options.scope).every((entry) => !entry.cleanupAttempted && entry.actions.length === 0);
|
|
336
|
+
target.execution = blockedByDependency ? 'not-run'
|
|
337
|
+
: changed || backendTargets.some((entry) => entry.state === 'completed') ? 'partial' : 'failed';
|
|
338
|
+
}
|
|
339
|
+
plan.receipt.outputsMayHaveChanged ||= changed;
|
|
340
|
+
if (succeeded && (plan.command === 'cleanup' || plan.command === 'uninstall')) {
|
|
341
|
+
const completed = result.rebuildResults.filter((entry) => entry.target.pluginId === pluginId
|
|
342
|
+
&& entry.target.platform === platform && entry.target.scope === plan.options.scope);
|
|
343
|
+
const footprints = result.nativeFootprints?.filter((entry) => entry.pluginId === pluginId
|
|
344
|
+
&& entry.platform === platform && entry.scope === plan.options.scope);
|
|
345
|
+
const absent = completed.length > 0 && footprints !== undefined && footprints.length > 0
|
|
346
|
+
&& footprints.every((entry) => !entry.shared)
|
|
347
|
+
&& completed.every((entry) => entry.status === 'succeeded' && entry.cleanupAttempted
|
|
348
|
+
&& entry.removed.length + entry.absent.length > 0 && entry.residual.length === 0
|
|
349
|
+
&& entry.quarantined.length === 0 && entry.failures.length === 0);
|
|
350
|
+
target.observation = absent ? 'missing' : 'unknown';
|
|
351
|
+
target.content = absent ? 'absent' : 'unknown';
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
target.observation = succeeded ? 'verified' : 'unknown';
|
|
355
|
+
target.content = succeeded ? 'satisfied' : 'unknown';
|
|
356
|
+
}
|
|
357
|
+
if (deployments.length && plan.command !== 'cleanup' && plan.command !== 'uninstall') {
|
|
358
|
+
const gaps = deployments.flatMap((entry) => scopeNativeComponentGaps(entry.unmet, target, deploymentPlans.get(entry.bindingId)?.evidence.renderUnits));
|
|
359
|
+
if (gaps.length)
|
|
360
|
+
target.componentGaps = uniqueRecoveryComponentGaps(gaps);
|
|
361
|
+
const installed = new Set(deployments.flatMap((entry) => {
|
|
362
|
+
const deployment = deploymentPlans.get(entry.bindingId);
|
|
363
|
+
if (!deployment)
|
|
364
|
+
return [];
|
|
365
|
+
const ids = new Set(deployment.expected.components.map(({ id }) => id));
|
|
366
|
+
if (!succeeded) {
|
|
367
|
+
const partial = new Set(deployment.effects.filter((effect) => (effect.kind === 'publish-package' || effect.kind === 'write-supplement')
|
|
368
|
+
&& entry.effects.some((actual) => actual.id === effect.id && actual.status === 'applied' && actual.mutation === 'confirmed'))
|
|
369
|
+
.flatMap((effect) => effect.componentIds));
|
|
370
|
+
for (const id of ids)
|
|
371
|
+
if (!partial.has(id))
|
|
372
|
+
ids.delete(id);
|
|
373
|
+
}
|
|
374
|
+
for (const gap of entry.unmet)
|
|
375
|
+
if (!isDeliveryCapabilityGap(gap))
|
|
376
|
+
ids.delete(gap.componentId ?? gap.id);
|
|
377
|
+
return entry.after.components.filter(({ id, presence, reasonCodes }) => ids.has(id) && presence === 'present' && !reasonCodes.length).map(({ id }) => id);
|
|
378
|
+
}));
|
|
379
|
+
if (installed.size || succeeded && target.deploymentPlans?.every(({ expected }) => !expected.components.length)) {
|
|
380
|
+
target.installedComponentCount = installed.size;
|
|
381
|
+
target.installedComponentIds = [...installed];
|
|
382
|
+
}
|
|
383
|
+
if (succeeded && !target.blockers.length && gaps.every(isDeliveryCapabilityGap)) {
|
|
384
|
+
if (installed.size)
|
|
385
|
+
target.satisfaction = 'installed';
|
|
386
|
+
else if (gaps.length && target.deploymentPlans?.every(({ expected }) => !expected.components.length))
|
|
387
|
+
target.satisfaction = 'not-applicable';
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (!succeeded && !target.blockers.length)
|
|
391
|
+
block(target, 'nativeRecoveryFailed');
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
/** All scopes share one final marketplace generation before Review is returned. */
|
|
396
|
+
export async function refreshRecoveryNativePreviews(plan, catalogReadScope, signal = plan.runtime.signal) {
|
|
397
|
+
const previews = await readNativeGroups(plan.nativeGroups, (group) => nativeOperation(plan, group.pluginIds, group.platform, true, { ...plan.runtime, signal }, group.command, nativeGroupTargets(group), catalogReadScope), signal);
|
|
398
|
+
for (const [index, group] of plan.nativeGroups.entries()) {
|
|
399
|
+
group.preview = previews[index];
|
|
400
|
+
nativeResults(plan, group, group.preview, false);
|
|
401
|
+
}
|
|
402
|
+
completeReceipt(plan.receipt);
|
|
403
|
+
}
|
|
404
|
+
function portableRequiredBy(plan, prepared, target) {
|
|
405
|
+
return plan.portableGroups.filter((group) => group.logicalIdentity === prepared.logicalIdentity
|
|
406
|
+
&& group.targets.some((entry) => entry.providerPluginId === target.providerPluginId
|
|
407
|
+
&& entry.expectedDigest === target.expectedDigest && entry.physicalPath === target.physicalPath))
|
|
408
|
+
.map((group) => group.options.selector);
|
|
409
|
+
}
|
|
410
|
+
function portableResults(plan, prepared) {
|
|
411
|
+
for (const agent of prepared.options.agents) {
|
|
412
|
+
const target = pair(plan, prepared.options.selector, agent);
|
|
413
|
+
const observations = prepared.targets.filter((entry) => entry.agent === agent);
|
|
414
|
+
const gaps = (prepared.unmet ?? []).filter((gap) => gap.agent === agent);
|
|
415
|
+
if (gaps.length)
|
|
416
|
+
target.componentGaps = gaps;
|
|
417
|
+
const blockingGap = gaps.some((gap) => !isDeliveryCapabilityGap(gap));
|
|
418
|
+
target.content = observations.some((entry) => entry.observation === 'conflict') ? 'conflict'
|
|
419
|
+
: observations.some((entry) => entry.observation === 'unknown') ? 'unknown'
|
|
420
|
+
: observations.some((entry) => entry.observation === 'drifted') ? 'drifted'
|
|
421
|
+
: observations.some((entry) => entry.observation === 'absent') ? 'absent'
|
|
422
|
+
: observations.length || prepared.intentionalEmpty || gaps.length && !blockingGap && !prepared.blockers.length ? 'satisfied' : 'unknown';
|
|
423
|
+
if ((blockingGap || observations.some((entry) => entry.disposition === 'retain')) && target.content !== 'conflict')
|
|
424
|
+
target.content = 'unknown';
|
|
425
|
+
target.observation = target.content === 'satisfied' ? 'verified'
|
|
426
|
+
: target.content === 'absent' ? 'missing' : 'unknown';
|
|
427
|
+
for (const gap of gaps)
|
|
428
|
+
plan.changes.push(`组件未满足 · ${gap.providerPluginId} · ${gap.componentId ?? gap.id} · ${gap.reasonCode}`
|
|
429
|
+
+ gap.requiredFeatures.map((requirement) => ` · ${requirement.feature}${requirement.values ? `: ${requirement.values.join(', ')}` : ''}`).join(''));
|
|
430
|
+
for (const code of [...prepared.globalBlockers, ...observations.flatMap((entry) => entry.blocker
|
|
431
|
+
&& !(entry.disposition === 'retain' && entry.blocker === 'previousDeploymentRetained') ? [entry.blocker] : [])]) {
|
|
432
|
+
block(target, code, portablePreparationDiagnostic(prepared, diagnostic(code), agent));
|
|
433
|
+
}
|
|
434
|
+
const retained = observations.filter((entry) => entry.disposition === 'retain');
|
|
435
|
+
if (retained.length)
|
|
436
|
+
target.reasons = retained.map((entry) => retainedOutputDiagnostic(entry.providerPluginId, agent, target.scope, entry.physicalPath, `skill.${entry.skill}`));
|
|
437
|
+
const policyNotices = prepared.policyNotices?.filter((notice) => notice.subject?.target === agent);
|
|
438
|
+
if (policyNotices?.length)
|
|
439
|
+
(target.reasons ??= []).push(...policyNotices);
|
|
440
|
+
target.backend = observations.map((entry) => ({ skill: entry.skill, providerPluginId: entry.providerPluginId,
|
|
441
|
+
requiredBy: portableRequiredBy(plan, prepared, entry), observation: entry.observation,
|
|
442
|
+
ownership: entry.ownership, associatedAgents: entry.associatedAgents }));
|
|
443
|
+
target.recoveryActions = portableRecoveryActions(plan, target.pluginId, observations.filter((entry) => ['conflict', 'unknown'].includes(entry.observation)));
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
function portableOutcomes(plan, prepared, agent, outcomes, globalBlockers) {
|
|
447
|
+
const target = pair(plan, prepared.options.selector, agent);
|
|
448
|
+
const contentOutcomes = outcomes.filter((entry) => entry.disposition !== 'remove');
|
|
449
|
+
for (const entry of contentOutcomes) {
|
|
450
|
+
if (entry.invocationWarning && entry.disposition === 'write' && entry.observation === 'satisfied'
|
|
451
|
+
&& (entry.execution === 'applied' || entry.execution === 'no-op') && !entry.blockers.length) {
|
|
452
|
+
(target.reasons ??= []).push(entry.invocationWarning);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
const preparedTargets = prepared.targets.filter((entry) => entry.agent === agent);
|
|
456
|
+
const gaps = (prepared.unmet ?? []).filter((gap) => gap.agent === agent);
|
|
457
|
+
if (gaps.length)
|
|
458
|
+
target.componentGaps = gaps;
|
|
459
|
+
const blockingGap = gaps.some((gap) => !isDeliveryCapabilityGap(gap));
|
|
460
|
+
const completeEmpty = prepared.mode === 'deploy' && (prepared.intentionalEmpty || gaps.length > 0 && !blockingGap) && prepared.blockers.length === 0
|
|
461
|
+
&& globalBlockers.length === 0 && preparedTargets.every((entry) => entry.disposition === 'remove')
|
|
462
|
+
&& outcomes.length === preparedTargets.length
|
|
463
|
+
&& outcomes.every((entry) => entry.observation === 'absent' && entry.blockers.length === 0
|
|
464
|
+
&& ['applied', 'no-op'].includes(entry.execution));
|
|
465
|
+
target.execution = (prepared.mode === 'cleanup' || completeEmpty) && outcomes.length === 0 && !globalBlockers.length ? 'no-op' : outcomes.length > 0 && outcomes.every((entry) => entry.execution === 'no-op') ? 'no-op'
|
|
466
|
+
: outcomes.length > 0 && outcomes.every((entry) => ['applied', 'no-op'].includes(entry.execution)) ? 'applied'
|
|
467
|
+
: outcomes.some((entry) => ['applied', 'no-op'].includes(entry.execution)) ? 'partial'
|
|
468
|
+
: outcomes.some((entry) => entry.execution === 'failed') ? 'failed' : 'not-run';
|
|
469
|
+
target.observation = contentOutcomes.length > 0 && contentOutcomes.every((entry) => entry.observation === 'satisfied')
|
|
470
|
+
&& globalBlockers.length === 0 ? 'verified'
|
|
471
|
+
: globalBlockers.length === 0 && contentOutcomes.some((entry) => entry.observation === 'absent'
|
|
472
|
+
|| entry.observation === 'drifted') && contentOutcomes.every((entry) => entry.observation !== 'unknown'
|
|
473
|
+
&& entry.observation !== 'conflict') ? 'missing' : 'unknown';
|
|
474
|
+
target.content = contentOutcomes.some((entry) => entry.observation === 'conflict') ? 'conflict'
|
|
475
|
+
: contentOutcomes.some((entry) => entry.observation === 'unknown') ? 'unknown'
|
|
476
|
+
: contentOutcomes.some((entry) => entry.observation === 'drifted') ? 'drifted'
|
|
477
|
+
: contentOutcomes.some((entry) => entry.observation === 'absent') ? 'absent'
|
|
478
|
+
: contentOutcomes.length ? 'satisfied' : 'unknown';
|
|
479
|
+
if (prepared.mode === 'cleanup' && globalBlockers.length === 0
|
|
480
|
+
&& outcomes.every((entry) => entry.observation === 'absent' && entry.blockers.length === 0)) {
|
|
481
|
+
target.observation = 'missing';
|
|
482
|
+
target.content = 'absent';
|
|
483
|
+
}
|
|
484
|
+
else if (completeEmpty) {
|
|
485
|
+
target.observation = 'verified';
|
|
486
|
+
target.content = 'satisfied';
|
|
487
|
+
}
|
|
488
|
+
if (prepared.mode === 'deploy') {
|
|
489
|
+
const installed = contentOutcomes.filter((entry) => entry.providerPluginId === target.pluginId
|
|
490
|
+
&& entry.disposition === 'write' && entry.observation === 'satisfied' && !entry.blockers.length);
|
|
491
|
+
if (installed.length || !globalBlockers.length && contentOutcomes.every((entry) => entry.disposition === 'retain' || entry.observation === 'satisfied' || entry.observation === 'absent')) {
|
|
492
|
+
target.installedComponentCount = installed.length;
|
|
493
|
+
if (installed.every((entry) => entry.componentId))
|
|
494
|
+
target.installedComponentIds = installed.map((entry) => entry.componentId);
|
|
495
|
+
}
|
|
496
|
+
if (target.content === 'satisfied' && !blockingGap && !globalBlockers.length && outcomes.every((entry) => !entry.blockers.length)
|
|
497
|
+
&& (target.execution === 'applied' || target.execution === 'no-op')) {
|
|
498
|
+
if (installed.length)
|
|
499
|
+
target.satisfaction = 'installed';
|
|
500
|
+
else if (gaps.some((gap) => gap.providerPluginId === target.pluginId))
|
|
501
|
+
target.satisfaction = 'not-applicable';
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
if (blockingGap || contentOutcomes.some((entry) => entry.disposition === 'retain')) {
|
|
505
|
+
if (target.execution === 'applied' || target.execution === 'no-op')
|
|
506
|
+
target.execution = 'partial';
|
|
507
|
+
if (target.content !== 'conflict')
|
|
508
|
+
target.content = 'unknown';
|
|
509
|
+
target.observation = 'unknown';
|
|
510
|
+
if (blockingGap)
|
|
511
|
+
block(target, 'portableComponentsUnmet');
|
|
512
|
+
}
|
|
513
|
+
target.backend = outcomes.map((entry) => ({ skill: entry.skill, providerPluginId: entry.providerPluginId,
|
|
514
|
+
requiredBy: portableRequiredBy(plan, prepared, entry), observation: entry.observation,
|
|
515
|
+
ownership: entry.ownership, associatedAgents: entry.associatedAgents,
|
|
516
|
+
execution: entry.execution, blockers: entry.blockers }));
|
|
517
|
+
for (const code of [...globalBlockers, ...outcomes.flatMap((entry) => entry.blockers)])
|
|
518
|
+
block(target, code);
|
|
519
|
+
target.recoveryActions = portableRecoveryActions(plan, target.pluginId, outcomes.filter((entry) => entry.observation === 'conflict' || entry.observation === 'unknown' && !entry.blockers.includes('operationReviewStale')));
|
|
520
|
+
if (globalBlockers.includes('operationReviewStale') && prepared.mode !== 'cleanup') {
|
|
521
|
+
target.recoveryActions.push(`aw plugin sync ${target.pluginId} --context ${target.scope} --target ${agent}`);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
function portablePluginClosure(plan, prepared) {
|
|
525
|
+
const { sourceId, pluginName } = parsePluginId(prepared.options.selector);
|
|
526
|
+
return resolvePluginMetaDependencyClosure(plan.demand.plugins.filter((plugin) => plugin.sourceId === sourceId), [pluginName])
|
|
527
|
+
.filter((plugin) => !prepared.options.excludedPluginIds?.includes(plugin.pluginId));
|
|
528
|
+
}
|
|
529
|
+
function isHealthyPortableProvider(group) {
|
|
530
|
+
return !group.blockers.length && group.unmet.every(isDeliveryCapabilityGap)
|
|
531
|
+
&& (group.intentionalEmpty || group.unmet.length > 0 || group.targets.length > 0)
|
|
532
|
+
&& group.targets.every((target) => target.disposition === 'write' && target.ownership === 'aw'
|
|
533
|
+
&& target.observation === 'satisfied' && target.installedDigest === target.expectedDigest);
|
|
534
|
+
}
|
|
535
|
+
function preparePortablePreApplyAuthorization(plan) {
|
|
536
|
+
if (plan.command === 'cleanup' || plan.command === 'uninstall')
|
|
537
|
+
return;
|
|
538
|
+
const authorization = new Map();
|
|
539
|
+
const verifiedProviders = new Set(plan.portableGroups.filter((group) => plan.options.inheritedPortableProviderIds?.includes(group.options.selector) && isHealthyPortableProvider(group))
|
|
540
|
+
.map((group) => group.options.selector));
|
|
541
|
+
for (const prepared of plan.portableGroups) {
|
|
542
|
+
for (const plugin of portablePluginClosure(plan, prepared)) {
|
|
543
|
+
if (!plugin.manifest.scripts?.preApply || verifiedProviders.has(plugin.pluginId))
|
|
544
|
+
continue;
|
|
545
|
+
for (const platform of prepared.options.agents) {
|
|
546
|
+
if (pair(plan, prepared.options.selector, platform)?.blockers.length)
|
|
547
|
+
continue;
|
|
548
|
+
const target = {
|
|
549
|
+
pluginId: plugin.pluginId, pluginName: plugin.manifest.name,
|
|
550
|
+
sourceId: plugin.sourceId, sourceIdentity: plugin.sourceIdentity,
|
|
551
|
+
platform, scope: plan.options.scope,
|
|
552
|
+
relation: plugin.pluginId === prepared.options.selector ? 'requested'
|
|
553
|
+
: plan.demand.plugins.find((entry) => entry.pluginId === prepared.options.selector)?.manifest.dependencies?.includes(plugin.manifest.name)
|
|
554
|
+
? 'direct' : 'transitive',
|
|
555
|
+
};
|
|
556
|
+
authorization.set([target.pluginId, target.platform, target.scope].join('\0'), target);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
plan.preApplyAuthorization = [...authorization.values()];
|
|
561
|
+
plan.changes.push(...plan.preApplyAuthorization.map((target) => `运行插件 preApply 脚本:${target.pluginId} / ${target.platform} / ${target.scope}。`));
|
|
562
|
+
}
|
|
563
|
+
async function executePortablePreApply(plan, prepared, agent, runtime) {
|
|
564
|
+
if (prepared.mode === 'cleanup' || plan.command === 'cleanup' || plan.command === 'uninstall')
|
|
565
|
+
return;
|
|
566
|
+
const plugins = portablePluginClosure(plan, prepared);
|
|
567
|
+
const required = plan.preApplyAuthorization?.filter((target) => target.platform === agent
|
|
568
|
+
&& plugins.some((plugin) => plugin.pluginId === target.pluginId)) ?? [];
|
|
569
|
+
return executePreApplyAuthorization(plan, required, runtime);
|
|
570
|
+
}
|
|
571
|
+
async function executePreApplyAuthorization(plan, required, runtime) {
|
|
572
|
+
if (!required.length)
|
|
573
|
+
return;
|
|
574
|
+
if (plan.options.yes !== true && runtime.preApplyConfirmed !== true)
|
|
575
|
+
return 'preApplyAuthorizationRequired';
|
|
576
|
+
const cache = runtime.preApplyExecutionCache ??= new Map();
|
|
577
|
+
for (const target of required) {
|
|
578
|
+
runtime.signal?.throwIfAborted();
|
|
579
|
+
const plugin = plan.demand.plugins.find((entry) => entry.pluginId === target.pluginId);
|
|
580
|
+
if (!plugin || plugin.sourceIdentity !== target.sourceIdentity)
|
|
581
|
+
return 'sourceUnavailable';
|
|
582
|
+
const context = target.scope === plan.options.scope ? plan.context
|
|
583
|
+
: await createScopeContext({ scope: target.scope, cwd: plan.context.callerCwd, env: plan.options.env });
|
|
584
|
+
try {
|
|
585
|
+
const projectKey = target.scope !== 'project' ? '' : target.platform === 'codex'
|
|
586
|
+
? await resolveCodexProjectKey(context.executionCwd) : target.platform === 'claude'
|
|
587
|
+
? await resolveClaudeProjectKey(context.executionCwd) : context.projectKey;
|
|
588
|
+
const key = [target.sourceIdentity, target.pluginId, target.platform, target.scope, projectKey].join('\0');
|
|
589
|
+
let execution = cache.get(key);
|
|
590
|
+
if (!execution) {
|
|
591
|
+
execution = runPreApplyScript({ plugin, platform: target.platform, scope: target.scope,
|
|
592
|
+
cwd: context.executionCwd, context: { env: context.env, interruption: runtime.interruption },
|
|
593
|
+
referencePlugins: plan.demand.plugins, scriptTimeoutMs: plan.options.scriptTimeoutMs });
|
|
594
|
+
cache.set(key, execution);
|
|
595
|
+
}
|
|
596
|
+
await execution;
|
|
597
|
+
}
|
|
598
|
+
catch (error) {
|
|
599
|
+
const interrupted = recoveryInterruptionCode(error, runtime.signal);
|
|
600
|
+
if (interrupted) {
|
|
601
|
+
const affected = pair(plan, target.pluginId, target.platform);
|
|
602
|
+
if (affected) {
|
|
603
|
+
affected.execution = 'partial';
|
|
604
|
+
affected.observation = 'unknown';
|
|
605
|
+
affected.content = 'unknown';
|
|
606
|
+
block(affected, interrupted);
|
|
607
|
+
}
|
|
608
|
+
plan.receipt.outputsMayHaveChanged = true;
|
|
609
|
+
throw error;
|
|
610
|
+
}
|
|
611
|
+
const operationDiagnostic = readSafeOperationError(error);
|
|
612
|
+
const affected = pair(plan, target.pluginId, target.platform);
|
|
613
|
+
if (affected) {
|
|
614
|
+
affected.execution = 'failed';
|
|
615
|
+
block(affected, 'preApplyFailed');
|
|
616
|
+
if (affected.delivery?.kind === 'native') {
|
|
617
|
+
const identity = { pluginId: target.pluginId, pluginName: plugin.manifest.name, pluginVersion: plugin.manifest.version,
|
|
618
|
+
sourceId: plugin.sourceId, sourceIdentity: target.sourceIdentity, platform: affected.delivery.platform,
|
|
619
|
+
scope: target.scope, cwd: context.executionCwd };
|
|
620
|
+
const failure = { phase: 'preApply', message: operationDiagnostic?.safeMessage ?? 'The preApply script failed.',
|
|
621
|
+
...(operationDiagnostic ? { operationDiagnostic } : {}) };
|
|
622
|
+
affected.backend = buildRebuildReceiptJson(plan.command, { platforms: [target.platform], plugins: [], warnings: [],
|
|
623
|
+
targetResults: [{ target: identity, action: 'install', state: 'failed', errorCode: 'preApplyFailed' }],
|
|
624
|
+
rebuildResults: [{ status: 'failed', command: plan.command, target: identity, actions: [{ name: 'preApply', status: 'failed' }],
|
|
625
|
+
cleanupAttempted: false, removed: [], absent: [], residual: [], quarantined: [], failures: [failure], error: failure }] });
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return 'preApplyFailed';
|
|
629
|
+
}
|
|
630
|
+
finally {
|
|
631
|
+
if (context !== plan.context)
|
|
632
|
+
await context.dispose();
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
/** Run the reviewed replacement's hooks before any dependent old-output cleanup. */
|
|
637
|
+
export async function executeRecoveryPreApply(plan, pluginId, agent, runtime) {
|
|
638
|
+
if (plan.command === 'cleanup' || plan.command === 'uninstall')
|
|
639
|
+
return;
|
|
640
|
+
if (plan.receipt.nativeToolChanges?.length && plan.options.yes !== true)
|
|
641
|
+
return 'nativeToolAuthorizationRequired';
|
|
642
|
+
const target = pair(plan, pluginId, agent);
|
|
643
|
+
if (!target)
|
|
644
|
+
return 'preApplyTargetUnavailable';
|
|
645
|
+
if (target.blockers.length)
|
|
646
|
+
return target.blockers[0].code;
|
|
647
|
+
if (target.delivery?.kind === 'native') {
|
|
648
|
+
const platform = target.delivery.platform;
|
|
649
|
+
try {
|
|
650
|
+
const authorization = await nativeOperation(plan, [pluginId], platform, true, { ...runtime, resolvePreApplyAuthorization: true }, plan.command, [{ pluginId, platform }]);
|
|
651
|
+
if (authorization.overallState !== 'succeeded' || !authorization.preApplyAuthorization) {
|
|
652
|
+
return authorization.targetResults.find((result) => result.errorCode)?.errorCode ?? 'preApplyAuthorizationUnavailable';
|
|
653
|
+
}
|
|
654
|
+
const blocked = authorization.dependencyPlan?.targets.find((entry) => entry.action === 'block'
|
|
655
|
+
&& (entry.pluginId === pluginId || entry.requiredBy.includes(pluginId)));
|
|
656
|
+
if (blocked)
|
|
657
|
+
return blocked.errorCode ?? 'nativePreparationFailed';
|
|
658
|
+
return executePreApplyAuthorization(plan, authorization.preApplyAuthorization, runtime);
|
|
659
|
+
}
|
|
660
|
+
catch (error) {
|
|
661
|
+
if (recoveryInterruptionCode(error, runtime.signal))
|
|
662
|
+
throw error;
|
|
663
|
+
return readSafeOperationError(error)?.code ?? errorCode(error, 'nativePreparationFailed');
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
if (isPortableAgent(agent)) {
|
|
667
|
+
const prepared = plan.portableGroups.find((group) => group.options.selector === pluginId
|
|
668
|
+
&& group.options.agents.includes(agent));
|
|
669
|
+
if (prepared)
|
|
670
|
+
return executePortablePreApply(plan, prepared, agent, runtime);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
export async function checkFootprints(plan) {
|
|
674
|
+
const footprints = [];
|
|
675
|
+
for (const [nativeGroup, group] of plan.nativeGroups.entries()) {
|
|
676
|
+
const actions = group.preview.operationPlan?.actions.filter((action) => (action.kind === 'writeOwnedArtifact' || action.kind === 'removeOwnedArtifact')
|
|
677
|
+
&& !group.preview.nativeFootprints?.some((footprint) => footprint.path === action.path
|
|
678
|
+
&& footprint.pluginId === action.pluginId && footprint.platform === action.platform)) ?? [];
|
|
679
|
+
for (const action of [...(group.preview.nativeFootprints ?? []), ...actions]) {
|
|
680
|
+
if (!('path' in action))
|
|
681
|
+
continue;
|
|
682
|
+
const consumers = group.preview.dependencyPlan?.targets.filter((target) => target.pluginId === action.pluginId)
|
|
683
|
+
.flatMap((target) => target.requiredBy ?? []) ?? [];
|
|
684
|
+
footprints.push({ path: action.path,
|
|
685
|
+
pluginIds: group.pluginIds.filter((id) => id === action.pluginId || consumers.includes(id)),
|
|
686
|
+
agent: agentForPlatform(action.platform), identity: `native:${action.platform}:${action.pluginId}`,
|
|
687
|
+
sharedNative: 'shared' in action && action.shared,
|
|
688
|
+
...('sharedMarketplace' in action && action.sharedMarketplace
|
|
689
|
+
? { sharedMarketplaceSource: parsePluginId(action.pluginId).sourceId } : {}),
|
|
690
|
+
nativeGroup });
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
for (const prepared of plan.portableGroups) {
|
|
694
|
+
for (const target of prepared.targets)
|
|
695
|
+
footprints.push({
|
|
696
|
+
path: target.physicalPath,
|
|
697
|
+
pluginIds: [prepared.options.selector], agent: target.agent,
|
|
698
|
+
identity: JSON.stringify(['agent-skills', prepared.logicalIdentity, target.providerPluginId, target.expectedDigest,
|
|
699
|
+
target.configDigest, target.disposition]),
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
const paths = [...new Set(footprints.map((entry) => entry.path))];
|
|
703
|
+
const canonical = new Map(await mapInstallReads(paths, async (value) => [value, await canonicalizePathThroughExistingAncestor(value)], { signal: plan.runtime.signal }));
|
|
704
|
+
for (const item of footprints)
|
|
705
|
+
item.path = canonical.get(item.path);
|
|
706
|
+
for (let index = 0; index < footprints.length; index += 1) {
|
|
707
|
+
const left = footprints[index];
|
|
708
|
+
for (const right of footprints.slice(index + 1)) {
|
|
709
|
+
const overlap = left.path === right.path || left.path.startsWith(right.path + path.sep) || right.path.startsWith(left.path + path.sep);
|
|
710
|
+
if (!overlap || left.identity === right.identity
|
|
711
|
+
|| (left.nativeGroup !== undefined && left.nativeGroup === right.nativeGroup)
|
|
712
|
+
|| (left.sharedMarketplaceSource !== undefined && left.agent === right.agent
|
|
713
|
+
&& left.sharedMarketplaceSource === right.sharedMarketplaceSource)
|
|
714
|
+
|| (left.sharedNative && right.sharedNative && left.agent === right.agent))
|
|
715
|
+
continue;
|
|
716
|
+
for (const footprint of [left, right]) {
|
|
717
|
+
for (const pluginId of footprint.pluginIds) {
|
|
718
|
+
const target = pair(plan, pluginId, footprint.agent);
|
|
719
|
+
if (target)
|
|
720
|
+
block(target, 'artifactCollision');
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
for (const prepared of plan.portableGroups) {
|
|
726
|
+
const layout = portableRecoveryLayout(plan.context);
|
|
727
|
+
plan.changes.push(`${prepared.options.selector}:AW 写入所选 Agent 的 owned Skill 目录;准备目录 ${layout.generationRoot}。`);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
export async function prepareScopedRecovery(command, selectors, options, runtime = {}, { catalogReadScope, nativeObservationBatch, portableGenerations = new Map() } = {}) {
|
|
731
|
+
runtime = { ...runtime, preparedArtifactRenderResults: runtime.preparedArtifactRenderResults ?? new Map() };
|
|
732
|
+
options.signal?.throwIfAborted();
|
|
733
|
+
const context = await createScopeContext({ scope: options.scope, cwd: options.cwd, env: options.env });
|
|
734
|
+
try {
|
|
735
|
+
options.signal?.throwIfAborted();
|
|
736
|
+
options = { ...options, cwd: context.executionCwd, env: context.env };
|
|
737
|
+
let demand = options.demandOverride ?? await readDemand({ ...options, preferences: undefined });
|
|
738
|
+
const refreshFailures = new Map();
|
|
739
|
+
const sourceRefreshes = [];
|
|
740
|
+
if (options.refresh && command === 'sync') {
|
|
741
|
+
let selected = [];
|
|
742
|
+
try {
|
|
743
|
+
selected = selectRoots(demand, selectors, options.all ?? false);
|
|
744
|
+
}
|
|
745
|
+
catch { /* Selection below reports the invalid request without refreshing any source. */ }
|
|
746
|
+
if (selected.length > 0) {
|
|
747
|
+
const config = await readCatalogSourcesConfigSnapshot(options.env);
|
|
748
|
+
const generationState = await readCatalogGenerationState(options.env);
|
|
749
|
+
for (const sourceId of new Set(selected.map((id) => parsePluginId(id).sourceId))) {
|
|
750
|
+
try {
|
|
751
|
+
const source = config.config.sources.find((entry) => entry.id === sourceId);
|
|
752
|
+
const probe = await probeCatalogSourceGeneration({ sourceId, env: options.env,
|
|
753
|
+
cliVersion: options.cliVersion, signal: options.signal, runtime: runtime.catalogGenerationRuntime });
|
|
754
|
+
const previousActive = generationState.sources[sourceId]?.active ?? null;
|
|
755
|
+
const candidateChanged = !previousActive
|
|
756
|
+
|| previousActive.sourceConfigFingerprint !== probe.candidate.sourceConfigFingerprint
|
|
757
|
+
|| previousActive.sourceIdentity !== probe.candidate.sourceIdentity
|
|
758
|
+
|| previousActive.logicalIdentity !== probe.candidate.logicalIdentity
|
|
759
|
+
|| previousActive.requestedRef !== probe.candidate.requestedRef
|
|
760
|
+
|| previousActive.manifestDigest !== probe.candidate.manifestDigest
|
|
761
|
+
|| previousActive.snapshotDigest !== probe.candidate.snapshotDigest
|
|
762
|
+
|| previousActive.resolvedCommit !== probe.candidate.resolvedCommit;
|
|
763
|
+
if (!candidateChanged)
|
|
764
|
+
continue;
|
|
765
|
+
const inspectImpact = runtime.catalogGenerationRuntime?.inspectSourceImpact
|
|
766
|
+
?? inspectCatalogSourceImpact;
|
|
767
|
+
const impact = await inspectImpact({ sourceId, cwd: options.cwd, env: options.env,
|
|
768
|
+
sourcePrimary: source?.primary === true, mode: 'generation', candidateManifest: probe.manifest });
|
|
769
|
+
sourceRefreshes.push({ sourceId, candidate: probe.candidate, previousActive,
|
|
770
|
+
configDigest: config.digest, impact, impactDigest: calculateCatalogSourceImpactDigest(impact) });
|
|
771
|
+
}
|
|
772
|
+
catch (error) {
|
|
773
|
+
if (recoveryInterruptionCode(error, options.signal))
|
|
774
|
+
throw error;
|
|
775
|
+
const code = errorCode(error, 'catalogGenerationRefreshFailed');
|
|
776
|
+
refreshFailures.set(sourceId, code.startsWith('catalog') ? code : 'catalogGenerationRefreshFailed');
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
options.signal?.throwIfAborted();
|
|
782
|
+
const originalIntent = intentEvidence(demand.intent);
|
|
783
|
+
const proposed = command === 'install'
|
|
784
|
+
? await addRequirements({ ...options, selectors, dryRun: true, installSelectors: true }) : undefined;
|
|
785
|
+
if (proposed?.state && proposed.errors.length === 0) {
|
|
786
|
+
const rawBytes = Buffer.from(JSON.stringify(proposed.state));
|
|
787
|
+
demand = await readDemand({ ...options, preferences: undefined, intent: {
|
|
788
|
+
state: 'valid', value: proposed.state, rawBytes,
|
|
789
|
+
digest: calculateIntentDigest(proposed.state), rawDigest: originalIntent,
|
|
790
|
+
} });
|
|
791
|
+
}
|
|
792
|
+
const receipt = {
|
|
793
|
+
schemaVersion: 1, kind: 'aw-recovery', scope: options.scope, command, ok: false,
|
|
794
|
+
intent: { state: demand.intent.state, ...('digest' in demand.intent ? { digest: demand.intent.digest } : {}),
|
|
795
|
+
roots: demand.roots?.map((root) => root.pluginId) ?? null },
|
|
796
|
+
requestedRoots: [], requestedTargets: [], selection: { agents: [], origin: 'none', preferences: demand.preferences.state },
|
|
797
|
+
blockers: proposed?.errors ?? [], errors: [], targetResults: [], remainingTargets: [], recoveryActions: [],
|
|
798
|
+
declarationChanged: false, preferencesChanged: false, configChanged: false, outputsMayHaveChanged: false,
|
|
799
|
+
};
|
|
800
|
+
const { signal: _signal, ...executionOptions } = options;
|
|
801
|
+
const plan = { command, options: executionOptions, receipt, demand, context, originalIntent,
|
|
802
|
+
plannedImpact: { declaration: proposed?.changed === true, preferences: false, config: false, outputs: false },
|
|
803
|
+
preferencesEvidence: preferenceEvidence(demand), changes: [], warnings: [],
|
|
804
|
+
nativeGroups: [], portableGroups: [],
|
|
805
|
+
portableProtectionGroups: [], runtime,
|
|
806
|
+
portableResidues: [], sourceRefreshes,
|
|
807
|
+
sourceRefreshFailures: [...refreshFailures].map(([sourceId, code]) => ({ sourceId, code })),
|
|
808
|
+
blockExecution: false,
|
|
809
|
+
...(proposed?.state && proposed.errors.length === 0 ? { declaration: proposed.roots } : {}),
|
|
810
|
+
};
|
|
811
|
+
if (proposed?.changed)
|
|
812
|
+
plan.changes.push(`保存 ${options.scope} 插件需求:${proposed.roots.join('、')}。`);
|
|
813
|
+
const preciseCleanup = (command === 'cleanup' || command === 'uninstall') && selectors.length > 0
|
|
814
|
+
&& options.targets !== undefined;
|
|
815
|
+
try {
|
|
816
|
+
receipt.selection = selectAgents({ preferences: preciseCleanup ? { state: 'absent' } : demand.preferences,
|
|
817
|
+
targets: options.targets });
|
|
818
|
+
receipt.requestedRoots = preciseCleanup ? [...new Set(selectors.map((selector) => {
|
|
819
|
+
const parsed = parsePluginId(selector);
|
|
820
|
+
if (!parsed.sourceId)
|
|
821
|
+
throw new Error('cleanupPluginIdRequired');
|
|
822
|
+
return `${parsed.sourceId}/${parsed.pluginName}`;
|
|
823
|
+
}))] : selectRoots(demand, selectors, options.all ?? false);
|
|
824
|
+
}
|
|
825
|
+
catch (error) {
|
|
826
|
+
receipt.blockers.push(diagnostic(errorCode(error, 'projectSelectionInvalid')));
|
|
827
|
+
}
|
|
828
|
+
if (options.exactTargets && (options.exactTargets.length === 0 || options.exactTargets.some((target) => !receipt.requestedRoots.includes(target.pluginId) || !receipt.selection.agents.includes(target.agent)))) {
|
|
829
|
+
receipt.blockers.push(diagnostic('invalidExactTargets'));
|
|
830
|
+
}
|
|
831
|
+
if (!preciseCleanup) {
|
|
832
|
+
if (!['valid', 'absent'].includes(demand.intent.state))
|
|
833
|
+
receipt.blockers.push(diagnostic('pluginIntentStateInvalid'));
|
|
834
|
+
}
|
|
835
|
+
if (receipt.requestedRoots.length && !receipt.selection.agents.length)
|
|
836
|
+
receipt.blockers.push(diagnostic('localTargetsRequired'));
|
|
837
|
+
if (!preciseCleanup)
|
|
838
|
+
receipt.blockers.push(...demand.errors);
|
|
839
|
+
plan.blockExecution = Boolean(proposed?.errors.length)
|
|
840
|
+
|| receipt.blockers.length > 0;
|
|
841
|
+
for (const [sourceId, code] of refreshFailures) {
|
|
842
|
+
receipt.blockers.push({ code, message: `${sourceId}:${diagnostic('sourceRefreshFailed').message}` });
|
|
843
|
+
}
|
|
844
|
+
for (const root of demand.roots ?? []) {
|
|
845
|
+
if (!receipt.requestedRoots.includes(root.pluginId) || preciseCleanup)
|
|
846
|
+
continue;
|
|
847
|
+
receipt.blockers.push(...root.blockers.map((code) => ({ ...diagnostic(code), message: `${root.pluginId}:${diagnostic(code).message}` })));
|
|
848
|
+
}
|
|
849
|
+
for (const pluginId of receipt.requestedRoots) {
|
|
850
|
+
const root = demand.roots?.find((entry) => entry.pluginId === pluginId);
|
|
851
|
+
const agents = receipt.selection.agents;
|
|
852
|
+
for (const agent of agents) {
|
|
853
|
+
if (options.exactTargets
|
|
854
|
+
&& !options.exactTargets.some((target) => target.pluginId === pluginId && target.agent === agent))
|
|
855
|
+
continue;
|
|
856
|
+
const resolvedDelivery = root?.plugin ? resolveDelivery(root.plugin.manifest, agent, options.scope) ?? null : null;
|
|
857
|
+
const delivery = preciseCleanup ? isPortableAgent(agent)
|
|
858
|
+
? { kind: 'agent-skills', provider: 'aw', agentId: 'generic' }
|
|
859
|
+
: { kind: 'native', platform: agent } : resolvedDelivery;
|
|
860
|
+
const configPackageBlocker = delivery?.kind === 'native' && options.existingOnly
|
|
861
|
+
? runtime.configApplyPackages?.targets.find((target) => target.pluginId === pluginId
|
|
862
|
+
&& target.platforms.includes(delivery.platform))?.blocker : undefined;
|
|
863
|
+
receipt.targetResults.push({ pluginId, agent, scope: options.scope, delivery, execution: 'not-run', observation: 'unknown',
|
|
864
|
+
blockers: [...(preciseCleanup ? [] : root?.blockers ?? []).map(diagnostic),
|
|
865
|
+
...(configPackageBlocker ? [configPackageBlocker] : []),
|
|
866
|
+
...(refreshFailures.has(parsePluginId(pluginId).sourceId)
|
|
867
|
+
? [diagnostic(refreshFailures.get(parsePluginId(pluginId).sourceId))] : []),
|
|
868
|
+
...(!delivery ? [diagnostic(preciseCleanup ? 'backend-action-unsupported' : 'deliveryUnsupported')] : [])],
|
|
869
|
+
requiredBy: [pluginId] });
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
if (plan.blockExecution)
|
|
873
|
+
return { ...plan, receipt: completeReceipt(receipt) };
|
|
874
|
+
if (sourceRefreshes.length > 0) {
|
|
875
|
+
for (const refresh of sourceRefreshes) {
|
|
876
|
+
plan.changes.push(`刷新 Catalog 来源 ${refresh.sourceId},确认后激活已检查的候选 generation。`);
|
|
877
|
+
if (!refresh.impact.inventoryComplete) {
|
|
878
|
+
plan.warnings.push(`${refresh.sourceId}:来源影响清单不完整,需要明确确认。`);
|
|
879
|
+
}
|
|
880
|
+
else if (refresh.impact.affectedReferences.length > 0) {
|
|
881
|
+
plan.warnings.push(`${refresh.sourceId}:来源更新会影响 ${refresh.impact.affectedReferences.length} 个已知引用,需要明确确认。`);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
return { ...plan, receipt: completeReceipt(receipt) };
|
|
885
|
+
}
|
|
886
|
+
const groups = new Map();
|
|
887
|
+
for (const target of receipt.targetResults) {
|
|
888
|
+
if (target.blockers.length || target.delivery?.kind !== 'native')
|
|
889
|
+
continue;
|
|
890
|
+
const command = plan.command;
|
|
891
|
+
const key = `${parsePluginId(target.pluginId).sourceId}\0${target.delivery.platform}\0${command}`;
|
|
892
|
+
const group = groups.get(key) ?? { command, targets: [] };
|
|
893
|
+
group.targets.push({ pluginId: target.pluginId, platform: target.delivery.platform });
|
|
894
|
+
groups.set(key, group);
|
|
895
|
+
}
|
|
896
|
+
const preparationRuntime = { ...runtime, signal: options.signal, nativeObservationBatch };
|
|
897
|
+
const pendingGroups = [...groups.values()].map((pending) => ({
|
|
898
|
+
...nativeTargetSelection(pending.targets), command: pending.command,
|
|
899
|
+
}));
|
|
900
|
+
const previews = await readNativeGroups(pendingGroups, async (group) => {
|
|
901
|
+
try {
|
|
902
|
+
const preview = await nativeOperation(plan, group.pluginIds, group.platform, true, preparationRuntime, group.command, group.targets, catalogReadScope);
|
|
903
|
+
return { ok: true, preview };
|
|
904
|
+
}
|
|
905
|
+
catch (error) {
|
|
906
|
+
if (recoveryInterruptionCode(error, options.signal))
|
|
907
|
+
throw error;
|
|
908
|
+
return { ok: false, error };
|
|
909
|
+
}
|
|
910
|
+
}, options.signal);
|
|
911
|
+
for (const [index, group] of pendingGroups.entries()) {
|
|
912
|
+
const result = previews[index];
|
|
913
|
+
if (result.ok) {
|
|
914
|
+
const { preview } = result;
|
|
915
|
+
const nativeGroup = { ...group, preview };
|
|
916
|
+
plan.nativeGroups.push(nativeGroup);
|
|
917
|
+
nativeResults(plan, nativeGroup, preview, false);
|
|
918
|
+
plan.changes.push(...(preview.operationPlan?.changes ?? []));
|
|
919
|
+
const nativeToolChanges = preview.operationPlan ? operationPlanNativeToolChanges(preview.operationPlan) : [];
|
|
920
|
+
if (nativeToolChanges.length)
|
|
921
|
+
receipt.nativeToolChanges = [...(receipt.nativeToolChanges ?? []), ...nativeToolChanges];
|
|
922
|
+
for (const change of nativeToolChanges) {
|
|
923
|
+
for (const [verb, closure] of [['撤销', change.before], ['使用', change.after]]) {
|
|
924
|
+
if (closure)
|
|
925
|
+
plan.changes.push(...describeNativeToolClosure(closure).map((description) => `${verb}原生工具 · ${change.producer.sourceId}/${change.producer.pluginName} · ${description}`));
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
for (const override of preview.dependencyPlan?.scopeOverrides ?? []) {
|
|
929
|
+
if (options.dependencyScopeOverrides?.some((requested) => requested.pluginId === override.pluginId
|
|
930
|
+
&& (!requested.platform || requested.platform === override.platform))) {
|
|
931
|
+
plan.changes.push(`推导的依赖提供位置:${override.pluginId}#${override.platform}=${override.scope}。`);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
plan.warnings.push(...preview.warnings);
|
|
935
|
+
}
|
|
936
|
+
else {
|
|
937
|
+
const { error } = result;
|
|
938
|
+
if (error instanceof CatalogSourceInventoryIncompleteError) {
|
|
939
|
+
receipt.blockers.push(...error.inventory.errors.map(inventoryRecoveryDiagnostic));
|
|
940
|
+
}
|
|
941
|
+
for (const { pluginId, platform } of group.targets) {
|
|
942
|
+
block(pair(plan, pluginId, agentForPlatform(platform)), errorCode(error, 'nativePreparationFailed'));
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
const portableReads = receipt.requestedRoots.flatMap((pluginId) => {
|
|
947
|
+
const agents = receipt.targetResults.filter((target) => target.pluginId === pluginId
|
|
948
|
+
&& !target.blockers.length && target.delivery?.kind === 'agent-skills').map((target) => target.agent).filter(isPortableAgent);
|
|
949
|
+
return agents.length ? [{ pluginId, agents }] : [];
|
|
950
|
+
});
|
|
951
|
+
const preparedGroups = await mapInstallReads(portableReads, async ({ pluginId, agents }) => {
|
|
952
|
+
try {
|
|
953
|
+
const prepared = command === 'cleanup' || command === 'uninstall'
|
|
954
|
+
? await preparePortableCleanup({ scope: options.scope, context, selector: pluginId, agents, force: options.force, signal: options.signal })
|
|
955
|
+
: await preparePortableRecovery({ scope: options.scope, context, selector: pluginId, agents,
|
|
956
|
+
env: options.env, cliVersion: options.cliVersion, signal: options.signal,
|
|
957
|
+
catalogOperationContext: demand.catalogOperationContext, excludedPluginIds: options.excludedPluginIds }, catalogReadScope, portableGenerations);
|
|
958
|
+
return { ok: true, prepared };
|
|
959
|
+
}
|
|
960
|
+
catch (error) {
|
|
961
|
+
if (recoveryInterruptionCode(error, options.signal))
|
|
962
|
+
throw error;
|
|
963
|
+
return { ok: false, agents, pluginId, code: errorCode(error, 'portablePreparationFailed') };
|
|
964
|
+
}
|
|
965
|
+
}, { signal: options.signal });
|
|
966
|
+
for (const result of preparedGroups) {
|
|
967
|
+
if (result.ok)
|
|
968
|
+
plan.portableGroups.push(result.prepared);
|
|
969
|
+
else
|
|
970
|
+
for (const agent of result.agents)
|
|
971
|
+
block(pair(plan, result.pluginId, agent), result.code);
|
|
972
|
+
}
|
|
973
|
+
for (const prepared of plan.portableGroups)
|
|
974
|
+
portableResults(plan, prepared);
|
|
975
|
+
preparePortablePreApplyAuthorization(plan);
|
|
976
|
+
if (command !== 'cleanup' && command !== 'uninstall') {
|
|
977
|
+
// Complete scope demand protects copies contributed by unselected roots and their dependencies.
|
|
978
|
+
const desiredAgents = new Set([...receipt.selection.agents,
|
|
979
|
+
...(demand.preferences.state === 'valid' ? demand.preferences.value.targets : [])]);
|
|
980
|
+
const protection = await mapInstallReads(demand.roots ?? [], async (root) => {
|
|
981
|
+
const portableAgents = [...desiredAgents].filter(isPortableAgent).filter((agent) => root.plugin
|
|
982
|
+
&& resolveDelivery(root.plugin.manifest, agent, options.scope)?.kind === 'agent-skills');
|
|
983
|
+
if (!portableAgents.length || plan.portableGroups.some((group) => group.options.selector === root.pluginId
|
|
984
|
+
&& portableAgents.every((agent) => group.options.agents.includes(agent))))
|
|
985
|
+
return;
|
|
986
|
+
try {
|
|
987
|
+
const prepared = await preparePortableRecovery({ scope: options.scope, context, selector: root.pluginId,
|
|
988
|
+
env: options.env, agents: portableAgents, cliVersion: options.cliVersion, signal: options.signal,
|
|
989
|
+
catalogOperationContext: demand.catalogOperationContext, excludedPluginIds: options.excludedPluginIds }, catalogReadScope, portableGenerations);
|
|
990
|
+
if (!prepared.globalBlockers.length)
|
|
991
|
+
return prepared;
|
|
992
|
+
}
|
|
993
|
+
catch (error) {
|
|
994
|
+
if (recoveryInterruptionCode(error, options.signal))
|
|
995
|
+
throw error;
|
|
996
|
+
// Missing current Portable evidence cannot protect historical residue.
|
|
997
|
+
}
|
|
998
|
+
}, { signal: options.signal });
|
|
999
|
+
plan.portableProtectionGroups = protection.filter((prepared) => prepared !== undefined);
|
|
1000
|
+
}
|
|
1001
|
+
options.signal?.throwIfAborted();
|
|
1002
|
+
await checkFootprints(plan);
|
|
1003
|
+
options.signal?.throwIfAborted();
|
|
1004
|
+
for (const prepared of [...plan.portableGroups, ...plan.portableProtectionGroups]) {
|
|
1005
|
+
delete prepared.options.signal;
|
|
1006
|
+
}
|
|
1007
|
+
plan.plannedImpact.outputs = !plan.blockExecution && (plan.nativeGroups.some((group) => (group.preview.operationPlan?.actions.length ?? 0) > 0
|
|
1008
|
+
&& nativeGroupTargets(group).some(({ pluginId, platform }) => pair(plan, pluginId, agentForPlatform(platform))?.blockers.length === 0))
|
|
1009
|
+
|| (plan.portableGroups.some((group) => group.targets.some((target) => pair(plan, group.options.selector, target.agent)?.blockers.length === 0
|
|
1010
|
+
&& (group.mode === 'cleanup' || target.observation === 'absent' || target.observation === 'drifted'
|
|
1011
|
+
|| (command === 'reinstall' && target.observation === 'satisfied' && target.ownership === 'aw'))))));
|
|
1012
|
+
completeReceipt(receipt);
|
|
1013
|
+
return plan;
|
|
1014
|
+
}
|
|
1015
|
+
catch (error) {
|
|
1016
|
+
await context.dispose();
|
|
1017
|
+
throw error;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
export async function activateRecoverySourcesAndReprepare(plan, execution = {}) {
|
|
1021
|
+
if (plan.sourceRefreshes.length === 0)
|
|
1022
|
+
return plan;
|
|
1023
|
+
const runtime = { ...plan.runtime, ...execution.runtime };
|
|
1024
|
+
const failures = new Map(plan.sourceRefreshFailures.map(({ sourceId, code }) => [sourceId, code]));
|
|
1025
|
+
try {
|
|
1026
|
+
for (const refresh of plan.sourceRefreshes) {
|
|
1027
|
+
try {
|
|
1028
|
+
await activateCatalogSourceGeneration({
|
|
1029
|
+
sourceId: refresh.sourceId,
|
|
1030
|
+
cliVersion: plan.options.cliVersion,
|
|
1031
|
+
cwd: plan.options.cwd,
|
|
1032
|
+
env: plan.options.env,
|
|
1033
|
+
impactConfirmed: true,
|
|
1034
|
+
expectedImpactDigest: refresh.impactDigest,
|
|
1035
|
+
expectedCandidate: refresh.candidate,
|
|
1036
|
+
expectedActive: refresh.previousActive,
|
|
1037
|
+
expectedConfigDigest: refresh.configDigest,
|
|
1038
|
+
runtime: runtime.catalogGenerationRuntime,
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
catch (error) {
|
|
1042
|
+
const code = errorCode(error, 'catalogGenerationRefreshFailed');
|
|
1043
|
+
failures.set(refresh.sourceId, code.startsWith('catalog') ? code : 'catalogGenerationRefreshFailed');
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
const failedSourceIds = new Set(failures.keys());
|
|
1047
|
+
const originalExactTargets = plan.options.exactTargets
|
|
1048
|
+
?? plan.receipt.targetResults.map(({ pluginId, agent }) => ({ pluginId, agent }));
|
|
1049
|
+
const exactTargets = failures.size > 0
|
|
1050
|
+
? originalExactTargets.filter((target) => !failedSourceIds.has(parsePluginId(target.pluginId).sourceId))
|
|
1051
|
+
: plan.options.exactTargets;
|
|
1052
|
+
const next = await prepareRecovery(plan.command, plan.receipt.requestedRoots, {
|
|
1053
|
+
...plan.options,
|
|
1054
|
+
all: false,
|
|
1055
|
+
refresh: false,
|
|
1056
|
+
...(exactTargets ? { exactTargets } : {}),
|
|
1057
|
+
}, { ...runtime, preparedArtifactRenderResults: new Map() });
|
|
1058
|
+
if (failures.size === 0)
|
|
1059
|
+
return next;
|
|
1060
|
+
if (exactTargets?.length === 0) {
|
|
1061
|
+
next.receipt.blockers = next.receipt.blockers.filter((entry) => entry.code !== 'invalidExactTargets');
|
|
1062
|
+
next.blockExecution = true;
|
|
1063
|
+
}
|
|
1064
|
+
for (const [sourceId, code] of failures) {
|
|
1065
|
+
next.receipt.blockers.push({ code, message: `${sourceId}:${diagnostic('sourceRefreshFailed').message}` });
|
|
1066
|
+
}
|
|
1067
|
+
for (const target of plan.receipt.targetResults) {
|
|
1068
|
+
const sourceId = parsePluginId(target.pluginId).sourceId;
|
|
1069
|
+
const code = failures.get(sourceId);
|
|
1070
|
+
if (!code || next.receipt.targetResults.some((entry) => entry.pluginId === target.pluginId && entry.agent === target.agent))
|
|
1071
|
+
continue;
|
|
1072
|
+
const failed = structuredClone(target);
|
|
1073
|
+
block(failed, code);
|
|
1074
|
+
next.receipt.targetResults.push(failed);
|
|
1075
|
+
}
|
|
1076
|
+
next.receipt = completeReceipt(next.receipt);
|
|
1077
|
+
return next;
|
|
1078
|
+
}
|
|
1079
|
+
finally {
|
|
1080
|
+
await plan.context.dispose();
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
function portablePrewriteBinding(context, sourceId) {
|
|
1084
|
+
const source = context?.catalog.sources[0]?.resolution;
|
|
1085
|
+
const generation = context?.generationSet.sources[0];
|
|
1086
|
+
if (!context || context.catalog.sources.length !== 1 || context.generationSet.sources.length !== 1
|
|
1087
|
+
|| !source || !generation || source.sourceId !== sourceId || generation.sourceId !== sourceId
|
|
1088
|
+
|| source.rootDir !== generation.snapshotPath || source.sourceIdentity !== generation.sourceIdentity
|
|
1089
|
+
|| source.logicalIdentity !== generation.logicalIdentity || source.resolvedCommit !== generation.resolvedCommit
|
|
1090
|
+
|| source.manifestDigest !== generation.manifestDigest || source.snapshotDigest !== generation.snapshotDigest)
|
|
1091
|
+
return;
|
|
1092
|
+
return JSON.stringify([context.generationSetDigest,
|
|
1093
|
+
createCatalogPreparationStoreKey({ ...generation, requestedRef: source.requestedRef })]);
|
|
1094
|
+
}
|
|
1095
|
+
async function recheckPortableRecovery(plan, groups = plan.portableGroups, progress) {
|
|
1096
|
+
const executable = groups.filter(({ options }) => !options.agents.every((agent) => pair(plan, options.selector, agent)?.blockers.length));
|
|
1097
|
+
const providers = new Set(executable.flatMap((group) => plan.options.portableProviderChecks?.get(group.options.selector) ?? []));
|
|
1098
|
+
const inspections = [
|
|
1099
|
+
...executable,
|
|
1100
|
+
...plan.portableProtectionGroups,
|
|
1101
|
+
...providers,
|
|
1102
|
+
];
|
|
1103
|
+
if (!inspections.length)
|
|
1104
|
+
return;
|
|
1105
|
+
const readScope = new CatalogPreparationReadScope({ env: plan.context.env, signal: plan.runtime.signal });
|
|
1106
|
+
const active = new Map();
|
|
1107
|
+
const problems = await mapInstallReads(inspections, async (prepared) => {
|
|
1108
|
+
let current;
|
|
1109
|
+
const sourceId = parsePluginId(prepared.options.selector).sourceId;
|
|
1110
|
+
const reviewed = prepared.options.catalogOperationContext;
|
|
1111
|
+
if (sourceId && reviewed && prepared.mode === 'deploy') {
|
|
1112
|
+
try {
|
|
1113
|
+
let pending = active.get(sourceId);
|
|
1114
|
+
if (!pending) {
|
|
1115
|
+
pending = readScope.resolve({ sourceIds: [sourceId] }, true);
|
|
1116
|
+
active.set(sourceId, pending);
|
|
1117
|
+
}
|
|
1118
|
+
current = await pending;
|
|
1119
|
+
const original = selectCatalogOperationContext(reviewed, [sourceId]);
|
|
1120
|
+
if (portablePrewriteBinding(current, sourceId) !== portablePrewriteBinding(original, sourceId)) {
|
|
1121
|
+
return diagnostic('operationReviewStale');
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
catch (error) {
|
|
1125
|
+
if (recoveryInterruptionCode(error, plan.runtime.signal))
|
|
1126
|
+
throw error;
|
|
1127
|
+
return { ...diagnostic('operationReviewStale'), subject: { sourceId },
|
|
1128
|
+
detail: { reasonCode: error instanceof CatalogGenerationError ? error.code : 'catalogReadFailed' } };
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
const checked = await inspectPortableRecovery({ ...prepared.options, catalogOperationContext: current,
|
|
1132
|
+
signal: plan.runtime.signal }, readScope);
|
|
1133
|
+
// The provider ran first. Its original missing state is never sufficient for a consumer.
|
|
1134
|
+
if (providers.has(prepared) && !isHealthyPortableProvider(checked)
|
|
1135
|
+
|| !await portableReviewMatches(prepared, checked, progress?.completed))
|
|
1136
|
+
return diagnostic('operationReviewStale');
|
|
1137
|
+
}, { signal: plan.runtime.signal });
|
|
1138
|
+
return problems.find((problem) => problem !== undefined);
|
|
1139
|
+
}
|
|
1140
|
+
async function executeNativeGroup(plan, group, nativeRuntime) {
|
|
1141
|
+
const { receipt } = plan;
|
|
1142
|
+
const running = new Set();
|
|
1143
|
+
try {
|
|
1144
|
+
const result = await nativeOperation(plan, group.pluginIds, group.platform, false, { ...nativeRuntime, onInstallTargetState(identity, state) {
|
|
1145
|
+
const target = identity.scope === plan.options.scope && identity.pluginId
|
|
1146
|
+
? pair(plan, identity.pluginId, identity.platform) : undefined;
|
|
1147
|
+
if (target && state === 'running')
|
|
1148
|
+
running.add(target);
|
|
1149
|
+
else if (target)
|
|
1150
|
+
running.delete(target);
|
|
1151
|
+
nativeRuntime.onInstallTargetState?.(identity, state);
|
|
1152
|
+
}, expectedPlanFingerprint: group.preview.operationPlan?.planFingerprint }, group.command, nativeGroupTargets(group));
|
|
1153
|
+
receipt.outputsMayHaveChanged ||= result.rebuildResults.some((result) => result.actions.some((action) => action.name === 'stale.cleanup' || action.name === 'native.write' || action.name === 'artifacts.write'
|
|
1154
|
+
|| action.name === 'recovery.cleanup' || action.name === 'cleanup.owned'))
|
|
1155
|
+
|| (result.commandResults ?? []).some(({ action, state }) => action !== 'unchanged' || state === 'partial');
|
|
1156
|
+
nativeResults(plan, group, result, true);
|
|
1157
|
+
}
|
|
1158
|
+
catch (error) {
|
|
1159
|
+
if (error instanceof RebuildInterruptedError) {
|
|
1160
|
+
const recorded = error.result;
|
|
1161
|
+
const targets = nativeGroupTargets(group).filter(({ pluginId, platform }) => recorded.targetResults.some((entry) => entry.target.pluginId === pluginId && entry.target.platform === platform));
|
|
1162
|
+
nativeResults(plan, { ...group, targets }, recorded, true);
|
|
1163
|
+
receipt.outputsMayHaveChanged ||= recorded.rebuildResults.some((entry) => entry.actions.length > 0 || entry.deploymentReceipts?.some((deployment) => deployment.effects.some((effect) => effect.mutation !== 'none')))
|
|
1164
|
+
|| recorded.commandResults?.some((command) => command.state === 'completed') === true;
|
|
1165
|
+
}
|
|
1166
|
+
const interruption = recoveryInterruptionCode(error, nativeRuntime.signal);
|
|
1167
|
+
if (interruption) {
|
|
1168
|
+
for (const target of running) {
|
|
1169
|
+
target.execution = 'partial';
|
|
1170
|
+
target.observation = 'unknown';
|
|
1171
|
+
target.content = 'unknown';
|
|
1172
|
+
block(target, interruption);
|
|
1173
|
+
receipt.outputsMayHaveChanged = true;
|
|
1174
|
+
}
|
|
1175
|
+
throw error;
|
|
1176
|
+
}
|
|
1177
|
+
const code = errorCode(error, 'nativeRecoveryFailed');
|
|
1178
|
+
receipt.outputsMayHaveChanged ||= code !== 'preApplyAuthorizationRequired';
|
|
1179
|
+
for (const { pluginId, platform } of nativeGroupTargets(group)) {
|
|
1180
|
+
const target = pair(plan, pluginId, agentForPlatform(platform));
|
|
1181
|
+
target.execution = 'failed';
|
|
1182
|
+
block(target, code);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
async function executePortableGroups(plan, groups, nativeRuntime, progress, jointChecked = false) {
|
|
1187
|
+
const { receipt } = plan;
|
|
1188
|
+
for (const prepared of groups) {
|
|
1189
|
+
let started = false;
|
|
1190
|
+
const onStart = () => {
|
|
1191
|
+
if (started)
|
|
1192
|
+
return;
|
|
1193
|
+
started = true;
|
|
1194
|
+
try {
|
|
1195
|
+
nativeRuntime.onInstallTargetState?.({ pluginId: prepared.options.selector,
|
|
1196
|
+
platform: 'generic', scope: plan.options.scope }, 'running');
|
|
1197
|
+
}
|
|
1198
|
+
catch { /* Display callbacks don't control execution. */ }
|
|
1199
|
+
};
|
|
1200
|
+
const providers = plan.options.portableProviderChecks?.get(prepared.options.selector);
|
|
1201
|
+
const checkPrewrite = jointChecked || providers?.length ? () => recheckPortableRecovery(plan, [prepared], progress) : undefined;
|
|
1202
|
+
const agents = [];
|
|
1203
|
+
for (const agent of prepared.options.agents) {
|
|
1204
|
+
if (pair(plan, prepared.options.selector, agent).blockers.length)
|
|
1205
|
+
continue;
|
|
1206
|
+
const outcomes = prepared.targets.filter((entry) => entry.agent === agent).map((entry) => {
|
|
1207
|
+
const failed = progress.failed.find((failure) => failure.logicalIdentity === prepared.logicalIdentity
|
|
1208
|
+
&& failure.outcome.physicalPath === entry.physicalPath && failure.outcome.expectedDigest === entry.expectedDigest
|
|
1209
|
+
&& failure.outcome.providerPluginId === entry.providerPluginId);
|
|
1210
|
+
return failed ? { ...failed.outcome, agent } : { ...entry, execution: 'not-run', blockers: [] };
|
|
1211
|
+
});
|
|
1212
|
+
if (outcomes.some((entry) => entry.execution === 'failed')) {
|
|
1213
|
+
portableOutcomes(plan, prepared, agent, outcomes, []);
|
|
1214
|
+
continue;
|
|
1215
|
+
}
|
|
1216
|
+
const hasScript = plan.preApplyAuthorization?.some((target) => target.platform === agent
|
|
1217
|
+
&& portablePluginClosure(plan, prepared).some((plugin) => plugin.pluginId === target.pluginId));
|
|
1218
|
+
const preApply = async () => {
|
|
1219
|
+
onStart();
|
|
1220
|
+
const stale = await checkPrewrite?.();
|
|
1221
|
+
if (stale) {
|
|
1222
|
+
receipt.blockers.push(stale);
|
|
1223
|
+
return stale.code;
|
|
1224
|
+
}
|
|
1225
|
+
return executePortablePreApply(plan, prepared, agent, nativeRuntime);
|
|
1226
|
+
};
|
|
1227
|
+
const preApplyFailure = !hasScript ? undefined : nativeRuntime.installAdmission
|
|
1228
|
+
? await nativeRuntime.installAdmission.run([{ kind: 'exclusive' }], preApply, nativeRuntime.signal) : await preApply();
|
|
1229
|
+
if (preApplyFailure) {
|
|
1230
|
+
const target = pair(plan, prepared.options.selector, agent);
|
|
1231
|
+
portableOutcomes(plan, prepared, agent, prepared.targets.filter((entry) => entry.agent === agent)
|
|
1232
|
+
.map((entry) => unobservedPortableTarget(entry, preApplyFailure)), [preApplyFailure]);
|
|
1233
|
+
if (preApplyFailure !== 'operationReviewStale')
|
|
1234
|
+
target.execution = 'failed';
|
|
1235
|
+
target.recoveryActions = [`aw plugin sync ${target.pluginId} --context ${target.scope} --target ${agent}`
|
|
1236
|
+
+ (preApplyFailure === 'operationReviewStale' ? '' : ' --yes')];
|
|
1237
|
+
continue;
|
|
1238
|
+
}
|
|
1239
|
+
agents.push(agent);
|
|
1240
|
+
}
|
|
1241
|
+
if (!agents.length)
|
|
1242
|
+
continue;
|
|
1243
|
+
let interruption;
|
|
1244
|
+
const result = await executePortableRecovery({ prepared, token: nativeRuntime.awHomeMutationToken, authorizeUpdate: plan.options.yes,
|
|
1245
|
+
action: plan.command === 'install' ? 'sync' : plan.command, force: plan.options.force,
|
|
1246
|
+
targets: prepared.targets.filter((target) => agents.includes(target.agent)).map(({ skill, agent }) => ({ skill, agent })),
|
|
1247
|
+
progress, checkPrewrite, readProviders: providers, onStart, admission: nativeRuntime.installAdmission, signal: nativeRuntime.signal }).catch((error) => {
|
|
1248
|
+
if (!(error instanceof PortableInterruptedError))
|
|
1249
|
+
throw error;
|
|
1250
|
+
interruption = error;
|
|
1251
|
+
return error.result;
|
|
1252
|
+
});
|
|
1253
|
+
if (result.reviewProblem)
|
|
1254
|
+
receipt.blockers.push(result.reviewProblem);
|
|
1255
|
+
receipt.outputsMayHaveChanged ||= result.outputsMayHaveChanged;
|
|
1256
|
+
for (const agent of agents) {
|
|
1257
|
+
portableOutcomes(plan, prepared, agent, result.targets.filter((entry) => entry.agent === agent), result.globalBlockers);
|
|
1258
|
+
if (interruption && result.outputsMayHaveChanged) {
|
|
1259
|
+
const target = pair(plan, prepared.options.selector, agent);
|
|
1260
|
+
if (target.execution === 'failed')
|
|
1261
|
+
target.execution = 'partial';
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
if (interruption)
|
|
1265
|
+
throw interruption.cause;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
/** The joint coordinator holds the write lock and has checked this complete child against Review. */
|
|
1269
|
+
export async function executeCheckedScopedInstall(child, execution) {
|
|
1270
|
+
if (!execution.runtime.awHomeMutationToken || child.command !== 'sync' && child.command !== 'reinstall') {
|
|
1271
|
+
throw new Error('checkedScopedInstallUnavailable');
|
|
1272
|
+
}
|
|
1273
|
+
const selected = (pluginId) => !execution.pluginIds || execution.pluginIds.includes(pluginId);
|
|
1274
|
+
const receipt = structuredClone({ ...child.receipt,
|
|
1275
|
+
targetResults: child.receipt.targetResults.filter((target) => selected(target.pluginId)),
|
|
1276
|
+
requestedRoots: child.receipt.requestedRoots.filter(selected),
|
|
1277
|
+
});
|
|
1278
|
+
const plan = { ...child, receipt, runtime: { ...child.runtime, ...execution.runtime }, options: { ...child.options, yes: execution.yes ?? child.options.yes } };
|
|
1279
|
+
if (receipt.nativeToolChanges?.length && plan.options.yes !== true) {
|
|
1280
|
+
receipt.blockers.push(diagnostic('nativeToolAuthorizationRequired'));
|
|
1281
|
+
return completeReceipt(receipt);
|
|
1282
|
+
}
|
|
1283
|
+
if (plan.blockExecution)
|
|
1284
|
+
return completeReceipt(receipt);
|
|
1285
|
+
const runtime = plan.runtime;
|
|
1286
|
+
try {
|
|
1287
|
+
for (const group of plan.nativeGroups) {
|
|
1288
|
+
const targets = nativeGroupTargets(group);
|
|
1289
|
+
const blocked = new Map();
|
|
1290
|
+
for (const { pluginId, platform } of targets) {
|
|
1291
|
+
const code = pair(plan, pluginId, platform)?.blockers[0]?.code;
|
|
1292
|
+
if (code)
|
|
1293
|
+
blocked.set([pluginId, platform, plan.options.scope].join('\0'), code);
|
|
1294
|
+
}
|
|
1295
|
+
if (blocked.size === targets.length)
|
|
1296
|
+
continue;
|
|
1297
|
+
await executeNativeGroup(plan, group, { ...runtime, nativeInstallBlockers: blocked });
|
|
1298
|
+
}
|
|
1299
|
+
await executePortableGroups(plan, plan.portableGroups.filter((group) => selected(group.options.selector)), runtime, execution.portableProgress, true);
|
|
1300
|
+
return completeReceipt(receipt);
|
|
1301
|
+
}
|
|
1302
|
+
catch (error) {
|
|
1303
|
+
const code = recoveryInterruptionCode(error, runtime.signal);
|
|
1304
|
+
if (!code)
|
|
1305
|
+
throw error;
|
|
1306
|
+
receipt.blockers.push(diagnostic(code));
|
|
1307
|
+
throw new RecoveryInterruptedError(completeReceipt(receipt), error);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
export async function executeScopedRecovery(plan, execution = {}) {
|
|
1311
|
+
if (plan.sourceRefreshes.length > 0) {
|
|
1312
|
+
const receipt = structuredClone(plan.receipt);
|
|
1313
|
+
receipt.blockers.push(diagnostic('sourceRefreshConfirmationRequired'));
|
|
1314
|
+
await plan.context.dispose();
|
|
1315
|
+
return completeReceipt(receipt);
|
|
1316
|
+
}
|
|
1317
|
+
const receipt = structuredClone(plan.receipt);
|
|
1318
|
+
plan = { ...plan, receipt, options: { ...plan.options, yes: execution.yes ?? plan.options.yes },
|
|
1319
|
+
runtime: { ...plan.runtime, ...execution.runtime } };
|
|
1320
|
+
try {
|
|
1321
|
+
if (receipt.nativeToolChanges?.length && plan.options.yes !== true) {
|
|
1322
|
+
receipt.blockers.push(diagnostic('nativeToolAuthorizationRequired'));
|
|
1323
|
+
return completeReceipt(receipt);
|
|
1324
|
+
}
|
|
1325
|
+
const freshContext = await createScopeContext({ scope: plan.options.scope,
|
|
1326
|
+
cwd: plan.context.callerCwd, env: plan.options.env });
|
|
1327
|
+
const environmentStable = freshContext.awHome === plan.context.awHome
|
|
1328
|
+
&& freshContext.generationRoot === plan.context.generationRoot
|
|
1329
|
+
&& freshContext.projectKey === plan.context.projectKey
|
|
1330
|
+
&& JSON.stringify(freshContext.targetHomes) === JSON.stringify(plan.context.targetHomes);
|
|
1331
|
+
await freshContext.dispose();
|
|
1332
|
+
const executionCwdStable = plan.options.scope !== 'user'
|
|
1333
|
+
|| await assertNeutralAncestorChain(plan.context.executionCwd)
|
|
1334
|
+
.then((value) => value === plan.context.executionCwd, () => false);
|
|
1335
|
+
if (!environmentStable || !executionCwdStable) {
|
|
1336
|
+
receipt.blockers.push(diagnostic('operationReviewStale'));
|
|
1337
|
+
return completeReceipt(receipt);
|
|
1338
|
+
}
|
|
1339
|
+
return await withAwHomeMutationLock({ env: plan.options.env, token: plan.runtime.awHomeMutationToken,
|
|
1340
|
+
action: async (token) => {
|
|
1341
|
+
const [actualIntent, current] = await Promise.all([
|
|
1342
|
+
observeIntent(plan.options),
|
|
1343
|
+
readDemand({ ...plan.options, preferences: undefined,
|
|
1344
|
+
...(plan.declaration || plan.options.demandOverride ? { intent: plan.demand.intent } : {}) }),
|
|
1345
|
+
]);
|
|
1346
|
+
if (intentEvidence(actualIntent) !== plan.originalIntent || preferenceEvidence(current) !== plan.preferencesEvidence
|
|
1347
|
+
|| current.catalogOperationContext?.generationSetDigest !== plan.demand.catalogOperationContext?.generationSetDigest) {
|
|
1348
|
+
receipt.blockers.push(diagnostic('operationReviewStale'));
|
|
1349
|
+
return completeReceipt(receipt);
|
|
1350
|
+
}
|
|
1351
|
+
const previewManager = plan.nativeGroups.map((group) => group.preview.codexManagerPreview)
|
|
1352
|
+
.find((entry) => entry?.state === 'system');
|
|
1353
|
+
const session = plan.runtime.codexObservationSession ?? (plan.nativeGroups.length ? await createCodexNativeObservationSession({
|
|
1354
|
+
exactCwd: plan.context.executionCwd, env: plan.context.env,
|
|
1355
|
+
runner: plan.runtime.nativeCliRunner ?? getDefaultNativeCliRunner(),
|
|
1356
|
+
manager: plan.runtime.codexManager ?? (previewManager?.state === 'system'
|
|
1357
|
+
? previewManager.manager : undefined),
|
|
1358
|
+
}) : undefined);
|
|
1359
|
+
const nativeRuntime = { ...plan.runtime, awHomeMutationToken: token,
|
|
1360
|
+
managedCommandProducerCache: plan.runtime.managedCommandProducerCache
|
|
1361
|
+
?? new Map(),
|
|
1362
|
+
...(session ? { codexObservationSession: session } : {}) };
|
|
1363
|
+
try {
|
|
1364
|
+
// Freeze every backend before the first declaration or output write.
|
|
1365
|
+
const recheckedGroups = await readNativeGroups(plan.nativeGroups, async (group) => {
|
|
1366
|
+
const targets = nativeGroupTargets(group);
|
|
1367
|
+
const executable = targets.filter(({ pluginId, platform }) => !pair(plan, pluginId, agentForPlatform(platform)).blockers.length);
|
|
1368
|
+
if (!executable.length)
|
|
1369
|
+
return;
|
|
1370
|
+
const checked = await nativeOperation(plan, group.pluginIds, group.platform, true, nativeRuntime, group.command, targets);
|
|
1371
|
+
if (checked.operationPlan?.planFingerprint !== group.preview.operationPlan?.planFingerprint)
|
|
1372
|
+
return 'stale';
|
|
1373
|
+
const selection = nativeTargetSelection(executable);
|
|
1374
|
+
const preview = executable.length === targets.length ? checked
|
|
1375
|
+
: await nativeOperation(plan, selection.pluginIds, selection.platform, true, nativeRuntime, group.command, executable);
|
|
1376
|
+
return { ...group, ...selection, preview };
|
|
1377
|
+
}, nativeRuntime.signal);
|
|
1378
|
+
if (recheckedGroups.includes('stale')) {
|
|
1379
|
+
receipt.blockers.push(diagnostic('operationReviewStale'));
|
|
1380
|
+
return completeReceipt(receipt);
|
|
1381
|
+
}
|
|
1382
|
+
const executableNativeGroups = recheckedGroups.filter((group) => group !== undefined && group !== 'stale');
|
|
1383
|
+
const portableProgress = execution.portableProgress ?? { completed: [], failed: [] };
|
|
1384
|
+
const portableBlocker = await recheckPortableRecovery(plan, plan.portableGroups, portableProgress);
|
|
1385
|
+
if (portableBlocker) {
|
|
1386
|
+
receipt.blockers.push(portableBlocker);
|
|
1387
|
+
return completeReceipt(receipt);
|
|
1388
|
+
}
|
|
1389
|
+
for (const residue of plan.portableResidues) {
|
|
1390
|
+
const checked = await inspectPortableResidue({ scope: plan.options.scope, context: plan.context,
|
|
1391
|
+
selector: residue.pluginId, env: plan.options.env, agents: residue.agents.filter(isPortableAgent),
|
|
1392
|
+
retainedTargets: residue.retainedTargets }).catch(() => undefined);
|
|
1393
|
+
if (!checked || JSON.stringify(checked) !== JSON.stringify(residue.observation)) {
|
|
1394
|
+
receipt.blockers.push(diagnostic('operationReviewStale'));
|
|
1395
|
+
return completeReceipt(receipt);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
if (plan.declaration) {
|
|
1399
|
+
const declared = await addRequirements({ ...plan.options, selectors: plan.declaration, token });
|
|
1400
|
+
receipt.declarationChanged = declared.changed;
|
|
1401
|
+
receipt.blockers.push(...declared.errors);
|
|
1402
|
+
plan.blockExecution ||= declared.errors.length > 0;
|
|
1403
|
+
const intent = await observeIntent(plan.options);
|
|
1404
|
+
receipt.intent = { ...receipt.intent, state: intent.state, ...('digest' in intent ? { digest: intent.digest } : {}) };
|
|
1405
|
+
}
|
|
1406
|
+
if (plan.blockExecution)
|
|
1407
|
+
return completeReceipt(receipt);
|
|
1408
|
+
if (plan.preferences) {
|
|
1409
|
+
try {
|
|
1410
|
+
const saved = await writePreferences({ ...plan.options, token }, plan.preferences);
|
|
1411
|
+
receipt.preferencesChanged = saved.changed;
|
|
1412
|
+
}
|
|
1413
|
+
catch (error) {
|
|
1414
|
+
receipt.blockers.push(diagnostic(errorCode(error, 'deploymentPreferencesWriteFailed')));
|
|
1415
|
+
return completeReceipt(receipt);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
for (const group of executableNativeGroups)
|
|
1419
|
+
await executeNativeGroup(plan, group, nativeRuntime);
|
|
1420
|
+
await executePortableGroups(plan, plan.portableGroups, nativeRuntime, portableProgress);
|
|
1421
|
+
for (const { kind, pluginId, observation } of plan.portableResidues) {
|
|
1422
|
+
if (kind !== 'cleanup')
|
|
1423
|
+
continue;
|
|
1424
|
+
if (observation.state === 'absent')
|
|
1425
|
+
continue;
|
|
1426
|
+
const targets = receipt.targetResults.filter((target) => target.pluginId === pluginId
|
|
1427
|
+
&& (observation.targets.some((entry) => entry.agent === target.agent)
|
|
1428
|
+
|| (observation.unknownAgents?.some((item) => item === target.agent)
|
|
1429
|
+
?? (observation.blockers.length > 0))));
|
|
1430
|
+
for (const target of targets) {
|
|
1431
|
+
block(target, isPortableAgent(target.agent) && observation.unknownAgents?.some((item) => item === target.agent)
|
|
1432
|
+
|| !observation.targets.some((entry) => entry.agent === target.agent)
|
|
1433
|
+
? 'portableObservationFailed' : 'backend-action-unsupported');
|
|
1434
|
+
if (target.execution === 'applied')
|
|
1435
|
+
target.execution = 'partial';
|
|
1436
|
+
target.backend = { ...(target.delivery?.kind === 'native' ? { native: target.backend } : { portable: target.backend }), portableRemaining: {
|
|
1437
|
+
state: observation.state, targets: observation.targets.map(({ skill, agent, physicalPath }) => ({ skill, agent, physicalPath: displayPortablePath(plan, physicalPath) })),
|
|
1438
|
+
} };
|
|
1439
|
+
target.recoveryActions = [...new Set([...(target.recoveryActions ?? []), ...portableRecoveryActions(plan, pluginId, observation.targets.filter((entry) => entry.agent === target.agent))])];
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
if (receipt.declarationChanged) {
|
|
1443
|
+
const intent = await observeIntent(plan.options);
|
|
1444
|
+
receipt.intent = { state: intent.state, ...('digest' in intent ? { digest: intent.digest } : {}),
|
|
1445
|
+
roots: intent.state === 'valid' ? intent.value.roots.map((root) => root.pluginId) : null };
|
|
1446
|
+
}
|
|
1447
|
+
return completeReceipt(receipt);
|
|
1448
|
+
}
|
|
1449
|
+
finally {
|
|
1450
|
+
if (!plan.runtime.codexObservationSession)
|
|
1451
|
+
await session?.dispose();
|
|
1452
|
+
}
|
|
1453
|
+
} });
|
|
1454
|
+
}
|
|
1455
|
+
finally {
|
|
1456
|
+
await plan.context.dispose();
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
export async function runRecovery(command, selectors, options, runtime = {}) {
|
|
1460
|
+
let plan = await prepareRecovery(command, selectors, options, runtime);
|
|
1461
|
+
if (plan.sourceRefreshes.length > 0) {
|
|
1462
|
+
if (options.yes !== true) {
|
|
1463
|
+
if (!options.interactive || !options.prompt?.confirm) {
|
|
1464
|
+
plan.receipt.blockers.push(diagnostic('sourceRefreshConfirmationRequired'));
|
|
1465
|
+
await plan.context.dispose();
|
|
1466
|
+
return completeReceipt(plan.receipt);
|
|
1467
|
+
}
|
|
1468
|
+
const response = await options.prompt.confirm({ defaultValue: false, message: [
|
|
1469
|
+
`先更新来源:${plan.sourceRefreshes.map((entry) => entry.sourceId).join('、')}。`,
|
|
1470
|
+
...plan.changes,
|
|
1471
|
+
...plan.warnings,
|
|
1472
|
+
'确认后只激活已检查的来源候选;随后会基于新的 Active 重新准备插件恢复,并再次确认。',
|
|
1473
|
+
].join('\n') });
|
|
1474
|
+
if (response.cancelled || response.value !== true) {
|
|
1475
|
+
plan.receipt.blockers.push(diagnostic('operationCancelled'));
|
|
1476
|
+
await plan.context.dispose();
|
|
1477
|
+
return completeReceipt(plan.receipt);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
plan = await activateRecoverySourcesAndReprepare(plan, { runtime });
|
|
1481
|
+
}
|
|
1482
|
+
if (options.interactive && options.yes !== true && options.prompt?.confirm
|
|
1483
|
+
&& (plan.declaration || plan.receipt.targetResults.some((target) => target.blockers.length === 0))) {
|
|
1484
|
+
const response = await options.prompt.confirm({ defaultValue: false, message: [
|
|
1485
|
+
`${options.scope} 请求:${plan.receipt.requestedRoots.join('、')};Agent:${plan.receipt.selection.agents.join('、') || '未选择'}。`,
|
|
1486
|
+
...plan.receipt.targetResults.map((target) => `${target.pluginId} / ${target.agent}:${target.blockers.length
|
|
1487
|
+
? `受阻(${target.blockers.map((entry) => entry.code).join('、')})` : '可执行'}`),
|
|
1488
|
+
...plan.changes, ...plan.warnings, ...plan.receipt.blockers.map((entry) => entry.message),
|
|
1489
|
+
'是否执行以上可处理变更及计划中的 preApply 脚本?',
|
|
1490
|
+
].join('\n') });
|
|
1491
|
+
if (response.cancelled || response.value !== true) {
|
|
1492
|
+
plan.receipt.blockers.push(diagnostic('operationCancelled'));
|
|
1493
|
+
await plan.context.dispose();
|
|
1494
|
+
return completeReceipt(plan.receipt);
|
|
1495
|
+
}
|
|
1496
|
+
return executeRecovery(plan, { yes: true, runtime: { preApplyConfirmed: true } });
|
|
1497
|
+
}
|
|
1498
|
+
return executeRecovery(plan);
|
|
1499
|
+
}
|
|
1500
|
+
export async function prepareRecovery(command, selectors, options, runtime = {}) {
|
|
1501
|
+
const preparedResults = runtime.preparedArtifactRenderResults ?? new Map();
|
|
1502
|
+
runtime = { ...runtime, preparedArtifactRenderResults: preparedResults };
|
|
1503
|
+
return measureRecoveryPerformanceStage(runtime, 'recovery.plan', async () => {
|
|
1504
|
+
try {
|
|
1505
|
+
if (command === 'cleanup' && !options.scope)
|
|
1506
|
+
throw new Error('cleanupScopeRequired');
|
|
1507
|
+
const plan = command === 'cleanup'
|
|
1508
|
+
? await prepareScopedRecovery(command, selectors, { ...options, scope: options.scope }, runtime)
|
|
1509
|
+
: await prepareJointRecovery(command, selectors, options, runtime);
|
|
1510
|
+
const dispose = plan.context.dispose;
|
|
1511
|
+
let disposed = false;
|
|
1512
|
+
plan.context.dispose = async () => {
|
|
1513
|
+
if (disposed)
|
|
1514
|
+
return;
|
|
1515
|
+
disposed = true;
|
|
1516
|
+
try {
|
|
1517
|
+
await dispose();
|
|
1518
|
+
}
|
|
1519
|
+
finally {
|
|
1520
|
+
await disposePreparedPlatformRebuildSession(preparedResults);
|
|
1521
|
+
}
|
|
1522
|
+
};
|
|
1523
|
+
return plan;
|
|
1524
|
+
}
|
|
1525
|
+
catch (error) {
|
|
1526
|
+
await disposePreparedPlatformRebuildSession(preparedResults);
|
|
1527
|
+
throw error;
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
export async function executeRecovery(plan, execution = {}) {
|
|
1532
|
+
return plan.joint ? executeJointRecovery(plan, execution) : executeScopedRecovery(plan, execution);
|
|
1533
|
+
}
|
|
1534
|
+
/** Review evidence uses existing backend fingerprints and observation digests; it is not stored state. */
|
|
1535
|
+
export function describeRecoveryPlan(plan) {
|
|
1536
|
+
const describe = (child) => ({ scope: child.options.scope, targets: child.receipt.requestedTargets,
|
|
1537
|
+
native: child.nativeGroups.map((group) => group.preview.operationPlan?.planFingerprint),
|
|
1538
|
+
preApplyAuthorization: child.preApplyAuthorization,
|
|
1539
|
+
nativeActivationOnlyTargets: child.options.nativeActivationOnlyTargets,
|
|
1540
|
+
nativePlannedRetirements: child.options.nativePlannedRetirements,
|
|
1541
|
+
portable: child.portableGroups.map((group) => group.evidenceDigest),
|
|
1542
|
+
inheritedPortable: child.options.portableProviderChecks?.size
|
|
1543
|
+
? [...child.options.portableProviderChecks].map(([root, providers]) => [root, providers.map((item) => item.evidenceDigest)]) : undefined,
|
|
1544
|
+
protectedPortable: child.portableProtectionGroups.map((group) => group.evidenceDigest),
|
|
1545
|
+
residue: child.portableResidues, blockers: child.receipt.blockers,
|
|
1546
|
+
targetBlockers: child.receipt.targetResults.map((target) => target.blockers),
|
|
1547
|
+
environment: { homes: child.context.targetHomes, projectRoot: child.context.projectRoot, awHome: child.context.awHome },
|
|
1548
|
+
});
|
|
1549
|
+
return { inputs: plan.joint?.evidence ?? [plan.originalIntent, plan.preferencesEvidence],
|
|
1550
|
+
catalog: plan.command === 'install' ? plan.demand.catalogOperationContext?.generationSetDigest : undefined,
|
|
1551
|
+
pendingUserSkills: plan.joint?.pendingUserSkills,
|
|
1552
|
+
providerRetirements: plan.joint ? [...plan.joint.providerRetirements] : undefined,
|
|
1553
|
+
command: plan.command, dependencyCleanupTargets: plan.dependencyCleanupTargets,
|
|
1554
|
+
declaration: plan.joint?.declaration, packages: plan.runtime.configApplyPackages ? { targets: plan.runtime.configApplyPackages.targets, evidence: plan.runtime.configApplyPackages.evidence } : undefined,
|
|
1555
|
+
portableCommandWithdrawals: plan.portableCommandWithdrawals, blockers: plan.receipt.blockers,
|
|
1556
|
+
children: (plan.joint?.children ?? [plan]).map(describe) };
|
|
1557
|
+
}
|
|
1558
|
+
//# sourceMappingURL=coordinator.js.map
|