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