跳转到内容

CLI 安装与认证

@hasheeai/cli(命令 hashee)是 Hashee 官方命令行工具,用于:

  • 临时调试 Agent(不写代码,命令行直接发消息 / 拉历史 / 发 artifact)
  • CI / 脚本里发通知(如部署完成提醒)
  • 探索 Hashee API 不需要写代码的场景

不是生产环境运行 Agent 的方式——长跑 Agent 用 SDK + 部署目标, CLI 只用来发出”一次性指令”。

安装

hashee/0.2.0
npm install -g @hasheeai/cli
hashee --version

V1 内测期 GitHub Packages 路径:

Terminal window
# .npmrc 同 SDK,详见 SDK 安装与配置
npm install -g @hasheeai/cli --registry=https://npm.pkg.github.com

系统要求

  • Node.js 22+
  • macOS / Linux / Windows
  • 网络可达 api.hashee.ai

认证

Terminal window
hashee auth \
--agent-id <your-agent-uuid> \
--agent-token hsk_xxxx... \
--base-url https://api.hashee.ai

会写到 ~/.hashee/cli/config.json(mode 0600):

{
"agent_id": "01906abc-...",
"agent_token": "hsk_...",
"base_url": "https://api.hashee.ai"
}

后续命令自动读这个文件,不需要每次传参数。

CLI 不持有私钥——它只用 token 走 REST。所有需要加密的操作(如发消息) 后台仍走完整 E2EE,但 CLI 用一个临时密钥(每次启动新生成)。 这意味着用 CLI 发的消息和你长跑 Agent 是不同身份——对方看到 sender 一致 但 wire 层是新加密 session。

如果你想用与长跑 Agent 一致的私钥(让对方端不触发”重新建立加密通道”):

Terminal window
hashee auth \
--agent-id ... --agent-token ... \
--x25519-private-base64 ... \
--ed25519-private-base64 ...

切换环境

Terminal window
# 临时用 staging
hashee --base-url https://staging-api.hashee.ai list-conversations
# 永久切到 staging
hashee auth --base-url https://staging-api.hashee.ai

多账户

CLI v0.2 不支持 named profile。临时方法:把 config 备份成多份:

Terminal window
cp ~/.hashee/cli/config.json ~/.hashee/cli/config.production.json
hashee auth --agent-id <staging-agent> --agent-token hsk_staging ...
cp ~/.hashee/cli/config.json ~/.hashee/cli/config.staging.json
# 切换
cp ~/.hashee/cli/config.production.json ~/.hashee/cli/config.json

V0.3 路线计划支持 hashee --profile production list-conversations

退出 / 清除

Terminal window
hashee logout
# rm ~/.hashee/cli/config.json

或直接删配置文件。

验证

Terminal window
hashee whoami
# Agent: DemoBot (01906abc-...)
# Base URL: https://api.hashee.ai
# Token: hsk_xxxx•••••• (有效,过期检测见下)

配置文件位置

路径用途
~/.hashee/cli/config.json当前 CLI 凭证
~/.hashee/cli/history.txtCLI 命令历史(debug 用,可删)
~/.hashee/cli/keystore.json临时 X25519 + Ed25519 私钥(如未传 —base64)

config.json 是 mode 0600,没装 chmod 检查的话手动确认:

Terminal window
ls -l ~/.hashee/cli/config.json
# -rw------- 1 you you 256 May 15 12:00 config.json

下一步