@lesliechan721/aw 0.1.0-beta.85 → 0.1.0-beta.87
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/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 +4 -4
- package/dist/src/commands/public-lifecycle-result.js +55 -14
- 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/rebuild-command.d.ts +4 -0
- package/dist/src/commands/rebuild-command.js +160 -101
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +17 -6
- package/dist/src/commands/rebuild-integration.js +76 -183
- 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 +2 -0
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +5 -3
- package/dist/src/commands/rebuild-platform-integration.js +166 -135
- 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 +14 -6
- package/dist/src/generators/permissions.js +59 -61
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.js +77 -40
- package/dist/src/index.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 +7 -0
- package/dist/src/output/component-delivery.js +59 -3
- package/dist/src/output/component-delivery.js.map +1 -1
- package/dist/src/output/public-result.d.ts +15 -0
- package/dist/src/output/public-result.js +75 -12
- 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 +39 -27
- package/dist/src/output/receipt-projection.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/contracts.d.ts +10 -1
- package/dist/src/platforms/discovery.d.ts +2 -0
- 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 +47 -5
- package/dist/src/platforms/inspection-grok.js.map +1 -1
- package/dist/src/platforms/layout.d.ts +8 -0
- package/dist/src/platforms/layout.js +53 -8
- package/dist/src/platforms/layout.js.map +1 -1
- package/dist/src/platforms/lifecycle.js +39 -17
- 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.js +58 -8
- package/dist/src/platforms/projection.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +2 -0
- package/dist/src/recovery/coordinator.js +24 -27
- package/dist/src/recovery/coordinator.js.map +1 -1
- package/dist/src/recovery/joint-coordinator.js +103 -47
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/joint-demand.js +1 -1
- 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/retirement.js +11 -17
- package/dist/src/recovery/retirement.js.map +1 -1
- package/dist/src/recovery/status.js +32 -2
- 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/review-selection.js +12 -5
- package/dist/src/review/review-selection.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +1 -1
- package/dist/src/review/skill-materialization.js +3 -7
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +37 -30
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +71 -6
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +4 -1
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/deployment-view.d.ts +1 -1
- package/dist/src/tui/deployment-view.js +16 -3
- package/dist/src/tui/deployment-view.js.map +1 -1
- package/dist/src/tui/diagnostic-projection.js +11 -6
- package/dist/src/tui/diagnostic-projection.js.map +1 -1
- package/dist/src/tui/entity-cards.js +1 -1
- package/dist/src/tui/entity-cards.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/types.d.ts +8 -20
- 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 +11 -77
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +0 -59
- package/dist/src/utils/artifact-renderer.js +2 -49
- 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 +10 -0
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +6 -11
- package/dist/src/utils/component-command-preparation.js +109 -228
- package/dist/src/utils/component-command-preparation.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-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 +7 -0
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +2 -1
- package/dist/src/utils/platform-empty-state.js +13 -12
- 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 +194 -772
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/rendered-contract.js +12 -6
- package/dist/src/utils/rendered-contract.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
|
@@ -4,12 +4,14 @@ import { mapInstallReads, runInstallTasks } from '../recovery/install-concurrenc
|
|
|
4
4
|
import { withNativeObservationBatch } from '../platforms/inspection-query.js';
|
|
5
5
|
import { RebuildInterruptedError, recoveryInterruptionCode } from '../recovery/interruption.js';
|
|
6
6
|
import { inventoryRecoveryDiagnostic } from '../utils/inventory-recovery-diagnostic.js';
|
|
7
|
-
import { withNativeToolRemovalImpact } from '../utils/native-tool-review.js';
|
|
8
7
|
import fs from 'fs-extra';
|
|
9
8
|
import { NATIVE_PLATFORM_TARGETS } from '@lesliechan721/aw-plugin-core/manifest';
|
|
10
9
|
import { nativeInstallResources } from './rebuild-platform-integration.js';
|
|
10
|
+
import { isPermissionHost } from '../platforms/host-permission-policy.js';
|
|
11
|
+
import { missingPermissionOwnershipWarning, pendingRelatedProjectNotices, relatedProjectPermissionNotices, reviewPermissionRemovals, updateHostPermissions } from '../platforms/permission-ownership.js';
|
|
12
|
+
import { permissionConflict, permissionFailureNotice } from '../platforms/permission-sidecar.js';
|
|
11
13
|
import { resolvePlatformConfigRoot } from '../platforms/discovery.js';
|
|
12
|
-
import { getDeploymentLayout } from '../platforms/layout.js';
|
|
14
|
+
import { getDeploymentLayout, scopedPermissionPath } from '../platforms/layout.js';
|
|
13
15
|
import { createNoopDebugLogger } from '../output/debug-log.js';
|
|
14
16
|
import { createNoopReporter } from '../output/reporter.js';
|
|
15
17
|
import { getCodexOperationRequirement, probeAgentVersion } from '../utils/agent-version.js';
|
|
@@ -27,11 +29,11 @@ import { createCodexNativeObservationSession } from '../utils/codex-native-obser
|
|
|
27
29
|
import { isCanonicalCodexMarketplaceRegistration } from '../utils/codex-shared-native.js';
|
|
28
30
|
import { analyzeCodexSurface } from '../utils/codex-surface-analysis.js';
|
|
29
31
|
import { getNamespacedMarketplaceName, } from '../utils/local-marketplace.js';
|
|
30
|
-
import { discoverRetainedManagedCommandPackages, retainedManagedCommandPackageResult } from '
|
|
32
|
+
import { commandPackageProviderSatisfied, discoverRetainedManagedCommandPackages, retainedManagedCommandPackageResult } from './lifecycle-command-package.js';
|
|
31
33
|
import { assertStrictSemVer, checkAwCapabilitySupport, readPluginManifest } from '../utils/manifest.js';
|
|
32
34
|
import { formatPluginId, parsePluginId, planPluginSelectorSourceIds, preflightDesiredArtifactCollisions, withResolvedMultiSourceCatalog, } from '../utils/multi-source-catalog.js';
|
|
33
35
|
import { getDefaultNativeCliRunner, } from '../utils/native-cli.js';
|
|
34
|
-
import { inspectOwnedComponents, parseOwnedTextHeader, readSkillOwnerMarker, SKILL_OWNER_MARKER, } from '../utils/ownership.js';
|
|
36
|
+
import { inspectOwnedComponents, parseOwnedTextHeader, parseSharedOwnerToken, readSkillOwnerMarker, SKILL_OWNER_MARKER, } from '../utils/ownership.js';
|
|
35
37
|
import { resolveAwHome, resolveCliPackageRoot, resolveCodexPaths } from '../utils/paths.js';
|
|
36
38
|
import { supportsPlatform } from '../utils/platform-support.js';
|
|
37
39
|
import { pluginConfigTargetRenderScopes } from '../utils/plugin-config-impact.js';
|
|
@@ -44,7 +46,7 @@ import { createDependencyPlacementPlan, } from './dependency-operation-plan.js';
|
|
|
44
46
|
import { forceOfflineCleanupEvidence, intentOnlyOfflineCleanupEvidence, offlineCleanupEvidenceFromInventory, offlineCleanupEvidenceMatches, } from './offline-cleanup-evidence.js';
|
|
45
47
|
import { assertOperationPlanFingerprint, createOperationPlan, createOperationPlanConfigDigest, operationPlanNativeToolChanges, } from './operation-plan.js';
|
|
46
48
|
import { deploymentConfirmationEffects } from './deployment-confirmation.js';
|
|
47
|
-
import { assertNoClaudeUnboundNativeNameCollision, CodexActivationPostcheckError, createRebuildIntegration, disposePreparedPlatformRebuildSession, executeCodexReconcileActivations,
|
|
49
|
+
import { assertNoClaudeUnboundNativeNameCollision, CodexActivationPostcheckError, createRebuildIntegration, disposePreparedPlatformRebuildSession, executeCodexReconcileActivations, inspectNativeMarketplaceRegistration, isNativeActivationOnlyTarget, postcheckCodexReconcileActivations, removeForceCleanupCodexRoleRegistration } from './rebuild-integration.js';
|
|
48
50
|
import { executeRebuildOperation, hasPlannedPreApply, prepareRebuildOperation } from './rebuild-operations.js';
|
|
49
51
|
import { createReconcileOperationPlan, } from './reconcile-operation-plan.js';
|
|
50
52
|
// A read scope belongs to one Review or its independent locked recheck.
|
|
@@ -334,10 +336,14 @@ async function resolveRequestedNames(options) {
|
|
|
334
336
|
}
|
|
335
337
|
async function runSingleSourceRebuildCommand(options) {
|
|
336
338
|
const runtime = {
|
|
339
|
+
invocationCwd: options.runtime?.invocationCwd,
|
|
337
340
|
referencePlugins: options.runtime?.referencePlugins,
|
|
338
341
|
recoveryCandidates: options.runtime?.recoveryCandidates,
|
|
339
342
|
sharedReferenceView: options.runtime?.executionInput?.requirements.sharedReferenceView ?? options.runtime?.sharedReferenceView,
|
|
340
343
|
platformRebuildSession: options.runtime?.platformRebuildSession,
|
|
344
|
+
commandPackagePlatforms: options.runtime?.commandPackagePlatforms,
|
|
345
|
+
retainCommandPackages: options.runtime?.retainCommandPackages,
|
|
346
|
+
configApply: options.runtime?.configApply ?? !!options.runtime?.configApplyPackages,
|
|
341
347
|
packagePreparationCache: options.runtime?.packagePreparationCache,
|
|
342
348
|
preparedArtifactRenderResults: options.runtime?.preparedArtifactRenderResults,
|
|
343
349
|
interruption: options.runtime?.interruption,
|
|
@@ -611,6 +617,7 @@ function mergeRebuildCommandResults(results) {
|
|
|
611
617
|
}
|
|
612
618
|
function hasRebuildMutation(result) {
|
|
613
619
|
return result.removed.length > 0 || result.quarantined.length > 0
|
|
620
|
+
|| result.cleanupMutation !== undefined
|
|
614
621
|
|| (result.deploymentReceipts ?? []).some((receipt) => receipt.effects.some((effect) => effect.mutation === 'confirmed' || effect.status === 'unknown' && effect.mutation === 'possible'))
|
|
615
622
|
|| result.actions.some((action) => action.status === 'succeeded'
|
|
616
623
|
&& (action.name === 'native.write' || action.name === 'artifacts.write'));
|
|
@@ -665,7 +672,6 @@ function createRebuildOperationPlan(options) {
|
|
|
665
672
|
];
|
|
666
673
|
return createOperationPlan({
|
|
667
674
|
deploymentExclusions: options.deploymentExclusions,
|
|
668
|
-
nativeToolChanges: options.nativeToolChanges,
|
|
669
675
|
...(options.deploymentPlans ? { deploymentPlans: options.deploymentPlans } : {}),
|
|
670
676
|
intentChanges: [],
|
|
671
677
|
actions,
|
|
@@ -858,6 +864,7 @@ function cleanupLocatorPaths(component) {
|
|
|
858
864
|
const locator = component.locator;
|
|
859
865
|
switch (locator.kind) {
|
|
860
866
|
case 'cursor-workspace-hook': return [locator.hooksPath];
|
|
867
|
+
case 'host-permissions':
|
|
861
868
|
case 'claude-permissions': return [locator.settingsPath];
|
|
862
869
|
case 'codex-instruction': return [locator.configPath];
|
|
863
870
|
case 'codex-activation': return [locator.configPath];
|
|
@@ -1021,14 +1028,43 @@ async function prepareOfflineNativeCleanup(options) {
|
|
|
1021
1028
|
}
|
|
1022
1029
|
}
|
|
1023
1030
|
await integration.sealMarketplaceGenerations([...targets.values()]);
|
|
1024
|
-
|
|
1031
|
+
const locators = options.evidence.flatMap((target) => target.plan.actions.flatMap(({ action, component }) => action === 'removeOwnedOutput' && component?.kind === 'shared-config' && component.locator.kind === 'host-permissions'
|
|
1032
|
+
? [component.locator] : []));
|
|
1033
|
+
const invocationCwd = options.runtime?.invocationCwd ?? options.cwd;
|
|
1034
|
+
const permissionRemovals = await reviewPermissionRemovals({ cwd: options.cwd, env: options.env, invocationCwd }, locators);
|
|
1035
|
+
return { integration, targets, warnings, deploymentExclusions, permissionRemovals, invocationCwd };
|
|
1025
1036
|
}
|
|
1026
1037
|
async function cleanupOfflineOwnedComponents(options) {
|
|
1027
1038
|
const results = [];
|
|
1028
1039
|
const warnings = [...options.nativePreparation?.warnings ?? []];
|
|
1029
1040
|
const nativeCliRunner = options.nativeCliRunner ?? getDefaultNativeCliRunner();
|
|
1030
1041
|
const codexManager = options.codexManager;
|
|
1042
|
+
const advanced = new Map();
|
|
1043
|
+
const relatedProjectBatch = { writes: new Map(), pending: new Map() };
|
|
1044
|
+
const permissionNotices = [];
|
|
1045
|
+
let cleanupMutation;
|
|
1031
1046
|
const context = {
|
|
1047
|
+
removeHostPermissions: async (locator) => {
|
|
1048
|
+
const review = options.nativePreparation?.permissionRemovals.get(locator.ownerKey);
|
|
1049
|
+
if (!review?.batch)
|
|
1050
|
+
throw permissionConflict();
|
|
1051
|
+
const expected = advanced.get(locator.settingsPath) ?? review.fingerprint;
|
|
1052
|
+
try {
|
|
1053
|
+
await updateHostPermissions({ env: options.env, cwd: options.cwd, invocationCwd: options.nativePreparation?.invocationCwd }, locator, undefined, (_previous, current, target = locator.settingsPath) => advanced.set(target, current), review.batch, (notices) => permissionNotices.push(...notices), expected, locator.platform === 'opencode' && !locator.projectRoot ? relatedProjectBatch : undefined);
|
|
1054
|
+
}
|
|
1055
|
+
catch (error) {
|
|
1056
|
+
const notices = relatedProjectPermissionNotices(error, {
|
|
1057
|
+
pluginId: parseSharedOwnerToken(locator.ownerKey)?.pluginId, target: locator.platform,
|
|
1058
|
+
scope: locator.projectRoot ? 'project' : 'user',
|
|
1059
|
+
});
|
|
1060
|
+
permissionNotices.push(...notices);
|
|
1061
|
+
if (notices.length && error && typeof error === 'object' && 'mutation' in error) {
|
|
1062
|
+
if (error.mutation === 'confirmed' || error.mutation === 'possible' && cleanupMutation !== 'confirmed')
|
|
1063
|
+
cleanupMutation = error.mutation;
|
|
1064
|
+
}
|
|
1065
|
+
throw error;
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1032
1068
|
env: options.env,
|
|
1033
1069
|
nativeCliRunner,
|
|
1034
1070
|
...(codexManager ? { codexManager } : {}),
|
|
@@ -1038,6 +1074,8 @@ async function cleanupOfflineOwnedComponents(options) {
|
|
|
1038
1074
|
};
|
|
1039
1075
|
const integration = createRebuildIntegration({ context });
|
|
1040
1076
|
for (const target of options.targets) {
|
|
1077
|
+
permissionNotices.length = 0;
|
|
1078
|
+
cleanupMutation = undefined;
|
|
1041
1079
|
try {
|
|
1042
1080
|
const inventoryErrors = (options.inventoryErrors ?? []).filter((error) => error.relevance.global || ((error.relevance.sourceId === undefined || error.relevance.sourceId === target.sourceId)
|
|
1043
1081
|
&& (error.relevance.pluginName === undefined || error.relevance.pluginName === target.pluginName)
|
|
@@ -1048,6 +1086,10 @@ async function cleanupOfflineOwnedComponents(options) {
|
|
|
1048
1086
|
&& candidate.platform === target.platform
|
|
1049
1087
|
&& candidate.scope === target.scope);
|
|
1050
1088
|
const nativeTarget = options.nativePreparation?.targets.get(offlineCleanupKey(target));
|
|
1089
|
+
const cleanupContext = { cwd: options.cwd, env: options.env };
|
|
1090
|
+
const permissionNotice = !nativeTarget && isPermissionHost(target.platform) && (target.platform !== 'antigravity' || target.scope === 'user')
|
|
1091
|
+
? await missingPermissionOwnershipWarning(cleanupContext, target.pluginId, target.scope, await scopedPermissionPath(cleanupContext, target.platform, target.scope === 'project' ? { kind: 'project', projectRoot: resolveRepoRootSync(options.cwd) } : { kind: 'user' }), target.platform)
|
|
1092
|
+
: undefined;
|
|
1051
1093
|
const nativeComponents = nativeTarget?.ownedComponents ?? [];
|
|
1052
1094
|
const nativeOwns = (component) => nativeComponents.some((item) => 'path' in component && 'path' in item ? component.path === item.path
|
|
1053
1095
|
: component.kind === 'shared-config' && item.kind === 'shared-config'
|
|
@@ -1253,10 +1295,23 @@ async function cleanupOfflineOwnedComponents(options) {
|
|
|
1253
1295
|
}
|
|
1254
1296
|
if (!finalResult.deploymentExclusions?.length)
|
|
1255
1297
|
finalResult.deploymentExclusions = options.nativePreparation?.deploymentExclusions.filter((entry) => entry.pluginId === target.pluginId && entry.platform === target.platform && entry.scope.kind === target.scope);
|
|
1298
|
+
const cleanupNotices = finalResult.failures.flatMap((failure) => {
|
|
1299
|
+
if (!failure.label)
|
|
1300
|
+
return [];
|
|
1301
|
+
const notice = permissionFailureNotice(failure.operationDiagnostic?.code, failure.label, { pluginId: target.pluginId, target: target.platform, scope: target.scope });
|
|
1302
|
+
return notice ? [notice] : [];
|
|
1303
|
+
});
|
|
1304
|
+
if (permissionNotice)
|
|
1305
|
+
cleanupNotices.push(permissionNotice);
|
|
1306
|
+
cleanupNotices.push(...permissionNotices);
|
|
1307
|
+
if (cleanupNotices.length)
|
|
1308
|
+
finalResult.cleanupNotices = [...finalResult.cleanupNotices ?? [], ...cleanupNotices];
|
|
1309
|
+
if (cleanupMutation)
|
|
1310
|
+
finalResult.cleanupMutation = cleanupMutation;
|
|
1256
1311
|
results.push(finalResult);
|
|
1257
1312
|
}
|
|
1258
1313
|
catch (error) {
|
|
1259
|
-
|
|
1314
|
+
const failed = failedResult('cleanup', {
|
|
1260
1315
|
pluginId: target.pluginId,
|
|
1261
1316
|
pluginName: target.pluginName,
|
|
1262
1317
|
sourceId: target.sourceId,
|
|
@@ -1265,9 +1320,20 @@ async function cleanupOfflineOwnedComponents(options) {
|
|
|
1265
1320
|
platform: target.platform,
|
|
1266
1321
|
scope: target.scope,
|
|
1267
1322
|
cwd: options.cwd,
|
|
1268
|
-
}, error instanceof Error ? error.message : String(error), 'cleanup.owned')
|
|
1323
|
+
}, error instanceof Error ? error.message : String(error), 'cleanup.owned');
|
|
1324
|
+
if (permissionNotices.length)
|
|
1325
|
+
failed.cleanupNotices = [...permissionNotices];
|
|
1326
|
+
if (cleanupMutation)
|
|
1327
|
+
failed.cleanupMutation = cleanupMutation;
|
|
1328
|
+
results.push(failed);
|
|
1269
1329
|
}
|
|
1270
1330
|
}
|
|
1331
|
+
for (const notice of pendingRelatedProjectNotices(relatedProjectBatch, false)) {
|
|
1332
|
+
const result = results.find((entry) => entry.target.platform === 'opencode' && entry.target.scope === 'user'
|
|
1333
|
+
&& entry.target.pluginId === notice.subject?.pluginId);
|
|
1334
|
+
if (result)
|
|
1335
|
+
(result.cleanupNotices ??= []).push(notice);
|
|
1336
|
+
}
|
|
1271
1337
|
const obsoleteContracts = path.join(resolveAwHome(options.env), 'installation-contracts');
|
|
1272
1338
|
try {
|
|
1273
1339
|
await (options.removeObsoleteInstallationContracts ?? fs.remove)(obsoleteContracts);
|
|
@@ -1302,7 +1368,7 @@ async function previewOfflineOwnedComponents(options) {
|
|
|
1302
1368
|
: []));
|
|
1303
1369
|
if (options.evidence) {
|
|
1304
1370
|
preview.offlineCleanupPlans = options.evidence;
|
|
1305
|
-
preview.operationPlan =
|
|
1371
|
+
preview.operationPlan = createOfflineCleanupOperationPlan(options.evidence);
|
|
1306
1372
|
}
|
|
1307
1373
|
await options.onPreviewStage?.('dependencyPlan');
|
|
1308
1374
|
return preview;
|
|
@@ -1321,7 +1387,6 @@ function createOfflineCleanupOperationPlan(evidence, requirements, warnings = []
|
|
|
1321
1387
|
});
|
|
1322
1388
|
return createOperationPlan({
|
|
1323
1389
|
deploymentExclusions: nativePreparation?.deploymentExclusions ?? [],
|
|
1324
|
-
nativeToolChanges: nativePreparation ? [...nativePreparation.targets.values()].flatMap((target) => target.nativeToolChanges ?? []) : [],
|
|
1325
1390
|
...(nativePreparation ? { deploymentPlans: [...nativePreparation.targets.values()].flatMap((target) => target.platformDeployment?.plans ?? []) } : {}),
|
|
1326
1391
|
intentChanges: [],
|
|
1327
1392
|
actions: [...retainedPackages, ...evidence.flatMap((target) => reviewedActions(target).flatMap((action) => action.action === 'removeOwnedOutput'
|
|
@@ -1333,6 +1398,8 @@ function createOfflineCleanupOperationPlan(evidence, requirements, warnings = []
|
|
|
1333
1398
|
path: action.kind === 'namespacedOwner' && path.basename(action.target) === SKILL_OWNER_MARKER
|
|
1334
1399
|
? path.dirname(action.target) : action.target,
|
|
1335
1400
|
ownerFingerprint: target.targetFingerprint,
|
|
1401
|
+
...(action.component?.kind === 'shared-config' && action.component.locator.kind === 'host-permissions'
|
|
1402
|
+
? { permissionRemoval: nativePreparation?.permissionRemovals.get(action.component.locator.ownerKey) } : {}),
|
|
1336
1403
|
}]
|
|
1337
1404
|
: action.activationScope === target.scope
|
|
1338
1405
|
? [{
|
|
@@ -1715,13 +1782,11 @@ export async function executeRemovedPluginOutputCleanup(options) {
|
|
|
1715
1782
|
const selected = options.selectedTargets.filter((target) => target.pluginId === options.target.pluginId && target.scope === options.context.scope);
|
|
1716
1783
|
const retainedPackages = await discoverRetainedManagedCommandPackages({
|
|
1717
1784
|
selectors: [{ sourceId: options.target.sourceId, pluginName: options.target.pluginName }],
|
|
1718
|
-
scope: options.context.scope,
|
|
1719
|
-
cwd: options.context.executionCwd,
|
|
1720
1785
|
env: options.context.env,
|
|
1721
1786
|
});
|
|
1722
1787
|
const retainedActions = retainedPackages.map((entry) => ({
|
|
1723
1788
|
...entry, kind: 'retainManagedCommandPackage', pluginId: options.target.pluginId,
|
|
1724
|
-
scope:
|
|
1789
|
+
scope: 'user',
|
|
1725
1790
|
}));
|
|
1726
1791
|
const withRetainedPackages = (result, operationPlan = createOfflineCleanupOperationPlan([], undefined, [], retainedActions)) => {
|
|
1727
1792
|
result.operationPlan = operationPlan;
|
|
@@ -1778,7 +1843,7 @@ export async function executeRemovedPluginOutputCleanup(options) {
|
|
|
1778
1843
|
}));
|
|
1779
1844
|
const nativePreparation = await prepareOfflineNativeCleanup({ evidence, cwd: options.context.executionCwd,
|
|
1780
1845
|
env: options.context.env, runtime: options.runtime });
|
|
1781
|
-
const operationPlan =
|
|
1846
|
+
const operationPlan = createOfflineCleanupOperationPlan(evidence, undefined, [], retainedActions, nativePreparation);
|
|
1782
1847
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
1783
1848
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
|
|
1784
1849
|
}
|
|
@@ -1842,9 +1907,9 @@ async function runRebuildCommandInSession(options) {
|
|
|
1842
1907
|
.catch(() => undefined)
|
|
1843
1908
|
: undefined;
|
|
1844
1909
|
const retainedPackages = options.command === 'cleanup'
|
|
1845
|
-
? await discoverRetainedManagedCommandPackages({ selectors: retainSelectors.map((selector) => ({ ...selector, sourceId: selector.sourceId ?? primarySourceId })), all: options.all,
|
|
1910
|
+
? await discoverRetainedManagedCommandPackages({ selectors: retainSelectors.map((selector) => ({ ...selector, sourceId: selector.sourceId ?? primarySourceId })), all: options.all, env: runtimeEnv })
|
|
1846
1911
|
: [];
|
|
1847
|
-
const retainedPackageActions = retainedPackages.map((entry) => ({ ...entry, kind: 'retainManagedCommandPackage', pluginId: `${entry.producer.sourceId}/${entry.producer.pluginName}`, scope:
|
|
1912
|
+
const retainedPackageActions = retainedPackages.map((entry) => ({ ...entry, kind: 'retainManagedCommandPackage', pluginId: `${entry.producer.sourceId}/${entry.producer.pluginName}`, scope: 'user' }));
|
|
1848
1913
|
const readInventory = options.runtime?.inventoryCatalogSourceReferences
|
|
1849
1914
|
?? inventoryCatalogSourceReferences;
|
|
1850
1915
|
const inventoryRequest = { cwd: options.commandOptions.cwd, env: runtimeEnv, scope: options.commandOptions.scope };
|
|
@@ -2037,7 +2102,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2037
2102
|
&& cleanupSelectionErrors.length === 0
|
|
2038
2103
|
&& legacyLiveTargets.length === 0) {
|
|
2039
2104
|
const result = mergeRebuildCommandResults([]);
|
|
2040
|
-
const operationPlan =
|
|
2105
|
+
const operationPlan = createOfflineCleanupOperationPlan([], { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, []), ...cleanupUnavailableWarnings], retainedPackageActions);
|
|
2041
2106
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
2042
2107
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
|
|
2043
2108
|
}
|
|
@@ -2129,7 +2194,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2129
2194
|
&& candidate.platform === target.platform
|
|
2130
2195
|
&& candidate.scope === target.scope)
|
|
2131
2196
|
?? intentOnlyOfflineCleanupEvidence(target));
|
|
2132
|
-
const operationPlan =
|
|
2197
|
+
const operationPlan = createOfflineCleanupOperationPlan(forceEvidence, { scope: options.commandOptions.scope, view: cleanupRequirements }, cleanupInventoryWarnings(cleanupInventory, forceCleanupTargets), retainedPackageActions);
|
|
2133
2198
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
2134
2199
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
|
|
2135
2200
|
}
|
|
@@ -2230,7 +2295,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2230
2295
|
}
|
|
2231
2296
|
if (cleanupTargets.length === 0) {
|
|
2232
2297
|
const result = mergeRebuildCommandResults([]);
|
|
2233
|
-
const operationPlan =
|
|
2298
|
+
const operationPlan = createOfflineCleanupOperationPlan([], { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, []), ...cleanupUnavailableWarnings], retainedPackageActions);
|
|
2234
2299
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
2235
2300
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
|
|
2236
2301
|
}
|
|
@@ -2272,7 +2337,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2272
2337
|
?? intentOnlyOfflineCleanupEvidence(target));
|
|
2273
2338
|
const nativePreparation = await prepareOfflineNativeCleanup({ evidence, cwd: options.commandOptions.cwd,
|
|
2274
2339
|
env: runtimeEnv, runtime: options.runtime });
|
|
2275
|
-
const operationPlan =
|
|
2340
|
+
const operationPlan = createOfflineCleanupOperationPlan(evidence, { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, cleanupTargets), ...cleanupUnavailableWarnings], retainedPackageActions, nativePreparation);
|
|
2276
2341
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
2277
2342
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
|
|
2278
2343
|
}
|
|
@@ -2677,61 +2742,34 @@ async function runRebuildCommandInSession(options) {
|
|
|
2677
2742
|
: preflightTargets.filter((target) => target.pluginId === entry.pluginId));
|
|
2678
2743
|
}
|
|
2679
2744
|
}
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
let marketplaceName = persistedName
|
|
2698
|
-
?? (entry.source.sourceId === catalog.primarySourceId
|
|
2699
|
-
? 'aw'
|
|
2700
|
-
: getNamespacedMarketplaceName(entry.source.sourceId));
|
|
2701
|
-
if (options.command === 'cleanup' || options.command === 'uninstall') {
|
|
2702
|
-
marketplaceNamesBySource.set(entry.source.sourceId, marketplaceName);
|
|
2703
|
-
continue;
|
|
2704
|
-
}
|
|
2705
|
-
let registrations = await inspectNativeMarketplaceRegistrations({
|
|
2706
|
-
marketplaceName,
|
|
2707
|
-
marketplaceRoot,
|
|
2708
|
-
cwd: options.commandOptions.cwd,
|
|
2709
|
-
env: runtimeEnv,
|
|
2710
|
-
});
|
|
2711
|
-
if (!persistedName
|
|
2712
|
-
&& marketplaceName === 'aw'
|
|
2713
|
-
&& Object.values(registrations).includes('foreign')) {
|
|
2714
|
-
marketplaceName = getNamespacedMarketplaceName(entry.source.sourceId);
|
|
2715
|
-
registrations = await inspectNativeMarketplaceRegistrations({
|
|
2745
|
+
if (options.command !== 'cleanup' && options.command !== 'uninstall') {
|
|
2746
|
+
const marketplaceSelections = new Map(executionSelections.map(({ entry, platform }) => [
|
|
2747
|
+
`${entry.source.sourceId}\0${platform}`, { source: entry.source, platform },
|
|
2748
|
+
]));
|
|
2749
|
+
for (const { source, platform } of marketplaceSelections.values()) {
|
|
2750
|
+
if (platform !== 'codex' && platform !== 'claude')
|
|
2751
|
+
continue;
|
|
2752
|
+
const marketplaceName = getNamespacedMarketplaceName(source.sourceId);
|
|
2753
|
+
const codexPackages = platform === 'codex' ? stateInventory.references.flatMap((reference) => {
|
|
2754
|
+
const candidate = reference.recoveryCandidate;
|
|
2755
|
+
return reference.kind === 'namespacedOwner' && reference.scope === 'user'
|
|
2756
|
+
&& reference.sourceId === source.sourceId && reference.sourceIdentity === source.sourceIdentity
|
|
2757
|
+
&& candidate?.evidence === 'verified' && candidate.binding.route === 'codex-marketplace' && candidate.nativeIdentity
|
|
2758
|
+
? [candidate.nativeIdentity] : [];
|
|
2759
|
+
}) : [];
|
|
2760
|
+
const registration = await inspectNativeMarketplaceRegistration({
|
|
2761
|
+
platform,
|
|
2716
2762
|
marketplaceName,
|
|
2717
|
-
|
|
2763
|
+
sourceId: source.sourceId,
|
|
2718
2764
|
cwd: options.commandOptions.cwd,
|
|
2719
2765
|
env: runtimeEnv,
|
|
2766
|
+
codexPackages,
|
|
2720
2767
|
});
|
|
2768
|
+
if (registration === 'foreign') {
|
|
2769
|
+
throw new Error(`externalOwnershipPresent: Marketplace ${marketplaceName} is foreign on ${platform}.`);
|
|
2770
|
+
}
|
|
2721
2771
|
}
|
|
2722
|
-
const foreignPlatforms = Object.entries(registrations).flatMap(([platform, state]) => state === 'foreign' ? [platform] : []);
|
|
2723
|
-
if (foreignPlatforms.length > 0) {
|
|
2724
|
-
throw new Error(`externalOwnershipPresent: Marketplace ${marketplaceName} is foreign on ${foreignPlatforms.join(', ')}.`);
|
|
2725
|
-
}
|
|
2726
|
-
marketplaceNamesBySource.set(entry.source.sourceId, marketplaceName);
|
|
2727
2772
|
}
|
|
2728
|
-
const marketplaceNameFor = (entry, ..._placement) => {
|
|
2729
|
-
const marketplaceName = marketplaceNamesBySource.get(entry.source.sourceId);
|
|
2730
|
-
if (!marketplaceName) {
|
|
2731
|
-
throw new Error('marketplaceIdentityUnavailable: No marketplace name was selected for the source.');
|
|
2732
|
-
}
|
|
2733
|
-
return marketplaceName;
|
|
2734
|
-
};
|
|
2735
2773
|
const codexObservationScopeByMarketplace = new Map();
|
|
2736
2774
|
const projectCodexConfig = options.commandOptions.scope === 'project'
|
|
2737
2775
|
? await readCodexConfigFile(resolveCodexPaths(options.commandOptions.cwd, 'project', runtimeEnv).configTomlPath)
|
|
@@ -2739,7 +2777,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2739
2777
|
for (const { entry, platform } of executionSelections) {
|
|
2740
2778
|
if (platform !== 'codex')
|
|
2741
2779
|
continue;
|
|
2742
|
-
const marketplaceName =
|
|
2780
|
+
const marketplaceName = getNamespacedMarketplaceName(entry.source.sourceId);
|
|
2743
2781
|
const codexPluginId = `${entry.plugin.manifest.name}@${marketplaceName}`;
|
|
2744
2782
|
const requiredScope = options.commandOptions.scope === 'project'
|
|
2745
2783
|
|| (projectCodexConfig !== undefined
|
|
@@ -2752,10 +2790,14 @@ async function runRebuildCommandInSession(options) {
|
|
|
2752
2790
|
}
|
|
2753
2791
|
}
|
|
2754
2792
|
const executionContext = {
|
|
2793
|
+
invocationCwd: options.runtime?.invocationCwd,
|
|
2755
2794
|
recoveryCandidates: options.runtime?.recoveryCandidates,
|
|
2756
2795
|
sharedReferenceView: options.runtime?.executionInput?.requirements.sharedReferenceView ?? options.runtime?.sharedReferenceView,
|
|
2757
2796
|
platformRebuildSession: options.runtime?.platformRebuildSession,
|
|
2758
2797
|
batchInstallPlatform: options.runtime?.batchInstallPlatform,
|
|
2798
|
+
commandPackagePlatforms: options.runtime?.commandPackagePlatforms,
|
|
2799
|
+
retainCommandPackages: options.runtime?.retainCommandPackages,
|
|
2800
|
+
configApply: options.runtime?.configApply ?? !!options.runtime?.configApplyPackages,
|
|
2759
2801
|
packagePreparationCache: options.runtime?.packagePreparationCache,
|
|
2760
2802
|
preparedArtifactRenderResults: options.runtime?.preparedArtifactRenderResults,
|
|
2761
2803
|
interruption: options.runtime?.interruption,
|
|
@@ -2833,7 +2875,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2833
2875
|
const requestedScope = selection.requestedScope ?? options.commandOptions.scope;
|
|
2834
2876
|
const requestedMethod = selection.requestedMethod ?? options.command;
|
|
2835
2877
|
const inspectScope = async (scope) => {
|
|
2836
|
-
const marketplaceName =
|
|
2878
|
+
const marketplaceName = getNamespacedMarketplaceName(entry.source.sourceId);
|
|
2837
2879
|
entry.plugin.marketplaceName = marketplaceName;
|
|
2838
2880
|
const desired = await inspection.buildTarget({
|
|
2839
2881
|
sourceId: entry.source.sourceId,
|
|
@@ -3104,7 +3146,9 @@ async function runRebuildCommandInSession(options) {
|
|
|
3104
3146
|
state = resolvedInspection.state;
|
|
3105
3147
|
errorCode ??= 'dependencyNotReady';
|
|
3106
3148
|
}
|
|
3107
|
-
|
|
3149
|
+
const configPackageBlocker = options.runtime?.configApplyPackages?.targets.find((target) => target.pluginId === entry.pluginId && target.platforms.includes(platform))?.blocker;
|
|
3150
|
+
if (!configPackageBlocker
|
|
3151
|
+
&& !planOptions?.skipConfigValidation
|
|
3108
3152
|
&& entry.plugin.manifest.config?.fields
|
|
3109
3153
|
&& (action === 'install' || action === 'reinstall')) {
|
|
3110
3154
|
const configs = await Promise.all(pluginConfigTargetRenderScopes(entry.plugin, {
|
|
@@ -3137,6 +3181,10 @@ async function runRebuildCommandInSession(options) {
|
|
|
3137
3181
|
action = 'block';
|
|
3138
3182
|
errorCode = surface?.errorCode ?? 'codexNativeKindUnsupported';
|
|
3139
3183
|
}
|
|
3184
|
+
if (configPackageBlocker) {
|
|
3185
|
+
action = 'block';
|
|
3186
|
+
errorCode = configPackageBlocker.code;
|
|
3187
|
+
}
|
|
3140
3188
|
if (errorCode)
|
|
3141
3189
|
blockingTargets.set(`${entry.pluginId}\0${platform}\0${requestedScope}`, errorCode);
|
|
3142
3190
|
targets.push({
|
|
@@ -3287,7 +3335,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
3287
3335
|
|| planned.action === 'block'))
|
|
3288
3336
|
continue;
|
|
3289
3337
|
const scope = planned?.resolvedScope ?? options.commandOptions.scope;
|
|
3290
|
-
const marketplaceName =
|
|
3338
|
+
const marketplaceName = getNamespacedMarketplaceName(entry.source.sourceId);
|
|
3291
3339
|
entry.plugin.marketplaceName = marketplaceName;
|
|
3292
3340
|
const marketplaceRoot = path.join(resolveAwHome(runtimeEnv), 'marketplaces', entry.source.sourceId);
|
|
3293
3341
|
if (!dependencyEnabled && selectedPlatform === 'codex') {
|
|
@@ -3371,7 +3419,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
3371
3419
|
|| (plannedNative?.action === 'none' && codexNativeStillDesired)
|
|
3372
3420
|
|| options.command === 'cleanup'
|
|
3373
3421
|
|| options.command === 'uninstall';
|
|
3374
|
-
const marketplaceName =
|
|
3422
|
+
const marketplaceName = getNamespacedMarketplaceName(entry.source.sourceId);
|
|
3375
3423
|
try {
|
|
3376
3424
|
const target = await measureCommandPerformanceStage(options.runtime, 'target.build', () => integration.buildTarget({
|
|
3377
3425
|
sourceId: entry.source.sourceId,
|
|
@@ -3454,8 +3502,8 @@ async function runRebuildCommandInSession(options) {
|
|
|
3454
3502
|
? `native:${component.pluginId}`
|
|
3455
3503
|
: component.locator.kind === 'cursor-workspace-hook'
|
|
3456
3504
|
? `shared:cursor:${path.resolve(component.locator.hooksPath)}:${component.locator.ownerKey}`
|
|
3457
|
-
: component.locator.kind === 'claude-permissions'
|
|
3458
|
-
? `shared
|
|
3505
|
+
: component.locator.kind === 'claude-permissions' || component.locator.kind === 'host-permissions'
|
|
3506
|
+
? `shared:${platform}:${path.resolve(component.locator.settingsPath)}:${component.locator.ownerKey}`
|
|
3459
3507
|
: `shared:${component.label}`),
|
|
3460
3508
|
};
|
|
3461
3509
|
return { key, target, collision };
|
|
@@ -3593,18 +3641,17 @@ async function runRebuildCommandInSession(options) {
|
|
|
3593
3641
|
}));
|
|
3594
3642
|
}
|
|
3595
3643
|
preview.nativeFootprints = preparedNativeFootprints([...previewPreparation.preparedTargets.values()].map((entry) => entry.target));
|
|
3596
|
-
preview.operationPlan =
|
|
3644
|
+
preview.operationPlan = createRebuildOperationPlan({
|
|
3597
3645
|
dependencyPlan: initialPlan,
|
|
3598
3646
|
codexPlans: initialCodexPlans,
|
|
3599
3647
|
targetActions: previewPreparation.targetActions,
|
|
3600
3648
|
deploymentPlans: previewPreparation.deploymentPlans,
|
|
3601
3649
|
deploymentExclusions: previewPreparation.deploymentExclusions,
|
|
3602
|
-
nativeToolChanges: [...previewPreparation.preparedTargets.values()].flatMap((entry) => entry.target.nativeToolChanges ?? []),
|
|
3603
3650
|
catalogSources: catalog.sources.flatMap((source) => source.resolution ? [source.resolution] : []),
|
|
3604
3651
|
requirements,
|
|
3605
3652
|
scope: options.commandOptions.scope,
|
|
3606
3653
|
configDigests: previewPreparation.configDigests,
|
|
3607
|
-
})
|
|
3654
|
+
});
|
|
3608
3655
|
if (initialCodexPlans.length > 0)
|
|
3609
3656
|
preview.codexReconcilePlans = initialCodexPlans;
|
|
3610
3657
|
if (initialCodexPlans.some((plan) => plan.sharedNativeActions.some((action) => action.action === 'install' || action.action === 'replace' || action.action === 'repair')
|
|
@@ -3653,18 +3700,17 @@ async function runRebuildCommandInSession(options) {
|
|
|
3653
3700
|
|| action.action === 'repair'));
|
|
3654
3701
|
let lockedCodexPlans = provisionalLockedCodexPlans;
|
|
3655
3702
|
let lockedPreparation = await prepareRenderedTargets(lockedPlan, lockedCodexPlans, true);
|
|
3656
|
-
let lockedOperationPlan =
|
|
3703
|
+
let lockedOperationPlan = createRebuildOperationPlan({
|
|
3657
3704
|
dependencyPlan: lockedPlan,
|
|
3658
3705
|
codexPlans: lockedCodexPlans,
|
|
3659
3706
|
targetActions: lockedPreparation.targetActions,
|
|
3660
3707
|
deploymentPlans: lockedPreparation.deploymentPlans,
|
|
3661
3708
|
deploymentExclusions: lockedPreparation.deploymentExclusions,
|
|
3662
|
-
nativeToolChanges: [...lockedPreparation.preparedTargets.values()].flatMap((entry) => entry.target.nativeToolChanges ?? []),
|
|
3663
3709
|
catalogSources: catalog.sources.flatMap((source) => source.resolution ? [source.resolution] : []),
|
|
3664
3710
|
requirements,
|
|
3665
3711
|
scope: options.commandOptions.scope,
|
|
3666
3712
|
configDigests: lockedPreparation.configDigests,
|
|
3667
|
-
})
|
|
3713
|
+
});
|
|
3668
3714
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
3669
3715
|
try {
|
|
3670
3716
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, lockedOperationPlan);
|
|
@@ -3952,18 +3998,17 @@ async function runRebuildCommandInSession(options) {
|
|
|
3952
3998
|
});
|
|
3953
3999
|
lockedPreparation.integration.setNativeMarketplaceEligibleTargets(eligibleTargets);
|
|
3954
4000
|
}
|
|
3955
|
-
lockedOperationPlan =
|
|
4001
|
+
lockedOperationPlan = createRebuildOperationPlan({
|
|
3956
4002
|
dependencyPlan: lockedPlan,
|
|
3957
4003
|
codexPlans: lockedCodexPlans,
|
|
3958
4004
|
targetActions: lockedPreparation.targetActions,
|
|
3959
4005
|
deploymentPlans: lockedPreparation.deploymentPlans,
|
|
3960
4006
|
deploymentExclusions: lockedPreparation.deploymentExclusions,
|
|
3961
|
-
nativeToolChanges: [...lockedPreparation.preparedTargets.values()].flatMap((entry) => entry.target.nativeToolChanges ?? []),
|
|
3962
4007
|
catalogSources: catalog.sources.flatMap((source) => source.resolution ? [source.resolution] : []),
|
|
3963
4008
|
requirements,
|
|
3964
4009
|
scope: options.commandOptions.scope,
|
|
3965
4010
|
configDigests: lockedPreparation.configDigests,
|
|
3966
|
-
})
|
|
4011
|
+
});
|
|
3967
4012
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
3968
4013
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, lockedOperationPlan);
|
|
3969
4014
|
}
|
|
@@ -4120,7 +4165,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
4120
4165
|
assertRebuildCatalogSourceInventoryComplete(checked.inventory, options.commandOptions.scope);
|
|
4121
4166
|
}
|
|
4122
4167
|
const inspectConsumer = async (options_) => {
|
|
4123
|
-
const marketplaceName =
|
|
4168
|
+
const marketplaceName = getNamespacedMarketplaceName(options_.entry.source.sourceId);
|
|
4124
4169
|
options_.entry.plugin.marketplaceName = marketplaceName;
|
|
4125
4170
|
const consumerTarget = await inspection.buildTarget({
|
|
4126
4171
|
sourceId: options_.entry.source.sourceId,
|
|
@@ -4464,7 +4509,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
4464
4509
|
try {
|
|
4465
4510
|
const commands = await nativeTargetExecution.beforeApply(identity);
|
|
4466
4511
|
recordTargetCommands(commands);
|
|
4467
|
-
if (commands.
|
|
4512
|
+
if (!commands.every(commandPackageProviderSatisfied)) {
|
|
4468
4513
|
packageFailure = 'commandPackageProviderNotSatisfied';
|
|
4469
4514
|
}
|
|
4470
4515
|
}
|
|
@@ -4475,7 +4520,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
4475
4520
|
recordTargetCommands(nativeTargetExecution.blocked?.(identity, packageFailure) ?? []);
|
|
4476
4521
|
}
|
|
4477
4522
|
if (packageFailure) {
|
|
4478
|
-
const result = failedResult(requestedMethod, identity, `${packageFailure}: ${entry.pluginId} requires a
|
|
4523
|
+
const result = failedResult(requestedMethod, identity, `${packageFailure}: ${entry.pluginId} requires a published command package.`);
|
|
4479
4524
|
record({
|
|
4480
4525
|
platforms: [platform], plugins: [], warnings: [], rebuildResults: [result],
|
|
4481
4526
|
targetResults: [{ ...toTargetResult(result), action: planned.action }],
|
|
@@ -4591,7 +4636,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
4591
4636
|
dependencyStates.set(key, 'kept');
|
|
4592
4637
|
return;
|
|
4593
4638
|
}
|
|
4594
|
-
const marketplaceName =
|
|
4639
|
+
const marketplaceName = getNamespacedMarketplaceName(entry.source.sourceId);
|
|
4595
4640
|
const namespacedSource = {
|
|
4596
4641
|
sourceId: entry.source.sourceId,
|
|
4597
4642
|
sourceIdentity: entry.source.sourceIdentity,
|
|
@@ -4948,6 +4993,13 @@ async function runRebuildCommandInSession(options) {
|
|
|
4948
4993
|
}
|
|
4949
4994
|
};
|
|
4950
4995
|
const privatePackages = [];
|
|
4996
|
+
const reportPendingOpenCodeProjects = (interrupted) => {
|
|
4997
|
+
for (const notice of lockedPreparation.integration.pendingOpenCodeProjectNotices(interrupted)) {
|
|
4998
|
+
const rebuild = results.flatMap((result) => result.rebuildResults).find((entry) => entry.target.platform === 'opencode'
|
|
4999
|
+
&& entry.target.scope === 'user' && entry.target.pluginId === notice.subject?.pluginId);
|
|
5000
|
+
rebuild?.deploymentReceipts?.[0]?.diagnostics.push(notice);
|
|
5001
|
+
}
|
|
5002
|
+
};
|
|
4951
5003
|
try {
|
|
4952
5004
|
if (admission && options.runtime?.batchInstallPlatform) {
|
|
4953
5005
|
const selectedKeys = new Set(executionSelections.map((selection) => executionKey(selection, lockedPlan)));
|
|
@@ -4959,8 +5011,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
4959
5011
|
const resources = nativeInstallResources(deployment?.plans ?? []);
|
|
4960
5012
|
const producesCommands = target && nativeTargetExecution
|
|
4961
5013
|
&& (nativeTargetExecution.produces?.(target.identity) ?? true);
|
|
4962
|
-
if (
|
|
4963
|
-
|| target?.operationActions?.some((action) => action.kind === 'syncManagedCommandPackage')) {
|
|
5014
|
+
if (producesCommands || target?.operationActions?.some((action) => action.kind === 'syncManagedCommandPackage' || action.kind === 'removeManagedCommandPackage')) {
|
|
4964
5015
|
resources.push({ kind: 'path', value: path.join(resolveAwHome(runtimeEnv), 'commands') });
|
|
4965
5016
|
}
|
|
4966
5017
|
const leaves = [];
|
|
@@ -5044,11 +5095,13 @@ async function runRebuildCommandInSession(options) {
|
|
|
5044
5095
|
failCompletedCodexTarget({ identity: targetIdentity(selection, planTargetFor(lockedPlan, selection).resolvedScope),
|
|
5045
5096
|
message: `${code}: Codex postcheck did not complete.` });
|
|
5046
5097
|
}
|
|
5098
|
+
reportPendingOpenCodeProjects(true);
|
|
5047
5099
|
throw new RebuildInterruptedError(mergeRebuildCommandResults(results.filter(Boolean)), error);
|
|
5048
5100
|
}
|
|
5049
5101
|
finally {
|
|
5050
5102
|
await Promise.all(privatePackages.map((staging) => staging.dispose()));
|
|
5051
5103
|
}
|
|
5104
|
+
reportPendingOpenCodeProjects(false);
|
|
5052
5105
|
const merged = mergeRebuildCommandResults(results);
|
|
5053
5106
|
if (malformedSelectedConfigPreserved) {
|
|
5054
5107
|
merged.warnings.push(MALFORMED_CONFIG_PRESERVED_WARNING);
|
|
@@ -5120,18 +5173,24 @@ export async function runRebuildCommand(options) {
|
|
|
5120
5173
|
?? result.rebuildResults.flatMap((entry) => entry.deploymentExclusions ?? []);
|
|
5121
5174
|
if (exclusions.length)
|
|
5122
5175
|
result = { ...result, deploymentExclusions: exclusions };
|
|
5123
|
-
const byProducer = new Map();
|
|
5124
5176
|
const retained = (result.operationPlan?.actions ?? []).flatMap((action) => action.kind === 'retainManagedCommandPackage' ? [retainedManagedCommandPackageResult(action)] : []);
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
byProducer.set(key, { ...entry, removedCommandIds: [...new Set([...(previous?.removedCommandIds ?? []), ...entry.removedCommandIds])].filter((id) => !entry.commandIds.includes(id)), errors: [...(previous?.errors ?? []), ...entry.errors], recoveryActions: [...new Set([...(previous?.recoveryActions ?? []), ...entry.recoveryActions])] });
|
|
5177
|
+
const byPackage = new Map();
|
|
5178
|
+
for (const entry of [...retained, ...(result.commandResults ?? []), ...commandResults]) {
|
|
5179
|
+
byPackage.set(entry.packageId, entry);
|
|
5129
5180
|
}
|
|
5130
|
-
const commands = [...
|
|
5131
|
-
if (commands.length
|
|
5181
|
+
const commands = [...byPackage.values()];
|
|
5182
|
+
if (!commands.length)
|
|
5132
5183
|
return result;
|
|
5133
|
-
|
|
5134
|
-
|
|
5184
|
+
let overallState = result.overallState;
|
|
5185
|
+
if (commands.some((entry) => entry.state !== 'completed')) {
|
|
5186
|
+
const completedWork = result.targetResults.some((entry) => entry.state === 'completed')
|
|
5187
|
+
|| commands.some((entry) => entry.state !== 'failed');
|
|
5188
|
+
overallState = completedWork ? 'partial' : 'failed';
|
|
5189
|
+
}
|
|
5190
|
+
else if (overallState === 'failed' && commands.some((entry) => entry.action !== 'unchanged')) {
|
|
5191
|
+
overallState = 'partial';
|
|
5192
|
+
}
|
|
5193
|
+
return { ...result, commandResults: commands, overallState };
|
|
5135
5194
|
};
|
|
5136
5195
|
const scopedOptions = {
|
|
5137
5196
|
...options,
|