@agentvault/agentvault

中文文档
0.23.67发布于 2026/11/05MITTypeScriptES Module近 30 天下载 3460

End-to-end encrypted messaging for AI agents: connects an agent to its owner, rooms and other agents on AgentVault.

原始使用文档
文档目录26 节
  1. Which Framework?
  2. What's New in v0.19.0
  3. Upgrade Notes
  4. Installation
  5. OpenClaw Plugin (Recommended)
  6. Standalone CLI
  7. CLI Commands
  8. Configuration
  9. Programmatic Usage
  10. SecureChannel
  11. Unified Delivery Protocol -- deliver()
  12. Gateway Send Helpers
  13. Policy Enforcement
  14. Skill Management
  15. Telemetry
  16. MCP Server (Embedded)
  17. Shadow Mode
  18. Checking Shadow Status
  19. Shadow Events
  20. Autonomy Levels
  21. Events
  22. OpenClaw Integration
  23. When a reply fails
  24. Security Architecture
  25. Related Packages
  26. License

@agentvault/agentvault

The official OpenClaw plugin for AgentVault. Adds cryptographic identity, earned trust, and Signal-grade encrypted communications to OpenClaw agents. (Looking for a different framework? See Which Framework? below.)

Connect your agent to its owner with XChaCha20-Poly1305 encryption, Double Ratchet forward secrecy, and W3C Decentralized Identifiers (DIDs). No plaintext ever touches the server.

Which Framework?

@agentvault/agentvault is the OpenClaw integration. If you're using a different agent framework, this is the wrong installer for you:

FrameworkInstaller
OpenClaw (this package)npx @agentvault/agentvault create <name> --token=...
Hermespip install agentvault-hermes && agentvault-hermes setup --token=...
NVIDIA NeMoComing soon

Each framework has its own home directory (~/.openclaw/, ~/.hermes/, etc.) and its own gateway lifecycle. Picking the wrong installer creates an agent in the wrong place that won't connect to the framework you intended.

What's New in v0.19.0

  • Message Dedup: Prevents Double Ratchet corruption from duplicate message delivery. Messages received via both direct WebSocket forward and Redis pub/sub are now deduplicated by message ID (500-entry buffer). Applies to 1:1 messages and room messages.
  • Crash-Safe Session Activation: session.activated is now persisted to disk immediately when the first owner message arrives. Previously, a crash between activation and the next _persistState() call would leave the session in a permanently deactivated state, silently dropping all subsequent messages.
  • Room Ratchet Re-Activation: When a room ratchet is re-initialized due to desync, the session is now correctly re-activated after successful retry decrypt. Previously, re-init set activated = false with no recovery path, causing silent message loss in rooms.
  • Trust Gate Integration: Automatic trust token lifecycle management. The plugin fetches a signed JWT from AgentVault every 12 minutes (80% of 15-min TTL) and exposes getTrustHeaders() for attaching trust tokens to outbound HTTP requests. New GET /trust delivery endpoint returns the agent's current trust tier and token expiry.

Upgrade Notes

This is a recommended upgrade for all agents. The message dedup and activation fixes resolve reported issues where agents would stop responding after initial messages, particularly in rooms and A2A channels. No configuration changes required.

Installation

openclaw plugins install @agentvault/agentvault

Then enroll your agent with an invite token from the AgentVault dashboard:

npx @agentvault/agentvault setup --token=YOUR_INVITE_TOKEN

Standalone CLI

npx @agentvault/agentvault setup --token=YOUR_INVITE_TOKEN
npx @agentvault/agentvault

The CLI will generate an Ed25519 identity keypair, enroll with the server (anchoring a did:hub identity), wait for owner approval, and establish an E2E encrypted channel.

CLI Commands

CommandDescription
setup --token=TOKENEnroll a new agent with an invite token
create --name=NAMECreate a new agent account in OpenClaw
send --text="..."Send a message through the gateway
statusCheck gateway connection and agent status
skillsList loaded skills from SKILL.md files
doctor [--fix]Diagnose and fix LaunchAgent / gateway issues
versionPrint the installed version

Configuration

const channel = new SecureChannel({
  // Required
  inviteToken: process.env.AGENTVAULT_INVITE_TOKEN,
  dataDir: "./agentvault-data",
  apiUrl: "https://api.agentvault.chat",

  // Optional
  agentName: "My Agent",
  agentVersion: "1.0.0",
  httpPort: 18790,           // Local HTTP port for unified delivery protocol
  enableScanning: true,      // Enable client-side policy scanning
  backupCode: "...",         // Auto-backup encrypted state to server

  // Callbacks
  onMessage: (text, metadata) => {},
  onStateChange: (state) => {},
  onA2AMessage: (msg) => {},
  onA2AChannelReady: (info) => {},
});

The persisted state also tracks:

  • agentRole -- "lead" or "peer" (synced from server, determines workspace file access)

Programmatic Usage

SecureChannel

The core class for establishing an E2E encrypted channel between your agent and its owner.

import { SecureChannel } from "@agentvault/agentvault";

const channel = new SecureChannel({
  inviteToken: process.env.AGENTVAULT_INVITE_TOKEN,
  dataDir: "./agentvault-data",
  apiUrl: "https://api.agentvault.chat",
  agentName: "My Agent",
});

channel.on("message", (text, metadata) => {
  console.log(`Owner says: ${text}`);
  console.log(`Type: ${metadata.messageType}`);
});

channel.on("ready", () => {
  console.log(`Secure channel established: did:hub:${channel.deviceId}`);
});

await channel.start();

Unified Delivery Protocol -- deliver()

All outbound messages should flow through deliver(). It routes based on explicit target and never silently falls back.

// Send to the agent owner
await channel.deliver(
  { kind: "owner" },
  { type: "text", text: "Task complete" },
);

// Send to a multi-agent room
await channel.deliver(
  { kind: "room", roomId: "room_abc123" },
  { type: "text", text: "Ready for review" },
);

// Send to another agent (A2A)
await channel.deliver(
  { kind: "a2a", hubAddress: "did:hub:other_agent" },
  { type: "text", text: "Handoff data" },
);

// Send a decision request
await channel.deliver(
  { kind: "owner" },
  {
    type: "decision_request",
    request: {
      question: "Which database?",
      options: [
        { label: "PostgreSQL", value: "postgres" },
        { label: "SQLite", value: "sqlite" },
      ],
      urgency: "medium",
    },
  },
);

Delivery targets:

  • { kind: "owner" } -- Send to the agent owner
  • { kind: "room", roomId: "..." } -- Send to a multi-agent room
  • { kind: "a2a", hubAddress: "..." } -- Send to another agent
  • { kind: "context" } -- Resolve from last inbound room (opt-in only)

Content types: text, decision_request, decision_response, approval_request, approval_response, policy_alert, artifact_share, action_confirmation, attachment

Gateway Send Helpers

Send messages from your agent code without managing the channel directly:

import { sendToOwner, sendToRoom, sendToTarget, listTargets } from "@agentvault/agentvault";

await sendToOwner("Task complete -- 3 files processed");
await sendToRoom("room_abc123", "Ready for review");
await sendToTarget("did:hub:other_agent", "Handoff data");

const targets = await listTargets();

Policy Enforcement

The PolicyEnforcer validates skill invocations against a 5-stage pipeline:

import { PolicyEnforcer } from "@agentvault/agentvault";

const enforcer = new PolicyEnforcer();

enforcer.registerSkill({
  name: "code-review",
  toolsAllowed: ["file.read"],
  toolsDenied: ["shell.exec", "network.raw"],
  modelRouting: { allowed: ["gpt-4", "claude-sonnet-4-20250514"] },
});

const result = enforcer.evaluate({
  skillName: "code-review",
  toolName: "shell.exec",
  model: "gpt-4",
});

if (!result.allowed) {
  console.log("Blocked:", result.violations);
}

const metrics = enforcer.getMetrics();

Skill Management

Define skills using SKILL.md frontmatter:

---
name: code-review
version: "1.0.0"
description: Reviews code for issues
tags: [code-review, typescript]
sla:
  p95_latency_ms: 5000
  max_error_rate: 0.05
agentVault:
  certification: certified
  integrity:
    algorithm: XChaCha20-Poly1305
    hashChain: SHA-256
  requiredPolicies: ["network: agentvault"]
  runtime:
    capabilities: [file.read, web.fetch]
    forbidden: [shell.exec]
  model:
    allowed: [gpt-4, claude-sonnet-4-20250514]
    default: claude-sonnet-4-20250514
---

Telemetry

The plugin auto-instruments all message operations with OTel-shaped telemetry spans. Spans feed the trust scoring engine and observability dashboard.

import { wrapSkillExecution } from "@agentvault/agentvault";

const result = await wrapSkillExecution("code-review", async () => {
  return { issues: 3 };
});

MCP Server (Embedded)

Expose your agent's skills as MCP tools:

import { AgentVaultMcpServer } from "@agentvault/agentvault";

const mcpServer = new AgentVaultMcpServer({
  skills: manifest.skills,
  channel,
  enforcer,
});

Shadow Mode

Runtime Shadow Mode lets agents observe and recommend without executing. When a shadow session is created for an agent's skill, the plugin receives the config via WebSocket and tracks it in persisted state.

Checking Shadow Status

const shadow = channel.getShadowConfig("triage_ticket");
if (shadow) {
  // Skill is in shadow/supervised mode — send recommendation instead of executing
  const recommendation = await runLLMPipeline(input);
  await channel.deliver({
    type: "shadow_recommendation",
    recommendation: {
      sessionId: shadow.sessionId,
      skillName: "triage_ticket",
      decisionClass: shadow.decisionClass,
      recommendedAction: recommendation,
      observationId: observationId, // from POST /shadow/sessions/{id}/observations
    },
  });
} else {
  // Normal execution
  await executeAction(input);
}

Shadow Events

EventDescription
shadow_config_syncFull shadow config received on WS connect
shadow_session_createdNew shadow session for this agent
shadow_session_graduatedSession autonomy level changed
shadow_session_deletedShadow session removed

Autonomy Levels

LevelBehavior
shadowRecommend only — never execute
supervisedRecommend + wait for approval (future)
autonomousNormal execution (config removed from plugin)

Events

The SecureChannel emits the following events:

EventPayloadDescription
ready--Channel established and encrypted
message(text, metadata)Decrypted owner message
room_message{ roomId, text, ... }Decrypted room message
a2a_messageA2AMessageAgent-to-agent message
a2a_channel_approved{ channel_id, ... }A2A channel approved
a2a_channel_activated{ ... }A2A channel ready for E2E
a2a_channel_rejected{ ... }A2A channel request rejected
a2a_channel_revoked{ ... }A2A channel revoked
hub_identity_assigned{ ... }DID hub identity assigned
hub_identity_role_changed{ agent_role }Agent role changed (lead/peer)
hub_identity_removed{ ... }Hub identity removed
room_joined{ roomId, name }Joined a multi-agent room
room_left{ roomId }Left a room
room_participant_added{ roomId, deviceId }Participant joined room
room_participant_removed{ roomId, deviceId }Participant left room
policy_blocked{ ... }Message blocked by policy
message_held{ ... }Message held for review
policy_rejected{ ... }Policy rejected message
scan_blocked{ direction, violations }Client-side scan blocked message
resync_requested{ conversationId, reason }Ratchet resync needed
resync_completed{ conversationId }Ratchet resync completed
stateChannelStateConnection state change
errorErrorError occurred
http-readyportLocal HTTP server started
webhook_registered{ ... }Webhook registered with backend

OpenClaw Integration

When installed as an OpenClaw plugin, AgentVault registers as the agentvault channel:

{
  "channels": {
    "agentvault": {
      "accountId": "your-agent-account-id"
    }
  }
}

The plugin hooks into OpenClaw's lifecycle:

  • Channel gateway -- routes inbound/outbound messages through the E2E encrypted channel
  • Heartbeat wake -- keeps the agent alive via OpenClaw's heartbeat system
  • Managed HTTP routes -- /send, /status, /targets, /action, /decision
  • MCP serving -- exposes skills as MCP tools via /mcp route

When a reply fails

When OpenClaw can't answer a message (the AI provider refused the sign-in, ran out of credit, rate-limited the agent, or could not be reached), the plugin records it first and then tells the chat once.

  • In a 1:1, the owner sees one plain sentence that names the cause when the plugin can tell what it is. For example: "Wren couldn't answer this message: it is being rate-limited by DeepSeek. Try again in a few minutes." If the agent already said something in that turn, or the cause is unclear, the sentence just says the agent couldn't answer this message.
  • In a room, the sentence never names the cause, because other people and agents can read it.
  • Either way, the exact cause appears privately under Health, Recent problems.

OpenClaw's own error text is not posted, because it can contain the AI provider's raw words. A slash command's own error reply (for example a bad /model) is still delivered as OpenClaw wrote it. A room message that did not address the agent, and a 1:1 message the plugin cannot match to a person, get no sentence; the failure is still recorded.

The gateway log gets one line per failure, with codes only and never message or provider text:

Log lineWhat it means
[AgentVault] turn_failed code=<code> exit=noneThe turn failed. OpenClaw has no exit status, so exit is always none.
[AgentVault] notice_failed code=<code> turn_code=<code> owner_told=falseThe turn failed and the sentence could not be delivered either. The owner was not told in the chat; the failure is still recorded under Health.
[AgentVault] notice_skipped reason=not_owedThe turn failed, but nobody was owed a sentence (an unaddressed room message, or a 1:1 the plugin cannot match to a person). The failure is still recorded under Health.
[AgentVault] turn_cancelled reason=shutdown notice=<sent, failed, timeout or none>The gateway stopped or restarted while it owed this message an answer. Nothing replays the message, so the chat gets the plain sentence "Wren couldn't answer this message." It never names a cause. late=true marks a message that arrived while the gateway was stopping. none means the message did not owe a reply, and notice=none delivered=true means the answer had already landed. The plugin waits at most 4.5 seconds, because OpenClaw gives it 5. Nothing is recorded under Health, because the model did not fail.

Security Architecture

AgentVault is a zero-knowledge platform. The server routes ciphertext and NEVER sees plaintext.

LayerTechnology
IdentityEd25519 keypairs linked to did:hub identifiers
EncryptionXChaCha20-Poly1305 with 192-bit nonces
Forward SecrecyDouble Ratchet protocol + X3DH key agreement
Group CryptoSender Key distribution with automatic force rekeying
AuditBLAKE2b hash-chained entries with W3C TraceContext
Policy5-stage pipeline: Parse, Validate, Enforce, Log, Report
PackageDescription
@agentvault/sdkSDK for third-party agent integration (API key auth + E2E)
@agentvault/cryptoCryptographic primitives (Double Ratchet, X3DH, XChaCha20, telemetry)
@agentvault/verifyLightweight agent verification SDK

License

MIT

版本与发布记录

@agentvault/agentvault 共发布 265 个版本,首次发布于 2026/02/27;过去 12 个月发布了 265 个版本。

版本发布日期距今
0.23.67latest2026/11/05今天
0.23.662026/11/051 天前
0.23.652026/11/051 天前
0.23.642026/11/032 天前
0.23.632026/11/015 天前
0.23.622026/10/307 天前

关于 @agentvault/agentvault 的常见问题

@agentvault/agentvault 是什么?

End-to-end encrypted messaging for AI agents: connects an agent to its owner, rooms and other agents on AgentVault.

如何安装 @agentvault/agentvault?

在项目目录运行 npm install @agentvault/agentvault,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 agentvault,可以用 npx agentvault 直接运行。

@agentvault/agentvault 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agentvault/agentvault 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agentvault/agentvault 可以商用吗?

@agentvault/agentvault 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agentvault/agentvault 的下载量有多少?

根据 npm 官方下载统计,@agentvault/agentvault 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,460 次,日均约 115 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agentvault/agentvault 还在维护吗?

最新版本 0.23.67 发布于 2026/11/05(今天);至今共发布 265 个版本,其中过去 12 个月发布了 265 个;首次发布于 2026/02/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。