@lesliechan721/aw 0.1.0-beta.79 → 0.1.0-beta.80

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 (85) hide show
  1. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  2. package/dist/src/commands/aw-capabilities.js +2 -1
  3. package/dist/src/commands/aw-capabilities.js.map +1 -1
  4. package/dist/src/commands/public-lifecycle-result.d.ts +1 -1
  5. package/dist/src/commands/public-lifecycle-result.js +31 -4
  6. package/dist/src/commands/public-lifecycle-result.js.map +1 -1
  7. package/dist/src/commands/public-plugin-query.js +32 -15
  8. package/dist/src/commands/public-plugin-query.js.map +1 -1
  9. package/dist/src/commands/rebuild-command.js +1 -1
  10. package/dist/src/commands/rebuild-command.js.map +1 -1
  11. package/dist/src/commands/rebuild-operations.js +11 -3
  12. package/dist/src/commands/rebuild-operations.js.map +1 -1
  13. package/dist/src/commands/rebuild-platform-integration.d.ts +3 -1
  14. package/dist/src/commands/rebuild-platform-integration.js +105 -53
  15. package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
  16. package/dist/src/index.js +4 -4
  17. package/dist/src/index.js.map +1 -1
  18. package/dist/src/output/public-result.d.ts +2 -1
  19. package/dist/src/output/public-result.js +25 -6
  20. package/dist/src/output/public-result.js.map +1 -1
  21. package/dist/src/output/receipt-projection.js +2 -2
  22. package/dist/src/output/receipt-projection.js.map +1 -1
  23. package/dist/src/platforms/capabilities.d.ts +5 -3
  24. package/dist/src/platforms/capabilities.js +54 -10
  25. package/dist/src/platforms/capabilities.js.map +1 -1
  26. package/dist/src/platforms/contracts.d.ts +14 -8
  27. package/dist/src/platforms/cursor-workspace-hook.d.ts +6 -0
  28. package/dist/src/platforms/cursor-workspace-hook.js +13 -0
  29. package/dist/src/platforms/cursor-workspace-hook.js.map +1 -1
  30. package/dist/src/platforms/inspection-grok.d.ts +1 -1
  31. package/dist/src/platforms/inspection-grok.js +29 -26
  32. package/dist/src/platforms/inspection-grok.js.map +1 -1
  33. package/dist/src/platforms/inspection-native.js +25 -19
  34. package/dist/src/platforms/inspection-native.js.map +1 -1
  35. package/dist/src/platforms/inspection-opencode.js +2 -2
  36. package/dist/src/platforms/inspection-opencode.js.map +1 -1
  37. package/dist/src/platforms/inspection-pi.js +2 -3
  38. package/dist/src/platforms/inspection-pi.js.map +1 -1
  39. package/dist/src/platforms/inspection.d.ts +3 -1
  40. package/dist/src/platforms/inspection.js +47 -8
  41. package/dist/src/platforms/inspection.js.map +1 -1
  42. package/dist/src/platforms/lifecycle-native.js +4 -3
  43. package/dist/src/platforms/lifecycle-native.js.map +1 -1
  44. package/dist/src/platforms/lifecycle.js +21 -13
  45. package/dist/src/platforms/lifecycle.js.map +1 -1
  46. package/dist/src/platforms/projection.js +1 -1
  47. package/dist/src/platforms/projection.js.map +1 -1
  48. package/dist/src/platforms/supplement-state.d.ts +13 -0
  49. package/dist/src/platforms/supplement-state.js +82 -0
  50. package/dist/src/platforms/supplement-state.js.map +1 -0
  51. package/dist/src/recovery/demand.d.ts +1 -0
  52. package/dist/src/recovery/status.d.ts +1 -1
  53. package/dist/src/recovery/status.js +171 -101
  54. package/dist/src/recovery/status.js.map +1 -1
  55. package/dist/src/review/platform-profile.d.ts +2 -2
  56. package/dist/src/review/platform-profile.js +5 -7
  57. package/dist/src/review/platform-profile.js.map +1 -1
  58. package/dist/src/review/skill-materialization.js +2 -1
  59. package/dist/src/review/skill-materialization.js.map +1 -1
  60. package/dist/src/review/source-binding.js +3 -2
  61. package/dist/src/review/source-binding.js.map +1 -1
  62. package/dist/src/tui/deployment-view.js +9 -4
  63. package/dist/src/tui/deployment-view.js.map +1 -1
  64. package/dist/src/tui/glossary.js +10 -0
  65. package/dist/src/tui/glossary.js.map +1 -1
  66. package/dist/src/utils/artifact-plan.d.ts +3 -3
  67. package/dist/src/utils/artifact-renderer.d.ts +3 -3
  68. package/dist/src/utils/artifact-renderer.js +10 -11
  69. package/dist/src/utils/artifact-renderer.js.map +1 -1
  70. package/dist/src/utils/artifact-request.d.ts +4 -3
  71. package/dist/src/utils/artifact-request.js +9 -5
  72. package/dist/src/utils/artifact-request.js.map +1 -1
  73. package/dist/src/utils/codex-native-observation.d.ts +0 -3
  74. package/dist/src/utils/codex-native-observation.js +0 -57
  75. package/dist/src/utils/codex-native-observation.js.map +1 -1
  76. package/dist/src/utils/component-resources.d.ts +15 -7
  77. package/dist/src/utils/component-resources.js +18 -0
  78. package/dist/src/utils/component-resources.js.map +1 -1
  79. package/dist/src/utils/platform-empty-state.d.ts +3 -4
  80. package/dist/src/utils/platform-empty-state.js +57 -21
  81. package/dist/src/utils/platform-empty-state.js.map +1 -1
  82. package/package.json +3 -3
  83. package/dist/src/utils/codex-config-observation.d.ts +0 -19
  84. package/dist/src/utils/codex-config-observation.js +0 -145
  85. package/dist/src/utils/codex-config-observation.js.map +0 -1
@@ -9,13 +9,14 @@ import { readDemand, resolveDelivery } from './demand.js';
9
9
  import { runNativeCli } from '../utils/native-cli.js';
10
10
  import { rethrowFatalError } from '../utils/codex-executable-discovery.js';
11
11
  import { createCodexNativeObservationSession } from '../utils/codex-native-observation.js';
12
- import { analyzeCodexSurface } from '../utils/codex-surface-analysis.js';
13
12
  import { getAgentPluginAdapter } from '../platforms/registry.js';
14
13
  import { getQualifiedPlatformProfile } from '../platforms/capabilities.js';
14
+ import { inspectPlatformSupplementState } from '../platforms/supplement-state.js';
15
15
  import { resolveArtifactRenderConfig } from '../utils/artifact-renderer.js';
16
16
  import { createPlatformInputEvidence, matchesPlatformEmptyState, platformPackageInputDigest, readPlatformPackageContentDigest } from '../utils/platform-empty-state.js';
17
- import { getDeploymentLayout } from '../platforms/layout.js';
18
- import { deploymentPackageComponent, inspectStaticSupplements } from '../platforms/inspection.js';
17
+ import { getDeploymentLayout, hasSharedUserPackage } from '../platforms/layout.js';
18
+ import { deploymentPackageComponent, inspectStaticSupplements, requiredDeploymentActivation } from '../platforms/inspection.js';
19
+ import { resolveStaticPlatformResourceRoot } from '../utils/component-resources.js';
19
20
  import { readSkillOwnerMarker } from '../utils/ownership.js';
20
21
  import { inventoryCatalogSourceReferences } from '../utils/catalog-source-references.js';
21
22
  import { resolvePartialCatalogOperationContext } from '../utils/catalog-operation-context.js';
@@ -25,7 +26,6 @@ import { resolvePluginMetaDependencyClosure } from '../utils/plugin-dependencies
25
26
  import { installationInvocation, selectNativeProduct } from '../platforms/discovery.js';
26
27
  import { DEFAULT_AGENT_VERSION_PROBE_TIMEOUT_MS } from '../constants.js';
27
28
  import { inventoryRecoveryDiagnostic } from '../utils/inventory-recovery-diagnostic.js';
28
- import { selectedNativeConsumer } from '../platforms/inspection.js';
29
29
  import { measureRecoveryPerformanceStage } from './performance.js';
30
30
  import { createNativeQuerySession } from '../platforms/inspection-query.js';
31
31
  import { readCatalogSourcesConfigSnapshot } from '../utils/catalog-sources.js';
@@ -81,7 +81,7 @@ async function readAdapterObservations(options, context, demand) {
81
81
  }
82
82
  for (const root of roots) {
83
83
  options.signal?.throwIfAborted();
84
- const observation = { pluginId: root.pluginId, expectedVersion: root.plugin?.manifest.version, platform, content: 'unknown', blockers: [], deploymentObservations: [] };
84
+ const observation = { pluginId: root.pluginId, expectedVersion: root.plugin?.manifest.version, platform, content: 'unknown', blockers: [], reasons: [], deploymentObservations: [] };
85
85
  observations.push(observation);
86
86
  try {
87
87
  const plugin = root.plugin;
@@ -109,12 +109,15 @@ async function readAdapterObservations(options, context, demand) {
109
109
  const emptyMatches = [];
110
110
  const currentMatches = [];
111
111
  const versions = [];
112
+ const staticResourceRoot = await resolveStaticPlatformResourceRoot(plugin.rootDir, platform);
112
113
  for (const binding of resolution.bindings) {
114
+ const subject = { pluginId: root.pluginId, target: platform, scope: binding.scope.kind };
115
+ const warn = (code) => observation.reasons.push({ ...diagnostic(code), subject });
116
+ const block = (code) => observation.blockers.push({ ...diagnostic(code), subject });
113
117
  const live = await measureRecoveryPerformanceStage(options, 'status.adapter.inspect', () => adapter.inspect(ctx, binding));
114
118
  versions.push(live.packageVersion);
115
119
  options.signal?.throwIfAborted();
116
120
  observation.deploymentObservations.push({ bindingId: binding.id, products: binding.consumers, after: live });
117
- observation.blockers.push(...live.diagnostics.map((entry) => ({ code: entry.code, message: entry.message })));
118
121
  const shared = ['codex-marketplace', 'claude-marketplace', 'gemini-extension', 'copilot-marketplace'].includes(binding.route);
119
122
  const scopedNativeConsumer = shared ? live.registration === 'present'
120
123
  && live.consumers.some((consumer) => consumer.activation === 'enabled')
@@ -124,25 +127,28 @@ async function readAdapterObservations(options, context, demand) {
124
127
  existing.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
125
128
  }
126
129
  const unmet = [];
127
- const staticComponents = [];
128
130
  const staticSupplements = [];
131
+ const dynamicUnits = new Set();
129
132
  const inputUnits = [];
130
133
  const profile = getQualifiedPlatformProfile(platform);
131
134
  let expectedCount = 0;
132
135
  let packageExpectedCount = 0;
133
136
  for (const unit of resolution.renderUnits.filter((unit) => binding.renderUnitIds.includes(unit.id))) {
137
+ const artifacts = plugin.manifest.artifacts;
138
+ if (artifacts && unit.kinds.length && (!artifacts.scopes || artifacts.scopes.includes(unit.renderScope.kind))) {
139
+ dynamicUnits.add(unit.output);
140
+ }
134
141
  const capabilities = adapter.capabilities({ binding, renderUnit: unit, observation: live,
135
142
  profile });
136
- const expected = await normalizeStaticPluginComponents({ pluginRoot: plugin.rootDir,
143
+ const expected = await normalizeStaticPluginComponents({ pluginRoot: plugin.rootDir, staticResourceRoot,
137
144
  manifest: plugin.manifest, platform, capabilities, allowedOutputKinds: unit.kinds });
138
145
  expectedCount += expected.components.length;
139
- staticComponents.push(...expected.components);
140
146
  if (unit.output === 'supplement')
141
147
  staticSupplements.push(...expected.components);
142
148
  else
143
149
  packageExpectedCount += expected.components.length;
144
150
  unmet.push(...expected.unmet);
145
- inputUnits.push({ renderUnit: unit, capabilities, prerequisites: live.prerequisites,
151
+ inputUnits.push({ renderUnit: unit, capabilities,
146
152
  config: await resolveArtifactRenderConfig({ pluginName: plugin.manifest.name, sourceId: binding.plugin.sourceId,
147
153
  sourceIdentity: binding.plugin.sourceIdentity, logicalIdentity: plugin.catalogLogicalIdentity,
148
154
  manifest: plugin.manifest, platform, scope: unit.renderScope.kind,
@@ -150,32 +156,81 @@ async function readAdapterObservations(options, context, demand) {
150
156
  env: context.env, referencePlugins: demand.plugins }) });
151
157
  }
152
158
  const supplements = await inspectStaticSupplements(ctx, binding, staticSupplements);
159
+ const inputEvidence = await createPlatformInputEvidence({ plugin, binding, units: inputUnits });
160
+ const supplementInput = inputEvidence.units.find((unit) => unit.output === 'supplement');
161
+ const recordedSupplements = dynamicUnits.has('supplement') && supplementInput
162
+ ? await inspectPlatformSupplementState(ctx, binding, supplementInput.inputDigest) : null;
163
+ if (recordedSupplements) {
164
+ const staticIds = new Set(supplements.components.map((component) => component.id));
165
+ const dynamicComponents = recordedSupplements.components.filter((component) => !staticIds.has(component.id));
166
+ supplements.components.push(...dynamicComponents);
167
+ expectedCount += dynamicComponents.length;
168
+ }
153
169
  const supplementConflict = supplements.components.some((component) => component.reasonCodes.includes('supplementOwnershipConflict'));
154
- const supplementDrift = supplements.components.some((component) => component.presence === 'absent'
155
- || component.reasonCodes.includes('componentContentDrift'));
170
+ const supplementMissing = supplements.components.some((component) => component.presence === 'absent');
171
+ const supplementDrift = supplements.components.some((component) => component.reasonCodes.includes('componentContentDrift'));
156
172
  const supplementUnknown = supplements.components.some((component) => component.presence === 'unknown');
173
+ const supplementInputDrift = Boolean(recordedSupplements && !recordedSupplements.inputMatches
174
+ && recordedSupplements.components.every((component) => component.presence === 'present'));
157
175
  if (supplementConflict)
158
- observation.blockers.push(diagnostic('supplementOwnershipConflict'));
159
- else if (supplementDrift)
160
- observation.blockers.push(diagnostic('platformContentDrift'));
161
- else if (supplementUnknown)
162
- observation.blockers.push(diagnostic('componentOutputUnconfirmed'));
176
+ block('supplementOwnershipConflict');
177
+ if (supplementDrift)
178
+ warn('platformContentDrift');
179
+ if (supplementInputDrift)
180
+ warn('platformInputDrift');
181
+ if (supplementMissing)
182
+ warn('componentOutputMissing');
183
+ if (supplementUnknown && !supplementConflict)
184
+ warn('componentOutputUnconfirmed');
163
185
  if (supplements.owned && !existing.some((target) => target.pluginId === root.pluginId && target.agent === platform && target.scope === demand.scope)) {
164
186
  owned.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
165
187
  existing.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
166
188
  }
167
- const inputEvidence = await createPlatformInputEvidence({ plugin, binding, units: inputUnits });
168
189
  const confirmedEmpty = Boolean(plugin.manifest.artifacts && expectedCount === 0 && unmet.length === 0
169
190
  && await matchesPlatformEmptyState({ state: { ...inputEvidence, kind: 'aw-platform-empty-state', result: 'intentional-empty' }, env: context.env }));
170
- const dynamicSupplementsUnconfirmed = Boolean(plugin.manifest.artifacts && !confirmedEmpty
171
- && inputUnits.some(({ renderUnit }) => renderUnit.output === 'supplement'
172
- && (!plugin.manifest.artifacts?.scopes || plugin.manifest.artifacts.scopes.includes(renderUnit.renderScope.kind))));
191
+ const confirmedEmptyPackage = binding.route === 'codex-marketplace' && recordedSupplements !== null
192
+ && dynamicUnits.has('package') && packageExpectedCount === 0
193
+ && await matchesPlatformEmptyState({ state: { ...inputEvidence, kind: 'aw-platform-empty-state', result: 'intentional-empty',
194
+ units: inputEvidence.units.filter((unit) => unit.output === 'package') }, env: context.env });
195
+ const dynamicSupplementsUnconfirmed = dynamicUnits.has('supplement') && !confirmedEmpty
196
+ && !recordedSupplements?.inputMatches && !supplementInputDrift;
197
+ if (dynamicSupplementsUnconfirmed)
198
+ warn('dynamicExpectationUnconfirmed');
199
+ const hasPackageExpectation = packageExpectedCount > 0 || dynamicUnits.has('package') && !confirmedEmpty && !confirmedEmptyPackage;
200
+ const inheritsUserNative = demand.targetRequirements?.find((item) => item.pluginId === root.pluginId
201
+ && item.target === platform)?.inheritsUserNative;
202
+ const requiredActivation = requiredDeploymentActivation(binding, live, !inheritsUserNative);
203
+ for (const entry of live.diagnostics) {
204
+ if (entry.code === 'codexProjectActivationUnconfirmed' && inheritsUserNative && requiredActivation === 'enabled')
205
+ continue;
206
+ const destination = entry.severity === 'error' || (hasPackageExpectation || confirmedEmpty || confirmedEmptyPackage) && NATIVE_READ_ERRORS.has(entry.code)
207
+ ? observation.blockers : observation.reasons;
208
+ destination.push({ code: entry.code, message: entry.message, subject: { ...subject, ...entry.subject }, detail: entry.detail });
209
+ }
210
+ const requiresScopeRegistration = binding.route === 'claude-marketplace' && !inheritsUserNative;
211
+ const registration = requiresScopeRegistration ? live.scopeRegistration ?? 'unknown' : live.registration;
212
+ const ownershipConflict = live.ownership === 'foreign' || live.ownership === 'shared';
213
+ if (ownershipConflict)
214
+ block('deploymentOwnershipConflict');
215
+ const missing = hasPackageExpectation && (live.package === 'absent' && packageExpectedCount > 0
216
+ || registration === 'absent' && (packageExpectedCount > 0 || live.package === 'present')
217
+ || live.nativePackage === 'absent');
218
+ if (missing) {
219
+ if (live.package === 'absent')
220
+ warn('platformPackageMissing');
221
+ if (registration === 'absent')
222
+ warn('nativeRegistrationMissing');
223
+ if (live.nativePackage === 'absent')
224
+ warn('nativePackageMissing');
225
+ }
173
226
  let inputDrift = false;
174
- let currentProjection = false;
227
+ let packageExpectationConfirmed = false;
175
228
  let projectionUnconfirmed = false;
229
+ let componentMissing = false;
230
+ let componentUnknown = false;
176
231
  let nativeContentDrift = false;
177
232
  let nativeContentUnconfirmed = false;
178
- if (live.package === 'present' && live.ownership === 'aw') {
233
+ if (hasPackageExpectation && live.package === 'present' && live.ownership === 'aw' && !missing) {
179
234
  const layout = await getDeploymentLayout(ctx, binding);
180
235
  const marker = await readSkillOwnerMarker({ skillRoot: layout.packageRoot, allowedRoot: path.dirname(layout.packageRoot),
181
236
  expectedIdentity: deploymentPackageComponent(binding, layout).identity });
@@ -186,73 +241,93 @@ async function readAdapterObservations(options, context, demand) {
186
241
  nativeContentDrift = Boolean(contentDigest && live.nativePackageContentDigest
187
242
  && contentDigest !== live.nativePackageContentDigest);
188
243
  if (nativeContentUnconfirmed)
189
- observation.blockers.push(diagnostic('nativePackageContentUnconfirmed'));
190
- else if (nativeContentDrift)
191
- observation.blockers.push(diagnostic('nativePackageContentDrift'));
244
+ warn('nativePackageContentUnconfirmed');
245
+ if (nativeContentDrift)
246
+ warn('nativePackageContentDrift');
192
247
  }
193
- projectionUnconfirmed = !projection || projection.preparation !== 'complete';
248
+ projectionUnconfirmed = !projection || projection.preparation !== 'complete' || !contentDigest;
194
249
  const packageInputDigest = platformPackageInputDigest(inputEvidence);
195
250
  inputDrift = Boolean(projection && (projection.inputDigest !== packageInputDigest
196
- || projection.contentDigest !== contentDigest));
251
+ || contentDigest && projection.contentDigest !== contentDigest));
197
252
  if (projectionUnconfirmed)
198
- observation.blockers.push(diagnostic(projection?.preparation === 'partial'
199
- ? 'platformPreparationPartial' : 'platformExpectationUnconfirmed'));
253
+ warn(projection?.preparation === 'partial'
254
+ ? 'platformPreparationPartial' : 'platformExpectationUnconfirmed');
200
255
  else if (inputDrift)
201
- observation.blockers.push(diagnostic(projection.inputDigest !== packageInputDigest
202
- ? 'platformInputDrift' : 'platformContentDrift'));
203
- currentProjection = Boolean(projection && !inputDrift && projection.preparation === 'complete'
204
- && projection.components.length > 0 && projection.components.every((component) => live.components.some((observed) => observed.id === component.id && observed.presence === 'present'))
205
- && !supplementConflict && !supplementDrift && !supplementUnknown && !dynamicSupplementsUnconfirmed
206
- && !nativeContentDrift && !nativeContentUnconfirmed);
207
- if (currentProjection)
256
+ warn(projection.inputDigest !== packageInputDigest
257
+ ? 'platformInputDrift' : 'platformContentDrift');
258
+ componentMissing = live.components.some((component) => component.presence === 'absent');
259
+ componentUnknown = live.components.some((component) => component.presence === 'unknown'
260
+ && !component.reasonCodes.includes('nativePackageContentDrift'));
261
+ if (componentMissing)
262
+ warn('componentOutputMissing');
263
+ if (componentUnknown && !nativeContentUnconfirmed)
264
+ warn('componentOutputUnconfirmed');
265
+ packageExpectationConfirmed = Boolean(!projectionUnconfirmed && projection.inputDigest === packageInputDigest
266
+ && projection.components.length > 0);
267
+ if (packageExpectationConfirmed)
208
268
  expectedCount = Math.max(expectedCount, projection.components.length);
209
269
  }
210
- // Codex CLI 0.167.0 loads user plugin Skills without the independent
211
- // Hook/project trust gate. This is component applicability, not trust
212
- // inferred from activation, and requires complete current evidence.
213
- const selectedProduct = selectNativeProduct(binding.consumers);
214
- const selectedConsumer = selectedNativeConsumer(binding, live);
215
- if (binding.route === 'codex-marketplace' && binding.scope.kind === 'user'
216
- && !plugin.manifest.artifacts && staticComponents.length > 0
217
- && staticComponents.every((component) => component.kind === 'skill')
218
- && unmet.length === 0 && staticSupplements.length === 0 && currentProjection
219
- && live.registration === 'present' && profile.kinds.skill.status === 'supported'
220
- && selectedProduct?.product === 'cli' && selectedProduct.version === '0.167.0'
221
- && profile.qualifiedConsumers?.skill?.some((qualified) => qualified.product === selectedProduct.product && qualified.version === selectedProduct.version)
222
- && selectedConsumer?.activation === 'enabled' && selectedConsumer.trust === 'unknown') {
223
- selectedConsumer.trust = 'not-applicable';
224
- }
225
270
  live.components.push(...supplements.components);
226
- observation.inputDrift ||= inputDrift || supplementDrift || nativeContentDrift;
227
- currentMatches.push(confirmedEmpty || currentProjection);
271
+ currentMatches.push(!dynamicUnits.size || confirmedEmpty || packageExpectationConfirmed || missing
272
+ || recordedSupplements !== null && !hasPackageExpectation);
228
273
  emptyMatches.push(confirmedEmpty);
229
- observation.blockers.push(...unmet.map((entry) => diagnostic(entry.reasonCode)));
230
- const requiresComponents = expectedCount > 0 || unmet.length > 0 || Boolean(plugin.manifest.artifacts);
231
- if (!confirmedEmpty && requiresComponents && selectedConsumer && [selectedConsumer].some((consumer) => consumer.trust === 'required' || consumer.trust === 'blocked')
232
- && !observation.blockers.some((entry) => entry.code === 'nativeTrustRequired')) {
233
- observation.blockers.push(diagnostic('nativeTrustRequired'));
234
- }
235
- const supplementOnly = !plugin.manifest.artifacts && staticSupplements.length > 0 && packageExpectedCount === 0;
236
- const absent = !supplementOnly && live.package === 'absent' && ['absent', 'not-applicable'].includes(live.registration);
237
- const consumers = selectedConsumer ? [selectedConsumer] : [];
238
- const unknown = !supplementOnly && (live.package === 'unknown' || live.registration === 'unknown'
239
- || !consumers.length || consumers.some((consumer) => consumer.activation === 'unknown' || consumer.trust === 'unknown'));
240
- const inactive = !supplementOnly && (live.registration === 'absent' || consumers.some((consumer) => consumer.activation === 'disabled' || consumer.activation === 'blocked'
241
- || consumer.trust === 'blocked' || consumer.trust === 'required'));
274
+ for (const entry of unmet)
275
+ block(entry.reasonCode);
276
+ const inactiveScope = live.registration === 'absent'
277
+ || live.package === 'absent' && live.registration === 'not-applicable'
278
+ || live.scopeRegistration === 'absent'
279
+ || binding.scope.kind === 'project' && shared && live.configuration?.activation === 'absent'
280
+ || live.consumers.every((consumer) => ['disabled', 'not-applicable'].includes(consumer.activation));
242
281
  if (confirmedEmpty) {
243
- const inactiveScope = live.registration === 'absent'
244
- || live.package === 'absent' && live.registration === 'not-applicable'
245
- || live.scopeRegistration === 'absent'
246
- || binding.scope.kind === 'project' && shared && live.configuration?.activation === 'absent'
247
- || live.consumers.every((consumer) => ['disabled', 'not-applicable'].includes(consumer.activation));
248
- states.push(live.ownership === 'foreign' ? 'conflict' : live.package === 'unknown' || live.registration === 'unknown'
249
- || live.diagnostics.length || !inactiveScope ? 'unknown'
282
+ states.push(ownershipConflict ? 'conflict' : live.package === 'unknown' || live.registration === 'unknown'
283
+ || live.ownership === 'unknown' || observation.blockers.length || !inactiveScope ? 'unknown'
250
284
  : live.package === 'absent' || shared ? 'satisfied' : 'drifted');
285
+ continue;
286
+ }
287
+ if (hasPackageExpectation && !missing) {
288
+ if (registration === 'unknown')
289
+ warn('nativeRegistrationUnconfirmed');
290
+ if (requiredActivation === 'unknown')
291
+ warn('nativeActivationUnconfirmed');
292
+ if (requiredActivation === 'disabled')
293
+ warn('nativeActivationDisabled');
294
+ if (requiredActivation === 'blocked')
295
+ block(binding.route === 'grok-directory'
296
+ ? 'grokProjectAuthorizationDenied' : 'nativeActivationBlocked');
297
+ if (binding.route === 'cursor-workspace-hook') {
298
+ if (live.workspaceOpen === 'absent')
299
+ warn('cursorWorkspaceOpenMissing');
300
+ if (live.workspaceOpen === 'unknown')
301
+ warn('cursorWorkspaceOpenUnconfirmed');
302
+ }
303
+ }
304
+ if (ownershipConflict || supplementConflict)
305
+ states.push('conflict');
306
+ else if (confirmedEmptyPackage && (live.package === 'unknown' || live.registration === 'unknown' || live.ownership === 'unknown'))
307
+ states.push('unknown');
308
+ else if (confirmedEmptyPackage && !inactiveScope) {
309
+ warn('platformContentDrift');
310
+ states.push('drifted');
251
311
  }
312
+ else if (unmet.length || hasPackageExpectation && registration === 'unknown')
313
+ states.push('unknown');
314
+ else if (missing)
315
+ states.push('absent');
316
+ else if (supplementUnknown || hasPackageExpectation && (live.package === 'unknown' || live.ownership === 'unknown'
317
+ || requiredActivation === 'unknown' || live.workspaceOpen === 'unknown'
318
+ || componentUnknown || nativeContentUnconfirmed || projectionUnconfirmed))
319
+ states.push('unknown');
320
+ else if (componentMissing || supplementMissing && !dynamicSupplementsUnconfirmed)
321
+ states.push('absent');
322
+ else if (hasPackageExpectation && ['disabled', 'blocked'].includes(requiredActivation)
323
+ || live.workspaceOpen === 'absent' && live.package === 'present' || inputDrift || supplementDrift || supplementInputDrift || nativeContentDrift)
324
+ states.push('drifted');
325
+ else if (dynamicSupplementsUnconfirmed || hasPackageExpectation && !packageExpectationConfirmed)
326
+ states.push('unknown');
327
+ else if (!expectedCount)
328
+ states.push(live.package === 'absent' && ['absent', 'not-applicable'].includes(live.registration) ? 'satisfied' : 'drifted');
252
329
  else
253
- states.push(live.ownership === 'foreign' || supplementConflict ? 'conflict' : projectionUnconfirmed || supplementUnknown || nativeContentUnconfirmed ? 'unknown' : inputDrift || supplementDrift || nativeContentDrift ? 'drifted' : unmet.length || dynamicSupplementsUnconfirmed ? 'unknown'
254
- : !expectedCount ? absent ? 'satisfied' : unknown ? 'unknown' : 'drifted'
255
- : absent ? 'absent' : unknown ? 'unknown' : inactive ? 'drifted' : supplementOnly || live.package === 'present' ? 'satisfied' : 'unknown');
330
+ states.push('satisfied');
256
331
  }
257
332
  observation.intentionalEmpty = emptyMatches.length === resolution.bindings.length && emptyMatches.every(Boolean);
258
333
  observation.expectationConfirmed = currentMatches.length === resolution.bindings.length && currentMatches.every(Boolean);
@@ -370,6 +445,8 @@ export async function statusFromObservations(options) {
370
445
  if (native.deploymentExclusions)
371
446
  target.deploymentExclusions = native.deploymentExclusions;
372
447
  target.blockers.push(...native.blockers);
448
+ if (native.reasons?.length)
449
+ target.reasons = [...native.reasons];
373
450
  errors.push(...native.blockers.filter((entry) => NATIVE_READ_ERRORS.has(entry.code))
374
451
  .map((entry) => ({ ...entry, pluginId: root.pluginId })));
375
452
  target.backend = { ...(native.assumedActivation ? { assumedActivation: true } : {}),
@@ -419,12 +496,13 @@ export async function statusFromObservations(options) {
419
496
  errors.push({ ...diagnostic('portableObservationFailed'), pluginId: root.pluginId });
420
497
  }
421
498
  }
422
- const confirmedEmpty = delivery?.kind === 'native' && options.nativeObservations.some((entry) => entry.pluginId === root.pluginId && entry.platform === delivery.platform && (entry.intentionalEmpty === true || entry.expectationConfirmed === true));
423
- if (delivery?.kind === 'native' && root.plugin?.manifest.artifacts && !confirmedEmpty) {
424
- const inputDrift = delivery?.kind === 'native' && options.nativeObservations.some((entry) => entry.pluginId === root.pluginId && entry.platform === delivery.platform && entry.inputDrift === true);
425
- if (target.content !== 'conflict' && !inputDrift)
499
+ const dynamicExpectationConfirmed = delivery?.kind === 'native' && options.nativeObservations.some((entry) => entry.pluginId === root.pluginId && entry.platform === delivery.platform && (entry.intentionalEmpty === true || entry.expectationConfirmed === true));
500
+ if (delivery?.kind === 'native' && root.plugin?.manifest.artifacts && !dynamicExpectationConfirmed) {
501
+ if (target.content === 'satisfied' || target.content === 'absent')
426
502
  target.content = 'unknown';
427
- target.blockers.push(diagnostic('dynamicExpectationUnconfirmed'));
503
+ if (target.content === 'unknown' && !target.reasons?.some((entry) => entry.code === 'dynamicExpectationUnconfirmed')) {
504
+ target.reasons = [...target.reasons ?? [], diagnostic('dynamicExpectationUnconfirmed')];
505
+ }
428
506
  }
429
507
  target.observation = target.content === 'satisfied' ? 'verified'
430
508
  : target.content === 'absent' ? 'missing' : 'unknown';
@@ -854,7 +932,9 @@ async function readRecoveryStatusInSession(options, snapshot) {
854
932
  userProviders: demand.scope === 'project' ? Object.fromEntries((snapshot.preferences?.targets ?? []).map((target) => [target,
855
933
  plan.placements.filter((item) => item.scope === 'user' && item.target === target
856
934
  && !nodes.some((project) => project.scope === 'project' && project.pluginId === item.pluginId && project.target === item.target)).map((item) => item.pluginId)])) : {},
857
- targetRequirements: nodes.map((item) => ({ pluginId: item.pluginId, target: item.target })), roots: demand.roots === null ? null : [...new Map(nodes.map((item) => [item.pluginId, {
935
+ targetRequirements: nodes.map((item) => ({ pluginId: item.pluginId, target: item.target,
936
+ ...(item.scope === 'user' && demand.scope === 'project' ? { inheritsUserNative: true } : {}) })),
937
+ roots: demand.roots === null ? null : [...new Map(nodes.map((item) => [item.pluginId, {
858
938
  pluginId: item.pluginId, sourceId: item.plugin.sourceId, sourceState: 'ready',
859
939
  blockers: [], plugin: item.plugin,
860
940
  }])).values()] };
@@ -896,29 +976,19 @@ async function readRecoveryStatusInSession(options, snapshot) {
896
976
  const providers = requirement.dependencies.map((id) => {
897
977
  const provider = plan.placements.find((item) => item.pluginId === id && item.target === requirement.target
898
978
  && item.contributions.some((contribution) => contribution.scope === demand.scope && contribution.root === root.pluginId));
899
- const actual = allTargets.find((item) => item.pluginId === id && item.agent === requirement.target && item.scope === provider?.scope);
900
- if (demand.scope === 'project' && provider?.scope === 'user' && ['codex', 'claude', 'gemini', 'copilot'].includes(requirement.target)) {
901
- const activation = allTargets.find((item) => item.pluginId === id && item.agent === requirement.target && item.scope === 'project');
902
- if (actual?.content !== 'satisfied')
903
- return actual;
904
- if (requirement.target === 'codex' && activation && activation.blockers.length === 0) {
905
- const backend = activation.backend;
906
- const surface = analyzeCodexSurface(provider.plugin.manifest);
907
- const completeUserCapability = surface.components.every((component) => !component.scopes.includes('project') || component.scopes.includes('user'));
908
- const effective = surface.nativeKinds.length === 0 || backend?.live?.components.some((component) => component.kind === 'activation' && component.metadata?.effective === true);
909
- const supported = surface.nativeKinds.length === 0 || backend?.live?.sharedComponents?.some((component) => component.kind === 'systemConsumer' && component.state === 'compatible');
910
- if (completeUserCapability && effective && supported && !backend?.assumedActivation) {
911
- return { ...activation, content: 'satisfied', observation: 'verified' };
912
- }
913
- }
914
- return activation;
915
- }
916
- return actual;
979
+ if (!provider)
980
+ return undefined;
981
+ // These observations check the same physical package and the demand's own effective scope.
982
+ const scope = hasSharedUserPackage(requirement.target) ? demand.scope : provider.scope;
983
+ return allTargets.find((item) => item.pluginId === id && item.agent === requirement.target && item.scope === scope);
917
984
  });
918
985
  const ownProvider = providers.find((provider) => provider?.pluginId === root.pluginId);
919
986
  if (ownProvider?.installedVersion)
920
987
  target.installedVersion = ownProvider.installedVersion;
921
988
  target.blockers.push(...providers.flatMap((item) => item?.blockers ?? []));
989
+ const reasons = providers.flatMap((item) => item?.reasons ?? []);
990
+ if (reasons.length)
991
+ target.reasons = reasons;
922
992
  const componentGaps = providers.flatMap((item) => item?.componentGaps ?? []);
923
993
  if (componentGaps.length)
924
994
  target.componentGaps = [...new Map(componentGaps.map((gap) => [JSON.stringify([gap.providerPluginId, gap.agent, gap.renderScope, gap.id]), gap])).values()];