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