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