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): Add trusted directories to /statusline
openJiuwen-bot29bfd9dc9c89
diff --git a/docs/en/SlashCommands.md b/docs/en/SlashCommands.mdindex 826d21d948..dcf98b0cb5 100644--- a/docs/en/SlashCommands.md+++ b/docs/en/SlashCommands.md@@ -607,6 +607,7 @@ The command receives the following JSON data on each execution:| `evolution_status` | Evolution status (`idle` / `running`) || `active_subtask_count` | Number of active subtasks || `todo_count` | Number of todo items |+| `trusted_dirs` | Trusted workspace directories (array of path strings) || `usage.total_input_tokens` | Total input tokens for session || `usage.total_output_tokens` | Total output tokens for session || `usage.total_tokens` | Total tokens for session |@@ -648,6 +649,7 @@ Use the following template to write commands. `input=$(cat)` reads JSON into a v| Evolution status | `jq -r '.evolution_status // "idle"'` || Subtask count | `jq -r '.active_subtask_count // 0'` || Todo count | `jq -r '.todo_count // 0'` |+| Trusted dirs | `jq -r '(.trusted_dirs // []) | join(" ")'` || Total input tokens | `jq -r '.usage.total_input_tokens // 0'` || Total output tokens | `jq -r '.usage.total_output_tokens // 0'` || Total tokens | `jq -r '.usage.total_tokens // 0'` |@@ -663,6 +665,7 @@ Use the following template to write commands. `input=$(cat)` reads JSON into a v- `/statusline set 'input=$(cat); pct=$(echo "$input" | jq -r .context_window.used_percentage); rem=$(echo "$input" | jq -r .context_window.remaining_percentage); cw=$(echo "$input" | jq -r .context_window.context_window_size / 1000); echo "ctx:${pct}% used (${rem}% left, ${cw}K window)"'` — Show context window occupancy with percentage bar- `/statusline set 'input=$(cat); pct=$(echo "$input" | jq -r ".context_window.used_percentage // 0"); if [ "$pct" -ge 90 ]; then warn="⚠HIGH"; elif [ "$pct" -ge 70 ]; then warn="~MED"; else warn="OK"; fi; echo "ctx:${pct}% $warn"'` — Show context % with threshold warning (≥90% HIGH, ≥70% MED)- `/statusline set 'input=$(cat); err=$(echo "$input" | jq -r .last_error); if [ "$err" != "null" ] && [ "$err" != "" ]; then echo "error: $err"; else echo "ok"; fi'` — Show error when present, otherwise "ok"+- `/statusline set 'input=$(cat); dirs=$(echo "$input" | jq -r '.trusted_dirs // [] | join(" ")'); mode=$(echo "$input" | jq -r '.mode // "?"'); echo "$mode | dirs:$dirs"'` — Show mode and trusted workspace directories- `/statusline clear` — Remove status line configuration- `/statusline help` — View JSON input fields referencediff --git "a/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md" "b/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"index 9f26ac8700..877a257b14 100644--- "a/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"+++ "b/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"@@ -618,6 +618,7 @@| `evolution_status` | 演化状态(`idle` / `running`) || `active_subtask_count` | 活跃子任务数 || `todo_count` | 待办事项数 |+| `trusted_dirs` | 可信工作目录列表(路径字符串数组) || `usage.total_input_tokens` | 会话总输入 token || `usage.total_output_tokens` | 会话总输出 token || `usage.total_tokens` | 会话总 token |@@ -659,6 +660,7 @@| 演化状态 | `jq -r '.evolution_status // "idle"'` || 子任务数 | `jq -r '.active_subtask_count // 0'` || 待办数 | `jq -r '.todo_count // 0'` |+| 可信目录 | `jq -r '(.trusted_dirs // []) | join(" ")'` || 总输入 token | `jq -r '.usage.total_input_tokens // 0'` || 总输出 token | `jq -r '.usage.total_output_tokens // 0'` || 总 token | `jq -r '.usage.total_tokens // 0'` |@@ -674,6 +676,7 @@- `/statusline set 'input=$(cat); pct=$(echo "$input" | jq -r .context_window.used_percentage); rem=$(echo "$input" | jq -r .context_window.remaining_percentage); cw=$(echo "$input" | jq -r .context_window.context_window_size / 1000); echo "ctx:${pct}% used (${rem}% left, ${cw}K window)"'` — 显示上下文窗口占用百分比- `/statusline set 'input=$(cat); pct=$(echo "$input" | jq -r ".context_window.used_percentage // 0"); if [ "$pct" -ge 90 ]; then warn="⚠HIGH"; elif [ "$pct" -ge 70 ]; then warn="~MED"; else warn="OK"; fi; echo "ctx:${pct}% $warn"'` — 显示上下文占用百分比并带阈值警告(≥90% HIGH,≥70% MED)- `/statusline set 'input=$(cat); err=$(echo "$input" | jq -r .last_error); if [ "$err" != "null" ] && [ "$err" != "" ]; then echo "error: $err"; else echo "ok"; fi'` — 有错误时显示错误信息,无错误时显示 ok+- `/statusline set 'input=$(cat); dirs=$(echo "$input" | jq -r '.trusted_dirs // [] | join(" ")'); mode=$(echo "$input" | jq -r '.mode // "?"'); echo "$mode | dirs:$dirs"'` — 显示模式与可信工作目录- `/statusline clear` — 清除状态栏配置- `/statusline help` — 查看 JSON 输入字段参考diff --git a/jiuwenswarm/channels/tui/frontend/src/app-state.ts b/jiuwenswarm/channels/tui/frontend/src/app-state.tsindex be712ef5e6..b99a9738e1 100644--- a/jiuwenswarm/channels/tui/frontend/src/app-state.ts+++ b/jiuwenswarm/channels/tui/frontend/src/app-state.ts@@ -1769,6 +1769,7 @@ export class CliPiAppState {evolution_status: snapshot.evolutionStatus,active_subtask_count: snapshot.activeSubtasks.length,todo_count: snapshot.todos.length,+ trusted_dirs: trustedDirs,usage: {total_input_tokens: usage.total_input_tokens,total_output_tokens: usage.total_output_tokens,diff --git a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/statusline.ts b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/statusline.tsindex c71db0c5cc..a54dc9a165 100644--- a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/statusline.ts+++ b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/statusline.ts@@ -97,6 +97,7 @@ function showJsonInput(ctx: CommandContext): void {"evolution_status — evolution status (idle/running)","active_subtask_count — number of active subtasks","todo_count — number of todo items",+ "trusted_dirs — trusted workspace directories (array of paths)","usage.total_input_tokens — total input tokens","usage.total_output_tokens — total output tokens","usage.total_tokens — total tokens (input + output)",