@dxos/assistant-toolkit 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8

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 (454) hide show
  1. package/dist/lib/{browser → neutral}/index.mjs +3835 -2486
  2. package/dist/lib/neutral/index.mjs.map +7 -0
  3. package/dist/lib/neutral/meta.json +1 -0
  4. package/dist/lib/neutral/testing/index.mjs +81 -0
  5. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  6. package/dist/types/src/blueprints/automation/blueprint.d.ts +4 -0
  7. package/dist/types/src/blueprints/automation/blueprint.d.ts.map +1 -0
  8. package/dist/types/src/blueprints/automation/index.d.ts +2 -0
  9. package/dist/types/src/blueprints/automation/index.d.ts.map +1 -0
  10. package/dist/types/src/blueprints/browser/blueprint.d.ts +4 -0
  11. package/dist/types/src/blueprints/browser/blueprint.d.ts.map +1 -0
  12. package/dist/types/src/blueprints/browser/blueprint.test.d.ts +2 -0
  13. package/dist/types/src/blueprints/browser/blueprint.test.d.ts.map +1 -0
  14. package/dist/types/src/blueprints/browser/index.d.ts +2 -0
  15. package/dist/types/src/blueprints/browser/index.d.ts.map +1 -0
  16. package/dist/types/src/blueprints/database/blueprint.d.ts +4 -0
  17. package/dist/types/src/blueprints/database/blueprint.d.ts.map +1 -0
  18. package/dist/types/src/blueprints/database/blueprint.test.d.ts +2 -0
  19. package/dist/types/src/blueprints/database/blueprint.test.d.ts.map +1 -0
  20. package/dist/types/src/blueprints/database/functions/context-add.d.ts +6 -0
  21. package/dist/types/src/blueprints/database/functions/context-add.d.ts.map +1 -0
  22. package/dist/types/src/blueprints/database/functions/context-remove.d.ts +6 -0
  23. package/dist/types/src/blueprints/database/functions/context-remove.d.ts.map +1 -0
  24. package/dist/types/src/blueprints/database/functions/index.d.ts +57 -0
  25. package/dist/types/src/blueprints/database/functions/index.d.ts.map +1 -0
  26. package/dist/types/src/blueprints/database/functions/load.d.ts +6 -0
  27. package/dist/types/src/blueprints/database/functions/load.d.ts.map +1 -0
  28. package/dist/types/src/blueprints/database/functions/object-create.d.ts +6 -0
  29. package/dist/types/src/blueprints/database/functions/object-create.d.ts.map +1 -0
  30. package/dist/types/src/blueprints/database/functions/object-delete.d.ts +6 -0
  31. package/dist/types/src/blueprints/database/functions/object-delete.d.ts.map +1 -0
  32. package/dist/types/src/blueprints/database/functions/object-update.d.ts +9 -0
  33. package/dist/types/src/blueprints/database/functions/object-update.d.ts.map +1 -0
  34. package/dist/types/src/blueprints/database/functions/query.d.ts +9 -0
  35. package/dist/types/src/blueprints/database/functions/query.d.ts.map +1 -0
  36. package/dist/types/src/blueprints/database/functions/relation-create.d.ts +9 -0
  37. package/dist/types/src/blueprints/database/functions/relation-create.d.ts.map +1 -0
  38. package/dist/types/src/blueprints/database/functions/relation-delete.d.ts +6 -0
  39. package/dist/types/src/blueprints/database/functions/relation-delete.d.ts.map +1 -0
  40. package/dist/types/src/{initiative/functions/update.d.ts → blueprints/database/functions/schema-add.d.ts} +3 -3
  41. package/dist/types/src/blueprints/database/functions/schema-add.d.ts.map +1 -0
  42. package/dist/types/src/blueprints/database/functions/schema-list.d.ts +5 -0
  43. package/dist/types/src/blueprints/database/functions/schema-list.d.ts.map +1 -0
  44. package/dist/types/src/blueprints/database/functions/tag-add.d.ts +7 -0
  45. package/dist/types/src/blueprints/database/functions/tag-add.d.ts.map +1 -0
  46. package/dist/types/src/blueprints/database/functions/tag-remove.d.ts +7 -0
  47. package/dist/types/src/blueprints/database/functions/tag-remove.d.ts.map +1 -0
  48. package/dist/types/src/blueprints/database/index.d.ts +3 -0
  49. package/dist/types/src/blueprints/database/index.d.ts.map +1 -0
  50. package/dist/types/src/blueprints/design/blueprint.d.ts +4 -0
  51. package/dist/types/src/blueprints/design/blueprint.d.ts.map +1 -0
  52. package/dist/types/src/blueprints/design/blueprint.test.d.ts +2 -0
  53. package/dist/types/src/blueprints/design/blueprint.test.d.ts.map +1 -0
  54. package/dist/types/src/blueprints/design/index.d.ts +1 -2
  55. package/dist/types/src/blueprints/design/index.d.ts.map +1 -1
  56. package/dist/types/src/blueprints/discord/blueprint.d.ts +4 -0
  57. package/dist/types/src/blueprints/discord/blueprint.d.ts.map +1 -0
  58. package/dist/types/src/blueprints/discord/functions/fetch-messages.d.ts.map +1 -0
  59. package/dist/types/src/blueprints/discord/functions/fetch-messages.test.d.ts.map +1 -0
  60. package/dist/types/src/{functions/discord → blueprints/discord/functions}/index.d.ts +3 -3
  61. package/dist/types/src/blueprints/discord/functions/index.d.ts.map +1 -0
  62. package/dist/types/src/blueprints/discord/index.d.ts +1 -2
  63. package/dist/types/src/blueprints/discord/index.d.ts.map +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.map +1 -0
  68. package/dist/types/src/blueprints/index.d.ts +13 -6
  69. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  70. package/dist/types/src/blueprints/linear/blueprint.d.ts +4 -0
  71. package/dist/types/src/blueprints/linear/blueprint.d.ts.map +1 -0
  72. package/dist/types/src/{functions/linear → blueprints/linear/functions}/index.d.ts +3 -3
  73. package/dist/types/src/blueprints/linear/functions/index.d.ts.map +1 -0
  74. package/dist/types/src/blueprints/linear/functions/linear.test.d.ts.map +1 -0
  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 +4 -0
  141. package/dist/types/src/blueprints/project/index.d.ts.map +1 -0
  142. package/dist/types/src/blueprints/project/sync-triggers.d.ts +11 -0
  143. package/dist/types/src/blueprints/project/sync-triggers.d.ts.map +1 -0
  144. package/dist/types/src/blueprints/project-wizard/blueprint.d.ts +4 -0
  145. package/dist/types/src/blueprints/project-wizard/blueprint.d.ts.map +1 -0
  146. package/dist/types/src/blueprints/project-wizard/functions/create-project.d.ts +10 -0
  147. package/dist/types/src/blueprints/project-wizard/functions/create-project.d.ts.map +1 -0
  148. package/dist/types/src/blueprints/project-wizard/functions/index.d.ts +31 -0
  149. package/dist/types/src/blueprints/project-wizard/functions/index.d.ts.map +1 -0
  150. package/dist/types/src/blueprints/project-wizard/functions/project-rules.d.ts +3 -0
  151. package/dist/types/src/blueprints/project-wizard/functions/project-rules.d.ts.map +1 -0
  152. package/dist/types/src/blueprints/{design/design-blueprint.d.ts → project-wizard/functions/query-blueprints.d.ts} +8 -3
  153. package/dist/types/src/blueprints/project-wizard/functions/query-blueprints.d.ts.map +1 -0
  154. package/dist/types/src/blueprints/project-wizard/index.d.ts +3 -0
  155. package/dist/types/src/blueprints/project-wizard/index.d.ts.map +1 -0
  156. package/dist/types/src/blueprints/research/blueprint.d.ts +4 -0
  157. package/dist/types/src/blueprints/research/blueprint.d.ts.map +1 -0
  158. package/dist/types/src/blueprints/research/blueprint.test.d.ts +2 -0
  159. package/dist/types/src/blueprints/research/blueprint.test.d.ts.map +1 -0
  160. package/dist/types/src/{functions/research → blueprints/research/functions}/document-create.d.ts +2 -1
  161. package/dist/types/src/blueprints/research/functions/document-create.d.ts.map +1 -0
  162. package/dist/types/src/{functions/research → blueprints/research/functions}/index.d.ts +6 -8
  163. package/dist/types/src/blueprints/research/functions/index.d.ts.map +1 -0
  164. package/dist/types/src/{functions/research → blueprints/research/functions}/research.d.ts +1 -1
  165. package/dist/types/src/blueprints/research/functions/research.d.ts.map +1 -0
  166. package/dist/types/src/blueprints/research/functions/research.test.d.ts.map +1 -0
  167. package/dist/types/src/blueprints/research/index.d.ts +2 -2
  168. package/dist/types/src/blueprints/research/index.d.ts.map +1 -1
  169. package/dist/types/src/{functions/research/research-graph.d.ts → blueprints/research/types/ResearchGraph.d.ts} +5 -6
  170. package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts.map +1 -0
  171. package/dist/types/src/blueprints/research/types/index.d.ts +7 -0
  172. package/dist/types/src/blueprints/research/types/index.d.ts.map +1 -0
  173. package/dist/types/src/blueprints/testing.d.ts +17 -3
  174. package/dist/types/src/blueprints/testing.d.ts.map +1 -1
  175. package/dist/types/src/blueprints/websearch/blueprint.d.ts +4 -0
  176. package/dist/types/src/blueprints/websearch/blueprint.d.ts.map +1 -0
  177. package/dist/types/src/blueprints/websearch/functions/fetch.d.ts +5 -0
  178. package/dist/types/src/blueprints/websearch/functions/fetch.d.ts.map +1 -0
  179. package/dist/types/src/blueprints/websearch/functions/index.d.ts +6 -0
  180. package/dist/types/src/blueprints/websearch/functions/index.d.ts.map +1 -0
  181. package/dist/types/src/blueprints/websearch/index.d.ts +3 -3
  182. package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -1
  183. package/dist/types/src/blueprints/websearch/{websearch-toolkit.d.ts → toolkit.d.ts} +1 -1
  184. package/dist/types/src/blueprints/websearch/toolkit.d.ts.map +1 -0
  185. package/dist/types/src/crud/graph.d.ts +6 -6
  186. package/dist/types/src/crud/graph.d.ts.map +1 -1
  187. package/dist/types/src/functions/agent/index.d.ts +84 -4
  188. package/dist/types/src/functions/agent/index.d.ts.map +1 -1
  189. package/dist/types/src/functions/agent/prompt.d.ts +9 -1
  190. package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
  191. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +8 -3
  192. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
  193. package/dist/types/src/functions/entity-extraction/index.d.ts +10 -6
  194. package/dist/types/src/functions/entity-extraction/index.d.ts.map +1 -1
  195. package/dist/types/src/functions/exa/index.d.ts +8 -2
  196. package/dist/types/src/functions/exa/index.d.ts.map +1 -1
  197. package/dist/types/src/functions/index.d.ts +1 -5
  198. package/dist/types/src/functions/index.d.ts.map +1 -1
  199. package/dist/types/src/index.d.ts +2 -1
  200. package/dist/types/src/index.d.ts.map +1 -1
  201. package/dist/types/src/testing/index.d.ts +1 -0
  202. package/dist/types/src/testing/index.d.ts.map +1 -1
  203. package/dist/types/src/testing/plugins.d.ts.map +1 -1
  204. package/dist/types/src/toolkits/WebToolkit.d.ts +38 -0
  205. package/dist/types/src/toolkits/WebToolkit.d.ts.map +1 -0
  206. package/dist/types/src/toolkits/index.d.ts +1 -2
  207. package/dist/types/src/toolkits/index.d.ts.map +1 -1
  208. package/dist/types/src/types/Chat.d.ts +31 -0
  209. package/dist/types/src/types/Chat.d.ts.map +1 -0
  210. package/dist/types/src/types/Memory.d.ts +12 -0
  211. package/dist/types/src/types/Memory.d.ts.map +1 -0
  212. package/dist/types/src/types/Plan.d.ts +77 -0
  213. package/dist/types/src/types/Plan.d.ts.map +1 -0
  214. package/dist/types/src/types/Project.d.ts +66 -0
  215. package/dist/types/src/types/Project.d.ts.map +1 -0
  216. package/dist/types/src/types/index.d.ts +5 -0
  217. package/dist/types/src/types/index.d.ts.map +1 -0
  218. package/dist/types/tsconfig.tsbuildinfo +1 -1
  219. package/package.json +38 -43
  220. package/src/blueprints/automation/blueprint.ts +109 -0
  221. package/src/blueprints/automation/index.ts +5 -0
  222. package/src/blueprints/browser/blueprint.conversations.json +1 -0
  223. package/src/blueprints/browser/blueprint.test.ts +70 -0
  224. package/src/blueprints/browser/blueprint.ts +41 -0
  225. package/src/blueprints/browser/index.ts +5 -0
  226. package/src/blueprints/database/blueprint.conversations.json +1 -0
  227. package/src/blueprints/database/blueprint.test.ts +341 -0
  228. package/src/blueprints/database/blueprint.ts +39 -0
  229. package/src/blueprints/database/functions/context-add.ts +35 -0
  230. package/src/blueprints/database/functions/context-remove.ts +35 -0
  231. package/src/blueprints/database/functions/index.ts +33 -0
  232. package/src/blueprints/database/functions/load.ts +31 -0
  233. package/src/blueprints/database/functions/object-create.ts +48 -0
  234. package/src/blueprints/database/functions/object-delete.ts +27 -0
  235. package/src/blueprints/database/functions/object-update.ts +40 -0
  236. package/src/blueprints/database/functions/query.ts +130 -0
  237. package/src/blueprints/database/functions/relation-create.ts +47 -0
  238. package/src/blueprints/database/functions/relation-delete.ts +28 -0
  239. package/src/blueprints/database/functions/schema-add.ts +40 -0
  240. package/src/blueprints/database/functions/schema-list.ts +34 -0
  241. package/src/blueprints/database/functions/tag-add.ts +31 -0
  242. package/src/blueprints/database/functions/tag-remove.ts +30 -0
  243. package/src/blueprints/database/index.ts +6 -0
  244. package/src/blueprints/design/{design-blueprint.test.ts → blueprint.test.ts} +12 -21
  245. package/src/blueprints/design/{design-blueprint.ts → blueprint.ts} +25 -10
  246. package/src/blueprints/design/index.ts +1 -3
  247. package/src/blueprints/discord/blueprint.ts +46 -0
  248. package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.ts +4 -7
  249. package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.ts +1 -1
  250. package/src/blueprints/discord/functions/index.ts +9 -0
  251. package/src/blueprints/discord/index.ts +1 -3
  252. package/src/{functions/github → blueprints/github/functions}/fetch-prs.ts +1 -1
  253. package/src/blueprints/github/functions/index.ts +9 -0
  254. package/src/blueprints/index.ts +13 -6
  255. package/src/blueprints/linear/blueprint.ts +47 -0
  256. package/src/blueprints/linear/functions/index.ts +9 -0
  257. package/src/blueprints/linear/functions/linear.test.ts +58 -0
  258. package/src/{functions/linear → blueprints/linear/functions}/sync-issues.ts +7 -7
  259. package/src/blueprints/linear/index.ts +1 -3
  260. package/src/blueprints/markdown/blueprint.ts +38 -0
  261. package/src/blueprints/markdown/functions/create.ts +29 -0
  262. package/src/blueprints/markdown/functions/index.ts +13 -0
  263. package/src/blueprints/markdown/functions/read.ts +32 -0
  264. package/src/{functions/document → blueprints/markdown/functions}/update.ts +6 -7
  265. package/src/blueprints/markdown/index.ts +6 -0
  266. package/src/blueprints/memory/blueprint.conversations.json +1 -0
  267. package/src/blueprints/memory/blueprint.test.ts +135 -0
  268. package/src/blueprints/memory/blueprint.ts +44 -0
  269. package/src/blueprints/memory/functions/delete.ts +25 -0
  270. package/src/blueprints/memory/functions/index.ts +13 -0
  271. package/src/blueprints/memory/functions/query.ts +49 -0
  272. package/src/blueprints/memory/functions/save.ts +32 -0
  273. package/src/blueprints/memory/index.ts +6 -0
  274. package/src/blueprints/planning/blueprint.ts +28 -0
  275. package/src/blueprints/planning/functions/index.ts +9 -0
  276. package/src/blueprints/planning/functions/update-tasks.ts +168 -0
  277. package/src/blueprints/planning/index.ts +2 -4
  278. package/src/blueprints/{planning/planning-blueprint.test.ts → planning-old/blueprint.test.ts} +12 -16
  279. package/src/blueprints/{planning/planning-blueprint.ts → planning-old/blueprint.ts} +24 -10
  280. package/src/blueprints/planning-old/functions/index.ts +11 -0
  281. package/src/{functions/tasks → blueprints/planning-old/functions}/read.ts +6 -7
  282. package/src/{functions/tasks → blueprints/planning-old/functions}/update.ts +6 -7
  283. package/src/blueprints/planning-old/index.ts +5 -0
  284. package/src/{initiative/initiative.test.ts → blueprints/project/blueprint.test.ts} +138 -44
  285. package/src/blueprints/project/blueprint.ts +68 -0
  286. package/src/blueprints/project/functions/add-artifact.ts +41 -0
  287. package/src/blueprints/project/functions/agent.ts +72 -0
  288. package/src/blueprints/project/functions/get-context.ts +63 -0
  289. package/src/blueprints/project/functions/index.ts +15 -0
  290. package/src/blueprints/project/functions/qualifier.ts +96 -0
  291. package/src/blueprints/project/index.ts +7 -0
  292. package/src/blueprints/project/sync-triggers.ts +153 -0
  293. package/src/blueprints/project-wizard/blueprint.ts +45 -0
  294. package/src/blueprints/project-wizard/functions/create-project.ts +57 -0
  295. package/src/blueprints/project-wizard/functions/index.ts +13 -0
  296. package/src/blueprints/project-wizard/functions/project-rules.ts +78 -0
  297. package/src/blueprints/project-wizard/functions/query-blueprints.ts +27 -0
  298. package/src/blueprints/project-wizard/index.ts +6 -0
  299. package/src/blueprints/research/{research-blueprint.ts → blueprint.ts} +25 -11
  300. package/src/{functions/research → blueprints/research/functions}/document-create.ts +9 -12
  301. package/src/blueprints/research/functions/index.ts +11 -0
  302. package/src/{functions/research → blueprints/research/functions}/research-instructions.tpl +5 -5
  303. package/src/blueprints/research/functions/research.conversations.json +1 -0
  304. package/src/{functions/research → blueprints/research/functions}/research.test.ts +33 -55
  305. package/src/{functions/research → blueprints/research/functions}/research.ts +14 -28
  306. package/src/blueprints/research/index.ts +2 -3
  307. package/src/blueprints/research/types/ResearchGraph.ts +49 -0
  308. package/src/{functions/research/types.ts → blueprints/research/types/index.ts} +12 -6
  309. package/src/blueprints/testing.ts +35 -4
  310. package/src/blueprints/websearch/blueprint.ts +32 -0
  311. package/src/blueprints/websearch/functions/fetch.ts +28 -0
  312. package/src/blueprints/websearch/functions/index.ts +9 -0
  313. package/src/blueprints/websearch/index.ts +3 -5
  314. package/src/crud/graph.test.ts +2 -2
  315. package/src/crud/graph.ts +9 -9
  316. package/src/functions/READ_THIS.md +5 -0
  317. package/src/functions/agent/index.ts +4 -6
  318. package/src/functions/agent/prompt.ts +16 -26
  319. package/src/functions/entity-extraction/entity-extraction.conversations.json +1 -6597
  320. package/src/functions/entity-extraction/entity-extraction.test.ts +11 -30
  321. package/src/functions/entity-extraction/entity-extraction.ts +13 -15
  322. package/src/functions/entity-extraction/index.ts +4 -4
  323. package/src/functions/exa/exa.ts +2 -2
  324. package/src/functions/exa/index.ts +7 -2
  325. package/src/functions/exa/mock.ts +1 -1
  326. package/src/functions/index.ts +1 -5
  327. package/src/index.ts +2 -1
  328. package/src/sync/sync.ts +2 -2
  329. package/src/testing/index.ts +1 -0
  330. package/src/testing/plugins.tsx +22 -18
  331. package/src/toolkits/WebToolkit.ts +33 -0
  332. package/src/toolkits/index.ts +1 -2
  333. package/src/types/Chat.ts +51 -0
  334. package/src/types/Memory.ts +23 -0
  335. package/src/types/Plan.ts +110 -0
  336. package/src/types/Project.ts +197 -0
  337. package/src/types/index.ts +8 -0
  338. package/dist/lib/browser/index.mjs.map +0 -7
  339. package/dist/lib/browser/meta.json +0 -1
  340. package/dist/lib/browser/testing/index.mjs +0 -43
  341. package/dist/lib/browser/testing/index.mjs.map +0 -7
  342. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  343. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  344. package/dist/lib/node-esm/index.mjs +0 -2881
  345. package/dist/lib/node-esm/index.mjs.map +0 -7
  346. package/dist/lib/node-esm/meta.json +0 -1
  347. package/dist/lib/node-esm/testing/index.mjs +0 -44
  348. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  349. package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +0 -1
  350. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts +0 -2
  351. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts.map +0 -1
  352. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +0 -18
  353. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +0 -1
  354. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +0 -18
  355. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +0 -1
  356. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +0 -18
  357. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +0 -1
  358. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts +0 -2
  359. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts.map +0 -1
  360. package/dist/types/src/blueprints/research/research-blueprint.d.ts +0 -18
  361. package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +0 -1
  362. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts +0 -2
  363. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts.map +0 -1
  364. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +0 -18
  365. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +0 -1
  366. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts.map +0 -1
  367. package/dist/types/src/experimental/feed.test.d.ts +0 -2
  368. package/dist/types/src/experimental/feed.test.d.ts.map +0 -1
  369. package/dist/types/src/functions/discord/fetch-messages.d.ts.map +0 -1
  370. package/dist/types/src/functions/discord/fetch-messages.test.d.ts.map +0 -1
  371. package/dist/types/src/functions/discord/index.d.ts.map +0 -1
  372. package/dist/types/src/functions/document/index.d.ts +0 -13
  373. package/dist/types/src/functions/document/index.d.ts.map +0 -1
  374. package/dist/types/src/functions/document/read.d.ts.map +0 -1
  375. package/dist/types/src/functions/document/update.d.ts.map +0 -1
  376. package/dist/types/src/functions/github/fetch-prs.d.ts.map +0 -1
  377. package/dist/types/src/functions/linear/index.d.ts.map +0 -1
  378. package/dist/types/src/functions/linear/linear.test.d.ts.map +0 -1
  379. package/dist/types/src/functions/linear/sync-issues.d.ts.map +0 -1
  380. package/dist/types/src/functions/research/document-create.d.ts.map +0 -1
  381. package/dist/types/src/functions/research/index.d.ts.map +0 -1
  382. package/dist/types/src/functions/research/research-graph.d.ts.map +0 -1
  383. package/dist/types/src/functions/research/research.d.ts.map +0 -1
  384. package/dist/types/src/functions/research/research.test.d.ts.map +0 -1
  385. package/dist/types/src/functions/research/types.d.ts +0 -6
  386. package/dist/types/src/functions/research/types.d.ts.map +0 -1
  387. package/dist/types/src/functions/tasks/index.d.ts +0 -15
  388. package/dist/types/src/functions/tasks/index.d.ts.map +0 -1
  389. package/dist/types/src/functions/tasks/read.d.ts +0 -7
  390. package/dist/types/src/functions/tasks/read.d.ts.map +0 -1
  391. package/dist/types/src/functions/tasks/task-list.d.ts.map +0 -1
  392. package/dist/types/src/functions/tasks/task-list.test.d.ts.map +0 -1
  393. package/dist/types/src/functions/tasks/update.d.ts +0 -9
  394. package/dist/types/src/functions/tasks/update.d.ts.map +0 -1
  395. package/dist/types/src/initiative/Initiative.d.ts +0 -84
  396. package/dist/types/src/initiative/Initiative.d.ts.map +0 -1
  397. package/dist/types/src/initiative/InitiativeSchema.d.ts +0 -19
  398. package/dist/types/src/initiative/InitiativeSchema.d.ts.map +0 -1
  399. package/dist/types/src/initiative/functions/agent.d.ts +0 -37
  400. package/dist/types/src/initiative/functions/agent.d.ts.map +0 -1
  401. package/dist/types/src/initiative/functions/getContext.d.ts +0 -17
  402. package/dist/types/src/initiative/functions/getContext.d.ts.map +0 -1
  403. package/dist/types/src/initiative/functions/index.d.ts +0 -4
  404. package/dist/types/src/initiative/functions/index.d.ts.map +0 -1
  405. package/dist/types/src/initiative/functions/update.d.ts.map +0 -1
  406. package/dist/types/src/initiative/index.d.ts.map +0 -1
  407. package/dist/types/src/initiative/initiative.test.d.ts +0 -2
  408. package/dist/types/src/initiative/initiative.test.d.ts.map +0 -1
  409. package/dist/types/src/toolkits/AssistantToolkit.d.ts +0 -43
  410. package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +0 -1
  411. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts +0 -2
  412. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts.map +0 -1
  413. package/dist/types/src/toolkits/SystemToolkit.d.ts +0 -99
  414. package/dist/types/src/toolkits/SystemToolkit.d.ts.map +0 -1
  415. package/src/blueprints/discord/discord-blueprint.ts +0 -32
  416. package/src/blueprints/linear/linear-blueprint.ts +0 -33
  417. package/src/blueprints/websearch/websearch-blueprint.ts +0 -18
  418. package/src/experimental/feed.test.ts +0 -111
  419. package/src/functions/discord/index.ts +0 -9
  420. package/src/functions/document/index.ts +0 -12
  421. package/src/functions/document/read.ts +0 -30
  422. package/src/functions/linear/index.ts +0 -9
  423. package/src/functions/linear/linear.test.ts +0 -84
  424. package/src/functions/research/index.ts +0 -14
  425. package/src/functions/research/research-graph.ts +0 -49
  426. package/src/functions/research/research.conversations.json +0 -1
  427. package/src/functions/tasks/index.ts +0 -11
  428. package/src/initiative/Initiative.ts +0 -99
  429. package/src/initiative/InitiativeSchema.ts +0 -37
  430. package/src/initiative/functions/agent.ts +0 -57
  431. package/src/initiative/functions/getContext.ts +0 -74
  432. package/src/initiative/functions/index.ts +0 -7
  433. package/src/initiative/functions/update.ts +0 -63
  434. package/src/initiative/initiative.conversations.json +0 -1
  435. package/src/toolkits/AssistantToolkit.conversations.json +0 -1
  436. package/src/toolkits/AssistantToolkit.test.ts +0 -94
  437. package/src/toolkits/AssistantToolkit.ts +0 -70
  438. package/src/toolkits/SystemToolkit.ts +0 -299
  439. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
  440. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
  441. /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.d.ts +0 -0
  442. /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.d.ts +0 -0
  443. /package/dist/types/src/{functions/github → blueprints/github/functions}/fetch-prs.d.ts +0 -0
  444. /package/dist/types/src/{initiative → blueprints/github}/index.d.ts +0 -0
  445. /package/dist/types/src/{functions/linear → blueprints/linear/functions}/linear.test.d.ts +0 -0
  446. /package/dist/types/src/{functions/linear → blueprints/linear/functions}/sync-issues.d.ts +0 -0
  447. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.d.ts +0 -0
  448. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.d.ts +0 -0
  449. /package/dist/types/src/{functions/research → blueprints/research/functions}/research.test.d.ts +0 -0
  450. /package/src/{initiative → blueprints/github}/index.ts +0 -0
  451. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.ts +0 -0
  452. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.ts +0 -0
  453. /package/src/blueprints/research/{research-blueprint.test.ts → blueprint.test.ts} +0 -0
  454. /package/src/blueprints/websearch/{websearch-toolkit.ts → toolkit.ts} +0 -0
@@ -0,0 +1,341 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { describe, expect, it } from '@effect/vitest';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Layer from 'effect/Layer';
8
+
9
+ import { AiContextService, AiConversationService } from '@dxos/assistant';
10
+ import { AssistantTestLayer } from '@dxos/assistant/testing';
11
+ import { Blueprint } from '@dxos/blueprints';
12
+ import { Database, Entity, Obj, Query, Ref, Relation, Tag } from '@dxos/echo';
13
+ import { TestHelpers } from '@dxos/effect/testing';
14
+ import { ObjectId } from '@dxos/keys';
15
+ import { Employer, Organization, Person } from '@dxos/types';
16
+
17
+ import DatabaseBlueprint from './blueprint';
18
+ import { DatabaseFunctions } from './functions';
19
+
20
+ ObjectId.dangerouslyDisableRandomness();
21
+
22
+ const TestLayer = AssistantTestLayer({
23
+ functions: [...Object.values(DatabaseFunctions)],
24
+ types: [Organization.Organization, Person.Person, Employer.Employer, Tag.Tag, Blueprint.Blueprint],
25
+ tracing: 'pretty',
26
+ });
27
+
28
+ const provideTestLayers = Effect.provide(AiConversationService.layerNewQueue().pipe(Layer.provideMerge(TestLayer)));
29
+
30
+ const addDatabaseBlueprint = Effect.fnUntraced(function* () {
31
+ yield* AiContextService.bindContext({
32
+ blueprints: [Ref.make(yield* Database.add(Obj.clone(DatabaseBlueprint.make(), { deep: true })))],
33
+ });
34
+ });
35
+
36
+ describe('Database Blueprint', () => {
37
+ //
38
+ // Schema
39
+ //
40
+
41
+ it.effect(
42
+ 'schema-list: list available schemas',
43
+ Effect.fnUntraced(
44
+ function* (_) {
45
+ yield* addDatabaseBlueprint();
46
+ const messages = yield* AiConversationService.run({
47
+ prompt: 'List all available schemas. Tell me what typenames are available.',
48
+ });
49
+ const lastMessage = messages.at(-1);
50
+ expect(lastMessage).toBeDefined();
51
+ },
52
+ provideTestLayers,
53
+ TestHelpers.provideTestContext,
54
+ ),
55
+ { timeout: 60_000 },
56
+ );
57
+
58
+ it.effect(
59
+ 'schema-add: add a new schema',
60
+ Effect.fnUntraced(
61
+ function* (_) {
62
+ yield* addDatabaseBlueprint();
63
+ yield* AiConversationService.run({
64
+ prompt:
65
+ 'Add a new schema called "Project" with typename "com.example.type.project" and fields: name (string), description (string), and status (string).',
66
+ });
67
+ const { db } = yield* Database.Service;
68
+ const schemas = yield* Effect.promise(() =>
69
+ db.schemaRegistry.query({ typename: 'com.example.type.project', location: ['database', 'runtime'] }).run(),
70
+ );
71
+ expect(schemas.length).toBeGreaterThanOrEqual(1);
72
+ },
73
+ provideTestLayers,
74
+ TestHelpers.provideTestContext,
75
+ ),
76
+ { timeout: 60_000 },
77
+ );
78
+
79
+ //
80
+ // Objects
81
+ //
82
+
83
+ it.effect(
84
+ 'object-create: create an object',
85
+ Effect.fnUntraced(
86
+ function* (_) {
87
+ yield* addDatabaseBlueprint();
88
+ yield* AiConversationService.run({
89
+ prompt: 'Create a new organization called "Cyberdyne Systems".',
90
+ });
91
+ const orgs = yield* Database.runQuery(Query.type(Organization.Organization, { name: 'Cyberdyne Systems' }));
92
+ expect(orgs).toHaveLength(1);
93
+ },
94
+ provideTestLayers,
95
+ TestHelpers.provideTestContext,
96
+ ),
97
+ { timeout: 60_000 },
98
+ );
99
+
100
+ it.effect(
101
+ 'object-create: create an object with a reference',
102
+ Effect.fnUntraced(
103
+ function* (_) {
104
+ yield* addDatabaseBlueprint();
105
+ yield* AiConversationService.run({
106
+ prompt: 'Create a preson fullName="John Doe" with a reference to the organization "Cyberdyne Systems".',
107
+ });
108
+ const orgs = yield* Database.runQuery(Query.type(Organization.Organization, { name: 'Cyberdyne Systems' }));
109
+ const persons = yield* Database.runQuery(Query.type(Person.Person, { fullName: 'John Doe' }));
110
+ expect(orgs).toHaveLength(1);
111
+ expect(persons).toHaveLength(1);
112
+ expect(persons[0].organization.target).toBe(orgs[0]);
113
+ },
114
+ provideTestLayers,
115
+ TestHelpers.provideTestContext,
116
+ ),
117
+ { timeout: 60_000 },
118
+ );
119
+
120
+ it.effect(
121
+ 'object-delete: delete an object',
122
+ Effect.fnUntraced(
123
+ function* (_) {
124
+ yield* addDatabaseBlueprint();
125
+ const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Obsolete Corp' }));
126
+ yield* AiConversationService.run({
127
+ prompt: `Delete the organization "Obsolete Corp".`,
128
+ });
129
+ expect(Obj.isDeleted(org)).toBe(true);
130
+ },
131
+ provideTestLayers,
132
+ TestHelpers.provideTestContext,
133
+ ),
134
+ { timeout: 60_000 },
135
+ );
136
+
137
+ it.effect(
138
+ 'object-update: update an object',
139
+ Effect.fnUntraced(
140
+ function* (_) {
141
+ yield* addDatabaseBlueprint();
142
+ const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Old Name Inc' }));
143
+ yield* AiConversationService.run({
144
+ prompt: `Update the organization "Old Name Inc" and change its name to "New Name Corp".`,
145
+ });
146
+ expect(org.name).toBe('New Name Corp');
147
+ },
148
+ provideTestLayers,
149
+ TestHelpers.provideTestContext,
150
+ ),
151
+ { timeout: 60_000 },
152
+ );
153
+
154
+ //
155
+ // Query & Load
156
+ //
157
+
158
+ it.effect(
159
+ 'query: search for objects',
160
+ Effect.fnUntraced(
161
+ function* (_) {
162
+ yield* addDatabaseBlueprint();
163
+ yield* Database.add(Obj.make(Organization.Organization, { name: 'Acme Corp' }));
164
+ yield* Database.add(Obj.make(Organization.Organization, { name: 'Globex Industries' }));
165
+ const messages = yield* AiConversationService.run({
166
+ prompt: 'Search for all organizations. How many are there?',
167
+ });
168
+ const lastMessage = messages.at(-1);
169
+ expect(lastMessage).toBeDefined();
170
+ },
171
+ provideTestLayers,
172
+ TestHelpers.provideTestContext,
173
+ ),
174
+ { timeout: 60_000 },
175
+ );
176
+
177
+ it.effect(
178
+ 'load: load object details',
179
+ Effect.fnUntraced(
180
+ function* (_) {
181
+ yield* addDatabaseBlueprint();
182
+ const org = yield* Database.add(
183
+ Obj.make(Organization.Organization, { name: 'Detail Corp', description: 'A detailed organization.' }),
184
+ );
185
+ const dxn = Obj.getDXN(org).toString();
186
+ const messages = yield* AiConversationService.run({
187
+ prompt: `Load the full details of object ${dxn}. What is its description?`,
188
+ });
189
+ const lastMessage = messages.at(-1);
190
+ expect(lastMessage).toBeDefined();
191
+ },
192
+ provideTestLayers,
193
+ TestHelpers.provideTestContext,
194
+ ),
195
+ { timeout: 60_000 },
196
+ );
197
+
198
+ //
199
+ // Relations
200
+ //
201
+
202
+ it.effect(
203
+ 'relation-create: create a relation between objects',
204
+ Effect.fnUntraced(
205
+ function* (_) {
206
+ yield* addDatabaseBlueprint();
207
+ const person = yield* Database.add(Obj.make(Person.Person, { fullName: 'John Connor' }));
208
+ const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Cyberdyne Systems' }));
209
+ yield* AiConversationService.run({
210
+ prompt: `Create an Employer relation from person "John Connor" to organization "Cyberdyne Systems" with role "Engineer". List schemas first to find the relation typename.`,
211
+ });
212
+ const relations = yield* Database.runQuery(Query.type(Employer.Employer));
213
+ expect(relations.length).toBeGreaterThanOrEqual(1);
214
+ },
215
+ provideTestLayers,
216
+ TestHelpers.provideTestContext,
217
+ ),
218
+ { timeout: 60_000 },
219
+ );
220
+
221
+ it.effect(
222
+ 'relation-delete: delete a relation',
223
+ Effect.fnUntraced(
224
+ function* (_) {
225
+ yield* addDatabaseBlueprint();
226
+ const person = yield* Database.add(Obj.make(Person.Person, { fullName: 'Sarah Connor' }));
227
+ const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Cyberdyne Systems' }));
228
+ const relation = yield* Database.add(
229
+ Relation.make(Employer.Employer, {
230
+ [Relation.Source]: person,
231
+ [Relation.Target]: org,
232
+ role: 'Director',
233
+ }),
234
+ );
235
+ const relationDxn = Relation.getDXN(relation).toString();
236
+ yield* AiConversationService.run({
237
+ prompt: `Delete the relation ${relationDxn}.`,
238
+ });
239
+ expect(Relation.isDeleted(relation)).toBe(true);
240
+ },
241
+ provideTestLayers,
242
+ TestHelpers.provideTestContext,
243
+ ),
244
+ { timeout: 60_000 },
245
+ );
246
+
247
+ //
248
+ // Tags
249
+ //
250
+
251
+ it.effect(
252
+ 'tag-add: add a tag to an object',
253
+ Effect.fnUntraced(
254
+ function* (_) {
255
+ yield* addDatabaseBlueprint();
256
+ const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Tagged Corp' }));
257
+ const tag = yield* Database.add(Tag.make({ label: 'important' }));
258
+ yield* AiConversationService.run({
259
+ prompt: `Add tag "important" to the organization "Tagged Corp".`,
260
+ });
261
+ const tags = Obj.getMeta(org).tags ?? [];
262
+ // TODO(dmaretskyi): matcher doesnt work with echo proxies.
263
+ expect([...tags]).toContain(Obj.getDXN(tag).toString());
264
+ },
265
+ provideTestLayers,
266
+ TestHelpers.provideTestContext,
267
+ ),
268
+ { timeout: 60_000 },
269
+ );
270
+
271
+ it.effect(
272
+ 'tag-remove: remove a tag from an object',
273
+ Effect.fnUntraced(
274
+ function* (_) {
275
+ yield* addDatabaseBlueprint();
276
+ const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Untagged Corp' }));
277
+ const tag = yield* Database.add(Tag.make({ label: 'obsolete' }));
278
+ const tagDxn = Obj.getDXN(tag).toString();
279
+ Entity.change(org, (obj) => Entity.addTag(obj, tagDxn));
280
+ expect(Obj.getMeta(org).tags ?? []).toContain(tagDxn);
281
+ yield* AiConversationService.run({
282
+ prompt: `Remove tag "obsolete" from the organization "Untagged Corp".`,
283
+ });
284
+ const tags = Obj.getMeta(org).tags ?? [];
285
+ // TODO(dmaretskyi): matcher doesnt work with echo proxies.
286
+ expect([...tags]).not.toContain(tagDxn);
287
+ },
288
+ provideTestLayers,
289
+ TestHelpers.provideTestContext,
290
+ ),
291
+ { timeout: 60_000 },
292
+ );
293
+
294
+ //
295
+ // Context
296
+ //
297
+
298
+ it.effect(
299
+ 'context-add: add object to chat context',
300
+ Effect.fnUntraced(
301
+ function* (_) {
302
+ yield* addDatabaseBlueprint();
303
+ const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Context Corp' }));
304
+ yield* AiConversationService.run({
305
+ prompt: `Add the organization "Context Corp" to the chat context.`,
306
+ });
307
+ const conversation = yield* AiConversationService;
308
+ const objects = conversation.context.getObjects();
309
+ expect(objects.length).toBeGreaterThanOrEqual(1);
310
+ },
311
+ provideTestLayers,
312
+ TestHelpers.provideTestContext,
313
+ ),
314
+ { timeout: 60_000 },
315
+ );
316
+
317
+ it.effect(
318
+ 'context-remove: remove object from chat context',
319
+ Effect.fnUntraced(
320
+ function* (_) {
321
+ yield* addDatabaseBlueprint();
322
+ const org = yield* Database.add(Obj.make(Organization.Organization, { name: 'Remove Context Corp' }));
323
+ const { db } = yield* Database.Service;
324
+ const ref = db.makeRef(Obj.getDXN(org)) as Ref.Ref<any>;
325
+ const { binder } = yield* AiContextService;
326
+ yield* Effect.promise(() => binder.bind({ blueprints: [], objects: [ref] }));
327
+ const dxn = Obj.getDXN(org).toString();
328
+ yield* AiConversationService.run({
329
+ prompt: `Remove the organization "Remove Context Corp" from the chat context.`,
330
+ });
331
+ const conversation = yield* AiConversationService;
332
+ const objects = conversation.context.getObjects();
333
+ const found = objects.find((obj) => Obj.getDXN(obj).toString() === dxn);
334
+ expect(found).toBeUndefined();
335
+ },
336
+ provideTestLayers,
337
+ TestHelpers.provideTestContext,
338
+ ),
339
+ { timeout: 60_000 },
340
+ );
341
+ });
@@ -0,0 +1,39 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type AppCapabilities } from '@dxos/app-toolkit';
6
+ import { Blueprint } from '@dxos/blueprints';
7
+ import { Ref } from '@dxos/echo';
8
+ import { Text } from '@dxos/schema';
9
+ import { trim } from '@dxos/util';
10
+
11
+ import { DatabaseFunctions } from './functions';
12
+
13
+ const BLUEPRINT_KEY = 'org.dxos.blueprint.database';
14
+
15
+ const instructions = trim`
16
+ You can query, create, update, and delete objects in ECHO.
17
+ You can manage schemas, relations, tags, and add objects to the chat context.
18
+ `;
19
+
20
+ const functions = Object.values(DatabaseFunctions);
21
+
22
+ const make = () =>
23
+ Blueprint.make({
24
+ key: BLUEPRINT_KEY,
25
+ name: 'Database',
26
+ description: 'Query and manipulate objects in the ECHO database.',
27
+ instructions: {
28
+ source: Ref.make(Text.make(instructions)),
29
+ },
30
+ tools: Blueprint.toolDefinitions({ functions }),
31
+ });
32
+
33
+ const blueprint: AppCapabilities.BlueprintDefinition = {
34
+ key: BLUEPRINT_KEY,
35
+ functions,
36
+ make,
37
+ };
38
+
39
+ export default blueprint;
@@ -0,0 +1,35 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Schema from 'effect/Schema';
7
+
8
+ import { AiContextService } from '@dxos/assistant';
9
+ import { Obj, Ref } from '@dxos/echo';
10
+ import { defineFunction } from '@dxos/functions';
11
+ import { trim } from '@dxos/util';
12
+
13
+ export default defineFunction({
14
+ key: 'org.dxos.function.database.context-add',
15
+ name: 'Add to context',
16
+ description: trim`
17
+ Adds the object to the chat context.
18
+ Use this it for objects that are useful long-term for the conversation.
19
+ `,
20
+ inputSchema: Schema.Struct({
21
+ obj: Ref.Ref(Obj.Unknown).annotations({
22
+ description: 'Object to add to the chat context.',
23
+ }),
24
+ }),
25
+ outputSchema: Schema.Void,
26
+ handler: Effect.fn(function* ({ data: { obj } }) {
27
+ const { binder } = yield* AiContextService;
28
+ yield* Effect.promise(() =>
29
+ binder.bind({
30
+ blueprints: [],
31
+ objects: [obj],
32
+ }),
33
+ );
34
+ }, AiContextService.fixFunctionHandlerType),
35
+ });
@@ -0,0 +1,35 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Schema from 'effect/Schema';
7
+
8
+ import { AiContextService } from '@dxos/assistant';
9
+ import { Obj, Ref } from '@dxos/echo';
10
+ import { defineFunction } from '@dxos/functions';
11
+ import { trim } from '@dxos/util';
12
+
13
+ export default defineFunction({
14
+ key: 'org.dxos.function.database.context-remove',
15
+ name: 'Remove from context',
16
+ description: trim`
17
+ Removes the object from the chat context.
18
+ Use this it for objects that are no longer useful for the conversation.
19
+ `,
20
+ inputSchema: Schema.Struct({
21
+ obj: Ref.Ref(Obj.Unknown).annotations({
22
+ description: 'Object to remove from the chat context.',
23
+ }),
24
+ }),
25
+ outputSchema: Schema.Void,
26
+ handler: Effect.fn(function* ({ data: { obj } }) {
27
+ const { binder } = yield* AiContextService;
28
+ yield* Effect.promise(() =>
29
+ binder.unbind({
30
+ blueprints: [],
31
+ objects: [obj],
32
+ }),
33
+ );
34
+ }, AiContextService.fixFunctionHandlerType),
35
+ });
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { default as ContextAdd } from './context-add';
6
+ import { default as ContextRemove } from './context-remove';
7
+ import { default as Load } from './load';
8
+ import { default as ObjectCreate } from './object-create';
9
+ import { default as ObjectDelete } from './object-delete';
10
+ import { default as ObjectUpdate } from './object-update';
11
+ import { default as Query } from './query';
12
+ import { default as RelationCreate } from './relation-create';
13
+ import { default as RelationDelete } from './relation-delete';
14
+ import { default as SchemaAdd } from './schema-add';
15
+ import { default as SchemaList } from './schema-list';
16
+ import { default as TagAdd } from './tag-add';
17
+ import { default as TagRemove } from './tag-remove';
18
+
19
+ export const DatabaseFunctions = {
20
+ ContextAdd,
21
+ ContextRemove,
22
+ Load,
23
+ ObjectCreate,
24
+ ObjectDelete,
25
+ ObjectUpdate,
26
+ Query,
27
+ RelationCreate,
28
+ RelationDelete,
29
+ SchemaAdd,
30
+ SchemaList,
31
+ TagAdd,
32
+ TagRemove,
33
+ };
@@ -0,0 +1,31 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Array from 'effect/Array';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Schema from 'effect/Schema';
8
+
9
+ import { Database, Entity, Obj, Ref } from '@dxos/echo';
10
+ import { defineFunction } from '@dxos/functions';
11
+ import { trim } from '@dxos/util';
12
+
13
+ export default defineFunction({
14
+ key: 'org.dxos.function.database.load',
15
+ name: 'Load object',
16
+ description: trim`
17
+ Loads the object or relation content.
18
+ Can load multiple objects at at time.
19
+ Use the to read the data when you have a DXN.
20
+ Call this tool with an array of one or more DXNs or object IDs.
21
+ When use see a reference ({ '/': 'dxn:...' }), you can call this function to load the object.
22
+ Note that returned data is only a snapshot in time, and might have changed since the object was last loaded.
23
+ `,
24
+ inputSchema: Schema.Struct({
25
+ refs: Schema.Array(Ref.Ref(Obj.Unknown)),
26
+ }),
27
+ outputSchema: Schema.Unknown,
28
+ handler: Effect.fn(function* ({ data: { refs } }) {
29
+ return yield* Effect.forEach(refs, Database.load).pipe(Effect.map(Array.map(Entity.toJSON)));
30
+ }),
31
+ });
@@ -0,0 +1,48 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Schema from 'effect/Schema';
7
+
8
+ import { Database, Entity, Obj, Type } from '@dxos/echo';
9
+ import { defineFunction } from '@dxos/functions';
10
+ import { invariant } from '@dxos/invariant';
11
+ import { deepMapValues, trim } from '@dxos/util';
12
+ import { EncodedReference } from '@dxos/echo-protocol';
13
+
14
+ export default defineFunction({
15
+ key: 'org.dxos.function.database.object-create',
16
+ name: 'Create object',
17
+ description: trim`
18
+ Creates a new object and adds it to the current space.
19
+ Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.
20
+ References are provided in the following format: { "/": "dxn:..." }.
21
+ Reference examples: { "/": "dxn:echo:@:01KG7R1ZXWFMWQ4DA1Q6TN1DG4" }, { "/": "dxn:queue:data:01KG7R1ZXWFMWQ4DA1Q6TN1DG4:01KG7R1ZXWFMWQ4DA1Q6TN1DG4" }
22
+ `,
23
+ inputSchema: Schema.Struct({
24
+ typename: Schema.String,
25
+ data: Schema.Any,
26
+ }),
27
+ outputSchema: Schema.Unknown,
28
+ handler: Effect.fn(function* ({ data: { typename, data } }) {
29
+ const { db } = yield* Database.Service;
30
+ const schema = yield* Effect.promise(() =>
31
+ db.schemaRegistry.query({ typename, location: ['database', 'runtime'] }).first(),
32
+ );
33
+ invariant(Type.isObjectSchema(schema), 'Schema is not an object schema');
34
+
35
+ const object = db.add(
36
+ Obj.make(
37
+ schema,
38
+ deepMapValues(data, (value, recurse) => {
39
+ if (EncodedReference.isEncodedReference(value)) {
40
+ return db.makeRef(EncodedReference.toDXN(value));
41
+ }
42
+ return recurse(value);
43
+ }),
44
+ ),
45
+ );
46
+ return Entity.toJSON(object);
47
+ }),
48
+ });
@@ -0,0 +1,27 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Schema from 'effect/Schema';
7
+
8
+ import { Database, Obj, Ref } from '@dxos/echo';
9
+ import { defineFunction } from '@dxos/functions';
10
+ import { trim } from '@dxos/util';
11
+
12
+ export default defineFunction({
13
+ key: 'org.dxos.function.database.object-delete',
14
+ name: 'Delete object',
15
+ description: trim`
16
+ Deletes the object.
17
+ `,
18
+ inputSchema: Schema.Struct({
19
+ obj: Ref.Ref(Obj.Unknown),
20
+ }),
21
+ outputSchema: Schema.Void,
22
+ handler: Effect.fn(function* ({ data: { obj } }) {
23
+ const { db } = yield* Database.Service;
24
+ const object = yield* Database.load(obj);
25
+ db.remove(object);
26
+ }),
27
+ });
@@ -0,0 +1,40 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Schema from 'effect/Schema';
7
+
8
+ import { Database, Entity, Obj, Ref } from '@dxos/echo';
9
+ import { defineFunction } from '@dxos/functions';
10
+ import { trim } from '@dxos/util';
11
+ import { EncodedReference } from '@dxos/echo-protocol';
12
+
13
+ export default defineFunction({
14
+ key: 'org.dxos.function.database.object-update',
15
+ name: 'Update object',
16
+ description: trim`
17
+ Updates the object properties.
18
+ References are provided in the following format: { "/": "dxn:..." }.
19
+ Reference examples: { "/": "dxn:echo:@:01KG7R1ZXWFMWQ4DA1Q6TN1DG4" }, { "/": "dxn:queue:data:01KG7R1ZXWFMWQ4DA1Q6TN1DG4:01KG7R1ZXWFMWQ4DA1Q6TN1DG4" }
20
+ `,
21
+ inputSchema: Schema.Struct({
22
+ obj: Ref.Ref(Obj.Unknown),
23
+ properties: Schema.Record({ key: Schema.String, value: Schema.Any }),
24
+ }),
25
+ outputSchema: Schema.Unknown,
26
+ handler: Effect.fn(function* ({ data: { obj, properties } }) {
27
+ const { db } = yield* Database.Service;
28
+ const object = yield* Database.load(obj);
29
+ Entity.change(object as Entity.Any, (obj) => {
30
+ for (const [key, value] of Object.entries(properties)) {
31
+ if (EncodedReference.isEncodedReference(value)) {
32
+ obj[key] = db.makeRef(EncodedReference.toDXN(value));
33
+ } else {
34
+ obj[key] = value;
35
+ }
36
+ }
37
+ });
38
+ return Entity.toJSON(object);
39
+ }),
40
+ });