@lesliechan721/aw 0.1.0-beta.73 → 0.1.0-beta.75
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 +125 -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 +27 -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 +531 -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 +60 -0
- package/dist/src/commands/rebuild-platform-integration.js +1264 -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 +72 -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 +351 -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 +80 -0
- package/dist/src/platforms/discovery.js +604 -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 +204 -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 +401 -0
- package/dist/src/platforms/inspection-native.js.map +1 -0
- package/dist/src/platforms/inspection-opencode.d.ts +4 -0
- package/dist/src/platforms/inspection-opencode.js +97 -0
- package/dist/src/platforms/inspection-opencode.js.map +1 -0
- package/dist/src/platforms/inspection-pi.d.ts +3 -0
- package/dist/src/platforms/inspection-pi.js +287 -0
- package/dist/src/platforms/inspection-pi.js.map +1 -0
- package/dist/src/platforms/inspection-query.d.ts +5 -0
- package/dist/src/platforms/inspection-query.js +36 -0
- package/dist/src/platforms/inspection-query.js.map +1 -0
- package/dist/src/platforms/inspection.d.ts +13 -0
- package/dist/src/platforms/inspection.js +180 -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 +13 -0
- package/dist/src/platforms/lifecycle-native.js +276 -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 +470 -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 +51 -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 +131 -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 +483 -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 +103 -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 +23 -0
- package/dist/src/utils/native-cli.js +51 -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/plugin-scripts.d.ts +4 -0
- package/dist/src/utils/plugin-scripts.js +11 -0
- package/dist/src/utils/plugin-scripts.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,15 +1,287 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { isPlatformTarget, normalizeStaticPluginComponents } from '@lesliechan721/aw-plugin-core/manifest';
|
|
1
3
|
import { selectAgents } from '../intent/deployment-preferences.js';
|
|
2
4
|
import { createScopeContext } from '../intent/scope-context.js';
|
|
3
5
|
import { parsePluginId } from '../utils/multi-source-catalog.js';
|
|
4
|
-
import { statusCommandV8, flattenStatusTargets, statusTargetHasLiveConfigConsumer } from '../commands/status-v6.js';
|
|
5
6
|
import { inspectPortableExtraInstalled, inspectPortableRecovery, portablePreparationDiagnostic } from '../portable/recovery.js';
|
|
6
|
-
import { readJointDemand, deriveJointDemand
|
|
7
|
+
import { readJointDemand, deriveJointDemand } from './joint-demand.js';
|
|
7
8
|
import { readDemand, resolveDelivery } from './demand.js';
|
|
9
|
+
import { runNativeCli } from '../utils/native-cli.js';
|
|
10
|
+
import { rethrowFatalError } from '../utils/codex-executable-discovery.js';
|
|
11
|
+
import { createCodexNativeObservationSession } from '../utils/codex-native-observation.js';
|
|
8
12
|
import { analyzeCodexSurface } from '../utils/codex-surface-analysis.js';
|
|
13
|
+
import { getAgentPluginAdapter } from '../platforms/registry.js';
|
|
14
|
+
import { getQualifiedPlatformProfile } from '../platforms/capabilities.js';
|
|
15
|
+
import { resolveArtifactRenderConfig } from '../utils/artifact-renderer.js';
|
|
16
|
+
import { createPlatformInputEvidence, matchesPlatformEmptyState, platformPackageInputDigest, readPlatformPackageContentDigest } from '../utils/platform-empty-state.js';
|
|
17
|
+
import { getDeploymentLayout } from '../platforms/layout.js';
|
|
18
|
+
import { deploymentPackageComponent, inspectStaticSupplements } from '../platforms/inspection.js';
|
|
19
|
+
import { readSkillOwnerMarker } from '../utils/ownership.js';
|
|
20
|
+
import { inventoryCatalogSourceReferences } from '../utils/catalog-source-references.js';
|
|
21
|
+
import { resolvePartialCatalogOperationContext } from '../utils/catalog-operation-context.js';
|
|
22
|
+
import { checkAwCapabilitySupport, readPluginManifest } from '../utils/manifest.js';
|
|
23
|
+
import { IMPLEMENTED_AW_CAPABILITIES } from '../commands/aw-capabilities.js';
|
|
24
|
+
import { resolvePluginMetaDependencyClosure } from '../utils/plugin-dependencies.js';
|
|
25
|
+
import { installationInvocation } from '../platforms/discovery.js';
|
|
26
|
+
import { DEFAULT_AGENT_VERSION_PROBE_TIMEOUT_MS } from '../constants.js';
|
|
9
27
|
const NATIVE_READ_ERRORS = new Set(['nativeStateUnreadable', 'stateInventoryFailed', 'configReadFailed',
|
|
10
28
|
'configInvalid', 'componentInspectionFailed', 'targetInspectionFailed', 'codexNativeObservationFailed',
|
|
11
29
|
'nativeObservationFailed', 'nativeObservationUnavailable']);
|
|
12
30
|
function diagnostic(code) { return { code, message: `目标尚未满足:${code}。` }; }
|
|
31
|
+
async function readAdapterObservations(options, context, demand) {
|
|
32
|
+
const observations = [];
|
|
33
|
+
const existing = [];
|
|
34
|
+
const owned = [];
|
|
35
|
+
let selected;
|
|
36
|
+
try {
|
|
37
|
+
selected = selectAgents({ preferences: demand.preferences, targets: options.targets }).agents
|
|
38
|
+
.filter((agent) => agent !== 'generic');
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return { observations, existing, owned };
|
|
42
|
+
}
|
|
43
|
+
const ctx = { cwd: context.executionCwd, env: context.env, signal: options.signal, runner: options.nativeCliRunner,
|
|
44
|
+
codexObservationSession: options.codexObservationSession, observeNative: options.observeNative };
|
|
45
|
+
for (const platform of selected) {
|
|
46
|
+
options.signal?.throwIfAborted();
|
|
47
|
+
const roots = (demand.roots ?? []).filter((root) => root.plugin
|
|
48
|
+
&& resolveDelivery(root.plugin.manifest, platform, demand.scope)?.kind === 'native'
|
|
49
|
+
&& (!demand.targetRequirements || demand.targetRequirements.some((item) => item.pluginId === root.pluginId && item.target === platform)));
|
|
50
|
+
if (!roots.length)
|
|
51
|
+
continue;
|
|
52
|
+
const adapter = getAgentPluginAdapter(platform);
|
|
53
|
+
let ownedSession;
|
|
54
|
+
try {
|
|
55
|
+
const discovery = await adapter.discover(ctx);
|
|
56
|
+
if (platform === 'codex') {
|
|
57
|
+
const product = discovery.installations.find((item) => item.availability === 'available' && item.entry?.kind === 'cli');
|
|
58
|
+
if (product) {
|
|
59
|
+
const invocation = await installationInvocation(product, ctx, []);
|
|
60
|
+
const manager = { kind: product.product === 'app' ? 'app' : 'system', version: product.version ?? 'unknown',
|
|
61
|
+
command: invocation.command, argsPrefix: invocation.args };
|
|
62
|
+
if (ctx.codexObservationSession)
|
|
63
|
+
ctx.codexObservationSession.setManager(manager);
|
|
64
|
+
else {
|
|
65
|
+
ownedSession = await createCodexNativeObservationSession({ exactCwd: context.executionCwd, env: context.env, manager,
|
|
66
|
+
runner: async (request) => {
|
|
67
|
+
const result = await runNativeCli({ ...request, signal: options.signal, timeoutMs: DEFAULT_AGENT_VERSION_PROBE_TIMEOUT_MS }, options.nativeCliRunner);
|
|
68
|
+
if (Buffer.byteLength(result.stdout) + Buffer.byteLength(result.stderr) > 1024 * 1024)
|
|
69
|
+
throw new Error('nativeObservationOutputLimit');
|
|
70
|
+
return result;
|
|
71
|
+
} });
|
|
72
|
+
ctx.codexObservationSession = ownedSession;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
for (const root of roots) {
|
|
77
|
+
options.signal?.throwIfAborted();
|
|
78
|
+
const observation = { pluginId: root.pluginId, expectedVersion: root.plugin?.manifest.version, platform, content: 'unknown', blockers: [], deploymentObservations: [] };
|
|
79
|
+
observations.push(observation);
|
|
80
|
+
try {
|
|
81
|
+
const plugin = root.plugin;
|
|
82
|
+
const resolution = await adapter.resolve(ctx, { plugin: {
|
|
83
|
+
sourceId: plugin.sourceId ?? root.sourceId, sourceIdentity: plugin.sourceIdentity,
|
|
84
|
+
pluginId: root.pluginId, version: plugin.manifest.version,
|
|
85
|
+
}, scope: demand.scope === 'project' ? { kind: 'project', projectRoot: context.projectRoot } : { kind: 'user' },
|
|
86
|
+
operation: 'ensure', discovery, recoveryCandidates: [] });
|
|
87
|
+
observation.deploymentExclusions = resolution.exclusions.flatMap((entry) => entry.productId ? [{
|
|
88
|
+
platform, pluginId: root.pluginId,
|
|
89
|
+
scope: demand.scope === 'project' ? { kind: 'project', projectRoot: context.projectRoot } : { kind: 'user' },
|
|
90
|
+
productId: entry.productId, product: discovery.installations.find((product) => product.id === entry.productId) ?? null,
|
|
91
|
+
reasonCode: entry.reasonCode, execution: 'not-run',
|
|
92
|
+
recoveryActions: ['aw target list', `aw plugin sync ${root.pluginId} --context ${demand.scope} --target ${platform}`],
|
|
93
|
+
}] : []);
|
|
94
|
+
observation.blockers.push(...resolution.exclusions.map((entry) => diagnostic(entry.reasonCode)), ...resolution.diagnostics.map((entry) => ({ code: entry.code, message: entry.message })));
|
|
95
|
+
if (!resolution.bindings.length) {
|
|
96
|
+
observation.blockers.push(...discovery.diagnostics.map((entry) => ({ code: entry.code, message: entry.message })));
|
|
97
|
+
if (!observation.blockers.length)
|
|
98
|
+
observation.blockers.push(diagnostic(discovery.availability === 'missing' ? 'client-missing' : 'nativeObservationUnavailable'));
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const states = [];
|
|
102
|
+
const emptyMatches = [];
|
|
103
|
+
const currentMatches = [];
|
|
104
|
+
const versions = [];
|
|
105
|
+
for (const binding of resolution.bindings) {
|
|
106
|
+
const live = await adapter.inspect(ctx, binding);
|
|
107
|
+
versions.push(live.packageVersion);
|
|
108
|
+
options.signal?.throwIfAborted();
|
|
109
|
+
observation.deploymentObservations.push({ bindingId: binding.id, products: binding.consumers, after: live });
|
|
110
|
+
observation.blockers.push(...live.diagnostics.map((entry) => ({ code: entry.code, message: entry.message })));
|
|
111
|
+
const shared = ['codex-marketplace', 'claude-marketplace', 'gemini-extension', 'copilot-marketplace'].includes(binding.route);
|
|
112
|
+
const scopedNativeConsumer = shared ? live.registration === 'present'
|
|
113
|
+
&& live.consumers.some((consumer) => consumer.activation === 'enabled')
|
|
114
|
+
: live.package === 'present' && live.ownership === 'aw';
|
|
115
|
+
if (scopedNativeConsumer && (live.ownership === 'aw' || live.ownership === 'shared')) {
|
|
116
|
+
owned.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
|
|
117
|
+
existing.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
|
|
118
|
+
}
|
|
119
|
+
const unmet = [];
|
|
120
|
+
const staticComponents = [];
|
|
121
|
+
const staticSupplements = [];
|
|
122
|
+
const inputUnits = [];
|
|
123
|
+
const profile = getQualifiedPlatformProfile(platform);
|
|
124
|
+
let expectedCount = 0;
|
|
125
|
+
let packageExpectedCount = 0;
|
|
126
|
+
for (const unit of resolution.renderUnits.filter((unit) => binding.renderUnitIds.includes(unit.id))) {
|
|
127
|
+
const capabilities = adapter.capabilities({ binding, renderUnit: unit, observation: live,
|
|
128
|
+
profile });
|
|
129
|
+
const expected = await normalizeStaticPluginComponents({ pluginRoot: plugin.rootDir,
|
|
130
|
+
manifest: plugin.manifest, platform, capabilities, allowedOutputKinds: unit.kinds });
|
|
131
|
+
expectedCount += expected.components.length;
|
|
132
|
+
staticComponents.push(...expected.components);
|
|
133
|
+
if (unit.output === 'supplement')
|
|
134
|
+
staticSupplements.push(...expected.components);
|
|
135
|
+
else
|
|
136
|
+
packageExpectedCount += expected.components.length;
|
|
137
|
+
unmet.push(...expected.unmet);
|
|
138
|
+
inputUnits.push({ renderUnit: unit, capabilities, prerequisites: live.prerequisites,
|
|
139
|
+
config: await resolveArtifactRenderConfig({ pluginName: plugin.manifest.name, sourceId: binding.plugin.sourceId,
|
|
140
|
+
sourceIdentity: binding.plugin.sourceIdentity, logicalIdentity: plugin.catalogLogicalIdentity,
|
|
141
|
+
manifest: plugin.manifest, platform, scope: unit.renderScope.kind,
|
|
142
|
+
cwd: unit.renderScope.kind === 'project' ? unit.renderScope.projectRoot : context.executionCwd,
|
|
143
|
+
env: context.env, referencePlugins: demand.plugins }) });
|
|
144
|
+
}
|
|
145
|
+
const supplements = await inspectStaticSupplements(ctx, binding, staticSupplements);
|
|
146
|
+
const supplementConflict = supplements.components.some((component) => component.reasonCodes.includes('supplementOwnershipConflict'));
|
|
147
|
+
const supplementDrift = supplements.components.some((component) => component.presence === 'absent'
|
|
148
|
+
|| component.reasonCodes.includes('componentContentDrift'));
|
|
149
|
+
const supplementUnknown = supplements.components.some((component) => component.presence === 'unknown');
|
|
150
|
+
if (supplementConflict)
|
|
151
|
+
observation.blockers.push(diagnostic('supplementOwnershipConflict'));
|
|
152
|
+
else if (supplementDrift)
|
|
153
|
+
observation.blockers.push(diagnostic('platformContentDrift'));
|
|
154
|
+
else if (supplementUnknown)
|
|
155
|
+
observation.blockers.push(diagnostic('componentOutputUnconfirmed'));
|
|
156
|
+
if (supplements.owned && !existing.some((target) => target.pluginId === root.pluginId && target.agent === platform && target.scope === demand.scope)) {
|
|
157
|
+
owned.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
|
|
158
|
+
existing.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
|
|
159
|
+
}
|
|
160
|
+
const inputEvidence = await createPlatformInputEvidence({ plugin, binding, units: inputUnits });
|
|
161
|
+
const confirmedEmpty = Boolean(plugin.manifest.artifacts && expectedCount === 0 && unmet.length === 0
|
|
162
|
+
&& await matchesPlatformEmptyState({ state: { ...inputEvidence, kind: 'aw-platform-empty-state', result: 'intentional-empty' }, env: context.env }));
|
|
163
|
+
const dynamicSupplementsUnconfirmed = Boolean(plugin.manifest.artifacts && !confirmedEmpty
|
|
164
|
+
&& inputUnits.some(({ renderUnit }) => renderUnit.output === 'supplement'
|
|
165
|
+
&& (!plugin.manifest.artifacts?.scopes || plugin.manifest.artifacts.scopes.includes(renderUnit.renderScope.kind))));
|
|
166
|
+
let inputDrift = false;
|
|
167
|
+
let currentProjection = false;
|
|
168
|
+
let projectionUnconfirmed = false;
|
|
169
|
+
let nativeContentDrift = false;
|
|
170
|
+
let nativeContentUnconfirmed = false;
|
|
171
|
+
if (live.package === 'present' && live.ownership === 'aw') {
|
|
172
|
+
const layout = await getDeploymentLayout(ctx, binding);
|
|
173
|
+
const marker = await readSkillOwnerMarker({ skillRoot: layout.packageRoot, allowedRoot: path.dirname(layout.packageRoot),
|
|
174
|
+
expectedIdentity: deploymentPackageComponent(binding, layout).identity });
|
|
175
|
+
const projection = marker?.nativeProjection;
|
|
176
|
+
const contentDigest = projection ? await readPlatformPackageContentDigest(layout.packageRoot) : undefined;
|
|
177
|
+
if (['grok-cli', 'gemini-extension', 'antigravity-cli'].includes(binding.route) && live.registration === 'present') {
|
|
178
|
+
nativeContentUnconfirmed = !contentDigest || !live.nativePackageContentDigest;
|
|
179
|
+
nativeContentDrift = Boolean(contentDigest && live.nativePackageContentDigest
|
|
180
|
+
&& contentDigest !== live.nativePackageContentDigest);
|
|
181
|
+
if (nativeContentUnconfirmed)
|
|
182
|
+
observation.blockers.push(diagnostic('nativePackageContentUnconfirmed'));
|
|
183
|
+
else if (nativeContentDrift)
|
|
184
|
+
observation.blockers.push(diagnostic('nativePackageContentDrift'));
|
|
185
|
+
}
|
|
186
|
+
projectionUnconfirmed = !projection || projection.preparation !== 'complete';
|
|
187
|
+
const packageInputDigest = platformPackageInputDigest(inputEvidence);
|
|
188
|
+
inputDrift = Boolean(projection && (projection.inputDigest !== packageInputDigest
|
|
189
|
+
|| projection.contentDigest !== contentDigest));
|
|
190
|
+
if (projectionUnconfirmed)
|
|
191
|
+
observation.blockers.push(diagnostic(projection?.preparation === 'partial'
|
|
192
|
+
? 'platformPreparationPartial' : 'platformExpectationUnconfirmed'));
|
|
193
|
+
else if (inputDrift)
|
|
194
|
+
observation.blockers.push(diagnostic(projection.inputDigest !== packageInputDigest
|
|
195
|
+
? 'platformInputDrift' : 'platformContentDrift'));
|
|
196
|
+
currentProjection = Boolean(projection && !inputDrift && projection.preparation === 'complete'
|
|
197
|
+
&& projection.components.length > 0 && projection.components.every((component) => live.components.some((observed) => observed.id === component.id && observed.presence === 'present'))
|
|
198
|
+
&& !supplementConflict && !supplementDrift && !supplementUnknown && !dynamicSupplementsUnconfirmed
|
|
199
|
+
&& !nativeContentDrift && !nativeContentUnconfirmed);
|
|
200
|
+
if (currentProjection)
|
|
201
|
+
expectedCount = Math.max(expectedCount, projection.components.length);
|
|
202
|
+
}
|
|
203
|
+
// Codex CLI 0.167.0 loads user plugin Skills without the independent
|
|
204
|
+
// Hook/project trust gate. This is component applicability, not trust
|
|
205
|
+
// inferred from activation, and requires complete current evidence.
|
|
206
|
+
if (binding.route === 'codex-marketplace' && binding.scope.kind === 'user'
|
|
207
|
+
&& !plugin.manifest.artifacts && staticComponents.length > 0
|
|
208
|
+
&& staticComponents.every((component) => component.kind === 'skill')
|
|
209
|
+
&& unmet.length === 0 && staticSupplements.length === 0 && currentProjection
|
|
210
|
+
&& live.registration === 'present' && profile.kinds.skill.status === 'supported'
|
|
211
|
+
&& binding.consumers.length > 0 && live.consumers.length === binding.consumers.length
|
|
212
|
+
&& binding.consumers.every((product) => product.product === 'cli' && product.availability === 'available'
|
|
213
|
+
&& product.version === '0.167.0' && profile.qualifiedConsumers?.skill?.some((qualified) => qualified.product === product.product && qualified.version === product.version)
|
|
214
|
+
&& live.consumers.filter((consumer) => consumer.productId === product.id
|
|
215
|
+
&& consumer.activation === 'enabled' && ['unknown', 'trusted', 'not-applicable'].includes(consumer.trust)).length === 1)) {
|
|
216
|
+
for (const consumer of live.consumers)
|
|
217
|
+
if (consumer.trust === 'unknown')
|
|
218
|
+
consumer.trust = 'not-applicable';
|
|
219
|
+
}
|
|
220
|
+
live.components.push(...supplements.components);
|
|
221
|
+
observation.inputDrift ||= inputDrift || supplementDrift || nativeContentDrift;
|
|
222
|
+
currentMatches.push(confirmedEmpty || currentProjection);
|
|
223
|
+
emptyMatches.push(confirmedEmpty);
|
|
224
|
+
observation.blockers.push(...unmet.map((entry) => diagnostic(entry.reasonCode)));
|
|
225
|
+
const requiresComponents = expectedCount > 0 || unmet.length > 0 || Boolean(plugin.manifest.artifacts);
|
|
226
|
+
if (!confirmedEmpty && requiresComponents && live.consumers.some((consumer) => consumer.trust === 'required' || consumer.trust === 'blocked')
|
|
227
|
+
&& !observation.blockers.some((entry) => entry.code === 'nativeTrustRequired')) {
|
|
228
|
+
observation.blockers.push(diagnostic('nativeTrustRequired'));
|
|
229
|
+
}
|
|
230
|
+
const supplementOnly = !plugin.manifest.artifacts && staticSupplements.length > 0 && packageExpectedCount === 0;
|
|
231
|
+
const absent = !supplementOnly && live.package === 'absent' && ['absent', 'not-applicable'].includes(live.registration);
|
|
232
|
+
const unknown = !supplementOnly && (live.package === 'unknown' || live.registration === 'unknown'
|
|
233
|
+
|| live.consumers.some((consumer) => consumer.activation === 'unknown' || consumer.trust === 'unknown'));
|
|
234
|
+
const inactive = !supplementOnly && (live.registration === 'absent' || live.consumers.some((consumer) => consumer.activation === 'disabled' || consumer.activation === 'blocked'
|
|
235
|
+
|| consumer.trust === 'blocked' || consumer.trust === 'required'));
|
|
236
|
+
if (confirmedEmpty) {
|
|
237
|
+
const inactiveScope = live.registration === 'absent'
|
|
238
|
+
|| live.package === 'absent' && live.registration === 'not-applicable'
|
|
239
|
+
|| live.scopeRegistration === 'absent'
|
|
240
|
+
|| binding.scope.kind === 'project' && shared && live.configuration?.activation === 'absent'
|
|
241
|
+
|| live.consumers.every((consumer) => ['disabled', 'not-applicable'].includes(consumer.activation));
|
|
242
|
+
states.push(live.ownership === 'foreign' ? 'conflict' : live.package === 'unknown' || live.registration === 'unknown'
|
|
243
|
+
|| live.diagnostics.length || !inactiveScope ? 'unknown'
|
|
244
|
+
: live.package === 'absent' || shared ? 'satisfied' : 'drifted');
|
|
245
|
+
}
|
|
246
|
+
else
|
|
247
|
+
states.push(live.ownership === 'foreign' || supplementConflict ? 'conflict' : projectionUnconfirmed || supplementUnknown || nativeContentUnconfirmed ? 'unknown' : inputDrift || supplementDrift || nativeContentDrift ? 'drifted' : unmet.length || dynamicSupplementsUnconfirmed ? 'unknown'
|
|
248
|
+
: !expectedCount ? absent ? 'satisfied' : unknown ? 'unknown' : 'drifted'
|
|
249
|
+
: absent ? 'absent' : unknown ? 'unknown' : inactive ? 'drifted' : supplementOnly || live.package === 'present' ? 'satisfied' : 'unknown');
|
|
250
|
+
}
|
|
251
|
+
observation.intentionalEmpty = emptyMatches.length === resolution.bindings.length && emptyMatches.every(Boolean);
|
|
252
|
+
observation.expectationConfirmed = currentMatches.length === resolution.bindings.length && currentMatches.every(Boolean);
|
|
253
|
+
if (versions.length && versions[0] && versions.every((version) => version === versions[0]))
|
|
254
|
+
observation.installedVersion = versions[0];
|
|
255
|
+
observation.content = ['conflict', 'drifted', 'absent', 'unknown']
|
|
256
|
+
.find((state) => states.includes(state)) ?? 'satisfied';
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
rethrowFatalError(error);
|
|
260
|
+
options.signal?.throwIfAborted();
|
|
261
|
+
observation.content = 'unknown';
|
|
262
|
+
observation.blockers.push(diagnostic('nativeObservationFailed'));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
rethrowFatalError(error);
|
|
268
|
+
options.signal?.throwIfAborted();
|
|
269
|
+
for (const root of roots)
|
|
270
|
+
observations.push({ pluginId: root.pluginId, platform, content: 'unknown', blockers: [diagnostic('nativeObservationFailed')] });
|
|
271
|
+
}
|
|
272
|
+
finally {
|
|
273
|
+
if (ownedSession) {
|
|
274
|
+
try {
|
|
275
|
+
await ownedSession.dispose();
|
|
276
|
+
}
|
|
277
|
+
finally {
|
|
278
|
+
ctx.codexObservationSession = undefined;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return { observations, existing, owned };
|
|
284
|
+
}
|
|
13
285
|
function safeNativePlacement(target) {
|
|
14
286
|
const component = ({ kind, key, state, metadata }) => ({
|
|
15
287
|
kind, key, state,
|
|
@@ -47,6 +319,21 @@ export async function statusFromObservations(options) {
|
|
|
47
319
|
for (const root of demand.roots ?? []) {
|
|
48
320
|
options.signal?.throwIfAborted();
|
|
49
321
|
const blockers = root.blockers.map(diagnostic);
|
|
322
|
+
if (root.plugin) {
|
|
323
|
+
try {
|
|
324
|
+
const closure = root.plugin.manifest.dependencies?.length
|
|
325
|
+
? resolvePluginMetaDependencyClosure(demand.plugins.filter((plugin) => plugin.sourceId === root.sourceId), [root.plugin.manifest.name])
|
|
326
|
+
: [root.plugin];
|
|
327
|
+
for (const plugin of closure) {
|
|
328
|
+
const support = checkAwCapabilitySupport(plugin.manifest.requires?.aw.capabilities ?? [], IMPLEMENTED_AW_CAPABILITIES);
|
|
329
|
+
if (!support.supported)
|
|
330
|
+
blockers.push({ ...diagnostic('awCapabilityUnsupported'), pluginId: plugin.pluginId });
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
catch {
|
|
334
|
+
blockers.push(diagnostic('dependencyContractInvalid'));
|
|
335
|
+
}
|
|
336
|
+
}
|
|
50
337
|
if (!selection.agents.length)
|
|
51
338
|
blockers.push(diagnostic('localTargetsRequired'));
|
|
52
339
|
const targetResults = [];
|
|
@@ -57,7 +344,8 @@ export async function statusFromObservations(options) {
|
|
|
57
344
|
const delivery = root.plugin ? resolveDelivery(root.plugin.manifest, agent, options.scope) ?? null : null;
|
|
58
345
|
const target = { pluginId: root.pluginId, agent, scope: options.scope, delivery,
|
|
59
346
|
execution: 'not-run', observation: 'unknown', content: 'unknown', blockers: [...blockers],
|
|
60
|
-
requiredBy: [root.pluginId], relation: 'root'
|
|
347
|
+
requiredBy: [root.pluginId], relation: 'root',
|
|
348
|
+
...(root.plugin?.manifest.version ? { expectedVersion: root.plugin.manifest.version } : {}) };
|
|
61
349
|
if (blockers.length) {
|
|
62
350
|
targetResults.push(target);
|
|
63
351
|
continue;
|
|
@@ -69,6 +357,12 @@ export async function statusFromObservations(options) {
|
|
|
69
357
|
&& entry.platform === delivery.platform);
|
|
70
358
|
if (native) {
|
|
71
359
|
target.content = native.content;
|
|
360
|
+
if (native.installedVersion)
|
|
361
|
+
target.installedVersion = native.installedVersion;
|
|
362
|
+
if (native.deploymentObservations)
|
|
363
|
+
target.deploymentObservations = native.deploymentObservations;
|
|
364
|
+
if (native.deploymentExclusions)
|
|
365
|
+
target.deploymentExclusions = native.deploymentExclusions;
|
|
72
366
|
target.blockers.push(...native.blockers);
|
|
73
367
|
errors.push(...native.blockers.filter((entry) => NATIVE_READ_ERRORS.has(entry.code))
|
|
74
368
|
.map((entry) => ({ ...entry, pluginId: root.pluginId })));
|
|
@@ -88,16 +382,24 @@ export async function statusFromObservations(options) {
|
|
|
88
382
|
excludedPluginIds: demand.userProviders?.[agent] });
|
|
89
383
|
options.signal?.throwIfAborted();
|
|
90
384
|
target.blockers.push(...portable.blockers.map((code) => portablePreparationDiagnostic(portable, diagnostic(code), agent)));
|
|
385
|
+
const gaps = (portable.unmet ?? []).filter((gap) => gap.agent === agent);
|
|
386
|
+
if (gaps.length) {
|
|
387
|
+
target.componentGaps = gaps;
|
|
388
|
+
if (!target.blockers.some((entry) => entry.code === 'portableComponentsUnmet'))
|
|
389
|
+
target.blockers.push(diagnostic('portableComponentsUnmet'));
|
|
390
|
+
}
|
|
91
391
|
const observed = portable.targets.filter((entry) => entry.agent === agent);
|
|
92
392
|
target.blockers.push(...observed.flatMap((entry) => entry.blocker ? [diagnostic(entry.blocker)] : []));
|
|
93
393
|
target.content = ['conflict', 'drifted', 'absent', 'unknown']
|
|
94
394
|
.find((state) => observed.some((entry) => entry.observation === state))
|
|
95
|
-
?? (
|
|
395
|
+
?? (!portable.blockers.length && (observed.length || portable.intentionalEmpty && gaps.length === 0) ? 'satisfied' : 'unknown');
|
|
96
396
|
if (observed.length === 0 && portable.blockers.includes('needs-preparation') && options.portableCoverage === true
|
|
97
397
|
&& options.portableInstalled && !options.portableInstalled.some((item) => item.pluginId === root.pluginId && item.agent === agent)) {
|
|
98
398
|
target.content = 'absent';
|
|
99
399
|
target.blockers = target.blockers.filter((item) => item.code !== 'needs-preparation');
|
|
100
400
|
}
|
|
401
|
+
if (gaps.length && target.content !== 'conflict')
|
|
402
|
+
target.content = 'unknown';
|
|
101
403
|
target.backend = observed.map((entry) => ({ skill: entry.skill, agent: entry.agent,
|
|
102
404
|
ownership: entry.ownership, observation: entry.observation, associatedAgents: entry.associatedAgents }));
|
|
103
405
|
if (target.blockers.some((entry) => /(?:VerificationFailed|ReadFailed|LockInvalid)/u.test(entry.code))) {
|
|
@@ -105,13 +407,19 @@ export async function statusFromObservations(options) {
|
|
|
105
407
|
}
|
|
106
408
|
}
|
|
107
409
|
catch (error) {
|
|
410
|
+
rethrowFatalError(error);
|
|
108
411
|
options.signal?.throwIfAborted();
|
|
109
|
-
if (error instanceof Error && error.name === 'AbortError')
|
|
110
|
-
throw error;
|
|
111
412
|
target.blockers.push(diagnostic('portableObservationFailed'));
|
|
112
413
|
errors.push({ ...diagnostic('portableObservationFailed'), pluginId: root.pluginId });
|
|
113
414
|
}
|
|
114
415
|
}
|
|
416
|
+
const confirmedEmpty = delivery?.kind === 'native' && options.nativeObservations.some((entry) => entry.pluginId === root.pluginId && entry.platform === delivery.platform && (entry.intentionalEmpty === true || entry.expectationConfirmed === true));
|
|
417
|
+
if (delivery?.kind === 'native' && root.plugin?.manifest.artifacts && !confirmedEmpty) {
|
|
418
|
+
const inputDrift = delivery?.kind === 'native' && options.nativeObservations.some((entry) => entry.pluginId === root.pluginId && entry.platform === delivery.platform && entry.inputDrift === true);
|
|
419
|
+
if (target.content !== 'conflict' && !inputDrift)
|
|
420
|
+
target.content = 'unknown';
|
|
421
|
+
target.blockers.push(diagnostic('dynamicExpectationUnconfirmed'));
|
|
422
|
+
}
|
|
115
423
|
target.observation = target.content === 'satisfied' ? 'verified'
|
|
116
424
|
: target.content === 'absent' ? 'missing' : 'unknown';
|
|
117
425
|
targetResults.push(target);
|
|
@@ -147,6 +455,8 @@ export async function statusFromObservations(options) {
|
|
|
147
455
|
|| target.blockers.some((entry) => entry.code === 'deliveryUnsupported')) {
|
|
148
456
|
definiteFailure = true;
|
|
149
457
|
}
|
|
458
|
+
else if (target.blockers.some((entry) => entry.code === 'awCapabilityUnsupported'))
|
|
459
|
+
definiteFailure = true;
|
|
150
460
|
else if (target.content === 'unknown' || target.observation === 'unknown' || target.blockers.length)
|
|
151
461
|
uncertain = true;
|
|
152
462
|
}
|
|
@@ -167,20 +477,57 @@ export async function readScopedRecoveryStatus(options) {
|
|
|
167
477
|
const demand = options.demandOverride ?? await readDemand({ scope: options.scope, cwd: context.executionCwd, env: context.env,
|
|
168
478
|
catalogOperationContext: options.catalogOperationContext, signal: options.signal });
|
|
169
479
|
options.signal?.throwIfAborted();
|
|
170
|
-
|
|
171
|
-
const native = options.nativeObservations ? undefined : await statusCommandV8({
|
|
172
|
-
cwd: context.executionCwd, env: context.env, scope: options.scope,
|
|
173
|
-
...(nativePlugins ? { plugins: nativePlugins } : {}),
|
|
174
|
-
recoveryDemand: demand, recoverySelection: { targets: options.targets }, cliVersion: options.cliVersion,
|
|
175
|
-
catalogOperationContext: options.catalogOperationContext,
|
|
176
|
-
nativeCliRunner: options.nativeCliRunner,
|
|
177
|
-
codexObservationSession: options.codexObservationSession,
|
|
178
|
-
signal: options.signal,
|
|
179
|
-
});
|
|
480
|
+
options.onDemand?.(demand);
|
|
180
481
|
options.signal?.throwIfAborted();
|
|
181
|
-
|
|
182
|
-
await
|
|
482
|
+
const ownerInventory = options.nativeObservations ? { references: [], errors: [] }
|
|
483
|
+
: await inventoryCatalogSourceReferences({ cwd: context.executionCwd, env: context.env, scope: options.scope });
|
|
183
484
|
options.signal?.throwIfAborted();
|
|
485
|
+
const candidates = ownerInventory.references.filter((entry) => entry.scope === options.scope
|
|
486
|
+
&& entry.sourceId && entry.pluginName && isPlatformTarget(entry.platform) && entry.platform !== 'generic');
|
|
487
|
+
const observedPlugins = new Map(demand.plugins.map((plugin) => [plugin.pluginId, plugin]));
|
|
488
|
+
let catalog = demand.catalogOperationContext ?? options.catalogOperationContext;
|
|
489
|
+
if (candidates.some((entry) => !observedPlugins.has(`${entry.sourceId}/${entry.pluginName}`))) {
|
|
490
|
+
try {
|
|
491
|
+
catalog ??= await resolvePartialCatalogOperationContext({ env: context.env, signal: options.signal });
|
|
492
|
+
}
|
|
493
|
+
catch (error) {
|
|
494
|
+
rethrowFatalError(error);
|
|
495
|
+
options.signal?.throwIfAborted();
|
|
496
|
+
}
|
|
497
|
+
for (const candidate of candidates) {
|
|
498
|
+
const pluginId = `${candidate.sourceId}/${candidate.pluginName}`;
|
|
499
|
+
if (observedPlugins.has(pluginId))
|
|
500
|
+
continue;
|
|
501
|
+
const source = catalog?.catalog.sources.find((entry) => entry.sourceId === candidate.sourceId)?.resolution;
|
|
502
|
+
if (!source?.manifest.entries.some((entry) => entry.name === candidate.pluginName))
|
|
503
|
+
continue;
|
|
504
|
+
try {
|
|
505
|
+
const plugin = await readPluginManifest(path.join(source.rootDir, 'plugins', candidate.pluginName), { mode: 'bundle' });
|
|
506
|
+
Object.assign(plugin, { pluginId, sourceId: candidate.sourceId, sourceIdentity: source.sourceIdentity,
|
|
507
|
+
catalogLogicalIdentity: source.logicalIdentity });
|
|
508
|
+
observedPlugins.set(pluginId, plugin);
|
|
509
|
+
}
|
|
510
|
+
catch (error) {
|
|
511
|
+
rethrowFatalError(error);
|
|
512
|
+
options.signal?.throwIfAborted();
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
let selectedAgents = [];
|
|
517
|
+
try {
|
|
518
|
+
selectedAgents = selectAgents({ preferences: demand.preferences, targets: options.targets }).agents;
|
|
519
|
+
}
|
|
520
|
+
catch { /* The status result reports invalid strong state without extending observations. */ }
|
|
521
|
+
const observationDemand = { ...demand, plugins: [...observedPlugins.values()],
|
|
522
|
+
roots: [...new Map([...(demand.roots ?? []), ...candidates.flatMap((candidate) => {
|
|
523
|
+
const pluginId = `${candidate.sourceId}/${candidate.pluginName}`;
|
|
524
|
+
const plugin = observedPlugins.get(pluginId);
|
|
525
|
+
return plugin ? [{ pluginId, sourceId: candidate.sourceId, plugin, sourceState: 'ready', blockers: [] }] : [];
|
|
526
|
+
})].map((root) => [root.pluginId, root])).values()],
|
|
527
|
+
targetRequirements: demand.targetRequirements ? [...demand.targetRequirements,
|
|
528
|
+
...candidates.map((entry) => ({ pluginId: `${entry.sourceId}/${entry.pluginName}`, target: entry.platform }))] : undefined };
|
|
529
|
+
const adapters = options.nativeObservations ? { observations: [], existing: [], owned: [] }
|
|
530
|
+
: await readAdapterObservations({ ...options, targets: [...new Set([...selectedAgents, ...candidates.map((entry) => entry.platform)])] }, context, observationDemand);
|
|
184
531
|
const roots = new Set(demand.roots?.map((root) => root.pluginId) ?? []);
|
|
185
532
|
const queue = [...(demand.roots ?? []).map((root) => root.plugin).filter((plugin) => plugin !== undefined)];
|
|
186
533
|
const byId = new Map(demand.plugins.map((plugin) => [plugin.pluginId, plugin]));
|
|
@@ -199,45 +546,43 @@ export async function readScopedRecoveryStatus(options) {
|
|
|
199
546
|
const expected = (pluginId, agent) => demand.targetRequirements
|
|
200
547
|
? demand.targetRequirements.some((item) => item.pluginId === pluginId && item.target === agent)
|
|
201
548
|
: roots.has(pluginId) && agent !== null && demand.preferences.state === 'valid' && demand.preferences.value.targets.includes(agent);
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
&&
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}),
|
|
240
|
-
];
|
|
549
|
+
const nativeExtraObserved = adapters.owned
|
|
550
|
+
.filter((entry) => !expected(entry.pluginId, entry.agent))
|
|
551
|
+
.map((entry) => ({ ...entry,
|
|
552
|
+
expectedVersion: adapters.observations.find((item) => item.pluginId === entry.pluginId && item.platform === entry.agent)?.expectedVersion,
|
|
553
|
+
installedVersion: adapters.observations.find((item) => item.pluginId === entry.pluginId && item.platform === entry.agent)?.installedVersion,
|
|
554
|
+
delivery: { kind: 'native', platform: entry.agent },
|
|
555
|
+
observation: 'unknown', content: 'unknown', deploymentObservations: adapters.observations.find((observation) => observation.pluginId === entry.pluginId && observation.platform === entry.agent)?.deploymentObservations }));
|
|
556
|
+
const inventoryOwned = candidates.flatMap((entry) => {
|
|
557
|
+
// A verified Antigravity copy remains a native retirement candidate when
|
|
558
|
+
// its AW source is gone. Execution still verifies the live registration;
|
|
559
|
+
// the copy is not an owned filesystem output or AW source authority.
|
|
560
|
+
const nativeCopy = entry.platform === 'antigravity' && entry.scope === 'user'
|
|
561
|
+
&& entry.kind === 'namespacedMarketplace' && entry.recoveryCandidate?.evidence === 'verified'
|
|
562
|
+
&& entry.recoveryCandidate.binding.route === 'antigravity-cli';
|
|
563
|
+
return nativeCopy || entry.ownedComponent && !['codex', 'claude', 'gemini', 'copilot'].includes(entry.platform)
|
|
564
|
+
? [{ pluginId: `${entry.sourceId}/${entry.pluginName}`, agent: entry.platform, scope: options.scope }] : [];
|
|
565
|
+
});
|
|
566
|
+
for (const entry of inventoryOwned) {
|
|
567
|
+
if (!expected(entry.pluginId, entry.agent) && !nativeExtraObserved.some((target) => target.pluginId === entry.pluginId && target.agent === entry.agent)) {
|
|
568
|
+
nativeExtraObserved.push({ ...entry, delivery: { kind: 'native', platform: entry.agent }, observation: 'unknown', content: 'unknown' });
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
for (const entry of candidates) {
|
|
572
|
+
const component = entry.ownedComponent;
|
|
573
|
+
if (component?.kind !== 'owned-directory' || !['codex', 'claude', 'gemini', 'copilot'].includes(entry.platform)
|
|
574
|
+
|| component.identity.scope !== options.scope || entry.recoveryCandidate?.evidence !== 'verified'
|
|
575
|
+
|| component.identity.sourceId !== entry.sourceId || component.identity.sourceIdentity !== entry.sourceIdentity
|
|
576
|
+
|| component.identity.platform !== entry.platform || component.identity.pluginId !== `${entry.sourceId}/${entry.pluginName}`
|
|
577
|
+
|| component.identity.physicalKey !== entry.recoveryCandidate.binding.physicalKey)
|
|
578
|
+
continue;
|
|
579
|
+
const pluginId = component.identity.pluginId;
|
|
580
|
+
if (observedPlugins.get(pluginId)?.sourceIdentity === component.identity.sourceIdentity)
|
|
581
|
+
continue;
|
|
582
|
+
nativeExtraObserved.push({ pluginId, agent: entry.platform, scope: component.identity.scope,
|
|
583
|
+
delivery: { kind: 'native', platform: entry.platform }, observation: 'unknown', content: 'unknown',
|
|
584
|
+
backend: { retainedPackage: true, ownedComponents: [{ ...component, state: 'present' }] } });
|
|
585
|
+
}
|
|
241
586
|
const portableExtra = await inspectPortableExtraInstalled({
|
|
242
587
|
scope: options.scope, context, env: context.env, signal: options.signal,
|
|
243
588
|
});
|
|
@@ -245,25 +590,27 @@ export async function readScopedRecoveryStatus(options) {
|
|
|
245
590
|
const portableObserved = portableExtra.targets
|
|
246
591
|
.filter((entry) => !expected(entry.pluginId, entry.agent))
|
|
247
592
|
.map((entry) => ({ pluginId: entry.pluginId, agent: entry.agent, scope: options.scope,
|
|
248
|
-
delivery: { kind: 'agent-skills', provider: 'aw', agentId:
|
|
593
|
+
delivery: { kind: 'agent-skills', provider: 'aw', agentId: 'generic' },
|
|
249
594
|
observation: entry.observation, content: entry.content,
|
|
250
595
|
backend: { skill: entry.skill, logicalIdentity: entry.logicalIdentity } }));
|
|
251
596
|
const extraObserved = [...nativeExtraObserved, ...portableObserved];
|
|
252
597
|
const result = await statusFromObservations({ ...options, context, demand,
|
|
253
|
-
nativeObservations: options.nativeObservations ??
|
|
598
|
+
nativeObservations: options.nativeObservations ?? adapters.observations, extraObserved,
|
|
254
599
|
portableCoverage: portableExtra.complete, portableInstalled: portableExtra.targets,
|
|
255
|
-
nativeReadErrors:
|
|
256
|
-
.map((error) =>
|
|
600
|
+
nativeReadErrors: [
|
|
601
|
+
...ownerInventory.errors.map((error) => ({ code: error.kind === 'nativeStateRead' ? 'nativeStateUnreadable' : error.code })),
|
|
602
|
+
...adapters.observations.flatMap((entry) => entry.blockers.filter((error) => NATIVE_READ_ERRORS.has(error.code))),
|
|
603
|
+
].map((error) => diagnostic(error.code)) });
|
|
257
604
|
result.existingTargets = [
|
|
258
|
-
...
|
|
259
|
-
.map((target) => ({ pluginId: target.pluginId, agent: target.platform, scope: target.scope })) : []),
|
|
605
|
+
...adapters.existing,
|
|
260
606
|
...portableExtra.targets.map((target) => ({ pluginId: target.pluginId, agent: target.agent, scope: options.scope })),
|
|
261
607
|
];
|
|
262
608
|
result.ownedTargets = [
|
|
263
|
-
...
|
|
264
|
-
.map((target) => ({ pluginId: target.pluginId, agent: target.platform, scope: target.scope })) : []),
|
|
609
|
+
...adapters.owned, ...inventoryOwned,
|
|
265
610
|
...portableExtra.targets.map((target) => ({ pluginId: target.pluginId, agent: target.agent, scope: options.scope })),
|
|
266
611
|
];
|
|
612
|
+
await options.onNativeStatus?.(result, demand);
|
|
613
|
+
options.signal?.throwIfAborted();
|
|
267
614
|
return result;
|
|
268
615
|
}
|
|
269
616
|
finally {
|
|
@@ -315,35 +662,78 @@ export function aggregateConvergence(allSatisfied, residue) {
|
|
|
315
662
|
}
|
|
316
663
|
export async function readRecoveryStatus(options, preparedDemand) {
|
|
317
664
|
const snapshot = preparedDemand ?? await readJointDemand(options);
|
|
665
|
+
if (options.codexObservationSession || options.nativeObservations) {
|
|
666
|
+
return readRecoveryStatusInSession(options, snapshot);
|
|
667
|
+
}
|
|
668
|
+
const context = await createScopeContext({ scope: snapshot.context.context,
|
|
669
|
+
cwd: snapshot.context.projectRoot ?? options.cwd, env: options.env, readOnly: true });
|
|
670
|
+
let session;
|
|
671
|
+
try {
|
|
672
|
+
options.signal?.throwIfAborted();
|
|
673
|
+
session = await createCodexNativeObservationSession({ exactCwd: context.executionCwd, env: context.env,
|
|
674
|
+
runner: async (request) => {
|
|
675
|
+
const result = await runNativeCli({ ...request, signal: options.signal,
|
|
676
|
+
timeoutMs: DEFAULT_AGENT_VERSION_PROBE_TIMEOUT_MS }, options.nativeCliRunner);
|
|
677
|
+
if (Buffer.byteLength(result.stdout) + Buffer.byteLength(result.stderr) > 1024 * 1024)
|
|
678
|
+
throw new Error('nativeObservationOutputLimit');
|
|
679
|
+
return result;
|
|
680
|
+
} });
|
|
681
|
+
// User reads use only this session's neutral cwd. Project reads add the
|
|
682
|
+
// exact project snapshot without repeating the same neutral observation.
|
|
683
|
+
return await readRecoveryStatusInSession({ ...options, codexObservationSession: session }, snapshot);
|
|
684
|
+
}
|
|
685
|
+
finally {
|
|
686
|
+
try {
|
|
687
|
+
await session?.dispose();
|
|
688
|
+
}
|
|
689
|
+
finally {
|
|
690
|
+
await context.dispose();
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
async function readRecoveryStatusInSession(options, snapshot) {
|
|
318
695
|
const plan = deriveJointDemand(snapshot);
|
|
319
696
|
const scopes = [snapshot.user, ...(snapshot.project ? [snapshot.project] : [])];
|
|
320
697
|
const observed = [];
|
|
321
698
|
for (const demand of scopes) {
|
|
322
699
|
const nodes = plan.placements.filter((item) => item.scope === demand.scope
|
|
323
|
-
|| demand.scope === 'project' &&
|
|
700
|
+
|| demand.scope === 'project' && ['codex', 'claude', 'gemini', 'copilot'].includes(item.target)
|
|
324
701
|
&& item.contributions.some((contribution) => contribution.scope === 'project'));
|
|
325
702
|
const expanded = { ...demand,
|
|
326
703
|
userProviders: demand.scope === 'project' ? Object.fromEntries((snapshot.preferences?.targets ?? []).map((target) => [target,
|
|
327
|
-
plan.placements.filter((item) => item.scope === 'user' && item.target === target
|
|
704
|
+
plan.placements.filter((item) => item.scope === 'user' && item.target === target
|
|
705
|
+
&& !nodes.some((project) => project.scope === 'project' && project.pluginId === item.pluginId && project.target === item.target)).map((item) => item.pluginId)])) : {},
|
|
328
706
|
targetRequirements: nodes.map((item) => ({ pluginId: item.pluginId, target: item.target })), roots: demand.roots === null ? null : [...new Map(nodes.map((item) => [item.pluginId, {
|
|
329
707
|
pluginId: item.pluginId, sourceId: item.plugin.sourceId, sourceState: 'ready',
|
|
330
708
|
blockers: [], plugin: item.plugin,
|
|
331
709
|
}])).values()] };
|
|
332
|
-
observed.push(await readScopedRecoveryStatus({ ...options, scope: demand.scope,
|
|
710
|
+
observed.push(await readScopedRecoveryStatus({ ...options, onNativeStatus: undefined, scope: demand.scope,
|
|
333
711
|
cwd: snapshot.context.projectRoot ?? options.cwd, targets: undefined, demandOverride: expanded }));
|
|
334
712
|
}
|
|
335
|
-
const allTargets = observed.flatMap((status) => status.inventory?.flatMap((item) => item.targetResults) ?? [])
|
|
713
|
+
const allTargets = observed.flatMap((status) => status.inventory?.flatMap((item) => item.targetResults) ?? []).map((target) => {
|
|
714
|
+
const providers = plan.placements.filter((placement) => placement.pluginId === target.pluginId && placement.target === target.agent
|
|
715
|
+
&& (placement.scope === target.scope || target.scope === 'project'
|
|
716
|
+
&& ['codex', 'claude', 'gemini', 'copilot'].includes(target.agent) && placement.scope === 'user'
|
|
717
|
+
&& placement.contributions.some((entry) => entry.scope === 'project')));
|
|
718
|
+
const contributions = providers.flatMap((provider) => provider.contributions
|
|
719
|
+
.filter((entry) => provider.scope === target.scope || entry.scope === target.scope));
|
|
720
|
+
return { ...target, contributions: contributions.map((entry) => ({ root: entry.root, scope: entry.scope, path: [...entry.path] })),
|
|
721
|
+
requiredBy: [...new Set(contributions.map((entry) => entry.root))], providerScope: providers[0]?.scope,
|
|
722
|
+
relation: contributions.some((entry) => entry.path.length === 1 && entry.scope === target.scope) ? 'root' : 'dependency' };
|
|
723
|
+
});
|
|
336
724
|
const inventory = scopes.some((demand) => demand.roots !== null) ? [] : null;
|
|
337
725
|
const visibleInventory = [];
|
|
338
726
|
for (const demand of scopes)
|
|
339
727
|
for (const root of demand.roots ?? []) {
|
|
340
728
|
const targetResults = [];
|
|
341
729
|
for (const requirement of plan.roots.filter((entry) => entry.scope === demand.scope && entry.pluginId === root.pluginId)) {
|
|
342
|
-
const placement = plan.placements.find((item) => item.pluginId === root.pluginId && item.target === requirement.target
|
|
730
|
+
const placement = plan.placements.find((item) => item.pluginId === root.pluginId && item.target === requirement.target
|
|
731
|
+
&& item.contributions.some((contribution) => contribution.scope === demand.scope && contribution.root === root.pluginId));
|
|
343
732
|
const target = { pluginId: root.pluginId, agent: requirement.target, scope: demand.scope,
|
|
344
733
|
requirementScope: demand.scope, providerScope: placement?.scope,
|
|
345
734
|
delivery: root.plugin ? resolveDelivery(root.plugin.manifest, requirement.target, demand.scope) ?? null : null,
|
|
346
|
-
execution: 'not-run', observation: 'unknown', content: 'unknown', requiredBy: [root.pluginId], relation: 'root',
|
|
735
|
+
execution: 'not-run', observation: 'unknown', content: 'unknown', requiredBy: [root.pluginId], relation: 'root',
|
|
736
|
+
...(root.plugin?.manifest.version ? { expectedVersion: root.plugin.manifest.version } : {}), blockers: [...requirement.blockers] };
|
|
347
737
|
if (requirement.state === 'excluded' || requirement.state === 'unsupported') {
|
|
348
738
|
target.satisfaction = requirement.state;
|
|
349
739
|
target.content = 'satisfied';
|
|
@@ -353,9 +743,10 @@ export async function readRecoveryStatus(options, preparedDemand) {
|
|
|
353
743
|
}
|
|
354
744
|
else if (requirement.state === 'required') {
|
|
355
745
|
const providers = requirement.dependencies.map((id) => {
|
|
356
|
-
const provider = plan.placements.find((item) => item.pluginId === id && item.target === requirement.target
|
|
746
|
+
const provider = plan.placements.find((item) => item.pluginId === id && item.target === requirement.target
|
|
747
|
+
&& item.contributions.some((contribution) => contribution.scope === demand.scope && contribution.root === root.pluginId));
|
|
357
748
|
const actual = allTargets.find((item) => item.pluginId === id && item.agent === requirement.target && item.scope === provider?.scope);
|
|
358
|
-
if (demand.scope === 'project' && provider?.scope === 'user' &&
|
|
749
|
+
if (demand.scope === 'project' && provider?.scope === 'user' && ['codex', 'claude', 'gemini', 'copilot'].includes(requirement.target)) {
|
|
359
750
|
const activation = allTargets.find((item) => item.pluginId === id && item.agent === requirement.target && item.scope === 'project');
|
|
360
751
|
if (actual?.content !== 'satisfied')
|
|
361
752
|
return actual;
|
|
@@ -373,7 +764,19 @@ export async function readRecoveryStatus(options, preparedDemand) {
|
|
|
373
764
|
}
|
|
374
765
|
return actual;
|
|
375
766
|
});
|
|
767
|
+
const ownProvider = providers.find((provider) => provider?.pluginId === root.pluginId);
|
|
768
|
+
if (ownProvider?.installedVersion)
|
|
769
|
+
target.installedVersion = ownProvider.installedVersion;
|
|
376
770
|
target.blockers.push(...providers.flatMap((item) => item?.blockers ?? []));
|
|
771
|
+
const componentGaps = providers.flatMap((item) => item?.componentGaps ?? []);
|
|
772
|
+
if (componentGaps.length)
|
|
773
|
+
target.componentGaps = [...new Map(componentGaps.map((gap) => [JSON.stringify([gap.providerPluginId, gap.agent, gap.renderScope, gap.id]), gap])).values()];
|
|
774
|
+
const exclusions = providers.flatMap((item) => item?.deploymentExclusions ?? []);
|
|
775
|
+
if (exclusions.length)
|
|
776
|
+
target.deploymentExclusions = [...new Map(exclusions.map((exclusion) => [JSON.stringify([exclusion.pluginId, exclusion.platform, exclusion.scope, exclusion.productId, exclusion.reasonCode]), exclusion])).values()];
|
|
777
|
+
const deployments = providers.flatMap((item) => item?.deploymentObservations ?? []);
|
|
778
|
+
if (deployments.length)
|
|
779
|
+
target.deploymentObservations = [...new Map(deployments.map((item) => [item.bindingId, item])).values()];
|
|
377
780
|
target.content = ['conflict', 'drifted', 'absent', 'unknown'].find((state) => providers.some((item) => (item?.content ?? 'unknown') === state)) ?? 'satisfied';
|
|
378
781
|
target.observation = target.content === 'satisfied' ? 'verified' : target.content === 'absent' ? 'missing' : 'unknown';
|
|
379
782
|
target.satisfaction = target.content === 'satisfied' ? demand.scope === 'project' && placement?.scope === 'user' ? 'inherited-user' : 'installed'
|
|
@@ -388,18 +791,16 @@ export async function readRecoveryStatus(options, preparedDemand) {
|
|
|
388
791
|
const expected = new Set(plan.placements.map((item) => `${item.pluginId}\0${item.target}\0${item.scope}`));
|
|
389
792
|
const extraObserved = observed.flatMap((status) => status.extraObserved)
|
|
390
793
|
.filter((item) => !expected.has(`${item.pluginId}\0${item.agent}\0${item.scope}`));
|
|
391
|
-
const conflicts = findPlacementConflicts([...plan.placements,
|
|
392
|
-
...extraObserved.filter((item) => item.agent !== null)
|
|
393
|
-
.map((item) => ({ pluginId: item.pluginId, target: item.agent, scope: item.scope }))]);
|
|
394
794
|
const targets = visibleInventory.flatMap((item) => item.targetResults);
|
|
395
795
|
const knownFailure = plan.errors.some((error) => ['targetsNotConfigured', 'dependencyExcluded', 'dependencyContractInvalid', 'targetPlacementConflict'].includes(error.code))
|
|
396
|
-
||
|
|
796
|
+
|| targets.some((target) => ['absent', 'drifted', 'conflict'].includes(target.content ?? 'unknown')
|
|
797
|
+
|| target.blockers.some((entry) => entry.code === 'awCapabilityUnsupported'));
|
|
397
798
|
const uncertain = !plan.complete || targets.some((target) => target.content === 'unknown' || target.blockers.length > 0);
|
|
398
799
|
const allSatisfied = knownFailure ? false : uncertain ? null : true;
|
|
399
800
|
const nativeCoverage = observed.every((status) => status.coverage.native);
|
|
400
801
|
const portableCoverage = observed.every((status) => status.coverage.portable);
|
|
401
|
-
const errors = [...plan.errors, ...
|
|
402
|
-
|
|
802
|
+
const errors = [...plan.errors, ...observed.flatMap((status) => status.errors)];
|
|
803
|
+
const result = { schemaVersion: 1, kind: 'aw-recovery-status', scope: snapshot.context.context, ok: errors.length === 0,
|
|
403
804
|
intent: { state: scopes.some((demand) => demand.intent.state === 'invalid') ? 'invalid'
|
|
404
805
|
: scopes.some((demand) => demand.intent.state === 'unreadable') ? 'unreadable'
|
|
405
806
|
: scopes.some((demand) => demand.intent.state === 'unsupported-version') ? 'unsupported-version'
|
|
@@ -414,5 +815,8 @@ export async function readRecoveryStatus(options, preparedDemand) {
|
|
|
414
815
|
unconfirmed: targets.filter((target) => target.content === 'unknown').length,
|
|
415
816
|
ready: targets.filter((target) => target.content === 'satisfied').length },
|
|
416
817
|
allSatisfied, inSync: aggregateConvergence(allSatisfied, extraObserved.length ? 'present' : nativeCoverage && portableCoverage ? 'absent' : 'unknown'), errors };
|
|
818
|
+
await options.onNativeStatus?.(result, snapshot.context.context === 'project' ? snapshot.project : snapshot.user);
|
|
819
|
+
options.signal?.throwIfAborted();
|
|
820
|
+
return result;
|
|
417
821
|
}
|
|
418
822
|
//# sourceMappingURL=status.js.map
|