@botonic/react 0.48.0 → 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 (101) hide show
  1. package/lib/cjs/components/button/index.js +3 -2
  2. package/lib/cjs/components/button/index.js.map +1 -1
  3. package/lib/cjs/components/system-debug-trace/debug-message.js +2 -0
  4. package/lib/cjs/components/system-debug-trace/debug-message.js.map +1 -1
  5. package/lib/cjs/components/system-debug-trace/events/ai-agent/ai-agent.js +1 -1
  6. package/lib/cjs/components/system-debug-trace/events/ai-agent/ai-agent.js.map +1 -1
  7. package/lib/cjs/components/system-debug-trace/events/ai-agent/parse-tools.d.ts +1 -1
  8. package/lib/cjs/components/system-debug-trace/events/ai-agent/parse-tools.js +6 -2
  9. package/lib/cjs/components/system-debug-trace/events/ai-agent/parse-tools.js.map +1 -1
  10. package/lib/cjs/components/system-debug-trace/events/ai-agent-router/ai-agent-router.d.ts +4 -0
  11. package/lib/cjs/components/system-debug-trace/events/ai-agent-router/ai-agent-router.js +23 -0
  12. package/lib/cjs/components/system-debug-trace/events/ai-agent-router/ai-agent-router.js.map +1 -0
  13. package/lib/cjs/components/system-debug-trace/events/ai-agent-router/index.d.ts +2 -0
  14. package/lib/cjs/components/system-debug-trace/events/ai-agent-router/index.js +6 -0
  15. package/lib/cjs/components/system-debug-trace/events/ai-agent-router/index.js.map +1 -0
  16. package/lib/cjs/components/system-debug-trace/events/ai-agent-router/types.d.ts +23 -0
  17. package/lib/cjs/components/system-debug-trace/events/ai-agent-router/types.js +3 -0
  18. package/lib/cjs/components/system-debug-trace/events/ai-agent-router/types.js.map +1 -0
  19. package/lib/cjs/components/system-debug-trace/events/constants.d.ts +4 -0
  20. package/lib/cjs/components/system-debug-trace/events/constants.js +4 -0
  21. package/lib/cjs/components/system-debug-trace/events/constants.js.map +1 -1
  22. package/lib/cjs/components/system-debug-trace/events/index.d.ts +1 -0
  23. package/lib/cjs/components/system-debug-trace/events/index.js +1 -0
  24. package/lib/cjs/components/system-debug-trace/events/index.js.map +1 -1
  25. package/lib/cjs/components/system-debug-trace/hooks/use-last-label-position.js +36 -28
  26. package/lib/cjs/components/system-debug-trace/hooks/use-last-label-position.js.map +1 -1
  27. package/lib/cjs/components/system-debug-trace/icons/ai-router.d.ts +1 -0
  28. package/lib/cjs/components/system-debug-trace/icons/ai-router.js +11 -0
  29. package/lib/cjs/components/system-debug-trace/icons/ai-router.js.map +1 -0
  30. package/lib/cjs/components/system-debug-trace/icons/index.d.ts +2 -0
  31. package/lib/cjs/components/system-debug-trace/icons/index.js +2 -0
  32. package/lib/cjs/components/system-debug-trace/icons/index.js.map +1 -1
  33. package/lib/cjs/components/system-debug-trace/types.d.ts +2 -2
  34. package/lib/cjs/debug-system-messages.d.ts +198 -0
  35. package/lib/cjs/debug-system-messages.js +240 -0
  36. package/lib/cjs/debug-system-messages.js.map +1 -0
  37. package/lib/cjs/dev-app.d.ts +199 -0
  38. package/lib/cjs/dev-app.js +22 -0
  39. package/lib/cjs/dev-app.js.map +1 -1
  40. package/lib/cjs/index.d.ts +1 -0
  41. package/lib/cjs/index.js +3 -1
  42. package/lib/cjs/index.js.map +1 -1
  43. package/lib/esm/components/button/index.js +3 -2
  44. package/lib/esm/components/button/index.js.map +1 -1
  45. package/lib/esm/components/system-debug-trace/debug-message.js +2 -0
  46. package/lib/esm/components/system-debug-trace/debug-message.js.map +1 -1
  47. package/lib/esm/components/system-debug-trace/events/ai-agent/ai-agent.js +1 -1
  48. package/lib/esm/components/system-debug-trace/events/ai-agent/ai-agent.js.map +1 -1
  49. package/lib/esm/components/system-debug-trace/events/ai-agent/parse-tools.d.ts +1 -1
  50. package/lib/esm/components/system-debug-trace/events/ai-agent/parse-tools.js +6 -2
  51. package/lib/esm/components/system-debug-trace/events/ai-agent/parse-tools.js.map +1 -1
  52. package/lib/esm/components/system-debug-trace/events/ai-agent-router/ai-agent-router.d.ts +4 -0
  53. package/lib/esm/components/system-debug-trace/events/ai-agent-router/ai-agent-router.js +23 -0
  54. package/lib/esm/components/system-debug-trace/events/ai-agent-router/ai-agent-router.js.map +1 -0
  55. package/lib/esm/components/system-debug-trace/events/ai-agent-router/index.d.ts +2 -0
  56. package/lib/esm/components/system-debug-trace/events/ai-agent-router/index.js +6 -0
  57. package/lib/esm/components/system-debug-trace/events/ai-agent-router/index.js.map +1 -0
  58. package/lib/esm/components/system-debug-trace/events/ai-agent-router/types.d.ts +23 -0
  59. package/lib/esm/components/system-debug-trace/events/ai-agent-router/types.js +3 -0
  60. package/lib/esm/components/system-debug-trace/events/ai-agent-router/types.js.map +1 -0
  61. package/lib/esm/components/system-debug-trace/events/constants.d.ts +4 -0
  62. package/lib/esm/components/system-debug-trace/events/constants.js +4 -0
  63. package/lib/esm/components/system-debug-trace/events/constants.js.map +1 -1
  64. package/lib/esm/components/system-debug-trace/events/index.d.ts +1 -0
  65. package/lib/esm/components/system-debug-trace/events/index.js +1 -0
  66. package/lib/esm/components/system-debug-trace/events/index.js.map +1 -1
  67. package/lib/esm/components/system-debug-trace/hooks/use-last-label-position.js +36 -28
  68. package/lib/esm/components/system-debug-trace/hooks/use-last-label-position.js.map +1 -1
  69. package/lib/esm/components/system-debug-trace/icons/ai-router.d.ts +1 -0
  70. package/lib/esm/components/system-debug-trace/icons/ai-router.js +11 -0
  71. package/lib/esm/components/system-debug-trace/icons/ai-router.js.map +1 -0
  72. package/lib/esm/components/system-debug-trace/icons/index.d.ts +2 -0
  73. package/lib/esm/components/system-debug-trace/icons/index.js +2 -0
  74. package/lib/esm/components/system-debug-trace/icons/index.js.map +1 -1
  75. package/lib/esm/components/system-debug-trace/types.d.ts +2 -2
  76. package/lib/esm/debug-system-messages.d.ts +198 -0
  77. package/lib/esm/debug-system-messages.js +240 -0
  78. package/lib/esm/debug-system-messages.js.map +1 -0
  79. package/lib/esm/dev-app.d.ts +199 -0
  80. package/lib/esm/dev-app.js +22 -0
  81. package/lib/esm/dev-app.js.map +1 -1
  82. package/lib/esm/index.d.ts +1 -0
  83. package/lib/esm/index.js +3 -1
  84. package/lib/esm/index.js.map +1 -1
  85. package/package.json +3 -3
  86. package/src/components/button/index.tsx +3 -2
  87. package/src/components/system-debug-trace/debug-message.tsx +3 -0
  88. package/src/components/system-debug-trace/events/ai-agent/ai-agent.tsx +1 -1
  89. package/src/components/system-debug-trace/events/ai-agent/parse-tools.ts +14 -2
  90. package/src/components/system-debug-trace/events/ai-agent-router/ai-agent-router.tsx +75 -0
  91. package/src/components/system-debug-trace/events/ai-agent-router/index.ts +2 -0
  92. package/src/components/system-debug-trace/events/ai-agent-router/types.ts +26 -0
  93. package/src/components/system-debug-trace/events/constants.ts +4 -0
  94. package/src/components/system-debug-trace/events/index.ts +1 -0
  95. package/src/components/system-debug-trace/hooks/use-last-label-position.ts +42 -32
  96. package/src/components/system-debug-trace/icons/ai-router.tsx +45 -0
  97. package/src/components/system-debug-trace/icons/index.ts +2 -0
  98. package/src/components/system-debug-trace/types.ts +2 -0
  99. package/src/debug-system-messages.ts +276 -0
  100. package/src/dev-app.jsx +24 -0
  101. package/src/index.ts +1 -0
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Dev-only mock payloads for every SystemDebugTrace event type.
3
+ *
4
+ * Usage from dev-entry.ts:
5
+ * import { DEBUG_SYSTEM_MESSAGES } from '@botonic/react/src/debug-system-messages'
6
+ * app.addDebugSystemMessage(DEBUG_SYSTEM_MESSAGES.keyword)
7
+ *
8
+ * Usage from the browser console (window.Botonic is the DevApp instance):
9
+ * Botonic.addDebugSystemMessage({ action: 'nlu_keyword', nlu_keyword_name: 'hello', ... })
10
+ * // or use the pre-built fixtures exposed on the DevApp:
11
+ * Botonic.addDebugSystemMessage(Botonic.debugSystemMessages.aiAgent)
12
+ */
13
+ import { EventAction } from '@botonic/core';
14
+ import type { ChunkIdsGroupedBySourceData } from './components/system-debug-trace/events/knowledge-bases-types';
15
+ export declare const DEBUG_SYSTEM_MESSAGES: {
16
+ keyword: {
17
+ action: EventAction.Keyword;
18
+ flow_id: string;
19
+ flow_node_id: string;
20
+ nlu_keyword_is_regex: false;
21
+ nlu_keyword_name: string;
22
+ };
23
+ smartIntent: {
24
+ action: EventAction.IntentSmart;
25
+ nlu_intent_smart_title: string;
26
+ };
27
+ fallback: {
28
+ action: EventAction.Fallback;
29
+ user_input: string;
30
+ fallback_out: number;
31
+ fallback_message_id: string;
32
+ };
33
+ handoffSuccess: {
34
+ action: EventAction.HandoffSuccess;
35
+ handoff_queue_name: string;
36
+ handoff_is_queue_open: true;
37
+ handoff_has_auto_assign: true;
38
+ handoff_note_id: string;
39
+ };
40
+ botAction: {
41
+ action: EventAction.BotAction;
42
+ payload: string;
43
+ };
44
+ knowledgeBase: {
45
+ action: EventAction.Knowledgebase;
46
+ flow_id: string;
47
+ flow_node_id: string;
48
+ knowledgebase_inference_id: string;
49
+ knowledgebase_fail_reason: string;
50
+ knowledgebase_sources_ids: string[];
51
+ knowledgebase_chunks_ids: string[];
52
+ user_input: string;
53
+ knowledge_base_chunks_with_sources: ChunkIdsGroupedBySourceData[];
54
+ };
55
+ knowledgeBaseFailed: {
56
+ action: EventAction.Knowledgebase;
57
+ flow_id: string;
58
+ flow_node_id: string;
59
+ knowledgebase_inference_id: string;
60
+ knowledgebase_fail_reason: string;
61
+ knowledgebase_sources_ids: never[];
62
+ knowledgebase_chunks_ids: never[];
63
+ user_input: string;
64
+ knowledge_base_chunks_with_sources: never[];
65
+ };
66
+ conditionalChannel: {
67
+ action: EventAction.ConditionalChannel;
68
+ channel: string;
69
+ };
70
+ conditionalCountry: {
71
+ action: EventAction.ConditionalCountry;
72
+ country: string;
73
+ };
74
+ conditionalCustom: {
75
+ action: EventAction.ConditionalCustom;
76
+ conditional_variable: string;
77
+ variable_format: string;
78
+ };
79
+ conditionalQueueStatus: {
80
+ action: EventAction.ConditionalQueueStatus;
81
+ queue_id: string;
82
+ queue_name: string;
83
+ is_queue_open: true;
84
+ is_available_agent: true;
85
+ };
86
+ redirectFlow: {
87
+ action: EventAction.RedirectFlow;
88
+ flow_id: string;
89
+ flow_name: string;
90
+ flow_target_id: string;
91
+ flow_target_name: string;
92
+ };
93
+ webviewActionTriggered: {
94
+ action: EventAction.WebviewActionTriggered;
95
+ webview_target_id: string;
96
+ webview_name: string;
97
+ };
98
+ aiAgent: {
99
+ action: EventAction.AiAgent;
100
+ flow_node_content_id: string;
101
+ user_input: string;
102
+ tools_executed: ({
103
+ tool_name: string;
104
+ tool_arguments: {
105
+ query: string;
106
+ user_id?: undefined;
107
+ };
108
+ tool_results: string;
109
+ knowledgebase_sources_ids: string[];
110
+ knowledgebase_chunks_ids: string[];
111
+ } | {
112
+ tool_name: string;
113
+ tool_arguments: {
114
+ user_id: string;
115
+ query?: undefined;
116
+ };
117
+ tool_results: string;
118
+ knowledgebase_sources_ids?: undefined;
119
+ knowledgebase_chunks_ids?: undefined;
120
+ })[];
121
+ input_guardrails_triggered: never[];
122
+ output_guardrails_triggered: never[];
123
+ exit: false;
124
+ error: false;
125
+ knowledge_base_chunks_with_sources: ChunkIdsGroupedBySourceData[];
126
+ };
127
+ aiAgentWithGuardrails: {
128
+ action: EventAction.AiAgent;
129
+ flow_node_content_id: string;
130
+ user_input: string;
131
+ tools_executed: never[];
132
+ input_guardrails_triggered: string[];
133
+ output_guardrails_triggered: never[];
134
+ exit: false;
135
+ error: false;
136
+ };
137
+ aiAgentError: {
138
+ action: EventAction.AiAgent;
139
+ flow_node_content_id: string;
140
+ user_input: string;
141
+ tools_executed: never[];
142
+ input_guardrails_triggered: never[];
143
+ output_guardrails_triggered: never[];
144
+ exit: false;
145
+ error: true;
146
+ };
147
+ aiAgentRouter: {
148
+ noTransfer: {
149
+ action: EventAction.AiAgentRouter;
150
+ flow_node_content_id: string;
151
+ tools_executed: never[];
152
+ memory_length: number;
153
+ input_guardrails_triggered: never[];
154
+ output_guardrails_triggered: never[];
155
+ exit: false;
156
+ starting_agent_name: string;
157
+ last_agent_name: string;
158
+ available_specialists: {
159
+ name: string;
160
+ description: string;
161
+ }[];
162
+ is_transferred_to_specialist: false;
163
+ };
164
+ inputGuardrail: {
165
+ action: EventAction.AiAgentRouter;
166
+ flow_node_content_id: string;
167
+ tools_executed: never[];
168
+ memory_length: number;
169
+ input_guardrails_triggered: string[];
170
+ output_guardrails_triggered: never[];
171
+ exit: false;
172
+ starting_agent_name: string;
173
+ last_agent_name: string;
174
+ available_specialists: {
175
+ name: string;
176
+ description: string;
177
+ }[];
178
+ is_transferred_to_specialist: false;
179
+ };
180
+ transfer: {
181
+ action: EventAction.AiAgentRouter;
182
+ flow_node_content_id: string;
183
+ tools_executed: never[];
184
+ memory_length: number;
185
+ input_guardrails_triggered: never[];
186
+ output_guardrails_triggered: never[];
187
+ exit: true;
188
+ starting_agent_name: string;
189
+ last_agent_name: string;
190
+ available_specialists: {
191
+ name: string;
192
+ description: string;
193
+ }[];
194
+ is_transferred_to_specialist: true;
195
+ knowledge_base_chunks_with_sources: never[];
196
+ };
197
+ };
198
+ };
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ /**
3
+ * Dev-only mock payloads for every SystemDebugTrace event type.
4
+ *
5
+ * Usage from dev-entry.ts:
6
+ * import { DEBUG_SYSTEM_MESSAGES } from '@botonic/react/src/debug-system-messages'
7
+ * app.addDebugSystemMessage(DEBUG_SYSTEM_MESSAGES.keyword)
8
+ *
9
+ * Usage from the browser console (window.Botonic is the DevApp instance):
10
+ * Botonic.addDebugSystemMessage({ action: 'nlu_keyword', nlu_keyword_name: 'hello', ... })
11
+ * // or use the pre-built fixtures exposed on the DevApp:
12
+ * Botonic.addDebugSystemMessage(Botonic.debugSystemMessages.aiAgent)
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DEBUG_SYSTEM_MESSAGES = void 0;
16
+ const core_1 = require("@botonic/core");
17
+ const mockChunksWithSources = [
18
+ {
19
+ source: {
20
+ id: 'src-mock-001',
21
+ name: 'Help Center',
22
+ type: 'url',
23
+ scrapingCountryCode: null,
24
+ createdAt: '2026-01-01T00:00:00Z',
25
+ createdBy: 'mock',
26
+ lastUpdatedAt: '2026-01-01T00:00:00Z',
27
+ lastUpdatedBy: 'mock',
28
+ activeExtractionJob: null,
29
+ lastExtractionJob: null,
30
+ },
31
+ chunks: [
32
+ {
33
+ id: 'chunk-mock-001',
34
+ text: 'To reset your password, go to Settings > Security > Reset Password.',
35
+ },
36
+ ],
37
+ },
38
+ ];
39
+ exports.DEBUG_SYSTEM_MESSAGES = {
40
+ keyword: {
41
+ action: core_1.EventAction.Keyword,
42
+ flow_id: 'flow-mock-001',
43
+ flow_node_id: 'node-mock-001',
44
+ nlu_keyword_is_regex: false,
45
+ nlu_keyword_name: 'hello',
46
+ },
47
+ smartIntent: {
48
+ action: core_1.EventAction.IntentSmart,
49
+ nlu_intent_smart_title: 'Greeting smart intent',
50
+ },
51
+ fallback: {
52
+ action: core_1.EventAction.Fallback,
53
+ user_input: "I don't understand this bot",
54
+ fallback_out: 1,
55
+ fallback_message_id: 'msg-mock-002',
56
+ },
57
+ handoffSuccess: {
58
+ action: core_1.EventAction.HandoffSuccess,
59
+ handoff_queue_name: 'Support Team',
60
+ handoff_is_queue_open: true,
61
+ handoff_has_auto_assign: true,
62
+ handoff_note_id: '',
63
+ },
64
+ botAction: {
65
+ action: core_1.EventAction.BotAction,
66
+ payload: 'custom-action-result',
67
+ },
68
+ knowledgeBase: {
69
+ action: core_1.EventAction.Knowledgebase,
70
+ flow_id: 'flow-mock-001',
71
+ flow_node_id: 'node-mock-004',
72
+ knowledgebase_inference_id: 'inf-mock-001',
73
+ knowledgebase_fail_reason: '',
74
+ knowledgebase_sources_ids: ['src-mock-001'],
75
+ knowledgebase_chunks_ids: ['chunk-mock-001'],
76
+ user_input: 'How do I reset my password?',
77
+ knowledge_base_chunks_with_sources: mockChunksWithSources,
78
+ },
79
+ knowledgeBaseFailed: {
80
+ action: core_1.EventAction.Knowledgebase,
81
+ flow_id: 'flow-mock-001',
82
+ flow_node_id: 'node-mock-004',
83
+ knowledgebase_inference_id: 'inf-mock-002',
84
+ knowledgebase_fail_reason: 'no_relevant_content',
85
+ knowledgebase_sources_ids: [],
86
+ knowledgebase_chunks_ids: [],
87
+ user_input: 'What is the meaning of life?',
88
+ knowledge_base_chunks_with_sources: [],
89
+ },
90
+ conditionalChannel: {
91
+ action: core_1.EventAction.ConditionalChannel,
92
+ channel: 'whatsapp',
93
+ },
94
+ conditionalCountry: {
95
+ action: core_1.EventAction.ConditionalCountry,
96
+ country: 'ES',
97
+ },
98
+ conditionalCustom: {
99
+ action: core_1.EventAction.ConditionalCustom,
100
+ conditional_variable: 'user_plan',
101
+ variable_format: 'string',
102
+ },
103
+ conditionalQueueStatus: {
104
+ action: core_1.EventAction.ConditionalQueueStatus,
105
+ queue_id: 'queue-mock-001',
106
+ queue_name: 'Support Team',
107
+ is_queue_open: true,
108
+ is_available_agent: true,
109
+ },
110
+ redirectFlow: {
111
+ action: core_1.EventAction.RedirectFlow,
112
+ flow_id: 'flow-mock-001',
113
+ flow_name: 'Main Flow',
114
+ flow_target_id: 'flow-mock-002',
115
+ flow_target_name: 'Billing Flow',
116
+ },
117
+ webviewActionTriggered: {
118
+ action: core_1.EventAction.WebviewActionTriggered,
119
+ webview_target_id: 'webview-mock-001',
120
+ webview_name: 'Payment Form',
121
+ },
122
+ aiAgent: {
123
+ action: core_1.EventAction.AiAgent,
124
+ flow_node_content_id: 'content-mock-001',
125
+ user_input: 'Can you help me with my subscription?',
126
+ tools_executed: [
127
+ {
128
+ tool_name: 'retrieve_knowledge',
129
+ tool_arguments: { query: 'subscription management' },
130
+ tool_results: 'Found 3 relevant articles about subscription management.',
131
+ knowledgebase_sources_ids: ['src-mock-001'],
132
+ knowledgebase_chunks_ids: ['chunk-mock-001'],
133
+ },
134
+ {
135
+ tool_name: 'get_user_subscription',
136
+ tool_arguments: { user_id: 'user-mock-001' },
137
+ tool_results: '{"plan": "pro", "renewal_date": "2026-06-01"}',
138
+ },
139
+ ],
140
+ input_guardrails_triggered: [],
141
+ output_guardrails_triggered: [],
142
+ exit: false,
143
+ error: false,
144
+ knowledge_base_chunks_with_sources: mockChunksWithSources,
145
+ },
146
+ aiAgentWithGuardrails: {
147
+ action: core_1.EventAction.AiAgent,
148
+ flow_node_content_id: 'content-mock-002',
149
+ user_input: 'Tell me something inappropriate',
150
+ tools_executed: [],
151
+ input_guardrails_triggered: ['content_safety', 'topic_restriction'],
152
+ output_guardrails_triggered: [],
153
+ exit: false,
154
+ error: false,
155
+ },
156
+ aiAgentError: {
157
+ action: core_1.EventAction.AiAgent,
158
+ flow_node_content_id: 'content-mock-003',
159
+ user_input: 'Hello',
160
+ tools_executed: [],
161
+ input_guardrails_triggered: [],
162
+ output_guardrails_triggered: [],
163
+ exit: false,
164
+ error: true,
165
+ },
166
+ aiAgentRouter: {
167
+ noTransfer: {
168
+ action: core_1.EventAction.AiAgentRouter,
169
+ flow_node_content_id: 'customer_support_router',
170
+ tools_executed: [],
171
+ memory_length: 2,
172
+ input_guardrails_triggered: [],
173
+ output_guardrails_triggered: [],
174
+ exit: false,
175
+ starting_agent_name: 'customer_support_router',
176
+ last_agent_name: 'customer_support_router',
177
+ available_specialists: [
178
+ {
179
+ name: 'billing_specialist',
180
+ description: 'Handles billing and invoice queries',
181
+ },
182
+ {
183
+ name: 'technical_support_specialist',
184
+ description: 'Handles technical issues',
185
+ },
186
+ ],
187
+ is_transferred_to_specialist: false,
188
+ },
189
+ inputGuardrail: {
190
+ action: core_1.EventAction.AiAgentRouter,
191
+ flow_node_content_id: 'customer_support_router',
192
+ tools_executed: [],
193
+ memory_length: 0,
194
+ input_guardrails_triggered: ['is_competence'],
195
+ output_guardrails_triggered: [],
196
+ exit: false,
197
+ starting_agent_name: 'customer_support_router',
198
+ last_agent_name: 'customer_support_router',
199
+ available_specialists: [
200
+ {
201
+ name: 'billing_specialist',
202
+ description: 'Handles billing and invoice queries',
203
+ },
204
+ {
205
+ name: 'technical_support_specialist',
206
+ description: 'Handles technical issues',
207
+ },
208
+ ],
209
+ is_transferred_to_specialist: false,
210
+ },
211
+ transfer: {
212
+ action: core_1.EventAction.AiAgentRouter,
213
+ flow_node_content_id: 'customer_support_router',
214
+ tools_executed: [],
215
+ memory_length: 3,
216
+ input_guardrails_triggered: [],
217
+ output_guardrails_triggered: [],
218
+ exit: true,
219
+ starting_agent_name: 'customer_support_router',
220
+ last_agent_name: 'billing_specialist',
221
+ available_specialists: [
222
+ {
223
+ name: 'billing_specialist',
224
+ description: 'Handles billing and invoice queries',
225
+ },
226
+ {
227
+ name: 'technical_support_specialist',
228
+ description: 'Handles technical issues',
229
+ },
230
+ {
231
+ name: 'sales_specialist',
232
+ description: 'Handles sales and pricing queries',
233
+ },
234
+ ],
235
+ is_transferred_to_specialist: true,
236
+ knowledge_base_chunks_with_sources: [],
237
+ },
238
+ },
239
+ };
240
+ //# sourceMappingURL=debug-system-messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-system-messages.js","sourceRoot":"","sources":["../../src/debug-system-messages.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,wCAA2C;AAoB3C,MAAM,qBAAqB,GAAkC;IAC3D;QACE,MAAM,EAAE;YACN,EAAE,EAAE,cAAc;YAClB,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,KAAK;YACX,mBAAmB,EAAE,IAAI;YACzB,SAAS,EAAE,sBAAsB;YACjC,SAAS,EAAE,MAAM;YACjB,aAAa,EAAE,sBAAsB;YACrC,aAAa,EAAE,MAAM;YACrB,mBAAmB,EAAE,IAAW;YAChC,iBAAiB,EAAE,IAAW;SAC/B;QACD,MAAM,EAAE;YACN;gBACE,EAAE,EAAE,gBAAgB;gBACpB,IAAI,EAAE,qEAAqE;aAC5E;SACF;KACF;CACF,CAAA;AAEY,QAAA,qBAAqB,GAAG;IACnC,OAAO,EAAE;QACP,MAAM,EAAE,kBAAW,CAAC,OAAO;QAC3B,OAAO,EAAE,eAAe;QACxB,YAAY,EAAE,eAAe;QAC7B,oBAAoB,EAAE,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B;YAC9C,eAAe,EAAE,yBAAyB;YAC1C,qBAAqB,EAAE;gBACrB;oBACE,IAAI,EAAE,oBAAoB;oBAC1B,WAAW,EAAE,qCAAqC;iBACnD;gBACD;oBACE,IAAI,EAAE,8BAA8B;oBACpC,WAAW,EAAE,0BAA0B;iBACxC;aACF;YACD,4BAA4B,EAAE,KAAK;SACF;QAEnC,QAAQ,EAAE;YACR,MAAM,EAAE,kBAAW,CAAC,aAAa;YACjC,oBAAoB,EAAE,yBAAyB;YAC/C,cAAc,EAAE,EAAE;YAClB,aAAa,EAAE,CAAC;YAChB,0BAA0B,EAAE,EAAE;YAC9B,2BAA2B,EAAE,EAAE;YAC/B,IAAI,EAAE,IAAI;YACV,mBAAmB,EAAE,yBAAyB;YAC9C,eAAe,EAAE,oBAAoB;YACrC,qBAAqB,EAAE;gBACrB;oBACE,IAAI,EAAE,oBAAoB;oBAC1B,WAAW,EAAE,qCAAqC;iBACnD;gBACD;oBACE,IAAI,EAAE,8BAA8B;oBACpC,WAAW,EAAE,0BAA0B;iBACxC;gBACD;oBACE,IAAI,EAAE,kBAAkB;oBACxB,WAAW,EAAE,mCAAmC;iBACjD;aACF;YACD,4BAA4B,EAAE,IAAI;YAClC,kCAAkC,EAAE,EAAE;SACL;KACpC;CACF,CAAA"}
@@ -24,6 +24,205 @@ export class DevApp extends WebchatApp {
24
24
  bot: ReactBot;
25
25
  getComponent(host: any, optionsAtRuntime?: {}): import("react/jsx-runtime").JSX.Element;
26
26
  render(dest: any, optionsAtRuntime?: {}): void;
27
+ /** Pre-built mock payloads for every debug event type. Handy from the console:
28
+ * Botonic.addDebugSystemMessage(Botonic.debugSystemMessages.aiAgent) */
29
+ get debugSystemMessages(): {
30
+ keyword: {
31
+ action: import("@botonic/core").EventAction.Keyword;
32
+ flow_id: string;
33
+ flow_node_id: string;
34
+ nlu_keyword_is_regex: false;
35
+ nlu_keyword_name: string;
36
+ };
37
+ smartIntent: {
38
+ action: import("@botonic/core").EventAction.IntentSmart;
39
+ nlu_intent_smart_title: string;
40
+ };
41
+ fallback: {
42
+ action: import("@botonic/core").EventAction.Fallback;
43
+ user_input: string;
44
+ fallback_out: number;
45
+ fallback_message_id: string;
46
+ };
47
+ handoffSuccess: {
48
+ action: import("@botonic/core").EventAction.HandoffSuccess;
49
+ handoff_queue_name: string;
50
+ handoff_is_queue_open: true;
51
+ handoff_has_auto_assign: true;
52
+ handoff_note_id: string;
53
+ };
54
+ botAction: {
55
+ action: import("@botonic/core").EventAction.BotAction;
56
+ payload: string;
57
+ };
58
+ knowledgeBase: {
59
+ action: import("@botonic/core").EventAction.Knowledgebase;
60
+ flow_id: string;
61
+ flow_node_id: string;
62
+ knowledgebase_inference_id: string;
63
+ knowledgebase_fail_reason: string;
64
+ knowledgebase_sources_ids: string[];
65
+ knowledgebase_chunks_ids: string[];
66
+ user_input: string;
67
+ knowledge_base_chunks_with_sources: import("./index-types").ChunkIdsGroupedBySourceData[];
68
+ };
69
+ knowledgeBaseFailed: {
70
+ action: import("@botonic/core").EventAction.Knowledgebase;
71
+ flow_id: string;
72
+ flow_node_id: string;
73
+ knowledgebase_inference_id: string;
74
+ knowledgebase_fail_reason: string;
75
+ knowledgebase_sources_ids: never[];
76
+ knowledgebase_chunks_ids: never[];
77
+ user_input: string;
78
+ knowledge_base_chunks_with_sources: never[];
79
+ };
80
+ conditionalChannel: {
81
+ action: import("@botonic/core").EventAction.ConditionalChannel;
82
+ channel: string;
83
+ };
84
+ conditionalCountry: {
85
+ action: import("@botonic/core").EventAction.ConditionalCountry;
86
+ country: string;
87
+ };
88
+ conditionalCustom: {
89
+ action: import("@botonic/core").EventAction.ConditionalCustom;
90
+ conditional_variable: string;
91
+ variable_format: string;
92
+ };
93
+ conditionalQueueStatus: {
94
+ action: import("@botonic/core").EventAction.ConditionalQueueStatus;
95
+ queue_id: string;
96
+ queue_name: string;
97
+ is_queue_open: true;
98
+ is_available_agent: true;
99
+ };
100
+ redirectFlow: {
101
+ action: import("@botonic/core").EventAction.RedirectFlow;
102
+ flow_id: string;
103
+ flow_name: string;
104
+ flow_target_id: string;
105
+ flow_target_name: string;
106
+ };
107
+ webviewActionTriggered: {
108
+ action: import("@botonic/core").EventAction.WebviewActionTriggered;
109
+ webview_target_id: string;
110
+ webview_name: string;
111
+ };
112
+ aiAgent: {
113
+ action: import("@botonic/core").EventAction.AiAgent;
114
+ flow_node_content_id: string;
115
+ user_input: string;
116
+ tools_executed: ({
117
+ tool_name: string;
118
+ tool_arguments: {
119
+ query: string;
120
+ user_id?: undefined;
121
+ };
122
+ tool_results: string;
123
+ knowledgebase_sources_ids: string[];
124
+ knowledgebase_chunks_ids: string[];
125
+ } | {
126
+ tool_name: string;
127
+ tool_arguments: {
128
+ user_id: string;
129
+ query?: undefined;
130
+ };
131
+ tool_results: string;
132
+ knowledgebase_sources_ids?: undefined;
133
+ knowledgebase_chunks_ids?: undefined;
134
+ })[];
135
+ input_guardrails_triggered: never[];
136
+ output_guardrails_triggered: never[];
137
+ exit: false;
138
+ error: false;
139
+ knowledge_base_chunks_with_sources: import("./index-types").ChunkIdsGroupedBySourceData[];
140
+ };
141
+ aiAgentWithGuardrails: {
142
+ action: import("@botonic/core").EventAction.AiAgent;
143
+ flow_node_content_id: string;
144
+ user_input: string;
145
+ tools_executed: never[];
146
+ input_guardrails_triggered: string[];
147
+ output_guardrails_triggered: never[];
148
+ exit: false;
149
+ error: false;
150
+ };
151
+ aiAgentError: {
152
+ action: import("@botonic/core").EventAction.AiAgent;
153
+ flow_node_content_id: string;
154
+ user_input: string;
155
+ tools_executed: never[];
156
+ input_guardrails_triggered: never[];
157
+ output_guardrails_triggered: never[];
158
+ exit: false;
159
+ error: true;
160
+ };
161
+ aiAgentRouter: {
162
+ noTransfer: {
163
+ action: import("@botonic/core").EventAction.AiAgentRouter;
164
+ flow_node_content_id: string;
165
+ tools_executed: never[];
166
+ memory_length: number;
167
+ input_guardrails_triggered: never[];
168
+ output_guardrails_triggered: never[];
169
+ exit: false;
170
+ starting_agent_name: string;
171
+ last_agent_name: string;
172
+ available_specialists: {
173
+ name: string;
174
+ description: string;
175
+ }[];
176
+ is_transferred_to_specialist: false;
177
+ };
178
+ inputGuardrail: {
179
+ action: import("@botonic/core").EventAction.AiAgentRouter;
180
+ flow_node_content_id: string;
181
+ tools_executed: never[];
182
+ memory_length: number;
183
+ input_guardrails_triggered: string[];
184
+ output_guardrails_triggered: never[];
185
+ exit: false;
186
+ starting_agent_name: string;
187
+ last_agent_name: string;
188
+ available_specialists: {
189
+ name: string;
190
+ description: string;
191
+ }[];
192
+ is_transferred_to_specialist: false;
193
+ };
194
+ transfer: {
195
+ action: import("@botonic/core").EventAction.AiAgentRouter;
196
+ flow_node_content_id: string;
197
+ tools_executed: never[];
198
+ memory_length: number;
199
+ input_guardrails_triggered: never[];
200
+ output_guardrails_triggered: never[];
201
+ exit: true;
202
+ starting_agent_name: string;
203
+ last_agent_name: string;
204
+ available_specialists: {
205
+ name: string;
206
+ description: string;
207
+ }[];
208
+ is_transferred_to_specialist: true;
209
+ knowledge_base_chunks_with_sources: never[];
210
+ };
211
+ };
212
+ };
213
+ /**
214
+ * Inject a mock SystemDebugTrace event into the preview webchat.
215
+ * Accepts any DebugEvent payload (plain object with an `action` field).
216
+ *
217
+ * From code:
218
+ * import { DEBUG_SYSTEM_MESSAGES } from '@botonic/react/src/debug-system-messages'
219
+ * app.addDebugSystemMessage(DEBUG_SYSTEM_MESSAGES.aiAgent)
220
+ *
221
+ * From the browser console:
222
+ * Botonic.addDebugSystemMessage(Botonic.debugSystemMessages.conditionalQueueStatus)
223
+ * Botonic.addDebugSystemMessage({ action: 'nlu_keyword', nlu_keyword_name: 'hi', nlu_keyword_is_regex: false, flow_id: 'f1', flow_node_id: 'n1' })
224
+ */
225
+ addDebugSystemMessage(eventData: any): void;
27
226
  onUserInput({ input, session, lastRoutePath }: {
28
227
  input: any;
29
228
  session: any;
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DevApp = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const core_1 = require("@botonic/core");
5
6
  const client_1 = require("react-dom/client");
7
+ const debug_system_messages_1 = require("./debug-system-messages");
6
8
  const index_types_1 = require("./index-types");
7
9
  const react_bot_1 = require("./react-bot");
8
10
  const dom_1 = require("./util/dom");
@@ -56,6 +58,26 @@ class DevApp extends webchat_app_1.WebchatApp {
56
58
  reactRoot.render(devAppComponent);
57
59
  });
58
60
  }
61
+ /** Pre-built mock payloads for every debug event type. Handy from the console:
62
+ * Botonic.addDebugSystemMessage(Botonic.debugSystemMessages.aiAgent) */
63
+ get debugSystemMessages() {
64
+ return debug_system_messages_1.DEBUG_SYSTEM_MESSAGES;
65
+ }
66
+ /**
67
+ * Inject a mock SystemDebugTrace event into the preview webchat.
68
+ * Accepts any DebugEvent payload (plain object with an `action` field).
69
+ *
70
+ * From code:
71
+ * import { DEBUG_SYSTEM_MESSAGES } from '@botonic/react/src/debug-system-messages'
72
+ * app.addDebugSystemMessage(DEBUG_SYSTEM_MESSAGES.aiAgent)
73
+ *
74
+ * From the browser console:
75
+ * Botonic.addDebugSystemMessage(Botonic.debugSystemMessages.conditionalQueueStatus)
76
+ * Botonic.addDebugSystemMessage({ action: 'nlu_keyword', nlu_keyword_name: 'hi', nlu_keyword_is_regex: false, flow_id: 'f1', flow_node_id: 'n1' })
77
+ */
78
+ addDebugSystemMessage(eventData) {
79
+ this.addSystemMessage({ type: core_1.INPUT.SYSTEM_DEBUG_TRACE, data: eventData });
80
+ }
59
81
  async onUserInput({ input, session, lastRoutePath }) {
60
82
  this.onMessage?.(this, {
61
83
  sentBy: index_types_1.SENDERS.user,