@botonic/plugin-ai-agents 0.56.0-alpha.0 → 0.57.0-rslib-esm.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 (161) hide show
  1. package/lib/esm/agents/base-agent.d.ts +4 -4
  2. package/lib/esm/agents/base-agent.js +47 -20
  3. package/lib/esm/agents/base-agent.js.map +1 -1
  4. package/lib/esm/agents/index.d.ts +2 -2
  5. package/lib/esm/agents/index.js +8 -7
  6. package/lib/esm/agents/index.js.map +1 -1
  7. package/lib/esm/agents/router-agent.d.ts +5 -5
  8. package/lib/esm/agents/router-agent.js +32 -15
  9. package/lib/esm/agents/router-agent.js.map +1 -1
  10. package/lib/esm/agents/specialist-agent.d.ts +5 -5
  11. package/lib/esm/agents/specialist-agent.js +65 -45
  12. package/lib/esm/agents/specialist-agent.js.map +1 -1
  13. package/lib/esm/bot-config-tools.d.ts +1 -1
  14. package/lib/esm/bot-config-tools.js +15 -13
  15. package/lib/esm/bot-config-tools.js.map +1 -1
  16. package/lib/esm/constants.js +18 -17
  17. package/lib/esm/constants.js.map +1 -1
  18. package/lib/esm/debug-logger.d.ts +1 -1
  19. package/lib/esm/debug-logger.js +14 -9
  20. package/lib/esm/debug-logger.js.map +1 -1
  21. package/lib/esm/guardrails/index.d.ts +1 -1
  22. package/lib/esm/guardrails/index.js +5 -4
  23. package/lib/esm/guardrails/index.js.map +1 -1
  24. package/lib/esm/guardrails/input.d.ts +2 -2
  25. package/lib/esm/guardrails/input.js +65 -42
  26. package/lib/esm/guardrails/input.js.map +1 -1
  27. package/lib/esm/index.d.ts +3 -3
  28. package/lib/esm/index.js +114 -74
  29. package/lib/esm/index.js.map +1 -1
  30. package/lib/esm/llm-config.d.ts +1 -1
  31. package/lib/esm/llm-config.js +81 -52
  32. package/lib/esm/llm-config.js.map +1 -1
  33. package/lib/esm/package.json +3 -0
  34. package/lib/esm/runners/base-runner.d.ts +3 -3
  35. package/lib/esm/runners/base-runner.js +81 -69
  36. package/lib/esm/runners/base-runner.js.map +1 -1
  37. package/lib/esm/runners/index.d.ts +2 -2
  38. package/lib/esm/runners/index.js +8 -7
  39. package/lib/esm/runners/index.js.map +1 -1
  40. package/lib/esm/runners/router-runner.d.ts +2 -2
  41. package/lib/esm/runners/router-runner.js +19 -14
  42. package/lib/esm/runners/router-runner.js.map +1 -1
  43. package/lib/esm/runners/specialist-runner.d.ts +1 -1
  44. package/lib/esm/runners/specialist-runner.js +8 -6
  45. package/lib/esm/runners/specialist-runner.js.map +1 -1
  46. package/lib/esm/services/hubtype-api-client.d.ts +2 -2
  47. package/lib/esm/services/hubtype-api-client.js +110 -95
  48. package/lib/esm/services/hubtype-api-client.js.map +1 -1
  49. package/lib/esm/services/types.d.ts +1 -1
  50. package/lib/esm/services/types.js +9 -9
  51. package/lib/esm/services/types.js.map +1 -1
  52. package/lib/esm/structured-output/bot-executor.js +20 -17
  53. package/lib/esm/structured-output/bot-executor.js.map +1 -1
  54. package/lib/esm/structured-output/carousel.js +25 -22
  55. package/lib/esm/structured-output/carousel.js.map +1 -1
  56. package/lib/esm/structured-output/exit.js +13 -10
  57. package/lib/esm/structured-output/exit.js.map +1 -1
  58. package/lib/esm/structured-output/index.d.ts +0 -10
  59. package/lib/esm/structured-output/index.js +39 -29
  60. package/lib/esm/structured-output/index.js.map +1 -1
  61. package/lib/esm/structured-output/text-with-buttons.js +24 -23
  62. package/lib/esm/structured-output/text-with-buttons.js.map +1 -1
  63. package/lib/esm/structured-output/text.js +16 -13
  64. package/lib/esm/structured-output/text.js.map +1 -1
  65. package/lib/esm/tools/index.d.ts +2 -2
  66. package/lib/esm/tools/index.js +7 -7
  67. package/lib/esm/tools/index.js.map +1 -1
  68. package/lib/esm/tools/retrieve-knowledge.d.ts +2 -2
  69. package/lib/esm/tools/retrieve-knowledge.js +38 -32
  70. package/lib/esm/tools/retrieve-knowledge.js.map +1 -1
  71. package/lib/esm/types.d.ts +3 -3
  72. package/lib/esm/types.js +4 -2
  73. package/lib/esm/types.js.map +1 -1
  74. package/package.json +8 -7
  75. package/src/structured-output/index.ts +0 -2
  76. package/src/types.ts +4 -4
  77. package/lib/cjs/agents/base-agent.d.ts +0 -28
  78. package/lib/cjs/agents/base-agent.js +0 -39
  79. package/lib/cjs/agents/base-agent.js.map +0 -1
  80. package/lib/cjs/agents/index.d.ts +0 -2
  81. package/lib/cjs/agents/index.js +0 -8
  82. package/lib/cjs/agents/index.js.map +0 -1
  83. package/lib/cjs/agents/router-agent.d.ts +0 -25
  84. package/lib/cjs/agents/router-agent.js +0 -33
  85. package/lib/cjs/agents/router-agent.js.map +0 -1
  86. package/lib/cjs/agents/specialist-agent.d.ts +0 -39
  87. package/lib/cjs/agents/specialist-agent.js +0 -108
  88. package/lib/cjs/agents/specialist-agent.js.map +0 -1
  89. package/lib/cjs/bot-config-tools.d.ts +0 -7
  90. package/lib/cjs/bot-config-tools.js +0 -18
  91. package/lib/cjs/bot-config-tools.js.map +0 -1
  92. package/lib/cjs/constants.d.ts +0 -21
  93. package/lib/cjs/constants.js +0 -25
  94. package/lib/cjs/constants.js.map +0 -1
  95. package/lib/cjs/debug-logger.d.ts +0 -33
  96. package/lib/cjs/debug-logger.js +0 -116
  97. package/lib/cjs/debug-logger.js.map +0 -1
  98. package/lib/cjs/guardrails/index.d.ts +0 -1
  99. package/lib/cjs/guardrails/index.js +0 -5
  100. package/lib/cjs/guardrails/index.js.map +0 -1
  101. package/lib/cjs/guardrails/input.d.ts +0 -10
  102. package/lib/cjs/guardrails/input.js +0 -96
  103. package/lib/cjs/guardrails/input.js.map +0 -1
  104. package/lib/cjs/index.d.ts +0 -22
  105. package/lib/cjs/index.js +0 -219
  106. package/lib/cjs/index.js.map +0 -1
  107. package/lib/cjs/llm-config.d.ts +0 -30
  108. package/lib/cjs/llm-config.js +0 -121
  109. package/lib/cjs/llm-config.js.map +0 -1
  110. package/lib/cjs/runners/base-runner.d.ts +0 -31
  111. package/lib/cjs/runners/base-runner.js +0 -189
  112. package/lib/cjs/runners/base-runner.js.map +0 -1
  113. package/lib/cjs/runners/index.d.ts +0 -2
  114. package/lib/cjs/runners/index.js +0 -8
  115. package/lib/cjs/runners/index.js.map +0 -1
  116. package/lib/cjs/runners/router-runner.d.ts +0 -8
  117. package/lib/cjs/runners/router-runner.js +0 -44
  118. package/lib/cjs/runners/router-runner.js.map +0 -1
  119. package/lib/cjs/runners/specialist-runner.d.ts +0 -4
  120. package/lib/cjs/runners/specialist-runner.js +0 -8
  121. package/lib/cjs/runners/specialist-runner.js.map +0 -1
  122. package/lib/cjs/services/hubtype-api-client.d.ts +0 -13
  123. package/lib/cjs/services/hubtype-api-client.js +0 -176
  124. package/lib/cjs/services/hubtype-api-client.js.map +0 -1
  125. package/lib/cjs/services/types.d.ts +0 -72
  126. package/lib/cjs/services/types.js +0 -13
  127. package/lib/cjs/services/types.js.map +0 -1
  128. package/lib/cjs/structured-output/bot-executor.d.ts +0 -13
  129. package/lib/cjs/structured-output/bot-executor.js +0 -18
  130. package/lib/cjs/structured-output/bot-executor.js.map +0 -1
  131. package/lib/cjs/structured-output/carousel.d.ts +0 -18
  132. package/lib/cjs/structured-output/carousel.js +0 -23
  133. package/lib/cjs/structured-output/carousel.js.map +0 -1
  134. package/lib/cjs/structured-output/exit.d.ts +0 -6
  135. package/lib/cjs/structured-output/exit.js +0 -11
  136. package/lib/cjs/structured-output/exit.js.map +0 -1
  137. package/lib/cjs/structured-output/index.d.ts +0 -108
  138. package/lib/cjs/structured-output/index.js +0 -45
  139. package/lib/cjs/structured-output/index.js.map +0 -1
  140. package/lib/cjs/structured-output/request-contact-info.d.ts +0 -9
  141. package/lib/cjs/structured-output/request-contact-info.js +0 -14
  142. package/lib/cjs/structured-output/request-contact-info.js.map +0 -1
  143. package/lib/cjs/structured-output/text-with-buttons.d.ts +0 -17
  144. package/lib/cjs/structured-output/text-with-buttons.js +0 -24
  145. package/lib/cjs/structured-output/text-with-buttons.js.map +0 -1
  146. package/lib/cjs/structured-output/text.d.ts +0 -9
  147. package/lib/cjs/structured-output/text.js +0 -14
  148. package/lib/cjs/structured-output/text.js.map +0 -1
  149. package/lib/cjs/tools/index.d.ts +0 -3
  150. package/lib/cjs/tools/index.js +0 -8
  151. package/lib/cjs/tools/index.js.map +0 -1
  152. package/lib/cjs/tools/retrieve-knowledge.d.ts +0 -6
  153. package/lib/cjs/tools/retrieve-knowledge.js +0 -34
  154. package/lib/cjs/tools/retrieve-knowledge.js.map +0 -1
  155. package/lib/cjs/types.d.ts +0 -53
  156. package/lib/cjs/types.js +0 -3
  157. package/lib/cjs/types.js.map +0 -1
  158. package/lib/esm/structured-output/request-contact-info.d.ts +0 -9
  159. package/lib/esm/structured-output/request-contact-info.js +0 -14
  160. package/lib/esm/structured-output/request-contact-info.js.map +0 -1
  161. package/src/structured-output/request-contact-info.ts +0 -18
@@ -1,24 +1,25 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextWithButtonsSchema = void 0;
4
- const core_1 = require("@botonic/core");
5
- const zod_1 = require("zod");
6
- exports.TextWithButtonsSchema = zod_1.z
7
- .object({
8
- type: zod_1.z.literal(core_1.OutputMessageType.TextWithButtons),
9
- content: zod_1.z.object({
10
- text: zod_1.z.string(),
11
- buttons: zod_1.z.array(zod_1.z.object({
12
- text: zod_1.z.string(),
13
- url: zod_1.z.string().nullable().optional(),
14
- target: zod_1.z
15
- .enum(['_blank', '_self'])
16
- .default('_blank')
17
- .nullable()
18
- .optional()
19
- .describe('The target of the button when it has an url. If not provided, it will default to _blank.'),
20
- })),
21
- }),
22
- })
23
- .describe('A text message with buttons to allow the user to use quick replies');
1
+ import { OutputMessageType } from "@botonic/core";
2
+ import { z } from "zod";
3
+
4
+
5
+
6
+
7
+
8
+ const TextWithButtonsSchema = z.object({
9
+ type: z.literal(OutputMessageType.TextWithButtons),
10
+ content: z.object({
11
+ text: z.string(),
12
+ buttons: z.array(z.object({
13
+ text: z.string(),
14
+ url: z.string().nullable().optional(),
15
+ target: z["enum"]([
16
+ '_blank',
17
+ '_self'
18
+ ]).default('_blank').nullable().optional().describe('The target of the button when it has an url. If not provided, it will default to _blank.')
19
+ }))
20
+ })
21
+ }).describe('A text message with buttons to allow the user to use quick replies');
22
+
23
+ export { TextWithButtonsSchema };
24
+
24
25
  //# sourceMappingURL=text-with-buttons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-with-buttons.js","sourceRoot":"","sources":["../../../src/structured-output/text-with-buttons.ts"],"names":[],"mappings":";;;AAAA,wCAA8E;AAC9E,6BAAuB;AAIV,QAAA,qBAAqB,GAAG,OAAC;KACnC,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,eAAe,CAAC;IAClD,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,OAAC,CAAC,KAAK,CACd,OAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;YACrC,MAAM,EAAE,OAAC;iBACN,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;iBACzB,OAAO,CAAC,QAAQ,CAAC;iBACjB,QAAQ,EAAE;iBACV,QAAQ,EAAE;iBACV,QAAQ,CACP,0FAA0F,CAC3F;SACJ,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,oEAAoE,CACrE,CAAA"}
1
+ {"version":3,"file":"structured-output/text-with-buttons.js","sources":["../../../src/structured-output/text-with-buttons.ts"],"sourcesContent":["import { OutputMessageType, type TextWithButtonsMessage } from '@botonic/core'\nimport { z } from 'zod'\n\nexport type { TextWithButtonsMessage }\n\nexport const TextWithButtonsSchema = z\n .object({\n type: z.literal(OutputMessageType.TextWithButtons),\n content: z.object({\n text: z.string(),\n buttons: z.array(\n z.object({\n text: z.string(),\n url: z.string().nullable().optional(),\n target: z\n .enum(['_blank', '_self'])\n .default('_blank')\n .nullable()\n .optional()\n .describe(\n 'The target of the button when it has an url. If not provided, it will default to _blank.'\n ),\n })\n ),\n }),\n })\n .describe(\n 'A text message with buttons to allow the user to use quick replies'\n )\n"],"names":["OutputMessageType","z","TextWithButtonsSchema"],"mappings":";;;;;AAA8E;AACvD;AAIhB,MAAME,qBAAqBA,GAAGD,QAC5B,CAAC;IACN,MAAMA,SAAS,CAACD,iCAAiC;IACjD,SAASC,QAAQ,CAAC;QAChB,MAAMA,QAAQ;QACd,SAASA,OAAO,CACdA,QAAQ,CAAC;YACP,MAAMA,QAAQ;YACd,KAAKA,QAAQ,GAAG,QAAQ,GAAG,QAAQ;YACnC,QAAQA,SACD,CAAC;gBAAC;gBAAU;aAAQ,EACxB,OAAO,CAAC,UACR,QAAQ,GACR,QAAQ,GACR,QAAQ,CACP;QAEN;IAEJ;AACF,GACC,QAAQ,CACP,sEACD"}
@@ -1,14 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextSchema = void 0;
4
- const core_1 = require("@botonic/core");
5
- const zod_1 = require("zod");
6
- exports.TextSchema = zod_1.z
7
- .object({
8
- type: zod_1.z.literal(core_1.OutputMessageType.Text),
9
- content: zod_1.z.object({
10
- text: zod_1.z.string(),
11
- }),
12
- })
13
- .describe('A text message');
1
+ import { OutputMessageType } from "@botonic/core";
2
+ import { z } from "zod";
3
+
4
+
5
+
6
+
7
+
8
+ const TextSchema = z.object({
9
+ type: z.literal(OutputMessageType.Text),
10
+ content: z.object({
11
+ text: z.string()
12
+ })
13
+ }).describe('A text message');
14
+
15
+ export { TextSchema };
16
+
14
17
  //# sourceMappingURL=text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/structured-output/text.ts"],"names":[],"mappings":";;;AAAA,wCAAmE;AACnE,6BAAuB;AAIV,QAAA,UAAU,GAAG,OAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,IAAI,CAAC;IACvC,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;KACjB,CAAC;CACH,CAAC;KACD,QAAQ,CAAC,gBAAgB,CAAC,CAAA"}
1
+ {"version":3,"file":"structured-output/text.js","sources":["../../../src/structured-output/text.ts"],"sourcesContent":["import { OutputMessageType, type TextMessage } from '@botonic/core'\nimport { z } from 'zod'\n\nexport type { TextMessage }\n\nexport const TextSchema = z\n .object({\n type: z.literal(OutputMessageType.Text),\n content: z.object({\n text: z.string(),\n }),\n })\n .describe('A text message')\n"],"names":["OutputMessageType","z","TextSchema"],"mappings":";;;;;AAAmE;AAC5C;AAIhB,MAAME,UAAUA,GAAGD,QACjB,CAAC;IACN,MAAMA,SAAS,CAACD,sBAAsB;IACtC,SAASC,QAAQ,CAAC;QAChB,MAAMA,QAAQ;IAChB;AACF,GACC,QAAQ,CAAC,kBAAiB"}
@@ -1,3 +1,3 @@
1
- import type { Tool } from '../types';
2
- export { createRetrieveKnowledge, RETRIEVE_KNOWLEDGE_TOOL_NAME, } from './retrieve-knowledge';
1
+ import type { Tool } from '../types.js';
2
+ export { createRetrieveKnowledge, RETRIEVE_KNOWLEDGE_TOOL_NAME, } from './retrieve-knowledge.js';
3
3
  export declare const mandatoryTools: Tool[];
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mandatoryTools = exports.RETRIEVE_KNOWLEDGE_TOOL_NAME = exports.createRetrieveKnowledge = void 0;
4
- var retrieve_knowledge_1 = require("./retrieve-knowledge");
5
- Object.defineProperty(exports, "createRetrieveKnowledge", { enumerable: true, get: function () { return retrieve_knowledge_1.createRetrieveKnowledge; } });
6
- Object.defineProperty(exports, "RETRIEVE_KNOWLEDGE_TOOL_NAME", { enumerable: true, get: function () { return retrieve_knowledge_1.RETRIEVE_KNOWLEDGE_TOOL_NAME; } });
7
- exports.mandatoryTools = [];
1
+
2
+
3
+ const mandatoryTools = [];
4
+
5
+ export { mandatoryTools };
6
+ export { RETRIEVE_KNOWLEDGE_TOOL_NAME, createRetrieveKnowledge } from "./retrieve-knowledge.js";
7
+
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;AAEA,2DAG6B;AAF3B,6HAAA,uBAAuB,OAAA;AACvB,kIAAA,4BAA4B,OAAA;AAGjB,QAAA,cAAc,GAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"tools/index.js","sources":["../../../src/tools/index.ts"],"sourcesContent":["import type { Tool } from '../types'\n\nexport {\n createRetrieveKnowledge,\n RETRIEVE_KNOWLEDGE_TOOL_NAME,\n} from './retrieve-knowledge'\n\nexport const mandatoryTools: Tool[] = []\n"],"names":["createRetrieveKnowledge","RETRIEVE_KNOWLEDGE_TOOL_NAME","mandatoryTools"],"mappings":";AAK6B;AAEtB,MAAME,cAAcA,GAAW,EAAE"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import type { Context } from '../types';
2
+ import type { Context } from '../types.js';
3
3
  export declare const RETRIEVE_KNOWLEDGE_TOOL_NAME = "retrieve_knowledge";
4
- export declare const createRetrieveKnowledge: (sourceIds: string[]) => import("@openai/agents").FunctionTool<Context<import("@botonic/core").ResolvedPlugins, any>, z.ZodObject<{
4
+ export declare const createRetrieveKnowledge: (sourceIds: string[]) => import("@openai/agents-core").FunctionTool<Context<import("@botonic/core").ResolvedPlugins, any>, z.ZodObject<{
5
5
  query: z.ZodString;
6
6
  }, z.core.$strip>, string>;
@@ -1,34 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRetrieveKnowledge = exports.RETRIEVE_KNOWLEDGE_TOOL_NAME = void 0;
4
- const agents_1 = require("@openai/agents");
5
- const zod_1 = require("zod");
6
- const hubtype_api_client_1 = require("../services/hubtype-api-client");
7
- exports.RETRIEVE_KNOWLEDGE_TOOL_NAME = 'retrieve_knowledge';
8
- const createRetrieveKnowledge = (sourceIds) => (0, agents_1.tool)({
9
- name: exports.RETRIEVE_KNOWLEDGE_TOOL_NAME,
10
- description: 'Consult the knowledge base for information before answering. Use this tool to make sure the information you provide is faithful.',
11
- parameters: zod_1.z.object({
12
- query: zod_1.z.string().describe('The query to search the knowledge base for'),
13
- }),
14
- execute: async (input, runContext) => {
15
- const context = runContext?.context;
16
- const query = input.query;
17
- if (!context) {
18
- throw new Error('Context is required');
1
+ import { tool } from "@openai/agents";
2
+ import { z } from "zod";
3
+ import { HubtypeApiClient } from "../services/hubtype-api-client.js";
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+ const RETRIEVE_KNOWLEDGE_TOOL_NAME = 'retrieve_knowledge';
12
+ const createRetrieveKnowledge = (sourceIds)=>tool({
13
+ name: RETRIEVE_KNOWLEDGE_TOOL_NAME,
14
+ description: 'Consult the knowledge base for information before answering. Use this tool to make sure the information you provide is faithful.',
15
+ parameters: z.object({
16
+ query: z.string().describe('The query to search the knowledge base for')
17
+ }),
18
+ execute: async (input, runContext)=>{
19
+ const context = runContext?.context;
20
+ const query = input.query;
21
+ if (!context) {
22
+ throw new Error('Context is required');
23
+ }
24
+ const client = new HubtypeApiClient(context.authToken);
25
+ const chunks = await client.retrieveSimilarChunks(query, sourceIds);
26
+ const chunksIds = chunks.map((chunk)=>chunk.id);
27
+ const chunkTexts = chunks.map((chunk)=>chunk.text);
28
+ context.knowledgeUsed = {
29
+ query,
30
+ sourceIds,
31
+ chunksIds,
32
+ chunkTexts
33
+ };
34
+ return chunkTexts;
19
35
  }
20
- const client = new hubtype_api_client_1.HubtypeApiClient(context.authToken);
21
- const chunks = await client.retrieveSimilarChunks(query, sourceIds);
22
- const chunksIds = chunks.map(chunk => chunk.id);
23
- const chunkTexts = chunks.map(chunk => chunk.text);
24
- context.knowledgeUsed = {
25
- query,
26
- sourceIds,
27
- chunksIds,
28
- chunkTexts,
29
- };
30
- return chunkTexts;
31
- },
32
- });
33
- exports.createRetrieveKnowledge = createRetrieveKnowledge;
36
+ });
37
+
38
+ export { RETRIEVE_KNOWLEDGE_TOOL_NAME, createRetrieveKnowledge };
39
+
34
40
  //# sourceMappingURL=retrieve-knowledge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AACtD,6BAAuB;AAEvB,uEAAiE;AAGpD,QAAA,4BAA4B,GAAG,oBAAoB,CAAA;AAEzD,MAAM,uBAAuB,GAAG,CAAC,SAAmB,EAAE,EAAE,CAC7D,IAAA,aAAI,EAAC;IACH,IAAI,EAAE,oCAA4B;IAClC,WAAW,EACT,kIAAkI;IACpI,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;KACzE,CAAC;IACF,OAAO,EAAE,KAAK,EACZ,KAAwB,EACxB,UAAgC,EACb,EAAE;QACrB,MAAM,OAAO,GAAG,UAAU,EAAE,OAAO,CAAA;QACnC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;QACxC,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,qCAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QACtD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QACnE,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC/C,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAElD,OAAO,CAAC,aAAa,GAAG;YACtB,KAAK;YACL,SAAS;YACT,SAAS;YACT,UAAU;SACX,CAAA;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;CACF,CAAC,CAAA;AA/BS,QAAA,uBAAuB,2BA+BhC"}
1
+ {"version":3,"file":"tools/retrieve-knowledge.js","sources":["../../../src/tools/retrieve-knowledge.ts"],"sourcesContent":["import { type RunContext, tool } from '@openai/agents'\nimport { z } from 'zod'\n\nimport { HubtypeApiClient } from '../services/hubtype-api-client'\nimport type { Context } from '../types'\n\nexport const RETRIEVE_KNOWLEDGE_TOOL_NAME = 'retrieve_knowledge'\n\nexport const createRetrieveKnowledge = (sourceIds: string[]) =>\n tool({\n name: RETRIEVE_KNOWLEDGE_TOOL_NAME,\n description:\n 'Consult the knowledge base for information before answering. Use this tool to make sure the information you provide is faithful.',\n parameters: z.object({\n query: z.string().describe('The query to search the knowledge base for'),\n }),\n execute: async (\n input: { query: string },\n runContext?: RunContext<Context>\n ): Promise<string[]> => {\n const context = runContext?.context\n const query = input.query\n if (!context) {\n throw new Error('Context is required')\n }\n const client = new HubtypeApiClient(context.authToken)\n const chunks = await client.retrieveSimilarChunks(query, sourceIds)\n const chunksIds = chunks.map(chunk => chunk.id)\n const chunkTexts = chunks.map(chunk => chunk.text)\n\n context.knowledgeUsed = {\n query,\n sourceIds,\n chunksIds,\n chunkTexts,\n }\n\n return chunkTexts\n },\n })\n"],"names":["tool","z","HubtypeApiClient","RETRIEVE_KNOWLEDGE_TOOL_NAME","createRetrieveKnowledge","sourceIds","input","runContext","context","query","Error","client","chunks","chunksIds","chunk","chunkTexts"],"mappings":";;;;;;;AAAsD;AAC/B;AAE0C;AAG1D,MAAMG,4BAA4BA,GAAG,qBAAoB;AAEzD,MAAMC,uBAAuBA,GAAG,CAACC,YACtCL,IAAIA,CAAC;QACH,MAAMG,4BAA4BA;QAClC,aACE;QACF,YAAYF,QAAQ,CAAC;YACnB,OAAOA,QAAQ,GAAG,QAAQ,CAAC;QAC7B;QACA,SAAS,OACPK,OACAC;YAEA,MAAMC,UAAUD,YAAY;YAC5B,MAAME,QAAQH,MAAM,KAAK;YACzB,IAAI,CAACE,SAAS;gBACZ,MAAM,IAAIE,MAAM;YAClB;YACA,MAAMC,SAAS,IAAIT,gBAAgBA,CAACM,QAAQ,SAAS;YACrD,MAAMI,SAAS,MAAMD,OAAO,qBAAqB,CAACF,OAAOJ;YACzD,MAAMQ,YAAYD,OAAO,GAAG,CAACE,CAAAA,QAASA,MAAM,EAAE;YAC9C,MAAMC,aAAaH,OAAO,GAAG,CAACE,CAAAA,QAASA,MAAM,IAAI;YAEjDN,QAAQ,aAAa,GAAG;gBACtBC;gBACAJ;gBACAQ;gBACAE;YACF;YAEA,OAAOA;QACT;IACF,GAAE"}
@@ -1,7 +1,7 @@
1
- import { AgenticOutputMessage, AiAgentArgs, type BotContext, GuardrailRule, InferenceResponse, type ResolvedPlugins, RunResult } from '@botonic/core';
1
+ import type { AgenticOutputMessage, AiAgentArgs, BotContext, GuardrailRule, InferenceResponse, ResolvedPlugins, RunResult } from '@botonic/core';
2
2
  import type { Agent, AgentInputItem, AgentOutputType, RunContext as OpenAIRunContext, Tool as OpenAITool } from '@openai/agents';
3
3
  import type { ZodType } from 'zod';
4
- import type { OutputSchema } from './structured-output';
4
+ import type { OutputSchema } from './structured-output/index.js';
5
5
  export interface Context<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
6
6
  authToken: string;
7
7
  knowledgeUsed: {
@@ -50,4 +50,4 @@ export interface ResultRawResponse {
50
50
  providerData?: Record<string, unknown>;
51
51
  }
52
52
  export type AgenticInputMessage = AgentInputItem;
53
- export { AgenticOutputMessage, AiAgentArgs, GuardrailRule, InferenceResponse, RunResult, };
53
+ export type { AgenticOutputMessage, AiAgentArgs, GuardrailRule, InferenceResponse, RunResult, };
package/lib/esm/types.js CHANGED
@@ -1,3 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+
2
+
3
+ export {};
4
+
3
5
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["import type {\n AgenticOutputMessage,\n AiAgentArgs,\n BotContext,\n GuardrailRule,\n InferenceResponse,\n ResolvedPlugins,\n RunResult,\n} from '@botonic/core'\nimport type {\n Agent,\n AgentInputItem,\n AgentOutputType,\n RunContext as OpenAIRunContext,\n Tool as OpenAITool,\n} from '@openai/agents'\nimport type { ZodType } from 'zod'\n\nimport type { OutputSchema } from './structured-output'\n\nexport interface Context<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> {\n authToken: string\n knowledgeUsed: {\n query: string\n sourceIds: string[]\n chunksIds: string[]\n chunkTexts: string[]\n }\n request: BotContext<TPlugins, TExtraData>\n}\n\nexport type RunContext<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = OpenAIRunContext<Context<TPlugins, TExtraData>>\n\nexport interface CustomTool<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> {\n name: string\n description: string\n schema: ZodType\n func: (\n input?: any,\n runContext?: RunContext<TPlugins, TExtraData>\n ) => Promise<any>\n}\n\nexport interface Chunk {\n id: string\n text: string\n}\n\nexport type Tool<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = OpenAITool<Context<TPlugins, TExtraData>>\n\nexport type AIAgent<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = Agent<Context<TPlugins, TExtraData>, AgentOutputType<typeof OutputSchema>>\n\nexport interface MemoryOptions {\n maxMessages: number\n includeToolCalls: boolean\n maxFullToolResults: number\n debugMode: boolean\n}\n\nexport interface PluginAiAgentOptions<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> {\n authToken?: string\n customTools?: CustomTool<TPlugins, TExtraData>[]\n maxRetries?: number\n timeout?: number\n memory?: Partial<MemoryOptions>\n /** Enable debug logging for AI agent configuration and execution details. */\n enableDebug?: boolean\n /** Key for the local storage to to get messages in local development mode */\n localStorageKey?: string\n}\n\nexport interface ResultRawResponse {\n usage: {\n inputTokens: number\n outputTokens: number\n }\n providerData?: Record<string, unknown>\n}\n\nexport type AgenticInputMessage = AgentInputItem\n\nexport type {\n AgenticOutputMessage,\n AiAgentArgs,\n GuardrailRule,\n InferenceResponse,\n RunResult,\n}\n"],"names":[],"mappings":"AAyGC"}
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@botonic/plugin-ai-agents",
3
- "version": "0.56.0-alpha.0",
4
- "main": "./lib/cjs/index.js",
3
+ "version": "0.57.0-rslib-esm.0",
4
+ "main": "./lib/esm/index.js",
5
5
  "module": "./lib/esm/index.js",
6
6
  "description": "Use AI Agents to generate your contents",
7
7
  "scripts": {
8
- "build": "rm -rf lib && ../../node_modules/.bin/tsc -p tsconfig.json && ../../node_modules/.bin/tsc -p tsconfig.esm.json",
9
- "build:watch": "npm run build -- --watch",
8
+ "build": "node ../../scripts/build/clean.mjs && rslib build --no-env",
9
+ "build:watch": "node ../../scripts/build/clean.mjs && rslib build --watch --no-env",
10
10
  "test": "../../node_modules/.bin/jest --coverage",
11
- "prepublishOnly": "rm -rf lib && npm i && npm run build",
11
+ "prepublishOnly": "npm run build && npm run test && npm run lint",
12
12
  "lint": "biome check --write src/ tests/",
13
13
  "lint:check": "biome check src/ tests/",
14
14
  "format": "biome format --write src/ tests/"
15
15
  },
16
16
  "dependencies": {
17
- "@botonic/core": "^0.56.0-alpha.0",
17
+ "@botonic/core": "^0.57.0-rslib-esm.0",
18
18
  "@openai/agents": "^0.10.1",
19
19
  "axios": "^1.18.1",
20
20
  "openai": "^6.36.0",
@@ -45,5 +45,6 @@
45
45
  "typescript",
46
46
  "javascript"
47
47
  ],
48
- "author": ""
48
+ "author": "",
49
+ "types": "./lib/esm/index.d.ts"
49
50
  }
@@ -3,7 +3,6 @@ import { z } from 'zod'
3
3
  import { BotExecutorSchema } from './bot-executor'
4
4
  import { CarouselSchema } from './carousel'
5
5
  import { ExitSchema } from './exit'
6
- import { RequestContactInfoSchema } from './request-contact-info'
7
6
  import { TextSchema } from './text'
8
7
  import { TextWithButtonsSchema } from './text-with-buttons'
9
8
 
@@ -17,7 +16,6 @@ const baseMessageSchemas = [
17
16
  CarouselSchema,
18
17
  ExitSchema,
19
18
  BotExecutorSchema,
20
- RequestContactInfoSchema,
21
19
  ] as const
22
20
  export const OutputSchema = z
23
21
  .object({
package/src/types.ts CHANGED
@@ -1,10 +1,10 @@
1
- import {
1
+ import type {
2
2
  AgenticOutputMessage,
3
3
  AiAgentArgs,
4
- type BotContext,
4
+ BotContext,
5
5
  GuardrailRule,
6
6
  InferenceResponse,
7
- type ResolvedPlugins,
7
+ ResolvedPlugins,
8
8
  RunResult,
9
9
  } from '@botonic/core'
10
10
  import type {
@@ -97,7 +97,7 @@ export interface ResultRawResponse {
97
97
 
98
98
  export type AgenticInputMessage = AgentInputItem
99
99
 
100
- export {
100
+ export type {
101
101
  AgenticOutputMessage,
102
102
  AiAgentArgs,
103
103
  GuardrailRule,
@@ -1,28 +0,0 @@
1
- import type { AgentOutputType, InputGuardrail, Model, ModelSettings } from '@openai/agents';
2
- import type { z } from 'zod';
3
- import type { GuardrailTrackingContext } from '../guardrails/input';
4
- import type { LLMConfig } from '../llm-config';
5
- import { type OutputSchema } from '../structured-output';
6
- import type { GuardrailRule } from '../types';
7
- export interface BaseAgentOptions {
8
- name: string;
9
- instructions: string;
10
- llmConfig: LLMConfig;
11
- inputGuardrailRules: GuardrailRule[];
12
- outputMessagesSchemas?: z.ZodObject[];
13
- guardrailTrackingContext: GuardrailTrackingContext;
14
- }
15
- export declare abstract class BaseAgent {
16
- protected name: string;
17
- protected instructions: string;
18
- protected llmConfig: LLMConfig;
19
- private inputGuardrailRules;
20
- private outputMessagesSchemas;
21
- private guardrailTrackingContext;
22
- constructor(options: BaseAgentOptions);
23
- protected getAgentModelSettings(): ModelSettings;
24
- protected getInputGuardrails(): Promise<InputGuardrail[]>;
25
- protected getOutputType(): AgentOutputType<typeof OutputSchema>;
26
- protected addOutputInstructions(instructions: string): string;
27
- protected getModel(): Promise<string | Model>;
28
- }
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseAgent = void 0;
4
- const guardrails_1 = require("../guardrails");
5
- const structured_output_1 = require("../structured-output");
6
- class BaseAgent {
7
- constructor(options) {
8
- this.name = options.name;
9
- this.instructions = options.instructions;
10
- this.llmConfig = options.llmConfig;
11
- this.inputGuardrailRules = options.inputGuardrailRules;
12
- this.outputMessagesSchemas = options.outputMessagesSchemas || [];
13
- this.guardrailTrackingContext = options.guardrailTrackingContext;
14
- }
15
- getAgentModelSettings() {
16
- const modelSettings = { ...this.llmConfig.modelSettings };
17
- if (this.llmConfig.modelSettings.reasoning) {
18
- modelSettings.reasoning = { ...this.llmConfig.modelSettings.reasoning };
19
- }
20
- if (this.llmConfig.modelSettings.text) {
21
- modelSettings.text = { ...this.llmConfig.modelSettings.text };
22
- }
23
- return modelSettings;
24
- }
25
- async getInputGuardrails() {
26
- return await (0, guardrails_1.createInputGuardrails)(this.inputGuardrailRules, this.llmConfig, this.guardrailTrackingContext);
27
- }
28
- getOutputType() {
29
- return (0, structured_output_1.getOutputSchema)(this.outputMessagesSchemas);
30
- }
31
- addOutputInstructions(instructions) {
32
- return `${instructions}\n\n${(0, structured_output_1.getOutputInstructions)()}`;
33
- }
34
- async getModel() {
35
- return await this.llmConfig.getModel();
36
- }
37
- }
38
- exports.BaseAgent = BaseAgent;
39
- //# sourceMappingURL=base-agent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-agent.js","sourceRoot":"","sources":["../../../src/agents/base-agent.ts"],"names":[],"mappings":";;;AAQA,8CAAqD;AAGrD,4DAI6B;AAY7B,MAAsB,SAAS;IAQ7B,YAAY,OAAyB;QACnC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAA;QACxC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QAClC,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;QACtD,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,IAAI,EAAE,CAAA;QAChE,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAA;IAClE,CAAC;IAES,qBAAqB;QAC7B,MAAM,aAAa,GAAkB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAA;QAExE,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;YAC3C,aAAa,CAAC,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE,CAAA;QACzE,CAAC;QAED,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;YACtC,aAAa,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;QAC/D,CAAC;QAED,OAAO,aAAa,CAAA;IACtB,CAAC;IAES,KAAK,CAAC,kBAAkB;QAChC,OAAO,MAAM,IAAA,kCAAqB,EAChC,IAAI,CAAC,mBAAmB,EACxB,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,wBAAwB,CAC9B,CAAA;IACH,CAAC;IAES,aAAa;QACrB,OAAO,IAAA,mCAAe,EAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;IACpD,CAAC;IAES,qBAAqB,CAAC,YAAoB;QAClD,OAAO,GAAG,YAAY,OAAO,IAAA,yCAAqB,GAAE,EAAE,CAAA;IACxD,CAAC;IAES,KAAK,CAAC,QAAQ;QACtB,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAA;IACxC,CAAC;CACF;AAlDD,8BAkDC"}
@@ -1,2 +0,0 @@
1
- export { RouterAgent } from './router-agent';
2
- export { SpecialistAgent } from './specialist-agent';
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SpecialistAgent = exports.RouterAgent = void 0;
4
- var router_agent_1 = require("./router-agent");
5
- Object.defineProperty(exports, "RouterAgent", { enumerable: true, get: function () { return router_agent_1.RouterAgent; } });
6
- var specialist_agent_1 = require("./specialist-agent");
7
- Object.defineProperty(exports, "SpecialistAgent", { enumerable: true, get: function () { return specialist_agent_1.SpecialistAgent; } });
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/index.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AACpB,uDAAoD;AAA3C,mHAAA,eAAe,OAAA"}
@@ -1,25 +0,0 @@
1
- import type { ResolvedPlugins } from '@botonic/core';
2
- import { type AgentOutputType, type Handoff } from '@openai/agents';
3
- import type { z } from 'zod';
4
- import type { GuardrailTrackingContext } from '../guardrails/input';
5
- import type { LLMConfig } from '../llm-config';
6
- import type { OutputSchema } from '../structured-output';
7
- import type { AIAgent, Context, GuardrailRule } from '../types';
8
- import { BaseAgent } from './base-agent';
9
- interface RouterAgentOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> {
10
- name: string;
11
- instructions: string;
12
- llmConfig: LLMConfig;
13
- handoffs: Handoff<Context<TPlugins, TExtraData>, AgentOutputType<typeof OutputSchema>>[];
14
- inputGuardrailRules: GuardrailRule[];
15
- outputMessagesSchemas?: z.ZodObject[];
16
- guardrailTrackingContext: GuardrailTrackingContext;
17
- }
18
- export declare class RouterAgent<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> extends BaseAgent {
19
- private handoffs;
20
- private agent;
21
- private constructor();
22
- static create<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown>(options: RouterAgentOptions<TPlugins, TExtraData>): Promise<RouterAgent<TPlugins, TExtraData>>;
23
- getAgent(): AIAgent<TPlugins, TExtraData>;
24
- }
25
- export {};
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RouterAgent = void 0;
4
- const agents_1 = require("@openai/agents");
5
- const extensions_1 = require("@openai/agents-core/extensions");
6
- const base_agent_1 = require("./base-agent");
7
- class RouterAgent extends base_agent_1.BaseAgent {
8
- constructor(options) {
9
- super(options);
10
- this.handoffs = options.handoffs;
11
- }
12
- static async create(options) {
13
- const routerAgent = new RouterAgent(options);
14
- const inputGuardrails = await routerAgent.getInputGuardrails();
15
- // Agent.create is typed as Agent<UnknownContext>; we run with Context<TPlugins, TExtraData>.
16
- const agent = agents_1.Agent.create({
17
- name: routerAgent.name,
18
- model: await routerAgent.getModel(),
19
- modelSettings: routerAgent.getAgentModelSettings(),
20
- instructions: routerAgent.addOutputInstructions(`${extensions_1.RECOMMENDED_PROMPT_PREFIX}${routerAgent.instructions}`),
21
- handoffs: routerAgent.handoffs,
22
- outputType: routerAgent.getOutputType(),
23
- inputGuardrails,
24
- });
25
- routerAgent.agent = agent;
26
- return routerAgent;
27
- }
28
- getAgent() {
29
- return this.agent;
30
- }
31
- }
32
- exports.RouterAgent = RouterAgent;
33
- //# sourceMappingURL=router-agent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"router-agent.js","sourceRoot":"","sources":["../../../src/agents/router-agent.ts"],"names":[],"mappings":";;;AACA,2CAA0E;AAC1E,+DAA0E;AAM1E,6CAAwC;AAkBxC,MAAa,WAGX,SAAQ,sBAAS;IAOjB,YAAoB,OAAiD;QACnE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IAClC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAIjB,OAAiD;QAEjD,MAAM,WAAW,GAAG,IAAI,WAAW,CAAuB,OAAO,CAAC,CAAA;QAClE,MAAM,eAAe,GAAG,MAAM,WAAW,CAAC,kBAAkB,EAAE,CAAA;QAE9D,6FAA6F;QAC7F,MAAM,KAAK,GAAG,cAAK,CAAC,MAAM,CAAC;YACzB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,KAAK,EAAE,MAAM,WAAW,CAAC,QAAQ,EAAE;YACnC,aAAa,EAAE,WAAW,CAAC,qBAAqB,EAAE;YAClD,YAAY,EAAE,WAAW,CAAC,qBAAqB,CAC7C,GAAG,sCAAyB,GAAG,WAAW,CAAC,YAAY,EAAE,CAC1D;YACD,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,UAAU,EAAE,WAAW,CAAC,aAAa,EAAE;YACvC,eAAe;SAChB,CAAkC,CAAA;QAEnC,WAAW,CAAC,KAAK,GAAG,KAAK,CAAA;QACzB,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;CACF;AA5CD,kCA4CC"}
@@ -1,39 +0,0 @@
1
- import type { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core';
2
- import type { z } from 'zod';
3
- import type { DebugLogger } from '../debug-logger';
4
- import type { GuardrailTrackingContext } from '../guardrails/input';
5
- import type { LLMConfig } from '../llm-config';
6
- import type { AIAgent, GuardrailRule, Tool } from '../types';
7
- import { BaseAgent } from './base-agent';
8
- interface SpecialistAgentOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> {
9
- name: string;
10
- instructions: string;
11
- tools: Tool<TPlugins, TExtraData>[];
12
- campaignsContext?: CampaignV2[];
13
- contactInfo: ContactInfo[];
14
- inputGuardrailRules: GuardrailRule[];
15
- sourceIds: string[];
16
- outputMessagesSchemas?: z.ZodObject[];
17
- llmConfig: LLMConfig;
18
- logger: DebugLogger;
19
- guardrailTrackingContext: GuardrailTrackingContext;
20
- forceToolNameOverride?: string;
21
- disableForceRetrieveKnowledge?: boolean;
22
- }
23
- export declare class SpecialistAgent<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> extends BaseAgent {
24
- private tools;
25
- private logger;
26
- private agent;
27
- private forceToolNameOverride?;
28
- private disableForceRetrieveKnowledge?;
29
- private constructor();
30
- static create<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown>(options: SpecialistAgentOptions<TPlugins, TExtraData>): Promise<SpecialistAgent<TPlugins, TExtraData>>;
31
- getAgent(): AIAgent<TPlugins, TExtraData>;
32
- private getSpecialistModelSettings;
33
- private addExtraInstructions;
34
- private getContactInfoInstructions;
35
- private getMetadataInstructions;
36
- private getCampaignInstructions;
37
- private addHubtypeTools;
38
- }
39
- export {};