@lesliechan721/aw 0.1.0-beta.92 → 0.1.0-beta.94
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/scripts/validate-plugin.mjs +3 -0
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +2 -1
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/deployment-confirmation.js +13 -0
- package/dist/src/commands/deployment-confirmation.js.map +1 -1
- package/dist/src/commands/offline-cleanup-evidence.d.ts +1 -1
- package/dist/src/commands/offline-cleanup-evidence.js +30 -31
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
- package/dist/src/commands/operation-plan.d.ts +5 -0
- package/dist/src/commands/operation-plan.js +2 -0
- package/dist/src/commands/operation-plan.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +7 -2
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-lifecycle-result.js +18 -1
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/commands/public-lifecycle.js +3 -1
- package/dist/src/commands/public-lifecycle.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +9 -16
- package/dist/src/commands/rebuild-command.js +149 -92
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +1 -0
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +4 -0
- package/dist/src/commands/rebuild-platform-integration.js +106 -60
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
- package/dist/src/commands/status-v6.js +7 -4
- package/dist/src/commands/status-v6.js.map +1 -1
- package/dist/src/generators/local-plugin.js +20 -12
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/output/component-delivery.js +3 -0
- package/dist/src/output/component-delivery.js.map +1 -1
- package/dist/src/output/skill-invocation-notices.d.ts +1 -1
- package/dist/src/output/skill-invocation-notices.js +5 -5
- package/dist/src/output/skill-invocation-notices.js.map +1 -1
- package/dist/src/platforms/capabilities.d.ts +7 -15
- package/dist/src/platforms/capabilities.js +62 -265
- package/dist/src/platforms/capabilities.js.map +1 -1
- package/dist/src/platforms/contracts.d.ts +29 -43
- package/dist/src/platforms/discovery.d.ts +2 -0
- package/dist/src/platforms/discovery.js.map +1 -1
- package/dist/src/platforms/inspection-native.d.ts +4 -2
- package/dist/src/platforms/inspection-native.js +228 -24
- package/dist/src/platforms/inspection-native.js.map +1 -1
- package/dist/src/platforms/inspection-pi.js +22 -14
- package/dist/src/platforms/inspection-pi.js.map +1 -1
- package/dist/src/platforms/layout.js +15 -0
- package/dist/src/platforms/layout.js.map +1 -1
- package/dist/src/platforms/lifecycle-native-services.js +68 -2
- package/dist/src/platforms/lifecycle-native-services.js.map +1 -1
- package/dist/src/platforms/lifecycle-native.js +12 -1
- package/dist/src/platforms/lifecycle-native.js.map +1 -1
- package/dist/src/platforms/lifecycle.d.ts +3 -1
- package/dist/src/platforms/lifecycle.js +133 -12
- package/dist/src/platforms/lifecycle.js.map +1 -1
- package/dist/src/platforms/projection-files.d.ts +4 -3
- package/dist/src/platforms/projection-files.js +7 -5
- package/dist/src/platforms/projection-files.js.map +1 -1
- package/dist/src/platforms/projection.js +6 -4
- package/dist/src/platforms/projection.js.map +1 -1
- package/dist/src/platforms/retirement-native.d.ts +6 -0
- package/dist/src/platforms/retirement-native.js +95 -0
- package/dist/src/platforms/retirement-native.js.map +1 -0
- package/dist/src/platforms/supplement-layout.js +8 -7
- package/dist/src/platforms/supplement-layout.js.map +1 -1
- package/dist/src/portable/materializer.js +1 -1
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/recovery/receipt.d.ts +2 -0
- package/dist/src/recovery/receipt.js.map +1 -1
- package/dist/src/recovery/retirement.js +58 -22
- package/dist/src/recovery/retirement.js.map +1 -1
- package/dist/src/recovery/status.js +14 -3
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/review/platform-profile.d.ts +2 -3
- package/dist/src/review/platform-profile.js +4 -15
- package/dist/src/review/platform-profile.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +1 -0
- package/dist/src/review/skill-materialization.js +15 -7
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/review/source-binding.d.ts +4 -2
- package/dist/src/review/source-binding.js +11 -2
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/catalog-generation.d.ts +4 -1
- package/dist/src/tui/catalog-generation.js +34 -0
- package/dist/src/tui/catalog-generation.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +52 -17
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +16 -8
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +2 -1
- package/dist/src/tui/controller.js +14 -5
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/deployment-view.d.ts +1 -0
- package/dist/src/tui/deployment-view.js +23 -3
- package/dist/src/tui/deployment-view.js.map +1 -1
- package/dist/src/tui/entity-cards.js +7 -1
- package/dist/src/tui/entity-cards.js.map +1 -1
- package/dist/src/tui/model.d.ts +6 -1
- package/dist/src/tui/model.js +18 -5
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/scoped-inventory.d.ts +9 -1
- package/dist/src/tui/scoped-inventory.js +16 -1
- package/dist/src/tui/scoped-inventory.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +4 -3
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +3 -3
- package/dist/src/utils/artifact-renderer.js +16 -18
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +3 -3
- package/dist/src/utils/catalog-source-references.d.ts +37 -1
- package/dist/src/utils/catalog-source-references.js +361 -94
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/codex-config.d.ts +3 -0
- package/dist/src/utils/codex-config.js +7 -0
- package/dist/src/utils/codex-config.js.map +1 -1
- package/dist/src/utils/component-agent-binding.d.ts +17 -0
- package/dist/src/utils/component-agent-binding.js +119 -0
- package/dist/src/utils/component-agent-binding.js.map +1 -0
- package/dist/src/utils/component-command-preparation.d.ts +2 -0
- package/dist/src/utils/component-command-preparation.js +18 -16
- package/dist/src/utils/component-command-preparation.js.map +1 -1
- package/dist/src/utils/component-gap.js +0 -4
- package/dist/src/utils/component-gap.js.map +1 -1
- package/dist/src/utils/component-resources.d.ts +9 -7
- package/dist/src/utils/component-resources.js +22 -1
- package/dist/src/utils/component-resources.js.map +1 -1
- package/dist/src/utils/local-marketplace.d.ts +2 -0
- package/dist/src/utils/local-marketplace.js +12 -0
- package/dist/src/utils/local-marketplace.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +2 -2
- package/dist/src/utils/platform-empty-state.js +42 -19
- package/dist/src/utils/platform-empty-state.js.map +1 -1
- package/dist/src/utils/skill-invocation-warning.d.ts +3 -4
- package/dist/src/utils/skill-invocation-warning.js +11 -36
- package/dist/src/utils/skill-invocation-warning.js.map +1 -1
- package/package.json +3 -3
|
@@ -11,18 +11,19 @@ import { isPermissionHost } from '../platforms/host-permission-policy.js';
|
|
|
11
11
|
import { missingPermissionOwnershipWarning, pendingRelatedProjectNotices, relatedProjectPermissionNotices, reviewPermissionRemovals, updateHostPermissions } from '../platforms/permission-ownership.js';
|
|
12
12
|
import { permissionConflict, permissionFailureNotice } from '../platforms/permission-sidecar.js';
|
|
13
13
|
import { resolvePlatformConfigRoot } from '../platforms/discovery.js';
|
|
14
|
-
import { getDeploymentLayout, scopedPermissionPath } from '../platforms/layout.js';
|
|
14
|
+
import { getDeploymentLayout, hasSharedUserPackage, scopedPermissionPath } from '../platforms/layout.js';
|
|
15
15
|
import { createNoopDebugLogger } from '../output/debug-log.js';
|
|
16
16
|
import { createNoopReporter } from '../output/reporter.js';
|
|
17
17
|
import { getCodexOperationRequirement, probeAgentVersion } from '../utils/agent-version.js';
|
|
18
18
|
import { resolveArtifactRenderConfig } from '../utils/artifact-renderer.js';
|
|
19
19
|
import { configIssueDiagnostic, configReadDiagnostic } from '../utils/plugin-config-diagnostics.js';
|
|
20
|
+
import { withAwHomeMutationLock } from '../utils/aw-home-mutation-lock.js';
|
|
20
21
|
import { catalogGenerationErrorCode, isOfflineCleanupCatalogGenerationError, } from '../utils/catalog-generation-error.js';
|
|
21
22
|
import { resolveActiveCatalogGeneration, resolveActiveCatalogPluginShallow } from '../utils/catalog-generation-resolver.js';
|
|
22
23
|
import { CatalogPreparationReadScope, resolveCatalogOperationContext, } from '../utils/catalog-operation-context.js';
|
|
23
24
|
import { sanitizeCatalogSourceErrorMessage } from '../utils/catalog-public-error.js';
|
|
24
25
|
import { validateCatalogSnapshotComplete } from '../utils/catalog-snapshot.js';
|
|
25
|
-
import { assertCatalogSourceInventoryComplete,
|
|
26
|
+
import { assertCatalogSourceInventoryComplete, resolveCleanupMarketplaceIdentity, scopedCleanupMarketplaceEvidence, inventoryCatalogSourceReferences, offlineOwnedPathEvidence, } from '../utils/catalog-source-references.js';
|
|
26
27
|
import { readCatalogSourcesConfigSnapshot } from '../utils/catalog-sources.js';
|
|
27
28
|
import { readCodexConfigFile } from '../utils/codex-config.js';
|
|
28
29
|
import { previewCodexManager, resolveCodexOperationConsumer, } from '../utils/codex-manager.js';
|
|
@@ -616,10 +617,10 @@ function mergeRebuildCommandResults(results) {
|
|
|
616
617
|
: {}),
|
|
617
618
|
};
|
|
618
619
|
}
|
|
619
|
-
function hasRebuildMutation(result) {
|
|
620
|
+
export function hasRebuildMutation(result) {
|
|
620
621
|
return result.removed.length > 0 || result.quarantined.length > 0
|
|
621
622
|
|| result.cleanupMutation !== undefined
|
|
622
|
-
|| (result.deploymentReceipts ?? []).some((receipt) => receipt.effects.some((effect) => effect.mutation
|
|
623
|
+
|| (result.deploymentReceipts ?? []).some((receipt) => receipt.effects.some((effect) => effect.mutation !== 'none'))
|
|
623
624
|
|| result.actions.some((action) => action.status === 'succeeded'
|
|
624
625
|
&& (action.name === 'native.write' || action.name === 'artifacts.write'));
|
|
625
626
|
}
|
|
@@ -796,7 +797,7 @@ function cleanupIntentResult(target) {
|
|
|
796
797
|
cleanupAttempted: false,
|
|
797
798
|
removed: [],
|
|
798
799
|
absent: [],
|
|
799
|
-
residual: [],
|
|
800
|
+
residual: target.marketplaceIdentityUnresolved ? ['nativeMarketplaceIdentityUnresolved'] : [],
|
|
800
801
|
quarantined: [],
|
|
801
802
|
failures: [],
|
|
802
803
|
};
|
|
@@ -928,54 +929,40 @@ function resolveLiveCleanupTargets(options) {
|
|
|
928
929
|
const selectors = options.selectors.map((value) => {
|
|
929
930
|
const parsed = parsePluginId(value);
|
|
930
931
|
const matchesByTarget = new Map();
|
|
932
|
+
const targetFor = (sourceId, platform, sourceIdentity) => {
|
|
933
|
+
const registeredIdentities = new Set(options.references.flatMap((entry) => entry.kind === 'namespacedMarketplace' && entry.sourceId === sourceId
|
|
934
|
+
&& (entry.platform === undefined || entry.platform === platform)
|
|
935
|
+
&& entry.sourceIdentity ? [entry.sourceIdentity] : []));
|
|
936
|
+
const stableSourceIdentity = sourceIdentity
|
|
937
|
+
?? (registeredIdentities.size === 1 ? [...registeredIdentities][0] : 'unavailable');
|
|
938
|
+
return {
|
|
939
|
+
pluginId: formatPluginId({ sourceId, pluginName: parsed.pluginName }),
|
|
940
|
+
pluginName: parsed.pluginName, sourceId, sourceIdentity: stableSourceIdentity, platform, scope: options.scope,
|
|
941
|
+
...resolveCleanupMarketplaceIdentity({
|
|
942
|
+
references: options.references, sourceId, sourceIdentity: stableSourceIdentity,
|
|
943
|
+
pluginName: parsed.pluginName, platform, scope: options.scope,
|
|
944
|
+
}),
|
|
945
|
+
};
|
|
946
|
+
};
|
|
931
947
|
for (const reference of visible.filter((entry) => entry.pluginName === parsed.pluginName
|
|
932
948
|
&& (parsed.sourceId === undefined || entry.sourceId === parsed.sourceId))) {
|
|
933
|
-
const
|
|
934
|
-
const
|
|
935
|
-
? reference.sourceIdentity ?? registeredSourceIdentity ?? 'unavailable'
|
|
936
|
-
: registeredSourceIdentity ?? reference.sourceIdentity ?? 'unavailable';
|
|
937
|
-
const liveNames = new Set(options.references.flatMap((candidate) => candidate.sourceId === reference.sourceId
|
|
938
|
-
&& candidate.pluginName === reference.pluginName
|
|
939
|
-
&& candidate.platform === reference.platform
|
|
940
|
-
&& candidate.scope === reference.scope
|
|
941
|
-
&& candidate.marketplaceName
|
|
942
|
-
? [candidate.marketplaceName]
|
|
943
|
-
: []));
|
|
944
|
-
const registeredNames = canonicalMarketplaceRegistrationNames(options.references, reference.sourceId);
|
|
945
|
-
const unboundNativeNames = new Set(options.references.flatMap((candidate) => candidate.kind === 'namespacedMarketplace'
|
|
946
|
-
&& candidate.sourceId === undefined
|
|
947
|
-
&& candidate.pluginName === reference.pluginName
|
|
948
|
-
&& candidate.platform === reference.platform
|
|
949
|
-
&& candidate.scope === reference.scope
|
|
950
|
-
&& candidate.marketplaceName
|
|
951
|
-
? [candidate.marketplaceName]
|
|
952
|
-
: []));
|
|
953
|
-
const marketplaceName = liveNames.size === 1
|
|
954
|
-
? [...liveNames][0]
|
|
955
|
-
: liveNames.size === 0 && registeredNames.length === 1
|
|
956
|
-
? registeredNames[0]
|
|
957
|
-
: undefined;
|
|
958
|
-
const marketplaceIdentityUnresolved = liveNames.size > 1
|
|
959
|
-
|| (liveNames.size === 0 && registeredNames.length > 1)
|
|
960
|
-
|| (liveNames.size === 0 && registeredNames.length === 0 && unboundNativeNames.size > 0);
|
|
961
|
-
const target = {
|
|
962
|
-
pluginId: formatPluginId({ sourceId: reference.sourceId, pluginName: reference.pluginName }),
|
|
963
|
-
pluginName: reference.pluginName,
|
|
964
|
-
sourceId: reference.sourceId,
|
|
965
|
-
sourceIdentity: stableSourceIdentity,
|
|
966
|
-
platform: reference.platform,
|
|
967
|
-
scope: reference.scope,
|
|
968
|
-
...(marketplaceName ? { marketplaceName } : {}),
|
|
969
|
-
...((liveNames.size === 1
|
|
970
|
-
|| (marketplaceName !== undefined && unboundNativeNames.has(marketplaceName)))
|
|
971
|
-
? { nativeRegistration: true }
|
|
972
|
-
: {}),
|
|
973
|
-
...(marketplaceIdentityUnresolved ? { marketplaceIdentityUnresolved: true } : {}),
|
|
974
|
-
};
|
|
975
|
-
const key = [target.pluginId, target.sourceIdentity, target.platform, target.scope].join('\0');
|
|
949
|
+
const target = targetFor(reference.sourceId, reference.platform, reference.sourceIdentity ?? reference.ownedComponent?.identity.sourceIdentity);
|
|
950
|
+
const key = offlineCleanupKey(target);
|
|
976
951
|
const previous = matchesByTarget.get(key);
|
|
977
952
|
matchesByTarget.set(key, previous?.marketplaceName ? previous : target);
|
|
978
953
|
}
|
|
954
|
+
// A qualified request can have only an unbound host activation left. It
|
|
955
|
+
// still needs a diagnostic target, but that clue never grants ownership.
|
|
956
|
+
if (parsed.sourceId)
|
|
957
|
+
for (const platform of options.platforms) {
|
|
958
|
+
if ([...matchesByTarget.values()].some((target) => target.platform === platform)
|
|
959
|
+
|| !scopedCleanupMarketplaceEvidence({ references: options.references, pluginName: parsed.pluginName,
|
|
960
|
+
platform, scope: options.scope }).unboundConsumers.length)
|
|
961
|
+
continue;
|
|
962
|
+
const target = targetFor(parsed.sourceId, platform);
|
|
963
|
+
if (target.marketplaceIdentityUnresolved)
|
|
964
|
+
matchesByTarget.set(offlineCleanupKey(target), target);
|
|
965
|
+
}
|
|
979
966
|
const matches = [...matchesByTarget.values()];
|
|
980
967
|
const identities = [...new Set(matches.map((target) => target.pluginId))];
|
|
981
968
|
if (parsed.sourceId === undefined && identities.length > 1) {
|
|
@@ -991,6 +978,11 @@ function resolveLiveCleanupTargets(options) {
|
|
|
991
978
|
].join('\0'), target])).values()],
|
|
992
979
|
};
|
|
993
980
|
}
|
|
981
|
+
function cleanupMarketplaceIdentityWarnings(targets) {
|
|
982
|
+
return targets.flatMap((target) => target.marketplaceIdentityUnresolved
|
|
983
|
+
? [`nativeMarketplaceIdentityUnresolved: Preserved ambiguous native registration for ${target.pluginId} on ${target.platform}/${target.scope}.`]
|
|
984
|
+
: []);
|
|
985
|
+
}
|
|
994
986
|
function offlineCleanupKey(target) {
|
|
995
987
|
return [target.pluginId, target.sourceIdentity, target.platform, target.scope].join('\0');
|
|
996
988
|
}
|
|
@@ -1000,6 +992,7 @@ function needsFrozenNativeRemoval(candidate) {
|
|
|
1000
992
|
async function prepareOfflineNativeCleanup(options) {
|
|
1001
993
|
const candidates = options.evidence.flatMap((target) => target.plan.actions.flatMap((action) => action.recoveryCandidate && needsFrozenNativeRemoval(action.recoveryCandidate) ? [action.recoveryCandidate] : []));
|
|
1002
994
|
const context = { ...options.runtime, env: options.env,
|
|
995
|
+
confirmedCatalogRetirement: options.retirementNativePlatforms ? true : undefined,
|
|
1003
996
|
nativeCliRunner: options.runtime?.nativeCliRunner ?? getDefaultNativeCliRunner(),
|
|
1004
997
|
reporter: createNoopReporter(), debugLogger: createNoopDebugLogger(), recoveryCandidates: candidates,
|
|
1005
998
|
sharedReferenceView: options.runtime?.executionInput?.requirements.sharedReferenceView ?? options.runtime?.sharedReferenceView };
|
|
@@ -1008,9 +1001,10 @@ async function prepareOfflineNativeCleanup(options) {
|
|
|
1008
1001
|
const deploymentExclusions = [];
|
|
1009
1002
|
const warnings = [];
|
|
1010
1003
|
for (const evidence of options.evidence) {
|
|
1011
|
-
if (!
|
|
1012
|
-
&& candidate
|
|
1013
|
-
|
|
1004
|
+
if (!options.retirementNativePlatforms?.includes(evidence.platform)
|
|
1005
|
+
&& !candidates.some((candidate) => candidate.binding.plugin.sourceIdentity === evidence.sourceIdentity
|
|
1006
|
+
&& candidate.binding.plugin.pluginId === evidence.pluginId && candidate.binding.platform === evidence.platform
|
|
1007
|
+
&& candidate.binding.scope.kind === evidence.scope))
|
|
1014
1008
|
continue;
|
|
1015
1009
|
const plugin = createSyntheticPlugin(evidence.pluginName, options.env);
|
|
1016
1010
|
plugin.sourceId = evidence.sourceId;
|
|
@@ -1087,6 +1081,15 @@ async function cleanupOfflineOwnedComponents(options) {
|
|
|
1087
1081
|
&& candidate.platform === target.platform
|
|
1088
1082
|
&& candidate.scope === target.scope);
|
|
1089
1083
|
const nativeTarget = options.nativePreparation?.targets.get(offlineCleanupKey(target));
|
|
1084
|
+
// Confirmed retirement needs verified native observations, including when
|
|
1085
|
+
// the package is already gone. Never downgrade a failed retirement to
|
|
1086
|
+
// an offline activation edit with weaker evidence.
|
|
1087
|
+
if (options.retirementNativePlatforms?.includes(target.platform) && !nativeTarget?.platformDeployment) {
|
|
1088
|
+
results.push(failedResult('cleanup', {
|
|
1089
|
+
...target, pluginVersion: '0.0.0', cwd: options.cwd,
|
|
1090
|
+
}, 'removedPluginNativeOwnershipUnavailable: Native retirement evidence could not be established.', 'preflight', options.nativePreparation?.deploymentExclusions.filter((entry) => entry.pluginId === target.pluginId && entry.platform === target.platform && entry.scope.kind === target.scope)));
|
|
1091
|
+
continue;
|
|
1092
|
+
}
|
|
1090
1093
|
const cleanupContext = { cwd: options.cwd, env: options.env };
|
|
1091
1094
|
const permissionNotice = !nativeTarget && isPermissionHost(target.platform) && (target.platform !== 'antigravity' || target.scope === 'user')
|
|
1092
1095
|
? 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)
|
|
@@ -1230,7 +1233,8 @@ async function cleanupOfflineOwnedComponents(options) {
|
|
|
1230
1233
|
const nativeResult = nativeTarget ? await (options.executeCleanupOperation ?? executeRebuildOperation)({
|
|
1231
1234
|
command: 'cleanup', target: nativeTarget, driver: options.nativePreparation.integration.driver,
|
|
1232
1235
|
}) : undefined;
|
|
1233
|
-
if (nativeResult?.status === 'failed' && nativeResult.error.phase === 'preflight'
|
|
1236
|
+
if (nativeResult?.status === 'failed' && (nativeResult.error.phase === 'preflight'
|
|
1237
|
+
|| options.retirementNativePlatforms?.includes(target.platform))) {
|
|
1234
1238
|
results.push(nativeResult);
|
|
1235
1239
|
continue;
|
|
1236
1240
|
}
|
|
@@ -1364,9 +1368,7 @@ async function cleanupOfflineOwnedComponents(options) {
|
|
|
1364
1368
|
async function previewOfflineOwnedComponents(options) {
|
|
1365
1369
|
await options.onPreviewStage?.('inventory');
|
|
1366
1370
|
const preview = mergeRebuildCommandResults([]);
|
|
1367
|
-
preview.warnings.push(...options.targets
|
|
1368
|
-
? [`nativeMarketplaceIdentityUnresolved: Preserved ambiguous native registration for ${target.pluginId} on ${target.platform}/${target.scope}.`]
|
|
1369
|
-
: []));
|
|
1371
|
+
preview.warnings.push(...cleanupMarketplaceIdentityWarnings(options.targets));
|
|
1370
1372
|
if (options.evidence) {
|
|
1371
1373
|
preview.offlineCleanupPlans = options.evidence;
|
|
1372
1374
|
preview.operationPlan = createOfflineCleanupOperationPlan(options.evidence);
|
|
@@ -1374,7 +1376,7 @@ async function previewOfflineOwnedComponents(options) {
|
|
|
1374
1376
|
await options.onPreviewStage?.('dependencyPlan');
|
|
1375
1377
|
return preview;
|
|
1376
1378
|
}
|
|
1377
|
-
function createOfflineCleanupOperationPlan(evidence, requirements, warnings = [], retainedPackages = [], nativePreparation) {
|
|
1379
|
+
function createOfflineCleanupOperationPlan(evidence, requirements, warnings = [], retainedPackages = [], nativePreparation, retirement) {
|
|
1378
1380
|
const reviewedActions = (target) => target.plan.actions.filter((action) => {
|
|
1379
1381
|
const prepared = nativePreparation?.targets.get(offlineCleanupKey(target));
|
|
1380
1382
|
if (!prepared)
|
|
@@ -1418,6 +1420,9 @@ function createOfflineCleanupOperationPlan(evidence, requirements, warnings = []
|
|
|
1418
1420
|
: [])),
|
|
1419
1421
|
warnings: [...warnings, ...nativePreparation?.warnings ?? []],
|
|
1420
1422
|
evidence: {
|
|
1423
|
+
...(retirement ? { confirmedCatalogRetirement: {
|
|
1424
|
+
pluginId: retirement.pluginId, snapshotDigest: retirement.snapshotDigest,
|
|
1425
|
+
} } : {}),
|
|
1421
1426
|
catalogDigests: evidence.map((target) => ({
|
|
1422
1427
|
sourceId: target.sourceId,
|
|
1423
1428
|
digest: target.sourceIdentity,
|
|
@@ -1709,6 +1714,7 @@ export async function inspectRemovedPluginCleanup(options) {
|
|
|
1709
1714
|
let generation;
|
|
1710
1715
|
try {
|
|
1711
1716
|
generation = await resolveActiveCatalogGeneration({ sourceId: parsed.sourceId, env: options.env });
|
|
1717
|
+
await validateCatalogSnapshotComplete(generation.snapshotPath);
|
|
1712
1718
|
}
|
|
1713
1719
|
catch {
|
|
1714
1720
|
return null;
|
|
@@ -1745,41 +1751,64 @@ export async function inspectRemovedPluginCleanup(options) {
|
|
|
1745
1751
|
}
|
|
1746
1752
|
}
|
|
1747
1753
|
const evidence = [];
|
|
1754
|
+
const nativePlatforms = [];
|
|
1755
|
+
const marketplaceNames = {};
|
|
1748
1756
|
for (const platform of NATIVE_PLATFORM_TARGETS) {
|
|
1749
1757
|
const base = offlineCleanupEvidenceFromInventory({ reason: 'bundleUnavailable', pluginId,
|
|
1750
1758
|
pluginName: parsed.pluginName, sourceId: parsed.sourceId, sourceIdentity: generation.sourceIdentity,
|
|
1751
1759
|
platform, scope: options.scope, inventory: options.inventory });
|
|
1752
|
-
|
|
1760
|
+
// Shared user packages can also be inherited by this project without an
|
|
1761
|
+
// independent local owner marker. Canonical consumer records (including
|
|
1762
|
+
// disabled activation) still identify targets after the package is gone.
|
|
1763
|
+
const nativeReferences = hasSharedUserPackage(platform) && options.inventory.references.some((reference) => reference.platform === platform && reference.pluginName === parsed.pluginName
|
|
1764
|
+
&& !reference.disabledNativeActivation
|
|
1765
|
+
&& (reference.sourceId === parsed.sourceId || reference.sourceId === undefined
|
|
1766
|
+
&& reference.marketplaceName === getNamespacedMarketplaceName(parsed.sourceId))
|
|
1767
|
+
&& (reference.kind === 'namespacedMarketplace'
|
|
1768
|
+
|| reference.kind === 'namespacedOwner' && reference.recoveryCandidate?.evidence === 'verified')
|
|
1769
|
+
&& (reference.scope === options.scope || options.scope === 'project' && reference.scope === 'user'));
|
|
1770
|
+
if (!base && !nativeReferences)
|
|
1753
1771
|
continue;
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
if (
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1772
|
+
if (nativeReferences)
|
|
1773
|
+
nativePlatforms.push(platform);
|
|
1774
|
+
const identity = resolveCleanupMarketplaceIdentity({
|
|
1775
|
+
references: options.inventory.references, sourceId: parsed.sourceId,
|
|
1776
|
+
sourceIdentity: generation.sourceIdentity, pluginName: parsed.pluginName, platform, scope: options.scope,
|
|
1777
|
+
});
|
|
1778
|
+
if (identity.marketplaceName)
|
|
1779
|
+
marketplaceNames[platform] = identity.marketplaceName;
|
|
1780
|
+
const cleanup = base ?? intentOnlyOfflineCleanupEvidence({
|
|
1781
|
+
pluginId, pluginName: parsed.pluginName, sourceId: parsed.sourceId, sourceIdentity: generation.sourceIdentity,
|
|
1782
|
+
platform, scope: options.scope,
|
|
1783
|
+
});
|
|
1784
|
+
// Retirement never executes the weaker offline registration actions.
|
|
1785
|
+
// The platform plan must establish package or canonical marketplace
|
|
1786
|
+
// ownership before withdrawing any registration or activation.
|
|
1787
|
+
const actions = ownershipConflict ? [] : cleanup.plan.actions.filter((action) => action.action !== 'removeNativeRegistration');
|
|
1788
|
+
const plan = { ...cleanup.plan, actions };
|
|
1789
|
+
const planDigest = removedCleanupDigest(plan);
|
|
1790
|
+
evidence.push({ ...cleanup, plan, planDigest, targetFingerprint: planDigest });
|
|
1764
1791
|
}
|
|
1765
|
-
const first = candidates[0];
|
|
1766
|
-
const firstLayout = first ? await getDeploymentLayout({ cwd: options.cwd, env: options.env }, first.binding) : undefined;
|
|
1767
1792
|
return {
|
|
1768
1793
|
pluginId, pluginName: parsed.pluginName, sourceId: parsed.sourceId,
|
|
1769
1794
|
sourceIdentity: generation.sourceIdentity, logicalIdentity: generation.logicalIdentity,
|
|
1770
1795
|
snapshotDigest: generation.snapshotDigest,
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
claudeNativeCleanupBlocked: false, nativeState: 'unbound',
|
|
1776
|
-
nativeObservationFingerprint: removedCleanupDigest(candidates),
|
|
1777
|
-
marketplaceEvidenceFingerprint: removedCleanupDigest(candidates.map((candidate) => candidate.physicalIdentity)),
|
|
1778
|
-
projectionFingerprint: removedCleanupDigest(evidence), projectionPresent: false, activationScopes: [],
|
|
1796
|
+
...(!ownershipConflict ? { confirmedCatalogRetirement: true } : {}),
|
|
1797
|
+
nativePlatforms,
|
|
1798
|
+
marketplaceNames,
|
|
1799
|
+
projectionFingerprint: removedCleanupDigest({ evidence, marketplaceNames, nativePlatforms }),
|
|
1779
1800
|
configTargets, evidence, blockers,
|
|
1780
1801
|
};
|
|
1781
1802
|
}
|
|
1782
1803
|
export async function executeRemovedPluginOutputCleanup(options) {
|
|
1804
|
+
if (options.runtime?.previewOperationPlan)
|
|
1805
|
+
return removedPluginOutputCleanupInContext(options);
|
|
1806
|
+
return withAwHomeMutationLock({ env: options.context.env, token: options.runtime?.awHomeMutationToken,
|
|
1807
|
+
signal: options.runtime?.signal, action: (token) => removedPluginOutputCleanupInContext({
|
|
1808
|
+
...options, runtime: { ...options.runtime, awHomeMutationToken: token },
|
|
1809
|
+
}) });
|
|
1810
|
+
}
|
|
1811
|
+
async function removedPluginOutputCleanupInContext(options) {
|
|
1783
1812
|
const selected = options.selectedTargets.filter((target) => target.pluginId === options.target.pluginId && target.scope === options.context.scope);
|
|
1784
1813
|
const retainedPackages = await discoverRetainedManagedCommandPackages({
|
|
1785
1814
|
selectors: [{ sourceId: options.target.sourceId, pluginName: options.target.pluginName }],
|
|
@@ -1789,7 +1818,7 @@ export async function executeRemovedPluginOutputCleanup(options) {
|
|
|
1789
1818
|
...entry, kind: 'retainManagedCommandPackage', pluginId: options.target.pluginId,
|
|
1790
1819
|
scope: 'user',
|
|
1791
1820
|
}));
|
|
1792
|
-
const withRetainedPackages = (result, operationPlan
|
|
1821
|
+
const withRetainedPackages = (result, operationPlan) => {
|
|
1793
1822
|
result.operationPlan = operationPlan;
|
|
1794
1823
|
if (operationPlan.deploymentExclusions?.length)
|
|
1795
1824
|
result.deploymentExclusions = operationPlan.deploymentExclusions;
|
|
@@ -1804,8 +1833,6 @@ export async function executeRemovedPluginOutputCleanup(options) {
|
|
|
1804
1833
|
}
|
|
1805
1834
|
return result;
|
|
1806
1835
|
};
|
|
1807
|
-
if (selected.length === 0)
|
|
1808
|
-
return withRetainedPackages(mergeRebuildCommandResults([]));
|
|
1809
1836
|
const inventoryReader = options.runtime?.inventoryCatalogSourceReferences
|
|
1810
1837
|
?? inventoryCatalogSourceReferences;
|
|
1811
1838
|
const inventory = await inventoryReader({
|
|
@@ -1824,6 +1851,9 @@ export async function executeRemovedPluginOutputCleanup(options) {
|
|
|
1824
1851
|
codexManager: options.runtime?.codexManager,
|
|
1825
1852
|
});
|
|
1826
1853
|
if (!current || current.sourceIdentity !== options.target.sourceIdentity
|
|
1854
|
+
|| current.logicalIdentity !== options.target.logicalIdentity
|
|
1855
|
+
|| current.snapshotDigest !== options.target.snapshotDigest
|
|
1856
|
+
|| current.confirmedCatalogRetirement !== options.target.confirmedCatalogRetirement
|
|
1827
1857
|
|| current.projectionFingerprint !== options.target.projectionFingerprint
|
|
1828
1858
|
|| current.evidence.some((entry) => {
|
|
1829
1859
|
const expected = options.target.evidence.find((candidate) => candidate.platform === entry.platform && candidate.scope === entry.scope);
|
|
@@ -1831,6 +1861,11 @@ export async function executeRemovedPluginOutputCleanup(options) {
|
|
|
1831
1861
|
})) {
|
|
1832
1862
|
throw new Error('operationReviewStale: removed plugin ownership or output changed before cleanup.');
|
|
1833
1863
|
}
|
|
1864
|
+
if (!current.confirmedCatalogRetirement) {
|
|
1865
|
+
if (!options.runtime?.previewOperationPlan)
|
|
1866
|
+
throw new Error('removedPluginOwnershipConflict');
|
|
1867
|
+
return withRetainedPackages(mergeRebuildCommandResults([]), createOfflineCleanupOperationPlan([], undefined, current.blockers, retainedActions));
|
|
1868
|
+
}
|
|
1834
1869
|
const evidence = current.evidence.filter((entry) => selected.some((target) => target.platform === entry.platform && target.scope === entry.scope));
|
|
1835
1870
|
const targets = evidence.map((entry) => ({
|
|
1836
1871
|
pluginId: current.pluginId,
|
|
@@ -1839,15 +1874,17 @@ export async function executeRemovedPluginOutputCleanup(options) {
|
|
|
1839
1874
|
sourceIdentity: current.sourceIdentity,
|
|
1840
1875
|
platform: entry.platform,
|
|
1841
1876
|
scope: entry.scope,
|
|
1842
|
-
...(current.
|
|
1877
|
+
...(current.marketplaceNames[entry.platform] ? { marketplaceName: current.marketplaceNames[entry.platform] } : {}),
|
|
1843
1878
|
nativeRegistration: entry.platform === 'codex',
|
|
1844
1879
|
}));
|
|
1845
1880
|
const nativePreparation = await prepareOfflineNativeCleanup({ evidence, cwd: options.context.executionCwd,
|
|
1846
|
-
env: options.context.env, runtime: options.runtime });
|
|
1847
|
-
const operationPlan = createOfflineCleanupOperationPlan(evidence, undefined, [], retainedActions, nativePreparation);
|
|
1881
|
+
env: options.context.env, runtime: options.runtime, retirementNativePlatforms: current.nativePlatforms });
|
|
1882
|
+
const operationPlan = createOfflineCleanupOperationPlan(evidence, undefined, [], retainedActions, nativePreparation, current);
|
|
1848
1883
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
1849
1884
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
|
|
1850
1885
|
}
|
|
1886
|
+
if (selected.length === 0)
|
|
1887
|
+
return withRetainedPackages(mergeRebuildCommandResults([]), operationPlan);
|
|
1851
1888
|
const result = options.runtime?.previewOperationPlan
|
|
1852
1889
|
? await previewOfflineOwnedComponents({
|
|
1853
1890
|
targets,
|
|
@@ -1862,6 +1899,7 @@ export async function executeRemovedPluginOutputCleanup(options) {
|
|
|
1862
1899
|
targets,
|
|
1863
1900
|
evidence,
|
|
1864
1901
|
nativePreparation,
|
|
1902
|
+
retirementNativePlatforms: current.nativePlatforms,
|
|
1865
1903
|
inventoryErrors: inventory.errors.filter((error) => !error.kind.startsWith('config')),
|
|
1866
1904
|
cwd: options.context.executionCwd,
|
|
1867
1905
|
env: options.context.env,
|
|
@@ -2022,7 +2060,6 @@ async function runRebuildCommandInSession(options) {
|
|
|
2022
2060
|
liveTargets = projectedTargets;
|
|
2023
2061
|
if (options.command === 'cleanup') {
|
|
2024
2062
|
cleanupInventory = inventory;
|
|
2025
|
-
cleanupLiveTargets = projectedTargets.filter(selectedExecutionTarget);
|
|
2026
2063
|
}
|
|
2027
2064
|
const identities = new Set();
|
|
2028
2065
|
for (const reference of live) {
|
|
@@ -2034,6 +2071,13 @@ async function runRebuildCommandInSession(options) {
|
|
|
2034
2071
|
identities.add(root.pluginId);
|
|
2035
2072
|
}
|
|
2036
2073
|
requestedPluginNames = [...identities];
|
|
2074
|
+
if (options.command === 'cleanup') {
|
|
2075
|
+
cleanupLiveTargets = resolveLiveCleanupTargets({
|
|
2076
|
+
selectors: requestedPluginNames, platforms: selectedPlatforms(options.commandOptions.platform),
|
|
2077
|
+
scope: options.commandOptions.scope, references: inventory.references,
|
|
2078
|
+
}).targets.filter(selectedExecutionTarget);
|
|
2079
|
+
liveTargets = cleanupLiveTargets;
|
|
2080
|
+
}
|
|
2037
2081
|
}
|
|
2038
2082
|
let cleanupTargets = [];
|
|
2039
2083
|
let cleanupUnavailableWarnings = [];
|
|
@@ -2053,6 +2097,18 @@ async function runRebuildCommandInSession(options) {
|
|
|
2053
2097
|
liveTargets: cleanupLiveTargets,
|
|
2054
2098
|
primarySourceId,
|
|
2055
2099
|
});
|
|
2100
|
+
// A bare selector with one known Intent identity needs the same identity
|
|
2101
|
+
// check as an explicitly qualified request, even without owned output.
|
|
2102
|
+
const unresolvedIntentSelectors = [...new Set(intentTargets.filter((target) => !cleanupLiveTargets.some((live) => live.pluginId === target.pluginId && live.platform === target.platform))
|
|
2103
|
+
.map((target) => target.pluginId))];
|
|
2104
|
+
if (unresolvedIntentSelectors.length) {
|
|
2105
|
+
const intentLive = resolveLiveCleanupTargets({
|
|
2106
|
+
selectors: unresolvedIntentSelectors, platforms: selectedPlatforms(options.commandOptions.platform),
|
|
2107
|
+
scope: options.commandOptions.scope, references: cleanupInventory.references,
|
|
2108
|
+
}).targets.filter(selectedExecutionTarget);
|
|
2109
|
+
cleanupLiveTargets = [...new Map([...cleanupLiveTargets, ...intentLive].map((target) => [offlineCleanupKey(target), target])).values()];
|
|
2110
|
+
liveTargets = cleanupLiveTargets;
|
|
2111
|
+
}
|
|
2056
2112
|
const damagedTargets = options.pluginNames.flatMap((selector) => {
|
|
2057
2113
|
const parsed = parsePluginId(selector);
|
|
2058
2114
|
if (!parsed.sourceId)
|
|
@@ -2163,7 +2219,10 @@ async function runRebuildCommandInSession(options) {
|
|
|
2163
2219
|
platform: target.identity.platform,
|
|
2164
2220
|
scope: target.identity.scope,
|
|
2165
2221
|
})),
|
|
2166
|
-
].map((target) => [`${target.pluginId}\0${target.platform}\0${target.scope}`, target])).values()]
|
|
2222
|
+
].map((target) => [`${target.pluginId}\0${target.platform}\0${target.scope}`, target])).values()]
|
|
2223
|
+
.map((target) => ({ ...target, ...resolveCleanupMarketplaceIdentity({
|
|
2224
|
+
...target, references: cleanupInventory.references,
|
|
2225
|
+
}) }));
|
|
2167
2226
|
const requestedTargets = requestedPluginNames.flatMap((selector) => {
|
|
2168
2227
|
const parsed = parsePluginId(selector);
|
|
2169
2228
|
const sourceId = parsed.sourceId ?? primarySource;
|
|
@@ -2195,7 +2254,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2195
2254
|
&& candidate.platform === target.platform
|
|
2196
2255
|
&& candidate.scope === target.scope)
|
|
2197
2256
|
?? intentOnlyOfflineCleanupEvidence(target));
|
|
2198
|
-
const operationPlan = createOfflineCleanupOperationPlan(forceEvidence, { scope: options.commandOptions.scope, view: cleanupRequirements }, cleanupInventoryWarnings(cleanupInventory, forceCleanupTargets), retainedPackageActions);
|
|
2257
|
+
const operationPlan = createOfflineCleanupOperationPlan(forceEvidence, { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, forceCleanupTargets), ...cleanupMarketplaceIdentityWarnings(forceCleanupTargets)], retainedPackageActions);
|
|
2199
2258
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
2200
2259
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
|
|
2201
2260
|
}
|
|
@@ -2234,7 +2293,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2234
2293
|
const result = await (options.runtime?.executeCleanupOperation ?? executeRebuildOperation)({
|
|
2235
2294
|
command: 'cleanup', target, driver: pathOnlyDriver,
|
|
2236
2295
|
});
|
|
2237
|
-
if (
|
|
2296
|
+
if (forceCleanupTargets.some((liveTarget) => liveTarget.marketplaceIdentityUnresolved
|
|
2238
2297
|
&& liveTarget.pluginId === result.target.pluginId
|
|
2239
2298
|
&& liveTarget.platform === result.target.platform
|
|
2240
2299
|
&& liveTarget.scope === result.target.scope)) {
|
|
@@ -2274,9 +2333,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2274
2333
|
&& unresolved.scope === target.scope))
|
|
2275
2334
|
.map(cleanupIntentResult);
|
|
2276
2335
|
const allResults = [...forceResults, ...unresolvedResults, ...intentOnlyResults];
|
|
2277
|
-
const warnings =
|
|
2278
|
-
? [`nativeMarketplaceIdentityUnresolved: Preserved ambiguous native registration for ${target.pluginId} on ${target.platform}/${target.scope}.`]
|
|
2279
|
-
: []);
|
|
2336
|
+
const warnings = cleanupMarketplaceIdentityWarnings(forceCleanupTargets);
|
|
2280
2337
|
return leaseSafeRebuildResult({
|
|
2281
2338
|
platforms: [...new Set(allResults.map((entry) => entry.target.platform))],
|
|
2282
2339
|
plugins: allResults.filter((entry) => entry.status === 'succeeded')
|
|
@@ -2338,7 +2395,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2338
2395
|
?? intentOnlyOfflineCleanupEvidence(target));
|
|
2339
2396
|
const nativePreparation = await prepareOfflineNativeCleanup({ evidence, cwd: options.commandOptions.cwd,
|
|
2340
2397
|
env: runtimeEnv, runtime: options.runtime });
|
|
2341
|
-
const operationPlan = createOfflineCleanupOperationPlan(evidence, { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, cleanupTargets), ...cleanupUnavailableWarnings], retainedPackageActions, nativePreparation);
|
|
2398
|
+
const operationPlan = createOfflineCleanupOperationPlan(evidence, { scope: options.commandOptions.scope, view: cleanupRequirements }, [...cleanupInventoryWarnings(cleanupInventory, cleanupTargets), ...cleanupMarketplaceIdentityWarnings(cleanupTargets), ...cleanupUnavailableWarnings], retainedPackageActions, nativePreparation);
|
|
2342
2399
|
if (options.runtime?.expectedPlanFingerprint) {
|
|
2343
2400
|
assertOperationPlanFingerprint(options.runtime.expectedPlanFingerprint, operationPlan);
|
|
2344
2401
|
}
|
|
@@ -2391,7 +2448,7 @@ async function runRebuildCommandInSession(options) {
|
|
|
2391
2448
|
if (malformedSelectedConfigPreserved) {
|
|
2392
2449
|
cleanupResult.warnings.push(MALFORMED_CONFIG_PRESERVED_WARNING);
|
|
2393
2450
|
}
|
|
2394
|
-
cleanupResult.warnings.
|
|
2451
|
+
cleanupResult.warnings = [...new Set([...cleanupResult.warnings, ...cleanupMarketplaceIdentityWarnings(cleanupTargets), ...cleanupUnavailableWarnings])];
|
|
2395
2452
|
return cleanupResult;
|
|
2396
2453
|
}
|
|
2397
2454
|
try {
|