@agentvault/secure-channel 0.4.4 → 0.5.1

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
@@ -2,28 +2,21 @@
2
2
 
3
3
  End-to-end encrypted communication channel for AI agents on the [AgentVault](https://agentvault.chat) platform. Connect your agent to its owner with XChaCha20-Poly1305 encryption and Double Ratchet forward secrecy.
4
4
 
5
- ## What's New in v0.4.0
5
+ ## What's New in v0.5.0
6
6
 
7
- **Webhook Notifications** — Your agent can now receive HTTP webhook callbacks when a new message arrives, even when it's not connected via WebSocket. This is ideal for serverless agents, agents that poll on a schedule, or any agent that isn't always online.
7
+ **Desktop Notifications** — Incoming messages now trigger native OS notifications (macOS Notification Center, Windows Toast, Linux notify-send) when using the CLI. Enabled by default disable with `--no-notifications`.
8
8
 
9
- ### Upgrading from v0.3.x
9
+ **Webhook URL CLI Flag** (v0.4.4) — `--webhook-url` flag and `AGENTVAULT_WEBHOOK_URL` env var for programmatic webhook registration.
10
10
 
11
- ```bash
12
- npm install @agentvault/secure-channel@latest
13
- ```
11
+ **Webhook Notifications** (v0.4.0) — HTTP webhook callbacks when a new message arrives, even when not connected via WebSocket.
14
12
 
15
- Add `webhookUrl` to your config to enable:
13
+ ### Upgrading
16
14
 
17
- ```js
18
- const channel = new SecureChannel({
19
- inviteToken: "your-token",
20
- dataDir: "./agentvault-data",
21
- apiUrl: "https://api.agentvault.chat",
22
- webhookUrl: "https://your-server.com/webhook/agentvault", // NEW in 0.4.0
23
- });
15
+ ```bash
16
+ npm install @agentvault/secure-channel@latest
24
17
  ```
25
18
 
26
- No other code changes required — fully backward-compatible.
19
+ No code changes required — fully backward-compatible.
27
20
 
28
21
  ---
29
22
 
@@ -58,8 +51,10 @@ The CLI will:
58
51
  | `--name` | `"CLI Agent"` | Agent display name |
59
52
  | `--data-dir` | `./agentvault-data` | Directory for persistent state |
60
53
  | `--api-url` | `https://api.agentvault.chat` | API endpoint |
54
+ | `--webhook-url` | (none) | URL for HTTP webhook notifications |
55
+ | `--no-notifications` | (notifications on) | Disable OS desktop notifications |
61
56
 
62
- Environment variables (`AGENTVAULT_INVITE_TOKEN`, `AGENTVAULT_AGENT_NAME`, `AGENTVAULT_DATA_DIR`, `AGENTVAULT_API_URL`) work as alternatives to flags.
57
+ Environment variables (`AGENTVAULT_INVITE_TOKEN`, `AGENTVAULT_AGENT_NAME`, `AGENTVAULT_DATA_DIR`, `AGENTVAULT_API_URL`, `AGENTVAULT_WEBHOOK_URL`, `AGENTVAULT_NO_NOTIFICATIONS`) work as alternatives to flags.
63
58
 
64
59
  ### Option 2: SDK (Programmatic)
65
60
 
@@ -216,6 +211,32 @@ AgentVault supports multiple owner devices (e.g., desktop + mobile). The channel
216
211
 
217
212
  No additional configuration needed — multi-device is handled transparently.
218
213
 
214
+ ## Running as a Service
215
+
216
+ The agent process must stay running to receive messages and desktop notifications. Use [pm2](https://pm2.keymetrics.io/) to keep it alive:
217
+
218
+ ```bash
219
+ # Install pm2 globally
220
+ npm install -g pm2
221
+
222
+ # Start your agent as a background service
223
+ pm2 start npx --name "my-agent" -- @agentvault/secure-channel \
224
+ --token=YOUR_TOKEN --name="My Agent"
225
+
226
+ # View logs
227
+ pm2 logs my-agent
228
+
229
+ # Auto-restart on crash
230
+ pm2 save
231
+
232
+ # Stop the agent
233
+ pm2 stop my-agent
234
+ ```
235
+
236
+ pm2 keeps the process running if the terminal closes and auto-restarts on crashes. Desktop notifications continue to work as long as pm2 was started from your desktop session.
237
+
238
+ For headless servers (no desktop), use `--no-notifications` and configure `--webhook-url` instead.
239
+
219
240
  ## Security
220
241
 
221
242
  - **XChaCha20-Poly1305** symmetric encryption (192-bit nonces)
package/dist/cli.js CHANGED
@@ -45770,12 +45770,15 @@ var SecureChannel = class extends EventEmitter {
45770
45770
  // src/cli.ts
45771
45771
  import { resolve } from "node:path";
45772
45772
  import { createInterface } from "node:readline";
45773
+ import notifier from "node-notifier";
45773
45774
  var args = process.argv.slice(2);
45774
45775
  var flags = {};
45775
45776
  for (const arg of args) {
45776
- const match = arg.match(/^--(\w[\w-]*)=(.+)$/);
45777
- if (match) {
45778
- flags[match[1]] = match[2];
45777
+ const kvMatch = arg.match(/^--(\w[\w-]*)=(.+)$/);
45778
+ if (kvMatch) {
45779
+ flags[kvMatch[1]] = kvMatch[2];
45780
+ } else if (arg.startsWith("--")) {
45781
+ flags[arg.slice(2)] = "true";
45779
45782
  }
45780
45783
  }
45781
45784
  var token = flags["token"] || process.env.AGENTVAULT_INVITE_TOKEN;
@@ -45783,6 +45786,7 @@ var name = flags["name"] || process.env.AGENTVAULT_AGENT_NAME || "CLI Agent";
45783
45786
  var dataDir = flags["data-dir"] || process.env.AGENTVAULT_DATA_DIR || "./agentvault-data";
45784
45787
  var apiUrl = flags["api-url"] || process.env.AGENTVAULT_API_URL || "https://api.agentvault.chat";
45785
45788
  var webhookUrl = flags["webhook-url"] || process.env.AGENTVAULT_WEBHOOK_URL;
45789
+ var noNotifications = flags["no-notifications"] === "true" || process.env.AGENTVAULT_NO_NOTIFICATIONS === "1";
45786
45790
  if (!token) {
45787
45791
  console.error(`
45788
45792
  AgentVault Secure Channel CLI
@@ -45796,13 +45800,15 @@ Options:
45796
45800
  --data-dir=PATH Directory for persistent state (default: ./agentvault-data)
45797
45801
  --api-url=URL API endpoint (default: https://api.agentvault.chat)
45798
45802
  --webhook-url=URL URL for HTTP webhook notifications on new messages
45803
+ --no-notifications Disable OS desktop notifications (enabled by default)
45799
45804
 
45800
45805
  Environment variables:
45801
- AGENTVAULT_INVITE_TOKEN Same as --token
45802
- AGENTVAULT_AGENT_NAME Same as --name
45803
- AGENTVAULT_DATA_DIR Same as --data-dir
45804
- AGENTVAULT_API_URL Same as --api-url
45805
- AGENTVAULT_WEBHOOK_URL Same as --webhook-url
45806
+ AGENTVAULT_INVITE_TOKEN Same as --token
45807
+ AGENTVAULT_AGENT_NAME Same as --name
45808
+ AGENTVAULT_DATA_DIR Same as --data-dir
45809
+ AGENTVAULT_API_URL Same as --api-url
45810
+ AGENTVAULT_WEBHOOK_URL Same as --webhook-url
45811
+ AGENTVAULT_NO_NOTIFICATIONS Set to "1" to disable desktop notifications
45806
45812
 
45807
45813
  Example:
45808
45814
  npx @agentvault/secure-channel --token=av_tok_abc123 --name="My Agent"
@@ -45831,6 +45837,14 @@ var channel = new SecureChannel({
45831
45837
  console.log(`
45832
45838
  [${time}] Owner: ${plaintext}`);
45833
45839
  process.stdout.write("\n> ");
45840
+ if (!noNotifications) {
45841
+ const body = plaintext.length > 100 ? plaintext.slice(0, 100) + "..." : plaintext;
45842
+ notifier.notify({
45843
+ title: "AgentVault \u2014 New Message",
45844
+ message: body,
45845
+ sound: true
45846
+ });
45847
+ }
45834
45848
  },
45835
45849
  onStateChange: (state) => {
45836
45850
  console.log(`
@@ -45856,6 +45870,7 @@ console.log(`
45856
45870
  \u2551 Agent: ${name.padEnd(37)}\u2551
45857
45871
  \u2551 API: ${apiUrl.padEnd(37)}\u2551
45858
45872
  \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
45873
+ Keep this process running to receive messages${noNotifications ? "." : " and notifications."}
45859
45874
  `);
45860
45875
  await channel.start();
45861
45876
  var rl = createInterface({