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
docs:增加/export和/status命令文档
openJiuwen-bot90437fddda19
diff --git a/docs/en/SlashCommands.md b/docs/en/SlashCommands.mdindex 2e3da9334a..56a6b5e167 100644--- a/docs/en/SlashCommands.md+++ b/docs/en/SlashCommands.md@@ -22,6 +22,9 @@ Executed locally in the terminal UI, not through Gateway control pipeline.| `/config` | Modify configuration (currently local, planned to unify with Gateway) || `/workspace` | Manage trusted directories (see below) || `/teamskills` | TeamSkills Hub publish/delete (`publish`/`delete`) |+| `/export` | Export current conversation to file or clipboard (see below) |+| `/status` | Show jiuwenclaw status overview, usage, config (see below) |+| `/permissions` | Manage tool permissions (`allow`/`ask`/`deny`) |> Note: `/mode` controlled switching logic is primarily on Gateway side, see "`/mode` and `/switch`" below.@@ -245,6 +248,112 @@ For other subcommands (`/skills install`, `/skills import`, `/skills uninstall`,- `/skills marketplace toggle community off` — Disable the "community" marketplace source- `/skills use my-skill, Code and execute a Hello World program.` — Use a skill to execute a query+### `/export` (Export Conversation)++Export the current conversation to a file or clipboard.++#### Usage++- `/export` — Copy conversation to clipboard (no filename argument)+- `/export <filename>` — Save conversation to a `.txt` file in workspace directory++#### Subcommands++| Command | Description |+|---|---|+| `/export` | Copy entire conversation to clipboard; if clipboard unavailable, prompt to specify a filename |+| `/export <filename>` | Write conversation to `filename.txt` in workspace directory; if filename lacks `.txt` extension, it is automatically appended |++#### Output Format++The exported text renders each conversation entry with a timestamp and role prefix:++- `[User] <timestamp>` — User input+- `[Assistant] <timestamp>` — Assistant response+- `[Thinking] <timestamp>` — Internal reasoning trace+- `[Tools] <timestamp>` — Tool calls with name, summary, and truncated result (max 500 chars)+- `[System] / [Error] / [Info] <timestamp>` — System messages+- `[Diff] <timestamp>` — Per-turn file change summary++#### Tab Completion++When typing `/export ` and pressing Tab, auto-generated filename suggestions appear:++- `<timestamp>-<sanitized-first-prompt>.txt` — Based on the first user message (truncated to 50 chars, sanitized)+- `conversation-<timestamp>.txt` — Generic timestamped name++Timestamp format: `YYYY-MM-DD-HHmmss`.++#### Behavior Details++- **Clipboard fallback**: If no filename is given and clipboard is unavailable, an error message prompts the user to specify a filename instead.+- **Filename normalization**: Any extension is replaced with `.txt`; e.g., `/export my-chat.json` becomes `my-chat.txt`.+- **Write location**: Files are saved to `ctx.getWorkspaceDir()` (or `process.cwd()` as fallback).++#### Examples++- `/export` — Copy conversation to clipboard+- `/export my-chat` — Save to `my-chat.txt` in workspace+- `/export 2026-05-09-debug-session.txt` — Save with explicit timestamp name++### `/status` (Show Status)++Display jiuwenclaw runtime status: overview, usage statistics, or config editor.++#### Usage++- `/status` or `/status overview` — Show core identity, model/API info, MCP servers, and config sources+- `/status usage` — Show session token usage statistics+- `/status config` — Enter interactive config editor++#### Subcommands++| Command | Description |+|---|---|+| `/status` | Show full status overview (version, session, model, connection, MCP servers, config) |+| `/status overview` | Same as `/status` — explicit overview subcommand |+| `/status usage` | Show session token usage (input, output, total, per-model breakdown) |+| `/status config` | Enter interactive config editor (same as `/config edit`) |++#### Overview Display Sections++When `/status` is run, four key-value panels are displayed:++1. **Core identity**: version, session ID, session name (or prompt to `/rename`), cwd, current mode+2. **Model & API**: model name, provider, API base URL, connection status+3. **MCP servers**: each server's name, transport type, and enabled/disabled state+4. **Config sources**: config file path and all settings source paths++#### Usage Display++`/status usage` shows token consumption for the current session:++- Total input tokens, output tokens, and total tokens+- Per-model breakdown: model name, token count, input/output split++#### Interactive Mode++If the TUI provides an interactive StatusView (`ctx.enterStatusView`), `/status` opens the full status UI with tabs. The subcommand argument selects the initial tab:++- `/status` → opens on overview tab+- `/status usage` → opens on usage tab+- `/status config` → opens on config tab++If StatusView is unavailable, the command falls back to inline key-value display.++#### Data Sources++- Overview data: `command.status` RPC request to AgentServer+- Usage data: `ctx.getUsageSummary()` from local session tracking+- Config data: `config.get` RPC request to AgentServer++#### Examples++- `/status` — Show full overview+- `/status overview` — Show overview (explicit)+- `/status usage` — Show token usage+- `/status config` — Open config editor+---## Planned Features@@ -253,6 +362,4 @@ For other subcommands (`/skills install`, `/skills import`, `/skills uninstall`,|---|---|| `/btw` | Ask question || `/context` | Context status view |-| `/export` | Export related files |-| `/memory` | Memory management |-| `/permissions` | Permission management |\ No newline at end of file+| `/memory` | Memory management |\ No newline at end of filediff --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 c2f0fc1cd3..f48433059f 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"@@ -22,6 +22,9 @@| `/config` | 修改配置(当前为本地实现,后续计划统一到 Gateway) || `/workspace` | 管理可信目录(见下文) || `/teamskills` | TeamSkills 管理(`init/validate/pack/info/search/list/install/uninstall/config/publish/delete`) |+| `/export` | 导出当前会话到文件或剪贴板(见下文) |+| `/status` | 查看 jiuwenclaw 运行状态概览、用量统计、配置编辑(见下文) |+| `/permissions` | 管理工具权限(`allow`/`ask`/`deny`) |> 说明:`/mode` 的受控切换逻辑以 Gateway 侧行为为主,详见下文「`/mode` 与 `/switch`」。@@ -267,6 +270,101 @@- `/skills marketplace toggle community off` — 禁用"community"市场源- `/skills use my-skill, Code and execute a Hello World program.` — 使用技能执行查询+### `/export`(导出会话)++将当前对话导出到文件或剪贴板。++#### 子命令++| 命令 | 说明 |+|---|---|+| `/export` | 将整段对话复制到剪贴板;剪贴板不可用时提示指定文件名 |+| `/export <filename>` | 将对话写入工作空间目录下的 `filename.txt`;文件名不含 `.txt` 后缀时自动追加 |++#### 输出格式++导出的文本按时间戳与角色前缀逐条渲染:++- `[User] <时间戳>` — 用户输入+- `[Assistant] <时间戳>` — 助手回复+- `[Thinking] <时间戳>` — 内部推理过程+- `[Tools] <时间戳>` — 工具调用,含名称、摘要、截断结果(最多 500 字符)+- `[System] / [Error] / [Info] <时间戳>` — 系统消息+- `[Diff] <时间戳>` — 按轮次的文件变更摘要++#### Tab 补全++输入 `/export ` 后按 Tab,自动生成文件名建议:++- `<时间戳>-<净化后的首条提示>.txt` — 取首条用户消息(截断 50 字符,净化特殊字符)+- `conversation-<时间戳>.txt` — 通用时间戳名++时间戳格式:`YYYY-MM-DD-HHmmss`。++#### 行为细节++- **剪贴板回退**:未指定文件名且剪贴板不可用时,提示用户指定文件名导出到文件。+- **文件名规范化**:任何扩展名都会被替换为 `.txt`;例如 `/export my-chat.json` 变为 `my-chat.txt`。+- **写入位置**:文件保存到 `ctx.getWorkspaceDir()`(回退为 `process.cwd()`)。++#### 示例++- `/export` — 复制对话到剪贴板+- `/export my-chat` — 保存到工作空间下的 `my-chat.txt`+- `/export 2026-05-09-debug-session.txt` — 使用显式时间戳文件名保存++### `/status`(查看运行状态)++显示 jiuwenclaw 运行状态概览、用量统计或配置编辑界面。++#### 子命令++| 命令 | 说明 |+|---|---|+| `/status` | 显示完整状态概览(版本、会话、模型、连接、MCP 服务、配置来源) |+| `/status overview` | 与 `/status` 相同——显式概览子命令 |+| `/status usage` | 显示当前会话的 token 用量(输入、输出、总量、按模型拆分) |+| `/status config` | 进入交互式配置编辑器(与 `/config edit` 相同) |++#### 概览显示分区++运行 `/status` 时展示四个键值面板:++1. **核心信息**:版本号、会话 ID、会话名称(或提示 `/rename` 添加)、当前工作目录、当前模式+2. **模型与 API**:模型名称、提供商、API 基地址、连接状态+3. **MCP 服务**:每个服务的名称、传输类型、启用/禁用状态+4. **配置来源**:配置文件路径与所有设置来源路径++#### 用量显示++`/status usage` 显示当前会话的 token 消耗:++- 总输入 token、输出 token、总 token+- 按模型拆分:模型名称、token 总量、输入/输出细分++#### 交互模式++若 TUI 提供交互式 StatusView(`ctx.enterStatusView`),`/status` 会打开带标签页的完整状态 UI。子命令参数选择初始标签页:++- `/status` → 打开概览标签页+- `/status usage` → 打开用量标签页+- `/status config` → 打开配置标签页++若 StatusView 不可用,回退为内联键值展示。++#### 数据来源++- 概览数据:通过 `command.status` RPC 请求 AgentServer+- 用量数据:通过 `ctx.getUsageSummary()` 从本地会话追踪获取+- 配置数据:通过 `config.get` RPC 请求 AgentServer++#### 示例++- `/status` — 显示完整概览+- `/status overview` — 显示概览(显式)+- `/status usage` — 显示 token 用量+- `/status config` — 打开配置编辑器+---## 待开发@@ -275,8 +373,6 @@|----------------|---------|| `/btw` | 提问 || `/context` | 上下文状态查看 |-| `/export` | 导出相关文件 || `/memory` | 记忆管理 |-| `/permissions` | 权限管理 |diff --git "a/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md" "b/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md"index 471e01f312..69366094d9 100644--- "a/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md"+++ "b/docs/zh/TUI\344\275\277\347\224\250\346\214\207\345\215\227.md"@@ -81,6 +81,8 @@| `/teamskills` | - | TeamSkills Hub(初始化、校验、打包、搜索、安装等) | `/teamskills list` | 全部 || `/model` | - | 查看/新增/切换模型 | `/model`、`/model add name k=v` | 全部 || `/workspace` | `/workspace_dir`, `/workspace-dir` | 管理文件操作可信目录 | `/workspace add .` | 全部 |+| `/export` | - | 导出当前会话到文件或剪贴板 | `/export`、`/export my-chat` | 全部 |+| `/status` | - | 查看运行状态概览、用量、配置 | `/status`、`/status usage` | 全部 |#### `/resume` 与 `/continue` 在 TUI 中的特殊行为@@ -152,9 +154,25 @@#### `/permissions`-- 用法:`/permissions <allow|ask|deny> <tool_name>`+- 用法:`/permissions <allow|ask|deny> <tool_name>`- 调用 `permissions.tools.update`,写入配置中的 per-tool 策略。+#### `/export`++- 无参数:复制当前对话到剪贴板;剪贴板不可用时提示指定文件名。+- `/export <filename>`:将对话写入工作空间目录下的 `.txt` 文件(自动追加 `.txt` 后缀)。+- 输出格式为纯文本,每条消息按 `[User]`、`[Assistant]`、`[Thinking]`、`[Tools]` 等角色前缀与时间戳逐条渲染。+- 支持 Tab 补全:自动生成 `<时间戳>-<首条提示>.txt` 和 `conversation-<时间戳>.txt` 建议。+- 详见 [Slash命令表.md](Slash命令表.md) 的 `/export` 小节。++#### `/status`++- `/status`:显示完整状态概览(版本、会话、模型、连接、MCP 服务、配置来源)。+- `/status usage`:显示当前会话 token 用量统计(含按模型拆分)。+- `/status config`:进入交互式配置编辑器。+- 若 TUI 提供 StatusView,会打开带标签页的交互界面;否则回退为内联键值展示。+- 详见 [Slash命令表.md](Slash命令表.md) 的 `/status` 小节。+#### `/clear` 与忙状态- 若 `session is busy`(正在处理),`/clear` 会拒绝执行,需先中断任务(**`Ctrl+C`** 第一次中断;默认构建无 `/cancel` 命令)。