@onecx/integration-interface 8.11.0 → 8.13.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 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
+ AiCompletionGatherer: () => AiCompletionGatherer,
33
34
  AiContextGatherer: () => AiContextGatherer,
34
35
  ConfigurationTopic: () => ConfigurationTopic,
35
36
  CurrentLocationTopic: () => CurrentLocationTopic,
@@ -52,6 +53,7 @@ __export(index_exports, {
52
53
  MessageTopic: () => MessageTopic,
53
54
  NotificationService: () => NotificationService,
54
55
  NotificationTopic: () => NotificationTopic,
56
+ OneCXAiCompletionService: () => OneCXAiCompletionService,
55
57
  OverrideType: () => OverrideType,
56
58
  ParametersTopic: () => ParametersTopic,
57
59
  PermissionsRpcTopic: () => PermissionsRpcTopic,
@@ -69,6 +71,7 @@ __export(index_exports, {
69
71
  constructBaseUrlFromWorkspace: () => constructBaseUrlFromWorkspace,
70
72
  constructEndpointUrl: () => constructEndpointUrl,
71
73
  constructRouteUrl: () => constructRouteUrl,
74
+ consumerAiCompletionProvider: () => consumerAiCompletionProvider,
72
75
  determineBrowserLanguage: () => determineBrowserLanguage,
73
76
  dissolveEndpoint: () => dissolveEndpoint,
74
77
  doesUrlExistForWorkspace: () => doesUrlExistForWorkspace,
@@ -1609,3 +1612,32 @@ var AiContextGatherer = class extends Gatherer {
1609
1612
  super("aiContext", 1, callback);
1610
1613
  }
1611
1614
  };
1615
+
1616
+ // libs/integration-interface/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.ts
1617
+ var AiCompletionGatherer = class extends Gatherer {
1618
+ constructor(callback) {
1619
+ super("aiCompletion", 1, callback);
1620
+ }
1621
+ };
1622
+
1623
+ // libs/integration-interface/src/lib/services/ai-completion.service.ts
1624
+ async function consumerAiCompletionProvider(_request) {
1625
+ return null;
1626
+ }
1627
+ var OneCXAiCompletionService = class {
1628
+ logger = createLogger2("OneCXAiCompletionService");
1629
+ aiCompletionGatherer = new AiCompletionGatherer(consumerAiCompletionProvider);
1630
+ async getCompletion(request) {
1631
+ this.logger.debug("getCompletion", request);
1632
+ const responses = await this.aiCompletionGatherer.gather(request);
1633
+ const response = responses.find((r) => r !== null);
1634
+ if (!response) {
1635
+ throw new Error("No AI provider responded to the completion request");
1636
+ }
1637
+ this.logger.debug("getCompletion resolved", response);
1638
+ return response;
1639
+ }
1640
+ destroy() {
1641
+ this.aiCompletionGatherer.destroy();
1642
+ }
1643
+ };
package/dist/index.mjs CHANGED
@@ -1517,7 +1517,37 @@ var AiContextGatherer = class extends Gatherer {
1517
1517
  super("aiContext", 1, callback);
1518
1518
  }
1519
1519
  };
1520
+
1521
+ // libs/integration-interface/src/lib/gatherers/ai-completion/v1/ai-completion.gatherer.ts
1522
+ var AiCompletionGatherer = class extends Gatherer {
1523
+ constructor(callback) {
1524
+ super("aiCompletion", 1, callback);
1525
+ }
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
+ };
1520
1549
  export {
1550
+ AiCompletionGatherer,
1521
1551
  AiContextGatherer,
1522
1552
  ConfigurationTopic,
1523
1553
  CurrentLocationTopic,
@@ -1540,6 +1570,7 @@ export {
1540
1570
  MessageTopic,
1541
1571
  NotificationService,
1542
1572
  NotificationTopic,
1573
+ OneCXAiCompletionService,
1543
1574
  OverrideType,
1544
1575
  ParametersTopic,
1545
1576
  PermissionsRpcTopic,
@@ -1557,6 +1588,7 @@ export {
1557
1588
  constructBaseUrlFromWorkspace,
1558
1589
  constructEndpointUrl,
1559
1590
  constructRouteUrl,
1591
+ consumerAiCompletionProvider,
1560
1592
  determineBrowserLanguage,
1561
1593
  dissolveEndpoint,
1562
1594
  doesUrlExistForWorkspace,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onecx/integration-interface",
3
- "version": "8.11.0",
3
+ "version": "8.13.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.0"
11
+ "@onecx/accelerator": "8.13.0"
12
12
  },
13
13
  "type": "module",
14
14
  "dependencies": {
package/src/index.d.ts CHANGED
@@ -61,3 +61,6 @@ export * from './lib/topics/notification/v1/notification.topic';
61
61
  export * from './lib/services/notification.service';
62
62
  export * from './lib/gatherers/ai-context/v1/ai-context.model';
63
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';
package/src/index.js CHANGED
@@ -61,4 +61,7 @@ export * from './lib/topics/notification/v1/notification.topic';
61
61
  export * from './lib/services/notification.service';
62
62
  export * from './lib/gatherers/ai-context/v1/ai-context.model';
63
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';
64
67
  //# 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,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,yDAAyD,CAAA;AACvE,cAAc,sCAAsC,CAAA"}
@@ -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,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.11.0";
2
+ export declare const LIB_VERSION = "8.13.0";
package/src/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export const LIB_NAME = '@onecx/integration-interface';
2
- export const LIB_VERSION = '8.11.0';
2
+ export const LIB_VERSION = '8.13.0';
3
3
  //# sourceMappingURL=version.js.map