@synnaxlabs/client 0.46.1 → 0.48.0

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 (508) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/dist/client.cjs +35 -35
  3. package/dist/client.js +5053 -4924
  4. package/dist/eslint.config.d.ts +4 -0
  5. package/dist/eslint.config.d.ts.map +1 -0
  6. package/dist/src/access/client.d.ts.map +1 -0
  7. package/dist/src/access/external.d.ts.map +1 -0
  8. package/dist/src/access/index.d.ts.map +1 -0
  9. package/dist/src/access/payload.d.ts.map +1 -0
  10. package/dist/src/access/policy/client.d.ts.map +1 -0
  11. package/dist/src/access/policy/external.d.ts.map +1 -0
  12. package/dist/src/access/policy/index.d.ts.map +1 -0
  13. package/dist/src/access/policy/payload.d.ts.map +1 -0
  14. package/dist/src/access/policy/policy.spec.d.ts.map +1 -0
  15. package/dist/{arc → src/arc}/client.d.ts +17 -2
  16. package/dist/src/arc/client.d.ts.map +1 -0
  17. package/dist/src/arc/external.d.ts.map +1 -0
  18. package/dist/src/arc/index.d.ts.map +1 -0
  19. package/dist/src/arc/lsp.spec.d.ts +2 -0
  20. package/dist/src/arc/lsp.spec.d.ts.map +1 -0
  21. package/dist/{arc → src/arc}/payload.d.ts +11 -9
  22. package/dist/src/arc/payload.d.ts.map +1 -0
  23. package/dist/src/auth/auth.d.ts.map +1 -0
  24. package/dist/{auth → src/auth}/auth.spec.d.ts.map +1 -1
  25. package/dist/src/auth/index.d.ts.map +1 -0
  26. package/dist/src/channel/batchRetriever.spec.d.ts.map +1 -0
  27. package/dist/src/channel/channel.spec.d.ts.map +1 -0
  28. package/dist/{channel → src/channel}/client.d.ts +8 -8
  29. package/dist/src/channel/client.d.ts.map +1 -0
  30. package/dist/src/channel/external.d.ts.map +1 -0
  31. package/dist/src/channel/index.d.ts.map +1 -0
  32. package/dist/src/channel/payload.d.ts +260 -0
  33. package/dist/src/channel/payload.d.ts.map +1 -0
  34. package/dist/{channel → src/channel}/retriever.d.ts +2 -1
  35. package/dist/src/channel/retriever.d.ts.map +1 -0
  36. package/dist/src/channel/writer.d.ts.map +1 -0
  37. package/dist/{client.d.ts → src/client.d.ts} +10 -6
  38. package/dist/src/client.d.ts.map +1 -0
  39. package/dist/{connection → src/connection}/checker.d.ts +3 -4
  40. package/dist/src/connection/checker.d.ts.map +1 -0
  41. package/dist/src/connection/connection.spec.d.ts +2 -0
  42. package/dist/src/connection/connection.spec.d.ts.map +1 -0
  43. package/dist/src/connection/index.d.ts.map +1 -0
  44. package/dist/src/connection.spec.d.ts.map +1 -0
  45. package/dist/src/control/client.d.ts.map +1 -0
  46. package/dist/src/control/external.d.ts.map +1 -0
  47. package/dist/src/control/index.d.ts.map +1 -0
  48. package/dist/{control → src/control}/state.d.ts +1 -2
  49. package/dist/src/control/state.d.ts.map +1 -0
  50. package/dist/{control → src/control}/state.spec.d.ts.map +1 -1
  51. package/dist/src/errors.d.ts.map +1 -0
  52. package/dist/{errors.spec.d.ts.map → src/errors.spec.d.ts.map} +1 -1
  53. package/dist/{framer → src/framer}/adapter.d.ts +3 -3
  54. package/dist/src/framer/adapter.d.ts.map +1 -0
  55. package/dist/src/framer/adapter.spec.d.ts.map +1 -0
  56. package/dist/src/framer/client.d.ts.map +1 -0
  57. package/dist/src/framer/client.spec.d.ts.map +1 -0
  58. package/dist/src/framer/codec.d.ts.map +1 -0
  59. package/dist/{framer → src/framer}/codec.spec.d.ts.map +1 -1
  60. package/dist/src/framer/deleter.d.ts.map +1 -0
  61. package/dist/src/framer/deleter.spec.d.ts.map +1 -0
  62. package/dist/{framer → src/framer}/external.d.ts +1 -0
  63. package/dist/src/framer/external.d.ts.map +1 -0
  64. package/dist/{framer → src/framer}/frame.d.ts +5 -4
  65. package/dist/src/framer/frame.d.ts.map +1 -0
  66. package/dist/{framer → src/framer}/frame.spec.d.ts.map +1 -1
  67. package/dist/src/framer/index.d.ts.map +1 -0
  68. package/dist/{framer → src/framer}/iterator.d.ts +1 -2
  69. package/dist/src/framer/iterator.d.ts.map +1 -0
  70. package/dist/src/framer/iterator.spec.d.ts.map +1 -0
  71. package/dist/src/framer/payload.d.ts +7 -0
  72. package/dist/src/framer/payload.d.ts.map +1 -0
  73. package/dist/src/framer/streamProxy.d.ts.map +1 -0
  74. package/dist/{framer → src/framer}/streamer.d.ts +106 -4
  75. package/dist/src/framer/streamer.d.ts.map +1 -0
  76. package/dist/src/framer/streamer.spec.d.ts.map +1 -0
  77. package/dist/{framer → src/framer}/writer.d.ts +133 -36
  78. package/dist/src/framer/writer.d.ts.map +1 -0
  79. package/dist/src/framer/writer.spec.d.ts.map +1 -0
  80. package/dist/src/hardware/client.d.ts.map +1 -0
  81. package/dist/src/hardware/device/client.d.ts.map +1 -0
  82. package/dist/src/hardware/device/device.spec.d.ts.map +1 -0
  83. package/dist/src/hardware/device/external.d.ts.map +1 -0
  84. package/dist/src/hardware/device/index.d.ts.map +1 -0
  85. package/dist/{hardware → src/hardware}/device/payload.d.ts +4 -4
  86. package/dist/src/hardware/device/payload.d.ts.map +1 -0
  87. package/dist/src/hardware/external.d.ts.map +1 -0
  88. package/dist/src/hardware/index.d.ts.map +1 -0
  89. package/dist/src/hardware/rack/client.d.ts.map +1 -0
  90. package/dist/src/hardware/rack/external.d.ts.map +1 -0
  91. package/dist/src/hardware/rack/index.d.ts.map +1 -0
  92. package/dist/{hardware → src/hardware}/rack/payload.d.ts +4 -4
  93. package/dist/src/hardware/rack/payload.d.ts.map +1 -0
  94. package/dist/src/hardware/rack/rack.spec.d.ts.map +1 -0
  95. package/dist/{hardware → src/hardware}/task/client.d.ts +1 -2
  96. package/dist/src/hardware/task/client.d.ts.map +1 -0
  97. package/dist/src/hardware/task/external.d.ts.map +1 -0
  98. package/dist/src/hardware/task/index.d.ts.map +1 -0
  99. package/dist/src/hardware/task/payload.d.ts.map +1 -0
  100. package/dist/src/hardware/task/task.spec.d.ts.map +1 -0
  101. package/dist/{index.d.ts → src/index.d.ts} +3 -3
  102. package/dist/src/index.d.ts.map +1 -0
  103. package/dist/src/label/client.d.ts.map +1 -0
  104. package/dist/src/label/external.d.ts.map +1 -0
  105. package/dist/src/label/index.d.ts.map +1 -0
  106. package/dist/{label → src/label}/label.spec.d.ts.map +1 -1
  107. package/dist/src/label/payload.d.ts.map +1 -0
  108. package/dist/src/ontology/client.d.ts.map +1 -0
  109. package/dist/src/ontology/external.d.ts.map +1 -0
  110. package/dist/src/ontology/group/client.d.ts.map +1 -0
  111. package/dist/src/ontology/group/external.d.ts.map +1 -0
  112. package/dist/src/ontology/group/group.spec.d.ts.map +1 -0
  113. package/dist/src/ontology/group/index.d.ts.map +1 -0
  114. package/dist/src/ontology/group/payload.d.ts.map +1 -0
  115. package/dist/src/ontology/index.d.ts.map +1 -0
  116. package/dist/src/ontology/ontology.spec.d.ts.map +1 -0
  117. package/dist/src/ontology/payload.d.ts.map +1 -0
  118. package/dist/src/ontology/writer.d.ts.map +1 -0
  119. package/dist/{ranger → src/ranger}/alias.d.ts +1 -1
  120. package/dist/src/ranger/alias.d.ts.map +1 -0
  121. package/dist/{ranger → src/ranger}/client.d.ts +1 -2
  122. package/dist/src/ranger/client.d.ts.map +1 -0
  123. package/dist/src/ranger/external.d.ts.map +1 -0
  124. package/dist/src/ranger/index.d.ts.map +1 -0
  125. package/dist/src/ranger/kv.d.ts.map +1 -0
  126. package/dist/{ranger → src/ranger}/payload.d.ts +1 -1
  127. package/dist/src/ranger/payload.d.ts.map +1 -0
  128. package/dist/src/ranger/ranger.spec.d.ts.map +1 -0
  129. package/dist/src/ranger/writer.d.ts.map +1 -0
  130. package/dist/src/status/client.d.ts.map +1 -0
  131. package/dist/src/status/external.d.ts.map +1 -0
  132. package/dist/src/status/index.d.ts.map +1 -0
  133. package/dist/{status → src/status}/payload.d.ts +2 -2
  134. package/dist/src/status/payload.d.ts.map +1 -0
  135. package/dist/src/status/status.spec.d.ts.map +1 -0
  136. package/dist/src/testutil/channels.d.ts.map +1 -0
  137. package/dist/src/testutil/client.d.ts +4 -0
  138. package/dist/src/testutil/client.d.ts.map +1 -0
  139. package/dist/src/testutil/telem.d.ts.map +1 -0
  140. package/dist/{transport.d.ts → src/transport.d.ts} +1 -2
  141. package/dist/src/transport.d.ts.map +1 -0
  142. package/dist/src/user/client.d.ts.map +1 -0
  143. package/dist/src/user/external.d.ts.map +1 -0
  144. package/dist/src/user/index.d.ts.map +1 -0
  145. package/dist/src/user/payload.d.ts.map +1 -0
  146. package/dist/src/user/retriever.d.ts.map +1 -0
  147. package/dist/{user → src/user}/user.spec.d.ts.map +1 -1
  148. package/dist/src/user/writer.d.ts.map +1 -0
  149. package/dist/src/util/decodeJSONString.d.ts.map +1 -0
  150. package/dist/src/util/parseWithoutKeyConversion.d.ts +3 -0
  151. package/dist/src/util/parseWithoutKeyConversion.d.ts.map +1 -0
  152. package/dist/src/util/retrieve.d.ts.map +1 -0
  153. package/dist/src/util/retrieve.spec.d.ts.map +1 -0
  154. package/dist/src/util/telem.d.ts +3 -0
  155. package/dist/src/util/telem.d.ts.map +1 -0
  156. package/dist/src/workspace/client.d.ts.map +1 -0
  157. package/dist/src/workspace/external.d.ts.map +1 -0
  158. package/dist/src/workspace/index.d.ts.map +1 -0
  159. package/dist/src/workspace/lineplot/client.d.ts.map +1 -0
  160. package/dist/src/workspace/lineplot/external.d.ts.map +1 -0
  161. package/dist/src/workspace/lineplot/index.d.ts.map +1 -0
  162. package/dist/src/workspace/lineplot/lineplot.spec.d.ts.map +1 -0
  163. package/dist/{workspace → src/workspace}/lineplot/payload.d.ts +1 -1
  164. package/dist/src/workspace/lineplot/payload.d.ts.map +1 -0
  165. package/dist/src/workspace/log/client.d.ts.map +1 -0
  166. package/dist/src/workspace/log/external.d.ts.map +1 -0
  167. package/dist/src/workspace/log/index.d.ts.map +1 -0
  168. package/dist/src/workspace/log/log.spec.d.ts.map +1 -0
  169. package/dist/{workspace → src/workspace}/log/payload.d.ts +1 -1
  170. package/dist/src/workspace/log/payload.d.ts.map +1 -0
  171. package/dist/{workspace → src/workspace}/payload.d.ts +1 -1
  172. package/dist/src/workspace/payload.d.ts.map +1 -0
  173. package/dist/src/workspace/schematic/client.d.ts.map +1 -0
  174. package/dist/src/workspace/schematic/external.d.ts.map +1 -0
  175. package/dist/src/workspace/schematic/index.d.ts.map +1 -0
  176. package/dist/{workspace → src/workspace}/schematic/payload.d.ts +1 -1
  177. package/dist/src/workspace/schematic/payload.d.ts.map +1 -0
  178. package/dist/src/workspace/schematic/schematic.spec.d.ts.map +1 -0
  179. package/dist/src/workspace/schematic/symbol/client.d.ts.map +1 -0
  180. package/dist/src/workspace/schematic/symbol/client.spec.d.ts.map +1 -0
  181. package/dist/src/workspace/schematic/symbol/external.d.ts.map +1 -0
  182. package/dist/src/workspace/schematic/symbol/index.d.ts.map +1 -0
  183. package/dist/src/workspace/schematic/symbol/payload.d.ts.map +1 -0
  184. package/dist/src/workspace/table/client.d.ts.map +1 -0
  185. package/dist/src/workspace/table/external.d.ts.map +1 -0
  186. package/dist/src/workspace/table/index.d.ts.map +1 -0
  187. package/dist/{workspace → src/workspace}/table/payload.d.ts +1 -1
  188. package/dist/src/workspace/table/payload.d.ts.map +1 -0
  189. package/dist/src/workspace/table/table.spec.d.ts.map +1 -0
  190. package/dist/src/workspace/workspace.spec.d.ts.map +1 -0
  191. package/eslint.config.ts +14 -0
  192. package/examples/node/streamWrite.js +0 -1
  193. package/package.json +11 -11
  194. package/src/arc/client.ts +27 -2
  195. package/src/arc/lsp.spec.ts +852 -0
  196. package/src/arc/payload.ts +13 -8
  197. package/src/auth/auth.spec.ts +14 -14
  198. package/src/channel/batchRetriever.spec.ts +3 -2
  199. package/src/channel/channel.spec.ts +8 -22
  200. package/src/channel/client.ts +22 -14
  201. package/src/channel/payload.ts +25 -3
  202. package/src/channel/retriever.ts +2 -3
  203. package/src/client.ts +26 -14
  204. package/src/connection/checker.ts +13 -14
  205. package/src/connection/connection.spec.ts +14 -14
  206. package/src/connection.spec.ts +145 -0
  207. package/src/control/state.ts +1 -3
  208. package/src/errors.ts +2 -2
  209. package/src/framer/adapter.spec.ts +340 -2
  210. package/src/framer/adapter.ts +24 -15
  211. package/src/framer/client.ts +0 -2
  212. package/src/framer/codec.spec.ts +11 -1
  213. package/src/framer/codec.ts +3 -2
  214. package/src/framer/deleter.spec.ts +1 -1
  215. package/src/framer/deleter.ts +1 -3
  216. package/src/framer/external.ts +1 -0
  217. package/src/framer/frame.spec.ts +297 -1
  218. package/src/framer/frame.ts +26 -6
  219. package/src/framer/iterator.spec.ts +1 -2
  220. package/src/framer/iterator.ts +4 -5
  221. package/{eslint.config.js → src/framer/payload.ts} +6 -3
  222. package/src/framer/streamer.spec.ts +72 -12
  223. package/src/framer/streamer.ts +7 -6
  224. package/src/framer/writer.spec.ts +1 -9
  225. package/src/framer/writer.ts +29 -35
  226. package/src/hardware/task/client.ts +9 -2
  227. package/src/index.ts +10 -3
  228. package/src/label/client.ts +1 -1
  229. package/src/ranger/alias.ts +1 -2
  230. package/src/ranger/client.ts +1 -2
  231. package/src/ranger/kv.ts +1 -2
  232. package/src/ranger/payload.ts +1 -2
  233. package/src/ranger/ranger.spec.ts +1 -2
  234. package/src/status/client.ts +1 -1
  235. package/src/status/payload.ts +4 -2
  236. package/src/testutil/client.ts +4 -4
  237. package/src/transport.ts +1 -3
  238. package/src/user/writer.ts +1 -1
  239. package/src/util/parseWithoutKeyConversion.ts +1 -1
  240. package/src/util/telem.ts +1 -1
  241. package/src/workspace/lineplot/payload.ts +1 -1
  242. package/src/workspace/log/payload.ts +1 -1
  243. package/src/workspace/payload.ts +1 -1
  244. package/src/workspace/schematic/payload.ts +1 -1
  245. package/src/workspace/table/payload.ts +1 -1
  246. package/tsconfig.json +1 -1
  247. package/dist/access/client.d.ts.map +0 -1
  248. package/dist/access/external.d.ts.map +0 -1
  249. package/dist/access/index.d.ts.map +0 -1
  250. package/dist/access/payload.d.ts.map +0 -1
  251. package/dist/access/policy/client.d.ts.map +0 -1
  252. package/dist/access/policy/external.d.ts.map +0 -1
  253. package/dist/access/policy/index.d.ts.map +0 -1
  254. package/dist/access/policy/payload.d.ts.map +0 -1
  255. package/dist/access/policy/policy.spec.d.ts.map +0 -1
  256. package/dist/arc/client.d.ts.map +0 -1
  257. package/dist/arc/external.d.ts.map +0 -1
  258. package/dist/arc/index.d.ts.map +0 -1
  259. package/dist/arc/payload.d.ts.map +0 -1
  260. package/dist/auth/auth.d.ts.map +0 -1
  261. package/dist/auth/index.d.ts.map +0 -1
  262. package/dist/channel/batchRetriever.spec.d.ts.map +0 -1
  263. package/dist/channel/channel.spec.d.ts.map +0 -1
  264. package/dist/channel/client.d.ts.map +0 -1
  265. package/dist/channel/external.d.ts.map +0 -1
  266. package/dist/channel/index.d.ts.map +0 -1
  267. package/dist/channel/payload.d.ts +0 -150
  268. package/dist/channel/payload.d.ts.map +0 -1
  269. package/dist/channel/retriever.d.ts.map +0 -1
  270. package/dist/channel/writer.d.ts.map +0 -1
  271. package/dist/client.d.ts.map +0 -1
  272. package/dist/connection/checker.d.ts.map +0 -1
  273. package/dist/connection/connection.spec.d.ts.map +0 -1
  274. package/dist/connection/index.d.ts.map +0 -1
  275. package/dist/control/client.d.ts.map +0 -1
  276. package/dist/control/external.d.ts.map +0 -1
  277. package/dist/control/index.d.ts.map +0 -1
  278. package/dist/control/state.d.ts.map +0 -1
  279. package/dist/errors.d.ts.map +0 -1
  280. package/dist/framer/adapter.d.ts.map +0 -1
  281. package/dist/framer/adapter.spec.d.ts.map +0 -1
  282. package/dist/framer/client.d.ts.map +0 -1
  283. package/dist/framer/client.spec.d.ts.map +0 -1
  284. package/dist/framer/codec.d.ts.map +0 -1
  285. package/dist/framer/deleter.d.ts.map +0 -1
  286. package/dist/framer/deleter.spec.d.ts.map +0 -1
  287. package/dist/framer/external.d.ts.map +0 -1
  288. package/dist/framer/frame.d.ts.map +0 -1
  289. package/dist/framer/index.d.ts.map +0 -1
  290. package/dist/framer/iterator.d.ts.map +0 -1
  291. package/dist/framer/iterator.spec.d.ts.map +0 -1
  292. package/dist/framer/streamProxy.d.ts.map +0 -1
  293. package/dist/framer/streamer.d.ts.map +0 -1
  294. package/dist/framer/streamer.spec.d.ts.map +0 -1
  295. package/dist/framer/writer.d.ts.map +0 -1
  296. package/dist/framer/writer.spec.d.ts.map +0 -1
  297. package/dist/hardware/client.d.ts.map +0 -1
  298. package/dist/hardware/device/client.d.ts.map +0 -1
  299. package/dist/hardware/device/device.spec.d.ts.map +0 -1
  300. package/dist/hardware/device/external.d.ts.map +0 -1
  301. package/dist/hardware/device/index.d.ts.map +0 -1
  302. package/dist/hardware/device/payload.d.ts.map +0 -1
  303. package/dist/hardware/external.d.ts.map +0 -1
  304. package/dist/hardware/index.d.ts.map +0 -1
  305. package/dist/hardware/rack/client.d.ts.map +0 -1
  306. package/dist/hardware/rack/external.d.ts.map +0 -1
  307. package/dist/hardware/rack/index.d.ts.map +0 -1
  308. package/dist/hardware/rack/payload.d.ts.map +0 -1
  309. package/dist/hardware/rack/rack.spec.d.ts.map +0 -1
  310. package/dist/hardware/task/client.d.ts.map +0 -1
  311. package/dist/hardware/task/external.d.ts.map +0 -1
  312. package/dist/hardware/task/index.d.ts.map +0 -1
  313. package/dist/hardware/task/payload.d.ts.map +0 -1
  314. package/dist/hardware/task/task.spec.d.ts.map +0 -1
  315. package/dist/index.d.ts.map +0 -1
  316. package/dist/label/client.d.ts.map +0 -1
  317. package/dist/label/external.d.ts.map +0 -1
  318. package/dist/label/index.d.ts.map +0 -1
  319. package/dist/label/payload.d.ts.map +0 -1
  320. package/dist/ontology/client.d.ts.map +0 -1
  321. package/dist/ontology/external.d.ts.map +0 -1
  322. package/dist/ontology/group/client.d.ts.map +0 -1
  323. package/dist/ontology/group/external.d.ts.map +0 -1
  324. package/dist/ontology/group/group.spec.d.ts.map +0 -1
  325. package/dist/ontology/group/index.d.ts.map +0 -1
  326. package/dist/ontology/group/payload.d.ts.map +0 -1
  327. package/dist/ontology/index.d.ts.map +0 -1
  328. package/dist/ontology/ontology.spec.d.ts.map +0 -1
  329. package/dist/ontology/payload.d.ts.map +0 -1
  330. package/dist/ontology/writer.d.ts.map +0 -1
  331. package/dist/ranger/alias.d.ts.map +0 -1
  332. package/dist/ranger/client.d.ts.map +0 -1
  333. package/dist/ranger/external.d.ts.map +0 -1
  334. package/dist/ranger/index.d.ts.map +0 -1
  335. package/dist/ranger/kv.d.ts.map +0 -1
  336. package/dist/ranger/payload.d.ts.map +0 -1
  337. package/dist/ranger/ranger.spec.d.ts.map +0 -1
  338. package/dist/ranger/writer.d.ts.map +0 -1
  339. package/dist/status/client.d.ts.map +0 -1
  340. package/dist/status/external.d.ts.map +0 -1
  341. package/dist/status/index.d.ts.map +0 -1
  342. package/dist/status/payload.d.ts.map +0 -1
  343. package/dist/status/status.spec.d.ts.map +0 -1
  344. package/dist/testutil/channels.d.ts.map +0 -1
  345. package/dist/testutil/client.d.ts +0 -4
  346. package/dist/testutil/client.d.ts.map +0 -1
  347. package/dist/testutil/telem.d.ts.map +0 -1
  348. package/dist/transport.d.ts.map +0 -1
  349. package/dist/user/client.d.ts.map +0 -1
  350. package/dist/user/external.d.ts.map +0 -1
  351. package/dist/user/index.d.ts.map +0 -1
  352. package/dist/user/payload.d.ts.map +0 -1
  353. package/dist/user/retriever.d.ts.map +0 -1
  354. package/dist/user/writer.d.ts.map +0 -1
  355. package/dist/util/decodeJSONString.d.ts.map +0 -1
  356. package/dist/util/parseWithoutKeyConversion.d.ts +0 -3
  357. package/dist/util/parseWithoutKeyConversion.d.ts.map +0 -1
  358. package/dist/util/retrieve.d.ts.map +0 -1
  359. package/dist/util/retrieve.spec.d.ts.map +0 -1
  360. package/dist/util/telem.d.ts +0 -3
  361. package/dist/util/telem.d.ts.map +0 -1
  362. package/dist/workspace/client.d.ts.map +0 -1
  363. package/dist/workspace/external.d.ts.map +0 -1
  364. package/dist/workspace/index.d.ts.map +0 -1
  365. package/dist/workspace/lineplot/client.d.ts.map +0 -1
  366. package/dist/workspace/lineplot/external.d.ts.map +0 -1
  367. package/dist/workspace/lineplot/index.d.ts.map +0 -1
  368. package/dist/workspace/lineplot/lineplot.spec.d.ts.map +0 -1
  369. package/dist/workspace/lineplot/payload.d.ts.map +0 -1
  370. package/dist/workspace/log/client.d.ts.map +0 -1
  371. package/dist/workspace/log/external.d.ts.map +0 -1
  372. package/dist/workspace/log/index.d.ts.map +0 -1
  373. package/dist/workspace/log/log.spec.d.ts.map +0 -1
  374. package/dist/workspace/log/payload.d.ts.map +0 -1
  375. package/dist/workspace/payload.d.ts.map +0 -1
  376. package/dist/workspace/schematic/client.d.ts.map +0 -1
  377. package/dist/workspace/schematic/external.d.ts.map +0 -1
  378. package/dist/workspace/schematic/index.d.ts.map +0 -1
  379. package/dist/workspace/schematic/payload.d.ts.map +0 -1
  380. package/dist/workspace/schematic/schematic.spec.d.ts.map +0 -1
  381. package/dist/workspace/schematic/symbol/client.d.ts.map +0 -1
  382. package/dist/workspace/schematic/symbol/client.spec.d.ts.map +0 -1
  383. package/dist/workspace/schematic/symbol/external.d.ts.map +0 -1
  384. package/dist/workspace/schematic/symbol/index.d.ts.map +0 -1
  385. package/dist/workspace/schematic/symbol/payload.d.ts.map +0 -1
  386. package/dist/workspace/table/client.d.ts.map +0 -1
  387. package/dist/workspace/table/external.d.ts.map +0 -1
  388. package/dist/workspace/table/index.d.ts.map +0 -1
  389. package/dist/workspace/table/payload.d.ts.map +0 -1
  390. package/dist/workspace/table/table.spec.d.ts.map +0 -1
  391. package/dist/workspace/workspace.spec.d.ts.map +0 -1
  392. /package/dist/{access → src/access}/client.d.ts +0 -0
  393. /package/dist/{access → src/access}/external.d.ts +0 -0
  394. /package/dist/{access → src/access}/index.d.ts +0 -0
  395. /package/dist/{access → src/access}/payload.d.ts +0 -0
  396. /package/dist/{access → src/access}/policy/client.d.ts +0 -0
  397. /package/dist/{access → src/access}/policy/external.d.ts +0 -0
  398. /package/dist/{access → src/access}/policy/index.d.ts +0 -0
  399. /package/dist/{access → src/access}/policy/payload.d.ts +0 -0
  400. /package/dist/{access → src/access}/policy/policy.spec.d.ts +0 -0
  401. /package/dist/{arc → src/arc}/external.d.ts +0 -0
  402. /package/dist/{arc → src/arc}/index.d.ts +0 -0
  403. /package/dist/{auth → src/auth}/auth.d.ts +0 -0
  404. /package/dist/{auth → src/auth}/auth.spec.d.ts +0 -0
  405. /package/dist/{auth → src/auth}/index.d.ts +0 -0
  406. /package/dist/{channel → src/channel}/batchRetriever.spec.d.ts +0 -0
  407. /package/dist/{channel → src/channel}/channel.spec.d.ts +0 -0
  408. /package/dist/{channel → src/channel}/external.d.ts +0 -0
  409. /package/dist/{channel → src/channel}/index.d.ts +0 -0
  410. /package/dist/{channel → src/channel}/writer.d.ts +0 -0
  411. /package/dist/{connection → src/connection}/index.d.ts +0 -0
  412. /package/dist/{connection → src}/connection.spec.d.ts +0 -0
  413. /package/dist/{control → src/control}/client.d.ts +0 -0
  414. /package/dist/{control → src/control}/external.d.ts +0 -0
  415. /package/dist/{control → src/control}/index.d.ts +0 -0
  416. /package/dist/{control → src/control}/state.spec.d.ts +0 -0
  417. /package/dist/{errors.d.ts → src/errors.d.ts} +0 -0
  418. /package/dist/{errors.spec.d.ts → src/errors.spec.d.ts} +0 -0
  419. /package/dist/{framer → src/framer}/adapter.spec.d.ts +0 -0
  420. /package/dist/{framer → src/framer}/client.d.ts +0 -0
  421. /package/dist/{framer → src/framer}/client.spec.d.ts +0 -0
  422. /package/dist/{framer → src/framer}/codec.d.ts +0 -0
  423. /package/dist/{framer → src/framer}/codec.spec.d.ts +0 -0
  424. /package/dist/{framer → src/framer}/deleter.d.ts +0 -0
  425. /package/dist/{framer → src/framer}/deleter.spec.d.ts +0 -0
  426. /package/dist/{framer → src/framer}/frame.spec.d.ts +0 -0
  427. /package/dist/{framer → src/framer}/index.d.ts +0 -0
  428. /package/dist/{framer → src/framer}/iterator.spec.d.ts +0 -0
  429. /package/dist/{framer → src/framer}/streamProxy.d.ts +0 -0
  430. /package/dist/{framer → src/framer}/streamer.spec.d.ts +0 -0
  431. /package/dist/{framer → src/framer}/writer.spec.d.ts +0 -0
  432. /package/dist/{hardware → src/hardware}/client.d.ts +0 -0
  433. /package/dist/{hardware → src/hardware}/device/client.d.ts +0 -0
  434. /package/dist/{hardware → src/hardware}/device/device.spec.d.ts +0 -0
  435. /package/dist/{hardware → src/hardware}/device/external.d.ts +0 -0
  436. /package/dist/{hardware → src/hardware}/device/index.d.ts +0 -0
  437. /package/dist/{hardware → src/hardware}/external.d.ts +0 -0
  438. /package/dist/{hardware → src/hardware}/index.d.ts +0 -0
  439. /package/dist/{hardware → src/hardware}/rack/client.d.ts +0 -0
  440. /package/dist/{hardware → src/hardware}/rack/external.d.ts +0 -0
  441. /package/dist/{hardware → src/hardware}/rack/index.d.ts +0 -0
  442. /package/dist/{hardware → src/hardware}/rack/rack.spec.d.ts +0 -0
  443. /package/dist/{hardware → src/hardware}/task/external.d.ts +0 -0
  444. /package/dist/{hardware → src/hardware}/task/index.d.ts +0 -0
  445. /package/dist/{hardware → src/hardware}/task/payload.d.ts +0 -0
  446. /package/dist/{hardware → src/hardware}/task/task.spec.d.ts +0 -0
  447. /package/dist/{label → src/label}/client.d.ts +0 -0
  448. /package/dist/{label → src/label}/external.d.ts +0 -0
  449. /package/dist/{label → src/label}/index.d.ts +0 -0
  450. /package/dist/{label → src/label}/label.spec.d.ts +0 -0
  451. /package/dist/{label → src/label}/payload.d.ts +0 -0
  452. /package/dist/{ontology → src/ontology}/client.d.ts +0 -0
  453. /package/dist/{ontology → src/ontology}/external.d.ts +0 -0
  454. /package/dist/{ontology → src/ontology}/group/client.d.ts +0 -0
  455. /package/dist/{ontology → src/ontology}/group/external.d.ts +0 -0
  456. /package/dist/{ontology → src/ontology}/group/group.spec.d.ts +0 -0
  457. /package/dist/{ontology → src/ontology}/group/index.d.ts +0 -0
  458. /package/dist/{ontology → src/ontology}/group/payload.d.ts +0 -0
  459. /package/dist/{ontology → src/ontology}/index.d.ts +0 -0
  460. /package/dist/{ontology → src/ontology}/ontology.spec.d.ts +0 -0
  461. /package/dist/{ontology → src/ontology}/payload.d.ts +0 -0
  462. /package/dist/{ontology → src/ontology}/writer.d.ts +0 -0
  463. /package/dist/{ranger → src/ranger}/external.d.ts +0 -0
  464. /package/dist/{ranger → src/ranger}/index.d.ts +0 -0
  465. /package/dist/{ranger → src/ranger}/kv.d.ts +0 -0
  466. /package/dist/{ranger → src/ranger}/ranger.spec.d.ts +0 -0
  467. /package/dist/{ranger → src/ranger}/writer.d.ts +0 -0
  468. /package/dist/{status → src/status}/client.d.ts +0 -0
  469. /package/dist/{status → src/status}/external.d.ts +0 -0
  470. /package/dist/{status → src/status}/index.d.ts +0 -0
  471. /package/dist/{status → src/status}/status.spec.d.ts +0 -0
  472. /package/dist/{testutil → src/testutil}/channels.d.ts +0 -0
  473. /package/dist/{testutil → src/testutil}/telem.d.ts +0 -0
  474. /package/dist/{user → src/user}/client.d.ts +0 -0
  475. /package/dist/{user → src/user}/external.d.ts +0 -0
  476. /package/dist/{user → src/user}/index.d.ts +0 -0
  477. /package/dist/{user → src/user}/payload.d.ts +0 -0
  478. /package/dist/{user → src/user}/retriever.d.ts +0 -0
  479. /package/dist/{user → src/user}/user.spec.d.ts +0 -0
  480. /package/dist/{user → src/user}/writer.d.ts +0 -0
  481. /package/dist/{util → src/util}/decodeJSONString.d.ts +0 -0
  482. /package/dist/{util → src/util}/retrieve.d.ts +0 -0
  483. /package/dist/{util → src/util}/retrieve.spec.d.ts +0 -0
  484. /package/dist/{workspace → src/workspace}/client.d.ts +0 -0
  485. /package/dist/{workspace → src/workspace}/external.d.ts +0 -0
  486. /package/dist/{workspace → src/workspace}/index.d.ts +0 -0
  487. /package/dist/{workspace → src/workspace}/lineplot/client.d.ts +0 -0
  488. /package/dist/{workspace → src/workspace}/lineplot/external.d.ts +0 -0
  489. /package/dist/{workspace → src/workspace}/lineplot/index.d.ts +0 -0
  490. /package/dist/{workspace → src/workspace}/lineplot/lineplot.spec.d.ts +0 -0
  491. /package/dist/{workspace → src/workspace}/log/client.d.ts +0 -0
  492. /package/dist/{workspace → src/workspace}/log/external.d.ts +0 -0
  493. /package/dist/{workspace → src/workspace}/log/index.d.ts +0 -0
  494. /package/dist/{workspace → src/workspace}/log/log.spec.d.ts +0 -0
  495. /package/dist/{workspace → src/workspace}/schematic/client.d.ts +0 -0
  496. /package/dist/{workspace → src/workspace}/schematic/external.d.ts +0 -0
  497. /package/dist/{workspace → src/workspace}/schematic/index.d.ts +0 -0
  498. /package/dist/{workspace → src/workspace}/schematic/schematic.spec.d.ts +0 -0
  499. /package/dist/{workspace → src/workspace}/schematic/symbol/client.d.ts +0 -0
  500. /package/dist/{workspace → src/workspace}/schematic/symbol/client.spec.d.ts +0 -0
  501. /package/dist/{workspace → src/workspace}/schematic/symbol/external.d.ts +0 -0
  502. /package/dist/{workspace → src/workspace}/schematic/symbol/index.d.ts +0 -0
  503. /package/dist/{workspace → src/workspace}/schematic/symbol/payload.d.ts +0 -0
  504. /package/dist/{workspace → src/workspace}/table/client.d.ts +0 -0
  505. /package/dist/{workspace → src/workspace}/table/external.d.ts +0 -0
  506. /package/dist/{workspace → src/workspace}/table/index.d.ts +0 -0
  507. /package/dist/{workspace → src/workspace}/table/table.spec.d.ts +0 -0
  508. /package/dist/{workspace → src/workspace}/workspace.spec.d.ts +0 -0
@@ -0,0 +1,852 @@
1
+ // Copyright 2025 Synnax Labs, Inc.
2
+ //
3
+ // Use of this software is governed by the Business Source License included in the file
4
+ // licenses/BSL.txt.
5
+ //
6
+ // As of the Change Date specified in that file, in accordance with the Business Source
7
+ // License, use of this software will be governed by the Apache License, Version 2.0,
8
+ // included in the file licenses/APL.txt.
9
+
10
+ import { type jsonRPC } from "@synnaxlabs/x";
11
+ import { describe, expect, it } from "vitest";
12
+
13
+ import { createTestClient } from "@/testutil/client";
14
+
15
+ describe("Arc LSP", () => {
16
+ it("should open an LSP stream and handle initialize request", async () => {
17
+ const client = createTestClient();
18
+ const stream = await client.arcs.openLSP();
19
+
20
+ // Send LSP initialize request (raw JSON, no Content-Length headers)
21
+ const initializeRequest: jsonRPC.Request = {
22
+ jsonrpc: "2.0",
23
+ id: 1,
24
+ method: "initialize",
25
+ params: {
26
+ processId: null,
27
+ clientInfo: {
28
+ name: "test-client",
29
+ version: "1.0.0",
30
+ },
31
+ rootUri: null,
32
+ capabilities: {},
33
+ },
34
+ };
35
+
36
+ stream.send({
37
+ content: JSON.stringify(initializeRequest),
38
+ });
39
+
40
+ // Receive response (raw JSON, no Content-Length headers)
41
+ const [res, err] = await stream.receive();
42
+ expect(err).toBeNull();
43
+ if (!res) throw new Error("Expected response");
44
+
45
+ // Parse raw JSON response directly
46
+ const msg = JSON.parse(res.content) as jsonRPC.Response;
47
+ expect(msg.jsonrpc).toBe("2.0");
48
+ expect(msg.id).toBe(1);
49
+
50
+ // Check for error response
51
+ if ("error" in msg) throw new Error(`LSP error: ${msg.error.message}`);
52
+
53
+ expect("result" in msg).toBe(true);
54
+
55
+ // Verify capabilities are present
56
+ if ("result" in msg) {
57
+ const result = msg.result as Record<string, unknown>;
58
+ expect(result).toHaveProperty("capabilities");
59
+ }
60
+
61
+ stream.closeSend();
62
+ });
63
+
64
+ it("should handle textDocument/didOpen notification", async () => {
65
+ const client = createTestClient();
66
+ const stream = await client.arcs.openLSP();
67
+
68
+ // First initialize
69
+ const initializeRequest: jsonRPC.Request = {
70
+ jsonrpc: "2.0",
71
+ id: 1,
72
+ method: "initialize",
73
+ params: {
74
+ processId: null,
75
+ clientInfo: { name: "test-client", version: "1.0.0" },
76
+ rootUri: null,
77
+ capabilities: {},
78
+ },
79
+ };
80
+
81
+ stream.send({ content: JSON.stringify(initializeRequest) });
82
+ const [initResponse, initErr] = await stream.receive();
83
+ expect(initErr).toBeNull();
84
+ expect(initResponse).not.toBeNull();
85
+ if (!initResponse) throw new Error("Expected response");
86
+
87
+ // Parse raw JSON response
88
+ const initMsg = JSON.parse(initResponse.content) as jsonRPC.Response;
89
+ expect(initMsg.id).toBe(1);
90
+
91
+ // Check for error response
92
+ if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
93
+
94
+ // Send initialized notification
95
+ const initializedNotification: jsonRPC.Request = {
96
+ jsonrpc: "2.0",
97
+ method: "initialized",
98
+ params: {},
99
+ };
100
+
101
+ stream.send({ content: JSON.stringify(initializedNotification) });
102
+
103
+ // Send didOpen notification
104
+ const didOpenNotification: jsonRPC.Request = {
105
+ jsonrpc: "2.0",
106
+ method: "textDocument/didOpen",
107
+ params: {
108
+ textDocument: {
109
+ uri: "file:///test.arc",
110
+ languageId: "arc",
111
+ version: 1,
112
+ text: "let x = 1 + 2;",
113
+ },
114
+ },
115
+ };
116
+
117
+ stream.send({ content: JSON.stringify(didOpenNotification) });
118
+
119
+ // Notifications don't get responses, but we might get diagnostics back
120
+ // Wait a bit to see if we get any messages
121
+ const diagnosticsPromise = stream.receive();
122
+ const timeoutPromise = new Promise((resolve) =>
123
+ setTimeout(() => resolve(null), 100),
124
+ );
125
+
126
+ const result = await Promise.race([diagnosticsPromise, timeoutPromise]);
127
+
128
+ if (result && Array.isArray(result)) {
129
+ const [diagResponse, diagErr] = result;
130
+ if (diagResponse && !diagErr) {
131
+ // Parse raw JSON notification
132
+ const diagMsg = JSON.parse(diagResponse.content) as jsonRPC.Message;
133
+ expect(diagMsg.jsonrpc).toBe("2.0");
134
+ if ("method" in diagMsg)
135
+ expect(diagMsg.method).toBe("textDocument/publishDiagnostics");
136
+ }
137
+ }
138
+
139
+ stream.closeSend();
140
+ client.close();
141
+ });
142
+
143
+ it("should handle hover request", async () => {
144
+ const client = createTestClient();
145
+ const stream = await client.arcs.openLSP();
146
+
147
+ // Initialize
148
+ const initializeRequest: jsonRPC.Request = {
149
+ jsonrpc: "2.0",
150
+ id: 1,
151
+ method: "initialize",
152
+ params: {
153
+ processId: null,
154
+ clientInfo: { name: "test-client", version: "1.0.0" },
155
+ rootUri: null,
156
+ capabilities: { textDocument: { hover: { dynamicRegistration: true } } },
157
+ },
158
+ };
159
+
160
+ stream.send({ content: JSON.stringify(initializeRequest) });
161
+ const [initRes] = await stream.receive();
162
+ expect(initRes).not.toBeNull();
163
+ if (!initRes) throw new Error("Expected response");
164
+
165
+ const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
166
+ if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
167
+
168
+ // Send initialized notification
169
+ stream.send({
170
+ content: JSON.stringify({
171
+ jsonrpc: "2.0",
172
+ method: "initialized",
173
+ params: {},
174
+ }),
175
+ });
176
+
177
+ // Open a document
178
+ stream.send({
179
+ content: JSON.stringify({
180
+ jsonrpc: "2.0",
181
+ method: "textDocument/didOpen",
182
+ params: {
183
+ textDocument: {
184
+ uri: "file:///test.arc",
185
+ languageId: "arc",
186
+ version: 1,
187
+ text: "let x = 1 + 2;",
188
+ },
189
+ },
190
+ }),
191
+ });
192
+
193
+ // Wait for and consume the publishDiagnostics notification
194
+ const [diagResponse] = await stream.receive();
195
+ expect(diagResponse).not.toBeNull();
196
+
197
+ // Request hover information
198
+ const hoverRequest: jsonRPC.Request = {
199
+ jsonrpc: "2.0",
200
+ id: 2,
201
+ method: "textDocument/hover",
202
+ params: {
203
+ textDocument: { uri: "file:///test.arc" },
204
+ position: { line: 0, character: 4 },
205
+ },
206
+ };
207
+
208
+ stream.send({ content: JSON.stringify(hoverRequest) });
209
+
210
+ const [hoverResponse, hoverErr] = await stream.receive();
211
+ expect(hoverErr).toBeNull();
212
+ expect(hoverResponse).not.toBeNull();
213
+ if (!hoverResponse) throw new Error("Expected response");
214
+
215
+ // Parse raw JSON response
216
+ const responseMsg = JSON.parse(hoverResponse.content) as jsonRPC.Response;
217
+ expect(responseMsg.jsonrpc).toBe("2.0");
218
+ expect(responseMsg.id).toBe(2);
219
+
220
+ // Check for error response
221
+ if ("error" in responseMsg)
222
+ throw new Error(`LSP error: ${responseMsg.error.message}`);
223
+
224
+ stream.closeSend();
225
+ client.close();
226
+ });
227
+
228
+ it("should handle multiple concurrent messages", async () => {
229
+ const client = createTestClient();
230
+ const stream = await client.arcs.openLSP();
231
+
232
+ const receivedMessages: jsonRPC.Response[] = [];
233
+
234
+ // Initialize
235
+ const initializeRequest: jsonRPC.Request = {
236
+ jsonrpc: "2.0",
237
+ id: 1,
238
+ method: "initialize",
239
+ params: {
240
+ processId: null,
241
+ clientInfo: { name: "test-client", version: "1.0.0" },
242
+ rootUri: null,
243
+ capabilities: {},
244
+ },
245
+ };
246
+
247
+ stream.send({ content: JSON.stringify(initializeRequest) });
248
+ const [initResponse] = await stream.receive();
249
+ if (!initResponse) throw new Error("Expected response");
250
+ const initMsg = JSON.parse(initResponse.content) as jsonRPC.Response;
251
+ if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
252
+
253
+ receivedMessages.push(initMsg);
254
+
255
+ // Send multiple requests with different IDs
256
+ const requests = [
257
+ {
258
+ jsonrpc: "2.0",
259
+ id: 10,
260
+ method: "workspace/symbol",
261
+ params: { query: "test" },
262
+ },
263
+ {
264
+ jsonrpc: "2.0",
265
+ id: 11,
266
+ method: "textDocument/documentSymbol",
267
+ params: { textDocument: { uri: "file:///test.arc" } },
268
+ },
269
+ ];
270
+
271
+ for (const req of requests) stream.send({ content: JSON.stringify(req) });
272
+
273
+ // Receive responses (order may vary)
274
+ for (let i = 0; i < requests.length; i++) {
275
+ const [response] = await stream.receive();
276
+ if (!response) throw new Error("Expected response");
277
+ const msg = JSON.parse(response.content) as jsonRPC.Response;
278
+ if ("error" in msg) throw new Error(`LSP error: ${msg.error.message}`);
279
+
280
+ receivedMessages.push(msg);
281
+ }
282
+
283
+ // Should have init response + 2 request responses
284
+ expect(receivedMessages.length).toBeGreaterThanOrEqual(3);
285
+
286
+ // Verify all responses have correct structure
287
+ for (const msg of receivedMessages) {
288
+ expect(msg.jsonrpc).toBe("2.0");
289
+ expect(msg.id).toBeDefined();
290
+ }
291
+
292
+ stream.closeSend();
293
+ client.close();
294
+ });
295
+
296
+ it("should properly encode and decode JSON-RPC messages without headers", async () => {
297
+ const client = createTestClient();
298
+ const stream = await client.arcs.openLSP();
299
+
300
+ // Test that our message format is just JSON without Content-Length headers
301
+ const testMessage: jsonRPC.Request = {
302
+ jsonrpc: "2.0",
303
+ id: 999,
304
+ method: "test/method",
305
+ params: { data: "test" },
306
+ };
307
+
308
+ const messageContent = JSON.stringify(testMessage);
309
+
310
+ // Send raw JSON (no headers)
311
+ stream.send({ content: messageContent });
312
+
313
+ // The server should respond (even if it's an error for unknown method)
314
+ const [response, err] = await stream.receive();
315
+ expect(err).toBeNull();
316
+ expect(response).not.toBeNull();
317
+ if (!response) throw new Error("Expected response");
318
+
319
+ // Response should be parseable JSON
320
+ const parsed = JSON.parse(response.content) as jsonRPC.Response;
321
+ expect(parsed.jsonrpc).toBe("2.0");
322
+ expect(parsed.id).toBe(999);
323
+
324
+ // This test expects an error response for unknown method
325
+ if ("error" in parsed) expect(parsed.error).toBeDefined();
326
+
327
+ stream.closeSend();
328
+ client.close();
329
+ });
330
+
331
+ it("should provide semantic tokens for Arc code", async () => {
332
+ const client = createTestClient();
333
+ const stream = await client.arcs.openLSP();
334
+
335
+ // Initialize with semantic tokens capability
336
+ const initializeRequest: jsonRPC.Request = {
337
+ jsonrpc: "2.0",
338
+ id: 1,
339
+ method: "initialize",
340
+ params: {
341
+ processId: null,
342
+ clientInfo: { name: "test-client", version: "1.0.0" },
343
+ rootUri: null,
344
+ capabilities: {
345
+ textDocument: {
346
+ semanticTokens: {
347
+ dynamicRegistration: true,
348
+ requests: { full: true },
349
+ },
350
+ },
351
+ },
352
+ },
353
+ };
354
+
355
+ stream.send({ content: JSON.stringify(initializeRequest) });
356
+ const [initRes] = await stream.receive();
357
+ expect(initRes).not.toBeNull();
358
+ if (!initRes) throw new Error("Expected response");
359
+
360
+ const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
361
+ if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
362
+
363
+ // Verify server advertises semantic tokens support
364
+ if ("result" in initMsg) {
365
+ const result = initMsg.result as Record<string, unknown>;
366
+ const capabilities = result.capabilities as Record<string, unknown>;
367
+ expect(capabilities).toHaveProperty("semanticTokensProvider");
368
+ }
369
+
370
+ // Send initialized notification
371
+ stream.send({
372
+ content: JSON.stringify({
373
+ jsonrpc: "2.0",
374
+ method: "initialized",
375
+ params: {},
376
+ }),
377
+ });
378
+
379
+ // Open a document with Arc code
380
+ const arcCode = "func add(x i32, y i32) i32 {\n return x + y\n}";
381
+ stream.send({
382
+ content: JSON.stringify({
383
+ jsonrpc: "2.0",
384
+ method: "textDocument/didOpen",
385
+ params: {
386
+ textDocument: {
387
+ uri: "file:///test.arc",
388
+ languageId: "arc",
389
+ version: 1,
390
+ text: arcCode,
391
+ },
392
+ },
393
+ }),
394
+ });
395
+
396
+ // Wait for diagnostics
397
+ await stream.receive();
398
+
399
+ // Request semantic tokens
400
+ const semanticTokensRequest: jsonRPC.Request = {
401
+ jsonrpc: "2.0",
402
+ id: 2,
403
+ method: "textDocument/semanticTokens/full",
404
+ params: {
405
+ textDocument: { uri: "file:///test.arc" },
406
+ },
407
+ };
408
+
409
+ stream.send({ content: JSON.stringify(semanticTokensRequest) });
410
+
411
+ const [tokenResponse, tokenErr] = await stream.receive();
412
+ expect(tokenErr).toBeNull();
413
+ expect(tokenResponse).not.toBeNull();
414
+ if (!tokenResponse) throw new Error("Expected response");
415
+
416
+ const tokenMsg = JSON.parse(tokenResponse.content) as jsonRPC.Response;
417
+ expect(tokenMsg.jsonrpc).toBe("2.0");
418
+ expect(tokenMsg.id).toBe(2);
419
+
420
+ if ("error" in tokenMsg) throw new Error(`LSP error: ${tokenMsg.error.message}`);
421
+
422
+ // Verify semantic tokens are returned
423
+ if ("result" in tokenMsg) {
424
+ const result = tokenMsg.result as Record<string, unknown>;
425
+ expect(result).toHaveProperty("data");
426
+ const data = result.data as number[];
427
+ expect(Array.isArray(data)).toBe(true);
428
+ // Should have tokens (encoded as [deltaLine, deltaStart, length, type, modifiers] * N)
429
+ expect(data.length).toBeGreaterThan(0);
430
+ // Tokens should be in groups of 5
431
+ expect(data.length % 5).toBe(0);
432
+ }
433
+
434
+ stream.closeSend();
435
+ client.close();
436
+ });
437
+
438
+ describe("Block Expression Wrapping", () => {
439
+ it("should handle block URI with metadata", async () => {
440
+ const client = createTestClient();
441
+ const stream = await client.arcs.openLSP();
442
+
443
+ // Initialize
444
+ const initializeRequest: jsonRPC.Request = {
445
+ jsonrpc: "2.0",
446
+ id: 1,
447
+ method: "initialize",
448
+ params: {
449
+ processId: null,
450
+ clientInfo: { name: "test-client", version: "1.0.0" },
451
+ rootUri: null,
452
+ capabilities: {},
453
+ },
454
+ };
455
+
456
+ stream.send({ content: JSON.stringify(initializeRequest) });
457
+ const [initRes] = await stream.receive();
458
+ expect(initRes).not.toBeNull();
459
+ if (!initRes) throw new Error("Expected response");
460
+
461
+ const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
462
+ if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
463
+
464
+ // Send initialized notification
465
+ stream.send({
466
+ content: JSON.stringify({
467
+ jsonrpc: "2.0",
468
+ method: "initialized",
469
+ params: {},
470
+ }),
471
+ });
472
+
473
+ // Create metadata for block expression
474
+ const metadata = { is_block: true };
475
+ const encoded = btoa(JSON.stringify(metadata));
476
+ const blockURI = `arc://block/test123#${encoded}`;
477
+
478
+ // Open a document with block URI containing a simple expression
479
+ const blockExpression = "return x * 2";
480
+ stream.send({
481
+ content: JSON.stringify({
482
+ jsonrpc: "2.0",
483
+ method: "textDocument/didOpen",
484
+ params: {
485
+ textDocument: {
486
+ uri: blockURI,
487
+ languageId: "arc",
488
+ version: 1,
489
+ text: blockExpression,
490
+ },
491
+ },
492
+ }),
493
+ });
494
+
495
+ // Should receive diagnostics
496
+ const [diagResponse, diagErr] = await stream.receive();
497
+ expect(diagErr).toBeNull();
498
+ expect(diagResponse).not.toBeNull();
499
+ if (!diagResponse) throw new Error("Expected diagnostics");
500
+
501
+ const diagMsg = JSON.parse(diagResponse.content) as jsonRPC.Message;
502
+ expect(diagMsg.jsonrpc).toBe("2.0");
503
+ if ("method" in diagMsg) {
504
+ expect(diagMsg.method).toBe("textDocument/publishDiagnostics");
505
+ if ("params" in diagMsg) {
506
+ const params = diagMsg.params as Record<string, unknown>;
507
+ expect(params.uri).toBe(blockURI);
508
+ // Expression should be wrapped and parsed successfully
509
+ const diagnostics = params.diagnostics as unknown[];
510
+ // May have diagnostics about undefined 'x', but should parse successfully
511
+ expect(Array.isArray(diagnostics)).toBe(true);
512
+ }
513
+ }
514
+
515
+ stream.closeSend();
516
+ client.close();
517
+ });
518
+
519
+ it("should provide correct diagnostics for block with syntax error", async () => {
520
+ const client = createTestClient();
521
+ const stream = await client.arcs.openLSP();
522
+
523
+ // Initialize
524
+ const initializeRequest: jsonRPC.Request = {
525
+ jsonrpc: "2.0",
526
+ id: 1,
527
+ method: "initialize",
528
+ params: {
529
+ processId: null,
530
+ clientInfo: { name: "test-client", version: "1.0.0" },
531
+ rootUri: null,
532
+ capabilities: {},
533
+ },
534
+ };
535
+
536
+ stream.send({ content: JSON.stringify(initializeRequest) });
537
+ const [initRes] = await stream.receive();
538
+ expect(initRes).not.toBeNull();
539
+ if (!initRes) throw new Error("Expected response");
540
+
541
+ const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
542
+ if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
543
+
544
+ // Send initialized notification
545
+ stream.send({
546
+ content: JSON.stringify({
547
+ jsonrpc: "2.0",
548
+ method: "initialized",
549
+ params: {},
550
+ }),
551
+ });
552
+
553
+ // Create block URI
554
+ const metadata = { is_block: true };
555
+ const encoded = btoa(JSON.stringify(metadata));
556
+ const blockURI = `arc://block/syntax-error#${encoded}`;
557
+
558
+ // Open a document with invalid syntax
559
+ const invalidExpression = "return x +";
560
+ stream.send({
561
+ content: JSON.stringify({
562
+ jsonrpc: "2.0",
563
+ method: "textDocument/didOpen",
564
+ params: {
565
+ textDocument: {
566
+ uri: blockURI,
567
+ languageId: "arc",
568
+ version: 1,
569
+ text: invalidExpression,
570
+ },
571
+ },
572
+ }),
573
+ });
574
+
575
+ // Should receive diagnostics with syntax error
576
+ const [diagResponse, diagErr] = await stream.receive();
577
+ expect(diagErr).toBeNull();
578
+ expect(diagResponse).not.toBeNull();
579
+ if (!diagResponse) throw new Error("Expected diagnostics");
580
+
581
+ const diagMsg = JSON.parse(diagResponse.content) as jsonRPC.Message;
582
+ if ("method" in diagMsg && "params" in diagMsg) {
583
+ expect(diagMsg.method).toBe("textDocument/publishDiagnostics");
584
+ const params = diagMsg.params as Record<string, unknown>;
585
+ const diagnostics = params.diagnostics as Array<{
586
+ range: { start: { line: number; character: number } };
587
+ message: string;
588
+ severity: number;
589
+ }>;
590
+
591
+ // Should have at least one diagnostic
592
+ expect(diagnostics.length).toBeGreaterThan(0);
593
+
594
+ // Position should be mapped correctly (line 0 for original expression)
595
+ // Note: Parse errors may not be position-mapped correctly yet
596
+ // This is a known limitation - for now we just verify diagnostics exist
597
+ const firstDiag = diagnostics[0];
598
+ console.log("Diagnostic position:", firstDiag.range.start);
599
+ // expect(firstDiag.range.start.line).toBe(0);
600
+ }
601
+
602
+ stream.closeSend();
603
+ client.close();
604
+ });
605
+
606
+ it("should handle multi-line block expressions", async () => {
607
+ const client = createTestClient();
608
+ const stream = await client.arcs.openLSP();
609
+
610
+ // Initialize
611
+ const initializeRequest: jsonRPC.Request = {
612
+ jsonrpc: "2.0",
613
+ id: 1,
614
+ method: "initialize",
615
+ params: {
616
+ processId: null,
617
+ clientInfo: { name: "test-client", version: "1.0.0" },
618
+ rootUri: null,
619
+ capabilities: {},
620
+ },
621
+ };
622
+
623
+ stream.send({ content: JSON.stringify(initializeRequest) });
624
+ const [initRes] = await stream.receive();
625
+ expect(initRes).not.toBeNull();
626
+ if (!initRes) throw new Error("Expected response");
627
+
628
+ const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
629
+ if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
630
+
631
+ // Send initialized notification
632
+ stream.send({
633
+ content: JSON.stringify({
634
+ jsonrpc: "2.0",
635
+ method: "initialized",
636
+ params: {},
637
+ }),
638
+ });
639
+
640
+ // Create block URI
641
+ const metadata = { is_block: true };
642
+ const encoded = btoa(JSON.stringify(metadata));
643
+ const blockURI = `arc://block/multiline#${encoded}`;
644
+
645
+ // Multi-line block expression
646
+ const multiLineExpression =
647
+ "let temp = x * 2\nlet result = temp + 1\nreturn result";
648
+ stream.send({
649
+ content: JSON.stringify({
650
+ jsonrpc: "2.0",
651
+ method: "textDocument/didOpen",
652
+ params: {
653
+ textDocument: {
654
+ uri: blockURI,
655
+ languageId: "arc",
656
+ version: 1,
657
+ text: multiLineExpression,
658
+ },
659
+ },
660
+ }),
661
+ });
662
+
663
+ // Should receive diagnostics
664
+ const [diagResponse, diagErr] = await stream.receive();
665
+ expect(diagErr).toBeNull();
666
+ expect(diagResponse).not.toBeNull();
667
+ if (!diagResponse) throw new Error("Expected diagnostics");
668
+
669
+ const diagMsg = JSON.parse(diagResponse.content) as jsonRPC.Message;
670
+ if ("method" in diagMsg && "params" in diagMsg) {
671
+ expect(diagMsg.method).toBe("textDocument/publishDiagnostics");
672
+ const params = diagMsg.params as Record<string, unknown>;
673
+ expect(params.uri).toBe(blockURI);
674
+ const diagnostics = params.diagnostics as unknown[];
675
+ // Should successfully parse multi-line expression
676
+ expect(Array.isArray(diagnostics)).toBe(true);
677
+ }
678
+
679
+ stream.closeSend();
680
+ client.close();
681
+ });
682
+
683
+ it("should handle textDocument/didChange for block expressions", async () => {
684
+ const client = createTestClient();
685
+ const stream = await client.arcs.openLSP();
686
+
687
+ // Initialize
688
+ const initializeRequest: jsonRPC.Request = {
689
+ jsonrpc: "2.0",
690
+ id: 1,
691
+ method: "initialize",
692
+ params: {
693
+ processId: null,
694
+ clientInfo: { name: "test-client", version: "1.0.0" },
695
+ rootUri: null,
696
+ capabilities: {},
697
+ },
698
+ };
699
+
700
+ stream.send({ content: JSON.stringify(initializeRequest) });
701
+ const [initRes] = await stream.receive();
702
+ expect(initRes).not.toBeNull();
703
+ if (!initRes) throw new Error("Expected response");
704
+
705
+ const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
706
+ if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
707
+
708
+ // Send initialized notification
709
+ stream.send({
710
+ content: JSON.stringify({
711
+ jsonrpc: "2.0",
712
+ method: "initialized",
713
+ params: {},
714
+ }),
715
+ });
716
+
717
+ // Create block URI
718
+ const metadata = { is_block: true };
719
+ const encoded = btoa(JSON.stringify(metadata));
720
+ const blockURI = `arc://block/change-test#${encoded}`;
721
+
722
+ // Open initial document
723
+ stream.send({
724
+ content: JSON.stringify({
725
+ jsonrpc: "2.0",
726
+ method: "textDocument/didOpen",
727
+ params: {
728
+ textDocument: {
729
+ uri: blockURI,
730
+ languageId: "arc",
731
+ version: 1,
732
+ text: "return x",
733
+ },
734
+ },
735
+ }),
736
+ });
737
+
738
+ // Receive initial diagnostics
739
+ await stream.receive();
740
+
741
+ // Send didChange to update the expression
742
+ stream.send({
743
+ content: JSON.stringify({
744
+ jsonrpc: "2.0",
745
+ method: "textDocument/didChange",
746
+ params: {
747
+ textDocument: {
748
+ uri: blockURI,
749
+ version: 2,
750
+ },
751
+ contentChanges: [
752
+ {
753
+ text: "return x + y",
754
+ },
755
+ ],
756
+ },
757
+ }),
758
+ });
759
+
760
+ // Should receive updated diagnostics
761
+ const [changeDiagResponse, changeDiagErr] = await stream.receive();
762
+ expect(changeDiagErr).toBeNull();
763
+ expect(changeDiagResponse).not.toBeNull();
764
+ if (!changeDiagResponse) throw new Error("Expected diagnostics");
765
+
766
+ const changeDiagMsg = JSON.parse(changeDiagResponse.content) as jsonRPC.Message;
767
+ if ("method" in changeDiagMsg && "params" in changeDiagMsg) {
768
+ expect(changeDiagMsg.method).toBe("textDocument/publishDiagnostics");
769
+ const params = changeDiagMsg.params as Record<string, unknown>;
770
+ expect(params.uri).toBe(blockURI);
771
+ }
772
+
773
+ stream.closeSend();
774
+ client.close();
775
+ });
776
+
777
+ it("should reject non-block URIs without metadata", async () => {
778
+ const client = createTestClient();
779
+ const stream = await client.arcs.openLSP();
780
+
781
+ // Initialize
782
+ const initializeRequest: jsonRPC.Request = {
783
+ jsonrpc: "2.0",
784
+ id: 1,
785
+ method: "initialize",
786
+ params: {
787
+ processId: null,
788
+ clientInfo: { name: "test-client", version: "1.0.0" },
789
+ rootUri: null,
790
+ capabilities: {},
791
+ },
792
+ };
793
+
794
+ stream.send({ content: JSON.stringify(initializeRequest) });
795
+ const [initRes] = await stream.receive();
796
+ expect(initRes).not.toBeNull();
797
+ if (!initRes) throw new Error("Expected response");
798
+
799
+ const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
800
+ if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
801
+
802
+ // Send initialized notification
803
+ stream.send({
804
+ content: JSON.stringify({
805
+ jsonrpc: "2.0",
806
+ method: "initialized",
807
+ params: {},
808
+ }),
809
+ });
810
+
811
+ // Try to open a block URI without metadata fragment
812
+ const invalidBlockURI = "arc://block/no-metadata";
813
+
814
+ // Open a document with invalid block expression (missing wrapping)
815
+ const blockExpression = "return x * 2";
816
+ stream.send({
817
+ content: JSON.stringify({
818
+ jsonrpc: "2.0",
819
+ method: "textDocument/didOpen",
820
+ params: {
821
+ textDocument: {
822
+ uri: invalidBlockURI,
823
+ languageId: "arc",
824
+ version: 1,
825
+ text: blockExpression,
826
+ },
827
+ },
828
+ }),
829
+ });
830
+
831
+ // Should receive diagnostics with parse errors (not wrapped)
832
+ const [diagResponse, diagErr] = await stream.receive();
833
+ expect(diagErr).toBeNull();
834
+ expect(diagResponse).not.toBeNull();
835
+ if (!diagResponse) throw new Error("Expected diagnostics");
836
+
837
+ const diagMsg = JSON.parse(diagResponse.content) as jsonRPC.Message;
838
+ if ("method" in diagMsg && "params" in diagMsg) {
839
+ expect(diagMsg.method).toBe("textDocument/publishDiagnostics");
840
+ const params = diagMsg.params as Record<string, unknown>;
841
+ const diagnostics = params.diagnostics as Array<{ severity: number }>;
842
+
843
+ // Should have error diagnostics because expression isn't wrapped
844
+ const errors = diagnostics.filter((d) => d.severity === 1); // Error severity
845
+ expect(errors.length).toBeGreaterThan(0);
846
+ }
847
+
848
+ stream.closeSend();
849
+ client.close();
850
+ });
851
+ });
852
+ });