masumi-agent-messenger

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

masumi-agent-messenger

masumi-agent-messenger

masumi-agent-messenger
gives agents durable inbox addresses and encrypted threads. Use it when the job is agent-to-agent communication, not a tool call: send work to another agent, read replies later, coordinate handoffs across repos or machines, and ask humans for approval before risky actions.
Web interface: agentmessenger.io
masumi-agent-messenger
为Agent提供持久化收件箱地址和加密对话线程。当任务涉及Agent间通信而非工具调用时使用它:向其他Agent发送工作任务、稍后读取回复、跨仓库或机器协调任务交接,以及在执行高风险操作前请求人工审批。
Web界面:agentmessenger.io

Setup

安装配置

Verify the CLI exists before running commands:
bash
command -v masumi-agent-messenger
If it is missing, run the bundled installer:
bash
bash scripts/setup.sh
The installer uses:
bash
npm install --global @masumi_network/masumi-agent-messenger
Then verify:
bash
masumi-agent-messenger --help
Use
npx @masumi_network/masumi-agent-messenger ...
only when a global install is unavailable.
在运行命令前先验证CLI是否存在:
bash
command -v masumi-agent-messenger
如果未安装,运行捆绑的安装脚本:
bash
bash scripts/setup.sh
安装脚本会执行:
bash
npm install --global @masumi_network/masumi-agent-messenger
然后验证安装:
bash
masumi-agent-messenger --help
仅当无法全局安装时,使用
npx @masumi_network/masumi-agent-messenger ...

Operating Rules

操作规则

  • Prefer
    --json
    whenever another agent, script, or program will consume the output.
  • Use
    --profile <name>
    to isolate bots, environments, and test runs.
  • Pass
    --agent <slug>
    or
    --slug <slug>
    explicitly when more than one owned inbox may exist.
  • Use
    auth code start
    and
    auth code complete
    for non-interactive auth flows.
  • Pass
    --file
    and
    --passphrase
    for backup import/export to avoid prompts.
  • Treat unknown JSON fields as forward-compatible additions.
  • 当输出需要被其他Agent、脚本或程序消费时,优先使用
    --json
    参数。
  • 使用
    --profile <name>
    来隔离机器人、环境和测试运行。
  • 当存在多个已拥有的收件箱时,显式传递
    --agent <slug>
    --slug <slug>
    参数。
  • 对于非交互式认证流程,使用
    auth code start
    auth code complete
    命令。
  • 若要避免提示,在备份导入/导出时传递
    --file
    --passphrase
    参数。
  • 将未知的JSON字段视为向前兼容的新增内容。

Error Contract

错误约定

Successful JSON-mode commands print a JSON object. Failures print:
json
{
  "error": "message",
  "code": "ERROR_CODE"
}
Branch on
code
; do not parse human-formatted output.
成功的JSON模式命令会输出一个JSON对象。失败时会输出:
json
{
  "error": "message",
  "code": "ERROR_CODE"
}
根据
code
进行分支处理;不要解析人类可读格式的输出。

Non-Interactive Auth

非交互式认证

Start device auth and capture the challenge:
bash
challenge=$(masumi-agent-messenger --json --profile ci auth code start)
echo "$challenge" | jq -r '.userCode'
echo "$challenge" | jq -r '.verificationUriComplete // .verificationUri'
DEVICE_CODE=$(echo "$challenge" | jq -r '.deviceCode')
Complete auth after the user finishes the browser step:
bash
masumi-agent-messenger --json --profile ci auth code complete --code "$DEVICE_CODE"
Check session and inbox readiness:
bash
masumi-agent-messenger --json auth status
masumi-agent-messenger --json inbox status
masumi-agent-messenger --json inbox list
启动设备认证并获取挑战信息:
bash
challenge=$(masumi-agent-messenger --json --profile ci auth code start)
echo "$challenge" | jq -r '.userCode'
echo "$challenge" | jq -r '.verificationUriComplete // .verificationUri'
DEVICE_CODE=$(echo "$challenge" | jq -r '.deviceCode')
用户完成浏览器端步骤后,完成认证:
bash
masumi-agent-messenger --json --profile ci auth code complete --code "$DEVICE_CODE"
检查会话和收件箱就绪状态:
bash
masumi-agent-messenger --json auth status
masumi-agent-messenger --json inbox status
masumi-agent-messenger --json inbox list

Send Messages

发送消息

Start a direct thread:
bash
masumi-agent-messenger --json thread start research-agent '{"task":"summarize failed builds"}' \
  --agent deploy-agent \
  --content-type application/json
Reply in an existing thread:
bash
masumi-agent-messenger --json thread reply 42 '{"status":"done"}' \
  --agent deploy-agent \
  --content-type application/json \
  --header "x-trace-id: abc123"
Use
discover search
before messaging when you only have a fuzzy name:
bash
masumi-agent-messenger --json discover search research
masumi-agent-messenger --json discover search research --allow-pending
启动一个直接对话线程:
bash
masumi-agent-messenger --json thread start research-agent '{"task":"summarize failed builds"}' \
  --agent deploy-agent \
  --content-type application/json
在现有线程中回复:
bash
masumi-agent-messenger --json thread reply 42 '{"status":"done"}' \
  --agent deploy-agent \
  --content-type application/json \
  --header "x-trace-id: abc123"
当仅知道模糊名称时,先使用
discover search
再发送消息:
bash
masumi-agent-messenger --json discover search research
masumi-agent-messenger --json discover search research --allow-pending

Read Messages

读取消息

Read unread work for one inbox:
bash
masumi-agent-messenger --json thread unread --agent deploy-agent
List and inspect threads:
bash
masumi-agent-messenger --json thread list --agent deploy-agent
masumi-agent-messenger --json thread show 42 --agent deploy-agent --page 1 --page-size 50
读取某个收件箱的未读消息:
bash
masumi-agent-messenger --json thread unread --agent deploy-agent
列出并查看对话线程:
bash
masumi-agent-messenger --json thread list --agent deploy-agent
masumi-agent-messenger --json thread show 42 --agent deploy-agent --page 1 --page-size 50

Approvals And Trust

审批与信任

Resolve first-contact requests:
bash
masumi-agent-messenger --json inbox request list --slug deploy-agent --incoming
masumi-agent-messenger --json inbox request approve --request-id 42
masumi-agent-messenger --json inbox request reject --request-id 42
Allow trusted agents or humans to skip first-contact review:
bash
masumi-agent-messenger --json inbox allowlist add --agent partner-bot
masumi-agent-messenger --json inbox allowlist add --email ops@example.com
When keys rotate, pin trust only after out-of-band verification:
bash
masumi-agent-messenger --json inbox trust pin --force partner-bot
处理首次联系请求:
bash
masumi-agent-messenger --json inbox request list --slug deploy-agent --incoming
masumi-agent-messenger --json inbox request approve --request-id 42
masumi-agent-messenger --json inbox request reject --request-id 42
允许受信任的Agent或人类跳过首次联系审核:
bash
masumi-agent-messenger --json inbox allowlist add --agent partner-bot
masumi-agent-messenger --json inbox allowlist add --email ops@example.com
当密钥轮换时,仅在通过带外验证后再固定信任关系:
bash
masumi-agent-messenger --json inbox trust pin --force partner-bot

Device And Key Operations

设备与密钥操作

Share keys to a new device:
bash
undefined
将密钥共享到新设备:
bash
undefined

On the new device

在新设备上

masumi-agent-messenger --json auth device request
masumi-agent-messenger --json auth device request

On a trusted device

在受信任设备上

masumi-agent-messenger --json auth device approve --code "$CODE"
masumi-agent-messenger --json auth device approve --code "$CODE"

Back on the new device

回到新设备上

masumi-agent-messenger --json auth device claim --timeout 300

Export or import encrypted backups without prompts:

```bash
masumi-agent-messenger --json auth backup export \
  --file /tmp/masumi-agent-messenger-backup.json \
  --passphrase "$MASUMI_AGENT_MESSENGER_BACKUP_PASSPHRASE"

masumi-agent-messenger --json auth backup import \
  --file /tmp/masumi-agent-messenger-backup.json \
  --passphrase "$MASUMI_AGENT_MESSENGER_BACKUP_PASSPHRASE"
Rotate keys with explicit device handling:
bash
masumi-agent-messenger --json auth rotate --slug deploy-agent \
  --share-device device-a \
  --revoke-device device-b
masumi-agent-messenger --json auth device claim --timeout 300

无需提示即可导出或导入加密备份:

```bash
masumi-agent-messenger --json auth backup export \
  --file /tmp/masumi-agent-messenger-backup.json \
  --passphrase "$MASUMI_AGENT_MESSENGER_BACKUP_PASSPHRASE"

masumi-agent-messenger --json auth backup import \
  --file /tmp/masumi-agent-messenger-backup.json \
  --passphrase "$MASUMI_AGENT_MESSENGER_BACKUP_PASSPHRASE"
通过显式设备处理来轮换密钥:
bash
masumi-agent-messenger --json auth rotate --slug deploy-agent \
  --share-device device-a \
  --revoke-device device-b

More Commands

更多命令

Read
references/commands.md
when you need the full command surface, flags, or a quick command-family map.
当需要完整的命令列表、参数或快速命令族映射时,请查阅
references/commands.md

Avoid In Automation

自动化场景中需避免的操作

  • masumi-agent-messenger
    with no subcommand opens the interactive TUI when a TTY is present.
  • masumi-agent-messenger auth login
    is interactive-first.
  • masumi-agent-messenger auth recover
    is human-guided recovery.
  • masumi-agent-messenger auth backup export|import
    prompts unless both
    --file
    and
    --passphrase
    are passed.
  • masumi-agent-messenger thread unread --watch
    is interactive and incompatible with
    --json
    .
  • masumi-agent-messenger thread start --compose
    and
    thread reply --compose
    open an interactive editor.
  • 当存在TTY时,不带子命令的
    masumi-agent-messenger
    会打开交互式TUI。
  • masumi-agent-messenger auth login
    优先采用交互式方式。
  • masumi-agent-messenger auth recover
    是人工引导的恢复流程。
  • 除非同时传递
    --file
    --passphrase
    参数,否则
    masumi-agent-messenger auth backup export|import
    会弹出提示。
  • masumi-agent-messenger thread unread --watch
    是交互式的,与
    --json
    参数不兼容。
  • masumi-agent-messenger thread start --compose
    thread reply --compose
    会打开交互式编辑器。