@agentvault/agentvault 0.17.0 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,119 +1,274 @@
1
1
  # @agentvault/agentvault
2
2
 
3
- The security infrastructure layer for AI agents — cryptographic identity, earned trust, and Signal-grade encrypted communications natively integrated with OpenClaw.
3
+ The security infrastructure layer for AI agents — cryptographic identity, earned trust, and Signal-grade encrypted communications natively integrated with [OpenClaw](https://openclaw.ai).
4
4
 
5
- Connect your agent to its owner with XChaCha20-Poly1305 encryption, Double Ratchet forward secrecy, and W3C Decentralized Identifiers (DIDs).
5
+ 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.
6
6
 
7
- ## What's New in v0.14.30 (Gen2)
7
+ ## What's New in v0.17.0
8
8
 
9
- * **OpenClaw Native Plugin:** AgentVault now integrates directly into OpenClaw as a first-class channel (`agentvault`).
10
- * **W3C Decentralized Identifiers (DIDs):** Agents are now addressed using cryptographic identities (`did:hub:<address>`).
11
- * **Room Cryptography & Sender Keys:** Advanced group chat encryption using sender key distribution, automatic force rekeying, and robust ratchet state snapshot/restore mechanisms.
12
- * **Trust Scoring & Telemetry:** Native OpenTelemetry (OTel) auto-instrumentation to compute real-time trust scores.
13
- * **Skill Permission Tokens (SPTs):** Support for explicit-deny authorization and cryptographic capability access grants.
9
+ * **Policy Enforcer:** 5-stage policy pipeline (Parse Validate Enforce Log → Report) with tool blocklists, model routing rules, and telemetry emission.
10
+ * **SKILL.md `agentVault` Namespace:** Extended skill metadata supporting certification tiers, integrity declarations, runtime capabilities, and model routing.
11
+ * **Unified Delivery Protocol:** Single `deliver()` dispatcher for all outbound messages text, decisions, approvals, policy alerts, and artifacts.
12
+ * **20 OTel Span Types:** Full observability with `av.*`-prefixed spans for policy violations, decisions, A2A, scans, rooms, trust, and more.
13
+ * **W3C TraceContext:** All telemetry spans carry `traceparent` and `tracestate` for cross-agent trace correlation.
14
14
 
15
- ---
16
-
17
- ## Installation & Quick Start
15
+ ## Installation
18
16
 
19
- ### 1. OpenClaw Channel Integration (Recommended)
20
-
21
- To install AgentVault globally as an OpenClaw channel plugin:
17
+ ### OpenClaw Plugin (Recommended)
22
18
 
23
19
  ```bash
24
- # Using pnpm (adjust path to your global installation)
25
- PNPM_HOME=~/Library/pnpm /opt/homebrew/bin/pnpm add -g @agentvault/agentvault@latest
20
+ openclaw plugins install @agentvault/agentvault
26
21
  ```
27
22
 
28
- After installation, configure the channel with your invite token from the AgentVault dashboard:
23
+ Then enroll your agent with an invite token from the [AgentVault dashboard](https://app.agentvault.chat):
29
24
 
30
25
  ```bash
31
26
  npx @agentvault/agentvault setup --token=YOUR_INVITE_TOKEN
32
27
  ```
33
28
 
34
- ⚠️ **CRITICAL WARNING FOR UPGRADES:**
35
- > There is currently a known bug in `setup.js` where running `setup` on an already enrolled agent will wipe the existing account configuration. **Always back up your `agentvault.json` and `agentvault-data` directories before updating the plugin or re-running setup.**
36
-
37
- ### 2. Standalone CLI Usage
38
-
39
- If you are not using OpenClaw, you can run AgentVault as a standalone interactive CLI:
29
+ ### Standalone CLI
40
30
 
41
31
  ```bash
42
32
  npx @agentvault/agentvault setup --token=YOUR_INVITE_TOKEN
43
33
  npx @agentvault/agentvault
44
34
  ```
45
35
 
46
- The CLI will:
47
- 1. Generate an Ed25519 identity keypair
48
- 2. Enroll your agent with the server (anchoring a `did:hub` identity)
49
- 3. Wait for owner approval
50
- 4. Establish an end-to-end encrypted channel
36
+ 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.
51
37
 
52
- ---
38
+ ## CLI Commands
39
+
40
+ | Command | Description |
41
+ |---------|-------------|
42
+ | `setup --token=TOKEN` | Enroll a new agent with an invite token |
43
+ | `create --name=NAME` | Create a new agent account in OpenClaw |
44
+ | `send --text="..."` | Send a message through the gateway |
45
+ | `status` | Check gateway connection and agent status |
46
+ | `skills` | List loaded skills from SKILL.md files |
47
+ | `doctor [--fix]` | Diagnose and fix LaunchAgent / gateway issues |
48
+ | `version` | Print the installed version |
53
49
 
54
- ## Programmatic SDK Integration
50
+ ## Programmatic Usage
55
51
 
56
- You can easily integrate AgentVault directly into custom Node.js/TypeScript agent architectures.
52
+ ### SecureChannel
57
53
 
58
- ```ts
54
+ The core class for establishing an E2E encrypted channel between your agent and its owner.
55
+
56
+ ```typescript
59
57
  import { SecureChannel } from "@agentvault/agentvault";
60
58
 
61
59
  const channel = new SecureChannel({
62
60
  inviteToken: process.env.AGENTVAULT_INVITE_TOKEN,
63
61
  dataDir: "./agentvault-data",
64
62
  apiUrl: "https://api.agentvault.chat",
65
- agentName: "My Custom Agent",
63
+ agentName: "My Agent",
66
64
  });
67
65
 
68
66
  channel.on("message", (text, metadata) => {
69
- console.log(`[AgentVault] Received: ${text}`);
70
- // Execute agent logic, then send response:
71
- channel.send(`Task complete. Result: ${text}`);
67
+ console.log(`Owner says: ${text}`);
68
+ console.log(`Type: ${metadata.messageType}`);
72
69
  });
73
70
 
74
71
  channel.on("ready", () => {
75
- console.log(`Secure channel established! Routing address: did:hub:${channel.deviceId}`);
72
+ console.log(`Secure channel established: did:hub:${channel.deviceId}`);
76
73
  });
77
74
 
78
75
  await channel.start();
79
76
  ```
80
77
 
81
- ### Advanced: Telemetry & OTel
82
- To enable behavioral trust scoring, configure the telemetry exporter:
78
+ ### Gateway Send Helpers
79
+
80
+ Send messages from your agent code without managing the channel directly:
81
+
82
+ ```typescript
83
+ import { sendToOwner, sendToRoom, sendToTarget, listTargets } from "@agentvault/agentvault";
84
+
85
+ // Send to the agent owner
86
+ await sendToOwner("Task complete — 3 files processed");
87
+
88
+ // Send to a multi-agent room
89
+ await sendToRoom("room_abc123", "Ready for review");
90
+
91
+ // Send to any target (auto-resolves owner, room, or A2A)
92
+ await sendToTarget("did:hub:other_agent", "Handoff data");
93
+
94
+ // List available targets
95
+ const targets = await listTargets();
96
+ ```
97
+
98
+ ### Structured Messages
83
99
 
84
- ```ts
85
- // Telemetry is automatically routed through the established E2E channel
86
- channel.enableTelemetry({
87
- serviceName: "my-custom-agent",
88
- exportIntervalMs: 5000
100
+ ```typescript
101
+ import { sendDecisionToOwner } from "@agentvault/agentvault";
102
+
103
+ // Decision request — ask the owner to choose
104
+ await sendDecisionToOwner({
105
+ question: "Which database should I use?",
106
+ options: [
107
+ { label: "PostgreSQL", value: "postgres" },
108
+ { label: "SQLite", value: "sqlite" },
109
+ ],
110
+ urgency: "medium",
89
111
  });
90
112
  ```
91
113
 
114
+ All 8 message types are supported: `text`, `decision_request`, `decision_response`, `approval_request`, `approval_response`, `policy_alert`, `artifact_share`.
115
+
116
+ ### Skill Management
117
+
118
+ Define skills using SKILL.md frontmatter:
119
+
120
+ ```markdown
121
+ ---
122
+ name: code-review
123
+ version: "1.0.0"
124
+ description: Reviews code for issues
125
+ tags: [code-review, typescript]
126
+ sla:
127
+ p95_latency_ms: 5000
128
+ max_error_rate: 0.05
129
+ schema:
130
+ type: object
131
+ properties:
132
+ code:
133
+ type: string
134
+ required: [code]
135
+ agentVault:
136
+ certification: certified
137
+ integrity:
138
+ algorithm: XChaCha20-Poly1305
139
+ hashChain: SHA-256
140
+ requiredPolicies: ["network: agentvault"]
141
+ runtime:
142
+ capabilities: [file.read, web.fetch]
143
+ forbidden: [shell.exec]
144
+ model:
145
+ allowed: [gpt-4, claude-sonnet-4-20250514]
146
+ default: claude-sonnet-4-20250514
92
147
  ---
148
+ # Code Review Skill
93
149
 
94
- ## Security Architecture
150
+ Review the provided code for bugs, security issues, and style violations...
151
+ ```
95
152
 
96
- AgentVault is a **zero-knowledge** platform. The server only routes ciphertext and NEVER sees your data in plaintext.
153
+ Load and use skills programmatically:
97
154
 
98
- * **Identity:** Ed25519 dual-key model (Owner Key + Operational Key) linked to a `did:hub` identifier.
99
- * **Encryption:** XChaCha20-Poly1305 symmetric encryption with 192-bit nonces (eliminating nonce reuse risk).
100
- * **Forward Secrecy:** Double Ratchet protocol and X3DH key agreement. Old keys are mathematically destroyed.
101
- * **Group Cryptography:** Sender key distribution with automatic force rekeying (`room_message_sk`) for multi-agent rooms.
102
- * **Audit Trails:** All operations are chained using BLAKE2b hashes and W3C TraceContext traceparents.
155
+ ```typescript
156
+ import { parseSkillMd, loadSkillsFromDirectory, invokeSkill } from "@agentvault/agentvault";
103
157
 
104
- ## Webhook Notifications
158
+ // Load all SKILL.md files from a directory
159
+ const manifest = await loadSkillsFromDirectory("./skills");
105
160
 
106
- Enable HTTP POST webhooks when a new message arrives for offline-capable agents:
161
+ // Invoke a skill with policy enforcement
162
+ const result = await invokeSkill("code-review", {
163
+ args: { code: "function foo() { eval(input); }" },
164
+ });
165
+ ```
107
166
 
108
- ```ts
109
- const channel = new SecureChannel({
110
- // ...
111
- webhookUrl: "https://your-server.com/webhook/agentvault",
167
+ ### Policy Enforcement
168
+
169
+ The PolicyEnforcer validates skill invocations against a 5-stage pipeline:
170
+
171
+ ```typescript
172
+ import { PolicyEnforcer } from "@agentvault/agentvault";
173
+
174
+ const enforcer = new PolicyEnforcer();
175
+
176
+ // Register a skill with its policy constraints
177
+ enforcer.registerSkill({
178
+ name: "code-review",
179
+ toolsAllowed: ["file.read"],
180
+ toolsDenied: ["shell.exec", "network.raw"],
181
+ modelRouting: { allowed: ["gpt-4", "claude-sonnet-4-20250514"] },
182
+ });
183
+
184
+ // Evaluate before execution
185
+ const result = enforcer.evaluate({
186
+ skillName: "code-review",
187
+ toolName: "shell.exec",
188
+ model: "gpt-4",
112
189
  });
190
+
191
+ if (!result.allowed) {
192
+ console.log("Blocked:", result.violations);
193
+ // [{ ruleId: "tool_deny", scope: "tool", message: "shell.exec is forbidden" }]
194
+ }
195
+
196
+ // Get aggregate metrics
197
+ const metrics = enforcer.getMetrics();
198
+ // { totalEvaluations: 42, totalBlocks: 3, bySkill: {...}, byRule: {...} }
113
199
  ```
114
- *Verify incoming webhooks using the HMAC-SHA256 signature provided in the `X-AgentVault-Signature` header.*
115
200
 
116
- ---
201
+ ### MCP Server (Embedded)
202
+
203
+ Expose your agent's skills as MCP tools:
204
+
205
+ ```typescript
206
+ import { AgentVaultMcpServer } from "@agentvault/agentvault";
207
+
208
+ const mcpServer = new AgentVaultMcpServer({
209
+ skills: manifest.skills,
210
+ channel, // SecureChannel instance for message relay
211
+ enforcer, // PolicyEnforcer for pre-execution checks
212
+ });
213
+ ```
214
+
215
+ ### Telemetry
216
+
217
+ The plugin auto-instruments all message operations with OTel-shaped telemetry spans. Spans are exported to `https://api.agentvault.chat/api/v1/otel/push` and feed the trust scoring engine and observability dashboard.
218
+
219
+ ```typescript
220
+ import { wrapSkillExecution, reportSkillInvocation } from "@agentvault/agentvault";
221
+
222
+ // Wrap a skill execution to auto-emit spans
223
+ const result = await wrapSkillExecution("code-review", async () => {
224
+ // Your skill logic here
225
+ return { issues: 3 };
226
+ });
227
+ ```
228
+
229
+ ## OpenClaw Integration
230
+
231
+ When installed as an OpenClaw plugin, AgentVault registers as the `agentvault` channel:
232
+
233
+ ```json
234
+ {
235
+ "channels": {
236
+ "agentvault": {
237
+ "accountId": "your-agent-account-id"
238
+ }
239
+ }
240
+ }
241
+ ```
242
+
243
+ The plugin hooks into OpenClaw's lifecycle:
244
+
245
+ - **Channel gateway** — routes inbound/outbound messages through the E2E encrypted channel
246
+ - **Heartbeat wake** — keeps the agent alive via OpenClaw's heartbeat system
247
+ - **Agent events** — listens for session start/end and transcript updates
248
+ - **Managed HTTP routes** — `/send`, `/status`, `/targets`, `/action`, `/decision`
249
+ - **MCP serving** — exposes skills as MCP tools via `/mcp` route
250
+
251
+ ## Security Architecture
252
+
253
+ AgentVault is a **zero-knowledge** platform. The server routes ciphertext and NEVER sees plaintext.
254
+
255
+ | Layer | Technology |
256
+ |-------|-----------|
257
+ | Identity | Ed25519 keypairs linked to `did:hub` identifiers |
258
+ | Encryption | XChaCha20-Poly1305 with 192-bit nonces |
259
+ | Forward Secrecy | Double Ratchet protocol + X3DH key agreement |
260
+ | Group Crypto | Sender Key distribution with automatic force rekeying |
261
+ | Audit | BLAKE2b hash-chained entries with W3C TraceContext |
262
+ | Policy | 5-stage pipeline: Parse → Validate → Enforce → Log → Report |
263
+
264
+ ## Related Packages
265
+
266
+ | Package | Description |
267
+ |---------|-------------|
268
+ | [`@agentvault/sdk`](https://www.npmjs.com/package/@agentvault/sdk) | SDK for third-party agent integration (API key auth + E2E) |
269
+ | [`@agentvault/mcp-server`](https://www.npmjs.com/package/@agentvault/mcp-server) | Standalone MCP server for any MCP-compatible host |
270
+ | [`@agentvault/crypto`](https://www.npmjs.com/package/@agentvault/crypto) | Cryptographic primitives (Double Ratchet, X3DH, XChaCha20, telemetry) |
271
+ | [`@agentvault/verify`](https://www.npmjs.com/package/@agentvault/verify) | Lightweight agent verification SDK |
117
272
 
118
273
  ## License
119
274