@lesliechan721/aw 0.1.0-beta.73 → 0.1.0-beta.74
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-runtime-config.mjs +65 -43
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -1
- package/dist/authoring/scripts/add-skill.mjs +5 -14
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +4 -28
- package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-version-check.mjs +2 -2
- package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +0 -1
- package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +234 -1422
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/scripts/aw-skill-eval-materializer.d.ts +2 -0
- package/dist/scripts/aw-skill-eval-materializer.js +19 -80
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/test-plugin-scripts.js +6 -8
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +2 -2
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/dependency-operation-plan.js +3 -3
- package/dist/src/commands/dependency-operation-plan.js.map +1 -1
- package/dist/src/commands/deployment-confirmation.d.ts +4 -0
- package/dist/src/commands/deployment-confirmation.js +20 -0
- package/dist/src/commands/deployment-confirmation.js.map +1 -0
- package/dist/src/commands/managed-commands.js +4 -2
- package/dist/src/commands/managed-commands.js.map +1 -1
- package/dist/src/commands/offline-cleanup-evidence.d.ts +3 -1
- package/dist/src/commands/offline-cleanup-evidence.js +9 -4
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
- package/dist/src/commands/operation-plan.d.ts +6 -0
- package/dist/src/commands/operation-plan.js +29 -2
- package/dist/src/commands/operation-plan.js.map +1 -1
- package/dist/src/commands/options.d.ts +6 -2
- package/dist/src/commands/options.js +5 -4
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +29 -41
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-config-confirmation.js +5 -5
- package/dist/src/commands/public-config-confirmation.js.map +1 -1
- package/dist/src/commands/public-lifecycle-result.d.ts +47 -0
- package/dist/src/commands/public-lifecycle-result.js +119 -4
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/commands/public-lifecycle.d.ts +1 -0
- package/dist/src/commands/public-lifecycle.js +15 -2
- package/dist/src/commands/public-lifecycle.js.map +1 -1
- package/dist/src/commands/public-plugin-query.d.ts +1 -0
- package/dist/src/commands/public-plugin-query.js +28 -8
- package/dist/src/commands/public-plugin-query.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +12 -11
- package/dist/src/commands/rebuild-command.js +529 -769
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +21 -43
- package/dist/src/commands/rebuild-integration.js +306 -3600
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +13 -0
- package/dist/src/commands/rebuild-operations.js +60 -15
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +59 -0
- package/dist/src/commands/rebuild-platform-integration.js +1200 -0
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
- package/dist/src/commands/review-inspection.js +41 -4
- package/dist/src/commands/review-inspection.js.map +1 -1
- package/dist/src/commands/review-preparation.d.ts +2 -0
- package/dist/src/commands/review-preparation.js +23 -60
- package/dist/src/commands/review-preparation.js.map +1 -1
- package/dist/src/commands/skill-eval.js +1 -0
- package/dist/src/commands/skill-eval.js.map +1 -1
- package/dist/src/commands/status-v6.d.ts +3 -1
- package/dist/src/commands/status-v6.js +24 -15
- package/dist/src/commands/status-v6.js.map +1 -1
- package/dist/src/commands/targets-command.d.ts +9 -0
- package/dist/src/commands/targets-command.js +57 -6
- package/dist/src/commands/targets-command.js.map +1 -1
- package/dist/src/commands/write-commands.js +43 -28
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/constants.d.ts +2 -2
- package/dist/src/constants.js +2 -2
- package/dist/src/constants.js.map +1 -1
- package/dist/src/generators/local-plugin.js +59 -248
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/index.js +40 -14
- package/dist/src/index.js.map +1 -1
- package/dist/src/output/command-receipt.d.ts +1 -1
- package/dist/src/output/command-receipt.js +3 -1
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/native-consent.d.ts +2 -0
- package/dist/src/output/native-consent.js +5 -0
- package/dist/src/output/native-consent.js.map +1 -0
- package/dist/src/output/public-result.js +60 -0
- package/dist/src/output/public-result.js.map +1 -1
- package/dist/src/output/rebuild-progress.js +5 -5
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/output/receipt-projection.js +19 -2
- package/dist/src/output/receipt-projection.js.map +1 -1
- package/dist/src/platforms/capabilities.d.ts +10 -0
- package/dist/src/platforms/capabilities.js +158 -0
- package/dist/src/platforms/capabilities.js.map +1 -0
- package/dist/src/platforms/contracts.d.ts +338 -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 +22 -0
- package/dist/src/platforms/cursor-workspace-hook.js +185 -0
- package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
- package/dist/src/platforms/discovery.d.ts +74 -0
- package/dist/src/platforms/discovery.js +582 -0
- package/dist/src/platforms/discovery.js.map +1 -0
- package/dist/src/platforms/gemini-activation.d.ts +36 -0
- package/dist/src/platforms/gemini-activation.js +331 -0
- package/dist/src/platforms/gemini-activation.js.map +1 -0
- package/dist/src/platforms/gemini-consent.d.ts +8 -0
- package/dist/src/platforms/gemini-consent.js +79 -0
- package/dist/src/platforms/gemini-consent.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 +173 -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 +379 -0
- package/dist/src/platforms/inspection-native.js.map +1 -0
- package/dist/src/platforms/inspection-pi.d.ts +4 -0
- package/dist/src/platforms/inspection-pi.js +212 -0
- package/dist/src/platforms/inspection-pi.js.map +1 -0
- package/dist/src/platforms/inspection.d.ts +13 -0
- package/dist/src/platforms/inspection.js +189 -0
- package/dist/src/platforms/inspection.js.map +1 -0
- package/dist/src/platforms/layout.d.ts +21 -0
- package/dist/src/platforms/layout.js +239 -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 +9 -0
- package/dist/src/platforms/lifecycle-native.js +252 -0
- package/dist/src/platforms/lifecycle-native.js.map +1 -0
- package/dist/src/platforms/lifecycle.d.ts +25 -0
- package/dist/src/platforms/lifecycle.js +452 -0
- package/dist/src/platforms/lifecycle.js.map +1 -0
- package/dist/src/platforms/managed-command-placement.d.ts +8 -0
- package/dist/src/platforms/managed-command-placement.js +79 -0
- package/dist/src/platforms/managed-command-placement.js.map +1 -0
- package/dist/src/platforms/projection-code-extension.d.ts +8 -0
- package/dist/src/platforms/projection-code-extension.js +121 -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 +10 -0
- package/dist/src/platforms/projection.js +446 -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 +16 -0
- package/dist/src/platforms/supplement-layout.js +31 -0
- package/dist/src/platforms/supplement-layout.js.map +1 -0
- package/dist/src/portable/commands.d.ts +7 -5
- package/dist/src/portable/commands.js +6 -1
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +8 -6
- package/dist/src/portable/materializer.js +47 -245
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery-layout.js +2 -15
- package/dist/src/portable/recovery-layout.js.map +1 -1
- package/dist/src/portable/recovery.d.ts +10 -1
- package/dist/src/portable/recovery.js +34 -8
- package/dist/src/portable/recovery.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +4 -7
- package/dist/src/recovery/coordinator.js +151 -119
- package/dist/src/recovery/coordinator.js.map +1 -1
- package/dist/src/recovery/demand.d.ts +1 -1
- package/dist/src/recovery/demand.js +10 -42
- package/dist/src/recovery/demand.js.map +1 -1
- package/dist/src/recovery/joint-coordinator.js +112 -52
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/joint-demand.d.ts +4 -22
- package/dist/src/recovery/joint-demand.js +43 -40
- package/dist/src/recovery/joint-demand.js.map +1 -1
- package/dist/src/recovery/receipt.d.ts +23 -8
- package/dist/src/recovery/retirement.d.ts +1 -1
- package/dist/src/recovery/retirement.js +122 -29
- package/dist/src/recovery/retirement.js.map +1 -1
- package/dist/src/recovery/status.d.ts +13 -6
- package/dist/src/recovery/status.js +479 -79
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/recovery/types.d.ts +3 -3
- package/dist/src/review/platform-profile.d.ts +3 -0
- package/dist/src/review/platform-profile.js +16 -0
- package/dist/src/review/platform-profile.js.map +1 -0
- package/dist/src/review/review-profile.d.ts +1 -0
- package/dist/src/review/review-profile.js +8 -2
- package/dist/src/review/review-profile.js.map +1 -1
- package/dist/src/review/review-selection.d.ts +2 -11
- package/dist/src/review/review-selection.js +97 -71
- package/dist/src/review/review-selection.js.map +1 -1
- package/dist/src/review/review-types.d.ts +3 -0
- package/dist/src/review/review-types.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +44 -9
- package/dist/src/review/skill-materialization.js +112 -136
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/review/source-binding.d.ts +8 -5
- package/dist/src/review/source-binding.js +99 -41
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/agent-management.js +112 -10
- package/dist/src/tui/agent-management.js.map +1 -1
- package/dist/src/tui/agent-settings.d.ts +3 -0
- package/dist/src/tui/agent-settings.js +10 -11
- package/dist/src/tui/agent-settings.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +58 -20
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/content-item-card.js +2 -2
- package/dist/src/tui/content-item-card.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +198 -152
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +5 -9
- package/dist/src/tui/controller.js +40 -18
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/deployment-view.d.ts +10 -0
- package/dist/src/tui/deployment-view.js +91 -0
- package/dist/src/tui/deployment-view.js.map +1 -0
- package/dist/src/tui/glossary.js +4 -4
- package/dist/src/tui/glossary.js.map +1 -1
- package/dist/src/tui/model.d.ts +5 -0
- package/dist/src/tui/model.js +73 -12
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.js +2 -1
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
- package/dist/src/tui/operation-history.d.ts +5 -4
- package/dist/src/tui/operation-history.js.map +1 -1
- package/dist/src/tui/operation-review-planner.d.ts +7 -2
- package/dist/src/tui/operation-review-planner.js +97 -42
- package/dist/src/tui/operation-review-planner.js.map +1 -1
- package/dist/src/tui/plugin-content.d.ts +5 -3
- package/dist/src/tui/plugin-content.js +70 -508
- package/dist/src/tui/plugin-content.js.map +1 -1
- package/dist/src/tui/plugin-detail.d.ts +3 -2
- package/dist/src/tui/plugin-detail.js +33 -25
- package/dist/src/tui/plugin-detail.js.map +1 -1
- package/dist/src/tui/scoped-inventory.d.ts +10 -6
- package/dist/src/tui/scoped-inventory.js +34 -1
- package/dist/src/tui/scoped-inventory.js.map +1 -1
- package/dist/src/types.d.ts +4 -63
- 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.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +26 -2
- package/dist/src/utils/artifact-plan.js +113 -489
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +100 -93
- package/dist/src/utils/artifact-renderer.js +173 -346
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +21 -11
- package/dist/src/utils/artifact-request.js +56 -80
- package/dist/src/utils/artifact-request.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +30 -146
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-digests.d.ts +2 -12
- package/dist/src/utils/catalog-digests.js +0 -39
- package/dist/src/utils/catalog-digests.js.map +1 -1
- package/dist/src/utils/catalog-source-references.d.ts +7 -0
- package/dist/src/utils/catalog-source-references.js +234 -19
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/codex-config-observation.d.ts +19 -0
- package/dist/src/utils/codex-config-observation.js +145 -0
- package/dist/src/utils/codex-config-observation.js.map +1 -0
- package/dist/src/utils/codex-executable-discovery.d.ts +2 -0
- package/dist/src/utils/codex-executable-discovery.js +47 -13
- package/dist/src/utils/codex-executable-discovery.js.map +1 -1
- package/dist/src/utils/codex-manager.js +1 -1
- package/dist/src/utils/codex-manager.js.map +1 -1
- package/dist/src/utils/codex-native-observation.d.ts +3 -0
- package/dist/src/utils/codex-native-observation.js +53 -0
- package/dist/src/utils/codex-native-observation.js.map +1 -1
- package/dist/src/utils/codex-shared-native.d.ts +3 -1
- package/dist/src/utils/codex-shared-native.js +46 -5
- 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-surface-analysis.d.ts +5 -2
- package/dist/src/utils/codex-surface-analysis.js +28 -57
- package/dist/src/utils/codex-surface-analysis.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +34 -0
- package/dist/src/utils/component-command-preparation.js +228 -0
- package/dist/src/utils/component-command-preparation.js.map +1 -0
- package/dist/src/utils/component-resources.d.ts +43 -0
- package/dist/src/utils/component-resources.js +304 -0
- package/dist/src/utils/component-resources.js.map +1 -0
- package/dist/src/utils/dynamic-skill-tree.d.ts +17 -6
- package/dist/src/utils/dynamic-skill-tree.js +7 -3
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/local-marketplace.d.ts +11 -44
- package/dist/src/utils/local-marketplace.js +11 -638
- package/dist/src/utils/local-marketplace.js.map +1 -1
- package/dist/src/utils/managed-command-evidence.d.ts +2 -2
- package/dist/src/utils/managed-command-evidence.js +5 -81
- package/dist/src/utils/managed-command-evidence.js.map +1 -1
- package/dist/src/utils/managed-command-materialization.d.ts +5 -2
- package/dist/src/utils/managed-command-materialization.js +35 -35
- package/dist/src/utils/managed-command-materialization.js.map +1 -1
- package/dist/src/utils/managed-command-preparation.d.ts +67 -0
- package/dist/src/utils/managed-command-preparation.js +146 -0
- package/dist/src/utils/managed-command-preparation.js.map +1 -0
- package/dist/src/utils/managed-command-review.d.ts +26 -0
- package/dist/src/utils/managed-command-review.js +68 -0
- package/dist/src/utils/managed-command-review.js.map +1 -0
- package/dist/src/utils/managed-command-store.js +26 -15
- package/dist/src/utils/managed-command-store.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +19 -0
- package/dist/src/utils/native-cli.js +45 -2
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/native-demand.d.ts +20 -1
- package/dist/src/utils/native-demand.js.map +1 -1
- package/dist/src/utils/native-tool-review.d.ts +3 -6
- package/dist/src/utils/native-tool-review.js +25 -11
- package/dist/src/utils/native-tool-review.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +26 -3
- package/dist/src/utils/ownership.js +95 -9
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/paths.d.ts +1 -1
- package/dist/src/utils/paths.js +2 -0
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +46 -0
- package/dist/src/utils/platform-empty-state.js +123 -0
- package/dist/src/utils/platform-empty-state.js.map +1 -0
- package/dist/src/utils/plugin-config-impact.d.ts +17 -11
- package/dist/src/utils/plugin-config-impact.js +46 -62
- package/dist/src/utils/plugin-config-impact.js.map +1 -1
- package/dist/src/utils/plugin-config-write.js +52 -53
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +0 -2
- package/dist/src/utils/plugin-config.js +0 -6
- 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/runtime-config.d.ts +5 -7
- package/dist/src/utils/runtime-config.js +12 -25
- package/dist/src/utils/runtime-config.js.map +1 -1
- package/dist/src/utils/windows-npm-shim.js +19 -2
- package/dist/src/utils/windows-npm-shim.js.map +1 -1
- package/package.json +3 -3
- package/dist/src/utils/claude-native-render-receipt.d.ts +0 -14
- package/dist/src/utils/claude-native-render-receipt.js +0 -26
- package/dist/src/utils/claude-native-render-receipt.js.map +0 -1
- package/dist/src/utils/claude-skills-root.d.ts +0 -8
- package/dist/src/utils/claude-skills-root.js +0 -87
- package/dist/src/utils/claude-skills-root.js.map +0 -1
- package/dist/src/utils/codex-native-render-receipt.d.ts +0 -40
- package/dist/src/utils/codex-native-render-receipt.js +0 -205
- package/dist/src/utils/codex-native-render-receipt.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
|
@@ -26,8 +26,10 @@ import { resolvePluginMetaDependencyClosure } from '../utils/plugin-dependencies
|
|
|
26
26
|
import { runPreApplyScript } from '../utils/plugin-scripts.js';
|
|
27
27
|
import { readSafeOperationError } from '../utils/safe-operation-diagnostic.js';
|
|
28
28
|
import { measureRecoveryPerformanceStage } from './performance.js';
|
|
29
|
+
import { disposePreparedPlatformRebuildSession } from '../commands/rebuild-integration.js';
|
|
30
|
+
import { operationPlanNativeToolChanges } from '../commands/operation-plan.js';
|
|
29
31
|
function isPortableAgent(agent) {
|
|
30
|
-
return agent
|
|
32
|
+
return agent === 'generic';
|
|
31
33
|
}
|
|
32
34
|
function diagnostic(code) {
|
|
33
35
|
const messages = {
|
|
@@ -145,6 +147,11 @@ async function nativeOperation(plan, pluginIds, platform, preview, runtime = pla
|
|
|
145
147
|
await prepareNativeCliExecution({ env: plan.context.env, runner: runtime.nativeCliRunner });
|
|
146
148
|
}
|
|
147
149
|
const rebuildCommand = command === 'install' ? 'sync' : command;
|
|
150
|
+
const requirements = command === 'cleanup' && (plan.demand.intent.state !== 'valid'
|
|
151
|
+
|| plan.demand.preferences.state === 'invalid' || plan.demand.preferences.state === 'unreadable')
|
|
152
|
+
? createEmptyNativeDemandView() : demandNativeProjection(plan.demand);
|
|
153
|
+
if (plan.options.sharedReferenceView)
|
|
154
|
+
requirements.sharedReferenceView = plan.options.sharedReferenceView;
|
|
148
155
|
const result = await runRebuildCommand({
|
|
149
156
|
command: rebuildCommand,
|
|
150
157
|
pluginNames: pluginIds,
|
|
@@ -153,7 +160,7 @@ async function nativeOperation(plan, pluginIds, platform, preview, runtime = pla
|
|
|
153
160
|
yes: plan.options.yes,
|
|
154
161
|
scriptTimeoutMs: plan.options.scriptTimeoutMs,
|
|
155
162
|
...(plan.options.dependencyScopeOverrides ? { dependencyScopeOverrides: plan.options.dependencyScopeOverrides } : {}),
|
|
156
|
-
...(command === 'cleanup' ? { force: plan.options.force } : {}),
|
|
163
|
+
...(command === 'cleanup' || command === 'uninstall' ? { force: plan.options.force } : {}),
|
|
157
164
|
},
|
|
158
165
|
runtime: {
|
|
159
166
|
...runtime,
|
|
@@ -166,9 +173,7 @@ async function nativeOperation(plan, pluginIds, platform, preview, runtime = pla
|
|
|
166
173
|
previewOperationPlan: preview,
|
|
167
174
|
executionInput: {
|
|
168
175
|
context: plan.context,
|
|
169
|
-
requirements
|
|
170
|
-
|| plan.demand.preferences.state === 'invalid' || plan.demand.preferences.state === 'unreadable')
|
|
171
|
-
? createEmptyNativeDemandView() : demandNativeProjection(plan.demand),
|
|
176
|
+
requirements,
|
|
172
177
|
selectedTargets: (selectedTargets ?? nativeGroupTargets({ pluginIds, platform }))
|
|
173
178
|
.map((target) => ({ ...target, scope: plan.options.scope })),
|
|
174
179
|
preserveOtherObservedTargets: true,
|
|
@@ -179,10 +184,6 @@ async function nativeOperation(plan, pluginIds, platform, preview, runtime = pla
|
|
|
179
184
|
runtime.signal?.throwIfAborted();
|
|
180
185
|
return result;
|
|
181
186
|
}
|
|
182
|
-
function nativeCleanupEvidence(result, pluginId, platform, scope) {
|
|
183
|
-
const actions = result.operationPlan?.actions.filter((action) => action.pluginId === pluginId && action.platform === platform && action.scope === scope) ?? [];
|
|
184
|
-
return [...new Set(actions.map((action) => action.kind))];
|
|
185
|
-
}
|
|
186
187
|
function nativeResults(plan, group, result, executed) {
|
|
187
188
|
if (executed && result.commandResults?.length) {
|
|
188
189
|
plan.receipt.commandResults = [...new Map([
|
|
@@ -199,6 +200,23 @@ function nativeResults(plan, group, result, executed) {
|
|
|
199
200
|
target.recoveryActions = backend.recoveryActions;
|
|
200
201
|
const backendTargets = result.targetResults.filter((entry) => entry.target.pluginId === pluginId
|
|
201
202
|
&& entry.target.platform === platform && entry.target.scope === plan.options.scope);
|
|
203
|
+
const deploymentPlans = new Map([
|
|
204
|
+
...(group.preview.operationPlan?.deploymentPlans ?? []),
|
|
205
|
+
...(result.operationPlan?.deploymentPlans ?? []),
|
|
206
|
+
].filter((deployment) => deployment.binding.plugin.pluginId === pluginId
|
|
207
|
+
&& deployment.binding.platform === platform && deployment.binding.scope.kind === plan.options.scope)
|
|
208
|
+
.map((deployment) => [deployment.binding.id, deployment]));
|
|
209
|
+
if (deploymentPlans.size)
|
|
210
|
+
target.deploymentPlans = [...deploymentPlans.values()];
|
|
211
|
+
const exclusions = [
|
|
212
|
+
...(group.preview.deploymentExclusions ?? []),
|
|
213
|
+
...(result.deploymentExclusions ?? []),
|
|
214
|
+
...(group.preview.operationPlan?.deploymentExclusions ?? []),
|
|
215
|
+
...(result.operationPlan?.deploymentExclusions ?? []),
|
|
216
|
+
...result.rebuildResults.flatMap((entry) => entry.deploymentExclusions ?? []),
|
|
217
|
+
].filter((entry) => entry.pluginId === pluginId && entry.platform === platform && entry.scope.kind === plan.options.scope);
|
|
218
|
+
if (exclusions.length)
|
|
219
|
+
target.deploymentExclusions = [...new Map(exclusions.map((entry) => [JSON.stringify([entry.pluginId, entry.platform, entry.scope, entry.productId, entry.reasonCode]), entry])).values()];
|
|
202
220
|
const dependencies = result.dependencyPlan?.targets.filter((entry) => entry.platform === platform && (entry.pluginId === pluginId || entry.requiredBy?.includes(pluginId))) ?? [];
|
|
203
221
|
const producers = (result.commandResults ?? []).filter((entry) => {
|
|
204
222
|
if (entry.producer.platform !== null && entry.producer.platform !== platform)
|
|
@@ -227,7 +245,21 @@ function nativeResults(plan, group, result, executed) {
|
|
|
227
245
|
for (const dependency of dependencies.filter((entry) => entry.action === 'block')) {
|
|
228
246
|
block(target, dependency.errorCode ?? 'dependencyNotReady');
|
|
229
247
|
}
|
|
248
|
+
for (const dependency of dependencies.filter((entry) => entry.pluginId !== pluginId)) {
|
|
249
|
+
for (const failure of result.targetResults.filter((entry) => entry.target.pluginId === dependency.pluginId
|
|
250
|
+
&& entry.target.platform === dependency.platform && entry.target.scope === dependency.resolvedScope && entry.state === 'failed')) {
|
|
251
|
+
const code = failure.errorCode ?? 'dependencyNotReady';
|
|
252
|
+
block(target, code, { ...diagnostic(code), pluginId: dependency.pluginId });
|
|
253
|
+
}
|
|
254
|
+
}
|
|
230
255
|
if (executed) {
|
|
256
|
+
const deployments = result.rebuildResults.filter((entry) => entry.target.pluginId === pluginId
|
|
257
|
+
&& entry.target.platform === platform && entry.target.scope === plan.options.scope)
|
|
258
|
+
.flatMap((entry) => entry.deploymentReceipts ?? []);
|
|
259
|
+
if (deployments.length)
|
|
260
|
+
target.deploymentReceipts = deployments.map((entry) => ({ ...entry,
|
|
261
|
+
products: deploymentPlans.get(entry.bindingId)?.binding.consumers ?? [],
|
|
262
|
+
}));
|
|
231
263
|
const commandFailures = producers.filter((entry) => entry.state !== 'completed');
|
|
232
264
|
for (const producer of commandFailures) {
|
|
233
265
|
for (const error of producer.errors)
|
|
@@ -237,8 +269,22 @@ function nativeResults(plan, group, result, executed) {
|
|
|
237
269
|
}
|
|
238
270
|
const succeeded = commandFailures.length === 0 && backendTargets.length > 0
|
|
239
271
|
&& backendTargets.every((entry) => entry.state === 'completed');
|
|
240
|
-
|
|
241
|
-
|
|
272
|
+
const effects = deployments.flatMap((entry) => entry.effects);
|
|
273
|
+
const changed = effects.some((effect) => effect.mutation !== 'none');
|
|
274
|
+
if (succeeded) {
|
|
275
|
+
const unchanged = deployments.length > 0 ? effects.every((effect) => effect.status === 'unchanged')
|
|
276
|
+
: backendTargets.every((entry) => entry.action === 'skipped');
|
|
277
|
+
target.execution = unchanged ? 'no-op' : 'applied';
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
const blockedByDependency = !changed && backendTargets.length > 0
|
|
281
|
+
&& backendTargets.every((entry) => entry.errorCode === 'dependencyInstallFailed')
|
|
282
|
+
&& result.rebuildResults.filter((entry) => entry.target.pluginId === pluginId && entry.target.platform === platform
|
|
283
|
+
&& entry.target.scope === plan.options.scope).every((entry) => !entry.cleanupAttempted && entry.actions.length === 0);
|
|
284
|
+
target.execution = blockedByDependency ? 'not-run'
|
|
285
|
+
: changed || backendTargets.some((entry) => entry.state === 'completed') ? 'partial' : 'failed';
|
|
286
|
+
}
|
|
287
|
+
plan.receipt.outputsMayHaveChanged ||= changed;
|
|
242
288
|
if (succeeded && (plan.command === 'cleanup' || plan.command === 'uninstall')) {
|
|
243
289
|
const completed = result.rebuildResults.filter((entry) => entry.target.pluginId === pluginId
|
|
244
290
|
&& entry.target.platform === platform && entry.target.scope === plan.options.scope);
|
|
@@ -261,6 +307,14 @@ function nativeResults(plan, group, result, executed) {
|
|
|
261
307
|
}
|
|
262
308
|
}
|
|
263
309
|
}
|
|
310
|
+
/** All scopes share one final marketplace generation before Review is returned. */
|
|
311
|
+
export async function refreshRecoveryNativePreviews(plan) {
|
|
312
|
+
for (const group of plan.nativeGroups) {
|
|
313
|
+
group.preview = await nativeOperation(plan, group.pluginIds, group.platform, true, plan.runtime, group.command, nativeGroupTargets(group));
|
|
314
|
+
nativeResults(plan, group, group.preview, false);
|
|
315
|
+
}
|
|
316
|
+
completeReceipt(plan.receipt);
|
|
317
|
+
}
|
|
264
318
|
function portableRequiredBy(plan, prepared, target) {
|
|
265
319
|
return plan.portableGroups.filter((group) => group.logicalIdentity === prepared.logicalIdentity
|
|
266
320
|
&& group.targets.some((entry) => entry.providerPluginId === target.providerPluginId
|
|
@@ -271,14 +325,23 @@ function portableResults(plan, prepared) {
|
|
|
271
325
|
for (const agent of prepared.options.agents) {
|
|
272
326
|
const target = pair(plan, prepared.options.selector, agent);
|
|
273
327
|
const observations = prepared.targets.filter((entry) => entry.agent === agent);
|
|
328
|
+
const gaps = (prepared.unmet ?? []).filter((gap) => gap.agent === agent);
|
|
329
|
+
if (gaps.length)
|
|
330
|
+
target.componentGaps = gaps;
|
|
274
331
|
target.content = observations.some((entry) => entry.observation === 'conflict') ? 'conflict'
|
|
275
332
|
: observations.some((entry) => entry.observation === 'unknown') ? 'unknown'
|
|
276
333
|
: observations.some((entry) => entry.observation === 'drifted') ? 'drifted'
|
|
277
334
|
: observations.some((entry) => entry.observation === 'absent') ? 'absent'
|
|
278
|
-
: observations.length ? 'satisfied' : 'unknown';
|
|
335
|
+
: observations.length || prepared.intentionalEmpty && gaps.length === 0 ? 'satisfied' : 'unknown';
|
|
336
|
+
if (gaps.length && target.content !== 'conflict')
|
|
337
|
+
target.content = 'unknown';
|
|
279
338
|
target.observation = target.content === 'satisfied' ? 'verified'
|
|
280
339
|
: target.content === 'absent' ? 'missing' : 'unknown';
|
|
281
|
-
for (const
|
|
340
|
+
for (const gap of gaps)
|
|
341
|
+
plan.changes.push(`组件未满足 · ${gap.providerPluginId} · ${gap.componentId ?? gap.id} · ${gap.reasonCode}`
|
|
342
|
+
+ gap.requiredFeatures.map((requirement) => ` · ${requirement.feature}${requirement.values ? `: ${requirement.values.join(', ')}` : ''}`).join(''));
|
|
343
|
+
for (const code of [...prepared.globalBlockers, ...observations.flatMap((entry) => entry.blocker
|
|
344
|
+
&& !(entry.disposition === 'retain' && entry.blocker === 'portableComponentsUnmet') ? [entry.blocker] : [])]) {
|
|
282
345
|
block(target, code, portablePreparationDiagnostic(prepared, diagnostic(code), agent));
|
|
283
346
|
}
|
|
284
347
|
target.backend = observations.map((entry) => ({ skill: entry.skill, providerPluginId: entry.providerPluginId,
|
|
@@ -290,7 +353,16 @@ function portableResults(plan, prepared) {
|
|
|
290
353
|
function portableOutcomes(plan, prepared, agent, outcomes, globalBlockers) {
|
|
291
354
|
const target = pair(plan, prepared.options.selector, agent);
|
|
292
355
|
const contentOutcomes = outcomes.filter((entry) => entry.disposition !== 'remove');
|
|
293
|
-
|
|
356
|
+
const preparedTargets = prepared.targets.filter((entry) => entry.agent === agent);
|
|
357
|
+
const gaps = (prepared.unmet ?? []).filter((gap) => gap.agent === agent);
|
|
358
|
+
if (gaps.length)
|
|
359
|
+
target.componentGaps = gaps;
|
|
360
|
+
const intentionalEmpty = prepared.mode === 'deploy' && prepared.intentionalEmpty && gaps.length === 0 && prepared.blockers.length === 0
|
|
361
|
+
&& globalBlockers.length === 0 && preparedTargets.every((entry) => entry.disposition === 'remove')
|
|
362
|
+
&& outcomes.length === preparedTargets.length
|
|
363
|
+
&& outcomes.every((entry) => entry.observation === 'absent' && entry.blockers.length === 0
|
|
364
|
+
&& ['applied', 'no-op'].includes(entry.execution));
|
|
365
|
+
target.execution = (prepared.mode === 'cleanup' || intentionalEmpty) && outcomes.length === 0 && !globalBlockers.length ? 'no-op' : outcomes.length > 0 && outcomes.every((entry) => entry.execution === 'no-op') ? 'no-op'
|
|
294
366
|
: outcomes.length > 0 && outcomes.every((entry) => ['applied', 'no-op'].includes(entry.execution)) ? 'applied'
|
|
295
367
|
: outcomes.some((entry) => ['applied', 'no-op'].includes(entry.execution)) ? 'partial'
|
|
296
368
|
: outcomes.some((entry) => entry.execution === 'failed') ? 'failed' : 'not-run';
|
|
@@ -309,6 +381,18 @@ function portableOutcomes(plan, prepared, agent, outcomes, globalBlockers) {
|
|
|
309
381
|
target.observation = 'missing';
|
|
310
382
|
target.content = 'absent';
|
|
311
383
|
}
|
|
384
|
+
else if (intentionalEmpty) {
|
|
385
|
+
target.observation = 'verified';
|
|
386
|
+
target.content = 'satisfied';
|
|
387
|
+
}
|
|
388
|
+
if (gaps.length) {
|
|
389
|
+
if (target.execution === 'applied' || target.execution === 'no-op')
|
|
390
|
+
target.execution = 'partial';
|
|
391
|
+
if (target.content !== 'conflict')
|
|
392
|
+
target.content = 'unknown';
|
|
393
|
+
target.observation = 'unknown';
|
|
394
|
+
block(target, 'portableComponentsUnmet');
|
|
395
|
+
}
|
|
312
396
|
target.backend = outcomes.map((entry) => ({ skill: entry.skill, providerPluginId: entry.providerPluginId,
|
|
313
397
|
requiredBy: portableRequiredBy(plan, prepared, entry), observation: entry.observation,
|
|
314
398
|
ownership: entry.ownership, associatedAgents: entry.associatedAgents,
|
|
@@ -386,7 +470,24 @@ async function executePreApplyAuthorization(plan, required, runtime) {
|
|
|
386
470
|
runtime.signal?.throwIfAborted();
|
|
387
471
|
if (error instanceof Error && error.name === 'AbortError')
|
|
388
472
|
throw error;
|
|
389
|
-
|
|
473
|
+
const operationDiagnostic = readSafeOperationError(error);
|
|
474
|
+
const affected = pair(plan, target.pluginId, target.platform);
|
|
475
|
+
if (affected) {
|
|
476
|
+
affected.execution = 'failed';
|
|
477
|
+
block(affected, 'preApplyFailed');
|
|
478
|
+
if (affected.delivery?.kind === 'native') {
|
|
479
|
+
const identity = { pluginId: target.pluginId, pluginName: plugin.manifest.name, pluginVersion: plugin.manifest.version,
|
|
480
|
+
sourceId: plugin.sourceId, sourceIdentity: target.sourceIdentity, platform: affected.delivery.platform,
|
|
481
|
+
scope: target.scope, cwd: context.executionCwd };
|
|
482
|
+
const failure = { phase: 'preApply', message: operationDiagnostic?.safeMessage ?? 'The preApply script failed.',
|
|
483
|
+
...(operationDiagnostic ? { operationDiagnostic } : {}) };
|
|
484
|
+
affected.backend = buildRebuildReceiptJson(plan.command, { platforms: [target.platform], plugins: [], warnings: [],
|
|
485
|
+
targetResults: [{ target: identity, action: 'install', state: 'failed', errorCode: 'preApplyFailed' }],
|
|
486
|
+
rebuildResults: [{ status: 'failed', command: plan.command, target: identity, actions: [{ name: 'preApply', status: 'failed' }],
|
|
487
|
+
cleanupAttempted: false, removed: [], absent: [], residual: [], quarantined: [], failures: [failure], error: failure }] });
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return 'preApplyFailed';
|
|
390
491
|
}
|
|
391
492
|
finally {
|
|
392
493
|
if (context !== plan.context)
|
|
@@ -559,7 +660,7 @@ export async function prepareScopedRecovery(command, selectors, options, runtime
|
|
|
559
660
|
const plan = { command, options: executionOptions, receipt, demand, context, originalIntent,
|
|
560
661
|
plannedImpact: { declaration: proposed?.changed === true, preferences: false, config: false, outputs: false },
|
|
561
662
|
preferencesEvidence: preferenceEvidence(demand), changes: [], warnings: [],
|
|
562
|
-
nativeGroups: [],
|
|
663
|
+
nativeGroups: [], portableGroups: [],
|
|
563
664
|
portableProtectionGroups: [], runtime,
|
|
564
665
|
portableResidues: [], sourceRefreshes,
|
|
565
666
|
sourceRefreshFailures: [...refreshFailures].map(([sourceId, code]) => ({ sourceId, code })),
|
|
@@ -613,7 +714,7 @@ export async function prepareScopedRecovery(command, selectors, options, runtime
|
|
|
613
714
|
continue;
|
|
614
715
|
const resolvedDelivery = root?.plugin ? resolveDelivery(root.plugin.manifest, agent, options.scope) ?? null : null;
|
|
615
716
|
const delivery = preciseCleanup ? isPortableAgent(agent)
|
|
616
|
-
? { kind: 'agent-skills', provider: 'aw', agentId:
|
|
717
|
+
? { kind: 'agent-skills', provider: 'aw', agentId: 'generic' }
|
|
617
718
|
: { kind: 'native', platform: agent } : resolvedDelivery;
|
|
618
719
|
receipt.targetResults.push({ pluginId, agent, scope: options.scope, delivery, execution: 'not-run', observation: 'unknown',
|
|
619
720
|
blockers: [...(preciseCleanup ? [] : root?.blockers ?? []).map(diagnostic),
|
|
@@ -637,90 +738,12 @@ export async function prepareScopedRecovery(command, selectors, options, runtime
|
|
|
637
738
|
}
|
|
638
739
|
return { ...plan, receipt: completeReceipt(receipt) };
|
|
639
740
|
}
|
|
640
|
-
if (command === 'cleanup' || command === 'uninstall') {
|
|
641
|
-
for (const platform of ['codex', 'claude']) {
|
|
642
|
-
const candidates = receipt.targetResults.filter((target) => target.agent === agentForPlatform(platform));
|
|
643
|
-
if (candidates.length === 0)
|
|
644
|
-
continue;
|
|
645
|
-
try {
|
|
646
|
-
const preview = await nativeOperation(plan, candidates.map((target) => target.pluginId), platform, true, preparationRuntime, 'cleanup');
|
|
647
|
-
for (const target of candidates) {
|
|
648
|
-
if (target.delivery?.kind === 'native')
|
|
649
|
-
continue;
|
|
650
|
-
const cleanupEvidence = nativeCleanupEvidence(preview, target.pluginId, platform, options.scope);
|
|
651
|
-
if (cleanupEvidence.length === 0)
|
|
652
|
-
continue;
|
|
653
|
-
target.delivery = { kind: 'native', platform };
|
|
654
|
-
plan.historicalNativeTargets.add(`${target.pluginId}\0${platform}`);
|
|
655
|
-
target.blockers = target.blockers.filter((entry) => entry.code !== 'backend-action-unsupported'
|
|
656
|
-
&& entry.code !== 'deliveryUnsupported');
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
catch (error) {
|
|
660
|
-
options.signal?.throwIfAborted();
|
|
661
|
-
if (error instanceof Error && error.name === 'AbortError')
|
|
662
|
-
throw error;
|
|
663
|
-
for (const target of candidates.filter((entry) => entry.delivery?.kind === 'native')) {
|
|
664
|
-
block(target, errorCode(error, 'nativePreparationFailed'));
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
if (command !== 'cleanup' && command !== 'uninstall') {
|
|
670
|
-
for (const platform of ['codex', 'claude']) {
|
|
671
|
-
const candidates = receipt.targetResults.filter((target) => target.blockers.length === 0
|
|
672
|
-
&& target.delivery?.kind === 'agent-skills' && target.agent === agentForPlatform(platform));
|
|
673
|
-
if (candidates.length === 0)
|
|
674
|
-
continue;
|
|
675
|
-
try {
|
|
676
|
-
const pluginIds = candidates.map((target) => target.pluginId);
|
|
677
|
-
const preview = await nativeOperation(plan, pluginIds, platform, true, preparationRuntime, 'cleanup');
|
|
678
|
-
const cleanPluginIds = [];
|
|
679
|
-
for (const target of candidates) {
|
|
680
|
-
const evidence = nativeCleanupEvidence(preview, target.pluginId, platform, options.scope);
|
|
681
|
-
if (evidence.length === 0) {
|
|
682
|
-
if (preview.overallState !== 'succeeded' || preview.warnings.length > 0
|
|
683
|
-
|| !preview.operationPlan) {
|
|
684
|
-
block(target, 'deliverySwitchObservationFailed');
|
|
685
|
-
target.recoveryActions = [`检查 ${target.pluginId}/${target.agent} 的 Native 现场后重试 aw plugin sync。`];
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
cleanPluginIds.push(target.pluginId);
|
|
689
|
-
}
|
|
690
|
-
continue;
|
|
691
|
-
}
|
|
692
|
-
block(target, 'deliverySwitchCleanupRequired');
|
|
693
|
-
target.backend = { previousDelivery: { kind: 'native', platform }, cleanupEvidence: evidence };
|
|
694
|
-
target.recoveryActions = [
|
|
695
|
-
`aw plugin remove ${target.pluginId} --only outputs --scope ${options.scope} --target ${target.agent}`,
|
|
696
|
-
`aw plugin sync ${target.pluginId} --context ${options.scope} --target ${target.agent}`,
|
|
697
|
-
];
|
|
698
|
-
plan.changes.push(`先清理 ${target.pluginId}/${target.agent} 的旧 Native 输出,再恢复 Portable。`);
|
|
699
|
-
}
|
|
700
|
-
if (cleanPluginIds.length && preview.operationPlan)
|
|
701
|
-
plan.deliverySwitchChecks.push({
|
|
702
|
-
pluginIds, cleanPluginIds, platform, fingerprint: preview.operationPlan.planFingerprint,
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
catch (error) {
|
|
706
|
-
options.signal?.throwIfAborted();
|
|
707
|
-
if (error instanceof Error && error.name === 'AbortError')
|
|
708
|
-
throw error;
|
|
709
|
-
for (const target of candidates) {
|
|
710
|
-
block(target, 'deliverySwitchObservationFailed');
|
|
711
|
-
target.recoveryActions = [`检查 ${target.pluginId}/${target.agent} 的 Native 现场后重试 aw plugin sync。`];
|
|
712
|
-
plan.warnings.push(`${target.pluginId}/${target.agent}:${errorCode(error, 'deliverySwitchObservationFailed')}。`);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
741
|
const groups = new Map();
|
|
718
742
|
for (const target of receipt.targetResults) {
|
|
719
743
|
if (target.blockers.length || target.delivery?.kind !== 'native')
|
|
720
744
|
continue;
|
|
721
|
-
const command = plan.
|
|
722
|
-
|
|
723
|
-
const key = `${parsePluginId(target.pluginId).sourceId}\0${command}`;
|
|
745
|
+
const command = plan.command;
|
|
746
|
+
const key = `${parsePluginId(target.pluginId).sourceId}\0${target.delivery.platform}\0${command}`;
|
|
724
747
|
const group = groups.get(key) ?? { command, targets: [] };
|
|
725
748
|
group.targets.push({ pluginId: target.pluginId, platform: target.delivery.platform });
|
|
726
749
|
groups.set(key, group);
|
|
@@ -736,15 +759,13 @@ export async function prepareScopedRecovery(command, selectors, options, runtime
|
|
|
736
759
|
plan.nativeGroups.push(nativeGroup);
|
|
737
760
|
nativeResults(plan, nativeGroup, preview, false);
|
|
738
761
|
plan.changes.push(...(preview.operationPlan?.changes ?? []));
|
|
739
|
-
const nativeToolChanges = preview.operationPlan
|
|
762
|
+
const nativeToolChanges = preview.operationPlan ? operationPlanNativeToolChanges(preview.operationPlan) : [];
|
|
740
763
|
if (nativeToolChanges.length)
|
|
741
764
|
receipt.nativeToolChanges = [...(receipt.nativeToolChanges ?? []), ...nativeToolChanges];
|
|
742
|
-
for (const
|
|
743
|
-
for (const
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
plan.changes.push(...describeNativeToolClosure(closure).map((description) => `${verb}原生工具 · ${change.producer.sourceId}/${change.producer.pluginName} · ${change.producer.key} · ${description}`));
|
|
747
|
-
}
|
|
765
|
+
for (const change of nativeToolChanges) {
|
|
766
|
+
for (const [verb, closure] of [['撤销', change.before], ['使用', change.after]]) {
|
|
767
|
+
if (closure)
|
|
768
|
+
plan.changes.push(...describeNativeToolClosure(closure).map((description) => `${verb}原生工具 · ${change.producer.sourceId}/${change.producer.pluginName} · ${change.producer.key} · ${description}`));
|
|
748
769
|
}
|
|
749
770
|
}
|
|
750
771
|
for (const override of preview.dependencyPlan?.scopeOverrides ?? []) {
|
|
@@ -874,7 +895,7 @@ export async function activateRecoverySourcesAndReprepare(plan, execution = {})
|
|
|
874
895
|
all: false,
|
|
875
896
|
refresh: false,
|
|
876
897
|
...(exactTargets ? { exactTargets } : {}),
|
|
877
|
-
}, runtime);
|
|
898
|
+
}, { ...runtime, preparedArtifactRenderResults: new Map() });
|
|
878
899
|
if (failures.size === 0)
|
|
879
900
|
return next;
|
|
880
901
|
if (exactTargets?.length === 0) {
|
|
@@ -952,16 +973,6 @@ export async function executeScopedRecovery(plan, execution = {}) {
|
|
|
952
973
|
...(session ? { codexObservationSession: session } : {}) };
|
|
953
974
|
try {
|
|
954
975
|
// Freeze every backend before the first declaration or output write.
|
|
955
|
-
for (const check of plan.deliverySwitchChecks) {
|
|
956
|
-
const checked = await nativeOperation(plan, check.pluginIds, check.platform, true, nativeRuntime, 'cleanup')
|
|
957
|
-
.catch(() => undefined);
|
|
958
|
-
if (!checked || checked.overallState !== 'succeeded' || checked.warnings.length > 0
|
|
959
|
-
|| checked.operationPlan?.planFingerprint !== check.fingerprint
|
|
960
|
-
|| check.cleanPluginIds.some((pluginId) => nativeCleanupEvidence(checked, pluginId, check.platform, plan.options.scope).length > 0)) {
|
|
961
|
-
receipt.blockers.push(diagnostic('operationReviewStale'));
|
|
962
|
-
return completeReceipt(receipt);
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
976
|
const executableNativeGroups = [];
|
|
966
977
|
for (const group of plan.nativeGroups) {
|
|
967
978
|
const targets = nativeGroupTargets(group);
|
|
@@ -1168,13 +1179,34 @@ export async function runRecovery(command, selectors, options, runtime = {}) {
|
|
|
1168
1179
|
return executeRecovery(plan);
|
|
1169
1180
|
}
|
|
1170
1181
|
export async function prepareRecovery(command, selectors, options, runtime = {}) {
|
|
1182
|
+
const preparedResults = runtime.preparedArtifactRenderResults ?? new Map();
|
|
1183
|
+
runtime = { ...runtime, preparedArtifactRenderResults: preparedResults };
|
|
1171
1184
|
return measureRecoveryPerformanceStage(runtime, 'recovery.plan', async () => {
|
|
1172
|
-
|
|
1173
|
-
if (!options.scope)
|
|
1185
|
+
try {
|
|
1186
|
+
if (command === 'cleanup' && !options.scope)
|
|
1174
1187
|
throw new Error('cleanupScopeRequired');
|
|
1175
|
-
|
|
1188
|
+
const plan = command === 'cleanup'
|
|
1189
|
+
? await prepareScopedRecovery(command, selectors, { ...options, scope: options.scope }, runtime)
|
|
1190
|
+
: await prepareJointRecovery(command, selectors, options, runtime);
|
|
1191
|
+
const dispose = plan.context.dispose;
|
|
1192
|
+
let disposed = false;
|
|
1193
|
+
plan.context.dispose = async () => {
|
|
1194
|
+
if (disposed)
|
|
1195
|
+
return;
|
|
1196
|
+
disposed = true;
|
|
1197
|
+
try {
|
|
1198
|
+
await dispose();
|
|
1199
|
+
}
|
|
1200
|
+
finally {
|
|
1201
|
+
await disposePreparedPlatformRebuildSession(preparedResults);
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
return plan;
|
|
1205
|
+
}
|
|
1206
|
+
catch (error) {
|
|
1207
|
+
await disposePreparedPlatformRebuildSession(preparedResults);
|
|
1208
|
+
throw error;
|
|
1176
1209
|
}
|
|
1177
|
-
return prepareJointRecovery(command, selectors, options, runtime);
|
|
1178
1210
|
});
|
|
1179
1211
|
}
|
|
1180
1212
|
export async function executeRecovery(plan, execution = {}) {
|