@stack-spot/ai-chat-widget 2.7.1 → 2.8.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 (41) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/app-metadata.json +2 -2
  3. package/dist/chat-interceptors/send-message.d.ts.map +1 -1
  4. package/dist/chat-interceptors/send-message.js +0 -15
  5. package/dist/chat-interceptors/send-message.js.map +1 -1
  6. package/dist/context/hooks.d.ts +1 -0
  7. package/dist/context/hooks.d.ts.map +1 -1
  8. package/dist/context/hooks.js +24 -0
  9. package/dist/context/hooks.js.map +1 -1
  10. package/dist/utils/tools.d.ts +17 -8
  11. package/dist/utils/tools.d.ts.map +1 -1
  12. package/dist/utils/tools.js +20 -9
  13. package/dist/utils/tools.js.map +1 -1
  14. package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
  15. package/dist/views/Agents/AgentDescription.js +5 -14
  16. package/dist/views/Agents/AgentDescription.js.map +1 -1
  17. package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
  18. package/dist/views/Agents/AgentsTab.js +3 -2
  19. package/dist/views/Agents/AgentsTab.js.map +1 -1
  20. package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
  21. package/dist/views/Chat/ChatMessage.js +14 -21
  22. package/dist/views/Chat/ChatMessage.js.map +1 -1
  23. package/dist/views/Chat/StepsList.d.ts +2 -8
  24. package/dist/views/Chat/StepsList.d.ts.map +1 -1
  25. package/dist/views/Chat/StepsList.js +7 -6
  26. package/dist/views/Chat/StepsList.js.map +1 -1
  27. package/dist/views/Resources.js +8 -5
  28. package/dist/views/Resources.js.map +1 -1
  29. package/dist/views/Tools.js +1 -1
  30. package/dist/views/Tools.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/app-metadata.json +2 -2
  33. package/src/chat-interceptors/send-message.ts +0 -17
  34. package/src/context/hooks.ts +24 -0
  35. package/src/utils/tools.ts +28 -17
  36. package/src/views/Agents/AgentDescription.tsx +40 -36
  37. package/src/views/Agents/AgentsTab.tsx +3 -2
  38. package/src/views/Chat/ChatMessage.tsx +14 -22
  39. package/src/views/Chat/StepsList.tsx +8 -8
  40. package/src/views/Resources.tsx +11 -10
  41. package/src/views/Tools.tsx +1 -1
@@ -46,29 +46,30 @@ const ResourcesPanel = () => {
46
46
  const chat = widget.chatTabs.getAll().find(c => c.id === chatId)
47
47
  return chat?.getMessages().find(m => m.id === messageId)?.getValue()
48
48
  }, [messageId])
49
- const [toolKits] = agentToolsClient.tools.useStatefulQuery({}, { enabled: !!message?.agent?.id })
50
49
  const [agent] = agentToolsClient.agent.useStatefulQuery({ agentId: message?.agent?.id || '' },
51
50
  { enabled: !!message?.agent?.id })
52
- const tools = useMemo(() => message?.tools?.map(id => toolById(id, toolKits)), [messageId, toolKits])
53
- const customTools = useMemo(() => message?.tools?.map(id => toolById(id, agent?.toolkits?.custom_toolkits)),
54
- [messageId, agent?.toolkits?.custom_toolkits])
55
-
51
+ const toolkits = useMemo(() => [
52
+ ...agent?.toolkits?.builtin_toolkits ?? [],
53
+ ...agent?.toolkits?.custom_toolkits ?? [],
54
+ ...agent?.toolkits?.mcp_toolkits ?? [],
55
+ ], [agent])
56
+ const tools = useMemo(() => message?.tools?.map(id => toolById(id, toolkits)), [messageId, toolkits])
56
57
  const [agentsTools] = agentToolsClient.agentsByIds.useStatefulQuery({ searchAgentsRequest:{ ids: message?.tools || [] } })
57
- const hasAgentTool = useMemo(() => message?.tools?.some(id => agentsTools?.find((agent) => agent.id === id)), [messageId, toolKits])
58
+ const hasAgentTool = useMemo(() => message?.tools?.some(id => agentsTools?.find((agent) => agent.id === id)), [messageId])
58
59
 
59
60
  const header = (image?: string, label?: string) => (
60
61
  <Row>
61
- <ImageBox >
62
+ <ImageBox>
62
63
  <ImageWithFallback src={image} fallback={<Icon icon="Agent" />} aria-label={label} title={label} />
63
64
  </ImageBox>
64
65
  <Text style={{ marginLeft: '8px' }}>{label}</Text>
65
66
  </Row>
66
67
  )
67
-
68
- return !!(tools?.length || customTools?.length) && (
68
+
69
+ return !!tools?.length && (
69
70
  <>
70
71
  <>
71
- {[...(tools || []), ...(customTools || [])].map(
72
+ {tools.map(
72
73
  (tool) =>
73
74
  tool && (
74
75
  <StyledAccordion key={tool.id} header={header(tool?.image, tool?.name)} appearance="card" maxHeight={120}>
@@ -54,7 +54,7 @@ const ToolsPanel = () => {
54
54
  tool && (
55
55
  <li key={tool.id}>
56
56
  <ToolBadge
57
- name={tool.name || tool.id}
57
+ name={tool.name || tool.id || ''}
58
58
  image={tool.image ?? ''}
59
59
  description={tool.description ?? ''}
60
60
  />