Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test(remote-agent): stabilize guest usage completion
MagicLizic977a1a0f8b6
diff --git a/apps/desktop/src/main/remote-agent/__tests__/guestHost.test.ts b/apps/desktop/src/main/remote-agent/__tests__/guestHost.test.tsindex 443f59a490..c89adbc49d 100644--- a/apps/desktop/src/main/remote-agent/__tests__/guestHost.test.ts+++ b/apps/desktop/src/main/remote-agent/__tests__/guestHost.test.ts@@ -456,7 +456,19 @@ describe('guest provider access and usage', () => {const host = makeHost(started, { events: [done], recordGuestUsage });await host.handle(GUEST, { op: 'open', runId: RUN_1, agentKind: 'claude-code', payload: { json: openPayload('task-1') } });await host.handle(OWNER, { op: 'open', runId: RUN_2, agentKind: 'claude-code', payload: { json: openPayload('task-2') } });- await vi.waitFor(() => expect(recordGuestUsage).toHaveBeenCalledTimes(1));+ // open 只登记任务,启动与事件泵在后台继续;Windows 全量分片繁忙时不能用 waitFor 的+ // 1 秒默认值猜测它们已处理完。等两条任务的 done 都进入可观察事件日志后再断言计量。+ await vi.waitFor(async () => {+ const polls = await Promise.all([+ host.handle(GUEST, { op: 'poll', runs: [{ runId: RUN_1, cursor: 0 }], waitMs: 0 }),+ host.handle(OWNER, { op: 'poll', runs: [{ runId: RUN_2, cursor: 0 }], waitMs: 0 }),+ ]) as Array<{ runs: Array<{ data?: string }> }>;+ for (const poll of polls) {+ const events = Buffer.from(poll.runs[0]?.data ?? '', 'base64').toString('utf8');+ expect(events).toContain('"t":"event","event":{"type":"done"');+ }+ }, { timeout: 10_000 });+ expect(recordGuestUsage).toHaveBeenCalledTimes(1);expect(recordGuestUsage).toHaveBeenCalledWith(GUEST, {kind: 'claude-code',providerId: 'shared-provider',