@dxos/plugin-assistant 0.8.4-main.f9ba587 → 0.8.4-main.fd6878d

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 (405) hide show
  1. package/dist/lib/browser/{TemplateContainer-6ZGGH5T4.mjs → BlueprintContainer-H7H4BQ2C.mjs} +10 -9
  2. package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +7 -0
  3. package/dist/lib/browser/{ChatContainer-6XNB5NEI.mjs → ChatContainer-OUVSX5V5.mjs} +36 -17
  4. package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatDialog-IMWPRXTO.mjs → ChatDialog-P4FLEOHG.mjs} +22 -10
  6. package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +7 -0
  7. package/dist/lib/browser/SequenceContainer-627OQ557.mjs +163 -0
  8. package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +7 -0
  9. package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +22 -0
  10. package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +7 -0
  11. package/dist/lib/browser/{app-graph-builder-UJ5NHRGK.mjs → app-graph-builder-AVHHQ3KV.mjs} +16 -73
  12. package/dist/lib/browser/app-graph-builder-AVHHQ3KV.mjs.map +7 -0
  13. package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs +146 -0
  14. package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-BRLHDHOF.mjs +244 -0
  16. package/dist/lib/browser/chunk-BRLHDHOF.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-HRLMD35M.mjs +191 -0
  18. package/dist/lib/browser/chunk-HRLMD35M.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  20. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  21. package/dist/lib/browser/{chunk-44HZKIAW.mjs → chunk-NZDCKQ6W.mjs} +32 -30
  22. package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +7 -0
  23. package/dist/lib/browser/{chunk-NTBGTFTV.mjs → chunk-QB7OVS6Z.mjs} +3 -2
  24. package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +7 -0
  25. package/dist/lib/browser/{chunk-TQ3QW3HJ.mjs → chunk-VEBVAHNM.mjs} +1041 -882
  26. package/dist/lib/browser/chunk-VEBVAHNM.mjs.map +7 -0
  27. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +24 -0
  28. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +7 -0
  29. package/dist/lib/browser/index.mjs +116 -88
  30. package/dist/lib/browser/index.mjs.map +3 -3
  31. package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs +81 -0
  32. package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +7 -0
  33. package/dist/lib/browser/meta.json +1 -1
  34. package/dist/lib/browser/{react-surface-TMF7JJA4.mjs → react-surface-4HXS3YLT.mjs} +52 -45
  35. package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +7 -0
  36. package/dist/lib/browser/{settings-N4HEXADL.mjs → settings-G2EZXMWT.mjs} +5 -4
  37. package/dist/lib/{node-esm/settings-WQ76EG6O.mjs.map → browser/settings-G2EZXMWT.mjs.map} +1 -1
  38. package/dist/lib/browser/toolkit-IW4FBLLB.mjs +105 -0
  39. package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +7 -0
  40. package/dist/lib/browser/types/index.mjs +6 -13
  41. package/dist/lib/node-esm/{TemplateContainer-6KRNEMVE.mjs → BlueprintContainer-VH4EE4CM.mjs} +10 -9
  42. package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +7 -0
  43. package/dist/lib/node-esm/{ChatContainer-VOLG7J6N.mjs → ChatContainer-D5FABDNE.mjs} +36 -17
  44. package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +7 -0
  45. package/dist/lib/node-esm/{ChatDialog-B2XNUNRM.mjs → ChatDialog-NKWVXHJP.mjs} +22 -10
  46. package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +7 -0
  47. package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs +164 -0
  48. package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +7 -0
  49. package/dist/lib/node-esm/ai-service-LDD32477.mjs +23 -0
  50. package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +7 -0
  51. package/dist/lib/node-esm/{app-graph-builder-MEQ5CYNI.mjs → app-graph-builder-RMOUJMMG.mjs} +16 -73
  52. package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.mjs.map +7 -0
  53. package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs +147 -0
  54. package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +7 -0
  55. package/dist/lib/node-esm/{chunk-D3HTVK5D.mjs → chunk-3SOC5GOP.mjs} +1041 -882
  56. package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +7 -0
  57. package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs +192 -0
  58. package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +7 -0
  59. package/dist/lib/node-esm/{chunk-VESVUAOS.mjs → chunk-GAWXJ7K5.mjs} +32 -30
  60. package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  62. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  63. package/dist/lib/node-esm/chunk-RD755HN3.mjs +245 -0
  64. package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +7 -0
  65. package/dist/lib/node-esm/{chunk-E6V2RUQ2.mjs → chunk-X6AANUHZ.mjs} +3 -2
  66. package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +7 -0
  67. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +25 -0
  68. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +7 -0
  69. package/dist/lib/node-esm/index.mjs +116 -88
  70. package/dist/lib/node-esm/index.mjs.map +3 -3
  71. package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs +82 -0
  72. package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs.map +7 -0
  73. package/dist/lib/node-esm/meta.json +1 -1
  74. package/dist/lib/node-esm/{react-surface-6XL6SWL2.mjs → react-surface-V6JNEZVO.mjs} +52 -45
  75. package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +7 -0
  76. package/dist/lib/node-esm/{settings-WQ76EG6O.mjs → settings-AIP5FOJG.mjs} +5 -4
  77. package/dist/lib/{browser/settings-N4HEXADL.mjs.map → node-esm/settings-AIP5FOJG.mjs.map} +1 -1
  78. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +106 -0
  79. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +7 -0
  80. package/dist/lib/node-esm/types/index.mjs +6 -13
  81. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  82. package/dist/types/src/capabilities/ai-service.d.ts +5 -0
  83. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
  84. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  85. package/dist/types/src/capabilities/blueprint-definition.d.ts +3 -0
  86. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  87. package/dist/types/src/capabilities/capabilities.d.ts +8 -3
  88. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  89. package/dist/types/src/capabilities/edge-model-resolver.d.ts +5 -0
  90. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/index.d.ts +6 -3
  92. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  93. package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
  94. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  95. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  96. package/dist/types/src/capabilities/toolkit.d.ts +5 -0
  97. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
  98. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  99. package/dist/types/src/components/BlueprintContainer.d.ts +8 -0
  100. package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
  101. package/dist/types/src/components/Chat/Chat.d.ts +16 -13
  102. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  103. package/dist/types/src/components/Chat/events.d.ts +30 -0
  104. package/dist/types/src/components/Chat/events.d.ts.map +1 -0
  105. package/dist/types/src/components/Chat/index.d.ts +1 -0
  106. package/dist/types/src/components/Chat/index.d.ts.map +1 -1
  107. package/dist/types/src/components/ChatContainer.d.ts +5 -4
  108. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  109. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  110. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +6 -5
  111. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  112. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +13 -0
  113. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
  114. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts +11 -0
  115. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -0
  116. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -3
  117. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  118. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +2 -1
  119. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
  120. package/dist/types/src/components/ChatPrompt/index.d.ts +2 -2
  121. package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
  122. package/dist/types/src/components/ChatThread/ChatMessage.d.ts +10 -10
  123. package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
  124. package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -12
  125. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  126. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +54 -60
  127. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  128. package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
  129. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
  130. package/dist/types/src/components/ChatThread/ToolBlock.d.ts +4 -3
  131. package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -1
  132. package/dist/types/src/components/ChatThread/reducer.d.ts +4 -4
  133. package/dist/types/src/components/ChatThread/reducer.d.ts.map +1 -1
  134. package/dist/types/src/components/PromptSettings.d.ts +2 -2
  135. package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
  136. package/dist/types/src/components/SequenceContainer.d.ts +1 -2
  137. package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
  138. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
  139. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +1 -1
  140. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
  141. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +4 -3
  142. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  143. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +2 -2
  144. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  145. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +5 -4
  146. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  147. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  148. package/dist/types/src/components/Timeline/Timeline.d.ts +24 -0
  149. package/dist/types/src/components/Timeline/Timeline.d.ts.map +1 -0
  150. package/dist/types/src/components/Timeline/Timeline.stories.d.ts +9 -0
  151. package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +1 -0
  152. package/dist/types/src/components/Timeline/index.d.ts +2 -0
  153. package/dist/types/src/components/Timeline/index.d.ts.map +1 -0
  154. package/dist/types/src/components/Toolbox/Toolbox.d.ts +6 -9
  155. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  156. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -2
  157. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  158. package/dist/types/src/components/index.d.ts +4 -3
  159. package/dist/types/src/components/index.d.ts.map +1 -1
  160. package/dist/types/src/events.d.ts +1 -1
  161. package/dist/types/src/events.d.ts.map +1 -1
  162. package/dist/types/src/functions/analysis.d.ts +5 -0
  163. package/dist/types/src/functions/analysis.d.ts.map +1 -0
  164. package/dist/types/src/functions/index.d.ts +4 -0
  165. package/dist/types/src/functions/index.d.ts.map +1 -0
  166. package/dist/types/src/functions/list.d.ts +10 -0
  167. package/dist/types/src/functions/list.d.ts.map +1 -0
  168. package/dist/types/src/functions/load.d.ts +8 -0
  169. package/dist/types/src/functions/load.d.ts.map +1 -0
  170. package/dist/types/src/hooks/chat-processor.d.ts +34 -44
  171. package/dist/types/src/hooks/chat-processor.d.ts.map +1 -1
  172. package/dist/types/src/hooks/errors.d.ts +4 -0
  173. package/dist/types/src/hooks/errors.d.ts.map +1 -0
  174. package/dist/types/src/hooks/index.d.ts +8 -4
  175. package/dist/types/src/hooks/index.d.ts.map +1 -1
  176. package/dist/types/src/hooks/presets.d.ts +13 -0
  177. package/dist/types/src/hooks/presets.d.ts.map +1 -0
  178. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +21 -0
  179. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
  180. package/dist/types/src/hooks/useChatProcessor.d.ts +9 -18
  181. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  182. package/dist/types/src/hooks/useChatServices.d.ts +13 -0
  183. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -0
  184. package/dist/types/src/hooks/useOnline.d.ts +3 -0
  185. package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
  186. package/dist/types/src/hooks/usePresets.d.ts +7 -0
  187. package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
  188. package/dist/types/src/hooks/useReferencesProvider.d.ts +7 -0
  189. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -0
  190. package/dist/types/src/hooks/useResolveRef.d.ts +4 -0
  191. package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
  192. package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
  193. package/dist/types/src/parser/index.d.ts +1 -1
  194. package/dist/types/src/parser/index.d.ts.map +1 -1
  195. package/dist/types/src/parser/query-parser.d.ts.map +1 -1
  196. package/dist/types/src/stories/Chat.stories.d.ts +87 -18
  197. package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
  198. package/dist/types/src/stories/components/BlueprintContainer.d.ts +5 -0
  199. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
  200. package/dist/types/src/stories/components/ChatContainer.d.ts +5 -0
  201. package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
  202. package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
  203. package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
  204. package/dist/types/src/stories/components/LoggingContainer.d.ts +5 -0
  205. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
  206. package/dist/types/src/stories/components/SurfaceContainer.d.ts +8 -0
  207. package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +1 -0
  208. package/dist/types/src/stories/components/TasksContainer.d.ts +5 -0
  209. package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
  210. package/dist/types/src/stories/components/index.d.ts +8 -0
  211. package/dist/types/src/stories/components/index.d.ts.map +1 -0
  212. package/dist/types/src/stories/components/types.d.ts +7 -0
  213. package/dist/types/src/stories/components/types.d.ts.map +1 -0
  214. package/dist/types/src/stories/hooks/index.d.ts +3 -0
  215. package/dist/types/src/stories/hooks/index.d.ts.map +1 -0
  216. package/dist/types/src/stories/hooks/useFlush.d.ts +6 -0
  217. package/dist/types/src/stories/hooks/useFlush.d.ts.map +1 -0
  218. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +3 -0
  219. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +1 -0
  220. package/dist/types/src/stories/testing/data.d.ts +142 -0
  221. package/dist/types/src/stories/testing/data.d.ts.map +1 -0
  222. package/dist/types/src/stories/testing/index.d.ts +3 -0
  223. package/dist/types/src/stories/testing/index.d.ts.map +1 -0
  224. package/dist/types/src/stories/testing/testing.d.ts +26 -0
  225. package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
  226. package/dist/types/src/testing/test-functions.d.ts +5 -2
  227. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  228. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  229. package/dist/types/src/tools/function.d.ts.map +1 -1
  230. package/dist/types/src/tools/openapi.d.ts.map +1 -1
  231. package/dist/types/src/translations.d.ts +25 -13
  232. package/dist/types/src/translations.d.ts.map +1 -1
  233. package/dist/types/src/types/Assistant.d.ts +40 -0
  234. package/dist/types/src/types/Assistant.d.ts.map +1 -0
  235. package/dist/types/src/types/AssistantAction.d.ts +90 -0
  236. package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
  237. package/dist/types/src/types/defs.d.ts +2 -0
  238. package/dist/types/src/types/defs.d.ts.map +1 -0
  239. package/dist/types/src/types/index.d.ts +3 -2
  240. package/dist/types/src/types/index.d.ts.map +1 -1
  241. package/dist/types/src/types/service.d.ts +6 -6
  242. package/dist/types/src/types/service.d.ts.map +1 -1
  243. package/dist/types/tsconfig.tsbuildinfo +1 -1
  244. package/package.json +83 -73
  245. package/src/AssistantPlugin.tsx +61 -41
  246. package/src/capabilities/ai-service.ts +28 -0
  247. package/src/capabilities/app-graph-builder.ts +9 -92
  248. package/src/capabilities/blueprint-definition.ts +32 -0
  249. package/src/capabilities/capabilities.ts +11 -3
  250. package/src/capabilities/edge-model-resolver.ts +29 -0
  251. package/src/capabilities/index.ts +6 -3
  252. package/src/capabilities/intent-resolver.ts +39 -11
  253. package/src/capabilities/react-surface.tsx +35 -27
  254. package/src/capabilities/toolkit.ts +106 -0
  255. package/src/components/AssistantSettings/AssistantSettings.tsx +1 -1
  256. package/src/components/BlueprintContainer.tsx +24 -0
  257. package/src/components/Chat/Chat.tsx +148 -95
  258. package/src/components/Chat/events.ts +50 -0
  259. package/src/components/Chat/index.ts +2 -0
  260. package/src/components/ChatContainer.tsx +39 -15
  261. package/src/components/ChatDialog.tsx +10 -7
  262. package/src/components/ChatPrompt/ChatActions.tsx +15 -20
  263. package/src/components/ChatPrompt/ChatOptions.tsx +59 -0
  264. package/src/components/ChatPrompt/ChatPresets.tsx +28 -0
  265. package/src/components/ChatPrompt/ChatReferences.tsx +11 -8
  266. package/src/components/ChatPrompt/ChatStatusIndicator.tsx +17 -4
  267. package/src/components/ChatPrompt/index.ts +2 -3
  268. package/src/components/ChatThread/ChatMessage.tsx +192 -148
  269. package/src/components/ChatThread/ChatThread.stories.tsx +221 -109
  270. package/src/components/ChatThread/ChatThread.tsx +12 -23
  271. package/src/components/ChatThread/Link.tsx +39 -0
  272. package/src/components/ChatThread/ToolBlock.tsx +41 -27
  273. package/src/components/ChatThread/reducer.ts +14 -14
  274. package/src/components/PromptSettings.tsx +41 -43
  275. package/src/components/SequenceContainer.tsx +32 -38
  276. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +3 -2
  277. package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
  278. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +37 -35
  279. package/src/components/TemplateEditor/TemplateEditor.tsx +39 -23
  280. package/src/components/TemplateEditor/TemplateForm.stories.tsx +23 -16
  281. package/src/components/TemplateEditor/TemplateForm.tsx +50 -55
  282. package/src/components/Timeline/Timeline.stories.tsx +53 -0
  283. package/src/components/Timeline/Timeline.tsx +159 -0
  284. package/src/components/Timeline/index.ts +5 -0
  285. package/src/components/Toolbox/Toolbox.stories.tsx +7 -13
  286. package/src/components/Toolbox/Toolbox.tsx +21 -42
  287. package/src/components/index.ts +2 -5
  288. package/src/events.ts +2 -2
  289. package/src/functions/analysis.ts +20 -0
  290. package/src/functions/index.ts +7 -0
  291. package/src/functions/list.ts +42 -0
  292. package/src/functions/load.ts +43 -0
  293. package/src/hooks/chat-processor.ts +167 -188
  294. package/src/hooks/errors.ts +8 -0
  295. package/src/hooks/index.ts +8 -4
  296. package/src/hooks/presets.ts +53 -0
  297. package/src/hooks/useBlueprintRegistry.ts +79 -0
  298. package/src/hooks/useChatProcessor.ts +81 -0
  299. package/src/hooks/useChatServices.ts +72 -0
  300. package/src/hooks/useOnline.ts +10 -0
  301. package/src/hooks/usePresets.ts +45 -0
  302. package/src/hooks/{useContextProvider.ts → useReferencesProvider.ts} +18 -22
  303. package/src/hooks/useResolveRef.ts +33 -0
  304. package/src/parser/filter-generator.ts +6 -13
  305. package/src/parser/index.ts +1 -1
  306. package/src/parser/query-parser.ts +1 -1
  307. package/src/queue-logger.ts +5 -5
  308. package/src/stories/Chat.stories.tsx +246 -198
  309. package/src/stories/components/BlueprintContainer.tsx +34 -0
  310. package/src/stories/components/ChatContainer.tsx +80 -0
  311. package/src/stories/components/GraphContainer.tsx +118 -0
  312. package/src/stories/components/LoggingContainer.tsx +22 -0
  313. package/src/stories/components/SurfaceContainer.tsx +62 -0
  314. package/src/stories/components/TasksContainer.tsx +51 -0
  315. package/src/stories/components/index.ts +12 -0
  316. package/src/stories/components/types.ts +11 -0
  317. package/src/stories/hooks/index.ts +6 -0
  318. package/src/stories/hooks/useFlush.ts +35 -0
  319. package/src/stories/hooks/useMatcherExtension.ts +45 -0
  320. package/src/stories/testing/data.ts +130 -0
  321. package/src/stories/testing/index.ts +6 -0
  322. package/src/stories/testing/testing.tsx +162 -0
  323. package/src/testing/test-functions.ts +9 -4
  324. package/src/testing/test-sequence.ts +18 -20
  325. package/src/tools/function.ts +4 -1
  326. package/src/tools/openapi.test.ts +10 -8
  327. package/src/tools/openapi.ts +4 -1
  328. package/src/translations.ts +29 -13
  329. package/src/types/Assistant.ts +59 -0
  330. package/src/types/AssistantAction.ts +54 -0
  331. package/src/types/defs.ts +5 -0
  332. package/src/types/index.ts +4 -2
  333. package/dist/lib/browser/ChatContainer-6XNB5NEI.mjs.map +0 -7
  334. package/dist/lib/browser/ChatDialog-IMWPRXTO.mjs.map +0 -7
  335. package/dist/lib/browser/SequenceContainer-6XOYB2RN.mjs +0 -322
  336. package/dist/lib/browser/SequenceContainer-6XOYB2RN.mjs.map +0 -7
  337. package/dist/lib/browser/TemplateContainer-6ZGGH5T4.mjs.map +0 -7
  338. package/dist/lib/browser/ai-client-ML7OQWAO.mjs +0 -39
  339. package/dist/lib/browser/ai-client-ML7OQWAO.mjs.map +0 -7
  340. package/dist/lib/browser/app-graph-builder-UJ5NHRGK.mjs.map +0 -7
  341. package/dist/lib/browser/chunk-44HZKIAW.mjs.map +0 -7
  342. package/dist/lib/browser/chunk-NTBGTFTV.mjs.map +0 -7
  343. package/dist/lib/browser/chunk-OZL4OHTU.mjs +0 -157
  344. package/dist/lib/browser/chunk-OZL4OHTU.mjs.map +0 -7
  345. package/dist/lib/browser/chunk-TQ3QW3HJ.mjs.map +0 -7
  346. package/dist/lib/browser/chunk-TU7UUGWQ.mjs +0 -203
  347. package/dist/lib/browser/chunk-TU7UUGWQ.mjs.map +0 -7
  348. package/dist/lib/browser/chunk-WPZ4UANI.mjs +0 -16
  349. package/dist/lib/browser/chunk-WPZ4UANI.mjs.map +0 -7
  350. package/dist/lib/browser/intent-resolver-LEAPB55Q.mjs +0 -42
  351. package/dist/lib/browser/intent-resolver-LEAPB55Q.mjs.map +0 -7
  352. package/dist/lib/browser/react-surface-TMF7JJA4.mjs.map +0 -7
  353. package/dist/lib/node-esm/ChatContainer-VOLG7J6N.mjs.map +0 -7
  354. package/dist/lib/node-esm/ChatDialog-B2XNUNRM.mjs.map +0 -7
  355. package/dist/lib/node-esm/SequenceContainer-WWG6IMN3.mjs +0 -323
  356. package/dist/lib/node-esm/SequenceContainer-WWG6IMN3.mjs.map +0 -7
  357. package/dist/lib/node-esm/TemplateContainer-6KRNEMVE.mjs.map +0 -7
  358. package/dist/lib/node-esm/ai-client-2FQ434CT.mjs +0 -40
  359. package/dist/lib/node-esm/ai-client-2FQ434CT.mjs.map +0 -7
  360. package/dist/lib/node-esm/app-graph-builder-MEQ5CYNI.mjs.map +0 -7
  361. package/dist/lib/node-esm/chunk-D3HTVK5D.mjs.map +0 -7
  362. package/dist/lib/node-esm/chunk-E6V2RUQ2.mjs.map +0 -7
  363. package/dist/lib/node-esm/chunk-HVMVHP4R.mjs +0 -158
  364. package/dist/lib/node-esm/chunk-HVMVHP4R.mjs.map +0 -7
  365. package/dist/lib/node-esm/chunk-HXKRKIN2.mjs +0 -18
  366. package/dist/lib/node-esm/chunk-HXKRKIN2.mjs.map +0 -7
  367. package/dist/lib/node-esm/chunk-VESVUAOS.mjs.map +0 -7
  368. package/dist/lib/node-esm/chunk-YYUVTTVK.mjs +0 -204
  369. package/dist/lib/node-esm/chunk-YYUVTTVK.mjs.map +0 -7
  370. package/dist/lib/node-esm/intent-resolver-4ULF3F7U.mjs +0 -43
  371. package/dist/lib/node-esm/intent-resolver-4ULF3F7U.mjs.map +0 -7
  372. package/dist/lib/node-esm/react-surface-6XL6SWL2.mjs.map +0 -7
  373. package/dist/types/src/capabilities/ai-client.d.ts +0 -5
  374. package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
  375. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
  376. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
  377. package/dist/types/src/components/ChatPrompt/events.d.ts +0 -17
  378. package/dist/types/src/components/ChatPrompt/events.d.ts.map +0 -1
  379. package/dist/types/src/components/TemplateContainer.d.ts +0 -9
  380. package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
  381. package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
  382. package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
  383. package/dist/types/src/hooks/useBlueprints.d.ts +0 -4
  384. package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
  385. package/dist/types/src/hooks/useContextProvider.d.ts +0 -23
  386. package/dist/types/src/hooks/useContextProvider.d.ts.map +0 -1
  387. package/dist/types/src/hooks/useServiceContainer.d.ts +0 -8
  388. package/dist/types/src/hooks/useServiceContainer.d.ts.map +0 -1
  389. package/dist/types/src/hooks/useTextInputEvents.d.ts +0 -13
  390. package/dist/types/src/hooks/useTextInputEvents.d.ts.map +0 -1
  391. package/dist/types/src/types/schema.d.ts +0 -71
  392. package/dist/types/src/types/schema.d.ts.map +0 -1
  393. package/dist/types/src/types/template.d.ts +0 -56
  394. package/dist/types/src/types/template.d.ts.map +0 -1
  395. package/src/capabilities/ai-client.ts +0 -39
  396. package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
  397. package/src/components/ChatPrompt/events.ts +0 -12
  398. package/src/components/TemplateContainer.tsx +0 -25
  399. package/src/hooks/chat-processor.test.ts +0 -15
  400. package/src/hooks/useBlueprints.ts +0 -31
  401. package/src/hooks/useChatProcessor.tsx +0 -142
  402. package/src/hooks/useServiceContainer.ts +0 -42
  403. package/src/hooks/useTextInputEvents.ts +0 -49
  404. package/src/types/schema.ts +0 -86
  405. package/src/types/template.ts +0 -66
@@ -1,39 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { effect, signal } from '@preact/signals-core';
6
-
7
- import { type AiServiceClient, EdgeAiServiceClient, OllamaAiServiceClient } from '@dxos/ai';
8
- import { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';
9
- import { ClientCapabilities } from '@dxos/plugin-client';
10
-
11
- import { AssistantCapabilities } from './capabilities';
12
- import { meta } from '../meta';
13
- import { type Assistant } from '../types';
14
-
15
- // TODO(wittjosiah): Factor out.
16
- const DEFAULT_AI_SERVICE_URL = 'http://localhost:8788';
17
-
18
- export default (context: PluginContext) => {
19
- const client = context.getCapability(ClientCapabilities.Client);
20
- const endpoint = client.config.values.runtime?.services?.ai?.server ?? DEFAULT_AI_SERVICE_URL;
21
- const aiClient = signal<AiServiceClient>(new EdgeAiServiceClient({ endpoint }));
22
-
23
- const unsubscribe = effect(() => {
24
- const settings = context.getCapability(Capabilities.SettingsStore).getStore<Assistant.Settings>(meta.id)?.value;
25
- if (settings?.llmProvider === 'ollama') {
26
- aiClient.value = new OllamaAiServiceClient();
27
- } else {
28
- aiClient.value = new EdgeAiServiceClient({
29
- endpoint,
30
- defaultGenerationOptions: {
31
- // model: '@anthropic/claude-sonnet-4-20250514',
32
- model: '@anthropic/claude-3-5-haiku-20241022',
33
- },
34
- });
35
- }
36
- });
37
-
38
- return contributes(AssistantCapabilities.AiClient, aiClient, () => unsubscribe());
39
- };
@@ -1,52 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React, { useMemo } from 'react';
6
-
7
- import { type Blueprint, type BlueprintRegistry } from '@dxos/assistant';
8
- import { DropdownMenu, IconButton, Input, useTranslation } from '@dxos/react-ui';
9
-
10
- import { meta } from '../../meta';
11
-
12
- export type ChatOptionsMenuProps = {
13
- blueprintRegistry?: BlueprintRegistry;
14
- blueprints?: Blueprint[];
15
- onChange?: (key: string, active: boolean) => void;
16
- };
17
-
18
- export const ChatOptionsMenu = ({ blueprintRegistry, blueprints, onChange }: ChatOptionsMenuProps) => {
19
- const { t } = useTranslation(meta.id);
20
- const blueprintOptions = useMemo(
21
- () => blueprintRegistry?.query().map((blueprint) => ({ key: blueprint.key, label: blueprint.name })),
22
- [blueprintRegistry],
23
- );
24
-
25
- return (
26
- <DropdownMenu.Root>
27
- <DropdownMenu.Trigger asChild disabled={!blueprintOptions?.length}>
28
- <IconButton icon='ph--plus--regular' variant='ghost' size={5} iconOnly label={t('button add blueprint')} />
29
- </DropdownMenu.Trigger>
30
- <DropdownMenu.Portal>
31
- <DropdownMenu.Content side='left'>
32
- <DropdownMenu.Viewport>
33
- {blueprintOptions?.map((option) => (
34
- <DropdownMenu.Item key={option.key}>
35
- <Input.Root>
36
- <Input.Checkbox
37
- checked={!!blueprints?.find((blueprint) => blueprint.key === option.key)}
38
- onCheckedChange={(checked) => onChange?.(option.key, !!checked)}
39
- />
40
- {/* TODO(burdon): Remove need for custom margin. */}
41
- {/* TODO(burdon): Clicking on label doesn't toggle checkbox. */}
42
- <Input.Label classNames='m-0'>{option.label}</Input.Label>
43
- </Input.Root>
44
- </DropdownMenu.Item>
45
- ))}
46
- </DropdownMenu.Viewport>
47
- <DropdownMenu.Arrow />
48
- </DropdownMenu.Content>
49
- </DropdownMenu.Portal>
50
- </DropdownMenu.Root>
51
- );
52
- };
@@ -1,12 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- export type ChatEvent =
6
- | { type: 'submit'; text: string }
7
- | { type: 'cancel' }
8
- | { type: 'thread-open' }
9
- | { type: 'thread-close' }
10
- | { type: 'scroll-to-bottom' }
11
- | { type: 'record-start' }
12
- | { type: 'record-stop' };
@@ -1,25 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { StackItem } from '@dxos/react-ui-stack';
8
-
9
- import { TemplateEditor } from './TemplateEditor';
10
- import { type TemplateType } from '../types';
11
-
12
- export type TemplateContainerProps = {
13
- role: string;
14
- template: TemplateType;
15
- };
16
-
17
- export const TemplateContainer = ({ role, template }: TemplateContainerProps) => {
18
- return (
19
- <StackItem.Content role={role} classNames='container-max-width'>
20
- <TemplateEditor template={template} />
21
- </StackItem.Content>
22
- );
23
- };
24
-
25
- export default TemplateContainer;
@@ -1,15 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { describe, it } from 'vitest';
6
-
7
- import { ChatProcessor } from './chat-processor';
8
-
9
- describe('ChatProcessor', () => {
10
- it('should be instantiable', ({ expect }) => {
11
- const client = {} as any; // TODO(burdon): Create mock.
12
- const processor = new ChatProcessor(client);
13
- expect(processor).toBeDefined();
14
- });
15
- });
@@ -1,31 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { useCallback, useState } from 'react';
6
-
7
- import { type Blueprint, type ContextBinder } from '@dxos/assistant';
8
- import { Ref } from '@dxos/echo';
9
- import { log } from '@dxos/log';
10
- import { useTimeout } from '@dxos/react-ui';
11
- import { isNonNullable } from '@dxos/util';
12
-
13
- export type UpdateCallback = (key: string, active: boolean) => void;
14
-
15
- export const useBlueprints = (context: ContextBinder): [Blueprint[], UpdateCallback] => {
16
- const [blueprints, setBlueprints] = useState<Blueprint[]>([]);
17
- useTimeout(
18
- async () => {
19
- const blueprints = (await Ref.Array.loadAll(context.blueprints.value ?? [])).filter(isNonNullable);
20
- setBlueprints(blueprints);
21
- },
22
- 0,
23
- [context],
24
- );
25
-
26
- const handleUpdate = useCallback<UpdateCallback>((key: string, active: boolean) => {
27
- log.info('update', { key, active });
28
- }, []);
29
-
30
- return [blueprints, handleUpdate] as const;
31
- };
@@ -1,142 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { useEffect, useMemo, useState } from 'react';
6
-
7
- import { DEFAULT_EDGE_MODEL, DEFAULT_OLLAMA_MODEL, type ExecutableTool } from '@dxos/ai';
8
- import { Capabilities, useCapabilities, useIntentDispatcher } from '@dxos/app-framework';
9
- import { type ArtifactDefinition, type AssociatedArtifact, createSystemPrompt } from '@dxos/artifact';
10
- import { type BlueprintRegistry, Conversation } from '@dxos/assistant';
11
- import { FunctionType, type ServiceContainer } from '@dxos/functions';
12
- import { log } from '@dxos/log';
13
- import { useConfig } from '@dxos/react-client';
14
- import { Filter, fullyQualifiedId, type Queue, type Space, useQuery } from '@dxos/react-client/echo';
15
- import { isNonNullable } from '@dxos/util';
16
-
17
- import { ChatProcessor, type ChatProcessorOptions } from '../hooks';
18
- import { convertFunctionToTool, createToolsFromService } from '../tools';
19
- import { type Assistant, ServiceType } from '../types';
20
-
21
- type UseChatProcessorProps = {
22
- /** @deprecated Why is this required? */
23
- part?: 'deck' | 'dialog';
24
- space?: Space;
25
- chat?: Assistant.Chat;
26
- // TODO(burdon): Reconcile all of below (overlapping concepts). Figure out how to inject vie effect layers.
27
- serviceContainer: ServiceContainer;
28
- blueprintRegistry?: BlueprintRegistry;
29
- settings?: Assistant.Settings;
30
- /** @deprecated */
31
- instructions?: string;
32
- /** @deprecated */
33
- artifact?: AssociatedArtifact;
34
- /** @deprecated */
35
- noPluginArtifacts?: boolean;
36
- };
37
-
38
- /**
39
- * Configure and create ChatProcessor.
40
- */
41
- export const useChatProcessor = ({
42
- part = 'deck',
43
- space,
44
- chat,
45
- serviceContainer,
46
- blueprintRegistry,
47
- settings,
48
- instructions,
49
- artifact,
50
- noPluginArtifacts,
51
- }: UseChatProcessorProps): ChatProcessor | undefined => {
52
- const { dispatchPromise: dispatch } = useIntentDispatcher();
53
- const globalTools = useCapabilities(Capabilities.Tools);
54
-
55
- // TODO(burdon): Spec artifacts.
56
- let artifacts: readonly ArtifactDefinition[] = useCapabilities(Capabilities.ArtifactDefinition);
57
- if (noPluginArtifacts) {
58
- artifacts = Stable.array;
59
- }
60
-
61
- // Services.
62
- const services = useQuery(space, Filter.type(ServiceType));
63
- const [serviceTools, setServiceTools] = useState<ExecutableTool[]>([]);
64
- useEffect(() => {
65
- log('creating service tools...');
66
- queueMicrotask(async () => {
67
- const tools = await Promise.all(services.map((service) => createToolsFromService(service)));
68
- setServiceTools(tools.flat());
69
- });
70
- }, [services]);
71
-
72
- // Tools and context.
73
- const config = useConfig();
74
- const functions = useQuery(space, Filter.type(FunctionType));
75
- const chatId = useMemo(() => (chat ? fullyQualifiedId(chat) : undefined), [chat]);
76
- const [tools, extensions] = useMemo(() => {
77
- log('creating tools...');
78
- const tools: ExecutableTool[] = [
79
- ...globalTools.flat(),
80
- ...serviceTools,
81
- ...functions
82
- .map((fn) => convertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? '', space?.id))
83
- .filter(isNonNullable),
84
- ];
85
- const extensions = { part, space, dispatch, pivotId: chatId };
86
- return [tools, extensions];
87
- }, [dispatch, globalTools, space, chatId, serviceTools, functions]);
88
-
89
- // Prompt.
90
- const systemPrompt = useMemo(
91
- () =>
92
- createSystemPrompt({
93
- artifacts: artifacts.map((definition) => `${definition.name}\n${definition.instructions}`),
94
- artifact,
95
- instructions,
96
- }),
97
- [artifacts, artifact, instructions],
98
- );
99
-
100
- // TODO(burdon): Remove default (let backend decide if not specified).
101
- const model: ChatProcessorOptions['model'] =
102
- settings?.llmProvider === 'ollama'
103
- ? ((settings?.ollamaModel ?? DEFAULT_OLLAMA_MODEL) as ChatProcessorOptions['model'])
104
- : ((settings?.edgeModel ?? DEFAULT_EDGE_MODEL) as ChatProcessorOptions['model']);
105
-
106
- const conversation = useMemo(() => {
107
- if (!chat?.queue.target) {
108
- return;
109
- }
110
-
111
- return new Conversation({
112
- serviceContainer,
113
- queue: chat.queue.target as Queue<any>,
114
- });
115
- }, [chat?.queue.target, serviceContainer]);
116
-
117
- // Create processor.
118
- // TODO(burdon): Updated on each query update above; should just update current processor.
119
- const processor = useMemo(() => {
120
- if (!conversation) {
121
- return undefined;
122
- }
123
-
124
- log('creating processor...', { settings });
125
- return new ChatProcessor(conversation, {
126
- tools,
127
- extensions,
128
- blueprintRegistry,
129
- artifacts,
130
- systemPrompt,
131
- model,
132
- });
133
- }, [conversation, tools, blueprintRegistry, artifacts, extensions, systemPrompt, model]);
134
-
135
- return processor;
136
- };
137
-
138
- // TODO(dmaretskyi): Extract.
139
- export const Stable = Object.freeze({
140
- array: [] as readonly never[],
141
- object: {} as {},
142
- });
@@ -1,42 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { useEffect, useMemo, useState } from 'react';
6
-
7
- import { ToolRegistry } from '@dxos/ai';
8
- import { Capabilities, useCapabilities, useCapability } from '@dxos/app-framework';
9
- import { AiService, DatabaseService, QueueService, ServiceContainer, ToolResolverService } from '@dxos/functions';
10
- import { type Space } from '@dxos/react-client/echo';
11
-
12
- import { AssistantCapabilities } from '../capabilities';
13
-
14
- interface UseServiceContainerProps {
15
- space?: Space;
16
- }
17
-
18
- export const useServiceContainer = ({ space }: UseServiceContainerProps) => {
19
- const aiClient = useCapability(AssistantCapabilities.AiClient);
20
- const tools = useCapabilities(Capabilities.Tools).flat();
21
-
22
- const [toolRegistry] = useState(() => new ToolRegistry([]));
23
- useEffect(() => {
24
- for (const tool of tools) {
25
- if (!toolRegistry.has(tool)) {
26
- toolRegistry.register(tool);
27
- }
28
- }
29
- }, [toolRegistry, JSON.stringify(tools.map((tool) => tool.id))]);
30
-
31
- return useMemo(
32
- () =>
33
- new ServiceContainer().setServices({
34
- ai: AiService.make(aiClient.value),
35
- database: space ? DatabaseService.make(space.db) : undefined,
36
- queues: space ? QueueService.make(space.queues, undefined) : undefined,
37
- // eventLogger: consoleLogger,
38
- toolResolver: ToolResolverService.make(toolRegistry),
39
- }),
40
- [space, aiClient],
41
- );
42
- };
@@ -1,49 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { useState, useCallback, type KeyboardEventHandler, type ChangeEventHandler } from 'react';
6
-
7
- /**
8
- * Hook that handles text input events.
9
- */
10
- // TODO(burdon): Factor out.
11
- export const useTextInputEvents = ({
12
- onEnter,
13
- onEscape,
14
- }: {
15
- onEnter?: (text: string) => boolean | void;
16
- onEscape?: () => void;
17
- }) => {
18
- const [value, setValue] = useState('');
19
-
20
- const onKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>(
21
- (ev) => {
22
- switch (ev.key) {
23
- case 'Escape': {
24
- onEscape?.();
25
- setValue('');
26
- break;
27
- }
28
-
29
- case 'Enter': {
30
- const value = (ev.target as HTMLInputElement).value.trim();
31
- if (value.length > 0) {
32
- const reset = onEnter?.(value);
33
- if (reset) {
34
- setValue('');
35
- }
36
- }
37
- break;
38
- }
39
- }
40
- },
41
- [onEnter, onEscape],
42
- );
43
-
44
- const onChange = useCallback<ChangeEventHandler<HTMLInputElement>>((ev) => {
45
- setValue(ev.target.value);
46
- }, []);
47
-
48
- return [{ value, onKeyDown, onChange }, setValue];
49
- };
@@ -1,86 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { Schema } from 'effect';
6
-
7
- import { SpaceSchema, Queue } from '@dxos/client/echo';
8
- import { Sequence } from '@dxos/conductor';
9
- import { Type } from '@dxos/echo';
10
- import { LabelAnnotation } from '@dxos/echo-schema';
11
-
12
- import { meta } from '../meta';
13
-
14
- export const LLM_PROVIDERS = ['edge', 'ollama', 'lmstudio'] as const;
15
-
16
- export namespace Assistant {
17
- //
18
- // Types
19
- //
20
-
21
- export const Chat = Schema.Struct({
22
- id: Type.ObjectId,
23
- name: Schema.optional(Schema.String),
24
- queue: Type.Ref(Queue),
25
- }).pipe(
26
- Type.Obj({
27
- typename: 'dxos.org/type/assistant/Chat',
28
- version: '0.2.0',
29
- }),
30
- LabelAnnotation.set(['name']),
31
- );
32
-
33
- export interface Chat extends Schema.Schema.Type<typeof Chat> {}
34
-
35
- export const CompanionTo = Schema.Struct({
36
- id: Type.ObjectId,
37
- }).pipe(
38
- Type.Relation({
39
- typename: 'dxos.org/relation/assistant/CompanionTo',
40
- version: '0.1.0',
41
- source: Chat,
42
- target: Type.Expando,
43
- }),
44
- );
45
-
46
- export interface CompanionTo extends Schema.Schema.Type<typeof CompanionTo> {}
47
-
48
- //
49
- // Settings
50
- //
51
-
52
- export const Settings = Schema.mutable(
53
- Schema.Struct({
54
- llmProvider: Schema.optional(Schema.Literal(...LLM_PROVIDERS)),
55
- edgeModel: Schema.optional(Schema.String),
56
- ollamaModel: Schema.optional(Schema.String),
57
- lmstudioModel: Schema.optional(Schema.String),
58
- customPrompts: Schema.optional(Schema.Boolean),
59
- }),
60
- );
61
-
62
- export type Settings = Schema.Schema.Type<typeof Settings>;
63
-
64
- //
65
- // Actions
66
- //
67
-
68
- export class CreateChat extends Schema.TaggedClass<CreateChat>()(`${meta.id}/action}/create-chat`, {
69
- input: Schema.Struct({
70
- space: SpaceSchema,
71
- name: Schema.optional(Schema.String),
72
- }),
73
- output: Schema.Struct({
74
- object: Assistant.Chat,
75
- }),
76
- }) {}
77
-
78
- export class CreateSequence extends Schema.TaggedClass<CreateSequence>()(`${meta.id}/action}/create-sequence`, {
79
- input: Schema.Struct({
80
- name: Schema.optional(Schema.String),
81
- }),
82
- output: Schema.Struct({
83
- object: Sequence,
84
- }),
85
- }) {}
86
- }
@@ -1,66 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { Schema } from 'effect';
6
-
7
- import { Type } from '@dxos/echo';
8
- import { LabelAnnotation } from '@dxos/echo-schema';
9
-
10
- // TODO(burdon): Change to Schema.Literal (and discriminated union).
11
- export enum TemplateInputType {
12
- VALUE = 0,
13
- PASS_THROUGH = 1,
14
- RETRIEVER = 2,
15
- FUNCTION = 3,
16
- QUERY = 4,
17
- RESOLVER = 5,
18
- CONTEXT = 6,
19
- SCHEMA = 7,
20
- }
21
-
22
- export const TemplateInputSchema = Schema.mutable(
23
- Schema.Struct({
24
- name: Schema.String,
25
- type: Schema.optional(Schema.Enums(TemplateInputType)),
26
- value: Schema.optional(Schema.String),
27
- }),
28
- );
29
-
30
- export type TemplateInput = Schema.Schema.Type<typeof TemplateInputSchema>;
31
-
32
- export const TemplateKinds = ['always', 'schema-matching', 'automatically', 'manual'] as const;
33
- export type TemplateKind = (typeof TemplateKinds)[number];
34
-
35
- export const TemplateKindSchema = Schema.Union(
36
- Schema.Struct({
37
- include: Schema.Literal('always'),
38
- }),
39
- Schema.Struct({
40
- include: Schema.Literal('schema-matching'),
41
- typename: Schema.String,
42
- }),
43
- Schema.Struct({
44
- include: Schema.Literal('automatically'),
45
- description: Schema.String,
46
- }),
47
- Schema.Struct({
48
- include: Schema.Literal('manual'),
49
- }),
50
- );
51
-
52
- export type TemplateKindType = Schema.Schema.Type<typeof TemplateKindSchema>;
53
- export const TemplateType = Schema.Struct({
54
- name: Schema.optional(Schema.String),
55
- kind: Schema.mutable(TemplateKindSchema),
56
- source: Schema.String,
57
- inputs: Schema.optional(Schema.mutable(Schema.Array(TemplateInputSchema))),
58
- command: Schema.optional(Schema.String),
59
- }).pipe(
60
- LabelAnnotation.set(['name']),
61
- Type.Obj({
62
- typename: 'dxos.org/type/Template',
63
- version: '0.1.0',
64
- }),
65
- );
66
- export interface TemplateType extends Schema.Schema.Type<typeof TemplateType> {}