@dxos/assistant-toolkit 0.8.4-main.66e292d → 0.8.4-main.6fa680abb7

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 (418) hide show
  1. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  2. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  3. package/dist/lib/{browser → neutral}/index.mjs +3478 -2472
  4. package/dist/lib/neutral/index.mjs.map +7 -0
  5. package/dist/lib/neutral/meta.json +1 -0
  6. package/dist/lib/neutral/testing/index.mjs +81 -0
  7. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  8. package/dist/types/src/blueprints/browser/blueprint.d.ts +4 -0
  9. package/dist/types/src/blueprints/browser/blueprint.d.ts.map +1 -0
  10. package/dist/types/src/blueprints/browser/blueprint.test.d.ts +2 -0
  11. package/dist/types/src/blueprints/browser/blueprint.test.d.ts.map +1 -0
  12. package/dist/types/src/blueprints/browser/index.d.ts +2 -0
  13. package/dist/types/src/blueprints/browser/index.d.ts.map +1 -0
  14. package/dist/types/src/blueprints/database/blueprint.d.ts +4 -0
  15. package/dist/types/src/blueprints/database/blueprint.d.ts.map +1 -0
  16. package/dist/types/src/blueprints/database/blueprint.test.d.ts +2 -0
  17. package/dist/types/src/blueprints/database/blueprint.test.d.ts.map +1 -0
  18. package/dist/types/src/blueprints/database/functions/context-add.d.ts +6 -0
  19. package/dist/types/src/blueprints/database/functions/context-add.d.ts.map +1 -0
  20. package/dist/types/src/blueprints/database/functions/context-remove.d.ts +6 -0
  21. package/dist/types/src/blueprints/database/functions/context-remove.d.ts.map +1 -0
  22. package/dist/types/src/blueprints/database/functions/index.d.ts +57 -0
  23. package/dist/types/src/blueprints/database/functions/index.d.ts.map +1 -0
  24. package/dist/types/src/blueprints/database/functions/load.d.ts +6 -0
  25. package/dist/types/src/blueprints/database/functions/load.d.ts.map +1 -0
  26. package/dist/types/src/blueprints/database/functions/object-create.d.ts +6 -0
  27. package/dist/types/src/blueprints/database/functions/object-create.d.ts.map +1 -0
  28. package/dist/types/src/blueprints/database/functions/object-delete.d.ts +6 -0
  29. package/dist/types/src/blueprints/database/functions/object-delete.d.ts.map +1 -0
  30. package/dist/types/src/blueprints/database/functions/object-update.d.ts +9 -0
  31. package/dist/types/src/blueprints/database/functions/object-update.d.ts.map +1 -0
  32. package/dist/types/src/blueprints/database/functions/query.d.ts +9 -0
  33. package/dist/types/src/blueprints/database/functions/query.d.ts.map +1 -0
  34. package/dist/types/src/blueprints/database/functions/relation-create.d.ts +9 -0
  35. package/dist/types/src/blueprints/database/functions/relation-create.d.ts.map +1 -0
  36. package/dist/types/src/blueprints/database/functions/relation-delete.d.ts +6 -0
  37. package/dist/types/src/blueprints/database/functions/relation-delete.d.ts.map +1 -0
  38. package/dist/types/src/blueprints/database/functions/schema-add.d.ts +7 -0
  39. package/dist/types/src/blueprints/database/functions/schema-add.d.ts.map +1 -0
  40. package/dist/types/src/blueprints/database/functions/schema-list.d.ts +5 -0
  41. package/dist/types/src/blueprints/database/functions/schema-list.d.ts.map +1 -0
  42. package/dist/types/src/blueprints/database/functions/tag-add.d.ts +7 -0
  43. package/dist/types/src/blueprints/database/functions/tag-add.d.ts.map +1 -0
  44. package/dist/types/src/blueprints/database/functions/tag-remove.d.ts +7 -0
  45. package/dist/types/src/blueprints/database/functions/tag-remove.d.ts.map +1 -0
  46. package/dist/types/src/blueprints/database/index.d.ts +3 -0
  47. package/dist/types/src/blueprints/database/index.d.ts.map +1 -0
  48. package/dist/types/src/blueprints/design/blueprint.d.ts +4 -0
  49. package/dist/types/src/blueprints/design/blueprint.d.ts.map +1 -0
  50. package/dist/types/src/blueprints/design/blueprint.test.d.ts +2 -0
  51. package/dist/types/src/blueprints/design/blueprint.test.d.ts.map +1 -0
  52. package/dist/types/src/blueprints/design/index.d.ts +1 -2
  53. package/dist/types/src/blueprints/design/index.d.ts.map +1 -1
  54. package/dist/types/src/blueprints/discord/blueprint.d.ts +4 -0
  55. package/dist/types/src/blueprints/discord/blueprint.d.ts.map +1 -0
  56. package/dist/types/src/blueprints/discord/functions/fetch-messages.d.ts.map +1 -0
  57. package/dist/types/src/blueprints/discord/functions/fetch-messages.test.d.ts.map +1 -0
  58. package/dist/types/src/{functions/discord → blueprints/discord/functions}/index.d.ts +3 -3
  59. package/dist/types/src/blueprints/discord/functions/index.d.ts.map +1 -0
  60. package/dist/types/src/blueprints/discord/index.d.ts +1 -2
  61. package/dist/types/src/blueprints/discord/index.d.ts.map +1 -1
  62. package/dist/types/src/blueprints/github/functions/fetch-prs.d.ts.map +1 -0
  63. package/dist/types/src/blueprints/github/functions/index.d.ts +7 -0
  64. package/dist/types/src/blueprints/github/functions/index.d.ts.map +1 -0
  65. package/dist/types/src/blueprints/github/index.d.ts +1 -0
  66. package/dist/types/src/blueprints/github/index.d.ts.map +1 -0
  67. package/dist/types/src/blueprints/index.d.ts +11 -6
  68. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  69. package/dist/types/src/blueprints/linear/blueprint.d.ts +4 -0
  70. package/dist/types/src/blueprints/linear/blueprint.d.ts.map +1 -0
  71. package/dist/types/src/blueprints/linear/functions/index.d.ts +9 -0
  72. package/dist/types/src/blueprints/linear/functions/index.d.ts.map +1 -0
  73. package/dist/types/src/blueprints/linear/functions/linear.test.d.ts.map +1 -0
  74. package/dist/types/src/{functions/linear → blueprints/linear/functions}/sync-issues.d.ts +1 -1
  75. package/dist/types/src/blueprints/linear/functions/sync-issues.d.ts.map +1 -0
  76. package/dist/types/src/blueprints/linear/index.d.ts +1 -2
  77. package/dist/types/src/blueprints/linear/index.d.ts.map +1 -1
  78. package/dist/types/src/blueprints/markdown/blueprint.d.ts +4 -0
  79. package/dist/types/src/blueprints/markdown/blueprint.d.ts.map +1 -0
  80. package/dist/types/src/{functions/document/update.d.ts → blueprints/markdown/functions/create.d.ts} +2 -2
  81. package/dist/types/src/blueprints/markdown/functions/create.d.ts.map +1 -0
  82. package/dist/types/src/blueprints/markdown/functions/index.d.ts +30 -0
  83. package/dist/types/src/blueprints/markdown/functions/index.d.ts.map +1 -0
  84. package/dist/types/src/blueprints/markdown/functions/read.d.ts +14 -0
  85. package/dist/types/src/blueprints/markdown/functions/read.d.ts.map +1 -0
  86. package/dist/types/src/blueprints/markdown/functions/update.d.ts +13 -0
  87. package/dist/types/src/blueprints/markdown/functions/update.d.ts.map +1 -0
  88. package/dist/types/src/blueprints/markdown/index.d.ts +3 -0
  89. package/dist/types/src/blueprints/markdown/index.d.ts.map +1 -0
  90. package/dist/types/src/blueprints/memory/blueprint.d.ts +4 -0
  91. package/dist/types/src/blueprints/memory/blueprint.d.ts.map +1 -0
  92. package/dist/types/src/blueprints/memory/blueprint.test.d.ts +2 -0
  93. package/dist/types/src/blueprints/memory/blueprint.test.d.ts.map +1 -0
  94. package/dist/types/src/blueprints/memory/functions/delete.d.ts +8 -0
  95. package/dist/types/src/blueprints/memory/functions/delete.d.ts.map +1 -0
  96. package/dist/types/src/blueprints/memory/functions/index.d.ts +17 -0
  97. package/dist/types/src/blueprints/memory/functions/index.d.ts.map +1 -0
  98. package/dist/types/src/blueprints/memory/functions/query.d.ts +6 -0
  99. package/dist/types/src/blueprints/memory/functions/query.d.ts.map +1 -0
  100. package/dist/types/src/{functions/document/read.d.ts → blueprints/memory/functions/save.d.ts} +3 -4
  101. package/dist/types/src/blueprints/memory/functions/save.d.ts.map +1 -0
  102. package/dist/types/src/blueprints/memory/index.d.ts +3 -0
  103. package/dist/types/src/blueprints/memory/index.d.ts.map +1 -0
  104. package/dist/types/src/blueprints/planning/blueprint.d.ts +4 -0
  105. package/dist/types/src/blueprints/planning/blueprint.d.ts.map +1 -0
  106. package/dist/types/src/blueprints/planning/functions/index.d.ts +10 -0
  107. package/dist/types/src/blueprints/planning/functions/index.d.ts.map +1 -0
  108. package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts +9 -0
  109. package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts.map +1 -0
  110. package/dist/types/src/blueprints/planning/index.d.ts +1 -2
  111. package/dist/types/src/blueprints/planning/index.d.ts.map +1 -1
  112. package/dist/types/src/blueprints/planning-old/blueprint.d.ts +4 -0
  113. package/dist/types/src/blueprints/planning-old/blueprint.d.ts.map +1 -0
  114. package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts +2 -0
  115. package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts.map +1 -0
  116. package/dist/types/src/blueprints/planning-old/functions/index.d.ts +29 -0
  117. package/dist/types/src/blueprints/planning-old/functions/index.d.ts.map +1 -0
  118. package/dist/types/src/blueprints/planning-old/functions/read.d.ts +14 -0
  119. package/dist/types/src/blueprints/planning-old/functions/read.d.ts.map +1 -0
  120. package/dist/types/src/blueprints/planning-old/functions/task-list.d.ts.map +1 -0
  121. package/dist/types/src/blueprints/planning-old/functions/task-list.test.d.ts.map +1 -0
  122. package/dist/types/src/blueprints/planning-old/functions/update.d.ts +16 -0
  123. package/dist/types/src/blueprints/planning-old/functions/update.d.ts.map +1 -0
  124. package/dist/types/src/blueprints/planning-old/index.d.ts +2 -0
  125. package/dist/types/src/blueprints/planning-old/index.d.ts.map +1 -0
  126. package/dist/types/src/blueprints/project/blueprint.d.ts +4 -0
  127. package/dist/types/src/blueprints/project/blueprint.d.ts.map +1 -0
  128. package/dist/types/src/blueprints/project/blueprint.test.d.ts +2 -0
  129. package/dist/types/src/blueprints/project/blueprint.test.d.ts.map +1 -0
  130. package/dist/types/src/blueprints/project/functions/add-artifact.d.ts +7 -0
  131. package/dist/types/src/blueprints/project/functions/add-artifact.d.ts.map +1 -0
  132. package/dist/types/src/blueprints/project/functions/agent.d.ts +62 -0
  133. package/dist/types/src/blueprints/project/functions/agent.d.ts.map +1 -0
  134. package/dist/types/src/blueprints/project/functions/get-context.d.ts +13 -0
  135. package/dist/types/src/blueprints/project/functions/get-context.d.ts.map +1 -0
  136. package/dist/types/src/blueprints/project/functions/index.d.ts +133 -0
  137. package/dist/types/src/blueprints/project/functions/index.d.ts.map +1 -0
  138. package/dist/types/src/blueprints/project/functions/qualifier.d.ts +60 -0
  139. package/dist/types/src/blueprints/project/functions/qualifier.d.ts.map +1 -0
  140. package/dist/types/src/blueprints/project/index.d.ts +3 -0
  141. package/dist/types/src/blueprints/project/index.d.ts.map +1 -0
  142. package/dist/types/src/blueprints/research/blueprint.d.ts +4 -0
  143. package/dist/types/src/blueprints/research/blueprint.d.ts.map +1 -0
  144. package/dist/types/src/blueprints/research/blueprint.test.d.ts +2 -0
  145. package/dist/types/src/blueprints/research/blueprint.test.d.ts.map +1 -0
  146. package/dist/types/src/{functions/research → blueprints/research/functions}/document-create.d.ts +2 -1
  147. package/dist/types/src/blueprints/research/functions/document-create.d.ts.map +1 -0
  148. package/dist/types/src/{functions/research → blueprints/research/functions}/index.d.ts +6 -8
  149. package/dist/types/src/blueprints/research/functions/index.d.ts.map +1 -0
  150. package/dist/types/src/{functions/research → blueprints/research/functions}/research.d.ts +1 -1
  151. package/dist/types/src/blueprints/research/functions/research.d.ts.map +1 -0
  152. package/dist/types/src/blueprints/research/functions/research.test.d.ts.map +1 -0
  153. package/dist/types/src/blueprints/research/index.d.ts +2 -2
  154. package/dist/types/src/blueprints/research/index.d.ts.map +1 -1
  155. package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts +18 -0
  156. package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts.map +1 -0
  157. package/dist/types/src/blueprints/research/types/index.d.ts +7 -0
  158. package/dist/types/src/blueprints/research/types/index.d.ts.map +1 -0
  159. package/dist/types/src/blueprints/testing.d.ts +18 -4
  160. package/dist/types/src/blueprints/testing.d.ts.map +1 -1
  161. package/dist/types/src/blueprints/websearch/blueprint.d.ts +4 -0
  162. package/dist/types/src/blueprints/websearch/blueprint.d.ts.map +1 -0
  163. package/dist/types/src/blueprints/websearch/index.d.ts +2 -3
  164. package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -1
  165. package/dist/types/src/blueprints/websearch/{websearch-toolkit.d.ts → toolkit.d.ts} +1 -1
  166. package/dist/types/src/blueprints/websearch/toolkit.d.ts.map +1 -0
  167. package/dist/types/src/crud/graph.d.ts +14 -11
  168. package/dist/types/src/crud/graph.d.ts.map +1 -1
  169. package/dist/types/src/functions/agent/index.d.ts +84 -4
  170. package/dist/types/src/functions/agent/index.d.ts.map +1 -1
  171. package/dist/types/src/functions/agent/prompt.d.ts +79 -4
  172. package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
  173. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +136 -129
  174. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
  175. package/dist/types/src/functions/entity-extraction/index.d.ts +138 -132
  176. package/dist/types/src/functions/entity-extraction/index.d.ts.map +1 -1
  177. package/dist/types/src/functions/exa/data/exa-search-1748337321991.d.ts.map +1 -0
  178. package/dist/types/src/functions/exa/data/exa-search-1748337331526.d.ts.map +1 -0
  179. package/dist/types/src/functions/exa/data/exa-search-1748337344119.d.ts.map +1 -0
  180. package/dist/types/src/functions/exa/data/index.d.ts.map +1 -0
  181. package/dist/types/src/functions/exa/index.d.ts +8 -2
  182. package/dist/types/src/functions/exa/index.d.ts.map +1 -1
  183. package/dist/types/src/functions/index.d.ts +1 -5
  184. package/dist/types/src/functions/index.d.ts.map +1 -1
  185. package/dist/types/src/index.d.ts +2 -2
  186. package/dist/types/src/index.d.ts.map +1 -1
  187. package/dist/types/src/sync/sync.d.ts +3 -3
  188. package/dist/types/src/sync/sync.d.ts.map +1 -1
  189. package/dist/types/src/testing/index.d.ts +2 -1
  190. package/dist/types/src/testing/index.d.ts.map +1 -1
  191. package/dist/types/src/testing/plugins.d.ts +19 -0
  192. package/dist/types/src/testing/plugins.d.ts.map +1 -0
  193. package/dist/types/src/toolkits/WebToolkit.d.ts +38 -0
  194. package/dist/types/src/toolkits/WebToolkit.d.ts.map +1 -0
  195. package/dist/types/src/toolkits/index.d.ts +1 -2
  196. package/dist/types/src/toolkits/index.d.ts.map +1 -1
  197. package/dist/types/src/types/Chat.d.ts +31 -0
  198. package/dist/types/src/types/Chat.d.ts.map +1 -0
  199. package/dist/types/src/types/Memory.d.ts +12 -0
  200. package/dist/types/src/types/Memory.d.ts.map +1 -0
  201. package/dist/types/src/types/Plan.d.ts +77 -0
  202. package/dist/types/src/types/Plan.d.ts.map +1 -0
  203. package/dist/types/src/types/Project.d.ts +67 -0
  204. package/dist/types/src/types/Project.d.ts.map +1 -0
  205. package/dist/types/src/types/index.d.ts +5 -0
  206. package/dist/types/src/types/index.d.ts.map +1 -0
  207. package/dist/types/tsconfig.tsbuildinfo +1 -1
  208. package/package.json +49 -40
  209. package/src/blueprints/browser/blueprint.conversations.json +1 -0
  210. package/src/blueprints/browser/blueprint.test.ts +70 -0
  211. package/src/blueprints/browser/blueprint.ts +41 -0
  212. package/src/blueprints/browser/index.ts +5 -0
  213. package/src/blueprints/database/blueprint.conversations.json +1 -0
  214. package/src/blueprints/database/blueprint.test.ts +321 -0
  215. package/src/blueprints/database/blueprint.ts +39 -0
  216. package/src/blueprints/database/functions/context-add.ts +35 -0
  217. package/src/blueprints/database/functions/context-remove.ts +35 -0
  218. package/src/blueprints/database/functions/index.ts +33 -0
  219. package/src/blueprints/database/functions/load.ts +31 -0
  220. package/src/blueprints/database/functions/object-create.ts +35 -0
  221. package/src/blueprints/database/functions/object-delete.ts +27 -0
  222. package/src/blueprints/database/functions/object-update.ts +32 -0
  223. package/src/blueprints/database/functions/query.ts +126 -0
  224. package/src/blueprints/database/functions/relation-create.ts +47 -0
  225. package/src/blueprints/database/functions/relation-delete.ts +28 -0
  226. package/src/blueprints/database/functions/schema-add.ts +40 -0
  227. package/src/blueprints/database/functions/schema-list.ts +34 -0
  228. package/src/blueprints/database/functions/tag-add.ts +31 -0
  229. package/src/blueprints/database/functions/tag-remove.ts +30 -0
  230. package/src/blueprints/database/index.ts +6 -0
  231. package/src/blueprints/design/{design-blueprint.test.ts → blueprint.test.ts} +19 -26
  232. package/src/blueprints/design/{design-blueprint.ts → blueprint.ts} +24 -11
  233. package/src/blueprints/design/index.ts +1 -3
  234. package/src/blueprints/discord/blueprint.ts +46 -0
  235. package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.ts +5 -8
  236. package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.ts +2 -2
  237. package/src/blueprints/discord/functions/index.ts +9 -0
  238. package/src/blueprints/discord/index.ts +1 -3
  239. package/src/{functions/github → blueprints/github/functions}/fetch-prs.ts +4 -3
  240. package/src/blueprints/github/functions/index.ts +9 -0
  241. package/src/blueprints/github/index.ts +3 -0
  242. package/src/blueprints/index.ts +11 -6
  243. package/src/blueprints/linear/blueprint.ts +47 -0
  244. package/src/blueprints/linear/functions/index.ts +9 -0
  245. package/src/blueprints/linear/functions/linear.test.ts +58 -0
  246. package/src/{functions/linear → blueprints/linear/functions}/sync-issues.ts +13 -11
  247. package/src/blueprints/linear/index.ts +1 -3
  248. package/src/blueprints/markdown/blueprint.ts +38 -0
  249. package/src/blueprints/markdown/functions/create.ts +29 -0
  250. package/src/blueprints/markdown/functions/index.ts +13 -0
  251. package/src/blueprints/markdown/functions/read.ts +32 -0
  252. package/src/{functions/document → blueprints/markdown/functions}/update.ts +10 -8
  253. package/src/blueprints/markdown/index.ts +6 -0
  254. package/src/blueprints/memory/blueprint.conversations.json +1 -0
  255. package/src/blueprints/memory/blueprint.test.ts +135 -0
  256. package/src/blueprints/memory/blueprint.ts +44 -0
  257. package/src/blueprints/memory/functions/delete.ts +25 -0
  258. package/src/blueprints/memory/functions/index.ts +13 -0
  259. package/src/blueprints/memory/functions/query.ts +49 -0
  260. package/src/blueprints/memory/functions/save.ts +32 -0
  261. package/src/blueprints/memory/index.ts +6 -0
  262. package/src/blueprints/planning/blueprint.ts +28 -0
  263. package/src/blueprints/planning/functions/index.ts +9 -0
  264. package/src/blueprints/planning/functions/update-tasks.ts +168 -0
  265. package/src/blueprints/planning/index.ts +2 -4
  266. package/src/blueprints/{planning/planning-blueprint.test.ts → planning-old/blueprint.test.ts} +17 -19
  267. package/src/blueprints/{planning/planning-blueprint.ts → planning-old/blueprint.ts} +23 -11
  268. package/src/blueprints/planning-old/functions/index.ts +11 -0
  269. package/src/{functions/tasks → blueprints/planning-old/functions}/read.ts +7 -7
  270. package/src/{functions/tasks → blueprints/planning-old/functions}/update.ts +7 -7
  271. package/src/blueprints/planning-old/index.ts +5 -0
  272. package/src/blueprints/project/blueprint.test.ts +579 -0
  273. package/src/blueprints/project/blueprint.ts +68 -0
  274. package/src/blueprints/project/functions/add-artifact.ts +41 -0
  275. package/src/blueprints/project/functions/agent.ts +72 -0
  276. package/src/blueprints/project/functions/get-context.ts +63 -0
  277. package/src/blueprints/project/functions/index.ts +15 -0
  278. package/src/blueprints/project/functions/qualifier.ts +96 -0
  279. package/src/blueprints/project/index.ts +6 -0
  280. package/src/blueprints/research/{research-blueprint.ts → blueprint.ts} +24 -12
  281. package/src/{functions/research → blueprints/research/functions}/document-create.ts +10 -12
  282. package/src/blueprints/research/functions/index.ts +11 -0
  283. package/src/{functions/research → blueprints/research/functions}/research-instructions.tpl +5 -5
  284. package/src/blueprints/research/functions/research.conversations.json +1 -0
  285. package/src/{functions/research → blueprints/research/functions}/research.test.ts +40 -70
  286. package/src/{functions/research → blueprints/research/functions}/research.ts +19 -34
  287. package/src/blueprints/research/index.ts +2 -3
  288. package/src/blueprints/research/types/ResearchGraph.ts +49 -0
  289. package/src/{functions/research/types.ts → blueprints/research/types/index.ts} +12 -6
  290. package/src/blueprints/testing.ts +36 -5
  291. package/src/blueprints/websearch/blueprint.ts +32 -0
  292. package/src/blueprints/websearch/index.ts +2 -4
  293. package/src/crud/graph.test.ts +6 -29
  294. package/src/crud/graph.ts +21 -23
  295. package/src/functions/READ_THIS.md +5 -0
  296. package/src/functions/agent/index.ts +4 -6
  297. package/src/functions/agent/prompt.ts +20 -26
  298. package/src/functions/entity-extraction/entity-extraction.conversations.json +1 -1
  299. package/src/functions/entity-extraction/entity-extraction.test.ts +13 -31
  300. package/src/functions/entity-extraction/entity-extraction.ts +44 -27
  301. package/src/functions/entity-extraction/index.ts +4 -4
  302. package/src/functions/exa/exa.ts +2 -2
  303. package/src/functions/exa/index.ts +7 -2
  304. package/src/functions/exa/mock.ts +2 -2
  305. package/src/functions/index.ts +1 -5
  306. package/src/index.ts +2 -2
  307. package/src/sync/sync.ts +38 -30
  308. package/src/testing/index.ts +2 -1
  309. package/src/{plugins.tsx → testing/plugins.tsx} +27 -23
  310. package/src/toolkits/WebToolkit.ts +33 -0
  311. package/src/toolkits/index.ts +1 -2
  312. package/src/types/Chat.ts +51 -0
  313. package/src/types/Memory.ts +23 -0
  314. package/src/types/Plan.ts +110 -0
  315. package/src/types/Project.ts +198 -0
  316. package/src/types/index.ts +8 -0
  317. package/dist/lib/browser/index.mjs.map +0 -7
  318. package/dist/lib/browser/meta.json +0 -1
  319. package/dist/lib/node-esm/index.mjs +0 -2779
  320. package/dist/lib/node-esm/index.mjs.map +0 -7
  321. package/dist/lib/node-esm/meta.json +0 -1
  322. package/dist/types/src/blueprints/design/design-blueprint.d.ts +0 -4
  323. package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +0 -1
  324. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts +0 -2
  325. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts.map +0 -1
  326. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +0 -19
  327. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +0 -1
  328. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +0 -19
  329. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +0 -1
  330. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +0 -4
  331. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +0 -1
  332. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts +0 -2
  333. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts.map +0 -1
  334. package/dist/types/src/blueprints/research/research-blueprint.d.ts +0 -4
  335. package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +0 -1
  336. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts +0 -2
  337. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts.map +0 -1
  338. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +0 -4
  339. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +0 -1
  340. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts.map +0 -1
  341. package/dist/types/src/experimental/feed.test.d.ts +0 -2
  342. package/dist/types/src/experimental/feed.test.d.ts.map +0 -1
  343. package/dist/types/src/functions/discord/fetch-messages.d.ts.map +0 -1
  344. package/dist/types/src/functions/discord/fetch-messages.test.d.ts.map +0 -1
  345. package/dist/types/src/functions/discord/index.d.ts.map +0 -1
  346. package/dist/types/src/functions/document/index.d.ts +0 -13
  347. package/dist/types/src/functions/document/index.d.ts.map +0 -1
  348. package/dist/types/src/functions/document/read.d.ts.map +0 -1
  349. package/dist/types/src/functions/document/update.d.ts.map +0 -1
  350. package/dist/types/src/functions/github/fetch-prs.d.ts.map +0 -1
  351. package/dist/types/src/functions/linear/index.d.ts +0 -9
  352. package/dist/types/src/functions/linear/index.d.ts.map +0 -1
  353. package/dist/types/src/functions/linear/linear.test.d.ts.map +0 -1
  354. package/dist/types/src/functions/linear/sync-issues.d.ts.map +0 -1
  355. package/dist/types/src/functions/research/document-create.d.ts.map +0 -1
  356. package/dist/types/src/functions/research/index.d.ts.map +0 -1
  357. package/dist/types/src/functions/research/research-graph.d.ts +0 -18
  358. package/dist/types/src/functions/research/research-graph.d.ts.map +0 -1
  359. package/dist/types/src/functions/research/research.d.ts.map +0 -1
  360. package/dist/types/src/functions/research/research.test.d.ts.map +0 -1
  361. package/dist/types/src/functions/research/types.d.ts +0 -6
  362. package/dist/types/src/functions/research/types.d.ts.map +0 -1
  363. package/dist/types/src/functions/tasks/index.d.ts +0 -15
  364. package/dist/types/src/functions/tasks/index.d.ts.map +0 -1
  365. package/dist/types/src/functions/tasks/read.d.ts +0 -7
  366. package/dist/types/src/functions/tasks/read.d.ts.map +0 -1
  367. package/dist/types/src/functions/tasks/task-list.d.ts.map +0 -1
  368. package/dist/types/src/functions/tasks/task-list.test.d.ts.map +0 -1
  369. package/dist/types/src/functions/tasks/update.d.ts +0 -9
  370. package/dist/types/src/functions/tasks/update.d.ts.map +0 -1
  371. package/dist/types/src/plugins.d.ts +0 -19
  372. package/dist/types/src/plugins.d.ts.map +0 -1
  373. package/dist/types/src/testing/data/exa-search-1748337321991.d.ts.map +0 -1
  374. package/dist/types/src/testing/data/exa-search-1748337331526.d.ts.map +0 -1
  375. package/dist/types/src/testing/data/exa-search-1748337344119.d.ts.map +0 -1
  376. package/dist/types/src/testing/data/index.d.ts.map +0 -1
  377. package/dist/types/src/toolkits/AssistantToolkit.d.ts +0 -17
  378. package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +0 -1
  379. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts +0 -2
  380. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts.map +0 -1
  381. package/dist/types/src/toolkits/SystemToolkit.d.ts +0 -67
  382. package/dist/types/src/toolkits/SystemToolkit.d.ts.map +0 -1
  383. package/src/blueprints/discord/discord-blueprint.ts +0 -34
  384. package/src/blueprints/linear/linear-blueprint.ts +0 -35
  385. package/src/blueprints/websearch/websearch-blueprint.ts +0 -20
  386. package/src/experimental/feed.test.ts +0 -111
  387. package/src/functions/discord/index.ts +0 -9
  388. package/src/functions/document/index.ts +0 -12
  389. package/src/functions/document/read.ts +0 -29
  390. package/src/functions/linear/index.ts +0 -9
  391. package/src/functions/linear/linear.test.ts +0 -83
  392. package/src/functions/research/index.ts +0 -14
  393. package/src/functions/research/research-graph.ts +0 -49
  394. package/src/functions/research/research.conversations.json +0 -1
  395. package/src/functions/tasks/index.ts +0 -11
  396. package/src/toolkits/AssistantToolkit.conversations.json +0 -1
  397. package/src/toolkits/AssistantToolkit.test.ts +0 -88
  398. package/src/toolkits/AssistantToolkit.ts +0 -47
  399. package/src/toolkits/SystemToolkit.ts +0 -231
  400. /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.d.ts +0 -0
  401. /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.d.ts +0 -0
  402. /package/dist/types/src/{functions/github → blueprints/github/functions}/fetch-prs.d.ts +0 -0
  403. /package/dist/types/src/{functions/linear → blueprints/linear/functions}/linear.test.d.ts +0 -0
  404. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.d.ts +0 -0
  405. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.d.ts +0 -0
  406. /package/dist/types/src/{functions/research → blueprints/research/functions}/research.test.d.ts +0 -0
  407. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337321991.d.ts +0 -0
  408. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337331526.d.ts +0 -0
  409. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337344119.d.ts +0 -0
  410. /package/dist/types/src/{testing → functions/exa}/data/index.d.ts +0 -0
  411. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.ts +0 -0
  412. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.ts +0 -0
  413. /package/src/blueprints/research/{research-blueprint.test.ts → blueprint.test.ts} +0 -0
  414. /package/src/blueprints/websearch/{websearch-toolkit.ts → toolkit.ts} +0 -0
  415. /package/src/{testing → functions/exa}/data/exa-search-1748337321991.ts +0 -0
  416. /package/src/{testing → functions/exa}/data/exa-search-1748337331526.ts +0 -0
  417. /package/src/{testing → functions/exa}/data/exa-search-1748337344119.ts +0 -0
  418. /package/src/{testing → functions/exa}/data/index.ts +0 -0
@@ -4,52 +4,34 @@
4
4
 
5
5
  import { describe, expect, it } from '@effect/vitest';
6
6
  import * as Effect from 'effect/Effect';
7
- import * as Layer from 'effect/Layer';
8
7
 
9
- import { AiService, MemoizedAiService } from '@dxos/ai';
10
- import { TestAiService } from '@dxos/ai/testing';
11
- import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
8
+ import { MemoizedAiService } from '@dxos/ai/testing';
9
+ import { AssistantTestLayer } from '@dxos/assistant/testing';
12
10
  import { Blueprint } from '@dxos/blueprints';
13
11
  import { Obj } from '@dxos/echo';
14
- import { TestHelpers } from '@dxos/effect';
15
- import { CredentialsService, DatabaseService, FunctionInvocationService, TracingService } from '@dxos/functions';
16
- import { FunctionInvocationServiceLayerTest, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
12
+ import { Database } from '@dxos/echo';
13
+ import { TestHelpers } from '@dxos/effect/testing';
14
+ import { FunctionInvocationService } from '@dxos/functions';
17
15
  import { ObjectId } from '@dxos/keys';
18
16
  import { Message, Organization, Person } from '@dxos/types';
19
17
 
20
- import { testToolkit } from '../../blueprints/testing';
21
- import { ResearchGraph } from '../research';
18
+ import { ResearchGraph } from '../../blueprints';
22
19
 
23
20
  import { default as entityExtraction } from './entity-extraction';
24
21
 
25
22
  ObjectId.dangerouslyDisableRandomness();
26
23
 
27
- const TestLayer = Layer.mergeAll(
28
- AiService.model('@anthropic/claude-opus-4-0'),
29
- makeToolResolverFromFunctions([], testToolkit),
30
- makeToolExecutionServiceFromFunctions(testToolkit, testToolkit.toLayer({}) as any),
31
- ).pipe(
32
- Layer.provideMerge(FunctionInvocationServiceLayerTest({ functions: [entityExtraction] })),
33
- Layer.provideMerge(
34
- Layer.mergeAll(
35
- TestAiService(),
36
- TestDatabaseLayer({
37
- spaceKey: 'fixed',
38
- indexing: { vector: true },
39
- types: [Blueprint.Blueprint, Message.Message, Person.Person, Organization.Organization, ResearchGraph],
40
- }),
41
- CredentialsService.configuredLayer([]),
42
- TracingService.layerNoop,
43
- ),
44
- ),
45
- );
24
+ const TestLayer = AssistantTestLayer({
25
+ functions: [entityExtraction],
26
+ types: [Blueprint.Blueprint, Message.Message, Person.Person, Organization.Organization, ResearchGraph.ResearchGraph],
27
+ });
46
28
 
47
29
  describe('Entity extraction', () => {
48
30
  it.effect(
49
- 'call a function to generate a research report',
31
+ 'calls a function to generate a research report',
50
32
  Effect.fnUntraced(
51
33
  function* (_) {
52
- const email = yield* DatabaseService.add(
34
+ const email = yield* Database.add(
53
35
  Obj.make(Message.Message, {
54
36
  [Obj.Meta]: {
55
37
  tags: ['important'],
@@ -75,7 +57,7 @@ describe('Entity extraction', () => {
75
57
  ],
76
58
  }),
77
59
  );
78
- yield* DatabaseService.flush({ indexes: true });
60
+ yield* Database.flush({ indexes: true });
79
61
  const result = yield* FunctionInvocationService.invokeFunction(entityExtraction, {
80
62
  source: email,
81
63
  });
@@ -2,38 +2,42 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import * as Toolkit from '@effect/ai/Toolkit';
6
5
  import * as Effect from 'effect/Effect';
7
6
  import * as Layer from 'effect/Layer';
8
7
  import * as Predicate from 'effect/Predicate';
9
8
  import * as Schema from 'effect/Schema';
10
9
 
11
10
  import { AiService } from '@dxos/ai';
12
- import { AiSession, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
13
- import { Filter, Obj, Ref } from '@dxos/echo';
14
- import { DatabaseService, defineFunction } from '@dxos/functions';
11
+ import { GenericToolkit } from '@dxos/ai';
12
+ import { AiSession, ToolExecutionServices } from '@dxos/assistant';
13
+ import { Database, Filter, Obj, Ref } from '@dxos/echo';
14
+ import { defineFunction } from '@dxos/functions';
15
15
  import { FunctionInvocationServiceLayerTest } from '@dxos/functions-runtime/testing';
16
16
  import { type DXN } from '@dxos/keys';
17
17
  import { log } from '@dxos/log';
18
18
  import { type Actor, LegacyOrganization, Message, Organization, Person } from '@dxos/types';
19
19
  import { trim } from '@dxos/util';
20
20
 
21
+ import { ResearchGraph } from '../../blueprints';
21
22
  import { makeGraphWriterHandler, makeGraphWriterToolkit } from '../../crud';
22
- import { contextQueueLayerFromResearchGraph } from '../research';
23
23
 
24
24
  export default defineFunction({
25
- key: 'dxos.org/functions/entity-extraction',
25
+ key: 'org.dxos.functions.entity-extraction',
26
26
  name: 'Entity Extraction',
27
27
  description: 'Extracts entities from emails and transcripts.',
28
28
  inputSchema: Schema.Struct({
29
- source: Message.Message.annotations({ description: 'Email or transcript to extract entities from.' }),
29
+ source: Message.Message.annotations({
30
+ description: 'Email or transcript to extract entities from.',
31
+ }),
30
32
 
31
33
  // TODO(dmaretskyi): Consider making this an array of blueprints instead.
32
- instructions: Schema.optional(Schema.String).annotations({ description: 'Instructions extraction process.' }),
34
+ instructions: Schema.optional(Schema.String).annotations({
35
+ description: 'Instructions extraction process.',
36
+ }),
33
37
  }),
34
38
  outputSchema: Schema.Struct({
35
39
  entities: Schema.optional(
36
- Schema.Array(Obj.Any).annotations({
40
+ Schema.Array(Obj.Unknown).annotations({
37
41
  description: 'Extracted entities.',
38
42
  }),
39
43
  ),
@@ -46,12 +50,14 @@ export default defineFunction({
46
50
 
47
51
  if (contact && !contact.organization) {
48
52
  const created: DXN[] = [];
49
- const GraphWriterToolkit = makeGraphWriterToolkit({ schema: [LegacyOrganization] }).pipe();
53
+ const GraphWriterToolkit = makeGraphWriterToolkit({
54
+ schema: [LegacyOrganization],
55
+ }).pipe();
50
56
  const GraphWriterHandler = makeGraphWriterHandler(GraphWriterToolkit, {
51
57
  onAppend: (dxns) => created.push(...dxns),
52
58
  });
53
59
  const toolkit = yield* GraphWriterToolkit.pipe(
54
- Effect.provide(GraphWriterHandler.pipe(Layer.provide(contextQueueLayerFromResearchGraph))),
60
+ Effect.provide(GraphWriterHandler.pipe(Layer.provide(ResearchGraph.contextQueueLayer))),
55
61
  );
56
62
 
57
63
  yield* new AiSession().run({
@@ -67,10 +73,15 @@ export default defineFunction({
67
73
  if (created.length > 1) {
68
74
  throw new Error('Multiple organizations created');
69
75
  } else if (created.length === 1) {
70
- organization = yield* DatabaseService.resolve(created[0], Organization.Organization);
71
- Obj.getMeta(organization).tags ??= [];
72
- Obj.getMeta(organization).tags!.push(...(tags ?? []));
73
- contact.organization = Ref.make(organization);
76
+ organization = yield* Database.resolve(created[0], Organization.Organization);
77
+ Obj.change(organization, (org) => {
78
+ const meta = Obj.getMeta(org);
79
+ meta.tags ??= [];
80
+ meta.tags.push(...(tags ?? []));
81
+ });
82
+ Obj.change(contact, (c) => {
83
+ c.organization = Ref.make(organization!);
84
+ });
74
85
  }
75
86
  }
76
87
 
@@ -81,19 +92,18 @@ export default defineFunction({
81
92
  Effect.provide(
82
93
  Layer.mergeAll(
83
94
  AiService.model('@anthropic/claude-sonnet-4-0'), // TODO(dmaretskyi): Extract.
84
- makeToolResolverFromFunctions([], Toolkit.make()),
85
- makeToolExecutionServiceFromFunctions(Toolkit.make() as any, Layer.empty as any),
95
+ ToolExecutionServices,
86
96
  ).pipe(
87
97
  Layer.provide(
88
98
  // TODO(dmaretskyi): This should be provided by environment.
89
- Layer.mergeAll(FunctionInvocationServiceLayerTest()),
99
+ Layer.mergeAll(GenericToolkit.providerEmpty, FunctionInvocationServiceLayerTest()),
90
100
  ),
91
101
  ),
92
102
  ),
93
103
  ),
94
104
  });
95
105
 
96
- const extractContact = Effect.fn('extractContact')(function* (actor: Actor.Actor, tags?: string[]) {
106
+ const extractContact = Effect.fn('extractContact')(function* (actor: Actor.Actor, tags?: readonly string[]) {
97
107
  const name = actor.name;
98
108
  const email = actor.email;
99
109
  if (!email) {
@@ -101,12 +111,12 @@ const extractContact = Effect.fn('extractContact')(function* (actor: Actor.Actor
101
111
  return undefined;
102
112
  }
103
113
 
104
- const { objects: existingContacts } = yield* DatabaseService.runQuery(Filter.type(Person.Person));
114
+ const existingContacts = yield* Database.runQuery(Filter.type(Person.Person));
105
115
 
106
116
  // Check for existing contact
107
117
  // TODO(dmaretskyi): Query filter DSL - https://linear.app/dxos/issue/DX-541/filtercontains-should-work-with-partial-objects
108
118
  const existingContact = existingContacts.find((contact) =>
109
- contact.emails?.some((contactEmail: any) => contactEmail.value === email),
119
+ contact.emails?.some((contactEmail) => contactEmail.value === email),
110
120
  );
111
121
 
112
122
  if (existingContact) {
@@ -115,13 +125,15 @@ const extractContact = Effect.fn('extractContact')(function* (actor: Actor.Actor
115
125
  }
116
126
 
117
127
  const newContact = Obj.make(Person.Person, {
118
- [Obj.Meta]: { tags },
128
+ ...(tags ? { [Obj.Meta]: { tags: [...tags] } } : {}),
119
129
  emails: [{ value: email }],
120
130
  });
121
- yield* DatabaseService.add(newContact);
131
+ yield* Database.add(newContact);
122
132
 
123
133
  if (name) {
124
- newContact.fullName = name;
134
+ Obj.change(newContact, (c) => {
135
+ c.fullName = name;
136
+ });
125
137
  }
126
138
 
127
139
  const emailDomain = email.split('@')[1]?.toLowerCase();
@@ -132,7 +144,7 @@ const extractContact = Effect.fn('extractContact')(function* (actor: Actor.Actor
132
144
 
133
145
  log.info('extracted email domain', { emailDomain });
134
146
 
135
- const { objects: existingOrganisations } = yield* DatabaseService.runQuery(Filter.type(Organization.Organization));
147
+ const existingOrganisations = yield* Database.runQuery(Filter.type(Organization.Organization));
136
148
  const matchingOrg = existingOrganisations.find((org) => {
137
149
  if (org.website) {
138
150
  try {
@@ -148,7 +160,10 @@ const extractContact = Effect.fn('extractContact')(function* (actor: Actor.Actor
148
160
  emailDomain.endsWith(`.${websiteDomain}`)
149
161
  );
150
162
  } catch (e) {
151
- log.warn('Error parsing website URL', { website: org.website, error: e });
163
+ log.warn('Error parsing website URL', {
164
+ website: org.website,
165
+ error: e,
166
+ });
152
167
  return false;
153
168
  }
154
169
  }
@@ -157,7 +172,9 @@ const extractContact = Effect.fn('extractContact')(function* (actor: Actor.Actor
157
172
 
158
173
  if (matchingOrg) {
159
174
  log.info('found matching organization', { organization: matchingOrg });
160
- newContact.organization = Ref.make(matchingOrg);
175
+ Obj.change(newContact, (c) => {
176
+ c.organization = Ref.make(matchingOrg);
177
+ });
161
178
  }
162
179
 
163
180
  return newContact;
@@ -2,8 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { default as extract$ } from './entity-extraction';
5
+ import Extract from './entity-extraction';
6
6
 
7
- export namespace EntityExtraction {
8
- export const extract = extract$;
9
- }
7
+ export const EntityExtractionFunctions = {
8
+ Extract,
9
+ };
@@ -9,8 +9,8 @@ import Exa from 'exa-js';
9
9
  import { CredentialsService, defineFunction } from '@dxos/functions';
10
10
 
11
11
  export default defineFunction({
12
- key: 'dxos.org/function/exa',
13
- name: 'Exa',
12
+ key: 'org.dxos.function.exa-search',
13
+ name: 'Exa Search',
14
14
  description: 'Search the web for information',
15
15
  inputSchema: Schema.Struct({
16
16
  query: Schema.String.annotations({
@@ -2,5 +2,10 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export { default as exaFunction } from './exa';
6
- export { default as exaMockFunction } from './mock';
5
+ import Search from './exa';
6
+ import Mock from './mock';
7
+
8
+ export const ExaFunctions = {
9
+ Search,
10
+ Mock,
11
+ };
@@ -7,10 +7,10 @@ import * as Schema from 'effect/Schema';
7
7
 
8
8
  import { defineFunction } from '@dxos/functions';
9
9
 
10
- import { SEARCH_RESULTS } from '../../testing';
10
+ import { SEARCH_RESULTS } from './data';
11
11
 
12
12
  export default defineFunction({
13
- key: 'dxos.org/function/exa-mock',
13
+ key: 'org.dxos.function.exa-mock',
14
14
  name: 'Exa mock',
15
15
  description: 'Search the web for information',
16
16
  inputSchema: Schema.Struct({
@@ -3,9 +3,5 @@
3
3
  //
4
4
 
5
5
  export * from './agent';
6
- export * from './discord';
7
- export * from './document';
8
6
  export * from './entity-extraction';
9
- export * from './linear';
10
- export * from './research';
11
- export * from './tasks';
7
+ export * from './exa';
package/src/index.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  //
4
4
 
5
5
  export * from './blueprints';
6
+ export * from './crud';
6
7
  export * from './functions';
7
- export * from './plugins';
8
8
  export * from './sync';
9
- export * from './crud';
10
9
  export * from './toolkits';
10
+ export * from './types';
package/src/sync/sync.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  import * as Effect from 'effect/Effect';
6
6
 
7
7
  import { Filter, Obj, Query, Ref } from '@dxos/echo';
8
- import { DatabaseService } from '@dxos/functions';
8
+ import { Database } from '@dxos/echo';
9
9
  import { failedInvariant } from '@dxos/invariant';
10
10
  import { log } from '@dxos/log';
11
11
 
@@ -18,9 +18,12 @@ import { log } from '@dxos/log';
18
18
  * @param opts.foreignKeyId - The key to use for matching objects.
19
19
  */
20
20
  export const syncObjects: (
21
- objs: Obj.Any[],
21
+ objs: Obj.Unknown[],
22
22
  opts: { foreignKeyId: string },
23
- ) => Effect.Effect<Obj.Any[], never, DatabaseService> = Effect.fn('syncObjects')(function* (objs, { foreignKeyId }) {
23
+ ) => Effect.Effect<Obj.Unknown[], never, Database.Service> = Effect.fn('syncObjects')(function* (
24
+ objs,
25
+ { foreignKeyId },
26
+ ) {
24
27
  return yield* Effect.forEach(
25
28
  objs,
26
29
  Effect.fnUntraced(function* (obj) {
@@ -28,7 +31,7 @@ export const syncObjects: (
28
31
  for (const key of Object.keys(obj)) {
29
32
  if (typeof key !== 'string' || key === 'id') continue;
30
33
  if (!Ref.isRef((obj as any)[key])) continue;
31
- const ref: Ref.Any = (obj as any)[key];
34
+ const ref: Ref.Unknown = (obj as any)[key];
32
35
  if (!ref.target) continue;
33
36
  if (Obj.getDXN(ref.target).isLocalObjectId()) {
34
37
  // obj not persisted to db.
@@ -39,9 +42,7 @@ export const syncObjects: (
39
42
 
40
43
  const schema = Obj.getSchema(obj) ?? failedInvariant('No schema.');
41
44
  const foreignId = Obj.getKeys(obj, foreignKeyId)[0]?.id ?? failedInvariant('No foreign key.');
42
- const {
43
- objects: [existing],
44
- } = yield* DatabaseService.runQuery(
45
+ const [existing] = yield* Database.runQuery(
45
46
  Query.select(Filter.foreignKeys(schema, [{ source: foreignKeyId, id: foreignId }])),
46
47
  );
47
48
  log('sync object', {
@@ -50,7 +51,7 @@ export const syncObjects: (
50
51
  existing: existing ? Obj.getDXN(existing) : undefined,
51
52
  });
52
53
  if (!existing) {
53
- yield* DatabaseService.add(obj);
54
+ yield* Database.add(obj);
54
55
  return obj;
55
56
  } else {
56
57
  copyObjectData(existing, obj);
@@ -61,27 +62,34 @@ export const syncObjects: (
61
62
  );
62
63
  });
63
64
 
64
- const copyObjectData = (existing: Obj.Any, newObj: Obj.Any) => {
65
- for (const key of Object.keys(newObj)) {
66
- if (typeof key !== 'string' || key === 'id') continue;
67
- if (
68
- typeof (newObj as any)[key] !== 'string' &&
69
- typeof (newObj as any)[key] !== 'number' &&
70
- typeof (newObj as any)[key] !== 'boolean' &&
71
- !Ref.isRef((newObj as any)[key])
72
- )
73
- continue;
74
- (existing as any)[key] = (newObj as any)[key];
75
- }
76
- for (const key of Object.keys(existing)) {
77
- if (typeof key !== 'string' || key === 'id') continue;
78
- if (!(key in newObj)) {
79
- delete (existing as any)[key];
65
+ const copyObjectData = (existing: Obj.Unknown, newObj: Obj.Unknown) => {
66
+ Obj.change(existing, (obj) => {
67
+ // Copy properties from newObj to existing.
68
+ for (const key of Object.keys(newObj)) {
69
+ if (typeof key !== 'string' || key === 'id') continue;
70
+ if (
71
+ typeof (newObj as any)[key] !== 'string' &&
72
+ typeof (newObj as any)[key] !== 'number' &&
73
+ typeof (newObj as any)[key] !== 'boolean' &&
74
+ !Ref.isRef((newObj as any)[key])
75
+ )
76
+ continue;
77
+ (obj as any)[key] = (newObj as any)[key];
80
78
  }
81
- }
82
- for (const foreignKey of Obj.getMeta(newObj).keys) {
83
- Obj.deleteKeys(existing, foreignKey.source);
84
- // TODO(dmaretskyi): Doesn't work: `Obj.getMeta(existing).keys.push(foreignKey);`
85
- Obj.getMeta(existing).keys.push({ ...foreignKey });
86
- }
79
+
80
+ // Delete properties that don't exist in newObj.
81
+ for (const key of Object.keys(obj)) {
82
+ if (typeof key !== 'string' || key === 'id') continue;
83
+ if (!(key in newObj)) {
84
+ delete (obj as any)[key];
85
+ }
86
+ }
87
+
88
+ // Update foreign keys.
89
+ for (const foreignKey of Obj.getMeta(newObj).keys) {
90
+ Obj.deleteKeys(obj, foreignKey.source);
91
+ // TODO(dmaretskyi): Doesn't work: `Obj.getMeta(existing).keys.push(foreignKey);`
92
+ Obj.getMeta(obj).keys.push({ ...foreignKey });
93
+ }
94
+ });
87
95
  };
@@ -2,4 +2,5 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './data';
5
+ export * from '../blueprints/testing';
6
+ export * from './plugins';
@@ -5,15 +5,17 @@
5
5
  import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
- import { type AnyCapability, Capabilities, contributes, createSurface } from '@dxos/app-framework';
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface } from '@dxos/app-framework/ui';
9
10
  import { Format, type Obj, Type } from '@dxos/echo';
11
+ import { Card } from '@dxos/react-ui';
10
12
  import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
11
13
 
12
14
  export const MapSchema = Schema.Struct({
13
15
  coordinates: Format.GeoPoint,
14
16
  }).pipe(
15
- Type.Obj({
16
- typename: 'example.com/type/Map',
17
+ Type.object({
18
+ typename: 'com.example.type.map',
17
19
  version: '0.1.0',
18
20
  }),
19
21
  );
@@ -22,9 +24,9 @@ export type MapSchema = Schema.Schema.Type<typeof MapSchema>;
22
24
 
23
25
  // TODO(burdon): Move to ECHO def.
24
26
  export type ArtifactsContext = {
25
- items: Obj.Any[];
26
- getArtifacts: () => Obj.Any[];
27
- addArtifact: (artifact: Obj.Any) => void;
27
+ items: Obj.Unknown[];
28
+ getArtifacts: () => Obj.Unknown[];
29
+ addArtifact: (artifact: Obj.Unknown) => void;
28
30
  };
29
31
 
30
32
  declare global {
@@ -36,33 +38,35 @@ declare global {
36
38
  // TODO(dmaretskyi): Removed images from conductor GPT implementation.
37
39
  const isImage = (data: any): data is any => false;
38
40
 
39
- export const capabilities: AnyCapability[] = [
40
- contributes(
41
+ export const capabilities: Capability.Any[] = [
42
+ Capability.contributes(
41
43
  Capabilities.ReactSurface,
42
- createSurface({
44
+ Surface.create({
43
45
  id: 'plugin-image',
44
- role: 'card--extrinsic',
46
+ role: 'card--content',
45
47
  filter: (data: any): data is any => isImage(data.value),
46
48
  component: ({ data }) => (
47
- <img
48
- className='grow object-cover'
49
- src={`data:image/jpeg;base64,${data.value.source.data}`}
50
- alt={data.value.prompt ?? `Generated image [id=${data.value.id}]`}
51
- />
49
+ <Card.Content>
50
+ <img
51
+ className='grow object-cover'
52
+ src={`data:image/jpeg;base64,${data.value.source.data}`}
53
+ alt={data.value.prompt ?? `Generated image [id=${data.value.id}]`}
54
+ />
55
+ </Card.Content>
52
56
  ),
53
57
  }),
54
58
  ),
55
-
56
- //
57
- // Default
58
- //
59
- contributes(
59
+ Capability.contributes(
60
60
  Capabilities.ReactSurface,
61
- createSurface({
61
+ Surface.create({
62
62
  id: 'plugin-default',
63
- role: 'card--extrinsic',
63
+ role: 'card--content',
64
64
  position: 'fallback',
65
- component: ({ role, data }) => <JsonFilter data={data} />,
65
+ component: ({ data }) => (
66
+ <Card.Content>
67
+ <JsonFilter data={data} />
68
+ </Card.Content>
69
+ ),
66
70
  }),
67
71
  ),
68
72
  ];
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Tool from '@effect/ai/Tool';
6
+ import * as Toolkit from '@effect/ai/Toolkit';
7
+ import * as AnthropicTool from '@effect/ai-anthropic/AnthropicTool';
8
+ import * as Effect from 'effect/Effect';
9
+ import * as Schema from 'effect/Schema';
10
+
11
+ // TODO(dmaretskyi): Testing only.
12
+ export const WebToolkit = Toolkit.make(
13
+ AnthropicTool.WebSearch_20250305({}).pipe(
14
+ // TODO(dmaretskyi): Effect bug -- provider-defined tools don't support annotations.
15
+ // ToolFormatter.assign({
16
+ // debugFormatResult: (result) =>
17
+ // Array.isArray(result) ? result.map(Struct.pick('title', 'type', 'url', 'page_age')) : result,
18
+ // }),
19
+ ),
20
+ Tool.make('WebFetch', {
21
+ parameters: {
22
+ url: Schema.String,
23
+ },
24
+ success: Schema.String,
25
+ }),
26
+ );
27
+
28
+ export const layer = WebToolkit.toLayer({
29
+ WebFetch: Effect.fnUntraced(function* ({ url }) {
30
+ const response = yield* Effect.promise(() => fetch(url).then((response) => response.text()));
31
+ return response;
32
+ }),
33
+ });
@@ -2,5 +2,4 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * as AssistantToolkit from './AssistantToolkit';
6
- export * as SystemToolkit from './SystemToolkit';
5
+ export * as WebToolkit from './WebToolkit';
@@ -0,0 +1,51 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ // @import-as-namespace
6
+
7
+ import * as Schema from 'effect/Schema';
8
+
9
+ import { Annotation, Obj, Ref, Type } from '@dxos/echo';
10
+ import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
11
+ import { Queue } from '@dxos/echo-db';
12
+
13
+ /**
14
+ * AI chat.
15
+ */
16
+ export const Chat = Schema.Struct({
17
+ name: Schema.String.pipe(Schema.optional),
18
+ queue: Ref.Ref(Queue).pipe(FormInputAnnotation.set(false)),
19
+ // TODO(dmaretskyi): Eventually this and the message queue will be the same.
20
+ traceQueue: Ref.Ref(Queue).pipe(FormInputAnnotation.set(false), Schema.optional),
21
+ }).pipe(
22
+ Type.object({
23
+ typename: 'org.dxos.type.assistant.chat',
24
+ version: '0.1.0',
25
+ }),
26
+ LabelAnnotation.set(['name']),
27
+ Annotation.IconAnnotation.set({
28
+ icon: 'ph--atom--regular',
29
+ hue: 'blue',
30
+ }),
31
+ );
32
+
33
+ export interface Chat extends Schema.Schema.Type<typeof Chat> {}
34
+
35
+ export const make = (props: Obj.MakeProps<typeof Chat>) => Obj.make(Chat, props);
36
+
37
+ /**
38
+ * Relation between a Chat and companion objects (e.g., artifacts).
39
+ */
40
+ export const CompanionTo = Schema.Struct({
41
+ id: Obj.ID,
42
+ }).pipe(
43
+ Type.relation({
44
+ typename: 'org.dxos.relation.assistant.companion-to',
45
+ version: '0.1.0',
46
+ source: Chat,
47
+ target: Obj.Unknown,
48
+ }),
49
+ );
50
+
51
+ export interface CompanionTo extends Schema.Schema.Type<typeof CompanionTo> {}
@@ -0,0 +1,23 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+
7
+ import { Annotation, Type } from '@dxos/echo';
8
+
9
+ /**
10
+ * Unit of knowledge generated by an agent.
11
+ */
12
+ export const Memory = Schema.Struct({
13
+ title: Schema.String,
14
+ content: Schema.String,
15
+ }).pipe(
16
+ Type.object({ typename: 'dxos.org/type/Memory', version: '0.1.0' }),
17
+ Annotation.LabelAnnotation.set(['title']),
18
+ Annotation.IconAnnotation.set({
19
+ icon: 'ph--brain--regular',
20
+ hue: 'pink',
21
+ }),
22
+ );
23
+ export interface Memory extends Schema.Schema.Type<typeof Memory> {}