@lesliechan721/aw 0.1.0-beta.73 → 0.1.0-beta.75
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-runtime-config.mjs +65 -43
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -1
- package/dist/authoring/scripts/add-skill.mjs +5 -14
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +4 -28
- package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-version-check.mjs +2 -2
- package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +0 -1
- package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +234 -1422
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/scripts/aw-skill-eval-materializer.d.ts +2 -0
- package/dist/scripts/aw-skill-eval-materializer.js +19 -80
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/test-plugin-scripts.js +6 -8
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +2 -2
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/dependency-operation-plan.js +3 -3
- package/dist/src/commands/dependency-operation-plan.js.map +1 -1
- package/dist/src/commands/deployment-confirmation.d.ts +4 -0
- package/dist/src/commands/deployment-confirmation.js +20 -0
- package/dist/src/commands/deployment-confirmation.js.map +1 -0
- package/dist/src/commands/managed-commands.js +4 -2
- package/dist/src/commands/managed-commands.js.map +1 -1
- package/dist/src/commands/offline-cleanup-evidence.d.ts +3 -1
- package/dist/src/commands/offline-cleanup-evidence.js +9 -4
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
- package/dist/src/commands/operation-plan.d.ts +6 -0
- package/dist/src/commands/operation-plan.js +29 -2
- package/dist/src/commands/operation-plan.js.map +1 -1
- package/dist/src/commands/options.d.ts +6 -2
- package/dist/src/commands/options.js +5 -4
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +29 -41
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-config-confirmation.js +5 -5
- package/dist/src/commands/public-config-confirmation.js.map +1 -1
- package/dist/src/commands/public-lifecycle-result.d.ts +47 -0
- package/dist/src/commands/public-lifecycle-result.js +125 -4
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/commands/public-lifecycle.d.ts +1 -0
- package/dist/src/commands/public-lifecycle.js +15 -2
- package/dist/src/commands/public-lifecycle.js.map +1 -1
- package/dist/src/commands/public-plugin-query.d.ts +1 -0
- package/dist/src/commands/public-plugin-query.js +27 -8
- package/dist/src/commands/public-plugin-query.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +12 -11
- package/dist/src/commands/rebuild-command.js +531 -769
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +21 -43
- package/dist/src/commands/rebuild-integration.js +306 -3600
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +13 -0
- package/dist/src/commands/rebuild-operations.js +60 -15
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +60 -0
- package/dist/src/commands/rebuild-platform-integration.js +1264 -0
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
- package/dist/src/commands/review-inspection.js +41 -4
- package/dist/src/commands/review-inspection.js.map +1 -1
- package/dist/src/commands/review-preparation.d.ts +2 -0
- package/dist/src/commands/review-preparation.js +23 -60
- package/dist/src/commands/review-preparation.js.map +1 -1
- package/dist/src/commands/skill-eval.js +1 -0
- package/dist/src/commands/skill-eval.js.map +1 -1
- package/dist/src/commands/status-v6.d.ts +3 -1
- package/dist/src/commands/status-v6.js +24 -15
- package/dist/src/commands/status-v6.js.map +1 -1
- package/dist/src/commands/targets-command.d.ts +9 -0
- package/dist/src/commands/targets-command.js +57 -6
- package/dist/src/commands/targets-command.js.map +1 -1
- package/dist/src/commands/write-commands.js +43 -28
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/constants.d.ts +2 -2
- package/dist/src/constants.js +2 -2
- package/dist/src/constants.js.map +1 -1
- package/dist/src/generators/local-plugin.js +59 -248
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/index.js +40 -14
- package/dist/src/index.js.map +1 -1
- package/dist/src/output/command-receipt.d.ts +1 -1
- package/dist/src/output/command-receipt.js +3 -1
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/native-consent.d.ts +2 -0
- package/dist/src/output/native-consent.js +5 -0
- package/dist/src/output/native-consent.js.map +1 -0
- package/dist/src/output/public-result.js +72 -0
- package/dist/src/output/public-result.js.map +1 -1
- package/dist/src/output/rebuild-progress.js +5 -5
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/output/receipt-projection.js +19 -2
- package/dist/src/output/receipt-projection.js.map +1 -1
- package/dist/src/platforms/capabilities.d.ts +10 -0
- package/dist/src/platforms/capabilities.js +158 -0
- package/dist/src/platforms/capabilities.js.map +1 -0
- package/dist/src/platforms/contracts.d.ts +351 -0
- package/dist/src/platforms/contracts.js +2 -0
- package/dist/src/platforms/contracts.js.map +1 -0
- package/dist/src/platforms/cursor-workspace-hook.d.ts +22 -0
- package/dist/src/platforms/cursor-workspace-hook.js +185 -0
- package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
- package/dist/src/platforms/discovery.d.ts +80 -0
- package/dist/src/platforms/discovery.js +604 -0
- package/dist/src/platforms/discovery.js.map +1 -0
- package/dist/src/platforms/gemini-activation.d.ts +36 -0
- package/dist/src/platforms/gemini-activation.js +331 -0
- package/dist/src/platforms/gemini-activation.js.map +1 -0
- package/dist/src/platforms/gemini-consent.d.ts +8 -0
- package/dist/src/platforms/gemini-consent.js +79 -0
- package/dist/src/platforms/gemini-consent.js.map +1 -0
- package/dist/src/platforms/identity.d.ts +4 -0
- package/dist/src/platforms/identity.js +22 -0
- package/dist/src/platforms/identity.js.map +1 -0
- package/dist/src/platforms/inspection-grok.d.ts +4 -0
- package/dist/src/platforms/inspection-grok.js +204 -0
- package/dist/src/platforms/inspection-grok.js.map +1 -0
- package/dist/src/platforms/inspection-native.d.ts +6 -0
- package/dist/src/platforms/inspection-native.js +401 -0
- package/dist/src/platforms/inspection-native.js.map +1 -0
- package/dist/src/platforms/inspection-opencode.d.ts +4 -0
- package/dist/src/platforms/inspection-opencode.js +97 -0
- package/dist/src/platforms/inspection-opencode.js.map +1 -0
- package/dist/src/platforms/inspection-pi.d.ts +3 -0
- package/dist/src/platforms/inspection-pi.js +287 -0
- package/dist/src/platforms/inspection-pi.js.map +1 -0
- package/dist/src/platforms/inspection-query.d.ts +5 -0
- package/dist/src/platforms/inspection-query.js +36 -0
- package/dist/src/platforms/inspection-query.js.map +1 -0
- package/dist/src/platforms/inspection.d.ts +13 -0
- package/dist/src/platforms/inspection.js +180 -0
- package/dist/src/platforms/inspection.js.map +1 -0
- package/dist/src/platforms/layout.d.ts +21 -0
- package/dist/src/platforms/layout.js +239 -0
- package/dist/src/platforms/layout.js.map +1 -0
- package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
- package/dist/src/platforms/lifecycle-native-services.js +147 -0
- package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
- package/dist/src/platforms/lifecycle-native.d.ts +13 -0
- package/dist/src/platforms/lifecycle-native.js +276 -0
- package/dist/src/platforms/lifecycle-native.js.map +1 -0
- package/dist/src/platforms/lifecycle.d.ts +25 -0
- package/dist/src/platforms/lifecycle.js +470 -0
- package/dist/src/platforms/lifecycle.js.map +1 -0
- package/dist/src/platforms/managed-command-placement.d.ts +8 -0
- package/dist/src/platforms/managed-command-placement.js +79 -0
- package/dist/src/platforms/managed-command-placement.js.map +1 -0
- package/dist/src/platforms/projection-code-extension.d.ts +8 -0
- package/dist/src/platforms/projection-code-extension.js +121 -0
- package/dist/src/platforms/projection-code-extension.js.map +1 -0
- package/dist/src/platforms/projection-command-resources.d.ts +7 -0
- package/dist/src/platforms/projection-command-resources.js +74 -0
- package/dist/src/platforms/projection-command-resources.js.map +1 -0
- package/dist/src/platforms/projection-files.d.ts +27 -0
- package/dist/src/platforms/projection-files.js +111 -0
- package/dist/src/platforms/projection-files.js.map +1 -0
- package/dist/src/platforms/projection-marketplace.d.ts +19 -0
- package/dist/src/platforms/projection-marketplace.js +42 -0
- package/dist/src/platforms/projection-marketplace.js.map +1 -0
- package/dist/src/platforms/projection.d.ts +10 -0
- package/dist/src/platforms/projection.js +446 -0
- package/dist/src/platforms/projection.js.map +1 -0
- package/dist/src/platforms/registry.d.ts +4 -0
- package/dist/src/platforms/registry.js +30 -0
- package/dist/src/platforms/registry.js.map +1 -0
- package/dist/src/platforms/supplement-layout.d.ts +16 -0
- package/dist/src/platforms/supplement-layout.js +31 -0
- package/dist/src/platforms/supplement-layout.js.map +1 -0
- package/dist/src/portable/commands.d.ts +7 -5
- package/dist/src/portable/commands.js +6 -1
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +8 -6
- package/dist/src/portable/materializer.js +47 -245
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery-layout.js +2 -15
- package/dist/src/portable/recovery-layout.js.map +1 -1
- package/dist/src/portable/recovery.d.ts +10 -1
- package/dist/src/portable/recovery.js +34 -8
- package/dist/src/portable/recovery.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +4 -7
- package/dist/src/recovery/coordinator.js +151 -119
- package/dist/src/recovery/coordinator.js.map +1 -1
- package/dist/src/recovery/demand.d.ts +1 -1
- package/dist/src/recovery/demand.js +10 -42
- package/dist/src/recovery/demand.js.map +1 -1
- package/dist/src/recovery/joint-coordinator.js +112 -52
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/joint-demand.d.ts +4 -22
- package/dist/src/recovery/joint-demand.js +51 -40
- package/dist/src/recovery/joint-demand.js.map +1 -1
- package/dist/src/recovery/receipt.d.ts +23 -8
- package/dist/src/recovery/retirement.d.ts +1 -1
- package/dist/src/recovery/retirement.js +131 -29
- package/dist/src/recovery/retirement.js.map +1 -1
- package/dist/src/recovery/status.d.ts +13 -6
- package/dist/src/recovery/status.js +483 -79
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/recovery/types.d.ts +3 -3
- package/dist/src/review/platform-profile.d.ts +3 -0
- package/dist/src/review/platform-profile.js +16 -0
- package/dist/src/review/platform-profile.js.map +1 -0
- package/dist/src/review/review-profile.d.ts +1 -0
- package/dist/src/review/review-profile.js +8 -2
- package/dist/src/review/review-profile.js.map +1 -1
- package/dist/src/review/review-selection.d.ts +2 -11
- package/dist/src/review/review-selection.js +97 -71
- package/dist/src/review/review-selection.js.map +1 -1
- package/dist/src/review/review-types.d.ts +3 -0
- package/dist/src/review/review-types.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +44 -9
- package/dist/src/review/skill-materialization.js +112 -136
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/review/source-binding.d.ts +8 -5
- package/dist/src/review/source-binding.js +99 -41
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/agent-management.js +112 -10
- package/dist/src/tui/agent-management.js.map +1 -1
- package/dist/src/tui/agent-settings.d.ts +3 -0
- package/dist/src/tui/agent-settings.js +10 -11
- package/dist/src/tui/agent-settings.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +58 -20
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/content-item-card.js +2 -2
- package/dist/src/tui/content-item-card.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +198 -152
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +5 -9
- package/dist/src/tui/controller.js +40 -18
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/deployment-view.d.ts +10 -0
- package/dist/src/tui/deployment-view.js +103 -0
- package/dist/src/tui/deployment-view.js.map +1 -0
- package/dist/src/tui/glossary.js +4 -4
- package/dist/src/tui/glossary.js.map +1 -1
- package/dist/src/tui/model.d.ts +5 -0
- package/dist/src/tui/model.js +73 -12
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.js +2 -1
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
- package/dist/src/tui/operation-history.d.ts +5 -4
- package/dist/src/tui/operation-history.js.map +1 -1
- package/dist/src/tui/operation-review-planner.d.ts +7 -2
- package/dist/src/tui/operation-review-planner.js +97 -42
- package/dist/src/tui/operation-review-planner.js.map +1 -1
- package/dist/src/tui/plugin-content.d.ts +5 -3
- package/dist/src/tui/plugin-content.js +70 -508
- package/dist/src/tui/plugin-content.js.map +1 -1
- package/dist/src/tui/plugin-detail.d.ts +3 -2
- package/dist/src/tui/plugin-detail.js +33 -25
- package/dist/src/tui/plugin-detail.js.map +1 -1
- package/dist/src/tui/scoped-inventory.d.ts +10 -6
- package/dist/src/tui/scoped-inventory.js +34 -1
- package/dist/src/tui/scoped-inventory.js.map +1 -1
- package/dist/src/types.d.ts +4 -63
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/agent-version.d.ts +10 -4
- package/dist/src/utils/agent-version.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +26 -2
- package/dist/src/utils/artifact-plan.js +113 -489
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +100 -93
- package/dist/src/utils/artifact-renderer.js +173 -346
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +21 -11
- package/dist/src/utils/artifact-request.js +56 -80
- package/dist/src/utils/artifact-request.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +30 -146
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-digests.d.ts +2 -12
- package/dist/src/utils/catalog-digests.js +0 -39
- package/dist/src/utils/catalog-digests.js.map +1 -1
- package/dist/src/utils/catalog-source-references.d.ts +7 -0
- package/dist/src/utils/catalog-source-references.js +234 -19
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/codex-config-observation.d.ts +19 -0
- package/dist/src/utils/codex-config-observation.js +145 -0
- package/dist/src/utils/codex-config-observation.js.map +1 -0
- package/dist/src/utils/codex-executable-discovery.d.ts +2 -0
- package/dist/src/utils/codex-executable-discovery.js +47 -13
- package/dist/src/utils/codex-executable-discovery.js.map +1 -1
- package/dist/src/utils/codex-manager.js +1 -1
- package/dist/src/utils/codex-manager.js.map +1 -1
- package/dist/src/utils/codex-native-observation.d.ts +3 -0
- package/dist/src/utils/codex-native-observation.js +53 -0
- package/dist/src/utils/codex-native-observation.js.map +1 -1
- package/dist/src/utils/codex-shared-native.d.ts +3 -1
- package/dist/src/utils/codex-shared-native.js +46 -5
- package/dist/src/utils/codex-shared-native.js.map +1 -1
- package/dist/src/utils/codex-skill-staging.d.ts +4 -3
- package/dist/src/utils/codex-skill-staging.js.map +1 -1
- package/dist/src/utils/codex-surface-analysis.d.ts +5 -2
- package/dist/src/utils/codex-surface-analysis.js +28 -57
- package/dist/src/utils/codex-surface-analysis.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +34 -0
- package/dist/src/utils/component-command-preparation.js +228 -0
- package/dist/src/utils/component-command-preparation.js.map +1 -0
- package/dist/src/utils/component-resources.d.ts +43 -0
- package/dist/src/utils/component-resources.js +304 -0
- package/dist/src/utils/component-resources.js.map +1 -0
- package/dist/src/utils/dynamic-skill-tree.d.ts +17 -6
- package/dist/src/utils/dynamic-skill-tree.js +7 -3
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/local-marketplace.d.ts +11 -44
- package/dist/src/utils/local-marketplace.js +11 -638
- package/dist/src/utils/local-marketplace.js.map +1 -1
- package/dist/src/utils/managed-command-evidence.d.ts +2 -2
- package/dist/src/utils/managed-command-evidence.js +5 -81
- package/dist/src/utils/managed-command-evidence.js.map +1 -1
- package/dist/src/utils/managed-command-materialization.d.ts +5 -2
- package/dist/src/utils/managed-command-materialization.js +35 -35
- package/dist/src/utils/managed-command-materialization.js.map +1 -1
- package/dist/src/utils/managed-command-preparation.d.ts +67 -0
- package/dist/src/utils/managed-command-preparation.js +146 -0
- package/dist/src/utils/managed-command-preparation.js.map +1 -0
- package/dist/src/utils/managed-command-review.d.ts +26 -0
- package/dist/src/utils/managed-command-review.js +68 -0
- package/dist/src/utils/managed-command-review.js.map +1 -0
- package/dist/src/utils/managed-command-store.js +26 -15
- package/dist/src/utils/managed-command-store.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +23 -0
- package/dist/src/utils/native-cli.js +51 -2
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/native-demand.d.ts +20 -1
- package/dist/src/utils/native-demand.js.map +1 -1
- package/dist/src/utils/native-tool-review.d.ts +3 -6
- package/dist/src/utils/native-tool-review.js +25 -11
- package/dist/src/utils/native-tool-review.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +26 -3
- package/dist/src/utils/ownership.js +95 -9
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/paths.d.ts +1 -1
- package/dist/src/utils/paths.js +2 -0
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +46 -0
- package/dist/src/utils/platform-empty-state.js +123 -0
- package/dist/src/utils/platform-empty-state.js.map +1 -0
- package/dist/src/utils/plugin-config-impact.d.ts +17 -11
- package/dist/src/utils/plugin-config-impact.js +46 -62
- package/dist/src/utils/plugin-config-impact.js.map +1 -1
- package/dist/src/utils/plugin-config-write.js +52 -53
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +0 -2
- package/dist/src/utils/plugin-config.js +0 -6
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-dependencies.d.ts +1 -1
- package/dist/src/utils/plugin-dependencies.js.map +1 -1
- package/dist/src/utils/plugin-scripts.d.ts +4 -0
- package/dist/src/utils/plugin-scripts.js +11 -0
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/runtime-config.d.ts +5 -7
- package/dist/src/utils/runtime-config.js +12 -25
- package/dist/src/utils/runtime-config.js.map +1 -1
- package/dist/src/utils/windows-npm-shim.js +19 -2
- package/dist/src/utils/windows-npm-shim.js.map +1 -1
- package/package.json +3 -3
- package/dist/src/utils/claude-native-render-receipt.d.ts +0 -14
- package/dist/src/utils/claude-native-render-receipt.js +0 -26
- package/dist/src/utils/claude-native-render-receipt.js.map +0 -1
- package/dist/src/utils/claude-skills-root.d.ts +0 -8
- package/dist/src/utils/claude-skills-root.js +0 -87
- package/dist/src/utils/claude-skills-root.js.map +0 -1
- package/dist/src/utils/codex-native-render-receipt.d.ts +0 -40
- package/dist/src/utils/codex-native-render-receipt.js +0 -205
- package/dist/src/utils/codex-native-render-receipt.js.map +0 -1
- package/dist/src/utils/slash-commands.d.ts +0 -1
- package/dist/src/utils/slash-commands.js +0 -2
- package/dist/src/utils/slash-commands.js.map +0 -1
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
|
-
import { selectPluginConfigProfile } from '@lesliechan721/aw-plugin-core/manifest';
|
|
5
|
-
import { assertReadyPluginConfigStore, readPluginConfigStore, resolveEffectivePluginConfig
|
|
4
|
+
import { normalizeStaticPluginComponents, assertPlatformRenderContext, selectPluginConfigProfile, assertNoDuplicateHookHandlers, } from '@lesliechan721/aw-plugin-core/manifest';
|
|
5
|
+
import { assertReadyPluginConfigStore, readPluginConfigStore, resolveEffectivePluginConfig } from './plugin-config.js';
|
|
6
6
|
import { assertNoSensitiveConfigValues, buildNodeScriptInvocation, buildPluginScriptSpawnEnv, calculateFileDigest, collectSensitivePluginConfigValues, defaultPluginProcessRunner, preparePluginScriptDirectories, redactPluginScriptOutput, resolveBundledPluginFilePath, resolvePluginScriptTimeoutMs, summarizePluginScriptOutput, } from './plugin-scripts.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { resolveArtifactRequest, resolvePlatformComponentBatches, selectPlatformRenderConfig, selectPlatformRenderConfigKeys } from './artifact-request.js';
|
|
8
|
+
import { artifactValueDigest, mergeExpectedComponentSets, validateArtifactPlan, validatePlatformComponentPlan } from './artifact-plan.js';
|
|
9
|
+
import { resolveCommandSourceDirectory } from './artifact-sources.js';
|
|
10
|
+
import { resolvePlatformComponentResources, verifyPlatformComponentResources } from './component-resources.js';
|
|
10
11
|
import { createArtifactRuntimeConfigSnapshots } from './runtime-config.js';
|
|
12
|
+
import { prepareWindowsJobHelper } from './process-tree.js';
|
|
11
13
|
import { attachSafeOperationError, readSafeOperationError } from './safe-operation-diagnostic.js';
|
|
12
|
-
const
|
|
13
|
-
'install',
|
|
14
|
-
'refresh',
|
|
15
|
-
'materialize',
|
|
16
|
-
]);
|
|
14
|
+
export const ARTIFACT_RENDERER_MAX_STDOUT_BYTES = 16 * 1024 * 1024;
|
|
17
15
|
function isRecord(value) {
|
|
18
16
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
19
17
|
}
|
|
20
|
-
function assertArtifactRenderEvent(value) {
|
|
21
|
-
if (!SUPPORTED_ARTIFACT_RENDER_EVENTS.has(value)) {
|
|
22
|
-
throw new Error(`Artifact renderer only supports install, refresh, and materialize events; received "${value}".`);
|
|
23
|
-
}
|
|
24
|
-
return value;
|
|
25
|
-
}
|
|
26
|
-
function selectConfigKeys(values, selectedKeys) {
|
|
27
|
-
return Object.fromEntries(Object.entries(values).filter(([key]) => selectedKeys.has(key)));
|
|
28
|
-
}
|
|
29
18
|
export async function resolveArtifactRenderConfig(options) {
|
|
30
19
|
const pluginName = options.pluginName ?? options.manifest.name;
|
|
31
20
|
const schema = options.manifest.config ? selectPluginConfigProfile(options.manifest.config, options.platform).fields : undefined;
|
|
@@ -106,360 +95,198 @@ export async function resolveArtifactRendererTarget(plugin) {
|
|
|
106
95
|
rendererDigest: await calculateFileDigest(entryPath),
|
|
107
96
|
};
|
|
108
97
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
!options.target.bundleRoot ||
|
|
115
|
-
!options.target.sourceManifest ||
|
|
116
|
-
!options.target.manifestPath ||
|
|
117
|
-
!options.target.manifestDigest ||
|
|
118
|
-
!options.target.rendererDigest) {
|
|
119
|
-
throw new Error('Cannot write artifact renderer context for a no-op target.');
|
|
120
|
-
}
|
|
121
|
-
if (options.platform === 'agent-skills') {
|
|
122
|
-
throw new Error('artifactTargetRequired: Portable Skill rendering requires a concrete platform target.');
|
|
98
|
+
/** One process boundary for all surfaces. Surface owners validate their response schema. */
|
|
99
|
+
export async function runPreparedArtifactRenderer(options) {
|
|
100
|
+
options.signal?.throwIfAborted();
|
|
101
|
+
if (!isRecord(options.context) || (options.context.scope !== 'user' && options.context.scope !== 'project')) {
|
|
102
|
+
throw new Error('artifactRendererContextInvalid: A prepared context must contain its render scope.');
|
|
123
103
|
}
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const request = resolveArtifactRequest({
|
|
128
|
-
manifest: options.target.sourceManifest,
|
|
129
|
-
platform: options.platform,
|
|
130
|
-
scope: options.scope,
|
|
131
|
-
requestedArtifactIds: options.requestedArtifactIds,
|
|
132
|
-
});
|
|
133
|
-
const requestedConfigKeys = new Set(request.declarations.flatMap((target) => target.refreshKeys));
|
|
134
|
-
const config = await resolveArtifactRenderConfig({
|
|
135
|
-
sourceId: options.sourceId,
|
|
136
|
-
sourceIdentity: options.sourceIdentity,
|
|
137
|
-
logicalIdentity: options.logicalIdentity,
|
|
138
|
-
pluginName: options.target.sourceManifest.name,
|
|
139
|
-
manifest: options.target.sourceManifest,
|
|
140
|
-
platform,
|
|
141
|
-
referencePlugins: options.referencePlugins,
|
|
142
|
-
scope: options.configScope ?? options.scope,
|
|
143
|
-
cwd: options.cwd,
|
|
144
|
-
env: options.commandEnv,
|
|
145
|
-
});
|
|
146
|
-
const rendererConfig = {
|
|
147
|
-
mode: config.mode,
|
|
148
|
-
targetScope: config.targetScope,
|
|
149
|
-
schema: config.schema === undefined
|
|
150
|
-
? undefined
|
|
151
|
-
: selectConfigKeys(config.schema, requestedConfigKeys),
|
|
152
|
-
values: selectConfigKeys(config.values, requestedConfigKeys),
|
|
153
|
-
sources: selectConfigKeys(config.sources, requestedConfigKeys),
|
|
154
|
-
issues: config.issues.filter((issue) => requestedConfigKeys.has(issue.key)),
|
|
155
|
-
};
|
|
156
|
-
const runtimeConfigSnapshots = platform === 'codex' || platform === 'claude' ? createArtifactRuntimeConfigSnapshots({
|
|
157
|
-
sourceId: options.sourceId,
|
|
158
|
-
sourceIdentity: options.sourceIdentity,
|
|
159
|
-
logicalIdentity: options.logicalIdentity,
|
|
160
|
-
manifest: options.target.sourceManifest,
|
|
161
|
-
platform,
|
|
162
|
-
scope: options.scope,
|
|
163
|
-
config,
|
|
164
|
-
requestedArtifactIds: request.requestedArtifactIds,
|
|
165
|
-
}) : {};
|
|
166
|
-
const artifactSources = await Promise.all((options.target.sourceManifest.artifacts?.targets ?? [])
|
|
167
|
-
.filter((target) => (target.target === 'codex.skill' || target.target === 'claude.skill' || target.target === 'agent-skills.skill')
|
|
168
|
-
&& target.platform === platform
|
|
169
|
-
&& target.distribution === distribution
|
|
170
|
-
&& ((target.target === 'codex.skill' || target.target === 'claude.skill')
|
|
171
|
-
|| target.scopes.includes(options.scope)))
|
|
172
|
-
.map(async (target) => ({
|
|
173
|
-
id: target.id,
|
|
174
|
-
target: target.target,
|
|
175
|
-
sourceDirs: await Promise.all((target.sourceDirs ?? []).map((_, index) => resolveBundledPluginFilePath({
|
|
176
|
-
bundleRoot: options.target.bundleRoot,
|
|
177
|
-
pluginRelativePath: `./${getArtifactSourceBundleRelativePath({
|
|
178
|
-
platform: target.platform,
|
|
179
|
-
distribution: target.distribution,
|
|
180
|
-
artifactId: target.id,
|
|
181
|
-
index,
|
|
182
|
-
})}`,
|
|
183
|
-
fieldName: `Artifact source ${target.id}[${index}]`,
|
|
184
|
-
}))),
|
|
185
|
-
})));
|
|
186
|
-
const packageKeys = new Set(request.declarations.flatMap((declaration) => 'producer' in declaration && declaration.producer.kind === 'package' ? [declaration.producer.packageKey] : []));
|
|
187
|
-
const commandSources = await Promise.all((options.target.sourceManifest.managedCommands?.packages ?? [])
|
|
188
|
-
.filter((entry) => packageKeys.has(entry.key))
|
|
189
|
-
.map(async (entry) => ({
|
|
190
|
-
packageKey: entry.key,
|
|
191
|
-
sourceDir: await resolveCommandSourceDirectory({ bundleRoot: options.target.bundleRoot, pluginRelativePath: entry.sourceDir }),
|
|
192
|
-
})));
|
|
104
|
+
const target = await resolveArtifactRendererTarget(options.plugin);
|
|
105
|
+
if (target.noOp)
|
|
106
|
+
throw new Error(`Plugin "${options.plugin.manifest.name}" does not declare scripts.artifacts.render.`);
|
|
193
107
|
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'aw-plugin-artifact-render-'));
|
|
108
|
+
const isolatedHomes = { awHome: path.join(tempDir, 'aw-home'), codexHome: path.join(tempDir, 'codex-home'), claudeHome: path.join(tempDir, 'claude-home') };
|
|
194
109
|
try {
|
|
195
|
-
const context = {
|
|
196
|
-
event,
|
|
197
|
-
surface: awSurface ? { kind: 'aw', name: 'managed-commands' } : distribution
|
|
198
|
-
? { kind: 'distribution', name: distribution }
|
|
199
|
-
: { kind: 'platform', name: platform },
|
|
200
|
-
platform,
|
|
201
|
-
distribution,
|
|
202
|
-
scope: options.scope,
|
|
203
|
-
plugin: {
|
|
204
|
-
name: options.target.sourceManifest.name,
|
|
205
|
-
version: options.target.sourceManifest.version,
|
|
206
|
-
rootDir: options.target.bundleRoot,
|
|
207
|
-
},
|
|
208
|
-
config: rendererConfig,
|
|
209
|
-
changedConfigKeys: (options.changedConfigKeys ?? [])
|
|
210
|
-
.filter((key) => requestedConfigKeys.has(key)),
|
|
211
|
-
requestedArtifactIds: request.requestedArtifactIds,
|
|
212
|
-
previousArtifacts: options.previousArtifacts ?? [],
|
|
213
|
-
artifactSources,
|
|
214
|
-
commandSources,
|
|
215
|
-
runtimeImports: request.declarations
|
|
216
|
-
.flatMap((target) => (target.runtimeImports ?? []).map((runtimeImport) => {
|
|
217
|
-
if (!runtimeImport.resolved) {
|
|
218
|
-
throw new Error(`Artifact runtime import "${target.id}/${runtimeImport.name}" is not resolved in the bundle.`);
|
|
219
|
-
}
|
|
220
|
-
return {
|
|
221
|
-
artifactId: target.id,
|
|
222
|
-
name: runtimeImport.name,
|
|
223
|
-
providerPluginId: runtimeImport.resolved.providerPluginId,
|
|
224
|
-
exportName: runtimeImport.export,
|
|
225
|
-
path: path.join(options.target.bundleRoot, runtimeImport.resolved.path.replace(/^\.\//u, '')),
|
|
226
|
-
digest: runtimeImport.resolved.digest,
|
|
227
|
-
};
|
|
228
|
-
})),
|
|
229
|
-
paths: {
|
|
230
|
-
awHome: path.join(tempDir, 'aw-home'),
|
|
231
|
-
codexHome: path.join(tempDir, 'codex-home'),
|
|
232
|
-
claudeHome: path.join(tempDir, 'claude-home'),
|
|
233
|
-
manifestPath: options.target.manifestPath,
|
|
234
|
-
},
|
|
235
|
-
renderer: {
|
|
236
|
-
runner: options.target.entry.runner,
|
|
237
|
-
path: options.target.entryPath,
|
|
238
|
-
args: options.target.entry.args ?? [],
|
|
239
|
-
manifestDigest: options.target.manifestDigest,
|
|
240
|
-
rendererDigest: options.target.rendererDigest,
|
|
241
|
-
},
|
|
242
|
-
};
|
|
243
110
|
const contextPath = path.join(tempDir, 'context.json');
|
|
244
|
-
await fs.writeJson(contextPath, context, { spaces: 2 });
|
|
111
|
+
await fs.writeJson(contextPath, options.context, { spaces: 2 });
|
|
112
|
+
await fs.chmod(contextPath, 0o600).catch(() => undefined);
|
|
113
|
+
await preparePluginScriptDirectories(tempDir);
|
|
114
|
+
if (process.platform === 'win32')
|
|
115
|
+
await prepareWindowsJobHelper();
|
|
116
|
+
for (const location of Object.values(isolatedHomes))
|
|
117
|
+
await fs.ensureDir(location);
|
|
118
|
+
const commandEnv = options.commandEnv ?? process.env;
|
|
119
|
+
const surface = options.context.surface;
|
|
120
|
+
const platform = typeof options.context.platform === 'string' ? options.context.platform : undefined;
|
|
121
|
+
const env = buildPluginScriptSpawnEnv({ commandEnv, contextPath, tempDir, isolatedHomes,
|
|
122
|
+
plugin: options.plugin.manifest, event: options.event ?? 'materialize',
|
|
123
|
+
platform, scope: options.context.scope, bundleRoot: target.bundleRoot });
|
|
124
|
+
env.AW_PLUGIN_SURFACE = typeof surface === 'string' ? surface : 'managed-commands';
|
|
125
|
+
const invocation = buildNodeScriptInvocation({ entryPath: target.entryPath, cwd: options.cwd, env, args: target.entry.args });
|
|
126
|
+
const timeoutMs = resolvePluginScriptTimeoutMs({ cliTimeoutMs: options.scriptTimeoutMs });
|
|
127
|
+
const preparationKey = options.preparedResults ? artifactValueDigest({ context: options.context,
|
|
128
|
+
manifestDigest: target.manifestDigest, rendererDigest: target.rendererDigest, cwd: options.cwd,
|
|
129
|
+
commandEnv, scriptTimeoutMs: options.scriptTimeoutMs }) : undefined;
|
|
130
|
+
const runOptions = { timeoutMs, maxStdoutBytes: ARTIFACT_RENDERER_MAX_STDOUT_BYTES, ...(options.signal ? { signal: options.signal } : {}) };
|
|
131
|
+
const result = (preparationKey ? options.preparedResults?.get(preparationKey) : undefined)
|
|
132
|
+
?? await (options.runner ? options.runner.run(invocation, runOptions)
|
|
133
|
+
: defaultPluginProcessRunner.run(invocation, { ...runOptions, sensitiveValues: options.sensitiveValues }));
|
|
134
|
+
const summary = (text) => summarizePluginScriptOutput(text, options.sensitiveValues) || '<empty>';
|
|
135
|
+
const stdout = summary(result.stdout);
|
|
136
|
+
const stderr = summary(result.stderr);
|
|
137
|
+
if (result.stdoutTruncated || Buffer.byteLength(result.stdout, 'utf8') > ARTIFACT_RENDERER_MAX_STDOUT_BYTES)
|
|
138
|
+
throw new Error('artifactRendererOutputTooLarge: Artifact renderer JSON exceeds the 16 MiB limit.');
|
|
139
|
+
if (result.timedOut)
|
|
140
|
+
throw new Error(`Artifact renderer timed out after ${timeoutMs} ms. stderr: ${stderr}`);
|
|
141
|
+
if (result.exitCode !== 0 || result.signal !== null)
|
|
142
|
+
throw new Error(`Artifact renderer failed with exit code ${result.exitCode}. stderr: ${stderr}`);
|
|
143
|
+
let value;
|
|
245
144
|
try {
|
|
246
|
-
|
|
145
|
+
value = JSON.parse(result.stdout.trim());
|
|
247
146
|
}
|
|
248
147
|
catch {
|
|
249
|
-
|
|
148
|
+
throw new Error(`Artifact renderer must write JSON to stdout. stdout: ${stdout}. stderr: ${stderr}`);
|
|
250
149
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
runtimeConfigSnapshots,
|
|
257
|
-
cleanup: async () => {
|
|
258
|
-
await fs.remove(tempDir);
|
|
259
|
-
},
|
|
260
|
-
};
|
|
150
|
+
assertNoSensitiveConfigValues(value, options.sensitiveValues, 'artifactRendererSensitiveConfigExposed: Artifact renderer output contains sensitive config.');
|
|
151
|
+
// This cache is scoped to one operation. Every consumer still validates its surface and resources.
|
|
152
|
+
if (preparationKey)
|
|
153
|
+
options.preparedResults.set(preparationKey, result);
|
|
154
|
+
return { value, target, exitCode: result.exitCode, signal: result.signal, stdout, stderr, timedOut: result.timedOut };
|
|
261
155
|
}
|
|
262
156
|
catch (error) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
function assertArtifactPlanEnvelope(value, output) {
|
|
273
|
-
if (!isRecord(value)) {
|
|
274
|
-
throw new Error(`Artifact renderer must write a JSON object to stdout. stdout: ${output.stdoutSummary}. stderr: ${output.stderrSummary}`);
|
|
275
|
-
}
|
|
276
|
-
if (value.version !== 2) {
|
|
277
|
-
const migrationHint = value.version === 1
|
|
278
|
-
? ' ArtifactPlan V1 is not supported by AW 1.0.0-beta.30; upgrade or reinstall the plugin.'
|
|
279
|
-
: '';
|
|
280
|
-
throw new Error(`Artifact renderer returned unsupported plan version "${String(value.version)}".${migrationHint} stderr: ${output.stderrSummary}`);
|
|
281
|
-
}
|
|
282
|
-
if (!Array.isArray(value.artifacts)) {
|
|
283
|
-
throw new Error(`Artifact renderer returned an invalid plan: "artifacts" must be an array. stdout: ${output.stdoutSummary}. stderr: ${output.stderrSummary}`);
|
|
157
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
158
|
+
const redacted = redactPluginScriptOutput(message, options.sensitiveValues);
|
|
159
|
+
if (redacted === message)
|
|
160
|
+
throw error;
|
|
161
|
+
const failure = new Error(redacted, { cause: error });
|
|
162
|
+
if (error instanceof Error)
|
|
163
|
+
failure.name = error.name;
|
|
164
|
+
const diagnostic = readSafeOperationError(error);
|
|
165
|
+
throw diagnostic ? attachSafeOperationError(failure, diagnostic) : failure;
|
|
284
166
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
function buildArtifactRendererInvocation(options) {
|
|
288
|
-
return buildNodeScriptInvocation({
|
|
289
|
-
entryPath: options.entryPath,
|
|
290
|
-
cwd: options.cwd,
|
|
291
|
-
env: options.env,
|
|
292
|
-
args: options.entry.args,
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
function assertRefreshKeysForEvent(event, changedConfigKeys) {
|
|
296
|
-
assertArtifactRenderEvent(event);
|
|
297
|
-
const keys = changedConfigKeys ? [...changedConfigKeys] : [];
|
|
298
|
-
if (event === 'refresh' && keys.length === 0) {
|
|
299
|
-
throw new Error('Artifact renderer refresh requires changedConfigKeys.');
|
|
167
|
+
finally {
|
|
168
|
+
await fs.remove(tempDir);
|
|
300
169
|
}
|
|
301
|
-
return keys;
|
|
302
170
|
}
|
|
303
|
-
async function
|
|
304
|
-
const runOptions = {
|
|
305
|
-
timeoutMs: options.timeoutMs,
|
|
306
|
-
maxStdoutBytes: ARTIFACT_RENDERER_MAX_STDOUT_BYTES,
|
|
307
|
-
...(options.signal ? { signal: options.signal } : {}),
|
|
308
|
-
};
|
|
309
|
-
return options.runner
|
|
310
|
-
? options.runner.run(options.invocation, runOptions)
|
|
311
|
-
: defaultPluginProcessRunner.run(options.invocation, {
|
|
312
|
-
...runOptions,
|
|
313
|
-
sensitiveValues: options.sensitiveValues,
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
export async function runArtifactRenderer(options) {
|
|
171
|
+
export async function preparePlatformComponents(options) {
|
|
317
172
|
options.signal?.throwIfAborted();
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
173
|
+
if (options.capabilities.platform !== options.platform || options.capabilities.scope !== options.renderScope
|
|
174
|
+
|| options.config.targetScope !== options.renderScope)
|
|
175
|
+
throw new Error('componentRenderUnitMismatch: Config and capability scope must match the render unit.');
|
|
321
176
|
const target = await resolveArtifactRendererTarget(options.plugin);
|
|
322
|
-
|
|
323
|
-
throw new Error(`Plugin "${options.plugin.manifest.name}" does not declare scripts.artifacts.render.`);
|
|
324
|
-
}
|
|
325
|
-
const writtenContext = await writeArtifactRendererContext({
|
|
326
|
-
sourceId: options.plugin.sourceId,
|
|
327
|
-
sourceIdentity: options.plugin.sourceIdentity,
|
|
328
|
-
logicalIdentity: options.plugin.catalogLogicalIdentity,
|
|
329
|
-
target,
|
|
330
|
-
referencePlugins: options.referencePlugins,
|
|
331
|
-
event,
|
|
332
|
-
platform: options.platform,
|
|
333
|
-
scope: options.scope,
|
|
334
|
-
...(options.configScope ? { configScope: options.configScope } : {}),
|
|
335
|
-
cwd: options.cwd,
|
|
336
|
-
commandEnv,
|
|
337
|
-
changedConfigKeys,
|
|
338
|
-
previousArtifacts: options.previousArtifacts,
|
|
339
|
-
requestedArtifactIds: options.requestedArtifactIds,
|
|
340
|
-
});
|
|
177
|
+
const sensitiveValues = collectSensitivePluginConfigValues(options.plugin.manifest, options.config.values, options.platform);
|
|
341
178
|
try {
|
|
342
|
-
|
|
343
|
-
|
|
179
|
+
const resources = await resolvePlatformComponentResources(options.plugin);
|
|
180
|
+
const sets = [options.staticExpected ?? await normalizeStaticPluginComponents({
|
|
181
|
+
pluginRoot: options.plugin.rootDir, staticResourceRoot: options.staticResourceRoot, manifest: options.plugin.manifest, platform: options.platform,
|
|
182
|
+
capabilities: options.capabilities, allowedOutputKinds: options.kinds,
|
|
183
|
+
})];
|
|
184
|
+
const contexts = [];
|
|
185
|
+
for (const allowedOutputKinds of resolvePlatformComponentBatches({ ...options, manifest: options.plugin.manifest })) {
|
|
186
|
+
const nonSensitive = allowedOutputKinds.includes('skill');
|
|
187
|
+
const keys = options.plugin.manifest.artifacts.configKeys;
|
|
188
|
+
const config = selectPlatformRenderConfig({ resolved: options.config, keys, nonSensitive });
|
|
189
|
+
if (config.issues.length)
|
|
190
|
+
throw new Error(`Invalid AW config for ${options.plugin.manifest.name}: ${config.issues.map((issue) => issue.path.field).join(', ')}.`);
|
|
191
|
+
const context = {
|
|
192
|
+
schemaVersion: 1, surface: 'agent-plugin', platform: options.platform, scope: options.renderScope,
|
|
193
|
+
plugin: { pluginId: options.plugin.pluginId ?? `${options.plugin.sourceId ?? 'authoring'}/${options.plugin.manifest.name}`,
|
|
194
|
+
name: options.plugin.manifest.name, version: options.plugin.manifest.version },
|
|
195
|
+
config, changedConfigKeys: (options.changedConfigKeys ?? []).filter((key) => Object.hasOwn(config.sources, key)),
|
|
196
|
+
allowedOutputKinds, platformCapabilities: options.capabilities, resources,
|
|
197
|
+
previousComponents: (options.previousComponents ?? []).filter((entry) => allowedOutputKinds.includes(entry.kind))
|
|
198
|
+
.map(({ id, kind, name }) => ({ id, kind, name })),
|
|
199
|
+
};
|
|
200
|
+
assertPlatformRenderContext(context);
|
|
201
|
+
contexts.push(context);
|
|
202
|
+
const rendered = await runPreparedArtifactRenderer({ ...options, context, sensitiveValues });
|
|
203
|
+
const plan = validatePlatformComponentPlan({ plan: rendered.value, platform: options.platform, scope: options.renderScope,
|
|
204
|
+
allowedOutputKinds, platformCapabilities: options.capabilities, configKeys: keys,
|
|
205
|
+
nonSensitiveConfigKeys: selectPlatformRenderConfigKeys({ resolved: options.config, keys, nonSensitive: true }),
|
|
206
|
+
resources, sourceDirs: options.plugin.manifest.artifacts?.sourceDirs,
|
|
207
|
+
requiredAwCapabilities: options.plugin.manifest.requires?.aw.capabilities });
|
|
208
|
+
sets.push({ components: plan.components, omitted: plan.omitted, unmet: plan.unmet,
|
|
209
|
+
sources: Object.fromEntries([...plan.components, ...plan.omitted, ...plan.unmet].map((entry) => [entry.id, 'dynamic'])) });
|
|
344
210
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
]
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
contextPath: writtenContext.contextPath,
|
|
359
|
-
tempDir: writtenContext.tempDir,
|
|
360
|
-
plugin: writtenContext.context.plugin,
|
|
361
|
-
event,
|
|
362
|
-
...(options.platform === 'managed-commands'
|
|
363
|
-
? {}
|
|
364
|
-
: { platform: writtenContext.context.platform,
|
|
365
|
-
...(writtenContext.context.distribution ? { distribution: writtenContext.context.distribution } : {}) }),
|
|
366
|
-
scope: options.scope,
|
|
367
|
-
bundleRoot: writtenContext.context.plugin.rootDir,
|
|
211
|
+
const expected = mergeExpectedComponentSets(sets);
|
|
212
|
+
assertNoDuplicateHookHandlers(expected.components, options.platform);
|
|
213
|
+
const closure = await verifyPlatformComponentResources({ plugin: options.plugin, expected, resources,
|
|
214
|
+
capabilities: options.capabilities, sensitiveValues, staticResourceRoot: options.staticResourceRoot });
|
|
215
|
+
// Only the exact static receipt, already matched to the verified manifest above, is metadata rather than plugin text.
|
|
216
|
+
const scannedComponents = expected.components.map((component) => component.kind === 'skill' && expected.sources[component.id] === 'static'
|
|
217
|
+
? { ...component, content: { files: Object.fromEntries(Object.entries(component.content.files).filter(([file]) => file !== 'aw-plugin-requirements.json')) } }
|
|
218
|
+
: component);
|
|
219
|
+
assertNoSensitiveConfigValues({ ...expected, components: scannedComponents }, sensitiveValues, 'componentSensitiveConfigExposed: Components contain sensitive config.');
|
|
220
|
+
const runtimeConfigSnapshots = createArtifactRuntimeConfigSnapshots({
|
|
221
|
+
sourceId: options.plugin.sourceId, sourceIdentity: options.plugin.sourceIdentity,
|
|
222
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity, manifest: options.plugin.manifest,
|
|
223
|
+
platform: options.platform, scope: options.renderScope, config: options.config, components: expected.components,
|
|
368
224
|
});
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
});
|
|
377
|
-
// Temporary homes change on every preparation. The remaining context binds
|
|
378
|
-
// the renderer, exact request, config, sources and previous artifacts.
|
|
379
|
-
const preparationKey = options.preparedResults ? JSON.stringify({
|
|
380
|
-
...writtenContext.context,
|
|
381
|
-
paths: { manifestPath: writtenContext.context.paths.manifestPath },
|
|
382
|
-
cwd: options.cwd,
|
|
383
|
-
commandEnv,
|
|
384
|
-
scriptTimeoutMs: options.scriptTimeoutMs,
|
|
385
|
-
}) : undefined;
|
|
386
|
-
const result = (preparationKey ? options.preparedResults?.get(preparationKey) : undefined)
|
|
387
|
-
?? await runArtifactRendererProcess({
|
|
388
|
-
invocation,
|
|
389
|
-
timeoutMs,
|
|
390
|
-
sensitiveValues: writtenContext.sensitiveValues,
|
|
391
|
-
signal: options.signal,
|
|
392
|
-
runner: options.runner,
|
|
393
|
-
});
|
|
394
|
-
const stdoutSummary = summarizeRenderOutput(result.stdout, writtenContext.sensitiveValues);
|
|
395
|
-
const stderrSummary = summarizeRenderOutput(result.stderr, writtenContext.sensitiveValues);
|
|
396
|
-
if (result.stdoutTruncated || Buffer.byteLength(result.stdout, 'utf8') > ARTIFACT_RENDERER_MAX_STDOUT_BYTES) {
|
|
397
|
-
throw new Error('artifactRendererOutputTooLarge: Artifact renderer JSON exceeds the 16 MiB limit.');
|
|
398
|
-
}
|
|
399
|
-
if (result.timedOut) {
|
|
400
|
-
throw new Error(`Artifact renderer timed out after ${timeoutMs} ms. stderr: ${stderrSummary}`);
|
|
401
|
-
}
|
|
402
|
-
if (result.exitCode !== 0) {
|
|
403
|
-
throw new Error(`Artifact renderer failed with exit code ${result.exitCode}. stderr: ${stderrSummary}`);
|
|
404
|
-
}
|
|
405
|
-
const rawStdout = result.stdout.trim();
|
|
406
|
-
let parsed;
|
|
407
|
-
try {
|
|
408
|
-
parsed = JSON.parse(rawStdout);
|
|
409
|
-
}
|
|
410
|
-
catch {
|
|
411
|
-
throw new Error(`Artifact renderer must write JSON to stdout. stdout: ${stdoutSummary}. stderr: ${stderrSummary}`);
|
|
412
|
-
}
|
|
413
|
-
let plan;
|
|
414
|
-
try {
|
|
415
|
-
assertNoSensitiveConfigValues(parsed, writtenContext.sensitiveValues, 'artifactRendererSensitiveConfigExposed: Artifact renderer output contains sensitive config.');
|
|
416
|
-
plan = assertArtifactPlanEnvelope(parsed, {
|
|
417
|
-
stdoutSummary,
|
|
418
|
-
stderrSummary,
|
|
419
|
-
});
|
|
420
|
-
validateArtifactPlan({
|
|
421
|
-
manifest: options.plugin.manifest,
|
|
422
|
-
plan,
|
|
423
|
-
platform: options.platform,
|
|
424
|
-
scope: options.scope,
|
|
425
|
-
requestedArtifactIds: writtenContext.context.requestedArtifactIds,
|
|
426
|
-
renderConfig: writtenContext.context.config,
|
|
427
|
-
rendererDigest: target.rendererDigest,
|
|
428
|
-
manifestDigest: target.manifestDigest,
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
catch (error) {
|
|
432
|
-
throw new Error(redactPluginScriptOutput(error instanceof Error ? error.message : String(error), writtenContext.sensitiveValues));
|
|
433
|
-
}
|
|
434
|
-
// Cache only validated success. Reused output still passes the current
|
|
435
|
-
// sensitive-value and artifact checks above.
|
|
436
|
-
if (preparationKey)
|
|
437
|
-
options.preparedResults.set(preparationKey, result);
|
|
438
|
-
return {
|
|
439
|
-
plan,
|
|
440
|
-
target,
|
|
441
|
-
context: writtenContext.context,
|
|
442
|
-
runtimeConfigSnapshots: writtenContext.runtimeConfigSnapshots,
|
|
443
|
-
exitCode: result.exitCode,
|
|
444
|
-
signal: result.signal,
|
|
445
|
-
stdout: stdoutSummary,
|
|
446
|
-
stderr: stderrSummary,
|
|
447
|
-
timedOut: result.timedOut,
|
|
225
|
+
const evidence = {
|
|
226
|
+
manifestDigest: target.manifestDigest, ...(target.rendererDigest ? { rendererDigest: target.rendererDigest } : {}),
|
|
227
|
+
configDigest: artifactValueDigest(selectPlatformRenderConfig({ resolved: options.config,
|
|
228
|
+
keys: options.plugin.manifest.artifacts?.configKeys ?? [], nonSensitive: false })),
|
|
229
|
+
capabilitiesDigest: artifactValueDigest(options.capabilities), resourceDigest: closure.digest,
|
|
230
|
+
renderInputDigest: artifactValueDigest({ contexts, static: sets[0], manifestDigest: target.manifestDigest,
|
|
231
|
+
rendererDigest: target.rendererDigest, resources: closure.digest }),
|
|
448
232
|
};
|
|
233
|
+
return { expected, resources: closure, evidence, runtimeConfigSnapshots,
|
|
234
|
+
empty: expected.components.length ? null : expected.unmet.length ? 'unmet' : 'intentional' };
|
|
449
235
|
}
|
|
450
236
|
catch (error) {
|
|
451
237
|
const message = error instanceof Error ? error.message : String(error);
|
|
452
|
-
const redacted = redactPluginScriptOutput(message,
|
|
453
|
-
if (
|
|
238
|
+
const redacted = redactPluginScriptOutput(message, sensitiveValues);
|
|
239
|
+
if (message === redacted)
|
|
454
240
|
throw error;
|
|
455
|
-
const failure = new Error(redacted
|
|
456
|
-
if (error instanceof Error)
|
|
457
|
-
failure.name = error.name;
|
|
241
|
+
const failure = new Error(redacted);
|
|
458
242
|
const diagnostic = readSafeOperationError(error);
|
|
459
243
|
throw diagnostic ? attachSafeOperationError(failure, diagnostic) : failure;
|
|
460
244
|
}
|
|
245
|
+
}
|
|
246
|
+
/** The independent command-package surface retains its v2 protocol. */
|
|
247
|
+
export async function runArtifactRenderer(options) {
|
|
248
|
+
const written = await createManagedCommandRendererContext({ ...options, target: await resolveArtifactRendererTarget(options.plugin),
|
|
249
|
+
sourceId: options.plugin.sourceId, sourceIdentity: options.plugin.sourceIdentity,
|
|
250
|
+
logicalIdentity: options.plugin.catalogLogicalIdentity, commandEnv: options.commandEnv ?? process.env });
|
|
251
|
+
try {
|
|
252
|
+
const rendered = await runPreparedArtifactRenderer({ ...options, context: written.context, sensitiveValues: written.sensitiveValues });
|
|
253
|
+
const plan = validateArtifactPlan({ ...options, manifest: options.plugin.manifest, plan: rendered.value,
|
|
254
|
+
renderConfig: written.renderConfig, manifestDigest: rendered.target.manifestDigest, rendererDigest: rendered.target.rendererDigest });
|
|
255
|
+
return { ...rendered, plan, context: written.context, runtimeConfigSnapshots: {} };
|
|
256
|
+
}
|
|
461
257
|
finally {
|
|
462
|
-
await
|
|
258
|
+
await written.cleanup();
|
|
463
259
|
}
|
|
464
260
|
}
|
|
261
|
+
async function createManagedCommandRendererContext(options) {
|
|
262
|
+
if (options.platform !== 'managed-commands')
|
|
263
|
+
throw new Error('Platform components require preparePlatformComponents and the v3 component protocol.');
|
|
264
|
+
if (!options.target.sourceManifest || !options.target.bundleRoot)
|
|
265
|
+
throw new Error('Cannot write a command context for an unresolved target.');
|
|
266
|
+
const manifest = options.target.sourceManifest;
|
|
267
|
+
const request = resolveArtifactRequest({ manifest, platform: 'managed-commands', scope: options.scope, requestedArtifactIds: options.requestedArtifactIds });
|
|
268
|
+
const resolved = await resolveArtifactRenderConfig({ ...options, manifest, platform: undefined, scope: options.configScope ?? options.scope, env: options.commandEnv });
|
|
269
|
+
const requestedKeys = request.declarations.flatMap((entry) => entry.refreshKeys);
|
|
270
|
+
const selected = selectPlatformRenderConfig({ resolved, keys: requestedKeys, nonSensitive: true });
|
|
271
|
+
if (requestedKeys.some((key) => !Object.hasOwn(selected.sources, key)))
|
|
272
|
+
throw new Error('managedCommandSensitiveConfigDenied: Command inputs must be non-sensitive.');
|
|
273
|
+
const keySet = new Set(Object.keys(selected.sources));
|
|
274
|
+
const renderConfig = { ...resolved, schema: selected.schema.fields,
|
|
275
|
+
values: selected.values, sources: selected.sources, issues: resolved.issues.filter((issue) => keySet.has(issue.key)) };
|
|
276
|
+
if (renderConfig.issues.length)
|
|
277
|
+
throw new Error('Invalid AW config for managed commands.');
|
|
278
|
+
const packageKeys = new Set(request.declarations.flatMap((entry) => entry.producer.kind === 'package' ? [entry.producer.packageKey] : []));
|
|
279
|
+
const commandSources = await Promise.all((manifest.managedCommands?.packages ?? []).filter((entry) => packageKeys.has(entry.key))
|
|
280
|
+
.map(async (entry) => ({ packageKey: entry.key, sourceDir: await resolveCommandSourceDirectory({ bundleRoot: options.target.bundleRoot, pluginRelativePath: entry.sourceDir }) })));
|
|
281
|
+
return { context: { event: options.event, surface: { kind: 'aw', name: 'managed-commands' }, scope: options.scope,
|
|
282
|
+
plugin: { name: manifest.name, version: manifest.version, rootDir: options.target.bundleRoot },
|
|
283
|
+
config: { mode: 'artifact-render', targetScope: resolved.targetScope, schema: renderConfig.schema,
|
|
284
|
+
values: renderConfig.values, sources: renderConfig.sources, issues: renderConfig.issues },
|
|
285
|
+
changedConfigKeys: (options.changedConfigKeys ?? []).filter((key) => keySet.has(key)),
|
|
286
|
+
requestedArtifactIds: request.requestedArtifactIds,
|
|
287
|
+
previousArtifacts: (options.previousArtifacts ?? []).filter((value) => isRecord(value)
|
|
288
|
+
&& request.requestedArtifactIds.includes(String(value.id)) && (value.kind === 'commandSet' || value.kind === 'commandPackage')),
|
|
289
|
+
commandSources, artifactSources: [], runtimeImports: [] }, renderConfig,
|
|
290
|
+
sensitiveValues: collectSensitivePluginConfigValues(manifest, resolved.values), cleanup: async () => undefined };
|
|
291
|
+
}
|
|
465
292
|
//# sourceMappingURL=artifact-renderer.js.map
|