🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(skill): 重新打包技能 ZIP 时按本地时间固定 mtime,修复西半球时区打包失败 (#22646)
Mocha01368c640168
diff --git a/apps/server/src/services/skill/parser.test.ts b/apps/server/src/services/skill/parser.test.tsindex 08ce5484e75..781db7fe6b2 100644--- a/apps/server/src/services/skill/parser.test.ts+++ b/apps/server/src/services/skill/parser.test.ts@@ -891,6 +891,33 @@ Fallback content`;});describe('parseZipPackage with repackSkillZip', () => {+ it('should repack to the same bytes in any server time zone', async () => {+ const skillMd = `---+name: tz-skill+description: Time zone independent repack+---+Content`;+ const zipped = Buffer.from(+ await createZip({+ 'repo/SKILL.md': new TextEncoder().encode(skillMd),+ 'repo/notes.txt': new TextEncoder().encode('notes'),+ }),+ );+ const originalTz = process.env.TZ;+ const hashes: string[] = [];+ try {+ // ZIP stores local time; west of UTC a UTC-midnight 1980 date falls in 1979.+ for (const tz of ['America/New_York', 'UTC', 'Asia/Shanghai']) {+ process.env.TZ = tz;+ const result = await parser.parseZipPackage(zipped, { repackSkillZip: true });+ hashes.push(result.zipHash!);+ }+ } finally {+ process.env.TZ = originalTz;+ }+ expect(new Set(hashes).size).toBe(1);+ });+it('should not return skillZipBuffer when repackSkillZip is false/undefined', async () => {const skillMd = `---name: user-skilldiff --git a/apps/server/src/services/skill/parser.ts b/apps/server/src/services/skill/parser.tsindex af78318cdca..7a6ed93f44e 100644--- a/apps/server/src/services/skill/parser.ts+++ b/apps/server/src/services/skill/parser.ts@@ -298,8 +298,9 @@ export class SkillParser {private repackSkillZip(skillMdContent: string, resources: Map<string, Buffer>): Promise<Buffer> {return new Promise((resolve, reject) => {// Use fixed timestamp (1980-01-01) for deterministic output- // ZIP format requires dates in 1980-2099 range- const fixedMtime = new Date('1980-01-01T00:00:00Z');+ // ZIP format requires dates in 1980-2099 range and stores local time, so+ // build the date in local time: a UTC midnight is still 1979 west of UTC.+ const fixedMtime = new Date(1980, 0, 1);// Use Zippable format with fixed mtime for deterministic outputconst files: Record<string, [Uint8Array, { mtime: Date }]> = {