@agentvault/agentvault 0.20.9 → 0.20.11

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 CHANGED
@@ -65390,6 +65390,9 @@ var init_channel = __esm({
65390
65390
  } catch (kpErr) {
65391
65391
  console.warn("[SecureChannel] Failed to publish MLS KeyPackage:", kpErr);
65392
65392
  }
65393
+ this.listA2AChannels().catch((err) => {
65394
+ console.warn("[SecureChannel] A2A channel sync on connect failed:", err);
65395
+ });
65393
65396
  this._pullDeliveryQueue().catch((err) => {
65394
65397
  console.warn("[SecureChannel] Initial delivery pull failed:", err);
65395
65398
  });
@@ -67037,103 +67040,105 @@ ${messageText}`;
67037
67040
  return;
67038
67041
  }
67039
67042
  const { messages } = await res.json();
67040
- if (!messages || messages.length === 0) return;
67041
- const order = { welcome: 0, commit: 1, application: 2 };
67042
- messages.sort((a2, b2) => {
67043
- const ao = order[a2.message_type] ?? 2;
67044
- const bo = order[b2.message_type] ?? 2;
67045
- if (ao !== bo) return ao - bo;
67046
- return new Date(a2.created_at).getTime() - new Date(b2.created_at).getTime();
67047
- });
67048
- const ackedIds = [];
67049
- const nackedIds = [];
67050
- for (const msg of messages) {
67051
- try {
67052
- if (msg.sender_device_id === this._deviceId) {
67053
- ackedIds.push(msg.queue_id);
67054
- continue;
67055
- }
67056
- if (msg.message_type === "welcome") {
67057
- await this._handleMlsWelcome({
67058
- group_id: msg.group_id,
67059
- sender_device_id: msg.sender_device_id,
67060
- payload: msg.payload,
67061
- room_id: msg.room_id,
67062
- conversation_id: msg.conversation_id,
67063
- a2a_channel_id: msg.a2a_channel_id
67064
- });
67065
- } else if (msg.message_type === "commit") {
67066
- await this._handleMlsCommit({
67067
- group_id: msg.group_id,
67068
- sender_device_id: msg.sender_device_id,
67069
- epoch: msg.epoch,
67070
- payload: msg.payload
67071
- });
67072
- } else if (msg.message_type === "application") {
67073
- if (msg.room_id) {
67074
- await this._handleRoomMessageMLS({
67075
- message_id: msg.message_id,
67043
+ const hasMessages = messages && messages.length > 0;
67044
+ if (hasMessages) {
67045
+ const order = { welcome: 0, commit: 1, application: 2 };
67046
+ messages.sort((a2, b2) => {
67047
+ const ao = order[a2.message_type] ?? 2;
67048
+ const bo = order[b2.message_type] ?? 2;
67049
+ if (ao !== bo) return ao - bo;
67050
+ return new Date(a2.created_at).getTime() - new Date(b2.created_at).getTime();
67051
+ });
67052
+ const ackedIds = [];
67053
+ const nackedIds = [];
67054
+ for (const msg of messages) {
67055
+ try {
67056
+ if (msg.sender_device_id === this._deviceId) {
67057
+ ackedIds.push(msg.queue_id);
67058
+ continue;
67059
+ }
67060
+ if (msg.message_type === "welcome") {
67061
+ await this._handleMlsWelcome({
67076
67062
  group_id: msg.group_id,
67077
67063
  sender_device_id: msg.sender_device_id,
67078
- epoch: msg.epoch,
67079
67064
  payload: msg.payload,
67080
67065
  room_id: msg.room_id,
67081
- created_at: msg.created_at
67082
- });
67083
- } else if (msg.a2a_channel_id) {
67084
- await this._handleA2AMessageMLS({
67085
- message_id: msg.message_id,
67086
- group_id: msg.group_id,
67087
- sender_device_id: msg.sender_device_id,
67088
- epoch: msg.epoch,
67089
- payload: msg.payload,
67090
- a2a_channel_id: msg.a2a_channel_id,
67091
- created_at: msg.created_at
67066
+ conversation_id: msg.conversation_id,
67067
+ a2a_channel_id: msg.a2a_channel_id
67092
67068
  });
67093
- } else if (msg.conversation_id) {
67094
- await this._handleMessageMLS({
67095
- message_id: msg.message_id,
67069
+ } else if (msg.message_type === "commit") {
67070
+ await this._handleMlsCommit({
67096
67071
  group_id: msg.group_id,
67097
67072
  sender_device_id: msg.sender_device_id,
67098
67073
  epoch: msg.epoch,
67099
- payload: msg.payload,
67100
- conversation_id: msg.conversation_id,
67101
- created_at: msg.created_at
67074
+ payload: msg.payload
67102
67075
  });
67076
+ } else if (msg.message_type === "application") {
67077
+ if (msg.room_id) {
67078
+ await this._handleRoomMessageMLS({
67079
+ message_id: msg.message_id,
67080
+ group_id: msg.group_id,
67081
+ sender_device_id: msg.sender_device_id,
67082
+ epoch: msg.epoch,
67083
+ payload: msg.payload,
67084
+ room_id: msg.room_id,
67085
+ created_at: msg.created_at
67086
+ });
67087
+ } else if (msg.a2a_channel_id) {
67088
+ await this._handleA2AMessageMLS({
67089
+ message_id: msg.message_id,
67090
+ group_id: msg.group_id,
67091
+ sender_device_id: msg.sender_device_id,
67092
+ epoch: msg.epoch,
67093
+ payload: msg.payload,
67094
+ a2a_channel_id: msg.a2a_channel_id,
67095
+ created_at: msg.created_at
67096
+ });
67097
+ } else if (msg.conversation_id) {
67098
+ await this._handleMessageMLS({
67099
+ message_id: msg.message_id,
67100
+ group_id: msg.group_id,
67101
+ sender_device_id: msg.sender_device_id,
67102
+ epoch: msg.epoch,
67103
+ payload: msg.payload,
67104
+ conversation_id: msg.conversation_id,
67105
+ created_at: msg.created_at
67106
+ });
67107
+ }
67103
67108
  }
67109
+ ackedIds.push(msg.queue_id);
67110
+ } catch (err) {
67111
+ console.warn(`[SecureChannel] Delivery ${msg.message_type} processing failed:`, err);
67112
+ nackedIds.push(msg.queue_id);
67104
67113
  }
67105
- ackedIds.push(msg.queue_id);
67106
- } catch (err) {
67107
- console.warn(`[SecureChannel] Delivery ${msg.message_type} processing failed:`, err);
67108
- nackedIds.push(msg.queue_id);
67109
67114
  }
67110
- }
67111
- if (nackedIds.length > 0) {
67112
- try {
67113
- await fetch(`${this.config.apiUrl}/api/v1/mls/delivery/nack`, {
67114
- method: "POST",
67115
- headers: {
67116
- Authorization: `Bearer ${this._deviceJwt}`,
67117
- "Content-Type": "application/json"
67118
- },
67119
- body: JSON.stringify({ queue_ids: nackedIds })
67120
- });
67121
- } catch {
67115
+ if (nackedIds.length > 0) {
67116
+ try {
67117
+ await fetch(`${this.config.apiUrl}/api/v1/mls/delivery/nack`, {
67118
+ method: "POST",
67119
+ headers: {
67120
+ Authorization: `Bearer ${this._deviceJwt}`,
67121
+ "Content-Type": "application/json"
67122
+ },
67123
+ body: JSON.stringify({ queue_ids: nackedIds })
67124
+ });
67125
+ } catch {
67126
+ }
67122
67127
  }
67123
- }
67124
- if (ackedIds.length > 0) {
67125
- try {
67126
- await fetch(`${this.config.apiUrl}/api/v1/mls/delivery/ack`, {
67127
- method: "POST",
67128
- headers: {
67129
- Authorization: `Bearer ${this._deviceJwt}`,
67130
- "Content-Type": "application/json"
67131
- },
67132
- body: JSON.stringify({ queue_ids: ackedIds, device_id: this._deviceId })
67133
- });
67134
- console.log(`[SecureChannel] Delivery acked ${ackedIds.length}/${messages.length}`);
67135
- } catch (ackErr) {
67136
- console.warn("[SecureChannel] Delivery ack failed:", ackErr);
67128
+ if (ackedIds.length > 0) {
67129
+ try {
67130
+ await fetch(`${this.config.apiUrl}/api/v1/mls/delivery/ack`, {
67131
+ method: "POST",
67132
+ headers: {
67133
+ Authorization: `Bearer ${this._deviceJwt}`,
67134
+ "Content-Type": "application/json"
67135
+ },
67136
+ body: JSON.stringify({ queue_ids: ackedIds, device_id: this._deviceId })
67137
+ });
67138
+ console.log(`[SecureChannel] Delivery acked ${ackedIds.length}/${messages.length}`);
67139
+ } catch (ackErr) {
67140
+ console.warn("[SecureChannel] Delivery ack failed:", ackErr);
67141
+ }
67137
67142
  }
67138
67143
  }
67139
67144
  for (const [roomId, mlsGroup] of this._mlsGroups) {
@@ -88655,7 +88660,7 @@ var init_index = __esm({
88655
88660
  init_skill_invoker();
88656
88661
  await init_skill_telemetry();
88657
88662
  await init_policy_enforcer();
88658
- VERSION = true ? "0.20.9" : "0.0.0-dev";
88663
+ VERSION = true ? "0.20.11" : "0.0.0-dev";
88659
88664
  }
88660
88665
  });
88661
88666