@lesliechan721/aw 0.1.0-beta.74 → 0.1.0-beta.75
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/src/commands/public-lifecycle-result.d.ts +1 -1
- package/dist/src/commands/public-lifecycle-result.js +6 -0
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/commands/public-plugin-query.js +1 -2
- package/dist/src/commands/public-plugin-query.js.map +1 -1
- package/dist/src/commands/rebuild-command.js +4 -2
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +1 -0
- package/dist/src/commands/rebuild-platform-integration.js +89 -25
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/output/public-result.js +12 -0
- package/dist/src/output/public-result.js.map +1 -1
- package/dist/src/platforms/contracts.d.ts +13 -0
- package/dist/src/platforms/discovery.d.ts +7 -1
- package/dist/src/platforms/discovery.js +33 -11
- package/dist/src/platforms/discovery.js.map +1 -1
- package/dist/src/platforms/inspection-grok.js +100 -69
- package/dist/src/platforms/inspection-grok.js.map +1 -1
- package/dist/src/platforms/inspection-native.js +171 -149
- package/dist/src/platforms/inspection-native.js.map +1 -1
- package/dist/src/platforms/inspection-opencode.d.ts +4 -0
- package/dist/src/platforms/inspection-opencode.js +97 -0
- package/dist/src/platforms/inspection-opencode.js.map +1 -0
- package/dist/src/platforms/inspection-pi.d.ts +0 -1
- package/dist/src/platforms/inspection-pi.js +98 -23
- package/dist/src/platforms/inspection-pi.js.map +1 -1
- package/dist/src/platforms/inspection-query.d.ts +5 -0
- package/dist/src/platforms/inspection-query.js +36 -0
- package/dist/src/platforms/inspection-query.js.map +1 -0
- package/dist/src/platforms/inspection.js +15 -24
- package/dist/src/platforms/inspection.js.map +1 -1
- package/dist/src/platforms/lifecycle-native.d.ts +5 -1
- package/dist/src/platforms/lifecycle-native.js +28 -4
- package/dist/src/platforms/lifecycle-native.js.map +1 -1
- package/dist/src/platforms/lifecycle.js +29 -11
- package/dist/src/platforms/lifecycle.js.map +1 -1
- package/dist/src/recovery/joint-demand.js +10 -2
- package/dist/src/recovery/joint-demand.js.map +1 -1
- package/dist/src/recovery/retirement.js +13 -4
- package/dist/src/recovery/retirement.js.map +1 -1
- package/dist/src/recovery/status.js +5 -1
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/tui/deployment-view.js +12 -0
- package/dist/src/tui/deployment-view.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +4 -0
- package/dist/src/utils/native-cli.js +6 -0
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/plugin-scripts.d.ts +4 -0
- package/dist/src/utils/plugin-scripts.js +11 -0
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/package.json +3 -3
|
@@ -42,6 +42,7 @@ export declare class PlatformRebuildSession {
|
|
|
42
42
|
updateContext(context: RebuildExecutionContext): void;
|
|
43
43
|
setOwnershipExecutor(executor: OwnedComponentExecutor): void;
|
|
44
44
|
private root;
|
|
45
|
+
private nativeReadContext;
|
|
45
46
|
dispose(): Promise<void>;
|
|
46
47
|
freezeMarketplaceCandidates(): void;
|
|
47
48
|
private key;
|
|
@@ -7,7 +7,7 @@ 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 } from '../platforms/inspection.js';
|
|
10
|
-
import { nativeRoute } from '../platforms/lifecycle-native.js';
|
|
10
|
+
import { nativeRoute, piProjectRegistrationHidden, piProjectRemovalConfirmed } from '../platforms/lifecycle-native.js';
|
|
11
11
|
import { createNativeLifecycleServices } from '../platforms/lifecycle-native-services.js';
|
|
12
12
|
import { assertGeminiProjectRules, geminiActivationEvidence, geminiActivationRules, geminiExtensionPaths, geminiScopePattern, geminiUserActivation, readGeminiActivationSnapshot } from '../platforms/gemini-activation.js';
|
|
13
13
|
import { cursorWorkspaceOpenCommand } from '../platforms/projection.js';
|
|
@@ -313,8 +313,8 @@ async function sharedReferences(context, binding, observation, layout) {
|
|
|
313
313
|
}
|
|
314
314
|
// These routes do not expose a complete global activation inventory. An absent
|
|
315
315
|
// registration is sufficient for orphan payload cleanup; otherwise keep it.
|
|
316
|
-
return observation.registration === 'absent' &&
|
|
317
|
-
&& view
|
|
316
|
+
return observation.registration === 'absent' && view?.desiredComplete === true
|
|
317
|
+
&& view.scopes.includes('user') && view.scopes.includes('project') ? 'none' : 'unknown';
|
|
318
318
|
}
|
|
319
319
|
export class PlatformRebuildSession {
|
|
320
320
|
context;
|
|
@@ -344,6 +344,23 @@ export class PlatformRebuildSession {
|
|
|
344
344
|
}
|
|
345
345
|
setOwnershipExecutor(executor) { this.ownership = executor; }
|
|
346
346
|
root() { return this.staging ??= fs.mkdtemp(path.join(os.tmpdir(), 'aw-deployment-')); }
|
|
347
|
+
nativeReadContext(input) {
|
|
348
|
+
const ctx = readContext(this.context, input.cwd);
|
|
349
|
+
if (input.platform === 'gemini')
|
|
350
|
+
ctx.nativeNodeCompileCacheDir = async () => {
|
|
351
|
+
const pending = this.root();
|
|
352
|
+
try {
|
|
353
|
+
return path.join(await pending, 'native-node-compile-cache');
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
// An optional cache allocation must not poison later required staging.
|
|
357
|
+
if (this.staging === pending)
|
|
358
|
+
this.staging = undefined;
|
|
359
|
+
throw error;
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
return ctx;
|
|
363
|
+
}
|
|
347
364
|
async dispose() {
|
|
348
365
|
for (const result of await Promise.allSettled(this.units.values()))
|
|
349
366
|
if (result.status === 'fulfilled')
|
|
@@ -375,7 +392,7 @@ export class PlatformRebuildSession {
|
|
|
375
392
|
if (!result) {
|
|
376
393
|
result = (async () => {
|
|
377
394
|
const adapter = this.adapterFor(input.platform);
|
|
378
|
-
const ctx =
|
|
395
|
+
const ctx = this.nativeReadContext(input);
|
|
379
396
|
const plugin = sourceIdentity(input);
|
|
380
397
|
const recoveryCandidates = (this.context.recoveryCandidates ?? []).filter((candidate) => candidate.binding.platform === input.platform
|
|
381
398
|
&& candidate.binding.plugin.sourceIdentity === plugin.sourceIdentity && candidate.binding.plugin.pluginId === plugin.pluginId
|
|
@@ -562,21 +579,25 @@ export class PlatformRebuildSession {
|
|
|
562
579
|
if (input.readOnlyInspectionPlan)
|
|
563
580
|
return this.build(input);
|
|
564
581
|
const key = this.key(input);
|
|
582
|
+
let verifyInitial;
|
|
565
583
|
let target = this.targets.get(key);
|
|
566
584
|
if (!target) {
|
|
567
|
-
target = this.build(input);
|
|
585
|
+
target = this.build(input, (check) => { verifyInitial = check; });
|
|
568
586
|
this.targets.set(key, target);
|
|
569
587
|
}
|
|
570
588
|
const result = await target;
|
|
571
|
-
|
|
589
|
+
if (verifyInitial)
|
|
590
|
+
await verifyInitial();
|
|
591
|
+
else
|
|
592
|
+
await result.platformDeployment?.verify();
|
|
572
593
|
return result;
|
|
573
594
|
}
|
|
574
|
-
async build(input) {
|
|
595
|
+
async build(input, receiveInitialVerifier) {
|
|
575
596
|
const resolution = await this.resolve(input);
|
|
576
597
|
if (!resolution.bindings.length)
|
|
577
598
|
throw Object.assign(new Error(`platformUnavailable: ${resolution.exclusions.map((item) => item.reasonCode).join(', ') || input.platform}`), { deploymentExclusions: this.exclusions.get(this.key(input)) ?? [] });
|
|
578
599
|
const adapter = this.adapterFor(input.platform);
|
|
579
|
-
const ctx =
|
|
600
|
+
const ctx = this.nativeReadContext(input);
|
|
580
601
|
this.contexts.add(ctx);
|
|
581
602
|
const observed = await Promise.all(resolution.bindings.map(async (binding) => ({ binding, observation: await adapter.inspect(ctx, binding), layout: await getDeploymentLayout(ctx, binding) })));
|
|
582
603
|
if (input.readOnlyInspectionPlan && !input.readOnlyShallowInspectionPlan)
|
|
@@ -640,6 +661,7 @@ export class PlatformRebuildSession {
|
|
|
640
661
|
const blockedReceipts = [];
|
|
641
662
|
const cleanupResults = [];
|
|
642
663
|
const checks = new Map();
|
|
664
|
+
let initialDiscoveryCheck;
|
|
643
665
|
const priorProducers = new Map();
|
|
644
666
|
const priorResourceRoots = new Map();
|
|
645
667
|
const bindingRecoveryEvidence = [];
|
|
@@ -746,10 +768,10 @@ export class PlatformRebuildSession {
|
|
|
746
768
|
ownership: await inspectOwnedComponents({ components: [component], executor: this.ownership }), contentDigest: await ownedContentDigest(component),
|
|
747
769
|
})) };
|
|
748
770
|
};
|
|
749
|
-
const fingerprintParts = async () => ({
|
|
771
|
+
const fingerprintParts = async (discovery) => ({
|
|
750
772
|
managedCommandReview,
|
|
751
773
|
source: removing ? null : await pathEvidence(input.plugin.rootDir),
|
|
752
|
-
discovery: 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),
|
|
774
|
+
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),
|
|
753
775
|
sharedReferenceView: this.context.sharedReferenceView,
|
|
754
776
|
layout: await getDeploymentLayout(ctx, entry.binding),
|
|
755
777
|
config: await Promise.all(units.map((unit) => resolveArtifactRenderConfig({ ...sourceIdentity(input), pluginName: input.plugin.manifest.name,
|
|
@@ -760,26 +782,26 @@ export class PlatformRebuildSession {
|
|
|
760
782
|
supplements: await Promise.all(projection.supplements.map((contribution) => pathEvidence(contribution.stagingPath))),
|
|
761
783
|
}))),
|
|
762
784
|
});
|
|
763
|
-
//
|
|
785
|
+
// Discovery and inspection are independent reads for these routes. Settle
|
|
764
786
|
// both before comparing or throwing, while preserving immutable priority.
|
|
765
|
-
const parallelNativeReads =
|
|
787
|
+
const parallelNativeReads = ['gemini-extension', 'copilot-marketplace', 'pi-package'].includes(entry.binding.route);
|
|
766
788
|
const initialReads = parallelNativeReads
|
|
767
789
|
? await Promise.allSettled([fingerprintParts(), currentMutable()]) : null;
|
|
768
790
|
if (initialReads?.[0].status === 'rejected')
|
|
769
791
|
throw initialReads[0].reason;
|
|
770
792
|
const initialParts = initialReads?.[0].status === 'fulfilled' ? initialReads[0].value : await fingerprintParts();
|
|
771
793
|
const initial = artifactValueDigest(initialParts);
|
|
772
|
-
const fingerprint = async () => artifactValueDigest(await fingerprintParts());
|
|
794
|
+
const fingerprint = async (discovery) => artifactValueDigest(await fingerprintParts(discovery));
|
|
773
795
|
if (initialReads?.[1].status === 'rejected')
|
|
774
796
|
throw initialReads[1].reason;
|
|
775
797
|
let mutableBaseline = initialReads?.[1].status === 'fulfilled' ? initialReads[1].value : await currentMutable();
|
|
776
798
|
const preparationObservation = entry.binding.route === 'gemini-extension' || entry.binding.route === 'antigravity-cli'
|
|
777
799
|
? mutableBaseline.observation : entry.observation;
|
|
778
|
-
|
|
800
|
+
const check = async (discovery) => {
|
|
779
801
|
if (!parallelNativeReads)
|
|
780
|
-
return await fingerprint() === initial
|
|
802
|
+
return await fingerprint(discovery) === initial
|
|
781
803
|
&& artifactValueDigest(await currentMutable()) === artifactValueDigest(mutableBaseline);
|
|
782
|
-
const [immutableRead, mutableRead] = await Promise.allSettled([fingerprint(), currentMutable()]);
|
|
804
|
+
const [immutableRead, mutableRead] = await Promise.allSettled([fingerprint(discovery), currentMutable()]);
|
|
783
805
|
if (immutableRead.status === 'rejected')
|
|
784
806
|
throw immutableRead.reason;
|
|
785
807
|
if (immutableRead.value !== initial)
|
|
@@ -787,7 +809,11 @@ export class PlatformRebuildSession {
|
|
|
787
809
|
if (mutableRead.status === 'rejected')
|
|
788
810
|
throw mutableRead.reason;
|
|
789
811
|
return artifactValueDigest(mutableRead.value) === artifactValueDigest(mutableBaseline);
|
|
790
|
-
}
|
|
812
|
+
};
|
|
813
|
+
checks.set(entry.binding.id, () => check());
|
|
814
|
+
if (resolution.bindings.length === 1 && ['gemini-extension', 'pi-package'].includes(entry.binding.route)) {
|
|
815
|
+
initialDiscoveryCheck = () => check({ value: initialParts.discovery });
|
|
816
|
+
}
|
|
791
817
|
this.mutableChecks.set(entry.binding.id, { physicalKey: entry.binding.physicalKey,
|
|
792
818
|
marketplaceRoot: entry.layout.marketplaceRoot, sourceId: entry.binding.plugin.sourceId,
|
|
793
819
|
sourceIdentity: entry.binding.plugin.sourceIdentity,
|
|
@@ -804,7 +830,15 @@ export class PlatformRebuildSession {
|
|
|
804
830
|
registration: mutableBaseline.observation.registration } };
|
|
805
831
|
const onlyRegistration = mutableBaseline.observation.registration === 'absent' && current.observation.registration === 'present'
|
|
806
832
|
&& artifactValueDigest(withoutRegistration) === artifactValueDigest(mutableBaseline);
|
|
807
|
-
|
|
833
|
+
const onlyMarketplace = ['codex-marketplace', 'claude-marketplace'].includes(entry.binding.route)
|
|
834
|
+
&& current.observation.configuration?.marketplace === 'canonical'
|
|
835
|
+
&& mutableBaseline.observation.configuration?.marketplace === 'absent'
|
|
836
|
+
&& (current.observation.registration === mutableBaseline.observation.registration
|
|
837
|
+
|| mutableBaseline.observation.registration === 'absent' && current.observation.registration === 'present')
|
|
838
|
+
&& artifactValueDigest({ ...withoutRegistration, observation: { ...withoutRegistration.observation,
|
|
839
|
+
configuration: { ...current.observation.configuration, marketplace: mutableBaseline.observation.configuration.marketplace },
|
|
840
|
+
} }) === artifactValueDigest(mutableBaseline);
|
|
841
|
+
if ((!onlyRegistration && !onlyMarketplace) || await fingerprint() !== initial) {
|
|
808
842
|
throw new Error('operationPlanStale: deployment evidence changed during source registration.');
|
|
809
843
|
}
|
|
810
844
|
// This is the one shared observation changed by our confirmed source
|
|
@@ -906,23 +940,28 @@ export class PlatformRebuildSession {
|
|
|
906
940
|
target.ownedComponents = plans.flatMap((plan) => plan.evidence.ownership.map((item) => item.component));
|
|
907
941
|
target.desiredOwnedComponents = target.ownedComponents;
|
|
908
942
|
let frozenNativeTools;
|
|
909
|
-
const
|
|
910
|
-
for (const check of
|
|
943
|
+
const verifyChecks = async (selected) => {
|
|
944
|
+
for (const check of selected)
|
|
911
945
|
if (!await check())
|
|
912
946
|
throw new Error('operationPlanStale: deployment evidence changed.');
|
|
913
947
|
for (const plan of plans)
|
|
914
948
|
if (!await this.verifyMarketplace(plan))
|
|
915
949
|
throw new Error('operationPlanStale: marketplace evidence changed.');
|
|
916
950
|
};
|
|
951
|
+
const verify = () => verifyChecks(checks.values());
|
|
917
952
|
const canVerifyAtExecution = () => {
|
|
918
953
|
const prepared = deployments[0];
|
|
919
954
|
if (!prepared || deployments.length !== 1 || plans.length !== 1 || plans[0] !== prepared.plan || blockedReceipts.length
|
|
920
955
|
|| target.operationActions === undefined || target.operationActions.some((action) => action.kind === 'runPreApply' || action.kind === 'syncManagedCommandPackage'))
|
|
921
956
|
return false;
|
|
922
957
|
const { plan, driverState } = prepared;
|
|
923
|
-
|
|
958
|
+
const hiddenEmptyPiProject = piProjectRegistrationHidden(plan.binding, driverState.before)
|
|
959
|
+
&& driverState.before.package === 'absent' && driverState.before.ownership === 'absent'
|
|
960
|
+
&& plan.evidence.sharedReferences === 'none' && plan.evidence.ownership.every((item) => item.state === 'absent')
|
|
961
|
+
&& plan.effects.every((effect) => ['publish-package', 'register'].includes(effect.kind));
|
|
962
|
+
return plan.operation === 'ensure' && ['gemini-extension', 'copilot-marketplace', 'pi-package'].includes(plan.binding.route)
|
|
924
963
|
&& plan.binding.platform === target.identity.platform && plan.expected.components.length > 0 && !plan.expected.unmet.length
|
|
925
|
-
&& driverState.before.package !== 'unknown' && driverState.before.registration !== 'unknown'
|
|
964
|
+
&& driverState.before.package !== 'unknown' && (driverState.before.registration !== 'unknown' || hiddenEmptyPiProject)
|
|
926
965
|
&& ['absent', 'aw', 'shared'].includes(driverState.before.ownership)
|
|
927
966
|
&& plan.effects.every((effect) => ['publish-package', 'register', 'refresh', 'activate'].includes(effect.kind));
|
|
928
967
|
};
|
|
@@ -973,7 +1012,9 @@ export class PlatformRebuildSession {
|
|
|
973
1012
|
const packageIncomplete = packageIds.size > 0 && (after.package !== 'present' || !['aw', 'shared'].includes(after.ownership)
|
|
974
1013
|
|| nativeContentIncomplete
|
|
975
1014
|
|| nativeRoute(plan.binding.route) && (after.registration !== 'present'
|
|
976
|
-
|| after.consumers.some((consumer) => consumer.activation !== 'enabled')
|
|
1015
|
+
|| plan.binding.route !== 'pi-package' && after.consumers.some((consumer) => consumer.activation !== 'enabled')
|
|
1016
|
+
|| plan.binding.route === 'claude-marketplace' && after.scopeRegistration !== undefined && after.scopeRegistration !== 'present'
|
|
1017
|
+
|| untrusted));
|
|
977
1018
|
const gaps = plan.expected.components.filter((component) => packageIncomplete && packageIds.has(component.id)
|
|
978
1019
|
|| !after.components.some((observed) => observed.id === component.id && observed.presence === 'present' && !observed.reasonCodes.length));
|
|
979
1020
|
receipt.diagnostics.push(...after.diagnostics);
|
|
@@ -1174,10 +1215,18 @@ export class PlatformRebuildSession {
|
|
|
1174
1215
|
}
|
|
1175
1216
|
}
|
|
1176
1217
|
const emptyState = emptyStates.get(prepared.plan.binding.id);
|
|
1218
|
+
const removedByCommand = piProjectRemovalConfirmed(prepared.plan, receipt);
|
|
1219
|
+
const inactiveScope = removedByCommand || receipt.after.registration === 'absent'
|
|
1220
|
+
|| receipt.after.package === 'absent' && receipt.after.registration === 'not-applicable'
|
|
1221
|
+
|| receipt.after.scopeRegistration === 'absent'
|
|
1222
|
+
|| prepared.plan.binding.scope.kind === 'project'
|
|
1223
|
+
&& ['codex-marketplace', 'gemini-extension', 'copilot-marketplace'].includes(prepared.plan.binding.route)
|
|
1224
|
+
&& receipt.after.configuration?.activation === 'absent'
|
|
1225
|
+
|| receipt.after.consumers.every((consumer) => ['disabled', 'not-applicable'].includes(consumer.activation));
|
|
1177
1226
|
if (emptyState && !receipt.unmet.length && !receipt.diagnostics.some((diagnostic) => diagnostic.severity === 'error')
|
|
1178
|
-
&& receipt.after.registration !== 'unknown' && receipt.after.package !== 'unknown'
|
|
1227
|
+
&& (receipt.after.registration !== 'unknown' || removedByCommand) && receipt.after.package !== 'unknown'
|
|
1179
1228
|
&& !['foreign', 'unknown'].includes(receipt.after.ownership)
|
|
1180
|
-
&&
|
|
1229
|
+
&& inactiveScope) {
|
|
1181
1230
|
const residual = await inspectOwnedComponents({ components: prepared.plan.evidence.ownership
|
|
1182
1231
|
.filter((slot) => !('path' in slot.component) || slot.component.path !== prepared.plan.evidence.layout.packageRoot)
|
|
1183
1232
|
.map((slot) => slot.component), executor: this.ownership });
|
|
@@ -1194,6 +1243,21 @@ export class PlatformRebuildSession {
|
|
|
1194
1243
|
return receipts;
|
|
1195
1244
|
},
|
|
1196
1245
|
};
|
|
1246
|
+
if (initialDiscoveryCheck) {
|
|
1247
|
+
const firstCheck = initialDiscoveryCheck;
|
|
1248
|
+
const canReuseDiscovery = () => this.targets.size === 1 && deployments.length === 1 && plans.length === 1
|
|
1249
|
+
&& plans[0] === deployments[0].plan && !blockedReceipts.length && plans[0].operation === 'ensure'
|
|
1250
|
+
&& plans[0].expected.components.length > 0 && !plans[0].expected.unmet.length;
|
|
1251
|
+
receiveInitialVerifier?.(async () => {
|
|
1252
|
+
if (!canReuseDiscovery())
|
|
1253
|
+
return verify();
|
|
1254
|
+
// Only this creator reuses the discovery captured after rendering.
|
|
1255
|
+
// Inspect still rereads all native facts and local copy/config evidence.
|
|
1256
|
+
await verifyChecks([firstCheck]);
|
|
1257
|
+
if (!canReuseDiscovery())
|
|
1258
|
+
await verify();
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1197
1261
|
return target;
|
|
1198
1262
|
}
|
|
1199
1263
|
}
|