文档Docs
网页终端:在手机、平板和电脑浏览器里用命令行Web terminal — command line on your phone, tablet or computer
Olares 应用在设置里打开自己的交互式终端,由 Olares 验证登录;普通 Agent J 主机提供手机、平板和电脑浏览器里的限时完整终端,开启和打开需要本人确认。Open the Olares app’s interactive terminal from Settings, with sign-in verified by Olares. Ordinary Agent J hosts offer a time-limited full terminal on phones, tablets and computer browsers, with owner confirmation to enable and open it.
在 Olares 应用里打开
从 Olares 应用市场安装的 Agent J 使用 Olares 自带的交互式网页终端。在 Agent J 应用的设置页点「打开网页终端」;已经配对的遥控器也能在「设置」→「安全」点「打开 Olares 网页终端」。它会在新标签页打开,由 Olares 验证你的登录身份;尚未登录时,先按 Olares 的提示登录。
终端运行在 Agent J 自己的应用容器里,使用同一个用户、主目录和配置。查看状态运行 agentj status,查看自己的后台任务运行 agentj tasks list --json。Olares 的其他 Terminal 应用运行在别的容器里,不能代替这个入口。
这个入口不要求先开启 Agent J 的行模式终端,也不额外要求 Agent J 的 Face ID。它使用 Olares 的终端和登录规则,不提供下文 Agent J 终端的输出遮挡、操作日志、sudo 卡片或终端命令确认。不要打印密码、密钥、令牌或完整进程命令行,也不要把含有这些内容的输出发到聊天里。
普通 Agent J 主机的完整终端
以下说明适用于普通 Linux、macOS 和 WSL 安装的 Agent J 网页终端;完整终端需要主机和页面都支持 PTY;主机太旧时会提示升级,不会改开一个逐行输入框。
网页终端让你在手机、平板或电脑浏览器里使用 Agent J 主机(装着 Agent J 的那台机器)的命令行。打开头像菜单里的终端卡,也可以从「设置」→「安全」→「网页终端」进入。
手机、平板和电脑浏览器遵守相同的授权规则:先配对、设置通行密钥,再由你本人开启。手机不会因为屏幕小而失去终端功能。
它默认是关的。开启要你本人确认:在已配对的浏览器里用 Face ID、Touch ID 或通行密钥加 Agent J 主机登录密码,或者在 Agent J 主机上运行一条命令。Agent、定时任务和脚本都开不了。每次打开都要用 Face ID 确认,默认最长 15 分钟,全程记录操作日志(记录什么、谁能看)。
开启以后,你还可以在聊天里直接用!开头运行命令([详见](#bang));让 Agent J 主机记住它的登录密码,之后扫脸就能填入,Agent 的管理员命令卡上也能用([详见](#computer-password));还可以让 Agent 帮你打开终端、填好命令,或者读取终端的输出([详见](#agent))。
在哪里找
打开「设置」→「安全」,「网页终端」这一行一直都在,按情况写着下一步:
- 已配对的浏览器,还没开启或还不能用:点「开启并打开网页终端」,见[在浏览器里开启](#enable-browser)。下面「也可以在 Agent J 主机上运行下面这行:」写着
agentj terminal enable,点旁边的按钮就能复制([详见](#enable))。 - Agent J 主机是 Windows(不在 WSL 里):写明这台 Agent J 主机的系统暂不支持,下一版支持;现在支持 Linux、macOS 和 Windows 的 WSL。
- 这台设备还没设 Face ID:先点「设置 Face ID」。
- 只写着一行命令、没有开启按钮:这台遥控器配对时没记下它是电脑还是手机(比如配对得很早)。重新配对这台遥控器,就能直接在这里开启;也可以在 Agent J 主机上运行写着的那行命令,见 [谁能用](#who)。
- 已开启,这个浏览器也能用:点「打开网页终端」。
在浏览器里开启
- 在手机、平板或电脑浏览器里打开遥控器,到「设置」→「安全」→「网页终端」点「开启并打开网页终端」。
- 用 Face ID 确认。
- 输入一次 Agent J 主机登录密码,就是你登录这台主机、用 sudo 时输入的密码。主机用 sudo 核对它;开启时每次都要亲手输入,不用记住的密码。
- 密码对了,网页终端就为这个浏览器开启,并马上打开:你离开「设置」,在这个窗口里全屏使用它,点右上角的 ✕ 收起([详见](#full-screen))。
开启后,所有遥控器都会收到一条通知,写明是在哪台设备上开启的。这台是网页版遥控器时,通知里还会写:不是你本人开启的话,立刻在 Agent J 主机上运行 agentj terminal disable。
手机和平板与电脑浏览器使用相同的保护:配对设备名单、签名、Face ID 或通行密钥、Agent J 主机登录密码、操作日志和时间限制。改变窗口大小不会改变授权。
在 Agent J 主机上开启
另一种开启方式:在 Agent J 主机自己的终端里运行:
agentj terminal enable
- 主机上会显示一串 6 位对照码,同时你已配对的遥控器(包括手机)都会收到一张确认卡片,卡片上写着能用的设备、每次最长几分钟,以及同一串对照码。
- 核对两边的数字一样,再在一台设了 Face ID 的遥控器上点允许,用 Face ID 确认。5 分钟内没人确认,就什么都不改。
- 确认后,名单上的浏览器的「设置」→「安全」里出现「打开网页终端」。
要求:
- 至少一台已配对的浏览器设了 Face ID(或指纹,也就是通行密钥)。还没设的,先在它的「设置」→「安全」→「网页终端」点「设置 Face ID」。
- 支持 Linux、macOS 和 Windows 的 WSL;Windows 本身还不支持,留到下一版。Mac 上另有几条,见 [在 Mac 上](#macos)。
- 你在 Agent J 主机上的账户要能用 sudo,而且 sudo 要输密码。sudo 不用密码(NOPASSWD)或者账户不是管理员,
agentj terminal enable会直接拒绝并说明原因:网页终端要拿 Agent J 主机登录密码当第二道锁。
这条命令只能由你在自己的终端里亲手运行。Agent、定时任务、脚本,还有网页终端本身,都开不了它。遥控器只能用「开启并打开网页终端」为它自己开启,还要 Face ID 和 Agent J 主机登录密码。
有好几台设了 Face ID 的浏览器时,用 --device 选一台(可以写多次);每次最长几分钟用 --minutes 改,默认 15,最多 60:
agentj terminal enable --device <设备> --minutes 30
agentj terminal status 列出开关、名单上的设备和每台是否记住了 Agent J 主机登录密码。
在 Mac 上
Agent J 主机是 Mac 时,网页终端和 Linux 上一样:同样要你本人开启、每次打开都要 Face ID、有时间限制、全程记录操作日志、需要确认的命令用普通按钮、敲的命令照样先遮挡再记录。几点不同:
- 开启前还要满足三条,不满足时会直接说明原因:你的 Mac 账户是管理员(系统设置 → 用户与群组里写着管理员);sudo 没有开启 Touch ID 或 Apple Watch 验证,不然 sudo 会在 Mac 屏幕上等你按指纹,远程永远等不到;装了命令行开发工具(在 Mac 上运行
xcode-select --install),网页终端里的 sudo 才能安全地用记住的 Agent J 主机登录密码。没装的话终端照样能用,只是 sudo 会说明原因并拒绝运行。 - 终端用你的登录 shell:默认是 zsh;登录 shell 是 bash 的,就用系统自带的 bash。它不读
~/.zshrc、~/.bash_profile这些启动文件,所以里面的别名和函数没有;常用路径(包括 Homebrew 的/opt/homebrew/bin)都在 PATH 里,文字按 UTF-8 显示。 - 命令历史只存在 Agent J 的数据目录里,不写进
~/.zsh_history。看起来像密码、密钥、令牌的行,和以空格开头的行,都不进历史。 - Mac 上没有 Linux 那样的隔离运行空间。终端以你本人的身份运行,不是 Agent,也不受 Agent 的隔离限制;保护它的是前面那几道门。
谁能用
名单上的设备才能打开网页终端。开启时选的那台,或者在浏览器里自己开启的那台,是你自己的。
请朋友(比如一位工程师)帮忙时,不要把你的设备交给他。让他在自己电脑的浏览器里配对成一台遥控器,并设好他自己的 Face ID,然后你在 Agent J 主机上临时允许这一台:
agentj terminal allow <设备> --hours 2
--hours 可以填 1 到 24,默认 2,到时间自动取消。临时允许的设备不会记住 Agent J 主机登录密码,每次打开都要重新输入一次。用 agentj terminal deny <设备> 可以提前把它从名单上去掉。手机、平板和电脑浏览器都必须经过同样的允许流程。
网页版遥控器要多加 --allow-web。这种设备的「网页终端」那一行会写「这台设备是网页版」。原因:网页版的页面如果被篡改,可能借用你的 Face ID。确认卡片上也会写明这一点。
agentj terminal allow <设备> --allow-web
打开和输入密码
- 在已配对的浏览器里,到「设置」→「安全」→「网页终端」点「打开网页终端」,再点「用 Face ID 确认」。每次打开都要 Face ID,不会因为刚用过就跳过。
- 在一台设备上第一次打开时(除非这台已经能扫脸填入,见[下文](#computer-password)),终端页里会出现「输入 Agent J 主机登录密码」。这就是你登录 Agent J 主机、用 sudo 时输入的那个密码。它在浏览器里加密后才发出,只有 Agent J 主机能解开;它不会显示,也不会留在这台设备上。点「用 Face ID 发送」。
- Agent J 主机核对密码,对了就打开终端,顶上显示当前目录和「操作日志记录中」,后面是剩余时间;点它可以看记录什么、为什么记录、谁能看。
密码输错:同一台设备连错 3 次锁 15 分钟;整台主机一小时内错 10 次锁 1 小时。每次输错,所有遥控器都会收到提醒。Agent J 主机的系统自己可能也会把这些错误计入它的锁定次数(比如 Linux 的 pam_faillock),连错太多次,可能连主机本身的登录也会被暂时锁住。
Agent J 主机登录密码怎么保存
Agent J 主机会按下面三种方式之一保存密码,「设置」里的那一行会用大白话写明是哪一种:
| 方式 | 设置里怎么写 | 什么时候用 |
|---|---|---|
| 扫脸才能解开 | Agent J 主机登录密码已加密保存,只有你扫脸才能解开。 | 这台设备的 Face ID 支持这项能力时(优先) |
| 主机本地加密 | Agent J 主机登录密码已加密保存在 Agent J 主机本地,你扫脸后才会使用。 | 设备不支持上一种,且「隔离运行」开着、「会话模式」是「独立会话」时 |
| 只在这一次 | 每次打开都要输入 Agent J 主机登录密码,用完即清除。 | 其他情况,以及朋友临时允许的设备 |
这几种方式能防什么、不能防什么:
- 前两种:防备份、离线拷贝和 Agent 直接读盘;不防能改 Agent J 代码或用户服务的程序。 密码文件加了密,拷走、备份走都打不开,Agent 直接去读也读不到明文。但同一台 Agent J 主机上,如果有程序能改 Agent J 自己的代码或你的用户服务,它就能在密码被用到的那一刻拿到它。
- 主机本地加密只在「隔离运行」开着、「会话模式」是「独立会话」时才能用;你一关隔离或改成共享会话,这份密码立刻删除,下次打开重新输入。
- 只在这一次:密码只在 Agent J 主机端程序的内存里,终端关掉就清除,硬盘上不留。
想让 Agent J 主机对这台设备忘掉密码,在「设置」→「安全」→「Agent J 主机登录密码」点「清除这台」;想删掉所有记住的密码,在 Agent J 主机上运行 agentj terminal forget。你在 Agent J 主机上改了登录密码以后,旧的那份在下次被 sudo 拒绝时自动删除,下次打开时再输一次新密码就好。
Agent J 主机登录密码:输一次,以后扫脸
上面第一种方式就是一个小小的密码保险箱。Agent J 主机登录密码只以加密形式存在 Agent J 主机上,从不存在遥控器上;每台设备用自己的 Face ID 或指纹来解开。
- 在一台设备上第一次用:输一次密码(在终端里,或在管理员命令卡上)。之后这台设备扫脸就能填入。
- 换一台设备:在那台设备的「设置」→「安全」→「Agent J 主机登录密码」点「让这台也能用」,先用 Face ID 确认,再在 2 分钟内到一台已经能用的设备上点「用 Face ID 同意」。那张卡片上写着新设备的名字、设备编号、通行密钥、配对日期和类型:只在你认得这台设备时同意。同意后所有遥控器都会收到提醒。也可以直接在新设备上输一次密码。
- Agent 的管理员命令卡(sudo):点「用 Face ID 填入 Agent J 主机登录密码」;或者点「或者输入 Agent J 主机登录密码」,并勾选「用 Face ID 记住(下次扫脸即可)」。密码只用于这一条命令,Agent 拿到的是命令的输出,不是密码。手机上的管理员命令卡也能这样用。
- Face ID 不支持这项能力的设备(设置里会写明),以及临时允许的设备,每次都要输入密码。
- 你改过密码时,卡片上会写「记住的 Agent J 主机登录密码不对了(可能改过),请输入一次。」这不算输错密码。
它能防的和上面一样:防备份、离线拷贝和 Agent 直接读文件;不防能改 Agent J 代码或用户服务的程序。
「设置」里的「Agent J 主机登录密码」那一行写着这台设备能不能用;「清除这台」只取消这一台的使用权。
完整终端
Agent J 主机和页面都支持完整终端时,会直接打开完整终端。开启、Face ID、Agent J 主机登录密码和 sudo 都和上面一样。没有单独的聊天式输入框:直接在终端光标处输入,程序中途问 y/n 或让你选菜单时,也在原处回答。手机和平板点一下终端区,就能唤起软键盘直接输入。
- 有 Tab 补全、方向键和命令历史,Ctrl+C、Ctrl+D、Ctrl+Z 照常用。手机和平板有 Ctrl、Tab、Esc、方向、粘贴和回车常用键;软键盘展开、旋转屏幕后会重新调整终端大小。
vim、top、claude、codex这类整屏程序能跑,有颜色。- 一次粘贴太多不会发出去。
- Agent 填进终端的命令,你按回车才运行。
- 终端组件没加载出来时,会关闭这次终端并说明原因;重试或升级,不会悄悄改成逐行输入。
只用 Agent J 自己的 shell 设置。 不读你的 ~/.bashrc、~/.bash_profile、~/.zshrc,所以平时的别名、PATH 和提示符这里没有;别的程序改过的启动文件也不会在打开时跟着运行。
不要把输出遮挡当作绝对保密。 完整终端能运行你有权运行的程序;程序可能用特殊格式或编码输出秘密,遮挡不可能全部识别。不要打印或转发密码、密钥和令牌。端到端加密保护传输,但不阻止你运行的程序把内容显示给自己的设备。
终端命令的普通确认。 在 shell 提示符提交一行时,页面可能弹「这一行要你确认」,用普通按钮处理,不按命令形状要求指纹。vim 等程序在前台时,按键直接交给程序。
输出和操作日志。 输出照样先遮挡密码和密钥。操作日志只记遮挡后的输出和终端大小变化,不记按键;确认过的终端命令只留指纹;输入不显示的密码从不记录。整屏程序的画面不进 Agent 能读的终端输出。
闲置:没有输入也没有输出满 5 分钟才算,开着 top 不会被当成闲置关掉。
暂不能打开完整终端的情况:Windows 原生主机;旧主机未提供 PTY;Linux 上 Agent 的隔离环境没有自己的 /dev(页面会写明原因)。请按页面提示升级或处理;完整终端不改用逐行输入框。在 Mac 上,开着隔离的 Agent 仍可能打开终端设备,目前还挡不住。
从聊天填入命令
主 Agent 在回复中写明命令要在 Agent J 主机上运行时,紧跟在这行说明下的单行 shell 命令会显示 ▶。点 ▶ 后按手机提示操作,需要批准时会显示确认卡。需在其他设备上运行的命令、没写明目标的命令,以及好友消息、转发和引用中的命令,都只显示复制。
正在运行 vim、其他交互程序、等待密码,或者输入行已有内容时,不会直接塞入命令;先回到空的 shell 提示符再试。多行命令和带控制字符的内容不直接预填。
旧版行模式与聊天里的 !
以下是旧版行模式的限制,供仍在使用旧页面的人参考;新版完整终端不显示这个输入框。聊天里的 ! 仍使用逐行命令通道,和完整终端中在光标处输入是两种用法。
- 一行最多 4096 字节,不能有 Tab 和换行。没有 Tab 补全。
- 控制键只有两个:Ctrl+C(中断正在运行的程序)和 Ctrl+\(强制退出它)。没有 Ctrl+D、Ctrl+Z。
- 不能用全屏程序,比如
vim、top、less。要看文件用cat、head、tail。 - 有的程序发现输出不是屏幕,会攒够一大块才一起显示,看上去像卡住。可以在命令前加
stdbuf -oL,让它一行一行地输出。 - 错误信息和普通输出按顺序混在一起显示。颜色等控制字符会去掉,主机会尽量遮挡常见的密码和密钥,再把输出发到浏览器。输出太快时,多出来的部分会省略,并写明省略了多少字节。
- 浏览器只把输出放在内存里,关掉就没了,不存到这台设备上。
不要在行模式里输入密码
行模式不是真正的屏幕,程序要密码时(比如 ssh、git 要账号密码,passwd),它读到的就是你发的下一整行明文。所以不要在这里输入任何密码。输入框下面也有这句提示。
sudo 是例外:你在终端里用 sudo,页面上会弹出「用 Face ID 允许 sudo」,写明 sudo 实际要运行的命令和你敲的那一行;两者不一样时会特别提醒。点「用 Face ID 允许」,主机把记住的密码交给这一次 sudo;点「不允许」,sudo 就失败。60 秒内不答也算不允许。密码从来不会出现在你发的命令里。
程序正在运行时你发的行,会交给那个程序。这样的行在操作日志里只留一句占位说明,不记内容,也不进命令历史。
网页终端自己的命令历史只存在主机上(只有你能读)。行首带空格的行、和上一行重复的行,以及看起来在设置密钥或密码的行(比如 TOKEN=…、--password=…、Bearer …、https://用户名:密码@…)都不会留下;你平时用的终端的历史不会被读取,也不会被复制过来。
终端命令的确认
终端需要确认一行命令时,用正在操作的设备点「运行」;这是普通签名按钮,不要求指纹。120 秒内没有确认就取消。删除、脚本、解释器或联网等命令文字本身,不再成为要求指纹的理由。 这一步只防手滑,不防已经拿到会话的人:命令可以分行拼接,终端确认不能代替本人的验证。
打开或授权终端、共享和解锁保存的主机登录密码,以及清单中的其他操作,仍要主人当场验证。sudo 交付保存密码时仍按密码卡验证。用 agentj uv list 查看完整清单;终端里的普通确认不能代替清单命令自己的验证。
什么时候会自动关
出现下面任何一种情况,终端就关掉,并停下它里面还在运行的所有命令:
- 到了时间上限(默认 15 分钟,在主机上开启时用
--minutes改,最多 60)。 - 完整终端 5 分钟没有输入也没有输出;行模式 5 分钟没有发任何一行。
- 浏览器切到别的标签页或最小化超过 60 秒。
- 断线超过 30 秒,或重新验证失败。短断线可在同一设备重新用通行密钥确认,恢复原终端;剩余时间不增加,断线期间不能输入。
- 你点了「全部停下」,或主机上的 Agent J 停了。
- 你在主机上运行了
agentj terminal disable,或用deny把这台设备去掉。 - 你点了「结束」。
打开和关闭时,所有遥控器都会收到一条通知,写明原因和用了几分钟。同一时间只能有一台设备在用网页终端。
在原遥控器点「验证并恢复终端」,用通行密钥接回原进程。页面会显示剩余时限。若旧连接留有未提交的输入,终端会安全结束。仍在授权范围内可点「重新验证并开启」。若临时权限已到期,点「填写临时授权申请」,检查主对话里的草稿后发送,由主人确认。
全屏、收起、复制和截屏
终端打开后是全屏的:深色底、浅色字。从「设置」里打开时,你会离开设置页,在这个窗口里全屏使用它。完整终端支持 vim 等全屏程序;行模式不支持。
- 收起:点右上角的 ✕,按 Esc,或者把顶部的小横条往下拉。双击什么都不会发生,免得打扰正在运行的程序。
- 收起不等于结束。 终端照样运行,时间限制不变,消息框上方会出现「终端 · 剩 N 分钟」,点「打开」就回来。弹出 sudo 或确认卡片时,终端会自己回到全屏。
- 「复制输出」:复制页面上的输出。
- 「截屏发到聊天」:把屏幕上看得到的输出画成一张图,放进附件;你点发送才会发出去。
- 点「结束」才会关掉终端。
在聊天里用!运行命令
在已允许的浏览器消息框里先打 !,再接命令,比如 !df -h,然后发送。它不会当成聊天发给 Agent J,而是作为一行命令在网页终端里运行。
- 这台设备的终端没开时,会先请你用 Face ID 打开它,打开后收在后台。
- 聊天里出现一张结果卡片,显示输出;输出长时点「展开全部」。
- 命令和输出随后交给 Agent J,它会接着处理。
需要确认的终端行使用普通签名按钮;sudo 交付保存密码仍须本人验证,时间限制和操作日志不变。同一时间只运行一条! 命令;120 秒还没运行完,卡片先显示到那时为止的输出。
终端没开启,或这台设备不在名单上时,会弹出一张卡片写明怎么开启。只想发一句以 ! 开头的普通消息,就在! 前面加一个空格。! 只在 Agent J 的 App 和网页里有用,Telegram、邮件里不算。
哪些内容会交给 AI
! 输出中遇到凭据块、对象、数组、表节或续行时,会保守地遮挡本次捕获的后续内容,其中可能包含无害输出;这样的一段计作一处隐藏。
! 命令的输出,以及 Agent 用 agentj terminal output 读到的内容,会进 Agent 的对话,也就会发给你用的 AI 模型服务商。发出之前,Agent J 主机会尽量遮挡常见的密码和密钥:KEY、TOKEN、SECRET、PASS 这类名字后面的值,-p 或 --password 后面的那个词,链接里的密码。卡片上会写遮了几处,比如「已隐藏 3 处像密码或密钥的内容」。
这种遮挡并不完美:它会多遮一些无害的东西(比如 mkdir -p dir 里的 dir),也可能漏掉格式少见的密钥。所以不要在终端里打印密码或密钥(比如别 cat .env)。
操作日志
每次使用都会记一份文字的操作日志:完整终端记录遮挡后的输出和大小变化,不另记按键;行模式还记录你发的每一行(同样先遮挡)。不录屏,不开摄像头,不录声音。日志存在 Agent J 主机上 Agent J 的数据目录里,只有你在 Agent J 主机上的账户能读,超过 30 天的在下次打开网页终端时自动删除。日志不上传到任何地方,也不会进客服报告。操作记录里另外记下哪台设备、什么时候打开和关闭,以及确认过的终端命令和 sudo,这些只记指纹(一串哈希值),不记命令原文。记录什么、为什么记录、谁能看,详见网页终端的操作日志。
在 Agent J 主机上看最近的记录和操作日志文件名:
agentj terminal logs
它不是断线时的备用通道
网页终端走的是遥控器和 Agent J 主机之间同一条加密连接。连接断了,它也用不了。遥控器连不上主机时,用这些办法:
- 遥控器上的「紧急修复」,按 ① ② 的顺序试。
- 在主机上运行
agentj doctor --reconnect。 - 请主机旁边的人运行
curl -fsSL https://agentj.app/rescue | sh。
详见 手机显示灰色或断开怎么办。
「紧急修复」下面「终端指令」里的每条命令,在终端开启且这台设备在名单上时,旁边会多一个「在终端里打开」:它把这条命令填进网页终端,你按回车才运行。
关掉和收回
- 关掉整个功能,同时删掉所有记住的密码:
agentj terminal disable
- 把一台设备从名单上去掉:
agentj terminal deny <设备>
- 只删掉记住的 Agent J 主机登录密码,名单不变:
agentj terminal forget
解除一台遥控器的配对,或删掉它的 Face ID,它也会自动从名单上去掉,记住的密码一起删除。
借朋友电脑救急
Agent J 主机不能随身带,但浏览器到处都有。急着要在主机上敲几条命令时,可以临时借一台电脑的浏览器,用完解绑:
- 扫码配对:在借来的电脑上用浏览器打开遥控器网页,让它亮出配对二维码;拿你已配对的手机扫这个码,核对两边的 6 位对照码一致后确认。详见 被扫码配对。
- 设 Face ID:在这个浏览器里点「设置 Face ID」。朋友的电脑没有指纹时,按浏览器的提示改用你的手机确认。
- 开启并打开:在这个浏览器的「设置」→「安全」→「网页终端」点「开启并打开网页终端」,用 Face ID 确认,再输入一次 Agent J 主机登录密码。见[在浏览器里开启](#enable-browser)。
- 用:敲完命令点「结束」。
- 解绑:在你的手机上打开「遥控器管理」,把这台「解绑」。解绑的那一刻,它正开着的网页终端立刻关掉,里面还在运行的命令一起停下;它从名单上去掉,记住的 Agent J 主机登录密码一起删除;之后这个浏览器再也打不开网页终端,要用只能重新配对。
还电脑之前,顺手清掉这个浏览器里遥控器网页的网站数据;不要让浏览器记住 Agent J 主机的密码。
Agent 能做什么
Agent 永远不能往终端里打字、发送命令,也不能打开网页终端的开关。它只能做两件事:
- 帮你打开终端、填好命令。 需要你亲自运行某条命令时(比如一条 sudo 命令),Agent 可以在你名单上、正在线的设备上打开终端,命令会填在空闲的 shell 提示符处:「Agent J 填好了一条命令,看清楚后按回车运行。」终端没开时,照样要你用 Face ID 打开。正在运行交互程序、等待密码、或者当前行已有内容时,不会直接填入;先回到空的 shell 提示符再试。Agent 填的命令一字没改就发送时,页面会再问一次「这条命令由 Agent 填写」,用普通签名按钮确认。
- 读取输出。 不用你复制粘贴,Agent 可以读当前这次终端的命令和输出,或者上一次的(关闭后 30 分钟内)。这些只放在主机内存里,遮挡方式和[哪些内容会交给 AI](#what-the-ai-sees) 一样。你输给正在运行的程序的内容不在里面,临时允许的设备用的那次终端也不在里面。终端页上写着:「Agent J 能读到这里的输出;会尽量遮挡常见的密码和密钥,请勿打印凭据。」
Agent 在处理不是你发来的消息时(群聊、转发、好友),这两件事都做不了。Agent 用密钥卡向你要 Agent J 主机登录密码或 sudo 密码,会被拒绝。
更多命令和参数见 agentj 命令参考。遥控器上其他设置见 使用手册。
Open it in the Olares app
Agent J installed from Olares Market uses Olares’ interactive web terminal. On the Agent J app’s setup page, choose Open web terminal. An already paired remote also offers Open Olares web terminal under Settings → Safety. The terminal opens in a new tab, where Olares verifies your sign-in. If you are signed out, follow Olares’ sign-in prompt first.
The shell runs in Agent J’s own app container, as the same user with the same home directory and configuration. Run agentj status to check status or agentj tasks list --json to view your background tasks. Other Olares Terminal apps run in separate containers and cannot replace this entrance.
You do not need to enable Agent J’s line-mode terminal or pass an additional Agent J Face ID check to follow this link. Olares’ terminal and sign-in rules apply. This terminal does not provide the output masking, operation log, sudo cards or terminal-command confirmation described for Agent J’s terminal below. Do not print passwords, keys, tokens or complete process command lines, or send output containing them to the chat.
Full terminal on an ordinary Agent J host
The following instructions apply to Agent J’s web terminal on ordinary Linux, macOS and WSL installations. The full terminal needs PTY support on both the host and page. An older host prompts you to upgrade instead of opening a line-input box.
Use the Agent J host’s command line from your phone, tablet or computer browser. Open the terminal card from the avatar menu, or go to Settings → Safety → Web terminal.
Phones, tablets and computers follow the same authorization rules: pair the device, set up its passkey and enable terminal access yourself. A smaller screen does not remove terminal functions.
It is off by default. Switching it on takes you in person: Face ID, Touch ID or a passkey plus the Agent J host login password in a paired browser, or one command run at the Agent J host. The Agent, scheduled tasks and scripts cannot. Every open needs Face ID, lasts at most 15 minutes by default and keeps an operation log of fingerprints only (what is logged and who can read it).
Once it is on, you can also run a command straight from the chat by starting the message with ! ([details](#bang)), let the Agent J host remember its login password so Face ID fills it in, on the Agent's admin-command cards too ([details](#computer-password)), and let the Agent open the terminal with a command filled in or read what it printed ([details](#agent)).
Where to find it
Open Settings → Safety. The Web terminal row is always there and tells you the next step:
- A paired browser, the terminal off or this browser not allowed yet: tap Switch on and open; see [Switch it on in a browser](#enable-browser). Below it, Or run this line on the Agent J host: shows
agentj terminal enablewith a button to copy it ([details](#enable)). - The Agent J host runs Windows (not inside WSL): it says this system is not supported yet and the next version will be. Today it works on Linux, macOS and Windows' WSL.
- This device has no Face ID yet: tap Set up Face ID first.
- Only a command line, no switch-on button: this remote did not record at pairing whether it is a computer or a phone (it was paired long ago, for example). Pair this remote again to switch it on right here, or run the line shown at the Agent J host; see [Who can use it](#who).
- Switched on and this browser may use it: tap Open web terminal.
Switch it on in a browser
In a paired phone, tablet or computer browser, open Settings → Safety → Web terminal → Switch on and open. Confirm Face ID, then type the Agent J host login password (also used for sudo). Enable always requires typing, not a remembered password. The host verifies it with sudo and opens this browser's full-screen terminal; ✕ collapses ([details](#full-screen)).
Every remote receives the enabling device's name. For a web-version remote, the notice also directs you to agentj terminal disable at the host if this was not you. Phones/tablets retain the desktop device list, signatures, passkey, password, audit and expiry checks; resize grants no permission.
Switch it on at the Agent J host
Run this yourself at the host:
agentj terminal enable
The host and every paired remote show a 6-digit match code, allowed devices and session minutes. Compare codes and approve with a remote's Face ID within 5 minutes; otherwise nothing changes. Allowed browsers then show Open web terminal in Settings → Safety.
Requirements: a paired browser with Face ID/passkey (use Set up Face ID first); Linux, macOS and Windows' WSL; an administrator account whose sudo requires a password. NOPASSWD or non-administrator accounts are refused: the login password is the second lock. Native Windows is not supported yet.
Agents, scheduled tasks, scripts and the web terminal cannot run enable. A remote can enable only itself through Switch on and open, with Face ID and the host password.
Select devices with repeatable --device; set the default 15 minutes with --minutes, at most 60:
agentj terminal enable --device <device> --minutes 30
agentj terminal status lists enable state, allowed devices and remembered-password availability.
On a Mac
The same owner enable, Face ID, expiry, masking, logs and ordinary terminal confirmations apply. Additional requirements:
- Administrator account (System Settings → Users & Groups: Admin). Sudo must not use Touch ID/Apple Watch, which would wait at the Mac. Command Line Tools (
xcode-select --install) are needed for safe remembered-password sudo; without them the terminal works but sudo refuses and explains. - Login shell: zsh, or system bash for bash users. No
~/.zshrc/~/.bash_profile, aliases or functions; usual paths including/opt/homebrew/binremain, with UTF-8 text. - History stays in Agent J's folder, never
~/.zsh_history; credential-like and leading-space lines are omitted. - Unlike Linux, macOS has no terminal isolation: it runs as you, outside the Agent's fence. The authorization gates protect it.
Who can use it
Only listed devices can open it. Your enable device, or the browser that enabled itself, is the owner device.
For a friend's help, pair their own browser and passkey instead of handing over yours. At the host, grant temporary access:
agentj terminal allow <device> --hours 2
--hours accepts 1–24, default 2; expiry removes access. Temporary devices never remember the host password and must type it on every open. agentj terminal deny <device> revokes early. Phones/tablets use the same flow.
A web-version remote also requires explicit --allow-web, because a tampered page could misuse your Face ID; the approval card discloses this:
agentj terminal allow <device> --allow-web
Opening it and the password
In Settings → Safety → Web terminal, choose Open web terminal, then Confirm with Face ID. Every open needs Face ID. Unless this device can already unlock a remembered password, Type your Agent J host login password and Send with Face ID. This login/sudo password is encrypted in the browser for only the Agent J host to open, never displayed or saved on the remote. After verification, the terminal shows its folder and Operation log recording with time left (log guide).
Wrong-password lockouts: 3 consecutive failures per device → 15 minutes; 10 per host within an hour → 1 hour. Every failure notifies all remotes and may count toward OS lockout, including Linux pam_faillock and normal host login.
How the Agent J host keeps the password
Settings identifies one of three modes:
| Mode | Storage and requirement |
|---|---|
| Unlocked by your Face ID | Encrypted on the host; unlocked by this device’s passkey, when supported (preferred). |
| Encrypted on the host | Unlocked after Face ID; available only with Isolated sandbox on and Session mode independent. Turning isolation off or sharing the session deletes this copy. |
| This session only | Host memory until close, nothing on disk; type again each open. Used for all other cases, including temporary devices. |
For the two stored modes, they protect against backups, offline copies and the Agent reading the disk directly; they do not protect against a program that can change Agent J's code or your user services. Such a program could intercept the password when used.
Clear on this device under Settings → Safety → Agent J host login password removes this device’s access. agentj terminal forget deletes all remembered copies. Sudo rejecting a changed password deletes the old copy; enter the replacement next open.
The Agent J host login password: type it once, then Face ID
This vault stores only host-encrypted data, never on remotes; each device unlocks it with its own passkey.
- First use: type once in the terminal or admin-command card; subsequent Face ID fills it in.
- New device: Settings → Safety → Agent J host login password → Use it on this device too, confirm Face ID; then, within 2 minutes, Agree with Face ID on an already enabled device. Check the card’s name, ID, passkey, pairing date and type. All remotes are notified. Alternatively type once on the new device.
- Sudo card: Fill in the password with Face ID, or Or type the Agent J host login password and Remember it with Face ID (next time, just scan your face). This also works on phones; only that sudo receives the password, while the Agent receives output.
- Unsupported passkeys and temporary devices type each time. A changed password shows The remembered Agent J host login password no longer works (it may have changed). Type it once., without counting as a wrong password.
Protection: backups, offline copies and the Agent reading the files; not against a program that can change Agent J's code or your user services. The Settings password row reports this device’s availability; Clear on this device revokes only this device.
Full terminal
With PTY support on host and page, the full terminal opens by default under the same authorization rules. Type at its cursor, including y/n answers and menus; no separate chat-style box. Tap it on phones/tablets to open the keyboard.
- Tab completion, arrow keys and history; Ctrl+C, Ctrl+D, Ctrl+Z. Phones and tablets have a row for Ctrl, Tab, Esc, arrows, paste and Enter. The terminal refits when the software keyboard opens or the screen rotates.
- Full-screen programs such as
vim,top,claudeorcodexrun, in colour. - An oversized paste is not sent.
- A command the Agent fills in runs only when you press Enter.
- If the terminal component fails to load, this terminal closes and explains why. Retry or upgrade; it never silently changes to line input.
Agent J's shell setup only. Your ~/.bashrc, ~/.bash_profile and ~/.zshrc are not read, so your aliases, PATH additions and prompt are missing, and a start-up file another program changed cannot run when you open it.
Masking cannot guarantee secrecy. The full terminal can run programs you are allowed to run. A program can print a secret in an unusual format or encoding that masking misses. Do not print or forward passwords, keys or tokens. End-to-end encryption protects transmission; it does not stop a program you run from displaying data to your own device.
Risky lines are checked at the shell prompt only. Before Enter or any key that runs the line, it is checked and may show This line needs your OK. While a program such as vim is in front, keys go straight to it, unchecked.
Output and the operation log. Output is masked as before. The log keeps masked output and size changes, not keystrokes; a confirmed risky line leaves only a fingerprint; echo-off input is never recorded. A full-screen program's screen is not in the output the Agent reads.
Idle means 5 minutes with no input and no output, so a running top is not closed as idle.
The full terminal cannot open on native Windows, on an older host without PTY support, or on Linux when the Agent’s isolation has no /dev of its own (the page says why). Follow the upgrade or repair prompt; the full terminal does not switch to a line-input box. On a Mac an isolated Agent can still open terminal devices; that is not blocked yet.
Fill in a command from the chat
In the main Agent’s reply, a single-line shell command shows ▶ when the line immediately above it says to run it on the Agent J host. Tap ▶ and follow the prompt. Commands that need approval show a confirmation card. Commands for another computer, commands with no stated destination, and commands in friend messages, forwards or quotations offer Copy only.
Nothing is inserted into vim, another interactive program, a password prompt or an edited command line. Return to an empty shell prompt first. Multiline commands and control characters are not filled directly.
Legacy line mode and ! in chat
Old pages used a separate Send box; the current full terminal never opens that box. Chat ! commands retain their line channel.
Legacy limits: 4096 bytes per line, no Tab/newline/completion; Ctrl+C interrupts and Ctrl+\\ force-quits, without Ctrl+D/Z. Full-screen vim, top and less cannot run; use cat, head or tail. Programs may buffer output; stdbuf -oL requests line buffering. Standard/error output stays ordered, loses control codes/colour and is masked. Excess fast output is omitted with a byte count. Browser output lives only in memory until close.
Never type passwords into line mode
A legacy program's password prompt reads the next line as plain text: do not type any password here, including ssh, git or passwd. Runtime input goes to the program, leaves only a log placeholder and no history.
sudo uses Allow sudo with Face ID instead: it shows the actual command and typed line, warning if they differ. Allow with Face ID sends the stored password only to that sudo; Don't allow or no answer within 60 seconds fails it. The password is never a command line.
History stays on the host, readable only by you, separate from your usual terminal. It omits leading-space lines, consecutive duplicates and credential-like assignments/arguments (TOKEN=…, --password=…, Bearer …, credentials in URLs).
Confirming terminal commands
When the terminal asks you to confirm a line, tap Run on the device using the terminal. This is an ordinary signed button, without fingerprint verification; no answer within 120 seconds cancels. Deletion, scripts, interpreters or network access in command text are no longer reasons for a fingerprint check. this step only catches slips; it does not stop someone who already holds the session: commands can be assembled across lines, and terminal confirmation does not replace owner verification.
Enabling, authorizing and opening a terminal, sharing or unlocking its saved host login password, and other listed operations still require in-person owner verification. Supplying a saved password to sudo retains its password-card verification. Run agentj uv list for the complete list. An ordinary terminal confirmation never approves a listed command's own verification.
When it closes by itself
The terminal closes, and stops everything still running in it, when:
- the time limit is reached (15 minutes by default; set with
--minuteswhen you switch it on at the host, at most 60); - the full terminal has no input or output for 5 minutes, or line mode receives no line for 5 minutes;
- the browser has been on another tab or minimised for more than 60 seconds;
- the connection has been down for more than 30 seconds, or re-verification fails. A short interruption can resume the same terminal on the same device after a fresh passkey check. Its original expiry stays unchanged and no input is accepted while disconnected;
- you tap Stop everything, or Agent J on the host stops;
- you run
agentj terminal disableat the host, or take this device off the list withdeny; - you tap End.
Every remote gets a notice when it opens and when it closes, with the reason and the minutes used. Only one device can use the web terminal at a time.
On the original remote, choose Verify and resume terminal and use your passkey to return to the same process. The page shows the remaining time. Unsubmitted input on the old connection can require a new terminal. Choose Verify and open again while you still have access. If temporary access expired, choose Prepare an access request, review the draft in chat and send it for the owner to approve.
Full screen, collapse, copy and screenshot
The terminal opens full screen, replacing Settings, with light text on dark. Full-screen programs such as vim require the full terminal, not line mode.
- Collapse it: click the ✕ at the top right, press Esc, or drag the handle at the top down. Double-clicking does nothing, so it never disturbs a running program.
- Collapsing does not end it. The session keeps running with the same time limits, and a chip above the message box shows Terminal · N min left; tap Open to go back. A sudo or confirmation card brings the terminal back by itself.
- Copy output copies the output on the page.
- Screenshot to chat turns the visible output into a picture and puts it in your attachments. It is sent only when you send the message.
- Tap End to close it.
Run a command from the chat with !
In the message box on an allowed browser, type ! and then the command, for example !df -h, and send. It is not sent to Agent J as chat: it runs as one line in the web terminal.
- If the terminal is not open on this device, you are first asked to open it with Face ID. It then stays collapsed in the background.
- A result card in the chat shows the output; Show all opens long output.
- The command and its output then go to Agent J, which carries on from there.
Ordinary terminal line confirmations use signed buttons; supplying a saved password to sudo still verifies the owner. Time limits and operation logs stay the same. One ! command runs at a time. If the output is not finished after 120 seconds, the card shows the output so far.
If the terminal is off or this device is not on the list, a card explains how to switch it on. To send an ordinary message that starts with !, put a space before it. ! works only in the Agent J app and web page, not in Telegram or e-mail.
What reaches the AI
For ! output, a credential block, object, array, section or continuation causes the remaining capture to be hidden conservatively, even if it includes harmless output. One such region counts as one hidden item.
The output of a ! command, and what the Agent reads with agentj terminal output, go into the Agent's conversation, so they are sent to your AI model provider. Before that, the Agent J host tries to hide common passwords and keys: the value after names such as KEY, TOKEN, SECRET or PASS, the word after -p or --password, and passwords inside links. The card says how many items it hid, for example 3 items that look like passwords or keys are hidden.
The hiding is not perfect. It also hides some harmless things (in mkdir -p dir, dir is hidden), and it can miss a secret in an unusual format. So do not print passwords or keys in the terminal (no cat .env).
The operation log
Each session logs masked output and resize; legacy line mode also logs commands, never separate raw keystrokes. No camera, sound or screen recording. Files stay readable only by your account on the Agent J host; opens delete logs older than 30 days. No automatic upload: the log never goes into a support report. Activity records device/open/close times and confirmed risky/sudo command fingerprints, not command text. Recording and access.
To see the recent activity log and the operation log files at the Agent J host:
agentj terminal logs
It is not a way in when the connection is down
The terminal shares the remote’s encrypted host connection. When it drops, the terminal is down too. To reconnect:
- Use Emergency repair on the remote, ① then ②.
- Run
agentj doctor --reconnectat the host. - Ask someone at the host to run
curl -fsSL https://agentj.app/rescue | sh.
See Phone grey or disconnected?.
With terminal access enabled, Emergency repair → Terminal Commands offers Open in terminal: fill the command, then press Enter yourself.
Switching it off
- Switch the whole feature off and delete every remembered password:
agentj terminal disable
- Take one device off the list:
agentj terminal deny <device>
- Delete only the remembered Agent J host login passwords and keep the list:
agentj terminal forget
Unpairing a remote, or removing its Face ID, also takes it off the list and deletes its remembered password.
Borrowing a friend's computer in an emergency
Use a borrowed browser briefly, then unbind it:
- Pair by scanning: on the borrowed computer, open the remote web page in a browser and let it show its pairing QR code; scan it with your paired phone, check that both 6-digit match codes are the same, and confirm. See Be scanned.
- Set up Face ID: tap Set up Face ID in that browser. If your friend's computer has no fingerprint reader, follow the browser's prompt to confirm with your phone instead.
- Switch on and open: in that browser go to Settings → Safety → Web terminal, tap Switch on and open, confirm with Face ID and type the Agent J host login password once. See [Switch it on in a browser](#enable-browser).
- Use it, and tap End when you are done.
- Unbind: on your phone, open Remotes and Unbind this one. The moment you do, its open web terminal closes and every command still running in it stops; it leaves the list and its remembered Agent J host login password is deleted; from then on that browser cannot open the web terminal at all — it would have to be paired again.
Before you hand the computer back, clear this browser's site data for the remote web page, and do not let the browser save the Agent J host's password.
What the Agent can do
The Agent can never type into the terminal, send a line or switch the terminal on. It can do two things:
- Open it for you with a command filled in. When you need to run something yourself (a sudo command, say), the Agent can bring up the terminal on your allowed devices that are online , with the line at an empty shell prompt: Agent J filled in a command. Check it, then press Enter to run it. A closed terminal still needs your Face ID to open. Nothing is inserted into a running interactive program, password prompt or edited line; return to an empty shell prompt first. When you send the Agent's line without changing it, the page asks again, This command was filled in by the Agent, with an ordinary signed confirmation button.
- Read the output. Instead of asking you to paste it, the Agent can read the lines and output of the current session, or of the last one for up to 30 minutes after it closed. This is kept only in memory on the host, hidden the same way as in [What reaches the AI](#what-the-ai-sees). A line you type into a running program is not included, and nor is the session of a device allowed only for a while. The terminal page says so: Agent J can read this output. We try to hide common passwords and keys; do not print credentials.
Neither works while the Agent is handling a message that did not come from you (a group, a forwarded message, a friend). If the Agent asks you, through a key card, for your Agent J host login password or sudo password, that request is refused.
More commands and options: agentj command reference. Other remote settings: User guide.