@lesliechan721/aw 0.1.0-beta.56 → 0.1.0-beta.58

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 (33) hide show
  1. package/dist/src/commands/rebuild-command.js +70 -2
  2. package/dist/src/commands/rebuild-command.js.map +1 -1
  3. package/dist/src/commands/rebuild-integration.js +18 -4
  4. package/dist/src/commands/rebuild-integration.js.map +1 -1
  5. package/dist/src/commands/rebuild-operations.js +2 -0
  6. package/dist/src/commands/rebuild-operations.js.map +1 -1
  7. package/dist/src/commands/status-v6.js +3 -5
  8. package/dist/src/commands/status-v6.js.map +1 -1
  9. package/dist/src/constants.d.ts +1 -2
  10. package/dist/src/constants.js +1 -2
  11. package/dist/src/constants.js.map +1 -1
  12. package/dist/src/output/command-receipt.js +2 -6
  13. package/dist/src/output/command-receipt.js.map +1 -1
  14. package/dist/src/tui/controller.js +6 -3
  15. package/dist/src/tui/controller.js.map +1 -1
  16. package/dist/src/tui/model.d.ts +1 -0
  17. package/dist/src/tui/model.js +1 -1
  18. package/dist/src/tui/model.js.map +1 -1
  19. package/dist/src/types.d.ts +0 -1
  20. package/dist/src/types.js.map +1 -1
  21. package/dist/src/utils/agent-version.js +2 -6
  22. package/dist/src/utils/agent-version.js.map +1 -1
  23. package/dist/src/utils/codex-manager.d.ts +3 -3
  24. package/dist/src/utils/codex-manager.js +8 -20
  25. package/dist/src/utils/codex-manager.js.map +1 -1
  26. package/dist/src/utils/codex-reconciler.js +3 -3
  27. package/dist/src/utils/codex-reconciler.js.map +1 -1
  28. package/dist/src/utils/ownership.d.ts +2 -0
  29. package/dist/src/utils/ownership.js +6 -1
  30. package/dist/src/utils/ownership.js.map +1 -1
  31. package/dist/src/utils/process-lock.js +12 -5
  32. package/dist/src/utils/process-lock.js.map +1 -1
  33. package/package.json +3 -3
@@ -16,6 +16,7 @@ import { analyzeCodexSurface } from '../utils/codex-surface-analysis.js';
16
16
  import { buildGeneratedName } from '../generators/shared.js';
17
17
  import { createCodexReconcilePlan, } from '../utils/codex-reconciler.js';
18
18
  import { readCodexConfigFile } from '../utils/codex-config.js';
19
+ import { isCanonicalCodexMarketplaceRegistration } from '../utils/codex-shared-native.js';
19
20
  import { executeRebuildComponentCleanup, executeRebuildOperation, prepareRebuildOperation, } from './rebuild-operations.js';
20
21
  import { assertNoClaudeUnboundNativeNameCollision, CodexActivationPostcheckError, createRebuildIntegration, executeCodexReconcileActivations, inspectCodexPluginRegistrationLive, inspectCodexSharedNativeLive, hasPreparedStaticNativeCommandDrift, inspectNativeMarketplaceRegistrations, removeCodexPluginActivation, removeNamespacedMarketplacePluginProjection, postcheckCodexReconcileActivations, } from './rebuild-integration.js';
21
22
  import { assertSafeNamespacedMarketplacePluginRoot, getNamespacedMarketplaceName, readStrictNamespacedMarketplaceRoot, } from '../utils/local-marketplace.js';
@@ -3413,6 +3414,7 @@ async function runRebuildCommandInSession(options) {
3413
3414
  const executionContext = {
3414
3415
  env: runtimeEnv,
3415
3416
  nativeCliRunner: options.runtime?.nativeCliRunner ?? getDefaultNativeCliRunner(),
3417
+ codexManager: options.runtime?.codexManager,
3416
3418
  reporter: options.runtime?.reporter ?? createNoopReporter(),
3417
3419
  debugLogger: options.runtime?.debugLogger ?? createNoopDebugLogger(),
3418
3420
  expectedCatalogConfigDigest: catalog.configDigest,
@@ -4548,7 +4550,7 @@ async function runRebuildCommandInSession(options) {
4548
4550
  const previewActivationOnly = !previewNeedsNativeMaterialization
4549
4551
  && provisionalCodexPlans.some((plan) => plan.postcheck.support === 'observed'
4550
4552
  && plan.postcheck.plugins.length > 0);
4551
- const previewActivationScope = provisionalCodexPlans.some((plan) => plan.requirement.requiresProjectPluginContract) ? 'project' : 'user';
4553
+ const previewActivationScope = provisionalCodexPlans.some((plan) => plan.requirement.scope === 'project') ? 'project' : 'user';
4552
4554
  const previewConsumer = previewActivationOnly
4553
4555
  ? await (options.runtime?.codexOperationConsumerResolver ?? resolveCodexOperationConsumer)({
4554
4556
  cwd: options.commandOptions.cwd,
@@ -4915,6 +4917,71 @@ async function runRebuildCommandInSession(options) {
4915
4917
  && lockedCodexPlans.some((plan) => plan.review.requiresConfirmation)) {
4916
4918
  throw namespacedPreflightError('sharedNativeImpactAuthorizationRequired: Replacing or force-reinstalling shared Codex native state requires --yes.', preflightTargets);
4917
4919
  }
4920
+ if (!executionContext.codexManager) {
4921
+ const removalTargets = [];
4922
+ for (const [key, prepared] of lockedPreparation.preparedTargets) {
4923
+ const target = prepared.target;
4924
+ if (target.identity.platform !== 'codex'
4925
+ || target.writeNativeRequired
4926
+ || operationPreparationFailures.has(key))
4927
+ continue;
4928
+ const nativeComponents = target.ownedComponents.filter((component) => component.kind === 'native-plugin'
4929
+ || (component.kind === 'shared-config' && component.locator.kind === 'codex-marketplace'));
4930
+ if (nativeComponents.length === 0)
4931
+ continue;
4932
+ const inspected = await inspectOwnedComponents({
4933
+ components: nativeComponents,
4934
+ executor: lockedPreparation.integration.driver.ownership,
4935
+ nativeProbe: lockedPreparation.integration.driver.probeNative,
4936
+ });
4937
+ let requiresManager = inspected.components.some((component) => component.state === 'present'
4938
+ || (component.state === 'partial' && component.component.kind !== 'native-plugin'));
4939
+ if (!requiresManager && inspected.components.some((component) => component.component.kind === 'native-plugin'
4940
+ && (component.state === 'partial' || component.state === 'error'))) {
4941
+ try {
4942
+ const config = await readCodexConfigFile(resolveCodexPaths(target.identity.cwd, 'user', runtimeEnv).configTomlPath);
4943
+ requiresManager = Boolean(target.identity.marketplaceName && target.identity.marketplaceRoot
4944
+ && isCanonicalCodexMarketplaceRegistration(config.snapshot.marketplaces[target.identity.marketplaceName], target.identity.marketplaceRoot));
4945
+ }
4946
+ catch (error) {
4947
+ const message = error instanceof Error ? error.message : String(error);
4948
+ operationPreparationFailures.set(key, failedResult(options.command, target.identity, message));
4949
+ continue;
4950
+ }
4951
+ }
4952
+ if (requiresManager) {
4953
+ removalTargets.push({ key, target });
4954
+ }
4955
+ }
4956
+ if (removalTargets.length > 0) {
4957
+ try {
4958
+ const managerOptions = {
4959
+ cwd: options.commandOptions.cwd,
4960
+ env: runtimeEnv,
4961
+ runner: executionContext.nativeCliRunner,
4962
+ authorizer: options.runtime?.managedCodexAuthorizer,
4963
+ operationRequirement: getCodexOperationRequirement(options.commandOptions.scope),
4964
+ };
4965
+ if (options.runtime?.codexManagerResolver) {
4966
+ executionContext.codexManager = await options.runtime.codexManagerResolver(managerOptions);
4967
+ }
4968
+ else {
4969
+ const consumer = await (options.runtime?.codexOperationConsumerResolver ?? resolveCodexOperationConsumer)({ ...managerOptions, requiresNativeMaterialization: true });
4970
+ if (consumer.support !== 'observed') {
4971
+ throw new Error('Codex native removal requires an observed CLI consumer.');
4972
+ }
4973
+ executionContext.codexManager = consumer.manager;
4974
+ }
4975
+ executionContext.codexObservationSession?.setManager(executionContext.codexManager);
4976
+ }
4977
+ catch (error) {
4978
+ const message = error instanceof Error ? error.message : String(error);
4979
+ for (const { key, target } of removalTargets) {
4980
+ operationPreparationFailures.set(key, failedResult(options.command, target.identity, message));
4981
+ }
4982
+ }
4983
+ }
4984
+ }
4918
4985
  if (options.runtime?.awHomeMutationToken) {
4919
4986
  if (lifecycleCommand) {
4920
4987
  const preparedKeys = new Set(operationPreparations.keys());
@@ -5164,7 +5231,8 @@ async function runRebuildCommandInSession(options) {
5164
5231
  && plannedNativeAction !== undefined
5165
5232
  && (plannedNativeAction.action === 'reuse'
5166
5233
  || plannedNativeAction.action === 'none')
5167
- && !hasCodexExtensionMutation;
5234
+ && !hasCodexExtensionMutation
5235
+ && !lockedPreparation.preparedTargets.get(key)?.target.ownedComponents.some((component) => component.kind === 'native-plugin');
5168
5236
  if (failedDependency || failedConsumer || planned.action === 'block') {
5169
5237
  const code = failedConsumer
5170
5238
  ? 'dependencyStillRequired'