@lesliechan721/aw 0.1.0-beta.19 → 0.1.0-beta.20

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.
@@ -31,7 +31,6 @@ export interface RebuildIntegration {
31
31
  scope: Scope;
32
32
  disposition: 'remove' | 'disable';
33
33
  }>;
34
- preserveCodexSharedNativePayload?: boolean;
35
34
  }): Promise<DesiredTarget>;
36
35
  }
37
36
  export interface PreparedRebuildTarget {
@@ -1070,90 +1070,6 @@ async function resolveCodexSkillsRelativeRoot(plugin, marketplaceFallbackRoot) {
1070
1070
  }
1071
1071
  return normalized;
1072
1072
  }
1073
- async function buildBundledCodexSkillWrites(options) {
1074
- const relativeRoot = await resolveCodexSkillsRelativeRoot(options.plugin);
1075
- const sourceRoot = path.join(options.plugin.rootDir, ...relativeRoot.split('/'));
1076
- if (!await fs.pathExists(sourceRoot))
1077
- return [];
1078
- const dynamicKeys = new Set((options.plugin.manifest.artifacts?.targets ?? [])
1079
- .filter((target) => target.target === 'codex.skill' && target.skillKey)
1080
- .map((target) => target.skillKey));
1081
- const targetRoot = await canonicalizePathThroughExistingAncestor(path.join(options.marketplaceRoot ?? resolveAwHome(options.env), 'plugins', options.plugin.manifest.name, ...relativeRoot.split('/')));
1082
- const writes = [];
1083
- for (const entry of await fs.readdir(sourceRoot, { withFileTypes: true })) {
1084
- if (entry.isSymbolicLink()) {
1085
- throw new Error(`Codex skills source 不能包含符号链接:${entry.name}`);
1086
- }
1087
- if (!entry.isDirectory() || dynamicKeys.has(entry.name))
1088
- continue;
1089
- const skillSource = path.join(sourceRoot, entry.name);
1090
- if (!await fs.pathExists(path.join(skillSource, 'SKILL.md')))
1091
- continue;
1092
- const skillPath = path.join(targetRoot, entry.name);
1093
- const identity = ownerIdentity(options.plugin.manifest.name, entry.name, 'codex', 'user');
1094
- if (options.shallow) {
1095
- writes.push({
1096
- artifact: {
1097
- path: skillPath,
1098
- kind: 'skill',
1099
- platform: 'codex',
1100
- artifactKey: entry.name,
1101
- },
1102
- component: pathComponent({
1103
- kind: 'skill-directory',
1104
- path: skillPath,
1105
- allowedRoot: targetRoot,
1106
- identity,
1107
- }),
1108
- });
1109
- continue;
1110
- }
1111
- const tree = await createCodexSkillExpectedTree({
1112
- artifact: {
1113
- target: 'codex.skill',
1114
- skillKey: entry.name,
1115
- state: 'present',
1116
- content: { files: {} },
1117
- },
1118
- sourceDirs: [skillSource],
1119
- sourceRequirementsReceiptPolicy: 'allow',
1120
- });
1121
- const canRecoverPristine = await canonicalizePathThroughExistingAncestor(skillSource)
1122
- !== path.resolve(skillPath);
1123
- const component = pathComponent({
1124
- kind: 'skill-directory',
1125
- path: skillPath,
1126
- allowedRoot: targetRoot,
1127
- identity,
1128
- ...(canRecoverPristine
1129
- ? {
1130
- pristineTree: pristineTreeDescriptor(tree),
1131
- }
1132
- : {}),
1133
- });
1134
- writes.push({
1135
- artifact: {
1136
- path: skillPath,
1137
- paths: Object.keys(tree.files).map((relativePath) => path.join(skillPath, relativePath)),
1138
- kind: 'skill',
1139
- platform: 'codex',
1140
- artifactKey: entry.name,
1141
- },
1142
- component,
1143
- action: skillWriteAction({
1144
- plugin: options.plugin,
1145
- platform: 'codex',
1146
- scope: 'user',
1147
- path: skillPath,
1148
- allowedRoot: targetRoot,
1149
- identity,
1150
- tree,
1151
- allowPristineUnowned: canRecoverPristine,
1152
- }),
1153
- });
1154
- }
1155
- return writes;
1156
- }
1157
1073
  async function buildClaudeWrites(options) {
1158
1074
  const paths = resolveClaudePaths(options.cwd, options.scope, options.env);
1159
1075
  const writes = [];
@@ -1230,13 +1146,6 @@ async function buildCodexWrites(options) {
1230
1146
  const dynamicRoles = dynamic.artifacts.filter((entry) => entry.target === 'codex.agentRole');
1231
1147
  const dynamicSkills = dynamic.artifacts.filter((entry) => entry.target === 'codex.skill');
1232
1148
  const repoRoot = await resolveRepoRoot(options.cwd);
1233
- if (options.scope === 'user') {
1234
- writes.push(...await buildBundledCodexSkillWrites({
1235
- plugin: options.plugin,
1236
- env: options.env,
1237
- marketplaceRoot: options.marketplaceRoot,
1238
- }));
1239
- }
1240
1149
  const skillRoot = options.scope === 'user'
1241
1150
  ? path.join(getCodexHome(options.env), 'skills')
1242
1151
  : path.join(repoRoot, '.agents', 'skills');
@@ -1525,13 +1434,6 @@ async function buildInspectionWrites(options) {
1525
1434
  }
1526
1435
  const paths = resolveCodexPaths(options.cwd, options.scope, options.env);
1527
1436
  const repoRoot = await resolveRepoRoot(options.cwd);
1528
- if (options.scope === 'user' && options.shallow !== true) {
1529
- writes.push(...await buildBundledCodexSkillWrites({
1530
- plugin: options.plugin,
1531
- env: options.env,
1532
- marketplaceRoot: options.marketplaceRoot,
1533
- }));
1534
- }
1535
1437
  const instructions = resolvePlatformEntries(options.plugin.manifest.extensions?.instructions, 'codex');
1536
1438
  const targets = (options.plugin.manifest.artifacts?.targets ?? []).filter((target) => target.platform === 'codex' && target.scopes.includes(options.scope));
1537
1439
  const instructionTargets = targets.filter((target) => target.target === 'codex.developerInstructionsBlock');
@@ -3122,7 +3024,6 @@ function createNativeDriver(options) {
3122
3024
  const codexNativeStates = new Map();
3123
3025
  const pendingCodexNativeStates = new Map();
3124
3026
  const codexMutationMarketplaces = new Set();
3125
- const completedNativeSkillWrites = new WeakSet();
3126
3027
  const committedNativeGroups = new Set();
3127
3028
  let nativeMarketplaceEligibleTargets;
3128
3029
  let deferredPostchecks = [];
@@ -3141,25 +3042,6 @@ function createNativeDriver(options) {
3141
3042
  return options.targets.filter((candidate) => nativeGroupKey(candidate) === key
3142
3043
  && (nativeMarketplaceEligibleTargets?.has(candidate) ?? true));
3143
3044
  };
3144
- const nativeSkillOverlay = async (target) => {
3145
- const canonicalMarketplaceRoot = await canonicalizePathThroughExistingAncestor(target.identity.marketplaceRoot ?? resolveAwHome(options.context.env));
3146
- const nativePluginRoot = await canonicalizePathThroughExistingAncestor(path.join(canonicalMarketplaceRoot, 'plugins', target.identity.pluginName));
3147
- const desiredSkillPaths = new Set((target.desiredOwnedComponents ?? [])
3148
- .filter((component) => component.kind === 'skill-directory')
3149
- .map((component) => path.resolve(component.path)));
3150
- const enabledSkillPaths = new Set(target.artifacts
3151
- .filter((artifact) => artifact.kind === 'skill' && artifact.state !== 'disabled')
3152
- .map((artifact) => path.resolve(artifact.path)));
3153
- return {
3154
- marketplaceRoot: canonicalMarketplaceRoot,
3155
- writes: (target.operationActions ?? []).filter((action) => action.kind === 'writeOwnedArtifact'
3156
- && action.artifactKind === 'skill-directory'
3157
- && desiredSkillPaths.has(path.resolve(action.path))
3158
- && enabledSkillPaths.has(path.resolve(action.path))
3159
- && target.identity.scope === 'user'
3160
- && !path.relative(nativePluginRoot, action.path).startsWith('..')),
3161
- };
3162
- };
3163
3045
  const asNativeGroupFailure = (error) => {
3164
3046
  const result = error instanceof Error ? error : new Error(String(error));
3165
3047
  return Object.assign(result, { nativeMarketplaceGroupFailure: true });
@@ -3225,23 +3107,9 @@ function createNativeDriver(options) {
3225
3107
  right.identity.scope,
3226
3108
  right.identity.cwd,
3227
3109
  ].join('\0'), 'en'));
3228
- const nativeSkillOverlays = new Map(await Promise.all(materializationTargets.map(async (candidate) => [
3229
- candidate,
3230
- await nativeSkillOverlay(candidate),
3231
- ])));
3232
3110
  const transaction = await mirrorCatalog(first.catalog, options.context.env, first.identity, first.plugin.catalogLogicalIdentity, first.identity.platform === 'codex' ? async (stagingRoot) => {
3233
3111
  for (const candidate of materializationTargets) {
3234
- const overlay = nativeSkillOverlays.get(candidate);
3235
- const requiredSkillWrites = overlay.writes;
3236
- for (const action of requiredSkillWrites) {
3237
- await applyPlannedOperationAction({
3238
- ...action,
3239
- path: path.join(stagingRoot, path.relative(overlay.marketplaceRoot, action.path)),
3240
- allowedRoot: path.join(stagingRoot, path.relative(overlay.marketplaceRoot, action.allowedRoot)),
3241
- });
3242
- }
3243
- const hasStaticSkills = candidate.plugin.manifest.skills !== undefined
3244
- || requiredSkillWrites.length > 0;
3112
+ const hasStaticSkills = candidate.plugin.manifest.skills !== undefined;
3245
3113
  const preparedNativeRender = await requirePreparedCodexNativeRender({
3246
3114
  context: options.context,
3247
3115
  plugin: candidate.plugin,
@@ -3290,11 +3158,6 @@ function createNativeDriver(options) {
3290
3158
  }
3291
3159
  throw error;
3292
3160
  }
3293
- for (const candidate of materializationTargets) {
3294
- for (const action of nativeSkillOverlays.get(candidate)?.writes ?? []) {
3295
- completedNativeSkillWrites.add(action);
3296
- }
3297
- }
3298
3161
  committedNativeGroups.add(key);
3299
3162
  })().catch((error) => {
3300
3163
  throw asNativeGroupFailure(error);
@@ -3980,8 +3843,6 @@ function createNativeDriver(options) {
3980
3843
  },
3981
3844
  writeArtifacts: async (target) => {
3982
3845
  for (const operationAction of target.operationActions ?? []) {
3983
- if (completedNativeSkillWrites.has(operationAction))
3984
- continue;
3985
3846
  if (operationAction.kind === 'writeOwnedArtifact'
3986
3847
  || operationAction.kind === 'updateSharedConfig'
3987
3848
  || operationAction.kind === 'setActivation') {
@@ -4083,7 +3944,6 @@ export function createRebuildIntegration(options) {
4083
3944
  marketplaceRoot: input.marketplaceRoot,
4084
3945
  marketplaceName: input.marketplaceName,
4085
3946
  userActivationDesired: options.context.codexUserActivationDesired,
4086
- shallow: input.readOnlyShallowInspectionPlan,
4087
3947
  });
4088
3948
  }
4089
3949
  else if (input.platform === 'codex') {
@@ -4134,10 +3994,6 @@ export function createRebuildIntegration(options) {
4134
3994
  ...(write.component ? [write.component] : []),
4135
3995
  ]);
4136
3996
  const optionalComponentKeys = new Set(optionalComponents.map(componentIdentityKey));
4137
- const preserveCodexSharedNativePayload = input.platform === 'codex'
4138
- && (input.command === 'cleanup'
4139
- || input.command === 'uninstall'
4140
- || input.preserveCodexSharedNativePayload === true);
4141
3997
  const configDir = input.platform === 'codex'
4142
3998
  ? resolveCodexPaths(input.cwd, input.scope, options.context.env).configDir
4143
3999
  : resolveClaudePaths(input.cwd, input.scope, options.context.env).configDir;
@@ -4159,12 +4015,7 @@ export function createRebuildIntegration(options) {
4159
4015
  && input.readOnlyInspectionPlan !== true)
4160
4016
  ? [path.join(input.cwd, '.agents', 'skills')]
4161
4017
  : []
4162
- : [
4163
- path.join(getCodexHome(options.context.env), 'skills'),
4164
- ...(preserveCodexSharedNativePayload || input.readOnlyShallowInspectionPlan === true
4165
- ? []
4166
- : [await canonicalizePathThroughExistingAncestor(path.join(input.marketplaceRoot ?? resolveAwHome(options.context.env), 'plugins', input.plugin.manifest.name))]),
4167
- ]
4018
+ : [path.join(getCodexHome(options.context.env), 'skills')]
4168
4019
  : [path.join(configDir, 'skills')];
4169
4020
  const scanSkills = () => Promise.all(skillRoots.map((root) => scanOwnedSkills({
4170
4021
  sourceId: input.sourceId,
@@ -4216,7 +4067,7 @@ export function createRebuildIntegration(options) {
4216
4067
  artifacts: historicalArtifacts,
4217
4068
  command: input.command,
4218
4069
  });
4219
- if (preserveCodexSharedNativePayload) {
4070
+ if (input.platform === 'codex') {
4220
4071
  const nativePluginRoot = await canonicalizePathThroughExistingAncestor(path.join(input.marketplaceRoot ?? resolveAwHome(options.context.env), 'plugins', input.plugin.manifest.name));
4221
4072
  const privateCacheRoot = path.resolve(getCodexHome(options.context.env), 'plugins', 'cache');
4222
4073
  historicalComponents = historicalComponents.filter((component) => {