@dxos/assistant-toolkit 0.8.4-main.ae835ea → 0.8.4-main.c85a9c8dae

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 (403) 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 +2989 -1842
  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/{functions/discord → blueprints/discord/functions}/fetch-messages.d.ts +1 -1
  57. package/dist/types/src/blueprints/discord/functions/fetch-messages.d.ts.map +1 -0
  58. package/dist/types/src/blueprints/discord/functions/fetch-messages.test.d.ts.map +1 -0
  59. package/dist/types/src/{functions/discord → blueprints/discord/functions}/index.d.ts +4 -4
  60. package/dist/types/src/blueprints/discord/functions/index.d.ts.map +1 -0
  61. package/dist/types/src/blueprints/discord/index.d.ts +1 -2
  62. package/dist/types/src/blueprints/discord/index.d.ts.map +1 -1
  63. package/dist/types/src/{functions/github → blueprints/github/functions}/fetch-prs.d.ts +1 -1
  64. package/dist/types/src/blueprints/github/functions/fetch-prs.d.ts.map +1 -0
  65. package/dist/types/src/blueprints/github/functions/index.d.ts +7 -0
  66. package/dist/types/src/blueprints/github/functions/index.d.ts.map +1 -0
  67. package/dist/types/src/blueprints/github/index.d.ts +1 -0
  68. package/dist/types/src/blueprints/github/index.d.ts.map +1 -0
  69. package/dist/types/src/blueprints/index.d.ts +10 -6
  70. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  71. package/dist/types/src/blueprints/linear/blueprint.d.ts +4 -0
  72. package/dist/types/src/blueprints/linear/blueprint.d.ts.map +1 -0
  73. package/dist/types/src/blueprints/linear/functions/index.d.ts +9 -0
  74. package/dist/types/src/blueprints/linear/functions/index.d.ts.map +1 -0
  75. package/dist/types/src/blueprints/linear/functions/linear.test.d.ts.map +1 -0
  76. package/dist/types/src/{functions/linear → blueprints/linear/functions}/sync-issues.d.ts +2 -2
  77. package/dist/types/src/blueprints/linear/functions/sync-issues.d.ts.map +1 -0
  78. package/dist/types/src/blueprints/linear/index.d.ts +1 -2
  79. package/dist/types/src/blueprints/linear/index.d.ts.map +1 -1
  80. package/dist/types/src/blueprints/markdown/blueprint.d.ts +4 -0
  81. package/dist/types/src/blueprints/markdown/blueprint.d.ts.map +1 -0
  82. package/dist/types/src/{functions/research/create-document.d.ts → blueprints/markdown/functions/create.d.ts} +2 -3
  83. package/dist/types/src/blueprints/markdown/functions/create.d.ts.map +1 -0
  84. package/dist/types/src/blueprints/markdown/functions/index.d.ts +30 -0
  85. package/dist/types/src/blueprints/markdown/functions/index.d.ts.map +1 -0
  86. package/dist/types/src/blueprints/markdown/functions/read.d.ts +14 -0
  87. package/dist/types/src/blueprints/markdown/functions/read.d.ts.map +1 -0
  88. package/dist/types/src/blueprints/markdown/functions/update.d.ts +13 -0
  89. package/dist/types/src/blueprints/markdown/functions/update.d.ts.map +1 -0
  90. package/dist/types/src/blueprints/markdown/index.d.ts +3 -0
  91. package/dist/types/src/blueprints/markdown/index.d.ts.map +1 -0
  92. package/dist/types/src/blueprints/planning/blueprint.d.ts +4 -0
  93. package/dist/types/src/blueprints/planning/blueprint.d.ts.map +1 -0
  94. package/dist/types/src/blueprints/planning/functions/index.d.ts +10 -0
  95. package/dist/types/src/blueprints/planning/functions/index.d.ts.map +1 -0
  96. package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts +9 -0
  97. package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts.map +1 -0
  98. package/dist/types/src/blueprints/planning/index.d.ts +1 -2
  99. package/dist/types/src/blueprints/planning/index.d.ts.map +1 -1
  100. package/dist/types/src/blueprints/planning-old/blueprint.d.ts +4 -0
  101. package/dist/types/src/blueprints/planning-old/blueprint.d.ts.map +1 -0
  102. package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts +2 -0
  103. package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts.map +1 -0
  104. package/dist/types/src/blueprints/planning-old/functions/index.d.ts +29 -0
  105. package/dist/types/src/blueprints/planning-old/functions/index.d.ts.map +1 -0
  106. package/dist/types/src/blueprints/planning-old/functions/read.d.ts +14 -0
  107. package/dist/types/src/blueprints/planning-old/functions/read.d.ts.map +1 -0
  108. package/dist/types/src/blueprints/planning-old/functions/task-list.d.ts.map +1 -0
  109. package/dist/types/src/blueprints/planning-old/functions/task-list.test.d.ts.map +1 -0
  110. package/dist/types/src/blueprints/planning-old/functions/update.d.ts +16 -0
  111. package/dist/types/src/blueprints/planning-old/functions/update.d.ts.map +1 -0
  112. package/dist/types/src/blueprints/planning-old/index.d.ts +2 -0
  113. package/dist/types/src/blueprints/planning-old/index.d.ts.map +1 -0
  114. package/dist/types/src/blueprints/project/blueprint.d.ts +4 -0
  115. package/dist/types/src/blueprints/project/blueprint.d.ts.map +1 -0
  116. package/dist/types/src/blueprints/project/blueprint.test.d.ts +2 -0
  117. package/dist/types/src/blueprints/project/blueprint.test.d.ts.map +1 -0
  118. package/dist/types/src/blueprints/project/functions/add-artifact.d.ts +7 -0
  119. package/dist/types/src/blueprints/project/functions/add-artifact.d.ts.map +1 -0
  120. package/dist/types/src/blueprints/project/functions/agent.d.ts +62 -0
  121. package/dist/types/src/blueprints/project/functions/agent.d.ts.map +1 -0
  122. package/dist/types/src/blueprints/project/functions/get-context.d.ts +13 -0
  123. package/dist/types/src/blueprints/project/functions/get-context.d.ts.map +1 -0
  124. package/dist/types/src/blueprints/project/functions/index.d.ts +133 -0
  125. package/dist/types/src/blueprints/project/functions/index.d.ts.map +1 -0
  126. package/dist/types/src/blueprints/project/functions/qualifier.d.ts +60 -0
  127. package/dist/types/src/blueprints/project/functions/qualifier.d.ts.map +1 -0
  128. package/dist/types/src/blueprints/project/index.d.ts +3 -0
  129. package/dist/types/src/blueprints/project/index.d.ts.map +1 -0
  130. package/dist/types/src/blueprints/research/blueprint.d.ts +4 -0
  131. package/dist/types/src/blueprints/research/blueprint.d.ts.map +1 -0
  132. package/dist/types/src/blueprints/research/blueprint.test.d.ts +2 -0
  133. package/dist/types/src/blueprints/research/blueprint.test.d.ts.map +1 -0
  134. package/dist/types/src/blueprints/research/functions/document-create.d.ts +10 -0
  135. package/dist/types/src/blueprints/research/functions/document-create.d.ts.map +1 -0
  136. package/dist/types/src/blueprints/research/functions/index.d.ts +19 -0
  137. package/dist/types/src/blueprints/research/functions/index.d.ts.map +1 -0
  138. package/dist/types/src/{functions/research → blueprints/research/functions}/research.d.ts +4 -3
  139. package/dist/types/src/blueprints/research/functions/research.d.ts.map +1 -0
  140. package/dist/types/src/blueprints/research/functions/research.test.d.ts.map +1 -0
  141. package/dist/types/src/blueprints/research/index.d.ts +2 -2
  142. package/dist/types/src/blueprints/research/index.d.ts.map +1 -1
  143. package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts +18 -0
  144. package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts.map +1 -0
  145. package/dist/types/src/blueprints/research/types/index.d.ts +7 -0
  146. package/dist/types/src/blueprints/research/types/index.d.ts.map +1 -0
  147. package/dist/types/src/blueprints/testing.d.ts +18 -4
  148. package/dist/types/src/blueprints/testing.d.ts.map +1 -1
  149. package/dist/types/src/blueprints/websearch/blueprint.d.ts +4 -0
  150. package/dist/types/src/blueprints/websearch/blueprint.d.ts.map +1 -0
  151. package/dist/types/src/blueprints/websearch/index.d.ts +2 -3
  152. package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -1
  153. package/dist/types/src/blueprints/websearch/{websearch-toolkit.d.ts → toolkit.d.ts} +2 -1
  154. package/dist/types/src/blueprints/websearch/toolkit.d.ts.map +1 -0
  155. package/dist/types/src/{functions/research → crud}/graph.d.ts +14 -11
  156. package/dist/types/src/crud/graph.d.ts.map +1 -0
  157. package/dist/types/src/crud/graph.test.d.ts.map +1 -0
  158. package/dist/types/src/crud/index.d.ts +2 -0
  159. package/dist/types/src/crud/index.d.ts.map +1 -0
  160. package/dist/types/src/functions/agent/index.d.ts +84 -4
  161. package/dist/types/src/functions/agent/index.d.ts.map +1 -1
  162. package/dist/types/src/functions/agent/prompt.d.ts +81 -8
  163. package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
  164. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +142 -136
  165. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
  166. package/dist/types/src/functions/entity-extraction/index.d.ts +144 -139
  167. package/dist/types/src/functions/entity-extraction/index.d.ts.map +1 -1
  168. package/dist/types/src/functions/exa/data/exa-search-1748337321991.d.ts.map +1 -0
  169. package/dist/types/src/functions/exa/data/exa-search-1748337331526.d.ts.map +1 -0
  170. package/dist/types/src/functions/exa/data/exa-search-1748337344119.d.ts.map +1 -0
  171. package/dist/types/src/functions/exa/data/index.d.ts.map +1 -0
  172. package/dist/types/src/functions/exa/exa.d.ts +1 -1
  173. package/dist/types/src/functions/exa/index.d.ts +8 -2
  174. package/dist/types/src/functions/exa/index.d.ts.map +1 -1
  175. package/dist/types/src/functions/exa/mock.d.ts +1 -1
  176. package/dist/types/src/functions/index.d.ts +1 -5
  177. package/dist/types/src/functions/index.d.ts.map +1 -1
  178. package/dist/types/src/index.d.ts +3 -1
  179. package/dist/types/src/index.d.ts.map +1 -1
  180. package/dist/types/src/sync/sync.d.ts +3 -3
  181. package/dist/types/src/sync/sync.d.ts.map +1 -1
  182. package/dist/types/src/testing/index.d.ts +2 -1
  183. package/dist/types/src/testing/index.d.ts.map +1 -1
  184. package/dist/types/src/testing/plugins.d.ts +19 -0
  185. package/dist/types/src/testing/plugins.d.ts.map +1 -0
  186. package/dist/types/src/toolkits/WebToolkit.d.ts +38 -0
  187. package/dist/types/src/toolkits/WebToolkit.d.ts.map +1 -0
  188. package/dist/types/src/toolkits/index.d.ts +2 -0
  189. package/dist/types/src/toolkits/index.d.ts.map +1 -0
  190. package/dist/types/src/types/Chat.d.ts +31 -0
  191. package/dist/types/src/types/Chat.d.ts.map +1 -0
  192. package/dist/types/src/types/Plan.d.ts +77 -0
  193. package/dist/types/src/types/Plan.d.ts.map +1 -0
  194. package/dist/types/src/types/Project.d.ts +67 -0
  195. package/dist/types/src/types/Project.d.ts.map +1 -0
  196. package/dist/types/src/types/index.d.ts +4 -0
  197. package/dist/types/src/types/index.d.ts.map +1 -0
  198. package/dist/types/tsconfig.tsbuildinfo +1 -1
  199. package/package.json +49 -38
  200. package/src/blueprints/browser/blueprint.conversations.json +1 -0
  201. package/src/blueprints/browser/blueprint.test.ts +70 -0
  202. package/src/blueprints/browser/blueprint.ts +41 -0
  203. package/src/blueprints/browser/index.ts +5 -0
  204. package/src/blueprints/database/blueprint.conversations.json +1 -0
  205. package/src/blueprints/database/blueprint.test.ts +321 -0
  206. package/src/blueprints/database/blueprint.ts +39 -0
  207. package/src/blueprints/database/functions/context-add.ts +35 -0
  208. package/src/blueprints/database/functions/context-remove.ts +35 -0
  209. package/src/blueprints/database/functions/index.ts +33 -0
  210. package/src/blueprints/database/functions/load.ts +31 -0
  211. package/src/blueprints/database/functions/object-create.ts +35 -0
  212. package/src/blueprints/database/functions/object-delete.ts +27 -0
  213. package/src/blueprints/database/functions/object-update.ts +32 -0
  214. package/src/blueprints/database/functions/query.ts +126 -0
  215. package/src/blueprints/database/functions/relation-create.ts +47 -0
  216. package/src/blueprints/database/functions/relation-delete.ts +28 -0
  217. package/src/blueprints/database/functions/schema-add.ts +40 -0
  218. package/src/blueprints/database/functions/schema-list.ts +34 -0
  219. package/src/blueprints/database/functions/tag-add.ts +31 -0
  220. package/src/blueprints/database/functions/tag-remove.ts +30 -0
  221. package/src/blueprints/database/index.ts +6 -0
  222. package/src/blueprints/design/{design-blueprint.test.ts → blueprint.test.ts} +25 -37
  223. package/src/blueprints/design/blueprint.ts +46 -0
  224. package/src/blueprints/design/index.ts +1 -3
  225. package/src/blueprints/discord/blueprint.ts +46 -0
  226. package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.ts +10 -14
  227. package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.ts +11 -10
  228. package/src/blueprints/discord/functions/index.ts +9 -0
  229. package/src/blueprints/discord/index.ts +1 -3
  230. package/src/{functions/github → blueprints/github/functions}/fetch-prs.ts +3 -2
  231. package/src/blueprints/github/functions/index.ts +9 -0
  232. package/src/blueprints/github/index.ts +3 -0
  233. package/src/blueprints/index.ts +10 -6
  234. package/src/blueprints/linear/blueprint.ts +47 -0
  235. package/src/blueprints/linear/functions/index.ts +9 -0
  236. package/src/blueprints/linear/functions/linear.test.ts +58 -0
  237. package/src/{functions/linear → blueprints/linear/functions}/sync-issues.ts +17 -15
  238. package/src/blueprints/linear/index.ts +1 -3
  239. package/src/blueprints/markdown/blueprint.ts +38 -0
  240. package/src/blueprints/markdown/functions/create.ts +29 -0
  241. package/src/blueprints/markdown/functions/index.ts +13 -0
  242. package/src/blueprints/markdown/functions/read.ts +32 -0
  243. package/src/{functions/document → blueprints/markdown/functions}/update.ts +9 -7
  244. package/src/blueprints/markdown/index.ts +6 -0
  245. package/src/blueprints/planning/blueprint.ts +28 -0
  246. package/src/blueprints/planning/functions/index.ts +9 -0
  247. package/src/blueprints/planning/functions/update-tasks.ts +168 -0
  248. package/src/blueprints/planning/index.ts +2 -4
  249. package/src/blueprints/{planning/planning-blueprint.test.ts → planning-old/blueprint.test.ts} +25 -32
  250. package/src/blueprints/{planning/planning-blueprint.ts → planning-old/blueprint.ts} +24 -12
  251. package/src/blueprints/planning-old/functions/index.ts +11 -0
  252. package/src/{functions/tasks → blueprints/planning-old/functions}/read.ts +6 -6
  253. package/src/{functions/tasks → blueprints/planning-old/functions}/update.ts +6 -6
  254. package/src/blueprints/planning-old/index.ts +5 -0
  255. package/src/blueprints/project/blueprint.test.ts +579 -0
  256. package/src/blueprints/project/blueprint.ts +68 -0
  257. package/src/blueprints/project/functions/add-artifact.ts +41 -0
  258. package/src/blueprints/project/functions/agent.ts +72 -0
  259. package/src/blueprints/project/functions/get-context.ts +63 -0
  260. package/src/blueprints/project/functions/index.ts +15 -0
  261. package/src/blueprints/project/functions/qualifier.ts +96 -0
  262. package/src/blueprints/project/index.ts +6 -0
  263. package/src/blueprints/research/blueprint.ts +65 -0
  264. package/src/blueprints/research/functions/document-create.ts +73 -0
  265. package/src/blueprints/research/functions/index.ts +11 -0
  266. package/src/{functions/research/instructions-research.tpl → blueprints/research/functions/research-instructions.tpl} +14 -6
  267. package/src/blueprints/research/functions/research.conversations.json +1 -0
  268. package/src/blueprints/research/functions/research.test.ts +149 -0
  269. package/src/blueprints/research/functions/research.ts +175 -0
  270. package/src/blueprints/research/index.ts +2 -3
  271. package/src/blueprints/research/types/ResearchGraph.ts +49 -0
  272. package/src/blueprints/research/types/index.ts +32 -0
  273. package/src/blueprints/testing.ts +36 -5
  274. package/src/blueprints/websearch/blueprint.ts +32 -0
  275. package/src/blueprints/websearch/index.ts +2 -4
  276. package/src/crud/graph.test.ts +46 -0
  277. package/src/{functions/research → crud}/graph.ts +32 -40
  278. package/src/crud/index.ts +5 -0
  279. package/src/functions/READ_THIS.md +5 -0
  280. package/src/functions/agent/index.ts +4 -6
  281. package/src/functions/agent/prompt.ts +32 -25
  282. package/src/functions/entity-extraction/entity-extraction.conversations.json +1 -1
  283. package/src/functions/entity-extraction/entity-extraction.test.ts +17 -43
  284. package/src/functions/entity-extraction/entity-extraction.ts +54 -36
  285. package/src/functions/entity-extraction/index.ts +4 -4
  286. package/src/functions/exa/exa.ts +2 -2
  287. package/src/functions/exa/index.ts +7 -2
  288. package/src/functions/exa/mock.ts +1 -1
  289. package/src/functions/index.ts +1 -5
  290. package/src/index.ts +3 -1
  291. package/src/sync/sync.ts +38 -30
  292. package/src/testing/index.ts +2 -1
  293. package/src/testing/plugins.tsx +72 -0
  294. package/src/toolkits/WebToolkit.ts +33 -0
  295. package/src/toolkits/index.ts +5 -0
  296. package/src/types/Chat.ts +49 -0
  297. package/src/types/Plan.ts +107 -0
  298. package/src/types/Project.ts +196 -0
  299. package/src/types/index.ts +7 -0
  300. package/dist/lib/browser/index.mjs.map +0 -7
  301. package/dist/lib/browser/meta.json +0 -1
  302. package/dist/lib/node-esm/index.mjs +0 -2483
  303. package/dist/lib/node-esm/index.mjs.map +0 -7
  304. package/dist/lib/node-esm/meta.json +0 -1
  305. package/dist/types/src/blueprints/design/design-blueprint.d.ts +0 -4
  306. package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +0 -1
  307. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts +0 -2
  308. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts.map +0 -1
  309. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +0 -18
  310. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +0 -1
  311. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +0 -18
  312. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +0 -1
  313. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +0 -4
  314. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +0 -1
  315. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts +0 -2
  316. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts.map +0 -1
  317. package/dist/types/src/blueprints/research/research-blueprint.d.ts +0 -4
  318. package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +0 -1
  319. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts +0 -2
  320. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts.map +0 -1
  321. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +0 -4
  322. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +0 -1
  323. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts.map +0 -1
  324. package/dist/types/src/experimental/feed.test.d.ts +0 -2
  325. package/dist/types/src/experimental/feed.test.d.ts.map +0 -1
  326. package/dist/types/src/functions/discord/fetch-messages.d.ts.map +0 -1
  327. package/dist/types/src/functions/discord/fetch-messages.test.d.ts.map +0 -1
  328. package/dist/types/src/functions/discord/index.d.ts.map +0 -1
  329. package/dist/types/src/functions/document/index.d.ts +0 -12
  330. package/dist/types/src/functions/document/index.d.ts.map +0 -1
  331. package/dist/types/src/functions/document/read.d.ts +0 -7
  332. package/dist/types/src/functions/document/read.d.ts.map +0 -1
  333. package/dist/types/src/functions/document/update.d.ts +0 -6
  334. package/dist/types/src/functions/document/update.d.ts.map +0 -1
  335. package/dist/types/src/functions/github/fetch-prs.d.ts.map +0 -1
  336. package/dist/types/src/functions/linear/index.d.ts +0 -9
  337. package/dist/types/src/functions/linear/index.d.ts.map +0 -1
  338. package/dist/types/src/functions/linear/linear.test.d.ts.map +0 -1
  339. package/dist/types/src/functions/linear/sync-issues.d.ts.map +0 -1
  340. package/dist/types/src/functions/research/create-document.d.ts.map +0 -1
  341. package/dist/types/src/functions/research/graph.d.ts.map +0 -1
  342. package/dist/types/src/functions/research/graph.test.d.ts.map +0 -1
  343. package/dist/types/src/functions/research/index.d.ts +0 -19
  344. package/dist/types/src/functions/research/index.d.ts.map +0 -1
  345. package/dist/types/src/functions/research/research-graph.d.ts +0 -18
  346. package/dist/types/src/functions/research/research-graph.d.ts.map +0 -1
  347. package/dist/types/src/functions/research/research.d.ts.map +0 -1
  348. package/dist/types/src/functions/research/research.test.d.ts.map +0 -1
  349. package/dist/types/src/functions/research/types.d.ts +0 -384
  350. package/dist/types/src/functions/research/types.d.ts.map +0 -1
  351. package/dist/types/src/functions/tasks/index.d.ts +0 -15
  352. package/dist/types/src/functions/tasks/index.d.ts.map +0 -1
  353. package/dist/types/src/functions/tasks/read.d.ts +0 -7
  354. package/dist/types/src/functions/tasks/read.d.ts.map +0 -1
  355. package/dist/types/src/functions/tasks/task-list.d.ts.map +0 -1
  356. package/dist/types/src/functions/tasks/task-list.test.d.ts.map +0 -1
  357. package/dist/types/src/functions/tasks/update.d.ts +0 -9
  358. package/dist/types/src/functions/tasks/update.d.ts.map +0 -1
  359. package/dist/types/src/plugins.d.ts +0 -19
  360. package/dist/types/src/plugins.d.ts.map +0 -1
  361. package/dist/types/src/testing/data/exa-search-1748337321991.d.ts.map +0 -1
  362. package/dist/types/src/testing/data/exa-search-1748337331526.d.ts.map +0 -1
  363. package/dist/types/src/testing/data/exa-search-1748337344119.d.ts.map +0 -1
  364. package/dist/types/src/testing/data/index.d.ts.map +0 -1
  365. package/src/blueprints/design/design-blueprint.ts +0 -33
  366. package/src/blueprints/discord/discord-blueprint.ts +0 -34
  367. package/src/blueprints/linear/linear-blueprint.ts +0 -35
  368. package/src/blueprints/research/research-blueprint.ts +0 -45
  369. package/src/blueprints/websearch/websearch-blueprint.ts +0 -20
  370. package/src/experimental/feed.test.ts +0 -108
  371. package/src/functions/discord/index.ts +0 -9
  372. package/src/functions/document/index.ts +0 -11
  373. package/src/functions/document/read.ts +0 -29
  374. package/src/functions/linear/index.ts +0 -9
  375. package/src/functions/linear/linear.test.ts +0 -86
  376. package/src/functions/research/create-document.ts +0 -69
  377. package/src/functions/research/graph.test.ts +0 -69
  378. package/src/functions/research/index.ts +0 -15
  379. package/src/functions/research/research-graph.ts +0 -47
  380. package/src/functions/research/research.conversations.json +0 -10714
  381. package/src/functions/research/research.test.ts +0 -240
  382. package/src/functions/research/research.ts +0 -155
  383. package/src/functions/research/types.ts +0 -24
  384. package/src/functions/tasks/index.ts +0 -11
  385. package/src/plugins.tsx +0 -68
  386. /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.d.ts +0 -0
  387. /package/dist/types/src/{functions/linear → blueprints/linear/functions}/linear.test.d.ts +0 -0
  388. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.d.ts +0 -0
  389. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.d.ts +0 -0
  390. /package/dist/types/src/{functions/research → blueprints/research/functions}/research.test.d.ts +0 -0
  391. /package/dist/types/src/{functions/research → crud}/graph.test.d.ts +0 -0
  392. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337321991.d.ts +0 -0
  393. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337331526.d.ts +0 -0
  394. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337344119.d.ts +0 -0
  395. /package/dist/types/src/{testing → functions/exa}/data/index.d.ts +0 -0
  396. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.ts +0 -0
  397. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.ts +0 -0
  398. /package/src/blueprints/research/{research-blueprint.test.ts → blueprint.test.ts} +0 -0
  399. /package/src/blueprints/websearch/{websearch-toolkit.ts → toolkit.ts} +0 -0
  400. /package/src/{testing → functions/exa}/data/exa-search-1748337321991.ts +0 -0
  401. /package/src/{testing → functions/exa}/data/exa-search-1748337331526.ts +0 -0
  402. /package/src/{testing → functions/exa}/data/exa-search-1748337344119.ts +0 -0
  403. /package/src/{testing → functions/exa}/data/index.ts +0 -0
@@ -0,0 +1,149 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { inspect } from 'node:util';
6
+
7
+ import { describe, it } from '@effect/vitest';
8
+ import * as Effect from 'effect/Effect';
9
+
10
+ import { ConsolePrinter } from '@dxos/ai';
11
+ import { MemoizedAiService } from '@dxos/ai/testing';
12
+ import { AiConversation, type ContextBinding, GenerationObserver } from '@dxos/assistant';
13
+ import { AssistantTestLayer } from '@dxos/assistant/testing';
14
+ import { Blueprint } from '@dxos/blueprints';
15
+ import { Database, Filter, Obj, Query, Ref } from '@dxos/echo';
16
+ import { acquireReleaseResource } from '@dxos/effect';
17
+ import { TestHelpers } from '@dxos/effect/testing';
18
+ import { FunctionInvocationService, QueueService } from '@dxos/functions';
19
+ import { invariant } from '@dxos/invariant';
20
+ import { ObjectId } from '@dxos/keys';
21
+ import { MarkdownBlueprint } from '@dxos/plugin-markdown/blueprints';
22
+ import { Markdown } from '@dxos/plugin-markdown/types';
23
+ import { HasSubject, type Message, Organization } from '@dxos/types';
24
+
25
+ import ResearchBlueprint from '../blueprint';
26
+ import { ResearchDataTypes, ResearchGraph } from '../types';
27
+
28
+ import { default as createDocument } from './document-create';
29
+ import { default as research } from './research';
30
+
31
+ ObjectId.dangerouslyDisableRandomness();
32
+
33
+ const TestLayer = AssistantTestLayer({
34
+ functions: [research, createDocument, ...MarkdownBlueprint.functions],
35
+ types: [
36
+ ...ResearchDataTypes,
37
+ ResearchGraph.ResearchGraph,
38
+ Blueprint.Blueprint,
39
+ Markdown.Document,
40
+ HasSubject.HasSubject,
41
+ ],
42
+ });
43
+
44
+ describe('Research', () => {
45
+ it.effect(
46
+ 'call a function to generate a research report',
47
+ Effect.fnUntraced(
48
+ function* (_) {
49
+ yield* Database.add(
50
+ Obj.make(Organization.Organization, {
51
+ name: 'BlueYard',
52
+ website: 'https://blueyard.com',
53
+ }),
54
+ );
55
+ yield* Database.flush({ indexes: true });
56
+ const result = yield* FunctionInvocationService.invokeFunction(research, {
57
+ query: 'Founders and portfolio of BlueYard.',
58
+ });
59
+
60
+ console.log(inspect(result, { depth: null, colors: true }));
61
+ console.log(JSON.stringify(result, null, 2));
62
+
63
+ yield* Database.flush({ indexes: true });
64
+ const researchGraph = yield* ResearchGraph.query();
65
+ if (researchGraph) {
66
+ const data = yield* Database.load(researchGraph.queue).pipe(
67
+ Effect.flatMap((queue) => Effect.promise(() => queue.queryObjects())),
68
+ );
69
+ console.log(inspect(data, { depth: null, colors: true }));
70
+ }
71
+ },
72
+ Effect.provide(TestLayer),
73
+ TestHelpers.provideTestContext,
74
+ ),
75
+ MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
76
+ );
77
+
78
+ it.scoped(
79
+ 'create and update research report',
80
+ Effect.fnUntraced(
81
+ function* (_) {
82
+ const organization = yield* Database.add(
83
+ Obj.make(Organization.Organization, {
84
+ name: 'BlueYard',
85
+ website: 'https://blueyard.com',
86
+ }),
87
+ );
88
+
89
+ const queue = yield* QueueService.createQueue<Message.Message | ContextBinding>();
90
+ const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
91
+
92
+ yield* Database.flush({ indexes: true });
93
+ const researchBlueprint = yield* Database.add(Obj.clone(ResearchBlueprint.make()));
94
+ const markdownBlueprint = yield* Database.add(Obj.clone(MarkdownBlueprint.make()));
95
+ yield* Effect.promise(() =>
96
+ conversation.context.bind({
97
+ blueprints: [Ref.make(researchBlueprint), Ref.make(markdownBlueprint)],
98
+ objects: [Ref.make(organization)],
99
+ }),
100
+ );
101
+
102
+ const observer = GenerationObserver.fromPrinter(new ConsolePrinter());
103
+
104
+ yield* conversation.createRequest({
105
+ observer,
106
+ prompt: `Create a research summary about ${organization.name}.`,
107
+ });
108
+ {
109
+ const docs = yield* Database.runQuery(
110
+ Query.select(Filter.id(organization.id)).targetOf(HasSubject.HasSubject).source(),
111
+ );
112
+ if (docs.length !== 1) {
113
+ throw new Error(`Expected 1 research document; got ${docs.length}: ${docs.map((_) => (_ as any).name)}`);
114
+ }
115
+
116
+ const doc = docs[0];
117
+ invariant(Obj.instanceOf(Markdown.Document, doc));
118
+ console.log({
119
+ name: doc.name,
120
+ content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
121
+ });
122
+ }
123
+
124
+ yield* conversation.createRequest({
125
+ observer,
126
+ prompt: 'Add a section about their portfolio.',
127
+ });
128
+ {
129
+ const docs = yield* Database.runQuery(
130
+ Query.select(Filter.id(organization.id)).targetOf(HasSubject.HasSubject).source(),
131
+ );
132
+ if (docs.length !== 1) {
133
+ throw new Error(`Expected 1 research document; got ${docs.length}: ${docs.map((_) => (_ as any).name)}`);
134
+ }
135
+
136
+ const doc = docs[0];
137
+ invariant(Obj.instanceOf(Markdown.Document, doc));
138
+ console.log({
139
+ name: doc.name,
140
+ content: yield* Database.load(doc.content).pipe(Effect.map((_) => _.content)),
141
+ });
142
+ }
143
+ },
144
+ Effect.provide(TestLayer),
145
+ TestHelpers.provideTestContext,
146
+ ),
147
+ MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
148
+ );
149
+ });
@@ -0,0 +1,175 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Toolkit from '@effect/ai/Toolkit';
6
+ import * as AnthropicTool from '@effect/ai-anthropic/AnthropicTool';
7
+ import * as Array from 'effect/Array';
8
+ import * as Effect from 'effect/Effect';
9
+ import * as Function from 'effect/Function';
10
+ import * as Layer from 'effect/Layer';
11
+ import * as Option from 'effect/Option';
12
+ import * as Schema from 'effect/Schema';
13
+ import * as String from 'effect/String';
14
+
15
+ import { AiService, ConsolePrinter } from '@dxos/ai';
16
+ import { GenericToolkit } from '@dxos/ai';
17
+ import { AiSession, GenerationObserver, ToolExecutionServices, createToolkit } from '@dxos/assistant';
18
+ import { Template } from '@dxos/blueprints';
19
+ import { type DXN, Entity, Obj } from '@dxos/echo';
20
+ import { Database } from '@dxos/echo';
21
+ import { TracingService, defineFunction } from '@dxos/functions';
22
+ import { type Message, Person } from '@dxos/types';
23
+ import { trim } from '@dxos/util';
24
+
25
+ import { LocalSearchHandler, LocalSearchToolkit, makeGraphWriterHandler, makeGraphWriterToolkit } from '../../../crud';
26
+ import { ResearchGraph } from '../types';
27
+ import { ResearchDataTypes } from '../types';
28
+
29
+ import PROMPT from './research-instructions.tpl?raw';
30
+
31
+ /**
32
+ * Exec external service and return the results as a Subgraph.
33
+ */
34
+ export default defineFunction({
35
+ key: 'dxos.org/function/research',
36
+ name: 'Research',
37
+ description: trim`
38
+ Search the web to research information about the given subject.
39
+ Inserts structured data into the research graph.
40
+ Creates a research summary and returns the objects created.
41
+ `,
42
+ inputSchema: Schema.Struct({
43
+ query: Schema.String.annotations({
44
+ description: trim`
45
+ The search query.
46
+ If doing research on an object then load it first and pass it as JSON.
47
+ `,
48
+ }),
49
+
50
+ instructions: Schema.optional(Schema.String).annotations({
51
+ description: trim`
52
+ The instructions for the research agent.
53
+ `,
54
+ }),
55
+
56
+ // TOOD(burdon): Move to context.
57
+ mockSearch: Schema.optional(Schema.Boolean).annotations({
58
+ description: 'Whether to use the mock search tool.',
59
+ default: false,
60
+ }),
61
+
62
+ entityExtraction: Schema.optional(Schema.Boolean).annotations({
63
+ description: trim`
64
+ Whether to extract structured entities from the research.
65
+ Experimental feature only enable if user explicitly requests it.
66
+ `,
67
+ default: false,
68
+ }),
69
+ }),
70
+ outputSchema: Schema.Struct({
71
+ document: Schema.optional(Schema.String).annotations({
72
+ description: 'The generated research document.',
73
+ }),
74
+ objects: Schema.Array(Schema.Unknown).annotations({
75
+ description: 'Structured objects created during the research process.',
76
+ }),
77
+ }),
78
+ handler: Effect.fnUntraced(
79
+ function* ({ data: { query, instructions, mockSearch = false, entityExtraction = false } }) {
80
+ if (mockSearch) {
81
+ const mockPerson = yield* Database.add(
82
+ Obj.make(Person.Person, {
83
+ preferredName: 'John Doe',
84
+ emails: [{ value: 'john.doe@example.com' }],
85
+ phoneNumbers: [{ value: '123-456-7890' }],
86
+ }),
87
+ );
88
+
89
+ return {
90
+ document: trim`
91
+ The research ran in test-mode and was mocked. Proceed as usual.
92
+ We reference John Doe to test reference: ${Obj.getDXN(mockPerson)}
93
+ `,
94
+ objects: [Obj.toJSON(mockPerson)],
95
+ };
96
+ }
97
+
98
+ yield* Database.flush({ indexes: true });
99
+ yield* TracingService.emitStatus({ message: 'Starting research...' });
100
+
101
+ const NativeWebSearch = Toolkit.make(AnthropicTool.WebSearch_20250305({}));
102
+
103
+ let toolkit: Toolkit.Any = NativeWebSearch;
104
+ let handlers: Layer.Layer<any, any> = Layer.empty as any;
105
+
106
+ const objectDXNs: DXN[] = [];
107
+ if (entityExtraction) {
108
+ const GraphWriterToolkit = makeGraphWriterToolkit({ schema: ResearchDataTypes });
109
+ const GraphWriterHandler = makeGraphWriterHandler(GraphWriterToolkit, {
110
+ onAppend: (dxns) => objectDXNs.push(...dxns),
111
+ });
112
+
113
+ toolkit = Toolkit.merge(toolkit, LocalSearchToolkit, GraphWriterToolkit);
114
+ handlers = Layer.mergeAll(handlers, LocalSearchHandler, GraphWriterHandler).pipe(
115
+ Layer.provide(ResearchGraph.contextQueueLayer),
116
+ ) as any;
117
+ }
118
+
119
+ const finishedToolkit = yield* createToolkit({ toolkit }).pipe(Effect.provide(handlers));
120
+
121
+ const session = new AiSession();
122
+ const result = yield* session.run({
123
+ prompt: query,
124
+ system: join(
125
+ Template.process(PROMPT, { entityExtraction }),
126
+ instructions && `<instructions>${instructions}</instructions>`,
127
+ ),
128
+ toolkit: finishedToolkit,
129
+ observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'research' })),
130
+ });
131
+
132
+ const objects = yield* Effect.forEach(objectDXNs, (dxn) => Database.resolve(dxn)).pipe(
133
+ Effect.map(Array.map((obj) => Entity.toJSON(obj))),
134
+ );
135
+
136
+ return {
137
+ document: extractLastTextBlock(result),
138
+ objects,
139
+ };
140
+ },
141
+ Effect.provide(
142
+ AiService.model('@anthropic/claude-sonnet-4-0').pipe(
143
+ Layer.merge(ToolExecutionServices),
144
+ Layer.provide(GenericToolkit.providerEmpty),
145
+ ),
146
+ ),
147
+ ),
148
+ });
149
+
150
+ // TODO(burdon): Factor out.
151
+ const join = (...strings: (string | undefined)[]) => strings.filter(Boolean).join('\n\n');
152
+
153
+ /**
154
+ * Extracts the last text block from the result.
155
+ * Skips citations.
156
+ */
157
+ // TODO(burdon): Factor out.
158
+ const extractLastTextBlock = (result: Message.Message[]) => {
159
+ return Function.pipe(
160
+ result,
161
+ Array.last,
162
+ Option.map(
163
+ Function.flow(
164
+ (_: Message.Message) => _.blocks,
165
+ Array.reverse,
166
+ Array.dropWhile((_: any) => _._tag === 'stats'),
167
+ Array.takeWhile((_: any) => _._tag === 'text'),
168
+ Array.reverse,
169
+ Array.map((_: any) => _.text),
170
+ Array.reduce('', String.concat),
171
+ ),
172
+ ),
173
+ Option.getOrElse(() => ''),
174
+ );
175
+ };
@@ -2,6 +2,5 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import blueprint from './research-blueprint';
6
-
7
- export default blueprint;
5
+ export { default as ResearchBlueprint } from './blueprint';
6
+ export * from './types';
@@ -0,0 +1,49 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Layer from 'effect/Layer';
7
+ import * as Schema from 'effect/Schema';
8
+
9
+ import { Database, Obj, Query, Ref, Type } from '@dxos/echo';
10
+ import { SystemTypeAnnotation } from '@dxos/echo/internal';
11
+ import { Queue } from '@dxos/echo-db';
12
+ import { ContextQueueService, QueueService } from '@dxos/functions';
13
+
14
+ /**
15
+ * Container for a set of ephemeral research results.
16
+ */
17
+ export const ResearchGraph = Schema.Struct({
18
+ queue: Ref.Ref(Queue),
19
+ }).pipe(
20
+ Type.object({
21
+ typename: 'dxos.org/type/ResearchGraph',
22
+ version: '0.1.0',
23
+ }),
24
+ SystemTypeAnnotation.set(true),
25
+ );
26
+
27
+ export interface ResearchGraph extends Schema.Schema.Type<typeof ResearchGraph> {}
28
+
29
+ export const create: () => Effect.Effect<ResearchGraph, never, Database.Service | QueueService> = Effect.fn(
30
+ 'createResearchGraph',
31
+ )(function* () {
32
+ const queue = yield* QueueService.createQueue();
33
+ return yield* Database.add(Obj.make(ResearchGraph, { queue: Ref.fromDXN(queue.dxn) }));
34
+ });
35
+
36
+ export const query: () => Effect.Effect<ResearchGraph | undefined, never, Database.Service> = Effect.fn(
37
+ 'queryResearchGraph',
38
+ )(function* () {
39
+ const objects = yield* Database.runQuery(Query.type(ResearchGraph));
40
+ return objects.at(0);
41
+ });
42
+
43
+ export const contextQueueLayer = Layer.unwrapEffect(
44
+ Effect.gen(function* () {
45
+ const researchGraph = (yield* query()) ?? (yield* create());
46
+ const researchQueue = yield* Database.load(researchGraph.queue);
47
+ return ContextQueueService.layer(researchQueue);
48
+ }),
49
+ );
@@ -0,0 +1,32 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { type Type } from '@dxos/echo';
6
+ import { Text } from '@dxos/schema';
7
+ import { Event, HasConnection, HasRelationship, LegacyOrganization, LegacyPerson, Pipeline, Task } from '@dxos/types';
8
+
9
+ export * as ResearchGraph from './ResearchGraph';
10
+
11
+ /**
12
+ * Data types for research.
13
+ */
14
+ // TODO(burdon): This should not be hardcoded.
15
+ export const ResearchDataTypes: Type.AnyEntity[] = [
16
+ // Objects
17
+ Event.Event,
18
+ Task.Task,
19
+ Text.Text,
20
+
21
+ // TODO(wittjosiah): Until views (e.g., Table) support relations this needs to be expressed via organization ref.
22
+ // Employer.Employer,
23
+ // Organization.Organization,
24
+ LegacyPerson,
25
+ LegacyOrganization,
26
+
27
+ Pipeline.Pipeline,
28
+
29
+ // Relations
30
+ HasRelationship.HasRelationship,
31
+ HasConnection.HasConnection,
32
+ ];
@@ -2,17 +2,36 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import * as Toolkit from '@effect/ai/Toolkit';
5
+ import * as Arr from 'effect/Array';
6
6
  import * as Effect from 'effect/Effect';
7
+ import { pipe } from 'effect/Function';
7
8
 
8
9
  import { ConsolePrinter } from '@dxos/ai';
9
- import { type AiConversation, type AiConversationRunParams, GenerationObserver } from '@dxos/assistant';
10
+ import {
11
+ AiContextService,
12
+ type AiConversation,
13
+ type AiConversationRunProps,
14
+ GenerationObserver,
15
+ } from '@dxos/assistant';
16
+ import type { Blueprint } from '@dxos/blueprints';
17
+ import { Database, Ref } from '@dxos/echo';
18
+ import { type FunctionDefinition } from '@dxos/functions';
10
19
  import { log } from '@dxos/log';
11
20
 
12
- export type TestStep = Pick<AiConversationRunParams, 'prompt' | 'system'> & {
21
+ export type TestStep = Pick<AiConversationRunProps, 'prompt' | 'system'> & {
13
22
  test?: () => Promise<void>;
14
23
  };
15
24
 
25
+ /**
26
+ * Blueprint definition type for testing.
27
+ * Mirrors AppCapabilities.BlueprintDefinition to avoid circular dependency with app-toolkit.
28
+ */
29
+ export interface BlueprintDefinition {
30
+ key: string;
31
+ functions: FunctionDefinition.Any[];
32
+ make: () => Blueprint.Blueprint;
33
+ }
34
+
16
35
  /**
17
36
  * Runs the prompt steps, calling the test function after each step.
18
37
  */
@@ -30,5 +49,17 @@ export const runSteps = Effect.fn(function* (conversation: AiConversation, steps
30
49
  }
31
50
  });
32
51
 
33
- // TODO(wittjosiah): Don't cast.
34
- export const testToolkit = Toolkit.empty as Toolkit.Toolkit<any>;
52
+ /**
53
+ * Binds blueprints from the blueprint definitions.
54
+ */
55
+ // TODO(dmaretskyi): Potentially the agent will auto-bind the blueprints.
56
+ export const addBlueprints = Effect.fnUntraced(function* (blueprints: BlueprintDefinition[]) {
57
+ yield* AiContextService.bindContext({
58
+ blueprints: yield* pipe(
59
+ blueprints,
60
+ Arr.map((blueprint) => blueprint.make()),
61
+ Effect.forEach(Database.add),
62
+ Effect.map(Arr.map(Ref.make)),
63
+ ),
64
+ });
65
+ });
@@ -0,0 +1,32 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { ToolId } from '@dxos/ai';
6
+ import { type AppCapabilities } from '@dxos/app-toolkit';
7
+ import { Blueprint } from '@dxos/blueprints';
8
+ import { Ref } from '@dxos/echo';
9
+ import { Text } from '@dxos/schema';
10
+
11
+ const BLUEPRINT_KEY = 'dxos.org/blueprint/web-search';
12
+
13
+ const functions: AppCapabilities.BlueprintDefinition['functions'] = [];
14
+
15
+ const make = () =>
16
+ Blueprint.make({
17
+ key: BLUEPRINT_KEY,
18
+ name: 'Web Search',
19
+ description: 'Search the web.',
20
+ instructions: {
21
+ source: Ref.make(Text.make()),
22
+ },
23
+ tools: [ToolId.make('AnthropicWebSearch')],
24
+ });
25
+
26
+ const blueprint: AppCapabilities.BlueprintDefinition = {
27
+ key: BLUEPRINT_KEY,
28
+ functions,
29
+ make,
30
+ };
31
+
32
+ export default blueprint;
@@ -2,7 +2,5 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import blueprint from './websearch-blueprint';
6
-
7
- export { WebSearchToolkit } from './websearch-toolkit';
8
- export default blueprint;
5
+ export { default as WebSearchBlueprint } from './blueprint';
6
+ export { WebSearchToolkit } from './toolkit';
@@ -0,0 +1,46 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { describe, it } from '@effect/vitest';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Layer from 'effect/Layer';
8
+
9
+ import { AiSession } from '@dxos/assistant';
10
+ import { AssistantTestLayer } from '@dxos/assistant/testing';
11
+ import { TestHelpers } from '@dxos/effect/testing';
12
+ import { log } from '@dxos/log';
13
+ import { Pipeline } from '@dxos/types';
14
+
15
+ import { makeGraphWriterHandler, makeGraphWriterToolkit } from './graph';
16
+
17
+ const TestLayer = AssistantTestLayer({});
18
+
19
+ describe('graph', () => {
20
+ // let builder: EchoTestBuilder;
21
+ // test('findRelatedSchema', async () => {
22
+ // const db = await createEchoDatabase();
23
+ // const relatedSchemas = await findRelatedSchema(db, Schema.Struct({}));
24
+ // });
25
+
26
+ const Toolkit = makeGraphWriterToolkit({ schema: [Pipeline.Pipeline] });
27
+ const ToolkitLayer = makeGraphWriterHandler(Toolkit);
28
+
29
+ it.effect.skip(
30
+ 'calculator',
31
+ Effect.fn(
32
+ function* (_) {
33
+ const session = new AiSession();
34
+ const toolkit = yield* Toolkit;
35
+ const response = yield* session.run({
36
+ toolkit,
37
+ prompt: 'What is 10 + 20?',
38
+ });
39
+
40
+ log.info('response', { response });
41
+ },
42
+ Effect.provide(Layer.mergeAll(TestLayer, ToolkitLayer)),
43
+ TestHelpers.provideTestContext,
44
+ ),
45
+ );
46
+ });