@dxos/assistant-toolkit 0.8.4-main.e8ec1fe → 0.8.4-main.fcfe5033a5

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 (676) hide show
  1. package/dist/lib/neutral/add-artifact-IGKQVEIL.mjs +30 -0
  2. package/dist/lib/neutral/add-artifact-IGKQVEIL.mjs.map +7 -0
  3. package/dist/lib/neutral/agent-3MJJ36QG.mjs +87 -0
  4. package/dist/lib/neutral/agent-3MJJ36QG.mjs.map +7 -0
  5. package/dist/lib/neutral/chunk-4BWLYLTR.mjs +29 -0
  6. package/dist/lib/neutral/chunk-4BWLYLTR.mjs.map +7 -0
  7. package/dist/lib/neutral/chunk-6DPL2YY5.mjs +68 -0
  8. package/dist/lib/neutral/chunk-6DPL2YY5.mjs.map +7 -0
  9. package/dist/lib/neutral/chunk-6FL4C6KD.mjs +86 -0
  10. package/dist/lib/neutral/chunk-6FL4C6KD.mjs.map +7 -0
  11. package/dist/lib/neutral/chunk-7VH5RFBT.mjs +392 -0
  12. package/dist/lib/neutral/chunk-7VH5RFBT.mjs.map +7 -0
  13. package/dist/lib/neutral/chunk-7WHAIX7N.mjs +692 -0
  14. package/dist/lib/neutral/chunk-7WHAIX7N.mjs.map +7 -0
  15. package/dist/lib/neutral/chunk-7WUXG23R.mjs +95 -0
  16. package/dist/lib/neutral/chunk-7WUXG23R.mjs.map +7 -0
  17. package/dist/lib/neutral/chunk-DV5DCOUE.mjs +52 -0
  18. package/dist/lib/neutral/chunk-DV5DCOUE.mjs.map +7 -0
  19. package/dist/lib/neutral/chunk-FKGWM6KF.mjs +140 -0
  20. package/dist/lib/neutral/chunk-FKGWM6KF.mjs.map +7 -0
  21. package/dist/lib/neutral/chunk-HCS67KNS.mjs +74 -0
  22. package/dist/lib/neutral/chunk-HCS67KNS.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-I2YSCI65.mjs +76 -0
  24. package/dist/lib/neutral/chunk-I2YSCI65.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-IVXBQQDJ.mjs +332 -0
  26. package/dist/lib/neutral/chunk-IVXBQQDJ.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  28. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  29. package/dist/lib/neutral/chunk-JEQB7H27.mjs +70 -0
  30. package/dist/lib/neutral/chunk-JEQB7H27.mjs.map +7 -0
  31. package/dist/lib/neutral/chunk-LI6VMCJW.mjs +27 -0
  32. package/dist/lib/neutral/chunk-LI6VMCJW.mjs.map +7 -0
  33. package/dist/lib/neutral/chunk-MEZ4UFR6.mjs +25 -0
  34. package/dist/lib/neutral/chunk-MEZ4UFR6.mjs.map +7 -0
  35. package/dist/lib/neutral/chunk-RXITNKBD.mjs +73 -0
  36. package/dist/lib/neutral/chunk-RXITNKBD.mjs.map +7 -0
  37. package/dist/lib/neutral/chunk-RZYPNKOB.mjs +53 -0
  38. package/dist/lib/neutral/chunk-RZYPNKOB.mjs.map +7 -0
  39. package/dist/lib/neutral/chunk-VD2WAUU2.mjs +78 -0
  40. package/dist/lib/neutral/chunk-VD2WAUU2.mjs.map +7 -0
  41. package/dist/lib/neutral/chunk-VDEDVOS6.mjs +39 -0
  42. package/dist/lib/neutral/chunk-VDEDVOS6.mjs.map +7 -0
  43. package/dist/lib/neutral/chunk-VUGCOWRW.mjs +283 -0
  44. package/dist/lib/neutral/chunk-VUGCOWRW.mjs.map +7 -0
  45. package/dist/lib/neutral/chunk-YPECGXN2.mjs +100 -0
  46. package/dist/lib/neutral/chunk-YPECGXN2.mjs.map +7 -0
  47. package/dist/lib/neutral/context-add-QAHU6I24.mjs +22 -0
  48. package/dist/lib/neutral/context-add-QAHU6I24.mjs.map +7 -0
  49. package/dist/lib/neutral/context-remove-VMZPMZ4E.mjs +22 -0
  50. package/dist/lib/neutral/context-remove-VMZPMZ4E.mjs.map +7 -0
  51. package/dist/lib/neutral/create-P6I22VS5.mjs +23 -0
  52. package/dist/lib/neutral/create-P6I22VS5.mjs.map +7 -0
  53. package/dist/lib/neutral/create-project-JBCPS6OC.mjs +36 -0
  54. package/dist/lib/neutral/create-project-JBCPS6OC.mjs.map +7 -0
  55. package/dist/lib/neutral/delete-7PDHEV4U.mjs +19 -0
  56. package/dist/lib/neutral/delete-7PDHEV4U.mjs.map +7 -0
  57. package/dist/lib/neutral/document-create-GKW354LS.mjs +55 -0
  58. package/dist/lib/neutral/document-create-GKW354LS.mjs.map +7 -0
  59. package/dist/lib/neutral/enable-blueprints-4UMPKGUD.mjs +48 -0
  60. package/dist/lib/neutral/enable-blueprints-4UMPKGUD.mjs.map +7 -0
  61. package/dist/lib/neutral/entity-extraction-T2M7C3WU.mjs +194 -0
  62. package/dist/lib/neutral/entity-extraction-T2M7C3WU.mjs.map +7 -0
  63. package/dist/lib/neutral/exa-P4G3DCYB.mjs +28 -0
  64. package/dist/lib/neutral/exa-P4G3DCYB.mjs.map +7 -0
  65. package/dist/lib/neutral/fetch-TLKREIZA.mjs +16 -0
  66. package/dist/lib/neutral/fetch-TLKREIZA.mjs.map +7 -0
  67. package/dist/lib/neutral/fetch-messages-UKDOTMLZ.mjs +150 -0
  68. package/dist/lib/neutral/fetch-messages-UKDOTMLZ.mjs.map +7 -0
  69. package/dist/lib/neutral/get-context-TJOY4S33.mjs +35 -0
  70. package/dist/lib/neutral/get-context-TJOY4S33.mjs.map +7 -0
  71. package/dist/lib/neutral/index.mjs +250 -0
  72. package/dist/lib/neutral/index.mjs.map +7 -0
  73. package/dist/lib/neutral/load-ZTOGVHWP.mjs +17 -0
  74. package/dist/lib/neutral/load-ZTOGVHWP.mjs.map +7 -0
  75. package/dist/lib/neutral/meta.json +1 -0
  76. package/dist/lib/{browser/index.mjs → neutral/mock-2ARYZ54S.mjs} +28 -2249
  77. package/dist/lib/neutral/mock-2ARYZ54S.mjs.map +7 -0
  78. package/dist/lib/neutral/object-create-7QCGL56E.mjs +43 -0
  79. package/dist/lib/neutral/object-create-7QCGL56E.mjs.map +7 -0
  80. package/dist/lib/neutral/object-delete-KXBWC4Q4.mjs +18 -0
  81. package/dist/lib/neutral/object-delete-KXBWC4Q4.mjs.map +7 -0
  82. package/dist/lib/neutral/object-update-B7RDX3JC.mjs +28 -0
  83. package/dist/lib/neutral/object-update-B7RDX3JC.mjs.map +7 -0
  84. package/dist/lib/neutral/project-4YLFG5BQ.mjs +23 -0
  85. package/dist/lib/neutral/project-4YLFG5BQ.mjs.map +7 -0
  86. package/dist/lib/neutral/project-rules-R5EYMWD3.mjs +78 -0
  87. package/dist/lib/neutral/project-rules-R5EYMWD3.mjs.map +7 -0
  88. package/dist/lib/neutral/prompt-4NEDW6FG.mjs +197 -0
  89. package/dist/lib/neutral/prompt-4NEDW6FG.mjs.map +7 -0
  90. package/dist/lib/neutral/qualifier-RKTN2QK4.mjs +104 -0
  91. package/dist/lib/neutral/qualifier-RKTN2QK4.mjs.map +7 -0
  92. package/dist/lib/neutral/query-BPDND25Q.mjs +32 -0
  93. package/dist/lib/neutral/query-BPDND25Q.mjs.map +7 -0
  94. package/dist/lib/neutral/query-V2ZWVVYP.mjs +70 -0
  95. package/dist/lib/neutral/query-V2ZWVVYP.mjs.map +7 -0
  96. package/dist/lib/neutral/query-blueprints-EKHEZAGD.mjs +17 -0
  97. package/dist/lib/neutral/query-blueprints-EKHEZAGD.mjs.map +7 -0
  98. package/dist/lib/neutral/read-JJN7YXHI.mjs +19 -0
  99. package/dist/lib/neutral/read-JJN7YXHI.mjs.map +7 -0
  100. package/dist/lib/neutral/relation-create-FSHBM5CJ.mjs +42 -0
  101. package/dist/lib/neutral/relation-create-FSHBM5CJ.mjs.map +7 -0
  102. package/dist/lib/neutral/relation-delete-CYYQUIZY.mjs +18 -0
  103. package/dist/lib/neutral/relation-delete-CYYQUIZY.mjs.map +7 -0
  104. package/dist/lib/neutral/research-DZPSEZZC.mjs +106 -0
  105. package/dist/lib/neutral/research-DZPSEZZC.mjs.map +7 -0
  106. package/dist/lib/neutral/save-M4KRWV4W.mjs +23 -0
  107. package/dist/lib/neutral/save-M4KRWV4W.mjs.map +7 -0
  108. package/dist/lib/neutral/schema-add-RVV364G6.mjs +24 -0
  109. package/dist/lib/neutral/schema-add-RVV364G6.mjs.map +7 -0
  110. package/dist/lib/neutral/schema-list-4IYBLXFN.mjs +39 -0
  111. package/dist/lib/neutral/schema-list-4IYBLXFN.mjs.map +7 -0
  112. package/dist/lib/neutral/sync-issues-BBAMXSZN.mjs +179 -0
  113. package/dist/lib/neutral/sync-issues-BBAMXSZN.mjs.map +7 -0
  114. package/dist/lib/neutral/sync-triggers-56ELUXSO.mjs +112 -0
  115. package/dist/lib/neutral/sync-triggers-56ELUXSO.mjs.map +7 -0
  116. package/dist/lib/neutral/tag-add-OUDUBR3E.mjs +19 -0
  117. package/dist/lib/neutral/tag-add-OUDUBR3E.mjs.map +7 -0
  118. package/dist/lib/neutral/tag-remove-DI3ZSLFK.mjs +19 -0
  119. package/dist/lib/neutral/tag-remove-DI3ZSLFK.mjs.map +7 -0
  120. package/dist/lib/neutral/testing/index.mjs +81 -0
  121. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  122. package/dist/lib/neutral/update-J64AYUS5.mjs +20 -0
  123. package/dist/lib/neutral/update-J64AYUS5.mjs.map +7 -0
  124. package/dist/lib/neutral/update-blueprints-ZNWR7BBN.mjs +17 -0
  125. package/dist/lib/neutral/update-blueprints-ZNWR7BBN.mjs.map +7 -0
  126. package/dist/lib/neutral/update-tasks-EH7MOB5X.mjs +46 -0
  127. package/dist/lib/neutral/update-tasks-EH7MOB5X.mjs.map +7 -0
  128. package/dist/types/src/blueprints/automation/blueprint.d.ts +4 -0
  129. package/dist/types/src/blueprints/automation/blueprint.d.ts.map +1 -0
  130. package/dist/types/src/blueprints/automation/index.d.ts +2 -0
  131. package/dist/types/src/blueprints/automation/index.d.ts.map +1 -0
  132. package/dist/types/src/blueprints/blueprint-manager/blueprint.d.ts +4 -0
  133. package/dist/types/src/blueprints/blueprint-manager/blueprint.d.ts.map +1 -0
  134. package/dist/types/src/blueprints/blueprint-manager/blueprint.test.d.ts +2 -0
  135. package/dist/types/src/blueprints/blueprint-manager/blueprint.test.d.ts.map +1 -0
  136. package/dist/types/src/blueprints/blueprint-manager/functions/definitions.d.ts +60 -0
  137. package/dist/types/src/blueprints/blueprint-manager/functions/definitions.d.ts.map +1 -0
  138. package/dist/types/src/blueprints/blueprint-manager/functions/enable-blueprints.d.ts +36 -0
  139. package/dist/types/src/blueprints/blueprint-manager/functions/enable-blueprints.d.ts.map +1 -0
  140. package/dist/types/src/blueprints/blueprint-manager/functions/index.d.ts +4 -0
  141. package/dist/types/src/blueprints/blueprint-manager/functions/index.d.ts.map +1 -0
  142. package/dist/types/src/blueprints/blueprint-manager/functions/query-blueprints.d.ts +27 -0
  143. package/dist/types/src/blueprints/blueprint-manager/functions/query-blueprints.d.ts.map +1 -0
  144. package/dist/types/src/blueprints/blueprint-manager/functions/update-blueprints.d.ts +5 -0
  145. package/dist/types/src/blueprints/blueprint-manager/functions/update-blueprints.d.ts.map +1 -0
  146. package/dist/types/src/blueprints/blueprint-manager/index.d.ts +3 -0
  147. package/dist/types/src/blueprints/blueprint-manager/index.d.ts.map +1 -0
  148. package/dist/types/src/blueprints/browser/blueprint.d.ts +4 -0
  149. package/dist/types/src/blueprints/browser/blueprint.d.ts.map +1 -0
  150. package/dist/types/src/blueprints/browser/blueprint.test.d.ts +2 -0
  151. package/dist/types/src/blueprints/browser/blueprint.test.d.ts.map +1 -0
  152. package/dist/types/src/blueprints/browser/index.d.ts +2 -0
  153. package/dist/types/src/blueprints/browser/index.d.ts.map +1 -0
  154. package/dist/types/src/blueprints/database/blueprint.d.ts +4 -0
  155. package/dist/types/src/blueprints/database/blueprint.d.ts.map +1 -0
  156. package/dist/types/src/blueprints/database/blueprint.test.d.ts +2 -0
  157. package/dist/types/src/blueprints/database/blueprint.test.d.ts.map +1 -0
  158. package/dist/types/src/blueprints/database/functions/context-add.d.ts +7 -0
  159. package/dist/types/src/blueprints/database/functions/context-add.d.ts.map +1 -0
  160. package/dist/types/src/blueprints/database/functions/context-remove.d.ts +7 -0
  161. package/dist/types/src/blueprints/database/functions/context-remove.d.ts.map +1 -0
  162. package/dist/types/src/blueprints/database/functions/definitions.d.ts +59 -0
  163. package/dist/types/src/blueprints/database/functions/definitions.d.ts.map +1 -0
  164. package/dist/types/src/blueprints/database/functions/index.d.ts +4 -0
  165. package/dist/types/src/blueprints/database/functions/index.d.ts.map +1 -0
  166. package/dist/types/src/blueprints/database/functions/load.d.ts +7 -0
  167. package/dist/types/src/blueprints/database/functions/load.d.ts.map +1 -0
  168. package/dist/types/src/blueprints/database/functions/object-create.d.ts +8 -0
  169. package/dist/types/src/blueprints/database/functions/object-create.d.ts.map +1 -0
  170. package/dist/types/src/blueprints/database/functions/object-delete.d.ts +7 -0
  171. package/dist/types/src/blueprints/database/functions/object-delete.d.ts.map +1 -0
  172. package/dist/types/src/blueprints/database/functions/object-update.d.ts +10 -0
  173. package/dist/types/src/blueprints/database/functions/object-update.d.ts.map +1 -0
  174. package/dist/types/src/blueprints/database/functions/query.d.ts +13 -0
  175. package/dist/types/src/blueprints/database/functions/query.d.ts.map +1 -0
  176. package/dist/types/src/blueprints/database/functions/relation-create.d.ts +10 -0
  177. package/dist/types/src/blueprints/database/functions/relation-create.d.ts.map +1 -0
  178. package/dist/types/src/blueprints/database/functions/relation-delete.d.ts +7 -0
  179. package/dist/types/src/blueprints/database/functions/relation-delete.d.ts.map +1 -0
  180. package/dist/types/src/blueprints/database/functions/schema-add.d.ts +9 -0
  181. package/dist/types/src/blueprints/database/functions/schema-add.d.ts.map +1 -0
  182. package/dist/types/src/blueprints/database/functions/schema-list.d.ts +7 -0
  183. package/dist/types/src/blueprints/database/functions/schema-list.d.ts.map +1 -0
  184. package/dist/types/src/blueprints/database/functions/tag-add.d.ts +8 -0
  185. package/dist/types/src/blueprints/database/functions/tag-add.d.ts.map +1 -0
  186. package/dist/types/src/blueprints/database/functions/tag-remove.d.ts +8 -0
  187. package/dist/types/src/blueprints/database/functions/tag-remove.d.ts.map +1 -0
  188. package/dist/types/src/blueprints/database/index.d.ts +3 -0
  189. package/dist/types/src/blueprints/database/index.d.ts.map +1 -0
  190. package/dist/types/src/blueprints/design/blueprint.d.ts +4 -0
  191. package/dist/types/src/blueprints/design/blueprint.d.ts.map +1 -0
  192. package/dist/types/src/blueprints/design/blueprint.test.d.ts +2 -0
  193. package/dist/types/src/blueprints/design/blueprint.test.d.ts.map +1 -0
  194. package/dist/types/src/blueprints/design/index.d.ts +1 -2
  195. package/dist/types/src/blueprints/design/index.d.ts.map +1 -1
  196. package/dist/types/src/blueprints/discord/blueprint.d.ts +4 -0
  197. package/dist/types/src/blueprints/discord/blueprint.d.ts.map +1 -0
  198. package/dist/types/src/blueprints/discord/functions/definitions.d.ts +16 -0
  199. package/dist/types/src/blueprints/discord/functions/definitions.d.ts.map +1 -0
  200. package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.d.ts +4 -2
  201. package/dist/types/src/blueprints/discord/functions/fetch-messages.d.ts.map +1 -0
  202. package/dist/types/src/blueprints/discord/functions/fetch-messages.test.d.ts.map +1 -0
  203. package/dist/types/src/blueprints/discord/functions/index.d.ts +4 -0
  204. package/dist/types/src/blueprints/discord/functions/index.d.ts.map +1 -0
  205. package/dist/types/src/blueprints/discord/index.d.ts +2 -2
  206. package/dist/types/src/blueprints/discord/index.d.ts.map +1 -1
  207. package/dist/types/src/blueprints/github/functions/definitions.d.ts +8 -0
  208. package/dist/types/src/blueprints/github/functions/definitions.d.ts.map +1 -0
  209. package/dist/types/src/blueprints/github/functions/fetch-prs.d.ts +9 -0
  210. package/dist/types/src/blueprints/github/functions/fetch-prs.d.ts.map +1 -0
  211. package/dist/types/src/blueprints/github/functions/index.d.ts +4 -0
  212. package/dist/types/src/blueprints/github/functions/index.d.ts.map +1 -0
  213. package/dist/types/src/blueprints/github/index.d.ts +2 -0
  214. package/dist/types/src/blueprints/github/index.d.ts.map +1 -0
  215. package/dist/types/src/blueprints/index.d.ts +14 -6
  216. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  217. package/dist/types/src/blueprints/linear/blueprint.d.ts +4 -0
  218. package/dist/types/src/blueprints/linear/blueprint.d.ts.map +1 -0
  219. package/dist/types/src/blueprints/linear/functions/definitions.d.ts +7 -0
  220. package/dist/types/src/blueprints/linear/functions/definitions.d.ts.map +1 -0
  221. package/dist/types/src/blueprints/linear/functions/index.d.ts +4 -0
  222. package/dist/types/src/blueprints/linear/functions/index.d.ts.map +1 -0
  223. package/dist/types/src/blueprints/linear/functions/linear.test.d.ts.map +1 -0
  224. package/dist/types/src/blueprints/linear/functions/sync-issues.d.ts +11 -0
  225. package/dist/types/src/blueprints/linear/functions/sync-issues.d.ts.map +1 -0
  226. package/dist/types/src/blueprints/linear/index.d.ts +2 -2
  227. package/dist/types/src/blueprints/linear/index.d.ts.map +1 -1
  228. package/dist/types/src/blueprints/markdown/blueprint.d.ts +4 -0
  229. package/dist/types/src/blueprints/markdown/blueprint.d.ts.map +1 -0
  230. package/dist/types/src/blueprints/markdown/functions/create.d.ts +8 -0
  231. package/dist/types/src/blueprints/markdown/functions/create.d.ts.map +1 -0
  232. package/dist/types/src/blueprints/markdown/functions/definitions.d.ts +45 -0
  233. package/dist/types/src/blueprints/markdown/functions/definitions.d.ts.map +1 -0
  234. package/dist/types/src/blueprints/markdown/functions/index.d.ts +4 -0
  235. package/dist/types/src/blueprints/markdown/functions/index.d.ts.map +1 -0
  236. package/dist/types/src/blueprints/markdown/functions/read.d.ts +17 -0
  237. package/dist/types/src/blueprints/markdown/functions/read.d.ts.map +1 -0
  238. package/dist/types/src/blueprints/markdown/functions/update.d.ts +16 -0
  239. package/dist/types/src/blueprints/markdown/functions/update.d.ts.map +1 -0
  240. package/dist/types/src/blueprints/markdown/index.d.ts +3 -0
  241. package/dist/types/src/blueprints/markdown/index.d.ts.map +1 -0
  242. package/dist/types/src/blueprints/memory/blueprint.d.ts +4 -0
  243. package/dist/types/src/blueprints/memory/blueprint.d.ts.map +1 -0
  244. package/dist/types/src/blueprints/memory/blueprint.test.d.ts +2 -0
  245. package/dist/types/src/blueprints/memory/blueprint.test.d.ts.map +1 -0
  246. package/dist/types/src/blueprints/memory/functions/definitions.d.ts +17 -0
  247. package/dist/types/src/blueprints/memory/functions/definitions.d.ts.map +1 -0
  248. package/dist/types/src/blueprints/memory/functions/delete.d.ts +10 -0
  249. package/dist/types/src/blueprints/memory/functions/delete.d.ts.map +1 -0
  250. package/dist/types/src/blueprints/memory/functions/index.d.ts +4 -0
  251. package/dist/types/src/blueprints/memory/functions/index.d.ts.map +1 -0
  252. package/dist/types/src/blueprints/memory/functions/query.d.ts +8 -0
  253. package/dist/types/src/blueprints/memory/functions/query.d.ts.map +1 -0
  254. package/dist/types/src/blueprints/memory/functions/save.d.ts +8 -0
  255. package/dist/types/src/blueprints/memory/functions/save.d.ts.map +1 -0
  256. package/dist/types/src/blueprints/memory/index.d.ts +3 -0
  257. package/dist/types/src/blueprints/memory/index.d.ts.map +1 -0
  258. package/dist/types/src/blueprints/planning/blueprint.d.ts +4 -0
  259. package/dist/types/src/blueprints/planning/blueprint.d.ts.map +1 -0
  260. package/dist/types/src/blueprints/planning/functions/definitions.d.ts +11 -0
  261. package/dist/types/src/blueprints/planning/functions/definitions.d.ts.map +1 -0
  262. package/dist/types/src/blueprints/planning/functions/index.d.ts +4 -0
  263. package/dist/types/src/blueprints/planning/functions/index.d.ts.map +1 -0
  264. package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts +11 -0
  265. package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts.map +1 -0
  266. package/dist/types/src/blueprints/planning/index.d.ts +2 -2
  267. package/dist/types/src/blueprints/planning/index.d.ts.map +1 -1
  268. package/dist/types/src/blueprints/planning-old/blueprint.d.ts +4 -0
  269. package/dist/types/src/blueprints/planning-old/blueprint.d.ts.map +1 -0
  270. package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts +2 -0
  271. package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts.map +1 -0
  272. package/dist/types/src/blueprints/planning-old/functions/definitions.d.ts +31 -0
  273. package/dist/types/src/blueprints/planning-old/functions/definitions.d.ts.map +1 -0
  274. package/dist/types/src/blueprints/planning-old/functions/index.d.ts +4 -0
  275. package/dist/types/src/blueprints/planning-old/functions/index.d.ts.map +1 -0
  276. package/dist/types/src/blueprints/planning-old/functions/read.d.ts +17 -0
  277. package/dist/types/src/blueprints/planning-old/functions/read.d.ts.map +1 -0
  278. package/dist/types/src/blueprints/planning-old/functions/task-list.d.ts.map +1 -0
  279. package/dist/types/src/blueprints/planning-old/functions/task-list.test.d.ts.map +1 -0
  280. package/dist/types/src/blueprints/planning-old/functions/update.d.ts +19 -0
  281. package/dist/types/src/blueprints/planning-old/functions/update.d.ts.map +1 -0
  282. package/dist/types/src/blueprints/planning-old/index.d.ts +3 -0
  283. package/dist/types/src/blueprints/planning-old/index.d.ts.map +1 -0
  284. package/dist/types/src/blueprints/project/blueprint.d.ts +4 -0
  285. package/dist/types/src/blueprints/project/blueprint.d.ts.map +1 -0
  286. package/dist/types/src/blueprints/project/blueprint.test.d.ts +2 -0
  287. package/dist/types/src/blueprints/project/blueprint.test.d.ts.map +1 -0
  288. package/dist/types/src/blueprints/project/functions/add-artifact.d.ts +8 -0
  289. package/dist/types/src/blueprints/project/functions/add-artifact.d.ts.map +1 -0
  290. package/dist/types/src/blueprints/project/functions/agent.d.ts +4 -0
  291. package/dist/types/src/blueprints/project/functions/agent.d.ts.map +1 -0
  292. package/dist/types/src/blueprints/project/functions/definitions.d.ts +150 -0
  293. package/dist/types/src/blueprints/project/functions/definitions.d.ts.map +1 -0
  294. package/dist/types/src/blueprints/project/functions/get-context.d.ts +15 -0
  295. package/dist/types/src/blueprints/project/functions/get-context.d.ts.map +1 -0
  296. package/dist/types/src/blueprints/project/functions/index.d.ts +4 -0
  297. package/dist/types/src/blueprints/project/functions/index.d.ts.map +1 -0
  298. package/dist/types/src/blueprints/project/functions/qualifier.d.ts +69 -0
  299. package/dist/types/src/blueprints/project/functions/qualifier.d.ts.map +1 -0
  300. package/dist/types/src/blueprints/project/index.d.ts +3 -0
  301. package/dist/types/src/blueprints/project/index.d.ts.map +1 -0
  302. package/dist/types/src/blueprints/project-wizard/blueprint.d.ts +4 -0
  303. package/dist/types/src/blueprints/project-wizard/blueprint.d.ts.map +1 -0
  304. package/dist/types/src/blueprints/project-wizard/functions/create-project.d.ts +48 -0
  305. package/dist/types/src/blueprints/project-wizard/functions/create-project.d.ts.map +1 -0
  306. package/dist/types/src/blueprints/project-wizard/functions/definitions.d.ts +89 -0
  307. package/dist/types/src/blueprints/project-wizard/functions/definitions.d.ts.map +1 -0
  308. package/dist/types/src/blueprints/project-wizard/functions/index.d.ts +4 -0
  309. package/dist/types/src/blueprints/project-wizard/functions/index.d.ts.map +1 -0
  310. package/dist/types/src/blueprints/project-wizard/functions/project-rules.d.ts +4 -0
  311. package/dist/types/src/blueprints/project-wizard/functions/project-rules.d.ts.map +1 -0
  312. package/dist/types/src/blueprints/project-wizard/functions/sync-triggers.d.ts +44 -0
  313. package/dist/types/src/blueprints/project-wizard/functions/sync-triggers.d.ts.map +1 -0
  314. package/dist/types/src/blueprints/project-wizard/index.d.ts +3 -0
  315. package/dist/types/src/blueprints/project-wizard/index.d.ts.map +1 -0
  316. package/dist/types/src/blueprints/research/blueprint.d.ts +4 -0
  317. package/dist/types/src/blueprints/research/blueprint.d.ts.map +1 -0
  318. package/dist/types/src/blueprints/research/blueprint.test.d.ts +2 -0
  319. package/dist/types/src/blueprints/research/blueprint.test.d.ts.map +1 -0
  320. package/dist/types/src/blueprints/research/functions/definitions.d.ts +21 -0
  321. package/dist/types/src/blueprints/research/functions/definitions.d.ts.map +1 -0
  322. package/dist/types/src/blueprints/research/functions/document-create.d.ts +12 -0
  323. package/dist/types/src/blueprints/research/functions/document-create.d.ts.map +1 -0
  324. package/dist/types/src/blueprints/research/functions/index.d.ts +4 -0
  325. package/dist/types/src/blueprints/research/functions/index.d.ts.map +1 -0
  326. package/dist/types/src/blueprints/research/functions/research.d.ts +7 -0
  327. package/dist/types/src/blueprints/research/functions/research.d.ts.map +1 -0
  328. package/dist/types/src/blueprints/research/functions/research.test.d.ts.map +1 -0
  329. package/dist/types/src/blueprints/research/index.d.ts +3 -2
  330. package/dist/types/src/blueprints/research/index.d.ts.map +1 -1
  331. package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts +35 -0
  332. package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts.map +1 -0
  333. package/dist/types/src/blueprints/research/types/index.d.ts +7 -0
  334. package/dist/types/src/blueprints/research/types/index.d.ts.map +1 -0
  335. package/dist/types/src/blueprints/testing.d.ts +17 -5
  336. package/dist/types/src/blueprints/testing.d.ts.map +1 -1
  337. package/dist/types/src/blueprints/websearch/blueprint.d.ts +4 -0
  338. package/dist/types/src/blueprints/websearch/blueprint.d.ts.map +1 -0
  339. package/dist/types/src/blueprints/websearch/blueprint.test.d.ts +2 -0
  340. package/dist/types/src/blueprints/websearch/blueprint.test.d.ts.map +1 -0
  341. package/dist/types/src/blueprints/websearch/functions/definitions.d.ts +5 -0
  342. package/dist/types/src/blueprints/websearch/functions/definitions.d.ts.map +1 -0
  343. package/dist/types/src/blueprints/websearch/functions/fetch.d.ts +6 -0
  344. package/dist/types/src/blueprints/websearch/functions/fetch.d.ts.map +1 -0
  345. package/dist/types/src/blueprints/websearch/functions/index.d.ts +4 -0
  346. package/dist/types/src/blueprints/websearch/functions/index.d.ts.map +1 -0
  347. package/dist/types/src/blueprints/websearch/index.d.ts +3 -3
  348. package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -1
  349. package/dist/types/src/blueprints/websearch/{websearch-toolkit.d.ts → toolkit.d.ts} +3 -1
  350. package/dist/types/src/blueprints/websearch/toolkit.d.ts.map +1 -0
  351. package/dist/types/src/crud/graph.d.ts +14 -11
  352. package/dist/types/src/crud/graph.d.ts.map +1 -1
  353. package/dist/types/src/errors.d.ts +41 -0
  354. package/dist/types/src/errors.d.ts.map +1 -0
  355. package/dist/types/src/functions/agent/definitions.d.ts +60 -0
  356. package/dist/types/src/functions/agent/definitions.d.ts.map +1 -0
  357. package/dist/types/src/functions/agent/index.d.ts +3 -4
  358. package/dist/types/src/functions/agent/index.d.ts.map +1 -1
  359. package/dist/types/src/functions/agent/prompt.d.ts +2 -7
  360. package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
  361. package/dist/types/src/functions/agent/prompt.test.d.ts +2 -0
  362. package/dist/types/src/functions/agent/prompt.test.d.ts.map +1 -0
  363. package/dist/types/src/functions/entity-extraction/definitions.d.ts +182 -0
  364. package/dist/types/src/functions/entity-extraction/definitions.d.ts.map +1 -0
  365. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +2 -171
  366. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
  367. package/dist/types/src/functions/entity-extraction/index.d.ts +3 -173
  368. package/dist/types/src/functions/entity-extraction/index.d.ts.map +1 -1
  369. package/dist/types/src/functions/exa/data/exa-search-1748337321991.d.ts.map +1 -0
  370. package/dist/types/src/functions/exa/data/exa-search-1748337331526.d.ts.map +1 -0
  371. package/dist/types/src/functions/exa/data/exa-search-1748337344119.d.ts.map +1 -0
  372. package/dist/types/src/functions/exa/data/index.d.ts.map +1 -0
  373. package/dist/types/src/functions/exa/definitions.d.ts +9 -0
  374. package/dist/types/src/functions/exa/definitions.d.ts.map +1 -0
  375. package/dist/types/src/functions/exa/exa.d.ts +4 -2
  376. package/dist/types/src/functions/exa/exa.d.ts.map +1 -1
  377. package/dist/types/src/functions/exa/index.d.ts +3 -2
  378. package/dist/types/src/functions/exa/index.d.ts.map +1 -1
  379. package/dist/types/src/functions/exa/mock.d.ts +3 -2
  380. package/dist/types/src/functions/exa/mock.d.ts.map +1 -1
  381. package/dist/types/src/functions/index.d.ts +1 -5
  382. package/dist/types/src/functions/index.d.ts.map +1 -1
  383. package/dist/types/src/index.d.ts +2 -2
  384. package/dist/types/src/index.d.ts.map +1 -1
  385. package/dist/types/src/sync/sync.d.ts +3 -3
  386. package/dist/types/src/sync/sync.d.ts.map +1 -1
  387. package/dist/types/src/testing/index.d.ts +2 -1
  388. package/dist/types/src/testing/index.d.ts.map +1 -1
  389. package/dist/types/src/testing/plugins.d.ts +19 -0
  390. package/dist/types/src/testing/plugins.d.ts.map +1 -0
  391. package/dist/types/src/toolkits/WebToolkit.d.ts +38 -0
  392. package/dist/types/src/toolkits/WebToolkit.d.ts.map +1 -0
  393. package/dist/types/src/toolkits/index.d.ts +1 -2
  394. package/dist/types/src/toolkits/index.d.ts.map +1 -1
  395. package/dist/types/src/types/Agent.d.ts +73 -0
  396. package/dist/types/src/types/Agent.d.ts.map +1 -0
  397. package/dist/types/src/types/Chat.d.ts +52 -0
  398. package/dist/types/src/types/Chat.d.ts.map +1 -0
  399. package/dist/types/src/types/McpServer.d.ts +18 -0
  400. package/dist/types/src/types/McpServer.d.ts.map +1 -0
  401. package/dist/types/src/types/Memory.d.ts +12 -0
  402. package/dist/types/src/types/Memory.d.ts.map +1 -0
  403. package/dist/types/src/types/Plan.d.ts +86 -0
  404. package/dist/types/src/types/Plan.d.ts.map +1 -0
  405. package/dist/types/src/types/index.d.ts +6 -0
  406. package/dist/types/src/types/index.d.ts.map +1 -0
  407. package/dist/types/tsconfig.tsbuildinfo +1 -1
  408. package/package.json +50 -40
  409. package/src/blueprints/automation/blueprint.ts +108 -0
  410. package/src/blueprints/automation/index.ts +5 -0
  411. package/src/blueprints/blueprint-manager/blueprint.conversations.json +1 -0
  412. package/src/blueprints/blueprint-manager/blueprint.test.ts +199 -0
  413. package/src/blueprints/blueprint-manager/blueprint.ts +50 -0
  414. package/src/blueprints/blueprint-manager/functions/definitions.ts +58 -0
  415. package/src/blueprints/blueprint-manager/functions/enable-blueprints.ts +44 -0
  416. package/src/blueprints/blueprint-manager/functions/index.ts +13 -0
  417. package/src/blueprints/blueprint-manager/functions/query-blueprints.ts +19 -0
  418. package/src/blueprints/blueprint-manager/functions/update-blueprints.ts +19 -0
  419. package/src/blueprints/blueprint-manager/index.ts +6 -0
  420. package/src/blueprints/browser/blueprint.conversations.json +1 -0
  421. package/src/blueprints/browser/blueprint.test.ts +63 -0
  422. package/src/blueprints/browser/blueprint.ts +41 -0
  423. package/src/blueprints/browser/index.ts +5 -0
  424. package/src/blueprints/database/blueprint.conversations.json +1 -0
  425. package/src/blueprints/database/blueprint.test.ts +532 -0
  426. package/src/blueprints/database/blueprint.ts +67 -0
  427. package/src/blueprints/database/functions/context-add.ts +24 -0
  428. package/src/blueprints/database/functions/context-remove.ts +24 -0
  429. package/src/blueprints/database/functions/definitions.ts +318 -0
  430. package/src/blueprints/database/functions/index.ts +23 -0
  431. package/src/blueprints/database/functions/load.ts +19 -0
  432. package/src/blueprints/database/functions/object-create.ts +38 -0
  433. package/src/blueprints/database/functions/object-delete.ts +20 -0
  434. package/src/blueprints/database/functions/object-update.ts +30 -0
  435. package/src/blueprints/database/functions/query.ts +64 -0
  436. package/src/blueprints/database/functions/relation-create.ts +34 -0
  437. package/src/blueprints/database/functions/relation-delete.ts +21 -0
  438. package/src/blueprints/database/functions/schema-add.ts +28 -0
  439. package/src/blueprints/database/functions/schema-list.ts +34 -0
  440. package/src/blueprints/database/functions/tag-add.ts +21 -0
  441. package/src/blueprints/database/functions/tag-remove.ts +21 -0
  442. package/src/blueprints/database/index.ts +21 -0
  443. package/src/blueprints/design/blueprint.test.ts +77 -0
  444. package/src/blueprints/design/{design-blueprint.ts → blueprint.ts} +20 -12
  445. package/src/blueprints/design/index.ts +1 -3
  446. package/src/blueprints/discord/blueprint.ts +42 -0
  447. package/src/blueprints/discord/functions/definitions.ts +71 -0
  448. package/src/blueprints/discord/functions/fetch-messages.test.ts +45 -0
  449. package/src/blueprints/discord/functions/fetch-messages.ts +199 -0
  450. package/src/blueprints/discord/functions/index.ts +9 -0
  451. package/src/blueprints/discord/index.ts +2 -3
  452. package/src/blueprints/github/functions/definitions.ts +27 -0
  453. package/src/blueprints/github/functions/fetch-prs.ts +24 -0
  454. package/src/blueprints/github/functions/index.ts +9 -0
  455. package/src/blueprints/github/index.ts +5 -0
  456. package/src/blueprints/index.ts +14 -6
  457. package/src/blueprints/linear/blueprint.ts +43 -0
  458. package/src/blueprints/linear/functions/definitions.ts +24 -0
  459. package/src/blueprints/linear/functions/index.ts +9 -0
  460. package/src/blueprints/linear/functions/linear.test.ts +59 -0
  461. package/src/{functions/linear → blueprints/linear/functions}/sync-issues.ts +40 -46
  462. package/src/blueprints/linear/index.ts +2 -3
  463. package/src/blueprints/markdown/blueprint.ts +36 -0
  464. package/src/blueprints/markdown/functions/create.ts +20 -0
  465. package/src/blueprints/markdown/functions/definitions.ts +80 -0
  466. package/src/blueprints/markdown/functions/index.ts +13 -0
  467. package/src/blueprints/markdown/functions/read.ts +22 -0
  468. package/src/blueprints/markdown/functions/update.ts +22 -0
  469. package/src/blueprints/markdown/index.ts +11 -0
  470. package/src/blueprints/memory/blueprint.conversations.json +1 -0
  471. package/src/blueprints/memory/blueprint.test.ts +139 -0
  472. package/src/blueprints/memory/blueprint.ts +42 -0
  473. package/src/blueprints/memory/functions/definitions.ts +68 -0
  474. package/src/blueprints/memory/functions/delete.ts +20 -0
  475. package/src/blueprints/memory/functions/index.ts +13 -0
  476. package/src/blueprints/memory/functions/query.ts +32 -0
  477. package/src/blueprints/memory/functions/save.ts +20 -0
  478. package/src/blueprints/memory/index.ts +6 -0
  479. package/src/blueprints/planning/blueprint.ts +25 -0
  480. package/src/blueprints/planning/functions/definitions.ts +137 -0
  481. package/src/blueprints/planning/functions/index.ts +9 -0
  482. package/src/blueprints/planning/functions/update-tasks.ts +45 -0
  483. package/src/blueprints/planning/index.ts +3 -4
  484. package/src/blueprints/{planning/planning-blueprint.test.ts → planning-old/blueprint.test.ts} +23 -40
  485. package/src/blueprints/{planning/planning-blueprint.ts → planning-old/blueprint.ts} +20 -12
  486. package/src/blueprints/planning-old/functions/definitions.ts +53 -0
  487. package/src/blueprints/planning-old/functions/index.ts +12 -0
  488. package/src/blueprints/planning-old/functions/read.ts +24 -0
  489. package/src/blueprints/planning-old/functions/update.ts +31 -0
  490. package/src/blueprints/planning-old/index.ts +6 -0
  491. package/src/blueprints/project/blueprint.conversations.json +1 -0
  492. package/src/blueprints/project/blueprint.test.ts +626 -0
  493. package/src/blueprints/project/blueprint.ts +65 -0
  494. package/src/blueprints/project/functions/add-artifact.ts +30 -0
  495. package/src/blueprints/project/functions/agent.ts +68 -0
  496. package/src/blueprints/project/functions/definitions.ts +92 -0
  497. package/src/blueprints/project/functions/get-context.ts +46 -0
  498. package/src/blueprints/project/functions/index.ts +14 -0
  499. package/src/blueprints/project/functions/qualifier.ts +90 -0
  500. package/src/blueprints/project/index.ts +6 -0
  501. package/src/blueprints/project-wizard/blueprint.ts +48 -0
  502. package/src/blueprints/project-wizard/functions/create-project.ts +33 -0
  503. package/src/blueprints/project-wizard/functions/definitions.ts +64 -0
  504. package/src/blueprints/project-wizard/functions/index.ts +13 -0
  505. package/src/blueprints/project-wizard/functions/project-rules.ts +77 -0
  506. package/src/blueprints/project-wizard/functions/sync-triggers.ts +135 -0
  507. package/src/blueprints/project-wizard/index.ts +6 -0
  508. package/src/blueprints/research/{research-blueprint.ts → blueprint.ts} +21 -13
  509. package/src/blueprints/research/functions/definitions.ts +87 -0
  510. package/src/blueprints/research/functions/document-create.ts +50 -0
  511. package/src/blueprints/research/functions/index.ts +12 -0
  512. package/src/{functions/research → blueprints/research/functions}/research-instructions.tpl +5 -5
  513. package/src/blueprints/research/functions/research.conversations.json +1 -0
  514. package/src/blueprints/research/functions/research.test.ts +149 -0
  515. package/src/blueprints/research/functions/research.ts +138 -0
  516. package/src/blueprints/research/index.ts +3 -3
  517. package/src/blueprints/research/types/ResearchGraph.ts +96 -0
  518. package/src/{functions/research/types.ts → blueprints/research/types/index.ts} +12 -6
  519. package/src/blueprints/testing.ts +32 -8
  520. package/src/blueprints/websearch/blueprint.conversations.json +1 -0
  521. package/src/blueprints/websearch/blueprint.test.ts +39 -0
  522. package/src/blueprints/websearch/blueprint.ts +31 -0
  523. package/src/blueprints/websearch/functions/definitions.ts +25 -0
  524. package/src/blueprints/websearch/functions/fetch.ts +18 -0
  525. package/src/blueprints/websearch/functions/index.ts +9 -0
  526. package/src/blueprints/websearch/index.ts +3 -4
  527. package/src/blueprints/websearch/{websearch-toolkit.ts → toolkit.ts} +6 -1
  528. package/src/crud/graph.test.ts +13 -38
  529. package/src/crud/graph.ts +33 -41
  530. package/src/errors.ts +25 -0
  531. package/src/functions/READ_THIS.md +5 -0
  532. package/src/functions/agent/definitions.ts +53 -0
  533. package/src/functions/agent/index.ts +3 -5
  534. package/src/functions/agent/prompt.conversations.json +1 -0
  535. package/src/functions/agent/prompt.test.ts +83 -0
  536. package/src/functions/agent/prompt.ts +211 -102
  537. package/src/functions/entity-extraction/definitions.ts +36 -0
  538. package/src/functions/entity-extraction/entity-extraction.conversations.json +1 -1
  539. package/src/functions/entity-extraction/entity-extraction.test.ts +15 -33
  540. package/src/functions/entity-extraction/entity-extraction.ts +81 -90
  541. package/src/functions/entity-extraction/index.ts +4 -4
  542. package/src/functions/exa/definitions.ts +37 -0
  543. package/src/functions/exa/exa.ts +22 -27
  544. package/src/functions/exa/index.ts +8 -2
  545. package/src/functions/exa/mock.ts +26 -35
  546. package/src/functions/index.ts +1 -5
  547. package/src/index.ts +2 -2
  548. package/src/sync/sync.ts +38 -30
  549. package/src/testing/index.ts +2 -1
  550. package/src/testing/plugins.tsx +77 -0
  551. package/src/toolkits/WebToolkit.ts +33 -0
  552. package/src/toolkits/index.ts +1 -2
  553. package/src/types/Agent.ts +219 -0
  554. package/src/types/Chat.ts +62 -0
  555. package/src/types/McpServer.ts +37 -0
  556. package/src/types/Memory.ts +24 -0
  557. package/src/types/Plan.ts +110 -0
  558. package/src/types/index.ts +9 -0
  559. package/dist/lib/browser/index.mjs.map +0 -7
  560. package/dist/lib/browser/meta.json +0 -1
  561. package/dist/lib/node-esm/index.mjs +0 -2778
  562. package/dist/lib/node-esm/index.mjs.map +0 -7
  563. package/dist/lib/node-esm/meta.json +0 -1
  564. package/dist/types/src/blueprints/design/design-blueprint.d.ts +0 -4
  565. package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +0 -1
  566. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts +0 -2
  567. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts.map +0 -1
  568. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +0 -18
  569. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +0 -1
  570. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +0 -18
  571. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +0 -1
  572. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +0 -4
  573. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +0 -1
  574. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts +0 -2
  575. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts.map +0 -1
  576. package/dist/types/src/blueprints/research/research-blueprint.d.ts +0 -4
  577. package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +0 -1
  578. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts +0 -2
  579. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts.map +0 -1
  580. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +0 -4
  581. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +0 -1
  582. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts.map +0 -1
  583. package/dist/types/src/experimental/feed.test.d.ts +0 -2
  584. package/dist/types/src/experimental/feed.test.d.ts.map +0 -1
  585. package/dist/types/src/functions/discord/fetch-messages.d.ts.map +0 -1
  586. package/dist/types/src/functions/discord/fetch-messages.test.d.ts.map +0 -1
  587. package/dist/types/src/functions/discord/index.d.ts +0 -12
  588. package/dist/types/src/functions/discord/index.d.ts.map +0 -1
  589. package/dist/types/src/functions/document/index.d.ts +0 -13
  590. package/dist/types/src/functions/document/index.d.ts.map +0 -1
  591. package/dist/types/src/functions/document/read.d.ts +0 -7
  592. package/dist/types/src/functions/document/read.d.ts.map +0 -1
  593. package/dist/types/src/functions/document/update.d.ts +0 -6
  594. package/dist/types/src/functions/document/update.d.ts.map +0 -1
  595. package/dist/types/src/functions/github/fetch-prs.d.ts +0 -6
  596. package/dist/types/src/functions/github/fetch-prs.d.ts.map +0 -1
  597. package/dist/types/src/functions/linear/index.d.ts +0 -9
  598. package/dist/types/src/functions/linear/index.d.ts.map +0 -1
  599. package/dist/types/src/functions/linear/linear.test.d.ts.map +0 -1
  600. package/dist/types/src/functions/linear/sync-issues.d.ts +0 -12
  601. package/dist/types/src/functions/linear/sync-issues.d.ts.map +0 -1
  602. package/dist/types/src/functions/research/document-create.d.ts +0 -9
  603. package/dist/types/src/functions/research/document-create.d.ts.map +0 -1
  604. package/dist/types/src/functions/research/index.d.ts +0 -21
  605. package/dist/types/src/functions/research/index.d.ts.map +0 -1
  606. package/dist/types/src/functions/research/research-graph.d.ts +0 -18
  607. package/dist/types/src/functions/research/research-graph.d.ts.map +0 -1
  608. package/dist/types/src/functions/research/research.d.ts +0 -14
  609. package/dist/types/src/functions/research/research.d.ts.map +0 -1
  610. package/dist/types/src/functions/research/research.test.d.ts.map +0 -1
  611. package/dist/types/src/functions/research/types.d.ts +0 -6
  612. package/dist/types/src/functions/research/types.d.ts.map +0 -1
  613. package/dist/types/src/functions/tasks/index.d.ts +0 -15
  614. package/dist/types/src/functions/tasks/index.d.ts.map +0 -1
  615. package/dist/types/src/functions/tasks/read.d.ts +0 -7
  616. package/dist/types/src/functions/tasks/read.d.ts.map +0 -1
  617. package/dist/types/src/functions/tasks/task-list.d.ts.map +0 -1
  618. package/dist/types/src/functions/tasks/task-list.test.d.ts.map +0 -1
  619. package/dist/types/src/functions/tasks/update.d.ts +0 -9
  620. package/dist/types/src/functions/tasks/update.d.ts.map +0 -1
  621. package/dist/types/src/plugins.d.ts +0 -19
  622. package/dist/types/src/plugins.d.ts.map +0 -1
  623. package/dist/types/src/testing/data/exa-search-1748337321991.d.ts.map +0 -1
  624. package/dist/types/src/testing/data/exa-search-1748337331526.d.ts.map +0 -1
  625. package/dist/types/src/testing/data/exa-search-1748337344119.d.ts.map +0 -1
  626. package/dist/types/src/testing/data/index.d.ts.map +0 -1
  627. package/dist/types/src/toolkits/AssistantToolkit.d.ts +0 -17
  628. package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +0 -1
  629. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts +0 -2
  630. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts.map +0 -1
  631. package/dist/types/src/toolkits/SystemToolkit.d.ts +0 -67
  632. package/dist/types/src/toolkits/SystemToolkit.d.ts.map +0 -1
  633. package/src/blueprints/design/design-blueprint.test.ts +0 -103
  634. package/src/blueprints/discord/discord-blueprint.ts +0 -34
  635. package/src/blueprints/linear/linear-blueprint.ts +0 -35
  636. package/src/blueprints/websearch/websearch-blueprint.ts +0 -20
  637. package/src/experimental/feed.test.ts +0 -111
  638. package/src/functions/discord/fetch-messages.test.ts +0 -58
  639. package/src/functions/discord/fetch-messages.ts +0 -252
  640. package/src/functions/discord/index.ts +0 -9
  641. package/src/functions/document/index.ts +0 -12
  642. package/src/functions/document/read.ts +0 -29
  643. package/src/functions/document/update.ts +0 -30
  644. package/src/functions/github/fetch-prs.ts +0 -30
  645. package/src/functions/linear/index.ts +0 -9
  646. package/src/functions/linear/linear.test.ts +0 -83
  647. package/src/functions/research/document-create.ts +0 -75
  648. package/src/functions/research/index.ts +0 -14
  649. package/src/functions/research/research-graph.ts +0 -47
  650. package/src/functions/research/research.conversations.json +0 -1
  651. package/src/functions/research/research.test.ts +0 -179
  652. package/src/functions/research/research.ts +0 -190
  653. package/src/functions/tasks/index.ts +0 -11
  654. package/src/functions/tasks/read.ts +0 -34
  655. package/src/functions/tasks/update.ts +0 -52
  656. package/src/plugins.tsx +0 -68
  657. package/src/toolkits/AssistantToolkit.conversations.json +0 -1
  658. package/src/toolkits/AssistantToolkit.test.ts +0 -88
  659. package/src/toolkits/AssistantToolkit.ts +0 -47
  660. package/src/toolkits/SystemToolkit.ts +0 -231
  661. /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.d.ts +0 -0
  662. /package/dist/types/src/{functions/linear → blueprints/linear/functions}/linear.test.d.ts +0 -0
  663. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.d.ts +0 -0
  664. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.d.ts +0 -0
  665. /package/dist/types/src/{functions/research → blueprints/research/functions}/research.test.d.ts +0 -0
  666. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337321991.d.ts +0 -0
  667. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337331526.d.ts +0 -0
  668. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337344119.d.ts +0 -0
  669. /package/dist/types/src/{testing → functions/exa}/data/index.d.ts +0 -0
  670. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.ts +0 -0
  671. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.ts +0 -0
  672. /package/src/blueprints/research/{research-blueprint.test.ts → blueprint.test.ts} +0 -0
  673. /package/src/{testing → functions/exa}/data/exa-search-1748337321991.ts +0 -0
  674. /package/src/{testing → functions/exa}/data/exa-search-1748337331526.ts +0 -0
  675. /package/src/{testing → functions/exa}/data/exa-search-1748337344119.ts +0 -0
  676. /package/src/{testing → functions/exa}/data/index.ts +0 -0
@@ -1,809 +1,13 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // src/blueprints/design/design-blueprint.ts
8
- import { ToolId } from "@dxos/ai";
9
- import { Blueprint } from "@dxos/blueprints";
10
- import { Obj as Obj10, Ref as Ref6 } from "@dxos/echo";
11
- import { Text as Text2 } from "@dxos/schema";
12
- import { trim as trim5 } from "@dxos/util";
13
-
14
- // src/functions/agent/prompt.ts
15
- import * as Array2 from "effect/Array";
16
- import * as Effect from "effect/Effect";
17
- import * as Function from "effect/Function";
18
- import * as Match from "effect/Match";
19
- import * as Option from "effect/Option";
20
- import * as Schema from "effect/Schema";
21
- import { AiService, ConsolePrinter, ModelName } from "@dxos/ai";
22
- import { AiSession, GenerationObserver, createToolkit } from "@dxos/assistant";
23
- import { Prompt, Template } from "@dxos/blueprints";
24
- import { Obj, Ref, Type } from "@dxos/echo";
25
- import { DatabaseService, TracingService, defineFunction } from "@dxos/functions";
26
- import { log } from "@dxos/log";
27
- var __dxlog_file = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/agent/prompt.ts";
28
- var DEFAULT_MODEL = "@anthropic/claude-opus-4-0";
29
- var prompt_default = defineFunction({
30
- key: "dxos.org/function/prompt",
31
- name: "Agent",
32
- description: "Agentic worker that executes a provided prompt using blueprints and tools.",
33
- inputSchema: Schema.Struct({
34
- prompt: Type.Ref(Prompt.Prompt),
35
- systemPrompt: Type.Ref(Prompt.Prompt).pipe(Schema.optional),
36
- /**
37
- * @default @anthropic/claude-opus-4-0
38
- */
39
- model: Schema.optional(ModelName),
40
- /**
41
- * Input object or data.
42
- * References get auto-resolved.
43
- */
44
- input: Schema.Any.pipe(Schema.annotations({
45
- title: "Input"
46
- }))
47
- }),
48
- outputSchema: Schema.Any,
49
- handler: Effect.fnUntraced(function* ({ data }) {
50
- log.info("processing input", {
51
- input: data.input
52
- }, {
53
- F: __dxlog_file,
54
- L: 40,
55
- S: this,
56
- C: (f, a) => f(...a)
57
- });
58
- const input = yield* Match.value(data.input).pipe(Match.when((value2) => Ref.isRef(value2), Effect.fnUntraced(function* (ref) {
59
- const object = yield* DatabaseService.load(ref);
60
- return Obj.toJSON(object);
61
- })), Match.orElse(() => Effect.succeed(data.input)));
62
- yield* DatabaseService.flush({
63
- indexes: true
64
- });
65
- const prompt = yield* DatabaseService.load(data.prompt);
66
- const systemPrompt = data.systemPrompt ? yield* DatabaseService.load(data.systemPrompt) : void 0;
67
- yield* TracingService.emitStatus({
68
- message: `Running ${prompt.id}`
69
- });
70
- log.info("starting agent", {
71
- prompt: prompt.id,
72
- input
73
- }, {
74
- F: __dxlog_file,
75
- L: 70,
76
- S: this,
77
- C: (f, a) => f(...a)
78
- });
79
- const blueprints = yield* Function.pipe(prompt.blueprints, Array2.appendAll(systemPrompt?.blueprints ?? []), Effect.forEach(DatabaseService.loadOption), Effect.map(Array2.filter(Option.isSome)), Effect.map(Array2.map((option) => option.value)));
80
- const objects = yield* Function.pipe(prompt.context, Array2.appendAll(systemPrompt?.context ?? []), Effect.forEach(DatabaseService.loadOption), Effect.map(Array2.filter(Option.isSome)), Effect.map(Array2.map((option) => option.value)));
81
- const toolkit = yield* createToolkit({
82
- blueprints
83
- });
84
- const promptInstructions = yield* DatabaseService.load(prompt.instructions.source);
85
- const promptText = Template.process(promptInstructions.content, input);
86
- const systemInstructions = systemPrompt ? yield* DatabaseService.load(systemPrompt.instructions.source) : void 0;
87
- const systemText = systemInstructions ? Template.process(systemInstructions.content, {}) : void 0;
88
- const session = new AiSession();
89
- const result = yield* session.run({
90
- prompt: promptText,
91
- system: systemText,
92
- blueprints,
93
- objects,
94
- toolkit,
95
- observer: GenerationObserver.fromPrinter(new ConsolePrinter({
96
- tag: "agent"
97
- }))
98
- }).pipe(Effect.provide(AiService.model(data.model ?? DEFAULT_MODEL)));
99
- const lastBlock = result.at(-1)?.blocks.filter((block) => block._tag === "text").at(-1);
100
- return {
101
- note: lastBlock?.text
102
- };
103
- })
104
- });
105
-
106
- // src/functions/agent/index.ts
107
- (function(Agent2) {
108
- Agent2.prompt = prompt_default;
109
- })(Agent || (Agent = {}));
110
- var Agent;
111
-
112
- // src/functions/discord/fetch-messages.ts
113
- import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
114
- import { DiscordConfig, DiscordREST, DiscordRESTMemoryLive } from "dfx";
115
- import * as Array3 from "effect/Array";
116
- import * as Effect2 from "effect/Effect";
117
- import * as Function2 from "effect/Function";
118
- import * as Layer from "effect/Layer";
119
- import * as Option2 from "effect/Option";
120
- import * as Schema2 from "effect/Schema";
121
- import { Obj as Obj2 } from "@dxos/echo";
122
- import { CredentialsService, TracingService as TracingService2, defineFunction as defineFunction2 } from "@dxos/functions";
123
- import { log as log2 } from "@dxos/log";
124
- import { Message } from "@dxos/types";
125
- var __dxlog_file2 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/discord/fetch-messages.ts";
126
- var TimeRange = class extends Schema2.String.pipe(Schema2.pattern(/\d+(s|m|h|d)/)).annotations({
127
- description: "Time range. 1d - 1 day, 2h - 2 hours, 30m - 30 minutes, 15s - 15 seconds.",
128
- examples: [
129
- "1d",
130
- "2h",
131
- "30m",
132
- "15s"
133
- ]
134
- }) {
135
- static toSeconds(timeRange) {
136
- const match = timeRange.match(/(\d+)(s|m|h|d)/);
137
- if (!match) {
138
- throw new Error(`Invalid time range: ${timeRange}`);
139
- }
140
- const [_, amount, unit] = match;
141
- switch (unit) {
142
- case "s":
143
- return Number(amount);
144
- case "m":
145
- return Number(amount) * 60;
146
- case "h":
147
- return Number(amount) * 60 * 60;
148
- case "d":
149
- return Number(amount) * 24 * 60 * 60;
150
- default:
151
- throw new Error(`Invalid time range unit: ${unit}`);
152
- }
153
- }
154
- };
155
- var DiscordConfigFromCredential = Layer.unwrapEffect(Effect2.gen(function* () {
156
- return DiscordConfig.layer({
157
- token: yield* CredentialsService.getApiKey({
158
- service: "discord.com"
159
- }),
160
- rest: {
161
- baseUrl: "https://api-proxy.dxos.workers.dev/discord.com/api/v10"
162
- }
163
- });
164
- }));
165
- var DEFAULT_AFTER = 1704067200;
166
- var DEFAULT_LIMIT = 500;
167
- var DEFAULT_IGNORE_USERNAMES = [
168
- "GitHub",
169
- "Needle"
170
- ];
171
- var fetch_messages_default = defineFunction2({
172
- key: "dxos.org/function/fetch-discord-messages",
173
- name: "Sync Discord messages",
174
- inputSchema: Schema2.Struct({
175
- serverId: Schema2.String.annotations({
176
- description: "The ID of the server to fetch messages from."
177
- }),
178
- channelId: Schema2.optional(Schema2.String).annotations({
179
- description: "The ID of the channel to fetch messages from. Will crawl all channels from the server if not specified."
180
- }),
181
- after: Schema2.optional(Schema2.Number).annotations({
182
- description: "Fetch messages that were sent after a given date. Unix timestamp in seconds. Exclusive with `last`."
183
- }),
184
- last: TimeRange.annotations({
185
- description: 'Time range to fetch most recent messages. Specifies the range in the past, from now. "1d" would fetch messages from the last 24 hours.'
186
- }),
187
- limit: Schema2.optional(Schema2.Number).annotations({
188
- description: "The maximum number of messages to fetch."
189
- }),
190
- pageSize: Schema2.optional(Schema2.Number).annotations({
191
- description: "The number of messages to fetch per page."
192
- }),
193
- ignoreUsernames: Schema2.optional(Schema2.Array(Schema2.String)).annotations({
194
- description: "Exclude messages from these usernames."
195
- })
196
- }),
197
- handler: Effect2.fnUntraced(function* ({ data: { serverId, channelId, after, last: last2, pageSize = 100, limit = DEFAULT_LIMIT, ignoreUsernames = DEFAULT_IGNORE_USERNAMES } }) {
198
- if (!after && !last2) {
199
- throw new Error("cannot specify both `after` and `last`");
200
- }
201
- const afterTs = last2 ? Date.now() / 1e3 - TimeRange.toSeconds(last2) : after ?? DEFAULT_AFTER;
202
- const rest = yield* DiscordREST;
203
- let channels = [];
204
- channels.push(...yield* rest.listGuildChannels(serverId));
205
- const { threads: guildThreads } = yield* rest.getActiveGuildThreads(serverId);
206
- channels.push(...guildThreads);
207
- if (channelId) {
208
- channels = channels.filter((channel) => channel.id === channelId);
209
- }
210
- if (channels.length === 0) {
211
- throw new Error("no channels found");
212
- }
213
- for (const channel of channels) {
214
- console.log(channel.id, "name" in channel ? channel.name : void 0);
215
- }
216
- yield* TracingService2.emitStatus({
217
- message: `Will fetch from channels: ${channels.length}`
218
- });
219
- const threads = yield* Effect2.forEach(channels, Effect2.fnUntraced(function* (channel) {
220
- const allMessages = [];
221
- let lastMessage = Option2.none();
222
- while (true) {
223
- const { id: lastId = void 0 } = Function2.pipe(lastMessage, Option2.map(Obj2.getKeys("discord.com")), Option2.flatMap(Option2.fromIterable), Option2.getOrElse(() => ({
224
- id: void 0
225
- })));
226
- const options = {
227
- after: !lastId ? `${generateSnowflake(afterTs)}` : lastId,
228
- limit: pageSize
229
- };
230
- log2.info("fetching messages", {
231
- lastId,
232
- afterTs,
233
- afterSnowflake: options.after,
234
- after: parseSnowflake(options.after),
235
- limit: options.limit
236
- }, {
237
- F: __dxlog_file2,
238
- L: 159,
239
- S: this,
240
- C: (f, a) => f(...a)
241
- });
242
- const messages = yield* rest.listMessages(channel.id, options).pipe(Effect2.map(Array3.map(makeMessage)), Effect2.map(Array3.reverse), Effect2.catchTag("ErrorResponse", (err) => err.cause.code === 50001 ? Effect2.succeed([]) : Effect2.fail(err)));
243
- if (messages.length > 0) {
244
- lastMessage = Option2.fromNullable(messages.at(-1));
245
- allMessages.push(...messages);
246
- } else {
247
- break;
248
- }
249
- yield* TracingService2.emitStatus({
250
- message: `Fetched messages: ${allMessages.length}`
251
- });
252
- if (allMessages.length >= limit) {
253
- break;
254
- }
255
- }
256
- return {
257
- discordChannelId: channel.id,
258
- name: "name" in channel ? channel.name ?? void 0 : void 0,
259
- messages: allMessages.filter((message) => !message.sender.name || !ignoreUsernames.includes(message.sender.name)).filter((message) => message.blocks.some((block) => block._tag === "text" && block.text.trim().length > 0))
260
- };
261
- }), {
262
- concurrency: 10
263
- });
264
- return threads.filter((thread) => thread.messages.length > 0).map(serializeThread).join("\n");
265
- }, Effect2.provide(DiscordRESTMemoryLive.pipe(Layer.provideMerge(DiscordConfigFromCredential)).pipe(Layer.provide(FetchHttpClient.layer))), Effect2.orDie)
266
- });
267
- var generateSnowflake = (unixTimestamp) => {
268
- const discordEpoch = 1420070400000n;
269
- return BigInt(unixTimestamp * 1e3) - discordEpoch << 22n;
270
- };
271
- var parseSnowflake = (snowflake) => {
272
- const discordEpoch = 1420070400000n;
273
- return new Date(Number((BigInt(snowflake) >> 22n) + discordEpoch));
274
- };
275
- var makeMessage = (message) => Obj2.make(Message.Message, {
276
- [Obj2.Meta]: {
277
- keys: [
278
- {
279
- id: message.id,
280
- source: "discord.com"
281
- },
282
- {
283
- id: message.channel_id,
284
- source: "discord.com/thread"
285
- }
286
- ]
287
- },
288
- sender: {
289
- name: message.author.username
290
- },
291
- created: message.timestamp,
292
- blocks: [
293
- {
294
- _tag: "text",
295
- text: message.content
296
- }
297
- ]
298
- });
299
- var serializeThread = (thread) => {
300
- return `<thread id=${thread.discordChannelId} name=${thread.name ?? ""}>
301
- ${thread.messages.map((message) => ` ${message.sender.name}: ${message.blocks.filter((block) => block._tag === "text").map((block) => block.text).join(" ")}`).join("\n")}
302
- </thread>`;
303
- };
304
-
305
- // src/functions/discord/index.ts
306
- (function(Discord2) {
307
- Discord2.fetch = fetch_messages_default;
308
- })(Discord || (Discord = {}));
309
- var Discord;
310
-
311
- // src/functions/document/read.ts
312
- import * as Effect3 from "effect/Effect";
313
- import * as Schema3 from "effect/Schema";
314
- import { ArtifactId } from "@dxos/assistant";
315
- import { DatabaseService as DatabaseService2, defineFunction as defineFunction3 } from "@dxos/functions";
316
- import { Markdown } from "@dxos/plugin-markdown/types";
317
- var read_default = defineFunction3({
318
- key: "dxos.org/function/markdown/read",
319
- name: "Read markdown document",
320
- description: "Read markdown document.",
321
- inputSchema: Schema3.Struct({
322
- id: ArtifactId.annotations({
323
- description: "The ID of the document to read."
324
- })
325
- }),
326
- outputSchema: Schema3.Struct({
327
- content: Schema3.String
328
- }),
329
- handler: Effect3.fn(function* ({ data: { id } }) {
330
- const doc = yield* DatabaseService2.resolve(ArtifactId.toDXN(id), Markdown.Document);
331
- const { content } = yield* DatabaseService2.load(doc.content);
332
- return {
333
- content
334
- };
335
- })
336
- });
337
-
338
- // src/functions/document/update.ts
339
- import * as Effect4 from "effect/Effect";
340
- import * as Schema4 from "effect/Schema";
341
- import { ArtifactId as ArtifactId2 } from "@dxos/assistant";
342
- import { DatabaseService as DatabaseService3, defineFunction as defineFunction4 } from "@dxos/functions";
343
- import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
344
- var update_default = defineFunction4({
345
- key: "dxos.org/function/markdown/update",
346
- name: "Update markdown",
347
- description: "Updates the entire contents of the markdown document.",
348
- inputSchema: Schema4.Struct({
349
- id: ArtifactId2.annotations({
350
- description: "The ID of the document to write."
351
- }),
352
- content: Schema4.String.annotations({
353
- description: "New content to write to the document."
354
- })
355
- }),
356
- outputSchema: Schema4.Void,
357
- handler: Effect4.fn(function* ({ data: { id, content } }) {
358
- const doc = yield* DatabaseService3.resolve(ArtifactId2.toDXN(id), Markdown2.Document);
359
- const text = yield* DatabaseService3.load(doc.content);
360
- text.content = content;
361
- })
362
- });
363
-
364
- // src/functions/document/index.ts
365
- (function(Document2) {
366
- Document2.read = read_default;
367
- Document2.update = update_default;
368
- })(Document || (Document = {}));
369
- var Document;
370
-
371
- // src/functions/entity-extraction/entity-extraction.ts
372
- import * as Toolkit3 from "@effect/ai/Toolkit";
373
- import * as Effect11 from "effect/Effect";
374
- import * as Layer4 from "effect/Layer";
375
- import * as Predicate from "effect/Predicate";
376
- import * as Schema11 from "effect/Schema";
377
- import { AiService as AiService3 } from "@dxos/ai";
378
- import { AiSession as AiSession3, makeToolExecutionServiceFromFunctions as makeToolExecutionServiceFromFunctions2, makeToolResolverFromFunctions as makeToolResolverFromFunctions2 } from "@dxos/assistant";
379
- import { Filter as Filter2, Obj as Obj7, Ref as Ref3 } from "@dxos/echo";
380
- import { DatabaseService as DatabaseService8, defineFunction as defineFunction9 } from "@dxos/functions";
381
- import { FunctionInvocationServiceLayerTest } from "@dxos/functions-runtime/testing";
382
- import { log as log5 } from "@dxos/log";
383
- import { LegacyOrganization as LegacyOrganization2, Message as Message2, Organization, Person as Person2 } from "@dxos/types";
384
- import { trim as trim4 } from "@dxos/util";
385
-
386
- // src/crud/graph.ts
387
- import * as Tool from "@effect/ai/Tool";
388
- import * as Toolkit from "@effect/ai/Toolkit";
389
- import * as Context from "effect/Context";
390
- import * as Effect5 from "effect/Effect";
391
- import * as Function3 from "effect/Function";
392
- import * as Option3 from "effect/Option";
393
- import * as Schema5 from "effect/Schema";
394
- import * as SchemaAST from "effect/SchemaAST";
395
- import { Obj as Obj3 } from "@dxos/echo";
396
- import { Filter, Query } from "@dxos/echo";
397
- import { EntityKind, ObjectId, ReferenceAnnotationId, RelationSourceDXNId, RelationSourceId, RelationTargetDXNId, RelationTargetId, create, getEntityKind, getSchemaDXN, getSchemaTypename, getTypeAnnotation, getTypeIdentifierAnnotation } from "@dxos/echo/internal";
398
- import { isEncodedReference } from "@dxos/echo-protocol";
399
- import { mapAst } from "@dxos/effect";
400
- import { ContextQueueService, DatabaseService as DatabaseService4 } from "@dxos/functions";
401
- import { DXN } from "@dxos/keys";
402
- import { log as log3 } from "@dxos/log";
403
- import { deepMapValues, isNonNullable, trim } from "@dxos/util";
404
- var __dxlog_file3 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/crud/graph.ts";
405
- var Subgraph = Schema5.Struct({
406
- /** Objects and relations. */
407
- objects: Schema5.Array(Schema5.Any)
408
- });
409
- var findRelatedSchema = async (db, anchor) => {
410
- const allSchemas = [
411
- ...db.graph.schemaRegistry.schemas
412
- ];
413
- return allSchemas.filter((schema) => {
414
- if (getTypeAnnotation(schema)?.kind !== EntityKind.Relation) {
415
- return false;
416
- }
417
- return isSchemaAddressableByDxn(anchor, DXN.parse(getTypeAnnotation(schema).sourceSchema)) || isSchemaAddressableByDxn(anchor, DXN.parse(getTypeAnnotation(schema).targetSchema));
418
- }).map((schema) => ({
419
- schema,
420
- kind: "relation"
421
- }));
422
- };
423
- var isSchemaAddressableByDxn = (schema, dxn) => {
424
- if (getTypeIdentifierAnnotation(schema) === dxn.toString()) {
425
- return true;
426
- }
427
- const t = dxn.asTypeDXN();
428
- if (t) {
429
- return t.type === getSchemaTypename(schema);
430
- }
431
- return false;
432
- };
433
- var LocalSearchToolkit = Toolkit.make(Tool.make("search_local_search", {
434
- description: "Search the local database for information using a vector index",
435
- parameters: {
436
- query: Schema5.String.annotations({
437
- description: "The query to search for. Could be a question or a topic or a set of keywords."
438
- })
439
- },
440
- success: Schema5.Unknown,
441
- failure: Schema5.Never,
442
- dependencies: [
443
- DatabaseService4
444
- ]
445
- }));
446
- var LocalSearchHandler = LocalSearchToolkit.toLayer({
447
- search_local_search: Effect5.fn(function* ({ query }) {
448
- const { objects } = yield* DatabaseService4.runQuery(Query.select(Filter.text(query, {
449
- type: "vector"
450
- })));
451
- const results = [
452
- ...objects
453
- ];
454
- const option = yield* Effect5.serviceOption(ContextQueueService);
455
- if (Option3.isSome(option)) {
456
- const queueObjects = yield* Effect5.promise(() => option.value.queue.queryObjects());
457
- results.push(...queueObjects);
458
- }
459
- return trim`
460
- <local_context>
461
- ${JSON.stringify(results, null, 2)}
462
- </local_context>
463
- `;
464
- })
465
- });
466
- var GraphWriterSchema = class extends Context.Tag("@dxos/assistant/GraphWriterSchema")() {
467
- };
468
- var makeGraphWriterToolkit = ({ schema }) => {
469
- return Toolkit.make(Tool.make("graph_writer", {
470
- description: "Write to the local graph database",
471
- parameters: createExtractionSchema(schema).fields,
472
- success: Schema5.Unknown,
473
- failure: Schema5.Never,
474
- dependencies: [
475
- DatabaseService4,
476
- ContextQueueService
477
- ]
478
- }).annotateContext(Context.make(GraphWriterSchema, {
479
- schema
480
- })));
481
- };
482
- var makeGraphWriterHandler = (toolkit, { onAppend } = {}) => {
483
- const { schema } = Context.get(toolkit.tools.graph_writer.annotations, GraphWriterSchema);
484
- return toolkit.toLayer({
485
- graph_writer: Effect5.fn(function* (input) {
486
- const { db } = yield* DatabaseService4;
487
- const { queue } = yield* ContextQueueService;
488
- const data = yield* Effect5.promise(() => sanitizeObjects(schema, input, db, queue));
489
- yield* Effect5.promise(() => queue.append(data));
490
- const dxns = data.map((obj) => Obj3.getDXN(obj));
491
- onAppend?.(dxns);
492
- return dxns;
493
- })
494
- });
495
- };
496
- var createExtractionSchema = (types) => {
497
- return Schema5.Struct({
498
- ...Object.fromEntries(types.map(preprocessSchema).map((schema, index) => [
499
- `objects_${getSanitizedSchemaName(types[index])}`,
500
- Schema5.optional(Schema5.Array(schema)).annotations({
501
- description: `The objects of type: ${getSchemaDXN(types[index])?.asTypeDXN().type}. ${SchemaAST.getDescriptionAnnotation(types[index].ast).pipe(Option3.getOrElse(() => ""))}`
502
- })
503
- ]))
504
- });
505
- };
506
- var getSanitizedSchemaName = (schema) => {
507
- return getSchemaDXN(schema).asTypeDXN().type.replaceAll(/[^a-zA-Z0-9]+/g, "_");
508
- };
509
- var sanitizeObjects = async (types, data, db, queue) => {
510
- const entries = types.map((type) => data[`objects_${getSanitizedSchemaName(type)}`]?.map((object) => ({
511
- data: object,
512
- schema: type
513
- })) ?? []).flat();
514
- const idMap = /* @__PURE__ */ new Map();
515
- const existingIds = /* @__PURE__ */ new Set();
516
- const enitties = /* @__PURE__ */ new Map();
517
- const resolveId = (id) => {
518
- if (ObjectId.isValid(id)) {
519
- existingIds.add(id);
520
- return DXN.fromLocalObjectId(id);
521
- }
522
- const mappedId = idMap.get(id);
523
- if (mappedId) {
524
- return DXN.fromLocalObjectId(mappedId);
525
- }
526
- return void 0;
527
- };
528
- const res = entries.map((entry) => {
529
- if (ObjectId.isValid(entry.data.id)) {
530
- return entry;
531
- }
532
- idMap.set(entry.data.id, ObjectId.random());
533
- entry.data.id = idMap.get(entry.data.id);
534
- return entry;
535
- }).map((entry) => {
536
- const data2 = deepMapValues(entry.data, (value2, recurse) => {
537
- if (isEncodedReference(value2)) {
538
- const ref = value2["/"];
539
- const id = resolveId(ref);
540
- if (id) {
541
- return {
542
- "/": id.toString()
543
- };
544
- } else {
545
- return {
546
- "/": `search:?q=${encodeURIComponent(ref)}`
547
- };
548
- }
549
- }
550
- return recurse(value2);
551
- });
552
- if (getEntityKind(entry.schema) === "relation") {
553
- const sourceDxn = resolveId(data2.source);
554
- if (!sourceDxn) {
555
- log3.warn("source not found", {
556
- source: data2.source
557
- }, {
558
- F: __dxlog_file3,
559
- L: 281,
560
- S: void 0,
561
- C: (f, a) => f(...a)
562
- });
563
- }
564
- const targetDxn = resolveId(data2.target);
565
- if (!targetDxn) {
566
- log3.warn("target not found", {
567
- target: data2.target
568
- }, {
569
- F: __dxlog_file3,
570
- L: 285,
571
- S: void 0,
572
- C: (f, a) => f(...a)
573
- });
574
- }
575
- delete data2.source;
576
- delete data2.target;
577
- data2[RelationSourceDXNId] = sourceDxn;
578
- data2[RelationTargetDXNId] = targetDxn;
579
- }
580
- return {
581
- data: data2,
582
- schema: entry.schema
583
- };
584
- }).filter((object) => !existingIds.has(object.data.id));
585
- const { objects: dbObjects } = await db.query(Query.select(Filter.ids(...existingIds))).run();
586
- const queueObjects = await queue?.getObjectsById([
587
- ...existingIds
588
- ]) ?? [];
589
- const objects = [
590
- ...dbObjects,
591
- ...queueObjects
592
- ].filter(isNonNullable);
593
- log3.info("objects", {
594
- dbObjects,
595
- queueObjects,
596
- existingIds
597
- }, {
598
- F: __dxlog_file3,
599
- L: 306,
600
- S: void 0,
601
- C: (f, a) => f(...a)
602
- });
603
- const missing = Array.from(existingIds).filter((id) => !objects.some((object) => object.id === id));
604
- if (missing.length > 0) {
605
- throw new Error(`Object IDs do not point to existing objects: ${missing.join(", ")}`);
606
- }
607
- return res.flatMap(({ data: data2, schema }) => {
608
- let skip = false;
609
- if (RelationSourceDXNId in data2) {
610
- const id = data2[RelationSourceDXNId].asEchoDXN()?.echoId;
611
- const obj = objects.find((object) => object.id === id) ?? enitties.get(id);
612
- if (obj) {
613
- delete data2[RelationSourceDXNId];
614
- data2[RelationSourceId] = obj;
615
- } else {
616
- skip = true;
617
- }
618
- }
619
- if (RelationTargetDXNId in data2) {
620
- const id = data2[RelationTargetDXNId].asEchoDXN()?.echoId;
621
- const obj = objects.find((object) => object.id === id) ?? enitties.get(id);
622
- if (obj) {
623
- delete data2[RelationTargetDXNId];
624
- data2[RelationTargetId] = obj;
625
- } else {
626
- skip = true;
627
- }
628
- }
629
- if (!skip) {
630
- const obj = create(schema, data2);
631
- enitties.set(obj.id, obj);
632
- return [
633
- obj
634
- ];
635
- }
636
- return [];
637
- });
638
- };
639
- var SoftRef = Schema5.Struct({
640
- "/": Schema5.String
641
- }).annotations({
642
- description: "Reference to another object."
643
- });
644
- var preprocessSchema = (schema) => {
645
- const isRelationSchema = getEntityKind(schema) === "relation";
646
- const go = (ast, visited = /* @__PURE__ */ new Set()) => {
647
- if (visited.has(ast)) {
648
- return ast;
649
- }
650
- visited.add(ast);
651
- if (SchemaAST.getAnnotation(ast, ReferenceAnnotationId).pipe(Option3.isSome)) {
652
- return SoftRef.ast;
653
- }
654
- return mapAst(ast, (child) => go(child, visited));
655
- };
656
- return Schema5.make(mapAst(schema.ast, (ast) => go(ast))).pipe(Schema5.omit("id"), Schema5.extend(Schema5.Struct({
657
- id: Schema5.String.annotations({
658
- description: "The id of this object. Come up with a unique id based on your judgement."
659
- })
660
- })), isRelationSchema ? Schema5.extend(Schema5.Struct({
661
- source: Schema5.String.annotations({
662
- description: "The id of the source object for this relation."
663
- }),
664
- target: Schema5.String.annotations({
665
- description: "The id of the target object for this relation."
666
- })
667
- })) : Function3.identity);
668
- };
669
-
670
- // src/functions/research/document-create.ts
671
- import * as Effect6 from "effect/Effect";
672
- import * as Schema6 from "effect/Schema";
673
- import { ArtifactId as ArtifactId3 } from "@dxos/assistant";
674
- import { Obj as Obj4, Relation } from "@dxos/echo";
675
- import { DatabaseService as DatabaseService5, TracingService as TracingService3, defineFunction as defineFunction5 } from "@dxos/functions";
676
- import { log as log4 } from "@dxos/log";
677
- import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
678
- import { HasSubject } from "@dxos/types";
679
- import { trim as trim2 } from "@dxos/util";
680
- var __dxlog_file4 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/research/document-create.ts";
681
- var document_create_default = defineFunction5({
682
- key: "dxos.org/function/research/document-create",
683
- name: "Create research document",
684
- description: "Creates a note summarizing the research.",
685
- inputSchema: Schema6.Struct({
686
- subject: ArtifactId3.annotations({
687
- description: trim2`
688
- ID of the object (organization, contact, etc.) for which the research was performed.
689
- `
690
- }),
691
- name: Schema6.String.annotations({
692
- description: "Name of the document."
693
- }),
694
- content: Schema6.String.annotations({
695
- description: trim2`
696
- Content of the note.
697
- Supports (and are prefered) references to research objects using @ syntax and <object> tags (refer to research blueprint instructions).
698
- `
699
- })
700
- }),
701
- outputSchema: Schema6.Struct({
702
- document: ArtifactId3.annotations({
703
- description: "DXN of the created document."
704
- })
705
- }),
706
- handler: Effect6.fnUntraced(function* ({ data: { subject, name, content } }) {
707
- log4.info("Creating research document", {
708
- subject,
709
- name,
710
- content
711
- }, {
712
- F: __dxlog_file4,
713
- L: 42,
714
- S: this,
715
- C: (f, a) => f(...a)
716
- });
717
- yield* DatabaseService5.flush({
718
- indexes: true
719
- });
720
- yield* TracingService3.emitStatus({
721
- message: "Creating research document..."
722
- });
723
- const target = yield* DatabaseService5.resolve(ArtifactId3.toDXN(subject));
724
- const object = yield* DatabaseService5.add(Markdown3.make({
725
- name,
726
- content
727
- }));
728
- yield* DatabaseService5.add(Relation.make(HasSubject.HasSubject, {
729
- [Relation.Source]: object,
730
- [Relation.Target]: target,
731
- completedAt: (/* @__PURE__ */ new Date()).toISOString()
732
- }));
733
- yield* DatabaseService5.flush({
734
- indexes: true
735
- });
736
- log4.info("Created research document", {
737
- subject,
738
- object
739
- }, {
740
- F: __dxlog_file4,
741
- L: 69,
742
- S: this,
743
- C: (f, a) => f(...a)
744
- });
745
- return {
746
- document: Obj4.getDXN(object).toString()
747
- };
748
- })
749
- });
750
-
751
- // src/functions/research/research.ts
752
- import * as Toolkit2 from "@effect/ai/Toolkit";
753
- import * as AnthropicTool from "@effect/ai-anthropic/AnthropicTool";
754
- import * as Array6 from "effect/Array";
755
- import * as Effect10 from "effect/Effect";
756
- import * as Function4 from "effect/Function";
757
- import * as Layer3 from "effect/Layer";
758
- import * as Option4 from "effect/Option";
759
- import * as Schema10 from "effect/Schema";
760
- import * as String10 from "effect/String";
761
- import { AiService as AiService2, ConsolePrinter as ConsolePrinter2 } from "@dxos/ai";
762
- import { AiSession as AiSession2, GenerationObserver as GenerationObserver2, createToolkit as createToolkit2, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from "@dxos/assistant";
763
- import { Template as Template2 } from "@dxos/blueprints";
764
- import { Obj as Obj6 } from "@dxos/echo";
765
- import { DatabaseService as DatabaseService7, TracingService as TracingService4, defineFunction as defineFunction8 } from "@dxos/functions";
766
- import { FunctionInvocationServiceLayerTestMocked } from "@dxos/functions-runtime/testing";
767
- import { Person } from "@dxos/types";
768
- import { trim as trim3 } from "@dxos/util";
769
-
770
- // src/functions/exa/exa.ts
771
- import * as Effect7 from "effect/Effect";
772
- import * as Schema7 from "effect/Schema";
773
- import Exa from "exa-js";
774
- import { CredentialsService as CredentialsService2, defineFunction as defineFunction6 } from "@dxos/functions";
775
- var exa_default = defineFunction6({
776
- key: "dxos.org/function/exa",
777
- name: "Exa",
778
- description: "Search the web for information",
779
- inputSchema: Schema7.Struct({
780
- query: Schema7.String.annotations({
781
- description: "The query to search for."
782
- })
783
- }),
784
- outputSchema: Schema7.Unknown,
785
- handler: Effect7.fnUntraced(function* ({ data: { query } }) {
786
- const credential = yield* CredentialsService2.getCredential({
787
- service: "exa.ai"
788
- });
789
- const exa = new Exa(credential.apiKey);
790
- const context = yield* Effect7.promise(async () => exa.searchAndContents(query, {
791
- type: "auto",
792
- text: {
793
- maxCharacters: 3e3
794
- },
795
- livecrawl: "always"
796
- }));
797
- return context;
798
- })
799
- });
1
+ import {
2
+ ExaMock
3
+ } from "./chunk-VDEDVOS6.mjs";
4
+ import "./chunk-J5LGTIGS.mjs";
800
5
 
801
6
  // src/functions/exa/mock.ts
802
- import * as Effect8 from "effect/Effect";
803
- import * as Schema8 from "effect/Schema";
804
- import { defineFunction as defineFunction7 } from "@dxos/functions";
7
+ import * as Effect from "effect/Effect";
8
+ import { Operation } from "@dxos/operation";
805
9
 
806
- // src/testing/data/exa-search-1748337321991.ts
10
+ // src/functions/exa/data/exa-search-1748337321991.ts
807
11
  var exa_search_1748337321991_default = {
808
12
  requestId: "324936368a74f4db978982172bc18a6c",
809
13
  autopromptString: "AI personal knowledge management tools projects 2024",
@@ -959,7 +163,7 @@ var exa_search_1748337321991_default = {
959
163
  }
960
164
  };
961
165
 
962
- // src/testing/data/exa-search-1748337331526.ts
166
+ // src/functions/exa/data/exa-search-1748337331526.ts
963
167
  var exa_search_1748337331526_default = {
964
168
  requestId: "0dc12e344fa649884456960ca1a54954",
965
169
  autopromptString: "PKM software artificial intelligence integration open source projects",
@@ -1182,7 +386,7 @@ npm run tauri dev
1182
386
  }
1183
387
  };
1184
388
 
1185
- // src/testing/data/exa-search-1748337344119.ts
389
+ // src/functions/exa/data/exa-search-1748337344119.ts
1186
390
  var exa_search_1748337344119_default = {
1187
391
  requestId: "32df0c541f9883180b35e04caece4374",
1188
392
  autopromptString: "open source AI knowledge management projects features comparison 2024",
@@ -1305,7 +509,7 @@ var exa_search_1748337344119_default = {
1305
509
  }
1306
510
  };
1307
511
 
1308
- // src/testing/data/index.ts
512
+ // src/functions/exa/data/index.ts
1309
513
  var SEARCH_RESULTS = [
1310
514
  exa_search_1748337321991_default,
1311
515
  exa_search_1748337331526_default,
@@ -1313,33 +517,22 @@ var SEARCH_RESULTS = [
1313
517
  ];
1314
518
 
1315
519
  // src/functions/exa/mock.ts
1316
- var mock_default = defineFunction7({
1317
- key: "dxos.org/function/exa-mock",
1318
- name: "Exa mock",
1319
- description: "Search the web for information",
1320
- inputSchema: Schema8.Struct({
1321
- query: Schema8.String.annotations({
1322
- description: "The query to search for."
1323
- })
1324
- }),
1325
- outputSchema: Schema8.Unknown,
1326
- handler: Effect8.fnUntraced(function* ({ data: { query } }) {
1327
- const result = SEARCH_RESULTS.reduce((closest, current) => {
1328
- if (!current.autopromptString) {
1329
- return closest;
1330
- }
1331
- if (!closest) {
1332
- return current;
1333
- }
1334
- const dist1 = levenshteinDistance(query, current.autopromptString);
1335
- const dist2 = levenshteinDistance(query, closest.autopromptString || "");
1336
- const weight1 = dist1 / Math.max(query.length, current.autopromptString.length);
1337
- const weight2 = dist2 / Math.max(query.length, closest.autopromptString?.length || 0);
1338
- return weight1 < weight2 ? current : closest;
1339
- }, null);
1340
- return result;
1341
- })
1342
- });
520
+ var mock_default = ExaMock.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ query }) {
521
+ const result = SEARCH_RESULTS.reduce((closest, current) => {
522
+ if (!current.autopromptString) {
523
+ return closest;
524
+ }
525
+ if (!closest) {
526
+ return current;
527
+ }
528
+ const dist1 = levenshteinDistance(query, current.autopromptString);
529
+ const dist2 = levenshteinDistance(query, closest.autopromptString || "");
530
+ const weight1 = dist1 / Math.max(query.length, current.autopromptString.length);
531
+ const weight2 = dist2 / Math.max(query.length, closest.autopromptString?.length || 0);
532
+ return weight1 < weight2 ? current : closest;
533
+ }, null);
534
+ return result;
535
+ })));
1343
536
  var levenshteinDistance = (str1, str2) => {
1344
537
  const m = str1.length;
1345
538
  const n = str2.length;
@@ -1357,1421 +550,7 @@ var levenshteinDistance = (str1, str2) => {
1357
550
  }
1358
551
  return dp[m][n];
1359
552
  };
1360
-
1361
- // src/functions/research/research-graph.ts
1362
- import * as Effect9 from "effect/Effect";
1363
- import * as Layer2 from "effect/Layer";
1364
- import * as Schema9 from "effect/Schema";
1365
- import { Obj as Obj5, Query as Query2, Ref as Ref2, Type as Type2 } from "@dxos/echo";
1366
- import { Queue } from "@dxos/echo-db";
1367
- import { ContextQueueService as ContextQueueService2, DatabaseService as DatabaseService6, QueueService } from "@dxos/functions";
1368
- var ResearchGraph = Schema9.Struct({
1369
- queue: Type2.Ref(Queue)
1370
- }).pipe(Type2.Obj({
1371
- typename: "dxos.org/type/ResearchGraph",
1372
- version: "0.1.0"
1373
- }));
1374
- var queryResearchGraph = Effect9.fn("queryResearchGraph")(function* () {
1375
- const { objects } = yield* DatabaseService6.runQuery(Query2.type(ResearchGraph));
1376
- return objects.at(0);
1377
- });
1378
- var createResearchGraph = Effect9.fn("createResearchGraph")(function* () {
1379
- const queue = yield* QueueService.createQueue();
1380
- return yield* DatabaseService6.add(Obj5.make(ResearchGraph, {
1381
- queue: Ref2.fromDXN(queue.dxn)
1382
- }));
1383
- });
1384
- var contextQueueLayerFromResearchGraph = Layer2.unwrapEffect(Effect9.gen(function* () {
1385
- const researchGraph = (yield* queryResearchGraph()) ?? (yield* createResearchGraph());
1386
- const researchQueue = yield* DatabaseService6.load(researchGraph.queue);
1387
- return ContextQueueService2.layer(researchQueue);
1388
- }));
1389
-
1390
- // raw-loader:/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/research/research-instructions.tpl?raw
1391
- var research_instructions_default = "You are the Research Agent.\n\nThe Research Agent is an expert assistant that conducts in-depth research using real-time web search.\nThe Research Agent outputs results in a structured format matching the schema provided.\n\nThe Research Agent is equipped with the ability to:\n\n- Generate precise and effective search queries \n- Request web pages by query.\n- Synthesize accurate, clear, and structured answers using reliable information from the retrieved content\n{{#if entityExtraction}}\n- Search the local database for information using a vector index (through a `local_search` tool)\n{{/if}}\n\nThe Research Agent always follows these principles:\n\n- Relevance First: The Research Agent only returns facts supported by content in retrieved web pages. The Research Agent never fabricates or guesses information.\n- Summarize, Don't Copy: The Research Agent synthesizes and rephrases content in its own words. The Research Agent quotes only when necessary.\n- Multiple Sources: The Research Agent cross-references at least 2 sources before drawing conclusions, unless the information is directly stated and non-controversial.\n- Transparency: The Research Agent mentions which sources were used and explains how it arrived at conclusions.\n- Accuracy Over Brevity: The Research Agent prefers detailed, technically accurate explanations over shallow summaries.\n- The Research Agent admits uncertainty rather than misleading.\n{{#if entityExtraction}}\n- The Research Agent picks the most concrete schema types for extracted information.\n- The Research Agent fills schema fields completely with information it is confident about, and omits fields it is not confident about.\n- When outputting results, the Research Agent adds extra data that fits the schema even if not directly related to the user's question.\n- The Research Agent creates relations and references between new objects found and what's already in the database.\n- The Research Agent does not create objects that are already in the database.\n- The Research Agent re-uses existing object IDs as references when enriching existing objects.\n- The Research Agent ALWAYS calls the `graph_writer` at the end to save the data. This conversation will be deleted, so only the data written to the graph will be preserved.\n{{/if}}\n\nThe Research Agent may be asked for:\n\n- Technical explanations\n- Literature reviews \n- Comparisons\n- Emerging trends\n- Implementation strategies\n\nThe Research Agent begins by interpreting the user's request, then:\n\nThe Research Agent breaks it into sub-questions (if applicable).\n\nFor each sub-question, the Research Agent generates a clear, concise web search query.\n\nThe Research Agent extracts and synthesizes relevant answers.\n\nThe Research Agent's output includes:\n\n- A clear, structured answer to the user's question\n- A citation list or link list of sources used\n\nOptionally, the Research Agent provides follow-up suggestions or questions for deeper inquiry.\n\nHere's how the Research Agent operates:\n\n1. The Research Agent analyzes the user's request and identifies key topics to search for (3 or more), printing them out.\n2. The Research Agent performs a web search for each topic.\n3. The Research Agent reads and analyzes results, cross references information from multiple sources, and represents conflicting information as ranges of possible values.\n\n{{#if entityExtraction}}\n4. The Research Agent searches the local database for information using a vector index that might link to the user's question.\n6. The Research Agent creates relations and references between new objects and existing database objects when related, using existing object IDs as references.\n7. The Research Agent selects the most concrete schema types for extracted information, using multiple types as needed, and prints its decision and reasoning.\n5. The Research Agent creates a clear, structured answer to the user's question.\n8. The Research Agent submits results using the specific schema.\n{{/if}}\n\n{{#if entityExtraction}}\nIMPORTANT:\n- The Research Agent always runs the `local_search` tool to search the local database at least once before submitting results.\n- The Research Agent does not create objects that already exist in the database.\n- Ids that are not in the database are human-readable strings like `ivan_zhao_1`.\n{{/if}}\n\nStatus reporting:\n\nThe Research Agent reports its status frequently using the `<status>` tags: <status>Searching for Google Founders</status>\nThe Research Agent reports its status in-between each tool call and before submitting results.\n\n{{#if entityExtraction}}\n<example>\n\nBased on my research, I can now provide information about Google and it's founders.\n\nThe following objects are already in the database, I will not submit them again, but I'll re-use their IDs as references:\n\n- 01JWRDEHPB5TT2JQQQC15038BT Google\n- 01JWRDEHPA14CYW2NW9FAH6DJJ Larry Page\n- 01JWRDEHPBN0BBJP57B9S108W6 Sergey Brin\n\nI will use the following schema to construct new objects:\n\n- type:dxos.org/type/Organization for Alphabet Inc.\n- type:dxos.org/type/Person for Ivan Zhao\n- type:dxos.org/type/Person for Simon Last\n- dxn:type:dxos.org/relation/Employer for Ivan's employer\n- dxn:type:dxos.org/relation/Employer for Simon's employer\n\n<status>Formatting results</status>\n\n</example>\n{{/if}}\n\nLast content block is the full research note -- the result of the research.\n";
1392
-
1393
- // src/functions/research/types.ts
1394
- import { Text } from "@dxos/schema";
1395
- import { Event, HasConnection, HasRelationship, LegacyOrganization, LegacyPerson, Project, Task } from "@dxos/types";
1396
- var ResearchDataTypes = [
1397
- // Objects
1398
- Event.Event,
1399
- LegacyOrganization,
1400
- Task.Task,
1401
- Text.Text,
1402
- // Relations
1403
- // TODO(wittjosiah): Until views (e.g., Table) support relations this needs to be expressed via organization ref.
1404
- // Employer.Employer,
1405
- LegacyPerson,
1406
- Project.Project,
1407
- HasRelationship.HasRelationship,
1408
- HasConnection.HasConnection
1409
- ];
1410
-
1411
- // src/functions/research/research.ts
1412
- var research_default = defineFunction8({
1413
- key: "dxos.org/function/research",
1414
- name: "Research",
1415
- description: trim3`
1416
- Search the web to research information about the given subject.
1417
- Inserts structured data into the research graph.
1418
- Creates a research summary and returns the objects created.
1419
- `,
1420
- inputSchema: Schema10.Struct({
1421
- query: Schema10.String.annotations({
1422
- description: trim3`
1423
- The search query.
1424
- If doing research on an object then load it first and pass it as JSON.
1425
- `
1426
- }),
1427
- instructions: Schema10.optional(Schema10.String).annotations({
1428
- description: trim3`
1429
- The instructions for the research agent.
1430
- `
1431
- }),
1432
- // TOOD(burdon): Move to context.
1433
- mockSearch: Schema10.optional(Schema10.Boolean).annotations({
1434
- description: "Whether to use the mock search tool.",
1435
- default: false
1436
- }),
1437
- entityExtraction: Schema10.optional(Schema10.Boolean).annotations({
1438
- description: trim3`
1439
- Whether to extract structured entities from the research.
1440
- Experimental feature only enable if user explicitly requests it.
1441
- `,
1442
- default: false
1443
- })
1444
- }),
1445
- outputSchema: Schema10.Struct({
1446
- document: Schema10.optional(Schema10.String).annotations({
1447
- description: "The generated research document."
1448
- }),
1449
- objects: Schema10.Array(Schema10.Unknown).annotations({
1450
- description: "Structured objects created during the research process."
1451
- })
1452
- }),
1453
- handler: Effect10.fnUntraced(function* ({ data: { query, instructions: instructions6, mockSearch = false, entityExtraction = false } }) {
1454
- if (mockSearch) {
1455
- const mockPerson = yield* DatabaseService7.add(Obj6.make(Person.Person, {
1456
- preferredName: "John Doe",
1457
- emails: [
1458
- {
1459
- value: "john.doe@example.com"
1460
- }
1461
- ],
1462
- phoneNumbers: [
1463
- {
1464
- value: "123-456-7890"
1465
- }
1466
- ]
1467
- }));
1468
- return {
1469
- document: trim3`
1470
- The research ran in test-mode and was mocked. Proceed as usual.
1471
- We reference John Doe to test reference: ${Obj6.getDXN(mockPerson)}
1472
- `,
1473
- objects: [
1474
- Obj6.toJSON(mockPerson)
1475
- ]
1476
- };
1477
- }
1478
- yield* DatabaseService7.flush({
1479
- indexes: true
1480
- });
1481
- yield* TracingService4.emitStatus({
1482
- message: "Starting research..."
1483
- });
1484
- const NativeWebSearch = Toolkit2.make(AnthropicTool.WebSearch_20250305({}));
1485
- let toolkit = NativeWebSearch;
1486
- let handlers = Layer3.empty;
1487
- const objectDXNs = [];
1488
- if (entityExtraction) {
1489
- const GraphWriterToolkit = makeGraphWriterToolkit({
1490
- schema: ResearchDataTypes
1491
- });
1492
- const GraphWriterHandler = makeGraphWriterHandler(GraphWriterToolkit, {
1493
- onAppend: (dxns) => objectDXNs.push(...dxns)
1494
- });
1495
- toolkit = Toolkit2.merge(toolkit, LocalSearchToolkit, GraphWriterToolkit);
1496
- handlers = Layer3.mergeAll(handlers, LocalSearchHandler, GraphWriterHandler).pipe(Layer3.provide(contextQueueLayerFromResearchGraph));
1497
- }
1498
- const finishedToolkit = yield* createToolkit2({
1499
- toolkit
1500
- }).pipe(Effect10.provide(handlers));
1501
- const session = new AiSession2();
1502
- const result = yield* session.run({
1503
- prompt: query,
1504
- system: join(Template2.process(research_instructions_default, {
1505
- entityExtraction
1506
- }), instructions6 && `<instructions>${instructions6}</instructions>`),
1507
- toolkit: finishedToolkit,
1508
- observer: GenerationObserver2.fromPrinter(new ConsolePrinter2({
1509
- tag: "research"
1510
- }))
1511
- });
1512
- const objects = yield* Effect10.forEach(objectDXNs, (dxn) => DatabaseService7.resolve(dxn)).pipe(Effect10.map(Array6.map((obj) => Obj6.toJSON(obj))));
1513
- return {
1514
- document: extractLastTextBlock(result),
1515
- objects
1516
- };
1517
- }, Effect10.provide(Layer3.mergeAll(
1518
- AiService2.model("@anthropic/claude-sonnet-4-0"),
1519
- // TODO(dmaretskyi): Extract.
1520
- makeToolResolverFromFunctions([
1521
- exa_default,
1522
- mock_default
1523
- ], Toolkit2.make()),
1524
- makeToolExecutionServiceFromFunctions(Toolkit2.make(), Layer3.empty)
1525
- ).pipe(Layer3.provide(
1526
- // TODO(dmaretskyi): This should be provided by environment.
1527
- Layer3.mergeAll(FunctionInvocationServiceLayerTestMocked({
1528
- functions: [
1529
- exa_default,
1530
- mock_default
1531
- ]
1532
- }))
1533
- ))))
1534
- });
1535
- var join = (...strings) => strings.filter(Boolean).join("\n\n");
1536
- var extractLastTextBlock = (result) => {
1537
- return Function4.pipe(result, Array6.last, Option4.map(Function4.flow((_) => _.blocks, Array6.reverse, Array6.dropWhile((_) => _._tag === "summary"), Array6.takeWhile((_) => _._tag === "text"), Array6.reverse, Array6.map((_) => _.text), Array6.reduce("", String10.concat))), Option4.getOrElse(() => ""));
1538
- };
1539
-
1540
- // src/functions/research/index.ts
1541
- (function(Research2) {
1542
- Research2.create = document_create_default;
1543
- Research2.research = research_default;
1544
- })(Research || (Research = {}));
1545
- var Research;
1546
-
1547
- // src/functions/entity-extraction/entity-extraction.ts
1548
- var __dxlog_file5 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/entity-extraction/entity-extraction.ts";
1549
- var entity_extraction_default = defineFunction9({
1550
- key: "dxos.org/functions/entity-extraction",
1551
- name: "Entity Extraction",
1552
- description: "Extracts entities from emails and transcripts.",
1553
- inputSchema: Schema11.Struct({
1554
- source: Message2.Message.annotations({
1555
- description: "Email or transcript to extract entities from."
1556
- }),
1557
- // TODO(dmaretskyi): Consider making this an array of blueprints instead.
1558
- instructions: Schema11.optional(Schema11.String).annotations({
1559
- description: "Instructions extraction process."
1560
- })
1561
- }),
1562
- outputSchema: Schema11.Struct({
1563
- entities: Schema11.optional(Schema11.Array(Obj7.Any).annotations({
1564
- description: "Extracted entities."
1565
- }))
1566
- }),
1567
- handler: Effect11.fnUntraced(function* ({ data: { source, instructions: instructions6 } }) {
1568
- const contact = yield* extractContact(source);
1569
- let organization = null;
1570
- if (contact && !contact.organization) {
1571
- const created = [];
1572
- const GraphWriterToolkit = makeGraphWriterToolkit({
1573
- schema: [
1574
- LegacyOrganization2
1575
- ]
1576
- }).pipe();
1577
- const GraphWriterHandler = makeGraphWriterHandler(GraphWriterToolkit, {
1578
- onAppend: (dxns) => created.push(...dxns)
1579
- });
1580
- const toolkit = yield* GraphWriterToolkit.pipe(Effect11.provide(GraphWriterHandler.pipe(Layer4.provide(contextQueueLayerFromResearchGraph))));
1581
- yield* new AiSession3().run({
1582
- system: trim4`
1583
- Extract the sender's organization from the email. If you are not sure, do nothing.
1584
- The extracted organization URL must match the sender's email domain.
1585
- ${instructions6 ? "<user_intructions>" + instructions6 + "</user_intructions>" : ""},
1586
- `,
1587
- prompt: JSON.stringify({
1588
- source,
1589
- contact
1590
- }),
1591
- toolkit
1592
- });
1593
- if (created.length > 1) {
1594
- throw new Error("Multiple organizations created");
1595
- } else if (created.length === 1) {
1596
- organization = yield* DatabaseService8.resolve(created[0], Organization.Organization);
1597
- Obj7.getMeta(organization).tags ??= [];
1598
- Obj7.getMeta(organization).tags.push(...Obj7.getMeta(source)?.tags ?? []);
1599
- contact.organization = Ref3.make(organization);
1600
- }
1601
- }
1602
- return {
1603
- entities: [
1604
- contact,
1605
- organization
1606
- ].filter(Predicate.isNotNullable)
1607
- };
1608
- }, Effect11.provide(Layer4.mergeAll(AiService3.model("@anthropic/claude-sonnet-4-0"), makeToolResolverFromFunctions2([], Toolkit3.make()), makeToolExecutionServiceFromFunctions2(Toolkit3.make(), Layer4.empty)).pipe(Layer4.provide(
1609
- // TODO(dmaretskyi): This should be provided by environment.
1610
- Layer4.mergeAll(FunctionInvocationServiceLayerTest())
1611
- ))))
1612
- });
1613
- var extractContact = Effect11.fn("extractContact")(function* (message) {
1614
- const name = message.sender.name;
1615
- const email = message.sender.email;
1616
- if (!email) {
1617
- log5.warn("email is required for contact extraction", {
1618
- sender: message.sender
1619
- }, {
1620
- F: __dxlog_file5,
1621
- L: 99,
1622
- S: this,
1623
- C: (f, a) => f(...a)
1624
- });
1625
- return void 0;
1626
- }
1627
- const { objects: existingContacts } = yield* DatabaseService8.runQuery(Filter2.type(Person2.Person));
1628
- const existingContact = existingContacts.find((contact) => contact.emails?.some((contactEmail) => contactEmail.value === email));
1629
- if (existingContact) {
1630
- log5.info("Contact already exists", {
1631
- email,
1632
- existingContact
1633
- }, {
1634
- F: __dxlog_file5,
1635
- L: 112,
1636
- S: this,
1637
- C: (f, a) => f(...a)
1638
- });
1639
- return existingContact;
1640
- }
1641
- const newContact = Obj7.make(Person2.Person, {
1642
- [Obj7.Meta]: {
1643
- tags: Obj7.getMeta(message)?.tags
1644
- },
1645
- emails: [
1646
- {
1647
- value: email
1648
- }
1649
- ]
1650
- });
1651
- yield* DatabaseService8.add(newContact);
1652
- if (name) {
1653
- newContact.fullName = name;
1654
- }
1655
- const emailDomain = email.split("@")[1]?.toLowerCase();
1656
- if (!emailDomain) {
1657
- log5.warn("Invalid email format, cannot extract domain", {
1658
- email
1659
- }, {
1660
- F: __dxlog_file5,
1661
- L: 130,
1662
- S: this,
1663
- C: (f, a) => f(...a)
1664
- });
1665
- return newContact;
1666
- }
1667
- log5.info("extracted email domain", {
1668
- emailDomain
1669
- }, {
1670
- F: __dxlog_file5,
1671
- L: 134,
1672
- S: this,
1673
- C: (f, a) => f(...a)
1674
- });
1675
- const { objects: existingOrganisations } = yield* DatabaseService8.runQuery(Filter2.type(Organization.Organization));
1676
- const matchingOrg = existingOrganisations.find((org) => {
1677
- if (org.website) {
1678
- try {
1679
- const websiteUrl = org.website.startsWith("http://") || org.website.startsWith("https://") ? org.website : `https://${org.website}`;
1680
- const websiteDomain = new URL(websiteUrl).hostname.toLowerCase();
1681
- return websiteDomain === emailDomain || websiteDomain.endsWith(`.${emailDomain}`) || emailDomain.endsWith(`.${websiteDomain}`);
1682
- } catch (e) {
1683
- log5.warn("Error parsing website URL", {
1684
- website: org.website,
1685
- error: e
1686
- }, {
1687
- F: __dxlog_file5,
1688
- L: 152,
1689
- S: this,
1690
- C: (f, a) => f(...a)
1691
- });
1692
- return false;
1693
- }
1694
- }
1695
- return false;
1696
- });
1697
- if (matchingOrg) {
1698
- log5.info("found matching organization", {
1699
- organization: matchingOrg
1700
- }, {
1701
- F: __dxlog_file5,
1702
- L: 160,
1703
- S: this,
1704
- C: (f, a) => f(...a)
1705
- });
1706
- newContact.organization = Ref3.make(matchingOrg);
1707
- }
1708
- return newContact;
1709
- });
1710
-
1711
- // src/functions/entity-extraction/index.ts
1712
- (function(EntityExtraction2) {
1713
- EntityExtraction2.extract = entity_extraction_default;
1714
- })(EntityExtraction || (EntityExtraction = {}));
1715
- var EntityExtraction;
1716
-
1717
- // src/functions/linear/sync-issues.ts
1718
- import * as FetchHttpClient2 from "@effect/platform/FetchHttpClient";
1719
- import * as HttpClient from "@effect/platform/HttpClient";
1720
- import * as Array9 from "effect/Array";
1721
- import * as Effect13 from "effect/Effect";
1722
- import * as Function5 from "effect/Function";
1723
- import * as Schema12 from "effect/Schema";
1724
- import { Filter as Filter4, Obj as Obj9, Query as Query4, Ref as Ref5 } from "@dxos/echo";
1725
- import { DatabaseService as DatabaseService10, defineFunction as defineFunction10, withAuthorization } from "@dxos/functions";
1726
- import { log as log7 } from "@dxos/log";
1727
- import { Person as Person3, Project as Project2, Task as Task2 } from "@dxos/types";
1728
-
1729
- // src/sync/sync.ts
1730
- import * as Effect12 from "effect/Effect";
1731
- import { Filter as Filter3, Obj as Obj8, Query as Query3, Ref as Ref4 } from "@dxos/echo";
1732
- import { DatabaseService as DatabaseService9 } from "@dxos/functions";
1733
- import { failedInvariant } from "@dxos/invariant";
1734
- import { log as log6 } from "@dxos/log";
1735
- var __dxlog_file6 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/sync/sync.ts";
1736
- var syncObjects = Effect12.fn("syncObjects")(function* (objs, { foreignKeyId }) {
1737
- return yield* Effect12.forEach(objs, Effect12.fnUntraced(function* (obj) {
1738
- for (const key of Object.keys(obj)) {
1739
- if (typeof key !== "string" || key === "id") continue;
1740
- if (!Ref4.isRef(obj[key])) continue;
1741
- const ref = obj[key];
1742
- if (!ref.target) continue;
1743
- if (Obj8.getDXN(ref.target).isLocalObjectId()) {
1744
- const [target] = yield* syncObjects([
1745
- ref.target
1746
- ], {
1747
- foreignKeyId
1748
- });
1749
- obj[key] = Ref4.make(target);
1750
- }
1751
- }
1752
- const schema = Obj8.getSchema(obj) ?? failedInvariant("No schema.");
1753
- const foreignId = Obj8.getKeys(obj, foreignKeyId)[0]?.id ?? failedInvariant("No foreign key.");
1754
- const { objects: [existing] } = yield* DatabaseService9.runQuery(Query3.select(Filter3.foreignKeys(schema, [
1755
- {
1756
- source: foreignKeyId,
1757
- id: foreignId
1758
- }
1759
- ])));
1760
- log6("sync object", {
1761
- type: Obj8.getTypename(obj),
1762
- foreignId,
1763
- existing: existing ? Obj8.getDXN(existing) : void 0
1764
- }, {
1765
- F: __dxlog_file6,
1766
- L: 47,
1767
- S: this,
1768
- C: (f, a) => f(...a)
1769
- });
1770
- if (!existing) {
1771
- yield* DatabaseService9.add(obj);
1772
- return obj;
1773
- } else {
1774
- copyObjectData(existing, obj);
1775
- return existing;
1776
- }
1777
- }), {
1778
- concurrency: 1
1779
- });
1780
- });
1781
- var copyObjectData = (existing, newObj) => {
1782
- for (const key of Object.keys(newObj)) {
1783
- if (typeof key !== "string" || key === "id") continue;
1784
- if (typeof newObj[key] !== "string" && typeof newObj[key] !== "number" && typeof newObj[key] !== "boolean" && !Ref4.isRef(newObj[key])) continue;
1785
- existing[key] = newObj[key];
1786
- }
1787
- for (const key of Object.keys(existing)) {
1788
- if (typeof key !== "string" || key === "id") continue;
1789
- if (!(key in newObj)) {
1790
- delete existing[key];
1791
- }
1792
- }
1793
- for (const foreignKey of Obj8.getMeta(newObj).keys) {
1794
- Obj8.deleteKeys(existing, foreignKey.source);
1795
- Obj8.getMeta(existing).keys.push({
1796
- ...foreignKey
1797
- });
1798
- }
1799
- };
1800
-
1801
- // src/util/graphql.ts
1802
- import * as HttpBody from "@effect/platform/HttpBody";
1803
- var graphqlRequestBody = (query, variables = {}) => HttpBody.json({
1804
- query,
1805
- variables
1806
- });
1807
-
1808
- // src/functions/linear/sync-issues.ts
1809
- var __dxlog_file7 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/linear/sync-issues.ts";
1810
- var queryIssues = `
1811
- query Issues($teamId: String!, $after: DateTimeOrDuration!) {
1812
- team(id: $teamId) {
1813
- id
1814
- name
1815
-
1816
-
1817
- issues(last: 150, orderBy: updatedAt, filter: {
1818
- updatedAt: { gt: $after }
1819
- }) {
1820
- edges {
1821
- node {
1822
- id
1823
- title
1824
- createdAt
1825
- updatedAt
1826
- description
1827
- assignee { id, name }
1828
- state {
1829
- name
1830
- }
1831
- project {
1832
- id
1833
- name
1834
- }
1835
- }
1836
- cursor
1837
- }
1838
- pageInfo {
1839
- hasNextPage
1840
- endCursor
1841
- }
1842
- }
1843
- }
1844
- }
1845
- `;
1846
- var LINEAR_ID_KEY = "linear.app/id";
1847
- var LINEAR_TEAM_ID_KEY = "linear.app/teamId";
1848
- var LINEAR_UPDATED_AT_KEY = "linear.app/updatedAt";
1849
- var sync_issues_default = defineFunction10({
1850
- key: "dxos.org/function/linear/sync-issues",
1851
- name: "Linear",
1852
- description: "Sync issues from Linear.",
1853
- inputSchema: Schema12.Struct({
1854
- team: Schema12.String.annotations({
1855
- description: "Linear team id."
1856
- })
1857
- }),
1858
- handler: Effect13.fnUntraced(function* ({ data }) {
1859
- const client = yield* HttpClient.HttpClient.pipe(Effect13.map(withAuthorization({
1860
- service: "linear.app"
1861
- })));
1862
- const after = yield* getLatestUpdateTimestamp(data.team, Task2.Task);
1863
- log7.info("will fetch", {
1864
- after
1865
- }, {
1866
- F: __dxlog_file7,
1867
- L: 91,
1868
- S: this,
1869
- C: (f, a) => f(...a)
1870
- });
1871
- const response = yield* client.post("https://api.linear.app/graphql", {
1872
- body: yield* graphqlRequestBody(queryIssues, {
1873
- teamId: data.team,
1874
- after
1875
- })
1876
- });
1877
- const json2 = yield* response.json;
1878
- const tasks = json2.data.team.issues.edges.map((edge) => mapLinearIssue(edge.node, {
1879
- teamId: data.team
1880
- }));
1881
- log7.info("Fetched tasks", {
1882
- count: tasks.length
1883
- }, {
1884
- F: __dxlog_file7,
1885
- L: 104,
1886
- S: this,
1887
- C: (f, a) => f(...a)
1888
- });
1889
- return {
1890
- objects: yield* syncObjects(tasks, {
1891
- foreignKeyId: LINEAR_ID_KEY
1892
- }),
1893
- syncComplete: tasks.length < 150
1894
- };
1895
- }, Effect13.provide(FetchHttpClient2.layer))
1896
- });
1897
- var getLatestUpdateTimestamp = Effect13.fnUntraced(function* (teamId, dataType) {
1898
- const { objects: existingTasks } = yield* DatabaseService10.runQuery(Query4.type(dataType).select(Filter4.foreignKeys(dataType, [
1899
- {
1900
- source: LINEAR_TEAM_ID_KEY,
1901
- id: teamId
1902
- }
1903
- ])));
1904
- return Function5.pipe(existingTasks, Array9.map((task) => Obj9.getKeys(task, LINEAR_UPDATED_AT_KEY).at(0)?.id), Array9.filter((x) => x !== void 0), Array9.reduce("2025-01-01T00:00:00.000Z", (acc, x) => x > acc ? x : acc));
1905
- });
1906
- var mapLinearPerson = (person, { teamId }) => Obj9.make(Person3.Person, {
1907
- [Obj9.Meta]: {
1908
- keys: [
1909
- {
1910
- id: person.id,
1911
- source: LINEAR_ID_KEY
1912
- },
1913
- {
1914
- id: teamId,
1915
- source: LINEAR_TEAM_ID_KEY
1916
- }
1917
- ]
1918
- },
1919
- nickname: person.name
1920
- });
1921
- var mapLinearIssue = (issue, { teamId }) => Obj9.make(Task2.Task, {
1922
- [Obj9.Meta]: {
1923
- keys: [
1924
- {
1925
- id: issue.id,
1926
- source: LINEAR_ID_KEY
1927
- },
1928
- {
1929
- id: issue.updatedAt,
1930
- source: LINEAR_UPDATED_AT_KEY
1931
- },
1932
- {
1933
- id: teamId,
1934
- source: LINEAR_TEAM_ID_KEY
1935
- }
1936
- ]
1937
- },
1938
- title: issue.title ?? void 0,
1939
- description: issue.description ?? void 0,
1940
- assigned: !issue.assignee ? void 0 : Ref5.make(mapLinearPerson(issue.assignee, {
1941
- teamId
1942
- })),
1943
- // TODO(dmaretskyi): Sync those (+ linear team as org?).
1944
- // state: issue.state.name,
1945
- project: !issue.project ? void 0 : Ref5.make(Project2.make({
1946
- [Obj9.Meta]: {
1947
- keys: [
1948
- {
1949
- id: issue.project.id,
1950
- source: LINEAR_ID_KEY
1951
- },
1952
- {
1953
- id: teamId,
1954
- source: LINEAR_TEAM_ID_KEY
1955
- }
1956
- ]
1957
- },
1958
- name: issue.project.name
1959
- }))
1960
- });
1961
-
1962
- // src/functions/linear/index.ts
1963
- (function(Linear2) {
1964
- Linear2.sync = sync_issues_default;
1965
- })(Linear || (Linear = {}));
1966
- var Linear;
1967
-
1968
- // src/functions/tasks/read.ts
1969
- import * as Effect14 from "effect/Effect";
1970
- import * as Schema13 from "effect/Schema";
1971
- import { ArtifactId as ArtifactId4 } from "@dxos/assistant";
1972
- import { DatabaseService as DatabaseService11, defineFunction as defineFunction11 } from "@dxos/functions";
1973
- import { Markdown as Markdown4 } from "@dxos/plugin-markdown/types";
1974
- var read_default2 = defineFunction11({
1975
- key: "dxos.org/function/markdown/read-tasks",
1976
- name: "Read",
1977
- description: "Read markdown tasks.",
1978
- inputSchema: Schema13.Struct({
1979
- id: ArtifactId4.annotations({
1980
- description: "The ID of the document to read."
1981
- })
1982
- }),
1983
- outputSchema: Schema13.Struct({
1984
- content: Schema13.String
1985
- }),
1986
- handler: Effect14.fn(function* ({ data: { id } }) {
1987
- const doc = yield* DatabaseService11.resolve(ArtifactId4.toDXN(id), Markdown4.Document);
1988
- const { content } = yield* DatabaseService11.load(doc.content);
1989
- const lines = content.split("\n");
1990
- const len = String(lines.length).length;
1991
- const numbered = lines.map((line, i) => `${String(i + 1).padStart(len, " ")}. ${line}`).join("\n");
1992
- return {
1993
- content: numbered
1994
- };
1995
- })
1996
- });
1997
-
1998
- // src/functions/tasks/update.ts
1999
- import * as Effect15 from "effect/Effect";
2000
- import * as Schema14 from "effect/Schema";
2001
- import { ArtifactId as ArtifactId5 } from "@dxos/assistant";
2002
- import { DatabaseService as DatabaseService12, defineFunction as defineFunction12 } from "@dxos/functions";
2003
- import { Markdown as Markdown5 } from "@dxos/plugin-markdown/types";
2004
-
2005
- // src/functions/tasks/task-list.ts
2006
- var MarkdownTasks = class {
2007
- _lineEndings;
2008
- _content;
2009
- constructor(initialContent = "") {
2010
- this._lineEndings = initialContent.includes("\r\n") ? "\r\n" : "\n";
2011
- this._content = initialContent ? initialContent.split(this._lineEndings) : [];
2012
- }
2013
- /**
2014
- * Get the current document content with line numbers prefixed.
2015
- */
2016
- getNumberedContent() {
2017
- return this._content.map((line, index) => `${(index + 1).toString().padStart(3, " ")}\u2192${line}`).join(this._lineEndings);
2018
- }
2019
- /**
2020
- * Get the raw document content without line numbers.
2021
- */
2022
- getRawContent() {
2023
- return this._content.join(this._lineEndings);
2024
- }
2025
- /**
2026
- * Insert a new task at the specified line number (1-based).
2027
- * Indentation level determines hierarchy (0, 2, 4, 6 spaces etc.)
2028
- */
2029
- insertTask(lineNumber, taskText, completed = false, indent = 0) {
2030
- const indentStr = " ".repeat(indent);
2031
- const taskLine = completed ? `${indentStr}- [x] ${taskText}` : `${indentStr}- [ ] ${taskText}`;
2032
- const insertIndex = Math.max(0, Math.min(lineNumber - 1, this._content.length));
2033
- this._content.splice(insertIndex, 0, taskLine);
2034
- }
2035
- /**
2036
- * Delete a task at the specified line number (1-based).
2037
- */
2038
- deleteTask(lineNumber) {
2039
- if (lineNumber < 1 || lineNumber > this._content.length) {
2040
- return false;
2041
- }
2042
- this._content.splice(lineNumber - 1, 1);
2043
- return true;
2044
- }
2045
- /**
2046
- * Update the text of a task at the specified line number (1-based).
2047
- */
2048
- updateTaskText(lineNumber, newText) {
2049
- if (lineNumber < 1 || lineNumber > this._content.length) {
2050
- return false;
2051
- }
2052
- const currentLine = this._content[lineNumber - 1];
2053
- const taskMatch = currentLine.match(/^(\s*- \[[x ]\] )(.*)$/);
2054
- if (taskMatch) {
2055
- this._content[lineNumber - 1] = `${taskMatch[1]}${newText}`;
2056
- return true;
2057
- }
2058
- return false;
2059
- }
2060
- /**
2061
- * Mark a task as complete or incomplete at the specified line number (1-based).
2062
- */
2063
- toggleTaskCompletion(lineNumber, completed) {
2064
- if (lineNumber < 1 || lineNumber > this._content.length) {
2065
- return false;
2066
- }
2067
- const currentLine = this._content[lineNumber - 1];
2068
- const taskMatch = currentLine.match(/^(\s*- \[)([x ])(.*)$/);
2069
- if (taskMatch) {
2070
- const isCurrentlyComplete = taskMatch[2] === "x";
2071
- const newStatus = completed !== void 0 ? completed : !isCurrentlyComplete;
2072
- const statusChar = newStatus ? "x" : " ";
2073
- this._content[lineNumber - 1] = `${taskMatch[1]}${statusChar}${taskMatch[3]}`;
2074
- return true;
2075
- }
2076
- return false;
2077
- }
2078
- /**
2079
- * Change the indentation level of a task (for hierarchy).
2080
- */
2081
- setTaskIndent(lineNumber, indent) {
2082
- if (lineNumber < 1 || lineNumber > this._content.length) {
2083
- return false;
2084
- }
2085
- const currentLine = this._content[lineNumber - 1];
2086
- const taskMatch = currentLine.match(/^\s*- (\[[x ]\] .*)$/);
2087
- if (taskMatch) {
2088
- const indentStr = " ".repeat(indent);
2089
- this._content[lineNumber - 1] = `${indentStr}- ${taskMatch[1]}`;
2090
- return true;
2091
- }
2092
- return false;
2093
- }
2094
- /**
2095
- * Get the total number of lines in the document.
2096
- */
2097
- getLineCount() {
2098
- return this._content.length;
2099
- }
2100
- /**
2101
- * Apply multiple operations atomically.
2102
- */
2103
- applyOperations(operations) {
2104
- const sortedOps = [
2105
- ...operations
2106
- ].sort((a, b) => {
2107
- const aLine = "lineNumber" in a ? a.lineNumber : 0;
2108
- const bLine = "lineNumber" in b ? b.lineNumber : 0;
2109
- return bLine - aLine;
2110
- });
2111
- for (const op of sortedOps) {
2112
- switch (op.type) {
2113
- case "insertTask":
2114
- this.insertTask(op.lineNumber, op.text, op.completed, op.indent);
2115
- break;
2116
- case "deleteTask":
2117
- this.deleteTask(op.lineNumber);
2118
- break;
2119
- case "updateTaskText":
2120
- this.updateTaskText(op.lineNumber, op.text);
2121
- break;
2122
- case "toggleTaskCompletion":
2123
- this.toggleTaskCompletion(op.lineNumber, op.completed);
2124
- break;
2125
- case "setTaskIndent":
2126
- this.setTaskIndent(op.lineNumber, op.indent);
2127
- break;
2128
- }
2129
- }
2130
- }
2131
- };
2132
-
2133
- // src/functions/tasks/update.ts
2134
- var update_default2 = defineFunction12({
2135
- key: "dxos.org/function/markdown/update-tasks",
2136
- name: "Update markdown",
2137
- description: "Creates and updates tasks in markdown documents.",
2138
- inputSchema: Schema14.Struct({
2139
- id: ArtifactId5.annotations({
2140
- description: "The ID of the document to update."
2141
- }),
2142
- operations: Schema14.optional(Schema14.Array(Schema14.Any.annotations({
2143
- description: "Task operations to apply."
2144
- })))
2145
- }),
2146
- outputSchema: Schema14.Struct({
2147
- content: Schema14.String,
2148
- numberedContent: Schema14.String.annotations({
2149
- description: "Content with line numbers for agent reference."
2150
- })
2151
- }),
2152
- handler: Effect15.fn(function* ({ data: { id, operations = [] } }) {
2153
- const doc = yield* DatabaseService12.resolve(ArtifactId5.toDXN(id), Markdown5.Document);
2154
- const { content } = yield* DatabaseService12.load(doc.content);
2155
- const taskManager = new MarkdownTasks(content);
2156
- if (operations.length > 0) {
2157
- taskManager.applyOperations(operations);
2158
- }
2159
- return {
2160
- content: taskManager.getRawContent(),
2161
- numberedContent: taskManager.getNumberedContent()
2162
- };
2163
- })
2164
- });
2165
-
2166
- // src/functions/tasks/index.ts
2167
- (function(Tasks2) {
2168
- Tasks2.read = read_default2;
2169
- Tasks2.update = update_default2;
2170
- })(Tasks || (Tasks = {}));
2171
- var Tasks;
2172
-
2173
- // src/blueprints/design/design-blueprint.ts
2174
- var instructions = trim5`
2175
- You manage a design spec based on the conversation.
2176
- The design spec is a markdown document that is used to record the tasks.
2177
- The design spec document follows a hierarchical structure, with nested markdown bulleted sections.
2178
- Use the appropriate tools to read and write the design spec document.
2179
- Maintain the document so that it can convey all relevant points from the conversation.
2180
- When replying to the user, be terse with your comments about design doc handling.
2181
- Do not announce when you read or write the design spec document.
2182
- `;
2183
- var blueprint = Obj10.make(Blueprint.Blueprint, {
2184
- key: "dxos.org/blueprint/design",
2185
- name: "Design Spec",
2186
- description: "Preserve the conversation in the design spec.",
2187
- instructions: {
2188
- source: Ref6.make(Text2.make(instructions))
2189
- },
2190
- tools: [
2191
- Document.read,
2192
- Document.update
2193
- ].map((fn9) => ToolId.make(fn9.key))
2194
- });
2195
- var design_blueprint_default = blueprint;
2196
-
2197
- // src/blueprints/design/index.ts
2198
- var design_default = design_blueprint_default;
2199
-
2200
- // src/blueprints/discord/discord-blueprint.ts
2201
- import { ToolId as ToolId2 } from "@dxos/ai";
2202
- import { Blueprint as Blueprint2 } from "@dxos/blueprints";
2203
- import { Obj as Obj11, Ref as Ref7 } from "@dxos/echo";
2204
- import { Text as Text3 } from "@dxos/schema";
2205
- import { trim as trim6 } from "@dxos/util";
2206
- var instructions2 = trim6`
2207
- You are able to fetch messages from Discord servers.
2208
-
2209
- Known servers:
2210
-
2211
- DXOS serverId: 837138313172353095
2212
- `;
2213
- var blueprint2 = Obj11.make(Blueprint2.Blueprint, {
2214
- key: "dxos.org/blueprint/discord",
2215
- name: "Discord",
2216
- description: "Discord integration.",
2217
- instructions: {
2218
- source: Ref7.make(Text3.make(instructions2))
2219
- },
2220
- tools: [
2221
- ToolId2.make(Discord.fetch.key)
2222
- ]
2223
- });
2224
- var discord_blueprint_default = blueprint2;
2225
-
2226
- // src/blueprints/discord/index.ts
2227
- var discord_default = discord_blueprint_default;
2228
-
2229
- // src/blueprints/linear/linear-blueprint.ts
2230
- import { ToolId as ToolId3 } from "@dxos/ai";
2231
- import { Blueprint as Blueprint3 } from "@dxos/blueprints";
2232
- import { Obj as Obj12, Ref as Ref8 } from "@dxos/echo";
2233
- import { Text as Text4 } from "@dxos/schema";
2234
- import { trim as trim7 } from "@dxos/util";
2235
- var instructions3 = trim7`
2236
- You are able to sync Linear workspaces.
2237
- Sometimes sync does not complete in one go and you need to call the function again.
2238
-
2239
- Known workspaces:
2240
-
2241
- DXOS teamId: 1127c63a-6f77-4725-9229-50f6cd47321c
2242
- `;
2243
- var blueprint3 = Obj12.make(Blueprint3.Blueprint, {
2244
- key: "dxos.org/blueprint/linear",
2245
- name: "Linear",
2246
- description: "Syncs Linear workspaces.",
2247
- instructions: {
2248
- source: Ref8.make(Text4.make(instructions3))
2249
- },
2250
- tools: [
2251
- Linear.sync
2252
- ].map((tool) => ToolId3.make(tool.key))
2253
- });
2254
- var linear_blueprint_default = blueprint3;
2255
-
2256
- // src/blueprints/linear/index.ts
2257
- var linear_default = linear_blueprint_default;
2258
-
2259
- // src/blueprints/planning/planning-blueprint.ts
2260
- import { ToolId as ToolId4 } from "@dxos/ai";
2261
- import { Blueprint as Blueprint4 } from "@dxos/blueprints";
2262
- import { Obj as Obj13, Ref as Ref9 } from "@dxos/echo";
2263
- import { Text as Text5 } from "@dxos/schema";
2264
- import { trim as trim8 } from "@dxos/util";
2265
- var instructions4 = trim8`
2266
- You are a task management agent that maintains hierarchical task lists where each line is a task.
2267
-
2268
- ## Document Format
2269
- You will receive task lists with line numbers prefixed like:
2270
-
2271
- ${"```"}
2272
- 1. - [ ] First main task
2273
- 2. - [ ] Subtask 1: Research phase
2274
- 3. - [x] Literature review
2275
- 4. - [ ] Stakeholder interviews
2276
- 5. - [ ] Subtask 2: Implementation
2277
- 6. - [ ] Setup infrastructure
2278
- 7. - [ ] Write core functionality
2279
- 8. - [ ] Another main task
2280
- ${"```"}
2281
-
2282
- ## Task Hierarchy
2283
- - 0 spaces: Top-level tasks
2284
- - 2 spaces: First-level subtasks
2285
- - 4 spaces: Second-level subtasks
2286
- - 6 spaces: Third-level subtasks (and so on)
2287
-
2288
- ## Available Operations
2289
- You can modify the task list using these operations:
2290
-
2291
- 1. **insertTask(lineNumber, text, completed?, indent?)** - Insert a new task
2292
- 2. **deleteTask(lineNumber)** - Delete a task
2293
- 3. **updateTaskText(lineNumber, text)** - Change task description
2294
- 4. **toggleTaskCompletion(lineNumber, completed?)** - Mark task complete/incomplete
2295
- 5. **setTaskIndent(lineNumber, indent)** - Change task hierarchy level
2296
-
2297
- ## Examples
2298
-
2299
- ### Example 1: Adding a subtask
2300
- **User:** "Add a subtask 'Code review' under the task on line 1"
2301
- **Response:** \`insertTask(2, "Code review", false, 2)\`
2302
-
2303
- ### Example 2: Marking a task complete
2304
- **User:** "Mark the task on line 3 as complete"
2305
- **Response:** \`toggleTaskCompletion(3, true)\`
2306
-
2307
- ### Example 3: Updating task text
2308
- **User:** "Change the task on line 5 to 'Backend implementation'"
2309
- **Response:** \`updateTaskText(5, "Backend implementation")\`
2310
-
2311
- ### Example 4: Creating a task hierarchy
2312
- **User:** "Add a main task 'Testing phase' with two subtasks"
2313
- **Response:**
2314
- \`\`\`
2315
- insertTask(999, "Testing phase", false, 0)
2316
- insertTask(999, "Unit tests", false, 2)
2317
- insertTask(999, "Integration tests", false, 2)
2318
- \`\`\`
2319
-
2320
- ### Example 5: Reorganizing hierarchy
2321
- **User:** "Move the task on line 4 to be a main task (top level)"
2322
- **Response:** \`setTaskIndent(4, 0)\`
2323
-
2324
- ### Example 6: Adding nested subtasks
2325
- **User:** "Add a sub-subtask 'Write test cases' under line 6"
2326
- **Response:** \`insertTask(7, "Write test cases", false, 4)\`
2327
-
2328
- ## Guidelines
2329
- - Always reference line numbers from the numbered document you receive
2330
- - Use line number 999 to append to the end of the document
2331
- - Maintain logical hierarchy (subtasks should be indented under their parent)
2332
- - Use appropriate indentation levels (0, 2, 4, 6, etc. spaces)
2333
- - When creating subtasks, consider the parent task's completion status
2334
- - Be precise with task descriptions and hierarchy levels
2335
- `;
2336
- var blueprint4 = Obj13.make(Blueprint4.Blueprint, {
2337
- key: "dxos.org/blueprint/planning",
2338
- name: "Planning",
2339
- description: "Plans and tracks complex tasks with artifact management.",
2340
- instructions: {
2341
- source: Ref9.make(Text5.make(instructions4))
2342
- },
2343
- tools: [
2344
- Tasks.read,
2345
- Tasks.update
2346
- ].map((fn9) => ToolId4.make(fn9.key))
2347
- });
2348
- var planning_blueprint_default = blueprint4;
2349
-
2350
- // src/blueprints/planning/index.ts
2351
- var planning_default = planning_blueprint_default;
2352
-
2353
- // src/blueprints/research/research-blueprint.ts
2354
- import { ToolId as ToolId5 } from "@dxos/ai";
2355
- import { Blueprint as Blueprint5 } from "@dxos/blueprints";
2356
- import { Obj as Obj14, Ref as Ref10 } from "@dxos/echo";
2357
- import { Text as Text6 } from "@dxos/schema";
2358
- import { trim as trim9 } from "@dxos/util";
2359
- var instructions5 = trim9`
2360
- {{! Research }}
2361
-
2362
- You are an analyst that does research tasks using tools that scrape the web and create structured data.
2363
- Structured data extraction is an experimental feature -- only enable it if the user explicitly requests it in the prompt.
2364
- Prefer updating existing notes instead of creating new ones.
2365
-
2366
- <strcutured_mode>
2367
- When you are done, reply with the created objects.
2368
- Do not print the data, instead reply with inline references to the created objects.
2369
- Those will be later substituted with the pills representing the created objects.
2370
- Print the rest of the created objects as block references after the main note.
2371
-
2372
- <example>
2373
- Based on my research, Google was founded by @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M and @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW9H2ZQ
2374
-
2375
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M</dxn></object>
2376
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW9H2ZQ</dxn></object>
2377
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW92333</dxn></object>
2378
- </example>
2379
- </structured_mode>
2380
-
2381
- <unstructured_mode>
2382
- Reply normally with the text mode of the result of your research.
2383
- </unstructured_mode>
2384
- `;
2385
- var blueprint5 = Obj14.make(Blueprint5.Blueprint, {
2386
- key: "dxos.org/blueprint/research",
2387
- name: "Research",
2388
- description: "Researches the web and creates structured data.",
2389
- instructions: {
2390
- source: Ref10.make(Text6.make(instructions5))
2391
- },
2392
- tools: [
2393
- Research.create,
2394
- Research.research
2395
- ].map((fn9) => ToolId5.make(fn9.key))
2396
- });
2397
- var research_blueprint_default = blueprint5;
2398
-
2399
- // src/blueprints/research/index.ts
2400
- var research_default2 = research_blueprint_default;
2401
-
2402
- // src/blueprints/websearch/websearch-blueprint.ts
2403
- import { ToolId as ToolId6 } from "@dxos/ai";
2404
- import { Blueprint as Blueprint6 } from "@dxos/blueprints";
2405
- import { Obj as Obj15, Ref as Ref11 } from "@dxos/echo";
2406
- import { Text as Text7 } from "@dxos/schema";
2407
- var blueprint6 = Obj15.make(Blueprint6.Blueprint, {
2408
- key: "dxos.org/blueprint/web-search",
2409
- name: "Web Search",
2410
- description: "Search the web.",
2411
- instructions: {
2412
- source: Ref11.make(Text7.make())
2413
- },
2414
- tools: [
2415
- ToolId6.make("AnthropicWebSearch")
2416
- ]
2417
- });
2418
- var websearch_blueprint_default = blueprint6;
2419
-
2420
- // src/blueprints/websearch/websearch-toolkit.ts
2421
- import * as Toolkit4 from "@effect/ai/Toolkit";
2422
- import * as AnthropicTool2 from "@effect/ai-anthropic/AnthropicTool";
2423
- var WebSearchToolkit = Toolkit4.make(AnthropicTool2.WebSearch_20250305({}));
2424
-
2425
- // src/blueprints/websearch/index.ts
2426
- var websearch_default = websearch_blueprint_default;
2427
-
2428
- // src/plugins.tsx
2429
- import * as Schema15 from "effect/Schema";
2430
- import React from "react";
2431
- import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
2432
- import { Type as Type3 } from "@dxos/echo";
2433
- import { JsonFilter } from "@dxos/react-ui-syntax-highlighter";
2434
- var MapSchema = Schema15.Struct({
2435
- coordinates: Type3.Format.GeoPoint
2436
- }).pipe(Type3.Obj({
2437
- typename: "example.com/type/Map",
2438
- version: "0.1.0"
2439
- }));
2440
- var isImage = (data) => false;
2441
- var capabilities = [
2442
- contributes(Capabilities.ReactSurface, createSurface({
2443
- id: "plugin-image",
2444
- role: "card--extrinsic",
2445
- filter: (data) => isImage(data.value),
2446
- component: ({ data }) => /* @__PURE__ */ React.createElement("img", {
2447
- className: "grow object-cover",
2448
- src: `data:image/jpeg;base64,${data.value.source.data}`,
2449
- alt: data.value.prompt ?? `Generated image [id=${data.value.id}]`
2450
- })
2451
- })),
2452
- //
2453
- // Default
2454
- //
2455
- contributes(Capabilities.ReactSurface, createSurface({
2456
- id: "plugin-default",
2457
- role: "card--extrinsic",
2458
- position: "fallback",
2459
- component: ({ role, data }) => /* @__PURE__ */ React.createElement(JsonFilter, {
2460
- data
2461
- })
2462
- }))
2463
- ];
2464
-
2465
- // src/toolkits/AssistantToolkit.ts
2466
- var AssistantToolkit_exports = {};
2467
- __export(AssistantToolkit_exports, {
2468
- AssistantToolkit: () => AssistantToolkit,
2469
- layer: () => layer3,
2470
- tools: () => tools
2471
- });
2472
- import * as Tool2 from "@effect/ai/Tool";
2473
- import * as Toolkit5 from "@effect/ai/Toolkit";
2474
- import * as Effect16 from "effect/Effect";
2475
- import * as Record from "effect/Record";
2476
- import * as Schema16 from "effect/Schema";
2477
- import { AiContextService, ArtifactId as ArtifactId6 } from "@dxos/assistant";
2478
- import { Ref as Ref12 } from "@dxos/echo";
2479
- import { DatabaseService as DatabaseService13 } from "@dxos/functions";
2480
- import { trim as trim10 } from "@dxos/util";
2481
- var AssistantToolkit = Toolkit5.make(Tool2.make("add-to-context", {
2482
- description: trim10`
2483
- Adds the object to the chat context.
2484
- `,
2485
- parameters: {
2486
- id: ArtifactId6.annotations({
2487
- description: "The ID of the document to read."
2488
- })
2489
- },
2490
- success: Schema16.Void,
2491
- failure: Schema16.Never,
2492
- dependencies: [
2493
- AiContextService,
2494
- DatabaseService13
2495
- ]
2496
- }));
2497
- var tools = Record.keys(AssistantToolkit.tools);
2498
- var layer3 = () => AssistantToolkit.toLayer({
2499
- "add-to-context": Effect16.fnUntraced(function* ({ id }) {
2500
- const { binder } = yield* AiContextService;
2501
- const { db } = yield* DatabaseService13;
2502
- const ref = Ref12.fromDXN(ArtifactId6.toDXN(id, db.spaceId));
2503
- yield* Effect16.promise(() => binder.bind({
2504
- blueprints: [],
2505
- objects: [
2506
- ref
2507
- ]
2508
- }));
2509
- })
2510
- });
2511
-
2512
- // src/toolkits/SystemToolkit.ts
2513
- var SystemToolkit_exports = {};
2514
- __export(SystemToolkit_exports, {
2515
- SystemToolkit: () => SystemToolkit,
2516
- layer: () => layer4,
2517
- tools: () => tools2
2518
- });
2519
- import * as Tool3 from "@effect/ai/Tool";
2520
- import * as Toolkit6 from "@effect/ai/Toolkit";
2521
- import * as Effect17 from "effect/Effect";
2522
- import * as Record2 from "effect/Record";
2523
- import * as Schema17 from "effect/Schema";
2524
- import { ArtifactId as ArtifactId7 } from "@dxos/assistant";
2525
- import { DXN as DXN2, Obj as Obj16, Relation as Relation2, Tag as Tag2, Type as Type4 } from "@dxos/echo";
2526
- import { DatabaseService as DatabaseService14 } from "@dxos/functions";
2527
- import { trim as trim11 } from "@dxos/util";
2528
- var SystemToolkit = Toolkit6.make(
2529
- //
2530
- // Schema
2531
- //
2532
- Tool3.make("schema-list", {
2533
- description: trim11`
2534
- Lists schemas definitions.
2535
- `,
2536
- parameters: {
2537
- // TODO(wittjosiah): Remove this once parameter-less tools are fixed.
2538
- limit: Schema17.Number
2539
- },
2540
- // TODO(dmaretskyi): Effect returns ({ result, encodedResult })
2541
- success: Schema17.Any,
2542
- failure: Schema17.Never,
2543
- dependencies: [
2544
- DatabaseService14
2545
- ]
2546
- }),
2547
- Tool3.make("schema-add", {
2548
- description: trim11`
2549
- Adds a schema to the space.
2550
- The name will be used when displayed to the user.
2551
- The typename must be in the format of "example.com/type/Type".
2552
- `,
2553
- parameters: {
2554
- name: Schema17.String,
2555
- typename: Schema17.String,
2556
- jsonSchema: Schema17.Any
2557
- },
2558
- success: Schema17.Any,
2559
- failure: Schema17.Never,
2560
- dependencies: [
2561
- DatabaseService14
2562
- ]
2563
- }),
2564
- //
2565
- // Objects
2566
- //
2567
- Tool3.make("object-create", {
2568
- description: trim11`
2569
- Creates a new object and adds it to the current space.
2570
- Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.
2571
- `,
2572
- parameters: {
2573
- typename: Schema17.String,
2574
- data: Schema17.Any
2575
- },
2576
- success: Schema17.Any,
2577
- failure: Schema17.Never,
2578
- dependencies: [
2579
- DatabaseService14
2580
- ]
2581
- }),
2582
- Tool3.make("object-remove", {
2583
- description: trim11`
2584
- Removes an object or relation from the database.
2585
- `,
2586
- parameters: {
2587
- id: ArtifactId7.annotations({
2588
- description: "The ID of the object."
2589
- })
2590
- },
2591
- success: Schema17.Any,
2592
- failure: Schema17.Never,
2593
- dependencies: [
2594
- DatabaseService14
2595
- ]
2596
- }),
2597
- //
2598
- // Relations
2599
- //
2600
- Tool3.make("relation-create", {
2601
- description: trim11`
2602
- Creates a new relation and adds it to the current space.
2603
- Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.
2604
- `,
2605
- parameters: {
2606
- typename: Schema17.String,
2607
- source: ArtifactId7.annotations({
2608
- description: "The ID of the source object."
2609
- }),
2610
- target: ArtifactId7.annotations({
2611
- description: "The ID of the target object."
2612
- }),
2613
- data: Schema17.Any.annotations({
2614
- description: "The data to be stored in the relation."
2615
- })
2616
- },
2617
- success: Schema17.Any,
2618
- failure: Schema17.Never,
2619
- dependencies: [
2620
- DatabaseService14
2621
- ]
2622
- }),
2623
- //
2624
- // Tags
2625
- //
2626
- Tool3.make("tag-add", {
2627
- description: trim11`
2628
- Adds a tag to an object.
2629
- Tags are objects of type ${Tag2.Tag.typename}.
2630
- `,
2631
- parameters: {
2632
- tagId: ArtifactId7.annotations({
2633
- description: "The ID of the tag."
2634
- }),
2635
- objectId: ArtifactId7.annotations({
2636
- description: "The ID of the object."
2637
- })
2638
- },
2639
- success: Schema17.Any,
2640
- failure: Schema17.Never,
2641
- dependencies: [
2642
- DatabaseService14
2643
- ]
2644
- }),
2645
- Tool3.make("tag-remove", {
2646
- description: trim11`
2647
- Removes a tag from an object.
2648
- Tags are objects of type ${Tag2.Tag.typename}.
2649
- `,
2650
- parameters: {
2651
- tagId: ArtifactId7.annotations({
2652
- description: "The ID of the tag."
2653
- }),
2654
- objectId: ArtifactId7.annotations({
2655
- description: "The ID of the object."
2656
- })
2657
- },
2658
- success: Schema17.Any,
2659
- failure: Schema17.Never,
2660
- dependencies: [
2661
- DatabaseService14
2662
- ]
2663
- })
2664
- );
2665
- var tools2 = Record2.keys(SystemToolkit.tools);
2666
- var layer4 = () => SystemToolkit.toLayer({
2667
- "schema-list": Effect17.fnUntraced(function* () {
2668
- const { db } = yield* DatabaseService14;
2669
- const schema = yield* Effect17.promise(() => db.schemaRegistry.query({
2670
- location: [
2671
- "database",
2672
- "runtime"
2673
- ]
2674
- }).run());
2675
- return schema.map((schema2) => {
2676
- const meta = Type4.getMeta(schema2);
2677
- return {
2678
- typename: Type4.getTypename(schema2),
2679
- jsonSchema: Type4.toJsonSchema(schema2),
2680
- kind: meta?.sourceSchema ? "relation" : "record"
2681
- };
2682
- });
2683
- }),
2684
- "schema-add": Effect17.fnUntraced(function* ({ name, typename, jsonSchema }) {
2685
- const { db } = yield* DatabaseService14;
2686
- yield* Effect17.promise(() => db.schemaRegistry.register([
2687
- {
2688
- typename,
2689
- version: "0.1.0",
2690
- jsonSchema,
2691
- name
2692
- }
2693
- ]));
2694
- }),
2695
- "object-create": Effect17.fnUntraced(function* ({ typename, data }) {
2696
- const { db } = yield* DatabaseService14;
2697
- const schema = yield* Effect17.promise(() => db.schemaRegistry.query({
2698
- typename,
2699
- location: [
2700
- "database",
2701
- "runtime"
2702
- ]
2703
- }).first());
2704
- const object = db.add(Obj16.make(schema, data));
2705
- return object;
2706
- }),
2707
- "object-remove": Effect17.fnUntraced(function* ({ id }) {
2708
- const { db } = yield* DatabaseService14;
2709
- const object = yield* DatabaseService14.resolve(DXN2.parse(id));
2710
- db.remove(object);
2711
- return object;
2712
- }),
2713
- "relation-create": Effect17.fnUntraced(function* ({ typename, source, target, data }) {
2714
- const { db } = yield* DatabaseService14;
2715
- const schema = yield* Effect17.promise(() => db.schemaRegistry.query({
2716
- typename,
2717
- location: [
2718
- "database",
2719
- "runtime"
2720
- ]
2721
- }).first());
2722
- const sourceObj = yield* DatabaseService14.resolve(DXN2.parse(source));
2723
- const targetObj = yield* DatabaseService14.resolve(DXN2.parse(target));
2724
- const relation = db.add(Relation2.make(schema, {
2725
- [Relation2.Source]: sourceObj,
2726
- [Relation2.Target]: targetObj,
2727
- ...data
2728
- }));
2729
- return relation;
2730
- }),
2731
- "tag-add": Effect17.fnUntraced(function* ({ tagId, objectId }) {
2732
- const object = yield* DatabaseService14.resolve(DXN2.parse(objectId));
2733
- Obj16.addTag(object, DXN2.parse(tagId).toString());
2734
- return object;
2735
- }),
2736
- "tag-remove": Effect17.fnUntraced(function* ({ tagId, objectId }) {
2737
- const object = yield* DatabaseService14.resolve(DXN2.parse(objectId));
2738
- Obj16.removeTag(object, DXN2.parse(tagId).toString());
2739
- return object;
2740
- })
2741
- });
2742
553
  export {
2743
- Agent,
2744
- AssistantToolkit_exports as AssistantToolkit,
2745
- design_default as DesignBlueprint,
2746
- Discord,
2747
- discord_default as DiscordBlueprint,
2748
- Document,
2749
- EntityExtraction,
2750
- Linear,
2751
- linear_default as LinearBlueprint,
2752
- LocalSearchHandler,
2753
- LocalSearchToolkit,
2754
- MapSchema,
2755
- planning_default as PlanningBlueprint,
2756
- Research,
2757
- research_default2 as ResearchBlueprint,
2758
- ResearchDataTypes,
2759
- ResearchGraph,
2760
- Subgraph,
2761
- SystemToolkit_exports as SystemToolkit,
2762
- Tasks,
2763
- websearch_default as WebSearchBlueprint,
2764
- WebSearchToolkit,
2765
- capabilities,
2766
- contextQueueLayerFromResearchGraph,
2767
- createExtractionSchema,
2768
- createResearchGraph,
2769
- findRelatedSchema,
2770
- getSanitizedSchemaName,
2771
- makeGraphWriterHandler,
2772
- makeGraphWriterToolkit,
2773
- queryResearchGraph,
2774
- sanitizeObjects,
2775
- syncObjects
554
+ mock_default as default
2776
555
  };
2777
- //# sourceMappingURL=index.mjs.map
556
+ //# sourceMappingURL=mock-2ARYZ54S.mjs.map