@agentvault/secure-channel 0.4.3 → 0.5.0
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/dist/cli.js +31 -11
- package/dist/cli.js.map +2 -2
- package/package.json +3 -1
package/dist/cli.js
CHANGED
|
@@ -45770,18 +45770,23 @@ 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
|
|
45777
|
-
if (
|
|
45778
|
-
flags[
|
|
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;
|
|
45782
45785
|
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";
|
|
45788
|
+
var webhookUrl = flags["webhook-url"] || process.env.AGENTVAULT_WEBHOOK_URL;
|
|
45789
|
+
var noNotifications = flags["no-notifications"] === "true" || process.env.AGENTVAULT_NO_NOTIFICATIONS === "1";
|
|
45785
45790
|
if (!token) {
|
|
45786
45791
|
console.error(`
|
|
45787
45792
|
AgentVault Secure Channel CLI
|
|
@@ -45790,19 +45795,24 @@ Usage:
|
|
|
45790
45795
|
npx @agentvault/secure-channel --token=YOUR_INVITE_TOKEN
|
|
45791
45796
|
|
|
45792
45797
|
Options:
|
|
45793
|
-
--token=TOKEN
|
|
45794
|
-
--name=NAME
|
|
45795
|
-
--data-dir=PATH
|
|
45796
|
-
--api-url=URL
|
|
45798
|
+
--token=TOKEN Invite token from the AgentVault dashboard (required on first run)
|
|
45799
|
+
--name=NAME Agent display name (default: "CLI Agent")
|
|
45800
|
+
--data-dir=PATH Directory for persistent state (default: ./agentvault-data)
|
|
45801
|
+
--api-url=URL API endpoint (default: https://api.agentvault.chat)
|
|
45802
|
+
--webhook-url=URL URL for HTTP webhook notifications on new messages
|
|
45803
|
+
--no-notifications Disable OS desktop notifications (enabled by default)
|
|
45797
45804
|
|
|
45798
45805
|
Environment variables:
|
|
45799
|
-
AGENTVAULT_INVITE_TOKEN
|
|
45800
|
-
AGENTVAULT_AGENT_NAME
|
|
45801
|
-
AGENTVAULT_DATA_DIR
|
|
45802
|
-
AGENTVAULT_API_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
|
|
45803
45812
|
|
|
45804
45813
|
Example:
|
|
45805
45814
|
npx @agentvault/secure-channel --token=av_tok_abc123 --name="My Agent"
|
|
45815
|
+
npx @agentvault/secure-channel --token=av_tok_abc123 --webhook-url=https://myapp.com/webhook
|
|
45806
45816
|
`);
|
|
45807
45817
|
process.exit(1);
|
|
45808
45818
|
}
|
|
@@ -45821,11 +45831,20 @@ var channel = new SecureChannel({
|
|
|
45821
45831
|
dataDir: resolve(dataDir),
|
|
45822
45832
|
apiUrl,
|
|
45823
45833
|
agentName: name,
|
|
45834
|
+
webhookUrl,
|
|
45824
45835
|
onMessage: (plaintext, metadata) => {
|
|
45825
45836
|
const time = new Date(metadata.timestamp).toLocaleTimeString();
|
|
45826
45837
|
console.log(`
|
|
45827
45838
|
[${time}] Owner: ${plaintext}`);
|
|
45828
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
|
+
}
|
|
45829
45848
|
},
|
|
45830
45849
|
onStateChange: (state) => {
|
|
45831
45850
|
console.log(`
|
|
@@ -45851,6 +45870,7 @@ console.log(`
|
|
|
45851
45870
|
\u2551 Agent: ${name.padEnd(37)}\u2551
|
|
45852
45871
|
\u2551 API: ${apiUrl.padEnd(37)}\u2551
|
|
45853
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."}
|
|
45854
45874
|
`);
|
|
45855
45875
|
await channel.start();
|
|
45856
45876
|
var rl = createInterface({
|