From 1a8e1108667926eae0b470b743a7b4f44ca9bb16 Mon Sep 17 00:00:00 2001 From: lofyer Date: Mon, 10 Aug 2026 00:40:52 +0800 Subject: [PATCH] fix: make skill budget test cross-platform --- package-lock.json | 4 ++-- package.json | 2 +- src/main/capabilities/capability-service.test.ts | 13 ++++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6252dd1..6d55493 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "goodbuddy", - "version": "0.8.9", + "version": "0.8.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "goodbuddy", - "version": "0.8.9", + "version": "0.8.10", "license": "UNLICENSED", "dependencies": { "@modelcontextprotocol/sdk": "^1.30.0", diff --git a/package.json b/package.json index d87f524..c4eb8ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "goodbuddy", - "version": "0.8.9", + "version": "0.8.10", "private": true, "description": "Secure desktop AI workspace with controlled Agent Runtimes", "desktopName": "GoodBuddy", diff --git a/src/main/capabilities/capability-service.test.ts b/src/main/capabilities/capability-service.test.ts index b09c2cf..679b487 100644 --- a/src/main/capabilities/capability-service.test.ts +++ b/src/main/capabilities/capability-service.test.ts @@ -58,7 +58,8 @@ class FailingBrowserProfileService extends BrowserProfileService { async function writeSkill( root: string, id: string, - name: string + name: string, + body = '仅用于离线测试。' ): Promise { const directory = join(root, id) await mkdir(directory, { recursive: true }) @@ -76,7 +77,7 @@ async function writeSkill( '', `# ${name}`, '', - '仅用于离线测试。' + body ].join('\n'), 'utf8' ) @@ -327,7 +328,12 @@ describe('CapabilityService', () => { it('exposes the skill directory and names skills dropped by the budget', async () => { const { builtinRoot, service } = await createService() - await writeSkill(builtinRoot, 'oversized-skill', '超长技能') + await writeSkill( + builtinRoot, + 'oversized-skill', + '超长技能', + '超长技能说明。'.repeat(80) + ) const instructions = await service.getSkillInstructions('model') expect(instructions).toContain(join(builtinRoot, 'document-writing')) @@ -335,6 +341,7 @@ describe('CapabilityService', () => { const truncated = await service.getSkillInstructions('model', 200) expect(truncated).toContain('因超出注入上限未加载') + expect(truncated).toContain('超长技能') const fullyTruncated = await service.getSkillInstructions('model', 1) expect(fullyTruncated).toContain('因超出注入上限未加载')