@botonic/plugin-ai-agents 0.48.1 → 0.49.0-alpha.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 (160) hide show
  1. package/lib/cjs/agents/base-agent.d.ts +28 -0
  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/cjs/agents/router-agent.d.ts +25 -0
  8. package/lib/cjs/agents/router-agent.js +33 -0
  9. package/lib/cjs/agents/router-agent.js.map +1 -0
  10. package/lib/cjs/agents/worker-agent.d.ts +35 -0
  11. package/lib/cjs/{agent-builder.js → agents/worker-agent.js} +48 -49
  12. package/lib/cjs/agents/worker-agent.js.map +1 -0
  13. package/lib/cjs/bot-config-tools.js +3 -4
  14. package/lib/cjs/bot-config-tools.js.map +1 -1
  15. package/lib/cjs/debug-logger.d.ts +1 -1
  16. package/lib/cjs/debug-logger.js +4 -1
  17. package/lib/cjs/debug-logger.js.map +1 -1
  18. package/lib/cjs/guardrails/input.d.ts +1 -1
  19. package/lib/cjs/guardrails/input.js +20 -9
  20. package/lib/cjs/guardrails/input.js.map +1 -1
  21. package/lib/cjs/index.d.ts +4 -1
  22. package/lib/cjs/index.js +112 -51
  23. package/lib/cjs/index.js.map +1 -1
  24. package/lib/cjs/llm-config.d.ts +2 -1
  25. package/lib/cjs/llm-config.js +3 -0
  26. package/lib/cjs/llm-config.js.map +1 -1
  27. package/lib/cjs/runners/base-runner.d.ts +26 -0
  28. package/lib/cjs/runners/base-runner.js +114 -0
  29. package/lib/cjs/runners/base-runner.js.map +1 -0
  30. package/lib/cjs/runners/index.d.ts +2 -0
  31. package/lib/cjs/runners/index.js +8 -0
  32. package/lib/cjs/runners/index.js.map +1 -0
  33. package/lib/cjs/runners/router-runner.d.ts +6 -0
  34. package/lib/cjs/runners/router-runner.js +29 -0
  35. package/lib/cjs/runners/router-runner.js.map +1 -0
  36. package/lib/cjs/runners/worker-runner.d.ts +10 -0
  37. package/lib/cjs/runners/worker-runner.js +78 -0
  38. package/lib/cjs/runners/worker-runner.js.map +1 -0
  39. package/lib/cjs/structured-output/bot-executor.d.ts +6 -42
  40. package/lib/cjs/structured-output/bot-executor.js +9 -9
  41. package/lib/cjs/structured-output/bot-executor.js.map +1 -1
  42. package/lib/cjs/structured-output/carousel.d.ts +6 -78
  43. package/lib/cjs/structured-output/carousel.js +2 -1
  44. package/lib/cjs/structured-output/carousel.js.map +1 -1
  45. package/lib/cjs/structured-output/exit.d.ts +4 -8
  46. package/lib/cjs/structured-output/exit.js +4 -4
  47. package/lib/cjs/structured-output/exit.js.map +1 -1
  48. package/lib/cjs/structured-output/index.d.ts +48 -553
  49. package/lib/cjs/structured-output/index.js +15 -0
  50. package/lib/cjs/structured-output/index.js.map +1 -1
  51. package/lib/cjs/structured-output/text-with-buttons.d.ts +10 -49
  52. package/lib/cjs/structured-output/text-with-buttons.js +10 -10
  53. package/lib/cjs/structured-output/text-with-buttons.js.map +1 -1
  54. package/lib/cjs/structured-output/text.d.ts +4 -18
  55. package/lib/cjs/structured-output/text.js +2 -1
  56. package/lib/cjs/structured-output/text.js.map +1 -1
  57. package/lib/cjs/tools/index.d.ts +1 -1
  58. package/lib/cjs/tools/index.js +3 -2
  59. package/lib/cjs/tools/index.js.map +1 -1
  60. package/lib/cjs/tools/retrieve-knowledge.d.ts +3 -6
  61. package/lib/cjs/tools/retrieve-knowledge.js +7 -5
  62. package/lib/cjs/tools/retrieve-knowledge.js.map +1 -1
  63. package/lib/cjs/types.d.ts +2 -3
  64. package/lib/esm/agents/base-agent.d.ts +28 -0
  65. package/lib/esm/agents/base-agent.js +39 -0
  66. package/lib/esm/agents/base-agent.js.map +1 -0
  67. package/lib/esm/agents/index.d.ts +2 -0
  68. package/lib/esm/agents/index.js +8 -0
  69. package/lib/esm/agents/index.js.map +1 -0
  70. package/lib/esm/agents/router-agent.d.ts +25 -0
  71. package/lib/esm/agents/router-agent.js +33 -0
  72. package/lib/esm/agents/router-agent.js.map +1 -0
  73. package/lib/esm/agents/worker-agent.d.ts +35 -0
  74. package/lib/esm/{agent-builder.js → agents/worker-agent.js} +48 -49
  75. package/lib/esm/agents/worker-agent.js.map +1 -0
  76. package/lib/esm/bot-config-tools.js +3 -4
  77. package/lib/esm/bot-config-tools.js.map +1 -1
  78. package/lib/esm/debug-logger.d.ts +1 -1
  79. package/lib/esm/debug-logger.js +4 -1
  80. package/lib/esm/debug-logger.js.map +1 -1
  81. package/lib/esm/guardrails/input.d.ts +1 -1
  82. package/lib/esm/guardrails/input.js +20 -9
  83. package/lib/esm/guardrails/input.js.map +1 -1
  84. package/lib/esm/index.d.ts +4 -1
  85. package/lib/esm/index.js +112 -51
  86. package/lib/esm/index.js.map +1 -1
  87. package/lib/esm/llm-config.d.ts +2 -1
  88. package/lib/esm/llm-config.js +3 -0
  89. package/lib/esm/llm-config.js.map +1 -1
  90. package/lib/esm/runners/base-runner.d.ts +26 -0
  91. package/lib/esm/runners/base-runner.js +114 -0
  92. package/lib/esm/runners/base-runner.js.map +1 -0
  93. package/lib/esm/runners/index.d.ts +2 -0
  94. package/lib/esm/runners/index.js +8 -0
  95. package/lib/esm/runners/index.js.map +1 -0
  96. package/lib/esm/runners/router-runner.d.ts +6 -0
  97. package/lib/esm/runners/router-runner.js +29 -0
  98. package/lib/esm/runners/router-runner.js.map +1 -0
  99. package/lib/esm/runners/worker-runner.d.ts +10 -0
  100. package/lib/esm/runners/worker-runner.js +78 -0
  101. package/lib/esm/runners/worker-runner.js.map +1 -0
  102. package/lib/esm/structured-output/bot-executor.d.ts +6 -42
  103. package/lib/esm/structured-output/bot-executor.js +9 -9
  104. package/lib/esm/structured-output/bot-executor.js.map +1 -1
  105. package/lib/esm/structured-output/carousel.d.ts +6 -78
  106. package/lib/esm/structured-output/carousel.js +2 -1
  107. package/lib/esm/structured-output/carousel.js.map +1 -1
  108. package/lib/esm/structured-output/exit.d.ts +4 -8
  109. package/lib/esm/structured-output/exit.js +4 -4
  110. package/lib/esm/structured-output/exit.js.map +1 -1
  111. package/lib/esm/structured-output/index.d.ts +48 -553
  112. package/lib/esm/structured-output/index.js +15 -0
  113. package/lib/esm/structured-output/index.js.map +1 -1
  114. package/lib/esm/structured-output/text-with-buttons.d.ts +10 -49
  115. package/lib/esm/structured-output/text-with-buttons.js +10 -10
  116. package/lib/esm/structured-output/text-with-buttons.js.map +1 -1
  117. package/lib/esm/structured-output/text.d.ts +4 -18
  118. package/lib/esm/structured-output/text.js +2 -1
  119. package/lib/esm/structured-output/text.js.map +1 -1
  120. package/lib/esm/tools/index.d.ts +1 -1
  121. package/lib/esm/tools/index.js +3 -2
  122. package/lib/esm/tools/index.js.map +1 -1
  123. package/lib/esm/tools/retrieve-knowledge.d.ts +3 -6
  124. package/lib/esm/tools/retrieve-knowledge.js +7 -5
  125. package/lib/esm/tools/retrieve-knowledge.js.map +1 -1
  126. package/lib/esm/types.d.ts +2 -3
  127. package/package.json +5 -6
  128. package/src/agents/base-agent.ts +75 -0
  129. package/src/agents/index.ts +2 -0
  130. package/src/agents/router-agent.ts +71 -0
  131. package/src/{agent-builder.ts → agents/worker-agent.ts} +75 -77
  132. package/src/bot-config-tools.ts +3 -4
  133. package/src/debug-logger.ts +10 -4
  134. package/src/guardrails/input.ts +26 -9
  135. package/src/index.ts +216 -82
  136. package/src/llm-config.ts +5 -0
  137. package/src/runners/base-runner.ts +190 -0
  138. package/src/runners/index.ts +2 -0
  139. package/src/runners/router-runner.ts +41 -0
  140. package/src/runners/worker-runner.ts +112 -0
  141. package/src/structured-output/bot-executor.ts +3 -3
  142. package/src/structured-output/carousel.ts +2 -2
  143. package/src/structured-output/exit.ts +3 -3
  144. package/src/structured-output/index.ts +15 -0
  145. package/src/structured-output/text-with-buttons.ts +3 -3
  146. package/src/structured-output/text.ts +2 -2
  147. package/src/tools/index.ts +4 -1
  148. package/src/tools/retrieve-knowledge.ts +32 -29
  149. package/src/types.ts +2 -3
  150. package/lib/cjs/agent-builder.d.ts +0 -37
  151. package/lib/cjs/agent-builder.js.map +0 -1
  152. package/lib/cjs/runner.d.ts +0 -18
  153. package/lib/cjs/runner.js +0 -180
  154. package/lib/cjs/runner.js.map +0 -1
  155. package/lib/esm/agent-builder.d.ts +0 -37
  156. package/lib/esm/agent-builder.js.map +0 -1
  157. package/lib/esm/runner.d.ts +0 -18
  158. package/lib/esm/runner.js +0 -180
  159. package/lib/esm/runner.js.map +0 -1
  160. package/src/runner.ts +0 -283
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-runner.js","sourceRoot":"","sources":["../../../src/runners/router-runner.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AAIxC,+CAA6D;AAE7D,MAAa,YAGX,SAAQ,wBAAgC;IACrB,cAAc,CAC/B,MAAoB,EACpB,OAAsC,EACtC,YAAoB;QAEpB,MAAM,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;QAEhE,MAAM,oBAAoB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAC1D,CAAC,KAA0C,EAAE,EAAE;YAC7C,MAAM,SAAS,GAAG,KAAK,YAAY,gBAAO,CAAA;YAC1C,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAE,KAAyB,CAAA;YAClE,MAAM,WAAW,GAAG,SAAS;gBAC3B,CAAC,CAAC,KAAK,CAAC,eAAe;gBACvB,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAA;YAC5B,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,CAAA;QAC1C,CAAC,CACF,CAAA;QAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAA;QAC/C,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAA;QAElD,OAAO;YACL,GAAG,IAAI;YACP,iBAAiB;YACjB,aAAa;YACb,oBAAoB;YACpB,yBAAyB,EAAE,iBAAiB,KAAK,aAAa;SAC/D,CAAA;IACH,CAAC;CACF;AAjCD,oCAiCC"}
@@ -0,0 +1,10 @@
1
+ import type { ResolvedPlugins, ToolExecution } from '@botonic/core';
2
+ import type { Context } from '../types';
3
+ import { BaseRunner, type RunnerResult } from './base-runner';
4
+ export declare class WorkerRunner<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = unknown> extends BaseRunner<TPlugins, TExtraData> {
5
+ protected getToolsExecuted(result: RunnerResult, context: Context<TPlugins, TExtraData>): ToolExecution[];
6
+ private getToolResultsByCallId;
7
+ private extractToolResult;
8
+ private getToolExecutionInfo;
9
+ private getSafeToolArguments;
10
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkerRunner = void 0;
4
+ const agents_1 = require("@openai/agents");
5
+ const tools_1 = require("../tools");
6
+ const base_runner_1 = require("./base-runner");
7
+ class WorkerRunner extends base_runner_1.BaseRunner {
8
+ getToolsExecuted(result, context) {
9
+ const toolResultsByCallId = this.getToolResultsByCallId(result.newItems);
10
+ return (result.newItems
11
+ ?.filter(item => item instanceof agents_1.RunToolCallItem)
12
+ .map((item) => this.getToolExecutionInfo(item, context, toolResultsByCallId))
13
+ .filter((toolExecution) => toolExecution.toolName !== '') || []);
14
+ }
15
+ getToolResultsByCallId(newItems = []) {
16
+ const map = new Map();
17
+ for (const item of newItems) {
18
+ if (!(item instanceof agents_1.RunToolCallOutputItem)) {
19
+ continue;
20
+ }
21
+ const rawItem = item.rawItem;
22
+ const callId = rawItem?.callId;
23
+ const output = rawItem?.output;
24
+ if (callId == null || output == null) {
25
+ continue;
26
+ }
27
+ const text = this.extractToolResult(output);
28
+ if (text != null) {
29
+ map.set(callId, text);
30
+ }
31
+ }
32
+ return map;
33
+ }
34
+ extractToolResult(output) {
35
+ if (typeof output === 'string') {
36
+ return output;
37
+ }
38
+ return output?.type === 'text' && typeof output?.text === 'string'
39
+ ? output.text
40
+ : undefined;
41
+ }
42
+ getToolExecutionInfo(item, context, toolResultsByCallId) {
43
+ if (item.rawItem.type !== 'function_call') {
44
+ return {
45
+ toolName: '',
46
+ toolArguments: {},
47
+ };
48
+ }
49
+ const toolName = item.rawItem.name;
50
+ const toolArguments = this.getSafeToolArguments(item.rawItem.arguments);
51
+ const toolResults = item.rawItem.callId
52
+ ? toolResultsByCallId.get(item.rawItem.callId)
53
+ : undefined;
54
+ const toolExecution = {
55
+ toolName,
56
+ toolArguments,
57
+ toolResults,
58
+ };
59
+ if (toolName === tools_1.RETRIEVE_KNOWLEDGE_TOOL_NAME) {
60
+ return {
61
+ ...toolExecution,
62
+ knowledgebaseSourcesIds: context.knowledgeUsed.sourceIds,
63
+ knowledgebaseChunksIds: context.knowledgeUsed.chunksIds,
64
+ };
65
+ }
66
+ return toolExecution;
67
+ }
68
+ getSafeToolArguments(rawToolArguments) {
69
+ try {
70
+ return JSON.parse(rawToolArguments);
71
+ }
72
+ catch (_error) {
73
+ return {};
74
+ }
75
+ }
76
+ }
77
+ exports.WorkerRunner = WorkerRunner;
78
+ //# sourceMappingURL=worker-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-runner.js","sourceRoot":"","sources":["../../../src/runners/worker-runner.ts"],"names":[],"mappings":";;;AACA,2CAAuE;AACvE,oCAAuD;AAEvD,+CAA6D;AAE7D,MAAa,YAGX,SAAQ,wBAAgC;IAC9B,gBAAgB,CACxB,MAAoB,EACpB,OAAsC;QAEtC,MAAM,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAExE,OAAO,CACL,MAAM,CAAC,QAAQ;YACb,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,YAAY,wBAAe,CAAC;aAChD,GAAG,CAAC,CAAC,IAAqB,EAAE,EAAE,CAC7B,IAAI,CAAC,oBAAoB,CACvB,IAAuB,EACvB,OAAO,EACP,mBAAmB,CACpB,CACF;aACA,MAAM,CACL,CAAC,aAA4B,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,KAAK,EAAE,CAChE,IAAI,EAAE,CACV,CAAA;IACH,CAAC;IAEO,sBAAsB,CAC5B,WAAsB,EAAE;QAExB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAA;QACrC,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,IAAI,CAAC,CAAC,IAAI,YAAY,8BAAqB,CAAC,EAAE,CAAC;gBAC7C,SAAQ;YACV,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,CAAC,OAGpB,CAAA;YACD,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAA;YAC9B,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAA;YAC9B,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;gBACrC,SAAQ;YACV,CAAC;YACD,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;YAC3C,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;gBACjB,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YACvB,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IAEO,iBAAiB,CACvB,MAAiD;QAEjD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,MAAM,CAAA;QACf,CAAC;QACD,OAAO,MAAM,EAAE,IAAI,KAAK,MAAM,IAAI,OAAO,MAAM,EAAE,IAAI,KAAK,QAAQ;YAChE,CAAC,CAAC,MAAM,CAAC,IAAI;YACb,CAAC,CAAC,SAAS,CAAA;IACf,CAAC;IAEO,oBAAoB,CAC1B,IAAqB,EACrB,OAAsC,EACtC,mBAAwC;QAExC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YAC1C,OAAO;gBACL,QAAQ,EAAE,EAAE;gBACZ,aAAa,EAAE,EAAE;aAClB,CAAA;QACH,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QAClC,MAAM,aAAa,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QACvE,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM;YACrC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YAC9C,CAAC,CAAC,SAAS,CAAA;QAEb,MAAM,aAAa,GAAkB;YACnC,QAAQ;YACR,aAAa;YACb,WAAW;SACZ,CAAA;QAED,IAAI,QAAQ,KAAK,oCAA4B,EAAE,CAAC;YAC9C,OAAO;gBACL,GAAG,aAAa;gBAChB,uBAAuB,EAAE,OAAO,CAAC,aAAa,CAAC,SAAS;gBACxD,sBAAsB,EAAE,OAAO,CAAC,aAAa,CAAC,SAAS;aACxD,CAAA;QACH,CAAC;QAED,OAAO,aAAa,CAAA;IACtB,CAAC;IAEO,oBAAoB,CAC1B,gBAAwB;QAExB,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;QACrC,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YAChB,OAAO,EAAE,CAAA;QACX,CAAC;IACH,CAAC;CACF;AAzGD,oCAyGC"}
@@ -1,49 +1,13 @@
1
- import type { BotExecutorMessage } from '@botonic/core';
2
- import z from 'zod';
1
+ import { type BotExecutorMessage, OutputMessageType } from '@botonic/core';
2
+ import { z } from 'zod';
3
3
  export type { BotExecutorMessage };
4
4
  export declare const BotExecutorSchema: z.ZodObject<{
5
- type: z.ZodEnum<["botExecutor"]>;
5
+ type: z.ZodLiteral<OutputMessageType.BotExecutor>;
6
6
  content: z.ZodObject<{
7
7
  text: z.ZodString;
8
8
  buttons: z.ZodArray<z.ZodObject<{
9
9
  text: z.ZodString;
10
10
  payload: z.ZodString;
11
- }, "strip", z.ZodTypeAny, {
12
- text: string;
13
- payload: string;
14
- }, {
15
- text: string;
16
- payload: string;
17
- }>, "many">;
18
- }, "strip", z.ZodTypeAny, {
19
- text: string;
20
- buttons: {
21
- text: string;
22
- payload: string;
23
- }[];
24
- }, {
25
- text: string;
26
- buttons: {
27
- text: string;
28
- payload: string;
29
- }[];
30
- }>;
31
- }, "strip", z.ZodTypeAny, {
32
- type: "botExecutor";
33
- content: {
34
- text: string;
35
- buttons: {
36
- text: string;
37
- payload: string;
38
- }[];
39
- };
40
- }, {
41
- type: "botExecutor";
42
- content: {
43
- text: string;
44
- buttons: {
45
- text: string;
46
- payload: string;
47
- }[];
48
- };
49
- }>;
11
+ }, z.core.$strip>>;
12
+ }, z.core.$strip>;
13
+ }, z.core.$strip>;
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BotExecutorSchema = void 0;
4
- const tslib_1 = require("tslib");
5
- const zod_1 = tslib_1.__importDefault(require("zod"));
6
- exports.BotExecutorSchema = zod_1.default
4
+ const core_1 = require("@botonic/core");
5
+ const zod_1 = require("zod");
6
+ exports.BotExecutorSchema = zod_1.z
7
7
  .object({
8
- type: zod_1.default.enum(['botExecutor']),
9
- content: zod_1.default.object({
10
- text: zod_1.default.string(),
11
- buttons: zod_1.default.array(zod_1.default.object({
12
- text: zod_1.default.string(),
13
- payload: zod_1.default.string(),
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
14
  })),
15
15
  }),
16
16
  })
@@ -1 +1 @@
1
- {"version":3,"file":"bot-executor.js","sourceRoot":"","sources":["../../../src/structured-output/bot-executor.ts"],"names":[],"mappings":";;;;AACA,sDAAmB;AAIN,QAAA,iBAAiB,GAAG,aAAC;KAC/B,MAAM,CAAC;IACN,IAAI,EAAE,aAAC,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,CAAC;IAC7B,OAAO,EAAE,aAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,aAAC,CAAC,KAAK,CACd,aAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;YAChB,OAAO,EAAE,aAAC,CAAC,MAAM,EAAE;SACpB,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,4HAA4H,CAC7H,CAAA"}
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"}
@@ -1,8 +1,8 @@
1
- import type { CarouselMessage } from '@botonic/core';
1
+ import { type CarouselMessage, OutputMessageType } from '@botonic/core';
2
2
  import { z } from 'zod';
3
3
  export type { CarouselMessage };
4
4
  export declare const CarouselSchema: z.ZodObject<{
5
- type: z.ZodEnum<["carousel"]>;
5
+ type: z.ZodLiteral<OutputMessageType.Carousel>;
6
6
  content: z.ZodObject<{
7
7
  text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
8
  elements: z.ZodArray<z.ZodObject<{
@@ -12,79 +12,7 @@ export declare const CarouselSchema: z.ZodObject<{
12
12
  button: z.ZodObject<{
13
13
  text: z.ZodString;
14
14
  url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
- }, "strip", z.ZodTypeAny, {
16
- text: string;
17
- url?: string | null | undefined;
18
- }, {
19
- text: string;
20
- url?: string | null | undefined;
21
- }>;
22
- }, "strip", z.ZodTypeAny, {
23
- title: string;
24
- subtitle: string;
25
- image: string;
26
- button: {
27
- text: string;
28
- url?: string | null | undefined;
29
- };
30
- }, {
31
- title: string;
32
- subtitle: string;
33
- image: string;
34
- button: {
35
- text: string;
36
- url?: string | null | undefined;
37
- };
38
- }>, "many">;
39
- }, "strip", z.ZodTypeAny, {
40
- elements: {
41
- title: string;
42
- subtitle: string;
43
- image: string;
44
- button: {
45
- text: string;
46
- url?: string | null | undefined;
47
- };
48
- }[];
49
- text?: string | null | undefined;
50
- }, {
51
- elements: {
52
- title: string;
53
- subtitle: string;
54
- image: string;
55
- button: {
56
- text: string;
57
- url?: string | null | undefined;
58
- };
59
- }[];
60
- text?: string | null | undefined;
61
- }>;
62
- }, "strip", z.ZodTypeAny, {
63
- type: "carousel";
64
- content: {
65
- elements: {
66
- title: string;
67
- subtitle: string;
68
- image: string;
69
- button: {
70
- text: string;
71
- url?: string | null | undefined;
72
- };
73
- }[];
74
- text?: string | null | undefined;
75
- };
76
- }, {
77
- type: "carousel";
78
- content: {
79
- elements: {
80
- title: string;
81
- subtitle: string;
82
- image: string;
83
- button: {
84
- text: string;
85
- url?: string | null | undefined;
86
- };
87
- }[];
88
- text?: string | null | undefined;
89
- };
90
- }>;
15
+ }, z.core.$strip>;
16
+ }, z.core.$strip>>;
17
+ }, z.core.$strip>;
18
+ }, z.core.$strip>;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CarouselSchema = void 0;
4
+ const core_1 = require("@botonic/core");
4
5
  const zod_1 = require("zod");
5
6
  exports.CarouselSchema = zod_1.z
6
7
  .object({
7
- type: zod_1.z.enum(['carousel']),
8
+ type: zod_1.z.literal(core_1.OutputMessageType.Carousel),
8
9
  content: zod_1.z.object({
9
10
  text: zod_1.z.string().nullable().optional(),
10
11
  elements: zod_1.z.array(zod_1.z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../src/structured-output/carousel.ts"],"names":[],"mappings":";;;AACA,6BAAuB;AAIV,QAAA,cAAc,GAAG,OAAC;KAC5B,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC;IAC1B,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"}
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"}
@@ -1,10 +1,6 @@
1
- import type { ExitMessage } from '@botonic/core';
2
- import z from 'zod';
1
+ import { type ExitMessage, OutputMessageType } from '@botonic/core';
2
+ import { z } from 'zod';
3
3
  export type { ExitMessage };
4
4
  export declare const ExitSchema: z.ZodObject<{
5
- type: z.ZodEnum<["exit"]>;
6
- }, "strip", z.ZodTypeAny, {
7
- type: "exit";
8
- }, {
9
- type: "exit";
10
- }>;
5
+ type: z.ZodLiteral<OutputMessageType.Exit>;
6
+ }, z.core.$strip>;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExitSchema = void 0;
4
- const tslib_1 = require("tslib");
5
- const zod_1 = tslib_1.__importDefault(require("zod"));
6
- exports.ExitSchema = zod_1.default
4
+ const core_1 = require("@botonic/core");
5
+ const zod_1 = require("zod");
6
+ exports.ExitSchema = zod_1.z
7
7
  .object({
8
- type: zod_1.default.enum(['exit']),
8
+ type: zod_1.z.literal(core_1.OutputMessageType.Exit),
9
9
  })
10
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
11
  //# sourceMappingURL=exit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exit.js","sourceRoot":"","sources":["../../../src/structured-output/exit.ts"],"names":[],"mappings":";;;;AACA,sDAAmB;AAIN,QAAA,UAAU,GAAG,aAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,aAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;CACvB,CAAC;KACD,QAAQ,CACP,uIAAuI,CACxI,CAAA"}
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"}