Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
Merge origin/main into fix/remote-provider-startup
MagicLizi29cd55743c10
diff --cc apps/desktop/src/main/remote-agent/controller/poller.tsindex a79bdb16e2,483a1ad2e3..d851f40f32--- a/apps/desktop/src/main/remote-agent/controller/poller.ts+++ b/apps/desktop/src/main/remote-agent/controller/poller.ts@@@ -114,23 -109,22 +116,31 @@@ export class RemoteAgentPollervoid this.pollOnce();}- private snapshot(): Array<{ runId: string; cursor: number }> {- const all = [...this.entries.values()].map((entry) => ({ runId: entry.run.runId, cursor: entry.cursor }));+ private snapshot(): Array<{ runId: string; cursor: number; hold?: true }> {+ const all = [...this.entries.values()].map((entry) => {+ let hold = false;+ try {+ hold = entry.run.holdsRemote?.() === true;+ } catch {+ // 判断失败时照常拉取,不报 hold。+ }+ return { runId: entry.run.runId, cursor: entry.cursor, ...(hold ? { hold: true as const } : {}) };+ });- if (all.length <= REMOTE_AGENT_MAX_POLL_RUNS) return all;- // 按整批推进,避免大量空闲任务在下次被拉取前超过 host 的存活期限。- const start = this.rotation % all.length;- this.rotation = (start + REMOTE_AGENT_MAX_POLL_RUNS) % all.length;- this.needFresh = true;- return [...all.slice(start), ...all.slice(0, start)].slice(0, REMOTE_AGENT_MAX_POLL_RUNS);+ let wanted = all;+ if (all.length > REMOTE_AGENT_MAX_POLL_RUNS) {+ // 按整批推进,避免大量空闲任务在下次被拉取前超过 host 的存活期限;没有在途覆盖的任务排在最前。+ const start = this.rotation % all.length;+ const ordered = [...all.slice(start), ...all.slice(0, start)];+ const uncovered = new Set(all.filter((item) => !this.isCovered(item.runId)).map((item) => item.runId));+ const fresh = ordered.filter((item) => uncovered.has(item.runId)).slice(0, REMOTE_AGENT_MAX_POLL_RUNS);+ const rotated = ordered+ .filter((item) => !uncovered.has(item.runId))+ .slice(0, REMOTE_AGENT_MAX_POLL_RUNS - fresh.length);+ this.rotation = (start + fresh.length + rotated.length) % all.length;+ this.needFresh = true;+ wanted = [...fresh, ...rotated];+ }+ return wanted;}private async pollOnce(): Promise<void> {diff --cc apps/desktop/src/main/remote-agent/host/runHost.tsindex e457bbdd40,d5a62bf627..ac40311c16--- a/apps/desktop/src/main/remote-agent/host/runHost.ts+++ b/apps/desktop/src/main/remote-agent/host/runHost.ts@@@ -339,10 -339,10 +346,12 @@@ interface RelayBackendstarted: boolean;/** 那台上正在运行一轮(按它报来的状态)。 */turnRunning: boolean;+ /** 那台报来的忙闲状态(在准备回合、后台任务、待唤醒续跑):本机按闲置收回时与本机 Agent 同一判据。 */+ activity: Record<string, unknown>;/** 推帧按任务串行,保证 Codex exec-server 帧的顺序。 */pushChain: Promise<void>;+ /** 已记过一次转发慢(排队加推送超过 RELAY_SLOW_PUSH_MS)。 */+ slowPushLogged?: boolean;model?: string;load: GroupRelayLoad;}