Skip to content

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(auto-harness): tui修复logs补全及error显示问题

ray_le5e89f15effdc
diff --git a/jiuwenswarm/agents/harness/common/auto_harness/service.py b/jiuwenswarm/agents/harness/common/auto_harness/service.py
index a7e5785e87..c2439e1fcf 100644
--- a/jiuwenswarm/agents/harness/common/auto_harness/service.py
+++ b/jiuwenswarm/agents/harness/common/auto_harness/service.py
@@ -165,6 +165,7 @@ class ActiveAutoHarnessRun:
current_stage_name: str = "assess"
pending_interaction_id: str = ""
completed: bool = False
+ pipeline_preference: str = ""
class AutoHarnessService:
@@ -992,6 +993,7 @@ class AutoHarnessService:
orchestrator=orchestrator,
stream_queue=stream_queue,
current_stage_name="activate",
+ pipeline_preference=config.pipeline_preference,
)
self._active_runs[session_id] = active_run
@@ -1183,6 +1185,7 @@ class AutoHarnessService:
orchestrator=orchestrator,
stream_queue=stream_queue,
current_stage_name="implement_ext",
+ pipeline_preference=config.pipeline_preference,
)
self._active_runs[session_id] = active_run
@@ -1397,6 +1400,7 @@ class AutoHarnessService:
cancelled=False,
orchestrator=orchestrator,
stream_queue=stream_queue,
+ pipeline_preference=config.pipeline_preference,
)
self._active_runs[session_id] = active_run
@@ -1689,13 +1693,13 @@ class AutoHarnessService:
# When EXTENDED_EVOLVE_PIPELINE finishes, refresh packages cache
# so other channels can pick up newly generated packages.
- if self._base_config and self._base_config.pipeline_preference == EXTENDED_EVOLVE_PIPELINE:
+ if active_run.pipeline_preference == EXTENDED_EVOLVE_PIPELINE:
try:
data = await asyncio.to_thread(self.scan_runtime_extensions)
await asyncio.to_thread(self.save_packages, data)
logger.info(
"[AutoHarnessService] Packages cache refreshed after %s, session=%s",
- self._base_config.pipeline_preference,
+ active_run.pipeline_preference,
active_run.session_id,
)
except Exception as exc:
diff --git a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/auto-harness.ts b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/auto-harness.ts
index 300c13aa4e..e3432903ee 100644
--- a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/auto-harness.ts
+++ b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/auto-harness.ts
@@ -584,8 +584,8 @@ const scheduleLogsCommand: SlashCommand = {
return ["--history"].filter((f) => f.startsWith(lastPart)).map((f) => buildCompletion(f));
}
- // Step 4: If we have a task_id already, suggest --history flag (preserve task_id)
- if (existingTaskId && !parts.includes("--history")) {
+ // Step 4: If task_id is complete, suggest --history flag
+ if (existingTaskId && hasTrailingSpace && !parts.includes("--history")) {
return [`${existingTaskId} --history`];
}
@@ -1378,7 +1378,15 @@ function formatLogSection(section: ParsedLogSection, detailed: boolean = false):
return `${ANSI.blue}▶ ${section.content}${ANSI.reset}`;
case "error":
- return `${ANSI.red}${ANSI.bold}🔥 错误: ${section.content}${ANSI.reset}`;
+ const wrappedError = wrapText(section.content, 100);
+ const errorLines = wrappedError.split("\n");
+ const formattedErrorLines = errorLines.map((line, index) => {
+ if (index === 0) {
+ return `${ANSI.red}${ANSI.bold}🔥 错误: ${line}${ANSI.reset}`;
+ }
+ return `${ANSI.red}${ANSI.bold} ${line}${ANSI.reset}`; // 8 spaces indent to align with "🔥 错误:"
+ });
+ return formattedErrorLines.join("\n");
case "info":
return `${ANSI.gray} · ${section.content}${ANSI.reset}`;