hiloop-sdk 0.5.5 → 0.6.0

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/client.d.ts CHANGED
@@ -268,7 +268,9 @@ export declare class HiloopClient {
268
268
  * Send a message in a conv session. Accepts plaintext — encrypts automatically
269
269
  * using the session message key (`{agentPub}:{AES-GCM ciphertext}` format).
270
270
  */
271
- sendConvSessionMessage(sessionId: string, content: string): Promise<ConvSessionMessage>;
271
+ sendConvSessionMessage(sessionId: string, content: string, opts?: {
272
+ agentName?: string;
273
+ }): Promise<ConvSessionMessage>;
272
274
  /** Send a typing indicator to a conv session (HU-034). */
273
275
  sendConvSessionTyping(sessionId: string, typing: boolean): Promise<void>;
274
276
  /** Edit a previously sent conv session message. */
package/dist/client.js CHANGED
@@ -87,13 +87,14 @@ export class HiloopClient {
87
87
  this.initialized = true;
88
88
  }
89
89
  /** Raw HTTP request without triggering auto-init (used during init itself). */
90
- buildHeaders() {
90
+ buildHeaders(agentName) {
91
91
  const h = {
92
92
  "Content-Type": "application/json",
93
93
  "X-API-Key": this.apiKey,
94
94
  };
95
- if (this.options.agentName)
96
- h["X-Agent"] = this.options.agentName;
95
+ const agent = agentName ?? this.options.agentName;
96
+ if (agent)
97
+ h["X-Agent"] = agent;
97
98
  return h;
98
99
  }
99
100
  async rawRequest(method, path, options) {
@@ -164,7 +165,7 @@ export class HiloopClient {
164
165
  try {
165
166
  const res = await fetch(url, {
166
167
  method,
167
- headers: this.buildHeaders(),
168
+ headers: this.buildHeaders(options?.agentName),
168
169
  body: options?.body !== undefined ? JSON.stringify(options.body) : undefined,
169
170
  signal: controller.signal,
170
171
  });
@@ -551,10 +552,10 @@ export class HiloopClient {
551
552
  * Send a message in a conv session. Accepts plaintext — encrypts automatically
552
553
  * using the session message key (`{agentPub}:{AES-GCM ciphertext}` format).
553
554
  */
554
- async sendConvSessionMessage(sessionId, content) {
555
+ async sendConvSessionMessage(sessionId, content, opts) {
555
556
  await this.ensureInitialized();
556
557
  const encryptedContent = await this.crypto.encryptSessionMessage(content);
557
- const data = await this.request("POST", `/agent/sessions/${sessionId}/messages`, { body: { encryptedContent } });
558
+ const data = await this.request("POST", `/agent/sessions/${sessionId}/messages`, { body: { encryptedContent }, agentName: opts?.agentName });
558
559
  return parseConvSessionMessage(data);
559
560
  }
560
561
  /** Send a typing indicator to a conv session (HU-034). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hiloop-sdk",
3
- "version": "0.5.5",
3
+ "version": "0.6.0",
4
4
  "description": "TypeScript SDK for Hiloop — zero-trust human-AI agent interaction platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",