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

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.
@@ -19,6 +19,7 @@ import { createCodexSkillExpectedTree, createCodexSkillStagingTreeContentDigest,
19
19
  import { AW_PLUGIN_REQUIREMENTS_RECEIPT_PATH, createDynamicSkillExpectedTree, createDynamicSkillTreeContentDigest, readDynamicSkillTree, validateSkillDirectory, writeDynamicSkillTree, } from '../utils/dynamic-skill-tree.js';
20
20
  import { parseCodexSharedHooksFile, serializeTrackedHookGroupIdentity, } from '../utils/hooks-contract.js';
21
21
  import { buildCodexMarketplaceAddInvocation, buildCodexMarketplaceRemoveInvocation, buildCodexPluginAddInvocation, buildCodexPluginRemoveInvocation, CodexProjectConfigNotEffectiveError, runNativeCliChecked, SYSTEM_CODEX_MANAGER, } from '../utils/native-cli.js';
22
+ import { attachSafeOperationError, readSafeOperationError } from '../utils/safe-operation-diagnostic.js';
22
23
  import { OWNED_TEXT_HEADER_PREFIX, createSharedOwnerToken, createSkillOwnerMarkerContent, parseSharedOwnerToken, parseOwnedTextHeader, readSkillOwnerMarker, renderOwnedTextFile, inspectOwnedComponents, writeOwnedTextFile, } from '../utils/ownership.js';
23
24
  import { resolveArtifactRenderConfig, resolveArtifactRendererTarget, runArtifactRenderer, } from '../utils/artifact-renderer.js';
24
25
  import { createArtifactConfigDigest, validateArtifactPlan, } from '../utils/artifact-plan.js';
@@ -301,7 +302,7 @@ async function executeCodexReconcileActivationsInSession(options) {
301
302
  for (const pluginId of observedActivationPluginIds) {
302
303
  const marketplaceName = codexMarketplaceFromPluginId(pluginId);
303
304
  const observationScope = options.observationScopeByMarketplace?.get(marketplaceName)
304
- ?? (options.plans.some((plan) => plan.requirement.requiresProjectPluginContract)
305
+ ?? (options.plans.some((plan) => plan.requirement.scope === 'project')
305
306
  ? 'both'
306
307
  : 'user');
307
308
  const registration = await inspectCodexPluginRegistrationLive({
@@ -443,7 +444,7 @@ export async function postcheckCodexReconcileActivations(options) {
443
444
  try {
444
445
  const marketplaceName = codexMarketplaceFromPluginId(check.codexPluginId);
445
446
  const observationScope = options.observationScopeByMarketplace?.get(marketplaceName)
446
- ?? (options.plans.some((plan) => plan.requirement.requiresProjectPluginContract)
447
+ ?? (options.plans.some((plan) => plan.requirement.scope === 'project')
447
448
  ? 'both'
448
449
  : 'user');
449
450
  const registration = await inspectCodexPluginRegistrationLive({
@@ -4000,6 +4001,11 @@ function createNativeDriver(options) {
4000
4001
  return;
4001
4002
  const target = findTarget(component);
4002
4003
  await prepareNativeGroup(target);
4004
+ const pluginId = `${target.identity.pluginName}@${locator.marketplaceName}`;
4005
+ const stateKey = codexStateKey(target, pluginId);
4006
+ if (codexNativeStates.get(stateKey) === 'present'
4007
+ && pendingCodexNativeStates.get(stateKey) !== 'absent')
4008
+ return;
4003
4009
  codexMutationMarketplaces.add(locator.marketplaceName);
4004
4010
  await runObservedCodexMutation({
4005
4011
  marketplaceName: locator.marketplaceName,
@@ -4330,8 +4336,16 @@ function createNativeDriver(options) {
4330
4336
  mutation: () => runNativeCliChecked(buildCodexPluginRemoveInvocation(requireCodexManager(currentCodexManager()), component.pluginId, target.identity.cwd, options.context.env), runner),
4331
4337
  });
4332
4338
  }
4333
- catch {
4334
- throw new Error(`codexNativeRemoveFailed: ${CODEX_REMOVE_RECOVERY}`);
4339
+ catch (error) {
4340
+ const diagnostic = readSafeOperationError(error);
4341
+ throw attachSafeOperationError(new Error(`codexNativeRemoveFailed: ${CODEX_REMOVE_RECOVERY}`), {
4342
+ code: 'codexNativeRemoveFailed',
4343
+ safeMessage: `Codex plugin removal did not complete. ${CODEX_REMOVE_RECOVERY}`,
4344
+ ...(diagnostic?.exitCode === undefined ? {} : { exitCode: diagnostic.exitCode }),
4345
+ ...(diagnostic ? {
4346
+ cause: { code: diagnostic.code, safeMessage: diagnostic.safeMessage },
4347
+ } : {}),
4348
+ });
4335
4349
  }
4336
4350
  pendingCodexNativeStates.set(stateKey, 'absent');
4337
4351
  const postcheck = async () => {