@botonic/plugin-ai-agents 0.57.0-rslib-esm.2 → 0.57.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 (225) hide show
  1. package/lib/{agents → cjs/agents}/base-agent.d.ts +4 -4
  2. package/lib/cjs/agents/base-agent.js +39 -0
  3. package/lib/cjs/agents/base-agent.js.map +1 -0
  4. package/lib/cjs/agents/index.d.ts +2 -0
  5. package/lib/cjs/agents/index.js +8 -0
  6. package/lib/cjs/agents/index.js.map +1 -0
  7. package/lib/{agents → cjs/agents}/router-agent.d.ts +5 -5
  8. package/lib/cjs/agents/router-agent.js +33 -0
  9. package/lib/cjs/agents/router-agent.js.map +1 -0
  10. package/lib/{agents → cjs/agents}/specialist-agent.d.ts +5 -5
  11. package/lib/{agents → cjs/agents}/specialist-agent.js +45 -65
  12. package/lib/cjs/agents/specialist-agent.js.map +1 -0
  13. package/lib/{bot-config-tools.d.ts → cjs/bot-config-tools.d.ts} +1 -1
  14. package/lib/cjs/bot-config-tools.js +18 -0
  15. package/lib/cjs/bot-config-tools.js.map +1 -0
  16. package/lib/cjs/constants.js +25 -0
  17. package/lib/cjs/constants.js.map +1 -0
  18. package/lib/{debug-logger.d.ts → cjs/debug-logger.d.ts} +1 -1
  19. package/lib/{debug-logger.js → cjs/debug-logger.js} +9 -14
  20. package/lib/cjs/debug-logger.js.map +1 -0
  21. package/lib/cjs/guardrails/index.d.ts +1 -0
  22. package/lib/cjs/guardrails/index.js +5 -0
  23. package/lib/cjs/guardrails/index.js.map +1 -0
  24. package/lib/{guardrails → cjs/guardrails}/input.d.ts +2 -2
  25. package/lib/cjs/guardrails/input.js +96 -0
  26. package/lib/cjs/guardrails/input.js.map +1 -0
  27. package/lib/{index.d.ts → cjs/index.d.ts} +3 -3
  28. package/lib/{index.js → cjs/index.js} +75 -114
  29. package/lib/cjs/index.js.map +1 -0
  30. package/lib/{llm-config.d.ts → cjs/llm-config.d.ts} +1 -1
  31. package/lib/cjs/llm-config.js +121 -0
  32. package/lib/cjs/llm-config.js.map +1 -0
  33. package/lib/{runners → cjs/runners}/base-runner.d.ts +4 -4
  34. package/lib/{runners → cjs/runners}/base-runner.js +74 -81
  35. package/lib/cjs/runners/base-runner.js.map +1 -0
  36. package/lib/cjs/runners/index.d.ts +2 -0
  37. package/lib/cjs/runners/index.js +8 -0
  38. package/lib/cjs/runners/index.js.map +1 -0
  39. package/lib/{runners → cjs/runners}/router-runner.d.ts +2 -2
  40. package/lib/{runners → cjs/runners}/router-runner.js +14 -19
  41. package/lib/cjs/runners/router-runner.js.map +1 -0
  42. package/lib/{runners → cjs/runners}/specialist-runner.d.ts +1 -1
  43. package/lib/cjs/runners/specialist-runner.js +8 -0
  44. package/lib/cjs/runners/specialist-runner.js.map +1 -0
  45. package/lib/{services → cjs/services}/hubtype-api-client.d.ts +2 -2
  46. package/lib/cjs/services/hubtype-api-client.js +176 -0
  47. package/lib/cjs/services/hubtype-api-client.js.map +1 -0
  48. package/lib/{services → cjs/services}/types.d.ts +1 -1
  49. package/lib/cjs/services/types.js +13 -0
  50. package/lib/cjs/services/types.js.map +1 -0
  51. package/lib/cjs/structured-output/bot-executor.js +18 -0
  52. package/lib/cjs/structured-output/bot-executor.js.map +1 -0
  53. package/lib/cjs/structured-output/carousel.js +23 -0
  54. package/lib/cjs/structured-output/carousel.js.map +1 -0
  55. package/lib/cjs/structured-output/do-nothing.d.ts +6 -0
  56. package/lib/cjs/structured-output/do-nothing.js +11 -0
  57. package/lib/cjs/structured-output/do-nothing.js.map +1 -0
  58. package/lib/cjs/structured-output/exit.js +11 -0
  59. package/lib/cjs/structured-output/exit.js.map +1 -0
  60. package/lib/{structured-output → cjs/structured-output}/index.d.ts +4 -0
  61. package/lib/cjs/structured-output/index.js +47 -0
  62. package/lib/cjs/structured-output/index.js.map +1 -0
  63. package/lib/cjs/structured-output/request-contact-info.js +14 -0
  64. package/lib/cjs/structured-output/request-contact-info.js.map +1 -0
  65. package/lib/cjs/structured-output/text-with-buttons.js +24 -0
  66. package/lib/cjs/structured-output/text-with-buttons.js.map +1 -0
  67. package/lib/cjs/structured-output/text.js +14 -0
  68. package/lib/cjs/structured-output/text.js.map +1 -0
  69. package/lib/{tools → cjs/tools}/index.d.ts +2 -2
  70. package/lib/cjs/tools/index.js +8 -0
  71. package/lib/cjs/tools/index.js.map +1 -0
  72. package/lib/{tools → cjs/tools}/retrieve-knowledge.d.ts +2 -2
  73. package/lib/cjs/tools/retrieve-knowledge.js +34 -0
  74. package/lib/cjs/tools/retrieve-knowledge.js.map +1 -0
  75. package/lib/{types.d.ts → cjs/types.d.ts} +1 -1
  76. package/lib/cjs/types.js +3 -0
  77. package/lib/cjs/types.js.map +1 -0
  78. package/lib/esm/agents/base-agent.d.ts +28 -0
  79. package/lib/esm/agents/base-agent.js +39 -0
  80. package/lib/esm/agents/base-agent.js.map +1 -0
  81. package/lib/esm/agents/index.d.ts +2 -0
  82. package/lib/esm/agents/index.js +8 -0
  83. package/lib/esm/agents/index.js.map +1 -0
  84. package/lib/esm/agents/router-agent.d.ts +25 -0
  85. package/lib/esm/agents/router-agent.js +33 -0
  86. package/lib/esm/agents/router-agent.js.map +1 -0
  87. package/lib/esm/agents/specialist-agent.d.ts +39 -0
  88. package/lib/esm/agents/specialist-agent.js +108 -0
  89. package/lib/esm/agents/specialist-agent.js.map +1 -0
  90. package/lib/esm/bot-config-tools.d.ts +7 -0
  91. package/lib/esm/bot-config-tools.js +18 -0
  92. package/lib/esm/bot-config-tools.js.map +1 -0
  93. package/lib/esm/constants.d.ts +21 -0
  94. package/lib/esm/constants.js +25 -0
  95. package/lib/esm/constants.js.map +1 -0
  96. package/lib/esm/debug-logger.d.ts +33 -0
  97. package/lib/esm/debug-logger.js +116 -0
  98. package/lib/esm/debug-logger.js.map +1 -0
  99. package/lib/esm/guardrails/index.d.ts +1 -0
  100. package/lib/esm/guardrails/index.js +5 -0
  101. package/lib/esm/guardrails/index.js.map +1 -0
  102. package/lib/esm/guardrails/input.d.ts +10 -0
  103. package/lib/esm/guardrails/input.js +96 -0
  104. package/lib/esm/guardrails/input.js.map +1 -0
  105. package/lib/esm/index.d.ts +22 -0
  106. package/lib/esm/index.js +220 -0
  107. package/lib/esm/index.js.map +1 -0
  108. package/lib/esm/llm-config.d.ts +30 -0
  109. package/lib/esm/llm-config.js +121 -0
  110. package/lib/esm/llm-config.js.map +1 -0
  111. package/lib/esm/runners/base-runner.d.ts +31 -0
  112. package/lib/esm/runners/base-runner.js +194 -0
  113. package/lib/esm/runners/base-runner.js.map +1 -0
  114. package/lib/esm/runners/index.d.ts +2 -0
  115. package/lib/esm/runners/index.js +8 -0
  116. package/lib/esm/runners/index.js.map +1 -0
  117. package/lib/esm/runners/router-runner.d.ts +8 -0
  118. package/lib/esm/runners/router-runner.js +44 -0
  119. package/lib/esm/runners/router-runner.js.map +1 -0
  120. package/lib/esm/runners/specialist-runner.d.ts +4 -0
  121. package/lib/esm/runners/specialist-runner.js +8 -0
  122. package/lib/esm/runners/specialist-runner.js.map +1 -0
  123. package/lib/esm/services/hubtype-api-client.d.ts +13 -0
  124. package/lib/esm/services/hubtype-api-client.js +176 -0
  125. package/lib/esm/services/hubtype-api-client.js.map +1 -0
  126. package/lib/esm/services/types.d.ts +72 -0
  127. package/lib/esm/services/types.js +13 -0
  128. package/lib/esm/services/types.js.map +1 -0
  129. package/lib/esm/structured-output/bot-executor.d.ts +13 -0
  130. package/lib/esm/structured-output/bot-executor.js +18 -0
  131. package/lib/esm/structured-output/bot-executor.js.map +1 -0
  132. package/lib/esm/structured-output/carousel.d.ts +18 -0
  133. package/lib/esm/structured-output/carousel.js +23 -0
  134. package/lib/esm/structured-output/carousel.js.map +1 -0
  135. package/lib/esm/structured-output/do-nothing.d.ts +6 -0
  136. package/lib/esm/structured-output/do-nothing.js +11 -0
  137. package/lib/esm/structured-output/do-nothing.js.map +1 -0
  138. package/lib/esm/structured-output/exit.d.ts +6 -0
  139. package/lib/esm/structured-output/exit.js +11 -0
  140. package/lib/esm/structured-output/exit.js.map +1 -0
  141. package/lib/esm/structured-output/index.d.ts +112 -0
  142. package/lib/esm/structured-output/index.js +47 -0
  143. package/lib/esm/structured-output/index.js.map +1 -0
  144. package/lib/esm/structured-output/request-contact-info.d.ts +9 -0
  145. package/lib/esm/structured-output/request-contact-info.js +14 -0
  146. package/lib/esm/structured-output/request-contact-info.js.map +1 -0
  147. package/lib/esm/structured-output/text-with-buttons.d.ts +17 -0
  148. package/lib/esm/structured-output/text-with-buttons.js +24 -0
  149. package/lib/esm/structured-output/text-with-buttons.js.map +1 -0
  150. package/lib/esm/structured-output/text.d.ts +9 -0
  151. package/lib/esm/structured-output/text.js +14 -0
  152. package/lib/esm/structured-output/text.js.map +1 -0
  153. package/lib/esm/tools/index.d.ts +3 -0
  154. package/lib/esm/tools/index.js +8 -0
  155. package/lib/esm/tools/index.js.map +1 -0
  156. package/lib/esm/tools/retrieve-knowledge.d.ts +6 -0
  157. package/lib/esm/tools/retrieve-knowledge.js +34 -0
  158. package/lib/esm/tools/retrieve-knowledge.js.map +1 -0
  159. package/lib/esm/types.d.ts +53 -0
  160. package/lib/esm/types.js +3 -0
  161. package/lib/esm/types.js.map +1 -0
  162. package/package.json +10 -12
  163. package/src/index.ts +1 -0
  164. package/src/runners/base-runner.ts +20 -10
  165. package/src/structured-output/do-nothing.ts +12 -0
  166. package/src/structured-output/index.ts +2 -0
  167. package/lib/agents/base-agent.js +0 -66
  168. package/lib/agents/base-agent.js.map +0 -1
  169. package/lib/agents/index.d.ts +0 -2
  170. package/lib/agents/index.js +0 -9
  171. package/lib/agents/index.js.map +0 -1
  172. package/lib/agents/router-agent.js +0 -50
  173. package/lib/agents/router-agent.js.map +0 -1
  174. package/lib/agents/specialist-agent.js.map +0 -1
  175. package/lib/bot-config-tools.js +0 -20
  176. package/lib/bot-config-tools.js.map +0 -1
  177. package/lib/constants.js +0 -26
  178. package/lib/constants.js.map +0 -1
  179. package/lib/debug-logger.js.map +0 -1
  180. package/lib/guardrails/index.d.ts +0 -1
  181. package/lib/guardrails/index.js +0 -6
  182. package/lib/guardrails/index.js.map +0 -1
  183. package/lib/guardrails/input.js +0 -119
  184. package/lib/guardrails/input.js.map +0 -1
  185. package/lib/index.js.map +0 -1
  186. package/lib/llm-config.js +0 -150
  187. package/lib/llm-config.js.map +0 -1
  188. package/lib/runners/base-runner.js.map +0 -1
  189. package/lib/runners/index.d.ts +0 -2
  190. package/lib/runners/index.js +0 -9
  191. package/lib/runners/index.js.map +0 -1
  192. package/lib/runners/router-runner.js.map +0 -1
  193. package/lib/runners/specialist-runner.js +0 -10
  194. package/lib/runners/specialist-runner.js.map +0 -1
  195. package/lib/services/hubtype-api-client.js +0 -191
  196. package/lib/services/hubtype-api-client.js.map +0 -1
  197. package/lib/services/types.js +0 -13
  198. package/lib/services/types.js.map +0 -1
  199. package/lib/structured-output/bot-executor.js +0 -21
  200. package/lib/structured-output/bot-executor.js.map +0 -1
  201. package/lib/structured-output/carousel.js +0 -26
  202. package/lib/structured-output/carousel.js.map +0 -1
  203. package/lib/structured-output/exit.js +0 -14
  204. package/lib/structured-output/exit.js.map +0 -1
  205. package/lib/structured-output/index.js +0 -59
  206. package/lib/structured-output/index.js.map +0 -1
  207. package/lib/structured-output/request-contact-info.js +0 -17
  208. package/lib/structured-output/request-contact-info.js.map +0 -1
  209. package/lib/structured-output/text-with-buttons.js +0 -25
  210. package/lib/structured-output/text-with-buttons.js.map +0 -1
  211. package/lib/structured-output/text.js +0 -17
  212. package/lib/structured-output/text.js.map +0 -1
  213. package/lib/tools/index.js +0 -8
  214. package/lib/tools/index.js.map +0 -1
  215. package/lib/tools/retrieve-knowledge.js +0 -40
  216. package/lib/tools/retrieve-knowledge.js.map +0 -1
  217. package/lib/types.js +0 -5
  218. package/lib/types.js.map +0 -1
  219. /package/lib/{constants.d.ts → cjs/constants.d.ts} +0 -0
  220. /package/lib/{structured-output → cjs/structured-output}/bot-executor.d.ts +0 -0
  221. /package/lib/{structured-output → cjs/structured-output}/carousel.d.ts +0 -0
  222. /package/lib/{structured-output → cjs/structured-output}/exit.d.ts +0 -0
  223. /package/lib/{structured-output → cjs/structured-output}/request-contact-info.d.ts +0 -0
  224. /package/lib/{structured-output → cjs/structured-output}/text-with-buttons.d.ts +0 -0
  225. /package/lib/{structured-output → cjs/structured-output}/text.d.ts +0 -0
@@ -1,17 +0,0 @@
1
- import { OutputMessageType } from "@botonic/core";
2
- import { z } from "zod";
3
-
4
-
5
-
6
-
7
-
8
- const RequestContactInfoSchema = z.object({
9
- type: z.literal(OutputMessageType.RequestContactInfo),
10
- content: z.object({
11
- text: z.string().describe('The text of the message')
12
- })
13
- }).describe('A message to request phone number from the user. Use it only when asked explicitly in the prompt.');
14
-
15
- export { RequestContactInfoSchema };
16
-
17
- //# sourceMappingURL=request-contact-info.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"structured-output/request-contact-info.js","sources":["../../src/structured-output/request-contact-info.ts"],"sourcesContent":["import {\n OutputMessageType,\n type RequestContactInfoMessage,\n} from '@botonic/core'\nimport { z } from 'zod'\n\nexport type { RequestContactInfoMessage }\n\nexport const RequestContactInfoSchema = z\n .object({\n type: z.literal(OutputMessageType.RequestContactInfo),\n content: z.object({\n text: z.string().describe('The text of the message'),\n }),\n })\n .describe(\n 'A message to request phone number from the user. Use it only when asked explicitly in the prompt.'\n )\n"],"names":["OutputMessageType","z","RequestContactInfoSchema"],"mappings":";;;;;AAGsB;AACC;AAIhB,MAAME,wBAAwBA,GAAGD,QAC/B,CAAC;IACN,MAAMA,SAAS,CAACD,oCAAoC;IACpD,SAASC,QAAQ,CAAC;QAChB,MAAMA,QAAQ,GAAG,QAAQ,CAAC;IAC5B;AACF,GACC,QAAQ,CACP,qGACD"}
@@ -1,25 +0,0 @@
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
-
25
- //# sourceMappingURL=text-with-buttons.js.map
@@ -1 +0,0 @@
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,17 +0,0 @@
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
-
17
- //# sourceMappingURL=text.js.map
@@ -1 +0,0 @@
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,8 +0,0 @@
1
-
2
-
3
- const mandatoryTools = [];
4
-
5
- export { mandatoryTools };
6
- export { RETRIEVE_KNOWLEDGE_TOOL_NAME, createRetrieveKnowledge } from "./retrieve-knowledge.js";
7
-
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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,40 +0,0 @@
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;
35
- }
36
- });
37
-
38
- export { RETRIEVE_KNOWLEDGE_TOOL_NAME, createRetrieveKnowledge };
39
-
40
- //# sourceMappingURL=retrieve-knowledge.js.map
@@ -1 +0,0 @@
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"}
package/lib/types.js DELETED
@@ -1,5 +0,0 @@
1
-
2
-
3
- export {};
4
-
5
- //# sourceMappingURL=types.js.map
package/lib/types.js.map DELETED
@@ -1 +0,0 @@
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"}
File without changes