@onecx/integration-interface 6.28.0 → 6.29.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onecx/integration-interface",
3
- "version": "6.28.0",
3
+ "version": "6.29.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,8 +9,8 @@
9
9
  "peerDependencies": {
10
10
  "tslib": "^2.6.3",
11
11
  "rxjs": "^7.8.1",
12
- "@onecx/accelerator": "^6.28.0",
13
- "@onecx/nx-migration-utils": "^6.28.0",
12
+ "@onecx/accelerator": "^6.29.0",
13
+ "@onecx/nx-migration-utils": "^6.29.0",
14
14
  "@nx/devkit": "^20.3.0",
15
15
  "@phenomnomnominal/tsquery": "^6",
16
16
  "typescript": "^5.5.4"
package/src/index.d.ts CHANGED
@@ -45,3 +45,4 @@ export * from './lib/gatherers/ai-context/v1/ai-context.model';
45
45
  export * from './lib/gatherers/ai-context/v1/ai-context.gatherer';
46
46
  export * from './lib/gatherers/ai-completion/v1/ai-completion.model';
47
47
  export * from './lib/gatherers/ai-completion/v1/ai-completion.gatherer';
48
+ export * from './lib/services/ai-completion.service';
package/src/index.js CHANGED
@@ -48,4 +48,5 @@ tslib_1.__exportStar(require("./lib/gatherers/ai-context/v1/ai-context.model"),
48
48
  tslib_1.__exportStar(require("./lib/gatherers/ai-context/v1/ai-context.gatherer"), exports);
49
49
  tslib_1.__exportStar(require("./lib/gatherers/ai-completion/v1/ai-completion.model"), exports);
50
50
  tslib_1.__exportStar(require("./lib/gatherers/ai-completion/v1/ai-completion.gatherer"), exports);
51
+ tslib_1.__exportStar(require("./lib/services/ai-completion.service"), exports);
51
52
  //# 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,wFAA6D;AAC7D,qFAA0D;AAC1D,0FAA+D;AAC/D,uFAA4D;AAE5D,0FAA+D;AAE/D,8FAAmE;AAEnE,4FAAiE;AACjE,oFAAyD;AACzD,6FAAkE;AAElE,0FAA+D;AAC/D,0FAA+D;AAE/D,4FAAiE;AAEjE,oGAAyE;AACzE,0GAA+E;AAC/E,4FAAiE;AACjE,wFAA6D;AAC7D,2FAAgE;AAEhE,iGAAsE;AAEtE,gFAAqD;AACrD,gFAAqD;AAErD,mGAAwE;AACxE,yGAA8E;AAC9E,uFAA4D;AAC5D,oGAAyE;AAEzE,wFAA6D;AAE7D,gGAAqE;AACrE,gGAAqE;AAErE,8EAAmD;AACnD,kFAAuD;AACvD,sFAA2D;AAC3D,yFAA8D;AAE9D,kGAAuE;AACvE,kGAAuE;AAEvE,sFAA2D;AAE3D,+FAAoE;AACpE,+FAAoE;AACpE,kFAAuD;AAEvD,2EAAgD;AAChD,2EAAgD;AAChD,sEAA2C;AAE3C,0FAA+D;AAC/D,0FAA+D;AAC/D,8EAAmD;AACnD,yFAA8D;AAC9D,4FAAiE;AACjE,+FAAoE;AACpE,kGAAuE"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/integration-interface/src/index.ts"],"names":[],"mappings":";;;AAAA,wFAA6D;AAC7D,qFAA0D;AAC1D,0FAA+D;AAC/D,uFAA4D;AAE5D,0FAA+D;AAE/D,8FAAmE;AAEnE,4FAAiE;AACjE,oFAAyD;AACzD,6FAAkE;AAElE,0FAA+D;AAC/D,0FAA+D;AAE/D,4FAAiE;AAEjE,oGAAyE;AACzE,0GAA+E;AAC/E,4FAAiE;AACjE,wFAA6D;AAC7D,2FAAgE;AAEhE,iGAAsE;AAEtE,gFAAqD;AACrD,gFAAqD;AAErD,mGAAwE;AACxE,yGAA8E;AAC9E,uFAA4D;AAC5D,oGAAyE;AAEzE,wFAA6D;AAE7D,gGAAqE;AACrE,gGAAqE;AAErE,8EAAmD;AACnD,kFAAuD;AACvD,sFAA2D;AAC3D,yFAA8D;AAE9D,kGAAuE;AACvE,kGAAuE;AAEvE,sFAA2D;AAE3D,+FAAoE;AACpE,+FAAoE;AACpE,kFAAuD;AAEvD,2EAAgD;AAChD,2EAAgD;AAChD,sEAA2C;AAE3C,0FAA+D;AAC/D,0FAA+D;AAC/D,8EAAmD;AACnD,yFAA8D;AAC9D,4FAAiE;AACjE,+FAAoE;AACpE,kGAAuE;AAEvE,+EAAoD"}
@@ -0,0 +1,14 @@
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 aiCompletionGatherer;
12
+ getCompletion(request: AiCompletionRequest): Promise<AiCompletionResponse>;
13
+ destroy(): void;
14
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OneCXAiCompletionService = void 0;
4
+ exports.consumerAiCompletionProvider = consumerAiCompletionProvider;
5
+ const ai_completion_gatherer_1 = require("../gatherers/ai-completion/v1/ai-completion.gatherer");
6
+ async function consumerAiCompletionProvider(_request) {
7
+ return null;
8
+ }
9
+ /**
10
+ * Thin service wrapper around AiCompletionGatherer that lets consumers inside request AI completions.
11
+ *
12
+ * It forwards the given request unchanged through the gatherer and returns the first
13
+ * non-null response collected from the registered AI provider instance (for example the
14
+ * ocx-ai-connector-component). If no provider contributes a response, an error is thrown.
15
+ */
16
+ class OneCXAiCompletionService {
17
+ aiCompletionGatherer = new ai_completion_gatherer_1.AiCompletionGatherer(consumerAiCompletionProvider);
18
+ async getCompletion(request) {
19
+ const responses = await this.aiCompletionGatherer.gather(request);
20
+ const response = responses.find((r) => r !== null);
21
+ if (!response) {
22
+ throw new Error('No AI provider responded to the completion request');
23
+ }
24
+ return response;
25
+ }
26
+ destroy() {
27
+ this.aiCompletionGatherer.destroy();
28
+ }
29
+ }
30
+ exports.OneCXAiCompletionService = OneCXAiCompletionService;
31
+ //# 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":";;;AAGA,oEAIC;AAPD,iGAA2F;AAGpF,KAAK,UAAU,4BAA4B,CAChD,QAA6B;IAE7B,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAa,wBAAwB;IAClB,oBAAoB,GAAG,IAAI,6CAAoB,CAAC,4BAA4B,CAAC,CAAA;IAE9F,KAAK,CAAC,aAAa,CAAC,OAA4B;QAC9C,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,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAA;IACrC,CAAC;CACF;AAfD,4DAeC"}