@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hubtype-api-client.js","sourceRoot":"","sources":["../../../src/services/hubtype-api-client.ts"],"names":[],"mappings":";;;;AAEA,0DAAyB;AAEzB,4CAA8C;AAa9C,MAAa,gBAAgB;IAG3B,YAAY,SAAiB;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,qBAAqB,CACzB,KAAa,EACb,SAAmB;QAEnB,MAAM,GAAG,GAAG,GAAG,2BAAe,gDAAgD,CAAA;QAC9E,MAAM,OAAO,GAAG;YACd,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,IAAI,CAAC,SAAS,EAAE;SAC1C,CAAA;QACD,MAAM,MAAM,GAAG;YACb,KAAK;YACL,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,CAAC;SACd,CAAA;QACD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;QAC3D,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;YACzD,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC,CAAA;QACH,OAAO,MAAM,CAAA;IACf,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,eAAuB,EACvB,uBAAkD,EAClD,eAAuB;QAEvB,MAAM,iBAAiB,GACrB,OAAO,UAAU,KAAK,WAAW,IAAI,UA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AAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,UAAU,IAAI,CAAC,SAAS,EAAE;aAC1C,CAAA;YACD,MAAM,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAA;QACnD,CAAC;IACH,CAAC;IAEO,aAAa,CAAC,OAAuB;QAC3C,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC5B,OAAO;gBACL,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,MAAM;aACb,CAAA;QACH,CAAC;aAAM,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACxC,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,aAAa;wBACnB,IAAI,EAAE,OAAO,CAAC,OAAO;qBACtB;iBACF;gBACD,MAAM,EAAE,WAAW;aACpB,CAAA;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;CACF;AAhMD,4CAgMC"}
@@ -0,0 +1,72 @@
1
+ import type { HubtypeAssistantMessage, HubtypeUserMessage } from '@botonic/core';
2
+ import type { AgenticInputMessage } from '../types';
3
+ export declare enum TrackProductName {
4
+ AI_AGENT = "ai_agent"
5
+ }
6
+ export declare enum TrackFeature {
7
+ AI_AGENT_RUN = "ai_agent_run",
8
+ AI_AGENT_GUARDRAIL = "ai_agent_guardrail"
9
+ }
10
+ export interface LlmRunData {
11
+ inference_id: string;
12
+ is_test: boolean;
13
+ product_name: string;
14
+ deployment_name: string;
15
+ model_name: string;
16
+ feature: string;
17
+ api_version?: string;
18
+ num_prompt_tokens: number;
19
+ num_completion_tokens: number;
20
+ duration_in_milliseconds: number;
21
+ temperature: number;
22
+ error: string | null;
23
+ }
24
+ export interface TrackLlmRunsData {
25
+ llm_runs: LlmRunData[];
26
+ }
27
+ export type HubtypeMessage = HubtypeAssistantMessage | HubtypeUserMessage;
28
+ interface HubtypeToolCall {
29
+ id: string;
30
+ type: 'function';
31
+ function: {
32
+ name: string;
33
+ arguments: string;
34
+ };
35
+ }
36
+ interface HubtypeUserMessageV2 {
37
+ role: 'user';
38
+ content: string | null;
39
+ }
40
+ export interface HubtypeAssistantMessageV2 {
41
+ role: 'assistant';
42
+ content: string | null;
43
+ tool_calls?: HubtypeToolCall[] | null;
44
+ }
45
+ export interface HubtypeToolMessageV2 {
46
+ role: 'tool';
47
+ content: string | null;
48
+ tool_call_id: string;
49
+ }
50
+ interface HubtypeSystemMessageV2 {
51
+ role: 'system';
52
+ content: string | null;
53
+ }
54
+ export type HubtypeMessageV2 = HubtypeUserMessageV2 | HubtypeAssistantMessageV2 | HubtypeToolMessageV2 | HubtypeSystemMessageV2;
55
+ export interface MessageHistoryResponseV2 {
56
+ messages: HubtypeMessageV2[];
57
+ conversation_id: string | null;
58
+ truncated: boolean;
59
+ }
60
+ export interface GetMessagesV2Result {
61
+ messages: AgenticInputMessage[];
62
+ conversationId: string | null;
63
+ truncated: boolean;
64
+ }
65
+ export interface MessageHistoryV2Params {
66
+ last_message_id: string;
67
+ max_messages?: number;
68
+ include_tool_calls?: boolean;
69
+ max_full_tool_results?: number;
70
+ debug_mode?: boolean;
71
+ }
72
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TrackFeature = exports.TrackProductName = void 0;
4
+ var TrackProductName;
5
+ (function (TrackProductName) {
6
+ TrackProductName["AI_AGENT"] = "ai_agent";
7
+ })(TrackProductName || (exports.TrackProductName = TrackProductName = {}));
8
+ var TrackFeature;
9
+ (function (TrackFeature) {
10
+ TrackFeature["AI_AGENT_RUN"] = "ai_agent_run";
11
+ TrackFeature["AI_AGENT_GUARDRAIL"] = "ai_agent_guardrail";
12
+ })(TrackFeature || (exports.TrackFeature = TrackFeature = {}));
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/types.ts"],"names":[],"mappings":";;;AAGA,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,yCAAqB,CAAA;AACvB,CAAC,EAFW,gBAAgB,gCAAhB,gBAAgB,QAE3B;AAED,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6CAA6B,CAAA;IAC7B,yDAAyC,CAAA;AAC3C,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
@@ -0,0 +1,13 @@
1
+ import { type BotExecutorMessage, OutputMessageType } from '@botonic/core';
2
+ import { z } from 'zod';
3
+ export type { BotExecutorMessage };
4
+ export declare const BotExecutorSchema: z.ZodObject<{
5
+ type: z.ZodLiteral<OutputMessageType.BotExecutor>;
6
+ content: z.ZodObject<{
7
+ text: z.ZodString;
8
+ buttons: z.ZodArray<z.ZodObject<{
9
+ text: z.ZodString;
10
+ payload: z.ZodString;
11
+ }, z.core.$strip>>;
12
+ }, z.core.$strip>;
13
+ }, z.core.$strip>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BotExecutorSchema = void 0;
4
+ const core_1 = require("@botonic/core");
5
+ const zod_1 = require("zod");
6
+ exports.BotExecutorSchema = zod_1.z
7
+ .object({
8
+ type: zod_1.z.literal(core_1.OutputMessageType.BotExecutor),
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
+ payload: zod_1.z.string(),
14
+ })),
15
+ }),
16
+ })
17
+ .describe('A text message with buttons to allow the bot to execute a specific action. Use it only when asked explicitly in the prompt');
18
+ //# sourceMappingURL=bot-executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-executor.js","sourceRoot":"","sources":["../../../src/structured-output/bot-executor.ts"],"names":[],"mappings":";;;AAAA,wCAA0E;AAC1E,6BAAuB;AAIV,QAAA,iBAAiB,GAAG,OAAC;KAC/B,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,WAAW,CAAC;IAC9C,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,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;SACpB,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,4HAA4H,CAC7H,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { type CarouselMessage, OutputMessageType } from '@botonic/core';
2
+ import { z } from 'zod';
3
+ export type { CarouselMessage };
4
+ export declare const CarouselSchema: z.ZodObject<{
5
+ type: z.ZodLiteral<OutputMessageType.Carousel>;
6
+ content: z.ZodObject<{
7
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ elements: z.ZodArray<z.ZodObject<{
9
+ title: z.ZodString;
10
+ subtitle: z.ZodString;
11
+ image: z.ZodString;
12
+ button: z.ZodObject<{
13
+ text: z.ZodString;
14
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ }, z.core.$strip>;
16
+ }, z.core.$strip>>;
17
+ }, z.core.$strip>;
18
+ }, z.core.$strip>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CarouselSchema = void 0;
4
+ const core_1 = require("@botonic/core");
5
+ const zod_1 = require("zod");
6
+ exports.CarouselSchema = zod_1.z
7
+ .object({
8
+ type: zod_1.z.literal(core_1.OutputMessageType.Carousel),
9
+ content: zod_1.z.object({
10
+ text: zod_1.z.string().nullable().optional(),
11
+ elements: zod_1.z.array(zod_1.z.object({
12
+ title: zod_1.z.string(),
13
+ subtitle: zod_1.z.string(),
14
+ image: zod_1.z.string(),
15
+ button: zod_1.z.object({
16
+ text: zod_1.z.string(),
17
+ url: zod_1.z.string().nullable().optional(),
18
+ }),
19
+ })),
20
+ }),
21
+ })
22
+ .describe('A carousel message containing a list of elements');
23
+ //# sourceMappingURL=carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../src/structured-output/carousel.ts"],"names":[],"mappings":";;;AAAA,wCAAuE;AACvE,6BAAuB;AAIV,QAAA,cAAc,GAAG,OAAC;KAC5B,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,QAAQ,CAAC;IAC3C,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACtC,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,MAAM,CAAC;YACP,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;YACpB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;gBACf,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;gBAChB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;aACtC,CAAC;SACH,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CAAC,kDAAkD,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { type DoNothingMessage, OutputMessageType } from '@botonic/core';
2
+ import { z } from 'zod';
3
+ export type { DoNothingMessage };
4
+ export declare const DoNothingSchema: z.ZodObject<{
5
+ type: z.ZodLiteral<OutputMessageType.DoNothing>;
6
+ }, z.core.$strip>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DoNothingSchema = void 0;
4
+ const core_1 = require("@botonic/core");
5
+ const zod_1 = require("zod");
6
+ exports.DoNothingSchema = zod_1.z
7
+ .object({
8
+ type: zod_1.z.literal(core_1.OutputMessageType.DoNothing),
9
+ })
10
+ .describe('A do nothing message is used to end the conversation without send a reply. Use it only when asked explicitly in the prompt.');
11
+ //# sourceMappingURL=do-nothing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"do-nothing.js","sourceRoot":"","sources":["../../../src/structured-output/do-nothing.ts"],"names":[],"mappings":";;;AAAA,wCAAwE;AACxE,6BAAuB;AAIV,QAAA,eAAe,GAAG,OAAC;KAC7B,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,SAAS,CAAC;CAC7C,CAAC;KACD,QAAQ,CACP,6HAA6H,CAC9H,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { type ExitMessage, OutputMessageType } from '@botonic/core';
2
+ import { z } from 'zod';
3
+ export type { ExitMessage };
4
+ export declare const ExitSchema: z.ZodObject<{
5
+ type: z.ZodLiteral<OutputMessageType.Exit>;
6
+ }, z.core.$strip>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExitSchema = void 0;
4
+ const core_1 = require("@botonic/core");
5
+ const zod_1 = require("zod");
6
+ exports.ExitSchema = zod_1.z
7
+ .object({
8
+ type: zod_1.z.literal(core_1.OutputMessageType.Exit),
9
+ })
10
+ .describe('An exit message. This message should only be used to exit the agent due to out of context or the user asking to exit the conversation');
11
+ //# sourceMappingURL=exit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exit.js","sourceRoot":"","sources":["../../../src/structured-output/exit.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;CACxC,CAAC;KACD,QAAQ,CACP,uIAAuI,CACxI,CAAA"}
@@ -0,0 +1,112 @@
1
+ import type { OutputMessage } from '@botonic/core';
2
+ import { z } from 'zod';
3
+ export interface Output {
4
+ messages: OutputMessage[];
5
+ }
6
+ export declare const OutputSchema: z.ZodObject<{
7
+ messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
8
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Text>;
9
+ content: z.ZodObject<{
10
+ text: z.ZodString;
11
+ }, z.core.$strip>;
12
+ }, z.core.$strip>, z.ZodObject<{
13
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.TextWithButtons>;
14
+ content: z.ZodObject<{
15
+ text: z.ZodString;
16
+ buttons: z.ZodArray<z.ZodObject<{
17
+ text: z.ZodString;
18
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
20
+ _blank: "_blank";
21
+ _self: "_self";
22
+ }>>>>;
23
+ }, z.core.$strip>>;
24
+ }, z.core.$strip>;
25
+ }, z.core.$strip>, z.ZodObject<{
26
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Carousel>;
27
+ content: z.ZodObject<{
28
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ elements: z.ZodArray<z.ZodObject<{
30
+ title: z.ZodString;
31
+ subtitle: z.ZodString;
32
+ image: z.ZodString;
33
+ button: z.ZodObject<{
34
+ text: z.ZodString;
35
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ }, z.core.$strip>;
37
+ }, z.core.$strip>>;
38
+ }, z.core.$strip>;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.DoNothing>;
41
+ }, z.core.$strip>, z.ZodObject<{
42
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Exit>;
43
+ }, z.core.$strip>, z.ZodObject<{
44
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.BotExecutor>;
45
+ content: z.ZodObject<{
46
+ text: z.ZodString;
47
+ buttons: z.ZodArray<z.ZodObject<{
48
+ text: z.ZodString;
49
+ payload: z.ZodString;
50
+ }, z.core.$strip>>;
51
+ }, z.core.$strip>;
52
+ }, z.core.$strip>, z.ZodObject<{
53
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.RequestContactInfo>;
54
+ content: z.ZodObject<{
55
+ text: z.ZodString;
56
+ }, z.core.$strip>;
57
+ }, z.core.$strip>]>>;
58
+ }, z.core.$strip>;
59
+ export declare function getOutputSchema(externalOutputMessagesSchemas: z.ZodObject<any>[]): z.ZodObject<{
60
+ messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
61
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Text>;
62
+ content: z.ZodObject<{
63
+ text: z.ZodString;
64
+ }, z.core.$strip>;
65
+ }, z.core.$strip>, z.ZodObject<{
66
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.TextWithButtons>;
67
+ content: z.ZodObject<{
68
+ text: z.ZodString;
69
+ buttons: z.ZodArray<z.ZodObject<{
70
+ text: z.ZodString;
71
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
73
+ _blank: "_blank";
74
+ _self: "_self";
75
+ }>>>>;
76
+ }, z.core.$strip>>;
77
+ }, z.core.$strip>;
78
+ }, z.core.$strip>, z.ZodObject<{
79
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Carousel>;
80
+ content: z.ZodObject<{
81
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ elements: z.ZodArray<z.ZodObject<{
83
+ title: z.ZodString;
84
+ subtitle: z.ZodString;
85
+ image: z.ZodString;
86
+ button: z.ZodObject<{
87
+ text: z.ZodString;
88
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
+ }, z.core.$strip>;
90
+ }, z.core.$strip>>;
91
+ }, z.core.$strip>;
92
+ }, z.core.$strip>, z.ZodObject<{
93
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.DoNothing>;
94
+ }, z.core.$strip>, z.ZodObject<{
95
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Exit>;
96
+ }, z.core.$strip>, z.ZodObject<{
97
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.BotExecutor>;
98
+ content: z.ZodObject<{
99
+ text: z.ZodString;
100
+ buttons: z.ZodArray<z.ZodObject<{
101
+ text: z.ZodString;
102
+ payload: z.ZodString;
103
+ }, z.core.$strip>>;
104
+ }, z.core.$strip>;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ type: z.ZodLiteral<import("@botonic/core").OutputMessageType.RequestContactInfo>;
107
+ content: z.ZodObject<{
108
+ text: z.ZodString;
109
+ }, z.core.$strip>;
110
+ }, z.core.$strip>, ...z.ZodObject<any, z.core.$strip>[]]>>;
111
+ }, z.core.$strip>;
112
+ export declare function getOutputInstructions(): string;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutputSchema = void 0;
4
+ exports.getOutputSchema = getOutputSchema;
5
+ exports.getOutputInstructions = getOutputInstructions;
6
+ const zod_1 = require("zod");
7
+ const bot_executor_1 = require("./bot-executor");
8
+ const carousel_1 = require("./carousel");
9
+ const do_nothing_1 = require("./do-nothing");
10
+ const exit_1 = require("./exit");
11
+ const request_contact_info_1 = require("./request-contact-info");
12
+ const text_1 = require("./text");
13
+ const text_with_buttons_1 = require("./text-with-buttons");
14
+ const baseMessageSchemas = [
15
+ text_1.TextSchema,
16
+ text_with_buttons_1.TextWithButtonsSchema,
17
+ carousel_1.CarouselSchema,
18
+ do_nothing_1.DoNothingSchema,
19
+ exit_1.ExitSchema,
20
+ bot_executor_1.BotExecutorSchema,
21
+ request_contact_info_1.RequestContactInfoSchema,
22
+ ];
23
+ exports.OutputSchema = zod_1.z
24
+ .object({
25
+ messages: zod_1.z.array(zod_1.z.union(baseMessageSchemas)),
26
+ })
27
+ .describe('The messages to be sent to the user');
28
+ function getOutputSchema(externalOutputMessagesSchemas) {
29
+ return zod_1.z.object({
30
+ messages: zod_1.z.array(zod_1.z.union([...baseMessageSchemas, ...externalOutputMessagesSchemas])),
31
+ });
32
+ }
33
+ function getOutputInstructions() {
34
+ const example = {
35
+ messages: [
36
+ {
37
+ type: 'text',
38
+ content: {
39
+ text: 'Hello, how can I help you today?',
40
+ },
41
+ },
42
+ ],
43
+ };
44
+ const output = `Return a JSON that follows the output schema provided. Never return multiple output schemas concatenated by a line break.\n<example>\n${JSON.stringify(example)}\n</example>`;
45
+ return `<output>\n${output}\n</output>`;
46
+ }
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structured-output/index.ts"],"names":[],"mappings":";;;AA6BA,0CAQC;AAED,sDAaC;AAnDD,6BAAuB;AACvB,iDAAkD;AAClD,yCAA2C;AAC3C,6CAA8C;AAC9C,iCAAmC;AACnC,iEAAiE;AACjE,iCAAmC;AACnC,2DAA2D;AAM3D,MAAM,kBAAkB,GAAG;IACzB,iBAAU;IACV,yCAAqB;IACrB,yBAAc;IACd,4BAAe;IACf,iBAAU;IACV,gCAAiB;IACjB,+CAAwB;CAChB,CAAA;AACG,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,CAAC;IACN,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;KACD,QAAQ,CAAC,qCAAqC,CAAC,CAAA;AAElD,SAAgB,eAAe,CAC7B,6BAAiD;IAEjD,OAAO,OAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,KAAK,CAAC,CAAC,GAAG,kBAAkB,EAAE,GAAG,6BAA6B,CAAC,CAAC,CACnE;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAgB,qBAAqB;IACnC,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,kCAAkC;iBACzC;aACF;SACF;KACF,CAAA;IACD,MAAM,MAAM,GAAG,yIAAyI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAA;IAC7L,OAAO,aAAa,MAAM,aAAa,CAAA;AACzC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { OutputMessageType, type RequestContactInfoMessage } from '@botonic/core';
2
+ import { z } from 'zod';
3
+ export type { RequestContactInfoMessage };
4
+ export declare const RequestContactInfoSchema: z.ZodObject<{
5
+ type: z.ZodLiteral<OutputMessageType.RequestContactInfo>;
6
+ content: z.ZodObject<{
7
+ text: z.ZodString;
8
+ }, z.core.$strip>;
9
+ }, z.core.$strip>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequestContactInfoSchema = void 0;
4
+ const core_1 = require("@botonic/core");
5
+ const zod_1 = require("zod");
6
+ exports.RequestContactInfoSchema = zod_1.z
7
+ .object({
8
+ type: zod_1.z.literal(core_1.OutputMessageType.RequestContactInfo),
9
+ content: zod_1.z.object({
10
+ text: zod_1.z.string().describe('The text of the message'),
11
+ }),
12
+ })
13
+ .describe('A message to request phone number from the user. Use it only when asked explicitly in the prompt.');
14
+ //# sourceMappingURL=request-contact-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-contact-info.js","sourceRoot":"","sources":["../../../src/structured-output/request-contact-info.ts"],"names":[],"mappings":";;;AAAA,wCAGsB;AACtB,6BAAuB;AAIV,QAAA,wBAAwB,GAAG,OAAC;KACtC,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAiB,CAAC,kBAAkB,CAAC;IACrD,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;KACrD,CAAC;CACH,CAAC;KACD,QAAQ,CACP,mGAAmG,CACpG,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { OutputMessageType, type TextWithButtonsMessage } from '@botonic/core';
2
+ import { z } from 'zod';
3
+ export type { TextWithButtonsMessage };
4
+ export declare const TextWithButtonsSchema: z.ZodObject<{
5
+ type: z.ZodLiteral<OutputMessageType.TextWithButtons>;
6
+ content: z.ZodObject<{
7
+ text: z.ZodString;
8
+ buttons: z.ZodArray<z.ZodObject<{
9
+ text: z.ZodString;
10
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
12
+ _blank: "_blank";
13
+ _self: "_self";
14
+ }>>>>;
15
+ }, z.core.$strip>>;
16
+ }, z.core.$strip>;
17
+ }, z.core.$strip>;
@@ -0,0 +1,24 @@
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');
24
+ //# sourceMappingURL=text-with-buttons.js.map
@@ -0,0 +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"}
@@ -0,0 +1,9 @@
1
+ import { OutputMessageType, type TextMessage } from '@botonic/core';
2
+ import { z } from 'zod';
3
+ export type { TextMessage };
4
+ export declare const TextSchema: z.ZodObject<{
5
+ type: z.ZodLiteral<OutputMessageType.Text>;
6
+ content: z.ZodObject<{
7
+ text: z.ZodString;
8
+ }, z.core.$strip>;
9
+ }, z.core.$strip>;
@@ -0,0 +1,14 @@
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');
14
+ //# sourceMappingURL=text.js.map
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
1
+ import type { Tool } from '../types';
2
+ export { createRetrieveKnowledge, RETRIEVE_KNOWLEDGE_TOOL_NAME, } from './retrieve-knowledge';
3
+ export declare const mandatoryTools: Tool[];
@@ -0,0 +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 = [];
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"}
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ import type { Context } from '../types';
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<{
5
+ query: z.ZodString;
6
+ }, z.core.$strip>, string>;
@@ -0,0 +1,34 @@
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');
19
+ }
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;
34
+ //# sourceMappingURL=retrieve-knowledge.js.map
@@ -0,0 +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"}
@@ -0,0 +1,53 @@
1
+ import type { AgenticOutputMessage, AiAgentArgs, BotContext, GuardrailRule, InferenceResponse, ResolvedPlugins, RunResult } from '@botonic/core';
2
+ import type { Agent, AgentInputItem, AgentOutputType, RunContext as OpenAIRunContext, Tool as OpenAITool } from '@openai/agents';
3
+ import type { ZodType } from 'zod';
4
+ import type { OutputSchema } from './structured-output';
5
+ export interface Context<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
6
+ authToken: string;
7
+ knowledgeUsed: {
8
+ query: string;
9
+ sourceIds: string[];
10
+ chunksIds: string[];
11
+ chunkTexts: string[];
12
+ };
13
+ request: BotContext<TPlugins, TExtraData>;
14
+ }
15
+ export type RunContext<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = OpenAIRunContext<Context<TPlugins, TExtraData>>;
16
+ export interface CustomTool<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
17
+ name: string;
18
+ description: string;
19
+ schema: ZodType;
20
+ func: (input?: any, runContext?: RunContext<TPlugins, TExtraData>) => Promise<any>;
21
+ }
22
+ export interface Chunk {
23
+ id: string;
24
+ text: string;
25
+ }
26
+ export type Tool<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = OpenAITool<Context<TPlugins, TExtraData>>;
27
+ export type AIAgent<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = Agent<Context<TPlugins, TExtraData>, AgentOutputType<typeof OutputSchema>>;
28
+ export interface MemoryOptions {
29
+ maxMessages: number;
30
+ includeToolCalls: boolean;
31
+ maxFullToolResults: number;
32
+ debugMode: boolean;
33
+ }
34
+ export interface PluginAiAgentOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
35
+ authToken?: string;
36
+ customTools?: CustomTool<TPlugins, TExtraData>[];
37
+ maxRetries?: number;
38
+ timeout?: number;
39
+ memory?: Partial<MemoryOptions>;
40
+ /** Enable debug logging for AI agent configuration and execution details. */
41
+ enableDebug?: boolean;
42
+ /** Key for the local storage to to get messages in local development mode */
43
+ localStorageKey?: string;
44
+ }
45
+ export interface ResultRawResponse {
46
+ usage: {
47
+ inputTokens: number;
48
+ outputTokens: number;
49
+ };
50
+ providerData?: Record<string, unknown>;
51
+ }
52
+ export type AgenticInputMessage = AgentInputItem;
53
+ export type { AgenticOutputMessage, AiAgentArgs, GuardrailRule, InferenceResponse, RunResult, };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}