hiloop-sdk 0.4.0 → 0.4.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
@@ -26,6 +26,7 @@ export type WsEventHandler = (data: any) => void;
26
26
  export declare class HiloopWsClient {
27
27
  private ws;
28
28
  private options;
29
+ private agentId;
29
30
  private handlers;
30
31
  private anyHandlers;
31
32
  private reconnectAttempts;
package/dist/ws.js CHANGED
@@ -15,6 +15,7 @@ import { CryptoContext, deriveKeyPairFromApiKey, computeFingerprint } from "./cr
15
15
  export class HiloopWsClient {
16
16
  constructor(options) {
17
17
  this.ws = null;
18
+ this.agentId = null;
18
19
  this.handlers = new Map();
19
20
  this.anyHandlers = new Set();
20
21
  this.reconnectAttempts = 0;
@@ -80,8 +81,17 @@ export class HiloopWsClient {
80
81
  try {
81
82
  const data = JSON.parse(event.data);
82
83
  if (data.type === "connected") {
84
+ this.agentId = data.agentId;
83
85
  resolve();
84
86
  }
87
+ // Skip metadata-only message.new (agents get the richer session.message.new instead)
88
+ if (data.type === "message.new") {
89
+ return;
90
+ }
91
+ // Skip echoes: don't emit session messages sent by this agent
92
+ if (data.type === "session.message.new" && data.senderType === "agent" && data.senderId === this.agentId) {
93
+ return;
94
+ }
85
95
  this.emit(data.type, data);
86
96
  }
87
97
  catch { /* ignore malformed */ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hiloop-sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.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",