@lesliechan721/aw 0.1.0-beta.9 → 0.1.0-beta.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring/assets/aw-config.mjs +100 -501
- package/dist/authoring/assets/aw-config.mjs.map +1 -1
- package/dist/authoring/assets/aw-runtime-config.d.mts +13 -0
- package/dist/authoring/assets/aw-runtime-config.mjs +221 -0
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
- package/dist/authoring/assets/command-runtime-config.d.mts +9 -0
- package/dist/authoring/assets/command-runtime-config.mjs +134 -0
- package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
- package/dist/authoring/scripts/add-skill.mjs +15 -38
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +72 -96
- package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-root.mjs +4 -4
- package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
- package/dist/authoring/scripts/lib/plugin-version-check.mjs +230 -9
- package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.d.mts +2 -2
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +4 -7
- package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +396 -1997
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-skill.mjs +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/native-runtime/reader-runtime.mjs +34 -0
- package/dist/native-runtime/reader.d.mts +6 -0
- package/dist/native-runtime/reader.mjs +11 -0
- package/dist/scripts/aw-skill-eval-materializer.d.ts +11 -1
- package/dist/scripts/aw-skill-eval-materializer.js +118 -115
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/scripts/bundle-plugins.js +25 -7
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.d.ts +7 -7
- package/dist/scripts/plugin-staging.js +10 -8
- package/dist/scripts/plugin-staging.js.map +1 -1
- package/dist/scripts/plugin-test-reporter.d.mts +2 -0
- package/dist/scripts/plugin-test-reporter.mjs +21 -0
- package/dist/scripts/plugin-test-reporter.mjs.map +1 -0
- package/dist/scripts/test-plugin-scripts.d.ts +5 -0
- package/dist/scripts/test-plugin-scripts.js +284 -78
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/scripts/test-workers.d.mts +24 -0
- package/dist/scripts/test-workers.mjs +59 -0
- package/dist/scripts/test-workers.mjs.map +1 -0
- package/dist/src/adapters/helpers.d.ts +7 -0
- package/dist/src/adapters/helpers.js.map +1 -1
- package/dist/src/authoring/workspace-commands.d.ts +3 -0
- package/dist/src/authoring/workspace-commands.js +7 -2
- package/dist/src/authoring/workspace-commands.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +42 -21
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/catalog-dev-source.d.ts +42 -3
- package/dist/src/commands/catalog-dev-source.js +351 -43
- package/dist/src/commands/catalog-dev-source.js.map +1 -1
- package/dist/src/commands/catalog-generation.d.ts +8 -0
- package/dist/src/commands/catalog-generation.js +1 -5
- package/dist/src/commands/catalog-generation.js.map +1 -1
- package/dist/src/commands/catalog-publication-inspection.d.ts +42 -3
- package/dist/src/commands/catalog-publication-inspection.js +379 -48
- package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
- package/dist/src/commands/catalog-publication-journal.d.ts +23 -4
- package/dist/src/commands/catalog-publication-journal.js +165 -20
- package/dist/src/commands/catalog-publication-journal.js.map +1 -1
- package/dist/src/commands/catalog-publish.d.ts +34 -3
- package/dist/src/commands/catalog-publish.js +311 -165
- package/dist/src/commands/catalog-publish.js.map +1 -1
- package/dist/src/commands/catalog-source.d.ts +54 -8
- package/dist/src/commands/catalog-source.js +277 -15
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/catalog-status.js +2 -2
- package/dist/src/commands/catalog-status.js.map +1 -1
- package/dist/src/commands/catalog-store.d.ts +104 -0
- package/dist/src/commands/catalog-store.js +685 -0
- package/dist/src/commands/catalog-store.js.map +1 -0
- package/dist/src/commands/catalog-workspace-resolution.d.ts +4 -0
- package/dist/src/commands/catalog-workspace-resolution.js +18 -3
- package/dist/src/commands/catalog-workspace-resolution.js.map +1 -1
- package/dist/src/commands/console.js +33 -20
- package/dist/src/commands/console.js.map +1 -1
- package/dist/src/commands/dependency-operation-plan.d.ts +14 -56
- package/dist/src/commands/dependency-operation-plan.js +90 -133
- package/dist/src/commands/dependency-operation-plan.js.map +1 -1
- package/dist/src/commands/deployment-confirmation.d.ts +11 -0
- package/dist/src/commands/deployment-confirmation.js +88 -0
- package/dist/src/commands/deployment-confirmation.js.map +1 -0
- package/dist/src/commands/init.js +1 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/intent-command.d.ts +34 -0
- package/dist/src/commands/intent-command.js +174 -0
- package/dist/src/commands/intent-command.js.map +1 -0
- package/dist/src/commands/lifecycle-command-package.d.ts +45 -0
- package/dist/src/commands/lifecycle-command-package.js +199 -0
- package/dist/src/commands/lifecycle-command-package.js.map +1 -0
- package/dist/src/commands/managed-commands.d.ts +41 -0
- package/dist/src/commands/managed-commands.js +404 -0
- package/dist/src/commands/managed-commands.js.map +1 -0
- package/dist/src/commands/offline-cleanup-evidence.d.ts +29 -3
- package/dist/src/commands/offline-cleanup-evidence.js +80 -10
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
- package/dist/src/commands/operation-plan.d.ts +191 -0
- package/dist/src/commands/operation-plan.js +96 -0
- package/dist/src/commands/operation-plan.js.map +1 -0
- package/dist/src/commands/operation-planner.d.ts +47 -0
- package/dist/src/commands/operation-planner.js +142 -0
- package/dist/src/commands/operation-planner.js.map +1 -0
- package/dist/src/commands/options.d.ts +11 -20
- package/dist/src/commands/options.js +31 -36
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/permission-batch.d.ts +5 -0
- package/dist/src/commands/permission-batch.js +80 -0
- package/dist/src/commands/permission-batch.js.map +1 -0
- package/dist/src/commands/plugin-capabilities.js +96 -46
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-config-confirmation.d.ts +14 -0
- package/dist/src/commands/public-config-confirmation.js +73 -0
- package/dist/src/commands/public-config-confirmation.js.map +1 -0
- package/dist/src/commands/public-interruption.d.ts +9 -0
- package/dist/src/commands/public-interruption.js +23 -0
- package/dist/src/commands/public-interruption.js.map +1 -0
- package/dist/src/commands/public-lifecycle-result.d.ts +106 -0
- package/dist/src/commands/public-lifecycle-result.js +518 -0
- package/dist/src/commands/public-lifecycle-result.js.map +1 -0
- package/dist/src/commands/public-lifecycle.d.ts +27 -0
- package/dist/src/commands/public-lifecycle.js +563 -0
- package/dist/src/commands/public-lifecycle.js.map +1 -0
- package/dist/src/commands/public-plugin-query.d.ts +16 -0
- package/dist/src/commands/public-plugin-query.js +230 -0
- package/dist/src/commands/public-plugin-query.js.map +1 -0
- package/dist/src/commands/rebuild-command.d.ts +176 -25
- package/dist/src/commands/rebuild-command.js +3989 -1392
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +133 -52
- package/dist/src/commands/rebuild-integration.js +1097 -2692
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +74 -23
- package/dist/src/commands/rebuild-operations.js +334 -227
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +81 -0
- package/dist/src/commands/rebuild-platform-integration.js +1992 -0
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
- package/dist/src/commands/reconcile-operation-plan.d.ts +31 -0
- package/dist/src/commands/reconcile-operation-plan.js +48 -0
- package/dist/src/commands/reconcile-operation-plan.js.map +1 -0
- package/dist/src/commands/review-inspection.d.ts +60 -0
- package/dist/src/commands/review-inspection.js +436 -0
- package/dist/src/commands/review-inspection.js.map +1 -0
- package/dist/src/commands/review-preparation.d.ts +51 -0
- package/dist/src/commands/review-preparation.js +400 -0
- package/dist/src/commands/review-preparation.js.map +1 -0
- package/dist/src/commands/runtime.d.ts +6 -6
- package/dist/src/commands/runtime.js +44 -24
- package/dist/src/commands/runtime.js.map +1 -1
- package/dist/src/commands/skill-eval.d.ts +8 -0
- package/dist/src/commands/skill-eval.js +126 -73
- package/dist/src/commands/skill-eval.js.map +1 -1
- package/dist/src/commands/status-v6.d.ts +185 -68
- package/dist/src/commands/status-v6.js +1592 -499
- package/dist/src/commands/status-v6.js.map +1 -1
- package/dist/src/commands/targets-command.d.ts +38 -0
- package/dist/src/commands/targets-command.js +182 -0
- package/dist/src/commands/targets-command.js.map +1 -0
- package/dist/src/commands/wizard.d.ts +8 -5
- package/dist/src/commands/wizard.js +7 -4
- package/dist/src/commands/wizard.js.map +1 -1
- package/dist/src/commands/write-commands.d.ts +9 -3
- package/dist/src/commands/write-commands.js +144 -44
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/constants.d.ts +2 -3
- package/dist/src/constants.js +2 -3
- package/dist/src/constants.js.map +1 -1
- package/dist/src/eval/manifest-v1.d.ts +6 -2
- package/dist/src/eval/manifest-v1.js +58 -26
- package/dist/src/eval/manifest-v1.js.map +1 -1
- package/dist/src/generators/local-plugin.d.ts +4 -2
- package/dist/src/generators/local-plugin.js +207 -346
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/generators/permissions.d.ts +20 -2
- package/dist/src/generators/permissions.js +82 -15
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.d.ts +3 -33
- package/dist/src/index.js +1786 -1945
- package/dist/src/index.js.map +1 -1
- package/dist/src/intent/deployment-preferences.d.ts +63 -0
- package/dist/src/intent/deployment-preferences.js +170 -0
- package/dist/src/intent/deployment-preferences.js.map +1 -0
- package/dist/src/intent/diagnostics.d.ts +11 -0
- package/dist/src/intent/diagnostics.js +14 -0
- package/dist/src/intent/diagnostics.js.map +1 -0
- package/dist/src/intent/intent-codec.d.ts +19 -0
- package/dist/src/intent/intent-codec.js +117 -0
- package/dist/src/intent/intent-codec.js.map +1 -0
- package/dist/src/intent/intent-store.d.ts +43 -0
- package/dist/src/intent/intent-store.js +118 -0
- package/dist/src/intent/intent-store.js.map +1 -0
- package/dist/src/intent/scope-context.d.ts +35 -0
- package/dist/src/intent/scope-context.js +179 -0
- package/dist/src/intent/scope-context.js.map +1 -0
- package/dist/src/intent/work-context.d.ts +13 -0
- package/dist/src/intent/work-context.js +22 -0
- package/dist/src/intent/work-context.js.map +1 -0
- package/dist/src/output/command-receipt.d.ts +37 -86
- package/dist/src/output/command-receipt.js +257 -179
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/component-delivery.d.ts +28 -0
- package/dist/src/output/component-delivery.js +138 -0
- package/dist/src/output/component-delivery.js.map +1 -0
- package/dist/src/output/public-result.d.ts +69 -0
- package/dist/src/output/public-result.js +403 -0
- package/dist/src/output/public-result.js.map +1 -0
- package/dist/src/output/rebuild-progress.d.ts +3 -0
- package/dist/src/output/rebuild-progress.js +34 -16
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/output/receipt-projection.d.ts +7 -0
- package/dist/src/output/receipt-projection.js +664 -0
- package/dist/src/output/receipt-projection.js.map +1 -0
- package/dist/src/output/skill-invocation-notices.d.ts +18 -0
- package/dist/src/output/skill-invocation-notices.js +84 -0
- package/dist/src/output/skill-invocation-notices.js.map +1 -0
- package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
- package/dist/src/platforms/antigravity-permissions.js +388 -0
- package/dist/src/platforms/antigravity-permissions.js.map +1 -0
- package/dist/src/platforms/capabilities.d.ts +17 -0
- package/dist/src/platforms/capabilities.js +328 -0
- package/dist/src/platforms/capabilities.js.map +1 -0
- package/dist/src/platforms/contracts.d.ts +402 -0
- package/dist/src/platforms/contracts.js +2 -0
- package/dist/src/platforms/contracts.js.map +1 -0
- package/dist/src/platforms/cursor-workspace-hook.d.ts +28 -0
- package/dist/src/platforms/cursor-workspace-hook.js +198 -0
- package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
- package/dist/src/platforms/discovery.d.ts +98 -0
- package/dist/src/platforms/discovery.js +777 -0
- package/dist/src/platforms/discovery.js.map +1 -0
- package/dist/src/platforms/grok-permission-config.d.ts +23 -0
- package/dist/src/platforms/grok-permission-config.js +184 -0
- package/dist/src/platforms/grok-permission-config.js.map +1 -0
- package/dist/src/platforms/grok-permission-document.d.ts +4 -0
- package/dist/src/platforms/grok-permission-document.js +145 -0
- package/dist/src/platforms/grok-permission-document.js.map +1 -0
- package/dist/src/platforms/grok-permissions.d.ts +17 -0
- package/dist/src/platforms/grok-permissions.js +311 -0
- package/dist/src/platforms/grok-permissions.js.map +1 -0
- package/dist/src/platforms/host-permission-policy.d.ts +38 -0
- package/dist/src/platforms/host-permission-policy.js +86 -0
- package/dist/src/platforms/host-permission-policy.js.map +1 -0
- package/dist/src/platforms/identity.d.ts +4 -0
- package/dist/src/platforms/identity.js +22 -0
- package/dist/src/platforms/identity.js.map +1 -0
- package/dist/src/platforms/inspection-grok.d.ts +4 -0
- package/dist/src/platforms/inspection-grok.js +366 -0
- package/dist/src/platforms/inspection-grok.js.map +1 -0
- package/dist/src/platforms/inspection-native.d.ts +6 -0
- package/dist/src/platforms/inspection-native.js +373 -0
- package/dist/src/platforms/inspection-native.js.map +1 -0
- package/dist/src/platforms/inspection-opencode.d.ts +4 -0
- package/dist/src/platforms/inspection-opencode.js +98 -0
- package/dist/src/platforms/inspection-opencode.js.map +1 -0
- package/dist/src/platforms/inspection-pi.d.ts +9 -0
- package/dist/src/platforms/inspection-pi.js +482 -0
- package/dist/src/platforms/inspection-pi.js.map +1 -0
- package/dist/src/platforms/inspection-query.d.ts +24 -0
- package/dist/src/platforms/inspection-query.js +119 -0
- package/dist/src/platforms/inspection-query.js.map +1 -0
- package/dist/src/platforms/inspection.d.ts +20 -0
- package/dist/src/platforms/inspection.js +259 -0
- package/dist/src/platforms/inspection.js.map +1 -0
- package/dist/src/platforms/layout.d.ts +35 -0
- package/dist/src/platforms/layout.js +317 -0
- package/dist/src/platforms/layout.js.map +1 -0
- package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
- package/dist/src/platforms/lifecycle-native-services.js +147 -0
- package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
- package/dist/src/platforms/lifecycle-native.d.ts +14 -0
- package/dist/src/platforms/lifecycle-native.js +223 -0
- package/dist/src/platforms/lifecycle-native.js.map +1 -0
- package/dist/src/platforms/lifecycle.d.ts +27 -0
- package/dist/src/platforms/lifecycle.js +567 -0
- package/dist/src/platforms/lifecycle.js.map +1 -0
- package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
- package/dist/src/platforms/opencode-permission-config.js +253 -0
- package/dist/src/platforms/opencode-permission-config.js.map +1 -0
- package/dist/src/platforms/opencode-permissions.d.ts +39 -0
- package/dist/src/platforms/opencode-permissions.js +212 -0
- package/dist/src/platforms/opencode-permissions.js.map +1 -0
- package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
- package/dist/src/platforms/opencode-related-permissions.js +177 -0
- package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
- package/dist/src/platforms/permission-ownership.d.ts +89 -0
- package/dist/src/platforms/permission-ownership.js +543 -0
- package/dist/src/platforms/permission-ownership.js.map +1 -0
- package/dist/src/platforms/permission-sidecar.d.ts +70 -0
- package/dist/src/platforms/permission-sidecar.js +215 -0
- package/dist/src/platforms/permission-sidecar.js.map +1 -0
- package/dist/src/platforms/projection-code-extension.d.ts +8 -0
- package/dist/src/platforms/projection-code-extension.js +126 -0
- package/dist/src/platforms/projection-code-extension.js.map +1 -0
- package/dist/src/platforms/projection-command-resources.d.ts +7 -0
- package/dist/src/platforms/projection-command-resources.js +74 -0
- package/dist/src/platforms/projection-command-resources.js.map +1 -0
- package/dist/src/platforms/projection-files.d.ts +27 -0
- package/dist/src/platforms/projection-files.js +111 -0
- package/dist/src/platforms/projection-files.js.map +1 -0
- package/dist/src/platforms/projection-marketplace.d.ts +19 -0
- package/dist/src/platforms/projection-marketplace.js +42 -0
- package/dist/src/platforms/projection-marketplace.js.map +1 -0
- package/dist/src/platforms/projection.d.ts +13 -0
- package/dist/src/platforms/projection.js +576 -0
- package/dist/src/platforms/projection.js.map +1 -0
- package/dist/src/platforms/registry.d.ts +4 -0
- package/dist/src/platforms/registry.js +30 -0
- package/dist/src/platforms/registry.js.map +1 -0
- package/dist/src/platforms/supplement-layout.d.ts +20 -0
- package/dist/src/platforms/supplement-layout.js +53 -0
- package/dist/src/platforms/supplement-layout.js.map +1 -0
- package/dist/src/platforms/supplement-state.d.ts +13 -0
- package/dist/src/platforms/supplement-state.js +93 -0
- package/dist/src/platforms/supplement-state.js.map +1 -0
- package/dist/src/portable/commands.d.ts +58 -11
- package/dist/src/portable/commands.js +99 -345
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/historical-materialization.d.ts +22 -0
- package/dist/src/portable/historical-materialization.js +124 -0
- package/dist/src/portable/historical-materialization.js.map +1 -0
- package/dist/src/portable/materializer.d.ts +29 -1
- package/dist/src/portable/materializer.js +197 -258
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery-layout.d.ts +17 -0
- package/dist/src/portable/recovery-layout.js +42 -0
- package/dist/src/portable/recovery-layout.js.map +1 -0
- package/dist/src/portable/recovery.d.ts +176 -0
- package/dist/src/portable/recovery.js +556 -0
- package/dist/src/portable/recovery.js.map +1 -0
- package/dist/src/portable/writer.d.ts +67 -0
- package/dist/src/portable/writer.js +321 -0
- package/dist/src/portable/writer.js.map +1 -0
- package/dist/src/recovery/coordinator.d.ts +168 -0
- package/dist/src/recovery/coordinator.js +1558 -0
- package/dist/src/recovery/coordinator.js.map +1 -0
- package/dist/src/recovery/demand.d.ts +53 -0
- package/dist/src/recovery/demand.js +189 -0
- package/dist/src/recovery/demand.js.map +1 -0
- package/dist/src/recovery/install-concurrency.d.ts +48 -0
- package/dist/src/recovery/install-concurrency.js +196 -0
- package/dist/src/recovery/install-concurrency.js.map +1 -0
- package/dist/src/recovery/interruption.d.ts +19 -0
- package/dist/src/recovery/interruption.js +43 -0
- package/dist/src/recovery/interruption.js.map +1 -0
- package/dist/src/recovery/joint-coordinator.d.ts +46 -0
- package/dist/src/recovery/joint-coordinator.js +1641 -0
- package/dist/src/recovery/joint-coordinator.js.map +1 -0
- package/dist/src/recovery/joint-demand.d.ts +72 -0
- package/dist/src/recovery/joint-demand.js +332 -0
- package/dist/src/recovery/joint-demand.js.map +1 -0
- package/dist/src/recovery/joint-install-execution.d.ts +19 -0
- package/dist/src/recovery/joint-install-execution.js +308 -0
- package/dist/src/recovery/joint-install-execution.js.map +1 -0
- package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
- package/dist/src/recovery/joint-install-native-rebase.js +67 -0
- package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
- package/dist/src/recovery/performance.d.ts +4 -0
- package/dist/src/recovery/performance.js +26 -0
- package/dist/src/recovery/performance.js.map +1 -0
- package/dist/src/recovery/receipt.d.ts +129 -0
- package/dist/src/recovery/receipt.js +91 -0
- package/dist/src/recovery/receipt.js.map +1 -0
- package/dist/src/recovery/retirement.d.ts +47 -0
- package/dist/src/recovery/retirement.js +463 -0
- package/dist/src/recovery/retirement.js.map +1 -0
- package/dist/src/recovery/status.d.ts +143 -0
- package/dist/src/recovery/status.js +1517 -0
- package/dist/src/recovery/status.js.map +1 -0
- package/dist/src/recovery/types.d.ts +85 -0
- package/dist/src/recovery/types.js +2 -0
- package/dist/src/recovery/types.js.map +1 -0
- package/dist/src/review/eval-source-input.d.ts +44 -0
- package/dist/src/review/eval-source-input.js +213 -0
- package/dist/src/review/eval-source-input.js.map +1 -0
- package/dist/src/review/platform-profile.d.ts +6 -0
- package/dist/src/review/platform-profile.js +24 -0
- package/dist/src/review/platform-profile.js.map +1 -0
- package/dist/src/review/review-profile.d.ts +20 -0
- package/dist/src/review/review-profile.js +276 -0
- package/dist/src/review/review-profile.js.map +1 -0
- package/dist/src/review/review-selection.d.ts +20 -0
- package/dist/src/review/review-selection.js +502 -0
- package/dist/src/review/review-selection.js.map +1 -0
- package/dist/src/review/review-types.d.ts +71 -0
- package/dist/src/review/review-types.js +16 -0
- package/dist/src/review/review-types.js.map +1 -0
- package/dist/src/review/skill-materialization.d.ts +65 -0
- package/dist/src/review/skill-materialization.js +228 -0
- package/dist/src/review/skill-materialization.js.map +1 -0
- package/dist/src/review/source-binding.d.ts +201 -0
- package/dist/src/review/source-binding.js +782 -0
- package/dist/src/review/source-binding.js.map +1 -0
- package/dist/src/tui/agent-management.d.ts +23 -0
- package/dist/src/tui/agent-management.js +319 -0
- package/dist/src/tui/agent-management.js.map +1 -0
- package/dist/src/tui/agent-settings.d.ts +47 -0
- package/dist/src/tui/agent-settings.js +97 -0
- package/dist/src/tui/agent-settings.js.map +1 -0
- package/dist/src/tui/catalog-freshness.d.ts +1 -0
- package/dist/src/tui/catalog-freshness.js +2 -0
- package/dist/src/tui/catalog-freshness.js.map +1 -0
- package/dist/src/tui/catalog-generation.d.ts +8 -16
- package/dist/src/tui/catalog-generation.js +97 -10
- package/dist/src/tui/catalog-generation.js.map +1 -1
- package/dist/src/tui/catalog-sources/projection.d.ts +4 -0
- package/dist/src/tui/catalog-sources/projection.js +17 -0
- package/dist/src/tui/catalog-sources/projection.js.map +1 -0
- package/dist/src/tui/catalog-sources/review.d.ts +3 -0
- package/dist/src/tui/catalog-sources/review.js +13 -0
- package/dist/src/tui/catalog-sources/review.js.map +1 -0
- package/dist/src/tui/catalog-sources/screens.d.ts +12 -0
- package/dist/src/tui/catalog-sources/screens.js +40 -0
- package/dist/src/tui/catalog-sources/screens.js.map +1 -0
- package/dist/src/tui/catalog-sources/session.d.ts +32 -0
- package/dist/src/tui/catalog-sources/session.js +300 -0
- package/dist/src/tui/catalog-sources/session.js.map +1 -0
- package/dist/src/tui/catalog-sources/types.d.ts +54 -0
- package/dist/src/tui/catalog-sources/types.js +2 -0
- package/dist/src/tui/catalog-sources/types.js.map +1 -0
- package/dist/src/tui/catalog-store-task.d.ts +16 -0
- package/dist/src/tui/catalog-store-task.js +19 -0
- package/dist/src/tui/catalog-store-task.js.map +1 -0
- package/dist/src/tui/clipboard.d.ts +13 -0
- package/dist/src/tui/clipboard.js +95 -0
- package/dist/src/tui/clipboard.js.map +1 -0
- package/dist/src/tui/components.d.ts +113 -3
- package/dist/src/tui/components.js +201 -34
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/config-array-draft.d.ts +30 -0
- package/dist/src/tui/config-array-draft.js +51 -0
- package/dist/src/tui/config-array-draft.js.map +1 -0
- package/dist/src/tui/config-leaf-editor.d.ts +44 -0
- package/dist/src/tui/config-leaf-editor.js +227 -0
- package/dist/src/tui/config-leaf-editor.js.map +1 -0
- package/dist/src/tui/config-object-suggestions.d.ts +15 -0
- package/dist/src/tui/config-object-suggestions.js +71 -0
- package/dist/src/tui/config-object-suggestions.js.map +1 -0
- package/dist/src/tui/config-references.d.ts +38 -0
- package/dist/src/tui/config-references.js +82 -0
- package/dist/src/tui/config-references.js.map +1 -0
- package/dist/src/tui/config-suggestions.d.ts +27 -0
- package/dist/src/tui/config-suggestions.js +62 -0
- package/dist/src/tui/config-suggestions.js.map +1 -0
- package/dist/src/tui/config-value-presentation.d.ts +21 -0
- package/dist/src/tui/config-value-presentation.js +129 -0
- package/dist/src/tui/config-value-presentation.js.map +1 -0
- package/dist/src/tui/console-app-v4.d.ts +14 -5
- package/dist/src/tui/console-app-v4.js +10344 -2133
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/content-item-card.d.ts +13 -0
- package/dist/src/tui/content-item-card.js +51 -0
- package/dist/src/tui/content-item-card.js.map +1 -0
- package/dist/src/tui/controller-runtime.d.ts +8 -3
- package/dist/src/tui/controller-runtime.js +2301 -842
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +664 -79
- package/dist/src/tui/controller.js +3670 -830
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/dependency-graph-view.d.ts +39 -0
- package/dist/src/tui/dependency-graph-view.js +121 -0
- package/dist/src/tui/dependency-graph-view.js.map +1 -0
- package/dist/src/tui/dependency-graph.d.ts +81 -0
- package/dist/src/tui/dependency-graph.js +452 -0
- package/dist/src/tui/dependency-graph.js.map +1 -0
- package/dist/src/tui/deployment-view.d.ts +13 -0
- package/dist/src/tui/deployment-view.js +155 -0
- package/dist/src/tui/deployment-view.js.map +1 -0
- package/dist/src/tui/diagnostic-projection.d.ts +31 -0
- package/dist/src/tui/diagnostic-projection.js +681 -0
- package/dist/src/tui/diagnostic-projection.js.map +1 -0
- package/dist/src/tui/diagnostics.d.ts +6 -2
- package/dist/src/tui/diagnostics.js +14 -2
- package/dist/src/tui/diagnostics.js.map +1 -1
- package/dist/src/tui/entity-cards.d.ts +56 -0
- package/dist/src/tui/entity-cards.js +321 -0
- package/dist/src/tui/entity-cards.js.map +1 -0
- package/dist/src/tui/glossary.d.ts +25 -0
- package/dist/src/tui/glossary.js +78 -0
- package/dist/src/tui/glossary.js.map +1 -0
- package/dist/src/tui/guided-setup.d.ts +25 -0
- package/dist/src/tui/guided-setup.js +101 -0
- package/dist/src/tui/guided-setup.js.map +1 -0
- package/dist/src/tui/index.d.ts +5 -1
- package/dist/src/tui/index.js +4 -1
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/input-display.d.ts +1 -0
- package/dist/src/tui/input-display.js +23 -1
- package/dist/src/tui/input-display.js.map +1 -1
- package/dist/src/tui/keys.d.ts +44 -0
- package/dist/src/tui/keys.js +43 -15
- package/dist/src/tui/keys.js.map +1 -1
- package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
- package/dist/src/tui/lifecycle-action-view.js +36 -0
- package/dist/src/tui/lifecycle-action-view.js.map +1 -0
- package/dist/src/tui/model.d.ts +187 -52
- package/dist/src/tui/model.js +1202 -426
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
- package/dist/src/tui/operation-diagnostic-screens.js +76 -0
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
- package/dist/src/tui/operation-history.d.ts +91 -0
- package/dist/src/tui/operation-history.js +167 -0
- package/dist/src/tui/operation-history.js.map +1 -0
- package/dist/src/tui/operation-review-planner.d.ts +28 -0
- package/dist/src/tui/operation-review-planner.js +1456 -0
- package/dist/src/tui/operation-review-planner.js.map +1 -0
- package/dist/src/tui/plugin-content.d.ts +33 -0
- package/dist/src/tui/plugin-content.js +245 -0
- package/dist/src/tui/plugin-content.js.map +1 -0
- package/dist/src/tui/plugin-detail.d.ts +75 -0
- package/dist/src/tui/plugin-detail.js +267 -0
- package/dist/src/tui/plugin-detail.js.map +1 -0
- package/dist/src/tui/plugin-write-task.d.ts +69 -0
- package/dist/src/tui/plugin-write-task.js +286 -0
- package/dist/src/tui/plugin-write-task.js.map +1 -0
- package/dist/src/tui/prompt.js +4 -15
- package/dist/src/tui/prompt.js.map +1 -1
- package/dist/src/tui/query-header.d.ts +30 -0
- package/dist/src/tui/query-header.js +40 -0
- package/dist/src/tui/query-header.js.map +1 -0
- package/dist/src/tui/reader.d.ts +38 -0
- package/dist/src/tui/reader.js +49 -0
- package/dist/src/tui/reader.js.map +1 -0
- package/dist/src/tui/router.d.ts +182 -39
- package/dist/src/tui/router.js +338 -50
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/tui/scoped-flow.d.ts +49 -0
- package/dist/src/tui/scoped-flow.js +212 -0
- package/dist/src/tui/scoped-flow.js.map +1 -0
- package/dist/src/tui/scoped-inventory.d.ts +131 -0
- package/dist/src/tui/scoped-inventory.js +280 -0
- package/dist/src/tui/scoped-inventory.js.map +1 -0
- package/dist/src/tui/screen-registry.d.ts +696 -0
- package/dist/src/tui/screen-registry.js +226 -0
- package/dist/src/tui/screen-registry.js.map +1 -0
- package/dist/src/tui/session-console-app.d.ts +8 -0
- package/dist/src/tui/session-console-app.js +24 -0
- package/dist/src/tui/session-console-app.js.map +1 -0
- package/dist/src/tui/session-host.d.ts +45 -0
- package/dist/src/tui/session-host.js +219 -0
- package/dist/src/tui/session-host.js.map +1 -0
- package/dist/src/tui/source-detail-card.d.ts +29 -0
- package/dist/src/tui/source-detail-card.js +45 -0
- package/dist/src/tui/source-detail-card.js.map +1 -0
- package/dist/src/tui/theme.d.ts +12 -0
- package/dist/src/tui/theme.js +12 -0
- package/dist/src/tui/theme.js.map +1 -1
- package/dist/src/tui/viewport.d.ts +1 -0
- package/dist/src/tui/viewport.js +23 -0
- package/dist/src/tui/viewport.js.map +1 -1
- package/dist/src/tui/wizard.js +37 -13
- package/dist/src/tui/wizard.js.map +1 -1
- package/dist/src/types.d.ts +177 -85
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/agent-version.d.ts +10 -4
- package/dist/src/utils/agent-version.js +6 -8
- package/dist/src/utils/agent-version.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +17 -24
- package/dist/src/utils/artifact-plan.js +59 -436
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +61 -89
- package/dist/src/utils/artifact-renderer.js +187 -364
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +21 -0
- package/dist/src/utils/artifact-request.js +57 -0
- package/dist/src/utils/artifact-request.js.map +1 -0
- package/dist/src/utils/artifact-sources.d.ts +4 -8
- package/dist/src/utils/artifact-sources.js +15 -6
- package/dist/src/utils/artifact-sources.js.map +1 -1
- package/dist/src/utils/aw-home-mutation-lock.js +2 -1
- package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +59 -173
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
- package/dist/src/utils/catalog-capability-projection.js +14 -0
- package/dist/src/utils/catalog-capability-projection.js.map +1 -0
- package/dist/src/utils/catalog-digests.d.ts +2 -9
- package/dist/src/utils/catalog-digests.js +7 -45
- package/dist/src/utils/catalog-digests.js.map +1 -1
- package/dist/src/utils/catalog-generation-error.d.ts +4 -1
- package/dist/src/utils/catalog-generation-error.js +2 -0
- package/dist/src/utils/catalog-generation-error.js.map +1 -1
- package/dist/src/utils/catalog-generation-resolver.d.ts +32 -3
- package/dist/src/utils/catalog-generation-resolver.js +182 -40
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
- package/dist/src/utils/catalog-generation-service.d.ts +142 -2
- package/dist/src/utils/catalog-generation-service.js +1146 -171
- package/dist/src/utils/catalog-generation-service.js.map +1 -1
- package/dist/src/utils/catalog-generation-state.d.ts +5 -0
- package/dist/src/utils/catalog-generation-state.js +25 -1
- package/dist/src/utils/catalog-generation-state.js.map +1 -1
- package/dist/src/utils/catalog-generation-store.d.ts +29 -2
- package/dist/src/utils/catalog-generation-store.js +240 -36
- package/dist/src/utils/catalog-generation-store.js.map +1 -1
- package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
- package/dist/src/utils/{catalog-manifest-v6.js → catalog-manifest-v7.js} +23 -23
- package/dist/src/utils/{catalog-manifest-v6.js.map → catalog-manifest-v7.js.map} +1 -1
- package/dist/src/utils/catalog-operation-context.d.ts +27 -3
- package/dist/src/utils/catalog-operation-context.js +75 -4
- package/dist/src/utils/catalog-operation-context.js.map +1 -1
- package/dist/src/utils/catalog-public-error.js +7 -0
- package/dist/src/utils/catalog-public-error.js.map +1 -1
- package/dist/src/utils/catalog-runtime-projection.d.ts +4 -3
- package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
- package/dist/src/utils/catalog-snapshot.d.ts +5 -2
- package/dist/src/utils/catalog-snapshot.js +4 -1
- package/dist/src/utils/catalog-snapshot.js.map +1 -1
- package/dist/src/utils/catalog-source-impact.d.ts +21 -0
- package/dist/src/utils/catalog-source-impact.js +344 -0
- package/dist/src/utils/catalog-source-impact.js.map +1 -0
- package/dist/src/utils/catalog-source-references.d.ts +22 -8
- package/dist/src/utils/catalog-source-references.js +457 -365
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/catalog-sources.d.ts +14 -1
- package/dist/src/utils/catalog-sources.js +155 -11
- package/dist/src/utils/catalog-sources.js.map +1 -1
- package/dist/src/utils/codex-executable-discovery.d.ts +28 -0
- package/dist/src/utils/codex-executable-discovery.js +431 -0
- package/dist/src/utils/codex-executable-discovery.js.map +1 -0
- package/dist/src/utils/codex-manager.d.ts +23 -42
- package/dist/src/utils/codex-manager.js +79 -767
- package/dist/src/utils/codex-manager.js.map +1 -1
- package/dist/src/utils/codex-marketplace-path.d.ts +5 -0
- package/dist/src/utils/codex-marketplace-path.js +45 -0
- package/dist/src/utils/codex-marketplace-path.js.map +1 -0
- package/dist/src/utils/codex-native-observation.d.ts +55 -0
- package/dist/src/utils/codex-native-observation.js +198 -0
- package/dist/src/utils/codex-native-observation.js.map +1 -0
- package/dist/src/utils/codex-reconciler.d.ts +6 -14
- package/dist/src/utils/codex-reconciler.js +45 -50
- package/dist/src/utils/codex-reconciler.js.map +1 -1
- package/dist/src/utils/codex-shared-native.d.ts +28 -39
- package/dist/src/utils/codex-shared-native.js +92 -57
- package/dist/src/utils/codex-shared-native.js.map +1 -1
- package/dist/src/utils/codex-skill-staging.d.ts +4 -3
- package/dist/src/utils/codex-skill-staging.js.map +1 -1
- package/dist/src/utils/codex-skills-root.d.ts +4 -0
- package/dist/src/utils/codex-skills-root.js +25 -0
- package/dist/src/utils/codex-skills-root.js.map +1 -0
- package/dist/src/utils/codex-surface-analysis.d.ts +8 -3
- package/dist/src/utils/codex-surface-analysis.js +35 -62
- package/dist/src/utils/codex-surface-analysis.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +31 -0
- package/dist/src/utils/component-command-preparation.js +127 -0
- package/dist/src/utils/component-command-preparation.js.map +1 -0
- package/dist/src/utils/component-gap.d.ts +4 -0
- package/dist/src/utils/component-gap.js +20 -0
- package/dist/src/utils/component-gap.js.map +1 -0
- package/dist/src/utils/component-resources.d.ts +51 -0
- package/dist/src/utils/component-resources.js +320 -0
- package/dist/src/utils/component-resources.js.map +1 -0
- package/dist/src/utils/config-platforms.d.ts +21 -0
- package/dist/src/utils/config-platforms.js +51 -0
- package/dist/src/utils/config-platforms.js.map +1 -0
- package/dist/src/utils/dynamic-skill-tree.d.ts +18 -6
- package/dist/src/utils/dynamic-skill-tree.js +33 -40
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/git-catalog-provider.d.ts +16 -0
- package/dist/src/utils/git-catalog-provider.js +112 -6
- package/dist/src/utils/git-catalog-provider.js.map +1 -1
- package/dist/src/utils/inventory-recovery-diagnostic.d.ts +4 -0
- package/dist/src/utils/inventory-recovery-diagnostic.js +15 -0
- package/dist/src/utils/inventory-recovery-diagnostic.js.map +1 -0
- package/dist/src/utils/local-marketplace.d.ts +17 -12
- package/dist/src/utils/local-marketplace.js +85 -195
- package/dist/src/utils/local-marketplace.js.map +1 -1
- package/dist/src/utils/managed-command-cli-review.d.ts +53 -0
- package/dist/src/utils/managed-command-cli-review.js +431 -0
- package/dist/src/utils/managed-command-cli-review.js.map +1 -0
- package/dist/src/utils/managed-command-closure.d.ts +14 -0
- package/dist/src/utils/managed-command-closure.js +156 -0
- package/dist/src/utils/managed-command-closure.js.map +1 -0
- package/dist/src/utils/managed-command-errors.d.ts +5 -0
- package/dist/src/utils/managed-command-errors.js +10 -0
- package/dist/src/utils/managed-command-errors.js.map +1 -0
- package/dist/src/utils/managed-command-materialization.d.ts +90 -0
- package/dist/src/utils/managed-command-materialization.js +375 -0
- package/dist/src/utils/managed-command-materialization.js.map +1 -0
- package/dist/src/utils/managed-command-preparation.d.ts +30 -0
- package/dist/src/utils/managed-command-preparation.js +39 -0
- package/dist/src/utils/managed-command-preparation.js.map +1 -0
- package/dist/src/utils/managed-command-review.d.ts +33 -0
- package/dist/src/utils/managed-command-review.js +80 -0
- package/dist/src/utils/managed-command-review.js.map +1 -0
- package/dist/src/utils/managed-command-runtime.d.ts +36 -0
- package/dist/src/utils/managed-command-runtime.js +126 -0
- package/dist/src/utils/managed-command-runtime.js.map +1 -0
- package/dist/src/utils/managed-command-snapshots.d.ts +24 -0
- package/dist/src/utils/managed-command-snapshots.js +89 -0
- package/dist/src/utils/managed-command-snapshots.js.map +1 -0
- package/dist/src/utils/managed-command-store.d.ts +141 -0
- package/dist/src/utils/managed-command-store.js +839 -0
- package/dist/src/utils/managed-command-store.js.map +1 -0
- package/dist/src/utils/multi-source-catalog.d.ts +4 -0
- package/dist/src/utils/multi-source-catalog.js +7 -3
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli-interruption.d.ts +8 -0
- package/dist/src/utils/native-cli-interruption.js +65 -0
- package/dist/src/utils/native-cli-interruption.js.map +1 -0
- package/dist/src/utils/native-cli.d.ts +37 -6
- package/dist/src/utils/native-cli.js +523 -60
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/native-demand.d.ts +29 -0
- package/dist/src/utils/native-demand.js +4 -0
- package/dist/src/utils/native-demand.js.map +1 -0
- package/dist/src/utils/native-tool-context.d.ts +17 -0
- package/dist/src/utils/native-tool-context.js +40 -0
- package/dist/src/utils/native-tool-context.js.map +1 -0
- package/dist/src/utils/native-tool-review.d.ts +8 -0
- package/dist/src/utils/native-tool-review.js +14 -0
- package/dist/src/utils/native-tool-review.js.map +1 -0
- package/dist/src/utils/orphan-marketplace-cleanup.js +0 -2
- package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +111 -11
- package/dist/src/utils/ownership.js +247 -126
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/package-content.d.ts +7 -0
- package/dist/src/utils/package-content.js +70 -0
- package/dist/src/utils/package-content.js.map +1 -0
- package/dist/src/utils/path-catalog-provider.js +2 -0
- package/dist/src/utils/path-catalog-provider.js.map +1 -1
- package/dist/src/utils/paths.d.ts +1 -1
- package/dist/src/utils/paths.js +5 -2
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +69 -0
- package/dist/src/utils/platform-empty-state.js +226 -0
- package/dist/src/utils/platform-empty-state.js.map +1 -0
- package/dist/src/utils/platform-support.d.ts +1 -1
- package/dist/src/utils/platform-support.js +1 -1
- package/dist/src/utils/platform-support.js.map +1 -1
- package/dist/src/utils/plugin-config-command-apply.d.ts +33 -0
- package/dist/src/utils/plugin-config-command-apply.js +142 -0
- package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
- package/dist/src/utils/plugin-config-diagnostics.d.ts +16 -0
- package/dist/src/utils/plugin-config-diagnostics.js +44 -0
- package/dist/src/utils/plugin-config-diagnostics.js.map +1 -0
- package/dist/src/utils/plugin-config-impact.d.ts +75 -0
- package/dist/src/utils/plugin-config-impact.js +355 -0
- package/dist/src/utils/plugin-config-impact.js.map +1 -0
- package/dist/src/utils/plugin-config-references.d.ts +96 -0
- package/dist/src/utils/plugin-config-references.js +357 -0
- package/dist/src/utils/plugin-config-references.js.map +1 -0
- package/dist/src/utils/plugin-config-suggestion-runner.d.ts +83 -0
- package/dist/src/utils/plugin-config-suggestion-runner.js +308 -0
- package/dist/src/utils/plugin-config-suggestion-runner.js.map +1 -0
- package/dist/src/utils/plugin-config-suggestions.d.ts +50 -0
- package/dist/src/utils/plugin-config-suggestions.js +302 -0
- package/dist/src/utils/plugin-config-suggestions.js.map +1 -0
- package/dist/src/utils/plugin-config-write.d.ts +123 -31
- package/dist/src/utils/plugin-config-write.js +828 -399
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +192 -109
- package/dist/src/utils/plugin-config.js +970 -1150
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-dependencies.d.ts +1 -1
- package/dist/src/utils/plugin-dependencies.js.map +1 -1
- package/dist/src/utils/plugin-scripts.d.ts +80 -127
- package/dist/src/utils/plugin-scripts.js +655 -524
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/process-lock.js +14 -5
- package/dist/src/utils/process-lock.js.map +1 -1
- package/dist/src/utils/process-tree.d.ts +2 -2
- package/dist/src/utils/process-tree.js +1 -1
- package/dist/src/utils/process-tree.js.map +1 -1
- package/dist/src/utils/project-boundary.d.ts +11 -13
- package/dist/src/utils/project-boundary.js +28 -34
- package/dist/src/utils/project-boundary.js.map +1 -1
- package/dist/src/utils/rendered-contract.js +24 -1
- package/dist/src/utils/rendered-contract.js.map +1 -1
- package/dist/src/utils/runtime-config.d.ts +18 -0
- package/dist/src/utils/runtime-config.js +64 -0
- package/dist/src/utils/runtime-config.js.map +1 -0
- package/dist/src/utils/runtime-skill-closure.d.ts +2 -2
- package/dist/src/utils/runtime-skill-closure.js +47 -6
- package/dist/src/utils/runtime-skill-closure.js.map +1 -1
- package/dist/src/utils/safe-fs.d.ts +21 -0
- package/dist/src/utils/safe-fs.js +111 -0
- package/dist/src/utils/safe-fs.js.map +1 -0
- package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
- package/dist/src/utils/safe-operation-diagnostic.js +33 -0
- package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
- package/dist/src/utils/sensitive-content.d.ts +4 -0
- package/dist/src/utils/sensitive-content.js +36 -0
- package/dist/src/utils/sensitive-content.js.map +1 -0
- package/dist/src/utils/skill-invocation-warning.d.ts +20 -0
- package/dist/src/utils/skill-invocation-warning.js +68 -0
- package/dist/src/utils/skill-invocation-warning.js.map +1 -0
- package/dist/src/utils/state-paths.d.ts +8 -3
- package/dist/src/utils/state-paths.js +53 -16
- package/dist/src/utils/state-paths.js.map +1 -1
- package/dist/src/utils/target-eligibility.d.ts +3 -3
- package/dist/src/utils/target-eligibility.js +11 -6
- package/dist/src/utils/target-eligibility.js.map +1 -1
- package/dist/src/utils/windows-claude-shim.d.ts +7 -0
- package/dist/src/utils/windows-claude-shim.js +10 -0
- package/dist/src/utils/windows-claude-shim.js.map +1 -0
- package/dist/src/utils/windows-npm-shim.d.ts +16 -0
- package/dist/src/utils/windows-npm-shim.js +155 -0
- package/dist/src/utils/windows-npm-shim.js.map +1 -0
- package/dist/vitest.config.js +106 -9
- package/dist/vitest.config.js.map +1 -1
- package/package.json +30 -21
- package/dist/src/commands/review-publication.d.ts +0 -99
- package/dist/src/commands/review-publication.js +0 -904
- package/dist/src/commands/review-publication.js.map +0 -1
- package/dist/src/commands/sync-command.d.ts +0 -21
- package/dist/src/commands/sync-command.js +0 -206
- package/dist/src/commands/sync-command.js.map +0 -1
- package/dist/src/portable/skills-cli.d.ts +0 -43
- package/dist/src/portable/skills-cli.js +0 -148
- package/dist/src/portable/skills-cli.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v6.d.ts +0 -5
- package/dist/src/utils/lifecycle-active-store.d.ts +0 -147
- package/dist/src/utils/lifecycle-active-store.js +0 -1064
- package/dist/src/utils/lifecycle-active-store.js.map +0 -1
- package/dist/src/utils/plugin-intent-state.d.ts +0 -39
- package/dist/src/utils/plugin-intent-state.js +0 -325
- package/dist/src/utils/plugin-intent-state.js.map +0 -1
- package/dist/src/utils/slash-commands.d.ts +0 -1
- package/dist/src/utils/slash-commands.js +0 -2
- package/dist/src/utils/slash-commands.js.map +0 -1
|
@@ -0,0 +1,1517 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { isPlatformTarget, normalizeStaticPluginComponents, resolveInvocationPolicy } from '@lesliechan721/aw-plugin-core/manifest';
|
|
3
|
+
import { selectAgents } from '../intent/deployment-preferences.js';
|
|
4
|
+
import { createScopeContext } from '../intent/scope-context.js';
|
|
5
|
+
import { resolveIntentPath } from '../intent/intent-store.js';
|
|
6
|
+
import { parsePluginId } from '../utils/multi-source-catalog.js';
|
|
7
|
+
import { inspectPortableExtraInstalled, inspectPortableRecovery, portablePreparationDiagnostic } from '../portable/recovery.js';
|
|
8
|
+
import { readJointDemand, deriveJointDemand, projectSkillCandidates, isInstalledSkillProvider, hasReadyProviderSkills } from './joint-demand.js';
|
|
9
|
+
import { readDemand, resolveDelivery } from './demand.js';
|
|
10
|
+
import { retainedOutputDiagnostic, scopeNativeComponentGaps, uniqueRecoveryComponentGaps } from './receipt.js';
|
|
11
|
+
import { rethrowFatalError } from '../utils/codex-executable-discovery.js';
|
|
12
|
+
import { createCodexNativeObservationSession } from '../utils/codex-native-observation.js';
|
|
13
|
+
import { getAgentPluginAdapter } from '../platforms/registry.js';
|
|
14
|
+
import { getQualifiedPlatformProfile } from '../platforms/capabilities.js';
|
|
15
|
+
import { isDeliveryCapabilityGap } from '../utils/component-gap.js';
|
|
16
|
+
import { piAgentConsumerDiagnostic, piProjectListsUserSkills } from '../platforms/inspection-pi.js';
|
|
17
|
+
import { gapSupplementFiles } from '../platforms/supplement-layout.js';
|
|
18
|
+
import { inspectPlatformSupplementState } from '../platforms/supplement-state.js';
|
|
19
|
+
import { resolveArtifactRenderConfig } from '../utils/artifact-renderer.js';
|
|
20
|
+
import { resolveActiveConfigPlatforms } from '../utils/config-platforms.js';
|
|
21
|
+
import { configStatusDiagnostics, configReadDiagnostic, isConfigDiagnostic } from '../utils/plugin-config-diagnostics.js';
|
|
22
|
+
import { createPlatformInputEvidence, matchesPlatformEmptyState, readPlatformDeliveryState, platformPackageInputDigest, readPlatformPackageContentDigest } from '../utils/platform-empty-state.js';
|
|
23
|
+
import { deliveryNoticeMessage, INVOCATION_POLICY_NOT_APPLIED } from '../output/component-delivery.js';
|
|
24
|
+
import { piProjectEmptyDeliveryObserved } from '../platforms/lifecycle-native.js';
|
|
25
|
+
import { getDeploymentLayout, hasSharedUserPackage } from '../platforms/layout.js';
|
|
26
|
+
import { identityDigest } from '../platforms/identity.js';
|
|
27
|
+
import { deploymentPackageComponent, inspectStaticSupplements, requiredDeploymentActivation } from '../platforms/inspection.js';
|
|
28
|
+
import { resolveStaticPlatformResourceRoot } from '../utils/component-resources.js';
|
|
29
|
+
import { inspectOwnedComponents, readSkillOwnerMarker } from '../utils/ownership.js';
|
|
30
|
+
import { inventoryCatalogSourceReferences } from '../utils/catalog-source-references.js';
|
|
31
|
+
import { resolvePartialCatalogOperationContext } from '../utils/catalog-operation-context.js';
|
|
32
|
+
import { checkAwCapabilitySupport, readPluginManifest } from '../utils/manifest.js';
|
|
33
|
+
import { IMPLEMENTED_AW_CAPABILITIES } from '../commands/aw-capabilities.js';
|
|
34
|
+
import { resolvePluginDependencyClosure, resolvePluginMetaDependencyClosure } from '../utils/plugin-dependencies.js';
|
|
35
|
+
import { installationInvocation, selectNativeProduct } from '../platforms/discovery.js';
|
|
36
|
+
import { inventoryRecoveryDiagnostic } from '../utils/inventory-recovery-diagnostic.js';
|
|
37
|
+
import { measureRecoveryPerformanceStage } from './performance.js';
|
|
38
|
+
import { withNativeObservationBatch } from '../platforms/inspection-query.js';
|
|
39
|
+
import { readCatalogSourcesConfigSnapshot } from '../utils/catalog-sources.js';
|
|
40
|
+
import { mapInstallReads } from './install-concurrency.js';
|
|
41
|
+
import { selectPlatformInvocationPolicy, hostPermissionClaims } from '../generators/permissions.js';
|
|
42
|
+
import { isPermissionHost } from '../platforms/host-permission-policy.js';
|
|
43
|
+
import { inspectHostPermissionDelivery } from '../platforms/permission-ownership.js';
|
|
44
|
+
import { readManagedCommandPackage } from '../utils/managed-command-store.js';
|
|
45
|
+
const NATIVE_READ_ERRORS = new Set(['nativeStateUnreadable', 'stateInventoryFailed', 'configReadFailed', 'componentInspectionFailed', 'targetInspectionFailed', 'codexNativeObservationFailed',
|
|
46
|
+
'nativeObservationFailed', 'nativeObservationUnavailable']);
|
|
47
|
+
function isNativeReadError({ code, detail }, needsOwnership = true) {
|
|
48
|
+
return NATIVE_READ_ERRORS.has(code) || (code === 'configInvalid' && detail?.reasonCode === 'configReadFailed')
|
|
49
|
+
|| needsOwnership && (code === 'nativeConfigurationUnreadable'
|
|
50
|
+
|| code === 'nativeMarketplaceUnconfirmed' && detail !== undefined);
|
|
51
|
+
}
|
|
52
|
+
export function isTargetObservationReadError(entry) {
|
|
53
|
+
const { code } = entry;
|
|
54
|
+
return isNativeReadError(entry) || code === 'portableObservationFailed' || code === 'portablePreparationFailed'
|
|
55
|
+
|| /(?:VerificationFailed|ReadFailed|LockInvalid)/u.test(code);
|
|
56
|
+
}
|
|
57
|
+
function diagnostic(code) { return { code, message: `目标尚未满足:${code}。` }; }
|
|
58
|
+
function withStatusNativeQueries(options, read) {
|
|
59
|
+
if (options.nativeQuerySession)
|
|
60
|
+
return read(options);
|
|
61
|
+
return withNativeObservationBatch({ runner: options.nativeCliRunner, signal: options.signal }, (batch) => read({ ...options,
|
|
62
|
+
discoveryCache: options.discoveryCache ?? batch.discoveryCache, nativeQuerySession: batch.nativeQuerySession,
|
|
63
|
+
nativeCliRunner: batch.runner }));
|
|
64
|
+
}
|
|
65
|
+
async function readAdapterObservations(options, context, demand, inventory) {
|
|
66
|
+
let selected;
|
|
67
|
+
try {
|
|
68
|
+
selected = selectAgents({ preferences: demand.preferences, targets: options.targets }).agents
|
|
69
|
+
.filter((agent) => agent !== 'generic');
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return { observations: [], existing: [], owned: [] };
|
|
73
|
+
}
|
|
74
|
+
const commandPackages = new Map();
|
|
75
|
+
const platforms = await mapInstallReads(selected, async (platform) => {
|
|
76
|
+
const observations = [];
|
|
77
|
+
const existing = [];
|
|
78
|
+
const owned = [];
|
|
79
|
+
const ctx = { cwd: context.executionCwd, env: context.env, signal: options.signal, runner: options.nativeCliRunner,
|
|
80
|
+
discoveryCache: options.discoveryCache, nativeQuerySession: options.nativeQuerySession,
|
|
81
|
+
codexObservationSession: platform === 'codex' ? options.codexObservationSession : undefined,
|
|
82
|
+
observeNative: options.observeNative };
|
|
83
|
+
options.signal?.throwIfAborted();
|
|
84
|
+
const roots = (demand.roots ?? []).filter((root) => root.plugin
|
|
85
|
+
&& resolveDelivery(root.plugin.manifest, platform, demand.scope)?.kind === 'native'
|
|
86
|
+
&& (!demand.targetRequirements || demand.targetRequirements.some((item) => item.pluginId === root.pluginId && item.target === platform)));
|
|
87
|
+
if (!roots.length)
|
|
88
|
+
return { observations, existing, owned };
|
|
89
|
+
// Configuration is independent of the host's availability. Preserve these blockers if discovery fails.
|
|
90
|
+
const configuredRoots = await mapInstallReads(roots, async (root) => {
|
|
91
|
+
options.signal?.throwIfAborted();
|
|
92
|
+
const observation = { pluginId: root.pluginId, expectedVersion: root.plugin?.manifest.version, platform, content: 'unknown', blockers: [], reasons: [], deploymentObservations: [] };
|
|
93
|
+
observations.push(observation);
|
|
94
|
+
const plugin = root.plugin;
|
|
95
|
+
const active = demand.preferences.state === 'valid'
|
|
96
|
+
&& resolveActiveConfigPlatforms(root.pluginId, plugin.manifest, demand.preferences).includes(platform);
|
|
97
|
+
const configSubject = { pluginId: root.pluginId, target: platform, scope: demand.scope };
|
|
98
|
+
const configForScope = async (scope, cwd) => {
|
|
99
|
+
try {
|
|
100
|
+
const config = await resolveArtifactRenderConfig({ pluginName: plugin.manifest.name, sourceId: plugin.sourceId ?? root.sourceId,
|
|
101
|
+
sourceIdentity: plugin.sourceIdentity, logicalIdentity: plugin.catalogLogicalIdentity,
|
|
102
|
+
manifest: plugin.manifest, platform, scope, cwd, env: context.env, referencePlugins: demand.plugins });
|
|
103
|
+
const blockers = configStatusDiagnostics(config.issues);
|
|
104
|
+
if (active)
|
|
105
|
+
observation.blockers.push(...blockers.map((blocker) => ({ ...blocker, subject: configSubject })));
|
|
106
|
+
return blockers.length ? undefined : config;
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
options.signal?.throwIfAborted();
|
|
110
|
+
const blocker = configReadDiagnostic(error);
|
|
111
|
+
if (active)
|
|
112
|
+
observation.blockers.push({ ...blocker, subject: configSubject });
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
// Missing clients/bindings cannot hide a known configuration problem. Keep inspecting live ownership.
|
|
117
|
+
const scopedConfig = await configForScope(demand.scope, context.executionCwd);
|
|
118
|
+
return { root, observation, configForScope, scopedConfig };
|
|
119
|
+
}, { signal: options.signal, limit: 1 });
|
|
120
|
+
const adapter = getAgentPluginAdapter(platform);
|
|
121
|
+
let ownedSession;
|
|
122
|
+
try {
|
|
123
|
+
const discovery = await measureRecoveryPerformanceStage(options, 'status.discovery', () => adapter.discover(ctx));
|
|
124
|
+
if (platform === 'codex') {
|
|
125
|
+
const product = selectNativeProduct(discovery.installations);
|
|
126
|
+
if (product) {
|
|
127
|
+
const invocation = await installationInvocation(product, ctx, []);
|
|
128
|
+
const manager = { kind: product.product === 'app' ? 'app' : 'system', version: product.version ?? 'unknown',
|
|
129
|
+
command: invocation.command, argsPrefix: invocation.args };
|
|
130
|
+
if (ctx.codexObservationSession)
|
|
131
|
+
ctx.codexObservationSession.setManager(manager);
|
|
132
|
+
else {
|
|
133
|
+
ownedSession = await createCodexNativeObservationSession({ exactCwd: context.executionCwd, env: context.env, manager,
|
|
134
|
+
runner: options.nativeCliRunner, probe: { platform: ctx.platform, signal: options.signal } });
|
|
135
|
+
ctx.codexObservationSession = ownedSession;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
for (const { root, observation, configForScope, scopedConfig } of configuredRoots) {
|
|
140
|
+
options.signal?.throwIfAborted();
|
|
141
|
+
let nativePackage;
|
|
142
|
+
try {
|
|
143
|
+
const plugin = root.plugin;
|
|
144
|
+
const resolution = await adapter.resolve(ctx, { plugin: {
|
|
145
|
+
sourceId: plugin.sourceId ?? root.sourceId, sourceIdentity: plugin.sourceIdentity,
|
|
146
|
+
pluginId: root.pluginId, version: plugin.manifest.version,
|
|
147
|
+
}, scope: demand.scope === 'project' ? { kind: 'project', projectRoot: context.projectRoot } : { kind: 'user' },
|
|
148
|
+
operation: 'ensure', discovery, recoveryCandidates: [] });
|
|
149
|
+
observation.deploymentExclusions = resolution.exclusions.flatMap((entry) => entry.productId ? [{
|
|
150
|
+
platform, pluginId: root.pluginId,
|
|
151
|
+
scope: demand.scope === 'project' ? { kind: 'project', projectRoot: context.projectRoot } : { kind: 'user' },
|
|
152
|
+
productId: entry.productId, product: discovery.installations.find((product) => product.id === entry.productId) ?? null,
|
|
153
|
+
reasonCode: entry.reasonCode, execution: 'not-run',
|
|
154
|
+
recoveryActions: ['aw target list', `aw plugin sync ${root.pluginId} --context ${demand.scope} --target ${platform}`],
|
|
155
|
+
}] : []);
|
|
156
|
+
observation.blockers.push(...resolution.diagnostics.map((entry) => ({ ...entry })));
|
|
157
|
+
if (!resolution.bindings.length) {
|
|
158
|
+
observation.blockers.push(...resolution.exclusions.map((entry) => diagnostic(entry.reasonCode)));
|
|
159
|
+
observation.blockers.push(...discovery.diagnostics.map((entry) => ({ code: entry.code, message: entry.message })));
|
|
160
|
+
if (!observation.blockers.some((blocker) => !isConfigDiagnostic(blocker)))
|
|
161
|
+
observation.blockers.push(diagnostic(discovery.availability === 'missing' ? 'client-missing' : 'nativeObservationUnavailable'));
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const states = [];
|
|
165
|
+
const emptyMatches = [];
|
|
166
|
+
const currentMatches = [];
|
|
167
|
+
const versions = [];
|
|
168
|
+
const deliveredIds = new Set();
|
|
169
|
+
const staticResourceRoot = await resolveStaticPlatformResourceRoot(plugin.rootDir, platform);
|
|
170
|
+
let commandRoutes;
|
|
171
|
+
if (plugin.sourceIdentity && plugin.manifest.command?.platforms.includes(platform)) {
|
|
172
|
+
let commandPackage = commandPackages.get(root.pluginId);
|
|
173
|
+
if (!commandPackage) {
|
|
174
|
+
commandPackage = readManagedCommandPackage({ sourceId: root.sourceId,
|
|
175
|
+
sourceIdentity: plugin.sourceIdentity, pluginName: plugin.manifest.name }, context.env).catch(() => undefined);
|
|
176
|
+
commandPackages.set(root.pluginId, commandPackage);
|
|
177
|
+
}
|
|
178
|
+
commandRoutes = (await commandPackage)?.record.routes;
|
|
179
|
+
}
|
|
180
|
+
for (const binding of resolution.bindings) {
|
|
181
|
+
const subject = { pluginId: root.pluginId, target: platform, scope: binding.scope.kind };
|
|
182
|
+
const warn = (code) => observation.reasons.push({ ...diagnostic(code), subject });
|
|
183
|
+
const block = (code) => observation.blockers.push({ ...diagnostic(code), subject });
|
|
184
|
+
const live = await measureRecoveryPerformanceStage(options, 'status.adapter.inspect', () => adapter.inspect(ctx, binding));
|
|
185
|
+
versions.push(live.packageVersion);
|
|
186
|
+
options.signal?.throwIfAborted();
|
|
187
|
+
observation.deploymentObservations.push({ bindingId: binding.id, products: binding.consumers, after: live });
|
|
188
|
+
if (isPermissionHost(platform)) {
|
|
189
|
+
const { policy } = selectPlatformInvocationPolicy(resolveInvocationPolicy(plugin.manifest, platform, root.pluginId), subject, commandRoutes ?? null);
|
|
190
|
+
const claims = hostPermissionClaims(policy.permissions, policy.invocationSelector);
|
|
191
|
+
const previous = inventory.some(({ ownedComponent }) => ownedComponent?.kind === 'shared-config'
|
|
192
|
+
&& ownedComponent.locator.kind === 'host-permissions' && ownedComponent.identity.pluginId === root.pluginId
|
|
193
|
+
&& ownedComponent.identity.sourceIdentity === binding.plugin.sourceIdentity && ownedComponent.identity.platform === platform
|
|
194
|
+
&& ownedComponent.identity.scope === binding.scope.kind);
|
|
195
|
+
if (claims.length || previous) {
|
|
196
|
+
const permissions = await inspectHostPermissionDelivery(ctx, binding, claims, live.grokScopeAuthorization);
|
|
197
|
+
if (permissions) {
|
|
198
|
+
states.push(permissions.content);
|
|
199
|
+
observation.reasons.push(permissions.diagnostic);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const shared = ['codex-marketplace', 'claude-marketplace', 'copilot-marketplace'].includes(binding.route);
|
|
204
|
+
const scopedNativeConsumer = shared ? live.registration === 'present'
|
|
205
|
+
&& live.consumers.some((consumer) => consumer.activation === 'enabled')
|
|
206
|
+
: live.package === 'present' && live.ownership === 'aw';
|
|
207
|
+
if (scopedNativeConsumer && (live.ownership === 'aw' || live.ownership === 'shared')) {
|
|
208
|
+
owned.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
|
|
209
|
+
if (!shared)
|
|
210
|
+
nativePackage ??= { sourceIdentity: binding.plugin.sourceIdentity, skillsReady: false };
|
|
211
|
+
existing.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope,
|
|
212
|
+
...(nativePackage ? { nativePackage } : {}) });
|
|
213
|
+
}
|
|
214
|
+
if (!scopedConfig) {
|
|
215
|
+
states.push('unknown');
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
const unmet = [];
|
|
219
|
+
const staticPackageIds = new Set();
|
|
220
|
+
const staticSupplements = [];
|
|
221
|
+
const dynamicUnits = new Set();
|
|
222
|
+
const inputUnits = [];
|
|
223
|
+
const profile = getQualifiedPlatformProfile(platform);
|
|
224
|
+
const renderUnits = resolution.renderUnits.filter((unit) => binding.renderUnitIds.includes(unit.id));
|
|
225
|
+
for (const unit of renderUnits) {
|
|
226
|
+
const artifacts = plugin.manifest.artifacts;
|
|
227
|
+
if (artifacts && unit.kinds.length && (!artifacts.scopes || artifacts.scopes.includes(unit.renderScope.kind))) {
|
|
228
|
+
dynamicUnits.add(unit.output);
|
|
229
|
+
}
|
|
230
|
+
const capabilities = adapter.capabilities({ binding, renderUnit: unit, observation: live,
|
|
231
|
+
profile });
|
|
232
|
+
const config = unit.renderScope.kind === demand.scope ? scopedConfig
|
|
233
|
+
: await configForScope(unit.renderScope.kind, unit.renderScope.kind === 'project' ? unit.renderScope.projectRoot : context.executionCwd);
|
|
234
|
+
if (config)
|
|
235
|
+
inputUnits.push({ renderUnit: unit, capabilities, config });
|
|
236
|
+
}
|
|
237
|
+
// Do not feed invalid config to input-evidence creation or report a native read failure for it.
|
|
238
|
+
if (inputUnits.length !== renderUnits.length) {
|
|
239
|
+
states.push('unknown');
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
const inputEvidence = await createPlatformInputEvidence({ plugin, binding, units: inputUnits, commandRoutes }).catch((error) => {
|
|
243
|
+
rethrowFatalError(error);
|
|
244
|
+
options.signal?.throwIfAborted();
|
|
245
|
+
const systemCode = error?.code;
|
|
246
|
+
if (systemCode !== 'ENOENT' && systemCode !== 'ENOTDIR')
|
|
247
|
+
throw error;
|
|
248
|
+
observation.blockers.push({ code: 'componentResourceMissing', message: 'A required plugin source file or directory is missing.',
|
|
249
|
+
subject, detail: { reasonCode: systemCode } });
|
|
250
|
+
return undefined;
|
|
251
|
+
});
|
|
252
|
+
if (!inputEvidence) {
|
|
253
|
+
states.push('unknown');
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const readPackageProjection = async () => {
|
|
257
|
+
const layout = await getDeploymentLayout(ctx, binding);
|
|
258
|
+
const marker = await readSkillOwnerMarker({ skillRoot: layout.packageRoot, allowedRoot: path.dirname(layout.packageRoot),
|
|
259
|
+
expectedIdentity: deploymentPackageComponent(binding, layout).identity });
|
|
260
|
+
return { layout, projection: marker?.nativeProjection };
|
|
261
|
+
};
|
|
262
|
+
const packageUnit = renderUnits.find((unit) => unit.output === 'package');
|
|
263
|
+
const rolePackage = (platform === 'copilot' || platform === 'grok') && packageUnit?.kinds.includes('agent')
|
|
264
|
+
&& dynamicUnits.has('package') && plugin.manifest.extensions?.instructions?.length
|
|
265
|
+
&& live.package === 'present' && live.ownership === 'aw' ? await readPackageProjection() : undefined;
|
|
266
|
+
// The current package projection identifies renderer-produced roles. File presence and bytes are checked below.
|
|
267
|
+
const roleProjection = rolePackage?.projection;
|
|
268
|
+
const projectedRole = rolePackage && roleProjection?.preparation === 'complete'
|
|
269
|
+
&& roleProjection.inputDigest === platformPackageInputDigest(inputEvidence)
|
|
270
|
+
&& identityDigest(roleProjection.physicalIdentity) === identityDigest(rolePackage.layout.physicalIdentity)
|
|
271
|
+
&& roleProjection.components.some(({ nativeName, relativeOutputs }) => relativeOutputs.includes(platform === 'copilot'
|
|
272
|
+
? `com.github.copilot/agents/${nativeName}.agent.md` : `agents/${nativeName}.md`));
|
|
273
|
+
let expectedCount = 0;
|
|
274
|
+
let grokAgentRecipientScope;
|
|
275
|
+
for (const { renderUnit: unit, capabilities } of inputUnits) {
|
|
276
|
+
const expected = await normalizeStaticPluginComponents({ pluginRoot: plugin.rootDir, staticResourceRoot,
|
|
277
|
+
manifest: plugin.manifest, platform, capabilities, allowedOutputKinds: unit.kinds,
|
|
278
|
+
hasInstructionAgentRecipients: platform === 'grok' && unit.output === 'supplement'
|
|
279
|
+
? grokAgentRecipientScope === identityDigest(unit.renderScope) : projectedRole || undefined });
|
|
280
|
+
if (platform === 'grok' && unit.output === 'package'
|
|
281
|
+
&& (projectedRole || expected.components.some(({ kind }) => kind === 'agent'))) {
|
|
282
|
+
grokAgentRecipientScope = identityDigest(unit.renderScope);
|
|
283
|
+
}
|
|
284
|
+
expectedCount += expected.components.length;
|
|
285
|
+
for (const component of expected.components) {
|
|
286
|
+
const grokRoleText = platform === 'grok' && component.kind === 'instruction' && !component.content.coverage.includes('main');
|
|
287
|
+
if (unit.output === 'supplement' && !grokRoleText)
|
|
288
|
+
staticSupplements.push(component);
|
|
289
|
+
else
|
|
290
|
+
staticPackageIds.add(component.id);
|
|
291
|
+
}
|
|
292
|
+
unmet.push(...expected.unmet);
|
|
293
|
+
}
|
|
294
|
+
const recordedDelivery = await readPlatformDeliveryState({ input: inputEvidence, env: context.env });
|
|
295
|
+
const recordedGaps = recordedDelivery?.result === 'capability-gaps' && recordedDelivery.gaps.length ? recordedDelivery : undefined;
|
|
296
|
+
for (const { field, ...detail } of recordedDelivery?.permissionNotices ?? []) {
|
|
297
|
+
observation.reasons.push({ code: INVOCATION_POLICY_NOT_APPLIED, subject: { ...subject, field }, detail,
|
|
298
|
+
message: deliveryNoticeMessage(INVOCATION_POLICY_NOT_APPLIED, detail, field) });
|
|
299
|
+
}
|
|
300
|
+
const currentIds = recordedGaps ? new Set(recordedGaps.installedComponentIds) : undefined;
|
|
301
|
+
if (currentIds && recordedGaps) {
|
|
302
|
+
// A renderer receipt can add dynamic expectations. A positive static
|
|
303
|
+
// expectation remains unless that specific component was skipped.
|
|
304
|
+
const skipped = new Set(recordedGaps.gaps.filter((gap) => !gap.componentId).map((gap) => gap.id));
|
|
305
|
+
for (const id of [...staticPackageIds, ...staticSupplements.map((component) => component.id)]) {
|
|
306
|
+
if (!skipped.has(id))
|
|
307
|
+
currentIds.add(id);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
let packageExpectedCount = staticPackageIds.size;
|
|
311
|
+
const expectedSupplements = currentIds ? staticSupplements.filter(({ id }) => currentIds.has(id)) : staticSupplements;
|
|
312
|
+
const supplements = await inspectStaticSupplements(ctx, binding, expectedSupplements);
|
|
313
|
+
const gaps = recordedGaps?.gaps ?? unmet;
|
|
314
|
+
const blockingGaps = gaps.filter((gap) => !isDeliveryCapabilityGap(gap));
|
|
315
|
+
if (gaps.length) {
|
|
316
|
+
(observation.componentGaps ??= []).push(...scopeNativeComponentGaps(gaps, { pluginId: root.pluginId, agent: platform, scope: binding.scope.kind }, renderUnits));
|
|
317
|
+
}
|
|
318
|
+
const supplementInput = inputEvidence.units.find((unit) => unit.output === 'supplement');
|
|
319
|
+
const emptyPackageIds = recordedDelivery?.result === 'intentional-empty-package' ? recordedDelivery.installedComponentIds : undefined;
|
|
320
|
+
const recordedSupplements = dynamicUnits.has('supplement') && supplementInput
|
|
321
|
+
? await inspectPlatformSupplementState(ctx, binding, supplementInput.inputDigest, emptyPackageIds) : null;
|
|
322
|
+
if (recordedSupplements) {
|
|
323
|
+
const staticIds = new Set(supplements.components.map((component) => component.id));
|
|
324
|
+
const dynamicComponents = recordedSupplements.components.filter((component) => !staticIds.has(component.id));
|
|
325
|
+
supplements.components.push(...dynamicComponents);
|
|
326
|
+
expectedCount += dynamicComponents.length;
|
|
327
|
+
}
|
|
328
|
+
const supplementIds = new Set(supplements.components.map(({ id }) => id));
|
|
329
|
+
if (currentIds) {
|
|
330
|
+
expectedCount = currentIds.size;
|
|
331
|
+
packageExpectedCount = [...currentIds].filter((id) => !supplementIds.has(id)).length;
|
|
332
|
+
}
|
|
333
|
+
const supplementSetUnconfirmed = emptyPackageIds
|
|
334
|
+
&& (emptyPackageIds.length !== supplementIds.size || emptyPackageIds.some((id) => !supplementIds.has(id)));
|
|
335
|
+
const supplementConflict = supplements.components.some((component) => component.reasonCodes.includes('supplementOwnershipConflict'));
|
|
336
|
+
const supplementMissing = supplements.components.some((component) => component.presence === 'absent');
|
|
337
|
+
const supplementDrift = supplements.components.some((component) => component.reasonCodes.includes('componentContentDrift'));
|
|
338
|
+
const supplementUnknown = supplements.components.some((component) => component.presence === 'unknown');
|
|
339
|
+
const supplementInputDrift = Boolean(recordedSupplements && !recordedSupplements.inputMatches
|
|
340
|
+
&& recordedSupplements.components.every((component) => component.presence === 'present'));
|
|
341
|
+
if (supplementConflict)
|
|
342
|
+
block('supplementOwnershipConflict');
|
|
343
|
+
if (supplementDrift)
|
|
344
|
+
warn('platformContentDrift');
|
|
345
|
+
if (supplementInputDrift)
|
|
346
|
+
warn('platformInputDrift');
|
|
347
|
+
if (supplementMissing)
|
|
348
|
+
warn('componentOutputMissing');
|
|
349
|
+
if (supplementUnknown && !supplementConflict)
|
|
350
|
+
warn('componentOutputUnconfirmed');
|
|
351
|
+
if (supplements.owned && !existing.some((target) => target.pluginId === root.pluginId && target.agent === platform && target.scope === demand.scope)) {
|
|
352
|
+
owned.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
|
|
353
|
+
existing.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
|
|
354
|
+
}
|
|
355
|
+
const onlyCapabilityGaps = expectedCount === 0 && gaps.length > 0 && !blockingGaps.length;
|
|
356
|
+
const capabilityEmpty = onlyCapabilityGaps && recordedGaps !== undefined;
|
|
357
|
+
const confirmedEmpty = capabilityEmpty || Boolean(plugin.manifest.artifacts && expectedCount === 0 && gaps.length === 0
|
|
358
|
+
&& recordedDelivery?.result === 'intentional-empty');
|
|
359
|
+
const confirmedEmptyPackage = packageExpectedCount === 0 && (Boolean(currentIds?.size)
|
|
360
|
+
|| dynamicUnits.has('package') && (recordedDelivery?.result === 'intentional-empty-package'
|
|
361
|
+
|| binding.route === 'codex-marketplace' && recordedSupplements !== null
|
|
362
|
+
&& await matchesPlatformEmptyState({ state: { ...inputEvidence, kind: 'aw-platform-empty-state', result: 'intentional-empty',
|
|
363
|
+
units: inputEvidence.units.filter((unit) => unit.output === 'package') }, env: context.env })));
|
|
364
|
+
const dynamicSupplementsUnconfirmed = dynamicUnits.has('supplement') && !confirmedEmpty
|
|
365
|
+
&& !recordedSupplements?.inputMatches && !supplementInputDrift;
|
|
366
|
+
if (dynamicSupplementsUnconfirmed || supplementSetUnconfirmed)
|
|
367
|
+
warn('dynamicExpectationUnconfirmed');
|
|
368
|
+
const hasPackageExpectation = packageExpectedCount > 0 || !currentIds && dynamicUnits.has('package') && !confirmedEmpty && !confirmedEmptyPackage;
|
|
369
|
+
const inheritsUserNative = demand.targetRequirements?.find((item) => item.pluginId === root.pluginId
|
|
370
|
+
&& item.target === platform)?.inheritsUserNative;
|
|
371
|
+
const requiredActivation = requiredDeploymentActivation(binding, live, !inheritsUserNative);
|
|
372
|
+
for (const entry of live.diagnostics) {
|
|
373
|
+
if (entry.code === 'codexProjectActivationUnconfirmed' && inheritsUserNative && requiredActivation === 'enabled')
|
|
374
|
+
continue;
|
|
375
|
+
const needsOwnership = live.ownership === 'unknown' && live.package !== 'absent' && live.registration !== 'absent';
|
|
376
|
+
const destination = entry.severity === 'error' || (hasPackageExpectation || confirmedEmpty || confirmedEmptyPackage) && isNativeReadError(entry, needsOwnership)
|
|
377
|
+
? observation.blockers : observation.reasons;
|
|
378
|
+
destination.push({ code: entry.code, message: entry.message, subject: { ...subject, ...entry.subject }, detail: entry.detail });
|
|
379
|
+
}
|
|
380
|
+
const legacyAntigravityPackage = live.antigravityLegacyProjectPackage;
|
|
381
|
+
if (legacyAntigravityPackage?.state === 'owned')
|
|
382
|
+
observation.reasons.push({
|
|
383
|
+
code: 'antigravityProjectPackageMigrationPending',
|
|
384
|
+
message: 'Sync this plugin to finish moving it to the short Antigravity project path.',
|
|
385
|
+
subject,
|
|
386
|
+
detail: { reasonCode: 'antigravityProjectPackageMigrationPending', path: legacyAntigravityPackage.path },
|
|
387
|
+
});
|
|
388
|
+
const requiresScopeRegistration = binding.route === 'claude-marketplace' && !inheritsUserNative;
|
|
389
|
+
const registration = requiresScopeRegistration ? live.scopeRegistration ?? 'unknown' : live.registration;
|
|
390
|
+
const ownershipConflict = live.ownership === 'foreign' || live.ownership === 'shared'
|
|
391
|
+
|| legacyAntigravityPackage?.state === 'unconfirmed';
|
|
392
|
+
if (ownershipConflict)
|
|
393
|
+
block('deploymentOwnershipConflict');
|
|
394
|
+
const missing = hasPackageExpectation && (live.package === 'absent' && packageExpectedCount > 0
|
|
395
|
+
|| registration === 'absent' && (packageExpectedCount > 0 || live.package === 'present')
|
|
396
|
+
|| live.nativePackage === 'absent');
|
|
397
|
+
if (missing) {
|
|
398
|
+
if (live.package === 'absent')
|
|
399
|
+
warn('platformPackageMissing');
|
|
400
|
+
if (registration === 'absent')
|
|
401
|
+
warn('nativeRegistrationMissing');
|
|
402
|
+
if (live.nativePackage === 'absent')
|
|
403
|
+
warn('nativePackageMissing');
|
|
404
|
+
}
|
|
405
|
+
let inputDrift = false;
|
|
406
|
+
let packageExpectationConfirmed = false;
|
|
407
|
+
let projectionUnconfirmed = false;
|
|
408
|
+
let componentMissing = false;
|
|
409
|
+
let componentUnknown = false;
|
|
410
|
+
let nativeContentDrift = false;
|
|
411
|
+
let nativeContentUnconfirmed = false;
|
|
412
|
+
if (hasPackageExpectation && live.package === 'present' && live.ownership === 'aw' && !missing) {
|
|
413
|
+
const { layout, projection } = rolePackage ?? await readPackageProjection();
|
|
414
|
+
const contentDigest = projection ? await readPlatformPackageContentDigest(layout.packageRoot) : undefined;
|
|
415
|
+
if (['grok-cli', 'antigravity-cli'].includes(binding.route) && live.registration === 'present') {
|
|
416
|
+
nativeContentUnconfirmed = !contentDigest || !live.nativePackageContentDigest;
|
|
417
|
+
nativeContentDrift = Boolean(contentDigest && live.nativePackageContentDigest
|
|
418
|
+
&& contentDigest !== live.nativePackageContentDigest);
|
|
419
|
+
if (nativeContentUnconfirmed)
|
|
420
|
+
warn('nativePackageContentUnconfirmed');
|
|
421
|
+
if (nativeContentDrift)
|
|
422
|
+
warn('nativePackageContentDrift');
|
|
423
|
+
}
|
|
424
|
+
projectionUnconfirmed = !projection || projection.preparation !== 'complete' || !contentDigest;
|
|
425
|
+
const packageInputDigest = platformPackageInputDigest(inputEvidence, projection?.components);
|
|
426
|
+
inputDrift = Boolean(projection && (projection.inputDigest !== packageInputDigest
|
|
427
|
+
|| contentDigest && projection.contentDigest !== contentDigest));
|
|
428
|
+
if (projectionUnconfirmed)
|
|
429
|
+
warn(projection?.preparation === 'partial'
|
|
430
|
+
? 'platformPreparationPartial' : 'platformExpectationUnconfirmed');
|
|
431
|
+
else if (inputDrift) {
|
|
432
|
+
if (projection.inputDigest !== packageInputDigest)
|
|
433
|
+
warn('platformInputDrift');
|
|
434
|
+
if (projection.contentDigest !== contentDigest)
|
|
435
|
+
warn('platformContentDrift');
|
|
436
|
+
}
|
|
437
|
+
componentMissing = live.components.some((component) => component.presence === 'absent');
|
|
438
|
+
componentUnknown = live.components.some((component) => component.presence === 'unknown'
|
|
439
|
+
&& !component.reasonCodes.includes('nativePackageContentDrift'));
|
|
440
|
+
if (componentMissing)
|
|
441
|
+
warn('componentOutputMissing');
|
|
442
|
+
if (componentUnknown && !nativeContentUnconfirmed)
|
|
443
|
+
warn('componentOutputUnconfirmed');
|
|
444
|
+
packageExpectationConfirmed = Boolean(!projectionUnconfirmed && projection.inputDigest === packageInputDigest
|
|
445
|
+
&& projection.components.length > 0);
|
|
446
|
+
if (packageExpectationConfirmed) {
|
|
447
|
+
expectedCount = Math.max(expectedCount, projection.components.length);
|
|
448
|
+
if (platform === 'pi' && !inputDrift) {
|
|
449
|
+
const roles = projection.components.filter((component) => component.relativeOutputs.some((output) => /^agents\/[^/]+\.md$/u.test(output))
|
|
450
|
+
&& live.components.some((entry) => entry.id === component.id && entry.presence === 'present' && !entry.reasonCodes.length));
|
|
451
|
+
const warning = piAgentConsumerDiagnostic(binding, live, roles.map(({ id }) => id));
|
|
452
|
+
if (warning)
|
|
453
|
+
observation.reasons.push(warning);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
const confirmedPackage = packageExpectationConfirmed && !inputDrift && !nativeContentDrift && !nativeContentUnconfirmed;
|
|
458
|
+
const confirmedComponents = [...(confirmedPackage ? live.components : []), ...supplements.components];
|
|
459
|
+
for (const component of confirmedComponents) {
|
|
460
|
+
if (component.presence === 'present' && !component.reasonCodes.length && (!currentIds || currentIds.has(component.id))) {
|
|
461
|
+
deliveredIds.add(component.id);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
live.components.push(...supplements.components);
|
|
465
|
+
currentMatches.push(Boolean(currentIds) || !dynamicUnits.size || confirmedEmpty || packageExpectationConfirmed || missing
|
|
466
|
+
|| !dynamicSupplementsUnconfirmed && confirmedEmptyPackage || recordedSupplements !== null && !hasPackageExpectation);
|
|
467
|
+
emptyMatches.push(confirmedEmpty && !capabilityEmpty);
|
|
468
|
+
for (const entry of blockingGaps)
|
|
469
|
+
block(entry.reasonCode);
|
|
470
|
+
if (legacyAntigravityPackage?.state === 'owned' && !ownershipConflict
|
|
471
|
+
&& live.ownership !== 'unknown' && !blockingGaps.length) {
|
|
472
|
+
states.push('drifted');
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
const inactiveScope = live.registration === 'absent'
|
|
476
|
+
|| live.package === 'absent' && live.registration === 'not-applicable'
|
|
477
|
+
|| live.scopeRegistration === 'absent'
|
|
478
|
+
|| binding.scope.kind === 'project' && shared && live.configuration?.activation === 'absent'
|
|
479
|
+
|| live.consumers.every((consumer) => ['disabled', 'not-applicable'].includes(consumer.activation));
|
|
480
|
+
const skippedFiles = gaps.filter((gap) => supplementInput?.kinds.includes(gap.kind) && gap.name
|
|
481
|
+
&& !currentIds?.has(gap.componentId ?? gap.id)
|
|
482
|
+
&& !expectedSupplements.some((component) => component.kind === gap.kind && component.name === gap.name));
|
|
483
|
+
if (skippedFiles.length) {
|
|
484
|
+
const slots = gapSupplementFiles(binding, await getDeploymentLayout(ctx, binding), skippedFiles);
|
|
485
|
+
const checked = await inspectOwnedComponents({ components: slots });
|
|
486
|
+
const retained = checked.components.filter((item) => item.state !== 'absent');
|
|
487
|
+
if (retained.length) {
|
|
488
|
+
for (const item of retained)
|
|
489
|
+
if ('path' in item.component) {
|
|
490
|
+
observation.blockers.push(retainedOutputDiagnostic(root.pluginId, platform, binding.scope.kind, item.component.path));
|
|
491
|
+
}
|
|
492
|
+
states.push(retained.some((item) => item.state === 'foreign') ? 'conflict'
|
|
493
|
+
: retained.some((item) => item.state === 'error') ? 'unknown' : 'drifted');
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
if (onlyCapabilityGaps) {
|
|
498
|
+
const supplementKey = supplementInput?.physicalKey;
|
|
499
|
+
const retained = supplementKey ? inventory.flatMap(({ ownedComponent }) => ownedComponent?.kind === 'owned-text-file' && ownedComponent.identity.physicalKey === supplementKey
|
|
500
|
+
&& ownedComponent.identity.sourceIdentity === binding.plugin.sourceIdentity && ownedComponent.identity.pluginId === root.pluginId
|
|
501
|
+
? [ownedComponent.path] : []) : [];
|
|
502
|
+
const piRegistrationRemaining = binding.route === 'pi-package'
|
|
503
|
+
&& (live.registration === 'present' || live.configuration?.activation === 'enabled');
|
|
504
|
+
if ((live.package === 'present' && (!shared || !inactiveScope) || piRegistrationRemaining) && live.nativeIdentity) {
|
|
505
|
+
retained.push(live.nativeIdentity.sourceLocation);
|
|
506
|
+
}
|
|
507
|
+
if (binding.route === 'cursor-workspace-hook' && live.workspaceOpen === 'present') {
|
|
508
|
+
retained.push((await getDeploymentLayout(ctx, binding)).activationPath);
|
|
509
|
+
}
|
|
510
|
+
if (retained.length) {
|
|
511
|
+
observation.blockers.push(...retained.map((file) => retainedOutputDiagnostic(root.pluginId, platform, binding.scope.kind, file)));
|
|
512
|
+
states.push(ownershipConflict ? 'conflict' : 'drifted');
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (confirmedEmpty) {
|
|
517
|
+
const hiddenEmptyPi = capabilityEmpty && piProjectEmptyDeliveryObserved(binding, live);
|
|
518
|
+
const cursorHookUnconfirmed = capabilityEmpty && binding.route === 'cursor-workspace-hook' && live.workspaceOpen !== 'absent';
|
|
519
|
+
const piConfigUnconfirmed = capabilityEmpty && binding.route === 'pi-package' && live.configuration?.activation !== 'absent';
|
|
520
|
+
states.push(ownershipConflict ? 'conflict' : live.package === 'unknown' || live.registration === 'unknown' && !hiddenEmptyPi
|
|
521
|
+
|| live.ownership === 'unknown' || observation.blockers.length || cursorHookUnconfirmed || piConfigUnconfirmed || !inactiveScope && !hiddenEmptyPi ? 'unknown'
|
|
522
|
+
: live.package === 'absent' || shared ? 'satisfied' : 'drifted');
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
if (hasPackageExpectation && !missing) {
|
|
526
|
+
if (registration === 'unknown')
|
|
527
|
+
warn('nativeRegistrationUnconfirmed');
|
|
528
|
+
if (requiredActivation === 'unknown')
|
|
529
|
+
warn('nativeActivationUnconfirmed');
|
|
530
|
+
if (requiredActivation === 'disabled')
|
|
531
|
+
warn('nativeActivationDisabled');
|
|
532
|
+
if (requiredActivation === 'blocked')
|
|
533
|
+
block(binding.route === 'grok-directory'
|
|
534
|
+
? 'grokProjectAuthorizationDenied' : 'nativeActivationBlocked');
|
|
535
|
+
if (binding.route === 'cursor-workspace-hook') {
|
|
536
|
+
if (live.workspaceOpen === 'absent')
|
|
537
|
+
warn('cursorWorkspaceOpenMissing');
|
|
538
|
+
if (live.workspaceOpen === 'unknown')
|
|
539
|
+
warn('cursorWorkspaceOpenUnconfirmed');
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (ownershipConflict || supplementConflict)
|
|
543
|
+
states.push('conflict');
|
|
544
|
+
else if (confirmedEmptyPackage && (live.package === 'unknown' || live.registration === 'unknown' || live.ownership === 'unknown'))
|
|
545
|
+
states.push('unknown');
|
|
546
|
+
else if (confirmedEmptyPackage && (!inactiveScope || !shared && live.package === 'present')) {
|
|
547
|
+
warn('platformContentDrift');
|
|
548
|
+
states.push('drifted');
|
|
549
|
+
}
|
|
550
|
+
else if (onlyCapabilityGaps) {
|
|
551
|
+
warn('platformExpectationUnconfirmed');
|
|
552
|
+
states.push('unknown');
|
|
553
|
+
}
|
|
554
|
+
else if (blockingGaps.length || hasPackageExpectation && registration === 'unknown')
|
|
555
|
+
states.push('unknown');
|
|
556
|
+
else if (missing)
|
|
557
|
+
states.push('absent');
|
|
558
|
+
else if (supplementUnknown || hasPackageExpectation && (live.package === 'unknown' || live.ownership === 'unknown'
|
|
559
|
+
|| requiredActivation === 'unknown' || live.workspaceOpen === 'unknown'
|
|
560
|
+
|| componentUnknown || nativeContentUnconfirmed || projectionUnconfirmed))
|
|
561
|
+
states.push('unknown');
|
|
562
|
+
else if (componentMissing || supplementMissing && !dynamicSupplementsUnconfirmed)
|
|
563
|
+
states.push('absent');
|
|
564
|
+
else if (hasPackageExpectation && ['disabled', 'blocked'].includes(requiredActivation)
|
|
565
|
+
|| live.workspaceOpen === 'absent' && live.package === 'present' || inputDrift || supplementDrift || supplementInputDrift || nativeContentDrift)
|
|
566
|
+
states.push('drifted');
|
|
567
|
+
else if (dynamicSupplementsUnconfirmed || supplementSetUnconfirmed || hasPackageExpectation && !packageExpectationConfirmed)
|
|
568
|
+
states.push('unknown');
|
|
569
|
+
else if (!expectedCount)
|
|
570
|
+
states.push(live.package === 'absent' && ['absent', 'not-applicable'].includes(live.registration) ? 'satisfied' : 'drifted');
|
|
571
|
+
else
|
|
572
|
+
states.push('satisfied');
|
|
573
|
+
}
|
|
574
|
+
observation.intentionalEmpty = emptyMatches.length === resolution.bindings.length && emptyMatches.every(Boolean);
|
|
575
|
+
observation.expectationConfirmed = currentMatches.length === resolution.bindings.length && currentMatches.every(Boolean);
|
|
576
|
+
if (versions.length && versions[0] && versions.every((version) => version === versions[0]))
|
|
577
|
+
observation.installedVersion = versions[0];
|
|
578
|
+
observation.content = ['conflict', 'drifted', 'absent', 'unknown']
|
|
579
|
+
.find((state) => states.includes(state)) ?? 'satisfied';
|
|
580
|
+
if (observation.content === 'satisfied' || observation.content === 'absent' || deliveredIds.size) {
|
|
581
|
+
observation.installedComponentIds = [...deliveredIds];
|
|
582
|
+
}
|
|
583
|
+
if (nativePackage)
|
|
584
|
+
nativePackage.skillsReady = hasReadyProviderSkills({ ...observation, installedComponentCount: deliveredIds.size });
|
|
585
|
+
}
|
|
586
|
+
catch (error) {
|
|
587
|
+
rethrowFatalError(error);
|
|
588
|
+
options.signal?.throwIfAborted();
|
|
589
|
+
observation.content = 'unknown';
|
|
590
|
+
observation.blockers.push(diagnostic('nativeObservationFailed'));
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
catch (error) {
|
|
595
|
+
rethrowFatalError(error);
|
|
596
|
+
options.signal?.throwIfAborted();
|
|
597
|
+
for (const { observation } of configuredRoots) {
|
|
598
|
+
observation.content = 'unknown';
|
|
599
|
+
observation.blockers.push(diagnostic('nativeObservationFailed'));
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
finally {
|
|
603
|
+
await ownedSession?.dispose();
|
|
604
|
+
}
|
|
605
|
+
return { observations, existing, owned };
|
|
606
|
+
}, { signal: options.signal });
|
|
607
|
+
return { observations: platforms.flatMap((result) => result.observations),
|
|
608
|
+
existing: platforms.flatMap((result) => result.existing), owned: platforms.flatMap((result) => result.owned) };
|
|
609
|
+
}
|
|
610
|
+
function safeNativePlacement(target) {
|
|
611
|
+
const component = ({ kind, key, state, metadata }) => ({
|
|
612
|
+
kind, key, state,
|
|
613
|
+
...(metadata ? { metadata: Object.fromEntries(Object.entries(metadata).filter(([name]) => ['enabled', 'scopes', 'relation', 'errorCode', 'shared', 'version', 'desiredVersion',
|
|
614
|
+
'staleCacheObserved', 'effective', 'requiredMinVersion', 'detectedVersion', 'code',
|
|
615
|
+
'kinds', 'platform', 'scope', 'project', 'rootIssueId', 'rootIssueCode'].includes(name)
|
|
616
|
+
|| (kind === 'systemConsumer' && name === 'diagnostics'))) } : {}),
|
|
617
|
+
});
|
|
618
|
+
const reason = ({ code, severity, dependencyPluginId, dependencyPlatform, dependencyScope, dependencyProject, rootIssueId, rootIssueCode }) => ({
|
|
619
|
+
code, severity, dependencyPluginId, dependencyPlatform, dependencyScope, dependencyProject,
|
|
620
|
+
rootIssueId, rootIssueCode,
|
|
621
|
+
});
|
|
622
|
+
return {
|
|
623
|
+
pluginId: target.pluginId, platform: target.platform, scope: target.scope,
|
|
624
|
+
state: target.state,
|
|
625
|
+
components: target.components.map(component), reasons: target.reasons.map(reason),
|
|
626
|
+
recoveryActions: target.recoveryActions.map(({ command, scope }) => ({ command, scope })),
|
|
627
|
+
...(target.sharedComponents ? { sharedComponents: target.sharedComponents.map(component) } : {}),
|
|
628
|
+
...(target.sharedReasons ? { sharedReasons: target.sharedReasons.map(reason) } : {}),
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
export async function statusFromObservations(options) {
|
|
632
|
+
options.signal?.throwIfAborted();
|
|
633
|
+
const { demand } = options;
|
|
634
|
+
const errors = [...demand.errors, ...(options.nativeReadErrors ?? [])];
|
|
635
|
+
let selection;
|
|
636
|
+
try {
|
|
637
|
+
selection = selectAgents({ preferences: demand.preferences, targets: options.targets });
|
|
638
|
+
}
|
|
639
|
+
catch {
|
|
640
|
+
selection = { agents: [], origin: 'none', preferences: demand.preferences.state };
|
|
641
|
+
errors.push(diagnostic('targetSelectionInvalid'));
|
|
642
|
+
}
|
|
643
|
+
const inventory = demand.roots === null ? null : [];
|
|
644
|
+
for (const root of demand.roots ?? []) {
|
|
645
|
+
options.signal?.throwIfAborted();
|
|
646
|
+
const blockers = root.blockers.map(diagnostic);
|
|
647
|
+
if (root.plugin) {
|
|
648
|
+
try {
|
|
649
|
+
const closure = root.plugin.manifest.dependencies?.length
|
|
650
|
+
? resolvePluginMetaDependencyClosure(demand.plugins.filter((plugin) => plugin.sourceId === root.sourceId), [root.plugin.manifest.name])
|
|
651
|
+
: [root.plugin];
|
|
652
|
+
for (const plugin of closure) {
|
|
653
|
+
const support = checkAwCapabilitySupport(plugin.manifest.requires?.aw.capabilities ?? [], IMPLEMENTED_AW_CAPABILITIES);
|
|
654
|
+
if (!support.supported)
|
|
655
|
+
blockers.push({ ...diagnostic('awCapabilityUnsupported'), pluginId: plugin.pluginId });
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
catch {
|
|
659
|
+
blockers.push(diagnostic('dependencyContractInvalid'));
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
if (!selection.agents.length)
|
|
663
|
+
blockers.push(diagnostic('localTargetsRequired'));
|
|
664
|
+
const targetResults = [];
|
|
665
|
+
for (const agent of selection.agents) {
|
|
666
|
+
if (demand.targetRequirements && !demand.targetRequirements.some((item) => item.pluginId === root.pluginId && item.target === agent))
|
|
667
|
+
continue;
|
|
668
|
+
options.signal?.throwIfAborted();
|
|
669
|
+
const delivery = root.plugin ? resolveDelivery(root.plugin.manifest, agent, options.scope) ?? null : null;
|
|
670
|
+
const target = { pluginId: root.pluginId, agent, scope: options.scope, delivery,
|
|
671
|
+
execution: 'not-run', observation: 'unknown', content: 'unknown', blockers: [...blockers],
|
|
672
|
+
requiredBy: [root.pluginId], relation: 'root',
|
|
673
|
+
...(root.plugin?.manifest.version ? { expectedVersion: root.plugin.manifest.version } : {}) };
|
|
674
|
+
if (blockers.length) {
|
|
675
|
+
targetResults.push(target);
|
|
676
|
+
continue;
|
|
677
|
+
}
|
|
678
|
+
if (!delivery)
|
|
679
|
+
target.blockers.push(diagnostic('deliveryUnsupported'));
|
|
680
|
+
else if (delivery.kind === 'native') {
|
|
681
|
+
const native = options.nativeObservations.find((entry) => entry.pluginId === root.pluginId
|
|
682
|
+
&& entry.platform === delivery.platform);
|
|
683
|
+
if (native) {
|
|
684
|
+
target.content = native.content;
|
|
685
|
+
if (native.componentGaps?.length)
|
|
686
|
+
target.componentGaps = native.componentGaps;
|
|
687
|
+
if (native.installedComponentIds) {
|
|
688
|
+
target.installedComponentIds = native.installedComponentIds;
|
|
689
|
+
target.installedComponentCount = native.installedComponentIds.length;
|
|
690
|
+
}
|
|
691
|
+
if (native.installedVersion)
|
|
692
|
+
target.installedVersion = native.installedVersion;
|
|
693
|
+
if (native.deploymentObservations)
|
|
694
|
+
target.deploymentObservations = native.deploymentObservations;
|
|
695
|
+
if (native.deploymentExclusions)
|
|
696
|
+
target.deploymentExclusions = native.deploymentExclusions;
|
|
697
|
+
target.blockers.push(...native.blockers);
|
|
698
|
+
if (native.reasons?.length)
|
|
699
|
+
target.reasons = [...native.reasons];
|
|
700
|
+
errors.push(...native.blockers.filter((entry) => isNativeReadError(entry))
|
|
701
|
+
.map((entry) => ({ ...entry, pluginId: root.pluginId })));
|
|
702
|
+
target.backend = { ...(native.assumedActivation ? { assumedActivation: true } : {}),
|
|
703
|
+
...(native.backend ? { live: safeNativePlacement(native.backend) } : {}) };
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
target.blockers.push(diagnostic('nativeObservationUnavailable'));
|
|
707
|
+
errors.push({ ...diagnostic('nativeObservationUnavailable'), pluginId: root.pluginId });
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
711
|
+
try {
|
|
712
|
+
const portable = await inspectPortableRecovery({ scope: options.scope, context: options.context,
|
|
713
|
+
selector: root.pluginId, agents: [agent], env: options.env, signal: options.signal,
|
|
714
|
+
cliVersion: options.cliVersion ?? '0.0.0', catalogOperationContext: demand.catalogOperationContext,
|
|
715
|
+
excludedPluginIds: demand.userProviders?.[agent] }, options.catalogReadScope);
|
|
716
|
+
options.signal?.throwIfAborted();
|
|
717
|
+
const activeConfig = root.plugin && demand.preferences.state === 'valid'
|
|
718
|
+
&& resolveActiveConfigPlatforms(root.pluginId, root.plugin.manifest, demand.preferences).includes(agent);
|
|
719
|
+
target.blockers.push(...portable.blockers.filter((code) => code !== 'previousDeploymentRetained'
|
|
720
|
+
&& (activeConfig || !isConfigDiagnostic({ code }))).map((code) => portablePreparationDiagnostic(portable, diagnostic(code), agent)));
|
|
721
|
+
if (portable.policyNotices?.length)
|
|
722
|
+
target.reasons = [...target.reasons ?? [], ...portable.policyNotices];
|
|
723
|
+
const gaps = (portable.unmet ?? []).filter((gap) => gap.agent === agent);
|
|
724
|
+
const blockingGap = gaps.some((gap) => !isDeliveryCapabilityGap(gap));
|
|
725
|
+
if (gaps.length)
|
|
726
|
+
target.componentGaps = gaps;
|
|
727
|
+
if (blockingGap && !target.blockers.some((entry) => entry.code === 'portableComponentsUnmet'))
|
|
728
|
+
target.blockers.push(diagnostic('portableComponentsUnmet'));
|
|
729
|
+
const observed = portable.targets.filter((entry) => entry.agent === agent);
|
|
730
|
+
if (!portable.globalBlockers?.length) {
|
|
731
|
+
const installed = observed.filter((entry) => entry.providerPluginId === root.pluginId
|
|
732
|
+
&& entry.disposition === 'write' && entry.observation === 'satisfied' && !entry.blocker);
|
|
733
|
+
if (installed.length || observed.every((entry) => entry.disposition === 'retain'
|
|
734
|
+
|| entry.observation === 'satisfied' || entry.observation === 'absent')) {
|
|
735
|
+
target.installedComponentCount = installed.length;
|
|
736
|
+
if (installed.every((entry) => entry.componentId))
|
|
737
|
+
target.installedComponentIds = installed.map((entry) => entry.componentId);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
target.blockers.push(...observed.flatMap((entry) => entry.disposition === 'retain'
|
|
741
|
+
? [retainedOutputDiagnostic(entry.providerPluginId, agent, options.scope, entry.physicalPath, `skill.${entry.skill}`)]
|
|
742
|
+
: entry.blocker ? [diagnostic(entry.blocker)] : []));
|
|
743
|
+
target.content = ['conflict', 'drifted', 'absent', 'unknown']
|
|
744
|
+
.find((state) => observed.some((entry) => entry.observation === state))
|
|
745
|
+
?? (!portable.blockers.length && (observed.length || portable.intentionalEmpty || gaps.length && !blockingGap) ? 'satisfied' : 'unknown');
|
|
746
|
+
if (observed.length === 0 && portable.blockers.includes('needs-preparation') && options.portableCoverage === true
|
|
747
|
+
&& options.portableInstalled && !options.portableInstalled.some((item) => item.pluginId === root.pluginId && item.agent === agent)) {
|
|
748
|
+
target.content = 'absent';
|
|
749
|
+
target.blockers = target.blockers.filter((item) => item.code !== 'needs-preparation');
|
|
750
|
+
}
|
|
751
|
+
if ((blockingGap || observed.some((entry) => entry.disposition === 'retain')) && target.content !== 'conflict')
|
|
752
|
+
target.content = 'unknown';
|
|
753
|
+
target.backend = observed.map((entry) => ({ skill: entry.skill, agent: entry.agent,
|
|
754
|
+
ownership: entry.ownership, observation: entry.observation, associatedAgents: entry.associatedAgents }));
|
|
755
|
+
if (target.blockers.some((entry) => !isConfigDiagnostic(entry) && isTargetObservationReadError(entry))) {
|
|
756
|
+
errors.push({ ...diagnostic('portableObservationFailed'), pluginId: root.pluginId });
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
catch (error) {
|
|
760
|
+
rethrowFatalError(error);
|
|
761
|
+
options.signal?.throwIfAborted();
|
|
762
|
+
target.blockers.push(diagnostic('portableObservationFailed'));
|
|
763
|
+
errors.push({ ...diagnostic('portableObservationFailed'), pluginId: root.pluginId });
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
const dynamicExpectationConfirmed = delivery?.kind === 'native' && options.nativeObservations.some((entry) => entry.pluginId === root.pluginId && entry.platform === delivery.platform && (entry.intentionalEmpty === true || entry.expectationConfirmed === true));
|
|
767
|
+
if (delivery?.kind === 'native' && root.plugin?.manifest.artifacts && !dynamicExpectationConfirmed) {
|
|
768
|
+
if (target.content === 'satisfied' || target.content === 'absent')
|
|
769
|
+
target.content = 'unknown';
|
|
770
|
+
if (target.content === 'unknown' && !target.reasons?.some((entry) => entry.code === 'dynamicExpectationUnconfirmed')) {
|
|
771
|
+
target.reasons = [...target.reasons ?? [], diagnostic('dynamicExpectationUnconfirmed')];
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
if (target.content === 'satisfied' && !target.blockers.length && target.installedComponentCount === 0
|
|
775
|
+
&& target.componentGaps?.some((gap) => gap.providerPluginId === target.pluginId) && target.componentGaps.every(isDeliveryCapabilityGap)) {
|
|
776
|
+
target.satisfaction = 'not-applicable';
|
|
777
|
+
}
|
|
778
|
+
target.observation = target.content === 'satisfied' ? 'verified'
|
|
779
|
+
: target.content === 'absent' ? 'missing' : 'unknown';
|
|
780
|
+
targetResults.push(target);
|
|
781
|
+
}
|
|
782
|
+
inventory.push({ pluginId: root.pluginId, source: root.sourceId, sourceState: root.sourceState,
|
|
783
|
+
blockers, targetResults });
|
|
784
|
+
}
|
|
785
|
+
const counts = { blocked: 0, unconfirmed: 0, pending: 0, ready: 0 };
|
|
786
|
+
let definiteFailure = false;
|
|
787
|
+
let uncertain = inventory === null;
|
|
788
|
+
for (const root of inventory ?? []) {
|
|
789
|
+
const targets = root.targetResults;
|
|
790
|
+
if (root.blockers.length || targets.some((target) => target.blockers.length || target.content === 'conflict'
|
|
791
|
+
|| target.delivery === null)) {
|
|
792
|
+
counts.blocked++;
|
|
793
|
+
}
|
|
794
|
+
else if (!targets.length || targets.some((target) => target.content === 'unknown')) {
|
|
795
|
+
counts.unconfirmed++;
|
|
796
|
+
uncertain = true;
|
|
797
|
+
}
|
|
798
|
+
else if (targets.some((target) => target.content === 'absent' || target.content === 'drifted'))
|
|
799
|
+
counts.pending++;
|
|
800
|
+
else
|
|
801
|
+
counts.ready++;
|
|
802
|
+
if (!targets.length || root.blockers.some((entry) => !/^(?:pluginUnavailable|sourceMissing|sourceIdentityMismatch)$/u.test(entry.code))) {
|
|
803
|
+
uncertain = true;
|
|
804
|
+
}
|
|
805
|
+
if (root.blockers.some((entry) => /^(?:pluginUnavailable|sourceMissing|sourceIdentityMismatch)$/u.test(entry.code))) {
|
|
806
|
+
definiteFailure = true;
|
|
807
|
+
}
|
|
808
|
+
for (const target of targets) {
|
|
809
|
+
if (target.content === 'absent' || target.content === 'drifted' || target.content === 'conflict'
|
|
810
|
+
|| target.blockers.some((entry) => entry.code === 'deliveryUnsupported')) {
|
|
811
|
+
definiteFailure = true;
|
|
812
|
+
}
|
|
813
|
+
else if (target.blockers.some((entry) => entry.code === 'awCapabilityUnsupported'))
|
|
814
|
+
definiteFailure = true;
|
|
815
|
+
else if (target.content === 'unknown' || target.observation === 'unknown' || target.blockers.length)
|
|
816
|
+
uncertain = true;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
const allSatisfied = definiteFailure ? false : uncertain ? null : true;
|
|
820
|
+
options.signal?.throwIfAborted();
|
|
821
|
+
return { schemaVersion: 1, kind: 'aw-recovery-status', scope: options.scope, ok: errors.length === 0,
|
|
822
|
+
intent: { state: demand.intent.state, ...('digest' in demand.intent ? { digest: demand.intent.digest } : {}) },
|
|
823
|
+
selection, inventory, extraObserved: options.extraObserved ?? [],
|
|
824
|
+
coverage: { native: (options.nativeReadErrors?.length ?? 0) === 0, portable: options.portableCoverage ?? true },
|
|
825
|
+
counts, allSatisfied, inSync: aggregateConvergence(allSatisfied, (options.extraObserved?.length ?? 0) > 0 ? 'present' : options.portableCoverage === false ? 'unknown' : 'absent'), errors };
|
|
826
|
+
}
|
|
827
|
+
export async function readScopedRecoveryStatus(options) {
|
|
828
|
+
options.signal?.throwIfAborted();
|
|
829
|
+
const context = await createScopeContext({ scope: options.scope, cwd: options.cwd, env: options.env, readOnly: true });
|
|
830
|
+
try {
|
|
831
|
+
options.signal?.throwIfAborted();
|
|
832
|
+
const demand = options.demandOverride ?? await readDemand({ scope: options.scope, cwd: context.executionCwd, env: context.env,
|
|
833
|
+
catalogOperationContext: options.catalogOperationContext, signal: options.signal, catalogReadScope: options.catalogReadScope });
|
|
834
|
+
options.signal?.throwIfAborted();
|
|
835
|
+
options.onDemand?.(demand);
|
|
836
|
+
options.signal?.throwIfAborted();
|
|
837
|
+
const ownerInventory = options.nativeObservations ? { references: [], errors: [] }
|
|
838
|
+
: await measureRecoveryPerformanceStage(options, 'status.inventory', () => inventoryCatalogSourceReferences({ cwd: context.executionCwd, env: context.env, scope: options.scope,
|
|
839
|
+
knownPluginNames: demand.plugins.map((plugin) => plugin.manifest.name), collectPathEvidence: false,
|
|
840
|
+
observationPlugins: options.observationPlugins }));
|
|
841
|
+
options.signal?.throwIfAborted();
|
|
842
|
+
const candidates = ownerInventory.references.filter((entry) => entry.scope === options.scope
|
|
843
|
+
&& entry.sourceId && entry.pluginName && isPlatformTarget(entry.platform) && entry.platform !== 'generic'
|
|
844
|
+
&& (!options.observationPlugins || options.observationPlugins.has(`${entry.sourceId}/${entry.pluginName}`)
|
|
845
|
+
|| options.observationPlugins.has(entry.pluginName))
|
|
846
|
+
&& (!options.targets || options.targets.includes(entry.platform)));
|
|
847
|
+
const portableExtra = options.targets && !options.targets.includes('generic') ? { targets: [], complete: true }
|
|
848
|
+
: await inspectPortableExtraInstalled({
|
|
849
|
+
scope: options.scope, context, env: context.env, signal: options.signal, plugins: options.observationPlugins,
|
|
850
|
+
});
|
|
851
|
+
options.signal?.throwIfAborted();
|
|
852
|
+
const sourceCandidates = [...candidates, ...portableExtra.targets.flatMap((target) => {
|
|
853
|
+
if (demand.preferences.state !== 'valid' || !demand.preferences.value.targets.includes(target.agent))
|
|
854
|
+
return [];
|
|
855
|
+
if (options.observationPlugins && !options.observationPlugins.has(target.pluginId)
|
|
856
|
+
&& !options.observationPlugins.has(parsePluginId(target.pluginId).pluginName))
|
|
857
|
+
return [];
|
|
858
|
+
const { sourceId, pluginName } = parsePluginId(target.pluginId);
|
|
859
|
+
return [{ sourceId, pluginName }];
|
|
860
|
+
})];
|
|
861
|
+
const observedPlugins = new Map(demand.plugins.map((plugin) => [plugin.pluginId, plugin]));
|
|
862
|
+
const catalog = demand.catalogOperationContext ?? options.catalogOperationContext;
|
|
863
|
+
const catalogSources = options.catalogSources ?? new Map();
|
|
864
|
+
for (const source of catalog?.catalog.sources ?? [])
|
|
865
|
+
if (!catalogSources.has(source.sourceId))
|
|
866
|
+
catalogSources.set(source.sourceId, source);
|
|
867
|
+
if (sourceCandidates.some((entry) => !observedPlugins.has(`${entry.sourceId}/${entry.pluginName}`))) {
|
|
868
|
+
try {
|
|
869
|
+
const missing = [...new Set(sourceCandidates.map((entry) => entry.sourceId))].filter((id) => !catalogSources.has(id));
|
|
870
|
+
if (missing.length) {
|
|
871
|
+
const config = await readCatalogSourcesConfigSnapshot(context.env);
|
|
872
|
+
const configured = new Set(config.config.sources.map((source) => source.id));
|
|
873
|
+
const sourceIds = missing.filter((id) => configured.has(id));
|
|
874
|
+
if (sourceIds.length) {
|
|
875
|
+
const additional = await resolvePartialCatalogOperationContext({ env: context.env, signal: options.signal,
|
|
876
|
+
configSnapshot: config, sourceIds }, options.catalogReadScope);
|
|
877
|
+
for (const source of additional.catalog.sources)
|
|
878
|
+
catalogSources.set(source.sourceId, source);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
catch (error) {
|
|
883
|
+
rethrowFatalError(error);
|
|
884
|
+
options.signal?.throwIfAborted();
|
|
885
|
+
}
|
|
886
|
+
for (const candidate of sourceCandidates) {
|
|
887
|
+
const pluginId = `${candidate.sourceId}/${candidate.pluginName}`;
|
|
888
|
+
if (observedPlugins.has(pluginId))
|
|
889
|
+
continue;
|
|
890
|
+
const source = catalogSources.get(candidate.sourceId)?.resolution;
|
|
891
|
+
if (!source?.manifest.entries.some((entry) => entry.name === candidate.pluginName))
|
|
892
|
+
continue;
|
|
893
|
+
// Configuration references need the retained plugin's dependency closure as well as its own manifest.
|
|
894
|
+
let dependencyEntries;
|
|
895
|
+
try {
|
|
896
|
+
dependencyEntries = resolvePluginDependencyClosure(source.manifest.entries, [candidate.pluginName]);
|
|
897
|
+
}
|
|
898
|
+
catch {
|
|
899
|
+
dependencyEntries = [{ name: candidate.pluginName }];
|
|
900
|
+
}
|
|
901
|
+
for (const { name } of dependencyEntries) {
|
|
902
|
+
const id = `${source.sourceId}/${name}`;
|
|
903
|
+
if (observedPlugins.has(id))
|
|
904
|
+
continue;
|
|
905
|
+
try {
|
|
906
|
+
const plugin = await readPluginManifest(path.join(source.rootDir, 'plugins', name), { mode: 'bundle' });
|
|
907
|
+
Object.assign(plugin, { pluginId: id, sourceId: source.sourceId, sourceIdentity: source.sourceIdentity,
|
|
908
|
+
catalogLogicalIdentity: source.logicalIdentity });
|
|
909
|
+
observedPlugins.set(id, plugin);
|
|
910
|
+
}
|
|
911
|
+
catch (error) {
|
|
912
|
+
rethrowFatalError(error);
|
|
913
|
+
options.signal?.throwIfAborted();
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
let selectedAgents = [];
|
|
919
|
+
try {
|
|
920
|
+
selectedAgents = selectAgents({ preferences: demand.preferences, targets: options.targets }).agents;
|
|
921
|
+
}
|
|
922
|
+
catch { /* The status result reports invalid strong state without extending observations. */ }
|
|
923
|
+
// Keep old owners in the residual/cleanup inventory. Only bind a current
|
|
924
|
+
// manifest for native observation when the recorded identity is compatible.
|
|
925
|
+
// Older Native owners may omit the source identity; keep their existing observation path.
|
|
926
|
+
const currentCandidates = candidates.filter((candidate) => {
|
|
927
|
+
const plugin = observedPlugins.get(`${candidate.sourceId}/${candidate.pluginName}`);
|
|
928
|
+
return plugin && (!candidate.sourceIdentity || candidate.sourceIdentity === plugin.sourceIdentity);
|
|
929
|
+
});
|
|
930
|
+
const observationDemand = { ...demand, plugins: [...observedPlugins.values()],
|
|
931
|
+
roots: [...new Map([...(demand.roots ?? []), ...currentCandidates.flatMap((candidate) => {
|
|
932
|
+
const pluginId = `${candidate.sourceId}/${candidate.pluginName}`;
|
|
933
|
+
const plugin = observedPlugins.get(pluginId);
|
|
934
|
+
return plugin ? [{ pluginId, sourceId: candidate.sourceId, plugin, sourceState: 'ready', blockers: [] }] : [];
|
|
935
|
+
})].map((root) => [root.pluginId, root])).values()],
|
|
936
|
+
targetRequirements: demand.targetRequirements ? [...demand.targetRequirements,
|
|
937
|
+
...currentCandidates.map((entry) => ({ pluginId: `${entry.sourceId}/${entry.pluginName}`, target: entry.platform }))] : undefined };
|
|
938
|
+
const adapters = options.nativeObservations ? { observations: [], existing: [], owned: [] }
|
|
939
|
+
: await withStatusNativeQueries({ ...options, targets: [...new Set([...selectedAgents, ...candidates.map((entry) => entry.platform)])] }, (nativeOptions) => readAdapterObservations(nativeOptions, context, observationDemand, candidates));
|
|
940
|
+
const roots = new Set(demand.roots?.map((root) => root.pluginId) ?? []);
|
|
941
|
+
const queue = [...(demand.roots ?? []).map((root) => root.plugin).filter((plugin) => plugin !== undefined)];
|
|
942
|
+
const byId = new Map(demand.plugins.map((plugin) => [plugin.pluginId, plugin]));
|
|
943
|
+
while (queue.length) {
|
|
944
|
+
const plugin = queue.shift();
|
|
945
|
+
for (const name of plugin.manifest.dependencies ?? []) {
|
|
946
|
+
const id = `${plugin.sourceId}/${name}`;
|
|
947
|
+
if (roots.has(id))
|
|
948
|
+
continue;
|
|
949
|
+
roots.add(id);
|
|
950
|
+
const dependency = byId.get(id);
|
|
951
|
+
if (dependency)
|
|
952
|
+
queue.push(dependency);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
const expected = (pluginId, agent) => demand.targetRequirements
|
|
956
|
+
? demand.targetRequirements.some((item) => item.pluginId === pluginId && item.target === agent)
|
|
957
|
+
: roots.has(pluginId) && agent !== null && demand.preferences.state === 'valid' && demand.preferences.value.targets.includes(agent);
|
|
958
|
+
const nativeExtraObserved = adapters.owned
|
|
959
|
+
.filter((entry) => !expected(entry.pluginId, entry.agent))
|
|
960
|
+
.map((entry) => ({ ...entry,
|
|
961
|
+
expectedVersion: adapters.observations.find((item) => item.pluginId === entry.pluginId && item.platform === entry.agent)?.expectedVersion,
|
|
962
|
+
installedVersion: adapters.observations.find((item) => item.pluginId === entry.pluginId && item.platform === entry.agent)?.installedVersion,
|
|
963
|
+
delivery: { kind: 'native', platform: entry.agent },
|
|
964
|
+
observation: 'unknown', content: 'unknown', blockers: adapters.observations.find((observation) => observation.pluginId === entry.pluginId && observation.platform === entry.agent)?.blockers.filter(isConfigDiagnostic),
|
|
965
|
+
deploymentObservations: adapters.observations.find((observation) => observation.pluginId === entry.pluginId && observation.platform === entry.agent)?.deploymentObservations }));
|
|
966
|
+
const inventoryOwned = candidates.flatMap((entry) => {
|
|
967
|
+
// A verified Antigravity copy remains a native retirement candidate when
|
|
968
|
+
// its AW source is gone. Execution still verifies the live registration;
|
|
969
|
+
// the copy is not an owned filesystem output or AW source authority.
|
|
970
|
+
const nativeCopy = entry.platform === 'antigravity' && entry.scope === 'user'
|
|
971
|
+
&& entry.kind === 'namespacedMarketplace' && entry.recoveryCandidate?.evidence === 'verified'
|
|
972
|
+
&& entry.recoveryCandidate.binding.route === 'antigravity-cli';
|
|
973
|
+
return nativeCopy || entry.ownedComponent && !['codex', 'claude', 'copilot'].includes(entry.platform)
|
|
974
|
+
? [{ pluginId: `${entry.sourceId}/${entry.pluginName}`, agent: entry.platform, scope: options.scope }] : [];
|
|
975
|
+
});
|
|
976
|
+
for (const entry of inventoryOwned) {
|
|
977
|
+
if (!expected(entry.pluginId, entry.agent) && !nativeExtraObserved.some((target) => target.pluginId === entry.pluginId && target.agent === entry.agent)) {
|
|
978
|
+
const current = currentCandidates.some((candidate) => `${candidate.sourceId}/${candidate.pluginName}` === entry.pluginId
|
|
979
|
+
&& candidate.platform === entry.agent);
|
|
980
|
+
nativeExtraObserved.push({ ...entry, delivery: { kind: 'native', platform: entry.agent }, observation: 'unknown', content: 'unknown',
|
|
981
|
+
...(current ? { blockers: adapters.observations.find((observation) => observation.pluginId === entry.pluginId && observation.platform === entry.agent)?.blockers.filter(isConfigDiagnostic) } : {}) });
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
const retainedProjectPackages = [];
|
|
985
|
+
for (const entry of candidates) {
|
|
986
|
+
const component = entry.ownedComponent;
|
|
987
|
+
const recovery = entry.recoveryCandidate;
|
|
988
|
+
if (component?.kind !== 'owned-directory' || recovery?.evidence !== 'verified' || component.identity.scope !== options.scope
|
|
989
|
+
|| component.identity.sourceId !== entry.sourceId || component.identity.sourceIdentity !== entry.sourceIdentity
|
|
990
|
+
|| component.identity.platform !== entry.platform || component.identity.pluginId !== `${entry.sourceId}/${entry.pluginName}`
|
|
991
|
+
|| component.identity.physicalKey !== recovery.binding.physicalKey)
|
|
992
|
+
continue;
|
|
993
|
+
const pluginId = component.identity.pluginId;
|
|
994
|
+
const agent = entry.platform;
|
|
995
|
+
const sourceIdentity = recovery.binding.plugin.sourceIdentity;
|
|
996
|
+
if (!hasSharedUserPackage(agent)) {
|
|
997
|
+
const location = recovery.binding.scope;
|
|
998
|
+
if (location.kind !== 'project' || location.projectRoot !== context.projectRoot
|
|
999
|
+
|| adapters.existing.some((target) => target.pluginId === pluginId && target.agent === agent
|
|
1000
|
+
&& target.nativePackage?.sourceIdentity === sourceIdentity))
|
|
1001
|
+
continue;
|
|
1002
|
+
const source = catalogSources.get(entry.sourceId)?.resolution;
|
|
1003
|
+
let dependencies = null;
|
|
1004
|
+
if (source?.sourceIdentity === sourceIdentity && source.manifest.entries.some((plugin) => plugin.name === entry.pluginName)) {
|
|
1005
|
+
try {
|
|
1006
|
+
dependencies = resolvePluginDependencyClosure(source.manifest.entries, [entry.pluginName])
|
|
1007
|
+
.filter((plugin) => plugin.name !== entry.pluginName).map((plugin) => `${entry.sourceId}/${plugin.name}`);
|
|
1008
|
+
}
|
|
1009
|
+
catch { /* An unavailable closure retains only same-source candidates. */ }
|
|
1010
|
+
}
|
|
1011
|
+
retainedProjectPackages.push({ pluginId, agent, scope: 'project', dependencies,
|
|
1012
|
+
nativePackage: { sourceIdentity, skillsReady: false } });
|
|
1013
|
+
continue;
|
|
1014
|
+
}
|
|
1015
|
+
if (observedPlugins.get(pluginId)?.sourceIdentity === component.identity.sourceIdentity)
|
|
1016
|
+
continue;
|
|
1017
|
+
nativeExtraObserved.push({ pluginId, agent, scope: component.identity.scope,
|
|
1018
|
+
delivery: { kind: 'native', platform: agent }, observation: 'unknown', content: 'unknown',
|
|
1019
|
+
backend: { retainedPackage: true, ownedComponents: [{ ...component, state: 'present' }] } });
|
|
1020
|
+
}
|
|
1021
|
+
const portableConfigBlockers = new Map();
|
|
1022
|
+
const portableObserved = [];
|
|
1023
|
+
for (const entry of portableExtra.targets.filter((item) => !expected(item.pluginId, item.agent))) {
|
|
1024
|
+
const plugin = observedPlugins.get(entry.pluginId);
|
|
1025
|
+
const key = `${entry.pluginId}\0${entry.agent}`;
|
|
1026
|
+
const current = plugin?.catalogLogicalIdentity !== undefined && plugin.catalogLogicalIdentity === entry.logicalIdentity;
|
|
1027
|
+
if (current && !portableConfigBlockers.has(key) && demand.preferences.state === 'valid'
|
|
1028
|
+
&& (!options.observationPlugins || options.observationPlugins.has(entry.pluginId)
|
|
1029
|
+
|| options.observationPlugins.has(parsePluginId(entry.pluginId).pluginName))
|
|
1030
|
+
&& resolveActiveConfigPlatforms(entry.pluginId, plugin.manifest, demand.preferences).includes(entry.agent)) {
|
|
1031
|
+
let blockers;
|
|
1032
|
+
try {
|
|
1033
|
+
const config = await resolveArtifactRenderConfig({ pluginName: plugin.manifest.name, sourceId: plugin.sourceId,
|
|
1034
|
+
sourceIdentity: plugin.sourceIdentity, logicalIdentity: plugin.catalogLogicalIdentity, manifest: plugin.manifest,
|
|
1035
|
+
platform: entry.agent, scope: options.scope, cwd: context.executionCwd, env: context.env, referencePlugins: [...observedPlugins.values()] });
|
|
1036
|
+
blockers = configStatusDiagnostics(config.issues);
|
|
1037
|
+
}
|
|
1038
|
+
catch (error) {
|
|
1039
|
+
options.signal?.throwIfAborted();
|
|
1040
|
+
blockers = [configReadDiagnostic(error)];
|
|
1041
|
+
}
|
|
1042
|
+
portableConfigBlockers.set(key, blockers.map((blocker) => ({ ...blocker, subject: { pluginId: entry.pluginId, target: entry.agent, scope: options.scope } })));
|
|
1043
|
+
}
|
|
1044
|
+
const blockers = current ? portableConfigBlockers.get(key) : undefined;
|
|
1045
|
+
portableObserved.push({ pluginId: entry.pluginId, agent: entry.agent, scope: options.scope,
|
|
1046
|
+
delivery: { kind: 'agent-skills', provider: 'aw', agentId: 'generic' },
|
|
1047
|
+
observation: entry.observation, content: entry.content, ...(blockers?.length ? { blockers } : {}),
|
|
1048
|
+
backend: { skill: entry.skill, logicalIdentity: entry.logicalIdentity } });
|
|
1049
|
+
}
|
|
1050
|
+
const extraObserved = [...nativeExtraObserved, ...portableObserved];
|
|
1051
|
+
const relevantErrors = ownerInventory.errors.filter((error) => {
|
|
1052
|
+
const relevance = error.relevance;
|
|
1053
|
+
if (relevance.global)
|
|
1054
|
+
return true;
|
|
1055
|
+
if (options.targets && relevance.platform && !options.targets.includes(relevance.platform))
|
|
1056
|
+
return false;
|
|
1057
|
+
if (!options.observationPlugins)
|
|
1058
|
+
return true;
|
|
1059
|
+
if (!relevance.pluginName && !relevance.sourceId)
|
|
1060
|
+
return true;
|
|
1061
|
+
return [...options.observationPlugins].some((id) => {
|
|
1062
|
+
const parsed = parsePluginId(id);
|
|
1063
|
+
const plugin = observedPlugins.get(id);
|
|
1064
|
+
return (!relevance.sourceId || !parsed.sourceId || relevance.sourceId === parsed.sourceId)
|
|
1065
|
+
&& (!relevance.pluginName || relevance.pluginName === parsed.pluginName
|
|
1066
|
+
|| relevance.componentName && plugin?.manifest.extensions?.agents?.some((agent) => agent.name === relevance.componentName));
|
|
1067
|
+
});
|
|
1068
|
+
});
|
|
1069
|
+
const result = await statusFromObservations({ ...options, context, demand,
|
|
1070
|
+
nativeObservations: options.nativeObservations ?? adapters.observations, extraObserved,
|
|
1071
|
+
portableCoverage: portableExtra.complete, portableInstalled: portableExtra.targets,
|
|
1072
|
+
nativeReadErrors: [
|
|
1073
|
+
...relevantErrors.map(inventoryRecoveryDiagnostic),
|
|
1074
|
+
...adapters.observations.flatMap((entry) => entry.blockers.filter((error) => isNativeReadError(error))),
|
|
1075
|
+
] });
|
|
1076
|
+
result.coverage.requestComplete = result.coverage.native && result.coverage.portable;
|
|
1077
|
+
result.coverage.native &&= ownerInventory.errors.length === 0;
|
|
1078
|
+
// The project scan includes User Intent. Demand accounts for its effect on
|
|
1079
|
+
// shared providers, while this loop attributes failures to local outputs.
|
|
1080
|
+
const userIntentPath = options.scope === 'project' && relevantErrors.some((error) => error.kind === 'lifecycleIntentRead')
|
|
1081
|
+
? await resolveIntentPath({ ...options, scope: 'user' }) : undefined;
|
|
1082
|
+
const targetErrors = relevantErrors.filter((error) => !(userIntentPath && error.kind === 'lifecycleIntentRead'
|
|
1083
|
+
&& error.recoveryPath === userIntentPath));
|
|
1084
|
+
for (const target of result.inventory?.flatMap((entry) => entry.targetResults) ?? []) {
|
|
1085
|
+
for (const error of targetErrors) {
|
|
1086
|
+
const relevance = error.relevance;
|
|
1087
|
+
const identity = parsePluginId(target.pluginId);
|
|
1088
|
+
if (!relevance.global && (relevance.platform && relevance.platform !== target.agent
|
|
1089
|
+
|| relevance.sourceId && relevance.sourceId !== identity.sourceId
|
|
1090
|
+
|| relevance.scope && relevance.scope !== target.scope
|
|
1091
|
+
&& !(relevance.scope === 'user' && target.scope === 'project' && ['codex', 'claude', 'copilot'].includes(target.agent))
|
|
1092
|
+
|| relevance.projectLocationKey && relevance.projectLocationKey !== context.projectKey
|
|
1093
|
+
|| relevance.pluginName && relevance.pluginName !== identity.pluginName
|
|
1094
|
+
&& !(relevance.componentName && observedPlugins.get(target.pluginId)?.manifest.extensions?.agents?.some((agent) => agent.name === relevance.componentName))))
|
|
1095
|
+
continue;
|
|
1096
|
+
target.blockers.push(inventoryRecoveryDiagnostic(error));
|
|
1097
|
+
if (target.content === 'satisfied') {
|
|
1098
|
+
target.content = 'unknown';
|
|
1099
|
+
target.observation = 'unknown';
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
// Installed-current evidence must not bind a retained old Catalog's Skill to
|
|
1104
|
+
// the new source. Unresolved sources remain observable, and ownedTargets
|
|
1105
|
+
// below still keeps every exact residual for cleanup.
|
|
1106
|
+
const portableCurrent = (target) => {
|
|
1107
|
+
const identity = observedPlugins.get(target.pluginId)?.catalogLogicalIdentity
|
|
1108
|
+
?? catalogSources.get(parsePluginId(target.pluginId).sourceId)?.resolution?.logicalIdentity;
|
|
1109
|
+
return identity === undefined || target.logicalIdentity === identity;
|
|
1110
|
+
};
|
|
1111
|
+
result.existingTargets = [
|
|
1112
|
+
...adapters.existing,
|
|
1113
|
+
...portableExtra.targets.filter(portableCurrent).map((target) => ({ pluginId: target.pluginId, agent: target.agent, scope: options.scope })),
|
|
1114
|
+
];
|
|
1115
|
+
result.retainedProjectPackages = retainedProjectPackages;
|
|
1116
|
+
result.ownedTargets = [
|
|
1117
|
+
...adapters.owned, ...inventoryOwned,
|
|
1118
|
+
...portableExtra.targets.map((target) => ({ pluginId: target.pluginId, agent: target.agent, scope: options.scope })),
|
|
1119
|
+
];
|
|
1120
|
+
await options.onNativeStatus?.(result, demand);
|
|
1121
|
+
options.signal?.throwIfAborted();
|
|
1122
|
+
return result;
|
|
1123
|
+
}
|
|
1124
|
+
finally {
|
|
1125
|
+
await context.dispose();
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
export async function checkRecovery(selectors, options) {
|
|
1129
|
+
const status = await readRecoveryStatus(options);
|
|
1130
|
+
const blockers = [];
|
|
1131
|
+
const roots = [...new Set(status.inventory?.map((root) => root.pluginId) ?? [])];
|
|
1132
|
+
const requested = [];
|
|
1133
|
+
if (options.all && selectors.length)
|
|
1134
|
+
blockers.push(diagnostic('syncSelectorConflict'));
|
|
1135
|
+
else if (!selectors.length)
|
|
1136
|
+
requested.push(...roots);
|
|
1137
|
+
else
|
|
1138
|
+
for (const selector of selectors) {
|
|
1139
|
+
const parsed = parsePluginId(selector);
|
|
1140
|
+
const matches = roots.filter((id) => parsed.sourceId ? id === selector : parsePluginId(id).pluginName === parsed.pluginName);
|
|
1141
|
+
if (matches.length !== 1)
|
|
1142
|
+
blockers.push(diagnostic('syncPluginNotDesired'));
|
|
1143
|
+
else if (!requested.includes(matches[0]))
|
|
1144
|
+
requested.push(matches[0]);
|
|
1145
|
+
}
|
|
1146
|
+
const selectedRoots = status.inventory?.filter((root) => requested.includes(root.pluginId)) ?? [];
|
|
1147
|
+
blockers.push(...selectedRoots.flatMap((root) => root.blockers));
|
|
1148
|
+
if (requested.length && status.selection.agents.length === 0)
|
|
1149
|
+
blockers.push(diagnostic('targetsNotConfigured'));
|
|
1150
|
+
const targetResults = selectedRoots.flatMap((root) => root.targetResults)
|
|
1151
|
+
.filter((target) => !options.targets || options.targets.includes(target.agent));
|
|
1152
|
+
const remainingTargets = targetResults.filter((target) => target.blockers.length || target.observation !== 'verified')
|
|
1153
|
+
.map(({ pluginId, agent, scope, delivery }) => ({ pluginId, agent, scope, delivery }));
|
|
1154
|
+
if (status.intent.state !== 'valid' && status.intent.state !== 'absent')
|
|
1155
|
+
blockers.push(diagnostic('pluginIntentStateInvalid'));
|
|
1156
|
+
const errors = status.errors;
|
|
1157
|
+
const ok = blockers.length === 0 && remainingTargets.length === 0 && errors.length === 0
|
|
1158
|
+
&& !(requested.length === 0 && status.allSatisfied === null);
|
|
1159
|
+
return { schemaVersion: 1, kind: 'aw-recovery', scope: status.scope, command: 'sync:check', ok,
|
|
1160
|
+
intent: { ...status.intent, roots: status.inventory === null ? null : roots },
|
|
1161
|
+
requestedRoots: requested, requestedTargets: targetResults.map(({ pluginId, agent, scope, delivery }) => ({ pluginId, agent, scope, delivery })), selection: status.selection, blockers, errors,
|
|
1162
|
+
targetResults, remainingTargets, recoveryActions: ok ? [] : ['aw plugin status --json'],
|
|
1163
|
+
allSatisfied: status.allSatisfied, inSync: status.inSync,
|
|
1164
|
+
coverage: { scopes: status.coverage.scopes ?? [status.scope], ...(status.coverage.projectRoot ? { projectRoot: status.coverage.projectRoot } : {}) },
|
|
1165
|
+
declarationChanged: false, preferencesChanged: false, configChanged: false, outputsMayHaveChanged: false };
|
|
1166
|
+
}
|
|
1167
|
+
function observedSatisfaction(content, provider, inheritsUser) {
|
|
1168
|
+
if (!content || content === 'unknown')
|
|
1169
|
+
return 'unknown';
|
|
1170
|
+
if (content !== 'satisfied')
|
|
1171
|
+
return 'pending';
|
|
1172
|
+
if (provider?.satisfaction === 'not-applicable')
|
|
1173
|
+
return 'not-applicable';
|
|
1174
|
+
return inheritsUser ? 'inherited-user' : 'installed';
|
|
1175
|
+
}
|
|
1176
|
+
export function aggregateConvergence(allSatisfied, residue) {
|
|
1177
|
+
return allSatisfied === false || residue === 'present' ? false
|
|
1178
|
+
: allSatisfied === null || residue === 'unknown' ? null : true;
|
|
1179
|
+
}
|
|
1180
|
+
export async function readRecoveryStatus(options, preparedDemand) {
|
|
1181
|
+
return withStatusNativeQueries(options, (nativeOptions) => readRecoveryStatusWithQueries(nativeOptions, preparedDemand));
|
|
1182
|
+
}
|
|
1183
|
+
async function readRecoveryStatusWithQueries(options, preparedDemand) {
|
|
1184
|
+
options = { ...options, discoveryCache: options.discoveryCache ?? new Map(), catalogSources: new Map() };
|
|
1185
|
+
const snapshot = preparedDemand ?? await measureRecoveryPerformanceStage(options, 'status.demand', () => readJointDemand(options));
|
|
1186
|
+
if (options.codexObservationSession || options.nativeObservations || options.targets && !options.targets.includes('codex')) {
|
|
1187
|
+
return readRecoveryStatusInSession(options, snapshot);
|
|
1188
|
+
}
|
|
1189
|
+
const context = await createScopeContext({ scope: snapshot.context.context,
|
|
1190
|
+
cwd: snapshot.context.projectRoot ?? options.cwd, env: options.env, readOnly: true });
|
|
1191
|
+
let session;
|
|
1192
|
+
try {
|
|
1193
|
+
options.signal?.throwIfAborted();
|
|
1194
|
+
session = await createCodexNativeObservationSession({ exactCwd: context.executionCwd, env: context.env,
|
|
1195
|
+
runner: options.nativeCliRunner, probe: { signal: options.signal } });
|
|
1196
|
+
// User reads use only this session's neutral cwd. Project reads add the
|
|
1197
|
+
// exact project snapshot without repeating the same neutral observation.
|
|
1198
|
+
return await readRecoveryStatusInSession({ ...options, codexObservationSession: session }, snapshot);
|
|
1199
|
+
}
|
|
1200
|
+
finally {
|
|
1201
|
+
try {
|
|
1202
|
+
await session?.dispose();
|
|
1203
|
+
}
|
|
1204
|
+
finally {
|
|
1205
|
+
await context.dispose();
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
/** An empty demand or inventory does not establish that the selected Catalog is readable. */
|
|
1210
|
+
async function checkUndeclaredSelection(options, snapshot) {
|
|
1211
|
+
const demands = [snapshot.user, ...(snapshot.project ? [snapshot.project] : [])];
|
|
1212
|
+
const known = new Set(demands.flatMap((demand) => demand.plugins.map((plugin) => plugin.pluginId)));
|
|
1213
|
+
const selectors = (options.plugins ?? []).filter((selector) => ![...known].some((id) => id === selector || !selector.includes('/') && parsePluginId(id).pluginName === selector));
|
|
1214
|
+
if (!selectors.length)
|
|
1215
|
+
return [];
|
|
1216
|
+
const sources = options.catalogSources ?? new Map();
|
|
1217
|
+
for (const source of [options.catalogOperationContext, ...demands.map((demand) => demand.catalogOperationContext)]
|
|
1218
|
+
.flatMap((context) => context?.catalog.sources ?? []))
|
|
1219
|
+
if (!sources.has(source.sourceId))
|
|
1220
|
+
sources.set(source.sourceId, source);
|
|
1221
|
+
const errors = [];
|
|
1222
|
+
try {
|
|
1223
|
+
const config = await readCatalogSourcesConfigSnapshot(options.env);
|
|
1224
|
+
const configured = new Set(config.config.sources.map((source) => source.id));
|
|
1225
|
+
const wanted = new Set(selectors.flatMap((selector) => parsePluginId(selector).sourceId
|
|
1226
|
+
? [parsePluginId(selector).sourceId] : [...configured]));
|
|
1227
|
+
const missing = [...wanted].filter((id) => configured.has(id) && !sources.has(id));
|
|
1228
|
+
if (missing.length) {
|
|
1229
|
+
const context = await resolvePartialCatalogOperationContext({ sourceIds: missing, configSnapshot: config,
|
|
1230
|
+
env: options.env, signal: options.signal }, options.catalogReadScope);
|
|
1231
|
+
for (const source of context.catalog.sources)
|
|
1232
|
+
sources.set(source.sourceId, source);
|
|
1233
|
+
}
|
|
1234
|
+
for (const selector of selectors) {
|
|
1235
|
+
const { sourceId, pluginName } = parsePluginId(selector);
|
|
1236
|
+
const candidates = sourceId ? [sourceId] : [...configured];
|
|
1237
|
+
const code = sourceId && !configured.has(sourceId) ? 'sourceMissing'
|
|
1238
|
+
: candidates.some((id) => !sources.get(id)?.resolution) ? 'sourceActiveUnavailable'
|
|
1239
|
+
: !candidates.some((id) => sources.get(id)?.resolution?.manifest.entries.some((entry) => entry.name === pluginName))
|
|
1240
|
+
? 'pluginUnavailable' : undefined;
|
|
1241
|
+
if (code)
|
|
1242
|
+
errors.push({ code, message: 'The selected plugin or its Catalog source could not be confirmed.',
|
|
1243
|
+
...(sourceId ? { pluginId: selector, subject: { pluginId: selector, sourceId } } : {}) });
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
catch (error) {
|
|
1247
|
+
rethrowFatalError(error);
|
|
1248
|
+
options.signal?.throwIfAborted();
|
|
1249
|
+
errors.push({ code: 'catalogReadFailed', message: 'The selected Catalog source could not be read.' });
|
|
1250
|
+
}
|
|
1251
|
+
return errors;
|
|
1252
|
+
}
|
|
1253
|
+
/** Decide whether a project location can consume the exact User Skills observed this round. */
|
|
1254
|
+
function projectSkillCopy(user, project, userAbsent) {
|
|
1255
|
+
const deployments = project.deploymentObservations;
|
|
1256
|
+
if (!deployments?.length || project.blockers.length)
|
|
1257
|
+
return 'blocked';
|
|
1258
|
+
const userDeployments = user.deploymentObservations ?? [];
|
|
1259
|
+
for (const { after, products } of deployments) {
|
|
1260
|
+
if (!products.every((product) => userDeployments.some((deployment) => deployment.products.some((item) => item.id === product.id))))
|
|
1261
|
+
return 'blocked';
|
|
1262
|
+
if (!userAbsent && project.agent === 'pi' && !userDeployments.some((deployment) => deployment.after.nativeIdentity
|
|
1263
|
+
&& piProjectListsUserSkills(after, deployment.after.nativeIdentity.sourceLocation)))
|
|
1264
|
+
return 'blocked';
|
|
1265
|
+
if (after.configuration?.activation === 'disabled' || after.configuration?.activation === 'unknown'
|
|
1266
|
+
|| after.antigravityLegacyProjectPackage?.state === 'unconfirmed' || after.grokScopeAuthorization === 'denied')
|
|
1267
|
+
return 'blocked';
|
|
1268
|
+
if (after.package === 'present' && after.ownership === 'aw') {
|
|
1269
|
+
// A previous input generation can retire if its own published bytes are still intact.
|
|
1270
|
+
const staleInput = project.content === 'drifted' && project.reasons?.some((reason) => reason.code === 'platformInputDrift' || reason.code === 'antigravityProjectPackageMigrationPending')
|
|
1271
|
+
&& project.reasons.every((reason) => ['platformInputDrift', 'antigravityProjectPackageMigrationPending',
|
|
1272
|
+
'opencodeNativeObservationRequired', INVOCATION_POLICY_NOT_APPLIED].includes(reason.code));
|
|
1273
|
+
if (project.content === 'satisfied' || staleInput)
|
|
1274
|
+
continue;
|
|
1275
|
+
}
|
|
1276
|
+
if (after.package !== 'absent' || after.ownership !== 'absent')
|
|
1277
|
+
return 'blocked';
|
|
1278
|
+
if (project.agent === 'pi') {
|
|
1279
|
+
const hiddenSection = after.registration === 'unknown' && after.diagnostics.some((entry) => entry.code === 'piProjectRegistrationNotVisible');
|
|
1280
|
+
if ((!hiddenSection && after.registration !== 'absent') || after.configuration?.activation !== 'absent')
|
|
1281
|
+
return 'blocked';
|
|
1282
|
+
}
|
|
1283
|
+
if (!userAbsent && project.agent === 'grok') {
|
|
1284
|
+
const name = after.nativeIdentity?.packageId;
|
|
1285
|
+
const native = after.prerequisites.nativeSources;
|
|
1286
|
+
const sources = native?.sources.filter((source) => source.name === name);
|
|
1287
|
+
const personal = user.deploymentObservations?.flatMap(({ after }) => after.prerequisites.nativeSources?.sources ?? [])
|
|
1288
|
+
.find((source) => source.name === name && source.scope === 'user' && source.enabled && source.origin === 'native');
|
|
1289
|
+
if (after.grokScopeAuthorization !== 'granted' || native?.observation !== 'complete' || !personal || sources?.length !== 1
|
|
1290
|
+
|| sources[0].scope !== 'user' || !sources[0].enabled || sources[0].path !== personal.path
|
|
1291
|
+
|| !user.installedComponentIds?.every((id) => sources[0].effectiveComponents.includes(id.replace(/^skill:/u, 'skills:'))))
|
|
1292
|
+
return 'blocked';
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
return deployments.some(({ after }) => after.package === 'present' || after.antigravityLegacyProjectPackage?.state === 'owned') ? 'owned' : 'absent';
|
|
1296
|
+
}
|
|
1297
|
+
async function readRecoveryStatusInSession(options, snapshot) {
|
|
1298
|
+
const selectionErrors = await checkUndeclaredSelection(options, snapshot);
|
|
1299
|
+
const requestedDemand = options.targets ? { ...snapshot, preferences: snapshot.preferences
|
|
1300
|
+
? { ...snapshot.preferences, targets: [...new Set([...snapshot.preferences.targets, ...options.targets])] } : null } : snapshot;
|
|
1301
|
+
let globalPlan = deriveJointDemand(snapshot);
|
|
1302
|
+
let plan = requestedDemand === snapshot ? globalPlan : deriveJointDemand(requestedDemand);
|
|
1303
|
+
const matchesPlugin = (id) => !options.plugins?.length || options.plugins.some((selector) => selector === id || !selector.includes('/') && parsePluginId(id).pluginName === selector);
|
|
1304
|
+
const selected = Boolean(options.plugins?.length || options.targets);
|
|
1305
|
+
const observationPlugins = options.plugins?.length ? new Set(plan.placements.filter((item) => matchesPlugin(item.pluginId)
|
|
1306
|
+
|| item.contributions.some((contribution) => matchesPlugin(contribution.root))).map((item) => item.pluginId)) : undefined;
|
|
1307
|
+
if (observationPlugins) {
|
|
1308
|
+
const plugins = [...new Map([snapshot.user, ...(snapshot.project ? [snapshot.project] : [])]
|
|
1309
|
+
.flatMap((demand) => demand.plugins).map((plugin) => [plugin.pluginId, plugin])).values()];
|
|
1310
|
+
for (const id of observationPlugins) {
|
|
1311
|
+
const plugin = plugins.find((entry) => entry.pluginId === id);
|
|
1312
|
+
if (!plugin)
|
|
1313
|
+
continue;
|
|
1314
|
+
for (const dependency of plugin.manifest.dependencies ?? [])
|
|
1315
|
+
observationPlugins.add(`${plugin.sourceId}/${dependency}`);
|
|
1316
|
+
const slots = new Set(plugin.manifest.extensions?.agents?.map((agent) => agent.name) ?? []);
|
|
1317
|
+
for (const candidate of plugins)
|
|
1318
|
+
if (candidate.manifest.extensions?.agents?.some((agent) => slots.has(agent.name))) {
|
|
1319
|
+
observationPlugins.add(candidate.pluginId);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
if (observationPlugins)
|
|
1324
|
+
for (const plugin of options.plugins ?? [])
|
|
1325
|
+
observationPlugins.add(plugin);
|
|
1326
|
+
const selectedPlacement = (item) => (!options.targets || options.targets.includes(item.target)) && (!observationPlugins || observationPlugins.has(item.pluginId));
|
|
1327
|
+
const candidates = [...new Map([...projectSkillCandidates(plan), ...(options.projectSkillProbes ?? [])]
|
|
1328
|
+
.filter(selectedPlacement).map((item) => [`${item.pluginId}\0${item.target}`, item])).values()];
|
|
1329
|
+
const scopes = [snapshot.user, ...(snapshot.project ? [snapshot.project] : [])];
|
|
1330
|
+
const observed = [];
|
|
1331
|
+
// Scope order gives User discovery the neutral cwd before equivalent Project
|
|
1332
|
+
// probes reuse it. Codex also shares a mutable manager and neutral inventory.
|
|
1333
|
+
for (const demand of scopes) {
|
|
1334
|
+
const nodes = [...plan.placements, ...(options.projectSkillProbes ?? [])].filter((item) => selectedPlacement(item) && (item.scope === demand.scope
|
|
1335
|
+
|| demand.scope === 'project' && ['codex', 'claude', 'copilot'].includes(item.target)
|
|
1336
|
+
&& item.contributions.some((contribution) => contribution.scope === 'project')));
|
|
1337
|
+
const expanded = { ...demand,
|
|
1338
|
+
plugins: [...new Map([...demand.plugins, ...nodes.map((item) => item.plugin)]
|
|
1339
|
+
.map((plugin) => [plugin.pluginId, plugin])).values()],
|
|
1340
|
+
catalogOperationContext: demand.catalogOperationContext ?? snapshot.user.catalogOperationContext
|
|
1341
|
+
?? snapshot.project?.catalogOperationContext,
|
|
1342
|
+
userProviders: demand.scope === 'project' ? Object.fromEntries((snapshot.preferences?.targets ?? []).map((target) => [target,
|
|
1343
|
+
plan.placements.filter((item) => item.scope === 'user' && item.target === target
|
|
1344
|
+
&& !nodes.some((project) => project.scope === 'project' && project.pluginId === item.pluginId && project.target === item.target)).map((item) => item.pluginId)])) : {},
|
|
1345
|
+
targetRequirements: nodes.map((item) => ({ pluginId: item.pluginId, target: item.target,
|
|
1346
|
+
...(item.scope === 'user' && demand.scope === 'project' ? { inheritsUserNative: true } : {}) })),
|
|
1347
|
+
roots: demand.roots === null ? null : [...new Map(nodes.map((item) => [item.pluginId, {
|
|
1348
|
+
pluginId: item.pluginId, sourceId: item.plugin.sourceId, sourceState: 'ready',
|
|
1349
|
+
blockers: [], plugin: item.plugin,
|
|
1350
|
+
}])).values()] };
|
|
1351
|
+
observed.push(await readScopedRecoveryStatus({ ...options, onNativeStatus: undefined, scope: demand.scope,
|
|
1352
|
+
cwd: snapshot.context.projectRoot ?? options.cwd, observationPlugins, targets: options.targets, demandOverride: expanded }));
|
|
1353
|
+
}
|
|
1354
|
+
const scopedTargets = observed.flatMap((status) => status.inventory?.flatMap((item) => item.targetResults) ?? []);
|
|
1355
|
+
const skillProviders = candidates.flatMap((candidate) => {
|
|
1356
|
+
const matches = (target) => target.pluginId === candidate.pluginId && target.agent === candidate.target;
|
|
1357
|
+
const user = scopedTargets.find((target) => matches(target) && target.scope === 'user');
|
|
1358
|
+
const project = scopedTargets.find((target) => matches(target) && target.scope === 'project');
|
|
1359
|
+
if (!user || !project)
|
|
1360
|
+
return [];
|
|
1361
|
+
const absent = user.deploymentObservations?.length && user.deploymentObservations.every(({ after }) => after.package === 'absent' && after.ownership === 'absent' && (after.registration === 'absent' || after.registration === 'not-applicable'));
|
|
1362
|
+
return [{ pluginId: candidate.pluginId, target: candidate.target, sourceIdentity: candidate.plugin.sourceIdentity,
|
|
1363
|
+
projectCopy: projectSkillCopy(user, project, !!absent), userAbsent: !!absent, userNeedsRepair: !absent && !isInstalledSkillProvider(user) }];
|
|
1364
|
+
});
|
|
1365
|
+
if (skillProviders.length) {
|
|
1366
|
+
globalPlan = deriveJointDemand(snapshot, skillProviders);
|
|
1367
|
+
plan = requestedDemand === snapshot ? globalPlan : deriveJointDemand(requestedDemand, skillProviders);
|
|
1368
|
+
}
|
|
1369
|
+
const allTargets = scopedTargets.flatMap((target) => {
|
|
1370
|
+
const providers = plan.placements.filter((placement) => placement.pluginId === target.pluginId && placement.target === target.agent
|
|
1371
|
+
&& (placement.scope === target.scope || target.scope === 'project'
|
|
1372
|
+
&& ['codex', 'claude', 'copilot'].includes(target.agent) && placement.scope === 'user'
|
|
1373
|
+
&& placement.contributions.some((entry) => entry.scope === 'project')));
|
|
1374
|
+
if (!providers.length)
|
|
1375
|
+
return [];
|
|
1376
|
+
const contributions = providers.flatMap((provider) => provider.contributions
|
|
1377
|
+
.filter((entry) => provider.scope === target.scope || entry.scope === target.scope));
|
|
1378
|
+
return { ...target, contributions: contributions.map((entry) => ({ root: entry.root, scope: entry.scope, path: [...entry.path] })),
|
|
1379
|
+
requiredBy: [...new Set(contributions.map((entry) => entry.root))], providerScope: providers[0]?.scope,
|
|
1380
|
+
relation: contributions.some((entry) => entry.path.length === 1 && entry.scope === target.scope) ? 'root' : 'dependency' };
|
|
1381
|
+
});
|
|
1382
|
+
const inventory = scopes.some((demand) => demand.roots !== null) ? [] : null;
|
|
1383
|
+
const expected = new Set(plan.placements.map((item) => `${item.pluginId}\0${item.target}\0${item.scope}`));
|
|
1384
|
+
const surplusSkills = scopedTargets.filter((target) => target.scope === 'project'
|
|
1385
|
+
&& !expected.has(`${target.pluginId}\0${target.agent}\0project`)
|
|
1386
|
+
&& skillProviders.some((provider) => provider.projectCopy === 'owned' && !provider.userAbsent && !provider.userNeedsRepair
|
|
1387
|
+
&& provider.pluginId === target.pluginId && provider.target === target.agent))
|
|
1388
|
+
.map((target) => ({ ...target, reasons: [{ code: 'projectSkillDuplicatePending', pluginId: target.pluginId,
|
|
1389
|
+
subject: { pluginId: target.pluginId, target: target.agent, scope: target.scope },
|
|
1390
|
+
message: 'Sync the Project plugin to remove the previous copy of its User Skill dependency.' }] }));
|
|
1391
|
+
const visibleInventory = [];
|
|
1392
|
+
for (const demand of scopes)
|
|
1393
|
+
for (const root of demand.roots ?? []) {
|
|
1394
|
+
const targetResults = [];
|
|
1395
|
+
for (const requirement of plan.roots.filter((entry) => entry.scope === demand.scope && entry.pluginId === root.pluginId)) {
|
|
1396
|
+
const placement = plan.placements.find((item) => item.pluginId === root.pluginId && item.target === requirement.target
|
|
1397
|
+
&& item.contributions.some((contribution) => contribution.scope === demand.scope && contribution.root === root.pluginId));
|
|
1398
|
+
const target = { pluginId: root.pluginId, agent: requirement.target, scope: demand.scope,
|
|
1399
|
+
requirementScope: demand.scope, providerScope: placement?.scope,
|
|
1400
|
+
delivery: root.plugin ? resolveDelivery(root.plugin.manifest, requirement.target, demand.scope) ?? null : null,
|
|
1401
|
+
execution: 'not-run', observation: 'unknown', content: 'unknown', requiredBy: [root.pluginId], relation: 'root',
|
|
1402
|
+
...(root.plugin?.manifest.version ? { expectedVersion: root.plugin.manifest.version } : {}), blockers: [...requirement.blockers] };
|
|
1403
|
+
if (requirement.state === 'excluded' || requirement.state === 'unsupported') {
|
|
1404
|
+
target.satisfaction = requirement.state;
|
|
1405
|
+
target.content = 'satisfied';
|
|
1406
|
+
target.observation = 'verified';
|
|
1407
|
+
if (requirement.reasons?.length)
|
|
1408
|
+
target.reasons = requirement.reasons;
|
|
1409
|
+
}
|
|
1410
|
+
else if (requirement.state === 'required') {
|
|
1411
|
+
const providers = requirement.dependencies.map((id) => {
|
|
1412
|
+
const provider = plan.placements.find((item) => item.pluginId === id && item.target === requirement.target
|
|
1413
|
+
&& item.contributions.some((contribution) => contribution.scope === demand.scope && contribution.root === root.pluginId));
|
|
1414
|
+
if (!provider)
|
|
1415
|
+
return undefined;
|
|
1416
|
+
// These observations check the same physical package and the demand's own effective scope.
|
|
1417
|
+
const scope = hasSharedUserPackage(requirement.target) ? demand.scope : provider.scope;
|
|
1418
|
+
return allTargets.find((item) => item.pluginId === id && item.agent === requirement.target && item.scope === scope);
|
|
1419
|
+
});
|
|
1420
|
+
const ownProvider = providers.find((provider) => provider?.pluginId === root.pluginId);
|
|
1421
|
+
if (ownProvider?.installedComponentIds)
|
|
1422
|
+
target.installedComponentIds = ownProvider.installedComponentIds;
|
|
1423
|
+
if (ownProvider?.installedComponentCount !== undefined)
|
|
1424
|
+
target.installedComponentCount = ownProvider.installedComponentCount;
|
|
1425
|
+
if (ownProvider?.installedVersion)
|
|
1426
|
+
target.installedVersion = ownProvider.installedVersion;
|
|
1427
|
+
target.blockers.push(...providers.flatMap((item) => item?.blockers ?? []));
|
|
1428
|
+
const reasons = providers.flatMap((item) => item?.reasons ?? []);
|
|
1429
|
+
if (demand.scope === 'project') {
|
|
1430
|
+
for (const copy of surplusSkills) {
|
|
1431
|
+
if (copy.agent !== requirement.target || !requirement.dependencies.includes(copy.pluginId))
|
|
1432
|
+
continue;
|
|
1433
|
+
reasons.push(...copy.reasons);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
if (reasons.length)
|
|
1437
|
+
target.reasons = reasons;
|
|
1438
|
+
const componentGaps = providers.flatMap((item) => item?.componentGaps ?? []);
|
|
1439
|
+
if (componentGaps.length)
|
|
1440
|
+
target.componentGaps = uniqueRecoveryComponentGaps(componentGaps);
|
|
1441
|
+
const exclusions = providers.flatMap((item) => item?.deploymentExclusions ?? []);
|
|
1442
|
+
if (exclusions.length)
|
|
1443
|
+
target.deploymentExclusions = [...new Map(exclusions.map((exclusion) => [JSON.stringify([exclusion.pluginId, exclusion.platform, exclusion.scope, exclusion.productId, exclusion.reasonCode]), exclusion])).values()];
|
|
1444
|
+
const deployments = providers.flatMap((item) => item?.deploymentObservations ?? []);
|
|
1445
|
+
if (deployments.length)
|
|
1446
|
+
target.deploymentObservations = [...new Map(deployments.map((item) => [item.bindingId, item])).values()];
|
|
1447
|
+
target.content = ['conflict', 'drifted', 'absent', 'unknown'].find((state) => providers.some((item) => (item?.content ?? 'unknown') === state)) ?? 'satisfied';
|
|
1448
|
+
target.observation = target.content === 'satisfied' ? 'verified' : target.content === 'absent' ? 'missing' : 'unknown';
|
|
1449
|
+
target.satisfaction = observedSatisfaction(target.content, ownProvider, demand.scope === 'project' && placement?.scope === 'user');
|
|
1450
|
+
target.backend = providers.map((provider) => ({ pluginId: provider?.pluginId, scope: provider?.scope, content: provider?.content, live: provider?.backend }));
|
|
1451
|
+
}
|
|
1452
|
+
targetResults.push(target);
|
|
1453
|
+
}
|
|
1454
|
+
visibleInventory.push({ pluginId: root.pluginId, source: root.sourceId, sourceState: root.sourceState,
|
|
1455
|
+
blockers: root.blockers.map(diagnostic), targetResults });
|
|
1456
|
+
}
|
|
1457
|
+
const extraObserved = [...observed.flatMap((status) => status.extraObserved), ...surplusSkills]
|
|
1458
|
+
.filter((item) => !expected.has(`${item.pluginId}\0${item.agent}\0${item.scope}`));
|
|
1459
|
+
const targets = visibleInventory.flatMap((item) => item.targetResults);
|
|
1460
|
+
const globalTargets = targets.filter((target) => globalPlan.roots.some((root) => root.pluginId === target.pluginId && root.target === target.agent && root.scope === target.scope));
|
|
1461
|
+
const fullObservation = !selected || globalPlan.placements.every(selectedPlacement);
|
|
1462
|
+
const knownFailure = globalPlan.errors.some((error) => ['targetsNotConfigured', 'dependencyExcluded', 'dependencyContractInvalid', 'targetPlacementConflict', 'projectSkillProviderConflict', 'userSkillProviderNotReady'].includes(error.code))
|
|
1463
|
+
|| globalTargets.some((target) => ['absent', 'drifted', 'conflict'].includes(target.content ?? 'unknown')
|
|
1464
|
+
|| target.blockers.some((entry) => entry.code === 'awCapabilityUnsupported'));
|
|
1465
|
+
const uncertain = !fullObservation || !globalPlan.complete || globalTargets.some((target) => target.content === 'unknown' || target.blockers.length > 0);
|
|
1466
|
+
const allSatisfied = knownFailure ? false : uncertain ? null : true;
|
|
1467
|
+
const nativeCoverage = !selected && observed.every((status) => status.coverage.native);
|
|
1468
|
+
const portableCoverage = !selected && observed.every((status) => status.coverage.portable);
|
|
1469
|
+
const errors = [...new Map([...selectionErrors, ...plan.errors.filter((error) => !selected || !error.pluginId
|
|
1470
|
+
|| !observationPlugins || observationPlugins.has(error.pluginId)), ...observed.flatMap((status) => status.errors)]
|
|
1471
|
+
.map((error) => [JSON.stringify(error), error])).values()];
|
|
1472
|
+
const result = { schemaVersion: 1, kind: 'aw-recovery-status', scope: snapshot.context.context, ok: errors.length === 0,
|
|
1473
|
+
intent: { state: scopes.some((demand) => demand.intent.state === 'invalid') ? 'invalid'
|
|
1474
|
+
: scopes.some((demand) => demand.intent.state === 'unreadable') ? 'unreadable'
|
|
1475
|
+
: scopes.some((demand) => demand.intent.state === 'unsupported-version') ? 'unsupported-version'
|
|
1476
|
+
: scopes.some((demand) => demand.intent.state === 'valid') ? 'valid' : 'absent' },
|
|
1477
|
+
selection: { agents: snapshot.preferences?.targets ?? [], origin: snapshot.preferences?.targets.length ? 'preference' : 'none', preferences: snapshot.user.preferences.state },
|
|
1478
|
+
inventory: inventory === null ? null : visibleInventory, extraObserved, observedTargets: allTargets, projectSkillProviders: skillProviders,
|
|
1479
|
+
existingTargets: observed.flatMap((status) => status.existingTargets ?? []), ownedTargets: observed.flatMap((status) => status.ownedTargets ?? []),
|
|
1480
|
+
retainedProjectPackages: observed.flatMap((status) => status.retainedProjectPackages ?? []),
|
|
1481
|
+
coverage: { native: nativeCoverage, portable: portableCoverage, scopes: snapshot.context.scopes,
|
|
1482
|
+
...(snapshot.context.projectRoot ? { projectRoot: snapshot.context.projectRoot } : {}) },
|
|
1483
|
+
counts: { blocked: targets.filter((target) => target.blockers.length).length,
|
|
1484
|
+
pending: targets.filter((target) => target.satisfaction === 'pending').length,
|
|
1485
|
+
unconfirmed: targets.filter((target) => target.content === 'unknown').length,
|
|
1486
|
+
ready: targets.filter((target) => target.content === 'satisfied').length },
|
|
1487
|
+
allSatisfied, inSync: aggregateConvergence(allSatisfied, extraObserved.length ? 'present' : nativeCoverage && portableCoverage ? 'absent' : 'unknown'), errors };
|
|
1488
|
+
if (options.plugins?.length) {
|
|
1489
|
+
for (const target of allTargets.filter((target) => matchesPlugin(target.pluginId))) {
|
|
1490
|
+
if (visibleInventory.some((entry) => entry.pluginId === target.pluginId))
|
|
1491
|
+
continue;
|
|
1492
|
+
visibleInventory.push({ pluginId: target.pluginId, source: parsePluginId(target.pluginId).sourceId, sourceState: 'ready', blockers: [],
|
|
1493
|
+
targetResults: allTargets.filter((entry) => entry.pluginId === target.pluginId).map((entry) => ({ ...entry,
|
|
1494
|
+
requirementScope: entry.contributions?.[0]?.scope,
|
|
1495
|
+
satisfaction: observedSatisfaction(entry.content, entry, entry.scope === 'user' && entry.contributions.some((contribution) => contribution.scope === 'project')) })) });
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
if (selected) {
|
|
1499
|
+
result.inventory = result.inventory?.filter((entry) => matchesPlugin(entry.pluginId)).map((entry) => ({ ...entry,
|
|
1500
|
+
targetResults: entry.targetResults.filter((target) => !options.targets || options.targets.includes(target.agent)) })) ?? null;
|
|
1501
|
+
const requested = result.inventory?.flatMap((entry) => entry.targetResults) ?? [];
|
|
1502
|
+
result.coverage.requestComplete = observed.every((status) => status.coverage.requestComplete ?? (status.coverage.native && status.coverage.portable))
|
|
1503
|
+
&& result.errors.length === 0 && result.inventory !== null
|
|
1504
|
+
&& result.inventory.every((entry) => entry.sourceState === 'ready' && entry.blockers.length === 0)
|
|
1505
|
+
&& allTargets.every((target) => target.content !== 'unknown'
|
|
1506
|
+
&& target.blockers.every((blocker) => blocker.code === 'needs-preparation' && ['absent', 'drifted'].includes(target.content ?? '')))
|
|
1507
|
+
&& requested.every((target) => target.content !== 'unknown');
|
|
1508
|
+
result.counts = { blocked: requested.filter((target) => target.blockers.length).length,
|
|
1509
|
+
pending: requested.filter((target) => target.satisfaction === 'pending').length,
|
|
1510
|
+
unconfirmed: requested.filter((target) => target.content === 'unknown').length,
|
|
1511
|
+
ready: requested.filter((target) => target.content === 'satisfied').length };
|
|
1512
|
+
}
|
|
1513
|
+
await options.onNativeStatus?.(result, snapshot.context.context === 'project' ? snapshot.project : snapshot.user);
|
|
1514
|
+
options.signal?.throwIfAborted();
|
|
1515
|
+
return result;
|
|
1516
|
+
}
|
|
1517
|
+
//# sourceMappingURL=status.js.map
|