@lesliechan721/aw 0.1.0-beta.94 → 0.1.0-beta.96
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/scripts/add-skill.mjs +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +2 -2
- package/dist/authoring/scripts/lib/skill-scaffold.d.mts +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +0 -10
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/scripts/aw-skill-eval-materializer.js +3 -2
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/scripts/bundle-plugins.js +10 -3
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.js +2 -1
- package/dist/scripts/plugin-staging.js.map +1 -1
- package/dist/scripts/plugin-test-context-guard.d.mts +1 -0
- package/dist/scripts/plugin-test-context-guard.mjs +59 -0
- package/dist/scripts/plugin-test-context-guard.mjs.map +1 -0
- package/dist/scripts/test-plugin-scripts.js +91 -45
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/scripts/test-workers.mjs +1 -1
- package/dist/scripts/test-workers.mjs.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +1 -0
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/permission-batch.d.ts +1 -1
- package/dist/src/commands/permission-batch.js +6 -3
- package/dist/src/commands/permission-batch.js.map +1 -1
- package/dist/src/commands/public-lifecycle-result.js +3 -2
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/commands/public-lifecycle.js +12 -8
- package/dist/src/commands/public-lifecycle.js.map +1 -1
- package/dist/src/commands/public-plugin-query.js +3 -2
- package/dist/src/commands/public-plugin-query.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +12 -0
- package/dist/src/commands/rebuild-command.js +78 -8
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +8 -5
- package/dist/src/commands/rebuild-integration.js +21 -7
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +16 -2
- package/dist/src/commands/rebuild-platform-integration.js +314 -23
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
- package/dist/src/commands/review-inspection.js +3 -2
- package/dist/src/commands/review-inspection.js.map +1 -1
- package/dist/src/generators/local-plugin.js +117 -37
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/platforms/contracts.d.ts +6 -0
- package/dist/src/platforms/discovery.js +20 -18
- package/dist/src/platforms/discovery.js.map +1 -1
- package/dist/src/platforms/inspection-grok.js +20 -6
- package/dist/src/platforms/inspection-grok.js.map +1 -1
- package/dist/src/platforms/inspection-native.js +9 -2
- package/dist/src/platforms/inspection-native.js.map +1 -1
- package/dist/src/platforms/inspection-query.d.ts +2 -0
- package/dist/src/platforms/inspection-query.js +20 -21
- package/dist/src/platforms/inspection-query.js.map +1 -1
- package/dist/src/platforms/read-only-retry-policy.d.ts +34 -0
- package/dist/src/platforms/read-only-retry-policy.js +70 -0
- package/dist/src/platforms/read-only-retry-policy.js.map +1 -0
- package/dist/src/portable/commands.d.ts +3 -1
- package/dist/src/portable/commands.js +11 -23
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/historical-materialization.d.ts +4 -1
- package/dist/src/portable/historical-materialization.js +35 -11
- package/dist/src/portable/historical-materialization.js.map +1 -1
- package/dist/src/portable/materializer.d.ts +17 -1
- package/dist/src/portable/materializer.js +99 -30
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery.d.ts +3 -2
- package/dist/src/portable/recovery.js +49 -8
- package/dist/src/portable/recovery.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +9 -2
- package/dist/src/recovery/coordinator.js +105 -39
- package/dist/src/recovery/coordinator.js.map +1 -1
- package/dist/src/recovery/joint-coordinator.d.ts +3 -3
- package/dist/src/recovery/joint-coordinator.js +402 -320
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/retirement.d.ts +2 -2
- package/dist/src/recovery/retirement.js +3 -3
- package/dist/src/recovery/retirement.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +2 -1
- package/dist/src/review/skill-materialization.js +2 -3
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +9 -2
- package/dist/src/utils/artifact-renderer.js +67 -31
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/bundle-layout.d.ts +2 -0
- package/dist/src/utils/bundle-layout.js +40 -13
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-generation-resolver.d.ts +9 -2
- package/dist/src/utils/catalog-generation-resolver.js +82 -10
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
- package/dist/src/utils/catalog-operation-context.d.ts +35 -2
- package/dist/src/utils/catalog-operation-context.js +155 -5
- package/dist/src/utils/catalog-operation-context.js.map +1 -1
- package/dist/src/utils/catalog-source-references.js +11 -4
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/codex-native-observation.js +8 -12
- package/dist/src/utils/codex-native-observation.js.map +1 -1
- package/dist/src/utils/codex-skills-root.js +5 -1
- package/dist/src/utils/codex-skills-root.js.map +1 -1
- package/dist/src/utils/component-resources.js +2 -3
- package/dist/src/utils/component-resources.js.map +1 -1
- package/dist/src/utils/multi-source-catalog.d.ts +2 -1
- package/dist/src/utils/multi-source-catalog.js +2 -1
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/runtime-skill-closure.d.ts +1 -1
- package/dist/src/utils/runtime-skill-closure.js +3 -1
- package/dist/src/utils/runtime-skill-closure.js.map +1 -1
- package/dist/src/utils/skill-validation.js +0 -5
- package/dist/src/utils/skill-validation.js.map +1 -1
- package/dist/vitest.config.js +3 -0
- package/dist/vitest.config.js.map +1 -1
- package/package.json +4 -3
|
@@ -2,6 +2,7 @@ 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 { getStaticTOMLValue, parseTOML } from 'toml-eslint-parser';
|
|
5
6
|
import { sealPermissionBatches } from './permission-batch.js';
|
|
6
7
|
import { COMMAND_ROUTE_UNREACHABLE, HOST_PERMISSION_ADDITIONAL_IMPACT, publicHostPermissionResource } from '../output/component-delivery.js';
|
|
7
8
|
import { createMarketplaceManifestEntry, getComponentFeatureRequirements, normalizeStaticPluginComponents } from '@lesliechan721/aw-plugin-core/manifest';
|
|
@@ -19,6 +20,8 @@ import { cursorWorkspaceOpenCommand } from '../platforms/projection.js';
|
|
|
19
20
|
import { grokProjectPermissionsAuthorized } from '../platforms/grok-permission-config.js';
|
|
20
21
|
import { isPermissionHost } from '../platforms/host-permission-policy.js';
|
|
21
22
|
import { hostPermissionFingerprint, missingPermissionOwnershipWarning, pendingRelatedProjectNotices, permissionComponent, permissionOwnerContentDigest, updateHostPermissions } from '../platforms/permission-ownership.js';
|
|
23
|
+
import { permissionFileFingerprint, readPermissionSidecar } from '../platforms/permission-sidecar.js';
|
|
24
|
+
import { canonicalizePathThroughExistingAncestor } from '../utils/state-paths.js';
|
|
22
25
|
import { cursorHookEntryCommand, cursorHooks } from '../platforms/cursor-workspace-hook.js';
|
|
23
26
|
import { gapSupplementFiles, ownedSupplementFile, staticSupplementFiles } from '../platforms/supplement-layout.js';
|
|
24
27
|
import { projectPlatformMarketplace } from '../platforms/projection-marketplace.js';
|
|
@@ -28,6 +31,7 @@ import { artifactValueDigest, mergeExpectedComponentSets } from '../utils/artifa
|
|
|
28
31
|
import { preparePlatformComponents, resolveArtifactRenderConfig } from '../utils/artifact-renderer.js';
|
|
29
32
|
import { skillAgentBinding } from '../utils/component-agent-binding.js';
|
|
30
33
|
import { finalizePlatformSkillProducers } from '../utils/component-command-preparation.js';
|
|
34
|
+
import { resolveStaticPlatformResourceRoot } from '../utils/component-resources.js';
|
|
31
35
|
import { cleanupOwnedComponents, createSharedOwnerToken, inspectOwnedComponents, renderOwnedTextFile, writeOwnedTextFile, writeSkillOwnerMarker } from '../utils/ownership.js';
|
|
32
36
|
import { createPlatformInputEvidence, platformPackageInputDigest, platformPermissionNotices, readPlatformPackageContentDigest, writePlatformEmptyState } from '../utils/platform-empty-state.js';
|
|
33
37
|
import { writePlatformSupplementState } from '../platforms/supplement-state.js';
|
|
@@ -103,6 +107,58 @@ export function nativeInstallResources(plans) {
|
|
|
103
107
|
...[...readPaths].filter((value) => !paths.has(value)).map((value) => ({ kind: 'path', value, access: 'read' })),
|
|
104
108
|
];
|
|
105
109
|
}
|
|
110
|
+
async function readOptionalUtf8(file) {
|
|
111
|
+
try {
|
|
112
|
+
const stat = await fs.lstat(file);
|
|
113
|
+
if (!stat.isFile() || stat.size > 1024 * 1024)
|
|
114
|
+
return null;
|
|
115
|
+
return await fs.readFile(file, 'utf8');
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (['ENOENT', 'ENOTDIR'].includes(error.code ?? ''))
|
|
119
|
+
return null;
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function isPlainRecord(value) {
|
|
124
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
125
|
+
}
|
|
126
|
+
function isGrokDisableConfigTransition(beforeText, afterText, packageName) {
|
|
127
|
+
if (afterText === null || beforeText === afterText)
|
|
128
|
+
return false;
|
|
129
|
+
try {
|
|
130
|
+
const beforeDoc = beforeText === null ? {} : getStaticTOMLValue(parseTOML(beforeText));
|
|
131
|
+
const afterDoc = getStaticTOMLValue(parseTOML(afterText));
|
|
132
|
+
if (!isPlainRecord(beforeDoc) || !isPlainRecord(afterDoc))
|
|
133
|
+
return false;
|
|
134
|
+
const { plugins: beforePluginsRaw, ...beforeRest } = beforeDoc;
|
|
135
|
+
const { plugins: afterPluginsRaw, ...afterRest } = afterDoc;
|
|
136
|
+
if (artifactValueDigest(beforeRest) !== artifactValueDigest(afterRest))
|
|
137
|
+
return false;
|
|
138
|
+
const beforePlugins = beforePluginsRaw === undefined ? {} : beforePluginsRaw;
|
|
139
|
+
const afterPlugins = afterPluginsRaw === undefined ? {} : afterPluginsRaw;
|
|
140
|
+
if (!isPlainRecord(beforePlugins) || !isPlainRecord(afterPlugins))
|
|
141
|
+
return false;
|
|
142
|
+
const { enabled: beforeEnabledRaw, disabled: beforeDisabledRaw, ...beforePluginRest } = beforePlugins;
|
|
143
|
+
const { enabled: afterEnabledRaw, disabled: afterDisabledRaw, ...afterPluginRest } = afterPlugins;
|
|
144
|
+
if (artifactValueDigest(beforePluginRest) !== artifactValueDigest(afterPluginRest))
|
|
145
|
+
return false;
|
|
146
|
+
const beforeEnabled = beforeEnabledRaw === undefined ? [] : beforeEnabledRaw;
|
|
147
|
+
const beforeDisabled = beforeDisabledRaw === undefined ? [] : beforeDisabledRaw;
|
|
148
|
+
const afterEnabled = afterEnabledRaw === undefined ? [] : afterEnabledRaw;
|
|
149
|
+
const afterDisabled = afterDisabledRaw === undefined ? [] : afterDisabledRaw;
|
|
150
|
+
if (![beforeEnabled, beforeDisabled, afterEnabled, afterDisabled].every((list) => Array.isArray(list) && list.every((entry) => typeof entry === 'string')))
|
|
151
|
+
return false;
|
|
152
|
+
const expectedEnabled = beforeEnabled.filter((name) => name !== packageName);
|
|
153
|
+
const expectedDisabled = beforeDisabled.includes(packageName)
|
|
154
|
+
? beforeDisabled : [...beforeDisabled, packageName];
|
|
155
|
+
return artifactValueDigest(afterEnabled) === artifactValueDigest(expectedEnabled)
|
|
156
|
+
&& artifactValueDigest(afterDisabled) === artifactValueDigest(expectedDisabled);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
106
162
|
function matchesGrokComponentOrder(before, after, publishedRoots) {
|
|
107
163
|
// Leave newly added or removed identities out of both sides. Every other
|
|
108
164
|
// row, including a surviving component of an upgraded package, anchors order.
|
|
@@ -203,12 +259,60 @@ function recheckCopilotMarketplaceTimeout(receipt, fresh) {
|
|
|
203
259
|
const [timeout] = diagnostics;
|
|
204
260
|
if (ownership !== 'unknown' || registration !== 'present' || diagnostics.length !== 1
|
|
205
261
|
|| timeout?.code !== 'nativeMarketplaceUnconfirmed' || timeout.detail?.reasonCode !== 'nativeCliTimedOut')
|
|
206
|
-
return;
|
|
262
|
+
return false;
|
|
207
263
|
// Keep the local owner, marketplace, registration and activation from the same
|
|
208
264
|
// read. Postcheck may annotate the receipt's components independently of rebase.
|
|
209
265
|
receipt.after = structuredClone(fresh);
|
|
210
266
|
receipt.diagnostics = receipt.diagnostics.filter((entry) => entry !== timeout);
|
|
211
267
|
receipt.diagnostics.push(...receipt.after.diagnostics);
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
function checkRetainedCopilotDeactivation(prepared, receipt, fresh) {
|
|
271
|
+
const { binding, operation, effects, evidence } = prepared.plan;
|
|
272
|
+
if (binding.route !== 'copilot-marketplace' || operation !== 'remove' || evidence.sharedReferences === 'none')
|
|
273
|
+
return;
|
|
274
|
+
const deactivate = effects.find((effect) => effect.kind === 'deactivate');
|
|
275
|
+
if (!deactivate)
|
|
276
|
+
return;
|
|
277
|
+
const outcome = receipt.effects.find((effect) => effect.id === deactivate.id);
|
|
278
|
+
const unchanged = outcome?.status === 'unchanged' && outcome.mutation === 'none';
|
|
279
|
+
if (!unchanged && !(outcome?.status === 'applied' && outcome.mutation === 'confirmed'))
|
|
280
|
+
return;
|
|
281
|
+
const disabled = (after) => after.physicalKey === binding.physicalKey
|
|
282
|
+
&& after.package === 'present' && after.registration === 'present' && after.copilotRegistration?.source === 'canonical'
|
|
283
|
+
&& after.configuration?.activation === 'disabled' && after.consumers.length > 0
|
|
284
|
+
&& after.consumers.every((consumer) => consumer.activationKey === deactivate.activationKey && consumer.activation === 'disabled'
|
|
285
|
+
&& binding.consumers.some((product) => product.id === consumer.productId && product.product === 'cli'));
|
|
286
|
+
const confirmed = (after) => disabled(after) && after.copilotRegistration?.marketplace === 'canonical'
|
|
287
|
+
&& ['aw', 'shared'].includes(after.ownership) && after.ownership === prepared.driverState.before.ownership;
|
|
288
|
+
const sourceConflict = (after) => after.ownership === 'foreign'
|
|
289
|
+
|| after.copilotRegistration?.source === 'foreign' || after.copilotRegistration?.marketplace === 'foreign';
|
|
290
|
+
const firstConflict = sourceConflict(receipt.after);
|
|
291
|
+
if (fresh) {
|
|
292
|
+
if (confirmed(fresh)) {
|
|
293
|
+
if (!unchanged && disabled(receipt.after) && recheckCopilotMarketplaceTimeout(receipt, fresh))
|
|
294
|
+
return;
|
|
295
|
+
if (confirmed(receipt.after)) {
|
|
296
|
+
receipt.after = structuredClone(fresh);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
// A healthy rebase cannot clear a different failure in the first read.
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
// Retain the first diagnostics alongside the latest independent observation.
|
|
303
|
+
receipt.after = structuredClone(fresh);
|
|
304
|
+
receipt.diagnostics.push(...fresh.diagnostics);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
else if (unchanged && confirmed(receipt.after))
|
|
308
|
+
return;
|
|
309
|
+
// Even if the more recent read fails, do not erase a confirmed source conflict.
|
|
310
|
+
const reasonCode = firstConflict || sourceConflict(receipt.after) ? 'deploymentOwnershipConflict'
|
|
311
|
+
: receipt.after.copilotRegistration?.source === 'unknown' ? 'nativeIdentityUnconfirmed' : undefined;
|
|
312
|
+
receipt.diagnostics.push({ code: 'nativeMutationPostcheckFailed', severity: 'error',
|
|
313
|
+
message: 'The retained Copilot package or its scoped deactivation could not be confirmed. Check status before retrying.',
|
|
314
|
+
subject: { target: binding.platform, pluginId: binding.plugin.pluginId, scope: binding.scope.kind },
|
|
315
|
+
...(reasonCode ? { detail: { reasonCode } } : {}) });
|
|
212
316
|
}
|
|
213
317
|
/** Fingerprints are operation-local evidence; they confer no ownership or deletion rights. */
|
|
214
318
|
async function pathEvidence(location) {
|
|
@@ -518,8 +622,36 @@ export class PlatformRebuildSession {
|
|
|
518
622
|
this.grokPermissionWrites.set(target, { previous: earlier && earlier.current === host.previous ? earlier.previous : host.previous, current: host.current });
|
|
519
623
|
}
|
|
520
624
|
}
|
|
625
|
+
async recordGrokDisableConfigWrite(configPath, beforeText, afterText) {
|
|
626
|
+
const prevDigest = beforeText === null ? null : crypto.createHash('sha256').update(beforeText).digest('hex');
|
|
627
|
+
const nextDigest = crypto.createHash('sha256').update(afterText).digest('hex');
|
|
628
|
+
if (prevDigest !== nextDigest) {
|
|
629
|
+
const earlier = this.grokPermissionWrites.get(configPath);
|
|
630
|
+
this.grokPermissionWrites.set(configPath, {
|
|
631
|
+
previous: earlier && earlier.current === prevDigest ? earlier.previous : prevDigest,
|
|
632
|
+
current: nextDigest,
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
const sidecar = await readPermissionSidecar(this.context.env, 'grok', configPath).catch(() => undefined);
|
|
636
|
+
if (sidecar && !sidecar.unreadable && sidecar.raw !== null) {
|
|
637
|
+
const previous = permissionFileFingerprint(beforeText, sidecar.raw);
|
|
638
|
+
const current = permissionFileFingerprint(afterText, sidecar.raw);
|
|
639
|
+
if (previous !== current) {
|
|
640
|
+
const last = this.permissionWrites.get(configPath);
|
|
641
|
+
this.permissionWrites.set(configPath, { previous: last?.current === previous ? last.previous : previous, current });
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
521
645
|
grokPublications = new Map();
|
|
522
646
|
grokProjectRetirements = new Map();
|
|
647
|
+
grokRemovals = new Map();
|
|
648
|
+
offlinePermissionRemovals = new Map();
|
|
649
|
+
recordOfflinePermissionRemoval(settingsPath, ownerKey) {
|
|
650
|
+
let owners = this.offlinePermissionRemovals.get(settingsPath);
|
|
651
|
+
if (!owners)
|
|
652
|
+
this.offlinePermissionRemovals.set(settingsPath, owners = new Set());
|
|
653
|
+
owners.add(ownerKey);
|
|
654
|
+
}
|
|
523
655
|
exclusions = new Map();
|
|
524
656
|
contexts = new Set();
|
|
525
657
|
mutableChecks = new Map();
|
|
@@ -620,6 +752,66 @@ export class PlatformRebuildSession {
|
|
|
620
752
|
}
|
|
621
753
|
}
|
|
622
754
|
}
|
|
755
|
+
recordGrokRemovals(prepared, receipt) {
|
|
756
|
+
const { binding, operation, evidence: { layout } } = prepared.plan;
|
|
757
|
+
const sources = receipt.after.prerequisites.nativeSources;
|
|
758
|
+
const evidence = sources?.grokScopeEvidence;
|
|
759
|
+
if (!['grok-cli', 'grok-directory'].includes(binding.route) || !['remove', 'cleanup'].includes(operation)
|
|
760
|
+
|| receipt.diagnostics.some((item) => item.severity === 'error')
|
|
761
|
+
|| receipt.effects.some((effect) => effect.mutation === 'possible' || ['failed', 'unknown', 'blocked', 'skipped'].includes(effect.status))
|
|
762
|
+
|| sources?.observation !== 'complete' || !evidence)
|
|
763
|
+
return;
|
|
764
|
+
const { before, removals } = prepared.driverState;
|
|
765
|
+
const priorSources = before.prerequisites.nativeSources;
|
|
766
|
+
const priorEvidence = priorSources?.grokScopeEvidence;
|
|
767
|
+
if (priorSources?.observation !== 'complete' || !priorEvidence)
|
|
768
|
+
return;
|
|
769
|
+
const scope = binding.scope.kind;
|
|
770
|
+
const scopeRoot = binding.scope.kind === 'project' ? binding.scope.projectRoot : layout.activationPath;
|
|
771
|
+
if (binding.route === 'grok-cli' && receipt.after.registration === 'absent') {
|
|
772
|
+
const registrationId = before.nativeIdentity?.registrationId;
|
|
773
|
+
const packageName = before.nativeIdentity?.packageId;
|
|
774
|
+
const unregistered = prepared.plan.effects.some((effect) => effect.kind === 'unregister'
|
|
775
|
+
&& receipt.effects.some((result) => result.id === effect.id && result.status === 'applied' && result.mutation === 'confirmed'));
|
|
776
|
+
if (unregistered && registrationId && packageName) {
|
|
777
|
+
const index = priorSources.sources.findIndex((source) => source.name === packageName && source.scope === 'user' && source.origin === 'native'
|
|
778
|
+
&& path.basename(source.path) === registrationId && path.basename(path.dirname(source.path)) === 'installed-plugins');
|
|
779
|
+
const priorNativeDigest = index >= 0 ? priorEvidence.sourceDigests[index] : undefined;
|
|
780
|
+
const installedRoot = index >= 0 ? path.normalize(priorSources.sources[index].path) : undefined;
|
|
781
|
+
if (installedRoot && priorNativeDigest && !sources.sources.some((source) => path.normalize(source.path) === installedRoot)) {
|
|
782
|
+
this.grokRemovals.set(installedRoot, {
|
|
783
|
+
kind: 'package', scope: 'user', scopeRoot, pluginId: binding.plugin.pluginId, packageName,
|
|
784
|
+
installedRoot, priorNativeDigest,
|
|
785
|
+
sourceOrderAfter: sources.sources.map((source) => path.normalize(source.path)),
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
if (layout.supplementRoot) {
|
|
791
|
+
for (const { effectId, component } of removals) {
|
|
792
|
+
if (component.kind !== 'owned-text-file')
|
|
793
|
+
continue;
|
|
794
|
+
const rulePath = path.normalize(component.path);
|
|
795
|
+
if (path.dirname(rulePath) !== layout.supplementRoot)
|
|
796
|
+
continue;
|
|
797
|
+
if (!receipt.effects.some((effect) => effect.id === effectId && effect.status === 'applied' && effect.mutation === 'confirmed'))
|
|
798
|
+
continue;
|
|
799
|
+
const priorRows = priorEvidence.instructions.filter((row) => row.rulePath === rulePath);
|
|
800
|
+
if (priorRows.length === 1 && !evidence.instructions.some((row) => row.rulePath === rulePath)) {
|
|
801
|
+
this.grokRemovals.set(rulePath, {
|
|
802
|
+
kind: 'rule', scope, scopeRoot, pluginId: binding.plugin.pluginId, rulePath,
|
|
803
|
+
priorInstructionDigest: priorRows[0].digest,
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
recordGrokOfflineRuleRemoval(removal) {
|
|
810
|
+
const rulePath = path.normalize(removal.rulePath);
|
|
811
|
+
if (!this.grokRemovals.has(rulePath)) {
|
|
812
|
+
this.grokRemovals.set(rulePath, { kind: 'rule', ...removal, rulePath });
|
|
813
|
+
}
|
|
814
|
+
}
|
|
623
815
|
recordGrokProjectRetirement(projectRoot, project, user, removed) {
|
|
624
816
|
const old = project.nativeIdentity;
|
|
625
817
|
const replacement = user.nativeIdentity;
|
|
@@ -660,6 +852,8 @@ export class PlatformRebuildSession {
|
|
|
660
852
|
this.exclusions.clear();
|
|
661
853
|
this.grokPublications.clear();
|
|
662
854
|
this.grokProjectRetirements.clear();
|
|
855
|
+
this.grokRemovals.clear();
|
|
856
|
+
this.offlinePermissionRemovals.clear();
|
|
663
857
|
this.contexts.clear();
|
|
664
858
|
this.mutableChecks.clear();
|
|
665
859
|
this.requestedOperations.clear();
|
|
@@ -766,7 +960,7 @@ export class PlatformRebuildSession {
|
|
|
766
960
|
this.marketplaceTargets.add(target);
|
|
767
961
|
targets = [...this.marketplaceTargets];
|
|
768
962
|
await this.freezeSharedPreApplyActions(targets);
|
|
769
|
-
await sealPermissionBatches(targets, (target) => readContext(this.context, target.identity.cwd), this.adapterFor);
|
|
963
|
+
await sealPermissionBatches(targets, (target) => readContext(this.context, target.identity.cwd), this.adapterFor, this.offlinePermissionRemovals);
|
|
770
964
|
const retained = new Map(targets.flatMap((target) => (target.platformDeployment?.plans ?? [])
|
|
771
965
|
.filter((plan) => plan.evidence.retainPackage).map((plan) => [plan.binding.physicalKey, plan.expected.unmet])));
|
|
772
966
|
for (const target of targets)
|
|
@@ -925,6 +1119,11 @@ export class PlatformRebuildSession {
|
|
|
925
1119
|
return result.prepared;
|
|
926
1120
|
}
|
|
927
1121
|
async build(input, receiveInitialVerifier) {
|
|
1122
|
+
const { command: pluginCommand, scripts } = input.plugin.manifest;
|
|
1123
|
+
const cursorPreviewBatch = input.platform === 'cursor'
|
|
1124
|
+
&& this.context.nativeObservationBatch?.initialInstallPreview === true
|
|
1125
|
+
&& pluginCommand?.mode !== 'dynamic' && !scripts?.artifacts?.render && !scripts?.preApply && !scripts?.node?.build
|
|
1126
|
+
? this.context.nativeObservationBatch : undefined;
|
|
928
1127
|
const confirmedCatalogRetirement = this.retirementMode(input);
|
|
929
1128
|
const ctx = readContext(this.context, input.cwd, confirmedCatalogRetirement);
|
|
930
1129
|
const ordinaryCtx = confirmedCatalogRetirement ? ctx : input.readOnlyInspectionPlan && input.observationBatch ? { ...ctx, ...input.observationBatch }
|
|
@@ -959,8 +1158,10 @@ export class PlatformRebuildSession {
|
|
|
959
1158
|
const unit = entry.layout.renderUnits.find((candidate) => candidate.output === 'supplement');
|
|
960
1159
|
if (!unit)
|
|
961
1160
|
continue;
|
|
962
|
-
const
|
|
963
|
-
|
|
1161
|
+
const staticResourceRoot = await resolveStaticPlatformResourceRoot(input.plugin.rootDir, input.platform);
|
|
1162
|
+
const expected = await normalizeStaticPluginComponents({ pluginRoot: input.plugin.rootDir, staticResourceRoot,
|
|
1163
|
+
manifest: input.plugin.manifest, platform: input.platform,
|
|
1164
|
+
capabilities: adapter.capabilities({ binding: entry.binding, renderUnit: unit,
|
|
964
1165
|
profile: getQualifiedPlatformProfile(input.platform) }), allowedOutputKinds: unit.kinds });
|
|
965
1166
|
const supplements = await inspectStaticSupplements(ctx, entry.binding, expected.components);
|
|
966
1167
|
entry.observation.components.push(...supplements.components);
|
|
@@ -999,8 +1200,7 @@ export class PlatformRebuildSession {
|
|
|
999
1200
|
pluginName: input.plugin.manifest.name, manifest: input.plugin.manifest, platform: input.platform,
|
|
1000
1201
|
scope: unit.renderScope.kind, cwd: unit.renderScope.kind === 'project' ? unit.renderScope.projectRoot : input.cwd,
|
|
1001
1202
|
env: this.context.env, referencePlugins: this.context.referencePlugins });
|
|
1002
|
-
const
|
|
1003
|
-
const staticResourceRoot = await fs.pathExists(platformRoot) ? platformRoot : input.plugin.rootDir;
|
|
1203
|
+
const staticResourceRoot = await resolveStaticPlatformResourceRoot(input.plugin.rootDir, input.platform);
|
|
1004
1204
|
const grokRoleUnit = input.platform === 'grok' && unit.output === 'supplement'
|
|
1005
1205
|
? bindingEntry.layout.renderUnits.find((candidate) => candidate.output === 'package'
|
|
1006
1206
|
&& artifactValueDigest(candidate.renderScope) === artifactValueDigest(unit.renderScope)) : undefined;
|
|
@@ -1206,10 +1406,12 @@ export class PlatformRebuildSession {
|
|
|
1206
1406
|
const publications = scopeRoot && operation(input) === 'ensure' ? [...this.grokPublications.values()].filter((item) => item.scope === binding.scope.kind && item.scopeRoot === scopeRoot && item.owner.identity.pluginId !== binding.plugin.pluginId) : [];
|
|
1207
1407
|
const retirements = binding.route === 'grok-directory' && operation(input) === 'ensure'
|
|
1208
1408
|
? [...this.grokProjectRetirements.values()].filter((item) => item.projectRoot === scopeRoot) : [];
|
|
1409
|
+
const removals = scopeRoot && ['remove', 'cleanup'].includes(operation(input))
|
|
1410
|
+
? [...this.grokRemovals.values()].filter((item) => item.scope === binding.scope.kind && item.scopeRoot === scopeRoot && item.pluginId !== binding.plugin.pluginId) : [];
|
|
1209
1411
|
const baselineDigest = artifactValueDigest(mutableBaseline);
|
|
1210
1412
|
if (artifactValueDigest(current) === baselineDigest)
|
|
1211
1413
|
return true;
|
|
1212
|
-
if (!scopeRoot || !publications.length && !retirements.length && !this.grokPermissionWrites.size)
|
|
1414
|
+
if (!scopeRoot || !publications.length && !retirements.length && !removals.length && !this.grokPermissionWrites.size)
|
|
1213
1415
|
return false;
|
|
1214
1416
|
const before = mutableBaseline.observation.prerequisites.nativeSources;
|
|
1215
1417
|
const after = current.observation.prerequisites.nativeSources;
|
|
@@ -1245,7 +1447,37 @@ export class PlatformRebuildSession {
|
|
|
1245
1447
|
const orderChecks = [priorEvidence];
|
|
1246
1448
|
const instructions = [...scopeEvidence.instructions];
|
|
1247
1449
|
const retiredSources = new Set();
|
|
1450
|
+
const retiredRules = new Set();
|
|
1248
1451
|
let adjusted = permissionChanged;
|
|
1452
|
+
for (const removal of removals) {
|
|
1453
|
+
ctx.signal?.throwIfAborted();
|
|
1454
|
+
if (removal.kind === 'package') {
|
|
1455
|
+
if (removal.packageName === entry.layout.nativeIdentity.packageId)
|
|
1456
|
+
return false;
|
|
1457
|
+
const priorIndex = priorPaths.indexOf(removal.installedRoot);
|
|
1458
|
+
if (priorIndex < 0)
|
|
1459
|
+
continue;
|
|
1460
|
+
if (priorEvidence.sourceDigests[priorIndex] !== removal.priorNativeDigest
|
|
1461
|
+
|| paths.includes(removal.installedRoot)
|
|
1462
|
+
|| await pathEvidence(removal.installedRoot) !== null)
|
|
1463
|
+
return false;
|
|
1464
|
+
retiredSources.add(removal.installedRoot);
|
|
1465
|
+
publishedRoots.add(removal.installedRoot);
|
|
1466
|
+
adjusted = true;
|
|
1467
|
+
}
|
|
1468
|
+
else {
|
|
1469
|
+
const priorRows = priorEvidence.instructions.filter((row) => row.rulePath === removal.rulePath);
|
|
1470
|
+
if (!priorRows.length)
|
|
1471
|
+
continue;
|
|
1472
|
+
if (priorRows.length !== 1
|
|
1473
|
+
|| removal.priorInstructionDigest !== undefined && priorRows[0].digest !== removal.priorInstructionDigest
|
|
1474
|
+
|| instructions.some((row) => row.rulePath === removal.rulePath)
|
|
1475
|
+
|| await pathEvidence(removal.rulePath) !== null)
|
|
1476
|
+
return false;
|
|
1477
|
+
retiredRules.add(removal.rulePath);
|
|
1478
|
+
adjusted = true;
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1249
1481
|
for (const retirement of retirements) {
|
|
1250
1482
|
const { name, projectPackage, projectDigest, userPackage, userDigest, userSource, userContentDigest, userPhysicalKey } = retirement;
|
|
1251
1483
|
if (!priorPaths.includes(projectPackage))
|
|
@@ -1353,10 +1585,11 @@ export class PlatformRebuildSession {
|
|
|
1353
1585
|
ctx.signal?.throwIfAborted();
|
|
1354
1586
|
if (!adjusted)
|
|
1355
1587
|
return artifactValueDigest(current) === baselineDigest;
|
|
1356
|
-
for (const
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1588
|
+
for (const sourceOrderAfter of [
|
|
1589
|
+
...publications.flatMap((item) => item.sourceOrderAfter ? [item.sourceOrderAfter] : []),
|
|
1590
|
+
...removals.flatMap((item) => item.kind === 'package' ? [item.sourceOrderAfter] : []),
|
|
1591
|
+
]) {
|
|
1592
|
+
// Sources that remained visible since the Project publication or User removal keep their receipt order.
|
|
1360
1593
|
if (artifactValueDigest(sourceOrderAfter.filter((root) => paths.includes(root)))
|
|
1361
1594
|
!== artifactValueDigest(paths.filter((root) => sourceOrderAfter.includes(root))))
|
|
1362
1595
|
return false;
|
|
@@ -1364,19 +1597,33 @@ export class PlatformRebuildSession {
|
|
|
1364
1597
|
// The reviewed order anchors surviving rows. Each publication's receipt
|
|
1365
1598
|
// also anchors its new rows against later cross-package moves.
|
|
1366
1599
|
for (const previous of orderChecks) {
|
|
1367
|
-
if (!matchesGrokComponentOrder(previous.
|
|
1600
|
+
if (!matchesGrokComponentOrder(previous.listOrder, scopeEvidence.listOrder, publishedRoots)
|
|
1601
|
+
|| !matchesGrokComponentOrder(previous.hookOrder, scopeEvidence.hookOrder, publishedRoots)
|
|
1368
1602
|
|| !scopeEvidence.resourceOrder.every((order, index) => matchesGrokComponentOrder(previous.resourceOrder[index], order, publishedRoots)))
|
|
1369
1603
|
return false;
|
|
1370
1604
|
}
|
|
1371
1605
|
const normalizedSources = { ...after, sources: sources.filter((_, index) => !addedSources.has(paths[index])),
|
|
1372
1606
|
configurationEvidence: before.configurationEvidence, grokScopeEvidence: { ...scopeEvidence, instructions, permissionConfigs: priorEvidence.permissionConfigs,
|
|
1373
|
-
permissionInventoryDigest: priorEvidence.permissionInventoryDigest,
|
|
1607
|
+
permissionInventoryDigest: priorEvidence.permissionInventoryDigest, listOrder: priorEvidence.listOrder, hookOrder: priorEvidence.hookOrder,
|
|
1608
|
+
resourceOrder: priorEvidence.resourceOrder,
|
|
1374
1609
|
sourceDigests: sourceDigests.filter((_, index) => !addedSources.has(paths[index])) } };
|
|
1375
1610
|
const observation = { ...current.observation, prerequisites: { ...current.observation.prerequisites, nativeSources: normalizedSources } };
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1611
|
+
const remainingBeforeSources = before.sources.filter((_, index) => !retiredSources.has(priorPaths[index]));
|
|
1612
|
+
const normalizedBeforeOverlaps = retiredSources.size
|
|
1613
|
+
? [...new Set(remainingBeforeSources.filter((source) => remainingBeforeSources.some((other) => other !== source && other.name === source.name))
|
|
1614
|
+
.map((source) => source.name))].sort()
|
|
1615
|
+
: before.overlaps;
|
|
1616
|
+
const normalizedBefore = { ...before, sources: remainingBeforeSources, overlaps: normalizedBeforeOverlaps,
|
|
1617
|
+
grokScopeEvidence: { ...priorEvidence,
|
|
1618
|
+
sourceDigests: priorEvidence.sourceDigests.filter((_, index) => !retiredSources.has(priorPaths[index])),
|
|
1619
|
+
instructions: retiredRules.size
|
|
1620
|
+
? priorEvidence.instructions.filter((row) => row.rulePath === null || !retiredRules.has(row.rulePath))
|
|
1621
|
+
: priorEvidence.instructions } };
|
|
1622
|
+
const baselineDiagnostics = before.overlaps.length > 0 && normalizedBeforeOverlaps.length === 0
|
|
1623
|
+
? mutableBaseline.observation.diagnostics.filter(({ code }) => code !== 'nativeCompatibilityOverlap')
|
|
1624
|
+
: mutableBaseline.observation.diagnostics;
|
|
1625
|
+
const baselineObservation = { ...mutableBaseline.observation, diagnostics: baselineDiagnostics,
|
|
1626
|
+
prerequisites: { ...mutableBaseline.observation.prerequisites, nativeSources: normalizedBefore } };
|
|
1380
1627
|
return artifactValueDigest({ ...current, observation }) === artifactValueDigest({ ...mutableBaseline, observation: baselineObservation });
|
|
1381
1628
|
};
|
|
1382
1629
|
const check = async (discovery, batch) => {
|
|
@@ -1400,7 +1647,8 @@ export class PlatformRebuildSession {
|
|
|
1400
1647
|
return 'deploymentObservationChanged';
|
|
1401
1648
|
};
|
|
1402
1649
|
checks.set(entry.binding.id, (batch) => check(undefined, batch));
|
|
1403
|
-
if (resolution.bindings.length === 1 && entry.binding.route === 'pi-package'
|
|
1650
|
+
if (resolution.bindings.length === 1 && (entry.binding.route === 'pi-package'
|
|
1651
|
+
|| cursorPreviewBatch && entry.binding.route === 'cursor-workspace-hook')) {
|
|
1404
1652
|
initialDiscoveryCheck = () => check({ value: initialParts.discovery });
|
|
1405
1653
|
}
|
|
1406
1654
|
this.mutableChecks.set(entry.binding.id, { physicalKey: entry.binding.physicalKey,
|
|
@@ -1583,11 +1831,15 @@ export class PlatformRebuildSession {
|
|
|
1583
1831
|
&& plan.evidence.sharedReferences === 'none' && plan.evidence.ownership.every((item) => item.state === 'absent')
|
|
1584
1832
|
&& plan.effects.every((effect) => ['publish-package', 'register'].includes(effect.kind));
|
|
1585
1833
|
const checkedBatch = this.context.batchInstallPlatform === plan.binding.platform && plan.binding.platform !== 'codex';
|
|
1834
|
+
const isBuiltinCursorWorkspaceHook = (effect) => effect.kind === 'write-supplement'
|
|
1835
|
+
&& plan.binding.route === 'cursor-workspace-hook'
|
|
1836
|
+
&& driverState.contributions.some((entry) => entry.effectId === effect.id && entry.contribution.id === 'cursor-workspace-open');
|
|
1586
1837
|
return plan.operation === 'ensure' && (checkedBatch || ['copilot-marketplace', 'pi-package'].includes(plan.binding.route))
|
|
1587
1838
|
&& plan.binding.platform === target.identity.platform && plan.expected.components.length > 0 && plan.expected.unmet.every(isDeliveryCapabilityGap)
|
|
1588
1839
|
&& driverState.before.package !== 'unknown' && (driverState.before.registration !== 'unknown' || hiddenEmptyPiProject)
|
|
1589
1840
|
&& ['absent', 'aw', 'shared'].includes(driverState.before.ownership)
|
|
1590
|
-
&& plan.effects.every((effect) => ['publish-package', 'register', 'refresh', 'activate'].includes(effect.kind)
|
|
1841
|
+
&& plan.effects.every((effect) => ['publish-package', 'register', 'refresh', 'activate'].includes(effect.kind)
|
|
1842
|
+
|| isBuiltinCursorWorkspaceHook(effect));
|
|
1591
1843
|
};
|
|
1592
1844
|
let privateStaging;
|
|
1593
1845
|
let stagedPackage;
|
|
@@ -1764,6 +2016,16 @@ export class PlatformRebuildSession {
|
|
|
1764
2016
|
for (const peer of peers)
|
|
1765
2017
|
await peer.assertStable();
|
|
1766
2018
|
} : undefined);
|
|
2019
|
+
const grokDisablePackage = prepared.plan.binding.route === 'grok-cli'
|
|
2020
|
+
&& ['remove', 'cleanup'].includes(prepared.plan.operation)
|
|
2021
|
+
&& prepared.plan.effects.some((effect) => effect.kind === 'deactivate')
|
|
2022
|
+
? prepared.driverState.before.nativeIdentity?.packageId ?? prepared.driverState.identity?.packageId
|
|
2023
|
+
: undefined;
|
|
2024
|
+
const grokDisableConfigPath = grokDisablePackage
|
|
2025
|
+
? path.join(await canonicalizePathThroughExistingAncestor(prepared.plan.evidence.layout.activationPath), 'config.toml')
|
|
2026
|
+
: undefined;
|
|
2027
|
+
const grokDisableConfigBefore = grokDisableConfigPath ? await readOptionalUtf8(grokDisableConfigPath) : undefined;
|
|
2028
|
+
let grokDisableConfigRecorded = false;
|
|
1767
2029
|
try {
|
|
1768
2030
|
receipt = await adapter.lifecycle.execute({ ...ctx, nativeEffects: this.nativeEffects, inspect: (binding) => adapter.inspect(ctx, binding), services: {
|
|
1769
2031
|
...nativeServices,
|
|
@@ -1866,6 +2128,14 @@ export class PlatformRebuildSession {
|
|
|
1866
2128
|
let permissionFailure;
|
|
1867
2129
|
const executor = locator ? { ...this.ownership, removeShared: async () => {
|
|
1868
2130
|
try {
|
|
2131
|
+
if (grokDisableConfigPath && grokDisablePackage && !grokDisableConfigRecorded
|
|
2132
|
+
&& locator.platform === 'grok' && locator.settingsPath === grokDisableConfigPath) {
|
|
2133
|
+
const midText = await readOptionalUtf8(grokDisableConfigPath);
|
|
2134
|
+
if (midText !== null && isGrokDisableConfigTransition(grokDisableConfigBefore ?? null, midText, grokDisablePackage)) {
|
|
2135
|
+
await this.recordGrokDisableConfigWrite(grokDisableConfigPath, grokDisableConfigBefore ?? null, midText);
|
|
2136
|
+
grokDisableConfigRecorded = true;
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
1869
2139
|
await updateHostPermissions(ctx, locator, undefined, (previous, current, target = locator.settingsPath, host) => this.recordPermissionWrite(target, previous, current, locator.platform === 'grok' ? host : undefined), batch, (notices) => {
|
|
1870
2140
|
for (const notice of notices) {
|
|
1871
2141
|
(notice.code === 'hostPermissionRestored' ? restorations : appliedPermissionNotices).push(notice);
|
|
@@ -1917,6 +2187,7 @@ export class PlatformRebuildSession {
|
|
|
1917
2187
|
const publish = prepared.plan.effects.find((effect) => effect.kind === 'publish-package');
|
|
1918
2188
|
const publication = receipt.effects.find((result) => result.id === publish?.id && result.status === 'applied');
|
|
1919
2189
|
try {
|
|
2190
|
+
let copilotRebase;
|
|
1920
2191
|
if (receipt.effects.some((effect) => effect.mutation !== 'none')) {
|
|
1921
2192
|
for (const [bindingId, check] of this.mutableChecks)
|
|
1922
2193
|
if (check.physicalKey === prepared.plan.binding.physicalKey) {
|
|
@@ -1927,12 +2198,18 @@ export class PlatformRebuildSession {
|
|
|
1927
2198
|
...verifiedSupplementIds.map((id) => ({ id, presence: 'present', reasonCodes: [] })),
|
|
1928
2199
|
];
|
|
1929
2200
|
}
|
|
1930
|
-
if (bindingId === receipt.bindingId && prepared.plan.binding.route === 'copilot-marketplace'
|
|
1931
|
-
|
|
1932
|
-
recheckCopilotMarketplaceTimeout(receipt, fresh);
|
|
2201
|
+
if (bindingId === receipt.bindingId && prepared.plan.binding.route === 'copilot-marketplace') {
|
|
2202
|
+
copilotRebase = fresh;
|
|
1933
2203
|
}
|
|
1934
2204
|
}
|
|
1935
2205
|
}
|
|
2206
|
+
if (prepared.plan.operation === 'remove' && prepared.plan.evidence.sharedReferences !== 'none') {
|
|
2207
|
+
checkRetainedCopilotDeactivation(prepared, receipt, copilotRebase);
|
|
2208
|
+
}
|
|
2209
|
+
else if (prepared.plan.operation !== 'remove' && copilotRebase
|
|
2210
|
+
&& receipt.effects.some((result) => result.status === 'applied' && result.mutation === 'confirmed')) {
|
|
2211
|
+
recheckCopilotMarketplaceTimeout(receipt, copilotRebase);
|
|
2212
|
+
}
|
|
1936
2213
|
}
|
|
1937
2214
|
catch (error) {
|
|
1938
2215
|
receipt.diagnostics.push({ code: recoveryInterruptionCode(error) ?? 'operationPlanStale', severity: 'error', message: error instanceof Error ? error.message : String(error),
|
|
@@ -1945,6 +2222,18 @@ export class PlatformRebuildSession {
|
|
|
1945
2222
|
// registration needs explicit trust. Account for the confirmed rule
|
|
1946
2223
|
// bytes before considering the next target, not for the blocked package.
|
|
1947
2224
|
this.recordGrokWrites(prepared, receipt, publication?.mutation === 'confirmed', writtenFiles, shadowedUsers.get(prepared.plan.binding.id));
|
|
2225
|
+
if (grokDisableConfigPath && grokDisablePackage && !grokDisableConfigRecorded
|
|
2226
|
+
&& !receipt.diagnostics.some((item) => item.severity === 'error')
|
|
2227
|
+
&& !receipt.effects.some((effect) => effect.mutation === 'possible' || ['failed', 'unknown', 'blocked', 'skipped'].includes(effect.status))
|
|
2228
|
+
&& prepared.plan.effects.some((effect) => effect.kind === 'deactivate'
|
|
2229
|
+
&& receipt.effects.some((result) => result.id === effect.id && result.status === 'applied' && result.mutation === 'confirmed'))) {
|
|
2230
|
+
const afterText = await readOptionalUtf8(grokDisableConfigPath);
|
|
2231
|
+
if (afterText !== null && isGrokDisableConfigTransition(grokDisableConfigBefore ?? null, afterText, grokDisablePackage)) {
|
|
2232
|
+
await this.recordGrokDisableConfigWrite(grokDisableConfigPath, grokDisableConfigBefore ?? null, afterText);
|
|
2233
|
+
grokDisableConfigRecorded = true;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
this.recordGrokRemovals(prepared, receipt);
|
|
1948
2237
|
if (receipt.effects.some((effect) => ['failed', 'unknown', 'blocked', 'skipped'].includes(effect.status)))
|
|
1949
2238
|
continue;
|
|
1950
2239
|
const piInventoryKey = piProjectInventoryKey(prepared.plan.binding, prepared.plan.evidence.layout.activationPath);
|
|
@@ -2019,7 +2308,9 @@ export class PlatformRebuildSession {
|
|
|
2019
2308
|
};
|
|
2020
2309
|
if (initialDiscoveryCheck) {
|
|
2021
2310
|
const firstCheck = initialDiscoveryCheck;
|
|
2022
|
-
const canReuseDiscovery = () =>
|
|
2311
|
+
const canReuseDiscovery = () => (cursorPreviewBatch
|
|
2312
|
+
? this.context.nativeObservationBatch === cursorPreviewBatch : this.targets.size === 1)
|
|
2313
|
+
&& deployments.length === 1 && plans.length === 1
|
|
2023
2314
|
&& plans[0] === deployments[0].plan && !blockedReceipts.length && plans[0].operation === 'ensure'
|
|
2024
2315
|
&& plans[0].expected.components.length > 0 && !plans[0].expected.unmet.length;
|
|
2025
2316
|
receiveInitialVerifier?.(async () => {
|