@connekz/connekz-agent 1.5.0 → 2.0.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/CHANGELOG.md CHANGED
@@ -1,4 +1,25 @@
1
- ## [1.5.0] - 2026-04-01 (Minor Release)
1
+ ## [2.0.0] - 2026-06-23 (Major Release)
2
+
3
+ ### Added
4
+ - Cross redis session support
5
+ - Support for multiple redis instances
6
+
7
+ ## [1.5.2] - 2026-06-23 (Patch Release)
8
+
9
+ ### Added
10
+
11
+ ### Changed
12
+
13
+ - Minor lint cleanup in `Icon.vue` (quote style).
14
+
15
+ ### Fixed
16
+
17
+ - Socket.IO now connects with `withCredentials: true` so the AWS ALB sticky-session cookie (`AWSALBCORS`, `SameSite=None`) is sent on cross-origin requests. Without it, long-polling sessions were routed to different backend instances behind the load balancer and failed with HTTP 400 ("Session ID unknown").
18
+ - `setCurrentConversationId` no longer resets the active audio batch when a repeated `THINKING` status arrives for the same conversation (prevents killing in-flight audio).
19
+
20
+ ### Security
21
+
22
+ ## [1.5.1] - 2026-04-01 (Patch Release)
2
23
 
3
24
  ### Added
4
25
 
@@ -8,6 +29,11 @@
8
29
 
9
30
  ### Security
10
31
 
32
+ ## [1.5.0] - 2026-04-01 (Minor Release)
33
+
34
+ ### Security
35
+ - Security enhancements
36
+
11
37
  ## [1.4.1] - 2026-03-25 (Patch Release)
12
38
 
13
39
  ### Added
package/README.md CHANGED
@@ -333,3 +333,110 @@ async function handleToolCall(tool: ConnekzToolCallPayload): Promise<string> {
333
333
  ### Tool Call Response:
334
334
  Always return a string (plain text or JSON.stringify for structured data).
335
335
 
336
+ ---
337
+
338
+ ## On-Demand Tools & Memories (v1.5.0+)
339
+
340
+ By default, tools and memories are loaded automatically via semantic search based on conversation context. With **on-demand loading**, you can explicitly control which tools and memories are available in a session.
341
+
342
+ ### Setup
343
+
344
+ 1. In the Connekz developer portal, create a tool or memory and set **Load Mode** to `On-Demand`.
345
+ 2. Assign a unique **Slug** (e.g., `navigate-dashboard`, `onboarding-context`).
346
+ 3. From your app, call `setSessionTools()` with an array of slugs to load.
347
+
348
+ ### Usage
349
+
350
+ ```typescript
351
+ // Load specific tools and memories into the active session
352
+ connekzInstance.connekzAgent.setSessionTools([
353
+ 'navigate-to-page',
354
+ 'fill-form-field',
355
+ 'onboarding-welcome-context',
356
+ ]);
357
+
358
+ // Replace with a different set (previous on-demand items are removed)
359
+ connekzInstance.connekzAgent.setSessionTools([
360
+ 'dashboard-tools',
361
+ 'search-products',
362
+ ]);
363
+
364
+ // Clear all on-demand tools/memories
365
+ connekzInstance.connekzAgent.setSessionTools([]);
366
+ ```
367
+
368
+ ### How It Works
369
+
370
+ - **Auto tools/memories** (default): Loaded via semantic search every conversation turn. Best for general-purpose knowledge.
371
+ - **On-demand tools/memories**: Only loaded when your app explicitly requests them by slug. Not included in semantic search results.
372
+ - Both types run in parallel — auto and on-demand items are merged in the active session.
373
+ - Calling `setSessionTools()` again replaces the previous on-demand set.
374
+ - Max 30 slugs per call.
375
+
376
+ ### Server Confirmation
377
+
378
+ The server emits a `session-tools-updated` event (via `cnkz-voice-agent` channel) with:
379
+ ```json
380
+ { "type": "session-tools-updated", "data": { "tools": ["tool-name-1"], "memories": 2 } }
381
+ ```
382
+
383
+ ---
384
+
385
+ ## Developer API: Usage Tracking
386
+
387
+ ### Get Total Token Usage
388
+
389
+ Retrieve aggregated token usage for your instance within a date range (max 1 month).
390
+
391
+ ```
392
+ GET /api/v1/developer/usage/total
393
+ ```
394
+
395
+ **Headers:**
396
+ ```
397
+ Authorization: Bearer <your-secret-key>
398
+ X-Client-Id: <your-client-id>
399
+ ```
400
+
401
+ **Query Parameters:**
402
+ | Param | Required | Description |
403
+ |-------|----------|-------------|
404
+ | `startDate` | Yes | ISO 8601 date (e.g., `2026-04-01`) |
405
+ | `endDate` | Yes | ISO 8601 date (e.g., `2026-04-30`) |
406
+ | `userIdentity` | No | Filter by guest user identity |
407
+
408
+ **Response:**
409
+ ```json
410
+ {
411
+ "totalConnekzTokens": 142.5,
412
+ "sessionCount": 47,
413
+ "periodStart": "2026-04-01",
414
+ "periodEnd": "2026-04-30"
415
+ }
416
+ ```
417
+
418
+ **With userIdentity filter:**
419
+ ```json
420
+ {
421
+ "totalConnekzTokens": 12.3,
422
+ "sessionCount": 5,
423
+ "periodStart": "2026-04-01",
424
+ "periodEnd": "2026-04-30",
425
+ "userIdentity": "user-abc-123"
426
+ }
427
+ ```
428
+
429
+ ### User Identity Tracking
430
+
431
+ When initializing the agent with `userIdentity`, all token usage is tagged with that identity:
432
+
433
+ ```typescript
434
+ const instance = init({
435
+ clientId: 'your-client-id',
436
+ clientSecret: 'your-secret',
437
+ userIdentity: 'user-abc-123', // Tagged on all usage records
438
+ });
439
+ ```
440
+
441
+ This allows per-user usage tracking on shared instances (e.g., onboarding flows where multiple users share one instance).
442
+