@lesliechan721/aw 0.1.0-beta.6 → 0.1.0-beta.60
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 +199 -0
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
- package/dist/authoring/scripts/add-skill.mjs +4 -4
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +67 -97
- 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 +229 -8
- package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.d.mts +77 -92
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +99 -124
- package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
- package/dist/authoring/scripts/plugin-status.mjs +8 -11
- package/dist/authoring/scripts/plugin-status.mjs.map +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs +3 -2
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +552 -1142
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/native-runtime/reader-runtime.mjs +34 -0
- package/dist/native-runtime/reader.d.mts +6 -0
- package/dist/native-runtime/reader.mjs +11 -0
- package/dist/scripts/aw-skill-eval-materializer.d.ts +26 -0
- package/dist/scripts/aw-skill-eval-materializer.js +306 -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 +19 -8
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.d.ts +7 -9
- package/dist/scripts/plugin-staging.js +18 -29
- 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 +208 -89
- 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 +2 -2
- package/dist/src/adapters/helpers.js.map +1 -1
- package/dist/src/authoring/workspace-commands.d.ts +19 -1
- package/dist/src/authoring/workspace-commands.js +24 -5
- package/dist/src/authoring/workspace-commands.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +78 -0
- package/dist/src/commands/aw-capabilities.js +266 -0
- package/dist/src/commands/aw-capabilities.js.map +1 -0
- package/dist/src/commands/catalog-dev-source.d.ts +154 -0
- package/dist/src/commands/catalog-dev-source.js +655 -0
- package/dist/src/commands/catalog-dev-source.js.map +1 -0
- package/dist/src/commands/catalog-generation.d.ts +21 -0
- package/dist/src/commands/catalog-generation.js +9 -0
- package/dist/src/commands/catalog-generation.js.map +1 -0
- package/dist/src/commands/catalog-publication-inspection.d.ts +71 -30
- package/dist/src/commands/catalog-publication-inspection.js +475 -63
- 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 +18 -0
- package/dist/src/commands/catalog-publication-target.js +95 -0
- package/dist/src/commands/catalog-publication-target.js.map +1 -0
- package/dist/src/commands/catalog-publish.d.ts +73 -15
- package/dist/src/commands/catalog-publish.js +701 -212
- package/dist/src/commands/catalog-publish.js.map +1 -1
- package/dist/src/commands/catalog-source.d.ts +60 -22
- package/dist/src/commands/catalog-source.js +311 -91
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/catalog-status.d.ts +18 -22
- package/dist/src/commands/catalog-status.js +81 -115
- 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 +13 -0
- package/dist/src/commands/catalog-workspace-resolution.js +42 -0
- package/dist/src/commands/catalog-workspace-resolution.js.map +1 -0
- package/dist/src/commands/console.js +28 -17
- 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/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/managed-commands.d.ts +28 -0
- package/dist/src/commands/managed-commands.js +315 -0
- package/dist/src/commands/managed-commands.js.map +1 -0
- package/dist/src/commands/offline-cleanup-evidence.d.ts +67 -0
- package/dist/src/commands/offline-cleanup-evidence.js +181 -0
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -0
- package/dist/src/commands/operation-plan.d.ts +182 -0
- package/dist/src/commands/operation-plan.js +71 -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 +9 -7
- package/dist/src/commands/options.js +83 -21
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +65 -4
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +78 -31
- package/dist/src/commands/rebuild-command.js +5229 -942
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +143 -21
- package/dist/src/commands/rebuild-integration.js +3384 -1342
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +60 -30
- package/dist/src/commands/rebuild-operations.js +267 -320
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- 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 +422 -0
- package/dist/src/commands/review-inspection.js.map +1 -0
- package/dist/src/commands/review-preparation.d.ts +49 -0
- package/dist/src/commands/review-preparation.js +427 -0
- package/dist/src/commands/review-preparation.js.map +1 -0
- package/dist/src/commands/runtime.d.ts +1 -5
- package/dist/src/commands/runtime.js +27 -53
- package/dist/src/commands/runtime.js.map +1 -1
- package/dist/src/commands/skill-eval.d.ts +39 -0
- package/dist/src/commands/skill-eval.js +400 -0
- package/dist/src/commands/skill-eval.js.map +1 -0
- package/dist/src/commands/status-v6.d.ts +279 -0
- package/dist/src/commands/status-v6.js +2785 -0
- package/dist/src/commands/status-v6.js.map +1 -0
- package/dist/src/commands/sync-command.d.ts +40 -0
- package/dist/src/commands/sync-command.js +254 -0
- package/dist/src/commands/sync-command.js.map +1 -0
- package/dist/src/commands/wizard.d.ts +8 -5
- package/dist/src/commands/wizard.js +6 -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 +136 -31
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/constants.d.ts +7 -2
- package/dist/src/constants.js +7 -2
- package/dist/src/constants.js.map +1 -1
- package/dist/src/eval/manifest-v1.d.ts +68 -0
- package/dist/src/eval/manifest-v1.js +353 -0
- package/dist/src/eval/manifest-v1.js.map +1 -0
- package/dist/src/generators/local-plugin.d.ts +5 -1
- package/dist/src/generators/local-plugin.js +261 -109
- 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 +10 -4
- package/dist/src/index.js +1774 -609
- package/dist/src/index.js.map +1 -1
- package/dist/src/output/command-receipt.d.ts +47 -46
- package/dist/src/output/command-receipt.js +277 -79
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/model.d.ts +3 -44
- package/dist/src/output/model.js +1 -144
- package/dist/src/output/model.js.map +1 -1
- package/dist/src/output/rebuild-progress.js +15 -13
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/portable/commands.d.ts +46 -7
- package/dist/src/portable/commands.js +349 -37
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +17 -4
- package/dist/src/portable/materializer.js +186 -41
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/skills-cli.d.ts +15 -7
- package/dist/src/portable/skills-cli.js +74 -20
- package/dist/src/portable/skills-cli.js.map +1 -1
- 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/review-profile.d.ts +17 -0
- package/dist/src/review/review-profile.js +234 -0
- package/dist/src/review/review-profile.js.map +1 -0
- package/dist/src/review/review-selection.d.ts +30 -0
- package/dist/src/review/review-selection.js +527 -0
- package/dist/src/review/review-selection.js.map +1 -0
- package/dist/src/review/review-types.d.ts +68 -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 +26 -0
- package/dist/src/review/skill-materialization.js +217 -0
- package/dist/src/review/skill-materialization.js.map +1 -0
- package/dist/src/review/source-binding.d.ts +183 -0
- package/dist/src/review/source-binding.js +708 -0
- package/dist/src/review/source-binding.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 +21 -0
- package/dist/src/tui/catalog-generation.js +156 -0
- package/dist/src/tui/catalog-generation.js.map +1 -0
- 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 +110 -3
- package/dist/src/tui/components.js +183 -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 +19 -0
- package/dist/src/tui/config-leaf-editor.js +212 -0
- package/dist/src/tui/config-leaf-editor.js.map +1 -0
- package/dist/src/tui/config-references.d.ts +34 -0
- package/dist/src/tui/config-references.js +70 -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 +14 -4
- package/dist/src/tui/console-app-v4.js +9205 -1951
- 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 +10 -2
- package/dist/src/tui/controller-runtime.js +3289 -388
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +622 -45
- package/dist/src/tui/controller.js +3589 -768
- 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/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 +3 -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 +220 -0
- package/dist/src/tui/entity-cards.js.map +1 -0
- package/dist/src/tui/glossary.d.ts +23 -0
- package/dist/src/tui/glossary.js +42 -0
- package/dist/src/tui/glossary.js.map +1 -0
- package/dist/src/tui/index.d.ts +6 -1
- package/dist/src/tui/index.js +5 -1
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/input-display.d.ts +9 -0
- package/dist/src/tui/input-display.js +58 -0
- package/dist/src/tui/input-display.js.map +1 -0
- 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 +224 -31
- package/dist/src/tui/model.js +1510 -397
- 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 +71 -0
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
- package/dist/src/tui/operation-history.d.ts +81 -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 +21 -0
- package/dist/src/tui/operation-review-planner.js +1392 -0
- package/dist/src/tui/operation-review-planner.js.map +1 -0
- package/dist/src/tui/plugin-content.d.ts +31 -0
- package/dist/src/tui/plugin-content.js +680 -0
- package/dist/src/tui/plugin-content.js.map +1 -0
- package/dist/src/tui/plugin-detail.d.ts +52 -0
- package/dist/src/tui/plugin-detail.js +165 -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/project-inventory.d.ts +68 -0
- package/dist/src/tui/project-inventory.js +203 -0
- package/dist/src/tui/project-inventory.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 +37 -0
- package/dist/src/tui/reader.js +47 -0
- package/dist/src/tui/reader.js.map +1 -0
- package/dist/src/tui/router.d.ts +197 -10
- package/dist/src/tui/router.js +338 -50
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/tui/screen-registry.d.ts +701 -0
- package/dist/src/tui/screen-registry.js +230 -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 +209 -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/source-ref-presets.d.ts +3 -0
- package/dist/src/tui/source-ref-presets.js +11 -0
- package/dist/src/tui/source-ref-presets.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/views.js +31 -3
- package/dist/src/tui/views.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 +264 -21
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/agent-version.d.ts +7 -1
- package/dist/src/utils/agent-version.js +36 -7
- package/dist/src/utils/agent-version.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +8 -6
- package/dist/src/utils/artifact-plan.js +67 -13
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +24 -10
- package/dist/src/utils/artifact-renderer.js +230 -220
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +32 -0
- package/dist/src/utils/artifact-request.js +90 -0
- package/dist/src/utils/artifact-request.js.map +1 -0
- package/dist/src/utils/artifact-sources.d.ts +4 -0
- package/dist/src/utils/artifact-sources.js +17 -0
- package/dist/src/utils/artifact-sources.js.map +1 -1
- package/dist/src/utils/aw-home-mutation-lock.d.ts +1 -0
- package/dist/src/utils/aw-home-mutation-lock.js +32 -4
- package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
- package/dist/src/utils/bundle-integrity.d.ts +0 -1
- package/dist/src/utils/bundle-integrity.js +0 -25
- package/dist/src/utils/bundle-integrity.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +29 -29
- 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 +10 -0
- package/dist/src/utils/catalog-digests.js +57 -20
- 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 +16 -0
- package/dist/src/utils/catalog-generation-error.js +30 -0
- package/dist/src/utils/catalog-generation-error.js.map +1 -0
- package/dist/src/utils/catalog-generation-resolver.d.ts +44 -0
- package/dist/src/utils/catalog-generation-resolver.js +273 -0
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -0
- package/dist/src/utils/catalog-generation-service.d.ts +172 -0
- package/dist/src/utils/catalog-generation-service.js +1271 -0
- package/dist/src/utils/catalog-generation-service.js.map +1 -0
- package/dist/src/utils/catalog-generation-state.d.ts +22 -0
- package/dist/src/utils/catalog-generation-state.js +192 -0
- package/dist/src/utils/catalog-generation-state.js.map +1 -0
- package/dist/src/utils/catalog-generation-store.d.ts +58 -0
- package/dist/src/utils/catalog-generation-store.js +452 -0
- package/dist/src/utils/catalog-generation-store.js.map +1 -0
- package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
- package/dist/src/utils/{catalog-manifest-v4.js → catalog-manifest-v7.js} +35 -43
- package/dist/src/utils/catalog-manifest-v7.js.map +1 -0
- package/dist/src/utils/catalog-operation-context.d.ts +20 -0
- package/dist/src/utils/catalog-operation-context.js +142 -0
- package/dist/src/utils/catalog-operation-context.js.map +1 -0
- package/dist/src/utils/catalog-public-error.d.ts +7 -3
- package/dist/src/utils/catalog-public-error.js +28 -8
- package/dist/src/utils/catalog-public-error.js.map +1 -1
- package/dist/src/utils/catalog-runtime-projection.d.ts +3 -0
- 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 +5 -3
- package/dist/src/utils/catalog-snapshot.js +11 -3
- package/dist/src/utils/catalog-snapshot.js.map +1 -1
- package/dist/src/utils/catalog-source-identity.d.ts +1 -0
- package/dist/src/utils/catalog-source-identity.js +21 -2
- package/dist/src/utils/catalog-source-identity.js.map +1 -1
- package/dist/src/utils/catalog-source-impact.d.ts +21 -0
- package/dist/src/utils/catalog-source-impact.js +344 -0
- package/dist/src/utils/catalog-source-impact.js.map +1 -0
- package/dist/src/utils/catalog-source-references.d.ts +3 -2
- package/dist/src/utils/catalog-source-references.js +195 -347
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/catalog-sources.d.ts +15 -1
- package/dist/src/utils/catalog-sources.js +206 -27
- package/dist/src/utils/catalog-sources.js.map +1 -1
- package/dist/src/utils/claude-skills-root.d.ts +8 -0
- package/dist/src/utils/claude-skills-root.js +76 -0
- package/dist/src/utils/claude-skills-root.js.map +1 -0
- package/dist/src/utils/codex-config.d.ts +2 -0
- package/dist/src/utils/codex-config.js +26 -5
- package/dist/src/utils/codex-config.js.map +1 -1
- package/dist/src/utils/codex-manager.d.ts +79 -0
- package/dist/src/utils/codex-manager.js +735 -0
- package/dist/src/utils/codex-manager.js.map +1 -0
- 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 +154 -0
- package/dist/src/utils/codex-native-observation.js.map +1 -0
- package/dist/src/utils/codex-native-render-receipt.d.ts +40 -0
- package/dist/src/utils/codex-native-render-receipt.js +205 -0
- package/dist/src/utils/codex-native-render-receipt.js.map +1 -0
- package/dist/src/utils/codex-reconciler.d.ts +126 -0
- package/dist/src/utils/codex-reconciler.js +298 -0
- package/dist/src/utils/codex-reconciler.js.map +1 -0
- package/dist/src/utils/codex-shared-native.d.ts +43 -0
- package/dist/src/utils/codex-shared-native.js +81 -0
- package/dist/src/utils/codex-shared-native.js.map +1 -0
- package/dist/src/utils/codex-skill-staging.d.ts +2 -0
- 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 +46 -0
- package/dist/src/utils/codex-surface-analysis.js +247 -0
- package/dist/src/utils/codex-surface-analysis.js.map +1 -0
- package/dist/src/utils/dynamic-skill-tree.d.ts +5 -0
- package/dist/src/utils/dynamic-skill-tree.js +56 -7
- 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 +177 -145
- package/dist/src/utils/git-catalog-provider.js.map +1 -1
- package/dist/src/utils/local-marketplace.d.ts +27 -1
- package/dist/src/utils/local-marketplace.js +434 -84
- 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 +86 -0
- package/dist/src/utils/managed-command-evidence.js.map +1 -0
- package/dist/src/utils/managed-command-materialization.d.ts +115 -0
- package/dist/src/utils/managed-command-materialization.js +359 -0
- package/dist/src/utils/managed-command-materialization.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 +128 -0
- package/dist/src/utils/managed-command-store.js +589 -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 +3 -9
- package/dist/src/utils/multi-source-catalog.js +54 -110
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +61 -7
- package/dist/src/utils/native-cli.js +426 -58
- package/dist/src/utils/native-cli.js.map +1 -1
- 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 +21 -0
- package/dist/src/utils/native-tool-review.js +102 -0
- package/dist/src/utils/native-tool-review.js.map +1 -0
- package/dist/src/utils/orphan-marketplace-cleanup.js +0 -4
- package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +88 -20
- package/dist/src/utils/ownership.js +185 -223
- 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 +54 -65
- package/dist/src/utils/path-catalog-provider.js.map +1 -1
- package/dist/src/utils/paths.d.ts +0 -1
- package/dist/src/utils/paths.js +0 -1
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/plugin-config-impact.d.ts +40 -0
- package/dist/src/utils/plugin-config-impact.js +373 -0
- package/dist/src/utils/plugin-config-impact.js.map +1 -0
- package/dist/src/utils/plugin-config-write.d.ts +52 -27
- package/dist/src/utils/plugin-config-write.js +1112 -298
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +153 -93
- package/dist/src/utils/plugin-config.js +1116 -968
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-intent-state.d.ts +49 -0
- package/dist/src/utils/plugin-intent-state.js +320 -0
- package/dist/src/utils/plugin-intent-state.js.map +1 -0
- package/dist/src/utils/plugin-scripts.d.ts +66 -125
- package/dist/src/utils/plugin-scripts.js +518 -526
- 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 +20 -0
- package/dist/src/utils/runtime-config.js +75 -0
- package/dist/src/utils/runtime-config.js.map +1 -0
- 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.js +7 -2
- package/dist/src/utils/state-paths.js.map +1 -1
- package/dist/src/utils/target-eligibility.d.ts +8 -2
- package/dist/src/utils/target-eligibility.js +17 -8
- 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 +14 -0
- package/dist/src/utils/windows-npm-shim.js +140 -0
- package/dist/src/utils/windows-npm-shim.js.map +1 -0
- package/dist/vitest.config.js +100 -9
- package/dist/vitest.config.js.map +1 -1
- package/package.json +31 -21
- package/dist/authoring/scripts/check-plugin-versions.d.mts +0 -2
- package/dist/authoring/scripts/check-plugin-versions.mjs +0 -5
- package/dist/authoring/scripts/check-plugin-versions.mjs.map +0 -1
- 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 -89
- package/dist/scripts/codex-eval-app-server.js +0 -1228
- 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 -1586
- 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 -185
- package/dist/scripts/plugin-eval-contract.js +0 -695
- 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/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-v4.d.ts +0 -123
- package/dist/src/commands/status-v4.js +0 -905
- package/dist/src/commands/status-v4.js.map +0 -1
- package/dist/src/commands/status.d.ts +0 -93
- package/dist/src/commands/status.js +0 -442
- package/dist/src/commands/status.js.map +0 -1
- package/dist/src/utils/active-marketplace-runtime-lock.d.ts +0 -12
- package/dist/src/utils/active-marketplace-runtime-lock.js +0 -133
- package/dist/src/utils/active-marketplace-runtime-lock.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v3.d.ts +0 -2
- package/dist/src/utils/catalog-manifest-v3.js +0 -3
- package/dist/src/utils/catalog-manifest-v3.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v4.d.ts +0 -5
- package/dist/src/utils/catalog-manifest-v4.js.map +0 -1
- package/dist/src/utils/catalog-source-cache.d.ts +0 -62
- package/dist/src/utils/catalog-source-cache.js +0 -296
- 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 -175
- package/dist/src/utils/lifecycle-active-store.js +0 -1276
- 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
|
@@ -1,16 +1,83 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { getCommandPackageId } from '@lesliechan721/aw-plugin-core/manifest';
|
|
2
|
+
import { flattenStatusTargets, statusCommandV8, statusTargetIntent, } from '../commands/status-v6.js';
|
|
3
|
+
import { syncWriteCommand } from '../commands/write-commands.js';
|
|
4
|
+
import { CONFIG_MUTATION_RECEIPT_SCHEMA_VERSION, } from '../types.js';
|
|
5
|
+
import { getDefaultNativeCliRunner, prepareNativeCliExecution } from './native-cli.js';
|
|
6
|
+
import { assertReadyPluginConfigStore, assertPluginConfigMutationCandidate, assertSafePluginConfigSegment, codexNativeRefreshKeys, coercePluginConfigUpdates, patchPluginConfigStore, readPluginConfigStore, readNamespacedPluginConfigStoreIdentity, resetPluginConfigStore, resolveConfigRead, resolveEffectivePluginConfig, resolvePluginConfigStorePath, resolvePluginConfigSchemaAccess, summarizeEffectivePluginConfig, } from './plugin-config.js';
|
|
7
|
+
import { analyzePluginConfigMutationImpact, pluginSharedNativeConfigTargets } from './plugin-config-impact.js';
|
|
8
|
+
import { discoverInstalledPluginManagedCommandPackages, assertManagedCommandPackageNativeToolsUnchanged, syncPluginManagedCommandPackage, } from './managed-command-materialization.js';
|
|
9
|
+
import { managedCommandDiagnostic } from './managed-command-store.js';
|
|
10
|
+
import { collectSensitivePluginConfigValues, redactPluginScriptOutput, } from './plugin-scripts.js';
|
|
11
11
|
import { resolveClaudeProjectKey, resolveCodexProjectKey } from './paths.js';
|
|
12
|
-
import { supportsPlatform } from './platform-support.js';
|
|
13
12
|
import { withAwHomeMutationLock, } from './aw-home-mutation-lock.js';
|
|
13
|
+
import { assertProjectSharedConfigPathVisible, } from './project-boundary.js';
|
|
14
|
+
export function buildConfigMutationReceipt(command, receipt) {
|
|
15
|
+
return {
|
|
16
|
+
...receipt,
|
|
17
|
+
receiptSchemaVersion: CONFIG_MUTATION_RECEIPT_SCHEMA_VERSION,
|
|
18
|
+
command,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function publicConfigApplyTargetResult(result) {
|
|
22
|
+
return {
|
|
23
|
+
target: {
|
|
24
|
+
pluginName: result.target.pluginName,
|
|
25
|
+
...(result.target.pluginId ? { pluginId: result.target.pluginId } : {}),
|
|
26
|
+
platform: result.target.platform,
|
|
27
|
+
scope: result.target.scope,
|
|
28
|
+
},
|
|
29
|
+
action: result.action,
|
|
30
|
+
state: result.state,
|
|
31
|
+
...(result.message ? { message: result.message } : {}),
|
|
32
|
+
...(result.errorCode ? { errorCode: result.errorCode } : {}),
|
|
33
|
+
...(result.relation ? { relation: result.relation } : {}),
|
|
34
|
+
...(result.requiredBy ? { requiredBy: result.requiredBy } : {}),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function publicConfigApplyResult(apply) {
|
|
38
|
+
if (apply.state === 'skipped')
|
|
39
|
+
return apply;
|
|
40
|
+
return {
|
|
41
|
+
...apply,
|
|
42
|
+
targetResults: apply.targetResults.map(publicConfigApplyTargetResult),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function configWriteStateForError(error) {
|
|
46
|
+
return error?.configWrite === 'failed'
|
|
47
|
+
? 'failed'
|
|
48
|
+
: 'notStarted';
|
|
49
|
+
}
|
|
50
|
+
function markConfigWriteFailed(error) {
|
|
51
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
52
|
+
return Object.assign(failure, { configWrite: 'failed' });
|
|
53
|
+
}
|
|
54
|
+
function skippedApply(reason) {
|
|
55
|
+
return { state: 'skipped', reason, targetResults: [] };
|
|
56
|
+
}
|
|
57
|
+
function unavailableApply(reason, stage, targetResults = [], commandPackages = []) {
|
|
58
|
+
const messages = {
|
|
59
|
+
invalidConfig: 'The effective config is invalid for every visible target.',
|
|
60
|
+
schemaUnavailable: 'The config schema is unavailable after the config commit.',
|
|
61
|
+
sourceUnavailable: 'The plugin source is unavailable after the config commit.',
|
|
62
|
+
effectiveConfigUnavailable: 'The effective config cannot be read after the config commit.',
|
|
63
|
+
targetDiscoveryFailed: 'Visible config apply targets cannot be discovered after the config commit.',
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
state: 'unavailable',
|
|
67
|
+
reason,
|
|
68
|
+
targetResults,
|
|
69
|
+
...(commandPackages.length > 0 ? { commandResults: commandPackages.map((target) => ({
|
|
70
|
+
producer: target.producer, state: 'failed', commandIds: [], removedCommandIds: [],
|
|
71
|
+
errors: [{ code: reason, message: messages[reason] }],
|
|
72
|
+
recoveryActions: [`aw command package sync ${target.producer.sourceId}/${target.producer.pluginName} ${target.packageKey} --scope ${target.producer.scope} --yes`,
|
|
73
|
+
`aw command package remove ${target.packageId} --yes`],
|
|
74
|
+
})) } : {}),
|
|
75
|
+
error: { stage, code: reason, message: messages[reason] },
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function overallStateForApply(apply) {
|
|
79
|
+
return apply.state === 'succeeded' || apply.state === 'skipped' ? 'succeeded' : 'partial';
|
|
80
|
+
}
|
|
14
81
|
function uniqueInOrder(values) {
|
|
15
82
|
return [...new Set(values)];
|
|
16
83
|
}
|
|
@@ -44,154 +111,478 @@ async function createCandidateTarget(options) {
|
|
|
44
111
|
async function discoverVisibleTargets(options) {
|
|
45
112
|
const targets = [];
|
|
46
113
|
const failures = [];
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
114
|
+
const selector = options.plugin.pluginId ?? options.pluginName;
|
|
115
|
+
const status = await statusCommandV8({
|
|
116
|
+
plugins: [selector],
|
|
117
|
+
cwd: options.cwd,
|
|
118
|
+
env: options.env,
|
|
119
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
120
|
+
...(options.scope === 'project' ? { scope: 'project' } : {}),
|
|
121
|
+
...(options.rebuildRuntime?.catalogOperationContext
|
|
122
|
+
? { catalogOperationContext: options.rebuildRuntime.catalogOperationContext }
|
|
123
|
+
: {}),
|
|
124
|
+
});
|
|
125
|
+
for (const statusTarget of flattenStatusTargets(status.payload.targets)) {
|
|
126
|
+
const intent = statusTargetIntent(statusTarget);
|
|
127
|
+
if ((statusTarget.pluginId !== selector && statusTarget.pluginName !== options.pluginName)
|
|
128
|
+
|| !intent.enabled)
|
|
129
|
+
continue;
|
|
130
|
+
for (const scope of intent.scopes) {
|
|
131
|
+
if (options.scope === 'project' && scope !== 'project')
|
|
56
132
|
continue;
|
|
57
|
-
|
|
133
|
+
targets.push(await createCandidateTarget({
|
|
58
134
|
pluginName: options.pluginName,
|
|
59
|
-
platform,
|
|
135
|
+
platform: statusTarget.platform,
|
|
60
136
|
scope,
|
|
61
137
|
cwd: options.cwd,
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return { targets: dedupeTargets(targets), failures };
|
|
142
|
+
}
|
|
143
|
+
async function reinstallVisibleTargets(options) {
|
|
144
|
+
const nativeCliRunner = options.nativeCliRunner ?? getDefaultNativeCliRunner();
|
|
145
|
+
const discovered = options.discovered ?? await resolveConfigApplyTargets(options);
|
|
146
|
+
const targetResults = [...discovered.failures];
|
|
147
|
+
const commandResults = new Map();
|
|
148
|
+
const managedCommandProducerCache = options.rebuildRuntime?.managedCommandProducerCache
|
|
149
|
+
?? new Map();
|
|
150
|
+
let runtimeFailed = discovered.failures.length > 0
|
|
151
|
+
|| (discovered.commandDiscoveryErrors?.length ?? 0) > 0;
|
|
152
|
+
let invalidTargets = 0;
|
|
153
|
+
let unavailableTargets = 0;
|
|
154
|
+
const errors = [];
|
|
155
|
+
if ((discovered.commandDiscoveryErrors?.length ?? 0) > 0) {
|
|
156
|
+
errors.push(...discovered.commandDiscoveryErrors.map((error) => ({
|
|
157
|
+
stage: 'targetDiscovery', code: error.code, message: error.message,
|
|
158
|
+
})));
|
|
159
|
+
}
|
|
160
|
+
const reinstall = options.reinstallCommandImpl ?? syncWriteCommand;
|
|
161
|
+
if (options.plugin.sourceId && !options.plugin.pluginId) {
|
|
162
|
+
throw new Error(`Plugin "${options.plugin.manifest.name}" is missing its namespaced plugin ID.`);
|
|
163
|
+
}
|
|
164
|
+
const selector = options.plugin.sourceId
|
|
165
|
+
? options.plugin.pluginId
|
|
166
|
+
: options.plugin.manifest.name;
|
|
167
|
+
const nativeFailures = [];
|
|
168
|
+
for (const target of discovered.commandPackages ?? []) {
|
|
169
|
+
try {
|
|
170
|
+
await assertManagedCommandPackageNativeToolsUnchanged({ plugin: options.plugin, producer: target.producer, env: options.env });
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
nativeFailures.push({ producer: target.producer, state: 'failed', commandIds: [], removedCommandIds: [],
|
|
174
|
+
errors: [managedCommandDiagnostic(error)],
|
|
175
|
+
recoveryActions: [`aw command package sync ${selector} ${target.packageKey} --scope ${target.producer.scope} --yes`] });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (nativeFailures.length > 0) {
|
|
179
|
+
return { state: 'partial', commandResults: nativeFailures,
|
|
180
|
+
targetResults: [...targetResults, ...discovered.targets.map((target) => ({
|
|
181
|
+
target, action: 'reinstall', state: 'failed', errorCode: 'nativeToolSyncRequired',
|
|
182
|
+
message: 'Run a reviewed producer sync or package sync before configuration apply.',
|
|
183
|
+
}))] };
|
|
184
|
+
}
|
|
185
|
+
const sanitizeFailure = async (message, target) => {
|
|
186
|
+
let sensitiveValues = [];
|
|
187
|
+
try {
|
|
188
|
+
const effective = await resolveEffectivePluginConfig({
|
|
189
|
+
...(options.plugin.sourceId ? {
|
|
190
|
+
sourceId: options.plugin.sourceId,
|
|
191
|
+
sourceIdentity: options.plugin.sourceIdentity,
|
|
192
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
193
|
+
} : {}),
|
|
194
|
+
pluginName: options.plugin.manifest.name,
|
|
195
|
+
manifest: options.plugin.manifest,
|
|
196
|
+
targetScope: target.scope,
|
|
197
|
+
cwd: options.cwd,
|
|
198
|
+
env: options.env,
|
|
62
199
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
200
|
+
sensitiveValues = collectSensitivePluginConfigValues(options.plugin.manifest, effective.values);
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
// Generic credential redaction and known config paths still apply.
|
|
204
|
+
}
|
|
205
|
+
let sanitized = redactPluginScriptOutput(message, sensitiveValues);
|
|
206
|
+
for (const privatePath of [target.projectKey, options.cwd]) {
|
|
207
|
+
if (privatePath)
|
|
208
|
+
sanitized = sanitized.split(privatePath).join('<project>');
|
|
209
|
+
}
|
|
210
|
+
for (const scope of ['user', 'project']) {
|
|
211
|
+
const configPath = resolvePluginConfigStorePath({
|
|
212
|
+
sourceId: options.plugin.sourceId,
|
|
213
|
+
pluginName: options.plugin.manifest.name,
|
|
214
|
+
scope,
|
|
215
|
+
cwd: options.cwd,
|
|
216
|
+
env: options.env,
|
|
217
|
+
});
|
|
218
|
+
const safeTarget = `${scope}/plugin-config/${[
|
|
219
|
+
options.plugin.sourceId,
|
|
220
|
+
options.plugin.manifest.name,
|
|
221
|
+
'config.json',
|
|
222
|
+
].filter(Boolean).join('/')}`;
|
|
223
|
+
sanitized = sanitized.split(configPath).join(safeTarget);
|
|
224
|
+
}
|
|
225
|
+
return sanitized;
|
|
226
|
+
};
|
|
227
|
+
const sanitizeProjection = async (value, target, freeText = false) => {
|
|
228
|
+
if (typeof value === 'string')
|
|
229
|
+
return freeText ? sanitizeFailure(value, target) : value;
|
|
230
|
+
if (value === null || typeof value !== 'object')
|
|
231
|
+
return value;
|
|
232
|
+
if (Array.isArray(value)) {
|
|
233
|
+
return Promise.all(value.map((entry) => sanitizeProjection(entry, target, freeText)));
|
|
234
|
+
}
|
|
235
|
+
return Object.fromEntries(await Promise.all(Object.entries(value).map(async ([key, entry]) => [
|
|
236
|
+
key,
|
|
237
|
+
await sanitizeProjection(entry, target, typeof entry === 'string'
|
|
238
|
+
? /^(?:message|error|stack|stdout|stderr|output|warning)$/u.test(key)
|
|
239
|
+
: Array.isArray(entry) && /^(?:messages|warnings)$/u.test(key)),
|
|
240
|
+
])));
|
|
241
|
+
};
|
|
242
|
+
const preApplyExecutionCache = new Map();
|
|
243
|
+
for (const target of discovered.targets) {
|
|
244
|
+
try {
|
|
245
|
+
const effective = await resolveEffectivePluginConfig({
|
|
246
|
+
...(options.plugin.sourceId ? {
|
|
247
|
+
sourceId: options.plugin.sourceId,
|
|
248
|
+
sourceIdentity: options.plugin.sourceIdentity,
|
|
249
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
250
|
+
} : {}),
|
|
251
|
+
pluginName: options.plugin.manifest.name,
|
|
252
|
+
manifest: options.plugin.manifest,
|
|
253
|
+
targetScope: target.scope,
|
|
254
|
+
cwd: options.cwd,
|
|
255
|
+
env: options.env,
|
|
256
|
+
});
|
|
257
|
+
if (effective.issues.length > 0) {
|
|
258
|
+
invalidTargets += 1;
|
|
259
|
+
targetResults.push({
|
|
82
260
|
target,
|
|
83
261
|
action: 'reinstall',
|
|
84
|
-
state: '
|
|
85
|
-
|
|
262
|
+
state: 'skipped',
|
|
263
|
+
errorCode: 'invalidConfig',
|
|
264
|
+
message: 'The effective config is invalid for this target.',
|
|
86
265
|
});
|
|
266
|
+
continue;
|
|
87
267
|
}
|
|
88
268
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
269
|
+
catch {
|
|
270
|
+
runtimeFailed = true;
|
|
271
|
+
unavailableTargets += 1;
|
|
272
|
+
targetResults.push({
|
|
273
|
+
target,
|
|
274
|
+
action: 'reinstall',
|
|
275
|
+
state: 'failed',
|
|
276
|
+
errorCode: 'effectiveConfigUnavailable',
|
|
277
|
+
message: 'The effective config cannot be read for this target.',
|
|
278
|
+
});
|
|
279
|
+
errors.push({
|
|
280
|
+
stage: 'targetValidation',
|
|
281
|
+
code: 'effectiveConfigUnavailable',
|
|
282
|
+
message: 'The effective config cannot be read for a visible target.',
|
|
283
|
+
});
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
99
286
|
try {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
marketplaceName: options.plugin.marketplaceName,
|
|
105
|
-
marketplaceRoot: options.plugin.sourceId
|
|
106
|
-
? path.join(resolveAwHome(options.env), 'marketplaces', options.plugin.sourceId)
|
|
107
|
-
: undefined,
|
|
108
|
-
plugin: options.plugin,
|
|
287
|
+
const debugLogger = options.rebuildRuntime?.debugLogger;
|
|
288
|
+
const reporter = options.rebuildRuntime?.reporter;
|
|
289
|
+
const result = await reinstall([selector], {
|
|
290
|
+
cwd: options.cwd,
|
|
109
291
|
platform: target.platform,
|
|
110
292
|
scope: target.scope,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
293
|
+
...(options.rebuildRuntime?.scriptTimeoutMs === undefined
|
|
294
|
+
? {}
|
|
295
|
+
: { scriptTimeoutMs: options.rebuildRuntime.scriptTimeoutMs }),
|
|
296
|
+
}, {
|
|
297
|
+
...options.rebuildRuntime,
|
|
298
|
+
env: options.env,
|
|
299
|
+
nativeCliRunner,
|
|
300
|
+
preApplyConfirmed: options.preApplyConfirmed === true,
|
|
301
|
+
preApplyExecutionCache,
|
|
302
|
+
managedCommandProducerCache,
|
|
303
|
+
...(debugLogger ? {
|
|
304
|
+
debugLogger: {
|
|
305
|
+
...debugLogger,
|
|
306
|
+
log: async (value) => debugLogger.log(await sanitizeProjection(value, target)),
|
|
307
|
+
},
|
|
308
|
+
} : {}),
|
|
309
|
+
...(reporter ? {
|
|
310
|
+
reporter: {
|
|
311
|
+
event: async (value) => reporter.event(await sanitizeProjection(value, target)),
|
|
312
|
+
notice: async (value) => reporter.notice(await sanitizeProjection(value, target)),
|
|
313
|
+
},
|
|
314
|
+
} : {}),
|
|
119
315
|
});
|
|
120
|
-
|
|
121
|
-
|
|
316
|
+
options.rebuildRuntime?.operationDiagnosticSink?.(result.rebuildResults);
|
|
317
|
+
for (const producer of result.commandResults ?? []) {
|
|
318
|
+
commandResults.set(getCommandPackageId(producer.producer), producer);
|
|
319
|
+
if (producer.state !== 'completed')
|
|
320
|
+
runtimeFailed = true;
|
|
122
321
|
}
|
|
322
|
+
if (result.overallState !== 'succeeded')
|
|
323
|
+
runtimeFailed = true;
|
|
324
|
+
targetResults.push(...await Promise.all(result.targetResults.map(async (entry) => ({
|
|
325
|
+
...entry,
|
|
326
|
+
state: entry.action === 'skipped' ? 'skipped' : entry.state,
|
|
327
|
+
...(entry.message ? { message: await sanitizeFailure(entry.message, entry.target) } : {}),
|
|
328
|
+
}))));
|
|
123
329
|
}
|
|
124
330
|
catch (error) {
|
|
125
|
-
|
|
331
|
+
runtimeFailed = true;
|
|
332
|
+
const message = await sanitizeFailure(error instanceof Error ? error.message : String(error), target);
|
|
333
|
+
targetResults.push({
|
|
126
334
|
target,
|
|
127
335
|
action: 'reinstall',
|
|
128
336
|
state: 'failed',
|
|
129
|
-
message
|
|
337
|
+
message,
|
|
338
|
+
});
|
|
339
|
+
errors.push({
|
|
340
|
+
stage: 'apply',
|
|
341
|
+
code: 'targetApplyFailed',
|
|
342
|
+
message: 'A visible config apply target failed.',
|
|
130
343
|
});
|
|
131
344
|
}
|
|
132
345
|
}
|
|
133
|
-
|
|
346
|
+
for (const target of discovered.commandPackages ?? []) {
|
|
347
|
+
await options.rebuildRuntime?.reporter?.event({
|
|
348
|
+
type: 'managed-command:producer',
|
|
349
|
+
source: { plugin: options.plugin.manifest.name, scope: target.producer.scope },
|
|
350
|
+
data: { packageKey: target.packageKey, phase: 'start' },
|
|
351
|
+
});
|
|
352
|
+
let result;
|
|
353
|
+
if (!target.declared) {
|
|
354
|
+
result = {
|
|
355
|
+
producer: target.producer, state: 'failed', commandIds: [], removedCommandIds: [],
|
|
356
|
+
errors: [{ code: 'commandPackageDeclarationMissing',
|
|
357
|
+
message: 'The installed command package is no longer declared by this plugin.' }],
|
|
358
|
+
recoveryActions: [`aw command package remove ${target.packageId} --yes`],
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
try {
|
|
363
|
+
result = await syncPluginManagedCommandPackage({
|
|
364
|
+
plugin: options.plugin, packageKey: target.packageKey, scope: target.producer.scope,
|
|
365
|
+
cwd: options.cwd, env: options.env, managedCommandProducerCache,
|
|
366
|
+
event: options.changedConfigKeys?.length ? 'refresh' : 'install',
|
|
367
|
+
changedConfigKeys: options.changedConfigKeys ?? [],
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
catch {
|
|
371
|
+
result = {
|
|
372
|
+
producer: target.producer, state: 'failed', commandIds: [], removedCommandIds: [],
|
|
373
|
+
errors: [{ code: 'commandPackageApplyFailed', message: 'The managed command package could not be refreshed.' }],
|
|
374
|
+
recoveryActions: [`aw command package sync ${selector} ${target.packageKey} --scope ${target.producer.scope} --yes`,
|
|
375
|
+
`aw command package remove ${target.packageId} --yes`],
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
result = { ...result, errors: await Promise.all(result.errors.map(async (error) => ({
|
|
380
|
+
...error, message: await sanitizeFailure(error.message, { scope: target.producer.scope,
|
|
381
|
+
...(target.producer.projectRoot ? { projectKey: target.producer.projectRoot } : {}) }),
|
|
382
|
+
}))) };
|
|
383
|
+
commandResults.set(getCommandPackageId(result.producer), result);
|
|
384
|
+
await options.rebuildRuntime?.reporter?.event({
|
|
385
|
+
type: 'managed-command:producer',
|
|
386
|
+
source: { plugin: options.plugin.manifest.name, scope: target.producer.scope },
|
|
387
|
+
data: { packageKey: target.packageKey, phase: result.state === 'completed' ? 'success' : 'failure' },
|
|
388
|
+
});
|
|
389
|
+
if (result.state !== 'completed')
|
|
390
|
+
runtimeFailed = true;
|
|
391
|
+
}
|
|
392
|
+
const commands = commandResults.size > 0 ? { commandResults: [...commandResults.values()] } : {};
|
|
393
|
+
const commandTargetCount = (discovered.commandPackages?.length ?? 0);
|
|
394
|
+
if (discovered.targets.length === 0 && discovered.failures.length === 0
|
|
395
|
+
&& commandTargetCount === 0 && !runtimeFailed) {
|
|
396
|
+
return skippedApply('noVisibleTarget');
|
|
397
|
+
}
|
|
398
|
+
if (discovered.targets.length > 0 && invalidTargets === discovered.targets.length && commandTargetCount === 0) {
|
|
399
|
+
return { ...unavailableApply('invalidConfig', 'targetValidation', targetResults), ...commands };
|
|
400
|
+
}
|
|
401
|
+
if (discovered.targets.length > 0 && unavailableTargets === discovered.targets.length && commandTargetCount === 0) {
|
|
402
|
+
return { ...unavailableApply('effectiveConfigUnavailable', 'targetValidation', targetResults), ...commands };
|
|
403
|
+
}
|
|
404
|
+
if (runtimeFailed
|
|
405
|
+
|| invalidTargets > 0
|
|
406
|
+
|| unavailableTargets > 0
|
|
407
|
+
|| targetResults.some((entry) => entry.state === 'failed' || entry.state === 'skipped')) {
|
|
408
|
+
return {
|
|
409
|
+
state: 'partial',
|
|
410
|
+
targetResults,
|
|
411
|
+
...commands,
|
|
412
|
+
...(errors.length > 0 ? { errors } : {}),
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
return { state: 'succeeded', targetResults, ...commands };
|
|
134
416
|
}
|
|
135
|
-
async function
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
417
|
+
async function resolveConfigApplyTargets(options) {
|
|
418
|
+
const platformTargets = options.applyTargets !== undefined
|
|
419
|
+
? { targets: dedupeTargets(options.applyTargets), failures: [] }
|
|
420
|
+
: await discoverVisibleTargets({
|
|
139
421
|
pluginName: options.plugin.manifest.name,
|
|
140
422
|
plugin: options.plugin,
|
|
141
423
|
scope: options.scope,
|
|
142
424
|
cwd: options.cwd,
|
|
143
425
|
env: options.env,
|
|
144
|
-
nativeCliRunner,
|
|
426
|
+
nativeCliRunner: options.nativeCliRunner ?? getDefaultNativeCliRunner(),
|
|
145
427
|
rebuildRuntime: options.rebuildRuntime,
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
428
|
+
});
|
|
429
|
+
const commands = await discoverInstalledPluginManagedCommandPackages({
|
|
430
|
+
plugin: options.plugin, scope: options.scope, cwd: options.cwd, env: options.env,
|
|
431
|
+
platformTargets: platformTargets.targets,
|
|
432
|
+
});
|
|
433
|
+
return { ...platformTargets, commandPackages: commands.packages, commandDiscoveryErrors: commands.errors };
|
|
434
|
+
}
|
|
435
|
+
async function configApplyHasValidSharedNativeTarget(options) {
|
|
436
|
+
const sharedTargets = pluginSharedNativeConfigTargets(options.plugin);
|
|
437
|
+
if (options.targets.some((target) => sharedTargets.some((shared) => (shared.platform ?? 'codex') === target.platform))) {
|
|
438
|
+
const effective = await resolveEffectivePluginConfig({
|
|
439
|
+
...(options.plugin.sourceId ? {
|
|
440
|
+
sourceId: options.plugin.sourceId,
|
|
441
|
+
sourceIdentity: options.plugin.sourceIdentity,
|
|
442
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
443
|
+
} : {}),
|
|
444
|
+
pluginName: options.plugin.manifest.name,
|
|
445
|
+
manifest: options.plugin.manifest,
|
|
446
|
+
targetScope: 'user',
|
|
447
|
+
cwd: options.cwd,
|
|
448
|
+
env: options.env,
|
|
449
|
+
});
|
|
450
|
+
if (effective.issues.length === 0)
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
455
|
+
async function applyConfigToVisibleTargets(options) {
|
|
456
|
+
let discovered;
|
|
457
|
+
if (options.discovered) {
|
|
458
|
+
discovered = options.discovered;
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
try {
|
|
462
|
+
discovered = await resolveConfigApplyTargets(options);
|
|
463
|
+
}
|
|
464
|
+
catch {
|
|
465
|
+
return unavailableApply('targetDiscoveryFailed', 'targetDiscovery');
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
if (discovered.targets.length === 0
|
|
469
|
+
&& discovered.failures.length === 0
|
|
470
|
+
&& (discovered.commandPackages?.length ?? 0) === 0
|
|
471
|
+
&& options.noVisibleTargetHasInvalidConfig) {
|
|
472
|
+
return unavailableApply('invalidConfig', 'targetValidation');
|
|
473
|
+
}
|
|
474
|
+
return reinstallVisibleTargets({ ...options, discovered });
|
|
475
|
+
}
|
|
476
|
+
export async function resolveConfigPreApplyAuthorization(options) {
|
|
477
|
+
const applyTargets = dedupeTargets(options.applyTargets);
|
|
478
|
+
if (applyTargets.length === 0 || !pluginMayRunPreApply(options.plugin)) {
|
|
479
|
+
return { targets: [], availableApplyTargets: applyTargets, unavailableTargetResults: [] };
|
|
480
|
+
}
|
|
151
481
|
if (options.plugin.sourceId && !options.plugin.pluginId) {
|
|
152
|
-
|
|
482
|
+
return {
|
|
483
|
+
targets: [],
|
|
484
|
+
availableApplyTargets: [],
|
|
485
|
+
unavailableTargetResults: applyTargets.map((target) => ({
|
|
486
|
+
target,
|
|
487
|
+
action: 'reinstall',
|
|
488
|
+
state: 'failed',
|
|
489
|
+
errorCode: 'sourceUnavailable',
|
|
490
|
+
message: 'The preApply authorization scope cannot be resolved for this target.',
|
|
491
|
+
})),
|
|
492
|
+
};
|
|
153
493
|
}
|
|
154
494
|
const selector = options.plugin.sourceId
|
|
155
495
|
? options.plugin.pluginId
|
|
156
496
|
: options.plugin.manifest.name;
|
|
157
|
-
|
|
497
|
+
const groups = new Map();
|
|
498
|
+
for (const target of applyTargets) {
|
|
499
|
+
const targets = groups.get(target.scope) ?? [];
|
|
500
|
+
targets.push(target);
|
|
501
|
+
groups.set(target.scope, targets);
|
|
502
|
+
}
|
|
503
|
+
const authorization = [];
|
|
504
|
+
const availableApplyTargets = [];
|
|
505
|
+
const unavailableTargetResults = [];
|
|
506
|
+
const resolveGroup = async (targets) => {
|
|
507
|
+
const platforms = new Set(targets.map((target) => target.platform));
|
|
508
|
+
const platform = platforms.size === 2 ? 'both' : [...platforms][0];
|
|
158
509
|
try {
|
|
159
|
-
const
|
|
510
|
+
const preview = await (options.reinstallCommandImpl ?? syncWriteCommand)([selector], {
|
|
160
511
|
cwd: options.cwd,
|
|
161
|
-
platform
|
|
162
|
-
scope:
|
|
512
|
+
platform,
|
|
513
|
+
scope: targets[0].scope,
|
|
163
514
|
}, {
|
|
164
515
|
...options.rebuildRuntime,
|
|
165
|
-
env: options.env,
|
|
166
|
-
nativeCliRunner,
|
|
516
|
+
env: options.env ?? process.env,
|
|
517
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
518
|
+
resolvePreApplyAuthorization: true,
|
|
167
519
|
});
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
520
|
+
if (preview.overallState !== 'succeeded' || !preview.preApplyAuthorization)
|
|
521
|
+
return false;
|
|
522
|
+
authorization.push(...preview.preApplyAuthorization);
|
|
523
|
+
availableApplyTargets.push(...targets);
|
|
524
|
+
return true;
|
|
171
525
|
}
|
|
172
|
-
catch
|
|
173
|
-
|
|
174
|
-
|
|
526
|
+
catch {
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
for (const targets of groups.values()) {
|
|
531
|
+
if (await resolveGroup(targets))
|
|
532
|
+
continue;
|
|
533
|
+
for (const target of targets) {
|
|
534
|
+
if (targets.length > 1 && await resolveGroup([target]))
|
|
535
|
+
continue;
|
|
536
|
+
unavailableTargetResults.push({
|
|
175
537
|
target,
|
|
176
538
|
action: 'reinstall',
|
|
177
539
|
state: 'failed',
|
|
178
|
-
|
|
540
|
+
errorCode: 'sourceUnavailable',
|
|
541
|
+
message: 'The preApply authorization scope cannot be resolved for this target.',
|
|
179
542
|
});
|
|
180
543
|
}
|
|
181
544
|
}
|
|
182
|
-
const overallState = runtimeFailed || targetResults.some((entry) => entry.state === 'failed')
|
|
183
|
-
? 'failed' : 'succeeded';
|
|
184
545
|
return {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
546
|
+
targets: [...new Map(authorization.map((target) => [[
|
|
547
|
+
target.pluginId,
|
|
548
|
+
target.platform,
|
|
549
|
+
target.scope,
|
|
550
|
+
].join('\0'), target])).values()],
|
|
551
|
+
availableApplyTargets: dedupeTargets(availableApplyTargets),
|
|
552
|
+
unavailableTargetResults,
|
|
190
553
|
};
|
|
191
554
|
}
|
|
555
|
+
function pluginMayRunPreApply(plugin) {
|
|
556
|
+
return plugin.manifest.scripts?.preApply !== undefined
|
|
557
|
+
|| (plugin.manifest.dependencies?.length ?? 0) > 0;
|
|
558
|
+
}
|
|
559
|
+
function throwPreApplyAuthorizationRequired(targets) {
|
|
560
|
+
const plugins = [...new Set(targets.map((target) => target.pluginId))].join(', ');
|
|
561
|
+
const error = new Error(`preApplyAuthorizationRequired: Applying this config runs plugin preApply for ${plugins}. Re-run with --yes.`);
|
|
562
|
+
error.code = 'preApplyAuthorizationRequired';
|
|
563
|
+
throw error;
|
|
564
|
+
}
|
|
565
|
+
function preApplyAuthorizationIsConfirmed(options) {
|
|
566
|
+
if (options.confirmed !== true)
|
|
567
|
+
return false;
|
|
568
|
+
if (options.authorizedTargets === undefined)
|
|
569
|
+
return true;
|
|
570
|
+
const authorized = new Set(options.authorizedTargets.map((target) => [
|
|
571
|
+
target.pluginId,
|
|
572
|
+
target.sourceIdentity,
|
|
573
|
+
target.platform,
|
|
574
|
+
target.scope,
|
|
575
|
+
].join('\0')));
|
|
576
|
+
return options.required.every((target) => authorized.has([
|
|
577
|
+
target.pluginId,
|
|
578
|
+
target.sourceIdentity,
|
|
579
|
+
target.platform,
|
|
580
|
+
target.scope,
|
|
581
|
+
].join('\0')));
|
|
582
|
+
}
|
|
192
583
|
function otherProjectsWarning(scope) {
|
|
193
584
|
return scope === 'user'
|
|
194
|
-
? ['
|
|
585
|
+
? ['其它项目不会由本次命令扫描或更新,可能需要在对应项目目录中运行 aw sync。']
|
|
195
586
|
: [];
|
|
196
587
|
}
|
|
197
588
|
function buildReceiptFieldEntry(options) {
|
|
@@ -202,35 +593,133 @@ function buildReceiptFieldEntry(options) {
|
|
|
202
593
|
reserved: options.reserved,
|
|
203
594
|
action: options.action,
|
|
204
595
|
scope: options.scope,
|
|
205
|
-
...(options.scope === 'project' ? { projectLayer: options.projectLayer } : {}),
|
|
206
596
|
...(options.valueState ? { valueState: options.valueState } : {}),
|
|
207
597
|
};
|
|
208
598
|
}
|
|
209
599
|
export async function replayConfigRuntimeWrites(options) {
|
|
600
|
+
if (!options.awHomeMutationToken) {
|
|
601
|
+
await prepareNativeCliExecution({ env: options.env, runner: options.nativeCliRunner });
|
|
602
|
+
}
|
|
210
603
|
return withAwHomeMutationLock({
|
|
211
604
|
env: options.env,
|
|
212
605
|
token: options.awHomeMutationToken,
|
|
213
606
|
action: async (awHomeMutationToken) => {
|
|
214
|
-
const
|
|
607
|
+
const env = options.env ?? process.env;
|
|
608
|
+
const rebuildRuntime = { ...options.rebuildRuntime, awHomeMutationToken };
|
|
609
|
+
let discovered;
|
|
610
|
+
try {
|
|
611
|
+
discovered = await resolveConfigApplyTargets({
|
|
612
|
+
plugin: options.plugin,
|
|
613
|
+
scope: options.scope,
|
|
614
|
+
cwd: options.cwd,
|
|
615
|
+
env,
|
|
616
|
+
applyTargets: options.applyTargets,
|
|
617
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
618
|
+
rebuildRuntime,
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
catch {
|
|
622
|
+
const apply = unavailableApply('targetDiscoveryFailed', 'targetDiscovery');
|
|
623
|
+
return {
|
|
624
|
+
configWrite: 'succeeded',
|
|
625
|
+
overallState: 'partial',
|
|
626
|
+
apply: publicConfigApplyResult(apply),
|
|
627
|
+
otherProjectsMayRequireSync: false,
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
const preApplyAuthorization = await resolveConfigPreApplyAuthorization({
|
|
215
631
|
plugin: options.plugin,
|
|
216
632
|
scope: options.scope,
|
|
217
633
|
cwd: options.cwd,
|
|
218
|
-
env
|
|
634
|
+
env,
|
|
635
|
+
applyTargets: discovered.targets,
|
|
636
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
637
|
+
rebuildRuntime,
|
|
638
|
+
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
639
|
+
});
|
|
640
|
+
if (preApplyAuthorization.targets.length > 0 && !preApplyAuthorizationIsConfirmed({
|
|
641
|
+
required: preApplyAuthorization.targets,
|
|
642
|
+
confirmed: options.preApplyConfirmed,
|
|
643
|
+
authorizedTargets: options.preApplyAuthorizedTargets,
|
|
644
|
+
})) {
|
|
645
|
+
const apply = {
|
|
646
|
+
state: 'partial',
|
|
647
|
+
targetResults: preApplyAuthorization.targets.map((target) => ({
|
|
648
|
+
target: {
|
|
649
|
+
pluginName: target.pluginName,
|
|
650
|
+
pluginId: target.pluginId,
|
|
651
|
+
platform: target.platform,
|
|
652
|
+
scope: target.scope,
|
|
653
|
+
},
|
|
654
|
+
action: 'reinstall',
|
|
655
|
+
state: 'failed',
|
|
656
|
+
errorCode: 'preApplyAuthorizationRequired',
|
|
657
|
+
message: 'Running plugin preApply requires explicit authorization.',
|
|
658
|
+
})),
|
|
659
|
+
};
|
|
660
|
+
return {
|
|
661
|
+
configWrite: 'succeeded',
|
|
662
|
+
overallState: 'partial',
|
|
663
|
+
apply: publicConfigApplyResult(apply),
|
|
664
|
+
otherProjectsMayRequireSync: false,
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
discovered = {
|
|
668
|
+
...discovered,
|
|
669
|
+
targets: preApplyAuthorization.availableApplyTargets,
|
|
670
|
+
failures: [...discovered.failures, ...preApplyAuthorization.unavailableTargetResults],
|
|
671
|
+
};
|
|
672
|
+
if (discovered.targets.length === 0
|
|
673
|
+
&& preApplyAuthorization.unavailableTargetResults.length > 0
|
|
674
|
+
&& (discovered.commandPackages?.length ?? 0) === 0) {
|
|
675
|
+
const apply = unavailableApply('sourceUnavailable', 'source', preApplyAuthorization.unavailableTargetResults);
|
|
676
|
+
return {
|
|
677
|
+
configWrite: 'succeeded',
|
|
678
|
+
overallState: 'partial',
|
|
679
|
+
apply: publicConfigApplyResult(apply),
|
|
680
|
+
otherProjectsMayRequireSync: false,
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
if (options.scope === 'user'
|
|
684
|
+
&& options.sharedNativeApplyConfirmed !== true
|
|
685
|
+
&& pluginHasSharedNativeRefreshKeys(options.plugin)
|
|
686
|
+
&& await configApplyHasValidSharedNativeTarget({
|
|
687
|
+
plugin: options.plugin,
|
|
688
|
+
targets: discovered.targets,
|
|
689
|
+
cwd: options.cwd,
|
|
690
|
+
env,
|
|
691
|
+
})) {
|
|
692
|
+
throwSharedNativeApplyConfirmationRequired();
|
|
693
|
+
}
|
|
694
|
+
const apply = await reinstallVisibleTargets({
|
|
695
|
+
plugin: options.plugin,
|
|
696
|
+
scope: options.scope,
|
|
697
|
+
cwd: options.cwd,
|
|
698
|
+
env,
|
|
219
699
|
applyTargets: options.applyTargets,
|
|
220
700
|
nativeCliRunner: options.nativeCliRunner,
|
|
221
701
|
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
222
|
-
rebuildRuntime
|
|
702
|
+
rebuildRuntime,
|
|
703
|
+
discovered,
|
|
704
|
+
preApplyConfirmed: options.preApplyConfirmed,
|
|
223
705
|
});
|
|
224
706
|
return {
|
|
225
707
|
configWrite: 'succeeded',
|
|
226
|
-
overallState:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
otherProjectsRequireReinstall: options.scope === 'user',
|
|
708
|
+
overallState: overallStateForApply(apply),
|
|
709
|
+
apply: publicConfigApplyResult(apply),
|
|
710
|
+
otherProjectsMayRequireSync: false,
|
|
230
711
|
};
|
|
231
712
|
},
|
|
232
713
|
});
|
|
233
714
|
}
|
|
715
|
+
function pluginHasSharedNativeRefreshKeys(plugin) {
|
|
716
|
+
return pluginSharedNativeConfigTargets(plugin).length > 0;
|
|
717
|
+
}
|
|
718
|
+
function throwSharedNativeApplyConfirmationRequired() {
|
|
719
|
+
const error = new Error('sharedNativeConfigApplyConfirmationRequired: Applying this user config changes a shared native artifact. Re-run with --yes.');
|
|
720
|
+
error.code = 'sharedNativeConfigApplyConfirmationRequired';
|
|
721
|
+
throw error;
|
|
722
|
+
}
|
|
234
723
|
async function applyPluginConfigWriteUnlocked(options) {
|
|
235
724
|
const requestedPluginName = options.pluginName ?? options.plugin?.manifest.name;
|
|
236
725
|
if (!requestedPluginName)
|
|
@@ -239,8 +728,8 @@ async function applyPluginConfigWriteUnlocked(options) {
|
|
|
239
728
|
const configIdentity = options.plugin?.sourceId ? {
|
|
240
729
|
sourceId: options.plugin.sourceId,
|
|
241
730
|
sourceIdentity: options.plugin.sourceIdentity,
|
|
731
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
242
732
|
} : {};
|
|
243
|
-
const projectLayer = options.scope === 'project' ? (options.projectLayer ?? 'shared') : 'shared';
|
|
244
733
|
const requestedUpdates = options.request.updates ?? {};
|
|
245
734
|
const requestedRemoveKeys = uniqueInOrder(options.request.removeKeys ?? []);
|
|
246
735
|
const duplicateKeys = requestedRemoveKeys.filter((key) => Object.hasOwn(requestedUpdates, key));
|
|
@@ -252,113 +741,229 @@ async function applyPluginConfigWriteUnlocked(options) {
|
|
|
252
741
|
currentPlugin: options.plugin,
|
|
253
742
|
currentPluginError: options.pluginError,
|
|
254
743
|
scope: options.scope,
|
|
255
|
-
projectLayer,
|
|
256
744
|
cwd: options.cwd,
|
|
257
745
|
env: options.env,
|
|
258
746
|
});
|
|
259
747
|
const schemaPlugin = schemaAccess.plugin;
|
|
260
|
-
const schema = schemaPlugin?.manifest.config?.
|
|
748
|
+
const schema = schemaPlugin?.manifest.config?.fields;
|
|
261
749
|
if (!schema || !schemaPlugin) {
|
|
262
750
|
throw new Error(`configSchemaUnavailable: Plugin "${pluginName}" does not declare an AW config schema.`);
|
|
263
751
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
752
|
+
if (options.scope === 'project') {
|
|
753
|
+
const userStore = await readPluginConfigStore({
|
|
754
|
+
...configIdentity,
|
|
755
|
+
pluginName,
|
|
756
|
+
scope: 'user',
|
|
757
|
+
cwd: options.cwd,
|
|
758
|
+
env: options.env,
|
|
759
|
+
schema,
|
|
760
|
+
});
|
|
761
|
+
assertReadyPluginConfigStore(userStore);
|
|
267
762
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
763
|
+
if (options.scope === 'project') {
|
|
764
|
+
const rejectedSensitiveKeys = Object.keys(requestedUpdates)
|
|
765
|
+
.filter((key) => schema[key]?.sensitive === true);
|
|
766
|
+
if (rejectedSensitiveKeys.length > 0) {
|
|
767
|
+
const error = new Error('sensitiveProjectConfigUnsupported: Sensitive config can only be set in user scope.');
|
|
768
|
+
error.code = 'sensitiveProjectConfigUnsupported';
|
|
769
|
+
throw error;
|
|
770
|
+
}
|
|
771
|
+
const userOnlyKeys = codexNativeRefreshKeys(schemaPlugin.manifest);
|
|
772
|
+
const rejectedKeys = Object.keys(requestedUpdates).filter((key) => userOnlyKeys.has(key));
|
|
773
|
+
if (rejectedKeys.length > 0) {
|
|
774
|
+
const error = new Error(`sharedNativeConfigUserScopeRequired: Codex native Skill refresh keys can only be set in user scope: ${rejectedKeys.join(', ')}.`);
|
|
775
|
+
error.code = 'sharedNativeConfigUserScopeRequired';
|
|
776
|
+
throw error;
|
|
276
777
|
}
|
|
277
778
|
}
|
|
278
|
-
|
|
779
|
+
let discovered;
|
|
780
|
+
let targetDiscoveryFailed = false;
|
|
781
|
+
if (options.apply !== false) {
|
|
782
|
+
try {
|
|
783
|
+
discovered = await resolveConfigApplyTargets({
|
|
784
|
+
plugin: schemaPlugin,
|
|
785
|
+
scope: options.scope,
|
|
786
|
+
cwd: options.cwd,
|
|
787
|
+
env: options.env ?? process.env,
|
|
788
|
+
applyTargets: options.applyTargets,
|
|
789
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
790
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
catch {
|
|
794
|
+
targetDiscoveryFailed = true;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
const impact = await analyzePluginConfigMutationImpact({
|
|
798
|
+
plugin: schemaPlugin,
|
|
799
|
+
scope: options.scope,
|
|
800
|
+
cwd: options.cwd,
|
|
801
|
+
env: options.env,
|
|
802
|
+
visibleTargets: discovered?.targets ?? [],
|
|
803
|
+
...(discovered ? { commandDiscovery: {
|
|
804
|
+
packages: discovered.commandPackages ?? [], errors: discovered.commandDiscoveryErrors ?? [],
|
|
805
|
+
} } : {}),
|
|
806
|
+
mutation: {
|
|
807
|
+
kind: 'patch',
|
|
808
|
+
updates: requestedUpdates,
|
|
809
|
+
removeKeys: requestedRemoveKeys,
|
|
810
|
+
},
|
|
811
|
+
});
|
|
812
|
+
const updates = await coercePluginConfigUpdates({ schema, updates: requestedUpdates, cwd: options.cwd });
|
|
813
|
+
await assertPluginConfigMutationCandidate({
|
|
279
814
|
...configIdentity,
|
|
280
815
|
pluginName,
|
|
816
|
+
manifest: schemaPlugin.manifest,
|
|
281
817
|
scope: options.scope,
|
|
282
|
-
projectLayer,
|
|
283
818
|
cwd: options.cwd,
|
|
284
819
|
env: options.env,
|
|
820
|
+
updates,
|
|
821
|
+
removeKeys: requestedRemoveKeys,
|
|
285
822
|
});
|
|
286
823
|
const warnings = [];
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
824
|
+
const { updatedKeys, removedKeys, staleRemovedKeys } = impact;
|
|
825
|
+
let preApplyUnavailableReason;
|
|
826
|
+
let preApplyUnavailableTargetResults = [];
|
|
827
|
+
let applyDiscovery = discovered
|
|
828
|
+
? { ...discovered, targets: impact.affectedTargets, failures: discovered.failures,
|
|
829
|
+
commandPackages: impact.affectedCommandPackages }
|
|
830
|
+
: undefined;
|
|
831
|
+
const shouldApply = options.apply !== false && impact.storeChanged && !impact.noEffectiveChange;
|
|
832
|
+
if (shouldApply && pluginMayRunPreApply(schemaPlugin)) {
|
|
833
|
+
if (applyDiscovery) {
|
|
834
|
+
const preApplyAuthorization = await resolveConfigPreApplyAuthorization({
|
|
835
|
+
plugin: schemaPlugin,
|
|
836
|
+
scope: options.scope,
|
|
837
|
+
cwd: options.cwd,
|
|
838
|
+
env: options.env,
|
|
839
|
+
applyTargets: applyDiscovery.targets,
|
|
840
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
841
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
842
|
+
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
843
|
+
});
|
|
844
|
+
if (preApplyAuthorization.targets.length > 0 && !preApplyAuthorizationIsConfirmed({
|
|
845
|
+
required: preApplyAuthorization.targets,
|
|
846
|
+
confirmed: options.preApplyConfirmed,
|
|
847
|
+
authorizedTargets: options.preApplyAuthorizedTargets,
|
|
848
|
+
})) {
|
|
849
|
+
throwPreApplyAuthorizationRequired(preApplyAuthorization.targets);
|
|
850
|
+
}
|
|
851
|
+
preApplyUnavailableTargetResults = preApplyAuthorization.unavailableTargetResults;
|
|
852
|
+
applyDiscovery = {
|
|
853
|
+
...applyDiscovery,
|
|
854
|
+
targets: preApplyAuthorization.availableApplyTargets,
|
|
855
|
+
failures: [...applyDiscovery.failures, ...preApplyUnavailableTargetResults],
|
|
856
|
+
};
|
|
857
|
+
if (applyDiscovery.targets.length === 0 && preApplyUnavailableTargetResults.length > 0
|
|
858
|
+
&& (applyDiscovery.commandPackages?.length ?? 0) === 0) {
|
|
859
|
+
preApplyUnavailableReason = 'sourceUnavailable';
|
|
860
|
+
}
|
|
308
861
|
}
|
|
309
862
|
}
|
|
310
|
-
if (
|
|
311
|
-
|
|
863
|
+
if (options.apply !== false
|
|
864
|
+
&& options.scope === 'user'
|
|
865
|
+
&& options.sharedNativeApplyConfirmed !== true
|
|
866
|
+
&& impact.sharedNativeRenderTargets.some((shared) => impact.affectedTargets
|
|
867
|
+
.some((target) => target.platform === (shared.platform ?? 'codex')))) {
|
|
868
|
+
throwSharedNativeApplyConfirmationRequired();
|
|
869
|
+
}
|
|
870
|
+
if (impact.storeChanged) {
|
|
871
|
+
try {
|
|
872
|
+
const write = await patchPluginConfigStore({
|
|
873
|
+
...configIdentity,
|
|
874
|
+
pluginName,
|
|
875
|
+
scope: options.scope,
|
|
876
|
+
cwd: options.cwd,
|
|
877
|
+
env: options.env,
|
|
878
|
+
updates: Object.fromEntries(updatedKeys.map((key) => [key, updates[key]])),
|
|
879
|
+
removeKeys: requestedRemoveKeys,
|
|
880
|
+
schema,
|
|
881
|
+
});
|
|
882
|
+
warnings.push(...write.warnings);
|
|
883
|
+
}
|
|
884
|
+
catch (error) {
|
|
885
|
+
throw markConfigWriteFailed(error);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
let effective;
|
|
889
|
+
try {
|
|
890
|
+
effective = summarizeEffectivePluginConfig(await resolveEffectivePluginConfig({
|
|
312
891
|
...configIdentity,
|
|
313
892
|
pluginName,
|
|
314
|
-
|
|
315
|
-
|
|
893
|
+
manifest: schemaPlugin.manifest,
|
|
894
|
+
targetScope: options.scope,
|
|
316
895
|
cwd: options.cwd,
|
|
317
896
|
env: options.env,
|
|
318
|
-
|
|
319
|
-
removeKeys: requestedRemoveKeys,
|
|
320
|
-
});
|
|
897
|
+
}));
|
|
321
898
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
const applied = changedKeys.length === 0
|
|
330
|
-
? {
|
|
331
|
-
overallState: 'succeeded',
|
|
332
|
-
targetResults: [],
|
|
333
|
-
applySkippedReason: 'noConfigChange',
|
|
334
|
-
}
|
|
335
|
-
: await reinstallVisibleTargets({
|
|
336
|
-
plugin: schemaPlugin,
|
|
899
|
+
catch {
|
|
900
|
+
const apply = unavailableApply('effectiveConfigUnavailable', 'effectiveConfig', [], impact.affectedCommandPackages);
|
|
901
|
+
const otherProjectsMayRequireSync = options.scope === 'user' && impact.storeChanged;
|
|
902
|
+
if (otherProjectsMayRequireSync)
|
|
903
|
+
warnings.push(...otherProjectsWarning(options.scope));
|
|
904
|
+
return {
|
|
905
|
+
plugin: pluginName,
|
|
337
906
|
scope: options.scope,
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
907
|
+
...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
|
|
908
|
+
updatedKeys,
|
|
909
|
+
removedKeys,
|
|
910
|
+
staleRemovedKeys,
|
|
911
|
+
configWrite: 'succeeded',
|
|
912
|
+
overallState: 'partial',
|
|
913
|
+
apply: publicConfigApplyResult(apply),
|
|
914
|
+
otherProjectsMayRequireSync,
|
|
915
|
+
warnings,
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
let apply;
|
|
919
|
+
try {
|
|
920
|
+
apply = !impact.storeChanged
|
|
921
|
+
? skippedApply('noConfigChange')
|
|
922
|
+
: options.apply === false
|
|
923
|
+
? skippedApply('notRequested')
|
|
924
|
+
: targetDiscoveryFailed
|
|
925
|
+
? unavailableApply('targetDiscoveryFailed', 'targetDiscovery')
|
|
926
|
+
: impact.noEffectiveChange
|
|
927
|
+
&& ((discovered?.targets.length ?? 0) + impact.commandPackages.length > 0
|
|
928
|
+
|| staleRemovedKeys.length === impact.changedKeys.length)
|
|
929
|
+
? skippedApply('noEffectiveConfigChange')
|
|
930
|
+
: preApplyUnavailableReason
|
|
931
|
+
? unavailableApply(preApplyUnavailableReason, preApplyUnavailableReason === 'sourceUnavailable' ? 'source' : 'targetDiscovery', preApplyUnavailableTargetResults)
|
|
932
|
+
: await applyConfigToVisibleTargets({
|
|
933
|
+
plugin: schemaPlugin,
|
|
934
|
+
scope: options.scope,
|
|
935
|
+
cwd: options.cwd,
|
|
936
|
+
env: options.env ?? process.env,
|
|
937
|
+
applyTargets: applyDiscovery?.targets ?? impact.affectedTargets,
|
|
938
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
939
|
+
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
940
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
941
|
+
noVisibleTargetHasInvalidConfig: (discovered?.targets.length ?? 0) > 0
|
|
942
|
+
&& effective.issues.length > 0,
|
|
943
|
+
preApplyConfirmed: options.preApplyConfirmed,
|
|
944
|
+
discovered: applyDiscovery,
|
|
945
|
+
changedConfigKeys: impact.changedKeys,
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
catch (error) {
|
|
949
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
950
|
+
throw Object.assign(failure, { configWrite: 'succeeded' });
|
|
951
|
+
}
|
|
952
|
+
const otherProjectsMayRequireSync = options.scope === 'user' && impact.storeChanged;
|
|
953
|
+
if (otherProjectsMayRequireSync)
|
|
348
954
|
warnings.push(...otherProjectsWarning(options.scope));
|
|
349
955
|
return {
|
|
350
956
|
plugin: pluginName,
|
|
351
957
|
scope: options.scope,
|
|
352
|
-
projectLayer,
|
|
353
958
|
...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
|
|
354
959
|
updatedKeys,
|
|
355
960
|
removedKeys,
|
|
961
|
+
staleRemovedKeys,
|
|
356
962
|
effective,
|
|
357
963
|
configWrite: 'succeeded',
|
|
358
|
-
overallState:
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
otherProjectsRequireReinstall,
|
|
964
|
+
overallState: overallStateForApply(apply),
|
|
965
|
+
apply: publicConfigApplyResult(apply),
|
|
966
|
+
otherProjectsMayRequireSync,
|
|
362
967
|
warnings,
|
|
363
968
|
};
|
|
364
969
|
}
|
|
@@ -366,162 +971,372 @@ export async function applyPluginConfigWrite(options) {
|
|
|
366
971
|
const requestedPluginName = options.pluginName ?? options.plugin?.manifest.name;
|
|
367
972
|
if (!requestedPluginName)
|
|
368
973
|
throw new Error('Plugin name is required for config write.');
|
|
369
|
-
|
|
974
|
+
assertSafePluginConfigSegment(requestedPluginName);
|
|
975
|
+
if (options.scope === 'project') {
|
|
976
|
+
const targetPath = resolvePluginConfigStorePath({
|
|
977
|
+
sourceId: options.plugin?.sourceId,
|
|
978
|
+
pluginName: requestedPluginName,
|
|
979
|
+
scope: 'project',
|
|
980
|
+
cwd: options.cwd,
|
|
981
|
+
env: options.env,
|
|
982
|
+
});
|
|
983
|
+
await assertProjectSharedConfigPathVisible({
|
|
984
|
+
cwd: options.cwd,
|
|
985
|
+
targetPath,
|
|
986
|
+
env: options.env,
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
if (options.apply !== false && !options.awHomeMutationToken) {
|
|
990
|
+
await prepareNativeCliExecution({ env: options.env, runner: options.nativeCliRunner });
|
|
991
|
+
}
|
|
370
992
|
return withAwHomeMutationLock({
|
|
371
993
|
env: options.env,
|
|
372
994
|
token: options.awHomeMutationToken,
|
|
373
|
-
action: (awHomeMutationToken) =>
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
projectLayer: options.scope === 'project' ? (options.projectLayer ?? 'shared') : 'shared',
|
|
378
|
-
cwd: options.cwd,
|
|
379
|
-
env: options.env,
|
|
380
|
-
action: async () => {
|
|
381
|
-
await options.reviewPreflight?.();
|
|
382
|
-
return applyPluginConfigWriteUnlocked({
|
|
995
|
+
action: async (awHomeMutationToken) => {
|
|
996
|
+
await options.reviewPreflight?.();
|
|
997
|
+
try {
|
|
998
|
+
return await applyPluginConfigWriteUnlocked({
|
|
383
999
|
...options,
|
|
384
1000
|
awHomeMutationToken,
|
|
385
1001
|
rebuildRuntime: { ...options.rebuildRuntime, awHomeMutationToken },
|
|
386
1002
|
});
|
|
387
|
-
}
|
|
388
|
-
|
|
1003
|
+
}
|
|
1004
|
+
catch (error) {
|
|
1005
|
+
let sensitiveValues = options.plugin
|
|
1006
|
+
? collectSensitivePluginConfigValues(options.plugin.manifest, (options.request.updates ?? {}))
|
|
1007
|
+
: [];
|
|
1008
|
+
if (options.plugin) {
|
|
1009
|
+
try {
|
|
1010
|
+
const effective = await resolveEffectivePluginConfig({
|
|
1011
|
+
...(options.plugin.sourceId ? {
|
|
1012
|
+
sourceId: options.plugin.sourceId,
|
|
1013
|
+
sourceIdentity: options.plugin.sourceIdentity,
|
|
1014
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
1015
|
+
} : {}),
|
|
1016
|
+
pluginName: options.plugin.manifest.name,
|
|
1017
|
+
manifest: options.plugin.manifest,
|
|
1018
|
+
targetScope: options.scope,
|
|
1019
|
+
cwd: options.cwd,
|
|
1020
|
+
env: options.env,
|
|
1021
|
+
});
|
|
1022
|
+
sensitiveValues = [
|
|
1023
|
+
...sensitiveValues,
|
|
1024
|
+
...collectSensitivePluginConfigValues(options.plugin.manifest, effective.values),
|
|
1025
|
+
];
|
|
1026
|
+
}
|
|
1027
|
+
catch {
|
|
1028
|
+
// Requested sensitive values and generic credential redaction remain available.
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
let message = redactPluginScriptOutput(error instanceof Error ? error.message : String(error), sensitiveValues);
|
|
1032
|
+
message = message.split(options.cwd).join('<project>');
|
|
1033
|
+
for (const scope of ['user', 'project']) {
|
|
1034
|
+
const configPath = resolvePluginConfigStorePath({
|
|
1035
|
+
sourceId: options.plugin?.sourceId,
|
|
1036
|
+
pluginName: requestedPluginName,
|
|
1037
|
+
scope,
|
|
1038
|
+
cwd: options.cwd,
|
|
1039
|
+
env: options.env,
|
|
1040
|
+
});
|
|
1041
|
+
message = message.split(configPath).join(`${scope}/plugin-config/${[
|
|
1042
|
+
options.plugin?.sourceId,
|
|
1043
|
+
requestedPluginName,
|
|
1044
|
+
'config.json',
|
|
1045
|
+
].filter(Boolean).join('/')}`);
|
|
1046
|
+
}
|
|
1047
|
+
const safeError = new Error(message);
|
|
1048
|
+
const code = error.code;
|
|
1049
|
+
safeError.code = typeof code === 'string' ? code
|
|
1050
|
+
: message.startsWith('schemaVersionUnsupported:') ? 'schemaVersionUnsupported'
|
|
1051
|
+
: 'configApplyFailed';
|
|
1052
|
+
const configWrite = error.configWrite;
|
|
1053
|
+
if (configWrite === 'succeeded' || configWriteStateForError(error) === 'failed') {
|
|
1054
|
+
safeError.configWrite = configWrite === 'succeeded' ? 'succeeded' : 'failed';
|
|
1055
|
+
}
|
|
1056
|
+
if (error && typeof error === 'object' && 'operationDiagnostic' in error) {
|
|
1057
|
+
safeError.operationDiagnostic = error.operationDiagnostic;
|
|
1058
|
+
}
|
|
1059
|
+
throw safeError;
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
389
1062
|
});
|
|
390
1063
|
}
|
|
391
1064
|
async function resetPluginConfigWithHelperUnlocked(options) {
|
|
392
1065
|
const pluginName = assertSafePluginConfigSegment(options.pluginName);
|
|
393
|
-
|
|
394
|
-
if (!options.plugin) {
|
|
395
|
-
throw new Error(`sourceMissing: Plugin "${pluginName}" is unavailable; config reset was not applied.`);
|
|
396
|
-
}
|
|
397
|
-
const schemaAccess = await resolvePluginConfigSchemaAccess({
|
|
398
|
-
pluginName,
|
|
399
|
-
currentPlugin: options.plugin,
|
|
400
|
-
scope: options.scope,
|
|
401
|
-
projectLayer,
|
|
402
|
-
cwd: options.cwd,
|
|
403
|
-
env: options.env,
|
|
404
|
-
});
|
|
405
|
-
if (!schemaAccess.plugin?.manifest.config?.schema) {
|
|
406
|
-
throw new Error(`configSchemaUnavailable: Plugin "${pluginName}" does not declare an AW config schema.`);
|
|
407
|
-
}
|
|
408
|
-
const configIdentity = options.plugin.sourceId ? {
|
|
1066
|
+
let configIdentity = options.plugin?.sourceId ? {
|
|
409
1067
|
sourceId: options.plugin.sourceId,
|
|
410
1068
|
sourceIdentity: options.plugin.sourceIdentity,
|
|
1069
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
1070
|
+
} : options.sourceId ? {
|
|
1071
|
+
sourceId: options.sourceId,
|
|
1072
|
+
sourceIdentity: options.sourceIdentity,
|
|
1073
|
+
logicalIdentity: options.logicalIdentity,
|
|
411
1074
|
} : {};
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
projectLayer,
|
|
417
|
-
cwd: options.cwd,
|
|
418
|
-
env: options.env,
|
|
419
|
-
});
|
|
420
|
-
const removedKeys = collectRemovedConfigKeys(store.values);
|
|
421
|
-
const warnings = [];
|
|
422
|
-
if (options.scope === 'project' && projectLayer === 'shared' && store.exists) {
|
|
423
|
-
await assertProjectSharedConfigPathVisible({ cwd: options.cwd, targetPath: store.path });
|
|
424
|
-
}
|
|
425
|
-
if (options.scope === 'project' && projectLayer === 'local') {
|
|
426
|
-
const ignore = await ensureProjectPrivateStateIgnore({ cwd: options.cwd, targetPath: store.path });
|
|
427
|
-
if (ignore.warning)
|
|
428
|
-
warnings.push(ignore.warning);
|
|
429
|
-
}
|
|
430
|
-
const reset = await resetPluginConfigStore({
|
|
431
|
-
...configIdentity,
|
|
432
|
-
pluginName,
|
|
433
|
-
scope: options.scope,
|
|
434
|
-
projectLayer,
|
|
435
|
-
cwd: options.cwd,
|
|
436
|
-
env: options.env,
|
|
437
|
-
});
|
|
438
|
-
let applied = {
|
|
439
|
-
overallState: 'succeeded',
|
|
440
|
-
targetResults: [],
|
|
441
|
-
applySkippedReason: 'noConfigChange',
|
|
442
|
-
};
|
|
443
|
-
let effective;
|
|
444
|
-
if (schemaAccess.plugin) {
|
|
445
|
-
if (schemaAccess.plugin.manifest.config?.schema) {
|
|
446
|
-
effective = summarizeEffectivePluginConfig(await resolveEffectivePluginConfig({
|
|
447
|
-
...configIdentity,
|
|
1075
|
+
if (options.sourceId && !options.sourceIdentity) {
|
|
1076
|
+
try {
|
|
1077
|
+
const identity = await readNamespacedPluginConfigStoreIdentity({
|
|
1078
|
+
sourceId: options.sourceId,
|
|
448
1079
|
pluginName,
|
|
449
|
-
|
|
1080
|
+
scope: options.scope,
|
|
450
1081
|
cwd: options.cwd,
|
|
451
1082
|
env: options.env,
|
|
452
|
-
})
|
|
1083
|
+
});
|
|
1084
|
+
if (identity?.binding.kind === 'source')
|
|
1085
|
+
configIdentity = {
|
|
1086
|
+
sourceId: options.sourceId,
|
|
1087
|
+
sourceIdentity: identity.binding.sourceIdentity,
|
|
1088
|
+
};
|
|
1089
|
+
if (identity?.binding.kind === 'catalog')
|
|
1090
|
+
configIdentity = {
|
|
1091
|
+
sourceId: options.sourceId,
|
|
1092
|
+
logicalIdentity: identity.binding.logicalIdentity,
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
catch {
|
|
1096
|
+
// Reset does not require a readable or valid envelope.
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
let removedKeys = [];
|
|
1100
|
+
try {
|
|
1101
|
+
const store = await readPluginConfigStore({
|
|
1102
|
+
...configIdentity,
|
|
1103
|
+
pluginName,
|
|
1104
|
+
scope: options.scope,
|
|
1105
|
+
cwd: options.cwd,
|
|
1106
|
+
env: options.env,
|
|
1107
|
+
});
|
|
1108
|
+
removedKeys = collectRemovedConfigKeys(store.values);
|
|
1109
|
+
}
|
|
1110
|
+
catch {
|
|
1111
|
+
// Reset is the final recovery boundary and does not require a readable store.
|
|
1112
|
+
}
|
|
1113
|
+
const warnings = [];
|
|
1114
|
+
let impact;
|
|
1115
|
+
let targetDiscoveryFailed = false;
|
|
1116
|
+
let visibleTargets = [];
|
|
1117
|
+
let discovered;
|
|
1118
|
+
if (options.plugin) {
|
|
1119
|
+
if (options.apply !== false) {
|
|
1120
|
+
try {
|
|
1121
|
+
discovered = await resolveConfigApplyTargets({
|
|
1122
|
+
plugin: options.plugin,
|
|
1123
|
+
scope: options.scope,
|
|
1124
|
+
cwd: options.cwd,
|
|
1125
|
+
env: options.env ?? process.env,
|
|
1126
|
+
applyTargets: options.applyTargets,
|
|
1127
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
1128
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
1129
|
+
});
|
|
1130
|
+
visibleTargets = discovered.targets;
|
|
1131
|
+
}
|
|
1132
|
+
catch {
|
|
1133
|
+
targetDiscoveryFailed = true;
|
|
1134
|
+
}
|
|
453
1135
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
plugin:
|
|
1136
|
+
try {
|
|
1137
|
+
impact = await analyzePluginConfigMutationImpact({
|
|
1138
|
+
plugin: options.plugin,
|
|
457
1139
|
scope: options.scope,
|
|
458
1140
|
cwd: options.cwd,
|
|
459
|
-
env: options.env
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
1141
|
+
env: options.env,
|
|
1142
|
+
visibleTargets,
|
|
1143
|
+
...(discovered ? { commandDiscovery: {
|
|
1144
|
+
packages: discovered.commandPackages ?? [], errors: discovered.commandDiscoveryErrors ?? [],
|
|
1145
|
+
} } : {}),
|
|
1146
|
+
mutation: { kind: 'reset' },
|
|
464
1147
|
});
|
|
1148
|
+
removedKeys = impact.removedKeys;
|
|
1149
|
+
}
|
|
1150
|
+
catch {
|
|
1151
|
+
// Reset remains available when its before state cannot be read.
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
let preApplyUnavailableReason;
|
|
1155
|
+
let preApplyUnavailableTargetResults = [];
|
|
1156
|
+
let applyDiscovery = options.plugin && !targetDiscoveryFailed
|
|
1157
|
+
? { targets: impact?.affectedTargets ?? visibleTargets, failures: [],
|
|
1158
|
+
commandPackages: impact?.affectedCommandPackages ?? discovered?.commandPackages,
|
|
1159
|
+
commandDiscoveryErrors: impact?.commandDiscoveryErrors ?? discovered?.commandDiscoveryErrors }
|
|
1160
|
+
: undefined;
|
|
1161
|
+
if (options.plugin
|
|
1162
|
+
&& options.apply !== false
|
|
1163
|
+
&& impact?.storeChanged
|
|
1164
|
+
&& !impact.noEffectiveChange
|
|
1165
|
+
&& applyDiscovery
|
|
1166
|
+
&& pluginMayRunPreApply(options.plugin)) {
|
|
1167
|
+
const preApplyAuthorization = await resolveConfigPreApplyAuthorization({
|
|
1168
|
+
plugin: options.plugin,
|
|
1169
|
+
scope: options.scope,
|
|
1170
|
+
cwd: options.cwd,
|
|
1171
|
+
env: options.env,
|
|
1172
|
+
applyTargets: applyDiscovery.targets,
|
|
1173
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
1174
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
1175
|
+
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
1176
|
+
});
|
|
1177
|
+
if (preApplyAuthorization.targets.length > 0 && !preApplyAuthorizationIsConfirmed({
|
|
1178
|
+
required: preApplyAuthorization.targets,
|
|
1179
|
+
confirmed: options.preApplyConfirmed,
|
|
1180
|
+
authorizedTargets: options.preApplyAuthorizedTargets,
|
|
1181
|
+
})) {
|
|
1182
|
+
throwPreApplyAuthorizationRequired(preApplyAuthorization.targets);
|
|
1183
|
+
}
|
|
1184
|
+
preApplyUnavailableTargetResults = preApplyAuthorization.unavailableTargetResults;
|
|
1185
|
+
applyDiscovery = {
|
|
1186
|
+
...applyDiscovery,
|
|
1187
|
+
targets: preApplyAuthorization.availableApplyTargets,
|
|
1188
|
+
failures: preApplyUnavailableTargetResults,
|
|
1189
|
+
};
|
|
1190
|
+
if (applyDiscovery.targets.length === 0 && preApplyUnavailableTargetResults.length > 0
|
|
1191
|
+
&& (applyDiscovery.commandPackages?.length ?? 0) === 0) {
|
|
1192
|
+
preApplyUnavailableReason = 'sourceUnavailable';
|
|
465
1193
|
}
|
|
466
1194
|
}
|
|
467
|
-
|
|
1195
|
+
if (options.plugin
|
|
1196
|
+
&& options.apply !== false
|
|
468
1197
|
&& options.scope === 'user'
|
|
469
|
-
&&
|
|
470
|
-
|
|
1198
|
+
&& options.sharedNativeApplyConfirmed !== true
|
|
1199
|
+
&& (impact
|
|
1200
|
+
? impact.sharedNativeRenderTargets.some((shared) => impact.affectedTargets
|
|
1201
|
+
.some((target) => target.platform === (shared.platform ?? 'codex')))
|
|
1202
|
+
: pluginSharedNativeConfigTargets(options.plugin).some((shared) => visibleTargets
|
|
1203
|
+
.some((target) => target.platform === (shared.platform ?? 'codex'))))) {
|
|
1204
|
+
throwSharedNativeApplyConfirmationRequired();
|
|
1205
|
+
}
|
|
1206
|
+
let reset;
|
|
1207
|
+
try {
|
|
1208
|
+
reset = await resetPluginConfigStore({
|
|
1209
|
+
...configIdentity,
|
|
1210
|
+
pluginName,
|
|
1211
|
+
scope: options.scope,
|
|
1212
|
+
cwd: options.cwd,
|
|
1213
|
+
env: options.env,
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
catch (error) {
|
|
1217
|
+
throw markConfigWriteFailed(error);
|
|
1218
|
+
}
|
|
1219
|
+
let schemaAccess;
|
|
1220
|
+
let apply = reset.deleted ? skippedApply('notRequested') : skippedApply('noConfigChange');
|
|
1221
|
+
let effective;
|
|
1222
|
+
if (options.plugin) {
|
|
1223
|
+
try {
|
|
1224
|
+
schemaAccess = await resolvePluginConfigSchemaAccess({
|
|
1225
|
+
pluginName,
|
|
1226
|
+
currentPlugin: options.plugin,
|
|
1227
|
+
scope: options.scope,
|
|
1228
|
+
cwd: options.cwd,
|
|
1229
|
+
env: options.env,
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
catch {
|
|
1233
|
+
if (reset.deleted && options.apply !== false) {
|
|
1234
|
+
apply = unavailableApply('sourceUnavailable', 'source');
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
const schemaPlugin = schemaAccess?.plugin;
|
|
1238
|
+
if (schemaPlugin?.manifest.config?.fields) {
|
|
1239
|
+
try {
|
|
1240
|
+
effective = summarizeEffectivePluginConfig(await resolveEffectivePluginConfig({
|
|
1241
|
+
...configIdentity,
|
|
1242
|
+
pluginName,
|
|
1243
|
+
manifest: schemaPlugin.manifest,
|
|
1244
|
+
targetScope: options.scope,
|
|
1245
|
+
cwd: options.cwd,
|
|
1246
|
+
env: options.env,
|
|
1247
|
+
}));
|
|
1248
|
+
}
|
|
1249
|
+
catch {
|
|
1250
|
+
if (reset.deleted && options.apply !== false) {
|
|
1251
|
+
apply = unavailableApply('effectiveConfigUnavailable', 'effectiveConfig', [], impact?.affectedCommandPackages);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
if (reset.deleted
|
|
1255
|
+
&& options.apply !== false
|
|
1256
|
+
&& apply.state === 'skipped'
|
|
1257
|
+
&& impact?.noEffectiveChange
|
|
1258
|
+
&& visibleTargets.length + (impact?.commandPackages.length ?? 0) > 0) {
|
|
1259
|
+
apply = skippedApply('noEffectiveConfigChange');
|
|
1260
|
+
}
|
|
1261
|
+
else if (reset.deleted
|
|
1262
|
+
&& options.apply !== false
|
|
1263
|
+
&& apply.state === 'skipped'
|
|
1264
|
+
&& targetDiscoveryFailed) {
|
|
1265
|
+
apply = unavailableApply('targetDiscoveryFailed', 'targetDiscovery');
|
|
1266
|
+
}
|
|
1267
|
+
else if (reset.deleted && options.apply !== false && apply.state === 'skipped') {
|
|
1268
|
+
apply = preApplyUnavailableReason
|
|
1269
|
+
? unavailableApply(preApplyUnavailableReason, 'source', preApplyUnavailableTargetResults)
|
|
1270
|
+
: await applyConfigToVisibleTargets({
|
|
1271
|
+
plugin: schemaPlugin,
|
|
1272
|
+
scope: options.scope,
|
|
1273
|
+
cwd: options.cwd,
|
|
1274
|
+
env: options.env ?? process.env,
|
|
1275
|
+
applyTargets: applyDiscovery?.targets ?? impact?.affectedTargets ?? options.applyTargets,
|
|
1276
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
1277
|
+
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
1278
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
1279
|
+
noVisibleTargetHasInvalidConfig: (effective?.issues.length ?? 0) > 0,
|
|
1280
|
+
preApplyConfirmed: options.preApplyConfirmed,
|
|
1281
|
+
discovered: applyDiscovery,
|
|
1282
|
+
changedConfigKeys: impact?.changedKeys ?? removedKeys,
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
else if (reset.deleted && options.apply !== false && apply.state === 'skipped') {
|
|
1287
|
+
apply = unavailableApply('schemaUnavailable', 'schema');
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
else if (reset.deleted && options.apply !== false) {
|
|
1291
|
+
apply = options.pluginError
|
|
1292
|
+
? unavailableApply('sourceUnavailable', 'source')
|
|
1293
|
+
: unavailableApply('schemaUnavailable', 'schema');
|
|
1294
|
+
}
|
|
1295
|
+
const otherProjectsMayRequireSync = options.scope === 'user' && reset.deleted;
|
|
1296
|
+
if (otherProjectsMayRequireSync)
|
|
471
1297
|
warnings.push(...otherProjectsWarning(options.scope));
|
|
472
1298
|
return {
|
|
473
1299
|
plugin: pluginName,
|
|
474
1300
|
scope: options.scope,
|
|
475
|
-
|
|
476
|
-
...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
|
|
1301
|
+
...(schemaAccess?.schema ? { schema: schemaAccess.schema } : {}),
|
|
477
1302
|
existed: reset.existed,
|
|
478
1303
|
deleted: reset.deleted,
|
|
1304
|
+
resetDisposition: reset.resetDisposition,
|
|
1305
|
+
...(reset.quarantineBasename ? { quarantineBasename: reset.quarantineBasename } : {}),
|
|
479
1306
|
removedKeys,
|
|
480
1307
|
...(effective ? { effective } : {}),
|
|
481
1308
|
configWrite: 'succeeded',
|
|
482
|
-
overallState:
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
otherProjectsRequireReinstall,
|
|
1309
|
+
overallState: overallStateForApply(apply),
|
|
1310
|
+
apply: publicConfigApplyResult(apply),
|
|
1311
|
+
otherProjectsMayRequireSync,
|
|
486
1312
|
warnings,
|
|
487
1313
|
};
|
|
488
1314
|
}
|
|
489
1315
|
export async function resetPluginConfigWithHelper(options) {
|
|
490
|
-
|
|
491
|
-
if (!options.
|
|
492
|
-
|
|
1316
|
+
assertSafePluginConfigSegment(options.pluginName);
|
|
1317
|
+
if (options.apply !== false && !options.awHomeMutationToken) {
|
|
1318
|
+
await prepareNativeCliExecution({ env: options.env, runner: options.nativeCliRunner });
|
|
493
1319
|
}
|
|
494
|
-
const sourceId = options.plugin.sourceId;
|
|
495
1320
|
return withAwHomeMutationLock({
|
|
496
1321
|
env: options.env,
|
|
497
1322
|
token: options.awHomeMutationToken,
|
|
498
|
-
action: (awHomeMutationToken) =>
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
await options.reviewPreflight?.();
|
|
507
|
-
return resetPluginConfigWithHelperUnlocked({
|
|
508
|
-
...options,
|
|
509
|
-
awHomeMutationToken,
|
|
510
|
-
rebuildRuntime: { ...options.rebuildRuntime, awHomeMutationToken },
|
|
511
|
-
});
|
|
512
|
-
},
|
|
513
|
-
}),
|
|
1323
|
+
action: async (awHomeMutationToken) => {
|
|
1324
|
+
await options.reviewPreflight?.();
|
|
1325
|
+
return resetPluginConfigWithHelperUnlocked({
|
|
1326
|
+
...options,
|
|
1327
|
+
awHomeMutationToken,
|
|
1328
|
+
rebuildRuntime: { ...options.rebuildRuntime, awHomeMutationToken },
|
|
1329
|
+
});
|
|
1330
|
+
},
|
|
514
1331
|
});
|
|
515
1332
|
}
|
|
516
1333
|
export async function describeResetAffectedFields(options) {
|
|
517
|
-
const projectLayer = options.scope === 'project' ? (options.projectLayer ?? 'shared') : 'shared';
|
|
518
1334
|
try {
|
|
519
1335
|
const resolved = await resolveConfigRead({
|
|
520
1336
|
pluginName: options.pluginName,
|
|
521
1337
|
plugin: options.plugin,
|
|
522
1338
|
...(options.pluginError ? { pluginError: options.pluginError } : {}),
|
|
523
1339
|
scope: options.scope,
|
|
524
|
-
projectLayer,
|
|
525
1340
|
cwd: options.cwd,
|
|
526
1341
|
env: options.env,
|
|
527
1342
|
});
|
|
@@ -532,7 +1347,6 @@ export async function describeResetAffectedFields(options) {
|
|
|
532
1347
|
reserved: field.reserved,
|
|
533
1348
|
action: 'reset',
|
|
534
1349
|
scope: options.scope,
|
|
535
|
-
projectLayer,
|
|
536
1350
|
valueState: field.valueState,
|
|
537
1351
|
}));
|
|
538
1352
|
}
|
|
@@ -541,13 +1355,14 @@ export async function describeResetAffectedFields(options) {
|
|
|
541
1355
|
...(options.plugin?.sourceId ? {
|
|
542
1356
|
sourceId: options.plugin.sourceId,
|
|
543
1357
|
sourceIdentity: options.plugin.sourceIdentity,
|
|
1358
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
544
1359
|
} : options.sourceId ? {
|
|
545
1360
|
sourceId: options.sourceId,
|
|
546
1361
|
sourceIdentity: options.sourceIdentity,
|
|
1362
|
+
logicalIdentity: options.logicalIdentity,
|
|
547
1363
|
} : {}),
|
|
548
1364
|
pluginName: options.pluginName,
|
|
549
1365
|
scope: options.scope,
|
|
550
|
-
projectLayer,
|
|
551
1366
|
cwd: options.cwd,
|
|
552
1367
|
env: options.env,
|
|
553
1368
|
});
|
|
@@ -558,7 +1373,6 @@ export async function describeResetAffectedFields(options) {
|
|
|
558
1373
|
reserved: false,
|
|
559
1374
|
action: 'reset',
|
|
560
1375
|
scope: options.scope,
|
|
561
|
-
projectLayer,
|
|
562
1376
|
}));
|
|
563
1377
|
}
|
|
564
1378
|
}
|