@sixb/core 0.2.2 → 0.2.3
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 +55 -49
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run/executor.d.ts +0 -2
- package/dist/actions/run/executor.d.ts.map +1 -1
- package/dist/actions/types/context.d.ts +5 -1
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +2 -1
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/fork.d.ts.map +1 -1
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +82 -75
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/request.d.ts +7 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-artifacts.d.ts +73 -10
- package/dist/agents/run-artifacts.d.ts.map +1 -1
- package/dist/agents/run-session-http.d.ts.map +1 -1
- package/dist/agents/run-session-serve.d.ts.map +1 -1
- package/dist/agents/run-session.d.ts +3 -0
- package/dist/agents/run-session.d.ts.map +1 -1
- package/dist/agents/streams/index.js +2 -2
- package/dist/agents/streams/internal.js +2 -2
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/artifacts/access.d.ts +37 -17
- package/dist/artifacts/access.d.ts.map +1 -1
- package/dist/artifacts/canvas-display.d.ts +65 -0
- package/dist/artifacts/canvas-display.d.ts.map +1 -0
- package/dist/artifacts/canvas.d.ts +6 -1
- package/dist/artifacts/canvas.d.ts.map +1 -1
- package/dist/artifacts/comment-text.d.ts +19 -0
- package/dist/artifacts/comment-text.d.ts.map +1 -0
- package/dist/artifacts/comments.d.ts +52 -0
- package/dist/artifacts/comments.d.ts.map +1 -0
- package/dist/artifacts/errors.d.ts +3 -3
- package/dist/artifacts/errors.d.ts.map +1 -1
- package/dist/artifacts/events.d.ts +14 -0
- package/dist/artifacts/events.d.ts.map +1 -0
- package/dist/artifacts/execution.d.ts +129 -22
- package/dist/artifacts/execution.d.ts.map +1 -1
- package/dist/artifacts/frames/assets.d.ts +12 -1
- package/dist/artifacts/frames/assets.d.ts.map +1 -1
- package/dist/artifacts/frames/grants.d.ts +8 -5
- package/dist/artifacts/frames/grants.d.ts.map +1 -1
- package/dist/artifacts/frames/index.d.ts +1 -1
- package/dist/artifacts/frames/index.d.ts.map +1 -1
- package/dist/artifacts/frames/index.js +32 -964
- package/dist/artifacts/frames/index.js.map +4 -8
- package/dist/artifacts/frames/kit.d.ts.map +1 -1
- package/dist/artifacts/frames/protocol.d.ts +78 -0
- package/dist/artifacts/frames/protocol.d.ts.map +1 -1
- package/dist/artifacts/frames/runtime.d.ts +17 -7
- package/dist/artifacts/frames/runtime.d.ts.map +1 -1
- package/dist/artifacts/holders.d.ts +23 -0
- package/dist/artifacts/holders.d.ts.map +1 -0
- package/dist/artifacts/ids.d.ts +2 -0
- package/dist/artifacts/ids.d.ts.map +1 -1
- package/dist/artifacts/index.d.ts +6 -4
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +108 -13
- package/dist/artifacts/index.js.map +5 -4
- package/dist/artifacts/limits.d.ts +24 -3
- package/dist/artifacts/limits.d.ts.map +1 -1
- package/dist/artifacts/live/board.d.ts +103 -0
- package/dist/artifacts/live/board.d.ts.map +1 -0
- package/dist/artifacts/live/diff.d.ts +43 -0
- package/dist/artifacts/live/diff.d.ts.map +1 -0
- package/dist/artifacts/live/document.d.ts +55 -0
- package/dist/artifacts/live/document.d.ts.map +1 -0
- package/dist/artifacts/live/files.d.ts +16 -0
- package/dist/artifacts/live/files.d.ts.map +1 -0
- package/dist/artifacts/live/index.d.ts +9 -0
- package/dist/artifacts/live/index.d.ts.map +1 -0
- package/dist/artifacts/live/index.js +593 -0
- package/dist/artifacts/live/index.js.map +10 -0
- package/dist/artifacts/live/presence.d.ts +55 -0
- package/dist/artifacts/live/presence.d.ts.map +1 -0
- package/dist/artifacts/live/protocol.d.ts +109 -0
- package/dist/artifacts/live/protocol.d.ts.map +1 -0
- package/dist/artifacts/live/protocol.js +21 -0
- package/dist/artifacts/live/protocol.js.map +9 -0
- package/dist/artifacts/live/server.d.ts +10 -0
- package/dist/artifacts/live/server.d.ts.map +1 -0
- package/dist/artifacts/live/server.js +86 -0
- package/dist/artifacts/live/server.js.map +9 -0
- package/dist/artifacts/live/state.d.ts +26 -0
- package/dist/artifacts/live/state.d.ts.map +1 -0
- package/dist/artifacts/outline.d.ts +11 -0
- package/dist/artifacts/outline.d.ts.map +1 -1
- package/dist/artifacts/publish/index.d.ts +8 -1
- package/dist/artifacts/publish/index.d.ts.map +1 -1
- package/dist/artifacts/publish/index.js +61 -33
- package/dist/artifacts/publish/index.js.map +1 -1
- package/dist/artifacts/publish/merge.d.ts +75 -0
- package/dist/artifacts/publish/merge.d.ts.map +1 -0
- package/dist/artifacts/publish/previews.d.ts +153 -0
- package/dist/artifacts/publish/previews.d.ts.map +1 -0
- package/dist/artifacts/publish/publish.d.ts +29 -8
- package/dist/artifacts/publish/publish.d.ts.map +1 -1
- package/dist/artifacts/publish/query-answers.d.ts +20 -0
- package/dist/artifacts/publish/query-answers.d.ts.map +1 -0
- package/dist/artifacts/publish/references.d.ts +4 -3
- package/dist/artifacts/publish/references.d.ts.map +1 -1
- package/dist/artifacts/publish/validate/canvas.d.ts.map +1 -1
- package/dist/artifacts/theme.d.ts +5 -1
- package/dist/artifacts/theme.d.ts.map +1 -1
- package/dist/auth/directory.d.ts +33 -0
- package/dist/auth/directory.d.ts.map +1 -0
- package/dist/auth/index.js +13 -12
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/member-events.d.ts +5 -1
- package/dist/auth/member-events.d.ts.map +1 -1
- package/dist/auth/runtime.d.ts +22 -1
- package/dist/auth/runtime.d.ts.map +1 -1
- package/dist/auth/strategy.d.ts +2 -2
- package/dist/auth/strategy.d.ts.map +1 -1
- package/dist/auth/types.d.ts +42 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/authorization/decision.d.ts +6 -5
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/event-visibility.d.ts.map +1 -1
- package/dist/authorization/index.js +7 -6
- package/dist/authorization/index.js.map +1 -1
- package/dist/blob-storage/index.js +4 -4
- package/dist/blob-storage/index.js.map +1 -1
- package/dist/bootstrap/index.js +62 -56
- package/dist/bootstrap/index.js.map +2 -2
- package/dist/broker/in-memory.d.ts.map +1 -1
- package/dist/broker/index.js +1 -1
- package/dist/broker/types.d.ts +4 -0
- package/dist/broker/types.d.ts.map +1 -1
- package/dist/{chunk-s7j8ewqv.js → chunk-0k3r5kb3.js} +257 -43
- package/dist/{chunk-s7j8ewqv.js.map → chunk-0k3r5kb3.js.map} +14 -13
- package/dist/{chunk-e5wf5vz0.js → chunk-0kgrghqx.js} +13 -1
- package/dist/chunk-0kgrghqx.js.map +10 -0
- package/dist/{chunk-80gym75n.js → chunk-186k5yz3.js} +1 -1
- package/dist/chunk-191jz8a6.js +61 -0
- package/dist/chunk-191jz8a6.js.map +10 -0
- package/dist/{chunk-mmagke4x.js → chunk-22d3qg4x.js} +2 -2
- package/dist/{chunk-mmagke4x.js.map → chunk-22d3qg4x.js.map} +3 -3
- package/dist/{chunk-m2vh8gh0.js → chunk-26qet7wh.js} +62 -15
- package/dist/{chunk-m2vh8gh0.js.map → chunk-26qet7wh.js.map} +5 -5
- package/dist/{chunk-eqgr6nsa.js → chunk-2by73sm2.js} +982 -184
- package/dist/chunk-2by73sm2.js.map +75 -0
- package/dist/chunk-2c4j899j.js.map +2 -2
- package/dist/{chunk-e6xgz4h4.js → chunk-3014rfjz.js} +197 -18
- package/dist/chunk-3014rfjz.js.map +21 -0
- package/dist/chunk-38yvdqzd.js +70 -0
- package/dist/chunk-38yvdqzd.js.map +10 -0
- package/dist/{chunk-ytzcxtpt.js → chunk-3ba89vm7.js} +1 -1
- package/dist/chunk-3hzhcfsv.js +139 -0
- package/dist/chunk-3hzhcfsv.js.map +10 -0
- package/dist/chunk-3sgvd10b.js +69 -0
- package/dist/chunk-3sgvd10b.js.map +10 -0
- package/dist/{chunk-djs3hw9p.js → chunk-3zagkr6w.js} +73 -6
- package/dist/chunk-3zagkr6w.js.map +21 -0
- package/dist/{chunk-wkq3kvzd.js → chunk-48c1z8nj.js} +6 -6
- package/dist/chunk-48c1z8nj.js.map +10 -0
- package/dist/{chunk-3sqqhpr7.js → chunk-4j0sagwv.js} +134 -19
- package/dist/{chunk-3sqqhpr7.js.map → chunk-4j0sagwv.js.map} +11 -10
- package/dist/{chunk-d04g36fw.js → chunk-5qqmndhm.js} +1 -1
- package/dist/{chunk-scyq22td.js → chunk-5rqqp8cr.js} +19 -4
- package/dist/chunk-5rqqp8cr.js.map +12 -0
- package/dist/{chunk-f1h34y3r.js → chunk-6gtxshcc.js} +6 -6
- package/dist/{chunk-f1h34y3r.js.map → chunk-6gtxshcc.js.map} +1 -1
- package/dist/{chunk-jspskey0.js → chunk-7j4yydm2.js} +67 -45
- package/dist/chunk-7j4yydm2.js.map +11 -0
- package/dist/{chunk-5wtnmpze.js → chunk-7qe46788.js} +1 -1
- package/dist/{chunk-31kcqmhf.js → chunk-855w9nvw.js} +1 -1
- package/dist/{chunk-e7v3trpz.js → chunk-8a8k38tz.js} +4 -3
- package/dist/chunk-8a8k38tz.js.map +10 -0
- package/dist/{chunk-2ajw5rz0.js → chunk-8p7bze4c.js} +3 -3
- package/dist/{chunk-jftd33rc.js → chunk-8t2ynwg0.js} +105 -9
- package/dist/chunk-8t2ynwg0.js.map +11 -0
- package/dist/{chunk-9whfmsfk.js → chunk-8tqnsx3q.js} +1 -1
- package/dist/{chunk-s3we74h8.js → chunk-9nsjjd44.js} +38 -5
- package/dist/chunk-9nsjjd44.js.map +12 -0
- package/dist/{chunk-hz5d43gn.js → chunk-9vsc919v.js} +14 -6
- package/dist/chunk-9vsc919v.js.map +10 -0
- package/dist/{chunk-waqk73p1.js → chunk-a6fjkcne.js} +185 -341
- package/dist/{chunk-waqk73p1.js.map → chunk-a6fjkcne.js.map} +6 -7
- package/dist/{chunk-s038wa5v.js → chunk-b9qfh2ya.js} +1 -1
- package/dist/{chunk-5taem5aw.js → chunk-bc3y6gff.js} +13 -4
- package/dist/chunk-bc3y6gff.js.map +10 -0
- package/dist/{chunk-w1btn96n.js → chunk-bkmnd7zq.js} +523 -254
- package/dist/chunk-bkmnd7zq.js.map +49 -0
- package/dist/chunk-bz5bnjjt.js +358 -0
- package/dist/chunk-bz5bnjjt.js.map +12 -0
- package/dist/{chunk-w976a4me.js → chunk-czct88ht.js} +28 -4
- package/dist/chunk-czct88ht.js.map +10 -0
- package/dist/{chunk-5kyvrtjh.js → chunk-d9xbwh3h.js} +131 -32
- package/dist/chunk-d9xbwh3h.js.map +13 -0
- package/dist/{chunk-kfee1h52.js → chunk-dfveegqq.js} +28 -8
- package/dist/chunk-dfveegqq.js.map +13 -0
- package/dist/{chunk-2g0r46hy.js → chunk-dhkc9b23.js} +15 -2
- package/dist/chunk-dhkc9b23.js.map +12 -0
- package/dist/chunk-dmnd9ea6.js +106 -0
- package/dist/chunk-dmnd9ea6.js.map +10 -0
- package/dist/{chunk-nz7815t3.js → chunk-e0hnbb1m.js} +27 -2
- package/dist/chunk-e0hnbb1m.js.map +14 -0
- package/dist/chunk-e91fmg6t.js +288 -0
- package/dist/chunk-e91fmg6t.js.map +11 -0
- package/dist/{chunk-a5v4gjdx.js → chunk-e9w4mgdh.js} +308 -220
- package/dist/{chunk-a5v4gjdx.js.map → chunk-e9w4mgdh.js.map} +21 -19
- package/dist/{chunk-w122ymx4.js → chunk-f6ahf5gf.js} +15 -4
- package/dist/{chunk-w122ymx4.js.map → chunk-f6ahf5gf.js.map} +3 -3
- package/dist/{chunk-jjmggm9a.js → chunk-fe6r7yhg.js} +1 -1
- package/dist/{chunk-165c9wm6.js → chunk-g2ph4873.js} +1 -1
- package/dist/chunk-hgj98cbb.js +22 -0
- package/dist/chunk-hgj98cbb.js.map +10 -0
- package/dist/{chunk-mbc5hvnj.js → chunk-hkaa807g.js} +18 -7
- package/dist/{chunk-mbc5hvnj.js.map → chunk-hkaa807g.js.map} +3 -3
- package/dist/chunk-hn2r7z41.js.map +3 -3
- package/dist/chunk-j0wgh8gv.js +250 -0
- package/dist/chunk-j0wgh8gv.js.map +10 -0
- package/dist/{chunk-z8fx5cgb.js → chunk-j2zm215x.js} +37 -3
- package/dist/chunk-j2zm215x.js.map +12 -0
- package/dist/{chunk-j1ny5fwh.js → chunk-k1g14kk3.js} +11 -83
- package/dist/{chunk-j1ny5fwh.js.map → chunk-k1g14kk3.js.map} +4 -5
- package/dist/{chunk-ga63a3dz.js → chunk-k66rp2hr.js} +3 -3
- package/dist/chunk-kr6dx38r.js +25 -0
- package/dist/chunk-kr6dx38r.js.map +10 -0
- package/dist/{chunk-a7aa0nzj.js → chunk-kv0kvknv.js} +14 -14
- package/dist/{chunk-a7aa0nzj.js.map → chunk-kv0kvknv.js.map} +1 -1
- package/dist/chunk-m2jerfef.js +474 -0
- package/dist/chunk-m2jerfef.js.map +11 -0
- package/dist/chunk-m7b9q5dk.js +234 -0
- package/dist/chunk-m7b9q5dk.js.map +12 -0
- package/dist/{chunk-escedwyt.js → chunk-mvz89age.js} +6 -1
- package/dist/{chunk-escedwyt.js.map → chunk-mvz89age.js.map} +3 -3
- package/dist/chunk-mwcqz3e3.js +30 -0
- package/dist/chunk-mwcqz3e3.js.map +10 -0
- package/dist/chunk-n2ay51px.js +21 -0
- package/dist/chunk-n2ay51px.js.map +10 -0
- package/dist/{chunk-gkv8r794.js → chunk-n68vz95m.js} +5 -5
- package/dist/{chunk-gkv8r794.js.map → chunk-n68vz95m.js.map} +3 -3
- package/dist/{chunk-0j3crh1w.js → chunk-p351afzm.js} +14 -14
- package/dist/{chunk-0j3crh1w.js.map → chunk-p351afzm.js.map} +4 -4
- package/dist/chunk-pk539cwv.js +370 -0
- package/dist/chunk-pk539cwv.js.map +11 -0
- package/dist/{chunk-jbw70d6t.js → chunk-ppxf7gw2.js} +52 -10
- package/dist/chunk-ppxf7gw2.js.map +11 -0
- package/dist/{chunk-9x8dybsb.js → chunk-pvpq483h.js} +10 -2
- package/dist/chunk-pvpq483h.js.map +10 -0
- package/dist/chunk-qafng88v.js +225 -0
- package/dist/chunk-qafng88v.js.map +11 -0
- package/dist/chunk-qds484t8.js +1363 -0
- package/dist/chunk-qds484t8.js.map +18 -0
- package/dist/{chunk-4zm1k3xj.js → chunk-r2psmn42.js} +1 -1
- package/dist/{chunk-kkjfve0t.js → chunk-rt9deb92.js} +4 -3
- package/dist/{chunk-kkjfve0t.js.map → chunk-rt9deb92.js.map} +3 -3
- package/dist/{chunk-r1cxq7vv.js → chunk-rtdrm592.js} +2 -2
- package/dist/{chunk-c7cfe31p.js → chunk-s5n9617r.js} +15 -15
- package/dist/{chunk-c7cfe31p.js.map → chunk-s5n9617r.js.map} +1 -1
- package/dist/{chunk-4bm0caep.js → chunk-smnt672s.js} +1 -1
- package/dist/{chunk-21q0j5f2.js → chunk-stmxh0hv.js} +2 -2
- package/dist/{chunk-nh26e7c5.js → chunk-sysnvjce.js} +5 -5
- package/dist/{chunk-nh26e7c5.js.map → chunk-sysnvjce.js.map} +3 -3
- package/dist/{chunk-57g0215c.js → chunk-t24yktqr.js} +296 -7
- package/dist/{chunk-57g0215c.js.map → chunk-t24yktqr.js.map} +6 -3
- package/dist/{chunk-ff5xkv0p.js → chunk-tfzvjdms.js} +1 -1
- package/dist/chunk-tqa68kj7.js +1322 -0
- package/dist/chunk-tqa68kj7.js.map +25 -0
- package/dist/chunk-vtjzwymr.js +37 -0
- package/dist/chunk-vtjzwymr.js.map +10 -0
- package/dist/{chunk-twfreyxr.js → chunk-vzkxqf8h.js} +23 -13
- package/dist/{chunk-twfreyxr.js.map → chunk-vzkxqf8h.js.map} +6 -6
- package/dist/{chunk-6b61s40c.js → chunk-w3t94hm6.js} +1 -1
- package/dist/{chunk-j8thxj7w.js → chunk-w9s23r24.js} +1218 -101
- package/dist/chunk-w9s23r24.js.map +30 -0
- package/dist/{chunk-fwsvshr5.js → chunk-wa05txmk.js} +20 -7
- package/dist/{chunk-fwsvshr5.js.map → chunk-wa05txmk.js.map} +3 -3
- package/dist/chunk-whbwf3np.js +12 -0
- package/dist/chunk-whbwf3np.js.map +10 -0
- package/dist/{chunk-t5608tkq.js → chunk-yv8hv4wq.js} +3 -1
- package/dist/{chunk-t5608tkq.js.map → chunk-yv8hv4wq.js.map} +3 -3
- package/dist/{chunk-dsv783c3.js → chunk-z0t4p2sk.js} +169 -53
- package/dist/{chunk-dsv783c3.js.map → chunk-z0t4p2sk.js.map} +7 -7
- package/dist/connectors/builders.d.ts +2 -2
- package/dist/connectors/builders.d.ts.map +1 -1
- package/dist/connectors/connections/access.d.ts +11 -0
- package/dist/connectors/connections/access.d.ts.map +1 -0
- package/dist/connectors/connections/contracts.d.ts +6 -1
- package/dist/connectors/connections/contracts.d.ts.map +1 -1
- package/dist/connectors/connections/internal.js +1 -1
- package/dist/connectors/connections/runs.d.ts +6 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/service.d.ts +25 -0
- package/dist/connectors/connections/service.d.ts.map +1 -1
- package/dist/connectors/connections/views.d.ts +1 -1
- package/dist/connectors/connections/views.d.ts.map +1 -1
- package/dist/connectors/execution.d.ts.map +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/service.d.ts +3 -0
- package/dist/connectors/service.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +21 -2
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/execution.d.ts +12 -6
- package/dist/datasets/execution.d.ts.map +1 -1
- package/dist/datasets/ingest-flush-batch.d.ts +59 -0
- package/dist/datasets/ingest-flush-batch.d.ts.map +1 -0
- package/dist/datasets/ingest-flush-job.d.ts +33 -0
- package/dist/datasets/ingest-flush-job.d.ts.map +1 -0
- package/dist/datasets/ingest-flush.d.ts +66 -0
- package/dist/datasets/ingest-flush.d.ts.map +1 -0
- package/dist/datasets/produced-version.d.ts +21 -0
- package/dist/datasets/produced-version.d.ts.map +1 -0
- package/dist/datasets/write.d.ts +22 -1
- package/dist/datasets/write.d.ts.map +1 -1
- package/dist/datasets/write.js +8 -4
- package/dist/datasets/write.js.map +1 -1
- package/dist/deploy/internal.js +5 -4
- package/dist/deploy/internal.js.map +4 -4
- package/dist/deploy/types.d.ts +2 -3
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/error-reporting/capability.d.ts +8 -2
- package/dist/error-reporting/capability.d.ts.map +1 -1
- package/dist/error-reporting/internal.d.ts +1 -1
- package/dist/error-reporting/internal.d.ts.map +1 -1
- package/dist/error-reporting/internal.js +17 -5
- package/dist/error-reporting/internal.js.map +1 -1
- package/dist/error-reporting/reporter.d.ts.map +1 -1
- package/dist/error-reporting/reports.d.ts +55 -0
- package/dist/error-reporting/reports.d.ts.map +1 -1
- package/dist/error-reporting/types.d.ts +82 -1
- package/dist/error-reporting/types.d.ts.map +1 -1
- package/dist/errors/catalog.d.ts +5 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/internal.js +1 -1
- package/dist/events/definitions.d.ts +4 -0
- package/dist/events/definitions.d.ts.map +1 -1
- package/dist/events/execution.d.ts +1 -0
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +5 -5
- package/dist/events/scope.d.ts.map +1 -1
- package/dist/events/scope.js +1 -1
- package/dist/events/selectors/index.js +2 -2
- package/dist/events/types/artifacts.d.ts +38 -0
- package/dist/events/types/artifacts.d.ts.map +1 -0
- package/dist/events/types/index.d.ts +3 -1
- package/dist/events/types/index.d.ts.map +1 -1
- package/dist/events/types/users.d.ts +5 -2
- package/dist/events/types/users.d.ts.map +1 -1
- package/dist/execution/agent.js +57 -51
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +10 -0
- package/dist/execution/authorized-object-reader.d.ts.map +1 -1
- package/dist/execution/object-reader-clearance.d.ts +6 -0
- package/dist/execution/object-reader-clearance.d.ts.map +1 -1
- package/dist/execution/object-reader-security.d.ts +9 -2
- package/dist/execution/object-reader-security.d.ts.map +1 -1
- package/dist/execution/primitive.js +55 -49
- package/dist/execution/primitive.js.map +1 -1
- package/dist/execution/request.js +49 -43
- package/dist/execution/request.js.map +2 -2
- package/dist/http/api-routes.d.ts +1 -1
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +95 -87
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/errors.d.ts +15 -0
- package/dist/lake-storage/errors.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +3 -2
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +16 -10
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/maintenance.d.ts +88 -0
- package/dist/lake-storage/maintenance.d.ts.map +1 -0
- package/dist/lake-storage/merge.d.ts +3 -1
- package/dist/lake-storage/merge.d.ts.map +1 -1
- package/dist/lake-storage/source-ordering.d.ts +23 -0
- package/dist/lake-storage/source-ordering.d.ts.map +1 -1
- package/dist/lake-storage/types.d.ts +10 -0
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/maintenance/heartbeat.d.ts +5 -0
- package/dist/maintenance/heartbeat.d.ts.map +1 -0
- package/dist/maintenance/index.d.ts +4 -2
- package/dist/maintenance/index.d.ts.map +1 -1
- package/dist/maintenance/index.js +515 -0
- package/dist/maintenance/index.js.map +16 -0
- package/dist/maintenance/lake-retention-status.d.ts +36 -0
- package/dist/maintenance/lake-retention-status.d.ts.map +1 -0
- package/dist/maintenance/lake-retention.d.ts +84 -0
- package/dist/maintenance/lake-retention.d.ts.map +1 -0
- package/dist/maintenance/loop.d.ts +95 -0
- package/dist/maintenance/loop.d.ts.map +1 -0
- package/dist/maintenance/ontology-maintenance.d.ts +17 -16
- package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
- package/dist/maintenance/passes/cron-pass.d.ts +21 -0
- package/dist/maintenance/passes/cron-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/directory-pass.d.ts +12 -0
- package/dist/maintenance/passes/directory-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/ingest-pass.d.ts +26 -0
- package/dist/maintenance/passes/ingest-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/lake-change-feed.d.ts +38 -0
- package/dist/maintenance/passes/lake-change-feed.d.ts.map +1 -0
- package/dist/maintenance/passes/lake-retention-pass.d.ts +20 -0
- package/dist/maintenance/passes/lake-retention-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/ontology-pass.d.ts +8 -0
- package/dist/maintenance/passes/ontology-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/projections-pass.d.ts +26 -0
- package/dist/maintenance/passes/projections-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/recovery-pass.d.ts +6 -0
- package/dist/maintenance/passes/recovery-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/recovery-passes.d.ts +24 -0
- package/dist/maintenance/passes/recovery-passes.d.ts.map +1 -0
- package/dist/maintenance/passes/runs-pass.d.ts +6 -0
- package/dist/maintenance/passes/runs-pass.d.ts.map +1 -0
- package/dist/maintenance/passes/triggers-pass.d.ts +41 -0
- package/dist/maintenance/passes/triggers-pass.d.ts.map +1 -0
- package/dist/maintenance/status.d.ts +19 -0
- package/dist/maintenance/status.d.ts.map +1 -0
- package/dist/maintenance/types.d.ts +25 -24
- package/dist/maintenance/types.d.ts.map +1 -1
- package/dist/materialization/model.d.ts +11 -2
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/edits/artifact-refs.d.ts +33 -0
- package/dist/materializer/edits/artifact-refs.d.ts.map +1 -0
- package/dist/materializer/edits/commit.d.ts.map +1 -1
- package/dist/materializer/edits/operations.d.ts +7 -1
- package/dist/materializer/edits/operations.d.ts.map +1 -1
- package/dist/materializer/edits/plan.d.ts.map +1 -1
- package/dist/materializer/execution/work-records.d.ts +6 -0
- package/dist/materializer/execution/work-records.d.ts.map +1 -1
- package/dist/materializer/index.js +30 -27
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/materializer/telemetry/plan.d.ts.map +1 -1
- package/dist/models/execution/index.js +29 -26
- package/dist/models/execution/index.js.map +1 -1
- package/dist/objects/artifact-refs.d.ts +5 -0
- package/dist/objects/artifact-refs.d.ts.map +1 -0
- package/dist/objects/index.js +58 -53
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/materializer-adapter.d.ts +4 -3
- package/dist/objects/materializer-adapter.d.ts.map +1 -1
- package/dist/objects/object/upsert-batch.d.ts.map +1 -1
- package/dist/objects/object/upsert.d.ts.map +1 -1
- package/dist/objects/query/index.js +28 -25
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/ir.d.ts +3 -1
- package/dist/objects/query/ir.d.ts.map +1 -1
- package/dist/objects/query/scalar-values.d.ts.map +1 -1
- package/dist/objects/runtime-batch.d.ts +2 -0
- package/dist/objects/runtime-batch.d.ts.map +1 -1
- package/dist/ontology/artifact-ref.d.ts +36 -0
- package/dist/ontology/artifact-ref.d.ts.map +1 -0
- package/dist/ontology/docs-markdown.d.ts.map +1 -1
- package/dist/ontology/index.d.ts +3 -1
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +8 -5
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/inference/index.d.ts +2 -0
- package/dist/ontology/inference/index.d.ts.map +1 -1
- package/dist/ontology/internal.js +7 -6
- package/dist/ontology/internal.js.map +1 -1
- package/dist/ontology/json-schema.d.ts.map +1 -1
- package/dist/ontology/primitives.d.ts.map +1 -1
- package/dist/ontology/reference-values.d.ts +10 -0
- package/dist/ontology/reference-values.d.ts.map +1 -0
- package/dist/ontology/refs.d.ts +6 -1
- package/dist/ontology/refs.d.ts.map +1 -1
- package/dist/ontology/registry.d.ts +9 -1
- package/dist/ontology/registry.d.ts.map +1 -1
- package/dist/ontology/types.d.ts +2 -1
- package/dist/ontology/types.d.ts.map +1 -1
- package/dist/ontology/user-ref.d.ts +16 -0
- package/dist/ontology/user-ref.d.ts.map +1 -1
- package/dist/ontology/validation/normalize.d.ts.map +1 -1
- package/dist/ontology/validation/properties.d.ts.map +1 -1
- package/dist/ontology/validation/schema.d.ts.map +1 -1
- package/dist/pending-tasks.d.ts +17 -0
- package/dist/pending-tasks.d.ts.map +1 -0
- package/dist/pipelines/index.js +36 -33
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/run-dispatch.d.ts +6 -0
- package/dist/pipelines/run-dispatch.d.ts.map +1 -1
- package/dist/predicates/types.d.ts +4 -0
- package/dist/predicates/types.d.ts.map +1 -1
- package/dist/projections/builders.d.ts +13 -11
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/internal.js +29 -26
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/types.d.ts +1 -1
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts +2 -2
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +6 -1
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +55 -2
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/create.d.ts +3 -0
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +22 -5
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +0 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +6 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +51 -30
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/sixb.d.ts +6 -1
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/sandboxes/index.js +8 -7
- package/dist/sandboxes/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +0 -2
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +3 -6
- package/dist/scheduler/index.js.map +1 -1
- package/dist/schedules/index.js +9 -11
- package/dist/schedules/index.js.map +1 -1
- package/dist/security/internal.js +1 -1
- package/dist/shared/backoff.d.ts +12 -0
- package/dist/shared/backoff.d.ts.map +1 -0
- package/dist/shared/duration.d.ts +3 -0
- package/dist/shared/duration.d.ts.map +1 -0
- package/dist/shared/params/artifact-refs.d.ts +19 -0
- package/dist/shared/params/artifact-refs.d.ts.map +1 -0
- package/dist/shares/guest-name.d.ts +8 -0
- package/dist/shares/guest-name.d.ts.map +1 -0
- package/dist/shares/internal.d.ts +1 -0
- package/dist/shares/internal.d.ts.map +1 -1
- package/dist/shares/internal.js +68 -27
- package/dist/shares/internal.js.map +3 -3
- package/dist/shares/session-protocol.d.ts +13 -0
- package/dist/shares/session-protocol.d.ts.map +1 -1
- package/dist/storage/action-runs/failure.js +2 -2
- package/dist/storage/ai-limits/enforcement.js +2 -2
- package/dist/storage/artifacts/errors.d.ts +9 -4
- package/dist/storage/artifacts/errors.d.ts.map +1 -1
- package/dist/storage/artifacts/in-memory.d.ts +27 -4
- package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
- package/dist/storage/artifacts/index.d.ts +1 -1
- package/dist/storage/artifacts/index.d.ts.map +1 -1
- package/dist/storage/artifacts/record.d.ts +39 -2
- package/dist/storage/artifacts/record.d.ts.map +1 -1
- package/dist/storage/artifacts/types.d.ts +328 -39
- package/dist/storage/artifacts/types.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts +2 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/identities.d.ts +4 -0
- package/dist/storage/auth/in-memory/identities.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/shared.d.ts +3 -1
- package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/users.d.ts.map +1 -1
- package/dist/storage/auth/index.d.ts +1 -1
- package/dist/storage/auth/index.d.ts.map +1 -1
- package/dist/storage/auth/types.d.ts +39 -0
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/connector-connections/in-memory.d.ts +1 -1
- package/dist/storage/connector-connections/in-memory.d.ts.map +1 -1
- package/dist/storage/connector-connections/index.d.ts +1 -1
- package/dist/storage/connector-connections/index.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider/runs.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider/shared.d.ts +12 -2
- package/dist/storage/connector-connections/provider/shared.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.d.ts +1 -0
- package/dist/storage/connector-connections/provider.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +21 -5
- package/dist/storage/connector-connections/provider.js.map +5 -5
- package/dist/storage/connector-connections/types.d.ts +1 -1
- package/dist/storage/connector-connections/types.d.ts.map +1 -1
- package/dist/storage/dataset-ingest/codec.d.ts +6 -0
- package/dist/storage/dataset-ingest/codec.d.ts.map +1 -0
- package/dist/storage/dataset-ingest/in-memory.d.ts +28 -0
- package/dist/storage/dataset-ingest/in-memory.d.ts.map +1 -0
- package/dist/storage/dataset-ingest/index.d.ts +4 -0
- package/dist/storage/dataset-ingest/index.d.ts.map +1 -0
- package/dist/storage/dataset-ingest/provider.d.ts +157 -0
- package/dist/storage/dataset-ingest/provider.d.ts.map +1 -0
- package/dist/storage/dataset-ingest/provider.js +17 -0
- package/dist/storage/dataset-ingest/provider.js.map +9 -0
- package/dist/storage/dataset-ingest/types.d.ts +188 -0
- package/dist/storage/dataset-ingest/types.d.ts.map +1 -0
- package/dist/storage/file-upload-sessions/provider.js +12 -11
- package/dist/storage/file-upload-sessions/provider.js.map +1 -1
- package/dist/storage/in-memory/index.d.ts +12 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +18 -11
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +55 -45
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +4 -1
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +81 -5
- package/dist/storage/internal.js.map +4 -3
- package/dist/storage/lake-retention-runs/in-memory.d.ts +11 -0
- package/dist/storage/lake-retention-runs/in-memory.d.ts.map +1 -0
- package/dist/storage/lake-retention-runs/index.d.ts +3 -0
- package/dist/storage/lake-retention-runs/index.d.ts.map +1 -0
- package/dist/storage/lake-retention-runs/types.d.ts +21 -0
- package/dist/storage/lake-retention-runs/types.d.ts.map +1 -0
- package/dist/storage/maintenance-heartbeats/in-memory.d.ts +11 -0
- package/dist/storage/maintenance-heartbeats/in-memory.d.ts.map +1 -0
- package/dist/storage/maintenance-heartbeats/index.d.ts +3 -0
- package/dist/storage/maintenance-heartbeats/index.d.ts.map +1 -0
- package/dist/storage/maintenance-heartbeats/record.d.ts +11 -0
- package/dist/storage/maintenance-heartbeats/record.d.ts.map +1 -0
- package/dist/storage/maintenance-heartbeats/types.d.ts +30 -0
- package/dist/storage/maintenance-heartbeats/types.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
- package/dist/storage/objects/in-memory/storage.d.ts +15 -1
- package/dist/storage/objects/in-memory/storage.d.ts.map +1 -1
- package/dist/storage/objects/read-scope.d.ts.map +1 -1
- package/dist/storage/objects/types.d.ts +18 -1
- package/dist/storage/objects/types.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts.map +1 -1
- package/dist/storage/ontology/index.d.ts +1 -1
- package/dist/storage/ontology/index.d.ts.map +1 -1
- package/dist/storage/ontology/materializations.d.ts +20 -0
- package/dist/storage/ontology/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/provider-work.d.ts +7 -1
- package/dist/storage/ontology/provider-work.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +1 -1
- package/dist/storage/pipeline-runs/in-memory.d.ts +8 -2
- package/dist/storage/pipeline-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/index.d.ts +1 -1
- package/dist/storage/pipeline-runs/index.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/provider.js +1 -1
- package/dist/storage/pipeline-runs/transitions.d.ts +2 -2
- package/dist/storage/pipeline-runs/transitions.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/types.d.ts +26 -6
- package/dist/storage/pipeline-runs/types.d.ts.map +1 -1
- package/dist/storage/projection-runs/errors.d.ts +6 -0
- package/dist/storage/projection-runs/errors.d.ts.map +1 -1
- package/dist/storage/projection-runs/in-memory.d.ts +5 -1
- package/dist/storage/projection-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/projection-runs/index.d.ts +2 -2
- package/dist/storage/projection-runs/index.d.ts.map +1 -1
- package/dist/storage/projection-runs/lifecycle.d.ts +1 -0
- package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -1
- package/dist/storage/projection-runs/provider.js +2 -2
- package/dist/storage/projection-runs/types.d.ts +16 -0
- package/dist/storage/projection-runs/types.d.ts.map +1 -1
- package/dist/storage/run-claim.d.ts +132 -0
- package/dist/storage/run-claim.d.ts.map +1 -0
- package/dist/storage/share-grants/provider.js +3 -3
- package/dist/storage/share-sessions/in-memory.d.ts +2 -1
- package/dist/storage/share-sessions/in-memory.d.ts.map +1 -1
- package/dist/storage/share-sessions/index.d.ts +1 -1
- package/dist/storage/share-sessions/index.d.ts.map +1 -1
- package/dist/storage/share-sessions/provider.d.ts +1 -1
- package/dist/storage/share-sessions/provider.d.ts.map +1 -1
- package/dist/storage/share-sessions/provider.js +4 -2
- package/dist/storage/share-sessions/provider.js.map +1 -1
- package/dist/storage/share-sessions/record.d.ts +2 -1
- package/dist/storage/share-sessions/record.d.ts.map +1 -1
- package/dist/storage/share-sessions/types.d.ts +17 -1
- package/dist/storage/share-sessions/types.d.ts.map +1 -1
- package/dist/storage/sync-runs/in-memory.d.ts +10 -2
- package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/sync-runs/index.d.ts +1 -1
- package/dist/storage/sync-runs/index.d.ts.map +1 -1
- package/dist/storage/sync-runs/transitions.d.ts +2 -2
- package/dist/storage/sync-runs/transitions.d.ts.map +1 -1
- package/dist/storage/sync-runs/types.d.ts +29 -3
- package/dist/storage/sync-runs/types.d.ts.map +1 -1
- package/dist/storage/types.d.ts +12 -6
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/webhook-runs/in-memory.d.ts +2 -1
- package/dist/storage/webhook-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/webhook-runs/index.d.ts +2 -2
- package/dist/storage/webhook-runs/index.d.ts.map +1 -1
- package/dist/storage/webhook-runs/types.d.ts +33 -2
- package/dist/storage/webhook-runs/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/in-memory.d.ts +6 -3
- package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/workflow-runs/index.d.ts +1 -1
- package/dist/storage/workflow-runs/index.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +12 -11
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/types.d.ts +11 -28
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/index.js +37 -34
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/run-dispatch.d.ts +2 -0
- package/dist/syncs/run-dispatch.d.ts.map +1 -1
- package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
- package/dist/testing/artifact-holders-contract.d.ts +15 -0
- package/dist/testing/artifact-holders-contract.d.ts.map +1 -0
- package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/broker-contract.d.ts.map +1 -1
- package/dist/testing/connector-connection-storage-contract.d.ts +1 -1
- package/dist/testing/connector-connection-storage-contract.d.ts.map +1 -1
- package/dist/testing/dataset-ingest-storage-contract.d.ts +11 -0
- package/dist/testing/dataset-ingest-storage-contract.d.ts.map +1 -0
- package/dist/testing/dataset-sequence-contract.d.ts +1 -1
- package/dist/testing/dataset-sequence-contract.d.ts.map +1 -1
- package/dist/testing/execution.d.ts.map +1 -1
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +6244 -3191
- package/dist/testing/index.js.map +28 -19
- package/dist/testing/lake-retention-run-storage-contract.d.ts +9 -0
- package/dist/testing/lake-retention-run-storage-contract.d.ts.map +1 -0
- package/dist/testing/maintenance-heartbeat-storage-contract.d.ts +9 -0
- package/dist/testing/maintenance-heartbeat-storage-contract.d.ts.map +1 -0
- package/dist/testing/object-query-contract.d.ts.map +1 -1
- package/dist/testing/pipeline-execution.d.ts.map +1 -1
- package/dist/testing/pipeline-run-read-contract.d.ts +13 -0
- package/dist/testing/pipeline-run-read-contract.d.ts.map +1 -0
- package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/testing/run-claim-storage-contract.d.ts +12 -0
- package/dist/testing/run-claim-storage-contract.d.ts.map +1 -0
- package/dist/testing/run-claim.d.ts +30 -0
- package/dist/testing/run-claim.d.ts.map +1 -0
- package/dist/testing/run-recovery-contract.d.ts +49 -0
- package/dist/testing/run-recovery-contract.d.ts.map +1 -0
- package/dist/testing/share-session-storage-contract.d.ts.map +1 -1
- package/dist/testing/stored-artifacts.d.ts +10 -0
- package/dist/testing/stored-artifacts.d.ts.map +1 -0
- package/dist/testing/sync-execution.d.ts.map +1 -1
- package/dist/testing/webhook-execution.d.ts +1 -1
- package/dist/testing/webhook-execution.d.ts.map +1 -1
- package/dist/testing/webhook-run-storage-contract.d.ts.map +1 -1
- package/dist/users/execution.d.ts +18 -1
- package/dist/users/execution.d.ts.map +1 -1
- package/dist/users/index.d.ts +1 -1
- package/dist/users/index.d.ts.map +1 -1
- package/dist/webhooks/delivery-lease.d.ts +13 -0
- package/dist/webhooks/delivery-lease.d.ts.map +1 -0
- package/dist/webhooks/internal.d.ts +2 -0
- package/dist/webhooks/internal.d.ts.map +1 -1
- package/dist/webhooks/internal.js +67 -35
- package/dist/webhooks/internal.js.map +5 -4
- package/dist/webhooks/run-admission.d.ts.map +1 -1
- package/dist/workers/index.d.ts +5 -1
- package/dist/workers/index.d.ts.map +1 -1
- package/dist/workers/index.js +193 -58
- package/dist/workers/index.js.map +8 -7
- package/dist/workers/job-ids.d.ts +17 -0
- package/dist/workers/job-ids.d.ts.map +1 -0
- package/dist/workers/lost-projection-runs.d.ts +26 -0
- package/dist/workers/lost-projection-runs.d.ts.map +1 -0
- package/dist/workers/lost-runs.d.ts +51 -0
- package/dist/workers/lost-runs.d.ts.map +1 -0
- package/dist/workers/queue-delivery.d.ts.map +1 -1
- package/dist/workers/queue-worker.d.ts +1 -2
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workers/queued-run-dispatch.d.ts +90 -0
- package/dist/workers/queued-run-dispatch.d.ts.map +1 -0
- package/dist/workers/run-lease.d.ts +25 -0
- package/dist/workers/run-lease.d.ts.map +1 -0
- package/dist/workers/run-worker.d.ts +95 -0
- package/dist/workers/run-worker.d.ts.map +1 -0
- package/dist/workflows/index.js +63 -57
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/run-dispatch.d.ts +6 -1
- package/dist/workflows/run-dispatch.d.ts.map +1 -1
- package/package.json +41 -3
- package/src/actions/request.ts +24 -7
- package/src/actions/run/executor.ts +9 -42
- package/src/actions/types/context.ts +8 -3
- package/src/agents/execution.ts +10 -2
- package/src/agents/fork.ts +12 -4
- package/src/agents/index.ts +7 -1
- package/src/agents/request.ts +42 -31
- package/src/agents/run-artifacts.ts +290 -46
- package/src/agents/run-session-http.ts +4 -0
- package/src/agents/run-session-serve.ts +10 -0
- package/src/agents/run-session.ts +8 -1
- package/src/agents/streams/protocol.ts +5 -10
- package/src/agents/validation.ts +3 -0
- package/src/artifacts/access.ts +71 -28
- package/src/artifacts/canvas-display.ts +160 -0
- package/src/artifacts/canvas.ts +26 -1
- package/src/artifacts/comment-text.ts +32 -0
- package/src/artifacts/comments.ts +275 -0
- package/src/artifacts/errors.ts +6 -1
- package/src/artifacts/events.ts +58 -0
- package/src/artifacts/execution.ts +496 -53
- package/src/artifacts/frames/assets.ts +20 -1
- package/src/artifacts/frames/grants.ts +31 -10
- package/src/artifacts/frames/index.ts +2 -0
- package/src/artifacts/frames/kit.ts +8 -5
- package/src/artifacts/frames/protocol.ts +149 -0
- package/src/artifacts/frames/runtime.ts +317 -29
- package/src/artifacts/holders.ts +120 -0
- package/src/artifacts/ids.ts +8 -0
- package/src/artifacts/index.ts +28 -2
- package/src/artifacts/limits.ts +28 -4
- package/src/artifacts/live/board.ts +759 -0
- package/src/artifacts/live/diff.ts +297 -0
- package/src/artifacts/live/document.ts +354 -0
- package/src/artifacts/live/files.ts +82 -0
- package/src/artifacts/live/index.ts +50 -0
- package/src/artifacts/live/presence.ts +144 -0
- package/src/artifacts/live/protocol.ts +134 -0
- package/src/artifacts/live/server.ts +16 -0
- package/src/artifacts/live/state.ts +115 -0
- package/src/artifacts/outline.ts +12 -0
- package/src/artifacts/publish/index.ts +26 -1
- package/src/artifacts/publish/merge.ts +271 -0
- package/src/artifacts/publish/previews.ts +485 -0
- package/src/artifacts/publish/publish.ts +92 -39
- package/src/artifacts/publish/query-answers.ts +85 -0
- package/src/artifacts/publish/references.ts +10 -4
- package/src/artifacts/publish/validate/canvas.ts +133 -1
- package/src/artifacts/theme.ts +9 -1
- package/src/auth/directory.ts +166 -0
- package/src/auth/member-events.ts +10 -3
- package/src/auth/runtime.ts +108 -8
- package/src/auth/strategy.ts +3 -1
- package/src/auth/types.ts +44 -0
- package/src/authorization/decision.ts +6 -5
- package/src/authorization/event-visibility.ts +4 -0
- package/src/broker/in-memory.ts +33 -6
- package/src/broker/types.ts +4 -0
- package/src/connectors/builders.ts +34 -2
- package/src/connectors/connections/access.ts +83 -0
- package/src/connectors/connections/contracts.ts +6 -1
- package/src/connectors/connections/execution.ts +2 -2
- package/src/connectors/connections/runs.ts +51 -2
- package/src/connectors/connections/service.ts +208 -41
- package/src/connectors/connections/views.ts +11 -4
- package/src/connectors/execution.ts +27 -3
- package/src/connectors/index.ts +2 -0
- package/src/connectors/service.ts +12 -0
- package/src/connectors/types.ts +37 -2
- package/src/datasets/execution.ts +74 -37
- package/src/datasets/ingest-flush-batch.ts +289 -0
- package/src/datasets/ingest-flush-job.ts +112 -0
- package/src/datasets/ingest-flush.ts +377 -0
- package/src/datasets/produced-version.ts +55 -0
- package/src/datasets/write.ts +65 -11
- package/src/deploy/services.ts +1 -1
- package/src/deploy/types.ts +2 -3
- package/src/deploy/validation.ts +1 -0
- package/src/error-reporting/capability.ts +66 -0
- package/src/error-reporting/internal.ts +12 -0
- package/src/error-reporting/reporter.ts +11 -35
- package/src/error-reporting/reports.ts +167 -0
- package/src/error-reporting/types.ts +99 -0
- package/src/errors/catalog.ts +6 -0
- package/src/events/definitions.ts +14 -0
- package/src/events/execution.ts +77 -28
- package/src/events/index.ts +3 -0
- package/src/events/scope.ts +2 -0
- package/src/events/types/artifacts.ts +40 -0
- package/src/events/types/index.ts +3 -0
- package/src/events/types/users.ts +5 -2
- package/src/execution/authorized-object-reader.ts +34 -0
- package/src/execution/object-reader-clearance.ts +31 -0
- package/src/execution/object-reader-security.ts +33 -13
- package/src/http/api-routes.ts +105 -4
- package/src/index.ts +22 -4
- package/src/lake-storage/errors.ts +21 -0
- package/src/lake-storage/index.ts +9 -1
- package/src/lake-storage/maintenance.ts +93 -0
- package/src/lake-storage/merge.ts +3 -1
- package/src/lake-storage/source-ordering.ts +28 -2
- package/src/lake-storage/types.ts +14 -0
- package/src/maintenance/heartbeat.ts +14 -0
- package/src/maintenance/index.ts +5 -3
- package/src/maintenance/lake-retention-status.ts +81 -0
- package/src/maintenance/lake-retention.ts +347 -0
- package/src/maintenance/loop.ts +365 -0
- package/src/maintenance/ontology-maintenance.ts +76 -229
- package/src/maintenance/passes/cron-pass.ts +217 -0
- package/src/maintenance/passes/directory-pass.ts +22 -0
- package/src/maintenance/passes/ingest-pass.ts +94 -0
- package/src/maintenance/passes/lake-change-feed.ts +112 -0
- package/src/maintenance/passes/lake-retention-pass.ts +71 -0
- package/src/maintenance/passes/ontology-pass.ts +19 -0
- package/src/maintenance/passes/projections-pass.ts +238 -0
- package/src/maintenance/passes/recovery-pass.ts +17 -0
- package/src/maintenance/passes/recovery-passes.ts +39 -0
- package/src/maintenance/passes/runs-pass.ts +12 -0
- package/src/maintenance/passes/triggers-pass.ts +332 -0
- package/src/maintenance/status.ts +75 -0
- package/src/maintenance/types.ts +27 -25
- package/src/materialization/model.ts +33 -21
- package/src/materializer/README.md +13 -2
- package/src/materializer/edits/artifact-refs.ts +140 -0
- package/src/materializer/edits/commit.ts +20 -7
- package/src/materializer/edits/operations.ts +23 -7
- package/src/materializer/edits/plan.ts +2 -0
- package/src/materializer/execution/work-records.ts +61 -0
- package/src/materializer/projections/replacement-plan.ts +2 -0
- package/src/materializer/shared/normalize.ts +14 -0
- package/src/materializer/telemetry/plan.ts +2 -0
- package/src/objects/artifact-refs.ts +34 -0
- package/src/objects/materializer-adapter.ts +8 -3
- package/src/objects/object/upsert-batch.ts +7 -0
- package/src/objects/object/upsert.ts +11 -2
- package/src/objects/query/ir.ts +2 -0
- package/src/objects/query/scalar-values.ts +5 -3
- package/src/objects/runtime-batch.ts +8 -1
- package/src/objects/vectors/README.md +4 -4
- package/src/ontology/artifact-ref.ts +83 -0
- package/src/ontology/docs-markdown.ts +17 -0
- package/src/ontology/index.ts +3 -1
- package/src/ontology/inference/index.ts +2 -0
- package/src/ontology/json-schema.ts +13 -0
- package/src/ontology/primitives.ts +14 -0
- package/src/ontology/reference-values.ts +62 -0
- package/src/ontology/refs.ts +7 -1
- package/src/ontology/registry.ts +26 -1
- package/src/ontology/types.ts +2 -0
- package/src/ontology/user-ref.ts +35 -45
- package/src/ontology/validation/normalize.ts +13 -0
- package/src/ontology/validation/properties.ts +9 -0
- package/src/ontology/validation/schema.ts +12 -0
- package/src/pending-tasks.ts +51 -0
- package/src/pipelines/run-dispatch.ts +120 -238
- package/src/predicates/types.ts +2 -1
- package/src/projections/builders.ts +28 -13
- package/src/projections/run-dispatch.ts +1 -1
- package/src/projections/types.ts +1 -1
- package/src/projections/validation.ts +22 -8
- package/src/queues/in-memory.ts +50 -3
- package/src/queues/index.ts +4 -0
- package/src/queues/types.ts +68 -1
- package/src/runtime/create.ts +4 -0
- package/src/runtime/host.ts +118 -13
- package/src/runtime/index.ts +0 -1
- package/src/runtime/internal.ts +13 -0
- package/src/runtime/ontology-mutations.ts +1 -1
- package/src/runtime/sixb.ts +14 -5
- package/src/scheduler/index.ts +0 -2
- package/src/shared/backoff.ts +34 -0
- package/src/shared/duration.ts +15 -0
- package/src/shared/params/artifact-refs.ts +42 -0
- package/src/shares/compiler.ts +1 -1
- package/src/shares/guest-name.ts +20 -0
- package/src/shares/internal.ts +1 -0
- package/src/shares/session-protocol.ts +63 -0
- package/src/storage/artifacts/errors.ts +10 -2
- package/src/storage/artifacts/in-memory.ts +579 -96
- package/src/storage/artifacts/index.ts +22 -1
- package/src/storage/artifacts/record.ts +255 -11
- package/src/storage/artifacts/types.ts +343 -40
- package/src/storage/auth/in-memory/auth-storage.ts +42 -5
- package/src/storage/auth/in-memory/identities.ts +16 -0
- package/src/storage/auth/in-memory/shared.ts +15 -0
- package/src/storage/auth/in-memory/users.ts +17 -16
- package/src/storage/auth/index.ts +3 -0
- package/src/storage/auth/types.ts +38 -0
- package/src/storage/connector-connections/in-memory.ts +4 -1
- package/src/storage/connector-connections/index.ts +1 -0
- package/src/storage/connector-connections/provider/runs.ts +3 -0
- package/src/storage/connector-connections/provider/shared.ts +30 -0
- package/src/storage/connector-connections/provider.ts +4 -0
- package/src/storage/connector-connections/types.ts +1 -0
- package/src/storage/dataset-ingest/codec.ts +90 -0
- package/src/storage/dataset-ingest/in-memory.ts +277 -0
- package/src/storage/dataset-ingest/index.ts +16 -0
- package/src/storage/dataset-ingest/provider.ts +592 -0
- package/src/storage/dataset-ingest/types.ts +191 -0
- package/src/storage/in-memory/index.ts +33 -0
- package/src/storage/index.ts +65 -5
- package/src/storage/internal.ts +20 -0
- package/src/storage/lake-retention-runs/in-memory.ts +22 -0
- package/src/storage/lake-retention-runs/index.ts +2 -0
- package/src/storage/lake-retention-runs/types.ts +19 -0
- package/src/storage/maintenance-heartbeats/in-memory.ts +24 -0
- package/src/storage/maintenance-heartbeats/index.ts +7 -0
- package/src/storage/maintenance-heartbeats/record.ts +50 -0
- package/src/storage/maintenance-heartbeats/types.ts +30 -0
- package/src/storage/objects/in-memory/query.ts +1 -0
- package/src/storage/objects/in-memory/storage.ts +81 -0
- package/src/storage/objects/read-scope.ts +1 -0
- package/src/storage/objects/types.ts +16 -1
- package/src/storage/ontology/in-memory/materializations.ts +8 -0
- package/src/storage/ontology/in-memory/replacement-plans.ts +4 -1
- package/src/storage/ontology/index.ts +2 -0
- package/src/storage/ontology/materializations.ts +18 -0
- package/src/storage/ontology/provider-work.ts +39 -0
- package/src/storage/pipeline-runs/in-memory.ts +97 -24
- package/src/storage/pipeline-runs/index.ts +0 -1
- package/src/storage/pipeline-runs/provider.ts +1 -1
- package/src/storage/pipeline-runs/transitions.ts +7 -4
- package/src/storage/pipeline-runs/types.ts +33 -7
- package/src/storage/projection-runs/errors.ts +10 -0
- package/src/storage/projection-runs/in-memory.ts +56 -1
- package/src/storage/projection-runs/index.ts +2 -1
- package/src/storage/projection-runs/lifecycle.ts +9 -1
- package/src/storage/projection-runs/types.ts +20 -1
- package/src/storage/run-claim.ts +224 -0
- package/src/storage/share-sessions/in-memory.ts +21 -0
- package/src/storage/share-sessions/index.ts +1 -0
- package/src/storage/share-sessions/provider.ts +1 -0
- package/src/storage/share-sessions/record.ts +28 -0
- package/src/storage/share-sessions/types.ts +19 -1
- package/src/storage/sync-runs/in-memory.ts +109 -29
- package/src/storage/sync-runs/index.ts +1 -1
- package/src/storage/sync-runs/transitions.ts +7 -4
- package/src/storage/sync-runs/types.ts +36 -3
- package/src/storage/types.ts +15 -5
- package/src/storage/webhook-runs/in-memory.ts +26 -2
- package/src/storage/webhook-runs/index.ts +3 -1
- package/src/storage/webhook-runs/types.ts +44 -3
- package/src/storage/workflow-runs/in-memory.ts +50 -36
- package/src/storage/workflow-runs/index.ts +0 -2
- package/src/storage/workflow-runs/types.ts +18 -30
- package/src/syncs/run-dispatch.ts +118 -239
- package/src/testing/ai-model-call-groups-contract.ts +2 -1
- package/src/testing/artifact-holders-contract.ts +392 -0
- package/src/testing/artifact-storage-contract.ts +1205 -151
- package/src/testing/auth-storage-contract.ts +228 -1
- package/src/testing/broker-contract.ts +56 -0
- package/src/testing/connector-connection-storage-contract.ts +94 -5
- package/src/testing/dataset-ingest-storage-contract.ts +480 -0
- package/src/testing/dataset-sequence-contract.ts +97 -12
- package/src/testing/execution.ts +23 -0
- package/src/testing/index.ts +31 -0
- package/src/testing/lake-retention-run-storage-contract.ts +75 -0
- package/src/testing/maintenance-heartbeat-storage-contract.ts +99 -0
- package/src/testing/object-query-contract.ts +93 -0
- package/src/testing/pipeline-execution.ts +3 -1
- package/src/testing/pipeline-run-read-contract.ts +123 -0
- package/src/testing/projection-run-storage-contract.ts +113 -0
- package/src/testing/queues-contract.ts +112 -0
- package/src/testing/run-claim-storage-contract.ts +736 -0
- package/src/testing/run-claim.ts +69 -0
- package/src/testing/run-recovery-contract.ts +176 -0
- package/src/testing/share-session-storage-contract.ts +43 -0
- package/src/testing/stored-artifacts.ts +43 -0
- package/src/testing/sync-execution.ts +3 -1
- package/src/testing/webhook-execution.ts +7 -2
- package/src/testing/webhook-run-storage-contract.ts +102 -5
- package/src/users/execution.ts +50 -2
- package/src/users/index.ts +1 -0
- package/src/webhooks/delivery-lease.ts +40 -0
- package/src/webhooks/internal.ts +2 -0
- package/src/webhooks/run-admission.ts +22 -9
- package/src/workers/README.md +169 -0
- package/src/workers/index.ts +9 -1
- package/src/workers/job-ids.ts +31 -0
- package/src/workers/lost-projection-runs.ts +114 -0
- package/src/workers/lost-runs.ts +397 -0
- package/src/workers/queue-delivery.ts +2 -14
- package/src/workers/queue-worker.ts +9 -17
- package/src/workers/queued-run-dispatch.ts +308 -0
- package/src/workers/run-lease.ts +46 -0
- package/src/workers/run-worker.ts +312 -0
- package/src/workers/worker.ts +4 -17
- package/src/workflows/request.ts +2 -0
- package/src/workflows/run-dispatch.ts +22 -4
- package/src/workflows/snapshot.ts +1 -0
- package/dist/chunk-2g0r46hy.js.map +0 -12
- package/dist/chunk-3fqxbn31.js +0 -107
- package/dist/chunk-3fqxbn31.js.map +0 -11
- package/dist/chunk-4s753g3k.js +0 -314
- package/dist/chunk-4s753g3k.js.map +0 -12
- package/dist/chunk-5kyvrtjh.js.map +0 -12
- package/dist/chunk-5taem5aw.js.map +0 -10
- package/dist/chunk-65abf64x.js +0 -13
- package/dist/chunk-65abf64x.js.map +0 -10
- package/dist/chunk-9x8dybsb.js.map +0 -10
- package/dist/chunk-az47zep4.js +0 -41
- package/dist/chunk-az47zep4.js.map +0 -10
- package/dist/chunk-c706qvyc.js +0 -299
- package/dist/chunk-c706qvyc.js.map +0 -11
- package/dist/chunk-djs3hw9p.js.map +0 -20
- package/dist/chunk-e5wf5vz0.js.map +0 -10
- package/dist/chunk-e6xgz4h4.js.map +0 -21
- package/dist/chunk-e7v3trpz.js.map +0 -10
- package/dist/chunk-eqgr6nsa.js.map +0 -72
- package/dist/chunk-fb3feg1e.js +0 -298
- package/dist/chunk-fb3feg1e.js.map +0 -12
- package/dist/chunk-hz5d43gn.js.map +0 -10
- package/dist/chunk-j8thxj7w.js.map +0 -22
- package/dist/chunk-jbw70d6t.js.map +0 -10
- package/dist/chunk-jftd33rc.js.map +0 -11
- package/dist/chunk-jspskey0.js.map +0 -10
- package/dist/chunk-kfee1h52.js.map +0 -13
- package/dist/chunk-kwfhd1g0.js +0 -144
- package/dist/chunk-kwfhd1g0.js.map +0 -13
- package/dist/chunk-nz7815t3.js.map +0 -14
- package/dist/chunk-s3we74h8.js.map +0 -12
- package/dist/chunk-scyq22td.js.map +0 -12
- package/dist/chunk-w1btn96n.js.map +0 -44
- package/dist/chunk-w976a4me.js.map +0 -10
- package/dist/chunk-wkq3kvzd.js.map +0 -10
- package/dist/chunk-wrjx1fqz.js +0 -587
- package/dist/chunk-wrjx1fqz.js.map +0 -18
- package/dist/chunk-yw9pyg66.js +0 -143
- package/dist/chunk-yw9pyg66.js.map +0 -11
- package/dist/chunk-z8fx5cgb.js.map +0 -11
- package/dist/scheduler/runtime.d.ts +0 -40
- package/dist/scheduler/runtime.d.ts.map +0 -1
- package/dist/workers/unstarted-run.d.ts +0 -10
- package/dist/workers/unstarted-run.d.ts.map +0 -1
- package/src/scheduler/runtime.ts +0 -214
- package/src/workers/unstarted-run.ts +0 -18
- /package/dist/{chunk-80gym75n.js.map → chunk-186k5yz3.js.map} +0 -0
- /package/dist/{chunk-ytzcxtpt.js.map → chunk-3ba89vm7.js.map} +0 -0
- /package/dist/{chunk-d04g36fw.js.map → chunk-5qqmndhm.js.map} +0 -0
- /package/dist/{chunk-5wtnmpze.js.map → chunk-7qe46788.js.map} +0 -0
- /package/dist/{chunk-31kcqmhf.js.map → chunk-855w9nvw.js.map} +0 -0
- /package/dist/{chunk-2ajw5rz0.js.map → chunk-8p7bze4c.js.map} +0 -0
- /package/dist/{chunk-9whfmsfk.js.map → chunk-8tqnsx3q.js.map} +0 -0
- /package/dist/{chunk-s038wa5v.js.map → chunk-b9qfh2ya.js.map} +0 -0
- /package/dist/{chunk-jjmggm9a.js.map → chunk-fe6r7yhg.js.map} +0 -0
- /package/dist/{chunk-165c9wm6.js.map → chunk-g2ph4873.js.map} +0 -0
- /package/dist/{chunk-ga63a3dz.js.map → chunk-k66rp2hr.js.map} +0 -0
- /package/dist/{chunk-4zm1k3xj.js.map → chunk-r2psmn42.js.map} +0 -0
- /package/dist/{chunk-r1cxq7vv.js.map → chunk-rtdrm592.js.map} +0 -0
- /package/dist/{chunk-4bm0caep.js.map → chunk-smnt672s.js.map} +0 -0
- /package/dist/{chunk-21q0j5f2.js.map → chunk-stmxh0hv.js.map} +0 -0
- /package/dist/{chunk-ff5xkv0p.js.map → chunk-tfzvjdms.js.map} +0 -0
- /package/dist/{chunk-6b61s40c.js.map → chunk-w3t94hm6.js.map} +0 -0
|
@@ -4,36 +4,69 @@ import {
|
|
|
4
4
|
validateObjectQueryWithAdmission,
|
|
5
5
|
SYSTEM_PRINCIPAL2,
|
|
6
6
|
principalsEqual2
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-0k3r5kb3.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveRuntimeAuthorizationForProject,
|
|
10
10
|
AuthorizationError2,
|
|
11
11
|
isRuntimeAllowed2
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-vzkxqf8h.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
14
|
+
createArtifactId,
|
|
15
|
+
createArtifactCommentId
|
|
16
|
+
} from "./chunk-kr6dx38r.js";
|
|
17
|
+
import {
|
|
18
|
+
inferFileMediaType2,
|
|
19
|
+
isValidFileRef
|
|
15
20
|
} from "./chunk-wkv3h3q7.js";
|
|
21
|
+
import {
|
|
22
|
+
collectArtifactRefIds
|
|
23
|
+
} from "./chunk-3zagkr6w.js";
|
|
24
|
+
import {
|
|
25
|
+
ArtifactStorageError,
|
|
26
|
+
turnUndoable2
|
|
27
|
+
} from "./chunk-3014rfjz.js";
|
|
16
28
|
import {
|
|
17
29
|
ARTIFACT_LIMITS2,
|
|
18
|
-
ARTIFACT_STATE_LIMITS2
|
|
19
|
-
|
|
30
|
+
ARTIFACT_STATE_LIMITS2,
|
|
31
|
+
ARTIFACT_HOLDERS_LIMIT2,
|
|
32
|
+
ARTIFACT_COMMENT_LIMITS2
|
|
33
|
+
} from "./chunk-9vsc919v.js";
|
|
34
|
+
import {
|
|
35
|
+
objectBatchKey2
|
|
36
|
+
} from "./chunk-2by73sm2.js";
|
|
37
|
+
import {
|
|
38
|
+
objectReadersIn,
|
|
39
|
+
getAuthorizedOntologyView,
|
|
40
|
+
readerClearance
|
|
41
|
+
} from "./chunk-26qet7wh.js";
|
|
20
42
|
import {
|
|
21
|
-
createArtifactId,
|
|
22
43
|
isArtifactAddress2,
|
|
23
|
-
parseArtifactAddress2
|
|
24
|
-
|
|
44
|
+
parseArtifactAddress2,
|
|
45
|
+
CANVAS_FILE2,
|
|
46
|
+
parseCanvas2
|
|
47
|
+
} from "./chunk-bz5bnjjt.js";
|
|
25
48
|
import {
|
|
26
|
-
|
|
27
|
-
|
|
49
|
+
isLiveTextPath,
|
|
50
|
+
createArtifactDocument,
|
|
51
|
+
documentFiles2,
|
|
52
|
+
mergeIntoDocument2
|
|
53
|
+
} from "./chunk-m2jerfef.js";
|
|
54
|
+
import {
|
|
55
|
+
BOARD_PREVIEW_JOB2,
|
|
56
|
+
BOARD_PREVIEW_WAIT_MS2,
|
|
57
|
+
canvasArrowLine2,
|
|
58
|
+
canvasItemBox,
|
|
59
|
+
canvasEndBox,
|
|
28
60
|
ARTIFACT_QUERIES_DIRECTORY,
|
|
29
61
|
ARTIFACT_QUERY_KINDS,
|
|
30
62
|
isArtifactQueryName,
|
|
31
63
|
artifactQueryPath,
|
|
32
64
|
artifactQueryName2,
|
|
33
65
|
parseArtifactQuery,
|
|
66
|
+
ARTIFACT_THEME_FILE2,
|
|
67
|
+
parseArtifactTheme2,
|
|
68
|
+
artifactThemeModes2,
|
|
34
69
|
resolveArtifactAddress2,
|
|
35
|
-
CANVAS_FILE2,
|
|
36
|
-
parseCanvas2,
|
|
37
70
|
createHeadingSlugger2,
|
|
38
71
|
CsvParseError2,
|
|
39
72
|
parseCsv2,
|
|
@@ -47,14 +80,7 @@ import {
|
|
|
47
80
|
sheetColumnsProblem,
|
|
48
81
|
sheetFormulasProblem,
|
|
49
82
|
sheetChartsProblem
|
|
50
|
-
} from "./chunk-
|
|
51
|
-
import {
|
|
52
|
-
ArtifactStorageError
|
|
53
|
-
} from "./chunk-e6xgz4h4.js";
|
|
54
|
-
import {
|
|
55
|
-
getAuthorizedOntologyView,
|
|
56
|
-
readerClearance
|
|
57
|
-
} from "./chunk-m2vh8gh0.js";
|
|
83
|
+
} from "./chunk-a6fjkcne.js";
|
|
58
84
|
import {
|
|
59
85
|
ArtifactRequestError2,
|
|
60
86
|
checkArtifactFiles,
|
|
@@ -63,8 +89,11 @@ import {
|
|
|
63
89
|
decodeHtmlEntities,
|
|
64
90
|
HTML_ENTRY2,
|
|
65
91
|
refuseFrameAssetPaths,
|
|
66
|
-
readHtmlReferences
|
|
67
|
-
|
|
92
|
+
readHtmlReferences,
|
|
93
|
+
FRAME_DEFAULT_THEMES2,
|
|
94
|
+
FRAME_ASSETS2,
|
|
95
|
+
serializeArtifactQueryResult2
|
|
96
|
+
} from "./chunk-qds484t8.js";
|
|
68
97
|
import {
|
|
69
98
|
ObjectQueryValidationError2,
|
|
70
99
|
ObjectQueryPlanningError2,
|
|
@@ -74,6 +103,9 @@ import {
|
|
|
74
103
|
import {
|
|
75
104
|
AgentRequestError2
|
|
76
105
|
} from "./chunk-9wr3yajk.js";
|
|
106
|
+
import {
|
|
107
|
+
statFileRef2
|
|
108
|
+
} from "./chunk-a3faa34j.js";
|
|
77
109
|
|
|
78
110
|
// src/agents/thread-access.ts
|
|
79
111
|
function createAgentThreadAccessRule(runtime, authority, agents) {
|
|
@@ -134,8 +166,9 @@ function publicThread(thread) {
|
|
|
134
166
|
function createArtifactAccessRule(input) {
|
|
135
167
|
const { caller } = input;
|
|
136
168
|
const conversations = new Map;
|
|
169
|
+
const holders = new Map;
|
|
137
170
|
const conversation = (threadId) => {
|
|
138
|
-
if (caller === null || !input.sharing)
|
|
171
|
+
if (caller === null || caller === "guest" || !input.sharing)
|
|
139
172
|
return Promise.resolve(null);
|
|
140
173
|
let reads = conversations.get(threadId);
|
|
141
174
|
if (!reads) {
|
|
@@ -144,14 +177,24 @@ function createArtifactAccessRule(input) {
|
|
|
144
177
|
}
|
|
145
178
|
return reads;
|
|
146
179
|
};
|
|
180
|
+
const throughObjects = (artifact) => {
|
|
181
|
+
let reaches = holders.get(artifact.id);
|
|
182
|
+
if (!reaches) {
|
|
183
|
+
reaches = input.holders(artifact).then((access) => caller === "guest" && access !== null ? "read" : access);
|
|
184
|
+
holders.set(artifact.id, reaches);
|
|
185
|
+
}
|
|
186
|
+
return reaches;
|
|
187
|
+
};
|
|
147
188
|
const ownAccess = (artifact) => {
|
|
148
189
|
if (caller === null)
|
|
149
190
|
return "none";
|
|
191
|
+
if (caller === "guest")
|
|
192
|
+
return;
|
|
150
193
|
if (caller === "system" || principalsEqual2(caller, artifact.owner))
|
|
151
194
|
return "owner";
|
|
152
|
-
return
|
|
195
|
+
return;
|
|
153
196
|
};
|
|
154
|
-
const threadIdsOf = (artifact) => input.storage.listThreadIds({ projectId: input.projectId, id: artifact.id });
|
|
197
|
+
const threadIdsOf = async (artifact) => input.sharing ? input.storage.listThreadIds({ projectId: input.projectId, id: artifact.id }) : [];
|
|
155
198
|
const accessTo = async (artifact) => {
|
|
156
199
|
const own = ownAccess(artifact);
|
|
157
200
|
if (own)
|
|
@@ -164,7 +207,7 @@ function createArtifactAccessRule(input) {
|
|
|
164
207
|
if (reads === "read")
|
|
165
208
|
access = "read";
|
|
166
209
|
}
|
|
167
|
-
return access;
|
|
210
|
+
return await throughObjects(artifact) ?? access;
|
|
168
211
|
};
|
|
169
212
|
const publishAccess = async (artifact, threadId) => {
|
|
170
213
|
if (threadId === undefined)
|
|
@@ -172,20 +215,764 @@ function createArtifactAccessRule(input) {
|
|
|
172
215
|
const own = ownAccess(artifact);
|
|
173
216
|
if (own)
|
|
174
217
|
return own;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
218
|
+
const shared = (await threadIdsOf(artifact)).includes(threadId);
|
|
219
|
+
const here = shared ? await conversation(threadId) : null;
|
|
220
|
+
if (here === "update")
|
|
221
|
+
return "update";
|
|
222
|
+
if (await throughObjects(artifact) === "update")
|
|
223
|
+
return "update";
|
|
224
|
+
return here ?? "none";
|
|
179
225
|
};
|
|
180
226
|
return { accessTo, publishAccess, conversation };
|
|
181
227
|
}
|
|
182
228
|
function assertUpdatable(artifactId, access) {
|
|
183
229
|
if (access === "none") {
|
|
184
|
-
throw new ArtifactRequestError2("not_shared", `[Sixb] Artifact '${artifactId}' is not shared
|
|
230
|
+
throw new ArtifactRequestError2("not_shared", `[Sixb] Artifact '${artifactId}' is not shared with you.`);
|
|
185
231
|
}
|
|
186
232
|
if (access === "read") {
|
|
187
|
-
throw new ArtifactRequestError2("read_only", `[Sixb] You read artifact '${artifactId}'
|
|
233
|
+
throw new ArtifactRequestError2("read_only", `[Sixb] You only read artifact '${artifactId}': you cannot change it or keep page data in it.`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// src/artifacts/events.ts
|
|
238
|
+
async function announceArtifactUpdates(events, latest) {
|
|
239
|
+
if (latest.length === 0)
|
|
240
|
+
return;
|
|
241
|
+
await events.emit({
|
|
242
|
+
events: latest.map((version) => ({
|
|
243
|
+
type: "artifact.updated",
|
|
244
|
+
payload: {
|
|
245
|
+
artifactId: version.artifactId,
|
|
246
|
+
version: version.version,
|
|
247
|
+
revision: version.revision,
|
|
248
|
+
frozen: version.frozenAt !== undefined
|
|
249
|
+
},
|
|
250
|
+
idempotencyKey: `artifact.updated:${version.artifactId}:${version.revision}`
|
|
251
|
+
}))
|
|
252
|
+
}, { source: "Sixb" });
|
|
253
|
+
}
|
|
254
|
+
async function announceArtifactComment(events, comment, action) {
|
|
255
|
+
await events.emit({
|
|
256
|
+
events: [
|
|
257
|
+
{
|
|
258
|
+
type: "artifact.commented",
|
|
259
|
+
payload: {
|
|
260
|
+
artifactId: comment.artifactId,
|
|
261
|
+
commentId: comment.id,
|
|
262
|
+
...comment.parentId === undefined ? {} : { parentId: comment.parentId },
|
|
263
|
+
action
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
}, { source: "Sixb" });
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// src/artifacts/comments.ts
|
|
271
|
+
var ELEMENT_ADDRESS = /^body(>[a-z][a-z0-9-]*:\d+)*$/;
|
|
272
|
+
var MAX_ELEMENT_ADDRESS_LENGTH = 1024;
|
|
273
|
+
function createArtifactCommentsRuntime(input) {
|
|
274
|
+
const { projectId, events } = input;
|
|
275
|
+
const readable = async (artifactId) => {
|
|
276
|
+
const reached = await input.reach(artifactId);
|
|
277
|
+
if (!reached)
|
|
278
|
+
throw notFound(artifactId);
|
|
279
|
+
if (reached.access === "none") {
|
|
280
|
+
throw new ArtifactRequestError2("not_shared", `[Sixb] Artifact '${artifactId}' is not shared with you.`);
|
|
281
|
+
}
|
|
282
|
+
return reached;
|
|
283
|
+
};
|
|
284
|
+
const managed = async (artifactId, commentId) => {
|
|
285
|
+
const { access } = await readable(artifactId);
|
|
286
|
+
const manager = input.manager();
|
|
287
|
+
const comment = await input.storage().getComment({ projectId, artifactId, id: commentId });
|
|
288
|
+
if (!comment)
|
|
289
|
+
throw commentNotFound(artifactId, commentId);
|
|
290
|
+
const changes = access === "owner" || access === "update";
|
|
291
|
+
const authored = comment.author.type !== "guest" && principalsEqual2(comment.author, manager);
|
|
292
|
+
if (!changes && !authored) {
|
|
293
|
+
throw new ArtifactRequestError2("not_allowed", "[Sixb] Only a comment's author, or whoever may change the artifact, resolves or deletes it.");
|
|
294
|
+
}
|
|
295
|
+
return comment;
|
|
296
|
+
};
|
|
297
|
+
return {
|
|
298
|
+
async listComments(artifactId) {
|
|
299
|
+
const reached = await input.reach(artifactId);
|
|
300
|
+
if (!reached || reached.access === "none")
|
|
301
|
+
return null;
|
|
302
|
+
return input.storage().listComments({ projectId, id: artifactId });
|
|
303
|
+
},
|
|
304
|
+
async addComment(artifactId, comment) {
|
|
305
|
+
const { artifact } = await readable(artifactId);
|
|
306
|
+
const author = await input.author();
|
|
307
|
+
const storage = input.storage();
|
|
308
|
+
const body = comment.body.trim();
|
|
309
|
+
if (body.length === 0 || body.length > ARTIFACT_COMMENT_LIMITS2.maxBodyLength) {
|
|
310
|
+
throw invalid(`A comment holds 1 to ${ARTIFACT_COMMENT_LIMITS2.maxBodyLength} characters of text.`);
|
|
311
|
+
}
|
|
312
|
+
let anchor;
|
|
313
|
+
if (comment.parentId !== undefined) {
|
|
314
|
+
const parent = await storage.getComment({ projectId, artifactId, id: comment.parentId });
|
|
315
|
+
if (!parent)
|
|
316
|
+
throw commentNotFound(artifactId, comment.parentId);
|
|
317
|
+
anchor = parent.anchor;
|
|
318
|
+
} else {
|
|
319
|
+
anchor = await checkAnchor(storage, artifact, comment.anchor ?? {});
|
|
320
|
+
}
|
|
321
|
+
try {
|
|
322
|
+
const created = await storage.createComment({
|
|
323
|
+
projectId,
|
|
324
|
+
artifactId,
|
|
325
|
+
id: createArtifactCommentId(),
|
|
326
|
+
...comment.parentId === undefined ? {} : { parentId: comment.parentId },
|
|
327
|
+
anchor,
|
|
328
|
+
body,
|
|
329
|
+
author,
|
|
330
|
+
...comment.origin ? { origin: comment.origin } : {},
|
|
331
|
+
createdAt: new Date
|
|
332
|
+
});
|
|
333
|
+
await announceArtifactComment(events, created, "created");
|
|
334
|
+
return created;
|
|
335
|
+
} catch (error) {
|
|
336
|
+
throw commentRequestError(error);
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
async resolveComment(artifactId, commentId, resolved = true) {
|
|
340
|
+
await managed(artifactId, commentId);
|
|
341
|
+
const changed = await input.storage().resolveComment({
|
|
342
|
+
projectId,
|
|
343
|
+
artifactId,
|
|
344
|
+
id: commentId,
|
|
345
|
+
resolved: resolved ? { at: new Date, by: input.manager() } : null
|
|
346
|
+
});
|
|
347
|
+
if (!changed)
|
|
348
|
+
throw commentNotFound(artifactId, commentId);
|
|
349
|
+
await announceArtifactComment(events, changed, resolved ? "resolved" : "reopened");
|
|
350
|
+
return changed;
|
|
351
|
+
},
|
|
352
|
+
async deleteComment(artifactId, commentId) {
|
|
353
|
+
const comment = await managed(artifactId, commentId);
|
|
354
|
+
const deleted = await input.storage().deleteComment({ projectId, artifactId, id: commentId });
|
|
355
|
+
if (!deleted)
|
|
356
|
+
throw commentNotFound(artifactId, commentId);
|
|
357
|
+
await announceArtifactComment(events, comment, "deleted");
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
async function checkAnchor(storage, artifact, anchor) {
|
|
362
|
+
const revision = anchor.revision ?? artifact.revision;
|
|
363
|
+
if (!Number.isSafeInteger(revision) || revision < 1 || revision > artifact.revision) {
|
|
364
|
+
throw invalid(`A comment is about a revision of the artifact, 1 to ${artifact.revision}.`);
|
|
365
|
+
}
|
|
366
|
+
if (anchor.element !== undefined && anchor.board === undefined) {
|
|
367
|
+
throw invalid("A comment on an element names the board it is on.");
|
|
368
|
+
}
|
|
369
|
+
if (anchor.element !== undefined && (anchor.element.length > MAX_ELEMENT_ADDRESS_LENGTH || !ELEMENT_ADDRESS.test(anchor.element))) {
|
|
370
|
+
throw invalid(`'${anchor.element}' is no element's address, as a board's elements have.`);
|
|
371
|
+
}
|
|
372
|
+
if (anchor.board !== undefined) {
|
|
373
|
+
const latest = await storage.getVersion({
|
|
374
|
+
projectId: artifact.projectId,
|
|
375
|
+
artifactId: artifact.id,
|
|
376
|
+
version: artifact.latestVersion
|
|
377
|
+
});
|
|
378
|
+
const outline = latest?.outline;
|
|
379
|
+
const shows = outline?.kind === "canvas" && outline.items.some((item) => item.type === "board" && item.id === anchor.board);
|
|
380
|
+
if (!shows)
|
|
381
|
+
throw invalid(`The artifact shows no board '${anchor.board}'.`);
|
|
382
|
+
}
|
|
383
|
+
const { point } = anchor;
|
|
384
|
+
if (point !== undefined && anchor.board === undefined) {
|
|
385
|
+
throw invalid("A comment's point is on the board it names.");
|
|
386
|
+
}
|
|
387
|
+
if (point !== undefined && ![point.x, point.y].every((value) => Number.isFinite(value) && value >= 0 && value <= 1)) {
|
|
388
|
+
throw invalid("A comment's point is on its board: x and y from 0 to 1.");
|
|
389
|
+
}
|
|
390
|
+
const label = anchor.label?.replace(/\s+/g, " ").trim().slice(0, ARTIFACT_COMMENT_LIMITS2.maxLabelLength);
|
|
391
|
+
return {
|
|
392
|
+
...anchor.board === undefined ? {} : { board: anchor.board },
|
|
393
|
+
...anchor.element === undefined ? {} : { element: anchor.element },
|
|
394
|
+
...label ? { label } : {},
|
|
395
|
+
...point === undefined ? {} : { point: { x: point.x, y: point.y } },
|
|
396
|
+
revision
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function commentRequestError(error) {
|
|
400
|
+
if (!(error instanceof ArtifactStorageError))
|
|
401
|
+
return error;
|
|
402
|
+
switch (error.code) {
|
|
403
|
+
case "artifact_not_found":
|
|
404
|
+
return new ArtifactRequestError2("artifact_not_found", error.message);
|
|
405
|
+
case "comment_not_found":
|
|
406
|
+
return new ArtifactRequestError2("comment_not_found", error.message);
|
|
407
|
+
case "artifact_comments_full":
|
|
408
|
+
return new ArtifactRequestError2("comments_full", error.message);
|
|
409
|
+
default:
|
|
410
|
+
return error;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function invalid(message) {
|
|
414
|
+
return new ArtifactRequestError2("invalid_comment", `[Sixb] ${message}`);
|
|
415
|
+
}
|
|
416
|
+
function notFound(artifactId) {
|
|
417
|
+
return new ArtifactRequestError2("artifact_not_found", `[Sixb] Artifact '${artifactId}' was not found.`);
|
|
418
|
+
}
|
|
419
|
+
function commentNotFound(artifactId, commentId) {
|
|
420
|
+
return new ArtifactRequestError2("comment_not_found", `[Sixb] Artifact '${artifactId}' has no comment '${commentId}'.`);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// src/artifacts/holders.ts
|
|
424
|
+
var HOLDER_PAGE = 100;
|
|
425
|
+
async function* readableHoldings(input) {
|
|
426
|
+
const { runtime, reader, artifactId } = input;
|
|
427
|
+
let after;
|
|
428
|
+
do {
|
|
429
|
+
const page = await input.objects.listArtifactHolders({
|
|
430
|
+
projectId: runtime.projectId,
|
|
431
|
+
artifactId,
|
|
432
|
+
...after ? { after } : {},
|
|
433
|
+
limit: HOLDER_PAGE
|
|
434
|
+
});
|
|
435
|
+
const objects = await readHolders(reader, page.holders);
|
|
436
|
+
for (const holder of page.holders) {
|
|
437
|
+
const object = objects.get(objectBatchKey2(holder.objectTypeId, holder.primaryId));
|
|
438
|
+
if (!object || !holdsArtifact(runtime, object, holder.propertyId, artifactId))
|
|
439
|
+
continue;
|
|
440
|
+
const edits = isRuntimeAllowed2(runtime, {
|
|
441
|
+
kind: "object.edit",
|
|
442
|
+
objectTypeId: holder.objectTypeId
|
|
443
|
+
});
|
|
444
|
+
yield { ...holder, access: edits ? "update" : "read", object };
|
|
445
|
+
}
|
|
446
|
+
after = page.next;
|
|
447
|
+
} while (after);
|
|
448
|
+
}
|
|
449
|
+
async function readHolders(reader, holders) {
|
|
450
|
+
const byType = new Map;
|
|
451
|
+
for (const { objectTypeId, primaryId } of holders) {
|
|
452
|
+
const primaryIds = byType.get(objectTypeId) ?? new Set;
|
|
453
|
+
byType.set(objectTypeId, primaryIds.add(primaryId));
|
|
454
|
+
}
|
|
455
|
+
const read = new Map;
|
|
456
|
+
for (const [objectTypeId, primaryIds] of byType) {
|
|
457
|
+
try {
|
|
458
|
+
const rows = await reader.getByPrimaryIdBatch({
|
|
459
|
+
items: [...primaryIds].map((primaryId) => ({ objectTypeId, primaryId }))
|
|
460
|
+
});
|
|
461
|
+
for (const [key, row] of rows)
|
|
462
|
+
read.set(key, row);
|
|
463
|
+
} catch (error) {
|
|
464
|
+
if (!(error instanceof AuthorizationError2))
|
|
465
|
+
throw error;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return read;
|
|
469
|
+
}
|
|
470
|
+
function holdsArtifact(runtime, object, propertyId, artifactId) {
|
|
471
|
+
const property = runtime.ontology.getObjectTypeById(object.objectTypeId)?.properties.find((candidate) => candidate.id === propertyId);
|
|
472
|
+
if (!property)
|
|
473
|
+
return false;
|
|
474
|
+
const held = collectArtifactRefIds(property.schema, object.properties[propertyId], runtime.ontology.getValueTypesById(), new Set);
|
|
475
|
+
return held.has(artifactId);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// src/artifacts/live/state.ts
|
|
479
|
+
import * as Y from "yjs";
|
|
480
|
+
|
|
481
|
+
// src/artifacts/live/files.ts
|
|
482
|
+
import { createHash } from "crypto";
|
|
483
|
+
import { posix } from "path";
|
|
484
|
+
var strictUtf8 = new TextDecoder("utf-8", { fatal: true });
|
|
485
|
+
async function readLiveFiles2(blobStorage, files) {
|
|
486
|
+
const read = await Promise.all(files.map(async ({ path, file }) => {
|
|
487
|
+
if (!isLiveTextPath(path) || file.sizeBytes > ARTIFACT_LIMITS2.maxFileBytes) {
|
|
488
|
+
return [path, { file }];
|
|
489
|
+
}
|
|
490
|
+
const bytes = new Uint8Array(await new Response(await blobStorage.open(file.blobId)).arrayBuffer());
|
|
491
|
+
try {
|
|
492
|
+
return [path, { text: strictUtf8.decode(bytes) }];
|
|
493
|
+
} catch {
|
|
494
|
+
return [path, { file }];
|
|
495
|
+
}
|
|
496
|
+
}));
|
|
497
|
+
return new Map(read.sort(([left], [right]) => left < right ? -1 : 1));
|
|
498
|
+
}
|
|
499
|
+
async function storeLiveFiles2(blobStorage, files, known) {
|
|
500
|
+
const byPath = new Map(known.map((entry) => [entry.path, entry.file]));
|
|
501
|
+
return Promise.all([...files].map(async ([path, file]) => {
|
|
502
|
+
if ("file" in file)
|
|
503
|
+
return { path, file: { ...file.file } };
|
|
504
|
+
const body = new TextEncoder().encode(file.text);
|
|
505
|
+
const digest = `sha256:${createHash("sha256").update(body).digest("hex")}`;
|
|
506
|
+
const before = byPath.get(path);
|
|
507
|
+
if (before?.digest === digest)
|
|
508
|
+
return { path, file: { ...before } };
|
|
509
|
+
const fileName = posix.basename(path);
|
|
510
|
+
const stored = await blobStorage.put({
|
|
511
|
+
body,
|
|
512
|
+
expectedSizeBytes: body.byteLength,
|
|
513
|
+
fileName,
|
|
514
|
+
mediaType: before?.mediaType ?? inferFileMediaType2(fileName, body)
|
|
515
|
+
});
|
|
516
|
+
return { path, file: stored };
|
|
517
|
+
}));
|
|
518
|
+
}
|
|
519
|
+
function sameArtifactFiles2(left, right) {
|
|
520
|
+
if (left.length !== right.length)
|
|
521
|
+
return false;
|
|
522
|
+
const digests = new Map(left.map((entry) => [entry.path, entry.file.digest]));
|
|
523
|
+
return right.every((entry) => digests.get(entry.path) === entry.file.digest);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// src/artifacts/live/state.ts
|
|
527
|
+
function keepsDocument(kind) {
|
|
528
|
+
return kind === "canvas";
|
|
529
|
+
}
|
|
530
|
+
async function loadArtifactDocument2(blobStorage, artifact, files) {
|
|
531
|
+
const doc = new Y.Doc;
|
|
532
|
+
const stored = artifact.document;
|
|
533
|
+
if (stored?.revision === artifact.revision) {
|
|
534
|
+
Y.applyUpdate(doc, await readDocumentState2(blobStorage, stored.file));
|
|
535
|
+
return doc;
|
|
536
|
+
}
|
|
537
|
+
const clientID = madeClientId(artifact.id, stored, files);
|
|
538
|
+
const live = await readLiveFiles2(blobStorage, files);
|
|
539
|
+
let made;
|
|
540
|
+
if (stored) {
|
|
541
|
+
made = new Y.Doc;
|
|
542
|
+
made.clientID = clientID;
|
|
543
|
+
Y.applyUpdate(made, await readDocumentState2(blobStorage, stored.file));
|
|
544
|
+
mergeIntoDocument2(made, documentFiles2(made), live);
|
|
545
|
+
} else {
|
|
546
|
+
made = createArtifactDocument(artifact.kind, live, { clientID });
|
|
547
|
+
}
|
|
548
|
+
Y.applyUpdate(doc, Y.encodeStateAsUpdate(made));
|
|
549
|
+
made.destroy();
|
|
550
|
+
return doc;
|
|
551
|
+
}
|
|
552
|
+
async function readDocumentState2(blobStorage, document) {
|
|
553
|
+
return new Uint8Array(await new Response(await blobStorage.open(document.blobId)).arrayBuffer());
|
|
554
|
+
}
|
|
555
|
+
async function storeArtifactDocument(blobStorage, doc) {
|
|
556
|
+
const body = Y.encodeStateAsUpdate(doc);
|
|
557
|
+
return blobStorage.put({
|
|
558
|
+
body,
|
|
559
|
+
expectedSizeBytes: body.byteLength,
|
|
560
|
+
fileName: "document.yjs",
|
|
561
|
+
mediaType: "application/octet-stream"
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
async function firstArtifactDocument(blobStorage, kind, files) {
|
|
565
|
+
if (!keepsDocument(kind))
|
|
566
|
+
return;
|
|
567
|
+
const doc = createArtifactDocument(kind, await readLiveFiles2(blobStorage, files));
|
|
568
|
+
try {
|
|
569
|
+
return await storeArtifactDocument(blobStorage, doc);
|
|
570
|
+
} finally {
|
|
571
|
+
doc.destroy();
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
function madeClientId(artifactId, stored, files) {
|
|
575
|
+
const named = [...files].map(({ path, file }) => `${path}\x00${file.digest}`).sort().join("\x01");
|
|
576
|
+
const from = stored ? `${stored.file.digest}@${stored.revision}` : "";
|
|
577
|
+
let hash = 2166136261;
|
|
578
|
+
for (const char of `${artifactId}\x02${from}\x02${named}`) {
|
|
579
|
+
hash ^= char.codePointAt(0) ?? 0;
|
|
580
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
581
|
+
}
|
|
582
|
+
return hash;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// src/artifacts/publish/merge.ts
|
|
586
|
+
import * as Y2 from "yjs";
|
|
587
|
+
var MERGE_ATTEMPTS = 3;
|
|
588
|
+
async function mergeArtifactWrite(context, write) {
|
|
589
|
+
const unmerged = {
|
|
590
|
+
files: write.files,
|
|
591
|
+
...write.baseRevision === undefined ? {} : { baseRevision: write.baseRevision },
|
|
592
|
+
merged: false
|
|
593
|
+
};
|
|
594
|
+
if (!keepsDocument(write.kind))
|
|
595
|
+
return unmerged;
|
|
596
|
+
const { projectId, storage, blobStorage } = context;
|
|
597
|
+
const artifact = await storage.get({ projectId, id: write.artifactId });
|
|
598
|
+
const latest = artifact && await storage.getVersion({
|
|
599
|
+
projectId,
|
|
600
|
+
artifactId: artifact.id,
|
|
601
|
+
version: artifact.latestVersion
|
|
602
|
+
});
|
|
603
|
+
if (!artifact || !latest || artifact.kind !== write.kind)
|
|
604
|
+
return unmerged;
|
|
605
|
+
const moved = write.baseRevision !== undefined && write.baseRevision !== artifact.revision;
|
|
606
|
+
const doc = await loadArtifactDocument2(blobStorage, artifact, latest.files);
|
|
607
|
+
try {
|
|
608
|
+
let merged = moved;
|
|
609
|
+
if (write.update) {
|
|
610
|
+
Y2.applyUpdate(doc, write.update);
|
|
611
|
+
} else {
|
|
612
|
+
const files = moved ? write.baseFiles ?? await filesAtRevision(storage, projectId, artifact.id, write.baseRevision ?? 0) : write.baseFiles;
|
|
613
|
+
if (moved && !files)
|
|
614
|
+
return unmerged;
|
|
615
|
+
let base = documentFiles2(doc);
|
|
616
|
+
merged = files !== undefined && files !== null && !sameArtifactFiles2(files, latest.files);
|
|
617
|
+
if (merged && files)
|
|
618
|
+
base = await readLiveFiles2(blobStorage, files);
|
|
619
|
+
mergeIntoDocument2(doc, base, await readLiveFiles2(blobStorage, write.files));
|
|
620
|
+
}
|
|
621
|
+
const files = merged || write.update ? await storeLiveFiles2(blobStorage, documentFiles2(doc), [...latest.files, ...write.files]) : write.files;
|
|
622
|
+
const renamed = moved && write.baseTitle !== undefined && write.title === write.baseTitle && artifact.title !== write.title;
|
|
623
|
+
return {
|
|
624
|
+
files,
|
|
625
|
+
baseRevision: artifact.revision,
|
|
626
|
+
merged,
|
|
627
|
+
document: await storeArtifactDocument(blobStorage, doc),
|
|
628
|
+
...renamed ? { title: artifact.title } : {}
|
|
629
|
+
};
|
|
630
|
+
} finally {
|
|
631
|
+
doc.destroy();
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
async function withMergedWrite(context, write, store) {
|
|
635
|
+
for (let attempt = 1;; attempt += 1) {
|
|
636
|
+
const merged = await mergeArtifactWrite(context, write);
|
|
637
|
+
try {
|
|
638
|
+
return await store(merged);
|
|
639
|
+
} catch (error) {
|
|
640
|
+
if (!isMoved(error) || !keepsDocument(write.kind) || attempt === MERGE_ATTEMPTS)
|
|
641
|
+
throw error;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
async function documentHolding(context, artifactId, files) {
|
|
646
|
+
const { projectId, storage, blobStorage } = context;
|
|
647
|
+
const artifact = await storage.get({ projectId, id: artifactId });
|
|
648
|
+
if (!artifact || !keepsDocument(artifact.kind))
|
|
649
|
+
return null;
|
|
650
|
+
const latest = await storage.getVersion({
|
|
651
|
+
projectId,
|
|
652
|
+
artifactId,
|
|
653
|
+
version: artifact.latestVersion
|
|
654
|
+
});
|
|
655
|
+
if (!latest)
|
|
656
|
+
return null;
|
|
657
|
+
const doc = await loadArtifactDocument2(blobStorage, artifact, latest.files);
|
|
658
|
+
try {
|
|
659
|
+
mergeIntoDocument2(doc, documentFiles2(doc), await readLiveFiles2(blobStorage, files));
|
|
660
|
+
return {
|
|
661
|
+
document: await storeArtifactDocument(blobStorage, doc),
|
|
662
|
+
baseRevision: artifact.revision
|
|
663
|
+
};
|
|
664
|
+
} finally {
|
|
665
|
+
doc.destroy();
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
async function withDocumentHolding(context, artifactId, files, baseRevision, store) {
|
|
669
|
+
for (let attempt = 1;; attempt += 1) {
|
|
670
|
+
const held = files ? await documentHolding(context, artifactId, files) : null;
|
|
671
|
+
const base = baseRevision ?? held?.baseRevision;
|
|
672
|
+
const fits = held && (baseRevision === undefined || baseRevision === held.baseRevision);
|
|
673
|
+
try {
|
|
674
|
+
return await store({
|
|
675
|
+
...fits ? { document: held.document } : {},
|
|
676
|
+
...base === undefined ? {} : { baseRevision: base }
|
|
677
|
+
});
|
|
678
|
+
} catch (error) {
|
|
679
|
+
if (!isMoved(error) || baseRevision !== undefined || !held || attempt === MERGE_ATTEMPTS) {
|
|
680
|
+
throw error;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
async function undoneTurnDocuments(context, turnRunId) {
|
|
686
|
+
const { projectId, storage } = context;
|
|
687
|
+
const documents = {};
|
|
688
|
+
for (const write of await storage.listTurnWrites({ projectId, turnRunId })) {
|
|
689
|
+
if (write.created)
|
|
690
|
+
continue;
|
|
691
|
+
const artifact = await storage.get({ projectId, id: write.artifactId });
|
|
692
|
+
if (!artifact || !keepsDocument(artifact.kind))
|
|
693
|
+
continue;
|
|
694
|
+
const points = await storage.listRestorePoints({ projectId, id: artifact.id });
|
|
695
|
+
const point = points.find((each) => each.turnRunId === turnRunId);
|
|
696
|
+
const target = point && await storage.getVersion({ projectId, artifactId: artifact.id, version: point.version });
|
|
697
|
+
const undoable = turnUndoable2({
|
|
698
|
+
write,
|
|
699
|
+
revision: artifact.revision,
|
|
700
|
+
...point ? { point } : {},
|
|
701
|
+
...target ? { target: { frozen: target.frozenAt !== undefined } } : {}
|
|
702
|
+
});
|
|
703
|
+
if (!point || !undoable)
|
|
704
|
+
continue;
|
|
705
|
+
const held = await documentHolding(context, artifact.id, point.files);
|
|
706
|
+
if (held?.baseRevision === artifact.revision)
|
|
707
|
+
documents[artifact.id] = held.document;
|
|
708
|
+
}
|
|
709
|
+
return documents;
|
|
710
|
+
}
|
|
711
|
+
function isMoved(error) {
|
|
712
|
+
return (error instanceof ArtifactRequestError2 || error instanceof ArtifactStorageError) && error.code === "artifact_moved";
|
|
713
|
+
}
|
|
714
|
+
async function filesAtRevision(storage, projectId, artifactId, revision) {
|
|
715
|
+
const point = await storage.getRestorePoint({ projectId, artifactId, revision });
|
|
716
|
+
if (point)
|
|
717
|
+
return point.files;
|
|
718
|
+
const { versions } = await storage.listVersions({ projectId, artifactId, limit: 50 });
|
|
719
|
+
return versions.find((version) => version.revision === revision)?.files ?? null;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// src/artifacts/publish/previews.ts
|
|
723
|
+
import { createHash as createHash2 } from "crypto";
|
|
724
|
+
|
|
725
|
+
// src/artifacts/publish/query-answers.ts
|
|
726
|
+
async function answerArtifactQuery(read) {
|
|
727
|
+
try {
|
|
728
|
+
const result = await read();
|
|
729
|
+
if (!result)
|
|
730
|
+
return { error: UNREADABLE };
|
|
731
|
+
return { result: serializeArtifactQueryResult2(result) };
|
|
732
|
+
} catch (error) {
|
|
733
|
+
if (error instanceof ArtifactRequestError2 || error instanceof AuthorizationError2 || error instanceof ObjectQueryExecutionError2) {
|
|
734
|
+
return { error: /[.!?]$/.test(error.message) ? error.message : `${error.message}.` };
|
|
735
|
+
}
|
|
736
|
+
console.warn("[Sixb] A query of an artifact version did not run:", error);
|
|
737
|
+
return { error: UNREADABLE };
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
async function answerArtifactQueries2(version, read) {
|
|
741
|
+
const names = version.files.flatMap((file) => {
|
|
742
|
+
const name = artifactQueryName2(file.path);
|
|
743
|
+
return name === undefined ? [] : [name];
|
|
744
|
+
});
|
|
745
|
+
const answers = await Promise.all(names.map(async (name) => [name, await answerArtifactQuery(() => read(name))]));
|
|
746
|
+
return Object.fromEntries(answers);
|
|
747
|
+
}
|
|
748
|
+
function parseArtifactQueryAnswers2(text) {
|
|
749
|
+
let value;
|
|
750
|
+
try {
|
|
751
|
+
value = JSON.parse(text);
|
|
752
|
+
} catch {
|
|
753
|
+
return null;
|
|
754
|
+
}
|
|
755
|
+
if (!isObject(value))
|
|
756
|
+
return null;
|
|
757
|
+
const answers = {};
|
|
758
|
+
for (const [name, answer] of Object.entries(value)) {
|
|
759
|
+
if (!isArtifactQueryName(name) || !isObject(answer))
|
|
760
|
+
return null;
|
|
761
|
+
if ("result" in answer)
|
|
762
|
+
answers[name] = { result: answer.result };
|
|
763
|
+
else if (typeof answer.error === "string")
|
|
764
|
+
answers[name] = { error: answer.error };
|
|
765
|
+
else
|
|
766
|
+
return null;
|
|
188
767
|
}
|
|
768
|
+
return answers;
|
|
769
|
+
}
|
|
770
|
+
var UNREADABLE = "[Sixb] The query could not be read.";
|
|
771
|
+
function isObject(value) {
|
|
772
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
// src/artifacts/publish/previews.ts
|
|
776
|
+
var BOARD_PREVIEW_MEDIA_TYPES2 = {
|
|
777
|
+
full: "image/png",
|
|
778
|
+
small: "image/webp"
|
|
779
|
+
};
|
|
780
|
+
var SIZES = ["full", "small"];
|
|
781
|
+
var MAX_BOARD_PREVIEW_BYTES2 = 8 * 1024 * 1024;
|
|
782
|
+
var RENDER_KEY_FORMAT = "sixb-board-preview/1";
|
|
783
|
+
function boardRenderKey(input) {
|
|
784
|
+
const { board, files, boardFiles, author, artifactId } = input;
|
|
785
|
+
const loaded = files.filter((entry) => entry.path !== CANVAS_FILE2 && (entry.path === board.file || !boardFiles.has(entry.path))).map((entry) => [entry.path, entry.file.digest]).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0);
|
|
786
|
+
const reader = boardsReadLiveData2({ files }) ? [author.type, author.id] : null;
|
|
787
|
+
return createHash2("sha256").update(JSON.stringify([
|
|
788
|
+
RENDER_KEY_FORMAT,
|
|
789
|
+
frameKitDigest(),
|
|
790
|
+
board.file,
|
|
791
|
+
board.w,
|
|
792
|
+
board.h,
|
|
793
|
+
artifactId,
|
|
794
|
+
reader,
|
|
795
|
+
loaded
|
|
796
|
+
])).digest("hex");
|
|
797
|
+
}
|
|
798
|
+
function canvasPreviewOutline(outline, themes) {
|
|
799
|
+
return { ...outline, themes: [...themes] };
|
|
800
|
+
}
|
|
801
|
+
function withBoardRenderKeys(version, artifactId) {
|
|
802
|
+
const { outline } = version;
|
|
803
|
+
if (outline.kind !== "canvas")
|
|
804
|
+
return version;
|
|
805
|
+
const boardFiles = new Set(outline.items.flatMap((item) => item.type === "board" ? [item.file] : []));
|
|
806
|
+
return {
|
|
807
|
+
...version,
|
|
808
|
+
outline: {
|
|
809
|
+
...outline,
|
|
810
|
+
items: outline.items.map((item) => item.type === "board" ? {
|
|
811
|
+
...item,
|
|
812
|
+
renderKey: boardRenderKey({
|
|
813
|
+
board: item,
|
|
814
|
+
files: version.files,
|
|
815
|
+
boardFiles,
|
|
816
|
+
author: version.author,
|
|
817
|
+
artifactId
|
|
818
|
+
})
|
|
819
|
+
} : item)
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
function boardPreviewsOfCopy(copyId) {
|
|
824
|
+
const renamed = new Map;
|
|
825
|
+
const outlineOf = (version) => {
|
|
826
|
+
if (version.outline.kind !== "canvas")
|
|
827
|
+
return;
|
|
828
|
+
const copied = withBoardRenderKeys(version, copyId);
|
|
829
|
+
if (boardsReadLiveData2(version))
|
|
830
|
+
return copied.outline;
|
|
831
|
+
const source = new Map(previewedBoards(version).boards.map((each) => [each.id, each.renderKey]));
|
|
832
|
+
for (const board of previewedBoards(copied).boards) {
|
|
833
|
+
const from = source.get(board.id);
|
|
834
|
+
if (from)
|
|
835
|
+
renamed.set(from, board.renderKey);
|
|
836
|
+
}
|
|
837
|
+
return copied.outline;
|
|
838
|
+
};
|
|
839
|
+
const carry = async (storage, projectId) => {
|
|
840
|
+
if (renamed.size === 0)
|
|
841
|
+
return;
|
|
842
|
+
const pictures = await storage.listBoardPreviews({ projectId, renderKeys: [...renamed.keys()] });
|
|
843
|
+
const previews = pictures.flatMap((picture) => {
|
|
844
|
+
const renderKey = renamed.get(picture.renderKey);
|
|
845
|
+
return renderKey ? [{ ...picture, renderKey }] : [];
|
|
846
|
+
});
|
|
847
|
+
if (previews.length > 0)
|
|
848
|
+
await storage.putBoardPreviews({ projectId, previews });
|
|
849
|
+
};
|
|
850
|
+
return { outlineOf, carry };
|
|
851
|
+
}
|
|
852
|
+
function previewedBoards(version) {
|
|
853
|
+
const { outline } = version;
|
|
854
|
+
if (outline.kind !== "canvas" || !outline.themes)
|
|
855
|
+
return { boards: [], themes: [] };
|
|
856
|
+
return {
|
|
857
|
+
boards: outline.items.flatMap((item) => item.type === "board" && item.renderKey ? [{ ...item, renderKey: item.renderKey }] : []),
|
|
858
|
+
themes: outline.themes
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
function boardsReadLiveData2(version) {
|
|
862
|
+
return version.files.some((file) => artifactQueryName2(file.path) !== undefined);
|
|
863
|
+
}
|
|
864
|
+
async function boardPreviews2(storage, version) {
|
|
865
|
+
const { boards } = previewedBoards(version);
|
|
866
|
+
if (boards.length === 0)
|
|
867
|
+
return new Map;
|
|
868
|
+
const stored = await storage.listBoardPreviews({
|
|
869
|
+
projectId: version.projectId,
|
|
870
|
+
renderKeys: [...new Set(boards.map((board) => board.renderKey))]
|
|
871
|
+
});
|
|
872
|
+
return new Map(boards.map((board) => [
|
|
873
|
+
board.id,
|
|
874
|
+
stored.filter((preview) => preview.renderKey === board.renderKey)
|
|
875
|
+
]));
|
|
876
|
+
}
|
|
877
|
+
function boardPreview2(pictures, theme, size) {
|
|
878
|
+
return pictures?.find((picture) => picture.theme === theme && picture.size === size);
|
|
879
|
+
}
|
|
880
|
+
function pictured(pictures, theme) {
|
|
881
|
+
return SIZES.every((size) => boardPreview2(pictures, theme, size));
|
|
882
|
+
}
|
|
883
|
+
async function missingBoardPreviews2(storage, version) {
|
|
884
|
+
const { boards, themes } = previewedBoards(version);
|
|
885
|
+
const stored = await boardPreviews2(storage, version);
|
|
886
|
+
return boards.flatMap((board) => {
|
|
887
|
+
const missing = themes.filter((theme) => !pictured(stored.get(board.id), theme));
|
|
888
|
+
return missing.length === 0 ? [] : [{ board, renderKey: board.renderKey, themes: missing }];
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
async function boardPreviewStatuses2(storage, version, input) {
|
|
892
|
+
const { boards, themes } = previewedBoards(version);
|
|
893
|
+
const stored = await boardPreviews2(storage, version);
|
|
894
|
+
const waiting = input.renders && input.now.getTime() - version.updatedAt.getTime() < BOARD_PREVIEW_WAIT_MS2;
|
|
895
|
+
return new Map(boards.map((board) => {
|
|
896
|
+
const ready = themes.every((theme) => pictured(stored.get(board.id), theme));
|
|
897
|
+
return [board.id, ready ? "ready" : waiting ? "pending" : "none"];
|
|
898
|
+
}));
|
|
899
|
+
}
|
|
900
|
+
async function storeBoardPreviews2(context, version, previews) {
|
|
901
|
+
if (previews.length === 0)
|
|
902
|
+
return [];
|
|
903
|
+
const { boards, themes } = previewedBoards(version);
|
|
904
|
+
const keys = new Map(boards.map((board) => [board.id, board.renderKey]));
|
|
905
|
+
const createdAt = new Date;
|
|
906
|
+
const checked = await Promise.all(previews.map(async (preview) => {
|
|
907
|
+
const { board, theme, size, file } = preview;
|
|
908
|
+
const refuse = (reason) => ({ refused: { board, theme, size, reason } });
|
|
909
|
+
const renderKey = keys.get(board);
|
|
910
|
+
if (!renderKey || !themes.includes(theme)) {
|
|
911
|
+
return refuse(`the version has no board '${board}' to picture in ${theme} mode`);
|
|
912
|
+
}
|
|
913
|
+
const mediaType = SIZES.includes(size) ? BOARD_PREVIEW_MEDIA_TYPES2[size] : undefined;
|
|
914
|
+
if (!mediaType || !isValidFileRef(file) || file.mediaType !== mediaType) {
|
|
915
|
+
return refuse(`a ${size} picture must be ${mediaType ?? "full or small"}`);
|
|
916
|
+
}
|
|
917
|
+
if (file.sizeBytes > MAX_BOARD_PREVIEW_BYTES2) {
|
|
918
|
+
return refuse(`it is ${file.sizeBytes} bytes, past the ${MAX_BOARD_PREVIEW_BYTES2} kept`);
|
|
919
|
+
}
|
|
920
|
+
if (!await statFileRef2(context.blobStorage, file))
|
|
921
|
+
return refuse("it is not stored");
|
|
922
|
+
return { record: { renderKey, theme, size, file: { ...file }, createdAt } };
|
|
923
|
+
}));
|
|
924
|
+
const records = checked.flatMap((each) => ("record" in each) ? [each.record] : []);
|
|
925
|
+
if (records.length > 0) {
|
|
926
|
+
await context.storage.putBoardPreviews({ projectId: version.projectId, previews: records });
|
|
927
|
+
}
|
|
928
|
+
return checked.flatMap((each) => ("refused" in each) ? [each.refused] : []);
|
|
929
|
+
}
|
|
930
|
+
function boardPreviewsJobId(artifactId) {
|
|
931
|
+
return `art_previews_${artifactId}`;
|
|
932
|
+
}
|
|
933
|
+
async function requestBoardPreviews(input, version, options = {}) {
|
|
934
|
+
if (version.outline.kind !== "canvas")
|
|
935
|
+
return;
|
|
936
|
+
try {
|
|
937
|
+
if ((await missingBoardPreviews2(input.storage, version)).length === 0)
|
|
938
|
+
return;
|
|
939
|
+
const queries = boardsReadLiveData2(version) && !options.withoutAnswers ? await storeQueryAnswers(input, version) : undefined;
|
|
940
|
+
const delayMs = options.delayMs ?? BOARD_PREVIEW_JOB2.settleMs;
|
|
941
|
+
await input.queue.enqueue({
|
|
942
|
+
projectId: version.projectId,
|
|
943
|
+
jobs: [
|
|
944
|
+
{
|
|
945
|
+
id: boardPreviewsJobId(version.artifactId),
|
|
946
|
+
replace: true,
|
|
947
|
+
type: "agent.artifact-previews.requested",
|
|
948
|
+
payload: {
|
|
949
|
+
artifactId: version.artifactId,
|
|
950
|
+
version: version.version,
|
|
951
|
+
updatedAt: version.updatedAt.toISOString(),
|
|
952
|
+
...queries ? { queries } : {}
|
|
953
|
+
},
|
|
954
|
+
availableAt: new Date(Date.now() + delayMs).toISOString()
|
|
955
|
+
}
|
|
956
|
+
]
|
|
957
|
+
});
|
|
958
|
+
} catch (error) {
|
|
959
|
+
console.error(`[Sixb] Could not ask for the previews of version ${version.version} of '${version.artifactId}'; its boards show their outlines.`, error);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
async function storeQueryAnswers(input, version) {
|
|
963
|
+
const answers = await answerArtifactQueries2(version, input.query);
|
|
964
|
+
const body = new TextEncoder().encode(JSON.stringify(answers));
|
|
965
|
+
return input.blobStorage.put({
|
|
966
|
+
body,
|
|
967
|
+
expectedSizeBytes: body.byteLength,
|
|
968
|
+
fileName: `${version.artifactId}-r${version.revision}-queries.json`,
|
|
969
|
+
mediaType: "application/json"
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
var kitDigest;
|
|
973
|
+
function frameKitDigest() {
|
|
974
|
+
kitDigest ??= createHash2("sha256").update(JSON.stringify([FRAME_ASSETS2, FRAME_DEFAULT_THEMES2])).digest("hex");
|
|
975
|
+
return kitDigest;
|
|
189
976
|
}
|
|
190
977
|
|
|
191
978
|
// src/artifacts/run-query.ts
|
|
@@ -509,6 +1296,9 @@ async function resolveReferences(context, found) {
|
|
|
509
1296
|
const target = await version;
|
|
510
1297
|
if (!target)
|
|
511
1298
|
throw invalidArtifact(`${where}: \u201C${record.title}\u201D has no version ${number}.`);
|
|
1299
|
+
if (address.version !== undefined && !target.frozenAt) {
|
|
1300
|
+
throw invalidArtifact(`${where} pins version ${number} of \u201C${record.title}\u201D, which is still open and changes with every write. Write artifact:${record.id} without @${number} to follow its latest version; a version can be pinned once someone creates it.`);
|
|
1301
|
+
}
|
|
512
1302
|
const result = resolveArtifactAddress2(address, { kind: record.kind, ...target });
|
|
513
1303
|
if ("problem" in result) {
|
|
514
1304
|
throw invalidArtifact(`${where}: \u201C${target.title}\u201D ${result.problem}.`);
|
|
@@ -536,7 +1326,7 @@ async function brokenDependents(context, artifact, version) {
|
|
|
536
1326
|
continue;
|
|
537
1327
|
broken.push({
|
|
538
1328
|
code: "reference_broken",
|
|
539
|
-
message: `\u201C${dependent.title}\u201D (${dependent.artifactId}) ${reference.as === "embed" ? "shows" : "links to"} ${reference.address}, but version ${version.version} ${result.problem}.
|
|
1329
|
+
message: `\u201C${dependent.title}\u201D (${dependent.artifactId}) ${reference.as === "embed" ? "shows" : "links to"} ${reference.address}, but version ${version.version} ${result.problem}. Update it with an address that resolves, or restore what it names.`
|
|
540
1330
|
});
|
|
541
1331
|
}
|
|
542
1332
|
if (broken.length === 0)
|
|
@@ -555,7 +1345,7 @@ function ownArtifacts(author) {
|
|
|
555
1345
|
}
|
|
556
1346
|
|
|
557
1347
|
// src/artifacts/publish/validate/canvas.ts
|
|
558
|
-
import { posix } from "path";
|
|
1348
|
+
import { posix as posix2 } from "path";
|
|
559
1349
|
async function validateCanvas(blobStorage, files) {
|
|
560
1350
|
const byPath = new Map(files.map((file) => [file.path, file]));
|
|
561
1351
|
const canvasFile = byPath.get(CANVAS_FILE2);
|
|
@@ -573,7 +1363,7 @@ async function validateCanvas(blobStorage, files) {
|
|
|
573
1363
|
references.push({ address: item.src, as: "embed", at: item.id });
|
|
574
1364
|
if (item.type !== "board")
|
|
575
1365
|
continue;
|
|
576
|
-
const file = byPath.get(
|
|
1366
|
+
const file = byPath.get(posix2.normalize(item.file));
|
|
577
1367
|
if (!file) {
|
|
578
1368
|
throw invalidArtifact(`${CANVAS_FILE2} board '${item.id}' shows '${item.file}', which is not one of the canvas's files.`);
|
|
579
1369
|
}
|
|
@@ -594,14 +1384,18 @@ async function validateCanvas(blobStorage, files) {
|
|
|
594
1384
|
const named = { id: item.id, ...title ? { title } : {} };
|
|
595
1385
|
if (item.type === "board") {
|
|
596
1386
|
return [
|
|
597
|
-
{ ...named, type: "board", file:
|
|
1387
|
+
{ ...named, type: "board", file: posix2.normalize(item.file), w: item.w, h: item.h }
|
|
598
1388
|
];
|
|
599
1389
|
}
|
|
600
1390
|
return item.type === "section" ? [{ ...named, type: "section" }] : [];
|
|
601
1391
|
})
|
|
602
1392
|
},
|
|
603
1393
|
references,
|
|
604
|
-
warnings:
|
|
1394
|
+
warnings: [
|
|
1395
|
+
...layoutWarnings(canvas),
|
|
1396
|
+
...overprintWarnings(canvas),
|
|
1397
|
+
...crossingArrowWarnings(canvas)
|
|
1398
|
+
]
|
|
605
1399
|
};
|
|
606
1400
|
}
|
|
607
1401
|
var overlaps = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h;
|
|
@@ -634,9 +1428,102 @@ function layoutWarnings(canvas) {
|
|
|
634
1428
|
}
|
|
635
1429
|
return warnings;
|
|
636
1430
|
}
|
|
1431
|
+
var MAX_OVERPRINTS = 12;
|
|
1432
|
+
function overprintWarnings(canvas) {
|
|
1433
|
+
const worded = canvas.items.flatMap((item) => {
|
|
1434
|
+
if (item.type !== "text" && item.type !== "note")
|
|
1435
|
+
return [];
|
|
1436
|
+
const box = canvasItemBox(item);
|
|
1437
|
+
return box ? [{ item, box }] : [];
|
|
1438
|
+
});
|
|
1439
|
+
const pairs = worded.flatMap((first, index) => worded.slice(index + 1).filter((second) => intersects(first.box, second.box)).map((second) => [first.item, second.item]));
|
|
1440
|
+
const warnings = pairs.slice(0, MAX_OVERPRINTS).map(([first, second]) => ({
|
|
1441
|
+
code: "canvas_text_overlap",
|
|
1442
|
+
part: first.id,
|
|
1443
|
+
message: `${first.type === "note" ? "Note" : "Text"} '${first.id}' and ${second.type} '${second.id}' are drawn over each other, so neither reads: move one clear of the other.`
|
|
1444
|
+
}));
|
|
1445
|
+
const more = pairs.length - warnings.length;
|
|
1446
|
+
if (more > 0) {
|
|
1447
|
+
warnings.push({
|
|
1448
|
+
code: "canvas_text_overlap",
|
|
1449
|
+
message: `${more} more pair${more === 1 ? " is" : "s are"} drawn over each other.`
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
return warnings;
|
|
1453
|
+
}
|
|
1454
|
+
function intersects(a, b) {
|
|
1455
|
+
return a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;
|
|
1456
|
+
}
|
|
1457
|
+
var MAX_CROSSING_ARROWS = 12;
|
|
1458
|
+
var MAX_CROSSED_ITEMS = 3;
|
|
1459
|
+
function crossingArrowWarnings(canvas) {
|
|
1460
|
+
const boxes = new Map(canvas.items.flatMap((item) => {
|
|
1461
|
+
const box = canvasItemBox(item);
|
|
1462
|
+
return box ? [[item.id, box]] : [];
|
|
1463
|
+
}));
|
|
1464
|
+
const crossable = canvas.items.filter((item) => item.type !== "arrow" && item.type !== "section");
|
|
1465
|
+
const crossing = canvas.items.flatMap((arrow) => {
|
|
1466
|
+
if (arrow.type !== "arrow")
|
|
1467
|
+
return [];
|
|
1468
|
+
const from = canvasEndBox(arrow.from, boxes);
|
|
1469
|
+
const to = canvasEndBox(arrow.to, boxes);
|
|
1470
|
+
if (!from || !to)
|
|
1471
|
+
return [];
|
|
1472
|
+
const { start, end } = canvasArrowLine2(from, to);
|
|
1473
|
+
const crossed = crossable.filter((item) => {
|
|
1474
|
+
const box = boxes.get(item.id);
|
|
1475
|
+
return item.id !== arrow.from && item.id !== arrow.to && box && crosses(start, end, box);
|
|
1476
|
+
});
|
|
1477
|
+
return crossed.length === 0 ? [] : [{ arrow, crossed }];
|
|
1478
|
+
});
|
|
1479
|
+
const warnings = crossing.slice(0, MAX_CROSSING_ARROWS).map(({ arrow, crossed }) => {
|
|
1480
|
+
const named = crossed.slice(0, MAX_CROSSED_ITEMS).map((item) => `${item.type} '${item.id}'`);
|
|
1481
|
+
const more = crossed.length - named.length;
|
|
1482
|
+
return {
|
|
1483
|
+
code: "canvas_arrow_crosses",
|
|
1484
|
+
part: arrow.id,
|
|
1485
|
+
message: `Arrow '${arrow.id}' is drawn across ${named.join(", ")}${more > 0 ? ` and ${more} more` : ""}: join neighbours in a row with arrows, and let a sequence that wraps to the next row read on without one.`
|
|
1486
|
+
};
|
|
1487
|
+
});
|
|
1488
|
+
const more = crossing.length - warnings.length;
|
|
1489
|
+
if (more > 0) {
|
|
1490
|
+
warnings.push({
|
|
1491
|
+
code: "canvas_arrow_crosses",
|
|
1492
|
+
message: `${more} more arrow${more === 1 ? " is" : "s are"} drawn across other items.`
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
return warnings;
|
|
1496
|
+
}
|
|
1497
|
+
function crosses(start, end, box) {
|
|
1498
|
+
const dx = end.x - start.x;
|
|
1499
|
+
const dy = end.y - start.y;
|
|
1500
|
+
let enter = 0;
|
|
1501
|
+
let leave = 1;
|
|
1502
|
+
const edges = [
|
|
1503
|
+
[-dx, start.x - box.x],
|
|
1504
|
+
[dx, box.x + box.width - start.x],
|
|
1505
|
+
[-dy, start.y - box.y],
|
|
1506
|
+
[dy, box.y + box.height - start.y]
|
|
1507
|
+
];
|
|
1508
|
+
for (const [direction, room] of edges) {
|
|
1509
|
+
if (direction === 0) {
|
|
1510
|
+
if (room <= 0)
|
|
1511
|
+
return false;
|
|
1512
|
+
continue;
|
|
1513
|
+
}
|
|
1514
|
+
const at = room / direction;
|
|
1515
|
+
if (direction < 0)
|
|
1516
|
+
enter = Math.max(enter, at);
|
|
1517
|
+
else
|
|
1518
|
+
leave = Math.min(leave, at);
|
|
1519
|
+
if (enter >= leave)
|
|
1520
|
+
return false;
|
|
1521
|
+
}
|
|
1522
|
+
return true;
|
|
1523
|
+
}
|
|
637
1524
|
|
|
638
1525
|
// src/artifacts/publish/validate/document.ts
|
|
639
|
-
import { posix as
|
|
1526
|
+
import { posix as posix3 } from "path";
|
|
640
1527
|
var DOCUMENT_ENTRY = "document.md";
|
|
641
1528
|
async function validateDocument(blobStorage, files) {
|
|
642
1529
|
const entry = files.find((file) => file.path === DOCUMENT_ENTRY);
|
|
@@ -704,7 +1591,7 @@ function checkImage(source, paths) {
|
|
|
704
1591
|
if (source === "" || source.startsWith("//") || /^[a-z][a-z\d+.-]*:/i.test(source)) {
|
|
705
1592
|
throw invalidArtifact(`${DOCUMENT_ENTRY} shows the image '${source}'. Images must be files in the artifact, by their relative path, or another artifact's address, such as artifact:art_k3m9q2x7tp#chart=revenue.`);
|
|
706
1593
|
}
|
|
707
|
-
const path =
|
|
1594
|
+
const path = posix3.normalize(safeDecodeUri(source.split(/[?#]/)[0] ?? ""));
|
|
708
1595
|
if (!paths.has(path)) {
|
|
709
1596
|
throw invalidArtifact(`${DOCUMENT_ENTRY} shows the image '${source}', which is not one of the artifact's files.`);
|
|
710
1597
|
}
|
|
@@ -774,7 +1661,7 @@ async function validatePage(blobStorage, files) {
|
|
|
774
1661
|
}
|
|
775
1662
|
|
|
776
1663
|
// src/artifacts/publish/validate/sheet.ts
|
|
777
|
-
import { posix as
|
|
1664
|
+
import { posix as posix4 } from "path";
|
|
778
1665
|
async function validateSheet(blobStorage, files, queries) {
|
|
779
1666
|
const byPath = new Map(files.map((file) => [file.path, file]));
|
|
780
1667
|
const workbookFile = byPath.get(WORKBOOK_FILE2);
|
|
@@ -934,7 +1821,7 @@ function cellProblem(value, format, byPath) {
|
|
|
934
1821
|
case "link":
|
|
935
1822
|
return /^https?:\/\/[^\s]+$/i.test(value.trim()) ? undefined : "is not a link: write a full https:// address, or another artifact's address.";
|
|
936
1823
|
case "image": {
|
|
937
|
-
const imagePath =
|
|
1824
|
+
const imagePath = posix4.normalize(value.trim());
|
|
938
1825
|
return byPath.has(imagePath) ? undefined : "is not one of the artifact's files: add the image to the artifact and give its relative path, or give another artifact's address.";
|
|
939
1826
|
}
|
|
940
1827
|
case "boolean":
|
|
@@ -1014,6 +1901,10 @@ async function validateSlides(blobStorage, files) {
|
|
|
1014
1901
|
|
|
1015
1902
|
// src/artifacts/publish/publish.ts
|
|
1016
1903
|
var CREATE_ATTEMPTS = 3;
|
|
1904
|
+
var LIVE_BOARD_PREVIEWS = {
|
|
1905
|
+
code: "canvas_previews_show_author_data",
|
|
1906
|
+
message: "Its boards read live data, so each board's preview shows the data its author can see, to everyone who can open the canvas, until they open the board."
|
|
1907
|
+
};
|
|
1017
1908
|
async function publishArtifact2(context, input, access) {
|
|
1018
1909
|
const prepared = await prepareArtifactVersion2(context, input);
|
|
1019
1910
|
const stored = await storeArtifactVersion2(context, prepared, access);
|
|
@@ -1022,39 +1913,42 @@ async function publishArtifact2(context, input, access) {
|
|
|
1022
1913
|
async function prepareArtifactVersion2(context, input) {
|
|
1023
1914
|
const title = checkTitle(input.title);
|
|
1024
1915
|
await checkArtifactFiles(context.blobStorage, input.files);
|
|
1025
|
-
|
|
1026
|
-
await checkTheme(context.blobStorage, input.files);
|
|
1916
|
+
const theme = input.kind === "file" ? undefined : await readTheme(context.blobStorage, input.files);
|
|
1027
1917
|
const queries = await checkArtifactQueries(context.blobStorage, input.kind, input.files, input.checkQuery);
|
|
1028
1918
|
const validated = await validateKind(context.blobStorage, input.kind, input.files, queries);
|
|
1029
1919
|
const readable = input.readable ?? ownArtifacts(input.author);
|
|
1030
1920
|
const references = await resolveReferences(referenceContext(context, { readable, artifactId: input.artifactId }), validated.references ?? []);
|
|
1031
1921
|
return {
|
|
1032
1922
|
...input.artifactId ? { artifactId: input.artifactId } : {},
|
|
1033
|
-
...input.
|
|
1923
|
+
...input.baseRevision === undefined ? {} : { baseRevision: input.baseRevision },
|
|
1924
|
+
...input.turnRunId === undefined ? {} : { turnRunId: input.turnRunId },
|
|
1925
|
+
...input.document ? { document: input.document } : {},
|
|
1034
1926
|
kind: input.kind,
|
|
1035
1927
|
owner: input.owner ?? input.author,
|
|
1036
1928
|
readable,
|
|
1037
|
-
warnings:
|
|
1929
|
+
warnings: [
|
|
1930
|
+
...validated.warnings ?? [],
|
|
1931
|
+
...input.kind === "canvas" && queries.size > 0 ? [LIVE_BOARD_PREVIEWS] : []
|
|
1932
|
+
],
|
|
1038
1933
|
version: {
|
|
1039
1934
|
title,
|
|
1040
1935
|
entry: validated.entry,
|
|
1041
1936
|
files: input.files.map(({ path, file }) => ({ path, file: { ...file } })),
|
|
1042
|
-
outline: validated.outline,
|
|
1937
|
+
outline: validated.outline.kind === "canvas" ? canvasPreviewOutline(validated.outline, artifactThemeModes2(theme)) : validated.outline,
|
|
1043
1938
|
references,
|
|
1044
1939
|
author: input.author,
|
|
1045
1940
|
...input.origin ? { origin: input.origin } : {},
|
|
1046
|
-
|
|
1941
|
+
updatedAt: new Date
|
|
1047
1942
|
}
|
|
1048
1943
|
};
|
|
1049
1944
|
}
|
|
1050
1945
|
async function storeArtifactVersion2(context, prepared, access) {
|
|
1051
1946
|
const { artifactId } = prepared;
|
|
1052
|
-
if (!artifactId)
|
|
1053
|
-
return createArtifact(context, prepared
|
|
1054
|
-
}
|
|
1947
|
+
if (!artifactId)
|
|
1948
|
+
return createArtifact(context, prepared);
|
|
1055
1949
|
const artifact = await context.storage.get({ projectId: context.projectId, id: artifactId });
|
|
1056
1950
|
if (!artifact)
|
|
1057
|
-
throw
|
|
1951
|
+
throw notFound2(artifactId);
|
|
1058
1952
|
assertUpdatable(artifactId, await access(artifact));
|
|
1059
1953
|
return publishVersion(context, artifactId, prepared);
|
|
1060
1954
|
}
|
|
@@ -1097,13 +1991,14 @@ async function validateKind(blobStorage, kind, files, queries) {
|
|
|
1097
1991
|
throw invalidArtifact(`'${kind}' is not a kind of artifact.`);
|
|
1098
1992
|
}
|
|
1099
1993
|
}
|
|
1100
|
-
async function
|
|
1994
|
+
async function readTheme(blobStorage, files) {
|
|
1101
1995
|
const themeFile = files.find((file) => file.path === ARTIFACT_THEME_FILE2);
|
|
1102
1996
|
if (!themeFile)
|
|
1103
1997
|
return;
|
|
1104
1998
|
const parsed = parseArtifactTheme2(await readArtifactText(blobStorage, themeFile, ARTIFACT_LIMITS2.maxThemeBytes));
|
|
1105
1999
|
if ("error" in parsed)
|
|
1106
2000
|
throw invalidArtifact(parsed.error);
|
|
2001
|
+
return parsed.theme;
|
|
1107
2002
|
}
|
|
1108
2003
|
function checkTitle(value) {
|
|
1109
2004
|
const title = typeof value === "string" ? value.trim() : "";
|
|
@@ -1121,34 +2016,44 @@ async function publishVersion(context, artifactId, prepared) {
|
|
|
1121
2016
|
projectId: context.projectId,
|
|
1122
2017
|
artifactId,
|
|
1123
2018
|
kind: prepared.kind,
|
|
1124
|
-
version: prepared.version,
|
|
1125
|
-
...prepared.
|
|
2019
|
+
version: withBoardRenderKeys(prepared.version, artifactId),
|
|
2020
|
+
...prepared.baseRevision === undefined ? {} : { baseRevision: prepared.baseRevision },
|
|
2021
|
+
...prepared.turnRunId === undefined ? {} : { turnRunId: prepared.turnRunId },
|
|
2022
|
+
...prepared.document ? { document: prepared.document } : {}
|
|
1126
2023
|
});
|
|
1127
2024
|
} catch (error) {
|
|
1128
|
-
|
|
1129
|
-
throw new ArtifactRequestError2("artifact_not_found", error.message);
|
|
1130
|
-
}
|
|
1131
|
-
if (error instanceof ArtifactStorageError && error.code === "artifact_kind_mismatch") {
|
|
1132
|
-
throw new ArtifactRequestError2("artifact_kind_mismatch", error.message);
|
|
1133
|
-
}
|
|
1134
|
-
if (error instanceof ArtifactStorageError && error.code === "artifact_moved") {
|
|
1135
|
-
throw new ArtifactRequestError2("artifact_moved", error.message, error.latest);
|
|
1136
|
-
}
|
|
1137
|
-
throw error;
|
|
2025
|
+
throw artifactRequestError(error);
|
|
1138
2026
|
}
|
|
1139
2027
|
}
|
|
1140
|
-
function
|
|
2028
|
+
function artifactRequestError(error) {
|
|
2029
|
+
if (!(error instanceof ArtifactStorageError))
|
|
2030
|
+
return error;
|
|
2031
|
+
switch (error.code) {
|
|
2032
|
+
case "artifact_not_found":
|
|
2033
|
+
case "artifact_kind_mismatch":
|
|
2034
|
+
case "restore_point_not_found":
|
|
2035
|
+
return new ArtifactRequestError2(error.code, error.message);
|
|
2036
|
+
case "artifact_moved":
|
|
2037
|
+
return new ArtifactRequestError2("artifact_moved", error.message, error.latest);
|
|
2038
|
+
default:
|
|
2039
|
+
return error;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
function notFound2(artifactId) {
|
|
1141
2043
|
return new ArtifactRequestError2("artifact_not_found", `[Sixb] Artifact '${artifactId}' was not found.`);
|
|
1142
2044
|
}
|
|
1143
|
-
async function createArtifact(context,
|
|
2045
|
+
async function createArtifact(context, prepared) {
|
|
1144
2046
|
for (let attempt = 1;; attempt += 1) {
|
|
2047
|
+
const id = createArtifactId();
|
|
1145
2048
|
try {
|
|
1146
2049
|
return await context.storage.create({
|
|
1147
2050
|
projectId: context.projectId,
|
|
1148
|
-
id
|
|
1149
|
-
kind,
|
|
1150
|
-
owner,
|
|
1151
|
-
version
|
|
2051
|
+
id,
|
|
2052
|
+
kind: prepared.kind,
|
|
2053
|
+
owner: prepared.owner,
|
|
2054
|
+
version: withBoardRenderKeys(prepared.version, id),
|
|
2055
|
+
...prepared.turnRunId === undefined ? {} : { turnRunId: prepared.turnRunId },
|
|
2056
|
+
...prepared.document ? { document: prepared.document } : {}
|
|
1152
2057
|
});
|
|
1153
2058
|
} catch (error) {
|
|
1154
2059
|
const collided = error instanceof ArtifactStorageError && error.code === "artifact_exists";
|
|
@@ -1166,13 +2071,29 @@ function publisherOf(artifacts) {
|
|
|
1166
2071
|
throw new Error("[Sixb] These artifacts are not a Sixb runtime's.");
|
|
1167
2072
|
return publisher;
|
|
1168
2073
|
}
|
|
1169
|
-
function artifactAccessRule2(artifacts
|
|
1170
|
-
return publisherOf(artifacts).rule(
|
|
2074
|
+
function artifactAccessRule2(artifacts) {
|
|
2075
|
+
return publisherOf(artifacts).rule();
|
|
2076
|
+
}
|
|
2077
|
+
function artifactTransactionRules(artifacts) {
|
|
2078
|
+
return publisherOf(artifacts).transactionRules();
|
|
1171
2079
|
}
|
|
1172
2080
|
function artifactQueryChecker2(artifacts) {
|
|
1173
2081
|
return publisherOf(artifacts).checkQuery;
|
|
1174
2082
|
}
|
|
1175
|
-
function
|
|
2083
|
+
function artifactPreviewRequester(artifacts) {
|
|
2084
|
+
return publisherOf(artifacts).requestPreviews;
|
|
2085
|
+
}
|
|
2086
|
+
function writeLiveArtifact2(artifacts, artifactId, write) {
|
|
2087
|
+
return publisherOf(artifacts).writeLive(artifactId, write);
|
|
2088
|
+
}
|
|
2089
|
+
function createRuntimeArtifactAccessRule(runtime) {
|
|
2090
|
+
return accessRuleIn(runtime, runtime.storage, runtime.objectReader);
|
|
2091
|
+
}
|
|
2092
|
+
async function transactionArtifactAccessRules(runtime) {
|
|
2093
|
+
const readerIn = await objectReadersIn(runtime.objectReader);
|
|
2094
|
+
return (tx) => accessRuleIn(runtime, tx, readerIn(tx.objects));
|
|
2095
|
+
}
|
|
2096
|
+
function accessRuleIn(runtime, storage, reader) {
|
|
1176
2097
|
const artifacts = storage.artifacts;
|
|
1177
2098
|
if (!artifacts) {
|
|
1178
2099
|
throw new ArtifactRequestError2("storage_unavailable", "[Sixb] Artifacts need storage that supports them.");
|
|
@@ -1182,16 +2103,46 @@ function createRuntimeArtifactAccessRule(runtime, storage = runtime.storage) {
|
|
|
1182
2103
|
return createArtifactAccessRule({
|
|
1183
2104
|
storage: artifacts,
|
|
1184
2105
|
projectId: runtime.projectId,
|
|
1185
|
-
caller: authority.type === "unrestricted" ? "system" : authority.type === "principal" ? authority.context.principal : null,
|
|
2106
|
+
caller: authority.type === "unrestricted" ? "system" : authority.type === "principal" ? authority.context.principal : authority.type === "delegated" ? "guest" : null,
|
|
1186
2107
|
sharing: authority.type === "principal" && authority.ref.credential?.type === "session",
|
|
1187
2108
|
conversation: async (threadId) => {
|
|
1188
2109
|
if (await threads.read(threadId))
|
|
1189
2110
|
return "update";
|
|
1190
2111
|
return isRuntimeAllowed2(runtime, { kind: "agentThreads.observe" }) ? "read" : null;
|
|
2112
|
+
},
|
|
2113
|
+
holders: async (artifact) => {
|
|
2114
|
+
let access = null;
|
|
2115
|
+
const holdings = readableHoldings({
|
|
2116
|
+
runtime,
|
|
2117
|
+
reader,
|
|
2118
|
+
objects: storage.objects,
|
|
2119
|
+
artifactId: artifact.id
|
|
2120
|
+
});
|
|
2121
|
+
for await (const holding of holdings) {
|
|
2122
|
+
if (holding.access === "update")
|
|
2123
|
+
return "update";
|
|
2124
|
+
access = "read";
|
|
2125
|
+
}
|
|
2126
|
+
return access;
|
|
1191
2127
|
}
|
|
1192
2128
|
});
|
|
1193
2129
|
}
|
|
1194
|
-
function
|
|
2130
|
+
async function updatableArtifactIds(runtime, artifactIds) {
|
|
2131
|
+
const ids = [...new Set(artifactIds)];
|
|
2132
|
+
const storage = runtime.storage.artifacts;
|
|
2133
|
+
if (ids.length === 0 || !storage)
|
|
2134
|
+
return new Set;
|
|
2135
|
+
const rule = createRuntimeArtifactAccessRule(runtime);
|
|
2136
|
+
const updatable = await Promise.all(ids.map(async (id) => {
|
|
2137
|
+
const artifact = await storage.get({ projectId: runtime.projectId, id });
|
|
2138
|
+
if (!artifact)
|
|
2139
|
+
return [];
|
|
2140
|
+
const access = await rule.accessTo(artifact);
|
|
2141
|
+
return access === "owner" || access === "update" ? [id] : [];
|
|
2142
|
+
}));
|
|
2143
|
+
return new Set(updatable.flat());
|
|
2144
|
+
}
|
|
2145
|
+
function createArtifactsRuntime(runtime, blobStorage, options = {}) {
|
|
1195
2146
|
const authority = resolveRuntimeAuthorizationForProject(runtime);
|
|
1196
2147
|
const caller = authority.type === "principal" ? authority.context.principal : authority.type === "unrestricted" ? SYSTEM_PRINCIPAL2 : null;
|
|
1197
2148
|
const requireStorage = () => {
|
|
@@ -1203,12 +2154,28 @@ function createArtifactsRuntime(runtime, blobStorage) {
|
|
|
1203
2154
|
};
|
|
1204
2155
|
const requireCaller = () => {
|
|
1205
2156
|
if (!caller) {
|
|
1206
|
-
throw new ArtifactRequestError2("not_allowed", "[Sixb] This caller cannot publish artifacts.");
|
|
2157
|
+
throw new ArtifactRequestError2("not_allowed", authority.type === "delegated" ? "[Sixb] A shared link's guest reads its artifacts and comments on them, nothing more." : "[Sixb] This caller cannot publish artifacts.");
|
|
1207
2158
|
}
|
|
1208
2159
|
return caller;
|
|
1209
2160
|
};
|
|
1210
|
-
const
|
|
2161
|
+
const commentAuthor = async () => {
|
|
2162
|
+
if (authority.type !== "delegated" || !authority.delegation)
|
|
2163
|
+
return requireCaller();
|
|
2164
|
+
return sharedLinkGuest(runtime, authority.delegation);
|
|
2165
|
+
};
|
|
2166
|
+
const rule = () => createRuntimeArtifactAccessRule(runtime);
|
|
1211
2167
|
const checkQuery = createArtifactQueryChecker(runtime);
|
|
2168
|
+
const requestPreviews = async (version, requestOptions) => {
|
|
2169
|
+
const storage = runtime.storage.artifacts;
|
|
2170
|
+
if (!options.rendersBoardPreviews || !storage)
|
|
2171
|
+
return;
|
|
2172
|
+
await requestBoardPreviews({
|
|
2173
|
+
storage,
|
|
2174
|
+
queue: runtime.queues.agents,
|
|
2175
|
+
blobStorage,
|
|
2176
|
+
query: (name) => artifacts.query(version.artifactId, name, { version: version.version })
|
|
2177
|
+
}, version, requestOptions);
|
|
2178
|
+
};
|
|
1212
2179
|
const reach = async (artifactId) => {
|
|
1213
2180
|
const artifact = await requireStorage().get({ projectId: runtime.projectId, id: artifactId });
|
|
1214
2181
|
return artifact ? { artifact, access: await rule().accessTo(artifact) } : null;
|
|
@@ -1232,16 +2199,38 @@ function createArtifactsRuntime(runtime, blobStorage) {
|
|
|
1232
2199
|
const requireUpdatable = async (artifactId) => {
|
|
1233
2200
|
const reached = await reach(artifactId);
|
|
1234
2201
|
if (!reached)
|
|
1235
|
-
throw
|
|
2202
|
+
throw notFound3(artifactId);
|
|
1236
2203
|
assertUpdatable(artifactId, reached.access);
|
|
1237
2204
|
return reached.artifact;
|
|
1238
2205
|
};
|
|
1239
|
-
const store =
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
2206
|
+
const store = async (prepared) => {
|
|
2207
|
+
const ruleIn = await transactionArtifactAccessRules(runtime);
|
|
2208
|
+
return runtime.storage.transaction(async (tx) => {
|
|
2209
|
+
const storage = tx.artifacts;
|
|
2210
|
+
if (!storage)
|
|
2211
|
+
throw new Error("[Sixb] Storage transactions hold no artifacts.");
|
|
2212
|
+
return storeArtifactVersion2({ projectId: runtime.projectId, storage, blobStorage }, prepared, (artifact) => ruleIn(tx).publishAccess(artifact));
|
|
2213
|
+
});
|
|
2214
|
+
};
|
|
2215
|
+
const change = async (artifactId, write) => {
|
|
2216
|
+
const author = requireCaller();
|
|
2217
|
+
requireStorage();
|
|
2218
|
+
const ruleIn = await transactionArtifactAccessRules(runtime);
|
|
2219
|
+
return runtime.storage.transaction(async (tx) => {
|
|
2220
|
+
const storage = tx.artifacts;
|
|
2221
|
+
if (!storage)
|
|
2222
|
+
throw new Error("[Sixb] Storage transactions hold no artifacts.");
|
|
2223
|
+
const artifact = await storage.get({ projectId: runtime.projectId, id: artifactId });
|
|
2224
|
+
if (!artifact)
|
|
2225
|
+
throw notFound3(artifactId);
|
|
2226
|
+
assertUpdatable(artifactId, await ruleIn(tx).publishAccess(artifact));
|
|
2227
|
+
try {
|
|
2228
|
+
return await write(storage, author);
|
|
2229
|
+
} catch (error) {
|
|
2230
|
+
throw artifactRequestError(error);
|
|
2231
|
+
}
|
|
2232
|
+
});
|
|
2233
|
+
};
|
|
1245
2234
|
const contentFiles = async (input) => {
|
|
1246
2235
|
if (!input.queries)
|
|
1247
2236
|
return input.files;
|
|
@@ -1262,34 +2251,121 @@ function createArtifactsRuntime(runtime, blobStorage) {
|
|
|
1262
2251
|
}
|
|
1263
2252
|
return files;
|
|
1264
2253
|
};
|
|
2254
|
+
const write = async (input) => {
|
|
2255
|
+
const author = requireCaller();
|
|
2256
|
+
const context = { projectId: runtime.projectId, storage: requireStorage(), blobStorage };
|
|
2257
|
+
return withMergedWrite(context, input, async (merged) => {
|
|
2258
|
+
const prepared = await prepareArtifactVersion2(context, {
|
|
2259
|
+
artifactId: input.artifactId,
|
|
2260
|
+
kind: input.kind,
|
|
2261
|
+
title: merged.title ?? input.title,
|
|
2262
|
+
files: merged.files,
|
|
2263
|
+
...merged.baseRevision === undefined ? {} : { baseRevision: merged.baseRevision },
|
|
2264
|
+
...merged.document ? { document: merged.document } : {},
|
|
2265
|
+
author,
|
|
2266
|
+
readable: readableBy(rule()),
|
|
2267
|
+
checkQuery
|
|
2268
|
+
});
|
|
2269
|
+
const stored = await store(prepared);
|
|
2270
|
+
await announceArtifactUpdates(runtime.events, [stored.version]);
|
|
2271
|
+
await requestPreviews(stored.version);
|
|
2272
|
+
return {
|
|
2273
|
+
...stored,
|
|
2274
|
+
warnings: await artifactVersionWarnings2(context, prepared, stored),
|
|
2275
|
+
...merged.merged ? { merged: true } : {}
|
|
2276
|
+
};
|
|
2277
|
+
});
|
|
2278
|
+
};
|
|
2279
|
+
const writeLive = async (artifactId, input) => {
|
|
2280
|
+
const artifact = await requireUpdatable(artifactId);
|
|
2281
|
+
if (!keepsDocument(artifact.kind)) {
|
|
2282
|
+
throw invalidArtifact(`Artifact '${artifactId}' is a ${artifact.kind}, which is not edited live: publish its files.`);
|
|
2283
|
+
}
|
|
2284
|
+
return write({ artifactId, kind: artifact.kind, ...input });
|
|
2285
|
+
};
|
|
1265
2286
|
const artifacts = {
|
|
2287
|
+
...createArtifactCommentsRuntime({
|
|
2288
|
+
projectId: runtime.projectId,
|
|
2289
|
+
storage: requireStorage,
|
|
2290
|
+
events: runtime.events,
|
|
2291
|
+
author: commentAuthor,
|
|
2292
|
+
manager: requireCaller,
|
|
2293
|
+
reach
|
|
2294
|
+
}),
|
|
1266
2295
|
async create(input) {
|
|
1267
2296
|
const author = requireCaller();
|
|
1268
|
-
|
|
2297
|
+
const files = await contentFiles(input);
|
|
2298
|
+
const document = await firstArtifactDocument(blobStorage, input.kind, files);
|
|
2299
|
+
const published = await publishArtifact2({ projectId: runtime.projectId, storage: requireStorage(), blobStorage }, {
|
|
1269
2300
|
kind: input.kind,
|
|
1270
2301
|
title: input.title,
|
|
1271
|
-
files
|
|
2302
|
+
files,
|
|
2303
|
+
...document ? { document } : {},
|
|
1272
2304
|
author,
|
|
1273
2305
|
readable: readableBy(rule()),
|
|
1274
2306
|
checkQuery
|
|
1275
2307
|
}, (artifact) => rule().publishAccess(artifact));
|
|
2308
|
+
await requestPreviews(published.version);
|
|
2309
|
+
return published;
|
|
1276
2310
|
},
|
|
1277
|
-
async
|
|
1278
|
-
const author = requireCaller();
|
|
2311
|
+
async update(artifactId, input) {
|
|
1279
2312
|
await requireUpdatable(artifactId);
|
|
1280
|
-
|
|
1281
|
-
const prepared = await prepareArtifactVersion2(context, {
|
|
2313
|
+
return write({
|
|
1282
2314
|
artifactId,
|
|
1283
2315
|
kind: input.kind,
|
|
1284
|
-
title: input.title,
|
|
1285
2316
|
files: await contentFiles(input),
|
|
1286
|
-
...input.
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
2317
|
+
...input.baseRevision === undefined ? {} : { baseRevision: input.baseRevision },
|
|
2318
|
+
...input.baseFiles === undefined ? {} : { baseFiles: input.baseFiles },
|
|
2319
|
+
title: input.title,
|
|
2320
|
+
...input.baseTitle === undefined ? {} : { baseTitle: input.baseTitle }
|
|
2321
|
+
});
|
|
2322
|
+
},
|
|
2323
|
+
async freeze(artifactId, input = {}) {
|
|
2324
|
+
const frozenAt = new Date;
|
|
2325
|
+
const frozen = await change(artifactId, (storage, author) => storage.freeze({
|
|
2326
|
+
projectId: runtime.projectId,
|
|
2327
|
+
artifactId,
|
|
2328
|
+
...input.baseRevision === undefined ? {} : { baseRevision: input.baseRevision },
|
|
2329
|
+
frozenAt,
|
|
2330
|
+
frozenBy: author
|
|
2331
|
+
}));
|
|
2332
|
+
if (frozen.version.frozenAt?.getTime() === frozenAt.getTime()) {
|
|
2333
|
+
await announceArtifactUpdates(runtime.events, [frozen.version]);
|
|
2334
|
+
}
|
|
2335
|
+
return frozen;
|
|
2336
|
+
},
|
|
2337
|
+
async listRestorePoints(artifactId) {
|
|
2338
|
+
if (!await getReadable(artifactId))
|
|
2339
|
+
return null;
|
|
2340
|
+
return requireStorage().listRestorePoints({ projectId: runtime.projectId, id: artifactId });
|
|
2341
|
+
},
|
|
2342
|
+
async getRestorePoint(artifactId, revision) {
|
|
2343
|
+
if (!await getReadable(artifactId))
|
|
2344
|
+
return null;
|
|
2345
|
+
return requireStorage().getRestorePoint({
|
|
2346
|
+
projectId: runtime.projectId,
|
|
2347
|
+
artifactId,
|
|
2348
|
+
revision
|
|
1290
2349
|
});
|
|
1291
|
-
|
|
1292
|
-
|
|
2350
|
+
},
|
|
2351
|
+
async restore(artifactId, revision, input = {}) {
|
|
2352
|
+
const context = { projectId: runtime.projectId, storage: requireStorage(), blobStorage };
|
|
2353
|
+
const point = await context.storage.getRestorePoint({
|
|
2354
|
+
projectId: runtime.projectId,
|
|
2355
|
+
artifactId,
|
|
2356
|
+
revision
|
|
2357
|
+
});
|
|
2358
|
+
const restored = await withDocumentHolding(context, artifactId, point?.files ?? null, input.baseRevision, (held) => change(artifactId, (storage, author) => storage.restoreTo({
|
|
2359
|
+
projectId: runtime.projectId,
|
|
2360
|
+
artifactId,
|
|
2361
|
+
revision,
|
|
2362
|
+
...held,
|
|
2363
|
+
author,
|
|
2364
|
+
restoredAt: new Date
|
|
2365
|
+
})));
|
|
2366
|
+
await announceArtifactUpdates(runtime.events, [restored.version]);
|
|
2367
|
+
await requestPreviews(restored.version, boardsReadLiveData2(restored.version) ? { withoutAnswers: true } : {});
|
|
2368
|
+
return restored;
|
|
1293
2369
|
},
|
|
1294
2370
|
async access(artifactId) {
|
|
1295
2371
|
return (await reach(artifactId))?.access ?? null;
|
|
@@ -1309,6 +2385,23 @@ function createArtifactsRuntime(runtime, blobStorage) {
|
|
|
1309
2385
|
...input.offset === undefined ? {} : { offset: input.offset }
|
|
1310
2386
|
});
|
|
1311
2387
|
},
|
|
2388
|
+
async holders(artifactId) {
|
|
2389
|
+
if (!await getReadable(artifactId))
|
|
2390
|
+
return null;
|
|
2391
|
+
const holders = [];
|
|
2392
|
+
const holdings = readableHoldings({
|
|
2393
|
+
runtime,
|
|
2394
|
+
reader: runtime.objectReader,
|
|
2395
|
+
objects: runtime.storage.objects,
|
|
2396
|
+
artifactId
|
|
2397
|
+
});
|
|
2398
|
+
for await (const holding of holdings) {
|
|
2399
|
+
if (holders.length === ARTIFACT_HOLDERS_LIMIT2)
|
|
2400
|
+
return { holders, hasMore: true };
|
|
2401
|
+
holders.push(holderObject(runtime, holding));
|
|
2402
|
+
}
|
|
2403
|
+
return { holders, hasMore: false };
|
|
2404
|
+
},
|
|
1312
2405
|
async getVersion(artifactId, version) {
|
|
1313
2406
|
return (await readVersion(artifactId, version))?.version ?? null;
|
|
1314
2407
|
},
|
|
@@ -1380,7 +2473,13 @@ function createArtifactsRuntime(runtime, blobStorage) {
|
|
|
1380
2473
|
};
|
|
1381
2474
|
}
|
|
1382
2475
|
};
|
|
1383
|
-
publishers.set(artifacts, {
|
|
2476
|
+
publishers.set(artifacts, {
|
|
2477
|
+
rule,
|
|
2478
|
+
transactionRules: () => transactionArtifactAccessRules(runtime),
|
|
2479
|
+
checkQuery,
|
|
2480
|
+
requestPreviews,
|
|
2481
|
+
writeLive
|
|
2482
|
+
});
|
|
1384
2483
|
return artifacts;
|
|
1385
2484
|
}
|
|
1386
2485
|
function stateKey(key) {
|
|
@@ -1409,10 +2508,28 @@ function queryFile(query) {
|
|
|
1409
2508
|
facets: query.facets.map((facet) => ({ propertyId: facet.property.id, limit: facet.limit }))
|
|
1410
2509
|
};
|
|
1411
2510
|
}
|
|
1412
|
-
function
|
|
2511
|
+
function holderObject(runtime, holding) {
|
|
2512
|
+
const { objectTypeId, primaryId, propertyId, object } = holding;
|
|
2513
|
+
const titleId = runtime.ontology.getObjectTypeById(objectTypeId)?.search?.title;
|
|
2514
|
+
const value = titleId === undefined ? undefined : object.properties[titleId];
|
|
2515
|
+
const title = typeof value === "string" || typeof value === "number" ? String(value).trim() : "";
|
|
2516
|
+
return { objectTypeId, primaryId, propertyId, ...title ? { title } : {} };
|
|
2517
|
+
}
|
|
2518
|
+
async function sharedLinkGuest(runtime, delegation) {
|
|
2519
|
+
const session = await runtime.storage.shareSessions?.getById({
|
|
2520
|
+
projectId: runtime.projectId,
|
|
2521
|
+
id: delegation.sessionId
|
|
2522
|
+
});
|
|
2523
|
+
const name = session?.grantId === delegation.grantId ? session.guestName : undefined;
|
|
2524
|
+
if (!name) {
|
|
2525
|
+
throw new ArtifactRequestError2("name_required", "[Sixb] A shared link's guest gives their name before they comment.");
|
|
2526
|
+
}
|
|
2527
|
+
return { type: "guest", id: delegation.sessionId, name };
|
|
2528
|
+
}
|
|
2529
|
+
function notFound3(artifactId) {
|
|
1413
2530
|
return new ArtifactRequestError2("artifact_not_found", `[Sixb] Artifact '${artifactId}' was not found.`);
|
|
1414
2531
|
}
|
|
1415
2532
|
|
|
1416
|
-
export { createAgentThreadAccessRule, assertConversationThread2, conversationThreadId2, agentThreadViews, publishArtifact2, prepareArtifactVersion2, storeArtifactVersion2, artifactVersionWarnings2, artifactAccessRule2, artifactQueryChecker2, createRuntimeArtifactAccessRule, createArtifactsRuntime };
|
|
2533
|
+
export { createAgentThreadAccessRule, assertConversationThread2, conversationThreadId2, agentThreadViews, announceArtifactUpdates, readLiveFiles2, storeLiveFiles2, sameArtifactFiles2, loadArtifactDocument2, readDocumentState2, firstArtifactDocument, withMergedWrite, undoneTurnDocuments, answerArtifactQueries2, parseArtifactQueryAnswers2, BOARD_PREVIEW_MEDIA_TYPES2, MAX_BOARD_PREVIEW_BYTES2, boardRenderKey, boardPreviewsOfCopy, boardsReadLiveData2, boardPreviews2, boardPreview2, missingBoardPreviews2, boardPreviewStatuses2, storeBoardPreviews2, publishArtifact2, prepareArtifactVersion2, storeArtifactVersion2, artifactVersionWarnings2, artifactAccessRule2, artifactTransactionRules, artifactQueryChecker2, artifactPreviewRequester, writeLiveArtifact2, createRuntimeArtifactAccessRule, transactionArtifactAccessRules, updatableArtifactIds, createArtifactsRuntime };
|
|
1417
2534
|
|
|
1418
|
-
//# debugId=
|
|
2535
|
+
//# debugId=AA04267CD72FF03864756E2164756E21
|