hiloop-sdk 0.5.0 → 0.5.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.
package/dist/ws.d.ts CHANGED
@@ -33,6 +33,7 @@ export declare class HiloopWsClient {
33
33
  private closed;
34
34
  private crypto;
35
35
  private initPromise;
36
+ private seenMessageIds;
36
37
  constructor(options: HiloopWsClientOptions);
37
38
  /** Initialize encryption context (derives keypair from API key, fetches space key). */
38
39
  private ensureCrypto;
package/dist/ws.js CHANGED
@@ -22,6 +22,7 @@ export class HiloopWsClient {
22
22
  this.closed = false;
23
23
  this.crypto = null;
24
24
  this.initPromise = null;
25
+ this.seenMessageIds = new Set();
25
26
  this.options = options;
26
27
  }
27
28
  /** Initialize encryption context (derives keypair from API key, fetches space key). */
@@ -87,6 +88,18 @@ export class HiloopWsClient {
87
88
  if (data.type === "message.new") {
88
89
  return;
89
90
  }
91
+ // Deduplicate messages delivered via multiple topics
92
+ if (data.messageId) {
93
+ if (this.seenMessageIds.has(data.messageId))
94
+ return;
95
+ this.seenMessageIds.add(data.messageId);
96
+ // Keep set bounded
97
+ if (this.seenMessageIds.size > 1000) {
98
+ const first = this.seenMessageIds.values().next().value;
99
+ if (first)
100
+ this.seenMessageIds.delete(first);
101
+ }
102
+ }
90
103
  // Auto-decrypt session messages
91
104
  if (data.type === "session.message.new" && data.encryptedContent && this.crypto) {
92
105
  const plain = await this.crypto.decryptSessionMessage(data.encryptedContent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hiloop-sdk",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "TypeScript SDK for Hiloop — zero-trust human-AI agent interaction platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",