@botonic/react 0.45.0 → 0.46.0-alpha-3

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 (75) hide show
  1. package/lib/cjs/components/system-debug-trace/events/ai-agent/ai-agent.d.ts +4 -0
  2. package/lib/cjs/components/system-debug-trace/events/ai-agent/ai-agent.js +49 -0
  3. package/lib/cjs/components/system-debug-trace/events/ai-agent/ai-agent.js.map +1 -0
  4. package/lib/cjs/components/system-debug-trace/events/ai-agent/executed-tools.d.ts +7 -0
  5. package/lib/cjs/components/system-debug-trace/events/ai-agent/executed-tools.js +21 -0
  6. package/lib/cjs/components/system-debug-trace/events/ai-agent/executed-tools.js.map +1 -0
  7. package/lib/cjs/components/system-debug-trace/events/ai-agent/index.d.ts +2 -0
  8. package/lib/cjs/components/system-debug-trace/events/ai-agent/index.js +6 -0
  9. package/lib/cjs/components/system-debug-trace/events/ai-agent/index.js.map +1 -0
  10. package/lib/cjs/components/system-debug-trace/events/ai-agent/parse-tools.d.ts +9 -0
  11. package/lib/cjs/components/system-debug-trace/events/ai-agent/parse-tools.js +28 -0
  12. package/lib/cjs/components/system-debug-trace/events/ai-agent/parse-tools.js.map +1 -0
  13. package/lib/cjs/components/system-debug-trace/events/{ai-agent.d.ts → ai-agent/types.d.ts} +4 -7
  14. package/lib/cjs/components/system-debug-trace/events/ai-agent/types.js +3 -0
  15. package/lib/cjs/components/system-debug-trace/events/ai-agent/types.js.map +1 -0
  16. package/lib/cjs/components/system-debug-trace/events/components/sources-section.js +7 -1
  17. package/lib/cjs/components/system-debug-trace/events/components/sources-section.js.map +1 -1
  18. package/lib/cjs/components/system-debug-trace/events/constants.d.ts +4 -1
  19. package/lib/cjs/components/system-debug-trace/events/constants.js +4 -1
  20. package/lib/cjs/components/system-debug-trace/events/constants.js.map +1 -1
  21. package/lib/cjs/components/system-debug-trace/styles.d.ts +1 -1
  22. package/lib/cjs/components/system-debug-trace/styles.js +3 -5
  23. package/lib/cjs/components/system-debug-trace/styles.js.map +1 -1
  24. package/lib/cjs/index-types.d.ts +2 -1
  25. package/lib/cjs/index-types.js.map +1 -1
  26. package/lib/cjs/webchat/context/index.js +3 -0
  27. package/lib/cjs/webchat/context/index.js.map +1 -1
  28. package/lib/cjs/webchat/custom-messages/rating/index.js +12 -0
  29. package/lib/cjs/webchat/custom-messages/rating/index.js.map +1 -1
  30. package/lib/esm/components/system-debug-trace/events/ai-agent/ai-agent.d.ts +4 -0
  31. package/lib/esm/components/system-debug-trace/events/ai-agent/ai-agent.js +49 -0
  32. package/lib/esm/components/system-debug-trace/events/ai-agent/ai-agent.js.map +1 -0
  33. package/lib/esm/components/system-debug-trace/events/ai-agent/executed-tools.d.ts +7 -0
  34. package/lib/esm/components/system-debug-trace/events/ai-agent/executed-tools.js +21 -0
  35. package/lib/esm/components/system-debug-trace/events/ai-agent/executed-tools.js.map +1 -0
  36. package/lib/esm/components/system-debug-trace/events/ai-agent/index.d.ts +2 -0
  37. package/lib/esm/components/system-debug-trace/events/ai-agent/index.js +6 -0
  38. package/lib/esm/components/system-debug-trace/events/ai-agent/index.js.map +1 -0
  39. package/lib/esm/components/system-debug-trace/events/ai-agent/parse-tools.d.ts +9 -0
  40. package/lib/esm/components/system-debug-trace/events/ai-agent/parse-tools.js +28 -0
  41. package/lib/esm/components/system-debug-trace/events/ai-agent/parse-tools.js.map +1 -0
  42. package/lib/esm/components/system-debug-trace/events/{ai-agent.d.ts → ai-agent/types.d.ts} +4 -7
  43. package/lib/esm/components/system-debug-trace/events/ai-agent/types.js +3 -0
  44. package/lib/esm/components/system-debug-trace/events/ai-agent/types.js.map +1 -0
  45. package/lib/esm/components/system-debug-trace/events/components/sources-section.js +7 -1
  46. package/lib/esm/components/system-debug-trace/events/components/sources-section.js.map +1 -1
  47. package/lib/esm/components/system-debug-trace/events/constants.d.ts +4 -1
  48. package/lib/esm/components/system-debug-trace/events/constants.js +4 -1
  49. package/lib/esm/components/system-debug-trace/events/constants.js.map +1 -1
  50. package/lib/esm/components/system-debug-trace/styles.d.ts +1 -1
  51. package/lib/esm/components/system-debug-trace/styles.js +3 -5
  52. package/lib/esm/components/system-debug-trace/styles.js.map +1 -1
  53. package/lib/esm/index-types.d.ts +2 -1
  54. package/lib/esm/index-types.js.map +1 -1
  55. package/lib/esm/webchat/context/index.js +3 -0
  56. package/lib/esm/webchat/context/index.js.map +1 -1
  57. package/lib/esm/webchat/custom-messages/rating/index.js +12 -0
  58. package/lib/esm/webchat/custom-messages/rating/index.js.map +1 -1
  59. package/package.json +2 -2
  60. package/src/components/system-debug-trace/events/ai-agent/ai-agent.tsx +130 -0
  61. package/src/components/system-debug-trace/events/ai-agent/executed-tools.tsx +43 -0
  62. package/src/components/system-debug-trace/events/ai-agent/index.ts +2 -0
  63. package/src/components/system-debug-trace/events/ai-agent/parse-tools.ts +31 -0
  64. package/src/components/system-debug-trace/events/ai-agent/types.ts +23 -0
  65. package/src/components/system-debug-trace/events/components/sources-section.tsx +7 -2
  66. package/src/components/system-debug-trace/events/constants.ts +4 -1
  67. package/src/components/system-debug-trace/styles.ts +3 -4
  68. package/src/index-types.ts +2 -0
  69. package/src/webchat/context/index.tsx +3 -0
  70. package/src/webchat/custom-messages/rating/index.tsx +13 -1
  71. package/lib/cjs/components/system-debug-trace/events/ai-agent.js +0 -59
  72. package/lib/cjs/components/system-debug-trace/events/ai-agent.js.map +0 -1
  73. package/lib/esm/components/system-debug-trace/events/ai-agent.js +0 -59
  74. package/lib/esm/components/system-debug-trace/events/ai-agent.js.map +0 -1
  75. package/src/components/system-debug-trace/events/ai-agent.tsx +0 -158
@@ -0,0 +1,4 @@
1
+ import type { DebugEventConfig } from '../../types';
2
+ import type { AiAgentDebugEvent } from './types';
3
+ export declare const AiAgent: ({ tools_executed, input_guardrails_triggered, output_guardrails_triggered, exit, error, messageId, knowledge_base_chunks_with_sources, }: AiAgentDebugEvent) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const getAiAgentEventConfig: (data: AiAgentDebugEvent) => DebugEventConfig;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAiAgentEventConfig = exports.AiAgent = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const core_1 = require("@botonic/core");
6
+ const react_1 = require("react");
7
+ const context_1 = require("../../../../webchat/context");
8
+ const use_knowledge_base_info_1 = require("../../hooks/use-knowledge-base-info");
9
+ const icons_1 = require("../../icons");
10
+ const styles_1 = require("../../styles");
11
+ const components_1 = require("../components");
12
+ const constants_1 = require("../constants");
13
+ const executed_tools_1 = require("./executed-tools");
14
+ const parse_tools_1 = require("./parse-tools");
15
+ const AiAgent = ({ tools_executed, input_guardrails_triggered, output_guardrails_triggered, exit, error, messageId, knowledge_base_chunks_with_sources, }) => {
16
+ const { previewUtils } = (0, react_1.useContext)(context_1.WebchatContext);
17
+ const { otherTools, allSourcesIds, allChunksIds, query } = (0, react_1.useMemo)(() => (0, parse_tools_1.parseTools)(tools_executed), [tools_executed]);
18
+ const { sources: allSources, chunks: allChunks, chunksWithSources, getIconForSourceType, } = (0, use_knowledge_base_info_1.useKnowledgeBaseInfo)({
19
+ sourceIds: allSourcesIds,
20
+ chunkIds: allChunksIds,
21
+ messageId,
22
+ existingChunksWithSources: knowledge_base_chunks_with_sources,
23
+ });
24
+ const handleSeeChunks = () => {
25
+ previewUtils?.onClickOpenChunks?.(chunksWithSources);
26
+ };
27
+ const handleSeeToolDetails = (tool) => {
28
+ const toolExecution = {
29
+ toolName: tool.tool_name,
30
+ toolArguments: tool.tool_arguments ?? {},
31
+ toolResults: tool.tool_results ?? '',
32
+ };
33
+ previewUtils?.onClickOpenToolResults?.(toolExecution);
34
+ };
35
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [query && ((0, jsx_runtime_1.jsxs)(styles_1.StyledDebugDetail, { children: [(0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.QUERY }), (0, jsx_runtime_1.jsxs)(styles_1.StyledDebugValue, { children: ["\"", query, "\""] })] })), (0, jsx_runtime_1.jsx)(components_1.SourcesSection, { sources: allSources, chunks: allChunks, getIconForSourceType: getIconForSourceType, onSeeChunks: handleSeeChunks, label: constants_1.LABELS.KNOWLEDGE_SOURCES }), (0, jsx_runtime_1.jsx)(executed_tools_1.ExecutedTools, { tools: otherTools, onSeeToolDetails: handleSeeToolDetails }), !tools_executed.length && ((0, jsx_runtime_1.jsx)(styles_1.StyledDebugDetail, { children: (0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.NO_TOOLS_EXECUTED }) })), (0, jsx_runtime_1.jsx)(components_1.GuardrailList, { keyPrefix: 'input', guardrails: input_guardrails_triggered }), (0, jsx_runtime_1.jsx)(components_1.GuardrailList, { keyPrefix: 'output', guardrails: output_guardrails_triggered, "$isLastItem": !exit && !error }), exit && ((0, jsx_runtime_1.jsx)(styles_1.StyledDebugDetail, { children: (0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.EXIT }) })), error && ((0, jsx_runtime_1.jsx)(styles_1.StyledDebugDetail, { children: (0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.ERROR }) }))] }));
36
+ };
37
+ exports.AiAgent = AiAgent;
38
+ const getAiAgentEventConfig = (data) => {
39
+ const title = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["AI Agent triggered ", (0, jsx_runtime_1.jsxs)("span", { children: ["- ", data.flow_node_content_id] })] }));
40
+ return {
41
+ action: core_1.EventAction.AiAgent,
42
+ title,
43
+ component: exports.AiAgent,
44
+ icon: (0, jsx_runtime_1.jsx)(icons_1.WandSvg, {}),
45
+ collapsible: true,
46
+ };
47
+ };
48
+ exports.getAiAgentEventConfig = getAiAgentEventConfig;
49
+ //# sourceMappingURL=ai-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-agent.js","s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AAS,EAAE,eAAO;QAClB,IAAI,EAAE,uBAAC,eAAO,KAAG;QACjB,WAAW,EAAE,IAAI;KAClB,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,qBAAqB,yBAgBjC"}
@@ -0,0 +1,7 @@
1
+ import type { ToolExecuted } from './types';
2
+ interface Props {
3
+ tools: ToolExecuted[];
4
+ onSeeToolDetails: (tool: ToolExecuted) => void;
5
+ }
6
+ export declare const ExecutedTools: ({ tools, onSeeToolDetails }: Props) => import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExecutedTools = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
7
+ const icons_1 = require("../../icons");
8
+ const styles_1 = require("../../styles");
9
+ const constants_1 = require("../constants");
10
+ const StyledSeeToolDetailsButton = (0, styled_components_1.default)(styles_1.StyledSeeInfo) `
11
+ flex-shrink: 0;
12
+ border: none;
13
+ `;
14
+ const ExecutedTools = ({ tools, onSeeToolDetails }) => {
15
+ if (!tools.length) {
16
+ return null;
17
+ }
18
+ return ((0, jsx_runtime_1.jsxs)(styles_1.StyledDebugDetail, { children: [(0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.EXECUTED_TOOLS }), tools.map((tool, index) => ((0, jsx_runtime_1.jsxs)(styles_1.StyledDebugItemWithIcon, { children: [(0, jsx_runtime_1.jsx)(icons_1.ScrewdriverWrenchSvg, {}), tool.tool_name, (0, jsx_runtime_1.jsx)(StyledSeeToolDetailsButton, { onClick: () => onSeeToolDetails(tool), children: constants_1.LABELS.SEE_TOOL_DETAILS })] }, `${tool.tool_name}-${index}`)))] }));
19
+ };
20
+ exports.ExecutedTools = ExecutedTools;
21
+ //# sourceMappingURL=executed-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executed-tools.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/ai-agent/executed-tools.tsx"],"names":[],"mappings":";;;;;AAAA,kFAAsC;AACtC,uCAAkD;AAClD,yCAKqB;AACrB,4CAAqC;AAGrC,MAAM,0BAA0B,GAAG,IAAA,2BAAM,EAAC,sBAAa,CAAC,CAAA;;;CAGvD,CAAA;AAOM,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAS,EAAE,EAAE;IAClE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,wBAAC,0BAAiB,eAChB,uBAAC,yBAAgB,cAAE,kBAAM,CAAC,cAAc,GAAoB,EAE3D,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,wBAAC,gCAAuB,eACtB,uBAAC,4BAAoB,KAAG,EACvB,IAAI,CAAC,SAAS,EAEf,uBAAC,0BAA0B,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAC9D,kBAAM,CAAC,gBAAgB,GACG,KAND,GAAG,IAAI,CAAC,SAAS,IAAI,KAAK,EAAE,CAOhC,CAC3B,CAAC,IACgB,CACrB,CAAA;AACH,CAAC,CAAA;AArBY,QAAA,aAAa,iBAqBzB"}
@@ -0,0 +1,2 @@
1
+ export * from './ai-agent';
2
+ export * from './types';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./ai-agent"), exports);
5
+ tslib_1.__exportStar(require("./types"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/ai-agent/index.ts"],"names":[],"mappings":";;;AAAA,qDAA0B;AAC1B,kDAAuB"}
@@ -0,0 +1,9 @@
1
+ import type { ToolExecuted } from './types';
2
+ export declare const RETRIEVE_KNOWLEDGE_TOOL = "retrieve_knowledge";
3
+ export declare function parseTools(tools: ToolExecuted[]): {
4
+ retrieveKnowledgeTools: ToolExecuted[];
5
+ otherTools: ToolExecuted[];
6
+ allSourcesIds: string[];
7
+ allChunksIds: string[];
8
+ query: string | undefined;
9
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RETRIEVE_KNOWLEDGE_TOOL = void 0;
4
+ exports.parseTools = parseTools;
5
+ exports.RETRIEVE_KNOWLEDGE_TOOL = 'retrieve_knowledge';
6
+ function parseTools(tools) {
7
+ const result = {
8
+ retrieveKnowledgeTools: [],
9
+ otherTools: [],
10
+ allSourcesIds: [],
11
+ allChunksIds: [],
12
+ query: undefined,
13
+ };
14
+ for (const tool of tools) {
15
+ if (tool.tool_name !== exports.RETRIEVE_KNOWLEDGE_TOOL) {
16
+ result.otherTools.push(tool);
17
+ continue;
18
+ }
19
+ result.retrieveKnowledgeTools.push(tool);
20
+ if (typeof tool.tool_arguments?.query === 'string') {
21
+ result.query = tool.tool_arguments.query;
22
+ }
23
+ result.allSourcesIds.push(...(tool.knowledgebase_sources_ids ?? []));
24
+ result.allChunksIds.push(...(tool.knowledgebase_chunks_ids ?? []));
25
+ }
26
+ return result;
27
+ }
28
+ //# sourceMappingURL=parse-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-tools.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/ai-agent/parse-tools.ts"],"names":[],"mappings":";;;AAIA,gCA0BC;AA5BY,QAAA,uBAAuB,GAAG,oBAAoB,CAAA;AAE3D,SAAgB,UAAU,CAAC,KAAqB;IAC9C,MAAM,MAAM,GAAG;QACb,sBAAsB,EAAE,EAAoB;QAC5C,UAAU,EAAE,EAAoB;QAChC,aAAa,EAAE,EAAc;QAC7B,YAAY,EAAE,EAAc;QAC5B,KAAK,EAAE,SAA+B;KACvC,CAAA;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,SAAS,KAAK,+BAAuB,EAAE,CAAC;YAC/C,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC5B,SAAQ;QACV,CAAC;QAED,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAExC,IAAI,OAAO,IAAI,CAAC,cAAc,EAAE,KAAK,KAAK,QAAQ,EAAE,CAAC;YACnD,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAA;QAC1C,CAAC;QAED,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC,CAAA;QACpE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAC,CAAA;IACpE,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -1,9 +1,9 @@
1
- import { EventAction } from '@botonic/core';
2
- import type { DebugEventConfig } from '../types';
3
- import type { ChunkIdsGroupedBySourceData } from './knowledge-bases-types';
4
- interface ToolExecuted {
1
+ import type { EventAction } from '@botonic/core';
2
+ import type { ChunkIdsGroupedBySourceData } from '../knowledge-bases-types';
3
+ export interface ToolExecuted {
5
4
  tool_name: string;
6
5
  tool_arguments: Record<string, unknown>;
6
+ tool_results?: string;
7
7
  knowledgebase_sources_ids?: string[];
8
8
  knowledgebase_chunks_ids?: string[];
9
9
  }
@@ -19,6 +19,3 @@ export interface AiAgentDebugEvent {
19
19
  knowledge_base_chunks_with_sources?: ChunkIdsGroupedBySourceData[];
20
20
  messageId?: string;
21
21
  }
22
- export declare const AiAgent: (props: AiAgentDebugEvent) => import("react/jsx-runtime").JSX.Element;
23
- export declare const getAiAgentEventConfig: (data: AiAgentDebugEvent) => DebugEventConfig;
24
- export {};
@@ -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/components/system-debug-trace/events/ai-agent/types.ts"],"names":[],"mappings":""}
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SourcesSection = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
5
7
  const styles_1 = require("../../styles");
6
8
  const constants_1 = require("../constants");
9
+ const StyledSeeChunksButton = (0, styled_components_1.default)(styles_1.StyledSeeInfo) `
10
+ margin-left: 0;
11
+ margin-top: 4px;
12
+ `;
7
13
  const SourcesSection = ({ sources, chunks, getIconForSourceType, onSeeChunks, label = constants_1.LABELS.SOURCES, }) => {
8
14
  if (sources.length === 0) {
9
15
  return null;
@@ -15,7 +21,7 @@ const SourcesSection = ({ sources, chunks, getIconForSourceType, onSeeChunks, la
15
21
  ? source.activeExtractionJob?.url
16
22
  : source.activeExtractionJob?.fileName;
17
23
  return ((0, jsx_runtime_1.jsxs)(styles_1.StyledDebugItemWithIcon, { children: [icon, isUrl ? ((0, jsx_runtime_1.jsx)(styles_1.StyledUrlSourceValue, { href: value ?? '', target: '_blank', rel: 'noopener noreferrer', title: value ?? 'Not detected', children: value })) : ((0, jsx_runtime_1.jsx)(styles_1.StyledFileSourceValue, { children: value }))] }, source.id));
18
- }), chunks.length > 0 && ((0, jsx_runtime_1.jsx)(styles_1.StyledSeeChunksButton, { onClick: onSeeChunks, children: constants_1.LABELS.SEE_CHUNKS_BUTTON }))] }));
24
+ }), chunks.length > 0 && ((0, jsx_runtime_1.jsx)(StyledSeeChunksButton, { onClick: onSeeChunks, children: constants_1.LABELS.SEE_CHUNKS_BUTTON }))] }));
19
25
  };
20
26
  exports.SourcesSection = SourcesSection;
21
27
  //# sourceMappingURL=sources-section.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sources-section.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/components/sources-section.tsx"],"names":[],"mappings":";;;;AAEA,yCAOqB;AACrB,4CAAqC;AAW9B,MAAM,cAAc,GAAG,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,WAAW,EACX,KAAK,GAAG,kBAAM,CAAC,OAAO,GACF,EAAE,EAAE;IACxB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,wBAAC,0BAAiB,eAChB,uBAAC,yBAAgB,cAAE,KAAK,GAAoB,EAC3C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;gBACpB,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAA;gBACzC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,KAAK,KAAK,CAAA;gBACnC,MAAM,KAAK,GAAG,KAAK;oBACjB,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,GAAG;oBACjC,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,QAAQ,CAAA;gBAExC,OAAO,CACL,wBAAC,gCAAuB,eACrB,IAAI,EACJ,KAAK,CAAC,CAAC,CAAC,CACP,uBAAC,6BAAoB,IACnB,IAAI,EAAE,KAAK,IAAI,EAAE,EACjB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,KAAK,EAAE,KAAK,IAAI,cAAc,YAE7B,KAAK,GACe,CACxB,CAAC,CAAC,CAAC,CACF,uBAAC,8BAAqB,cAAE,KAAK,GAAyB,CACvD,KAb2B,MAAM,CAAC,EAAE,CAcb,CAC3B,CAAA;YACH,CAAC,CAAC,EACD,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CACpB,uBAAC,8BAAqB,IAAC,OAAO,EAAE,WAAW,YACxC,kBAAM,CAAC,iBAAiB,GACH,CACzB,IACiB,CACrB,CAAA;AACH,CAAC,CAAA;AA9CY,QAAA,cAAc,kBA8C1B"}
1
+ {"version":3,"file":"sources-section.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/components/sources-section.tsx"],"names":[],"mappings":";;;;;AACA,kFAAsC;AACtC,yCAOqB;AACrB,4CAAqC;AAGrC,MAAM,qBAAqB,GAAG,IAAA,2BAAM,EAAC,sBAAa,CAAC,CAAA;;;CAGlD,CAAA;AAUM,MAAM,cAAc,GAAG,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,WAAW,EACX,KAAK,GAAG,kBAAM,CAAC,OAAO,GACF,EAAE,EAAE;IACxB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,wBAAC,0BAAiB,eAChB,uBAAC,yBAAgB,cAAE,KAAK,GAAoB,EAC3C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;gBACpB,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAA;gBACzC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,KAAK,KAAK,CAAA;gBACnC,MAAM,KAAK,GAAG,KAAK;oBACjB,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,GAAG;oBACjC,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,QAAQ,CAAA;gBAExC,OAAO,CACL,wBAAC,gCAAuB,eACrB,IAAI,EACJ,KAAK,CAAC,CAAC,CAAC,CACP,uBAAC,6BAAoB,IACnB,IAAI,EAAE,KAAK,IAAI,EAAE,EACjB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,KAAK,EAAE,KAAK,IAAI,cAAc,YAE7B,KAAK,GACe,CACxB,CAAC,CAAC,CAAC,CACF,uBAAC,8BAAqB,cAAE,KAAK,GAAyB,CACvD,KAb2B,MAAM,CAAC,EAAE,CAcb,CAC3B,CAAA;YACH,CAAC,CAAC,EACD,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CACpB,uBAAC,qBAAqB,IAAC,OAAO,EAAE,WAAW,YACxC,kBAAM,CAAC,iBAAiB,GACH,CACzB,IACiB,CACrB,CAAA;AACH,CAAC,CAAA;AA9CY,QAAA,cAAc,kBA8C1B"}
@@ -4,8 +4,10 @@ export declare const LABELS: {
4
4
  readonly FAITHFUL_ANSWER: "Faithful answer";
5
5
  readonly QUERY: "Query";
6
6
  readonly SOURCES: "Sources";
7
- readonly KNOWLEDGE_GATHERED: "Knowledge gathered";
7
+ readonly KNOWLEDGE_SOURCES: "Knowledge sources";
8
8
  readonly EXECUTED_TOOLS: "Executed tools";
9
+ readonly TOOL_ARGUMENTS: "Tool arguments";
10
+ readonly TOOL_RESULTS: "Tool results";
9
11
  readonly NO_TOOLS_EXECUTED: "No tools executed";
10
12
  readonly AUTO_ASSIGN_ON: "ON";
11
13
  readonly AUTO_ASSIGN_OFF: "OFF";
@@ -16,6 +18,7 @@ export declare const LABELS: {
16
18
  readonly NOTE: "Note";
17
19
  readonly KNOWLEDGE_BASE_FAIL_REASON: "Knowledge Base Fail Reason";
18
20
  readonly SEE_CHUNKS_BUTTON: "See chunks";
21
+ readonly SEE_TOOL_DETAILS: "Details";
19
22
  readonly STATUS: "Status";
20
23
  readonly YES: "Yes";
21
24
  readonly NO: "No";
@@ -7,8 +7,10 @@ exports.LABELS = {
7
7
  FAITHFUL_ANSWER: 'Faithful answer',
8
8
  QUERY: 'Query',
9
9
  SOURCES: 'Sources',
10
- KNOWLEDGE_GATHERED: 'Knowledge gathered',
10
+ KNOWLEDGE_SOURCES: 'Knowledge sources',
11
11
  EXECUTED_TOOLS: 'Executed tools',
12
+ TOOL_ARGUMENTS: 'Tool arguments',
13
+ TOOL_RESULTS: 'Tool results',
12
14
  NO_TOOLS_EXECUTED: 'No tools executed',
13
15
  AUTO_ASSIGN_ON: 'ON',
14
16
  AUTO_ASSIGN_OFF: 'OFF',
@@ -19,6 +21,7 @@ exports.LABELS = {
19
21
  NOTE: 'Note',
20
22
  KNOWLEDGE_BASE_FAIL_REASON: 'Knowledge Base Fail Reason',
21
23
  SEE_CHUNKS_BUTTON: 'See chunks',
24
+ SEE_TOOL_DETAILS: 'Details',
22
25
  STATUS: 'Status',
23
26
  YES: 'Yes',
24
27
  NO: 'No',
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,KAAK;IACtB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,0BAA0B,EAAE,4BAA4B;IACxD,iBAAiB,EAAE,YAAY;IAC/B,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,kBAAkB;CAC5B,CAAA"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,KAAK;IACtB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,0BAA0B,EAAE,4BAA4B;IACxD,iBAAiB,EAAE,YAAY;IAC/B,gBAAgB,EAAE,SAAS;IAC3B,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,kBAAkB;CAC5B,CAAA"}
@@ -9,7 +9,7 @@ export declare const StyledDebugLabel: import("styled-components").StyledCompone
9
9
  export declare const StyledDebugValue: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
10
  export declare const StyledDebugItemWithIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
11
11
  export declare const StyledDebugMetadata: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
12
- export declare const StyledSeeChunksButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
12
+ export declare const StyledSeeInfo: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
13
13
  interface StyledGuardrailItemProps {
14
14
  $isLastItem?: boolean;
15
15
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StyledUrlSourceValue = exports.StyledFileSourceValue = exports.StyledSourceValue = exports.StyledGuardrailValue = exports.StyledGuardrailLabel = exports.StyledDebugContentWrapper = exports.StyledGuardrailItem = exports.StyledSeeChunksButton = exports.StyledDebugMetadata = exports.StyledDebugItemWithIcon = exports.StyledDebugValue = exports.StyledDebugLabel = exports.StyledDebugDetail = exports.StyledDebugContent = exports.StyledDebugTitle = exports.StyledDebugIcon = exports.StyledDebugArrow = exports.StyledDebugHeader = exports.StyledDebugContainer = void 0;
3
+ exports.StyledUrlSourceValue = exports.StyledFileSourceValue = exports.StyledSourceValue = exports.StyledGuardrailValue = exports.StyledGuardrailLabel = exports.StyledDebugContentWrapper = exports.StyledGuardrailItem = exports.StyledSeeInfo = exports.StyledDebugMetadata = exports.StyledDebugItemWithIcon = exports.StyledDebugValue = exports.StyledDebugLabel = exports.StyledDebugDetail = exports.StyledDebugContent = exports.StyledDebugTitle = exports.StyledDebugIcon = exports.StyledDebugArrow = exports.StyledDebugHeader = exports.StyledDebugContainer = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
6
6
  const constants_1 = require("../../constants");
@@ -169,7 +169,7 @@ exports.StyledDebugMetadata = styled_components_1.default.div `
169
169
  font-weight: 400;
170
170
  }
171
171
  `;
172
- exports.StyledSeeChunksButton = styled_components_1.default.button `
172
+ exports.StyledSeeInfo = styled_components_1.default.button `
173
173
  border: 1px solid #c4c6d0;
174
174
  border-radius: 6px;
175
175
  padding: 8px;
@@ -181,8 +181,6 @@ exports.StyledSeeChunksButton = styled_components_1.default.button `
181
181
  font-weight: 500;
182
182
  line-height: 1.5;
183
183
  cursor: pointer;
184
- margin-left: 0;
185
- margin-top: 4px;
186
184
  display: flex;
187
185
  align-items: center;
188
186
  justify-content: center;
@@ -211,7 +209,7 @@ exports.StyledGuardrailItem = styled_components_1.default.div `
211
209
  exports.StyledDebugContentWrapper = styled_components_1.default.div `
212
210
  display: flex;
213
211
  flex-direction: column;
214
- gap: 8px;
212
+ gap: 16px;
215
213
  position: relative;
216
214
  width: 100%;
217
215
  min-width: 0;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/system-debug-trace/styles.ts"],"names":[],"mappings":";;;;AAAA,kFAAsC;AAEtC,+CAAwC;AAE3B,QAAA,oBAAoB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;sBAOxB,kBAAM,CAAC,WAAW;;;;;;;;;;;;;0BAad,kBAAM,CAAC,GAAG;;;CAGnC,CAAA;AAEY,QAAA,iBAAiB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;;;CAS1C,CAAA;AAEY,QAAA,gBAAgB,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;;;;;;;;;CAY1C,CAAA;AAEY,QAAA,eAAe,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;;;;;;;;;;CAazC,CAAA;AAEY,QAAA,gBAAgB,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;;;;WAOhC,kBAAM,CAAC,IAAI;;;;;;;;CAQrB,CAAA;AAEY,QAAA,kBAAkB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;;;;WAUjC,kBAAM,CAAC,IAAI;CACrB,CAAA;AAEY,QAAA,iBAAiB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;;;;CAU1C,CAAA;AAEY,QAAA,gBAAgB,GAAG,2BAAM,CAAC,MAAM,CAAA;WAClC,kBAAM,CAAC,IAAI;;;;CAIrB,CAAA;AAEY,QAAA,gBAAgB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;WAG/B,kBAAM,CAAC,IAAI;;;;;;;;;;;;;;;;;CAiBrB,CAAA;AAEY,QAAA,uBAAuB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;WAOtC,kBAAM,CAAC,IAAI;;;;;;;;;;;;;;;;;CAiBrB,CAAA;AAEY,QAAA,mBAAmB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;0BAGnB,kBAAM,CAAC,IAAI;WAC1B,kBAAM,C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,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;;;WAGxD,kBAAM,CAAC,IAAI;;;;;;;CAOrB,CAAA;AAEY,QAAA,yBAAyB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;wBAgB3B,kBAAM,CAAC,IAAI;;;;;;;;;0BAST,kBAAM,CAAC,IAAI;;;CAGpC,CAAA;AAEY,QAAA,oBAAoB,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;WAIpC,kBAAM,CAAC,IAAI;CACrB,CAAA;AAEY,QAAA,oBAAoB,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;WAIpC,kBAAM,CAAC,IAAI;CACrB,CAAA;AAEY,QAAA,iBAAiB,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;WAIjC,kBAAM,CAAC,IAAI;CACrB,CAAA;AAEY,QAAA,qBAAqB,GAAG,IAAA,2BAAM,EAAC,yBAAiB,CAAC,CAAA;;;;;;;CAO7D,CAAA;AAEY,QAAA,oBAAoB,GAAG,2BAAM,CAAC,CAAC,CAAA;;;;WAIjC,kBAAM,CAAC,IAAI;;;;;;;;;;;aAWT,kBAAM,CAAC,YAAY;;;;aAInB,kBAAM,CAAC,IAAI;;CAEvB,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { BotContext, BotRequest as CoreBotRequest, Input as CoreInput, InputType as CoreInputType, Route as CoreRoute, Routes as CoreRoutes, Session as CoreSession, SessionUser as CoreSessionUser, ServerConfig } from '@botonic/core';
1
+ import type { BotContext, BotRequest as CoreBotRequest, Input as CoreInput, InputType as CoreInputType, Route as CoreRoute, Routes as CoreRoutes, Session as CoreSession, SessionUser as CoreSessionUser, ServerConfig, ToolExecution } from '@botonic/core';
2
2
  import type React from 'react';
3
3
  import type { BlockInputOption, ButtonProps, ReplyProps, WebchatSettingsProps } from './components';
4
4
  import { ChunkIdsGroupedBySourceData } from './components/system-debug-trace/events/knowledge-bases-types';
@@ -61,6 +61,7 @@ export interface MinimalHubtypeMessage {
61
61
  export interface PreviewUtils {
62
62
  getChunkIdsGroupedBySource: (chunkIds: string[]) => Promise<ChunkIdsGroupedBySourceData[]>;
63
63
  onClickOpenChunks: (chunkIdsGroupedBySource: ChunkIdsGroupedBySourceData[]) => void;
64
+ onClickOpenToolResults: (toolExecution: ToolExecution) => void;
64
65
  getMessageById: (messageId: string) => Promise<MinimalHubtypeMessage>;
65
66
  trackPreviewEventOpened: (eventProperties: Record<string, unknown>) => void;
66
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/index-types.ts"],"names":[],"mappings":";;;AA8JA,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,4BAAiB,CAAA;AACnB,CAAC,EALW,OAAO,uBAAP,OAAO,QAKlB;AAED,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,0BAAgB,CAAA;IAChB,4BAAkB,CAAA;AACpB,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB"}
1
+ {"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/index-types.ts"],"names":[],"mappings":";;;AAgKA,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,4BAAiB,CAAA;AACnB,CAAC,EALW,OAAO,uBAAP,OAAO,QAKlB;AAED,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,0BAAgB,CAAA;IAChB,4BAAkB,CAAA;AACpB,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB"}
@@ -73,6 +73,9 @@ exports.WebchatContext = (0, react_1.createContext)({
73
73
  },
74
74
  webchatState: {},
75
75
  previewUtils: {
76
+ onClickOpenToolResults: () => {
77
+ return;
78
+ },
76
79
  trackPreviewEventOpened: () => {
77
80
  return;
78
81
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webchat/context/index.tsx"],"names":[],"mappings":";;;AAAA,iCAAqC;AAOrC,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AAEN,QAAA,cAAc,GAAG,IAAA,qBAAa,EAAsB;IAC/D,UAAU,EAAE,GAAG,EAAE;QACf,OAAM;IACR,CAAC;IACD,gBAAgB,EAAE,GAAG,EAAE;QACrB,OAAM;IACR,CAAC,EAAE,uGAAuG;IAC1G,YAAY,EAAE,KAAK,IAAI,EAAE;QACvB,OAAM;IACR,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QAChB,OAAM;IACR,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QAChB,OAAM;IACR,CAAC;IACD,mBAAmB,EAAE,GAAG,EAAE;QACxB,OAAM;IACR,CAAC;IACD,iBAAiB,EAAE,GAAG,EAAE;QACtB,OAAM;IACR,CAAC;IACD,qBAAqB,EAAE,GAAG,EAAE;QAC1B,OAAM;IACR,CAAC;IACD,cAAc,EAAE,KAAK,IAAI,EAAE;QACzB,OAAM;IACR,CAAC;IACD,SAAS,EAAE,KAAK,IAAI,EAAE;QACpB,OAAM;IACR,CAAC;IACD,WAAW,EAAE,KAAK,IAAI,EAAE;QACtB,OAAM;IACR,CAAC;IACD,QAAQ,EAAE,KAAK,IAAI,EAAE;QACnB,OAAM;IACR,CAAC;IACD,oBAAoB,EAAE,GAAG,EAAE;QACzB,OAAM;IACR,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAClB,OAAM;IACR,CAAC;IACD,iBAAiB,EAAE,GAAG,EAAE;QACtB,OAAM;IACR,CAAC;IACD,oBAAoB,EAAE,GAAG,EAAE;QACzB,OAAM;IACR,CAAC;IACD,wBAAwB,EAAE,GAAG,EAAE;QAC7B,OAAM;IACR,CAAC;IACD,iBAAiB,EAAE,GAAG,EAAE;QACtB,OAAM;IACR,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAClB,OAAM;IACR,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAClB,OAAM;IACR,CAAC;IACD,UAAU,EAAE,GAAG,EAAE;QACf,OAAM;IACR,CAAC;IACD,wBAAwB,EAAE,GAAG,EAAE;QAC7B,OAAM;IACR,CAAC;IACD,YAAY,EAAE,EAAkB;IAChC,YAAY,EAAE;QACZ,uBAAuB,EAAE,GAAG,EAAE;YAC5B,OAAM;QACR,CAAC;QACD,0BAA0B,EAAE,KAAK,IAAI,EAAE;YACrC,OAAO,EAAmC,CAAA;QAC5C,CAAC;QACD,iBAAiB,EAAE,GAAG,EAAE;YACtB,OAAM;QACR,CAAC;QACD,cAAc,EAAE,KAAK,IAAI,EAAE;YACzB,OAAO,EAA2B,CAAA;QACpC,CAAC;KACF;IAED,UAAU,EAAE,KAAK,IAAI,EAAE;QACrB,OAAM;IACR,CAAC;IACD,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACtC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9B,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAChC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5B,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5C,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webchat/context/index.tsx"],"names":[],"mappings":";;;AAAA,iCAAqC;AAOrC,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AAEN,QAAA,cAAc,GAAG,IAAA,qBAAa,EAAsB;IAC/D,UAAU,EAAE,GAAG,EAAE;QACf,OAAM;IACR,CAAC;IACD,gBAAgB,EAAE,GAAG,EAAE;QACrB,OAAM;IACR,CAAC,EAAE,uGAAuG;IAC1G,YAAY,EAAE,KAAK,IAAI,EAAE;QACvB,OAAM;IACR,CAAC;IACD,WAAW,EAAE,GAA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5C,CAAC;QACD,iBAAiB,EAAE,GAAG,EAAE;YACtB,OAAM;QACR,CAAC;QACD,cAAc,EAAE,KAAK,IAAI,EAAE;YACzB,OAAO,EAA2B,CAAA;QACpC,CAAC;KACF;IAED,UAAU,EAAE,KAAK,IAAI,EAAE;QACrB,OAAM;IACR,CAAC;IACD,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACtC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9B,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAChC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5B,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5C,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA"}
@@ -8,6 +8,17 @@ const components_1 = require("../../../components");
8
8
  const context_1 = require("../../context");
9
9
  const rating_selector_1 = require("./rating-selector");
10
10
  const styles_1 = require("./styles");
11
+ const types_1 = require("./types");
12
+ const ratingValues = {
13
+ [types_1.RatingType.Stars]: [
14
+ '⭐'.repeat(1),
15
+ '⭐'.repeat(2),
16
+ '⭐'.repeat(3),
17
+ '⭐'.repeat(4),
18
+ '⭐'.repeat(5),
19
+ ],
20
+ [types_1.RatingType.Smileys]: ['😠', '🙁', '😐', '🙂', '😄'],
21
+ };
11
22
  const CustomRatingMessage = props => {
12
23
  const { payloads, messageText, buttonText, ratingType, id, valueSent } = props;
13
24
  const { updateCustomMessageProps, sendInput } = (0, react_1.useContext)(context_1.WebchatContext);
@@ -31,6 +42,7 @@ const CustomRatingMessage = props => {
31
42
  const input = {
32
43
  type: core_1.INPUT.POSTBACK,
33
44
  payload,
45
+ referral: ratingValues[ratingType][ratingValue - 1],
34
46
  };
35
47
  void sendInput(input);
36
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/webchat/custom-messages/rating/index.tsx"],"names":[],"m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AAA;QACD,KAAK,SAAS,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC,CAAA;IAED,MAAM,QAAQ,GAAG,WAAW,KAAK,CAAC,CAAC,CAAA;IAEnC,OAAO,CACL,iCAAK,SAAS,EAAC,0BAA0B,aACvC,wBAAC,sBAAa,IAAC,SAAS,EAAC,uBAAuB,aAC7C,WAAW,EACZ,uBAAC,gCAAc,IACb,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,aAAa,EAC7B,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,GACpB,IACY,EACf,CAAC,KAAK,EAAE,SAAS,IAAI,UAAU,IAAI,CAClC,uBAAC,mBAAM,IACL,WAAW,EAAE,IAAI,EACjB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,gBAAgB,YAExB,UAAU,GACJ,CACV,IACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,IAAA,0BAAa,EAAC;IAC3B,IAAI,EAAE,eAAe;IACrB,SAAS,EAAE,mBAAmB;CAC/B,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/webchat/custom-messages/rating/index.tsx"],"names":[],"mappings":";;;AAAA,wCAAqD;AAErD,iCAA4C;AAC5C,yDAAgD;AAEhD,oDAA2D;AAC3D,2CAA8C;AAC9C,uDAAkD;AAClD,qCAAwC;AACxC,mCAAoC;AAWpC,MAAM,YAAY,GAAG;IACnB,CAAC,kBAAU,CAAC,KAAK,CAAC,EAAE;QAClB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACb,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACb,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACb,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACb,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;KACd;IACD,CAAC,kBAAU,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EA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AAC;SACpD,CAAA;QACD,KAAK,SAAS,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC,CAAA;IAED,MAAM,QAAQ,GAAG,WAAW,KAAK,CAAC,CAAC,CAAA;IAEnC,OAAO,CACL,iCAAK,SAAS,EAAC,0BAA0B,aACvC,wBAAC,sBAAa,IAAC,SAAS,EAAC,uBAAuB,aAC7C,WAAW,EACZ,uBAAC,gCAAc,IACb,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,aAAa,EAC7B,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,GACpB,IACY,EACf,CAAC,KAAK,EAAE,SAAS,IAAI,UAAU,IAAI,CAClC,uBAAC,mBAAM,IACL,WAAW,EAAE,IAAI,EACjB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,gBAAgB,YAExB,UAAU,GACJ,CACV,IACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,IAAA,0BAAa,EAAC;IAC3B,IAAI,EAAE,eAAe;IACrB,SAAS,EAAE,mBAAmB;CAC/B,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { DebugEventConfig } from '../../types';
2
+ import type { AiAgentDebugEvent } from './types';
3
+ export declare const AiAgent: ({ tools_executed, input_guardrails_triggered, output_guardrails_triggered, exit, error, messageId, knowledge_base_chunks_with_sources, }: AiAgentDebugEvent) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const getAiAgentEventConfig: (data: AiAgentDebugEvent) => DebugEventConfig;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAiAgentEventConfig = exports.AiAgent = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const core_1 = require("@botonic/core");
6
+ const react_1 = require("react");
7
+ const context_1 = require("../../../../webchat/context");
8
+ const use_knowledge_base_info_1 = require("../../hooks/use-knowledge-base-info");
9
+ const icons_1 = require("../../icons");
10
+ const styles_1 = require("../../styles");
11
+ const components_1 = require("../components");
12
+ const constants_1 = require("../constants");
13
+ const executed_tools_1 = require("./executed-tools");
14
+ const parse_tools_1 = require("./parse-tools");
15
+ const AiAgent = ({ tools_executed, input_guardrails_triggered, output_guardrails_triggered, exit, error, messageId, knowledge_base_chunks_with_sources, }) => {
16
+ const { previewUtils } = (0, react_1.useContext)(context_1.WebchatContext);
17
+ const { otherTools, allSourcesIds, allChunksIds, query } = (0, react_1.useMemo)(() => (0, parse_tools_1.parseTools)(tools_executed), [tools_executed]);
18
+ const { sources: allSources, chunks: allChunks, chunksWithSources, getIconForSourceType, } = (0, use_knowledge_base_info_1.useKnowledgeBaseInfo)({
19
+ sourceIds: allSourcesIds,
20
+ chunkIds: allChunksIds,
21
+ messageId,
22
+ existingChunksWithSources: knowledge_base_chunks_with_sources,
23
+ });
24
+ const handleSeeChunks = () => {
25
+ previewUtils?.onClickOpenChunks?.(chunksWithSources);
26
+ };
27
+ const handleSeeToolDetails = (tool) => {
28
+ const toolExecution = {
29
+ toolName: tool.tool_name,
30
+ toolArguments: tool.tool_arguments ?? {},
31
+ toolResults: tool.tool_results ?? '',
32
+ };
33
+ previewUtils?.onClickOpenToolResults?.(toolExecution);
34
+ };
35
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [query && ((0, jsx_runtime_1.jsxs)(styles_1.StyledDebugDetail, { children: [(0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.QUERY }), (0, jsx_runtime_1.jsxs)(styles_1.StyledDebugValue, { children: ["\"", query, "\""] })] })), (0, jsx_runtime_1.jsx)(components_1.SourcesSection, { sources: allSources, chunks: allChunks, getIconForSourceType: getIconForSourceType, onSeeChunks: handleSeeChunks, label: constants_1.LABELS.KNOWLEDGE_SOURCES }), (0, jsx_runtime_1.jsx)(executed_tools_1.ExecutedTools, { tools: otherTools, onSeeToolDetails: handleSeeToolDetails }), !tools_executed.length && ((0, jsx_runtime_1.jsx)(styles_1.StyledDebugDetail, { children: (0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.NO_TOOLS_EXECUTED }) })), (0, jsx_runtime_1.jsx)(components_1.GuardrailList, { keyPrefix: 'input', guardrails: input_guardrails_triggered }), (0, jsx_runtime_1.jsx)(components_1.GuardrailList, { keyPrefix: 'output', guardrails: output_guardrails_triggered, "$isLastItem": !exit && !error }), exit && ((0, jsx_runtime_1.jsx)(styles_1.StyledDebugDetail, { children: (0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.EXIT }) })), error && ((0, jsx_runtime_1.jsx)(styles_1.StyledDebugDetail, { children: (0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.ERROR }) }))] }));
36
+ };
37
+ exports.AiAgent = AiAgent;
38
+ const getAiAgentEventConfig = (data) => {
39
+ const title = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["AI Agent triggered ", (0, jsx_runtime_1.jsxs)("span", { children: ["- ", data.flow_node_content_id] })] }));
40
+ return {
41
+ action: core_1.EventAction.AiAgent,
42
+ title,
43
+ component: exports.AiAgent,
44
+ icon: (0, jsx_runtime_1.jsx)(icons_1.WandSvg, {}),
45
+ collapsible: true,
46
+ };
47
+ };
48
+ exports.getAiAgentEventConfig = getAiAgentEventConfig;
49
+ //# sourceMappingURL=ai-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-agent.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/ai-agent/ai-agent.tsx"],"names":[],"mappings":";;;;AAAA,wCAA+D;AAC/D,iCAA2C;AAC3C,yDAA4D;AAC5D,iFAA0E;AAC1E,uCAAqC;AACrC,yCAIqB;AAErB,8CAA6D;AAC7D,4CAAqC;AACrC,qDAAgD;AAChD,+CAA0C;AAGnC,MAAM,OAAO,GAAG,CAAC,EACtB,cAAc,EACd,0BAA0B,EAC1B,2BAA2B,EAC3B,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,EAC5B,KAAK,EAAE,kBAAM,CAAC,iBAAiB,GAC/B,EAEF,uBAAC,8BAAa,IACZ,KAAK,EAAE,UAAU,EACjB,gBAAgB,EAAE,oBAAoB,GACtC,EAED,CAAC,cAAc,CAAC,MAAM,IAAI,CACzB,uBAAC,0BAAiB,cAChB,uBAAC,yBAAgB,cAAE,kBAAM,CAAC,iBAAiB,GAAoB,GAC7C,CACrB,EAED,uBAAC,0BAAa,IACZ,SAAS,EAAC,OAAO,EACjB,UAAU,EAAE,0BAA0B,GACtC,EAEF,uBAAC,0BAAa,IACZ,SAAS,EAAC,QAAQ,EAClB,UAAU,EAAE,2BAA2B,iBAC1B,CAAC,IAAI,IAAI,CAAC,KAAK,GAC5B,EAED,IAAI,IAAI,CACP,uBAAC,0BAAiB,cAChB,uBAAC,yBAAgB,cAAE,kBAAM,CAAC,IAAI,GAAoB,GAChC,CACrB,EAEA,KAAK,IAAI,CACR,uBAAC,0BAAiB,cAChB,uBAAC,yBAAgB,cAAE,kBAAM,CAAC,KAAK,GAAoB,GACjC,CACrB,IACA,CACJ,CAAA;AACH,CAAC,CAAA;AA9FY,QAAA,OAAO,WA8FnB;AAEM,MAAM,qBAAqB,GAAG,CACnC,IAAuB,EACL,EAAE;IACpB,MAAM,KAAK,GAAG,CACZ,oFACqB,mDAAS,IAAI,CAAC,oBAAoB,IAAQ,IAC5D,CACJ,CAAA;IAED,OAAO;QACL,MAAM,EAAE,kBAAW,CAAC,OAAO;QAC3B,KAAK;QACL,SAAS,EAAE,eAAO;QAClB,IAAI,EAAE,uBAAC,eAAO,KAAG;QACjB,WAAW,EAAE,IAAI;KAClB,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,qBAAqB,yBAgBjC"}
@@ -0,0 +1,7 @@
1
+ import type { ToolExecuted } from './types';
2
+ interface Props {
3
+ tools: ToolExecuted[];
4
+ onSeeToolDetails: (tool: ToolExecuted) => void;
5
+ }
6
+ export declare const ExecutedTools: ({ tools, onSeeToolDetails }: Props) => import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExecutedTools = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
7
+ const icons_1 = require("../../icons");
8
+ const styles_1 = require("../../styles");
9
+ const constants_1 = require("../constants");
10
+ const StyledSeeToolDetailsButton = (0, styled_components_1.default)(styles_1.StyledSeeInfo) `
11
+ flex-shrink: 0;
12
+ border: none;
13
+ `;
14
+ const ExecutedTools = ({ tools, onSeeToolDetails }) => {
15
+ if (!tools.length) {
16
+ return null;
17
+ }
18
+ return ((0, jsx_runtime_1.jsxs)(styles_1.StyledDebugDetail, { children: [(0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.EXECUTED_TOOLS }), tools.map((tool, index) => ((0, jsx_runtime_1.jsxs)(styles_1.StyledDebugItemWithIcon, { children: [(0, jsx_runtime_1.jsx)(icons_1.ScrewdriverWrenchSvg, {}), tool.tool_name, (0, jsx_runtime_1.jsx)(StyledSeeToolDetailsButton, { onClick: () => onSeeToolDetails(tool), children: constants_1.LABELS.SEE_TOOL_DETAILS })] }, `${tool.tool_name}-${index}`)))] }));
19
+ };
20
+ exports.ExecutedTools = ExecutedTools;
21
+ //# sourceMappingURL=executed-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executed-tools.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/ai-agent/executed-tools.tsx"],"names":[],"mappings":";;;;;AAAA,kFAAsC;AACtC,uCAAkD;AAClD,yCAKqB;AACrB,4CAAqC;AAGrC,MAAM,0BAA0B,GAAG,IAAA,2BAAM,EAAC,sBAAa,CAAC,CAAA;;;CAGvD,CAAA;AAOM,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAS,EAAE,EAAE;IAClE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CACL,wBAAC,0BAAiB,eAChB,uBAAC,yBAAgB,cAAE,kBAAM,CAAC,cAAc,GAAoB,EAE3D,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,wBAAC,gCAAuB,eACtB,uBAAC,4BAAoB,KAAG,EACvB,IAAI,CAAC,SAAS,EAEf,uBAAC,0BAA0B,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAC9D,kBAAM,CAAC,gBAAgB,GACG,KAND,GAAG,IAAI,CAAC,SAAS,IAAI,KAAK,EAAE,CAOhC,CAC3B,CAAC,IACgB,CACrB,CAAA;AACH,CAAC,CAAA;AArBY,QAAA,aAAa,iBAqBzB"}
@@ -0,0 +1,2 @@
1
+ export * from './ai-agent';
2
+ export * from './types';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./ai-agent"), exports);
5
+ tslib_1.__exportStar(require("./types"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/ai-agent/index.ts"],"names":[],"mappings":";;;AAAA,qDAA0B;AAC1B,kDAAuB"}
@@ -0,0 +1,9 @@
1
+ import type { ToolExecuted } from './types';
2
+ export declare const RETRIEVE_KNOWLEDGE_TOOL = "retrieve_knowledge";
3
+ export declare function parseTools(tools: ToolExecuted[]): {
4
+ retrieveKnowledgeTools: ToolExecuted[];
5
+ otherTools: ToolExecuted[];
6
+ allSourcesIds: string[];
7
+ allChunksIds: string[];
8
+ query: string | undefined;
9
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RETRIEVE_KNOWLEDGE_TOOL = void 0;
4
+ exports.parseTools = parseTools;
5
+ exports.RETRIEVE_KNOWLEDGE_TOOL = 'retrieve_knowledge';
6
+ function parseTools(tools) {
7
+ const result = {
8
+ retrieveKnowledgeTools: [],
9
+ otherTools: [],
10
+ allSourcesIds: [],
11
+ allChunksIds: [],
12
+ query: undefined,
13
+ };
14
+ for (const tool of tools) {
15
+ if (tool.tool_name !== exports.RETRIEVE_KNOWLEDGE_TOOL) {
16
+ result.otherTools.push(tool);
17
+ continue;
18
+ }
19
+ result.retrieveKnowledgeTools.push(tool);
20
+ if (typeof tool.tool_arguments?.query === 'string') {
21
+ result.query = tool.tool_arguments.query;
22
+ }
23
+ result.allSourcesIds.push(...(tool.knowledgebase_sources_ids ?? []));
24
+ result.allChunksIds.push(...(tool.knowledgebase_chunks_ids ?? []));
25
+ }
26
+ return result;
27
+ }
28
+ //# sourceMappingURL=parse-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-tools.js","sourceRoot":"","sources":["../../../../../../src/components/system-debug-trace/events/ai-agent/parse-tools.ts"],"names":[],"mappings":";;;AAIA,gCA0BC;AA5BY,QAAA,uBAAuB,GAAG,oBAAoB,CAAA;AAE3D,SAAgB,UAAU,CAAC,KAAqB;IAC9C,MAAM,MAAM,GAAG;QACb,sBAAsB,EAAE,EAAoB;QAC5C,UAAU,EAAE,EAAoB;QAChC,aAAa,EAAE,EAAc;QAC7B,YAAY,EAAE,EAAc;QAC5B,KAAK,EAAE,SAA+B;KACvC,CAAA;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,SAAS,KAAK,+BAAuB,EAAE,CAAC;YAC/C,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC5B,SAAQ;QACV,CAAC;QAED,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAExC,IAAI,OAAO,IAAI,CAAC,cAAc,EAAE,KAAK,KAAK,QAAQ,EAAE,CAAC;YACnD,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAA;QAC1C,CAAC;QAED,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC,CAAA;QACpE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAC,CAAA;IACpE,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -1,9 +1,9 @@
1
- import { EventAction } from '@botonic/core';
2
- import type { DebugEventConfig } from '../types';
3
- import type { ChunkIdsGroupedBySourceData } from './knowledge-bases-types';
4
- interface ToolExecuted {
1
+ import type { EventAction } from '@botonic/core';
2
+ import type { ChunkIdsGroupedBySourceData } from '../knowledge-bases-types';
3
+ export interface ToolExecuted {
5
4
  tool_name: string;
6
5
  tool_arguments: Record<string, unknown>;
6
+ tool_results?: string;
7
7
  knowledgebase_sources_ids?: string[];
8
8
  knowledgebase_chunks_ids?: string[];
9
9
  }
@@ -19,6 +19,3 @@ export interface AiAgentDebugEvent {
19
19
  knowledge_base_chunks_with_sources?: ChunkIdsGroupedBySourceData[];
20
20
  messageId?: string;
21
21
  }
22
- export declare const AiAgent: (props: AiAgentDebugEvent) => import("react/jsx-runtime").JSX.Element;
23
- export declare const getAiAgentEventConfig: (data: AiAgentDebugEvent) => DebugEventConfig;
24
- export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map