@onecx/integration-interface 8.12.0 → 8.14.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/index.cjs +68 -4
- package/dist/index.mjs +68 -4
- package/package.json +2 -2
- package/src/index.d.ts +4 -0
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.d.ts +22 -0
- package/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.js +24 -0
- package/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.js.map +1 -0
- package/src/lib/gatherers/ai-agent/v1/ai-agent.model.d.ts +14 -0
- package/src/lib/gatherers/ai-agent/v1/ai-agent.model.js +1 -0
- package/src/lib/gatherers/ai-agent/v1/ai-agent.model.js.map +1 -0
- package/src/lib/services/ai-agent.service.d.ts +15 -0
- package/src/lib/services/ai-agent.service.js +39 -0
- package/src/lib/services/ai-agent.service.js.map +1 -0
- package/src/lib/services/ai-completion.service.d.ts +15 -0
- package/src/lib/services/ai-completion.service.js +30 -0
- package/src/lib/services/ai-completion.service.js.map +1 -0
- package/src/version.d.ts +1 -1
- package/src/version.js +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// libs/integration-interface/src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AiAgentGatherer: () => AiAgentGatherer,
|
|
33
34
|
AiCompletionGatherer: () => AiCompletionGatherer,
|
|
34
35
|
AiContextGatherer: () => AiContextGatherer,
|
|
35
36
|
ConfigurationTopic: () => ConfigurationTopic,
|
|
@@ -53,6 +54,8 @@ __export(index_exports, {
|
|
|
53
54
|
MessageTopic: () => MessageTopic,
|
|
54
55
|
NotificationService: () => NotificationService,
|
|
55
56
|
NotificationTopic: () => NotificationTopic,
|
|
57
|
+
OneCXAiAgentService: () => OneCXAiAgentService,
|
|
58
|
+
OneCXAiCompletionService: () => OneCXAiCompletionService,
|
|
56
59
|
OverrideType: () => OverrideType,
|
|
57
60
|
ParametersTopic: () => ParametersTopic,
|
|
58
61
|
PermissionsRpcTopic: () => PermissionsRpcTopic,
|
|
@@ -70,6 +73,8 @@ __export(index_exports, {
|
|
|
70
73
|
constructBaseUrlFromWorkspace: () => constructBaseUrlFromWorkspace,
|
|
71
74
|
constructEndpointUrl: () => constructEndpointUrl,
|
|
72
75
|
constructRouteUrl: () => constructRouteUrl,
|
|
76
|
+
consumerAiAgentProvider: () => consumerAiAgentProvider,
|
|
77
|
+
consumerAiCompletionProvider: () => consumerAiCompletionProvider,
|
|
73
78
|
determineBrowserLanguage: () => determineBrowserLanguage,
|
|
74
79
|
dissolveEndpoint: () => dissolveEndpoint,
|
|
75
80
|
doesUrlExistForWorkspace: () => doesUrlExistForWorkspace,
|
|
@@ -117,7 +122,8 @@ function ensureProperty(obj, path, initialValue) {
|
|
|
117
122
|
|
|
118
123
|
// libs/accelerator/src/lib/declarations.ts
|
|
119
124
|
var gatherPromises = ensureProperty(globalThis, ["@onecx/accelerator", "gatherer", "promises"], {});
|
|
120
|
-
var
|
|
125
|
+
var gatherId = ensureProperty(gatherPromises, ["@onecx/accelerator", "gatherer", "id"], 0);
|
|
126
|
+
var topicUseBroadcastChannel = ensureProperty(gatherId, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
|
|
121
127
|
var topicInitDate = ensureProperty(topicUseBroadcastChannel, ["@onecx/accelerator", "topic", "initDate"], Date.now());
|
|
122
128
|
var topicTabId = ensureProperty(topicInitDate, ["@onecx/accelerator", "topic", "tabId"], Math.ceil(globalThis.performance?.now?.() ?? 0));
|
|
123
129
|
|
|
@@ -466,9 +472,8 @@ var Topic = class extends TopicPublisher {
|
|
|
466
472
|
var import_rxjs2 = require("rxjs");
|
|
467
473
|
|
|
468
474
|
// libs/accelerator/src/lib/utils/gatherer.ts
|
|
469
|
-
var Gatherer = class
|
|
475
|
+
var Gatherer = class {
|
|
470
476
|
logger;
|
|
471
|
-
static id = 0;
|
|
472
477
|
topic;
|
|
473
478
|
ownIds = /* @__PURE__ */ new Set();
|
|
474
479
|
topicSub = null;
|
|
@@ -512,7 +517,7 @@ var Gatherer = class _Gatherer {
|
|
|
512
517
|
if (!topicTabId["@onecx/accelerator"].gatherer?.promises) {
|
|
513
518
|
throw new Error("Gatherer is not initialized");
|
|
514
519
|
}
|
|
515
|
-
const id =
|
|
520
|
+
const id = topicTabId["@onecx/accelerator"].gatherer.id++;
|
|
516
521
|
this.ownIds.add(id);
|
|
517
522
|
topicTabId["@onecx/accelerator"].gatherer.promises[id] = [];
|
|
518
523
|
const message = { id, request };
|
|
@@ -1617,3 +1622,62 @@ var AiCompletionGatherer = class extends Gatherer {
|
|
|
1617
1622
|
super("aiCompletion", 1, callback);
|
|
1618
1623
|
}
|
|
1619
1624
|
};
|
|
1625
|
+
|
|
1626
|
+
// libs/integration-interface/src/lib/services/ai-completion.service.ts
|
|
1627
|
+
async function consumerAiCompletionProvider(_request) {
|
|
1628
|
+
return null;
|
|
1629
|
+
}
|
|
1630
|
+
var OneCXAiCompletionService = class {
|
|
1631
|
+
logger = createLogger2("OneCXAiCompletionService");
|
|
1632
|
+
aiCompletionGatherer = new AiCompletionGatherer(consumerAiCompletionProvider);
|
|
1633
|
+
async getCompletion(request) {
|
|
1634
|
+
this.logger.debug("getCompletion", request);
|
|
1635
|
+
const responses = await this.aiCompletionGatherer.gather(request);
|
|
1636
|
+
const response = responses.find((r) => r !== null);
|
|
1637
|
+
if (!response) {
|
|
1638
|
+
throw new Error("No AI provider responded to the completion request");
|
|
1639
|
+
}
|
|
1640
|
+
this.logger.debug("getCompletion resolved", response);
|
|
1641
|
+
return response;
|
|
1642
|
+
}
|
|
1643
|
+
destroy() {
|
|
1644
|
+
this.aiCompletionGatherer.destroy();
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
// libs/integration-interface/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.ts
|
|
1649
|
+
var AiAgentGatherer = class extends Gatherer {
|
|
1650
|
+
constructor(callback) {
|
|
1651
|
+
super("aiAgent", 1, callback);
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
|
|
1655
|
+
// libs/integration-interface/src/lib/services/ai-agent.service.ts
|
|
1656
|
+
function consumerAiAgentProvider(_request) {
|
|
1657
|
+
return Promise.resolve(null);
|
|
1658
|
+
}
|
|
1659
|
+
var OneCXAiAgentService = class {
|
|
1660
|
+
logger = createLogger2("OneCXAiAgentService");
|
|
1661
|
+
aiAgentGatherer = new AiAgentGatherer(consumerAiAgentProvider);
|
|
1662
|
+
async getAgents(request = {}) {
|
|
1663
|
+
this.logger.debug("getAgents", request);
|
|
1664
|
+
const responses = await this.aiAgentGatherer.gather(request);
|
|
1665
|
+
const agents = /* @__PURE__ */ new Map();
|
|
1666
|
+
for (const providerAgents of responses) {
|
|
1667
|
+
for (const agent of providerAgents ?? []) {
|
|
1668
|
+
if (!agents.has(agent.id)) {
|
|
1669
|
+
agents.set(agent.id, agent);
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
if (agents.size === 0) {
|
|
1674
|
+
this.logger.warn("No AI provider returned any agents for the request", request);
|
|
1675
|
+
} else {
|
|
1676
|
+
this.logger.debug("getAgents resolved", agents.size);
|
|
1677
|
+
}
|
|
1678
|
+
return [...agents.values()];
|
|
1679
|
+
}
|
|
1680
|
+
destroy() {
|
|
1681
|
+
this.aiAgentGatherer.destroy();
|
|
1682
|
+
}
|
|
1683
|
+
};
|
package/dist/index.mjs
CHANGED
|
@@ -24,7 +24,8 @@ function ensureProperty(obj, path, initialValue) {
|
|
|
24
24
|
|
|
25
25
|
// libs/accelerator/src/lib/declarations.ts
|
|
26
26
|
var gatherPromises = ensureProperty(globalThis, ["@onecx/accelerator", "gatherer", "promises"], {});
|
|
27
|
-
var
|
|
27
|
+
var gatherId = ensureProperty(gatherPromises, ["@onecx/accelerator", "gatherer", "id"], 0);
|
|
28
|
+
var topicUseBroadcastChannel = ensureProperty(gatherId, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
|
|
28
29
|
var topicInitDate = ensureProperty(topicUseBroadcastChannel, ["@onecx/accelerator", "topic", "initDate"], Date.now());
|
|
29
30
|
var topicTabId = ensureProperty(topicInitDate, ["@onecx/accelerator", "topic", "tabId"], Math.ceil(globalThis.performance?.now?.() ?? 0));
|
|
30
31
|
|
|
@@ -373,9 +374,8 @@ var Topic = class extends TopicPublisher {
|
|
|
373
374
|
import { BehaviorSubject as BehaviorSubject2, ReplaySubject } from "rxjs";
|
|
374
375
|
|
|
375
376
|
// libs/accelerator/src/lib/utils/gatherer.ts
|
|
376
|
-
var Gatherer = class
|
|
377
|
+
var Gatherer = class {
|
|
377
378
|
logger;
|
|
378
|
-
static id = 0;
|
|
379
379
|
topic;
|
|
380
380
|
ownIds = /* @__PURE__ */ new Set();
|
|
381
381
|
topicSub = null;
|
|
@@ -419,7 +419,7 @@ var Gatherer = class _Gatherer {
|
|
|
419
419
|
if (!topicTabId["@onecx/accelerator"].gatherer?.promises) {
|
|
420
420
|
throw new Error("Gatherer is not initialized");
|
|
421
421
|
}
|
|
422
|
-
const id =
|
|
422
|
+
const id = topicTabId["@onecx/accelerator"].gatherer.id++;
|
|
423
423
|
this.ownIds.add(id);
|
|
424
424
|
topicTabId["@onecx/accelerator"].gatherer.promises[id] = [];
|
|
425
425
|
const message = { id, request };
|
|
@@ -1524,7 +1524,67 @@ var AiCompletionGatherer = class extends Gatherer {
|
|
|
1524
1524
|
super("aiCompletion", 1, callback);
|
|
1525
1525
|
}
|
|
1526
1526
|
};
|
|
1527
|
+
|
|
1528
|
+
// libs/integration-interface/src/lib/services/ai-completion.service.ts
|
|
1529
|
+
async function consumerAiCompletionProvider(_request) {
|
|
1530
|
+
return null;
|
|
1531
|
+
}
|
|
1532
|
+
var OneCXAiCompletionService = class {
|
|
1533
|
+
logger = createLogger2("OneCXAiCompletionService");
|
|
1534
|
+
aiCompletionGatherer = new AiCompletionGatherer(consumerAiCompletionProvider);
|
|
1535
|
+
async getCompletion(request) {
|
|
1536
|
+
this.logger.debug("getCompletion", request);
|
|
1537
|
+
const responses = await this.aiCompletionGatherer.gather(request);
|
|
1538
|
+
const response = responses.find((r) => r !== null);
|
|
1539
|
+
if (!response) {
|
|
1540
|
+
throw new Error("No AI provider responded to the completion request");
|
|
1541
|
+
}
|
|
1542
|
+
this.logger.debug("getCompletion resolved", response);
|
|
1543
|
+
return response;
|
|
1544
|
+
}
|
|
1545
|
+
destroy() {
|
|
1546
|
+
this.aiCompletionGatherer.destroy();
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
|
|
1550
|
+
// libs/integration-interface/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.ts
|
|
1551
|
+
var AiAgentGatherer = class extends Gatherer {
|
|
1552
|
+
constructor(callback) {
|
|
1553
|
+
super("aiAgent", 1, callback);
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
// libs/integration-interface/src/lib/services/ai-agent.service.ts
|
|
1558
|
+
function consumerAiAgentProvider(_request) {
|
|
1559
|
+
return Promise.resolve(null);
|
|
1560
|
+
}
|
|
1561
|
+
var OneCXAiAgentService = class {
|
|
1562
|
+
logger = createLogger2("OneCXAiAgentService");
|
|
1563
|
+
aiAgentGatherer = new AiAgentGatherer(consumerAiAgentProvider);
|
|
1564
|
+
async getAgents(request = {}) {
|
|
1565
|
+
this.logger.debug("getAgents", request);
|
|
1566
|
+
const responses = await this.aiAgentGatherer.gather(request);
|
|
1567
|
+
const agents = /* @__PURE__ */ new Map();
|
|
1568
|
+
for (const providerAgents of responses) {
|
|
1569
|
+
for (const agent of providerAgents ?? []) {
|
|
1570
|
+
if (!agents.has(agent.id)) {
|
|
1571
|
+
agents.set(agent.id, agent);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
if (agents.size === 0) {
|
|
1576
|
+
this.logger.warn("No AI provider returned any agents for the request", request);
|
|
1577
|
+
} else {
|
|
1578
|
+
this.logger.debug("getAgents resolved", agents.size);
|
|
1579
|
+
}
|
|
1580
|
+
return [...agents.values()];
|
|
1581
|
+
}
|
|
1582
|
+
destroy() {
|
|
1583
|
+
this.aiAgentGatherer.destroy();
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1527
1586
|
export {
|
|
1587
|
+
AiAgentGatherer,
|
|
1528
1588
|
AiCompletionGatherer,
|
|
1529
1589
|
AiContextGatherer,
|
|
1530
1590
|
ConfigurationTopic,
|
|
@@ -1548,6 +1608,8 @@ export {
|
|
|
1548
1608
|
MessageTopic,
|
|
1549
1609
|
NotificationService,
|
|
1550
1610
|
NotificationTopic,
|
|
1611
|
+
OneCXAiAgentService,
|
|
1612
|
+
OneCXAiCompletionService,
|
|
1551
1613
|
OverrideType,
|
|
1552
1614
|
ParametersTopic,
|
|
1553
1615
|
PermissionsRpcTopic,
|
|
@@ -1565,6 +1627,8 @@ export {
|
|
|
1565
1627
|
constructBaseUrlFromWorkspace,
|
|
1566
1628
|
constructEndpointUrl,
|
|
1567
1629
|
constructRouteUrl,
|
|
1630
|
+
consumerAiAgentProvider,
|
|
1631
|
+
consumerAiCompletionProvider,
|
|
1568
1632
|
determineBrowserLanguage,
|
|
1569
1633
|
dissolveEndpoint,
|
|
1570
1634
|
doesUrlExistForWorkspace,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onecx/integration-interface",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.14.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"peerDependencies": {
|
|
10
10
|
"rxjs": "^7.8.1",
|
|
11
|
-
"@onecx/accelerator": "8.
|
|
11
|
+
"@onecx/accelerator": "8.14.0"
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
14
|
"dependencies": {
|
package/src/index.d.ts
CHANGED
|
@@ -63,3 +63,7 @@ export * from './lib/gatherers/ai-context/v1/ai-context.model';
|
|
|
63
63
|
export * from './lib/gatherers/ai-context/v1/ai-context.gatherer';
|
|
64
64
|
export * from './lib/gatherers/ai-completion/v1/ai-completion.model';
|
|
65
65
|
export * from './lib/gatherers/ai-completion/v1/ai-completion.gatherer';
|
|
66
|
+
export * from './lib/services/ai-completion.service';
|
|
67
|
+
export * from './lib/gatherers/ai-agent/v1/ai-agent.model';
|
|
68
|
+
export * from './lib/gatherers/ai-agent/v1/ai-agent.gatherer';
|
|
69
|
+
export * from './lib/services/ai-agent.service';
|
package/src/index.js
CHANGED
|
@@ -63,4 +63,8 @@ export * from './lib/gatherers/ai-context/v1/ai-context.model';
|
|
|
63
63
|
export * from './lib/gatherers/ai-context/v1/ai-context.gatherer';
|
|
64
64
|
export * from './lib/gatherers/ai-completion/v1/ai-completion.model';
|
|
65
65
|
export * from './lib/gatherers/ai-completion/v1/ai-completion.gatherer';
|
|
66
|
+
export * from './lib/services/ai-completion.service';
|
|
67
|
+
export * from './lib/gatherers/ai-agent/v1/ai-agent.model';
|
|
68
|
+
export * from './lib/gatherers/ai-agent/v1/ai-agent.gatherer';
|
|
69
|
+
export * from './lib/services/ai-agent.service';
|
|
66
70
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/integration-interface/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+CAA+C,CAAA;AAC7D,cAAc,4CAA4C,CAAA;AAC1D,cAAc,iDAAiD,CAAA;AAC/D,cAAc,8CAA8C,CAAA;AAE5D,cAAc,iDAAiD,CAAA;AAE/D,cAAc,qDAAqD,CAAA;AAEn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4
|
+
* This class lets consumers gather the AI agents that are available to them.
|
|
5
|
+
* Each provider (for example the AI Provider remote component) registers a callback and answers
|
|
6
|
+
* with its agents, or with null if it does not want to contribute to the request.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
*
|
|
11
|
+
* // in the provider (remote component), answer agent requests
|
|
12
|
+
* // in ngOnDestroy, call the gatherer.destroy() method to clean up resources
|
|
13
|
+
*
|
|
14
|
+
* const aiAgentGatherer = new AiAgentGatherer(async (request) => {
|
|
15
|
+
* // return the agents visible for request.appId, or null if you do not want to contribute
|
|
16
|
+
* return [{ id: 'agent-1', name: 'Agent' }]
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class AiAgentGatherer extends Gatherer<AiAgentRequest, AiAgentResponse[] | null> {
|
|
21
|
+
constructor(callback: (request: AiAgentRequest) => Promise<AiAgentResponse[] | null>);
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Gatherer } from "@onecx/accelerator";
|
|
2
|
+
/**
|
|
3
|
+
* This class lets consumers gather the AI agents that are available to them.
|
|
4
|
+
* Each provider (for example the AI Provider remote component) registers a callback and answers
|
|
5
|
+
* with its agents, or with null if it does not want to contribute to the request.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
*
|
|
10
|
+
* // in the provider (remote component), answer agent requests
|
|
11
|
+
* // in ngOnDestroy, call the gatherer.destroy() method to clean up resources
|
|
12
|
+
*
|
|
13
|
+
* const aiAgentGatherer = new AiAgentGatherer(async (request) => {
|
|
14
|
+
* // return the agents visible for request.appId, or null if you do not want to contribute
|
|
15
|
+
* return [{ id: 'agent-1', name: 'Agent' }]
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export class AiAgentGatherer extends Gatherer {
|
|
20
|
+
constructor(callback) {
|
|
21
|
+
super("aiAgent", 1, callback);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ai-agent.gatherer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-agent.gatherer.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAI7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,eAAgB,SAAQ,QAAkD;IACnF,YAAY,QAAwE;QAChF,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;IACjC,CAAC;CACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface AiAgentRequest {
|
|
2
|
+
/**
|
|
3
|
+
* Optional application id. When set, providers should only return agents assigned to this application.
|
|
4
|
+
*/
|
|
5
|
+
appId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AiAgentResponse {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
languageCode?: string;
|
|
12
|
+
voiceEnabled?: boolean;
|
|
13
|
+
appId?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=ai-agent.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-agent.model.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/gatherers/ai-agent/v1/ai-agent.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AiAgentRequest, AiAgentResponse } from '../gatherers/ai-agent/v1/ai-agent.model';
|
|
2
|
+
export declare function consumerAiAgentProvider(_request: AiAgentRequest): Promise<AiAgentResponse[] | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Thin service wrapper around AiAgentGatherer that lets consumers collect the available AI agents.
|
|
5
|
+
*
|
|
6
|
+
* It forwards the request unchanged through the gatherer and merges the agent lists returned by all
|
|
7
|
+
* providers. Agents are de-duplicated by id, keeping the first occurrence. If no provider contributes,
|
|
8
|
+
* an empty list is returned.
|
|
9
|
+
*/
|
|
10
|
+
export declare class OneCXAiAgentService {
|
|
11
|
+
private readonly logger;
|
|
12
|
+
private readonly aiAgentGatherer;
|
|
13
|
+
getAgents(request?: AiAgentRequest): Promise<AiAgentResponse[]>;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AiAgentGatherer } from '../gatherers/ai-agent/v1/ai-agent.gatherer';
|
|
2
|
+
import { createLogger } from '../utils/logger.utils';
|
|
3
|
+
export function consumerAiAgentProvider(_request) {
|
|
4
|
+
return Promise.resolve(null);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Thin service wrapper around AiAgentGatherer that lets consumers collect the available AI agents.
|
|
8
|
+
*
|
|
9
|
+
* It forwards the request unchanged through the gatherer and merges the agent lists returned by all
|
|
10
|
+
* providers. Agents are de-duplicated by id, keeping the first occurrence. If no provider contributes,
|
|
11
|
+
* an empty list is returned.
|
|
12
|
+
*/
|
|
13
|
+
export class OneCXAiAgentService {
|
|
14
|
+
logger = createLogger('OneCXAiAgentService');
|
|
15
|
+
aiAgentGatherer = new AiAgentGatherer(consumerAiAgentProvider);
|
|
16
|
+
async getAgents(request = {}) {
|
|
17
|
+
this.logger.debug('getAgents', request);
|
|
18
|
+
const responses = await this.aiAgentGatherer.gather(request);
|
|
19
|
+
const agents = new Map();
|
|
20
|
+
for (const providerAgents of responses) {
|
|
21
|
+
for (const agent of providerAgents ?? []) {
|
|
22
|
+
if (!agents.has(agent.id)) {
|
|
23
|
+
agents.set(agent.id, agent);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (agents.size === 0) {
|
|
28
|
+
this.logger.warn('No AI provider returned any agents for the request', request);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.logger.debug('getAgents resolved', agents.size);
|
|
32
|
+
}
|
|
33
|
+
return [...agents.values()];
|
|
34
|
+
}
|
|
35
|
+
destroy() {
|
|
36
|
+
this.aiAgentGatherer.destroy();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ai-agent.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-agent.service.js","sourceRoot":"","sources":["../../../../../../libs/integration-interface/src/lib/services/ai-agent.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAA;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,UAAU,uBAAuB,CAAC,QAAwB;IAC9D,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,mBAAmB;IACb,MAAM,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAA;IAE5C,eAAe,GAAG,IAAI,eAAe,CAAC,uBAAuB,CAAC,CAAA;IAE/E,KAAK,CAAC,SAAS,CAAC,UAA0B,EAAE;QAC1C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QACvC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAC5D,MAAM,MAAM,GAAG,IAAI,GAAG,EAA2B,CAAA;QACjD,KAAK,MAAM,cAAc,IAAI,SAAS,EAAE,CAAC;YACvC,KAAK,MAAM,KAAK,IAAI,cAAc,IAAI,EAAE,EAAE,CAAC;gBACzC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;oBAC1B,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;gBAC7B,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oDAAoD,EAAE,OAAO,CAAC,CAAA;QACjF,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;QACtD,CAAC;QACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED,OAAO;QACL,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAA;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AiCompletionRequest, AiCompletionResponse } from '../gatherers/ai-completion/v1/ai-completion.model';
|
|
2
|
+
export declare function consumerAiCompletionProvider(_request: AiCompletionRequest): Promise<AiCompletionResponse | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Thin service wrapper around AiCompletionGatherer that lets consumers inside request AI completions.
|
|
5
|
+
*
|
|
6
|
+
* It forwards the given request unchanged through the gatherer and returns the first
|
|
7
|
+
* non-null response collected from the registered AI provider instance (for example the
|
|
8
|
+
* ocx-ai-connector-component). If no provider contributes a response, an error is thrown.
|
|
9
|
+
*/
|
|
10
|
+
export declare class OneCXAiCompletionService {
|
|
11
|
+
private readonly logger;
|
|
12
|
+
private readonly aiCompletionGatherer;
|
|
13
|
+
getCompletion(request: AiCompletionRequest): Promise<AiCompletionResponse>;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AiCompletionGatherer } from '../gatherers/ai-completion/v1/ai-completion.gatherer';
|
|
2
|
+
import { createLogger } from '../utils/logger.utils';
|
|
3
|
+
export async function consumerAiCompletionProvider(_request) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Thin service wrapper around AiCompletionGatherer that lets consumers inside request AI completions.
|
|
8
|
+
*
|
|
9
|
+
* It forwards the given request unchanged through the gatherer and returns the first
|
|
10
|
+
* non-null response collected from the registered AI provider instance (for example the
|
|
11
|
+
* ocx-ai-connector-component). If no provider contributes a response, an error is thrown.
|
|
12
|
+
*/
|
|
13
|
+
export class OneCXAiCompletionService {
|
|
14
|
+
logger = createLogger('OneCXAiCompletionService');
|
|
15
|
+
aiCompletionGatherer = new AiCompletionGatherer(consumerAiCompletionProvider);
|
|
16
|
+
async getCompletion(request) {
|
|
17
|
+
this.logger.debug('getCompletion', request);
|
|
18
|
+
const responses = await this.aiCompletionGatherer.gather(request);
|
|
19
|
+
const response = responses.find((r) => r !== null);
|
|
20
|
+
if (!response) {
|
|
21
|
+
throw new Error('No AI provider responded to the completion request');
|
|
22
|
+
}
|
|
23
|
+
this.logger.debug('getCompletion resolved', response);
|
|
24
|
+
return response;
|
|
25
|
+
}
|
|
26
|
+
destroy() {
|
|
27
|
+
this.aiCompletionGatherer.destroy();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ai-completion.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-completion.service.js","sourceRoot":"","sources":["../../../../../../libs/integration-interface/src/lib/services/ai-completion.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAA;AAE3F,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,QAA6B;IAE7B,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,wBAAwB;IAClB,MAAM,GAAG,YAAY,CAAC,0BAA0B,CAAC,CAAA;IAEjD,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,4BAA4B,CAAC,CAAA;IAE9F,KAAK,CAAC,aAAa,CAAC,OAA4B;QAC9C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;QAC3C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACjE,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAA;QAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QACvE,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAA;QACrD,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAA;IACrC,CAAC;CACF"}
|
package/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const LIB_NAME = "@onecx/integration-interface";
|
|
2
|
-
export declare const LIB_VERSION = "8.
|
|
2
|
+
export declare const LIB_VERSION = "8.14.0";
|
package/src/version.js
CHANGED