@lesliechan721/aw 0.1.0-beta.8 → 0.1.0-beta.81
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/scripts/add-skill.mjs +17 -40
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +74 -98
- 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 +79 -92
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +103 -127
- package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs +2 -2
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +490 -2841
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-skill.mjs +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 +30 -0
- package/dist/scripts/aw-skill-eval-materializer.js +278 -0
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -0
- package/dist/scripts/bundle-plugins.d.ts +1 -0
- package/dist/scripts/bundle-plugins.js +27 -8
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.d.ts +7 -8
- package/dist/scripts/plugin-staging.js +16 -15
- 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 +273 -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 +5 -1
- 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 +2 -2
- package/dist/src/commands/aw-capabilities.js +41 -29
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/catalog-dev-source.d.ts +58 -13
- package/dist/src/commands/catalog-dev-source.js +549 -305
- package/dist/src/commands/catalog-dev-source.js.map +1 -1
- package/dist/src/commands/catalog-generation.d.ts +14 -19
- package/dist/src/commands/catalog-generation.js +5 -10
- package/dist/src/commands/catalog-generation.js.map +1 -1
- package/dist/src/commands/catalog-publication-inspection.d.ts +70 -30
- package/dist/src/commands/catalog-publication-inspection.js +511 -91
- package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
- package/dist/src/commands/catalog-publication-journal.d.ts +68 -0
- package/dist/src/commands/catalog-publication-journal.js +292 -0
- package/dist/src/commands/catalog-publication-journal.js.map +1 -0
- package/dist/src/commands/catalog-publication-target.d.ts +2 -1
- package/dist/src/commands/catalog-publication-target.js +37 -2
- package/dist/src/commands/catalog-publication-target.js.map +1 -1
- package/dist/src/commands/catalog-publish.d.ts +82 -15
- package/dist/src/commands/catalog-publish.js +722 -219
- package/dist/src/commands/catalog-publish.js.map +1 -1
- package/dist/src/commands/catalog-source.d.ts +55 -35
- package/dist/src/commands/catalog-source.js +298 -148
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/catalog-status.d.ts +6 -26
- package/dist/src/commands/catalog-status.js +9 -147
- 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 +17 -0
- package/dist/src/commands/catalog-workspace-resolution.js +57 -0
- package/dist/src/commands/catalog-workspace-resolution.js.map +1 -0
- package/dist/src/commands/console.js +32 -20
- package/dist/src/commands/console.js.map +1 -1
- package/dist/src/commands/dependency-operation-plan.d.ts +52 -15
- package/dist/src/commands/dependency-operation-plan.js +289 -7
- package/dist/src/commands/dependency-operation-plan.js.map +1 -1
- package/dist/src/commands/deployment-confirmation.d.ts +4 -0
- package/dist/src/commands/deployment-confirmation.js +20 -0
- package/dist/src/commands/deployment-confirmation.js.map +1 -0
- package/dist/src/commands/init.d.ts +5 -11
- package/dist/src/commands/init.js +30 -51
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/intent-command.d.ts +32 -0
- package/dist/src/commands/intent-command.js +171 -0
- package/dist/src/commands/intent-command.js.map +1 -0
- package/dist/src/commands/managed-commands.d.ts +35 -0
- package/dist/src/commands/managed-commands.js +361 -0
- package/dist/src/commands/managed-commands.js.map +1 -0
- package/dist/src/commands/offline-cleanup-evidence.d.ts +46 -0
- package/dist/src/commands/offline-cleanup-evidence.js +158 -10
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
- package/dist/src/commands/operation-plan.d.ts +190 -0
- package/dist/src/commands/operation-plan.js +99 -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 +16 -20
- package/dist/src/commands/options.js +94 -41
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +88 -45
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-config-confirmation.d.ts +8 -0
- package/dist/src/commands/public-config-confirmation.js +56 -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 +102 -0
- package/dist/src/commands/public-lifecycle-result.js +307 -0
- package/dist/src/commands/public-lifecycle-result.js.map +1 -0
- package/dist/src/commands/public-lifecycle.d.ts +28 -0
- package/dist/src/commands/public-lifecycle.js +492 -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 +193 -0
- package/dist/src/commands/public-plugin-query.js.map +1 -0
- package/dist/src/commands/rebuild-command.d.ts +166 -28
- package/dist/src/commands/rebuild-command.js +3745 -813
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +137 -25
- package/dist/src/commands/rebuild-integration.js +1343 -2535
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +73 -22
- package/dist/src/commands/rebuild-operations.js +313 -216
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +62 -0
- package/dist/src/commands/rebuild-platform-integration.js +1317 -0
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
- package/dist/src/commands/reconcile-operation-plan.d.ts +28 -0
- package/dist/src/commands/reconcile-operation-plan.js +47 -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 +41 -0
- package/dist/src/commands/skill-eval.js +407 -0
- package/dist/src/commands/skill-eval.js.map +1 -0
- package/dist/src/commands/status-v6.d.ts +319 -0
- package/dist/src/commands/status-v6.js +2979 -0
- package/dist/src/commands/status-v6.js.map +1 -0
- 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 +143 -85
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/constants.d.ts +6 -6
- package/dist/src/constants.js +6 -6
- package/dist/src/constants.js.map +1 -1
- package/dist/src/eval/manifest-v1.d.ts +70 -0
- package/dist/src/eval/manifest-v1.js +358 -0
- package/dist/src/eval/manifest-v1.js.map +1 -0
- package/dist/src/generators/local-plugin.d.ts +7 -2
- package/dist/src/generators/local-plugin.js +313 -389
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/generators/permissions.d.ts +5 -2
- package/dist/src/generators/permissions.js +28 -15
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.d.ts +2 -31
- package/dist/src/index.js +1666 -1827
- 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 +33 -0
- package/dist/src/intent/scope-context.js +149 -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 +47 -46
- package/dist/src/output/command-receipt.js +286 -79
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/model.d.ts +3 -11
- package/dist/src/output/native-consent.d.ts +2 -0
- package/dist/src/output/native-consent.js +5 -0
- package/dist/src/output/native-consent.js.map +1 -0
- package/dist/src/output/public-result.d.ts +49 -0
- package/dist/src/output/public-result.js +240 -0
- package/dist/src/output/public-result.js.map +1 -0
- package/dist/src/output/rebuild-progress.js +20 -15
- 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 +592 -0
- package/dist/src/output/receipt-projection.js.map +1 -0
- package/dist/src/platforms/capabilities.d.ts +12 -0
- package/dist/src/platforms/capabilities.js +205 -0
- package/dist/src/platforms/capabilities.js.map +1 -0
- package/dist/src/platforms/contracts.d.ts +358 -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 +91 -0
- package/dist/src/platforms/discovery.js +653 -0
- package/dist/src/platforms/discovery.js.map +1 -0
- package/dist/src/platforms/gemini-activation.d.ts +36 -0
- package/dist/src/platforms/gemini-activation.js +331 -0
- package/dist/src/platforms/gemini-activation.js.map +1 -0
- package/dist/src/platforms/gemini-consent.d.ts +8 -0
- package/dist/src/platforms/gemini-consent.js +81 -0
- package/dist/src/platforms/gemini-consent.js.map +1 -0
- package/dist/src/platforms/identity.d.ts +4 -0
- package/dist/src/platforms/identity.js +22 -0
- package/dist/src/platforms/identity.js.map +1 -0
- package/dist/src/platforms/inspection-grok.d.ts +4 -0
- package/dist/src/platforms/inspection-grok.js +212 -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 +406 -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 +3 -0
- package/dist/src/platforms/inspection-pi.js +282 -0
- package/dist/src/platforms/inspection-pi.js.map +1 -0
- package/dist/src/platforms/inspection-query.d.ts +12 -0
- package/dist/src/platforms/inspection-query.js +96 -0
- package/dist/src/platforms/inspection-query.js.map +1 -0
- package/dist/src/platforms/inspection.d.ts +17 -0
- package/dist/src/platforms/inspection.js +227 -0
- package/dist/src/platforms/inspection.js.map +1 -0
- package/dist/src/platforms/layout.d.ts +21 -0
- package/dist/src/platforms/layout.js +239 -0
- package/dist/src/platforms/layout.js.map +1 -0
- package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
- package/dist/src/platforms/lifecycle-native-services.js +147 -0
- package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
- package/dist/src/platforms/lifecycle-native.d.ts +13 -0
- package/dist/src/platforms/lifecycle-native.js +283 -0
- package/dist/src/platforms/lifecycle-native.js.map +1 -0
- package/dist/src/platforms/lifecycle.d.ts +25 -0
- package/dist/src/platforms/lifecycle.js +494 -0
- package/dist/src/platforms/lifecycle.js.map +1 -0
- package/dist/src/platforms/managed-command-placement.d.ts +8 -0
- package/dist/src/platforms/managed-command-placement.js +79 -0
- package/dist/src/platforms/managed-command-placement.js.map +1 -0
- package/dist/src/platforms/projection-code-extension.d.ts +8 -0
- package/dist/src/platforms/projection-code-extension.js +121 -0
- package/dist/src/platforms/projection-code-extension.js.map +1 -0
- package/dist/src/platforms/projection-command-resources.d.ts +7 -0
- package/dist/src/platforms/projection-command-resources.js +74 -0
- package/dist/src/platforms/projection-command-resources.js.map +1 -0
- package/dist/src/platforms/projection-files.d.ts +27 -0
- package/dist/src/platforms/projection-files.js +111 -0
- package/dist/src/platforms/projection-files.js.map +1 -0
- package/dist/src/platforms/projection-marketplace.d.ts +19 -0
- package/dist/src/platforms/projection-marketplace.js +42 -0
- package/dist/src/platforms/projection-marketplace.js.map +1 -0
- package/dist/src/platforms/projection.d.ts +10 -0
- package/dist/src/platforms/projection.js +446 -0
- package/dist/src/platforms/projection.js.map +1 -0
- package/dist/src/platforms/registry.d.ts +4 -0
- package/dist/src/platforms/registry.js +30 -0
- package/dist/src/platforms/registry.js.map +1 -0
- package/dist/src/platforms/supplement-layout.d.ts +16 -0
- package/dist/src/platforms/supplement-layout.js +31 -0
- package/dist/src/platforms/supplement-layout.js.map +1 -0
- package/dist/src/platforms/supplement-state.d.ts +13 -0
- package/dist/src/platforms/supplement-state.js +82 -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 +94 -350
- 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 +24 -4
- package/dist/src/portable/materializer.js +189 -259
- 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 +153 -0
- package/dist/src/portable/recovery.js +367 -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 +141 -0
- package/dist/src/recovery/coordinator.js +1254 -0
- package/dist/src/recovery/coordinator.js.map +1 -0
- package/dist/src/recovery/demand.d.ts +51 -0
- package/dist/src/recovery/demand.js +159 -0
- package/dist/src/recovery/demand.js.map +1 -0
- package/dist/src/recovery/joint-coordinator.d.ts +25 -0
- package/dist/src/recovery/joint-coordinator.js +991 -0
- package/dist/src/recovery/joint-coordinator.js.map +1 -0
- package/dist/src/recovery/joint-demand.d.ts +50 -0
- package/dist/src/recovery/joint-demand.js +197 -0
- package/dist/src/recovery/joint-demand.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 +98 -0
- package/dist/src/recovery/receipt.js +2 -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 +469 -0
- package/dist/src/recovery/retirement.js.map +1 -0
- package/dist/src/recovery/status.d.ts +126 -0
- package/dist/src/recovery/status.js +1073 -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 +43 -0
- package/dist/src/review/eval-source-input.js +207 -0
- package/dist/src/review/eval-source-input.js.map +1 -0
- package/dist/src/review/platform-profile.d.ts +3 -0
- package/dist/src/review/platform-profile.js +14 -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 +495 -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 +62 -0
- package/dist/src/review/skill-materialization.js +205 -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 +773 -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 +18 -53
- package/dist/src/tui/catalog-generation.js +136 -224
- 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 -36
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/config-array-draft.d.ts +29 -0
- package/dist/src/tui/config-array-draft.js +48 -0
- package/dist/src/tui/config-array-draft.js.map +1 -0
- package/dist/src/tui/config-leaf-editor.d.ts +43 -0
- package/dist/src/tui/config-leaf-editor.js +224 -0
- package/dist/src/tui/config-leaf-editor.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-value-presentation.d.ts +20 -0
- package/dist/src/tui/config-value-presentation.js +104 -0
- package/dist/src/tui/config-value-presentation.js.map +1 -0
- package/dist/src/tui/console-app-v4.d.ts +13 -4
- package/dist/src/tui/console-app-v4.js +9764 -2210
- 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 +7 -4
- package/dist/src/tui/controller-runtime.js +2064 -779
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +669 -106
- package/dist/src/tui/controller.js +3617 -971
- 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 +10 -0
- package/dist/src/tui/deployment-view.js +108 -0
- package/dist/src/tui/deployment-view.js.map +1 -0
- package/dist/src/tui/diagnostic-projection.d.ts +23 -0
- package/dist/src/tui/diagnostic-projection.js +595 -0
- package/dist/src/tui/diagnostic-projection.js.map +1 -0
- package/dist/src/tui/diagnostics.d.ts +6 -3
- 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 +55 -0
- package/dist/src/tui/entity-cards.js +298 -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 +72 -0
- package/dist/src/tui/glossary.js.map +1 -0
- package/dist/src/tui/index.d.ts +6 -2
- package/dist/src/tui/index.js +5 -2
- 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 +243 -45
- package/dist/src/tui/model.js +1402 -415
- 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 +72 -0
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
- package/dist/src/tui/operation-history.d.ts +82 -0
- package/dist/src/tui/operation-history.js +136 -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 +1396 -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 +72 -0
- package/dist/src/tui/plugin-detail.js +260 -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 +186 -35
- 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 +45 -0
- package/dist/src/tui/scoped-flow.js +96 -0
- package/dist/src/tui/scoped-flow.js.map +1 -0
- package/dist/src/tui/scoped-inventory.d.ts +126 -0
- package/dist/src/tui/scoped-inventory.js +258 -0
- package/dist/src/tui/scoped-inventory.js.map +1 -0
- package/dist/src/tui/screen-registry.d.ts +701 -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 +6 -0
- package/dist/src/tui/session-console-app.js +13 -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 +220 -118
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/agent-version.d.ts +13 -4
- package/dist/src/utils/agent-version.js +27 -4
- package/dist/src/utils/agent-version.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +33 -7
- package/dist/src/utils/artifact-plan.js +115 -430
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +114 -83
- package/dist/src/utils/artifact-renderer.js +213 -364
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +44 -0
- package/dist/src/utils/artifact-request.js +80 -0
- package/dist/src/utils/artifact-request.js.map +1 -0
- package/dist/src/utils/artifact-sources.d.ts +6 -2
- package/dist/src/utils/artifact-sources.js +17 -0
- package/dist/src/utils/artifact-sources.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +57 -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 -2
- package/dist/src/utils/catalog-digests.js +7 -18
- package/dist/src/utils/catalog-digests.js.map +1 -1
- package/dist/src/utils/catalog-generation-control-snapshot.d.ts +11 -0
- package/dist/src/utils/catalog-generation-control-snapshot.js +45 -0
- package/dist/src/utils/catalog-generation-control-snapshot.js.map +1 -0
- package/dist/src/utils/catalog-generation-error.d.ts +5 -1
- package/dist/src/utils/catalog-generation-error.js +14 -0
- package/dist/src/utils/catalog-generation-error.js.map +1 -1
- package/dist/src/utils/catalog-generation-resolver.d.ts +36 -5
- package/dist/src/utils/catalog-generation-resolver.js +221 -77
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
- package/dist/src/utils/catalog-generation-service.d.ts +159 -28
- package/dist/src/utils/catalog-generation-service.js +1186 -525
- package/dist/src/utils/catalog-generation-service.js.map +1 -1
- package/dist/src/utils/catalog-generation-state.d.ts +9 -0
- package/dist/src/utils/catalog-generation-state.js +97 -106
- package/dist/src/utils/catalog-generation-state.js.map +1 -1
- package/dist/src/utils/catalog-generation-store.d.ts +38 -24
- package/dist/src/utils/catalog-generation-store.js +337 -272
- 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-v5.js → catalog-manifest-v7.js} +23 -35
- package/dist/src/utils/catalog-manifest-v7.js.map +1 -0
- package/dist/src/utils/catalog-operation-context.d.ts +6 -14
- package/dist/src/utils/catalog-operation-context.js +69 -169
- package/dist/src/utils/catalog-operation-context.js.map +1 -1
- package/dist/src/utils/catalog-public-error.js +8 -4
- package/dist/src/utils/catalog-public-error.js.map +1 -1
- package/dist/src/utils/catalog-runtime-projection.d.ts +7 -3
- package/dist/src/utils/catalog-runtime-projection.js +5 -40
- package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
- package/dist/src/utils/catalog-snapshot.d.ts +2 -2
- 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 +23 -2
- package/dist/src/utils/catalog-source-references.js +456 -382
- 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 +178 -18
- package/dist/src/utils/catalog-sources.js.map +1 -1
- package/dist/src/utils/codex-config.d.ts +2 -0
- package/dist/src/utils/codex-config.js +22 -1
- package/dist/src/utils/codex-config.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 +47 -18
- package/dist/src/utils/codex-manager.js +88 -622
- 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 +49 -0
- package/dist/src/utils/codex-native-observation.js +169 -0
- package/dist/src/utils/codex-native-observation.js.map +1 -0
- package/dist/src/utils/codex-reconciler.d.ts +123 -0
- package/dist/src/utils/codex-reconciler.js +322 -0
- package/dist/src/utils/codex-reconciler.js.map +1 -0
- package/dist/src/utils/codex-shared-native.d.ts +45 -0
- package/dist/src/utils/codex-shared-native.js +122 -0
- package/dist/src/utils/codex-shared-native.js.map +1 -0
- 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 +49 -0
- package/dist/src/utils/codex-surface-analysis.js +220 -0
- package/dist/src/utils/codex-surface-analysis.js.map +1 -0
- package/dist/src/utils/component-command-preparation.d.ts +34 -0
- package/dist/src/utils/component-command-preparation.js +228 -0
- package/dist/src/utils/component-command-preparation.js.map +1 -0
- package/dist/src/utils/component-resources.d.ts +51 -0
- package/dist/src/utils/component-resources.js +322 -0
- package/dist/src/utils/component-resources.js.map +1 -0
- package/dist/src/utils/dynamic-skill-tree.d.ts +18 -6
- package/dist/src/utils/dynamic-skill-tree.js +32 -9
- 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 +167 -120
- 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-closure.d.ts +3 -0
- package/dist/src/utils/managed-command-closure.js +35 -0
- package/dist/src/utils/managed-command-closure.js.map +1 -0
- package/dist/src/utils/managed-command-evidence.d.ts +7 -0
- package/dist/src/utils/managed-command-evidence.js +10 -0
- package/dist/src/utils/managed-command-evidence.js.map +1 -0
- package/dist/src/utils/managed-command-materialization.d.ts +124 -0
- package/dist/src/utils/managed-command-materialization.js +369 -0
- package/dist/src/utils/managed-command-materialization.js.map +1 -0
- package/dist/src/utils/managed-command-preparation.d.ts +67 -0
- package/dist/src/utils/managed-command-preparation.js +146 -0
- package/dist/src/utils/managed-command-preparation.js.map +1 -0
- package/dist/src/utils/managed-command-review.d.ts +26 -0
- package/dist/src/utils/managed-command-review.js +68 -0
- package/dist/src/utils/managed-command-review.js.map +1 -0
- package/dist/src/utils/managed-command-runtime.d.ts +33 -0
- package/dist/src/utils/managed-command-runtime.js +121 -0
- package/dist/src/utils/managed-command-runtime.js.map +1 -0
- package/dist/src/utils/managed-command-store.d.ts +143 -0
- package/dist/src/utils/managed-command-store.js +665 -0
- package/dist/src/utils/managed-command-store.js.map +1 -0
- package/dist/src/utils/manifest.d.ts +1 -3
- package/dist/src/utils/manifest.js +1 -3
- package/dist/src/utils/manifest.js.map +1 -1
- package/dist/src/utils/multi-source-catalog.d.ts +1 -10
- package/dist/src/utils/multi-source-catalog.js +9 -175
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +74 -5
- package/dist/src/utils/native-cli.js +479 -31
- 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 +14 -0
- package/dist/src/utils/native-tool-context.js +38 -0
- package/dist/src/utils/native-tool-context.js.map +1 -0
- package/dist/src/utils/native-tool-review.d.ts +18 -0
- package/dist/src/utils/native-tool-review.js +116 -0
- package/dist/src/utils/native-tool-review.js.map +1 -0
- package/dist/src/utils/orphan-marketplace-cleanup.js +0 -1
- package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +103 -21
- package/dist/src/utils/ownership.js +232 -210
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/path-catalog-provider.d.ts +1 -1
- package/dist/src/utils/path-catalog-provider.js +47 -62
- package/dist/src/utils/path-catalog-provider.js.map +1 -1
- package/dist/src/utils/paths.d.ts +1 -2
- package/dist/src/utils/paths.js +5 -3
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +45 -0
- package/dist/src/utils/platform-empty-state.js +159 -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-impact.d.ts +64 -0
- package/dist/src/utils/plugin-config-impact.js +307 -0
- package/dist/src/utils/plugin-config-impact.js.map +1 -0
- package/dist/src/utils/plugin-config-references.d.ts +89 -0
- package/dist/src/utils/plugin-config-references.js +335 -0
- package/dist/src/utils/plugin-config-references.js.map +1 -0
- package/dist/src/utils/plugin-config-write.d.ts +109 -27
- package/dist/src/utils/plugin-config-write.js +1242 -348
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +187 -109
- package/dist/src/utils/plugin-config.js +916 -1147
- 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 +78 -127
- package/dist/src/utils/plugin-scripts.js +566 -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 +18 -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/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 +4 -3
- package/dist/src/utils/target-eligibility.js +12 -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 +105 -9
- package/dist/vitest.config.js.map +1 -1
- package/package.json +30 -21
- package/dist/scripts/aw-skill-eval-engine.d.ts +0 -13
- package/dist/scripts/aw-skill-eval-engine.js +0 -31
- package/dist/scripts/aw-skill-eval-engine.js.map +0 -1
- package/dist/scripts/codex-eval-app-server.d.ts +0 -91
- package/dist/scripts/codex-eval-app-server.js +0 -1334
- package/dist/scripts/codex-eval-app-server.js.map +0 -1
- package/dist/scripts/codex-eval-isolation.d.ts +0 -61
- package/dist/scripts/codex-eval-isolation.js +0 -318
- package/dist/scripts/codex-eval-isolation.js.map +0 -1
- package/dist/scripts/codex-eval-process-management.d.ts +0 -8
- package/dist/scripts/codex-eval-process-management.js +0 -69
- package/dist/scripts/codex-eval-process-management.js.map +0 -1
- package/dist/scripts/codex-eval-process-tree.d.ts +0 -38
- package/dist/scripts/codex-eval-process-tree.js +0 -803
- package/dist/scripts/codex-eval-process-tree.js.map +0 -1
- package/dist/scripts/codex-eval-runtime-config.d.ts +0 -62
- package/dist/scripts/codex-eval-runtime-config.js +0 -843
- package/dist/scripts/codex-eval-runtime-config.js.map +0 -1
- package/dist/scripts/codex-trigger-eval.d.ts +0 -84
- package/dist/scripts/codex-trigger-eval.js +0 -968
- package/dist/scripts/codex-trigger-eval.js.map +0 -1
- package/dist/scripts/eval-plugin-skills-audited.d.ts +0 -6
- package/dist/scripts/eval-plugin-skills-audited.js +0 -261
- package/dist/scripts/eval-plugin-skills-audited.js.map +0 -1
- package/dist/scripts/eval-plugin-skills.d.ts +0 -45
- package/dist/scripts/eval-plugin-skills.js +0 -1589
- package/dist/scripts/eval-plugin-skills.js.map +0 -1
- package/dist/scripts/eval-run-layout.d.ts +0 -17
- package/dist/scripts/eval-run-layout.js +0 -26
- package/dist/scripts/eval-run-layout.js.map +0 -1
- package/dist/scripts/plugin-eval-contract.d.ts +0 -189
- package/dist/scripts/plugin-eval-contract.js +0 -745
- package/dist/scripts/plugin-eval-contract.js.map +0 -1
- package/dist/scripts/plugin-eval-materializer.d.ts +0 -13
- package/dist/scripts/plugin-eval-materializer.js +0 -421
- package/dist/scripts/plugin-eval-materializer.js.map +0 -1
- package/dist/scripts/skill-reporting.d.ts +0 -212
- package/dist/scripts/skill-reporting.js +0 -922
- package/dist/scripts/skill-reporting.js.map +0 -1
- package/dist/src/commands/catalog-context.d.ts +0 -52
- package/dist/src/commands/catalog-context.js +0 -156
- package/dist/src/commands/catalog-context.js.map +0 -1
- 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/status-v5.d.ts +0 -169
- package/dist/src/commands/status-v5.js +0 -1135
- package/dist/src/commands/status-v5.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-v5.d.ts +0 -5
- package/dist/src/utils/catalog-manifest-v5.js.map +0 -1
- package/dist/src/utils/catalog-source-cache.d.ts +0 -62
- package/dist/src/utils/catalog-source-cache.js +0 -321
- package/dist/src/utils/catalog-source-cache.js.map +0 -1
- package/dist/src/utils/codex-project-surface.d.ts +0 -3
- package/dist/src/utils/codex-project-surface.js +0 -49
- package/dist/src/utils/codex-project-surface.js.map +0 -1
- 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-release.d.ts +0 -2
- package/dist/src/utils/plugin-release.js +0 -2
- package/dist/src/utils/plugin-release.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,1317 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import { createMarketplaceManifestEntry, normalizeStaticPluginComponents, resolveInvocationPolicy } from '@lesliechan721/aw-plugin-core/manifest';
|
|
6
|
+
import { getAgentPluginAdapter } from '../platforms/registry.js';
|
|
7
|
+
import { getQualifiedPlatformProfile } from '../platforms/capabilities.js';
|
|
8
|
+
import { getDeploymentLayout, getDeploymentResourceKey, getInvocationPolicyPhysicalKey } from '../platforms/layout.js';
|
|
9
|
+
import { deploymentPackageComponent, inspectStaticSupplements, requiredDeploymentActivation } from '../platforms/inspection.js';
|
|
10
|
+
import { piProjectRegistrationHidden, piProjectRemovalConfirmed } from '../platforms/lifecycle-native.js';
|
|
11
|
+
import { createNativeLifecycleServices } from '../platforms/lifecycle-native-services.js';
|
|
12
|
+
import { assertGeminiProjectRules, geminiActivationEvidence, geminiActivationRules, geminiExtensionPaths, geminiScopePattern, geminiUserActivation, readGeminiActivationSnapshot } from '../platforms/gemini-activation.js';
|
|
13
|
+
import { cursorWorkspaceOpenCommand } from '../platforms/projection.js';
|
|
14
|
+
import { cursorHookEntryCommand, cursorHooks } from '../platforms/cursor-workspace-hook.js';
|
|
15
|
+
import { ownedSupplementFile, staticSupplementFiles } from '../platforms/supplement-layout.js';
|
|
16
|
+
import { projectPlatformMarketplace } from '../platforms/projection-marketplace.js';
|
|
17
|
+
import { readStrictNamespacedMarketplaceRoot } from '../utils/local-marketplace.js';
|
|
18
|
+
import { artifactValueDigest, mergeExpectedComponentSets } from '../utils/artifact-plan.js';
|
|
19
|
+
import { preparePlatformComponents, resolveArtifactRenderConfig } from '../utils/artifact-renderer.js';
|
|
20
|
+
import { finalizePlatformSkillProducers } from '../utils/component-command-preparation.js';
|
|
21
|
+
import { cleanupOwnedComponents, createSharedOwnerToken, inspectOwnedComponents, writeOwnedTextFile, writeSkillOwnerMarker } from '../utils/ownership.js';
|
|
22
|
+
import { createPlatformInputEvidence, platformPackageInputDigest, readPlatformPackageContentDigest, writePlatformEmptyState } from '../utils/platform-empty-state.js';
|
|
23
|
+
import { writePlatformSupplementState } from '../platforms/supplement-state.js';
|
|
24
|
+
import { atomicReplaceSafeFile, assertSafeFileMutationPath } from '../utils/safe-fs.js';
|
|
25
|
+
import { assertManagedCommandBindingIdentities, captureManagedCommandBindingRecoveryEvidence, publishManagedCommandBindings, listManagedCommands, readInstalledCommandProducer, revokeManagedCommandBindings } from '../utils/managed-command-store.js';
|
|
26
|
+
import { captureNativeToolChanges } from '../utils/native-tool-review.js';
|
|
27
|
+
import { captureManagedCommandReviewEvidence } from '../utils/managed-command-review.js';
|
|
28
|
+
import { readClaudeSettings } from '../adapters/helpers.js';
|
|
29
|
+
import { readCodexConfigFile } from '../utils/codex-config.js';
|
|
30
|
+
import { parseOwnedTextHeader, readSkillOwnerMarker } from '../utils/ownership.js';
|
|
31
|
+
import { applyPlannedOperationAction, isNativeActivationOnlyTarget } from './rebuild-integration.js';
|
|
32
|
+
function nativeCopyIncomplete(binding, after, contentDigest) {
|
|
33
|
+
return ['gemini-extension', 'antigravity-cli', 'grok-cli'].includes(binding.route)
|
|
34
|
+
&& after.nativePackageContentDigest !== contentDigest;
|
|
35
|
+
}
|
|
36
|
+
function packageDeliveryConfirmed(binding, after, contentDigest, requireIndependentActivation) {
|
|
37
|
+
return after.package === 'present' && ['aw', 'shared'].includes(after.ownership)
|
|
38
|
+
&& !nativeCopyIncomplete(binding, after, contentDigest)
|
|
39
|
+
&& ['present', 'not-applicable'].includes(after.registration)
|
|
40
|
+
&& ['enabled', 'not-applicable'].includes(requiredDeploymentActivation(binding, after, requireIndependentActivation))
|
|
41
|
+
&& (binding.route !== 'cursor-workspace-hook' || after.workspaceOpen === 'present')
|
|
42
|
+
&& (binding.route !== 'claude-marketplace' || after.scopeRegistration === undefined || after.scopeRegistration === 'present');
|
|
43
|
+
}
|
|
44
|
+
/** Fingerprints are operation-local evidence; they confer no ownership or deletion rights. */
|
|
45
|
+
async function pathEvidence(location) {
|
|
46
|
+
const stat = await fs.lstat(location).catch((error) => {
|
|
47
|
+
if (error.code === 'ENOENT' || error.code === 'ENOTDIR')
|
|
48
|
+
return null;
|
|
49
|
+
throw error;
|
|
50
|
+
});
|
|
51
|
+
if (!stat)
|
|
52
|
+
return null;
|
|
53
|
+
if (stat.isSymbolicLink())
|
|
54
|
+
return { link: await fs.readlink(location) };
|
|
55
|
+
if (stat.isDirectory())
|
|
56
|
+
return Promise.all((await fs.readdir(location)).sort().map(async (name) => [name, await pathEvidence(path.join(location, name))]));
|
|
57
|
+
if (!stat.isFile())
|
|
58
|
+
throw new Error('deploymentEvidenceInvalid: a deployment resource is not a regular file.');
|
|
59
|
+
return { mode: stat.mode & 0o777, digest: crypto.createHash('sha256').update(await fs.readFile(location)).digest('hex') };
|
|
60
|
+
}
|
|
61
|
+
async function ownedContentDigest(component) {
|
|
62
|
+
if (component.kind === 'owned-directory' || component.kind === 'skill-directory')
|
|
63
|
+
return readPlatformPackageContentDigest(component.path);
|
|
64
|
+
if (component.kind === 'shared-config') {
|
|
65
|
+
let value;
|
|
66
|
+
if (component.locator.kind === 'claude-permissions') {
|
|
67
|
+
const permissions = (await readClaudeSettings(component.locator.settingsPath)).awGenerated?.permissions?.[component.locator.ownerKey];
|
|
68
|
+
if (permissions)
|
|
69
|
+
value = { kind: 'claude-permissions', permissions };
|
|
70
|
+
}
|
|
71
|
+
else if (component.locator.kind === 'cursor-workspace-hook') {
|
|
72
|
+
const locator = component.locator;
|
|
73
|
+
const entries = cursorHooks(await jsonObject(locator.hooksPath)).entries;
|
|
74
|
+
if (entries.some((entry) => cursorHookEntryCommand(entry) === locator.command))
|
|
75
|
+
value = { version: 1, hooks: { workspaceOpen: [{ command: locator.command }] } };
|
|
76
|
+
}
|
|
77
|
+
return value === undefined ? undefined : `sha256:${crypto.createHash('sha256').update(`${JSON.stringify(value, null, 2)}\n`).digest('hex')}`;
|
|
78
|
+
}
|
|
79
|
+
if (component.kind !== 'owned-text-file')
|
|
80
|
+
return undefined;
|
|
81
|
+
try {
|
|
82
|
+
const parsed = parseOwnedTextHeader(await fs.readFile(component.path, 'utf8'), component.identity);
|
|
83
|
+
return parsed ? `sha256:${crypto.createHash('sha256').update(parsed.content).digest('hex')}` : undefined;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function ownedSupplements(binding, root, physicalKey) {
|
|
90
|
+
if (!root || !physicalKey)
|
|
91
|
+
return [];
|
|
92
|
+
const entries = await fs.readdir(root, { withFileTypes: true }).catch((error) => {
|
|
93
|
+
if (error.code === 'ENOENT' || error.code === 'ENOTDIR')
|
|
94
|
+
return [];
|
|
95
|
+
throw error;
|
|
96
|
+
});
|
|
97
|
+
const result = [];
|
|
98
|
+
for (const entry of entries) {
|
|
99
|
+
const location = path.join(root, entry.name);
|
|
100
|
+
let identity;
|
|
101
|
+
if (entry.isDirectory() && !entry.isSymbolicLink())
|
|
102
|
+
identity = (await readSkillOwnerMarker({ skillRoot: location, allowedRoot: root }).catch(() => null)) ?? undefined;
|
|
103
|
+
else if (entry.isFile())
|
|
104
|
+
identity = parseOwnedTextHeader(await fs.readFile(location, 'utf8').catch(() => ''))?.identity;
|
|
105
|
+
if (!identity || identity.sourceId !== binding.plugin.sourceId || identity.pluginId !== binding.plugin.pluginId
|
|
106
|
+
|| identity.sourceIdentity !== binding.plugin.sourceIdentity || identity.physicalKey !== physicalKey
|
|
107
|
+
|| identity.platform !== binding.platform || identity.scope !== binding.scope.kind)
|
|
108
|
+
continue;
|
|
109
|
+
result.push({ kind: entry.isDirectory() ? 'owned-directory' : 'owned-text-file', path: location, allowedRoot: root, identity });
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
function readContext(context, cwd) {
|
|
114
|
+
return { cwd, env: context.env, runner: context.nativeCliRunner, signal: context.signal,
|
|
115
|
+
codexObservationSession: context.codexObservationSession };
|
|
116
|
+
}
|
|
117
|
+
function operation(input) {
|
|
118
|
+
return input.command === 'uninstall' ? 'remove' : input.command === 'cleanup' ? 'cleanup'
|
|
119
|
+
: input.command === 'reinstall' ? 'reinstall' : 'ensure';
|
|
120
|
+
}
|
|
121
|
+
function sourceIdentity(input) {
|
|
122
|
+
const sourceId = input.sourceId ?? input.plugin.sourceId;
|
|
123
|
+
const sourceIdentity = input.sourceIdentity ?? input.plugin.sourceIdentity;
|
|
124
|
+
const pluginId = input.pluginId ?? input.plugin.pluginId;
|
|
125
|
+
if (!sourceId || !sourceIdentity || !pluginId)
|
|
126
|
+
throw new Error('deploymentSourceIdentityMissing: a native deployment requires a verified catalog source.');
|
|
127
|
+
return { sourceId, sourceIdentity, pluginId, version: input.plugin.manifest.version };
|
|
128
|
+
}
|
|
129
|
+
function targetIdentity(input) {
|
|
130
|
+
return { ...sourceIdentity(input), pluginName: input.plugin.manifest.name,
|
|
131
|
+
pluginVersion: input.plugin.manifest.version, platform: input.platform, scope: input.scope, cwd: input.cwd };
|
|
132
|
+
}
|
|
133
|
+
function contributionComponent(binding, contribution, physicalKey) {
|
|
134
|
+
if (contribution.kind === 'owned-file')
|
|
135
|
+
return ownedSupplementFile(binding, physicalKey, contribution.destination);
|
|
136
|
+
const identity = { owner: 'agent-workflows', sourceId: binding.plugin.sourceId,
|
|
137
|
+
pluginId: binding.plugin.pluginId, plugin: binding.plugin.pluginId.split('/').at(-1),
|
|
138
|
+
sourceIdentity: binding.plugin.sourceIdentity, physicalKey,
|
|
139
|
+
platform: binding.platform, scope: binding.scope.kind, artifactKey: path.basename(contribution.destination) };
|
|
140
|
+
if (contribution.kind === 'config-entry') {
|
|
141
|
+
if (binding.platform === 'claude' && contribution.mergeKey?.startsWith('claude-permissions:')) {
|
|
142
|
+
const owner = { ...identity, artifactKey: contribution.mergeKey.replace(':', '-') };
|
|
143
|
+
return { kind: 'shared-config', identity: owner, label: contribution.destination,
|
|
144
|
+
locator: { kind: 'claude-permissions', settingsPath: contribution.destination, ownerKey: createSharedOwnerToken(owner) } };
|
|
145
|
+
}
|
|
146
|
+
if (binding.platform !== 'cursor' || !contribution.mergeKey)
|
|
147
|
+
throw new Error('platformContributionUnsupported');
|
|
148
|
+
return { kind: 'shared-config', identity: { ...identity, artifactKey: `workspaceOpen-${identity.plugin}` },
|
|
149
|
+
label: contribution.destination, locator: { kind: 'cursor-workspace-hook', hooksPath: contribution.destination,
|
|
150
|
+
ownerKey: contribution.mergeKey, command: '' } };
|
|
151
|
+
}
|
|
152
|
+
return { kind: 'owned-directory',
|
|
153
|
+
path: contribution.destination, allowedRoot: path.dirname(contribution.destination), identity };
|
|
154
|
+
}
|
|
155
|
+
async function jsonObject(file) {
|
|
156
|
+
let value;
|
|
157
|
+
try {
|
|
158
|
+
value = await fs.readJson(file);
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
if (error.code === 'ENOENT')
|
|
162
|
+
return {};
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
166
|
+
throw new Error('sharedConfigurationInvalid');
|
|
167
|
+
return value;
|
|
168
|
+
}
|
|
169
|
+
export const platformOwnership = {
|
|
170
|
+
async inspectShared(component) {
|
|
171
|
+
if (component.locator.kind !== 'cursor-workspace-hook')
|
|
172
|
+
throw new Error('sharedOwnershipUnsupported');
|
|
173
|
+
const locator = component.locator;
|
|
174
|
+
const { entries } = cursorHooks(await jsonObject(locator.hooksPath));
|
|
175
|
+
return entries.some((entry) => cursorHookEntryCommand(entry) === locator.command) ? 'present' : 'absent';
|
|
176
|
+
},
|
|
177
|
+
async removeShared(component) {
|
|
178
|
+
if (component.locator.kind !== 'cursor-workspace-hook')
|
|
179
|
+
throw new Error('sharedOwnershipUnsupported');
|
|
180
|
+
const locator = component.locator;
|
|
181
|
+
const value = await jsonObject(locator.hooksPath);
|
|
182
|
+
const { hooks, entries } = cursorHooks(value);
|
|
183
|
+
const retained = entries.filter((entry) => cursorHookEntryCommand(entry) !== locator.command);
|
|
184
|
+
if (retained.length === entries.length)
|
|
185
|
+
return;
|
|
186
|
+
await atomicReplaceSafeFile({ filePath: component.locator.hooksPath, allowedRoot: path.dirname(component.locator.hooksPath),
|
|
187
|
+
content: `${JSON.stringify({ ...value, hooks: { ...hooks, workspaceOpen: retained } }, null, 2)}\n`, label: 'Cursor workspaceOpen' });
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
async function requireWritable(component, executor = platformOwnership) {
|
|
191
|
+
const inspection = await inspectOwnedComponents({ components: [component], executor });
|
|
192
|
+
if (!['present', 'absent'].includes(inspection.components[0].state))
|
|
193
|
+
throw new Error('operationPlanStale: deployment ownership changed.');
|
|
194
|
+
}
|
|
195
|
+
async function publishDirectory(source, component, nativeProjection) {
|
|
196
|
+
if (component.kind !== 'owned-directory')
|
|
197
|
+
throw new Error('deploymentPackageOwnerInvalid');
|
|
198
|
+
await requireWritable(component);
|
|
199
|
+
await assertSafeFileMutationPath({ filePath: path.join(component.allowedRoot, '.aw-publication-probe'),
|
|
200
|
+
allowedRoot: component.allowedRoot, label: 'Native package', createParent: true });
|
|
201
|
+
const staging = await fs.mkdtemp(path.join(component.allowedRoot, '.aw-package-'));
|
|
202
|
+
const candidate = path.join(staging, component.identity.artifactKey);
|
|
203
|
+
const backup = `${staging}.previous`;
|
|
204
|
+
let moved = false;
|
|
205
|
+
try {
|
|
206
|
+
await fs.copy(source, candidate, { dereference: false });
|
|
207
|
+
await writeSkillOwnerMarker({ skillRoot: candidate, allowedRoot: staging, identity: component.identity, nativeProjection });
|
|
208
|
+
await requireWritable(component);
|
|
209
|
+
if (await fs.pathExists(component.path)) {
|
|
210
|
+
await fs.move(component.path, backup);
|
|
211
|
+
moved = true;
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
await fs.move(candidate, component.path);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
if (moved && !await fs.pathExists(component.path))
|
|
218
|
+
await fs.move(backup, component.path);
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
await fs.remove(backup);
|
|
222
|
+
return { mutation: 'confirmed', changed: true };
|
|
223
|
+
}
|
|
224
|
+
finally {
|
|
225
|
+
await fs.remove(staging);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async function sharedReferences(context, binding, observation, layout) {
|
|
229
|
+
if (!['codex-marketplace', 'claude-marketplace', 'gemini-extension', 'copilot-marketplace'].includes(binding.route))
|
|
230
|
+
return 'none';
|
|
231
|
+
const view = context.sharedReferenceView;
|
|
232
|
+
const same = (reference) => reference.pluginId === binding.plugin.pluginId
|
|
233
|
+
&& reference.sourceIdentity === binding.plugin.sourceIdentity && reference.platform === binding.platform
|
|
234
|
+
&& (reference.physicalKey === undefined || reference.physicalKey === binding.physicalKey);
|
|
235
|
+
const current = (reference) => reference.scope === binding.scope.kind
|
|
236
|
+
&& (reference.scope !== 'project' || binding.scope.kind === 'project' && reference.projectRoot === binding.scope.projectRoot);
|
|
237
|
+
if (view && [...view.desired, ...view.observed].some((reference) => same(reference) && !current(reference)))
|
|
238
|
+
return 'present';
|
|
239
|
+
const host = binding.consumers.find((consumer) => consumer.entry?.kind === 'cli')?.entry;
|
|
240
|
+
if (!host || host.kind !== 'cli' || observation.registration === 'unknown')
|
|
241
|
+
return 'unknown';
|
|
242
|
+
if (binding.route === 'gemini-extension') {
|
|
243
|
+
try {
|
|
244
|
+
const ctx = readContext(context, binding.scope.kind === 'project' ? binding.scope.projectRoot : layout.packageRoot);
|
|
245
|
+
const snapshot = await readGeminiActivationSnapshot(ctx);
|
|
246
|
+
const rules = geminiActivationRules(snapshot, layout.nativeIdentity.packageId);
|
|
247
|
+
await assertGeminiProjectRules(ctx, binding, rules);
|
|
248
|
+
const home = geminiExtensionPaths(ctx).home;
|
|
249
|
+
const userActivation = geminiUserActivation(snapshot, layout.nativeIdentity.packageId, home);
|
|
250
|
+
if (userActivation === 'unknown')
|
|
251
|
+
return 'unknown';
|
|
252
|
+
if (binding.scope.kind === 'project' && observation.registration === 'present' && userActivation)
|
|
253
|
+
return 'present';
|
|
254
|
+
const currentPattern = binding.scope.kind === 'project' ? geminiScopePattern(binding.scope.projectRoot) : null;
|
|
255
|
+
if (rules.some((rule) => {
|
|
256
|
+
const pattern = rule.startsWith('!') ? rule.slice(1) : rule;
|
|
257
|
+
return pattern !== '*' && pattern !== geminiScopePattern(home) && pattern !== currentPattern;
|
|
258
|
+
}))
|
|
259
|
+
return 'present';
|
|
260
|
+
return view?.desiredComplete && view.scopes.includes('user') ? 'none' : 'unknown';
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
return 'unknown';
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (binding.route === 'claude-marketplace') {
|
|
267
|
+
try {
|
|
268
|
+
const installed = await jsonObject(path.join(host.configRoot, 'plugins', 'installed_plugins.json'));
|
|
269
|
+
const plugins = installed.plugins;
|
|
270
|
+
if (plugins !== undefined && (!plugins || typeof plugins !== 'object' || Array.isArray(plugins)))
|
|
271
|
+
return 'unknown';
|
|
272
|
+
const raw = plugins?.[layout.nativeIdentity.registrationId];
|
|
273
|
+
const records = raw === undefined ? [] : Array.isArray(raw) ? raw : [raw];
|
|
274
|
+
for (const rawRecord of records) {
|
|
275
|
+
if (!rawRecord || typeof rawRecord !== 'object')
|
|
276
|
+
return 'unknown';
|
|
277
|
+
const record = rawRecord;
|
|
278
|
+
if (record.scope !== 'user' && record.scope !== 'local')
|
|
279
|
+
return 'unknown';
|
|
280
|
+
if (record.scope === 'local' && (typeof record.projectPath !== 'string' || !path.isAbsolute(record.projectPath)))
|
|
281
|
+
return 'unknown';
|
|
282
|
+
if (record.scope === 'user' ? binding.scope.kind !== 'user'
|
|
283
|
+
: binding.scope.kind !== 'project' || path.resolve(record.projectPath) !== path.resolve(binding.scope.projectRoot))
|
|
284
|
+
return 'present';
|
|
285
|
+
}
|
|
286
|
+
return view && !view.desiredComplete ? 'unknown' : 'none';
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return 'unknown';
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (binding.route === 'codex-marketplace' && view?.desiredComplete && view.scopes.includes('user')
|
|
293
|
+
&& view.scopes.includes('project') && view.projectRoot) {
|
|
294
|
+
const covered = view.observations.filter((reference) => same(reference) && reference.physicalKey === binding.physicalKey && reference.complete);
|
|
295
|
+
if (covered.some((reference) => reference.scope === 'user')
|
|
296
|
+
&& covered.some((reference) => reference.scope === 'project' && reference.projectRoot === view.projectRoot)) {
|
|
297
|
+
try {
|
|
298
|
+
const config = await readCodexConfigFile(path.join(host.configRoot, 'config.toml'));
|
|
299
|
+
// Only the already authorized project is read. Any additional native
|
|
300
|
+
// project reference keeps the shared payload until its scope is observed.
|
|
301
|
+
if (Object.values(config.snapshot.projects).some((project) => path.resolve(project.path) !== path.resolve(view.projectRoot)))
|
|
302
|
+
return 'unknown';
|
|
303
|
+
if (binding.scope.kind === 'project' && config.snapshot.plugins[layout.nativeIdentity.registrationId]?.enabled === true)
|
|
304
|
+
return 'present';
|
|
305
|
+
const project = await readCodexConfigFile(path.join(view.projectRoot, '.codex', 'config.toml'));
|
|
306
|
+
if (binding.scope.kind === 'user' && project.snapshot.plugins[layout.nativeIdentity.registrationId]?.enabled === true)
|
|
307
|
+
return 'present';
|
|
308
|
+
return 'none';
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
return 'unknown';
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
// These routes do not expose a complete global activation inventory. An absent
|
|
316
|
+
// registration is sufficient for orphan payload cleanup; otherwise keep it.
|
|
317
|
+
return observation.registration === 'absent' && view?.desiredComplete === true
|
|
318
|
+
&& view.scopes.includes('user') && view.scopes.includes('project') ? 'none' : 'unknown';
|
|
319
|
+
}
|
|
320
|
+
export class PlatformRebuildSession {
|
|
321
|
+
context;
|
|
322
|
+
adapterFor;
|
|
323
|
+
targets = new Map();
|
|
324
|
+
resolutions = new Map();
|
|
325
|
+
units = new Map();
|
|
326
|
+
published = new Map();
|
|
327
|
+
nativeEffects = new Map();
|
|
328
|
+
exclusions = new Map();
|
|
329
|
+
contexts = new Set();
|
|
330
|
+
mutableChecks = new Map();
|
|
331
|
+
requestedOperations = new Map();
|
|
332
|
+
marketplaceTargets = new Set();
|
|
333
|
+
marketplaceCandidatesFrozen = false;
|
|
334
|
+
ownership = platformOwnership;
|
|
335
|
+
marketplaces = new Map();
|
|
336
|
+
staging;
|
|
337
|
+
constructor(context, adapterFor = getAgentPluginAdapter) {
|
|
338
|
+
this.context = context;
|
|
339
|
+
this.adapterFor = adapterFor;
|
|
340
|
+
}
|
|
341
|
+
updateContext(context) {
|
|
342
|
+
this.context = context;
|
|
343
|
+
for (const ctx of this.contexts)
|
|
344
|
+
Object.assign(ctx, readContext(context, ctx.cwd));
|
|
345
|
+
}
|
|
346
|
+
setOwnershipExecutor(executor) { this.ownership = executor; }
|
|
347
|
+
root() { return this.staging ??= fs.mkdtemp(path.join(os.tmpdir(), 'aw-deployment-')); }
|
|
348
|
+
nativeReadContext(input) {
|
|
349
|
+
const ctx = readContext(this.context, input.cwd);
|
|
350
|
+
if (input.platform === 'gemini')
|
|
351
|
+
ctx.nativeNodeCompileCacheDir = async () => {
|
|
352
|
+
const pending = this.root();
|
|
353
|
+
try {
|
|
354
|
+
return path.join(await pending, 'native-node-compile-cache');
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
// An optional cache allocation must not poison later required staging.
|
|
358
|
+
if (this.staging === pending)
|
|
359
|
+
this.staging = undefined;
|
|
360
|
+
throw error;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
return ctx;
|
|
364
|
+
}
|
|
365
|
+
async dispose() {
|
|
366
|
+
for (const result of await Promise.allSettled(this.units.values()))
|
|
367
|
+
if (result.status === 'fulfilled')
|
|
368
|
+
await result.value.finalized.cleanup();
|
|
369
|
+
if (this.staging)
|
|
370
|
+
await fs.remove(await this.staging);
|
|
371
|
+
this.staging = undefined;
|
|
372
|
+
this.targets.clear();
|
|
373
|
+
this.resolutions.clear();
|
|
374
|
+
this.units.clear();
|
|
375
|
+
this.published.clear();
|
|
376
|
+
this.nativeEffects.clear();
|
|
377
|
+
this.exclusions.clear();
|
|
378
|
+
this.contexts.clear();
|
|
379
|
+
this.mutableChecks.clear();
|
|
380
|
+
this.requestedOperations.clear();
|
|
381
|
+
this.marketplaces.clear();
|
|
382
|
+
this.marketplaceTargets.clear();
|
|
383
|
+
this.marketplaceCandidatesFrozen = false;
|
|
384
|
+
}
|
|
385
|
+
freezeMarketplaceCandidates() { this.marketplaceCandidatesFrozen = true; }
|
|
386
|
+
key(input) { return artifactValueDigest({ plugin: sourceIdentity(input), platform: input.platform, scope: input.scope, cwd: input.scope === 'project' ? input.cwd : null, operation: operation(input) }); }
|
|
387
|
+
resolve(input) {
|
|
388
|
+
const key = this.key(input);
|
|
389
|
+
// Inspection of a shared package does not request activation in that scope.
|
|
390
|
+
if (!input.readOnlyInspectionPlan)
|
|
391
|
+
this.requestedOperations.set(key, input);
|
|
392
|
+
let result = this.resolutions.get(key);
|
|
393
|
+
if (!result) {
|
|
394
|
+
result = (async () => {
|
|
395
|
+
const adapter = this.adapterFor(input.platform);
|
|
396
|
+
const ctx = this.nativeReadContext(input);
|
|
397
|
+
const plugin = sourceIdentity(input);
|
|
398
|
+
const recoveryCandidates = (this.context.recoveryCandidates ?? []).filter((candidate) => candidate.binding.platform === input.platform
|
|
399
|
+
&& candidate.binding.plugin.sourceIdentity === plugin.sourceIdentity && candidate.binding.plugin.pluginId === plugin.pluginId
|
|
400
|
+
&& candidate.binding.scope.kind === input.scope && (candidate.binding.scope.kind !== 'project' || candidate.binding.scope.projectRoot === input.cwd));
|
|
401
|
+
const scope = input.scope === 'project' ? { kind: 'project', projectRoot: input.cwd } : { kind: 'user' };
|
|
402
|
+
const discovery = await adapter.discover(ctx);
|
|
403
|
+
const resolution = await adapter.resolve(ctx, { plugin, scope, operation: operation(input), discovery, recoveryCandidates });
|
|
404
|
+
this.exclusions.set(key, resolution.exclusions.flatMap((exclusion) => {
|
|
405
|
+
if (!exclusion.productId)
|
|
406
|
+
return [];
|
|
407
|
+
const product = discovery.installations.find((item) => item.id === exclusion.productId) ?? null;
|
|
408
|
+
if (product?.availability === 'missing' || product?.availability === 'notApplicable')
|
|
409
|
+
return [];
|
|
410
|
+
return [{ platform: input.platform, pluginId: plugin.pluginId, scope, productId: exclusion.productId,
|
|
411
|
+
product: product ? structuredClone(product) : null, reasonCode: exclusion.reasonCode, execution: 'not-run',
|
|
412
|
+
recoveryActions: ['Check the identified client version and installation entry, then retry this product.'] }];
|
|
413
|
+
}));
|
|
414
|
+
if (recoveryCandidates.length) {
|
|
415
|
+
const allowed = new Set(recoveryCandidates.map((candidate) => candidate.binding.physicalKey));
|
|
416
|
+
resolution.bindings = resolution.bindings.filter((binding) => allowed.has(binding.physicalKey));
|
|
417
|
+
const unitIds = new Set(resolution.bindings.flatMap((binding) => binding.renderUnitIds));
|
|
418
|
+
resolution.renderUnits = resolution.renderUnits.filter((unit) => unitIds.has(unit.id));
|
|
419
|
+
}
|
|
420
|
+
return resolution;
|
|
421
|
+
})();
|
|
422
|
+
this.resolutions.set(key, result);
|
|
423
|
+
}
|
|
424
|
+
return result;
|
|
425
|
+
}
|
|
426
|
+
/** Resolve the whole selected scope before any physical unit is rendered. */
|
|
427
|
+
async resolveAll(inputs) {
|
|
428
|
+
await Promise.allSettled(inputs.map((input) => this.resolve(input)));
|
|
429
|
+
}
|
|
430
|
+
async freezeSharedPreApplyActions(targets) {
|
|
431
|
+
const prepared = (await Promise.allSettled(this.targets.values())).flatMap((result) => result.status === 'fulfilled' ? [result.value] : []);
|
|
432
|
+
for (const target of targets) {
|
|
433
|
+
if (target.identity.scope !== 'project' || !target.operationActions?.some((action) => action.kind === 'runPreApply'))
|
|
434
|
+
continue;
|
|
435
|
+
const plans = target.platformDeployment?.plans ?? [];
|
|
436
|
+
if (!plans.length || plans.some((plan) => !['codex-marketplace', 'claude-marketplace', 'gemini-extension', 'copilot-marketplace'].includes(plan.binding.route)
|
|
437
|
+
|| plan.effects.some((effect) => effect.physicalKey !== plan.binding.physicalKey)
|
|
438
|
+
|| plan.projections.some((projection) => projection.supplements.length > 0)
|
|
439
|
+
|| !plan.evidence.renderUnits?.some((unit) => unit.output === 'package' && unit.renderScope.kind === 'user')))
|
|
440
|
+
continue;
|
|
441
|
+
const provider = prepared.find((candidate) => candidate.identity.scope === 'user' && candidate.identity.platform === target.identity.platform
|
|
442
|
+
&& candidate.identity.pluginId === target.identity.pluginId && candidate.identity.sourceIdentity === target.identity.sourceIdentity
|
|
443
|
+
&& candidate.operationActions?.some((action) => action.kind === 'runPreApply')
|
|
444
|
+
&& plans.every((plan) => candidate.platformDeployment?.plans.some((other) => other.binding.physicalKey === plan.binding.physicalKey)));
|
|
445
|
+
if (!provider)
|
|
446
|
+
continue;
|
|
447
|
+
const input = { sourceId: target.identity.sourceId, sourceIdentity: target.identity.sourceIdentity,
|
|
448
|
+
pluginName: target.plugin.manifest.name, manifest: target.plugin.manifest, platform: target.identity.platform,
|
|
449
|
+
logicalIdentity: target.plugin.catalogLogicalIdentity, cwd: target.identity.cwd,
|
|
450
|
+
env: this.context.env, referencePlugins: this.context.referencePlugins };
|
|
451
|
+
const [userConfig, projectConfig] = await Promise.all([
|
|
452
|
+
resolveArtifactRenderConfig({ ...input, scope: 'user' }), resolveArtifactRenderConfig({ ...input, scope: 'project' }),
|
|
453
|
+
]);
|
|
454
|
+
if (artifactValueDigest(userConfig.values) !== artifactValueDigest(projectConfig.values))
|
|
455
|
+
continue;
|
|
456
|
+
target.operationActions = target.operationActions.filter((action) => action.kind !== 'runPreApply');
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
/** Freeze one complete source descriptor after all eligible packages have been prepared. */
|
|
460
|
+
async sealMarketplaceGenerations(targets) {
|
|
461
|
+
if (this.marketplaceCandidatesFrozen && targets.some((target) => !this.marketplaceTargets.has(target))) {
|
|
462
|
+
throw new Error('operationPlanStale: the reviewed marketplace candidates changed.');
|
|
463
|
+
}
|
|
464
|
+
for (const target of targets)
|
|
465
|
+
this.marketplaceTargets.add(target);
|
|
466
|
+
targets = [...this.marketplaceTargets];
|
|
467
|
+
await this.freezeSharedPreApplyActions(targets);
|
|
468
|
+
const retained = new Map(targets.flatMap((target) => (target.platformDeployment?.plans ?? [])
|
|
469
|
+
.filter((plan) => plan.evidence.retainPackage).map((plan) => [plan.binding.physicalKey, plan.expected.unmet])));
|
|
470
|
+
for (const target of targets)
|
|
471
|
+
for (const deployment of [...target.platformDeployment?.deployments ?? []]) {
|
|
472
|
+
const unmet = retained.get(deployment.plan.binding.physicalKey);
|
|
473
|
+
if (!unmet || deployment.plan.evidence.retainPackage)
|
|
474
|
+
continue;
|
|
475
|
+
const next = this.adapterFor(deployment.plan.binding.platform).lifecycle.prepare({ ...deployment.plan,
|
|
476
|
+
observation: deployment.driverState.before, expected: { ...deployment.plan.expected,
|
|
477
|
+
unmet: [...deployment.plan.expected.unmet, ...unmet] }, evidence: { ...deployment.plan.evidence, retainPackage: true } });
|
|
478
|
+
if (next.status !== 'ready')
|
|
479
|
+
throw new Error('sharedPackageRetentionUnconfirmed');
|
|
480
|
+
const prepared = target.platformDeployment;
|
|
481
|
+
prepared.deployments.splice(prepared.deployments.indexOf(deployment), 1, next.prepared);
|
|
482
|
+
prepared.plans.splice(prepared.plans.findIndex((plan) => plan.binding.id === deployment.plan.binding.id), 1, next.prepared.plan);
|
|
483
|
+
}
|
|
484
|
+
const groups = new Map();
|
|
485
|
+
for (const target of targets)
|
|
486
|
+
for (const deployment of target.platformDeployment?.deployments ?? []) {
|
|
487
|
+
const root = deployment.plan.evidence.layout.marketplaceRoot;
|
|
488
|
+
if (!root || deployment.plan.evidence.retainPackage || !deployment.plan.projections.some((projection) => projection.bundle))
|
|
489
|
+
continue;
|
|
490
|
+
const values = groups.get(root) ?? [];
|
|
491
|
+
values.push({ target, deployment });
|
|
492
|
+
groups.set(root, values);
|
|
493
|
+
}
|
|
494
|
+
for (const [root, entries] of groups) {
|
|
495
|
+
const first = entries[0];
|
|
496
|
+
const binding = first.deployment.plan.binding;
|
|
497
|
+
if (binding.platform !== 'codex' && binding.platform !== 'claude' && binding.platform !== 'copilot')
|
|
498
|
+
throw new Error('platformMarketplaceRouteUnsupported');
|
|
499
|
+
const marketplaceName = first.deployment.plan.evidence.layout.marketplaceName;
|
|
500
|
+
const previous = await readStrictNamespacedMarketplaceRoot({ rootDir: root, sourceId: binding.plugin.sourceId,
|
|
501
|
+
sourceIdentity: binding.plugin.sourceIdentity, marketplaceName, platform: binding.platform });
|
|
502
|
+
const candidates = [...new Map(entries.map(({ target }) => [target.plugin.manifest.name,
|
|
503
|
+
{ ...createMarketplaceManifestEntry(target.plugin), version: target.plugin.manifest.version }])).values()];
|
|
504
|
+
const descriptor = projectPlatformMarketplace({ binding, marketplaceName, entries: candidates });
|
|
505
|
+
const projected = JSON.parse(descriptor.bytes.toString('utf8'));
|
|
506
|
+
const previousEntries = previous?.manifest.plugins ?? [];
|
|
507
|
+
if (!Array.isArray(previousEntries))
|
|
508
|
+
throw new Error('marketplaceRootInvalid: plugins must be an array.');
|
|
509
|
+
const retained = previousEntries.filter((item) => {
|
|
510
|
+
if (!item || typeof item !== 'object' || !('name' in item) || typeof item.name !== 'string'
|
|
511
|
+
|| !('source' in item) || item.source !== `./plugins/${item.name}`
|
|
512
|
+
|| !/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(item.name))
|
|
513
|
+
throw new Error('marketplaceRootInvalid: an existing entry has an unverified location.');
|
|
514
|
+
return !candidates.some((candidate) => candidate.name === item.name);
|
|
515
|
+
});
|
|
516
|
+
if (!Array.isArray(projected.plugins))
|
|
517
|
+
throw new Error('platformMarketplaceProjectionInvalid');
|
|
518
|
+
projected.plugins = [...retained, ...projected.plugins].sort((left, right) => String(left.name).localeCompare(String(right.name)));
|
|
519
|
+
const contents = [{ relativePath: descriptor.relativePath, bytes: Buffer.from(`${JSON.stringify(projected, null, 2)}\n`) },
|
|
520
|
+
{ relativePath: 'config.json', bytes: Buffer.from(`${JSON.stringify({ schemaVersion: 2, sourceId: binding.plugin.sourceId,
|
|
521
|
+
sourceIdentity: binding.plugin.sourceIdentity, marketplaceName, logicalIdentity: first.target.plugin.catalogLogicalIdentity }, null, 2)}\n`) }];
|
|
522
|
+
const files = contents.map(({ relativePath, bytes }) => ({ relativePath, contentBase64: bytes.toString('base64'),
|
|
523
|
+
contentDigest: `sha256:${crypto.createHash('sha256').update(bytes).digest('hex')}` }));
|
|
524
|
+
const currentFingerprint = artifactValueDigest(await Promise.all(files.map((file) => pathEvidence(path.join(root, file.relativePath)))));
|
|
525
|
+
const previousGeneration = this.marketplaces.get(root);
|
|
526
|
+
const candidatesChanged = previousGeneration !== undefined
|
|
527
|
+
&& artifactValueDigest(previousGeneration.evidence.files) !== artifactValueDigest(files);
|
|
528
|
+
if (previousGeneration && (previousGeneration.currentFingerprint !== currentFingerprint
|
|
529
|
+
|| candidatesChanged && (this.marketplaceCandidatesFrozen || previousGeneration.publication))) {
|
|
530
|
+
throw new Error('operationPlanStale: the shared marketplace generation changed.');
|
|
531
|
+
}
|
|
532
|
+
// Scope plans can arrive separately during preparation. Complete the same
|
|
533
|
+
// generation before Review; once frozen or published, its bytes cannot grow.
|
|
534
|
+
const evidence = previousGeneration && !candidatesChanged ? previousGeneration.evidence
|
|
535
|
+
: { files, fingerprint: artifactValueDigest({ currentFingerprint, files }) };
|
|
536
|
+
this.marketplaces.set(root, previousGeneration && !candidatesChanged ? previousGeneration : { evidence, currentFingerprint });
|
|
537
|
+
for (const { target, deployment } of entries) {
|
|
538
|
+
const adapter = this.adapterFor(deployment.plan.binding.platform);
|
|
539
|
+
const next = adapter.lifecycle.prepare({ ...deployment.plan, observation: deployment.driverState.before,
|
|
540
|
+
evidence: { ...deployment.plan.evidence, marketplace: evidence } });
|
|
541
|
+
if (next.status !== 'ready')
|
|
542
|
+
throw new Error('operationPlanStale: the marketplace generation could not be sealed.');
|
|
543
|
+
const prepared = target.platformDeployment;
|
|
544
|
+
prepared.deployments.splice(prepared.deployments.indexOf(deployment), 1, next.prepared);
|
|
545
|
+
prepared.plans.splice(prepared.plans.findIndex((plan) => plan.binding.id === deployment.plan.binding.id), 1, next.prepared.plan);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
for (const target of targets)
|
|
549
|
+
if (target.platformDeployment) {
|
|
550
|
+
target.nativeToolChanges = await target.platformDeployment.captureNativeToolChanges();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
async verifyMarketplace(plan) {
|
|
554
|
+
if (!plan.evidence.layout.marketplaceRoot || !plan.evidence.marketplace)
|
|
555
|
+
return true;
|
|
556
|
+
const root = plan.evidence.layout.marketplaceRoot;
|
|
557
|
+
const generation = this.marketplaces.get(root);
|
|
558
|
+
return !!generation && artifactValueDigest(await Promise.all(generation.evidence.files.map((file) => pathEvidence(path.join(root, file.relativePath))))) === generation.currentFingerprint;
|
|
559
|
+
}
|
|
560
|
+
async publishMarketplace(plan) {
|
|
561
|
+
const root = plan.evidence.layout.marketplaceRoot;
|
|
562
|
+
if (!root)
|
|
563
|
+
return;
|
|
564
|
+
const generation = this.marketplaces.get(root);
|
|
565
|
+
if (!generation || !plan.evidence.marketplace)
|
|
566
|
+
throw new Error('marketplaceGenerationNotPrepared');
|
|
567
|
+
if (!generation.publication)
|
|
568
|
+
generation.publication = (async () => {
|
|
569
|
+
if (!await this.verifyMarketplace(plan))
|
|
570
|
+
throw new Error('operationPlanStale: the marketplace source changed.');
|
|
571
|
+
for (const file of generation.evidence.files) {
|
|
572
|
+
await atomicReplaceSafeFile({ filePath: path.join(root, file.relativePath), allowedRoot: root,
|
|
573
|
+
content: Buffer.from(file.contentBase64, 'base64').toString('utf8'), label: 'Native marketplace source' });
|
|
574
|
+
}
|
|
575
|
+
generation.currentFingerprint = artifactValueDigest(await Promise.all(generation.evidence.files.map((file) => pathEvidence(path.join(root, file.relativePath)))));
|
|
576
|
+
})();
|
|
577
|
+
await generation.publication;
|
|
578
|
+
}
|
|
579
|
+
async buildTarget(input) {
|
|
580
|
+
if (input.readOnlyInspectionPlan)
|
|
581
|
+
return this.build(input);
|
|
582
|
+
const key = this.key(input);
|
|
583
|
+
let verifyInitial;
|
|
584
|
+
let target = this.targets.get(key);
|
|
585
|
+
if (!target) {
|
|
586
|
+
target = this.build(input, (check) => { verifyInitial = check; });
|
|
587
|
+
this.targets.set(key, target);
|
|
588
|
+
}
|
|
589
|
+
const result = await target;
|
|
590
|
+
if (verifyInitial)
|
|
591
|
+
await verifyInitial();
|
|
592
|
+
else
|
|
593
|
+
await result.platformDeployment?.verify();
|
|
594
|
+
return result;
|
|
595
|
+
}
|
|
596
|
+
async build(input, receiveInitialVerifier) {
|
|
597
|
+
const resolution = await this.resolve(input);
|
|
598
|
+
if (!resolution.bindings.length)
|
|
599
|
+
throw Object.assign(new Error(`platformUnavailable: ${resolution.exclusions.map((item) => item.reasonCode).join(', ') || input.platform}`), { deploymentExclusions: this.exclusions.get(this.key(input)) ?? [] });
|
|
600
|
+
const adapter = this.adapterFor(input.platform);
|
|
601
|
+
// An activation-only Project action restores access to its existing User provider.
|
|
602
|
+
const requireIndependentActivation = input.platform !== 'codex' || !isNativeActivationOnlyTarget(this.context, {
|
|
603
|
+
pluginId: sourceIdentity(input).pluginId, platform: input.platform, scope: input.scope,
|
|
604
|
+
});
|
|
605
|
+
const ctx = this.nativeReadContext(input);
|
|
606
|
+
this.contexts.add(ctx);
|
|
607
|
+
const observed = await Promise.all(resolution.bindings.map(async (binding) => ({ binding, observation: await adapter.inspect(ctx, binding), layout: await getDeploymentLayout(ctx, binding) })));
|
|
608
|
+
if (input.readOnlyInspectionPlan && !input.readOnlyShallowInspectionPlan)
|
|
609
|
+
for (const entry of observed) {
|
|
610
|
+
const unit = entry.layout.renderUnits.find((candidate) => candidate.output === 'supplement');
|
|
611
|
+
if (!unit)
|
|
612
|
+
continue;
|
|
613
|
+
const expected = await normalizeStaticPluginComponents({ pluginRoot: input.plugin.rootDir, manifest: input.plugin.manifest,
|
|
614
|
+
platform: input.platform, capabilities: adapter.capabilities({ binding: entry.binding, renderUnit: unit,
|
|
615
|
+
observation: entry.observation, profile: getQualifiedPlatformProfile(input.platform) }), allowedOutputKinds: unit.kinds });
|
|
616
|
+
const supplements = await inspectStaticSupplements(ctx, entry.binding, expected.components);
|
|
617
|
+
entry.observation.components.push(...supplements.components);
|
|
618
|
+
}
|
|
619
|
+
const owned = observed.flatMap(({ binding, layout }) => [deploymentPackageComponent(binding, layout),
|
|
620
|
+
...(input.readOnlyInspectionPlan ? staticSupplementFiles(binding, layout, input.plugin.manifest) : [])]);
|
|
621
|
+
const target = { plugin: input.plugin, identity: targetIdentity(input), ownedComponents: owned,
|
|
622
|
+
platformObservations: observed.map(({ binding, observation }) => ({ binding, observation })),
|
|
623
|
+
desiredOwnedComponents: owned, requiresNative: false, writeNativeRequired: false, artifacts: [], preApplySource: input.plugin,
|
|
624
|
+
deploymentExclusions: this.exclusions.get(this.key(input)) ?? [] };
|
|
625
|
+
if (input.readOnlyInspectionPlan)
|
|
626
|
+
return target;
|
|
627
|
+
const removing = operation(input) === 'remove' || operation(input) === 'cleanup';
|
|
628
|
+
const preparedUnits = new Map();
|
|
629
|
+
if (!removing)
|
|
630
|
+
for (const unit of resolution.renderUnits) {
|
|
631
|
+
const bindingEntry = observed.find(({ binding }) => binding.renderUnitIds.includes(unit.id));
|
|
632
|
+
if (!bindingEntry)
|
|
633
|
+
throw new Error('deploymentRenderUnitUnbound');
|
|
634
|
+
const compatible = (await Promise.allSettled([...this.resolutions.values()])).flatMap((result) => result.status === 'fulfilled' ? result.value.renderUnits : []).filter((item) => item.physicalKey === unit.physicalKey);
|
|
635
|
+
if (compatible.some((item) => artifactValueDigest({ scope: item.renderScope, kinds: item.kinds, output: item.output })
|
|
636
|
+
!== artifactValueDigest({ scope: unit.renderScope, kinds: unit.kinds, output: unit.output })))
|
|
637
|
+
throw new Error('shared-projection-conflict');
|
|
638
|
+
const commonUnit = { ...unit, consumers: [...new Map(compatible.flatMap((item) => item.consumers).map((consumer) => [consumer.id, consumer])).values()] };
|
|
639
|
+
let promise = this.units.get(unit.physicalKey);
|
|
640
|
+
if (!promise) {
|
|
641
|
+
promise = (async () => {
|
|
642
|
+
const capabilities = adapter.capabilities({ ...bindingEntry, renderUnit: commonUnit, profile: getQualifiedPlatformProfile(input.platform) });
|
|
643
|
+
const config = await resolveArtifactRenderConfig({ ...sourceIdentity(input), logicalIdentity: input.plugin.catalogLogicalIdentity,
|
|
644
|
+
pluginName: input.plugin.manifest.name, manifest: input.plugin.manifest, platform: input.platform,
|
|
645
|
+
scope: unit.renderScope.kind, cwd: unit.renderScope.kind === 'project' ? unit.renderScope.projectRoot : input.cwd,
|
|
646
|
+
env: this.context.env, referencePlugins: this.context.referencePlugins });
|
|
647
|
+
const platformRoot = path.join(input.plugin.rootDir, input.platform);
|
|
648
|
+
const staticResourceRoot = await fs.pathExists(platformRoot) ? platformRoot : input.plugin.rootDir;
|
|
649
|
+
const prepared = await preparePlatformComponents({ plugin: input.plugin, platform: input.platform, staticResourceRoot,
|
|
650
|
+
renderScope: unit.renderScope.kind, kinds: unit.kinds, capabilities, config, cwd: input.cwd,
|
|
651
|
+
commandEnv: this.context.env, signal: this.context.signal, scriptTimeoutMs: this.context.scriptTimeoutMs,
|
|
652
|
+
preparedResults: this.context.preparedArtifactRenderResults });
|
|
653
|
+
const finalized = await finalizePlatformSkillProducers({ plugin: input.plugin, plugins: this.context.referencePlugins,
|
|
654
|
+
platform: input.platform, renderUnit: commonUnit, prepared, skillWorkRoot: path.join(await this.root(), artifactValueDigest(unit.physicalKey).slice(7), 'skills'),
|
|
655
|
+
cwd: input.cwd, env: this.context.env, signal: this.context.signal, scriptTimeoutMs: this.context.scriptTimeoutMs,
|
|
656
|
+
packagePreparationCache: this.context.packagePreparationCache });
|
|
657
|
+
return { unit: commonUnit, prepared: finalized.prepared, finalized,
|
|
658
|
+
evidenceInput: { renderUnit: commonUnit, capabilities, config } };
|
|
659
|
+
})();
|
|
660
|
+
this.units.set(unit.physicalKey, promise);
|
|
661
|
+
}
|
|
662
|
+
preparedUnits.set(unit.id, await promise);
|
|
663
|
+
}
|
|
664
|
+
const deployments = [];
|
|
665
|
+
const plans = [];
|
|
666
|
+
const blockedReceipts = [];
|
|
667
|
+
const cleanupResults = [];
|
|
668
|
+
const checks = new Map();
|
|
669
|
+
let initialDiscoveryCheck;
|
|
670
|
+
const priorProducers = new Map();
|
|
671
|
+
const priorResourceRoots = new Map();
|
|
672
|
+
const bindingRecoveryEvidence = [];
|
|
673
|
+
const emptyStates = new Map();
|
|
674
|
+
const inputDigests = new Map();
|
|
675
|
+
const supplementInputDigests = new Map();
|
|
676
|
+
const commandInventory = await listManagedCommands(this.context.env);
|
|
677
|
+
for (const entry of observed)
|
|
678
|
+
priorProducers.set(entry.binding.id, commandInventory.commands.flatMap((command) => {
|
|
679
|
+
if (command.owner.kind !== 'plugin')
|
|
680
|
+
return [];
|
|
681
|
+
const producer = command.owner.producer;
|
|
682
|
+
return producer.kind !== 'package' && producer.sourceId === entry.binding.plugin.sourceId
|
|
683
|
+
&& producer.sourceIdentity === entry.binding.plugin.sourceIdentity && producer.pluginName === input.plugin.manifest.name
|
|
684
|
+
&& producer.platform === entry.binding.platform && producer.placementKey === entry.binding.physicalKey ? [producer] : [];
|
|
685
|
+
}));
|
|
686
|
+
for (const entry of observed) {
|
|
687
|
+
const component = deploymentPackageComponent(entry.binding, entry.layout);
|
|
688
|
+
if (component.kind !== 'owned-directory')
|
|
689
|
+
continue;
|
|
690
|
+
const marker = await readSkillOwnerMarker({ skillRoot: component.path, allowedRoot: component.allowedRoot,
|
|
691
|
+
expectedIdentity: component.identity }).catch(() => null);
|
|
692
|
+
for (const mapping of marker?.nativeProjection?.components ?? []) {
|
|
693
|
+
if (!mapping.relativeOutputs.includes(`skills/${mapping.nativeName}/SKILL.md`))
|
|
694
|
+
continue;
|
|
695
|
+
const root = path.join(component.path, 'skills', mapping.nativeName);
|
|
696
|
+
const record = await readInstalledCommandProducer(root).catch(() => null);
|
|
697
|
+
const producer = record?.producer;
|
|
698
|
+
if (!producer || producer.kind === 'package' || producer.sourceId !== entry.binding.plugin.sourceId
|
|
699
|
+
|| producer.sourceIdentity !== entry.binding.plugin.sourceIdentity || producer.pluginName !== input.plugin.manifest.name
|
|
700
|
+
|| producer.platform !== entry.binding.platform || producer.placementKey !== entry.binding.physicalKey
|
|
701
|
+
|| mapping.id !== (producer.kind === 'static-skill' ? `skill:${producer.key}` : producer.key))
|
|
702
|
+
continue;
|
|
703
|
+
priorProducers.get(entry.binding.id).push(producer);
|
|
704
|
+
priorResourceRoots.set(entry.binding.id, [...priorResourceRoots.get(entry.binding.id) ?? [], root]);
|
|
705
|
+
if (!removing) {
|
|
706
|
+
// An unreadable index has no authority. Only the installed canonical
|
|
707
|
+
// producer and its owned resources can establish its former identity.
|
|
708
|
+
const recovery = await captureManagedCommandBindingRecoveryEvidence({ producer, resourceRoot: root,
|
|
709
|
+
env: this.context.env }).catch(() => null);
|
|
710
|
+
if (recovery)
|
|
711
|
+
bindingRecoveryEvidence.push(recovery);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
await assertManagedCommandBindingIdentities({ producers: [...preparedUnits.values()].flatMap((unit) => unit.finalized.commandCandidates),
|
|
716
|
+
env: this.context.env, bindingRecoveryEvidence });
|
|
717
|
+
for (const entry of observed) {
|
|
718
|
+
const units = entry.binding.renderUnitIds.flatMap((id) => preparedUnits.has(id) ? [preparedUnits.get(id)] : []);
|
|
719
|
+
const projections = [];
|
|
720
|
+
for (const unit of units) {
|
|
721
|
+
const sameScope = units.filter((candidate) => artifactValueDigest(candidate.unit.renderScope) === artifactValueDigest(unit.unit.renderScope));
|
|
722
|
+
const components = mergeExpectedComponentSets(sameScope.map((candidate) => candidate.prepared.expected)).components;
|
|
723
|
+
const resources = { resources: sameScope.flatMap((candidate) => candidate.prepared.resources.resources),
|
|
724
|
+
bundleFiles: sameScope.flatMap((candidate) => candidate.prepared.resources.bundleFiles),
|
|
725
|
+
files: sameScope.flatMap((candidate) => candidate.prepared.resources.files),
|
|
726
|
+
commandResources: sameScope.flatMap((candidate) => candidate.prepared.resources.commandResources),
|
|
727
|
+
digest: artifactValueDigest(sameScope.map((candidate) => candidate.prepared.resources.digest)) };
|
|
728
|
+
projections.push(await adapter.project({ ...ctx, stagingRoot: path.join(await this.root(), 'projection'), commandResolver: unit.finalized.commandResolver }, {
|
|
729
|
+
binding: entry.binding, renderUnit: unit.unit, capabilities: adapter.capabilities({ ...entry, renderUnit: unit.unit, profile: getQualifiedPlatformProfile(input.platform) }),
|
|
730
|
+
components, resources, policy: components.length ? resolveInvocationPolicy(input.plugin.manifest, input.platform) : { ...resolveInvocationPolicy(input.plugin.manifest, input.platform), permissions: [] }
|
|
731
|
+
}));
|
|
732
|
+
}
|
|
733
|
+
const policyKey = input.platform === 'codex' || input.platform === 'claude' ? await getInvocationPolicyPhysicalKey(ctx, entry.binding) : undefined;
|
|
734
|
+
const currentComponents = [deploymentPackageComponent(entry.binding, entry.layout),
|
|
735
|
+
...projections.flatMap((projection) => projection.supplements.map((contribution) => contributionComponent(entry.binding, contribution, policyKey && (contribution.mergeKey?.startsWith('claude-permissions:') || input.platform === 'codex' && contribution.destination.endsWith('.rules'))
|
|
736
|
+
? policyKey : entry.layout.renderUnits.find((unit) => unit.id === projection.renderUnitId).physicalKey)))];
|
|
737
|
+
const historical = await ownedSupplements(entry.binding, entry.layout.supplementRoot, entry.layout.renderUnits.find((unit) => unit.output === 'supplement')?.physicalKey);
|
|
738
|
+
if (entry.binding.platform === 'codex' && policyKey)
|
|
739
|
+
historical.push(...await ownedSupplements(entry.binding, path.join(entry.layout.activationPath, 'rules'), policyKey));
|
|
740
|
+
if (entry.binding.platform === 'claude' && policyKey) {
|
|
741
|
+
const destination = path.join(entry.layout.activationPath, entry.binding.scope.kind === 'project' ? 'settings.local.json' : 'settings.json');
|
|
742
|
+
historical.push(contributionComponent(entry.binding, { id: 'policy:claude-permissions', componentIds: [], kind: 'config-entry',
|
|
743
|
+
destination, contentDigest: '', stagingPath: '', mergeKey: `claude-permissions:${getDeploymentResourceKey(entry.binding.plugin)}` }, policyKey));
|
|
744
|
+
}
|
|
745
|
+
if (entry.binding.platform === 'cursor' && !projections.some((projection) => projection.supplements.some((item) => item.kind === 'config-entry'))) {
|
|
746
|
+
const component = contributionComponent(entry.binding, { id: 'cursor-workspace-open', componentIds: [], kind: 'config-entry',
|
|
747
|
+
destination: entry.layout.activationPath, stagingPath: '', contentDigest: '', mergeKey: `workspaceOpen:${getDeploymentResourceKey(entry.binding.plugin)}` }, entry.binding.physicalKey);
|
|
748
|
+
if (component.kind === 'shared-config' && component.locator.kind === 'cursor-workspace-hook')
|
|
749
|
+
component.locator.command = cursorWorkspaceOpenCommand(entry.binding, ctx.platform);
|
|
750
|
+
historical.push(component);
|
|
751
|
+
}
|
|
752
|
+
const components = [...currentComponents, ...historical.filter((component) => !currentComponents.some((current) => 'path' in current && 'path' in component && current.path === component.path
|
|
753
|
+
|| current.kind === 'shared-config' && component.kind === 'shared-config' && artifactValueDigest(current.locator) === artifactValueDigest(component.locator)))];
|
|
754
|
+
for (const component of components)
|
|
755
|
+
if (component.kind === 'shared-config' && component.locator.kind === 'cursor-workspace-hook') {
|
|
756
|
+
const locator = component.locator;
|
|
757
|
+
const contribution = projections.flatMap((projection) => projection.supplements).find((item) => item.destination === locator.hooksPath);
|
|
758
|
+
if (!contribution)
|
|
759
|
+
continue;
|
|
760
|
+
const { entries } = cursorHooks(await jsonObject(contribution.stagingPath));
|
|
761
|
+
const command = entries.map(cursorHookEntryCommand).find((value) => value !== undefined);
|
|
762
|
+
if (!command)
|
|
763
|
+
throw new Error('cursorWorkspaceHookInvalid');
|
|
764
|
+
component.locator.command = command;
|
|
765
|
+
}
|
|
766
|
+
const inspected = await inspectOwnedComponents({ components, executor: this.ownership });
|
|
767
|
+
const managedCommandReview = await captureManagedCommandReviewEvidence({ binding: entry.binding,
|
|
768
|
+
renderUnits: entry.layout.renderUnits, components: units.flatMap((unit) => unit.prepared.expected.components), projections });
|
|
769
|
+
const currentMutable = async () => {
|
|
770
|
+
const observation = await adapter.inspect(ctx, entry.binding);
|
|
771
|
+
return { observation, references: await sharedReferences(this.context, entry.binding, observation, entry.layout),
|
|
772
|
+
geminiActivation: entry.binding.route === 'gemini-extension' ? geminiActivationEvidence(await readGeminiActivationSnapshot(ctx)) : undefined,
|
|
773
|
+
paths: await Promise.all(components.map(async (component) => 'path' in component ? pathEvidence(component.path) : {
|
|
774
|
+
ownership: await inspectOwnedComponents({ components: [component], executor: this.ownership }), contentDigest: await ownedContentDigest(component),
|
|
775
|
+
})) };
|
|
776
|
+
};
|
|
777
|
+
const fingerprintParts = async (discovery) => ({
|
|
778
|
+
managedCommandReview,
|
|
779
|
+
source: removing ? null : await pathEvidence(input.plugin.rootDir),
|
|
780
|
+
discovery: discovery ? discovery.value : removing ? { consumers: entry.binding.consumers, executables: await Promise.all(entry.binding.consumers.map((consumer) => consumer.entry?.kind === 'cli' ? pathEvidence(consumer.entry.executable) : null)) } : await adapter.discover(ctx),
|
|
781
|
+
sharedReferenceView: this.context.sharedReferenceView,
|
|
782
|
+
layout: await getDeploymentLayout(ctx, entry.binding),
|
|
783
|
+
config: await Promise.all(units.map((unit) => resolveArtifactRenderConfig({ ...sourceIdentity(input), pluginName: input.plugin.manifest.name,
|
|
784
|
+
logicalIdentity: input.plugin.catalogLogicalIdentity, manifest: input.plugin.manifest, platform: input.platform,
|
|
785
|
+
scope: unit.unit.renderScope.kind, cwd: input.cwd, env: this.context.env, referencePlugins: this.context.referencePlugins }))),
|
|
786
|
+
staging: await Promise.all(projections.map(async (projection) => ({
|
|
787
|
+
bundle: projection.bundle ? await pathEvidence(projection.bundle.stagingRoot) : null,
|
|
788
|
+
supplements: await Promise.all(projection.supplements.map((contribution) => pathEvidence(contribution.stagingPath))),
|
|
789
|
+
}))),
|
|
790
|
+
});
|
|
791
|
+
// Discovery and inspection are independent reads for these routes. Settle
|
|
792
|
+
// both before comparing or throwing, while preserving immutable priority.
|
|
793
|
+
const parallelNativeReads = ['gemini-extension', 'copilot-marketplace', 'pi-package'].includes(entry.binding.route);
|
|
794
|
+
const initialReads = parallelNativeReads
|
|
795
|
+
? await Promise.allSettled([fingerprintParts(), currentMutable()]) : null;
|
|
796
|
+
if (initialReads?.[0].status === 'rejected')
|
|
797
|
+
throw initialReads[0].reason;
|
|
798
|
+
const initialParts = initialReads?.[0].status === 'fulfilled' ? initialReads[0].value : await fingerprintParts();
|
|
799
|
+
const initial = artifactValueDigest(initialParts);
|
|
800
|
+
const fingerprint = async (discovery) => artifactValueDigest(await fingerprintParts(discovery));
|
|
801
|
+
if (initialReads?.[1].status === 'rejected')
|
|
802
|
+
throw initialReads[1].reason;
|
|
803
|
+
let mutableBaseline = initialReads?.[1].status === 'fulfilled' ? initialReads[1].value : await currentMutable();
|
|
804
|
+
const preparationObservation = entry.binding.route === 'gemini-extension' || entry.binding.route === 'antigravity-cli'
|
|
805
|
+
? mutableBaseline.observation : entry.observation;
|
|
806
|
+
const check = async (discovery) => {
|
|
807
|
+
if (!parallelNativeReads)
|
|
808
|
+
return await fingerprint(discovery) === initial
|
|
809
|
+
&& artifactValueDigest(await currentMutable()) === artifactValueDigest(mutableBaseline);
|
|
810
|
+
const [immutableRead, mutableRead] = await Promise.allSettled([fingerprint(discovery), currentMutable()]);
|
|
811
|
+
if (immutableRead.status === 'rejected')
|
|
812
|
+
throw immutableRead.reason;
|
|
813
|
+
if (immutableRead.value !== initial)
|
|
814
|
+
return false;
|
|
815
|
+
if (mutableRead.status === 'rejected')
|
|
816
|
+
throw mutableRead.reason;
|
|
817
|
+
return artifactValueDigest(mutableRead.value) === artifactValueDigest(mutableBaseline);
|
|
818
|
+
};
|
|
819
|
+
checks.set(entry.binding.id, () => check());
|
|
820
|
+
if (resolution.bindings.length === 1 && ['gemini-extension', 'pi-package'].includes(entry.binding.route)) {
|
|
821
|
+
initialDiscoveryCheck = () => check({ value: initialParts.discovery });
|
|
822
|
+
}
|
|
823
|
+
this.mutableChecks.set(entry.binding.id, { physicalKey: entry.binding.physicalKey,
|
|
824
|
+
marketplaceRoot: entry.layout.marketplaceRoot, sourceId: entry.binding.plugin.sourceId,
|
|
825
|
+
sourceIdentity: entry.binding.plugin.sourceIdentity,
|
|
826
|
+
...(entry.binding.route === 'gemini-extension' ? { geminiActivationSnapshot: () => mutableBaseline.geminiActivation } : {}),
|
|
827
|
+
assertStable: async () => {
|
|
828
|
+
if (!await checks.get(entry.binding.id)())
|
|
829
|
+
throw new Error('operationPlanStale: deployment evidence changed before source registration.');
|
|
830
|
+
},
|
|
831
|
+
acceptMarketplaceRegistration: async () => {
|
|
832
|
+
const current = await currentMutable();
|
|
833
|
+
if (artifactValueDigest(current) === artifactValueDigest(mutableBaseline))
|
|
834
|
+
return;
|
|
835
|
+
const withoutRegistration = { ...current, observation: { ...current.observation,
|
|
836
|
+
registration: mutableBaseline.observation.registration } };
|
|
837
|
+
const onlyRegistration = mutableBaseline.observation.registration === 'absent' && current.observation.registration === 'present'
|
|
838
|
+
&& artifactValueDigest(withoutRegistration) === artifactValueDigest(mutableBaseline);
|
|
839
|
+
const onlyMarketplace = ['codex-marketplace', 'claude-marketplace'].includes(entry.binding.route)
|
|
840
|
+
&& current.observation.configuration?.marketplace === 'canonical'
|
|
841
|
+
&& mutableBaseline.observation.configuration?.marketplace === 'absent'
|
|
842
|
+
&& (current.observation.registration === mutableBaseline.observation.registration
|
|
843
|
+
|| mutableBaseline.observation.registration === 'absent' && current.observation.registration === 'present')
|
|
844
|
+
&& artifactValueDigest({ ...withoutRegistration, observation: { ...withoutRegistration.observation,
|
|
845
|
+
configuration: { ...current.observation.configuration, marketplace: mutableBaseline.observation.configuration.marketplace },
|
|
846
|
+
} }) === artifactValueDigest(mutableBaseline);
|
|
847
|
+
if ((!onlyRegistration && !onlyMarketplace) || await fingerprint() !== initial) {
|
|
848
|
+
throw new Error('operationPlanStale: deployment evidence changed during source registration.');
|
|
849
|
+
}
|
|
850
|
+
// This is the one shared observation changed by our confirmed source
|
|
851
|
+
// registration. The reviewed package, references and bytes stay frozen.
|
|
852
|
+
mutableBaseline = current;
|
|
853
|
+
},
|
|
854
|
+
rebase: async (geminiExpected) => {
|
|
855
|
+
const reads = parallelNativeReads
|
|
856
|
+
? await Promise.allSettled([fingerprintParts(), currentMutable()]) : null;
|
|
857
|
+
if (reads?.[0].status === 'rejected')
|
|
858
|
+
throw reads[0].reason;
|
|
859
|
+
const current = reads?.[0].status === 'fulfilled' ? reads[0].value : await fingerprintParts();
|
|
860
|
+
if (artifactValueDigest(current) !== initial) {
|
|
861
|
+
const changed = Object.keys(initialParts)
|
|
862
|
+
.filter((key) => artifactValueDigest(current[key]) !== artifactValueDigest(initialParts[key]));
|
|
863
|
+
throw new Error(`operationPlanStale: immutable deployment input changed (${changed.join(', ')}).`);
|
|
864
|
+
}
|
|
865
|
+
if (reads?.[1].status === 'rejected')
|
|
866
|
+
throw reads[1].reason;
|
|
867
|
+
const mutable = reads?.[1].status === 'fulfilled' ? reads[1].value : await currentMutable();
|
|
868
|
+
if (artifactValueDigest(mutable.geminiActivation ?? null) !== artifactValueDigest(geminiExpected ?? mutableBaseline.geminiActivation ?? null)) {
|
|
869
|
+
throw new Error('operationPlanStale: Gemini activation changed outside the checked native mutation.');
|
|
870
|
+
}
|
|
871
|
+
mutableBaseline = mutable;
|
|
872
|
+
} });
|
|
873
|
+
const evidence = { fingerprint: initial, managedCommandReview, layout: entry.layout, renderUnits: entry.layout.renderUnits,
|
|
874
|
+
ownership: await Promise.all(inspected.components.map(async ({ component, state }) => ({ component, state,
|
|
875
|
+
contentDigest: state === 'present' ? await ownedContentDigest(component) : undefined,
|
|
876
|
+
physicalKey: component.identity.physicalKey ?? entry.binding.physicalKey }))),
|
|
877
|
+
sharedReferences: await sharedReferences(this.context, entry.binding, preparationObservation, entry.layout),
|
|
878
|
+
nativeIdentity: preparationObservation.nativeIdentity ?? entry.layout.nativeIdentity,
|
|
879
|
+
contentMatches: projections.some((projection) => projection.bundle !== null)
|
|
880
|
+
&& await readPlatformPackageContentDigest(entry.layout.packageRoot) === projections.find((projection) => projection.bundle !== null)?.bundle?.contentDigest };
|
|
881
|
+
if (entry.binding.platform === 'codex') {
|
|
882
|
+
const hostEntry = entry.binding.consumers.find((consumer) => consumer.entry?.kind === 'cli'
|
|
883
|
+
|| removing && consumer.entry?.kind === 'directory')?.entry;
|
|
884
|
+
if (!hostEntry || hostEntry.kind === 'generic')
|
|
885
|
+
throw new Error('nativeActivationEvidenceUnknown');
|
|
886
|
+
const config = await readCodexConfigFile(path.join(hostEntry.configRoot, 'config.toml'));
|
|
887
|
+
evidence.userActivationEnabled = config.snapshot.plugins[entry.layout.nativeIdentity.registrationId]?.enabled === true;
|
|
888
|
+
}
|
|
889
|
+
if (entry.binding.platform === 'copilot') {
|
|
890
|
+
const hostEntry = entry.binding.consumers.find((consumer) => consumer.entry?.kind === 'cli')?.entry;
|
|
891
|
+
if (hostEntry?.kind === 'cli') {
|
|
892
|
+
const settings = await jsonObject(path.join(hostEntry.configRoot, 'settings.json'));
|
|
893
|
+
const enabled = settings.enabledPlugins;
|
|
894
|
+
evidence.userActivationEnabled = enabled === undefined ? false : enabled && typeof enabled === 'object' && !Array.isArray(enabled)
|
|
895
|
+
? enabled[entry.layout.nativeIdentity.registrationId] === true : 'unknown';
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
if (entry.binding.route === 'gemini-extension') {
|
|
899
|
+
evidence.userActivationEnabled = 'unknown';
|
|
900
|
+
const view = this.context.sharedReferenceView;
|
|
901
|
+
try {
|
|
902
|
+
const snapshot = await readGeminiActivationSnapshot(ctx, mutableBaseline.geminiActivation);
|
|
903
|
+
const rules = geminiActivationRules(snapshot, entry.layout.nativeIdentity.packageId);
|
|
904
|
+
await assertGeminiProjectRules(ctx, entry.binding, rules);
|
|
905
|
+
const actual = geminiUserActivation(snapshot, entry.layout.nativeIdentity.packageId, geminiExtensionPaths(ctx).home);
|
|
906
|
+
if (actual !== 'unknown' && preparationObservation.registration !== 'unknown'
|
|
907
|
+
&& (entry.binding.scope.kind === 'user' || view?.desiredComplete && view.scopes.includes('user'))) {
|
|
908
|
+
// Shared User renderScope does not establish User demand. A fresh
|
|
909
|
+
// project starts disabled globally; an existing global intent stays.
|
|
910
|
+
evidence.userActivationEnabled = preparationObservation.registration === 'present' ? actual : entry.binding.scope.kind === 'user'
|
|
911
|
+
|| view?.desired.some((reference) => reference.scope === 'user' && reference.platform === 'gemini'
|
|
912
|
+
&& reference.pluginId === entry.binding.plugin.pluginId && reference.sourceIdentity === entry.binding.plugin.sourceIdentity) === true;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
catch { /* Invalid or ambiguous native configuration remains blocked. */ }
|
|
916
|
+
}
|
|
917
|
+
if (entry.binding.scope.kind === 'project' && ['codex', 'copilot', 'gemini'].includes(entry.binding.platform)) {
|
|
918
|
+
const plannedUser = [...this.requestedOperations.values()].find((request) => request.scope === 'user'
|
|
919
|
+
&& request.platform === input.platform && sourceIdentity(request).sourceIdentity === entry.binding.plugin.sourceIdentity
|
|
920
|
+
&& sourceIdentity(request).pluginId === entry.binding.plugin.pluginId);
|
|
921
|
+
if (plannedUser && (entry.binding.platform !== 'gemini' || typeof evidence.userActivationEnabled === 'boolean')) {
|
|
922
|
+
evidence.userActivationEnabled = !['remove', 'cleanup'].includes(operation(plannedUser));
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
const expected = mergeExpectedComponentSets(units.map((unit) => unit.prepared.expected));
|
|
926
|
+
evidence.retainPackage = !removing && expected.unmet.length > 0 && inspected.components.some((slot) => 'path' in slot.component && slot.component.path === entry.layout.packageRoot && ['present', 'partial'].includes(slot.state));
|
|
927
|
+
if (!removing) {
|
|
928
|
+
const inputEvidence = await createPlatformInputEvidence({ plugin: input.plugin, binding: entry.binding, units: units.map((unit) => unit.evidenceInput) });
|
|
929
|
+
inputDigests.set(entry.binding.id, platformPackageInputDigest(inputEvidence));
|
|
930
|
+
if (expected.unmet.length === 0) {
|
|
931
|
+
if (expected.components.length === 0) {
|
|
932
|
+
emptyStates.set(entry.binding.id, { ...inputEvidence, kind: 'aw-platform-empty-state', result: 'intentional-empty' });
|
|
933
|
+
}
|
|
934
|
+
else if (entry.layout.supplementRoot && input.plugin.manifest.artifacts) {
|
|
935
|
+
const supplement = inputEvidence.units.find((unit) => unit.output === 'supplement');
|
|
936
|
+
if (supplement) {
|
|
937
|
+
supplementInputDigests.set(entry.binding.id, supplement.inputDigest);
|
|
938
|
+
if (entry.binding.route === 'codex-marketplace' && !projections.some((projection) => projection.bundle)) {
|
|
939
|
+
emptyStates.set(entry.binding.id, { ...inputEvidence, kind: 'aw-platform-empty-state', result: 'intentional-empty',
|
|
940
|
+
units: inputEvidence.units.filter((unit) => unit.output === 'package') });
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
const result = adapter.lifecycle.prepare({ operation: operation(input), binding: entry.binding, observation: preparationObservation,
|
|
947
|
+
projections, expected, evidence });
|
|
948
|
+
if (result.status === 'blocked') {
|
|
949
|
+
plans.push({ operation: operation(input), binding: entry.binding, projections, expected, evidence, effects: [] });
|
|
950
|
+
blockedReceipts.push({ bindingId: entry.binding.id, effects: [], after: preparationObservation,
|
|
951
|
+
unmet: expected.unmet.map((gap) => ({ ...gap, productIds: entry.binding.consumers.map((consumer) => consumer.id) })),
|
|
952
|
+
reload: 'none', diagnostics: result.diagnostics });
|
|
953
|
+
}
|
|
954
|
+
else {
|
|
955
|
+
deployments.push(result.prepared);
|
|
956
|
+
plans.push(result.prepared.plan);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
target.ownedComponents = plans.flatMap((plan) => plan.evidence.ownership.map((item) => item.component));
|
|
960
|
+
target.desiredOwnedComponents = target.ownedComponents;
|
|
961
|
+
let frozenNativeTools;
|
|
962
|
+
const verifyChecks = async (selected) => {
|
|
963
|
+
for (const check of selected)
|
|
964
|
+
if (!await check())
|
|
965
|
+
throw new Error('operationPlanStale: deployment evidence changed.');
|
|
966
|
+
for (const plan of plans)
|
|
967
|
+
if (!await this.verifyMarketplace(plan))
|
|
968
|
+
throw new Error('operationPlanStale: marketplace evidence changed.');
|
|
969
|
+
};
|
|
970
|
+
const verify = () => verifyChecks(checks.values());
|
|
971
|
+
const canVerifyAtExecution = () => {
|
|
972
|
+
const prepared = deployments[0];
|
|
973
|
+
if (!prepared || deployments.length !== 1 || plans.length !== 1 || plans[0] !== prepared.plan || blockedReceipts.length
|
|
974
|
+
|| target.operationActions === undefined || target.operationActions.some((action) => action.kind === 'runPreApply' || action.kind === 'syncManagedCommandPackage'))
|
|
975
|
+
return false;
|
|
976
|
+
const { plan, driverState } = prepared;
|
|
977
|
+
const hiddenEmptyPiProject = piProjectRegistrationHidden(plan.binding, driverState.before)
|
|
978
|
+
&& driverState.before.package === 'absent' && driverState.before.ownership === 'absent'
|
|
979
|
+
&& plan.evidence.sharedReferences === 'none' && plan.evidence.ownership.every((item) => item.state === 'absent')
|
|
980
|
+
&& plan.effects.every((effect) => ['publish-package', 'register'].includes(effect.kind));
|
|
981
|
+
return plan.operation === 'ensure' && ['gemini-extension', 'copilot-marketplace', 'pi-package'].includes(plan.binding.route)
|
|
982
|
+
&& plan.binding.platform === target.identity.platform && plan.expected.components.length > 0 && !plan.expected.unmet.length
|
|
983
|
+
&& driverState.before.package !== 'unknown' && (driverState.before.registration !== 'unknown' || hiddenEmptyPiProject)
|
|
984
|
+
&& ['absent', 'aw', 'shared'].includes(driverState.before.ownership)
|
|
985
|
+
&& plan.effects.every((effect) => ['publish-package', 'register', 'refresh', 'activate'].includes(effect.kind));
|
|
986
|
+
};
|
|
987
|
+
target.platformDeployment = { deployments, plans, blockedReceipts, cleanupResults,
|
|
988
|
+
canVerifyAtExecution,
|
|
989
|
+
captureNativeToolChanges: async () => {
|
|
990
|
+
const signature = artifactValueDigest(deployments.map(({ plan }) => ({ bindingId: plan.binding.id,
|
|
991
|
+
retainPackage: plan.evidence.retainPackage, effects: plan.effects })));
|
|
992
|
+
if (frozenNativeTools?.signature === signature)
|
|
993
|
+
return frozenNativeTools.changes;
|
|
994
|
+
const changes = [];
|
|
995
|
+
for (const { plan } of deployments) {
|
|
996
|
+
const root = plan.evidence.layout.packageRoot;
|
|
997
|
+
const publishes = plan.effects.some((effect) => effect.kind === 'publish-package' && effect.destination === root);
|
|
998
|
+
const removes = plan.effects.some((effect) => effect.kind === 'remove-owned' && effect.destination === root);
|
|
999
|
+
if (plan.evidence.retainPackage || !publishes && !removes)
|
|
1000
|
+
continue;
|
|
1001
|
+
const next = publishes ? [...preparedUnits.values()].flatMap((unit) => unit.finalized.commandCandidates)
|
|
1002
|
+
.filter((candidate) => candidate.producer.kind !== 'package' && candidate.producer.placementKey === plan.binding.physicalKey) : [];
|
|
1003
|
+
changes.push(...await captureNativeToolChanges({ actions: [],
|
|
1004
|
+
producers: [...priorProducers.get(plan.binding.id) ?? [], ...next.map((candidate) => candidate.producer)],
|
|
1005
|
+
nextProducers: next, removed: removes, env: this.context.env,
|
|
1006
|
+
resourceRoots: [...priorResourceRoots.get(plan.binding.id) ?? [], ...(removes ? [root] : [])] }));
|
|
1007
|
+
}
|
|
1008
|
+
frozenNativeTools = { signature, changes };
|
|
1009
|
+
return changes;
|
|
1010
|
+
},
|
|
1011
|
+
verify,
|
|
1012
|
+
postcheck: async (receipts, options) => {
|
|
1013
|
+
let incomplete = false;
|
|
1014
|
+
for (const { plan } of deployments) {
|
|
1015
|
+
if (!['ensure', 'reinstall'].includes(plan.operation) || !plan.expected.components.length)
|
|
1016
|
+
continue;
|
|
1017
|
+
const receipt = receipts.find((entry) => entry.bindingId === plan.binding.id);
|
|
1018
|
+
if (!receipt)
|
|
1019
|
+
continue;
|
|
1020
|
+
const after = options?.refresh ? await adapter.inspect(ctx, plan.binding) : receipt.after;
|
|
1021
|
+
const supplementFiles = plan.projections.filter((projection) => plan.evidence.renderUnits?.some((unit) => unit.id === projection.renderUnitId && unit.output === 'supplement')).flatMap((projection) => projection.supplements
|
|
1022
|
+
.filter((contribution) => contribution.kind === 'owned-file'));
|
|
1023
|
+
const supplementIds = new Set(supplementFiles.flatMap((contribution) => contribution.componentIds));
|
|
1024
|
+
const supplements = await inspectStaticSupplements(ctx, plan.binding, plan.expected.components.filter((component) => supplementIds.has(component.id)));
|
|
1025
|
+
after.components = [...after.components.filter((component) => !supplementIds.has(component.id)), ...supplements.components];
|
|
1026
|
+
if (options?.refresh) {
|
|
1027
|
+
receipt.after = after;
|
|
1028
|
+
receipt.diagnostics.push(...after.diagnostics);
|
|
1029
|
+
}
|
|
1030
|
+
const packageIds = new Set(plan.projections.filter((projection) => projection.bundle)
|
|
1031
|
+
.flatMap((projection) => projection.components.map((component) => component.id)));
|
|
1032
|
+
const bundle = plan.projections.find((projection) => projection.bundle)?.bundle;
|
|
1033
|
+
const requiredActivation = requiredDeploymentActivation(plan.binding, after, requireIndependentActivation);
|
|
1034
|
+
if (!requireIndependentActivation && requiredActivation === 'enabled') {
|
|
1035
|
+
receipt.diagnostics = receipt.diagnostics.filter((entry) => entry.code !== 'codexProjectActivationUnconfirmed');
|
|
1036
|
+
}
|
|
1037
|
+
const nativeContentIncomplete = bundle && nativeCopyIncomplete(plan.binding, after, bundle.contentDigest);
|
|
1038
|
+
const packageIncomplete = bundle && (!packageDeliveryConfirmed(plan.binding, after, bundle.contentDigest, requireIndependentActivation)
|
|
1039
|
+
|| await readPlatformPackageContentDigest(plan.evidence.layout.packageRoot) !== bundle.contentDigest);
|
|
1040
|
+
const delivered = new Set(after.components.filter((component) => component.presence === 'present' && !component.reasonCodes.length)
|
|
1041
|
+
.map((component) => component.id));
|
|
1042
|
+
const gaps = plan.expected.components.filter((component) => packageIncomplete && packageIds.has(component.id) || !delivered.has(component.id));
|
|
1043
|
+
const inputDigest = supplementInputDigests.get(plan.binding.id);
|
|
1044
|
+
if (inputDigest && [...supplementIds].every((id) => delivered.has(id))
|
|
1045
|
+
&& !receipt.unmet.length && !receipt.diagnostics.some((diagnostic) => diagnostic.severity === 'error')) {
|
|
1046
|
+
try {
|
|
1047
|
+
await writePlatformSupplementState(ctx, plan.binding, inputDigest, supplementFiles.map((file) => ({
|
|
1048
|
+
id: file.id, fileName: path.basename(file.destination), contentDigest: file.contentDigest,
|
|
1049
|
+
})));
|
|
1050
|
+
const emptyPackage = emptyStates.get(plan.binding.id);
|
|
1051
|
+
if (!gaps.length && emptyPackage && after.package === 'absent' && after.registration === 'absent') {
|
|
1052
|
+
await writePlatformEmptyState({ state: emptyPackage, env: this.context.env });
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
catch {
|
|
1056
|
+
ctx.signal?.throwIfAborted();
|
|
1057
|
+
receipt.diagnostics.push({ code: 'componentOutputUnconfirmed', severity: 'warning',
|
|
1058
|
+
message: 'The scope-local supplemental output could not be recorded. Run sync to restore the status evidence.',
|
|
1059
|
+
subject: { target: plan.binding.platform, pluginId: plan.binding.plugin.pluginId, scope: plan.binding.scope.kind } });
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
if (!gaps.length)
|
|
1063
|
+
continue;
|
|
1064
|
+
incomplete = true;
|
|
1065
|
+
const code = plan.binding.route === 'grok-directory' && requiredActivation === 'blocked' ? 'grokProjectAuthorizationDenied'
|
|
1066
|
+
: plan.binding.route === 'codex-marketplace' && requireIndependentActivation && after.scopeActivation === 'unknown'
|
|
1067
|
+
? 'codexProjectActivationUnconfirmed'
|
|
1068
|
+
: nativeContentIncomplete ? 'nativeInstallContentPostcheckFailed' : 'deploymentPostcheckFailed';
|
|
1069
|
+
receipt.diagnostics.push({ code, severity: 'error',
|
|
1070
|
+
message: code === 'nativeInstallContentPostcheckFailed' && plan.binding.route === 'gemini-extension'
|
|
1071
|
+
? `The actual Gemini copy does not confirm the frozen package bytes. In the same workspace, review and run aw plugin sync ${plan.binding.plugin.pluginId} --context ${plan.binding.scope.kind} --target gemini --native-consent.`
|
|
1072
|
+
: code === 'nativeInstallContentPostcheckFailed'
|
|
1073
|
+
? 'The installed native copy does not confirm the frozen package bytes. Check status and sync the affected target.'
|
|
1074
|
+
: code === 'grokProjectAuthorizationDenied'
|
|
1075
|
+
? 'Grok denied authorization for the selected project. Review the project in Grok before syncing.'
|
|
1076
|
+
: code === 'codexProjectActivationUnconfirmed'
|
|
1077
|
+
? 'Codex reports effective activation but does not distinguish this project from User inheritance.'
|
|
1078
|
+
: 'The final observation does not confirm the requested deployment. Check status and sync the affected target.',
|
|
1079
|
+
subject: { target: plan.binding.platform, pluginId: plan.binding.plugin.pluginId, scope: plan.binding.scope.kind } });
|
|
1080
|
+
receipt.unmet.push(...gaps.map((component) => ({ id: `postcheck:${plan.binding.id}:${component.id}`,
|
|
1081
|
+
componentId: component.id, kind: component.kind, reasonCode: code, requiredFeatures: [],
|
|
1082
|
+
productIds: plan.binding.consumers.map((consumer) => consumer.id) })));
|
|
1083
|
+
}
|
|
1084
|
+
if (incomplete)
|
|
1085
|
+
throw new Error('deploymentPostcheckFailed: the final observation does not confirm the requested deployment.');
|
|
1086
|
+
},
|
|
1087
|
+
execute: async (options) => {
|
|
1088
|
+
let verifiedPlan;
|
|
1089
|
+
if (options?.verifyBeforeExecution) {
|
|
1090
|
+
if (!canVerifyAtExecution())
|
|
1091
|
+
throw new Error('deploymentExecutionVerificationUnsupported');
|
|
1092
|
+
// Keep failures outside the lifecycle catch so the caller retains its
|
|
1093
|
+
// preflight error classification. Only this call can consume success.
|
|
1094
|
+
await verify();
|
|
1095
|
+
verifiedPlan = deployments[0].plan;
|
|
1096
|
+
}
|
|
1097
|
+
cleanupResults.length = 0;
|
|
1098
|
+
const receipts = [...blockedReceipts];
|
|
1099
|
+
for (const prepared of deployments) {
|
|
1100
|
+
const commandPreparationFailed = prepared.plan.binding.renderUnitIds.some((unitId) => preparedUnits.get(unitId)?.finalized.producerResolutions
|
|
1101
|
+
.some((resolution) => resolution.state === 'failed' || resolution.state === 'unmet'));
|
|
1102
|
+
let receipt;
|
|
1103
|
+
const executionContext = { ...ctx,
|
|
1104
|
+
...(this.context.nativeConsent === true && prepared.plan.binding.route === 'gemini-extension'
|
|
1105
|
+
? { geminiNativeConsent: prepared.plan } : {}),
|
|
1106
|
+
geminiActivationSnapshot: structuredClone(this.mutableChecks.get(prepared.plan.binding.id)?.geminiActivationSnapshot?.()) };
|
|
1107
|
+
const nativeServices = createNativeLifecycleServices(executionContext, prepared.plan.evidence);
|
|
1108
|
+
try {
|
|
1109
|
+
receipt = await adapter.lifecycle.execute({ ...executionContext, nativeEffects: this.nativeEffects, inspect: (binding) => adapter.inspect(ctx, binding), services: {
|
|
1110
|
+
...nativeServices,
|
|
1111
|
+
registerMarketplace: async (binding, identity) => {
|
|
1112
|
+
const peers = binding.route === 'codex-marketplace' ? [...this.mutableChecks.values()].filter((check) => check.physicalKey !== binding.physicalKey && check.marketplaceRoot === prepared.plan.evidence.layout.marketplaceRoot
|
|
1113
|
+
&& check.sourceId === binding.plugin.sourceId && check.sourceIdentity === binding.plugin.sourceIdentity) : [];
|
|
1114
|
+
for (const peer of peers)
|
|
1115
|
+
await peer.assertStable();
|
|
1116
|
+
const outcome = await nativeServices.registerMarketplace(binding, identity);
|
|
1117
|
+
if (outcome.mutation === 'confirmed') {
|
|
1118
|
+
ctx.codexObservationSession?.invalidate(prepared.plan.evidence.layout.marketplaceName ?? undefined);
|
|
1119
|
+
for (const peer of peers)
|
|
1120
|
+
await peer.acceptMarketplaceRegistration();
|
|
1121
|
+
}
|
|
1122
|
+
return outcome;
|
|
1123
|
+
},
|
|
1124
|
+
verifyEvidence: async (plan) => {
|
|
1125
|
+
const verified = verifiedPlan === plan;
|
|
1126
|
+
verifiedPlan = undefined;
|
|
1127
|
+
return verified || await checks.get(plan.binding.id)() && await this.verifyMarketplace(plan);
|
|
1128
|
+
},
|
|
1129
|
+
publishPackage: async (_binding, bundle, _destination, component) => {
|
|
1130
|
+
if (!('path' in component) || component.path !== _destination)
|
|
1131
|
+
throw new Error('deploymentDestinationMismatch');
|
|
1132
|
+
await this.publishMarketplace(prepared.plan);
|
|
1133
|
+
let publication = this.published.get(prepared.plan.binding.physicalKey);
|
|
1134
|
+
if (!publication) {
|
|
1135
|
+
publication = publishDirectory(bundle.stagingRoot, component, {
|
|
1136
|
+
components: prepared.plan.projections.filter((projection) => projection.bundle !== null).flatMap((projection) => projection.components),
|
|
1137
|
+
inputDigest: inputDigests.get(prepared.plan.binding.id), contentDigest: bundle.contentDigest,
|
|
1138
|
+
preparation: prepared.plan.expected.unmet.length || commandPreparationFailed ? 'partial' : 'complete',
|
|
1139
|
+
physicalIdentity: (await getDeploymentLayout(ctx, prepared.plan.binding)).physicalIdentity,
|
|
1140
|
+
});
|
|
1141
|
+
this.published.set(prepared.plan.binding.physicalKey, publication);
|
|
1142
|
+
}
|
|
1143
|
+
return publication;
|
|
1144
|
+
},
|
|
1145
|
+
writeContribution: async (_binding, contribution, component) => {
|
|
1146
|
+
await requireWritable(component, this.ownership);
|
|
1147
|
+
if (component.kind === 'owned-directory')
|
|
1148
|
+
return publishDirectory(contribution.stagingPath, component);
|
|
1149
|
+
if (component.kind === 'owned-text-file') {
|
|
1150
|
+
await writeOwnedTextFile({ ...component, content: await fs.readFile(contribution.stagingPath, 'utf8') });
|
|
1151
|
+
}
|
|
1152
|
+
else if (component.kind === 'shared-config' && component.locator.kind === 'cursor-workspace-hook') {
|
|
1153
|
+
const locator = component.locator;
|
|
1154
|
+
const value = await jsonObject(locator.hooksPath);
|
|
1155
|
+
const { hooks, entries } = cursorHooks(value);
|
|
1156
|
+
const desired = cursorHooks(await jsonObject(contribution.stagingPath)).entries;
|
|
1157
|
+
await atomicReplaceSafeFile({ filePath: component.locator.hooksPath, allowedRoot: path.dirname(component.locator.hooksPath), label: 'Cursor workspaceOpen',
|
|
1158
|
+
content: `${JSON.stringify({ ...value, hooks: { ...hooks, workspaceOpen: [...entries.filter((item) => cursorHookEntryCommand(item) !== locator.command), ...desired] } }, null, 2)}\n` });
|
|
1159
|
+
}
|
|
1160
|
+
else if (component.kind === 'shared-config' && component.locator.kind === 'claude-permissions') {
|
|
1161
|
+
const content = await jsonObject(contribution.stagingPath);
|
|
1162
|
+
if (content.kind !== 'claude-permissions')
|
|
1163
|
+
throw new Error('platformContributionUnsupported');
|
|
1164
|
+
await applyPlannedOperationAction({ kind: 'updateSharedConfig', pluginId: prepared.plan.binding.plugin.pluginId,
|
|
1165
|
+
platform: 'claude', scope: prepared.plan.binding.scope.kind, owner: component.identity, locator: component.locator,
|
|
1166
|
+
contentDigest: contribution.contentDigest, mutation: { kind: 'claude-permissions', permissions: content.permissions } });
|
|
1167
|
+
}
|
|
1168
|
+
else
|
|
1169
|
+
throw new Error('platformContributionUnsupported');
|
|
1170
|
+
return { mutation: 'confirmed', changed: true };
|
|
1171
|
+
},
|
|
1172
|
+
removeOwned: async (_binding, component) => {
|
|
1173
|
+
const result = await cleanupOwnedComponents({ components: [component], executor: this.ownership });
|
|
1174
|
+
cleanupResults.push(result);
|
|
1175
|
+
if (result.failures.length || result.residual.length || result.quarantined.length) {
|
|
1176
|
+
throw Object.assign(new Error('deploymentCleanupIncomplete'), result.removed.length || result.quarantined.length
|
|
1177
|
+
? { mutation: 'confirmed' } : {});
|
|
1178
|
+
}
|
|
1179
|
+
return { mutation: result.removed.length ? 'confirmed' : 'none', changed: result.removed.length > 0 };
|
|
1180
|
+
},
|
|
1181
|
+
} }, prepared);
|
|
1182
|
+
}
|
|
1183
|
+
catch (error) {
|
|
1184
|
+
const diagnostic = { code: 'platformExecutionFailed', severity: 'error',
|
|
1185
|
+
message: error instanceof Error ? error.message : String(error),
|
|
1186
|
+
subject: { target: prepared.plan.binding.platform, pluginId: prepared.plan.binding.plugin.pluginId, scope: prepared.plan.binding.scope.kind } };
|
|
1187
|
+
receipt = { bindingId: prepared.plan.binding.id, effects: prepared.plan.effects.map((effect) => ({
|
|
1188
|
+
id: effect.id, status: 'unknown', mutation: 'possible', diagnostics: [diagnostic]
|
|
1189
|
+
})),
|
|
1190
|
+
after: await adapter.inspect(ctx, prepared.plan.binding).catch(() => prepared.driverState.before),
|
|
1191
|
+
unmet: [], reload: 'unknown', diagnostics: [diagnostic] };
|
|
1192
|
+
}
|
|
1193
|
+
receipts.push(receipt);
|
|
1194
|
+
if ((prepared.plan.operation === 'remove' || prepared.plan.operation === 'cleanup'
|
|
1195
|
+
|| prepared.plan.expected.components.length === 0 && prepared.plan.expected.unmet.length === 0)
|
|
1196
|
+
&& prepared.plan.evidence.sharedReferences !== 'none' && receipt.after.package === 'present') {
|
|
1197
|
+
receipt.diagnostics.push({ code: prepared.plan.evidence.sharedReferences === 'unknown' ? 'sharedReferenceUnknown' : 'sharedPackageRetained', severity: 'warning',
|
|
1198
|
+
message: prepared.plan.evidence.sharedReferences === 'unknown'
|
|
1199
|
+
? 'The shared package was kept because references outside the observed scope could not be ruled out.'
|
|
1200
|
+
: 'The shared package was kept for another scope.',
|
|
1201
|
+
subject: { target: prepared.plan.binding.platform, pluginId: prepared.plan.binding.plugin.pluginId, scope: prepared.plan.binding.scope.kind } });
|
|
1202
|
+
}
|
|
1203
|
+
for (const unitId of prepared.plan.binding.renderUnitIds)
|
|
1204
|
+
for (const resolution of preparedUnits.get(unitId)?.finalized.producerResolutions ?? []) {
|
|
1205
|
+
if (resolution.state !== 'failed')
|
|
1206
|
+
continue;
|
|
1207
|
+
receipt.diagnostics.push({ code: 'managedCommandProducerFailed', severity: 'error', message: resolution.error.message,
|
|
1208
|
+
subject: { target: prepared.plan.binding.platform, pluginId: prepared.plan.binding.plugin.pluginId, scope: prepared.plan.binding.scope.kind } });
|
|
1209
|
+
}
|
|
1210
|
+
try {
|
|
1211
|
+
if (receipt.effects.some((effect) => effect.mutation !== 'none')) {
|
|
1212
|
+
for (const check of this.mutableChecks.values())
|
|
1213
|
+
if (check.physicalKey === prepared.plan.binding.physicalKey
|
|
1214
|
+
|| executionContext.geminiActivationSnapshot && check.geminiActivationSnapshot?.()?.path === executionContext.geminiActivationSnapshot.path) {
|
|
1215
|
+
await check.rebase(executionContext.geminiActivationSnapshot);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
catch (error) {
|
|
1220
|
+
receipt.diagnostics.push({ code: 'operationPlanStale', severity: 'error', message: error instanceof Error ? error.message : String(error),
|
|
1221
|
+
subject: { target: prepared.plan.binding.platform, pluginId: prepared.plan.binding.plugin.pluginId, scope: prepared.plan.binding.scope.kind } });
|
|
1222
|
+
continue;
|
|
1223
|
+
}
|
|
1224
|
+
if (prepared.plan.evidence.retainPackage || receipt.diagnostics.some((diagnostic) => diagnostic.code === 'operationPlanStale')
|
|
1225
|
+
|| receipt.effects.some((effect) => ['failed', 'unknown', 'blocked', 'skipped'].includes(effect.status)))
|
|
1226
|
+
continue;
|
|
1227
|
+
try {
|
|
1228
|
+
const candidates = [...preparedUnits.values()].flatMap((unit) => unit.finalized.commandCandidates)
|
|
1229
|
+
.filter((candidate) => candidate.producer.kind !== 'package' && candidate.producer.placementKey === prepared.plan.binding.physicalKey);
|
|
1230
|
+
const root = prepared.plan.evidence.layout.packageRoot;
|
|
1231
|
+
const mappings = prepared.plan.projections.filter((projection) => projection.bundle !== null).flatMap((projection) => projection.components);
|
|
1232
|
+
for (const candidate of candidates) {
|
|
1233
|
+
const componentId = candidate.producer.kind === 'static-skill' ? `skill:${candidate.producer.key}` : candidate.producer.key;
|
|
1234
|
+
const mapping = mappings.find((item) => item.id === componentId);
|
|
1235
|
+
if (!mapping || !mapping.relativeOutputs.some((output) => output === `skills/${mapping.nativeName}/SKILL.md`))
|
|
1236
|
+
throw new Error('commandProducerProjectionMissing');
|
|
1237
|
+
await publishManagedCommandBindings({ ...candidate, resourceRoot: path.join(root, 'skills', mapping.nativeName),
|
|
1238
|
+
env: this.context.env, bindingRecoveryEvidence });
|
|
1239
|
+
}
|
|
1240
|
+
const bundle = prepared.plan.projections.find((projection) => projection.bundle)?.bundle;
|
|
1241
|
+
const packageOwner = prepared.plan.evidence.ownership.find((slot) => 'path' in slot.component && slot.component.path === root)?.component;
|
|
1242
|
+
if (bundle && packageOwner?.kind === 'owned-directory' && prepared.plan.evidence.contentMatches
|
|
1243
|
+
&& !receipt.diagnostics.some((diagnostic) => diagnostic.severity === 'error')
|
|
1244
|
+
&& packageDeliveryConfirmed(prepared.plan.binding, receipt.after, bundle.contentDigest, requireIndependentActivation)
|
|
1245
|
+
&& await readPlatformPackageContentDigest(root) === bundle.contentDigest) {
|
|
1246
|
+
const projection = { components: mappings, contentDigest: bundle.contentDigest,
|
|
1247
|
+
inputDigest: inputDigests.get(prepared.plan.binding.id), preparation: prepared.plan.expected.unmet.length || commandPreparationFailed ? 'partial' : 'complete',
|
|
1248
|
+
physicalIdentity: (await getDeploymentLayout(ctx, prepared.plan.binding)).physicalIdentity };
|
|
1249
|
+
const marker = await readSkillOwnerMarker({ skillRoot: root, allowedRoot: packageOwner.allowedRoot, expectedIdentity: packageOwner.identity });
|
|
1250
|
+
if (marker && (!marker.nativeProjection || artifactValueDigest(marker.nativeProjection) !== artifactValueDigest(projection))) {
|
|
1251
|
+
await writeSkillOwnerMarker({ skillRoot: root, allowedRoot: packageOwner.allowedRoot, identity: packageOwner.identity, nativeProjection: projection });
|
|
1252
|
+
for (const check of this.mutableChecks.values())
|
|
1253
|
+
if (check.physicalKey === prepared.plan.binding.physicalKey)
|
|
1254
|
+
await check.rebase();
|
|
1255
|
+
receipt.after = await adapter.inspect(ctx, prepared.plan.binding);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
const packageRemoved = !await fs.pathExists(root);
|
|
1259
|
+
const replaced = receipt.effects.some((effect) => effect.status === 'applied'
|
|
1260
|
+
&& prepared.plan.effects.some((planned) => planned.id === effect.id && planned.kind === 'publish-package'));
|
|
1261
|
+
for (const producer of priorProducers.get(prepared.plan.binding.id) ?? []) {
|
|
1262
|
+
if (candidates.some((candidate) => artifactValueDigest(candidate.producer) === artifactValueDigest(producer)))
|
|
1263
|
+
continue;
|
|
1264
|
+
const componentId = producer.kind === 'static-skill' ? `skill:${producer.key}` : producer.key;
|
|
1265
|
+
if (packageRemoved || replaced && !prepared.plan.expected.unmet.some((gap) => gap.id === componentId)) {
|
|
1266
|
+
await revokeManagedCommandBindings(producer, this.context.env);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
const emptyState = emptyStates.get(prepared.plan.binding.id);
|
|
1270
|
+
const removedByCommand = piProjectRemovalConfirmed(prepared.plan, receipt);
|
|
1271
|
+
const inactiveScope = removedByCommand || receipt.after.registration === 'absent'
|
|
1272
|
+
|| receipt.after.package === 'absent' && receipt.after.registration === 'not-applicable'
|
|
1273
|
+
|| receipt.after.scopeRegistration === 'absent'
|
|
1274
|
+
|| prepared.plan.binding.scope.kind === 'project'
|
|
1275
|
+
&& ['codex-marketplace', 'gemini-extension', 'copilot-marketplace'].includes(prepared.plan.binding.route)
|
|
1276
|
+
&& receipt.after.configuration?.activation === 'absent'
|
|
1277
|
+
|| receipt.after.consumers.every((consumer) => ['disabled', 'not-applicable'].includes(consumer.activation));
|
|
1278
|
+
if (emptyState && !prepared.plan.expected.components.length && !receipt.unmet.length
|
|
1279
|
+
&& !receipt.diagnostics.some((diagnostic) => diagnostic.severity === 'error')
|
|
1280
|
+
&& (receipt.after.registration !== 'unknown' || removedByCommand) && receipt.after.package !== 'unknown'
|
|
1281
|
+
&& !['foreign', 'unknown'].includes(receipt.after.ownership)
|
|
1282
|
+
&& inactiveScope) {
|
|
1283
|
+
const residual = await inspectOwnedComponents({ components: prepared.plan.evidence.ownership
|
|
1284
|
+
.filter((slot) => !('path' in slot.component) || slot.component.path !== prepared.plan.evidence.layout.packageRoot)
|
|
1285
|
+
.map((slot) => slot.component), executor: this.ownership });
|
|
1286
|
+
if (residual.components.every((component) => component.state === 'absent'))
|
|
1287
|
+
await writePlatformEmptyState({ state: emptyState, env: this.context.env });
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
catch (error) {
|
|
1291
|
+
receipt.diagnostics.push({ code: 'managedCommandPublicationFailed', severity: 'error',
|
|
1292
|
+
message: error instanceof Error ? error.message : String(error),
|
|
1293
|
+
subject: { target: prepared.plan.binding.platform, pluginId: prepared.plan.binding.plugin.pluginId, scope: prepared.plan.binding.scope.kind } });
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
return receipts;
|
|
1297
|
+
},
|
|
1298
|
+
};
|
|
1299
|
+
if (initialDiscoveryCheck) {
|
|
1300
|
+
const firstCheck = initialDiscoveryCheck;
|
|
1301
|
+
const canReuseDiscovery = () => this.targets.size === 1 && deployments.length === 1 && plans.length === 1
|
|
1302
|
+
&& plans[0] === deployments[0].plan && !blockedReceipts.length && plans[0].operation === 'ensure'
|
|
1303
|
+
&& plans[0].expected.components.length > 0 && !plans[0].expected.unmet.length;
|
|
1304
|
+
receiveInitialVerifier?.(async () => {
|
|
1305
|
+
if (!canReuseDiscovery())
|
|
1306
|
+
return verify();
|
|
1307
|
+
// Only this creator reuses the discovery captured after rendering.
|
|
1308
|
+
// Inspect still rereads all native facts and local copy/config evidence.
|
|
1309
|
+
await verifyChecks([firstCheck]);
|
|
1310
|
+
if (!canReuseDiscovery())
|
|
1311
|
+
await verify();
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
return target;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
//# sourceMappingURL=rebuild-platform-integration.js.map
|