@unboundcx/sdk 4.13.56 → 4.13.58
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.58",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
package/services/ai/assist.js
CHANGED
|
@@ -14,7 +14,12 @@ export class AssistService {
|
|
|
14
14
|
* @param {Object} options - Evaluate options
|
|
15
15
|
* @param {string} options.taskId - Task ID
|
|
16
16
|
* @param {Array} options.utterances - Utterances to evaluate
|
|
17
|
-
* @returns {Promise<Object>} Evaluation result
|
|
17
|
+
* @returns {Promise<Object>} Evaluation result. Beyond the existing fields, now includes:
|
|
18
|
+
* @returns {string} result.coach - Agent-only guidance (may draw on internal + public KB, cards, playbook)
|
|
19
|
+
* @returns {Array<{sourceId:string,title:string,visibility:'internal'|'public',knowledgeBaseId:string}>} result.citations
|
|
20
|
+
* @returns {'ok'|'legacy'|'blocked:citation'|'blocked:overlap'|'blocked:dontSay'} result.guardResult
|
|
21
|
+
* @returns {'legacy'|'split'} result.visibilityMode
|
|
22
|
+
* @returns {string} result.reply - Insertable customer-facing text; empty when guardResult is blocked:*
|
|
18
23
|
*
|
|
19
24
|
* @example
|
|
20
25
|
* const result = await sdk.ai.assist.evaluate({
|
|
@@ -44,7 +49,8 @@ export class AssistService {
|
|
|
44
49
|
*
|
|
45
50
|
* @param {Object} options - Options
|
|
46
51
|
* @param {string} options.taskId - Task ID
|
|
47
|
-
* @returns {Promise<Object>} Last evaluation
|
|
52
|
+
* @returns {Promise<Object>} Last evaluation. Same shape as evaluate()'s result, including
|
|
53
|
+
* coach, citations, guardResult, visibilityMode, reply (see evaluate() for field docs).
|
|
48
54
|
*
|
|
49
55
|
* @example
|
|
50
56
|
* const last = await sdk.ai.assist.getLast({
|
|
@@ -63,6 +69,41 @@ export class AssistService {
|
|
|
63
69
|
return result;
|
|
64
70
|
}
|
|
65
71
|
|
|
72
|
+
/**
|
|
73
|
+
* List persisted AI Assist suggestions (assistSuggestions table), optionally scoped to a queue.
|
|
74
|
+
*
|
|
75
|
+
* @param {Object} [options] - Options
|
|
76
|
+
* @param {string} [options.queueId] - Filter by queue
|
|
77
|
+
* @param {number} [options.limit] - Max rows to return
|
|
78
|
+
* @returns {Promise<Object>} List of suggestion rows
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* const { suggestions } = await sdk.ai.assist.listSuggestions({ queueId: 'queue_123', limit: 50 });
|
|
82
|
+
*/
|
|
83
|
+
async listSuggestions({ queueId, limit } = {}) {
|
|
84
|
+
const result = await internalRequest(this.sdk, '/ai/assist/suggestions', 'GET', {
|
|
85
|
+
query: { queueId, limit },
|
|
86
|
+
});
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get aggregate stats for AI Assist suggestions (counts by guardResult, top blocked citations).
|
|
92
|
+
*
|
|
93
|
+
* @param {Object} [options] - Options
|
|
94
|
+
* @param {string} [options.queueId] - Filter by queue
|
|
95
|
+
* @returns {Promise<Object>} Stats { byGuardResult, topBlockedCitations, ... }
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* const stats = await sdk.ai.assist.suggestionStats({ queueId: 'queue_123' });
|
|
99
|
+
*/
|
|
100
|
+
async suggestionStats({ queueId } = {}) {
|
|
101
|
+
const result = await internalRequest(this.sdk, '/ai/assist/suggestions/stats', 'GET', {
|
|
102
|
+
query: { queueId },
|
|
103
|
+
});
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
|
|
66
107
|
async listQueueKnowledgeBases({ queueId }) {
|
|
67
108
|
this.sdk.validateParams(
|
|
68
109
|
{ queueId },
|
|
@@ -17,9 +17,11 @@ export class KnowledgeBaseService {
|
|
|
17
17
|
* @param {string} [params.filters.sourceType] - Filter by source type (article, document, source)
|
|
18
18
|
* @param {Array} [params.filters.tags] - Filter by tags
|
|
19
19
|
* @param {boolean} [params.rerank] - Whether to apply LLM reranking (default: true)
|
|
20
|
+
* @param {'all'|'public'} [params.visibility] - Result visibility scope: 'all' (default) or 'public' only.
|
|
21
|
+
* Each result's source now also includes isPublic, knowledgeBaseId, knowledgeBaseName.
|
|
20
22
|
* @returns {Promise<Object>} Search results with source attribution
|
|
21
23
|
*/
|
|
22
|
-
async search({ query, knowledgeBaseId, limit, filters, rerank }) {
|
|
24
|
+
async search({ query, knowledgeBaseId, limit, filters, rerank, visibility }) {
|
|
23
25
|
this.sdk.validateParams(
|
|
24
26
|
{ query },
|
|
25
27
|
{
|
|
@@ -28,7 +30,7 @@ export class KnowledgeBaseService {
|
|
|
28
30
|
);
|
|
29
31
|
|
|
30
32
|
const params = {
|
|
31
|
-
body: { query, knowledgeBaseId, limit, filters, rerank },
|
|
33
|
+
body: { query, knowledgeBaseId, limit, filters, rerank, visibility },
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
const result = await internalRequest(this.sdk,
|
|
@@ -385,11 +385,60 @@ export class WorkerService {
|
|
|
385
385
|
params.body.userId = userId;
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
-
const result = await internalRequest(this.sdk,
|
|
388
|
+
const result = await internalRequest(this.sdk,
|
|
389
389
|
'/taskRouter/worker/queueLogout',
|
|
390
390
|
'PUT',
|
|
391
391
|
params,
|
|
392
392
|
);
|
|
393
393
|
return result;
|
|
394
394
|
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Search for workers within a queue's scope
|
|
398
|
+
* Finds workers a caller can act on (transfer/invite/DM) for a given queue, with optional
|
|
399
|
+
* name/email/extension text search and skill-match flagging.
|
|
400
|
+
*
|
|
401
|
+
* @param {Object} options - Parameters
|
|
402
|
+
* @param {string} options.queueId - The queue ID to scope the search to (required)
|
|
403
|
+
* @param {string} [options.q] - Free-text filter matching name, email, or extension
|
|
404
|
+
* @param {string[]} [options.skills] - Skill IDs to flag matches for (joined as a comma-separated list)
|
|
405
|
+
* @param {number} [options.limit] - Max rows to return (default 50, max 200)
|
|
406
|
+
* @returns {Promise<Object>} Object containing the matching worker rows
|
|
407
|
+
* @returns {Array<Object>} result.rows - Worker rows with status/capacity/skills info
|
|
408
|
+
* @returns {number} result.total - Total matching rows
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* const { rows, total } = await sdk.taskRouter.worker.search({ queueId: 'queue123', q: 'sam' });
|
|
412
|
+
* console.log(rows.length, total);
|
|
413
|
+
*/
|
|
414
|
+
async search(options = {}) {
|
|
415
|
+
const { queueId, q, skills, limit } = options;
|
|
416
|
+
|
|
417
|
+
this.sdk.validateParams(
|
|
418
|
+
{ queueId, q, skills, limit },
|
|
419
|
+
{
|
|
420
|
+
queueId: { type: 'string', required: true },
|
|
421
|
+
q: { type: 'string', required: false },
|
|
422
|
+
skills: { type: 'array', required: false },
|
|
423
|
+
limit: { type: 'number', required: false },
|
|
424
|
+
},
|
|
425
|
+
);
|
|
426
|
+
|
|
427
|
+
const query = { queueId };
|
|
428
|
+
|
|
429
|
+
if (q) {
|
|
430
|
+
query.q = q;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (skills && skills.length) {
|
|
434
|
+
query.skills = skills.join(',');
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (limit) {
|
|
438
|
+
query.limit = limit;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
const result = await internalRequest(this.sdk, '/taskRouter/workers/search', 'GET', { query });
|
|
442
|
+
return result;
|
|
443
|
+
}
|
|
395
444
|
}
|