@agentvault/agentvault 0.8.0 → 0.9.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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=install-plugin.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-plugin.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/install-plugin.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAqB3C,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAMZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,QAAQ,EAER,UAAU,EAEX,MAAM,YAAY,CAAC;AAoDpB,qBAAa,aAAc,SAAQ,YAAY;IA0CjC,OAAO,CAAC,MAAM;IAzC1B,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,sBAAsB,CAAc;IAC5C,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,SAAS,CAGH;IACd,OAAO,CAAC,GAAG,CAA0B;IACrC,OAAO,CAAC,UAAU,CAA8C;IAChE,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,eAAe,CAA8C;IACrE,OAAO,CAAC,UAAU,CAA+C;IACjE,OAAO,CAAC,kBAAkB,CAAK;IAC/B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,kBAAkB,CAA+C;IACz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;IAoehB;;;;OAIG;YACW,sBAAsB;IA+JpC;;;OAGG;YACW,6BAA6B;IA6C3C;;;OAGG;YACW,iBAAiB;IAwD/B;;;OAGG;IACG,kBAAkB,CACtB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7B,OAAO,CAAC,IAAI,CAAC;IA8ChB;;;OAGG;YACW,oBAAoB;IAqClC;;;OAGG;YACW,uBAAuB;IAkCrC;;;;OAIG;YACW,mBAAmB;IAkEjC;;;OAGG;YACW,kBAAkB;IAyJhC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAiBlC;;;OAGG;IACH;;;OAGG;YACW,mBAAmB;IA8GjC,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,UAAU;YAMJ,mBAAmB;IAmCjC,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,gBAAgB;YAOV,qBAAqB;IAuCnC,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,SAAS;IAejB,OAAO,CAAC,kBAAkB;IAiH1B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,YAAY;IAKpB;;;OAGG;YACW,aAAa;CAmB5B"}
package/dist/cli.js CHANGED
@@ -45151,21 +45151,7 @@ var init_merkle = __esm({
45151
45151
  }
45152
45152
  });
45153
45153
 
45154
- // ../crypto/dist/index.js
45155
- var init_dist = __esm({
45156
- async "../crypto/dist/index.js"() {
45157
- "use strict";
45158
- await init_keys();
45159
- await init_x3dh();
45160
- await init_ratchet();
45161
- await init_file_crypto();
45162
- await init_did();
45163
- init_scan_engine();
45164
- await init_merkle();
45165
- }
45166
- });
45167
-
45168
- // src/crypto-helpers.ts
45154
+ // ../crypto/dist/transport.js
45169
45155
  function hexToBytes(hex) {
45170
45156
  return libsodium_wrappers_default.from_hex(hex);
45171
45157
  }
@@ -45187,18 +45173,14 @@ function encryptedMessageToTransport(msg) {
45187
45173
  nonce: bytesToBase64(msg.nonce)
45188
45174
  };
45189
45175
  const headerJson = JSON.stringify(headerObj);
45190
- const headerBlob = bytesToBase64(
45191
- new TextEncoder().encode(headerJson)
45192
- );
45176
+ const headerBlob = bytesToBase64(new TextEncoder().encode(headerJson));
45193
45177
  return {
45194
45178
  header_blob: headerBlob,
45195
45179
  ciphertext: bytesToBase64(msg.ciphertext)
45196
45180
  };
45197
45181
  }
45198
45182
  function transportToEncryptedMessage(transport) {
45199
- const headerJson = new TextDecoder().decode(
45200
- base64ToBytes(transport.header_blob)
45201
- );
45183
+ const headerJson = new TextDecoder().decode(base64ToBytes(transport.header_blob));
45202
45184
  const headerObj = JSON.parse(headerJson);
45203
45185
  return {
45204
45186
  header: {
@@ -45211,10 +45193,33 @@ function transportToEncryptedMessage(transport) {
45211
45193
  ciphertext: base64ToBytes(transport.ciphertext)
45212
45194
  };
45213
45195
  }
45196
+ var init_transport = __esm({
45197
+ async "../crypto/dist/transport.js"() {
45198
+ "use strict";
45199
+ await init_libsodium_wrappers();
45200
+ }
45201
+ });
45202
+
45203
+ // ../crypto/dist/index.js
45204
+ var init_dist = __esm({
45205
+ async "../crypto/dist/index.js"() {
45206
+ "use strict";
45207
+ await init_keys();
45208
+ await init_x3dh();
45209
+ await init_ratchet();
45210
+ await init_file_crypto();
45211
+ await init_did();
45212
+ init_scan_engine();
45213
+ await init_merkle();
45214
+ await init_transport();
45215
+ }
45216
+ });
45217
+
45218
+ // src/crypto-helpers.ts
45214
45219
  var init_crypto_helpers = __esm({
45215
45220
  async "src/crypto-helpers.ts"() {
45216
45221
  "use strict";
45217
- await init_libsodium_wrappers();
45222
+ await init_dist();
45218
45223
  }
45219
45224
  });
45220
45225
 
@@ -45308,7 +45313,7 @@ async function activateDevice(apiUrl2, deviceId) {
45308
45313
  }
45309
45314
  return res.json();
45310
45315
  }
45311
- var init_transport = __esm({
45316
+ var init_transport2 = __esm({
45312
45317
  "src/transport.ts"() {
45313
45318
  "use strict";
45314
45319
  }
@@ -45352,7 +45357,7 @@ var init_channel = __esm({
45352
45357
  await init_dist();
45353
45358
  await init_crypto_helpers();
45354
45359
  init_state();
45355
- init_transport();
45360
+ init_transport2();
45356
45361
  POLL_INTERVAL_MS = 6e3;
45357
45362
  RECONNECT_BASE_MS = 1e3;
45358
45363
  RECONNECT_MAX_MS = 3e4;
@@ -45517,9 +45522,18 @@ var init_channel = __esm({
45517
45522
  scanStatus = scanResult.status;
45518
45523
  }
45519
45524
  this._appendHistory("agent", plaintext, topicId);
45525
+ const roomConvIds = /* @__PURE__ */ new Set();
45526
+ if (this._persisted?.rooms) {
45527
+ for (const room of Object.values(this._persisted.rooms)) {
45528
+ for (const cid of room.conversationIds) {
45529
+ roomConvIds.add(cid);
45530
+ }
45531
+ }
45532
+ }
45520
45533
  const messageGroupId = randomUUID();
45521
45534
  for (const [convId, session] of this._sessions) {
45522
45535
  if (!session.activated) continue;
45536
+ if (roomConvIds.has(convId)) continue;
45523
45537
  const encrypted = session.ratchet.encrypt(plaintext);
45524
45538
  const transport = encryptedMessageToTransport(encrypted);
45525
45539
  const msg = {
@@ -45665,6 +45679,10 @@ var init_channel = __esm({
45665
45679
  if (conv.participantA !== myDeviceId && conv.participantB !== myDeviceId) {
45666
45680
  continue;
45667
45681
  }
45682
+ if (this._sessions.has(conv.id)) {
45683
+ conversationIds.push(conv.id);
45684
+ continue;
45685
+ }
45668
45686
  const otherDeviceId = conv.participantA === myDeviceId ? conv.participantB : conv.participantA;
45669
45687
  const otherMember = roomData.members.find((m2) => m2.deviceId === otherDeviceId);
45670
45688
  if (!otherMember?.identityPublicKey) {
@@ -45674,13 +45692,12 @@ var init_channel = __esm({
45674
45692
  continue;
45675
45693
  }
45676
45694
  const isInitiator = myDeviceId < otherDeviceId;
45695
+ const theirEphKey = otherMember.ephemeralPublicKey ?? otherMember.identityPublicKey;
45677
45696
  const sharedSecret = performX3DH({
45678
45697
  myIdentityPrivate: hexToBytes(identity.privateKey),
45679
45698
  myEphemeralPrivate: hexToBytes(ephemeral.privateKey),
45680
45699
  theirIdentityPublic: hexToBytes(otherMember.identityPublicKey),
45681
- theirEphemeralPublic: hexToBytes(
45682
- otherMember.ephemeralPublicKey ?? otherMember.identityPublicKey
45683
- ),
45700
+ theirEphemeralPublic: hexToBytes(theirEphKey),
45684
45701
  isInitiator
45685
45702
  });
45686
45703
  const ratchet = isInitiator ? DoubleRatchet.initSender(sharedSecret, {
@@ -45752,9 +45769,11 @@ var init_channel = __esm({
45752
45769
  this._ws.send(
45753
45770
  JSON.stringify({
45754
45771
  event: "room_message",
45755
- room_id: roomId,
45756
- recipients,
45757
- message_type: messageType
45772
+ data: {
45773
+ room_id: roomId,
45774
+ recipients,
45775
+ message_type: messageType
45776
+ }
45758
45777
  })
45759
45778
  );
45760
45779
  } else {
@@ -46180,6 +46199,23 @@ var init_channel = __esm({
46180
46199
  if (this._persisted.hubAddress) {
46181
46200
  payload2.hub_address = this._persisted.hubAddress;
46182
46201
  }
46202
+ if (channelEntry.observerSession?.ratchetState) {
46203
+ try {
46204
+ const obsRatchet = DoubleRatchet.deserialize(channelEntry.observerSession.ratchetState);
46205
+ const obsEncrypted = obsRatchet.encrypt(text);
46206
+ const obsHeaderObj = {
46207
+ dhPublicKey: bytesToHex(obsEncrypted.header.dhPublicKey),
46208
+ previousChainLength: obsEncrypted.header.previousChainLength,
46209
+ messageNumber: obsEncrypted.header.messageNumber
46210
+ };
46211
+ payload2.observer_header_blob = Buffer.from(JSON.stringify(obsHeaderObj)).toString("hex");
46212
+ payload2.observer_ciphertext = bytesToHex(obsEncrypted.ciphertext);
46213
+ payload2.observer_nonce = bytesToHex(obsEncrypted.nonce);
46214
+ channelEntry.observerSession.ratchetState = obsRatchet.serialize();
46215
+ } catch (obsErr) {
46216
+ console.error("[SecureChannel] Observer encryption failed (sending without observer copy):", obsErr);
46217
+ }
46218
+ }
46183
46219
  channelEntry.session.ratchetState = ratchet.serialize();
46184
46220
  await this._persistState();
46185
46221
  this._ws.send(
@@ -46482,7 +46518,7 @@ var init_channel = __esm({
46482
46518
  const d2 = data.data;
46483
46519
  this.joinRoom({
46484
46520
  roomId: d2.room_id,
46485
- name: d2.name,
46521
+ name: d2.room_name ?? d2.name ?? "Room",
46486
46522
  members: (d2.members || []).map((m2) => ({
46487
46523
  deviceId: m2.device_id,
46488
46524
  entityType: m2.entity_type,
@@ -46635,6 +46671,74 @@ var init_channel = __esm({
46635
46671
  }
46636
46672
  this.emit("a2a_channel_activated", actData);
46637
46673
  }
46674
+ if (data.event === "a2a_observer_enabled") {
46675
+ const obsData = data.data || data;
46676
+ const obsChannelId = obsData.channel_id;
46677
+ const obsChannelEntry = this._persisted?.a2aChannels?.[obsChannelId];
46678
+ if (obsChannelEntry && this._persisted && this._ws) {
46679
+ try {
46680
+ const obsEphemeral = await generateEphemeralKeypair();
46681
+ const obsEphPubHex = bytesToHex(obsEphemeral.publicKey);
46682
+ const obsEphPrivHex = bytesToHex(obsEphemeral.privateKey);
46683
+ obsChannelEntry.pendingObserverEphemeralPrivateKey = obsEphPrivHex;
46684
+ await this._persistState();
46685
+ this._ws.send(
46686
+ JSON.stringify({
46687
+ event: "a2a_observer_key_submit",
46688
+ data: {
46689
+ channel_id: obsChannelId,
46690
+ ephemeral_key: obsEphPubHex,
46691
+ side: obsChannelEntry.role || "initiator"
46692
+ }
46693
+ })
46694
+ );
46695
+ console.log(
46696
+ `[SecureChannel] Observer key submitted for channel ${obsChannelId.slice(0, 8)}... (side=${obsChannelEntry.role})`
46697
+ );
46698
+ } catch (err) {
46699
+ console.error("[SecureChannel] Observer key submission failed:", err);
46700
+ }
46701
+ }
46702
+ }
46703
+ if (data.event === "a2a_observer_key_accepted") {
46704
+ const obsAccData = data.data || data;
46705
+ const obsAccChannelId = obsAccData.channel_id;
46706
+ const observerIdentityHex = obsAccData.observer_identity_key;
46707
+ const obsAccSide = obsAccData.side;
46708
+ const obsAccEntry = this._persisted?.a2aChannels?.[obsAccChannelId];
46709
+ if (obsAccEntry && obsAccEntry.pendingObserverEphemeralPrivateKey && this._persisted) {
46710
+ try {
46711
+ const myIdentityPrivate = hexToBytes(this._persisted.identityKeypair.privateKey);
46712
+ const myIdentityPublic = hexToBytes(this._persisted.identityKeypair.publicKey);
46713
+ const myObsEphemeralPrivate = hexToBytes(obsAccEntry.pendingObserverEphemeralPrivateKey);
46714
+ const ownerIdentityPublic = hexToBytes(observerIdentityHex);
46715
+ const obsSharedSecret = performX3DH({
46716
+ myIdentityPrivate,
46717
+ myEphemeralPrivate: myObsEphemeralPrivate,
46718
+ theirIdentityPublic: ownerIdentityPublic,
46719
+ theirEphemeralPublic: ownerIdentityPublic,
46720
+ // owner uses identity as ephemeral
46721
+ isInitiator: true
46722
+ });
46723
+ const identityKp = {
46724
+ publicKey: myIdentityPublic,
46725
+ privateKey: myIdentityPrivate,
46726
+ keyType: "ed25519"
46727
+ };
46728
+ const obsRatchet = DoubleRatchet.initSender(obsSharedSecret, identityKp);
46729
+ obsAccEntry.observerSession = {
46730
+ ratchetState: obsRatchet.serialize()
46731
+ };
46732
+ delete obsAccEntry.pendingObserverEphemeralPrivateKey;
46733
+ await this._persistState();
46734
+ console.log(
46735
+ `[SecureChannel] Observer ratchet initialized for channel ${obsAccChannelId.slice(0, 8)}... (side=${obsAccSide})`
46736
+ );
46737
+ } catch (err) {
46738
+ console.error("[SecureChannel] Observer ratchet init failed:", err);
46739
+ }
46740
+ }
46741
+ }
46638
46742
  if (data.event === "a2a_channel_rejected") {
46639
46743
  this.emit("a2a_channel_rejected", data.data || data);
46640
46744
  }
@@ -47105,7 +47209,73 @@ ${messageText}`;
47105
47209
  header_blob: msgData.header_blob,
47106
47210
  ciphertext: msgData.ciphertext
47107
47211
  });
47108
- const plaintext = session.ratchet.decrypt(encrypted);
47212
+ let plaintext;
47213
+ try {
47214
+ plaintext = session.ratchet.decrypt(encrypted);
47215
+ } catch (decryptErr) {
47216
+ console.warn(
47217
+ `[SecureChannel] Room decrypt failed for conv ${convId.slice(0, 8)}...: ${String(decryptErr)}, re-initializing ratchet`
47218
+ );
47219
+ try {
47220
+ const roomEntry = this._persisted?.rooms ? Object.values(this._persisted.rooms).find(
47221
+ (r2) => r2.conversationIds.includes(convId)
47222
+ ) : null;
47223
+ if (!roomEntry) throw new Error("Room not found for conversation");
47224
+ const otherMember = roomEntry.members.find(
47225
+ (m2) => m2.deviceId === msgData.sender_device_id
47226
+ );
47227
+ if (!otherMember?.identityPublicKey) throw new Error("No key for sender");
47228
+ const isInitiator = this._deviceId < msgData.sender_device_id;
47229
+ const identity = this._persisted.identityKeypair;
47230
+ const ephemeral = this._persisted.ephemeralKeypair;
47231
+ const sharedSecret = performX3DH({
47232
+ myIdentityPrivate: hexToBytes(identity.privateKey),
47233
+ myEphemeralPrivate: hexToBytes(ephemeral.privateKey),
47234
+ theirIdentityPublic: hexToBytes(otherMember.identityPublicKey),
47235
+ theirEphemeralPublic: hexToBytes(
47236
+ otherMember.ephemeralPublicKey ?? otherMember.identityPublicKey
47237
+ ),
47238
+ isInitiator
47239
+ });
47240
+ const newRatchet = isInitiator ? DoubleRatchet.initSender(sharedSecret, {
47241
+ publicKey: hexToBytes(identity.publicKey),
47242
+ privateKey: hexToBytes(identity.privateKey),
47243
+ keyType: "ed25519"
47244
+ }) : DoubleRatchet.initReceiver(sharedSecret, {
47245
+ publicKey: hexToBytes(identity.publicKey),
47246
+ privateKey: hexToBytes(identity.privateKey),
47247
+ keyType: "ed25519"
47248
+ });
47249
+ session.ratchet = newRatchet;
47250
+ session.activated = false;
47251
+ this._persisted.sessions[convId] = {
47252
+ ownerDeviceId: session.ownerDeviceId,
47253
+ ratchetState: newRatchet.serialize(),
47254
+ activated: false
47255
+ };
47256
+ await this._persistState();
47257
+ console.log(
47258
+ `[SecureChannel] Room ratchet re-initialized for conv ${convId.slice(0, 8)}...`
47259
+ );
47260
+ plaintext = session.ratchet.decrypt(encrypted);
47261
+ } catch (reinitErr) {
47262
+ console.error(
47263
+ `[SecureChannel] Room ratchet re-init failed for conv ${convId.slice(0, 8)}...:`,
47264
+ reinitErr
47265
+ );
47266
+ return;
47267
+ }
47268
+ }
47269
+ let messageText;
47270
+ let messageType;
47271
+ try {
47272
+ const parsed = JSON.parse(plaintext);
47273
+ messageType = parsed.type || "message";
47274
+ messageText = parsed.text || plaintext;
47275
+ } catch {
47276
+ messageType = "message";
47277
+ messageText = plaintext;
47278
+ }
47109
47279
  if (!session.activated) {
47110
47280
  session.activated = true;
47111
47281
  console.log(
@@ -47120,16 +47290,17 @@ ${messageText}`;
47120
47290
  messageId: msgData.message_id ?? "",
47121
47291
  conversationId: convId,
47122
47292
  timestamp: msgData.created_at ?? (/* @__PURE__ */ new Date()).toISOString(),
47123
- messageType: msgData.message_type ?? "text"
47293
+ messageType,
47294
+ roomId: msgData.room_id
47124
47295
  };
47125
47296
  this.emit("room_message", {
47126
47297
  roomId: msgData.room_id,
47127
47298
  senderDeviceId: msgData.sender_device_id,
47128
- plaintext,
47129
- messageType: msgData.message_type ?? "text",
47299
+ plaintext: messageText,
47300
+ messageType,
47130
47301
  timestamp: msgData.created_at ?? (/* @__PURE__ */ new Date()).toISOString()
47131
47302
  });
47132
- this.config.onMessage?.(plaintext, metadata);
47303
+ this.config.onMessage?.(messageText, metadata);
47133
47304
  }
47134
47305
  /**
47135
47306
  * Find the pairwise conversation ID for a given sender in a room.
@@ -47501,6 +47672,68 @@ var init_openclaw_plugin = __esm({
47501
47672
  }
47502
47673
  });
47503
47674
 
47675
+ // src/gateway-send.ts
47676
+ var gateway_send_exports = {};
47677
+ __export(gateway_send_exports, {
47678
+ checkGateway: () => checkGateway,
47679
+ sendToOwner: () => sendToOwner
47680
+ });
47681
+ function resolveBaseUrl(options) {
47682
+ const host = options?.host ?? "127.0.0.1";
47683
+ const port = options?.port ?? (process.env.GATEWAY_SEND_PORT ? Number(process.env.GATEWAY_SEND_PORT) : 18790);
47684
+ return `http://${host}:${port}`;
47685
+ }
47686
+ function friendlyError(err) {
47687
+ if (err instanceof TypeError && String(err.cause ?? err.message).includes("ECONNREFUSED")) {
47688
+ return "Gateway not reachable \u2014 is OpenClaw running?";
47689
+ }
47690
+ return err instanceof Error ? err.message : String(err);
47691
+ }
47692
+ async function sendToOwner(text, options) {
47693
+ if (typeof text !== "string" || text.trim().length === 0) {
47694
+ return { ok: false, error: "Message text must be a non-empty string" };
47695
+ }
47696
+ try {
47697
+ const base = resolveBaseUrl(options);
47698
+ const res = await fetch(`${base}/send`, {
47699
+ method: "POST",
47700
+ headers: { "Content-Type": "application/json" },
47701
+ body: JSON.stringify({ text }),
47702
+ signal: options?.signal
47703
+ });
47704
+ if (!res.ok) {
47705
+ const body = await res.text().catch(() => "");
47706
+ return { ok: false, error: `HTTP ${res.status}${body ? `: ${body}` : ""}` };
47707
+ }
47708
+ return { ok: true };
47709
+ } catch (err) {
47710
+ return { ok: false, error: friendlyError(err) };
47711
+ }
47712
+ }
47713
+ async function checkGateway(options) {
47714
+ try {
47715
+ const base = resolveBaseUrl(options);
47716
+ const res = await fetch(`${base}/status`, { signal: options?.signal });
47717
+ if (!res.ok) {
47718
+ return { ok: false, error: `HTTP ${res.status}` };
47719
+ }
47720
+ const data = await res.json();
47721
+ return {
47722
+ ok: true,
47723
+ state: data.state,
47724
+ deviceId: data.deviceId,
47725
+ sessions: data.sessions
47726
+ };
47727
+ } catch (err) {
47728
+ return { ok: false, error: friendlyError(err) };
47729
+ }
47730
+ }
47731
+ var init_gateway_send = __esm({
47732
+ "src/gateway-send.ts"() {
47733
+ "use strict";
47734
+ }
47735
+ });
47736
+
47504
47737
  // src/index.ts
47505
47738
  var VERSION;
47506
47739
  var init_index = __esm({
@@ -47508,7 +47741,8 @@ var init_index = __esm({
47508
47741
  "use strict";
47509
47742
  await init_channel();
47510
47743
  await init_openclaw_plugin();
47511
- VERSION = "0.7.0";
47744
+ init_gateway_send();
47745
+ VERSION = "0.9.0";
47512
47746
  }
47513
47747
  });
47514
47748
 
@@ -47892,6 +48126,37 @@ if (subcommand === "pm2-setup") {
47892
48126
  configurePm22(env);
47893
48127
  process.exit(0);
47894
48128
  }
48129
+ if (subcommand === "send") {
48130
+ const message = args.slice(1).filter((a2) => !a2.startsWith("--")).join(" ").trim();
48131
+ if (!message) {
48132
+ console.error('Usage: agentvault send "your message here" [--port=PORT]');
48133
+ process.exit(1);
48134
+ }
48135
+ const port = flags["port"] ? Number(flags["port"]) : void 0;
48136
+ const { sendToOwner: sendToOwner2 } = await Promise.resolve().then(() => (init_gateway_send(), gateway_send_exports));
48137
+ const result = await sendToOwner2(message, { port });
48138
+ if (result.ok) {
48139
+ console.log("Sent.");
48140
+ } else {
48141
+ console.error(`Failed: ${result.error}`);
48142
+ process.exit(1);
48143
+ }
48144
+ process.exit(0);
48145
+ }
48146
+ if (subcommand === "status") {
48147
+ const port = flags["port"] ? Number(flags["port"]) : void 0;
48148
+ const { checkGateway: checkGateway2 } = await Promise.resolve().then(() => (init_gateway_send(), gateway_send_exports));
48149
+ const result = await checkGateway2({ port });
48150
+ if (result.ok) {
48151
+ console.log(` State: ${result.state ?? "unknown"}`);
48152
+ console.log(` Device: ${result.deviceId ?? "unknown"}`);
48153
+ console.log(` Sessions: ${result.sessions ?? 0}`);
48154
+ } else {
48155
+ console.error(`Failed: ${result.error}`);
48156
+ process.exit(1);
48157
+ }
48158
+ process.exit(0);
48159
+ }
47895
48160
  if (!token) {
47896
48161
  console.error(`
47897
48162
  AgentVault Secure Channel CLI
@@ -47899,6 +48164,8 @@ AgentVault Secure Channel CLI
47899
48164
  Usage:
47900
48165
  npx @agentvault/agentvault setup --token=TOKEN # First-time OpenClaw setup
47901
48166
  npx @agentvault/agentvault pm2-setup # Configure pm2 (existing install)
48167
+ npx @agentvault/agentvault send "message" # Send a message to the owner
48168
+ npx @agentvault/agentvault status # Check gateway status
47902
48169
  npx @agentvault/agentvault --token=TOKEN # Standalone interactive CLI
47903
48170
 
47904
48171
  Options:
@@ -47908,6 +48175,7 @@ Options:
47908
48175
  --api-url=URL API endpoint (default: https://api.agentvault.chat)
47909
48176
  --webhook-url=URL URL for HTTP webhook notifications on new messages
47910
48177
  --no-notifications Disable OS desktop notifications
48178
+ --port=PORT Gateway port for send/status (default: 18790)
47911
48179
 
47912
48180
  Environment variables:
47913
48181
  AGENTVAULT_INVITE_TOKEN Same as --token
@@ -47916,11 +48184,18 @@ Environment variables:
47916
48184
  AGENTVAULT_API_URL Same as --api-url
47917
48185
  AGENTVAULT_WEBHOOK_URL Same as --webhook-url
47918
48186
  AGENTVAULT_NO_NOTIFICATIONS Set to "1" to disable desktop notifications
48187
+ GATEWAY_SEND_PORT Same as --port for send/status
47919
48188
 
47920
48189
  Examples:
47921
48190
  # One-time OpenClaw setup (recommended):
47922
48191
  npx @agentvault/agentvault setup --token=av_tok_abc123
47923
48192
 
48193
+ # Send a message to the owner:
48194
+ npx @agentvault/agentvault send "Hello from the agent"
48195
+
48196
+ # Check gateway status:
48197
+ npx @agentvault/agentvault status
48198
+
47924
48199
  # Standalone interactive CLI:
47925
48200
  npx @agentvault/agentvault --token=av_tok_abc123 --name="My Agent"
47926
48201
  `);