@lesliechan721/aw 0.1.0-beta.92 → 0.1.0-beta.94

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.
Files changed (137) hide show
  1. package/dist/authoring/scripts/validate-plugin.mjs +3 -0
  2. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  3. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  4. package/dist/src/commands/aw-capabilities.js +2 -1
  5. package/dist/src/commands/aw-capabilities.js.map +1 -1
  6. package/dist/src/commands/deployment-confirmation.js +13 -0
  7. package/dist/src/commands/deployment-confirmation.js.map +1 -1
  8. package/dist/src/commands/offline-cleanup-evidence.d.ts +1 -1
  9. package/dist/src/commands/offline-cleanup-evidence.js +30 -31
  10. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
  11. package/dist/src/commands/operation-plan.d.ts +5 -0
  12. package/dist/src/commands/operation-plan.js +2 -0
  13. package/dist/src/commands/operation-plan.js.map +1 -1
  14. package/dist/src/commands/plugin-capabilities.js +7 -2
  15. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  16. package/dist/src/commands/public-lifecycle-result.js +18 -1
  17. package/dist/src/commands/public-lifecycle-result.js.map +1 -1
  18. package/dist/src/commands/public-lifecycle.js +3 -1
  19. package/dist/src/commands/public-lifecycle.js.map +1 -1
  20. package/dist/src/commands/rebuild-command.d.ts +9 -16
  21. package/dist/src/commands/rebuild-command.js +149 -92
  22. package/dist/src/commands/rebuild-command.js.map +1 -1
  23. package/dist/src/commands/rebuild-integration.d.ts +1 -0
  24. package/dist/src/commands/rebuild-integration.js.map +1 -1
  25. package/dist/src/commands/rebuild-platform-integration.d.ts +4 -0
  26. package/dist/src/commands/rebuild-platform-integration.js +106 -60
  27. package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
  28. package/dist/src/commands/status-v6.js +7 -4
  29. package/dist/src/commands/status-v6.js.map +1 -1
  30. package/dist/src/generators/local-plugin.js +20 -12
  31. package/dist/src/generators/local-plugin.js.map +1 -1
  32. package/dist/src/output/component-delivery.js +3 -0
  33. package/dist/src/output/component-delivery.js.map +1 -1
  34. package/dist/src/output/skill-invocation-notices.d.ts +1 -1
  35. package/dist/src/output/skill-invocation-notices.js +5 -5
  36. package/dist/src/output/skill-invocation-notices.js.map +1 -1
  37. package/dist/src/platforms/capabilities.d.ts +7 -15
  38. package/dist/src/platforms/capabilities.js +62 -265
  39. package/dist/src/platforms/capabilities.js.map +1 -1
  40. package/dist/src/platforms/contracts.d.ts +29 -43
  41. package/dist/src/platforms/discovery.d.ts +2 -0
  42. package/dist/src/platforms/discovery.js.map +1 -1
  43. package/dist/src/platforms/inspection-native.d.ts +4 -2
  44. package/dist/src/platforms/inspection-native.js +228 -24
  45. package/dist/src/platforms/inspection-native.js.map +1 -1
  46. package/dist/src/platforms/inspection-pi.js +22 -14
  47. package/dist/src/platforms/inspection-pi.js.map +1 -1
  48. package/dist/src/platforms/layout.js +15 -0
  49. package/dist/src/platforms/layout.js.map +1 -1
  50. package/dist/src/platforms/lifecycle-native-services.js +68 -2
  51. package/dist/src/platforms/lifecycle-native-services.js.map +1 -1
  52. package/dist/src/platforms/lifecycle-native.js +12 -1
  53. package/dist/src/platforms/lifecycle-native.js.map +1 -1
  54. package/dist/src/platforms/lifecycle.d.ts +3 -1
  55. package/dist/src/platforms/lifecycle.js +133 -12
  56. package/dist/src/platforms/lifecycle.js.map +1 -1
  57. package/dist/src/platforms/projection-files.d.ts +4 -3
  58. package/dist/src/platforms/projection-files.js +7 -5
  59. package/dist/src/platforms/projection-files.js.map +1 -1
  60. package/dist/src/platforms/projection.js +6 -4
  61. package/dist/src/platforms/projection.js.map +1 -1
  62. package/dist/src/platforms/retirement-native.d.ts +6 -0
  63. package/dist/src/platforms/retirement-native.js +95 -0
  64. package/dist/src/platforms/retirement-native.js.map +1 -0
  65. package/dist/src/platforms/supplement-layout.js +8 -7
  66. package/dist/src/platforms/supplement-layout.js.map +1 -1
  67. package/dist/src/portable/materializer.js +1 -1
  68. package/dist/src/portable/materializer.js.map +1 -1
  69. package/dist/src/recovery/receipt.d.ts +2 -0
  70. package/dist/src/recovery/receipt.js.map +1 -1
  71. package/dist/src/recovery/retirement.js +58 -22
  72. package/dist/src/recovery/retirement.js.map +1 -1
  73. package/dist/src/recovery/status.js +14 -3
  74. package/dist/src/recovery/status.js.map +1 -1
  75. package/dist/src/review/platform-profile.d.ts +2 -3
  76. package/dist/src/review/platform-profile.js +4 -15
  77. package/dist/src/review/platform-profile.js.map +1 -1
  78. package/dist/src/review/skill-materialization.d.ts +1 -0
  79. package/dist/src/review/skill-materialization.js +15 -7
  80. package/dist/src/review/skill-materialization.js.map +1 -1
  81. package/dist/src/review/source-binding.d.ts +4 -2
  82. package/dist/src/review/source-binding.js +11 -2
  83. package/dist/src/review/source-binding.js.map +1 -1
  84. package/dist/src/tui/catalog-generation.d.ts +4 -1
  85. package/dist/src/tui/catalog-generation.js +34 -0
  86. package/dist/src/tui/catalog-generation.js.map +1 -1
  87. package/dist/src/tui/console-app-v4.js +52 -17
  88. package/dist/src/tui/console-app-v4.js.map +1 -1
  89. package/dist/src/tui/controller-runtime.js +16 -8
  90. package/dist/src/tui/controller-runtime.js.map +1 -1
  91. package/dist/src/tui/controller.d.ts +2 -1
  92. package/dist/src/tui/controller.js +14 -5
  93. package/dist/src/tui/controller.js.map +1 -1
  94. package/dist/src/tui/deployment-view.d.ts +1 -0
  95. package/dist/src/tui/deployment-view.js +23 -3
  96. package/dist/src/tui/deployment-view.js.map +1 -1
  97. package/dist/src/tui/entity-cards.js +7 -1
  98. package/dist/src/tui/entity-cards.js.map +1 -1
  99. package/dist/src/tui/model.d.ts +6 -1
  100. package/dist/src/tui/model.js +18 -5
  101. package/dist/src/tui/model.js.map +1 -1
  102. package/dist/src/tui/scoped-inventory.d.ts +9 -1
  103. package/dist/src/tui/scoped-inventory.js +16 -1
  104. package/dist/src/tui/scoped-inventory.js.map +1 -1
  105. package/dist/src/utils/artifact-plan.d.ts +4 -3
  106. package/dist/src/utils/artifact-plan.js.map +1 -1
  107. package/dist/src/utils/artifact-renderer.d.ts +3 -3
  108. package/dist/src/utils/artifact-renderer.js +16 -18
  109. package/dist/src/utils/artifact-renderer.js.map +1 -1
  110. package/dist/src/utils/artifact-request.d.ts +3 -3
  111. package/dist/src/utils/catalog-source-references.d.ts +37 -1
  112. package/dist/src/utils/catalog-source-references.js +361 -94
  113. package/dist/src/utils/catalog-source-references.js.map +1 -1
  114. package/dist/src/utils/codex-config.d.ts +3 -0
  115. package/dist/src/utils/codex-config.js +7 -0
  116. package/dist/src/utils/codex-config.js.map +1 -1
  117. package/dist/src/utils/component-agent-binding.d.ts +17 -0
  118. package/dist/src/utils/component-agent-binding.js +119 -0
  119. package/dist/src/utils/component-agent-binding.js.map +1 -0
  120. package/dist/src/utils/component-command-preparation.d.ts +2 -0
  121. package/dist/src/utils/component-command-preparation.js +18 -16
  122. package/dist/src/utils/component-command-preparation.js.map +1 -1
  123. package/dist/src/utils/component-gap.js +0 -4
  124. package/dist/src/utils/component-gap.js.map +1 -1
  125. package/dist/src/utils/component-resources.d.ts +9 -7
  126. package/dist/src/utils/component-resources.js +22 -1
  127. package/dist/src/utils/component-resources.js.map +1 -1
  128. package/dist/src/utils/local-marketplace.d.ts +2 -0
  129. package/dist/src/utils/local-marketplace.js +12 -0
  130. package/dist/src/utils/local-marketplace.js.map +1 -1
  131. package/dist/src/utils/platform-empty-state.d.ts +2 -2
  132. package/dist/src/utils/platform-empty-state.js +42 -19
  133. package/dist/src/utils/platform-empty-state.js.map +1 -1
  134. package/dist/src/utils/skill-invocation-warning.d.ts +3 -4
  135. package/dist/src/utils/skill-invocation-warning.js +11 -36
  136. package/dist/src/utils/skill-invocation-warning.js.map +1 -1
  137. package/package.json +3 -3
@@ -7,8 +7,8 @@ import { COMMAND_ROUTE_UNREACHABLE, HOST_PERMISSION_ADDITIONAL_IMPACT, publicHos
7
7
  import { createMarketplaceManifestEntry, getComponentFeatureRequirements, normalizeStaticPluginComponents } from '@lesliechan721/aw-plugin-core/manifest';
8
8
  import { selectNativeProduct, supportsSharedNativeProbe } from '../platforms/discovery.js';
9
9
  import { getAgentPluginAdapter } from '../platforms/registry.js';
10
- import { getAntigravityUnsupportedSkillControls, getQualifiedPlatformProfile } from '../platforms/capabilities.js';
11
- import { getDeploymentLayout, getDeploymentResourceKey, getInvocationPolicyPhysicalKey, scopedPermissionPath, isAntigravityProjectDirectory } from '../platforms/layout.js';
10
+ import { getQualifiedPlatformProfile } from '../platforms/capabilities.js';
11
+ import { getDeploymentLayout, getDeploymentResourceKey, getInvocationPolicyPhysicalKey, scopedPermissionPath, isAntigravityProjectDirectory, hasSharedUserPackage } from '../platforms/layout.js';
12
12
  import { getPhysicalKey, identityDigest } from '../platforms/identity.js';
13
13
  import { antigravityLegacyProjectComponent, deploymentPackageComponent, inspectStaticSupplements, requiredDeploymentActivation } from '../platforms/inspection.js';
14
14
  import { hasCompleteDeliveryDeclaration } from '../platforms/lifecycle.js';
@@ -26,6 +26,7 @@ import { readStrictNamespacedMarketplaceRoot } from '../utils/local-marketplace.
26
26
  import { isDeliveryCapabilityGap } from '../utils/component-gap.js';
27
27
  import { artifactValueDigest, mergeExpectedComponentSets } from '../utils/artifact-plan.js';
28
28
  import { preparePlatformComponents, resolveArtifactRenderConfig } from '../utils/artifact-renderer.js';
29
+ import { skillAgentBinding } from '../utils/component-agent-binding.js';
29
30
  import { finalizePlatformSkillProducers } from '../utils/component-command-preparation.js';
30
31
  import { cleanupOwnedComponents, createSharedOwnerToken, inspectOwnedComponents, renderOwnedTextFile, writeOwnedTextFile, writeSkillOwnerMarker } from '../utils/ownership.js';
31
32
  import { createPlatformInputEvidence, platformPackageInputDigest, platformPermissionNotices, readPlatformPackageContentDigest, writePlatformEmptyState } from '../utils/platform-empty-state.js';
@@ -280,9 +281,9 @@ async function ownedSupplements(binding, root, physicalKey) {
280
281
  }
281
282
  return result;
282
283
  }
283
- function readContext(context, cwd) {
284
+ function readContext(context, cwd, confirmedCatalogRetirement) {
284
285
  return { cwd, invocationCwd: context.invocationCwd, env: context.env, runner: context.nativeCliRunner, signal: context.signal,
285
- codexObservationSession: context.codexObservationSession };
286
+ confirmedCatalogRetirement, codexObservationSession: confirmedCatalogRetirement ? undefined : context.codexObservationSession };
286
287
  }
287
288
  function operation(input) {
288
289
  return input.command === 'uninstall' ? 'remove' : input.command === 'cleanup' ? 'cleanup'
@@ -496,6 +497,7 @@ export class PlatformRebuildSession {
496
497
  adapterFor;
497
498
  targets = new Map();
498
499
  resolutions = new Map();
500
+ rawUnits = new Map();
499
501
  units = new Map();
500
502
  published = new Map();
501
503
  nativeEffects = new Map();
@@ -535,7 +537,7 @@ export class PlatformRebuildSession {
535
537
  updateContext(context) {
536
538
  this.context = context;
537
539
  for (const ctx of this.contexts)
538
- Object.assign(ctx, readContext(context, ctx.cwd));
540
+ Object.assign(ctx, readContext(context, ctx.cwd, ctx.confirmedCatalogRetirement));
539
541
  }
540
542
  setOwnershipExecutor(executor) { this.ownership = executor; }
541
543
  root() { return this.staging ??= fs.mkdtemp(path.join(os.tmpdir(), 'aw-deployment-')); }
@@ -644,12 +646,13 @@ export class PlatformRebuildSession {
644
646
  userContentDigest: user.nativePackageContentDigest, userPhysicalKey: user.physicalKey });
645
647
  }
646
648
  async dispose() {
647
- await Promise.allSettled(this.units.values());
649
+ await Promise.allSettled([...this.rawUnits.values(), ...this.units.values()]);
648
650
  if (this.staging)
649
651
  await fs.remove(await this.staging);
650
652
  this.staging = undefined;
651
653
  this.targets.clear();
652
654
  this.resolutions.clear();
655
+ this.rawUnits.clear();
653
656
  this.units.clear();
654
657
  this.published.clear();
655
658
  this.nativeEffects.clear();
@@ -665,7 +668,13 @@ export class PlatformRebuildSession {
665
668
  this.marketplaceCandidatesFrozen = false;
666
669
  }
667
670
  freezeMarketplaceCandidates() { this.marketplaceCandidatesFrozen = true; }
668
- key(input) { return artifactValueDigest({ plugin: sourceIdentity(input), platform: input.platform, scope: input.scope, cwd: input.scope === 'project' ? input.cwd : null, operation: operation(input) }); }
671
+ retirementMode(input) {
672
+ return input.command === 'cleanup' && hasSharedUserPackage(input.platform) && this.context.confirmedCatalogRetirement === true ? true : undefined;
673
+ }
674
+ key(input) {
675
+ return artifactValueDigest({ plugin: sourceIdentity(input), platform: input.platform, scope: input.scope, cwd: input.scope === 'project' ? input.cwd : null,
676
+ operation: operation(input), confirmedCatalogRetirement: this.retirementMode(input) });
677
+ }
669
678
  resolve(input, placementProbeGroup) {
670
679
  const key = this.key(input);
671
680
  // Inspection of a shared package does not request activation in that scope.
@@ -675,8 +684,10 @@ export class PlatformRebuildSession {
675
684
  if (!result) {
676
685
  result = (async () => {
677
686
  const adapter = this.adapterFor(input.platform);
678
- const ctx = input.readOnlyInspectionPlan && input.observationBatch ? { ...readContext(this.context, input.cwd), ...input.observationBatch }
679
- : this.ordinaryReadContext(readContext(this.context, input.cwd), input.platform);
687
+ const mode = this.retirementMode(input);
688
+ const readCtx = readContext(this.context, input.cwd, mode);
689
+ const ctx = mode ? readCtx : input.readOnlyInspectionPlan && input.observationBatch ? { ...readCtx, ...input.observationBatch }
690
+ : this.ordinaryReadContext(readCtx, input.platform);
680
691
  const plugin = sourceIdentity(input);
681
692
  const recoveryCandidates = (this.context.recoveryCandidates ?? []).filter((candidate) => candidate.binding.platform === input.platform
682
693
  && candidate.binding.plugin.sourceIdentity === plugin.sourceIdentity && candidate.binding.plugin.pluginId === plugin.pluginId
@@ -884,9 +895,39 @@ export class PlatformRebuildSession {
884
895
  await result.platformDeployment?.verify(input.observationBatch);
885
896
  return result;
886
897
  }
898
+ prepareRawUnit(key, requestFor) {
899
+ let result = this.rawUnits.get(key);
900
+ if (!result) {
901
+ result = requestFor().then(async (request) => ({ request, prepared: await preparePlatformComponents(request) }));
902
+ this.rawUnits.set(key, result);
903
+ }
904
+ return result;
905
+ }
906
+ async prepareCodexUserAgents(raw, resolved) {
907
+ const key = raw.unit.physicalKey;
908
+ // The User supplement and Project-only in-memory view share one raw batch, independently of package finalization.
909
+ const result = await this.prepareRawUnit(key + ':user-agents', async () => {
910
+ const request = { ...raw.request, kinds: ['agent'] };
911
+ const sibling = resolved.find((entry) => entry.request?.scope === 'user'
912
+ && !['remove', 'cleanup'].includes(operation(entry.request))
913
+ && entry.resolution?.bindings.some((binding) => binding.physicalKey === key));
914
+ const binding = sibling?.resolution?.bindings.find((other) => other.physicalKey === key);
915
+ const renderUnit = sibling?.resolution?.renderUnits.find((other) => binding?.renderUnitIds.includes(other.id)
916
+ && other.output === 'supplement' && other.renderScope.kind === 'user');
917
+ if (!binding || !renderUnit || !sibling?.request)
918
+ return request;
919
+ // The Project target can be built first, before a known User target starts preparing its supplement.
920
+ const adapter = this.adapterFor('codex');
921
+ const cwd = sibling.request.cwd;
922
+ const capabilities = adapter.capabilities({ binding, renderUnit, profile: getQualifiedPlatformProfile('codex') });
923
+ return { ...request, cwd, capabilities };
924
+ });
925
+ return result.prepared;
926
+ }
887
927
  async build(input, receiveInitialVerifier) {
888
- const ctx = readContext(this.context, input.cwd);
889
- const ordinaryCtx = input.readOnlyInspectionPlan && input.observationBatch ? { ...ctx, ...input.observationBatch }
928
+ const confirmedCatalogRetirement = this.retirementMode(input);
929
+ const ctx = readContext(this.context, input.cwd, confirmedCatalogRetirement);
930
+ const ordinaryCtx = confirmedCatalogRetirement ? ctx : input.readOnlyInspectionPlan && input.observationBatch ? { ...ctx, ...input.observationBatch }
890
931
  : this.ordinaryReadContext(ctx, input.platform);
891
932
  const resolution = await this.resolve(input);
892
933
  if (!resolution.bindings.length)
@@ -920,7 +961,7 @@ export class PlatformRebuildSession {
920
961
  continue;
921
962
  const expected = await normalizeStaticPluginComponents({ pluginRoot: input.plugin.rootDir, manifest: input.plugin.manifest,
922
963
  platform: input.platform, capabilities: adapter.capabilities({ binding: entry.binding, renderUnit: unit,
923
- observation: entry.observation, profile: getQualifiedPlatformProfile(input.platform) }), allowedOutputKinds: unit.kinds });
964
+ profile: getQualifiedPlatformProfile(input.platform) }), allowedOutputKinds: unit.kinds });
924
965
  const supplements = await inspectStaticSupplements(ctx, entry.binding, expected.components);
925
966
  entry.observation.components.push(...supplements.components);
926
967
  }
@@ -934,46 +975,64 @@ export class PlatformRebuildSession {
934
975
  return target;
935
976
  const removing = operation(input) === 'remove' || operation(input) === 'cleanup';
936
977
  const preparedUnits = new Map();
937
- if (!removing)
978
+ if (!removing) {
979
+ const resolved = await Promise.all([...this.resolutions].map(async ([key, promise]) => ({
980
+ request: this.requestedOperations.get(key), resolution: await promise.catch(() => undefined),
981
+ })));
982
+ const allUnits = resolved.flatMap((entry) => entry.resolution?.renderUnits ?? []);
983
+ const rawUnits = new Map();
984
+ const profile = getQualifiedPlatformProfile(input.platform);
938
985
  for (const unit of resolution.renderUnits) {
939
986
  const bindingEntry = observed.find(({ binding }) => binding.renderUnitIds.includes(unit.id));
940
987
  if (!bindingEntry)
941
988
  throw new Error('deploymentRenderUnitUnbound');
942
- const compatible = (await Promise.allSettled([...this.resolutions.values()])).flatMap((result) => result.status === 'fulfilled' ? result.value.renderUnits : []).filter((item) => item.physicalKey === unit.physicalKey);
989
+ const compatible = allUnits.filter((item) => item.physicalKey === unit.physicalKey);
943
990
  if (compatible.some((item) => artifactValueDigest({ scope: item.renderScope, kinds: item.kinds, output: item.output })
944
991
  !== artifactValueDigest({ scope: unit.renderScope, kinds: unit.kinds, output: unit.output })))
945
992
  throw new Error('shared-projection-conflict');
946
993
  const commonUnit = { ...unit, consumers: [...new Map(compatible.flatMap((item) => item.consumers).map((consumer) => [consumer.id, consumer])).values()] };
994
+ const codexUserRoles = input.platform === 'codex' && unit.output === 'supplement' && unit.renderScope.kind === 'user';
995
+ const key = codexUserRoles ? bindingEntry.binding.physicalKey + ':user-agents' : unit.physicalKey;
996
+ const raw = await this.prepareRawUnit(key, async () => {
997
+ const capabilities = adapter.capabilities({ binding: bindingEntry.binding, renderUnit: commonUnit, profile });
998
+ const config = await resolveArtifactRenderConfig({ ...sourceIdentity(input), logicalIdentity: input.plugin.catalogLogicalIdentity,
999
+ pluginName: input.plugin.manifest.name, manifest: input.plugin.manifest, platform: input.platform,
1000
+ scope: unit.renderScope.kind, cwd: unit.renderScope.kind === 'project' ? unit.renderScope.projectRoot : input.cwd,
1001
+ env: this.context.env, referencePlugins: this.context.referencePlugins });
1002
+ const platformRoot = path.join(input.plugin.rootDir, input.platform);
1003
+ const staticResourceRoot = await fs.pathExists(platformRoot) ? platformRoot : input.plugin.rootDir;
1004
+ const grokRoleUnit = input.platform === 'grok' && unit.output === 'supplement'
1005
+ ? bindingEntry.layout.renderUnits.find((candidate) => candidate.output === 'package'
1006
+ && artifactValueDigest(candidate.renderScope) === artifactValueDigest(unit.renderScope)) : undefined;
1007
+ return { plugin: input.plugin, platform: input.platform, staticResourceRoot,
1008
+ renderScope: unit.renderScope.kind, kinds: unit.kinds, capabilities, config, cwd: input.cwd,
1009
+ hasInstructionAgentRecipients: grokRoleUnit && rawUnits.get(grokRoleUnit.id)?.prepared.expected.components.some(({ kind }) => kind === 'agent'),
1010
+ commandEnv: this.context.env, signal: this.context.signal, scriptTimeoutMs: this.context.scriptTimeoutMs,
1011
+ preparedResults: this.context.preparedArtifactRenderResults };
1012
+ });
1013
+ rawUnits.set(unit.id, { unit: commonUnit, ...raw });
1014
+ }
1015
+ for (const raw of rawUnits.values()) {
1016
+ const { unit, request: { config, capabilities } } = raw;
947
1017
  let promise = this.units.get(unit.physicalKey);
948
1018
  if (!promise) {
949
1019
  promise = (async () => {
950
- const capabilities = adapter.capabilities({ ...bindingEntry, renderUnit: commonUnit, profile: getQualifiedPlatformProfile(input.platform) });
951
- const config = await resolveArtifactRenderConfig({ ...sourceIdentity(input), logicalIdentity: input.plugin.catalogLogicalIdentity,
952
- pluginName: input.plugin.manifest.name, manifest: input.plugin.manifest, platform: input.platform,
953
- scope: unit.renderScope.kind, cwd: unit.renderScope.kind === 'project' ? unit.renderScope.projectRoot : input.cwd,
954
- env: this.context.env, referencePlugins: this.context.referencePlugins });
955
- const platformRoot = path.join(input.plugin.rootDir, input.platform);
956
- const staticResourceRoot = await fs.pathExists(platformRoot) ? platformRoot : input.plugin.rootDir;
957
- // Grok prepares the package before its rules. Only roles prepared for this same target can receive the text.
958
- const grokRoleUnit = input.platform === 'grok' && unit.output === 'supplement'
959
- ? bindingEntry.layout.renderUnits.find((candidate) => candidate.output === 'package'
960
- && artifactValueDigest(candidate.renderScope) === artifactValueDigest(unit.renderScope)) : undefined;
961
- const prepared = await preparePlatformComponents({ plugin: input.plugin, platform: input.platform, staticResourceRoot,
962
- renderScope: unit.renderScope.kind, kinds: unit.kinds, capabilities, config, cwd: input.cwd,
963
- hasInstructionAgentRecipients: grokRoleUnit && preparedUnits.get(grokRoleUnit.id)?.prepared.expected.components.some(({ kind }) => kind === 'agent'),
964
- commandEnv: this.context.env, signal: this.context.signal, scriptTimeoutMs: this.context.scriptTimeoutMs,
965
- preparedResults: this.context.preparedArtifactRenderResults });
1020
+ const binding = observed.find((entry) => entry.binding.renderUnitIds.includes(unit.id)).binding;
1021
+ const peers = binding.renderUnitIds.map((id) => rawUnits.get(id));
1022
+ const sharedCodexPackage = input.platform === 'codex' && unit.output === 'package' && unit.renderScope.kind === 'user';
1023
+ const extraAgents = sharedCodexPackage ? () => this.prepareCodexUserAgents(raw, resolved) : undefined;
966
1024
  const finalized = await finalizePlatformSkillProducers({ plugin: input.plugin, plugins: this.context.referencePlugins,
967
- platform: input.platform, renderUnit: commonUnit, prepared, skillWorkRoot: path.join(await this.root(), artifactValueDigest(unit.physicalKey).slice(7), 'skills'),
1025
+ platform: input.platform, renderUnit: unit, prepared: raw.prepared, agentBinding: skillAgentBinding(raw, peers, extraAgents),
1026
+ skillWorkRoot: path.join(await this.root(), artifactValueDigest(unit.physicalKey).slice(7), 'skills'),
968
1027
  cwd: input.cwd, env: this.context.env, signal: this.context.signal, scriptTimeoutMs: this.context.scriptTimeoutMs,
969
1028
  commandRecord: input.commandRecord });
970
- return { unit: commonUnit, prepared: finalized.prepared, finalized,
971
- evidenceInput: { renderUnit: commonUnit, capabilities, config } };
1029
+ return { unit, prepared: finalized.prepared, finalized, evidenceInput: { renderUnit: unit, capabilities, config } };
972
1030
  })();
973
1031
  this.units.set(unit.physicalKey, promise);
974
1032
  }
975
1033
  preparedUnits.set(unit.id, await promise);
976
1034
  }
1035
+ }
977
1036
  const deployments = [];
978
1037
  const plans = [];
979
1038
  const blockedReceipts = [];
@@ -1002,7 +1061,8 @@ export class PlatformRebuildSession {
1002
1061
  commandResources: sameScope.flatMap((candidate) => candidate.prepared.resources.commandResources),
1003
1062
  digest: artifactValueDigest(sameScope.map((candidate) => candidate.prepared.resources.digest)) };
1004
1063
  const projection = await adapter.project({ ...ctx, stagingRoot: path.join(await this.root(), 'projection') }, {
1005
- binding: entry.binding, renderUnit: unit.unit, capabilities: adapter.capabilities({ ...entry, renderUnit: unit.unit, profile: getQualifiedPlatformProfile(input.platform) }),
1064
+ binding: entry.binding, renderUnit: unit.unit,
1065
+ capabilities: adapter.capabilities({ binding: entry.binding, renderUnit: unit.unit, profile: getQualifiedPlatformProfile(input.platform) }),
1006
1066
  components, resources, policy: unit.finalized.invocationPolicy.policy,
1007
1067
  ...(grokProjectBlocked ? { grokScopeAuthorization: 'denied' } : {})
1008
1068
  });
@@ -1065,7 +1125,7 @@ export class PlatformRebuildSession {
1065
1125
  const managedCommandReview = await captureManagedCommandReviewEvidence({ binding: entry.binding,
1066
1126
  renderUnits: entry.layout.renderUnits, inactivePermissions: units.flatMap((unit) => unit.finalized.invocationPolicy.inactivePermissions), projections });
1067
1127
  const currentMutable = async (batch) => {
1068
- const observation = await adapter.inspect(batch ? { ...ctx, ...batch } : ctx, entry.binding);
1128
+ const observation = await adapter.inspect(batch && !confirmedCatalogRetirement ? { ...ctx, ...batch } : ctx, entry.binding);
1069
1129
  return { observation, references: await sharedReferences(this.context, entry.binding, observation, entry.layout),
1070
1130
  paths: await Promise.all(components.map(async (component) => {
1071
1131
  if ('path' in component)
@@ -1083,6 +1143,7 @@ export class PlatformRebuildSession {
1083
1143
  };
1084
1144
  const shadowedUser = operation(input) === 'ensure' ? await grokUserBehindProject(ctx, entry.binding, entry.observation) : undefined;
1085
1145
  const fingerprintParts = async (discovery) => ({
1146
+ confirmedCatalogRetirement: this.retirementMode(input),
1086
1147
  ...(shadowedUser && { grokUserContent: await grokUserContentDigest(shadowedUser) }),
1087
1148
  managedCommandReview,
1088
1149
  source: removing ? null : await pathEvidence(input.plugin.rootDir),
@@ -1120,7 +1181,7 @@ export class PlatformRebuildSession {
1120
1181
  if (ordinaryObservation !== undefined && ordinaryObservation !== artifactValueDigest(mutableBaseline.observation)) {
1121
1182
  throw new Error('operationPlanStale: deployment evidence changed after the ordinary observation.');
1122
1183
  }
1123
- const preparationObservation = entry.binding.route === 'antigravity-cli' || antigravityProject
1184
+ const preparationObservation = confirmedCatalogRetirement || entry.binding.route === 'antigravity-cli' || antigravityProject
1124
1185
  ? mutableBaseline.observation : entry.observation;
1125
1186
  const piInventoryKey = piProjectInventoryKey(entry.binding, entry.layout.activationPath);
1126
1187
  const matchesMutable = (current) => {
@@ -1399,7 +1460,7 @@ export class PlatformRebuildSession {
1399
1460
  }) : [];
1400
1461
  return { observation: mutable.observation, verifiedSupplementIds };
1401
1462
  } });
1402
- const evidence = { fingerprint: initial, managedCommandReview, layout: entry.layout, renderUnits: entry.layout.renderUnits,
1463
+ const evidence = { confirmedCatalogRetirement, fingerprint: initial, managedCommandReview, layout: entry.layout, renderUnits: entry.layout.renderUnits,
1403
1464
  ownership: await Promise.all(inspected.components.map(async ({ component, state }) => ({ component, state,
1404
1465
  contentDigest: state === 'present' ? await ownedContentDigest(component, ctx) : undefined,
1405
1466
  physicalKey: component.identity.physicalKey ?? entry.binding.physicalKey }))),
@@ -1416,7 +1477,7 @@ export class PlatformRebuildSession {
1416
1477
  if (notice)
1417
1478
  evidence.permissionOwnershipWarning = notice;
1418
1479
  }
1419
- if (entry.binding.platform === 'codex') {
1480
+ if (!confirmedCatalogRetirement && entry.binding.platform === 'codex') {
1420
1481
  const hostEntry = entry.binding.consumers.find((consumer) => consumer.entry?.kind === 'cli'
1421
1482
  || removing && consumer.entry?.kind === 'directory')?.entry;
1422
1483
  if (!hostEntry || hostEntry.kind === 'generic')
@@ -1424,7 +1485,7 @@ export class PlatformRebuildSession {
1424
1485
  const config = await readCodexConfigFile(path.join(hostEntry.configRoot, 'config.toml'));
1425
1486
  evidence.userActivationEnabled = config.snapshot.plugins[entry.layout.nativeIdentity.registrationId]?.enabled === true;
1426
1487
  }
1427
- if (entry.binding.platform === 'copilot') {
1488
+ if (!confirmedCatalogRetirement && entry.binding.platform === 'copilot') {
1428
1489
  const hostEntry = entry.binding.consumers.find((consumer) => consumer.entry?.kind === 'cli')?.entry;
1429
1490
  if (hostEntry?.kind === 'cli') {
1430
1491
  const settings = await jsonObject(path.join(hostEntry.configRoot, 'settings.json'));
@@ -1433,7 +1494,7 @@ export class PlatformRebuildSession {
1433
1494
  ? enabled[entry.layout.nativeIdentity.registrationId] === true : 'unknown';
1434
1495
  }
1435
1496
  }
1436
- if (entry.binding.scope.kind === 'project' && ['codex', 'copilot'].includes(entry.binding.platform)) {
1497
+ if (!confirmedCatalogRetirement && entry.binding.scope.kind === 'project' && ['codex', 'copilot'].includes(entry.binding.platform)) {
1437
1498
  const plannedUser = [...this.requestedOperations.values()].find((request) => request.scope === 'user'
1438
1499
  && request.platform === input.platform && sourceIdentity(request).sourceIdentity === entry.binding.plugin.sourceIdentity
1439
1500
  && sourceIdentity(request).pluginId === entry.binding.plugin.pluginId);
@@ -1599,31 +1660,15 @@ export class PlatformRebuildSession {
1599
1660
  const unit = preparedUnits.get(unitId);
1600
1661
  if (!unit?.finalized.skills.length)
1601
1662
  continue;
1602
- const capabilityInput = { binding: plan.binding, renderUnit: unit.unit,
1603
- observation: after, profile: getQualifiedPlatformProfile(input.platform) };
1604
- const capabilities = adapter.capabilities(capabilityInput);
1605
- const cliReaders = unit.unit.consumers.filter(({ product }) => product === 'cli');
1606
- // Only attribute a shared package's limitation to Desktop if the same
1607
- // check passes for its CLI readers and an App reader was observed.
1608
- const codexCliCapabilities = plan.binding.platform === 'codex'
1609
- && cliReaders.some(({ availability }) => availability === 'available')
1610
- && unit.unit.consumers.some(({ product, availability }) => product === 'app' && availability === 'available')
1611
- && unit.unit.consumers.every(({ product, availability, entry }) => product === 'app'
1612
- || product === 'cli' && availability === 'available' && entry?.kind === 'cli')
1613
- ? adapter.capabilities({ ...capabilityInput, renderUnit: { ...unit.unit, consumers: cliReaders } }) : undefined;
1614
- const antigravityReaders = plan.binding.platform === 'antigravity'
1615
- ? unit.unit.consumers.flatMap((reader) => reader.availability === 'available' && reader.product !== 'generic'
1616
- ? [{ id: reader.id, product: reader.product,
1617
- unsupported: getAntigravityUnsupportedSkillControls(capabilityInput.profile, plan.binding.scope.kind, reader) }]
1618
- : []) : [];
1663
+ const capabilities = adapter.capabilities({ binding: plan.binding, renderUnit: unit.unit,
1664
+ profile: getQualifiedPlatformProfile(input.platform) });
1619
1665
  for (const skill of unit.finalized.skills) {
1620
1666
  if (!packageIds.has(skill.componentId) || !delivered.has(skill.componentId))
1621
1667
  continue;
1622
1668
  const component = unit.prepared.expected.components.find((item) => item.id === skill.componentId);
1623
1669
  const requested = getComponentFeatureRequirements(component, { skillText: skill.tree.files['SKILL.md'].toString('utf8') });
1624
- const warning = skillInvocationWarning(component.name, requested, { pluginId: plan.binding.plugin.pluginId, target: plan.binding.platform, scope: plan.binding.scope.kind }, capabilities, codexCliCapabilities, antigravityReaders.map((reader) => ({ ...reader,
1625
- observed: after.skillInvocationPolicies?.find(({ componentId, productId }) => componentId === component.id
1626
- && productId === reader.id)?.features })));
1670
+ const warning = skillInvocationWarning(component.name, requested, { pluginId: plan.binding.plugin.pluginId, target: plan.binding.platform, scope: plan.binding.scope.kind }, capabilities, plan.binding.platform === 'antigravity' ? unit.unit.consumers.flatMap((reader) => reader.availability === 'available' && reader.product !== 'generic'
1671
+ ? [{ product: reader.product, observed: after.skillInvocationPolicies?.find(({ componentId, productId }) => componentId === component.id && productId === reader.id)?.features }] : []) : []);
1627
1672
  if (warning)
1628
1673
  receipt.diagnostics.push(warning);
1629
1674
  }
@@ -1861,6 +1906,7 @@ export class PlatformRebuildSession {
1861
1906
  return receipts;
1862
1907
  if ((prepared.plan.operation === 'remove' || prepared.plan.operation === 'cleanup'
1863
1908
  || prepared.plan.expected.components.length === 0 && prepared.plan.expected.unmet.length === 0)
1909
+ && prepared.plan.evidence.confirmedCatalogRetirement !== true
1864
1910
  && prepared.plan.evidence.sharedReferences !== 'none' && receipt.after.package === 'present') {
1865
1911
  receipt.diagnostics.push({ code: prepared.plan.evidence.sharedReferences === 'unknown' ? 'sharedReferenceUnknown' : 'sharedPackageRetained', severity: 'warning',
1866
1912
  message: prepared.plan.evidence.sharedReferences === 'unknown'