refactor(commands): rename status command to list and update related references
feat(feishu): update card schema to 2.0 and simplify approval card structure docs(feishu): add documentation for card json schema 2.0 changes
This commit is contained in:
+16
-20
@@ -85,7 +85,7 @@ async def handle_command(user_id: str, text: str) -> Optional[str]:
|
||||
|
||||
if cmd in (P+"new", P+"n"):
|
||||
return await _cmd_new(user_id, args)
|
||||
elif cmd in (P+"status", P+"list", P+"ls", P+"l"):
|
||||
elif cmd in (P+"list", P+"ls", P+"l", P+"status"):
|
||||
return await _cmd_status(user_id)
|
||||
elif cmd in (P+"close", P+"c"):
|
||||
return await _cmd_close(user_id, args)
|
||||
@@ -443,7 +443,7 @@ async def _cmd_nodes(user_id: str, args: str) -> str:
|
||||
"""List nodes or switch active node."""
|
||||
from config import ROUTER_MODE
|
||||
if not ROUTER_MODE:
|
||||
return "Not in router mode. Run standalone.py for multi-host support."
|
||||
return "Not in router mode."
|
||||
|
||||
from router.nodes import get_node_registry
|
||||
registry = get_node_registry()
|
||||
@@ -476,29 +476,25 @@ def _cmd_help() -> str:
|
||||
"""Show help."""
|
||||
from config import COMMAND_PREFIX as P
|
||||
return f"""**Commands:** (prefix: `{P}`)
|
||||
{P}new <dir> [msg] [--idle N] [--perm MODE] - Create session
|
||||
{P}status - Show sessions and current mode
|
||||
{P}close [n] - Close session (active or by number)
|
||||
{P}switch <n> - Switch to session by number
|
||||
{P}perm <mode> [conv_id] - Set permission mode (default/edit/plan/bypass/auto)
|
||||
{P}stop - Interrupt the current task
|
||||
{P}progress - Show task progress
|
||||
{P}direct - Direct mode: messages → Claude Code (no LLM overhead)
|
||||
{P}new <dir> [msg] [--idle N] [--perm MODE] - Create session (alias: {P}n)
|
||||
{P}list - Show sessions and current mode (alias: {P}ls, {P}l, {P}status)
|
||||
{P}close [n] - Close session (active or by number) (alias: {P}c)
|
||||
{P}switch <n> - Switch to session by number (alias: {P}s)
|
||||
{P}perm <mode> [conv_id] - Set permission mode (alias: {P}perm)
|
||||
{P}stop - Interrupt the current task (alias: {P}interrupt)
|
||||
{P}progress - Show task progress (alias: {P}p)
|
||||
{P}direct - Direct mode: messages → Claude Code
|
||||
{P}smart - Smart mode: messages → LLM routing (default)
|
||||
{P}shell <cmd> - Run shell command (bypasses LLM)
|
||||
{P}shell <cmd> - Run shell command
|
||||
{P}remind <time> <msg> - Set reminder (e.g. {P}remind 10m check build)
|
||||
{P}tasks - List background tasks
|
||||
{P}nodes - List connected host nodes
|
||||
{P}node <name> - Switch active node
|
||||
{P}retry - Retry last message
|
||||
{P}help - Show this help
|
||||
{P}help - Show this help (alias: {P}h, {P}?)
|
||||
|
||||
**Permission modes** (used by {P}perm and {P}new --perm):
|
||||
default — 默认模式,遇到文件编辑操作时手动确认
|
||||
edit — 自动接受文件编辑,但 shell 命令仍需手动确认
|
||||
适合:日常开发,需要对命令执行保持控制
|
||||
default — 默认模式,需审批工具调用
|
||||
edit — 自动接受文件编辑,shell 命令仍需确认
|
||||
plan — 只规划、不执行任何写操作
|
||||
适合:先预览 CC 的操作计划再决定是否执行
|
||||
bypass — 跳过所有权限确认,CC 自动执行一切操作
|
||||
适合:受信任的沙盒环境、自动化任务
|
||||
auto — 允许所有工具,不询问(等效 bypass + dontAsk)"""
|
||||
bypass — 跳过所有权限确认
|
||||
auto — 允许所有工具,不询问"""
|
||||
+20
-20
@@ -149,7 +149,11 @@ def build_sessions_card(sessions: list[dict], active_conv_id: str | None, mode:
|
||||
|
||||
|
||||
def build_approval_card(conv_id: str, tool_name: str, summary: str, timeout: int = 120) -> dict:
|
||||
"""Build an approval card for a tool call (schema 2.0, with approve/deny buttons)."""
|
||||
"""Build an approval card for a tool call (schema 2.0, with approve/deny buttons).
|
||||
|
||||
Note: JSON 2.0 does NOT support "action" wrapper or "note" components.
|
||||
Buttons go directly in elements; use div with small text for the note.
|
||||
"""
|
||||
return {
|
||||
"schema": "2.0",
|
||||
"header": {
|
||||
@@ -163,27 +167,23 @@ def build_approval_card(conv_id: str, tool_name: str, summary: str, timeout: int
|
||||
"content": f"**工具:** `{tool_name}`\n**参数:** {summary}",
|
||||
},
|
||||
{
|
||||
"tag": "action",
|
||||
"actions": [
|
||||
{
|
||||
"tag": "button",
|
||||
"text": {"tag": "plain_text", "content": "✅ 批准"},
|
||||
"type": "primary",
|
||||
"value": {"action": "approve", "conv_id": conv_id},
|
||||
},
|
||||
{
|
||||
"tag": "button",
|
||||
"text": {"tag": "plain_text", "content": "❌ 拒绝"},
|
||||
"type": "danger",
|
||||
"value": {"action": "deny", "conv_id": conv_id},
|
||||
},
|
||||
],
|
||||
"tag": "button",
|
||||
"text": {"tag": "plain_text", "content": "✅ 批准"},
|
||||
"type": "primary",
|
||||
"value": {"action": "approve", "conv_id": conv_id},
|
||||
},
|
||||
{
|
||||
"tag": "note",
|
||||
"elements": [
|
||||
{"tag": "plain_text", "content": f"超时 {timeout}s 自动拒绝 | 也可回复 y/n"},
|
||||
],
|
||||
"tag": "button",
|
||||
"text": {"tag": "plain_text", "content": "❌ 拒绝"},
|
||||
"type": "danger",
|
||||
"value": {"action": "deny", "conv_id": conv_id},
|
||||
},
|
||||
{
|
||||
"tag": "div",
|
||||
"text": {
|
||||
"tag": "plain_text",
|
||||
"content": f"超时 {timeout}s 自动拒绝 | 也可回复 y/n",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user