@lesliechan721/aw 0.1.0-beta.73 → 0.1.0-beta.74
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 +119 -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 +28 -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 +529 -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 +59 -0
- package/dist/src/commands/rebuild-platform-integration.js +1200 -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 +60 -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 +338 -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 +74 -0
- package/dist/src/platforms/discovery.js +582 -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 +173 -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 +379 -0
- package/dist/src/platforms/inspection-native.js.map +1 -0
- package/dist/src/platforms/inspection-pi.d.ts +4 -0
- package/dist/src/platforms/inspection-pi.js +212 -0
- package/dist/src/platforms/inspection-pi.js.map +1 -0
- package/dist/src/platforms/inspection.d.ts +13 -0
- package/dist/src/platforms/inspection.js +189 -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 +9 -0
- package/dist/src/platforms/lifecycle-native.js +252 -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 +452 -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 +43 -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 +122 -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 +479 -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 +91 -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 +19 -0
- package/dist/src/utils/native-cli.js +45 -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/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
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
import { getStaticTOMLValue, parseTOML } from 'toml-eslint-parser';
|
|
5
|
+
import { resolvePlatformConfigRoot } from './discovery.js';
|
|
6
|
+
import { readPlatformPackageContentDigest } from '../utils/platform-empty-state.js';
|
|
7
|
+
function object(value) {
|
|
8
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
9
|
+
throw new Error('grokObservationInvalid');
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
function rows(value) {
|
|
13
|
+
if (!Array.isArray(value) || value.length > 4096)
|
|
14
|
+
throw new Error('grokObservationInvalid');
|
|
15
|
+
return value.map(object);
|
|
16
|
+
}
|
|
17
|
+
function within(root, file) {
|
|
18
|
+
if (typeof file !== 'string' || !path.isAbsolute(file))
|
|
19
|
+
return false;
|
|
20
|
+
const relative = path.relative(root, file);
|
|
21
|
+
return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
|
|
22
|
+
}
|
|
23
|
+
/** 1.0.77's list is an install inventory; inspect.enabled is not load evidence. */
|
|
24
|
+
export async function inspectGrokDeployment(ctx, binding, layout, result, listValue, inspectValue) {
|
|
25
|
+
const list = rows(listValue);
|
|
26
|
+
const inspect = object(inspectValue);
|
|
27
|
+
if (inspect.grokVersion !== '1.0.77')
|
|
28
|
+
throw new Error('grokObservationVersionUnverified');
|
|
29
|
+
const plugins = rows(inspect.plugins);
|
|
30
|
+
const name = layout.nativeIdentity.packageId;
|
|
31
|
+
const matches = list.filter((row) => row.name === name);
|
|
32
|
+
if (matches.length > 1)
|
|
33
|
+
throw new Error('nativeIdentityDuplicate');
|
|
34
|
+
const installed = matches[0];
|
|
35
|
+
if (installed && (installed.status !== 'installed' || typeof installed.repo_key !== 'string'
|
|
36
|
+
|| !/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/u.test(installed.repo_key)
|
|
37
|
+
|| typeof installed.version !== 'string' || typeof installed.path !== 'string' || !path.isAbsolute(installed.path)
|
|
38
|
+
|| typeof installed.source !== 'string' || !path.isAbsolute(installed.source)))
|
|
39
|
+
throw new Error('grokRegistrationInvalid');
|
|
40
|
+
result.registration = binding.route === 'grok-directory' ? 'not-applicable' : installed ? 'present' : 'absent';
|
|
41
|
+
const nativeRoot = binding.route === 'grok-directory' ? layout.packageRoot : installed?.path;
|
|
42
|
+
const entry = binding.consumers.find((consumer) => consumer.entry?.kind === 'cli')?.entry;
|
|
43
|
+
const hostRoot = entry?.kind === 'cli' ? entry.configRoot : await resolvePlatformConfigRoot('grok', ctx);
|
|
44
|
+
if (binding.route === 'grok-cli' && installed) {
|
|
45
|
+
const installedRoot = path.join(hostRoot, 'installed-plugins');
|
|
46
|
+
if (path.normalize(installed.path) !== path.join(installedRoot, installed.repo_key))
|
|
47
|
+
throw new Error('grokRegistrationPathUnconfirmed');
|
|
48
|
+
for (const directory of [hostRoot, installedRoot, installed.path]) {
|
|
49
|
+
const stat = await fs.lstat(directory).catch((error) => {
|
|
50
|
+
if (error.code === 'ENOENT')
|
|
51
|
+
return null;
|
|
52
|
+
throw error;
|
|
53
|
+
});
|
|
54
|
+
if (stat && (!stat.isDirectory() || stat.isSymbolicLink()))
|
|
55
|
+
throw new Error('grokRegistrationPathUnconfirmed');
|
|
56
|
+
}
|
|
57
|
+
result.nativeIdentity = { ...layout.nativeIdentity, registrationId: installed.repo_key, sourceLocation: installed.source };
|
|
58
|
+
if (path.normalize(installed.source) !== layout.packageRoot)
|
|
59
|
+
result.ownership = 'foreign';
|
|
60
|
+
else if (list.some((row) => row !== installed && (row.repo_key === installed.repo_key || row.path === installed.path || row.source === installed.source)))
|
|
61
|
+
result.ownership = 'shared';
|
|
62
|
+
else if (result.ownership === 'aw') {
|
|
63
|
+
const [sourceDigest, installedDigest] = await Promise.all([
|
|
64
|
+
readPlatformPackageContentDigest(layout.packageRoot), readPlatformPackageContentDigest(installed.path),
|
|
65
|
+
]);
|
|
66
|
+
result.nativePackageContentDigest = installedDigest;
|
|
67
|
+
const reason = !sourceDigest || !installedDigest ? 'nativePackageContentUnconfirmed'
|
|
68
|
+
: sourceDigest !== installedDigest ? 'nativePackageContentDrift' : null;
|
|
69
|
+
if (reason) {
|
|
70
|
+
result.components = result.components.map((component) => ({ ...component, presence: 'unknown', reasonCodes: [...component.reasonCodes, reason] }));
|
|
71
|
+
result.diagnostics.push({ code: reason, severity: 'warning',
|
|
72
|
+
message: 'The Grok installation does not confirm the current AW package bytes. Run sync to replace the native copy.',
|
|
73
|
+
subject: { target: 'grok', pluginId: binding.plugin.pluginId, scope: binding.scope.kind } });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const projectRoot = binding.scope.kind === 'project' ? binding.scope.projectRoot : ctx.cwd;
|
|
78
|
+
const allowedConfigs = new Set([path.join(hostRoot, 'config.toml'), path.join(projectRoot, '.grok', 'config.toml')]);
|
|
79
|
+
const evidence = [list, inspect];
|
|
80
|
+
const layers = rows(object(inspect.configSources).layers);
|
|
81
|
+
let configComplete = true;
|
|
82
|
+
const enabled = new Set();
|
|
83
|
+
const disabled = new Set();
|
|
84
|
+
for (const layer of layers) {
|
|
85
|
+
if (typeof layer.path !== 'string' || !allowedConfigs.has(layer.path)) {
|
|
86
|
+
configComplete = false;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
let text;
|
|
90
|
+
try {
|
|
91
|
+
const stat = await fs.stat(layer.path);
|
|
92
|
+
if (!stat.isFile() || stat.size > 1024 * 1024)
|
|
93
|
+
throw new Error('grokConfigLimit');
|
|
94
|
+
text = await fs.readFile(layer.path, 'utf8');
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
if (error.code === 'ENOENT') {
|
|
98
|
+
configComplete = false;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
evidence.push([layer.path, text]);
|
|
104
|
+
const config = object(getStaticTOMLValue(parseTOML(text)));
|
|
105
|
+
const section = config.plugins === undefined ? {} : object(config.plugins);
|
|
106
|
+
for (const [key, target] of [['enabled', enabled], ['disabled', disabled]]) {
|
|
107
|
+
const values = section[key] ?? [];
|
|
108
|
+
if (!Array.isArray(values) || !values.every((value) => typeof value === 'string'))
|
|
109
|
+
throw new Error('grokConfigInvalid');
|
|
110
|
+
for (const value of values)
|
|
111
|
+
target.add(value);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const effective = ['skills', 'agents', 'mcpServers'].flatMap((kind) => rows(inspect[kind]).map((row) => ({ kind, row, source: object(row.source) })));
|
|
115
|
+
const sources = [];
|
|
116
|
+
for (const plugin of plugins) {
|
|
117
|
+
if (typeof plugin.name !== 'string' || typeof plugin.path !== 'string' || !path.isAbsolute(plugin.path)
|
|
118
|
+
|| typeof plugin.scope !== 'string')
|
|
119
|
+
throw new Error('grokPluginIdentityInvalid');
|
|
120
|
+
const native = within(path.join(hostRoot, 'installed-plugins'), plugin.path) || within(path.join(hostRoot, 'plugins'), plugin.path)
|
|
121
|
+
|| within(path.join(projectRoot, '.grok', 'plugins'), plugin.path);
|
|
122
|
+
let origin = native ? 'native' : 'unknown';
|
|
123
|
+
const inventory = list.find((row) => row.name === plugin.name && row.path === plugin.path);
|
|
124
|
+
let version = typeof inventory?.version === 'string' ? inventory.version : typeof plugin.version === 'string' ? plugin.version : null;
|
|
125
|
+
// Public manifests provide version evidence for compatibility discoveries;
|
|
126
|
+
// this read never grants AW ownership or cleanup authority.
|
|
127
|
+
for (const descriptor of native ? ['.grok-plugin'] : ['.grok-plugin', '.claude-plugin']) {
|
|
128
|
+
if (version !== null && origin !== 'unknown')
|
|
129
|
+
break;
|
|
130
|
+
const manifest = path.join(plugin.path, descriptor, 'plugin.json');
|
|
131
|
+
try {
|
|
132
|
+
const stat = await fs.stat(manifest);
|
|
133
|
+
if (!stat.isFile() || stat.size > 1024 * 1024)
|
|
134
|
+
throw new Error('grokManifestLimit');
|
|
135
|
+
const text = await fs.readFile(manifest, 'utf8');
|
|
136
|
+
evidence.push([manifest, text]);
|
|
137
|
+
const parsed = object(JSON.parse(text));
|
|
138
|
+
if (parsed.name === plugin.name) {
|
|
139
|
+
origin = descriptor === '.grok-plugin' ? 'native' : 'compatibility';
|
|
140
|
+
if (typeof parsed.version === 'string')
|
|
141
|
+
version = parsed.version;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
if (!['ENOENT', 'ENOTDIR'].includes(error.code ?? ''))
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
sources.push({ name: plugin.name, version, path: plugin.path, scope: plugin.scope, origin,
|
|
151
|
+
enabled: typeof plugin.enabled === 'boolean' ? plugin.enabled : null,
|
|
152
|
+
effectiveComponents: effective.filter(({ source }) => source.plugin_name === plugin.name && within(plugin.path, source.path))
|
|
153
|
+
.map(({ kind, row }) => `${kind}:${String(row.name)}`).sort() });
|
|
154
|
+
}
|
|
155
|
+
const overlaps = [...new Set(sources.filter((source) => sources.some((other) => other !== source && other.name === source.name)).map((source) => source.name))].sort();
|
|
156
|
+
result.prerequisites.nativeSources = { observation: configComplete ? 'complete' : 'unknown', sources, overlaps,
|
|
157
|
+
configurationEvidence: `sha256:${crypto.createHash('sha256').update(JSON.stringify(evidence)).digest('hex')}` };
|
|
158
|
+
const own = sources.find((source) => source.name === name && source.path === nativeRoot);
|
|
159
|
+
const hasLoadedResources = !!own?.effectiveComponents.some((component) => component.startsWith('skills:') || component.startsWith('mcpServers:'));
|
|
160
|
+
for (const consumer of result.consumers) {
|
|
161
|
+
consumer.activation = !own ? 'disabled' : !configComplete ? 'unknown' : disabled.has(name) ? 'disabled' : enabled.has(name) ? 'enabled' : 'unknown';
|
|
162
|
+
consumer.trust = hasLoadedResources ? 'trusted' : binding.scope.kind === 'project' && inspect.projectTrusted === false ? 'required' : 'unknown';
|
|
163
|
+
consumer.load = hasLoadedResources ? 'observed' : 'not-observed';
|
|
164
|
+
}
|
|
165
|
+
if (overlaps.length)
|
|
166
|
+
result.diagnostics.push({ code: 'nativeCompatibilityOverlap', severity: 'warning',
|
|
167
|
+
message: 'Grok discovered overlapping plugin sources. Effective component sources are reported; compatibility files remain outside AW cleanup authority.', subject: { target: 'grok' } });
|
|
168
|
+
if (sources.some((source) => source.origin === 'compatibility' && source.name === name))
|
|
169
|
+
result.diagnostics.push({
|
|
170
|
+
code: 'nativeCompatibilitySourcePresent', severity: 'warning', message: 'A compatibility source with this plugin name is present. Its components are separate from the AW native package.', subject: { target: 'grok' }
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=inspection-grok.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspection-grok.js","sourceRoot":"","sources":["../../../src/platforms/inspection-grok.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO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AAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QACpJ,QAAQ,CAAC,KAAK,GAAG,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;QAChJ,QAAQ,CAAC,IAAI,GAAG,kBAAkB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC;IACnE,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM;QAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,4BAA4B,EAAE,QAAQ,EAAE,SAAS;YACpG,OAAO,EAAE,gJAAgJ,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5L,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,eAAe,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;QAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;YAC/G,IAAI,EAAE,kCAAkC,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,kHAAkH,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;SAAE,CAAC,CAAC;AAC/N,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DeploymentBinding, DeploymentObservation, ReadContext } from './contracts.js';
|
|
2
|
+
import type { DeploymentLayout } from './layout.js';
|
|
3
|
+
/** Only documented local-directory marketplace sources can establish ownership. */
|
|
4
|
+
export declare function inspectClaudeMarketplaceSource(ctx: ReadContext, binding: DeploymentBinding, name: string, root: string): Promise<'absent' | 'canonical' | 'foreign'>;
|
|
5
|
+
export declare function inspectCopilotMarketplaceSource(ctx: ReadContext, binding: DeploymentBinding, name: string, root: string): Promise<'absent' | 'canonical' | 'foreign' | 'unknown'>;
|
|
6
|
+
export declare function inspectNativeDeployment(ctx: ReadContext, binding: DeploymentBinding, layout: DeploymentLayout, result: DeploymentObservation): Promise<void>;
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import { isCanonicalCodexMarketplaceRegistration } from '../utils/codex-shared-native.js';
|
|
4
|
+
import { DEFAULT_AGENT_VERSION_PROBE_TIMEOUT_MS } from '../constants.js';
|
|
5
|
+
import { readCodexConfigFile } from '../utils/codex-config.js';
|
|
6
|
+
import { runNativeCli, runNativeCliChecked } from '../utils/native-cli.js';
|
|
7
|
+
import { createCodexNativeObservationSession } from '../utils/codex-native-observation.js';
|
|
8
|
+
import { getClaudeHome } from '../utils/state-paths.js';
|
|
9
|
+
import { inspectOwnedComponents, readSkillOwnerMarker } from '../utils/ownership.js';
|
|
10
|
+
import { readPlatformPackageContentDigest } from '../utils/platform-empty-state.js';
|
|
11
|
+
import { installationInvocation } from './discovery.js';
|
|
12
|
+
import { inspectPiDeployment } from './inspection-pi.js';
|
|
13
|
+
import { inspectGrokDeployment } from './inspection-grok.js';
|
|
14
|
+
import { getQualifiedPlatformProfile } from './capabilities.js';
|
|
15
|
+
import { getPhysicalKey } from './identity.js';
|
|
16
|
+
import { geminiActivationRules, geminiExtensionPaths, geminiPathEnabled, geminiScopePattern, geminiUserActivation, readGeminiActivationSnapshot, readGeminiNativeCopyContentDigest } from './gemini-activation.js';
|
|
17
|
+
function object(value) {
|
|
18
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
19
|
+
throw new Error('nativeObservationInvalid');
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
async function jsonFile(file) {
|
|
23
|
+
try {
|
|
24
|
+
return object(JSON.parse(await fs.readFile(file, 'utf8')));
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if (['ENOENT', 'ENOTDIR'].includes(error.code ?? ''))
|
|
28
|
+
return {};
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function setActivation(result, activation) {
|
|
33
|
+
for (const consumer of result.consumers)
|
|
34
|
+
consumer.activation = activation;
|
|
35
|
+
}
|
|
36
|
+
async function probe(ctx, binding, args) {
|
|
37
|
+
const product = binding.consumers.find((item) => item.entry?.kind === 'cli' && item.availability === 'available');
|
|
38
|
+
if (!product)
|
|
39
|
+
throw new Error('nativeEntryUnavailable');
|
|
40
|
+
const cwd = binding.scope.kind === 'project' ? binding.scope.projectRoot : ctx.cwd;
|
|
41
|
+
const invocation = await installationInvocation(product, { ...ctx, cwd }, args);
|
|
42
|
+
const output = await runNativeCliChecked({ ...invocation, timeoutMs: DEFAULT_AGENT_VERSION_PROBE_TIMEOUT_MS }, ctx.runner);
|
|
43
|
+
if (Buffer.byteLength(output.stdout) + Buffer.byteLength(output.stderr) > 1024 * 1024)
|
|
44
|
+
throw new Error('nativeObservationOutputLimit');
|
|
45
|
+
return output.stdout;
|
|
46
|
+
}
|
|
47
|
+
function nativeSourceMatches(source, expected) {
|
|
48
|
+
return typeof source === 'string' && path.isAbsolute(source) && path.normalize(source) === path.normalize(expected);
|
|
49
|
+
}
|
|
50
|
+
/** Antigravity lists a source type and a copied package path, not the AW source directory. */
|
|
51
|
+
async function inspectAntigravityCopy(binding, layout, result, rows) {
|
|
52
|
+
const matches = rows.filter((row) => row.name === layout.nativeIdentity.packageId);
|
|
53
|
+
if (matches.length > 1)
|
|
54
|
+
throw new Error('nativeIdentityDuplicate');
|
|
55
|
+
result.registration = matches.length ? 'present' : 'absent';
|
|
56
|
+
const row = matches[0];
|
|
57
|
+
if (!row) {
|
|
58
|
+
setActivation(result, 'disabled');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (typeof row.enabled !== 'boolean')
|
|
62
|
+
throw new Error('nativeActivationInvalid');
|
|
63
|
+
setActivation(result, row.enabled ? 'enabled' : 'disabled');
|
|
64
|
+
const root = layout.physicalIdentity.namespaceRoot;
|
|
65
|
+
const directory = path.join(root, 'plugins', layout.nativeIdentity.packageId);
|
|
66
|
+
if (row.source !== 'antigravity' || row.path !== directory) {
|
|
67
|
+
result.ownership = 'foreign';
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (rows.some((other) => other !== row && nativeSourceMatches(other.path, directory))) {
|
|
71
|
+
result.ownership = 'shared';
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const component = { kind: 'owned-directory', path: directory, allowedRoot: root,
|
|
75
|
+
identity: { owner: 'agent-workflows', plugin: layout.nativeIdentity.packageId,
|
|
76
|
+
sourceId: binding.plugin.sourceId, sourceIdentity: binding.plugin.sourceIdentity, pluginId: binding.plugin.pluginId,
|
|
77
|
+
platform: binding.platform, scope: binding.scope.kind, physicalKey: binding.physicalKey, artifactKey: path.basename(layout.packageRoot) } };
|
|
78
|
+
const inspected = (await inspectOwnedComponents({ components: [component] })).components[0];
|
|
79
|
+
if (inspected.state !== 'present') {
|
|
80
|
+
result.ownership = inspected.state === 'foreign' ? 'foreign' : 'unknown';
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const marker = await readSkillOwnerMarker({ skillRoot: directory, allowedRoot: root, expectedIdentity: component.identity });
|
|
84
|
+
const digest = await readPlatformPackageContentDigest(directory);
|
|
85
|
+
if (!marker?.nativeProjection || getPhysicalKey(marker.nativeProjection.physicalIdentity) !== binding.physicalKey
|
|
86
|
+
|| !digest || digest !== marker.nativeProjection.contentDigest) {
|
|
87
|
+
result.ownership = 'unknown';
|
|
88
|
+
result.diagnostics.push({ code: 'nativePackageContentUnconfirmed', severity: 'warning',
|
|
89
|
+
message: 'The Antigravity copy has unconfirmed content. Keep local data and check its ownership before retrying.',
|
|
90
|
+
subject: { target: binding.platform, pluginId: binding.plugin.pluginId, scope: binding.scope.kind } });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
// The copy's own exact owner remains usable for removal if the AW source is missing.
|
|
94
|
+
if (result.ownership === 'absent')
|
|
95
|
+
result.ownership = 'aw';
|
|
96
|
+
if (result.ownership !== 'aw')
|
|
97
|
+
return;
|
|
98
|
+
result.nativePackageContentDigest = digest;
|
|
99
|
+
const sourceDigest = await readPlatformPackageContentDigest(layout.packageRoot);
|
|
100
|
+
const reason = !sourceDigest ? 'nativePackageContentUnconfirmed' : sourceDigest !== digest ? 'nativePackageContentDrift' : null;
|
|
101
|
+
if (reason) {
|
|
102
|
+
result.components = result.components.map((component) => ({ ...component, presence: 'unknown', reasonCodes: [...component.reasonCodes, reason] }));
|
|
103
|
+
result.diagnostics.push({ code: reason, severity: 'warning',
|
|
104
|
+
message: 'The Antigravity copy does not confirm the current AW package bytes. Run sync to refresh the native copy.',
|
|
105
|
+
subject: { target: binding.platform, pluginId: binding.plugin.pluginId, scope: binding.scope.kind } });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** Only documented local-directory marketplace sources can establish ownership. */
|
|
109
|
+
export async function inspectClaudeMarketplaceSource(ctx, binding, name, root) {
|
|
110
|
+
const home = getClaudeHome(ctx.env);
|
|
111
|
+
const known = await jsonFile(path.join(home, 'plugins', 'known_marketplaces.json'));
|
|
112
|
+
const user = await jsonFile(path.join(home, 'settings.json'));
|
|
113
|
+
const project = binding.scope.kind === 'project' ? await jsonFile(path.join(binding.scope.projectRoot, '.claude', 'settings.local.json')) : {};
|
|
114
|
+
const sources = [];
|
|
115
|
+
const knownEntry = known[name];
|
|
116
|
+
if (knownEntry !== undefined) {
|
|
117
|
+
const entry = object(knownEntry);
|
|
118
|
+
if (entry.installLocation !== undefined)
|
|
119
|
+
sources.push(entry.installLocation);
|
|
120
|
+
if (entry.source !== undefined)
|
|
121
|
+
sources.push(entry.source);
|
|
122
|
+
}
|
|
123
|
+
for (const settings of [user, project]) {
|
|
124
|
+
if (settings.extraKnownMarketplaces === undefined)
|
|
125
|
+
continue;
|
|
126
|
+
const entry = object(settings.extraKnownMarketplaces)[name];
|
|
127
|
+
if (entry !== undefined)
|
|
128
|
+
sources.push(object(entry).source);
|
|
129
|
+
}
|
|
130
|
+
if (!sources.length)
|
|
131
|
+
return 'absent';
|
|
132
|
+
const location = (source) => {
|
|
133
|
+
if (typeof source === 'string')
|
|
134
|
+
return source;
|
|
135
|
+
const descriptor = object(source);
|
|
136
|
+
return descriptor.source === 'directory' ? descriptor.path : null;
|
|
137
|
+
};
|
|
138
|
+
return sources.every((source) => nativeSourceMatches(location(source), root)) ? 'canonical' : 'foreign';
|
|
139
|
+
}
|
|
140
|
+
export async function inspectCopilotMarketplaceSource(ctx, binding, name, root) {
|
|
141
|
+
const value = JSON.parse(await probe(ctx, binding, ['plugin', 'marketplace', 'list', '--json']));
|
|
142
|
+
if (!Array.isArray(value))
|
|
143
|
+
return 'unknown';
|
|
144
|
+
const rows = value.map(object);
|
|
145
|
+
if (rows.some((row) => typeof row.name !== 'string'))
|
|
146
|
+
return 'unknown';
|
|
147
|
+
const matching = rows.filter((row) => row.name === name);
|
|
148
|
+
if (!matching.length)
|
|
149
|
+
return 'absent';
|
|
150
|
+
if (matching.length !== 1)
|
|
151
|
+
return 'unknown';
|
|
152
|
+
const source = matching[0].source;
|
|
153
|
+
if (typeof source === 'string') {
|
|
154
|
+
// Copilot 1.0.95 renders directory sources with this display prefix.
|
|
155
|
+
const location = source.startsWith('Local: ') ? source.slice('Local: '.length) : source;
|
|
156
|
+
return nativeSourceMatches(location, root) ? 'canonical' : 'foreign';
|
|
157
|
+
}
|
|
158
|
+
if (!source || typeof source !== 'object' || Array.isArray(source))
|
|
159
|
+
return 'unknown';
|
|
160
|
+
const descriptor = source;
|
|
161
|
+
if (descriptor.source !== 'directory')
|
|
162
|
+
return typeof descriptor.source === 'string' ? 'foreign' : 'unknown';
|
|
163
|
+
return nativeSourceMatches(descriptor.path, root) ? 'canonical' : 'foreign';
|
|
164
|
+
}
|
|
165
|
+
export async function inspectNativeDeployment(ctx, binding, layout, result) {
|
|
166
|
+
const nativeId = layout.nativeIdentity.registrationId ?? layout.nativeIdentity.packageId;
|
|
167
|
+
switch (binding.route) {
|
|
168
|
+
case 'codex-marketplace': {
|
|
169
|
+
const product = binding.consumers.find((item) => item.entry?.kind === 'cli' && item.availability === 'available');
|
|
170
|
+
if (!product || product.entry?.kind !== 'cli') {
|
|
171
|
+
const config = await readCodexConfigFile(path.join(layout.activationPath, 'config.toml'));
|
|
172
|
+
const host = await readCodexConfigFile(path.join(layout.physicalIdentity.namespaceRoot, 'config.toml'));
|
|
173
|
+
for (const snapshot of [host.snapshot, config.snapshot]) {
|
|
174
|
+
const marketplace = snapshot.marketplaces[layout.marketplaceName];
|
|
175
|
+
if (marketplace && !isCanonicalCodexMarketplaceRegistration(marketplace, layout.marketplaceRoot))
|
|
176
|
+
result.ownership = 'foreign';
|
|
177
|
+
}
|
|
178
|
+
const activation = config.snapshot.plugins[nativeId];
|
|
179
|
+
result.registration = 'unknown';
|
|
180
|
+
setActivation(result, activation?.enabled === true ? 'enabled'
|
|
181
|
+
: activation?.enabled === false || binding.scope.kind === 'project' ? 'disabled' : 'unknown');
|
|
182
|
+
result.diagnostics.push({ code: 'nativeEntryUnavailable', severity: 'warning',
|
|
183
|
+
message: 'The native client is unavailable. Only the exact local activation can be observed; the shared registration is retained.',
|
|
184
|
+
subject: { target: binding.platform, pluginId: binding.plugin.pluginId, scope: binding.scope.kind } });
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
const invocation = await installationInvocation(product, ctx, []);
|
|
188
|
+
const manager = { kind: product.product === 'app' ? 'app' : 'system',
|
|
189
|
+
version: product.version ?? 'unknown', command: invocation.command, argsPrefix: invocation.args };
|
|
190
|
+
const session = ctx.codexObservationSession ?? await createCodexNativeObservationSession({ exactCwd: binding.scope.kind === 'project' ? binding.scope.projectRoot : ctx.cwd,
|
|
191
|
+
env: ctx.env ?? process.env, manager,
|
|
192
|
+
runner: async (request) => {
|
|
193
|
+
const response = await runNativeCli({ ...request, signal: ctx.signal, timeoutMs: DEFAULT_AGENT_VERSION_PROBE_TIMEOUT_MS }, ctx.runner);
|
|
194
|
+
if (Buffer.byteLength(response.stdout) + Buffer.byteLength(response.stderr) > 1024 * 1024)
|
|
195
|
+
throw new Error('nativeObservationOutputLimit');
|
|
196
|
+
return response;
|
|
197
|
+
} });
|
|
198
|
+
try {
|
|
199
|
+
// inspectPlugin binds both list invocations synchronously before yielding.
|
|
200
|
+
// A concurrent product can invalidate the cache, not change these reads.
|
|
201
|
+
session.setManager(manager);
|
|
202
|
+
const observed = await session.inspectPlugin({ pluginId: nativeId, scope: binding.scope.kind });
|
|
203
|
+
if (ctx.observeNative && binding.scope.kind === 'project' && product.product === 'cli'
|
|
204
|
+
&& product.version === '0.167.0' && getQualifiedPlatformProfile('codex', ctx).qualifiedConsumers?.skill?.some((qualified) => qualified.product === product.product && qualified.version === product.version)) {
|
|
205
|
+
session.setManager(manager);
|
|
206
|
+
const trust = await session.inspectProjectTrust(binding.scope.projectRoot);
|
|
207
|
+
for (const consumer of result.consumers)
|
|
208
|
+
if (consumer.productId === product.id && consumer.trust === 'unknown'
|
|
209
|
+
&& trust.state === 'observed')
|
|
210
|
+
consumer.trust = trust.trust === 'trusted' ? 'trusted' : 'blocked';
|
|
211
|
+
if (trust.state === 'failed')
|
|
212
|
+
result.diagnostics.push({ code: 'nativeObservationFailed', severity: 'warning',
|
|
213
|
+
message: 'The native client could not complete its effective project trust observation.',
|
|
214
|
+
subject: { target: binding.platform, pluginId: binding.plugin.pluginId, scope: binding.scope.kind } });
|
|
215
|
+
}
|
|
216
|
+
if (observed.observation.state !== 'observed') {
|
|
217
|
+
result.registration = 'unknown';
|
|
218
|
+
setActivation(result, 'unknown');
|
|
219
|
+
result.diagnostics.push({ code: observed.observation.state === 'failed' ? 'nativeObservationFailed' : 'nativeObservationUnconfirmed',
|
|
220
|
+
severity: 'warning', message: 'The selected native client could not confirm its registration.',
|
|
221
|
+
subject: { target: binding.platform, pluginId: binding.plugin.pluginId, scope: binding.scope.kind } });
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
result.registration = observed.observation.value === 'installed' ? 'present' : 'absent';
|
|
225
|
+
if (binding.scope.kind === 'project') {
|
|
226
|
+
const project = await readCodexConfigFile(path.join(binding.scope.projectRoot, '.codex', 'config.toml'));
|
|
227
|
+
const explicit = project.snapshot.plugins[nativeId];
|
|
228
|
+
// The exact native list includes inherited User activation. Only an
|
|
229
|
+
// explicit, effective project entry establishes a separate reference.
|
|
230
|
+
setActivation(result, !explicit || explicit.enabled === false || result.registration === 'absent' ? 'disabled'
|
|
231
|
+
: explicit.enabled === true && observed.activations.project === true ? 'enabled' : 'unknown');
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
const active = observed.activations.user;
|
|
235
|
+
setActivation(result, active === true ? 'enabled' : active === false || result.registration === 'absent' ? 'disabled' : 'unknown');
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
finally {
|
|
239
|
+
if (!ctx.codexObservationSession)
|
|
240
|
+
await session.dispose();
|
|
241
|
+
}
|
|
242
|
+
const config = await readCodexConfigFile(path.join(product.entry.configRoot, 'config.toml'));
|
|
243
|
+
const marketplace = config.snapshot.marketplaces[layout.marketplaceName];
|
|
244
|
+
// A cached installed plugin cannot replace the missing source registration.
|
|
245
|
+
if (!marketplace)
|
|
246
|
+
result.registration = 'absent';
|
|
247
|
+
else if (!isCanonicalCodexMarketplaceRegistration(marketplace, layout.marketplaceRoot))
|
|
248
|
+
result.ownership = 'foreign';
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
case 'claude-marketplace': {
|
|
252
|
+
const home = getClaudeHome(ctx.env);
|
|
253
|
+
if (await inspectClaudeMarketplaceSource(ctx, binding, layout.marketplaceName, layout.marketplaceRoot) === 'foreign')
|
|
254
|
+
result.ownership = 'foreign';
|
|
255
|
+
const installed = await jsonFile(path.join(home, 'plugins', 'installed_plugins.json'));
|
|
256
|
+
const plugins = installed.plugins === undefined ? {} : object(installed.plugins);
|
|
257
|
+
// Bare entries cannot be associated with or removed through a marketplace.
|
|
258
|
+
if (plugins[layout.nativeIdentity.packageId] !== undefined)
|
|
259
|
+
result.ownership = 'foreign';
|
|
260
|
+
const raw = plugins[nativeId];
|
|
261
|
+
const records = raw === undefined ? [] : Array.isArray(raw) ? raw.map(object) : [object(raw)];
|
|
262
|
+
const scope = binding.scope.kind === 'project' ? 'local' : 'user';
|
|
263
|
+
const matching = records.filter((record) => record.scope === scope && (scope === 'user'
|
|
264
|
+
|| nativeSourceMatches(record.projectPath, binding.scope.kind === 'project' ? binding.scope.projectRoot : '')));
|
|
265
|
+
result.registration = matching.length ? 'present' : 'absent';
|
|
266
|
+
const settingsPath = binding.scope.kind === 'project' ? path.join(binding.scope.projectRoot, '.claude', 'settings.local.json') : path.join(home, 'settings.json');
|
|
267
|
+
const settings = await jsonFile(settingsPath);
|
|
268
|
+
const enabled = settings.enabledPlugins === undefined ? undefined : object(settings.enabledPlugins)[nativeId];
|
|
269
|
+
if (enabled !== undefined && typeof enabled !== 'boolean' && !Array.isArray(enabled))
|
|
270
|
+
throw new Error('nativeActivationInvalid');
|
|
271
|
+
setActivation(result, enabled === true || Array.isArray(enabled) ? 'enabled' : enabled === false ? 'disabled' : 'unknown');
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
case 'antigravity-cli': {
|
|
275
|
+
const value = JSON.parse(await probe(ctx, binding, ['plugin', 'list', '--json']));
|
|
276
|
+
if (!Array.isArray(value) || value.length > 4096)
|
|
277
|
+
throw new Error('nativeObservationInvalid');
|
|
278
|
+
await inspectAntigravityCopy(binding, layout, result, value.map(object));
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
case 'copilot-marketplace': {
|
|
282
|
+
// These inventories are independent. Finish both reads before returning,
|
|
283
|
+
// including when one fails, so no native read outlives this inspection.
|
|
284
|
+
const [marketplaceRead, pluginsRead] = await Promise.allSettled([
|
|
285
|
+
inspectCopilotMarketplaceSource(ctx, binding, layout.marketplaceName, layout.marketplaceRoot),
|
|
286
|
+
probe(ctx, binding, ['plugin', 'list', '--json']),
|
|
287
|
+
]);
|
|
288
|
+
if (marketplaceRead.status === 'rejected')
|
|
289
|
+
throw marketplaceRead.reason;
|
|
290
|
+
const marketplace = marketplaceRead.value;
|
|
291
|
+
if (marketplace === 'foreign')
|
|
292
|
+
result.ownership = 'foreign';
|
|
293
|
+
if (marketplace === 'unknown')
|
|
294
|
+
result.ownership = 'unknown';
|
|
295
|
+
if (pluginsRead.status === 'rejected')
|
|
296
|
+
throw pluginsRead.reason;
|
|
297
|
+
const value = JSON.parse(pluginsRead.value);
|
|
298
|
+
if (!Array.isArray(value))
|
|
299
|
+
throw new Error('nativeObservationInvalid');
|
|
300
|
+
const matches = value.map(object).filter((row) => row.name === layout.nativeIdentity.packageId && row.marketplace === layout.marketplaceName);
|
|
301
|
+
if (matches.length > 1)
|
|
302
|
+
throw new Error('nativeIdentityDuplicate');
|
|
303
|
+
result.registration = matches.length ? 'present' : 'absent';
|
|
304
|
+
const row = matches[0];
|
|
305
|
+
if (row && marketplace !== 'canonical' && !nativeSourceMatches(row.source, layout.marketplaceRoot) && !nativeSourceMatches(row.installedFrom, layout.marketplaceRoot)) {
|
|
306
|
+
// Unrecognized source shapes remain unknown and cannot authorize mutation.
|
|
307
|
+
result.ownership = 'unknown';
|
|
308
|
+
}
|
|
309
|
+
const settings = await jsonFile(path.join(layout.activationPath, binding.scope.kind === 'project' ? 'settings.local.json' : 'settings.json'));
|
|
310
|
+
const enabled = settings.enabledPlugins === undefined ? undefined : object(settings.enabledPlugins)[nativeId];
|
|
311
|
+
setActivation(result, typeof enabled === 'boolean' ? enabled ? 'enabled' : 'disabled' : row?.enabled === false ? 'disabled' : 'unknown');
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
case 'pi-package':
|
|
315
|
+
await inspectPiDeployment(ctx, binding, layout, result);
|
|
316
|
+
break;
|
|
317
|
+
case 'gemini-extension': {
|
|
318
|
+
// Gemini stores exact local-source metadata separately from its human list.
|
|
319
|
+
// Discovery confirms the client. The unused list output adds no evidence
|
|
320
|
+
// to these metadata and activation reads, and does not prove host loading.
|
|
321
|
+
ctx.signal?.throwIfAborted();
|
|
322
|
+
if (!binding.consumers.some((item) => item.entry?.kind === 'cli' && item.availability === 'available')) {
|
|
323
|
+
throw new Error('nativeEntryUnavailable');
|
|
324
|
+
}
|
|
325
|
+
const { home, root } = geminiExtensionPaths(ctx);
|
|
326
|
+
const directory = path.join(root, layout.nativeIdentity.packageId);
|
|
327
|
+
try {
|
|
328
|
+
const stats = await fs.lstat(directory);
|
|
329
|
+
if (stats.isSymbolicLink() || !stats.isDirectory())
|
|
330
|
+
throw new Error('nativeExtensionPathUnconfirmed');
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
if (['ENOENT', 'ENOTDIR'].includes(error.code ?? '')) {
|
|
334
|
+
result.registration = 'absent';
|
|
335
|
+
setActivation(result, 'disabled');
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
throw error;
|
|
339
|
+
}
|
|
340
|
+
const metadata = await jsonFile(path.join(directory, '.gemini-extension-install.json'));
|
|
341
|
+
const manifest = await jsonFile(path.join(directory, 'gemini-extension.json'));
|
|
342
|
+
if (typeof metadata.source !== 'string' || typeof metadata.type !== 'string' || typeof manifest.name !== 'string') {
|
|
343
|
+
throw new Error('nativeExtensionIdentityUnknown');
|
|
344
|
+
}
|
|
345
|
+
result.registration = 'present';
|
|
346
|
+
if (!['local', 'link'].includes(metadata.type) || !nativeSourceMatches(metadata.source, layout.packageRoot)
|
|
347
|
+
|| manifest.name !== layout.nativeIdentity.packageId)
|
|
348
|
+
result.ownership = 'foreign';
|
|
349
|
+
if (result.ownership === 'aw') {
|
|
350
|
+
result.nativePackageContentDigest = await readGeminiNativeCopyContentDigest(ctx, layout.nativeIdentity, {
|
|
351
|
+
owner: 'agent-workflows', plugin: layout.nativeIdentity.packageId, pluginId: binding.plugin.pluginId,
|
|
352
|
+
sourceId: binding.plugin.sourceId, sourceIdentity: binding.plugin.sourceIdentity,
|
|
353
|
+
platform: binding.platform, scope: 'user', physicalKey: binding.physicalKey, artifactKey: path.basename(layout.packageRoot),
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
const snapshot = await readGeminiActivationSnapshot(ctx);
|
|
357
|
+
const rules = geminiActivationRules(snapshot, manifest.name);
|
|
358
|
+
const userActivation = geminiUserActivation(snapshot, manifest.name, home);
|
|
359
|
+
if (binding.scope.kind === 'project') {
|
|
360
|
+
const target = geminiScopePattern(binding.scope.projectRoot);
|
|
361
|
+
const explicit = rules.filter((rule) => rule === target || rule === `!${target}`).at(-1);
|
|
362
|
+
// Inherited global activation is not an independent project reference.
|
|
363
|
+
setActivation(result, explicit === target && geminiPathEnabled(rules, binding.scope.projectRoot) ? 'enabled' : 'disabled');
|
|
364
|
+
}
|
|
365
|
+
else
|
|
366
|
+
setActivation(result, userActivation === 'unknown' ? 'unknown' : userActivation ? 'enabled' : 'disabled');
|
|
367
|
+
if (userActivation === 'unknown')
|
|
368
|
+
result.diagnostics.push({ code: 'nativeActivationScopeLimited', severity: 'warning',
|
|
369
|
+
message: 'The extension rules do not confirm a global user activation. Check the native configuration before changing its scope.', subject: { target: binding.platform } });
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
case 'grok-cli':
|
|
373
|
+
case 'grok-directory':
|
|
374
|
+
await inspectGrokDeployment(ctx, binding, layout, result, JSON.parse(await probe(ctx, binding, ['plugin', 'list', '--json'])), JSON.parse(await probe(ctx, binding, ['inspect', '--json'])));
|
|
375
|
+
break;
|
|
376
|
+
default: break;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
//# sourceMappingURL=inspection-native.js.map
|