Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): complete built-in skill upgrades
xd-bobob5215c9d5df4
diff --git a/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/_frontmatter.py b/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/_frontmatter.pyindex 68ab56e9db..69a9a29341 100644--- a/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/_frontmatter.py+++ b/apps/desktop/resources/system-skills/cindy-skill-creator/scripts/_frontmatter.py@@ -114,6 +114,10 @@ def _parse_scalar(raw):# so valid YAML bare scalars such as [Read, Grep] and {owner: me} do not# require PyYAML or JSON syntax.return _parse_flow_collection(value)+ if re.match(r"^(?:[-?:](?:[ \t]|$)|[,\]\}#&*!|>'\"%@`])", value):+ raise FrontmatterError("Invalid leading indicator in plain scalar")+ if re.search(r":[ \t]|:$", value):+ raise FrontmatterError("Plain scalar contains ': ' and must be quoted")return valuediff --git a/apps/desktop/src/main/maker-host/__tests__/built-in-skills.test.ts b/apps/desktop/src/main/maker-host/__tests__/built-in-skills.test.tsindex e67d14af98..80d3559f51 100644--- a/apps/desktop/src/main/maker-host/__tests__/built-in-skills.test.ts+++ b/apps/desktop/src/main/maker-host/__tests__/built-in-skills.test.ts@@ -105,6 +105,37 @@ describe('built-in Skills', () => {expect(conflicting.warnings.join('\n')).toContain('bundle version 2 was reused');});+ it('advances the bundle version only after every Skill is ready and retries partial upgrades', async () => {+ const input = fixture();+ await prepareBuiltInSkills(input);+ fs.appendFileSync(path.join(input.source, 'SKILL.md'), '\nCreator v2\n');+ fs.writeFileSync(path.join(input.bundledRoot, 'learn', 'SKILL.md'), 'Learn v2\n');+ fs.renameSync(+ path.join(input.bundledRoot, 'learn', 'SKILL.md'),+ path.join(input.bundledRoot, 'learn', 'SKILL.md.missing'),+ );++ const partial = await prepareBuiltInSkills({ ...input, bundleVersion: 2 });+ const manifestPath = path.join(+ path.dirname(partial.descriptors[0]!.absolutePath),+ '.cindy-system-skills.json',+ );+ expect(JSON.parse(fs.readFileSync(manifestPath, 'utf8')).bundleVersion).toBe(1);+ expect(partial.warnings.join('\n')).toContain('missing SKILL.md');++ fs.renameSync(+ path.join(input.bundledRoot, 'learn', 'SKILL.md.missing'),+ path.join(input.bundledRoot, 'learn', 'SKILL.md'),+ );+ const retried = await prepareBuiltInSkills({ ...input, bundleVersion: 2 });+ expect(retried.warnings).toEqual([]);+ expect(JSON.parse(fs.readFileSync(manifestPath, 'utf8')).bundleVersion).toBe(2);+ expect(fs.readFileSync(path.join(+ retried.descriptors.find((descriptor) => descriptor.name === 'learn')!.absolutePath,+ 'SKILL.md',+ ), 'utf8')).toBe('Learn v2\n');+ });+it('keeps a user-owned same-name Skill while retaining the Cindy copy', async () => {const input = fixture();const userSkill = path.join(input.homeDir, '.agents', 'skills', 'cindy-skill-creator');diff --git a/apps/desktop/src/main/maker-host/built-in-skills.ts b/apps/desktop/src/main/maker-host/built-in-skills.tsindex 2b99d84abb..b2fd1003c7 100644--- a/apps/desktop/src/main/maker-host/built-in-skills.ts+++ b/apps/desktop/src/main/maker-host/built-in-skills.ts@@ -337,6 +337,7 @@ export async function prepareBuiltInSkills(await fsp.mkdir(root, { recursive: true });const manifest = await readManifest(root);const newerBundleIsInstalled = manifest.bundleVersion > bundleVersion;+ let bundleReady = true;if (newerBundleIsInstalled) {warnings.push(`kept built-in Skill bundle ${manifest.bundleVersion}; this build only carries older bundle ${bundleVersion}`,@@ -355,6 +356,7 @@ export async function prepareBuiltInSkills(recordedFingerprint !== fingerprint);if (sameVersionConflict) {+ bundleReady = false;warnings.push(`kept built-in Skill ${descriptor.name} because bundle version ${bundleVersion} was reused for different bytes`,);@@ -366,6 +368,7 @@ export async function prepareBuiltInSkills(manifest.fingerprints[descriptor.name] = fingerprint;}} catch (error) {+ bundleReady = false;warnings.push(`could not materialize built-in Skill ${descriptor.name}: ${error instanceof Error ? error.message : String(error)}`,);@@ -419,7 +422,7 @@ export async function prepareBuiltInSkills(}if (!newerBundleIsInstalled) {- manifest.bundleVersion = bundleVersion;+ if (bundleReady) manifest.bundleVersion = bundleVersion;try {await writeManifest(root, manifest);} catch (error) {