@lesliechan721/aw 0.1.0-beta.5 → 0.1.0-beta.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring/assets/aw-config.mjs +100 -501
- package/dist/authoring/assets/aw-config.mjs.map +1 -1
- package/dist/authoring/assets/aw-runtime-config.d.mts +13 -0
- package/dist/authoring/assets/aw-runtime-config.mjs +199 -0
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
- package/dist/authoring/scripts/add-skill.mjs +4 -4
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +67 -97
- package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-root.mjs +4 -4
- package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
- package/dist/authoring/scripts/lib/plugin-version-check.mjs +229 -8
- package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.d.mts +77 -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 +3 -2
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +346 -1131
- 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 -0
- package/dist/scripts/bundle-plugins.js +20 -5
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.d.ts +7 -9
- package/dist/scripts/plugin-staging.js +18 -29
- package/dist/scripts/plugin-staging.js.map +1 -1
- package/dist/scripts/test-plugin-scripts.d.ts +2 -0
- package/dist/scripts/test-plugin-scripts.js +47 -76
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/scripts/test-workers.d.mts +24 -0
- package/dist/scripts/test-workers.mjs +59 -0
- package/dist/scripts/test-workers.mjs.map +1 -0
- package/dist/src/adapters/helpers.js +2 -2
- package/dist/src/adapters/helpers.js.map +1 -1
- package/dist/src/authoring/workspace-commands.d.ts +17 -1
- package/dist/src/authoring/workspace-commands.js +21 -4
- 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 +264 -0
- package/dist/src/commands/aw-capabilities.js.map +1 -0
- package/dist/src/commands/catalog-dev-source.d.ts +154 -0
- package/dist/src/commands/catalog-dev-source.js +655 -0
- package/dist/src/commands/catalog-dev-source.js.map +1 -0
- package/dist/src/commands/catalog-generation.d.ts +21 -0
- package/dist/src/commands/catalog-generation.js +9 -0
- package/dist/src/commands/catalog-generation.js.map +1 -0
- package/dist/src/commands/catalog-publication-inspection.d.ts +71 -30
- package/dist/src/commands/catalog-publication-inspection.js +475 -63
- package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
- package/dist/src/commands/catalog-publication-journal.d.ts +68 -0
- package/dist/src/commands/catalog-publication-journal.js +292 -0
- package/dist/src/commands/catalog-publication-journal.js.map +1 -0
- package/dist/src/commands/catalog-publication-target.d.ts +18 -0
- package/dist/src/commands/catalog-publication-target.js +95 -0
- package/dist/src/commands/catalog-publication-target.js.map +1 -0
- package/dist/src/commands/catalog-publish.d.ts +73 -15
- package/dist/src/commands/catalog-publish.js +701 -212
- package/dist/src/commands/catalog-publish.js.map +1 -1
- package/dist/src/commands/catalog-source.d.ts +60 -22
- package/dist/src/commands/catalog-source.js +311 -91
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/catalog-status.d.ts +18 -22
- package/dist/src/commands/catalog-status.js +81 -115
- package/dist/src/commands/catalog-status.js.map +1 -1
- package/dist/src/commands/catalog-store.d.ts +104 -0
- package/dist/src/commands/catalog-store.js +685 -0
- package/dist/src/commands/catalog-store.js.map +1 -0
- package/dist/src/commands/catalog-workspace-resolution.d.ts +13 -0
- package/dist/src/commands/catalog-workspace-resolution.js +42 -0
- package/dist/src/commands/catalog-workspace-resolution.js.map +1 -0
- package/dist/src/commands/console.js +28 -17
- package/dist/src/commands/console.js.map +1 -1
- package/dist/src/commands/dependency-operation-plan.d.ts +52 -15
- package/dist/src/commands/dependency-operation-plan.js +289 -7
- package/dist/src/commands/dependency-operation-plan.js.map +1 -1
- package/dist/src/commands/init.d.ts +5 -11
- package/dist/src/commands/init.js +30 -51
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/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 +146 -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.js +23 -3
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +77 -31
- package/dist/src/commands/rebuild-command.js +4862 -729
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +131 -21
- package/dist/src/commands/rebuild-integration.js +2866 -1339
- 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 +260 -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 +39 -0
- package/dist/src/commands/skill-eval.js +400 -0
- package/dist/src/commands/skill-eval.js.map +1 -0
- package/dist/src/commands/status-v6.d.ts +279 -0
- package/dist/src/commands/status-v6.js +2787 -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 +8 -5
- package/dist/src/commands/wizard.js +6 -4
- package/dist/src/commands/wizard.js.map +1 -1
- package/dist/src/commands/write-commands.d.ts +9 -3
- package/dist/src/commands/write-commands.js +127 -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 +236 -109
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/index.d.ts +10 -4
- package/dist/src/index.js +1793 -486
- 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 +179 -41
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/skills-cli.d.ts +15 -7
- package/dist/src/portable/skills-cli.js +74 -20
- package/dist/src/portable/skills-cli.js.map +1 -1
- package/dist/src/review/eval-source-input.d.ts +43 -0
- package/dist/src/review/eval-source-input.js +207 -0
- package/dist/src/review/eval-source-input.js.map +1 -0
- package/dist/src/review/review-profile.d.ts +17 -0
- package/dist/src/review/review-profile.js +234 -0
- package/dist/src/review/review-profile.js.map +1 -0
- package/dist/src/review/review-selection.d.ts +30 -0
- package/dist/src/review/review-selection.js +527 -0
- package/dist/src/review/review-selection.js.map +1 -0
- package/dist/src/review/review-types.d.ts +68 -0
- package/dist/src/review/review-types.js +16 -0
- package/dist/src/review/review-types.js.map +1 -0
- package/dist/src/review/skill-materialization.d.ts +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 +183 -0
- package/dist/src/review/source-binding.js +708 -0
- package/dist/src/review/source-binding.js.map +1 -0
- package/dist/src/tui/catalog-freshness.d.ts +1 -0
- package/dist/src/tui/catalog-freshness.js +2 -0
- package/dist/src/tui/catalog-freshness.js.map +1 -0
- package/dist/src/tui/catalog-generation.d.ts +21 -0
- package/dist/src/tui/catalog-generation.js +156 -0
- package/dist/src/tui/catalog-generation.js.map +1 -0
- package/dist/src/tui/catalog-sources/projection.d.ts +4 -0
- package/dist/src/tui/catalog-sources/projection.js +17 -0
- package/dist/src/tui/catalog-sources/projection.js.map +1 -0
- package/dist/src/tui/catalog-sources/review.d.ts +3 -0
- package/dist/src/tui/catalog-sources/review.js +13 -0
- package/dist/src/tui/catalog-sources/review.js.map +1 -0
- package/dist/src/tui/catalog-sources/screens.d.ts +12 -0
- package/dist/src/tui/catalog-sources/screens.js +40 -0
- package/dist/src/tui/catalog-sources/screens.js.map +1 -0
- package/dist/src/tui/catalog-sources/session.d.ts +32 -0
- package/dist/src/tui/catalog-sources/session.js +300 -0
- package/dist/src/tui/catalog-sources/session.js.map +1 -0
- package/dist/src/tui/catalog-sources/types.d.ts +54 -0
- package/dist/src/tui/catalog-sources/types.js +2 -0
- package/dist/src/tui/catalog-sources/types.js.map +1 -0
- package/dist/src/tui/catalog-store-task.d.ts +16 -0
- package/dist/src/tui/catalog-store-task.js +19 -0
- package/dist/src/tui/catalog-store-task.js.map +1 -0
- package/dist/src/tui/clipboard.d.ts +13 -0
- package/dist/src/tui/clipboard.js +95 -0
- package/dist/src/tui/clipboard.js.map +1 -0
- package/dist/src/tui/components.d.ts +110 -3
- package/dist/src/tui/components.js +183 -36
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/config-array-draft.d.ts +29 -0
- package/dist/src/tui/config-array-draft.js +48 -0
- package/dist/src/tui/config-array-draft.js.map +1 -0
- package/dist/src/tui/config-leaf-editor.d.ts +16 -0
- package/dist/src/tui/config-leaf-editor.js +206 -0
- package/dist/src/tui/config-leaf-editor.js.map +1 -0
- package/dist/src/tui/config-value-presentation.d.ts +20 -0
- package/dist/src/tui/config-value-presentation.js +104 -0
- package/dist/src/tui/config-value-presentation.js.map +1 -0
- package/dist/src/tui/console-app-v4.d.ts +14 -4
- package/dist/src/tui/console-app-v4.js +8941 -1872
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/content-item-card.d.ts +13 -0
- package/dist/src/tui/content-item-card.js +51 -0
- package/dist/src/tui/content-item-card.js.map +1 -0
- package/dist/src/tui/controller-runtime.d.ts +10 -2
- package/dist/src/tui/controller-runtime.js +3211 -388
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +615 -45
- package/dist/src/tui/controller.js +3558 -768
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/dependency-graph-view.d.ts +39 -0
- package/dist/src/tui/dependency-graph-view.js +121 -0
- package/dist/src/tui/dependency-graph-view.js.map +1 -0
- package/dist/src/tui/dependency-graph.d.ts +81 -0
- package/dist/src/tui/dependency-graph.js +452 -0
- package/dist/src/tui/dependency-graph.js.map +1 -0
- package/dist/src/tui/diagnostic-projection.d.ts +23 -0
- package/dist/src/tui/diagnostic-projection.js +567 -0
- package/dist/src/tui/diagnostic-projection.js.map +1 -0
- package/dist/src/tui/diagnostics.d.ts +3 -3
- package/dist/src/tui/diagnostics.js +14 -2
- package/dist/src/tui/diagnostics.js.map +1 -1
- package/dist/src/tui/entity-cards.d.ts +55 -0
- package/dist/src/tui/entity-cards.js +220 -0
- package/dist/src/tui/entity-cards.js.map +1 -0
- package/dist/src/tui/glossary.d.ts +23 -0
- package/dist/src/tui/glossary.js +42 -0
- package/dist/src/tui/glossary.js.map +1 -0
- package/dist/src/tui/index.d.ts +6 -1
- package/dist/src/tui/index.js +5 -1
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/input-display.d.ts +9 -0
- package/dist/src/tui/input-display.js +58 -0
- package/dist/src/tui/input-display.js.map +1 -0
- package/dist/src/tui/keys.d.ts +44 -0
- package/dist/src/tui/keys.js +43 -15
- package/dist/src/tui/keys.js.map +1 -1
- package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
- package/dist/src/tui/lifecycle-action-view.js +36 -0
- package/dist/src/tui/lifecycle-action-view.js.map +1 -0
- package/dist/src/tui/model.d.ts +223 -31
- package/dist/src/tui/model.js +1510 -397
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
- package/dist/src/tui/operation-diagnostic-screens.js +71 -0
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
- package/dist/src/tui/operation-history.d.ts +81 -0
- package/dist/src/tui/operation-history.js +136 -0
- package/dist/src/tui/operation-history.js.map +1 -0
- package/dist/src/tui/operation-review-planner.d.ts +21 -0
- package/dist/src/tui/operation-review-planner.js +1295 -0
- package/dist/src/tui/operation-review-planner.js.map +1 -0
- package/dist/src/tui/plugin-content.d.ts +31 -0
- package/dist/src/tui/plugin-content.js +680 -0
- package/dist/src/tui/plugin-content.js.map +1 -0
- package/dist/src/tui/plugin-detail.d.ts +52 -0
- package/dist/src/tui/plugin-detail.js +165 -0
- package/dist/src/tui/plugin-detail.js.map +1 -0
- package/dist/src/tui/plugin-write-task.d.ts +69 -0
- package/dist/src/tui/plugin-write-task.js +286 -0
- package/dist/src/tui/plugin-write-task.js.map +1 -0
- package/dist/src/tui/project-inventory.d.ts +68 -0
- package/dist/src/tui/project-inventory.js +203 -0
- package/dist/src/tui/project-inventory.js.map +1 -0
- package/dist/src/tui/prompt.js +4 -15
- package/dist/src/tui/prompt.js.map +1 -1
- package/dist/src/tui/query-header.d.ts +30 -0
- package/dist/src/tui/query-header.js +40 -0
- package/dist/src/tui/query-header.js.map +1 -0
- package/dist/src/tui/reader.d.ts +37 -0
- package/dist/src/tui/reader.js +47 -0
- package/dist/src/tui/reader.js.map +1 -0
- package/dist/src/tui/router.d.ts +197 -10
- package/dist/src/tui/router.js +338 -50
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/tui/screen-registry.d.ts +701 -0
- package/dist/src/tui/screen-registry.js +230 -0
- package/dist/src/tui/screen-registry.js.map +1 -0
- package/dist/src/tui/session-console-app.d.ts +6 -0
- package/dist/src/tui/session-console-app.js +13 -0
- package/dist/src/tui/session-console-app.js.map +1 -0
- package/dist/src/tui/session-host.d.ts +45 -0
- package/dist/src/tui/session-host.js +209 -0
- package/dist/src/tui/session-host.js.map +1 -0
- package/dist/src/tui/source-detail-card.d.ts +29 -0
- package/dist/src/tui/source-detail-card.js +45 -0
- package/dist/src/tui/source-detail-card.js.map +1 -0
- package/dist/src/tui/source-ref-presets.d.ts +3 -0
- package/dist/src/tui/source-ref-presets.js +11 -0
- package/dist/src/tui/source-ref-presets.js.map +1 -0
- package/dist/src/tui/theme.d.ts +12 -0
- package/dist/src/tui/theme.js +12 -0
- package/dist/src/tui/theme.js.map +1 -1
- package/dist/src/tui/viewport.d.ts +1 -0
- package/dist/src/tui/viewport.js +23 -0
- package/dist/src/tui/viewport.js.map +1 -1
- package/dist/src/tui/views.js +31 -3
- package/dist/src/tui/views.js.map +1 -1
- package/dist/src/tui/wizard.js +37 -13
- package/dist/src/tui/wizard.js.map +1 -1
- package/dist/src/types.d.ts +244 -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 +17 -7
- package/dist/src/utils/artifact-renderer.js +214 -216
- 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 +78 -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 +22 -29
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
- package/dist/src/utils/catalog-capability-projection.js +14 -0
- package/dist/src/utils/catalog-capability-projection.js.map +1 -0
- package/dist/src/utils/catalog-digests.d.ts +10 -0
- package/dist/src/utils/catalog-digests.js +57 -20
- package/dist/src/utils/catalog-digests.js.map +1 -1
- package/dist/src/utils/catalog-generation-control-snapshot.d.ts +11 -0
- package/dist/src/utils/catalog-generation-control-snapshot.js +45 -0
- package/dist/src/utils/catalog-generation-control-snapshot.js.map +1 -0
- package/dist/src/utils/catalog-generation-error.d.ts +16 -0
- package/dist/src/utils/catalog-generation-error.js +30 -0
- package/dist/src/utils/catalog-generation-error.js.map +1 -0
- package/dist/src/utils/catalog-generation-resolver.d.ts +44 -0
- package/dist/src/utils/catalog-generation-resolver.js +273 -0
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -0
- package/dist/src/utils/catalog-generation-service.d.ts +172 -0
- package/dist/src/utils/catalog-generation-service.js +1271 -0
- package/dist/src/utils/catalog-generation-service.js.map +1 -0
- package/dist/src/utils/catalog-generation-state.d.ts +22 -0
- package/dist/src/utils/catalog-generation-state.js +192 -0
- package/dist/src/utils/catalog-generation-state.js.map +1 -0
- package/dist/src/utils/catalog-generation-store.d.ts +58 -0
- package/dist/src/utils/catalog-generation-store.js +452 -0
- package/dist/src/utils/catalog-generation-store.js.map +1 -0
- package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
- package/dist/src/utils/{catalog-manifest-v4.js → catalog-manifest-v7.js} +35 -43
- package/dist/src/utils/catalog-manifest-v7.js.map +1 -0
- package/dist/src/utils/catalog-operation-context.d.ts +20 -0
- package/dist/src/utils/catalog-operation-context.js +142 -0
- package/dist/src/utils/catalog-operation-context.js.map +1 -0
- package/dist/src/utils/catalog-public-error.d.ts +7 -3
- package/dist/src/utils/catalog-public-error.js +28 -8
- package/dist/src/utils/catalog-public-error.js.map +1 -1
- package/dist/src/utils/catalog-runtime-projection.d.ts +3 -0
- package/dist/src/utils/catalog-runtime-projection.js +5 -40
- package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
- package/dist/src/utils/catalog-snapshot.d.ts +5 -3
- package/dist/src/utils/catalog-snapshot.js +11 -3
- package/dist/src/utils/catalog-snapshot.js.map +1 -1
- package/dist/src/utils/catalog-source-identity.d.ts +1 -0
- package/dist/src/utils/catalog-source-identity.js +21 -2
- package/dist/src/utils/catalog-source-identity.js.map +1 -1
- package/dist/src/utils/catalog-source-impact.d.ts +21 -0
- package/dist/src/utils/catalog-source-impact.js +344 -0
- package/dist/src/utils/catalog-source-impact.js.map +1 -0
- package/dist/src/utils/catalog-source-references.d.ts +3 -2
- package/dist/src/utils/catalog-source-references.js +195 -347
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/catalog-sources.d.ts +15 -1
- package/dist/src/utils/catalog-sources.js +206 -27
- package/dist/src/utils/catalog-sources.js.map +1 -1
- package/dist/src/utils/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 +747 -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 +35 -5
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/git-catalog-provider.d.ts +16 -0
- package/dist/src/utils/git-catalog-provider.js +177 -145
- package/dist/src/utils/git-catalog-provider.js.map +1 -1
- package/dist/src/utils/local-marketplace.d.ts +18 -1
- package/dist/src/utils/local-marketplace.js +354 -84
- package/dist/src/utils/local-marketplace.js.map +1 -1
- package/dist/src/utils/manifest.d.ts +1 -3
- package/dist/src/utils/manifest.js +1 -3
- package/dist/src/utils/manifest.js.map +1 -1
- package/dist/src/utils/multi-source-catalog.d.ts +3 -9
- package/dist/src/utils/multi-source-catalog.js +54 -110
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +55 -7
- package/dist/src/utils/native-cli.js +400 -58
- 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 +1000 -296
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +153 -93
- package/dist/src/utils/plugin-config.js +1116 -968
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-intent-state.d.ts +49 -0
- package/dist/src/utils/plugin-intent-state.js +320 -0
- package/dist/src/utils/plugin-intent-state.js.map +1 -0
- package/dist/src/utils/plugin-scripts.d.ts +65 -125
- package/dist/src/utils/plugin-scripts.js +484 -524
- 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/runtime-config.d.ts +20 -0
- package/dist/src/utils/runtime-config.js +75 -0
- package/dist/src/utils/runtime-config.js.map +1 -0
- package/dist/src/utils/safe-fs.d.ts +21 -0
- package/dist/src/utils/safe-fs.js +111 -0
- package/dist/src/utils/safe-fs.js.map +1 -0
- package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
- package/dist/src/utils/safe-operation-diagnostic.js +33 -0
- package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
- package/dist/src/utils/sensitive-content.d.ts +4 -0
- package/dist/src/utils/sensitive-content.js +36 -0
- package/dist/src/utils/sensitive-content.js.map +1 -0
- package/dist/src/utils/state-paths.js +7 -2
- package/dist/src/utils/state-paths.js.map +1 -1
- package/dist/src/utils/target-eligibility.d.ts +8 -2
- package/dist/src/utils/target-eligibility.js +17 -8
- package/dist/src/utils/target-eligibility.js.map +1 -1
- package/dist/src/utils/windows-claude-shim.d.ts +7 -0
- package/dist/src/utils/windows-claude-shim.js +10 -0
- package/dist/src/utils/windows-claude-shim.js.map +1 -0
- package/dist/src/utils/windows-npm-shim.d.ts +14 -0
- package/dist/src/utils/windows-npm-shim.js +140 -0
- package/dist/src/utils/windows-npm-shim.js.map +1 -0
- package/dist/vitest.config.js +92 -10
- package/dist/vitest.config.js.map +1 -1
- package/package.json +27 -18
- package/dist/authoring/scripts/check-plugin-versions.d.mts +0 -2
- package/dist/authoring/scripts/check-plugin-versions.mjs +0 -5
- package/dist/authoring/scripts/check-plugin-versions.mjs.map +0 -1
- package/dist/scripts/aw-skill-eval-engine.d.ts +0 -13
- package/dist/scripts/aw-skill-eval-engine.js +0 -31
- package/dist/scripts/aw-skill-eval-engine.js.map +0 -1
- package/dist/scripts/codex-eval-app-server.d.ts +0 -89
- package/dist/scripts/codex-eval-app-server.js +0 -1228
- package/dist/scripts/codex-eval-app-server.js.map +0 -1
- package/dist/scripts/codex-eval-isolation.d.ts +0 -61
- package/dist/scripts/codex-eval-isolation.js +0 -318
- package/dist/scripts/codex-eval-isolation.js.map +0 -1
- package/dist/scripts/codex-eval-process-management.d.ts +0 -8
- package/dist/scripts/codex-eval-process-management.js +0 -69
- package/dist/scripts/codex-eval-process-management.js.map +0 -1
- package/dist/scripts/codex-eval-process-tree.d.ts +0 -38
- package/dist/scripts/codex-eval-process-tree.js +0 -803
- package/dist/scripts/codex-eval-process-tree.js.map +0 -1
- package/dist/scripts/codex-eval-runtime-config.d.ts +0 -62
- package/dist/scripts/codex-eval-runtime-config.js +0 -843
- package/dist/scripts/codex-eval-runtime-config.js.map +0 -1
- package/dist/scripts/codex-trigger-eval.d.ts +0 -84
- package/dist/scripts/codex-trigger-eval.js +0 -968
- package/dist/scripts/codex-trigger-eval.js.map +0 -1
- package/dist/scripts/eval-plugin-skills-audited.d.ts +0 -6
- package/dist/scripts/eval-plugin-skills-audited.js +0 -261
- package/dist/scripts/eval-plugin-skills-audited.js.map +0 -1
- package/dist/scripts/eval-plugin-skills.d.ts +0 -45
- package/dist/scripts/eval-plugin-skills.js +0 -1586
- package/dist/scripts/eval-plugin-skills.js.map +0 -1
- package/dist/scripts/eval-run-layout.d.ts +0 -17
- package/dist/scripts/eval-run-layout.js +0 -26
- package/dist/scripts/eval-run-layout.js.map +0 -1
- package/dist/scripts/plugin-eval-contract.d.ts +0 -185
- package/dist/scripts/plugin-eval-contract.js +0 -695
- package/dist/scripts/plugin-eval-contract.js.map +0 -1
- package/dist/scripts/plugin-eval-materializer.d.ts +0 -13
- package/dist/scripts/plugin-eval-materializer.js +0 -421
- package/dist/scripts/plugin-eval-materializer.js.map +0 -1
- package/dist/scripts/skill-reporting.d.ts +0 -212
- package/dist/scripts/skill-reporting.js +0 -922
- package/dist/scripts/skill-reporting.js.map +0 -1
- package/dist/src/commands/status-v4.d.ts +0 -123
- package/dist/src/commands/status-v4.js +0 -905
- package/dist/src/commands/status-v4.js.map +0 -1
- package/dist/src/commands/status.d.ts +0 -93
- package/dist/src/commands/status.js +0 -442
- package/dist/src/commands/status.js.map +0 -1
- package/dist/src/utils/active-marketplace-runtime-lock.d.ts +0 -12
- package/dist/src/utils/active-marketplace-runtime-lock.js +0 -133
- package/dist/src/utils/active-marketplace-runtime-lock.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v3.d.ts +0 -2
- package/dist/src/utils/catalog-manifest-v3.js +0 -3
- package/dist/src/utils/catalog-manifest-v3.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v4.d.ts +0 -5
- package/dist/src/utils/catalog-manifest-v4.js.map +0 -1
- package/dist/src/utils/catalog-source-cache.d.ts +0 -62
- package/dist/src/utils/catalog-source-cache.js +0 -296
- package/dist/src/utils/catalog-source-cache.js.map +0 -1
- package/dist/src/utils/codex-project-surface.d.ts +0 -3
- package/dist/src/utils/codex-project-surface.js +0 -49
- package/dist/src/utils/codex-project-surface.js.map +0 -1
- package/dist/src/utils/lifecycle-active-store.d.ts +0 -175
- package/dist/src/utils/lifecycle-active-store.js +0 -1276
- package/dist/src/utils/lifecycle-active-store.js.map +0 -1
- package/dist/src/utils/plugin-release.d.ts +0 -2
- package/dist/src/utils/plugin-release.js +0 -2
- package/dist/src/utils/plugin-release.js.map +0 -1
|
@@ -1,16 +1,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, assertPluginConfigMutationCandidate, 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,222 @@ 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
|
-
|
|
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,
|
|
712
|
+
scope: options.scope,
|
|
713
|
+
cwd: options.cwd,
|
|
714
|
+
env: options.env,
|
|
715
|
+
visibleTargets: discovered?.targets ?? [],
|
|
716
|
+
mutation: {
|
|
717
|
+
kind: 'patch',
|
|
718
|
+
updates: requestedUpdates,
|
|
719
|
+
removeKeys: requestedRemoveKeys,
|
|
720
|
+
},
|
|
721
|
+
});
|
|
722
|
+
const updates = await coercePluginConfigUpdates({ schema, updates: requestedUpdates, cwd: options.cwd });
|
|
723
|
+
await assertPluginConfigMutationCandidate({
|
|
279
724
|
...configIdentity,
|
|
280
725
|
pluginName,
|
|
726
|
+
manifest: schemaPlugin.manifest,
|
|
281
727
|
scope: options.scope,
|
|
282
|
-
projectLayer,
|
|
283
728
|
cwd: options.cwd,
|
|
284
729
|
env: options.env,
|
|
730
|
+
updates,
|
|
731
|
+
removeKeys: requestedRemoveKeys,
|
|
285
732
|
});
|
|
286
733
|
const warnings = [];
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
734
|
+
const { updatedKeys, removedKeys, staleRemovedKeys } = impact;
|
|
735
|
+
let preApplyUnavailableReason;
|
|
736
|
+
let preApplyUnavailableTargetResults = [];
|
|
737
|
+
let applyDiscovery = discovered
|
|
738
|
+
? { targets: impact.affectedTargets, failures: discovered.failures }
|
|
739
|
+
: undefined;
|
|
740
|
+
const shouldApply = options.apply !== false && impact.storeChanged && !impact.noEffectiveChange;
|
|
741
|
+
if (shouldApply && pluginMayRunPreApply(schemaPlugin)) {
|
|
742
|
+
if (applyDiscovery) {
|
|
743
|
+
const preApplyAuthorization = await resolveConfigPreApplyAuthorization({
|
|
744
|
+
plugin: schemaPlugin,
|
|
745
|
+
scope: options.scope,
|
|
746
|
+
cwd: options.cwd,
|
|
747
|
+
env: options.env,
|
|
748
|
+
applyTargets: applyDiscovery.targets,
|
|
749
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
750
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
751
|
+
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
752
|
+
});
|
|
753
|
+
if (preApplyAuthorization.targets.length > 0 && !preApplyAuthorizationIsConfirmed({
|
|
754
|
+
required: preApplyAuthorization.targets,
|
|
755
|
+
confirmed: options.preApplyConfirmed,
|
|
756
|
+
authorizedTargets: options.preApplyAuthorizedTargets,
|
|
757
|
+
})) {
|
|
758
|
+
throwPreApplyAuthorizationRequired(preApplyAuthorization.targets);
|
|
759
|
+
}
|
|
760
|
+
preApplyUnavailableTargetResults = preApplyAuthorization.unavailableTargetResults;
|
|
761
|
+
applyDiscovery = {
|
|
762
|
+
targets: preApplyAuthorization.availableApplyTargets,
|
|
763
|
+
failures: [...applyDiscovery.failures, ...preApplyUnavailableTargetResults],
|
|
764
|
+
};
|
|
765
|
+
if (applyDiscovery.targets.length === 0 && preApplyUnavailableTargetResults.length > 0) {
|
|
766
|
+
preApplyUnavailableReason = 'sourceUnavailable';
|
|
767
|
+
}
|
|
308
768
|
}
|
|
309
769
|
}
|
|
310
|
-
if (
|
|
311
|
-
|
|
770
|
+
if (options.apply !== false
|
|
771
|
+
&& options.scope === 'user'
|
|
772
|
+
&& options.sharedNativeApplyConfirmed !== true
|
|
773
|
+
&& impact.sharedNativeRenderTargets.length > 0
|
|
774
|
+
&& impact.affectedTargets.some((target) => target.platform === 'codex')) {
|
|
775
|
+
throwSharedNativeApplyConfirmationRequired();
|
|
776
|
+
}
|
|
777
|
+
if (impact.storeChanged) {
|
|
778
|
+
try {
|
|
779
|
+
const write = await patchPluginConfigStore({
|
|
780
|
+
...configIdentity,
|
|
781
|
+
pluginName,
|
|
782
|
+
scope: options.scope,
|
|
783
|
+
cwd: options.cwd,
|
|
784
|
+
env: options.env,
|
|
785
|
+
updates: Object.fromEntries(updatedKeys.map((key) => [key, updates[key]])),
|
|
786
|
+
removeKeys: requestedRemoveKeys,
|
|
787
|
+
schema,
|
|
788
|
+
});
|
|
789
|
+
warnings.push(...write.warnings);
|
|
790
|
+
}
|
|
791
|
+
catch (error) {
|
|
792
|
+
throw markConfigWriteFailed(error);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
let effective;
|
|
796
|
+
try {
|
|
797
|
+
effective = summarizeEffectivePluginConfig(await resolveEffectivePluginConfig({
|
|
312
798
|
...configIdentity,
|
|
313
799
|
pluginName,
|
|
314
|
-
|
|
315
|
-
|
|
800
|
+
manifest: schemaPlugin.manifest,
|
|
801
|
+
targetScope: options.scope,
|
|
316
802
|
cwd: options.cwd,
|
|
317
803
|
env: options.env,
|
|
318
|
-
|
|
319
|
-
removeKeys: requestedRemoveKeys,
|
|
320
|
-
});
|
|
804
|
+
}));
|
|
321
805
|
}
|
|
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,
|
|
806
|
+
catch {
|
|
807
|
+
const apply = unavailableApply('effectiveConfigUnavailable', 'effectiveConfig');
|
|
808
|
+
const otherProjectsMayRequireSync = options.scope === 'user' && impact.storeChanged;
|
|
809
|
+
if (otherProjectsMayRequireSync)
|
|
810
|
+
warnings.push(...otherProjectsWarning(options.scope));
|
|
811
|
+
return {
|
|
812
|
+
plugin: pluginName,
|
|
337
813
|
scope: options.scope,
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
814
|
+
...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
|
|
815
|
+
updatedKeys,
|
|
816
|
+
removedKeys,
|
|
817
|
+
staleRemovedKeys,
|
|
818
|
+
configWrite: 'succeeded',
|
|
819
|
+
overallState: 'partial',
|
|
820
|
+
apply: publicConfigApplyResult(apply),
|
|
821
|
+
otherProjectsMayRequireSync,
|
|
822
|
+
warnings,
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
let apply;
|
|
826
|
+
try {
|
|
827
|
+
apply = !impact.storeChanged
|
|
828
|
+
? skippedApply('noConfigChange')
|
|
829
|
+
: options.apply === false
|
|
830
|
+
? skippedApply('notRequested')
|
|
831
|
+
: targetDiscoveryFailed
|
|
832
|
+
? unavailableApply('targetDiscoveryFailed', 'targetDiscovery')
|
|
833
|
+
: impact.noEffectiveChange
|
|
834
|
+
&& ((discovered?.targets.length ?? 0) > 0
|
|
835
|
+
|| staleRemovedKeys.length === impact.changedKeys.length)
|
|
836
|
+
? skippedApply('noEffectiveConfigChange')
|
|
837
|
+
: preApplyUnavailableReason
|
|
838
|
+
? unavailableApply(preApplyUnavailableReason, preApplyUnavailableReason === 'sourceUnavailable' ? 'source' : 'targetDiscovery', preApplyUnavailableTargetResults)
|
|
839
|
+
: await applyConfigToVisibleTargets({
|
|
840
|
+
plugin: schemaPlugin,
|
|
841
|
+
scope: options.scope,
|
|
842
|
+
cwd: options.cwd,
|
|
843
|
+
env: options.env ?? process.env,
|
|
844
|
+
applyTargets: applyDiscovery?.targets ?? impact.affectedTargets,
|
|
845
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
846
|
+
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
847
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
848
|
+
noVisibleTargetHasInvalidConfig: (discovered?.targets.length ?? 0) > 0
|
|
849
|
+
&& effective.issues.length > 0,
|
|
850
|
+
preApplyConfirmed: options.preApplyConfirmed,
|
|
851
|
+
discovered: applyDiscovery,
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
catch (error) {
|
|
855
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
856
|
+
throw Object.assign(failure, { configWrite: 'succeeded' });
|
|
857
|
+
}
|
|
858
|
+
const otherProjectsMayRequireSync = options.scope === 'user' && impact.storeChanged;
|
|
859
|
+
if (otherProjectsMayRequireSync)
|
|
348
860
|
warnings.push(...otherProjectsWarning(options.scope));
|
|
349
861
|
return {
|
|
350
862
|
plugin: pluginName,
|
|
351
863
|
scope: options.scope,
|
|
352
|
-
projectLayer,
|
|
353
864
|
...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
|
|
354
865
|
updatedKeys,
|
|
355
866
|
removedKeys,
|
|
867
|
+
staleRemovedKeys,
|
|
356
868
|
effective,
|
|
357
869
|
configWrite: 'succeeded',
|
|
358
|
-
overallState:
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
otherProjectsRequireReinstall,
|
|
870
|
+
overallState: overallStateForApply(apply),
|
|
871
|
+
apply: publicConfigApplyResult(apply),
|
|
872
|
+
otherProjectsMayRequireSync,
|
|
362
873
|
warnings,
|
|
363
874
|
};
|
|
364
875
|
}
|
|
@@ -366,162 +877,356 @@ export async function applyPluginConfigWrite(options) {
|
|
|
366
877
|
const requestedPluginName = options.pluginName ?? options.plugin?.manifest.name;
|
|
367
878
|
if (!requestedPluginName)
|
|
368
879
|
throw new Error('Plugin name is required for config write.');
|
|
369
|
-
|
|
880
|
+
assertSafePluginConfigSegment(requestedPluginName);
|
|
881
|
+
if (options.scope === 'project') {
|
|
882
|
+
const targetPath = resolvePluginConfigStorePath({
|
|
883
|
+
sourceId: options.plugin?.sourceId,
|
|
884
|
+
pluginName: requestedPluginName,
|
|
885
|
+
scope: 'project',
|
|
886
|
+
cwd: options.cwd,
|
|
887
|
+
env: options.env,
|
|
888
|
+
});
|
|
889
|
+
await assertProjectSharedConfigPathVisible({
|
|
890
|
+
cwd: options.cwd,
|
|
891
|
+
targetPath,
|
|
892
|
+
env: options.env,
|
|
893
|
+
});
|
|
894
|
+
}
|
|
370
895
|
return withAwHomeMutationLock({
|
|
371
896
|
env: options.env,
|
|
372
897
|
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({
|
|
898
|
+
action: async (awHomeMutationToken) => {
|
|
899
|
+
await options.reviewPreflight?.();
|
|
900
|
+
try {
|
|
901
|
+
return await applyPluginConfigWriteUnlocked({
|
|
383
902
|
...options,
|
|
384
903
|
awHomeMutationToken,
|
|
385
904
|
rebuildRuntime: { ...options.rebuildRuntime, awHomeMutationToken },
|
|
386
905
|
});
|
|
387
|
-
}
|
|
388
|
-
|
|
906
|
+
}
|
|
907
|
+
catch (error) {
|
|
908
|
+
let sensitiveValues = options.plugin
|
|
909
|
+
? collectSensitivePluginConfigValues(options.plugin.manifest, (options.request.updates ?? {}))
|
|
910
|
+
: [];
|
|
911
|
+
if (options.plugin) {
|
|
912
|
+
try {
|
|
913
|
+
const effective = await resolveEffectivePluginConfig({
|
|
914
|
+
...(options.plugin.sourceId ? {
|
|
915
|
+
sourceId: options.plugin.sourceId,
|
|
916
|
+
sourceIdentity: options.plugin.sourceIdentity,
|
|
917
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
918
|
+
} : {}),
|
|
919
|
+
pluginName: options.plugin.manifest.name,
|
|
920
|
+
manifest: options.plugin.manifest,
|
|
921
|
+
targetScope: options.scope,
|
|
922
|
+
cwd: options.cwd,
|
|
923
|
+
env: options.env,
|
|
924
|
+
});
|
|
925
|
+
sensitiveValues = [
|
|
926
|
+
...sensitiveValues,
|
|
927
|
+
...collectSensitivePluginConfigValues(options.plugin.manifest, effective.values),
|
|
928
|
+
];
|
|
929
|
+
}
|
|
930
|
+
catch {
|
|
931
|
+
// Requested sensitive values and generic credential redaction remain available.
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
let message = redactPluginScriptOutput(error instanceof Error ? error.message : String(error), sensitiveValues);
|
|
935
|
+
message = message.split(options.cwd).join('<project>');
|
|
936
|
+
for (const scope of ['user', 'project']) {
|
|
937
|
+
const configPath = resolvePluginConfigStorePath({
|
|
938
|
+
sourceId: options.plugin?.sourceId,
|
|
939
|
+
pluginName: requestedPluginName,
|
|
940
|
+
scope,
|
|
941
|
+
cwd: options.cwd,
|
|
942
|
+
env: options.env,
|
|
943
|
+
});
|
|
944
|
+
message = message.split(configPath).join(`${scope}/plugin-config/${[
|
|
945
|
+
options.plugin?.sourceId,
|
|
946
|
+
requestedPluginName,
|
|
947
|
+
'config.json',
|
|
948
|
+
].filter(Boolean).join('/')}`);
|
|
949
|
+
}
|
|
950
|
+
const safeError = new Error(message);
|
|
951
|
+
const code = error.code;
|
|
952
|
+
safeError.code = typeof code === 'string' ? code
|
|
953
|
+
: message.startsWith('schemaVersionUnsupported:') ? 'schemaVersionUnsupported'
|
|
954
|
+
: 'configApplyFailed';
|
|
955
|
+
const configWrite = error.configWrite;
|
|
956
|
+
if (configWrite === 'succeeded' || configWriteStateForError(error) === 'failed') {
|
|
957
|
+
safeError.configWrite = configWrite === 'succeeded' ? 'succeeded' : 'failed';
|
|
958
|
+
}
|
|
959
|
+
if (error && typeof error === 'object' && 'operationDiagnostic' in error) {
|
|
960
|
+
safeError.operationDiagnostic = error.operationDiagnostic;
|
|
961
|
+
}
|
|
962
|
+
throw safeError;
|
|
963
|
+
}
|
|
964
|
+
},
|
|
389
965
|
});
|
|
390
966
|
}
|
|
391
967
|
async function resetPluginConfigWithHelperUnlocked(options) {
|
|
392
968
|
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 ? {
|
|
969
|
+
let configIdentity = options.plugin?.sourceId ? {
|
|
409
970
|
sourceId: options.plugin.sourceId,
|
|
410
971
|
sourceIdentity: options.plugin.sourceIdentity,
|
|
972
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
973
|
+
} : options.sourceId ? {
|
|
974
|
+
sourceId: options.sourceId,
|
|
975
|
+
sourceIdentity: options.sourceIdentity,
|
|
976
|
+
logicalIdentity: options.logicalIdentity,
|
|
411
977
|
} : {};
|
|
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,
|
|
978
|
+
if (options.sourceId && !options.sourceIdentity) {
|
|
979
|
+
try {
|
|
980
|
+
const identity = await readNamespacedPluginConfigStoreIdentity({
|
|
981
|
+
sourceId: options.sourceId,
|
|
448
982
|
pluginName,
|
|
449
|
-
|
|
983
|
+
scope: options.scope,
|
|
450
984
|
cwd: options.cwd,
|
|
451
985
|
env: options.env,
|
|
452
|
-
})
|
|
986
|
+
});
|
|
987
|
+
if (identity?.binding.kind === 'source')
|
|
988
|
+
configIdentity = {
|
|
989
|
+
sourceId: options.sourceId,
|
|
990
|
+
sourceIdentity: identity.binding.sourceIdentity,
|
|
991
|
+
};
|
|
992
|
+
if (identity?.binding.kind === 'catalog')
|
|
993
|
+
configIdentity = {
|
|
994
|
+
sourceId: options.sourceId,
|
|
995
|
+
logicalIdentity: identity.binding.logicalIdentity,
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
catch {
|
|
999
|
+
// Reset does not require a readable or valid envelope.
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
let removedKeys = [];
|
|
1003
|
+
try {
|
|
1004
|
+
const store = await readPluginConfigStore({
|
|
1005
|
+
...configIdentity,
|
|
1006
|
+
pluginName,
|
|
1007
|
+
scope: options.scope,
|
|
1008
|
+
cwd: options.cwd,
|
|
1009
|
+
env: options.env,
|
|
1010
|
+
});
|
|
1011
|
+
removedKeys = collectRemovedConfigKeys(store.values);
|
|
1012
|
+
}
|
|
1013
|
+
catch {
|
|
1014
|
+
// Reset is the final recovery boundary and does not require a readable store.
|
|
1015
|
+
}
|
|
1016
|
+
const warnings = [];
|
|
1017
|
+
let impact;
|
|
1018
|
+
let targetDiscoveryFailed = false;
|
|
1019
|
+
let visibleTargets = [];
|
|
1020
|
+
if (options.plugin) {
|
|
1021
|
+
if (options.apply !== false) {
|
|
1022
|
+
try {
|
|
1023
|
+
visibleTargets = (await resolveConfigApplyTargets({
|
|
1024
|
+
plugin: options.plugin,
|
|
1025
|
+
scope: options.scope,
|
|
1026
|
+
cwd: options.cwd,
|
|
1027
|
+
env: options.env ?? process.env,
|
|
1028
|
+
applyTargets: options.applyTargets,
|
|
1029
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
1030
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
1031
|
+
})).targets;
|
|
1032
|
+
}
|
|
1033
|
+
catch {
|
|
1034
|
+
targetDiscoveryFailed = true;
|
|
1035
|
+
}
|
|
453
1036
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
plugin:
|
|
1037
|
+
try {
|
|
1038
|
+
impact = await analyzePluginConfigMutationImpact({
|
|
1039
|
+
plugin: options.plugin,
|
|
457
1040
|
scope: options.scope,
|
|
458
1041
|
cwd: options.cwd,
|
|
459
|
-
env: options.env
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
463
|
-
rebuildRuntime: options.rebuildRuntime,
|
|
1042
|
+
env: options.env,
|
|
1043
|
+
visibleTargets,
|
|
1044
|
+
mutation: { kind: 'reset' },
|
|
464
1045
|
});
|
|
1046
|
+
removedKeys = impact.removedKeys;
|
|
1047
|
+
}
|
|
1048
|
+
catch {
|
|
1049
|
+
// Reset remains available when its before state cannot be read.
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
let preApplyUnavailableReason;
|
|
1053
|
+
let preApplyUnavailableTargetResults = [];
|
|
1054
|
+
let applyDiscovery = options.plugin && !targetDiscoveryFailed
|
|
1055
|
+
? { targets: impact?.affectedTargets ?? visibleTargets, failures: [] }
|
|
1056
|
+
: undefined;
|
|
1057
|
+
if (options.plugin
|
|
1058
|
+
&& options.apply !== false
|
|
1059
|
+
&& impact?.storeChanged
|
|
1060
|
+
&& !impact.noEffectiveChange
|
|
1061
|
+
&& applyDiscovery
|
|
1062
|
+
&& pluginMayRunPreApply(options.plugin)) {
|
|
1063
|
+
const preApplyAuthorization = await resolveConfigPreApplyAuthorization({
|
|
1064
|
+
plugin: options.plugin,
|
|
1065
|
+
scope: options.scope,
|
|
1066
|
+
cwd: options.cwd,
|
|
1067
|
+
env: options.env,
|
|
1068
|
+
applyTargets: applyDiscovery.targets,
|
|
1069
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
1070
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
1071
|
+
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
1072
|
+
});
|
|
1073
|
+
if (preApplyAuthorization.targets.length > 0 && !preApplyAuthorizationIsConfirmed({
|
|
1074
|
+
required: preApplyAuthorization.targets,
|
|
1075
|
+
confirmed: options.preApplyConfirmed,
|
|
1076
|
+
authorizedTargets: options.preApplyAuthorizedTargets,
|
|
1077
|
+
})) {
|
|
1078
|
+
throwPreApplyAuthorizationRequired(preApplyAuthorization.targets);
|
|
1079
|
+
}
|
|
1080
|
+
preApplyUnavailableTargetResults = preApplyAuthorization.unavailableTargetResults;
|
|
1081
|
+
applyDiscovery = {
|
|
1082
|
+
targets: preApplyAuthorization.availableApplyTargets,
|
|
1083
|
+
failures: preApplyUnavailableTargetResults,
|
|
1084
|
+
};
|
|
1085
|
+
if (applyDiscovery.targets.length === 0 && preApplyUnavailableTargetResults.length > 0) {
|
|
1086
|
+
preApplyUnavailableReason = 'sourceUnavailable';
|
|
465
1087
|
}
|
|
466
1088
|
}
|
|
467
|
-
|
|
1089
|
+
if (options.plugin
|
|
1090
|
+
&& options.apply !== false
|
|
468
1091
|
&& options.scope === 'user'
|
|
469
|
-
&&
|
|
470
|
-
|
|
1092
|
+
&& options.sharedNativeApplyConfirmed !== true
|
|
1093
|
+
&& (impact
|
|
1094
|
+
? impact.sharedNativeRenderTargets.length > 0
|
|
1095
|
+
&& impact.affectedTargets.some((target) => target.platform === 'codex')
|
|
1096
|
+
: pluginHasSharedNativeRefreshKeys(options.plugin))
|
|
1097
|
+
&& visibleTargets.some((target) => target.platform === 'codex')) {
|
|
1098
|
+
throwSharedNativeApplyConfirmationRequired();
|
|
1099
|
+
}
|
|
1100
|
+
let reset;
|
|
1101
|
+
try {
|
|
1102
|
+
reset = await resetPluginConfigStore({
|
|
1103
|
+
...configIdentity,
|
|
1104
|
+
pluginName,
|
|
1105
|
+
scope: options.scope,
|
|
1106
|
+
cwd: options.cwd,
|
|
1107
|
+
env: options.env,
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
catch (error) {
|
|
1111
|
+
throw markConfigWriteFailed(error);
|
|
1112
|
+
}
|
|
1113
|
+
let schemaAccess;
|
|
1114
|
+
let apply = reset.deleted ? skippedApply('notRequested') : skippedApply('noConfigChange');
|
|
1115
|
+
let effective;
|
|
1116
|
+
if (options.plugin) {
|
|
1117
|
+
try {
|
|
1118
|
+
schemaAccess = await resolvePluginConfigSchemaAccess({
|
|
1119
|
+
pluginName,
|
|
1120
|
+
currentPlugin: options.plugin,
|
|
1121
|
+
scope: options.scope,
|
|
1122
|
+
cwd: options.cwd,
|
|
1123
|
+
env: options.env,
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
catch {
|
|
1127
|
+
if (reset.deleted && options.apply !== false) {
|
|
1128
|
+
apply = unavailableApply('sourceUnavailable', 'source');
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
const schemaPlugin = schemaAccess?.plugin;
|
|
1132
|
+
if (schemaPlugin?.manifest.config?.fields) {
|
|
1133
|
+
try {
|
|
1134
|
+
effective = summarizeEffectivePluginConfig(await resolveEffectivePluginConfig({
|
|
1135
|
+
...configIdentity,
|
|
1136
|
+
pluginName,
|
|
1137
|
+
manifest: schemaPlugin.manifest,
|
|
1138
|
+
targetScope: options.scope,
|
|
1139
|
+
cwd: options.cwd,
|
|
1140
|
+
env: options.env,
|
|
1141
|
+
}));
|
|
1142
|
+
}
|
|
1143
|
+
catch {
|
|
1144
|
+
if (reset.deleted && options.apply !== false) {
|
|
1145
|
+
apply = unavailableApply('effectiveConfigUnavailable', 'effectiveConfig');
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
if (reset.deleted
|
|
1149
|
+
&& options.apply !== false
|
|
1150
|
+
&& apply.state === 'skipped'
|
|
1151
|
+
&& impact?.noEffectiveChange
|
|
1152
|
+
&& visibleTargets.length > 0) {
|
|
1153
|
+
apply = skippedApply('noEffectiveConfigChange');
|
|
1154
|
+
}
|
|
1155
|
+
else if (reset.deleted
|
|
1156
|
+
&& options.apply !== false
|
|
1157
|
+
&& apply.state === 'skipped'
|
|
1158
|
+
&& targetDiscoveryFailed) {
|
|
1159
|
+
apply = unavailableApply('targetDiscoveryFailed', 'targetDiscovery');
|
|
1160
|
+
}
|
|
1161
|
+
else if (reset.deleted && options.apply !== false && apply.state === 'skipped') {
|
|
1162
|
+
apply = preApplyUnavailableReason
|
|
1163
|
+
? unavailableApply(preApplyUnavailableReason, 'source', preApplyUnavailableTargetResults)
|
|
1164
|
+
: await applyConfigToVisibleTargets({
|
|
1165
|
+
plugin: schemaPlugin,
|
|
1166
|
+
scope: options.scope,
|
|
1167
|
+
cwd: options.cwd,
|
|
1168
|
+
env: options.env ?? process.env,
|
|
1169
|
+
applyTargets: applyDiscovery?.targets ?? impact?.affectedTargets ?? options.applyTargets,
|
|
1170
|
+
nativeCliRunner: options.nativeCliRunner,
|
|
1171
|
+
reinstallCommandImpl: options.reinstallCommandImpl,
|
|
1172
|
+
rebuildRuntime: options.rebuildRuntime,
|
|
1173
|
+
noVisibleTargetHasInvalidConfig: (effective?.issues.length ?? 0) > 0,
|
|
1174
|
+
preApplyConfirmed: options.preApplyConfirmed,
|
|
1175
|
+
discovered: applyDiscovery,
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
else if (reset.deleted && options.apply !== false && apply.state === 'skipped') {
|
|
1180
|
+
apply = unavailableApply('schemaUnavailable', 'schema');
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
else if (reset.deleted && options.apply !== false) {
|
|
1184
|
+
apply = options.pluginError
|
|
1185
|
+
? unavailableApply('sourceUnavailable', 'source')
|
|
1186
|
+
: unavailableApply('schemaUnavailable', 'schema');
|
|
1187
|
+
}
|
|
1188
|
+
const otherProjectsMayRequireSync = options.scope === 'user' && reset.deleted;
|
|
1189
|
+
if (otherProjectsMayRequireSync)
|
|
471
1190
|
warnings.push(...otherProjectsWarning(options.scope));
|
|
472
1191
|
return {
|
|
473
1192
|
plugin: pluginName,
|
|
474
1193
|
scope: options.scope,
|
|
475
|
-
|
|
476
|
-
...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
|
|
1194
|
+
...(schemaAccess?.schema ? { schema: schemaAccess.schema } : {}),
|
|
477
1195
|
existed: reset.existed,
|
|
478
1196
|
deleted: reset.deleted,
|
|
1197
|
+
resetDisposition: reset.resetDisposition,
|
|
1198
|
+
...(reset.quarantineBasename ? { quarantineBasename: reset.quarantineBasename } : {}),
|
|
479
1199
|
removedKeys,
|
|
480
1200
|
...(effective ? { effective } : {}),
|
|
481
1201
|
configWrite: 'succeeded',
|
|
482
|
-
overallState:
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
otherProjectsRequireReinstall,
|
|
1202
|
+
overallState: overallStateForApply(apply),
|
|
1203
|
+
apply: publicConfigApplyResult(apply),
|
|
1204
|
+
otherProjectsMayRequireSync,
|
|
486
1205
|
warnings,
|
|
487
1206
|
};
|
|
488
1207
|
}
|
|
489
1208
|
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;
|
|
1209
|
+
assertSafePluginConfigSegment(options.pluginName);
|
|
495
1210
|
return withAwHomeMutationLock({
|
|
496
1211
|
env: options.env,
|
|
497
1212
|
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
|
-
}),
|
|
1213
|
+
action: async (awHomeMutationToken) => {
|
|
1214
|
+
await options.reviewPreflight?.();
|
|
1215
|
+
return resetPluginConfigWithHelperUnlocked({
|
|
1216
|
+
...options,
|
|
1217
|
+
awHomeMutationToken,
|
|
1218
|
+
rebuildRuntime: { ...options.rebuildRuntime, awHomeMutationToken },
|
|
1219
|
+
});
|
|
1220
|
+
},
|
|
514
1221
|
});
|
|
515
1222
|
}
|
|
516
1223
|
export async function describeResetAffectedFields(options) {
|
|
517
|
-
const projectLayer = options.scope === 'project' ? (options.projectLayer ?? 'shared') : 'shared';
|
|
518
1224
|
try {
|
|
519
1225
|
const resolved = await resolveConfigRead({
|
|
520
1226
|
pluginName: options.pluginName,
|
|
521
1227
|
plugin: options.plugin,
|
|
522
1228
|
...(options.pluginError ? { pluginError: options.pluginError } : {}),
|
|
523
1229
|
scope: options.scope,
|
|
524
|
-
projectLayer,
|
|
525
1230
|
cwd: options.cwd,
|
|
526
1231
|
env: options.env,
|
|
527
1232
|
});
|
|
@@ -532,7 +1237,6 @@ export async function describeResetAffectedFields(options) {
|
|
|
532
1237
|
reserved: field.reserved,
|
|
533
1238
|
action: 'reset',
|
|
534
1239
|
scope: options.scope,
|
|
535
|
-
projectLayer,
|
|
536
1240
|
valueState: field.valueState,
|
|
537
1241
|
}));
|
|
538
1242
|
}
|
|
@@ -541,13 +1245,14 @@ export async function describeResetAffectedFields(options) {
|
|
|
541
1245
|
...(options.plugin?.sourceId ? {
|
|
542
1246
|
sourceId: options.plugin.sourceId,
|
|
543
1247
|
sourceIdentity: options.plugin.sourceIdentity,
|
|
1248
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
544
1249
|
} : options.sourceId ? {
|
|
545
1250
|
sourceId: options.sourceId,
|
|
546
1251
|
sourceIdentity: options.sourceIdentity,
|
|
1252
|
+
logicalIdentity: options.logicalIdentity,
|
|
547
1253
|
} : {}),
|
|
548
1254
|
pluginName: options.pluginName,
|
|
549
1255
|
scope: options.scope,
|
|
550
|
-
projectLayer,
|
|
551
1256
|
cwd: options.cwd,
|
|
552
1257
|
env: options.env,
|
|
553
1258
|
});
|
|
@@ -558,7 +1263,6 @@ export async function describeResetAffectedFields(options) {
|
|
|
558
1263
|
reserved: false,
|
|
559
1264
|
action: 'reset',
|
|
560
1265
|
scope: options.scope,
|
|
561
|
-
projectLayer,
|
|
562
1266
|
}));
|
|
563
1267
|
}
|
|
564
1268
|
}
|