@onecx/integration-interface 9.0.0-rc.9 → 9.1.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.
Files changed (35) hide show
  1. package/dist/index.cjs +156 -2
  2. package/dist/index.mjs +156 -2
  3. package/package.json +2 -2
  4. package/src/index.d.ts +8 -0
  5. package/src/index.js +8 -0
  6. package/src/index.js.map +1 -1
  7. package/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.d.ts +22 -0
  8. package/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.js +24 -0
  9. package/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.js.map +1 -0
  10. package/src/lib/gatherers/ai-agent/v1/ai-agent.model.d.ts +14 -0
  11. package/src/lib/gatherers/ai-agent/v1/ai-agent.model.js +1 -0
  12. package/src/lib/gatherers/ai-agent/v1/ai-agent.model.js.map +1 -0
  13. package/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.d.ts +28 -0
  14. package/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.js +30 -0
  15. package/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.js.map +1 -0
  16. package/src/lib/gatherers/ai-completion/v1/ai-completion.model.d.ts +12 -0
  17. package/src/lib/gatherers/ai-completion/v1/ai-completion.model.js +1 -0
  18. package/src/lib/gatherers/ai-completion/v1/ai-completion.model.js.map +1 -0
  19. package/src/lib/gatherers/ai-context/v1/ai-context.gatherer.d.ts +22 -0
  20. package/src/lib/gatherers/ai-context/v1/ai-context.gatherer.js +24 -0
  21. package/src/lib/gatherers/ai-context/v1/ai-context.gatherer.js.map +1 -0
  22. package/src/lib/gatherers/ai-context/v1/ai-context.model.d.ts +11 -0
  23. package/src/lib/gatherers/ai-context/v1/ai-context.model.js +1 -0
  24. package/src/lib/gatherers/ai-context/v1/ai-context.model.js.map +1 -0
  25. package/src/lib/services/ai-agent.service.d.ts +15 -0
  26. package/src/lib/services/ai-agent.service.js +39 -0
  27. package/src/lib/services/ai-agent.service.js.map +1 -0
  28. package/src/lib/services/ai-completion.service.d.ts +15 -0
  29. package/src/lib/services/ai-completion.service.js +30 -0
  30. package/src/lib/services/ai-completion.service.js.map +1 -0
  31. package/src/lib/topics/current-theme/v1/theme-override.model.d.ts +1 -1
  32. package/src/lib/topics/current-theme/v1/theme-override.model.js +1 -1
  33. package/src/version.d.ts +1 -1
  34. package/src/version.js +1 -1
  35. package/src/version.js.map +1 -1
package/dist/index.cjs CHANGED
@@ -30,6 +30,9 @@ 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,
34
+ AiCompletionGatherer: () => AiCompletionGatherer,
35
+ AiContextGatherer: () => AiContextGatherer,
33
36
  ConfigurationTopic: () => ConfigurationTopic,
34
37
  CurrentLocationTopic: () => CurrentLocationTopic,
35
38
  CurrentMfeTopic: () => CurrentMfeTopic,
@@ -51,6 +54,8 @@ __export(index_exports, {
51
54
  MessageTopic: () => MessageTopic,
52
55
  NotificationService: () => NotificationService,
53
56
  NotificationTopic: () => NotificationTopic,
57
+ OneCXAiAgentService: () => OneCXAiAgentService,
58
+ OneCXAiCompletionService: () => OneCXAiCompletionService,
54
59
  OverrideType: () => OverrideType,
55
60
  ParametersTopic: () => ParametersTopic,
56
61
  PermissionsRpcTopic: () => PermissionsRpcTopic,
@@ -68,6 +73,8 @@ __export(index_exports, {
68
73
  constructBaseUrlFromWorkspace: () => constructBaseUrlFromWorkspace,
69
74
  constructEndpointUrl: () => constructEndpointUrl,
70
75
  constructRouteUrl: () => constructRouteUrl,
76
+ consumerAiAgentProvider: () => consumerAiAgentProvider,
77
+ consumerAiCompletionProvider: () => consumerAiCompletionProvider,
71
78
  determineBrowserLanguage: () => determineBrowserLanguage,
72
79
  dissolveEndpoint: () => dissolveEndpoint,
73
80
  doesUrlExistForWorkspace: () => doesUrlExistForWorkspace,
@@ -115,7 +122,8 @@ function ensureProperty(obj, path, initialValue) {
115
122
 
116
123
  // libs/accelerator/src/lib/declarations.ts
117
124
  var gatherPromises = ensureProperty(globalThis, ["@onecx/accelerator", "gatherer", "promises"], {});
118
- var topicUseBroadcastChannel = ensureProperty(gatherPromises, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
125
+ var gatherId = ensureProperty(gatherPromises, ["@onecx/accelerator", "gatherer", "id"], 0);
126
+ var topicUseBroadcastChannel = ensureProperty(gatherId, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
119
127
  var topicInitDate = ensureProperty(topicUseBroadcastChannel, ["@onecx/accelerator", "topic", "initDate"], Date.now());
120
128
  var topicTabId = ensureProperty(topicInitDate, ["@onecx/accelerator", "topic", "tabId"], Math.ceil(globalThis.performance?.now?.() ?? 0));
121
129
 
@@ -463,6 +471,79 @@ var Topic = class extends TopicPublisher {
463
471
  // libs/accelerator/src/lib/topic/mocks/fake-topic.ts
464
472
  var import_rxjs2 = require("rxjs");
465
473
 
474
+ // libs/accelerator/src/lib/utils/gatherer.ts
475
+ var Gatherer = class {
476
+ logger;
477
+ topic;
478
+ ownIds = /* @__PURE__ */ new Set();
479
+ topicSub = null;
480
+ topicName;
481
+ constructor(name, version, callback) {
482
+ this.topicName = name;
483
+ this.logger = createLogger(`Gatherer:${name}`);
484
+ this.logger.debug(`Gatherer ${name}: ${version} created`);
485
+ this.topic = new Topic(name, version, false);
486
+ this.topicSub = this.topic.subscribe((m) => {
487
+ if (!this.isOwnerOfRequest(m) && topicTabId["@onecx/accelerator"].gatherer.promises) {
488
+ this.logReceivedIfDebug(name, version, m);
489
+ if (!topicTabId["@onecx/accelerator"].gatherer.promises[m.id]) {
490
+ this.logger.warn("Expected an array of promises to gather for id ", m.id, " but the id was not present");
491
+ return;
492
+ }
493
+ let resolve;
494
+ topicTabId["@onecx/accelerator"].gatherer.promises[m.id].push(
495
+ new Promise((r) => {
496
+ resolve = r;
497
+ })
498
+ );
499
+ callback(m.request).then((response) => {
500
+ resolve(response);
501
+ this.logAnsweredIfDebug(name, version, m, response);
502
+ });
503
+ }
504
+ });
505
+ }
506
+ destroy() {
507
+ this.logger.debug(`Gatherer ${this.topic.name}: ${this.topic.version} destroyed`);
508
+ this.topicSub?.unsubscribe();
509
+ this.topic.destroy();
510
+ for (const id of this.ownIds) {
511
+ if (topicTabId["@onecx/accelerator"].gatherer.promises?.[id]) {
512
+ delete topicTabId["@onecx/accelerator"].gatherer.promises[id];
513
+ }
514
+ }
515
+ }
516
+ async gather(request) {
517
+ if (!topicTabId["@onecx/accelerator"].gatherer?.promises) {
518
+ throw new Error("Gatherer is not initialized");
519
+ }
520
+ const id = topicTabId["@onecx/accelerator"].gatherer.id++;
521
+ this.ownIds.add(id);
522
+ topicTabId["@onecx/accelerator"].gatherer.promises[id] = [];
523
+ const message = { id, request };
524
+ await this.topic.publish(message);
525
+ const promises = topicTabId["@onecx/accelerator"].gatherer.promises[id];
526
+ delete topicTabId["@onecx/accelerator"].gatherer.promises[id];
527
+ this.ownIds.delete(id);
528
+ return Promise.all(promises).then((v) => {
529
+ this.logger.debug("Finished gathering responses", v);
530
+ return v;
531
+ });
532
+ }
533
+ logReceivedIfDebug(name, version, m) {
534
+ this.logger.debug("Gatherer " + name + ": " + version + " received request " + m.request);
535
+ }
536
+ logAnsweredIfDebug(name, version, m, response) {
537
+ this.logger.debug(
538
+ "Gatherer " + name + ": " + version + " answered request " + m.request + " with response",
539
+ response
540
+ );
541
+ }
542
+ isOwnerOfRequest(m) {
543
+ return this.ownIds.has(m.id);
544
+ }
545
+ };
546
+
466
547
  // libs/integration-interface/src/lib/topics/current-mfe/v1/current-mfe.topic.ts
467
548
  var CurrentMfeTopic = class extends Topic {
468
549
  constructor() {
@@ -526,7 +607,7 @@ var CurrentThemeTopic = class extends Topic {
526
607
 
527
608
  // libs/integration-interface/src/lib/topics/current-theme/v1/theme-override.model.ts
528
609
  var OverrideType = /* @__PURE__ */ ((OverrideType2) => {
529
- OverrideType2["PRIMENG"] = "PRIMENG";
610
+ OverrideType2["OPTIMUS"] = "OPTIMUS";
530
611
  OverrideType2["CSS"] = "CSS";
531
612
  return OverrideType2;
532
613
  })(OverrideType || {});
@@ -1361,3 +1442,76 @@ var NotificationService = class {
1361
1442
  this.notificationTopic.destroy();
1362
1443
  }
1363
1444
  };
1445
+
1446
+ // libs/integration-interface/src/lib/gatherers/ai-context/v1/ai-context.gatherer.ts
1447
+ var AiContextGatherer = class extends Gatherer {
1448
+ constructor(callback) {
1449
+ super("aiContext", 1, callback);
1450
+ }
1451
+ };
1452
+
1453
+ // libs/integration-interface/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.ts
1454
+ var AiCompletionGatherer = class extends Gatherer {
1455
+ constructor(callback) {
1456
+ super("aiCompletion", 1, callback);
1457
+ }
1458
+ };
1459
+
1460
+ // libs/integration-interface/src/lib/services/ai-completion.service.ts
1461
+ async function consumerAiCompletionProvider(_request) {
1462
+ return null;
1463
+ }
1464
+ var OneCXAiCompletionService = class {
1465
+ logger = createLogger2("OneCXAiCompletionService");
1466
+ aiCompletionGatherer = new AiCompletionGatherer(consumerAiCompletionProvider);
1467
+ async getCompletion(request) {
1468
+ this.logger.debug("getCompletion", request);
1469
+ const responses = await this.aiCompletionGatherer.gather(request);
1470
+ const response = responses.find((r) => r !== null);
1471
+ if (!response) {
1472
+ throw new Error("No AI provider responded to the completion request");
1473
+ }
1474
+ this.logger.debug("getCompletion resolved", response);
1475
+ return response;
1476
+ }
1477
+ destroy() {
1478
+ this.aiCompletionGatherer.destroy();
1479
+ }
1480
+ };
1481
+
1482
+ // libs/integration-interface/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.ts
1483
+ var AiAgentGatherer = class extends Gatherer {
1484
+ constructor(callback) {
1485
+ super("aiAgent", 1, callback);
1486
+ }
1487
+ };
1488
+
1489
+ // libs/integration-interface/src/lib/services/ai-agent.service.ts
1490
+ function consumerAiAgentProvider(_request) {
1491
+ return Promise.resolve(null);
1492
+ }
1493
+ var OneCXAiAgentService = class {
1494
+ logger = createLogger2("OneCXAiAgentService");
1495
+ aiAgentGatherer = new AiAgentGatherer(consumerAiAgentProvider);
1496
+ async getAgents(request = {}) {
1497
+ this.logger.debug("getAgents", request);
1498
+ const responses = await this.aiAgentGatherer.gather(request);
1499
+ const agents = /* @__PURE__ */ new Map();
1500
+ for (const providerAgents of responses) {
1501
+ for (const agent of providerAgents ?? []) {
1502
+ if (!agents.has(agent.id)) {
1503
+ agents.set(agent.id, agent);
1504
+ }
1505
+ }
1506
+ }
1507
+ if (agents.size === 0) {
1508
+ this.logger.warn("No AI provider returned any agents for the request", request);
1509
+ } else {
1510
+ this.logger.debug("getAgents resolved", agents.size);
1511
+ }
1512
+ return [...agents.values()];
1513
+ }
1514
+ destroy() {
1515
+ this.aiAgentGatherer.destroy();
1516
+ }
1517
+ };
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 topicUseBroadcastChannel = ensureProperty(gatherPromises, ["@onecx/accelerator", "topic", "useBroadcastChannel"], "V2");
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
 
@@ -372,6 +373,79 @@ var Topic = class extends TopicPublisher {
372
373
  // libs/accelerator/src/lib/topic/mocks/fake-topic.ts
373
374
  import { BehaviorSubject as BehaviorSubject2, ReplaySubject } from "rxjs";
374
375
 
376
+ // libs/accelerator/src/lib/utils/gatherer.ts
377
+ var Gatherer = class {
378
+ logger;
379
+ topic;
380
+ ownIds = /* @__PURE__ */ new Set();
381
+ topicSub = null;
382
+ topicName;
383
+ constructor(name, version, callback) {
384
+ this.topicName = name;
385
+ this.logger = createLogger(`Gatherer:${name}`);
386
+ this.logger.debug(`Gatherer ${name}: ${version} created`);
387
+ this.topic = new Topic(name, version, false);
388
+ this.topicSub = this.topic.subscribe((m) => {
389
+ if (!this.isOwnerOfRequest(m) && topicTabId["@onecx/accelerator"].gatherer.promises) {
390
+ this.logReceivedIfDebug(name, version, m);
391
+ if (!topicTabId["@onecx/accelerator"].gatherer.promises[m.id]) {
392
+ this.logger.warn("Expected an array of promises to gather for id ", m.id, " but the id was not present");
393
+ return;
394
+ }
395
+ let resolve;
396
+ topicTabId["@onecx/accelerator"].gatherer.promises[m.id].push(
397
+ new Promise((r) => {
398
+ resolve = r;
399
+ })
400
+ );
401
+ callback(m.request).then((response) => {
402
+ resolve(response);
403
+ this.logAnsweredIfDebug(name, version, m, response);
404
+ });
405
+ }
406
+ });
407
+ }
408
+ destroy() {
409
+ this.logger.debug(`Gatherer ${this.topic.name}: ${this.topic.version} destroyed`);
410
+ this.topicSub?.unsubscribe();
411
+ this.topic.destroy();
412
+ for (const id of this.ownIds) {
413
+ if (topicTabId["@onecx/accelerator"].gatherer.promises?.[id]) {
414
+ delete topicTabId["@onecx/accelerator"].gatherer.promises[id];
415
+ }
416
+ }
417
+ }
418
+ async gather(request) {
419
+ if (!topicTabId["@onecx/accelerator"].gatherer?.promises) {
420
+ throw new Error("Gatherer is not initialized");
421
+ }
422
+ const id = topicTabId["@onecx/accelerator"].gatherer.id++;
423
+ this.ownIds.add(id);
424
+ topicTabId["@onecx/accelerator"].gatherer.promises[id] = [];
425
+ const message = { id, request };
426
+ await this.topic.publish(message);
427
+ const promises = topicTabId["@onecx/accelerator"].gatherer.promises[id];
428
+ delete topicTabId["@onecx/accelerator"].gatherer.promises[id];
429
+ this.ownIds.delete(id);
430
+ return Promise.all(promises).then((v) => {
431
+ this.logger.debug("Finished gathering responses", v);
432
+ return v;
433
+ });
434
+ }
435
+ logReceivedIfDebug(name, version, m) {
436
+ this.logger.debug("Gatherer " + name + ": " + version + " received request " + m.request);
437
+ }
438
+ logAnsweredIfDebug(name, version, m, response) {
439
+ this.logger.debug(
440
+ "Gatherer " + name + ": " + version + " answered request " + m.request + " with response",
441
+ response
442
+ );
443
+ }
444
+ isOwnerOfRequest(m) {
445
+ return this.ownIds.has(m.id);
446
+ }
447
+ };
448
+
375
449
  // libs/integration-interface/src/lib/topics/current-mfe/v1/current-mfe.topic.ts
376
450
  var CurrentMfeTopic = class extends Topic {
377
451
  constructor() {
@@ -435,7 +509,7 @@ var CurrentThemeTopic = class extends Topic {
435
509
 
436
510
  // libs/integration-interface/src/lib/topics/current-theme/v1/theme-override.model.ts
437
511
  var OverrideType = /* @__PURE__ */ ((OverrideType2) => {
438
- OverrideType2["PRIMENG"] = "PRIMENG";
512
+ OverrideType2["OPTIMUS"] = "OPTIMUS";
439
513
  OverrideType2["CSS"] = "CSS";
440
514
  return OverrideType2;
441
515
  })(OverrideType || {});
@@ -1270,7 +1344,83 @@ var NotificationService = class {
1270
1344
  this.notificationTopic.destroy();
1271
1345
  }
1272
1346
  };
1347
+
1348
+ // libs/integration-interface/src/lib/gatherers/ai-context/v1/ai-context.gatherer.ts
1349
+ var AiContextGatherer = class extends Gatherer {
1350
+ constructor(callback) {
1351
+ super("aiContext", 1, callback);
1352
+ }
1353
+ };
1354
+
1355
+ // libs/integration-interface/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.ts
1356
+ var AiCompletionGatherer = class extends Gatherer {
1357
+ constructor(callback) {
1358
+ super("aiCompletion", 1, callback);
1359
+ }
1360
+ };
1361
+
1362
+ // libs/integration-interface/src/lib/services/ai-completion.service.ts
1363
+ async function consumerAiCompletionProvider(_request) {
1364
+ return null;
1365
+ }
1366
+ var OneCXAiCompletionService = class {
1367
+ logger = createLogger2("OneCXAiCompletionService");
1368
+ aiCompletionGatherer = new AiCompletionGatherer(consumerAiCompletionProvider);
1369
+ async getCompletion(request) {
1370
+ this.logger.debug("getCompletion", request);
1371
+ const responses = await this.aiCompletionGatherer.gather(request);
1372
+ const response = responses.find((r) => r !== null);
1373
+ if (!response) {
1374
+ throw new Error("No AI provider responded to the completion request");
1375
+ }
1376
+ this.logger.debug("getCompletion resolved", response);
1377
+ return response;
1378
+ }
1379
+ destroy() {
1380
+ this.aiCompletionGatherer.destroy();
1381
+ }
1382
+ };
1383
+
1384
+ // libs/integration-interface/src/lib/gatherers/ai-agent/v1/ai-agent.gatherer.ts
1385
+ var AiAgentGatherer = class extends Gatherer {
1386
+ constructor(callback) {
1387
+ super("aiAgent", 1, callback);
1388
+ }
1389
+ };
1390
+
1391
+ // libs/integration-interface/src/lib/services/ai-agent.service.ts
1392
+ function consumerAiAgentProvider(_request) {
1393
+ return Promise.resolve(null);
1394
+ }
1395
+ var OneCXAiAgentService = class {
1396
+ logger = createLogger2("OneCXAiAgentService");
1397
+ aiAgentGatherer = new AiAgentGatherer(consumerAiAgentProvider);
1398
+ async getAgents(request = {}) {
1399
+ this.logger.debug("getAgents", request);
1400
+ const responses = await this.aiAgentGatherer.gather(request);
1401
+ const agents = /* @__PURE__ */ new Map();
1402
+ for (const providerAgents of responses) {
1403
+ for (const agent of providerAgents ?? []) {
1404
+ if (!agents.has(agent.id)) {
1405
+ agents.set(agent.id, agent);
1406
+ }
1407
+ }
1408
+ }
1409
+ if (agents.size === 0) {
1410
+ this.logger.warn("No AI provider returned any agents for the request", request);
1411
+ } else {
1412
+ this.logger.debug("getAgents resolved", agents.size);
1413
+ }
1414
+ return [...agents.values()];
1415
+ }
1416
+ destroy() {
1417
+ this.aiAgentGatherer.destroy();
1418
+ }
1419
+ };
1273
1420
  export {
1421
+ AiAgentGatherer,
1422
+ AiCompletionGatherer,
1423
+ AiContextGatherer,
1274
1424
  ConfigurationTopic,
1275
1425
  CurrentLocationTopic,
1276
1426
  CurrentMfeTopic,
@@ -1292,6 +1442,8 @@ export {
1292
1442
  MessageTopic,
1293
1443
  NotificationService,
1294
1444
  NotificationTopic,
1445
+ OneCXAiAgentService,
1446
+ OneCXAiCompletionService,
1295
1447
  OverrideType,
1296
1448
  ParametersTopic,
1297
1449
  PermissionsRpcTopic,
@@ -1309,6 +1461,8 @@ export {
1309
1461
  constructBaseUrlFromWorkspace,
1310
1462
  constructEndpointUrl,
1311
1463
  constructRouteUrl,
1464
+ consumerAiAgentProvider,
1465
+ consumerAiCompletionProvider,
1312
1466
  determineBrowserLanguage,
1313
1467
  dissolveEndpoint,
1314
1468
  doesUrlExistForWorkspace,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onecx/integration-interface",
3
- "version": "9.0.0-rc.9",
3
+ "version": "9.1.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": "^9.0.0-rc.9"
11
+ "@onecx/accelerator": "9.1.0"
12
12
  },
13
13
  "type": "module",
14
14
  "dependencies": {
package/src/index.d.ts CHANGED
@@ -59,3 +59,11 @@ export * from './lib/utils/portal-message.utils';
59
59
  export * from './lib/topics/notification/v1/notification.model';
60
60
  export * from './lib/topics/notification/v1/notification.topic';
61
61
  export * from './lib/services/notification.service';
62
+ export * from './lib/gatherers/ai-context/v1/ai-context.model';
63
+ export * from './lib/gatherers/ai-context/v1/ai-context.gatherer';
64
+ export * from './lib/gatherers/ai-completion/v1/ai-completion.model';
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
@@ -59,4 +59,12 @@ export * from './lib/utils/portal-message.utils';
59
59
  export * from './lib/topics/notification/v1/notification.model';
60
60
  export * from './lib/topics/notification/v1/notification.topic';
61
61
  export * from './lib/services/notification.service';
62
+ export * from './lib/gatherers/ai-context/v1/ai-context.model';
63
+ export * from './lib/gatherers/ai-context/v1/ai-context.gatherer';
64
+ export * from './lib/gatherers/ai-completion/v1/ai-completion.model';
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';
62
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;AAEnE,cAAc,mDAAmD,CAAA;AACjE,cAAc,2CAA2C,CAAA;AACzD,cAAc,oDAAoD,CAAA;AAElE,cAAc,iDAAiD,CAAA;AAC/D,cAAc,iDAAiD,CAAA;AAE/D,cAAc,mDAAmD,CAAA;AAEjE,cAAc,2DAA2D,CAAA;AACzE,cAAc,iEAAiE,CAAA;AAC/E,cAAc,mDAAmD,CAAA;AACjE,cAAc,+CAA+C,CAAA;AAC7D,cAAc,kDAAkD,CAAA;AAEhE,cAAc,wDAAwD,CAAA;AAEtE,cAAc,uCAAuC,CAAA;AACrD,cAAc,uCAAuC,CAAA;AAErD,cAAc,0DAA0D,CAAA;AACxE,cAAc,gEAAgE,CAAA;AAC9E,cAAc,8CAA8C,CAAA;AAC5D,cAAc,2DAA2D,CAAA;AAEzE,cAAc,+CAA+C,CAAA;AAE7D,cAAc,uDAAuD,CAAA;AACrE,cAAc,uDAAuD,CAAA;AAErE,cAAc,qCAAqC,CAAA;AACnD,cAAc,yCAAyC,CAAA;AACvD,cAAc,mCAAmC,CAAA;AACjD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,gDAAgD,CAAA;AAE9D,cAAc,mDAAmD,CAAA;AACjE,cAAc,qDAAqD,CAAA;AACnE,cAAc,8DAA8D,CAAA;AAC5E,cAAc,yDAAyD,CAAA;AACvE,cAAc,mDAAmD,CAAA;AACjE,cAAc,yDAAyD,CAAA;AAEvE,cAAc,yDAAyD,CAAA;AACvE,cAAc,yDAAyD,CAAA;AAEvE,cAAc,6CAA6C,CAAA;AAE3D,cAAc,qDAAqD,CAAA;AAEnE,cAAc,sDAAsD,CAAA;AACpE,cAAc,sDAAsD,CAAA;AACpE,cAAc,yCAAyC,CAAA;AAEvD,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iEAAiE,CAAA;AAC/E,cAAc,iEAAiE,CAAA;AAE/E,cAAc,4CAA4C,CAAA;AAE1D,cAAc,qCAAqC,CAAA;AACnD,cAAc,oCAAoC,CAAA;AAClD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAEhD,cAAc,iDAAiD,CAAA;AAC/D,cAAc,iDAAiD,CAAA;AAC/D,cAAc,qCAAqC,CAAA"}
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;AAEnE,cAAc,mDAAmD,CAAA;AACjE,cAAc,2CAA2C,CAAA;AACzD,cAAc,oDAAoD,CAAA;AAElE,cAAc,iDAAiD,CAAA;AAC/D,cAAc,iDAAiD,CAAA;AAE/D,cAAc,mDAAmD,CAAA;AAEjE,cAAc,2DAA2D,CAAA;AACzE,cAAc,iEAAiE,CAAA;AAC/E,cAAc,mDAAmD,CAAA;AACjE,cAAc,+CAA+C,CAAA;AAC7D,cAAc,kDAAkD,CAAA;AAEhE,cAAc,wDAAwD,CAAA;AAEtE,cAAc,uCAAuC,CAAA;AACrD,cAAc,uCAAuC,CAAA;AAErD,cAAc,0DAA0D,CAAA;AACxE,cAAc,gEAAgE,CAAA;AAC9E,cAAc,8CAA8C,CAAA;AAC5D,cAAc,2DAA2D,CAAA;AAEzE,cAAc,+CAA+C,CAAA;AAE7D,cAAc,uDAAuD,CAAA;AACrE,cAAc,uDAAuD,CAAA;AAErE,cAAc,qCAAqC,CAAA;AACnD,cAAc,yCAAyC,CAAA;AACvD,cAAc,mCAAmC,CAAA;AACjD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,gDAAgD,CAAA;AAE9D,cAAc,mDAAmD,CAAA;AACjE,cAAc,qDAAqD,CAAA;AACnE,cAAc,8DAA8D,CAAA;AAC5E,cAAc,yDAAyD,CAAA;AACvE,cAAc,mDAAmD,CAAA;AACjE,cAAc,yDAAyD,CAAA;AAEvE,cAAc,yDAAyD,CAAA;AACvE,cAAc,yDAAyD,CAAA;AAEvE,cAAc,6CAA6C,CAAA;AAE3D,cAAc,qDAAqD,CAAA;AAEnE,cAAc,sDAAsD,CAAA;AACpE,cAAc,sDAAsD,CAAA;AACpE,cAAc,yCAAyC,CAAA;AAEvD,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iEAAiE,CAAA;AAC/E,cAAc,iEAAiE,CAAA;AAE/E,cAAc,4CAA4C,CAAA;AAE1D,cAAc,qCAAqC,CAAA;AACnD,cAAc,oCAAoC,CAAA;AAClD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAEhD,cAAc,iDAAiD,CAAA;AAC/D,cAAc,iDAAiD,CAAA;AAC/D,cAAc,qCAAqC,CAAA;AAEnD,cAAc,gDAAgD,CAAA;AAC9D,cAAc,mDAAmD,CAAA;AACjE,cAAc,sDAAsD,CAAA;AACpE,cAAc,yDAAyD,CAAA;AAEvE,cAAc,sCAAsC,CAAA;AAEpD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,+CAA+C,CAAA;AAC7D,cAAc,iCAAiC,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { Gatherer } from "@onecx/accelerator";
2
+ import type { AiAgentRequest, AiAgentResponse } from "./ai-agent.model";
3
+ /**
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,28 @@
1
+ import { Gatherer } from "@onecx/accelerator";
2
+ import type { AiCompletionRequest, AiCompletionResponse } from "./ai-completion.model";
3
+ /**
4
+ * This class acts as a thin communication layer for AI completions between consumers inside
5
+ * onecx-portal-ui-libs and the AI Provider Remote Component. It publishes AI completion requests,
6
+ * collects responses from the registered provider instance and returns them to the caller.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ *
11
+ * // create the gatherer in the provider (remote component) so it can answer completion requests
12
+ * // in ngOnDestroy, call the gatherer.destroy() method to clean up resources
13
+ *
14
+ * const aiCompletionGatherer = new AiCompletionGatherer(async (request) => {
15
+ * // request the AI provider BFF with request.agent / request.message / ...
16
+ * // and return the response: { message: string }
17
+ * // return null if you do not want to contribute to this request
18
+ * return { message: "..." }
19
+ * });
20
+ *
21
+ * // on the consumer side, publish the request and get the responses back:
22
+ * const responses = await aiCompletionGatherer.gather(request)
23
+ * // responses is an array of (AiCompletionResponse | null)
24
+ * ```
25
+ */
26
+ export declare class AiCompletionGatherer extends Gatherer<AiCompletionRequest, AiCompletionResponse | null> {
27
+ constructor(callback: (request: AiCompletionRequest) => Promise<AiCompletionResponse | null>);
28
+ }
@@ -0,0 +1,30 @@
1
+ import { Gatherer } from "@onecx/accelerator";
2
+ /**
3
+ * This class acts as a thin communication layer for AI completions between consumers inside
4
+ * onecx-portal-ui-libs and the AI Provider Remote Component. It publishes AI completion requests,
5
+ * collects responses from the registered provider instance and returns them to the caller.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ *
10
+ * // create the gatherer in the provider (remote component) so it can answer completion requests
11
+ * // in ngOnDestroy, call the gatherer.destroy() method to clean up resources
12
+ *
13
+ * const aiCompletionGatherer = new AiCompletionGatherer(async (request) => {
14
+ * // request the AI provider BFF with request.agent / request.message / ...
15
+ * // and return the response: { message: string }
16
+ * // return null if you do not want to contribute to this request
17
+ * return { message: "..." }
18
+ * });
19
+ *
20
+ * // on the consumer side, publish the request and get the responses back:
21
+ * const responses = await aiCompletionGatherer.gather(request)
22
+ * // responses is an array of (AiCompletionResponse | null)
23
+ * ```
24
+ */
25
+ export class AiCompletionGatherer extends Gatherer {
26
+ constructor(callback) {
27
+ super("aiCompletion", 1, callback);
28
+ }
29
+ }
30
+ //# sourceMappingURL=ai-completion.gatherer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-completion.gatherer.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAI7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,oBAAqB,SAAQ,QAA0D;IAChG,YAAY,QAAgF;QACxF,KAAK,CAAC,cAAc,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;IACtC,CAAC;CACJ"}
@@ -0,0 +1,12 @@
1
+ export interface AiCompletionRequest {
2
+ agent: {
3
+ id: string;
4
+ name: string;
5
+ };
6
+ aiContext: string[];
7
+ message: string;
8
+ systemPrompt: string;
9
+ }
10
+ export interface AiCompletionResponse {
11
+ message: string;
12
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ai-completion.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-completion.model.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/gatherers/ai-completion/v1/ai-completion.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { Gatherer } from "@onecx/accelerator";
2
+ import type { AiContextRequest, AiContextResponse } from "./ai-context.model";
3
+ /**
4
+ * This class can be used to provide a context for AI-specific features.
5
+ * It allows gathering information about all applications, products, and contexts in which the AI is being used.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ *
10
+ * // add a gatherer to the constructor of the page component that should provide AI context information
11
+ * // in ngOnDestroy, call the gatherer.destroy() method to clean up resources
12
+ *
13
+ * const aiContextGatherer = new AiContextGatherer(async (request) => {
14
+ * // decide if your app whats to contribute to the AI context or not
15
+ * // if you do not want to contribute, return null
16
+ * // if you want to contribute, return an AiContextResponse object
17
+ * });
18
+ * ```
19
+ */
20
+ export declare class AiContextGatherer extends Gatherer<AiContextRequest, AiContextResponse | null> {
21
+ constructor(callback: (request: AiContextRequest) => Promise<AiContextResponse | null>);
22
+ }
@@ -0,0 +1,24 @@
1
+ import { Gatherer } from "@onecx/accelerator";
2
+ /**
3
+ * This class can be used to provide a context for AI-specific features.
4
+ * It allows gathering information about all applications, products, and contexts in which the AI is being used.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ *
9
+ * // add a gatherer to the constructor of the page component that should provide AI context information
10
+ * // in ngOnDestroy, call the gatherer.destroy() method to clean up resources
11
+ *
12
+ * const aiContextGatherer = new AiContextGatherer(async (request) => {
13
+ * // decide if your app whats to contribute to the AI context or not
14
+ * // if you do not want to contribute, return null
15
+ * // if you want to contribute, return an AiContextResponse object
16
+ * });
17
+ * ```
18
+ */
19
+ export class AiContextGatherer extends Gatherer {
20
+ constructor(callback) {
21
+ super("aiContext", 1, callback);
22
+ }
23
+ }
24
+ //# sourceMappingURL=ai-context.gatherer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-context.gatherer.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/gatherers/ai-context/v1/ai-context.gatherer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAI7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,iBAAkB,SAAQ,QAAoD;IAEvF,YAAY,QAA0E;QAClF,KAAK,CAAC,WAAW,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;IACnC,CAAC;CACJ"}
@@ -0,0 +1,11 @@
1
+ export interface AiContextRequest {
2
+ agent: {
3
+ name: string;
4
+ };
5
+ }
6
+ export interface AiContextResponse {
7
+ productName: string;
8
+ appId: string;
9
+ appPath: string;
10
+ context: string;
11
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ai-context.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-context.model.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/gatherers/ai-context/v1/ai-context.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"}
@@ -1,5 +1,5 @@
1
1
  export declare enum OverrideType {
2
- PRIMENG = "PRIMENG",
2
+ OPTIMUS = "OPTIMUS",
3
3
  CSS = "CSS"
4
4
  }
5
5
  export interface ThemeOverride {
@@ -1,6 +1,6 @@
1
1
  export var OverrideType;
2
2
  (function (OverrideType) {
3
- OverrideType["PRIMENG"] = "PRIMENG";
3
+ OverrideType["OPTIMUS"] = "OPTIMUS";
4
4
  OverrideType["CSS"] = "CSS";
5
5
  })(OverrideType || (OverrideType = {}));
6
6
  //# sourceMappingURL=theme-override.model.js.map
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 = "9.0.0-rc.9";
2
+ export declare const LIB_VERSION = "9.1.0";
package/src/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export const LIB_NAME = '@onecx/integration-interface';
2
- export const LIB_VERSION = '9.0.0-rc.9';
2
+ export const LIB_VERSION = '9.1.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../libs/integration-interface/src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,8BAA8B,CAAA;AACtD,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAA"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../libs/integration-interface/src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,8BAA8B,CAAA;AACtD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAA"}