@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
@@ -23,6 +23,7 @@ import type {
23
23
  ConnectorClient,
24
24
  ConnectorConnectionSelector,
25
25
  ConnectorDefinition,
26
+ ConnectorTokenSource,
26
27
  OAuthConnectorAdapter,
27
28
  } from "../types"
28
29
  import {
@@ -172,6 +173,68 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
172
173
  definition: ConnectorDefinition<string, TAdapter>,
173
174
  selector: ConnectorConnectionSelector
174
175
  ): Promise<ConnectorClient<TAdapter>> {
176
+ const readable = await this.requireReadableConnection(definition, selector)
177
+ return this.connectExecutionConnection(definition, readable)
178
+ }
179
+
180
+ /**
181
+ * Live token source for one connected account, re-checking connection status and member
182
+ * suspension on each read while keeping revision invalidation across calls.
183
+ */
184
+ createConnectionTokenSource<TAdapter extends OAuthConnectorAdapter>(
185
+ definition: ConnectorDefinition<string, TAdapter>,
186
+ selector: ConnectorConnectionSelector
187
+ ): ConnectorTokenSource {
188
+ this.assertOAuthRegistered(definition)
189
+ assertConnectorConnectionSelector(selector)
190
+ let current:
191
+ | {
192
+ readonly authorizationId: string
193
+ readonly accountId: string
194
+ readonly source: ConnectorTokenSource
195
+ }
196
+ | undefined
197
+
198
+ return Object.freeze({
199
+ get: async () => {
200
+ const readable = await this.requireReadableConnection(definition, selector)
201
+ if (
202
+ readable.projectId !== this.projectId ||
203
+ readable.connectorId !== definition.id ||
204
+ readable.status !== "connected"
205
+ ) {
206
+ throw createConnectorCodedError(
207
+ "connector.not_found",
208
+ `Connector '${definition.id}' connection '${readable.id}' is not active in this project.`
209
+ )
210
+ }
211
+ const authorization = await this.authorizations.requireStableActiveAuthorization(
212
+ definition,
213
+ readable.authorizationId
214
+ )
215
+ if (
216
+ current?.authorizationId !== authorization.id ||
217
+ current.accountId !== readable.account.id
218
+ ) {
219
+ current = {
220
+ authorizationId: authorization.id,
221
+ accountId: readable.account.id,
222
+ source: this.authorizations.createTokenSource(
223
+ definition,
224
+ authorization.id,
225
+ readable.account
226
+ ),
227
+ }
228
+ }
229
+ return current.source.get()
230
+ },
231
+ })
232
+ }
233
+
234
+ private async requireReadableConnection<TAdapter extends OAuthConnectorAdapter>(
235
+ definition: ConnectorDefinition<string, TAdapter>,
236
+ selector: ConnectorConnectionSelector
237
+ ): Promise<ConnectorConnectionRecord> {
175
238
  this.assertOAuthRegistered(definition)
176
239
  assertConnectorConnectionSelector(selector)
177
240
  const connection = await withConnectorStorageBoundary(
@@ -199,13 +262,21 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
199
262
  `Connector '${definition.id}' does not open the connections of a suspended member.`
200
263
  )
201
264
  }
202
-
203
- return this.connectExecutionConnection(definition, readable)
265
+ return readable
204
266
  }
205
267
 
206
268
  /** Snapshot the connected records that one trusted primitive execution may consume. */
207
269
  async listExecutionConnections<TAdapter extends OAuthConnectorAdapter>(
208
270
  definition: ConnectorDefinition<string, TAdapter>
271
+ ): Promise<readonly ConnectorConnectionRecord[]> {
272
+ const connections = await this.listAllConnections(definition)
273
+ const connected = connections.filter((connection) => connection.status === "connected")
274
+ return this.withoutSuspendedOwners(connected)
275
+ }
276
+
277
+ /** Every connection of the connector, whatever its status: none is ever deleted. */
278
+ async listAllConnections<TAdapter extends OAuthConnectorAdapter>(
279
+ definition: ConnectorDefinition<string, TAdapter>
209
280
  ): Promise<readonly ConnectorConnectionRecord[]> {
210
281
  this.assertOAuthRegistered(definition)
211
282
  const connections = await withConnectorStorageBoundary(
@@ -216,9 +287,7 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
216
287
  connectorId: definition.id,
217
288
  })
218
289
  )
219
- const connected = connections.filter((connection) => connection.status === "connected")
220
- const readable = await this.withoutSuspendedOwners(connected)
221
- return [...readable].sort((left, right) => left.id.localeCompare(right.id))
290
+ return [...connections].sort((left, right) => left.id.localeCompare(right.id))
222
291
  }
223
292
 
224
293
  /**
@@ -1,5 +1,5 @@
1
1
  import { AuthorizationError, assertProviderAccess } from "../authorization"
2
- import type { ExecutionContext } from "../execution"
2
+ import type { AuthorizablePrincipal, ExecutionContext } from "../execution"
3
3
  import { resolveExecutionScopeAuthorization } from "../execution/authorization"
4
4
  import type { SixbRuntimeContext } from "../runtime/types"
5
5
  import { createConnectorConnections } from "./connection-handles"
@@ -65,7 +65,7 @@ export function createConnectorRuntime(
65
65
  `[Sixb] Connector '${definition.id}' uses persistent connections and requires an explicit owner and slot.`
66
66
  )
67
67
  }
68
- assertPersonalConnectionRequester(definition, execution, selector)
68
+ assertPersonalConnectionRequester(definition, execution.requestedBy, selector)
69
69
  return service.connectConnection(definition, selector)
70
70
  }
71
71
  if (selector) {
@@ -178,13 +178,12 @@ export function getConnectorExecutionSourceResolver(
178
178
  * person's account by calling an action, even with can.manage. A run no one requested, such as one
179
179
  * an event or a schedule started, picks the owner from its data, as syncs and webhooks do.
180
180
  */
181
- function assertPersonalConnectionRequester(
182
- definition: ConnectorDefinition,
183
- execution: ExecutionContext,
181
+ export function assertPersonalConnectionRequester(
182
+ definition: Pick<ConnectorDefinition, "id">,
183
+ requester: AuthorizablePrincipal | undefined,
184
184
  selector: ConnectorConnectionSelector
185
185
  ): void {
186
186
  const owner = selector.owner
187
- const requester = execution.requestedBy
188
187
  if (owner?.type !== "user" || requester === undefined) return
189
188
  if (requester.type === "user" && requester.id === owner.id) return
190
189
  throw new AuthorizationError(
@@ -1,3 +1,4 @@
1
+ import type { SandboxOAuthConnector } from "../sandboxes/auth"
1
2
  import type { ConnectorConnectionRecord } from "../storage"
2
3
  import type { ConnectorConnectionProcess } from "./connections/contracts"
3
4
  import {
@@ -10,6 +11,7 @@ import type {
10
11
  ConnectorClient,
11
12
  ConnectorConnectionSelector,
12
13
  ConnectorDefinition,
14
+ ConnectorTokenSource,
13
15
  OAuthConnectorAdapter,
14
16
  } from "./types"
15
17
  import { isOAuthConnectorDefinition } from "./types"
@@ -77,12 +79,33 @@ export class ConnectorService {
77
79
  return this.requireConnections().connectConnection(definition, selector)
78
80
  }
79
81
 
82
+ createConnectionTokenSource(
83
+ connector: SandboxOAuthConnector,
84
+ selector: ConnectorConnectionSelector
85
+ ): ConnectorTokenSource {
86
+ const definition = connector as unknown as ConnectorDefinition
87
+ if (!isOAuthConnectorDefinition(definition)) {
88
+ throw createConnectorCodedError(
89
+ "connector.configuration_invalid",
90
+ `[Sixb] Connector '${connector.id}' does not use persistent OAuth connections.`
91
+ )
92
+ }
93
+ return this.requireConnections().createConnectionTokenSource(definition, selector)
94
+ }
95
+
80
96
  listExecutionConnections<TAdapter extends OAuthConnectorAdapter>(
81
97
  definition: ConnectorDefinition<string, TAdapter>
82
98
  ): Promise<readonly ConnectorConnectionRecord[]> {
83
99
  return this.requireConnections().listExecutionConnections(definition)
84
100
  }
85
101
 
102
+ /** Every connection of the connector, whatever its status: none is ever deleted. */
103
+ listAllConnections<TAdapter extends OAuthConnectorAdapter>(
104
+ definition: ConnectorDefinition<string, TAdapter>
105
+ ): Promise<readonly ConnectorConnectionRecord[]> {
106
+ return this.requireConnections().listAllConnections(definition)
107
+ }
108
+
86
109
  /** Revokes every connection one person owns. Nothing to do without OAuth connectors. */
87
110
  async revokeUserConnections(userId: string): Promise<void> {
88
111
  await this.connections?.revokeUserConnections(userId)
@@ -244,7 +244,10 @@ export interface DeployRelease {
244
244
  readonly env?: DeployCommand
245
245
  /** Runs while the previous release still serves. */
246
246
  readonly build: readonly DeployCommand[]
247
- /** Runs after the services stop and before they start again. */
247
+ /**
248
+ * Runs before the new release starts. The SSH target keeps the previous release serving
249
+ * meanwhile, unless storage migrations are pending: then the services stop first.
250
+ */
248
251
  readonly beforeStart: readonly DeployCommand[]
249
252
  }
250
253
  readonly services: readonly DeployReleaseService[]
@@ -48,7 +48,18 @@ export interface EventsRuntime {
48
48
  ): Promise<() => void>
49
49
  }
50
50
 
51
- export function createEventsRuntime(runtime: SixbRuntimeContext): EventsRuntime {
51
+ export interface EventsRuntimeAccess {
52
+ /**
53
+ * The connections whose sync runs the caller sees, among those these syncs read, as
54
+ * `syncs.runs` decides. Undefined when nothing is left out.
55
+ */
56
+ visibleSyncConnectionIds(syncIds: readonly string[]): Promise<readonly string[] | undefined>
57
+ }
58
+
59
+ export function createEventsRuntime(
60
+ runtime: SixbRuntimeContext,
61
+ access: EventsRuntimeAccess
62
+ ): EventsRuntime {
52
63
  const authority = resolveRuntimeAuthorizationForProject(runtime)
53
64
 
54
65
  // Objects an event names that the reader cannot read: storage tells which still exist, and the
@@ -86,7 +97,8 @@ export function createEventsRuntime(runtime: SixbRuntimeContext): EventsRuntime
86
97
  case "unrestricted":
87
98
  return events
88
99
  case "principal": {
89
- const shown = await visibleByGrants(authority.context, events)
100
+ const granted = await visibleByGrants(authority.context, events)
101
+ const shown = await withoutHiddenSyncRuns(granted, access)
90
102
  if (!events.some((event) => event.topic === "artifacts")) return shown
91
103
 
92
104
  // Artifact events go to whoever reads the artifact, in the log's order with the others.
@@ -219,6 +231,34 @@ async function readableArtifactEvents(
219
231
  return shown
220
232
  }
221
233
 
234
+ /**
235
+ * The events left once the runs of connections the caller may not run are dropped, as
236
+ * `syncs.runs` drops them: a colleague's run, with its failure. A sync event that names no
237
+ * connection stays, and a batch without one costs no lookup.
238
+ */
239
+ async function withoutHiddenSyncRuns(
240
+ events: readonly StoredDomainEvent[],
241
+ access: EventsRuntimeAccess
242
+ ): Promise<readonly StoredDomainEvent[]> {
243
+ const connectionOf = (event: StoredDomainEvent) =>
244
+ event.topic === "syncs" ? event.payload.connectionId : undefined
245
+ const syncIds = new Set(
246
+ events.flatMap((event) =>
247
+ event.topic === "syncs" && connectionOf(event) !== undefined ? [event.payload.syncId] : []
248
+ )
249
+ )
250
+ if (syncIds.size === 0) return events
251
+
252
+ const visible = await access.visibleSyncConnectionIds([...syncIds])
253
+ if (visible === undefined) return events
254
+
255
+ const shown = new Set(visible)
256
+ return events.filter((event) => {
257
+ const connectionId = connectionOf(event)
258
+ return connectionId === undefined || shown.has(connectionId)
259
+ })
260
+ }
261
+
222
262
  /**
223
263
  * The clearance each event is redacted with, resolved once per kind of event for the whole batch.
224
264
  * An event that holds only values the current markings describe uses the reader's clearance.
@@ -9,6 +9,8 @@ export interface SyncRunStartedEvent extends EventEnvelope {
9
9
  payload: {
10
10
  syncId: string
11
11
  runId: string
12
+ /** The connection the run reads, on a sync of an OAuth connector. */
13
+ connectionId?: string
12
14
  startedAt: string
13
15
  }
14
16
  }
@@ -20,6 +22,8 @@ export interface SyncRunFinishedEvent extends EventEnvelope {
20
22
  payload: {
21
23
  syncId: string
22
24
  runId: string
25
+ /** The connection the run reads, on a sync of an OAuth connector. */
26
+ connectionId?: string
23
27
  status: "succeeded" | "failed" | "cancelled"
24
28
  datasetId?: string
25
29
  versionId?: string
@@ -37,6 +37,7 @@ import { userExpansionPlan } from "../objects/query/user-expansions"
37
37
  import {
38
38
  type AdmittedObjectQuery,
39
39
  composeObjectQueryAdmissions,
40
+ type ObjectQueryDiscovery,
40
41
  type ObjectQuerySemanticAdmission,
41
42
  validateObjectQuery,
42
43
  validateObjectQueryWithAdmission,
@@ -195,6 +196,10 @@ class AuthorizedObjectReaderImpl {
195
196
  return reader.#ontology.view()
196
197
  }
197
198
 
199
+ static queryDiscovery(reader: AuthorizedObjectReaderImpl): ObjectQueryDiscovery {
200
+ return reader.#ontology.discovery
201
+ }
202
+
198
203
  /** Project identity carried by this nominal reader capability. */
199
204
  get projectId(): string {
200
205
  return this.#security.runtime.projectId
@@ -445,11 +450,15 @@ class AuthorizedObjectReaderImpl {
445
450
  if (admission) {
446
451
  const preflight = preflightObjectQueryLinks(
447
452
  { query, ...request, projectId: this.#security.runtime.projectId },
448
- { ontology: this.#ontology.registry }
453
+ { ontology: this.#ontology.registry, discovery: this.#ontology.discovery }
449
454
  )
450
455
  const admitted = validateObjectQueryWithAdmission(
451
456
  preflight.validated.query,
452
- { ontology: this.#ontology.registry, normalize: false },
457
+ {
458
+ ontology: this.#ontology.registry,
459
+ discovery: this.#ontology.discovery,
460
+ normalize: false,
461
+ },
453
462
  admission
454
463
  )
455
464
  admission.assertIncidentEdgeSelected({
@@ -465,6 +474,7 @@ class AuthorizedObjectReaderImpl {
465
474
  if (clearance) {
466
475
  assertLinkQueryReadable({
467
476
  ontology: this.#ontology.registry,
477
+ discovery: this.#ontology.discovery,
468
478
  clearance,
469
479
  query,
470
480
  request: { ...request, projectId: this.#security.runtime.projectId },
@@ -537,13 +547,20 @@ class AuthorizedObjectReaderImpl {
537
547
  if (admission) {
538
548
  // Terminal arguments are ordinary validation errors, not an authorization oracle. Validate
539
549
  // them against the canonical result shape before raising any delegated-scope denial.
540
- const validated = validateObjectQuery(query, { ontology: this.#ontology.registry })
550
+ const validated = validateObjectQuery(query, {
551
+ ontology: this.#ontology.registry,
552
+ discovery: this.#ontology.discovery,
553
+ })
541
554
  const normalizedFacets = validateObjectFacetRequests(facets, validated.result.objectTypeIds, {
542
555
  ontology: this.#ontology.registry,
543
556
  })
544
557
  const admitted = validateObjectQueryWithAdmission(
545
558
  validated.query,
546
- { ontology: this.#ontology.registry, normalize: false },
559
+ {
560
+ ontology: this.#ontology.registry,
561
+ discovery: this.#ontology.discovery,
562
+ normalize: false,
563
+ },
547
564
  admission
548
565
  )
549
566
  normalizedFacets.forEach((facet, index) => {
@@ -657,6 +674,7 @@ class AuthorizedObjectReaderImpl {
657
674
  // forgeable bypass flag; neither is needed at this nominal boundary.
658
675
  return {
659
676
  ontology: this.#ontology.registry,
677
+ discovery: this.#ontology.discovery,
660
678
  storage: this.#storage,
661
679
  embeddingModels: this.#models.embedding,
662
680
  rerankingModels: this.#models.reranking,
@@ -666,6 +684,7 @@ class AuthorizedObjectReaderImpl {
666
684
  }
667
685
  return {
668
686
  ontology: this.#ontology.registry,
687
+ discovery: this.#ontology.discovery,
669
688
  embeddingModels: this.#models.embedding,
670
689
  rerankingModels: this.#models.reranking,
671
690
  storage: this.#storage,
@@ -775,7 +794,11 @@ class AuthorizedObjectReaderImpl {
775
794
  #admitDelegatedQuery(query: ObjectQuery): AdmittedObjectQuery | undefined {
776
795
  const admission = this.#security.delegation?.queryAdmission
777
796
  if (!admission) return undefined
778
- return validateObjectQueryWithAdmission(query, { ontology: this.#ontology.registry }, admission)
797
+ return validateObjectQueryWithAdmission(
798
+ query,
799
+ { ontology: this.#ontology.registry, discovery: this.#ontology.discovery },
800
+ admission
801
+ )
779
802
  }
780
803
 
781
804
  #resolveListObjectTypes(
@@ -868,6 +891,11 @@ export function getAuthorizedOntologyView(reader: AuthorizedObjectReader): Autho
868
891
  return AuthorizedObjectReaderImpl.ontologyView(reader)
869
892
  }
870
893
 
894
+ /** The reader's view as query validation reads it, built only when an issue reads it. */
895
+ export function getQueryDiscovery(reader: AuthorizedObjectReader): ObjectQueryDiscovery {
896
+ return AuthorizedObjectReaderImpl.queryDiscovery(reader)
897
+ }
898
+
871
899
  /**
872
900
  * What a reader resolved for this authority cannot read now. Events redact with it: an event of an
873
901
  * object type the reader cannot read is not delivered, and the others are redacted like rows.
@@ -3,6 +3,7 @@ import {
3
3
  type AuthorizedOntologyView,
4
4
  createAuthorizedOntologyView,
5
5
  } from "../objects/authorized-ontology-view"
6
+ import type { ObjectQueryDiscovery } from "../objects/query/validate"
6
7
  import type { OntologyRegistry } from "../ontology"
7
8
  import { assertObjectReadOutputWithinLimit } from "../storage"
8
9
  import type { ObjectReaderSecurity } from "./object-reader-security"
@@ -10,11 +11,16 @@ import type { ObjectReaderSecurity } from "./object-reader-security"
10
11
  /** The ontology a reader resolves against, and the part of it its authority may describe. */
11
12
  export class ObjectReaderOntology {
12
13
  readonly registry: OntologyRegistry
14
+ /** The view as query validation reads it, building the view only when an issue reads it. */
15
+ readonly discovery: ObjectQueryDiscovery
13
16
  readonly #security: ObjectReaderSecurity
14
17
  #view?: AuthorizedOntologyView
15
18
 
16
19
  constructor(registry: OntologyRegistry, security: ObjectReaderSecurity) {
17
20
  this.registry = registry
21
+ this.discovery = {
22
+ getObjectTypeById: (objectTypeId) => this.view().getObjectTypeById(objectTypeId),
23
+ }
18
24
  this.#security = security
19
25
  Object.freeze(this)
20
26
  }
@@ -24,6 +24,7 @@ export type {
24
24
  AgentRunView,
25
25
  AgentThreadsRuntime,
26
26
  CreateExecutionAgentThreadInput,
27
+ ExecutionAgentEditMessageInput,
27
28
  ExecutionAgentRequestInput,
28
29
  ExecutionAgentRunResult,
29
30
  ListExecutionAgentThreadsInput,
@@ -880,6 +880,14 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
880
880
  accessToken: true,
881
881
  agentApi: true,
882
882
  },
883
+ // Account labels are people's sign-in names: for the dashboard and scripts, not the Agent.
884
+ {
885
+ operationId: "listConnectorAccounts",
886
+ method: "GET",
887
+ path: "/api/connectors/:connectorId/accounts",
888
+ accessToken: true,
889
+ agentApi: false,
890
+ },
883
891
  {
884
892
  operationId: "listSyncRuns",
885
893
  method: "GET",
package/src/index.ts CHANGED
@@ -646,6 +646,7 @@ export type {
646
646
  ObjectExpansion,
647
647
  ObjectQuery,
648
648
  ObjectQueryDirection,
649
+ ObjectQueryDiscovery,
649
650
  ObjectQueryExpand,
650
651
  ObjectQueryFilter,
651
652
  ObjectQueryLimit,
@@ -749,6 +750,8 @@ export type {
749
750
  BatchSyncDefinitionConfig,
750
751
  DatasetSyncTarget,
751
752
  RequestSyncRunInput,
753
+ SyncAccount,
754
+ SyncAccountsRuntime,
752
755
  SyncBuilder,
753
756
  SyncConnectorConnection,
754
757
  SyncDefinition,
@@ -759,6 +762,7 @@ export type {
759
762
  SyncReadResult,
760
763
  SyncRunRequestOptions,
761
764
  SyncRunRequestResult,
765
+ SyncRunRequestResults,
762
766
  SyncTargetBuilder,
763
767
  } from "./syncs"
764
768
  export { defineSync } from "./syncs"
@@ -984,7 +988,12 @@ export type {
984
988
  SaveAgentMemoryRuntimeResult,
985
989
  } from "./agents/memory-execution"
986
990
  export type { AgentThreadParticipantInput } from "./agents/participants"
987
- export type { AgentThreadParticipant, AgentThreadView } from "./agents/thread-access"
991
+ export type {
992
+ AgentThreadLastRunView,
993
+ AgentThreadParticipant,
994
+ AgentThreadReadView,
995
+ AgentThreadView,
996
+ } from "./agents/thread-access"
988
997
  export type { ArtifactAccess } from "./artifacts/access"
989
998
  export type { ArtifactCommentInput } from "./artifacts/comments"
990
999
  export type { ArtifactRequestErrorCode } from "./artifacts/errors"
@@ -1267,6 +1276,7 @@ export type {
1267
1276
  AgentToolTextContent,
1268
1277
  AgentUsageReference,
1269
1278
  AgentWebOptions,
1279
+ EditAgentMessageInput,
1270
1280
  InferAgentToolInput,
1271
1281
  InferAgentToolInputSchema,
1272
1282
  InferAgentToolOutput,
@@ -1289,7 +1299,13 @@ export {
1289
1299
  MAX_AGENT_APP_STATE_TOTAL_BYTES,
1290
1300
  MAX_AGENT_CONTEXT_ENTRIES,
1291
1301
  } from "./agents"
1292
- export type { SandboxSourceAuth, SandboxSourceCredentials } from "./sandboxes/auth"
1302
+ export type {
1303
+ SandboxConnectionTokenResolver,
1304
+ SandboxOAuthConnector,
1305
+ SandboxSourceAuth,
1306
+ SandboxSourceAuthInput,
1307
+ SandboxSourceCredentials,
1308
+ } from "./sandboxes/auth"
1293
1309
  export type {
1294
1310
  SandboxConfig,
1295
1311
  SandboxDefinition,
@@ -18,6 +18,8 @@ import type {
18
18
  TranscriptionModel,
19
19
  TranscriptionModelResponseMetadata,
20
20
  TranscriptionModelResult,
21
+ TranscriptionOutput,
22
+ TranscriptionWord,
21
23
  } from "./types"
22
24
 
23
25
  export function createAudioRuntime(
@@ -86,25 +88,66 @@ export function createAudioRuntime(
86
88
  // A completed, billable reply must survive cancellation and transcript validation failures.
87
89
  const event = await recordTranscription(accounting, model, callId, result ?? {})
88
90
  signal.throwIfAborted()
89
- if (typeof result?.output?.text !== "string") {
90
- throw new TranscriptionModelResponseError(
91
- "[SixbModels] Invalid transcription response.",
92
- model.providerId,
93
- model.modelId,
94
- result ?? {}
95
- )
96
- }
91
+ const output = transcriptOutput(result, model)
97
92
 
98
- return {
99
- output: { text: result.output.text },
100
- usage: event.usage,
101
- cost: event.cost,
102
- callId,
103
- }
93
+ return { output, usage: event.usage, cost: event.cost, callId }
104
94
  },
105
95
  }
106
96
  }
107
97
 
98
+ /**
99
+ * The validated transcript. A word list a caller cannot trust is worse than none: a playhead
100
+ * would seek to a timestamp that is not there. Refuse the reply instead, as for a missing text;
101
+ * billing for it was recorded already.
102
+ */
103
+ function transcriptOutput(
104
+ result: TranscriptionModelResult | undefined,
105
+ model: TranscriptionModel
106
+ ): TranscriptionOutput {
107
+ const refuse = () =>
108
+ new TranscriptionModelResponseError(
109
+ "[SixbModels] Invalid transcription response.",
110
+ model.providerId,
111
+ model.modelId,
112
+ result ?? {}
113
+ )
114
+
115
+ const output = result?.output
116
+ if (typeof output?.text !== "string") throw refuse()
117
+
118
+ const words: readonly unknown[] | undefined = output.words
119
+ if (words === undefined) return { text: output.text }
120
+ if (!Array.isArray(words)) throw refuse()
121
+
122
+ const timed: TranscriptionWord[] = []
123
+ for (const word of words) {
124
+ const entry = word as Partial<TranscriptionWord> | null | undefined
125
+ if (
126
+ typeof entry?.text !== "string" ||
127
+ !entry.text ||
128
+ !isMillisecond(entry.startMs) ||
129
+ !isMillisecond(entry.endMs) ||
130
+ entry.endMs < entry.startMs ||
131
+ (entry.speaker !== undefined && (typeof entry.speaker !== "string" || !entry.speaker))
132
+ ) {
133
+ throw refuse()
134
+ }
135
+ timed.push({
136
+ text: entry.text,
137
+ startMs: entry.startMs,
138
+ endMs: entry.endMs,
139
+ ...(entry.speaker === undefined ? {} : { speaker: entry.speaker }),
140
+ })
141
+ }
142
+
143
+ // An empty list says nothing; the absent field is the one way to say "no words".
144
+ return timed.length ? { text: output.text, words: timed } : { text: output.text }
145
+ }
146
+
147
+ function isMillisecond(value: unknown): value is number {
148
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0
149
+ }
150
+
108
151
  interface PreparedAudio {
109
152
  readonly mediaType: string
110
153
  readonly sizeBytes: number
@@ -18,8 +18,28 @@ export interface TranscriptionModelRequest {
18
18
  readonly signal?: AbortSignal
19
19
  }
20
20
 
21
+ /** One word the provider timed, and who said it when the provider labels voices. */
22
+ export interface TranscriptionWord {
23
+ readonly text: string
24
+ /** Milliseconds from the start of the audio. */
25
+ readonly startMs: number
26
+ /** Milliseconds from the start of the audio; equal to `startMs` for a word it did not span. */
27
+ readonly endMs: number
28
+ /**
29
+ * The provider's label for who said it, such as `speaker_0`. It is stable within one
30
+ * transcript only: the same voice need not carry the same label in another.
31
+ */
32
+ readonly speaker?: string
33
+ }
34
+
21
35
  export interface TranscriptionOutput {
22
36
  readonly text: string
37
+ /**
38
+ * The words the provider timed, in spoken order. Text alone cannot say who was speaking at
39
+ * 12:04, or where to put the playhead. Absent when the provider returns none, which is what
40
+ * every provider that neither diarizes nor times words does.
41
+ */
42
+ readonly words?: readonly TranscriptionWord[]
23
43
  }
24
44
 
25
45
  export interface TranscriptionModelResponseMetadata {
@@ -31,6 +31,7 @@ export type {
31
31
  TranscriptionModelResponseMetadata,
32
32
  TranscriptionModelResult,
33
33
  TranscriptionOutput,
34
+ TranscriptionWord,
34
35
  } from "./audio/types"
35
36
  export type { ModelCallFiles, ModelCallsRuntime } from "./calls"
36
37
  export type {
@@ -44,6 +44,7 @@ import { sortTieDirection } from "./sort-ties"
44
44
  import { withoutUserExpansions } from "./user-expansions"
45
45
  import {
46
46
  type AdmittedObjectQuery,
47
+ type ObjectQueryDiscovery,
47
48
  type ObjectQuerySemanticAdmission,
48
49
  type ObjectQueryValidationIssue,
49
50
  resolveObjectQueryResultShape,
@@ -88,6 +89,8 @@ export interface QueryExecutorOptions
88
89
  readableObjectTypes?: ReadableObjectTypes
89
90
  /** Reader-specific admission applied after grants, such as marking clearances. */
90
91
  admission?: ObjectQuerySemanticAdmission
92
+ /** What the reader discovers of the ontology, which an unknown-property issue lists from. */
93
+ discovery?: ObjectQueryDiscovery
91
94
  /** The user `currentUser()` stands for; absent when the reader is not a user. */
92
95
  requestingUser?: UserRef
93
96
  }
@@ -450,6 +453,7 @@ function validateExecutableQuery(
450
453
  maxRefs: options.maxRefs,
451
454
  normalize: false,
452
455
  resolveLinkEndpoints: true,
456
+ discovery: options.discovery,
453
457
  }
454
458
  const normalized = normalizeObjectQuery(input.query)
455
459
  const validated = validateObjectQuery(normalized, validationOptions)