codex-loop AI Terminal(本地 MVP+)
这不是 GitHub Pages 线上能力,而是一个本地 relay + 本地静态页的最小网页端。它先解决四件事:看 daemon 状态、看日志、以受保护模式接入当前 thread、并用多 pane 观察同一条 loop。
默认设计是安全优先:当 daemon 仍在运行时,网页端默认不直接往同一个 thread 发消息,避免和后台 tick 同时写入同一条会话。
启动方式
- 终端一:
python3 tools/codex_loop_web_relay.py --workspace /home/clashuser/hzh/item_bo/learn-likecc - 终端二:
cd site && python3 -m http.server 8080 - 浏览器打开
http://127.0.0.1:8080/topic-codex-loop-console.html
Relay
Workspace
relayidle
thread writes—
shell—
- 等待 relay 状态与本地 shell 状态完成首次同步。
Repo-backed 补充:别把 Session Browser、Operator HUD、Local Desk 混成一层
最近补 Session Stack 时,最容易犯的错不是“功能不够多”,而是把不同参考项目解决的问题揉成同一种控制面。把边界拆开之后,LikeCode 本地 AI Terminal 应该学什么,会更清楚。
| 参考仓库 | 默认表面 | 它主要回答什么 | 对 codex-loop AI Terminal 的启发 |
|---|---|---|---|
reference/reference_cc_ui/hermes-webui/ |
session browser | 用三栏 WebUI 把 session / tools / workspace 接回已有 agent,追求 CLI parity |
说明 Session Stack 可以借“左侧 session 总览 + 工位切换”,但不必把整页做成完整聊天前台 |
reference/reference_cc_ui/claudecodeui/ |
multi-session workbench | 让多个 agent CLI session、文件树、Git、插件、移动端访问收进一个统一工作台 | 说明我们要学的是“session discovery + operator entrypoint”,不是立刻复制整套 file/git/plugin 面 |
reference/reference_cc_ui/hermes-hud/ |
operator HUD | 让 operator 看见 agent 的 health、growth、cron、approval queue、tmux seat | 说明 Attention Queue / Session Identity / headline badges 该偏向告警与 ownership,而不是继续堆聊天 UI |
所以当前这页更准确的定位不是“又一个 Claude 风格聊天壳”,而是 local operator desk。
Hermes WebUI / CloudCLI UI提醒我们要把 session、workspace、入口工位收拢。Hermes HUD提醒我们要把 self-observability、approval queue、runtime cues 抬到第一屏。- 但本页仍然只服务一个本地 loop workspace:它优先回答
daemon / thread / shell现在谁接管、谁可写、下一步该处理什么。
这也是为什么 Session Stack 现在更像一个带 guardrails 的 operator summary,而不是完整 session browser,更不是 agent 自我意识看板。
再压一层:把 Session Stack 读成五层控制面契约
如果只把这一块看成“又多了几个状态卡片”,它会继续显得很碎。更稳定的读法,是把它当成一个固定的 operator reading order。
| 层 | 当前表面 | 它先回答什么 | 不该承担什么 |
|---|---|---|---|
| 1 | Quick Actions |
现在能立刻开哪个工位、触发哪个入口动作 | 不负责解释系统为什么异常 |
| 2 | Attention Queue |
下一步最该处理的是 relay、thread 还是 shell | 不重复完整状态明细 |
| 3 | Session Identity |
当前 daemon / thread / active shell 具体是谁 | 不替代 assignment 或日志正文 |
| 4 | Desk Assignments |
Overview / Thread Desk / Shell Lab 这几个工位各自接管了什么对象 |
不做更深的 shell runtime 排障 |
| 5 | Shell Roster |
进入 shell 级别,继续看 active / standby / closed 的细节 | 不回头承担全局控制面摘要 |
这样切之后,Session Stack 的阅读顺序就更清楚了。
- 先看
Quick Actions,确认入口工位和恢复动作还在不在。 - 再看
Attention Queue,判断现在最热的风险到底落在 relay、thread 还是 shell。 - 再看
Session Identity与Desk Assignments,确认“是谁”以及“哪个工位接着它”。 - 最后才下钻到
Shell Roster,处理具体 session 的 runtime 细节。
这套分层对 LikeCode 的意义,不是把一页做得更复杂,而是守住一个约束:同一层只回答同一种 operator 问题。否则一旦 Session Identity、Desk Assignments、Shell Roster 都开始同时回答“当前谁接管了哪个 shell”,这个控制面很快又会退回“信息很多,但没人知道先看哪”的状态。
别把 approval 也揉成一种:它至少有三层边界
如果只盯着 Session Stack 的 ownership 和 reading order,还是会漏掉另一条更硬的 operator 约束:“谁在接管” 和 “谁能放行动作” 不是一回事。参考仓里至少已经能看到三种不同的 approval 边界。
| 参考源 | 真正被批准的对象 | 暴露给 operator 的表面 | 对 LikeCode 的直接约束 |
|---|---|---|---|
reference/reference_agent/reference_control-agent-cli/opencode/README.md + internal/permission/permission.go |
单次 tool action,或当前 session 的持续放行 | TUI permission dialog,支持 Allow / Allow for session / Deny |
说明 tool approval 该绑定“这次动作能不能做”,不要和 session ownership 混成一个 badge |
reference/reference_agent/reference_control-agent-cli/OfficeCLI/SKILL.md |
对文稿修改的提案,不是直接落盘写入 | mark 先挂起 edit proposal,再单独 review / apply |
说明 artifact review 是另一层:即使当前工位可写,也不该跳过“先看提案再落盘” |
reference/reference_agent/hermes-agent/hermes_cli/main.py |
危险命令执行 | 默认 approval prompt;只有显式 --yolo 才会整体绕过 |
说明“全局放开”必须是高风险姿态,不能伪装成普通运行状态 |
把这三类边界放回 LikeCode,本地 operator desk 更合理的读法应该是:
Readonly / Writable先回答 thread 现在有没有写入口,这是 ownership guard,不是动作批准本身。Attention Queue或后续更细的 approval cue,才应该回答“哪个动作正在等你放行”。- 真正涉及文件或产物改写时,还应该保留 proposal / review 的独立层,而不是因为 thread 已经 writable 就默认可以直接写。
所以更稳的控制面约束不是“所有安全都进一个状态条”,而是把它拆成一条 approval ladder:entry guard -> action approval -> artifact review。这样 Session Stack 负责把人带到正确工位,但不会假装自己已经替 operator 完成了审批。
daemon_running—
pid—
thread_id—
heartbeat—
interval—
tick phase—
tick started—
tick finished—
returncode—
当前 thread 预览来自 daemon 状态与最近一轮输出。
预览
—
路径:—
connecting…
路径:—
connecting…
默认保护:daemon 运行时不直接写 thread。需要强制发送时勾选风险开关。
lock mode—
lock source—
lock note—
最近回复
—
借了 Hermes WebUI 和 CloudCLI UI 的 session/sidebar 思路,把 operator 当前真正要看的 relay、thread、workspace 与 shell roster 收成一个总览面。
Waiting for relay state.
Waiting for thread lock state.
Waiting for shell roster.
Current desk preset.
Waiting for thread binding.
No daemon run active.
No active shell seat.
Refresh relay state before trusting ownership.
Review thread write protection before manual sends.
Bring a live shell seat online if local PTY work is needed.
No live daemon run is attached yet.
Thread Desk is waiting for a bound thread.
Shell Lab has not claimed a live PTY seat yet.
relayidle
daemon—
tick—
workspaceOverview
presetOverview
last actionidle
thread—
lock—
action at—
waiting…
记录 daemon、thread lock、shell 与 relay 的最近动作,优先帮助判断“刚刚到底发生了什么”。
暂无 shell session。点击“新建 Shell”。