@agentvault/secure-channel 0.4.4 → 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 +23 -8
- package/dist/cli.js.map +2 -2
- package/package.json +3 -1
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
|
|
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;
|
|
@@ -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
|
|
45802
|
-
AGENTVAULT_AGENT_NAME
|
|
45803
|
-
AGENTVAULT_DATA_DIR
|
|
45804
|
-
AGENTVAULT_API_URL
|
|
45805
|
-
AGENTVAULT_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({
|