@onecx/integration-interface 6.29.1 → 6.30.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.29.1",
3
+ "version": "6.30.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.29.1",
13
- "@onecx/nx-migration-utils": "^6.29.1",
12
+ "@onecx/accelerator": "^6.30.0",
13
+ "@onecx/nx-migration-utils": "^6.30.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
@@ -46,3 +46,6 @@ 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
48
  export * from './lib/services/ai-completion.service';
49
+ export * from './lib/gatherers/ai-agent/v1/ai-agent.model';
50
+ export * from './lib/gatherers/ai-agent/v1/ai-agent.gatherer';
51
+ export * from './lib/services/ai-agent.service';
package/src/index.js CHANGED
@@ -49,4 +49,7 @@ tslib_1.__exportStar(require("./lib/gatherers/ai-context/v1/ai-context.gatherer"
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
51
  tslib_1.__exportStar(require("./lib/services/ai-completion.service"), exports);
52
+ tslib_1.__exportStar(require("./lib/gatherers/ai-agent/v1/ai-agent.model"), exports);
53
+ tslib_1.__exportStar(require("./lib/gatherers/ai-agent/v1/ai-agent.gatherer"), exports);
54
+ tslib_1.__exportStar(require("./lib/services/ai-agent.service"), exports);
52
55
  //# 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;AAEvE,+EAAoD"}
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;AAEpD,qFAA0D;AAC1D,wFAA6D;AAC7D,0EAA+C"}
@@ -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,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AiAgentGatherer = void 0;
4
+ const accelerator_1 = require("@onecx/accelerator");
5
+ /**
6
+ * This class lets consumers gather the AI agents that are available to them.
7
+ * Each provider (for example the AI Provider remote component) registers a callback and answers
8
+ * with its agents, or with null if it does not want to contribute to the request.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ *
13
+ * // in the provider (remote component), answer agent requests
14
+ * // in ngOnDestroy, call the gatherer.destroy() method to clean up resources
15
+ *
16
+ * const aiAgentGatherer = new AiAgentGatherer(async (request) => {
17
+ * // return the agents visible for request.appId, or null if you do not want to contribute
18
+ * return [{ id: 'agent-1', name: 'Agent' }]
19
+ * });
20
+ * ```
21
+ */
22
+ class AiAgentGatherer extends accelerator_1.Gatherer {
23
+ constructor(callback) {
24
+ super("aiAgent", 1, callback);
25
+ }
26
+ }
27
+ exports.AiAgentGatherer = AiAgentGatherer;
28
+ //# 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,oDAA6C;AAI7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,eAAgB,SAAQ,sBAAkD;IACnF,YAAY,QAAwE;QAChF,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;IACjC,CAAC;CACJ;AAJD,0CAIC"}
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# 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,14 @@
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 aiAgentGatherer;
12
+ getAgents(request?: AiAgentRequest): Promise<AiAgentResponse[]>;
13
+ destroy(): void;
14
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OneCXAiAgentService = void 0;
4
+ exports.consumerAiAgentProvider = consumerAiAgentProvider;
5
+ const ai_agent_gatherer_1 = require("../gatherers/ai-agent/v1/ai-agent.gatherer");
6
+ function consumerAiAgentProvider(_request) {
7
+ return Promise.resolve(null);
8
+ }
9
+ /**
10
+ * Thin service wrapper around AiAgentGatherer that lets consumers collect the available AI agents.
11
+ *
12
+ * It forwards the request unchanged through the gatherer and merges the agent lists returned by all
13
+ * providers. Agents are de-duplicated by id, keeping the first occurrence. If no provider contributes,
14
+ * an empty list is returned.
15
+ */
16
+ class OneCXAiAgentService {
17
+ aiAgentGatherer = new ai_agent_gatherer_1.AiAgentGatherer(consumerAiAgentProvider);
18
+ async getAgents(request = {}) {
19
+ const responses = await this.aiAgentGatherer.gather(request);
20
+ const agents = new Map();
21
+ for (const providerAgents of responses) {
22
+ for (const agent of providerAgents ?? []) {
23
+ if (!agents.has(agent.id)) {
24
+ agents.set(agent.id, agent);
25
+ }
26
+ }
27
+ }
28
+ return [...agents.values()];
29
+ }
30
+ destroy() {
31
+ this.aiAgentGatherer.destroy();
32
+ }
33
+ }
34
+ exports.OneCXAiAgentService = OneCXAiAgentService;
35
+ //# 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":";;;AAGA,0DAEC;AALD,kFAA4E;AAG5E,SAAgB,uBAAuB,CAAC,QAAwB;IAC9D,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC;AAED;;;;;;GAMG;AACH,MAAa,mBAAmB;IACb,eAAe,GAAG,IAAI,mCAAe,CAAC,uBAAuB,CAAC,CAAA;IAE/E,KAAK,CAAC,SAAS,CAAC,UAA0B,EAAE;QAC1C,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,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED,OAAO;QACL,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAA;IAChC,CAAC;CACF;AAnBD,kDAmBC"}