@lesliechan721/aw 0.1.0-beta.101 → 0.1.0-beta.103

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 (199) hide show
  1. package/dist/src/commands/catalog-generation.d.ts +2 -5
  2. package/dist/src/commands/catalog-generation.js +2 -4
  3. package/dist/src/commands/catalog-generation.js.map +1 -1
  4. package/dist/src/commands/lifecycle-command-package.d.ts +1 -1
  5. package/dist/src/commands/lifecycle-command-package.js +40 -2
  6. package/dist/src/commands/lifecycle-command-package.js.map +1 -1
  7. package/dist/src/commands/managed-commands.d.ts +2 -1
  8. package/dist/src/commands/managed-commands.js +4 -2
  9. package/dist/src/commands/managed-commands.js.map +1 -1
  10. package/dist/src/commands/operation-plan.d.ts +2 -8
  11. package/dist/src/commands/operation-plan.js.map +1 -1
  12. package/dist/src/commands/public-config-confirmation.d.ts +16 -10
  13. package/dist/src/commands/public-config-confirmation.js +87 -52
  14. package/dist/src/commands/public-config-confirmation.js.map +1 -1
  15. package/dist/src/commands/public-lifecycle.d.ts +1 -1
  16. package/dist/src/commands/public-lifecycle.js +36 -8
  17. package/dist/src/commands/public-lifecycle.js.map +1 -1
  18. package/dist/src/commands/public-plugin-query.js +6 -4
  19. package/dist/src/commands/public-plugin-query.js.map +1 -1
  20. package/dist/src/commands/rebuild-command.d.ts +22 -6
  21. package/dist/src/commands/rebuild-command.js +273 -557
  22. package/dist/src/commands/rebuild-command.js.map +1 -1
  23. package/dist/src/commands/rebuild-integration.d.ts +12 -39
  24. package/dist/src/commands/rebuild-integration.js +67 -303
  25. package/dist/src/commands/rebuild-integration.js.map +1 -1
  26. package/dist/src/commands/rebuild-operations.d.ts +0 -4
  27. package/dist/src/commands/rebuild-operations.js +9 -8
  28. package/dist/src/commands/rebuild-operations.js.map +1 -1
  29. package/dist/src/commands/rebuild-platform-integration.d.ts +14 -6
  30. package/dist/src/commands/rebuild-platform-integration.js +310 -101
  31. package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
  32. package/dist/src/commands/status-v6.d.ts +3 -117
  33. package/dist/src/commands/status-v6.js +0 -2886
  34. package/dist/src/commands/status-v6.js.map +1 -1
  35. package/dist/src/commands/write-commands.js +0 -3
  36. package/dist/src/commands/write-commands.js.map +1 -1
  37. package/dist/src/index.js +44 -36
  38. package/dist/src/index.js.map +1 -1
  39. package/dist/src/intent/deployment-preferences.js +4 -3
  40. package/dist/src/intent/deployment-preferences.js.map +1 -1
  41. package/dist/src/intent/intent-store.js +3 -2
  42. package/dist/src/intent/intent-store.js.map +1 -1
  43. package/dist/src/output/command-receipt.d.ts +0 -6
  44. package/dist/src/output/command-receipt.js +0 -15
  45. package/dist/src/output/command-receipt.js.map +1 -1
  46. package/dist/src/output/receipt-projection.js +2 -1
  47. package/dist/src/output/receipt-projection.js.map +1 -1
  48. package/dist/src/platforms/capabilities.js +8 -2
  49. package/dist/src/platforms/capabilities.js.map +1 -1
  50. package/dist/src/platforms/contracts.d.ts +2 -0
  51. package/dist/src/platforms/discovery.d.ts +2 -0
  52. package/dist/src/platforms/discovery.js +95 -49
  53. package/dist/src/platforms/discovery.js.map +1 -1
  54. package/dist/src/platforms/inspection-native.d.ts +7 -1
  55. package/dist/src/platforms/inspection-native.js +6 -3
  56. package/dist/src/platforms/inspection-native.js.map +1 -1
  57. package/dist/src/platforms/inspection-query.d.ts +28 -14
  58. package/dist/src/platforms/inspection-query.js +102 -8
  59. package/dist/src/platforms/inspection-query.js.map +1 -1
  60. package/dist/src/platforms/lifecycle-native-services.d.ts +1 -1
  61. package/dist/src/platforms/lifecycle-native-services.js +7 -2
  62. package/dist/src/platforms/lifecycle-native-services.js.map +1 -1
  63. package/dist/src/platforms/lifecycle-native.js +20 -3
  64. package/dist/src/platforms/lifecycle-native.js.map +1 -1
  65. package/dist/src/platforms/lifecycle.js +5 -0
  66. package/dist/src/platforms/lifecycle.js.map +1 -1
  67. package/dist/src/platforms/supplement-state.js +11 -2
  68. package/dist/src/platforms/supplement-state.js.map +1 -1
  69. package/dist/src/portable/commands.d.ts +1 -0
  70. package/dist/src/portable/commands.js.map +1 -1
  71. package/dist/src/portable/materializer.d.ts +2 -0
  72. package/dist/src/portable/materializer.js +4 -4
  73. package/dist/src/portable/materializer.js.map +1 -1
  74. package/dist/src/portable/recovery.d.ts +1 -0
  75. package/dist/src/portable/recovery.js +3 -2
  76. package/dist/src/portable/recovery.js.map +1 -1
  77. package/dist/src/recovery/coordinator.d.ts +6 -1
  78. package/dist/src/recovery/coordinator.js +113 -108
  79. package/dist/src/recovery/coordinator.js.map +1 -1
  80. package/dist/src/recovery/demand.d.ts +1 -2
  81. package/dist/src/recovery/demand.js +4 -11
  82. package/dist/src/recovery/demand.js.map +1 -1
  83. package/dist/src/recovery/install-concurrency.d.ts +12 -0
  84. package/dist/src/recovery/install-concurrency.js +39 -0
  85. package/dist/src/recovery/install-concurrency.js.map +1 -1
  86. package/dist/src/recovery/joint-coordinator.d.ts +3 -4
  87. package/dist/src/recovery/joint-coordinator.js +324 -188
  88. package/dist/src/recovery/joint-coordinator.js.map +1 -1
  89. package/dist/src/recovery/joint-demand.js +4 -3
  90. package/dist/src/recovery/joint-demand.js.map +1 -1
  91. package/dist/src/recovery/joint-install-execution.js +46 -2
  92. package/dist/src/recovery/joint-install-execution.js.map +1 -1
  93. package/dist/src/recovery/joint-install-native-rebase.js +5 -2
  94. package/dist/src/recovery/joint-install-native-rebase.js.map +1 -1
  95. package/dist/src/recovery/locked-prepared-execution.d.ts +32 -0
  96. package/dist/src/recovery/locked-prepared-execution.js +67 -0
  97. package/dist/src/recovery/locked-prepared-execution.js.map +1 -0
  98. package/dist/src/recovery/status.d.ts +20 -6
  99. package/dist/src/recovery/status.js +153 -98
  100. package/dist/src/recovery/status.js.map +1 -1
  101. package/dist/src/review/skill-materialization.d.ts +1 -0
  102. package/dist/src/review/skill-materialization.js.map +1 -1
  103. package/dist/src/tui/console-app-v4.js +4 -14
  104. package/dist/src/tui/console-app-v4.js.map +1 -1
  105. package/dist/src/tui/controller-runtime.js +201 -57
  106. package/dist/src/tui/controller-runtime.js.map +1 -1
  107. package/dist/src/tui/controller.d.ts +8 -9
  108. package/dist/src/tui/controller.js +5 -6
  109. package/dist/src/tui/controller.js.map +1 -1
  110. package/dist/src/tui/operation-review-planner.js +14 -103
  111. package/dist/src/tui/operation-review-planner.js.map +1 -1
  112. package/dist/src/types.d.ts +5 -1
  113. package/dist/src/types.js.map +1 -1
  114. package/dist/src/utils/agent-version.js +1 -0
  115. package/dist/src/utils/agent-version.js.map +1 -1
  116. package/dist/src/utils/artifact-renderer.d.ts +10 -0
  117. package/dist/src/utils/artifact-renderer.js +28 -2
  118. package/dist/src/utils/artifact-renderer.js.map +1 -1
  119. package/dist/src/utils/aw-home-mutation-lock.d.ts +8 -0
  120. package/dist/src/utils/aw-home-mutation-lock.js +44 -8
  121. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  122. package/dist/src/utils/bundle-integrity.js +126 -33
  123. package/dist/src/utils/bundle-integrity.js.map +1 -1
  124. package/dist/src/utils/catalog-generation-resolver.d.ts +4 -0
  125. package/dist/src/utils/catalog-generation-resolver.js +4 -0
  126. package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
  127. package/dist/src/utils/catalog-generation-service.d.ts +50 -11
  128. package/dist/src/utils/catalog-generation-service.js +276 -130
  129. package/dist/src/utils/catalog-generation-service.js.map +1 -1
  130. package/dist/src/utils/catalog-generation-state.js +6 -1
  131. package/dist/src/utils/catalog-generation-state.js.map +1 -1
  132. package/dist/src/utils/catalog-generation-store.d.ts +5 -0
  133. package/dist/src/utils/catalog-generation-store.js +36 -13
  134. package/dist/src/utils/catalog-generation-store.js.map +1 -1
  135. package/dist/src/utils/catalog-operation-context.d.ts +17 -3
  136. package/dist/src/utils/catalog-operation-context.js +220 -22
  137. package/dist/src/utils/catalog-operation-context.js.map +1 -1
  138. package/dist/src/utils/catalog-performance.d.ts +3 -0
  139. package/dist/src/utils/catalog-performance.js +26 -0
  140. package/dist/src/utils/catalog-performance.js.map +1 -0
  141. package/dist/src/utils/catalog-snapshot.d.ts +5 -2
  142. package/dist/src/utils/catalog-snapshot.js +3 -2
  143. package/dist/src/utils/catalog-snapshot.js.map +1 -1
  144. package/dist/src/utils/catalog-source-impact.d.ts +2 -1
  145. package/dist/src/utils/catalog-source-impact.js +2 -2
  146. package/dist/src/utils/catalog-source-impact.js.map +1 -1
  147. package/dist/src/utils/catalog-source-references.d.ts +2 -0
  148. package/dist/src/utils/catalog-source-references.js +284 -148
  149. package/dist/src/utils/catalog-source-references.js.map +1 -1
  150. package/dist/src/utils/codex-executable-discovery.js +1 -0
  151. package/dist/src/utils/codex-executable-discovery.js.map +1 -1
  152. package/dist/src/utils/codex-manager.js +1 -0
  153. package/dist/src/utils/codex-manager.js.map +1 -1
  154. package/dist/src/utils/codex-native-observation.d.ts +5 -2
  155. package/dist/src/utils/codex-native-observation.js +8 -4
  156. package/dist/src/utils/codex-native-observation.js.map +1 -1
  157. package/dist/src/utils/component-command-preparation.d.ts +1 -0
  158. package/dist/src/utils/component-command-preparation.js.map +1 -1
  159. package/dist/src/utils/git-catalog-provider.d.ts +38 -5
  160. package/dist/src/utils/git-catalog-provider.js +365 -156
  161. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  162. package/dist/src/utils/managed-command-closure.d.ts +3 -1
  163. package/dist/src/utils/managed-command-closure.js +10 -5
  164. package/dist/src/utils/managed-command-closure.js.map +1 -1
  165. package/dist/src/utils/managed-command-materialization.d.ts +2 -0
  166. package/dist/src/utils/managed-command-materialization.js +4 -3
  167. package/dist/src/utils/managed-command-materialization.js.map +1 -1
  168. package/dist/src/utils/managed-command-preparation.js +1 -1
  169. package/dist/src/utils/managed-command-preparation.js.map +1 -1
  170. package/dist/src/utils/multi-source-catalog.d.ts +1 -1
  171. package/dist/src/utils/multi-source-catalog.js +3 -3
  172. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  173. package/dist/src/utils/native-cli.d.ts +6 -1
  174. package/dist/src/utils/native-cli.js +67 -32
  175. package/dist/src/utils/native-cli.js.map +1 -1
  176. package/dist/src/utils/platform-empty-state.d.ts +2 -0
  177. package/dist/src/utils/platform-empty-state.js +5 -5
  178. package/dist/src/utils/platform-empty-state.js.map +1 -1
  179. package/dist/src/utils/plugin-config-command-apply.d.ts +14 -4
  180. package/dist/src/utils/plugin-config-command-apply.js +49 -5
  181. package/dist/src/utils/plugin-config-command-apply.js.map +1 -1
  182. package/dist/src/utils/plugin-config-impact.d.ts +42 -0
  183. package/dist/src/utils/plugin-config-impact.js +170 -14
  184. package/dist/src/utils/plugin-config-impact.js.map +1 -1
  185. package/dist/src/utils/plugin-config-references.d.ts +3 -1
  186. package/dist/src/utils/plugin-config-references.js +3 -5
  187. package/dist/src/utils/plugin-config-references.js.map +1 -1
  188. package/dist/src/utils/plugin-config-write.d.ts +14 -5
  189. package/dist/src/utils/plugin-config-write.js +213 -117
  190. package/dist/src/utils/plugin-config-write.js.map +1 -1
  191. package/dist/src/utils/plugin-config.d.ts +2 -0
  192. package/dist/src/utils/plugin-config.js.map +1 -1
  193. package/dist/src/utils/plugin-scripts.d.ts +2 -0
  194. package/dist/src/utils/plugin-scripts.js +102 -3
  195. package/dist/src/utils/plugin-scripts.js.map +1 -1
  196. package/package.json +3 -5
  197. package/dist/src/utils/codex-reconciler.d.ts +0 -123
  198. package/dist/src/utils/codex-reconciler.js +0 -322
  199. package/dist/src/utils/codex-reconciler.js.map +0 -1
@@ -4,7 +4,6 @@ import { type ClaudePermissions } from '../generators/permissions.js';
4
4
  import type { CommandReporter, DebugLogger } from '../output/model.js';
5
5
  import type { CatalogResolution, CommandProducerResult, PlatformName, PluginMeta, Scope } from '../types.js';
6
6
  import { type CodexNativeObservationSession, type CodexNativePluginObservation } from '../utils/codex-native-observation.js';
7
- import type { CodexReconcilePlan } from '../utils/codex-reconciler.js';
8
7
  import { type CodexSharedNativeInspection } from '../utils/codex-shared-native.js';
9
8
  import { type CodexManager, type NativeCliRunner } from '../utils/native-cli.js';
10
9
  import { type NativeOwnershipProbe, type OwnedComponent, type OwnershipInspection } from '../utils/ownership.js';
@@ -20,14 +19,13 @@ export declare function recordPreparedPermissionWrite(results: PreparedArtifactR
20
19
  export declare function recordPreparedOfflinePermissionRemoval(results: PreparedArtifactRenderResults, settingsPath: string, ownerKey: string): void;
21
20
  export declare function disposePreparedPlatformRebuildSession(results: PreparedArtifactRenderResults): Promise<void>;
22
21
  export interface RebuildIntegration {
23
- resolvePlatformTargets(inputs: readonly Parameters<RebuildIntegration['buildTarget']>[0][]): Promise<void>;
22
+ resolvePlatformTargets(inputs: readonly Parameters<RebuildIntegration['buildTarget']>[0][], captureOrdinary?: boolean): Promise<void>;
24
23
  sealMarketplaceGenerations(targets: readonly DesiredTarget[]): Promise<void>;
25
24
  pendingOpenCodeProjectNotices(interrupted: boolean): import('../platforms/contracts.js').Diagnostic[];
26
25
  driver: RebuildTargetDriver;
27
26
  setNativeMarketplaceEligibleTargets(targets: readonly DesiredTarget[]): void;
28
- prepareNativeMarketplaceGroup(target: DesiredTarget): Promise<void>;
29
27
  postcheckCodexProvider(target: DesiredTarget): Promise<void>;
30
- captureCodexPostMutationSnapshots(marketplaceNames?: readonly string[]): Promise<void>;
28
+ captureCodexPostMutationSnapshots(): Promise<void>;
31
29
  buildTarget(options: {
32
30
  sourceId?: string;
33
31
  sourceIdentity?: string;
@@ -44,24 +42,20 @@ export interface RebuildIntegration {
44
42
  readOnlyInspectionPlan?: boolean;
45
43
  /** Fresh read window for peers undergoing the same placement check or plan verification. */
46
44
  observationBatch?: import('../platforms/inspection-query.js').NativeObservationBatch;
45
+ /** The selected group's rendered targets are checked together before any can enter Review. */
46
+ afterGroupRender?: (verify: () => Promise<void>) => void;
47
+ /** A direct locked single-target sync may merge adjacent host-only checks into its final seal. */
48
+ combinePostRenderSeal?: boolean;
47
49
  readOnlyShallowInspectionPlan?: boolean;
48
- includeNativeCleanupCandidate?: boolean;
49
- codexActivationCleanup?: Array<{
50
- codexPluginId: string;
51
- scope: Scope;
52
- disposition: 'remove' | 'disable';
53
- }>;
54
50
  }): Promise<DesiredTarget>;
55
51
  }
56
52
  export interface PreparedRebuildTarget {
57
53
  target: DesiredTarget;
58
54
  }
59
- export declare class CodexActivationPostcheckError extends Error {
60
- readonly code = "codexActivationPostcheckFailed";
61
- readonly codexPluginIds: string[];
62
- constructor(codexPluginIds: string | readonly string[], detail: string);
63
- }
64
55
  export interface RebuildExecutionContext {
56
+ awHomeMutationToken?: import('../utils/aw-home-mutation-lock.js').AwHomeMutationToken;
57
+ /** Bound bundle reads only for this preparation, never across Review/Execute. */
58
+ catalogReadScope?: import('../utils/catalog-operation-context.js').CatalogPreparationReadScope;
65
59
  confirmedCatalogRetirement?: true;
66
60
  removeHostPermissions?: (locator: import('../platforms/permission-ownership.js').PermissionLocator) => Promise<void>;
67
61
  invocationCwd?: string;
@@ -86,9 +80,7 @@ export interface RebuildExecutionContext {
86
80
  reporter: CommandReporter;
87
81
  debugLogger: DebugLogger;
88
82
  expectedCatalogConfigDigest?: string;
89
- codexUserActivationDesired?: ReadonlySet<string>;
90
- codexObservationSession?: CodexNativeObservationSession;
91
- /** Borrowed by ordinary native reads in the initial install preview. */
83
+ /** Owns this operation phase’s ordinary, verification and execution observations. */
92
84
  nativeObservationBatch?: import('../platforms/inspection-query.js').NativeObservationBatch;
93
85
  codexObservationScopeByMarketplace?: ReadonlyMap<string, 'user' | 'both'>;
94
86
  preApplyExecutionCache?: Map<string, Promise<void>>;
@@ -101,26 +93,6 @@ export interface RebuildExecutionContext {
101
93
  }[];
102
94
  commandResults?: CommandProducerResult[];
103
95
  }
104
- export declare function executeCodexReconcileActivations(options: {
105
- plans: readonly CodexReconcilePlan[];
106
- cwd: string;
107
- env: NodeJS.ProcessEnv;
108
- manager?: CodexManager;
109
- runner: NativeCliRunner;
110
- observationSession?: CodexNativeObservationSession;
111
- preflightCompleted?: boolean;
112
- mutationMarketplaces?: Set<string>;
113
- observationScopeByMarketplace?: ReadonlyMap<string, 'user' | 'both'>;
114
- }): Promise<void>;
115
- export declare function postcheckCodexReconcileActivations(options: {
116
- plans: readonly CodexReconcilePlan[];
117
- cwd: string;
118
- env: NodeJS.ProcessEnv;
119
- manager?: CodexManager;
120
- runner: NativeCliRunner;
121
- observationSession?: CodexNativeObservationSession;
122
- observationScopeByMarketplace?: ReadonlyMap<string, 'user' | 'both'>;
123
- }): Promise<void>;
124
96
  export declare function removeForceCleanupCodexRoleRegistration(options: {
125
97
  component: OwnedComponent;
126
98
  cwd: string;
@@ -202,6 +174,8 @@ export declare function createRebuildIntegration(options: {
202
174
  scriptTimeoutMs?: number;
203
175
  preparedTargets?: readonly DesiredTarget[];
204
176
  operationScopedNativePhases?: boolean;
177
+ /** Ordinary-only reader; it must not replace any shared mutable session. */
178
+ isolatedObservation?: true;
205
179
  }): RebuildIntegration;
206
180
  export declare function inspectRebuildTarget(options: {
207
181
  sourceId?: string;
@@ -215,7 +189,6 @@ export declare function inspectRebuildTarget(options: {
215
189
  cwd: string;
216
190
  catalog: CatalogResolution;
217
191
  context: RebuildExecutionContext;
218
- userActivationDesired?: ReadonlySet<string>;
219
192
  nativeProbe?: NativeOwnershipProbe;
220
193
  shallow?: boolean;
221
194
  }): Promise<{
@@ -15,7 +15,7 @@ import { inspectCodexSharedNative, isCanonicalCodexMarketplaceRegistration, } fr
15
15
  import { validateSkillDirectory } from '../utils/dynamic-skill-tree.js';
16
16
  import { parseCodexSharedHooksFile, serializeTrackedHookGroupIdentity, } from '../utils/hooks-contract.js';
17
17
  import { assertSafeNamespacedMarketplacePluginRoot, readStrictNamespacedMarketplaceRoot } from '../utils/local-marketplace.js';
18
- import { buildCodexMarketplaceRemoveInvocation, buildCodexPluginRemoveInvocation, CodexProjectConfigNotEffectiveError, runNativeCliChecked, SYSTEM_CODEX_MANAGER } from '../utils/native-cli.js';
18
+ import { buildCodexMarketplaceRemoveInvocation, buildCodexPluginRemoveInvocation, runNativeCliChecked, SYSTEM_CODEX_MANAGER } from '../utils/native-cli.js';
19
19
  import { inspectOwnedComponents, OWNED_TEXT_HEADER_PREFIX, parseOwnedTextHeader, parseSharedOwnerToken, readSkillOwnerMarker } from '../utils/ownership.js';
20
20
  import { resolveAwHome, resolveClaudePaths, resolveCodexPaths, resolveRepoRoot } from '../utils/paths.js';
21
21
  import { atomicRemoveConfigFile, atomicReplaceConfigFile, withConfigFileMutation, } from '../utils/plugin-config.js';
@@ -24,7 +24,8 @@ import { assertCanonicalProjectManagedRoots } from '../utils/project-boundary.js
24
24
  import { attachSafeOperationError, readSafeOperationError } from '../utils/safe-operation-diagnostic.js';
25
25
  import { createProjectLocationKey, resolveRequiredCanonicalRepoRoot, resolveClaudeProjectKey, resolveCodexProjectKey } from '../utils/state-paths.js';
26
26
  import { hasPermissionOwner, updateHostPermissions } from '../platforms/permission-ownership.js';
27
- import { resolvePlatformConfigRoot } from '../platforms/discovery.js';
27
+ import { codexProductManager } from '../platforms/inspection-native.js';
28
+ import { resolvePlatformConfigRoot, selectNativeProduct } from '../platforms/discovery.js';
28
29
  import { canonicalNamespaceRoot } from '../platforms/identity.js';
29
30
  import { getManagedPlatformRoot } from '../platforms/layout.js';
30
31
  import { platformOwnership, PlatformRebuildSession } from './rebuild-platform-integration.js';
@@ -72,22 +73,14 @@ export async function disposePreparedPlatformRebuildSession(results) {
72
73
  }));
73
74
  }
74
75
  }
75
- export class CodexActivationPostcheckError extends Error {
76
- code = 'codexActivationPostcheckFailed';
77
- codexPluginIds;
78
- constructor(codexPluginIds, detail) {
79
- super(`codexActivationPostcheckFailed: ${detail}`);
80
- this.name = 'CodexActivationPostcheckError';
81
- this.codexPluginIds = [...new Set(typeof codexPluginIds === 'string' ? [codexPluginIds] : codexPluginIds)];
82
- }
76
+ function codexObservation(context, cwd, manager = context.codexManager) {
77
+ const batch = context.nativeObservationBatch;
78
+ return batch?.readContextFor('codex', batch.phase === 'locked-execution' ? 'execution' : 'ordinary', { cwd, env: context.env, codexManager: manager }).codexObservationSession;
83
79
  }
84
80
  function codexObservationScope(context, marketplaceName, fallbackScope) {
85
81
  return context.codexObservationScopeByMarketplace?.get(marketplaceName)
86
82
  ?? (fallbackScope === 'user' ? 'user' : 'both');
87
83
  }
88
- function codexMarketplaceFromPluginId(pluginId) {
89
- return pluginId.slice(pluginId.lastIndexOf('@') + 1);
90
- }
91
84
  function requireCodexObservationCoverage(registration, scope, operation) {
92
85
  if (!registration.observations.user
93
86
  || (scope === 'both' && !registration.observations.project)) {
@@ -100,235 +93,6 @@ function requireCodexManager(manager) {
100
93
  }
101
94
  return manager;
102
95
  }
103
- async function runCodexMutationWithInvalidation(options) {
104
- try {
105
- return await options.mutation();
106
- }
107
- finally {
108
- options.observationSession?.invalidate(options.marketplaceName);
109
- }
110
- }
111
- async function executeCodexReconcileActivationsInSession(options) {
112
- const byScope = {
113
- user: { upserts: {}, removals: new Set() },
114
- project: { upserts: {}, removals: new Set() },
115
- };
116
- for (const plan of options.plans) {
117
- const rewrittenPluginIds = new Set(plan.sharedNativeActions
118
- .filter((action) => action.action === 'install'
119
- || action.action === 'replace'
120
- || action.action === 'repair')
121
- .map((action) => action.codexPluginId));
122
- for (const scope of ['user', 'project']) {
123
- for (const action of plan.activationActions[scope]) {
124
- if (action.action === 'enable' || action.action === 'disable') {
125
- byScope[scope].upserts[action.codexPluginId] = action.desired;
126
- byScope[scope].removals.delete(action.codexPluginId);
127
- }
128
- else if (action.action === 'remove') {
129
- byScope[scope].removals.add(action.codexPluginId);
130
- }
131
- else if (rewrittenPluginIds.has(action.codexPluginId)
132
- && (action.desired || scope === 'user')) {
133
- byScope[scope].upserts[action.codexPluginId] = action.desired;
134
- byScope[scope].removals.delete(action.codexPluginId);
135
- }
136
- }
137
- }
138
- for (const removal of plan.staleActivationRemovals) {
139
- if (!Object.hasOwn(byScope[removal.scope].upserts, removal.codexPluginId)) {
140
- byScope[removal.scope].removals.add(removal.codexPluginId);
141
- }
142
- }
143
- }
144
- const recordActivationMutations = (pluginIds) => {
145
- if (!options.mutationMarketplaces)
146
- return;
147
- for (const pluginId of pluginIds) {
148
- options.mutationMarketplaces.add(pluginId.slice(pluginId.lastIndexOf('@') + 1));
149
- }
150
- };
151
- const observedActivationPluginIds = [...new Set(options.plans.flatMap((plan) => plan.postcheck.support === 'observed'
152
- ? plan.postcheck.plugins.map((plugin) => plugin.codexPluginId)
153
- : []))];
154
- if (!options.preflightCompleted && observedActivationPluginIds.length > 0) {
155
- const manager = requireCodexManager(options.manager);
156
- for (const pluginId of observedActivationPluginIds) {
157
- const marketplaceName = codexMarketplaceFromPluginId(pluginId);
158
- const observationScope = options.observationScopeByMarketplace?.get(marketplaceName)
159
- ?? (options.plans.some((plan) => plan.requirement.scope === 'project')
160
- ? 'both'
161
- : 'user');
162
- const registration = await inspectCodexPluginRegistrationLive({
163
- pluginId,
164
- cwd: options.cwd,
165
- env: options.env,
166
- nativeCliRunner: options.runner,
167
- manager,
168
- scope: observationScope,
169
- observationSession: options.observationSession,
170
- });
171
- const observedState = requireObservedCodexNativeState(registration.observation, 'activation precheck');
172
- requireCodexObservationCoverage(registration, observationScope, 'activation precheck');
173
- if (observedState !== 'installed') {
174
- throw new Error('codexNativeObservationFailed: activation precheck did not observe the installed Codex plugin.');
175
- }
176
- }
177
- }
178
- for (const scope of ['user', 'project']) {
179
- const enables = Object.fromEntries(Object.entries(byScope[scope].upserts)
180
- .filter(([, desired]) => desired));
181
- if (Object.keys(enables).length === 0)
182
- continue;
183
- const configPath = resolveCodexPaths(options.cwd, scope, options.env).configTomlPath;
184
- const update = await applyCodexConfigTransactionFile(configPath, { upsertPluginActivations: enables });
185
- if (update.wrote)
186
- recordActivationMutations(Object.keys(enables));
187
- const enabledConfig = await readCodexConfigFile(configPath);
188
- const missingEnables = Object.keys(enables).filter((pluginId) => enabledConfig.snapshot.plugins[pluginId]?.enabled !== true);
189
- if (missingEnables.length > 0) {
190
- throw new CodexActivationPostcheckError(missingEnables, `${missingEnables.join(', ')} ${scope} activation was not enabled before obsolete activation removal.`);
191
- }
192
- }
193
- for (const scope of ['user', 'project']) {
194
- const transaction = byScope[scope];
195
- const disables = Object.fromEntries(Object.entries(transaction.upserts)
196
- .filter(([, desired]) => !desired));
197
- if (Object.keys(disables).length === 0 && transaction.removals.size === 0)
198
- continue;
199
- const update = await applyCodexConfigTransactionFile(resolveCodexPaths(options.cwd, scope, options.env).configTomlPath, {
200
- ...(transaction.removals.size > 0
201
- ? { removePluginActivations: [...transaction.removals].sort() }
202
- : {}),
203
- ...(Object.keys(disables).length > 0
204
- ? { upsertPluginActivations: disables }
205
- : {}),
206
- });
207
- if (update.wrote) {
208
- recordActivationMutations([
209
- ...Object.keys(disables),
210
- ...transaction.removals,
211
- ]);
212
- }
213
- }
214
- const [userConfig, projectConfig] = await Promise.all([
215
- readCodexConfigFile(resolveCodexPaths(options.cwd, 'user', options.env).configTomlPath),
216
- readCodexConfigFile(resolveCodexPaths(options.cwd, 'project', options.env).configTomlPath),
217
- ]);
218
- const configMismatchIds = [];
219
- const configMismatchDetails = [];
220
- for (const plan of options.plans) {
221
- for (const scope of ['user', 'project']) {
222
- const snapshot = scope === 'user' ? userConfig.snapshot : projectConfig.snapshot;
223
- for (const action of plan.activationActions[scope]) {
224
- const actual = snapshot.plugins[action.codexPluginId]?.enabled;
225
- const expected = action.desired
226
- ? true
227
- : action.action === 'disable' || actual === false ? false : undefined;
228
- if (actual !== expected) {
229
- configMismatchIds.push(action.codexPluginId);
230
- configMismatchDetails.push(`${action.codexPluginId} ${scope} activation is ${String(actual)}; expected ${String(expected)}.`);
231
- }
232
- }
233
- for (const removal of plan.staleActivationRemovals.filter((entry) => entry.scope === scope)) {
234
- if (snapshot.plugins[removal.codexPluginId]?.enabled !== undefined) {
235
- configMismatchIds.push(removal.codexPluginId);
236
- configMismatchDetails.push(`stale ${removal.codexPluginId} ${scope} activation remains.`);
237
- }
238
- }
239
- }
240
- }
241
- if (configMismatchIds.length > 0) {
242
- throw new CodexActivationPostcheckError(configMismatchIds, configMismatchDetails.join(' '));
243
- }
244
- const observedActivationChecks = options.plans.flatMap((plan) => plan.postcheck.support === 'observed'
245
- ? plan.postcheck.plugins
246
- : []);
247
- if (observedActivationChecks.length === 0)
248
- return;
249
- const ineffectivePlugins = [];
250
- const ineffectiveDetails = [];
251
- for (const plugin of observedActivationChecks) {
252
- const userActive = userConfig.snapshot.plugins[plugin.codexPluginId]?.enabled === true;
253
- const projectActive = projectConfig.snapshot.plugins[plugin.codexPluginId]?.enabled === true;
254
- if ((userActive || projectActive) !== (plugin.expectedUserEnabled || plugin.expectedProjectEnabled)
255
- || userActive !== plugin.expectedUserEnabled) {
256
- ineffectivePlugins.push(plugin.codexPluginId);
257
- ineffectiveDetails.push(new CodexProjectConfigNotEffectiveError(plugin.codexPluginId).message);
258
- }
259
- }
260
- if (ineffectivePlugins.length > 0) {
261
- throw new CodexActivationPostcheckError(ineffectivePlugins, ineffectiveDetails.join(' '));
262
- }
263
- }
264
- export async function executeCodexReconcileActivations(options) {
265
- const ownedSession = options.observationSession ? undefined
266
- : await createCodexNativeObservationSession({
267
- exactCwd: options.cwd,
268
- env: options.env,
269
- runner: options.runner,
270
- manager: options.manager,
271
- });
272
- try {
273
- await executeCodexReconcileActivationsInSession({
274
- ...options,
275
- observationSession: options.observationSession ?? ownedSession,
276
- });
277
- }
278
- finally {
279
- await ownedSession?.dispose();
280
- }
281
- }
282
- export async function postcheckCodexReconcileActivations(options) {
283
- const checks = options.plans.flatMap((plan) => plan.postcheck.support === 'observed' ? plan.postcheck.plugins : []);
284
- if (checks.length === 0)
285
- return;
286
- const ownedSession = options.observationSession ? undefined
287
- : await createCodexNativeObservationSession({
288
- exactCwd: options.cwd,
289
- env: options.env,
290
- runner: options.runner,
291
- manager: options.manager,
292
- });
293
- const session = options.observationSession ?? ownedSession;
294
- try {
295
- const failedPluginIds = [];
296
- const failureDetails = [];
297
- for (const check of checks) {
298
- try {
299
- const marketplaceName = codexMarketplaceFromPluginId(check.codexPluginId);
300
- const observationScope = options.observationScopeByMarketplace?.get(marketplaceName)
301
- ?? (options.plans.some((plan) => plan.requirement.scope === 'project')
302
- ? 'both'
303
- : 'user');
304
- const registration = await inspectCodexPluginRegistrationLive({
305
- pluginId: check.codexPluginId,
306
- cwd: options.cwd,
307
- env: options.env,
308
- nativeCliRunner: options.runner,
309
- manager: options.manager,
310
- scope: observationScope,
311
- observationSession: session,
312
- });
313
- const state = requireObservedCodexNativeState(registration.observation, 'activation postcheck');
314
- requireCodexObservationCoverage(registration, observationScope, 'activation postcheck');
315
- if (state !== 'installed') {
316
- throw new Error(`codexNativeObservationFailed: ${check.codexPluginId} was not observed after Codex activation mutation.`);
317
- }
318
- }
319
- catch (error) {
320
- failedPluginIds.push(check.codexPluginId);
321
- failureDetails.push(error instanceof Error ? error.message : String(error));
322
- }
323
- }
324
- if (failedPluginIds.length > 0) {
325
- throw new CodexActivationPostcheckError(failedPluginIds, failureDetails.join(' '));
326
- }
327
- }
328
- finally {
329
- await ownedSession?.dispose();
330
- }
331
- }
332
96
  const CODEX_REMOVE_RECOVERY = 'Codex residue was retained. Retry cleanup or uninstall, upgrade AW, or install a compatible official Codex CLI.';
333
97
  function pluginActionId(plugin) {
334
98
  return plugin.pluginId ?? plugin.manifest.name;
@@ -1024,7 +788,7 @@ function createNativeDriver(options) {
1024
788
  nativeCliRunner: runner,
1025
789
  manager: currentCodexManager(),
1026
790
  scope,
1027
- observationSession: options.context.codexObservationSession,
791
+ observationSession: codexObservation(options.context, target.identity.cwd),
1028
792
  });
1029
793
  const state = requireObservedCodexNativeState(registration.observation, 'native install postcheck');
1030
794
  requireCodexObservationCoverage(registration, scope, 'native install postcheck');
@@ -1057,12 +821,14 @@ function createNativeDriver(options) {
1057
821
  return target;
1058
822
  };
1059
823
  const codexStateKey = (target, pluginId) => `${nativeGroupKey(target)}\0${pluginId}`;
1060
- const runObservedCodexMutation = async (options_) => runCodexMutationWithInvalidation({
1061
- ...options_,
1062
- ...(options.operationScopedNativePhases
1063
- ? {}
1064
- : { observationSession: options.context.codexObservationSession }),
1065
- });
824
+ const runObservedCodexMutation = async (mutation) => {
825
+ try {
826
+ return await mutation();
827
+ }
828
+ finally {
829
+ options.context.nativeObservationBatch?.invalidatePlatform('codex', 'inspect');
830
+ }
831
+ };
1066
832
  const prepareNativeGroup = async (target) => {
1067
833
  for (const member of groupTargets(target)) {
1068
834
  if (member.identity.platform !== 'codex')
@@ -1073,7 +839,7 @@ function createNativeDriver(options) {
1073
839
  const registration = await inspectCodexPluginRegistrationLive({ pluginId: component.pluginId,
1074
840
  cwd: member.identity.cwd, env: options.context.env, nativeCliRunner: runner,
1075
841
  manager: currentCodexManager(), scope: observationScopeFor(member),
1076
- observationSession: options.context.codexObservationSession });
842
+ observationSession: codexObservation(options.context, member.identity.cwd) });
1077
843
  codexNativeStates.set(codexStateKey(member, component.pluginId), requireObservedCodexNativeState(registration.observation, 'native cleanup precheck') === 'installed' ? 'present' : 'absent');
1078
844
  }
1079
845
  }
@@ -1107,14 +873,15 @@ function createNativeDriver(options) {
1107
873
  ].filter((pluginId) => pluginId.endsWith(suffix));
1108
874
  if (configuredPluginIds.some((pluginId) => pluginId !== currentPluginId))
1109
875
  return 'absent';
1110
- const ownedSession = options.context.codexObservationSession ? undefined
876
+ const current = codexObservation(options.context, target.identity.cwd);
877
+ const ownedSession = current ? undefined
1111
878
  : await createCodexNativeObservationSession({
1112
879
  exactCwd: target.identity.cwd,
1113
880
  env: options.context.env,
1114
881
  runner,
1115
882
  manager: currentCodexManager() ?? SYSTEM_CODEX_MANAGER,
1116
883
  });
1117
- const session = options.context.codexObservationSession ?? ownedSession;
884
+ const session = current ?? ownedSession;
1118
885
  try {
1119
886
  const observationScope = observationScopeFor(target);
1120
887
  const snapshot = await session.snapshot(component.locator.marketplaceName, observationScope);
@@ -1293,10 +1060,7 @@ function createNativeDriver(options) {
1293
1060
  && pendingCodexNativeStates.get(stateKey) !== 'absent')
1294
1061
  return;
1295
1062
  codexMutationMarketplaces.add(locator.marketplaceName);
1296
- await runObservedCodexMutation({
1297
- marketplaceName: locator.marketplaceName,
1298
- mutation: () => runNativeCliChecked(buildCodexMarketplaceRemoveInvocation(currentCodexManager() ?? SYSTEM_CODEX_MANAGER, locator.marketplaceName, target.identity.cwd, options.context.env), runner),
1299
- });
1063
+ await runObservedCodexMutation(() => runNativeCliChecked(buildCodexMarketplaceRemoveInvocation(currentCodexManager() ?? SYSTEM_CODEX_MANAGER, locator.marketplaceName, target.identity.cwd, options.context.env), runner));
1300
1064
  return;
1301
1065
  }
1302
1066
  case 'claude-marketplace': {
@@ -1353,7 +1117,6 @@ function createNativeDriver(options) {
1353
1117
  setNativeMarketplaceEligibleTargets: (eligibleTargets) => {
1354
1118
  nativeMarketplaceEligibleTargets = new Set(eligibleTargets);
1355
1119
  },
1356
- prepareNativeMarketplaceGroup: prepareNativeGroup,
1357
1120
  postcheckCodexProvider: async (target) => {
1358
1121
  const pending = deferredPostchecks.filter((entry) => entry.target === target);
1359
1122
  deferredPostchecks = deferredPostchecks.filter((entry) => entry.target !== target);
@@ -1363,8 +1126,7 @@ function createNativeDriver(options) {
1363
1126
  ? [plan.evidence.layout.marketplaceName] : []));
1364
1127
  if (target.requiresNative)
1365
1128
  marketplaces.add(target.identity.marketplaceName ?? MARKETPLACE_NAME);
1366
- for (const name of marketplaces)
1367
- options.context.codexObservationSession?.invalidate(name);
1129
+ options.context.nativeObservationBatch?.refreshExecutionInspection('codex');
1368
1130
  if (!pending.length)
1369
1131
  await target.platformDeployment?.verify();
1370
1132
  for (const entry of pending)
@@ -1380,7 +1142,7 @@ function createNativeDriver(options) {
1380
1142
  deferredPostchecks.push({
1381
1143
  target,
1382
1144
  postcheck: async () => {
1383
- if (target.requiresNative) {
1145
+ if (target.requiresNative && !target.platformDeployment?.hasCurrentNoWriteSettlement?.()) {
1384
1146
  const marketplaceName = target.identity.marketplaceName ?? MARKETPLACE_NAME;
1385
1147
  await checkCodexInstalledVersion(target, `${target.identity.pluginName}@${marketplaceName}`, marketplaceName);
1386
1148
  }
@@ -1404,31 +1166,33 @@ function createNativeDriver(options) {
1404
1166
  return failures;
1405
1167
  },
1406
1168
  } : {}),
1407
- captureCodexPostMutationSnapshots: async (marketplaceNames = []) => {
1408
- for (const marketplaceName of marketplaceNames) {
1409
- codexMutationMarketplaces.add(marketplaceName);
1410
- }
1411
- const changedMarketplaces = [...codexMutationMarketplaces];
1412
- const marketplaces = [...new Set([...changedMarketplaces, ...deferredPostchecks.flatMap(({ target }) => (target.platformDeployment?.plans ?? []).flatMap((plan) => plan.evidence.layout.marketplaceName
1169
+ captureCodexPostMutationSnapshots: async () => {
1170
+ const marketplaces = [...new Set([...codexMutationMarketplaces, ...deferredPostchecks.flatMap(({ target }) => (target.platformDeployment?.plans ?? []).flatMap((plan) => plan.evidence.layout.marketplaceName
1413
1171
  && plan.projections.some((projection) => projection.bundle) ? [plan.evidence.layout.marketplaceName] : []))])].sort();
1414
1172
  if (marketplaces.length === 0)
1415
1173
  return;
1416
- const session = options.context.codexObservationSession;
1417
- if (!session) {
1418
- throw new Error('codexNativeObservationUnavailable: grouped postcheck requires an observation session.');
1419
- }
1420
1174
  codexMutationMarketplaces.clear();
1421
- // Platform mutations already invalidated and observed their generation.
1422
- // Only legacy writes still deferred in the dirty set need invalidation.
1423
- for (const marketplaceName of changedMarketplaces)
1424
- session.invalidate(marketplaceName);
1425
- await Promise.all(marketplaces.map((marketplaceName) => session.snapshot(marketplaceName, options.context.codexObservationScopeByMarketplace?.get(marketplaceName)
1426
- ?? (options.targets.some((target) => (nativeMarketplaceEligibleTargets?.has(target) ?? true)
1427
- && target.identity.platform === 'codex'
1428
- && (target.platformDeployment ? target.platformDeployment.plans.some((plan) => plan.evidence.layout.marketplaceName === marketplaceName && plan.binding.scope.kind === 'project')
1429
- : (target.identity.marketplaceName ?? MARKETPLACE_NAME) === marketplaceName && target.identity.scope === 'project'))
1430
- ? 'both'
1431
- : 'user'))));
1175
+ await Promise.all(marketplaces.map(async (marketplaceName) => {
1176
+ const target = options.targets.find((target) => target.identity.platform === 'codex'
1177
+ && ((target.identity.marketplaceName ?? MARKETPLACE_NAME) === marketplaceName
1178
+ || target.platformDeployment?.plans.some((plan) => plan.evidence.layout.marketplaceName === marketplaceName)));
1179
+ if (!target)
1180
+ throw new Error('codexNativeObservationUnavailable: grouped postcheck requires a prepared target.');
1181
+ const cwd = target.identity.cwd;
1182
+ const binding = target.platformDeployment?.plans.find((plan) => plan.evidence.layout.marketplaceName === marketplaceName)?.binding;
1183
+ const product = binding && selectNativeProduct(binding.consumers);
1184
+ const manager = options.context.codexManager ?? (product && await codexProductManager(product, { cwd, env: options.context.env }));
1185
+ const session = codexObservation(options.context, cwd, manager);
1186
+ if (!session)
1187
+ throw new Error('codexNativeObservationUnavailable: grouped postcheck requires an observation batch.');
1188
+ await session.snapshot(marketplaceName, options.context.codexObservationScopeByMarketplace?.get(marketplaceName)
1189
+ ?? (options.targets.some((target) => (nativeMarketplaceEligibleTargets?.has(target) ?? true)
1190
+ && target.identity.platform === 'codex'
1191
+ && (target.platformDeployment ? target.platformDeployment.plans.some((plan) => plan.evidence.layout.marketplaceName === marketplaceName && plan.binding.scope.kind === 'project')
1192
+ : (target.identity.marketplaceName ?? MARKETPLACE_NAME) === marketplaceName && target.identity.scope === 'project'))
1193
+ ? 'both'
1194
+ : 'user'));
1195
+ }));
1432
1196
  },
1433
1197
  preflightMaterialize: async (target) => {
1434
1198
  if (target.identity.sourceId && options.context.expectedCatalogConfigDigest) {
@@ -1477,7 +1241,7 @@ function createNativeDriver(options) {
1477
1241
  nativeCliRunner: runner,
1478
1242
  manager: currentCodexManager(),
1479
1243
  scope: observationScopeFor(target),
1480
- observationSession: options.context.codexObservationSession,
1244
+ observationSession: codexObservation(options.context, target.identity.cwd),
1481
1245
  });
1482
1246
  return observedCodexNativeState(registration.observation, 'native probe');
1483
1247
  }
@@ -1511,7 +1275,7 @@ function createNativeDriver(options) {
1511
1275
  nativeCliRunner: runner,
1512
1276
  manager: currentCodexManager(),
1513
1277
  scope: observationScopeFor(target),
1514
- observationSession: options.context.codexObservationSession,
1278
+ observationSession: codexObservation(options.context, target.identity.cwd),
1515
1279
  });
1516
1280
  const nativeState = observedCodexNativeState(registration.observation, 'native health postcheck');
1517
1281
  if (nativeState !== 'present')
@@ -1544,10 +1308,7 @@ function createNativeDriver(options) {
1544
1308
  return;
1545
1309
  try {
1546
1310
  codexMutationMarketplaces.add(marketplaceName);
1547
- await runObservedCodexMutation({
1548
- marketplaceName,
1549
- mutation: () => runNativeCliChecked(buildCodexPluginRemoveInvocation(requireCodexManager(currentCodexManager()), component.pluginId, target.identity.cwd, options.context.env), runner),
1550
- });
1311
+ await runObservedCodexMutation(() => runNativeCliChecked(buildCodexPluginRemoveInvocation(requireCodexManager(currentCodexManager()), component.pluginId, target.identity.cwd, options.context.env), runner));
1551
1312
  }
1552
1313
  catch (error) {
1553
1314
  const diagnostic = readSafeOperationError(error);
@@ -1569,7 +1330,7 @@ function createNativeDriver(options) {
1569
1330
  nativeCliRunner: runner,
1570
1331
  manager: currentCodexManager(),
1571
1332
  scope: observationScopeFor(target),
1572
- observationSession: options.context.codexObservationSession,
1333
+ observationSession: codexObservation(options.context, target.identity.cwd),
1573
1334
  });
1574
1335
  const expected = pendingCodexNativeStates.get(stateKey) ?? 'absent';
1575
1336
  const observed = requireObservedCodexNativeState(after.observation, 'native mutation postcheck');
@@ -1628,6 +1389,10 @@ function createNativeDriver(options) {
1628
1389
  scope: invocation.target.identity.scope,
1629
1390
  cwd: invocation.target.identity.cwd,
1630
1391
  context: options.context,
1392
+ onScriptExecuted: () => {
1393
+ options.context.nativeObservationBatch?.invalidateAll();
1394
+ options.context.catalogReadScope?.invalidateBundleReads();
1395
+ },
1631
1396
  referencePlugins: options.context.referencePlugins,
1632
1397
  scriptTimeoutMs: options.scriptTimeoutMs,
1633
1398
  });
@@ -1678,21 +1443,25 @@ export function createRebuildIntegration(options) {
1678
1443
  const renderResults = options.context.preparedArtifactRenderResults ??= new Map();
1679
1444
  const packageCache = options.context.packagePreparationCache
1680
1445
  ?? commandPackageCandidates.get(renderResults) ?? new Map();
1681
- commandPackageCandidates.set(renderResults, packageCache);
1446
+ if (!options.isolatedObservation)
1447
+ commandPackageCandidates.set(renderResults, packageCache);
1682
1448
  options.context.packagePreparationCache = packageCache;
1683
1449
  const sessions = platformRebuildSessions.get(renderResults) ?? new Map();
1684
- platformRebuildSessions.set(renderResults, sessions);
1685
- const platformSession = options.context.platformRebuildSession
1686
- ?? sessions.get(options.context.batchInstallPlatform)
1687
- ?? new PlatformRebuildSession(options.context);
1688
- sessions.set(options.context.batchInstallPlatform, platformSession);
1450
+ if (!options.isolatedObservation)
1451
+ platformRebuildSessions.set(renderResults, sessions);
1452
+ const platformSession = options.isolatedObservation ? new PlatformRebuildSession(options.context)
1453
+ : options.context.platformRebuildSession
1454
+ ?? sessions.get(options.context.batchInstallPlatform)
1455
+ ?? new PlatformRebuildSession(options.context);
1456
+ if (!options.isolatedObservation)
1457
+ sessions.set(options.context.batchInstallPlatform, platformSession);
1689
1458
  options.context.platformRebuildSession = platformSession;
1690
1459
  platformSession.updateContext(options.context);
1691
1460
  platformSession.setOwnershipExecutor(driver.ownership);
1692
1461
  const targetPlatforms = new Map();
1693
1462
  return {
1694
- resolvePlatformTargets: async (inputs) => {
1695
- await platformSession.resolveAll(inputs);
1463
+ resolvePlatformTargets: async (inputs, captureOrdinary) => {
1464
+ await platformSession.resolveAll(inputs, captureOrdinary);
1696
1465
  for (const input of inputs) {
1697
1466
  const id = input.pluginId ?? pluginActionId(input.plugin);
1698
1467
  const platforms = targetPlatforms.get(id) ?? [];
@@ -1705,7 +1474,6 @@ export function createRebuildIntegration(options) {
1705
1474
  pendingOpenCodeProjectNotices: (interrupted) => platformSession.pendingOpenCodeProjectNotices(interrupted),
1706
1475
  driver,
1707
1476
  setNativeMarketplaceEligibleTargets: driver.setNativeMarketplaceEligibleTargets,
1708
- prepareNativeMarketplaceGroup: driver.prepareNativeMarketplaceGroup,
1709
1477
  postcheckCodexProvider: driver.postcheckCodexProvider,
1710
1478
  captureCodexPostMutationSnapshots: driver.captureCodexPostMutationSnapshots,
1711
1479
  buildTarget: async (input) => {
@@ -1741,11 +1509,7 @@ export function createRebuildIntegration(options) {
1741
1509
  }
1742
1510
  export async function inspectRebuildTarget(options) {
1743
1511
  const integration = createRebuildIntegration({
1744
- context: {
1745
- ...options.context,
1746
- codexUserActivationDesired: options.userActivationDesired
1747
- ?? options.context.codexUserActivationDesired,
1748
- },
1512
+ context: options.context,
1749
1513
  });
1750
1514
  const target = await integration.buildTarget({
1751
1515
  ...(options.sourceId ? {
@@ -1785,7 +1549,7 @@ export async function inspectRebuildTarget(options) {
1785
1549
  nativeCliRunner: options.context.nativeCliRunner,
1786
1550
  manager: options.context.codexManager,
1787
1551
  scope: target.identity.scope,
1788
- observationSession: options.context.codexObservationSession,
1552
+ observationSession: codexObservation(options.context, target.identity.cwd),
1789
1553
  });
1790
1554
  return registration.observation.state === 'observed'
1791
1555
  && registration.observation.value === 'installed'