@dxos/assistant-toolkit 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (422) hide show
  1. package/dist/lib/{browser → neutral}/index.mjs +3396 -2492
  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/browser/blueprint.d.ts +4 -0
  7. package/dist/types/src/blueprints/browser/blueprint.d.ts.map +1 -0
  8. package/dist/types/src/blueprints/browser/blueprint.test.d.ts +2 -0
  9. package/dist/types/src/blueprints/browser/blueprint.test.d.ts.map +1 -0
  10. package/dist/types/src/blueprints/browser/index.d.ts +2 -0
  11. package/dist/types/src/blueprints/browser/index.d.ts.map +1 -0
  12. package/dist/types/src/blueprints/database/blueprint.d.ts +4 -0
  13. package/dist/types/src/blueprints/database/blueprint.d.ts.map +1 -0
  14. package/dist/types/src/blueprints/database/blueprint.test.d.ts +2 -0
  15. package/dist/types/src/blueprints/database/blueprint.test.d.ts.map +1 -0
  16. package/dist/types/src/blueprints/database/functions/context-add.d.ts +6 -0
  17. package/dist/types/src/blueprints/database/functions/context-add.d.ts.map +1 -0
  18. package/dist/types/src/blueprints/database/functions/context-remove.d.ts +6 -0
  19. package/dist/types/src/blueprints/database/functions/context-remove.d.ts.map +1 -0
  20. package/dist/types/src/blueprints/database/functions/index.d.ts +57 -0
  21. package/dist/types/src/blueprints/database/functions/index.d.ts.map +1 -0
  22. package/dist/types/src/blueprints/database/functions/load.d.ts +6 -0
  23. package/dist/types/src/blueprints/database/functions/load.d.ts.map +1 -0
  24. package/dist/types/src/blueprints/database/functions/object-create.d.ts +6 -0
  25. package/dist/types/src/blueprints/database/functions/object-create.d.ts.map +1 -0
  26. package/dist/types/src/blueprints/database/functions/object-delete.d.ts +6 -0
  27. package/dist/types/src/blueprints/database/functions/object-delete.d.ts.map +1 -0
  28. package/dist/types/src/blueprints/database/functions/object-update.d.ts +9 -0
  29. package/dist/types/src/blueprints/database/functions/object-update.d.ts.map +1 -0
  30. package/dist/types/src/blueprints/database/functions/query.d.ts +9 -0
  31. package/dist/types/src/blueprints/database/functions/query.d.ts.map +1 -0
  32. package/dist/types/src/blueprints/database/functions/relation-create.d.ts +9 -0
  33. package/dist/types/src/blueprints/database/functions/relation-create.d.ts.map +1 -0
  34. package/dist/types/src/blueprints/database/functions/relation-delete.d.ts +6 -0
  35. package/dist/types/src/blueprints/database/functions/relation-delete.d.ts.map +1 -0
  36. package/dist/types/src/{initiative/functions/update.d.ts → blueprints/database/functions/schema-add.d.ts} +3 -3
  37. package/dist/types/src/blueprints/database/functions/schema-add.d.ts.map +1 -0
  38. package/dist/types/src/blueprints/database/functions/schema-list.d.ts +5 -0
  39. package/dist/types/src/blueprints/database/functions/schema-list.d.ts.map +1 -0
  40. package/dist/types/src/blueprints/database/functions/tag-add.d.ts +7 -0
  41. package/dist/types/src/blueprints/database/functions/tag-add.d.ts.map +1 -0
  42. package/dist/types/src/blueprints/database/functions/tag-remove.d.ts +7 -0
  43. package/dist/types/src/blueprints/database/functions/tag-remove.d.ts.map +1 -0
  44. package/dist/types/src/blueprints/database/index.d.ts +3 -0
  45. package/dist/types/src/blueprints/database/index.d.ts.map +1 -0
  46. package/dist/types/src/blueprints/design/blueprint.d.ts +4 -0
  47. package/dist/types/src/blueprints/design/blueprint.d.ts.map +1 -0
  48. package/dist/types/src/blueprints/design/blueprint.test.d.ts +2 -0
  49. package/dist/types/src/blueprints/design/blueprint.test.d.ts.map +1 -0
  50. package/dist/types/src/blueprints/design/index.d.ts +1 -2
  51. package/dist/types/src/blueprints/design/index.d.ts.map +1 -1
  52. package/dist/types/src/blueprints/discord/blueprint.d.ts +4 -0
  53. package/dist/types/src/blueprints/discord/blueprint.d.ts.map +1 -0
  54. package/dist/types/src/blueprints/discord/functions/fetch-messages.d.ts.map +1 -0
  55. package/dist/types/src/blueprints/discord/functions/fetch-messages.test.d.ts.map +1 -0
  56. package/dist/types/src/{functions/discord → blueprints/discord/functions}/index.d.ts +3 -3
  57. package/dist/types/src/blueprints/discord/functions/index.d.ts.map +1 -0
  58. package/dist/types/src/blueprints/discord/index.d.ts +1 -2
  59. package/dist/types/src/blueprints/discord/index.d.ts.map +1 -1
  60. package/dist/types/src/blueprints/github/functions/fetch-prs.d.ts.map +1 -0
  61. package/dist/types/src/blueprints/github/functions/index.d.ts +7 -0
  62. package/dist/types/src/blueprints/github/functions/index.d.ts.map +1 -0
  63. package/dist/types/src/blueprints/github/index.d.ts.map +1 -0
  64. package/dist/types/src/blueprints/index.d.ts +11 -6
  65. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  66. package/dist/types/src/blueprints/linear/blueprint.d.ts +4 -0
  67. package/dist/types/src/blueprints/linear/blueprint.d.ts.map +1 -0
  68. package/dist/types/src/{functions/linear → blueprints/linear/functions}/index.d.ts +3 -3
  69. package/dist/types/src/blueprints/linear/functions/index.d.ts.map +1 -0
  70. package/dist/types/src/blueprints/linear/functions/linear.test.d.ts.map +1 -0
  71. package/dist/types/src/blueprints/linear/functions/sync-issues.d.ts.map +1 -0
  72. package/dist/types/src/blueprints/linear/index.d.ts +1 -2
  73. package/dist/types/src/blueprints/linear/index.d.ts.map +1 -1
  74. package/dist/types/src/blueprints/markdown/blueprint.d.ts +4 -0
  75. package/dist/types/src/blueprints/markdown/blueprint.d.ts.map +1 -0
  76. package/dist/types/src/{functions/document/update.d.ts → blueprints/markdown/functions/create.d.ts} +2 -2
  77. package/dist/types/src/blueprints/markdown/functions/create.d.ts.map +1 -0
  78. package/dist/types/src/blueprints/markdown/functions/index.d.ts +30 -0
  79. package/dist/types/src/blueprints/markdown/functions/index.d.ts.map +1 -0
  80. package/dist/types/src/blueprints/markdown/functions/read.d.ts +14 -0
  81. package/dist/types/src/blueprints/markdown/functions/read.d.ts.map +1 -0
  82. package/dist/types/src/blueprints/markdown/functions/update.d.ts +13 -0
  83. package/dist/types/src/blueprints/markdown/functions/update.d.ts.map +1 -0
  84. package/dist/types/src/blueprints/markdown/index.d.ts +3 -0
  85. package/dist/types/src/blueprints/markdown/index.d.ts.map +1 -0
  86. package/dist/types/src/blueprints/memory/blueprint.d.ts +4 -0
  87. package/dist/types/src/blueprints/memory/blueprint.d.ts.map +1 -0
  88. package/dist/types/src/blueprints/memory/blueprint.test.d.ts +2 -0
  89. package/dist/types/src/blueprints/memory/blueprint.test.d.ts.map +1 -0
  90. package/dist/types/src/blueprints/memory/functions/delete.d.ts +8 -0
  91. package/dist/types/src/blueprints/memory/functions/delete.d.ts.map +1 -0
  92. package/dist/types/src/blueprints/memory/functions/index.d.ts +17 -0
  93. package/dist/types/src/blueprints/memory/functions/index.d.ts.map +1 -0
  94. package/dist/types/src/blueprints/memory/functions/query.d.ts +6 -0
  95. package/dist/types/src/blueprints/memory/functions/query.d.ts.map +1 -0
  96. package/dist/types/src/{functions/document/read.d.ts → blueprints/memory/functions/save.d.ts} +3 -4
  97. package/dist/types/src/blueprints/memory/functions/save.d.ts.map +1 -0
  98. package/dist/types/src/blueprints/memory/index.d.ts +3 -0
  99. package/dist/types/src/blueprints/memory/index.d.ts.map +1 -0
  100. package/dist/types/src/blueprints/planning/blueprint.d.ts +4 -0
  101. package/dist/types/src/blueprints/planning/blueprint.d.ts.map +1 -0
  102. package/dist/types/src/blueprints/planning/functions/index.d.ts +10 -0
  103. package/dist/types/src/blueprints/planning/functions/index.d.ts.map +1 -0
  104. package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts +9 -0
  105. package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts.map +1 -0
  106. package/dist/types/src/blueprints/planning/index.d.ts +1 -2
  107. package/dist/types/src/blueprints/planning/index.d.ts.map +1 -1
  108. package/dist/types/src/blueprints/planning-old/blueprint.d.ts +4 -0
  109. package/dist/types/src/blueprints/planning-old/blueprint.d.ts.map +1 -0
  110. package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts +2 -0
  111. package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts.map +1 -0
  112. package/dist/types/src/blueprints/planning-old/functions/index.d.ts +29 -0
  113. package/dist/types/src/blueprints/planning-old/functions/index.d.ts.map +1 -0
  114. package/dist/types/src/blueprints/planning-old/functions/read.d.ts +14 -0
  115. package/dist/types/src/blueprints/planning-old/functions/read.d.ts.map +1 -0
  116. package/dist/types/src/blueprints/planning-old/functions/task-list.d.ts.map +1 -0
  117. package/dist/types/src/blueprints/planning-old/functions/task-list.test.d.ts.map +1 -0
  118. package/dist/types/src/blueprints/planning-old/functions/update.d.ts +16 -0
  119. package/dist/types/src/blueprints/planning-old/functions/update.d.ts.map +1 -0
  120. package/dist/types/src/blueprints/planning-old/index.d.ts +2 -0
  121. package/dist/types/src/blueprints/planning-old/index.d.ts.map +1 -0
  122. package/dist/types/src/blueprints/project/blueprint.d.ts +4 -0
  123. package/dist/types/src/blueprints/project/blueprint.d.ts.map +1 -0
  124. package/dist/types/src/blueprints/project/blueprint.test.d.ts +2 -0
  125. package/dist/types/src/blueprints/project/blueprint.test.d.ts.map +1 -0
  126. package/dist/types/src/blueprints/project/functions/add-artifact.d.ts +7 -0
  127. package/dist/types/src/blueprints/project/functions/add-artifact.d.ts.map +1 -0
  128. package/dist/types/src/blueprints/project/functions/agent.d.ts +62 -0
  129. package/dist/types/src/blueprints/project/functions/agent.d.ts.map +1 -0
  130. package/dist/types/src/blueprints/project/functions/get-context.d.ts +13 -0
  131. package/dist/types/src/blueprints/project/functions/get-context.d.ts.map +1 -0
  132. package/dist/types/src/blueprints/project/functions/index.d.ts +133 -0
  133. package/dist/types/src/blueprints/project/functions/index.d.ts.map +1 -0
  134. package/dist/types/src/blueprints/project/functions/qualifier.d.ts +60 -0
  135. package/dist/types/src/blueprints/project/functions/qualifier.d.ts.map +1 -0
  136. package/dist/types/src/blueprints/project/index.d.ts +3 -0
  137. package/dist/types/src/blueprints/project/index.d.ts.map +1 -0
  138. package/dist/types/src/blueprints/research/blueprint.d.ts +4 -0
  139. package/dist/types/src/blueprints/research/blueprint.d.ts.map +1 -0
  140. package/dist/types/src/blueprints/research/blueprint.test.d.ts +2 -0
  141. package/dist/types/src/blueprints/research/blueprint.test.d.ts.map +1 -0
  142. package/dist/types/src/{functions/research → blueprints/research/functions}/document-create.d.ts +2 -1
  143. package/dist/types/src/blueprints/research/functions/document-create.d.ts.map +1 -0
  144. package/dist/types/src/{functions/research → blueprints/research/functions}/index.d.ts +6 -8
  145. package/dist/types/src/blueprints/research/functions/index.d.ts.map +1 -0
  146. package/dist/types/src/{functions/research → blueprints/research/functions}/research.d.ts +1 -1
  147. package/dist/types/src/blueprints/research/functions/research.d.ts.map +1 -0
  148. package/dist/types/src/blueprints/research/functions/research.test.d.ts.map +1 -0
  149. package/dist/types/src/blueprints/research/index.d.ts +2 -2
  150. package/dist/types/src/blueprints/research/index.d.ts.map +1 -1
  151. package/dist/types/src/{functions/research/research-graph.d.ts → blueprints/research/types/ResearchGraph.d.ts} +5 -6
  152. package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts.map +1 -0
  153. package/dist/types/src/blueprints/research/types/index.d.ts +7 -0
  154. package/dist/types/src/blueprints/research/types/index.d.ts.map +1 -0
  155. package/dist/types/src/blueprints/testing.d.ts +17 -3
  156. package/dist/types/src/blueprints/testing.d.ts.map +1 -1
  157. package/dist/types/src/blueprints/websearch/blueprint.d.ts +4 -0
  158. package/dist/types/src/blueprints/websearch/blueprint.d.ts.map +1 -0
  159. package/dist/types/src/blueprints/websearch/index.d.ts +2 -3
  160. package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -1
  161. package/dist/types/src/blueprints/websearch/{websearch-toolkit.d.ts → toolkit.d.ts} +1 -1
  162. package/dist/types/src/blueprints/websearch/toolkit.d.ts.map +1 -0
  163. package/dist/types/src/crud/graph.d.ts +6 -6
  164. package/dist/types/src/crud/graph.d.ts.map +1 -1
  165. package/dist/types/src/functions/agent/index.d.ts +84 -4
  166. package/dist/types/src/functions/agent/index.d.ts.map +1 -1
  167. package/dist/types/src/functions/agent/prompt.d.ts +9 -1
  168. package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
  169. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +8 -3
  170. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
  171. package/dist/types/src/functions/entity-extraction/index.d.ts +10 -6
  172. package/dist/types/src/functions/entity-extraction/index.d.ts.map +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/index.d.ts +1 -5
  176. package/dist/types/src/functions/index.d.ts.map +1 -1
  177. package/dist/types/src/index.d.ts +2 -1
  178. package/dist/types/src/index.d.ts.map +1 -1
  179. package/dist/types/src/testing/index.d.ts +1 -0
  180. package/dist/types/src/testing/index.d.ts.map +1 -1
  181. package/dist/types/src/testing/plugins.d.ts.map +1 -1
  182. package/dist/types/src/toolkits/WebToolkit.d.ts +38 -0
  183. package/dist/types/src/toolkits/WebToolkit.d.ts.map +1 -0
  184. package/dist/types/src/toolkits/index.d.ts +1 -2
  185. package/dist/types/src/toolkits/index.d.ts.map +1 -1
  186. package/dist/types/src/types/Chat.d.ts +31 -0
  187. package/dist/types/src/types/Chat.d.ts.map +1 -0
  188. package/dist/types/src/types/Memory.d.ts +12 -0
  189. package/dist/types/src/types/Memory.d.ts.map +1 -0
  190. package/dist/types/src/types/Plan.d.ts +77 -0
  191. package/dist/types/src/types/Plan.d.ts.map +1 -0
  192. package/dist/types/src/types/Project.d.ts +67 -0
  193. package/dist/types/src/types/Project.d.ts.map +1 -0
  194. package/dist/types/src/types/index.d.ts +5 -0
  195. package/dist/types/src/types/index.d.ts.map +1 -0
  196. package/dist/types/tsconfig.tsbuildinfo +1 -1
  197. package/package.json +38 -43
  198. package/src/blueprints/browser/blueprint.conversations.json +1 -0
  199. package/src/blueprints/browser/blueprint.test.ts +70 -0
  200. package/src/blueprints/browser/blueprint.ts +41 -0
  201. package/src/blueprints/browser/index.ts +5 -0
  202. package/src/blueprints/database/blueprint.conversations.json +1 -0
  203. package/src/blueprints/database/blueprint.test.ts +321 -0
  204. package/src/blueprints/database/blueprint.ts +39 -0
  205. package/src/blueprints/database/functions/context-add.ts +35 -0
  206. package/src/blueprints/database/functions/context-remove.ts +35 -0
  207. package/src/blueprints/database/functions/index.ts +33 -0
  208. package/src/blueprints/database/functions/load.ts +31 -0
  209. package/src/blueprints/database/functions/object-create.ts +35 -0
  210. package/src/blueprints/database/functions/object-delete.ts +27 -0
  211. package/src/blueprints/database/functions/object-update.ts +32 -0
  212. package/src/blueprints/database/functions/query.ts +126 -0
  213. package/src/blueprints/database/functions/relation-create.ts +47 -0
  214. package/src/blueprints/database/functions/relation-delete.ts +28 -0
  215. package/src/blueprints/database/functions/schema-add.ts +40 -0
  216. package/src/blueprints/database/functions/schema-list.ts +34 -0
  217. package/src/blueprints/database/functions/tag-add.ts +31 -0
  218. package/src/blueprints/database/functions/tag-remove.ts +30 -0
  219. package/src/blueprints/database/index.ts +6 -0
  220. package/src/blueprints/design/{design-blueprint.test.ts → blueprint.test.ts} +12 -21
  221. package/src/blueprints/design/{design-blueprint.ts → blueprint.ts} +25 -10
  222. package/src/blueprints/design/index.ts +1 -3
  223. package/src/blueprints/discord/blueprint.ts +46 -0
  224. package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.ts +4 -7
  225. package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.ts +1 -1
  226. package/src/blueprints/discord/functions/index.ts +9 -0
  227. package/src/blueprints/discord/index.ts +1 -3
  228. package/src/{functions/github → blueprints/github/functions}/fetch-prs.ts +1 -1
  229. package/src/blueprints/github/functions/index.ts +9 -0
  230. package/src/blueprints/index.ts +11 -6
  231. package/src/blueprints/linear/blueprint.ts +47 -0
  232. package/src/blueprints/linear/functions/index.ts +9 -0
  233. package/src/blueprints/linear/functions/linear.test.ts +58 -0
  234. package/src/{functions/linear → blueprints/linear/functions}/sync-issues.ts +7 -7
  235. package/src/blueprints/linear/index.ts +1 -3
  236. package/src/blueprints/markdown/blueprint.ts +38 -0
  237. package/src/blueprints/markdown/functions/create.ts +29 -0
  238. package/src/blueprints/markdown/functions/index.ts +13 -0
  239. package/src/blueprints/markdown/functions/read.ts +32 -0
  240. package/src/{functions/document → blueprints/markdown/functions}/update.ts +6 -7
  241. package/src/blueprints/markdown/index.ts +6 -0
  242. package/src/blueprints/memory/blueprint.conversations.json +1 -0
  243. package/src/blueprints/memory/blueprint.test.ts +135 -0
  244. package/src/blueprints/memory/blueprint.ts +44 -0
  245. package/src/blueprints/memory/functions/delete.ts +25 -0
  246. package/src/blueprints/memory/functions/index.ts +13 -0
  247. package/src/blueprints/memory/functions/query.ts +49 -0
  248. package/src/blueprints/memory/functions/save.ts +32 -0
  249. package/src/blueprints/memory/index.ts +6 -0
  250. package/src/blueprints/planning/blueprint.ts +28 -0
  251. package/src/blueprints/planning/functions/index.ts +9 -0
  252. package/src/blueprints/planning/functions/update-tasks.ts +168 -0
  253. package/src/blueprints/planning/index.ts +2 -4
  254. package/src/blueprints/{planning/planning-blueprint.test.ts → planning-old/blueprint.test.ts} +12 -16
  255. package/src/blueprints/{planning/planning-blueprint.ts → planning-old/blueprint.ts} +24 -10
  256. package/src/blueprints/planning-old/functions/index.ts +11 -0
  257. package/src/{functions/tasks → blueprints/planning-old/functions}/read.ts +6 -7
  258. package/src/{functions/tasks → blueprints/planning-old/functions}/update.ts +6 -7
  259. package/src/blueprints/planning-old/index.ts +5 -0
  260. package/src/{initiative/initiative.test.ts → blueprints/project/blueprint.test.ts} +138 -44
  261. package/src/blueprints/project/blueprint.ts +68 -0
  262. package/src/blueprints/project/functions/add-artifact.ts +41 -0
  263. package/src/blueprints/project/functions/agent.ts +72 -0
  264. package/src/blueprints/project/functions/get-context.ts +63 -0
  265. package/src/blueprints/project/functions/index.ts +15 -0
  266. package/src/blueprints/project/functions/qualifier.ts +96 -0
  267. package/src/blueprints/project/index.ts +6 -0
  268. package/src/blueprints/research/{research-blueprint.ts → blueprint.ts} +25 -11
  269. package/src/{functions/research → blueprints/research/functions}/document-create.ts +9 -12
  270. package/src/blueprints/research/functions/index.ts +11 -0
  271. package/src/{functions/research → blueprints/research/functions}/research-instructions.tpl +5 -5
  272. package/src/blueprints/research/functions/research.conversations.json +1 -0
  273. package/src/{functions/research → blueprints/research/functions}/research.test.ts +33 -55
  274. package/src/{functions/research → blueprints/research/functions}/research.ts +14 -28
  275. package/src/blueprints/research/index.ts +2 -3
  276. package/src/blueprints/research/types/ResearchGraph.ts +49 -0
  277. package/src/{functions/research/types.ts → blueprints/research/types/index.ts} +12 -6
  278. package/src/blueprints/testing.ts +35 -4
  279. package/src/blueprints/websearch/blueprint.ts +32 -0
  280. package/src/blueprints/websearch/index.ts +2 -5
  281. package/src/crud/graph.test.ts +2 -2
  282. package/src/crud/graph.ts +9 -9
  283. package/src/functions/READ_THIS.md +5 -0
  284. package/src/functions/agent/index.ts +4 -6
  285. package/src/functions/agent/prompt.ts +16 -26
  286. package/src/functions/entity-extraction/entity-extraction.conversations.json +1 -6597
  287. package/src/functions/entity-extraction/entity-extraction.test.ts +11 -30
  288. package/src/functions/entity-extraction/entity-extraction.ts +13 -15
  289. package/src/functions/entity-extraction/index.ts +4 -4
  290. package/src/functions/exa/exa.ts +2 -2
  291. package/src/functions/exa/index.ts +7 -2
  292. package/src/functions/exa/mock.ts +1 -1
  293. package/src/functions/index.ts +1 -5
  294. package/src/index.ts +2 -1
  295. package/src/sync/sync.ts +2 -2
  296. package/src/testing/index.ts +1 -0
  297. package/src/testing/plugins.tsx +22 -18
  298. package/src/toolkits/WebToolkit.ts +33 -0
  299. package/src/toolkits/index.ts +1 -2
  300. package/src/types/Chat.ts +51 -0
  301. package/src/types/Memory.ts +23 -0
  302. package/src/types/Plan.ts +110 -0
  303. package/src/types/Project.ts +198 -0
  304. package/src/types/index.ts +8 -0
  305. package/dist/lib/browser/index.mjs.map +0 -7
  306. package/dist/lib/browser/meta.json +0 -1
  307. package/dist/lib/browser/testing/index.mjs +0 -43
  308. package/dist/lib/browser/testing/index.mjs.map +0 -7
  309. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  310. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  311. package/dist/lib/node-esm/index.mjs +0 -2881
  312. package/dist/lib/node-esm/index.mjs.map +0 -7
  313. package/dist/lib/node-esm/meta.json +0 -1
  314. package/dist/lib/node-esm/testing/index.mjs +0 -44
  315. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  316. package/dist/types/src/blueprints/design/design-blueprint.d.ts +0 -18
  317. package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +0 -1
  318. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts +0 -2
  319. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts.map +0 -1
  320. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +0 -18
  321. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +0 -1
  322. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +0 -18
  323. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +0 -1
  324. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +0 -18
  325. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +0 -1
  326. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts +0 -2
  327. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts.map +0 -1
  328. package/dist/types/src/blueprints/research/research-blueprint.d.ts +0 -18
  329. package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +0 -1
  330. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts +0 -2
  331. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts.map +0 -1
  332. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +0 -18
  333. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +0 -1
  334. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts.map +0 -1
  335. package/dist/types/src/experimental/feed.test.d.ts +0 -2
  336. package/dist/types/src/experimental/feed.test.d.ts.map +0 -1
  337. package/dist/types/src/functions/discord/fetch-messages.d.ts.map +0 -1
  338. package/dist/types/src/functions/discord/fetch-messages.test.d.ts.map +0 -1
  339. package/dist/types/src/functions/discord/index.d.ts.map +0 -1
  340. package/dist/types/src/functions/document/index.d.ts +0 -13
  341. package/dist/types/src/functions/document/index.d.ts.map +0 -1
  342. package/dist/types/src/functions/document/read.d.ts.map +0 -1
  343. package/dist/types/src/functions/document/update.d.ts.map +0 -1
  344. package/dist/types/src/functions/github/fetch-prs.d.ts.map +0 -1
  345. package/dist/types/src/functions/linear/index.d.ts.map +0 -1
  346. package/dist/types/src/functions/linear/linear.test.d.ts.map +0 -1
  347. package/dist/types/src/functions/linear/sync-issues.d.ts.map +0 -1
  348. package/dist/types/src/functions/research/document-create.d.ts.map +0 -1
  349. package/dist/types/src/functions/research/index.d.ts.map +0 -1
  350. package/dist/types/src/functions/research/research-graph.d.ts.map +0 -1
  351. package/dist/types/src/functions/research/research.d.ts.map +0 -1
  352. package/dist/types/src/functions/research/research.test.d.ts.map +0 -1
  353. package/dist/types/src/functions/research/types.d.ts +0 -6
  354. package/dist/types/src/functions/research/types.d.ts.map +0 -1
  355. package/dist/types/src/functions/tasks/index.d.ts +0 -15
  356. package/dist/types/src/functions/tasks/index.d.ts.map +0 -1
  357. package/dist/types/src/functions/tasks/read.d.ts +0 -7
  358. package/dist/types/src/functions/tasks/read.d.ts.map +0 -1
  359. package/dist/types/src/functions/tasks/task-list.d.ts.map +0 -1
  360. package/dist/types/src/functions/tasks/task-list.test.d.ts.map +0 -1
  361. package/dist/types/src/functions/tasks/update.d.ts +0 -9
  362. package/dist/types/src/functions/tasks/update.d.ts.map +0 -1
  363. package/dist/types/src/initiative/Initiative.d.ts +0 -84
  364. package/dist/types/src/initiative/Initiative.d.ts.map +0 -1
  365. package/dist/types/src/initiative/InitiativeSchema.d.ts +0 -19
  366. package/dist/types/src/initiative/InitiativeSchema.d.ts.map +0 -1
  367. package/dist/types/src/initiative/functions/agent.d.ts +0 -37
  368. package/dist/types/src/initiative/functions/agent.d.ts.map +0 -1
  369. package/dist/types/src/initiative/functions/getContext.d.ts +0 -17
  370. package/dist/types/src/initiative/functions/getContext.d.ts.map +0 -1
  371. package/dist/types/src/initiative/functions/index.d.ts +0 -4
  372. package/dist/types/src/initiative/functions/index.d.ts.map +0 -1
  373. package/dist/types/src/initiative/functions/update.d.ts.map +0 -1
  374. package/dist/types/src/initiative/index.d.ts.map +0 -1
  375. package/dist/types/src/initiative/initiative.test.d.ts +0 -2
  376. package/dist/types/src/initiative/initiative.test.d.ts.map +0 -1
  377. package/dist/types/src/toolkits/AssistantToolkit.d.ts +0 -43
  378. package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +0 -1
  379. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts +0 -2
  380. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts.map +0 -1
  381. package/dist/types/src/toolkits/SystemToolkit.d.ts +0 -99
  382. package/dist/types/src/toolkits/SystemToolkit.d.ts.map +0 -1
  383. package/src/blueprints/discord/discord-blueprint.ts +0 -32
  384. package/src/blueprints/linear/linear-blueprint.ts +0 -33
  385. package/src/blueprints/websearch/websearch-blueprint.ts +0 -18
  386. package/src/experimental/feed.test.ts +0 -111
  387. package/src/functions/discord/index.ts +0 -9
  388. package/src/functions/document/index.ts +0 -12
  389. package/src/functions/document/read.ts +0 -30
  390. package/src/functions/linear/index.ts +0 -9
  391. package/src/functions/linear/linear.test.ts +0 -84
  392. package/src/functions/research/index.ts +0 -14
  393. package/src/functions/research/research-graph.ts +0 -49
  394. package/src/functions/research/research.conversations.json +0 -1
  395. package/src/functions/tasks/index.ts +0 -11
  396. package/src/initiative/Initiative.ts +0 -99
  397. package/src/initiative/InitiativeSchema.ts +0 -37
  398. package/src/initiative/functions/agent.ts +0 -57
  399. package/src/initiative/functions/getContext.ts +0 -74
  400. package/src/initiative/functions/index.ts +0 -7
  401. package/src/initiative/functions/update.ts +0 -63
  402. package/src/initiative/initiative.conversations.json +0 -1
  403. package/src/toolkits/AssistantToolkit.conversations.json +0 -1
  404. package/src/toolkits/AssistantToolkit.test.ts +0 -94
  405. package/src/toolkits/AssistantToolkit.ts +0 -70
  406. package/src/toolkits/SystemToolkit.ts +0 -299
  407. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
  408. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
  409. /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.d.ts +0 -0
  410. /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.d.ts +0 -0
  411. /package/dist/types/src/{functions/github → blueprints/github/functions}/fetch-prs.d.ts +0 -0
  412. /package/dist/types/src/{initiative → blueprints/github}/index.d.ts +0 -0
  413. /package/dist/types/src/{functions/linear → blueprints/linear/functions}/linear.test.d.ts +0 -0
  414. /package/dist/types/src/{functions/linear → blueprints/linear/functions}/sync-issues.d.ts +0 -0
  415. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.d.ts +0 -0
  416. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.d.ts +0 -0
  417. /package/dist/types/src/{functions/research → blueprints/research/functions}/research.test.d.ts +0 -0
  418. /package/src/{initiative → blueprints/github}/index.ts +0 -0
  419. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.ts +0 -0
  420. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.ts +0 -0
  421. /package/src/blueprints/research/{research-blueprint.test.ts → blueprint.test.ts} +0 -0
  422. /package/src/blueprints/websearch/{websearch-toolkit.ts → toolkit.ts} +0 -0
@@ -5,28 +5,27 @@
5
5
  import * as Effect from 'effect/Effect';
6
6
  import * as Schema from 'effect/Schema';
7
7
 
8
- import { ArtifactId } from '@dxos/assistant';
9
- import { Database } from '@dxos/echo';
8
+ import { Database, Ref } from '@dxos/echo';
10
9
  import { defineFunction } from '@dxos/functions';
11
10
  import { Markdown } from '@dxos/plugin-markdown/types';
12
11
 
13
12
  export default defineFunction({
14
- key: 'dxos.org/function/markdown/read-tasks',
13
+ key: 'org.dxos.function.markdown.read-tasks',
15
14
  name: 'Read',
16
15
  description: 'Read markdown tasks.',
17
16
  inputSchema: Schema.Struct({
18
- id: ArtifactId.annotations({
17
+ doc: Ref.Ref(Markdown.Document).annotations({
19
18
  description: 'The ID of the document to read.',
20
19
  }),
21
20
  }),
22
21
  outputSchema: Schema.Struct({
23
22
  content: Schema.String,
24
23
  }),
25
- handler: Effect.fn(function* ({ data: { id } }) {
26
- const doc = yield* Database.Service.resolve(ArtifactId.toDXN(id), Markdown.Document);
24
+ handler: Effect.fn(function* ({ data: { doc } }) {
25
+ const document = yield* Database.load(doc);
27
26
 
28
27
  // Return content with line numbers prefixed.
29
- const { content } = yield* Database.Service.load(doc.content);
28
+ const { content } = yield* Database.load(document.content);
30
29
  const lines = content.split('\n');
31
30
  const len = String(lines.length).length;
32
31
  const numbered = lines.map((line, i) => `${String(i + 1).padStart(len, ' ')}. ${line}`).join('\n');
@@ -5,19 +5,18 @@
5
5
  import * as Effect from 'effect/Effect';
6
6
  import * as Schema from 'effect/Schema';
7
7
 
8
- import { ArtifactId } from '@dxos/assistant';
9
- import { Database } from '@dxos/echo';
8
+ import { Database, Ref } from '@dxos/echo';
10
9
  import { defineFunction } from '@dxos/functions';
11
10
  import { Markdown } from '@dxos/plugin-markdown/types';
12
11
 
13
12
  import { MarkdownTasks, type TaskOperation } from './task-list';
14
13
 
15
14
  export default defineFunction({
16
- key: 'dxos.org/function/markdown/update-tasks',
15
+ key: 'org.dxos.function.markdown.update-tasks',
17
16
  name: 'Update markdown',
18
17
  description: 'Creates and updates tasks in markdown documents.',
19
18
  inputSchema: Schema.Struct({
20
- id: ArtifactId.annotations({
19
+ doc: Ref.Ref(Markdown.Document).annotations({
21
20
  description: 'The ID of the document to update.',
22
21
  }),
23
22
  operations: Schema.optional(
@@ -34,11 +33,11 @@ export default defineFunction({
34
33
  description: 'Content with line numbers for agent reference.',
35
34
  }),
36
35
  }),
37
- handler: Effect.fn(function* ({ data: { id, operations = [] } }) {
38
- const doc = yield* Database.Service.resolve(ArtifactId.toDXN(id), Markdown.Document);
36
+ handler: Effect.fn(function* ({ data: { doc, operations = [] } }) {
37
+ const document = yield* Database.load(doc);
39
38
 
40
39
  // Create task manager and apply operations if provided.
41
- const { content } = yield* Database.Service.load(doc.content);
40
+ const { content } = yield* Database.load(document.content);
42
41
  const taskManager = new MarkdownTasks(content);
43
42
  if (operations.length > 0) {
44
43
  taskManager.applyOperations(operations as TaskOperation[]);
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { default as PlanningOldBlueprint } from './blueprint';
@@ -2,56 +2,83 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { describe, it } from '@effect/vitest';
5
+ import { describe, expect, it } from '@effect/vitest';
6
6
  import * as Effect from 'effect/Effect';
7
+ import * as Exit from 'effect/Exit';
7
8
 
8
9
  import { MemoizedAiService } from '@dxos/ai/testing';
9
10
  import { AiConversation } from '@dxos/assistant';
10
11
  import { AssistantTestLayerWithTriggers } from '@dxos/assistant/testing';
11
12
  import { Blueprint } from '@dxos/blueprints';
13
+ import { SpaceProperties } from '@dxos/client-protocol';
12
14
  import { Database, Obj, Ref } from '@dxos/echo';
15
+ import { Collection } from '@dxos/echo';
13
16
  import { acquireReleaseResource } from '@dxos/effect';
14
17
  import { TestHelpers } from '@dxos/effect/testing';
15
18
  import { FunctionDefinition, QueueService, Trigger } from '@dxos/functions';
16
19
  import { TriggerDispatcher } from '@dxos/functions-runtime';
17
20
  import { invariant } from '@dxos/invariant';
18
21
  import { ObjectId } from '@dxos/keys';
22
+ import { MarkdownBlueprint } from '@dxos/plugin-markdown/blueprints';
23
+ import { WithProperties } from '@dxos/plugin-markdown/testing';
24
+ import { Markdown } from '@dxos/plugin-markdown/types';
19
25
  import { Text } from '@dxos/schema';
20
26
  import { Message } from '@dxos/types';
21
27
  import { trim } from '@dxos/util';
22
28
 
23
- import { agent } from './functions';
24
- import * as Initiative from './Initiative';
29
+ import { Chat, Plan, Project } from '../../types';
30
+ import { PlanningBlueprint } from '../planning';
31
+
32
+ import ProjectBlueprintDef from './blueprint';
33
+ import { ProjectFunctions } from './functions';
25
34
 
26
35
  ObjectId.dangerouslyDisableRandomness();
27
36
 
28
37
  const TestLayer = AssistantTestLayerWithTriggers({
29
38
  aiServicePreset: 'edge-remote',
30
- functions: [...Initiative.functions],
31
- types: [Initiative.Initiative, Blueprint.Blueprint, Trigger.Trigger, Text.Text],
39
+ functions: [...Object.values(ProjectFunctions), ...MarkdownBlueprint.functions],
40
+ types: [
41
+ Project.Project,
42
+ Plan.Plan,
43
+ Chat.CompanionTo,
44
+ Chat.Chat,
45
+ SpaceProperties,
46
+ Blueprint.Blueprint,
47
+ Trigger.Trigger,
48
+ Text.Text,
49
+ Markdown.Document,
50
+ Collection.Collection,
51
+ ],
32
52
  tracing: 'pretty',
33
53
  });
34
54
 
35
55
  const SYSTEM = trim`
36
- If you do not have tools to complete the task, inform the user. DO NOT PRETEND TO DO SOMETHING YOU CAN'T DO.
56
+ You are a helpful assistant that can help with tasks in the outside world.
57
+ Be transparent about what you are doing and what you are not doing.
58
+ If you do not have tools to complete the task, inform the user.
59
+ DO NOT PRETEND TO DO SOMETHING YOU CAN'T DO.
37
60
  `;
38
61
 
39
- describe('Initiative', () => {
62
+ describe.runIf(TestHelpers.tagEnabled('flaky'))('Project', () => {
63
+ const blueprint = ProjectBlueprintDef.make();
40
64
  it.scoped(
41
65
  'shopping list',
42
66
  Effect.fnUntraced(
43
67
  function* (_) {
44
- const initiative = yield* Database.Service.add(
45
- yield* Initiative.make({
46
- name: 'Shopping list',
47
- spec: 'Keep a shopping list of items to buy.',
48
- }),
49
- );
50
- invariant(initiative.chat?.target, 'Initiative chat queue not found.');
51
- yield* Database.Service.flush({ indexes: true });
52
- const conversation = yield* acquireReleaseResource(
53
- () => new AiConversation({ queue: initiative.chat?.target as any }),
68
+ const project = yield* Database.add(
69
+ yield* Project.makeInitialized(
70
+ {
71
+ name: 'Shopping list',
72
+ spec: 'Keep a shopping list of items to buy.',
73
+ blueprints: [Ref.make(MarkdownBlueprint.make())],
74
+ },
75
+ blueprint,
76
+ ),
54
77
  );
78
+ const chatQueue = project.chat?.target?.queue?.target as any;
79
+ invariant(chatQueue, 'Project chat queue not found.');
80
+ yield* Database.flush({ indexes: true });
81
+ const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue: chatQueue }));
55
82
  yield* Effect.promise(() => conversation.context.open());
56
83
 
57
84
  yield* conversation.createRequest({
@@ -59,7 +86,7 @@ describe('Initiative', () => {
59
86
  prompt: `List ingredients for a scrambled eggs on a toast breakfast.`,
60
87
  });
61
88
 
62
- console.log(yield* Effect.promise(() => dumpInitiative(initiative)));
89
+ console.log(yield* Effect.promise(() => dumpProject(project)));
63
90
  },
64
91
  Effect.provide(TestLayer),
65
92
  TestHelpers.provideTestContext,
@@ -71,35 +98,38 @@ describe('Initiative', () => {
71
98
  'expense tracking list',
72
99
  Effect.fnUntraced(
73
100
  function* (_) {
74
- const initiative = yield* Database.Service.add(
75
- yield* Initiative.make({
76
- name: 'Expense tracking',
77
- spec: trim`
78
- Keep a list of expenses in a markdown document (create artifact "Expenses").
79
- Process incoming emails, add the relevant ones to the list.
80
-
81
- Format:
82
-
83
- ## Expences
84
-
85
- - Flight to London (2026-02-01): £100
86
- - Hotel in London (2026-02-01): £100
87
- `,
88
- }),
101
+ const project = yield* Database.add(
102
+ yield* Project.makeInitialized(
103
+ {
104
+ name: 'Expense tracking',
105
+ spec: trim`
106
+ Keep a list of expenses in a markdown document (create artifact "Expenses").
107
+ Process incoming emails, add the relevant ones to the list.
108
+
109
+ Format:
110
+
111
+ ## Expenses
112
+ - Flight to London (2026-02-01): £100
113
+ - Hotel in London (2026-02-01): £100
114
+ `,
115
+ blueprints: [Ref.make(MarkdownBlueprint.make())],
116
+ },
117
+ blueprint,
118
+ ),
89
119
  );
90
- yield* Database.Service.flush({ indexes: true });
120
+ yield* Database.flush({ indexes: true });
91
121
 
92
122
  const inboxQueue = yield* QueueService.createQueue();
93
- yield* Database.Service.add(
123
+ yield* Database.add(
94
124
  Trigger.make({
95
125
  enabled: true,
96
126
  spec: {
97
127
  kind: 'queue',
98
128
  queue: inboxQueue.dxn.toString(),
99
129
  },
100
- function: Ref.make(FunctionDefinition.serialize(agent)),
130
+ function: Ref.make(FunctionDefinition.serialize(ProjectFunctions.Agent)),
101
131
  input: {
102
- initiative: Ref.make(initiative),
132
+ project: Ref.make(project),
103
133
  event: '{{event}}',
104
134
  },
105
135
  }),
@@ -111,10 +141,69 @@ describe('Initiative', () => {
111
141
  );
112
142
 
113
143
  const dispatcher = yield* TriggerDispatcher;
114
- yield* dispatcher.invokeScheduledTriggers({ kinds: ['queue'], untilExhausted: true });
144
+ const invocations = yield* dispatcher.invokeScheduledTriggers({ kinds: ['queue'], untilExhausted: true });
145
+ expect(invocations.every((invocation) => Exit.isSuccess(invocation.result))).toBe(true);
146
+
147
+ console.log(yield* Effect.promise(() => dumpProject(project)));
148
+ },
149
+ WithProperties,
150
+ Effect.provide(TestLayer),
151
+ TestHelpers.provideTestContext,
152
+ ),
153
+ MemoizedAiService.isGenerationEnabled() ? 240_000 : 30_000,
154
+ );
155
+
156
+ it.scoped(
157
+ 'planning',
158
+ Effect.fnUntraced(
159
+ function* (_) {
160
+ const project = yield* Database.add(
161
+ yield* Project.makeInitialized(
162
+ {
163
+ name: 'Egg making',
164
+ spec: trim`
165
+ I'm testing how planning (task management) works.
166
+ Create tasks to make scrambled eggs.
167
+
168
+ Then simulate this plan execution in a markdown document.
169
+ The document should reflect the state of all objects involved in the cooking process.
170
+ The document should also have the log of actions taken.
171
+
172
+ Important: simualte actions one by one, in the order they are listed.
173
+ Simlate by updating the local document.
174
+
175
+ <example>
176
+ # State
177
+
178
+ - 2 raw eggs
179
+ - 1 frying pan
180
+
181
+ # Action log
182
+
183
+ - Taken 2 raw eggs out of the fridge.
184
+ </example>
185
+ `,
186
+ blueprints: [Ref.make(MarkdownBlueprint.make()), Ref.make(Obj.clone(PlanningBlueprint.make()))],
187
+ },
188
+ blueprint,
189
+ ),
190
+ );
191
+ yield* Database.flush({ indexes: true });
192
+
193
+ const chatQueue = project.chat?.target?.queue?.target as any;
194
+ invariant(chatQueue, 'Project chat queue not found.');
195
+ yield* Database.flush({ indexes: true });
196
+ const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue: chatQueue }));
197
+ yield* Effect.promise(() => conversation.context.open());
198
+
199
+ yield* conversation.createRequest({
200
+ system: SYSTEM,
201
+ prompt: `Go`,
202
+ });
115
203
 
116
- console.log(yield* Effect.promise(() => dumpInitiative(initiative)));
204
+ console.log(yield* Effect.promise(() => dumpProject(project)));
117
205
  },
206
+ WithProperties,
118
207
  Effect.provide(TestLayer),
119
208
  TestHelpers.provideTestContext,
120
209
  ),
@@ -122,14 +211,19 @@ describe('Initiative', () => {
122
211
  );
123
212
  });
124
213
 
125
- const dumpInitiative = async (initiative: Initiative.Initiative) => {
214
+ const dumpProject = async (project: Project.Project) => {
126
215
  let text = '';
127
- text += `============== Initiative: ${initiative.name} ==============\n\n`;
128
- for (const artifact of initiative.artifacts) {
216
+ text += `============== Project: ${project.name} ==============\n\n`;
217
+ text += `============== Spec ==============\n\n`;
218
+ text += `${await project.spec.load().then((_) => _.content)}\n`;
219
+ text += `============== Plan ==============\n\n`;
220
+ text += `${await project.plan?.load().then((_) => Plan.formatPlan(_))}\n`;
221
+ text += `============== Artifacts ==============\n\n`;
222
+ for (const artifact of project.artifacts) {
129
223
  const data = await artifact.data.load();
130
224
  text += `============== ${artifact.name} (${Obj.getTypename(data)}) ==============\n`;
131
- if (Obj.instanceOf(Text.Text, data)) {
132
- text += ` ${data.content}\n`;
225
+ if (Obj.instanceOf(Markdown.Document, data)) {
226
+ text += `# ${Obj.getLabel(data)}\n\n${await data.content.load().then((_) => _.content)}\n`;
133
227
  } else {
134
228
  text += ` ${JSON.stringify(data, null, 2)}\n`;
135
229
  }
@@ -0,0 +1,68 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { type AppCapabilities } from '@dxos/app-toolkit';
6
+ import { Blueprint, Template } from '@dxos/blueprints';
7
+ import { trim } from '@dxos/util';
8
+
9
+ import { ProjectFunctions } from './functions';
10
+
11
+ const BLUEPRINT_KEY = 'org.dxos.blueprint.project';
12
+
13
+ const functions = [ProjectFunctions.AddArtifact];
14
+
15
+ /**
16
+ * Creates the Project blueprint. This is a function to avoid circular dependency issues.
17
+ */
18
+ const make = () =>
19
+ Blueprint.make({
20
+ key: BLUEPRINT_KEY,
21
+ name: 'Project blueprint',
22
+ instructions: Template.make({
23
+ source: trim`
24
+ You work on an project. Each project has a spec - the goal of the project.
25
+ The project plan shows the current progress of the project.
26
+ Project has an number of associated artifacts you can read/write.
27
+ Spec and plan are also artifacts.
28
+ You can edit them if necessary.
29
+
30
+ IMPORTANT: When create a new artifact, always add it to the project using the add-artifact function.
31
+
32
+ {{#with project}}
33
+ <project id="{{id}}" name="{{name}}">
34
+ <spec>
35
+ {{spec}}
36
+ </spec>
37
+ <plan>
38
+ {{plan}}
39
+ </plan>
40
+
41
+ <artifacts>
42
+ {{#each artifacts}}
43
+ <artifact type="{{type}}" dxn="{{dxn}}">
44
+ {{name}}
45
+ </artifact>
46
+ {{/each}}
47
+ </artifacts>
48
+ </project>
49
+ {{/with}}
50
+ `,
51
+ inputs: [
52
+ {
53
+ name: 'project',
54
+ kind: 'function',
55
+ function: 'org.dxos.function.project.get-context',
56
+ },
57
+ ],
58
+ }),
59
+ tools: Blueprint.toolDefinitions({ functions }),
60
+ });
61
+
62
+ const blueprint: AppCapabilities.BlueprintDefinition = {
63
+ key: BLUEPRINT_KEY,
64
+ functions,
65
+ make,
66
+ };
67
+
68
+ export default blueprint;
@@ -0,0 +1,41 @@
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 { Database, Obj, Ref } from '@dxos/echo';
10
+ import { defineFunction } from '@dxos/functions';
11
+
12
+ import { Project } from '../../../types';
13
+
14
+ export default defineFunction({
15
+ key: 'org.dxos.function.project.add-artifact',
16
+ name: 'Add artifact',
17
+ description: 'Adds a new artifact.',
18
+ inputSchema: Schema.Struct({
19
+ name: Schema.String.annotations({
20
+ description: 'The name of the artifact to add.',
21
+ }),
22
+ artifact: Ref.Ref(Obj.Unknown).annotations({
23
+ description: 'The artifact to add. Do NOT guess or try to generate the ID.',
24
+ }),
25
+ }),
26
+ services: [AiContextService],
27
+ handler: Effect.fnUntraced(function* ({ data }) {
28
+ if (!(yield* Database.load(data.artifact))) {
29
+ throw new Error('Artifact not found.');
30
+ }
31
+
32
+ const project = yield* Project.getFromChatContext;
33
+
34
+ Obj.change(project, (project) => {
35
+ project.artifacts.push({
36
+ name: data.name,
37
+ data: data.artifact,
38
+ });
39
+ });
40
+ }, AiContextService.fixFunctionHandlerType),
41
+ });
@@ -0,0 +1,72 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Schema from 'effect/Schema';
7
+
8
+ import { AiService } from '@dxos/ai';
9
+ import { AiContextService, AiConversation, type ContextBinding } from '@dxos/assistant';
10
+ import { Database, Obj, Ref } from '@dxos/echo';
11
+ import { type Queue } from '@dxos/echo-db';
12
+ import { acquireReleaseResource } from '@dxos/effect';
13
+ import { TriggerEvent, defineFunction } from '@dxos/functions';
14
+ import { invariant } from '@dxos/invariant';
15
+ import { type Message } from '@dxos/types';
16
+
17
+ import { Project } from '../../../types';
18
+
19
+ export default defineFunction({
20
+ key: 'org.dxos.function.project.agent',
21
+ name: 'Project Agent',
22
+ description: 'Agentic worker that drives the project autonomously.',
23
+ inputSchema: Schema.Struct({
24
+ project: Schema.suspend(() => Ref.Ref(Project.Project)),
25
+ prompt: Schema.optional(Schema.String),
26
+ event: Schema.optional(TriggerEvent.TriggerEvent),
27
+ }),
28
+ outputSchema: Schema.Void,
29
+ services: [AiContextService],
30
+ handler: Effect.fnUntraced(
31
+ function* ({ data }) {
32
+ const project = yield* Database.load(data.project);
33
+ invariant(Obj.instanceOf(Project.Project, project));
34
+ invariant(project.chat, 'Project has no chat.');
35
+
36
+ const chatQueue = yield* project.chat.pipe(
37
+ Database.load,
38
+ Effect.flatMap((chat) => Database.load(chat.queue)),
39
+ );
40
+ invariant(chatQueue, 'Project chat queue not found.');
41
+ const conversation = yield* acquireReleaseResource(
42
+ () => new AiConversation({ queue: chatQueue as Queue<Message.Message | ContextBinding> }),
43
+ );
44
+
45
+ const iniativesInContext = conversation.context.getObjects().filter(Obj.instanceOf(Project.Project));
46
+ if (iniativesInContext.length !== 1) {
47
+ throw new Error('There should be exactly one project in context. Got: ' + iniativesInContext.length);
48
+ }
49
+
50
+ if (!data.prompt && !data.event) {
51
+ throw new Error('Either prompt or event must be provided.');
52
+ }
53
+
54
+ let input = '';
55
+ if (data.prompt) {
56
+ input += `${data.prompt}\n\n`;
57
+ }
58
+ if (data.event) {
59
+ input += `<event>\n${JSON.stringify(data.event, null, 2)}\n</event>\n\n`;
60
+ }
61
+
62
+ yield* conversation
63
+ .createRequest({
64
+ prompt: input,
65
+ })
66
+ .pipe(Effect.retry({ times: 2 }));
67
+ },
68
+ Effect.scoped,
69
+ Effect.provide(AiService.model('@anthropic/claude-sonnet-4-5')),
70
+ AiContextService.fixFunctionHandlerType,
71
+ ) as any,
72
+ });
@@ -0,0 +1,63 @@
1
+ //
2
+ // Copyright 2026 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 { Database, Obj } from '@dxos/echo';
10
+ import { defineFunction } from '@dxos/functions';
11
+
12
+ import { Plan, Project } from '../../../types';
13
+
14
+ export default defineFunction({
15
+ key: 'org.dxos.function.project.get-context',
16
+ name: 'Get Project Context',
17
+ description: 'Get the context of an project.',
18
+ inputSchema: Schema.Struct({}),
19
+ outputSchema: Schema.Struct({
20
+ id: Schema.String,
21
+ name: Schema.String,
22
+ spec: Schema.String,
23
+ plan: Schema.String,
24
+ artifacts: Schema.Array(
25
+ Schema.Struct({
26
+ name: Schema.String,
27
+ type: Schema.optional(Schema.String),
28
+ dxn: Schema.optional(Schema.String),
29
+ }),
30
+ ),
31
+ }),
32
+ services: [AiContextService],
33
+ handler: Effect.fnUntraced(function* ({ data: _data }) {
34
+ const project = yield* Project.getFromChatContext;
35
+
36
+ return {
37
+ id: project.id,
38
+ name: project.name,
39
+ spec: yield* project.spec.pipe(Database.load).pipe(
40
+ Effect.map((_) => _.content),
41
+ Effect.catchTag('ObjectNotFoundError', () => Effect.succeed('No spec found.')),
42
+ ),
43
+ plan: yield* (
44
+ project.plan?.pipe(Database.load).pipe(
45
+ Effect.map(Plan.formatPlan),
46
+ Effect.catchTag('ObjectNotFoundError', () => Effect.succeed('No plan found.')),
47
+ ) ?? Effect.succeed('No plan found.')
48
+ ),
49
+ artifacts: yield* Effect.forEach(project.artifacts, (artifact) =>
50
+ Effect.gen(function* () {
51
+ return {
52
+ name: artifact.name,
53
+ type: yield* Database.load(artifact.data).pipe(
54
+ Effect.map(Obj.getTypename),
55
+ Effect.catchTag('ObjectNotFoundError', () => Effect.succeed('Artifact not found.')),
56
+ ),
57
+ dxn: artifact.data.dxn.toString(),
58
+ };
59
+ }),
60
+ ),
61
+ };
62
+ }, AiContextService.fixFunctionHandlerType),
63
+ });
@@ -0,0 +1,15 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { default as AddArtifact } from './add-artifact';
6
+ import { default as Agent } from './agent';
7
+ import { default as GetContext } from './get-context';
8
+ import { default as Qualifier } from './qualifier';
9
+
10
+ export const ProjectFunctions = {
11
+ AddArtifact,
12
+ Agent,
13
+ GetContext,
14
+ Qualifier,
15
+ };