@lesliechan721/aw 0.1.0-beta.89 → 0.1.0-beta.90

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.
Files changed (96) hide show
  1. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  2. package/dist/src/commands/aw-capabilities.js +4 -1
  3. package/dist/src/commands/aw-capabilities.js.map +1 -1
  4. package/dist/src/commands/plugin-capabilities.js +4 -1
  5. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  6. package/dist/src/commands/public-lifecycle-result.d.ts +3 -0
  7. package/dist/src/commands/public-lifecycle-result.js +30 -5
  8. package/dist/src/commands/public-lifecycle-result.js.map +1 -1
  9. package/dist/src/commands/public-lifecycle.js +8 -0
  10. package/dist/src/commands/public-lifecycle.js.map +1 -1
  11. package/dist/src/commands/public-plugin-query.js +6 -2
  12. package/dist/src/commands/public-plugin-query.js.map +1 -1
  13. package/dist/src/commands/rebuild-command.js +28 -17
  14. package/dist/src/commands/rebuild-command.js.map +1 -1
  15. package/dist/src/commands/rebuild-platform-integration.js +23 -3
  16. package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
  17. package/dist/src/commands/reconcile-operation-plan.d.ts +3 -0
  18. package/dist/src/commands/reconcile-operation-plan.js +1 -0
  19. package/dist/src/commands/reconcile-operation-plan.js.map +1 -1
  20. package/dist/src/commands/status-v6.js +61 -9
  21. package/dist/src/commands/status-v6.js.map +1 -1
  22. package/dist/src/index.js +122 -28
  23. package/dist/src/index.js.map +1 -1
  24. package/dist/src/output/public-result.d.ts +1 -0
  25. package/dist/src/output/public-result.js +21 -3
  26. package/dist/src/output/public-result.js.map +1 -1
  27. package/dist/src/output/receipt-projection.js +19 -5
  28. package/dist/src/output/receipt-projection.js.map +1 -1
  29. package/dist/src/portable/recovery.d.ts +2 -7
  30. package/dist/src/portable/recovery.js +10 -0
  31. package/dist/src/portable/recovery.js.map +1 -1
  32. package/dist/src/recovery/coordinator.js +5 -0
  33. package/dist/src/recovery/coordinator.js.map +1 -1
  34. package/dist/src/recovery/joint-coordinator.js +12 -0
  35. package/dist/src/recovery/joint-coordinator.js.map +1 -1
  36. package/dist/src/recovery/status.d.ts +1 -0
  37. package/dist/src/recovery/status.js +151 -44
  38. package/dist/src/recovery/status.js.map +1 -1
  39. package/dist/src/review/source-binding.js +7 -4
  40. package/dist/src/review/source-binding.js.map +1 -1
  41. package/dist/src/tui/components.js +1 -0
  42. package/dist/src/tui/components.js.map +1 -1
  43. package/dist/src/tui/config-object-suggestions.d.ts +15 -0
  44. package/dist/src/tui/config-object-suggestions.js +71 -0
  45. package/dist/src/tui/config-object-suggestions.js.map +1 -0
  46. package/dist/src/tui/config-suggestions.d.ts +7 -2
  47. package/dist/src/tui/config-suggestions.js +22 -14
  48. package/dist/src/tui/config-suggestions.js.map +1 -1
  49. package/dist/src/tui/console-app-v4.js +569 -102
  50. package/dist/src/tui/console-app-v4.js.map +1 -1
  51. package/dist/src/tui/controller-runtime.js +14 -16
  52. package/dist/src/tui/controller-runtime.js.map +1 -1
  53. package/dist/src/tui/controller.d.ts +6 -4
  54. package/dist/src/tui/controller.js +59 -12
  55. package/dist/src/tui/controller.js.map +1 -1
  56. package/dist/src/tui/guided-setup.d.ts +25 -0
  57. package/dist/src/tui/guided-setup.js +101 -0
  58. package/dist/src/tui/guided-setup.js.map +1 -0
  59. package/dist/src/tui/model.d.ts +5 -0
  60. package/dist/src/tui/model.js +120 -49
  61. package/dist/src/tui/model.js.map +1 -1
  62. package/dist/src/tui/router.d.ts +5 -3
  63. package/dist/src/tui/router.js.map +1 -1
  64. package/dist/src/tui/scoped-flow.d.ts +2 -0
  65. package/dist/src/tui/scoped-flow.js.map +1 -1
  66. package/dist/src/tui/scoped-inventory.d.ts +1 -0
  67. package/dist/src/tui/screen-registry.d.ts +3 -2
  68. package/dist/src/utils/config-platforms.d.ts +21 -0
  69. package/dist/src/utils/config-platforms.js +51 -0
  70. package/dist/src/utils/config-platforms.js.map +1 -0
  71. package/dist/src/utils/managed-command-materialization.d.ts +1 -0
  72. package/dist/src/utils/managed-command-materialization.js +8 -3
  73. package/dist/src/utils/managed-command-materialization.js.map +1 -1
  74. package/dist/src/utils/plugin-config-command-apply.js +7 -1
  75. package/dist/src/utils/plugin-config-command-apply.js.map +1 -1
  76. package/dist/src/utils/plugin-config-diagnostics.d.ts +16 -0
  77. package/dist/src/utils/plugin-config-diagnostics.js +44 -0
  78. package/dist/src/utils/plugin-config-diagnostics.js.map +1 -0
  79. package/dist/src/utils/plugin-config-impact.js +46 -18
  80. package/dist/src/utils/plugin-config-impact.js.map +1 -1
  81. package/dist/src/utils/plugin-config-references.d.ts +5 -0
  82. package/dist/src/utils/plugin-config-references.js +19 -7
  83. package/dist/src/utils/plugin-config-references.js.map +1 -1
  84. package/dist/src/utils/plugin-config-suggestion-runner.d.ts +45 -12
  85. package/dist/src/utils/plugin-config-suggestion-runner.js +174 -33
  86. package/dist/src/utils/plugin-config-suggestion-runner.js.map +1 -1
  87. package/dist/src/utils/plugin-config-suggestions.d.ts +10 -7
  88. package/dist/src/utils/plugin-config-suggestions.js +41 -13
  89. package/dist/src/utils/plugin-config-suggestions.js.map +1 -1
  90. package/dist/src/utils/plugin-config-write.d.ts +2 -0
  91. package/dist/src/utils/plugin-config-write.js +44 -4
  92. package/dist/src/utils/plugin-config-write.js.map +1 -1
  93. package/dist/src/utils/plugin-config.d.ts +1 -0
  94. package/dist/src/utils/plugin-config.js +33 -8
  95. package/dist/src/utils/plugin-config.js.map +1 -1
  96. package/package.json +3 -3
@@ -17,6 +17,8 @@ import { piAgentConsumerDiagnostic, piProjectListsUserSkills } from '../platform
17
17
  import { gapSupplementFiles } from '../platforms/supplement-layout.js';
18
18
  import { inspectPlatformSupplementState } from '../platforms/supplement-state.js';
19
19
  import { resolveArtifactRenderConfig } from '../utils/artifact-renderer.js';
20
+ import { resolveActiveConfigPlatforms } from '../utils/config-platforms.js';
21
+ import { configStatusDiagnostics, configReadDiagnostic, isConfigDiagnostic } from '../utils/plugin-config-diagnostics.js';
20
22
  import { createPlatformInputEvidence, matchesPlatformEmptyState, readPlatformDeliveryState, platformPackageInputDigest, readPlatformPackageContentDigest } from '../utils/platform-empty-state.js';
21
23
  import { deliveryNoticeMessage, INVOCATION_POLICY_NOT_APPLIED } from '../output/component-delivery.js';
22
24
  import { piProjectEmptyDeliveryObserved } from '../platforms/lifecycle-native.js';
@@ -40,12 +42,12 @@ import { selectPlatformInvocationPolicy, hostPermissionClaims } from '../generat
40
42
  import { isPermissionHost } from '../platforms/host-permission-policy.js';
41
43
  import { inspectHostPermissionDelivery } from '../platforms/permission-ownership.js';
42
44
  import { readManagedCommandPackage } from '../utils/managed-command-store.js';
43
- const NATIVE_READ_ERRORS = new Set(['nativeStateUnreadable', 'stateInventoryFailed', 'configReadFailed',
44
- 'configInvalid', 'componentInspectionFailed', 'targetInspectionFailed', 'codexNativeObservationFailed',
45
+ const NATIVE_READ_ERRORS = new Set(['nativeStateUnreadable', 'stateInventoryFailed', 'configReadFailed', 'componentInspectionFailed', 'targetInspectionFailed', 'codexNativeObservationFailed',
45
46
  'nativeObservationFailed', 'nativeObservationUnavailable']);
46
47
  function isNativeReadError({ code, detail }, needsOwnership = true) {
47
- return NATIVE_READ_ERRORS.has(code) || needsOwnership && (code === 'nativeConfigurationUnreadable'
48
- || code === 'nativeMarketplaceUnconfirmed' && detail !== undefined);
48
+ return NATIVE_READ_ERRORS.has(code) || (code === 'configInvalid' && detail?.reasonCode === 'configReadFailed')
49
+ || needsOwnership && (code === 'nativeConfigurationUnreadable'
50
+ || code === 'nativeMarketplaceUnconfirmed' && detail !== undefined);
49
51
  }
50
52
  export function isTargetObservationReadError(entry) {
51
53
  const { code } = entry;
@@ -84,6 +86,37 @@ async function readAdapterObservations(options, context, demand, inventory) {
84
86
  && (!demand.targetRequirements || demand.targetRequirements.some((item) => item.pluginId === root.pluginId && item.target === platform)));
85
87
  if (!roots.length)
86
88
  return { observations, existing, owned };
89
+ // Configuration is independent of the host's availability. Preserve these blockers if discovery fails.
90
+ const configuredRoots = await mapInstallReads(roots, async (root) => {
91
+ options.signal?.throwIfAborted();
92
+ const observation = { pluginId: root.pluginId, expectedVersion: root.plugin?.manifest.version, platform, content: 'unknown', blockers: [], reasons: [], deploymentObservations: [] };
93
+ observations.push(observation);
94
+ const plugin = root.plugin;
95
+ const active = demand.preferences.state === 'valid'
96
+ && resolveActiveConfigPlatforms(root.pluginId, plugin.manifest, demand.preferences).includes(platform);
97
+ const configSubject = { pluginId: root.pluginId, target: platform, scope: demand.scope };
98
+ const configForScope = async (scope, cwd) => {
99
+ try {
100
+ const config = await resolveArtifactRenderConfig({ pluginName: plugin.manifest.name, sourceId: plugin.sourceId ?? root.sourceId,
101
+ sourceIdentity: plugin.sourceIdentity, logicalIdentity: plugin.catalogLogicalIdentity,
102
+ manifest: plugin.manifest, platform, scope, cwd, env: context.env, referencePlugins: demand.plugins });
103
+ const blockers = configStatusDiagnostics(config.issues);
104
+ if (active)
105
+ observation.blockers.push(...blockers.map((blocker) => ({ ...blocker, subject: configSubject })));
106
+ return blockers.length ? undefined : config;
107
+ }
108
+ catch (error) {
109
+ options.signal?.throwIfAborted();
110
+ const blocker = configReadDiagnostic(error);
111
+ if (active)
112
+ observation.blockers.push({ ...blocker, subject: configSubject });
113
+ return undefined;
114
+ }
115
+ };
116
+ // Missing clients/bindings cannot hide a known configuration problem. Keep inspecting live ownership.
117
+ const scopedConfig = await configForScope(demand.scope, context.executionCwd);
118
+ return { root, observation, configForScope, scopedConfig };
119
+ }, { signal: options.signal, limit: 1 });
87
120
  const adapter = getAgentPluginAdapter(platform);
88
121
  let ownedSession;
89
122
  try {
@@ -103,11 +136,9 @@ async function readAdapterObservations(options, context, demand, inventory) {
103
136
  }
104
137
  }
105
138
  }
106
- for (const root of roots) {
139
+ for (const { root, observation, configForScope, scopedConfig } of configuredRoots) {
107
140
  options.signal?.throwIfAborted();
108
- const observation = { pluginId: root.pluginId, expectedVersion: root.plugin?.manifest.version, platform, content: 'unknown', blockers: [], reasons: [], deploymentObservations: [] };
109
141
  let nativePackage;
110
- observations.push(observation);
111
142
  try {
112
143
  const plugin = root.plugin;
113
144
  const resolution = await adapter.resolve(ctx, { plugin: {
@@ -126,7 +157,7 @@ async function readAdapterObservations(options, context, demand, inventory) {
126
157
  if (!resolution.bindings.length) {
127
158
  observation.blockers.push(...resolution.exclusions.map((entry) => diagnostic(entry.reasonCode)));
128
159
  observation.blockers.push(...discovery.diagnostics.map((entry) => ({ code: entry.code, message: entry.message })));
129
- if (!observation.blockers.length)
160
+ if (!observation.blockers.some((blocker) => !isConfigDiagnostic(blocker)))
130
161
  observation.blockers.push(diagnostic(discovery.availability === 'missing' ? 'client-missing' : 'nativeObservationUnavailable'));
131
162
  continue;
132
163
  }
@@ -180,6 +211,10 @@ async function readAdapterObservations(options, context, demand, inventory) {
180
211
  existing.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope,
181
212
  ...(nativePackage ? { nativePackage } : {}) });
182
213
  }
214
+ if (!scopedConfig) {
215
+ states.push('unknown');
216
+ continue;
217
+ }
183
218
  const unmet = [];
184
219
  const staticPackageIds = new Set();
185
220
  const staticSupplements = [];
@@ -194,12 +229,15 @@ async function readAdapterObservations(options, context, demand, inventory) {
194
229
  }
195
230
  const capabilities = adapter.capabilities({ binding, renderUnit: unit, observation: live,
196
231
  profile });
197
- inputUnits.push({ renderUnit: unit, capabilities,
198
- config: await resolveArtifactRenderConfig({ pluginName: plugin.manifest.name, sourceId: binding.plugin.sourceId,
199
- sourceIdentity: binding.plugin.sourceIdentity, logicalIdentity: plugin.catalogLogicalIdentity,
200
- manifest: plugin.manifest, platform, scope: unit.renderScope.kind,
201
- cwd: unit.renderScope.kind === 'project' ? unit.renderScope.projectRoot : context.executionCwd,
202
- env: context.env, referencePlugins: demand.plugins }) });
232
+ const config = unit.renderScope.kind === demand.scope ? scopedConfig
233
+ : await configForScope(unit.renderScope.kind, unit.renderScope.kind === 'project' ? unit.renderScope.projectRoot : context.executionCwd);
234
+ if (config)
235
+ inputUnits.push({ renderUnit: unit, capabilities, config });
236
+ }
237
+ // Do not feed invalid config to input-evidence creation or report a native read failure for it.
238
+ if (inputUnits.length !== renderUnits.length) {
239
+ states.push('unknown');
240
+ continue;
203
241
  }
204
242
  const inputEvidence = await createPlatformInputEvidence({ plugin, binding, units: inputUnits, commandRoutes }).catch((error) => {
205
243
  rethrowFatalError(error);
@@ -556,8 +594,10 @@ async function readAdapterObservations(options, context, demand, inventory) {
556
594
  catch (error) {
557
595
  rethrowFatalError(error);
558
596
  options.signal?.throwIfAborted();
559
- for (const root of roots)
560
- observations.push({ pluginId: root.pluginId, platform, content: 'unknown', blockers: [diagnostic('nativeObservationFailed')] });
597
+ for (const { observation } of configuredRoots) {
598
+ observation.content = 'unknown';
599
+ observation.blockers.push(diagnostic('nativeObservationFailed'));
600
+ }
561
601
  }
562
602
  finally {
563
603
  await ownedSession?.dispose();
@@ -674,7 +714,10 @@ export async function statusFromObservations(options) {
674
714
  cliVersion: options.cliVersion ?? '0.0.0', catalogOperationContext: demand.catalogOperationContext,
675
715
  excludedPluginIds: demand.userProviders?.[agent] }, options.catalogReadScope);
676
716
  options.signal?.throwIfAborted();
677
- target.blockers.push(...portable.blockers.filter((code) => code !== 'previousDeploymentRetained').map((code) => portablePreparationDiagnostic(portable, diagnostic(code), agent)));
717
+ const activeConfig = root.plugin && demand.preferences.state === 'valid'
718
+ && resolveActiveConfigPlatforms(root.pluginId, root.plugin.manifest, demand.preferences).includes(agent);
719
+ target.blockers.push(...portable.blockers.filter((code) => code !== 'previousDeploymentRetained'
720
+ && (activeConfig || !isConfigDiagnostic({ code }))).map((code) => portablePreparationDiagnostic(portable, diagnostic(code), agent)));
678
721
  if (portable.policyNotices?.length)
679
722
  target.reasons = [...target.reasons ?? [], ...portable.policyNotices];
680
723
  const gaps = (portable.unmet ?? []).filter((gap) => gap.agent === agent);
@@ -709,7 +752,7 @@ export async function statusFromObservations(options) {
709
752
  target.content = 'unknown';
710
753
  target.backend = observed.map((entry) => ({ skill: entry.skill, agent: entry.agent,
711
754
  ownership: entry.ownership, observation: entry.observation, associatedAgents: entry.associatedAgents }));
712
- if (target.blockers.some(isTargetObservationReadError)) {
755
+ if (target.blockers.some((entry) => !isConfigDiagnostic(entry) && isTargetObservationReadError(entry))) {
713
756
  errors.push({ ...diagnostic('portableObservationFailed'), pluginId: root.pluginId });
714
757
  }
715
758
  }
@@ -801,15 +844,29 @@ export async function readScopedRecoveryStatus(options) {
801
844
  && (!options.observationPlugins || options.observationPlugins.has(`${entry.sourceId}/${entry.pluginName}`)
802
845
  || options.observationPlugins.has(entry.pluginName))
803
846
  && (!options.targets || options.targets.includes(entry.platform)));
847
+ const portableExtra = options.targets && !options.targets.includes('generic') ? { targets: [], complete: true }
848
+ : await inspectPortableExtraInstalled({
849
+ scope: options.scope, context, env: context.env, signal: options.signal, plugins: options.observationPlugins,
850
+ });
851
+ options.signal?.throwIfAborted();
852
+ const sourceCandidates = [...candidates, ...portableExtra.targets.flatMap((target) => {
853
+ if (demand.preferences.state !== 'valid' || !demand.preferences.value.targets.includes(target.agent))
854
+ return [];
855
+ if (options.observationPlugins && !options.observationPlugins.has(target.pluginId)
856
+ && !options.observationPlugins.has(parsePluginId(target.pluginId).pluginName))
857
+ return [];
858
+ const { sourceId, pluginName } = parsePluginId(target.pluginId);
859
+ return [{ sourceId, pluginName }];
860
+ })];
804
861
  const observedPlugins = new Map(demand.plugins.map((plugin) => [plugin.pluginId, plugin]));
805
862
  const catalog = demand.catalogOperationContext ?? options.catalogOperationContext;
806
863
  const catalogSources = options.catalogSources ?? new Map();
807
864
  for (const source of catalog?.catalog.sources ?? [])
808
865
  if (!catalogSources.has(source.sourceId))
809
866
  catalogSources.set(source.sourceId, source);
810
- if (candidates.some((entry) => !observedPlugins.has(`${entry.sourceId}/${entry.pluginName}`))) {
867
+ if (sourceCandidates.some((entry) => !observedPlugins.has(`${entry.sourceId}/${entry.pluginName}`))) {
811
868
  try {
812
- const missing = [...new Set(candidates.map((entry) => entry.sourceId))].filter((id) => !catalogSources.has(id));
869
+ const missing = [...new Set(sourceCandidates.map((entry) => entry.sourceId))].filter((id) => !catalogSources.has(id));
813
870
  if (missing.length) {
814
871
  const config = await readCatalogSourcesConfigSnapshot(context.env);
815
872
  const configured = new Set(config.config.sources.map((source) => source.id));
@@ -826,22 +883,35 @@ export async function readScopedRecoveryStatus(options) {
826
883
  rethrowFatalError(error);
827
884
  options.signal?.throwIfAborted();
828
885
  }
829
- for (const candidate of candidates) {
886
+ for (const candidate of sourceCandidates) {
830
887
  const pluginId = `${candidate.sourceId}/${candidate.pluginName}`;
831
888
  if (observedPlugins.has(pluginId))
832
889
  continue;
833
890
  const source = catalogSources.get(candidate.sourceId)?.resolution;
834
891
  if (!source?.manifest.entries.some((entry) => entry.name === candidate.pluginName))
835
892
  continue;
893
+ // Configuration references need the retained plugin's dependency closure as well as its own manifest.
894
+ let dependencyEntries;
836
895
  try {
837
- const plugin = await readPluginManifest(path.join(source.rootDir, 'plugins', candidate.pluginName), { mode: 'bundle' });
838
- Object.assign(plugin, { pluginId, sourceId: candidate.sourceId, sourceIdentity: source.sourceIdentity,
839
- catalogLogicalIdentity: source.logicalIdentity });
840
- observedPlugins.set(pluginId, plugin);
896
+ dependencyEntries = resolvePluginDependencyClosure(source.manifest.entries, [candidate.pluginName]);
841
897
  }
842
- catch (error) {
843
- rethrowFatalError(error);
844
- options.signal?.throwIfAborted();
898
+ catch {
899
+ dependencyEntries = [{ name: candidate.pluginName }];
900
+ }
901
+ for (const { name } of dependencyEntries) {
902
+ const id = `${source.sourceId}/${name}`;
903
+ if (observedPlugins.has(id))
904
+ continue;
905
+ try {
906
+ const plugin = await readPluginManifest(path.join(source.rootDir, 'plugins', name), { mode: 'bundle' });
907
+ Object.assign(plugin, { pluginId: id, sourceId: source.sourceId, sourceIdentity: source.sourceIdentity,
908
+ catalogLogicalIdentity: source.logicalIdentity });
909
+ observedPlugins.set(id, plugin);
910
+ }
911
+ catch (error) {
912
+ rethrowFatalError(error);
913
+ options.signal?.throwIfAborted();
914
+ }
845
915
  }
846
916
  }
847
917
  }
@@ -850,14 +920,21 @@ export async function readScopedRecoveryStatus(options) {
850
920
  selectedAgents = selectAgents({ preferences: demand.preferences, targets: options.targets }).agents;
851
921
  }
852
922
  catch { /* The status result reports invalid strong state without extending observations. */ }
923
+ // Keep old owners in the residual/cleanup inventory. Only bind a current
924
+ // manifest for native observation when the recorded identity is compatible.
925
+ // Older Native owners may omit the source identity; keep their existing observation path.
926
+ const currentCandidates = candidates.filter((candidate) => {
927
+ const plugin = observedPlugins.get(`${candidate.sourceId}/${candidate.pluginName}`);
928
+ return plugin && (!candidate.sourceIdentity || candidate.sourceIdentity === plugin.sourceIdentity);
929
+ });
853
930
  const observationDemand = { ...demand, plugins: [...observedPlugins.values()],
854
- roots: [...new Map([...(demand.roots ?? []), ...candidates.flatMap((candidate) => {
931
+ roots: [...new Map([...(demand.roots ?? []), ...currentCandidates.flatMap((candidate) => {
855
932
  const pluginId = `${candidate.sourceId}/${candidate.pluginName}`;
856
933
  const plugin = observedPlugins.get(pluginId);
857
934
  return plugin ? [{ pluginId, sourceId: candidate.sourceId, plugin, sourceState: 'ready', blockers: [] }] : [];
858
935
  })].map((root) => [root.pluginId, root])).values()],
859
936
  targetRequirements: demand.targetRequirements ? [...demand.targetRequirements,
860
- ...candidates.map((entry) => ({ pluginId: `${entry.sourceId}/${entry.pluginName}`, target: entry.platform }))] : undefined };
937
+ ...currentCandidates.map((entry) => ({ pluginId: `${entry.sourceId}/${entry.pluginName}`, target: entry.platform }))] : undefined };
861
938
  const adapters = options.nativeObservations ? { observations: [], existing: [], owned: [] }
862
939
  : await withStatusNativeQueries({ ...options, targets: [...new Set([...selectedAgents, ...candidates.map((entry) => entry.platform)])] }, (nativeOptions) => readAdapterObservations(nativeOptions, context, observationDemand, candidates));
863
940
  const roots = new Set(demand.roots?.map((root) => root.pluginId) ?? []);
@@ -884,7 +961,8 @@ export async function readScopedRecoveryStatus(options) {
884
961
  expectedVersion: adapters.observations.find((item) => item.pluginId === entry.pluginId && item.platform === entry.agent)?.expectedVersion,
885
962
  installedVersion: adapters.observations.find((item) => item.pluginId === entry.pluginId && item.platform === entry.agent)?.installedVersion,
886
963
  delivery: { kind: 'native', platform: entry.agent },
887
- observation: 'unknown', content: 'unknown', deploymentObservations: adapters.observations.find((observation) => observation.pluginId === entry.pluginId && observation.platform === entry.agent)?.deploymentObservations }));
964
+ observation: 'unknown', content: 'unknown', blockers: adapters.observations.find((observation) => observation.pluginId === entry.pluginId && observation.platform === entry.agent)?.blockers.filter(isConfigDiagnostic),
965
+ deploymentObservations: adapters.observations.find((observation) => observation.pluginId === entry.pluginId && observation.platform === entry.agent)?.deploymentObservations }));
888
966
  const inventoryOwned = candidates.flatMap((entry) => {
889
967
  // A verified Antigravity copy remains a native retirement candidate when
890
968
  // its AW source is gone. Execution still verifies the live registration;
@@ -897,7 +975,10 @@ export async function readScopedRecoveryStatus(options) {
897
975
  });
898
976
  for (const entry of inventoryOwned) {
899
977
  if (!expected(entry.pluginId, entry.agent) && !nativeExtraObserved.some((target) => target.pluginId === entry.pluginId && target.agent === entry.agent)) {
900
- nativeExtraObserved.push({ ...entry, delivery: { kind: 'native', platform: entry.agent }, observation: 'unknown', content: 'unknown' });
978
+ const current = currentCandidates.some((candidate) => `${candidate.sourceId}/${candidate.pluginName}` === entry.pluginId
979
+ && candidate.platform === entry.agent);
980
+ nativeExtraObserved.push({ ...entry, delivery: { kind: 'native', platform: entry.agent }, observation: 'unknown', content: 'unknown',
981
+ ...(current ? { blockers: adapters.observations.find((observation) => observation.pluginId === entry.pluginId && observation.platform === entry.agent)?.blockers.filter(isConfigDiagnostic) } : {}) });
901
982
  }
902
983
  }
903
984
  const retainedProjectPackages = [];
@@ -937,17 +1018,35 @@ export async function readScopedRecoveryStatus(options) {
937
1018
  delivery: { kind: 'native', platform: agent }, observation: 'unknown', content: 'unknown',
938
1019
  backend: { retainedPackage: true, ownedComponents: [{ ...component, state: 'present' }] } });
939
1020
  }
940
- const portableExtra = options.targets && !options.targets.includes('generic') ? { targets: [], complete: true }
941
- : await inspectPortableExtraInstalled({
942
- scope: options.scope, context, env: context.env, signal: options.signal, plugins: options.observationPlugins,
943
- });
944
- options.signal?.throwIfAborted();
945
- const portableObserved = portableExtra.targets
946
- .filter((entry) => !expected(entry.pluginId, entry.agent))
947
- .map((entry) => ({ pluginId: entry.pluginId, agent: entry.agent, scope: options.scope,
948
- delivery: { kind: 'agent-skills', provider: 'aw', agentId: 'generic' },
949
- observation: entry.observation, content: entry.content,
950
- backend: { skill: entry.skill, logicalIdentity: entry.logicalIdentity } }));
1021
+ const portableConfigBlockers = new Map();
1022
+ const portableObserved = [];
1023
+ for (const entry of portableExtra.targets.filter((item) => !expected(item.pluginId, item.agent))) {
1024
+ const plugin = observedPlugins.get(entry.pluginId);
1025
+ const key = `${entry.pluginId}\0${entry.agent}`;
1026
+ const current = plugin?.catalogLogicalIdentity !== undefined && plugin.catalogLogicalIdentity === entry.logicalIdentity;
1027
+ if (current && !portableConfigBlockers.has(key) && demand.preferences.state === 'valid'
1028
+ && (!options.observationPlugins || options.observationPlugins.has(entry.pluginId)
1029
+ || options.observationPlugins.has(parsePluginId(entry.pluginId).pluginName))
1030
+ && resolveActiveConfigPlatforms(entry.pluginId, plugin.manifest, demand.preferences).includes(entry.agent)) {
1031
+ let blockers;
1032
+ try {
1033
+ const config = await resolveArtifactRenderConfig({ pluginName: plugin.manifest.name, sourceId: plugin.sourceId,
1034
+ sourceIdentity: plugin.sourceIdentity, logicalIdentity: plugin.catalogLogicalIdentity, manifest: plugin.manifest,
1035
+ platform: entry.agent, scope: options.scope, cwd: context.executionCwd, env: context.env, referencePlugins: [...observedPlugins.values()] });
1036
+ blockers = configStatusDiagnostics(config.issues);
1037
+ }
1038
+ catch (error) {
1039
+ options.signal?.throwIfAborted();
1040
+ blockers = [configReadDiagnostic(error)];
1041
+ }
1042
+ portableConfigBlockers.set(key, blockers.map((blocker) => ({ ...blocker, subject: { pluginId: entry.pluginId, target: entry.agent, scope: options.scope } })));
1043
+ }
1044
+ const blockers = current ? portableConfigBlockers.get(key) : undefined;
1045
+ portableObserved.push({ pluginId: entry.pluginId, agent: entry.agent, scope: options.scope,
1046
+ delivery: { kind: 'agent-skills', provider: 'aw', agentId: 'generic' },
1047
+ observation: entry.observation, content: entry.content, ...(blockers?.length ? { blockers } : {}),
1048
+ backend: { skill: entry.skill, logicalIdentity: entry.logicalIdentity } });
1049
+ }
951
1050
  const extraObserved = [...nativeExtraObserved, ...portableObserved];
952
1051
  const relevantErrors = ownerInventory.errors.filter((error) => {
953
1052
  const relevance = error.relevance;
@@ -1001,9 +1100,17 @@ export async function readScopedRecoveryStatus(options) {
1001
1100
  }
1002
1101
  }
1003
1102
  }
1103
+ // Installed-current evidence must not bind a retained old Catalog's Skill to
1104
+ // the new source. Unresolved sources remain observable, and ownedTargets
1105
+ // below still keeps every exact residual for cleanup.
1106
+ const portableCurrent = (target) => {
1107
+ const identity = observedPlugins.get(target.pluginId)?.catalogLogicalIdentity
1108
+ ?? catalogSources.get(parsePluginId(target.pluginId).sourceId)?.resolution?.logicalIdentity;
1109
+ return identity === undefined || target.logicalIdentity === identity;
1110
+ };
1004
1111
  result.existingTargets = [
1005
1112
  ...adapters.existing,
1006
- ...portableExtra.targets.map((target) => ({ pluginId: target.pluginId, agent: target.agent, scope: options.scope })),
1113
+ ...portableExtra.targets.filter(portableCurrent).map((target) => ({ pluginId: target.pluginId, agent: target.agent, scope: options.scope })),
1007
1114
  ];
1008
1115
  result.retainedProjectPackages = retainedProjectPackages;
1009
1116
  result.ownedTargets = [