@dxos/assistant-toolkit 0.8.4-main.70d3990 → 0.8.4-main.74a063c4e0

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 (671) hide show
  1. package/dist/lib/neutral/add-artifact-W2CRMEAZ.mjs +30 -0
  2. package/dist/lib/neutral/add-artifact-W2CRMEAZ.mjs.map +7 -0
  3. package/dist/lib/neutral/agent-CT44JSYM.mjs +85 -0
  4. package/dist/lib/neutral/agent-CT44JSYM.mjs.map +7 -0
  5. package/dist/lib/neutral/chunk-2SH4XUQR.mjs +239 -0
  6. package/dist/lib/neutral/chunk-2SH4XUQR.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-A4AVXKBT.mjs +694 -0
  12. package/dist/lib/neutral/chunk-A4AVXKBT.mjs.map +7 -0
  13. package/dist/lib/neutral/chunk-AGG6OZNB.mjs +74 -0
  14. package/dist/lib/neutral/chunk-AGG6OZNB.mjs.map +7 -0
  15. package/dist/lib/neutral/chunk-AKMBURAD.mjs +320 -0
  16. package/dist/lib/neutral/chunk-AKMBURAD.mjs.map +7 -0
  17. package/dist/lib/neutral/chunk-B2PLQKOJ.mjs +103 -0
  18. package/dist/lib/neutral/chunk-B2PLQKOJ.mjs.map +7 -0
  19. package/dist/lib/neutral/chunk-BO4ZVH7M.mjs +73 -0
  20. package/dist/lib/neutral/chunk-BO4ZVH7M.mjs.map +7 -0
  21. package/dist/lib/neutral/chunk-HZM3HNAS.mjs +78 -0
  22. package/dist/lib/neutral/chunk-HZM3HNAS.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-ILZ2ODWC.mjs +95 -0
  24. package/dist/lib/neutral/chunk-ILZ2ODWC.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  26. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-KW45RMNS.mjs +140 -0
  28. package/dist/lib/neutral/chunk-KW45RMNS.mjs.map +7 -0
  29. package/dist/lib/neutral/chunk-LI6VMCJW.mjs +27 -0
  30. package/dist/lib/neutral/chunk-LI6VMCJW.mjs.map +7 -0
  31. package/dist/lib/neutral/chunk-MEZ4UFR6.mjs +25 -0
  32. package/dist/lib/neutral/chunk-MEZ4UFR6.mjs.map +7 -0
  33. package/dist/lib/neutral/chunk-TKJH3CAH.mjs +53 -0
  34. package/dist/lib/neutral/chunk-TKJH3CAH.mjs.map +7 -0
  35. package/dist/lib/neutral/chunk-U26AX7D7.mjs +76 -0
  36. package/dist/lib/neutral/chunk-U26AX7D7.mjs.map +7 -0
  37. package/dist/lib/neutral/chunk-VBSCQN37.mjs +52 -0
  38. package/dist/lib/neutral/chunk-VBSCQN37.mjs.map +7 -0
  39. package/dist/lib/neutral/chunk-VDEDVOS6.mjs +39 -0
  40. package/dist/lib/neutral/chunk-VDEDVOS6.mjs.map +7 -0
  41. package/dist/lib/neutral/chunk-VHYUC3HO.mjs +70 -0
  42. package/dist/lib/neutral/chunk-VHYUC3HO.mjs.map +7 -0
  43. package/dist/lib/neutral/chunk-XT5ZSUS6.mjs +363 -0
  44. package/dist/lib/neutral/chunk-XT5ZSUS6.mjs.map +7 -0
  45. package/dist/lib/neutral/chunk-YBTLIXQK.mjs +29 -0
  46. package/dist/lib/neutral/chunk-YBTLIXQK.mjs.map +7 -0
  47. package/dist/lib/neutral/context-add-U5LSEQLG.mjs +22 -0
  48. package/dist/lib/neutral/context-add-U5LSEQLG.mjs.map +7 -0
  49. package/dist/lib/neutral/context-remove-3YGXLVRA.mjs +22 -0
  50. package/dist/lib/neutral/context-remove-3YGXLVRA.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-NESP7QHJ.mjs +36 -0
  54. package/dist/lib/neutral/create-project-NESP7QHJ.mjs.map +7 -0
  55. package/dist/lib/neutral/delete-LHMZDJFA.mjs +19 -0
  56. package/dist/lib/neutral/delete-LHMZDJFA.mjs.map +7 -0
  57. package/dist/lib/neutral/document-create-53ZVNGFR.mjs +57 -0
  58. package/dist/lib/neutral/document-create-53ZVNGFR.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-EEMRVHPI.mjs +196 -0
  62. package/dist/lib/neutral/entity-extraction-EEMRVHPI.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-AFX7ZAVE.mjs +154 -0
  68. package/dist/lib/neutral/fetch-messages-AFX7ZAVE.mjs.map +7 -0
  69. package/dist/lib/neutral/get-context-LUOU7M3Z.mjs +35 -0
  70. package/dist/lib/neutral/get-context-LUOU7M3Z.mjs.map +7 -0
  71. package/dist/lib/neutral/index.mjs +248 -0
  72. package/dist/lib/neutral/index.mjs.map +7 -0
  73. package/dist/lib/neutral/load-KHLICMGJ.mjs +17 -0
  74. package/dist/lib/neutral/load-KHLICMGJ.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 -2250
  77. package/dist/lib/neutral/mock-2ARYZ54S.mjs.map +7 -0
  78. package/dist/lib/neutral/object-create-7J7D53FT.mjs +43 -0
  79. package/dist/lib/neutral/object-create-7J7D53FT.mjs.map +7 -0
  80. package/dist/lib/neutral/object-delete-QFXUHJ2D.mjs +18 -0
  81. package/dist/lib/neutral/object-delete-QFXUHJ2D.mjs.map +7 -0
  82. package/dist/lib/neutral/object-update-C73HRM5F.mjs +28 -0
  83. package/dist/lib/neutral/object-update-C73HRM5F.mjs.map +7 -0
  84. package/dist/lib/neutral/project-XFTFWHSY.mjs +23 -0
  85. package/dist/lib/neutral/project-XFTFWHSY.mjs.map +7 -0
  86. package/dist/lib/neutral/project-rules-IYRR6OQE.mjs +77 -0
  87. package/dist/lib/neutral/project-rules-IYRR6OQE.mjs.map +7 -0
  88. package/dist/lib/neutral/prompt-MWQPSPDW.mjs +193 -0
  89. package/dist/lib/neutral/prompt-MWQPSPDW.mjs.map +7 -0
  90. package/dist/lib/neutral/qualifier-KIBSTV6F.mjs +104 -0
  91. package/dist/lib/neutral/qualifier-KIBSTV6F.mjs.map +7 -0
  92. package/dist/lib/neutral/query-MN5B3MQF.mjs +32 -0
  93. package/dist/lib/neutral/query-MN5B3MQF.mjs.map +7 -0
  94. package/dist/lib/neutral/query-ZMWWZ4I3.mjs +67 -0
  95. package/dist/lib/neutral/query-ZMWWZ4I3.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-YWV2TUKS.mjs +42 -0
  101. package/dist/lib/neutral/relation-create-YWV2TUKS.mjs.map +7 -0
  102. package/dist/lib/neutral/relation-delete-JGGA4CYQ.mjs +18 -0
  103. package/dist/lib/neutral/relation-delete-JGGA4CYQ.mjs.map +7 -0
  104. package/dist/lib/neutral/research-7JQEX7MU.mjs +109 -0
  105. package/dist/lib/neutral/research-7JQEX7MU.mjs.map +7 -0
  106. package/dist/lib/neutral/save-ZWWNTBOD.mjs +23 -0
  107. package/dist/lib/neutral/save-ZWWNTBOD.mjs.map +7 -0
  108. package/dist/lib/neutral/schema-add-7WKPPKW4.mjs +24 -0
  109. package/dist/lib/neutral/schema-add-7WKPPKW4.mjs.map +7 -0
  110. package/dist/lib/neutral/schema-list-MIAIKERK.mjs +30 -0
  111. package/dist/lib/neutral/schema-list-MIAIKERK.mjs.map +7 -0
  112. package/dist/lib/neutral/sync-issues-GQFVEV4W.mjs +179 -0
  113. package/dist/lib/neutral/sync-issues-GQFVEV4W.mjs.map +7 -0
  114. package/dist/lib/neutral/sync-triggers-MBKM6VIQ.mjs +128 -0
  115. package/dist/lib/neutral/sync-triggers-MBKM6VIQ.mjs.map +7 -0
  116. package/dist/lib/neutral/tag-add-IKD4ADDM.mjs +19 -0
  117. package/dist/lib/neutral/tag-add-IKD4ADDM.mjs.map +7 -0
  118. package/dist/lib/neutral/tag-remove-PCSKCFT2.mjs +19 -0
  119. package/dist/lib/neutral/tag-remove-PCSKCFT2.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-HZ7A3ZA5.mjs +20 -0
  123. package/dist/lib/neutral/update-HZ7A3ZA5.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-D5XKU3TE.mjs +46 -0
  127. package/dist/lib/neutral/update-tasks-D5XKU3TE.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 +58 -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 +11 -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 +151 -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 +18 -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 +24 -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 +16 -4
  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 -170
  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 -172
  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/Chat.d.ts +52 -0
  396. package/dist/types/src/types/Chat.d.ts.map +1 -0
  397. package/dist/types/src/types/Memory.d.ts +12 -0
  398. package/dist/types/src/types/Memory.d.ts.map +1 -0
  399. package/dist/types/src/types/Plan.d.ts +86 -0
  400. package/dist/types/src/types/Plan.d.ts.map +1 -0
  401. package/dist/types/src/types/Project.d.ts +73 -0
  402. package/dist/types/src/types/Project.d.ts.map +1 -0
  403. package/dist/types/src/types/index.d.ts +5 -0
  404. package/dist/types/src/types/index.d.ts.map +1 -0
  405. package/dist/types/tsconfig.tsbuildinfo +1 -1
  406. package/package.json +50 -40
  407. package/src/blueprints/automation/blueprint.ts +108 -0
  408. package/src/blueprints/automation/index.ts +5 -0
  409. package/src/blueprints/blueprint-manager/blueprint.conversations.json +1 -0
  410. package/src/blueprints/blueprint-manager/blueprint.test.ts +176 -0
  411. package/src/blueprints/blueprint-manager/blueprint.ts +50 -0
  412. package/src/blueprints/blueprint-manager/functions/definitions.ts +58 -0
  413. package/src/blueprints/blueprint-manager/functions/enable-blueprints.ts +44 -0
  414. package/src/blueprints/blueprint-manager/functions/index.ts +13 -0
  415. package/src/blueprints/blueprint-manager/functions/query-blueprints.ts +19 -0
  416. package/src/blueprints/blueprint-manager/functions/update-blueprints.ts +19 -0
  417. package/src/blueprints/blueprint-manager/index.ts +6 -0
  418. package/src/blueprints/browser/blueprint.conversations.json +1 -0
  419. package/src/blueprints/browser/blueprint.test.ts +63 -0
  420. package/src/blueprints/browser/blueprint.ts +41 -0
  421. package/src/blueprints/browser/index.ts +5 -0
  422. package/src/blueprints/database/blueprint.conversations.json +1 -0
  423. package/src/blueprints/database/blueprint.test.ts +455 -0
  424. package/src/blueprints/database/blueprint.ts +67 -0
  425. package/src/blueprints/database/functions/context-add.ts +24 -0
  426. package/src/blueprints/database/functions/context-remove.ts +24 -0
  427. package/src/blueprints/database/functions/definitions.ts +301 -0
  428. package/src/blueprints/database/functions/index.ts +23 -0
  429. package/src/blueprints/database/functions/load.ts +19 -0
  430. package/src/blueprints/database/functions/object-create.ts +38 -0
  431. package/src/blueprints/database/functions/object-delete.ts +20 -0
  432. package/src/blueprints/database/functions/object-update.ts +30 -0
  433. package/src/blueprints/database/functions/query.ts +59 -0
  434. package/src/blueprints/database/functions/relation-create.ts +34 -0
  435. package/src/blueprints/database/functions/relation-delete.ts +21 -0
  436. package/src/blueprints/database/functions/schema-add.ts +28 -0
  437. package/src/blueprints/database/functions/schema-list.ts +27 -0
  438. package/src/blueprints/database/functions/tag-add.ts +21 -0
  439. package/src/blueprints/database/functions/tag-remove.ts +21 -0
  440. package/src/blueprints/database/index.ts +21 -0
  441. package/src/blueprints/design/{design-blueprint.test.ts → blueprint.test.ts} +23 -29
  442. package/src/blueprints/design/{design-blueprint.ts → blueprint.ts} +20 -12
  443. package/src/blueprints/design/index.ts +1 -3
  444. package/src/blueprints/discord/blueprint.ts +42 -0
  445. package/src/blueprints/discord/functions/definitions.ts +71 -0
  446. package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.ts +7 -9
  447. package/src/blueprints/discord/functions/fetch-messages.ts +199 -0
  448. package/src/blueprints/discord/functions/index.ts +9 -0
  449. package/src/blueprints/discord/index.ts +2 -3
  450. package/src/blueprints/github/functions/definitions.ts +27 -0
  451. package/src/blueprints/github/functions/fetch-prs.ts +24 -0
  452. package/src/blueprints/github/functions/index.ts +9 -0
  453. package/src/blueprints/github/index.ts +5 -0
  454. package/src/blueprints/index.ts +14 -6
  455. package/src/blueprints/linear/blueprint.ts +43 -0
  456. package/src/blueprints/linear/functions/definitions.ts +24 -0
  457. package/src/blueprints/linear/functions/index.ts +9 -0
  458. package/src/blueprints/linear/functions/linear.test.ts +59 -0
  459. package/src/{functions/linear → blueprints/linear/functions}/sync-issues.ts +40 -46
  460. package/src/blueprints/linear/index.ts +2 -3
  461. package/src/blueprints/markdown/blueprint.ts +36 -0
  462. package/src/blueprints/markdown/functions/create.ts +20 -0
  463. package/src/blueprints/markdown/functions/definitions.ts +80 -0
  464. package/src/blueprints/markdown/functions/index.ts +13 -0
  465. package/src/blueprints/markdown/functions/read.ts +22 -0
  466. package/src/blueprints/markdown/functions/update.ts +22 -0
  467. package/src/blueprints/markdown/index.ts +11 -0
  468. package/src/blueprints/memory/blueprint.conversations.json +1 -0
  469. package/src/blueprints/memory/blueprint.test.ts +139 -0
  470. package/src/blueprints/memory/blueprint.ts +42 -0
  471. package/src/blueprints/memory/functions/definitions.ts +68 -0
  472. package/src/blueprints/memory/functions/delete.ts +20 -0
  473. package/src/blueprints/memory/functions/index.ts +13 -0
  474. package/src/blueprints/memory/functions/query.ts +32 -0
  475. package/src/blueprints/memory/functions/save.ts +20 -0
  476. package/src/blueprints/memory/index.ts +6 -0
  477. package/src/blueprints/planning/blueprint.ts +25 -0
  478. package/src/blueprints/planning/functions/definitions.ts +137 -0
  479. package/src/blueprints/planning/functions/index.ts +9 -0
  480. package/src/blueprints/planning/functions/update-tasks.ts +45 -0
  481. package/src/blueprints/planning/index.ts +3 -4
  482. package/src/blueprints/{planning/planning-blueprint.test.ts → planning-old/blueprint.test.ts} +21 -23
  483. package/src/blueprints/{planning/planning-blueprint.ts → planning-old/blueprint.ts} +20 -12
  484. package/src/blueprints/planning-old/functions/definitions.ts +53 -0
  485. package/src/blueprints/planning-old/functions/index.ts +12 -0
  486. package/src/blueprints/planning-old/functions/read.ts +24 -0
  487. package/src/blueprints/planning-old/functions/update.ts +31 -0
  488. package/src/blueprints/planning-old/index.ts +6 -0
  489. package/src/blueprints/project/blueprint.conversations.json +1 -0
  490. package/src/blueprints/project/blueprint.test.ts +653 -0
  491. package/src/blueprints/project/blueprint.ts +65 -0
  492. package/src/blueprints/project/functions/add-artifact.ts +30 -0
  493. package/src/blueprints/project/functions/agent.ts +66 -0
  494. package/src/blueprints/project/functions/definitions.ts +95 -0
  495. package/src/blueprints/project/functions/get-context.ts +46 -0
  496. package/src/blueprints/project/functions/index.ts +14 -0
  497. package/src/blueprints/project/functions/qualifier.ts +90 -0
  498. package/src/blueprints/project/index.ts +6 -0
  499. package/src/blueprints/project-wizard/blueprint.ts +48 -0
  500. package/src/blueprints/project-wizard/functions/create-project.ts +33 -0
  501. package/src/blueprints/project-wizard/functions/definitions.ts +64 -0
  502. package/src/blueprints/project-wizard/functions/index.ts +13 -0
  503. package/src/blueprints/project-wizard/functions/project-rules.ts +76 -0
  504. package/src/blueprints/project-wizard/functions/sync-triggers.ts +158 -0
  505. package/src/blueprints/project-wizard/index.ts +6 -0
  506. package/src/blueprints/research/{research-blueprint.ts → blueprint.ts} +21 -13
  507. package/src/blueprints/research/functions/definitions.ts +87 -0
  508. package/src/blueprints/research/functions/document-create.ts +50 -0
  509. package/src/blueprints/research/functions/index.ts +12 -0
  510. package/src/{functions/research → blueprints/research/functions}/research-instructions.tpl +5 -5
  511. package/src/blueprints/research/functions/research.conversations.json +1 -0
  512. package/src/blueprints/research/functions/research.test.ts +150 -0
  513. package/src/blueprints/research/functions/research.ts +137 -0
  514. package/src/blueprints/research/index.ts +3 -3
  515. package/src/blueprints/research/types/ResearchGraph.ts +62 -0
  516. package/src/{functions/research/types.ts → blueprints/research/types/index.ts} +12 -6
  517. package/src/blueprints/testing.ts +34 -5
  518. package/src/blueprints/websearch/blueprint.conversations.json +1 -0
  519. package/src/blueprints/websearch/blueprint.test.ts +39 -0
  520. package/src/blueprints/websearch/blueprint.ts +31 -0
  521. package/src/blueprints/websearch/functions/definitions.ts +25 -0
  522. package/src/blueprints/websearch/functions/fetch.ts +18 -0
  523. package/src/blueprints/websearch/functions/index.ts +9 -0
  524. package/src/blueprints/websearch/index.ts +3 -4
  525. package/src/blueprints/websearch/{websearch-toolkit.ts → toolkit.ts} +6 -1
  526. package/src/crud/graph.test.ts +6 -29
  527. package/src/crud/graph.ts +22 -24
  528. package/src/errors.ts +25 -0
  529. package/src/functions/READ_THIS.md +5 -0
  530. package/src/functions/agent/definitions.ts +53 -0
  531. package/src/functions/agent/index.ts +3 -5
  532. package/src/functions/agent/prompt.conversations.json +1 -0
  533. package/src/functions/agent/prompt.test.ts +82 -0
  534. package/src/functions/agent/prompt.ts +206 -101
  535. package/src/functions/entity-extraction/definitions.ts +44 -0
  536. package/src/functions/entity-extraction/entity-extraction.conversations.json +1 -1
  537. package/src/functions/entity-extraction/entity-extraction.test.ts +14 -32
  538. package/src/functions/entity-extraction/entity-extraction.ts +80 -85
  539. package/src/functions/entity-extraction/index.ts +4 -4
  540. package/src/functions/exa/definitions.ts +37 -0
  541. package/src/functions/exa/exa.ts +22 -27
  542. package/src/functions/exa/index.ts +8 -2
  543. package/src/functions/exa/mock.ts +26 -35
  544. package/src/functions/index.ts +1 -5
  545. package/src/index.ts +2 -2
  546. package/src/sync/sync.ts +38 -30
  547. package/src/testing/index.ts +2 -1
  548. package/src/testing/plugins.tsx +77 -0
  549. package/src/toolkits/WebToolkit.ts +33 -0
  550. package/src/toolkits/index.ts +1 -2
  551. package/src/types/Chat.ts +62 -0
  552. package/src/types/Memory.ts +23 -0
  553. package/src/types/Plan.ts +110 -0
  554. package/src/types/Project.ts +201 -0
  555. package/src/types/index.ts +8 -0
  556. package/dist/lib/browser/index.mjs.map +0 -7
  557. package/dist/lib/browser/meta.json +0 -1
  558. package/dist/lib/node-esm/index.mjs +0 -2779
  559. package/dist/lib/node-esm/index.mjs.map +0 -7
  560. package/dist/lib/node-esm/meta.json +0 -1
  561. package/dist/types/src/blueprints/design/design-blueprint.d.ts +0 -4
  562. package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +0 -1
  563. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts +0 -2
  564. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts.map +0 -1
  565. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +0 -19
  566. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +0 -1
  567. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +0 -19
  568. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +0 -1
  569. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +0 -4
  570. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +0 -1
  571. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts +0 -2
  572. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts.map +0 -1
  573. package/dist/types/src/blueprints/research/research-blueprint.d.ts +0 -4
  574. package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +0 -1
  575. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts +0 -2
  576. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts.map +0 -1
  577. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +0 -4
  578. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +0 -1
  579. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts.map +0 -1
  580. package/dist/types/src/experimental/feed.test.d.ts +0 -2
  581. package/dist/types/src/experimental/feed.test.d.ts.map +0 -1
  582. package/dist/types/src/functions/discord/fetch-messages.d.ts.map +0 -1
  583. package/dist/types/src/functions/discord/fetch-messages.test.d.ts.map +0 -1
  584. package/dist/types/src/functions/discord/index.d.ts +0 -12
  585. package/dist/types/src/functions/discord/index.d.ts.map +0 -1
  586. package/dist/types/src/functions/document/index.d.ts +0 -13
  587. package/dist/types/src/functions/document/index.d.ts.map +0 -1
  588. package/dist/types/src/functions/document/read.d.ts +0 -7
  589. package/dist/types/src/functions/document/read.d.ts.map +0 -1
  590. package/dist/types/src/functions/document/update.d.ts +0 -6
  591. package/dist/types/src/functions/document/update.d.ts.map +0 -1
  592. package/dist/types/src/functions/github/fetch-prs.d.ts +0 -6
  593. package/dist/types/src/functions/github/fetch-prs.d.ts.map +0 -1
  594. package/dist/types/src/functions/linear/index.d.ts +0 -9
  595. package/dist/types/src/functions/linear/index.d.ts.map +0 -1
  596. package/dist/types/src/functions/linear/linear.test.d.ts.map +0 -1
  597. package/dist/types/src/functions/linear/sync-issues.d.ts +0 -12
  598. package/dist/types/src/functions/linear/sync-issues.d.ts.map +0 -1
  599. package/dist/types/src/functions/research/document-create.d.ts +0 -9
  600. package/dist/types/src/functions/research/document-create.d.ts.map +0 -1
  601. package/dist/types/src/functions/research/index.d.ts +0 -21
  602. package/dist/types/src/functions/research/index.d.ts.map +0 -1
  603. package/dist/types/src/functions/research/research-graph.d.ts +0 -18
  604. package/dist/types/src/functions/research/research-graph.d.ts.map +0 -1
  605. package/dist/types/src/functions/research/research.d.ts +0 -14
  606. package/dist/types/src/functions/research/research.d.ts.map +0 -1
  607. package/dist/types/src/functions/research/research.test.d.ts.map +0 -1
  608. package/dist/types/src/functions/research/types.d.ts +0 -6
  609. package/dist/types/src/functions/research/types.d.ts.map +0 -1
  610. package/dist/types/src/functions/tasks/index.d.ts +0 -15
  611. package/dist/types/src/functions/tasks/index.d.ts.map +0 -1
  612. package/dist/types/src/functions/tasks/read.d.ts +0 -7
  613. package/dist/types/src/functions/tasks/read.d.ts.map +0 -1
  614. package/dist/types/src/functions/tasks/task-list.d.ts.map +0 -1
  615. package/dist/types/src/functions/tasks/task-list.test.d.ts.map +0 -1
  616. package/dist/types/src/functions/tasks/update.d.ts +0 -9
  617. package/dist/types/src/functions/tasks/update.d.ts.map +0 -1
  618. package/dist/types/src/plugins.d.ts +0 -19
  619. package/dist/types/src/plugins.d.ts.map +0 -1
  620. package/dist/types/src/testing/data/exa-search-1748337321991.d.ts.map +0 -1
  621. package/dist/types/src/testing/data/exa-search-1748337331526.d.ts.map +0 -1
  622. package/dist/types/src/testing/data/exa-search-1748337344119.d.ts.map +0 -1
  623. package/dist/types/src/testing/data/index.d.ts.map +0 -1
  624. package/dist/types/src/toolkits/AssistantToolkit.d.ts +0 -17
  625. package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +0 -1
  626. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts +0 -2
  627. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts.map +0 -1
  628. package/dist/types/src/toolkits/SystemToolkit.d.ts +0 -67
  629. package/dist/types/src/toolkits/SystemToolkit.d.ts.map +0 -1
  630. package/src/blueprints/discord/discord-blueprint.ts +0 -34
  631. package/src/blueprints/linear/linear-blueprint.ts +0 -35
  632. package/src/blueprints/websearch/websearch-blueprint.ts +0 -20
  633. package/src/experimental/feed.test.ts +0 -111
  634. package/src/functions/discord/fetch-messages.ts +0 -252
  635. package/src/functions/discord/index.ts +0 -9
  636. package/src/functions/document/index.ts +0 -12
  637. package/src/functions/document/read.ts +0 -29
  638. package/src/functions/document/update.ts +0 -30
  639. package/src/functions/github/fetch-prs.ts +0 -30
  640. package/src/functions/linear/index.ts +0 -9
  641. package/src/functions/linear/linear.test.ts +0 -83
  642. package/src/functions/research/document-create.ts +0 -75
  643. package/src/functions/research/index.ts +0 -14
  644. package/src/functions/research/research-graph.ts +0 -49
  645. package/src/functions/research/research.conversations.json +0 -1
  646. package/src/functions/research/research.test.ts +0 -179
  647. package/src/functions/research/research.ts +0 -190
  648. package/src/functions/tasks/index.ts +0 -11
  649. package/src/functions/tasks/read.ts +0 -34
  650. package/src/functions/tasks/update.ts +0 -52
  651. package/src/plugins.tsx +0 -68
  652. package/src/toolkits/AssistantToolkit.conversations.json +0 -1
  653. package/src/toolkits/AssistantToolkit.test.ts +0 -88
  654. package/src/toolkits/AssistantToolkit.ts +0 -47
  655. package/src/toolkits/SystemToolkit.ts +0 -231
  656. /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.d.ts +0 -0
  657. /package/dist/types/src/{functions/linear → blueprints/linear/functions}/linear.test.d.ts +0 -0
  658. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.d.ts +0 -0
  659. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.d.ts +0 -0
  660. /package/dist/types/src/{functions/research → blueprints/research/functions}/research.test.d.ts +0 -0
  661. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337321991.d.ts +0 -0
  662. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337331526.d.ts +0 -0
  663. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337344119.d.ts +0 -0
  664. /package/dist/types/src/{testing → functions/exa}/data/index.d.ts +0 -0
  665. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.ts +0 -0
  666. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.ts +0 -0
  667. /package/src/blueprints/research/{research-blueprint.test.ts → blueprint.test.ts} +0 -0
  668. /package/src/{testing → functions/exa}/data/exa-search-1748337321991.ts +0 -0
  669. /package/src/{testing → functions/exa}/data/exa-search-1748337331526.ts +0 -0
  670. /package/src/{testing → functions/exa}/data/exa-search-1748337344119.ts +0 -0
  671. /package/src/{testing → functions/exa}/data/index.ts +0 -0
@@ -1,808 +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 { Entity, Filter, Obj as Obj3, Query, Type as Type2 } from "@dxos/echo";
396
- import { ReferenceAnnotationId, RelationSourceDXNId, RelationSourceId, RelationTargetDXNId, RelationTargetId, createObject, getTypeAnnotation, getTypeIdentifierAnnotation } from "@dxos/echo/internal";
397
- import { isEncodedReference } from "@dxos/echo-protocol";
398
- import { mapAst } from "@dxos/effect";
399
- import { ContextQueueService, DatabaseService as DatabaseService4 } from "@dxos/functions";
400
- import { DXN, ObjectId } from "@dxos/keys";
401
- import { log as log3 } from "@dxos/log";
402
- import { deepMapValues, isNonNullable, trim } from "@dxos/util";
403
- var __dxlog_file3 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/crud/graph.ts";
404
- var Subgraph = Schema5.Struct({
405
- /** Objects and relations. */
406
- objects: Schema5.Array(Schema5.Any)
407
- });
408
- var findRelatedSchema = async (db, anchor) => {
409
- const allSchemas = [
410
- ...db.graph.schemaRegistry.schemas
411
- ];
412
- return allSchemas.filter((schema) => {
413
- if (getTypeAnnotation(schema)?.kind !== Entity.Kind.Relation) {
414
- return false;
415
- }
416
- return isSchemaAddressableByDxn(anchor, DXN.parse(getTypeAnnotation(schema).sourceSchema)) || isSchemaAddressableByDxn(anchor, DXN.parse(getTypeAnnotation(schema).targetSchema));
417
- }).map((schema) => ({
418
- schema,
419
- kind: "relation"
420
- }));
421
- };
422
- var isSchemaAddressableByDxn = (schema, dxn) => {
423
- if (getTypeIdentifierAnnotation(schema) === dxn.toString()) {
424
- return true;
425
- }
426
- const t = dxn.asTypeDXN();
427
- if (t) {
428
- return t.type === Type2.getTypename(schema);
429
- }
430
- return false;
431
- };
432
- var LocalSearchToolkit = Toolkit.make(Tool.make("search_local_search", {
433
- description: "Search the local database for information using a vector index",
434
- parameters: {
435
- query: Schema5.String.annotations({
436
- description: "The query to search for. Could be a question or a topic or a set of keywords."
437
- })
438
- },
439
- success: Schema5.Unknown,
440
- failure: Schema5.Never,
441
- dependencies: [
442
- DatabaseService4
443
- ]
444
- }));
445
- var LocalSearchHandler = LocalSearchToolkit.toLayer({
446
- search_local_search: Effect5.fn(function* ({ query }) {
447
- const { objects } = yield* DatabaseService4.runQuery(Query.select(Filter.text(query, {
448
- type: "vector"
449
- })));
450
- const results = [
451
- ...objects
452
- ];
453
- const option = yield* Effect5.serviceOption(ContextQueueService);
454
- if (Option3.isSome(option)) {
455
- const queueObjects = yield* Effect5.promise(() => option.value.queue.queryObjects());
456
- results.push(...queueObjects);
457
- }
458
- return trim`
459
- <local_context>
460
- ${JSON.stringify(results, null, 2)}
461
- </local_context>
462
- `;
463
- })
464
- });
465
- var GraphWriterSchema = class extends Context.Tag("@dxos/assistant/GraphWriterSchema")() {
466
- };
467
- var makeGraphWriterToolkit = ({ schema }) => {
468
- return Toolkit.make(Tool.make("graph_writer", {
469
- description: "Write to the local graph database",
470
- parameters: createExtractionSchema(schema).fields,
471
- success: Schema5.Unknown,
472
- failure: Schema5.Never,
473
- dependencies: [
474
- DatabaseService4,
475
- ContextQueueService
476
- ]
477
- }).annotateContext(Context.make(GraphWriterSchema, {
478
- schema
479
- })));
480
- };
481
- var makeGraphWriterHandler = (toolkit, { onAppend } = {}) => {
482
- const { schema } = Context.get(toolkit.tools.graph_writer.annotations, GraphWriterSchema);
483
- return toolkit.toLayer({
484
- graph_writer: Effect5.fn(function* (input) {
485
- const { db } = yield* DatabaseService4;
486
- const { queue } = yield* ContextQueueService;
487
- const data = yield* Effect5.promise(() => sanitizeObjects(schema, input, db, queue));
488
- yield* Effect5.promise(() => queue.append(data));
489
- const dxns = data.map((obj) => Obj3.getDXN(obj));
490
- onAppend?.(dxns);
491
- return dxns;
492
- })
493
- });
494
- };
495
- var createExtractionSchema = (types) => {
496
- return Schema5.Struct({
497
- ...Object.fromEntries(types.map(preprocessSchema).map((schema, index) => [
498
- `objects_${getSanitizedSchemaName(types[index])}`,
499
- Schema5.optional(Schema5.Array(schema)).annotations({
500
- description: `The objects of type: ${Type2.getDXN(types[index])?.asTypeDXN().type}. ${SchemaAST.getDescriptionAnnotation(types[index].ast).pipe(Option3.getOrElse(() => ""))}`
501
- })
502
- ]))
503
- });
504
- };
505
- var getSanitizedSchemaName = (schema) => {
506
- return Type2.getDXN(schema).asTypeDXN().type.replaceAll(/[^a-zA-Z0-9]+/g, "_");
507
- };
508
- var sanitizeObjects = async (types, data, db, queue) => {
509
- const entries = types.map((type) => data[`objects_${getSanitizedSchemaName(type)}`]?.map((object) => ({
510
- data: object,
511
- schema: type
512
- })) ?? []).flat();
513
- const idMap = /* @__PURE__ */ new Map();
514
- const existingIds = /* @__PURE__ */ new Set();
515
- const enitties = /* @__PURE__ */ new Map();
516
- const resolveId = (id) => {
517
- if (ObjectId.isValid(id)) {
518
- existingIds.add(id);
519
- return DXN.fromLocalObjectId(id);
520
- }
521
- const mappedId = idMap.get(id);
522
- if (mappedId) {
523
- return DXN.fromLocalObjectId(mappedId);
524
- }
525
- return void 0;
526
- };
527
- const res = entries.map((entry) => {
528
- if (ObjectId.isValid(entry.data.id)) {
529
- return entry;
530
- }
531
- idMap.set(entry.data.id, ObjectId.random());
532
- entry.data.id = idMap.get(entry.data.id);
533
- return entry;
534
- }).map((entry) => {
535
- const data2 = deepMapValues(entry.data, (value2, recurse) => {
536
- if (isEncodedReference(value2)) {
537
- const ref = value2["/"];
538
- const id = resolveId(ref);
539
- if (id) {
540
- return {
541
- "/": id.toString()
542
- };
543
- } else {
544
- return {
545
- "/": `search:?q=${encodeURIComponent(ref)}`
546
- };
547
- }
548
- }
549
- return recurse(value2);
550
- });
551
- if (Entity.getKind(entry.schema) === "relation") {
552
- const sourceDxn = resolveId(data2.source);
553
- if (!sourceDxn) {
554
- log3.warn("source not found", {
555
- source: data2.source
556
- }, {
557
- F: __dxlog_file3,
558
- L: 275,
559
- S: void 0,
560
- C: (f, a) => f(...a)
561
- });
562
- }
563
- const targetDxn = resolveId(data2.target);
564
- if (!targetDxn) {
565
- log3.warn("target not found", {
566
- target: data2.target
567
- }, {
568
- F: __dxlog_file3,
569
- L: 279,
570
- S: void 0,
571
- C: (f, a) => f(...a)
572
- });
573
- }
574
- delete data2.source;
575
- delete data2.target;
576
- data2[RelationSourceDXNId] = sourceDxn;
577
- data2[RelationTargetDXNId] = targetDxn;
578
- }
579
- return {
580
- data: data2,
581
- schema: entry.schema
582
- };
583
- }).filter((object) => !existingIds.has(object.data.id));
584
- const { objects: dbObjects } = await db.query(Query.select(Filter.ids(...existingIds))).run();
585
- const queueObjects = await queue?.getObjectsById([
586
- ...existingIds
587
- ]) ?? [];
588
- const objects = [
589
- ...dbObjects,
590
- ...queueObjects
591
- ].filter(isNonNullable);
592
- log3.info("objects", {
593
- dbObjects,
594
- queueObjects,
595
- existingIds
596
- }, {
597
- F: __dxlog_file3,
598
- L: 300,
599
- S: void 0,
600
- C: (f, a) => f(...a)
601
- });
602
- const missing = Array.from(existingIds).filter((id) => !objects.some((object) => object.id === id));
603
- if (missing.length > 0) {
604
- throw new Error(`Object IDs do not point to existing objects: ${missing.join(", ")}`);
605
- }
606
- return res.flatMap(({ data: data2, schema }) => {
607
- let skip = false;
608
- if (RelationSourceDXNId in data2) {
609
- const id = data2[RelationSourceDXNId].asEchoDXN()?.echoId;
610
- const obj = objects.find((object) => object.id === id) ?? enitties.get(id);
611
- if (obj) {
612
- delete data2[RelationSourceDXNId];
613
- data2[RelationSourceId] = obj;
614
- } else {
615
- skip = true;
616
- }
617
- }
618
- if (RelationTargetDXNId in data2) {
619
- const id = data2[RelationTargetDXNId].asEchoDXN()?.echoId;
620
- const obj = objects.find((object) => object.id === id) ?? enitties.get(id);
621
- if (obj) {
622
- delete data2[RelationTargetDXNId];
623
- data2[RelationTargetId] = obj;
624
- } else {
625
- skip = true;
626
- }
627
- }
628
- if (!skip) {
629
- const obj = createObject(schema, data2);
630
- enitties.set(obj.id, obj);
631
- return [
632
- obj
633
- ];
634
- }
635
- return [];
636
- });
637
- };
638
- var SoftRef = Schema5.Struct({
639
- "/": Schema5.String
640
- }).annotations({
641
- description: "Reference to another object."
642
- });
643
- var preprocessSchema = (schema) => {
644
- const isRelationSchema = Entity.getKind(schema) === "relation";
645
- const go = (ast, visited = /* @__PURE__ */ new Set()) => {
646
- if (visited.has(ast)) {
647
- return ast;
648
- }
649
- visited.add(ast);
650
- if (SchemaAST.getAnnotation(ast, ReferenceAnnotationId).pipe(Option3.isSome)) {
651
- return SoftRef.ast;
652
- }
653
- return mapAst(ast, (child) => go(child, visited));
654
- };
655
- return Schema5.make(mapAst(schema.ast, (ast) => go(ast))).pipe(Schema5.omit("id"), Schema5.extend(Schema5.Struct({
656
- id: Schema5.String.annotations({
657
- description: "The id of this object. Come up with a unique id based on your judgement."
658
- })
659
- })), isRelationSchema ? Schema5.extend(Schema5.Struct({
660
- source: Schema5.String.annotations({
661
- description: "The id of the source object for this relation."
662
- }),
663
- target: Schema5.String.annotations({
664
- description: "The id of the target object for this relation."
665
- })
666
- })) : Function3.identity);
667
- };
668
-
669
- // src/functions/research/document-create.ts
670
- import * as Effect6 from "effect/Effect";
671
- import * as Schema6 from "effect/Schema";
672
- import { ArtifactId as ArtifactId3 } from "@dxos/assistant";
673
- import { Obj as Obj4, Relation } from "@dxos/echo";
674
- import { DatabaseService as DatabaseService5, TracingService as TracingService3, defineFunction as defineFunction5 } from "@dxos/functions";
675
- import { log as log4 } from "@dxos/log";
676
- import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
677
- import { HasSubject } from "@dxos/types";
678
- import { trim as trim2 } from "@dxos/util";
679
- var __dxlog_file4 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/research/document-create.ts";
680
- var document_create_default = defineFunction5({
681
- key: "dxos.org/function/research/document-create",
682
- name: "Create research document",
683
- description: "Creates a note summarizing the research.",
684
- inputSchema: Schema6.Struct({
685
- subject: ArtifactId3.annotations({
686
- description: trim2`
687
- ID of the object (organization, contact, etc.) for which the research was performed.
688
- `
689
- }),
690
- name: Schema6.String.annotations({
691
- description: "Name of the document."
692
- }),
693
- content: Schema6.String.annotations({
694
- description: trim2`
695
- Content of the note.
696
- Supports (and are prefered) references to research objects using @ syntax and <object> tags (refer to research blueprint instructions).
697
- `
698
- })
699
- }),
700
- outputSchema: Schema6.Struct({
701
- document: ArtifactId3.annotations({
702
- description: "DXN of the created document."
703
- })
704
- }),
705
- handler: Effect6.fnUntraced(function* ({ data: { subject, name, content } }) {
706
- log4.info("Creating research document", {
707
- subject,
708
- name,
709
- content
710
- }, {
711
- F: __dxlog_file4,
712
- L: 42,
713
- S: this,
714
- C: (f, a) => f(...a)
715
- });
716
- yield* DatabaseService5.flush({
717
- indexes: true
718
- });
719
- yield* TracingService3.emitStatus({
720
- message: "Creating research document..."
721
- });
722
- const target = yield* DatabaseService5.resolve(ArtifactId3.toDXN(subject));
723
- const object = yield* DatabaseService5.add(Markdown3.make({
724
- name,
725
- content
726
- }));
727
- yield* DatabaseService5.add(Relation.make(HasSubject.HasSubject, {
728
- [Relation.Source]: object,
729
- [Relation.Target]: target,
730
- completedAt: (/* @__PURE__ */ new Date()).toISOString()
731
- }));
732
- yield* DatabaseService5.flush({
733
- indexes: true
734
- });
735
- log4.info("Created research document", {
736
- subject,
737
- object
738
- }, {
739
- F: __dxlog_file4,
740
- L: 69,
741
- S: this,
742
- C: (f, a) => f(...a)
743
- });
744
- return {
745
- document: Obj4.getDXN(object).toString()
746
- };
747
- })
748
- });
749
-
750
- // src/functions/research/research.ts
751
- import * as Toolkit2 from "@effect/ai/Toolkit";
752
- import * as AnthropicTool from "@effect/ai-anthropic/AnthropicTool";
753
- import * as Array6 from "effect/Array";
754
- import * as Effect10 from "effect/Effect";
755
- import * as Function4 from "effect/Function";
756
- import * as Layer3 from "effect/Layer";
757
- import * as Option4 from "effect/Option";
758
- import * as Schema10 from "effect/Schema";
759
- import * as String10 from "effect/String";
760
- import { AiService as AiService2, ConsolePrinter as ConsolePrinter2 } from "@dxos/ai";
761
- import { AiSession as AiSession2, GenerationObserver as GenerationObserver2, createToolkit as createToolkit2, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from "@dxos/assistant";
762
- import { Template as Template2 } from "@dxos/blueprints";
763
- import { Obj as Obj6 } from "@dxos/echo";
764
- import { DatabaseService as DatabaseService7, TracingService as TracingService4, defineFunction as defineFunction8 } from "@dxos/functions";
765
- import { FunctionInvocationServiceLayerTestMocked } from "@dxos/functions-runtime/testing";
766
- import { Person } from "@dxos/types";
767
- import { trim as trim3 } from "@dxos/util";
768
-
769
- // src/functions/exa/exa.ts
770
- import * as Effect7 from "effect/Effect";
771
- import * as Schema7 from "effect/Schema";
772
- import Exa from "exa-js";
773
- import { CredentialsService as CredentialsService2, defineFunction as defineFunction6 } from "@dxos/functions";
774
- var exa_default = defineFunction6({
775
- key: "dxos.org/function/exa",
776
- name: "Exa",
777
- description: "Search the web for information",
778
- inputSchema: Schema7.Struct({
779
- query: Schema7.String.annotations({
780
- description: "The query to search for."
781
- })
782
- }),
783
- outputSchema: Schema7.Unknown,
784
- handler: Effect7.fnUntraced(function* ({ data: { query } }) {
785
- const credential = yield* CredentialsService2.getCredential({
786
- service: "exa.ai"
787
- });
788
- const exa = new Exa(credential.apiKey);
789
- const context = yield* Effect7.promise(async () => exa.searchAndContents(query, {
790
- type: "auto",
791
- text: {
792
- maxCharacters: 3e3
793
- },
794
- livecrawl: "always"
795
- }));
796
- return context;
797
- })
798
- });
1
+ import {
2
+ ExaMock
3
+ } from "./chunk-VDEDVOS6.mjs";
4
+ import "./chunk-J5LGTIGS.mjs";
799
5
 
800
6
  // src/functions/exa/mock.ts
801
- import * as Effect8 from "effect/Effect";
802
- import * as Schema8 from "effect/Schema";
803
- import { defineFunction as defineFunction7 } from "@dxos/functions";
7
+ import * as Effect from "effect/Effect";
8
+ import { Operation } from "@dxos/operation";
804
9
 
805
- // src/testing/data/exa-search-1748337321991.ts
10
+ // src/functions/exa/data/exa-search-1748337321991.ts
806
11
  var exa_search_1748337321991_default = {
807
12
  requestId: "324936368a74f4db978982172bc18a6c",
808
13
  autopromptString: "AI personal knowledge management tools projects 2024",
@@ -958,7 +163,7 @@ var exa_search_1748337321991_default = {
958
163
  }
959
164
  };
960
165
 
961
- // src/testing/data/exa-search-1748337331526.ts
166
+ // src/functions/exa/data/exa-search-1748337331526.ts
962
167
  var exa_search_1748337331526_default = {
963
168
  requestId: "0dc12e344fa649884456960ca1a54954",
964
169
  autopromptString: "PKM software artificial intelligence integration open source projects",
@@ -1181,7 +386,7 @@ npm run tauri dev
1181
386
  }
1182
387
  };
1183
388
 
1184
- // src/testing/data/exa-search-1748337344119.ts
389
+ // src/functions/exa/data/exa-search-1748337344119.ts
1185
390
  var exa_search_1748337344119_default = {
1186
391
  requestId: "32df0c541f9883180b35e04caece4374",
1187
392
  autopromptString: "open source AI knowledge management projects features comparison 2024",
@@ -1304,7 +509,7 @@ var exa_search_1748337344119_default = {
1304
509
  }
1305
510
  };
1306
511
 
1307
- // src/testing/data/index.ts
512
+ // src/functions/exa/data/index.ts
1308
513
  var SEARCH_RESULTS = [
1309
514
  exa_search_1748337321991_default,
1310
515
  exa_search_1748337331526_default,
@@ -1312,33 +517,22 @@ var SEARCH_RESULTS = [
1312
517
  ];
1313
518
 
1314
519
  // src/functions/exa/mock.ts
1315
- var mock_default = defineFunction7({
1316
- key: "dxos.org/function/exa-mock",
1317
- name: "Exa mock",
1318
- description: "Search the web for information",
1319
- inputSchema: Schema8.Struct({
1320
- query: Schema8.String.annotations({
1321
- description: "The query to search for."
1322
- })
1323
- }),
1324
- outputSchema: Schema8.Unknown,
1325
- handler: Effect8.fnUntraced(function* ({ data: { query } }) {
1326
- const result = SEARCH_RESULTS.reduce((closest, current) => {
1327
- if (!current.autopromptString) {
1328
- return closest;
1329
- }
1330
- if (!closest) {
1331
- return current;
1332
- }
1333
- const dist1 = levenshteinDistance(query, current.autopromptString);
1334
- const dist2 = levenshteinDistance(query, closest.autopromptString || "");
1335
- const weight1 = dist1 / Math.max(query.length, current.autopromptString.length);
1336
- const weight2 = dist2 / Math.max(query.length, closest.autopromptString?.length || 0);
1337
- return weight1 < weight2 ? current : closest;
1338
- }, null);
1339
- return result;
1340
- })
1341
- });
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
+ })));
1342
536
  var levenshteinDistance = (str1, str2) => {
1343
537
  const m = str1.length;
1344
538
  const n = str2.length;
@@ -1356,1423 +550,7 @@ var levenshteinDistance = (str1, str2) => {
1356
550
  }
1357
551
  return dp[m][n];
1358
552
  };
1359
-
1360
- // src/functions/research/research-graph.ts
1361
- import * as Effect9 from "effect/Effect";
1362
- import * as Layer2 from "effect/Layer";
1363
- import * as Schema9 from "effect/Schema";
1364
- import { Obj as Obj5, Query as Query2, Ref as Ref2, Type as Type3 } from "@dxos/echo";
1365
- import { SystemTypeAnnotation } from "@dxos/echo/internal";
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: Type3.Ref(Queue)
1370
- }).pipe(Type3.Obj({
1371
- typename: "dxos.org/type/ResearchGraph",
1372
- version: "0.1.0"
1373
- }), SystemTypeAnnotation.set(true));
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: message, instructions: instructions6 } }) {
1568
- const tags = Obj7.getMeta(message)?.tags;
1569
- const contact = yield* extractContact(message.sender, tags);
1570
- let organization = null;
1571
- if (contact && !contact.organization) {
1572
- const created = [];
1573
- const GraphWriterToolkit = makeGraphWriterToolkit({
1574
- schema: [
1575
- LegacyOrganization2
1576
- ]
1577
- }).pipe();
1578
- const GraphWriterHandler = makeGraphWriterHandler(GraphWriterToolkit, {
1579
- onAppend: (dxns) => created.push(...dxns)
1580
- });
1581
- const toolkit = yield* GraphWriterToolkit.pipe(Effect11.provide(GraphWriterHandler.pipe(Layer4.provide(contextQueueLayerFromResearchGraph))));
1582
- yield* new AiSession3().run({
1583
- system: trim4`
1584
- Extract the sender's organization from the email. If you are not sure, do nothing.
1585
- The extracted organization URL must match the sender's email domain.
1586
- ${instructions6 ? "<user_intructions>" + instructions6 + "</user_intructions>" : ""},
1587
- `,
1588
- prompt: JSON.stringify({
1589
- source: message,
1590
- contact
1591
- }),
1592
- toolkit
1593
- });
1594
- if (created.length > 1) {
1595
- throw new Error("Multiple organizations created");
1596
- } else if (created.length === 1) {
1597
- organization = yield* DatabaseService8.resolve(created[0], Organization.Organization);
1598
- Obj7.getMeta(organization).tags ??= [];
1599
- Obj7.getMeta(organization).tags.push(...tags ?? []);
1600
- contact.organization = Ref3.make(organization);
1601
- }
1602
- }
1603
- return {
1604
- entities: [
1605
- contact,
1606
- organization
1607
- ].filter(Predicate.isNotNullable)
1608
- };
1609
- }, Effect11.provide(Layer4.mergeAll(AiService3.model("@anthropic/claude-sonnet-4-0"), makeToolResolverFromFunctions2([], Toolkit3.make()), makeToolExecutionServiceFromFunctions2(Toolkit3.make(), Layer4.empty)).pipe(Layer4.provide(
1610
- // TODO(dmaretskyi): This should be provided by environment.
1611
- Layer4.mergeAll(FunctionInvocationServiceLayerTest())
1612
- ))))
1613
- });
1614
- var extractContact = Effect11.fn("extractContact")(function* (actor, tags) {
1615
- const name = actor.name;
1616
- const email = actor.email;
1617
- if (!email) {
1618
- log5.warn("email is required for contact extraction", {
1619
- actor
1620
- }, {
1621
- F: __dxlog_file5,
1622
- L: 100,
1623
- S: this,
1624
- C: (f, a) => f(...a)
1625
- });
1626
- return void 0;
1627
- }
1628
- const { objects: existingContacts } = yield* DatabaseService8.runQuery(Filter2.type(Person2.Person));
1629
- const existingContact = existingContacts.find((contact) => contact.emails?.some((contactEmail) => contactEmail.value === email));
1630
- if (existingContact) {
1631
- log5.info("Contact already exists", {
1632
- email,
1633
- existingContact
1634
- }, {
1635
- F: __dxlog_file5,
1636
- L: 113,
1637
- S: this,
1638
- C: (f, a) => f(...a)
1639
- });
1640
- return existingContact;
1641
- }
1642
- const newContact = Obj7.make(Person2.Person, {
1643
- [Obj7.Meta]: {
1644
- tags
1645
- },
1646
- emails: [
1647
- {
1648
- value: email
1649
- }
1650
- ]
1651
- });
1652
- yield* DatabaseService8.add(newContact);
1653
- if (name) {
1654
- newContact.fullName = name;
1655
- }
1656
- const emailDomain = email.split("@")[1]?.toLowerCase();
1657
- if (!emailDomain) {
1658
- log5.warn("Invalid email format, cannot extract domain", {
1659
- email
1660
- }, {
1661
- F: __dxlog_file5,
1662
- L: 129,
1663
- S: this,
1664
- C: (f, a) => f(...a)
1665
- });
1666
- return newContact;
1667
- }
1668
- log5.info("extracted email domain", {
1669
- emailDomain
1670
- }, {
1671
- F: __dxlog_file5,
1672
- L: 133,
1673
- S: this,
1674
- C: (f, a) => f(...a)
1675
- });
1676
- const { objects: existingOrganisations } = yield* DatabaseService8.runQuery(Filter2.type(Organization.Organization));
1677
- const matchingOrg = existingOrganisations.find((org) => {
1678
- if (org.website) {
1679
- try {
1680
- const websiteUrl = org.website.startsWith("http://") || org.website.startsWith("https://") ? org.website : `https://${org.website}`;
1681
- const websiteDomain = new URL(websiteUrl).hostname.toLowerCase();
1682
- return websiteDomain === emailDomain || websiteDomain.endsWith(`.${emailDomain}`) || emailDomain.endsWith(`.${websiteDomain}`);
1683
- } catch (e) {
1684
- log5.warn("Error parsing website URL", {
1685
- website: org.website,
1686
- error: e
1687
- }, {
1688
- F: __dxlog_file5,
1689
- L: 151,
1690
- S: this,
1691
- C: (f, a) => f(...a)
1692
- });
1693
- return false;
1694
- }
1695
- }
1696
- return false;
1697
- });
1698
- if (matchingOrg) {
1699
- log5.info("found matching organization", {
1700
- organization: matchingOrg
1701
- }, {
1702
- F: __dxlog_file5,
1703
- L: 159,
1704
- S: this,
1705
- C: (f, a) => f(...a)
1706
- });
1707
- newContact.organization = Ref3.make(matchingOrg);
1708
- }
1709
- return newContact;
1710
- });
1711
-
1712
- // src/functions/entity-extraction/index.ts
1713
- (function(EntityExtraction2) {
1714
- EntityExtraction2.extract = entity_extraction_default;
1715
- })(EntityExtraction || (EntityExtraction = {}));
1716
- var EntityExtraction;
1717
-
1718
- // src/functions/linear/sync-issues.ts
1719
- import * as FetchHttpClient2 from "@effect/platform/FetchHttpClient";
1720
- import * as HttpClient from "@effect/platform/HttpClient";
1721
- import * as Array9 from "effect/Array";
1722
- import * as Effect13 from "effect/Effect";
1723
- import * as Function5 from "effect/Function";
1724
- import * as Schema12 from "effect/Schema";
1725
- import { Filter as Filter4, Obj as Obj9, Query as Query4, Ref as Ref5 } from "@dxos/echo";
1726
- import { DatabaseService as DatabaseService10, defineFunction as defineFunction10, withAuthorization } from "@dxos/functions";
1727
- import { log as log7 } from "@dxos/log";
1728
- import { Person as Person3, Project as Project2, Task as Task2 } from "@dxos/types";
1729
-
1730
- // src/sync/sync.ts
1731
- import * as Effect12 from "effect/Effect";
1732
- import { Filter as Filter3, Obj as Obj8, Query as Query3, Ref as Ref4 } from "@dxos/echo";
1733
- import { DatabaseService as DatabaseService9 } from "@dxos/functions";
1734
- import { failedInvariant } from "@dxos/invariant";
1735
- import { log as log6 } from "@dxos/log";
1736
- var __dxlog_file6 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/sync/sync.ts";
1737
- var syncObjects = Effect12.fn("syncObjects")(function* (objs, { foreignKeyId }) {
1738
- return yield* Effect12.forEach(objs, Effect12.fnUntraced(function* (obj) {
1739
- for (const key of Object.keys(obj)) {
1740
- if (typeof key !== "string" || key === "id") continue;
1741
- if (!Ref4.isRef(obj[key])) continue;
1742
- const ref = obj[key];
1743
- if (!ref.target) continue;
1744
- if (Obj8.getDXN(ref.target).isLocalObjectId()) {
1745
- const [target] = yield* syncObjects([
1746
- ref.target
1747
- ], {
1748
- foreignKeyId
1749
- });
1750
- obj[key] = Ref4.make(target);
1751
- }
1752
- }
1753
- const schema = Obj8.getSchema(obj) ?? failedInvariant("No schema.");
1754
- const foreignId = Obj8.getKeys(obj, foreignKeyId)[0]?.id ?? failedInvariant("No foreign key.");
1755
- const { objects: [existing] } = yield* DatabaseService9.runQuery(Query3.select(Filter3.foreignKeys(schema, [
1756
- {
1757
- source: foreignKeyId,
1758
- id: foreignId
1759
- }
1760
- ])));
1761
- log6("sync object", {
1762
- type: Obj8.getTypename(obj),
1763
- foreignId,
1764
- existing: existing ? Obj8.getDXN(existing) : void 0
1765
- }, {
1766
- F: __dxlog_file6,
1767
- L: 47,
1768
- S: this,
1769
- C: (f, a) => f(...a)
1770
- });
1771
- if (!existing) {
1772
- yield* DatabaseService9.add(obj);
1773
- return obj;
1774
- } else {
1775
- copyObjectData(existing, obj);
1776
- return existing;
1777
- }
1778
- }), {
1779
- concurrency: 1
1780
- });
1781
- });
1782
- var copyObjectData = (existing, newObj) => {
1783
- for (const key of Object.keys(newObj)) {
1784
- if (typeof key !== "string" || key === "id") continue;
1785
- if (typeof newObj[key] !== "string" && typeof newObj[key] !== "number" && typeof newObj[key] !== "boolean" && !Ref4.isRef(newObj[key])) continue;
1786
- existing[key] = newObj[key];
1787
- }
1788
- for (const key of Object.keys(existing)) {
1789
- if (typeof key !== "string" || key === "id") continue;
1790
- if (!(key in newObj)) {
1791
- delete existing[key];
1792
- }
1793
- }
1794
- for (const foreignKey of Obj8.getMeta(newObj).keys) {
1795
- Obj8.deleteKeys(existing, foreignKey.source);
1796
- Obj8.getMeta(existing).keys.push({
1797
- ...foreignKey
1798
- });
1799
- }
1800
- };
1801
-
1802
- // src/util/graphql.ts
1803
- import * as HttpBody from "@effect/platform/HttpBody";
1804
- var graphqlRequestBody = (query, variables = {}) => HttpBody.json({
1805
- query,
1806
- variables
1807
- });
1808
-
1809
- // src/functions/linear/sync-issues.ts
1810
- var __dxlog_file7 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/linear/sync-issues.ts";
1811
- var queryIssues = `
1812
- query Issues($teamId: String!, $after: DateTimeOrDuration!) {
1813
- team(id: $teamId) {
1814
- id
1815
- name
1816
-
1817
-
1818
- issues(last: 150, orderBy: updatedAt, filter: {
1819
- updatedAt: { gt: $after }
1820
- }) {
1821
- edges {
1822
- node {
1823
- id
1824
- title
1825
- createdAt
1826
- updatedAt
1827
- description
1828
- assignee { id, name }
1829
- state {
1830
- name
1831
- }
1832
- project {
1833
- id
1834
- name
1835
- }
1836
- }
1837
- cursor
1838
- }
1839
- pageInfo {
1840
- hasNextPage
1841
- endCursor
1842
- }
1843
- }
1844
- }
1845
- }
1846
- `;
1847
- var LINEAR_ID_KEY = "linear.app/id";
1848
- var LINEAR_TEAM_ID_KEY = "linear.app/teamId";
1849
- var LINEAR_UPDATED_AT_KEY = "linear.app/updatedAt";
1850
- var sync_issues_default = defineFunction10({
1851
- key: "dxos.org/function/linear/sync-issues",
1852
- name: "Linear",
1853
- description: "Sync issues from Linear.",
1854
- inputSchema: Schema12.Struct({
1855
- team: Schema12.String.annotations({
1856
- description: "Linear team id."
1857
- })
1858
- }),
1859
- handler: Effect13.fnUntraced(function* ({ data }) {
1860
- const client = yield* HttpClient.HttpClient.pipe(Effect13.map(withAuthorization({
1861
- service: "linear.app"
1862
- })));
1863
- const after = yield* getLatestUpdateTimestamp(data.team, Task2.Task);
1864
- log7.info("will fetch", {
1865
- after
1866
- }, {
1867
- F: __dxlog_file7,
1868
- L: 91,
1869
- S: this,
1870
- C: (f, a) => f(...a)
1871
- });
1872
- const response = yield* client.post("https://api.linear.app/graphql", {
1873
- body: yield* graphqlRequestBody(queryIssues, {
1874
- teamId: data.team,
1875
- after
1876
- })
1877
- });
1878
- const json2 = yield* response.json;
1879
- const tasks = json2.data.team.issues.edges.map((edge) => mapLinearIssue(edge.node, {
1880
- teamId: data.team
1881
- }));
1882
- log7.info("Fetched tasks", {
1883
- count: tasks.length
1884
- }, {
1885
- F: __dxlog_file7,
1886
- L: 104,
1887
- S: this,
1888
- C: (f, a) => f(...a)
1889
- });
1890
- return {
1891
- objects: yield* syncObjects(tasks, {
1892
- foreignKeyId: LINEAR_ID_KEY
1893
- }),
1894
- syncComplete: tasks.length < 150
1895
- };
1896
- }, Effect13.provide(FetchHttpClient2.layer))
1897
- });
1898
- var getLatestUpdateTimestamp = Effect13.fnUntraced(function* (teamId, dataType) {
1899
- const { objects: existingTasks } = yield* DatabaseService10.runQuery(Query4.type(dataType).select(Filter4.foreignKeys(dataType, [
1900
- {
1901
- source: LINEAR_TEAM_ID_KEY,
1902
- id: teamId
1903
- }
1904
- ])));
1905
- 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));
1906
- });
1907
- var mapLinearPerson = (person, { teamId }) => Obj9.make(Person3.Person, {
1908
- [Obj9.Meta]: {
1909
- keys: [
1910
- {
1911
- id: person.id,
1912
- source: LINEAR_ID_KEY
1913
- },
1914
- {
1915
- id: teamId,
1916
- source: LINEAR_TEAM_ID_KEY
1917
- }
1918
- ]
1919
- },
1920
- nickname: person.name
1921
- });
1922
- var mapLinearIssue = (issue, { teamId }) => Obj9.make(Task2.Task, {
1923
- [Obj9.Meta]: {
1924
- keys: [
1925
- {
1926
- id: issue.id,
1927
- source: LINEAR_ID_KEY
1928
- },
1929
- {
1930
- id: issue.updatedAt,
1931
- source: LINEAR_UPDATED_AT_KEY
1932
- },
1933
- {
1934
- id: teamId,
1935
- source: LINEAR_TEAM_ID_KEY
1936
- }
1937
- ]
1938
- },
1939
- title: issue.title ?? void 0,
1940
- description: issue.description ?? void 0,
1941
- assigned: !issue.assignee ? void 0 : Ref5.make(mapLinearPerson(issue.assignee, {
1942
- teamId
1943
- })),
1944
- // TODO(dmaretskyi): Sync those (+ linear team as org?).
1945
- // state: issue.state.name,
1946
- project: !issue.project ? void 0 : Ref5.make(Project2.make({
1947
- [Obj9.Meta]: {
1948
- keys: [
1949
- {
1950
- id: issue.project.id,
1951
- source: LINEAR_ID_KEY
1952
- },
1953
- {
1954
- id: teamId,
1955
- source: LINEAR_TEAM_ID_KEY
1956
- }
1957
- ]
1958
- },
1959
- name: issue.project.name
1960
- }))
1961
- });
1962
-
1963
- // src/functions/linear/index.ts
1964
- (function(Linear2) {
1965
- Linear2.sync = sync_issues_default;
1966
- })(Linear || (Linear = {}));
1967
- var Linear;
1968
-
1969
- // src/functions/tasks/read.ts
1970
- import * as Effect14 from "effect/Effect";
1971
- import * as Schema13 from "effect/Schema";
1972
- import { ArtifactId as ArtifactId4 } from "@dxos/assistant";
1973
- import { DatabaseService as DatabaseService11, defineFunction as defineFunction11 } from "@dxos/functions";
1974
- import { Markdown as Markdown4 } from "@dxos/plugin-markdown/types";
1975
- var read_default2 = defineFunction11({
1976
- key: "dxos.org/function/markdown/read-tasks",
1977
- name: "Read",
1978
- description: "Read markdown tasks.",
1979
- inputSchema: Schema13.Struct({
1980
- id: ArtifactId4.annotations({
1981
- description: "The ID of the document to read."
1982
- })
1983
- }),
1984
- outputSchema: Schema13.Struct({
1985
- content: Schema13.String
1986
- }),
1987
- handler: Effect14.fn(function* ({ data: { id } }) {
1988
- const doc = yield* DatabaseService11.resolve(ArtifactId4.toDXN(id), Markdown4.Document);
1989
- const { content } = yield* DatabaseService11.load(doc.content);
1990
- const lines = content.split("\n");
1991
- const len = String(lines.length).length;
1992
- const numbered = lines.map((line, i) => `${String(i + 1).padStart(len, " ")}. ${line}`).join("\n");
1993
- return {
1994
- content: numbered
1995
- };
1996
- })
1997
- });
1998
-
1999
- // src/functions/tasks/update.ts
2000
- import * as Effect15 from "effect/Effect";
2001
- import * as Schema14 from "effect/Schema";
2002
- import { ArtifactId as ArtifactId5 } from "@dxos/assistant";
2003
- import { DatabaseService as DatabaseService12, defineFunction as defineFunction12 } from "@dxos/functions";
2004
- import { Markdown as Markdown5 } from "@dxos/plugin-markdown/types";
2005
-
2006
- // src/functions/tasks/task-list.ts
2007
- var MarkdownTasks = class {
2008
- _lineEndings;
2009
- _content;
2010
- constructor(initialContent = "") {
2011
- this._lineEndings = initialContent.includes("\r\n") ? "\r\n" : "\n";
2012
- this._content = initialContent ? initialContent.split(this._lineEndings) : [];
2013
- }
2014
- /**
2015
- * Get the current document content with line numbers prefixed.
2016
- */
2017
- getNumberedContent() {
2018
- return this._content.map((line, index) => `${(index + 1).toString().padStart(3, " ")}\u2192${line}`).join(this._lineEndings);
2019
- }
2020
- /**
2021
- * Get the raw document content without line numbers.
2022
- */
2023
- getRawContent() {
2024
- return this._content.join(this._lineEndings);
2025
- }
2026
- /**
2027
- * Insert a new task at the specified line number (1-based).
2028
- * Indentation level determines hierarchy (0, 2, 4, 6 spaces etc.)
2029
- */
2030
- insertTask(lineNumber, taskText, completed = false, indent = 0) {
2031
- const indentStr = " ".repeat(indent);
2032
- const taskLine = completed ? `${indentStr}- [x] ${taskText}` : `${indentStr}- [ ] ${taskText}`;
2033
- const insertIndex = Math.max(0, Math.min(lineNumber - 1, this._content.length));
2034
- this._content.splice(insertIndex, 0, taskLine);
2035
- }
2036
- /**
2037
- * Delete a task at the specified line number (1-based).
2038
- */
2039
- deleteTask(lineNumber) {
2040
- if (lineNumber < 1 || lineNumber > this._content.length) {
2041
- return false;
2042
- }
2043
- this._content.splice(lineNumber - 1, 1);
2044
- return true;
2045
- }
2046
- /**
2047
- * Update the text of a task at the specified line number (1-based).
2048
- */
2049
- updateTaskText(lineNumber, newText) {
2050
- if (lineNumber < 1 || lineNumber > this._content.length) {
2051
- return false;
2052
- }
2053
- const currentLine = this._content[lineNumber - 1];
2054
- const taskMatch = currentLine.match(/^(\s*- \[[x ]\] )(.*)$/);
2055
- if (taskMatch) {
2056
- this._content[lineNumber - 1] = `${taskMatch[1]}${newText}`;
2057
- return true;
2058
- }
2059
- return false;
2060
- }
2061
- /**
2062
- * Mark a task as complete or incomplete at the specified line number (1-based).
2063
- */
2064
- toggleTaskCompletion(lineNumber, completed) {
2065
- if (lineNumber < 1 || lineNumber > this._content.length) {
2066
- return false;
2067
- }
2068
- const currentLine = this._content[lineNumber - 1];
2069
- const taskMatch = currentLine.match(/^(\s*- \[)([x ])(.*)$/);
2070
- if (taskMatch) {
2071
- const isCurrentlyComplete = taskMatch[2] === "x";
2072
- const newStatus = completed !== void 0 ? completed : !isCurrentlyComplete;
2073
- const statusChar = newStatus ? "x" : " ";
2074
- this._content[lineNumber - 1] = `${taskMatch[1]}${statusChar}${taskMatch[3]}`;
2075
- return true;
2076
- }
2077
- return false;
2078
- }
2079
- /**
2080
- * Change the indentation level of a task (for hierarchy).
2081
- */
2082
- setTaskIndent(lineNumber, indent) {
2083
- if (lineNumber < 1 || lineNumber > this._content.length) {
2084
- return false;
2085
- }
2086
- const currentLine = this._content[lineNumber - 1];
2087
- const taskMatch = currentLine.match(/^\s*- (\[[x ]\] .*)$/);
2088
- if (taskMatch) {
2089
- const indentStr = " ".repeat(indent);
2090
- this._content[lineNumber - 1] = `${indentStr}- ${taskMatch[1]}`;
2091
- return true;
2092
- }
2093
- return false;
2094
- }
2095
- /**
2096
- * Get the total number of lines in the document.
2097
- */
2098
- getLineCount() {
2099
- return this._content.length;
2100
- }
2101
- /**
2102
- * Apply multiple operations atomically.
2103
- */
2104
- applyOperations(operations) {
2105
- const sortedOps = [
2106
- ...operations
2107
- ].sort((a, b) => {
2108
- const aLine = "lineNumber" in a ? a.lineNumber : 0;
2109
- const bLine = "lineNumber" in b ? b.lineNumber : 0;
2110
- return bLine - aLine;
2111
- });
2112
- for (const op of sortedOps) {
2113
- switch (op.type) {
2114
- case "insertTask":
2115
- this.insertTask(op.lineNumber, op.text, op.completed, op.indent);
2116
- break;
2117
- case "deleteTask":
2118
- this.deleteTask(op.lineNumber);
2119
- break;
2120
- case "updateTaskText":
2121
- this.updateTaskText(op.lineNumber, op.text);
2122
- break;
2123
- case "toggleTaskCompletion":
2124
- this.toggleTaskCompletion(op.lineNumber, op.completed);
2125
- break;
2126
- case "setTaskIndent":
2127
- this.setTaskIndent(op.lineNumber, op.indent);
2128
- break;
2129
- }
2130
- }
2131
- }
2132
- };
2133
-
2134
- // src/functions/tasks/update.ts
2135
- var update_default2 = defineFunction12({
2136
- key: "dxos.org/function/markdown/update-tasks",
2137
- name: "Update markdown",
2138
- description: "Creates and updates tasks in markdown documents.",
2139
- inputSchema: Schema14.Struct({
2140
- id: ArtifactId5.annotations({
2141
- description: "The ID of the document to update."
2142
- }),
2143
- operations: Schema14.optional(Schema14.Array(Schema14.Any.annotations({
2144
- description: "Task operations to apply."
2145
- })))
2146
- }),
2147
- outputSchema: Schema14.Struct({
2148
- content: Schema14.String,
2149
- numberedContent: Schema14.String.annotations({
2150
- description: "Content with line numbers for agent reference."
2151
- })
2152
- }),
2153
- handler: Effect15.fn(function* ({ data: { id, operations = [] } }) {
2154
- const doc = yield* DatabaseService12.resolve(ArtifactId5.toDXN(id), Markdown5.Document);
2155
- const { content } = yield* DatabaseService12.load(doc.content);
2156
- const taskManager = new MarkdownTasks(content);
2157
- if (operations.length > 0) {
2158
- taskManager.applyOperations(operations);
2159
- }
2160
- return {
2161
- content: taskManager.getRawContent(),
2162
- numberedContent: taskManager.getNumberedContent()
2163
- };
2164
- })
2165
- });
2166
-
2167
- // src/functions/tasks/index.ts
2168
- (function(Tasks2) {
2169
- Tasks2.read = read_default2;
2170
- Tasks2.update = update_default2;
2171
- })(Tasks || (Tasks = {}));
2172
- var Tasks;
2173
-
2174
- // src/blueprints/design/design-blueprint.ts
2175
- var instructions = trim5`
2176
- You manage a design spec based on the conversation.
2177
- The design spec is a markdown document that is used to record the tasks.
2178
- The design spec document follows a hierarchical structure, with nested markdown bulleted sections.
2179
- Use the appropriate tools to read and write the design spec document.
2180
- Maintain the document so that it can convey all relevant points from the conversation.
2181
- When replying to the user, be terse with your comments about design doc handling.
2182
- Do not announce when you read or write the design spec document.
2183
- `;
2184
- var blueprint = Obj10.make(Blueprint.Blueprint, {
2185
- key: "dxos.org/blueprint/design",
2186
- name: "Design Spec",
2187
- description: "Preserve the conversation in the design spec.",
2188
- instructions: {
2189
- source: Ref6.make(Text2.make(instructions))
2190
- },
2191
- tools: [
2192
- Document.read,
2193
- Document.update
2194
- ].map((fn9) => ToolId.make(fn9.key))
2195
- });
2196
- var design_blueprint_default = blueprint;
2197
-
2198
- // src/blueprints/design/index.ts
2199
- var design_default = design_blueprint_default;
2200
-
2201
- // src/blueprints/discord/discord-blueprint.ts
2202
- import { ToolId as ToolId2 } from "@dxos/ai";
2203
- import { Blueprint as Blueprint2 } from "@dxos/blueprints";
2204
- import { Obj as Obj11, Ref as Ref7 } from "@dxos/echo";
2205
- import { Text as Text3 } from "@dxos/schema";
2206
- import { trim as trim6 } from "@dxos/util";
2207
- var instructions2 = trim6`
2208
- You are able to fetch messages from Discord servers.
2209
-
2210
- Known servers:
2211
-
2212
- DXOS serverId: 837138313172353095
2213
- `;
2214
- var blueprint2 = Obj11.make(Blueprint2.Blueprint, {
2215
- key: "dxos.org/blueprint/discord",
2216
- name: "Discord",
2217
- description: "Discord integration.",
2218
- instructions: {
2219
- source: Ref7.make(Text3.make(instructions2))
2220
- },
2221
- tools: [
2222
- ToolId2.make(Discord.fetch.key)
2223
- ]
2224
- });
2225
- var discord_blueprint_default = blueprint2;
2226
-
2227
- // src/blueprints/discord/index.ts
2228
- var discord_default = discord_blueprint_default;
2229
-
2230
- // src/blueprints/linear/linear-blueprint.ts
2231
- import { ToolId as ToolId3 } from "@dxos/ai";
2232
- import { Blueprint as Blueprint3 } from "@dxos/blueprints";
2233
- import { Obj as Obj12, Ref as Ref8 } from "@dxos/echo";
2234
- import { Text as Text4 } from "@dxos/schema";
2235
- import { trim as trim7 } from "@dxos/util";
2236
- var instructions3 = trim7`
2237
- You are able to sync Linear workspaces.
2238
- Sometimes sync does not complete in one go and you need to call the function again.
2239
-
2240
- Known workspaces:
2241
-
2242
- DXOS teamId: 1127c63a-6f77-4725-9229-50f6cd47321c
2243
- `;
2244
- var blueprint3 = Obj12.make(Blueprint3.Blueprint, {
2245
- key: "dxos.org/blueprint/linear",
2246
- name: "Linear",
2247
- description: "Syncs Linear workspaces.",
2248
- instructions: {
2249
- source: Ref8.make(Text4.make(instructions3))
2250
- },
2251
- tools: [
2252
- Linear.sync
2253
- ].map((tool) => ToolId3.make(tool.key))
2254
- });
2255
- var linear_blueprint_default = blueprint3;
2256
-
2257
- // src/blueprints/linear/index.ts
2258
- var linear_default = linear_blueprint_default;
2259
-
2260
- // src/blueprints/planning/planning-blueprint.ts
2261
- import { ToolId as ToolId4 } from "@dxos/ai";
2262
- import { Blueprint as Blueprint4 } from "@dxos/blueprints";
2263
- import { Obj as Obj13, Ref as Ref9 } from "@dxos/echo";
2264
- import { Text as Text5 } from "@dxos/schema";
2265
- import { trim as trim8 } from "@dxos/util";
2266
- var instructions4 = trim8`
2267
- You are a task management agent that maintains hierarchical task lists where each line is a task.
2268
-
2269
- ## Document Format
2270
- You will receive task lists with line numbers prefixed like:
2271
-
2272
- ${"```"}
2273
- 1. - [ ] First main task
2274
- 2. - [ ] Subtask 1: Research phase
2275
- 3. - [x] Literature review
2276
- 4. - [ ] Stakeholder interviews
2277
- 5. - [ ] Subtask 2: Implementation
2278
- 6. - [ ] Setup infrastructure
2279
- 7. - [ ] Write core functionality
2280
- 8. - [ ] Another main task
2281
- ${"```"}
2282
-
2283
- ## Task Hierarchy
2284
- - 0 spaces: Top-level tasks
2285
- - 2 spaces: First-level subtasks
2286
- - 4 spaces: Second-level subtasks
2287
- - 6 spaces: Third-level subtasks (and so on)
2288
-
2289
- ## Available Operations
2290
- You can modify the task list using these operations:
2291
-
2292
- 1. **insertTask(lineNumber, text, completed?, indent?)** - Insert a new task
2293
- 2. **deleteTask(lineNumber)** - Delete a task
2294
- 3. **updateTaskText(lineNumber, text)** - Change task description
2295
- 4. **toggleTaskCompletion(lineNumber, completed?)** - Mark task complete/incomplete
2296
- 5. **setTaskIndent(lineNumber, indent)** - Change task hierarchy level
2297
-
2298
- ## Examples
2299
-
2300
- ### Example 1: Adding a subtask
2301
- **User:** "Add a subtask 'Code review' under the task on line 1"
2302
- **Response:** \`insertTask(2, "Code review", false, 2)\`
2303
-
2304
- ### Example 2: Marking a task complete
2305
- **User:** "Mark the task on line 3 as complete"
2306
- **Response:** \`toggleTaskCompletion(3, true)\`
2307
-
2308
- ### Example 3: Updating task text
2309
- **User:** "Change the task on line 5 to 'Backend implementation'"
2310
- **Response:** \`updateTaskText(5, "Backend implementation")\`
2311
-
2312
- ### Example 4: Creating a task hierarchy
2313
- **User:** "Add a main task 'Testing phase' with two subtasks"
2314
- **Response:**
2315
- \`\`\`
2316
- insertTask(999, "Testing phase", false, 0)
2317
- insertTask(999, "Unit tests", false, 2)
2318
- insertTask(999, "Integration tests", false, 2)
2319
- \`\`\`
2320
-
2321
- ### Example 5: Reorganizing hierarchy
2322
- **User:** "Move the task on line 4 to be a main task (top level)"
2323
- **Response:** \`setTaskIndent(4, 0)\`
2324
-
2325
- ### Example 6: Adding nested subtasks
2326
- **User:** "Add a sub-subtask 'Write test cases' under line 6"
2327
- **Response:** \`insertTask(7, "Write test cases", false, 4)\`
2328
-
2329
- ## Guidelines
2330
- - Always reference line numbers from the numbered document you receive
2331
- - Use line number 999 to append to the end of the document
2332
- - Maintain logical hierarchy (subtasks should be indented under their parent)
2333
- - Use appropriate indentation levels (0, 2, 4, 6, etc. spaces)
2334
- - When creating subtasks, consider the parent task's completion status
2335
- - Be precise with task descriptions and hierarchy levels
2336
- `;
2337
- var blueprint4 = Obj13.make(Blueprint4.Blueprint, {
2338
- key: "dxos.org/blueprint/planning",
2339
- name: "Planning",
2340
- description: "Plans and tracks complex tasks with artifact management.",
2341
- instructions: {
2342
- source: Ref9.make(Text5.make(instructions4))
2343
- },
2344
- tools: [
2345
- Tasks.read,
2346
- Tasks.update
2347
- ].map((fn9) => ToolId4.make(fn9.key))
2348
- });
2349
- var planning_blueprint_default = blueprint4;
2350
-
2351
- // src/blueprints/planning/index.ts
2352
- var planning_default = planning_blueprint_default;
2353
-
2354
- // src/blueprints/research/research-blueprint.ts
2355
- import { ToolId as ToolId5 } from "@dxos/ai";
2356
- import { Blueprint as Blueprint5 } from "@dxos/blueprints";
2357
- import { Obj as Obj14, Ref as Ref10 } from "@dxos/echo";
2358
- import { Text as Text6 } from "@dxos/schema";
2359
- import { trim as trim9 } from "@dxos/util";
2360
- var instructions5 = trim9`
2361
- {{! Research }}
2362
-
2363
- You are an analyst that does research tasks using tools that scrape the web and create structured data.
2364
- Structured data extraction is an experimental feature -- only enable it if the user explicitly requests it in the prompt.
2365
- Prefer updating existing notes instead of creating new ones.
2366
-
2367
- <strcutured_mode>
2368
- When you are done, reply with the created objects.
2369
- Do not print the data, instead reply with inline references to the created objects.
2370
- Those will be later substituted with the pills representing the created objects.
2371
- Print the rest of the created objects as block references after the main note.
2372
-
2373
- <example>
2374
- Based on my research, Google was founded by @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M and @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW9H2ZQ
2375
-
2376
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M</dxn></object>
2377
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW9H2ZQ</dxn></object>
2378
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW92333</dxn></object>
2379
- </example>
2380
- </structured_mode>
2381
-
2382
- <unstructured_mode>
2383
- Reply normally with the text mode of the result of your research.
2384
- </unstructured_mode>
2385
- `;
2386
- var blueprint5 = Obj14.make(Blueprint5.Blueprint, {
2387
- key: "dxos.org/blueprint/research",
2388
- name: "Research",
2389
- description: "Researches the web and creates structured data.",
2390
- instructions: {
2391
- source: Ref10.make(Text6.make(instructions5))
2392
- },
2393
- tools: [
2394
- Research.create,
2395
- Research.research
2396
- ].map((fn9) => ToolId5.make(fn9.key))
2397
- });
2398
- var research_blueprint_default = blueprint5;
2399
-
2400
- // src/blueprints/research/index.ts
2401
- var research_default2 = research_blueprint_default;
2402
-
2403
- // src/blueprints/websearch/websearch-blueprint.ts
2404
- import { ToolId as ToolId6 } from "@dxos/ai";
2405
- import { Blueprint as Blueprint6 } from "@dxos/blueprints";
2406
- import { Obj as Obj15, Ref as Ref11 } from "@dxos/echo";
2407
- import { Text as Text7 } from "@dxos/schema";
2408
- var blueprint6 = Obj15.make(Blueprint6.Blueprint, {
2409
- key: "dxos.org/blueprint/web-search",
2410
- name: "Web Search",
2411
- description: "Search the web.",
2412
- instructions: {
2413
- source: Ref11.make(Text7.make())
2414
- },
2415
- tools: [
2416
- ToolId6.make("AnthropicWebSearch")
2417
- ]
2418
- });
2419
- var websearch_blueprint_default = blueprint6;
2420
-
2421
- // src/blueprints/websearch/websearch-toolkit.ts
2422
- import * as Toolkit4 from "@effect/ai/Toolkit";
2423
- import * as AnthropicTool2 from "@effect/ai-anthropic/AnthropicTool";
2424
- var WebSearchToolkit = Toolkit4.make(AnthropicTool2.WebSearch_20250305({}));
2425
-
2426
- // src/blueprints/websearch/index.ts
2427
- var websearch_default = websearch_blueprint_default;
2428
-
2429
- // src/plugins.tsx
2430
- import * as Schema15 from "effect/Schema";
2431
- import React from "react";
2432
- import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
2433
- import { Format, Type as Type4 } from "@dxos/echo";
2434
- import { JsonFilter } from "@dxos/react-ui-syntax-highlighter";
2435
- var MapSchema = Schema15.Struct({
2436
- coordinates: Format.GeoPoint
2437
- }).pipe(Type4.Obj({
2438
- typename: "example.com/type/Map",
2439
- version: "0.1.0"
2440
- }));
2441
- var isImage = (data) => false;
2442
- var capabilities = [
2443
- contributes(Capabilities.ReactSurface, createSurface({
2444
- id: "plugin-image",
2445
- role: "card--extrinsic",
2446
- filter: (data) => isImage(data.value),
2447
- component: ({ data }) => /* @__PURE__ */ React.createElement("img", {
2448
- className: "grow object-cover",
2449
- src: `data:image/jpeg;base64,${data.value.source.data}`,
2450
- alt: data.value.prompt ?? `Generated image [id=${data.value.id}]`
2451
- })
2452
- })),
2453
- //
2454
- // Default
2455
- //
2456
- contributes(Capabilities.ReactSurface, createSurface({
2457
- id: "plugin-default",
2458
- role: "card--extrinsic",
2459
- position: "fallback",
2460
- component: ({ role, data }) => /* @__PURE__ */ React.createElement(JsonFilter, {
2461
- data
2462
- })
2463
- }))
2464
- ];
2465
-
2466
- // src/toolkits/AssistantToolkit.ts
2467
- var AssistantToolkit_exports = {};
2468
- __export(AssistantToolkit_exports, {
2469
- AssistantToolkit: () => AssistantToolkit,
2470
- layer: () => layer3,
2471
- tools: () => tools
2472
- });
2473
- import * as Tool2 from "@effect/ai/Tool";
2474
- import * as Toolkit5 from "@effect/ai/Toolkit";
2475
- import * as Effect16 from "effect/Effect";
2476
- import * as Record from "effect/Record";
2477
- import * as Schema16 from "effect/Schema";
2478
- import { AiContextService, ArtifactId as ArtifactId6 } from "@dxos/assistant";
2479
- import { Ref as Ref12 } from "@dxos/echo";
2480
- import { DatabaseService as DatabaseService13 } from "@dxos/functions";
2481
- import { trim as trim10 } from "@dxos/util";
2482
- var AssistantToolkit = Toolkit5.make(Tool2.make("add-to-context", {
2483
- description: trim10`
2484
- Adds the object to the chat context.
2485
- `,
2486
- parameters: {
2487
- id: ArtifactId6.annotations({
2488
- description: "The ID of the document to read."
2489
- })
2490
- },
2491
- success: Schema16.Void,
2492
- failure: Schema16.Never,
2493
- dependencies: [
2494
- AiContextService,
2495
- DatabaseService13
2496
- ]
2497
- }));
2498
- var tools = Record.keys(AssistantToolkit.tools);
2499
- var layer3 = () => AssistantToolkit.toLayer({
2500
- "add-to-context": Effect16.fnUntraced(function* ({ id }) {
2501
- const { binder } = yield* AiContextService;
2502
- const { db } = yield* DatabaseService13;
2503
- const ref = Ref12.fromDXN(ArtifactId6.toDXN(id, db.spaceId));
2504
- yield* Effect16.promise(() => binder.bind({
2505
- blueprints: [],
2506
- objects: [
2507
- ref
2508
- ]
2509
- }));
2510
- })
2511
- });
2512
-
2513
- // src/toolkits/SystemToolkit.ts
2514
- var SystemToolkit_exports = {};
2515
- __export(SystemToolkit_exports, {
2516
- SystemToolkit: () => SystemToolkit,
2517
- layer: () => layer4,
2518
- tools: () => tools2
2519
- });
2520
- import * as Tool3 from "@effect/ai/Tool";
2521
- import * as Toolkit6 from "@effect/ai/Toolkit";
2522
- import * as Effect17 from "effect/Effect";
2523
- import * as Record2 from "effect/Record";
2524
- import * as Schema17 from "effect/Schema";
2525
- import { ArtifactId as ArtifactId7 } from "@dxos/assistant";
2526
- import { DXN as DXN2, Obj as Obj16, Relation as Relation2, Tag as Tag2, Type as Type5 } from "@dxos/echo";
2527
- import { DatabaseService as DatabaseService14 } from "@dxos/functions";
2528
- import { trim as trim11 } from "@dxos/util";
2529
- var SystemToolkit = Toolkit6.make(
2530
- //
2531
- // Schema
2532
- //
2533
- Tool3.make("schema-list", {
2534
- description: trim11`
2535
- Lists schemas definitions.
2536
- `,
2537
- parameters: {
2538
- // TODO(wittjosiah): Remove this once parameter-less tools are fixed.
2539
- limit: Schema17.Number
2540
- },
2541
- // TODO(dmaretskyi): Effect returns ({ result, encodedResult })
2542
- success: Schema17.Any,
2543
- failure: Schema17.Never,
2544
- dependencies: [
2545
- DatabaseService14
2546
- ]
2547
- }),
2548
- Tool3.make("schema-add", {
2549
- description: trim11`
2550
- Adds a schema to the space.
2551
- The name will be used when displayed to the user.
2552
- The typename must be in the format of "example.com/type/Type".
2553
- `,
2554
- parameters: {
2555
- name: Schema17.String,
2556
- typename: Schema17.String,
2557
- jsonSchema: Schema17.Any
2558
- },
2559
- success: Schema17.Any,
2560
- failure: Schema17.Never,
2561
- dependencies: [
2562
- DatabaseService14
2563
- ]
2564
- }),
2565
- //
2566
- // Objects
2567
- //
2568
- Tool3.make("object-create", {
2569
- description: trim11`
2570
- Creates a new object and adds it to the current space.
2571
- Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.
2572
- `,
2573
- parameters: {
2574
- typename: Schema17.String,
2575
- data: Schema17.Any
2576
- },
2577
- success: Schema17.Any,
2578
- failure: Schema17.Never,
2579
- dependencies: [
2580
- DatabaseService14
2581
- ]
2582
- }),
2583
- Tool3.make("object-remove", {
2584
- description: trim11`
2585
- Removes an object or relation from the database.
2586
- `,
2587
- parameters: {
2588
- id: ArtifactId7.annotations({
2589
- description: "The ID of the object."
2590
- })
2591
- },
2592
- success: Schema17.Any,
2593
- failure: Schema17.Never,
2594
- dependencies: [
2595
- DatabaseService14
2596
- ]
2597
- }),
2598
- //
2599
- // Relations
2600
- //
2601
- Tool3.make("relation-create", {
2602
- description: trim11`
2603
- Creates a new relation and adds it to the current space.
2604
- Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.
2605
- `,
2606
- parameters: {
2607
- typename: Schema17.String,
2608
- source: ArtifactId7.annotations({
2609
- description: "The ID of the source object."
2610
- }),
2611
- target: ArtifactId7.annotations({
2612
- description: "The ID of the target object."
2613
- }),
2614
- data: Schema17.Any.annotations({
2615
- description: "The data to be stored in the relation."
2616
- })
2617
- },
2618
- success: Schema17.Any,
2619
- failure: Schema17.Never,
2620
- dependencies: [
2621
- DatabaseService14
2622
- ]
2623
- }),
2624
- //
2625
- // Tags
2626
- //
2627
- Tool3.make("tag-add", {
2628
- description: trim11`
2629
- Adds a tag to an object.
2630
- Tags are objects of type ${Tag2.Tag.typename}.
2631
- `,
2632
- parameters: {
2633
- tagId: ArtifactId7.annotations({
2634
- description: "The ID of the tag."
2635
- }),
2636
- objectId: ArtifactId7.annotations({
2637
- description: "The ID of the object."
2638
- })
2639
- },
2640
- success: Schema17.Any,
2641
- failure: Schema17.Never,
2642
- dependencies: [
2643
- DatabaseService14
2644
- ]
2645
- }),
2646
- Tool3.make("tag-remove", {
2647
- description: trim11`
2648
- Removes a tag from an object.
2649
- Tags are objects of type ${Tag2.Tag.typename}.
2650
- `,
2651
- parameters: {
2652
- tagId: ArtifactId7.annotations({
2653
- description: "The ID of the tag."
2654
- }),
2655
- objectId: ArtifactId7.annotations({
2656
- description: "The ID of the object."
2657
- })
2658
- },
2659
- success: Schema17.Any,
2660
- failure: Schema17.Never,
2661
- dependencies: [
2662
- DatabaseService14
2663
- ]
2664
- })
2665
- );
2666
- var tools2 = Record2.keys(SystemToolkit.tools);
2667
- var layer4 = () => SystemToolkit.toLayer({
2668
- "schema-list": Effect17.fnUntraced(function* () {
2669
- const { db } = yield* DatabaseService14;
2670
- const schema = yield* Effect17.promise(() => db.schemaRegistry.query({
2671
- location: [
2672
- "database",
2673
- "runtime"
2674
- ]
2675
- }).run());
2676
- return schema.map((schema2) => {
2677
- const meta = Type5.getMeta(schema2);
2678
- return {
2679
- typename: Type5.getTypename(schema2),
2680
- jsonSchema: Type5.toJsonSchema(schema2),
2681
- kind: meta?.sourceSchema ? "relation" : "record"
2682
- };
2683
- });
2684
- }),
2685
- "schema-add": Effect17.fnUntraced(function* ({ name, typename, jsonSchema }) {
2686
- const { db } = yield* DatabaseService14;
2687
- yield* Effect17.promise(() => db.schemaRegistry.register([
2688
- {
2689
- typename,
2690
- version: "0.1.0",
2691
- jsonSchema,
2692
- name
2693
- }
2694
- ]));
2695
- }),
2696
- "object-create": Effect17.fnUntraced(function* ({ typename, data }) {
2697
- const { db } = yield* DatabaseService14;
2698
- const schema = yield* Effect17.promise(() => db.schemaRegistry.query({
2699
- typename,
2700
- location: [
2701
- "database",
2702
- "runtime"
2703
- ]
2704
- }).first());
2705
- const object = db.add(Obj16.make(schema, data));
2706
- return object;
2707
- }),
2708
- "object-remove": Effect17.fnUntraced(function* ({ id }) {
2709
- const { db } = yield* DatabaseService14;
2710
- const object = yield* DatabaseService14.resolve(DXN2.parse(id));
2711
- db.remove(object);
2712
- return object;
2713
- }),
2714
- "relation-create": Effect17.fnUntraced(function* ({ typename, source, target, data }) {
2715
- const { db } = yield* DatabaseService14;
2716
- const schema = yield* Effect17.promise(() => db.schemaRegistry.query({
2717
- typename,
2718
- location: [
2719
- "database",
2720
- "runtime"
2721
- ]
2722
- }).first());
2723
- const sourceObj = yield* DatabaseService14.resolve(DXN2.parse(source));
2724
- const targetObj = yield* DatabaseService14.resolve(DXN2.parse(target));
2725
- const relation = db.add(Relation2.make(schema, {
2726
- [Relation2.Source]: sourceObj,
2727
- [Relation2.Target]: targetObj,
2728
- ...data
2729
- }));
2730
- return relation;
2731
- }),
2732
- "tag-add": Effect17.fnUntraced(function* ({ tagId, objectId }) {
2733
- const object = yield* DatabaseService14.resolve(DXN2.parse(objectId));
2734
- Obj16.addTag(object, DXN2.parse(tagId).toString());
2735
- return object;
2736
- }),
2737
- "tag-remove": Effect17.fnUntraced(function* ({ tagId, objectId }) {
2738
- const object = yield* DatabaseService14.resolve(DXN2.parse(objectId));
2739
- Obj16.removeTag(object, DXN2.parse(tagId).toString());
2740
- return object;
2741
- })
2742
- });
2743
553
  export {
2744
- Agent,
2745
- AssistantToolkit_exports as AssistantToolkit,
2746
- design_default as DesignBlueprint,
2747
- Discord,
2748
- discord_default as DiscordBlueprint,
2749
- Document,
2750
- EntityExtraction,
2751
- Linear,
2752
- linear_default as LinearBlueprint,
2753
- LocalSearchHandler,
2754
- LocalSearchToolkit,
2755
- MapSchema,
2756
- planning_default as PlanningBlueprint,
2757
- Research,
2758
- research_default2 as ResearchBlueprint,
2759
- ResearchDataTypes,
2760
- ResearchGraph,
2761
- Subgraph,
2762
- SystemToolkit_exports as SystemToolkit,
2763
- Tasks,
2764
- websearch_default as WebSearchBlueprint,
2765
- WebSearchToolkit,
2766
- capabilities,
2767
- contextQueueLayerFromResearchGraph,
2768
- createExtractionSchema,
2769
- createResearchGraph,
2770
- findRelatedSchema,
2771
- getSanitizedSchemaName,
2772
- makeGraphWriterHandler,
2773
- makeGraphWriterToolkit,
2774
- queryResearchGraph,
2775
- sanitizeObjects,
2776
- syncObjects
554
+ mock_default as default
2777
555
  };
2778
- //# sourceMappingURL=index.mjs.map
556
+ //# sourceMappingURL=mock-2ARYZ54S.mjs.map