feat(ai): add remote coding agent sessions for SSH hosts (#1545)

* feat(ai): add host coding agent sessions with configured providers

* Wait for agent initialization and shutdown before resuming sessions

* Keep Pi transcripts outside its configuration migration directory

* Cover Pi session directory separation

* Update core permission catalog expectations for remote agents

* Install remote agent runtimes from verified official sources

* Wait for the identity panel credentials request in its test

* Add scoped SSH forwarding setup for remote agents

* Verify forwarding setup through a fresh SSH connection

* Bound the SSH forwarding verification timeout

* Return the forwarding verification callback result

* fix(ai): support agent send and interrupt keyboard shortcuts

* feat(ai): add agent queues attachments worktrees and session recovery

* fix(ai): handle deleted workspace paths and duplicate status events

* fix(ai): accept file references in root workspaces

* fix(ai): refresh paused queues after agent errors

* fix(ai): store agent sessions in plugin tables and lock down OpenCode

Agent sessions lived in a single ctx.kv value holding up to 2000 events,
which passed the 256 KB kv limit within minutes of a normal run. Every
save after that failed, so history, nativeId, queue and archive changes
were lost and every event wrote a kv audit row.

Sessions, events and queued prompts now have their own tables. A running
agent appends events in batches at most once a second with a lazy save;
session and queue changes save immediately. Prompts, drafts and stored
event text are capped in UTF-8 bytes to fit MySQL TEXT. kv:own is no
longer requested.

The OpenCode server now requires a per-session password, so other local
accounts on the host cannot drive the agent through its loopback port.

* test(upgrade): include agent session tables in the reviewed upgrade SQL
This commit is contained in:
ZacharyZcR authored and LukeGus committed 2026-10-03 16:01:47 -05:00
1 parent 77bcbdb3d6
commit bf817d8bd1
75 files changed
+7292 -6

No files matched your search

+76
View File
@@ -116,6 +116,82 @@
"hosts": {
"docsLink": "查看文档"
},
"agents": {
"title": "AI Agent",
"permissionTitle": "运行远程 AI Agent",
"permissionDescription": "使用已配置的 AI Provider 在 SSH 主机上启动 Agent。Agent 可使用 SSH 账号权限执行命令和修改文件。",
"new": "新建会话",
"description": "在此主机的目录中运行 Agent,使用 Termix 配置的模型服务。",
"runtime": "Agent",
"provider": "Termix Provider",
"chooseProvider": "选择兼容的 Provider",
"model": "模型",
"directory": "工作目录",
"executable": "可执行文件(可选绝对路径)",
"requirements": "主机需要 Node.js 22.19+ 及所选 Agent,并允许 SSH 回环地址远程转发。不覆盖已有 Agent 配置。",
"responsesRequired": "Codex 需要 Responses API;仅支持 Chat Completions 的接口无法用于 Codex。",
"piPermissions": "Pi 工具使用当前 SSH 账号权限执行。请只在允许 Agent 修改的目录中启动。",
"start": "启动 Agent",
"resume": "恢复会话",
"stop": "停止会话",
"interrupt": "中断任务",
"send": "发送",
"prompt": "让 Agent 在此目录中完成任务…",
"noSessions": "此主机还没有 Agent 会话。",
"approval": "Agent 需要你的决定",
"answer": "填写答复(结构化问题使用 JSON)",
"allow": "允许一次",
"deny": "拒绝",
"tool": "工具执行",
"streamFailed": "Agent 消息连接断开,请重新打开会话连接。",
"status": {
"starting": "正在启动",
"ready": "就绪",
"running": "执行中",
"stopped": "已停止",
"error": "出错"
},
"installRuntime": "安装所选 Agent 和 Node.js",
"installSource": "仅从官方来源安装:nodejs.org(SHA-256 校验)、registry.npmjs.org(锁定依赖与完整性校验)。安装到当前 SSH 用户的 ~/.local/share/termix-agent-runtime;需要 curl、tar 和 Linux/macOS x64 或 arm64。不修改 SSH 转发策略。",
"installSucceeded": "安装及版本校验成功。现在可以启动 Agent;SSH 还需允许回环地址远程转发。",
"installFailed": "安装失败,请查看日志后重试。",
"installLog": "安装日志",
"enableForwarding": "一键启用 Agent 转发",
"forwardingScope": "需要 Linux、systemd/OpenSSH,以及 root 或免密 sudo。自动备份、校验并重载 SSH,仅为当前 SSH 账号与实际连接来源开放回环远程转发,保留已有本地转发权限。失败自动回滚。",
"forwardingSucceeded": "SSH 回环远程转发已就绪。请启动或恢复 Agent,建立新的 SSH 连接。",
"forwardingFailed": "SSH 转发配置失败,请查看日志;未通过校验的配置不会保留。",
"search": "搜索会话",
"showArchived": "显示已归档",
"sessionName": "会话名称",
"rename": "重命名",
"archive": "归档并停止",
"restore": "恢复归档",
"queue": "待发消息",
"enqueue": "加入队列",
"continueQueue": "继续队列",
"pauseQueue": "暂停队列",
"editQueued": "编辑待发消息",
"save": "保存",
"remove": "移除",
"upload": "上传附件",
"remoteFile": "工作目录内的文件路径",
"attach": "引用文件",
"attachments": "复用会话附件",
"pasteImage": "可在输入框粘贴图片。每条最多 4 个附件,每个不超过 1 MiB。",
"attachmentLimit": "每条最多 4 个附件,每个不超过 1 MiB",
"review": "Git 改动与 worktree",
"gitStatus": "刷新 Git 状态",
"diffFile": "要审阅的文件路径",
"diff": "查看 diff",
"branch": "新分支名称",
"createWorktree": "创建 worktree",
"useWorktree": "在此 worktree 新建会话",
"worktreeHint": "从 HEAD 创建新分支。未提交改动保留在当前目录,不会自动删除已有 worktree。",
"clean": "没有改动",
"reconnecting": "正在重连并补齐消息…",
"unavailable": "无法访问会话,请检查权限或重新登录。",
"shortcuts": "Enter 发送或排队 · Shift+Enter 换行 · Esc 中断并暂停队列"
},
"plugin": {
"name": "AI 助手"
}