@lesliechan721/aw 0.1.0-beta.83 → 0.1.0-beta.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring/assets/aw-runtime-config.mjs +1 -1
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -1
- package/dist/src/commands/console.js +1 -0
- package/dist/src/commands/console.js.map +1 -1
- package/dist/src/commands/intent-command.d.ts +1 -0
- package/dist/src/commands/intent-command.js +6 -2
- package/dist/src/commands/intent-command.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +3 -3
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-lifecycle-result.d.ts +11 -5
- package/dist/src/commands/public-lifecycle-result.js +131 -46
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/commands/public-lifecycle.d.ts +1 -2
- package/dist/src/commands/public-lifecycle.js +56 -34
- package/dist/src/commands/public-lifecycle.js.map +1 -1
- package/dist/src/commands/public-plugin-query.js +28 -11
- package/dist/src/commands/public-plugin-query.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +13 -3
- package/dist/src/commands/rebuild-command.js +647 -286
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +5 -2
- package/dist/src/commands/rebuild-integration.js +55 -29
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +1 -0
- package/dist/src/commands/rebuild-operations.js +23 -4
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +13 -3
- package/dist/src/commands/rebuild-platform-integration.js +229 -133
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
- package/dist/src/index.js +105 -50
- package/dist/src/index.js.map +1 -1
- package/dist/src/output/public-result.d.ts +2 -0
- package/dist/src/output/public-result.js +43 -6
- package/dist/src/output/public-result.js.map +1 -1
- package/dist/src/output/rebuild-progress.d.ts +3 -0
- package/dist/src/output/rebuild-progress.js +12 -2
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/output/receipt-projection.js +55 -18
- package/dist/src/output/receipt-projection.js.map +1 -1
- package/dist/src/output/skill-invocation-notices.d.ts +16 -0
- package/dist/src/output/skill-invocation-notices.js +48 -0
- package/dist/src/output/skill-invocation-notices.js.map +1 -0
- package/dist/src/platforms/capabilities.d.ts +2 -0
- package/dist/src/platforms/capabilities.js +73 -34
- package/dist/src/platforms/capabilities.js.map +1 -1
- package/dist/src/platforms/contracts.d.ts +9 -9
- package/dist/src/platforms/discovery.d.ts +0 -7
- package/dist/src/platforms/discovery.js +13 -53
- package/dist/src/platforms/discovery.js.map +1 -1
- package/dist/src/platforms/inspection-native.js +1 -80
- package/dist/src/platforms/inspection-native.js.map +1 -1
- package/dist/src/platforms/inspection-query.d.ts +2 -3
- package/dist/src/platforms/inspection-query.js +7 -18
- package/dist/src/platforms/inspection-query.js.map +1 -1
- package/dist/src/platforms/inspection.js +2 -2
- package/dist/src/platforms/inspection.js.map +1 -1
- package/dist/src/platforms/layout.js +1 -5
- package/dist/src/platforms/layout.js.map +1 -1
- package/dist/src/platforms/lifecycle-native-services.d.ts +1 -1
- package/dist/src/platforms/lifecycle-native-services.js +14 -14
- package/dist/src/platforms/lifecycle-native-services.js.map +1 -1
- package/dist/src/platforms/lifecycle-native.js +4 -88
- package/dist/src/platforms/lifecycle-native.js.map +1 -1
- package/dist/src/platforms/lifecycle.js +56 -56
- package/dist/src/platforms/lifecycle.js.map +1 -1
- package/dist/src/platforms/projection-code-extension.js +7 -3
- package/dist/src/platforms/projection-code-extension.js.map +1 -1
- package/dist/src/platforms/projection.d.ts +3 -0
- package/dist/src/platforms/projection.js +86 -54
- package/dist/src/platforms/projection.js.map +1 -1
- package/dist/src/portable/materializer.js +2 -2
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery.d.ts +29 -3
- package/dist/src/portable/recovery.js +220 -78
- package/dist/src/portable/recovery.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +18 -4
- package/dist/src/recovery/coordinator.js +357 -165
- package/dist/src/recovery/coordinator.js.map +1 -1
- package/dist/src/recovery/install-concurrency.d.ts +48 -0
- package/dist/src/recovery/install-concurrency.js +195 -0
- package/dist/src/recovery/install-concurrency.js.map +1 -0
- package/dist/src/recovery/interruption.d.ts +19 -0
- package/dist/src/recovery/interruption.js +43 -0
- package/dist/src/recovery/interruption.js.map +1 -0
- package/dist/src/recovery/joint-coordinator.d.ts +11 -4
- package/dist/src/recovery/joint-coordinator.js +671 -333
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/joint-demand.d.ts +8 -0
- package/dist/src/recovery/joint-demand.js +52 -1
- package/dist/src/recovery/joint-demand.js.map +1 -1
- package/dist/src/recovery/joint-install-execution.d.ts +19 -0
- package/dist/src/recovery/joint-install-execution.js +307 -0
- package/dist/src/recovery/joint-install-execution.js.map +1 -0
- package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
- package/dist/src/recovery/joint-install-native-rebase.js +67 -0
- package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
- package/dist/src/recovery/receipt.d.ts +20 -0
- package/dist/src/recovery/receipt.js +67 -1
- package/dist/src/recovery/receipt.js.map +1 -1
- package/dist/src/recovery/retirement.js +1 -1
- package/dist/src/recovery/retirement.js.map +1 -1
- package/dist/src/recovery/status.js +26 -27
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/review/platform-profile.d.ts +4 -1
- package/dist/src/review/platform-profile.js +13 -4
- 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 +28 -16
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/review/source-binding.js +6 -4
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/console-app-v4.d.ts +1 -1
- package/dist/src/tui/console-app-v4.js +137 -57
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +45 -9
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +13 -4
- package/dist/src/tui/controller.js +233 -102
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/deployment-view.js +6 -1
- package/dist/src/tui/deployment-view.js.map +1 -1
- package/dist/src/tui/diagnostic-projection.d.ts +4 -2
- package/dist/src/tui/diagnostic-projection.js +40 -4
- package/dist/src/tui/diagnostic-projection.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.d.ts +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 -3
- package/dist/src/tui/operation-history.js +15 -2
- package/dist/src/tui/operation-history.js.map +1 -1
- package/dist/src/tui/scoped-flow.d.ts +3 -1
- package/dist/src/tui/scoped-flow.js +99 -1
- package/dist/src/tui/scoped-flow.js.map +1 -1
- package/dist/src/tui/session-console-app.d.ts +2 -0
- package/dist/src/tui/session-console-app.js +11 -0
- package/dist/src/tui/session-console-app.js.map +1 -1
- package/dist/src/types.d.ts +8 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/aw-home-mutation-lock.js +2 -1
- package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
- package/dist/src/utils/catalog-source-references.js +2 -14
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/component-resources.js +1 -1
- package/dist/src/utils/component-resources.js.map +1 -1
- package/dist/src/utils/managed-command-materialization.d.ts +2 -1
- package/dist/src/utils/managed-command-materialization.js +3 -3
- package/dist/src/utils/managed-command-materialization.js.map +1 -1
- package/dist/src/utils/managed-command-store.d.ts +6 -0
- package/dist/src/utils/managed-command-store.js +90 -18
- package/dist/src/utils/managed-command-store.js.map +1 -1
- package/dist/src/utils/multi-source-catalog.d.ts +2 -0
- package/dist/src/utils/multi-source-catalog.js +3 -2
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +0 -19
- package/dist/src/utils/native-cli.js +2 -42
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/ownership.js +1 -1
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +1 -3
- package/dist/src/utils/platform-empty-state.js +1 -6
- package/dist/src/utils/platform-empty-state.js.map +1 -1
- package/dist/src/utils/plugin-config-write.d.ts +8 -0
- package/dist/src/utils/plugin-config-write.js +89 -25
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-scripts.js +5 -0
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/skill-invocation-warning.d.ts +15 -0
- package/dist/src/utils/skill-invocation-warning.js +42 -0
- package/dist/src/utils/skill-invocation-warning.js.map +1 -0
- package/package.json +3 -3
- package/dist/src/output/native-consent.d.ts +0 -2
- package/dist/src/output/native-consent.js +0 -5
- package/dist/src/output/native-consent.js.map +0 -1
- package/dist/src/platforms/gemini-activation.d.ts +0 -36
- package/dist/src/platforms/gemini-activation.js +0 -331
- package/dist/src/platforms/gemini-activation.js.map +0 -1
- package/dist/src/platforms/gemini-consent.d.ts +0 -8
- package/dist/src/platforms/gemini-consent.js +0 -81
- package/dist/src/platforms/gemini-consent.js.map +0 -1
|
@@ -2,14 +2,13 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
|
-
import { createMarketplaceManifestEntry, normalizeStaticPluginComponents, resolveInvocationPolicy } from '@lesliechan721/aw-plugin-core/manifest';
|
|
5
|
+
import { createMarketplaceManifestEntry, getComponentFeatureRequirements, normalizeStaticPluginComponents, resolveInvocationPolicy } from '@lesliechan721/aw-plugin-core/manifest';
|
|
6
6
|
import { getAgentPluginAdapter } from '../platforms/registry.js';
|
|
7
7
|
import { getQualifiedPlatformProfile } from '../platforms/capabilities.js';
|
|
8
8
|
import { getDeploymentLayout, getDeploymentResourceKey, getInvocationPolicyPhysicalKey } from '../platforms/layout.js';
|
|
9
9
|
import { deploymentPackageComponent, inspectStaticSupplements, requiredDeploymentActivation } from '../platforms/inspection.js';
|
|
10
10
|
import { piProjectRegistrationHidden, piProjectRemovalConfirmed } from '../platforms/lifecycle-native.js';
|
|
11
11
|
import { createNativeLifecycleServices } from '../platforms/lifecycle-native-services.js';
|
|
12
|
-
import { assertGeminiProjectRules, geminiActivationEvidence, geminiActivationRules, geminiExtensionPaths, geminiScopePattern, geminiUserActivation, readGeminiActivationSnapshot } from '../platforms/gemini-activation.js';
|
|
13
12
|
import { cursorWorkspaceOpenCommand } from '../platforms/projection.js';
|
|
14
13
|
import { cursorHookEntryCommand, cursorHooks } from '../platforms/cursor-workspace-hook.js';
|
|
15
14
|
import { ownedSupplementFile, staticSupplementFiles } from '../platforms/supplement-layout.js';
|
|
@@ -18,7 +17,7 @@ import { readStrictNamespacedMarketplaceRoot } from '../utils/local-marketplace.
|
|
|
18
17
|
import { artifactValueDigest, mergeExpectedComponentSets } from '../utils/artifact-plan.js';
|
|
19
18
|
import { preparePlatformComponents, resolveArtifactRenderConfig } from '../utils/artifact-renderer.js';
|
|
20
19
|
import { finalizePlatformSkillProducers } from '../utils/component-command-preparation.js';
|
|
21
|
-
import { cleanupOwnedComponents, createSharedOwnerToken, inspectOwnedComponents, writeOwnedTextFile, writeSkillOwnerMarker } from '../utils/ownership.js';
|
|
20
|
+
import { cleanupOwnedComponents, createSharedOwnerToken, inspectOwnedComponents, renderOwnedTextFile, writeOwnedTextFile, writeSkillOwnerMarker } from '../utils/ownership.js';
|
|
22
21
|
import { createPlatformInputEvidence, platformPackageInputDigest, readPlatformPackageContentDigest, writePlatformEmptyState } from '../utils/platform-empty-state.js';
|
|
23
22
|
import { writePlatformSupplementState } from '../platforms/supplement-state.js';
|
|
24
23
|
import { atomicReplaceSafeFile, assertSafeFileMutationPath } from '../utils/safe-fs.js';
|
|
@@ -26,11 +25,53 @@ import { assertManagedCommandBindingIdentities, captureManagedCommandBindingReco
|
|
|
26
25
|
import { captureNativeToolChanges } from '../utils/native-tool-review.js';
|
|
27
26
|
import { captureManagedCommandReviewEvidence } from '../utils/managed-command-review.js';
|
|
28
27
|
import { readClaudeSettings } from '../adapters/helpers.js';
|
|
28
|
+
import { skillInvocationWarning } from '../utils/skill-invocation-warning.js';
|
|
29
29
|
import { readCodexConfigFile } from '../utils/codex-config.js';
|
|
30
30
|
import { parseOwnedTextHeader, readSkillOwnerMarker } from '../utils/ownership.js';
|
|
31
31
|
import { applyPlannedOperationAction, isNativeActivationOnlyTarget } from './rebuild-integration.js';
|
|
32
|
+
import { recoveryInterruptionCode } from '../recovery/interruption.js';
|
|
33
|
+
/** Resources touched by the frozen adapter plans, including host-managed writes. */
|
|
34
|
+
export function nativeInstallResources(plans) {
|
|
35
|
+
if (!plans.length)
|
|
36
|
+
return [{ kind: 'exclusive' }];
|
|
37
|
+
const paths = new Set();
|
|
38
|
+
for (const plan of plans) {
|
|
39
|
+
const { binding, evidence } = plan;
|
|
40
|
+
const { layout } = evidence;
|
|
41
|
+
paths.add(layout.packageRoot);
|
|
42
|
+
for (const { component } of evidence.ownership) {
|
|
43
|
+
if ('path' in component)
|
|
44
|
+
paths.add(component.path);
|
|
45
|
+
else if (component.kind === 'shared-config' && component.locator.kind === 'claude-permissions')
|
|
46
|
+
paths.add(component.locator.settingsPath);
|
|
47
|
+
else if (component.kind === 'shared-config' && component.locator.kind === 'cursor-workspace-hook')
|
|
48
|
+
paths.add(component.locator.hooksPath);
|
|
49
|
+
}
|
|
50
|
+
for (const projection of plan.projections) {
|
|
51
|
+
for (const supplement of projection.supplements)
|
|
52
|
+
paths.add(supplement.destination);
|
|
53
|
+
}
|
|
54
|
+
if (layout.marketplaceRoot) {
|
|
55
|
+
for (const file of evidence.marketplace?.files ?? [])
|
|
56
|
+
paths.add(path.join(layout.marketplaceRoot, file.relativePath));
|
|
57
|
+
}
|
|
58
|
+
// These routes publish an entire, plugin-specific directory. activationPath
|
|
59
|
+
// is its parent and is never replaced by the directory publisher.
|
|
60
|
+
if (binding.route === 'opencode-directory' || binding.route === 'antigravity-directory' || binding.route === 'grok-directory')
|
|
61
|
+
continue;
|
|
62
|
+
paths.add(layout.activationPath);
|
|
63
|
+
if (binding.route === 'pi-package' || binding.route === 'cursor-workspace-hook')
|
|
64
|
+
continue;
|
|
65
|
+
for (const consumer of binding.consumers) {
|
|
66
|
+
if (!consumer.entry || consumer.entry.kind === 'generic')
|
|
67
|
+
return [{ kind: 'exclusive' }];
|
|
68
|
+
paths.add(consumer.entry.configRoot);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return [...paths].map((value) => ({ kind: 'path', value }));
|
|
72
|
+
}
|
|
32
73
|
function nativeCopyIncomplete(binding, after, contentDigest) {
|
|
33
|
-
return ['
|
|
74
|
+
return ['antigravity-cli', 'grok-cli'].includes(binding.route)
|
|
34
75
|
&& after.nativePackageContentDigest !== contentDigest;
|
|
35
76
|
}
|
|
36
77
|
function packageDeliveryConfirmed(binding, after, contentDigest, requireIndependentActivation) {
|
|
@@ -41,6 +82,29 @@ function packageDeliveryConfirmed(binding, after, contentDigest, requireIndepend
|
|
|
41
82
|
&& (binding.route !== 'cursor-workspace-hook' || after.workspaceOpen === 'present')
|
|
42
83
|
&& (binding.route !== 'claude-marketplace' || after.scopeRegistration === undefined || after.scopeRegistration === 'present');
|
|
43
84
|
}
|
|
85
|
+
function componentSupplementFiles(plan) {
|
|
86
|
+
return plan.projections.filter((projection) => plan.evidence.renderUnits?.some((unit) => unit.id === projection.renderUnitId && unit.output === 'supplement')).flatMap((projection) => projection.supplements
|
|
87
|
+
.filter((contribution) => contribution.kind === 'owned-file'));
|
|
88
|
+
}
|
|
89
|
+
export function nativeDeploymentHasVerifiedComponentWrite(plan, receipt) {
|
|
90
|
+
const { after, effects, unmet } = receipt;
|
|
91
|
+
if (receipt.bindingId !== plan.binding.id || after.physicalKey !== plan.binding.physicalKey)
|
|
92
|
+
return false;
|
|
93
|
+
const delivered = after.components.filter(({ id, presence, reasonCodes }) => presence === 'present' && !reasonCodes.length
|
|
94
|
+
&& !unmet.some((gap) => (gap.componentId ?? gap.id) === id));
|
|
95
|
+
if (!delivered.length)
|
|
96
|
+
return false;
|
|
97
|
+
const bundle = plan.projections.find((projection) => projection.bundle)?.bundle;
|
|
98
|
+
const supplementFiles = componentSupplementFiles(plan);
|
|
99
|
+
return plan.effects.some((effect) => {
|
|
100
|
+
if (!effects.some(({ id, status, mutation }) => id === effect.id && status === 'applied' && mutation === 'confirmed'))
|
|
101
|
+
return false;
|
|
102
|
+
const deliversComponents = effect.kind === 'publish-package'
|
|
103
|
+
? !plan.evidence.retainPackage && bundle && packageDeliveryConfirmed(plan.binding, after, bundle.contentDigest, true)
|
|
104
|
+
: effect.kind === 'write-supplement' && supplementFiles.some((file) => file.destination === effect.destination);
|
|
105
|
+
return deliversComponents && effect.componentIds.some((id) => delivered.some((component) => component.id === id));
|
|
106
|
+
});
|
|
107
|
+
}
|
|
44
108
|
function recheckCopilotMarketplaceTimeout(receipt, fresh) {
|
|
45
109
|
const { ownership, registration, diagnostics } = receipt.after;
|
|
46
110
|
const [timeout] = diagnostics;
|
|
@@ -204,7 +268,7 @@ async function requireWritable(component, executor = platformOwnership) {
|
|
|
204
268
|
if (!['present', 'absent'].includes(inspection.components[0].state))
|
|
205
269
|
throw new Error('operationPlanStale: deployment ownership changed.');
|
|
206
270
|
}
|
|
207
|
-
async function publishDirectory(source, component, nativeProjection) {
|
|
271
|
+
async function publishDirectory(source, component, nativeProjection, staged) {
|
|
208
272
|
if (component.kind !== 'owned-directory')
|
|
209
273
|
throw new Error('deploymentPackageOwnerInvalid');
|
|
210
274
|
await requireWritable(component);
|
|
@@ -215,7 +279,23 @@ async function publishDirectory(source, component, nativeProjection) {
|
|
|
215
279
|
const backup = `${staging}.previous`;
|
|
216
280
|
let moved = false;
|
|
217
281
|
try {
|
|
218
|
-
|
|
282
|
+
if (staged && nativeProjection) {
|
|
283
|
+
// A queued package can outlive its staging step. Verify its bytes before
|
|
284
|
+
// consuming it and keep the final rename on the destination filesystem.
|
|
285
|
+
if (await readPlatformPackageContentDigest(staged) !== nativeProjection.contentDigest) {
|
|
286
|
+
throw new Error('operationPlanStale: staged native package content changed.');
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
await fs.rename(staged, candidate);
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
if (error.code !== 'EXDEV')
|
|
293
|
+
throw error;
|
|
294
|
+
await fs.copy(staged, candidate, { dereference: false });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
else
|
|
298
|
+
await fs.copy(source, candidate, { dereference: false });
|
|
219
299
|
await writeSkillOwnerMarker({ skillRoot: candidate, allowedRoot: staging, identity: component.identity, nativeProjection });
|
|
220
300
|
await requireWritable(component);
|
|
221
301
|
if (await fs.pathExists(component.path)) {
|
|
@@ -238,7 +318,7 @@ async function publishDirectory(source, component, nativeProjection) {
|
|
|
238
318
|
}
|
|
239
319
|
}
|
|
240
320
|
async function sharedReferences(context, binding, observation, layout) {
|
|
241
|
-
if (!['codex-marketplace', 'claude-marketplace', '
|
|
321
|
+
if (!['codex-marketplace', 'claude-marketplace', 'copilot-marketplace'].includes(binding.route))
|
|
242
322
|
return 'none';
|
|
243
323
|
const view = context.sharedReferenceView;
|
|
244
324
|
const same = (reference) => reference.pluginId === binding.plugin.pluginId
|
|
@@ -251,30 +331,6 @@ async function sharedReferences(context, binding, observation, layout) {
|
|
|
251
331
|
const host = binding.consumers.find((consumer) => consumer.entry?.kind === 'cli')?.entry;
|
|
252
332
|
if (!host || host.kind !== 'cli' || observation.registration === 'unknown')
|
|
253
333
|
return 'unknown';
|
|
254
|
-
if (binding.route === 'gemini-extension') {
|
|
255
|
-
try {
|
|
256
|
-
const ctx = readContext(context, binding.scope.kind === 'project' ? binding.scope.projectRoot : layout.packageRoot);
|
|
257
|
-
const snapshot = await readGeminiActivationSnapshot(ctx);
|
|
258
|
-
const rules = geminiActivationRules(snapshot, layout.nativeIdentity.packageId);
|
|
259
|
-
await assertGeminiProjectRules(ctx, binding, rules);
|
|
260
|
-
const home = geminiExtensionPaths(ctx).home;
|
|
261
|
-
const userActivation = geminiUserActivation(snapshot, layout.nativeIdentity.packageId, home);
|
|
262
|
-
if (userActivation === 'unknown')
|
|
263
|
-
return 'unknown';
|
|
264
|
-
if (binding.scope.kind === 'project' && observation.registration === 'present' && userActivation)
|
|
265
|
-
return 'present';
|
|
266
|
-
const currentPattern = binding.scope.kind === 'project' ? geminiScopePattern(binding.scope.projectRoot) : null;
|
|
267
|
-
if (rules.some((rule) => {
|
|
268
|
-
const pattern = rule.startsWith('!') ? rule.slice(1) : rule;
|
|
269
|
-
return pattern !== '*' && pattern !== geminiScopePattern(home) && pattern !== currentPattern;
|
|
270
|
-
}))
|
|
271
|
-
return 'present';
|
|
272
|
-
return view?.desiredComplete && view.scopes.includes('user') ? 'none' : 'unknown';
|
|
273
|
-
}
|
|
274
|
-
catch {
|
|
275
|
-
return 'unknown';
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
334
|
if (binding.route === 'claude-marketplace') {
|
|
279
335
|
try {
|
|
280
336
|
const installed = await jsonObject(path.join(host.configRoot, 'plugins', 'installed_plugins.json'));
|
|
@@ -358,23 +414,6 @@ export class PlatformRebuildSession {
|
|
|
358
414
|
}
|
|
359
415
|
setOwnershipExecutor(executor) { this.ownership = executor; }
|
|
360
416
|
root() { return this.staging ??= fs.mkdtemp(path.join(os.tmpdir(), 'aw-deployment-')); }
|
|
361
|
-
nativeReadContext(input) {
|
|
362
|
-
const ctx = readContext(this.context, input.cwd);
|
|
363
|
-
if (input.platform === 'gemini')
|
|
364
|
-
ctx.nativeNodeCompileCacheDir = async () => {
|
|
365
|
-
const pending = this.root();
|
|
366
|
-
try {
|
|
367
|
-
return path.join(await pending, 'native-node-compile-cache');
|
|
368
|
-
}
|
|
369
|
-
catch (error) {
|
|
370
|
-
// An optional cache allocation must not poison later required staging.
|
|
371
|
-
if (this.staging === pending)
|
|
372
|
-
this.staging = undefined;
|
|
373
|
-
throw error;
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
return ctx;
|
|
377
|
-
}
|
|
378
417
|
ordinaryReadContext(ctx, platform) {
|
|
379
418
|
const batch = this.context.nativeObservationBatch;
|
|
380
419
|
// A locked re-Review starts its own observation batch. Cached targets of
|
|
@@ -414,7 +453,8 @@ export class PlatformRebuildSession {
|
|
|
414
453
|
if (!result) {
|
|
415
454
|
result = (async () => {
|
|
416
455
|
const adapter = this.adapterFor(input.platform);
|
|
417
|
-
const ctx =
|
|
456
|
+
const ctx = input.readOnlyInspectionPlan && input.observationBatch ? { ...readContext(this.context, input.cwd), ...input.observationBatch }
|
|
457
|
+
: this.ordinaryReadContext(readContext(this.context, input.cwd), input.platform);
|
|
418
458
|
const plugin = sourceIdentity(input);
|
|
419
459
|
const recoveryCandidates = (this.context.recoveryCandidates ?? []).filter((candidate) => candidate.binding.platform === input.platform
|
|
420
460
|
&& candidate.binding.plugin.sourceIdentity === plugin.sourceIdentity && candidate.binding.plugin.pluginId === plugin.pluginId
|
|
@@ -455,7 +495,7 @@ export class PlatformRebuildSession {
|
|
|
455
495
|
if (target.identity.scope !== 'project' || !target.operationActions?.some((action) => action.kind === 'runPreApply'))
|
|
456
496
|
continue;
|
|
457
497
|
const plans = target.platformDeployment?.plans ?? [];
|
|
458
|
-
if (!plans.length || plans.some((plan) => !['codex-marketplace', 'claude-marketplace', '
|
|
498
|
+
if (!plans.length || plans.some((plan) => !['codex-marketplace', 'claude-marketplace', 'copilot-marketplace'].includes(plan.binding.route)
|
|
459
499
|
|| plan.effects.some((effect) => effect.physicalKey !== plan.binding.physicalKey)
|
|
460
500
|
|| plan.projections.some((projection) => projection.supplements.length > 0)
|
|
461
501
|
|| !plan.evidence.renderUnits?.some((unit) => unit.output === 'package' && unit.renderScope.kind === 'user')))
|
|
@@ -616,12 +656,13 @@ export class PlatformRebuildSession {
|
|
|
616
656
|
if (verifyInitial)
|
|
617
657
|
await verifyInitial();
|
|
618
658
|
else
|
|
619
|
-
await result.platformDeployment?.verify();
|
|
659
|
+
await result.platformDeployment?.verify(input.observationBatch);
|
|
620
660
|
return result;
|
|
621
661
|
}
|
|
622
662
|
async build(input, receiveInitialVerifier) {
|
|
623
|
-
const ctx = this.
|
|
624
|
-
const ordinaryCtx =
|
|
663
|
+
const ctx = readContext(this.context, input.cwd);
|
|
664
|
+
const ordinaryCtx = input.readOnlyInspectionPlan && input.observationBatch ? { ...ctx, ...input.observationBatch }
|
|
665
|
+
: this.ordinaryReadContext(ctx, input.platform);
|
|
625
666
|
const resolution = await this.resolve(input);
|
|
626
667
|
if (!resolution.bindings.length)
|
|
627
668
|
throw Object.assign(new Error(`platformUnavailable: ${resolution.exclusions.map((item) => item.reasonCode).join(', ') || input.platform}`), { deploymentExclusions: this.exclusions.get(this.key(input)) ?? [] });
|
|
@@ -808,18 +849,17 @@ export class PlatformRebuildSession {
|
|
|
808
849
|
const inspected = await inspectOwnedComponents({ components, executor: this.ownership });
|
|
809
850
|
const managedCommandReview = await captureManagedCommandReviewEvidence({ binding: entry.binding,
|
|
810
851
|
renderUnits: entry.layout.renderUnits, components: units.flatMap((unit) => unit.prepared.expected.components), projections });
|
|
811
|
-
const currentMutable = async () => {
|
|
812
|
-
const observation = await adapter.inspect(ctx, entry.binding);
|
|
852
|
+
const currentMutable = async (batch) => {
|
|
853
|
+
const observation = await adapter.inspect(batch ? { ...ctx, ...batch } : ctx, entry.binding);
|
|
813
854
|
return { observation, references: await sharedReferences(this.context, entry.binding, observation, entry.layout),
|
|
814
|
-
geminiActivation: entry.binding.route === 'gemini-extension' ? geminiActivationEvidence(await readGeminiActivationSnapshot(ctx)) : undefined,
|
|
815
855
|
paths: await Promise.all(components.map(async (component) => 'path' in component ? pathEvidence(component.path) : {
|
|
816
856
|
ownership: await inspectOwnedComponents({ components: [component], executor: this.ownership }), contentDigest: await ownedContentDigest(component),
|
|
817
857
|
})) };
|
|
818
858
|
};
|
|
819
|
-
const fingerprintParts = async (discovery) => ({
|
|
859
|
+
const fingerprintParts = async (discovery, batch) => ({
|
|
820
860
|
managedCommandReview,
|
|
821
861
|
source: removing ? null : await pathEvidence(input.plugin.rootDir),
|
|
822
|
-
discovery: discovery ? discovery.value : removing ? { consumers: entry.binding.consumers, executables: await Promise.all(entry.binding.consumers.map((consumer) => consumer.entry?.kind === 'cli' ? pathEvidence(consumer.entry.executable) : null)) } : await adapter.discover(ctx),
|
|
862
|
+
discovery: discovery ? discovery.value : removing ? { consumers: entry.binding.consumers, executables: await Promise.all(entry.binding.consumers.map((consumer) => consumer.entry?.kind === 'cli' ? pathEvidence(consumer.entry.executable) : null)) } : await adapter.discover(batch ? { ...ctx, ...batch } : ctx),
|
|
823
863
|
sharedReferenceView: this.context.sharedReferenceView,
|
|
824
864
|
layout: await getDeploymentLayout(ctx, entry.binding),
|
|
825
865
|
config: await Promise.all(units.map((unit) => resolveArtifactRenderConfig({ ...sourceIdentity(input), pluginName: input.plugin.manifest.name,
|
|
@@ -832,7 +872,7 @@ export class PlatformRebuildSession {
|
|
|
832
872
|
});
|
|
833
873
|
// Discovery and inspection are independent reads for these routes. Settle
|
|
834
874
|
// both before comparing or throwing, while preserving immutable priority.
|
|
835
|
-
const parallelNativeReads = ['
|
|
875
|
+
const parallelNativeReads = ['copilot-marketplace', 'pi-package'].includes(entry.binding.route);
|
|
836
876
|
const initialReads = parallelNativeReads
|
|
837
877
|
? await Promise.allSettled([fingerprintParts(), currentMutable()]) : null;
|
|
838
878
|
if (initialReads?.[0].status === 'rejected')
|
|
@@ -842,7 +882,7 @@ export class PlatformRebuildSession {
|
|
|
842
882
|
throw new Error('operationPlanStale: client discovery changed after the ordinary observation.');
|
|
843
883
|
}
|
|
844
884
|
const initial = artifactValueDigest(initialParts);
|
|
845
|
-
const fingerprint = async (discovery) => artifactValueDigest(await fingerprintParts(discovery));
|
|
885
|
+
const fingerprint = async (discovery, batch) => artifactValueDigest(await fingerprintParts(discovery, batch));
|
|
846
886
|
if (initialReads?.[1].status === 'rejected')
|
|
847
887
|
throw initialReads[1].reason;
|
|
848
888
|
let mutableBaseline = initialReads?.[1].status === 'fulfilled' ? initialReads[1].value : await currentMutable();
|
|
@@ -850,13 +890,13 @@ export class PlatformRebuildSession {
|
|
|
850
890
|
if (ordinaryObservation !== undefined && ordinaryObservation !== artifactValueDigest(mutableBaseline.observation)) {
|
|
851
891
|
throw new Error('operationPlanStale: deployment evidence changed after the ordinary observation.');
|
|
852
892
|
}
|
|
853
|
-
const preparationObservation = entry.binding.route === '
|
|
893
|
+
const preparationObservation = entry.binding.route === 'antigravity-cli'
|
|
854
894
|
? mutableBaseline.observation : entry.observation;
|
|
855
|
-
const check = async (discovery) => {
|
|
895
|
+
const check = async (discovery, batch) => {
|
|
856
896
|
if (!parallelNativeReads)
|
|
857
|
-
return await fingerprint(discovery) === initial
|
|
858
|
-
&& artifactValueDigest(await currentMutable()) === artifactValueDigest(mutableBaseline);
|
|
859
|
-
const [immutableRead, mutableRead] = await Promise.allSettled([fingerprint(discovery), currentMutable()]);
|
|
897
|
+
return await fingerprint(discovery, batch) === initial
|
|
898
|
+
&& artifactValueDigest(await currentMutable(batch)) === artifactValueDigest(mutableBaseline);
|
|
899
|
+
const [immutableRead, mutableRead] = await Promise.allSettled([fingerprint(discovery, batch), currentMutable(batch)]);
|
|
860
900
|
if (immutableRead.status === 'rejected')
|
|
861
901
|
throw immutableRead.reason;
|
|
862
902
|
if (immutableRead.value !== initial)
|
|
@@ -865,14 +905,13 @@ export class PlatformRebuildSession {
|
|
|
865
905
|
throw mutableRead.reason;
|
|
866
906
|
return artifactValueDigest(mutableRead.value) === artifactValueDigest(mutableBaseline);
|
|
867
907
|
};
|
|
868
|
-
checks.set(entry.binding.id, () => check());
|
|
869
|
-
if (resolution.bindings.length === 1 &&
|
|
908
|
+
checks.set(entry.binding.id, (batch) => check(undefined, batch));
|
|
909
|
+
if (resolution.bindings.length === 1 && entry.binding.route === 'pi-package') {
|
|
870
910
|
initialDiscoveryCheck = () => check({ value: initialParts.discovery });
|
|
871
911
|
}
|
|
872
912
|
this.mutableChecks.set(entry.binding.id, { physicalKey: entry.binding.physicalKey,
|
|
873
913
|
marketplaceRoot: entry.layout.marketplaceRoot, sourceId: entry.binding.plugin.sourceId,
|
|
874
914
|
sourceIdentity: entry.binding.plugin.sourceIdentity,
|
|
875
|
-
...(entry.binding.route === 'gemini-extension' ? { geminiActivationSnapshot: () => mutableBaseline.geminiActivation } : {}),
|
|
876
915
|
assertStable: async () => {
|
|
877
916
|
if (!await checks.get(entry.binding.id)())
|
|
878
917
|
throw new Error('operationPlanStale: deployment evidence changed before source registration.');
|
|
@@ -900,7 +939,7 @@ export class PlatformRebuildSession {
|
|
|
900
939
|
// registration. The reviewed package, references and bytes stay frozen.
|
|
901
940
|
mutableBaseline = current;
|
|
902
941
|
},
|
|
903
|
-
rebase: async (
|
|
942
|
+
rebase: async (writtenFiles) => {
|
|
904
943
|
const reads = parallelNativeReads
|
|
905
944
|
? await Promise.allSettled([fingerprintParts(), currentMutable()]) : null;
|
|
906
945
|
if (reads?.[0].status === 'rejected')
|
|
@@ -914,11 +953,18 @@ export class PlatformRebuildSession {
|
|
|
914
953
|
if (reads?.[1].status === 'rejected')
|
|
915
954
|
throw reads[1].reason;
|
|
916
955
|
const mutable = reads?.[1].status === 'fulfilled' ? reads[1].value : await currentMutable();
|
|
917
|
-
if (artifactValueDigest(mutable.geminiActivation ?? null) !== artifactValueDigest(geminiExpected ?? mutableBaseline.geminiActivation ?? null)) {
|
|
918
|
-
throw new Error('operationPlanStale: Gemini activation changed outside the checked native mutation.');
|
|
919
|
-
}
|
|
920
956
|
mutableBaseline = mutable;
|
|
921
|
-
|
|
957
|
+
// The same rebase already hashes the exact paths. Match the owner's
|
|
958
|
+
// header and the desired bytes without opening each file again.
|
|
959
|
+
const verifiedSupplementIds = writtenFiles?.size ? components.flatMap((component, index) => {
|
|
960
|
+
if (component.kind !== 'owned-text-file')
|
|
961
|
+
return [];
|
|
962
|
+
const written = writtenFiles.get(component.path);
|
|
963
|
+
const observed = mutable.paths[index];
|
|
964
|
+
return written && observed && typeof observed === 'object' && 'digest' in observed && observed.digest === written.digest
|
|
965
|
+
? written.componentIds : [];
|
|
966
|
+
}) : [];
|
|
967
|
+
return { observation: mutable.observation, verifiedSupplementIds };
|
|
922
968
|
} });
|
|
923
969
|
const evidence = { fingerprint: initial, managedCommandReview, layout: entry.layout, renderUnits: entry.layout.renderUnits,
|
|
924
970
|
ownership: await Promise.all(inspected.components.map(async ({ component, state }) => ({ component, state,
|
|
@@ -945,30 +991,11 @@ export class PlatformRebuildSession {
|
|
|
945
991
|
? enabled[entry.layout.nativeIdentity.registrationId] === true : 'unknown';
|
|
946
992
|
}
|
|
947
993
|
}
|
|
948
|
-
if (entry.binding.
|
|
949
|
-
evidence.userActivationEnabled = 'unknown';
|
|
950
|
-
const view = this.context.sharedReferenceView;
|
|
951
|
-
try {
|
|
952
|
-
const snapshot = await readGeminiActivationSnapshot(ctx, mutableBaseline.geminiActivation);
|
|
953
|
-
const rules = geminiActivationRules(snapshot, entry.layout.nativeIdentity.packageId);
|
|
954
|
-
await assertGeminiProjectRules(ctx, entry.binding, rules);
|
|
955
|
-
const actual = geminiUserActivation(snapshot, entry.layout.nativeIdentity.packageId, geminiExtensionPaths(ctx).home);
|
|
956
|
-
if (actual !== 'unknown' && preparationObservation.registration !== 'unknown'
|
|
957
|
-
&& (entry.binding.scope.kind === 'user' || view?.desiredComplete && view.scopes.includes('user'))) {
|
|
958
|
-
// Shared User renderScope does not establish User demand. A fresh
|
|
959
|
-
// project starts disabled globally; an existing global intent stays.
|
|
960
|
-
evidence.userActivationEnabled = preparationObservation.registration === 'present' ? actual : entry.binding.scope.kind === 'user'
|
|
961
|
-
|| view?.desired.some((reference) => reference.scope === 'user' && reference.platform === 'gemini'
|
|
962
|
-
&& reference.pluginId === entry.binding.plugin.pluginId && reference.sourceIdentity === entry.binding.plugin.sourceIdentity) === true;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
catch { /* Invalid or ambiguous native configuration remains blocked. */ }
|
|
966
|
-
}
|
|
967
|
-
if (entry.binding.scope.kind === 'project' && ['codex', 'copilot', 'gemini'].includes(entry.binding.platform)) {
|
|
994
|
+
if (entry.binding.scope.kind === 'project' && ['codex', 'copilot'].includes(entry.binding.platform)) {
|
|
968
995
|
const plannedUser = [...this.requestedOperations.values()].find((request) => request.scope === 'user'
|
|
969
996
|
&& request.platform === input.platform && sourceIdentity(request).sourceIdentity === entry.binding.plugin.sourceIdentity
|
|
970
997
|
&& sourceIdentity(request).pluginId === entry.binding.plugin.pluginId);
|
|
971
|
-
if (plannedUser
|
|
998
|
+
if (plannedUser) {
|
|
972
999
|
evidence.userActivationEnabled = !['remove', 'cleanup'].includes(operation(plannedUser));
|
|
973
1000
|
}
|
|
974
1001
|
}
|
|
@@ -1009,15 +1036,15 @@ export class PlatformRebuildSession {
|
|
|
1009
1036
|
target.ownedComponents = plans.flatMap((plan) => plan.evidence.ownership.map((item) => item.component));
|
|
1010
1037
|
target.desiredOwnedComponents = target.ownedComponents;
|
|
1011
1038
|
let frozenNativeTools;
|
|
1012
|
-
const verifyChecks = async (selected) => {
|
|
1039
|
+
const verifyChecks = async (selected, batch) => {
|
|
1013
1040
|
for (const check of selected)
|
|
1014
|
-
if (!await check())
|
|
1041
|
+
if (!await check(batch))
|
|
1015
1042
|
throw new Error('operationPlanStale: deployment evidence changed.');
|
|
1016
1043
|
for (const plan of plans)
|
|
1017
1044
|
if (!await this.verifyMarketplace(plan))
|
|
1018
1045
|
throw new Error('operationPlanStale: marketplace evidence changed.');
|
|
1019
1046
|
};
|
|
1020
|
-
const verify = () => verifyChecks(checks.values());
|
|
1047
|
+
const verify = (batch) => verifyChecks(checks.values(), batch);
|
|
1021
1048
|
const canVerifyAtExecution = () => {
|
|
1022
1049
|
const prepared = deployments[0];
|
|
1023
1050
|
if (!prepared || deployments.length !== 1 || plans.length !== 1 || plans[0] !== prepared.plan || blockedReceipts.length
|
|
@@ -1028,13 +1055,37 @@ export class PlatformRebuildSession {
|
|
|
1028
1055
|
&& driverState.before.package === 'absent' && driverState.before.ownership === 'absent'
|
|
1029
1056
|
&& plan.evidence.sharedReferences === 'none' && plan.evidence.ownership.every((item) => item.state === 'absent')
|
|
1030
1057
|
&& plan.effects.every((effect) => ['publish-package', 'register'].includes(effect.kind));
|
|
1031
|
-
|
|
1058
|
+
const checkedBatch = this.context.batchInstallPlatform === plan.binding.platform && plan.binding.platform !== 'codex';
|
|
1059
|
+
return plan.operation === 'ensure' && (checkedBatch || ['copilot-marketplace', 'pi-package'].includes(plan.binding.route))
|
|
1032
1060
|
&& plan.binding.platform === target.identity.platform && plan.expected.components.length > 0 && !plan.expected.unmet.length
|
|
1033
1061
|
&& driverState.before.package !== 'unknown' && (driverState.before.registration !== 'unknown' || hiddenEmptyPiProject)
|
|
1034
1062
|
&& ['absent', 'aw', 'shared'].includes(driverState.before.ownership)
|
|
1035
1063
|
&& plan.effects.every((effect) => ['publish-package', 'register', 'refresh', 'activate'].includes(effect.kind));
|
|
1036
1064
|
};
|
|
1037
|
-
|
|
1065
|
+
let privateStaging;
|
|
1066
|
+
let stagedPackage;
|
|
1067
|
+
const packagePlan = plans.length === 1 ? plans[0] : undefined;
|
|
1068
|
+
const bundle = packagePlan?.projections.find((projection) => projection.bundle)?.bundle;
|
|
1069
|
+
// Registration mutates a shared client. Copy independent bytes outside its
|
|
1070
|
+
// namespace first; publication still checks the original frozen live plan.
|
|
1071
|
+
const privatePackage = packagePlan && bundle && packagePlan.operation === 'ensure'
|
|
1072
|
+
&& ['pi-package', 'claude-marketplace'].includes(packagePlan.binding.route)
|
|
1073
|
+
&& packagePlan.effects.some((effect) => effect.kind === 'publish-package') ? {
|
|
1074
|
+
prepare: async () => {
|
|
1075
|
+
privateStaging = await fs.mkdtemp(path.join(await this.root(), 'private-package-'));
|
|
1076
|
+
stagedPackage = path.join(privateStaging, input.plugin.manifest.name);
|
|
1077
|
+
await fs.copy(bundle.stagingRoot, stagedPackage, { dereference: false });
|
|
1078
|
+
},
|
|
1079
|
+
dispose: async () => {
|
|
1080
|
+
if (privateStaging)
|
|
1081
|
+
await fs.remove(privateStaging);
|
|
1082
|
+
privateStaging = undefined;
|
|
1083
|
+
stagedPackage = undefined;
|
|
1084
|
+
},
|
|
1085
|
+
} : undefined;
|
|
1086
|
+
target.platformDeployment = { deployments, plans, blockedReceipts, cleanupResults, privatePackage,
|
|
1087
|
+
writesManagedCommands: [...preparedUnits.values()].some((unit) => unit.finalized.commandCandidates.length > 0)
|
|
1088
|
+
|| [...priorProducers.values()].some((producers) => producers.length > 0),
|
|
1038
1089
|
canVerifyAtExecution,
|
|
1039
1090
|
captureNativeToolChanges: async () => {
|
|
1040
1091
|
const signature = artifactValueDigest(deployments.map(({ plan }) => ({ bindingId: plan.binding.id,
|
|
@@ -1065,14 +1116,15 @@ export class PlatformRebuildSession {
|
|
|
1065
1116
|
if (!['ensure', 'reinstall'].includes(plan.operation) || !plan.expected.components.length)
|
|
1066
1117
|
continue;
|
|
1067
1118
|
const receipt = receipts.find((entry) => entry.bindingId === plan.binding.id);
|
|
1068
|
-
if (!receipt)
|
|
1119
|
+
if (!receipt || options?.deliveredSkillsOnly && plan.evidence.retainPackage)
|
|
1069
1120
|
continue;
|
|
1070
1121
|
const after = options?.refresh ? await adapter.inspect(ctx, plan.binding) : receipt.after;
|
|
1071
|
-
const supplementFiles =
|
|
1072
|
-
.filter((contribution) => contribution.kind === 'owned-file'));
|
|
1122
|
+
const supplementFiles = componentSupplementFiles(plan);
|
|
1073
1123
|
const supplementIds = new Set(supplementFiles.flatMap((contribution) => contribution.componentIds));
|
|
1074
|
-
|
|
1075
|
-
|
|
1124
|
+
if (!options?.deliveredSkillsOnly) {
|
|
1125
|
+
const supplements = await inspectStaticSupplements(ctx, plan.binding, plan.expected.components.filter((component) => supplementIds.has(component.id)));
|
|
1126
|
+
after.components = [...after.components.filter((component) => !supplementIds.has(component.id)), ...supplements.components];
|
|
1127
|
+
}
|
|
1076
1128
|
if (options?.refresh) {
|
|
1077
1129
|
receipt.after = after;
|
|
1078
1130
|
receipt.diagnostics.push(...after.diagnostics);
|
|
@@ -1081,15 +1133,50 @@ export class PlatformRebuildSession {
|
|
|
1081
1133
|
.flatMap((projection) => projection.components.map((component) => component.id)));
|
|
1082
1134
|
const bundle = plan.projections.find((projection) => projection.bundle)?.bundle;
|
|
1083
1135
|
const requiredActivation = requiredDeploymentActivation(plan.binding, after, requireIndependentActivation);
|
|
1084
|
-
if (!requireIndependentActivation && requiredActivation === 'enabled') {
|
|
1136
|
+
if (!options?.deliveredSkillsOnly && !requireIndependentActivation && requiredActivation === 'enabled') {
|
|
1085
1137
|
receipt.diagnostics = receipt.diagnostics.filter((entry) => entry.code !== 'codexProjectActivationUnconfirmed');
|
|
1086
1138
|
}
|
|
1087
1139
|
const nativeContentIncomplete = bundle && nativeCopyIncomplete(plan.binding, after, bundle.contentDigest);
|
|
1140
|
+
// Partial execution already verified the frozen plan and recorded each package publication.
|
|
1141
|
+
const publication = options?.deliveredSkillsOnly && plan.effects.find((effect) => effect.kind === 'publish-package');
|
|
1088
1142
|
const packageIncomplete = bundle && (!packageDeliveryConfirmed(plan.binding, after, bundle.contentDigest, requireIndependentActivation)
|
|
1089
|
-
||
|
|
1143
|
+
|| (options?.deliveredSkillsOnly
|
|
1144
|
+
? !plan.evidence.contentMatches && !receipt.effects.some((effect) => publication && effect.id === publication.id
|
|
1145
|
+
&& effect.status === 'applied' && effect.mutation === 'confirmed')
|
|
1146
|
+
: await readPlatformPackageContentDigest(plan.evidence.layout.packageRoot) !== bundle.contentDigest));
|
|
1090
1147
|
const delivered = new Set(after.components.filter((component) => component.presence === 'present' && !component.reasonCodes.length)
|
|
1091
1148
|
.map((component) => component.id));
|
|
1092
1149
|
const gaps = plan.expected.components.filter((component) => packageIncomplete && packageIds.has(component.id) || !delivered.has(component.id));
|
|
1150
|
+
if (bundle && !packageIncomplete && !plan.evidence.retainPackage) {
|
|
1151
|
+
for (const unitId of plan.binding.renderUnitIds) {
|
|
1152
|
+
const unit = preparedUnits.get(unitId);
|
|
1153
|
+
if (!unit?.finalized.skills.length)
|
|
1154
|
+
continue;
|
|
1155
|
+
const capabilityInput = { binding: plan.binding, renderUnit: unit.unit,
|
|
1156
|
+
observation: after, profile: getQualifiedPlatformProfile(input.platform) };
|
|
1157
|
+
const capabilities = adapter.capabilities(capabilityInput);
|
|
1158
|
+
const cliReaders = unit.unit.consumers.filter(({ product }) => product === 'cli');
|
|
1159
|
+
// Only attribute a shared package's limitation to Desktop if the same
|
|
1160
|
+
// check passes for its CLI readers and an App reader was observed.
|
|
1161
|
+
const codexCliCapabilities = plan.binding.platform === 'codex'
|
|
1162
|
+
&& cliReaders.some(({ availability }) => availability === 'available')
|
|
1163
|
+
&& unit.unit.consumers.some(({ product, availability }) => product === 'app' && availability === 'available')
|
|
1164
|
+
&& unit.unit.consumers.every(({ product, availability, entry }) => product === 'app'
|
|
1165
|
+
|| product === 'cli' && availability === 'available' && entry?.kind === 'cli')
|
|
1166
|
+
? adapter.capabilities({ ...capabilityInput, renderUnit: { ...unit.unit, consumers: cliReaders } }) : undefined;
|
|
1167
|
+
for (const skill of unit.finalized.skills) {
|
|
1168
|
+
if (!packageIds.has(skill.componentId) || !delivered.has(skill.componentId))
|
|
1169
|
+
continue;
|
|
1170
|
+
const component = unit.prepared.expected.components.find((item) => item.id === skill.componentId);
|
|
1171
|
+
const requested = getComponentFeatureRequirements(component, { skillText: skill.tree.files['SKILL.md'].toString('utf8') });
|
|
1172
|
+
const warning = skillInvocationWarning(component.name, requested, { pluginId: plan.binding.plugin.pluginId, target: plan.binding.platform, scope: plan.binding.scope.kind }, capabilities, codexCliCapabilities);
|
|
1173
|
+
if (warning)
|
|
1174
|
+
receipt.diagnostics.push(warning);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
if (options?.deliveredSkillsOnly)
|
|
1179
|
+
continue;
|
|
1093
1180
|
const inputDigest = supplementInputDigests.get(plan.binding.id);
|
|
1094
1181
|
if (inputDigest && [...supplementIds].every((id) => delivered.has(id))
|
|
1095
1182
|
&& !receipt.unmet.length && !receipt.diagnostics.some((diagnostic) => diagnostic.severity === 'error')) {
|
|
@@ -1117,15 +1204,13 @@ export class PlatformRebuildSession {
|
|
|
1117
1204
|
? 'codexProjectActivationUnconfirmed'
|
|
1118
1205
|
: nativeContentIncomplete ? 'nativeInstallContentPostcheckFailed' : 'deploymentPostcheckFailed';
|
|
1119
1206
|
receipt.diagnostics.push({ code, severity: 'error',
|
|
1120
|
-
message: code === 'nativeInstallContentPostcheckFailed'
|
|
1121
|
-
?
|
|
1122
|
-
: code === '
|
|
1123
|
-
? '
|
|
1124
|
-
: code === '
|
|
1125
|
-
? '
|
|
1126
|
-
:
|
|
1127
|
-
? 'Codex reports effective activation but does not distinguish this project from User inheritance.'
|
|
1128
|
-
: 'The final observation does not confirm the requested deployment. Check status and sync the affected target.',
|
|
1207
|
+
message: code === 'nativeInstallContentPostcheckFailed'
|
|
1208
|
+
? 'The installed native copy does not confirm the frozen package bytes. Check status and sync the affected target.'
|
|
1209
|
+
: code === 'grokProjectAuthorizationDenied'
|
|
1210
|
+
? 'Grok denied authorization for the selected project. Review the project in Grok before syncing.'
|
|
1211
|
+
: code === 'codexProjectActivationUnconfirmed'
|
|
1212
|
+
? 'Codex reports effective activation but does not distinguish this project from User inheritance.'
|
|
1213
|
+
: 'The final observation does not confirm the requested deployment. Check status and sync the affected target.',
|
|
1129
1214
|
subject: { target: plan.binding.platform, pluginId: plan.binding.plugin.pluginId, scope: plan.binding.scope.kind } });
|
|
1130
1215
|
receipt.unmet.push(...gaps.map((component) => ({ id: `postcheck:${plan.binding.id}:${component.id}`,
|
|
1131
1216
|
componentId: component.id, kind: component.kind, reasonCode: code, requiredFeatures: [],
|
|
@@ -1147,22 +1232,21 @@ export class PlatformRebuildSession {
|
|
|
1147
1232
|
cleanupResults.length = 0;
|
|
1148
1233
|
const receipts = [...blockedReceipts];
|
|
1149
1234
|
for (const prepared of deployments) {
|
|
1235
|
+
const supplementFiles = componentSupplementFiles(prepared.plan);
|
|
1236
|
+
const writtenFiles = new Map();
|
|
1150
1237
|
const commandPreparationFailed = prepared.plan.binding.renderUnitIds.some((unitId) => preparedUnits.get(unitId)?.finalized.producerResolutions
|
|
1151
1238
|
.some((resolution) => resolution.state === 'failed' || resolution.state === 'unmet'));
|
|
1152
1239
|
let receipt;
|
|
1153
|
-
const
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1240
|
+
const peers = prepared.plan.binding.route === 'codex-marketplace' ? [...this.mutableChecks.values()].filter((check) => check.physicalKey !== prepared.plan.binding.physicalKey && check.marketplaceRoot === prepared.plan.evidence.layout.marketplaceRoot
|
|
1241
|
+
&& check.sourceId === prepared.plan.binding.plugin.sourceId && check.sourceIdentity === prepared.plan.binding.plugin.sourceIdentity) : [];
|
|
1242
|
+
const nativeServices = createNativeLifecycleServices(ctx, prepared.plan.evidence, peers.length ? async () => {
|
|
1243
|
+
for (const peer of peers)
|
|
1244
|
+
await peer.assertStable();
|
|
1245
|
+
} : undefined);
|
|
1158
1246
|
try {
|
|
1159
|
-
receipt = await adapter.lifecycle.execute({ ...
|
|
1247
|
+
receipt = await adapter.lifecycle.execute({ ...ctx, nativeEffects: this.nativeEffects, inspect: (binding) => adapter.inspect(ctx, binding), services: {
|
|
1160
1248
|
...nativeServices,
|
|
1161
1249
|
registerMarketplace: async (binding, identity) => {
|
|
1162
|
-
const peers = binding.route === 'codex-marketplace' ? [...this.mutableChecks.values()].filter((check) => check.physicalKey !== binding.physicalKey && check.marketplaceRoot === prepared.plan.evidence.layout.marketplaceRoot
|
|
1163
|
-
&& check.sourceId === binding.plugin.sourceId && check.sourceIdentity === binding.plugin.sourceIdentity) : [];
|
|
1164
|
-
for (const peer of peers)
|
|
1165
|
-
await peer.assertStable();
|
|
1166
1250
|
const outcome = await nativeServices.registerMarketplace(binding, identity);
|
|
1167
1251
|
if (outcome.mutation === 'confirmed') {
|
|
1168
1252
|
ctx.codexObservationSession?.invalidate(prepared.plan.evidence.layout.marketplaceName ?? undefined);
|
|
@@ -1187,7 +1271,7 @@ export class PlatformRebuildSession {
|
|
|
1187
1271
|
inputDigest: inputDigests.get(prepared.plan.binding.id), contentDigest: bundle.contentDigest,
|
|
1188
1272
|
preparation: prepared.plan.expected.unmet.length || commandPreparationFailed ? 'partial' : 'complete',
|
|
1189
1273
|
physicalIdentity: (await getDeploymentLayout(ctx, prepared.plan.binding)).physicalIdentity,
|
|
1190
|
-
});
|
|
1274
|
+
}, stagedPackage);
|
|
1191
1275
|
this.published.set(prepared.plan.binding.physicalKey, publication);
|
|
1192
1276
|
}
|
|
1193
1277
|
return publication;
|
|
@@ -1197,7 +1281,12 @@ export class PlatformRebuildSession {
|
|
|
1197
1281
|
if (component.kind === 'owned-directory')
|
|
1198
1282
|
return publishDirectory(contribution.stagingPath, component);
|
|
1199
1283
|
if (component.kind === 'owned-text-file') {
|
|
1200
|
-
|
|
1284
|
+
const content = await fs.readFile(contribution.stagingPath, 'utf8');
|
|
1285
|
+
await writeOwnedTextFile({ ...component, content });
|
|
1286
|
+
if (supplementFiles.includes(contribution)) {
|
|
1287
|
+
writtenFiles.set(component.path, { componentIds: contribution.componentIds,
|
|
1288
|
+
digest: crypto.createHash('sha256').update(renderOwnedTextFile(content, component.identity)).digest('hex') });
|
|
1289
|
+
}
|
|
1201
1290
|
}
|
|
1202
1291
|
else if (component.kind === 'shared-config' && component.locator.kind === 'cursor-workspace-hook') {
|
|
1203
1292
|
const locator = component.locator;
|
|
@@ -1231,7 +1320,7 @@ export class PlatformRebuildSession {
|
|
|
1231
1320
|
} }, prepared);
|
|
1232
1321
|
}
|
|
1233
1322
|
catch (error) {
|
|
1234
|
-
const diagnostic = { code: 'platformExecutionFailed', severity: 'error',
|
|
1323
|
+
const diagnostic = { code: recoveryInterruptionCode(error) ?? 'platformExecutionFailed', severity: 'error',
|
|
1235
1324
|
message: error instanceof Error ? error.message : String(error),
|
|
1236
1325
|
subject: { target: prepared.plan.binding.platform, pluginId: prepared.plan.binding.plugin.pluginId, scope: prepared.plan.binding.scope.kind } };
|
|
1237
1326
|
receipt = { bindingId: prepared.plan.binding.id, effects: prepared.plan.effects.map((effect) => ({
|
|
@@ -1241,6 +1330,8 @@ export class PlatformRebuildSession {
|
|
|
1241
1330
|
unmet: [], reload: 'unknown', diagnostics: [diagnostic] };
|
|
1242
1331
|
}
|
|
1243
1332
|
receipts.push(receipt);
|
|
1333
|
+
if (receipt.diagnostics.some(({ code }) => code === 'processCleanupUnconfirmed'))
|
|
1334
|
+
return receipts;
|
|
1244
1335
|
if ((prepared.plan.operation === 'remove' || prepared.plan.operation === 'cleanup'
|
|
1245
1336
|
|| prepared.plan.expected.components.length === 0 && prepared.plan.expected.unmet.length === 0)
|
|
1246
1337
|
&& prepared.plan.evidence.sharedReferences !== 'none' && receipt.after.package === 'present') {
|
|
@@ -1262,9 +1353,14 @@ export class PlatformRebuildSession {
|
|
|
1262
1353
|
try {
|
|
1263
1354
|
if (receipt.effects.some((effect) => effect.mutation !== 'none')) {
|
|
1264
1355
|
for (const [bindingId, check] of this.mutableChecks)
|
|
1265
|
-
if (check.physicalKey === prepared.plan.binding.physicalKey
|
|
1266
|
-
|
|
1267
|
-
|
|
1356
|
+
if (check.physicalKey === prepared.plan.binding.physicalKey) {
|
|
1357
|
+
const { observation: fresh, verifiedSupplementIds } = await check.rebase(bindingId === receipt.bindingId ? writtenFiles : undefined);
|
|
1358
|
+
if (verifiedSupplementIds.length) {
|
|
1359
|
+
receipt.after.components = [
|
|
1360
|
+
...receipt.after.components.filter(({ id }) => !verifiedSupplementIds.includes(id)),
|
|
1361
|
+
...verifiedSupplementIds.map((id) => ({ id, presence: 'present', reasonCodes: [] })),
|
|
1362
|
+
];
|
|
1363
|
+
}
|
|
1268
1364
|
if (bindingId === receipt.bindingId && prepared.plan.binding.route === 'copilot-marketplace'
|
|
1269
1365
|
&& publication?.mutation === 'confirmed') {
|
|
1270
1366
|
recheckCopilotMarketplaceTimeout(receipt, fresh);
|
|
@@ -1273,7 +1369,7 @@ export class PlatformRebuildSession {
|
|
|
1273
1369
|
}
|
|
1274
1370
|
}
|
|
1275
1371
|
catch (error) {
|
|
1276
|
-
receipt.diagnostics.push({ code: 'operationPlanStale', severity: 'error', message: error instanceof Error ? error.message : String(error),
|
|
1372
|
+
receipt.diagnostics.push({ code: recoveryInterruptionCode(error) ?? 'operationPlanStale', severity: 'error', message: error instanceof Error ? error.message : String(error),
|
|
1277
1373
|
subject: { target: prepared.plan.binding.platform, pluginId: prepared.plan.binding.plugin.pluginId, scope: prepared.plan.binding.scope.kind } });
|
|
1278
1374
|
continue;
|
|
1279
1375
|
}
|
|
@@ -1326,7 +1422,7 @@ export class PlatformRebuildSession {
|
|
|
1326
1422
|
|| receipt.after.package === 'absent' && receipt.after.registration === 'not-applicable'
|
|
1327
1423
|
|| receipt.after.scopeRegistration === 'absent'
|
|
1328
1424
|
|| prepared.plan.binding.scope.kind === 'project'
|
|
1329
|
-
&& ['codex-marketplace', '
|
|
1425
|
+
&& ['codex-marketplace', 'copilot-marketplace'].includes(prepared.plan.binding.route)
|
|
1330
1426
|
&& receipt.after.configuration?.activation === 'absent'
|
|
1331
1427
|
|| receipt.after.consumers.every((consumer) => ['disabled', 'not-applicable'].includes(consumer.activation));
|
|
1332
1428
|
if (emptyState && !prepared.plan.expected.components.length && !receipt.unmet.length
|