@sixb/core 0.1.8 → 0.1.9
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.
- package/dist/actions/index.js +77 -89
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/run-dispatch.d.ts.map +1 -1
- package/dist/actions/types/context.d.ts +2 -0
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/actions/validation.d.ts +1 -1
- package/dist/actions/validation.d.ts.map +1 -1
- package/dist/actions/worker.js +33 -37
- package/dist/actions/worker.js.map +2 -2
- package/dist/agents/adapters.d.ts +3 -3
- package/dist/agents/{context.d.ts → context/entries.d.ts} +3 -3
- package/dist/agents/context/entries.d.ts.map +1 -0
- package/dist/agents/context/index.d.ts +4 -0
- package/dist/agents/context/index.d.ts.map +1 -0
- package/dist/agents/context/index.js +19 -0
- package/dist/agents/{streams.js.map → context/index.js.map} +1 -1
- package/dist/agents/context-model.d.ts +1 -1
- package/dist/agents/context-model.d.ts.map +1 -1
- package/dist/agents/context-resolution.d.ts +1 -1
- package/dist/agents/context-resolution.d.ts.map +1 -1
- package/dist/agents/index.d.ts +4 -4
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +192 -204
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/message.d.ts +1 -1
- package/dist/agents/message.d.ts.map +1 -1
- package/dist/agents/model-loop.d.ts +2 -0
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/request.d.ts +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/streams/index.d.ts +4 -0
- package/dist/agents/streams/index.d.ts.map +1 -0
- package/dist/agents/streams/index.js +20 -0
- package/dist/{chunk-y64skrwp.js.map → agents/streams/index.js.map} +1 -1
- package/dist/agents/streams/internal.d.ts +3 -0
- package/dist/agents/streams/internal.d.ts.map +1 -0
- package/dist/agents/streams/internal.js +40 -0
- package/dist/agents/{context.js.map → streams/internal.js.map} +1 -1
- package/dist/agents/{streams.d.ts → streams/protocol.d.ts} +5 -5
- package/dist/agents/streams/protocol.d.ts.map +1 -0
- package/dist/agents/types.d.ts +1 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/auth/index.d.ts +0 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +96 -108
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/strategy.js +8 -9
- package/dist/auth/strategy.js.map +1 -1
- package/dist/authorization/index.js +51 -56
- package/dist/authorization/index.js.map +1 -1
- package/dist/blob-storage/browser.js +15 -17
- package/dist/blob-storage/browser.js.map +1 -1
- package/dist/blob-storage/index.js +36 -38
- package/dist/blob-storage/index.js.map +1 -1
- package/dist/bootstrap/discovery.d.ts +14 -1
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.d.ts +2 -2
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +79 -88
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/broker/index.js +8 -10
- package/dist/broker/index.js.map +1 -1
- package/dist/{chunk-k34z5rvh.js → chunk-0rdrecsb.js} +18 -18
- package/dist/{chunk-k34z5rvh.js.map → chunk-0rdrecsb.js.map} +2 -2
- package/dist/{chunk-q0k9nc5a.js → chunk-0w35wavj.js} +98 -98
- package/dist/{chunk-q0k9nc5a.js.map → chunk-0w35wavj.js.map} +2 -2
- package/dist/chunk-0y39rgsb.js +43 -0
- package/dist/{chunk-c15dr03f.js.map → chunk-0y39rgsb.js.map} +2 -2
- package/dist/{chunk-k522z7v6.js → chunk-17kfctj6.js} +16 -11
- package/dist/chunk-17kfctj6.js.map +10 -0
- package/dist/{chunk-aa2pen2v.js → chunk-1enhpacz.js} +188 -175
- package/dist/{chunk-aa2pen2v.js.map → chunk-1enhpacz.js.map} +2 -2
- package/dist/{chunk-5gd7tpv6.js → chunk-2c4j899j.js} +4 -4
- package/dist/{chunk-5gd7tpv6.js.map → chunk-2c4j899j.js.map} +2 -2
- package/dist/{chunk-fvt9rjsa.js → chunk-38zv5rkr.js} +4 -4
- package/dist/{chunk-fvt9rjsa.js.map → chunk-38zv5rkr.js.map} +1 -1
- package/dist/{chunk-w3e09qqk.js → chunk-39tqv9hz.js} +24 -24
- package/dist/{chunk-w3e09qqk.js.map → chunk-39tqv9hz.js.map} +2 -2
- package/dist/{chunk-04b07a9q.js → chunk-3bh94gbw.js} +13 -13
- package/dist/{chunk-04b07a9q.js.map → chunk-3bh94gbw.js.map} +2 -2
- package/dist/{chunk-8m5ejdpn.js → chunk-3f7veca0.js} +4 -4
- package/dist/{chunk-8m5ejdpn.js.map → chunk-3f7veca0.js.map} +2 -2
- package/dist/chunk-3frsnm7x.js +32 -0
- package/dist/chunk-3frsnm7x.js.map +11 -0
- package/dist/{chunk-n2w475r0.js → chunk-3tgwrcyh.js} +81 -81
- package/dist/{chunk-n2w475r0.js.map → chunk-3tgwrcyh.js.map} +2 -2
- package/dist/{chunk-mwsxn98e.js → chunk-52hbv0ak.js} +170 -170
- package/dist/{chunk-mwsxn98e.js.map → chunk-52hbv0ak.js.map} +4 -4
- package/dist/{chunk-nf4r78r4.js → chunk-5a4a52tq.js} +4 -4
- package/dist/{chunk-nf4r78r4.js.map → chunk-5a4a52tq.js.map} +2 -2
- package/dist/{chunk-rte5sm3z.js → chunk-5hz0fnca.js} +23 -23
- package/dist/{chunk-rte5sm3z.js.map → chunk-5hz0fnca.js.map} +2 -2
- package/dist/chunk-653vwrzr.js +39 -0
- package/dist/chunk-653vwrzr.js.map +10 -0
- package/dist/{chunk-qw9gvjv5.js → chunk-72w2pxk7.js} +13 -13
- package/dist/{chunk-qw9gvjv5.js.map → chunk-72w2pxk7.js.map} +2 -2
- package/dist/chunk-7apz6hg4.js +50 -0
- package/dist/{chunk-jq43kdvk.js.map → chunk-7apz6hg4.js.map} +2 -2
- package/dist/chunk-7bs40fe1.js +218 -0
- package/dist/{chunk-p1rzczbt.js.map → chunk-7bs40fe1.js.map} +3 -3
- package/dist/chunk-7zgecwy1.js +113 -0
- package/dist/chunk-7zgecwy1.js.map +10 -0
- package/dist/{chunk-pc7ys28c.js → chunk-860dwwy0.js} +29 -29
- package/dist/{chunk-pc7ys28c.js.map → chunk-860dwwy0.js.map} +2 -2
- package/dist/chunk-8vj0rjgs.js +165 -0
- package/dist/chunk-8vj0rjgs.js.map +15 -0
- package/dist/{chunk-7y0f6rf1.js → chunk-92vk7gta.js} +58 -58
- package/dist/chunk-92vk7gta.js.map +10 -0
- package/dist/{chunk-rafagrwr.js → chunk-93csa55g.js} +45 -17
- package/dist/chunk-93csa55g.js.map +11 -0
- package/dist/{chunk-d8qkxt2v.js → chunk-98cw09sw.js} +7 -7
- package/dist/chunk-98cw09sw.js.map +10 -0
- package/dist/{chunk-n4khvw9n.js → chunk-9qsh3p5y.js} +17 -17
- package/dist/{chunk-n4khvw9n.js.map → chunk-9qsh3p5y.js.map} +2 -2
- package/dist/{chunk-4a849fr1.js → chunk-9tc8dxmn.js} +1 -1
- package/dist/{chunk-9nbmsvn5.js → chunk-9vx5e9g1.js} +9 -9
- package/dist/{chunk-9nbmsvn5.js.map → chunk-9vx5e9g1.js.map} +2 -2
- package/dist/{chunk-f26bck4t.js → chunk-an5tt9y0.js} +353 -353
- package/dist/{chunk-f26bck4t.js.map → chunk-an5tt9y0.js.map} +2 -2
- package/dist/{chunk-2dw777qw.js → chunk-ap0g1g74.js} +37 -82
- package/dist/{chunk-2dw777qw.js.map → chunk-ap0g1g74.js.map} +3 -4
- package/dist/{chunk-v4en4jc2.js → chunk-awbhdqyc.js} +7 -7
- package/dist/{chunk-v4en4jc2.js.map → chunk-awbhdqyc.js.map} +2 -2
- package/dist/{chunk-ka3a2ft3.js → chunk-b19g04jk.js} +12 -12
- package/dist/{chunk-ka3a2ft3.js.map → chunk-b19g04jk.js.map} +2 -2
- package/dist/{chunk-nx7k8tpr.js → chunk-br3k6qbf.js} +23 -23
- package/dist/{chunk-nx7k8tpr.js.map → chunk-br3k6qbf.js.map} +2 -2
- package/dist/{chunk-dbc80ad7.js → chunk-c5rkjrgp.js} +28 -28
- package/dist/{chunk-dbc80ad7.js.map → chunk-c5rkjrgp.js.map} +2 -2
- package/dist/{chunk-dktq02ne.js → chunk-cqr3acm1.js} +4 -4
- package/dist/{chunk-dktq02ne.js.map → chunk-cqr3acm1.js.map} +2 -2
- package/dist/chunk-d62kjtbg.js +7 -0
- package/dist/{chunk-zcnhxkvd.js.map → chunk-d62kjtbg.js.map} +2 -2
- package/dist/{chunk-74drx9gd.js → chunk-dfm066qg.js} +10 -10
- package/dist/{chunk-74drx9gd.js.map → chunk-dfm066qg.js.map} +2 -2
- package/dist/{chunk-5e3pq99w.js → chunk-dmn70ztd.js} +30 -30
- package/dist/chunk-dmn70ztd.js.map +11 -0
- package/dist/{chunk-p1x242ad.js → chunk-dz5h08xv.js} +175 -175
- package/dist/{chunk-p1x242ad.js.map → chunk-dz5h08xv.js.map} +2 -2
- package/dist/{chunk-p2vqaxkc.js → chunk-e0d1rzef.js} +27 -22
- package/dist/{chunk-p2vqaxkc.js.map → chunk-e0d1rzef.js.map} +3 -3
- package/dist/{chunk-5sz8ta9r.js → chunk-e1c18xjx.js} +52 -52
- package/dist/{chunk-5sz8ta9r.js.map → chunk-e1c18xjx.js.map} +2 -2
- package/dist/{chunk-wtf06et8.js → chunk-emyyk7dx.js} +55 -55
- package/dist/{chunk-wtf06et8.js.map → chunk-emyyk7dx.js.map} +2 -2
- package/dist/{chunk-19jp6g9d.js → chunk-f0rwz2vh.js} +54 -33
- package/dist/chunk-f0rwz2vh.js.map +11 -0
- package/dist/{chunk-2xns679x.js → chunk-f4w3yp4f.js} +171 -36
- package/dist/chunk-f4w3yp4f.js.map +12 -0
- package/dist/{chunk-979ww6b3.js → chunk-fb3feg1e.js} +29 -29
- package/dist/{chunk-979ww6b3.js.map → chunk-fb3feg1e.js.map} +2 -2
- package/dist/{chunk-4sm0aznx.js → chunk-g00bfdq6.js} +254 -256
- package/dist/{chunk-4sm0aznx.js.map → chunk-g00bfdq6.js.map} +3 -3
- package/dist/{chunk-p03r0h5s.js → chunk-g53f0e4j.js} +76 -202
- package/dist/chunk-g53f0e4j.js.map +15 -0
- package/dist/chunk-g6cke204.js +124 -0
- package/dist/chunk-g6cke204.js.map +10 -0
- package/dist/{chunk-51fjndv0.js → chunk-gfdh9kqa.js} +4 -4
- package/dist/{chunk-51fjndv0.js.map → chunk-gfdh9kqa.js.map} +2 -2
- package/dist/chunk-h1gfhhbh.js +602 -0
- package/dist/chunk-h1gfhhbh.js.map +18 -0
- package/dist/chunk-h3v76ams.js +32 -0
- package/dist/{chunk-08m3b6w8.js.map → chunk-h3v76ams.js.map} +2 -2
- package/dist/{chunk-xajtptbw.js → chunk-hpr1r6av.js} +1367 -418
- package/dist/chunk-hpr1r6av.js.map +44 -0
- package/dist/{chunk-jecn6t54.js → chunk-jgwb25gc.js} +74 -74
- package/dist/{chunk-jecn6t54.js.map → chunk-jgwb25gc.js.map} +2 -2
- package/dist/{chunk-w9tg6yyb.js → chunk-jjy0fhrn.js} +36 -36
- package/dist/{chunk-w9tg6yyb.js.map → chunk-jjy0fhrn.js.map} +2 -2
- package/dist/{chunk-wdage1eb.js → chunk-jmfet9r4.js} +6 -6
- package/dist/{chunk-wdage1eb.js.map → chunk-jmfet9r4.js.map} +2 -2
- package/dist/{chunk-ajnan18g.js → chunk-k3cqkkn2.js} +58 -55
- package/dist/chunk-k3cqkkn2.js.map +12 -0
- package/dist/{chunk-s5y30bc9.js → chunk-kxwa347f.js} +51 -49
- package/dist/{chunk-s5y30bc9.js.map → chunk-kxwa347f.js.map} +4 -4
- package/dist/{chunk-2ab72m2h.js → chunk-m2ca93my.js} +3 -3
- package/dist/{chunk-2ab72m2h.js.map → chunk-m2ca93my.js.map} +2 -2
- package/dist/{chunk-3z1qec12.js → chunk-m3z3x9v0.js} +107 -64
- package/dist/{chunk-3z1qec12.js.map → chunk-m3z3x9v0.js.map} +3 -3
- package/dist/{chunk-sbzzr4kx.js → chunk-mjbk2djy.js} +1061 -1195
- package/dist/{chunk-sbzzr4kx.js.map → chunk-mjbk2djy.js.map} +9 -15
- package/dist/{chunk-4jjp5k14.js → chunk-mmagke4x.js} +6 -6
- package/dist/{chunk-4jjp5k14.js.map → chunk-mmagke4x.js.map} +2 -2
- package/dist/{chunk-359jm1jw.js → chunk-mrp7k0pw.js} +20 -20
- package/dist/{chunk-359jm1jw.js.map → chunk-mrp7k0pw.js.map} +2 -2
- package/dist/{chunk-h0k55pc7.js → chunk-ms2tmn1k.js} +139 -139
- package/dist/{chunk-h0k55pc7.js.map → chunk-ms2tmn1k.js.map} +2 -2
- package/dist/{chunk-rv2hkwwa.js → chunk-ppytyr6w.js} +156 -179
- package/dist/{chunk-rv2hkwwa.js.map → chunk-ppytyr6w.js.map} +3 -5
- package/dist/{chunk-trxxmgnf.js → chunk-pqajwytd.js} +10 -10
- package/dist/{chunk-trxxmgnf.js.map → chunk-pqajwytd.js.map} +3 -3
- package/dist/{chunk-nn0tekr1.js → chunk-pr2h4bv4.js} +33 -33
- package/dist/{chunk-nn0tekr1.js.map → chunk-pr2h4bv4.js.map} +2 -2
- package/dist/{chunk-xwnf87e1.js → chunk-q5gz3g2j.js} +64 -64
- package/dist/{chunk-xwnf87e1.js.map → chunk-q5gz3g2j.js.map} +2 -2
- package/dist/{chunk-5ntny1qx.js → chunk-qf954wje.js} +6 -6
- package/dist/{chunk-5ntny1qx.js.map → chunk-qf954wje.js.map} +2 -2
- package/dist/{chunk-mth82m8t.js → chunk-qhcpj9wc.js} +77 -77
- package/dist/{chunk-mth82m8t.js.map → chunk-qhcpj9wc.js.map} +2 -2
- package/dist/{chunk-tpnd31c1.js → chunk-r29fxdhn.js} +12 -12
- package/dist/{chunk-tpnd31c1.js.map → chunk-r29fxdhn.js.map} +2 -2
- package/dist/{chunk-b49dgvsj.js → chunk-r2y23egw.js} +3 -3
- package/dist/{chunk-b49dgvsj.js.map → chunk-r2y23egw.js.map} +2 -2
- package/dist/{chunk-3xep5cjx.js → chunk-r4tfx1sf.js} +104 -86
- package/dist/chunk-r4tfx1sf.js.map +15 -0
- package/dist/{chunk-4rh2m6zg.js → chunk-rb1xx120.js} +13 -13
- package/dist/{chunk-4rh2m6zg.js.map → chunk-rb1xx120.js.map} +2 -2
- package/dist/chunk-s3csryxe.js +152 -0
- package/dist/chunk-s3csryxe.js.map +11 -0
- package/dist/chunk-s670k14v.js +60 -0
- package/dist/{chunk-407j3msh.js.map → chunk-s670k14v.js.map} +2 -2
- package/dist/chunk-skz0hst3.js +788 -0
- package/dist/chunk-skz0hst3.js.map +19 -0
- package/dist/{chunk-r8jrnexe.js → chunk-v4jbb3rs.js} +4 -4
- package/dist/{chunk-r8jrnexe.js.map → chunk-v4jbb3rs.js.map} +2 -2
- package/dist/{chunk-v1xppd0y.js → chunk-vf691g1r.js} +60 -60
- package/dist/{chunk-v1xppd0y.js.map → chunk-vf691g1r.js.map} +2 -2
- package/dist/{chunk-w1tvjszy.js → chunk-vsj3mdfj.js} +8 -8
- package/dist/{chunk-w1tvjszy.js.map → chunk-vsj3mdfj.js.map} +2 -2
- package/dist/{chunk-9dzba0f2.js → chunk-wjasrj67.js} +8 -8
- package/dist/{chunk-9dzba0f2.js.map → chunk-wjasrj67.js.map} +2 -2
- package/dist/{chunk-1evzqhks.js → chunk-wr8qp979.js} +6 -6
- package/dist/{chunk-1evzqhks.js.map → chunk-wr8qp979.js.map} +2 -2
- package/dist/{chunk-n6jxh8sw.js → chunk-wy0qdqfm.js} +18 -18
- package/dist/{chunk-n6jxh8sw.js.map → chunk-wy0qdqfm.js.map} +2 -2
- package/dist/{chunk-8tsf6dmc.js → chunk-x57ycxq0.js} +204 -204
- package/dist/{chunk-8tsf6dmc.js.map → chunk-x57ycxq0.js.map} +2 -2
- package/dist/{chunk-z4ccwbkz.js → chunk-x9v4cx1d.js} +1 -1
- package/dist/{chunk-gbejpkex.js → chunk-xfbydgzy.js} +26 -26
- package/dist/{chunk-gbejpkex.js.map → chunk-xfbydgzy.js.map} +2 -2
- package/dist/{chunk-gzasd5b6.js → chunk-xyr8kppc.js} +22 -22
- package/dist/{chunk-gzasd5b6.js.map → chunk-xyr8kppc.js.map} +2 -2
- package/dist/{chunk-h5vqbfmd.js → chunk-ypbtykv6.js} +117 -117
- package/dist/{chunk-h5vqbfmd.js.map → chunk-ypbtykv6.js.map} +3 -3
- package/dist/{chunk-ry24jbr1.js → chunk-yv79ncbv.js} +10 -10
- package/dist/{chunk-ry24jbr1.js.map → chunk-yv79ncbv.js.map} +2 -2
- package/dist/{chunk-yp8ee62z.js → chunk-z30bv4ga.js} +35 -35
- package/dist/{chunk-yp8ee62z.js.map → chunk-z30bv4ga.js.map} +2 -2
- package/dist/{chunk-8ydjhh27.js → chunk-z3y411fq.js} +11 -7
- package/dist/{chunk-8ydjhh27.js.map → chunk-z3y411fq.js.map} +3 -3
- package/dist/{chunk-9t8f5xfx.js → chunk-z5rnrmz1.js} +10 -10
- package/dist/{chunk-9t8f5xfx.js.map → chunk-z5rnrmz1.js.map} +2 -2
- package/dist/{chunk-96swp2wd.js → chunk-z667z3sg.js} +3 -3
- package/dist/{chunk-96swp2wd.js.map → chunk-z667z3sg.js.map} +2 -2
- package/dist/{chunk-4yqmp43v.js → chunk-z8fx5cgb.js} +12 -12
- package/dist/{chunk-4yqmp43v.js.map → chunk-z8fx5cgb.js.map} +2 -2
- package/dist/{chunk-xhy826cz.js → chunk-zcnq6105.js} +7 -7
- package/dist/{chunk-xhy826cz.js.map → chunk-zcnq6105.js.map} +2 -2
- package/dist/{chunk-yt8wphsx.js → chunk-zvx7h87b.js} +3 -3
- package/dist/{chunk-yt8wphsx.js.map → chunk-zvx7h87b.js.map} +2 -2
- package/dist/connectors/connections/internal.js +9 -10
- package/dist/connectors/connections/internal.js.map +1 -1
- package/dist/datasets/write.js +8 -12
- package/dist/datasets/write.js.map +1 -1
- package/dist/edits/index.js +7 -8
- package/dist/edits/index.js.map +1 -1
- package/dist/error-reporting/internal.js +22 -24
- package/dist/error-reporting/internal.js.map +1 -1
- package/dist/errors/internal.d.ts +1 -1
- package/dist/errors/internal.d.ts.map +1 -1
- package/dist/errors/internal.js +22 -24
- package/dist/errors/internal.js.map +1 -1
- package/dist/errors/redaction.d.ts +8 -0
- package/dist/errors/redaction.d.ts.map +1 -0
- package/dist/errors/types.d.ts +4 -0
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/events/index.js +60 -63
- package/dist/events/index.js.map +1 -1
- package/dist/events/scope.js +4 -5
- package/dist/events/scope.js.map +1 -1
- package/dist/events/selectors/index.js +9 -10
- package/dist/events/selectors/index.js.map +1 -1
- package/dist/execution/agent.d.ts +3 -3
- package/dist/execution/agent.d.ts.map +1 -1
- package/dist/execution/agent.js +70 -82
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/durable.d.ts +1 -0
- package/dist/execution/durable.d.ts.map +1 -1
- package/dist/execution/primitive.d.ts +2 -0
- package/dist/execution/primitive.d.ts.map +1 -1
- package/dist/execution/primitive.js +63 -71
- package/dist/execution/primitive.js.map +3 -3
- package/dist/execution/request.d.ts +1 -0
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +65 -75
- package/dist/execution/request.js.map +3 -3
- package/dist/http/index.js +10 -11
- package/dist/http/index.js.map +1 -1
- package/dist/index.d.ts +14 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +455 -477
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +38 -42
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/logging/index.d.ts +3 -4
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/logging/index.js +18 -40
- package/dist/logging/index.js.map +1 -1
- package/dist/logging/internal.d.ts +5 -0
- package/dist/logging/internal.d.ts.map +1 -0
- package/dist/logging/internal.js +43 -0
- package/dist/logging/internal.js.map +9 -0
- package/dist/materialization/index.js +46 -49
- package/dist/materialization/index.js.map +1 -1
- package/dist/materializer/index.js +137 -145
- package/dist/materializer/index.js.map +1 -1
- package/dist/models/errors.d.ts +4 -0
- package/dist/models/errors.d.ts.map +1 -1
- package/dist/models/execution/binding.d.ts +9 -0
- package/dist/models/execution/binding.d.ts.map +1 -0
- package/dist/models/execution/errors.d.ts +9 -0
- package/dist/models/execution/errors.d.ts.map +1 -0
- package/dist/models/execution/index.d.ts +11 -0
- package/dist/models/execution/index.d.ts.map +1 -0
- package/dist/models/execution/index.js +55 -0
- package/dist/models/execution/index.js.map +9 -0
- package/dist/models/execution/model-call-accounting.d.ts +17 -0
- package/dist/models/execution/model-call-accounting.d.ts.map +1 -0
- package/dist/models/execution/model-call-admission.d.ts +47 -0
- package/dist/models/execution/model-call-admission.d.ts.map +1 -0
- package/dist/models/execution/model-call-limits.d.ts +15 -0
- package/dist/models/execution/model-call-limits.d.ts.map +1 -0
- package/dist/models/execution/model-call-recorder.d.ts +40 -0
- package/dist/models/execution/model-call-recorder.d.ts.map +1 -0
- package/dist/models/execution/model-call-recovery.d.ts +12 -0
- package/dist/models/execution/model-call-recovery.d.ts.map +1 -0
- package/dist/models/execution/recovery-queue.d.ts +5 -0
- package/dist/models/execution/recovery-queue.d.ts.map +1 -0
- package/dist/models/execution/types.d.ts +44 -0
- package/dist/models/execution/types.d.ts.map +1 -0
- package/dist/models/execution/usage.d.ts +5 -0
- package/dist/models/execution/usage.d.ts.map +1 -0
- package/dist/models/execution.d.ts +6 -0
- package/dist/models/execution.d.ts.map +1 -0
- package/dist/models/generation-types.d.ts +40 -0
- package/dist/models/generation-types.d.ts.map +1 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +42 -43
- package/dist/models/index.js.map +1 -1
- package/dist/models/language-model.d.ts +3 -0
- package/dist/models/language-model.d.ts.map +1 -1
- package/dist/models/output.d.ts +5 -0
- package/dist/models/output.d.ts.map +1 -0
- package/dist/models/resolve.d.ts +4 -0
- package/dist/models/resolve.d.ts.map +1 -0
- package/dist/objects/execution.d.ts.map +1 -1
- package/dist/objects/index.js +75 -87
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/query/index.js +67 -76
- package/dist/objects/query/index.js.map +1 -1
- package/dist/ontology/index.d.ts +1 -2
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +62 -113
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/internal.d.ts +7 -0
- package/dist/ontology/internal.d.ts.map +1 -1
- package/dist/ontology/internal.js +65 -116
- package/dist/ontology/internal.js.map +3 -4
- package/dist/pipelines/index.js +57 -66
- package/dist/pipelines/index.js.map +1 -1
- package/dist/projections/internal.js +58 -67
- package/dist/projections/internal.js.map +1 -1
- package/dist/query.d.ts +0 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +11 -15
- package/dist/query.js.map +1 -1
- package/dist/queues/index.d.ts +2 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +6 -7
- package/dist/queues/index.js.map +1 -1
- package/dist/queues/types.d.ts +3 -20
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/rules/internal.js +4 -5
- package/dist/rules/internal.js.map +1 -1
- package/dist/runtime/create.d.ts +2 -1
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +2 -1
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.js +13 -14
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/sixb.d.ts +2 -0
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/sandboxes/errors.d.ts +4 -0
- package/dist/sandboxes/errors.d.ts.map +1 -1
- package/dist/sandboxes/index.d.ts +2 -2
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +14 -13
- package/dist/sandboxes/index.js.map +1 -1
- package/dist/sandboxes/sandbox.d.ts +35 -7
- package/dist/sandboxes/sandbox.d.ts.map +1 -1
- package/dist/scheduler/index.js +9 -10
- package/dist/scheduler/index.js.map +1 -1
- package/dist/schedules/index.js +31 -33
- package/dist/schedules/index.js.map +1 -1
- package/dist/shares/internal.js +46 -54
- package/dist/shares/internal.js.map +2 -2
- package/dist/storage/action-runs/failure.js +7 -9
- package/dist/storage/action-runs/failure.js.map +1 -1
- package/dist/storage/action-runs/provider.js +4 -8
- package/dist/storage/action-runs/provider.js.map +1 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +26 -30
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +0 -3
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/attribution.d.ts +4 -0
- package/dist/storage/ai-cost/attribution.d.ts.map +1 -0
- package/dist/storage/ai-cost/groups.d.ts +3 -0
- package/dist/storage/ai-cost/groups.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.d.ts +1 -0
- package/dist/storage/ai-cost/provider.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +30 -143
- package/dist/storage/ai-cost/provider.js.map +3 -4
- package/dist/storage/ai-cost/types.d.ts +15 -0
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.js +14 -16
- package/dist/storage/ai-limits/enforcement.js.map +1 -1
- package/dist/storage/ai-limits/provider.js +56 -57
- package/dist/storage/ai-limits/provider.js.map +1 -1
- package/dist/storage/auth/in-memory.d.ts +1 -1
- package/dist/storage/auth/in-memory.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +34 -36
- package/dist/storage/connector-connections/provider.js.map +2 -2
- package/dist/storage/executions/in-memory.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +2 -1
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +14 -11
- package/dist/storage/executions/provider.js.map +3 -3
- package/dist/storage/executions/types.d.ts +6 -2
- package/dist/storage/executions/types.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts +2 -0
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +6 -7
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +221 -256
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +10 -0
- package/dist/storage/internal.d.ts.map +1 -0
- package/dist/storage/internal.js +47 -0
- package/dist/storage/internal.js.map +9 -0
- package/dist/storage/ontology/provider.js +105 -109
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/operation-scope.js +18 -19
- package/dist/storage/operation-scope.js.map +1 -1
- package/dist/storage/pipeline-runs/provider.js +4 -6
- package/dist/storage/pipeline-runs/provider.js.map +1 -1
- package/dist/storage/projection-runs/provider.js +66 -70
- package/dist/storage/projection-runs/provider.js.map +1 -1
- package/dist/storage/share-grants/provider.js +17 -19
- package/dist/storage/share-grants/provider.js.map +1 -1
- package/dist/storage/share-sessions/provider.js +14 -15
- package/dist/storage/share-sessions/provider.js.map +1 -1
- package/dist/storage/sync-runs/provider.js +4 -6
- package/dist/storage/sync-runs/provider.js.map +1 -1
- package/dist/storage/webhook-runs/provider.js +4 -6
- package/dist/storage/webhook-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +13 -21
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/types.d.ts +0 -3
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/index.js +55 -65
- package/dist/syncs/index.js.map +1 -1
- package/dist/testing/action-execution.d.ts +4 -1
- package/dist/testing/action-execution.d.ts.map +1 -1
- package/dist/testing/agent-execution.d.ts +1 -0
- package/dist/testing/agent-execution.d.ts.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution.d.ts +1 -0
- package/dist/testing/execution.d.ts.map +1 -1
- package/dist/testing/index.js +911 -799
- package/dist/testing/index.js.map +9 -9
- package/dist/testing/workflow-execution.d.ts +1 -0
- package/dist/testing/workflow-execution.d.ts.map +1 -1
- package/dist/webhooks/internal.js +51 -59
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +11 -13
- package/dist/workers/index.js.map +2 -2
- package/dist/workflows/failure.d.ts +2 -0
- package/dist/workflows/failure.d.ts.map +1 -1
- package/dist/workflows/index.js +135 -147
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/run-dispatch.d.ts +0 -1
- package/dist/workflows/run-dispatch.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +2 -0
- package/dist/workflows/types.d.ts.map +1 -1
- package/package.json +48 -30
- package/src/actions/run-dispatch.ts +2 -6
- package/src/actions/types/context.ts +2 -0
- package/src/actions/validation.ts +2 -1
- package/src/agents/adapters.ts +4 -9
- package/src/agents/{context.ts → context/entries.ts} +4 -4
- package/src/agents/context/index.ts +15 -0
- package/src/agents/context-model.ts +1 -1
- package/src/agents/context-resolution.ts +1 -1
- package/src/agents/index.ts +4 -4
- package/src/agents/message.ts +1 -1
- package/src/agents/model-loop.ts +8 -0
- package/src/agents/request.ts +11 -26
- package/src/agents/streams/index.ts +18 -0
- package/src/agents/streams/internal.ts +19 -0
- package/src/agents/{streams.ts → streams/protocol.ts} +5 -5
- package/src/agents/types.ts +1 -1
- package/src/agents/validation.ts +3 -7
- package/src/auth/index.ts +0 -1
- package/src/bootstrap/discovery.ts +81 -24
- package/src/bootstrap/index.ts +8 -1
- package/src/errors/internal.ts +90 -10
- package/src/errors/redaction.ts +98 -0
- package/src/errors/types.ts +4 -0
- package/src/execution/agent.ts +5 -3
- package/src/execution/durable.ts +11 -1
- package/src/execution/primitive.ts +5 -1
- package/src/execution/request.ts +3 -0
- package/src/index.ts +20 -18
- package/src/logging/index.ts +2 -33
- package/src/logging/internal.ts +43 -0
- package/src/models/errors.ts +12 -0
- package/src/models/execution/binding.ts +29 -0
- package/src/models/execution/errors.ts +18 -0
- package/src/models/execution/index.ts +26 -0
- package/src/models/execution/model-call-accounting.ts +211 -0
- package/src/models/execution/model-call-admission.ts +127 -0
- package/src/models/execution/model-call-limits.ts +135 -0
- package/src/models/execution/model-call-recorder.ts +235 -0
- package/src/models/execution/model-call-recovery.ts +125 -0
- package/src/models/execution/recovery-queue.ts +31 -0
- package/src/models/execution/types.ts +58 -0
- package/src/models/execution/usage.ts +23 -0
- package/src/models/execution.ts +207 -0
- package/src/models/generation-types.ts +50 -0
- package/src/models/index.ts +8 -0
- package/src/models/language-model.ts +3 -0
- package/src/models/output.ts +45 -0
- package/src/models/resolve.ts +27 -0
- package/src/objects/execution.ts +1 -1
- package/src/ontology/index.ts +1 -2
- package/src/ontology/internal.ts +35 -0
- package/src/projections/run-dispatch.ts +1 -0
- package/src/query.ts +0 -1
- package/src/queues/index.ts +4 -2
- package/src/queues/types.ts +6 -25
- package/src/runtime/create.ts +2 -1
- package/src/runtime/host.ts +2 -1
- package/src/runtime/sixb.ts +4 -0
- package/src/sandboxes/errors.ts +5 -0
- package/src/sandboxes/index.ts +3 -0
- package/src/sandboxes/sandbox.ts +35 -7
- package/src/storage/agents/in-memory.ts +0 -3
- package/src/storage/agents/types.ts +0 -3
- package/src/storage/ai-cost/analytics.ts +1 -1
- package/src/storage/ai-cost/attribution.ts +15 -0
- package/src/storage/ai-cost/groups.ts +5 -1
- package/src/storage/ai-cost/provider.ts +1 -0
- package/src/storage/ai-cost/types.ts +7 -0
- package/src/storage/auth/in-memory.ts +1 -1
- package/src/storage/executions/in-memory.ts +4 -9
- package/src/storage/executions/provider.ts +4 -0
- package/src/storage/executions/types.ts +6 -2
- package/src/storage/executions/validation.ts +32 -0
- package/src/storage/in-memory/index.ts +16 -1
- package/src/storage/index.ts +3 -29
- package/src/storage/internal.ts +20 -0
- package/src/storage/workflow-runs/in-memory.ts +0 -2
- package/src/storage/workflow-runs/types.ts +0 -3
- package/src/testing/action-execution.ts +9 -2
- package/src/testing/agent-execution.ts +3 -0
- package/src/testing/agent-storage-contract.ts +0 -5
- package/src/testing/ai-model-call-groups-contract.ts +74 -2
- package/src/testing/execution-storage-contract.ts +59 -1
- package/src/testing/execution.ts +6 -0
- package/src/testing/workflow-execution.ts +4 -0
- package/src/workflows/failure.ts +62 -1
- package/src/workflows/request.ts +0 -9
- package/src/workflows/run-dispatch.ts +0 -3
- package/src/workflows/types.ts +2 -0
- package/src/workflows/validation.ts +1 -1
- package/dist/agents/context.d.ts.map +0 -1
- package/dist/agents/context.js +0 -23
- package/dist/agents/streams.d.ts.map +0 -1
- package/dist/agents/streams.js +0 -55
- package/dist/chunk-08m3b6w8.js +0 -32
- package/dist/chunk-19jp6g9d.js.map +0 -11
- package/dist/chunk-2xns679x.js.map +0 -11
- package/dist/chunk-3xep5cjx.js.map +0 -15
- package/dist/chunk-407j3msh.js +0 -60
- package/dist/chunk-4qfkag59.js +0 -1568
- package/dist/chunk-4qfkag59.js.map +0 -20
- package/dist/chunk-5e3pq99w.js.map +0 -11
- package/dist/chunk-7y0f6rf1.js.map +0 -10
- package/dist/chunk-ajnan18g.js.map +0 -12
- package/dist/chunk-c15dr03f.js +0 -43
- package/dist/chunk-d8qkxt2v.js.map +0 -10
- package/dist/chunk-jq43kdvk.js +0 -50
- package/dist/chunk-k522z7v6.js.map +0 -10
- package/dist/chunk-p03r0h5s.js.map +0 -16
- package/dist/chunk-p1rzczbt.js +0 -218
- package/dist/chunk-rafagrwr.js.map +0 -11
- package/dist/chunk-xajtptbw.js.map +0 -40
- package/dist/chunk-y64skrwp.js +0 -19
- package/dist/chunk-zcnhxkvd.js +0 -7
- package/dist/logging/types.js +0 -27
- package/dist/logging/types.js.map +0 -9
- /package/dist/{chunk-zqqz8052.js → chunk-7n30ybym.js} +0 -0
- /package/dist/{chunk-zqqz8052.js.map → chunk-7n30ybym.js.map} +0 -0
- /package/dist/{chunk-4a849fr1.js.map → chunk-9tc8dxmn.js.map} +0 -0
- /package/dist/{chunk-j1sbhm7p.js → chunk-ey1nk510.js} +0 -0
- /package/dist/{chunk-j1sbhm7p.js.map → chunk-ey1nk510.js.map} +0 -0
- /package/dist/{chunk-z4ccwbkz.js.map → chunk-x9v4cx1d.js.map} +0 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
MODEL_REASONING_LEVELS2,
|
|
4
|
+
isModelReasoning2
|
|
5
|
+
} from "./chunk-pqajwytd.js";
|
|
6
|
+
import {
|
|
7
|
+
findAgentRunExecution
|
|
8
|
+
} from "./chunk-ey1nk510.js";
|
|
9
|
+
import {
|
|
10
|
+
isFileRef2
|
|
11
|
+
} from "./chunk-h3v76ams.js";
|
|
12
|
+
|
|
13
|
+
// src/storage/agents/provider.ts
|
|
14
|
+
import { isDeepStrictEqual } from "util";
|
|
15
|
+
|
|
16
|
+
// src/agents/types.ts
|
|
17
|
+
var AGENT_REASONING_LEVELS2 = MODEL_REASONING_LEVELS2;
|
|
18
|
+
|
|
19
|
+
// src/storage/agents/errors.ts
|
|
20
|
+
class AgentStorageError2 extends Error {
|
|
21
|
+
code;
|
|
22
|
+
name = "AgentStorageError";
|
|
23
|
+
constructor(code, message) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.code = code;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/storage/agents/provider.ts
|
|
30
|
+
function assertConversationAgentRunSpec2(spec, prefix = "Sixb") {
|
|
31
|
+
if (!isRecord(spec) || !isRecord(spec.model)) {
|
|
32
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Conversational Agent run spec must contain a model reference.`);
|
|
33
|
+
}
|
|
34
|
+
for (const [name, value] of [
|
|
35
|
+
["model.provider", spec.model.provider],
|
|
36
|
+
["model.modelId", spec.model.modelId]
|
|
37
|
+
]) {
|
|
38
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
39
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Conversational Agent run '${name}' must not be empty.`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (spec.reasoning !== undefined && !isModelReasoning2(spec.reasoning)) {
|
|
43
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Conversational Agent reasoning must be one of: ${AGENT_REASONING_LEVELS2.join(", ")}, or a nonnegative budgetTokens object.`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function isRecord(value) {
|
|
47
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
48
|
+
}
|
|
49
|
+
async function assertAgentRunExecution2(input) {
|
|
50
|
+
const execution = await findAgentRunExecution({
|
|
51
|
+
executions: input.executions,
|
|
52
|
+
projectId: input.projectId,
|
|
53
|
+
executionId: input.executionId,
|
|
54
|
+
runId: input.runId,
|
|
55
|
+
authority: { type: "inherited" }
|
|
56
|
+
});
|
|
57
|
+
if (!execution) {
|
|
58
|
+
throw new AgentStorageError2("invalid_input", `[Sixb] Execution '${input.executionId}' does not authorize Agent run '${input.runId}'.`);
|
|
59
|
+
}
|
|
60
|
+
return execution;
|
|
61
|
+
}
|
|
62
|
+
function assertCreateSubagentRunInput2(input, prefix = "Sixb") {
|
|
63
|
+
for (const [name, value] of [
|
|
64
|
+
["id", input.id],
|
|
65
|
+
["projectId", input.projectId],
|
|
66
|
+
["executionId", input.executionId],
|
|
67
|
+
["parentRunId", input.parentRunId],
|
|
68
|
+
["parentExecutionToken", input.parentExecutionToken],
|
|
69
|
+
["spawnKey", input.spawnKey],
|
|
70
|
+
["model.provider", input.spec.model.provider],
|
|
71
|
+
["model.modelId", input.spec.model.modelId],
|
|
72
|
+
["task", input.spec.task]
|
|
73
|
+
]) {
|
|
74
|
+
if (value.trim().length === 0) {
|
|
75
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Subagent run '${name}' must not be empty.`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (input.spawnKey.length > 128) {
|
|
79
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Subagent spawn key must not exceed 128 characters.`);
|
|
80
|
+
}
|
|
81
|
+
for (const [name, value] of [
|
|
82
|
+
["maxActiveChildren", input.maxActiveChildren],
|
|
83
|
+
["spec.maxSteps", input.spec.maxSteps]
|
|
84
|
+
]) {
|
|
85
|
+
if (!Number.isSafeInteger(value) || value < 1) {
|
|
86
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Subagent run '${name}' must be a positive safe integer.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (new Set(input.spec.toolNames).size !== input.spec.toolNames.length) {
|
|
90
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Subagent run tool names must be unique.`);
|
|
91
|
+
}
|
|
92
|
+
if (input.spec.reasoning !== undefined && !isModelReasoning2(input.spec.reasoning)) {
|
|
93
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Subagent reasoning must be one of: ${AGENT_REASONING_LEVELS2.join(", ")}, or a nonnegative budgetTokens object.`);
|
|
94
|
+
}
|
|
95
|
+
if (input.spec.toolNames.some((name) => !name.trim())) {
|
|
96
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Subagent run tool names must not be empty.`);
|
|
97
|
+
}
|
|
98
|
+
if (input.createdAt && !Number.isFinite(input.createdAt.getTime())) {
|
|
99
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Subagent run createdAt must be a valid date.`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function subagentRunMatchesCreateInput2(run, input) {
|
|
103
|
+
return run.kind === "subagent" && run.id === input.id && run.projectId === input.projectId && run.executionId === input.executionId && run.parentRunId === input.parentRunId && run.spawnKey === input.spawnKey && isDeepStrictEqual(run.spec, input.spec);
|
|
104
|
+
}
|
|
105
|
+
function assertSubagentRunResult2(result, runId, prefix = "Sixb") {
|
|
106
|
+
const text = result?.text;
|
|
107
|
+
const files = result?.files;
|
|
108
|
+
const hasText = typeof text === "string" && text.trim().length > 0;
|
|
109
|
+
const hasFiles = Array.isArray(files) && files.length > 0 && files.every(isFileRef2);
|
|
110
|
+
if (!result || !hasText && !hasFiles) {
|
|
111
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Succeeded subagent run '${runId}' requires text or files.`);
|
|
112
|
+
}
|
|
113
|
+
if (text !== undefined && !hasText || files !== undefined && !hasFiles) {
|
|
114
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Subagent run '${runId}' has an invalid result.`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function assertCreateAgentContextCheckpointInput2(input, prefix = "Sixb") {
|
|
118
|
+
for (const [name, value] of [
|
|
119
|
+
["id", input.id],
|
|
120
|
+
["projectId", input.projectId],
|
|
121
|
+
["threadId", input.threadId],
|
|
122
|
+
["createdByRunId", input.createdByRunId],
|
|
123
|
+
["executionToken", input.executionToken],
|
|
124
|
+
["summary", input.summary],
|
|
125
|
+
["summaryModelId", input.summaryModelId]
|
|
126
|
+
]) {
|
|
127
|
+
if (value.trim().length === 0) {
|
|
128
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent context checkpoint '${name}' must not be empty.`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (input.summaryFormatVersion !== 1) {
|
|
132
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent context checkpoint summary format version must be 1.`);
|
|
133
|
+
}
|
|
134
|
+
if (input.reason !== "threshold" && input.reason !== "overflow") {
|
|
135
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent context checkpoint reason must be 'threshold' or 'overflow'.`);
|
|
136
|
+
}
|
|
137
|
+
if (input.expectedPreviousCheckpointId !== null && input.expectedPreviousCheckpointId.trim().length === 0) {
|
|
138
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent context checkpoint expected previous id must not be empty.`);
|
|
139
|
+
}
|
|
140
|
+
if (input.createdAt && !Number.isFinite(input.createdAt.getTime())) {
|
|
141
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent context checkpoint createdAt must be a valid date.`);
|
|
142
|
+
}
|
|
143
|
+
for (const [name, value, minimum] of [
|
|
144
|
+
["expectedHeadSeq", input.expectedHeadSeq, 1],
|
|
145
|
+
["summarizedThroughSeq", input.summarizedThroughSeq, 1],
|
|
146
|
+
["observedHeadSeq", input.observedHeadSeq, 1],
|
|
147
|
+
["estimatedInputTokensBefore", input.estimatedInputTokensBefore, 0],
|
|
148
|
+
["estimatedInputTokensAfter", input.estimatedInputTokensAfter, 0]
|
|
149
|
+
]) {
|
|
150
|
+
if (!Number.isSafeInteger(value) || value < minimum) {
|
|
151
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent context checkpoint '${name}' must be a safe integer greater than or equal to ${minimum}.`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (input.observedHeadSeq !== input.expectedHeadSeq) {
|
|
155
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent context checkpoint observed head must equal its expected message head.`);
|
|
156
|
+
}
|
|
157
|
+
if (input.summarizedThroughSeq >= input.observedHeadSeq) {
|
|
158
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent context checkpoint must retain the triggering head message.`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function assertAgentContextCheckpointAuthority2(input) {
|
|
162
|
+
const { create, run, thread } = input;
|
|
163
|
+
const prefix = input.prefix ?? "Sixb";
|
|
164
|
+
if (!run) {
|
|
165
|
+
throw new AgentStorageError2("run_not_found", `[${prefix}] Agent run '${create.createdByRunId}' not found for project '${create.projectId}'.`);
|
|
166
|
+
}
|
|
167
|
+
if (!thread) {
|
|
168
|
+
throw new AgentStorageError2("thread_not_found", `[${prefix}] Agent thread '${create.threadId}' not found for project '${create.projectId}'.`);
|
|
169
|
+
}
|
|
170
|
+
if (run.kind !== "conversation" || run.threadId !== create.threadId) {
|
|
171
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent run '${run.id}' does not belong to thread '${create.threadId}'.`);
|
|
172
|
+
}
|
|
173
|
+
if (run.status !== "running") {
|
|
174
|
+
throw new AgentStorageError2("invalid_state", `[${prefix}] Agent run '${run.id}' is not running (status '${run.status}').`);
|
|
175
|
+
}
|
|
176
|
+
if (!run.execution || run.execution.token !== create.executionToken) {
|
|
177
|
+
throw new AgentStorageError2("execution_lost", `[${prefix}] Execution token is no longer current on agent run '${run.id}'.`);
|
|
178
|
+
}
|
|
179
|
+
if (thread.activeRunId !== run.id) {
|
|
180
|
+
throw new AgentStorageError2("invalid_state", `[${prefix}] Agent run '${run.id}' no longer owns thread '${thread.id}'.`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function assertAgentContextCheckpointAnchors2(input) {
|
|
184
|
+
const { create, latest, headSeq, firstRetained } = input;
|
|
185
|
+
const prefix = input.prefix ?? "Sixb";
|
|
186
|
+
if (headSeq !== create.expectedHeadSeq) {
|
|
187
|
+
throw new AgentStorageError2("invalid_state", `[${prefix}] Agent thread '${create.threadId}' message head changed from ${create.expectedHeadSeq} to ${headSeq}.`);
|
|
188
|
+
}
|
|
189
|
+
const latestId = latest?.id ?? null;
|
|
190
|
+
if (latestId !== create.expectedPreviousCheckpointId) {
|
|
191
|
+
throw new AgentStorageError2("invalid_state", `[${prefix}] Agent thread '${create.threadId}' checkpoint head changed.`);
|
|
192
|
+
}
|
|
193
|
+
if (latest && create.summarizedThroughSeq <= latest.summarizedThroughSeq) {
|
|
194
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent context checkpoint boundary must advance beyond sequence ${latest.summarizedThroughSeq}.`);
|
|
195
|
+
}
|
|
196
|
+
if (!firstRetained || firstRetained.seq !== create.summarizedThroughSeq + 1) {
|
|
197
|
+
throw new AgentStorageError2("invalid_state", `[${prefix}] Agent context checkpoint boundary does not align with stored thread messages.`);
|
|
198
|
+
}
|
|
199
|
+
if (firstRetained.role !== "user") {
|
|
200
|
+
throw new AgentStorageError2("invalid_input", `[${prefix}] Agent context checkpoint must retain a complete turn beginning with a user message.`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function assertAgentContextCheckpointReplayState2(input) {
|
|
204
|
+
const prefix = input.prefix ?? "Sixb";
|
|
205
|
+
if (input.headSeq !== input.create.expectedHeadSeq) {
|
|
206
|
+
throw new AgentStorageError2("invalid_state", `[${prefix}] Agent thread '${input.create.threadId}' message head changed from ${input.create.expectedHeadSeq} to ${input.headSeq}.`);
|
|
207
|
+
}
|
|
208
|
+
if (input.latest?.id !== input.existing.id) {
|
|
209
|
+
throw new AgentStorageError2("invalid_state", `[${prefix}] Agent thread '${input.create.threadId}' checkpoint head changed after '${input.existing.id}'.`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function agentContextCheckpointMatchesCreateInput2(record, input) {
|
|
213
|
+
return record.id === input.id && record.projectId === input.projectId && record.threadId === input.threadId && record.createdByRunId === input.createdByRunId && (record.previousCheckpointId ?? null) === input.expectedPreviousCheckpointId && record.reason === input.reason && record.summary === input.summary && record.summaryFormatVersion === input.summaryFormatVersion && record.summarizedThroughSeq === input.summarizedThroughSeq && record.observedHeadSeq === input.observedHeadSeq && record.estimatedInputTokensBefore === input.estimatedInputTokensBefore && record.estimatedInputTokensAfter === input.estimatedInputTokensAfter && record.summaryModelId === input.summaryModelId;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export { AgentStorageError2, AGENT_REASONING_LEVELS2, assertConversationAgentRunSpec2, assertAgentRunExecution2, assertCreateSubagentRunInput2, subagentRunMatchesCreateInput2, assertSubagentRunResult2, assertCreateAgentContextCheckpointInput2, assertAgentContextCheckpointAuthority2, assertAgentContextCheckpointAnchors2, assertAgentContextCheckpointReplayState2, agentContextCheckpointMatchesCreateInput2 };
|
|
217
|
+
|
|
218
|
+
//# debugId=75F4EF2CC8E4D1CC64756E2164756E21
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
"sources": ["../src/storage/agents/provider.ts", "../src/agents/types.ts", "../src/storage/agents/errors.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import { isDeepStrictEqual } from \"node:util\"\nimport { AGENT_REASONING_LEVELS } from \"../../agents/types\"\nimport { isFileRef } from \"../../blob-storage\"\nimport { isModelReasoning } from \"../../models/language-model\"\nimport type { ExecutionRecord, ExecutionStorage } from \"../executions\"\nimport { findAgentRunExecution } from \"../executions/run-link\"\nimport { AgentStorageError } from \"./errors\"\nimport type {\n AgentContextCheckpointRecord,\n AgentMessageRecord,\n AgentRunRecord,\n AgentThreadRecord,\n ConversationAgentRunSpec,\n CreateAgentContextCheckpointInput,\n CreateSubagentRunInput,\n SubagentRunRecord,\n SubagentRunResult,\n} from \"./types\"\n\n/** Validate the provider-neutral model selection captured for a conversational turn. */\nexport function assertConversationAgentRunSpec(\n spec: ConversationAgentRunSpec,\n prefix = \"Sixb\"\n): void {\n if (!isRecord(spec) || !isRecord(spec.model)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Conversational Agent run spec must contain a model reference.`\n )\n }\n for (const [name, value] of [\n [\"model.provider\", spec.model.provider],\n [\"model.modelId\", spec.model.modelId],\n ] as const) {\n if (typeof value !== \"string\" || value.trim().length === 0) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Conversational Agent run '${name}' must not be empty.`\n )\n }\n }\n if (spec.reasoning !== undefined && !isModelReasoning(spec.reasoning)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Conversational Agent reasoning must be one of: ${AGENT_REASONING_LEVELS.join(\", \")}, or a nonnegative budgetTokens object.`\n )\n }\n}\n\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\n/** Validate the semantic link between a conversational Agent run and its immutable execution. */\nexport async function assertAgentRunExecution(input: {\n readonly executions: ExecutionStorage\n readonly projectId: string\n readonly executionId: string\n readonly runId: string\n}): Promise<ExecutionRecord> {\n const execution = await findAgentRunExecution({\n executions: input.executions,\n projectId: input.projectId,\n executionId: input.executionId,\n runId: input.runId,\n authority: { type: \"inherited\" },\n })\n if (!execution) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[Sixb] Execution '${input.executionId}' does not authorize Agent run '${input.runId}'.`\n )\n }\n return execution\n}\n\n/** Validate the provider-neutral payload of an idempotent child admission. */\nexport function assertCreateSubagentRunInput(input: CreateSubagentRunInput, prefix = \"Sixb\"): void {\n for (const [name, value] of [\n [\"id\", input.id],\n [\"projectId\", input.projectId],\n [\"executionId\", input.executionId],\n [\"parentRunId\", input.parentRunId],\n [\"parentExecutionToken\", input.parentExecutionToken],\n [\"spawnKey\", input.spawnKey],\n [\"model.provider\", input.spec.model.provider],\n [\"model.modelId\", input.spec.model.modelId],\n [\"task\", input.spec.task],\n ] as const) {\n if (value.trim().length === 0) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run '${name}' must not be empty.`\n )\n }\n }\n if (input.spawnKey.length > 128) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent spawn key must not exceed 128 characters.`\n )\n }\n for (const [name, value] of [\n [\"maxActiveChildren\", input.maxActiveChildren],\n [\"spec.maxSteps\", input.spec.maxSteps],\n ] as const) {\n if (!Number.isSafeInteger(value) || value < 1) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run '${name}' must be a positive safe integer.`\n )\n }\n }\n if (new Set(input.spec.toolNames).size !== input.spec.toolNames.length) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run tool names must be unique.`\n )\n }\n if (input.spec.reasoning !== undefined && !isModelReasoning(input.spec.reasoning)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent reasoning must be one of: ${AGENT_REASONING_LEVELS.join(\", \")}, or a nonnegative budgetTokens object.`\n )\n }\n if (input.spec.toolNames.some((name) => !name.trim())) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run tool names must not be empty.`\n )\n }\n if (input.createdAt && !Number.isFinite(input.createdAt.getTime())) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run createdAt must be a valid date.`\n )\n }\n}\n\n/** Exact semantic match required when a durable spawn key is replayed. */\nexport function subagentRunMatchesCreateInput(\n run: AgentRunRecord,\n input: CreateSubagentRunInput\n): run is SubagentRunRecord {\n return (\n run.kind === \"subagent\" &&\n run.id === input.id &&\n run.projectId === input.projectId &&\n run.executionId === input.executionId &&\n run.parentRunId === input.parentRunId &&\n run.spawnKey === input.spawnKey &&\n isDeepStrictEqual(run.spec, input.spec)\n )\n}\n\n/** Validate the small durable result returned by a successful child. */\nexport function assertSubagentRunResult(\n result: SubagentRunResult | undefined,\n runId: string,\n prefix = \"Sixb\"\n): asserts result is SubagentRunResult {\n const text = result?.text\n const files = result?.files\n const hasText = typeof text === \"string\" && text.trim().length > 0\n const hasFiles = Array.isArray(files) && files.length > 0 && files.every(isFileRef)\n if (!result || (!hasText && !hasFiles)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Succeeded subagent run '${runId}' requires text or files.`\n )\n }\n if ((text !== undefined && !hasText) || (files !== undefined && !hasFiles)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run '${runId}' has an invalid result.`\n )\n }\n}\n\n/** Validate provider-independent checkpoint fields before entering a storage critical section. */\nexport function assertCreateAgentContextCheckpointInput(\n input: CreateAgentContextCheckpointInput,\n prefix = \"Sixb\"\n): void {\n for (const [name, value] of [\n [\"id\", input.id],\n [\"projectId\", input.projectId],\n [\"threadId\", input.threadId],\n [\"createdByRunId\", input.createdByRunId],\n [\"executionToken\", input.executionToken],\n [\"summary\", input.summary],\n [\"summaryModelId\", input.summaryModelId],\n ] as const) {\n if (value.trim().length === 0) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint '${name}' must not be empty.`\n )\n }\n }\n\n if (input.summaryFormatVersion !== 1) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint summary format version must be 1.`\n )\n }\n if (input.reason !== \"threshold\" && input.reason !== \"overflow\") {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint reason must be 'threshold' or 'overflow'.`\n )\n }\n if (\n input.expectedPreviousCheckpointId !== null &&\n input.expectedPreviousCheckpointId.trim().length === 0\n ) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint expected previous id must not be empty.`\n )\n }\n if (input.createdAt && !Number.isFinite(input.createdAt.getTime())) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint createdAt must be a valid date.`\n )\n }\n\n for (const [name, value, minimum] of [\n [\"expectedHeadSeq\", input.expectedHeadSeq, 1],\n [\"summarizedThroughSeq\", input.summarizedThroughSeq, 1],\n [\"observedHeadSeq\", input.observedHeadSeq, 1],\n [\"estimatedInputTokensBefore\", input.estimatedInputTokensBefore, 0],\n [\"estimatedInputTokensAfter\", input.estimatedInputTokensAfter, 0],\n ] as const) {\n if (!Number.isSafeInteger(value) || value < minimum) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint '${name}' must be a safe integer greater than or equal to ${minimum}.`\n )\n }\n }\n\n if (input.observedHeadSeq !== input.expectedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint observed head must equal its expected message head.`\n )\n }\n if (input.summarizedThroughSeq >= input.observedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint must retain the triggering head message.`\n )\n }\n}\n\n/** Assert that the current delivery still owns the active conversational run. */\nexport function assertAgentContextCheckpointAuthority(input: {\n readonly create: CreateAgentContextCheckpointInput\n readonly run: AgentRunRecord | null\n readonly thread: AgentThreadRecord | null\n readonly prefix?: string\n}): asserts input is typeof input & {\n readonly run: AgentRunRecord\n readonly thread: AgentThreadRecord\n} {\n const { create, run, thread } = input\n const prefix = input.prefix ?? \"Sixb\"\n if (!run) {\n throw new AgentStorageError(\n \"run_not_found\",\n `[${prefix}] Agent run '${create.createdByRunId}' not found for project '${create.projectId}'.`\n )\n }\n if (!thread) {\n throw new AgentStorageError(\n \"thread_not_found\",\n `[${prefix}] Agent thread '${create.threadId}' not found for project '${create.projectId}'.`\n )\n }\n if (run.kind !== \"conversation\" || run.threadId !== create.threadId) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent run '${run.id}' does not belong to thread '${create.threadId}'.`\n )\n }\n if (run.status !== \"running\") {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent run '${run.id}' is not running (status '${run.status}').`\n )\n }\n if (!run.execution || run.execution.token !== create.executionToken) {\n throw new AgentStorageError(\n \"execution_lost\",\n `[${prefix}] Execution token is no longer current on agent run '${run.id}'.`\n )\n }\n if (thread.activeRunId !== run.id) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent run '${run.id}' no longer owns thread '${thread.id}'.`\n )\n }\n}\n\n/** Assert both compare-and-swap anchors and the retained-turn boundary. */\nexport function assertAgentContextCheckpointAnchors(input: {\n readonly create: CreateAgentContextCheckpointInput\n readonly latest: AgentContextCheckpointRecord | null\n readonly headSeq: number\n readonly firstRetained: AgentMessageRecord | null\n readonly prefix?: string\n}): void {\n const { create, latest, headSeq, firstRetained } = input\n const prefix = input.prefix ?? \"Sixb\"\n if (headSeq !== create.expectedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${create.threadId}' message head changed from ${create.expectedHeadSeq} to ${headSeq}.`\n )\n }\n\n const latestId = latest?.id ?? null\n if (latestId !== create.expectedPreviousCheckpointId) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${create.threadId}' checkpoint head changed.`\n )\n }\n if (latest && create.summarizedThroughSeq <= latest.summarizedThroughSeq) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint boundary must advance beyond sequence ${latest.summarizedThroughSeq}.`\n )\n }\n if (!firstRetained || firstRetained.seq !== create.summarizedThroughSeq + 1) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent context checkpoint boundary does not align with stored thread messages.`\n )\n }\n if (firstRetained.role !== \"user\") {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint must retain a complete turn beginning with a user message.`\n )\n }\n}\n\n/** Validate the mutable anchors again before returning an idempotently created checkpoint. */\nexport function assertAgentContextCheckpointReplayState(input: {\n readonly create: CreateAgentContextCheckpointInput\n readonly existing: AgentContextCheckpointRecord\n readonly latest: AgentContextCheckpointRecord | null\n readonly headSeq: number\n readonly prefix?: string\n}): void {\n const prefix = input.prefix ?? \"Sixb\"\n if (input.headSeq !== input.create.expectedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${input.create.threadId}' message head changed from ${input.create.expectedHeadSeq} to ${input.headSeq}.`\n )\n }\n if (input.latest?.id !== input.existing.id) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${input.create.threadId}' checkpoint head changed after '${input.existing.id}'.`\n )\n }\n}\n\n/** Compare the durable semantic payload; delivery token and generated timestamp are not content. */\nexport function agentContextCheckpointMatchesCreateInput(\n record: AgentContextCheckpointRecord,\n input: CreateAgentContextCheckpointInput\n): boolean {\n return (\n record.id === input.id &&\n record.projectId === input.projectId &&\n record.threadId === input.threadId &&\n record.createdByRunId === input.createdByRunId &&\n (record.previousCheckpointId ?? null) === input.expectedPreviousCheckpointId &&\n record.reason === input.reason &&\n record.summary === input.summary &&\n record.summaryFormatVersion === input.summaryFormatVersion &&\n record.summarizedThroughSeq === input.summarizedThroughSeq &&\n record.observedHeadSeq === input.observedHeadSeq &&\n record.estimatedInputTokensBefore === input.estimatedInputTokensBefore &&\n record.estimatedInputTokensAfter === input.estimatedInputTokensAfter &&\n record.summaryModelId === input.summaryModelId\n )\n}\n",
|
|
6
|
-
"import type { BlobBody, FileRef } from \"../blob-storage\"\nimport type { ConnectorRuntime } from \"../connectors\"\nimport type { JsonPrimitive, JsonValue, ReadonlyJsonValue } from \"../json\"\nimport type { Logger } from \"../logging\"\nimport { type LanguageModelRef, MODEL_REASONING_LEVELS, type ModelReasoning } from \"../models\"\nimport type { InferSchema } from \"../ontology/inference\"\nimport type { Schema } from \"../ontology/types\"\n\nexport type {\n AgentContextEntryInput,\n AgentContextInput,\n AgentContextOrigin,\n AgentContextPart,\n} from \"./context\"\n\n/** Public capability reference used by security grants such as `can.run(agent)`. */\nexport interface AgentReference {\n readonly kind: \"agent\"\n readonly usage: AgentUsageReference\n}\n\n/** Project-wide AI accounting and limit capability, independent of permission to run the Agent. */\nexport interface AgentUsageReference {\n readonly kind: \"aiUsage\"\n}\n\n/** Public metadata for the project's conversational Agent. */\nexport interface AgentDescriptor {\n readonly name: string\n readonly model: LanguageModelRef\n}\n\nexport type AgentReasoning = ModelReasoning\n\n/** @deprecated Use {@link AgentReasoning}. */\nexport type AgentReasoningLevel = AgentReasoning\n\nexport const AGENT_REASONING_LEVELS = MODEL_REASONING_LEVELS\n\ntype Simplify<T> = { [K in keyof T]: T[K] } & {}\ntype JsonifyAgentToolInput<T> = unknown extends T\n ? ReadonlyJsonValue\n : T extends Date\n ? string\n : T extends readonly (infer TItem)[]\n ? readonly JsonifyAgentToolInput<TItem>[]\n : T extends JsonPrimitive\n ? T\n : T extends object\n ? { readonly [K in keyof T]: JsonifyAgentToolInput<T[K]> }\n : never\n\n/** A model-facing object shape expressed with Sixb's schema DSL. */\nexport type AgentToolInputSchema = Readonly<Record<string, Schema>>\n\n/** Infer the handler input represented by an agent tool schema. */\nexport type InferAgentToolInputSchema<TInput extends AgentToolInputSchema> =\n string extends keyof TInput\n ? Readonly<Record<string, unknown>>\n : Simplify<{\n readonly [K in keyof TInput]: JsonifyAgentToolInput<InferSchema<TInput[K]>>\n }>\n\n/** Identifies the conversational, workflow, or child Agent execution that invoked a tool. */\nexport type AgentToolRunInfo =\n | {\n readonly kind: \"conversation\"\n readonly id: string\n readonly threadId: string\n }\n | {\n readonly kind: \"subagent\"\n readonly id: string\n readonly parentRunId: string\n }\n | {\n readonly kind: \"workflow\"\n readonly id: string\n readonly workflowId: string\n readonly stepId: string\n }\n\n/** Input accepted by the run-scoped artifact publisher exposed to agent tools. */\nexport interface AgentToolArtifactPutInput {\n readonly body: BlobBody\n readonly fileName: string\n readonly mediaType?: string\n}\n\n/** A durable artifact and its path inside the current run sandbox. */\nexport interface AgentToolArtifact {\n readonly fileRef: FileRef\n readonly sandboxPath: string\n}\n\n/** The narrow artifact-writing surface available to an agent tool call. */\nexport interface AgentToolArtifacts {\n put(input: AgentToolArtifactPutInput): Promise<AgentToolArtifact>\n}\n\nexport type AgentToolTextContent = {\n readonly type: \"text\"\n readonly text: string\n}\n\nexport type AgentToolFileContent = {\n readonly type: \"file\"\n readonly fileRef: FileRef\n}\n\n/** Durable model-facing content returned by a file-aware tool. */\nexport type AgentToolContent = AgentToolTextContent | AgentToolFileContent\n\n/**\n * A file-aware tool result. The tag distinguishes this envelope from an ordinary JSON result while\n * keeping the whole value safe to persist in the durable tool-call trace.\n */\nexport type AgentToolResult = {\n readonly kind: \"agentToolResult\"\n readonly content: readonly AgentToolContent[]\n}\n\n/** The narrow, run-scoped surface passed to an agent tool handler. */\nexport interface AgentToolRunContext<\n TInput extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>,\n> {\n readonly input: TInput\n readonly toolCallId: string\n readonly signal: AbortSignal\n readonly run: AgentToolRunInfo\n readonly connector: ConnectorRuntime\n readonly logger: Logger\n readonly artifacts: AgentToolArtifacts\n}\n\n/** Agent tool handlers may return only values safe to persist in agent messages. */\nexport type AgentToolHandlerResult =\n | ReadonlyJsonValue\n | AgentToolResult\n | Promise<ReadonlyJsonValue | AgentToolResult>\n\nexport type AgentToolHandler<TInput extends Readonly<Record<string, unknown>>> = (\n context: AgentToolRunContext<TInput>\n) => AgentToolHandlerResult\n\n/**\n * Runtime definitions are stored heterogeneously. Keep variance erasure at this\n * boundary only; authoring through `run()` remains strictly contravariant.\n */\ntype StoredAgentToolHandler<TInput extends Readonly<Record<string, unknown>>> = {\n bivarianceHack(context: AgentToolRunContext<TInput>): JsonValue | Promise<JsonValue>\n}[\"bivarianceHack\"]\n\n/** A reusable, inert model tool definition selected explicitly by an agent. */\nexport interface AgentToolDefinition<\n TName extends string = string,\n TInput extends AgentToolInputSchema = AgentToolInputSchema,\n> {\n readonly kind: \"agentTool\"\n readonly name: TName\n readonly description: string\n readonly input: TInput\n readonly handler: StoredAgentToolHandler<InferAgentToolInputSchema<TInput>>\n}\n\n/** Infer the input received by a tool definition's handler. */\nexport type InferAgentToolInput<TTool extends AgentToolDefinition> = InferAgentToolInputSchema<\n TTool[\"input\"]\n>\n\nexport interface AgentToolRunBuilder<TName extends string, TInput extends AgentToolInputSchema> {\n run(\n handler: AgentToolHandler<InferAgentToolInputSchema<TInput>>\n ): AgentToolDefinition<TName, TInput>\n}\n\nexport interface AgentToolInputBuilder<TName extends string> {\n input<const TInput extends AgentToolInputSchema>(\n input: TInput\n ): AgentToolRunBuilder<TName, TInput>\n}\n\nexport interface AgentToolDescriptionBuilder<TName extends string> {\n description(description: string): AgentToolInputBuilder<TName>\n}\n",
|
|
6
|
+
"import type { BlobBody, FileRef } from \"../blob-storage\"\nimport type { ConnectorRuntime } from \"../connectors\"\nimport type { JsonPrimitive, JsonValue, ReadonlyJsonValue } from \"../json\"\nimport type { Logger } from \"../logging\"\nimport { type LanguageModelRef, MODEL_REASONING_LEVELS, type ModelReasoning } from \"../models\"\nimport type { InferSchema } from \"../ontology/inference\"\nimport type { Schema } from \"../ontology/types\"\n\nexport type {\n AgentContextEntryInput,\n AgentContextInput,\n AgentContextOrigin,\n AgentContextPart,\n} from \"./context/entries\"\n\n/** Public capability reference used by security grants such as `can.run(agent)`. */\nexport interface AgentReference {\n readonly kind: \"agent\"\n readonly usage: AgentUsageReference\n}\n\n/** Project-wide AI accounting and limit capability, independent of permission to run the Agent. */\nexport interface AgentUsageReference {\n readonly kind: \"aiUsage\"\n}\n\n/** Public metadata for the project's conversational Agent. */\nexport interface AgentDescriptor {\n readonly name: string\n readonly model: LanguageModelRef\n}\n\nexport type AgentReasoning = ModelReasoning\n\n/** @deprecated Use {@link AgentReasoning}. */\nexport type AgentReasoningLevel = AgentReasoning\n\nexport const AGENT_REASONING_LEVELS = MODEL_REASONING_LEVELS\n\ntype Simplify<T> = { [K in keyof T]: T[K] } & {}\ntype JsonifyAgentToolInput<T> = unknown extends T\n ? ReadonlyJsonValue\n : T extends Date\n ? string\n : T extends readonly (infer TItem)[]\n ? readonly JsonifyAgentToolInput<TItem>[]\n : T extends JsonPrimitive\n ? T\n : T extends object\n ? { readonly [K in keyof T]: JsonifyAgentToolInput<T[K]> }\n : never\n\n/** A model-facing object shape expressed with Sixb's schema DSL. */\nexport type AgentToolInputSchema = Readonly<Record<string, Schema>>\n\n/** Infer the handler input represented by an agent tool schema. */\nexport type InferAgentToolInputSchema<TInput extends AgentToolInputSchema> =\n string extends keyof TInput\n ? Readonly<Record<string, unknown>>\n : Simplify<{\n readonly [K in keyof TInput]: JsonifyAgentToolInput<InferSchema<TInput[K]>>\n }>\n\n/** Identifies the conversational, workflow, or child Agent execution that invoked a tool. */\nexport type AgentToolRunInfo =\n | {\n readonly kind: \"conversation\"\n readonly id: string\n readonly threadId: string\n }\n | {\n readonly kind: \"subagent\"\n readonly id: string\n readonly parentRunId: string\n }\n | {\n readonly kind: \"workflow\"\n readonly id: string\n readonly workflowId: string\n readonly stepId: string\n }\n\n/** Input accepted by the run-scoped artifact publisher exposed to agent tools. */\nexport interface AgentToolArtifactPutInput {\n readonly body: BlobBody\n readonly fileName: string\n readonly mediaType?: string\n}\n\n/** A durable artifact and its path inside the current run sandbox. */\nexport interface AgentToolArtifact {\n readonly fileRef: FileRef\n readonly sandboxPath: string\n}\n\n/** The narrow artifact-writing surface available to an agent tool call. */\nexport interface AgentToolArtifacts {\n put(input: AgentToolArtifactPutInput): Promise<AgentToolArtifact>\n}\n\nexport type AgentToolTextContent = {\n readonly type: \"text\"\n readonly text: string\n}\n\nexport type AgentToolFileContent = {\n readonly type: \"file\"\n readonly fileRef: FileRef\n}\n\n/** Durable model-facing content returned by a file-aware tool. */\nexport type AgentToolContent = AgentToolTextContent | AgentToolFileContent\n\n/**\n * A file-aware tool result. The tag distinguishes this envelope from an ordinary JSON result while\n * keeping the whole value safe to persist in the durable tool-call trace.\n */\nexport type AgentToolResult = {\n readonly kind: \"agentToolResult\"\n readonly content: readonly AgentToolContent[]\n}\n\n/** The narrow, run-scoped surface passed to an agent tool handler. */\nexport interface AgentToolRunContext<\n TInput extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>,\n> {\n readonly input: TInput\n readonly toolCallId: string\n readonly signal: AbortSignal\n readonly run: AgentToolRunInfo\n readonly connector: ConnectorRuntime\n readonly logger: Logger\n readonly artifacts: AgentToolArtifacts\n}\n\n/** Agent tool handlers may return only values safe to persist in agent messages. */\nexport type AgentToolHandlerResult =\n | ReadonlyJsonValue\n | AgentToolResult\n | Promise<ReadonlyJsonValue | AgentToolResult>\n\nexport type AgentToolHandler<TInput extends Readonly<Record<string, unknown>>> = (\n context: AgentToolRunContext<TInput>\n) => AgentToolHandlerResult\n\n/**\n * Runtime definitions are stored heterogeneously. Keep variance erasure at this\n * boundary only; authoring through `run()` remains strictly contravariant.\n */\ntype StoredAgentToolHandler<TInput extends Readonly<Record<string, unknown>>> = {\n bivarianceHack(context: AgentToolRunContext<TInput>): JsonValue | Promise<JsonValue>\n}[\"bivarianceHack\"]\n\n/** A reusable, inert model tool definition selected explicitly by an agent. */\nexport interface AgentToolDefinition<\n TName extends string = string,\n TInput extends AgentToolInputSchema = AgentToolInputSchema,\n> {\n readonly kind: \"agentTool\"\n readonly name: TName\n readonly description: string\n readonly input: TInput\n readonly handler: StoredAgentToolHandler<InferAgentToolInputSchema<TInput>>\n}\n\n/** Infer the input received by a tool definition's handler. */\nexport type InferAgentToolInput<TTool extends AgentToolDefinition> = InferAgentToolInputSchema<\n TTool[\"input\"]\n>\n\nexport interface AgentToolRunBuilder<TName extends string, TInput extends AgentToolInputSchema> {\n run(\n handler: AgentToolHandler<InferAgentToolInputSchema<TInput>>\n ): AgentToolDefinition<TName, TInput>\n}\n\nexport interface AgentToolInputBuilder<TName extends string> {\n input<const TInput extends AgentToolInputSchema>(\n input: TInput\n ): AgentToolRunBuilder<TName, TInput>\n}\n\nexport interface AgentToolDescriptionBuilder<TName extends string> {\n description(description: string): AgentToolInputBuilder<TName>\n}\n",
|
|
7
7
|
"export type AgentStorageErrorCode =\n | \"thread_not_found\"\n | \"active_run_exists\"\n | \"active_child_limit\"\n | \"run_not_found\"\n | \"invalid_input\"\n | \"invalid_state\"\n | \"execution_lost\"\n | \"duplicate_id\"\n\n/**\n * Error for agent-storage invariants and invalid state transitions (single-flight, execution\n * ownership, run lifecycle, message append). Callers branch on `code` rather than message text.\n */\nexport class AgentStorageError extends Error {\n readonly name = \"AgentStorageError\"\n\n constructor(\n readonly code: AgentStorageErrorCode,\n message: string\n ) {\n super(message)\n }\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";;;;;;;;;;;;;AAAA;;;ACqCO,IAAM,
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": ";;;;;;;;;;;;;AAAA;;;ACqCO,IAAM,0BAAyB;;;ACvB/B,MAAM,2BAA0B,MAAM;AAAA,EAIhC;AAAA,EAHF,OAAO;AAAA,EAEhB,WAAW,CACA,MACT,SACA;AAAA,IACA,MAAM,OAAO;AAAA,IAHJ;AAAA;AAKb;;;AFHO,SAAS,+BAA8B,CAC5C,MACA,SAAS,QACH;AAAA,EACN,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,KAAK,KAAK,GAAG;AAAA,IAC5C,MAAM,IAAI,mBACR,iBACA,IAAI,uEACN;AAAA,EACF;AAAA,EACA,YAAY,MAAM,UAAU;AAAA,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,0 +1,113 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
OntologyValidationError2
|
|
4
|
+
} from "./chunk-cqr3acm1.js";
|
|
5
|
+
|
|
6
|
+
// src/ontology/json-schema.ts
|
|
7
|
+
function schemaRecordToJsonSchema2(input) {
|
|
8
|
+
return schemaFieldsToJsonSchema2({
|
|
9
|
+
fields: Object.fromEntries(Object.entries(input.shape).map(([field, schema]) => [field, { schema, required: true }])),
|
|
10
|
+
valueTypesById: input.valueTypesById
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function schemaFieldsToJsonSchema2(input) {
|
|
14
|
+
const required = Object.entries(input.fields).filter(([, field]) => field.required === true).map(([field]) => field);
|
|
15
|
+
return {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: Object.fromEntries(Object.entries(input.fields).map(([fieldId, field]) => {
|
|
18
|
+
const fieldSchema = schemaOrRefJsonSchema(field.schema, input.valueTypesById, new Set);
|
|
19
|
+
return [fieldId, field.nullable ? { anyOf: [fieldSchema, { type: "null" }] } : fieldSchema];
|
|
20
|
+
})),
|
|
21
|
+
...required.length > 0 ? { required } : {},
|
|
22
|
+
additionalProperties: false
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function schemaOrRefJsonSchema(schema, valueTypesById, resolving) {
|
|
26
|
+
if (typeof schema !== "string" && schema.type === "objectRef") {
|
|
27
|
+
return {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {
|
|
30
|
+
objectTypeId: { type: "string", const: schema.objectTypeId },
|
|
31
|
+
primaryId: { type: "string" }
|
|
32
|
+
},
|
|
33
|
+
required: ["objectTypeId", "primaryId"],
|
|
34
|
+
additionalProperties: false
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return schemaJsonSchema(schema, valueTypesById, resolving);
|
|
38
|
+
}
|
|
39
|
+
function schemaJsonSchema(schema, valueTypesById, resolving) {
|
|
40
|
+
if (typeof schema === "string") {
|
|
41
|
+
switch (schema) {
|
|
42
|
+
case "string":
|
|
43
|
+
return { type: "string" };
|
|
44
|
+
case "integer":
|
|
45
|
+
return { type: "integer" };
|
|
46
|
+
case "double":
|
|
47
|
+
return { type: "number" };
|
|
48
|
+
case "decimal":
|
|
49
|
+
return { type: "string", pattern: "^[+-]?\\d+(?:\\.\\d+)?$" };
|
|
50
|
+
case "boolean":
|
|
51
|
+
return { type: "boolean" };
|
|
52
|
+
case "date":
|
|
53
|
+
return { type: "string", format: "date" };
|
|
54
|
+
case "timestamp":
|
|
55
|
+
return { type: "string", format: "date-time" };
|
|
56
|
+
case "uuid":
|
|
57
|
+
return { type: "string", format: "uuid" };
|
|
58
|
+
case "fileRef":
|
|
59
|
+
return {
|
|
60
|
+
type: "object",
|
|
61
|
+
properties: {
|
|
62
|
+
blobId: { type: "string" },
|
|
63
|
+
digest: { type: "string", pattern: "^sha256:[a-fA-F0-9]{64}$" },
|
|
64
|
+
sizeBytes: { type: "integer", minimum: 0 },
|
|
65
|
+
fileName: { type: "string" },
|
|
66
|
+
mediaType: { type: "string" },
|
|
67
|
+
logicalPath: { type: "string" }
|
|
68
|
+
},
|
|
69
|
+
required: ["blobId", "digest", "sizeBytes"],
|
|
70
|
+
additionalProperties: false
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (schema.type === "enum")
|
|
75
|
+
return { enum: [...schema.values] };
|
|
76
|
+
if (schema.type === "array") {
|
|
77
|
+
return { type: "array", items: schemaJsonSchema(schema.items, valueTypesById, resolving) };
|
|
78
|
+
}
|
|
79
|
+
if (schema.type === "map") {
|
|
80
|
+
return {
|
|
81
|
+
type: "object",
|
|
82
|
+
additionalProperties: schemaJsonSchema(schema.valueSchema, valueTypesById, resolving)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (schema.type === "object") {
|
|
86
|
+
const required = [];
|
|
87
|
+
const properties = Object.fromEntries(Object.entries(schema.properties).map(([fieldId, field]) => {
|
|
88
|
+
if (field.required)
|
|
89
|
+
required.push(fieldId);
|
|
90
|
+
const fieldSchema = schemaJsonSchema(field.schema, valueTypesById, resolving);
|
|
91
|
+
return [fieldId, field.nullable ? { anyOf: [fieldSchema, { type: "null" }] } : fieldSchema];
|
|
92
|
+
}));
|
|
93
|
+
return {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties,
|
|
96
|
+
...required.length > 0 ? { required } : {},
|
|
97
|
+
additionalProperties: false
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const valueTypeId = schema.valueTypeId;
|
|
101
|
+
if (resolving.has(valueTypeId)) {
|
|
102
|
+
throw new OntologyValidationError2(`Structured output contains a recursive value type '${valueTypeId}'.`);
|
|
103
|
+
}
|
|
104
|
+
const resolved = schema._resolved ?? valueTypesById.get(valueTypeId)?.schema;
|
|
105
|
+
if (!resolved) {
|
|
106
|
+
throw new OntologyValidationError2(`Structured output references unknown value type '${valueTypeId}'.`);
|
|
107
|
+
}
|
|
108
|
+
return schemaJsonSchema(resolved, valueTypesById, new Set([...resolving, valueTypeId]));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { schemaRecordToJsonSchema2, schemaFieldsToJsonSchema2 };
|
|
112
|
+
|
|
113
|
+
//# debugId=A6566067B08891D464756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/ontology/json-schema.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { JsonObject } from \"../json\"\nimport { OntologyValidationError } from \"./errors\"\nimport type { SchemaOrRef } from \"./refs\"\nimport type { Schema, ValueType } from \"./types\"\n\ntype DeepReadonly<T> = T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T\n\nexport interface SchemaJsonField {\n readonly schema: DeepReadonly<SchemaOrRef>\n readonly required?: boolean\n readonly nullable?: boolean\n}\n\n/** Convert a record of Sixb schemas into the strict JSON object schema used by model outputs. */\nexport function schemaRecordToJsonSchema(input: {\n readonly shape: Readonly<Record<string, DeepReadonly<SchemaOrRef>>>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n}): JsonObject {\n return schemaFieldsToJsonSchema({\n fields: Object.fromEntries(\n Object.entries(input.shape).map(([field, schema]) => [field, { schema, required: true }])\n ),\n valueTypesById: input.valueTypesById,\n })\n}\n\n/** Convert configured fields into the strict JSON object schema accepted at runtime. */\nexport function schemaFieldsToJsonSchema(input: {\n readonly fields: Readonly<Record<string, SchemaJsonField>>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n}): JsonObject {\n const required = Object.entries(input.fields)\n .filter(([, field]) => field.required === true)\n .map(([field]) => field)\n return {\n type: \"object\",\n properties: Object.fromEntries(\n Object.entries(input.fields).map(([fieldId, field]) => {\n const fieldSchema = schemaOrRefJsonSchema(field.schema, input.valueTypesById, new Set())\n return [fieldId, field.nullable ? { anyOf: [fieldSchema, { type: \"null\" }] } : fieldSchema]\n })\n ),\n ...(required.length > 0 ? { required } : {}),\n additionalProperties: false,\n }\n}\n\nfunction schemaOrRefJsonSchema(\n schema: DeepReadonly<SchemaOrRef>,\n valueTypesById: ReadonlyMap<string, ValueType>,\n resolving: ReadonlySet<string>\n): JsonObject {\n if (typeof schema !== \"string\" && schema.type === \"objectRef\") {\n return {\n type: \"object\",\n properties: {\n objectTypeId: { type: \"string\", const: schema.objectTypeId },\n primaryId: { type: \"string\" },\n },\n required: [\"objectTypeId\", \"primaryId\"],\n additionalProperties: false,\n }\n }\n return schemaJsonSchema(schema, valueTypesById, resolving)\n}\n\nfunction schemaJsonSchema(\n schema: DeepReadonly<Schema>,\n valueTypesById: ReadonlyMap<string, ValueType>,\n resolving: ReadonlySet<string>\n): JsonObject {\n if (typeof schema === \"string\") {\n switch (schema) {\n case \"string\":\n return { type: \"string\" }\n case \"integer\":\n return { type: \"integer\" }\n case \"double\":\n return { type: \"number\" }\n case \"decimal\":\n return { type: \"string\", pattern: \"^[+-]?\\\\d+(?:\\\\.\\\\d+)?$\" }\n case \"boolean\":\n return { type: \"boolean\" }\n case \"date\":\n return { type: \"string\", format: \"date\" }\n case \"timestamp\":\n return { type: \"string\", format: \"date-time\" }\n case \"uuid\":\n return { type: \"string\", format: \"uuid\" }\n case \"fileRef\":\n return {\n type: \"object\",\n properties: {\n blobId: { type: \"string\" },\n digest: { type: \"string\", pattern: \"^sha256:[a-fA-F0-9]{64}$\" },\n sizeBytes: { type: \"integer\", minimum: 0 },\n fileName: { type: \"string\" },\n mediaType: { type: \"string\" },\n logicalPath: { type: \"string\" },\n },\n required: [\"blobId\", \"digest\", \"sizeBytes\"],\n additionalProperties: false,\n }\n }\n }\n\n if (schema.type === \"enum\") return { enum: [...schema.values] }\n if (schema.type === \"array\") {\n return { type: \"array\", items: schemaJsonSchema(schema.items, valueTypesById, resolving) }\n }\n if (schema.type === \"map\") {\n return {\n type: \"object\",\n additionalProperties: schemaJsonSchema(schema.valueSchema, valueTypesById, resolving),\n }\n }\n if (schema.type === \"object\") {\n const required: string[] = []\n const properties = Object.fromEntries(\n Object.entries(schema.properties).map(([fieldId, field]) => {\n if (field.required) required.push(fieldId)\n const fieldSchema = schemaJsonSchema(field.schema, valueTypesById, resolving)\n return [fieldId, field.nullable ? { anyOf: [fieldSchema, { type: \"null\" }] } : fieldSchema]\n })\n )\n return {\n type: \"object\",\n properties,\n ...(required.length > 0 ? { required } : {}),\n additionalProperties: false,\n }\n }\n\n const valueTypeId = schema.valueTypeId\n if (resolving.has(valueTypeId)) {\n throw new OntologyValidationError(\n `Structured output contains a recursive value type '${valueTypeId}'.`\n )\n }\n const resolved = schema._resolved ?? valueTypesById.get(valueTypeId)?.schema\n if (!resolved) {\n throw new OntologyValidationError(\n `Structured output references unknown value type '${valueTypeId}'.`\n )\n }\n return schemaJsonSchema(resolved, valueTypesById, new Set([...resolving, valueTypeId]))\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;AAcO,SAAS,yBAAwB,CAAC,OAG1B;AAAA,EACb,OAAO,0BA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F;AAAA,EACA,IAAI,OAAO,SAAS,UAAU;AAAA,IAC5B,MAAM,WAAqB,CAAC;AAAA,IAC5B,MAAM,aAAa,OAAO,YACxB,OAAO,QAAQ,OAAO,UAAU,EAAE,IAAI,EAAE,SAAS,WAAW;AAAA,MAC1D,IAAI,MAAM;AAAA,QAAU,SAAS,KAAK,OAAO;AAAA,MACzC,MAAM,cAAc,iBAAiB,MAAM,QAAQ,gBAAgB,SAAS;AAAA,MAC5E,OAAO,CAAC,SAAS,MAAM,WAAW,EAAE,OAAO,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,EAAE,IAAI,WAAW;AAAA,KAC3F,CACH;AAAA,IACA,OAAO;AAAA,MACL,MAAM;AAAA,MACN;AAAA,SACI,SAAS,SAAS,IAAI,EAAE,SAAS,IAAI,CAAC;AAAA,MAC1C,sBAAsB;AAAA,IACxB;AAAA,EACF;AAAA,EAEA,MAAM,cAAc,OAAO;AAAA,EAC3B,IAAI,UAAU,IAAI,WAAW,GAAG;AAAA,IAC9B,MAAM,IAAI,yBACR,sDAAsD,eACxD;AAAA,EACF;AAAA,EACA,MAAM,WAAW,OAAO,aAAa,eAAe,IAAI,WAAW,GAAG;AAAA,EACtE,IAAI,CAAC,UAAU;AAAA,IACb,MAAM,IAAI,yBACR,oDAAoD,eACtD;AAAA,EACF;AAAA,EACA,OAAO,iBAAiB,UAAU,gBAAgB,IAAI,IAAI,CAAC,GAAG,WAAW,WAAW,CAAC,CAAC;AAAA;",
|
|
8
|
+
"debugId": "A6566067B08891D464756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
isDecimalString2
|
|
4
|
+
} from "./chunk-3bh94gbw.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
isFileRef2
|
|
7
|
+
} from "./chunk-h3v76ams.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
9
|
+
isJsonValue2,
|
|
10
10
|
isPlainRecord
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-wy0qdqfm.js";
|
|
12
12
|
|
|
13
13
|
// src/datasets/errors.ts
|
|
14
|
-
class
|
|
14
|
+
class DatasetValidationError2 extends Error {
|
|
15
15
|
name = "DatasetValidationError";
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ class DatasetValidationError extends Error {
|
|
|
19
19
|
var MIN_INT64 = -(1n << 63n);
|
|
20
20
|
var MAX_INT64 = (1n << 63n) - 1n;
|
|
21
21
|
function datasetSequenceValue(dataset, value) {
|
|
22
|
-
const column = dataset.schema.columns.find((
|
|
22
|
+
const column = dataset.schema.columns.find((column) => column.name === dataset.sequenceBy);
|
|
23
23
|
if (column?.type === "int64") {
|
|
24
24
|
if (typeof value === "number" && Number.isSafeInteger(value) || typeof value === "string" && /^-?\d+$/.test(value)) {
|
|
25
25
|
const integer = BigInt(value);
|
|
@@ -98,15 +98,15 @@ function matchesColumnType(value, type) {
|
|
|
98
98
|
case "float64":
|
|
99
99
|
return typeof value === "number" && Number.isFinite(value);
|
|
100
100
|
case "decimal":
|
|
101
|
-
return
|
|
101
|
+
return isDecimalString2(value);
|
|
102
102
|
case "date":
|
|
103
103
|
return isValidDateValue(value) || isDateString(value);
|
|
104
104
|
case "timestamp":
|
|
105
105
|
return isValidDateValue(value) || isTimestampString(value);
|
|
106
106
|
case "json":
|
|
107
|
-
return
|
|
107
|
+
return isJsonValue2(value);
|
|
108
108
|
case "fileRef":
|
|
109
|
-
return
|
|
109
|
+
return isFileRef2(value);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
function assertNonEmptyString(value, field, createError) {
|
|
@@ -173,7 +173,7 @@ function assertDatasetPrimaryKey(primaryKey, schema, createError) {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function assertDatasetDefinition2(definition, createError = (message) => new DatasetValidationError2(message)) {
|
|
177
177
|
if (!isRecord(definition)) {
|
|
178
178
|
throw createError("Dataset definition must be an object.");
|
|
179
179
|
}
|
|
@@ -186,7 +186,7 @@ function assertDatasetDefinition(definition, createError = (message) => new Data
|
|
|
186
186
|
assertDatasetPrimaryKey(definition.primaryKey, definition.schema, createError);
|
|
187
187
|
}
|
|
188
188
|
if (definition.sequenceBy !== undefined) {
|
|
189
|
-
const column = definition.schema.columns.find((
|
|
189
|
+
const column = definition.schema.columns.find((column) => column.name === definition.sequenceBy);
|
|
190
190
|
if (definition.primaryKey === undefined || !column || column.nullable || !["timestamp", "int64"].includes(column.type)) {
|
|
191
191
|
throw createError("Dataset sequenceBy requires a primaryKey and a non-nullable timestamp or int64 column.");
|
|
192
192
|
}
|
|
@@ -207,15 +207,15 @@ function assertDatasetDefinition(definition, createError = (message) => new Data
|
|
|
207
207
|
throw createError("Dataset description must be a string.");
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function isDatasetDefinition2(value) {
|
|
211
211
|
try {
|
|
212
|
-
|
|
212
|
+
assertDatasetDefinition2(value, (message) => new Error(message));
|
|
213
213
|
return true;
|
|
214
214
|
} catch {
|
|
215
215
|
return false;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function getDatasetRowValidationError2(row, dataset, options) {
|
|
219
219
|
if (!isPlainRecord(row)) {
|
|
220
220
|
return `Dataset '${dataset.id}' rows must be plain objects.`;
|
|
221
221
|
}
|
|
@@ -274,18 +274,18 @@ function getColumnValidationError(row, column, dataset) {
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
// src/datasets/builders.ts
|
|
277
|
-
function
|
|
277
|
+
function col2(name, type, options) {
|
|
278
278
|
const column = {
|
|
279
279
|
name,
|
|
280
280
|
type,
|
|
281
281
|
...options?.nullable !== undefined ? { nullable: options.nullable } : {}
|
|
282
282
|
};
|
|
283
|
-
assertDatasetColumnDefinition(column, (message) => new
|
|
283
|
+
assertDatasetColumnDefinition(column, (message) => new DatasetValidationError2(message));
|
|
284
284
|
return column;
|
|
285
285
|
}
|
|
286
286
|
function assertDatasetId(id) {
|
|
287
287
|
if (!id.trim()) {
|
|
288
|
-
throw new
|
|
288
|
+
throw new DatasetValidationError2("Dataset id must not be empty.");
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
function createDatasetDefinition(id, options) {
|
|
@@ -302,32 +302,32 @@ function createDatasetDefinition(id, options) {
|
|
|
302
302
|
...options.sequenceBy !== undefined ? { sequenceBy: options.sequenceBy } : {},
|
|
303
303
|
...options.description !== undefined ? { description: options.description } : {}
|
|
304
304
|
};
|
|
305
|
-
|
|
305
|
+
assertDatasetDefinition2(definition, (message) => new DatasetValidationError2(message));
|
|
306
306
|
return definition;
|
|
307
307
|
}
|
|
308
308
|
function assertStringArray(value, field) {
|
|
309
309
|
if (!Array.isArray(value)) {
|
|
310
|
-
throw new
|
|
310
|
+
throw new DatasetValidationError2(`${field} must be an array of column names.`);
|
|
311
311
|
}
|
|
312
312
|
for (const item of value) {
|
|
313
313
|
if (typeof item !== "string" || !item.trim()) {
|
|
314
|
-
throw new
|
|
314
|
+
throw new DatasetValidationError2(`${field} must contain only non-empty column names.`);
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
function deriveDatasetDefinition(id, parent, options = {}) {
|
|
319
|
-
|
|
319
|
+
assertDatasetDefinition2(parent, (message) => new DatasetValidationError2(message));
|
|
320
320
|
if (options.pick !== undefined) {
|
|
321
321
|
assertStringArray(options.pick, "Dataset derive pick");
|
|
322
322
|
}
|
|
323
323
|
if (options.add !== undefined && !Array.isArray(options.add)) {
|
|
324
|
-
throw new
|
|
324
|
+
throw new DatasetValidationError2("Dataset derive add must be an array of columns.");
|
|
325
325
|
}
|
|
326
326
|
const parentColumnsByName = new Map(parent.schema.columns.map((column) => [column.name, column]));
|
|
327
327
|
const pickedColumns = options.pick === undefined ? parent.schema.columns : options.pick.map((columnName) => {
|
|
328
328
|
const column = parentColumnsByName.get(columnName);
|
|
329
329
|
if (column === undefined) {
|
|
330
|
-
throw new
|
|
330
|
+
throw new DatasetValidationError2(`Dataset derive pick column '${columnName}' is not declared on parent dataset '${parent.id}'.`);
|
|
331
331
|
}
|
|
332
332
|
return column;
|
|
333
333
|
});
|
|
@@ -346,7 +346,7 @@ function createDatasetDeriveBuilder(id) {
|
|
|
346
346
|
}
|
|
347
347
|
return { derive };
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function defineDataset2(id, options) {
|
|
350
350
|
if (options === undefined) {
|
|
351
351
|
return createDatasetDeriveBuilder(id);
|
|
352
352
|
}
|
|
@@ -354,7 +354,7 @@ function defineDataset(id, options) {
|
|
|
354
354
|
}
|
|
355
355
|
|
|
356
356
|
// src/datasets/changes.ts
|
|
357
|
-
var
|
|
357
|
+
var change2 = {
|
|
358
358
|
upsert(row) {
|
|
359
359
|
return { kind: "upsert", row };
|
|
360
360
|
},
|
|
@@ -363,6 +363,6 @@ var change = {
|
|
|
363
363
|
function deleteChange(key, options) {
|
|
364
364
|
return { kind: "delete", key, ...options ? { sequence: options.sequence } : {} };
|
|
365
365
|
}
|
|
366
|
-
export {
|
|
366
|
+
export { DatasetValidationError2, datasetSequenceValue, getDatasetSequenceValidationError, assertDatasetDefinition2, isDatasetDefinition2, getDatasetRowValidationError2, col2, defineDataset2, change2 };
|
|
367
367
|
|
|
368
|
-
//# debugId=
|
|
368
|
+
//# debugId=BCF2A8CF0204048364756E2164756E21
|