Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(provider-share): 校验用量的公历日期键
fmfsaisai3d033f45a6f1
diff --git a/apps/desktop/src/main/device-link/__tests__/providerShareInsights.test.ts b/apps/desktop/src/main/device-link/__tests__/providerShareInsights.test.tsindex dff521d178..3a3c5f06a5 100644--- a/apps/desktop/src/main/device-link/__tests__/providerShareInsights.test.ts+++ b/apps/desktop/src/main/device-link/__tests__/providerShareInsights.test.ts@@ -409,6 +409,26 @@ describe('provider share insights', () => {}},);+ // #4317583971:任意字符串曾进入日期格式化;现有数值时间回归不覆盖日期键。tier: unit。+ it.each(['todayKey', 'coverageStart', 'day'] as const)(+ 'requires a real calendar date for usage %s',+ async (field) => {+ const { read } = fixture();+ const view = await read('peer', request);+ const setDay = (value: string) => {+ if (field === 'day') view.usage!.parties[0].days[0].day = value;+ else view.usage![field] = value;+ };+ for (const invalid of ['2026-99-99', '2026-02-29', '2026-04-31', '', '2026-1-1']) {+ setDay(invalid);+ expect(parseProviderShareInsights(view)).toBeNull();+ }+ for (const valid of ['2024-02-29', '2026-10-19']) {+ setDay(valid);+ expect(parseProviderShareInsights(view)).toEqual(view);+ }+ },+ );it('strips unknown fields and ignores data for disabled capabilities on the receiving boundary', async () => {const { read } = fixture();const view = await read('peer', request);diff --git a/apps/desktop/src/shared/providerShareInsights.ts b/apps/desktop/src/shared/providerShareInsights.tsindex fc0c568efb..c1dd9a236f 100644--- a/apps/desktop/src/shared/providerShareInsights.ts+++ b/apps/desktop/src/shared/providerShareInsights.ts@@ -109,8 +109,8 @@ const schema = z.object({.nullable(),usage: z.object({- todayKey: z.string(),- coverageStart: z.string().nullable(),+ todayKey: z.iso.date(),+ coverageStart: z.iso.date().nullable(),parties: z.array(z.object({key: z.string(),@@ -123,7 +123,7 @@ const schema = z.object({days: z.array(z.object({- day: z.string(),+ day: z.iso.date(),kind: z.string(),model: z.string(),turns: number,