@dxos/assistant 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f

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 (289) hide show
  1. package/dist/lib/browser/index.mjs +1983 -64
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +1976 -63
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +1984 -64
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/{src/bin → bin}/chat.d.ts.map +1 -1
  11. package/dist/types/src/blueprint/blueprint.d.ts +79 -0
  12. package/dist/types/src/blueprint/blueprint.d.ts.map +1 -0
  13. package/dist/types/src/blueprint/blueprint.test.d.ts +2 -0
  14. package/dist/types/src/blueprint/blueprint.test.d.ts.map +1 -0
  15. package/dist/types/src/blueprint/index.d.ts +4 -0
  16. package/dist/types/src/blueprint/index.d.ts.map +1 -0
  17. package/dist/types/src/blueprint/logger.d.ts +3 -0
  18. package/dist/types/src/blueprint/logger.d.ts.map +1 -0
  19. package/dist/types/src/{ai-service/parser.d.ts → blueprint/machine.d.ts} +46 -68
  20. package/dist/types/src/blueprint/machine.d.ts.map +1 -0
  21. package/dist/types/src/blueprint/test-data.d.ts +3 -0
  22. package/dist/types/src/blueprint/test-data.d.ts.map +1 -0
  23. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +4 -0
  24. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +1 -0
  25. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +2 -0
  26. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +1 -0
  27. package/dist/types/src/extraction/extraction-llm-function/index.d.ts +2 -0
  28. package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +1 -0
  29. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +210 -0
  30. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -0
  31. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +2 -0
  32. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +1 -0
  33. package/dist/types/src/extraction/extraction-ner-function/index.d.ts +3 -0
  34. package/dist/types/src/extraction/extraction-ner-function/index.d.ts.map +1 -0
  35. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts +14 -0
  36. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -0
  37. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.test.d.ts +2 -0
  38. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.test.d.ts.map +1 -0
  39. package/dist/types/src/extraction/extraction.d.ts +242 -0
  40. package/dist/types/src/extraction/extraction.d.ts.map +1 -0
  41. package/dist/types/src/extraction/index.d.ts +5 -0
  42. package/dist/types/src/extraction/index.d.ts.map +1 -0
  43. package/dist/types/src/extraction/quotes.d.ts +15 -0
  44. package/dist/types/src/extraction/quotes.d.ts.map +1 -0
  45. package/dist/types/src/extraction/quotes.test.d.ts +2 -0
  46. package/dist/types/src/extraction/quotes.test.d.ts.map +1 -0
  47. package/dist/types/src/index.d.ts +4 -2
  48. package/dist/types/src/index.d.ts.map +1 -1
  49. package/dist/types/src/research/exa.d.ts +7 -0
  50. package/dist/types/src/research/exa.d.ts.map +1 -0
  51. package/dist/types/src/research/graph.d.ts +39 -0
  52. package/dist/types/src/research/graph.d.ts.map +1 -0
  53. package/dist/types/src/research/graph.test.d.ts +2 -0
  54. package/dist/types/src/research/graph.test.d.ts.map +1 -0
  55. package/dist/types/src/research/index.d.ts +4 -0
  56. package/dist/types/src/research/index.d.ts.map +1 -0
  57. package/dist/types/src/research/research.d.ts +10 -0
  58. package/dist/types/src/research/research.d.ts.map +1 -0
  59. package/dist/types/src/research/research.test.d.ts.map +1 -0
  60. package/dist/types/src/session/index.d.ts +0 -1
  61. package/dist/types/src/session/index.d.ts.map +1 -1
  62. package/dist/types/src/session/session.d.ts +47 -22
  63. package/dist/types/src/session/session.d.ts.map +1 -1
  64. package/dist/types/src/session/version-pin.d.ts +3 -4
  65. package/dist/types/src/session/version-pin.d.ts.map +1 -1
  66. package/dist/types/src/summarization/summarization.test.d.ts +2 -0
  67. package/dist/types/src/summarization/summarization.test.d.ts.map +1 -0
  68. package/dist/types/src/testing/exa-search-1748337321991.d.ts +38 -0
  69. package/dist/types/src/testing/exa-search-1748337321991.d.ts.map +1 -0
  70. package/dist/types/src/testing/exa-search-1748337331526.d.ts +37 -0
  71. package/dist/types/src/testing/exa-search-1748337331526.d.ts.map +1 -0
  72. package/dist/types/src/testing/exa-search-1748337344119.d.ts +58 -0
  73. package/dist/types/src/testing/exa-search-1748337344119.d.ts.map +1 -0
  74. package/dist/types/src/testing/index.d.ts +2 -7
  75. package/dist/types/src/testing/index.d.ts.map +1 -1
  76. package/dist/types/src/types.d.ts +3 -0
  77. package/dist/types/src/types.d.ts.map +1 -0
  78. package/package.json +22 -38
  79. package/src/blueprint/blueprint.test.ts +142 -0
  80. package/src/blueprint/blueprint.ts +95 -0
  81. package/src/blueprint/index.ts +7 -0
  82. package/src/blueprint/logger.ts +66 -0
  83. package/src/blueprint/machine.ts +208 -0
  84. package/src/blueprint/test-data.ts +55 -0
  85. package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +95 -0
  86. package/src/extraction/extraction-llm-function/extraction-llm-function.ts +64 -0
  87. package/src/extraction/extraction-llm-function/index.ts +5 -0
  88. package/src/extraction/extraction-llm-function/instructions.tpl +28 -0
  89. package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +115 -0
  90. package/src/extraction/extraction-ner-function/extraction-ner-function.ts +54 -0
  91. package/src/extraction/extraction-ner-function/index.ts +6 -0
  92. package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +94 -0
  93. package/src/extraction/extraction-ner-function/named-entity-recognition.ts +97 -0
  94. package/src/extraction/extraction.ts +75 -0
  95. package/src/extraction/index.ts +8 -0
  96. package/src/extraction/quotes.test.ts +27 -0
  97. package/src/extraction/quotes.ts +57 -0
  98. package/src/index.ts +4 -4
  99. package/src/research/exa.ts +100 -0
  100. package/src/research/graph.test.ts +15 -0
  101. package/src/research/graph.ts +291 -0
  102. package/src/research/index.ts +7 -0
  103. package/src/research/instructions-research.tpl +97 -0
  104. package/src/research/research.test.ts +189 -0
  105. package/src/research/research.ts +89 -0
  106. package/src/session/index.ts +0 -1
  107. package/src/session/session.test.ts +7 -7
  108. package/src/session/session.ts +46 -19
  109. package/src/session/version-pin.ts +2 -3
  110. package/src/summarization/summarization.test.ts +216 -0
  111. package/src/testing/exa-search-1748337321991.ts +131 -0
  112. package/src/testing/exa-search-1748337331526.ts +144 -0
  113. package/src/testing/exa-search-1748337344119.ts +133 -0
  114. package/src/testing/index.ts +8 -8
  115. package/src/types.ts +8 -0
  116. package/src/typings.d.ts +8 -0
  117. package/dist/lib/browser/chunk-B4HAWUFW.mjs +0 -2786
  118. package/dist/lib/browser/chunk-B4HAWUFW.mjs.map +0 -7
  119. package/dist/lib/browser/testing/index.mjs +0 -658
  120. package/dist/lib/browser/testing/index.mjs.map +0 -7
  121. package/dist/lib/node/chunk-NOB7CIIC.cjs +0 -2791
  122. package/dist/lib/node/chunk-NOB7CIIC.cjs.map +0 -7
  123. package/dist/lib/node/testing/index.cjs +0 -672
  124. package/dist/lib/node/testing/index.cjs.map +0 -7
  125. package/dist/lib/node-esm/chunk-SAWYU3V5.mjs +0 -2788
  126. package/dist/lib/node-esm/chunk-SAWYU3V5.mjs.map +0 -7
  127. package/dist/lib/node-esm/testing/index.mjs +0 -659
  128. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  129. package/dist/types/src/ai-service/client.test.d.ts +0 -2
  130. package/dist/types/src/ai-service/client.test.d.ts.map +0 -1
  131. package/dist/types/src/ai-service/defs.d.ts +0 -9
  132. package/dist/types/src/ai-service/defs.d.ts.map +0 -1
  133. package/dist/types/src/ai-service/edge-client.d.ts +0 -18
  134. package/dist/types/src/ai-service/edge-client.d.ts.map +0 -1
  135. package/dist/types/src/ai-service/index.d.ts +0 -10
  136. package/dist/types/src/ai-service/index.d.ts.map +0 -1
  137. package/dist/types/src/ai-service/message-collector.d.ts +0 -82
  138. package/dist/types/src/ai-service/message-collector.d.ts.map +0 -1
  139. package/dist/types/src/ai-service/ollama-client.d.ts +0 -43
  140. package/dist/types/src/ai-service/ollama-client.d.ts.map +0 -1
  141. package/dist/types/src/ai-service/parser.d.ts.map +0 -1
  142. package/dist/types/src/ai-service/service.d.ts +0 -25
  143. package/dist/types/src/ai-service/service.d.ts.map +0 -1
  144. package/dist/types/src/ai-service/stream.d.ts +0 -40
  145. package/dist/types/src/ai-service/stream.d.ts.map +0 -1
  146. package/dist/types/src/ai-service/stream.test.d.ts +0 -2
  147. package/dist/types/src/ai-service/stream.test.d.ts.map +0 -1
  148. package/dist/types/src/ai-service/testing/index.d.ts +0 -3
  149. package/dist/types/src/ai-service/testing/index.d.ts.map +0 -1
  150. package/dist/types/src/ai-service/testing/mock.d.ts +0 -11
  151. package/dist/types/src/ai-service/testing/mock.d.ts.map +0 -1
  152. package/dist/types/src/ai-service/testing/test-stream.d.ts +0 -7
  153. package/dist/types/src/ai-service/testing/test-stream.d.ts.map +0 -1
  154. package/dist/types/src/ai-service/transform.d.ts +0 -27
  155. package/dist/types/src/ai-service/transform.d.ts.map +0 -1
  156. package/dist/types/src/ai-service/types.d.ts +0 -210
  157. package/dist/types/src/ai-service/types.d.ts.map +0 -1
  158. package/dist/types/src/ai-service/util/index.d.ts +0 -2
  159. package/dist/types/src/ai-service/util/index.d.ts.map +0 -1
  160. package/dist/types/src/ai-service/util/sse.d.ts +0 -39
  161. package/dist/types/src/ai-service/util/sse.d.ts.map +0 -1
  162. package/dist/types/src/experimental/conversation/conversation.d.ts +0 -61
  163. package/dist/types/src/experimental/conversation/conversation.d.ts.map +0 -1
  164. package/dist/types/src/experimental/conversation/conversation.test.d.ts +0 -2
  165. package/dist/types/src/experimental/conversation/conversation.test.d.ts.map +0 -1
  166. package/dist/types/src/experimental/conversation/index.d.ts +0 -2
  167. package/dist/types/src/experimental/conversation/index.d.ts.map +0 -1
  168. package/dist/types/src/experimental/conversation/types.d.ts +0 -78
  169. package/dist/types/src/experimental/conversation/types.d.ts.map +0 -1
  170. package/dist/types/src/experimental/cypher/ast.d.ts +0 -56
  171. package/dist/types/src/experimental/cypher/ast.d.ts.map +0 -1
  172. package/dist/types/src/experimental/cypher/combinators.d.ts +0 -14
  173. package/dist/types/src/experimental/cypher/combinators.d.ts.map +0 -1
  174. package/dist/types/src/experimental/cypher/combinators.test.d.ts +0 -2
  175. package/dist/types/src/experimental/cypher/combinators.test.d.ts.map +0 -1
  176. package/dist/types/src/experimental/cypher/echo-data-source.d.ts +0 -16
  177. package/dist/types/src/experimental/cypher/echo-data-source.d.ts.map +0 -1
  178. package/dist/types/src/experimental/cypher/execution-plan.d.ts +0 -49
  179. package/dist/types/src/experimental/cypher/execution-plan.d.ts.map +0 -1
  180. package/dist/types/src/experimental/cypher/execution-plan.test.d.ts +0 -2
  181. package/dist/types/src/experimental/cypher/execution-plan.test.d.ts.map +0 -1
  182. package/dist/types/src/experimental/cypher/index.d.ts +0 -5
  183. package/dist/types/src/experimental/cypher/index.d.ts.map +0 -1
  184. package/dist/types/src/experimental/cypher/parjs.d.ts +0 -4
  185. package/dist/types/src/experimental/cypher/parjs.d.ts.map +0 -1
  186. package/dist/types/src/experimental/cypher/parser.d.ts +0 -6
  187. package/dist/types/src/experimental/cypher/parser.d.ts.map +0 -1
  188. package/dist/types/src/experimental/cypher/query-executor.d.ts +0 -26
  189. package/dist/types/src/experimental/cypher/query-executor.d.ts.map +0 -1
  190. package/dist/types/src/experimental/cypher/query-executor.test.d.ts +0 -2
  191. package/dist/types/src/experimental/cypher/query-executor.test.d.ts.map +0 -1
  192. package/dist/types/src/experimental/cypher/schema.d.ts +0 -12
  193. package/dist/types/src/experimental/cypher/schema.d.ts.map +0 -1
  194. package/dist/types/src/experimental/cypher/schema.test.d.ts +0 -2
  195. package/dist/types/src/experimental/cypher/schema.test.d.ts.map +0 -1
  196. package/dist/types/src/experimental/index.d.ts +0 -3
  197. package/dist/types/src/experimental/index.d.ts.map +0 -1
  198. package/dist/types/src/experimental/ner/ner.test.d.ts +0 -2
  199. package/dist/types/src/experimental/ner/ner.test.d.ts.map +0 -1
  200. package/dist/types/src/experimental/research/exa.d.ts +0 -6
  201. package/dist/types/src/experimental/research/exa.d.ts.map +0 -1
  202. package/dist/types/src/experimental/research/research.test.d.ts.map +0 -1
  203. package/dist/types/src/session/tools.d.ts +0 -18
  204. package/dist/types/src/session/tools.d.ts.map +0 -1
  205. package/dist/types/src/testing/artifacts.test.d.ts +0 -1
  206. package/dist/types/src/testing/artifacts.test.d.ts.map +0 -1
  207. package/dist/types/src/testing/data.d.ts +0 -2
  208. package/dist/types/src/testing/data.d.ts.map +0 -1
  209. package/dist/types/src/testing/defs.d.ts +0 -5
  210. package/dist/types/src/testing/defs.d.ts.map +0 -1
  211. package/dist/types/src/testing/logger.d.ts +0 -12
  212. package/dist/types/src/testing/logger.d.ts.map +0 -1
  213. package/dist/types/src/testing/object-extraction.test.d.ts +0 -1
  214. package/dist/types/src/testing/object-extraction.test.d.ts.map +0 -1
  215. package/dist/types/src/testing/ollama.d.ts +0 -6
  216. package/dist/types/src/testing/ollama.d.ts.map +0 -1
  217. package/dist/types/src/testing/printer.d.ts +0 -6
  218. package/dist/types/src/testing/printer.d.ts.map +0 -1
  219. package/dist/types/src/testing/query-promts.d.ts +0 -5
  220. package/dist/types/src/testing/query-promts.d.ts.map +0 -1
  221. package/dist/types/src/testing/query.test.d.ts +0 -2
  222. package/dist/types/src/testing/query.test.d.ts.map +0 -1
  223. package/dist/types/src/testing/test-data.d.ts +0 -29
  224. package/dist/types/src/testing/test-data.d.ts.map +0 -1
  225. package/dist/types/src/testing/test-schema.d.ts +0 -52
  226. package/dist/types/src/testing/test-schema.d.ts.map +0 -1
  227. package/dist/types/src/util/index.d.ts +0 -2
  228. package/dist/types/src/util/index.d.ts.map +0 -1
  229. package/dist/types/src/util/trim.d.ts +0 -5
  230. package/dist/types/src/util/trim.d.ts.map +0 -1
  231. package/src/ai-service/client.test.ts +0 -247
  232. package/src/ai-service/defs.ts +0 -39
  233. package/src/ai-service/edge-client.ts +0 -60
  234. package/src/ai-service/index.ts +0 -13
  235. package/src/ai-service/message-collector.ts +0 -84
  236. package/src/ai-service/ollama-client.ts +0 -506
  237. package/src/ai-service/parser.ts +0 -369
  238. package/src/ai-service/service.ts +0 -31
  239. package/src/ai-service/stream.test.ts +0 -125
  240. package/src/ai-service/stream.ts +0 -118
  241. package/src/ai-service/testing/index.ts +0 -6
  242. package/src/ai-service/testing/mock.ts +0 -30
  243. package/src/ai-service/testing/test-stream.ts +0 -93
  244. package/src/ai-service/transform.ts +0 -121
  245. package/src/ai-service/types.ts +0 -112
  246. package/src/ai-service/util/index.ts +0 -5
  247. package/src/ai-service/util/sse.ts +0 -341
  248. package/src/bin/chat.ts +0 -79
  249. package/src/experimental/conversation/conversation.test.ts +0 -73
  250. package/src/experimental/conversation/conversation.ts +0 -142
  251. package/src/experimental/conversation/index.ts +0 -5
  252. package/src/experimental/conversation/types.ts +0 -126
  253. package/src/experimental/cypher/ast.ts +0 -75
  254. package/src/experimental/cypher/combinators.test.ts +0 -137
  255. package/src/experimental/cypher/combinators.ts +0 -148
  256. package/src/experimental/cypher/echo-data-source.ts +0 -105
  257. package/src/experimental/cypher/execution-plan.test.ts +0 -44
  258. package/src/experimental/cypher/execution-plan.ts +0 -208
  259. package/src/experimental/cypher/index.ts +0 -8
  260. package/src/experimental/cypher/parjs-shims.d.ts +0 -10
  261. package/src/experimental/cypher/parjs.ts +0 -10
  262. package/src/experimental/cypher/parser.ts +0 -19
  263. package/src/experimental/cypher/query-executor.test.ts +0 -47
  264. package/src/experimental/cypher/query-executor.ts +0 -145
  265. package/src/experimental/cypher/schema.test.ts +0 -17
  266. package/src/experimental/cypher/schema.ts +0 -86
  267. package/src/experimental/index.ts +0 -6
  268. package/src/experimental/ner/ner.test.ts +0 -163
  269. package/src/experimental/research/exa.ts +0 -38
  270. package/src/experimental/research/instructions.tpl +0 -64
  271. package/src/experimental/research/research.test.ts +0 -263
  272. package/src/session/tools.ts +0 -117
  273. package/src/testing/artifacts.test.ts +0 -182
  274. package/src/testing/data.ts +0 -13
  275. package/src/testing/defs.ts +0 -9
  276. package/src/testing/logger.ts +0 -129
  277. package/src/testing/object-extraction.test.ts +0 -71
  278. package/src/testing/ollama.ts +0 -15
  279. package/src/testing/printer.ts +0 -41
  280. package/src/testing/query-promts.ts +0 -75
  281. package/src/testing/query.test.ts +0 -88
  282. package/src/testing/test-data.ts +0 -379
  283. package/src/testing/test-schema.ts +0 -79
  284. package/src/util/index.ts +0 -5
  285. package/src/util/trim.ts +0 -15
  286. package/vendor/parjs-browser.mjs +0 -4
  287. package/vendor/parjs-default.mjs +0 -8
  288. /package/dist/types/{src/bin → bin}/chat.d.ts +0 -0
  289. /package/dist/types/src/{experimental/research → research}/research.test.d.ts +0 -0
@@ -1,210 +0,0 @@
1
- import { Schema } from 'effect';
2
- import { Message, type MessageContentBlock } from '@dxos/artifact';
3
- import { type ObjectId } from '@dxos/echo-schema';
4
- export declare const createArtifactElement: (id: ObjectId) => string;
5
- export declare const LLMModel: Schema.Literal<["@anthropic/claude-3-5-haiku-20241022", "@anthropic/claude-3-5-sonnet-20241022", "@anthropic/claude-3-7-sonnet-20250219", "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b", "@hf/nousresearch/hermes-2-pro-mistral-7b", "@ollama/llama-3-1-nemotron-70b-instruct", "@ollama/llama-3-1-nemotron-mini-4b-instruct", "@ollama/llama-3-2-3b", "llama3.2:1b", "llama3:70b", "deepseek-r1:latest"]>;
6
- export type LLMModel = Schema.Schema.Type<typeof LLMModel>;
7
- export declare const ToolTypes: Readonly<{
8
- TextToImage: "text_to_image";
9
- }>;
10
- /**
11
- * Client GPT request.
12
- */
13
- export declare const GenerateRequest: Schema.Struct<{
14
- /**
15
- * Preferred model or system default.
16
- */
17
- model: Schema.optional<Schema.Literal<["@anthropic/claude-3-5-haiku-20241022", "@anthropic/claude-3-5-sonnet-20241022", "@anthropic/claude-3-7-sonnet-20250219", "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b", "@hf/nousresearch/hermes-2-pro-mistral-7b", "@ollama/llama-3-1-nemotron-70b-instruct", "@ollama/llama-3-1-nemotron-mini-4b-instruct", "@ollama/llama-3-2-3b", "llama3.2:1b", "llama3:70b", "deepseek-r1:latest"]>>;
18
- /**
19
- * Tools available for the LLM.
20
- */
21
- tools: Schema.optional<Schema.mutable<Schema.Array$<Schema.Struct<{
22
- name: typeof Schema.String;
23
- namespace: Schema.optional<typeof Schema.String>;
24
- function: Schema.optional<typeof Schema.String>;
25
- type: Schema.optional<typeof Schema.String>;
26
- caption: Schema.optional<typeof Schema.String>;
27
- description: Schema.optional<typeof Schema.String>;
28
- parameters: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
29
- options: Schema.optional<typeof Schema.Any>;
30
- }>>>>;
31
- /**
32
- * System instructions to the LLM.
33
- */
34
- systemPrompt: Schema.optional<typeof Schema.String>;
35
- /**
36
- * History of messages to include in the context window.
37
- */
38
- history: Schema.optional<Schema.Array$<import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
39
- id: import("@dxos/echo-schema").ObjectIdClass;
40
- role: Schema.refine<"user" | "assistant", Schema.Schema<string, string, never>>;
41
- content: Schema.mutable<Schema.Array$<Schema.Union<[Schema.mutable<Schema.extend<Schema.Struct<{
42
- pending: Schema.optional<typeof Schema.Boolean>;
43
- }>, Schema.Struct<{
44
- type: Schema.Literal<["text"]>;
45
- disposition: Schema.optional<typeof Schema.String>;
46
- text: typeof Schema.String;
47
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
48
- pending: Schema.optional<typeof Schema.Boolean>;
49
- }>, Schema.Struct<{
50
- type: Schema.Literal<["json"]>;
51
- disposition: Schema.optional<typeof Schema.String>;
52
- json: typeof Schema.String;
53
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
54
- pending: Schema.optional<typeof Schema.Boolean>;
55
- }>, Schema.Struct<{
56
- type: Schema.Literal<["image"]>;
57
- id: Schema.optional<typeof Schema.String>;
58
- source: Schema.optional<Schema.mutable<Schema.Struct<{
59
- type: Schema.Literal<["base64"]>;
60
- mediaType: typeof Schema.String;
61
- data: typeof Schema.String;
62
- }>>>;
63
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
64
- pending: Schema.optional<typeof Schema.Boolean>;
65
- }>, Schema.Struct<{
66
- type: Schema.Literal<["tool_use"]>;
67
- id: typeof Schema.String;
68
- name: typeof Schema.String;
69
- input: typeof Schema.Unknown;
70
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
71
- pending: Schema.optional<typeof Schema.Boolean>;
72
- }>, Schema.Struct<{
73
- type: Schema.Literal<["tool_result"]>;
74
- toolUseId: typeof Schema.String;
75
- content: typeof Schema.String;
76
- isError: Schema.optional<typeof Schema.Boolean>;
77
- }>>>]>>>;
78
- }>, {}>>>;
79
- /**
80
- * Current request.
81
- */
82
- prompt: Schema.optional<import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
83
- id: import("@dxos/echo-schema").ObjectIdClass;
84
- role: Schema.refine<"user" | "assistant", Schema.Schema<string, string, never>>;
85
- content: Schema.mutable<Schema.Array$<Schema.Union<[Schema.mutable<Schema.extend<Schema.Struct<{
86
- pending: Schema.optional<typeof Schema.Boolean>;
87
- }>, Schema.Struct<{
88
- type: Schema.Literal<["text"]>;
89
- disposition: Schema.optional<typeof Schema.String>;
90
- text: typeof Schema.String;
91
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
92
- pending: Schema.optional<typeof Schema.Boolean>;
93
- }>, Schema.Struct<{
94
- type: Schema.Literal<["json"]>;
95
- disposition: Schema.optional<typeof Schema.String>;
96
- json: typeof Schema.String;
97
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
98
- pending: Schema.optional<typeof Schema.Boolean>;
99
- }>, Schema.Struct<{
100
- type: Schema.Literal<["image"]>;
101
- id: Schema.optional<typeof Schema.String>;
102
- source: Schema.optional<Schema.mutable<Schema.Struct<{
103
- type: Schema.Literal<["base64"]>;
104
- mediaType: typeof Schema.String;
105
- data: typeof Schema.String;
106
- }>>>;
107
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
108
- pending: Schema.optional<typeof Schema.Boolean>;
109
- }>, Schema.Struct<{
110
- type: Schema.Literal<["tool_use"]>;
111
- id: typeof Schema.String;
112
- name: typeof Schema.String;
113
- input: typeof Schema.Unknown;
114
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
115
- pending: Schema.optional<typeof Schema.Boolean>;
116
- }>, Schema.Struct<{
117
- type: Schema.Literal<["tool_result"]>;
118
- toolUseId: typeof Schema.String;
119
- content: typeof Schema.String;
120
- isError: Schema.optional<typeof Schema.Boolean>;
121
- }>>>]>>>;
122
- }>, {}>>;
123
- }>;
124
- export type GenerateRequest = Schema.Schema.Type<typeof GenerateRequest>;
125
- /**
126
- * Non-streaming response.
127
- */
128
- export declare const GenerateResponse: Schema.Struct<{
129
- messages: Schema.Array$<import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
130
- id: import("@dxos/echo-schema").ObjectIdClass;
131
- role: Schema.refine<"user" | "assistant", Schema.Schema<string, string, never>>;
132
- content: Schema.mutable<Schema.Array$<Schema.Union<[Schema.mutable<Schema.extend<Schema.Struct<{
133
- pending: Schema.optional<typeof Schema.Boolean>;
134
- }>, Schema.Struct<{
135
- type: Schema.Literal<["text"]>;
136
- disposition: Schema.optional<typeof Schema.String>;
137
- text: typeof Schema.String;
138
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
139
- pending: Schema.optional<typeof Schema.Boolean>;
140
- }>, Schema.Struct<{
141
- type: Schema.Literal<["json"]>;
142
- disposition: Schema.optional<typeof Schema.String>;
143
- json: typeof Schema.String;
144
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
145
- pending: Schema.optional<typeof Schema.Boolean>;
146
- }>, Schema.Struct<{
147
- type: Schema.Literal<["image"]>;
148
- id: Schema.optional<typeof Schema.String>;
149
- source: Schema.optional<Schema.mutable<Schema.Struct<{
150
- type: Schema.Literal<["base64"]>;
151
- mediaType: typeof Schema.String;
152
- data: typeof Schema.String;
153
- }>>>;
154
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
155
- pending: Schema.optional<typeof Schema.Boolean>;
156
- }>, Schema.Struct<{
157
- type: Schema.Literal<["tool_use"]>;
158
- id: typeof Schema.String;
159
- name: typeof Schema.String;
160
- input: typeof Schema.Unknown;
161
- }>>>, Schema.mutable<Schema.extend<Schema.Struct<{
162
- pending: Schema.optional<typeof Schema.Boolean>;
163
- }>, Schema.Struct<{
164
- type: Schema.Literal<["tool_result"]>;
165
- toolUseId: typeof Schema.String;
166
- content: typeof Schema.String;
167
- isError: Schema.optional<typeof Schema.Boolean>;
168
- }>>>]>>>;
169
- }>, {}>>;
170
- /**
171
- * Number of tokens used in the response.
172
- */
173
- tokenCount: Schema.optional<typeof Schema.Number>;
174
- }>;
175
- export type GenerateResponse = Schema.Schema.Type<typeof GenerateResponse>;
176
- /**
177
- * Server-Sent Events (SSE) stream from the AI service.
178
- * https://docs.anthropic.com/en/api/streaming
179
- * https://platform.openai.com/docs/api-reference/streaming
180
- * https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events
181
- */
182
- export type GenerationStreamEvent = {
183
- type: 'message_start';
184
- message: Omit<Message, 'spaceId' | 'threadId'>;
185
- } | {
186
- type: 'message_delta';
187
- delta: {
188
- stopReason: 'tool_use' | 'end_turn';
189
- };
190
- } | {
191
- type: 'message_stop';
192
- } | {
193
- type: 'content_block_start';
194
- index: number;
195
- content: MessageContentBlock;
196
- } | {
197
- type: 'content_block_delta';
198
- index: number;
199
- delta: {
200
- type: 'text_delta';
201
- text: string;
202
- } | {
203
- type: 'input_json_delta';
204
- partial_json: string;
205
- };
206
- } | {
207
- type: 'content_block_stop';
208
- index: number;
209
- };
210
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAQ,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIlD,eAAO,MAAM,qBAAqB,GAAI,IAAI,QAAQ,WAA4B,CAAC;AAE/E,eAAO,MAAM,QAAQ,6YAAmE,CAAC;AAEzF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE3D,eAAO,MAAM,SAAS;;EAIpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;IAC1B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAG3B;;OAEG;;EAEH,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3E;;;;;GAKG;AAEH,MAAM,MAAM,qBAAqB,GAC7B;IAEE,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC;CAChD,GACD;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE;QACL,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;KACrC,CAAC;CACH,GACD;IACE,IAAI,EAAE,cAAc,CAAC;CACtB,GACD;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,mBAAmB,CAAC;CAC9B,GACD;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EACD;QACE,IAAI,EAAE,YAAY,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;KACd,GACD;QACE,IAAI,EAAE,kBAAkB,CAAC;QACzB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACP,GACD;IACE,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './sse';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,OAAO,CAAC"}
@@ -1,39 +0,0 @@
1
- /**
2
- * Server sent events (SSE) iterator.
3
- * @param response
4
- * @param controller
5
- */
6
- export declare function iterSSEMessages(response: Response, controller: AbortController): AsyncGenerator<ServerSentEvent, void, unknown>;
7
- export type ServerSentEvent = {
8
- event: string | null;
9
- data: string;
10
- raw: string[];
11
- };
12
- /** This is an internal helper function that's just used for testing */
13
- export declare const _decodeChunks: (chunks: string[]) => string[];
14
- /**
15
- * Most browsers don't yet have async iterable support for ReadableStream,
16
- * and Node has a very different way of reading bytes from its "ReadableStream".
17
- *
18
- * This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
19
- */
20
- export declare function readableStreamAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
21
- export type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined;
22
- /**
23
- * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
24
- * reading lines from text.
25
- *
26
- * https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
27
- */
28
- export declare class LineDecoder {
29
- static NEWLINE_CHARS: Set<string>;
30
- static NEWLINE_REGEXP: RegExp;
31
- buffer: string[];
32
- trailingCR: boolean;
33
- textDecoder: any;
34
- constructor();
35
- decode(chunk: Bytes): string[];
36
- decodeText(bytes: Bytes): string;
37
- flush(): string[];
38
- }
39
- //# sourceMappingURL=sse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/util/sse.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAuB,eAAe,CACpC,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,eAAe,GAC1B,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,OAAO,CAAC,CAyBhD;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,EAAE,CAAC;CACf,CAAC;AA8HF,uEAAuE;AACvE,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,KAAG,MAAM,EAQtD,CAAC;AAWF;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,qBAAqB,CAAC,CAAC,CAAC,CA6BpF;AAED,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAElF;;;;;GAKG;AACH,qBAAa,WAAW;IAEtB,MAAM,CAAC,aAAa,cAAyB;IAC7C,MAAM,CAAC,cAAc,SAAkB;IAEvC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,GAAG,CAAC;;IAOjB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE;IA0C9B,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAuChC,KAAK,IAAI,MAAM,EAAE;CAUlB"}
@@ -1,61 +0,0 @@
1
- import { type Message, type Tool } from '@dxos/artifact';
2
- import { ObjectId } from '@dxos/echo-schema';
3
- import { type SpaceId } from '@dxos/keys';
4
- import { type AIServiceClient, type GenerationStreamEvent, type LLMModel } from '../../ai-service';
5
- export type CreateLLMConversationParams = {
6
- model: LLMModel;
7
- spaceId?: SpaceId;
8
- threadId?: ObjectId;
9
- /**
10
- * System prompt that specifies instructions for the LLM.
11
- */
12
- system?: string;
13
- tools: Tool[];
14
- history?: Message[];
15
- client: AIServiceClient;
16
- logger?: (event: ConversationEvent) => void;
17
- };
18
- export type ConversationEvent = {
19
- type: 'message';
20
- message: Message;
21
- } | GenerationStreamEvent;
22
- export declare const runLLM: (params: CreateLLMConversationParams) => Promise<{
23
- result: any;
24
- history: {
25
- readonly id: string;
26
- role: "user" | "assistant";
27
- content: ({
28
- pending?: boolean | undefined;
29
- type: "text";
30
- disposition?: string | undefined;
31
- text: string;
32
- } | {
33
- pending?: boolean | undefined;
34
- type: "json";
35
- disposition?: string | undefined;
36
- json: string;
37
- } | {
38
- pending?: boolean | undefined;
39
- type: "image";
40
- id?: string | undefined;
41
- source?: {
42
- type: "base64";
43
- mediaType: string;
44
- data: string;
45
- } | undefined;
46
- } | {
47
- pending?: boolean | undefined;
48
- name: string;
49
- type: "tool_use";
50
- id: string;
51
- input: unknown;
52
- } | {
53
- pending?: boolean | undefined;
54
- type: "tool_result";
55
- content: string;
56
- toolUseId: string;
57
- isError?: boolean | undefined;
58
- })[];
59
- }[];
60
- }>;
61
- //# sourceMappingURL=conversation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/conversation/conversation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEnG,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,QAAQ,CAAC;IAEhB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,GACD,qBAAqB,CAAC;AAG1B,eAAO,MAAM,MAAM,GAAU,QAAQ,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuG/D,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=conversation.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"conversation.test.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/conversation/conversation.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from './conversation';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/conversation/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC"}
@@ -1,78 +0,0 @@
1
- import { Schema } from 'effect';
2
- import { type Message, type MessageContentBlock } from '@dxos/artifact';
3
- import { JsonSchemaType } from '@dxos/echo-schema';
4
- export declare const createUserMessage: (text: string) => Message;
5
- /**
6
- * @deprecated Use {@link LLMTool} instead.
7
- */
8
- export declare const ToolDefinition: Schema.Struct<{
9
- name: typeof Schema.String;
10
- description: typeof Schema.String;
11
- parameters: Schema.Schema<JsonSchemaType, JsonSchemaType, never>;
12
- execute: typeof Schema.Any;
13
- }>;
14
- /**
15
- * @deprecated Use {@link LLMTool} instead.
16
- */
17
- export type ToolDefinition = {
18
- name: string;
19
- description: string;
20
- parameters: JsonSchemaType;
21
- execute: (params: unknown, context: ToolExecutionContext) => Promise<ToolResult>;
22
- };
23
- declare global {
24
- /**
25
- * Extensions to the tool execution context.
26
- *
27
- * Different modules can extend this definition to add their own properties.
28
- *
29
- * @example
30
- * ```ts
31
- * declare global {
32
- * interface ToolContextExtensions {
33
- * chess: {
34
- * board: string;
35
- * };
36
- * }
37
- * }
38
- * ```
39
- *
40
- * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#global-augmentation
41
- */
42
- interface ToolContextExtensions {
43
- }
44
- }
45
- export type ToolExecutionContext = {
46
- extensions: ToolContextExtensions;
47
- };
48
- export type ToolResult = {
49
- kind: 'success';
50
- result: unknown;
51
- extractContentBlocks?: MessageContentBlock[];
52
- } | {
53
- kind: 'error';
54
- message: string;
55
- } | {
56
- kind: 'break';
57
- result: unknown;
58
- };
59
- export declare const ToolResult: Readonly<{
60
- /**
61
- * The tool execution was successful.
62
- * Gives the result back to the LLM.
63
- */
64
- Success: (result: unknown, extractContentBlocks?: MessageContentBlock[]) => ToolResult;
65
- Error: (message: string) => ToolResult;
66
- /**
67
- * Stop the conversation and return the result.
68
- */
69
- Break: (result: unknown) => ToolResult;
70
- }>;
71
- export type DefineToolParams<Params extends Schema.Schema.AnyNoContext> = {
72
- name: string;
73
- description: string;
74
- schema: Params;
75
- execute: (params: Schema.Schema.Type<Params>, context: ToolExecutionContext) => Promise<ToolResult>;
76
- };
77
- export declare const defineTool: <Params extends Schema.Schema.AnyNoContext>({ name, description, schema, execute, }: DefineToolParams<Params>) => ToolDefinition;
78
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/conversation/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAgB,cAAc,EAAY,MAAM,mBAAmB,CAAC;AAG3E,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,OAI/C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;EAKzB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CAClF,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,qBAAqB;KAAG;CACnC;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,oBAAoB,CAAC,EAAE,mBAAmB,EAAE,CAAA;CAAE,GAClF;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvC,eAAO,MAAM,UAAU;IACrB;;;OAGG;sBACe,OAAO,yBAAyB,mBAAmB,EAAE,KAAG,UAAU;qBAMnE,MAAM,KAAG,UAAU;IACpC;;OAEG;oBACa,OAAO,KAAG,UAAU;EACpC,CAAC;AAEH,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,IAAI;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACrG,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,MAAM,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,yCAKnE,gBAAgB,CAAC,MAAM,CAAC,KAAG,cAU7B,CAAC"}
@@ -1,56 +0,0 @@
1
- export interface AstNode<Kind extends string> {
2
- astKind: Kind;
3
- }
4
- export interface Identifier extends AstNode<'Identifier'> {
5
- name: string;
6
- }
7
- export interface Property {
8
- key: Identifier;
9
- value: StringLiteral;
10
- }
11
- export interface Properties extends AstNode<'Properties'> {
12
- properties: Property[];
13
- }
14
- export interface NodePattern extends AstNode<'NodePattern'> {
15
- variable: Identifier | null;
16
- label: Identifier;
17
- properties: Properties | null;
18
- }
19
- export interface RelationshipPattern extends AstNode<'RelationshipPattern'> {
20
- variable: Identifier | null;
21
- label: Identifier;
22
- properties: Properties | null;
23
- }
24
- export interface GraphPatternConnector extends AstNode<'GraphPatternConnector'> {
25
- direction: '-' | '->' | '<-';
26
- }
27
- export interface GraphPattern extends AstNode<'GraphPattern'> {
28
- segments: (NodePattern | RelationshipPattern)[] & {
29
- separators: GraphPatternConnector[];
30
- };
31
- }
32
- export interface MatchClause extends AstNode<'MatchClause'> {
33
- pattern: GraphPattern;
34
- }
35
- export interface StringLiteral extends AstNode<'StringLiteral'> {
36
- value: string;
37
- }
38
- export interface MemberExpression extends AstNode<'MemberExpression'> {
39
- path: Identifier[];
40
- }
41
- export interface EqualsPredicate extends AstNode<'EqualsPredicate'> {
42
- left: MemberExpression;
43
- right: StringLiteral;
44
- }
45
- export interface WhereClause extends AstNode<'WhereClause'> {
46
- predicates: EqualsPredicate[];
47
- }
48
- export interface ReturnClause extends AstNode<'ReturnClause'> {
49
- fields: MemberExpression[];
50
- }
51
- export interface CypherQuery extends AstNode<'CypherQuery'> {
52
- matchClause: MatchClause;
53
- whereClause: WhereClause | null;
54
- returnClause: ReturnClause;
55
- }
56
- //# sourceMappingURL=ast.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/ast.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,OAAO,CAAC,IAAI,SAAS,MAAM;IAC1C,OAAO,EAAE,IAAI,CAAC;CACf;AAED,MAAM,WAAW,UAAW,SAAQ,OAAO,CAAC,YAAY,CAAC;IACvD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,WAAW,UAAW,SAAQ,OAAO,CAAC,YAAY,CAAC;IACvD,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,aAAa,CAAC;IACzD,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAoB,SAAQ,OAAO,CAAC,qBAAqB,CAAC;IACzE,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAsB,SAAQ,OAAO,CAAC,uBAAuB,CAAC;IAC7E,SAAS,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,cAAc,CAAC;IAC3D,QAAQ,EAAE,CAAC,WAAW,GAAG,mBAAmB,CAAC,EAAE,GAAG;QAChD,UAAU,EAAE,qBAAqB,EAAE,CAAC;KACrC,CAAC;CACH;AAED,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,aAAa,CAAC;IACzD,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,aAAc,SAAQ,OAAO,CAAC,eAAe,CAAC;IAC7D,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAiB,SAAQ,OAAO,CAAC,kBAAkB,CAAC;IACnE,IAAI,EAAE,UAAU,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO,CAAC,iBAAiB,CAAC;IACjE,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,aAAa,CAAC;IACzD,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,cAAc,CAAC;IAC3D,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,aAAa,CAAC;IACzD,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,YAAY,CAAC;CAC5B"}
@@ -1,14 +0,0 @@
1
- import type { CypherQuery, GraphPattern, Identifier, MatchClause, NodePattern, Properties, Property, RelationshipPattern, ReturnClause, WhereClause } from './ast';
2
- import { Parjser } from './parjs';
3
- export declare const identifier: Parjser<Identifier>;
4
- export declare const label: Parjser<Identifier>;
5
- export declare const property: Parjser<Property>;
6
- export declare const properties: Parjser<Properties>;
7
- export declare const nodePattern: Parjser<NodePattern>;
8
- export declare const relationshipPattern: Parjser<RelationshipPattern>;
9
- export declare const graphPattern: Parjser<GraphPattern>;
10
- export declare const matchClause: Parjser<MatchClause>;
11
- export declare const whereClause: Parjser<WhereClause>;
12
- export declare const returnClause: Parjser<ReturnClause>;
13
- export declare const cypherQuery: Parjser<CypherQuery>;
14
- //# sourceMappingURL=combinators.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"combinators.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/combinators.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EAEX,YAAY,EAEZ,UAAU,EACV,WAAW,EAEX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,YAAY,EAEZ,WAAW,EACZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAA2B,MAAM,SAAS,CAAC;AAgB3D,eAAO,MAAM,UAAU,qBAEtB,CAAC;AAUF,eAAO,MAAM,KAAK,qBAAwD,CAAC;AAC3E,eAAO,MAAM,QAAQ,mBAGpB,CAAC;AACF,eAAO,MAAM,UAAU,qBAItB,CAAC;AACF,eAAO,MAAM,WAAW,sBAQvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,8BAa/B,CAAC;AAOF,eAAO,MAAM,YAAY,uBAIxB,CAAC;AAEF,eAAO,MAAM,WAAW,sBAIvB,CAAC;AAYF,eAAO,MAAM,WAAW,sBAOvB,CAAC;AAEF,eAAO,MAAM,YAAY,uBAaxB,CAAC;AAEF,eAAO,MAAM,WAAW,sBAUvB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=combinators.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"combinators.test.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/combinators.test.ts"],"names":[],"mappings":""}
@@ -1,16 +0,0 @@
1
- import { type EchoDatabase } from '@dxos/echo-db';
2
- import type { DataSource, Node, Relationship } from './query-executor';
3
- export declare class EchoDataSource implements DataSource {
4
- private readonly _db;
5
- constructor(_db: EchoDatabase);
6
- getNodes({ label }: {
7
- label?: string;
8
- }): Promise<Node[]>;
9
- getRelationships({ label }: {
10
- label?: string;
11
- }): Promise<Relationship[]>;
12
- private _getAllSchema;
13
- private _objectToNode;
14
- private _projectRefRelationship;
15
- }
16
- //# sourceMappingURL=echo-data-source.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"echo-data-source.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/echo-data-source.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,YAAY,EAA8B,MAAM,eAAe,CAAC;AAI9E,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGvE,qBAAa,cAAe,YAAW,UAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,YAAY;IAGxC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAgBxD,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;YA+BhE,aAAa;IAQ3B,OAAO,CAAC,aAAa;YAUP,uBAAuB;CAqBtC"}
@@ -1,49 +0,0 @@
1
- import type { JsonPath } from '@dxos/echo-schema';
2
- import type { ParsedQuery } from './parser';
3
- export type VariableName = string & {
4
- __VariableName: never;
5
- };
6
- export type ExecutionPlanStep = {
7
- type: 'NodeScan';
8
- label: string;
9
- into: VariableName;
10
- } | {
11
- type: 'FilterByLabel';
12
- variable: VariableName;
13
- label: string;
14
- } | {
15
- type: 'FilterByProperty';
16
- variable: VariableName;
17
- property: JsonPath;
18
- value: unknown;
19
- } | {
20
- /**
21
- * Scans (anchor)-[relationshipInto:label]->(nodeInto).
22
- */
23
- type: 'RelationshipScan';
24
- label: string;
25
- anchor: VariableName;
26
- relationshipInto: VariableName;
27
- nodeInto: VariableName;
28
- /**
29
- * `in`: (anchor)<-[relationshipInto:label]-(nodeInto)
30
- * `out`: (anchor)-[relationshipInto:label]->(nodeInto)
31
- * `both`: (anchor)-[relationshipInto:label]-(nodeInto)
32
- */
33
- direction: 'in' | 'out' | 'both';
34
- } | {
35
- type: 'ProduceResults';
36
- fields: {
37
- name: string;
38
- variable: VariableName;
39
- path: JsonPath;
40
- }[];
41
- };
42
- export type ExecutionPlan = {
43
- steps: ExecutionPlanStep[];
44
- output: {
45
- fields: string[];
46
- };
47
- };
48
- export declare const createExecutionPlan: (query: ParsedQuery) => ExecutionPlan;
49
- //# sourceMappingURL=execution-plan.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execution-plan.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/execution-plan.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAKlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,cAAc,EAAE,KAAK,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GACzB;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;CACpB,GACD;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB,GACD;IACE;;OAEG;IACH,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;IACrB,gBAAgB,EAAE,YAAY,CAAC;IAC/B,QAAQ,EAAE,YAAY,CAAC;IAEvB;;;;OAIG;IACH,SAAS,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;CAClC,GACD;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,YAAY,CAAC;QACvB,IAAI,EAAE,QAAQ,CAAC;KAChB,EAAE,CAAC;CACL,CAAC;AAEN,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,WAAW,KAAG,aAExD,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=execution-plan.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execution-plan.test.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/execution-plan.test.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- export * from './parser';
2
- export * from './query-executor';
3
- export * from './schema';
4
- export * from './echo-data-source';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { Parjser } from 'parjs';
2
- import { parjsCombinators, parjs } from '#parjs';
3
- export { type Parjser, parjsCombinators, parjs };
4
- //# sourceMappingURL=parjs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parjs.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/parjs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAE,KAAK,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC"}
@@ -1,6 +0,0 @@
1
- import type { CypherQuery } from './ast';
2
- export type ParsedQuery = {
3
- ast: CypherQuery;
4
- };
5
- export declare const parseCypherQuery: (query: string) => ParsedQuery;
6
- //# sourceMappingURL=parser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/parser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGzC,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,WAAW,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,WAOhD,CAAC"}