JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix(tui): 10 mins timeout
douran0e5fe3d9cb71
diff --git a/jiuwenclaw/cli/src/core/ws-client.ts b/jiuwenclaw/cli/src/core/ws-client.tsindex 27f851a762..4f61ba173a 100644--- a/jiuwenclaw/cli/src/core/ws-client.ts+++ b/jiuwenclaw/cli/src/core/ws-client.ts@@ -18,7 +18,7 @@ export class WsClient {private handlers: FrameHandler[] = [];private pending = new Map<string, PendingRequest>();private retryCount = 0;- private readonly maxRetries = 5;+ private readonly maxBackoffRetries = 5;private readonly baseDelay = 1000;private reconnectTimer: ReturnType<typeof setTimeout> | null = null;private _status: ConnectionStatus = "idle";@@ -182,13 +182,13 @@ export class WsClient {}private handleReconnect(): void {- if (this.retryCount >= this.maxRetries) {- this.setStatus("idle");- return;- }-this.setStatus("reconnecting");- const delay = Math.min(this.baseDelay * 2 ** this.retryCount, 30000);+ // Keep behavior aligned with web client:+ // use exponential backoff for the first retries, then keep retrying+ // at a fixed interval so long-running tasks can recover automatically.+ const delay = this.retryCount < this.maxBackoffRetries+ ? Math.min(this.baseDelay * 2 ** this.retryCount, 30000)+ : 2000;this.retryCount += 1;this.reconnectTimer = setTimeout(() => this.doConnect(), delay);}diff --git a/jiuwenclaw/cli/src/ui/app-screen.ts b/jiuwenclaw/cli/src/ui/app-screen.tsindex f553c256f2..6f68660e69 100644--- a/jiuwenclaw/cli/src/ui/app-screen.ts+++ b/jiuwenclaw/cli/src/ui/app-screen.ts@@ -48,6 +48,7 @@ const PERMISSION_TOOL_RE = /工具\s+`([^`]+)`\s+需要授权/;const PERMISSION_RISK_RE = /安全风险评估:\**\s*([^\s*]+)?\s*\**([^*\n]+?风险)\**/m;const PERMISSION_QUOTE_RE = /^>\s*(.+)$/gm;const PERMISSION_JSON_BLOCK_RE = /```json\s*([\s\S]*?)\s*```/i;+const RUNNING_TIMER_RESET_GRACE_MS = 15_000;type PermissionSummary = {tool?: string;@@ -350,6 +351,7 @@ export class AppScreen implements Component, Focusable {private animationTimer: ReturnType<typeof setInterval> | null = null;private animationPhase = 0;private runningStartedAtMs: number | null = null;+ private runningStoppedAtMs: number | null = null;private pendingSubmittedInput: string | null = null;private pendingSubmittedBaseline = 0;private pendingSubmittedSessionId: string | null = null;@@ -1466,14 +1468,25 @@ export class AppScreen implements Component, Focusable {const shouldAnimate =!snapshot.isInterrupted && (snapshot.isProcessing || hasRunningTools || teamWorking);if (!shouldAnimate) {+ const nowMs = Date.now();+ if (this.runningStoppedAtMs === null) {+ this.runningStoppedAtMs = nowMs;+ }if (this.animationTimer) {clearInterval(this.animationTimer);this.animationTimer = null;}this.animationPhase = 0;- this.runningStartedAtMs = null;+ if (+ this.runningStartedAtMs !== null &&+ nowMs - this.runningStoppedAtMs >= RUNNING_TIMER_RESET_GRACE_MS+ ) {+ this.runningStartedAtMs = null;+ this.runningStoppedAtMs = null;+ }return;}+ this.runningStoppedAtMs = null;if (snapshot.isProcessing) {if (this.runningStartedAtMs === null) {this.runningStartedAtMs = Date.now();