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

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 (657) hide show
  1. package/dist/lib/neutral/add-artifact-OBP4D5RN.mjs +30 -0
  2. package/dist/lib/neutral/add-artifact-OBP4D5RN.mjs.map +7 -0
  3. package/dist/lib/neutral/agent-27Z7BESA.mjs +95 -0
  4. package/dist/lib/neutral/agent-27Z7BESA.mjs.map +7 -0
  5. package/dist/lib/neutral/chunk-2NKPVOXM.mjs +267 -0
  6. package/dist/lib/neutral/chunk-2NKPVOXM.mjs.map +7 -0
  7. package/dist/lib/neutral/chunk-3ZUJIEFV.mjs +184 -0
  8. package/dist/lib/neutral/chunk-3ZUJIEFV.mjs.map +7 -0
  9. package/dist/lib/neutral/chunk-4QGZEDWS.mjs +140 -0
  10. package/dist/lib/neutral/chunk-4QGZEDWS.mjs.map +7 -0
  11. package/dist/lib/neutral/chunk-6FL4C6KD.mjs +86 -0
  12. package/dist/lib/neutral/chunk-6FL4C6KD.mjs.map +7 -0
  13. package/dist/lib/neutral/chunk-6IAJ2JI5.mjs +54 -0
  14. package/dist/lib/neutral/chunk-6IAJ2JI5.mjs.map +7 -0
  15. package/dist/lib/neutral/chunk-AGG6OZNB.mjs +74 -0
  16. package/dist/lib/neutral/chunk-AGG6OZNB.mjs.map +7 -0
  17. package/dist/lib/neutral/chunk-AKMBURAD.mjs +320 -0
  18. package/dist/lib/neutral/chunk-AKMBURAD.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-CJUCONUJ.mjs +99 -0
  22. package/dist/lib/neutral/chunk-CJUCONUJ.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-GAJ6MKJX.mjs +363 -0
  24. package/dist/lib/neutral/chunk-GAJ6MKJX.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-HEFG73F2.mjs +53 -0
  26. package/dist/lib/neutral/chunk-HEFG73F2.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-HZM3HNAS.mjs +78 -0
  28. package/dist/lib/neutral/chunk-HZM3HNAS.mjs.map +7 -0
  29. package/dist/lib/neutral/chunk-ILZ2ODWC.mjs +95 -0
  30. package/dist/lib/neutral/chunk-ILZ2ODWC.mjs.map +7 -0
  31. package/dist/lib/neutral/chunk-IQNOIB23.mjs +58 -0
  32. package/dist/lib/neutral/chunk-IQNOIB23.mjs.map +7 -0
  33. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  34. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  35. package/dist/lib/neutral/chunk-KWZG4QBN.mjs +685 -0
  36. package/dist/lib/neutral/chunk-KWZG4QBN.mjs.map +7 -0
  37. package/dist/lib/neutral/chunk-LI6VMCJW.mjs +27 -0
  38. package/dist/lib/neutral/chunk-LI6VMCJW.mjs.map +7 -0
  39. package/dist/lib/neutral/chunk-MEZ4UFR6.mjs +25 -0
  40. package/dist/lib/neutral/chunk-MEZ4UFR6.mjs.map +7 -0
  41. package/dist/lib/neutral/chunk-VBSCQN37.mjs +52 -0
  42. package/dist/lib/neutral/chunk-VBSCQN37.mjs.map +7 -0
  43. package/dist/lib/neutral/chunk-VDEDVOS6.mjs +39 -0
  44. package/dist/lib/neutral/chunk-VDEDVOS6.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-YEDZU75J.mjs +34 -0
  54. package/dist/lib/neutral/create-project-YEDZU75J.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-Q5NXGX2G.mjs +48 -0
  60. package/dist/lib/neutral/enable-blueprints-Q5NXGX2G.mjs.map +7 -0
  61. package/dist/lib/neutral/entity-extraction-CFXRZWZK.mjs +196 -0
  62. package/dist/lib/neutral/entity-extraction-CFXRZWZK.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-MKM4CEGH.mjs +35 -0
  70. package/dist/lib/neutral/get-context-MKM4CEGH.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-JSY4GY77.mjs} +28 -1953
  77. package/dist/lib/neutral/mock-JSY4GY77.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-rules-ZVV4TFOQ.mjs +77 -0
  85. package/dist/lib/neutral/project-rules-ZVV4TFOQ.mjs.map +7 -0
  86. package/dist/lib/neutral/prompt-J2XSDAWH.mjs +138 -0
  87. package/dist/lib/neutral/prompt-J2XSDAWH.mjs.map +7 -0
  88. package/dist/lib/neutral/qualifier-WRYRVSET.mjs +104 -0
  89. package/dist/lib/neutral/qualifier-WRYRVSET.mjs.map +7 -0
  90. package/dist/lib/neutral/query-FUFKLAN2.mjs +66 -0
  91. package/dist/lib/neutral/query-FUFKLAN2.mjs.map +7 -0
  92. package/dist/lib/neutral/query-U4LWIBNG.mjs +32 -0
  93. package/dist/lib/neutral/query-U4LWIBNG.mjs.map +7 -0
  94. package/dist/lib/neutral/query-blueprints-Y5CXJLCT.mjs +17 -0
  95. package/dist/lib/neutral/query-blueprints-Y5CXJLCT.mjs.map +7 -0
  96. package/dist/lib/neutral/read-JJN7YXHI.mjs +19 -0
  97. package/dist/lib/neutral/read-JJN7YXHI.mjs.map +7 -0
  98. package/dist/lib/neutral/relation-create-YWV2TUKS.mjs +42 -0
  99. package/dist/lib/neutral/relation-create-YWV2TUKS.mjs.map +7 -0
  100. package/dist/lib/neutral/relation-delete-JGGA4CYQ.mjs +18 -0
  101. package/dist/lib/neutral/relation-delete-JGGA4CYQ.mjs.map +7 -0
  102. package/dist/lib/neutral/research-UBK6ZGX7.mjs +109 -0
  103. package/dist/lib/neutral/research-UBK6ZGX7.mjs.map +7 -0
  104. package/dist/lib/neutral/save-JZ73KUMA.mjs +23 -0
  105. package/dist/lib/neutral/save-JZ73KUMA.mjs.map +7 -0
  106. package/dist/lib/neutral/schema-add-7WKPPKW4.mjs +24 -0
  107. package/dist/lib/neutral/schema-add-7WKPPKW4.mjs.map +7 -0
  108. package/dist/lib/neutral/schema-list-MIAIKERK.mjs +30 -0
  109. package/dist/lib/neutral/schema-list-MIAIKERK.mjs.map +7 -0
  110. package/dist/lib/neutral/sync-issues-FIRE3XR6.mjs +179 -0
  111. package/dist/lib/neutral/sync-issues-FIRE3XR6.mjs.map +7 -0
  112. package/dist/lib/neutral/tag-add-IKD4ADDM.mjs +19 -0
  113. package/dist/lib/neutral/tag-add-IKD4ADDM.mjs.map +7 -0
  114. package/dist/lib/neutral/tag-remove-PCSKCFT2.mjs +19 -0
  115. package/dist/lib/neutral/tag-remove-PCSKCFT2.mjs.map +7 -0
  116. package/dist/lib/neutral/testing/index.mjs +81 -0
  117. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  118. package/dist/lib/neutral/update-HZ7A3ZA5.mjs +20 -0
  119. package/dist/lib/neutral/update-HZ7A3ZA5.mjs.map +7 -0
  120. package/dist/lib/neutral/update-tasks-TZ65WZ44.mjs +46 -0
  121. package/dist/lib/neutral/update-tasks-TZ65WZ44.mjs.map +7 -0
  122. package/dist/types/src/blueprints/automation/blueprint.d.ts +4 -0
  123. package/dist/types/src/blueprints/automation/blueprint.d.ts.map +1 -0
  124. package/dist/types/src/blueprints/automation/index.d.ts +2 -0
  125. package/dist/types/src/blueprints/automation/index.d.ts.map +1 -0
  126. package/dist/types/src/blueprints/blueprint-manager/blueprint.d.ts +4 -0
  127. package/dist/types/src/blueprints/blueprint-manager/blueprint.d.ts.map +1 -0
  128. package/dist/types/src/blueprints/blueprint-manager/blueprint.test.d.ts +2 -0
  129. package/dist/types/src/blueprints/blueprint-manager/blueprint.test.d.ts.map +1 -0
  130. package/dist/types/src/blueprints/blueprint-manager/functions/definitions.d.ts +59 -0
  131. package/dist/types/src/blueprints/blueprint-manager/functions/definitions.d.ts.map +1 -0
  132. package/dist/types/src/blueprints/blueprint-manager/functions/enable-blueprints.d.ts +36 -0
  133. package/dist/types/src/blueprints/blueprint-manager/functions/enable-blueprints.d.ts.map +1 -0
  134. package/dist/types/src/blueprints/blueprint-manager/functions/index.d.ts +4 -0
  135. package/dist/types/src/blueprints/blueprint-manager/functions/index.d.ts.map +1 -0
  136. package/dist/types/src/blueprints/blueprint-manager/functions/query-blueprints.d.ts +27 -0
  137. package/dist/types/src/blueprints/blueprint-manager/functions/query-blueprints.d.ts.map +1 -0
  138. package/dist/types/src/blueprints/blueprint-manager/index.d.ts +3 -0
  139. package/dist/types/src/blueprints/blueprint-manager/index.d.ts.map +1 -0
  140. package/dist/types/src/blueprints/browser/blueprint.d.ts +4 -0
  141. package/dist/types/src/blueprints/browser/blueprint.d.ts.map +1 -0
  142. package/dist/types/src/blueprints/browser/blueprint.test.d.ts +2 -0
  143. package/dist/types/src/blueprints/browser/blueprint.test.d.ts.map +1 -0
  144. package/dist/types/src/blueprints/browser/index.d.ts +2 -0
  145. package/dist/types/src/blueprints/browser/index.d.ts.map +1 -0
  146. package/dist/types/src/blueprints/database/blueprint.d.ts +4 -0
  147. package/dist/types/src/blueprints/database/blueprint.d.ts.map +1 -0
  148. package/dist/types/src/blueprints/database/blueprint.test.d.ts +2 -0
  149. package/dist/types/src/blueprints/database/blueprint.test.d.ts.map +1 -0
  150. package/dist/types/src/blueprints/database/functions/context-add.d.ts +7 -0
  151. package/dist/types/src/blueprints/database/functions/context-add.d.ts.map +1 -0
  152. package/dist/types/src/blueprints/database/functions/context-remove.d.ts +7 -0
  153. package/dist/types/src/blueprints/database/functions/context-remove.d.ts.map +1 -0
  154. package/dist/types/src/blueprints/database/functions/definitions.d.ts +58 -0
  155. package/dist/types/src/blueprints/database/functions/definitions.d.ts.map +1 -0
  156. package/dist/types/src/blueprints/database/functions/index.d.ts +4 -0
  157. package/dist/types/src/blueprints/database/functions/index.d.ts.map +1 -0
  158. package/dist/types/src/blueprints/database/functions/load.d.ts +7 -0
  159. package/dist/types/src/blueprints/database/functions/load.d.ts.map +1 -0
  160. package/dist/types/src/blueprints/database/functions/object-create.d.ts +8 -0
  161. package/dist/types/src/blueprints/database/functions/object-create.d.ts.map +1 -0
  162. package/dist/types/src/blueprints/database/functions/object-delete.d.ts +7 -0
  163. package/dist/types/src/blueprints/database/functions/object-delete.d.ts.map +1 -0
  164. package/dist/types/src/blueprints/database/functions/object-update.d.ts +10 -0
  165. package/dist/types/src/blueprints/database/functions/object-update.d.ts.map +1 -0
  166. package/dist/types/src/blueprints/database/functions/query.d.ts +11 -0
  167. package/dist/types/src/blueprints/database/functions/query.d.ts.map +1 -0
  168. package/dist/types/src/blueprints/database/functions/relation-create.d.ts +10 -0
  169. package/dist/types/src/blueprints/database/functions/relation-create.d.ts.map +1 -0
  170. package/dist/types/src/blueprints/database/functions/relation-delete.d.ts +7 -0
  171. package/dist/types/src/blueprints/database/functions/relation-delete.d.ts.map +1 -0
  172. package/dist/types/src/blueprints/database/functions/schema-add.d.ts +9 -0
  173. package/dist/types/src/blueprints/database/functions/schema-add.d.ts.map +1 -0
  174. package/dist/types/src/blueprints/database/functions/schema-list.d.ts +7 -0
  175. package/dist/types/src/blueprints/database/functions/schema-list.d.ts.map +1 -0
  176. package/dist/types/src/blueprints/database/functions/tag-add.d.ts +8 -0
  177. package/dist/types/src/blueprints/database/functions/tag-add.d.ts.map +1 -0
  178. package/dist/types/src/blueprints/database/functions/tag-remove.d.ts +8 -0
  179. package/dist/types/src/blueprints/database/functions/tag-remove.d.ts.map +1 -0
  180. package/dist/types/src/blueprints/database/index.d.ts +3 -0
  181. package/dist/types/src/blueprints/database/index.d.ts.map +1 -0
  182. package/dist/types/src/blueprints/design/blueprint.d.ts +4 -0
  183. package/dist/types/src/blueprints/design/blueprint.d.ts.map +1 -0
  184. package/dist/types/src/blueprints/design/blueprint.test.d.ts +2 -0
  185. package/dist/types/src/blueprints/design/blueprint.test.d.ts.map +1 -0
  186. package/dist/types/src/blueprints/design/index.d.ts +1 -2
  187. package/dist/types/src/blueprints/design/index.d.ts.map +1 -1
  188. package/dist/types/src/blueprints/discord/blueprint.d.ts +4 -0
  189. package/dist/types/src/blueprints/discord/blueprint.d.ts.map +1 -0
  190. package/dist/types/src/blueprints/discord/functions/definitions.d.ts +16 -0
  191. package/dist/types/src/blueprints/discord/functions/definitions.d.ts.map +1 -0
  192. package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.d.ts +4 -2
  193. package/dist/types/src/blueprints/discord/functions/fetch-messages.d.ts.map +1 -0
  194. package/dist/types/src/blueprints/discord/functions/fetch-messages.test.d.ts.map +1 -0
  195. package/dist/types/src/blueprints/discord/functions/index.d.ts +4 -0
  196. package/dist/types/src/blueprints/discord/functions/index.d.ts.map +1 -0
  197. package/dist/types/src/blueprints/discord/index.d.ts +2 -2
  198. package/dist/types/src/blueprints/discord/index.d.ts.map +1 -1
  199. package/dist/types/src/blueprints/github/functions/definitions.d.ts +8 -0
  200. package/dist/types/src/blueprints/github/functions/definitions.d.ts.map +1 -0
  201. package/dist/types/src/blueprints/github/functions/fetch-prs.d.ts +9 -0
  202. package/dist/types/src/blueprints/github/functions/fetch-prs.d.ts.map +1 -0
  203. package/dist/types/src/blueprints/github/functions/index.d.ts +4 -0
  204. package/dist/types/src/blueprints/github/functions/index.d.ts.map +1 -0
  205. package/dist/types/src/blueprints/github/index.d.ts +2 -0
  206. package/dist/types/src/blueprints/github/index.d.ts.map +1 -0
  207. package/dist/types/src/blueprints/index.d.ts +14 -6
  208. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  209. package/dist/types/src/blueprints/linear/blueprint.d.ts +4 -0
  210. package/dist/types/src/blueprints/linear/blueprint.d.ts.map +1 -0
  211. package/dist/types/src/blueprints/linear/functions/definitions.d.ts +7 -0
  212. package/dist/types/src/blueprints/linear/functions/definitions.d.ts.map +1 -0
  213. package/dist/types/src/blueprints/linear/functions/index.d.ts +4 -0
  214. package/dist/types/src/blueprints/linear/functions/index.d.ts.map +1 -0
  215. package/dist/types/src/blueprints/linear/functions/linear.test.d.ts.map +1 -0
  216. package/dist/types/src/blueprints/linear/functions/sync-issues.d.ts +11 -0
  217. package/dist/types/src/blueprints/linear/functions/sync-issues.d.ts.map +1 -0
  218. package/dist/types/src/blueprints/linear/index.d.ts +2 -2
  219. package/dist/types/src/blueprints/linear/index.d.ts.map +1 -1
  220. package/dist/types/src/blueprints/markdown/blueprint.d.ts +4 -0
  221. package/dist/types/src/blueprints/markdown/blueprint.d.ts.map +1 -0
  222. package/dist/types/src/blueprints/markdown/functions/create.d.ts +8 -0
  223. package/dist/types/src/blueprints/markdown/functions/create.d.ts.map +1 -0
  224. package/dist/types/src/blueprints/markdown/functions/definitions.d.ts +45 -0
  225. package/dist/types/src/blueprints/markdown/functions/definitions.d.ts.map +1 -0
  226. package/dist/types/src/blueprints/markdown/functions/index.d.ts +4 -0
  227. package/dist/types/src/blueprints/markdown/functions/index.d.ts.map +1 -0
  228. package/dist/types/src/blueprints/markdown/functions/read.d.ts +17 -0
  229. package/dist/types/src/blueprints/markdown/functions/read.d.ts.map +1 -0
  230. package/dist/types/src/blueprints/markdown/functions/update.d.ts +16 -0
  231. package/dist/types/src/blueprints/markdown/functions/update.d.ts.map +1 -0
  232. package/dist/types/src/blueprints/markdown/index.d.ts +3 -0
  233. package/dist/types/src/blueprints/markdown/index.d.ts.map +1 -0
  234. package/dist/types/src/blueprints/memory/blueprint.d.ts +4 -0
  235. package/dist/types/src/blueprints/memory/blueprint.d.ts.map +1 -0
  236. package/dist/types/src/blueprints/memory/blueprint.test.d.ts +2 -0
  237. package/dist/types/src/blueprints/memory/blueprint.test.d.ts.map +1 -0
  238. package/dist/types/src/blueprints/memory/functions/definitions.d.ts +17 -0
  239. package/dist/types/src/blueprints/memory/functions/definitions.d.ts.map +1 -0
  240. package/dist/types/src/blueprints/memory/functions/delete.d.ts +10 -0
  241. package/dist/types/src/blueprints/memory/functions/delete.d.ts.map +1 -0
  242. package/dist/types/src/blueprints/memory/functions/index.d.ts +4 -0
  243. package/dist/types/src/blueprints/memory/functions/index.d.ts.map +1 -0
  244. package/dist/types/src/blueprints/memory/functions/query.d.ts +8 -0
  245. package/dist/types/src/blueprints/memory/functions/query.d.ts.map +1 -0
  246. package/dist/types/src/blueprints/memory/functions/save.d.ts +8 -0
  247. package/dist/types/src/blueprints/memory/functions/save.d.ts.map +1 -0
  248. package/dist/types/src/blueprints/memory/index.d.ts +3 -0
  249. package/dist/types/src/blueprints/memory/index.d.ts.map +1 -0
  250. package/dist/types/src/blueprints/planning/blueprint.d.ts +4 -0
  251. package/dist/types/src/blueprints/planning/blueprint.d.ts.map +1 -0
  252. package/dist/types/src/blueprints/planning/functions/definitions.d.ts +11 -0
  253. package/dist/types/src/blueprints/planning/functions/definitions.d.ts.map +1 -0
  254. package/dist/types/src/blueprints/planning/functions/index.d.ts +4 -0
  255. package/dist/types/src/blueprints/planning/functions/index.d.ts.map +1 -0
  256. package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts +11 -0
  257. package/dist/types/src/blueprints/planning/functions/update-tasks.d.ts.map +1 -0
  258. package/dist/types/src/blueprints/planning/index.d.ts +2 -2
  259. package/dist/types/src/blueprints/planning/index.d.ts.map +1 -1
  260. package/dist/types/src/blueprints/planning-old/blueprint.d.ts +4 -0
  261. package/dist/types/src/blueprints/planning-old/blueprint.d.ts.map +1 -0
  262. package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts +2 -0
  263. package/dist/types/src/blueprints/planning-old/blueprint.test.d.ts.map +1 -0
  264. package/dist/types/src/blueprints/planning-old/functions/definitions.d.ts +31 -0
  265. package/dist/types/src/blueprints/planning-old/functions/definitions.d.ts.map +1 -0
  266. package/dist/types/src/blueprints/planning-old/functions/index.d.ts +4 -0
  267. package/dist/types/src/blueprints/planning-old/functions/index.d.ts.map +1 -0
  268. package/dist/types/src/blueprints/planning-old/functions/read.d.ts +17 -0
  269. package/dist/types/src/blueprints/planning-old/functions/read.d.ts.map +1 -0
  270. package/dist/types/src/blueprints/planning-old/functions/task-list.d.ts.map +1 -0
  271. package/dist/types/src/blueprints/planning-old/functions/task-list.test.d.ts.map +1 -0
  272. package/dist/types/src/blueprints/planning-old/functions/update.d.ts +19 -0
  273. package/dist/types/src/blueprints/planning-old/functions/update.d.ts.map +1 -0
  274. package/dist/types/src/blueprints/planning-old/index.d.ts +3 -0
  275. package/dist/types/src/blueprints/planning-old/index.d.ts.map +1 -0
  276. package/dist/types/src/blueprints/project/blueprint.d.ts +4 -0
  277. package/dist/types/src/blueprints/project/blueprint.d.ts.map +1 -0
  278. package/dist/types/src/blueprints/project/blueprint.test.d.ts +2 -0
  279. package/dist/types/src/blueprints/project/blueprint.test.d.ts.map +1 -0
  280. package/dist/types/src/blueprints/project/functions/add-artifact.d.ts +8 -0
  281. package/dist/types/src/blueprints/project/functions/add-artifact.d.ts.map +1 -0
  282. package/dist/types/src/blueprints/project/functions/agent.d.ts +4 -0
  283. package/dist/types/src/blueprints/project/functions/agent.d.ts.map +1 -0
  284. package/dist/types/src/blueprints/project/functions/definitions.d.ts +150 -0
  285. package/dist/types/src/blueprints/project/functions/definitions.d.ts.map +1 -0
  286. package/dist/types/src/blueprints/project/functions/get-context.d.ts +15 -0
  287. package/dist/types/src/blueprints/project/functions/get-context.d.ts.map +1 -0
  288. package/dist/types/src/blueprints/project/functions/index.d.ts +4 -0
  289. package/dist/types/src/blueprints/project/functions/index.d.ts.map +1 -0
  290. package/dist/types/src/blueprints/project/functions/qualifier.d.ts +69 -0
  291. package/dist/types/src/blueprints/project/functions/qualifier.d.ts.map +1 -0
  292. package/dist/types/src/blueprints/project/index.d.ts +4 -0
  293. package/dist/types/src/blueprints/project/index.d.ts.map +1 -0
  294. package/dist/types/src/blueprints/project/sync-triggers.d.ts +11 -0
  295. package/dist/types/src/blueprints/project/sync-triggers.d.ts.map +1 -0
  296. package/dist/types/src/blueprints/project-wizard/blueprint.d.ts +4 -0
  297. package/dist/types/src/blueprints/project-wizard/blueprint.d.ts.map +1 -0
  298. package/dist/types/src/blueprints/project-wizard/functions/create-project.d.ts +48 -0
  299. package/dist/types/src/blueprints/project-wizard/functions/create-project.d.ts.map +1 -0
  300. package/dist/types/src/blueprints/project-wizard/functions/definitions.d.ts +49 -0
  301. package/dist/types/src/blueprints/project-wizard/functions/definitions.d.ts.map +1 -0
  302. package/dist/types/src/blueprints/project-wizard/functions/index.d.ts +4 -0
  303. package/dist/types/src/blueprints/project-wizard/functions/index.d.ts.map +1 -0
  304. package/dist/types/src/blueprints/project-wizard/functions/project-rules.d.ts +4 -0
  305. package/dist/types/src/blueprints/project-wizard/functions/project-rules.d.ts.map +1 -0
  306. package/dist/types/src/blueprints/project-wizard/index.d.ts +3 -0
  307. package/dist/types/src/blueprints/project-wizard/index.d.ts.map +1 -0
  308. package/dist/types/src/blueprints/research/blueprint.d.ts +4 -0
  309. package/dist/types/src/blueprints/research/blueprint.d.ts.map +1 -0
  310. package/dist/types/src/blueprints/research/blueprint.test.d.ts +2 -0
  311. package/dist/types/src/blueprints/research/blueprint.test.d.ts.map +1 -0
  312. package/dist/types/src/blueprints/research/functions/definitions.d.ts +21 -0
  313. package/dist/types/src/blueprints/research/functions/definitions.d.ts.map +1 -0
  314. package/dist/types/src/blueprints/research/functions/document-create.d.ts +12 -0
  315. package/dist/types/src/blueprints/research/functions/document-create.d.ts.map +1 -0
  316. package/dist/types/src/blueprints/research/functions/index.d.ts +4 -0
  317. package/dist/types/src/blueprints/research/functions/index.d.ts.map +1 -0
  318. package/dist/types/src/blueprints/research/functions/research.d.ts +18 -0
  319. package/dist/types/src/blueprints/research/functions/research.d.ts.map +1 -0
  320. package/dist/types/src/blueprints/research/functions/research.test.d.ts.map +1 -0
  321. package/dist/types/src/blueprints/research/index.d.ts +3 -2
  322. package/dist/types/src/blueprints/research/index.d.ts.map +1 -1
  323. package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts +24 -0
  324. package/dist/types/src/blueprints/research/types/ResearchGraph.d.ts.map +1 -0
  325. package/dist/types/src/blueprints/research/types/index.d.ts +7 -0
  326. package/dist/types/src/blueprints/research/types/index.d.ts.map +1 -0
  327. package/dist/types/src/blueprints/testing.d.ts +16 -4
  328. package/dist/types/src/blueprints/testing.d.ts.map +1 -1
  329. package/dist/types/src/blueprints/websearch/blueprint.d.ts +4 -0
  330. package/dist/types/src/blueprints/websearch/blueprint.d.ts.map +1 -0
  331. package/dist/types/src/blueprints/websearch/blueprint.test.d.ts +2 -0
  332. package/dist/types/src/blueprints/websearch/blueprint.test.d.ts.map +1 -0
  333. package/dist/types/src/blueprints/websearch/functions/definitions.d.ts +5 -0
  334. package/dist/types/src/blueprints/websearch/functions/definitions.d.ts.map +1 -0
  335. package/dist/types/src/blueprints/websearch/functions/fetch.d.ts +6 -0
  336. package/dist/types/src/blueprints/websearch/functions/fetch.d.ts.map +1 -0
  337. package/dist/types/src/blueprints/websearch/functions/index.d.ts +4 -0
  338. package/dist/types/src/blueprints/websearch/functions/index.d.ts.map +1 -0
  339. package/dist/types/src/blueprints/websearch/index.d.ts +3 -3
  340. package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -1
  341. package/dist/types/src/blueprints/websearch/{websearch-toolkit.d.ts → toolkit.d.ts} +4 -1
  342. package/dist/types/src/blueprints/websearch/toolkit.d.ts.map +1 -0
  343. package/dist/types/src/{functions/research → crud}/graph.d.ts +14 -11
  344. package/dist/types/src/crud/graph.d.ts.map +1 -0
  345. package/dist/types/src/crud/graph.test.d.ts.map +1 -0
  346. package/dist/types/src/crud/index.d.ts +2 -0
  347. package/dist/types/src/crud/index.d.ts.map +1 -0
  348. package/dist/types/src/functions/agent/definitions.d.ts +101 -0
  349. package/dist/types/src/functions/agent/definitions.d.ts.map +1 -0
  350. package/dist/types/src/functions/agent/index.d.ts +3 -4
  351. package/dist/types/src/functions/agent/index.d.ts.map +1 -1
  352. package/dist/types/src/functions/agent/prompt.d.ts +100 -9
  353. package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
  354. package/dist/types/src/functions/agent/prompt.test.d.ts +2 -0
  355. package/dist/types/src/functions/agent/prompt.test.d.ts.map +1 -0
  356. package/dist/types/src/functions/entity-extraction/definitions.d.ts +182 -0
  357. package/dist/types/src/functions/entity-extraction/definitions.d.ts.map +1 -0
  358. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +2 -171
  359. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
  360. package/dist/types/src/functions/entity-extraction/index.d.ts +3 -173
  361. package/dist/types/src/functions/entity-extraction/index.d.ts.map +1 -1
  362. package/dist/types/src/functions/exa/data/exa-search-1748337321991.d.ts.map +1 -0
  363. package/dist/types/src/functions/exa/data/exa-search-1748337331526.d.ts.map +1 -0
  364. package/dist/types/src/functions/exa/data/exa-search-1748337344119.d.ts.map +1 -0
  365. package/dist/types/src/functions/exa/data/index.d.ts.map +1 -0
  366. package/dist/types/src/functions/exa/definitions.d.ts +9 -0
  367. package/dist/types/src/functions/exa/definitions.d.ts.map +1 -0
  368. package/dist/types/src/functions/exa/exa.d.ts +4 -2
  369. package/dist/types/src/functions/exa/exa.d.ts.map +1 -1
  370. package/dist/types/src/functions/exa/index.d.ts +3 -2
  371. package/dist/types/src/functions/exa/index.d.ts.map +1 -1
  372. package/dist/types/src/functions/exa/mock.d.ts +3 -2
  373. package/dist/types/src/functions/exa/mock.d.ts.map +1 -1
  374. package/dist/types/src/functions/index.d.ts +1 -5
  375. package/dist/types/src/functions/index.d.ts.map +1 -1
  376. package/dist/types/src/index.d.ts +3 -1
  377. package/dist/types/src/index.d.ts.map +1 -1
  378. package/dist/types/src/sync/sync.d.ts +3 -3
  379. package/dist/types/src/sync/sync.d.ts.map +1 -1
  380. package/dist/types/src/testing/index.d.ts +2 -1
  381. package/dist/types/src/testing/index.d.ts.map +1 -1
  382. package/dist/types/src/testing/plugins.d.ts +19 -0
  383. package/dist/types/src/testing/plugins.d.ts.map +1 -0
  384. package/dist/types/src/toolkits/WebToolkit.d.ts +38 -0
  385. package/dist/types/src/toolkits/WebToolkit.d.ts.map +1 -0
  386. package/dist/types/src/toolkits/index.d.ts +2 -0
  387. package/dist/types/src/toolkits/index.d.ts.map +1 -0
  388. package/dist/types/src/types/Chat.d.ts +52 -0
  389. package/dist/types/src/types/Chat.d.ts.map +1 -0
  390. package/dist/types/src/types/Memory.d.ts +12 -0
  391. package/dist/types/src/types/Memory.d.ts.map +1 -0
  392. package/dist/types/src/types/Plan.d.ts +86 -0
  393. package/dist/types/src/types/Plan.d.ts.map +1 -0
  394. package/dist/types/src/types/Project.d.ts +73 -0
  395. package/dist/types/src/types/Project.d.ts.map +1 -0
  396. package/dist/types/src/types/index.d.ts +5 -0
  397. package/dist/types/src/types/index.d.ts.map +1 -0
  398. package/dist/types/tsconfig.tsbuildinfo +1 -1
  399. package/package.json +50 -38
  400. package/src/blueprints/automation/blueprint.ts +109 -0
  401. package/src/blueprints/automation/index.ts +5 -0
  402. package/src/blueprints/blueprint-manager/blueprint.test.ts +130 -0
  403. package/src/blueprints/blueprint-manager/blueprint.ts +49 -0
  404. package/src/blueprints/blueprint-manager/functions/definitions.ts +46 -0
  405. package/src/blueprints/blueprint-manager/functions/enable-blueprints.ts +44 -0
  406. package/src/blueprints/blueprint-manager/functions/index.ts +12 -0
  407. package/src/blueprints/blueprint-manager/functions/query-blueprints.ts +19 -0
  408. package/src/blueprints/blueprint-manager/index.ts +6 -0
  409. package/src/blueprints/browser/blueprint.conversations.json +1 -0
  410. package/src/blueprints/browser/blueprint.test.ts +64 -0
  411. package/src/blueprints/browser/blueprint.ts +41 -0
  412. package/src/blueprints/browser/index.ts +5 -0
  413. package/src/blueprints/database/blueprint.conversations.json +1 -0
  414. package/src/blueprints/database/blueprint.test.ts +343 -0
  415. package/src/blueprints/database/blueprint.ts +67 -0
  416. package/src/blueprints/database/functions/context-add.ts +24 -0
  417. package/src/blueprints/database/functions/context-remove.ts +24 -0
  418. package/src/blueprints/database/functions/definitions.ts +301 -0
  419. package/src/blueprints/database/functions/index.ts +23 -0
  420. package/src/blueprints/database/functions/load.ts +19 -0
  421. package/src/blueprints/database/functions/object-create.ts +38 -0
  422. package/src/blueprints/database/functions/object-delete.ts +20 -0
  423. package/src/blueprints/database/functions/object-update.ts +30 -0
  424. package/src/blueprints/database/functions/query.ts +56 -0
  425. package/src/blueprints/database/functions/relation-create.ts +34 -0
  426. package/src/blueprints/database/functions/relation-delete.ts +21 -0
  427. package/src/blueprints/database/functions/schema-add.ts +28 -0
  428. package/src/blueprints/database/functions/schema-list.ts +27 -0
  429. package/src/blueprints/database/functions/tag-add.ts +21 -0
  430. package/src/blueprints/database/functions/tag-remove.ts +21 -0
  431. package/src/blueprints/database/index.ts +21 -0
  432. package/src/blueprints/design/{design-blueprint.test.ts → blueprint.test.ts} +26 -37
  433. package/src/blueprints/design/{design-blueprint.ts → blueprint.ts} +21 -13
  434. package/src/blueprints/design/index.ts +1 -3
  435. package/src/blueprints/discord/blueprint.ts +42 -0
  436. package/src/blueprints/discord/functions/definitions.ts +71 -0
  437. package/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.ts +11 -14
  438. package/src/blueprints/discord/functions/fetch-messages.ts +199 -0
  439. package/src/blueprints/discord/functions/index.ts +9 -0
  440. package/src/blueprints/discord/index.ts +2 -3
  441. package/src/blueprints/github/functions/definitions.ts +27 -0
  442. package/src/blueprints/github/functions/fetch-prs.ts +24 -0
  443. package/src/blueprints/github/functions/index.ts +9 -0
  444. package/src/blueprints/github/index.ts +5 -0
  445. package/src/blueprints/index.ts +14 -6
  446. package/src/blueprints/linear/blueprint.ts +43 -0
  447. package/src/blueprints/linear/functions/definitions.ts +24 -0
  448. package/src/blueprints/linear/functions/index.ts +9 -0
  449. package/src/blueprints/linear/functions/linear.test.ts +60 -0
  450. package/src/{functions/linear → blueprints/linear/functions}/sync-issues.ts +44 -50
  451. package/src/blueprints/linear/index.ts +2 -3
  452. package/src/blueprints/markdown/blueprint.ts +36 -0
  453. package/src/blueprints/markdown/functions/create.ts +20 -0
  454. package/src/blueprints/markdown/functions/definitions.ts +80 -0
  455. package/src/blueprints/markdown/functions/index.ts +13 -0
  456. package/src/blueprints/markdown/functions/read.ts +22 -0
  457. package/src/blueprints/markdown/functions/update.ts +22 -0
  458. package/src/blueprints/markdown/index.ts +11 -0
  459. package/src/blueprints/memory/blueprint.conversations.json +1 -0
  460. package/src/blueprints/memory/blueprint.test.ts +139 -0
  461. package/src/blueprints/memory/blueprint.ts +42 -0
  462. package/src/blueprints/memory/functions/definitions.ts +68 -0
  463. package/src/blueprints/memory/functions/delete.ts +20 -0
  464. package/src/blueprints/memory/functions/index.ts +13 -0
  465. package/src/blueprints/memory/functions/query.ts +32 -0
  466. package/src/blueprints/memory/functions/save.ts +20 -0
  467. package/src/blueprints/memory/index.ts +6 -0
  468. package/src/blueprints/planning/blueprint.ts +25 -0
  469. package/src/blueprints/planning/functions/definitions.ts +137 -0
  470. package/src/blueprints/planning/functions/index.ts +9 -0
  471. package/src/blueprints/planning/functions/update-tasks.ts +45 -0
  472. package/src/blueprints/planning/index.ts +3 -4
  473. package/src/blueprints/{planning/planning-blueprint.test.ts → planning-old/blueprint.test.ts} +26 -33
  474. package/src/blueprints/{planning/planning-blueprint.ts → planning-old/blueprint.ts} +21 -13
  475. package/src/blueprints/planning-old/functions/definitions.ts +53 -0
  476. package/src/blueprints/planning-old/functions/index.ts +12 -0
  477. package/src/blueprints/planning-old/functions/read.ts +24 -0
  478. package/src/blueprints/planning-old/functions/update.ts +31 -0
  479. package/src/blueprints/planning-old/index.ts +6 -0
  480. package/src/blueprints/project/blueprint.conversations.json +1 -0
  481. package/src/blueprints/project/blueprint.test.ts +587 -0
  482. package/src/blueprints/project/blueprint.ts +65 -0
  483. package/src/blueprints/project/functions/add-artifact.ts +30 -0
  484. package/src/blueprints/project/functions/agent.ts +75 -0
  485. package/src/blueprints/project/functions/definitions.ts +91 -0
  486. package/src/blueprints/project/functions/get-context.ts +46 -0
  487. package/src/blueprints/project/functions/index.ts +14 -0
  488. package/src/blueprints/project/functions/qualifier.ts +90 -0
  489. package/src/blueprints/project/index.ts +7 -0
  490. package/src/blueprints/project/sync-triggers.ts +149 -0
  491. package/src/blueprints/project-wizard/blueprint.ts +43 -0
  492. package/src/blueprints/project-wizard/functions/create-project.ts +33 -0
  493. package/src/blueprints/project-wizard/functions/definitions.ts +48 -0
  494. package/src/blueprints/project-wizard/functions/index.ts +12 -0
  495. package/src/blueprints/project-wizard/functions/project-rules.ts +76 -0
  496. package/src/blueprints/project-wizard/index.ts +6 -0
  497. package/src/blueprints/research/blueprint.ts +61 -0
  498. package/src/blueprints/research/functions/definitions.ts +87 -0
  499. package/src/blueprints/research/functions/document-create.ts +50 -0
  500. package/src/blueprints/research/functions/index.ts +12 -0
  501. package/src/{functions/research/instructions-research.tpl → blueprints/research/functions/research-instructions.tpl} +19 -11
  502. package/src/blueprints/research/functions/research.conversations.json +1 -0
  503. package/src/blueprints/research/functions/research.test.ts +152 -0
  504. package/src/blueprints/research/functions/research.ts +138 -0
  505. package/src/blueprints/research/index.ts +3 -3
  506. package/src/blueprints/research/types/ResearchGraph.ts +62 -0
  507. package/src/blueprints/research/types/index.ts +32 -0
  508. package/src/blueprints/testing.ts +34 -5
  509. package/src/blueprints/websearch/blueprint.conversations.json +1 -0
  510. package/src/blueprints/websearch/blueprint.test.ts +39 -0
  511. package/src/blueprints/websearch/blueprint.ts +31 -0
  512. package/src/blueprints/websearch/functions/definitions.ts +25 -0
  513. package/src/blueprints/websearch/functions/fetch.ts +18 -0
  514. package/src/blueprints/websearch/functions/index.ts +9 -0
  515. package/src/blueprints/websearch/index.ts +3 -4
  516. package/src/blueprints/websearch/{websearch-toolkit.ts → toolkit.ts} +4 -0
  517. package/src/crud/graph.test.ts +46 -0
  518. package/src/{functions/research → crud}/graph.ts +32 -40
  519. package/src/crud/index.ts +5 -0
  520. package/src/functions/READ_THIS.md +5 -0
  521. package/src/functions/agent/definitions.ts +53 -0
  522. package/src/functions/agent/index.ts +3 -5
  523. package/src/functions/agent/prompt.test.ts +144 -0
  524. package/src/functions/agent/prompt.ts +120 -85
  525. package/src/functions/entity-extraction/definitions.ts +44 -0
  526. package/src/functions/entity-extraction/entity-extraction.conversations.json +1 -1
  527. package/src/functions/entity-extraction/entity-extraction.test.ts +19 -43
  528. package/src/functions/entity-extraction/entity-extraction.ts +84 -88
  529. package/src/functions/entity-extraction/index.ts +4 -4
  530. package/src/functions/exa/definitions.ts +37 -0
  531. package/src/functions/exa/exa.ts +22 -27
  532. package/src/functions/exa/index.ts +8 -2
  533. package/src/functions/exa/mock.ts +26 -35
  534. package/src/functions/index.ts +1 -5
  535. package/src/index.ts +3 -1
  536. package/src/sync/sync.ts +38 -30
  537. package/src/testing/index.ts +2 -1
  538. package/src/testing/plugins.tsx +77 -0
  539. package/src/toolkits/WebToolkit.ts +33 -0
  540. package/src/toolkits/index.ts +5 -0
  541. package/src/types/Chat.ts +62 -0
  542. package/src/types/Memory.ts +23 -0
  543. package/src/types/Plan.ts +110 -0
  544. package/src/types/Project.ts +208 -0
  545. package/src/types/index.ts +8 -0
  546. package/dist/lib/browser/index.mjs.map +0 -7
  547. package/dist/lib/browser/meta.json +0 -1
  548. package/dist/lib/node-esm/index.mjs +0 -2483
  549. package/dist/lib/node-esm/index.mjs.map +0 -7
  550. package/dist/lib/node-esm/meta.json +0 -1
  551. package/dist/types/src/blueprints/design/design-blueprint.d.ts +0 -4
  552. package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +0 -1
  553. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts +0 -2
  554. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts.map +0 -1
  555. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +0 -18
  556. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +0 -1
  557. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +0 -18
  558. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +0 -1
  559. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +0 -4
  560. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +0 -1
  561. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts +0 -2
  562. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts.map +0 -1
  563. package/dist/types/src/blueprints/research/research-blueprint.d.ts +0 -4
  564. package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +0 -1
  565. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts +0 -2
  566. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts.map +0 -1
  567. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +0 -4
  568. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +0 -1
  569. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts.map +0 -1
  570. package/dist/types/src/experimental/feed.test.d.ts +0 -2
  571. package/dist/types/src/experimental/feed.test.d.ts.map +0 -1
  572. package/dist/types/src/functions/discord/fetch-messages.d.ts.map +0 -1
  573. package/dist/types/src/functions/discord/fetch-messages.test.d.ts.map +0 -1
  574. package/dist/types/src/functions/discord/index.d.ts +0 -12
  575. package/dist/types/src/functions/discord/index.d.ts.map +0 -1
  576. package/dist/types/src/functions/document/index.d.ts +0 -12
  577. package/dist/types/src/functions/document/index.d.ts.map +0 -1
  578. package/dist/types/src/functions/document/read.d.ts +0 -7
  579. package/dist/types/src/functions/document/read.d.ts.map +0 -1
  580. package/dist/types/src/functions/document/update.d.ts +0 -6
  581. package/dist/types/src/functions/document/update.d.ts.map +0 -1
  582. package/dist/types/src/functions/github/fetch-prs.d.ts +0 -6
  583. package/dist/types/src/functions/github/fetch-prs.d.ts.map +0 -1
  584. package/dist/types/src/functions/linear/index.d.ts +0 -9
  585. package/dist/types/src/functions/linear/index.d.ts.map +0 -1
  586. package/dist/types/src/functions/linear/linear.test.d.ts.map +0 -1
  587. package/dist/types/src/functions/linear/sync-issues.d.ts +0 -12
  588. package/dist/types/src/functions/linear/sync-issues.d.ts.map +0 -1
  589. package/dist/types/src/functions/research/create-document.d.ts +0 -7
  590. package/dist/types/src/functions/research/create-document.d.ts.map +0 -1
  591. package/dist/types/src/functions/research/graph.d.ts.map +0 -1
  592. package/dist/types/src/functions/research/graph.test.d.ts.map +0 -1
  593. package/dist/types/src/functions/research/index.d.ts +0 -19
  594. package/dist/types/src/functions/research/index.d.ts.map +0 -1
  595. package/dist/types/src/functions/research/research-graph.d.ts +0 -18
  596. package/dist/types/src/functions/research/research-graph.d.ts.map +0 -1
  597. package/dist/types/src/functions/research/research.d.ts +0 -13
  598. package/dist/types/src/functions/research/research.d.ts.map +0 -1
  599. package/dist/types/src/functions/research/research.test.d.ts.map +0 -1
  600. package/dist/types/src/functions/research/types.d.ts +0 -384
  601. package/dist/types/src/functions/research/types.d.ts.map +0 -1
  602. package/dist/types/src/functions/tasks/index.d.ts +0 -15
  603. package/dist/types/src/functions/tasks/index.d.ts.map +0 -1
  604. package/dist/types/src/functions/tasks/read.d.ts +0 -7
  605. package/dist/types/src/functions/tasks/read.d.ts.map +0 -1
  606. package/dist/types/src/functions/tasks/task-list.d.ts.map +0 -1
  607. package/dist/types/src/functions/tasks/task-list.test.d.ts.map +0 -1
  608. package/dist/types/src/functions/tasks/update.d.ts +0 -9
  609. package/dist/types/src/functions/tasks/update.d.ts.map +0 -1
  610. package/dist/types/src/plugins.d.ts +0 -19
  611. package/dist/types/src/plugins.d.ts.map +0 -1
  612. package/dist/types/src/testing/data/exa-search-1748337321991.d.ts.map +0 -1
  613. package/dist/types/src/testing/data/exa-search-1748337331526.d.ts.map +0 -1
  614. package/dist/types/src/testing/data/exa-search-1748337344119.d.ts.map +0 -1
  615. package/dist/types/src/testing/data/index.d.ts.map +0 -1
  616. package/src/blueprints/discord/discord-blueprint.ts +0 -34
  617. package/src/blueprints/linear/linear-blueprint.ts +0 -35
  618. package/src/blueprints/research/research-blueprint.ts +0 -45
  619. package/src/blueprints/websearch/websearch-blueprint.ts +0 -20
  620. package/src/experimental/feed.test.ts +0 -108
  621. package/src/functions/discord/fetch-messages.ts +0 -251
  622. package/src/functions/discord/index.ts +0 -9
  623. package/src/functions/document/index.ts +0 -11
  624. package/src/functions/document/read.ts +0 -29
  625. package/src/functions/document/update.ts +0 -30
  626. package/src/functions/github/fetch-prs.ts +0 -30
  627. package/src/functions/linear/index.ts +0 -9
  628. package/src/functions/linear/linear.test.ts +0 -86
  629. package/src/functions/research/create-document.ts +0 -69
  630. package/src/functions/research/graph.test.ts +0 -69
  631. package/src/functions/research/index.ts +0 -15
  632. package/src/functions/research/research-graph.ts +0 -47
  633. package/src/functions/research/research.conversations.json +0 -10714
  634. package/src/functions/research/research.test.ts +0 -240
  635. package/src/functions/research/research.ts +0 -155
  636. package/src/functions/research/types.ts +0 -24
  637. package/src/functions/tasks/index.ts +0 -11
  638. package/src/functions/tasks/read.ts +0 -34
  639. package/src/functions/tasks/update.ts +0 -52
  640. package/src/plugins.tsx +0 -68
  641. /package/dist/types/src/{functions/discord → blueprints/discord/functions}/fetch-messages.test.d.ts +0 -0
  642. /package/dist/types/src/{functions/linear → blueprints/linear/functions}/linear.test.d.ts +0 -0
  643. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.d.ts +0 -0
  644. /package/dist/types/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.d.ts +0 -0
  645. /package/dist/types/src/{functions/research → blueprints/research/functions}/research.test.d.ts +0 -0
  646. /package/dist/types/src/{functions/research → crud}/graph.test.d.ts +0 -0
  647. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337321991.d.ts +0 -0
  648. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337331526.d.ts +0 -0
  649. /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337344119.d.ts +0 -0
  650. /package/dist/types/src/{testing → functions/exa}/data/index.d.ts +0 -0
  651. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.test.ts +0 -0
  652. /package/src/{functions/tasks → blueprints/planning-old/functions}/task-list.ts +0 -0
  653. /package/src/blueprints/research/{research-blueprint.test.ts → blueprint.test.ts} +0 -0
  654. /package/src/{testing → functions/exa}/data/exa-search-1748337321991.ts +0 -0
  655. /package/src/{testing → functions/exa}/data/exa-search-1748337331526.ts +0 -0
  656. /package/src/{testing → functions/exa}/data/exa-search-1748337344119.ts +0 -0
  657. /package/src/{testing → functions/exa}/data/index.ts +0 -0
@@ -1,528 +1,13 @@
1
- // src/blueprints/design/design-blueprint.ts
2
- import { ToolId } from "@dxos/ai";
3
- import { Blueprint } from "@dxos/blueprints";
4
- import { Obj as Obj9, Ref as Ref6 } from "@dxos/echo";
5
- import { DataType as DataType7 } from "@dxos/schema";
6
- import { trim as trim5 } from "@dxos/util";
7
-
8
- // src/functions/agent/prompt.ts
9
- import * as Array2 from "effect/Array";
10
- import * as Effect from "effect/Effect";
11
- import * as Function from "effect/Function";
12
- import * as Option from "effect/Option";
13
- import * as Schema from "effect/Schema";
14
- import { AiService, ConsolePrinter, ModelName } from "@dxos/ai";
15
- import { AiSession, GenerationObserver, createToolkit } from "@dxos/assistant";
16
- import { Prompt, Template } from "@dxos/blueprints";
17
- import { Obj, Ref, Type } from "@dxos/echo";
18
- import { DatabaseService, TracingService, defineFunction } from "@dxos/functions";
19
- import { log } from "@dxos/log";
20
- var __dxlog_file = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/agent/prompt.ts";
21
- var DEFAULT_MODEL = "@anthropic/claude-opus-4-0";
22
- var prompt_default = defineFunction({
23
- key: "dxos.org/function/prompt",
24
- name: "Agent",
25
- description: "Agentic worker that executes a provided prompt using blueprints and tools.",
26
- inputSchema: Schema.Struct({
27
- prompt: Type.Ref(Prompt.Prompt),
28
- systemPrompt: Type.Ref(Prompt.Prompt).pipe(Schema.optional),
29
- /**
30
- * @default @anthropic/claude-opus-4-0
31
- */
32
- model: Schema.optional(ModelName),
33
- /**
34
- * Input object or data.
35
- * References get auto-resolved.
36
- */
37
- input: Schema.Record({
38
- key: Schema.String,
39
- value: Schema.Any
40
- })
41
- }),
42
- outputSchema: Schema.Any,
43
- handler: Effect.fnUntraced(function* ({ data }) {
44
- log.info("processing input", {
45
- input: data.input
46
- }, {
47
- F: __dxlog_file,
48
- L: 39,
49
- S: this,
50
- C: (f, a) => f(...a)
51
- });
52
- const input = {
53
- ...data.input
54
- };
55
- for (const key of Object.keys(data.input)) {
56
- const value = data.input[key];
57
- if (Ref.isRef(value)) {
58
- const object = yield* DatabaseService.load(value);
59
- input[key] = Obj.toJSON(object);
60
- } else {
61
- input[key] = JSON.stringify(value);
62
- }
63
- }
64
- yield* DatabaseService.flush({
65
- indexes: true
66
- });
67
- const prompt = yield* DatabaseService.load(data.prompt);
68
- const systemPrompt = data.systemPrompt ? yield* DatabaseService.load(data.systemPrompt) : void 0;
69
- yield* TracingService.emitStatus({
70
- message: `Running ${prompt.id}`
71
- });
72
- log.info("starting agent", {
73
- prompt: prompt.id,
74
- input: data.input
75
- }, {
76
- F: __dxlog_file,
77
- L: 57,
78
- S: this,
79
- C: (f, a) => f(...a)
80
- });
81
- 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)));
82
- 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)));
83
- const toolkit = yield* createToolkit({
84
- blueprints
85
- });
86
- const promptInstructions = yield* DatabaseService.load(prompt.instructions.source);
87
- const promptText = Template.process(promptInstructions.content, input);
88
- const systemInstructions = systemPrompt ? yield* DatabaseService.load(systemPrompt.instructions.source) : void 0;
89
- const systemText = systemInstructions ? Template.process(systemInstructions.content, {}) : void 0;
90
- const session = new AiSession();
91
- const result = yield* session.run({
92
- prompt: promptText,
93
- system: systemText,
94
- blueprints,
95
- objects,
96
- toolkit,
97
- observer: GenerationObserver.fromPrinter(new ConsolePrinter({
98
- tag: "agent"
99
- }))
100
- }).pipe(Effect.provide(AiService.model(data.model ?? DEFAULT_MODEL)));
101
- const lastBlock = result.at(-1)?.blocks.filter((block) => block._tag === "text").at(-1);
102
- return {
103
- note: lastBlock?.text
104
- };
105
- })
106
- });
107
-
108
- // src/functions/agent/index.ts
109
- (function(Agent2) {
110
- Agent2.prompt = prompt_default;
111
- })(Agent || (Agent = {}));
112
- var Agent;
113
-
114
- // src/functions/discord/fetch-messages.ts
115
- import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
116
- import { DiscordConfig, DiscordREST, DiscordRESTMemoryLive } from "dfx";
117
- import * as Array3 from "effect/Array";
118
- import * as Effect2 from "effect/Effect";
119
- import * as Function2 from "effect/Function";
120
- import * as Layer from "effect/Layer";
121
- import * as Option2 from "effect/Option";
122
- import * as Schema2 from "effect/Schema";
123
- import { Obj as Obj2 } from "@dxos/echo";
124
- import { CredentialsService, TracingService as TracingService2, defineFunction as defineFunction2 } from "@dxos/functions";
125
- import { log as log2 } from "@dxos/log";
126
- import { DataType } from "@dxos/schema";
127
- var __dxlog_file2 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/discord/fetch-messages.ts";
128
- var TimeRange = class extends Schema2.String.pipe(Schema2.pattern(/\d+(s|m|h|d)/)).annotations({
129
- description: "Time range. 1d - 1 day, 2h - 2 hours, 30m - 30 minutes, 15s - 15 seconds.",
130
- examples: [
131
- "1d",
132
- "2h",
133
- "30m",
134
- "15s"
135
- ]
136
- }) {
137
- static toSeconds(timeRange) {
138
- const match = timeRange.match(/(\d+)(s|m|h|d)/);
139
- if (!match) {
140
- throw new Error(`Invalid time range: ${timeRange}`);
141
- }
142
- const [_, amount, unit] = match;
143
- switch (unit) {
144
- case "s":
145
- return Number(amount);
146
- case "m":
147
- return Number(amount) * 60;
148
- case "h":
149
- return Number(amount) * 60 * 60;
150
- case "d":
151
- return Number(amount) * 24 * 60 * 60;
152
- default:
153
- throw new Error(`Invalid time range unit: ${unit}`);
154
- }
155
- }
156
- };
157
- var DiscordConfigFromCredential = Layer.unwrapEffect(Effect2.gen(function* () {
158
- return DiscordConfig.layer({
159
- token: yield* CredentialsService.getApiKey({
160
- service: "discord.com"
161
- }),
162
- rest: {
163
- baseUrl: "https://api-proxy.dxos.workers.dev/discord.com/api/v10"
164
- }
165
- });
166
- }));
167
- var DEFAULT_AFTER = 1704067200;
168
- var DEFAULT_LIMIT = 500;
169
- var DEFAULT_IGNORE_USERNAMES = [
170
- "GitHub",
171
- "Needle"
172
- ];
173
- var fetch_messages_default = defineFunction2({
174
- key: "dxos.org/function/fetch-discord-messages",
175
- name: "Sync Discord messages",
176
- inputSchema: Schema2.Struct({
177
- serverId: Schema2.String.annotations({
178
- description: "The ID of the server to fetch messages from."
179
- }),
180
- channelId: Schema2.optional(Schema2.String).annotations({
181
- description: "The ID of the channel to fetch messages from. Will crawl all channels from the server if not specified."
182
- }),
183
- after: Schema2.optional(Schema2.Number).annotations({
184
- description: "Fetch messages that were sent after a given date. Unix timestamp in seconds. Exclusive with `last`."
185
- }),
186
- last: TimeRange.annotations({
187
- 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.'
188
- }),
189
- limit: Schema2.optional(Schema2.Number).annotations({
190
- description: "The maximum number of messages to fetch."
191
- }),
192
- pageSize: Schema2.optional(Schema2.Number).annotations({
193
- description: "The number of messages to fetch per page."
194
- }),
195
- ignoreUsernames: Schema2.optional(Schema2.Array(Schema2.String)).annotations({
196
- description: "Exclude messages from these usernames."
197
- })
198
- }),
199
- handler: Effect2.fnUntraced(function* ({ data: { serverId, channelId, after, last, pageSize = 100, limit = DEFAULT_LIMIT, ignoreUsernames = DEFAULT_IGNORE_USERNAMES } }) {
200
- if (!after && !last) {
201
- throw new Error("cannot specify both `after` and `last`");
202
- }
203
- const afterTs = last ? Date.now() / 1e3 - TimeRange.toSeconds(last) : after ?? DEFAULT_AFTER;
204
- const rest = yield* DiscordREST;
205
- let channels = [];
206
- channels.push(...yield* rest.listGuildChannels(serverId));
207
- const { threads: guildThreads } = yield* rest.getActiveGuildThreads(serverId);
208
- channels.push(...guildThreads);
209
- if (channelId) {
210
- channels = channels.filter((channel) => channel.id === channelId);
211
- }
212
- if (channels.length === 0) {
213
- throw new Error("no channels found");
214
- }
215
- for (const channel of channels) {
216
- console.log(channel.id, "name" in channel ? channel.name : void 0);
217
- }
218
- yield* TracingService2.emitStatus({
219
- message: `Will fetch from channels: ${channels.length}`
220
- });
221
- const threads = yield* Effect2.forEach(channels, Effect2.fnUntraced(function* (channel) {
222
- const allMessages = [];
223
- let lastMessage = Option2.none();
224
- while (true) {
225
- const { id: lastId = void 0 } = Function2.pipe(lastMessage, Option2.map(Obj2.getKeys("discord.com")), Option2.flatMap(Option2.fromIterable), Option2.getOrElse(() => ({
226
- id: void 0
227
- })));
228
- const options = {
229
- after: !lastId ? `${generateSnowflake(afterTs)}` : lastId,
230
- limit: pageSize
231
- };
232
- log2.info("fetching messages", {
233
- lastId,
234
- afterTs,
235
- afterSnowflake: options.after,
236
- after: parseSnowflake(options.after),
237
- limit: options.limit
238
- }, {
239
- F: __dxlog_file2,
240
- L: 159,
241
- S: this,
242
- C: (f, a) => f(...a)
243
- });
244
- 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)));
245
- if (messages.length > 0) {
246
- lastMessage = Option2.fromNullable(messages.at(-1));
247
- allMessages.push(...messages);
248
- } else {
249
- break;
250
- }
251
- yield* TracingService2.emitStatus({
252
- message: `Fetched messages: ${allMessages.length}`
253
- });
254
- if (allMessages.length >= limit) {
255
- break;
256
- }
257
- }
258
- return {
259
- discordChannelId: channel.id,
260
- name: "name" in channel ? channel.name ?? void 0 : void 0,
261
- 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))
262
- };
263
- }), {
264
- concurrency: 10
265
- });
266
- return threads.filter((thread) => thread.messages.length > 0).map(serializeThread).join("\n");
267
- }, Effect2.provide(DiscordRESTMemoryLive.pipe(Layer.provideMerge(DiscordConfigFromCredential)).pipe(Layer.provide(FetchHttpClient.layer))), Effect2.orDie)
268
- });
269
- var generateSnowflake = (unixTimestamp) => {
270
- const discordEpoch = 1420070400000n;
271
- return BigInt(unixTimestamp * 1e3) - discordEpoch << 22n;
272
- };
273
- var parseSnowflake = (snowflake) => {
274
- const discordEpoch = 1420070400000n;
275
- return new Date(Number((BigInt(snowflake) >> 22n) + discordEpoch));
276
- };
277
- var makeMessage = (message) => Obj2.make(DataType.Message, {
278
- [Obj2.Meta]: {
279
- keys: [
280
- {
281
- id: message.id,
282
- source: "discord.com"
283
- },
284
- {
285
- id: message.channel_id,
286
- source: "discord.com/thread"
287
- }
288
- ]
289
- },
290
- sender: {
291
- name: message.author.username
292
- },
293
- created: message.timestamp,
294
- blocks: [
295
- {
296
- _tag: "text",
297
- text: message.content
298
- }
299
- ]
300
- });
301
- var serializeThread = (thread) => {
302
- return `<thread id=${thread.discordChannelId} name=${thread.name ?? ""}>
303
- ${thread.messages.map((message) => ` ${message.sender.name}: ${message.blocks.filter((block) => block._tag === "text").map((block) => block.text).join(" ")}`).join("\n")}
304
- </thread>`;
305
- };
306
-
307
- // src/functions/discord/index.ts
308
- (function(Discord2) {
309
- Discord2.fetch = fetch_messages_default;
310
- })(Discord || (Discord = {}));
311
- var Discord;
312
-
313
- // src/functions/document/read.ts
314
- import * as Effect3 from "effect/Effect";
315
- import * as Schema3 from "effect/Schema";
316
- import { ArtifactId } from "@dxos/assistant";
317
- import { DatabaseService as DatabaseService2, defineFunction as defineFunction3 } from "@dxos/functions";
318
- import { Markdown } from "@dxos/plugin-markdown/types";
319
- var read_default = defineFunction3({
320
- key: "dxos.org/function/markdown/read",
321
- name: "Read markdown document",
322
- description: "Read markdown document.",
323
- inputSchema: Schema3.Struct({
324
- id: ArtifactId.annotations({
325
- description: "The ID of the document to read."
326
- })
327
- }),
328
- outputSchema: Schema3.Struct({
329
- content: Schema3.String
330
- }),
331
- handler: Effect3.fn(function* ({ data: { id } }) {
332
- const doc = yield* DatabaseService2.resolve(ArtifactId.toDXN(id), Markdown.Document);
333
- const { content } = yield* DatabaseService2.load(doc.content);
334
- return {
335
- content
336
- };
337
- })
338
- });
339
-
340
- // src/functions/document/update.ts
341
- import * as Effect4 from "effect/Effect";
342
- import * as Schema4 from "effect/Schema";
343
- import { ArtifactId as ArtifactId2 } from "@dxos/assistant";
344
- import { DatabaseService as DatabaseService3, defineFunction as defineFunction4 } from "@dxos/functions";
345
- import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
346
- var update_default = defineFunction4({
347
- key: "dxos.org/function/markdown/update",
348
- name: "Update markdown",
349
- description: "Updates the entire contents of the markdown document.",
350
- inputSchema: Schema4.Struct({
351
- id: ArtifactId2.annotations({
352
- description: "The ID of the document to write."
353
- }),
354
- content: Schema4.String.annotations({
355
- description: "New content to write to the document."
356
- })
357
- }),
358
- outputSchema: Schema4.Void,
359
- handler: Effect4.fn(function* ({ data: { id, content } }) {
360
- const doc = yield* DatabaseService3.resolve(ArtifactId2.toDXN(id), Markdown2.Document);
361
- const text = yield* DatabaseService3.load(doc.content);
362
- text.content = content;
363
- })
364
- });
365
-
366
- // src/functions/document/index.ts
367
- (function(Document2) {
368
- Document2.read = read_default;
369
- Document2.update = update_default;
370
- })(Document || (Document = {}));
371
- var Document;
372
-
373
- // src/functions/entity-extraction/entity-extraction.ts
374
- import * as Toolkit3 from "@effect/ai/Toolkit";
375
- import * as Effect11 from "effect/Effect";
376
- import * as Layer4 from "effect/Layer";
377
- import * as Predicate from "effect/Predicate";
378
- import * as Schema11 from "effect/Schema";
379
- import { AiService as AiService3 } from "@dxos/ai";
380
- import { AiSession as AiSession3, makeToolExecutionServiceFromFunctions as makeToolExecutionServiceFromFunctions2, makeToolResolverFromFunctions as makeToolResolverFromFunctions2 } from "@dxos/assistant";
381
- import { Filter as Filter2, Obj as Obj6, Ref as Ref3 } from "@dxos/echo";
382
- import { DatabaseService as DatabaseService8, FunctionInvocationService as FunctionInvocationService2, defineFunction as defineFunction9 } from "@dxos/functions";
383
- import { log as log5 } from "@dxos/log";
384
- import { DataType as DataType5 } from "@dxos/schema";
385
- import { trim as trim4 } from "@dxos/util";
386
-
387
- // src/functions/research/create-document.ts
388
- import * as Effect5 from "effect/Effect";
389
- import * as Schema5 from "effect/Schema";
390
- import { Relation } from "@dxos/echo";
391
- import { DatabaseService as DatabaseService4, TracingService as TracingService3, defineFunction as defineFunction5 } from "@dxos/functions";
392
- import { invariant } from "@dxos/invariant";
393
- import { DXN, ObjectId } from "@dxos/keys";
394
- import { log as log3 } from "@dxos/log";
395
- import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
396
- import { DataType as DataType2 } from "@dxos/schema";
397
- import { trim } from "@dxos/util";
398
- var __dxlog_file3 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/research/create-document.ts";
399
- var create_document_default = defineFunction5({
400
- key: "dxos.org/function/research/create-document",
401
- name: "Create research document",
402
- description: "Creates a note summarizing the research.",
403
- inputSchema: Schema5.Struct({
404
- name: Schema5.String.annotations({
405
- description: "Name of the note."
406
- }),
407
- content: Schema5.String.annotations({
408
- description: trim`
409
- Content of the note.
410
- Supports (and are prefered) references to research objects using @ syntax and <object> tags (refer to research blueprint instructions).
411
- `
412
- }),
413
- // TODO(dmaretskyi): Use a specialized type for this (e.g., ArtifactId renamed as RefFromLLM).
414
- target: Schema5.String.annotations({
415
- description: trim`
416
- Id of the object (organization, contact, etc.) for which the research was performed.
417
- This must be a ulid.
418
- `
419
- })
420
- }),
421
- outputSchema: Schema5.Struct({}),
422
- handler: Effect5.fnUntraced(function* ({ data: { target, name, content } }) {
423
- log3.info("Creating research document", {
424
- target,
425
- name,
426
- content
427
- }, {
428
- F: __dxlog_file3,
429
- L: 43,
430
- S: this,
431
- C: (f, a) => f(...a)
432
- });
433
- yield* DatabaseService4.flush({
434
- indexes: true
435
- });
436
- yield* TracingService3.emitStatus({
437
- message: "Creating research document..."
438
- });
439
- invariant(ObjectId.isValid(target), void 0, {
440
- F: __dxlog_file3,
441
- L: 47,
442
- S: this,
443
- A: [
444
- "ObjectId.isValid(target)",
445
- ""
446
- ]
447
- });
448
- const targetObj = yield* DatabaseService4.resolve(DXN.fromLocalObjectId(target));
449
- const doc = yield* DatabaseService4.add(Markdown3.makeDocument({
450
- name,
451
- content
452
- }));
453
- yield* DatabaseService4.add(Relation.make(DataType2.HasSubject, {
454
- [Relation.Source]: doc,
455
- [Relation.Target]: targetObj,
456
- completedAt: (/* @__PURE__ */ new Date()).toISOString()
457
- }));
458
- yield* DatabaseService4.flush({
459
- indexes: true
460
- });
461
- log3.info("Created research document", {
462
- target,
463
- name,
464
- content
465
- }, {
466
- F: __dxlog_file3,
467
- L: 66,
468
- S: this,
469
- C: (f, a) => f(...a)
470
- });
471
- return {};
472
- })
473
- });
474
-
475
- // src/functions/research/research.ts
476
- import * as Toolkit2 from "@effect/ai/Toolkit";
477
- import * as AnthropicTool from "@effect/ai-anthropic/AnthropicTool";
478
- import * as Array6 from "effect/Array";
479
- import * as Effect10 from "effect/Effect";
480
- import * as Layer3 from "effect/Layer";
481
- import * as Schema10 from "effect/Schema";
482
- import { AiService as AiService2, ConsolePrinter as ConsolePrinter2 } from "@dxos/ai";
483
- import { AiSession as AiSession2, GenerationObserver as GenerationObserver2, createToolkit as createToolkit2, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from "@dxos/assistant";
484
- import { Obj as Obj5 } from "@dxos/echo";
485
- import { DatabaseService as DatabaseService7, FunctionInvocationService, TracingService as TracingService4, defineFunction as defineFunction8 } from "@dxos/functions";
486
- import { DataType as DataType4 } from "@dxos/schema";
487
- import { trim as trim3 } from "@dxos/util";
488
-
489
- // src/functions/exa/exa.ts
490
- import * as Effect6 from "effect/Effect";
491
- import * as Schema6 from "effect/Schema";
492
- import Exa from "exa-js";
493
- import { CredentialsService as CredentialsService2, defineFunction as defineFunction6 } from "@dxos/functions";
494
- var exa_default = defineFunction6({
495
- key: "dxos.org/function/exa",
496
- name: "Exa",
497
- description: "Search the web for information",
498
- inputSchema: Schema6.Struct({
499
- query: Schema6.String.annotations({
500
- description: "The query to search for."
501
- })
502
- }),
503
- outputSchema: Schema6.Unknown,
504
- handler: Effect6.fnUntraced(function* ({ data: { query } }) {
505
- const credential = yield* CredentialsService2.getCredential({
506
- service: "exa.ai"
507
- });
508
- const exa = new Exa(credential.apiKey);
509
- const context = yield* Effect6.promise(async () => exa.searchAndContents(query, {
510
- type: "auto",
511
- text: {
512
- maxCharacters: 3e3
513
- },
514
- livecrawl: "always"
515
- }));
516
- return context;
517
- })
518
- });
1
+ import {
2
+ ExaMock
3
+ } from "./chunk-VDEDVOS6.mjs";
4
+ import "./chunk-J5LGTIGS.mjs";
519
5
 
520
6
  // src/functions/exa/mock.ts
521
- import * as Effect7 from "effect/Effect";
522
- import * as Schema7 from "effect/Schema";
523
- import { defineFunction as defineFunction7 } from "@dxos/functions";
7
+ import * as Effect from "effect/Effect";
8
+ import { Operation } from "@dxos/operation";
524
9
 
525
- // src/testing/data/exa-search-1748337321991.ts
10
+ // src/functions/exa/data/exa-search-1748337321991.ts
526
11
  var exa_search_1748337321991_default = {
527
12
  requestId: "324936368a74f4db978982172bc18a6c",
528
13
  autopromptString: "AI personal knowledge management tools projects 2024",
@@ -678,7 +163,7 @@ var exa_search_1748337321991_default = {
678
163
  }
679
164
  };
680
165
 
681
- // src/testing/data/exa-search-1748337331526.ts
166
+ // src/functions/exa/data/exa-search-1748337331526.ts
682
167
  var exa_search_1748337331526_default = {
683
168
  requestId: "0dc12e344fa649884456960ca1a54954",
684
169
  autopromptString: "PKM software artificial intelligence integration open source projects",
@@ -901,7 +386,7 @@ npm run tauri dev
901
386
  }
902
387
  };
903
388
 
904
- // src/testing/data/exa-search-1748337344119.ts
389
+ // src/functions/exa/data/exa-search-1748337344119.ts
905
390
  var exa_search_1748337344119_default = {
906
391
  requestId: "32df0c541f9883180b35e04caece4374",
907
392
  autopromptString: "open source AI knowledge management projects features comparison 2024",
@@ -1024,7 +509,7 @@ var exa_search_1748337344119_default = {
1024
509
  }
1025
510
  };
1026
511
 
1027
- // src/testing/data/index.ts
512
+ // src/functions/exa/data/index.ts
1028
513
  var SEARCH_RESULTS = [
1029
514
  exa_search_1748337321991_default,
1030
515
  exa_search_1748337331526_default,
@@ -1032,33 +517,22 @@ var SEARCH_RESULTS = [
1032
517
  ];
1033
518
 
1034
519
  // src/functions/exa/mock.ts
1035
- var mock_default = defineFunction7({
1036
- key: "dxos.org/function/exa-mock",
1037
- name: "Exa mock",
1038
- description: "Search the web for information",
1039
- inputSchema: Schema7.Struct({
1040
- query: Schema7.String.annotations({
1041
- description: "The query to search for."
1042
- })
1043
- }),
1044
- outputSchema: Schema7.Unknown,
1045
- handler: Effect7.fnUntraced(function* ({ data: { query } }) {
1046
- const result = SEARCH_RESULTS.reduce((closest, current) => {
1047
- if (!current.autopromptString) {
1048
- return closest;
1049
- }
1050
- if (!closest) {
1051
- return current;
1052
- }
1053
- const dist1 = levenshteinDistance(query, current.autopromptString);
1054
- const dist2 = levenshteinDistance(query, closest.autopromptString || "");
1055
- const weight1 = dist1 / Math.max(query.length, current.autopromptString.length);
1056
- const weight2 = dist2 / Math.max(query.length, closest.autopromptString?.length || 0);
1057
- return weight1 < weight2 ? current : closest;
1058
- }, null);
1059
- return result;
1060
- })
1061
- });
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
+ })));
1062
536
  var levenshteinDistance = (str1, str2) => {
1063
537
  const m = str1.length;
1064
538
  const n = str2.length;
@@ -1076,1406 +550,7 @@ var levenshteinDistance = (str1, str2) => {
1076
550
  }
1077
551
  return dp[m][n];
1078
552
  };
1079
-
1080
- // src/functions/research/graph.ts
1081
- import * as Tool from "@effect/ai/Tool";
1082
- import * as Toolkit from "@effect/ai/Toolkit";
1083
- import * as Context from "effect/Context";
1084
- import * as Effect8 from "effect/Effect";
1085
- import * as Function3 from "effect/Function";
1086
- import * as Option3 from "effect/Option";
1087
- import * as Schema8 from "effect/Schema";
1088
- import * as SchemaAST from "effect/SchemaAST";
1089
- import { Obj as Obj3 } from "@dxos/echo";
1090
- import { Filter, Query } from "@dxos/echo";
1091
- import { EntityKind, ObjectId as ObjectId2, ReferenceAnnotationId, RelationSourceDXNId, RelationSourceId, RelationTargetDXNId, RelationTargetId, create, getEntityKind, getSchemaDXN, getSchemaTypename, getTypeAnnotation, getTypeIdentifierAnnotation } from "@dxos/echo/internal";
1092
- import { isEncodedReference } from "@dxos/echo-protocol";
1093
- import { mapAst } from "@dxos/effect";
1094
- import { ContextQueueService, DatabaseService as DatabaseService5 } from "@dxos/functions";
1095
- import { DXN as DXN2 } from "@dxos/keys";
1096
- import { log as log4 } from "@dxos/log";
1097
- import { deepMapValues, isNonNullable, trim as trim2 } from "@dxos/util";
1098
- var __dxlog_file4 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/research/graph.ts";
1099
- var Subgraph = Schema8.Struct({
1100
- /** Objects and relations. */
1101
- objects: Schema8.Array(Schema8.Any)
1102
- });
1103
- var findRelatedSchema = async (db, anchor) => {
1104
- const allSchemas = [
1105
- ...db.graph.schemaRegistry.schemas
1106
- ];
1107
- return allSchemas.filter((schema) => {
1108
- if (getTypeAnnotation(schema)?.kind !== EntityKind.Relation) {
1109
- return false;
1110
- }
1111
- return isSchemaAddressableByDxn(anchor, DXN2.parse(getTypeAnnotation(schema).sourceSchema)) || isSchemaAddressableByDxn(anchor, DXN2.parse(getTypeAnnotation(schema).targetSchema));
1112
- }).map((schema) => ({
1113
- schema,
1114
- kind: "relation"
1115
- }));
1116
- };
1117
- var isSchemaAddressableByDxn = (schema, dxn) => {
1118
- if (getTypeIdentifierAnnotation(schema) === dxn.toString()) {
1119
- return true;
1120
- }
1121
- const t = dxn.asTypeDXN();
1122
- if (t) {
1123
- return t.type === getSchemaTypename(schema);
1124
- }
1125
- return false;
1126
- };
1127
- var LocalSearchToolkit = Toolkit.make(Tool.make("search_local_search", {
1128
- description: "Search the local database for information using a vector index",
1129
- parameters: {
1130
- query: Schema8.String.annotations({
1131
- description: "The query to search for. Could be a question or a topic or a set of keywords."
1132
- })
1133
- },
1134
- success: Schema8.Unknown,
1135
- failure: Schema8.Never,
1136
- dependencies: [
1137
- DatabaseService5
1138
- ]
1139
- }));
1140
- var LocalSearchHandler = LocalSearchToolkit.toLayer({
1141
- search_local_search: Effect8.fn(function* ({ query }) {
1142
- const { objects } = yield* DatabaseService5.runQuery(Query.select(Filter.text(query, {
1143
- type: "vector"
1144
- })));
1145
- const results = [
1146
- ...objects
1147
- ];
1148
- const option = yield* Effect8.serviceOption(ContextQueueService);
1149
- if (Option3.isSome(option)) {
1150
- const queueObjects = yield* Effect8.promise(() => option.value.queue.queryObjects());
1151
- results.push(...queueObjects);
1152
- }
1153
- return trim2`
1154
- <local_context>
1155
- ${JSON.stringify(results, null, 2)}
1156
- </local_context>
1157
- `;
1158
- })
1159
- });
1160
- var GraphWriterSchema = class extends Context.Tag("@dxos/assistant/GraphWriterSchema")() {
1161
- };
1162
- var makeGraphWriterToolkit = ({ schema }) => {
1163
- return Toolkit.make(Tool.make("graph_writer", {
1164
- description: "Write to the local graph database",
1165
- parameters: createExtractionSchema(schema).fields,
1166
- success: Schema8.Unknown,
1167
- failure: Schema8.Never,
1168
- dependencies: [
1169
- DatabaseService5,
1170
- ContextQueueService
1171
- ]
1172
- }).annotateContext(Context.make(GraphWriterSchema, {
1173
- schema
1174
- })));
1175
- };
1176
- var makeGraphWriterHandler = (toolkit, { onAppend } = {}) => {
1177
- const { schema } = Context.get(toolkit.tools.graph_writer.annotations, GraphWriterSchema);
1178
- return toolkit.toLayer({
1179
- graph_writer: Effect8.fn(function* (input) {
1180
- const { db } = yield* DatabaseService5;
1181
- const { queue } = yield* ContextQueueService;
1182
- const data = yield* Effect8.promise(() => sanitizeObjects(schema, input, db, queue));
1183
- yield* Effect8.promise(() => queue.append(data));
1184
- const dxns = data.map((obj) => Obj3.getDXN(obj));
1185
- onAppend?.(dxns);
1186
- return dxns;
1187
- })
1188
- });
1189
- };
1190
- var createExtractionSchema = (types) => {
1191
- return Schema8.Struct({
1192
- ...Object.fromEntries(types.map(preprocessSchema).map((schema, index) => [
1193
- `objects_${getSanitizedSchemaName(types[index])}`,
1194
- Schema8.optional(Schema8.Array(schema)).annotations({
1195
- description: `The objects of type: ${getSchemaDXN(types[index])?.asTypeDXN().type}. ${SchemaAST.getDescriptionAnnotation(types[index].ast).pipe(Option3.getOrElse(() => ""))}`
1196
- })
1197
- ]))
1198
- });
1199
- };
1200
- var getSanitizedSchemaName = (schema) => {
1201
- return getSchemaDXN(schema).asTypeDXN().type.replaceAll(/[^a-zA-Z0-9]+/g, "_");
1202
- };
1203
- var sanitizeObjects = async (types, data, db, queue) => {
1204
- const entries = types.map((type) => data[`objects_${getSanitizedSchemaName(type)}`]?.map((object) => ({
1205
- data: object,
1206
- schema: type
1207
- })) ?? []).flat();
1208
- const idMap = /* @__PURE__ */ new Map();
1209
- const existingIds = /* @__PURE__ */ new Set();
1210
- const enitties = /* @__PURE__ */ new Map();
1211
- const resolveId = (id) => {
1212
- if (ObjectId2.isValid(id)) {
1213
- existingIds.add(id);
1214
- return DXN2.fromLocalObjectId(id);
1215
- }
1216
- const mappedId = idMap.get(id);
1217
- if (mappedId) {
1218
- return DXN2.fromLocalObjectId(mappedId);
1219
- }
1220
- return void 0;
1221
- };
1222
- const res = entries.map((entry) => {
1223
- if (ObjectId2.isValid(entry.data.id)) {
1224
- return entry;
1225
- }
1226
- idMap.set(entry.data.id, ObjectId2.random());
1227
- entry.data.id = idMap.get(entry.data.id);
1228
- return entry;
1229
- }).map((entry) => {
1230
- const data2 = deepMapValues(entry.data, (value, recurse) => {
1231
- if (isEncodedReference(value)) {
1232
- const ref = value["/"];
1233
- const id = resolveId(ref);
1234
- if (id) {
1235
- return {
1236
- "/": id.toString()
1237
- };
1238
- } else {
1239
- return {
1240
- "/": `search:?q=${encodeURIComponent(ref)}`
1241
- };
1242
- }
1243
- }
1244
- return recurse(value);
1245
- });
1246
- if (getEntityKind(entry.schema) === "relation") {
1247
- const sourceDxn = resolveId(data2.source);
1248
- if (!sourceDxn) {
1249
- log4.warn("source not found", {
1250
- source: data2.source
1251
- }, {
1252
- F: __dxlog_file4,
1253
- L: 281,
1254
- S: void 0,
1255
- C: (f, a) => f(...a)
1256
- });
1257
- }
1258
- const targetDxn = resolveId(data2.target);
1259
- if (!targetDxn) {
1260
- log4.warn("target not found", {
1261
- target: data2.target
1262
- }, {
1263
- F: __dxlog_file4,
1264
- L: 285,
1265
- S: void 0,
1266
- C: (f, a) => f(...a)
1267
- });
1268
- }
1269
- delete data2.source;
1270
- delete data2.target;
1271
- data2[RelationSourceDXNId] = sourceDxn;
1272
- data2[RelationTargetDXNId] = targetDxn;
1273
- }
1274
- return {
1275
- data: data2,
1276
- schema: entry.schema
1277
- };
1278
- }).filter((object) => !existingIds.has(object.data.id));
1279
- const { objects: dbObjects } = await db.query(Query.select(Filter.ids(...existingIds))).run();
1280
- const queueObjects = await queue?.getObjectsById([
1281
- ...existingIds
1282
- ]) ?? [];
1283
- const objects = [
1284
- ...dbObjects,
1285
- ...queueObjects
1286
- ].filter(isNonNullable);
1287
- log4.info("objects", {
1288
- dbObjects,
1289
- queueObjects,
1290
- existingIds
1291
- }, {
1292
- F: __dxlog_file4,
1293
- L: 306,
1294
- S: void 0,
1295
- C: (f, a) => f(...a)
1296
- });
1297
- const missing = Array.from(existingIds).filter((id) => !objects.some((object) => object.id === id));
1298
- if (missing.length > 0) {
1299
- throw new Error(`Object IDs do not point to existing objects: ${missing.join(", ")}`);
1300
- }
1301
- return res.flatMap(({ data: data2, schema }) => {
1302
- let skip = false;
1303
- if (RelationSourceDXNId in data2) {
1304
- const id = data2[RelationSourceDXNId].asEchoDXN()?.echoId;
1305
- const obj = objects.find((object) => object.id === id) ?? enitties.get(id);
1306
- if (obj) {
1307
- delete data2[RelationSourceDXNId];
1308
- data2[RelationSourceId] = obj;
1309
- } else {
1310
- skip = true;
1311
- }
1312
- }
1313
- if (RelationTargetDXNId in data2) {
1314
- const id = data2[RelationTargetDXNId].asEchoDXN()?.echoId;
1315
- const obj = objects.find((object) => object.id === id) ?? enitties.get(id);
1316
- if (obj) {
1317
- delete data2[RelationTargetDXNId];
1318
- data2[RelationTargetId] = obj;
1319
- } else {
1320
- skip = true;
1321
- }
1322
- }
1323
- if (!skip) {
1324
- const obj = create(schema, data2);
1325
- enitties.set(obj.id, obj);
1326
- return [
1327
- obj
1328
- ];
1329
- }
1330
- return [];
1331
- });
1332
- };
1333
- var SoftRef = Schema8.Struct({
1334
- "/": Schema8.String
1335
- }).annotations({
1336
- description: "Reference to another object."
1337
- });
1338
- var preprocessSchema = (schema) => {
1339
- const isRelationSchema = getEntityKind(schema) === "relation";
1340
- const go = (ast, visited = /* @__PURE__ */ new Set()) => {
1341
- if (visited.has(ast)) {
1342
- return ast;
1343
- }
1344
- visited.add(ast);
1345
- if (SchemaAST.getAnnotation(ast, ReferenceAnnotationId).pipe(Option3.isSome)) {
1346
- return SoftRef.ast;
1347
- }
1348
- return mapAst(ast, (child) => go(child, visited));
1349
- };
1350
- return Schema8.make(mapAst(schema.ast, (ast) => go(ast))).pipe(Schema8.omit("id"), Schema8.extend(Schema8.Struct({
1351
- id: Schema8.String.annotations({
1352
- description: "The id of this object. Come up with a unique id based on your judgement."
1353
- })
1354
- })), isRelationSchema ? Schema8.extend(Schema8.Struct({
1355
- source: Schema8.String.annotations({
1356
- description: "The id of the source object for this relation."
1357
- }),
1358
- target: Schema8.String.annotations({
1359
- description: "The id of the target object for this relation."
1360
- })
1361
- })) : Function3.identity);
1362
- };
1363
-
1364
- // raw-loader:/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/research/instructions-research.tpl?raw
1365
- var instructions_research_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 (through a `web_search` tool)\n- Read the full content of retrieved pages\n- Synthesize accurate, clear, and structured answers using reliable information from the retrieved content\n- Search the local database for information using a vector index (through a `local_search` tool)\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- 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\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 uses `web_search`(query) to retrieve information.\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\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\nIMPORTANT:\n\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\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<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>";
1366
-
1367
- // src/functions/research/research-graph.ts
1368
- import * as Effect9 from "effect/Effect";
1369
- import * as Layer2 from "effect/Layer";
1370
- import * as Schema9 from "effect/Schema";
1371
- import { Obj as Obj4, Query as Query2, Ref as Ref2, Type as Type2 } from "@dxos/echo";
1372
- import { Queue } from "@dxos/echo-db";
1373
- import { ContextQueueService as ContextQueueService2, DatabaseService as DatabaseService6, QueueService } from "@dxos/functions";
1374
- var ResearchGraph = Schema9.Struct({
1375
- queue: Type2.Ref(Queue)
1376
- }).pipe(Type2.Obj({
1377
- typename: "dxos.org/type/ResearchGraph",
1378
- version: "0.1.0"
1379
- }));
1380
- var queryResearchGraph = Effect9.fn("queryResearchGraph")(function* () {
1381
- const { objects } = yield* DatabaseService6.runQuery(Query2.type(ResearchGraph));
1382
- return objects.at(0);
1383
- });
1384
- var createResearchGraph = Effect9.fn("createResearchGraph")(function* () {
1385
- const queue = yield* QueueService.createQueue();
1386
- return yield* DatabaseService6.add(Obj4.make(ResearchGraph, {
1387
- queue: Ref2.fromDXN(queue.dxn)
1388
- }));
1389
- });
1390
- var contextQueueLayerFromResearchGraph = Layer2.unwrapEffect(Effect9.gen(function* () {
1391
- const researchGraph = (yield* queryResearchGraph()) ?? (yield* createResearchGraph());
1392
- const researchQueue = yield* DatabaseService6.load(researchGraph.queue);
1393
- return ContextQueueService2.layer(researchQueue);
1394
- }));
1395
-
1396
- // src/functions/research/types.ts
1397
- import { DataType as DataType3 } from "@dxos/schema";
1398
- var ResearchDataTypes = [
1399
- // Objects
1400
- DataType3.Event,
1401
- DataType3.LegacyOrganization,
1402
- DataType3.LegacyPerson,
1403
- DataType3.Project,
1404
- DataType3.Task,
1405
- DataType3.Text,
1406
- // Relations
1407
- // TODO(wittjosiah): Until views (e.g. table) support relations this needs to be expressed via organization ref.
1408
- // DataType.Employer,
1409
- DataType3.HasRelationship,
1410
- DataType3.HasConnection
1411
- ];
1412
-
1413
- // src/functions/research/research.ts
1414
- var research_default = defineFunction8({
1415
- key: "dxos.org/function/research",
1416
- name: "Research",
1417
- description: trim3`
1418
- Research the web for information.
1419
- Inserts structured data into the research graph.
1420
- Will return research summary and the objects created.
1421
- `,
1422
- inputSchema: Schema10.Struct({
1423
- query: Schema10.String.annotations({
1424
- description: trim3`
1425
- The query to search for.
1426
- If doing research on an object, load it first and pass it as a JSON string.
1427
- `
1428
- }),
1429
- researchInstructions: Schema10.optional(Schema10.String).annotations({
1430
- description: trim3`
1431
- The instructions for the research agent.
1432
- E.g., preference on fast responses or in-depth analysis, number of web searcher or the objects created.
1433
- `
1434
- }),
1435
- // TOOD(burdon): Move to context.
1436
- mockSearch: Schema10.optional(Schema10.Boolean).annotations({
1437
- description: "Whether to use the mock search tool.",
1438
- default: false
1439
- })
1440
- }),
1441
- outputSchema: Schema10.Struct({
1442
- note: Schema10.optional(Schema10.String).annotations({
1443
- description: "A note from the research agent."
1444
- }),
1445
- objects: Schema10.Array(Schema10.Unknown).annotations({
1446
- description: "The structured objects created as a result of the research."
1447
- })
1448
- }),
1449
- handler: Effect10.fnUntraced(function* ({ data: { query, mockSearch, researchInstructions } }) {
1450
- if (mockSearch) {
1451
- const mockPerson = yield* DatabaseService7.add(Obj5.make(DataType4.Person, {
1452
- preferredName: "John Doe",
1453
- emails: [
1454
- {
1455
- value: "john.doe@example.com"
1456
- }
1457
- ],
1458
- phoneNumbers: [
1459
- {
1460
- value: "123-456-7890"
1461
- }
1462
- ]
1463
- }));
1464
- return {
1465
- note: trim3`
1466
- The research run in test-mode and was mocked.
1467
- Proceed as usual.
1468
- We reference John Doe to test reference: ${Obj5.getDXN(mockPerson)}
1469
- `,
1470
- objects: [
1471
- Obj5.toJSON(mockPerson)
1472
- ]
1473
- };
1474
- }
1475
- yield* DatabaseService7.flush({
1476
- indexes: true
1477
- });
1478
- yield* TracingService4.emitStatus({
1479
- message: "Researching..."
1480
- });
1481
- const objectDXNs = [];
1482
- const GraphWriterToolkit = makeGraphWriterToolkit({
1483
- schema: ResearchDataTypes
1484
- });
1485
- const GraphWriterHandler = makeGraphWriterHandler(GraphWriterToolkit, {
1486
- onAppend: (dxns) => objectDXNs.push(...dxns)
1487
- });
1488
- const NativeWebSearch = Toolkit2.make(AnthropicTool.WebSearch_20250305({}));
1489
- const toolkit = yield* createToolkit2({
1490
- toolkit: Toolkit2.merge(LocalSearchToolkit, GraphWriterToolkit, NativeWebSearch)
1491
- }).pipe(Effect10.provide(Layer3.mergeAll(
1492
- //
1493
- GraphWriterHandler,
1494
- LocalSearchHandler
1495
- ).pipe(Layer3.provide(contextQueueLayerFromResearchGraph))));
1496
- const session = new AiSession2();
1497
- const result = yield* session.run({
1498
- prompt: query,
1499
- system: instructions_research_default + (researchInstructions ? `
1500
-
1501
- <research_instructions>${researchInstructions}</research_instructions>` : ""),
1502
- toolkit,
1503
- observer: GenerationObserver2.fromPrinter(new ConsolePrinter2({
1504
- tag: "research"
1505
- }))
1506
- });
1507
- const note = result.at(-1)?.blocks.filter((block) => block._tag === "text").at(-1)?.text;
1508
- const objects = yield* Effect10.forEach(objectDXNs, (dxn) => DatabaseService7.resolve(dxn)).pipe(Effect10.map(Array6.map((obj) => Obj5.toJSON(obj))));
1509
- return {
1510
- note,
1511
- objects
1512
- };
1513
- }, Effect10.provide(Layer3.mergeAll(
1514
- AiService2.model("@anthropic/claude-sonnet-4-0"),
1515
- // TODO(dmaretskyi): Extract.
1516
- makeToolResolverFromFunctions([
1517
- exa_default,
1518
- mock_default
1519
- ], Toolkit2.make()),
1520
- makeToolExecutionServiceFromFunctions(Toolkit2.make(), Layer3.empty)
1521
- ).pipe(Layer3.provide(
1522
- // TODO(dmaretskyi): This should be provided by environment.
1523
- Layer3.mergeAll(FunctionInvocationService.layerTestMocked({
1524
- functions: [
1525
- exa_default,
1526
- mock_default
1527
- ]
1528
- }))
1529
- ))))
1530
- });
1531
-
1532
- // src/functions/research/index.ts
1533
- (function(Research2) {
1534
- Research2.create = create_document_default;
1535
- Research2.research = research_default;
1536
- })(Research || (Research = {}));
1537
- var Research;
1538
-
1539
- // src/functions/entity-extraction/entity-extraction.ts
1540
- var __dxlog_file5 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/entity-extraction/entity-extraction.ts";
1541
- var entity_extraction_default = defineFunction9({
1542
- key: "dxos.org/functions/entity-extraction",
1543
- name: "Entity Extraction",
1544
- description: "Extracts entities from emails and transcripts.",
1545
- inputSchema: Schema11.Struct({
1546
- source: DataType5.Message.annotations({
1547
- description: "Email or transcript to extract entities from."
1548
- }),
1549
- // TODO(dmaretskyi): Consider making this an array of blueprints instead.
1550
- instructions: Schema11.optional(Schema11.String).annotations({
1551
- description: "Instructions extraction process."
1552
- })
1553
- }),
1554
- outputSchema: Schema11.Struct({
1555
- entities: Schema11.optional(Schema11.Array(Obj6.Any).annotations({
1556
- description: "Extracted entities."
1557
- }))
1558
- }),
1559
- handler: Effect11.fnUntraced(function* ({ data: { source, instructions: instructions6 } }) {
1560
- const contact = yield* extractContact(source);
1561
- let organization = null;
1562
- if (contact && !contact.organization) {
1563
- const created = [];
1564
- const GraphWriterToolkit = makeGraphWriterToolkit({
1565
- schema: [
1566
- DataType5.LegacyOrganization
1567
- ]
1568
- }).pipe();
1569
- const GraphWriterHandler = makeGraphWriterHandler(GraphWriterToolkit, {
1570
- onAppend: (dxns) => created.push(...dxns)
1571
- });
1572
- const toolkit = yield* GraphWriterToolkit.pipe(Effect11.provide(GraphWriterHandler.pipe(Layer4.provide(contextQueueLayerFromResearchGraph))));
1573
- yield* new AiSession3().run({
1574
- system: trim4`
1575
- Extract the sender's organization from the email. If you are not sure, do nothing.
1576
- The extracted organization URL must match the sender's email domain.
1577
- ${instructions6 ? "<user_intructions>" + instructions6 + "</user_intructions>" : ""},
1578
- `,
1579
- prompt: JSON.stringify({
1580
- source,
1581
- contact
1582
- }),
1583
- toolkit
1584
- });
1585
- if (created.length > 1) {
1586
- throw new Error("Multiple organizations created");
1587
- } else if (created.length === 1) {
1588
- organization = yield* DatabaseService8.resolve(created[0], DataType5.Organization);
1589
- Obj6.getMeta(organization).tags ??= [];
1590
- Obj6.getMeta(organization).tags.push(...Obj6.getMeta(source)?.tags ?? []);
1591
- contact.organization = Ref3.make(organization);
1592
- }
1593
- }
1594
- return {
1595
- entities: [
1596
- contact,
1597
- organization
1598
- ].filter(Predicate.isNotNullable)
1599
- };
1600
- }, Effect11.provide(Layer4.mergeAll(AiService3.model("@anthropic/claude-sonnet-4-0"), makeToolResolverFromFunctions2([], Toolkit3.make()), makeToolExecutionServiceFromFunctions2(Toolkit3.make(), Layer4.empty)).pipe(Layer4.provide(
1601
- // TODO(dmaretskyi): This should be provided by environment.
1602
- Layer4.mergeAll(FunctionInvocationService2.layerTest())
1603
- ))))
1604
- });
1605
- var extractContact = Effect11.fn("extractContact")(function* (message) {
1606
- const name = message.sender.name;
1607
- const email = message.sender.email;
1608
- if (!email) {
1609
- log5.warn("email is required for contact extraction", {
1610
- sender: message.sender
1611
- }, {
1612
- F: __dxlog_file5,
1613
- L: 97,
1614
- S: this,
1615
- C: (f, a) => f(...a)
1616
- });
1617
- return void 0;
1618
- }
1619
- const { objects: existingContacts } = yield* DatabaseService8.runQuery(Filter2.type(DataType5.Person));
1620
- const existingContact = existingContacts.find((contact) => contact.emails?.some((contactEmail) => contactEmail.value === email));
1621
- if (existingContact) {
1622
- log5.info("Contact already exists", {
1623
- email,
1624
- existingContact
1625
- }, {
1626
- F: __dxlog_file5,
1627
- L: 110,
1628
- S: this,
1629
- C: (f, a) => f(...a)
1630
- });
1631
- return existingContact;
1632
- }
1633
- const newContact = Obj6.make(DataType5.Person, {
1634
- [Obj6.Meta]: {
1635
- tags: Obj6.getMeta(message)?.tags
1636
- },
1637
- emails: [
1638
- {
1639
- value: email
1640
- }
1641
- ]
1642
- });
1643
- yield* DatabaseService8.add(newContact);
1644
- if (name) {
1645
- newContact.fullName = name;
1646
- }
1647
- const emailDomain = email.split("@")[1]?.toLowerCase();
1648
- if (!emailDomain) {
1649
- log5.warn("Invalid email format, cannot extract domain", {
1650
- email
1651
- }, {
1652
- F: __dxlog_file5,
1653
- L: 128,
1654
- S: this,
1655
- C: (f, a) => f(...a)
1656
- });
1657
- return newContact;
1658
- }
1659
- log5.info("extracted email domain", {
1660
- emailDomain
1661
- }, {
1662
- F: __dxlog_file5,
1663
- L: 132,
1664
- S: this,
1665
- C: (f, a) => f(...a)
1666
- });
1667
- const { objects: existingOrganisations } = yield* DatabaseService8.runQuery(Filter2.type(DataType5.Organization));
1668
- const matchingOrg = existingOrganisations.find((org) => {
1669
- if (org.website) {
1670
- try {
1671
- const websiteUrl = org.website.startsWith("http://") || org.website.startsWith("https://") ? org.website : `https://${org.website}`;
1672
- const websiteDomain = new URL(websiteUrl).hostname.toLowerCase();
1673
- return websiteDomain === emailDomain || websiteDomain.endsWith(`.${emailDomain}`) || emailDomain.endsWith(`.${websiteDomain}`);
1674
- } catch (e) {
1675
- log5.warn("Error parsing website URL", {
1676
- website: org.website,
1677
- error: e
1678
- }, {
1679
- F: __dxlog_file5,
1680
- L: 150,
1681
- S: this,
1682
- C: (f, a) => f(...a)
1683
- });
1684
- return false;
1685
- }
1686
- }
1687
- return false;
1688
- });
1689
- if (matchingOrg) {
1690
- log5.info("found matching organization", {
1691
- organization: matchingOrg
1692
- }, {
1693
- F: __dxlog_file5,
1694
- L: 158,
1695
- S: this,
1696
- C: (f, a) => f(...a)
1697
- });
1698
- newContact.organization = Ref3.make(matchingOrg);
1699
- }
1700
- return newContact;
1701
- });
1702
-
1703
- // src/functions/entity-extraction/index.ts
1704
- (function(EntityExtraction2) {
1705
- EntityExtraction2.extract = entity_extraction_default;
1706
- })(EntityExtraction || (EntityExtraction = {}));
1707
- var EntityExtraction;
1708
-
1709
- // src/functions/linear/sync-issues.ts
1710
- import * as FetchHttpClient2 from "@effect/platform/FetchHttpClient";
1711
- import * as HttpClient from "@effect/platform/HttpClient";
1712
- import * as Array9 from "effect/Array";
1713
- import * as Effect13 from "effect/Effect";
1714
- import * as Function4 from "effect/Function";
1715
- import * as Schema12 from "effect/Schema";
1716
- import { Filter as Filter4, Obj as Obj8, Query as Query4, Ref as Ref5 } from "@dxos/echo";
1717
- import { DatabaseService as DatabaseService10, defineFunction as defineFunction10, withAuthorization } from "@dxos/functions";
1718
- import { log as log7 } from "@dxos/log";
1719
- import { DataType as DataType6 } from "@dxos/schema";
1720
-
1721
- // src/sync/sync.ts
1722
- import * as Effect12 from "effect/Effect";
1723
- import { Filter as Filter3, Obj as Obj7, Query as Query3, Ref as Ref4 } from "@dxos/echo";
1724
- import { DatabaseService as DatabaseService9 } from "@dxos/functions";
1725
- import { failedInvariant } from "@dxos/invariant";
1726
- import { log as log6 } from "@dxos/log";
1727
- var __dxlog_file6 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/sync/sync.ts";
1728
- var syncObjects = Effect12.fn("syncObjects")(function* (objs, { foreignKeyId }) {
1729
- return yield* Effect12.forEach(objs, Effect12.fnUntraced(function* (obj) {
1730
- for (const key of Object.keys(obj)) {
1731
- if (typeof key !== "string" || key === "id") continue;
1732
- if (!Ref4.isRef(obj[key])) continue;
1733
- const ref = obj[key];
1734
- if (!ref.target) continue;
1735
- if (Obj7.getDXN(ref.target).isLocalObjectId()) {
1736
- const [target] = yield* syncObjects([
1737
- ref.target
1738
- ], {
1739
- foreignKeyId
1740
- });
1741
- obj[key] = Ref4.make(target);
1742
- }
1743
- }
1744
- const schema = Obj7.getSchema(obj) ?? failedInvariant("No schema.");
1745
- const foreignId = Obj7.getKeys(obj, foreignKeyId)[0]?.id ?? failedInvariant("No foreign key.");
1746
- const { objects: [existing] } = yield* DatabaseService9.runQuery(Query3.select(Filter3.foreignKeys(schema, [
1747
- {
1748
- source: foreignKeyId,
1749
- id: foreignId
1750
- }
1751
- ])));
1752
- log6("sync object", {
1753
- type: Obj7.getTypename(obj),
1754
- foreignId,
1755
- existing: existing ? Obj7.getDXN(existing) : void 0
1756
- }, {
1757
- F: __dxlog_file6,
1758
- L: 47,
1759
- S: this,
1760
- C: (f, a) => f(...a)
1761
- });
1762
- if (!existing) {
1763
- yield* DatabaseService9.add(obj);
1764
- return obj;
1765
- } else {
1766
- copyObjectData(existing, obj);
1767
- return existing;
1768
- }
1769
- }), {
1770
- concurrency: 1
1771
- });
1772
- });
1773
- var copyObjectData = (existing, newObj) => {
1774
- for (const key of Object.keys(newObj)) {
1775
- if (typeof key !== "string" || key === "id") continue;
1776
- if (typeof newObj[key] !== "string" && typeof newObj[key] !== "number" && typeof newObj[key] !== "boolean" && !Ref4.isRef(newObj[key])) continue;
1777
- existing[key] = newObj[key];
1778
- }
1779
- for (const key of Object.keys(existing)) {
1780
- if (typeof key !== "string" || key === "id") continue;
1781
- if (!(key in newObj)) {
1782
- delete existing[key];
1783
- }
1784
- }
1785
- for (const foreignKey of Obj7.getMeta(newObj).keys) {
1786
- Obj7.deleteKeys(existing, foreignKey.source);
1787
- Obj7.getMeta(existing).keys.push({
1788
- ...foreignKey
1789
- });
1790
- }
1791
- };
1792
-
1793
- // src/util/graphql.ts
1794
- import * as HttpBody from "@effect/platform/HttpBody";
1795
- var graphqlRequestBody = (query, variables = {}) => HttpBody.json({
1796
- query,
1797
- variables
1798
- });
1799
-
1800
- // src/functions/linear/sync-issues.ts
1801
- var __dxlog_file7 = "/__w/dxos/dxos/packages/core/assistant-toolkit/src/functions/linear/sync-issues.ts";
1802
- var queryIssues = `
1803
- query Issues($teamId: String!, $after: DateTimeOrDuration!) {
1804
- team(id: $teamId) {
1805
- id
1806
- name
1807
-
1808
-
1809
- issues(last: 150, orderBy: updatedAt, filter: {
1810
- updatedAt: { gt: $after }
1811
- }) {
1812
- edges {
1813
- node {
1814
- id
1815
- title
1816
- createdAt
1817
- updatedAt
1818
- description
1819
- assignee { id, name }
1820
- state {
1821
- name
1822
- }
1823
- project {
1824
- id
1825
- name
1826
- }
1827
- }
1828
- cursor
1829
- }
1830
- pageInfo {
1831
- hasNextPage
1832
- endCursor
1833
- }
1834
- }
1835
- }
1836
- }
1837
- `;
1838
- var LINEAR_ID_KEY = "linear.app/id";
1839
- var LINEAR_TEAM_ID_KEY = "linear.app/teamId";
1840
- var LINEAR_UPDATED_AT_KEY = "linear.app/updatedAt";
1841
- var sync_issues_default = defineFunction10({
1842
- key: "dxos.org/function/linear/sync-issues",
1843
- name: "Linear",
1844
- description: "Sync issues from Linear.",
1845
- inputSchema: Schema12.Struct({
1846
- team: Schema12.String.annotations({
1847
- description: "Linear team id."
1848
- })
1849
- }),
1850
- handler: Effect13.fnUntraced(function* ({ data }) {
1851
- const client = yield* HttpClient.HttpClient.pipe(Effect13.map(withAuthorization({
1852
- service: "linear.app"
1853
- })));
1854
- const after = yield* getLatestUpdateTimestamp(data.team, DataType6.Task);
1855
- log7.info("will fetch", {
1856
- after
1857
- }, {
1858
- F: __dxlog_file7,
1859
- L: 91,
1860
- S: this,
1861
- C: (f, a) => f(...a)
1862
- });
1863
- const response = yield* client.post("https://api.linear.app/graphql", {
1864
- body: yield* graphqlRequestBody(queryIssues, {
1865
- teamId: data.team,
1866
- after
1867
- })
1868
- });
1869
- const json2 = yield* response.json;
1870
- const tasks = json2.data.team.issues.edges.map((edge) => mapLinearIssue(edge.node, {
1871
- teamId: data.team
1872
- }));
1873
- log7.info("Fetched tasks", {
1874
- count: tasks.length
1875
- }, {
1876
- F: __dxlog_file7,
1877
- L: 104,
1878
- S: this,
1879
- C: (f, a) => f(...a)
1880
- });
1881
- return {
1882
- objects: yield* syncObjects(tasks, {
1883
- foreignKeyId: LINEAR_ID_KEY
1884
- }),
1885
- syncComplete: tasks.length < 150
1886
- };
1887
- }, Effect13.provide(FetchHttpClient2.layer))
1888
- });
1889
- var getLatestUpdateTimestamp = Effect13.fnUntraced(function* (teamId, dataType) {
1890
- const { objects: existingTasks } = yield* DatabaseService10.runQuery(Query4.type(dataType).select(Filter4.foreignKeys(dataType, [
1891
- {
1892
- source: LINEAR_TEAM_ID_KEY,
1893
- id: teamId
1894
- }
1895
- ])));
1896
- return Function4.pipe(existingTasks, Array9.map((task) => Obj8.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));
1897
- });
1898
- var mapLinearPerson = (person, { teamId }) => Obj8.make(DataType6.Person, {
1899
- [Obj8.Meta]: {
1900
- keys: [
1901
- {
1902
- id: person.id,
1903
- source: LINEAR_ID_KEY
1904
- },
1905
- {
1906
- id: teamId,
1907
- source: LINEAR_TEAM_ID_KEY
1908
- }
1909
- ]
1910
- },
1911
- nickname: person.name
1912
- });
1913
- var mapLinearIssue = (issue, { teamId }) => Obj8.make(DataType6.Task, {
1914
- [Obj8.Meta]: {
1915
- keys: [
1916
- {
1917
- id: issue.id,
1918
- source: LINEAR_ID_KEY
1919
- },
1920
- {
1921
- id: issue.updatedAt,
1922
- source: LINEAR_UPDATED_AT_KEY
1923
- },
1924
- {
1925
- id: teamId,
1926
- source: LINEAR_TEAM_ID_KEY
1927
- }
1928
- ]
1929
- },
1930
- title: issue.title ?? void 0,
1931
- description: issue.description ?? void 0,
1932
- assigned: !issue.assignee ? void 0 : Ref5.make(mapLinearPerson(issue.assignee, {
1933
- teamId
1934
- })),
1935
- // TODO(dmaretskyi): Sync those (+ linear team as org?).
1936
- // state: issue.state.name,
1937
- project: !issue.project ? void 0 : Ref5.make(DataType6.makeProject({
1938
- [Obj8.Meta]: {
1939
- keys: [
1940
- {
1941
- id: issue.project.id,
1942
- source: LINEAR_ID_KEY
1943
- },
1944
- {
1945
- id: teamId,
1946
- source: LINEAR_TEAM_ID_KEY
1947
- }
1948
- ]
1949
- },
1950
- name: issue.project.name
1951
- }))
1952
- });
1953
-
1954
- // src/functions/linear/index.ts
1955
- (function(Linear2) {
1956
- Linear2.sync = sync_issues_default;
1957
- })(Linear || (Linear = {}));
1958
- var Linear;
1959
-
1960
- // src/functions/tasks/read.ts
1961
- import * as Effect14 from "effect/Effect";
1962
- import * as Schema13 from "effect/Schema";
1963
- import { ArtifactId as ArtifactId3 } from "@dxos/assistant";
1964
- import { DatabaseService as DatabaseService11, defineFunction as defineFunction11 } from "@dxos/functions";
1965
- import { Markdown as Markdown4 } from "@dxos/plugin-markdown/types";
1966
- var read_default2 = defineFunction11({
1967
- key: "dxos.org/function/markdown/read-tasks",
1968
- name: "Read",
1969
- description: "Read markdown tasks.",
1970
- inputSchema: Schema13.Struct({
1971
- id: ArtifactId3.annotations({
1972
- description: "The ID of the document to read."
1973
- })
1974
- }),
1975
- outputSchema: Schema13.Struct({
1976
- content: Schema13.String
1977
- }),
1978
- handler: Effect14.fn(function* ({ data: { id } }) {
1979
- const doc = yield* DatabaseService11.resolve(ArtifactId3.toDXN(id), Markdown4.Document);
1980
- const { content } = yield* DatabaseService11.load(doc.content);
1981
- const lines = content.split("\n");
1982
- const len = String(lines.length).length;
1983
- const numbered = lines.map((line, i) => `${String(i + 1).padStart(len, " ")}. ${line}`).join("\n");
1984
- return {
1985
- content: numbered
1986
- };
1987
- })
1988
- });
1989
-
1990
- // src/functions/tasks/update.ts
1991
- import * as Effect15 from "effect/Effect";
1992
- import * as Schema14 from "effect/Schema";
1993
- import { ArtifactId as ArtifactId4 } from "@dxos/assistant";
1994
- import { DatabaseService as DatabaseService12, defineFunction as defineFunction12 } from "@dxos/functions";
1995
- import { Markdown as Markdown5 } from "@dxos/plugin-markdown/types";
1996
-
1997
- // src/functions/tasks/task-list.ts
1998
- var MarkdownTasks = class {
1999
- _lineEndings;
2000
- _content;
2001
- constructor(initialContent = "") {
2002
- this._lineEndings = initialContent.includes("\r\n") ? "\r\n" : "\n";
2003
- this._content = initialContent ? initialContent.split(this._lineEndings) : [];
2004
- }
2005
- /**
2006
- * Get the current document content with line numbers prefixed.
2007
- */
2008
- getNumberedContent() {
2009
- return this._content.map((line, index) => `${(index + 1).toString().padStart(3, " ")}\u2192${line}`).join(this._lineEndings);
2010
- }
2011
- /**
2012
- * Get the raw document content without line numbers.
2013
- */
2014
- getRawContent() {
2015
- return this._content.join(this._lineEndings);
2016
- }
2017
- /**
2018
- * Insert a new task at the specified line number (1-based).
2019
- * Indentation level determines hierarchy (0, 2, 4, 6 spaces etc.)
2020
- */
2021
- insertTask(lineNumber, taskText, completed = false, indent = 0) {
2022
- const indentStr = " ".repeat(indent);
2023
- const taskLine = completed ? `${indentStr}- [x] ${taskText}` : `${indentStr}- [ ] ${taskText}`;
2024
- const insertIndex = Math.max(0, Math.min(lineNumber - 1, this._content.length));
2025
- this._content.splice(insertIndex, 0, taskLine);
2026
- }
2027
- /**
2028
- * Delete a task at the specified line number (1-based).
2029
- */
2030
- deleteTask(lineNumber) {
2031
- if (lineNumber < 1 || lineNumber > this._content.length) {
2032
- return false;
2033
- }
2034
- this._content.splice(lineNumber - 1, 1);
2035
- return true;
2036
- }
2037
- /**
2038
- * Update the text of a task at the specified line number (1-based).
2039
- */
2040
- updateTaskText(lineNumber, newText) {
2041
- if (lineNumber < 1 || lineNumber > this._content.length) {
2042
- return false;
2043
- }
2044
- const currentLine = this._content[lineNumber - 1];
2045
- const taskMatch = currentLine.match(/^(\s*- \[[x ]\] )(.*)$/);
2046
- if (taskMatch) {
2047
- this._content[lineNumber - 1] = `${taskMatch[1]}${newText}`;
2048
- return true;
2049
- }
2050
- return false;
2051
- }
2052
- /**
2053
- * Mark a task as complete or incomplete at the specified line number (1-based).
2054
- */
2055
- toggleTaskCompletion(lineNumber, completed) {
2056
- if (lineNumber < 1 || lineNumber > this._content.length) {
2057
- return false;
2058
- }
2059
- const currentLine = this._content[lineNumber - 1];
2060
- const taskMatch = currentLine.match(/^(\s*- \[)([x ])(.*)$/);
2061
- if (taskMatch) {
2062
- const isCurrentlyComplete = taskMatch[2] === "x";
2063
- const newStatus = completed !== void 0 ? completed : !isCurrentlyComplete;
2064
- const statusChar = newStatus ? "x" : " ";
2065
- this._content[lineNumber - 1] = `${taskMatch[1]}${statusChar}${taskMatch[3]}`;
2066
- return true;
2067
- }
2068
- return false;
2069
- }
2070
- /**
2071
- * Change the indentation level of a task (for hierarchy).
2072
- */
2073
- setTaskIndent(lineNumber, indent) {
2074
- if (lineNumber < 1 || lineNumber > this._content.length) {
2075
- return false;
2076
- }
2077
- const currentLine = this._content[lineNumber - 1];
2078
- const taskMatch = currentLine.match(/^\s*- (\[[x ]\] .*)$/);
2079
- if (taskMatch) {
2080
- const indentStr = " ".repeat(indent);
2081
- this._content[lineNumber - 1] = `${indentStr}- ${taskMatch[1]}`;
2082
- return true;
2083
- }
2084
- return false;
2085
- }
2086
- /**
2087
- * Get the total number of lines in the document.
2088
- */
2089
- getLineCount() {
2090
- return this._content.length;
2091
- }
2092
- /**
2093
- * Apply multiple operations atomically.
2094
- */
2095
- applyOperations(operations) {
2096
- const sortedOps = [
2097
- ...operations
2098
- ].sort((a, b) => {
2099
- const aLine = "lineNumber" in a ? a.lineNumber : 0;
2100
- const bLine = "lineNumber" in b ? b.lineNumber : 0;
2101
- return bLine - aLine;
2102
- });
2103
- for (const op of sortedOps) {
2104
- switch (op.type) {
2105
- case "insertTask":
2106
- this.insertTask(op.lineNumber, op.text, op.completed, op.indent);
2107
- break;
2108
- case "deleteTask":
2109
- this.deleteTask(op.lineNumber);
2110
- break;
2111
- case "updateTaskText":
2112
- this.updateTaskText(op.lineNumber, op.text);
2113
- break;
2114
- case "toggleTaskCompletion":
2115
- this.toggleTaskCompletion(op.lineNumber, op.completed);
2116
- break;
2117
- case "setTaskIndent":
2118
- this.setTaskIndent(op.lineNumber, op.indent);
2119
- break;
2120
- }
2121
- }
2122
- }
2123
- };
2124
-
2125
- // src/functions/tasks/update.ts
2126
- var update_default2 = defineFunction12({
2127
- key: "dxos.org/function/markdown/update-tasks",
2128
- name: "Update markdown",
2129
- description: "Creates and updates tasks in markdown documents.",
2130
- inputSchema: Schema14.Struct({
2131
- id: ArtifactId4.annotations({
2132
- description: "The ID of the document to update."
2133
- }),
2134
- operations: Schema14.optional(Schema14.Array(Schema14.Any.annotations({
2135
- description: "Task operations to apply."
2136
- })))
2137
- }),
2138
- outputSchema: Schema14.Struct({
2139
- content: Schema14.String,
2140
- numberedContent: Schema14.String.annotations({
2141
- description: "Content with line numbers for agent reference."
2142
- })
2143
- }),
2144
- handler: Effect15.fn(function* ({ data: { id, operations = [] } }) {
2145
- const doc = yield* DatabaseService12.resolve(ArtifactId4.toDXN(id), Markdown5.Document);
2146
- const { content } = yield* DatabaseService12.load(doc.content);
2147
- const taskManager = new MarkdownTasks(content);
2148
- if (operations.length > 0) {
2149
- taskManager.applyOperations(operations);
2150
- }
2151
- return {
2152
- content: taskManager.getRawContent(),
2153
- numberedContent: taskManager.getNumberedContent()
2154
- };
2155
- })
2156
- });
2157
-
2158
- // src/functions/tasks/index.ts
2159
- (function(Tasks2) {
2160
- Tasks2.read = read_default2;
2161
- Tasks2.update = update_default2;
2162
- })(Tasks || (Tasks = {}));
2163
- var Tasks;
2164
-
2165
- // src/blueprints/design/design-blueprint.ts
2166
- var instructions = trim5`
2167
- You manage a design spec based on the conversation.
2168
- The design spec is a markdown document that is used to record the tasks.
2169
- The design spec document follows a hierarchical structure, with nested markdown bulleted sections.
2170
- Use the appropriate tools to read and write the design spec document.
2171
- Maintain the document so that it can convey all relevant points from the conversation.
2172
- When replying to the user, be terse with your comments about design doc handling.
2173
- Do not announce when you read or write the design spec document.
2174
- `;
2175
- var blueprint = Obj9.make(Blueprint.Blueprint, {
2176
- key: "dxos.org/blueprint/design",
2177
- name: "Design Spec",
2178
- description: "Preserve the conversation in the design spec.",
2179
- instructions: {
2180
- source: Ref6.make(DataType7.makeText(instructions))
2181
- },
2182
- tools: [
2183
- Document.read,
2184
- Document.update
2185
- ].map((fn9) => ToolId.make(fn9.key))
2186
- });
2187
- var design_blueprint_default = blueprint;
2188
-
2189
- // src/blueprints/design/index.ts
2190
- var design_default = design_blueprint_default;
2191
-
2192
- // src/blueprints/discord/discord-blueprint.ts
2193
- import { ToolId as ToolId2 } from "@dxos/ai";
2194
- import { Blueprint as Blueprint2 } from "@dxos/blueprints";
2195
- import { Obj as Obj10, Ref as Ref7 } from "@dxos/echo";
2196
- import { DataType as DataType8 } from "@dxos/schema";
2197
- import { trim as trim6 } from "@dxos/util";
2198
- var instructions2 = trim6`
2199
- You are able to fetch messages from Discord servers.
2200
-
2201
- Known servers:
2202
-
2203
- DXOS serverId: 837138313172353095
2204
- `;
2205
- var blueprint2 = Obj10.make(Blueprint2.Blueprint, {
2206
- key: "dxos.org/blueprint/discord",
2207
- name: "Discord",
2208
- description: "Discord integration.",
2209
- instructions: {
2210
- source: Ref7.make(DataType8.makeText(instructions2))
2211
- },
2212
- tools: [
2213
- ToolId2.make(Discord.fetch.key)
2214
- ]
2215
- });
2216
- var discord_blueprint_default = blueprint2;
2217
-
2218
- // src/blueprints/discord/index.ts
2219
- var discord_default = discord_blueprint_default;
2220
-
2221
- // src/blueprints/linear/linear-blueprint.ts
2222
- import { ToolId as ToolId3 } from "@dxos/ai";
2223
- import { Blueprint as Blueprint3 } from "@dxos/blueprints";
2224
- import { Obj as Obj11, Ref as Ref8 } from "@dxos/echo";
2225
- import { DataType as DataType9 } from "@dxos/schema";
2226
- import { trim as trim7 } from "@dxos/util";
2227
- var instructions3 = trim7`
2228
- You are able to sync Linear workspaces.
2229
- Sometimes sync does not complete in one go and you need to call the function again.
2230
-
2231
- Known workspaces:
2232
-
2233
- DXOS teamId: 1127c63a-6f77-4725-9229-50f6cd47321c
2234
- `;
2235
- var blueprint3 = Obj11.make(Blueprint3.Blueprint, {
2236
- key: "dxos.org/blueprint/linear",
2237
- name: "Linear",
2238
- description: "Syncs Linear workspaces.",
2239
- instructions: {
2240
- source: Ref8.make(DataType9.makeText(instructions3))
2241
- },
2242
- tools: [
2243
- Linear.sync
2244
- ].map((tool) => ToolId3.make(tool.key))
2245
- });
2246
- var linear_blueprint_default = blueprint3;
2247
-
2248
- // src/blueprints/linear/index.ts
2249
- var linear_default = linear_blueprint_default;
2250
-
2251
- // src/blueprints/planning/planning-blueprint.ts
2252
- import { ToolId as ToolId4 } from "@dxos/ai";
2253
- import { Blueprint as Blueprint4 } from "@dxos/blueprints";
2254
- import { Obj as Obj12, Ref as Ref9 } from "@dxos/echo";
2255
- import { DataType as DataType10 } from "@dxos/schema";
2256
- import { trim as trim8 } from "@dxos/util";
2257
- var instructions4 = trim8`
2258
- You are a task management agent that maintains hierarchical task lists where each line is a task.
2259
-
2260
- ## Document Format
2261
- You will receive task lists with line numbers prefixed like:
2262
-
2263
- ${"```"}
2264
- 1. - [ ] First main task
2265
- 2. - [ ] Subtask 1: Research phase
2266
- 3. - [x] Literature review
2267
- 4. - [ ] Stakeholder interviews
2268
- 5. - [ ] Subtask 2: Implementation
2269
- 6. - [ ] Setup infrastructure
2270
- 7. - [ ] Write core functionality
2271
- 8. - [ ] Another main task
2272
- ${"```"}
2273
-
2274
- ## Task Hierarchy
2275
- - 0 spaces: Top-level tasks
2276
- - 2 spaces: First-level subtasks
2277
- - 4 spaces: Second-level subtasks
2278
- - 6 spaces: Third-level subtasks (and so on)
2279
-
2280
- ## Available Operations
2281
- You can modify the task list using these operations:
2282
-
2283
- 1. **insertTask(lineNumber, text, completed?, indent?)** - Insert a new task
2284
- 2. **deleteTask(lineNumber)** - Delete a task
2285
- 3. **updateTaskText(lineNumber, text)** - Change task description
2286
- 4. **toggleTaskCompletion(lineNumber, completed?)** - Mark task complete/incomplete
2287
- 5. **setTaskIndent(lineNumber, indent)** - Change task hierarchy level
2288
-
2289
- ## Examples
2290
-
2291
- ### Example 1: Adding a subtask
2292
- **User:** "Add a subtask 'Code review' under the task on line 1"
2293
- **Response:** \`insertTask(2, "Code review", false, 2)\`
2294
-
2295
- ### Example 2: Marking a task complete
2296
- **User:** "Mark the task on line 3 as complete"
2297
- **Response:** \`toggleTaskCompletion(3, true)\`
2298
-
2299
- ### Example 3: Updating task text
2300
- **User:** "Change the task on line 5 to 'Backend implementation'"
2301
- **Response:** \`updateTaskText(5, "Backend implementation")\`
2302
-
2303
- ### Example 4: Creating a task hierarchy
2304
- **User:** "Add a main task 'Testing phase' with two subtasks"
2305
- **Response:**
2306
- \`\`\`
2307
- insertTask(999, "Testing phase", false, 0)
2308
- insertTask(999, "Unit tests", false, 2)
2309
- insertTask(999, "Integration tests", false, 2)
2310
- \`\`\`
2311
-
2312
- ### Example 5: Reorganizing hierarchy
2313
- **User:** "Move the task on line 4 to be a main task (top level)"
2314
- **Response:** \`setTaskIndent(4, 0)\`
2315
-
2316
- ### Example 6: Adding nested subtasks
2317
- **User:** "Add a sub-subtask 'Write test cases' under line 6"
2318
- **Response:** \`insertTask(7, "Write test cases", false, 4)\`
2319
-
2320
- ## Guidelines
2321
- - Always reference line numbers from the numbered document you receive
2322
- - Use line number 999 to append to the end of the document
2323
- - Maintain logical hierarchy (subtasks should be indented under their parent)
2324
- - Use appropriate indentation levels (0, 2, 4, 6, etc. spaces)
2325
- - When creating subtasks, consider the parent task's completion status
2326
- - Be precise with task descriptions and hierarchy levels
2327
- `;
2328
- var blueprint4 = Obj12.make(Blueprint4.Blueprint, {
2329
- key: "dxos.org/blueprint/planning",
2330
- name: "Planning",
2331
- description: "Plans and tracks complex tasks with artifact management.",
2332
- instructions: {
2333
- source: Ref9.make(DataType10.makeText(instructions4))
2334
- },
2335
- tools: [
2336
- Tasks.read,
2337
- Tasks.update
2338
- ].map((fn9) => ToolId4.make(fn9.key))
2339
- });
2340
- var planning_blueprint_default = blueprint4;
2341
-
2342
- // src/blueprints/planning/index.ts
2343
- var planning_default = planning_blueprint_default;
2344
-
2345
- // src/blueprints/research/research-blueprint.ts
2346
- import { ToolId as ToolId5 } from "@dxos/ai";
2347
- import { Blueprint as Blueprint5 } from "@dxos/blueprints";
2348
- import { Obj as Obj13, Ref as Ref10 } from "@dxos/echo";
2349
- import { DataType as DataType11 } from "@dxos/schema";
2350
- import { trim as trim9 } from "@dxos/util";
2351
- var instructions5 = trim9`
2352
- {{! Research }}
2353
-
2354
- You are an analyst that does research tasks using tools that scrape the web and create structured data.
2355
- The result of the research is a set of structured entities forming an interconnected graph.
2356
- When you are done, reply with the created objects.
2357
- Do not print the data, instead reply with inline references to the created objects.
2358
- Those will be later substituted with the pills representing the created objects.
2359
- Print the rest of the created objects as block references after the main note.
2360
-
2361
- <example>
2362
- Based on my research, Google was founded by @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M and @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW9H2ZQ
2363
-
2364
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M</dxn></object>
2365
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW9H2ZQ</dxn></object>
2366
- <object><dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK46K31DDW62PBW92333</dxn></object>
2367
- </example>
2368
- `;
2369
- var blueprint5 = Obj13.make(Blueprint5.Blueprint, {
2370
- key: "dxos.org/blueprint/research",
2371
- name: "Research",
2372
- description: "Researches the web and creates structured data.",
2373
- instructions: {
2374
- source: Ref10.make(DataType11.makeText(instructions5))
2375
- },
2376
- tools: [
2377
- Research.create,
2378
- Research.research
2379
- ].map((fn9) => ToolId5.make(fn9.key))
2380
- });
2381
- var research_blueprint_default = blueprint5;
2382
-
2383
- // src/blueprints/research/index.ts
2384
- var research_default2 = research_blueprint_default;
2385
-
2386
- // src/blueprints/websearch/websearch-blueprint.ts
2387
- import { ToolId as ToolId6 } from "@dxos/ai";
2388
- import { Blueprint as Blueprint6 } from "@dxos/blueprints";
2389
- import { Obj as Obj14, Ref as Ref11 } from "@dxos/echo";
2390
- import { DataType as DataType12 } from "@dxos/schema";
2391
- var blueprint6 = Obj14.make(Blueprint6.Blueprint, {
2392
- key: "dxos.org/blueprint/web-search",
2393
- name: "Web Search",
2394
- description: "Search the web.",
2395
- instructions: {
2396
- source: Ref11.make(DataType12.makeText(""))
2397
- },
2398
- tools: [
2399
- ToolId6.make("AnthropicWebSearch")
2400
- ]
2401
- });
2402
- var websearch_blueprint_default = blueprint6;
2403
-
2404
- // src/blueprints/websearch/websearch-toolkit.ts
2405
- import * as Toolkit4 from "@effect/ai/Toolkit";
2406
- import * as AnthropicTool2 from "@effect/ai-anthropic/AnthropicTool";
2407
- var WebSearchToolkit = Toolkit4.make(AnthropicTool2.WebSearch_20250305({}));
2408
-
2409
- // src/blueprints/websearch/index.ts
2410
- var websearch_default = websearch_blueprint_default;
2411
-
2412
- // src/plugins.tsx
2413
- import * as Schema15 from "effect/Schema";
2414
- import React from "react";
2415
- import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
2416
- import { Type as Type3 } from "@dxos/echo";
2417
- import { JsonFilter } from "@dxos/react-ui-syntax-highlighter";
2418
- var MapSchema = Schema15.Struct({
2419
- coordinates: Type3.Format.GeoPoint
2420
- }).pipe(Type3.Obj({
2421
- typename: "example.com/type/Map",
2422
- version: "0.1.0"
2423
- }));
2424
- var isImage = (data) => false;
2425
- var capabilities = [
2426
- contributes(Capabilities.ReactSurface, createSurface({
2427
- id: "plugin-image",
2428
- role: "card--extrinsic",
2429
- filter: (data) => isImage(data.value),
2430
- component: ({ data }) => /* @__PURE__ */ React.createElement("img", {
2431
- className: "grow object-cover",
2432
- src: `data:image/jpeg;base64,${data.value.source.data}`,
2433
- alt: data.value.prompt ?? `Generated image [id=${data.value.id}]`
2434
- })
2435
- })),
2436
- //
2437
- // Default
2438
- //
2439
- contributes(Capabilities.ReactSurface, createSurface({
2440
- id: "plugin-default",
2441
- role: "card--extrinsic",
2442
- position: "fallback",
2443
- component: ({ role, data }) => /* @__PURE__ */ React.createElement(JsonFilter, {
2444
- data
2445
- })
2446
- }))
2447
- ];
2448
553
  export {
2449
- Agent,
2450
- design_default as DesignBlueprint,
2451
- Discord,
2452
- discord_default as DiscordBlueprint,
2453
- Document,
2454
- EntityExtraction,
2455
- Linear,
2456
- linear_default as LinearBlueprint,
2457
- LocalSearchHandler,
2458
- LocalSearchToolkit,
2459
- MapSchema,
2460
- planning_default as PlanningBlueprint,
2461
- Research,
2462
- research_default2 as ResearchBlueprint,
2463
- ResearchDataTypes,
2464
- ResearchGraph,
2465
- Subgraph,
2466
- Tasks,
2467
- websearch_default as WebSearchBlueprint,
2468
- WebSearchToolkit,
2469
- capabilities,
2470
- contextQueueLayerFromResearchGraph,
2471
- createExtractionSchema,
2472
- createResearchGraph,
2473
- findRelatedSchema,
2474
- getSanitizedSchemaName,
2475
- makeGraphWriterHandler,
2476
- makeGraphWriterToolkit,
2477
- queryResearchGraph,
2478
- sanitizeObjects,
2479
- syncObjects
554
+ mock_default as default
2480
555
  };
2481
- //# sourceMappingURL=index.mjs.map
556
+ //# sourceMappingURL=mock-JSY4GY77.mjs.map