@lesliechan721/aw 0.1.0-beta.72 → 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 +2 -0
- package/dist/src/commands/public-lifecycle.js +29 -6
- 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 +45 -16
- package/dist/src/index.js.map +1 -1
- package/dist/src/intent/scope-context.js +23 -19
- package/dist/src/intent/scope-context.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 +9 -8
- package/dist/src/recovery/coordinator.js +153 -120
- 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.d.ts +1 -0
- package/dist/src/recovery/joint-coordinator.js +278 -84
- 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 +15 -7
- package/dist/src/recovery/status.js +481 -81
- 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 +85 -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 +199 -152
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +6 -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
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { getCommandPackageId } from '@lesliechan721/aw-plugin-core/manifest';
|
|
2
|
+
import { finalizePreparedPlatformRebuildSession } from '../commands/rebuild-integration.js';
|
|
2
3
|
import { addRequirements } from '../commands/intent-command.js';
|
|
3
4
|
import { createEmptyIntent, calculateIntentDigest, removeIntentRoot } from '../intent/intent-codec.js';
|
|
4
5
|
import { observeIntent, writeIntent, resolveIntentPath } from '../intent/intent-store.js';
|
|
5
6
|
import { describeStrongStateProblem } from '../intent/diagnostics.js';
|
|
6
7
|
import { observePreferences, normalizeAgents, writePreferences } from '../intent/deployment-preferences.js';
|
|
8
|
+
import { hasSharedUserPackage } from '../platforms/layout.js';
|
|
7
9
|
import { createScopeContext } from '../intent/scope-context.js';
|
|
8
10
|
import { withAwHomeMutationLock } from '../utils/aw-home-mutation-lock.js';
|
|
9
11
|
import { readSafeOperationError } from '../utils/safe-operation-diagnostic.js';
|
|
@@ -14,11 +16,13 @@ import { validateCatalogSnapshotComplete } from '../utils/catalog-snapshot.js';
|
|
|
14
16
|
import { readCatalogGenerationState } from '../utils/catalog-generation-state.js';
|
|
15
17
|
import { parsePluginId } from '../utils/multi-source-catalog.js';
|
|
16
18
|
import { readDemand } from './demand.js';
|
|
17
|
-
import { readJointDemand, deriveJointDemand,
|
|
18
|
-
import { prepareScopedRecovery, executeScopedRecovery, executeRecoveryPreApply, describeRecoveryPlan } from './coordinator.js';
|
|
19
|
+
import { readJointDemand, deriveJointDemand, deriveSharedReferenceView } from './joint-demand.js';
|
|
20
|
+
import { prepareScopedRecovery, executeScopedRecovery, executeRecoveryPreApply, refreshRecoveryNativePreviews, describeRecoveryPlan } from './coordinator.js';
|
|
19
21
|
import { readScopedRecoveryStatus, readRecoveryStatus } from './status.js';
|
|
20
22
|
import { measureRecoveryPerformanceStage, recordRecoveryPerformanceStage } from './performance.js';
|
|
23
|
+
import { resolvePluginMetaDependencyClosure } from '../utils/plugin-dependencies.js';
|
|
21
24
|
const diagnostic = (code, message = code) => ({ code, message });
|
|
25
|
+
const canReuseProviderAcrossScopes = (target) => target === 'generic' || hasSharedUserPackage(target);
|
|
22
26
|
function intentReceipt(observation) {
|
|
23
27
|
return { state: observation.state,
|
|
24
28
|
roots: observation.state === 'valid' ? observation.value.roots.map((root) => root.pluginId)
|
|
@@ -51,10 +55,20 @@ function mergeReceipts(plan, receipts) {
|
|
|
51
55
|
}
|
|
52
56
|
receipt.requestedTargets = receipt.targetResults.map(({ pluginId, agent, scope, delivery }) => ({ pluginId, agent, scope, delivery }));
|
|
53
57
|
for (const target of receipt.targetResults) {
|
|
54
|
-
const
|
|
58
|
+
const placements = plan.joint?.demand.placements ?? [];
|
|
59
|
+
const activationOnly = plan.joint?.children.some((child) => child.options.nativeActivationOnlyTargets?.some((item) => item.pluginId === target.pluginId && item.platform === target.agent && item.scope === target.scope));
|
|
60
|
+
const placement = placements.find((item) => item.pluginId === target.pluginId && item.target === target.agent && item.scope === target.scope)
|
|
61
|
+
?? (target.scope === 'project' && activationOnly ? placements.find((item) => item.pluginId === target.pluginId && item.target === target.agent && item.scope === 'user'
|
|
62
|
+
&& item.contributions.some((contribution) => contribution.scope === target.scope)) : undefined);
|
|
55
63
|
if (placement) {
|
|
56
|
-
|
|
64
|
+
const contributions = placement.scope === target.scope ? placement.contributions
|
|
65
|
+
: placement.contributions.filter((item) => item.scope === target.scope);
|
|
66
|
+
target.requiredBy = [...new Set(contributions.map((item) => item.root))];
|
|
57
67
|
target.providerScope = placement.scope;
|
|
68
|
+
if (placement.scope !== target.scope) {
|
|
69
|
+
target.requirementScope = target.scope;
|
|
70
|
+
target.relation = contributions.some((item) => item.root === target.pluginId) ? 'root' : 'dependency';
|
|
71
|
+
}
|
|
58
72
|
}
|
|
59
73
|
}
|
|
60
74
|
receipt.remainingTargets = receipts.flatMap((item) => item.remainingTargets);
|
|
@@ -110,13 +124,18 @@ export async function prepareJointRecovery(command, selectors, options, runtime)
|
|
|
110
124
|
}
|
|
111
125
|
}
|
|
112
126
|
async function prepareJointRecoveryInSession(command, selectors, options, runtime, snapshot) {
|
|
127
|
+
// Status observes saved requirements, before projecting proposed declarations.
|
|
128
|
+
// Reuse them only within this preparation; execution reads them again under the lock.
|
|
129
|
+
const savedDemand = snapshot;
|
|
130
|
+
let observedStatus;
|
|
113
131
|
const evidence = snapshotEvidence(snapshot);
|
|
114
132
|
const scope = options.scope ?? snapshot.context.context;
|
|
115
133
|
const observedIntent = (scope === 'project' ? snapshot.project : snapshot.user).intent;
|
|
116
134
|
if (options.existingOnly) {
|
|
117
135
|
// Existing owned deployments can be refreshed without converting them into declarations.
|
|
118
|
-
|
|
119
|
-
|
|
136
|
+
observedStatus = await readRecoveryStatus({ ...options, nativeCliRunner: runtime.nativeCliRunner,
|
|
137
|
+
codexObservationSession: runtime.codexObservationSession }, savedDemand);
|
|
138
|
+
const installed = (observedStatus.existingTargets ?? []).filter((item) => selectors.some((selector) => selector === item.pluginId
|
|
120
139
|
|| !selector.includes('/') && parsePluginId(item.pluginId).pluginName === selector)
|
|
121
140
|
&& (!options.targets || options.targets.includes(item.agent)));
|
|
122
141
|
if (installed.length) {
|
|
@@ -144,6 +163,22 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
144
163
|
}
|
|
145
164
|
}
|
|
146
165
|
const previousDemand = deriveJointDemand(snapshot);
|
|
166
|
+
const previousPlugins = [...new Map([...(snapshot.user.plugins), ...(snapshot.project?.plugins ?? [])]
|
|
167
|
+
.map((plugin) => [plugin.pluginId, plugin])).values()];
|
|
168
|
+
const dependencyClosures = new Map();
|
|
169
|
+
const dependencies = (pluginId) => {
|
|
170
|
+
if (!dependencyClosures.has(pluginId)) {
|
|
171
|
+
try {
|
|
172
|
+
const parsed = parsePluginId(pluginId);
|
|
173
|
+
const closure = resolvePluginMetaDependencyClosure(previousPlugins.filter((plugin) => plugin.sourceId === parsed.sourceId), [parsed.pluginName]);
|
|
174
|
+
dependencyClosures.set(pluginId, closure.filter((plugin) => plugin.pluginId !== pluginId).map((plugin) => plugin.pluginId));
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
dependencyClosures.set(pluginId, null);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return dependencyClosures.get(pluginId);
|
|
181
|
+
};
|
|
147
182
|
const original = scope === 'project' ? snapshot.project : snapshot.user;
|
|
148
183
|
const errors = [];
|
|
149
184
|
let declaration;
|
|
@@ -164,9 +199,17 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
164
199
|
}
|
|
165
200
|
}
|
|
166
201
|
else if (command === 'uninstall') {
|
|
202
|
+
const selectable = [...new Set([...(original.roots ?? []).map((root) => root.pluginId),
|
|
203
|
+
...previousDemand.placements.filter((placement) => placement.scope === scope).map((placement) => placement.pluginId)])];
|
|
204
|
+
requested = selectors.flatMap((selector) => {
|
|
205
|
+
const parsed = parsePluginId(selector);
|
|
206
|
+
const matches = selectable.filter((id) => parsed.sourceId ? id === selector : parsePluginId(id).pluginName === parsed.pluginName);
|
|
207
|
+
if (matches.length !== 1)
|
|
208
|
+
errors.push(diagnostic('pluginIntentRootMissing'));
|
|
209
|
+
return matches.length === 1 ? matches : [selector];
|
|
210
|
+
});
|
|
167
211
|
try {
|
|
168
|
-
const sourceIds = new Set(
|
|
169
|
-
|| !selector.includes('/') && parsePluginId(root.pluginId).pluginName === selector)).map((root) => root.sourceId));
|
|
212
|
+
const sourceIds = new Set(requested.map((id) => parsePluginId(id).sourceId));
|
|
170
213
|
for (const sourceId of sourceIds) {
|
|
171
214
|
const source = original.catalogOperationContext?.catalog.sources.find((entry) => entry.sourceId === sourceId)?.resolution;
|
|
172
215
|
if (!source)
|
|
@@ -184,19 +227,13 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
184
227
|
errors.push(diagnostic('pluginIntentStateInvalid'));
|
|
185
228
|
else {
|
|
186
229
|
let value = original.intent.state === 'valid' ? original.intent.value : createEmptyIntent();
|
|
187
|
-
for (const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
: parsePluginId(root.pluginId).pluginName === parsed.pluginName);
|
|
191
|
-
if (matches.length !== 1) {
|
|
192
|
-
errors.push(diagnostic('pluginIntentRootMissing'));
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
requested[requested.indexOf(selector)] = matches[0].pluginId;
|
|
196
|
-
value = removeIntentRoot(value, matches[0].pluginId);
|
|
230
|
+
for (const pluginId of requested) {
|
|
231
|
+
if (value.roots.some((root) => root.pluginId === pluginId))
|
|
232
|
+
value = removeIntentRoot(value, pluginId);
|
|
197
233
|
}
|
|
198
234
|
if (!errors.length) {
|
|
199
|
-
|
|
235
|
+
if (original.intent.state === 'valid' && calculateIntentDigest(value) !== original.intent.digest)
|
|
236
|
+
declaration = { scope, value };
|
|
200
237
|
const demand = await readDemand({ ...options, preferences: undefined, scope, intent: asObservation(value) });
|
|
201
238
|
snapshot = { ...snapshot, [scope]: demand };
|
|
202
239
|
}
|
|
@@ -209,31 +246,50 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
209
246
|
if (command !== 'install' && command !== 'uninstall') {
|
|
210
247
|
requested = selectors.length ? selectors.flatMap((selector) => {
|
|
211
248
|
const parsed = parsePluginId(selector);
|
|
212
|
-
const matches = (options.existingOnly ? [...new Set([...rootIds, ...demand.placements.map((item) => item.pluginId)])] : rootIds).filter((id) => parsed.sourceId ? id === selector : parsePluginId(id).pluginName === parsed.pluginName);
|
|
249
|
+
const matches = (options.existingOnly || options.allowDependencySelectors ? [...new Set([...rootIds, ...demand.placements.map((item) => item.pluginId)])] : rootIds).filter((id) => parsed.sourceId ? id === selector : parsePluginId(id).pluginName === parsed.pluginName);
|
|
213
250
|
if (matches.length !== 1 && !options.existingOnly)
|
|
214
251
|
errors.push(diagnostic('syncPluginNotDesired', `${selector} 未声明或名称不唯一。`));
|
|
215
252
|
return matches.length === 1 ? matches : [];
|
|
216
253
|
}) : rootIds;
|
|
217
254
|
}
|
|
218
255
|
const targets = options.targets ? normalizeAgents(options.targets) : snapshot.preferences?.targets ?? [];
|
|
219
|
-
|
|
256
|
+
const explicitlyRemoves = (item) => item.scope === scope && requested.includes(item.pluginId) && (!options.exactTargets
|
|
257
|
+
|| options.exactTargets.some((exact) => exact.pluginId === item.pluginId && exact.agent === item.agent
|
|
258
|
+
&& (!exact.scope || exact.scope === item.scope)));
|
|
259
|
+
if (command === 'uninstall' && !options.force) {
|
|
260
|
+
for (const pluginId of requested) {
|
|
261
|
+
const consumers = demand.placements.filter((placement) => placement.pluginId === pluginId
|
|
262
|
+
&& explicitlyRemoves({ pluginId, agent: placement.target, scope }))
|
|
263
|
+
.flatMap((placement) => placement.contributions.filter((item) => item.path.length > 1
|
|
264
|
+
&& (placement.scope === scope || item.scope === scope)).map((item) => item.root));
|
|
265
|
+
if (consumers.length)
|
|
266
|
+
errors.push(diagnostic('dependencyStillRequired', `${pluginId} 仍被 ${[...new Set(consumers)].join('、')} 依赖。使用 --force 可强制移除所选输出。`));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const selectionDemand = command === 'uninstall' ? previousDemand : demand;
|
|
270
|
+
if (options.exactTargets && (!options.exactTargets.length && !options.existingOnly || options.exactTargets.some((exact) => !targets.includes(exact.agent) || !selectionDemand.roots.some((root) => root.pluginId === exact.pluginId
|
|
220
271
|
&& requested.includes(root.pluginId) && root.target === exact.agent && (!exact.scope || root.scope === exact.scope))
|
|
221
|
-
&& !
|
|
272
|
+
&& !selectionDemand.placements.some((placement) => placement.pluginId === exact.pluginId && placement.target === exact.agent
|
|
222
273
|
&& (!exact.scope || placement.scope === exact.scope || placement.contributions.some((item) => item.scope === exact.scope))
|
|
223
274
|
&& (requested.includes(placement.pluginId) || placement.contributions.some((item) => requested.includes(item.root))))))) {
|
|
224
275
|
errors.push(diagnostic('invalidExactTargets', '精确重试目标不属于当前请求,请重新检查并选择。'));
|
|
225
276
|
}
|
|
226
277
|
const selected = demand.placements.filter((placement) => targets.includes(placement.target)
|
|
227
|
-
&& !demand.conflicts.some((conflict) => [conflict.left, conflict.right].some((position) => position.target === placement.target && position.scope === placement.scope))
|
|
228
278
|
&& (!options.exactTargets || options.exactTargets.some((exact) => exact.agent === placement.target
|
|
229
|
-
&& (
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
279
|
+
&& (command === 'uninstall' ? previousDemand.placements.some((previous) => previous.pluginId === placement.pluginId
|
|
280
|
+
&& previous.target === placement.target && previous.contributions.some((item) => item.path.includes(exact.pluginId)
|
|
281
|
+
&& (!exact.scope || item.scope === exact.scope)))
|
|
282
|
+
: (!exact.scope || placement.contributions.some((item) => item.scope === exact.scope))
|
|
283
|
+
&& (exact.pluginId === placement.pluginId || placement.contributions.some((item) => item.path.includes(exact.pluginId))))))
|
|
284
|
+
&& (command === 'uninstall' ? canReuseProviderAcrossScopes(placement.target)
|
|
285
|
+
&& !(options.force && requested.includes(placement.pluginId))
|
|
286
|
+
&& previousDemand.placements.some((previous) => previous.pluginId === placement.pluginId && previous.target === placement.target
|
|
287
|
+
&& previous.scope !== placement.scope && previous.contributions.some((item) => item.scope === scope && requested.includes(item.root)))
|
|
288
|
+
: placement.contributions.some((item) => requested.includes(item.root)
|
|
289
|
+
|| options.allowDependencySelectors && item.path.some((id) => requested.includes(id))) || options.existingOnly && requested.includes(placement.pluginId)));
|
|
234
290
|
const activationOnlyTargets = [];
|
|
235
291
|
if (snapshot.project && !errors.length) {
|
|
236
|
-
const sharedNative = selected.filter((item) => item.scope === 'user' &&
|
|
292
|
+
const sharedNative = selected.filter((item) => item.scope === 'user' && ['codex', 'claude', 'gemini', 'copilot'].includes(item.target)
|
|
237
293
|
&& item.contributions.some((entry) => entry.scope === 'project'));
|
|
238
294
|
if (sharedNative.length) {
|
|
239
295
|
const expanded = { ...snapshot.project, roots: [...new Map(sharedNative.map((item) => [item.pluginId, {
|
|
@@ -248,8 +304,7 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
248
304
|
if (item.target === 'codex') {
|
|
249
305
|
const surface = analyzeCodexSurface(item.plugin.manifest);
|
|
250
306
|
const live = actual?.backend?.live;
|
|
251
|
-
const explicitlyDisabled =
|
|
252
|
-
&& component.key === 'project' && component.state === 'disabled');
|
|
307
|
+
const explicitlyDisabled = actual?.deploymentObservations?.some((observation) => observation.after.consumers.some((consumer) => consumer.activation === 'disabled'));
|
|
253
308
|
const userProvidesComponents = surface.components.every((component) => !component.scopes.includes('project') || component.scopes.includes('user'));
|
|
254
309
|
const retiringProjectComponents = live?.components?.some((component) => component.kind === 'ownership'
|
|
255
310
|
&& component.key !== 'native' && !component.key.startsWith('activation-') && !component.key.startsWith('marketplace-')
|
|
@@ -263,8 +318,8 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
263
318
|
}
|
|
264
319
|
}
|
|
265
320
|
if (actual?.content !== 'satisfied') {
|
|
266
|
-
if (item.target
|
|
267
|
-
activationOnlyTargets.push({ pluginId: item.pluginId, platform:
|
|
321
|
+
if (item.target !== 'generic')
|
|
322
|
+
activationOnlyTargets.push({ pluginId: item.pluginId, platform: item.target, scope: 'project' });
|
|
268
323
|
selected.push({ ...item, scope: 'project' });
|
|
269
324
|
}
|
|
270
325
|
}
|
|
@@ -283,14 +338,14 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
283
338
|
};
|
|
284
339
|
const children = [];
|
|
285
340
|
const { signal: _signal, ...executionOptions } = options;
|
|
286
|
-
const joint = { snapshot, demand, children, originalOptions: executionOptions,
|
|
341
|
+
const joint = { snapshot, demand, removalDependencies: dependencyClosures, children, originalOptions: executionOptions,
|
|
287
342
|
selectors: [...selectors], declaration, evidence };
|
|
288
343
|
const plan = { command, options: { ...executionOptions, scope }, receipt, context, demand: baseDemand,
|
|
289
344
|
originalIntent: observationEvidence(original.intent), preferencesEvidence: observationEvidence(snapshot.user.preferences),
|
|
290
345
|
plannedImpact: { declaration: Boolean(declaration), preferences: false, config: false, outputs: false },
|
|
291
346
|
changes: declaration ? [`保存 ${scope} 插件需求。`] : [], warnings: [], nativeGroups: [],
|
|
292
|
-
|
|
293
|
-
portableResidues: [], sourceRefreshes: [], sourceRefreshFailures: [], runtime, blockExecution: errors.some((error) => ['syncPluginNotDesired', 'pluginIntentRootMissing', 'pluginIntentStateInvalid', 'catalogSnapshotInvalid', 'installTargetSelectionUnsupported', 'invalidExactTargets'].includes(error.code)
|
|
347
|
+
portableGroups: [], portableProtectionGroups: [],
|
|
348
|
+
portableResidues: [], sourceRefreshes: [], sourceRefreshFailures: [], runtime, blockExecution: errors.some((error) => ['syncPluginNotDesired', 'pluginIntentRootMissing', 'pluginIntentStateInvalid', 'catalogSnapshotInvalid', 'installTargetSelectionUnsupported', 'invalidExactTargets', 'dependencyStillRequired'].includes(error.code)
|
|
294
349
|
|| error.code === 'targetsNotConfigured' && !options.retireUnselectedTargets)
|
|
295
350
|
|| !snapshot.preferences || snapshot.user.roots === null || snapshot.project?.roots === null, joint };
|
|
296
351
|
const dispose = context.dispose;
|
|
@@ -298,12 +353,70 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
298
353
|
if (plan.blockExecution)
|
|
299
354
|
return plan;
|
|
300
355
|
try {
|
|
301
|
-
const currentStatus = await readRecoveryStatus({ ...options, nativeCliRunner: runtime.nativeCliRunner,
|
|
302
|
-
codexObservationSession: runtime.codexObservationSession, targets: undefined });
|
|
303
|
-
|
|
304
|
-
const
|
|
356
|
+
const currentStatus = observedStatus ?? await readRecoveryStatus({ ...options, nativeCliRunner: runtime.nativeCliRunner,
|
|
357
|
+
codexObservationSession: runtime.codexObservationSession, targets: undefined }, savedDemand);
|
|
358
|
+
const sharedReferenceView = deriveSharedReferenceView(snapshot, demand, currentStatus);
|
|
359
|
+
const ownsOutput = (item) => currentStatus.ownedTargets?.some((owned) => owned.pluginId === item.pluginId
|
|
360
|
+
&& owned.agent === item.agent && owned.scope === item.scope) === true;
|
|
361
|
+
const liveConsumers = currentStatus.existingTargets ?? [];
|
|
362
|
+
const sameProvider = (consumer, provider) => consumer.agent === provider.agent && (consumer.scope === provider.scope
|
|
363
|
+
|| provider.scope === 'user' && canReuseProviderAcrossScopes(consumer.agent));
|
|
364
|
+
const automaticRetirements = command === 'uninstall' && !options.keepDependencies && demand.complete
|
|
365
|
+
? previousDemand.placements.filter((placement) => placement.scope === scope && targets.includes(placement.target)
|
|
366
|
+
&& (placement.target !== 'generic' ? currentStatus.coverage.native : currentStatus.coverage.portable)
|
|
367
|
+
&& !requested.includes(placement.pluginId)
|
|
368
|
+
&& !(canReuseProviderAcrossScopes(placement.target) ? rootIds.includes(placement.pluginId)
|
|
369
|
+
: snapshot[placement.scope]?.roots?.some((root) => root.pluginId === placement.pluginId))
|
|
370
|
+
&& placement.contributions.some((item) => explicitlyRemoves({ pluginId: item.root, agent: placement.target, scope: item.scope }))
|
|
371
|
+
&& !demand.placements.some((item) => item.pluginId === placement.pluginId && item.target === placement.target
|
|
372
|
+
&& (item.scope === placement.scope || canReuseProviderAcrossScopes(placement.target)))
|
|
373
|
+
&& ownsOutput({ pluginId: placement.pluginId, agent: placement.target, scope: placement.scope })) : [];
|
|
374
|
+
// A live consumer can outlast its Intent or its Active catalog entry.
|
|
375
|
+
const retainedConsumerFor = (provider) => liveConsumers.find((consumer) => {
|
|
376
|
+
if (explicitlyRemoves(consumer) && ownsOutput(consumer) || automaticRetirements.some((item) => item.pluginId === consumer.pluginId && item.target === consumer.agent && item.scope === consumer.scope))
|
|
377
|
+
return false;
|
|
378
|
+
if (!sameProvider(consumer, provider))
|
|
379
|
+
return false;
|
|
380
|
+
const closure = dependencies(consumer.pluginId);
|
|
381
|
+
if (!closure?.includes(provider.pluginId) && !(closure === null
|
|
382
|
+
&& parsePluginId(consumer.pluginId).sourceId === parsePluginId(provider.pluginId).sourceId))
|
|
383
|
+
return false;
|
|
384
|
+
return !demand.placements.some((item) => item.pluginId === provider.pluginId && item.target === provider.agent
|
|
385
|
+
&& item.scope !== provider.scope && sameProvider(consumer, { agent: item.target, scope: item.scope }));
|
|
386
|
+
});
|
|
387
|
+
for (let index = automaticRetirements.length - 1; index >= 0; index--) {
|
|
388
|
+
const candidate = automaticRetirements[index];
|
|
389
|
+
if (retainedConsumerFor({ pluginId: candidate.pluginId, agent: candidate.target, scope: candidate.scope })) {
|
|
390
|
+
automaticRetirements.splice(index, 1);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (command === 'uninstall' && !options.force) {
|
|
394
|
+
for (const pluginId of requested)
|
|
395
|
+
for (const agent of new Set(liveConsumers.map((consumer) => consumer.agent))) {
|
|
396
|
+
const provider = { pluginId, agent, scope };
|
|
397
|
+
const consumer = explicitlyRemoves(provider) ? retainedConsumerFor(provider) : undefined;
|
|
398
|
+
if (consumer)
|
|
399
|
+
errors.push(diagnostic('dependencyStillRequired', `${pluginId} 的移除无法保留 ${consumer.pluginId} 的现有依赖。`));
|
|
400
|
+
}
|
|
401
|
+
if (errors.some((error) => error.code === 'dependencyStillRequired')) {
|
|
402
|
+
plan.blockExecution = true;
|
|
403
|
+
return plan;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (command === 'uninstall')
|
|
407
|
+
for (const replacement of selected) {
|
|
408
|
+
const old = currentStatus.ownedTargets?.find((item) => item.pluginId === replacement.pluginId
|
|
409
|
+
&& item.agent === replacement.target && item.scope !== replacement.scope && retainedConsumerFor(item));
|
|
410
|
+
if (!old)
|
|
411
|
+
continue;
|
|
412
|
+
errors.push(diagnostic('dependencyStillRequired', `${old.pluginId} 的提供位置切换会破坏现存消费者的依赖。`));
|
|
413
|
+
plan.blockExecution = true;
|
|
414
|
+
return plan;
|
|
415
|
+
}
|
|
416
|
+
plan.dependencyCleanupTargets = automaticRetirements.map((item) => ({ pluginId: item.pluginId, agent: item.target, scope: item.scope }));
|
|
417
|
+
const nativeTargets = targets.filter((target) => target !== 'generic');
|
|
305
418
|
const targetGroups = [...(nativeTargets.length ? [nativeTargets] : []),
|
|
306
|
-
...targets.filter((target) => target
|
|
419
|
+
...targets.filter((target) => target === 'generic').map((target) => [target])];
|
|
307
420
|
for (const currentScope of snapshot.context.scopes) {
|
|
308
421
|
for (const groupTargets of targetGroups) {
|
|
309
422
|
const placements = selected.filter((item) => item.scope === currentScope && groupTargets.includes(item.target)
|
|
@@ -317,7 +430,8 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
317
430
|
...demand.placements.filter((item) => item.scope === currentScope && groupTargets.includes(item.target)),
|
|
318
431
|
...placements,
|
|
319
432
|
];
|
|
320
|
-
const userProviders = demand.placements.filter((item) => item.scope === 'user' && groupTargets.includes(item.target)
|
|
433
|
+
const userProviders = demand.placements.filter((item) => item.scope === 'user' && groupTargets.includes(item.target)
|
|
434
|
+
&& !childPlacements.some((project) => project.scope === 'project' && project.pluginId === item.pluginId && project.target === item.target));
|
|
321
435
|
const childDemand = { ...sourceDemand,
|
|
322
436
|
targetRequirements: childPlacements.map((item) => ({ pluginId: item.pluginId, target: item.target })),
|
|
323
437
|
userProviders: Object.fromEntries(groupTargets.map((target) => [target, userProviders
|
|
@@ -325,6 +439,7 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
325
439
|
roots: [...new Map(childPlacements.map((item) => [item.pluginId, { pluginId: item.pluginId, sourceId: item.plugin.sourceId,
|
|
326
440
|
sourceState: 'ready', blockers: [], plugin: item.plugin }])).values()] };
|
|
327
441
|
const child = await prepareScopedRecovery(command === 'reinstall' ? 'reinstall' : 'sync', [...new Set(placements.map((item) => item.pluginId))], { ...options, scope: currentScope, targets: groupTargets, all: false,
|
|
442
|
+
sharedReferenceView,
|
|
328
443
|
cwd: snapshot.context.projectRoot ?? options.cwd, demandOverride: childDemand,
|
|
329
444
|
exactTargets: placements.map((item) => ({ pluginId: item.pluginId, agent: item.target })),
|
|
330
445
|
nativeActivationOnlyTargets: activationOnlyTargets.filter((item) => item.scope === currentScope
|
|
@@ -336,7 +451,7 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
336
451
|
.map((item) => ({ pluginId: item.pluginId, platform: 'codex', scope: 'user' })) : [],
|
|
337
452
|
excludedPluginIds: currentScope === 'project' ? userProviders.map((item) => item.pluginId) : [],
|
|
338
453
|
dependencyScopeOverrides: currentScope === 'project'
|
|
339
|
-
? userProviders.filter((provider) =>
|
|
454
|
+
? userProviders.filter((provider) => provider.target !== 'generic'
|
|
340
455
|
&& !placements.some((item) => item.pluginId === provider.pluginId && item.target === provider.target))
|
|
341
456
|
.map((item) => ({ pluginId: item.pluginId, platform: item.target, scope: 'user' })) : [],
|
|
342
457
|
}, runtime);
|
|
@@ -362,22 +477,24 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
362
477
|
if (left.child.options.scope === right.child.options.scope || left.target.agent !== right.target.agent
|
|
363
478
|
|| left.target.skill !== right.target.skill)
|
|
364
479
|
continue;
|
|
480
|
+
if (left.target.providerPluginId === right.target.providerPluginId
|
|
481
|
+
&& left.prepared.logicalIdentity !== '' && left.prepared.logicalIdentity === right.prepared.logicalIdentity
|
|
482
|
+
&& left.target.physicalPath !== right.target.physicalPath
|
|
483
|
+
&& [left, right].every((item) => item.target.observation === 'absent' || item.target.ownership === 'aw'))
|
|
484
|
+
continue;
|
|
365
485
|
const conflict = diagnostic('crossScopeSkillCollision', `${left.target.providerPluginId}@${left.child.options.scope} (${left.target.physicalPath}) 与 ${right.target.providerPluginId}@${right.child.options.scope} (${right.target.physicalPath}) 占用同一 Agent Skill 名。`);
|
|
366
486
|
for (const item of [left, right]) {
|
|
367
487
|
item.child.receipt.targetResults.find((target) => target.pluginId === item.prepared.options.selector && target.agent === item.target.agent)?.blockers.push(conflict);
|
|
368
488
|
}
|
|
369
489
|
plan.receipt.blockers.push(conflict);
|
|
370
490
|
}
|
|
371
|
-
//
|
|
372
|
-
// Unrelated indirect dependencies remain visible residue.
|
|
373
|
-
const ownsOutput = (item) => currentStatus.ownedTargets?.some((owned) => owned.pluginId === item.pluginId
|
|
374
|
-
&& owned.agent === item.agent && owned.scope === item.scope) === true;
|
|
491
|
+
// Retire this removal's orphaned dependencies, explicit exits and provider switches.
|
|
375
492
|
const requiredNativeActivation = (item) => {
|
|
376
493
|
const backend = item.backend;
|
|
377
494
|
const scopedExtensions = (backend?.live?.components ?? backend?.components ?? []).some((component) => component.kind === 'ownership' && component.key !== 'native'
|
|
378
495
|
&& !component.key.startsWith('activation-') && !component.key.startsWith('marketplace-')
|
|
379
496
|
&& ['present', 'partial'].includes(component.state));
|
|
380
|
-
if (item.scope !== 'project' ||
|
|
497
|
+
if (item.scope !== 'project' || !item.agent || !['codex', 'claude', 'gemini', 'copilot'].includes(item.agent))
|
|
381
498
|
return false;
|
|
382
499
|
return demand.placements.some((placement) => {
|
|
383
500
|
if (placement.pluginId !== item.pluginId || placement.target !== item.agent)
|
|
@@ -404,11 +521,13 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
404
521
|
}
|
|
405
522
|
const retire = currentStatus.extraObserved.filter((item) => item.agent !== null && !requiredNativeActivation(item) && (options.retireUnselectedTargets && (!snapshot.preferences.targets.includes(item.agent)
|
|
406
523
|
|| snapshot.preferences.exclusions.some((entry) => entry.plugin === item.pluginId && entry.target === item.agent))
|
|
407
|
-
|| command === 'uninstall' &&
|
|
408
|
-
|| selected.some((placement) => placement.
|
|
524
|
+
|| command === 'uninstall' && explicitlyRemoves(item)
|
|
525
|
+
|| selected.some((placement) => canReuseProviderAcrossScopes(placement.target)
|
|
526
|
+
&& placement.pluginId === item.pluginId && placement.target === item.agent && placement.scope !== item.scope
|
|
409
527
|
&& (item.delivery?.kind !== 'agent-skills' || item.backend?.logicalIdentity === placement.plugin.catalogLogicalIdentity))));
|
|
410
528
|
for (const item of currentStatus.observedTargets ?? []) {
|
|
411
|
-
if (ownsOutput(item) && !requiredNativeActivation(item) && selected.some((placement) => placement.
|
|
529
|
+
if (ownsOutput(item) && !requiredNativeActivation(item) && selected.some((placement) => canReuseProviderAcrossScopes(placement.target)
|
|
530
|
+
&& placement.pluginId === item.pluginId
|
|
412
531
|
&& placement.target === item.agent && placement.scope !== item.scope)
|
|
413
532
|
&& !demand.placements.some((placement) => placement.pluginId === item.pluginId
|
|
414
533
|
&& placement.target === item.agent && placement.scope === item.scope))
|
|
@@ -416,47 +535,100 @@ async function prepareJointRecoveryInSession(command, selectors, options, runtim
|
|
|
416
535
|
}
|
|
417
536
|
// A removed declaration is still present in the observed snapshot, so include its exact old outputs.
|
|
418
537
|
if (command === 'uninstall')
|
|
419
|
-
for (const item of
|
|
420
|
-
|
|
421
|
-
|
|
538
|
+
for (const item of [
|
|
539
|
+
...(currentStatus.observedTargets ?? []), ...currentStatus.extraObserved,
|
|
540
|
+
]) {
|
|
541
|
+
const automatic = automaticRetirements.some((candidate) => candidate.pluginId === item.pluginId
|
|
542
|
+
&& candidate.target === item.agent && candidate.scope === item.scope);
|
|
543
|
+
if (!automatic && !explicitlyRemoves(item)
|
|
544
|
+
|| !ownsOutput(item) || !targets.includes(item.agent)
|
|
545
|
+
|| !options.force && requiredNativeActivation(item)
|
|
546
|
+
|| !options.force && demand.placements.some((placement) => placement.pluginId === item.pluginId
|
|
547
|
+
&& placement.target === item.agent && placement.scope === item.scope))
|
|
422
548
|
continue;
|
|
423
549
|
retire.push(item);
|
|
424
550
|
}
|
|
425
|
-
// Conflicting replacements are filtered before child preparation. Keep the
|
|
426
|
-
// affected plugins' old outputs even when that leaves no deployment child.
|
|
427
|
-
const blockedReplacementPlugins = new Set(demand.conflicts.flatMap((conflict) => [...conflict.left.plugins, ...conflict.right.plugins]));
|
|
428
|
-
const safeRetirements = retire.filter((item) => !blockedReplacementPlugins.has(item.pluginId));
|
|
429
|
-
const retiringKeys = new Set(safeRetirements.map((item) => `${item.pluginId}\0${item.agent}\0${item.scope}`));
|
|
430
|
-
const remainingPositions = currentStatus.extraObserved.filter((item) => item.agent !== null
|
|
431
|
-
&& !retiringKeys.has(`${item.pluginId}\0${item.agent}\0${item.scope}`))
|
|
432
|
-
.map((item) => ({ pluginId: item.pluginId, target: item.agent, scope: item.scope }));
|
|
433
|
-
const remainingConflicts = findPlacementConflicts([...demand.placements, ...remainingPositions]);
|
|
434
|
-
if (remainingConflicts.length) {
|
|
435
|
-
plan.receipt.blockers.push(...remainingConflicts);
|
|
436
|
-
for (const child of children)
|
|
437
|
-
for (const target of child.receipt.targetResults) {
|
|
438
|
-
if (remainingConflicts.some((conflict) => [conflict.left, conflict.right].some((position) => position.target === target.agent && position.scope === target.scope)))
|
|
439
|
-
target.blockers.push(diagnostic('targetPlacementConflict'));
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
551
|
const deploymentBlocked = children.some((child) => child.blockExecution
|
|
443
552
|
|| child.receipt.targetResults.some((item) => item.blockers.length));
|
|
444
553
|
if (!plan.blockExecution && !deploymentBlocked) {
|
|
445
554
|
const cleanups = [];
|
|
446
|
-
|
|
555
|
+
const pendingRetirements = [...new Map(retire.map((entry) => [`${entry.pluginId}\0${entry.agent}\0${entry.scope}`, entry])).values()];
|
|
556
|
+
const orderedRetirements = [];
|
|
557
|
+
while (pendingRetirements.length) {
|
|
558
|
+
const ready = pendingRetirements.findIndex((candidate) => !pendingRetirements.some((consumer) => consumer !== candidate && consumer.agent === candidate.agent
|
|
559
|
+
&& dependencies(consumer.pluginId)?.includes(candidate.pluginId)));
|
|
560
|
+
if (ready < 0)
|
|
561
|
+
throw new Error('dependencyGraphInvalid');
|
|
562
|
+
orderedRetirements.push(...pendingRetirements.splice(ready, 1));
|
|
563
|
+
}
|
|
564
|
+
for (const item of orderedRetirements) {
|
|
447
565
|
if (!item.agent)
|
|
448
566
|
continue;
|
|
567
|
+
dependencies(item.pluginId);
|
|
449
568
|
const cleanupDemand = item.scope === 'project' ? { ...snapshot.project,
|
|
450
569
|
userProviders: Object.fromEntries((snapshot.preferences?.targets ?? []).map((target) => [target,
|
|
451
570
|
demand.placements.filter((placement) => placement.scope === 'user' && placement.target === target)
|
|
452
571
|
.map((placement) => placement.pluginId)])), } : snapshot.user;
|
|
453
572
|
const cleanup = await prepareScopedRecovery('cleanup', [item.pluginId], { ...options,
|
|
573
|
+
sharedReferenceView,
|
|
454
574
|
scope: item.scope, cwd: snapshot.context.projectRoot ?? options.cwd, targets: [item.agent], all: false,
|
|
455
|
-
|
|
575
|
+
// Ordinary remove's force bypasses dependencies, never ownership checks.
|
|
576
|
+
force: false, exactTargets: undefined, demandOverride: cleanupDemand }, runtime);
|
|
577
|
+
if (automaticRetirements.some((candidate) => candidate.pluginId === item.pluginId
|
|
578
|
+
&& candidate.target === item.agent && candidate.scope === item.scope)) {
|
|
579
|
+
for (const target of cleanup.receipt.targetResults) {
|
|
580
|
+
target.relation = 'dependency';
|
|
581
|
+
target.requiredBy = previousDemand.placements.find((candidate) => candidate.pluginId === item.pluginId
|
|
582
|
+
&& candidate.target === item.agent && candidate.scope === item.scope)?.contributions.map((entry) => entry.root) ?? [];
|
|
583
|
+
}
|
|
584
|
+
}
|
|
456
585
|
cleanups.push(cleanup);
|
|
457
586
|
}
|
|
458
587
|
children.unshift(...cleanups);
|
|
459
588
|
}
|
|
589
|
+
// The first preview already seals every target in its native group. A lone
|
|
590
|
+
// Gemini/Copilot ensure group has no later sibling contribution to refresh here.
|
|
591
|
+
const onlyChild = children.length === 1 ? children[0] : undefined;
|
|
592
|
+
const onlyGroup = onlyChild?.nativeGroups.length === 1 ? onlyChild.nativeGroups[0] : undefined;
|
|
593
|
+
const singleNativePreviewComplete = !plan.blockExecution && onlyChild !== undefined && !onlyChild.blockExecution
|
|
594
|
+
&& onlyChild.command === 'sync' && (onlyGroup?.platform === 'gemini' || onlyGroup?.platform === 'copilot')
|
|
595
|
+
&& onlyGroup.command === 'sync'
|
|
596
|
+
&& onlyGroup.preview.operationPlan !== undefined
|
|
597
|
+
&& (onlyGroup.preview.operationPlan.deploymentPlans?.length ?? 0) > 0
|
|
598
|
+
&& onlyGroup.preview.operationPlan.deploymentPlans.every((deployment) => deployment.operation === 'ensure')
|
|
599
|
+
&& onlyChild.receipt.targetResults.length > 0
|
|
600
|
+
&& onlyChild.receipt.targetResults.every((target) => target.blockers.length === 0)
|
|
601
|
+
&& onlyChild.portableGroups.length === 0 && onlyChild.portableProtectionGroups.length === 0
|
|
602
|
+
&& onlyChild.portableResidues.length === 0;
|
|
603
|
+
// Other scopes and groups can change shared descriptors, preApply actions
|
|
604
|
+
// or retained packages. Refresh those previews before exposing Review.
|
|
605
|
+
if (!singleNativePreviewComplete)
|
|
606
|
+
for (const child of children)
|
|
607
|
+
await refreshRecoveryNativePreviews(child);
|
|
608
|
+
const preparedNativeTargets = children.flatMap((child) => child.receipt.targetResults)
|
|
609
|
+
.filter((target) => target.delivery?.kind === 'native');
|
|
610
|
+
const failedProviders = preparedNativeTargets.filter((target) => target.blockers.length > 0);
|
|
611
|
+
for (const target of preparedNativeTargets) {
|
|
612
|
+
const placement = demand.placements.find((item) => item.pluginId === target.pluginId
|
|
613
|
+
&& item.target === target.agent && item.scope === target.scope);
|
|
614
|
+
if (!placement)
|
|
615
|
+
continue;
|
|
616
|
+
for (const provider of failedProviders) {
|
|
617
|
+
if (provider === target || provider.agent !== target.agent)
|
|
618
|
+
continue;
|
|
619
|
+
const dependency = demand.placements.find((item) => item.pluginId === provider.pluginId
|
|
620
|
+
&& item.target === provider.agent && item.scope === provider.scope);
|
|
621
|
+
if (!dependency?.contributions.some((contribution) => placement.contributions.some((parent) => parent.root === contribution.root && parent.scope === contribution.scope
|
|
622
|
+
&& parent.path.length < contribution.path.length
|
|
623
|
+
&& parent.path.every((pluginId, index) => pluginId === contribution.path[index]))))
|
|
624
|
+
continue;
|
|
625
|
+
for (const blocker of provider.blockers)
|
|
626
|
+
if (!target.blockers.some((entry) => entry.code === blocker.code && entry.pluginId === provider.pluginId)) {
|
|
627
|
+
target.blockers.push({ ...blocker, pluginId: provider.pluginId });
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
finalizePreparedPlatformRebuildSession(runtime.preparedArtifactRenderResults);
|
|
460
632
|
plan.sourceRefreshes = [...new Map(children.flatMap((child) => child.sourceRefreshes).map((item) => [item.sourceId, item])).values()];
|
|
461
633
|
plan.sourceRefreshFailures = [...new Map(children.flatMap((child) => child.sourceRefreshFailures).map((item) => [item.sourceId, item])).values()];
|
|
462
634
|
plan.changes.push(...children.flatMap((child) => child.changes));
|
|
@@ -558,21 +730,27 @@ export async function executeJointRecovery(plan, execution) {
|
|
|
558
730
|
if (!joint.originalOptions.existingOnly)
|
|
559
731
|
child.demand.intent = currentIntent;
|
|
560
732
|
const fresh = await measureRecoveryPerformanceStage(runtime, 'recovery.child.plan', () => prepareScopedRecovery(child.command, typeof pluginIds === 'string' ? [pluginIds] : pluginIds, {
|
|
561
|
-
...child.options, targets: agent
|
|
733
|
+
...child.options, targets: agent !== 'generic' ? child.options.targets : [agent], all: false,
|
|
562
734
|
exactTargets: child.options.exactTargets?.filter((target) => (typeof pluginIds === 'string' ? [pluginIds] : pluginIds).includes(target.pluginId)),
|
|
563
735
|
}, runtime));
|
|
564
736
|
fresh.originalIntent = observationEvidence(currentIntent);
|
|
565
737
|
for (const target of fresh.receipt.targetResults) {
|
|
566
738
|
const reviewed = child.receipt.targetResults.find((entry) => entry.pluginId === target.pluginId && entry.agent === target.agent);
|
|
739
|
+
if (reviewed?.relation === 'dependency') {
|
|
740
|
+
target.relation = 'dependency';
|
|
741
|
+
target.requiredBy = [...reviewed.requiredBy];
|
|
742
|
+
}
|
|
567
743
|
// Native/provider observations are refreshed after preceding nodes.
|
|
568
744
|
// Keep only joint constraints and an already failed script gate.
|
|
569
745
|
target.blockers.push(...(reviewed?.blockers ?? []).filter((error) => reviewed?.execution === 'failed'
|
|
570
746
|
|| ['configApplyRequiresExistingOutput', 'crossScopeSkillCollision', 'targetPlacementConflict',
|
|
571
|
-
'preApplyAuthorizationRequired', 'nativeToolAuthorizationRequired', 'providerSwitchPreApplyFailed'].includes(error.code)));
|
|
572
|
-
if (reviewed?.execution === 'failed')
|
|
747
|
+
'preApplyAuthorizationRequired', 'nativeToolAuthorizationRequired', 'providerSwitchPreApplyFailed', 'dependencyStillRequired'].includes(error.code)));
|
|
748
|
+
if (reviewed?.execution === 'failed') {
|
|
573
749
|
target.execution = 'failed';
|
|
574
|
-
|
|
575
|
-
|
|
750
|
+
if (reviewed.backend)
|
|
751
|
+
target.backend = reviewed.backend;
|
|
752
|
+
}
|
|
753
|
+
if (child.command !== 'cleanup' && failedCleanups.some((failed) => failed.agent === target.agent && (failed.pluginId === target.pluginId || joint.demand.roots.some((root) => root.pluginId === target.pluginId && root.target === target.agent && root.dependencies.includes(failed.pluginId))))) {
|
|
576
754
|
target.blockers.push(diagnostic('providerSwitchCleanupFailed'));
|
|
577
755
|
}
|
|
578
756
|
const dependencies = joint.demand.placements.filter((placement) => placement.target === target.agent
|
|
@@ -607,6 +785,10 @@ export async function executeJointRecovery(plan, execution) {
|
|
|
607
785
|
const replacementFailures = new Set();
|
|
608
786
|
for (const child of joint.children.filter((child) => child.command !== 'cleanup')) {
|
|
609
787
|
for (const target of child.receipt.targetResults) {
|
|
788
|
+
if (replacementFailures.has(`${target.pluginId}\0${target.agent}`)) {
|
|
789
|
+
target.blockers.push(diagnostic('dependencyApplyFailed'));
|
|
790
|
+
continue;
|
|
791
|
+
}
|
|
610
792
|
if (child.options.nativeActivationOnlyTargets?.some((item) => item.pluginId === target.pluginId
|
|
611
793
|
&& item.platform === target.agent && item.scope === target.scope))
|
|
612
794
|
continue;
|
|
@@ -629,6 +811,16 @@ export async function executeJointRecovery(plan, execution) {
|
|
|
629
811
|
// old output when its corresponding replacement cannot run.
|
|
630
812
|
for (const child of joint.children.filter((child) => child.command === 'cleanup')) {
|
|
631
813
|
for (const target of child.receipt.requestedTargets) {
|
|
814
|
+
if (plan.command === 'uninstall' && failedCleanups.some((failed) => {
|
|
815
|
+
if (failed.agent !== target.agent)
|
|
816
|
+
return false;
|
|
817
|
+
const required = joint.removalDependencies.get(failed.pluginId);
|
|
818
|
+
return required?.includes(target.pluginId) || required === null
|
|
819
|
+
&& parsePluginId(failed.pluginId).sourceId === parsePluginId(target.pluginId).sourceId;
|
|
820
|
+
})) {
|
|
821
|
+
child.receipt.targetResults.find((entry) => entry.pluginId === target.pluginId && entry.agent === target.agent)
|
|
822
|
+
.blockers.push(diagnostic('dependencyStillRequired', '依赖者未完成删除,保留其依赖输出。'));
|
|
823
|
+
}
|
|
632
824
|
if ([...replacementFailures].some((failed) => failed.startsWith(`${target.pluginId}\0`)
|
|
633
825
|
&& (failed === `${target.pluginId}\0${target.agent}`
|
|
634
826
|
|| !joint.children.some((replacement) => replacement.command !== 'cleanup'
|
|
@@ -655,7 +847,7 @@ export async function executeJointRecovery(plan, execution) {
|
|
|
655
847
|
for (const target of child.receipt.requestedTargets)
|
|
656
848
|
nodeFor(target.pluginId, target.scope).targets.push({ child, agent: target.agent });
|
|
657
849
|
}
|
|
658
|
-
const hasNative = (node) => node.targets.some(({ agent }) => agent
|
|
850
|
+
const hasNative = (node) => node.targets.some(({ agent }) => agent !== 'generic');
|
|
659
851
|
for (const target of packages?.targets ?? []) {
|
|
660
852
|
const sameScope = nodes.get(`${target.pluginId}\0${target.scope}`);
|
|
661
853
|
const native = sameScope && hasNative(sameScope) ? sameScope
|
|
@@ -665,15 +857,17 @@ export async function executeJointRecovery(plan, execution) {
|
|
|
665
857
|
}
|
|
666
858
|
for (const node of nodes.values()) {
|
|
667
859
|
for (const { agent } of node.targets) {
|
|
668
|
-
const plugin = joint.demand.placements.find((item) => item.pluginId === node.pluginId && item.target === agent)?.plugin;
|
|
860
|
+
const plugin = joint.demand.placements.find((item) => item.pluginId === node.pluginId && item.target === agent && item.scope === node.scope)?.plugin;
|
|
669
861
|
for (const name of plugin?.manifest.dependencies ?? []) {
|
|
670
862
|
const pluginId = `${plugin.sourceId}/${name}`;
|
|
671
|
-
const
|
|
863
|
+
const providers = joint.demand.placements.filter((item) => item.pluginId === pluginId && item.target === agent);
|
|
864
|
+
const provider = providers.find((item) => item.scope === node.scope) ?? providers.find((item) => item.scope === 'user');
|
|
672
865
|
if (provider)
|
|
673
866
|
node.dependencies.add(`${pluginId}\0${provider.scope}`);
|
|
674
867
|
}
|
|
675
868
|
}
|
|
676
|
-
if (node.scope === 'project' &&
|
|
869
|
+
if (node.scope === 'project' && node.targets.some(({ agent }) => ['codex', 'claude', 'gemini', 'copilot'].includes(agent))
|
|
870
|
+
&& nodes.has(`${node.pluginId}\0user`))
|
|
677
871
|
node.dependencies.add(`${node.pluginId}\0user`);
|
|
678
872
|
for (const dependency of node.packages?.flatMap((item) => item.dependencies) ?? []) {
|
|
679
873
|
for (const provider of nodes.values())
|
|
@@ -718,7 +912,7 @@ export async function executeJointRecovery(plan, execution) {
|
|
|
718
912
|
};
|
|
719
913
|
while (pending.length) {
|
|
720
914
|
const index = pending.findIndex((node) => {
|
|
721
|
-
const groups = node.targets.filter(({ child, agent }) =>
|
|
915
|
+
const groups = node.targets.filter(({ child, agent }) => agent !== 'generic' && !executedNativeChildren.has(child));
|
|
722
916
|
const members = new Set([node, ...groups.flatMap(({ child }) => pending.filter((candidate) => candidate.targets.some((target) => target.child === child)))]);
|
|
723
917
|
return [...members].every((member) => [...member.dependencies].every((key) => !pending.some((candidate) => !members.has(candidate) && `${candidate.pluginId}\0${candidate.scope}` === key)));
|
|
724
918
|
});
|
|
@@ -757,7 +951,7 @@ export async function executeJointRecovery(plan, execution) {
|
|
|
757
951
|
}
|
|
758
952
|
}
|
|
759
953
|
for (const { child, agent } of node.targets) {
|
|
760
|
-
const native = agent
|
|
954
|
+
const native = agent !== 'generic';
|
|
761
955
|
if (native && executedNativeChildren.has(child))
|
|
762
956
|
continue;
|
|
763
957
|
if (native)
|