@astrale-os/kernel-client 0.6.0-beta.9 → 0.6.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 (539) hide show
  1. package/dist/auth/auth.d.ts +22 -10
  2. package/dist/auth/auth.js +5 -7
  3. package/dist/auth/authorization.d.ts +4 -2
  4. package/dist/auth/authorization.js +25 -6
  5. package/dist/auth/credential.d.ts +7 -4
  6. package/dist/auth/credential.js +6 -3
  7. package/dist/auth/identity.d.ts +7 -9
  8. package/dist/auth/identity.js +0 -1
  9. package/dist/auth/index.d.ts +4 -5
  10. package/dist/auth/index.js +2 -4
  11. package/dist/auth/register.d.ts +24 -0
  12. package/dist/auth/register.js +10 -0
  13. package/dist/client/admission.d.ts +4 -2
  14. package/dist/client/admission.js +9 -11
  15. package/dist/client/client.d.ts +4 -3
  16. package/dist/client/client.js +16 -4
  17. package/dist/client/credential.d.ts +5 -3
  18. package/dist/client/credential.js +7 -3
  19. package/dist/client/index.d.ts +3 -4
  20. package/dist/client/index.js +2 -3
  21. package/dist/client/request.d.ts +11 -4
  22. package/dist/client/request.js +50 -6
  23. package/dist/client/result.d.ts +7 -5
  24. package/dist/client/result.js +13 -5
  25. package/dist/client/routing-control.d.ts +11 -4
  26. package/dist/client/routing-control.js +18 -4
  27. package/dist/errors/client-error.d.ts +0 -1
  28. package/dist/errors/client-error.js +0 -1
  29. package/dist/errors/exchange-error.d.ts +19 -0
  30. package/dist/errors/exchange-error.js +9 -0
  31. package/dist/errors/index.d.ts +2 -1
  32. package/dist/errors/index.js +2 -1
  33. package/dist/errors/miss-error.d.ts +0 -1
  34. package/dist/errors/miss-error.js +0 -1
  35. package/dist/errors/protocol-error.d.ts +0 -1
  36. package/dist/errors/protocol-error.js +0 -1
  37. package/dist/errors/refusal.d.ts +12 -0
  38. package/dist/errors/refusal.js +40 -0
  39. package/dist/errors/response-error.d.ts +0 -1
  40. package/dist/errors/response-error.js +0 -1
  41. package/dist/errors/session-error.d.ts +0 -1
  42. package/dist/errors/session-error.js +0 -1
  43. package/dist/errors/stale-route-error.d.ts +4 -4
  44. package/dist/errors/stale-route-error.js +5 -5
  45. package/dist/errors/transport-error.d.ts +3 -3
  46. package/dist/errors/transport-error.js +0 -1
  47. package/dist/graph/domain/binding.d.ts +0 -1
  48. package/dist/graph/domain/binding.js +4 -1
  49. package/dist/graph/domain/domain.typecheck.d.ts +0 -1
  50. package/dist/graph/domain/domain.typecheck.js +21 -1
  51. package/dist/graph/domain/index.d.ts +0 -1
  52. package/dist/graph/domain/index.js +0 -1
  53. package/dist/graph/domain/model.d.ts +0 -1
  54. package/dist/graph/domain/model.js +0 -1
  55. package/dist/graph/domain/page.d.ts +0 -1
  56. package/dist/graph/domain/page.js +0 -1
  57. package/dist/graph/domain/project.d.ts +0 -1
  58. package/dist/graph/domain/project.js +10 -7
  59. package/dist/graph/domain/provenance.d.ts +0 -1
  60. package/dist/graph/domain/provenance.js +0 -1
  61. package/dist/graph/errors.d.ts +0 -1
  62. package/dist/graph/errors.js +1 -3
  63. package/dist/graph/expectation.d.ts +3 -0
  64. package/dist/graph/expectation.js +6 -0
  65. package/dist/graph/graph.d.ts +6 -3
  66. package/dist/graph/graph.js +0 -1
  67. package/dist/graph/index.d.ts +2 -3
  68. package/dist/graph/index.js +1 -2
  69. package/dist/graph/mutation.d.ts +2 -4
  70. package/dist/graph/mutation.js +12 -2
  71. package/dist/graph/page/index.d.ts +0 -1
  72. package/dist/graph/page/index.js +0 -1
  73. package/dist/graph/page/neighbors.d.ts +0 -1
  74. package/dist/graph/page/neighbors.js +2 -2
  75. package/dist/graph/page/page.d.ts +0 -1
  76. package/dist/graph/page/page.js +0 -1
  77. package/dist/graph/page-contract.d.ts +6 -1
  78. package/dist/graph/page-contract.js +0 -1
  79. package/dist/graph/provenance.d.ts +2 -1
  80. package/dist/graph/provenance.js +5 -1
  81. package/dist/graph/query.d.ts +3 -1
  82. package/dist/graph/query.js +25 -10
  83. package/dist/graph/read.d.ts +0 -1
  84. package/dist/graph/read.js +6 -5
  85. package/dist/index.d.ts +3 -3
  86. package/dist/index.js +1 -1
  87. package/dist/pacer/batcher/batcher.d.ts +0 -1
  88. package/dist/pacer/batcher/batcher.js +0 -1
  89. package/dist/pacer/batcher/defaults.d.ts +0 -1
  90. package/dist/pacer/batcher/defaults.js +0 -1
  91. package/dist/pacer/batcher/index.d.ts +0 -1
  92. package/dist/pacer/batcher/index.js +0 -1
  93. package/dist/pacer/index.d.ts +1 -2
  94. package/dist/pacer/index.js +1 -2
  95. package/dist/pacer/limiter/defaults.d.ts +0 -1
  96. package/dist/pacer/limiter/defaults.js +0 -1
  97. package/dist/pacer/limiter/index.d.ts +0 -1
  98. package/dist/pacer/limiter/index.js +0 -1
  99. package/dist/pacer/limiter/limiter.d.ts +0 -1
  100. package/dist/pacer/limiter/limiter.js +0 -1
  101. package/dist/pacer/queue/defaults.d.ts +0 -1
  102. package/dist/pacer/queue/defaults.js +0 -1
  103. package/dist/pacer/queue/index.d.ts +0 -1
  104. package/dist/pacer/queue/index.js +0 -1
  105. package/dist/pacer/queue/queue.d.ts +0 -1
  106. package/dist/pacer/queue/queue.js +0 -1
  107. package/dist/pacer/retry/defaults.d.ts +0 -1
  108. package/dist/pacer/retry/defaults.js +0 -1
  109. package/dist/pacer/retry/index.d.ts +1 -1
  110. package/dist/pacer/retry/index.js +1 -1
  111. package/dist/pacer/retry/refusals.d.ts +7 -0
  112. package/dist/pacer/retry/refusals.js +10 -0
  113. package/dist/pacer/retry/retry.d.ts +2 -1
  114. package/dist/pacer/retry/retry.js +33 -2
  115. package/dist/pool/index.d.ts +0 -1
  116. package/dist/pool/index.js +0 -1
  117. package/dist/pool/pool.d.ts +0 -1
  118. package/dist/pool/pool.js +0 -1
  119. package/dist/pool/target.d.ts +0 -1
  120. package/dist/pool/target.js +0 -1
  121. package/dist/schema/admission.d.ts +1 -2
  122. package/dist/schema/admission.js +2 -3
  123. package/dist/schema/contracts.d.ts +97 -5
  124. package/dist/schema/contracts.js +0 -1
  125. package/dist/schema/index.d.ts +3 -3
  126. package/dist/schema/index.js +1 -2
  127. package/dist/schema/installation.d.ts +104 -0
  128. package/dist/schema/installation.js +144 -0
  129. package/dist/schema/introspection.d.ts +0 -1
  130. package/dist/schema/introspection.js +10 -3
  131. package/dist/schema/operation.d.ts +0 -1
  132. package/dist/schema/operation.js +1 -2
  133. package/dist/schema/schema.d.ts +32 -11
  134. package/dist/schema/schema.js +94 -19
  135. package/dist/session/admission.d.ts +6 -0
  136. package/dist/session/admission.js +52 -0
  137. package/dist/session/bound.d.ts +17 -14
  138. package/dist/session/bound.js +96 -10
  139. package/dist/session/content/api.d.ts +45 -0
  140. package/dist/session/content/api.js +28 -0
  141. package/dist/session/content/batch.d.ts +5 -0
  142. package/dist/session/content/batch.js +93 -0
  143. package/dist/session/content/index.d.ts +1 -0
  144. package/dist/session/content/index.js +1 -0
  145. package/dist/session/content/input.d.ts +9 -0
  146. package/dist/session/content/input.js +33 -0
  147. package/dist/session/content/parts.d.ts +36 -0
  148. package/dist/session/content/parts.js +154 -0
  149. package/dist/session/content/retry.d.ts +3 -0
  150. package/dist/session/content/retry.js +41 -0
  151. package/dist/session/content/wire.d.ts +12 -0
  152. package/dist/session/content/wire.js +60 -0
  153. package/dist/session/context/control.d.ts +0 -1
  154. package/dist/session/context/control.js +0 -1
  155. package/dist/session/context/index.d.ts +2 -3
  156. package/dist/session/context/index.js +2 -3
  157. package/dist/session/context/limits.d.ts +1 -2
  158. package/dist/session/context/limits.js +1 -2
  159. package/dist/session/context/operation.d.ts +5 -3
  160. package/dist/session/context/operation.js +1 -2
  161. package/dist/session/context/policy.d.ts +0 -2
  162. package/dist/session/context/policy.js +0 -17
  163. package/dist/session/credential/credentials.d.ts +65 -0
  164. package/dist/session/credential/credentials.js +296 -0
  165. package/dist/session/credential/index.d.ts +1 -0
  166. package/dist/session/credential/index.js +1 -0
  167. package/dist/session/credential/limits.d.ts +14 -0
  168. package/dist/session/credential/limits.js +14 -0
  169. package/dist/session/discovery/bundle.d.ts +9 -5
  170. package/dist/session/discovery/bundle.js +43 -26
  171. package/dist/session/discovery/discovery.d.ts +12 -5
  172. package/dist/session/discovery/discovery.js +42 -13
  173. package/dist/session/discovery/index.d.ts +6 -2
  174. package/dist/session/discovery/index.js +4 -8
  175. package/dist/session/discovery/release.d.ts +30 -0
  176. package/dist/session/discovery/release.js +81 -0
  177. package/dist/session/discovery/response.d.ts +3 -0
  178. package/dist/session/discovery/response.js +59 -0
  179. package/dist/session/discovery/snapshot.d.ts +4 -5
  180. package/dist/session/discovery/snapshot.js +2 -3
  181. package/dist/session/discovery/transport.d.ts +1 -4
  182. package/dist/session/discovery/transport.js +0 -1
  183. package/dist/session/exchange/domain.d.ts +27 -0
  184. package/dist/session/exchange/domain.js +63 -0
  185. package/dist/session/exchange/exchange.d.ts +48 -0
  186. package/dist/session/exchange/exchange.js +54 -0
  187. package/dist/session/exchange/index.d.ts +5 -0
  188. package/dist/session/exchange/index.js +5 -0
  189. package/dist/session/exchange/issuer.d.ts +18 -0
  190. package/dist/session/exchange/issuer.js +149 -0
  191. package/dist/session/exchange/limits.d.ts +10 -0
  192. package/dist/session/exchange/limits.js +10 -0
  193. package/dist/session/exchange/options.d.ts +37 -0
  194. package/dist/session/exchange/options.js +65 -0
  195. package/dist/session/exchange/presentation.d.ts +19 -0
  196. package/dist/session/exchange/presentation.js +72 -0
  197. package/dist/session/exchange/source.d.ts +33 -0
  198. package/dist/session/exchange/source.js +78 -0
  199. package/dist/session/execution.d.ts +88 -0
  200. package/dist/session/execution.js +34 -0
  201. package/dist/session/index.d.ts +9 -6
  202. package/dist/session/index.js +3 -2
  203. package/dist/session/options.d.ts +65 -0
  204. package/dist/session/options.js +132 -0
  205. package/dist/session/reference.d.ts +38 -19
  206. package/dist/session/reference.js +34 -12
  207. package/dist/session/routing/auth.d.ts +10 -1
  208. package/dist/session/routing/auth.js +8 -2
  209. package/dist/session/routing/cache.d.ts +21 -7
  210. package/dist/session/routing/cache.js +103 -73
  211. package/dist/session/routing/dispatch.d.ts +19 -11
  212. package/dist/session/routing/dispatch.js +115 -89
  213. package/dist/session/routing/envelope.d.ts +4 -3
  214. package/dist/session/routing/envelope.js +14 -10
  215. package/dist/session/routing/expiry.d.ts +4 -0
  216. package/dist/session/routing/expiry.js +32 -0
  217. package/dist/session/routing/index.d.ts +5 -5
  218. package/dist/session/routing/index.js +4 -3
  219. package/dist/session/routing/integrity.d.ts +7 -0
  220. package/dist/session/routing/integrity.js +44 -0
  221. package/dist/session/routing/recovery.d.ts +16 -0
  222. package/dist/session/routing/recovery.js +41 -0
  223. package/dist/session/routing/request.d.ts +13 -1
  224. package/dist/session/routing/request.js +28 -2
  225. package/dist/session/routing/result.d.ts +5 -0
  226. package/dist/session/routing/result.js +16 -0
  227. package/dist/session/routing/store.d.ts +23 -0
  228. package/dist/session/routing/store.js +99 -0
  229. package/dist/session/session.d.ts +37 -33
  230. package/dist/session/session.js +134 -157
  231. package/dist/session/session.typecheck.d.ts +0 -1
  232. package/dist/session/session.typecheck.js +183 -5
  233. package/dist/session/views/catalog.d.ts +9 -6
  234. package/dist/session/views/catalog.js +29 -23
  235. package/dist/session/views/index.d.ts +1 -2
  236. package/dist/session/views/index.js +1 -2
  237. package/dist/session/views/resolve.d.ts +6 -5
  238. package/dist/session/views/resolve.js +14 -7
  239. package/dist/store/entity-index.d.ts +1 -3
  240. package/dist/store/entity-index.js +0 -4
  241. package/dist/store/index.d.ts +0 -1
  242. package/dist/store/index.js +0 -1
  243. package/dist/store/memory.d.ts +2 -2
  244. package/dist/store/memory.js +60 -18
  245. package/dist/store/mutation.d.ts +1 -2
  246. package/dist/store/mutation.js +6 -4
  247. package/dist/store/observe.d.ts +0 -1
  248. package/dist/store/observe.js +0 -1
  249. package/dist/store/optimistic.d.ts +0 -1
  250. package/dist/store/optimistic.js +0 -1
  251. package/dist/store/query-key.d.ts +2 -2
  252. package/dist/store/query-key.js +7 -3
  253. package/dist/store/shape.d.ts +6 -3
  254. package/dist/store/shape.js +4 -2
  255. package/dist/store/store.d.ts +2 -4
  256. package/dist/store/store.js +6 -5
  257. package/dist/store/store.typecheck.d.ts +0 -1
  258. package/dist/store/store.typecheck.js +0 -6
  259. package/dist/transport/auto/decision.d.ts +3 -3
  260. package/dist/transport/auto/decision.js +0 -1
  261. package/dist/transport/auto/fallback.d.ts +2 -2
  262. package/dist/transport/auto/fallback.js +2 -2
  263. package/dist/transport/auto/index.d.ts +0 -1
  264. package/dist/transport/auto/index.js +0 -1
  265. package/dist/transport/auto/transport.d.ts +0 -2
  266. package/dist/transport/auto/transport.js +0 -3
  267. package/dist/transport/auto/warning.d.ts +0 -1
  268. package/dist/transport/auto/warning.js +5 -3
  269. package/dist/transport/deadline.d.ts +0 -1
  270. package/dist/transport/deadline.js +0 -1
  271. package/dist/transport/failure.d.ts +0 -1
  272. package/dist/transport/failure.js +0 -1
  273. package/dist/transport/http/admission.d.ts +5 -0
  274. package/dist/transport/http/admission.js +104 -0
  275. package/dist/transport/http/binary.d.ts +5 -0
  276. package/dist/transport/http/binary.js +70 -0
  277. package/dist/transport/http/byte-stream.d.ts +18 -0
  278. package/dist/transport/http/byte-stream.js +94 -0
  279. package/dist/transport/http/configuration.d.ts +24 -0
  280. package/dist/transport/http/configuration.js +116 -0
  281. package/dist/transport/http/index.d.ts +2 -2
  282. package/dist/transport/http/index.js +0 -1
  283. package/dist/transport/http/response.d.ts +8 -2
  284. package/dist/transport/http/response.js +11 -7
  285. package/dist/transport/http/retired.d.ts +8 -0
  286. package/dist/transport/http/retired.js +28 -0
  287. package/dist/transport/http/stream.d.ts +0 -1
  288. package/dist/transport/http/stream.js +0 -1
  289. package/dist/transport/http/transport.d.ts +4 -18
  290. package/dist/transport/http/transport.js +48 -252
  291. package/dist/transport/index.d.ts +1 -2
  292. package/dist/transport/index.js +0 -1
  293. package/dist/transport/transport.d.ts +20 -3
  294. package/dist/transport/transport.js +0 -1
  295. package/dist/transport/websocket/connection.d.ts +2 -2
  296. package/dist/transport/websocket/connection.js +5 -3
  297. package/dist/transport/websocket/exchange.d.ts +0 -1
  298. package/dist/transport/websocket/exchange.js +8 -1
  299. package/dist/transport/websocket/index.d.ts +0 -1
  300. package/dist/transport/websocket/index.js +0 -1
  301. package/dist/transport/websocket/transport.d.ts +0 -4
  302. package/dist/transport/websocket/transport.js +2 -18
  303. package/package.json +12 -15
  304. package/dist/auth/auth.d.ts.map +0 -1
  305. package/dist/auth/auth.js.map +0 -1
  306. package/dist/auth/authorization.d.ts.map +0 -1
  307. package/dist/auth/authorization.js.map +0 -1
  308. package/dist/auth/credential.d.ts.map +0 -1
  309. package/dist/auth/credential.js.map +0 -1
  310. package/dist/auth/identity.d.ts.map +0 -1
  311. package/dist/auth/identity.js.map +0 -1
  312. package/dist/auth/index.d.ts.map +0 -1
  313. package/dist/auth/index.js.map +0 -1
  314. package/dist/auth/provision.d.ts +0 -9
  315. package/dist/auth/provision.d.ts.map +0 -1
  316. package/dist/auth/provision.js +0 -11
  317. package/dist/auth/provision.js.map +0 -1
  318. package/dist/client/admission.d.ts.map +0 -1
  319. package/dist/client/admission.js.map +0 -1
  320. package/dist/client/client.d.ts.map +0 -1
  321. package/dist/client/client.js.map +0 -1
  322. package/dist/client/credential.d.ts.map +0 -1
  323. package/dist/client/credential.js.map +0 -1
  324. package/dist/client/index.d.ts.map +0 -1
  325. package/dist/client/index.js.map +0 -1
  326. package/dist/client/request.d.ts.map +0 -1
  327. package/dist/client/request.js.map +0 -1
  328. package/dist/client/result.d.ts.map +0 -1
  329. package/dist/client/result.js.map +0 -1
  330. package/dist/client/routing-control.d.ts.map +0 -1
  331. package/dist/client/routing-control.js.map +0 -1
  332. package/dist/errors/client-error.d.ts.map +0 -1
  333. package/dist/errors/client-error.js.map +0 -1
  334. package/dist/errors/index.d.ts.map +0 -1
  335. package/dist/errors/index.js.map +0 -1
  336. package/dist/errors/miss-error.d.ts.map +0 -1
  337. package/dist/errors/miss-error.js.map +0 -1
  338. package/dist/errors/protocol-error.d.ts.map +0 -1
  339. package/dist/errors/protocol-error.js.map +0 -1
  340. package/dist/errors/response-error.d.ts.map +0 -1
  341. package/dist/errors/response-error.js.map +0 -1
  342. package/dist/errors/session-error.d.ts.map +0 -1
  343. package/dist/errors/session-error.js.map +0 -1
  344. package/dist/errors/stale-route-error.d.ts.map +0 -1
  345. package/dist/errors/stale-route-error.js.map +0 -1
  346. package/dist/errors/transport-error.d.ts.map +0 -1
  347. package/dist/errors/transport-error.js.map +0 -1
  348. package/dist/graph/domain/binding.d.ts.map +0 -1
  349. package/dist/graph/domain/binding.js.map +0 -1
  350. package/dist/graph/domain/domain.typecheck.d.ts.map +0 -1
  351. package/dist/graph/domain/domain.typecheck.js.map +0 -1
  352. package/dist/graph/domain/index.d.ts.map +0 -1
  353. package/dist/graph/domain/index.js.map +0 -1
  354. package/dist/graph/domain/model.d.ts.map +0 -1
  355. package/dist/graph/domain/model.js.map +0 -1
  356. package/dist/graph/domain/page.d.ts.map +0 -1
  357. package/dist/graph/domain/page.js.map +0 -1
  358. package/dist/graph/domain/project.d.ts.map +0 -1
  359. package/dist/graph/domain/project.js.map +0 -1
  360. package/dist/graph/domain/provenance.d.ts.map +0 -1
  361. package/dist/graph/domain/provenance.js.map +0 -1
  362. package/dist/graph/errors.d.ts.map +0 -1
  363. package/dist/graph/errors.js.map +0 -1
  364. package/dist/graph/graph.d.ts.map +0 -1
  365. package/dist/graph/graph.js.map +0 -1
  366. package/dist/graph/index.d.ts.map +0 -1
  367. package/dist/graph/index.js.map +0 -1
  368. package/dist/graph/mutation.d.ts.map +0 -1
  369. package/dist/graph/mutation.js.map +0 -1
  370. package/dist/graph/page/index.d.ts.map +0 -1
  371. package/dist/graph/page/index.js.map +0 -1
  372. package/dist/graph/page/neighbors.d.ts.map +0 -1
  373. package/dist/graph/page/neighbors.js.map +0 -1
  374. package/dist/graph/page/page.d.ts.map +0 -1
  375. package/dist/graph/page/page.js.map +0 -1
  376. package/dist/graph/page-contract.d.ts.map +0 -1
  377. package/dist/graph/page-contract.js.map +0 -1
  378. package/dist/graph/provenance.d.ts.map +0 -1
  379. package/dist/graph/provenance.js.map +0 -1
  380. package/dist/graph/query.d.ts.map +0 -1
  381. package/dist/graph/query.js.map +0 -1
  382. package/dist/graph/read.d.ts.map +0 -1
  383. package/dist/graph/read.js.map +0 -1
  384. package/dist/index.d.ts.map +0 -1
  385. package/dist/index.js.map +0 -1
  386. package/dist/pacer/batcher/batcher.d.ts.map +0 -1
  387. package/dist/pacer/batcher/batcher.js.map +0 -1
  388. package/dist/pacer/batcher/defaults.d.ts.map +0 -1
  389. package/dist/pacer/batcher/defaults.js.map +0 -1
  390. package/dist/pacer/batcher/index.d.ts.map +0 -1
  391. package/dist/pacer/batcher/index.js.map +0 -1
  392. package/dist/pacer/index.d.ts.map +0 -1
  393. package/dist/pacer/index.js.map +0 -1
  394. package/dist/pacer/limiter/defaults.d.ts.map +0 -1
  395. package/dist/pacer/limiter/defaults.js.map +0 -1
  396. package/dist/pacer/limiter/index.d.ts.map +0 -1
  397. package/dist/pacer/limiter/index.js.map +0 -1
  398. package/dist/pacer/limiter/limiter.d.ts.map +0 -1
  399. package/dist/pacer/limiter/limiter.js.map +0 -1
  400. package/dist/pacer/queue/defaults.d.ts.map +0 -1
  401. package/dist/pacer/queue/defaults.js.map +0 -1
  402. package/dist/pacer/queue/index.d.ts.map +0 -1
  403. package/dist/pacer/queue/index.js.map +0 -1
  404. package/dist/pacer/queue/queue.d.ts.map +0 -1
  405. package/dist/pacer/queue/queue.js.map +0 -1
  406. package/dist/pacer/retry/defaults.d.ts.map +0 -1
  407. package/dist/pacer/retry/defaults.js.map +0 -1
  408. package/dist/pacer/retry/index.d.ts.map +0 -1
  409. package/dist/pacer/retry/index.js.map +0 -1
  410. package/dist/pacer/retry/retry.d.ts.map +0 -1
  411. package/dist/pacer/retry/retry.js.map +0 -1
  412. package/dist/pool/index.d.ts.map +0 -1
  413. package/dist/pool/index.js.map +0 -1
  414. package/dist/pool/pool.d.ts.map +0 -1
  415. package/dist/pool/pool.js.map +0 -1
  416. package/dist/pool/target.d.ts.map +0 -1
  417. package/dist/pool/target.js.map +0 -1
  418. package/dist/schema/admission.d.ts.map +0 -1
  419. package/dist/schema/admission.js.map +0 -1
  420. package/dist/schema/contracts.d.ts.map +0 -1
  421. package/dist/schema/contracts.js.map +0 -1
  422. package/dist/schema/index.d.ts.map +0 -1
  423. package/dist/schema/index.js.map +0 -1
  424. package/dist/schema/introspection.d.ts.map +0 -1
  425. package/dist/schema/introspection.js.map +0 -1
  426. package/dist/schema/operation.d.ts.map +0 -1
  427. package/dist/schema/operation.js.map +0 -1
  428. package/dist/schema/schema.d.ts.map +0 -1
  429. package/dist/schema/schema.js.map +0 -1
  430. package/dist/session/bound.d.ts.map +0 -1
  431. package/dist/session/bound.js.map +0 -1
  432. package/dist/session/context/control.d.ts.map +0 -1
  433. package/dist/session/context/control.js.map +0 -1
  434. package/dist/session/context/index.d.ts.map +0 -1
  435. package/dist/session/context/index.js.map +0 -1
  436. package/dist/session/context/limits.d.ts.map +0 -1
  437. package/dist/session/context/limits.js.map +0 -1
  438. package/dist/session/context/operation.d.ts.map +0 -1
  439. package/dist/session/context/operation.js.map +0 -1
  440. package/dist/session/context/policy.d.ts.map +0 -1
  441. package/dist/session/context/policy.js.map +0 -1
  442. package/dist/session/discovery/bundle.d.ts.map +0 -1
  443. package/dist/session/discovery/bundle.js.map +0 -1
  444. package/dist/session/discovery/discovery.d.ts.map +0 -1
  445. package/dist/session/discovery/discovery.js.map +0 -1
  446. package/dist/session/discovery/index.d.ts.map +0 -1
  447. package/dist/session/discovery/index.js.map +0 -1
  448. package/dist/session/discovery/publication.d.ts +0 -24
  449. package/dist/session/discovery/publication.d.ts.map +0 -1
  450. package/dist/session/discovery/publication.js +0 -124
  451. package/dist/session/discovery/publication.js.map +0 -1
  452. package/dist/session/discovery/snapshot.d.ts.map +0 -1
  453. package/dist/session/discovery/snapshot.js.map +0 -1
  454. package/dist/session/discovery/transport.d.ts.map +0 -1
  455. package/dist/session/discovery/transport.js.map +0 -1
  456. package/dist/session/index.d.ts.map +0 -1
  457. package/dist/session/index.js.map +0 -1
  458. package/dist/session/reference.d.ts.map +0 -1
  459. package/dist/session/reference.js.map +0 -1
  460. package/dist/session/routing/auth.d.ts.map +0 -1
  461. package/dist/session/routing/auth.js.map +0 -1
  462. package/dist/session/routing/cache.d.ts.map +0 -1
  463. package/dist/session/routing/cache.js.map +0 -1
  464. package/dist/session/routing/dispatch.d.ts.map +0 -1
  465. package/dist/session/routing/dispatch.js.map +0 -1
  466. package/dist/session/routing/envelope.d.ts.map +0 -1
  467. package/dist/session/routing/envelope.js.map +0 -1
  468. package/dist/session/routing/expectation.d.ts +0 -7
  469. package/dist/session/routing/expectation.d.ts.map +0 -1
  470. package/dist/session/routing/expectation.js +0 -2
  471. package/dist/session/routing/expectation.js.map +0 -1
  472. package/dist/session/routing/index.d.ts.map +0 -1
  473. package/dist/session/routing/index.js.map +0 -1
  474. package/dist/session/routing/request.d.ts.map +0 -1
  475. package/dist/session/routing/request.js.map +0 -1
  476. package/dist/session/session.d.ts.map +0 -1
  477. package/dist/session/session.js.map +0 -1
  478. package/dist/session/session.typecheck.d.ts.map +0 -1
  479. package/dist/session/session.typecheck.js.map +0 -1
  480. package/dist/session/views/catalog.d.ts.map +0 -1
  481. package/dist/session/views/catalog.js.map +0 -1
  482. package/dist/session/views/index.d.ts.map +0 -1
  483. package/dist/session/views/index.js.map +0 -1
  484. package/dist/session/views/resolve.d.ts.map +0 -1
  485. package/dist/session/views/resolve.js.map +0 -1
  486. package/dist/store/entity-index.d.ts.map +0 -1
  487. package/dist/store/entity-index.js.map +0 -1
  488. package/dist/store/index.d.ts.map +0 -1
  489. package/dist/store/index.js.map +0 -1
  490. package/dist/store/memory.d.ts.map +0 -1
  491. package/dist/store/memory.js.map +0 -1
  492. package/dist/store/mutation.d.ts.map +0 -1
  493. package/dist/store/mutation.js.map +0 -1
  494. package/dist/store/observe.d.ts.map +0 -1
  495. package/dist/store/observe.js.map +0 -1
  496. package/dist/store/optimistic.d.ts.map +0 -1
  497. package/dist/store/optimistic.js.map +0 -1
  498. package/dist/store/query-key.d.ts.map +0 -1
  499. package/dist/store/query-key.js.map +0 -1
  500. package/dist/store/shape.d.ts.map +0 -1
  501. package/dist/store/shape.js.map +0 -1
  502. package/dist/store/store.d.ts.map +0 -1
  503. package/dist/store/store.js.map +0 -1
  504. package/dist/store/store.typecheck.d.ts.map +0 -1
  505. package/dist/store/store.typecheck.js.map +0 -1
  506. package/dist/transport/auto/decision.d.ts.map +0 -1
  507. package/dist/transport/auto/decision.js.map +0 -1
  508. package/dist/transport/auto/fallback.d.ts.map +0 -1
  509. package/dist/transport/auto/fallback.js.map +0 -1
  510. package/dist/transport/auto/index.d.ts.map +0 -1
  511. package/dist/transport/auto/index.js.map +0 -1
  512. package/dist/transport/auto/transport.d.ts.map +0 -1
  513. package/dist/transport/auto/transport.js.map +0 -1
  514. package/dist/transport/auto/warning.d.ts.map +0 -1
  515. package/dist/transport/auto/warning.js.map +0 -1
  516. package/dist/transport/deadline.d.ts.map +0 -1
  517. package/dist/transport/deadline.js.map +0 -1
  518. package/dist/transport/failure.d.ts.map +0 -1
  519. package/dist/transport/failure.js.map +0 -1
  520. package/dist/transport/http/index.d.ts.map +0 -1
  521. package/dist/transport/http/index.js.map +0 -1
  522. package/dist/transport/http/response.d.ts.map +0 -1
  523. package/dist/transport/http/response.js.map +0 -1
  524. package/dist/transport/http/stream.d.ts.map +0 -1
  525. package/dist/transport/http/stream.js.map +0 -1
  526. package/dist/transport/http/transport.d.ts.map +0 -1
  527. package/dist/transport/http/transport.js.map +0 -1
  528. package/dist/transport/index.d.ts.map +0 -1
  529. package/dist/transport/index.js.map +0 -1
  530. package/dist/transport/transport.d.ts.map +0 -1
  531. package/dist/transport/transport.js.map +0 -1
  532. package/dist/transport/websocket/connection.d.ts.map +0 -1
  533. package/dist/transport/websocket/connection.js.map +0 -1
  534. package/dist/transport/websocket/exchange.d.ts.map +0 -1
  535. package/dist/transport/websocket/exchange.js.map +0 -1
  536. package/dist/transport/websocket/index.d.ts.map +0 -1
  537. package/dist/transport/websocket/index.js.map +0 -1
  538. package/dist/transport/websocket/transport.d.ts.map +0 -1
  539. package/dist/transport/websocket/transport.js.map +0 -1
@@ -0,0 +1,65 @@
1
+ import { accept as acceptIssuer } from '@astrale-os/kernel-core/auth/issuer';
2
+ import { admitControlOptions } from '../context/index.js';
3
+ import { delegationCoverageMs } from '../credential/index.js';
4
+ import { DEFAULT_EXCHANGE_TTL_SECONDS } from './limits.js';
5
+ /**
6
+ * Admit exchange options against the Session auth they extend. Every Domain credential must still
7
+ * cover the Session delegation, so a request that could never cover it is rejected.
8
+ */
9
+ export function admitExchangeOptions(input, auth) {
10
+ if (input === undefined)
11
+ return undefined;
12
+ if (input === null || typeof input !== 'object' || Array.isArray(input)) {
13
+ throw new TypeError('Session exchange options are invalid.');
14
+ }
15
+ const mode = input.mode;
16
+ if (mode !== 'auto' && mode !== 'source') {
17
+ throw new TypeError('Session exchange mode is invalid.');
18
+ }
19
+ const fields = mode === 'auto' ? ['mode', 'ttlSeconds'] : ['mode'];
20
+ if (Reflect.ownKeys(input).some((key) => typeof key !== 'string' || !fields.includes(key))) {
21
+ throw new TypeError('Session exchange options contain unexpected fields.');
22
+ }
23
+ if (input.mode === 'source')
24
+ return undefined;
25
+ if (auth === undefined)
26
+ throw new TypeError('Session exchange requires Session auth.');
27
+ const coverageMs = delegationCoverageMs(auth.ttlSeconds);
28
+ const ttlSeconds = admitTtlSeconds(input.ttlSeconds ?? Math.max(DEFAULT_EXCHANGE_TTL_SECONDS, Math.floor(coverageMs / 1_000) + 1));
29
+ if (ttlSeconds * 1_000 <= coverageMs) {
30
+ throw new TypeError('Session exchange ttlSeconds must exceed the Session auth ttlSeconds.');
31
+ }
32
+ return Object.freeze({ ttlSeconds });
33
+ }
34
+ /** Admit an explicit exchange: the canonical absolute issuer URL of the named Domain and its lifetime. */
35
+ export function admitExchangeRequest(domain, input) {
36
+ if (input !== undefined &&
37
+ (input === null || typeof input !== 'object' || Array.isArray(input))) {
38
+ throw new TypeError('Session exchange request is invalid.');
39
+ }
40
+ const ttlSeconds = admitTtlSeconds(input?.ttlSeconds);
41
+ const control = admitControlOptions(input === undefined
42
+ ? undefined
43
+ : {
44
+ ...(input.signal === undefined ? {} : { signal: input.signal }),
45
+ ...(input.timeoutMs === undefined ? {} : { timeoutMs: input.timeoutMs }),
46
+ });
47
+ return Object.freeze({ issuer: admitDomainIssuer(domain), ttlSeconds, control });
48
+ }
49
+ function admitTtlSeconds(input) {
50
+ const ttlSeconds = input ?? DEFAULT_EXCHANGE_TTL_SECONDS;
51
+ if (!Number.isSafeInteger(ttlSeconds) || ttlSeconds < 1) {
52
+ throw new TypeError('Session exchange ttlSeconds must be a positive safe integer.');
53
+ }
54
+ return ttlSeconds;
55
+ }
56
+ function admitDomainIssuer(input) {
57
+ try {
58
+ const issuer = acceptIssuer(input);
59
+ void new URL(issuer);
60
+ return issuer;
61
+ }
62
+ catch (cause) {
63
+ throw new TypeError('Domain issuer is invalid.', { cause });
64
+ }
65
+ }
@@ -0,0 +1,19 @@
1
+ import type { AuthExchange, SessionAuth } from '../routing/index.js';
2
+ import type { ExchangeDependencies } from './exchange.js';
3
+ /** The per-Call exchange a Session applies after resolving its source authority. */
4
+ export interface SessionExchange extends AuthExchange {
5
+ clear(): void;
6
+ }
7
+ /**
8
+ * Present each Call whose callable a remote installed Domain declares with the credential that
9
+ * Domain exchanged for the Call's source caller.
10
+ *
11
+ * Kernel callables, locally executed Domains, targets that name no Domain, and anonymous Calls keep
12
+ * the source authority unchanged. Domain credentials are held per source credential and replaced at
13
+ * the Session delegation threshold.
14
+ */
15
+ export declare function createSessionExchange(dependencies: ExchangeDependencies & {
16
+ readonly auth: SessionAuth;
17
+ }, options: Readonly<{
18
+ ttlSeconds: number;
19
+ }>): SessionExchange;
@@ -0,0 +1,72 @@
1
+ import { ClientError } from '../../errors/index.js';
2
+ import { runSessionOperation } from '../context/index.js';
3
+ import { credentials, delegationCoverageMs } from '../credential/index.js';
4
+ import { createInstallations, declaringOrigin, isKernelOrigin } from './domain.js';
5
+ import { exchangeDomainCredential } from './exchange.js';
6
+ import { MAXIMUM_EXCHANGE_SOURCES } from './limits.js';
7
+ import { isAuthority, renewing } from './source.js';
8
+ /**
9
+ * Present each Call whose callable a remote installed Domain declares with the credential that
10
+ * Domain exchanged for the Call's source caller.
11
+ *
12
+ * Kernel callables, locally executed Domains, targets that name no Domain, and anonymous Calls keep
13
+ * the source authority unchanged. Domain credentials are held per source credential and replaced at
14
+ * the Session delegation threshold.
15
+ */
16
+ export function createSessionExchange(dependencies, options) {
17
+ const { auth } = dependencies;
18
+ const coverageMs = delegationCoverageMs(auth.ttlSeconds);
19
+ const installations = createInstallations(dependencies);
20
+ const sources = new Map();
21
+ return Object.freeze({ resolve, clear });
22
+ async function resolve(call, effective, operation) {
23
+ if (!isAuthority(effective))
24
+ return effective;
25
+ const origin = declaringOrigin(call.target);
26
+ if (origin === undefined || isKernelOrigin(origin))
27
+ return effective;
28
+ const domain = await installations.issuerOf(origin, effective, operation);
29
+ if (domain === undefined)
30
+ return effective;
31
+ return renewing(auth, call, effective, operation, async (source) => {
32
+ if (source.delegate.ttlSeconds > auth.ttlSeconds) {
33
+ throw new ClientError('Session delegation outlives the Domain credential it would carry.');
34
+ }
35
+ const domainCredentials = credentialsFor(source, domain);
36
+ const exchanged = await runSessionOperation(operation, (signal) => domainCredentials.acquire(signal));
37
+ return Object.freeze({ credential: exchanged.credential, delegate: source.delegate });
38
+ });
39
+ }
40
+ function clear() {
41
+ installations.clear();
42
+ sources.clear();
43
+ }
44
+ function credentialsFor(source, domain) {
45
+ const held = heldFor(source.credential);
46
+ const known = held.get(domain);
47
+ if (known !== undefined)
48
+ return known;
49
+ const domainCredentials = credentials({
50
+ ttlSeconds: auth.ttlSeconds,
51
+ mint: (signal) => exchangeDomainCredential(dependencies, source, {
52
+ issuer: domain,
53
+ ttlSeconds: options.ttlSeconds,
54
+ coverageMs,
55
+ }, dependencies.operation(signal)),
56
+ });
57
+ held.set(domain, domainCredentials);
58
+ return domainCredentials;
59
+ }
60
+ /** Domain credentials never cross source credentials; the oldest source is forgotten first. */
61
+ function heldFor(credential) {
62
+ const known = sources.get(credential);
63
+ if (known !== undefined)
64
+ return known;
65
+ const held = new Map();
66
+ sources.set(credential, held);
67
+ if (sources.size > MAXIMUM_EXCHANGE_SOURCES) {
68
+ sources.delete(sources.keys().next().value);
69
+ }
70
+ return held;
71
+ }
72
+ }
@@ -0,0 +1,33 @@
1
+ import type { invocation } from '@astrale-os/kernel-protocol';
2
+ import type { AuthCall } from '../../auth/auth.js';
3
+ import type { Call, Result } from '../../client/index.js';
4
+ import type { SessionOperation } from '../context/index.js';
5
+ import type { EffectiveAuth, SessionAuth } from '../routing/index.js';
6
+ import type { ExchangeDependencies } from './exchange.js';
7
+ import { ExchangeError } from '../../errors/index.js';
8
+ /** A resolved source that carries both a credential and its delegation. */
9
+ export type SourceAuthority = Required<EffectiveAuth>;
10
+ /** Source Kernel syscalls issued as exactly one admitted source caller within one operation. */
11
+ interface SourceCaller {
12
+ dispatch(call: Call): Promise<Result>;
13
+ readonly call: AuthCall;
14
+ }
15
+ /** The source credential can no longer grant a delegation that covers what its exchange carries. */
16
+ export declare function sourceExhausted(): ExchangeError;
17
+ export declare function isAuthority(auth: EffectiveAuth): auth is SourceAuthority;
18
+ /** The source Kernel conversation of one exchange, acting as exactly the admitted source caller. */
19
+ export declare function sourceCaller(dependencies: Pick<ExchangeDependencies, 'source'>, auth: EffectiveAuth, operation: SessionOperation): SourceCaller;
20
+ /**
21
+ * Bound a requested delegation by the source credential's expiry less the issuance margin: the
22
+ * Kernel rejects a delegation that outlives its source, judged by its own clock. An opaque or
23
+ * transport-held source leaves the bound to the Kernel. A source that cannot grant one second, or
24
+ * bounds the delegation within `coverageMs`, is exhausted.
25
+ */
26
+ export declare function delegationTtl(credential: string | undefined, ttlSeconds: number, coverageMs?: number): number;
27
+ /**
28
+ * Run `attempt` with the resolved source, and once more with a renewed source if that one proved
29
+ * exhausted. The Session auth is refreshed only while it still resolves the exhausted credential, so
30
+ * concurrent Calls share one renewal; an auth that cannot refresh keeps the failure.
31
+ */
32
+ export declare function renewing<T>(auth: SessionAuth, call: invocation.Call, source: SourceAuthority, operation: SessionOperation, attempt: (source: SourceAuthority) => Promise<T>): Promise<T>;
33
+ export {};
@@ -0,0 +1,78 @@
1
+ import { inspect } from '@astrale-os/kernel-core/auth/credential';
2
+ import { ExchangeError } from '../../errors/index.js';
3
+ import { runSessionOperation, sessionTransportOptions } from '../context/index.js';
4
+ import { requireResultKind, resolveAuth } from '../routing/index.js';
5
+ import { ISSUANCE_MARGIN_SECONDS } from './limits.js';
6
+ /** The source credential can no longer grant a delegation that covers what its exchange carries. */
7
+ export function sourceExhausted() {
8
+ return new ExchangeError('The source credential expires too soon for a Domain token exchange.', {
9
+ failure: 'source-exhausted',
10
+ });
11
+ }
12
+ export function isAuthority(auth) {
13
+ return auth.credential !== undefined && auth.delegate !== undefined;
14
+ }
15
+ /** The source Kernel conversation of one exchange, acting as exactly the admitted source caller. */
16
+ export function sourceCaller(dependencies, auth, operation) {
17
+ const client = dependencies.source();
18
+ const caller = auth.credential === undefined ? client : client.as(auth.credential);
19
+ const dispatch = (input) => runSessionOperation(operation, () => caller.dispatch(input, {
20
+ ...sessionTransportOptions(operation),
21
+ ...(auth.delegate === undefined ? {} : { delegate: auth.delegate }),
22
+ }));
23
+ const call = async (target, input) => requireResultKind('value', await dispatch({ target, input })).value;
24
+ return Object.freeze({ dispatch, call });
25
+ }
26
+ /**
27
+ * Bound a requested delegation by the source credential's expiry less the issuance margin: the
28
+ * Kernel rejects a delegation that outlives its source, judged by its own clock. An opaque or
29
+ * transport-held source leaves the bound to the Kernel. A source that cannot grant one second, or
30
+ * bounds the delegation within `coverageMs`, is exhausted.
31
+ */
32
+ export function delegationTtl(credential, ttlSeconds, coverageMs = 0) {
33
+ const remaining = remainingSeconds(credential);
34
+ if (remaining === undefined || remaining >= ttlSeconds)
35
+ return ttlSeconds;
36
+ if (remaining < 1 || remaining * 1_000 <= coverageMs)
37
+ throw sourceExhausted();
38
+ return remaining;
39
+ }
40
+ /**
41
+ * Run `attempt` with the resolved source, and once more with a renewed source if that one proved
42
+ * exhausted. The Session auth is refreshed only while it still resolves the exhausted credential, so
43
+ * concurrent Calls share one renewal; an auth that cannot refresh keeps the failure.
44
+ */
45
+ export async function renewing(auth, call, source, operation, attempt) {
46
+ try {
47
+ return await attempt(source);
48
+ }
49
+ catch (cause) {
50
+ if (!(cause instanceof ExchangeError) || cause.failure !== 'source-exhausted')
51
+ throw cause;
52
+ let renewed = await resolveAuth(auth, call, operation);
53
+ if (renewed.credential === source.credential && auth.refresh !== undefined) {
54
+ const refresh = auth.refresh;
55
+ await runSessionOperation(operation, async (signal) => {
56
+ await refresh(signal);
57
+ });
58
+ renewed = await resolveAuth(auth, call, operation);
59
+ }
60
+ if (!isAuthority(renewed) || renewed.credential === source.credential)
61
+ throw cause;
62
+ return attempt(renewed);
63
+ }
64
+ }
65
+ function remainingSeconds(credential) {
66
+ if (credential === undefined)
67
+ return undefined;
68
+ let expiresAt;
69
+ try {
70
+ expiresAt = inspect(credential).claims.exp;
71
+ }
72
+ catch {
73
+ return undefined;
74
+ }
75
+ if (typeof expiresAt !== 'number' || !Number.isSafeInteger(expiresAt))
76
+ return undefined;
77
+ return expiresAt - Math.ceil(Date.now() / 1_000) - ISSUANCE_MARGIN_SECONDS;
78
+ }
@@ -0,0 +1,88 @@
1
+ import type { NodeId } from '@astrale-os/kernel-core/graph/node';
2
+ import type { SystemExecutionDetail } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
3
+ import type { Value } from '@astrale-os/kernel-dsl/value';
4
+ import type { CallableReference } from './reference.js';
5
+ declare const EXECUTION_OUTPUT: unique symbol;
6
+ /**
7
+ * Immediate value of a durable call: the `K.Execution` it created or recovered. `Output` is the
8
+ * handler output of the called declaration, carried only by the type.
9
+ */
10
+ export interface ExecutionRef<Output = unknown> {
11
+ readonly id: NodeId;
12
+ readonly [EXECUTION_OUTPUT]?: Output;
13
+ }
14
+ export type ExecutionOutcome<Output = unknown> = {
15
+ readonly kind: 'completed';
16
+ readonly value: Output;
17
+ } | {
18
+ readonly kind: 'failed';
19
+ readonly error: {
20
+ readonly code: string;
21
+ readonly message: string;
22
+ readonly family?: string;
23
+ readonly details?: Value;
24
+ };
25
+ } | {
26
+ readonly kind: 'cancelled';
27
+ };
28
+ export type ExecutionState = 'pending' | 'running' | 'waiting' | 'paused' | 'completed' | 'failed' | 'cancelled' | 'expired';
29
+ /**
30
+ * The status of an Execution: its node's, or what Root reads of a system execution whose node was
31
+ * deleted.
32
+ */
33
+ export type ExecutionStatus<Output = unknown> = ExecutionNodeStatus<Output> | DeletedExecutionStatus<Output>;
34
+ /** The status of an Execution whose node exists, with the engine state of its run. */
35
+ export interface ExecutionNodeStatus<Output = unknown> {
36
+ readonly id: NodeId;
37
+ readonly function: NodeId;
38
+ readonly version: `sha256:${string}`;
39
+ readonly state: ExecutionState;
40
+ readonly createdAt: string;
41
+ /** A system execution's step, progress and session state, as Core shapes it. */
42
+ readonly detail?: SystemExecutionDetail;
43
+ readonly outcome?: ExecutionOutcome<Output>;
44
+ }
45
+ /**
46
+ * What Root alone reads of a system execution whose node was deleted: the outcome its lifecycle
47
+ * record keeps, under the explicit state `deleted`, never a live state.
48
+ */
49
+ export interface DeletedExecutionStatus<Output = unknown> {
50
+ readonly id: NodeId;
51
+ readonly state: 'deleted';
52
+ readonly outcome: ExecutionOutcome<Output>;
53
+ /** Absent: the node that recorded them is deleted. */
54
+ readonly function?: never;
55
+ readonly version?: never;
56
+ readonly createdAt?: never;
57
+ readonly detail?: never;
58
+ }
59
+ type Empty = Readonly<Record<string, never>>;
60
+ type ExecutionLike<Output> = ExecutionRef<Output> | NodeId;
61
+ /**
62
+ * Typed references to the methods of one Execution, for `session.invoke`:
63
+ *
64
+ * ```ts
65
+ * const run = await session.invoke(remind(invoice), { days: 3 })
66
+ * const outcome = await session.invoke(execution.result(run), { waitMs: 10_000 })
67
+ * ```
68
+ */
69
+ export declare const execution: Readonly<{
70
+ status: <Output>(target: ExecutionLike<Output>) => CallableReference<Empty, ExecutionStatus<Output>>;
71
+ /** Outcome once terminal; fails `EXECUTION_PENDING` when `waitMs` elapses first. */
72
+ result: <Output>(target: ExecutionLike<Output>) => CallableReference<{
73
+ readonly waitMs?: number;
74
+ }, ExecutionOutcome<Output>>;
75
+ /** Cooperative cancellation; `force` kills without compensation (owner Domain only). */
76
+ cancel: <Output>(target: ExecutionLike<Output>) => CallableReference<{
77
+ readonly force?: boolean;
78
+ }, ExecutionStatus<Output>>;
79
+ /** Resolve a named durable promise once (owner Domain only). */
80
+ signal: (target: ExecutionLike<unknown>) => CallableReference<{
81
+ readonly name: string;
82
+ readonly value: Value;
83
+ }, Empty>;
84
+ resume: <Output>(target: ExecutionLike<Output>) => CallableReference<Empty, ExecutionStatus<Output>>;
85
+ /** Forget the Execution and stop its run (owner Domain only). */
86
+ delete: (target: ExecutionLike<unknown>) => CallableReference<Empty, Empty>;
87
+ }>;
88
+ export {};
@@ -0,0 +1,34 @@
1
+ import { Path } from '@astrale-os/kernel-core/path';
2
+ import { execution as methods } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
3
+ import { kernelReference } from './reference.js';
4
+ const bound = {
5
+ status: kernelReference(methods.status),
6
+ result: kernelReference(methods.result),
7
+ cancel: kernelReference(methods.cancel),
8
+ signal: kernelReference(methods.signal),
9
+ resume: kernelReference(methods.resume),
10
+ delete: kernelReference(methods.delete),
11
+ };
12
+ function receiver(execution) {
13
+ return Path.id(typeof execution === 'string' ? execution : execution.id);
14
+ }
15
+ /**
16
+ * Typed references to the methods of one Execution, for `session.invoke`:
17
+ *
18
+ * ```ts
19
+ * const run = await session.invoke(remind(invoice), { days: 3 })
20
+ * const outcome = await session.invoke(execution.result(run), { waitMs: 10_000 })
21
+ * ```
22
+ */
23
+ export const execution = Object.freeze({
24
+ status: (target) => bound.status(receiver(target)),
25
+ /** Outcome once terminal; fails `EXECUTION_PENDING` when `waitMs` elapses first. */
26
+ result: (target) => bound.result(receiver(target)),
27
+ /** Cooperative cancellation; `force` kills without compensation (owner Domain only). */
28
+ cancel: (target) => bound.cancel(receiver(target)),
29
+ /** Resolve a named durable promise once (owner Domain only). */
30
+ signal: (target) => bound.signal(receiver(target)),
31
+ resume: (target) => bound.resume(receiver(target)),
32
+ /** Forget the Execution and stop its run (owner Domain only). */
33
+ delete: (target) => bound.delete(receiver(target)),
34
+ });
@@ -1,11 +1,14 @@
1
1
  export type { SessionControlOptions, SessionPolicy } from './context/index.js';
2
+ export type { ContentApi, ContentDownload, ContentLocation, ContentRejection, ContentUploadOptions, ContentUploadResult, } from './content/index.js';
2
3
  export { bindSession, type BoundClientSession, type BoundSessionControls, type BoundSessionSource, } from './bound.js';
3
- export type { ReadyInstallation } from '../schema/index.js';
4
- export type { SessionSnapshot } from './discovery/index.js';
5
- export type { Auth, SessionAuth, SessionEnvelopeTransport, SessionRequestOptions, } from './routing/index.js';
6
- export { ClientSession, connect, type ClientSessionOptions, type ConnectOptions, } from './session.js';
7
- export type { CallableReference, InputOfReference, InstanceCallableReference, OutputOfReference, } from './reference.js';
4
+ export { credentials, type Credentials, type CredentialsMint, type CredentialsOptions, type CredentialsState, type SessionCredential, } from './credential/index.js';
5
+ export type { IntrinsicRelease, SessionSnapshot } from './discovery/index.js';
6
+ export type { SessionExchangeOptions, SessionExchangeRequest } from './exchange/index.js';
7
+ export type { Auth, PersistedRoute, SessionRouteArtifact, SessionRouteStore, SessionAuth, SessionEnvelopeTransport, SessionRequestOptions, SessionRequestOptionsWithBody, } from './routing/index.js';
8
+ export type { ClientSessionOptions } from './options.js';
9
+ export { ClientSession, connect, type ConnectOptions } from './session.js';
10
+ export type { CallableReference, InputOfReference, InputModeOfReference, InstanceCallableReference, OutputOfReference, } from './reference.js';
8
11
  export { reference } from './reference.js';
12
+ export { execution, type ExecutionOutcome, type ExecutionRef, type DeletedExecutionStatus, type ExecutionNodeStatus, type ExecutionState, type ExecutionStatus, } from './execution.js';
9
13
  export type { ResolvedView, ViewCatalog } from './views/index.js';
10
14
  export type { DomainBinding } from '../graph/domain/index.js';
11
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,5 @@
1
1
  export { bindSession, } from './bound.js';
2
- export { ClientSession, connect, } from './session.js';
2
+ export { credentials, } from './credential/index.js';
3
+ export { ClientSession, connect } from './session.js';
3
4
  export { reference } from './reference.js';
4
- //# sourceMappingURL=index.js.map
5
+ export { execution, } from './execution.js';
@@ -0,0 +1,65 @@
1
+ import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
2
+ import type { ClientFactory, ClientPool as ClientPoolType } from '../pool/index.js';
3
+ import type { ClientWarning } from '../transport/auto/index.js';
4
+ import type { Fetch } from '../transport/http/index.js';
5
+ import type { WebSocketConstructor } from '../transport/websocket/index.js';
6
+ import type { SessionPolicy } from './context/index.js';
7
+ import type { SessionExchangeOptions } from './exchange/index.js';
8
+ import type { ClientPoolCapability, SessionAuth, SessionEnvelopeTransport, SessionRouteStore } from './routing/index.js';
9
+ import { ClientPool } from '../pool/index.js';
10
+ import { RouteCache } from './routing/index.js';
11
+ export interface ClientSessionOptions {
12
+ /** Exact canonical source Kernel identity; its invocation and discovery endpoints are derived. */
13
+ readonly kernel: string;
14
+ readonly fetch?: Fetch;
15
+ readonly client?: ClientFactory;
16
+ readonly pool?: Pick<ClientPoolType, 'clientFor'>;
17
+ readonly websocket?: WebSocketConstructor;
18
+ readonly auth?: SessionAuth;
19
+ /**
20
+ * Present each Domain callable with a credential its declaring Domain exchanges for the `auth`
21
+ * caller, so the Domain is the principal and the caller is `auth`. Kernel and local callables keep
22
+ * the `auth` credential. `connect` defaults to `auto` when `auth` is present; `new ClientSession`
23
+ * keeps source authority when this option is omitted. `{ mode: 'source' }` keeps it for every Call.
24
+ */
25
+ readonly exchange?: SessionExchangeOptions;
26
+ /** Optional caller-owned persistence for bounded confidential route artifacts. */
27
+ readonly routeStore?: SessionRouteStore;
28
+ readonly policy: SessionPolicy;
29
+ readonly envelopeTransport?: SessionEnvelopeTransport;
30
+ readonly onWarning?: (warning: ClientWarning) => void;
31
+ /** Bounds the source Kernel's own `release.json`. */
32
+ readonly maximumReleaseBytes?: number;
33
+ readonly maximumBundleBytes?: number;
34
+ readonly maximumResponseBytes?: number;
35
+ readonly timeoutMs?: number;
36
+ readonly schemaLifecycleTimeoutMs?: number;
37
+ }
38
+ /** The caller's options once admitted, defaulted and captured, ready for the Session to wire. */
39
+ export interface SessionConfiguration {
40
+ readonly kernel: IssuerId;
41
+ readonly sourceEndpoint: string;
42
+ readonly policy: Readonly<SessionPolicy>;
43
+ readonly fetch: Fetch;
44
+ readonly maximumReleaseBytes: number;
45
+ readonly maximumBundleBytes: number;
46
+ readonly maximumResponseBytes: number;
47
+ readonly timeoutMs: number;
48
+ readonly schemaLifecycleTimeoutMs: number;
49
+ readonly websocketAvailable: boolean;
50
+ /** Present when the Session created, and therefore closes, its own pool. */
51
+ readonly ownedPool?: ClientPool;
52
+ readonly pool: ClientPoolCapability;
53
+ readonly routes: RouteCache;
54
+ readonly auth: SessionAuth | undefined;
55
+ readonly exchange: Readonly<{
56
+ ttlSeconds: number;
57
+ }> | undefined;
58
+ readonly envelopeTransport: SessionEnvelopeTransport;
59
+ }
60
+ /**
61
+ * Settle the caller's options in their public rejection order: the options object, policy, Kernel,
62
+ * Fetch, client/pool exclusivity, byte limits, durations, pool, route store, auth, exchange and
63
+ * envelope transport.
64
+ */
65
+ export declare function acceptSessionOptions(options: ClientSessionOptions): SessionConfiguration;
@@ -0,0 +1,132 @@
1
+ import { Client } from '../client/index.js';
2
+ import { ClientPool } from '../pool/index.js';
3
+ import { DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS } from '../schema/index.js';
4
+ import { AutoTransport } from '../transport/auto/index.js';
5
+ import { HttpTransport } from '../transport/http/index.js';
6
+ import { WebSocketTransport } from '../transport/websocket/index.js';
7
+ import { admitKernel, admitPolicy, DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_RELEASE_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_TIMEOUT_MS, kernelInvocationEndpoint, platformDuration, positive, } from './context/index.js';
8
+ import { admitExchangeOptions } from './exchange/index.js';
9
+ import { admitEnvelopeTransport, admitSessionAuth, RouteCache } from './routing/index.js';
10
+ /**
11
+ * Settle the caller's options in their public rejection order: the options object, policy, Kernel,
12
+ * Fetch, client/pool exclusivity, byte limits, durations, pool, route store, auth, exchange and
13
+ * envelope transport.
14
+ */
15
+ export function acceptSessionOptions(options) {
16
+ if (options === null || typeof options !== 'object') {
17
+ throw new TypeError('ClientSession options are invalid.');
18
+ }
19
+ const policy = admitPolicy(options.policy);
20
+ const kernel = admitKernel(options.kernel, policy.allowInsecureHttp === true);
21
+ const sourceEndpoint = kernelInvocationEndpoint(kernel);
22
+ const fetch = options.fetch ?? globalThis.fetch;
23
+ if (typeof fetch !== 'function')
24
+ throw new TypeError('ClientSession requires Fetch.');
25
+ const fetchImpl = options.fetch === undefined ? fetch.bind(globalThis) : fetch;
26
+ if (options.client !== undefined && options.pool !== undefined) {
27
+ throw new TypeError('ClientSession accepts either client or pool, not both.');
28
+ }
29
+ const maximumReleaseBytes = positive(options.maximumReleaseBytes ?? DEFAULT_MAXIMUM_RELEASE_BYTES, 'maximumReleaseBytes');
30
+ const maximumBundleBytes = positive(options.maximumBundleBytes ?? DEFAULT_MAXIMUM_BUNDLE_BYTES, 'maximumBundleBytes');
31
+ const maximumResponseBytes = positive(options.maximumResponseBytes ?? DEFAULT_MAXIMUM_RESPONSE_BYTES, 'maximumResponseBytes');
32
+ const timeoutMs = platformDuration(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, 'timeoutMs');
33
+ const schemaLifecycleTimeoutMs = platformDuration(options.schemaLifecycleTimeoutMs ?? DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS, 'schemaLifecycleTimeoutMs');
34
+ let ownedPool;
35
+ let pool;
36
+ if (options.pool === undefined) {
37
+ ownedPool = new ClientPool({
38
+ client: options.client ??
39
+ defaultClientFactory({
40
+ fetch: fetchImpl,
41
+ ...(options.websocket === undefined ? {} : { websocket: options.websocket }),
42
+ ...(options.onWarning === undefined ? {} : { onWarning: options.onWarning }),
43
+ maximumResponseBytes,
44
+ timeoutMs,
45
+ }),
46
+ });
47
+ pool = captureClientPool(ownedPool);
48
+ }
49
+ else {
50
+ pool = captureClientPool(options.pool);
51
+ }
52
+ // The route store is read while it is captured, so it keeps its place before auth and exchange.
53
+ const routes = new RouteCache(policy.maximumRouteAgeMs, undefined, options.routeStore);
54
+ const auth = admitSessionAuth(options.auth);
55
+ const exchange = admitExchangeOptions(options.exchange, auth);
56
+ return Object.freeze({
57
+ kernel,
58
+ sourceEndpoint,
59
+ policy,
60
+ fetch: fetchImpl,
61
+ maximumReleaseBytes,
62
+ maximumBundleBytes,
63
+ maximumResponseBytes,
64
+ timeoutMs,
65
+ schemaLifecycleTimeoutMs,
66
+ websocketAvailable: options.client !== undefined ||
67
+ options.pool !== undefined ||
68
+ options.websocket !== undefined ||
69
+ typeof WebSocket === 'function',
70
+ ...(ownedPool === undefined ? {} : { ownedPool }),
71
+ pool,
72
+ routes,
73
+ auth,
74
+ exchange,
75
+ envelopeTransport: admitEnvelopeTransport(options.envelopeTransport ?? 'http'),
76
+ });
77
+ }
78
+ function captureClientPool(input) {
79
+ if (input === null ||
80
+ typeof input !== 'object' ||
81
+ typeof input.clientFor !== 'function') {
82
+ throw new TypeError('Session client pool capability is invalid.');
83
+ }
84
+ return Object.freeze({
85
+ clientFor: (target) => admitPooledClient(input.clientFor.call(input, target)),
86
+ });
87
+ }
88
+ function admitPooledClient(input) {
89
+ if (input === null ||
90
+ typeof input !== 'object' ||
91
+ typeof input.dispatch !== 'function' ||
92
+ typeof input.as !== 'function' ||
93
+ typeof input.close !== 'function') {
94
+ throw new TypeError('Session client pool capability returned an invalid Client.');
95
+ }
96
+ return input;
97
+ }
98
+ function defaultClientFactory(options) {
99
+ return (target) => {
100
+ switch (target.transport) {
101
+ case 'http':
102
+ return new Client({
103
+ transport: new HttpTransport({
104
+ url: target.url,
105
+ fetch: options.fetch,
106
+ timeoutMs: options.timeoutMs,
107
+ maximumResponseBytes: options.maximumResponseBytes,
108
+ }),
109
+ });
110
+ case 'websocket':
111
+ return new Client({
112
+ transport: new WebSocketTransport({
113
+ url: target.url,
114
+ timeoutMs: options.timeoutMs,
115
+ maximumResponseBytes: options.maximumResponseBytes,
116
+ ...(options.websocket === undefined ? {} : { websocket: options.websocket }),
117
+ }),
118
+ });
119
+ case 'auto':
120
+ return new Client({
121
+ transport: new AutoTransport({
122
+ endpoints: target.endpoints,
123
+ fetch: options.fetch,
124
+ timeoutMs: options.timeoutMs,
125
+ maximumResponseBytes: options.maximumResponseBytes,
126
+ ...(options.websocket === undefined ? {} : { websocket: options.websocket }),
127
+ ...(options.onWarning === undefined ? {} : { onWarning: options.onWarning }),
128
+ }),
129
+ });
130
+ }
131
+ };
132
+ }