@stack-spot/ai-chat-widget 2.1.0-beta.1 → 2.1.1

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 (63) hide show
  1. package/CHANGELOG.md +6 -75
  2. package/dist/app-metadata.json +5 -5
  3. package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
  4. package/dist/chat-interceptors/quick-commands.js +2 -0
  5. package/dist/chat-interceptors/quick-commands.js.map +1 -1
  6. package/dist/chat-interceptors/send-message.d.ts.map +1 -1
  7. package/dist/chat-interceptors/send-message.js +1 -99
  8. package/dist/chat-interceptors/send-message.js.map +1 -1
  9. package/dist/state/ChatEntry.d.ts +1 -1
  10. package/dist/state/ChatEntry.d.ts.map +1 -1
  11. package/dist/state/ChatEntry.js +1 -2
  12. package/dist/state/ChatEntry.js.map +1 -1
  13. package/dist/state/ChatState.d.ts +0 -4
  14. package/dist/state/ChatState.d.ts.map +1 -1
  15. package/dist/state/ChatState.js.map +1 -1
  16. package/dist/views/Chat/ChatMessage.d.ts +1 -1
  17. package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
  18. package/dist/views/Chat/ChatMessage.js +3 -4
  19. package/dist/views/Chat/ChatMessage.js.map +1 -1
  20. package/dist/views/Chat/StepsList.d.ts +1 -6
  21. package/dist/views/Chat/StepsList.d.ts.map +1 -1
  22. package/dist/views/Chat/StepsList.js +13 -117
  23. package/dist/views/Chat/StepsList.js.map +1 -1
  24. package/dist/views/Chat/styled.d.ts.map +1 -1
  25. package/dist/views/Chat/styled.js +6 -13
  26. package/dist/views/Chat/styled.js.map +1 -1
  27. package/dist/views/MessageInput/dictionary.d.ts +1 -1
  28. package/dist/views/Steps/FlowChart/NodeStep.js +1 -1
  29. package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -1
  30. package/dist/views/Steps/FlowChart/layout.d.ts +1 -1
  31. package/dist/views/Steps/FlowChart/layout.d.ts.map +1 -1
  32. package/dist/views/Steps/FlowChart/layout.js +0 -1
  33. package/dist/views/Steps/FlowChart/layout.js.map +1 -1
  34. package/dist/views/Steps/FlowChart/types.d.ts +1 -1
  35. package/dist/views/Steps/FlowChart/types.d.ts.map +1 -1
  36. package/dist/views/Steps/StepModal.js +2 -2
  37. package/dist/views/Steps/StepModal.js.map +1 -1
  38. package/dist/views/Steps/dictionary.d.ts +1 -1
  39. package/dist/views/Steps/utils.d.ts +1 -1
  40. package/dist/views/Steps/utils.d.ts.map +1 -1
  41. package/package.json +3 -3
  42. package/src/app-metadata.json +5 -5
  43. package/src/chat-interceptors/quick-commands.ts +8 -4
  44. package/src/chat-interceptors/send-message.ts +2 -113
  45. package/src/state/ChatEntry.ts +1 -2
  46. package/src/state/ChatState.ts +0 -4
  47. package/src/views/Chat/ChatMessage.tsx +4 -8
  48. package/src/views/Chat/StepsList.tsx +31 -282
  49. package/src/views/Chat/styled.ts +6 -13
  50. package/src/views/Steps/FlowChart/NodeStep.tsx +1 -1
  51. package/src/views/Steps/FlowChart/layout.ts +0 -1
  52. package/src/views/Steps/FlowChart/types.ts +1 -1
  53. package/src/views/Steps/StepModal.tsx +2 -2
  54. package/dist/utils/planning-tool.d.ts +0 -14
  55. package/dist/utils/planning-tool.d.ts.map +0 -1
  56. package/dist/utils/planning-tool.js +0 -25
  57. package/dist/utils/planning-tool.js.map +0 -1
  58. package/dist/utils/update-tool-step.d.ts +0 -3
  59. package/dist/utils/update-tool-step.d.ts.map +0 -1
  60. package/dist/utils/update-tool-step.js +0 -23
  61. package/dist/utils/update-tool-step.js.map +0 -1
  62. package/src/utils/planning-tool.ts +0 -32
  63. package/src/utils/update-tool-step.tsx +0 -27
@@ -243,27 +243,20 @@ export const ChatList: IStyledComponentBase<
243
243
  }
244
244
 
245
245
  .steps {
246
- .steps-list {
246
+ ul {
247
247
  list-style: none;
248
248
  margin: 0;
249
249
  padding: 0;
250
250
  display: flex;
251
251
  flex-direction: column;
252
252
  gap: 6px;
253
- }
254
-
255
- .tools-list {
256
- list-style: disc;
257
- margin: 0;
258
- padding-left: 24px;
259
- display: block;
260
- ::marker {
261
- color: ${theme.color.light.contrastText};
262
- }
263
- }
264
253
 
265
- ul {
266
254
  li {
255
+ display: flex;
256
+ flex-direction: row;
257
+ gap: 4px;
258
+ align-items: center;
259
+
267
260
  &[role="button"] {
268
261
  cursor: pointer;
269
262
  }
@@ -37,7 +37,7 @@ export const NodeStep = ({ data: { step, index, nextStatus, onClick } }: Props)
37
37
  {!!step.attempts[0].tools?.length && <StackedBadge
38
38
  label={t.tools}
39
39
  images={step.attempts[0].tools?.slice(0, 3).map(
40
- tool => ({ key: tool.id, name: tool.name ?? '', url: tool.image, icon: <Icon icon="Cog" /> }),
40
+ tool => ({ key: tool.id, name: tool.name, url: tool.image, icon: <Icon icon="Cog" /> }),
41
41
  )}
42
42
  />}
43
43
  </div>}
@@ -8,7 +8,6 @@ const nodesSizes = {
8
8
  step: stepNodeSize,
9
9
  planning: planningNodeSize,
10
10
  answer: answerNodeSize,
11
- tool: stepNodeSize,
12
11
  }
13
12
 
14
13
  export function useLayoutedElements(nodes: NodeWithoutLayout[], edges: Edge[]) {
@@ -9,6 +9,6 @@ export interface NodeData {
9
9
 
10
10
  export interface NodeWithoutLayout {
11
11
  id: string,
12
- type: 'step' | 'planning' | 'answer' | 'tool',
12
+ type: 'step' | 'planning' | 'answer',
13
13
  data?: NodeData,
14
14
  }
@@ -127,7 +127,7 @@ export const StepModal = ({ message, stepId, onClose }: Props) => {
127
127
 
128
128
  const tools = step?.type === 'step' ? step.attempts[attempt]?.tools?.map(tool => (
129
129
  <div className="tool" key={tool.id}>
130
- <ToolBadge name={tool.name ?? ''} duration={tool.duration} image={tool.image} description={tool.description} />
130
+ <ToolBadge name={tool.name} duration={tool.duration} image={tool.image} description={tool.description} />
131
131
  {tool.input && <>
132
132
  <Text appearance="microtext1" color="light.700">{t.input}:</Text>
133
133
  <Code language="json" className="tool-input" showLineNumbers={false} showActionBar>{tool.input}</Code>
@@ -191,7 +191,7 @@ export const StepModal = ({ message, stepId, onClose }: Props) => {
191
191
  {!!s.attempts[0].tools?.length && <ul className="side-by-side-tools">
192
192
  {s.attempts[0].tools.map((tool) => (
193
193
  <li key={tool.id}>
194
- <ToolBadge name={tool.name ?? ''} image={tool.image} />
194
+ <ToolBadge name={tool.name} image={tool.image} />
195
195
  </li>
196
196
  ))}
197
197
  </ul>}
@@ -1,14 +0,0 @@
1
- declare class PlanningToolDictionaryHelper {
2
- static instance: PlanningToolDictionaryHelper | undefined;
3
- private toolExecutionIdPlanningStep;
4
- private toolExecutionIdToolStep;
5
- private constructor();
6
- static create(): PlanningToolDictionaryHelper;
7
- setMessageIdPlanningStepToolExecutionId(messageId: string, toolExecutionId: string): void;
8
- setMessageIdToolStepToolExecutionId(messageId: string, toolExecutionId: string): void;
9
- getMessageIdPlanningStepFromToolExecutionId(toolExecutionId: string): string;
10
- getMessageIdToolStepFromToolExecutionId(toolExecutionId: string): string;
11
- }
12
- export declare const planningToolDictionaryHelper: PlanningToolDictionaryHelper;
13
- export {};
14
- //# sourceMappingURL=planning-tool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"planning-tool.d.ts","sourceRoot":"","sources":["../../src/utils/planning-tool.ts"],"names":[],"mappings":"AAAA,cAAM,4BAA4B;IAChC,MAAM,CAAC,QAAQ,EAAE,4BAA4B,GAAG,SAAS,CAAA;IACzD,OAAO,CAAC,2BAA2B,CAA6B;IAChE,OAAO,CAAC,uBAAuB,CAA6B;IAE5D,OAAO;IAIP,MAAM,CAAC,MAAM;IAIb,uCAAuC,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAIlF,mCAAmC,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAI9E,2CAA2C,CAAC,eAAe,EAAE,MAAM;IAInE,uCAAuC,CAAC,eAAe,EAAE,MAAM;CAGhE;AAED,eAAO,MAAM,4BAA4B,8BAAwC,CAAA"}
@@ -1,25 +0,0 @@
1
- class PlanningToolDictionaryHelper {
2
- static instance;
3
- toolExecutionIdPlanningStep = {};
4
- toolExecutionIdToolStep = {};
5
- constructor() {
6
- PlanningToolDictionaryHelper.instance = this;
7
- }
8
- static create() {
9
- return PlanningToolDictionaryHelper.instance ?? new PlanningToolDictionaryHelper();
10
- }
11
- setMessageIdPlanningStepToolExecutionId(messageId, toolExecutionId) {
12
- this.toolExecutionIdPlanningStep[toolExecutionId] = messageId;
13
- }
14
- setMessageIdToolStepToolExecutionId(messageId, toolExecutionId) {
15
- this.toolExecutionIdToolStep[toolExecutionId] = messageId;
16
- }
17
- getMessageIdPlanningStepFromToolExecutionId(toolExecutionId) {
18
- return this.toolExecutionIdPlanningStep[toolExecutionId];
19
- }
20
- getMessageIdToolStepFromToolExecutionId(toolExecutionId) {
21
- return this.toolExecutionIdToolStep[toolExecutionId];
22
- }
23
- }
24
- export const planningToolDictionaryHelper = PlanningToolDictionaryHelper.create();
25
- //# sourceMappingURL=planning-tool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"planning-tool.js","sourceRoot":"","sources":["../../src/utils/planning-tool.ts"],"names":[],"mappings":"AAAA,MAAM,4BAA4B;IAChC,MAAM,CAAC,QAAQ,CAA0C;IACjD,2BAA2B,GAA2B,EAAE,CAAA;IACxD,uBAAuB,GAA2B,EAAE,CAAA;IAE5D;QACE,4BAA4B,CAAC,QAAQ,GAAG,IAAI,CAAA;IAC9C,CAAC;IAED,MAAM,CAAC,MAAM;QACX,OAAO,4BAA4B,CAAC,QAAQ,IAAI,IAAI,4BAA4B,EAAE,CAAA;IACpF,CAAC;IAED,uCAAuC,CAAC,SAAiB,EAAE,eAAuB;QAChF,IAAI,CAAC,2BAA2B,CAAC,eAAe,CAAC,GAAG,SAAS,CAAA;IAC/D,CAAC;IAED,mCAAmC,CAAC,SAAiB,EAAE,eAAuB;QAC5E,IAAI,CAAC,uBAAuB,CAAC,eAAe,CAAC,GAAG,SAAS,CAAA;IAC3D,CAAC;IAED,2CAA2C,CAAC,eAAuB;QACjE,OAAO,IAAI,CAAC,2BAA2B,CAAC,eAAe,CAAC,CAAA;IAC1D,CAAC;IAED,uCAAuC,CAAC,eAAuB;QAC7D,OAAO,IAAI,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAA;IACtD,CAAC;CACF;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,4BAA4B,CAAC,MAAM,EAAE,CAAA"}
@@ -1,3 +0,0 @@
1
- import { ChatEntry } from '../state/ChatEntry.js';
2
- export declare const updateToolStep: (messages: ChatEntry[], executionId: string, newStatus: "pending" | "running" | "success" | "error" | "awaiting_approval") => void;
3
- //# sourceMappingURL=update-tool-step.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-tool-step.d.ts","sourceRoot":"","sources":["../../src/utils/update-tool-step.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,oBAAoB,CAAA;AAG7D,eAAO,MAAM,cAAc,aAAc,SAAS,EAAE,eAAe,MAAM,aAC5D,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,mBAAmB,SAsB7E,CAAA"}
@@ -1,23 +0,0 @@
1
- import { planningToolDictionaryHelper } from './planning-tool.js';
2
- export const updateToolStep = (messages, executionId, newStatus) => {
3
- // if last message is a user message, no update in tool status is needed
4
- if (messages[messages.length - 1].getValue().agentType === 'user')
5
- return;
6
- const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(executionId);
7
- const message = messages.find((message) => `${message.id}` === messageId);
8
- let update = false;
9
- const messageValue = message?.getValue();
10
- messageValue?.steps?.map((step) => {
11
- if (step.type === 'step') {
12
- const tool = step.attempts?.[0].tools?.[0];
13
- if (tool?.executionId === executionId && step.status !== newStatus) {
14
- step.status = newStatus;
15
- update = true;
16
- }
17
- }
18
- });
19
- if (update) {
20
- message?.setValue({ ...messageValue });
21
- }
22
- };
23
- //# sourceMappingURL=update-tool-step.js.map
@@ -1 +0,0 @@
1
- {"version":3,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PlanningToolDictionaryHelper {
2
- static instance: PlanningToolDictionaryHelper | undefined
3
- private toolExecutionIdPlanningStep: Record<string, string> = {}
4
- private toolExecutionIdToolStep: Record<string, string> = {}
5
-
6
- private constructor() {
7
- PlanningToolDictionaryHelper.instance = this
8
- }
9
-
10
- static create() {
11
- return PlanningToolDictionaryHelper.instance ?? new PlanningToolDictionaryHelper()
12
- }
13
-
14
- setMessageIdPlanningStepToolExecutionId(messageId: string, toolExecutionId: string){
15
- this.toolExecutionIdPlanningStep[toolExecutionId] = messageId
16
- }
17
-
18
- setMessageIdToolStepToolExecutionId(messageId: string, toolExecutionId: string){
19
- this.toolExecutionIdToolStep[toolExecutionId] = messageId
20
- }
21
-
22
- getMessageIdPlanningStepFromToolExecutionId(toolExecutionId: string){
23
- return this.toolExecutionIdPlanningStep[toolExecutionId]
24
- }
25
-
26
- getMessageIdToolStepFromToolExecutionId(toolExecutionId: string){
27
- return this.toolExecutionIdToolStep[toolExecutionId]
28
- }
29
- }
30
-
31
- export const planningToolDictionaryHelper = PlanningToolDictionaryHelper.create()
32
-
@@ -1,27 +0,0 @@
1
- import { ChatEntry, TextChatEntry } from '../state/ChatEntry'
2
- import { planningToolDictionaryHelper } from './planning-tool'
3
-
4
- export const updateToolStep = (messages: ChatEntry[], executionId: string,
5
- newStatus: 'pending' | 'running' | 'success' | 'error' | 'awaiting_approval') => {
6
-
7
- // if last message is a user message, no update in tool status is needed
8
- if (messages[messages.length-1].getValue().agentType === 'user') return
9
-
10
- const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(executionId)
11
- const message = messages.find((message) => `${message.id}` === messageId)
12
- let update = false
13
- const messageValue = message?.getValue()
14
- messageValue?.steps?.map((step) => {
15
- if (step.type === 'step') {
16
- const tool = step.attempts?.[0].tools?.[0]
17
- if (tool?.executionId === executionId && step.status !== newStatus) {
18
- step.status = newStatus
19
- update = true
20
- }
21
- }
22
- })
23
-
24
- if (update) {
25
- message?.setValue({ ...messageValue as TextChatEntry })
26
- }
27
- }