@laserdata/laser-sdk 0.0.1-rc.2 → 0.0.1-rc.22

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 (434) hide show
  1. package/README.md +5 -5
  2. package/dist/agent/agdx.d.ts +55 -0
  3. package/dist/agent/agdx.d.ts.map +1 -0
  4. package/dist/agent/agdx.js +447 -0
  5. package/dist/agent/agdx.js.map +1 -0
  6. package/dist/agent/assembler.d.ts +29 -0
  7. package/dist/agent/assembler.d.ts.map +1 -0
  8. package/dist/agent/assembler.js +69 -0
  9. package/dist/agent/assembler.js.map +1 -0
  10. package/dist/agent/builder.d.ts +114 -0
  11. package/dist/agent/builder.d.ts.map +1 -0
  12. package/dist/agent/builder.js +334 -0
  13. package/dist/agent/builder.js.map +1 -0
  14. package/dist/agent/context.d.ts +68 -0
  15. package/dist/agent/context.d.ts.map +1 -0
  16. package/dist/agent/context.js +212 -0
  17. package/dist/agent/context.js.map +1 -0
  18. package/dist/agent/contract.d.ts +70 -0
  19. package/dist/agent/contract.d.ts.map +1 -0
  20. package/dist/agent/contract.js +275 -0
  21. package/dist/agent/contract.js.map +1 -0
  22. package/dist/agent/registry.d.ts +76 -0
  23. package/dist/agent/registry.d.ts.map +1 -0
  24. package/dist/agent/registry.js +286 -0
  25. package/dist/agent/registry.js.map +1 -0
  26. package/dist/agent/reliable-consumer.d.ts +126 -0
  27. package/dist/agent/reliable-consumer.d.ts.map +1 -0
  28. package/dist/agent/reliable-consumer.js +551 -0
  29. package/dist/agent/reliable-consumer.js.map +1 -0
  30. package/dist/agent/replies.d.ts +28 -0
  31. package/dist/agent/replies.d.ts.map +1 -0
  32. package/dist/agent/replies.js +175 -0
  33. package/dist/agent/replies.js.map +1 -0
  34. package/dist/agent/router.d.ts +72 -0
  35. package/dist/agent/router.d.ts.map +1 -0
  36. package/dist/agent/router.js +172 -0
  37. package/dist/agent/router.js.map +1 -0
  38. package/dist/agent/scope.d.ts +16 -0
  39. package/dist/agent/scope.d.ts.map +1 -0
  40. package/dist/agent/scope.js +34 -0
  41. package/dist/agent/scope.js.map +1 -0
  42. package/dist/agent/workflow.d.ts +85 -0
  43. package/dist/agent/workflow.d.ts.map +1 -0
  44. package/dist/agent/workflow.js +416 -0
  45. package/dist/agent/workflow.js.map +1 -0
  46. package/dist/blob.d.ts +12 -0
  47. package/dist/blob.d.ts.map +1 -0
  48. package/dist/blob.js +34 -0
  49. package/dist/blob.js.map +1 -0
  50. package/dist/bridges/a2a.d.ts +89 -0
  51. package/dist/bridges/a2a.d.ts.map +1 -0
  52. package/dist/bridges/a2a.js +244 -0
  53. package/dist/bridges/a2a.js.map +1 -0
  54. package/dist/bridges/agui.d.ts +66 -0
  55. package/dist/bridges/agui.d.ts.map +1 -0
  56. package/dist/bridges/agui.js +335 -0
  57. package/dist/bridges/agui.js.map +1 -0
  58. package/dist/bridges/edge-auth.d.ts +16 -0
  59. package/dist/bridges/edge-auth.d.ts.map +1 -0
  60. package/dist/bridges/edge-auth.js +19 -0
  61. package/dist/bridges/edge-auth.js.map +1 -0
  62. package/dist/bridges/hops.d.ts +9 -0
  63. package/dist/bridges/hops.d.ts.map +1 -0
  64. package/dist/bridges/hops.js +16 -0
  65. package/dist/bridges/hops.js.map +1 -0
  66. package/dist/bridges/mcp.d.ts +79 -0
  67. package/dist/bridges/mcp.d.ts.map +1 -0
  68. package/dist/bridges/mcp.js +248 -0
  69. package/dist/bridges/mcp.js.map +1 -0
  70. package/dist/client/bytes.d.ts +3 -0
  71. package/dist/client/bytes.d.ts.map +1 -0
  72. package/dist/client/bytes.js +9 -0
  73. package/dist/client/bytes.js.map +1 -0
  74. package/dist/client/capabilities.d.ts +36 -0
  75. package/dist/client/capabilities.d.ts.map +1 -0
  76. package/dist/client/capabilities.js +91 -0
  77. package/dist/client/capabilities.js.map +1 -0
  78. package/dist/client/errors.d.ts +178 -0
  79. package/dist/client/errors.d.ts.map +1 -0
  80. package/dist/client/errors.js +192 -0
  81. package/dist/client/errors.js.map +1 -0
  82. package/dist/client/internals.d.ts +5 -0
  83. package/dist/client/internals.d.ts.map +1 -0
  84. package/dist/client/internals.js +5 -0
  85. package/dist/client/internals.js.map +1 -0
  86. package/dist/client/laser.d.ts +238 -0
  87. package/dist/client/laser.d.ts.map +1 -0
  88. package/dist/client/laser.js +831 -0
  89. package/dist/client/laser.js.map +1 -0
  90. package/dist/client/laserdata-ca.d.ts +2 -0
  91. package/dist/client/laserdata-ca.d.ts.map +1 -0
  92. package/dist/client/laserdata-ca.js +35 -0
  93. package/dist/client/laserdata-ca.js.map +1 -0
  94. package/dist/client/managed.d.ts +6 -0
  95. package/dist/client/managed.d.ts.map +1 -0
  96. package/dist/client/managed.js +19 -0
  97. package/dist/client/managed.js.map +1 -0
  98. package/dist/context-scope.d.ts +40 -0
  99. package/dist/context-scope.d.ts.map +1 -0
  100. package/dist/context-scope.js +73 -0
  101. package/dist/context-scope.js.map +1 -0
  102. package/dist/context.d.ts +64 -0
  103. package/dist/context.d.ts.map +1 -0
  104. package/dist/context.js +149 -0
  105. package/dist/context.js.map +1 -0
  106. package/dist/conversation-state.d.ts +24 -0
  107. package/dist/conversation-state.d.ts.map +1 -0
  108. package/dist/conversation-state.js +29 -0
  109. package/dist/conversation-state.js.map +1 -0
  110. package/dist/crash-context.d.ts +11 -0
  111. package/dist/crash-context.d.ts.map +1 -0
  112. package/dist/crash-context.js +62 -0
  113. package/dist/crash-context.js.map +1 -0
  114. package/dist/full.d.ts +3 -0
  115. package/dist/full.d.ts.map +1 -0
  116. package/dist/full.js +3 -0
  117. package/dist/full.js.map +1 -0
  118. package/dist/govern.d.ts +133 -0
  119. package/dist/govern.d.ts.map +1 -0
  120. package/dist/govern.js +347 -0
  121. package/dist/govern.js.map +1 -0
  122. package/dist/iggy/apache-iggy.d.ts +173 -0
  123. package/dist/iggy/apache-iggy.d.ts.map +1 -0
  124. package/dist/iggy/apache-iggy.js +634 -0
  125. package/dist/iggy/apache-iggy.js.map +1 -0
  126. package/dist/index.d.ts +121 -0
  127. package/dist/index.d.ts.map +1 -0
  128. package/dist/index.js +64 -0
  129. package/dist/index.js.map +1 -0
  130. package/dist/intent.d.ts +75 -0
  131. package/dist/intent.d.ts.map +1 -0
  132. package/dist/intent.js +195 -0
  133. package/dist/intent.js.map +1 -0
  134. package/dist/managed/batch.d.ts +5 -0
  135. package/dist/managed/batch.d.ts.map +1 -0
  136. package/dist/managed/batch.js +32 -0
  137. package/dist/managed/batch.js.map +1 -0
  138. package/dist/managed/forks.d.ts +72 -0
  139. package/dist/managed/forks.d.ts.map +1 -0
  140. package/dist/managed/forks.js +188 -0
  141. package/dist/managed/forks.js.map +1 -0
  142. package/dist/managed/graph.d.ts +58 -0
  143. package/dist/managed/graph.d.ts.map +1 -0
  144. package/dist/managed/graph.js +176 -0
  145. package/dist/managed/graph.js.map +1 -0
  146. package/dist/managed/kv.d.ts +144 -0
  147. package/dist/managed/kv.d.ts.map +1 -0
  148. package/dist/managed/kv.js +502 -0
  149. package/dist/managed/kv.js.map +1 -0
  150. package/dist/managed/projections.d.ts +61 -0
  151. package/dist/managed/projections.d.ts.map +1 -0
  152. package/dist/managed/projections.js +191 -0
  153. package/dist/managed/projections.js.map +1 -0
  154. package/dist/managed/query.d.ts +72 -0
  155. package/dist/managed/query.d.ts.map +1 -0
  156. package/dist/managed/query.js +287 -0
  157. package/dist/managed/query.js.map +1 -0
  158. package/dist/managed/rbac.d.ts +16 -0
  159. package/dist/managed/rbac.d.ts.map +1 -0
  160. package/dist/managed/rbac.js +82 -0
  161. package/dist/managed/rbac.js.map +1 -0
  162. package/dist/managed/runs.d.ts +40 -0
  163. package/dist/managed/runs.d.ts.map +1 -0
  164. package/dist/managed/runs.js +112 -0
  165. package/dist/managed/runs.js.map +1 -0
  166. package/dist/managed/watch.d.ts +21 -0
  167. package/dist/managed/watch.d.ts.map +1 -0
  168. package/dist/managed/watch.js +73 -0
  169. package/dist/managed/watch.js.map +1 -0
  170. package/dist/memory/handle.d.ts +77 -0
  171. package/dist/memory/handle.d.ts.map +1 -0
  172. package/dist/memory/handle.js +234 -0
  173. package/dist/memory/handle.js.map +1 -0
  174. package/dist/memory/log-memory.d.ts +38 -0
  175. package/dist/memory/log-memory.d.ts.map +1 -0
  176. package/dist/memory/log-memory.js +309 -0
  177. package/dist/memory/log-memory.js.map +1 -0
  178. package/dist/memory/topic.d.ts +22 -0
  179. package/dist/memory/topic.d.ts.map +1 -0
  180. package/dist/memory/topic.js +56 -0
  181. package/dist/memory/topic.js.map +1 -0
  182. package/dist/memory/types.d.ts +108 -0
  183. package/dist/memory/types.d.ts.map +1 -0
  184. package/dist/memory/types.js +127 -0
  185. package/dist/memory/types.js.map +1 -0
  186. package/dist/memory/vector-memory.d.ts +20 -0
  187. package/dist/memory/vector-memory.d.ts.map +1 -0
  188. package/dist/memory/vector-memory.js +193 -0
  189. package/dist/memory/vector-memory.js.map +1 -0
  190. package/dist/memory.d.ts +7 -0
  191. package/dist/memory.d.ts.map +1 -0
  192. package/dist/memory.js +6 -0
  193. package/dist/memory.js.map +1 -0
  194. package/dist/observe.d.ts +10 -0
  195. package/dist/observe.d.ts.map +1 -0
  196. package/dist/observe.js +5 -0
  197. package/dist/observe.js.map +1 -0
  198. package/dist/opentelemetry.d.ts +22 -0
  199. package/dist/opentelemetry.d.ts.map +1 -0
  200. package/dist/opentelemetry.js +38 -0
  201. package/dist/opentelemetry.js.map +1 -0
  202. package/dist/provenance/agent-topic.d.ts +14 -0
  203. package/dist/provenance/agent-topic.d.ts.map +1 -0
  204. package/dist/provenance/agent-topic.js +13 -0
  205. package/dist/provenance/agent-topic.js.map +1 -0
  206. package/dist/provenance/provenance.d.ts +24 -0
  207. package/dist/provenance/provenance.d.ts.map +1 -0
  208. package/dist/provenance/provenance.js +186 -0
  209. package/dist/provenance/provenance.js.map +1 -0
  210. package/dist/provenance/session-policy.d.ts +4 -0
  211. package/dist/provenance/session-policy.d.ts.map +1 -0
  212. package/dist/provenance/session-policy.js +5 -0
  213. package/dist/provenance/session-policy.js.map +1 -0
  214. package/dist/runtime/async-once.d.ts +6 -0
  215. package/dist/runtime/async-once.d.ts.map +1 -0
  216. package/dist/runtime/async-once.js +19 -0
  217. package/dist/runtime/async-once.js.map +1 -0
  218. package/dist/runtime/clock.d.ts +14 -0
  219. package/dist/runtime/clock.d.ts.map +1 -0
  220. package/dist/runtime/clock.js +21 -0
  221. package/dist/runtime/clock.js.map +1 -0
  222. package/dist/runtime/mutex.d.ts +5 -0
  223. package/dist/runtime/mutex.d.ts.map +1 -0
  224. package/dist/runtime/mutex.js +23 -0
  225. package/dist/runtime/mutex.js.map +1 -0
  226. package/dist/runtime/ulid.d.ts +7 -0
  227. package/dist/runtime/ulid.d.ts.map +1 -0
  228. package/dist/runtime/ulid.js +17 -0
  229. package/dist/runtime/ulid.js.map +1 -0
  230. package/dist/schema-codecs.d.ts +16 -0
  231. package/dist/schema-codecs.d.ts.map +1 -0
  232. package/dist/schema-codecs.js +174 -0
  233. package/dist/schema-codecs.js.map +1 -0
  234. package/dist/signing.d.ts +63 -0
  235. package/dist/signing.d.ts.map +1 -0
  236. package/dist/signing.js +288 -0
  237. package/dist/signing.js.map +1 -0
  238. package/dist/snapshot.d.ts +24 -0
  239. package/dist/snapshot.d.ts.map +1 -0
  240. package/dist/snapshot.js +80 -0
  241. package/dist/snapshot.js.map +1 -0
  242. package/dist/state-store.d.ts +20 -0
  243. package/dist/state-store.d.ts.map +1 -0
  244. package/dist/state-store.js +70 -0
  245. package/dist/state-store.js.map +1 -0
  246. package/dist/stream/codecs.d.ts +9 -0
  247. package/dist/stream/codecs.d.ts.map +1 -0
  248. package/dist/stream/codecs.js +83 -0
  249. package/dist/stream/codecs.js.map +1 -0
  250. package/dist/stream/consumer.d.ts +50 -0
  251. package/dist/stream/consumer.d.ts.map +1 -0
  252. package/dist/stream/consumer.js +145 -0
  253. package/dist/stream/consumer.js.map +1 -0
  254. package/dist/stream/cursor.d.ts +26 -0
  255. package/dist/stream/cursor.d.ts.map +1 -0
  256. package/dist/stream/cursor.js +83 -0
  257. package/dist/stream/cursor.js.map +1 -0
  258. package/dist/stream/header-value.d.ts +18 -0
  259. package/dist/stream/header-value.d.ts.map +1 -0
  260. package/dist/stream/header-value.js +70 -0
  261. package/dist/stream/header-value.js.map +1 -0
  262. package/dist/stream/polling-strategy.d.ts +14 -0
  263. package/dist/stream/polling-strategy.d.ts.map +1 -0
  264. package/dist/stream/polling-strategy.js +2 -0
  265. package/dist/stream/polling-strategy.js.map +1 -0
  266. package/dist/stream/producer.d.ts +44 -0
  267. package/dist/stream/producer.d.ts.map +1 -0
  268. package/dist/stream/producer.js +125 -0
  269. package/dist/stream/producer.js.map +1 -0
  270. package/dist/stream/publish.d.ts +83 -0
  271. package/dist/stream/publish.d.ts.map +1 -0
  272. package/dist/stream/publish.js +287 -0
  273. package/dist/stream/publish.js.map +1 -0
  274. package/dist/stream/record.d.ts +29 -0
  275. package/dist/stream/record.d.ts.map +1 -0
  276. package/dist/stream/record.js +152 -0
  277. package/dist/stream/record.js.map +1 -0
  278. package/dist/stream/routing.d.ts +10 -0
  279. package/dist/stream/routing.d.ts.map +1 -0
  280. package/dist/stream/routing.js +2 -0
  281. package/dist/stream/routing.js.map +1 -0
  282. package/dist/stream/stream.d.ts +14 -0
  283. package/dist/stream/stream.d.ts.map +1 -0
  284. package/dist/stream/stream.js +26 -0
  285. package/dist/stream/stream.js.map +1 -0
  286. package/dist/stream/topic.d.ts +52 -0
  287. package/dist/stream/topic.d.ts.map +1 -0
  288. package/dist/stream/topic.js +181 -0
  289. package/dist/stream/topic.js.map +1 -0
  290. package/dist/stream/typed-topic.d.ts +59 -0
  291. package/dist/stream/typed-topic.d.ts.map +1 -0
  292. package/dist/stream/typed-topic.js +119 -0
  293. package/dist/stream/typed-topic.js.map +1 -0
  294. package/dist/swarm.d.ts +16 -0
  295. package/dist/swarm.d.ts.map +1 -0
  296. package/dist/swarm.js +40 -0
  297. package/dist/swarm.js.map +1 -0
  298. package/dist/testing.d.ts +16 -0
  299. package/dist/testing.d.ts.map +1 -0
  300. package/dist/testing.js +19 -0
  301. package/dist/testing.js.map +1 -0
  302. package/dist/types/ids.d.ts +48 -0
  303. package/dist/types/ids.d.ts.map +1 -0
  304. package/dist/types/ids.js +161 -0
  305. package/dist/types/ids.js.map +1 -0
  306. package/dist/wire/agent-record.d.ts +24 -0
  307. package/dist/wire/agent-record.d.ts.map +1 -0
  308. package/dist/wire/agent-record.js +99 -0
  309. package/dist/wire/agent-record.js.map +1 -0
  310. package/dist/wire/agent-workflow.d.ts +118 -0
  311. package/dist/wire/agent-workflow.d.ts.map +1 -0
  312. package/dist/wire/agent-workflow.js +290 -0
  313. package/dist/wire/agent-workflow.js.map +1 -0
  314. package/dist/wire/agent.d.ts +255 -0
  315. package/dist/wire/agent.d.ts.map +1 -0
  316. package/dist/wire/agent.js +792 -0
  317. package/dist/wire/agent.js.map +1 -0
  318. package/dist/wire/authz.d.ts +186 -0
  319. package/dist/wire/authz.d.ts.map +1 -0
  320. package/dist/wire/authz.js +545 -0
  321. package/dist/wire/authz.js.map +1 -0
  322. package/dist/wire/batch.d.ts +17 -0
  323. package/dist/wire/batch.d.ts.map +1 -0
  324. package/dist/wire/batch.js +41 -0
  325. package/dist/wire/batch.js.map +1 -0
  326. package/dist/wire/browse.d.ts +96 -0
  327. package/dist/wire/browse.d.ts.map +1 -0
  328. package/dist/wire/browse.js +201 -0
  329. package/dist/wire/browse.js.map +1 -0
  330. package/dist/wire/cbor.d.ts +35 -0
  331. package/dist/wire/cbor.d.ts.map +1 -0
  332. package/dist/wire/cbor.js +231 -0
  333. package/dist/wire/cbor.js.map +1 -0
  334. package/dist/wire/change.d.ts +12 -0
  335. package/dist/wire/change.d.ts.map +1 -0
  336. package/dist/wire/change.js +22 -0
  337. package/dist/wire/change.js.map +1 -0
  338. package/dist/wire/clients.d.ts +27 -0
  339. package/dist/wire/clients.d.ts.map +1 -0
  340. package/dist/wire/clients.js +64 -0
  341. package/dist/wire/clients.js.map +1 -0
  342. package/dist/wire/codes.d.ts +67 -0
  343. package/dist/wire/codes.d.ts.map +1 -0
  344. package/dist/wire/codes.js +67 -0
  345. package/dist/wire/codes.js.map +1 -0
  346. package/dist/wire/commands.d.ts +68 -0
  347. package/dist/wire/commands.d.ts.map +1 -0
  348. package/dist/wire/commands.js +140 -0
  349. package/dist/wire/commands.js.map +1 -0
  350. package/dist/wire/content.d.ts +17 -0
  351. package/dist/wire/content.d.ts.map +1 -0
  352. package/dist/wire/content.js +47 -0
  353. package/dist/wire/content.js.map +1 -0
  354. package/dist/wire/control.d.ts +170 -0
  355. package/dist/wire/control.d.ts.map +1 -0
  356. package/dist/wire/control.js +453 -0
  357. package/dist/wire/control.js.map +1 -0
  358. package/dist/wire/fork.d.ts +112 -0
  359. package/dist/wire/fork.d.ts.map +1 -0
  360. package/dist/wire/fork.js +280 -0
  361. package/dist/wire/fork.js.map +1 -0
  362. package/dist/wire/forward.d.ts +23 -0
  363. package/dist/wire/forward.d.ts.map +1 -0
  364. package/dist/wire/forward.js +72 -0
  365. package/dist/wire/forward.js.map +1 -0
  366. package/dist/wire/graph.d.ts +181 -0
  367. package/dist/wire/graph.d.ts.map +1 -0
  368. package/dist/wire/graph.js +554 -0
  369. package/dist/wire/graph.js.map +1 -0
  370. package/dist/wire/hashing.d.ts +2 -0
  371. package/dist/wire/hashing.d.ts.map +1 -0
  372. package/dist/wire/hashing.js +21 -0
  373. package/dist/wire/hashing.js.map +1 -0
  374. package/dist/wire/headers.d.ts +32 -0
  375. package/dist/wire/headers.d.ts.map +1 -0
  376. package/dist/wire/headers.js +32 -0
  377. package/dist/wire/headers.js.map +1 -0
  378. package/dist/wire/hello.d.ts +50 -0
  379. package/dist/wire/hello.d.ts.map +1 -0
  380. package/dist/wire/hello.js +122 -0
  381. package/dist/wire/hello.js.map +1 -0
  382. package/dist/wire/http.d.ts +95 -0
  383. package/dist/wire/http.d.ts.map +1 -0
  384. package/dist/wire/http.js +282 -0
  385. package/dist/wire/http.js.map +1 -0
  386. package/dist/wire/ids.d.ts +50 -0
  387. package/dist/wire/ids.d.ts.map +1 -0
  388. package/dist/wire/ids.js +198 -0
  389. package/dist/wire/ids.js.map +1 -0
  390. package/dist/wire/index.d.ts +32 -0
  391. package/dist/wire/index.d.ts.map +1 -0
  392. package/dist/wire/index.js +32 -0
  393. package/dist/wire/index.js.map +1 -0
  394. package/dist/wire/kv.d.ts +260 -0
  395. package/dist/wire/kv.d.ts.map +1 -0
  396. package/dist/wire/kv.js +650 -0
  397. package/dist/wire/kv.js.map +1 -0
  398. package/dist/wire/limits.d.ts +36 -0
  399. package/dist/wire/limits.d.ts.map +1 -0
  400. package/dist/wire/limits.js +36 -0
  401. package/dist/wire/limits.js.map +1 -0
  402. package/dist/wire/memory.d.ts +17 -0
  403. package/dist/wire/memory.d.ts.map +1 -0
  404. package/dist/wire/memory.js +65 -0
  405. package/dist/wire/memory.js.map +1 -0
  406. package/dist/wire/mutation.d.ts +10 -0
  407. package/dist/wire/mutation.d.ts.map +1 -0
  408. package/dist/wire/mutation.js +18 -0
  409. package/dist/wire/mutation.js.map +1 -0
  410. package/dist/wire/query.d.ts +210 -0
  411. package/dist/wire/query.d.ts.map +1 -0
  412. package/dist/wire/query.js +594 -0
  413. package/dist/wire/query.js.map +1 -0
  414. package/dist/wire/result.d.ts +25 -0
  415. package/dist/wire/result.d.ts.map +1 -0
  416. package/dist/wire/result.js +52 -0
  417. package/dist/wire/result.js.map +1 -0
  418. package/dist/wire/snapshot.d.ts +11 -0
  419. package/dist/wire/snapshot.d.ts.map +1 -0
  420. package/dist/wire/snapshot.js +50 -0
  421. package/dist/wire/snapshot.js.map +1 -0
  422. package/dist/wire/topics.d.ts +5 -0
  423. package/dist/wire/topics.d.ts.map +1 -0
  424. package/dist/wire/topics.js +5 -0
  425. package/dist/wire/topics.js.map +1 -0
  426. package/dist/wire/topology.d.ts +24 -0
  427. package/dist/wire/topology.d.ts.map +1 -0
  428. package/dist/wire/topology.js +56 -0
  429. package/dist/wire/topology.js.map +1 -0
  430. package/dist/wire/value.d.ts +21 -0
  431. package/dist/wire/value.d.ts.map +1 -0
  432. package/dist/wire/value.js +40 -0
  433. package/dist/wire/value.js.map +1 -0
  434. package/package.json +8 -6
package/README.md CHANGED
@@ -4,7 +4,7 @@ The native TypeScript client for LaserData over Apache Iggy. It provides typed s
4
4
 
5
5
  This prerelease targets Node 22.14 or later. Bun, Deno, and browsers are not supported because the Apache Iggy transport uses Node TCP and TLS APIs.
6
6
 
7
- > **Prerelease (`0.0.1-rc.2`).** Pin an exact version while the public API and wire contract are still in release-candidate development.
7
+ > **Prerelease (`0.0.1-rc.22`).** Pin an exact version while the public API and wire contract are still in release-candidate development.
8
8
 
9
9
  ## Install
10
10
 
@@ -32,9 +32,9 @@ console.log(`read ${records.length} order(s)`)
32
32
 
33
33
  Use the bare `user:password@host:port` connection string. The SDK supplies the Apache Iggy TCP scheme internally. One connection addresses every stream on the server. Select a stream explicitly with `laser.stream(name)`, then a topic with `.topic(name)`. `Laser.connectWithStream()` only pins a default stream so `laser.topic(name)` can be used as a shortcut. It does not limit the connection to that stream. `Laser.connectEnv()` reads `LASER_CONNECTION_STRING` and the optional `LASER_STREAM`. `Laser.local()` targets the default local server. `Laser.builder()` accepts a connection string, an address and credentials, or an injected Apache Iggy client with explicit owned or borrowed lifetime.
34
34
 
35
- Owned connections retry the initial handshake and reconnect after a dropped socket, with unlimited retries at one-second intervals by default. Set `reconnection_retries` to a non-negative integer and `reconnection_interval` to `250ms`, `1s`, or `1m` in the connection string to tune the policy. Laser owns this loop because the upstream Node reconnect path can leave its connect promise pending. An injected client remains under its caller's lifecycle and reconnect policy.
35
+ Owned connections retry the initial handshake and reconnect after a dropped socket, with unlimited retries at one-second intervals by default. Set `reconnection_retries` to a non-negative integer and `reconnection_interval` to `250ms`, `1s`, or `1m` in the connection string to tune the policy. An injected client remains under its caller's lifecycle and reconnect policy.
36
36
 
37
- LaserData Cloud hostnames automatically use TLS with the public LaserData root CA embedded in the package. `LASER_TLS_CERT` selects another CA file and `LASER_NO_TLS` disables automatic TLS. Other hosts keep the connection string's TLS settings unchanged.
37
+ The TypeScript SDK pins Apache Iggy `0.8.1-edge.3` and always constructs a VSR client. There is no protocol option in the Laser API. An injected Apache Iggy client must also use VSR and is rejected before use otherwise.
38
38
 
39
39
  ## Streaming model
40
40
 
@@ -81,14 +81,14 @@ Registered Avro, Protobuf, and JSON Schema topics compile the writer schema once
81
81
 
82
82
  ## Managed data surfaces
83
83
 
84
- LaserData Cloud announces its capabilities during connection setup. Stock Apache Iggy serves streaming and returns `UnsupportedError` for managed calls. The same client code can feature-detect through `laser.capabilities()`.
84
+ LaserData Cloud and Laser Stack announce their capabilities during connection setup. Apache Iggy without a managed backend serves streaming and returns `UnsupportedError` for managed calls. The same client code can feature-detect through `laser.capabilities()`.
85
85
 
86
86
  The root client exposes query, projections, bindings, schemas, key-value and CAS, forks, graph traversal, RBAC, runs, watch feeds, and independent managed command batches. Query uses the managed command path, not a request topic. Every command is encoded through the same Rust-owned AGDX fixtures consumed by the other SDKs.
87
87
 
88
88
  ```ts
89
89
  import { graphNodeEntity } from "@laserdata/laser-sdk"
90
90
 
91
- const paid = await laser.query("orders_v1").filterEq("status", "paid").limit(20).fetch()
91
+ const paid = await laser.query("orders_v1").whereEq("status", "paid").limit(20).fetch()
92
92
 
93
93
  const key = new TextEncoder().encode("user:42")
94
94
  const session = { cart: ["sku-1"] }
@@ -0,0 +1,55 @@
1
+ import { type BytesLike } from "../client/bytes.js";
2
+ import type { LaserTransport } from "../iggy/apache-iggy.js";
3
+ import { type UlidSource } from "../runtime/ulid.js";
4
+ import { type SigningKey } from "../signing.js";
5
+ import { type AgentId as SdkAgentId, type ConversationId as SdkConversationId } from "../types/ids.js";
6
+ import { type AgentEnvelope, type AgentErrorBody, type IdempotencyKey, type TaskState, type TokenUsage } from "../wire/agent.js";
7
+ import { ContentType } from "../wire/content.js";
8
+ import { ChannelId, CorrelationId, type LogPosition, RecordId } from "../wire/ids.js";
9
+ import type { Value } from "../wire/value.js";
10
+ export declare const DEFAULT_CHUNK_FLUSH_BYTES = 512;
11
+ export declare const DEFAULT_CHUNK_LINGER_MS = 20;
12
+ export declare const MAX_CHUNK_BODY_BYTES: number;
13
+ export type AgdxLogPosition = LogPosition;
14
+ export interface Agdx {
15
+ readonly topicName: string;
16
+ command(correlation: CorrelationId, body: BytesLike): AgdxSend;
17
+ respond(correlation: CorrelationId, body: BytesLike): AgdxSend;
18
+ emit(body: BytesLike): AgdxSend;
19
+ status(operation: string): AgdxSend;
20
+ fail(correlation: CorrelationId, error: AgentErrorBody): AgdxSend;
21
+ stream(correlation: CorrelationId, purpose: string): AgdxStream;
22
+ requestInput(replyTopic: string, prompt: BytesLike, timeoutMs: number, options?: {
23
+ readonly signal?: AbortSignal;
24
+ }): Promise<Uint8Array>;
25
+ }
26
+ export declare function createAgdx(transport: LaserTransport, streamName: string, topicName: string, source: SdkAgentId, conversation: SdkConversationId, ulidSource?: UlidSource, govern?: (envelope: AgentEnvelope, willSign: boolean) => Promise<Uint8Array>): Agdx;
27
+ export interface AgdxSend {
28
+ withTarget(target: SdkAgentId): this;
29
+ withCause(cause: RecordId, causeAt?: LogPosition): this;
30
+ withCorrelation(correlation: CorrelationId): this;
31
+ withIdempotencyKey(key: IdempotencyKey): this;
32
+ withDeadlineMicros(deadlineMicros: bigint): this;
33
+ withTaskState(state: TaskState): this;
34
+ withOperation(operation: string): this;
35
+ withTool(tool: string): this;
36
+ withUsage(usage: TokenUsage): this;
37
+ withMetadata(key: string, value: Value): this;
38
+ last(): this;
39
+ contentType(contentType: ContentType): this;
40
+ body(body: BytesLike): this;
41
+ signedBy(key: SigningKey): this;
42
+ send(): Promise<RecordId | undefined>;
43
+ }
44
+ export interface AgdxStream {
45
+ readonly channel: ChannelId;
46
+ withDeadlineMicros(deadlineMicros: bigint): this;
47
+ withTarget(target: SdkAgentId): this;
48
+ contentType(contentType: ContentType): this;
49
+ buffered(maxChunks: number, lingerMs: number): this;
50
+ write(body: BytesLike): Promise<void>;
51
+ flush(): Promise<void>;
52
+ finish(finishReason: string, usage?: TokenUsage): Promise<void>;
53
+ fail(error: AgentErrorBody): Promise<void>;
54
+ }
55
+ //# sourceMappingURL=agdx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agdx.d.ts","sourceRoot":"","sources":["../../src/agent/agdx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EACL,KAAK,OAAO,IAAI,UAAU,EAC1B,KAAK,cAAc,IAAI,iBAAiB,EACzC,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,UAAU,EAsBhB,MAAM,kBAAkB,CAAA;AAIzB,OAAO,EAAE,WAAW,EAAmB,MAAM,oBAAoB,CAAA;AACjE,OAAO,EACL,SAAS,EAET,aAAa,EACb,KAAK,WAAW,EAChB,QAAQ,EACT,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE7C,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAC5C,eAAO,MAAM,uBAAuB,KAAK,CAAA;AACzC,eAAO,MAAM,oBAAoB,QAAY,CAAA;AAM7C,MAAM,MAAM,eAAe,GAAG,WAAW,CAAA;AA0JzC,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,OAAO,CAAC,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC9D,OAAO,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+ import { mintUlidValue } from "../runtime/ulid.js";
4
+ import {} from "../signing.js";
5
+ import {} from "../types/ids.js";
6
+ import { AgentKind, chunkEnvelope, commandEnvelope, decodeAgentEnvelope, decodeAgentErrorBody, encodeAgentErrorBody, errorEnvelope, eventEnvelope, responseEnvelope, parseAgentId, statusEnvelope, validateAgentEnvelope, withCause, withCorrelation, withDeadlineMicros, withIdempotencyKey, withMetadata, withOperation, withTarget, withTaskState, withTool, withUsage } from "../wire/agent.js";
7
+ import { canonicalAgentRecord } from "../wire/agent-record.js";
8
+ import { decodeOne, encodeNamed, expectMap } from "../wire/cbor.js";
9
+ import { AGENT_OP_VERSION } from "../wire/codes.js";
10
+ import { ContentType, contentTypeCode } from "../wire/content.js";
11
+ import { ChannelId, ConversationId, CorrelationId, RecordId } from "../wire/ids.js";
12
+ export const DEFAULT_CHUNK_FLUSH_BYTES = 512;
13
+ export const DEFAULT_CHUNK_LINGER_MS = 20;
14
+ export const MAX_CHUNK_BODY_BYTES = 64 * 1024;
15
+ const REPLY_BATCH = 200;
16
+ const REPLY_POLL_INTERVAL_MS = 50;
17
+ const textDecoder = new TextDecoder("utf-8", { fatal: true });
18
+ function delay(ms, signal) {
19
+ return new Promise((resolve, reject) => {
20
+ if (signal?.aborted === true) {
21
+ reject(new CancelledError("AGDX reply wait aborted", { cause: signal.reason }));
22
+ return;
23
+ }
24
+ const onAbort = () => {
25
+ clearTimeout(timer);
26
+ reject(new CancelledError("AGDX reply wait aborted", { cause: signal?.reason }));
27
+ };
28
+ const timer = setTimeout(() => {
29
+ signal?.removeEventListener("abort", onAbort);
30
+ resolve();
31
+ }, ms);
32
+ signal?.addEventListener("abort", onAbort, { once: true });
33
+ });
34
+ }
35
+ function wireAgentId(agent) {
36
+ return parseAgentId(agent.asString());
37
+ }
38
+ function u32FromLittleEndian(header) {
39
+ if (header.bytes.byteLength !== 4)
40
+ throw new InvalidError("AGDX u32 header must be 4 bytes");
41
+ return new DataView(header.bytes.buffer, header.bytes.byteOffset, header.bytes.byteLength).getUint32(0, true);
42
+ }
43
+ function iggyHeader(header) {
44
+ switch (header.kind) {
45
+ case "u32":
46
+ return { kind: "uint32", value: u32FromLittleEndian(header) };
47
+ case "u8": {
48
+ const value = header.bytes[0];
49
+ if (header.bytes.byteLength !== 1 || value === undefined) {
50
+ throw new InvalidError("AGDX u8 header must be 1 byte");
51
+ }
52
+ return { kind: "uint8", value };
53
+ }
54
+ case "uint128":
55
+ if (header.bytes.byteLength !== 16) {
56
+ throw new InvalidError("AGDX uint128 header must be 16 bytes");
57
+ }
58
+ return { kind: "uint128", value: header.bytes.slice() };
59
+ case "string":
60
+ return { kind: "string", value: textDecoder.decode(header.bytes) };
61
+ }
62
+ }
63
+ function assemble(envelope, contentType) {
64
+ validateAgentEnvelope(envelope);
65
+ const record = canonicalAgentRecord(envelope, contentType);
66
+ return {
67
+ payload: record.payload,
68
+ headers: new Map(Array.from(record.headers, ([key, header]) => [key, iggyHeader(header)]))
69
+ };
70
+ }
71
+ function mintRecordId(source) {
72
+ return RecordId.fromU128(mintUlidValue(source));
73
+ }
74
+ function mintCorrelationId(source) {
75
+ return CorrelationId.fromU128(mintUlidValue(source));
76
+ }
77
+ function mintChannelId(source) {
78
+ return ChannelId.fromU128(mintUlidValue(source));
79
+ }
80
+ class AgdxReplyReader {
81
+ transport;
82
+ stream;
83
+ topic;
84
+ partitions;
85
+ offsets = [];
86
+ constructor(transport, stream, topic) {
87
+ this.transport = transport;
88
+ this.stream = stream;
89
+ this.topic = topic;
90
+ }
91
+ static async atTail(transport, stream, topic) {
92
+ const reader = new AgdxReplyReader(transport, stream, topic);
93
+ const partitions = await transport.findTopicPartitionCount(stream, topic);
94
+ if (partitions === undefined)
95
+ return reader;
96
+ reader.partitions = partitions;
97
+ reader.offsets = new Array(partitions).fill(0n);
98
+ for (let partitionId = 0; partitionId < partitions; partitionId += 1) {
99
+ const messages = await transport.pollMessages(stream, topic, { kind: "single", partitionId }, { kind: "last" }, 1, false);
100
+ const last = messages[messages.length - 1];
101
+ if (last !== undefined)
102
+ reader.offsets[partitionId] = last.offset + 1n;
103
+ }
104
+ return reader;
105
+ }
106
+ async next(correlation) {
107
+ if (this.partitions === undefined) {
108
+ this.partitions = await this.transport.findTopicPartitionCount(this.stream, this.topic);
109
+ if (this.partitions === undefined)
110
+ return undefined;
111
+ }
112
+ if (this.offsets.length < this.partitions) {
113
+ this.offsets.push(...new Array(this.partitions - this.offsets.length).fill(0n));
114
+ }
115
+ for (let partitionId = 0; partitionId < this.partitions; partitionId += 1) {
116
+ const messages = await this.transport.pollMessages(this.stream, this.topic, { kind: "single", partitionId }, { kind: "offset", value: this.offsets[partitionId] ?? 0n }, REPLY_BATCH, false);
117
+ for (const message of messages) {
118
+ this.offsets[partitionId] = message.offset + 1n;
119
+ const envelope = decodeEnvelope(message);
120
+ if (envelope !== undefined &&
121
+ envelope.correlation?.equals(correlation) === true &&
122
+ (envelope.kind === AgentKind.Response || envelope.kind === AgentKind.Error)) {
123
+ return envelope;
124
+ }
125
+ }
126
+ }
127
+ return undefined;
128
+ }
129
+ }
130
+ function decodeEnvelope(message) {
131
+ try {
132
+ const context = "AGDX reply";
133
+ return decodeAgentEnvelope(expectMap(decodeOne(message.payload, context), context), context);
134
+ }
135
+ catch {
136
+ return undefined;
137
+ }
138
+ }
139
+ class AgdxClient {
140
+ transport;
141
+ streamName;
142
+ topicName;
143
+ sourceId;
144
+ conversationId;
145
+ ulidSource;
146
+ govern;
147
+ constructor(transport, streamName, topicName, sourceId, conversationId, ulidSource, govern) {
148
+ this.transport = transport;
149
+ this.streamName = streamName;
150
+ this.topicName = topicName;
151
+ this.sourceId = sourceId;
152
+ this.conversationId = conversationId;
153
+ this.ulidSource = ulidSource;
154
+ this.govern = govern;
155
+ }
156
+ command(correlation, body) {
157
+ return this.sendOf(commandEnvelope(mintRecordId(this.ulidSource), this.conversationId, this.sourceId, correlation, ownedBytes(body)));
158
+ }
159
+ respond(correlation, body) {
160
+ return this.sendOf(responseEnvelope(mintRecordId(this.ulidSource), this.conversationId, this.sourceId, correlation, ownedBytes(body)));
161
+ }
162
+ emit(body) {
163
+ return this.sendOf(eventEnvelope(mintRecordId(this.ulidSource), this.conversationId, this.sourceId, ownedBytes(body)));
164
+ }
165
+ status(operation) {
166
+ return this.sendOf(statusEnvelope(mintRecordId(this.ulidSource), this.conversationId, this.sourceId, operation));
167
+ }
168
+ fail(correlation, error) {
169
+ const body = encodeNamed(encodeAgentErrorBody(error));
170
+ return this.sendOf(errorEnvelope(mintRecordId(this.ulidSource), this.conversationId, this.sourceId, correlation, body)).contentType(ContentType.Cbor);
171
+ }
172
+ stream(correlation, purpose) {
173
+ return new AgdxStreamWriter(this, this.sourceId, this.conversationId, correlation, mintChannelId(this.ulidSource), purpose, this.ulidSource);
174
+ }
175
+ async requestInput(replyTopic, prompt, timeoutMs, options = {}) {
176
+ if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
177
+ throw new InvalidError("requestInput() timeout must be a non-negative finite number");
178
+ }
179
+ const interrupt = mintCorrelationId(this.ulidSource);
180
+ const reader = await AgdxReplyReader.atTail(this.transport, this.streamName, replyTopic);
181
+ await this.command(interrupt, prompt).send();
182
+ const deadline = Date.now() + timeoutMs;
183
+ for (;;) {
184
+ if (options.signal?.aborted === true) {
185
+ throw new CancelledError("AGDX reply wait aborted", { cause: options.signal.reason });
186
+ }
187
+ const reply = await reader.next(interrupt);
188
+ if (reply !== undefined) {
189
+ if (reply.kind === AgentKind.Error) {
190
+ let message = "the input request was rejected";
191
+ try {
192
+ const context = "AGDX error body";
193
+ message =
194
+ decodeAgentErrorBody(expectMap(decodeOne(reply.body, context), context), context)
195
+ .message ?? message;
196
+ }
197
+ catch {
198
+ // Keep the stable rejection message when the optional error body is malformed.
199
+ }
200
+ throw new RejectedError(message);
201
+ }
202
+ return reply.body;
203
+ }
204
+ const remaining = deadline - Date.now();
205
+ if (remaining <= 0)
206
+ break;
207
+ await delay(Math.min(REPLY_POLL_INTERVAL_MS, remaining), options.signal);
208
+ }
209
+ throw new TimeoutError("the AGDX reply");
210
+ }
211
+ async publish(envelope, contentType) {
212
+ const message = assemble(envelope, contentType);
213
+ await this.transport.sendMessagesWithHeaders(this.streamName, this.topicName, [message], this.conversationId.toString());
214
+ return envelope.record;
215
+ }
216
+ async prepare(envelope, contentType, signingKey) {
217
+ const body = this.govern === undefined
218
+ ? envelope.body
219
+ : await this.govern(envelope, signingKey !== undefined);
220
+ const governed = body === envelope.body ? envelope : { ...envelope, body };
221
+ if (signingKey === undefined)
222
+ return governed;
223
+ return {
224
+ ...governed,
225
+ signature: signingKey.signWithContext(governed, {
226
+ contentType: contentTypeCode(contentType),
227
+ agentVersion: AGENT_OP_VERSION
228
+ })
229
+ };
230
+ }
231
+ assemble(envelope, contentType) {
232
+ return assemble(envelope, contentType);
233
+ }
234
+ async publishBatch(messages) {
235
+ await this.transport.sendMessagesWithHeaders(this.streamName, this.topicName, messages, this.conversationId.toString());
236
+ }
237
+ sendOf(envelope) {
238
+ return new AgdxSendBuilder(this, envelope);
239
+ }
240
+ }
241
+ export function createAgdx(transport, streamName, topicName, source, conversation, ulidSource, govern) {
242
+ return new AgdxClient(transport, streamName, topicName, parseAgentId(source.asString()), ConversationId.parse(conversation.toString()), ulidSource, govern);
243
+ }
244
+ class AgdxSendBuilder {
245
+ agdx;
246
+ envelope;
247
+ contentTypeValue = ContentType.Raw;
248
+ sent = false;
249
+ signingKey;
250
+ constructor(agdx, envelope) {
251
+ this.agdx = agdx;
252
+ this.envelope = envelope;
253
+ }
254
+ withTarget(target) {
255
+ this.envelope = withTarget(this.envelope, wireAgentId(target));
256
+ return this;
257
+ }
258
+ withCause(cause, causeAt) {
259
+ this.envelope = withCause(this.envelope, cause, causeAt);
260
+ return this;
261
+ }
262
+ withCorrelation(correlation) {
263
+ this.envelope = withCorrelation(this.envelope, correlation);
264
+ return this;
265
+ }
266
+ withIdempotencyKey(key) {
267
+ this.envelope = withIdempotencyKey(this.envelope, key);
268
+ return this;
269
+ }
270
+ withDeadlineMicros(deadlineMicros) {
271
+ this.envelope = withDeadlineMicros(this.envelope, deadlineMicros);
272
+ return this;
273
+ }
274
+ withTaskState(state) {
275
+ this.envelope = withTaskState(this.envelope, state);
276
+ return this;
277
+ }
278
+ withOperation(operation) {
279
+ this.envelope = withOperation(this.envelope, operation);
280
+ return this;
281
+ }
282
+ withTool(tool) {
283
+ this.envelope = withTool(this.envelope, tool);
284
+ return this;
285
+ }
286
+ withUsage(usage) {
287
+ this.envelope = withUsage(this.envelope, usage);
288
+ return this;
289
+ }
290
+ withMetadata(key, value) {
291
+ this.envelope = withMetadata(this.envelope, key, value);
292
+ return this;
293
+ }
294
+ last() {
295
+ this.envelope = { ...this.envelope, last: true };
296
+ return this;
297
+ }
298
+ contentType(contentType) {
299
+ this.contentTypeValue = contentType;
300
+ return this;
301
+ }
302
+ body(body) {
303
+ this.envelope = { ...this.envelope, body: ownedBytes(body) };
304
+ return this;
305
+ }
306
+ signedBy(key) {
307
+ this.signingKey = key;
308
+ return this;
309
+ }
310
+ async send() {
311
+ if (this.sent)
312
+ throw new InvalidError("an AGDX send can only be performed once");
313
+ this.sent = true;
314
+ const envelope = await this.agdx.prepare(this.envelope, this.contentTypeValue, this.signingKey);
315
+ return this.agdx.publish(envelope, this.contentTypeValue);
316
+ }
317
+ }
318
+ class AgdxStreamWriter {
319
+ agdx;
320
+ source;
321
+ conversation;
322
+ correlation;
323
+ channel;
324
+ purpose;
325
+ ulidSource;
326
+ sequence = 0n;
327
+ deadlineMicros;
328
+ target;
329
+ contentTypeValue = ContentType.Raw;
330
+ buffer;
331
+ closed = false;
332
+ constructor(agdx, source, conversation, correlation, channel, purpose, ulidSource) {
333
+ this.agdx = agdx;
334
+ this.source = source;
335
+ this.conversation = conversation;
336
+ this.correlation = correlation;
337
+ this.channel = channel;
338
+ this.purpose = purpose;
339
+ this.ulidSource = ulidSource;
340
+ }
341
+ withDeadlineMicros(deadlineMicros) {
342
+ this.deadlineMicros = deadlineMicros;
343
+ return this;
344
+ }
345
+ withTarget(target) {
346
+ this.target = wireAgentId(target);
347
+ return this;
348
+ }
349
+ contentType(contentType) {
350
+ this.contentTypeValue = contentType;
351
+ return this;
352
+ }
353
+ buffered(maxChunks, lingerMs) {
354
+ if (!Number.isInteger(maxChunks) || maxChunks < 0) {
355
+ throw new InvalidError("buffered() maxChunks must be a non-negative integer");
356
+ }
357
+ if (!Number.isFinite(lingerMs) || lingerMs < 0) {
358
+ throw new InvalidError("buffered() lingerMs must be a non-negative finite number");
359
+ }
360
+ this.buffer = {
361
+ maxChunks: Math.max(maxChunks, 1),
362
+ lingerMs,
363
+ firstAt: undefined,
364
+ messages: []
365
+ };
366
+ return this;
367
+ }
368
+ async write(body) {
369
+ this.assertOpen();
370
+ const bytes = ownedBytes(body);
371
+ if (bytes.byteLength > MAX_CHUNK_BODY_BYTES) {
372
+ throw new InvalidError(`chunk body is ${String(bytes.byteLength)}B, exceeds cap ${String(MAX_CHUNK_BODY_BYTES)}B`);
373
+ }
374
+ const envelope = this.chunk(bytes, false);
375
+ this.sequence += 1n;
376
+ if (this.buffer === undefined) {
377
+ await this.agdx.publish(envelope, this.contentTypeValue);
378
+ return;
379
+ }
380
+ this.buffer.firstAt ??= Date.now();
381
+ this.buffer.messages.push(this.agdx.assemble(envelope, this.contentTypeValue));
382
+ if (this.buffer.messages.length >= this.buffer.maxChunks ||
383
+ Date.now() - this.buffer.firstAt >= this.buffer.lingerMs) {
384
+ await this.flush();
385
+ }
386
+ }
387
+ async flush() {
388
+ if (this.buffer === undefined || this.buffer.messages.length === 0)
389
+ return;
390
+ const messages = this.buffer.messages;
391
+ this.buffer.messages = [];
392
+ this.buffer.firstAt = undefined;
393
+ await this.agdx.publishBatch(messages);
394
+ }
395
+ async finish(finishReason, usage) {
396
+ this.assertOpen();
397
+ this.closed = true;
398
+ let envelope = this.chunk(new Uint8Array(0), true, finishReason);
399
+ if (usage !== undefined)
400
+ envelope = withUsage(envelope, usage);
401
+ await this.sendTerminal(envelope, this.contentTypeValue);
402
+ }
403
+ async fail(error) {
404
+ this.assertOpen();
405
+ this.closed = true;
406
+ let envelope = errorEnvelope(mintRecordId(this.ulidSource), this.conversation, this.source, this.correlation, encodeNamed(encodeAgentErrorBody(error)));
407
+ envelope = { ...envelope, channel: this.channel, sequence: this.sequence };
408
+ if (this.target !== undefined)
409
+ envelope = withTarget(envelope, this.target);
410
+ await this.sendTerminal(envelope, ContentType.Cbor);
411
+ }
412
+ async sendTerminal(envelope, contentType) {
413
+ if (this.buffer === undefined) {
414
+ await this.agdx.publish(envelope, contentType);
415
+ return;
416
+ }
417
+ this.buffer.messages.push(this.agdx.assemble(envelope, contentType));
418
+ const messages = this.buffer.messages;
419
+ this.buffer.messages = [];
420
+ this.buffer.firstAt = undefined;
421
+ await this.agdx.publishBatch(messages);
422
+ }
423
+ chunk(body, last, finishReason) {
424
+ let envelope = chunkEnvelope(this.conversation, this.source, this.correlation, this.channel, this.sequence, body);
425
+ if (this.sequence === 0n) {
426
+ envelope = withOperation(envelope, this.purpose);
427
+ if (this.deadlineMicros !== undefined) {
428
+ envelope = withDeadlineMicros(envelope, this.deadlineMicros);
429
+ }
430
+ }
431
+ if (this.target !== undefined)
432
+ envelope = withTarget(envelope, this.target);
433
+ if (last) {
434
+ envelope = {
435
+ ...envelope,
436
+ last: true,
437
+ ...(finishReason !== undefined ? { finishReason } : {})
438
+ };
439
+ }
440
+ return envelope;
441
+ }
442
+ assertOpen() {
443
+ if (this.closed)
444
+ throw new InvalidError("an AGDX stream is already terminal");
445
+ }
446
+ }
447
+ //# sourceMappingURL=agdx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agdx.js","sourceRoot":"","sources":["../../src/agent/agdx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAO/F,OAAO,EAAE,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AI,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;gBACtC,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;YAC9D,CAAC;QACH,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,QAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAC3E,IAAI,IAAI,EAAE,CAAC;YACT,QAAQ,GAAG;gBACT,GAAG,QAAQ;gBACX,IAAI,EAAE,IAAI;gBACV,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACxD,CAAA;QACH,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;IAEO,UAAU;QAChB,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,YAAY,CAAC,oCAAoC,CAAC,CAAA;IAC/E,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ import { type AgentEnvelope, type TokenUsage } from "../wire/agent.js";
2
+ export declare const FINISH_REASON_ABANDONED = "abandoned";
3
+ export declare const FINISH_REASON_GAP = "gap";
4
+ export type StreamEvent = {
5
+ readonly kind: "body";
6
+ readonly sequence: bigint;
7
+ readonly payload: Uint8Array;
8
+ } | {
9
+ readonly kind: "finished";
10
+ readonly finishReason?: string;
11
+ readonly usage?: TokenUsage;
12
+ readonly synthetic: boolean;
13
+ } | {
14
+ readonly kind: "failed";
15
+ readonly body: Uint8Array;
16
+ };
17
+ export declare class ChunkAssembler {
18
+ private nextSequence;
19
+ private finished;
20
+ private duplicates;
21
+ private late;
22
+ feed(envelope: AgentEnvelope): readonly StreamEvent[];
23
+ abandon(): StreamEvent | undefined;
24
+ get isFinished(): boolean;
25
+ get duplicatesDropped(): bigint;
26
+ get lateDropped(): bigint;
27
+ private feedChunk;
28
+ }
29
+ //# sourceMappingURL=assembler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assembler.d.ts","sourceRoot":"","sources":["../../src/agent/assembler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAEjF,eAAO,MAAM,uBAAuB,cAAc,CAAA;AAClD,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AAEtC,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,GAClF;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAA;AAE1D,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,IAAI,CAAK;IAEjB,IAAI,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,WAAW,EAAE,CASpD;IAED,OAAO,IAAI,WAAW,GAAG,SAAS,CAIjC;IAED,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,OAAO,CAAC,SAAS;CA+BlB"}