@sixb/core 0.2.5 → 0.2.6

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 (385) hide show
  1. package/dist/actions/index.js +36 -35
  2. package/dist/actions/index.js.map +1 -1
  3. package/dist/actions/validation.d.ts.map +1 -1
  4. package/dist/agents/errors.d.ts +1 -1
  5. package/dist/agents/errors.d.ts.map +1 -1
  6. package/dist/agents/execution.d.ts +17 -2
  7. package/dist/agents/execution.d.ts.map +1 -1
  8. package/dist/agents/index.d.ts +2 -2
  9. package/dist/agents/index.d.ts.map +1 -1
  10. package/dist/agents/index.js +50 -44
  11. package/dist/agents/index.js.map +1 -1
  12. package/dist/agents/model-routing.d.ts +5 -2
  13. package/dist/agents/model-routing.d.ts.map +1 -1
  14. package/dist/agents/request.d.ts +45 -4
  15. package/dist/agents/request.d.ts.map +1 -1
  16. package/dist/agents/run-events.d.ts +4 -0
  17. package/dist/agents/run-events.d.ts.map +1 -1
  18. package/dist/agents/run-session-children.d.ts.map +1 -1
  19. package/dist/agents/run-turn.d.ts +9 -1
  20. package/dist/agents/run-turn.d.ts.map +1 -1
  21. package/dist/agents/streams/index.d.ts +1 -1
  22. package/dist/agents/streams/index.d.ts.map +1 -1
  23. package/dist/agents/streams/index.js +1 -1
  24. package/dist/agents/streams/internal.d.ts +2 -1
  25. package/dist/agents/streams/internal.d.ts.map +1 -1
  26. package/dist/agents/streams/internal.js +22 -2
  27. package/dist/agents/streams/internal.js.map +1 -1
  28. package/dist/agents/streams/protocol.d.ts +37 -0
  29. package/dist/agents/streams/protocol.d.ts.map +1 -1
  30. package/dist/agents/streams/steps.d.ts +24 -0
  31. package/dist/agents/streams/steps.d.ts.map +1 -0
  32. package/dist/agents/thread-access.d.ts +44 -2
  33. package/dist/agents/thread-access.d.ts.map +1 -1
  34. package/dist/artifacts/live/server.js +19 -18
  35. package/dist/artifacts/live/server.js.map +1 -1
  36. package/dist/artifacts/publish/index.js +18 -17
  37. package/dist/artifacts/publish/index.js.map +1 -1
  38. package/dist/artifacts/publish/merge.d.ts +2 -1
  39. package/dist/artifacts/publish/merge.d.ts.map +1 -1
  40. package/dist/artifacts/run-query.d.ts.map +1 -1
  41. package/dist/auth/index.js +6 -6
  42. package/dist/authorization/index.js +2 -2
  43. package/dist/bootstrap/index.js +40 -38
  44. package/dist/bootstrap/index.js.map +2 -2
  45. package/dist/calendar.d.ts +55 -0
  46. package/dist/calendar.d.ts.map +1 -0
  47. package/dist/calendar.js +19 -0
  48. package/dist/calendar.js.map +9 -0
  49. package/dist/{chunk-5a4a52tq.js → chunk-0pmpwn3g.js} +18 -2
  50. package/dist/chunk-0pmpwn3g.js.map +10 -0
  51. package/dist/{chunk-xcrnrpfh.js → chunk-394zjzjs.js} +20 -10
  52. package/dist/{chunk-xcrnrpfh.js.map → chunk-394zjzjs.js.map} +5 -5
  53. package/dist/{chunk-stmxh0hv.js → chunk-3neam1y5.js} +2 -2
  54. package/dist/{chunk-zeykm8my.js → chunk-3qtk0070.js} +16 -42
  55. package/dist/chunk-3qtk0070.js.map +14 -0
  56. package/dist/{chunk-0mvjpgvm.js → chunk-425ydk65.js} +4 -4
  57. package/dist/{chunk-s5pj68fa.js → chunk-5sswe5ej.js} +2 -2
  58. package/dist/chunk-6hfbz4d0.js +98 -0
  59. package/dist/chunk-6hfbz4d0.js.map +10 -0
  60. package/dist/{chunk-3zagkr6w.js → chunk-7mhbs9yy.js} +4 -4
  61. package/dist/{chunk-3zagkr6w.js.map → chunk-7mhbs9yy.js.map} +1 -1
  62. package/dist/{chunk-fpf57gca.js → chunk-7r9mqpva.js} +273 -66
  63. package/dist/{chunk-fpf57gca.js.map → chunk-7r9mqpva.js.map} +5 -5
  64. package/dist/{chunk-ewqn51gr.js → chunk-88xeh6zx.js} +6 -4
  65. package/dist/{chunk-ewqn51gr.js.map → chunk-88xeh6zx.js.map} +4 -4
  66. package/dist/chunk-90nqenq8.js +386 -0
  67. package/dist/chunk-90nqenq8.js.map +14 -0
  68. package/dist/{chunk-gjhrz66x.js → chunk-9c9yknwt.js} +247 -20
  69. package/dist/{chunk-gjhrz66x.js.map → chunk-9c9yknwt.js.map} +6 -6
  70. package/dist/{chunk-q9nkpr8k.js → chunk-9tpmfh3n.js} +1 -1
  71. package/dist/chunk-9wr3yajk.js.map +2 -2
  72. package/dist/{chunk-z1njfqqs.js → chunk-ats8y3d9.js} +721 -156
  73. package/dist/{chunk-z1njfqqs.js.map → chunk-ats8y3d9.js.map} +13 -13
  74. package/dist/{chunk-68hm50qh.js → chunk-bcz9dxtf.js} +16 -46
  75. package/dist/chunk-bcz9dxtf.js.map +12 -0
  76. package/dist/{chunk-naxjka9v.js → chunk-brhp9d97.js} +2 -2
  77. package/dist/{chunk-8a8k38tz.js → chunk-brybqw5k.js} +1 -1
  78. package/dist/{chunk-s1mqyqmm.js → chunk-bs1sd0e0.js} +12 -8
  79. package/dist/chunk-bs1sd0e0.js.map +18 -0
  80. package/dist/{chunk-vehcr9eb.js → chunk-cg7cygfj.js} +1 -1
  81. package/dist/chunk-dq3t5sr3.js +114 -0
  82. package/dist/chunk-dq3t5sr3.js.map +11 -0
  83. package/dist/{chunk-r2psmn42.js → chunk-eg6xqef7.js} +1 -1
  84. package/dist/{chunk-zxhym8tr.js → chunk-f05994as.js} +1 -1
  85. package/dist/{chunk-5t9gm5tt.js → chunk-fmgf9h5e.js} +38 -14
  86. package/dist/chunk-fmgf9h5e.js.map +22 -0
  87. package/dist/{chunk-ey1p8w68.js → chunk-gaj8djsw.js} +80 -4
  88. package/dist/chunk-gaj8djsw.js.map +13 -0
  89. package/dist/{chunk-1yh6jgtz.js → chunk-grt2j5vp.js} +2 -2
  90. package/dist/{chunk-zft9bzbc.js → chunk-hkbks1xm.js} +2 -1
  91. package/dist/{chunk-zft9bzbc.js.map → chunk-hkbks1xm.js.map} +3 -3
  92. package/dist/{chunk-rtdrm592.js → chunk-htdzx40w.js} +2 -2
  93. package/dist/{chunk-bc3y6gff.js → chunk-jka26v8c.js} +1 -1
  94. package/dist/{chunk-m3qx2pns.js → chunk-jt012fxq.js} +28 -12
  95. package/dist/{chunk-m3qx2pns.js.map → chunk-jt012fxq.js.map} +5 -5
  96. package/dist/{chunk-k3jh8gsg.js → chunk-kft7mp7z.js} +20 -3
  97. package/dist/chunk-kft7mp7z.js.map +10 -0
  98. package/dist/{chunk-qavwr628.js → chunk-n1hbwc6y.js} +5 -6
  99. package/dist/chunk-n1hbwc6y.js.map +12 -0
  100. package/dist/chunk-nxysqbt0.js.map +2 -2
  101. package/dist/{chunk-pqvvqc65.js → chunk-pqj8vff9.js} +3 -3
  102. package/dist/{chunk-wqe9shx2.js → chunk-qbd282aa.js} +2 -2
  103. package/dist/{chunk-e91fmg6t.js → chunk-qsa7nw6f.js} +2 -1
  104. package/dist/{chunk-e91fmg6t.js.map → chunk-qsa7nw6f.js.map} +3 -3
  105. package/dist/{chunk-rg725hry.js → chunk-s8xxef60.js} +83 -33
  106. package/dist/{chunk-rg725hry.js.map → chunk-s8xxef60.js.map} +5 -5
  107. package/dist/{chunk-fzae1jpq.js → chunk-t19wjmnc.js} +5 -5
  108. package/dist/{chunk-paxabbqd.js → chunk-tapdssb5.js} +1 -1
  109. package/dist/{chunk-dhkc9b23.js → chunk-v8a1qjzp.js} +1 -1
  110. package/dist/{chunk-q8d9p0tb.js → chunk-wzcjhv54.js} +8 -1
  111. package/dist/{chunk-q8d9p0tb.js.map → chunk-wzcjhv54.js.map} +3 -3
  112. package/dist/{chunk-pc7kra3k.js → chunk-xavet0qs.js} +1 -1
  113. package/dist/{chunk-0hkdtwqk.js → chunk-xf76csps.js} +5 -5
  114. package/dist/{chunk-m9ketb51.js → chunk-ygvay56w.js} +1 -1
  115. package/dist/{chunk-b4escq4c.js → chunk-ykchk644.js} +6 -6
  116. package/dist/{chunk-k29n4176.js → chunk-ym1bqd98.js} +6 -6
  117. package/dist/connectors/connections/capability.d.ts +11 -0
  118. package/dist/connectors/connections/capability.d.ts.map +1 -1
  119. package/dist/connectors/connections/internal.d.ts +2 -1
  120. package/dist/connectors/connections/internal.d.ts.map +1 -1
  121. package/dist/connectors/connections/internal.js +8 -4
  122. package/dist/connectors/connections/internal.js.map +1 -1
  123. package/dist/connectors/connections/service.d.ts +9 -1
  124. package/dist/connectors/connections/service.d.ts.map +1 -1
  125. package/dist/connectors/execution.d.ts +7 -1
  126. package/dist/connectors/execution.d.ts.map +1 -1
  127. package/dist/connectors/service.d.ts +5 -1
  128. package/dist/connectors/service.d.ts.map +1 -1
  129. package/dist/deploy/types.d.ts +4 -1
  130. package/dist/deploy/types.d.ts.map +1 -1
  131. package/dist/events/execution.d.ts +8 -1
  132. package/dist/events/execution.d.ts.map +1 -1
  133. package/dist/events/types/syncs.d.ts +4 -0
  134. package/dist/events/types/syncs.d.ts.map +1 -1
  135. package/dist/execution/agent.js +37 -36
  136. package/dist/execution/agent.js.map +1 -1
  137. package/dist/execution/authorized-object-reader.d.ts +4 -0
  138. package/dist/execution/authorized-object-reader.d.ts.map +1 -1
  139. package/dist/execution/object-reader-ontology.d.ts +3 -0
  140. package/dist/execution/object-reader-ontology.d.ts.map +1 -1
  141. package/dist/execution/primitive.js +36 -35
  142. package/dist/execution/primitive.js.map +1 -1
  143. package/dist/execution/request.d.ts +1 -1
  144. package/dist/execution/request.d.ts.map +1 -1
  145. package/dist/execution/request.js +33 -32
  146. package/dist/execution/request.js.map +3 -3
  147. package/dist/http/api-routes.d.ts.map +1 -1
  148. package/dist/http/index.js +1 -1
  149. package/dist/index.d.ts +5 -5
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +61 -59
  152. package/dist/index.js.map +1 -1
  153. package/dist/maintenance/index.js +1 -1
  154. package/dist/materializer/index.js +22 -21
  155. package/dist/materializer/index.js.map +1 -1
  156. package/dist/models/audio/runtime.d.ts.map +1 -1
  157. package/dist/models/audio/types.d.ts +19 -0
  158. package/dist/models/audio/types.d.ts.map +1 -1
  159. package/dist/models/execution/index.js +20 -19
  160. package/dist/models/execution/index.js.map +1 -1
  161. package/dist/models/index.d.ts +1 -1
  162. package/dist/models/index.d.ts.map +1 -1
  163. package/dist/objects/index.js +36 -35
  164. package/dist/objects/index.js.map +1 -1
  165. package/dist/objects/query/executor.d.ts +3 -1
  166. package/dist/objects/query/executor.d.ts.map +1 -1
  167. package/dist/objects/query/explain.d.ts +3 -1
  168. package/dist/objects/query/explain.d.ts.map +1 -1
  169. package/dist/objects/query/index.d.ts +1 -1
  170. package/dist/objects/query/index.d.ts.map +1 -1
  171. package/dist/objects/query/index.js +19 -18
  172. package/dist/objects/query/index.js.map +1 -1
  173. package/dist/objects/query/link-query-clearance.d.ts +3 -0
  174. package/dist/objects/query/link-query-clearance.d.ts.map +1 -1
  175. package/dist/objects/query/links.d.ts +1 -1
  176. package/dist/objects/query/links.d.ts.map +1 -1
  177. package/dist/objects/query/validate.d.ts +17 -0
  178. package/dist/objects/query/validate.d.ts.map +1 -1
  179. package/dist/objects/sdk/runtime-query-executor.d.ts +1 -1
  180. package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
  181. package/dist/ontology/index.js +3 -3
  182. package/dist/ontology/internal.js +3 -3
  183. package/dist/pipelines/index.js +21 -20
  184. package/dist/pipelines/index.js.map +1 -1
  185. package/dist/projections/internal.js +20 -19
  186. package/dist/projections/internal.js.map +1 -1
  187. package/dist/queues/in-memory.d.ts +1 -1
  188. package/dist/queues/in-memory.d.ts.map +1 -1
  189. package/dist/runtime/host.d.ts.map +1 -1
  190. package/dist/runtime/internal.js +24 -23
  191. package/dist/runtime/internal.js.map +2 -2
  192. package/dist/runtime/locale.d.ts +0 -2
  193. package/dist/runtime/locale.d.ts.map +1 -1
  194. package/dist/runtime/sixb.d.ts.map +1 -1
  195. package/dist/sandboxes/auth.d.ts +26 -4
  196. package/dist/sandboxes/auth.d.ts.map +1 -1
  197. package/dist/sandboxes/index.d.ts +3 -1
  198. package/dist/sandboxes/index.d.ts.map +1 -1
  199. package/dist/sandboxes/index.js +5 -5
  200. package/dist/security/view-conditions.d.ts.map +1 -1
  201. package/dist/shares/internal.js +16 -15
  202. package/dist/shares/internal.js.map +2 -2
  203. package/dist/storage/agents/in-memory.d.ts +18 -1
  204. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  205. package/dist/storage/agents/index.d.ts +1 -1
  206. package/dist/storage/agents/index.d.ts.map +1 -1
  207. package/dist/storage/agents/provider.d.ts +43 -9
  208. package/dist/storage/agents/provider.d.ts.map +1 -1
  209. package/dist/storage/agents/provider.js +18 -2
  210. package/dist/storage/agents/provider.js.map +1 -1
  211. package/dist/storage/agents/types.d.ts +136 -3
  212. package/dist/storage/agents/types.d.ts.map +1 -1
  213. package/dist/storage/ai-cost/analytics.d.ts +3 -2
  214. package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
  215. package/dist/storage/ai-cost/provider.js +4 -3
  216. package/dist/storage/ai-cost/provider.js.map +1 -1
  217. package/dist/storage/ai-cost/types.d.ts +5 -1
  218. package/dist/storage/ai-cost/types.d.ts.map +1 -1
  219. package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
  220. package/dist/storage/artifacts/record.d.ts +3 -1
  221. package/dist/storage/artifacts/record.d.ts.map +1 -1
  222. package/dist/storage/artifacts/types.d.ts +7 -0
  223. package/dist/storage/artifacts/types.d.ts.map +1 -1
  224. package/dist/storage/file-upload-sessions/provider.js +7 -7
  225. package/dist/storage/index.d.ts +2 -2
  226. package/dist/storage/index.d.ts.map +1 -1
  227. package/dist/storage/index.js +22 -21
  228. package/dist/storage/index.js.map +1 -1
  229. package/dist/storage/internal.js +8 -8
  230. package/dist/storage/operation-scope.d.ts.map +1 -1
  231. package/dist/storage/operation-scope.js +1 -1
  232. package/dist/storage/sync-runs/idempotency.d.ts.map +1 -1
  233. package/dist/storage/sync-runs/in-memory.d.ts +2 -1
  234. package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
  235. package/dist/storage/sync-runs/index.d.ts +1 -1
  236. package/dist/storage/sync-runs/index.d.ts.map +1 -1
  237. package/dist/storage/sync-runs/types.d.ts +27 -2
  238. package/dist/storage/sync-runs/types.d.ts.map +1 -1
  239. package/dist/storage/workflow-runs/provider.js +7 -7
  240. package/dist/syncs/accounts.d.ts +36 -0
  241. package/dist/syncs/accounts.d.ts.map +1 -0
  242. package/dist/syncs/builders.d.ts.map +1 -1
  243. package/dist/syncs/connections.d.ts +36 -0
  244. package/dist/syncs/connections.d.ts.map +1 -0
  245. package/dist/syncs/execution.d.ts +14 -4
  246. package/dist/syncs/execution.d.ts.map +1 -1
  247. package/dist/syncs/index.d.ts +2 -1
  248. package/dist/syncs/index.d.ts.map +1 -1
  249. package/dist/syncs/index.js +22 -21
  250. package/dist/syncs/index.js.map +1 -1
  251. package/dist/syncs/request.d.ts +16 -2
  252. package/dist/syncs/request.d.ts.map +1 -1
  253. package/dist/syncs/run-dispatch.d.ts +14 -2
  254. package/dist/syncs/run-dispatch.d.ts.map +1 -1
  255. package/dist/testing/agent-approval-storage-contract.d.ts.map +1 -1
  256. package/dist/testing/agent-inbox-storage-contract.d.ts.map +1 -1
  257. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  258. package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
  259. package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
  260. package/dist/testing/index.js +1051 -58
  261. package/dist/testing/index.js.map +8 -8
  262. package/dist/testing/run-claim-storage-contract.d.ts.map +1 -1
  263. package/dist/webhooks/internal.js +17 -16
  264. package/dist/webhooks/internal.js.map +2 -2
  265. package/dist/workers/index.js +66 -13
  266. package/dist/workers/index.js.map +4 -4
  267. package/dist/workers/queue-worker.d.ts +5 -0
  268. package/dist/workers/queue-worker.d.ts.map +1 -1
  269. package/dist/workers/worker.d.ts +8 -0
  270. package/dist/workers/worker.d.ts.map +1 -1
  271. package/dist/workflows/index.js +42 -40
  272. package/dist/workflows/index.js.map +1 -1
  273. package/package.json +7 -1
  274. package/src/actions/validation.ts +3 -1
  275. package/src/agents/children.ts +6 -0
  276. package/src/agents/errors.ts +3 -0
  277. package/src/agents/execution.ts +170 -20
  278. package/src/agents/index.ts +4 -0
  279. package/src/agents/model-routing.ts +25 -9
  280. package/src/agents/request.ts +759 -40
  281. package/src/agents/run-events.ts +235 -38
  282. package/src/agents/run-session-children.ts +13 -2
  283. package/src/agents/run-turn.ts +140 -23
  284. package/src/agents/streams/index.ts +2 -0
  285. package/src/agents/streams/internal.ts +12 -0
  286. package/src/agents/streams/protocol.ts +69 -1
  287. package/src/agents/streams/steps.ts +131 -0
  288. package/src/agents/thread-access.ts +57 -2
  289. package/src/artifacts/publish/merge.ts +14 -3
  290. package/src/artifacts/run-query.ts +5 -2
  291. package/src/calendar.ts +195 -0
  292. package/src/connectors/connections/capability.ts +40 -0
  293. package/src/connectors/connections/internal.ts +3 -0
  294. package/src/connectors/connections/service.ts +74 -5
  295. package/src/connectors/execution.ts +5 -6
  296. package/src/connectors/service.ts +23 -0
  297. package/src/deploy/types.ts +4 -1
  298. package/src/events/execution.ts +42 -2
  299. package/src/events/types/syncs.ts +4 -0
  300. package/src/execution/authorized-object-reader.ts +33 -5
  301. package/src/execution/object-reader-ontology.ts +6 -0
  302. package/src/execution/request.ts +1 -0
  303. package/src/http/api-routes.ts +8 -0
  304. package/src/index.ts +18 -2
  305. package/src/models/audio/runtime.ts +57 -14
  306. package/src/models/audio/types.ts +20 -0
  307. package/src/models/index.ts +1 -0
  308. package/src/objects/query/executor.ts +4 -0
  309. package/src/objects/query/explain.ts +5 -0
  310. package/src/objects/query/index.ts +1 -0
  311. package/src/objects/query/link-query-clearance.ts +4 -1
  312. package/src/objects/query/links.ts +5 -1
  313. package/src/objects/query/validate.ts +33 -1
  314. package/src/objects/sdk/runtime-query-executor.ts +7 -3
  315. package/src/runtime/host.ts +13 -7
  316. package/src/runtime/locale.ts +0 -10
  317. package/src/runtime/sixb.ts +12 -2
  318. package/src/sandboxes/README.md +3 -1
  319. package/src/sandboxes/auth.ts +32 -4
  320. package/src/sandboxes/index.ts +15 -1
  321. package/src/security/view-conditions.ts +2 -1
  322. package/src/storage/agents/in-memory.ts +271 -6
  323. package/src/storage/agents/index.ts +10 -0
  324. package/src/storage/agents/provider.ts +170 -13
  325. package/src/storage/agents/types.ts +148 -3
  326. package/src/storage/ai-cost/analytics.ts +22 -43
  327. package/src/storage/ai-cost/types.ts +5 -1
  328. package/src/storage/artifacts/in-memory.ts +20 -5
  329. package/src/storage/artifacts/record.ts +8 -2
  330. package/src/storage/artifacts/types.ts +7 -0
  331. package/src/storage/index.ts +11 -0
  332. package/src/storage/operation-scope.ts +1 -0
  333. package/src/storage/sync-runs/idempotency.ts +1 -0
  334. package/src/storage/sync-runs/in-memory.ts +43 -1
  335. package/src/storage/sync-runs/index.ts +1 -0
  336. package/src/storage/sync-runs/types.ts +30 -1
  337. package/src/syncs/accounts.ts +85 -0
  338. package/src/syncs/builders.ts +18 -1
  339. package/src/syncs/connections.ts +123 -0
  340. package/src/syncs/execution.ts +64 -22
  341. package/src/syncs/index.ts +3 -0
  342. package/src/syncs/request.ts +81 -23
  343. package/src/syncs/run-dispatch.ts +69 -7
  344. package/src/testing/agent-approval-storage-contract.ts +123 -0
  345. package/src/testing/agent-inbox-storage-contract.ts +59 -0
  346. package/src/testing/agent-storage-contract.ts +767 -8
  347. package/src/testing/ai-cost-storage-contract.ts +80 -0
  348. package/src/testing/artifact-storage-contract.ts +129 -0
  349. package/src/testing/run-claim-storage-contract.ts +116 -0
  350. package/src/workers/README.md +4 -1
  351. package/src/workers/lost-runs.ts +1 -0
  352. package/src/workers/queue-worker.ts +16 -5
  353. package/src/workers/worker.ts +67 -7
  354. package/dist/chunk-5a4a52tq.js.map +0 -10
  355. package/dist/chunk-5t9gm5tt.js.map +0 -22
  356. package/dist/chunk-68hm50qh.js.map +0 -13
  357. package/dist/chunk-aw1z0gre.js +0 -234
  358. package/dist/chunk-aw1z0gre.js.map +0 -12
  359. package/dist/chunk-ey1p8w68.js.map +0 -13
  360. package/dist/chunk-k3jh8gsg.js.map +0 -10
  361. package/dist/chunk-qavwr628.js.map +0 -12
  362. package/dist/chunk-s1mqyqmm.js.map +0 -18
  363. package/dist/chunk-zeykm8my.js.map +0 -14
  364. /package/dist/{chunk-stmxh0hv.js.map → chunk-3neam1y5.js.map} +0 -0
  365. /package/dist/{chunk-0mvjpgvm.js.map → chunk-425ydk65.js.map} +0 -0
  366. /package/dist/{chunk-s5pj68fa.js.map → chunk-5sswe5ej.js.map} +0 -0
  367. /package/dist/{chunk-q9nkpr8k.js.map → chunk-9tpmfh3n.js.map} +0 -0
  368. /package/dist/{chunk-naxjka9v.js.map → chunk-brhp9d97.js.map} +0 -0
  369. /package/dist/{chunk-8a8k38tz.js.map → chunk-brybqw5k.js.map} +0 -0
  370. /package/dist/{chunk-vehcr9eb.js.map → chunk-cg7cygfj.js.map} +0 -0
  371. /package/dist/{chunk-r2psmn42.js.map → chunk-eg6xqef7.js.map} +0 -0
  372. /package/dist/{chunk-zxhym8tr.js.map → chunk-f05994as.js.map} +0 -0
  373. /package/dist/{chunk-1yh6jgtz.js.map → chunk-grt2j5vp.js.map} +0 -0
  374. /package/dist/{chunk-rtdrm592.js.map → chunk-htdzx40w.js.map} +0 -0
  375. /package/dist/{chunk-bc3y6gff.js.map → chunk-jka26v8c.js.map} +0 -0
  376. /package/dist/{chunk-pqvvqc65.js.map → chunk-pqj8vff9.js.map} +0 -0
  377. /package/dist/{chunk-wqe9shx2.js.map → chunk-qbd282aa.js.map} +0 -0
  378. /package/dist/{chunk-fzae1jpq.js.map → chunk-t19wjmnc.js.map} +0 -0
  379. /package/dist/{chunk-paxabbqd.js.map → chunk-tapdssb5.js.map} +0 -0
  380. /package/dist/{chunk-dhkc9b23.js.map → chunk-v8a1qjzp.js.map} +0 -0
  381. /package/dist/{chunk-pc7kra3k.js.map → chunk-xavet0qs.js.map} +0 -0
  382. /package/dist/{chunk-0hkdtwqk.js.map → chunk-xf76csps.js.map} +0 -0
  383. /package/dist/{chunk-m9ketb51.js.map → chunk-ygvay56w.js.map} +0 -0
  384. /package/dist/{chunk-b4escq4c.js.map → chunk-ykchk644.js.map} +0 -0
  385. /package/dist/{chunk-k29n4176.js.map → chunk-ym1bqd98.js.map} +0 -0
@@ -5,13 +5,13 @@ import {
5
5
  import {
6
6
  resolveExecutionScopeAuthorization,
7
7
  assertAuthorized2
8
- } from "./chunk-paxabbqd.js";
8
+ } from "./chunk-tapdssb5.js";
9
9
  import {
10
10
  reportRunFailure2
11
11
  } from "./chunk-czct88ht.js";
12
12
  import {
13
13
  PIPELINE_RUN_FAILURE_CODES2
14
- } from "./chunk-gjhrz66x.js";
14
+ } from "./chunk-9c9yknwt.js";
15
15
  import {
16
16
  PipelineRunError2
17
17
  } from "./chunk-22d3qg4x.js";
@@ -26,7 +26,7 @@ import {
26
26
  executionRecordInputFromRuntime,
27
27
  ensureExecutionRecord2,
28
28
  createPrimitiveExecutionRecord
29
- } from "./chunk-pc7kra3k.js";
29
+ } from "./chunk-xavet0qs.js";
30
30
 
31
31
  // src/pipelines/run-dispatch.ts
32
32
  class PipelineRunDispatcher2 {
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  isPrimitiveSchema,
4
4
  primitiveTraits
5
- } from "./chunk-3zagkr6w.js";
5
+ } from "./chunk-7mhbs9yy.js";
6
6
  import {
7
7
  ShareDefinitionError2,
8
8
  snapshotShareDefinition
9
- } from "./chunk-xcrnrpfh.js";
9
+ } from "./chunk-394zjzjs.js";
10
10
  import {
11
11
  snapshotShareAccessPlan
12
12
  } from "./chunk-186k5yz3.js";
@@ -191,6 +191,7 @@ function syncLane({ projectId, storage, queues }) {
191
191
  payload: {
192
192
  syncId: run.syncId,
193
193
  runId: run.id,
194
+ ...run.connectionId === undefined ? {} : { connectionId: run.connectionId },
194
195
  status: "cancelled",
195
196
  datasetId: run.datasetId,
196
197
  error: failure
@@ -285,4 +286,4 @@ async function readCorrelationId(input, run) {
285
286
 
286
287
  export { republishLostRuns2, countLostRuns2 };
287
288
 
288
- //# debugId=8DB4B0E528A8963364756E2164756E21
289
+ //# debugId=55917A6258ABEC4264756E2164756E21
@@ -3,9 +3,9 @@
3
3
  "sources": ["../src/workers/lost-projection-runs.ts", "../src/workers/lost-runs.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { ProjectionRunDispatchPort } from \"../projections/run-dispatch\"\nimport type { ProjectionDispatchDescriptor } from \"../projections/types\"\nimport type { ListProjectionRunsInput, ProjectionRunRecord, Storage } from \"../storage\"\n\nconst PAGE_SIZE = 100\n\n/** What decides whether a projection's queued run still applies, and republishes it if so. */\nexport interface ProjectionRunRecovery {\n readonly descriptors: readonly ProjectionDispatchDescriptor[]\n readonly dispatcher: ProjectionRunDispatchPort\n}\n\ninterface LostProjectionRunsInput {\n readonly projectId: string\n readonly projectionRuns: NonNullable<Storage[\"projectionRuns\"]>\n /** Younger runs may still be in their first publication. */\n readonly queuedBefore: Date\n readonly recovery: ProjectionRunRecovery\n readonly signal?: AbortSignal\n}\n\n/**\n * Dispatches again the runs `queued` past their first publication, and those that failed with a\n * retryable enqueue error: the dispatcher republishes the same run and job, so whoever asks, it\n * is one. A run admitted under another definition revision belongs to an earlier deployment, and\n * the current revision is admitted from the lake instead. So a projection, unlike the other\n * primitives, needs the revision check its dispatcher carries to bring a queued run back.\n */\nexport async function republishQueuedProjectionRuns(\n input: LostProjectionRunsInput\n): Promise<number> {\n const { dispatcher, descriptors } = input.recovery\n const runs = await listQueuedRuns(input)\n const failures: Error[] = []\n let republished = 0\n\n for (const run of runs) {\n input.signal?.throwIfAborted()\n\n const descriptor = descriptors.find(\n (candidate) => candidate.projectionId === run.identity.projectionId\n )\n if (!descriptor || !admittedUnder(run, descriptor)) continue\n\n try {\n await dispatcher.dispatch({\n projectionId: descriptor.projectionId,\n datasetVersion: structuredClone(run.identity.datasetVersion),\n metadata: { dispatchSource: \"run-recovery\" },\n })\n republished += 1\n } catch (error) {\n failures.push(\n new Error(\n `[Sixb] Could not republish a projection run (projectionId=${descriptor.projectionId}, runId=${run.id}).`,\n { cause: error }\n )\n )\n }\n }\n\n if (failures.length > 0) {\n throw new AggregateError(failures, \"[Sixb] Could not republish every projection run.\")\n }\n\n return republished\n}\n\nasync function listQueuedRuns(\n input: LostProjectionRunsInput\n): Promise<readonly ProjectionRunRecord[]> {\n const [queued, enqueueFailed] = await Promise.all([\n listRuns(input, { statuses: [\"queued\"], startedBefore: input.queuedBefore }),\n listRuns(input, { statuses: [\"failed\"], errorCodes: [\"queue.enqueue_failed\"] }),\n ])\n\n return [...queued, ...enqueueFailed.filter((run) => run.error?.retryable)]\n}\n\nasync function listRuns(\n { projectId, projectionRuns }: LostProjectionRunsInput,\n filter: Omit<ListProjectionRunsInput, \"projectId\" | \"limit\" | \"offset\" | \"order\">\n): Promise<readonly ProjectionRunRecord[]> {\n const runs: ProjectionRunRecord[] = []\n\n for (let offset = 0; ; offset += PAGE_SIZE) {\n const page = await projectionRuns.list({\n ...filter,\n projectId,\n order: \"asc\",\n limit: PAGE_SIZE,\n offset,\n })\n\n runs.push(...page.runs)\n if (!page.hasMore) return runs\n }\n}\n\nfunction admittedUnder(\n run: ProjectionRunRecord,\n descriptor: ProjectionDispatchDescriptor\n): boolean {\n const { identity } = run\n\n return (\n identity.datasetVersion.datasetId === descriptor.datasetId &&\n identity.projectionKind === descriptor.projectionKind &&\n identity.protocol === descriptor.protocol &&\n identity.ontologyRevision === descriptor.ontologyRevision &&\n identity.projectionRevision === descriptor.projectionRevision &&\n identity.ownershipHash === descriptor.ownershipHash\n )\n}\n",
6
- "import { captureSixbFailure, withFailureMessage } from \"../errors/internal\"\nimport type { SixbFailure } from \"../errors/types\"\nimport type { DomainEventLog, EventsAppendInput } from \"../events/service\"\nimport type { Queues } from \"../queues\"\nimport type { ListLostRunsInput, Storage } from \"../storage\"\nimport {\n type ClaimableRun,\n isOrphanedRun,\n isStaleRun,\n ORPHANED_RUN_AFTER_MS,\n} from \"../storage/run-claim\"\nimport { recoverJobId } from \"./job-ids\"\nimport { type ProjectionRunRecovery, republishQueuedProjectionRuns } from \"./lost-projection-runs\"\n\n/**\n * A job may still be on its way for this long: a queued run may be in its first publication, and a\n * run handed back has its job back in the queue.\n */\nconst JOB_ON_ITS_WAY_MS = 30_000\nconst DEFAULT_LIMIT = 100\n\n/** Most runs of each primitive `countLostRuns` says it found. */\nconst COUNT_LIMIT = 1_000\n\nconst SOURCE = \"SixbRunRecovery\"\nconst LOST_WORKER = \"Its worker was lost, and it was too old or too unclear to resume.\"\n\nexport interface RepublishLostRunsInput {\n readonly projectId: string\n readonly storage: Pick<\n Storage,\n \"executions\" | \"syncRuns\" | \"pipelineRuns\" | \"workflowRuns\" | \"projectionRuns\"\n >\n readonly queues: Pick<Queues, \"syncRuns\" | \"pipelines\" | \"workflows\" | \"projections\">\n readonly events: Pick<DomainEventLog, \"emit\">\n readonly now: Date\n /** Most runs of each primitive one call looks at, longest lost first. */\n readonly limit?: number\n /** Brings back queued projection runs. Without it, only lapsed ones get a job. */\n readonly projections?: ProjectionRunRecovery\n /** Stops a backlog of queued projection runs, which no limit caps, between two of them. */\n readonly signal?: AbortSignal\n}\n\ninterface RepublishLostRunsResult {\n /** Jobs published for runs that had none. */\n readonly republished: number\n /** Runs given up on, which end `cancelled`. */\n readonly settled: number\n}\n\n/** What the next `runs` pass would do with one primitive's lost runs. */\nexport interface LostRunCount {\n readonly primitive: \"sync\" | \"pipeline\" | \"workflow\"\n /** They get a job, and run: a workflow's side effects with them. */\n readonly goOn: number\n /** They end `cancelled`. */\n readonly end: number\n}\n\ninterface LostRunCandidate extends ClaimableRun {\n readonly executionId: string\n readonly queuedAt?: Date\n}\n\ntype LostRunFailure = SixbFailure<\"runtime.cancelled\">\n\n/** What differs between the primitives this pass looks after. */\ninterface RunLane<TRun extends LostRunCandidate> {\n readonly primitive: LostRunCount[\"primitive\"]\n listLost(input: Omit<ListLostRunsInput, \"projectId\">): Promise<readonly TRun[]>\n enqueue(jobs: readonly RecoveryJob[]): Promise<unknown>\n /** End what the run left running, its steps or its nodes. */\n cancelChildren?(run: TRun, failure: LostRunFailure): Promise<void>\n cancel(run: TRun, failure: LostRunFailure): Promise<EventsAppendInput[\"events\"][number]>\n}\n\ninterface RecoveryJob {\n readonly id: string\n readonly runId: string\n}\n\n/**\n * What keeps a run from staying unfinished for good, for syncs, pipelines and workflows:\n *\n * - A queued run whose job never made it, or was lost with the queue, gets a job.\n * - A running run whose lease lapsed, which covers one handed back, gets a job.\n * - A running run with no lease, from a version that held none, is given time to end on its old\n * worker, then ends `cancelled`. A cancelled run does not count as having read its inputs, so\n * the triggers that were waiting on it fire again.\n * - A run lost for a week ends `cancelled` too, whatever it was: nothing it was asked for should\n * happen by surprise that late, least of all a workflow's side effects.\n *\n * A delivery that finds the run held or finished does nothing, so this can be wrong about a job\n * being lost without doing harm. Projections have no older version to settle, and retry without a\n * cap, so a lost one only ever gets a job (see `republishQueuedProjectionRuns`).\n */\nexport async function republishLostRuns(\n input: RepublishLostRunsInput\n): Promise<RepublishLostRunsResult> {\n const lanes = [\n recoverLane(input, syncLane(input)),\n recoverLane(input, pipelineLane(input)),\n recoverLane(input, workflowLane(input)),\n recoverProjections(input),\n ]\n\n // A lane that fails must not hold the others, and still has to reach the caller.\n const settled = await Promise.allSettled(lanes)\n\n const failed = settled.find((result) => result.status === \"rejected\")\n if (failed?.status === \"rejected\") throw failed.reason\n\n return settled.reduce<RepublishLostRunsResult>(\n (total, result) =>\n result.status === \"fulfilled\"\n ? {\n republished: total.republished + result.value.republished,\n settled: total.settled + result.value.settled,\n }\n : total,\n { republished: 0, settled: 0 }\n )\n}\n\n/** What the next pass would do, for someone about to start one. Nothing moves. */\nexport async function countLostRuns(\n input: Omit<RepublishLostRunsInput, \"limit\">\n): Promise<readonly LostRunCount[]> {\n const counts = await Promise.all([\n countLane(input, syncLane(input)),\n countLane(input, pipelineLane(input)),\n countLane(input, workflowLane(input)),\n ])\n\n return counts.filter((count) => count !== null)\n}\n\nasync function countLane<TRun extends LostRunCandidate>(\n input: Pick<RepublishLostRunsInput, \"now\">,\n lane: RunLane<TRun> | undefined\n): Promise<LostRunCount | null> {\n if (!lane) return null\n\n const lost = await listLostRuns(input, lane, COUNT_LIMIT)\n const end = lost.filter((run) => isBeyondRecovery(run, input.now)).length\n\n return { primitive: lane.primitive, goOn: lost.length - end, end }\n}\n\nfunction listLostRuns<TRun extends LostRunCandidate>(\n { now }: Pick<RepublishLostRunsInput, \"now\">,\n lane: RunLane<TRun>,\n limit: number\n): Promise<readonly TRun[]> {\n const jobOnItsWay = new Date(now.getTime() - JOB_ON_ITS_WAY_MS)\n\n return lane.listLost({\n queuedBefore: jobOnItsWay,\n lapsedBy: jobOnItsWay,\n orphanedBefore: new Date(now.getTime() - ORPHANED_RUN_AFTER_MS),\n limit,\n })\n}\n\nfunction isBeyondRecovery(run: LostRunCandidate, now: Date): boolean {\n return isOrphanedRun(run, now) || isStaleRun(run, now)\n}\n\nasync function recoverLane<TRun extends LostRunCandidate>(\n input: RepublishLostRunsInput,\n lane: RunLane<TRun> | undefined\n): Promise<RepublishLostRunsResult> {\n if (!lane) return { republished: 0, settled: 0 }\n\n const { now } = input\n const lost = await listLostRuns(input, lane, input.limit ?? DEFAULT_LIMIT)\n\n const beyondRecovery = lost.filter((run) => isBeyondRecovery(run, now))\n const failures: unknown[] = []\n\n // One run that cannot be ended must not keep the next pass from the others.\n for (const run of beyondRecovery) {\n await settleRun(input, lane, run).catch((error) => failures.push(error))\n }\n\n const jobs = lost.filter((run) => !isBeyondRecovery(run, now)).map(recoveryJob)\n\n if (jobs.length > 0) await lane.enqueue(jobs)\n if (failures.length > 0) {\n throw new AggregateError(failures, \"[Sixb] Could not end every run beyond recovery.\")\n }\n\n return { republished: jobs.length, settled: beyondRecovery.length - failures.length }\n}\n\nasync function settleRun<TRun extends LostRunCandidate>(\n input: RepublishLostRunsInput,\n lane: RunLane<TRun>,\n run: TRun\n): Promise<void> {\n const failure = lostWorkerFailure(input, run)\n\n await lane.cancelChildren?.(run, failure)\n const finished = await lane.cancel(run, failure)\n\n await input.events.emit(\n { events: [finished], correlationId: await readCorrelationId(input, run) },\n { source: SOURCE }\n )\n}\n\nasync function recoverProjections(input: RepublishLostRunsInput): Promise<RepublishLostRunsResult> {\n const { projectId, storage, queues, projections } = input\n const { projectionRuns } = storage\n if (!projectionRuns) return { republished: 0, settled: 0 }\n\n const jobOnItsWay = new Date(input.now.getTime() - JOB_ON_ITS_WAY_MS)\n\n const lapsed = await projectionRuns.listLapsed({\n projectId,\n lapsedBy: jobOnItsWay,\n limit: input.limit ?? DEFAULT_LIMIT,\n })\n\n const jobs = lapsed.map(recoveryJob)\n\n if (jobs.length > 0) {\n await queues.projections.enqueue({\n projectId,\n jobs: queueJobs(\"projection.run.requested\", jobs),\n })\n }\n\n const queued = projections\n ? await republishQueuedProjectionRuns({\n projectId,\n projectionRuns,\n queuedBefore: jobOnItsWay,\n recovery: projections,\n signal: input.signal,\n })\n : 0\n\n return { republished: jobs.length + queued, settled: 0 }\n}\n\n/**\n * A queued run's id is stable, so a job still waiting in the queue absorbs this one. A running run's\n * own job may be settled, so it gets one of its own.\n */\nfunction recoveryJob(run: LostRunCandidate): RecoveryJob {\n const id = run.status === \"queued\" ? run.id : recoverJobId(run.id, run.attempt)\n\n return { id, runId: run.id }\n}\n\nfunction queueJobs<TType extends string>(type: TType, jobs: readonly RecoveryJob[]) {\n return jobs.map(({ id, runId }) => ({ id, type, payload: { runId } }))\n}\n\ntype LaneInput = Pick<RepublishLostRunsInput, \"projectId\" | \"storage\" | \"queues\" | \"now\">\n\nfunction syncLane({ projectId, storage, queues }: LaneInput) {\n const runs = storage.syncRuns\n if (!runs) return undefined\n\n return {\n primitive: \"sync\",\n listLost: (filter) => runs.listLost({ ...filter, projectId }),\n\n enqueue: (jobs) =>\n queues.syncRuns.enqueue({ projectId, jobs: queueJobs(\"sync.run.requested\", jobs) }),\n\n async cancel(run, failure) {\n await runs.finish({ projectId, id: run.id, status: \"cancelled\", error: failure })\n\n return {\n type: \"sync.run.finished\",\n payload: {\n syncId: run.syncId,\n runId: run.id,\n status: \"cancelled\",\n datasetId: run.datasetId,\n error: failure,\n },\n }\n },\n } satisfies RunLane<NonNullable<Awaited<ReturnType<typeof runs.getById>>>>\n}\n\nfunction pipelineLane({ projectId, storage, queues }: LaneInput) {\n const runs = storage.pipelineRuns\n if (!runs) return undefined\n\n return {\n primitive: \"pipeline\",\n listLost: (filter) => runs.listLost({ ...filter, projectId }),\n\n enqueue: (jobs) =>\n queues.pipelines.enqueue({ projectId, jobs: queueJobs(\"pipeline.run.requested\", jobs) }),\n\n async cancelChildren(run, failure) {\n const { steps } = await runs.listSteps({\n projectId,\n pipelineRunId: run.id,\n statuses: [\"running\"],\n })\n\n for (const step of steps) {\n await runs.finishStep({ projectId, id: step.id, status: \"cancelled\", error: failure })\n }\n },\n\n async cancel(run, failure) {\n await runs.finish({ projectId, id: run.id, status: \"cancelled\", error: failure })\n\n return {\n type: \"pipeline.run.finished\",\n payload: {\n pipelineId: run.pipelineId,\n runId: run.id,\n status: \"cancelled\",\n error: failure,\n },\n }\n },\n } satisfies RunLane<NonNullable<Awaited<ReturnType<typeof runs.getById>>>>\n}\n\nfunction workflowLane({ projectId, storage, queues, now }: LaneInput) {\n const runs = storage.workflowRuns\n if (!runs) return undefined\n\n return {\n primitive: \"workflow\",\n listLost: (filter) => runs.listLost({ ...filter, projectId }),\n\n enqueue: (jobs) =>\n queues.workflows.enqueue({ projectId, jobs: queueJobs(\"workflow.run.requested\", jobs) }),\n\n async cancelChildren(run, failure) {\n const { nodes } = await runs.nodes.list({\n projectId,\n workflowRunId: run.id,\n statuses: [\"running\"],\n })\n\n for (const node of nodes) {\n await runs.nodes.finish({ projectId, id: node.id, status: \"cancelled\", error: failure })\n }\n },\n\n async cancel(run, failure) {\n const finished = await runs.finish({\n projectId,\n id: run.id,\n status: \"cancelled\",\n error: failure,\n })\n\n return {\n type: \"workflow.run.finished\",\n payload: {\n workflowId: run.workflowId,\n runId: run.id,\n status: \"cancelled\",\n finishedAt: (finished.finishedAt ?? now).toISOString(),\n error: failure,\n },\n }\n },\n } satisfies RunLane<NonNullable<Awaited<ReturnType<typeof runs.getById>>>>\n}\n\nfunction lostWorkerFailure(input: RepublishLostRunsInput, run: LostRunCandidate): LostRunFailure {\n const lost = withFailureMessage(new Error(`[Sixb] Run '${run.id}' lost its worker.`), LOST_WORKER)\n\n return captureSixbFailure(lost, {\n allowedCodes: [\"runtime.cancelled\"],\n defaultCode: \"runtime.cancelled\",\n details: { runId: run.id },\n at: input.now,\n })\n}\n\n/** Its execution ties its events together. A run may have lost even that: its id then does. */\nasync function readCorrelationId(\n input: RepublishLostRunsInput,\n run: LostRunCandidate\n): Promise<string> {\n const execution = await input.storage.executions\n .getById({ projectId: input.projectId, id: run.executionId })\n .catch(() => null)\n\n return execution?.correlationId ?? run.id\n}\n"
6
+ "import { captureSixbFailure, withFailureMessage } from \"../errors/internal\"\nimport type { SixbFailure } from \"../errors/types\"\nimport type { DomainEventLog, EventsAppendInput } from \"../events/service\"\nimport type { Queues } from \"../queues\"\nimport type { ListLostRunsInput, Storage } from \"../storage\"\nimport {\n type ClaimableRun,\n isOrphanedRun,\n isStaleRun,\n ORPHANED_RUN_AFTER_MS,\n} from \"../storage/run-claim\"\nimport { recoverJobId } from \"./job-ids\"\nimport { type ProjectionRunRecovery, republishQueuedProjectionRuns } from \"./lost-projection-runs\"\n\n/**\n * A job may still be on its way for this long: a queued run may be in its first publication, and a\n * run handed back has its job back in the queue.\n */\nconst JOB_ON_ITS_WAY_MS = 30_000\nconst DEFAULT_LIMIT = 100\n\n/** Most runs of each primitive `countLostRuns` says it found. */\nconst COUNT_LIMIT = 1_000\n\nconst SOURCE = \"SixbRunRecovery\"\nconst LOST_WORKER = \"Its worker was lost, and it was too old or too unclear to resume.\"\n\nexport interface RepublishLostRunsInput {\n readonly projectId: string\n readonly storage: Pick<\n Storage,\n \"executions\" | \"syncRuns\" | \"pipelineRuns\" | \"workflowRuns\" | \"projectionRuns\"\n >\n readonly queues: Pick<Queues, \"syncRuns\" | \"pipelines\" | \"workflows\" | \"projections\">\n readonly events: Pick<DomainEventLog, \"emit\">\n readonly now: Date\n /** Most runs of each primitive one call looks at, longest lost first. */\n readonly limit?: number\n /** Brings back queued projection runs. Without it, only lapsed ones get a job. */\n readonly projections?: ProjectionRunRecovery\n /** Stops a backlog of queued projection runs, which no limit caps, between two of them. */\n readonly signal?: AbortSignal\n}\n\ninterface RepublishLostRunsResult {\n /** Jobs published for runs that had none. */\n readonly republished: number\n /** Runs given up on, which end `cancelled`. */\n readonly settled: number\n}\n\n/** What the next `runs` pass would do with one primitive's lost runs. */\nexport interface LostRunCount {\n readonly primitive: \"sync\" | \"pipeline\" | \"workflow\"\n /** They get a job, and run: a workflow's side effects with them. */\n readonly goOn: number\n /** They end `cancelled`. */\n readonly end: number\n}\n\ninterface LostRunCandidate extends ClaimableRun {\n readonly executionId: string\n readonly queuedAt?: Date\n}\n\ntype LostRunFailure = SixbFailure<\"runtime.cancelled\">\n\n/** What differs between the primitives this pass looks after. */\ninterface RunLane<TRun extends LostRunCandidate> {\n readonly primitive: LostRunCount[\"primitive\"]\n listLost(input: Omit<ListLostRunsInput, \"projectId\">): Promise<readonly TRun[]>\n enqueue(jobs: readonly RecoveryJob[]): Promise<unknown>\n /** End what the run left running, its steps or its nodes. */\n cancelChildren?(run: TRun, failure: LostRunFailure): Promise<void>\n cancel(run: TRun, failure: LostRunFailure): Promise<EventsAppendInput[\"events\"][number]>\n}\n\ninterface RecoveryJob {\n readonly id: string\n readonly runId: string\n}\n\n/**\n * What keeps a run from staying unfinished for good, for syncs, pipelines and workflows:\n *\n * - A queued run whose job never made it, or was lost with the queue, gets a job.\n * - A running run whose lease lapsed, which covers one handed back, gets a job.\n * - A running run with no lease, from a version that held none, is given time to end on its old\n * worker, then ends `cancelled`. A cancelled run does not count as having read its inputs, so\n * the triggers that were waiting on it fire again.\n * - A run lost for a week ends `cancelled` too, whatever it was: nothing it was asked for should\n * happen by surprise that late, least of all a workflow's side effects.\n *\n * A delivery that finds the run held or finished does nothing, so this can be wrong about a job\n * being lost without doing harm. Projections have no older version to settle, and retry without a\n * cap, so a lost one only ever gets a job (see `republishQueuedProjectionRuns`).\n */\nexport async function republishLostRuns(\n input: RepublishLostRunsInput\n): Promise<RepublishLostRunsResult> {\n const lanes = [\n recoverLane(input, syncLane(input)),\n recoverLane(input, pipelineLane(input)),\n recoverLane(input, workflowLane(input)),\n recoverProjections(input),\n ]\n\n // A lane that fails must not hold the others, and still has to reach the caller.\n const settled = await Promise.allSettled(lanes)\n\n const failed = settled.find((result) => result.status === \"rejected\")\n if (failed?.status === \"rejected\") throw failed.reason\n\n return settled.reduce<RepublishLostRunsResult>(\n (total, result) =>\n result.status === \"fulfilled\"\n ? {\n republished: total.republished + result.value.republished,\n settled: total.settled + result.value.settled,\n }\n : total,\n { republished: 0, settled: 0 }\n )\n}\n\n/** What the next pass would do, for someone about to start one. Nothing moves. */\nexport async function countLostRuns(\n input: Omit<RepublishLostRunsInput, \"limit\">\n): Promise<readonly LostRunCount[]> {\n const counts = await Promise.all([\n countLane(input, syncLane(input)),\n countLane(input, pipelineLane(input)),\n countLane(input, workflowLane(input)),\n ])\n\n return counts.filter((count) => count !== null)\n}\n\nasync function countLane<TRun extends LostRunCandidate>(\n input: Pick<RepublishLostRunsInput, \"now\">,\n lane: RunLane<TRun> | undefined\n): Promise<LostRunCount | null> {\n if (!lane) return null\n\n const lost = await listLostRuns(input, lane, COUNT_LIMIT)\n const end = lost.filter((run) => isBeyondRecovery(run, input.now)).length\n\n return { primitive: lane.primitive, goOn: lost.length - end, end }\n}\n\nfunction listLostRuns<TRun extends LostRunCandidate>(\n { now }: Pick<RepublishLostRunsInput, \"now\">,\n lane: RunLane<TRun>,\n limit: number\n): Promise<readonly TRun[]> {\n const jobOnItsWay = new Date(now.getTime() - JOB_ON_ITS_WAY_MS)\n\n return lane.listLost({\n queuedBefore: jobOnItsWay,\n lapsedBy: jobOnItsWay,\n orphanedBefore: new Date(now.getTime() - ORPHANED_RUN_AFTER_MS),\n limit,\n })\n}\n\nfunction isBeyondRecovery(run: LostRunCandidate, now: Date): boolean {\n return isOrphanedRun(run, now) || isStaleRun(run, now)\n}\n\nasync function recoverLane<TRun extends LostRunCandidate>(\n input: RepublishLostRunsInput,\n lane: RunLane<TRun> | undefined\n): Promise<RepublishLostRunsResult> {\n if (!lane) return { republished: 0, settled: 0 }\n\n const { now } = input\n const lost = await listLostRuns(input, lane, input.limit ?? DEFAULT_LIMIT)\n\n const beyondRecovery = lost.filter((run) => isBeyondRecovery(run, now))\n const failures: unknown[] = []\n\n // One run that cannot be ended must not keep the next pass from the others.\n for (const run of beyondRecovery) {\n await settleRun(input, lane, run).catch((error) => failures.push(error))\n }\n\n const jobs = lost.filter((run) => !isBeyondRecovery(run, now)).map(recoveryJob)\n\n if (jobs.length > 0) await lane.enqueue(jobs)\n if (failures.length > 0) {\n throw new AggregateError(failures, \"[Sixb] Could not end every run beyond recovery.\")\n }\n\n return { republished: jobs.length, settled: beyondRecovery.length - failures.length }\n}\n\nasync function settleRun<TRun extends LostRunCandidate>(\n input: RepublishLostRunsInput,\n lane: RunLane<TRun>,\n run: TRun\n): Promise<void> {\n const failure = lostWorkerFailure(input, run)\n\n await lane.cancelChildren?.(run, failure)\n const finished = await lane.cancel(run, failure)\n\n await input.events.emit(\n { events: [finished], correlationId: await readCorrelationId(input, run) },\n { source: SOURCE }\n )\n}\n\nasync function recoverProjections(input: RepublishLostRunsInput): Promise<RepublishLostRunsResult> {\n const { projectId, storage, queues, projections } = input\n const { projectionRuns } = storage\n if (!projectionRuns) return { republished: 0, settled: 0 }\n\n const jobOnItsWay = new Date(input.now.getTime() - JOB_ON_ITS_WAY_MS)\n\n const lapsed = await projectionRuns.listLapsed({\n projectId,\n lapsedBy: jobOnItsWay,\n limit: input.limit ?? DEFAULT_LIMIT,\n })\n\n const jobs = lapsed.map(recoveryJob)\n\n if (jobs.length > 0) {\n await queues.projections.enqueue({\n projectId,\n jobs: queueJobs(\"projection.run.requested\", jobs),\n })\n }\n\n const queued = projections\n ? await republishQueuedProjectionRuns({\n projectId,\n projectionRuns,\n queuedBefore: jobOnItsWay,\n recovery: projections,\n signal: input.signal,\n })\n : 0\n\n return { republished: jobs.length + queued, settled: 0 }\n}\n\n/**\n * A queued run's id is stable, so a job still waiting in the queue absorbs this one. A running run's\n * own job may be settled, so it gets one of its own.\n */\nfunction recoveryJob(run: LostRunCandidate): RecoveryJob {\n const id = run.status === \"queued\" ? run.id : recoverJobId(run.id, run.attempt)\n\n return { id, runId: run.id }\n}\n\nfunction queueJobs<TType extends string>(type: TType, jobs: readonly RecoveryJob[]) {\n return jobs.map(({ id, runId }) => ({ id, type, payload: { runId } }))\n}\n\ntype LaneInput = Pick<RepublishLostRunsInput, \"projectId\" | \"storage\" | \"queues\" | \"now\">\n\nfunction syncLane({ projectId, storage, queues }: LaneInput) {\n const runs = storage.syncRuns\n if (!runs) return undefined\n\n return {\n primitive: \"sync\",\n listLost: (filter) => runs.listLost({ ...filter, projectId }),\n\n enqueue: (jobs) =>\n queues.syncRuns.enqueue({ projectId, jobs: queueJobs(\"sync.run.requested\", jobs) }),\n\n async cancel(run, failure) {\n await runs.finish({ projectId, id: run.id, status: \"cancelled\", error: failure })\n\n return {\n type: \"sync.run.finished\",\n payload: {\n syncId: run.syncId,\n runId: run.id,\n ...(run.connectionId === undefined ? {} : { connectionId: run.connectionId }),\n status: \"cancelled\",\n datasetId: run.datasetId,\n error: failure,\n },\n }\n },\n } satisfies RunLane<NonNullable<Awaited<ReturnType<typeof runs.getById>>>>\n}\n\nfunction pipelineLane({ projectId, storage, queues }: LaneInput) {\n const runs = storage.pipelineRuns\n if (!runs) return undefined\n\n return {\n primitive: \"pipeline\",\n listLost: (filter) => runs.listLost({ ...filter, projectId }),\n\n enqueue: (jobs) =>\n queues.pipelines.enqueue({ projectId, jobs: queueJobs(\"pipeline.run.requested\", jobs) }),\n\n async cancelChildren(run, failure) {\n const { steps } = await runs.listSteps({\n projectId,\n pipelineRunId: run.id,\n statuses: [\"running\"],\n })\n\n for (const step of steps) {\n await runs.finishStep({ projectId, id: step.id, status: \"cancelled\", error: failure })\n }\n },\n\n async cancel(run, failure) {\n await runs.finish({ projectId, id: run.id, status: \"cancelled\", error: failure })\n\n return {\n type: \"pipeline.run.finished\",\n payload: {\n pipelineId: run.pipelineId,\n runId: run.id,\n status: \"cancelled\",\n error: failure,\n },\n }\n },\n } satisfies RunLane<NonNullable<Awaited<ReturnType<typeof runs.getById>>>>\n}\n\nfunction workflowLane({ projectId, storage, queues, now }: LaneInput) {\n const runs = storage.workflowRuns\n if (!runs) return undefined\n\n return {\n primitive: \"workflow\",\n listLost: (filter) => runs.listLost({ ...filter, projectId }),\n\n enqueue: (jobs) =>\n queues.workflows.enqueue({ projectId, jobs: queueJobs(\"workflow.run.requested\", jobs) }),\n\n async cancelChildren(run, failure) {\n const { nodes } = await runs.nodes.list({\n projectId,\n workflowRunId: run.id,\n statuses: [\"running\"],\n })\n\n for (const node of nodes) {\n await runs.nodes.finish({ projectId, id: node.id, status: \"cancelled\", error: failure })\n }\n },\n\n async cancel(run, failure) {\n const finished = await runs.finish({\n projectId,\n id: run.id,\n status: \"cancelled\",\n error: failure,\n })\n\n return {\n type: \"workflow.run.finished\",\n payload: {\n workflowId: run.workflowId,\n runId: run.id,\n status: \"cancelled\",\n finishedAt: (finished.finishedAt ?? now).toISOString(),\n error: failure,\n },\n }\n },\n } satisfies RunLane<NonNullable<Awaited<ReturnType<typeof runs.getById>>>>\n}\n\nfunction lostWorkerFailure(input: RepublishLostRunsInput, run: LostRunCandidate): LostRunFailure {\n const lost = withFailureMessage(new Error(`[Sixb] Run '${run.id}' lost its worker.`), LOST_WORKER)\n\n return captureSixbFailure(lost, {\n allowedCodes: [\"runtime.cancelled\"],\n defaultCode: \"runtime.cancelled\",\n details: { runId: run.id },\n at: input.now,\n })\n}\n\n/** Its execution ties its events together. A run may have lost even that: its id then does. */\nasync function readCorrelationId(\n input: RepublishLostRunsInput,\n run: LostRunCandidate\n): Promise<string> {\n const execution = await input.storage.executions\n .getById({ projectId: input.projectId, id: run.executionId })\n .catch(() => null)\n\n return execution?.correlationId ?? run.id\n}\n"
7
7
  ],
8
- "mappings": ";;;;;;;;;;;;;;;;;AAIA,IAAM,YAAY;AAwBX,eAAe,6BAA6B,CACjD,OACiB;AAAA,EACjB,QAAQ,YAAY,gBAAgB,MAAM;AAAA,EAC1C,MAAM,OAAO,MAAM,eAAe,KAAK;AAAA,EACvC,MAAM,WAAoB,CAAC;AAAA,EAC3B,IAAI,cAAc;AAAA,EAElB,WAAW,OAAO,MAAM;AAAA,IACtB,MAAM,QAAQ,eAAe;AAAA,IAE7B,MAAM,aAAa,YAAY,KAC7B,CAAC,cAAc,UAAU,iBAAiB,IAAI,SAAS,YACzD;AAAA,IACA,IAAI,CAAC,cAAc,CAAC,cAAc,KAAK,UAAU;AAAA,MAAG;AAAA,IAEpD,IAAI;AAAA,MACF,MAAM,WAAW,SAAS;AAAA,QACxB,cAAc,WAAW;AAAA,QACzB,gBAAgB,gBAAgB,IAAI,SAAS,cAAc;AAAA,QAC3D,UAAU,EAAE,gBAAgB,eAAe;AAAA,MAC7C,CAAC;AAAA,MACD,eAAe;AAAA,MACf,OAAO,OAAO;AAAA,MACd,SAAS,KACP,IAAI,MACF,6DAA6D,WAAW,uBAAuB,IAAI,QACnG,EAAE,OAAO,MAAM,CACjB,CACF;AAAA;AAAA,EAEJ;AAAA,EAEA,IAAI,SAAS,SAAS,GAAG;AAAA,IACvB,MAAM,IAAI,eAAe,UAAU,kDAAkD;AAAA,EACvF;AAAA,EAEA,OAAO;AAAA;AAGT,eAAe,cAAc,CAC3B,OACyC;AAAA,EACzC,OAAO,QAAQ,iBAAiB,MAAM,QAAQ,IAAI;AAAA,IAChD,SAAS,OAAO,EAAE,UAAU,CAAC,QAAQ,GAAG,eAAe,MAAM,aAAa,CAAC;AAAA,IAC3E,SAAS,OAAO,EAAE,UAAU,CAAC,QAAQ,GAAG,YA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A,UACP,YAAY,IAAI;AAAA,UAChB,OAAO,IAAI;AAAA,UACX,QAAQ;AAAA,UACR,aAAa,SAAS,cAAc,KAAK,YAAY;AAAA,UACrD,OAAO;AAAA,QACT;AAAA,MACF;AAAA;AAAA,EAEJ;AAAA;AAGF,SAAS,iBAAiB,CAAC,OAA+B,KAAuC;AAAA,EAC/F,MAAM,OAAO,oBAAmB,IAAI,MAAM,eAAe,IAAI,sBAAsB,GAAG,WAAW;AAAA,EAEjG,OAAO,oBAAmB,MAAM;AAAA,IAC9B,cAAc,CAAC,mBAAmB;AAAA,IAClC,aAAa;AAAA,IACb,SAAS,EAAE,OAAO,IAAI,GAAG;AAAA,IACzB,IAAI,MAAM;AAAA,EACZ,CAAC;AAAA;AAIH,eAAe,iBAAiB,CAC9B,OACA,KACiB;AAAA,EACjB,MAAM,YAAY,MAAM,MAAM,QAAQ,WACnC,QAAQ,EAAE,WAAW,MAAM,WAAW,IAAI,IAAI,YAAY,CAAC,EAC3D,MAAM,MAAM,IAAI;AAAA,EAEnB,OAAO,WAAW,iBAAiB,IAAI;AAAA;",
9
+ "debugId": "55917A6258ABEC4264756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -4,12 +4,12 @@ import {
4
4
  } from "./chunk-wkv3h3q7.js";
5
5
  import {
6
6
  OntologyRegistry2
7
- } from "./chunk-dhkc9b23.js";
7
+ } from "./chunk-v8a1qjzp.js";
8
8
  import {
9
9
  assertViewConditionsReadable,
10
10
  SecurityRegistry,
11
11
  AuthRuntime2
12
- } from "./chunk-xcrnrpfh.js";
12
+ } from "./chunk-394zjzjs.js";
13
13
  import {
14
14
  captureSixbFailure2,
15
15
  isSixbError2
@@ -18,7 +18,7 @@ import {
18
18
  captureExecutionScope,
19
19
  resolveExecutionScopeAuthorization,
20
20
  AuthorizationError2
21
- } from "./chunk-paxabbqd.js";
21
+ } from "./chunk-tapdssb5.js";
22
22
  import {
23
23
  AuthRuntimeError2,
24
24
  isMagicLinkAuthStrategy2,
@@ -38,9 +38,15 @@ import {
38
38
  createModelCatalog2,
39
39
  estimateModelCall
40
40
  } from "./chunk-qttqe1ah.js";
41
+ import {
42
+ DEFAULT_PROJECT_LOCALE,
43
+ DEFAULT_PROJECT_TIME_ZONE,
44
+ canonicalLocale,
45
+ canonicalTimeZone2
46
+ } from "./chunk-dq3t5sr3.js";
41
47
  import {
42
48
  FileUploadSessionError2
43
- } from "./chunk-vehcr9eb.js";
49
+ } from "./chunk-cg7cygfj.js";
44
50
  import {
45
51
  ACTIVITY_VISIT_ID_PATTERN2,
46
52
  ACTIVITY_ID_MAX_LENGTH2,
@@ -48,30 +54,26 @@ import {
48
54
  ACTIVITY_MAX_PAGE_SIZE2,
49
55
  ACTIVITY_MIN_IDLE_TIMEOUT_MS,
50
56
  validateActivityEvents
51
- } from "./chunk-ewqn51gr.js";
57
+ } from "./chunk-88xeh6zx.js";
52
58
  import {
53
59
  isMigrationCapableStorage2,
54
60
  checkStorageSchema2
55
- } from "./chunk-gjhrz66x.js";
61
+ } from "./chunk-9c9yknwt.js";
56
62
  import {
57
63
  createAuthorizedObjectReader
58
- } from "./chunk-5t9gm5tt.js";
64
+ } from "./chunk-fmgf9h5e.js";
59
65
  import {
60
66
  ActionRegistry2,
61
67
  createAgentApprovalExecutor,
62
68
  registerAgentApprovalExecutor,
63
69
  assertTurnModelRouting,
64
- DEFAULT_PROJECT_LOCALE,
65
- DEFAULT_PROJECT_TIME_ZONE,
66
- canonicalLocale,
67
- canonicalTimeZone,
68
70
  assertNoAgentDefinitions,
69
71
  validateWorkflowsAtStartup2,
70
72
  validateWorkflowAgentStepGroupReferences2,
71
73
  createBoundSixb,
72
74
  ActionRunExecutor,
73
75
  registerActionRunExecutor
74
- } from "./chunk-z1njfqqs.js";
76
+ } from "./chunk-ats8y3d9.js";
75
77
  import {
76
78
  attachSixbErrorReporter2,
77
79
  shareSixbErrorReporter2
@@ -81,10 +83,11 @@ import {
81
83
  createOntologyMutationRuntime2,
82
84
  decodeActivityConnectionsCursor,
83
85
  ModelExecutionSession
84
- } from "./chunk-k29n4176.js";
86
+ } from "./chunk-ym1bqd98.js";
85
87
  import {
86
- registerConnectorConnectionCallbackProcess
87
- } from "./chunk-5a4a52tq.js";
88
+ registerConnectorConnectionCallbackProcess,
89
+ registerSandboxConnectionTokenAccess2
90
+ } from "./chunk-0pmpwn3g.js";
88
91
  import {
89
92
  ConnectorError2,
90
93
  ConnectorNotFoundError2,
@@ -95,8 +98,9 @@ import {
95
98
  providerBoundaryError,
96
99
  isConnectorStorageError,
97
100
  storageBoundaryError,
98
- recoverConnectorFailure
99
- } from "./chunk-qavwr628.js";
101
+ recoverConnectorFailure,
102
+ assertPersonalConnectionRequester
103
+ } from "./chunk-n1hbwc6y.js";
100
104
  import {
101
105
  assertDatasetDefinition2,
102
106
  isDatasetPick2
@@ -104,7 +108,12 @@ import {
104
108
  import {
105
109
  ProjectionRegistry2,
106
110
  createOntologyMaterializer2
107
- } from "./chunk-b4escq4c.js";
111
+ } from "./chunk-ykchk644.js";
112
+ import {
113
+ registerSyncConnections,
114
+ createSyncConnections,
115
+ SyncValidationError2
116
+ } from "./chunk-90nqenq8.js";
108
117
  import {
109
118
  LoggingService2
110
119
  } from "./chunk-1vg43g9q.js";
@@ -121,7 +130,7 @@ import {
121
130
  assertNoProviderWebTools,
122
131
  toolsFromProjectConfig,
123
132
  assertMaxSteps
124
- } from "./chunk-fpf57gca.js";
133
+ } from "./chunk-7r9mqpva.js";
125
134
  import {
126
135
  discoverOntologyFiles,
127
136
  discoverAgentSkills,
@@ -130,7 +139,7 @@ import {
130
139
  validateSharesAtStartup,
131
140
  discoverOntologySources,
132
141
  discoverProjectDefinitions2
133
- } from "./chunk-fzae1jpq.js";
142
+ } from "./chunk-t19wjmnc.js";
134
143
  import {
135
144
  createDatasetIngestRuntime,
136
145
  registerDatasetIngestRuntime,
@@ -143,10 +152,10 @@ import {
143
152
  createVectorIndexingRuntime,
144
153
  registerVectorIndexingRuntime,
145
154
  getApiPublicOrigin
146
- } from "./chunk-0hkdtwqk.js";
155
+ } from "./chunk-xf76csps.js";
147
156
  import {
148
157
  registerProjectionRegistry2
149
- } from "./chunk-naxjka9v.js";
158
+ } from "./chunk-brhp9d97.js";
150
159
  import {
151
160
  registeredSteps,
152
161
  runStepLineages,
@@ -168,17 +177,14 @@ import {
168
177
  everyMs,
169
178
  MaintenanceLoop
170
179
  } from "./chunk-j0wgh8gv.js";
171
- import {
172
- SyncValidationError2
173
- } from "./chunk-aw1z0gre.js";
174
180
  import {
175
181
  SandboxError2,
176
182
  createSandboxDefinition,
177
183
  sandboxCredentialIssue2
178
- } from "./chunk-rtdrm592.js";
184
+ } from "./chunk-htdzx40w.js";
179
185
  import {
180
186
  ensureExecutionRecord2
181
- } from "./chunk-pc7kra3k.js";
187
+ } from "./chunk-xavet0qs.js";
182
188
  import {
183
189
  PendingTasks,
184
190
  reportEventDeliveryFailure3,
@@ -2686,6 +2692,32 @@ class ConnectorConnectionService {
2686
2692
  });
2687
2693
  }
2688
2694
  async connectConnection(definition, selector) {
2695
+ const readable = await this.requireReadableConnection(definition, selector);
2696
+ return this.connectExecutionConnection(definition, readable);
2697
+ }
2698
+ createConnectionTokenSource(definition, selector) {
2699
+ this.assertOAuthRegistered(definition);
2700
+ assertConnectorConnectionSelector(selector);
2701
+ let current;
2702
+ return Object.freeze({
2703
+ get: async () => {
2704
+ const readable = await this.requireReadableConnection(definition, selector);
2705
+ if (readable.projectId !== this.projectId || readable.connectorId !== definition.id || readable.status !== "connected") {
2706
+ throw createConnectorCodedError("connector.not_found", `Connector '${definition.id}' connection '${readable.id}' is not active in this project.`);
2707
+ }
2708
+ const authorization = await this.authorizations.requireStableActiveAuthorization(definition, readable.authorizationId);
2709
+ if (current?.authorizationId !== authorization.id || current.accountId !== readable.account.id) {
2710
+ current = {
2711
+ authorizationId: authorization.id,
2712
+ accountId: readable.account.id,
2713
+ source: this.authorizations.createTokenSource(definition, authorization.id, readable.account)
2714
+ };
2715
+ }
2716
+ return current.source.get();
2717
+ }
2718
+ });
2719
+ }
2720
+ async requireReadableConnection(definition, selector) {
2689
2721
  this.assertOAuthRegistered(definition);
2690
2722
  assertConnectorConnectionSelector(selector);
2691
2723
  const connection = await withConnectorStorageBoundary("Connector connection could not be read.", () => this.connectionStorage.getConnection({
@@ -2700,17 +2732,20 @@ class ConnectorConnectionService {
2700
2732
  if (!readable) {
2701
2733
  throw createConnectorCodedError("connector.not_found", `Connector '${definition.id}' does not open the connections of a suspended member.`);
2702
2734
  }
2703
- return this.connectExecutionConnection(definition, readable);
2735
+ return readable;
2704
2736
  }
2705
2737
  async listExecutionConnections(definition) {
2738
+ const connections = await this.listAllConnections(definition);
2739
+ const connected = connections.filter((connection) => connection.status === "connected");
2740
+ return this.withoutSuspendedOwners(connected);
2741
+ }
2742
+ async listAllConnections(definition) {
2706
2743
  this.assertOAuthRegistered(definition);
2707
2744
  const connections = await withConnectorStorageBoundary("Connector connections could not be listed.", () => this.connectionStorage.listConnections({
2708
2745
  projectId: this.projectId,
2709
2746
  connectorId: definition.id
2710
2747
  }));
2711
- const connected = connections.filter((connection) => connection.status === "connected");
2712
- const readable = await this.withoutSuspendedOwners(connected);
2713
- return [...readable].sort((left, right) => left.id.localeCompare(right.id));
2748
+ return [...connections].sort((left, right) => left.id.localeCompare(right.id));
2714
2749
  }
2715
2750
  async revokeUserConnections(userId) {
2716
2751
  const principal = { type: "user", id: nonblank(userId, "user id") };
@@ -3105,9 +3140,19 @@ class ConnectorService {
3105
3140
  connectConnection(definition, selector) {
3106
3141
  return this.requireConnections().connectConnection(definition, selector);
3107
3142
  }
3143
+ createConnectionTokenSource(connector, selector) {
3144
+ const definition = connector;
3145
+ if (!isOAuthConnectorDefinition2(definition)) {
3146
+ throw createConnectorCodedError("connector.configuration_invalid", `[Sixb] Connector '${connector.id}' does not use persistent OAuth connections.`);
3147
+ }
3148
+ return this.requireConnections().createConnectionTokenSource(definition, selector);
3149
+ }
3108
3150
  listExecutionConnections(definition) {
3109
3151
  return this.requireConnections().listExecutionConnections(definition);
3110
3152
  }
3153
+ listAllConnections(definition) {
3154
+ return this.requireConnections().listAllConnections(definition);
3155
+ }
3111
3156
  async revokeUserConnections(userId) {
3112
3157
  await this.connections?.revokeUserConnections(userId);
3113
3158
  }
@@ -4588,7 +4633,12 @@ class SixbHost2 {
4588
4633
  });
4589
4634
  if (this.connectorService.connectionProcess) {
4590
4635
  registerConnectorConnectionCallbackProcess(this, this.connectorService.connectionProcess.callbackProcess);
4636
+ registerSyncConnections(this, createSyncConnections(this.connectorService));
4591
4637
  }
4638
+ registerSandboxConnectionTokenAccess2(this, ({ connector, selector, requestedBy }) => {
4639
+ assertPersonalConnectionRequester(connector, requestedBy, selector);
4640
+ return this.connectorService.createConnectionTokenSource(connector, selector);
4641
+ });
4592
4642
  assertWebhookRunStorage(connectors, this.storage);
4593
4643
  this.webhookRegistry = new WebhookRegistry({ connectors });
4594
4644
  this.materializer = createOntologyMaterializer2({
@@ -4829,7 +4879,7 @@ function resolveProjectLocale(locale) {
4829
4879
  function resolveProjectTimeZone(timeZone) {
4830
4880
  if (timeZone === undefined)
4831
4881
  return DEFAULT_PROJECT_TIME_ZONE;
4832
- const canonical = canonicalTimeZone(timeZone);
4882
+ const canonical = canonicalTimeZone2(timeZone);
4833
4883
  if (canonical === undefined) {
4834
4884
  throw new RuntimeError2(`[Sixb] 'timeZone' must be an IANA time zone such as "Europe/Paris"; received ${JSON.stringify(timeZone)}.`);
4835
4885
  }
@@ -4979,4 +5029,4 @@ async function createSixb2(options) {
4979
5029
  }
4980
5030
  export { WebhookValidationError2, defineWebhook2, webhookConnector2, UnverifiedWebhookError2, resolveWebhookVerification2, warnUnverifiedWebhook2, SixbHost2, createSixb2 };
4981
5031
 
4982
- //# debugId=7BD9042F9389B41D64756E2164756E21
5032
+ //# debugId=6A58420C6215A8CE64756E2164756E21