@lesliechan721/aw 0.1.0-beta.84 → 0.1.0-beta.86
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/command-runtime-config.d.mts +9 -0
- package/dist/authoring/assets/command-runtime-config.mjs +106 -0
- package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
- package/dist/authoring/scripts/validate-plugin.mjs +17 -22
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/scripts/aw-skill-eval-materializer.d.ts +4 -0
- package/dist/scripts/aw-skill-eval-materializer.js +27 -0
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/scripts/bundle-plugins.js +1 -1
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/test-plugin-scripts.js +13 -2
- 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/catalog-source.d.ts +2 -1
- package/dist/src/commands/catalog-source.js +8 -7
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/deployment-confirmation.d.ts +8 -1
- package/dist/src/commands/deployment-confirmation.js +79 -11
- package/dist/src/commands/deployment-confirmation.js.map +1 -1
- package/dist/src/commands/lifecycle-command-package.d.ts +44 -0
- package/dist/src/commands/lifecycle-command-package.js +195 -0
- package/dist/src/commands/lifecycle-command-package.js.map +1 -0
- package/dist/src/commands/managed-commands.d.ts +6 -0
- package/dist/src/commands/managed-commands.js +203 -152
- package/dist/src/commands/managed-commands.js.map +1 -1
- package/dist/src/commands/operation-plan.d.ts +22 -21
- package/dist/src/commands/operation-plan.js +2 -5
- package/dist/src/commands/operation-plan.js.map +1 -1
- package/dist/src/commands/permission-batch.d.ts +5 -0
- package/dist/src/commands/permission-batch.js +80 -0
- package/dist/src/commands/permission-batch.js.map +1 -0
- package/dist/src/commands/plugin-capabilities.js +17 -13
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-config-confirmation.d.ts +8 -2
- package/dist/src/commands/public-config-confirmation.js +22 -5
- package/dist/src/commands/public-config-confirmation.js.map +1 -1
- package/dist/src/commands/public-lifecycle-result.d.ts +7 -12
- package/dist/src/commands/public-lifecycle-result.js +136 -40
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/commands/public-lifecycle.js +49 -8
- package/dist/src/commands/public-lifecycle.js.map +1 -1
- package/dist/src/commands/public-plugin-query.js +21 -5
- package/dist/src/commands/public-plugin-query.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +4 -0
- package/dist/src/commands/rebuild-command.js +150 -48
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +12 -3
- package/dist/src/commands/rebuild-integration.js +52 -164
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +2 -1
- package/dist/src/commands/rebuild-operations.js +7 -2
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +12 -5
- package/dist/src/commands/rebuild-platform-integration.js +691 -186
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
- package/dist/src/commands/skill-eval.js +10 -1
- package/dist/src/commands/skill-eval.js.map +1 -1
- package/dist/src/generators/local-plugin.js +14 -15
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/generators/permissions.d.ts +18 -4
- package/dist/src/generators/permissions.js +76 -22
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +84 -44
- package/dist/src/index.js.map +1 -1
- package/dist/src/intent/scope-context.d.ts +4 -2
- package/dist/src/intent/scope-context.js +37 -7
- package/dist/src/intent/scope-context.js.map +1 -1
- package/dist/src/output/command-receipt.js +7 -8
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/component-delivery.d.ts +28 -0
- package/dist/src/output/component-delivery.js +138 -0
- package/dist/src/output/component-delivery.js.map +1 -0
- package/dist/src/output/public-result.d.ts +17 -0
- package/dist/src/output/public-result.js +121 -25
- package/dist/src/output/public-result.js.map +1 -1
- package/dist/src/output/rebuild-progress.js +7 -4
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/output/receipt-projection.js +51 -31
- package/dist/src/output/receipt-projection.js.map +1 -1
- package/dist/src/output/skill-invocation-notices.d.ts +2 -0
- package/dist/src/output/skill-invocation-notices.js +40 -4
- package/dist/src/output/skill-invocation-notices.js.map +1 -1
- package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
- package/dist/src/platforms/antigravity-permissions.js +388 -0
- package/dist/src/platforms/antigravity-permissions.js.map +1 -0
- package/dist/src/platforms/capabilities.d.ts +4 -1
- package/dist/src/platforms/capabilities.js +93 -9
- package/dist/src/platforms/capabilities.js.map +1 -1
- package/dist/src/platforms/contracts.d.ts +46 -2
- package/dist/src/platforms/discovery.d.ts +13 -0
- package/dist/src/platforms/discovery.js +170 -30
- package/dist/src/platforms/discovery.js.map +1 -1
- package/dist/src/platforms/grok-permission-config.d.ts +22 -0
- package/dist/src/platforms/grok-permission-config.js +184 -0
- package/dist/src/platforms/grok-permission-config.js.map +1 -0
- package/dist/src/platforms/grok-permission-document.d.ts +4 -0
- package/dist/src/platforms/grok-permission-document.js +145 -0
- package/dist/src/platforms/grok-permission-document.js.map +1 -0
- package/dist/src/platforms/grok-permissions.d.ts +17 -0
- package/dist/src/platforms/grok-permissions.js +311 -0
- package/dist/src/platforms/grok-permissions.js.map +1 -0
- package/dist/src/platforms/host-permission-policy.d.ts +38 -0
- package/dist/src/platforms/host-permission-policy.js +86 -0
- package/dist/src/platforms/host-permission-policy.js.map +1 -0
- package/dist/src/platforms/inspection-grok.js +165 -11
- package/dist/src/platforms/inspection-grok.js.map +1 -1
- package/dist/src/platforms/inspection-native.js +53 -18
- package/dist/src/platforms/inspection-native.js.map +1 -1
- package/dist/src/platforms/inspection-pi.d.ts +7 -1
- package/dist/src/platforms/inspection-pi.js +295 -95
- package/dist/src/platforms/inspection-pi.js.map +1 -1
- package/dist/src/platforms/inspection-query.d.ts +4 -2
- package/dist/src/platforms/inspection-query.js +24 -8
- package/dist/src/platforms/inspection-query.js.map +1 -1
- package/dist/src/platforms/inspection.d.ts +4 -1
- package/dist/src/platforms/inspection.js +36 -4
- package/dist/src/platforms/inspection.js.map +1 -1
- package/dist/src/platforms/layout.d.ts +13 -0
- package/dist/src/platforms/layout.js +90 -12
- package/dist/src/platforms/layout.js.map +1 -1
- package/dist/src/platforms/lifecycle-native.d.ts +1 -0
- package/dist/src/platforms/lifecycle-native.js +25 -1
- package/dist/src/platforms/lifecycle-native.js.map +1 -1
- package/dist/src/platforms/lifecycle.d.ts +2 -0
- package/dist/src/platforms/lifecycle.js +98 -25
- package/dist/src/platforms/lifecycle.js.map +1 -1
- package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
- package/dist/src/platforms/opencode-permission-config.js +253 -0
- package/dist/src/platforms/opencode-permission-config.js.map +1 -0
- package/dist/src/platforms/opencode-permissions.d.ts +39 -0
- package/dist/src/platforms/opencode-permissions.js +212 -0
- package/dist/src/platforms/opencode-permissions.js.map +1 -0
- package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
- package/dist/src/platforms/opencode-related-permissions.js +177 -0
- package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
- package/dist/src/platforms/permission-ownership.d.ts +89 -0
- package/dist/src/platforms/permission-ownership.js +543 -0
- package/dist/src/platforms/permission-ownership.js.map +1 -0
- package/dist/src/platforms/permission-sidecar.d.ts +70 -0
- package/dist/src/platforms/permission-sidecar.js +215 -0
- package/dist/src/platforms/permission-sidecar.js.map +1 -0
- package/dist/src/platforms/projection-code-extension.js +2 -1
- package/dist/src/platforms/projection-code-extension.js.map +1 -1
- package/dist/src/platforms/projection.js +127 -29
- package/dist/src/platforms/projection.js.map +1 -1
- package/dist/src/platforms/supplement-layout.d.ts +5 -1
- package/dist/src/platforms/supplement-layout.js +23 -1
- package/dist/src/platforms/supplement-layout.js.map +1 -1
- package/dist/src/platforms/supplement-state.d.ts +1 -1
- package/dist/src/platforms/supplement-state.js +18 -7
- package/dist/src/platforms/supplement-state.js.map +1 -1
- package/dist/src/portable/commands.js +1 -1
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +4 -0
- package/dist/src/portable/materializer.js +8 -1
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery.d.ts +2 -0
- package/dist/src/portable/recovery.js +45 -8
- package/dist/src/portable/recovery.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +3 -1
- package/dist/src/recovery/coordinator.js +101 -37
- package/dist/src/recovery/coordinator.js.map +1 -1
- package/dist/src/recovery/install-concurrency.js +3 -2
- package/dist/src/recovery/install-concurrency.js.map +1 -1
- package/dist/src/recovery/joint-coordinator.d.ts +7 -0
- package/dist/src/recovery/joint-coordinator.js +270 -64
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/joint-demand.d.ts +14 -2
- package/dist/src/recovery/joint-demand.js +54 -7
- package/dist/src/recovery/joint-demand.js.map +1 -1
- package/dist/src/recovery/joint-install-execution.js +2 -1
- package/dist/src/recovery/joint-install-execution.js.map +1 -1
- package/dist/src/recovery/receipt.d.ts +15 -4
- package/dist/src/recovery/receipt.js +23 -0
- package/dist/src/recovery/receipt.js.map +1 -1
- package/dist/src/recovery/retirement.js +11 -17
- package/dist/src/recovery/retirement.js.map +1 -1
- package/dist/src/recovery/status.d.ts +20 -8
- package/dist/src/recovery/status.js +411 -91
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/review/eval-source-input.d.ts +1 -0
- package/dist/src/review/eval-source-input.js +7 -1
- package/dist/src/review/eval-source-input.js.map +1 -1
- package/dist/src/review/platform-profile.js +2 -1
- package/dist/src/review/platform-profile.js.map +1 -1
- package/dist/src/review/review-selection.js +12 -5
- package/dist/src/review/review-selection.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +2 -1
- package/dist/src/review/skill-materialization.js +45 -43
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/review/source-binding.js +5 -1
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +101 -57
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +72 -7
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +6 -2
- package/dist/src/tui/controller.js +17 -4
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/deployment-view.d.ts +6 -3
- package/dist/src/tui/deployment-view.js +52 -10
- package/dist/src/tui/deployment-view.js.map +1 -1
- package/dist/src/tui/diagnostic-projection.d.ts +7 -1
- package/dist/src/tui/diagnostic-projection.js +55 -5
- package/dist/src/tui/diagnostic-projection.js.map +1 -1
- package/dist/src/tui/entity-cards.d.ts +2 -1
- package/dist/src/tui/entity-cards.js +34 -11
- package/dist/src/tui/entity-cards.js.map +1 -1
- package/dist/src/tui/glossary.js +5 -0
- package/dist/src/tui/glossary.js.map +1 -1
- package/dist/src/tui/model.js +2 -1
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.js +3 -1
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
- package/dist/src/tui/operation-history.d.ts +6 -0
- package/dist/src/tui/operation-history.js +20 -2
- package/dist/src/tui/operation-history.js.map +1 -1
- package/dist/src/tui/operation-review-planner.js +130 -70
- package/dist/src/tui/operation-review-planner.js.map +1 -1
- package/dist/src/tui/plugin-detail.d.ts +4 -1
- package/dist/src/tui/plugin-detail.js +9 -2
- package/dist/src/tui/plugin-detail.js.map +1 -1
- package/dist/src/tui/scoped-flow.js +34 -16
- package/dist/src/tui/scoped-flow.js.map +1 -1
- package/dist/src/tui/scoped-inventory.d.ts +6 -2
- package/dist/src/tui/scoped-inventory.js +29 -7
- package/dist/src/tui/scoped-inventory.js.map +1 -1
- package/dist/src/types.d.ts +10 -21
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +3 -36
- package/dist/src/utils/artifact-plan.js +16 -78
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +1 -60
- package/dist/src/utils/artifact-renderer.js +31 -57
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +3 -26
- package/dist/src/utils/artifact-request.js +13 -36
- package/dist/src/utils/artifact-request.js.map +1 -1
- package/dist/src/utils/artifact-sources.d.ts +0 -8
- package/dist/src/utils/artifact-sources.js +0 -8
- package/dist/src/utils/artifact-sources.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +2 -7
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-source-references.js +22 -3
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/codex-native-observation.d.ts +6 -0
- package/dist/src/utils/codex-native-observation.js +32 -3
- package/dist/src/utils/codex-native-observation.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +8 -11
- package/dist/src/utils/component-command-preparation.js +110 -210
- package/dist/src/utils/component-command-preparation.js.map +1 -1
- package/dist/src/utils/component-gap.d.ts +4 -0
- package/dist/src/utils/component-gap.js +20 -0
- package/dist/src/utils/component-gap.js.map +1 -0
- package/dist/src/utils/component-resources.js +2 -4
- package/dist/src/utils/component-resources.js.map +1 -1
- package/dist/src/utils/dynamic-skill-tree.js +2 -32
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/managed-command-cli-review.d.ts +43 -0
- package/dist/src/utils/managed-command-cli-review.js +389 -0
- package/dist/src/utils/managed-command-cli-review.js.map +1 -0
- package/dist/src/utils/managed-command-closure.d.ts +14 -3
- package/dist/src/utils/managed-command-closure.js +144 -23
- package/dist/src/utils/managed-command-closure.js.map +1 -1
- package/dist/src/utils/managed-command-errors.d.ts +5 -0
- package/dist/src/utils/managed-command-errors.js +10 -0
- package/dist/src/utils/managed-command-errors.js.map +1 -0
- package/dist/src/utils/managed-command-materialization.d.ts +77 -113
- package/dist/src/utils/managed-command-materialization.js +324 -323
- package/dist/src/utils/managed-command-materialization.js.map +1 -1
- package/dist/src/utils/managed-command-preparation.d.ts +28 -65
- package/dist/src/utils/managed-command-preparation.js +33 -140
- package/dist/src/utils/managed-command-preparation.js.map +1 -1
- package/dist/src/utils/managed-command-review.d.ts +11 -4
- package/dist/src/utils/managed-command-review.js +33 -21
- package/dist/src/utils/managed-command-review.js.map +1 -1
- package/dist/src/utils/managed-command-runtime.d.ts +1 -0
- package/dist/src/utils/managed-command-runtime.js +6 -3
- package/dist/src/utils/managed-command-runtime.js.map +1 -1
- package/dist/src/utils/managed-command-snapshots.d.ts +17 -0
- package/dist/src/utils/managed-command-snapshots.js +84 -0
- package/dist/src/utils/managed-command-snapshots.js.map +1 -0
- package/dist/src/utils/managed-command-store.d.ts +65 -78
- package/dist/src/utils/managed-command-store.js +446 -383
- package/dist/src/utils/managed-command-store.js.map +1 -1
- package/dist/src/utils/multi-source-catalog.d.ts +2 -0
- package/dist/src/utils/multi-source-catalog.js +3 -1
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli-interruption.d.ts +8 -0
- package/dist/src/utils/native-cli-interruption.js +65 -0
- package/dist/src/utils/native-cli-interruption.js.map +1 -0
- package/dist/src/utils/native-cli.d.ts +5 -0
- package/dist/src/utils/native-cli.js +166 -53
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/native-tool-context.d.ts +6 -3
- package/dist/src/utils/native-tool-context.js +3 -1
- package/dist/src/utils/native-tool-context.js.map +1 -1
- package/dist/src/utils/native-tool-review.d.ts +2 -12
- package/dist/src/utils/native-tool-review.js +6 -108
- package/dist/src/utils/native-tool-review.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +8 -0
- package/dist/src/utils/ownership.js +17 -3
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/package-content.d.ts +7 -0
- package/dist/src/utils/package-content.js +70 -0
- package/dist/src/utils/package-content.js.map +1 -0
- package/dist/src/utils/platform-empty-state.d.ts +32 -6
- package/dist/src/utils/platform-empty-state.js +146 -75
- package/dist/src/utils/platform-empty-state.js.map +1 -1
- package/dist/src/utils/plugin-config-command-apply.d.ts +33 -0
- package/dist/src/utils/plugin-config-command-apply.js +134 -0
- package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
- package/dist/src/utils/plugin-config-impact.d.ts +19 -9
- package/dist/src/utils/plugin-config-impact.js +56 -37
- package/dist/src/utils/plugin-config-impact.js.map +1 -1
- package/dist/src/utils/plugin-config-write.d.ts +19 -19
- package/dist/src/utils/plugin-config-write.js +196 -770
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-scripts.js +19 -8
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/process-tree.d.ts +1 -1
- package/dist/src/utils/process-tree.js +1 -1
- package/dist/src/utils/process-tree.js.map +1 -1
- package/dist/src/utils/rendered-contract.js +12 -6
- package/dist/src/utils/rendered-contract.js.map +1 -1
- package/dist/src/utils/skill-invocation-warning.d.ts +8 -3
- package/dist/src/utils/skill-invocation-warning.js +27 -1
- package/dist/src/utils/skill-invocation-warning.js.map +1 -1
- package/package.json +4 -3
- package/dist/src/platforms/managed-command-placement.d.ts +0 -8
- package/dist/src/platforms/managed-command-placement.js +0 -79
- package/dist/src/platforms/managed-command-placement.js.map +0 -1
- package/dist/src/utils/managed-command-evidence.d.ts +0 -7
- package/dist/src/utils/managed-command-evidence.js +0 -10
- package/dist/src/utils/managed-command-evidence.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Read selected applied values from the immutable revision containing this module. */
|
|
2
|
+
export function readCommandRuntimeConfig(options?: {}): Promise<{
|
|
3
|
+
values: {
|
|
4
|
+
[k: string]: any;
|
|
5
|
+
};
|
|
6
|
+
platform: any;
|
|
7
|
+
installedIdentity: any;
|
|
8
|
+
resourceRoot: string;
|
|
9
|
+
} | undefined>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
const platforms = ['codex', 'claude', 'antigravity', 'cursor', 'opencode', 'pi', 'copilot', 'grok'];
|
|
5
|
+
const sha256 = /^sha256:[a-f0-9]{64}$/u;
|
|
6
|
+
const record = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
7
|
+
const uniqueKeys = (keys) => Array.isArray(keys) && keys.length > 0
|
|
8
|
+
&& keys.every((key) => typeof key === 'string' && key.length > 0) && new Set(keys).size === keys.length;
|
|
9
|
+
function validConfigValue(value) {
|
|
10
|
+
if (typeof value === 'string' || typeof value === 'boolean' || Number.isFinite(value))
|
|
11
|
+
return true;
|
|
12
|
+
if (Array.isArray(value))
|
|
13
|
+
return value.every(validConfigValue);
|
|
14
|
+
return record(value) && Object.entries(value).every(([key, child]) => !['__proto__', 'constructor', 'prototype'].includes(key) && validConfigValue(child));
|
|
15
|
+
}
|
|
16
|
+
function fail(code = 'commandRuntimeConfigInvalid') {
|
|
17
|
+
const error = new Error(`${code}. Refresh the command package with aw plugin sync or aw command package sync.`);
|
|
18
|
+
error.code = code;
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
async function regularFile(file) {
|
|
22
|
+
const root = path.parse(file).root;
|
|
23
|
+
const parts = file.slice(root.length).split(path.sep === '\\' ? /[\\/]/u : path.sep);
|
|
24
|
+
let current = root;
|
|
25
|
+
for (const [index, part] of parts.entries()) {
|
|
26
|
+
if (!part || part === '.' || part === '..')
|
|
27
|
+
fail();
|
|
28
|
+
current = path.join(current, part);
|
|
29
|
+
const stat = await fs.lstat(current);
|
|
30
|
+
if (index === parts.length - 1 ? !stat.isFile() : !stat.isDirectory())
|
|
31
|
+
fail();
|
|
32
|
+
}
|
|
33
|
+
return current;
|
|
34
|
+
}
|
|
35
|
+
async function readRecord(file) {
|
|
36
|
+
const value = JSON.parse(await fs.readFile(await regularFile(file), 'utf8'));
|
|
37
|
+
if (!record(value))
|
|
38
|
+
fail();
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
function sameProducer(left, right) {
|
|
42
|
+
return record(right) && Object.keys(right).length === 3 && left.sourceId === right.sourceId
|
|
43
|
+
&& left.pluginName === right.pluginName && left.sourceIdentity === right.sourceIdentity;
|
|
44
|
+
}
|
|
45
|
+
/** Read selected applied values from the immutable revision containing this module. */
|
|
46
|
+
export async function readCommandRuntimeConfig(options = {}) {
|
|
47
|
+
try {
|
|
48
|
+
const { from, platform, keys } = options;
|
|
49
|
+
if (!platforms.includes(platform))
|
|
50
|
+
fail();
|
|
51
|
+
if (!uniqueKeys(keys))
|
|
52
|
+
fail('commandRuntimeConfigKeyDenied');
|
|
53
|
+
const reader = await regularFile(fileURLToPath(import.meta.url));
|
|
54
|
+
const revisionRoot = path.dirname(path.dirname(reader));
|
|
55
|
+
const revisions = path.dirname(revisionRoot);
|
|
56
|
+
const packageRoot = path.dirname(revisions);
|
|
57
|
+
if (path.basename(revisions) !== 'revisions'
|
|
58
|
+
|| !/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u.test(path.basename(revisionRoot))
|
|
59
|
+
|| !/^pkg_[0-9a-f]{64}$/u.test(path.basename(packageRoot)))
|
|
60
|
+
fail();
|
|
61
|
+
const caller = typeof from === 'string' && path.isAbsolute(from) ? from : fileURLToPath(from);
|
|
62
|
+
const relative = path.relative(revisionRoot, await regularFile(caller));
|
|
63
|
+
if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
|
|
64
|
+
fail();
|
|
65
|
+
const owner = await readRecord(path.join(packageRoot, 'owner.json'));
|
|
66
|
+
const receipt = await readRecord(path.join(revisionRoot, '.aw-command-producer.json'));
|
|
67
|
+
const producer = owner.producer;
|
|
68
|
+
if (owner.schemaVersion !== 2 || owner.owner !== 'agent-workflows' || owner.kind !== 'plugin-command-package'
|
|
69
|
+
|| !record(producer) || Object.keys(producer).length !== 3
|
|
70
|
+
|| typeof producer.sourceId !== 'string' || !/^[a-z][a-z0-9-]{0,31}$/u.test(producer.sourceId)
|
|
71
|
+
|| typeof producer.pluginName !== 'string' || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(producer.pluginName)
|
|
72
|
+
|| !sha256.test(producer.sourceIdentity ?? '') || receipt.schemaVersion !== 2
|
|
73
|
+
|| !sameProducer(producer, receipt.producer) || typeof receipt.pluginVersion !== 'string' || !receipt.pluginVersion
|
|
74
|
+
|| !sha256.test(receipt.sourceContentDigest ?? '') || !Array.isArray(receipt.runtimeConfigPlatforms)
|
|
75
|
+
|| receipt.runtimeConfigPlatforms.some((name) => !platforms.includes(name))
|
|
76
|
+
|| new Set(receipt.runtimeConfigPlatforms).size !== receipt.runtimeConfigPlatforms.length
|
|
77
|
+
|| !uniqueKeys(receipt.runtimeConfigKeys))
|
|
78
|
+
fail();
|
|
79
|
+
if (!receipt.runtimeConfigPlatforms.includes(platform))
|
|
80
|
+
fail('commandRuntimeConfigMissing');
|
|
81
|
+
if (keys.some((key) => !receipt.runtimeConfigKeys.includes(key)))
|
|
82
|
+
fail('commandRuntimeConfigKeyDenied');
|
|
83
|
+
const snapshot = await readRecord(path.join(revisionRoot, '.aw', 'runtime-config', `${platform}.json`));
|
|
84
|
+
if (Object.keys(snapshot).length !== 8 || snapshot.schemaVersion !== 1 || snapshot.kind !== 'aw-command-runtime-config' || snapshot.platform !== platform
|
|
85
|
+
|| !sameProducer(producer, snapshot.producer) || snapshot.pluginVersion !== receipt.pluginVersion
|
|
86
|
+
|| snapshot.sourceContentDigest !== receipt.sourceContentDigest || !uniqueKeys(snapshot.allowedKeys)
|
|
87
|
+
|| snapshot.allowedKeys.length !== receipt.runtimeConfigKeys.length
|
|
88
|
+
|| snapshot.allowedKeys.some((key, index) => key !== receipt.runtimeConfigKeys[index])
|
|
89
|
+
|| !record(snapshot.effectiveValues) || Object.entries(snapshot.effectiveValues).some(([key, value]) => !snapshot.allowedKeys.includes(key) || !validConfigValue(value)))
|
|
90
|
+
fail();
|
|
91
|
+
return {
|
|
92
|
+
values: Object.fromEntries(keys.filter((key) => Object.hasOwn(snapshot.effectiveValues, key))
|
|
93
|
+
.map((key) => [key, snapshot.effectiveValues[key]])),
|
|
94
|
+
platform,
|
|
95
|
+
installedIdentity: { ...producer, pluginId: `${producer.sourceId}/${producer.pluginName}`, platform,
|
|
96
|
+
pluginVersion: receipt.pluginVersion, sourceContentDigest: receipt.sourceContentDigest },
|
|
97
|
+
resourceRoot: revisionRoot,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (error?.code?.startsWith('commandRuntimeConfig'))
|
|
102
|
+
throw error;
|
|
103
|
+
fail(error?.code === 'ENOENT' ? 'commandRuntimeConfigMissing' : 'commandRuntimeConfigInvalid');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=command-runtime-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-runtime-config.mjs","sourceRoot":"","sources":["../../../authoring/assets/command-runtime-config.mjs"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AACpG,MAAM,MAAM,GAAG,wBAAwB,CAAC;AACxC,MAA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C;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,sBAAsB,CAAC;YAAE,MAAM,KAAK,CAAC;QACjE,IAAI,CAAC,KAAK,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC;IACjG,CAAC;AACH,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { createRequire } from 'node:module';
|
|
|
6
6
|
import * as os from 'node:os';
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
9
|
-
import { assertPluginConfigReferenceSchemas, AW_RUNTIME_CONFIG_READER_PATH, createNativeToolReaderSource, getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, normalizePluginConfigDefinition, compilePluginConfigDefinition, renderTemplate, resolveSupportedPlatforms, PLATFORM_TARGETS, isPortablePlatformTarget, isAuthorOnlySkillDirectory,
|
|
9
|
+
import { assertPluginConfigReferenceSchemas, AW_RUNTIME_CONFIG_READER_PATH, createNativeToolReaderSource, getCommandPackageInjectedReaders, isInjectedCommandReaderImport, getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, normalizePluginConfigDefinition, compilePluginConfigDefinition, renderTemplate, resolveSupportedPlatforms, PLATFORM_TARGETS, isPortablePlatformTarget, isAuthorOnlySkillDirectory, SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION, } from '@lesliechan721/aw-plugin-core/manifest';
|
|
10
10
|
import { readCatalogWorkspace } from '@lesliechan721/aw-plugin-core';
|
|
11
11
|
import { checkPluginVersions } from './lib/plugin-version-check.mjs';
|
|
12
12
|
import { scanJavaScriptImportSpecifiers } from './lib/javascript-import-scanner.mjs';
|
|
@@ -209,7 +209,6 @@ async function tryLoadCliManifestTools() {
|
|
|
209
209
|
materializeProfilePluginComponents: materializationModule.materializeProfilePluginComponents,
|
|
210
210
|
createIsolatedSkillEnv: materializationModule.createIsolatedSkillEnv,
|
|
211
211
|
prepareManagedCommandPackage: commandModule.prepareManagedCommandPackage,
|
|
212
|
-
managedCommandProducerIdentity: commandModule.managedCommandProducerIdentity,
|
|
213
212
|
validateRuntimeSkillClosure: (await import(pathToFileURL(path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'runtime-skill-closure.js')).href)).validateRuntimeSkillClosure,
|
|
214
213
|
};
|
|
215
214
|
}
|
|
@@ -1053,6 +1052,8 @@ function scanNodeImportContract(pluginDir, entryPaths, options) {
|
|
|
1053
1052
|
const requested = path.posix.normalize(path.posix.join(path.posix.dirname(relativePath), specifier));
|
|
1054
1053
|
if (options.nativeToolReader && requested === options.nativeToolReader)
|
|
1055
1054
|
continue;
|
|
1055
|
+
if (isInjectedCommandReaderImport(options.injectedCommandReaders, relativePath, requested))
|
|
1056
|
+
continue;
|
|
1056
1057
|
if ((options.runtimeConfigSkillRoots ?? []).some((root) => (relativePath.startsWith(`${root}/`)
|
|
1057
1058
|
&& requested === path.posix.join(root, AW_RUNTIME_CONFIG_READER_PATH))))
|
|
1058
1059
|
continue;
|
|
@@ -1391,13 +1392,12 @@ async function prepareSourceComponentFixture(root, pluginDir, manifest, runtimeI
|
|
|
1391
1392
|
}
|
|
1392
1393
|
async function validateAuthorComponentFixtures(pluginDir, sourceManifest, runtimeImports, tools, referenceContext, referencePlugins, skillValidationTools, validationOptions) {
|
|
1393
1394
|
const builtBundle = validationOptions.builtBundle;
|
|
1394
|
-
if (!builtBundle && !sourceManifest.skills && !sourceManifest.artifacts
|
|
1395
|
-
&& !(sourceManifest.managedCommands?.sets?.length || sourceManifest.managedCommands?.packages?.length))
|
|
1395
|
+
if (!builtBundle && !sourceManifest.skills && !sourceManifest.artifacts && !sourceManifest.command)
|
|
1396
1396
|
return;
|
|
1397
1397
|
if (runtimeImports === null)
|
|
1398
1398
|
return;
|
|
1399
1399
|
const tempRoot = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'aw-author-components-'));
|
|
1400
|
-
|
|
1400
|
+
let commandPackage;
|
|
1401
1401
|
try {
|
|
1402
1402
|
const root = path.join(tempRoot, 'plugin');
|
|
1403
1403
|
if (builtBundle) {
|
|
@@ -1419,6 +1419,10 @@ async function validateAuthorComponentFixtures(pluginDir, sourceManifest, runtim
|
|
|
1419
1419
|
sourceIdentity: `sha256:${createHash('sha256').update(fs.realpathSync(pluginDir)).digest('hex')}` };
|
|
1420
1420
|
const plugins = [plugin, ...(referencePlugins ?? runtimeImports?.referencePlugins ?? []).filter((entry) => entry.manifest.name !== manifest.name)];
|
|
1421
1421
|
const env = await tools.createIsolatedSkillEnv(process.env, path.join(tempRoot, 'state'));
|
|
1422
|
+
if (manifest.command) {
|
|
1423
|
+
commandPackage = await tools.prepareManagedCommandPackage({ plugin, referencePlugins: plugins,
|
|
1424
|
+
operation: { kind: 'materialize' }, cwd: pluginDir, env });
|
|
1425
|
+
}
|
|
1422
1426
|
for (const platform of resolveSupportedPlatforms(manifest)) {
|
|
1423
1427
|
for (const scope of ['user', 'project']) {
|
|
1424
1428
|
const definition = compilePluginConfigDefinition(manifest.config ?? { fields: {} }, platform);
|
|
@@ -1431,7 +1435,8 @@ async function validateAuthorComponentFixtures(pluginDir, sourceManifest, runtim
|
|
|
1431
1435
|
issues: [], stores: {}, referenceContext: references };
|
|
1432
1436
|
try {
|
|
1433
1437
|
const prepared = await tools.materializeProfilePluginComponents({ plugin, plugins, platform, scope,
|
|
1434
|
-
cwd: pluginDir, env, outputRoot: path.join(tempRoot, `${platform}-${scope}`), config,
|
|
1438
|
+
cwd: pluginDir, env, outputRoot: path.join(tempRoot, `${platform}-${scope}`), config,
|
|
1439
|
+
commandRecord: manifest.command?.platforms.includes(platform) ? commandPackage?.record : null });
|
|
1435
1440
|
if (prepared.skills.length && !skillValidationTools)
|
|
1436
1441
|
throw new Error('Prepared Skills require the shared CLI Skill validator.');
|
|
1437
1442
|
for (const skill of prepared.skills) {
|
|
@@ -1465,27 +1470,16 @@ async function validateAuthorComponentFixtures(pluginDir, sourceManifest, runtim
|
|
|
1465
1470
|
}
|
|
1466
1471
|
}
|
|
1467
1472
|
}
|
|
1468
|
-
for (const declaration of manifest.managedCommands?.packages ?? []) {
|
|
1469
|
-
const identity = await tools.managedCommandProducerIdentity({ plugin,
|
|
1470
|
-
producer: { kind: 'package', packageKey: declaration.key }, scope: declaration.scope, cwd: pluginDir });
|
|
1471
|
-
const key = getCommandPackageId(identity);
|
|
1472
|
-
if (!packagePreparationCache.has(key)) {
|
|
1473
|
-
packagePreparationCache.set(key, tools.prepareManagedCommandPackage({ plugin, referencePlugins: plugins,
|
|
1474
|
-
packageKey: declaration.key, scope: declaration.scope, cwd: pluginDir, env, event: 'materialize' }));
|
|
1475
|
-
}
|
|
1476
|
-
await packagePreparationCache.get(key);
|
|
1477
|
-
}
|
|
1478
1473
|
}
|
|
1479
1474
|
catch (cause) {
|
|
1480
1475
|
error(`author component preparation: ${cause.message}`);
|
|
1481
1476
|
}
|
|
1482
1477
|
finally {
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
error(`author component cleanup: ${entry.reason.message}`);
|
|
1478
|
+
try {
|
|
1479
|
+
await commandPackage?.cleanup();
|
|
1480
|
+
}
|
|
1481
|
+
catch (cause) {
|
|
1482
|
+
error(`author component cleanup: ${cause.message}`);
|
|
1489
1483
|
}
|
|
1490
1484
|
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
1491
1485
|
}
|
|
@@ -1603,6 +1597,7 @@ function validateScriptsLightweight(pluginDir, manifest) {
|
|
|
1603
1597
|
allowDevDependencies: true,
|
|
1604
1598
|
runtimeConfigSkillRoots,
|
|
1605
1599
|
nativeToolReader,
|
|
1600
|
+
injectedCommandReaders: getCommandPackageInjectedReaders(manifest),
|
|
1606
1601
|
});
|
|
1607
1602
|
}
|
|
1608
1603
|
}
|