@lesliechan721/aw 0.1.0-beta.82 → 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 +14 -3
- package/dist/src/commands/rebuild-platform-integration.js +240 -137
- 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 +21 -5
- package/dist/src/recovery/coordinator.js +383 -151
- 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 +681 -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/catalog-generation.d.ts +6 -0
- package/dist/src/tui/catalog-generation.js +22 -6
- package/dist/src/tui/catalog-generation.js.map +1 -1
- package/dist/src/tui/console-app-v4.d.ts +1 -1
- package/dist/src/tui/console-app-v4.js +139 -59
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +145 -53
- 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 +241 -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/glossary.js +1 -0
- package/dist/src/tui/glossary.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-generation-resolver.d.ts +1 -0
- package/dist/src/utils/catalog-generation-resolver.js +1 -0
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
- package/dist/src/utils/catalog-operation-context.d.ts +11 -0
- package/dist/src/utils/catalog-operation-context.js +18 -3
- package/dist/src/utils/catalog-operation-context.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'));
|
|
@@ -345,6 +401,7 @@ export class PlatformRebuildSession {
|
|
|
345
401
|
marketplaceCandidatesFrozen = false;
|
|
346
402
|
ownership = platformOwnership;
|
|
347
403
|
marketplaces = new Map();
|
|
404
|
+
closedObservationBatch;
|
|
348
405
|
staging;
|
|
349
406
|
constructor(context, adapterFor = getAgentPluginAdapter) {
|
|
350
407
|
this.context = context;
|
|
@@ -357,28 +414,13 @@ export class PlatformRebuildSession {
|
|
|
357
414
|
}
|
|
358
415
|
setOwnershipExecutor(executor) { this.ownership = executor; }
|
|
359
416
|
root() { return this.staging ??= fs.mkdtemp(path.join(os.tmpdir(), 'aw-deployment-')); }
|
|
360
|
-
nativeReadContext(input) {
|
|
361
|
-
const ctx = readContext(this.context, input.cwd);
|
|
362
|
-
if (input.platform === 'gemini')
|
|
363
|
-
ctx.nativeNodeCompileCacheDir = async () => {
|
|
364
|
-
const pending = this.root();
|
|
365
|
-
try {
|
|
366
|
-
return path.join(await pending, 'native-node-compile-cache');
|
|
367
|
-
}
|
|
368
|
-
catch (error) {
|
|
369
|
-
// An optional cache allocation must not poison later required staging.
|
|
370
|
-
if (this.staging === pending)
|
|
371
|
-
this.staging = undefined;
|
|
372
|
-
throw error;
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
return ctx;
|
|
376
|
-
}
|
|
377
417
|
ordinaryReadContext(ctx, platform) {
|
|
378
|
-
|
|
379
|
-
//
|
|
380
|
-
|
|
381
|
-
|
|
418
|
+
const batch = this.context.nativeObservationBatch;
|
|
419
|
+
// A locked re-Review starts its own observation batch. Cached targets of
|
|
420
|
+
// the earlier Review do not close the new batch before its first build.
|
|
421
|
+
const open = platform === 'pi'
|
|
422
|
+
? batch !== this.closedObservationBatch : this.targets.size === 0 && platform !== 'codex';
|
|
423
|
+
return open && batch ? { ...ctx, ...batch } : ctx;
|
|
382
424
|
}
|
|
383
425
|
async dispose() {
|
|
384
426
|
for (const result of await Promise.allSettled(this.units.values()))
|
|
@@ -411,7 +453,8 @@ export class PlatformRebuildSession {
|
|
|
411
453
|
if (!result) {
|
|
412
454
|
result = (async () => {
|
|
413
455
|
const adapter = this.adapterFor(input.platform);
|
|
414
|
-
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);
|
|
415
458
|
const plugin = sourceIdentity(input);
|
|
416
459
|
const recoveryCandidates = (this.context.recoveryCandidates ?? []).filter((candidate) => candidate.binding.platform === input.platform
|
|
417
460
|
&& candidate.binding.plugin.sourceIdentity === plugin.sourceIdentity && candidate.binding.plugin.pluginId === plugin.pluginId
|
|
@@ -452,7 +495,7 @@ export class PlatformRebuildSession {
|
|
|
452
495
|
if (target.identity.scope !== 'project' || !target.operationActions?.some((action) => action.kind === 'runPreApply'))
|
|
453
496
|
continue;
|
|
454
497
|
const plans = target.platformDeployment?.plans ?? [];
|
|
455
|
-
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)
|
|
456
499
|
|| plan.effects.some((effect) => effect.physicalKey !== plan.binding.physicalKey)
|
|
457
500
|
|| plan.projections.some((projection) => projection.supplements.length > 0)
|
|
458
501
|
|| !plan.evidence.renderUnits?.some((unit) => unit.output === 'package' && unit.renderScope.kind === 'user')))
|
|
@@ -605,16 +648,21 @@ export class PlatformRebuildSession {
|
|
|
605
648
|
target = this.build(input, (check) => { verifyInitial = check; });
|
|
606
649
|
this.targets.set(key, target);
|
|
607
650
|
}
|
|
651
|
+
// A writable build or cached-target verification ends ordinary sharing,
|
|
652
|
+
// before any renderer, plan verification or mutation can consume it.
|
|
653
|
+
if (this.context.nativeObservationBatch)
|
|
654
|
+
this.closedObservationBatch = this.context.nativeObservationBatch;
|
|
608
655
|
const result = await target;
|
|
609
656
|
if (verifyInitial)
|
|
610
657
|
await verifyInitial();
|
|
611
658
|
else
|
|
612
|
-
await result.platformDeployment?.verify();
|
|
659
|
+
await result.platformDeployment?.verify(input.observationBatch);
|
|
613
660
|
return result;
|
|
614
661
|
}
|
|
615
662
|
async build(input, receiveInitialVerifier) {
|
|
616
|
-
const ctx = this.
|
|
617
|
-
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);
|
|
618
666
|
const resolution = await this.resolve(input);
|
|
619
667
|
if (!resolution.bindings.length)
|
|
620
668
|
throw Object.assign(new Error(`platformUnavailable: ${resolution.exclusions.map((item) => item.reasonCode).join(', ') || input.platform}`), { deploymentExclusions: this.exclusions.get(this.key(input)) ?? [] });
|
|
@@ -801,18 +849,17 @@ export class PlatformRebuildSession {
|
|
|
801
849
|
const inspected = await inspectOwnedComponents({ components, executor: this.ownership });
|
|
802
850
|
const managedCommandReview = await captureManagedCommandReviewEvidence({ binding: entry.binding,
|
|
803
851
|
renderUnits: entry.layout.renderUnits, components: units.flatMap((unit) => unit.prepared.expected.components), projections });
|
|
804
|
-
const currentMutable = async () => {
|
|
805
|
-
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);
|
|
806
854
|
return { observation, references: await sharedReferences(this.context, entry.binding, observation, entry.layout),
|
|
807
|
-
geminiActivation: entry.binding.route === 'gemini-extension' ? geminiActivationEvidence(await readGeminiActivationSnapshot(ctx)) : undefined,
|
|
808
855
|
paths: await Promise.all(components.map(async (component) => 'path' in component ? pathEvidence(component.path) : {
|
|
809
856
|
ownership: await inspectOwnedComponents({ components: [component], executor: this.ownership }), contentDigest: await ownedContentDigest(component),
|
|
810
857
|
})) };
|
|
811
858
|
};
|
|
812
|
-
const fingerprintParts = async (discovery) => ({
|
|
859
|
+
const fingerprintParts = async (discovery, batch) => ({
|
|
813
860
|
managedCommandReview,
|
|
814
861
|
source: removing ? null : await pathEvidence(input.plugin.rootDir),
|
|
815
|
-
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),
|
|
816
863
|
sharedReferenceView: this.context.sharedReferenceView,
|
|
817
864
|
layout: await getDeploymentLayout(ctx, entry.binding),
|
|
818
865
|
config: await Promise.all(units.map((unit) => resolveArtifactRenderConfig({ ...sourceIdentity(input), pluginName: input.plugin.manifest.name,
|
|
@@ -825,7 +872,7 @@ export class PlatformRebuildSession {
|
|
|
825
872
|
});
|
|
826
873
|
// Discovery and inspection are independent reads for these routes. Settle
|
|
827
874
|
// both before comparing or throwing, while preserving immutable priority.
|
|
828
|
-
const parallelNativeReads = ['
|
|
875
|
+
const parallelNativeReads = ['copilot-marketplace', 'pi-package'].includes(entry.binding.route);
|
|
829
876
|
const initialReads = parallelNativeReads
|
|
830
877
|
? await Promise.allSettled([fingerprintParts(), currentMutable()]) : null;
|
|
831
878
|
if (initialReads?.[0].status === 'rejected')
|
|
@@ -835,7 +882,7 @@ export class PlatformRebuildSession {
|
|
|
835
882
|
throw new Error('operationPlanStale: client discovery changed after the ordinary observation.');
|
|
836
883
|
}
|
|
837
884
|
const initial = artifactValueDigest(initialParts);
|
|
838
|
-
const fingerprint = async (discovery) => artifactValueDigest(await fingerprintParts(discovery));
|
|
885
|
+
const fingerprint = async (discovery, batch) => artifactValueDigest(await fingerprintParts(discovery, batch));
|
|
839
886
|
if (initialReads?.[1].status === 'rejected')
|
|
840
887
|
throw initialReads[1].reason;
|
|
841
888
|
let mutableBaseline = initialReads?.[1].status === 'fulfilled' ? initialReads[1].value : await currentMutable();
|
|
@@ -843,13 +890,13 @@ export class PlatformRebuildSession {
|
|
|
843
890
|
if (ordinaryObservation !== undefined && ordinaryObservation !== artifactValueDigest(mutableBaseline.observation)) {
|
|
844
891
|
throw new Error('operationPlanStale: deployment evidence changed after the ordinary observation.');
|
|
845
892
|
}
|
|
846
|
-
const preparationObservation = entry.binding.route === '
|
|
893
|
+
const preparationObservation = entry.binding.route === 'antigravity-cli'
|
|
847
894
|
? mutableBaseline.observation : entry.observation;
|
|
848
|
-
const check = async (discovery) => {
|
|
895
|
+
const check = async (discovery, batch) => {
|
|
849
896
|
if (!parallelNativeReads)
|
|
850
|
-
return await fingerprint(discovery) === initial
|
|
851
|
-
&& artifactValueDigest(await currentMutable()) === artifactValueDigest(mutableBaseline);
|
|
852
|
-
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)]);
|
|
853
900
|
if (immutableRead.status === 'rejected')
|
|
854
901
|
throw immutableRead.reason;
|
|
855
902
|
if (immutableRead.value !== initial)
|
|
@@ -858,14 +905,13 @@ export class PlatformRebuildSession {
|
|
|
858
905
|
throw mutableRead.reason;
|
|
859
906
|
return artifactValueDigest(mutableRead.value) === artifactValueDigest(mutableBaseline);
|
|
860
907
|
};
|
|
861
|
-
checks.set(entry.binding.id, () => check());
|
|
862
|
-
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') {
|
|
863
910
|
initialDiscoveryCheck = () => check({ value: initialParts.discovery });
|
|
864
911
|
}
|
|
865
912
|
this.mutableChecks.set(entry.binding.id, { physicalKey: entry.binding.physicalKey,
|
|
866
913
|
marketplaceRoot: entry.layout.marketplaceRoot, sourceId: entry.binding.plugin.sourceId,
|
|
867
914
|
sourceIdentity: entry.binding.plugin.sourceIdentity,
|
|
868
|
-
...(entry.binding.route === 'gemini-extension' ? { geminiActivationSnapshot: () => mutableBaseline.geminiActivation } : {}),
|
|
869
915
|
assertStable: async () => {
|
|
870
916
|
if (!await checks.get(entry.binding.id)())
|
|
871
917
|
throw new Error('operationPlanStale: deployment evidence changed before source registration.');
|
|
@@ -893,7 +939,7 @@ export class PlatformRebuildSession {
|
|
|
893
939
|
// registration. The reviewed package, references and bytes stay frozen.
|
|
894
940
|
mutableBaseline = current;
|
|
895
941
|
},
|
|
896
|
-
rebase: async (
|
|
942
|
+
rebase: async (writtenFiles) => {
|
|
897
943
|
const reads = parallelNativeReads
|
|
898
944
|
? await Promise.allSettled([fingerprintParts(), currentMutable()]) : null;
|
|
899
945
|
if (reads?.[0].status === 'rejected')
|
|
@@ -907,11 +953,18 @@ export class PlatformRebuildSession {
|
|
|
907
953
|
if (reads?.[1].status === 'rejected')
|
|
908
954
|
throw reads[1].reason;
|
|
909
955
|
const mutable = reads?.[1].status === 'fulfilled' ? reads[1].value : await currentMutable();
|
|
910
|
-
if (artifactValueDigest(mutable.geminiActivation ?? null) !== artifactValueDigest(geminiExpected ?? mutableBaseline.geminiActivation ?? null)) {
|
|
911
|
-
throw new Error('operationPlanStale: Gemini activation changed outside the checked native mutation.');
|
|
912
|
-
}
|
|
913
956
|
mutableBaseline = mutable;
|
|
914
|
-
|
|
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 };
|
|
915
968
|
} });
|
|
916
969
|
const evidence = { fingerprint: initial, managedCommandReview, layout: entry.layout, renderUnits: entry.layout.renderUnits,
|
|
917
970
|
ownership: await Promise.all(inspected.components.map(async ({ component, state }) => ({ component, state,
|
|
@@ -938,30 +991,11 @@ export class PlatformRebuildSession {
|
|
|
938
991
|
? enabled[entry.layout.nativeIdentity.registrationId] === true : 'unknown';
|
|
939
992
|
}
|
|
940
993
|
}
|
|
941
|
-
if (entry.binding.
|
|
942
|
-
evidence.userActivationEnabled = 'unknown';
|
|
943
|
-
const view = this.context.sharedReferenceView;
|
|
944
|
-
try {
|
|
945
|
-
const snapshot = await readGeminiActivationSnapshot(ctx, mutableBaseline.geminiActivation);
|
|
946
|
-
const rules = geminiActivationRules(snapshot, entry.layout.nativeIdentity.packageId);
|
|
947
|
-
await assertGeminiProjectRules(ctx, entry.binding, rules);
|
|
948
|
-
const actual = geminiUserActivation(snapshot, entry.layout.nativeIdentity.packageId, geminiExtensionPaths(ctx).home);
|
|
949
|
-
if (actual !== 'unknown' && preparationObservation.registration !== 'unknown'
|
|
950
|
-
&& (entry.binding.scope.kind === 'user' || view?.desiredComplete && view.scopes.includes('user'))) {
|
|
951
|
-
// Shared User renderScope does not establish User demand. A fresh
|
|
952
|
-
// project starts disabled globally; an existing global intent stays.
|
|
953
|
-
evidence.userActivationEnabled = preparationObservation.registration === 'present' ? actual : entry.binding.scope.kind === 'user'
|
|
954
|
-
|| view?.desired.some((reference) => reference.scope === 'user' && reference.platform === 'gemini'
|
|
955
|
-
&& reference.pluginId === entry.binding.plugin.pluginId && reference.sourceIdentity === entry.binding.plugin.sourceIdentity) === true;
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
catch { /* Invalid or ambiguous native configuration remains blocked. */ }
|
|
959
|
-
}
|
|
960
|
-
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)) {
|
|
961
995
|
const plannedUser = [...this.requestedOperations.values()].find((request) => request.scope === 'user'
|
|
962
996
|
&& request.platform === input.platform && sourceIdentity(request).sourceIdentity === entry.binding.plugin.sourceIdentity
|
|
963
997
|
&& sourceIdentity(request).pluginId === entry.binding.plugin.pluginId);
|
|
964
|
-
if (plannedUser
|
|
998
|
+
if (plannedUser) {
|
|
965
999
|
evidence.userActivationEnabled = !['remove', 'cleanup'].includes(operation(plannedUser));
|
|
966
1000
|
}
|
|
967
1001
|
}
|
|
@@ -1002,15 +1036,15 @@ export class PlatformRebuildSession {
|
|
|
1002
1036
|
target.ownedComponents = plans.flatMap((plan) => plan.evidence.ownership.map((item) => item.component));
|
|
1003
1037
|
target.desiredOwnedComponents = target.ownedComponents;
|
|
1004
1038
|
let frozenNativeTools;
|
|
1005
|
-
const verifyChecks = async (selected) => {
|
|
1039
|
+
const verifyChecks = async (selected, batch) => {
|
|
1006
1040
|
for (const check of selected)
|
|
1007
|
-
if (!await check())
|
|
1041
|
+
if (!await check(batch))
|
|
1008
1042
|
throw new Error('operationPlanStale: deployment evidence changed.');
|
|
1009
1043
|
for (const plan of plans)
|
|
1010
1044
|
if (!await this.verifyMarketplace(plan))
|
|
1011
1045
|
throw new Error('operationPlanStale: marketplace evidence changed.');
|
|
1012
1046
|
};
|
|
1013
|
-
const verify = () => verifyChecks(checks.values());
|
|
1047
|
+
const verify = (batch) => verifyChecks(checks.values(), batch);
|
|
1014
1048
|
const canVerifyAtExecution = () => {
|
|
1015
1049
|
const prepared = deployments[0];
|
|
1016
1050
|
if (!prepared || deployments.length !== 1 || plans.length !== 1 || plans[0] !== prepared.plan || blockedReceipts.length
|
|
@@ -1021,13 +1055,37 @@ export class PlatformRebuildSession {
|
|
|
1021
1055
|
&& driverState.before.package === 'absent' && driverState.before.ownership === 'absent'
|
|
1022
1056
|
&& plan.evidence.sharedReferences === 'none' && plan.evidence.ownership.every((item) => item.state === 'absent')
|
|
1023
1057
|
&& plan.effects.every((effect) => ['publish-package', 'register'].includes(effect.kind));
|
|
1024
|
-
|
|
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))
|
|
1025
1060
|
&& plan.binding.platform === target.identity.platform && plan.expected.components.length > 0 && !plan.expected.unmet.length
|
|
1026
1061
|
&& driverState.before.package !== 'unknown' && (driverState.before.registration !== 'unknown' || hiddenEmptyPiProject)
|
|
1027
1062
|
&& ['absent', 'aw', 'shared'].includes(driverState.before.ownership)
|
|
1028
1063
|
&& plan.effects.every((effect) => ['publish-package', 'register', 'refresh', 'activate'].includes(effect.kind));
|
|
1029
1064
|
};
|
|
1030
|
-
|
|
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),
|
|
1031
1089
|
canVerifyAtExecution,
|
|
1032
1090
|
captureNativeToolChanges: async () => {
|
|
1033
1091
|
const signature = artifactValueDigest(deployments.map(({ plan }) => ({ bindingId: plan.binding.id,
|
|
@@ -1058,14 +1116,15 @@ export class PlatformRebuildSession {
|
|
|
1058
1116
|
if (!['ensure', 'reinstall'].includes(plan.operation) || !plan.expected.components.length)
|
|
1059
1117
|
continue;
|
|
1060
1118
|
const receipt = receipts.find((entry) => entry.bindingId === plan.binding.id);
|
|
1061
|
-
if (!receipt)
|
|
1119
|
+
if (!receipt || options?.deliveredSkillsOnly && plan.evidence.retainPackage)
|
|
1062
1120
|
continue;
|
|
1063
1121
|
const after = options?.refresh ? await adapter.inspect(ctx, plan.binding) : receipt.after;
|
|
1064
|
-
const supplementFiles =
|
|
1065
|
-
.filter((contribution) => contribution.kind === 'owned-file'));
|
|
1122
|
+
const supplementFiles = componentSupplementFiles(plan);
|
|
1066
1123
|
const supplementIds = new Set(supplementFiles.flatMap((contribution) => contribution.componentIds));
|
|
1067
|
-
|
|
1068
|
-
|
|
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
|
+
}
|
|
1069
1128
|
if (options?.refresh) {
|
|
1070
1129
|
receipt.after = after;
|
|
1071
1130
|
receipt.diagnostics.push(...after.diagnostics);
|
|
@@ -1074,15 +1133,50 @@ export class PlatformRebuildSession {
|
|
|
1074
1133
|
.flatMap((projection) => projection.components.map((component) => component.id)));
|
|
1075
1134
|
const bundle = plan.projections.find((projection) => projection.bundle)?.bundle;
|
|
1076
1135
|
const requiredActivation = requiredDeploymentActivation(plan.binding, after, requireIndependentActivation);
|
|
1077
|
-
if (!requireIndependentActivation && requiredActivation === 'enabled') {
|
|
1136
|
+
if (!options?.deliveredSkillsOnly && !requireIndependentActivation && requiredActivation === 'enabled') {
|
|
1078
1137
|
receipt.diagnostics = receipt.diagnostics.filter((entry) => entry.code !== 'codexProjectActivationUnconfirmed');
|
|
1079
1138
|
}
|
|
1080
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');
|
|
1081
1142
|
const packageIncomplete = bundle && (!packageDeliveryConfirmed(plan.binding, after, bundle.contentDigest, requireIndependentActivation)
|
|
1082
|
-
||
|
|
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));
|
|
1083
1147
|
const delivered = new Set(after.components.filter((component) => component.presence === 'present' && !component.reasonCodes.length)
|
|
1084
1148
|
.map((component) => component.id));
|
|
1085
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;
|
|
1086
1180
|
const inputDigest = supplementInputDigests.get(plan.binding.id);
|
|
1087
1181
|
if (inputDigest && [...supplementIds].every((id) => delivered.has(id))
|
|
1088
1182
|
&& !receipt.unmet.length && !receipt.diagnostics.some((diagnostic) => diagnostic.severity === 'error')) {
|
|
@@ -1110,15 +1204,13 @@ export class PlatformRebuildSession {
|
|
|
1110
1204
|
? 'codexProjectActivationUnconfirmed'
|
|
1111
1205
|
: nativeContentIncomplete ? 'nativeInstallContentPostcheckFailed' : 'deploymentPostcheckFailed';
|
|
1112
1206
|
receipt.diagnostics.push({ code, severity: 'error',
|
|
1113
|
-
message: code === 'nativeInstallContentPostcheckFailed'
|
|
1114
|
-
?
|
|
1115
|
-
: code === '
|
|
1116
|
-
? '
|
|
1117
|
-
: code === '
|
|
1118
|
-
? '
|
|
1119
|
-
:
|
|
1120
|
-
? 'Codex reports effective activation but does not distinguish this project from User inheritance.'
|
|
1121
|
-
: '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.',
|
|
1122
1214
|
subject: { target: plan.binding.platform, pluginId: plan.binding.plugin.pluginId, scope: plan.binding.scope.kind } });
|
|
1123
1215
|
receipt.unmet.push(...gaps.map((component) => ({ id: `postcheck:${plan.binding.id}:${component.id}`,
|
|
1124
1216
|
componentId: component.id, kind: component.kind, reasonCode: code, requiredFeatures: [],
|
|
@@ -1140,22 +1232,21 @@ export class PlatformRebuildSession {
|
|
|
1140
1232
|
cleanupResults.length = 0;
|
|
1141
1233
|
const receipts = [...blockedReceipts];
|
|
1142
1234
|
for (const prepared of deployments) {
|
|
1235
|
+
const supplementFiles = componentSupplementFiles(prepared.plan);
|
|
1236
|
+
const writtenFiles = new Map();
|
|
1143
1237
|
const commandPreparationFailed = prepared.plan.binding.renderUnitIds.some((unitId) => preparedUnits.get(unitId)?.finalized.producerResolutions
|
|
1144
1238
|
.some((resolution) => resolution.state === 'failed' || resolution.state === 'unmet'));
|
|
1145
1239
|
let receipt;
|
|
1146
|
-
const
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
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);
|
|
1151
1246
|
try {
|
|
1152
|
-
receipt = await adapter.lifecycle.execute({ ...
|
|
1247
|
+
receipt = await adapter.lifecycle.execute({ ...ctx, nativeEffects: this.nativeEffects, inspect: (binding) => adapter.inspect(ctx, binding), services: {
|
|
1153
1248
|
...nativeServices,
|
|
1154
1249
|
registerMarketplace: async (binding, identity) => {
|
|
1155
|
-
const peers = binding.route === 'codex-marketplace' ? [...this.mutableChecks.values()].filter((check) => check.physicalKey !== binding.physicalKey && check.marketplaceRoot === prepared.plan.evidence.layout.marketplaceRoot
|
|
1156
|
-
&& check.sourceId === binding.plugin.sourceId && check.sourceIdentity === binding.plugin.sourceIdentity) : [];
|
|
1157
|
-
for (const peer of peers)
|
|
1158
|
-
await peer.assertStable();
|
|
1159
1250
|
const outcome = await nativeServices.registerMarketplace(binding, identity);
|
|
1160
1251
|
if (outcome.mutation === 'confirmed') {
|
|
1161
1252
|
ctx.codexObservationSession?.invalidate(prepared.plan.evidence.layout.marketplaceName ?? undefined);
|
|
@@ -1180,7 +1271,7 @@ export class PlatformRebuildSession {
|
|
|
1180
1271
|
inputDigest: inputDigests.get(prepared.plan.binding.id), contentDigest: bundle.contentDigest,
|
|
1181
1272
|
preparation: prepared.plan.expected.unmet.length || commandPreparationFailed ? 'partial' : 'complete',
|
|
1182
1273
|
physicalIdentity: (await getDeploymentLayout(ctx, prepared.plan.binding)).physicalIdentity,
|
|
1183
|
-
});
|
|
1274
|
+
}, stagedPackage);
|
|
1184
1275
|
this.published.set(prepared.plan.binding.physicalKey, publication);
|
|
1185
1276
|
}
|
|
1186
1277
|
return publication;
|
|
@@ -1190,7 +1281,12 @@ export class PlatformRebuildSession {
|
|
|
1190
1281
|
if (component.kind === 'owned-directory')
|
|
1191
1282
|
return publishDirectory(contribution.stagingPath, component);
|
|
1192
1283
|
if (component.kind === 'owned-text-file') {
|
|
1193
|
-
|
|
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
|
+
}
|
|
1194
1290
|
}
|
|
1195
1291
|
else if (component.kind === 'shared-config' && component.locator.kind === 'cursor-workspace-hook') {
|
|
1196
1292
|
const locator = component.locator;
|
|
@@ -1224,7 +1320,7 @@ export class PlatformRebuildSession {
|
|
|
1224
1320
|
} }, prepared);
|
|
1225
1321
|
}
|
|
1226
1322
|
catch (error) {
|
|
1227
|
-
const diagnostic = { code: 'platformExecutionFailed', severity: 'error',
|
|
1323
|
+
const diagnostic = { code: recoveryInterruptionCode(error) ?? 'platformExecutionFailed', severity: 'error',
|
|
1228
1324
|
message: error instanceof Error ? error.message : String(error),
|
|
1229
1325
|
subject: { target: prepared.plan.binding.platform, pluginId: prepared.plan.binding.plugin.pluginId, scope: prepared.plan.binding.scope.kind } };
|
|
1230
1326
|
receipt = { bindingId: prepared.plan.binding.id, effects: prepared.plan.effects.map((effect) => ({
|
|
@@ -1234,6 +1330,8 @@ export class PlatformRebuildSession {
|
|
|
1234
1330
|
unmet: [], reload: 'unknown', diagnostics: [diagnostic] };
|
|
1235
1331
|
}
|
|
1236
1332
|
receipts.push(receipt);
|
|
1333
|
+
if (receipt.diagnostics.some(({ code }) => code === 'processCleanupUnconfirmed'))
|
|
1334
|
+
return receipts;
|
|
1237
1335
|
if ((prepared.plan.operation === 'remove' || prepared.plan.operation === 'cleanup'
|
|
1238
1336
|
|| prepared.plan.expected.components.length === 0 && prepared.plan.expected.unmet.length === 0)
|
|
1239
1337
|
&& prepared.plan.evidence.sharedReferences !== 'none' && receipt.after.package === 'present') {
|
|
@@ -1255,9 +1353,14 @@ export class PlatformRebuildSession {
|
|
|
1255
1353
|
try {
|
|
1256
1354
|
if (receipt.effects.some((effect) => effect.mutation !== 'none')) {
|
|
1257
1355
|
for (const [bindingId, check] of this.mutableChecks)
|
|
1258
|
-
if (check.physicalKey === prepared.plan.binding.physicalKey
|
|
1259
|
-
|
|
1260
|
-
|
|
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
|
+
}
|
|
1261
1364
|
if (bindingId === receipt.bindingId && prepared.plan.binding.route === 'copilot-marketplace'
|
|
1262
1365
|
&& publication?.mutation === 'confirmed') {
|
|
1263
1366
|
recheckCopilotMarketplaceTimeout(receipt, fresh);
|
|
@@ -1266,7 +1369,7 @@ export class PlatformRebuildSession {
|
|
|
1266
1369
|
}
|
|
1267
1370
|
}
|
|
1268
1371
|
catch (error) {
|
|
1269
|
-
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),
|
|
1270
1373
|
subject: { target: prepared.plan.binding.platform, pluginId: prepared.plan.binding.plugin.pluginId, scope: prepared.plan.binding.scope.kind } });
|
|
1271
1374
|
continue;
|
|
1272
1375
|
}
|
|
@@ -1319,7 +1422,7 @@ export class PlatformRebuildSession {
|
|
|
1319
1422
|
|| receipt.after.package === 'absent' && receipt.after.registration === 'not-applicable'
|
|
1320
1423
|
|| receipt.after.scopeRegistration === 'absent'
|
|
1321
1424
|
|| prepared.plan.binding.scope.kind === 'project'
|
|
1322
|
-
&& ['codex-marketplace', '
|
|
1425
|
+
&& ['codex-marketplace', 'copilot-marketplace'].includes(prepared.plan.binding.route)
|
|
1323
1426
|
&& receipt.after.configuration?.activation === 'absent'
|
|
1324
1427
|
|| receipt.after.consumers.every((consumer) => ['disabled', 'not-applicable'].includes(consumer.activation));
|
|
1325
1428
|
if (emptyState && !prepared.plan.expected.components.length && !receipt.unmet.length
|