@lesliechan721/aw 0.1.0-beta.85 → 0.1.0-beta.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring/assets/command-runtime-config.d.mts +9 -0
- package/dist/authoring/assets/command-runtime-config.mjs +106 -0
- package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
- package/dist/authoring/scripts/validate-plugin.mjs +17 -22
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/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 +131 -45
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +11 -3
- package/dist/src/commands/rebuild-integration.js +47 -164
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +2 -1
- package/dist/src/commands/rebuild-operations.js +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 +7 -0
- package/dist/src/platforms/layout.js +46 -5
- 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';
|
|
@@ -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
|
}
|
|
@@ -2752,10 +2817,14 @@ async function runRebuildCommandInSession(options) {
|
|
|
2752
2817
|
}
|
|
2753
2818
|
}
|
|
2754
2819
|
const executionContext = {
|
|
2820
|
+
invocationCwd: options.runtime?.invocationCwd,
|
|
2755
2821
|
recoveryCandidates: options.runtime?.recoveryCandidates,
|
|
2756
2822
|
sharedReferenceView: options.runtime?.executionInput?.requirements.sharedReferenceView ?? options.runtime?.sharedReferenceView,
|
|
2757
2823
|
platformRebuildSession: options.runtime?.platformRebuildSession,
|
|
2758
2824
|
batchInstallPlatform: options.runtime?.batchInstallPlatform,
|
|
2825
|
+
commandPackagePlatforms: options.runtime?.commandPackagePlatforms,
|
|
2826
|
+
retainCommandPackages: options.runtime?.retainCommandPackages,
|
|
2827
|
+
configApply: options.runtime?.configApply ?? !!options.runtime?.configApplyPackages,
|
|
2759
2828
|
packagePreparationCache: options.runtime?.packagePreparationCache,
|
|
2760
2829
|
preparedArtifactRenderResults: options.runtime?.preparedArtifactRenderResults,
|
|
2761
2830
|
interruption: options.runtime?.interruption,
|
|
@@ -3104,7 +3173,9 @@ async function runRebuildCommandInSession(options) {
|
|
|
3104
3173
|
state = resolvedInspection.state;
|
|
3105
3174
|
errorCode ??= 'dependencyNotReady';
|
|
3106
3175
|
}
|
|
3107
|
-
|
|
3176
|
+
const configPackageBlocker = options.runtime?.configApplyPackages?.targets.find((target) => target.pluginId === entry.pluginId && target.platforms.includes(platform))?.blocker;
|
|
3177
|
+
if (!configPackageBlocker
|
|
3178
|
+
&& !planOptions?.skipConfigValidation
|
|
3108
3179
|
&& entry.plugin.manifest.config?.fields
|
|
3109
3180
|
&& (action === 'install' || action === 'reinstall')) {
|
|
3110
3181
|
const configs = await Promise.all(pluginConfigTargetRenderScopes(entry.plugin, {
|
|
@@ -3137,6 +3208,10 @@ async function runRebuildCommandInSession(options) {
|
|
|
3137
3208
|
action = 'block';
|
|
3138
3209
|
errorCode = surface?.errorCode ?? 'codexNativeKindUnsupported';
|
|
3139
3210
|
}
|
|
3211
|
+
if (configPackageBlocker) {
|
|
3212
|
+
action = 'block';
|
|
3213
|
+
errorCode = configPackageBlocker.code;
|
|
3214
|
+
}
|
|
3140
3215
|
if (errorCode)
|
|
3141
3216
|
blockingTargets.set(`${entry.pluginId}\0${platform}\0${requestedScope}`, errorCode);
|
|
3142
3217
|
targets.push({
|
|
@@ -3454,8 +3529,8 @@ async function runRebuildCommandInSession(options) {
|
|
|
3454
3529
|
? `native:${component.pluginId}`
|
|
3455
3530
|
: component.locator.kind === 'cursor-workspace-hook'
|
|
3456
3531
|
? `shared:cursor:${path.resolve(component.locator.hooksPath)}:${component.locator.ownerKey}`
|
|
3457
|
-
: component.locator.kind === 'claude-permissions'
|
|
3458
|
-
? `shared
|
|
3532
|
+
: component.locator.kind === 'claude-permissions' || component.locator.kind === 'host-permissions'
|
|
3533
|
+
? `shared:${platform}:${path.resolve(component.locator.settingsPath)}:${component.locator.ownerKey}`
|
|
3459
3534
|
: `shared:${component.label}`),
|
|
3460
3535
|
};
|
|
3461
3536
|
return { key, target, collision };
|
|
@@ -3593,18 +3668,17 @@ async function runRebuildCommandInSession(options) {
|
|
|
3593
3668
|
}));
|
|
3594
3669
|
}
|
|
3595
3670
|
preview.nativeFootprints = preparedNativeFootprints([...previewPreparation.preparedTargets.values()].map((entry) => entry.target));
|
|
3596
|
-
preview.operationPlan =
|
|
3671
|
+
preview.operationPlan = createRebuildOperationPlan({
|
|
3597
3672
|
dependencyPlan: initialPlan,
|
|
3598
3673
|
codexPlans: initialCodexPlans,
|
|
3599
3674
|
targetActions: previewPreparation.targetActions,
|
|
3600
3675
|
deploymentPlans: previewPreparation.deploymentPlans,
|
|
3601
3676
|
deploymentExclusions: previewPreparation.deploymentExclusions,
|
|
3602
|
-
nativeToolChanges: [...previewPreparation.preparedTargets.values()].flatMap((entry) => entry.target.nativeToolChanges ?? []),
|
|
3603
3677
|
catalogSources: catalog.sources.flatMap((source) => source.resolution ? [source.resolution] : []),
|
|
3604
3678
|
requirements,
|
|
3605
3679
|
scope: options.commandOptions.scope,
|
|
3606
3680
|
configDigests: previewPreparation.configDigests,
|
|
3607
|
-
})
|
|
3681
|
+
});
|
|
3608
3682
|
if (initialCodexPlans.length > 0)
|
|
3609
3683
|
preview.codexReconcilePlans = initialCodexPlans;
|
|
3610
3684
|
if (initialCodexPlans.some((plan) => plan.sharedNativeActions.some((action) => action.action === 'install' || action.action === 'replace' || action.action === 'repair')
|
|
@@ -3653,18 +3727,17 @@ async function runRebuildCommandInSession(options) {
|
|
|
3653
3727
|
|| action.action === 'repair'));
|
|
3654
3728
|
let lockedCodexPlans = provisionalLockedCodexPlans;
|
|
3655
3729
|
let lockedPreparation = await prepareRenderedTargets(lockedPlan, lockedCodexPlans, true);
|
|
3656
|
-
let lockedOperationPlan =
|
|
3730
|
+
let lockedOperationPlan = createRebuildOperationPlan({
|
|
3657
3731
|
dependencyPlan: lockedPlan,
|
|
3658
3732
|
codexPlans: lockedCodexPlans,
|
|
3659
3733
|
targetActions: lockedPreparation.targetActions,
|
|
3660
3734
|
deploymentPlans: lockedPreparation.deploymentPlans,
|
|
3661
3735
|
deploymentExclusions: lockedPreparation.deploymentExclusions,
|
|
3662
|
-
nativeToolChanges: [...lockedPreparation.preparedTargets.values()].flatMap((entry) => entry.target.nativeToolChanges ?? []),
|
|
3663
3736
|
catalogSources: catalog.sources.flatMap((source) => source.resolution ? [source.resolution] : []),
|
|
3664
3737
|
requirements,
|
|
3665
3738
|
scope: options.commandOptions.scope,
|
|
3666
3739
|
configDigests: lockedPreparation.configDigests,
|
|
3667
|
-
})
|
|
3740
|
+
});
|
|
3668
3741
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
3669
3742
|
try {
|
|
3670
3743
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, lockedOperationPlan);
|
|
@@ -3952,18 +4025,17 @@ async function runRebuildCommandInSession(options) {
|
|
|
3952
4025
|
});
|
|
3953
4026
|
lockedPreparation.integration.setNativeMarketplaceEligibleTargets(eligibleTargets);
|
|
3954
4027
|
}
|
|
3955
|
-
lockedOperationPlan =
|
|
4028
|
+
lockedOperationPlan = createRebuildOperationPlan({
|
|
3956
4029
|
dependencyPlan: lockedPlan,
|
|
3957
4030
|
codexPlans: lockedCodexPlans,
|
|
3958
4031
|
targetActions: lockedPreparation.targetActions,
|
|
3959
4032
|
deploymentPlans: lockedPreparation.deploymentPlans,
|
|
3960
4033
|
deploymentExclusions: lockedPreparation.deploymentExclusions,
|
|
3961
|
-
nativeToolChanges: [...lockedPreparation.preparedTargets.values()].flatMap((entry) => entry.target.nativeToolChanges ?? []),
|
|
3962
4034
|
catalogSources: catalog.sources.flatMap((source) => source.resolution ? [source.resolution] : []),
|
|
3963
4035
|
requirements,
|
|
3964
4036
|
scope: options.commandOptions.scope,
|
|
3965
4037
|
configDigests: lockedPreparation.configDigests,
|
|
3966
|
-
})
|
|
4038
|
+
});
|
|
3967
4039
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
3968
4040
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, lockedOperationPlan);
|
|
3969
4041
|
}
|
|
@@ -4464,7 +4536,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
4464
4536
|
try {
|
|
4465
4537
|
const commands = await nativeTargetExecution.beforeApply(identity);
|
|
4466
4538
|
recordTargetCommands(commands);
|
|
4467
|
-
if (commands.
|
|
4539
|
+
if (!commands.every(commandPackageProviderSatisfied)) {
|
|
4468
4540
|
packageFailure = 'commandPackageProviderNotSatisfied';
|
|
4469
4541
|
}
|
|
4470
4542
|
}
|
|
@@ -4475,7 +4547,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
4475
4547
|
recordTargetCommands(nativeTargetExecution.blocked?.(identity, packageFailure) ?? []);
|
|
4476
4548
|
}
|
|
4477
4549
|
if (packageFailure) {
|
|
4478
|
-
const result = failedResult(requestedMethod, identity, `${packageFailure}: ${entry.pluginId} requires a
|
|
4550
|
+
const result = failedResult(requestedMethod, identity, `${packageFailure}: ${entry.pluginId} requires a published command package.`);
|
|
4479
4551
|
record({
|
|
4480
4552
|
platforms: [platform], plugins: [], warnings: [], rebuildResults: [result],
|
|
4481
4553
|
targetResults: [{ ...toTargetResult(result), action: planned.action }],
|
|
@@ -4948,6 +5020,13 @@ async function runRebuildCommandInSession(options) {
|
|
|
4948
5020
|
}
|
|
4949
5021
|
};
|
|
4950
5022
|
const privatePackages = [];
|
|
5023
|
+
const reportPendingOpenCodeProjects = (interrupted) => {
|
|
5024
|
+
for (const notice of lockedPreparation.integration.pendingOpenCodeProjectNotices(interrupted)) {
|
|
5025
|
+
const rebuild = results.flatMap((result) => result.rebuildResults).find((entry) => entry.target.platform === 'opencode'
|
|
5026
|
+
&& entry.target.scope === 'user' && entry.target.pluginId === notice.subject?.pluginId);
|
|
5027
|
+
rebuild?.deploymentReceipts?.[0]?.diagnostics.push(notice);
|
|
5028
|
+
}
|
|
5029
|
+
};
|
|
4951
5030
|
try {
|
|
4952
5031
|
if (admission && options.runtime?.batchInstallPlatform) {
|
|
4953
5032
|
const selectedKeys = new Set(executionSelections.map((selection) => executionKey(selection, lockedPlan)));
|
|
@@ -4959,8 +5038,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
4959
5038
|
const resources = nativeInstallResources(deployment?.plans ?? []);
|
|
4960
5039
|
const producesCommands = target && nativeTargetExecution
|
|
4961
5040
|
&& (nativeTargetExecution.produces?.(target.identity) ?? true);
|
|
4962
|
-
if (
|
|
4963
|
-
|| target?.operationActions?.some((action) => action.kind === 'syncManagedCommandPackage')) {
|
|
5041
|
+
if (producesCommands || target?.operationActions?.some((action) => action.kind === 'syncManagedCommandPackage' || action.kind === 'removeManagedCommandPackage')) {
|
|
4964
5042
|
resources.push({ kind: 'path', value: path.join(resolveAwHome(runtimeEnv), 'commands') });
|
|
4965
5043
|
}
|
|
4966
5044
|
const leaves = [];
|
|
@@ -5044,11 +5122,13 @@ async function runRebuildCommandInSession(options) {
|
|
|
5044
5122
|
failCompletedCodexTarget({ identity: targetIdentity(selection, planTargetFor(lockedPlan, selection).resolvedScope),
|
|
5045
5123
|
message: `${code}: Codex postcheck did not complete.` });
|
|
5046
5124
|
}
|
|
5125
|
+
reportPendingOpenCodeProjects(true);
|
|
5047
5126
|
throw new RebuildInterruptedError(mergeRebuildCommandResults(results.filter(Boolean)), error);
|
|
5048
5127
|
}
|
|
5049
5128
|
finally {
|
|
5050
5129
|
await Promise.all(privatePackages.map((staging) => staging.dispose()));
|
|
5051
5130
|
}
|
|
5131
|
+
reportPendingOpenCodeProjects(false);
|
|
5052
5132
|
const merged = mergeRebuildCommandResults(results);
|
|
5053
5133
|
if (malformedSelectedConfigPreserved) {
|
|
5054
5134
|
merged.warnings.push(MALFORMED_CONFIG_PRESERVED_WARNING);
|
|
@@ -5120,18 +5200,24 @@ export async function runRebuildCommand(options) {
|
|
|
5120
5200
|
?? result.rebuildResults.flatMap((entry) => entry.deploymentExclusions ?? []);
|
|
5121
5201
|
if (exclusions.length)
|
|
5122
5202
|
result = { ...result, deploymentExclusions: exclusions };
|
|
5123
|
-
const byProducer = new Map();
|
|
5124
5203
|
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])] });
|
|
5204
|
+
const byPackage = new Map();
|
|
5205
|
+
for (const entry of [...retained, ...(result.commandResults ?? []), ...commandResults]) {
|
|
5206
|
+
byPackage.set(entry.packageId, entry);
|
|
5129
5207
|
}
|
|
5130
|
-
const commands = [...
|
|
5131
|
-
if (commands.length
|
|
5208
|
+
const commands = [...byPackage.values()];
|
|
5209
|
+
if (!commands.length)
|
|
5132
5210
|
return result;
|
|
5133
|
-
|
|
5134
|
-
|
|
5211
|
+
let overallState = result.overallState;
|
|
5212
|
+
if (commands.some((entry) => entry.state !== 'completed')) {
|
|
5213
|
+
const completedWork = result.targetResults.some((entry) => entry.state === 'completed')
|
|
5214
|
+
|| commands.some((entry) => entry.state !== 'failed');
|
|
5215
|
+
overallState = completedWork ? 'partial' : 'failed';
|
|
5216
|
+
}
|
|
5217
|
+
else if (overallState === 'failed' && commands.some((entry) => entry.action !== 'unchanged')) {
|
|
5218
|
+
overallState = 'partial';
|
|
5219
|
+
}
|
|
5220
|
+
return { ...result, commandResults: commands, overallState };
|
|
5135
5221
|
};
|
|
5136
5222
|
const scopedOptions = {
|
|
5137
5223
|
...options,
|