@lesliechan721/aw 0.1.0-beta.84 → 0.1.0-beta.85
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/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/src/commands/public-lifecycle-result.d.ts +3 -8
- package/dist/src/commands/public-lifecycle-result.js +85 -30
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/commands/public-plugin-query.js +21 -5
- package/dist/src/commands/public-plugin-query.js.map +1 -1
- package/dist/src/commands/rebuild-command.js +19 -3
- 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 +5 -0
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.js +5 -2
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +7 -2
- package/dist/src/commands/rebuild-platform-integration.js +539 -65
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
- package/dist/src/generators/permissions.d.ts +7 -1
- package/dist/src/generators/permissions.js +56 -0
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +7 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/intent/scope-context.d.ts +4 -2
- package/dist/src/intent/scope-context.js +37 -7
- package/dist/src/intent/scope-context.js.map +1 -1
- package/dist/src/output/component-delivery.d.ts +21 -0
- package/dist/src/output/component-delivery.js +82 -0
- package/dist/src/output/component-delivery.js.map +1 -0
- package/dist/src/output/public-result.d.ts +2 -0
- package/dist/src/output/public-result.js +49 -16
- package/dist/src/output/public-result.js.map +1 -1
- package/dist/src/output/receipt-projection.js +13 -5
- package/dist/src/output/receipt-projection.js.map +1 -1
- package/dist/src/output/skill-invocation-notices.d.ts +2 -0
- package/dist/src/output/skill-invocation-notices.js +40 -4
- package/dist/src/output/skill-invocation-notices.js.map +1 -1
- package/dist/src/platforms/capabilities.d.ts +4 -1
- package/dist/src/platforms/capabilities.js +93 -9
- package/dist/src/platforms/capabilities.js.map +1 -1
- package/dist/src/platforms/contracts.d.ts +36 -1
- package/dist/src/platforms/discovery.d.ts +11 -0
- package/dist/src/platforms/discovery.js +170 -30
- package/dist/src/platforms/discovery.js.map +1 -1
- package/dist/src/platforms/inspection-grok.js +121 -9
- package/dist/src/platforms/inspection-grok.js.map +1 -1
- package/dist/src/platforms/inspection-native.js +53 -18
- package/dist/src/platforms/inspection-native.js.map +1 -1
- package/dist/src/platforms/inspection-pi.d.ts +7 -1
- package/dist/src/platforms/inspection-pi.js +295 -95
- package/dist/src/platforms/inspection-pi.js.map +1 -1
- package/dist/src/platforms/inspection-query.d.ts +4 -2
- package/dist/src/platforms/inspection-query.js +24 -8
- package/dist/src/platforms/inspection-query.js.map +1 -1
- package/dist/src/platforms/inspection.d.ts +4 -1
- package/dist/src/platforms/inspection.js +36 -4
- package/dist/src/platforms/inspection.js.map +1 -1
- package/dist/src/platforms/layout.d.ts +6 -0
- package/dist/src/platforms/layout.js +44 -7
- package/dist/src/platforms/layout.js.map +1 -1
- package/dist/src/platforms/lifecycle-native.d.ts +1 -0
- package/dist/src/platforms/lifecycle-native.js +25 -1
- package/dist/src/platforms/lifecycle-native.js.map +1 -1
- package/dist/src/platforms/lifecycle.d.ts +2 -0
- package/dist/src/platforms/lifecycle.js +67 -16
- package/dist/src/platforms/lifecycle.js.map +1 -1
- package/dist/src/platforms/projection-code-extension.js +2 -1
- package/dist/src/platforms/projection-code-extension.js.map +1 -1
- package/dist/src/platforms/projection.js +70 -22
- package/dist/src/platforms/projection.js.map +1 -1
- package/dist/src/platforms/supplement-layout.d.ts +5 -1
- package/dist/src/platforms/supplement-layout.js +23 -1
- package/dist/src/platforms/supplement-layout.js.map +1 -1
- package/dist/src/platforms/supplement-state.d.ts +1 -1
- package/dist/src/platforms/supplement-state.js +18 -7
- package/dist/src/platforms/supplement-state.js.map +1 -1
- package/dist/src/portable/commands.js +1 -1
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +4 -0
- package/dist/src/portable/materializer.js +8 -1
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery.d.ts +2 -0
- package/dist/src/portable/recovery.js +45 -8
- package/dist/src/portable/recovery.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +1 -1
- package/dist/src/recovery/coordinator.js +77 -10
- package/dist/src/recovery/coordinator.js.map +1 -1
- package/dist/src/recovery/install-concurrency.js +3 -2
- package/dist/src/recovery/install-concurrency.js.map +1 -1
- package/dist/src/recovery/joint-coordinator.d.ts +7 -0
- package/dist/src/recovery/joint-coordinator.js +173 -23
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/joint-demand.d.ts +14 -2
- package/dist/src/recovery/joint-demand.js +54 -7
- package/dist/src/recovery/joint-demand.js.map +1 -1
- package/dist/src/recovery/receipt.d.ts +15 -4
- package/dist/src/recovery/receipt.js +23 -0
- package/dist/src/recovery/receipt.js.map +1 -1
- package/dist/src/recovery/status.d.ts +20 -8
- package/dist/src/recovery/status.js +380 -90
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/review/platform-profile.js +2 -1
- 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 +45 -39
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/review/source-binding.js +5 -1
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +67 -30
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +1 -1
- 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 +17 -4
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/deployment-view.d.ts +6 -3
- package/dist/src/tui/deployment-view.js +39 -10
- package/dist/src/tui/deployment-view.js.map +1 -1
- package/dist/src/tui/diagnostic-projection.d.ts +7 -1
- package/dist/src/tui/diagnostic-projection.js +47 -2
- package/dist/src/tui/diagnostic-projection.js.map +1 -1
- package/dist/src/tui/entity-cards.d.ts +2 -1
- package/dist/src/tui/entity-cards.js +34 -11
- package/dist/src/tui/entity-cards.js.map +1 -1
- package/dist/src/tui/glossary.js +5 -0
- package/dist/src/tui/glossary.js.map +1 -1
- package/dist/src/tui/model.js +2 -1
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.js +3 -1
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
- package/dist/src/tui/operation-history.d.ts +6 -0
- package/dist/src/tui/operation-history.js +20 -2
- package/dist/src/tui/operation-history.js.map +1 -1
- package/dist/src/tui/plugin-detail.d.ts +4 -1
- package/dist/src/tui/plugin-detail.js +9 -2
- package/dist/src/tui/plugin-detail.js.map +1 -1
- package/dist/src/tui/scoped-flow.js +34 -16
- package/dist/src/tui/scoped-flow.js.map +1 -1
- package/dist/src/tui/scoped-inventory.d.ts +6 -2
- package/dist/src/tui/scoped-inventory.js +29 -7
- package/dist/src/tui/scoped-inventory.js.map +1 -1
- package/dist/src/types.d.ts +2 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/artifact-plan.js +5 -1
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +1 -1
- package/dist/src/utils/artifact-renderer.js +29 -8
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/catalog-source-references.js +12 -3
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/codex-native-observation.d.ts +6 -0
- package/dist/src/utils/codex-native-observation.js +32 -3
- package/dist/src/utils/codex-native-observation.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +2 -0
- package/dist/src/utils/component-command-preparation.js +23 -4
- package/dist/src/utils/component-command-preparation.js.map +1 -1
- package/dist/src/utils/component-gap.d.ts +4 -0
- package/dist/src/utils/component-gap.js +20 -0
- package/dist/src/utils/component-gap.js.map +1 -0
- package/dist/src/utils/component-resources.js +2 -4
- package/dist/src/utils/component-resources.js.map +1 -1
- package/dist/src/utils/dynamic-skill-tree.js +2 -32
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/native-cli-interruption.d.ts +8 -0
- package/dist/src/utils/native-cli-interruption.js +65 -0
- package/dist/src/utils/native-cli-interruption.js.map +1 -0
- package/dist/src/utils/native-cli.d.ts +5 -0
- package/dist/src/utils/native-cli.js +166 -53
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +1 -0
- package/dist/src/utils/ownership.js +17 -3
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/package-content.d.ts +7 -0
- package/dist/src/utils/package-content.js +70 -0
- package/dist/src/utils/package-content.js.map +1 -0
- package/dist/src/utils/platform-empty-state.d.ts +31 -6
- package/dist/src/utils/platform-empty-state.js +135 -65
- package/dist/src/utils/platform-empty-state.js.map +1 -1
- package/dist/src/utils/plugin-config-write.js +5 -1
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-scripts.js +19 -8
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/process-tree.d.ts +1 -1
- package/dist/src/utils/process-tree.js +1 -1
- package/dist/src/utils/process-tree.js.map +1 -1
- package/dist/src/utils/skill-invocation-warning.d.ts +8 -3
- package/dist/src/utils/skill-invocation-warning.js +27 -1
- package/dist/src/utils/skill-invocation-warning.js.map +1 -1
- package/package.json +3 -3
|
@@ -5,27 +5,32 @@ import { createScopeContext } from '../intent/scope-context.js';
|
|
|
5
5
|
import { resolveIntentPath } from '../intent/intent-store.js';
|
|
6
6
|
import { parsePluginId } from '../utils/multi-source-catalog.js';
|
|
7
7
|
import { inspectPortableExtraInstalled, inspectPortableRecovery, portablePreparationDiagnostic } from '../portable/recovery.js';
|
|
8
|
-
import { readJointDemand, deriveJointDemand } from './joint-demand.js';
|
|
8
|
+
import { readJointDemand, deriveJointDemand, projectSkillCandidates, isInstalledSkillProvider, hasReadyProviderSkills } from './joint-demand.js';
|
|
9
9
|
import { readDemand, resolveDelivery } from './demand.js';
|
|
10
|
-
import {
|
|
10
|
+
import { retainedOutputDiagnostic, scopeNativeComponentGaps, uniqueRecoveryComponentGaps } from './receipt.js';
|
|
11
11
|
import { rethrowFatalError } from '../utils/codex-executable-discovery.js';
|
|
12
12
|
import { createCodexNativeObservationSession } from '../utils/codex-native-observation.js';
|
|
13
13
|
import { getAgentPluginAdapter } from '../platforms/registry.js';
|
|
14
14
|
import { getQualifiedPlatformProfile } from '../platforms/capabilities.js';
|
|
15
|
+
import { isDeliveryCapabilityGap } from '../utils/component-gap.js';
|
|
16
|
+
import { piAgentConsumerDiagnostic, piProjectListsUserSkills } from '../platforms/inspection-pi.js';
|
|
17
|
+
import { gapSupplementFiles } from '../platforms/supplement-layout.js';
|
|
15
18
|
import { inspectPlatformSupplementState } from '../platforms/supplement-state.js';
|
|
16
19
|
import { resolveArtifactRenderConfig } from '../utils/artifact-renderer.js';
|
|
17
|
-
import { createPlatformInputEvidence, matchesPlatformEmptyState, platformPackageInputDigest, readPlatformPackageContentDigest } from '../utils/platform-empty-state.js';
|
|
20
|
+
import { createPlatformInputEvidence, matchesPlatformEmptyState, readPlatformDeliveryState, platformPackageInputDigest, readPlatformPackageContentDigest } from '../utils/platform-empty-state.js';
|
|
21
|
+
import { deliveryNoticeMessage, INVOCATION_POLICY_NOT_APPLIED } from '../output/component-delivery.js';
|
|
22
|
+
import { piProjectEmptyDeliveryObserved } from '../platforms/lifecycle-native.js';
|
|
18
23
|
import { getDeploymentLayout, hasSharedUserPackage } from '../platforms/layout.js';
|
|
24
|
+
import { identityDigest } from '../platforms/identity.js';
|
|
19
25
|
import { deploymentPackageComponent, inspectStaticSupplements, requiredDeploymentActivation } from '../platforms/inspection.js';
|
|
20
26
|
import { resolveStaticPlatformResourceRoot } from '../utils/component-resources.js';
|
|
21
|
-
import { readSkillOwnerMarker } from '../utils/ownership.js';
|
|
27
|
+
import { inspectOwnedComponents, readSkillOwnerMarker } from '../utils/ownership.js';
|
|
22
28
|
import { inventoryCatalogSourceReferences } from '../utils/catalog-source-references.js';
|
|
23
29
|
import { resolvePartialCatalogOperationContext } from '../utils/catalog-operation-context.js';
|
|
24
30
|
import { checkAwCapabilitySupport, readPluginManifest } from '../utils/manifest.js';
|
|
25
31
|
import { IMPLEMENTED_AW_CAPABILITIES } from '../commands/aw-capabilities.js';
|
|
26
|
-
import { resolvePluginMetaDependencyClosure } from '../utils/plugin-dependencies.js';
|
|
32
|
+
import { resolvePluginDependencyClosure, resolvePluginMetaDependencyClosure } from '../utils/plugin-dependencies.js';
|
|
27
33
|
import { installationInvocation, selectNativeProduct } from '../platforms/discovery.js';
|
|
28
|
-
import { DEFAULT_AGENT_VERSION_PROBE_TIMEOUT_MS } from '../constants.js';
|
|
29
34
|
import { inventoryRecoveryDiagnostic } from '../utils/inventory-recovery-diagnostic.js';
|
|
30
35
|
import { measureRecoveryPerformanceStage } from './performance.js';
|
|
31
36
|
import { withNativeObservationBatch } from '../platforms/inspection-query.js';
|
|
@@ -51,7 +56,7 @@ function withStatusNativeQueries(options, read) {
|
|
|
51
56
|
discoveryCache: options.discoveryCache ?? batch.discoveryCache, nativeQuerySession: batch.nativeQuerySession,
|
|
52
57
|
nativeCliRunner: batch.runner }));
|
|
53
58
|
}
|
|
54
|
-
async function readAdapterObservations(options, context, demand) {
|
|
59
|
+
async function readAdapterObservations(options, context, demand, inventory) {
|
|
55
60
|
let selected;
|
|
56
61
|
try {
|
|
57
62
|
selected = selectAgents({ preferences: demand.preferences, targets: options.targets }).agents
|
|
@@ -88,12 +93,7 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
88
93
|
ctx.codexObservationSession.setManager(manager);
|
|
89
94
|
else {
|
|
90
95
|
ownedSession = await createCodexNativeObservationSession({ exactCwd: context.executionCwd, env: context.env, manager,
|
|
91
|
-
runner:
|
|
92
|
-
const result = await runNativeCli({ ...request, signal: options.signal, timeoutMs: DEFAULT_AGENT_VERSION_PROBE_TIMEOUT_MS }, options.nativeCliRunner);
|
|
93
|
-
if (Buffer.byteLength(result.stdout) + Buffer.byteLength(result.stderr) > 1024 * 1024)
|
|
94
|
-
throw new Error('nativeObservationOutputLimit');
|
|
95
|
-
return result;
|
|
96
|
-
} });
|
|
96
|
+
runner: options.nativeCliRunner, probe: { platform: ctx.platform, signal: options.signal } });
|
|
97
97
|
ctx.codexObservationSession = ownedSession;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -101,6 +101,7 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
101
101
|
for (const root of roots) {
|
|
102
102
|
options.signal?.throwIfAborted();
|
|
103
103
|
const observation = { pluginId: root.pluginId, expectedVersion: root.plugin?.manifest.version, platform, content: 'unknown', blockers: [], reasons: [], deploymentObservations: [] };
|
|
104
|
+
let nativePackage;
|
|
104
105
|
observations.push(observation);
|
|
105
106
|
try {
|
|
106
107
|
const plugin = root.plugin;
|
|
@@ -128,6 +129,7 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
128
129
|
const emptyMatches = [];
|
|
129
130
|
const currentMatches = [];
|
|
130
131
|
const versions = [];
|
|
132
|
+
const deliveredIds = new Set();
|
|
131
133
|
const staticResourceRoot = await resolveStaticPlatformResourceRoot(plugin.rootDir, platform);
|
|
132
134
|
for (const binding of resolution.bindings) {
|
|
133
135
|
const subject = { pluginId: root.pluginId, target: platform, scope: binding.scope.kind };
|
|
@@ -143,30 +145,25 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
143
145
|
: live.package === 'present' && live.ownership === 'aw';
|
|
144
146
|
if (scopedNativeConsumer && (live.ownership === 'aw' || live.ownership === 'shared')) {
|
|
145
147
|
owned.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
|
|
146
|
-
|
|
148
|
+
if (!shared)
|
|
149
|
+
nativePackage ??= { sourceIdentity: binding.plugin.sourceIdentity, skillsReady: false };
|
|
150
|
+
existing.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope,
|
|
151
|
+
...(nativePackage ? { nativePackage } : {}) });
|
|
147
152
|
}
|
|
148
153
|
const unmet = [];
|
|
154
|
+
const staticPackageIds = new Set();
|
|
149
155
|
const staticSupplements = [];
|
|
150
156
|
const dynamicUnits = new Set();
|
|
151
157
|
const inputUnits = [];
|
|
152
158
|
const profile = getQualifiedPlatformProfile(platform);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
for (const unit of resolution.renderUnits.filter((unit) => binding.renderUnitIds.includes(unit.id))) {
|
|
159
|
+
const renderUnits = resolution.renderUnits.filter((unit) => binding.renderUnitIds.includes(unit.id));
|
|
160
|
+
for (const unit of renderUnits) {
|
|
156
161
|
const artifacts = plugin.manifest.artifacts;
|
|
157
162
|
if (artifacts && unit.kinds.length && (!artifacts.scopes || artifacts.scopes.includes(unit.renderScope.kind))) {
|
|
158
163
|
dynamicUnits.add(unit.output);
|
|
159
164
|
}
|
|
160
165
|
const capabilities = adapter.capabilities({ binding, renderUnit: unit, observation: live,
|
|
161
166
|
profile });
|
|
162
|
-
const expected = await normalizeStaticPluginComponents({ pluginRoot: plugin.rootDir, staticResourceRoot,
|
|
163
|
-
manifest: plugin.manifest, platform, capabilities, allowedOutputKinds: unit.kinds });
|
|
164
|
-
expectedCount += expected.components.length;
|
|
165
|
-
if (unit.output === 'supplement')
|
|
166
|
-
staticSupplements.push(...expected.components);
|
|
167
|
-
else
|
|
168
|
-
packageExpectedCount += expected.components.length;
|
|
169
|
-
unmet.push(...expected.unmet);
|
|
170
167
|
inputUnits.push({ renderUnit: unit, capabilities,
|
|
171
168
|
config: await resolveArtifactRenderConfig({ pluginName: plugin.manifest.name, sourceId: binding.plugin.sourceId,
|
|
172
169
|
sourceIdentity: binding.plugin.sourceIdentity, logicalIdentity: plugin.catalogLogicalIdentity,
|
|
@@ -174,17 +171,99 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
174
171
|
cwd: unit.renderScope.kind === 'project' ? unit.renderScope.projectRoot : context.executionCwd,
|
|
175
172
|
env: context.env, referencePlugins: demand.plugins }) });
|
|
176
173
|
}
|
|
177
|
-
const
|
|
178
|
-
|
|
174
|
+
const inputEvidence = await createPlatformInputEvidence({ plugin, binding, units: inputUnits }).catch((error) => {
|
|
175
|
+
rethrowFatalError(error);
|
|
176
|
+
options.signal?.throwIfAborted();
|
|
177
|
+
const systemCode = error?.code;
|
|
178
|
+
if (systemCode !== 'ENOENT' && systemCode !== 'ENOTDIR')
|
|
179
|
+
throw error;
|
|
180
|
+
observation.blockers.push({ code: 'componentResourceMissing', message: 'A required plugin source file or directory is missing.',
|
|
181
|
+
subject, detail: { reasonCode: systemCode } });
|
|
182
|
+
return undefined;
|
|
183
|
+
});
|
|
184
|
+
if (!inputEvidence) {
|
|
185
|
+
states.push('unknown');
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
const readPackageProjection = async () => {
|
|
189
|
+
const layout = await getDeploymentLayout(ctx, binding);
|
|
190
|
+
const marker = await readSkillOwnerMarker({ skillRoot: layout.packageRoot, allowedRoot: path.dirname(layout.packageRoot),
|
|
191
|
+
expectedIdentity: deploymentPackageComponent(binding, layout).identity });
|
|
192
|
+
return { layout, projection: marker?.nativeProjection };
|
|
193
|
+
};
|
|
194
|
+
const packageUnit = renderUnits.find((unit) => unit.output === 'package');
|
|
195
|
+
const rolePackage = (platform === 'copilot' || platform === 'grok') && packageUnit?.kinds.includes('agent')
|
|
196
|
+
&& dynamicUnits.has('package') && plugin.manifest.extensions?.instructions?.length
|
|
197
|
+
&& live.package === 'present' && live.ownership === 'aw' ? await readPackageProjection() : undefined;
|
|
198
|
+
// The current package projection identifies renderer-produced roles. File presence and bytes are checked below.
|
|
199
|
+
const roleProjection = rolePackage?.projection;
|
|
200
|
+
const projectedRole = rolePackage && roleProjection?.preparation === 'complete'
|
|
201
|
+
&& roleProjection.inputDigest === platformPackageInputDigest(inputEvidence)
|
|
202
|
+
&& identityDigest(roleProjection.physicalIdentity) === identityDigest(rolePackage.layout.physicalIdentity)
|
|
203
|
+
&& roleProjection.components.some(({ nativeName, relativeOutputs }) => relativeOutputs.includes(platform === 'copilot'
|
|
204
|
+
? `com.github.copilot/agents/${nativeName}.agent.md` : `agents/${nativeName}.md`));
|
|
205
|
+
let expectedCount = 0;
|
|
206
|
+
let grokAgentRecipientScope;
|
|
207
|
+
for (const { renderUnit: unit, capabilities } of inputUnits) {
|
|
208
|
+
const expected = await normalizeStaticPluginComponents({ pluginRoot: plugin.rootDir, staticResourceRoot,
|
|
209
|
+
manifest: plugin.manifest, platform, capabilities, allowedOutputKinds: unit.kinds,
|
|
210
|
+
hasInstructionAgentRecipients: platform === 'grok' && unit.output === 'supplement'
|
|
211
|
+
? grokAgentRecipientScope === identityDigest(unit.renderScope) : projectedRole || undefined });
|
|
212
|
+
if (platform === 'grok' && unit.output === 'package'
|
|
213
|
+
&& (projectedRole || expected.components.some(({ kind }) => kind === 'agent'))) {
|
|
214
|
+
grokAgentRecipientScope = identityDigest(unit.renderScope);
|
|
215
|
+
}
|
|
216
|
+
expectedCount += expected.components.length;
|
|
217
|
+
for (const component of expected.components) {
|
|
218
|
+
const grokRoleText = platform === 'grok' && component.kind === 'instruction' && !component.content.coverage.includes('main');
|
|
219
|
+
if (unit.output === 'supplement' && !grokRoleText)
|
|
220
|
+
staticSupplements.push(component);
|
|
221
|
+
else
|
|
222
|
+
staticPackageIds.add(component.id);
|
|
223
|
+
}
|
|
224
|
+
unmet.push(...expected.unmet);
|
|
225
|
+
}
|
|
226
|
+
const recordedDelivery = await readPlatformDeliveryState({ input: inputEvidence, env: context.env });
|
|
227
|
+
const recordedGaps = recordedDelivery?.result === 'capability-gaps' && recordedDelivery.gaps.length ? recordedDelivery : undefined;
|
|
228
|
+
for (const { field, ...detail } of recordedDelivery?.permissionNotices ?? []) {
|
|
229
|
+
observation.reasons.push({ code: INVOCATION_POLICY_NOT_APPLIED, subject: { ...subject, field }, detail,
|
|
230
|
+
message: deliveryNoticeMessage(INVOCATION_POLICY_NOT_APPLIED, detail, field) });
|
|
231
|
+
}
|
|
232
|
+
const currentIds = recordedGaps ? new Set(recordedGaps.installedComponentIds) : undefined;
|
|
233
|
+
if (currentIds && recordedGaps) {
|
|
234
|
+
// A renderer receipt can add dynamic expectations. A positive static
|
|
235
|
+
// expectation remains unless that specific component was skipped.
|
|
236
|
+
const skipped = new Set(recordedGaps.gaps.filter((gap) => !gap.componentId).map((gap) => gap.id));
|
|
237
|
+
for (const id of [...staticPackageIds, ...staticSupplements.map((component) => component.id)]) {
|
|
238
|
+
if (!skipped.has(id))
|
|
239
|
+
currentIds.add(id);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
let packageExpectedCount = staticPackageIds.size;
|
|
243
|
+
const expectedSupplements = currentIds ? staticSupplements.filter(({ id }) => currentIds.has(id)) : staticSupplements;
|
|
244
|
+
const supplements = await inspectStaticSupplements(ctx, binding, expectedSupplements);
|
|
245
|
+
const gaps = recordedGaps?.gaps ?? unmet;
|
|
246
|
+
const blockingGaps = gaps.filter((gap) => !isDeliveryCapabilityGap(gap));
|
|
247
|
+
if (gaps.length) {
|
|
248
|
+
(observation.componentGaps ??= []).push(...scopeNativeComponentGaps(gaps, { pluginId: root.pluginId, agent: platform, scope: binding.scope.kind }, renderUnits));
|
|
249
|
+
}
|
|
179
250
|
const supplementInput = inputEvidence.units.find((unit) => unit.output === 'supplement');
|
|
251
|
+
const emptyPackageIds = recordedDelivery?.result === 'intentional-empty-package' ? recordedDelivery.installedComponentIds : undefined;
|
|
180
252
|
const recordedSupplements = dynamicUnits.has('supplement') && supplementInput
|
|
181
|
-
? await inspectPlatformSupplementState(ctx, binding, supplementInput.inputDigest) : null;
|
|
253
|
+
? await inspectPlatformSupplementState(ctx, binding, supplementInput.inputDigest, emptyPackageIds) : null;
|
|
182
254
|
if (recordedSupplements) {
|
|
183
255
|
const staticIds = new Set(supplements.components.map((component) => component.id));
|
|
184
256
|
const dynamicComponents = recordedSupplements.components.filter((component) => !staticIds.has(component.id));
|
|
185
257
|
supplements.components.push(...dynamicComponents);
|
|
186
258
|
expectedCount += dynamicComponents.length;
|
|
187
259
|
}
|
|
260
|
+
const supplementIds = new Set(supplements.components.map(({ id }) => id));
|
|
261
|
+
if (currentIds) {
|
|
262
|
+
expectedCount = currentIds.size;
|
|
263
|
+
packageExpectedCount = [...currentIds].filter((id) => !supplementIds.has(id)).length;
|
|
264
|
+
}
|
|
265
|
+
const supplementSetUnconfirmed = emptyPackageIds
|
|
266
|
+
&& (emptyPackageIds.length !== supplementIds.size || emptyPackageIds.some((id) => !supplementIds.has(id)));
|
|
188
267
|
const supplementConflict = supplements.components.some((component) => component.reasonCodes.includes('supplementOwnershipConflict'));
|
|
189
268
|
const supplementMissing = supplements.components.some((component) => component.presence === 'absent');
|
|
190
269
|
const supplementDrift = supplements.components.some((component) => component.reasonCodes.includes('componentContentDrift'));
|
|
@@ -205,17 +284,20 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
205
284
|
owned.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
|
|
206
285
|
existing.push({ pluginId: root.pluginId, agent: platform, scope: demand.scope });
|
|
207
286
|
}
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
&&
|
|
212
|
-
|
|
213
|
-
|
|
287
|
+
const onlyCapabilityGaps = expectedCount === 0 && gaps.length > 0 && !blockingGaps.length;
|
|
288
|
+
const capabilityEmpty = onlyCapabilityGaps && recordedGaps !== undefined;
|
|
289
|
+
const confirmedEmpty = capabilityEmpty || Boolean(plugin.manifest.artifacts && expectedCount === 0 && gaps.length === 0
|
|
290
|
+
&& recordedDelivery?.result === 'intentional-empty');
|
|
291
|
+
const confirmedEmptyPackage = packageExpectedCount === 0 && (Boolean(currentIds?.size)
|
|
292
|
+
|| dynamicUnits.has('package') && (recordedDelivery?.result === 'intentional-empty-package'
|
|
293
|
+
|| binding.route === 'codex-marketplace' && recordedSupplements !== null
|
|
294
|
+
&& await matchesPlatformEmptyState({ state: { ...inputEvidence, kind: 'aw-platform-empty-state', result: 'intentional-empty',
|
|
295
|
+
units: inputEvidence.units.filter((unit) => unit.output === 'package') }, env: context.env })));
|
|
214
296
|
const dynamicSupplementsUnconfirmed = dynamicUnits.has('supplement') && !confirmedEmpty
|
|
215
297
|
&& !recordedSupplements?.inputMatches && !supplementInputDrift;
|
|
216
|
-
if (dynamicSupplementsUnconfirmed)
|
|
298
|
+
if (dynamicSupplementsUnconfirmed || supplementSetUnconfirmed)
|
|
217
299
|
warn('dynamicExpectationUnconfirmed');
|
|
218
|
-
const hasPackageExpectation = packageExpectedCount > 0 || dynamicUnits.has('package') && !confirmedEmpty && !confirmedEmptyPackage;
|
|
300
|
+
const hasPackageExpectation = packageExpectedCount > 0 || !currentIds && dynamicUnits.has('package') && !confirmedEmpty && !confirmedEmptyPackage;
|
|
219
301
|
const inheritsUserNative = demand.targetRequirements?.find((item) => item.pluginId === root.pluginId
|
|
220
302
|
&& item.target === platform)?.inheritsUserNative;
|
|
221
303
|
const requiredActivation = requiredDeploymentActivation(binding, live, !inheritsUserNative);
|
|
@@ -227,9 +309,18 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
227
309
|
? observation.blockers : observation.reasons;
|
|
228
310
|
destination.push({ code: entry.code, message: entry.message, subject: { ...subject, ...entry.subject }, detail: entry.detail });
|
|
229
311
|
}
|
|
312
|
+
const legacyAntigravityPackage = live.antigravityLegacyProjectPackage;
|
|
313
|
+
if (legacyAntigravityPackage?.state === 'owned')
|
|
314
|
+
observation.reasons.push({
|
|
315
|
+
code: 'antigravityProjectPackageMigrationPending',
|
|
316
|
+
message: 'Sync this plugin to finish moving it to the short Antigravity project path.',
|
|
317
|
+
subject,
|
|
318
|
+
detail: { reasonCode: 'antigravityProjectPackageMigrationPending', path: legacyAntigravityPackage.path },
|
|
319
|
+
});
|
|
230
320
|
const requiresScopeRegistration = binding.route === 'claude-marketplace' && !inheritsUserNative;
|
|
231
321
|
const registration = requiresScopeRegistration ? live.scopeRegistration ?? 'unknown' : live.registration;
|
|
232
|
-
const ownershipConflict = live.ownership === 'foreign' || live.ownership === 'shared'
|
|
322
|
+
const ownershipConflict = live.ownership === 'foreign' || live.ownership === 'shared'
|
|
323
|
+
|| legacyAntigravityPackage?.state === 'unconfirmed';
|
|
233
324
|
if (ownershipConflict)
|
|
234
325
|
block('deploymentOwnershipConflict');
|
|
235
326
|
const missing = hasPackageExpectation && (live.package === 'absent' && packageExpectedCount > 0
|
|
@@ -251,10 +342,7 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
251
342
|
let nativeContentDrift = false;
|
|
252
343
|
let nativeContentUnconfirmed = false;
|
|
253
344
|
if (hasPackageExpectation && live.package === 'present' && live.ownership === 'aw' && !missing) {
|
|
254
|
-
const layout = await
|
|
255
|
-
const marker = await readSkillOwnerMarker({ skillRoot: layout.packageRoot, allowedRoot: path.dirname(layout.packageRoot),
|
|
256
|
-
expectedIdentity: deploymentPackageComponent(binding, layout).identity });
|
|
257
|
-
const projection = marker?.nativeProjection;
|
|
345
|
+
const { layout, projection } = rolePackage ?? await readPackageProjection();
|
|
258
346
|
const contentDigest = projection ? await readPlatformPackageContentDigest(layout.packageRoot) : undefined;
|
|
259
347
|
if (['grok-cli', 'antigravity-cli'].includes(binding.route) && live.registration === 'present') {
|
|
260
348
|
nativeContentUnconfirmed = !contentDigest || !live.nativePackageContentDigest;
|
|
@@ -266,15 +354,18 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
266
354
|
warn('nativePackageContentDrift');
|
|
267
355
|
}
|
|
268
356
|
projectionUnconfirmed = !projection || projection.preparation !== 'complete' || !contentDigest;
|
|
269
|
-
const packageInputDigest = platformPackageInputDigest(inputEvidence);
|
|
357
|
+
const packageInputDigest = platformPackageInputDigest(inputEvidence, projection?.components);
|
|
270
358
|
inputDrift = Boolean(projection && (projection.inputDigest !== packageInputDigest
|
|
271
359
|
|| contentDigest && projection.contentDigest !== contentDigest));
|
|
272
360
|
if (projectionUnconfirmed)
|
|
273
361
|
warn(projection?.preparation === 'partial'
|
|
274
362
|
? 'platformPreparationPartial' : 'platformExpectationUnconfirmed');
|
|
275
|
-
else if (inputDrift)
|
|
276
|
-
|
|
277
|
-
|
|
363
|
+
else if (inputDrift) {
|
|
364
|
+
if (projection.inputDigest !== packageInputDigest)
|
|
365
|
+
warn('platformInputDrift');
|
|
366
|
+
if (projection.contentDigest !== contentDigest)
|
|
367
|
+
warn('platformContentDrift');
|
|
368
|
+
}
|
|
278
369
|
componentMissing = live.components.some((component) => component.presence === 'absent');
|
|
279
370
|
componentUnknown = live.components.some((component) => component.presence === 'unknown'
|
|
280
371
|
&& !component.reasonCodes.includes('nativePackageContentDrift'));
|
|
@@ -284,23 +375,82 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
284
375
|
warn('componentOutputUnconfirmed');
|
|
285
376
|
packageExpectationConfirmed = Boolean(!projectionUnconfirmed && projection.inputDigest === packageInputDigest
|
|
286
377
|
&& projection.components.length > 0);
|
|
287
|
-
if (packageExpectationConfirmed)
|
|
378
|
+
if (packageExpectationConfirmed) {
|
|
288
379
|
expectedCount = Math.max(expectedCount, projection.components.length);
|
|
380
|
+
if (platform === 'pi' && !inputDrift) {
|
|
381
|
+
const roles = projection.components.filter((component) => component.relativeOutputs.some((output) => /^agents\/[^/]+\.md$/u.test(output))
|
|
382
|
+
&& live.components.some((entry) => entry.id === component.id && entry.presence === 'present' && !entry.reasonCodes.length));
|
|
383
|
+
const warning = piAgentConsumerDiagnostic(binding, live, roles.map(({ id }) => id));
|
|
384
|
+
if (warning)
|
|
385
|
+
observation.reasons.push(warning);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
const confirmedPackage = packageExpectationConfirmed && !inputDrift && !nativeContentDrift && !nativeContentUnconfirmed;
|
|
390
|
+
const confirmedComponents = [...(confirmedPackage ? live.components : []), ...supplements.components];
|
|
391
|
+
for (const component of confirmedComponents) {
|
|
392
|
+
if (component.presence === 'present' && !component.reasonCodes.length && (!currentIds || currentIds.has(component.id))) {
|
|
393
|
+
deliveredIds.add(component.id);
|
|
394
|
+
}
|
|
289
395
|
}
|
|
290
396
|
live.components.push(...supplements.components);
|
|
291
|
-
currentMatches.push(!dynamicUnits.size || confirmedEmpty || packageExpectationConfirmed || missing
|
|
292
|
-
|| recordedSupplements !== null && !hasPackageExpectation);
|
|
293
|
-
emptyMatches.push(confirmedEmpty);
|
|
294
|
-
for (const entry of
|
|
397
|
+
currentMatches.push(Boolean(currentIds) || !dynamicUnits.size || confirmedEmpty || packageExpectationConfirmed || missing
|
|
398
|
+
|| !dynamicSupplementsUnconfirmed && confirmedEmptyPackage || recordedSupplements !== null && !hasPackageExpectation);
|
|
399
|
+
emptyMatches.push(confirmedEmpty && !capabilityEmpty);
|
|
400
|
+
for (const entry of blockingGaps)
|
|
295
401
|
block(entry.reasonCode);
|
|
402
|
+
if (legacyAntigravityPackage?.state === 'owned' && !ownershipConflict
|
|
403
|
+
&& live.ownership !== 'unknown' && !blockingGaps.length) {
|
|
404
|
+
states.push('drifted');
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
296
407
|
const inactiveScope = live.registration === 'absent'
|
|
297
408
|
|| live.package === 'absent' && live.registration === 'not-applicable'
|
|
298
409
|
|| live.scopeRegistration === 'absent'
|
|
299
410
|
|| binding.scope.kind === 'project' && shared && live.configuration?.activation === 'absent'
|
|
300
411
|
|| live.consumers.every((consumer) => ['disabled', 'not-applicable'].includes(consumer.activation));
|
|
412
|
+
const skippedFiles = gaps.filter((gap) => supplementInput?.kinds.includes(gap.kind) && gap.name
|
|
413
|
+
&& !currentIds?.has(gap.componentId ?? gap.id)
|
|
414
|
+
&& !expectedSupplements.some((component) => component.kind === gap.kind && component.name === gap.name));
|
|
415
|
+
if (skippedFiles.length) {
|
|
416
|
+
const slots = gapSupplementFiles(binding, await getDeploymentLayout(ctx, binding), skippedFiles);
|
|
417
|
+
const checked = await inspectOwnedComponents({ components: slots });
|
|
418
|
+
const retained = checked.components.filter((item) => item.state !== 'absent');
|
|
419
|
+
if (retained.length) {
|
|
420
|
+
for (const item of retained)
|
|
421
|
+
if ('path' in item.component) {
|
|
422
|
+
observation.blockers.push(retainedOutputDiagnostic(root.pluginId, platform, binding.scope.kind, item.component.path));
|
|
423
|
+
}
|
|
424
|
+
states.push(retained.some((item) => item.state === 'foreign') ? 'conflict'
|
|
425
|
+
: retained.some((item) => item.state === 'error') ? 'unknown' : 'drifted');
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (onlyCapabilityGaps) {
|
|
430
|
+
const supplementKey = supplementInput?.physicalKey;
|
|
431
|
+
const retained = supplementKey ? inventory.flatMap(({ ownedComponent }) => ownedComponent?.kind === 'owned-text-file' && ownedComponent.identity.physicalKey === supplementKey
|
|
432
|
+
&& ownedComponent.identity.sourceIdentity === binding.plugin.sourceIdentity && ownedComponent.identity.pluginId === root.pluginId
|
|
433
|
+
? [ownedComponent.path] : []) : [];
|
|
434
|
+
const piRegistrationRemaining = binding.route === 'pi-package'
|
|
435
|
+
&& (live.registration === 'present' || live.configuration?.activation === 'enabled');
|
|
436
|
+
if ((live.package === 'present' && (!shared || !inactiveScope) || piRegistrationRemaining) && live.nativeIdentity) {
|
|
437
|
+
retained.push(live.nativeIdentity.sourceLocation);
|
|
438
|
+
}
|
|
439
|
+
if (binding.route === 'cursor-workspace-hook' && live.workspaceOpen === 'present') {
|
|
440
|
+
retained.push((await getDeploymentLayout(ctx, binding)).activationPath);
|
|
441
|
+
}
|
|
442
|
+
if (retained.length) {
|
|
443
|
+
observation.blockers.push(...retained.map((file) => retainedOutputDiagnostic(root.pluginId, platform, binding.scope.kind, file)));
|
|
444
|
+
states.push(ownershipConflict ? 'conflict' : 'drifted');
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
301
448
|
if (confirmedEmpty) {
|
|
302
|
-
|
|
303
|
-
|
|
449
|
+
const hiddenEmptyPi = capabilityEmpty && piProjectEmptyDeliveryObserved(binding, live);
|
|
450
|
+
const cursorHookUnconfirmed = capabilityEmpty && binding.route === 'cursor-workspace-hook' && live.workspaceOpen !== 'absent';
|
|
451
|
+
const piConfigUnconfirmed = capabilityEmpty && binding.route === 'pi-package' && live.configuration?.activation !== 'absent';
|
|
452
|
+
states.push(ownershipConflict ? 'conflict' : live.package === 'unknown' || live.registration === 'unknown' && !hiddenEmptyPi
|
|
453
|
+
|| live.ownership === 'unknown' || observation.blockers.length || cursorHookUnconfirmed || piConfigUnconfirmed || !inactiveScope && !hiddenEmptyPi ? 'unknown'
|
|
304
454
|
: live.package === 'absent' || shared ? 'satisfied' : 'drifted');
|
|
305
455
|
continue;
|
|
306
456
|
}
|
|
@@ -325,11 +475,15 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
325
475
|
states.push('conflict');
|
|
326
476
|
else if (confirmedEmptyPackage && (live.package === 'unknown' || live.registration === 'unknown' || live.ownership === 'unknown'))
|
|
327
477
|
states.push('unknown');
|
|
328
|
-
else if (confirmedEmptyPackage && !inactiveScope) {
|
|
478
|
+
else if (confirmedEmptyPackage && (!inactiveScope || !shared && live.package === 'present')) {
|
|
329
479
|
warn('platformContentDrift');
|
|
330
480
|
states.push('drifted');
|
|
331
481
|
}
|
|
332
|
-
else if (
|
|
482
|
+
else if (onlyCapabilityGaps) {
|
|
483
|
+
warn('platformExpectationUnconfirmed');
|
|
484
|
+
states.push('unknown');
|
|
485
|
+
}
|
|
486
|
+
else if (blockingGaps.length || hasPackageExpectation && registration === 'unknown')
|
|
333
487
|
states.push('unknown');
|
|
334
488
|
else if (missing)
|
|
335
489
|
states.push('absent');
|
|
@@ -342,7 +496,7 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
342
496
|
else if (hasPackageExpectation && ['disabled', 'blocked'].includes(requiredActivation)
|
|
343
497
|
|| live.workspaceOpen === 'absent' && live.package === 'present' || inputDrift || supplementDrift || supplementInputDrift || nativeContentDrift)
|
|
344
498
|
states.push('drifted');
|
|
345
|
-
else if (dynamicSupplementsUnconfirmed || hasPackageExpectation && !packageExpectationConfirmed)
|
|
499
|
+
else if (dynamicSupplementsUnconfirmed || supplementSetUnconfirmed || hasPackageExpectation && !packageExpectationConfirmed)
|
|
346
500
|
states.push('unknown');
|
|
347
501
|
else if (!expectedCount)
|
|
348
502
|
states.push(live.package === 'absent' && ['absent', 'not-applicable'].includes(live.registration) ? 'satisfied' : 'drifted');
|
|
@@ -355,6 +509,11 @@ async function readAdapterObservations(options, context, demand) {
|
|
|
355
509
|
observation.installedVersion = versions[0];
|
|
356
510
|
observation.content = ['conflict', 'drifted', 'absent', 'unknown']
|
|
357
511
|
.find((state) => states.includes(state)) ?? 'satisfied';
|
|
512
|
+
if (observation.content === 'satisfied' || observation.content === 'absent' || deliveredIds.size) {
|
|
513
|
+
observation.installedComponentIds = [...deliveredIds];
|
|
514
|
+
}
|
|
515
|
+
if (nativePackage)
|
|
516
|
+
nativePackage.skillsReady = hasReadyProviderSkills({ ...observation, installedComponentCount: deliveredIds.size });
|
|
358
517
|
}
|
|
359
518
|
catch (error) {
|
|
360
519
|
rethrowFatalError(error);
|
|
@@ -453,6 +612,12 @@ export async function statusFromObservations(options) {
|
|
|
453
612
|
&& entry.platform === delivery.platform);
|
|
454
613
|
if (native) {
|
|
455
614
|
target.content = native.content;
|
|
615
|
+
if (native.componentGaps?.length)
|
|
616
|
+
target.componentGaps = native.componentGaps;
|
|
617
|
+
if (native.installedComponentIds) {
|
|
618
|
+
target.installedComponentIds = native.installedComponentIds;
|
|
619
|
+
target.installedComponentCount = native.installedComponentIds.length;
|
|
620
|
+
}
|
|
456
621
|
if (native.installedVersion)
|
|
457
622
|
target.installedVersion = native.installedVersion;
|
|
458
623
|
if (native.deploymentObservations)
|
|
@@ -479,24 +644,38 @@ export async function statusFromObservations(options) {
|
|
|
479
644
|
cliVersion: options.cliVersion ?? '0.0.0', catalogOperationContext: demand.catalogOperationContext,
|
|
480
645
|
excludedPluginIds: demand.userProviders?.[agent] }, options.catalogReadScope);
|
|
481
646
|
options.signal?.throwIfAborted();
|
|
482
|
-
target.blockers.push(...portable.blockers.map((code) => portablePreparationDiagnostic(portable, diagnostic(code), agent)));
|
|
647
|
+
target.blockers.push(...portable.blockers.filter((code) => code !== 'previousDeploymentRetained').map((code) => portablePreparationDiagnostic(portable, diagnostic(code), agent)));
|
|
648
|
+
if (portable.policyNotices?.length)
|
|
649
|
+
target.reasons = [...target.reasons ?? [], ...portable.policyNotices];
|
|
483
650
|
const gaps = (portable.unmet ?? []).filter((gap) => gap.agent === agent);
|
|
484
|
-
|
|
651
|
+
const blockingGap = gaps.some((gap) => !isDeliveryCapabilityGap(gap));
|
|
652
|
+
if (gaps.length)
|
|
485
653
|
target.componentGaps = gaps;
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
654
|
+
if (blockingGap && !target.blockers.some((entry) => entry.code === 'portableComponentsUnmet'))
|
|
655
|
+
target.blockers.push(diagnostic('portableComponentsUnmet'));
|
|
489
656
|
const observed = portable.targets.filter((entry) => entry.agent === agent);
|
|
490
|
-
|
|
657
|
+
if (!portable.globalBlockers?.length) {
|
|
658
|
+
const installed = observed.filter((entry) => entry.providerPluginId === root.pluginId
|
|
659
|
+
&& entry.disposition === 'write' && entry.observation === 'satisfied' && !entry.blocker);
|
|
660
|
+
if (installed.length || observed.every((entry) => entry.disposition === 'retain'
|
|
661
|
+
|| entry.observation === 'satisfied' || entry.observation === 'absent')) {
|
|
662
|
+
target.installedComponentCount = installed.length;
|
|
663
|
+
if (installed.every((entry) => entry.componentId))
|
|
664
|
+
target.installedComponentIds = installed.map((entry) => entry.componentId);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
target.blockers.push(...observed.flatMap((entry) => entry.disposition === 'retain'
|
|
668
|
+
? [retainedOutputDiagnostic(entry.providerPluginId, agent, options.scope, entry.physicalPath, `skill.${entry.skill}`)]
|
|
669
|
+
: entry.blocker ? [diagnostic(entry.blocker)] : []));
|
|
491
670
|
target.content = ['conflict', 'drifted', 'absent', 'unknown']
|
|
492
671
|
.find((state) => observed.some((entry) => entry.observation === state))
|
|
493
|
-
?? (!portable.blockers.length && (observed.length || portable.intentionalEmpty
|
|
672
|
+
?? (!portable.blockers.length && (observed.length || portable.intentionalEmpty || gaps.length && !blockingGap) ? 'satisfied' : 'unknown');
|
|
494
673
|
if (observed.length === 0 && portable.blockers.includes('needs-preparation') && options.portableCoverage === true
|
|
495
674
|
&& options.portableInstalled && !options.portableInstalled.some((item) => item.pluginId === root.pluginId && item.agent === agent)) {
|
|
496
675
|
target.content = 'absent';
|
|
497
676
|
target.blockers = target.blockers.filter((item) => item.code !== 'needs-preparation');
|
|
498
677
|
}
|
|
499
|
-
if (
|
|
678
|
+
if ((blockingGap || observed.some((entry) => entry.disposition === 'retain')) && target.content !== 'conflict')
|
|
500
679
|
target.content = 'unknown';
|
|
501
680
|
target.backend = observed.map((entry) => ({ skill: entry.skill, agent: entry.agent,
|
|
502
681
|
ownership: entry.ownership, observation: entry.observation, associatedAgents: entry.associatedAgents }));
|
|
@@ -519,6 +698,10 @@ export async function statusFromObservations(options) {
|
|
|
519
698
|
target.reasons = [...target.reasons ?? [], diagnostic('dynamicExpectationUnconfirmed')];
|
|
520
699
|
}
|
|
521
700
|
}
|
|
701
|
+
if (target.content === 'satisfied' && !target.blockers.length && target.installedComponentCount === 0
|
|
702
|
+
&& target.componentGaps?.some((gap) => gap.providerPluginId === target.pluginId) && target.componentGaps.every(isDeliveryCapabilityGap)) {
|
|
703
|
+
target.satisfaction = 'not-applicable';
|
|
704
|
+
}
|
|
522
705
|
target.observation = target.content === 'satisfied' ? 'verified'
|
|
523
706
|
: target.content === 'absent' ? 'missing' : 'unknown';
|
|
524
707
|
targetResults.push(target);
|
|
@@ -646,7 +829,7 @@ export async function readScopedRecoveryStatus(options) {
|
|
|
646
829
|
targetRequirements: demand.targetRequirements ? [...demand.targetRequirements,
|
|
647
830
|
...candidates.map((entry) => ({ pluginId: `${entry.sourceId}/${entry.pluginName}`, target: entry.platform }))] : undefined };
|
|
648
831
|
const adapters = options.nativeObservations ? { observations: [], existing: [], owned: [] }
|
|
649
|
-
: await withStatusNativeQueries({ ...options, targets: [...new Set([...selectedAgents, ...candidates.map((entry) => entry.platform)])] }, (nativeOptions) => readAdapterObservations(nativeOptions, context, observationDemand));
|
|
832
|
+
: await withStatusNativeQueries({ ...options, targets: [...new Set([...selectedAgents, ...candidates.map((entry) => entry.platform)])] }, (nativeOptions) => readAdapterObservations(nativeOptions, context, observationDemand, candidates));
|
|
650
833
|
const roots = new Set(demand.roots?.map((root) => root.pluginId) ?? []);
|
|
651
834
|
const queue = [...(demand.roots ?? []).map((root) => root.plugin).filter((plugin) => plugin !== undefined)];
|
|
652
835
|
const byId = new Map(demand.plugins.map((plugin) => [plugin.pluginId, plugin]));
|
|
@@ -687,19 +870,41 @@ export async function readScopedRecoveryStatus(options) {
|
|
|
687
870
|
nativeExtraObserved.push({ ...entry, delivery: { kind: 'native', platform: entry.agent }, observation: 'unknown', content: 'unknown' });
|
|
688
871
|
}
|
|
689
872
|
}
|
|
873
|
+
const retainedProjectPackages = [];
|
|
690
874
|
for (const entry of candidates) {
|
|
691
875
|
const component = entry.ownedComponent;
|
|
692
|
-
|
|
693
|
-
|
|
876
|
+
const recovery = entry.recoveryCandidate;
|
|
877
|
+
if (component?.kind !== 'owned-directory' || recovery?.evidence !== 'verified' || component.identity.scope !== options.scope
|
|
694
878
|
|| component.identity.sourceId !== entry.sourceId || component.identity.sourceIdentity !== entry.sourceIdentity
|
|
695
879
|
|| component.identity.platform !== entry.platform || component.identity.pluginId !== `${entry.sourceId}/${entry.pluginName}`
|
|
696
|
-
|| component.identity.physicalKey !==
|
|
880
|
+
|| component.identity.physicalKey !== recovery.binding.physicalKey)
|
|
697
881
|
continue;
|
|
698
882
|
const pluginId = component.identity.pluginId;
|
|
883
|
+
const agent = entry.platform;
|
|
884
|
+
const sourceIdentity = recovery.binding.plugin.sourceIdentity;
|
|
885
|
+
if (!hasSharedUserPackage(agent)) {
|
|
886
|
+
const location = recovery.binding.scope;
|
|
887
|
+
if (location.kind !== 'project' || location.projectRoot !== context.projectRoot
|
|
888
|
+
|| adapters.existing.some((target) => target.pluginId === pluginId && target.agent === agent
|
|
889
|
+
&& target.nativePackage?.sourceIdentity === sourceIdentity))
|
|
890
|
+
continue;
|
|
891
|
+
const source = catalogSources.get(entry.sourceId)?.resolution;
|
|
892
|
+
let dependencies = null;
|
|
893
|
+
if (source?.sourceIdentity === sourceIdentity && source.manifest.entries.some((plugin) => plugin.name === entry.pluginName)) {
|
|
894
|
+
try {
|
|
895
|
+
dependencies = resolvePluginDependencyClosure(source.manifest.entries, [entry.pluginName])
|
|
896
|
+
.filter((plugin) => plugin.name !== entry.pluginName).map((plugin) => `${entry.sourceId}/${plugin.name}`);
|
|
897
|
+
}
|
|
898
|
+
catch { /* An unavailable closure retains only same-source candidates. */ }
|
|
899
|
+
}
|
|
900
|
+
retainedProjectPackages.push({ pluginId, agent, scope: 'project', dependencies,
|
|
901
|
+
nativePackage: { sourceIdentity, skillsReady: false } });
|
|
902
|
+
continue;
|
|
903
|
+
}
|
|
699
904
|
if (observedPlugins.get(pluginId)?.sourceIdentity === component.identity.sourceIdentity)
|
|
700
905
|
continue;
|
|
701
|
-
nativeExtraObserved.push({ pluginId, agent
|
|
702
|
-
delivery: { kind: 'native', platform:
|
|
906
|
+
nativeExtraObserved.push({ pluginId, agent, scope: component.identity.scope,
|
|
907
|
+
delivery: { kind: 'native', platform: agent }, observation: 'unknown', content: 'unknown',
|
|
703
908
|
backend: { retainedPackage: true, ownedComponents: [{ ...component, state: 'present' }] } });
|
|
704
909
|
}
|
|
705
910
|
const portableExtra = options.targets && !options.targets.includes('generic') ? { targets: [], complete: true }
|
|
@@ -770,6 +975,7 @@ export async function readScopedRecoveryStatus(options) {
|
|
|
770
975
|
...adapters.existing,
|
|
771
976
|
...portableExtra.targets.map((target) => ({ pluginId: target.pluginId, agent: target.agent, scope: options.scope })),
|
|
772
977
|
];
|
|
978
|
+
result.retainedProjectPackages = retainedProjectPackages;
|
|
773
979
|
result.ownedTargets = [
|
|
774
980
|
...adapters.owned, ...inventoryOwned,
|
|
775
981
|
...portableExtra.targets.map((target) => ({ pluginId: target.pluginId, agent: target.agent, scope: options.scope })),
|
|
@@ -821,6 +1027,15 @@ export async function checkRecovery(selectors, options) {
|
|
|
821
1027
|
coverage: { scopes: status.coverage.scopes ?? [status.scope], ...(status.coverage.projectRoot ? { projectRoot: status.coverage.projectRoot } : {}) },
|
|
822
1028
|
declarationChanged: false, preferencesChanged: false, configChanged: false, outputsMayHaveChanged: false };
|
|
823
1029
|
}
|
|
1030
|
+
function observedSatisfaction(content, provider, inheritsUser) {
|
|
1031
|
+
if (!content || content === 'unknown')
|
|
1032
|
+
return 'unknown';
|
|
1033
|
+
if (content !== 'satisfied')
|
|
1034
|
+
return 'pending';
|
|
1035
|
+
if (provider?.satisfaction === 'not-applicable')
|
|
1036
|
+
return 'not-applicable';
|
|
1037
|
+
return inheritsUser ? 'inherited-user' : 'installed';
|
|
1038
|
+
}
|
|
824
1039
|
export function aggregateConvergence(allSatisfied, residue) {
|
|
825
1040
|
return allSatisfied === false || residue === 'present' ? false
|
|
826
1041
|
: allSatisfied === null || residue === 'unknown' ? null : true;
|
|
@@ -840,13 +1055,7 @@ async function readRecoveryStatusWithQueries(options, preparedDemand) {
|
|
|
840
1055
|
try {
|
|
841
1056
|
options.signal?.throwIfAborted();
|
|
842
1057
|
session = await createCodexNativeObservationSession({ exactCwd: context.executionCwd, env: context.env,
|
|
843
|
-
runner:
|
|
844
|
-
const result = await runNativeCli({ ...request, signal: options.signal,
|
|
845
|
-
timeoutMs: DEFAULT_AGENT_VERSION_PROBE_TIMEOUT_MS }, options.nativeCliRunner);
|
|
846
|
-
if (Buffer.byteLength(result.stdout) + Buffer.byteLength(result.stderr) > 1024 * 1024)
|
|
847
|
-
throw new Error('nativeObservationOutputLimit');
|
|
848
|
-
return result;
|
|
849
|
-
} });
|
|
1058
|
+
runner: options.nativeCliRunner, probe: { signal: options.signal } });
|
|
850
1059
|
// User reads use only this session's neutral cwd. Project reads add the
|
|
851
1060
|
// exact project snapshot without repeating the same neutral observation.
|
|
852
1061
|
return await readRecoveryStatusInSession({ ...options, codexObservationSession: session }, snapshot);
|
|
@@ -904,11 +1113,56 @@ async function checkUndeclaredSelection(options, snapshot) {
|
|
|
904
1113
|
}
|
|
905
1114
|
return errors;
|
|
906
1115
|
}
|
|
1116
|
+
/** Decide whether a project location can consume the exact User Skills observed this round. */
|
|
1117
|
+
function projectSkillCopy(user, project, userAbsent) {
|
|
1118
|
+
const deployments = project.deploymentObservations;
|
|
1119
|
+
if (!deployments?.length || project.blockers.length)
|
|
1120
|
+
return 'blocked';
|
|
1121
|
+
const userDeployments = user.deploymentObservations ?? [];
|
|
1122
|
+
for (const { after, products } of deployments) {
|
|
1123
|
+
if (!products.every((product) => userDeployments.some((deployment) => deployment.products.some((item) => item.id === product.id))))
|
|
1124
|
+
return 'blocked';
|
|
1125
|
+
if (!userAbsent && project.agent === 'pi' && !userDeployments.some((deployment) => deployment.after.nativeIdentity
|
|
1126
|
+
&& piProjectListsUserSkills(after, deployment.after.nativeIdentity.sourceLocation)))
|
|
1127
|
+
return 'blocked';
|
|
1128
|
+
if (after.configuration?.activation === 'disabled' || after.configuration?.activation === 'unknown'
|
|
1129
|
+
|| after.antigravityLegacyProjectPackage?.state === 'unconfirmed' || after.grokScopeAuthorization === 'denied')
|
|
1130
|
+
return 'blocked';
|
|
1131
|
+
if (after.package === 'present' && after.ownership === 'aw') {
|
|
1132
|
+
// A previous input generation can retire if its own published bytes are still intact.
|
|
1133
|
+
const staleInput = project.content === 'drifted' && project.reasons?.some((reason) => reason.code === 'platformInputDrift' || reason.code === 'antigravityProjectPackageMigrationPending')
|
|
1134
|
+
&& project.reasons.every((reason) => ['platformInputDrift', 'antigravityProjectPackageMigrationPending',
|
|
1135
|
+
'opencodeNativeObservationRequired', INVOCATION_POLICY_NOT_APPLIED].includes(reason.code));
|
|
1136
|
+
if (project.content === 'satisfied' || staleInput)
|
|
1137
|
+
continue;
|
|
1138
|
+
}
|
|
1139
|
+
if (after.package !== 'absent' || after.ownership !== 'absent')
|
|
1140
|
+
return 'blocked';
|
|
1141
|
+
if (project.agent === 'pi') {
|
|
1142
|
+
const hiddenSection = after.registration === 'unknown' && after.diagnostics.some((entry) => entry.code === 'piProjectRegistrationNotVisible');
|
|
1143
|
+
if ((!hiddenSection && after.registration !== 'absent') || after.configuration?.activation !== 'absent')
|
|
1144
|
+
return 'blocked';
|
|
1145
|
+
}
|
|
1146
|
+
if (!userAbsent && project.agent === 'grok') {
|
|
1147
|
+
const name = after.nativeIdentity?.packageId;
|
|
1148
|
+
const native = after.prerequisites.nativeSources;
|
|
1149
|
+
const sources = native?.sources.filter((source) => source.name === name);
|
|
1150
|
+
const personal = user.deploymentObservations?.flatMap(({ after }) => after.prerequisites.nativeSources?.sources ?? [])
|
|
1151
|
+
.find((source) => source.name === name && source.scope === 'user' && source.enabled && source.origin === 'native');
|
|
1152
|
+
if (after.grokScopeAuthorization !== 'granted' || native?.observation !== 'complete' || !personal || sources?.length !== 1
|
|
1153
|
+
|| sources[0].scope !== 'user' || !sources[0].enabled || sources[0].path !== personal.path
|
|
1154
|
+
|| !user.installedComponentIds?.every((id) => sources[0].effectiveComponents.includes(id.replace(/^skill:/u, 'skills:'))))
|
|
1155
|
+
return 'blocked';
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
return deployments.some(({ after }) => after.package === 'present' || after.antigravityLegacyProjectPackage?.state === 'owned') ? 'owned' : 'absent';
|
|
1159
|
+
}
|
|
907
1160
|
async function readRecoveryStatusInSession(options, snapshot) {
|
|
908
1161
|
const selectionErrors = await checkUndeclaredSelection(options, snapshot);
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
|
|
1162
|
+
const requestedDemand = options.targets ? { ...snapshot, preferences: snapshot.preferences
|
|
1163
|
+
? { ...snapshot.preferences, targets: [...new Set([...snapshot.preferences.targets, ...options.targets])] } : null } : snapshot;
|
|
1164
|
+
let globalPlan = deriveJointDemand(snapshot);
|
|
1165
|
+
let plan = requestedDemand === snapshot ? globalPlan : deriveJointDemand(requestedDemand);
|
|
912
1166
|
const matchesPlugin = (id) => !options.plugins?.length || options.plugins.some((selector) => selector === id || !selector.includes('/') && parsePluginId(id).pluginName === selector);
|
|
913
1167
|
const selected = Boolean(options.plugins?.length || options.targets);
|
|
914
1168
|
const observationPlugins = options.plugins?.length ? new Set(plan.placements.filter((item) => matchesPlugin(item.pluginId)
|
|
@@ -933,12 +1187,14 @@ async function readRecoveryStatusInSession(options, snapshot) {
|
|
|
933
1187
|
for (const plugin of options.plugins ?? [])
|
|
934
1188
|
observationPlugins.add(plugin);
|
|
935
1189
|
const selectedPlacement = (item) => (!options.targets || options.targets.includes(item.target)) && (!observationPlugins || observationPlugins.has(item.pluginId));
|
|
1190
|
+
const candidates = [...new Map([...projectSkillCandidates(plan), ...(options.projectSkillProbes ?? [])]
|
|
1191
|
+
.filter(selectedPlacement).map((item) => [`${item.pluginId}\0${item.target}`, item])).values()];
|
|
936
1192
|
const scopes = [snapshot.user, ...(snapshot.project ? [snapshot.project] : [])];
|
|
937
1193
|
const observed = [];
|
|
938
1194
|
// Scope order gives User discovery the neutral cwd before equivalent Project
|
|
939
1195
|
// probes reuse it. Codex also shares a mutable manager and neutral inventory.
|
|
940
1196
|
for (const demand of scopes) {
|
|
941
|
-
const nodes = plan.placements.filter((item) => selectedPlacement(item) && (item.scope === demand.scope
|
|
1197
|
+
const nodes = [...plan.placements, ...(options.projectSkillProbes ?? [])].filter((item) => selectedPlacement(item) && (item.scope === demand.scope
|
|
942
1198
|
|| demand.scope === 'project' && ['codex', 'claude', 'copilot'].includes(item.target)
|
|
943
1199
|
&& item.contributions.some((contribution) => contribution.scope === 'project')));
|
|
944
1200
|
const expanded = { ...demand,
|
|
@@ -958,11 +1214,28 @@ async function readRecoveryStatusInSession(options, snapshot) {
|
|
|
958
1214
|
observed.push(await readScopedRecoveryStatus({ ...options, onNativeStatus: undefined, scope: demand.scope,
|
|
959
1215
|
cwd: snapshot.context.projectRoot ?? options.cwd, observationPlugins, targets: options.targets, demandOverride: expanded }));
|
|
960
1216
|
}
|
|
961
|
-
const
|
|
1217
|
+
const scopedTargets = observed.flatMap((status) => status.inventory?.flatMap((item) => item.targetResults) ?? []);
|
|
1218
|
+
const skillProviders = candidates.flatMap((candidate) => {
|
|
1219
|
+
const matches = (target) => target.pluginId === candidate.pluginId && target.agent === candidate.target;
|
|
1220
|
+
const user = scopedTargets.find((target) => matches(target) && target.scope === 'user');
|
|
1221
|
+
const project = scopedTargets.find((target) => matches(target) && target.scope === 'project');
|
|
1222
|
+
if (!user || !project)
|
|
1223
|
+
return [];
|
|
1224
|
+
const absent = user.deploymentObservations?.length && user.deploymentObservations.every(({ after }) => after.package === 'absent' && after.ownership === 'absent' && (after.registration === 'absent' || after.registration === 'not-applicable'));
|
|
1225
|
+
return [{ pluginId: candidate.pluginId, target: candidate.target, sourceIdentity: candidate.plugin.sourceIdentity,
|
|
1226
|
+
projectCopy: projectSkillCopy(user, project, !!absent), userAbsent: !!absent, userNeedsRepair: !absent && !isInstalledSkillProvider(user) }];
|
|
1227
|
+
});
|
|
1228
|
+
if (skillProviders.length) {
|
|
1229
|
+
globalPlan = deriveJointDemand(snapshot, skillProviders);
|
|
1230
|
+
plan = requestedDemand === snapshot ? globalPlan : deriveJointDemand(requestedDemand, skillProviders);
|
|
1231
|
+
}
|
|
1232
|
+
const allTargets = scopedTargets.flatMap((target) => {
|
|
962
1233
|
const providers = plan.placements.filter((placement) => placement.pluginId === target.pluginId && placement.target === target.agent
|
|
963
1234
|
&& (placement.scope === target.scope || target.scope === 'project'
|
|
964
1235
|
&& ['codex', 'claude', 'copilot'].includes(target.agent) && placement.scope === 'user'
|
|
965
1236
|
&& placement.contributions.some((entry) => entry.scope === 'project')));
|
|
1237
|
+
if (!providers.length)
|
|
1238
|
+
return [];
|
|
966
1239
|
const contributions = providers.flatMap((provider) => provider.contributions
|
|
967
1240
|
.filter((entry) => provider.scope === target.scope || entry.scope === target.scope));
|
|
968
1241
|
return { ...target, contributions: contributions.map((entry) => ({ root: entry.root, scope: entry.scope, path: [...entry.path] })),
|
|
@@ -970,6 +1243,14 @@ async function readRecoveryStatusInSession(options, snapshot) {
|
|
|
970
1243
|
relation: contributions.some((entry) => entry.path.length === 1 && entry.scope === target.scope) ? 'root' : 'dependency' };
|
|
971
1244
|
});
|
|
972
1245
|
const inventory = scopes.some((demand) => demand.roots !== null) ? [] : null;
|
|
1246
|
+
const expected = new Set(plan.placements.map((item) => `${item.pluginId}\0${item.target}\0${item.scope}`));
|
|
1247
|
+
const surplusSkills = scopedTargets.filter((target) => target.scope === 'project'
|
|
1248
|
+
&& !expected.has(`${target.pluginId}\0${target.agent}\0project`)
|
|
1249
|
+
&& skillProviders.some((provider) => provider.projectCopy === 'owned' && !provider.userAbsent && !provider.userNeedsRepair
|
|
1250
|
+
&& provider.pluginId === target.pluginId && provider.target === target.agent))
|
|
1251
|
+
.map((target) => ({ ...target, reasons: [{ code: 'projectSkillDuplicatePending', pluginId: target.pluginId,
|
|
1252
|
+
subject: { pluginId: target.pluginId, target: target.agent, scope: target.scope },
|
|
1253
|
+
message: 'Sync the Project plugin to remove the previous copy of its User Skill dependency.' }] }));
|
|
973
1254
|
const visibleInventory = [];
|
|
974
1255
|
for (const demand of scopes)
|
|
975
1256
|
for (const root of demand.roots ?? []) {
|
|
@@ -1000,15 +1281,26 @@ async function readRecoveryStatusInSession(options, snapshot) {
|
|
|
1000
1281
|
return allTargets.find((item) => item.pluginId === id && item.agent === requirement.target && item.scope === scope);
|
|
1001
1282
|
});
|
|
1002
1283
|
const ownProvider = providers.find((provider) => provider?.pluginId === root.pluginId);
|
|
1284
|
+
if (ownProvider?.installedComponentIds)
|
|
1285
|
+
target.installedComponentIds = ownProvider.installedComponentIds;
|
|
1286
|
+
if (ownProvider?.installedComponentCount !== undefined)
|
|
1287
|
+
target.installedComponentCount = ownProvider.installedComponentCount;
|
|
1003
1288
|
if (ownProvider?.installedVersion)
|
|
1004
1289
|
target.installedVersion = ownProvider.installedVersion;
|
|
1005
1290
|
target.blockers.push(...providers.flatMap((item) => item?.blockers ?? []));
|
|
1006
1291
|
const reasons = providers.flatMap((item) => item?.reasons ?? []);
|
|
1292
|
+
if (demand.scope === 'project') {
|
|
1293
|
+
for (const copy of surplusSkills) {
|
|
1294
|
+
if (copy.agent !== requirement.target || !requirement.dependencies.includes(copy.pluginId))
|
|
1295
|
+
continue;
|
|
1296
|
+
reasons.push(...copy.reasons);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1007
1299
|
if (reasons.length)
|
|
1008
1300
|
target.reasons = reasons;
|
|
1009
1301
|
const componentGaps = providers.flatMap((item) => item?.componentGaps ?? []);
|
|
1010
1302
|
if (componentGaps.length)
|
|
1011
|
-
target.componentGaps =
|
|
1303
|
+
target.componentGaps = uniqueRecoveryComponentGaps(componentGaps);
|
|
1012
1304
|
const exclusions = providers.flatMap((item) => item?.deploymentExclusions ?? []);
|
|
1013
1305
|
if (exclusions.length)
|
|
1014
1306
|
target.deploymentExclusions = [...new Map(exclusions.map((exclusion) => [JSON.stringify([exclusion.pluginId, exclusion.platform, exclusion.scope, exclusion.productId, exclusion.reasonCode]), exclusion])).values()];
|
|
@@ -1017,8 +1309,7 @@ async function readRecoveryStatusInSession(options, snapshot) {
|
|
|
1017
1309
|
target.deploymentObservations = [...new Map(deployments.map((item) => [item.bindingId, item])).values()];
|
|
1018
1310
|
target.content = ['conflict', 'drifted', 'absent', 'unknown'].find((state) => providers.some((item) => (item?.content ?? 'unknown') === state)) ?? 'satisfied';
|
|
1019
1311
|
target.observation = target.content === 'satisfied' ? 'verified' : target.content === 'absent' ? 'missing' : 'unknown';
|
|
1020
|
-
target.satisfaction = target.content
|
|
1021
|
-
: target.content === 'unknown' ? 'unknown' : 'pending';
|
|
1312
|
+
target.satisfaction = observedSatisfaction(target.content, ownProvider, demand.scope === 'project' && placement?.scope === 'user');
|
|
1022
1313
|
target.backend = providers.map((provider) => ({ pluginId: provider?.pluginId, scope: provider?.scope, content: provider?.content, live: provider?.backend }));
|
|
1023
1314
|
}
|
|
1024
1315
|
targetResults.push(target);
|
|
@@ -1026,13 +1317,12 @@ async function readRecoveryStatusInSession(options, snapshot) {
|
|
|
1026
1317
|
visibleInventory.push({ pluginId: root.pluginId, source: root.sourceId, sourceState: root.sourceState,
|
|
1027
1318
|
blockers: root.blockers.map(diagnostic), targetResults });
|
|
1028
1319
|
}
|
|
1029
|
-
const
|
|
1030
|
-
const extraObserved = observed.flatMap((status) => status.extraObserved)
|
|
1320
|
+
const extraObserved = [...observed.flatMap((status) => status.extraObserved), ...surplusSkills]
|
|
1031
1321
|
.filter((item) => !expected.has(`${item.pluginId}\0${item.agent}\0${item.scope}`));
|
|
1032
1322
|
const targets = visibleInventory.flatMap((item) => item.targetResults);
|
|
1033
1323
|
const globalTargets = targets.filter((target) => globalPlan.roots.some((root) => root.pluginId === target.pluginId && root.target === target.agent && root.scope === target.scope));
|
|
1034
1324
|
const fullObservation = !selected || globalPlan.placements.every(selectedPlacement);
|
|
1035
|
-
const knownFailure = globalPlan.errors.some((error) => ['targetsNotConfigured', 'dependencyExcluded', 'dependencyContractInvalid', 'targetPlacementConflict'].includes(error.code))
|
|
1325
|
+
const knownFailure = globalPlan.errors.some((error) => ['targetsNotConfigured', 'dependencyExcluded', 'dependencyContractInvalid', 'targetPlacementConflict', 'projectSkillProviderConflict', 'userSkillProviderNotReady'].includes(error.code))
|
|
1036
1326
|
|| globalTargets.some((target) => ['absent', 'drifted', 'conflict'].includes(target.content ?? 'unknown')
|
|
1037
1327
|
|| target.blockers.some((entry) => entry.code === 'awCapabilityUnsupported'));
|
|
1038
1328
|
const uncertain = !fullObservation || !globalPlan.complete || globalTargets.some((target) => target.content === 'unknown' || target.blockers.length > 0);
|
|
@@ -1048,8 +1338,9 @@ async function readRecoveryStatusInSession(options, snapshot) {
|
|
|
1048
1338
|
: scopes.some((demand) => demand.intent.state === 'unsupported-version') ? 'unsupported-version'
|
|
1049
1339
|
: scopes.some((demand) => demand.intent.state === 'valid') ? 'valid' : 'absent' },
|
|
1050
1340
|
selection: { agents: snapshot.preferences?.targets ?? [], origin: snapshot.preferences?.targets.length ? 'preference' : 'none', preferences: snapshot.user.preferences.state },
|
|
1051
|
-
inventory: inventory === null ? null : visibleInventory, extraObserved, observedTargets: allTargets,
|
|
1341
|
+
inventory: inventory === null ? null : visibleInventory, extraObserved, observedTargets: allTargets, projectSkillProviders: skillProviders,
|
|
1052
1342
|
existingTargets: observed.flatMap((status) => status.existingTargets ?? []), ownedTargets: observed.flatMap((status) => status.ownedTargets ?? []),
|
|
1343
|
+
retainedProjectPackages: observed.flatMap((status) => status.retainedProjectPackages ?? []),
|
|
1053
1344
|
coverage: { native: nativeCoverage, portable: portableCoverage, scopes: snapshot.context.scopes,
|
|
1054
1345
|
...(snapshot.context.projectRoot ? { projectRoot: snapshot.context.projectRoot } : {}) },
|
|
1055
1346
|
counts: { blocked: targets.filter((target) => target.blockers.length).length,
|
|
@@ -1064,8 +1355,7 @@ async function readRecoveryStatusInSession(options, snapshot) {
|
|
|
1064
1355
|
visibleInventory.push({ pluginId: target.pluginId, source: parsePluginId(target.pluginId).sourceId, sourceState: 'ready', blockers: [],
|
|
1065
1356
|
targetResults: allTargets.filter((entry) => entry.pluginId === target.pluginId).map((entry) => ({ ...entry,
|
|
1066
1357
|
requirementScope: entry.contributions?.[0]?.scope,
|
|
1067
|
-
satisfaction: entry.content
|
|
1068
|
-
? 'inherited-user' : 'installed' : entry.content === 'unknown' ? 'unknown' : 'pending' })) });
|
|
1358
|
+
satisfaction: observedSatisfaction(entry.content, entry, entry.scope === 'user' && entry.contributions.some((contribution) => contribution.scope === 'project')) })) });
|
|
1069
1359
|
}
|
|
1070
1360
|
}
|
|
1071
1361
|
if (selected) {
|